Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@bassist/utils

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@bassist/utils - npm Package Compare versions

Comparing version 0.11.2 to 0.12.0

./lib/index.min.js

4

lib/index.min.js
/**
* name: @bassist/utils
* version: v0.11.2
* version: v0.12.0
* description: Opinionated collection of common JavaScript / TypeScript utils by @chengpeiquan .

@@ -9,2 +9,2 @@ * author: chengpeiquan <chengpeiquan@chengpeiquan.com>

*/
(function(o,s){typeof exports=="object"&&typeof module<"u"?s(exports):typeof define=="function"&&define.amd?define(["exports"],s):(o=typeof globalThis<"u"?globalThis:o||self,s(o.Utils={}))})(this,function(o){"use strict";var Te=Object.defineProperty;var Ae=(o,s,l)=>s in o?Te(o,s,{enumerable:!0,configurable:!0,writable:!0,value:l}):o[s]=l;var M=(o,s,l)=>(Ae(o,typeof s!="symbol"?s+"":s,l),l);const s={isSupported:typeof navigator>"u"?!1:Boolean(navigator.clipboard),async copy(e){if(!this.isSupported)return!1;const i=e.innerText||e.value;return await this.write(i)},async cut(e){return!this.isSupported||!await this.copy(e)?!1:(e.value="",!0)},async read(){return this.isSupported?await navigator.clipboard.readText():""},async write(e){return this.isSupported?(await navigator.clipboard.writeText(e),!0):!1}};function l(){return typeof window<"u"?navigator.userAgent.toLowerCase():""}const p=["Mozilla/5.0 (Linux; Android 5.0; SM-G900P Build/LRX21T) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Mobile Safari/537.36","Mozilla/5.0 (Linux; Android 8.0; Pixel 2 Build/OPD3.170816.012) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Mobile Safari/537.36","Mozilla/5.0 (Linux; Android 8.0.0; Pixel 2 XL Build/OPD1.170816.004) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Mobile Safari/537.36","Mozilla/5.0 (Linux; U; Android 8.1.0; zh-cn; BLA-AL00 Build/HUAWEIBLA-AL00) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/57.0.2987.132 MQQBrowser/8.9 Mobile Safari/537.36","Mozilla/5.0 (Linux; U; Android 8.0.0; zh-CN; MHA-AL00 Build/HUAWEIMHA-AL00) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/57.0.2987.108 UCBrowser/12.1.4.994 Mobile Safari/537.36","Mozilla/5.0 (Linux; Android 8.1; EML-AL00 Build/HUAWEIEML-AL00; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/53.0.2785.143 Crosswalk/24.53.595.0 XWEB/358 MMWEBSDK/23 Mobile Safari/537.36 MicroMessenger/6.7.2.1340(0x2607023A) NetType/4G Language/zh_CN","Mozilla/5.0 (Linux; Android 5.1.1; vivo X6S A Build/LMY47V; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/57.0.2987.132 MQQBrowser/6.2 TBS/044207 Mobile Safari/537.36 MicroMessenger/6.7.3.1340(0x26070332) NetType/4G Language/zh_CN Process/tools","Mozilla/5.0 (Linux; U; Android 3.0; en-us; Xoom Build/HRI39) AppleWebKit/534.13 (KHTML, like Gecko) Version/4.0 Safari/534.13","MQQBrowser/26 Mozilla/5.0 (Linux; U; Android 2.3.7; zh-cn; MB200 Build/GRJ22; CyanogenMod-7) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1","Mozilla/5.0 (Linux; Android 7.1.1; MI 6 Build/NMF26X; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/57.0.2987.132 MQQBrowser/6.2 TBS/043807 Mobile Safari/537.36 MicroMessenger/6.6.1.1220(0x26060135) NetType/WIFI Language/zh_CN","Mozilla/5.0 (Linux; Android 5.1.1; vivo X6S A Build/LMY47V; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/53.0.2785.49 Mobile MQQBrowser/6.2 TBS/043632 Safari/537.36 MicroMessenger/6.6.1.1220(0x26060135) NetType/WIFI Language/zh_CN","Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_1 like Mac OS X) AppleWebKit/603.1.30 (KHTML, like Gecko) Version/10.0 Mobile/14E304 Safari/602.1","Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1","Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1","Mozilla/5.0 (iPad; CPU OS 11_0 like Mac OS X) AppleWebKit/604.1.34 (KHTML, like Gecko) Version/11.0 Mobile/15A5341f Safari/604.1","Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36","Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36","Mozilla/5.0 (Windows NT 6.3; WOW64; rv:53.0) Gecko/20100101 Firefox/53.0","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_5) AppleWebKit/603.2.4 (KHTML, like Gecko) Version/10.1.1 Safari/603.2.4","Mozilla/5.0 (Windows NT 10.0; WOW64; rv:53.0) Gecko/20100101 Firefox/53.0","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36","Mozilla/5.0 (Windows NT 6.1; WOW64; rv:53.0) Gecko/20100101 Firefox/53.0","Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36","Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36","Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:53.0) Gecko/20100101 Firefox/53.0","Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36","Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko","Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:53.0) Gecko/20100101 Firefox/53.0","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_4) AppleWebKit/603.1.30 (KHTML, like Gecko) Version/10.1 Safari/603.1.30","Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.86 Safari/537.36","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36","Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko","Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:53.0) Gecko/20100101 Firefox/53.0","Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.79 Safari/537.36 Edge/14.14393","Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.86 Safari/537.36","Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.86 Safari/537.36","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.86 Safari/537.36","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36","Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:53.0) Gecko/20100101 Firefox/53.0","Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.104 Safari/537.36","Mozilla/5.0 (Windows NT 6.1; rv:53.0) Gecko/20100101 Firefox/53.0","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/603.2.5 (KHTML, like Gecko) Version/10.1.1 Safari/603.2.5","Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/58.0.3029.110 Chrome/58.0.3029.110 Safari/537.36","Mozilla/5.0 (Windows NT 10.0; WOW64; rv:54.0) Gecko/20100101 Firefox/54.0","Mozilla/5.0 (Windows NT 6.1; Trident/7.0; rv:11.0) like Gecko","Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36 Edge/15.15063","Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36","Mozilla/5.0 (X11; Linux x86_64; rv:53.0) Gecko/20100101 Firefox/53.0","Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36 OPR/45.0.2552.888","Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:53.0) Gecko/20100101 Firefox/53.0","Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Firefox/45.0","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/603.2.5 (KHTML, like Gecko) Version/10.1.1 Safari/603.2.5","Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36","Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36","Mozilla/5.0 (iPad; CPU OS 10_3_2 like Mac OS X) AppleWebKit/603.2.4 (KHTML, like Gecko) Version/10.0 Mobile/14F89 Safari/602.1","Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Firefox/52.0","Mozilla/5.0 (Windows NT 6.1; WOW64; rv:54.0) Gecko/20100101 Firefox/54.0","Mozilla/5.0 (Windows NT 10.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36","Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36","Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:54.0) Gecko/20100101 Firefox/54.0","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/602.4.8 (KHTML, like Gecko) Version/10.0.3 Safari/602.4.8","Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36","Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.81 Safari/537.36 OPR/45.0.2552.812","Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.81 Safari/537.36","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36","Mozilla/5.0 (Windows NT 5.1; rv:52.0) Gecko/20100101 Firefox/52.0","Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0","Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.104 Safari/537.36","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36","Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.96 Safari/537.36","Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36","Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:54.0) Gecko/20100101 Firefox/54.0","Mozilla/5.0 (Windows NT 6.1; WOW64; rv:40.0) Gecko/20100101 Firefox/40.1","Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:53.0) Gecko/20100101 Firefox/53.0","Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36","Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.0; Trident/5.0; Trident/5.0)","Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Firefox/45.0","Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0; Trident/5.0)","Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.96 Safari/537.36","Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.96 Safari/537.36","Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:54.0) Gecko/20100101 Firefox/54.0","Mozilla/5.0 (iPad; CPU OS 10_3_1 like Mac OS X) AppleWebKit/603.1.30 (KHTML, like Gecko) Version/10.0 Mobile/14E304 Safari/602.1","Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Firefox/52.0","Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36","Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.104 Safari/537.36","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.104 Safari/537.36","Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:53.0) Gecko/20100101 Firefox/53.0","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/601.7.7 (KHTML, like Gecko) Version/9.1.2 Safari/601.7.7","Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; Touch; rv:11.0) like Gecko","Mozilla/5.0 (Windows NT 6.2; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36","Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; rv:11.0) like Gecko"],c=typeof window<"u",C=!c,A=/iPhone|phone|android|iPod|pad|iPad/i;function K(){return c?A.test(l()):!1}function v(){return c?!K():!1}const _=/Android/i.test(l()),y=/iPhone|iPod|iPad|iOS/i.test(l()),O=/uni-app|html5plus/.test(l()),H=/MicroMessenger/i.test(l()),N=/\sQQ|mqqbrowser|qzone|qqbrowser/i.test(l()),x=/mqqbrowser|qqbrowser/i.test(l()),F=/qzone\/.*_qz_([\d.]+)/i.test(l()),I=/(weibo).*weibo__([\d.]+)/i.test(l()),E=/(baiduboxapp)\/([\d.]+)/i.test(l());function X(e,{immediate:i}={immediate:!0}){c&&(i&&window.addEventListener("load",e,!1),window.addEventListener("orientationchange"in window?"orientationchange":"resize",e,!1))}function k(e){return Object.prototype.toString.call(e).slice(8,-1).toLowerCase()}function u(e){return k(e)==="object"}function f(e,i){return u(e)?Object.prototype.hasOwnProperty.call(e,i):!1}const W={};class P{constructor(i){M(this,"data");this.data={};const n=f(W,i);this.data=n?W[i].data:{},n||(W[i]=this)}get length(){return Object.keys(this.data).length}clear(){this.data={}}getItem(i){return f(this.data,i)?this.data[i]:null}setItem(i,n){this.data[i]=n}removeItem(i){f(this.data,i)&&delete this.data[i]}key(i){const n=Object.keys(this.data);return i>n.length?null:n[i]}}class b{constructor(i,n){M(this,"prefix");M(this,"storage");this.prefix=i,this.storage=c?window[n]:new P(i)}get(i){const n=this.storage.getItem(`${this.prefix}-${i}`);if(!n)return n;try{return n==="true"?!0:n==="false"?!1:n==="null"?null:n==="undefined"?void 0:JSON.parse(n)}catch{return n}}set(i,n){try{const r=k(n)==="string"?n:JSON.stringify(n);this.storage.setItem(`${this.prefix}-${i}`,r)}catch(t){console.log(t)}}remove(i){this.storage.removeItem(`${this.prefix}-${i}`)}clear(){this.list().forEach(n=>{this.remove(n)})}count(){return this.list().length}list(){if(!this.prefix)return[];const i=[],n=this.storage.length;for(let t=0;t<n;t++){const r=this.storage.key(t);r!=null&&r.startsWith(this.prefix)&&i.push(r.replace(`${this.prefix}-`,""))}return i}}class B extends b{constructor(i){super(i,"localStorage")}}class $ extends b{constructor(i){super(i,"sessionStorage")}}function L(){return c?window.matchMedia("(prefers-color-scheme: dark)").matches:!1}function z(){return c?window.matchMedia("(prefers-color-scheme: light)").matches:!1}function Q(){if(L())return"dark";if(z())return"light"}function R(e){return new Promise(i=>{setTimeout(()=>{i()},e)})}class U{constructor(i){M(this,"mime");this.mime=i}getMimeType(i){try{return i.startsWith("data")&&i.includes("base64")?i.split(",")[0].replace(/data:(.*);base64/,"$1"):this.mime.getType(i)||""}catch{return""}}getExtensionFromMimeType(i){try{return this.mime.getExtension(i)||""}catch{return""}}getExtension(i){try{const n=this.getMimeType(i);return this.getExtensionFromMimeType(n)}catch{return""}}}function V(e,i=!1){return e=e?String(e):"",e=e.replace(/[^\d]/g,""),e&&!i&&(e=parseInt(e)),String(e)}function q(e){if(e=String(e),!e)return"0.00";const i=e.split("."),n=i[0],t=i[1];return i.length===1?`${n}.00`:t.length===1?`${e}0`:Number(e).toFixed(2)}function D(e,i){return String(e).length>i?String(e).slice(0,i)+" ...":String(e)}function g([e,...i]){return e?e.toUpperCase()+i.join(""):""}function j(e){return e?e.replace(/([A-Z])/g," $1").trim().split(" ").join("-").replace(/_/g,"-").toLowerCase():""}function w([e,...i]){return e?(e.toLowerCase()+i.join("")).replace(/[-_](\w)/g,(t,r)=>r?r.toUpperCase():""):""}function Z(e){return e?g(w(e)):""}function J(e){const i=/[\\^$.*+?()[\]{}|]/g,n=RegExp(i.source);return e&&n.test(e)?e.replace(i,"\\$&"):e}function S(e){if(!Array.isArray(e)&&!u(e))return e;if(Array.isArray(e))return e.map(t=>S(t));const i=Object.keys(e).sort(),n={};return i.forEach(t=>{n[t]=S(e[t])}),n}function Y({primaryKey:e,list:i}){const n=new Map;i.forEach(r=>{const d=String(r[e]);n.has(d)||n.set(d,r)});const t=[];return n.forEach(r=>{t.push(r)}),t}function ee(e,i){if(!u)return e;const n={};for(const t in e)f(e,t)&&!i.includes(t)&&(n[t]=e[t]);return n}function ie({type:e,id:i,resource:n}){return new Promise((t,r)=>{if(!c||document.querySelector(`#${i}`)){r();return}function d(a){a.addEventListener("load",t),a.addEventListener("error",r),a.addEventListener("abort",r)}switch(e){case"js":{const a=document.createElement("script");a.id=i,a.async=!0,a.src=n,d(a),document.head.appendChild(a);break}case"css":{const a=document.createElement("link");a.id=i,a.rel="stylesheet",a.href=n,d(a),document.head.appendChild(a);break}case"style":{const a=document.createElement("style");a.id=i,d(a),document.head.appendChild(a),a.appendChild(document.createTextNode(n));break}}})}function m(e){let i="";if(c){const{search:t}=window.location;i=t}if(typeof e=="string"&&e.startsWith("http")){const t=e.indexOf("?");i=t===-1?"":e.slice(t)}if(i.includes("#")){const t=i.indexOf("#");i=i.slice(0,t)}if(!i.length)return{};const n={};return i.slice(1).split("&").forEach(t=>{const[r,d]=t.split("=");n[r]=decodeURIComponent(d)}),n}function oe(e){const i=m(e),n={};return Object.keys(i).forEach(r=>{r!=="path"&&(n[r]=i[r])}),{path:i.path||"",params:n}}function ne(e,i){return m(i)[e]||""}function te(e){return u(e)?Object.keys(e).map(i=>`${i}=${encodeURIComponent(String(e[i]))}`).join("&"):""}function T(e=0,i=100,n="round"){return Math[n](Math.random()*(i-e)+e)}function re(e=10){const i="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let n="",t=e;const r=i.length;for(;t--;)n+=i[Math.random()*r|0];return n}function ae(){const e=T(0,1);return[!0,!1][e]}function le(e){if(!Array.isArray(e))return e;for(let i=e.length-1;i>0;i--){const n=Math.floor(Math.random()*(i+1)),t=e[i];e[i]=e[n],e[n]=t}return e}function se(){const e=T(0,p.length-1);return p[e]}function ce(e){return/^1[3456789]\d{9}$/.test(String(e))}function de(e){return/^[A-Za-z\d]+([-_.][A-Za-z\d]+)*@([A-Za-z\d]+[-.])+[A-Za-z\d]{2,4}$/.test(e)}function ue(e){return/https?:\/\/[\w-]+(\.[\w-]+){1,2}(\/[\w-]{3,6}){0,2}(\?[\w_]{4,6}=[\w_]{4,6}(&[\w_]{4,6}=[\w_]{4,6}){0,2})?/.test(e)}function fe(e){const i=/^([1-6][1-9]|50)\d{4}(18|19|20)\d{2}((0[1-9])|10|11|12)(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/,n=/^([1-6][1-9]|50)\d{4}\d{2}((0[1-9])|10|11|12)(([0-2][1-9])|10|20|30|31)\d{3}$/;return i.test(e)||n.test(e)}function Me(e){return/^([1-9]{1})(\d{15}|\d{16}|\d{18})$/.test(e)}function he(e){return/^((25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(25[0-5]|2[0-4]\d|[01]?\d\d?)$/.test(e)}function pe(e){return/^([\da-fA-F]{1,4}:){6}((25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(25[0-5]|2[0-4]\d|[01]?\d\d?)$|^::([\da-fA-F]{1,4}:){0,4}((25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(25[0-5]|2[0-4]\d|[01]?\d\d?)$|^([\da-fA-F]{1,4}:):([\da-fA-F]{1,4}:){0,3}((25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(25[0-5]|2[0-4]\d|[01]?\d\d?)$|^([\da-fA-F]{1,4}:){2}:([\da-fA-F]{1,4}:){0,2}((25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(25[0-5]|2[0-4]\d|[01]?\d\d?)$|^([\da-fA-F]{1,4}:){3}:([\da-fA-F]{1,4}:){0,1}((25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(25[0-5]|2[0-4]\d|[01]?\d\d?)$|^([\da-fA-F]{1,4}:){4}:((25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(25[0-5]|2[0-4]\d|[01]?\d\d?)$|^([\da-fA-F]{1,4}:){7}[\da-fA-F]{1,4}$|^:((:[\da-fA-F]{1,4}){1,6}|:)$|^[\da-fA-F]{1,4}:((:[\da-fA-F]{1,4}){1,5}|:)$|^([\da-fA-F]{1,4}:){2}((:[\da-fA-F]{1,4}){1,4}|:)$|^([\da-fA-F]{1,4}:){3}((:[\da-fA-F]{1,4}){1,3}|:)$|^([\da-fA-F]{1,4}:){4}((:[\da-fA-F]{1,4}){1,2}|:)$|^([\da-fA-F]{1,4}:){5}:([\da-fA-F]{1,4})?$|^([\da-fA-F]{1,4}:){6}:$/.test(e)}function G(){try{return process.env.NODE_ENV}catch{return}}const ke=G();function h(e){try{return process.env.NODE_ENV===e}catch{return!1}}const We=h("development"),Se=h("test"),me=h("production");o.FileInfo=U,o.LocalStorage=B,o.SessionStorage=$,o.camelCase=w,o.capitalize=g,o.checkRuntimeEnv=h,o.clipboard=s,o.ellipsis=D,o.escapeRegExp=J,o.excludeFields=ee,o.extractNumber=V,o.extractQueryInfo=oe,o.formatAmount=q,o.getDataType=k,o.getPrefersColorScheme=Q,o.getQuery=ne,o.getRuntimeEnv=G,o.getUserAgent=l,o.hasKey=f,o.isAndroid=_,o.isBaidu=E,o.isBankCard=Me,o.isBrowser=c,o.isDark=L,o.isDesktop=v,o.isDevRuntime=We,o.isEmail=de,o.isIOS=y,o.isIPv4=he,o.isIPv6=pe,o.isIdCard=fe,o.isLight=z,o.isMob=ce,o.isMobile=K,o.isObject=u,o.isProdRuntime=me,o.isQQ=N,o.isQQBrowser=x,o.isQzone=F,o.isServer=C,o.isTestRuntime=Se,o.isUniApp=O,o.isUrl=ue,o.isWeibo=I,o.isWeixin=H,o.kebabCase=j,o.loadRes=ie,o.mobileDevicesRegExp=A,o.parseQuery=m,o.pascalCase=Z,o.randomBoolean=ae,o.randomNumber=T,o.randomString=re,o.randomUserAgent=se,o.runtimeEnv=ke,o.shuffle=le,o.sleep=R,o.sortKeys=S,o.stringifyQuery=te,o.unique=Y,o.userAgents=p,o.watchResize=X,Object.defineProperty(o,Symbol.toStringTag,{value:"Module"})});
(function(t,c){typeof exports=="object"&&typeof module<"u"?c(exports):typeof define=="function"&&define.amd?define(["exports"],c):(t=typeof globalThis<"u"?globalThis:t||self,c(t.Utils={}))})(this,function(t){"use strict";var ze=Object.defineProperty;var we=(t,c,l)=>c in t?ze(t,c,{enumerable:!0,configurable:!0,writable:!0,value:l}):t[c]=l;var h=(t,c,l)=>(we(t,typeof c!="symbol"?c+"":c,l),l);const c={isSupported:typeof navigator>"u"?!1:!!navigator.clipboard,async copy(e){if(!this.isSupported)return!1;const i=e.innerText||e.value;return await this.write(i)},async cut(e){return!this.isSupported||!await this.copy(e)?!1:(e.value="",!0)},async read(){return this.isSupported?await navigator.clipboard.readText():""},async write(e){return this.isSupported?(await navigator.clipboard.writeText(e),!0):!1}};function l(){return typeof window<"u"?navigator.userAgent.toLowerCase():""}const k=["Mozilla/5.0 (Linux; Android 5.0; SM-G900P Build/LRX21T) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Mobile Safari/537.36","Mozilla/5.0 (Linux; Android 8.0; Pixel 2 Build/OPD3.170816.012) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Mobile Safari/537.36","Mozilla/5.0 (Linux; Android 8.0.0; Pixel 2 XL Build/OPD1.170816.004) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Mobile Safari/537.36","Mozilla/5.0 (Linux; U; Android 8.1.0; zh-cn; BLA-AL00 Build/HUAWEIBLA-AL00) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/57.0.2987.132 MQQBrowser/8.9 Mobile Safari/537.36","Mozilla/5.0 (Linux; U; Android 8.0.0; zh-CN; MHA-AL00 Build/HUAWEIMHA-AL00) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/57.0.2987.108 UCBrowser/12.1.4.994 Mobile Safari/537.36","Mozilla/5.0 (Linux; Android 8.1; EML-AL00 Build/HUAWEIEML-AL00; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/53.0.2785.143 Crosswalk/24.53.595.0 XWEB/358 MMWEBSDK/23 Mobile Safari/537.36 MicroMessenger/6.7.2.1340(0x2607023A) NetType/4G Language/zh_CN","Mozilla/5.0 (Linux; Android 5.1.1; vivo X6S A Build/LMY47V; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/57.0.2987.132 MQQBrowser/6.2 TBS/044207 Mobile Safari/537.36 MicroMessenger/6.7.3.1340(0x26070332) NetType/4G Language/zh_CN Process/tools","Mozilla/5.0 (Linux; U; Android 3.0; en-us; Xoom Build/HRI39) AppleWebKit/534.13 (KHTML, like Gecko) Version/4.0 Safari/534.13","MQQBrowser/26 Mozilla/5.0 (Linux; U; Android 2.3.7; zh-cn; MB200 Build/GRJ22; CyanogenMod-7) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1","Mozilla/5.0 (Linux; Android 7.1.1; MI 6 Build/NMF26X; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/57.0.2987.132 MQQBrowser/6.2 TBS/043807 Mobile Safari/537.36 MicroMessenger/6.6.1.1220(0x26060135) NetType/WIFI Language/zh_CN","Mozilla/5.0 (Linux; Android 5.1.1; vivo X6S A Build/LMY47V; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/53.0.2785.49 Mobile MQQBrowser/6.2 TBS/043632 Safari/537.36 MicroMessenger/6.6.1.1220(0x26060135) NetType/WIFI Language/zh_CN","Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_1 like Mac OS X) AppleWebKit/603.1.30 (KHTML, like Gecko) Version/10.0 Mobile/14E304 Safari/602.1","Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1","Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1","Mozilla/5.0 (iPad; CPU OS 11_0 like Mac OS X) AppleWebKit/604.1.34 (KHTML, like Gecko) Version/11.0 Mobile/15A5341f Safari/604.1","Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36","Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36","Mozilla/5.0 (Windows NT 6.3; WOW64; rv:53.0) Gecko/20100101 Firefox/53.0","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_5) AppleWebKit/603.2.4 (KHTML, like Gecko) Version/10.1.1 Safari/603.2.4","Mozilla/5.0 (Windows NT 10.0; WOW64; rv:53.0) Gecko/20100101 Firefox/53.0","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36","Mozilla/5.0 (Windows NT 6.1; WOW64; rv:53.0) Gecko/20100101 Firefox/53.0","Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36","Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36","Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:53.0) Gecko/20100101 Firefox/53.0","Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36","Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko","Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:53.0) Gecko/20100101 Firefox/53.0","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_4) AppleWebKit/603.1.30 (KHTML, like Gecko) Version/10.1 Safari/603.1.30","Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.86 Safari/537.36","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36","Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko","Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:53.0) Gecko/20100101 Firefox/53.0","Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.79 Safari/537.36 Edge/14.14393","Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.86 Safari/537.36","Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.86 Safari/537.36","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.86 Safari/537.36","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36","Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:53.0) Gecko/20100101 Firefox/53.0","Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.104 Safari/537.36","Mozilla/5.0 (Windows NT 6.1; rv:53.0) Gecko/20100101 Firefox/53.0","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/603.2.5 (KHTML, like Gecko) Version/10.1.1 Safari/603.2.5","Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/58.0.3029.110 Chrome/58.0.3029.110 Safari/537.36","Mozilla/5.0 (Windows NT 10.0; WOW64; rv:54.0) Gecko/20100101 Firefox/54.0","Mozilla/5.0 (Windows NT 6.1; Trident/7.0; rv:11.0) like Gecko","Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36 Edge/15.15063","Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36","Mozilla/5.0 (X11; Linux x86_64; rv:53.0) Gecko/20100101 Firefox/53.0","Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36 OPR/45.0.2552.888","Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:53.0) Gecko/20100101 Firefox/53.0","Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Firefox/45.0","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/603.2.5 (KHTML, like Gecko) Version/10.1.1 Safari/603.2.5","Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36","Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36","Mozilla/5.0 (iPad; CPU OS 10_3_2 like Mac OS X) AppleWebKit/603.2.4 (KHTML, like Gecko) Version/10.0 Mobile/14F89 Safari/602.1","Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Firefox/52.0","Mozilla/5.0 (Windows NT 6.1; WOW64; rv:54.0) Gecko/20100101 Firefox/54.0","Mozilla/5.0 (Windows NT 10.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36","Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36","Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:54.0) Gecko/20100101 Firefox/54.0","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/602.4.8 (KHTML, like Gecko) Version/10.0.3 Safari/602.4.8","Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36","Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.81 Safari/537.36 OPR/45.0.2552.812","Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.81 Safari/537.36","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36","Mozilla/5.0 (Windows NT 5.1; rv:52.0) Gecko/20100101 Firefox/52.0","Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0","Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.104 Safari/537.36","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36","Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.96 Safari/537.36","Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36","Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:54.0) Gecko/20100101 Firefox/54.0","Mozilla/5.0 (Windows NT 6.1; WOW64; rv:40.0) Gecko/20100101 Firefox/40.1","Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:53.0) Gecko/20100101 Firefox/53.0","Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36","Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.0; Trident/5.0; Trident/5.0)","Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Firefox/45.0","Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0; Trident/5.0)","Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.96 Safari/537.36","Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.96 Safari/537.36","Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:54.0) Gecko/20100101 Firefox/54.0","Mozilla/5.0 (iPad; CPU OS 10_3_1 like Mac OS X) AppleWebKit/603.1.30 (KHTML, like Gecko) Version/10.0 Mobile/14E304 Safari/602.1","Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Firefox/52.0","Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36","Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.104 Safari/537.36","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.104 Safari/537.36","Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:53.0) Gecko/20100101 Firefox/53.0","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/601.7.7 (KHTML, like Gecko) Version/9.1.2 Safari/601.7.7","Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; Touch; rv:11.0) like Gecko","Mozilla/5.0 (Windows NT 6.2; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36","Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; rv:11.0) like Gecko"],d=typeof window<"u",y=!d,K=/iPhone|phone|android|iPod|pad|iPad/i;function b(){return d?K.test(l()):!1}function v(){return d?!b():!1}const _=/Android/i.test(l()),O=/iPhone|iPod|iPad|iOS/i.test(l()),H=/uni-app|html5plus/.test(l()),N=/MicroMessenger/i.test(l()),F=/\sQQ|mqqbrowser|qzone|qqbrowser/i.test(l()),x=/mqqbrowser|qqbrowser/i.test(l()),$=/qzone\/.*_qz_([\d.]+)/i.test(l()),I=/(weibo).*weibo__([\d.]+)/i.test(l()),E=/(baiduboxapp)\/([\d.]+)/i.test(l());function X(e,{immediate:i}={immediate:!0}){d&&(i&&window.addEventListener("load",e,!1),window.addEventListener("orientationchange"in window?"orientationchange":"resize",e,!1))}function W(e){return Object.prototype.toString.call(e).slice(8,-1).toLowerCase()}function f(e){return W(e)==="object"}function M(e,i){return f(e)?Object.prototype.hasOwnProperty.call(e,i):!1}const m={};class P{constructor(i){h(this,"data");this.data={};const o=M(m,i);this.data=o?m[i].data:{},o||(m[i]=this)}get length(){return Object.keys(this.data).length}clear(){this.data={}}getItem(i){return M(this.data,i)?this.data[i]:null}setItem(i,o){this.data[i]=o}removeItem(i){M(this.data,i)&&delete this.data[i]}key(i){const o=Object.keys(this.data);return i>o.length?null:o[i]}}class g{constructor(i,o){h(this,"prefix");h(this,"storage");this.prefix=i,this.storage=d?window[o]:new P(i)}get(i){const o=this.storage.getItem(`${this.prefix}-${i}`);if(!o)return o;try{return o==="true"?!0:o==="false"?!1:o==="null"?null:o==="undefined"?void 0:JSON.parse(o)}catch{return o}}set(i,o){try{const r=W(o)==="string"?o:JSON.stringify(o);this.storage.setItem(`${this.prefix}-${i}`,r)}catch(n){console.log(n)}}remove(i){this.storage.removeItem(`${this.prefix}-${i}`)}clear(){this.list().forEach(o=>{this.remove(o)})}count(){return this.list().length}list(){if(!this.prefix)return[];const i=[],o=this.storage.length;for(let n=0;n<o;n++){const r=this.storage.key(n);r!=null&&r.startsWith(this.prefix)&&i.push(r.replace(`${this.prefix}-`,""))}return i}}class B extends g{constructor(i){super(i,"localStorage")}}class Q extends g{constructor(i){super(i,"sessionStorage")}}function L(){return d?window.matchMedia("(prefers-color-scheme: dark)").matches:!1}function z(){return d?window.matchMedia("(prefers-color-scheme: light)").matches:!1}function R(){if(L())return"dark";if(z())return"light"}class U{constructor(i){h(this,"mime");this.mime=i}getMimeType(i){try{return i.startsWith("data")&&i.includes("base64")?i.split(",")[0].replace(/data:(.*);base64/,"$1"):this.mime.getType(i)||""}catch{return""}}getExtensionFromMimeType(i){try{return this.mime.getExtension(i)||""}catch{return""}}getExtension(i){try{const o=this.getMimeType(i);return this.getExtensionFromMimeType(o)}catch{return""}}}function D(e,i=!1){return e=e?String(e):"",e=e.replace(/[^\d]/g,""),e&&!i&&(e=parseInt(e)),String(e)}function V(e){if(e=String(e),!e)return"0.00";const i=e.split("."),o=i[0],n=i[1];return i.length===1?`${o}.00`:n.length===1?`${e}0`:Number(e).toFixed(2)}function q(e,i){return String(e).length>i?String(e).slice(0,i)+" ...":String(e)}function w([e,...i]){return e?e.toUpperCase()+i.join(""):""}function j(e){return e?e.replace(/([A-Z])/g," $1").trim().split(" ").join("-").replace(/_/g,"-").toLowerCase():""}function G([e,...i]){return e?(e.toLowerCase()+i.join("")).replace(/[-_](\w)/g,(n,r)=>r?r.toUpperCase():""):""}function Z(e){return e?w(G(e)):""}function J(e){const i=/[\\^$.*+?()[\]{}|]/g,o=RegExp(i.source);return e&&o.test(e)?e.replace(i,"\\$&"):e}function S(e){if(!Array.isArray(e)&&!f(e))return e;if(Array.isArray(e))return e.map(n=>S(n));const i=Object.keys(e).sort(),o={};return i.forEach(n=>{o[n]=S(e[n])}),o}function Y({primaryKey:e,list:i}){const o=new Map;i.forEach(r=>{const s=String(r[e]);o.has(s)||o.set(s,r)});const n=[];return o.forEach(r=>{n.push(r)}),n}function ee(e,i){if(!f)return e;const o={};for(const n in e)M(e,n)&&!i.includes(n)&&(o[n]=e[n]);return o}function ie(e,i){const o=new Date(e),n=o.getFullYear(),r=("0"+(o.getMonth()+1)).slice(-2),s=("0"+o.getDate()).slice(-2),a=("0"+o.getHours()).slice(-2),u=("0"+o.getMinutes()).slice(-2),Le=("0"+o.getSeconds()).slice(-2);return i?`${n}-${r}-${s}`:`${n}-${r}-${s} ${a}:${u}:${Le}`}function oe(e,i={days:"天",hours:"小时",minutes:"分钟",seconds:"秒"}){const o=Math.floor(e/1e3),n=Math.floor(o/(3600*24)),r=Math.floor(o%(3600*24)/3600),s=Math.floor(o%3600/60),a=Math.floor(o%60),u=[];return n>0&&u.push(`${n} ${i.days}`),r>0&&u.push(`${r} ${i.hours}`),s>0&&u.push(`${s} ${i.minutes}`),a>0&&u.push(`${a} ${i.seconds}`),u.length===0?`0 ${i.seconds}`:u.join(" ")}function te({type:e,id:i,resource:o}){return new Promise((n,r)=>{if(!d||document.querySelector(`#${i}`)){r();return}function s(a){a.addEventListener("load",n),a.addEventListener("error",r),a.addEventListener("abort",r)}switch(e){case"js":{const a=document.createElement("script");a.id=i,a.async=!0,a.src=o,s(a),document.head.appendChild(a);break}case"css":{const a=document.createElement("link");a.id=i,a.rel="stylesheet",a.href=o,s(a),document.head.appendChild(a);break}case"style":{const a=document.createElement("style");a.id=i,s(a),document.head.appendChild(a),a.appendChild(document.createTextNode(o));break}}})}function ne(e){return new Promise(i=>{setTimeout(()=>{i()},e)})}function re(e,i=200){let o;return function(...n){const r=this;clearTimeout(o),o=setTimeout(function(){e.apply(r,n)},i)}}function ae(e,i){let o,n=0;return function(...r){const s=Date.now(),a=i-(s-n);a<=0?(clearTimeout(o),n=s,e.apply(this,r)):o||(o=setTimeout(()=>{n=Date.now(),o=void 0,e.apply(this,r)},a))}}function T(e){let i="";if(d){const{search:n}=window.location;i=n}if(typeof e=="string"&&e.startsWith("http")){const n=e.indexOf("?");i=n===-1?"":e.slice(n)}if(i.includes("#")){const n=i.indexOf("#");i=i.slice(0,n)}if(!i.length)return{};const o={};return i.slice(1).split("&").forEach(n=>{const[r,s]=n.split("=");o[r]=decodeURIComponent(s)}),o}function le(e){const i=T(e),o={};return Object.keys(i).forEach(r=>{r!=="path"&&(o[r]=i[r])}),{path:i.path||"",params:o}}function se(e,i){return T(i)[e]||""}function ce(e){return f(e)?Object.keys(e).map(i=>`${i}=${encodeURIComponent(String(e[i]))}`).join("&"):""}function A(e=0,i=100,o="round"){return Math[o](Math.random()*(i-e)+e)}function de(e=10){const i="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let o="",n=e;const r=i.length;for(;n--;)o+=i[Math.random()*r|0];return o}function ue(){const e=A(0,1);return[!0,!1][e]}function fe(e){if(!Array.isArray(e))return e;for(let i=e.length-1;i>0;i--){const o=Math.floor(Math.random()*(i+1)),n=e[i];e[i]=e[o],e[o]=n}return e}function Me(){const e=A(0,k.length-1);return k[e]}function he(e){return/^1[3456789]\d{9}$/.test(String(e))}function pe(e){return/^[A-Za-z\d]+([-_.][A-Za-z\d]+)*@([A-Za-z\d]+[-.])+[A-Za-z\d]{2,4}$/.test(e)}function ke(e){return/https?:\/\/[\w-]+(\.[\w-]+){1,2}(\/[\w-]{3,6}){0,2}(\?[\w_]{4,6}=[\w_]{4,6}(&[\w_]{4,6}=[\w_]{4,6}){0,2})?/.test(e)}function We(e){const i=/^([1-6][1-9]|50)\d{4}(18|19|20)\d{2}((0[1-9])|10|11|12)(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/,o=/^([1-6][1-9]|50)\d{4}\d{2}((0[1-9])|10|11|12)(([0-2][1-9])|10|20|30|31)\d{3}$/;return i.test(e)||o.test(e)}function me(e){return/^([1-9]{1})(\d{15}|\d{16}|\d{18})$/.test(e)}function Se(e){return/^((25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(25[0-5]|2[0-4]\d|[01]?\d\d?)$/.test(e)}function Te(e){return/^([\da-fA-F]{1,4}:){6}((25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(25[0-5]|2[0-4]\d|[01]?\d\d?)$|^::([\da-fA-F]{1,4}:){0,4}((25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(25[0-5]|2[0-4]\d|[01]?\d\d?)$|^([\da-fA-F]{1,4}:):([\da-fA-F]{1,4}:){0,3}((25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(25[0-5]|2[0-4]\d|[01]?\d\d?)$|^([\da-fA-F]{1,4}:){2}:([\da-fA-F]{1,4}:){0,2}((25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(25[0-5]|2[0-4]\d|[01]?\d\d?)$|^([\da-fA-F]{1,4}:){3}:([\da-fA-F]{1,4}:){0,1}((25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(25[0-5]|2[0-4]\d|[01]?\d\d?)$|^([\da-fA-F]{1,4}:){4}:((25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(25[0-5]|2[0-4]\d|[01]?\d\d?)$|^([\da-fA-F]{1,4}:){7}[\da-fA-F]{1,4}$|^:((:[\da-fA-F]{1,4}){1,6}|:)$|^[\da-fA-F]{1,4}:((:[\da-fA-F]{1,4}){1,5}|:)$|^([\da-fA-F]{1,4}:){2}((:[\da-fA-F]{1,4}){1,4}|:)$|^([\da-fA-F]{1,4}:){3}((:[\da-fA-F]{1,4}){1,3}|:)$|^([\da-fA-F]{1,4}:){4}((:[\da-fA-F]{1,4}){1,2}|:)$|^([\da-fA-F]{1,4}:){5}:([\da-fA-F]{1,4})?$|^([\da-fA-F]{1,4}:){6}:$/.test(e)}function C(){try{return process.env.NODE_ENV}catch{return}}const Ae=C();function p(e){try{return process.env.NODE_ENV===e}catch{return!1}}const Ke=p("development"),be=p("test"),ge=p("production");t.FileInfo=U,t.LocalStorage=B,t.SessionStorage=Q,t.camelCase=G,t.capitalize=w,t.checkRuntimeEnv=p,t.clipboard=c,t.debounce=re,t.ellipsis=q,t.escapeRegExp=J,t.excludeFields=ee,t.extractNumber=D,t.extractQueryInfo=le,t.formatAmount=V,t.formatDuration=oe,t.formatTime=ie,t.getDataType=W,t.getPrefersColorScheme=R,t.getQuery=se,t.getRuntimeEnv=C,t.getUserAgent=l,t.hasKey=M,t.isAndroid=_,t.isBaidu=E,t.isBankCard=me,t.isBrowser=d,t.isDark=L,t.isDesktop=v,t.isDevRuntime=Ke,t.isEmail=pe,t.isIOS=O,t.isIPv4=Se,t.isIPv6=Te,t.isIdCard=We,t.isLight=z,t.isMob=he,t.isMobile=b,t.isObject=f,t.isProdRuntime=ge,t.isQQ=F,t.isQQBrowser=x,t.isQzone=$,t.isServer=y,t.isTestRuntime=be,t.isUniApp=H,t.isUrl=ke,t.isWeibo=I,t.isWeixin=N,t.kebabCase=j,t.loadRes=te,t.mobileDevicesRegExp=K,t.parseQuery=T,t.pascalCase=Z,t.randomBoolean=ue,t.randomNumber=A,t.randomString=de,t.randomUserAgent=Me,t.runtimeEnv=Ae,t.shuffle=fe,t.sleep=ne,t.sortKeys=S,t.stringifyQuery=ce,t.throttle=ae,t.unique=Y,t.userAgents=k,t.watchResize=X,Object.defineProperty(t,Symbol.toStringTag,{value:"Module"})});
{
"name": "@bassist/utils",
"version": "0.11.2",
"version": "0.12.0",
"description": "Opinionated collection of common JavaScript / TypeScript utils by @chengpeiquan .",

@@ -5,0 +5,0 @@ "author": "chengpeiquan <chengpeiquan@chengpeiquan.com>",

@@ -145,8 +145,2 @@ /**

/**
* Put the program to sleep for a while
*
* @category delay
*/
export declare function sleep(ms: number): Promise<void>;
/**
* @category device

@@ -219,2 +213,3 @@ */

* Get file info via `mime` package
*
* @category file

@@ -231,3 +226,5 @@ */

* Extract numbers from text
*
* @param text - Text to be processed
*
* @param startsWithZero - Preserve the 0-starting format like `002`

@@ -240,2 +237,3 @@ *

* Format amount with two decimal places
*
* @param amount - Amount to be processed

@@ -248,4 +246,7 @@ *

* Add ellipses to words that are out of length
*
* @param word - The sentence to be processed
*
* @param limit - The upper limit
*
* @returns The processed word

@@ -282,2 +283,3 @@ *

* Escaping special characters for regular expressions
*
* @copyright lodash.escaperegexp

@@ -301,3 +303,3 @@ *

*/
primaryKey: string;
primaryKey: keyof T;
/**

@@ -316,5 +318,9 @@ * he original data list

* Exclude specified fields from the object
*
* @tips Only handle first-level fields
*
* @param object - An object as data source
*
* @param fields - Field names to exclude
*
* @returns A processed new object

@@ -326,2 +332,43 @@ *

/**
* Format the time as `yyyy-MM-dd HH:mm:ss`
*
* @description Note:
* If the date separator is `-`, it will be parsed as
* a standard ISO 8601 formatted date string (e.g. 2023-01-01)
*
* If the date separator is `/`, it will be parsed according to
* the non-standard date string format (e.g. 2023/01/01 )
*
* This will result in inconsistent processing, please be aware of such cases.
* e.g. `+new Date('2023/01/01') !== +new Date('2023-01-01')`
*
* @param time - A timestamp or a date object
*
* @param dateOnly - If `true` , only returns `yyyy-MM-dd`
*
* @category format
*/
export declare function formatTime(time: number | Date, dateOnly?: boolean): string;
/**
* @category format
*/
export interface FormatDurationUnit {
days: string;
hours: string;
minutes: string;
seconds: string;
}
/**
* Generally used to format the display of two time gaps, such as countdown
*
* @param timestamp - Timestamp with two time gaps
*
* @param units - Time units,
* different languages can be passed in when i18n is needed,
* the default is Simplified Chinese
*
* @category format
*/
export declare function formatDuration(timestamp: number, units?: FormatDurationUnit): string;
/**
* @category network

@@ -343,2 +390,21 @@ */

/**
* Put the program to sleep for a while
*
* @category performance
*/
export declare function sleep(ms: number): Promise<void>;
/**
* When an event is triggered frequently,
* only execute the event processing function once.
*
* @category performance
*/
export declare function debounce<T extends (...args: any[]) => void>(func: T, wait?: number): (...args: Parameters<T>) => void;
/**
* Can control how often a function is called within a specified time interval
*
* @category performance
*/
export declare function throttle<T extends (...args: any[]) => void>(func: T, wait: number): (this: ThisParameterType<T>, ...args: Parameters<T>) => void;
/**
* @category query

@@ -353,4 +419,6 @@ */

* Parse URL Query parameters
*
* @param url - By default, it is extracted from the browser URL,
* and this parameter can be parsed from the specified URL
*
* @returns Query parameter object,

@@ -364,2 +432,3 @@ * will convert `key1=value1&key2=value2` into an object

* Extract parameter information from URL Query
*
* @returns An object containing the request path and parameters object

@@ -377,3 +446,5 @@ * `path`: Jump path, the same as the routing name in the Web App

* Get the specified Query parameter
*
* @param key - The parameter key name to get
*
* @param url - By default, it is extracted from the browser URL,

@@ -387,2 +458,3 @@ * and this parameter can be parsed from the specified URL

* Serialize Query parameters information
*
* @param queryInfoObject - The object of the Query parameter to use for serialization

@@ -395,4 +467,7 @@ *

* Generate random number
*
* @param min - The minimum value in the range
*
* @param max - The maximum value in the range
*
* @param roundingType - Round the result

@@ -405,2 +480,3 @@ *

* Generate random string
*
* @param length - The length of the string to be returned

@@ -479,2 +555,3 @@ *

* Get current runtime environment
*
* @precondition The `cross-env` package is installed

@@ -493,2 +570,3 @@ *

* Determine whether the specified runtime environment is currently
*
* @precondition The `cross-env` package is installed

@@ -495,0 +573,0 @@ *

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc