@lntvow/utils 4.0.14 → 4.0.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/utils.cjs-bundler.cjs +849 -1
- package/dist/utils.esm-browser.mjs +1165 -1
- package/dist/utils.esm-bundler.d.ts +11 -0
- package/dist/utils.esm-bundler.mjs +731 -1
- package/dist/utils.global.js +1177 -1
- package/package.json +1 -1
|
@@ -1 +1,1165 @@
|
|
|
1
|
-
var zt=Object.create;var vt=Object.defineProperty;var Kt=Object.getOwnPropertyDescriptor;var Vt=Object.getOwnPropertyNames;var Xt=Object.getPrototypeOf,qt=Object.prototype.hasOwnProperty;var Tt=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var Bt=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Vt(e))!qt.call(t,i)&&i!==n&&vt(t,i,{get:()=>e[i],enumerable:!(r=Kt(e,i))||r.enumerable});return t};var ut=(t,e,n)=>(n=t!=null?zt(Xt(t)):{},Bt(e||!t||!t.__esModule?vt(n,"default",{value:t,enumerable:!0}):n,t));var $t=Tt((yt,bt)=>{"use strict";(function(t,e){typeof yt=="object"&&typeof bt<"u"?bt.exports=e():typeof define=="function"&&define.amd?define(e):(t=typeof globalThis<"u"?globalThis:t||self).dayjs=e()})(yt,function(){"use strict";var t=1e3,e=6e4,n=36e5,r="millisecond",i="second",y="minute",l="hour",b="day",h="week",v="month",X="quarter",I="year",_="date",it="Invalid Date",p=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,x=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,O={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(c){var s=["th","st","nd","rd"],o=c%100;return"["+c+(s[(o-20)%10]||s[o]||s[0])+"]"}},M=function(c,s,o){var u=String(c);return!u||u.length>=s?c:""+Array(s+1-u.length).join(o)+c},H={s:M,z:function(c){var s=-c.utcOffset(),o=Math.abs(s),u=Math.floor(o/60),a=o%60;return(s<=0?"+":"-")+M(u,2,"0")+":"+M(a,2,"0")},m:function c(s,o){if(s.date()<o.date())return-c(o,s);var u=12*(o.year()-s.year())+(o.month()-s.month()),a=s.clone().add(u,v),f=o-a<0,m=s.clone().add(u+(f?-1:1),v);return+(-(u+(o-a)/(f?a-m:m-a))||0)},a:function(c){return c<0?Math.ceil(c)||0:Math.floor(c)},p:function(c){return{M:v,y:I,w:h,d:b,D:_,h:l,m:y,s:i,ms:r,Q:X}[c]||String(c||"").toLowerCase().replace(/s$/,"")},u:function(c){return c===void 0}},Y="en",P={};P[Y]=O;var K="$isDayjsObject",N=function(c){return c instanceof k||!(!c||!c[K])},R=function c(s,o,u){var a;if(!s)return Y;if(typeof s=="string"){var f=s.toLowerCase();P[f]&&(a=f),o&&(P[f]=o,a=f);var m=s.split("-");if(!a&&m.length>1)return c(m[0])}else{var d=s.name;P[d]=s,a=d}return!u&&a&&(Y=a),a||!u&&Y},$=function(c,s){if(N(c))return c.clone();var o=typeof s=="object"?s:{};return o.date=c,o.args=arguments,new k(o)},g=H;g.l=R,g.i=N,g.w=function(c,s){return $(c,{locale:s.$L,utc:s.$u,x:s.$x,$offset:s.$offset})};var k=function(){function c(o){this.$L=R(o.locale,null,!0),this.parse(o),this.$x=this.$x||o.x||{},this[K]=!0}var s=c.prototype;return s.parse=function(o){this.$d=function(u){var a=u.date,f=u.utc;if(a===null)return new Date(NaN);if(g.u(a))return new Date;if(a instanceof Date)return new Date(a);if(typeof a=="string"&&!/Z$/i.test(a)){var m=a.match(p);if(m){var d=m[2]-1||0,w=(m[7]||"0").substring(0,3);return f?new Date(Date.UTC(m[1],d,m[3]||1,m[4]||0,m[5]||0,m[6]||0,w)):new Date(m[1],d,m[3]||1,m[4]||0,m[5]||0,m[6]||0,w)}}return new Date(a)}(o),this.init()},s.init=function(){var o=this.$d;this.$y=o.getFullYear(),this.$M=o.getMonth(),this.$D=o.getDate(),this.$W=o.getDay(),this.$H=o.getHours(),this.$m=o.getMinutes(),this.$s=o.getSeconds(),this.$ms=o.getMilliseconds()},s.$utils=function(){return g},s.isValid=function(){return this.$d.toString()!==it},s.isSame=function(o,u){var a=$(o);return this.startOf(u)<=a&&a<=this.endOf(u)},s.isAfter=function(o,u){return $(o)<this.startOf(u)},s.isBefore=function(o,u){return this.endOf(u)<$(o)},s.$g=function(o,u,a){return g.u(o)?this[u]:this.set(a,o)},s.unix=function(){return Math.floor(this.valueOf()/1e3)},s.valueOf=function(){return this.$d.getTime()},s.startOf=function(o,u){var a=this,f=!!g.u(u)||u,m=g.p(o),d=function(V,T){var L=g.w(a.$u?Date.UTC(a.$y,T,V):new Date(a.$y,T,V),a);return f?L:L.endOf(b)},w=function(V,T){return g.w(a.toDate()[V].apply(a.toDate("s"),(f?[0,0,0,0]:[23,59,59,999]).slice(T)),a)},S=this.$W,A=this.$M,C=this.$D,G="set"+(this.$u?"UTC":"");switch(m){case I:return f?d(1,0):d(31,11);case v:return f?d(1,A):d(0,A+1);case h:var q=this.$locale().weekStart||0,tt=(S<q?S+7:S)-q;return d(f?C-tt:C+(6-tt),A);case b:case _:return w(G+"Hours",0);case l:return w(G+"Minutes",1);case y:return w(G+"Seconds",2);case i:return w(G+"Milliseconds",3);default:return this.clone()}},s.endOf=function(o){return this.startOf(o,!1)},s.$set=function(o,u){var a,f=g.p(o),m="set"+(this.$u?"UTC":""),d=(a={},a[b]=m+"Date",a[_]=m+"Date",a[v]=m+"Month",a[I]=m+"FullYear",a[l]=m+"Hours",a[y]=m+"Minutes",a[i]=m+"Seconds",a[r]=m+"Milliseconds",a)[f],w=f===b?this.$D+(u-this.$W):u;if(f===v||f===I){var S=this.clone().set(_,1);S.$d[d](w),S.init(),this.$d=S.set(_,Math.min(this.$D,S.daysInMonth())).$d}else d&&this.$d[d](w);return this.init(),this},s.set=function(o,u){return this.clone().$set(o,u)},s.get=function(o){return this[g.p(o)]()},s.add=function(o,u){var a,f=this;o=Number(o);var m=g.p(u),d=function(A){var C=$(f);return g.w(C.date(C.date()+Math.round(A*o)),f)};if(m===v)return this.set(v,this.$M+o);if(m===I)return this.set(I,this.$y+o);if(m===b)return d(1);if(m===h)return d(7);var w=(a={},a[y]=e,a[l]=n,a[i]=t,a)[m]||1,S=this.$d.getTime()+o*w;return g.w(S,this)},s.subtract=function(o,u){return this.add(-1*o,u)},s.format=function(o){var u=this,a=this.$locale();if(!this.isValid())return a.invalidDate||it;var f=o||"YYYY-MM-DDTHH:mm:ssZ",m=g.z(this),d=this.$H,w=this.$m,S=this.$M,A=a.weekdays,C=a.months,G=a.meridiem,q=function(T,L,B,J){return T&&(T[L]||T(u,f))||B[L].slice(0,J)},tt=function(T){return g.s(d%12||12,T,"0")},V=G||function(T,L,B){var J=T<12?"AM":"PM";return B?J.toLowerCase():J};return f.replace(x,function(T,L){return L||function(B){switch(B){case"YY":return String(u.$y).slice(-2);case"YYYY":return g.s(u.$y,4,"0");case"M":return S+1;case"MM":return g.s(S+1,2,"0");case"MMM":return q(a.monthsShort,S,C,3);case"MMMM":return q(C,S);case"D":return u.$D;case"DD":return g.s(u.$D,2,"0");case"d":return String(u.$W);case"dd":return q(a.weekdaysMin,u.$W,A,2);case"ddd":return q(a.weekdaysShort,u.$W,A,3);case"dddd":return A[u.$W];case"H":return String(d);case"HH":return g.s(d,2,"0");case"h":return tt(1);case"hh":return tt(2);case"a":return V(d,w,!0);case"A":return V(d,w,!1);case"m":return String(w);case"mm":return g.s(w,2,"0");case"s":return String(u.$s);case"ss":return g.s(u.$s,2,"0");case"SSS":return g.s(u.$ms,3,"0");case"Z":return m}return null}(T)||m.replace(":","")})},s.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},s.diff=function(o,u,a){var f,m=this,d=g.p(u),w=$(o),S=(w.utcOffset()-this.utcOffset())*e,A=this-w,C=function(){return g.m(m,w)};switch(d){case I:f=C()/12;break;case v:f=C();break;case X:f=C()/3;break;case h:f=(A-S)/6048e5;break;case b:f=(A-S)/864e5;break;case l:f=A/n;break;case y:f=A/e;break;case i:f=A/t;break;default:f=A}return a?f:g.a(f)},s.daysInMonth=function(){return this.endOf(v).$D},s.$locale=function(){return P[this.$L]},s.locale=function(o,u){if(!o)return this.$L;var a=this.clone(),f=R(o,u,!0);return f&&(a.$L=f),a},s.clone=function(){return g.w(this.$d,this)},s.toDate=function(){return new Date(this.valueOf())},s.toJSON=function(){return this.isValid()?this.toISOString():null},s.toISOString=function(){return this.$d.toISOString()},s.toString=function(){return this.$d.toUTCString()},c}(),E=k.prototype;return $.prototype=E,[["$ms",r],["$s",i],["$m",y],["$H",l],["$W",b],["$M",v],["$y",I],["$D",_]].forEach(function(c){E[c[1]]=function(s){return this.$g(s,c[0],c[1])}}),$.extend=function(c,s){return c.$i||(c(s,k,$),c.$i=!0),$},$.locale=R,$.isDayjs=N,$.unix=function(c){return $(1e3*c)},$.en=P[Y],$.Ls=P,$.p={},$})});var Ot=Tt((Mt,wt)=>{"use strict";(function(t,e){typeof Mt=="object"&&typeof wt<"u"?wt.exports=e():typeof define=="function"&&define.amd?define(e):(t=typeof globalThis<"u"?globalThis:t||self).dayjs_plugin_customParseFormat=e()})(Mt,function(){"use strict";var t={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},e=/(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|Q|YYYY|YY?|ww?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g,n=/\d/,r=/\d\d/,i=/\d\d?/,y=/\d*[^-_:/,()\s\d]+/,l={},b=function(p){return(p=+p)+(p>68?1900:2e3)},h=function(p){return function(x){this[p]=+x}},v=[/[+-]\d\d:?(\d\d)?|Z/,function(p){(this.zone||(this.zone={})).offset=function(x){if(!x||x==="Z")return 0;var O=x.match(/([+-]|\d\d)/g),M=60*O[1]+(+O[2]||0);return M===0?0:O[0]==="+"?-M:M}(p)}],X=function(p){var x=l[p];return x&&(x.indexOf?x:x.s.concat(x.f))},I=function(p,x){var O,M=l.meridiem;if(M){for(var H=1;H<=24;H+=1)if(p.indexOf(M(H,0,x))>-1){O=H>12;break}}else O=p===(x?"pm":"PM");return O},_={A:[y,function(p){this.afternoon=I(p,!1)}],a:[y,function(p){this.afternoon=I(p,!0)}],Q:[n,function(p){this.month=3*(p-1)+1}],S:[n,function(p){this.milliseconds=100*+p}],SS:[r,function(p){this.milliseconds=10*+p}],SSS:[/\d{3}/,function(p){this.milliseconds=+p}],s:[i,h("seconds")],ss:[i,h("seconds")],m:[i,h("minutes")],mm:[i,h("minutes")],H:[i,h("hours")],h:[i,h("hours")],HH:[i,h("hours")],hh:[i,h("hours")],D:[i,h("day")],DD:[r,h("day")],Do:[y,function(p){var x=l.ordinal,O=p.match(/\d+/);if(this.day=O[0],x)for(var M=1;M<=31;M+=1)x(M).replace(/\[|\]/g,"")===p&&(this.day=M)}],w:[i,h("week")],ww:[r,h("week")],M:[i,h("month")],MM:[r,h("month")],MMM:[y,function(p){var x=X("months"),O=(X("monthsShort")||x.map(function(M){return M.slice(0,3)})).indexOf(p)+1;if(O<1)throw new Error;this.month=O%12||O}],MMMM:[y,function(p){var x=X("months").indexOf(p)+1;if(x<1)throw new Error;this.month=x%12||x}],Y:[/[+-]?\d+/,h("year")],YY:[r,function(p){this.year=b(p)}],YYYY:[/\d{4}/,h("year")],Z:v,ZZ:v};function it(p){var x,O;x=p,O=l&&l.formats;for(var M=(p=x.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,function($,g,k){var E=k&&k.toUpperCase();return g||O[k]||t[k]||O[E].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,function(c,s,o){return s||o.slice(1)})})).match(e),H=M.length,Y=0;Y<H;Y+=1){var P=M[Y],K=_[P],N=K&&K[0],R=K&&K[1];M[Y]=R?{regex:N,parser:R}:P.replace(/^\[|\]$/g,"")}return function($){for(var g={},k=0,E=0;k<H;k+=1){var c=M[k];if(typeof c=="string")E+=c.length;else{var s=c.regex,o=c.parser,u=$.slice(E),a=s.exec(u)[0];o.call(g,a),$=$.replace(a,"")}}return function(f){var m=f.afternoon;if(m!==void 0){var d=f.hours;m?d<12&&(f.hours+=12):d===12&&(f.hours=0),delete f.afternoon}}(g),g}}return function(p,x,O){O.p.customParseFormat=!0,p&&p.parseTwoDigitYear&&(b=p.parseTwoDigitYear);var M=x.prototype,H=M.parse;M.parse=function(Y){var P=Y.date,K=Y.utc,N=Y.args;this.$u=K;var R=N[1];if(typeof R=="string"){var $=N[2]===!0,g=N[3]===!0,k=$||g,E=N[2];g&&(E=N[2]),l=this.$locale(),!$&&E&&(l=O.Ls[E]),this.$d=function(u,a,f,m){try{if(["x","X"].indexOf(a)>-1)return new Date((a==="X"?1e3:1)*u);var d=it(a)(u),w=d.year,S=d.month,A=d.day,C=d.hours,G=d.minutes,q=d.seconds,tt=d.milliseconds,V=d.zone,T=d.week,L=new Date,B=A||(w||S?1:L.getDate()),J=w||L.getFullYear(),st=0;w&&!S||(st=S>0?S-1:L.getMonth());var at,dt=C||0,lt=G||0,gt=q||0,ht=tt||0;return V?new Date(Date.UTC(J,st,B,dt,lt,gt,ht+60*V.offset*1e3)):f?new Date(Date.UTC(J,st,B,dt,lt,gt,ht)):(at=new Date(J,st,B,dt,lt,gt,ht),T&&(at=m(at).week(T).toDate()),at)}catch{return new Date("")}}(P,R,K,O),this.init(),E&&E!==!0&&(this.$L=this.locale(E).$L),k&&P!=this.format(R)&&(this.$d=new Date("")),l={}}else if(R instanceof Array)for(var c=R.length,s=1;s<=c;s+=1){N[1]=R[s-1];var o=O.apply(this,N);if(o.isValid()){this.$d=o.$d,this.$L=o.$L,this.init();break}s===c&&(this.$d=new Date(""))}else H.call(this,Y)}}})});function le(t){let e=typeof t;return t!==null&&(e==="object"||e==="function")}function ct(t){return t!==null&&typeof t=="object"}var Gt=Object.prototype.toString,et=t=>Gt.call(t),xt=t=>et(t).slice(8,-1),jt=t=>typeof t=="string",U=t=>typeof t=="number"&&Number.isFinite(t),ye=t=>typeof t=="boolean",be=t=>t===null,$e=t=>t===void 0,Yt=t=>typeof t=="symbol",Z=Array.isArray,ft=t=>typeof t=="function",kt=t=>et(t)==="[object Map]",Rt=t=>et(t)==="[object Set]",Et=t=>et(t)==="[object Date]",Ct=t=>et(t)==="[object RegExp]",It=t=>ct(t)&&ft(t?.then)&&ft(t?.catch),rt=t=>t==null,Me=t=>t!=null,we=(t,e)=>t!==e;function Q(t){return et(t)==="[object Object]"}function nt(t){return Z(t)?t:[t]}function Ie(t){let e=[],n,r="";for(;t>0;)n=Math.floor(t%2),e.push(n),t=Math.floor(t/2);for(;e.length>0;)r+=e.pop().toString();return r}var Pt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";function Pe(t){let e="",n="";for(let i=0;i<t.length;i++)n+=t[i].charCodeAt(0).toString(2).padStart(8,"0");for(let i=0;i<n.length;i+=6)e+=Pt[parseInt(n.slice(i,i+6).padEnd(6,"0"),2)];let r=e.length%4;return r!==0&&(e+="=".repeat(4-r)),e}function Ne(t){let e="",n="";for(let r=0;r<t.length&&t[r]!=="=";r++)n+=Pt.indexOf(t[r]).toString(2).padStart(6,"0");for(let r=0;r<n.length;r+=8){let i=parseInt(n.slice(r,r+8),2);i&&(e+=String.fromCharCode(i))}return e}function Le(...t){return t.reduce((e,n)=>function(...r){return n(e(...r))})}function Fe(...t){return t.reduce((e,n)=>function(...r){return e(n(...r))})}function Ue(t,e=500){let n=null;return function(...r){n&&clearTimeout(n),n=setTimeout(()=>{t.apply(this,r)},e)}}function ot(t){let e=new WeakMap;function n(r){if(!ct(r))return r;if(Et(r))return new Date(r);if(Ct(r))return new RegExp(r);if(It(r))return r;if(e.has(r))return e.get(r);if(kt(r)){let l=new Map;return e.set(r,l),r.forEach((b,h)=>l.set(n(h),n(b))),l}if(Rt(r)){let l=new Set;return e.set(r,l),r.forEach(b=>l.add(n(b))),l}let i=Z(r)?Object.setPrototypeOf([],Object.getPrototypeOf(r)):Object.create(Object.getPrototypeOf(r));e.set(r,i);let y=Object.getOwnPropertyDescriptors(r);for(let l of Reflect.ownKeys(y)){let b=y[l];b.get||b.set?Object.defineProperty(i,l,b):Object.defineProperty(i,l,{...b,value:n(b.value)})}return i}return n(t)}function _t(t,e,n={}){return Lt(Nt(t,n),Nt(e,n),n)}function Lt(t,e,n){return Z(t)?Qt(t,e,n):Jt(t,e,n)}function Jt(t,e,n){if(!Q(e))return e;let r=Object.getOwnPropertyDescriptors(e);return Reflect.ownKeys(e).forEach(i=>{(Q(t[i])||Z(t[i]))&&(Q(e[i])||Z(e[i]))?t[i]=Lt(t[i],e[i],n):Object.defineProperty(t,i,r[i])}),t}function Qt(t,e,n){let{mergeStrategy:r="replace"}=n;if(Z(e))switch(r){case"merge":return t.concat(e);case"replace":return e;default:return e}return e}function Nt(t,e){let{deepClone:n=!0}=e;return n?ot(t):t}var mt=class extends Error{constructor(e,n="Utils"){super(e),this.name=n}};function D(t,e){throw new mt(`[${t}] ${e}`)}function Ft(t,e){let n=jt(t)?new mt(`[${t}] ${e}`,"UtilsWarn"):t;console.warn(n)}function Be(...t){console.warn(...t)}function Ge(...t){console.error(...t)}var Je=({from:t,replacement:e,version:n,type:r="API"})=>{Ft(`${r}`,`${t} is about to be deprecated in version ${n}, please use ${e} instead.`)};function Qe(t,e,n,r){let i=`Invalid params: type check failed for params "${e}". Expected ${n}, got ${xt(r)} with value ${r}.`;D(t,i)}function tn(t,e,n,r){let i=`Invalid params: type check failed for params "${e}". Expected ${n}, got ${xt(r)} with value ${r}.`;Ft(t,i)}function te(t,e){let{decode:n=!0}=e||{},r={};t.startsWith("?")&&(t=t.slice(1)),t.includes("?")&&(t=t.slice(t.indexOf("?")+1));let i=t.split("&").filter(Boolean);for(let y of i){let[l,b]=y.split("=");r[l]=n?decodeURIComponent(b):b}return r}function Ht(t,e){let{encode:n=!0}=e||{},r=[];for(let i in t){let y=t[i];r.push(`${i}=${n?encodeURIComponent(y):y}`)}return r.join("&")}function ee(t,e,n){let r=_t({encode:!0},{...n}),i=Ht(e,r);return t.includes("?")?t.endsWith("?")||t.endsWith("&")?`${t}${i}`:`${t}&${i}`:`${t}?${i}`}var rn={parse:te,stringify:Ht,appendQueryString:ee};function an(t,e=500){let n=null;return function(...r){if(rt(n))return n=Date.now(),t.apply(this,r);let i=Date.now();if(i-n>=e)return n=i,t.apply(this,r)}}function fn(t){return!rt(t)&&/^[\dA-Z\u4E00-\u9FA5]+$/i.test(t)}function mn(t){return!rt(t)&&/^[A-Z\u4E00-\u9FA5]+$/i.test(t)}function pn(t){return!rt(t)&&/^[\d!"#$%&'()*+,./:;<=>?@A-Z[\\\]^_`{|}~]+$/.test(t)}function dn(t){return/^[\dA-Z_]+$/.test(t)}function Ut(t,e,n={}){let{includeProto:r=!1,includeSymbols:i=!0,includeNonEnum:y=!1}=n,l={};return Q(t)&&nt(e).forEach(h=>{Yt(h)&&!i||!(r?h in t:Object.hasOwn(t,h))||!y&&(r?ne(t,h):Object.getOwnPropertyDescriptor(t,h))?.enumerable===!1||(l[h]=ot(t[h]))}),l}function ne(t,e){let n=t;for(;n!==null;){let r=Object.getOwnPropertyDescriptor(n,e);if(r)return r;n=Object.getPrototypeOf(n)}}function Cn(t,e){if(!Q(t))return{};let n=ot(t),r=nt(e),i=Object.keys(n).filter(y=>!r.includes(y));return Ut(n,i)}function Hn(t,e){return(!U(t)||t<=0)&&D("generateRandomArray","num \u5FC5\u987B\u5927\u4E8E0"),ft(e)||D("generateRandomArray","cb \u5FC5\u987B\u662F\u51FD\u6570"),Array.from({length:t}).fill(0).map((n,r)=>e(n,r))}function Zn(){return`#${Math.random().toString(16).slice(2,8).padEnd(6,"0")}`}var W=ut($t(),1),Zt=ut(Ot(),1);function F(t){return t[Math.floor(Math.random()*t.length)]}function j(t={}){U(t)&&(t={max:t});let{min:e=1,max:n=F(oe())}=t;re(e,n);let r=Math.ceil(e),i=Math.floor(n);return Math.floor(Math.random()*(i-r+1)+r)}function re(t,e){let n=Math.ceil(t),r=Math.floor(e);Number.isSafeInteger(n)||D("getRandomInt",`The minimum value Math.ceil(${t}) should be a safe integer`),Number.isSafeInteger(r)||D("getRandomInt",`The maximum value Math.floor(${e}) should be a safe integer`),r<n&&(e>=t&&D("getRandomInt",`No integer value found between ${t} and ${e}`),D("getRandomInt",`The maximum value ${e} should be greater than the minimum value ${t}`))}function oe(){return Array.from({length:Number.MAX_SAFE_INTEGER.toString().length}).map((t,e)=>{let n=Number.MAX_SAFE_INTEGER.toString().slice(0,e+1);return Number(n)})}(0,W.extend)(Zt.default);function St(t={}){let{start:e="1800-01-01 00:00:00",end:n=(0,W.default)().format("YYYY-MM-DD HH:mm:ss"),format:r="YYYY-MM-DD HH:mm:ss"}=t;(!(0,W.default)(e).isValid()||!(0,W.default)(n).isValid())&&D("generateRandomDate","start end \u53C2\u6570\u5FC5\u987B\u662F\u5408\u6CD5\u7684\u65F6\u95F4\u683C\u5F0F");let i=(0,W.default)(e).year(),y=(0,W.default)(n).year(),l=j({min:i,max:y}),b=j({min:1,max:12}),h=j({min:1,max:31}),v=j(23),X=j(59),I=j(59),_=(0,W.default)(`${l}-${b}-${h} ${v}:${X}:${I}`);return _.isBefore((0,W.default)(e))||_.isAfter((0,W.default)(n))?St(t):_.format(r)}function z(t={}){let e=se(t),n=ae(e);ue(n);let{length:r}=e;ce(r.min,r.max);let i=j(r),y=e.prefix||"";for(let l=0;l<i;l++)y+=n.charAt(Math.floor(Math.random()*n.length));return y+(e.suffix||"")}var ie=16,Dt=1;function se(t){let e=U(t);return{lowerCase:!0,upperCase:!0,number:!0,...e?{}:t,length:e?{max:t,min:t}:U(t.length)?{max:t.length,min:t.length}:{max:ie,min:Dt,...t.length},extra:e?[]:[...new Set(nt(t.extra||[]))]}}function ae(t){let e="";return t.lowerCase&&(e+="abcdefghijklmnopqrstuvwxyz"),t.upperCase&&(e+="ABCDEFGHIJKLMNOPQRSTUVWXYZ"),t.number&&(e+="0123456789"),e+=nt(t.extra).join(""),e}function ue(t){t.length===0&&D("getRandomString","At least one character set (lowercase, uppercase, number) must be enabled or extra characters provided")}function ce(t,e){Number.isInteger(t)||D("getRandomString","min must be an integer"),Number.isInteger(e)||D("getRandomString","max must be an integer"),t<Dt&&D("getRandomString",`Minimum length cannot be less than ${Dt}`),e<t&&D("getRandomString","Maximum length cannot be less than minimum length")}function fe(){let t=["gmail.com","outlook.com.cn","example.com","qq.com","163.com","test.com.cn"],e=`${z(1)}${z({length:j({max:30,min:1})})}${z(1)}@${F(t)}`;return/\.{2,}/.test(e)?fe():e}function cr(t={}){U(t)&&(t={max:t});let{min:e=0,max:n=1,fractionDigits:r=2}=t;if(e===n)return e;if(e>n)throw new Error(`\u6700\u5927\u503C ${n} \u5E94\u5927\u4E8E\u6700\u5C0F\u503C ${e}`);return Math.random()*(n-e)+e}function At(t,e){(!U(t)||t<=0)&&D("generateRandomStringFromSource","num \u5FC5\u987B\u5927\u4E8E0"),(!Z(e)||e.length===0)&&D("generateRandomStringFromSource","source \u4E0D\u80FD\u4E3A\u7A7A\u6570\u7EC4");let n="";for(let r=0;r<t;r++)n+=F(e);return n}function yr(){let t=j({min:1e5,max:999999}),e=[0,1,2,3,4,5,6,7,8,9];return[t,St({format:"YYYYMMDD"}),At(3,e),At(1,[...e,"X","x"])].join("")}function wr(){return F(["13","14","15","16","17","18","19"])+j(999999999).toString().padEnd(9,"0")}function vr(){let t=["http://","https://"],e=[".com",".net",".org",".cn",".top"],n=[`?name=${z({length:{min:4,max:8}})}`,`?id=${j()}`,`?page=${z({length:{min:2,max:4}})}`,`?query=${z({length:{min:5,max:6}})}`,`?search=${z({length:{min:1,max:4}})}`,`?token=${z({length:{min:16,max:16}})}`];return`${F(t)}${z({length:{min:5,max:25}})}${F(e)}${F(n)}`}function Zr(t){return/^\d+$/.test(t)}function Wr(t){return/^[A-Z]+$/i.test(t)}function zr(t){return/^[A-Z]+$/.test(t)}function Kr(t){return/^[\dA-Z]+$/.test(t)}function Vr(t){return/^[\dA-Z\u4E00-\u9FA5]+$/.test(t)}function Xr(t){return/^[a-z]+$/.test(t)}function qr(t){return/^[\da-z]+$/.test(t)}function Br(t){return/^[\da-z\u4E00-\u9FA5]+$/.test(t)}function Gr(t){return/^[\u4E00-\u9FA5]+$/.test(t)}function Qr(t){return/^-?(?:0|[1-9]\d*)\.\d+$/.test(t)}function to(t){return/^(?:0\.0*[1-9]\d*|[1-9]\d*\.\d+)$/.test(t)}function eo(t){return/^(?:0|[1-9]\d*)\.\d+$/.test(t)}function no(t){return/^-(?:0\.0*[1-9]\d*|[1-9]\d*\.\d+)$/.test(t)}function ro(t){return/^-(?:0|[1-9]\d*)\.\d+$/.test(t)}function io(t){return/^-?(?:0|[1-9]\d*)$/.test(t)}function so(t){return/^[1-9]\d*$/.test(t)}function ao(t){return/^(?:0|[1-9]\d*)$/.test(t)&&!Object.is(t,-0)}function uo(t){return/^-[1-9]\d*$/.test(t)}function co(t){return/^-(?:0|[1-9]\d*)$/.test(t)||Object.is(t,-0)}var pt=ut($t(),1),Wt=ut(Ot(),1);function mo(t){return/^1[3-9]\d{9}$/.test(t)}function po(t){return/^https?:\/\/\S+$/i.test(t)}function lo(t){return/^[^\s@]+@[^\s@][^\s.@]*\.[^\s@]+$/.test(t)}function go(t){return t===""}function me(t,e="YYYY-MM-DD HH:mm:ss"){return(0,pt.extend)(Wt.default),(0,pt.default)(t,e,!0).isValid()}function ho(t){return/^[1-9]\d{5}(?:18|19|20)\d{2}(?:0[1-9]|1[0-2])(?:0[1-9]|[12]\d|3[01])\d{3}[\dX]$/i.test(t)&&me(t.slice(6,14),"YYYYMMDD")}export{Ne as base64Decode,Pe as base64Encode,nt as castArray,Le as compose,Fe as composeRight,Ue as debounce,Ft as debugWarn,tn as debugWarnInvalidTypeMessage,Ie as decimalToBinary,ot as deepClone,_t as deepMerge,Je as deprecated,Ge as error,Hn as generateRandomArray,Zn as generateRandomColor,St as generateRandomDate,fe as generateRandomEmail,cr as generateRandomFloat,yr as generateRandomIdCard,wr as generateRandomMobilePhone,At as generateRandomStringFromSource,j as getRandomInt,F as getRandomItem,z as getRandomString,vr as getRandomUrl,we as hasChanged,Z as isArray,ye as isBoolean,Gr as isChineseString,Et as isDate,me as isDateString,Me as isDef,lo as isEmail,go as isEmptyString,Wr as isEnglishAphabet,Qr as isFloat,ft as isFunction,ho as isIdCard,io as isInteger,Xr as isLowerCase,qr as isLowerCaseAndNumber,Br as isLowerCaseAndNumberAndChinese,kt as isMap,mo as isMobilePhone,no as isNegativeFloat,uo as isNegativeInteger,eo as isNonNegativeFloat,ao as isNonNegativeInteger,ro as isNonPositiveFloat,co as isNonPositiveInteger,be as isNull,U as isNumber,Zr as isNumberOrNumberString,le as isObject,ct as isObjectLike,Q as isPlainObject,to as isPositiveFloat,so as isPositiveInteger,It as isPromise,Ct as isRegExp,Rt as isSet,jt as isString,Yt as isSymbol,rt as isUndef,$e as isUndefined,zr as isUpperCase,Kr as isUpperCaseAndNumber,Vr as isUpperCaseAndNumberAndChinese,po as isUrl,Gt as objectToString,Cn as omit,Ut as pick,rn as qs,an as throttle,D as throwError,Qe as throwErrorInvalidTypeMessage,et as toTypeString,xt as toTypeValue,mn as validatorChineseOrEnglish,fn as validatorChineseOrEnglishOrNumber,pn as validatorUppercaseOrNumbersOrSpecial,dn as validatorUppercaseOrNumbersOrUnderline,Be as warn};
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
8
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
19
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
20
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
21
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
22
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
23
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
24
|
+
mod
|
|
25
|
+
));
|
|
26
|
+
|
|
27
|
+
// node_modules/.pnpm/dayjs@1.11.13/node_modules/dayjs/dayjs.min.js
|
|
28
|
+
var require_dayjs_min = __commonJS({
|
|
29
|
+
"node_modules/.pnpm/dayjs@1.11.13/node_modules/dayjs/dayjs.min.js"(exports, module) {
|
|
30
|
+
"use strict";
|
|
31
|
+
!function(t, e) {
|
|
32
|
+
"object" == typeof exports && "undefined" != typeof module ? module.exports = e() : "function" == typeof define && define.amd ? define(e) : (t = "undefined" != typeof globalThis ? globalThis : t || self).dayjs = e();
|
|
33
|
+
}(exports, function() {
|
|
34
|
+
"use strict";
|
|
35
|
+
var t = 1e3, e = 6e4, n = 36e5, r = "millisecond", i = "second", s = "minute", u = "hour", a = "day", o = "week", c = "month", f = "quarter", h = "year", d = "date", l = "Invalid Date", $ = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/, y = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g, M = { name: "en", weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"), months: "January_February_March_April_May_June_July_August_September_October_November_December".split("_"), ordinal: function(t2) {
|
|
36
|
+
var e2 = ["th", "st", "nd", "rd"], n2 = t2 % 100;
|
|
37
|
+
return "[" + t2 + (e2[(n2 - 20) % 10] || e2[n2] || e2[0]) + "]";
|
|
38
|
+
} }, m = function(t2, e2, n2) {
|
|
39
|
+
var r2 = String(t2);
|
|
40
|
+
return !r2 || r2.length >= e2 ? t2 : "" + Array(e2 + 1 - r2.length).join(n2) + t2;
|
|
41
|
+
}, v = { s: m, z: function(t2) {
|
|
42
|
+
var e2 = -t2.utcOffset(), n2 = Math.abs(e2), r2 = Math.floor(n2 / 60), i2 = n2 % 60;
|
|
43
|
+
return (e2 <= 0 ? "+" : "-") + m(r2, 2, "0") + ":" + m(i2, 2, "0");
|
|
44
|
+
}, m: function t2(e2, n2) {
|
|
45
|
+
if (e2.date() < n2.date()) return -t2(n2, e2);
|
|
46
|
+
var r2 = 12 * (n2.year() - e2.year()) + (n2.month() - e2.month()), i2 = e2.clone().add(r2, c), s2 = n2 - i2 < 0, u2 = e2.clone().add(r2 + (s2 ? -1 : 1), c);
|
|
47
|
+
return +(-(r2 + (n2 - i2) / (s2 ? i2 - u2 : u2 - i2)) || 0);
|
|
48
|
+
}, a: function(t2) {
|
|
49
|
+
return t2 < 0 ? Math.ceil(t2) || 0 : Math.floor(t2);
|
|
50
|
+
}, p: function(t2) {
|
|
51
|
+
return { M: c, y: h, w: o, d: a, D: d, h: u, m: s, s: i, ms: r, Q: f }[t2] || String(t2 || "").toLowerCase().replace(/s$/, "");
|
|
52
|
+
}, u: function(t2) {
|
|
53
|
+
return void 0 === t2;
|
|
54
|
+
} }, g = "en", D = {};
|
|
55
|
+
D[g] = M;
|
|
56
|
+
var p = "$isDayjsObject", S = function(t2) {
|
|
57
|
+
return t2 instanceof _ || !(!t2 || !t2[p]);
|
|
58
|
+
}, w = function t2(e2, n2, r2) {
|
|
59
|
+
var i2;
|
|
60
|
+
if (!e2) return g;
|
|
61
|
+
if ("string" == typeof e2) {
|
|
62
|
+
var s2 = e2.toLowerCase();
|
|
63
|
+
D[s2] && (i2 = s2), n2 && (D[s2] = n2, i2 = s2);
|
|
64
|
+
var u2 = e2.split("-");
|
|
65
|
+
if (!i2 && u2.length > 1) return t2(u2[0]);
|
|
66
|
+
} else {
|
|
67
|
+
var a2 = e2.name;
|
|
68
|
+
D[a2] = e2, i2 = a2;
|
|
69
|
+
}
|
|
70
|
+
return !r2 && i2 && (g = i2), i2 || !r2 && g;
|
|
71
|
+
}, O = function(t2, e2) {
|
|
72
|
+
if (S(t2)) return t2.clone();
|
|
73
|
+
var n2 = "object" == typeof e2 ? e2 : {};
|
|
74
|
+
return n2.date = t2, n2.args = arguments, new _(n2);
|
|
75
|
+
}, b = v;
|
|
76
|
+
b.l = w, b.i = S, b.w = function(t2, e2) {
|
|
77
|
+
return O(t2, { locale: e2.$L, utc: e2.$u, x: e2.$x, $offset: e2.$offset });
|
|
78
|
+
};
|
|
79
|
+
var _ = function() {
|
|
80
|
+
function M2(t2) {
|
|
81
|
+
this.$L = w(t2.locale, null, true), this.parse(t2), this.$x = this.$x || t2.x || {}, this[p] = true;
|
|
82
|
+
}
|
|
83
|
+
var m2 = M2.prototype;
|
|
84
|
+
return m2.parse = function(t2) {
|
|
85
|
+
this.$d = function(t3) {
|
|
86
|
+
var e2 = t3.date, n2 = t3.utc;
|
|
87
|
+
if (null === e2) return /* @__PURE__ */ new Date(NaN);
|
|
88
|
+
if (b.u(e2)) return /* @__PURE__ */ new Date();
|
|
89
|
+
if (e2 instanceof Date) return new Date(e2);
|
|
90
|
+
if ("string" == typeof e2 && !/Z$/i.test(e2)) {
|
|
91
|
+
var r2 = e2.match($);
|
|
92
|
+
if (r2) {
|
|
93
|
+
var i2 = r2[2] - 1 || 0, s2 = (r2[7] || "0").substring(0, 3);
|
|
94
|
+
return n2 ? new Date(Date.UTC(r2[1], i2, r2[3] || 1, r2[4] || 0, r2[5] || 0, r2[6] || 0, s2)) : new Date(r2[1], i2, r2[3] || 1, r2[4] || 0, r2[5] || 0, r2[6] || 0, s2);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
return new Date(e2);
|
|
98
|
+
}(t2), this.init();
|
|
99
|
+
}, m2.init = function() {
|
|
100
|
+
var t2 = this.$d;
|
|
101
|
+
this.$y = t2.getFullYear(), this.$M = t2.getMonth(), this.$D = t2.getDate(), this.$W = t2.getDay(), this.$H = t2.getHours(), this.$m = t2.getMinutes(), this.$s = t2.getSeconds(), this.$ms = t2.getMilliseconds();
|
|
102
|
+
}, m2.$utils = function() {
|
|
103
|
+
return b;
|
|
104
|
+
}, m2.isValid = function() {
|
|
105
|
+
return !(this.$d.toString() === l);
|
|
106
|
+
}, m2.isSame = function(t2, e2) {
|
|
107
|
+
var n2 = O(t2);
|
|
108
|
+
return this.startOf(e2) <= n2 && n2 <= this.endOf(e2);
|
|
109
|
+
}, m2.isAfter = function(t2, e2) {
|
|
110
|
+
return O(t2) < this.startOf(e2);
|
|
111
|
+
}, m2.isBefore = function(t2, e2) {
|
|
112
|
+
return this.endOf(e2) < O(t2);
|
|
113
|
+
}, m2.$g = function(t2, e2, n2) {
|
|
114
|
+
return b.u(t2) ? this[e2] : this.set(n2, t2);
|
|
115
|
+
}, m2.unix = function() {
|
|
116
|
+
return Math.floor(this.valueOf() / 1e3);
|
|
117
|
+
}, m2.valueOf = function() {
|
|
118
|
+
return this.$d.getTime();
|
|
119
|
+
}, m2.startOf = function(t2, e2) {
|
|
120
|
+
var n2 = this, r2 = !!b.u(e2) || e2, f2 = b.p(t2), l2 = function(t3, e3) {
|
|
121
|
+
var i2 = b.w(n2.$u ? Date.UTC(n2.$y, e3, t3) : new Date(n2.$y, e3, t3), n2);
|
|
122
|
+
return r2 ? i2 : i2.endOf(a);
|
|
123
|
+
}, $2 = function(t3, e3) {
|
|
124
|
+
return b.w(n2.toDate()[t3].apply(n2.toDate("s"), (r2 ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(e3)), n2);
|
|
125
|
+
}, y2 = this.$W, M3 = this.$M, m3 = this.$D, v2 = "set" + (this.$u ? "UTC" : "");
|
|
126
|
+
switch (f2) {
|
|
127
|
+
case h:
|
|
128
|
+
return r2 ? l2(1, 0) : l2(31, 11);
|
|
129
|
+
case c:
|
|
130
|
+
return r2 ? l2(1, M3) : l2(0, M3 + 1);
|
|
131
|
+
case o:
|
|
132
|
+
var g2 = this.$locale().weekStart || 0, D2 = (y2 < g2 ? y2 + 7 : y2) - g2;
|
|
133
|
+
return l2(r2 ? m3 - D2 : m3 + (6 - D2), M3);
|
|
134
|
+
case a:
|
|
135
|
+
case d:
|
|
136
|
+
return $2(v2 + "Hours", 0);
|
|
137
|
+
case u:
|
|
138
|
+
return $2(v2 + "Minutes", 1);
|
|
139
|
+
case s:
|
|
140
|
+
return $2(v2 + "Seconds", 2);
|
|
141
|
+
case i:
|
|
142
|
+
return $2(v2 + "Milliseconds", 3);
|
|
143
|
+
default:
|
|
144
|
+
return this.clone();
|
|
145
|
+
}
|
|
146
|
+
}, m2.endOf = function(t2) {
|
|
147
|
+
return this.startOf(t2, false);
|
|
148
|
+
}, m2.$set = function(t2, e2) {
|
|
149
|
+
var n2, o2 = b.p(t2), f2 = "set" + (this.$u ? "UTC" : ""), l2 = (n2 = {}, n2[a] = f2 + "Date", n2[d] = f2 + "Date", n2[c] = f2 + "Month", n2[h] = f2 + "FullYear", n2[u] = f2 + "Hours", n2[s] = f2 + "Minutes", n2[i] = f2 + "Seconds", n2[r] = f2 + "Milliseconds", n2)[o2], $2 = o2 === a ? this.$D + (e2 - this.$W) : e2;
|
|
150
|
+
if (o2 === c || o2 === h) {
|
|
151
|
+
var y2 = this.clone().set(d, 1);
|
|
152
|
+
y2.$d[l2]($2), y2.init(), this.$d = y2.set(d, Math.min(this.$D, y2.daysInMonth())).$d;
|
|
153
|
+
} else l2 && this.$d[l2]($2);
|
|
154
|
+
return this.init(), this;
|
|
155
|
+
}, m2.set = function(t2, e2) {
|
|
156
|
+
return this.clone().$set(t2, e2);
|
|
157
|
+
}, m2.get = function(t2) {
|
|
158
|
+
return this[b.p(t2)]();
|
|
159
|
+
}, m2.add = function(r2, f2) {
|
|
160
|
+
var d2, l2 = this;
|
|
161
|
+
r2 = Number(r2);
|
|
162
|
+
var $2 = b.p(f2), y2 = function(t2) {
|
|
163
|
+
var e2 = O(l2);
|
|
164
|
+
return b.w(e2.date(e2.date() + Math.round(t2 * r2)), l2);
|
|
165
|
+
};
|
|
166
|
+
if ($2 === c) return this.set(c, this.$M + r2);
|
|
167
|
+
if ($2 === h) return this.set(h, this.$y + r2);
|
|
168
|
+
if ($2 === a) return y2(1);
|
|
169
|
+
if ($2 === o) return y2(7);
|
|
170
|
+
var M3 = (d2 = {}, d2[s] = e, d2[u] = n, d2[i] = t, d2)[$2] || 1, m3 = this.$d.getTime() + r2 * M3;
|
|
171
|
+
return b.w(m3, this);
|
|
172
|
+
}, m2.subtract = function(t2, e2) {
|
|
173
|
+
return this.add(-1 * t2, e2);
|
|
174
|
+
}, m2.format = function(t2) {
|
|
175
|
+
var e2 = this, n2 = this.$locale();
|
|
176
|
+
if (!this.isValid()) return n2.invalidDate || l;
|
|
177
|
+
var r2 = t2 || "YYYY-MM-DDTHH:mm:ssZ", i2 = b.z(this), s2 = this.$H, u2 = this.$m, a2 = this.$M, o2 = n2.weekdays, c2 = n2.months, f2 = n2.meridiem, h2 = function(t3, n3, i3, s3) {
|
|
178
|
+
return t3 && (t3[n3] || t3(e2, r2)) || i3[n3].slice(0, s3);
|
|
179
|
+
}, d2 = function(t3) {
|
|
180
|
+
return b.s(s2 % 12 || 12, t3, "0");
|
|
181
|
+
}, $2 = f2 || function(t3, e3, n3) {
|
|
182
|
+
var r3 = t3 < 12 ? "AM" : "PM";
|
|
183
|
+
return n3 ? r3.toLowerCase() : r3;
|
|
184
|
+
};
|
|
185
|
+
return r2.replace(y, function(t3, r3) {
|
|
186
|
+
return r3 || function(t4) {
|
|
187
|
+
switch (t4) {
|
|
188
|
+
case "YY":
|
|
189
|
+
return String(e2.$y).slice(-2);
|
|
190
|
+
case "YYYY":
|
|
191
|
+
return b.s(e2.$y, 4, "0");
|
|
192
|
+
case "M":
|
|
193
|
+
return a2 + 1;
|
|
194
|
+
case "MM":
|
|
195
|
+
return b.s(a2 + 1, 2, "0");
|
|
196
|
+
case "MMM":
|
|
197
|
+
return h2(n2.monthsShort, a2, c2, 3);
|
|
198
|
+
case "MMMM":
|
|
199
|
+
return h2(c2, a2);
|
|
200
|
+
case "D":
|
|
201
|
+
return e2.$D;
|
|
202
|
+
case "DD":
|
|
203
|
+
return b.s(e2.$D, 2, "0");
|
|
204
|
+
case "d":
|
|
205
|
+
return String(e2.$W);
|
|
206
|
+
case "dd":
|
|
207
|
+
return h2(n2.weekdaysMin, e2.$W, o2, 2);
|
|
208
|
+
case "ddd":
|
|
209
|
+
return h2(n2.weekdaysShort, e2.$W, o2, 3);
|
|
210
|
+
case "dddd":
|
|
211
|
+
return o2[e2.$W];
|
|
212
|
+
case "H":
|
|
213
|
+
return String(s2);
|
|
214
|
+
case "HH":
|
|
215
|
+
return b.s(s2, 2, "0");
|
|
216
|
+
case "h":
|
|
217
|
+
return d2(1);
|
|
218
|
+
case "hh":
|
|
219
|
+
return d2(2);
|
|
220
|
+
case "a":
|
|
221
|
+
return $2(s2, u2, true);
|
|
222
|
+
case "A":
|
|
223
|
+
return $2(s2, u2, false);
|
|
224
|
+
case "m":
|
|
225
|
+
return String(u2);
|
|
226
|
+
case "mm":
|
|
227
|
+
return b.s(u2, 2, "0");
|
|
228
|
+
case "s":
|
|
229
|
+
return String(e2.$s);
|
|
230
|
+
case "ss":
|
|
231
|
+
return b.s(e2.$s, 2, "0");
|
|
232
|
+
case "SSS":
|
|
233
|
+
return b.s(e2.$ms, 3, "0");
|
|
234
|
+
case "Z":
|
|
235
|
+
return i2;
|
|
236
|
+
}
|
|
237
|
+
return null;
|
|
238
|
+
}(t3) || i2.replace(":", "");
|
|
239
|
+
});
|
|
240
|
+
}, m2.utcOffset = function() {
|
|
241
|
+
return 15 * -Math.round(this.$d.getTimezoneOffset() / 15);
|
|
242
|
+
}, m2.diff = function(r2, d2, l2) {
|
|
243
|
+
var $2, y2 = this, M3 = b.p(d2), m3 = O(r2), v2 = (m3.utcOffset() - this.utcOffset()) * e, g2 = this - m3, D2 = function() {
|
|
244
|
+
return b.m(y2, m3);
|
|
245
|
+
};
|
|
246
|
+
switch (M3) {
|
|
247
|
+
case h:
|
|
248
|
+
$2 = D2() / 12;
|
|
249
|
+
break;
|
|
250
|
+
case c:
|
|
251
|
+
$2 = D2();
|
|
252
|
+
break;
|
|
253
|
+
case f:
|
|
254
|
+
$2 = D2() / 3;
|
|
255
|
+
break;
|
|
256
|
+
case o:
|
|
257
|
+
$2 = (g2 - v2) / 6048e5;
|
|
258
|
+
break;
|
|
259
|
+
case a:
|
|
260
|
+
$2 = (g2 - v2) / 864e5;
|
|
261
|
+
break;
|
|
262
|
+
case u:
|
|
263
|
+
$2 = g2 / n;
|
|
264
|
+
break;
|
|
265
|
+
case s:
|
|
266
|
+
$2 = g2 / e;
|
|
267
|
+
break;
|
|
268
|
+
case i:
|
|
269
|
+
$2 = g2 / t;
|
|
270
|
+
break;
|
|
271
|
+
default:
|
|
272
|
+
$2 = g2;
|
|
273
|
+
}
|
|
274
|
+
return l2 ? $2 : b.a($2);
|
|
275
|
+
}, m2.daysInMonth = function() {
|
|
276
|
+
return this.endOf(c).$D;
|
|
277
|
+
}, m2.$locale = function() {
|
|
278
|
+
return D[this.$L];
|
|
279
|
+
}, m2.locale = function(t2, e2) {
|
|
280
|
+
if (!t2) return this.$L;
|
|
281
|
+
var n2 = this.clone(), r2 = w(t2, e2, true);
|
|
282
|
+
return r2 && (n2.$L = r2), n2;
|
|
283
|
+
}, m2.clone = function() {
|
|
284
|
+
return b.w(this.$d, this);
|
|
285
|
+
}, m2.toDate = function() {
|
|
286
|
+
return new Date(this.valueOf());
|
|
287
|
+
}, m2.toJSON = function() {
|
|
288
|
+
return this.isValid() ? this.toISOString() : null;
|
|
289
|
+
}, m2.toISOString = function() {
|
|
290
|
+
return this.$d.toISOString();
|
|
291
|
+
}, m2.toString = function() {
|
|
292
|
+
return this.$d.toUTCString();
|
|
293
|
+
}, M2;
|
|
294
|
+
}(), k = _.prototype;
|
|
295
|
+
return O.prototype = k, [["$ms", r], ["$s", i], ["$m", s], ["$H", u], ["$W", a], ["$M", c], ["$y", h], ["$D", d]].forEach(function(t2) {
|
|
296
|
+
k[t2[1]] = function(e2) {
|
|
297
|
+
return this.$g(e2, t2[0], t2[1]);
|
|
298
|
+
};
|
|
299
|
+
}), O.extend = function(t2, e2) {
|
|
300
|
+
return t2.$i || (t2(e2, _, O), t2.$i = true), O;
|
|
301
|
+
}, O.locale = w, O.isDayjs = S, O.unix = function(t2) {
|
|
302
|
+
return O(1e3 * t2);
|
|
303
|
+
}, O.en = D[g], O.Ls = D, O.p = {}, O;
|
|
304
|
+
});
|
|
305
|
+
}
|
|
306
|
+
});
|
|
307
|
+
|
|
308
|
+
// node_modules/.pnpm/dayjs@1.11.13/node_modules/dayjs/plugin/customParseFormat.js
|
|
309
|
+
var require_customParseFormat = __commonJS({
|
|
310
|
+
"node_modules/.pnpm/dayjs@1.11.13/node_modules/dayjs/plugin/customParseFormat.js"(exports, module) {
|
|
311
|
+
"use strict";
|
|
312
|
+
!function(e, t) {
|
|
313
|
+
"object" == typeof exports && "undefined" != typeof module ? module.exports = t() : "function" == typeof define && define.amd ? define(t) : (e = "undefined" != typeof globalThis ? globalThis : e || self).dayjs_plugin_customParseFormat = t();
|
|
314
|
+
}(exports, function() {
|
|
315
|
+
"use strict";
|
|
316
|
+
var e = { LTS: "h:mm:ss A", LT: "h:mm A", L: "MM/DD/YYYY", LL: "MMMM D, YYYY", LLL: "MMMM D, YYYY h:mm A", LLLL: "dddd, MMMM D, YYYY h:mm A" }, t = /(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|Q|YYYY|YY?|ww?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g, n = /\d/, r = /\d\d/, i = /\d\d?/, o = /\d*[^-_:/,()\s\d]+/, s = {}, a = function(e2) {
|
|
317
|
+
return (e2 = +e2) + (e2 > 68 ? 1900 : 2e3);
|
|
318
|
+
};
|
|
319
|
+
var f = function(e2) {
|
|
320
|
+
return function(t2) {
|
|
321
|
+
this[e2] = +t2;
|
|
322
|
+
};
|
|
323
|
+
}, h = [/[+-]\d\d:?(\d\d)?|Z/, function(e2) {
|
|
324
|
+
(this.zone || (this.zone = {})).offset = function(e3) {
|
|
325
|
+
if (!e3) return 0;
|
|
326
|
+
if ("Z" === e3) return 0;
|
|
327
|
+
var t2 = e3.match(/([+-]|\d\d)/g), n2 = 60 * t2[1] + (+t2[2] || 0);
|
|
328
|
+
return 0 === n2 ? 0 : "+" === t2[0] ? -n2 : n2;
|
|
329
|
+
}(e2);
|
|
330
|
+
}], u = function(e2) {
|
|
331
|
+
var t2 = s[e2];
|
|
332
|
+
return t2 && (t2.indexOf ? t2 : t2.s.concat(t2.f));
|
|
333
|
+
}, d = function(e2, t2) {
|
|
334
|
+
var n2, r2 = s.meridiem;
|
|
335
|
+
if (r2) {
|
|
336
|
+
for (var i2 = 1; i2 <= 24; i2 += 1) if (e2.indexOf(r2(i2, 0, t2)) > -1) {
|
|
337
|
+
n2 = i2 > 12;
|
|
338
|
+
break;
|
|
339
|
+
}
|
|
340
|
+
} else n2 = e2 === (t2 ? "pm" : "PM");
|
|
341
|
+
return n2;
|
|
342
|
+
}, c = { A: [o, function(e2) {
|
|
343
|
+
this.afternoon = d(e2, false);
|
|
344
|
+
}], a: [o, function(e2) {
|
|
345
|
+
this.afternoon = d(e2, true);
|
|
346
|
+
}], Q: [n, function(e2) {
|
|
347
|
+
this.month = 3 * (e2 - 1) + 1;
|
|
348
|
+
}], S: [n, function(e2) {
|
|
349
|
+
this.milliseconds = 100 * +e2;
|
|
350
|
+
}], SS: [r, function(e2) {
|
|
351
|
+
this.milliseconds = 10 * +e2;
|
|
352
|
+
}], SSS: [/\d{3}/, function(e2) {
|
|
353
|
+
this.milliseconds = +e2;
|
|
354
|
+
}], s: [i, f("seconds")], ss: [i, f("seconds")], m: [i, f("minutes")], mm: [i, f("minutes")], H: [i, f("hours")], h: [i, f("hours")], HH: [i, f("hours")], hh: [i, f("hours")], D: [i, f("day")], DD: [r, f("day")], Do: [o, function(e2) {
|
|
355
|
+
var t2 = s.ordinal, n2 = e2.match(/\d+/);
|
|
356
|
+
if (this.day = n2[0], t2) for (var r2 = 1; r2 <= 31; r2 += 1) t2(r2).replace(/\[|\]/g, "") === e2 && (this.day = r2);
|
|
357
|
+
}], w: [i, f("week")], ww: [r, f("week")], M: [i, f("month")], MM: [r, f("month")], MMM: [o, function(e2) {
|
|
358
|
+
var t2 = u("months"), n2 = (u("monthsShort") || t2.map(function(e3) {
|
|
359
|
+
return e3.slice(0, 3);
|
|
360
|
+
})).indexOf(e2) + 1;
|
|
361
|
+
if (n2 < 1) throw new Error();
|
|
362
|
+
this.month = n2 % 12 || n2;
|
|
363
|
+
}], MMMM: [o, function(e2) {
|
|
364
|
+
var t2 = u("months").indexOf(e2) + 1;
|
|
365
|
+
if (t2 < 1) throw new Error();
|
|
366
|
+
this.month = t2 % 12 || t2;
|
|
367
|
+
}], Y: [/[+-]?\d+/, f("year")], YY: [r, function(e2) {
|
|
368
|
+
this.year = a(e2);
|
|
369
|
+
}], YYYY: [/\d{4}/, f("year")], Z: h, ZZ: h };
|
|
370
|
+
function l(n2) {
|
|
371
|
+
var r2, i2;
|
|
372
|
+
r2 = n2, i2 = s && s.formats;
|
|
373
|
+
for (var o2 = (n2 = r2.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g, function(t2, n3, r3) {
|
|
374
|
+
var o3 = r3 && r3.toUpperCase();
|
|
375
|
+
return n3 || i2[r3] || e[r3] || i2[o3].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g, function(e2, t3, n4) {
|
|
376
|
+
return t3 || n4.slice(1);
|
|
377
|
+
});
|
|
378
|
+
})).match(t), a2 = o2.length, f2 = 0; f2 < a2; f2 += 1) {
|
|
379
|
+
var h2 = o2[f2], u2 = c[h2], d2 = u2 && u2[0], l2 = u2 && u2[1];
|
|
380
|
+
o2[f2] = l2 ? { regex: d2, parser: l2 } : h2.replace(/^\[|\]$/g, "");
|
|
381
|
+
}
|
|
382
|
+
return function(e2) {
|
|
383
|
+
for (var t2 = {}, n3 = 0, r3 = 0; n3 < a2; n3 += 1) {
|
|
384
|
+
var i3 = o2[n3];
|
|
385
|
+
if ("string" == typeof i3) r3 += i3.length;
|
|
386
|
+
else {
|
|
387
|
+
var s2 = i3.regex, f3 = i3.parser, h3 = e2.slice(r3), u3 = s2.exec(h3)[0];
|
|
388
|
+
f3.call(t2, u3), e2 = e2.replace(u3, "");
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
return function(e3) {
|
|
392
|
+
var t3 = e3.afternoon;
|
|
393
|
+
if (void 0 !== t3) {
|
|
394
|
+
var n4 = e3.hours;
|
|
395
|
+
t3 ? n4 < 12 && (e3.hours += 12) : 12 === n4 && (e3.hours = 0), delete e3.afternoon;
|
|
396
|
+
}
|
|
397
|
+
}(t2), t2;
|
|
398
|
+
};
|
|
399
|
+
}
|
|
400
|
+
return function(e2, t2, n2) {
|
|
401
|
+
n2.p.customParseFormat = true, e2 && e2.parseTwoDigitYear && (a = e2.parseTwoDigitYear);
|
|
402
|
+
var r2 = t2.prototype, i2 = r2.parse;
|
|
403
|
+
r2.parse = function(e3) {
|
|
404
|
+
var t3 = e3.date, r3 = e3.utc, o2 = e3.args;
|
|
405
|
+
this.$u = r3;
|
|
406
|
+
var a2 = o2[1];
|
|
407
|
+
if ("string" == typeof a2) {
|
|
408
|
+
var f2 = true === o2[2], h2 = true === o2[3], u2 = f2 || h2, d2 = o2[2];
|
|
409
|
+
h2 && (d2 = o2[2]), s = this.$locale(), !f2 && d2 && (s = n2.Ls[d2]), this.$d = function(e4, t4, n3, r4) {
|
|
410
|
+
try {
|
|
411
|
+
if (["x", "X"].indexOf(t4) > -1) return new Date(("X" === t4 ? 1e3 : 1) * e4);
|
|
412
|
+
var i3 = l(t4)(e4), o3 = i3.year, s2 = i3.month, a3 = i3.day, f3 = i3.hours, h3 = i3.minutes, u3 = i3.seconds, d3 = i3.milliseconds, c3 = i3.zone, m2 = i3.week, M2 = /* @__PURE__ */ new Date(), Y = a3 || (o3 || s2 ? 1 : M2.getDate()), p = o3 || M2.getFullYear(), v = 0;
|
|
413
|
+
o3 && !s2 || (v = s2 > 0 ? s2 - 1 : M2.getMonth());
|
|
414
|
+
var D, w = f3 || 0, g = h3 || 0, y = u3 || 0, L = d3 || 0;
|
|
415
|
+
return c3 ? new Date(Date.UTC(p, v, Y, w, g, y, L + 60 * c3.offset * 1e3)) : n3 ? new Date(Date.UTC(p, v, Y, w, g, y, L)) : (D = new Date(p, v, Y, w, g, y, L), m2 && (D = r4(D).week(m2).toDate()), D);
|
|
416
|
+
} catch (e5) {
|
|
417
|
+
return /* @__PURE__ */ new Date("");
|
|
418
|
+
}
|
|
419
|
+
}(t3, a2, r3, n2), this.init(), d2 && true !== d2 && (this.$L = this.locale(d2).$L), u2 && t3 != this.format(a2) && (this.$d = /* @__PURE__ */ new Date("")), s = {};
|
|
420
|
+
} else if (a2 instanceof Array) for (var c2 = a2.length, m = 1; m <= c2; m += 1) {
|
|
421
|
+
o2[1] = a2[m - 1];
|
|
422
|
+
var M = n2.apply(this, o2);
|
|
423
|
+
if (M.isValid()) {
|
|
424
|
+
this.$d = M.$d, this.$L = M.$L, this.init();
|
|
425
|
+
break;
|
|
426
|
+
}
|
|
427
|
+
m === c2 && (this.$d = /* @__PURE__ */ new Date(""));
|
|
428
|
+
}
|
|
429
|
+
else i2.call(this, e3);
|
|
430
|
+
};
|
|
431
|
+
};
|
|
432
|
+
});
|
|
433
|
+
}
|
|
434
|
+
});
|
|
435
|
+
|
|
436
|
+
// src/lang/isObject.ts
|
|
437
|
+
function isObject(value) {
|
|
438
|
+
const type = typeof value;
|
|
439
|
+
return value !== null && (type === "object" || type === "function");
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
// src/lang/isObjectLike.ts
|
|
443
|
+
function isObjectLike(value) {
|
|
444
|
+
return value !== null && typeof value === "object";
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
// src/lang/type.ts
|
|
448
|
+
var objectToString = Object.prototype.toString;
|
|
449
|
+
var toTypeString = (value) => objectToString.call(value);
|
|
450
|
+
var toTypeValue = (value) => toTypeString(value).slice(8, -1);
|
|
451
|
+
var isString = (val) => typeof val === "string";
|
|
452
|
+
var isNumber = (val) => typeof val === "number" && Number.isFinite(val);
|
|
453
|
+
var isBoolean = (val) => typeof val === "boolean";
|
|
454
|
+
var isNull = (val) => val === null;
|
|
455
|
+
var isUndefined = (val) => val === void 0;
|
|
456
|
+
var isSymbol = (val) => typeof val === "symbol";
|
|
457
|
+
var isArray = Array.isArray;
|
|
458
|
+
var isFunction = (val) => typeof val === "function";
|
|
459
|
+
var isMap = (val) => toTypeString(val) === "[object Map]";
|
|
460
|
+
var isSet = (val) => toTypeString(val) === "[object Set]";
|
|
461
|
+
var isDate = (val) => toTypeString(val) === "[object Date]";
|
|
462
|
+
var isRegExp = (val) => toTypeString(val) === "[object RegExp]";
|
|
463
|
+
var isPromise = (val) => isObjectLike(val) && isFunction(val?.then) && isFunction(val?.catch);
|
|
464
|
+
var isUndef = (val) => val === void 0 || val === null;
|
|
465
|
+
var isDef = (val) => val !== void 0 && val !== null;
|
|
466
|
+
var hasChanged = (oldValue, newValue) => oldValue !== newValue;
|
|
467
|
+
|
|
468
|
+
// src/lang/isPlainObject.ts
|
|
469
|
+
function isPlainObject(value) {
|
|
470
|
+
return toTypeString(value) === "[object Object]";
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
// src/array/castArray.ts
|
|
474
|
+
function castArray(target) {
|
|
475
|
+
return isArray(target) ? target : [target];
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
// src/utils/code.ts
|
|
479
|
+
function decimalToBinary(decNumber) {
|
|
480
|
+
const stack = [];
|
|
481
|
+
let remainder;
|
|
482
|
+
let binaryString = "";
|
|
483
|
+
while (decNumber > 0) {
|
|
484
|
+
remainder = Math.floor(decNumber % 2);
|
|
485
|
+
stack.push(remainder);
|
|
486
|
+
decNumber = Math.floor(decNumber / 2);
|
|
487
|
+
}
|
|
488
|
+
while (stack.length > 0) {
|
|
489
|
+
binaryString += stack.pop().toString();
|
|
490
|
+
}
|
|
491
|
+
return binaryString;
|
|
492
|
+
}
|
|
493
|
+
var BASE64_CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
494
|
+
function base64Encode(str) {
|
|
495
|
+
let result = "";
|
|
496
|
+
let bin = "";
|
|
497
|
+
for (let i = 0; i < str.length; i++) {
|
|
498
|
+
bin += str[i].charCodeAt(0).toString(2).padStart(8, "0");
|
|
499
|
+
}
|
|
500
|
+
for (let i = 0; i < bin.length; i += 6) {
|
|
501
|
+
result += BASE64_CHARS[parseInt(bin.slice(i, i + 6).padEnd(6, "0"), 2)];
|
|
502
|
+
}
|
|
503
|
+
const padding = result.length % 4;
|
|
504
|
+
if (padding !== 0) result += "=".repeat(4 - padding);
|
|
505
|
+
return result;
|
|
506
|
+
}
|
|
507
|
+
function base64Decode(str) {
|
|
508
|
+
let result = "";
|
|
509
|
+
let bin = "";
|
|
510
|
+
for (let i = 0; i < str.length; i++) {
|
|
511
|
+
if (str[i] === "=") break;
|
|
512
|
+
bin += BASE64_CHARS.indexOf(str[i]).toString(2).padStart(6, "0");
|
|
513
|
+
}
|
|
514
|
+
for (let i = 0; i < bin.length; i += 8) {
|
|
515
|
+
const binary = parseInt(bin.slice(i, i + 8), 2);
|
|
516
|
+
if (binary) {
|
|
517
|
+
result += String.fromCharCode(binary);
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
return result;
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
// src/utils/compose.ts
|
|
524
|
+
function compose(...fns) {
|
|
525
|
+
return fns.reduce(
|
|
526
|
+
(previous, current) => function(...args) {
|
|
527
|
+
return current(previous(...args));
|
|
528
|
+
}
|
|
529
|
+
);
|
|
530
|
+
}
|
|
531
|
+
function composeRight(...fns) {
|
|
532
|
+
return fns.reduce(
|
|
533
|
+
(previous, current) => function(...args) {
|
|
534
|
+
return previous(current(...args));
|
|
535
|
+
}
|
|
536
|
+
);
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
// src/utils/debounce.ts
|
|
540
|
+
function debounce(target, wait = 500) {
|
|
541
|
+
let timer = null;
|
|
542
|
+
return function(...args) {
|
|
543
|
+
if (timer) clearTimeout(timer);
|
|
544
|
+
timer = setTimeout(() => {
|
|
545
|
+
target.apply(this, args);
|
|
546
|
+
}, wait);
|
|
547
|
+
};
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
// src/utils/deepClone.ts
|
|
551
|
+
function deepClone(target) {
|
|
552
|
+
const map = /* @__PURE__ */ new WeakMap();
|
|
553
|
+
function _deepClone(value) {
|
|
554
|
+
if (!isObjectLike(value)) return value;
|
|
555
|
+
if (isDate(value)) return new Date(value);
|
|
556
|
+
if (isRegExp(value)) return new RegExp(value);
|
|
557
|
+
if (isPromise(value)) return value;
|
|
558
|
+
if (map.has(value)) return map.get(value);
|
|
559
|
+
if (isMap(value)) {
|
|
560
|
+
const cloned2 = /* @__PURE__ */ new Map();
|
|
561
|
+
map.set(value, cloned2);
|
|
562
|
+
value.forEach((val, key) => cloned2.set(_deepClone(key), _deepClone(val)));
|
|
563
|
+
return cloned2;
|
|
564
|
+
}
|
|
565
|
+
if (isSet(value)) {
|
|
566
|
+
const cloned2 = /* @__PURE__ */ new Set();
|
|
567
|
+
map.set(value, cloned2);
|
|
568
|
+
value.forEach((val) => cloned2.add(_deepClone(val)));
|
|
569
|
+
return cloned2;
|
|
570
|
+
}
|
|
571
|
+
const cloned = isArray(value) ? Object.setPrototypeOf([], Object.getPrototypeOf(value)) : Object.create(Object.getPrototypeOf(value));
|
|
572
|
+
map.set(value, cloned);
|
|
573
|
+
const descriptors = Object.getOwnPropertyDescriptors(value);
|
|
574
|
+
for (const key of Reflect.ownKeys(descriptors)) {
|
|
575
|
+
const descriptor = descriptors[key];
|
|
576
|
+
if (descriptor.get || descriptor.set) {
|
|
577
|
+
Object.defineProperty(cloned, key, descriptor);
|
|
578
|
+
} else {
|
|
579
|
+
Object.defineProperty(cloned, key, { ...descriptor, value: _deepClone(descriptor.value) });
|
|
580
|
+
}
|
|
581
|
+
}
|
|
582
|
+
return cloned;
|
|
583
|
+
}
|
|
584
|
+
return _deepClone(target);
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
// src/utils/deepMerge.ts
|
|
588
|
+
function deepMerge(template, source, options = {}) {
|
|
589
|
+
return _deepMerge(clone(template, options), clone(source, options), options);
|
|
590
|
+
}
|
|
591
|
+
function _deepMerge(template, source, options) {
|
|
592
|
+
return isArray(template) ? arrayMerge(template, source, options) : mergeObject(template, source, options);
|
|
593
|
+
}
|
|
594
|
+
function mergeObject(template, source, options) {
|
|
595
|
+
if (!isPlainObject(source)) return source;
|
|
596
|
+
const descriptors = Object.getOwnPropertyDescriptors(source);
|
|
597
|
+
Reflect.ownKeys(source).forEach((key) => {
|
|
598
|
+
if ((isPlainObject(template[key]) || isArray(template[key])) && (isPlainObject(source[key]) || isArray(source[key]))) {
|
|
599
|
+
template[key] = _deepMerge(template[key], source[key], options);
|
|
600
|
+
} else {
|
|
601
|
+
Object.defineProperty(template, key, descriptors[key]);
|
|
602
|
+
}
|
|
603
|
+
});
|
|
604
|
+
return template;
|
|
605
|
+
}
|
|
606
|
+
function arrayMerge(template, source, options) {
|
|
607
|
+
const { mergeStrategy = "replace" } = options;
|
|
608
|
+
if (isArray(source)) {
|
|
609
|
+
switch (mergeStrategy) {
|
|
610
|
+
case "merge":
|
|
611
|
+
return template.concat(source);
|
|
612
|
+
case "replace":
|
|
613
|
+
return source;
|
|
614
|
+
default:
|
|
615
|
+
return source;
|
|
616
|
+
}
|
|
617
|
+
}
|
|
618
|
+
return source;
|
|
619
|
+
}
|
|
620
|
+
function clone(source, options) {
|
|
621
|
+
const { deepClone: _deepClone = true } = options;
|
|
622
|
+
return _deepClone ? deepClone(source) : source;
|
|
623
|
+
}
|
|
624
|
+
|
|
625
|
+
// src/utils/error.ts
|
|
626
|
+
var UtilsError = class extends Error {
|
|
627
|
+
constructor(m, name = "Utils") {
|
|
628
|
+
super(m);
|
|
629
|
+
this.name = name;
|
|
630
|
+
}
|
|
631
|
+
};
|
|
632
|
+
function throwError(scope, message) {
|
|
633
|
+
throw new UtilsError(`[${scope}] ${message}`);
|
|
634
|
+
}
|
|
635
|
+
function debugWarn(scope, message) {
|
|
636
|
+
const error2 = isString(scope) ? new UtilsError(`[${scope}] ${message}`, "UtilsWarn") : scope;
|
|
637
|
+
console.warn(error2);
|
|
638
|
+
}
|
|
639
|
+
function warn(...args) {
|
|
640
|
+
console.warn(...args);
|
|
641
|
+
}
|
|
642
|
+
function error(...args) {
|
|
643
|
+
console.error(...args);
|
|
644
|
+
}
|
|
645
|
+
var deprecated = ({
|
|
646
|
+
from,
|
|
647
|
+
replacement,
|
|
648
|
+
version,
|
|
649
|
+
type = "API"
|
|
650
|
+
}) => {
|
|
651
|
+
debugWarn(`${type}`, `${from} is about to be deprecated in version ${version}, please use ${replacement} instead.`);
|
|
652
|
+
};
|
|
653
|
+
function throwErrorInvalidTypeMessage(scope, key, type, value) {
|
|
654
|
+
const message = `Invalid params: type check failed for params "${key}". Expected ${type}, got ${toTypeValue(value)} with value ${value}.`;
|
|
655
|
+
throwError(scope, message);
|
|
656
|
+
}
|
|
657
|
+
function debugWarnInvalidTypeMessage(scope, key, type, value) {
|
|
658
|
+
const message = `Invalid params: type check failed for params "${key}". Expected ${type}, got ${toTypeValue(value)} with value ${value}.`;
|
|
659
|
+
debugWarn(scope, message);
|
|
660
|
+
}
|
|
661
|
+
|
|
662
|
+
// src/utils/log.ts
|
|
663
|
+
var baseConsole = (type, name, ...arg) => {
|
|
664
|
+
if (!name) return;
|
|
665
|
+
const context = arg.length === 0 ? "" : arg.length === 1 ? arg[0] : arg;
|
|
666
|
+
console[type](`[Log] ${name}:`, context);
|
|
667
|
+
};
|
|
668
|
+
var log = (name, ...arg) => {
|
|
669
|
+
baseConsole("info", name, ...arg);
|
|
670
|
+
};
|
|
671
|
+
log.info = (name, ...arg) => {
|
|
672
|
+
baseConsole("info", name, ...arg);
|
|
673
|
+
};
|
|
674
|
+
log.error = (name, ...arg) => {
|
|
675
|
+
baseConsole("error", name, ...arg);
|
|
676
|
+
};
|
|
677
|
+
log.warn = (name, ...arg) => {
|
|
678
|
+
baseConsole("warn", name, ...arg);
|
|
679
|
+
};
|
|
680
|
+
if (typeof globalThis !== "undefined") {
|
|
681
|
+
globalThis.log = log;
|
|
682
|
+
}
|
|
683
|
+
|
|
684
|
+
// src/utils/qs.ts
|
|
685
|
+
function parse(str, options) {
|
|
686
|
+
const { decode = true } = options || {};
|
|
687
|
+
const result = {};
|
|
688
|
+
str.startsWith("?") && (str = str.slice(1));
|
|
689
|
+
str.includes("?") && (str = str.slice(str.indexOf("?") + 1));
|
|
690
|
+
const pairs = str.split("&").filter(Boolean);
|
|
691
|
+
for (const pair of pairs) {
|
|
692
|
+
const [key, value] = pair.split("=");
|
|
693
|
+
result[key] = decode ? decodeURIComponent(value) : value;
|
|
694
|
+
}
|
|
695
|
+
return result;
|
|
696
|
+
}
|
|
697
|
+
function stringify(obj, options) {
|
|
698
|
+
const { encode = true } = options || {};
|
|
699
|
+
const pairs = [];
|
|
700
|
+
for (const key in obj) {
|
|
701
|
+
const value = obj[key];
|
|
702
|
+
pairs.push(`${key}=${encode ? encodeURIComponent(value) : value}`);
|
|
703
|
+
}
|
|
704
|
+
return pairs.join("&");
|
|
705
|
+
}
|
|
706
|
+
function appendQueryString(url, obj, options) {
|
|
707
|
+
const stringifyOptions = deepMerge({ encode: true }, { ...options });
|
|
708
|
+
const query = stringify(obj, stringifyOptions);
|
|
709
|
+
if (url.includes("?")) {
|
|
710
|
+
return url.endsWith("?") || url.endsWith("&") ? `${url}${query}` : `${url}&${query}`;
|
|
711
|
+
}
|
|
712
|
+
return `${url}?${query}`;
|
|
713
|
+
}
|
|
714
|
+
var qs = {
|
|
715
|
+
parse,
|
|
716
|
+
stringify,
|
|
717
|
+
appendQueryString
|
|
718
|
+
};
|
|
719
|
+
|
|
720
|
+
// src/utils/throttle.ts
|
|
721
|
+
function throttle(target, wait = 500) {
|
|
722
|
+
let timer = null;
|
|
723
|
+
return function(...args) {
|
|
724
|
+
if (isUndef(timer)) {
|
|
725
|
+
timer = Date.now();
|
|
726
|
+
return target.apply(this, args);
|
|
727
|
+
}
|
|
728
|
+
const now = Date.now();
|
|
729
|
+
if (now - timer >= wait) {
|
|
730
|
+
timer = now;
|
|
731
|
+
return target.apply(this, args);
|
|
732
|
+
}
|
|
733
|
+
};
|
|
734
|
+
}
|
|
735
|
+
|
|
736
|
+
// src/utils/validator.ts
|
|
737
|
+
function validatorChineseOrEnglishOrNumber(value) {
|
|
738
|
+
return !isUndef(value) && /^[\dA-Z\u4E00-\u9FA5]+$/i.test(value);
|
|
739
|
+
}
|
|
740
|
+
function validatorChineseOrEnglish(value) {
|
|
741
|
+
return !isUndef(value) && /^[A-Z\u4E00-\u9FA5]+$/i.test(value);
|
|
742
|
+
}
|
|
743
|
+
function validatorUppercaseOrNumbersOrSpecial(value) {
|
|
744
|
+
return !isUndef(value) && /^[\d!"#$%&'()*+,./:;<=>?@A-Z[\\\]^_`{|}~]+$/.test(value);
|
|
745
|
+
}
|
|
746
|
+
function validatorUppercaseOrNumbersOrUnderline(value) {
|
|
747
|
+
return /^[\dA-Z_]+$/.test(value);
|
|
748
|
+
}
|
|
749
|
+
|
|
750
|
+
// src/object/pick.ts
|
|
751
|
+
function pick(target, properties, options = {}) {
|
|
752
|
+
const { includeProto = false, includeSymbols = true, includeNonEnum = false } = options;
|
|
753
|
+
const cloned = {};
|
|
754
|
+
if (!isPlainObject(target)) return cloned;
|
|
755
|
+
const propsToPick = castArray(properties);
|
|
756
|
+
propsToPick.forEach((key) => {
|
|
757
|
+
if (isSymbol(key) && !includeSymbols) return;
|
|
758
|
+
const exists = includeProto ? key in target : Object.hasOwn(target, key);
|
|
759
|
+
if (!exists) return;
|
|
760
|
+
if (!includeNonEnum) {
|
|
761
|
+
const descriptor = includeProto ? findPropertyDescriptor(target, key) : Object.getOwnPropertyDescriptor(target, key);
|
|
762
|
+
if (descriptor?.enumerable === false) return;
|
|
763
|
+
}
|
|
764
|
+
cloned[key] = deepClone(target[key]);
|
|
765
|
+
});
|
|
766
|
+
return cloned;
|
|
767
|
+
}
|
|
768
|
+
function findPropertyDescriptor(obj, key) {
|
|
769
|
+
let current = obj;
|
|
770
|
+
while (current !== null) {
|
|
771
|
+
const descriptor = Object.getOwnPropertyDescriptor(current, key);
|
|
772
|
+
if (descriptor) return descriptor;
|
|
773
|
+
current = Object.getPrototypeOf(current);
|
|
774
|
+
}
|
|
775
|
+
}
|
|
776
|
+
|
|
777
|
+
// src/object/omit.ts
|
|
778
|
+
function omit(target, properties) {
|
|
779
|
+
if (!isPlainObject(target)) return {};
|
|
780
|
+
const cloned = deepClone(target);
|
|
781
|
+
const propsToOmit = castArray(properties);
|
|
782
|
+
const keysToPick = Object.keys(cloned).filter(
|
|
783
|
+
(key) => !propsToOmit.includes(key)
|
|
784
|
+
);
|
|
785
|
+
return pick(cloned, keysToPick);
|
|
786
|
+
}
|
|
787
|
+
|
|
788
|
+
// src/random/generateRandomArray.ts
|
|
789
|
+
function generateRandomArray(num, cb) {
|
|
790
|
+
if (!isNumber(num) || num <= 0) {
|
|
791
|
+
throwError("generateRandomArray", "num \u5FC5\u987B\u5927\u4E8E0");
|
|
792
|
+
}
|
|
793
|
+
if (!isFunction(cb)) {
|
|
794
|
+
throwError("generateRandomArray", "cb \u5FC5\u987B\u662F\u51FD\u6570");
|
|
795
|
+
}
|
|
796
|
+
return Array.from({ length: num }).fill(0).map((e, i) => cb(e, i));
|
|
797
|
+
}
|
|
798
|
+
|
|
799
|
+
// src/random/generateRandomColor.ts
|
|
800
|
+
function generateRandomColor() {
|
|
801
|
+
return `#${Math.random().toString(16).slice(2, 8).padEnd(6, "0")}`;
|
|
802
|
+
}
|
|
803
|
+
|
|
804
|
+
// src/random/generateRandomDate.ts
|
|
805
|
+
var import_dayjs = __toESM(require_dayjs_min(), 1);
|
|
806
|
+
var import_customParseFormat = __toESM(require_customParseFormat(), 1);
|
|
807
|
+
|
|
808
|
+
// src/random/getRandomItem.ts
|
|
809
|
+
function getRandomItem(list) {
|
|
810
|
+
return list[Math.floor(Math.random() * list.length)];
|
|
811
|
+
}
|
|
812
|
+
|
|
813
|
+
// src/random/getRandomInt.ts
|
|
814
|
+
function getRandomInt(options = {}) {
|
|
815
|
+
if (isNumber(options)) options = { max: options };
|
|
816
|
+
const { min = 1, max = getRandomItem(getMaxSafeIntegerList()) } = options;
|
|
817
|
+
validateOptions(min, max);
|
|
818
|
+
const effectiveMin = Math.ceil(min);
|
|
819
|
+
const effectiveMax = Math.floor(max);
|
|
820
|
+
return Math.floor(Math.random() * (effectiveMax - effectiveMin + 1) + effectiveMin);
|
|
821
|
+
}
|
|
822
|
+
function validateOptions(min, max) {
|
|
823
|
+
const effectiveMin = Math.ceil(min);
|
|
824
|
+
const effectiveMax = Math.floor(max);
|
|
825
|
+
if (!Number.isSafeInteger(effectiveMin)) {
|
|
826
|
+
throwError("getRandomInt", `The minimum value Math.ceil(${min}) should be a safe integer`);
|
|
827
|
+
}
|
|
828
|
+
if (!Number.isSafeInteger(effectiveMax)) {
|
|
829
|
+
throwError("getRandomInt", `The maximum value Math.floor(${max}) should be a safe integer`);
|
|
830
|
+
}
|
|
831
|
+
if (effectiveMax < effectiveMin) {
|
|
832
|
+
if (max >= min) {
|
|
833
|
+
throwError("getRandomInt", `No integer value found between ${min} and ${max}`);
|
|
834
|
+
}
|
|
835
|
+
throwError("getRandomInt", `The maximum value ${max} should be greater than the minimum value ${min}`);
|
|
836
|
+
}
|
|
837
|
+
}
|
|
838
|
+
function getMaxSafeIntegerList() {
|
|
839
|
+
return Array.from({ length: Number.MAX_SAFE_INTEGER.toString().length }).map((_, i) => {
|
|
840
|
+
const max = Number.MAX_SAFE_INTEGER.toString().slice(0, i + 1);
|
|
841
|
+
return Number(max);
|
|
842
|
+
});
|
|
843
|
+
}
|
|
844
|
+
|
|
845
|
+
// src/random/generateRandomDate.ts
|
|
846
|
+
(0, import_dayjs.extend)(import_customParseFormat.default);
|
|
847
|
+
function generateRandomDate(options = {}) {
|
|
848
|
+
const {
|
|
849
|
+
start = "1800-01-01 00:00:00",
|
|
850
|
+
end = (0, import_dayjs.default)().format("YYYY-MM-DD HH:mm:ss"),
|
|
851
|
+
format = "YYYY-MM-DD HH:mm:ss"
|
|
852
|
+
} = options;
|
|
853
|
+
if (!(0, import_dayjs.default)(start).isValid() || !(0, import_dayjs.default)(end).isValid()) {
|
|
854
|
+
throwError("generateRandomDate", "start end \u53C2\u6570\u5FC5\u987B\u662F\u5408\u6CD5\u7684\u65F6\u95F4\u683C\u5F0F");
|
|
855
|
+
}
|
|
856
|
+
const startYear = (0, import_dayjs.default)(start).year();
|
|
857
|
+
const endYear = (0, import_dayjs.default)(end).year();
|
|
858
|
+
const randomYear = getRandomInt({ min: startYear, max: endYear });
|
|
859
|
+
const randomMonth = getRandomInt({ min: 1, max: 12 });
|
|
860
|
+
const randomDay = getRandomInt({ min: 1, max: 31 });
|
|
861
|
+
const randomHour = getRandomInt(23);
|
|
862
|
+
const randomMinute = getRandomInt(59);
|
|
863
|
+
const randomSecond = getRandomInt(59);
|
|
864
|
+
const result = (0, import_dayjs.default)(`${randomYear}-${randomMonth}-${randomDay} ${randomHour}:${randomMinute}:${randomSecond}`);
|
|
865
|
+
if (result.isBefore((0, import_dayjs.default)(start)) || result.isAfter((0, import_dayjs.default)(end))) {
|
|
866
|
+
return generateRandomDate(options);
|
|
867
|
+
}
|
|
868
|
+
return result.format(format);
|
|
869
|
+
}
|
|
870
|
+
|
|
871
|
+
// src/random/getRandomString.ts
|
|
872
|
+
function getRandomString(options = {}) {
|
|
873
|
+
const normalizedOptions = normalizeOptions(options);
|
|
874
|
+
const characters = buildCharacterSet(normalizedOptions);
|
|
875
|
+
validateLengthCharacters(characters);
|
|
876
|
+
const { length } = normalizedOptions;
|
|
877
|
+
validateLength(length.min, length.max);
|
|
878
|
+
const len = getRandomInt(length);
|
|
879
|
+
let result = normalizedOptions.prefix || "";
|
|
880
|
+
for (let i = 0; i < len; i++) {
|
|
881
|
+
result += characters.charAt(Math.floor(Math.random() * characters.length));
|
|
882
|
+
}
|
|
883
|
+
return result + (normalizedOptions.suffix || "");
|
|
884
|
+
}
|
|
885
|
+
var DEFAULT_MAX = 16;
|
|
886
|
+
var DEFAULT_MIN = 1;
|
|
887
|
+
function normalizeOptions(options) {
|
|
888
|
+
const simple = isNumber(options);
|
|
889
|
+
return {
|
|
890
|
+
lowerCase: true,
|
|
891
|
+
upperCase: true,
|
|
892
|
+
number: true,
|
|
893
|
+
...simple ? {} : options,
|
|
894
|
+
length: simple ? { max: options, min: options } : isNumber(options.length) ? { max: options.length, min: options.length } : { max: DEFAULT_MAX, min: DEFAULT_MIN, ...options.length },
|
|
895
|
+
extra: simple ? [] : [...new Set(castArray(options.extra || []))]
|
|
896
|
+
};
|
|
897
|
+
}
|
|
898
|
+
function buildCharacterSet(options) {
|
|
899
|
+
let characters = "";
|
|
900
|
+
if (options.lowerCase) characters += "abcdefghijklmnopqrstuvwxyz";
|
|
901
|
+
if (options.upperCase) characters += "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
|
902
|
+
if (options.number) characters += "0123456789";
|
|
903
|
+
characters += castArray(options.extra).join("");
|
|
904
|
+
return characters;
|
|
905
|
+
}
|
|
906
|
+
function validateLengthCharacters(characters) {
|
|
907
|
+
if (characters.length === 0) {
|
|
908
|
+
throwError(
|
|
909
|
+
"getRandomString",
|
|
910
|
+
"At least one character set (lowercase, uppercase, number) must be enabled or extra characters provided"
|
|
911
|
+
);
|
|
912
|
+
}
|
|
913
|
+
}
|
|
914
|
+
function validateLength(min, max) {
|
|
915
|
+
if (!Number.isInteger(min)) throwError("getRandomString", "min must be an integer");
|
|
916
|
+
if (!Number.isInteger(max)) throwError("getRandomString", "max must be an integer");
|
|
917
|
+
if (min < DEFAULT_MIN) throwError("getRandomString", `Minimum length cannot be less than ${DEFAULT_MIN}`);
|
|
918
|
+
if (max < min) throwError("getRandomString", `Maximum length cannot be less than minimum length`);
|
|
919
|
+
}
|
|
920
|
+
|
|
921
|
+
// src/random/generateRandomEmail.ts
|
|
922
|
+
function generateRandomEmail() {
|
|
923
|
+
const emailProviders = ["gmail.com", "outlook.com.cn", "example.com", "qq.com", "163.com", "test.com.cn"];
|
|
924
|
+
const result = `${getRandomString(1)}${getRandomString({
|
|
925
|
+
length: getRandomInt({ max: 30, min: 1 })
|
|
926
|
+
})}${getRandomString(1)}@${getRandomItem(emailProviders)}`;
|
|
927
|
+
if (/\.{2,}/.test(result)) {
|
|
928
|
+
return generateRandomEmail();
|
|
929
|
+
}
|
|
930
|
+
return result;
|
|
931
|
+
}
|
|
932
|
+
|
|
933
|
+
// src/random/generateRandomFloat.ts
|
|
934
|
+
function generateRandomFloat(options = {}) {
|
|
935
|
+
if (isNumber(options)) {
|
|
936
|
+
options = { max: options };
|
|
937
|
+
}
|
|
938
|
+
const { min = 0, max = 1, fractionDigits = 2 } = options;
|
|
939
|
+
if (min === max) {
|
|
940
|
+
return min;
|
|
941
|
+
}
|
|
942
|
+
if (min > max) {
|
|
943
|
+
throw new Error(`\u6700\u5927\u503C ${max} \u5E94\u5927\u4E8E\u6700\u5C0F\u503C ${min}`);
|
|
944
|
+
}
|
|
945
|
+
return Math.random() * (max - min) + min;
|
|
946
|
+
}
|
|
947
|
+
|
|
948
|
+
// src/random/generateRandomStringFromSource.ts
|
|
949
|
+
function generateRandomStringFromSource(num, source) {
|
|
950
|
+
if (!isNumber(num) || num <= 0) {
|
|
951
|
+
throwError("generateRandomStringFromSource", "num \u5FC5\u987B\u5927\u4E8E0");
|
|
952
|
+
}
|
|
953
|
+
if (!isArray(source) || source.length === 0) {
|
|
954
|
+
throwError("generateRandomStringFromSource", "source \u4E0D\u80FD\u4E3A\u7A7A\u6570\u7EC4");
|
|
955
|
+
}
|
|
956
|
+
let result = "";
|
|
957
|
+
for (let i = 0; i < num; i++) {
|
|
958
|
+
result += getRandomItem(source);
|
|
959
|
+
}
|
|
960
|
+
return result;
|
|
961
|
+
}
|
|
962
|
+
|
|
963
|
+
// src/random/generateRandomIdCard.ts
|
|
964
|
+
function generateRandomIdCard() {
|
|
965
|
+
const prefix = getRandomInt({ min: 1e5, max: 999999 });
|
|
966
|
+
const zeroToNine = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
|
|
967
|
+
return [
|
|
968
|
+
prefix,
|
|
969
|
+
generateRandomDate({ format: "YYYYMMDD" }),
|
|
970
|
+
generateRandomStringFromSource(3, zeroToNine),
|
|
971
|
+
generateRandomStringFromSource(1, [...zeroToNine, "X", "x"])
|
|
972
|
+
].join("");
|
|
973
|
+
}
|
|
974
|
+
|
|
975
|
+
// src/random/generateRandomMobilePhone.ts
|
|
976
|
+
function generateRandomMobilePhone() {
|
|
977
|
+
return getRandomItem(["13", "14", "15", "16", "17", "18", "19"]) + getRandomInt(999999999).toString().padEnd(9, "0");
|
|
978
|
+
}
|
|
979
|
+
|
|
980
|
+
// src/random/getRandomUrl.ts
|
|
981
|
+
function getRandomUrl() {
|
|
982
|
+
const urlPrefix = ["http://", "https://"];
|
|
983
|
+
const domainSuffix = [".com", ".net", ".org", ".cn", ".top"];
|
|
984
|
+
const parameters = [
|
|
985
|
+
`?name=${getRandomString({ length: { min: 4, max: 8 } })}`,
|
|
986
|
+
`?id=${getRandomInt()}`,
|
|
987
|
+
`?page=${getRandomString({ length: { min: 2, max: 4 } })}`,
|
|
988
|
+
`?query=${getRandomString({ length: { min: 5, max: 6 } })}`,
|
|
989
|
+
`?search=${getRandomString({ length: { min: 1, max: 4 } })}`,
|
|
990
|
+
`?token=${getRandomString({ length: { min: 16, max: 16 } })}`
|
|
991
|
+
];
|
|
992
|
+
return `${getRandomItem(urlPrefix)}${getRandomString({ length: { min: 5, max: 25 } })}${getRandomItem(domainSuffix)}${getRandomItem(parameters)}`;
|
|
993
|
+
}
|
|
994
|
+
|
|
995
|
+
// src/validator/aphabet.ts
|
|
996
|
+
function isNumberOrNumberString(val) {
|
|
997
|
+
return /^\d+$/.test(val);
|
|
998
|
+
}
|
|
999
|
+
function isEnglishAphabet(val) {
|
|
1000
|
+
return /^[A-Z]+$/i.test(val);
|
|
1001
|
+
}
|
|
1002
|
+
function isUpperCase(val) {
|
|
1003
|
+
return /^[A-Z]+$/.test(val);
|
|
1004
|
+
}
|
|
1005
|
+
function isUpperCaseAndNumber(val) {
|
|
1006
|
+
return /^[\dA-Z]+$/.test(val);
|
|
1007
|
+
}
|
|
1008
|
+
function isUpperCaseAndNumberAndChinese(val) {
|
|
1009
|
+
return /^[\dA-Z\u4E00-\u9FA5]+$/.test(val);
|
|
1010
|
+
}
|
|
1011
|
+
function isLowerCase(val) {
|
|
1012
|
+
return /^[a-z]+$/.test(val);
|
|
1013
|
+
}
|
|
1014
|
+
function isLowerCaseAndNumber(val) {
|
|
1015
|
+
return /^[\da-z]+$/.test(val);
|
|
1016
|
+
}
|
|
1017
|
+
function isLowerCaseAndNumberAndChinese(val) {
|
|
1018
|
+
return /^[\da-z\u4E00-\u9FA5]+$/.test(val);
|
|
1019
|
+
}
|
|
1020
|
+
function isChineseString(val) {
|
|
1021
|
+
return /^[\u4E00-\u9FA5]+$/.test(val);
|
|
1022
|
+
}
|
|
1023
|
+
|
|
1024
|
+
// src/validator/float.ts
|
|
1025
|
+
function isFloat(val) {
|
|
1026
|
+
return /^-?(?:0|[1-9]\d*)\.\d+$/.test(val);
|
|
1027
|
+
}
|
|
1028
|
+
function isPositiveFloat(val) {
|
|
1029
|
+
return /^(?:0\.0*[1-9]\d*|[1-9]\d*\.\d+)$/.test(val);
|
|
1030
|
+
}
|
|
1031
|
+
function isNonNegativeFloat(val) {
|
|
1032
|
+
return /^(?:0|[1-9]\d*)\.\d+$/.test(val);
|
|
1033
|
+
}
|
|
1034
|
+
function isNegativeFloat(val) {
|
|
1035
|
+
return /^-(?:0\.0*[1-9]\d*|[1-9]\d*\.\d+)$/.test(val);
|
|
1036
|
+
}
|
|
1037
|
+
function isNonPositiveFloat(val) {
|
|
1038
|
+
return /^-(?:0|[1-9]\d*)\.\d+$/.test(val);
|
|
1039
|
+
}
|
|
1040
|
+
|
|
1041
|
+
// src/validator/integer.ts
|
|
1042
|
+
function isInteger(val) {
|
|
1043
|
+
return /^-?(?:0|[1-9]\d*)$/.test(val);
|
|
1044
|
+
}
|
|
1045
|
+
function isPositiveInteger(val) {
|
|
1046
|
+
return /^[1-9]\d*$/.test(val);
|
|
1047
|
+
}
|
|
1048
|
+
function isNonNegativeInteger(val) {
|
|
1049
|
+
return /^(?:0|[1-9]\d*)$/.test(val) && !Object.is(val, -0);
|
|
1050
|
+
}
|
|
1051
|
+
function isNegativeInteger(val) {
|
|
1052
|
+
return /^-[1-9]\d*$/.test(val);
|
|
1053
|
+
}
|
|
1054
|
+
function isNonPositiveInteger(val) {
|
|
1055
|
+
return /^-(?:0|[1-9]\d*)$/.test(val) || Object.is(val, -0);
|
|
1056
|
+
}
|
|
1057
|
+
|
|
1058
|
+
// src/validator/utils.ts
|
|
1059
|
+
var import_dayjs2 = __toESM(require_dayjs_min(), 1);
|
|
1060
|
+
var import_customParseFormat2 = __toESM(require_customParseFormat(), 1);
|
|
1061
|
+
function isMobilePhone(val) {
|
|
1062
|
+
return /^1[3-9]\d{9}$/.test(val);
|
|
1063
|
+
}
|
|
1064
|
+
function isUrl(val) {
|
|
1065
|
+
return /^https?:\/\/\S+$/i.test(val);
|
|
1066
|
+
}
|
|
1067
|
+
function isEmail(val) {
|
|
1068
|
+
return /^[^\s@]+@[^\s@][^\s.@]*\.[^\s@]+$/.test(val);
|
|
1069
|
+
}
|
|
1070
|
+
function isEmptyString(val) {
|
|
1071
|
+
return val === "";
|
|
1072
|
+
}
|
|
1073
|
+
function isDateString(val, format = "YYYY-MM-DD HH:mm:ss") {
|
|
1074
|
+
(0, import_dayjs2.extend)(import_customParseFormat2.default);
|
|
1075
|
+
return (0, import_dayjs2.default)(val, format, true).isValid();
|
|
1076
|
+
}
|
|
1077
|
+
function isIdCard(val) {
|
|
1078
|
+
const flag = /^[1-9]\d{5}(?:18|19|20)\d{2}(?:0[1-9]|1[0-2])(?:0[1-9]|[12]\d|3[01])\d{3}[\dX]$/i.test(val) && isDateString(val.slice(6, 14), "YYYYMMDD");
|
|
1079
|
+
return flag;
|
|
1080
|
+
}
|
|
1081
|
+
export {
|
|
1082
|
+
base64Decode,
|
|
1083
|
+
base64Encode,
|
|
1084
|
+
castArray,
|
|
1085
|
+
compose,
|
|
1086
|
+
composeRight,
|
|
1087
|
+
debounce,
|
|
1088
|
+
debugWarn,
|
|
1089
|
+
debugWarnInvalidTypeMessage,
|
|
1090
|
+
decimalToBinary,
|
|
1091
|
+
deepClone,
|
|
1092
|
+
deepMerge,
|
|
1093
|
+
deprecated,
|
|
1094
|
+
error,
|
|
1095
|
+
generateRandomArray,
|
|
1096
|
+
generateRandomColor,
|
|
1097
|
+
generateRandomDate,
|
|
1098
|
+
generateRandomEmail,
|
|
1099
|
+
generateRandomFloat,
|
|
1100
|
+
generateRandomIdCard,
|
|
1101
|
+
generateRandomMobilePhone,
|
|
1102
|
+
generateRandomStringFromSource,
|
|
1103
|
+
getRandomInt,
|
|
1104
|
+
getRandomItem,
|
|
1105
|
+
getRandomString,
|
|
1106
|
+
getRandomUrl,
|
|
1107
|
+
hasChanged,
|
|
1108
|
+
isArray,
|
|
1109
|
+
isBoolean,
|
|
1110
|
+
isChineseString,
|
|
1111
|
+
isDate,
|
|
1112
|
+
isDateString,
|
|
1113
|
+
isDef,
|
|
1114
|
+
isEmail,
|
|
1115
|
+
isEmptyString,
|
|
1116
|
+
isEnglishAphabet,
|
|
1117
|
+
isFloat,
|
|
1118
|
+
isFunction,
|
|
1119
|
+
isIdCard,
|
|
1120
|
+
isInteger,
|
|
1121
|
+
isLowerCase,
|
|
1122
|
+
isLowerCaseAndNumber,
|
|
1123
|
+
isLowerCaseAndNumberAndChinese,
|
|
1124
|
+
isMap,
|
|
1125
|
+
isMobilePhone,
|
|
1126
|
+
isNegativeFloat,
|
|
1127
|
+
isNegativeInteger,
|
|
1128
|
+
isNonNegativeFloat,
|
|
1129
|
+
isNonNegativeInteger,
|
|
1130
|
+
isNonPositiveFloat,
|
|
1131
|
+
isNonPositiveInteger,
|
|
1132
|
+
isNull,
|
|
1133
|
+
isNumber,
|
|
1134
|
+
isNumberOrNumberString,
|
|
1135
|
+
isObject,
|
|
1136
|
+
isObjectLike,
|
|
1137
|
+
isPlainObject,
|
|
1138
|
+
isPositiveFloat,
|
|
1139
|
+
isPositiveInteger,
|
|
1140
|
+
isPromise,
|
|
1141
|
+
isRegExp,
|
|
1142
|
+
isSet,
|
|
1143
|
+
isString,
|
|
1144
|
+
isSymbol,
|
|
1145
|
+
isUndef,
|
|
1146
|
+
isUndefined,
|
|
1147
|
+
isUpperCase,
|
|
1148
|
+
isUpperCaseAndNumber,
|
|
1149
|
+
isUpperCaseAndNumberAndChinese,
|
|
1150
|
+
isUrl,
|
|
1151
|
+
objectToString,
|
|
1152
|
+
omit,
|
|
1153
|
+
pick,
|
|
1154
|
+
qs,
|
|
1155
|
+
throttle,
|
|
1156
|
+
throwError,
|
|
1157
|
+
throwErrorInvalidTypeMessage,
|
|
1158
|
+
toTypeString,
|
|
1159
|
+
toTypeValue,
|
|
1160
|
+
validatorChineseOrEnglish,
|
|
1161
|
+
validatorChineseOrEnglishOrNumber,
|
|
1162
|
+
validatorUppercaseOrNumbersOrSpecial,
|
|
1163
|
+
validatorUppercaseOrNumbersOrUnderline,
|
|
1164
|
+
warn
|
|
1165
|
+
};
|