esexts 2.0.5 → 2.0.6

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/esexts.js CHANGED
@@ -108,7 +108,7 @@ c(Object.prototype, {
108
108
  $empty: function() {
109
109
  return Object.keys(this).length == 0;
110
110
  },
111
- $in: function(t) {
111
+ $has: function(t) {
112
112
  return t in this;
113
113
  },
114
114
  $pick: function(...t) {
@@ -1 +1 @@
1
- (function(u){typeof define=="function"&&define.amd?define(u):u()})((function(){"use strict";function u(t,e){return Object.defineProperties(t,Object.fromEntries(Object.keys(e).map(n=>[n,{value:e[n],enumerable:!1,configurable:!0,writable:!0}])))}function g(){return{new:function(...t){return new this(...t)}}}function m(...t){const e={};for(const n of t){const[r,i]=Array.isArray(n)?n:[n,"$"+n];e[i]=function(){return this[r]}}return e}function a(t,e,n,...r){const i={},s=(o,h,c)=>(h!==null&&o.splice(h>=0?h:o.length+h+1,0,c),o);for(const o of r){const[h,c]=Array.isArray(o)?o:[o,"$"+o+n.toString().replaceAll("-","_")];if(n==="")i[c]=function(...f){return t[h].apply(this,s(f,e,this))};else if(n==="t")i[c]=function(...f){return t[h].apply(this,s(f,e,this)),this};else if(n==="a")i[c]=function(...f){return t[h].apply(this,s(f,e,this)),f};else if(n>=0)i[c]=function(...f){return t[h].apply(this,s(f,e,this)),f[n]};else if(n<0)i[c]=function(...f){return t[h].apply(this,s(f,e,this)),f[f.length+n]};else throw Error("unreachable")}return i}function $(t,...e){const n={};for(const r of e){const[i,s]=Array.isArray(r)?r:[r,"$"+r];n[s]=function(...o){return[...t[i].apply(this,o)]}}return n}function w(t={array:!1}){return function(e={},...n){const r=(i,s)=>{const o=Object.prototype.toString.call(i),h=Object.prototype.toString.call(s);if(o!==h)return s;if(o==="[object Array]")return t.array?i.concat(...s):s;if(o==="[object Object]"){for(const c in s)i[c]=r(i[c],s[c]);return i}else return s};for(const i of n)e=r(e,i);return e}}const A=w({array:!1}),b=w({array:!0});u(Object,{...g(),isObject:function(t){return Object.prototype.toString.call(t)==="[object Object]"},merge$:function(...t){return A(this,...t)},concat:function(...t){return b(this,...t)}}),u(Object.prototype,{$clone:function(){return JSON.parse(JSON.stringify(this))},$length:function(){return Object.keys(this).length},...a(Object,0,"","entries","keys","values","assign"),...a(JSON,0,"","stringify"),$merge:function(...t){return A(this,...t)},$concat:function(...t){return b(this,...t)},$empty:function(){return Object.keys(this).length==0},$in:function(t){return t in this},$pick:function(...t){const e={};for(const n of t)e[n]=this[n];return e},$omit:function(...t){const e={},n=new Set(t);for(const r in this)n.has(r)||(e[r]=this[r]);return e},$attr:function(...t){if(typeof this!="object")return this;const[e,n,r,i]=t;return t.length==1?this[e]:t.length==2?(this[e]=n,this):typeof r=="boolean"?(e in this===r&&(this[e]=n),this):r=="define"||r===null?Object.defineProperty(this,e,{value:n,enumerable:!1,configurable:!0,writable:!0,...i}):r==="+"?(this[e]=(this[e]??i??0)+n,this):r==="-"?(this[e]=(this[e]??i??0)-n,this):r==="*"?(this[e]=(this[e]??i??0)*n,this):r==="/"?(this[e]=(this[e]??i??0)/n,this):this},$pipe:function(t,...e){return t(this,...e)},$tee:function(t,...e){return t(this,...e),this},$toArray:function(){return Array.isArray(this)?this:[this]},...a(console,-1,"t",["debug","$debug"],["log","$log"],["info","$info"],["warn","$warn"],["error","$error"],["dir","$dir"]),$debugger:function(...t){console.debug(this,...t);debugger;return this},$getParents:function(t=!1,e=-1,n="parent"){const r=t?[this]:[];let i=this[n];for(;i&&e--!=0;)r.push(i),i=i[n];return r},$getChildrens:function(t=!1,e=-1,n="children"){const r=[],i=(s,o,h)=>{if(o&&r.push(s),!(h==0||!s[n]||s[n].length==0))for(const c of s[n])i(c,!0,h-1)};return i(this,t,e),r},$tree$find:function(t,e=!0,n=-1,r="children"){if(e&&t(this))return this;if(n==0||!this[r]||this[r].length==0)return null;for(const i of this[r]){const s=i.$tree$find(t,!0,n-1,r);if(s!==null)return s}return null},$tree$each:function(t,e=!0,n=-1,r="children"){if(e&&t(this),!(n==0||!this[r]||this[r].length==0)){for(const i of this[r])i.$tree$each(t,!0,n-1,r);return this}},$tree$map:function(t,e=!0,n=-1,r="children",i=null){const s=e?t(this):this,o=[];if(n==0||!this[r]||this[r].length==0)return s;for(const h of this[r])o.push(h.$tree$map(t,!0,n-1,r,i));return s[r]=o,s}}),u(Number.prototype,{...a(Math,0,"",["ceil","ceil"],["floor","floor"],["trunc","trunc"],["abs","abs"],["max","max"],["min","min"]),fixed:function(t=0){return+this.toFixed(t)},round:function(t=0){return Math.round(this*10**t)/10**t},add:function(t,...e){return typeof t=="function"?t(this,...e):this+t},sub:function(t,...e){return typeof t=="function"?t(this,...e):this-t},mul:function(t,...e){return typeof t=="function"?t(this,...e):this*t},div:function(t,...e){return typeof t=="function"?t(this,...e):this/t},baseConvert:function(t=64){let e="",n=this,r="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_-";for(;n>0;)e=r.at(n%t)+e,n=Math.floor(n/t);return e||"0"},unit:function(t,e=0){let n=this,r="";for(const[i,s]of Object.entries(t)){if(r=i,s===0||n<s)break;n=n/s}return e<0?+n.toFixed(0-e)+r:n.toFixed(e)+r},units:function(t,e=!1){let n=this,r=[];for([unit,size]of Object.entries(t))if(size==0||n<size){r.push([n,unit]);break}else r.push([n%size,unit]),n=Math.floor(n/size);return e?r:r.reverse().map(([i,s])=>i+s).join("")},toDate:function(){return Date.new(this)}}),u(BigInt.prototype,{toJSON:function(){return this>=BigInt(Number.MIN_SAFE_INTEGER)&&this<=BigInt(Number.MAX_SAFE_INTEGER)?Number(this):this.toString()}}),u(String.prototype,{...g(),...m(["length","length$"]),$substring:function(t=0,e=this.length){return t=t>=0?t:this.length+t,e=e>=0?e:this.length+e,this.substring(t,e)},$substr:function(t=0,e=this.length){return t=t>=0?t:this.length+t,e=t+e,this.substring(t,e)},$split:function(t=",",e=-1){const n=this?this.split(t):[];return e===-1?n:n.$push(n.splice(e-1).join(t))},$split$number:function(t=","){return this.$split(t).map(e=>+e)},$split$segment:function(t=1){const e=[];for(let n=0;n<this.length;n+=t)e.push(this.substring(n,n+t));return e},sprintf:function(...t){let[e,...n]=this.split(/%[sd]/);for(let r=0;r<n.length;r++)e+=t[r]+n[r];return e},subOf:function(t,e,n=0,r=0){for(let o=0;o<n&&r!=-1;o++,r++)r=this.indexOf(t,r);let i=this.indexOf(t,r),s=this.indexOf(e,i);return i==-1||s==-1?"":(i+=t.length,this.substring(i,s))},lastSubOf:function(t,e,n=0,r=1/0){for(let o=0;o<n&&r!=-1;o++,r--)r=this.lastIndexOf(t,r);let i=this.lastIndexOf(t,r),s=this.indexOf(e,i);return i==-1||s==-1?"":(i+=t.length,this.substring(i,s))},camel2under:function(){return this.substr(0,1)+this.substr(1).replace(/([A-Z])/g,(t,e)=>"_"+e.toLowerCase())},under2camel:function(){return this.replace(/_([a-z])/g,(t,e)=>e.toUpperCase())},camel2pascal:function(){return this.substr(0,1).toUpperCase()+this.substr(1)},pascal2camel:function(){return this.substr(0,1).toLowerCase()+this.substr(1)},under2kebab:function(){return this.replace(/_/g,"-")},kebab2under:function(){return this.replace(/-/g,"_")},baseConvert:function(t=64){let e=0,n="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_-";for(let r=0;r<this.length;r++)e=e*t+n.indexOf(this.at(r));return e},fixed:function(...t){return+(+this).toFixed(...t)},toDate:function(){return Date.new(this)},toUint8Array:function(){return new TextEncoder().encode(this)},hexencode:function(){return new TextEncoder().encode(this).toHex()},hexdecode:function(){return new TextDecoder().decode(Uint8Array.fromHex(this))},base64encode:function(){return new TextEncoder().encode(this).toBase64()},base64decode:function(){return new TextDecoder().decode(Uint8Array.fromBase64(this))}}),u(Array,{...g(),range:function(...t){let e=[],n=0,r=0,i=1,s=typeof t[t.length-1]=="boolean"?t.pop():!0,o=typeof t[t.length-1]=="function"?t.pop():(h,c,f)=>h;switch(t.length){case 1:[r]=t;break;case 2:[n,r]=t;break;case 3:[n,r,i]=t;break;default:throw new Error("the number of parameters is incorrect!")}if(i==0)throw new Error("step cannot be 0!");for(let h=0,c=0,f=Math.abs(r-n),p=Math.abs(i),d=n<=r?1:-1;c<f;c+=p)e.push(s?o(n+c*d,h++,e):o());return e}}),u(Array.prototype,{...m("length"),...$(Array.prototype,"entries","keys","values"),...a(Array.prototype,null,"","map"),...a(Array.prototype,null,"t",["push","$push"],["pop","$pop"],["shift","$shift"],["unshift","$unshift"],["splice","$splice"]),...a(Array.prototype,null,"a","push","unshift"),...a(Array.prototype,null,0,"push","unshift"),$empty:function(){return this.length==0},first:function(t=null){return this.length?this[0]:t},last:function(t=null){return this.length?this[this.length-1]:t},$find:function(t,e=null){return this.find(t)??e},equals:function(t){return this.length===t.length&&(this===t||this.length===0||this.every((e,n)=>e===t[n]))},unique:function(t=e=>e){const e=new Set;return this.filter(n=>e.has(t(n))?!1:!!e.add(t(n)))},...a(Array.prototype,null,"t",["forEach","each"]),each$async:async function(t){for(let e=0;e<this.length;e++)await t(this[e],e,this);return this},map$async:async function(t){const e=[];for(let n=0;n<this.length;n++)e.push(await t(this[n],n,this));return e},shuffle:function(t=!1){let e=this.length;for(;e;){const n=Math.random()*e--|0;[this[n],this[e]]=[this[e],this[n]]}return this},union:function(t){return Set.new(this).union(Set.new(t)).toArray()},intersection:function(t){return Set.new(this).intersection(Set.new(t)).toArray()},difference:function(t){return Set.new(this).difference(Set.new(t)).toArray()},symmetricDifference:function(t){return Set.new(this).symmetricDifference(Set.new(t)).toArray()},toMap:function(t=(e,n)=>[n,e]){return new Map(this.map(t))},toSet:function(t=e=>e){return new Set(this.map(t))},toUint8Array:function(){return new Uint8Array(this)},toBase64:function(){return this.toUint8Array().toBase64()},toHex:function(){return this.toUint8Array().toHex()},decode:function(){return this.toUint8Array().decode()},assoc:function(t,e,n={}){const r=this.unique$(s=>s[t]),i=r.length==0?{}:typeof n=="function"?n(r):n;return this.each$(s=>s[e]=i[s[t]]??null)},toTree:function(t={}){const{id:e="id",pid:n="pid",level:r="level",root:i="root",parent:s="parent",children:o="children",empty:h=null,hasRoot:c=!0}=t,f=this.reduce((l,y)=>l.$attr(y[e],y),{}),p=this.reduce((l,y)=>(l.$attr(y[n],[],!1).$attr(y[n]).$push(y),l),{}),d=this.length&&c?this.find(l=>l[n]===0):{[e]:0,[n]:-1,[i]:null,[s]:null,[o]:p[0]};u(d,{[i]:d});for(const l of this)u(l,{[i]:d,[s]:f[l[n]]}),l[o]=p[l[e]]||h;return d.$tree$each(l=>l[r]=l[s]?l[s][r]+1:0,-1,o),d},$tree2tree:function(t={},e=null,n=null){const{id:r="id",pid:i="pid",level:s="level",root:o="root",parent:h="parent",children:c="children",empty:f=null}=t;e=e||{[r]:0,[i]:-1,[s]:0,[o]:null,[h]:null,[c]:this},n=n||e;for(const p of this)u(p,{[o]:e,[h]:n}),p[i]=n[r],p[s]=n[s]+1,p[c]=p[c]&&p[c].length?p[c]:f,p[c]?.$tree2tree(t,e,p);return e},$tree$find:function(t,e=!0,n=-1,r="children"){for(const i of this){const s=i.$tree$find(t,e,n,r);if(s!==null)return s}return null},$tree$each:function(t,e=!0,n=-1,r="children"){for(const i of this)i.$tree$each(t,e,n,r);return this},$tree$map:function(t,e=!0,n=-1,r="children",i=null){return this.map(s=>s.$tree$map(t,e,n,r,i))}}),u(Map,{...g()}),u(Map.prototype,{...m(["size","$length"]),...$(Map.prototype,"entries","keys","values"),...a(Map.prototype,null,"t",["set","$set"],["delete","$delete"]),...a(Map.prototype,null,"a","set","delete"),...a(Map.prototype,null,0,"set","delete"),...a(Map.prototype,null,1,"set","delete"),$getOrInsert:function(t,e=null){return this.has(t)?this.get(t):this.$set1(t,e)},$getOrInsertComputed:function(t,e){return this.has(t)?this.get(t):this.$set1(t,e(t))},$get:function(t,e=null){return this.has(t)?this.get(t):this.$set1(t,typeof e=="function"?e(t):e)},$get$async:async function(t,e=null){return this.has(t)?this.get(t):this.$set1(t,typeof e=="function"?await e(t):e)},toObject:function(){return Object.fromEntries(this)},toArray:function(){return[...this]},toJSON:function(){return[...this]}}),typeof Map.prototype.getOrInsert>"u"&&(Map.prototype.getOrInsert=Map.prototype.$getOrInsert,Map.prototype.getOrInsertComputed=Map.prototype.$getOrInsertComputed),u(Set,{...g()}),u(Set.prototype,{...m(["size","$length"]),...$(Set.prototype,"entries","keys","values"),...a(Set.prototype,null,"t",["add","$add"],["delete","$delete"]),...a(Set.prototype,null,"a","add","delete"),...a(Set.prototype,null,0,"add","delete"),$union:function(t){return new Set([...this,...t])},$intersection:function(t){return new Set([...this].filter(e=>t.has(e)))},$difference:function(t){return new Set([...this].filter(e=>!t.has(e)))},$symmetricDifference:function(t){return new Set([...[...this].filter(e=>!t.has(e)),...[...t].filter(e=>!this.has(e))])},toArray:function(){return[...this]},toJSON:function(){return[...this]}}),typeof Set.prototype.union>"u"&&(Set.prototype.union=Set.prototype.$union,Set.prototype.intersection=Set.prototype.$intersection,Set.prototype.difference=Set.prototype.$difference,Set.prototype.symmetricDifference=Set.prototype.$symmetricDifference),u(Date,{new:function(...t){return t.length!=1?new Date(...t):Number.isNaN(+t[0])?new Date(t[0].includes("T")?t[0]:t[0].replace(/-/g,"/")):new Date(t[0]>25e8?t[0]:t[0]*1e3)},format:function(t="y-m-d h:i:s"){return new Date().format(t)},unix:function(){return this.now()/1e3|0},fromUnix:function(t){return new Date((t??0)*1e3)},expr:function(t={}){return new Date().expr(t)},toDayRange:function(){const t=new Date,e=t.getFullYear(),n=t.getMonth(),r=t.getDate(),i=new Date(e,n,r).getTime()/1e3|0;return[i,i+86400-1]},toWeekRange:function(){let t=new Date;for(;t.getDay()!=1;)t=new Date(t.getTime()-86400);const e=t.getFullYear(),n=t.getMonth(),r=t.getDate(),i=new Date(e,n,r).getTime()/1e3|0;return[i,i+86400*7-1]},toMonthRange:function(){const t=new Date,e=t.getFullYear(),n=t.getMonth(),r=new Date(e,n,1).getTime()/1e3|0,i=new Date(e,n+1,0,23,59,59).getTime()/1e3|0;return[r,i]},toYearRange:function(){const e=new Date().getFullYear(),n=new Date(e,1,1).getTime()/1e3|0,r=new Date(e+1,1,0,23,59,59).getTime()/1e3|0;return[n,r]}}),u(Date.prototype,{format:function(t="y-m-d h:i:s"){if(this.getTime()===0)return"-";const e={y:this.getFullYear(),m:this.getMonth()+1,d:this.getDate(),h:this.getHours(),i:this.getMinutes(),s:this.getSeconds(),l:this.getMilliseconds(),e:this.getMonthDay()};return t.replace(/([ymdhisle])/ig,(n,r)=>r>="A"&&r<="Z"?e[r.toLowerCase()]:e[r].toString().padStart(r==="l"?3:2,"0"))},unix:function(){return this.getTime()/1e3|0},isLeapYear:function(){return this.getFullYear()%4===0&&this.getFullYear()%400!==0},getMonthDay:function(){return[31,0,31,30,31,30,31,31,30,31,30,31][this.getMonth()]||(this.isLeapYear()?29:28)},expr:function({y:t=0,m:e=0,d:n=0,h:r=0,i=0,s=0}){const o=new Date(this.getFullYear()+t,this.getMonth()+e+1,0);return new Date(this.getFullYear()+t,this.getMonth()+e,Math.min(o.getDate(),this.getDate())+n,this.getHours()+r,this.getMinutes()+i,this.getSeconds()+s)},begin:function(t=3){return new Date(...[this.getFullYear(),this.getMonth(),this.getDate(),this.getHours(),this.getMinutes(),this.getSeconds()].slice(0,t),...[this.getFullYear(),0,1,0,0,0].slice(t))},end:function(t=3){return new Date(...[this.getFullYear(),this.getMonth(),this.getDate(),this.getHours(),this.getMinutes(),this.getSeconds()].slice(0,t),...[this.getFullYear(),11,t<2?31:this.getMonthDay(),23,59,59].slice(t))},week:function(t,e=1){let n=new Date(this.getTime());for(;n.getDay()!==t;)n=new Date(n.getTime()+864e5*e);return n},toJSON:function(){return this.getTime()}}),u(RegExp,{...g()}),u(RegExp.prototype,{toJSON:function(){return this.toString()}}),u(Promise,{...g(),channel:function(){let t=null,e=null;return[new this((r,i)=>{t=r,e=i}),t,e]},$withResolvers:function(){let t=null,e=null;return{promise:new this((r,i)=>{t=r,e=i}),resolve:t,reject:e}}}),u(Promise.prototype,{tryCatch:function(){return new Promise(t=>this.then(e=>t([e,null])).catch(e=>t([null,e])))}}),typeof Promise.withResolvers>"u"&&(Promise.withResolvers=Promise.$withResolvers),u(JSON,{$parse:function(t,e=null){try{if(typeof t!="string")throw new Error("not string");return JSON.parse(t)}catch{return e}}}),typeof Iterator<"u"&&u(Iterator.prototype,{toArray:function(){return[...this]}}),u(ArrayBuffer.prototype,{toUint8Array:function(){return new Uint8Array(this)}}),u(Uint8Array,{...g(),fromString:function(t){return new TextEncoder().encode(t)},$fromHex:function(t){const e=[];for(let n=0;n<t.length;n+=2)e.push(Number.parseInt(t.substring(n,n+2),16));return new Uint8Array(e)},$fromBase64:function(t){const e=[],n={},r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(let s=0;s<r.length;s++)n[r.charAt(s)]=s;const i=t.charAt(t.length-1)!="="?t.length:t.charAt(t.length-2)!="="?t.length-1:t.length-2;for(let s=3;s<i;s+=4){const o=(n[t.charAt(s-3)]<<18)+(n[t.charAt(s-2)]<<12)+(n[t.charAt(s-1)]<<6)+n[t.charAt(s)];e.push((o&16711680)>>16,(o&65280)>>8,o&255)}if(i%4==3){const s=(n[t.charAt(i-3)]<<18)+(n[t.charAt(i-2)]<<12)+(n[t.charAt(i-1)]<<6);e.push((s&16711680)>>16,(s&65280)>>8)}else if(i%4==2){const s=(n[t.charAt(i-2)]<<18)+(n[t.charAt(i-1)]<<12);e.push((s&16711680)>>16)}return new Uint8Array(e)}}),u(Uint8Array.prototype,{setFromString(t,e=0){const n=Uint8Array.fromString(t);return this.set(n,e),{read:n.length,written:n.length}},$setFromHex(t,e=0){const n=Uint8Array.fromHex(t);return this.set(n,e),{read:n.length,written:n.length}},$setFromBase64(t,e=0){const n=Uint8Array.fromBase64(t);return this.set(n,e),{read:n.length,written:n.length}},toString:function(){return new TextDecoder().decode(this)},$toHex:function(){let t="";for(let e=0;e<this.length;e++)t+=(this[e]<16?"0":"")+this[e].toString(16);return t},$toBase64:function(){let t="",e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(let n=2;n<this.length;n+=3){const r=(this[n-2]<<16)+(this[n-1]<<8)+this[n];t+=e.charAt((r&16515072)>>18)+e.charAt((r&258048)>>12)+e.charAt((r&4032)>>6)+e.charAt(r&63)}if(this.length%3==2){const n=(this[this.length-2]<<16)+(this[this.length-1]<<8);t+=e.charAt((n&16515072)>>18)+e.charAt((n&258048)>>12)+e.charAt((n&4032)>>6)+"="}else if(this.length%3==1){const n=this[this.length-1]<<16;t+=e.charAt((n&16515072)>>18)+e.charAt((n&258048)>>12)+"=="}return t},toArray:function(){return new Array(...this)}}),typeof Uint8Array.fromBase64>"u"&&(Uint8Array.fromHex=Uint8Array.$fromHex,Uint8Array.fromBase64=Uint8Array.$fromBase64),typeof Uint8Array.prototype.setFromHex>"u"&&(Uint8Array.prototype.setFromHex=Uint8Array.prototype.$setFromHex,Uint8Array.prototype.setFromBase64=Uint8Array.prototype.$setFromBase64,Uint8Array.prototype.toHex=Uint8Array.prototype.$toHex,Uint8Array.prototype.toBase64=Uint8Array.prototype.$toBase64);let D=0,x=0,S=0;u(Math,{randstr:function(t=16,e=0,n="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",r="~!@#$%^&*()_+`{}|[]\\:\";'<>,.?/"){if(t<e)throw new Error("randstr: len < slen");const i=[];for(let s=0;s<t;s++)i.push(n.charAt(Math.random()*n.length|0));for(let s=new Set,o=0,h=0;h<e;h++){do o=Math.random()*t|0;while(s.has(o));s.set(o,!0),i[o]=r.charAt(Math.random()*r.length|0)}return i.join("")},randint:function(t=0,e=Number.MAX_SAFE_INTEGER){return Math.floor(Math.random()*(e-t)+t)},incrid:function(){return++D},incrstr:function(){return""+Math.incrid()},uniqid:function(t=Date.now()){return t===S?t*2048+ ++x%2048:(S=t)*2048+(x=0)%2048},uniqstr:function(){return""+Math.uniqid()},sleep:function(t){return new Promise(e=>setTimeout(e,t))},useTemplate:function(t){let e=null;const n={setup(i,{slots:s}){return e=s.default,()=>{}},name:t+"Template"},r={setup(i,{attrs:s}){return()=>e?.(s)},name:t};return{[n.name]:n,[r.name]:r}}});class M extends Map{constructor(e){super(),this.capacity=e}get(e){if(!super.has(e))return null;const n=super.get(e);return super.delete(e),super.set(e,n),n}getOrInsert(e,n){super.has(e)||super.set(e,n);const r=super.get(e);return super.delete(e),super.set(e,r),r}getOrInsertComputed(e,n){super.has(e)||super.set(e,n(e));const r=super.get(e);return super.delete(e),super.set(e,r),r}async getOrInsertComputedAsync(e,n){super.has(e)||super.set(e,await n(e));const r=super.get(e);return super.delete(e),super.set(e,r),r}set(e,n){super.has(e)&&super.delete(e),super.set(e,n),super.size>this.capacity&&super.delete(super.keys().next().value)}put(e,n){return this.set(e,n)}}u(M,{...g()}),typeof globalThis.LRU>"u"&&(globalThis.LRU=M)}));
1
+ (function(u){typeof define=="function"&&define.amd?define(u):u()})((function(){"use strict";function u(t,e){return Object.defineProperties(t,Object.fromEntries(Object.keys(e).map(n=>[n,{value:e[n],enumerable:!1,configurable:!0,writable:!0}])))}function g(){return{new:function(...t){return new this(...t)}}}function m(...t){const e={};for(const n of t){const[r,i]=Array.isArray(n)?n:[n,"$"+n];e[i]=function(){return this[r]}}return e}function a(t,e,n,...r){const i={},s=(o,h,c)=>(h!==null&&o.splice(h>=0?h:o.length+h+1,0,c),o);for(const o of r){const[h,c]=Array.isArray(o)?o:[o,"$"+o+n.toString().replaceAll("-","_")];if(n==="")i[c]=function(...f){return t[h].apply(this,s(f,e,this))};else if(n==="t")i[c]=function(...f){return t[h].apply(this,s(f,e,this)),this};else if(n==="a")i[c]=function(...f){return t[h].apply(this,s(f,e,this)),f};else if(n>=0)i[c]=function(...f){return t[h].apply(this,s(f,e,this)),f[n]};else if(n<0)i[c]=function(...f){return t[h].apply(this,s(f,e,this)),f[f.length+n]};else throw Error("unreachable")}return i}function $(t,...e){const n={};for(const r of e){const[i,s]=Array.isArray(r)?r:[r,"$"+r];n[s]=function(...o){return[...t[i].apply(this,o)]}}return n}function w(t={array:!1}){return function(e={},...n){const r=(i,s)=>{const o=Object.prototype.toString.call(i),h=Object.prototype.toString.call(s);if(o!==h)return s;if(o==="[object Array]")return t.array?i.concat(...s):s;if(o==="[object Object]"){for(const c in s)i[c]=r(i[c],s[c]);return i}else return s};for(const i of n)e=r(e,i);return e}}const A=w({array:!1}),b=w({array:!0});u(Object,{...g(),isObject:function(t){return Object.prototype.toString.call(t)==="[object Object]"},merge$:function(...t){return A(this,...t)},concat:function(...t){return b(this,...t)}}),u(Object.prototype,{$clone:function(){return JSON.parse(JSON.stringify(this))},$length:function(){return Object.keys(this).length},...a(Object,0,"","entries","keys","values","assign"),...a(JSON,0,"","stringify"),$merge:function(...t){return A(this,...t)},$concat:function(...t){return b(this,...t)},$empty:function(){return Object.keys(this).length==0},$has:function(t){return t in this},$pick:function(...t){const e={};for(const n of t)e[n]=this[n];return e},$omit:function(...t){const e={},n=new Set(t);for(const r in this)n.has(r)||(e[r]=this[r]);return e},$attr:function(...t){if(typeof this!="object")return this;const[e,n,r,i]=t;return t.length==1?this[e]:t.length==2?(this[e]=n,this):typeof r=="boolean"?(e in this===r&&(this[e]=n),this):r=="define"||r===null?Object.defineProperty(this,e,{value:n,enumerable:!1,configurable:!0,writable:!0,...i}):r==="+"?(this[e]=(this[e]??i??0)+n,this):r==="-"?(this[e]=(this[e]??i??0)-n,this):r==="*"?(this[e]=(this[e]??i??0)*n,this):r==="/"?(this[e]=(this[e]??i??0)/n,this):this},$pipe:function(t,...e){return t(this,...e)},$tee:function(t,...e){return t(this,...e),this},$toArray:function(){return Array.isArray(this)?this:[this]},...a(console,-1,"t",["debug","$debug"],["log","$log"],["info","$info"],["warn","$warn"],["error","$error"],["dir","$dir"]),$debugger:function(...t){console.debug(this,...t);debugger;return this},$getParents:function(t=!1,e=-1,n="parent"){const r=t?[this]:[];let i=this[n];for(;i&&e--!=0;)r.push(i),i=i[n];return r},$getChildrens:function(t=!1,e=-1,n="children"){const r=[],i=(s,o,h)=>{if(o&&r.push(s),!(h==0||!s[n]||s[n].length==0))for(const c of s[n])i(c,!0,h-1)};return i(this,t,e),r},$tree$find:function(t,e=!0,n=-1,r="children"){if(e&&t(this))return this;if(n==0||!this[r]||this[r].length==0)return null;for(const i of this[r]){const s=i.$tree$find(t,!0,n-1,r);if(s!==null)return s}return null},$tree$each:function(t,e=!0,n=-1,r="children"){if(e&&t(this),!(n==0||!this[r]||this[r].length==0)){for(const i of this[r])i.$tree$each(t,!0,n-1,r);return this}},$tree$map:function(t,e=!0,n=-1,r="children",i=null){const s=e?t(this):this,o=[];if(n==0||!this[r]||this[r].length==0)return s;for(const h of this[r])o.push(h.$tree$map(t,!0,n-1,r,i));return s[r]=o,s}}),u(Number.prototype,{...a(Math,0,"",["ceil","ceil"],["floor","floor"],["trunc","trunc"],["abs","abs"],["max","max"],["min","min"]),fixed:function(t=0){return+this.toFixed(t)},round:function(t=0){return Math.round(this*10**t)/10**t},add:function(t,...e){return typeof t=="function"?t(this,...e):this+t},sub:function(t,...e){return typeof t=="function"?t(this,...e):this-t},mul:function(t,...e){return typeof t=="function"?t(this,...e):this*t},div:function(t,...e){return typeof t=="function"?t(this,...e):this/t},baseConvert:function(t=64){let e="",n=this,r="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_-";for(;n>0;)e=r.at(n%t)+e,n=Math.floor(n/t);return e||"0"},unit:function(t,e=0){let n=this,r="";for(const[i,s]of Object.entries(t)){if(r=i,s===0||n<s)break;n=n/s}return e<0?+n.toFixed(0-e)+r:n.toFixed(e)+r},units:function(t,e=!1){let n=this,r=[];for([unit,size]of Object.entries(t))if(size==0||n<size){r.push([n,unit]);break}else r.push([n%size,unit]),n=Math.floor(n/size);return e?r:r.reverse().map(([i,s])=>i+s).join("")},toDate:function(){return Date.new(this)}}),u(BigInt.prototype,{toJSON:function(){return this>=BigInt(Number.MIN_SAFE_INTEGER)&&this<=BigInt(Number.MAX_SAFE_INTEGER)?Number(this):this.toString()}}),u(String.prototype,{...g(),...m(["length","length$"]),$substring:function(t=0,e=this.length){return t=t>=0?t:this.length+t,e=e>=0?e:this.length+e,this.substring(t,e)},$substr:function(t=0,e=this.length){return t=t>=0?t:this.length+t,e=t+e,this.substring(t,e)},$split:function(t=",",e=-1){const n=this?this.split(t):[];return e===-1?n:n.$push(n.splice(e-1).join(t))},$split$number:function(t=","){return this.$split(t).map(e=>+e)},$split$segment:function(t=1){const e=[];for(let n=0;n<this.length;n+=t)e.push(this.substring(n,n+t));return e},sprintf:function(...t){let[e,...n]=this.split(/%[sd]/);for(let r=0;r<n.length;r++)e+=t[r]+n[r];return e},subOf:function(t,e,n=0,r=0){for(let o=0;o<n&&r!=-1;o++,r++)r=this.indexOf(t,r);let i=this.indexOf(t,r),s=this.indexOf(e,i);return i==-1||s==-1?"":(i+=t.length,this.substring(i,s))},lastSubOf:function(t,e,n=0,r=1/0){for(let o=0;o<n&&r!=-1;o++,r--)r=this.lastIndexOf(t,r);let i=this.lastIndexOf(t,r),s=this.indexOf(e,i);return i==-1||s==-1?"":(i+=t.length,this.substring(i,s))},camel2under:function(){return this.substr(0,1)+this.substr(1).replace(/([A-Z])/g,(t,e)=>"_"+e.toLowerCase())},under2camel:function(){return this.replace(/_([a-z])/g,(t,e)=>e.toUpperCase())},camel2pascal:function(){return this.substr(0,1).toUpperCase()+this.substr(1)},pascal2camel:function(){return this.substr(0,1).toLowerCase()+this.substr(1)},under2kebab:function(){return this.replace(/_/g,"-")},kebab2under:function(){return this.replace(/-/g,"_")},baseConvert:function(t=64){let e=0,n="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_-";for(let r=0;r<this.length;r++)e=e*t+n.indexOf(this.at(r));return e},fixed:function(...t){return+(+this).toFixed(...t)},toDate:function(){return Date.new(this)},toUint8Array:function(){return new TextEncoder().encode(this)},hexencode:function(){return new TextEncoder().encode(this).toHex()},hexdecode:function(){return new TextDecoder().decode(Uint8Array.fromHex(this))},base64encode:function(){return new TextEncoder().encode(this).toBase64()},base64decode:function(){return new TextDecoder().decode(Uint8Array.fromBase64(this))}}),u(Array,{...g(),range:function(...t){let e=[],n=0,r=0,i=1,s=typeof t[t.length-1]=="boolean"?t.pop():!0,o=typeof t[t.length-1]=="function"?t.pop():(h,c,f)=>h;switch(t.length){case 1:[r]=t;break;case 2:[n,r]=t;break;case 3:[n,r,i]=t;break;default:throw new Error("the number of parameters is incorrect!")}if(i==0)throw new Error("step cannot be 0!");for(let h=0,c=0,f=Math.abs(r-n),p=Math.abs(i),d=n<=r?1:-1;c<f;c+=p)e.push(s?o(n+c*d,h++,e):o());return e}}),u(Array.prototype,{...m("length"),...$(Array.prototype,"entries","keys","values"),...a(Array.prototype,null,"","map"),...a(Array.prototype,null,"t",["push","$push"],["pop","$pop"],["shift","$shift"],["unshift","$unshift"],["splice","$splice"]),...a(Array.prototype,null,"a","push","unshift"),...a(Array.prototype,null,0,"push","unshift"),$empty:function(){return this.length==0},first:function(t=null){return this.length?this[0]:t},last:function(t=null){return this.length?this[this.length-1]:t},$find:function(t,e=null){return this.find(t)??e},equals:function(t){return this.length===t.length&&(this===t||this.length===0||this.every((e,n)=>e===t[n]))},unique:function(t=e=>e){const e=new Set;return this.filter(n=>e.has(t(n))?!1:!!e.add(t(n)))},...a(Array.prototype,null,"t",["forEach","each"]),each$async:async function(t){for(let e=0;e<this.length;e++)await t(this[e],e,this);return this},map$async:async function(t){const e=[];for(let n=0;n<this.length;n++)e.push(await t(this[n],n,this));return e},shuffle:function(t=!1){let e=this.length;for(;e;){const n=Math.random()*e--|0;[this[n],this[e]]=[this[e],this[n]]}return this},union:function(t){return Set.new(this).union(Set.new(t)).toArray()},intersection:function(t){return Set.new(this).intersection(Set.new(t)).toArray()},difference:function(t){return Set.new(this).difference(Set.new(t)).toArray()},symmetricDifference:function(t){return Set.new(this).symmetricDifference(Set.new(t)).toArray()},toMap:function(t=(e,n)=>[n,e]){return new Map(this.map(t))},toSet:function(t=e=>e){return new Set(this.map(t))},toUint8Array:function(){return new Uint8Array(this)},toBase64:function(){return this.toUint8Array().toBase64()},toHex:function(){return this.toUint8Array().toHex()},decode:function(){return this.toUint8Array().decode()},assoc:function(t,e,n={}){const r=this.unique$(s=>s[t]),i=r.length==0?{}:typeof n=="function"?n(r):n;return this.each$(s=>s[e]=i[s[t]]??null)},toTree:function(t={}){const{id:e="id",pid:n="pid",level:r="level",root:i="root",parent:s="parent",children:o="children",empty:h=null,hasRoot:c=!0}=t,f=this.reduce((l,y)=>l.$attr(y[e],y),{}),p=this.reduce((l,y)=>(l.$attr(y[n],[],!1).$attr(y[n]).$push(y),l),{}),d=this.length&&c?this.find(l=>l[n]===0):{[e]:0,[n]:-1,[i]:null,[s]:null,[o]:p[0]};u(d,{[i]:d});for(const l of this)u(l,{[i]:d,[s]:f[l[n]]}),l[o]=p[l[e]]||h;return d.$tree$each(l=>l[r]=l[s]?l[s][r]+1:0,-1,o),d},$tree2tree:function(t={},e=null,n=null){const{id:r="id",pid:i="pid",level:s="level",root:o="root",parent:h="parent",children:c="children",empty:f=null}=t;e=e||{[r]:0,[i]:-1,[s]:0,[o]:null,[h]:null,[c]:this},n=n||e;for(const p of this)u(p,{[o]:e,[h]:n}),p[i]=n[r],p[s]=n[s]+1,p[c]=p[c]&&p[c].length?p[c]:f,p[c]?.$tree2tree(t,e,p);return e},$tree$find:function(t,e=!0,n=-1,r="children"){for(const i of this){const s=i.$tree$find(t,e,n,r);if(s!==null)return s}return null},$tree$each:function(t,e=!0,n=-1,r="children"){for(const i of this)i.$tree$each(t,e,n,r);return this},$tree$map:function(t,e=!0,n=-1,r="children",i=null){return this.map(s=>s.$tree$map(t,e,n,r,i))}}),u(Map,{...g()}),u(Map.prototype,{...m(["size","$length"]),...$(Map.prototype,"entries","keys","values"),...a(Map.prototype,null,"t",["set","$set"],["delete","$delete"]),...a(Map.prototype,null,"a","set","delete"),...a(Map.prototype,null,0,"set","delete"),...a(Map.prototype,null,1,"set","delete"),$getOrInsert:function(t,e=null){return this.has(t)?this.get(t):this.$set1(t,e)},$getOrInsertComputed:function(t,e){return this.has(t)?this.get(t):this.$set1(t,e(t))},$get:function(t,e=null){return this.has(t)?this.get(t):this.$set1(t,typeof e=="function"?e(t):e)},$get$async:async function(t,e=null){return this.has(t)?this.get(t):this.$set1(t,typeof e=="function"?await e(t):e)},toObject:function(){return Object.fromEntries(this)},toArray:function(){return[...this]},toJSON:function(){return[...this]}}),typeof Map.prototype.getOrInsert>"u"&&(Map.prototype.getOrInsert=Map.prototype.$getOrInsert,Map.prototype.getOrInsertComputed=Map.prototype.$getOrInsertComputed),u(Set,{...g()}),u(Set.prototype,{...m(["size","$length"]),...$(Set.prototype,"entries","keys","values"),...a(Set.prototype,null,"t",["add","$add"],["delete","$delete"]),...a(Set.prototype,null,"a","add","delete"),...a(Set.prototype,null,0,"add","delete"),$union:function(t){return new Set([...this,...t])},$intersection:function(t){return new Set([...this].filter(e=>t.has(e)))},$difference:function(t){return new Set([...this].filter(e=>!t.has(e)))},$symmetricDifference:function(t){return new Set([...[...this].filter(e=>!t.has(e)),...[...t].filter(e=>!this.has(e))])},toArray:function(){return[...this]},toJSON:function(){return[...this]}}),typeof Set.prototype.union>"u"&&(Set.prototype.union=Set.prototype.$union,Set.prototype.intersection=Set.prototype.$intersection,Set.prototype.difference=Set.prototype.$difference,Set.prototype.symmetricDifference=Set.prototype.$symmetricDifference),u(Date,{new:function(...t){return t.length!=1?new Date(...t):Number.isNaN(+t[0])?new Date(t[0].includes("T")?t[0]:t[0].replace(/-/g,"/")):new Date(t[0]>25e8?t[0]:t[0]*1e3)},format:function(t="y-m-d h:i:s"){return new Date().format(t)},unix:function(){return this.now()/1e3|0},fromUnix:function(t){return new Date((t??0)*1e3)},expr:function(t={}){return new Date().expr(t)},toDayRange:function(){const t=new Date,e=t.getFullYear(),n=t.getMonth(),r=t.getDate(),i=new Date(e,n,r).getTime()/1e3|0;return[i,i+86400-1]},toWeekRange:function(){let t=new Date;for(;t.getDay()!=1;)t=new Date(t.getTime()-86400);const e=t.getFullYear(),n=t.getMonth(),r=t.getDate(),i=new Date(e,n,r).getTime()/1e3|0;return[i,i+86400*7-1]},toMonthRange:function(){const t=new Date,e=t.getFullYear(),n=t.getMonth(),r=new Date(e,n,1).getTime()/1e3|0,i=new Date(e,n+1,0,23,59,59).getTime()/1e3|0;return[r,i]},toYearRange:function(){const e=new Date().getFullYear(),n=new Date(e,1,1).getTime()/1e3|0,r=new Date(e+1,1,0,23,59,59).getTime()/1e3|0;return[n,r]}}),u(Date.prototype,{format:function(t="y-m-d h:i:s"){if(this.getTime()===0)return"-";const e={y:this.getFullYear(),m:this.getMonth()+1,d:this.getDate(),h:this.getHours(),i:this.getMinutes(),s:this.getSeconds(),l:this.getMilliseconds(),e:this.getMonthDay()};return t.replace(/([ymdhisle])/ig,(n,r)=>r>="A"&&r<="Z"?e[r.toLowerCase()]:e[r].toString().padStart(r==="l"?3:2,"0"))},unix:function(){return this.getTime()/1e3|0},isLeapYear:function(){return this.getFullYear()%4===0&&this.getFullYear()%400!==0},getMonthDay:function(){return[31,0,31,30,31,30,31,31,30,31,30,31][this.getMonth()]||(this.isLeapYear()?29:28)},expr:function({y:t=0,m:e=0,d:n=0,h:r=0,i=0,s=0}){const o=new Date(this.getFullYear()+t,this.getMonth()+e+1,0);return new Date(this.getFullYear()+t,this.getMonth()+e,Math.min(o.getDate(),this.getDate())+n,this.getHours()+r,this.getMinutes()+i,this.getSeconds()+s)},begin:function(t=3){return new Date(...[this.getFullYear(),this.getMonth(),this.getDate(),this.getHours(),this.getMinutes(),this.getSeconds()].slice(0,t),...[this.getFullYear(),0,1,0,0,0].slice(t))},end:function(t=3){return new Date(...[this.getFullYear(),this.getMonth(),this.getDate(),this.getHours(),this.getMinutes(),this.getSeconds()].slice(0,t),...[this.getFullYear(),11,t<2?31:this.getMonthDay(),23,59,59].slice(t))},week:function(t,e=1){let n=new Date(this.getTime());for(;n.getDay()!==t;)n=new Date(n.getTime()+864e5*e);return n},toJSON:function(){return this.getTime()}}),u(RegExp,{...g()}),u(RegExp.prototype,{toJSON:function(){return this.toString()}}),u(Promise,{...g(),channel:function(){let t=null,e=null;return[new this((r,i)=>{t=r,e=i}),t,e]},$withResolvers:function(){let t=null,e=null;return{promise:new this((r,i)=>{t=r,e=i}),resolve:t,reject:e}}}),u(Promise.prototype,{tryCatch:function(){return new Promise(t=>this.then(e=>t([e,null])).catch(e=>t([null,e])))}}),typeof Promise.withResolvers>"u"&&(Promise.withResolvers=Promise.$withResolvers),u(JSON,{$parse:function(t,e=null){try{if(typeof t!="string")throw new Error("not string");return JSON.parse(t)}catch{return e}}}),typeof Iterator<"u"&&u(Iterator.prototype,{toArray:function(){return[...this]}}),u(ArrayBuffer.prototype,{toUint8Array:function(){return new Uint8Array(this)}}),u(Uint8Array,{...g(),fromString:function(t){return new TextEncoder().encode(t)},$fromHex:function(t){const e=[];for(let n=0;n<t.length;n+=2)e.push(Number.parseInt(t.substring(n,n+2),16));return new Uint8Array(e)},$fromBase64:function(t){const e=[],n={},r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(let s=0;s<r.length;s++)n[r.charAt(s)]=s;const i=t.charAt(t.length-1)!="="?t.length:t.charAt(t.length-2)!="="?t.length-1:t.length-2;for(let s=3;s<i;s+=4){const o=(n[t.charAt(s-3)]<<18)+(n[t.charAt(s-2)]<<12)+(n[t.charAt(s-1)]<<6)+n[t.charAt(s)];e.push((o&16711680)>>16,(o&65280)>>8,o&255)}if(i%4==3){const s=(n[t.charAt(i-3)]<<18)+(n[t.charAt(i-2)]<<12)+(n[t.charAt(i-1)]<<6);e.push((s&16711680)>>16,(s&65280)>>8)}else if(i%4==2){const s=(n[t.charAt(i-2)]<<18)+(n[t.charAt(i-1)]<<12);e.push((s&16711680)>>16)}return new Uint8Array(e)}}),u(Uint8Array.prototype,{setFromString(t,e=0){const n=Uint8Array.fromString(t);return this.set(n,e),{read:n.length,written:n.length}},$setFromHex(t,e=0){const n=Uint8Array.fromHex(t);return this.set(n,e),{read:n.length,written:n.length}},$setFromBase64(t,e=0){const n=Uint8Array.fromBase64(t);return this.set(n,e),{read:n.length,written:n.length}},toString:function(){return new TextDecoder().decode(this)},$toHex:function(){let t="";for(let e=0;e<this.length;e++)t+=(this[e]<16?"0":"")+this[e].toString(16);return t},$toBase64:function(){let t="",e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(let n=2;n<this.length;n+=3){const r=(this[n-2]<<16)+(this[n-1]<<8)+this[n];t+=e.charAt((r&16515072)>>18)+e.charAt((r&258048)>>12)+e.charAt((r&4032)>>6)+e.charAt(r&63)}if(this.length%3==2){const n=(this[this.length-2]<<16)+(this[this.length-1]<<8);t+=e.charAt((n&16515072)>>18)+e.charAt((n&258048)>>12)+e.charAt((n&4032)>>6)+"="}else if(this.length%3==1){const n=this[this.length-1]<<16;t+=e.charAt((n&16515072)>>18)+e.charAt((n&258048)>>12)+"=="}return t},toArray:function(){return new Array(...this)}}),typeof Uint8Array.fromBase64>"u"&&(Uint8Array.fromHex=Uint8Array.$fromHex,Uint8Array.fromBase64=Uint8Array.$fromBase64),typeof Uint8Array.prototype.setFromHex>"u"&&(Uint8Array.prototype.setFromHex=Uint8Array.prototype.$setFromHex,Uint8Array.prototype.setFromBase64=Uint8Array.prototype.$setFromBase64,Uint8Array.prototype.toHex=Uint8Array.prototype.$toHex,Uint8Array.prototype.toBase64=Uint8Array.prototype.$toBase64);let D=0,x=0,S=0;u(Math,{randstr:function(t=16,e=0,n="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",r="~!@#$%^&*()_+`{}|[]\\:\";'<>,.?/"){if(t<e)throw new Error("randstr: len < slen");const i=[];for(let s=0;s<t;s++)i.push(n.charAt(Math.random()*n.length|0));for(let s=new Set,o=0,h=0;h<e;h++){do o=Math.random()*t|0;while(s.has(o));s.set(o,!0),i[o]=r.charAt(Math.random()*r.length|0)}return i.join("")},randint:function(t=0,e=Number.MAX_SAFE_INTEGER){return Math.floor(Math.random()*(e-t)+t)},incrid:function(){return++D},incrstr:function(){return""+Math.incrid()},uniqid:function(t=Date.now()){return t===S?t*2048+ ++x%2048:(S=t)*2048+(x=0)%2048},uniqstr:function(){return""+Math.uniqid()},sleep:function(t){return new Promise(e=>setTimeout(e,t))},useTemplate:function(t){let e=null;const n={setup(i,{slots:s}){return e=s.default,()=>{}},name:t+"Template"},r={setup(i,{attrs:s}){return()=>e?.(s)},name:t};return{[n.name]:n,[r.name]:r}}});class M extends Map{constructor(e){super(),this.capacity=e}get(e){if(!super.has(e))return null;const n=super.get(e);return super.delete(e),super.set(e,n),n}getOrInsert(e,n){super.has(e)||super.set(e,n);const r=super.get(e);return super.delete(e),super.set(e,r),r}getOrInsertComputed(e,n){super.has(e)||super.set(e,n(e));const r=super.get(e);return super.delete(e),super.set(e,r),r}async getOrInsertComputedAsync(e,n){super.has(e)||super.set(e,await n(e));const r=super.get(e);return super.delete(e),super.set(e,r),r}set(e,n){super.has(e)&&super.delete(e),super.set(e,n),super.size>this.capacity&&super.delete(super.keys().next().value)}put(e,n){return this.set(e,n)}}u(M,{...g()}),typeof globalThis.LRU>"u"&&(globalThis.LRU=M)}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "esexts",
3
- "version": "2.0.5",
3
+ "version": "2.0.6",
4
4
  "description": "esexts",
5
5
  "author": "dotcoo <dotcoo@163.com> (http://blog.dotcoo.com)",
6
6
  "homepage": "https://github.com/dotcoo/esexts#readme",