zeed 0.10.7 → 0.10.9
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/{chunk-FGACNSTC.js → chunk-OYG7IFNC.js} +8 -8
- package/dist/chunk-OYG7IFNC.js.map +1 -0
- package/dist/index.all.d.ts +31 -1
- package/dist/index.browser.cjs +263 -261
- package/dist/index.browser.cjs.map +1 -1
- package/dist/index.browser.d.ts +2 -2
- package/dist/index.browser.js +4 -4
- package/dist/index.browser.js.map +1 -1
- package/dist/index.node.cjs +322 -310
- package/dist/index.node.cjs.map +1 -1
- package/dist/index.node.d.ts +27 -3
- package/dist/index.node.js +13 -13
- package/dist/index.node.js.map +1 -1
- package/dist/{uuid-f5186a33.d.ts → uuid-5c4171ae.d.ts} +6 -1
- package/package.json +3 -3
- package/dist/chunk-FGACNSTC.js.map +0 -1
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
function
|
|
2
|
-
`)}var Q;function Ct(){return Q===void 0&&(Q=(typeof TextDecoder>"u"?null:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0}))??null,Q&&Q.decode(new Uint8Array).length===1&&(Q=null)),Q}var Rt="Unexpected end of array",It="Integer out of Range",je=class{constructor(t){this.arr=t,this.pos=0;}};function Te(e){return new je(e)}function Ne(e,t){let n=ce(e.arr.buffer,e.pos+e.arr.byteOffset,t);return e.pos+=t,n}function ee(e){let t=0,n=1,r=e.arr.length;for(;e.pos<r;){let o=e.arr[e.pos++];if(t=t+(o&127)*n,n*=128,o<128)return t;if(t>Number.MAX_SAFE_INTEGER)throw new Error(It)}throw new Error(Rt)}function Ae(e){return Ne(e,ee(e))}function ue(e){return e.arr[e.pos++]}function Ft(e){let t=e.arr[e.pos]+(e.arr[e.pos+1]<<8);return e.pos+=2,t}function kt(e){let t=e.arr[e.pos]+(e.arr[e.pos+1]<<8)+(e.arr[e.pos+2]<<16)+(e.arr[e.pos+3]<<24)>>>0;return e.pos+=4,t}function He(e){let t=e.arr[e.pos++],n=t&63,r=64,o=(t&64)>0?-1:1;if(!(t&128))return o*n;let i=e.arr.length;for(;e.pos<i;){if(t=e.arr[e.pos++],n=n+(t&127)*r,r*=128,t<128)return o*n;if(n>Number.MAX_SAFE_INTEGER)throw new Error(It)}throw new Error(Rt)}function Gn(e){let t=ee(e);if(t===0)return "";{let n=String.fromCodePoint(ue(e));if(--t<100)for(;t--;)n+=String.fromCodePoint(ue(e));else for(;t>0;){let r=t<1e4?t:1e4,o=e.arr.subarray(e.pos,e.pos+r);e.pos+=r,n+=String.fromCodePoint.apply(null,o),t-=r;}return decodeURIComponent(escape(n))}}function we(e){let t=Ct();return t?t.decode(Ae(e)):Gn(e)}function ze(e,t){let n=new DataView(e.arr.buffer,e.arr.byteOffset+e.pos,t);return e.pos+=t,n}function Ge(e){return ze(e,4).getFloat32(0,!1)}function qn(e){return ze(e,8).getFloat64(0,!1)}function Jn(e){return ze(e,8).getBigInt64(0,!1)}var Wn=[e=>{},e=>null,He,Ge,qn,Jn,e=>!1,e=>!0,we,e=>{let t=ee(e),n={};for(let r=0;r<t;r++){let o=we(e);n[o]=te(e);}return n},e=>{let t=ee(e),n=[];for(let r=0;r<t;r++)n.push(te(e));return n},Ae];function te(e){return Wn[127-ue(e)](e)}function ce(e,t,n){return new Uint8Array(e,t,n)}var qe=class{constructor(){this.cpos=0,this.cbuf=new Uint8Array(100),this.bufs=[];}};function De(){return new qe}function Je(e){let t=e.cpos;for(let n=0;n<e.bufs.length;n++)t+=e.bufs[n].length;return t}function ve(e){let t=new Uint8Array(Je(e)),n=0;for(let r=0;r<e.bufs.length;r++){let o=e.bufs[r];t.set(o,n),n+=o.length;}return t.set(ce(e.cbuf.buffer,0,e.cpos),n),t}function Zn(e,t){let n=e.cbuf.length;n-e.cpos<t&&(e.bufs.push(ce(e.cbuf.buffer,0,e.cpos)),e.cbuf=new Uint8Array(Math.max(n,t)*2),e.cpos=0);}function D(e,t){let n=e.cbuf.length;e.cpos===n&&(e.bufs.push(e.cbuf),e.cbuf=new Uint8Array(n*2),e.cpos=0),e.cbuf[e.cpos++]=t;}var _t=D;function $t(e,t){D(e,t&255),D(e,t>>>8&255);}function Vt(e,t){for(let n=0;n<4;n++)D(e,t&255),t>>>=8;}function J(e,t){for(;t>127;)D(e,128|127&t),t=Math.floor(t/128);D(e,127&t);}function Kn(e){return e!==0?e<0:1/e<0}function We(e,t){let n=Kn(t);for(n&&(t=-t),D(e,(t>63?128:0)|(n?64:0)|63&t),t=Math.floor(t/64);t>0;)D(e,(t>127?128:0)|127&t),t=Math.floor(t/128);}function Ee(e,t){let n=e.cbuf.length,r=e.cpos,o=Math.min(n-r,t.length),i=t.length-o;e.cbuf.set(t.subarray(0,o),r),e.cpos+=o,i>0&&(e.bufs.push(e.cbuf),e.cbuf=new Uint8Array(Math.max(n*2,i)),e.cbuf.set(t.subarray(o)),e.cpos=i);}function Pe(e,t){J(e,t.byteLength),Ee(e,t);}function Xn(e,t){let n=unescape(encodeURIComponent(t)),r=n.length;J(e,r);for(let o=0;o<r;o++)D(e,n.codePointAt(o));}function Ue(e,t){return Xn(e,t)}function Ze(e,t){Zn(e,t);let n=new DataView(e.cbuf.buffer,e.cpos,t);return e.cpos+=t,n}function Ke(e,t){return Ze(e,4).setFloat32(0,t,!1)}function Qn(e,t){return Ze(e,8).setFloat64(0,t,!1)}function er(e,t){return Ze(e,8).setBigInt64(0,t,!1)}var Le;function tr(e){return Le==null&&(Le=new DataView(new ArrayBuffer(4))),Le.setFloat32(0,e),Le.getFloat32(0)===e}function re(e,t){switch(typeof t){case"string":D(e,119),Ue(e,t);break;case"number":Number.isInteger(t)&&Math.abs(t)<=2147483647?(D(e,125),We(e,t)):tr(t)?(D(e,124),Ke(e,t)):(D(e,123),Qn(e,t));break;case"bigint":D(e,122),er(e,t);break;case"object":if(t===null)D(e,126);else if(Array.isArray(t)){D(e,117),J(e,t.length);for(let n=0;n<t.length;n++)re(e,t[n]);}else if(t instanceof Uint8Array)D(e,116),Pe(e,t);else {D(e,118);let n=Object.keys(t);J(e,n.length);for(let r=0;r<n.length;r++){let o=n[r];Ue(e,o),re(e,t[o]);}}break;case"boolean":D(e,t?120:121);break;default:D(e,127);}}var jt=class{async encode(t){let n=De();return re(n,t),ve(n)}async decode(t){return te(Te(U(t)))}};function zo(e){let t=De();return re(t,e),ve(t)}function Go(e){return te(Te(U(e)))}function qo(e){let t=De();return e!=null&&Ee(t,U(e)),{writeBytes:(n,r)=>{let o=U(n);wt(!(r!=null&&o.length!==r),`Expected ${r} bytes, got ${o.length}`),Ee(t,o);},writeBytesVar:n=>Pe(t,U(n)),writeUintVar:n=>J(t,n),writeUint8:n=>_t(t,n),writeUint16:n=>$t(t,n),writeUint32:n=>Vt(t,n),writeIntVar:n=>We(t,n),writeFloat:n=>Ke(t,n),writeStringVar:n=>Ue(t,n),write:n=>re(t,n),getUint8Array:()=>ve(t),getLength:()=>Je(t)}}function Jo(e){let t=Te(U(e));return {readBytes:n=>Ne(t,n),readBytesVar:()=>Ae(t),readUintVar:()=>ee(t),readUint8:()=>ue(t),readUint16:()=>Ft(t),readUint32:()=>kt(t),readIntVar:()=>He(t),readFloat:()=>Ge(t),readStringVar:()=>we(t),read:()=>te(t),getOffset:()=>t.pos||0}}function Wo(e=0){return {setBit:(t,n=!0)=>n?e|=1<<t:e&=~(1<<t),unsetBit:t=>e&=1<<t,toggleBit:t=>e^=1<<t,getBit:t=>(e&1<<t)!==0,getValue:()=>e}}async function nr(e){return await e.arrayBuffer()}async function Zo(e){let t=await nr(e);if(t!=null)return U(t)}function oe(e=16){let t=new Uint8Array(e);if(typeof crypto<"u"&&crypto.getRandomValues)crypto.getRandomValues(t);else for(let n=0;n<e;n++)t[n]=Math.floor(Math.random()*256);return t}var Ht="SHA-256",Ye="AES-GCM",Nt="PBKDF2",rr=1e5;async function Xo(e,t=Ht){return U(await crypto.subtle.digest(t,U(e)))}async function Qo(e,t={}){let n=U(e),r=await crypto.subtle.importKey("raw",n,Nt,!1,["deriveKey"]);return await crypto.subtle.deriveKey({name:Nt,salt:t.salt?U(t.salt):new Uint8Array(0),iterations:t.iterations??rr,hash:Ht},r,{name:Ye,length:256},!0,["encrypt","decrypt"])}function zt(){return new Uint8Array([1,1])}async function Gt(e,t){let n=zt(),r=oe(12),o=await crypto.subtle.encrypt({name:Ye,iv:r},t,e),i=new Uint8Array(o),a=n.length+r.length+i.length,s=new Uint8Array(a),u=0;return s.set(n,u),u+=n.length,s.set(r,u),u+=r.length,s.set(i,u),s}async function qt(e,t){let n=e.subarray(0,2);if(!Et(n,zt()))return Promise.reject(new Error(`Unknown magic ${n}`));let r=e.subarray(2,2+12),o=e.subarray(2+12,e.length),i=await crypto.subtle.decrypt({name:Ye,iv:r},t,o);return new Uint8Array(i)}function or(){return crypto.getRandomValues(new Uint32Array(1))[0]/4294967295}function P(){return typeof crypto<"u"?or():Math.random()}function ti(e=.25){return P()<e}function ni(e=100,t=0){return t+Math.floor(P()*(e-t))}function ri(e=100,t=0){return t+P()*(e-t)}function oi(e,t,n){return Math.max(e,Math.min(n,t))}function ir(e){return e.reduce((t,n)=>t+n,0)}function ii(e){return ir(e)/e.length}function si(e){return !/^1?$|^(11+?)\1+$/.test("1".repeat(e))}function ai(e){for(let t=2;t<e;t++)if(e%t===0)return !1;return e>1}var Xe=6;function ui(e=0,t=1,n){Xe=((n??Xe)*9301+49297)%233280;let r=Xe/233280;return t+r*(e-t)}function sr(e=""){let[t="",n="asc"]=e.split(" ");return n=n.toLowerCase(),{field:t,orderby:n,asc:n!=="desc",desc:n==="desc"}}function li(e,t=!0){return `${e} ${t?"asc":"desc"}`}function Qe(e,t,n=!0){let r=e||0,o=t||0;return r>o?n?1:-1:r<o?n?-1:1:0}function fi(e,...t){if(t.length>0){let n=t.map(sr),r=Array.from(e);return r.sort((o,i)=>{for(let{field:a,asc:s}of n){let u=Qe(o[a],i[a],s);if(u!==0)return u}return 0}),r}return e}function et(e){return e.filter((t,n)=>e.indexOf(t)===n)}function ar(e,t){return et(e.filter(n=>!t.includes(n)))}function ur(...e){return et(e.reduce((t=[],n)=>t.concat(n),[]))}function ie(...e){return e.flat(1/0)}function cr(e,t){return et(e).filter(n=>t.includes(n))}function yi(e,t){return ar(ur(e,t),cr(e,t))}function Jt(e,t){if(e&&Array.isArray(e)){let n;for(;(n=e.indexOf(t))!==-1;)e.splice(n,1);return e}return []}function mi(e,t){return e.includes(t)||e.push(t),e}function tt(e,t){return e.splice(0,e.length,...e.filter(t)),e}function hi(e,t){let n=e.findIndex(r=>r===t);return n>=0?e.splice(n,1):e.push(t),e}function xi(e){return e.splice(0,e.length),e}function lr(e,t=Qe){return Array.from(e).sort(t)}function bi(e){return lr(e,(t,n)=>t-n)}function fr(e,t){return e.length===t.length&&e.every((n,r)=>n===t[r])}function Wt(e){return e.sort(()=>P()>.5?1:-1),e}function wi(e){return Wt(Array.from(e))}function Ti(e){for(;e.length>1;){let t=Array.from(e);if(Wt(t),!fr(e,t))return t}return e}function Ai(e){return e[Math.floor(P()*e.length)]}function Li(...e){return ie(e).reduce((t,n)=>t!=null?n>t?n:t:n,void 0)}function Ui(...e){return ie(e).reduce((t,n)=>t!=null?n<t?n:t:n,void 0)}function Di(...e){return ie(e).reduce((t,n)=>t+n,0)}function vi(...e){let t=ie(e);return t.reduce((n,r)=>n+r,0)/t.length}function Ei(e,t){let n=[],r=0,o=e.length;for(;r<o;)n.push(e.slice(r,r+=t));return n}function Pi(e=0,t){if(e<=0)return [];let n=new Array(e);for(let r=0;r<e;r++)n[r]=t instanceof Function?t(r):t;return n}var pr={2:"01",8:"01234567",11:"0123456789a",16:"0123456789abcdef",32:"0123456789abcdefghjkmnpqrtuvwxyz","32-crockford":"0123456789ABCDEFGHJKMNPQRSTVWXYZ","32-geohash":"0123456789bcdefghjkmnpqrstuvwxyz","32-agnoster":"0123456789abcdefghjkmnpqrtuvwxyz","32-rfc":"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567","32-hex":"0123456789ABCDEFGHIJKLMNOPQRSTUV","32-zbase":"ybndrfg8ejkmcpqxot1uwisza345h769",36:"0123456789abcdefghijklmnopqrstuvwxyz",58:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",62:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",64:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/","64-url":"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",66:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_.!~",85:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz!#$%&()*+-;<=>?@^_`{|}~"};function dr(e){let t=pr[String(e)];if(!t)if(typeof e=="string")t=e;else throw new Error(`Unknown base ${e}`);if(t.length>=255)throw new TypeError("Alphabet too long");let n=new Uint8Array(256);for(let c=0;c<n.length;c++)n[c]=255;for(let c=0;c<t.length;c++){let f=t.charAt(c),l=f.charCodeAt(0);if(n[l]!==255)throw new TypeError(`${f} is ambiguous`);n[l]=c;}let r=t.length,o=t.charAt(0),i=Math.log(r)/Math.log(256),a=Math.log(256)/Math.log(r);function s(c,f=-1){let l=U(c);if(l.byteLength===0)return "";let m=0,g=0,p=l.byteLength;for(;g!==p&&l[g]===0;)g++;let d=(p-g)*a+1>>>0,w=new Uint8Array(d);for(;g!==p;){let S=l[g],B=0;for(let h=d-1;(S!==0||B<m)&&h!==-1;h--,B++)S+=256*w[h]>>>0,w[h]=S%r>>>0,S=S/r>>>0;if(S!==0)throw new Error("Non-zero carry");m=B,g++;}let x=d-m;for(;x!==d&&w[x]===0;)x++;let v="";for(;x<d;++x)v+=t.charAt(w[x]);return f>0?v.padStart(f,o):v}function u(c,f=-1){if(typeof c!="string")throw new TypeError("Expected String");if(c.length===0)return new Uint8Array;c=c.replace(/\s+/gi,"");let l=0,m=0;for(;c[l]===o;)l++;let g=(c.length-l)*i+1>>>0,p=new Uint8Array(g);for(;c[l];){let w=n[c.charCodeAt(l)];if(w===255)throw new Error(`Unsupported character "${c[l]}"`);let x=0;for(let v=g-1;(w!==0||x<m)&&v!==-1;v--,x++)w+=r*p[v]>>>0,p[v]=w%256>>>0,w=w/256>>>0;if(w!==0)throw new Error("Non-zero carry");m=x,l++;}let d=g-m;for(;d!==g&&p[d]===0;)d++;return f>0?new Uint8Array([...new Uint8Array(f-p.length+d),...p.slice(d)]):p.slice(d)}return {encode:s,decode:u}}var Se;function N(e){Se==null&&(Se=new Map);function t(){let o=Se.get(e);return o==null&&(o=dr(e),Se.set(e,o)),o}function n(o,i=-1){return t().encode(o,i)}function r(o,i=-1){return t().decode(o,i)}return {encode:n,decode:r}}function nt(e,t=-1){return N(32).encode(e,t)}function Zt(e,t=-1){return N(32).decode(e.toLocaleLowerCase().replaceAll("l","1").replaceAll("s","5").replaceAll("o","0").replaceAll("i","1"),t)}function Mi(e,t=-1){return N(16).encode(e,t)}function Ri(e,t=-1){return N(16).decode(e,t)}function Ii(e,t=-1){return N(58).encode(e,t)}function Fi(e,t=-1){return N(58).decode(e,t)}function rt(e,t=-1){return N(62).encode(e,t)}function Kt(e,t=-1){return N(62).decode(e,t)}function ki(e,t){return Math.ceil(e*(Math.log(256)/Math.log(t)))}var Oi=e=>(e.length>0&&(/^[A-Z0-9_\-\ ]*$/g.test(e)&&(e=e.toLowerCase()),e=e.replace(/^[-_\ ]+/gi,"").replace(/[-_\ ]+$/gi,"").replace(/[-_\ ]+([a-z0-9])/gi,(t,n)=>n.toUpperCase()),e=e[0].toLowerCase()+e.substring(1)),e);function gr(e){return e.charAt(0).toUpperCase()+e.toLowerCase().slice(1)}function _i(e){return e.replace(/\w\S*/g,gr)}function $i(e,t="-"){return t=typeof t>"u"?"_":t,e.replace(/([a-z\d])([A-Z])/g,`$1${t}$2`).replace(/([A-Z]+)([A-Z][a-z\d]+)/g,`$1${t}$2`).toLowerCase()}var Yt=["1","true","yes","y","on"];function Ni(e,t=!1){return e==null||typeof e!="string"?t:Yt.includes(String(e).trim().toLowerCase())}function Hi(e,t=0){return e==null||typeof e!="string"?t:parseInt(e.trim(),10)??t}function zi(e,t=0){return e==null||typeof e!="string"?t:parseFloat(e.trim())??t}function yr(e,t=!1){return e==null?t:typeof e=="boolean"?e:typeof e=="number"?e!==0:Yt.includes(String(e).trim().toLowerCase())}function mr(e,t=0){return e==null?t:typeof e=="boolean"?e?1:0:typeof e=="number"?Math.floor(e):parseInt(String(e).trim(),10)??t}function hr(e,t=0){return e==null?t:typeof e=="boolean"?e?1:0:typeof e=="number"?Math.floor(e):parseFloat(String(e).trim())??t}function ot(e,t=""){return e==null?t:String(e)??t}var Gi=hr,qi=mr,Ji=ot,Wi=yr;function xr(e,t={}){let{trace:n=!0,pretty:r=!0}=t;return e.map(o=>{if(o&&typeof o=="object"){if(r&&(o instanceof Uint8Array||o instanceof ArrayBuffer))return `
|
|
1
|
+
function In(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;if(typeof globalThis<"u")return globalThis;throw new Error("unable to locate global object")}function K(){let e=In();return e._zeedGlobal==null&&(e._zeedGlobal={}),e._zeedGlobal}function ge(e={}){let{level:t=void 0,filter:n=void 0}=e,r=Y(n),o=de(t);return i=>{if(!o(i.level)||!r(i.name))return;let a=i.name?`[${i.name}]`:"";switch(i.level){case H:console.info(`I|* ${a}`,...i.messages);break;case z:console.warn(`W|** ${a}`,...i.messages);break;case G:console.error(`E|*** ${a}`,...i.messages);break;default:console.debug(`D| ${a}`,...i.messages);break}}}var j=-1,q=0,H=1,z=2,G=3,ye=4,X=9007199254740991,ht={"*":j,a:j,all:j,d:q,dbg:q,debug:q,i:H,inf:H,info:H,w:z,warn:z,warning:z,e:G,err:G,error:G,fatal:ye,off:X,"-":X};function xt(e=""){let t=[ge()],n=u=>!0,r=!1,o=a,i=!1;function a(u="",c){let f=Oe(c??j);function l(p,d){return f<=p?d:()=>{}}let m=l(q,(...p)=>{g({name:u,messages:p,level:q});});m.label=u,m.extend=function(p){return o(u?`${u}:${p}`:p)};let g=p=>{if(n(u))for(let d of t)d&&d(p);};return m.debug=l(q,(...p)=>{g({name:u,messages:p,level:q});}),m.info=l(H,(...p)=>{g({name:u,messages:p,level:H});}),m.warn=l(z,(...p)=>{g({name:u,messages:p,level:z});}),m.error=l(G,(...p)=>{g({name:u,messages:p,level:G});}),m.fatal=l(ye,(...p)=>{throw g({name:u,messages:p,level:ye}),new Error(`${p.map(String).join(" ")}`)}),m.assert=l(ye,(p,...d)=>{(p==null||typeof p=="number"&&isNaN(p)||!p)&&m.fatal(...d);}),m}function s(u="",c){let f=o(u,c);return i&&f.debug(`+++ init of logger "${u}" on level "${f.level}".`),f}return s.registerHandler=function(u){t.push(u);},s.setFilter=function(u){n=Y(u);},s.setLock=(u=!0)=>r=u,s.setDebug=(u=!0)=>i=u,s.setHandlers=function(u=[]){o!==a&&(o=a),!r&&(t=[...u].filter(c=>typeof c=="function"));},s.level=j,s.setLogLevel=function(u=j){r||(s.level=u);},s.setFactory=function(u){r||(o=u);},s}function Fn(e){return e===!0||e==="true"||e==="1"||typeof e=="number"&&e!==0?e="*":e===!1||e==="false"||e===0||e==="0"||e==null||e==="null"||e==="undefined"?e="":e=String(e),e}function kn(){return Fn(typeof process<"u"?process.env.ZEED??process.env.DEBUG:typeof localStorage<"u"?localStorage.zeed??localStorage.debug:"*")}function Y(e=kn()){let t,n=[],r=[];if(!e)t=function(o){return !1};else if(e==="*")t=function(o){return !0};else {let o,i=e.split(/[\s,]+/),a=i.length;for(o=0;o<a;o++){if(!i[o])continue;let s=i[o].replace(/\*/g,".*?");s[0]==="-"?n.push(new RegExp(`^${s.substr(1)}$`)):r.push(new RegExp(`^${s}$`));}t=function(s){if(n.length===0&&r.length===0)return !0;let u,c;for(u=0,c=n.length;u<c;u++)if(n[u].test(s))return !1;for(u=0,c=r.length;u<c;u++)if(r[u].test(s))return !0;return !1};}return t.accept=r,t.reject=n,t.filter=e,t}function Bn(){return typeof process<"u"?process.env.ZEED_LEVEL??process.env.LEVEL??process.env.DEBUG_LEVEL:typeof localStorage<"u"?localStorage.zeed_level??localStorage.level??localStorage.debug_level:void 0}function Oe(e){if(e===!1)return X;if(typeof e=="number")return e;if(typeof e=="string"){let t=ht[e.toLocaleLowerCase().trim()];if(t!=null)return t}return j}function de(e=Bn()){let t=Oe(e);return n=>n>=t}var O;function _e(e){let t=xt();return e?e(t):t.setHandlers([ge()]),t}function On(e){if(O==null)try{let t=K();t!=null?t?.logger==null?(O=_e(e),t.logger=O):O=t.logger:O=_e(e);}catch{O=_e(e);}return O}function bt(){if(O!=null)return O;try{let e=K();if(e?.logger!=null)return e.logger}catch{}}function M(e,t){return On()(e,t)}function _n(...e){throw bt()?.("assert")?.fatal(...e),new Error(`${e.map(String).join(" ")}`)}function $n(e,...t){(e==null||typeof e=="number"&&isNaN(e)||!e)&&_n(...t);}function wt(e,...t){$n(e,...t);}var Tt=(e,t)=>t instanceof Object&&!Array.isArray(t)?Object.keys(t).sort().reduce((n,r)=>(n[r]=t[r],n),{}):t;function Lo(e,t=void 0){return JSON.stringify(e,Tt,t)}function Vn(e,t){let n=[],r=[];return t==null&&(t=function(o,i){return n[0]===i?"[Circular ~]":`[Circular ~.${r.slice(0,n.indexOf(i)).join(".")}]`}),function(o,i){if(n.length>0){let a=n.indexOf(this);~a?n.splice(a+1):n.push(this),~a?r.splice(a,1/0,o):r.push(o),~n.indexOf(i)&&(i=t?.call(this,o,i));}else n.push(i);i=Tt(o,i);try{return e==null?i:e.call(this,o,i)}catch{}return String(i)}}function F(e,t,n,r){return JSON.stringify(e,Vn(t,r),n)}var Uo=F;function jn(e){let t=unescape(encodeURIComponent(e)),n=t.length,r=new Uint8Array(n);for(let o=0;o<n;o++)r[o]=t.codePointAt(o)||0;return r}function Nn(e){let t=e.length,n="",r=0;for(;t>0;){let o=t<1e4?t:1e4,i=e.subarray(r,r+o);r+=o,n+=String.fromCodePoint.apply(null,i),t-=o;}return decodeURIComponent(escape(n))}var me;function At(e){if(me==null&&(me=jn,typeof TextEncoder<"u")){let t=new TextEncoder;me=n=>t.encode(n);}return me(e.normalize("NFC"))}var he;function Lt(e){if(he==null&&(he=Nn,typeof TextDecoder<"u")){let t=new TextDecoder("utf-8",{ignoreBOM:!0});he=n=>t.decode(n);}return he(e).normalize("NFC")}function U(e){return e instanceof ArrayBuffer?new Uint8Array(e):typeof e=="string"?At(e):e.length?new Uint8Array(e):e}function Eo(...e){let t=0,n=e.flat(1).map(i=>{let a=U(i);return t+=a.length,a}),r=new Uint8Array(t),o=0;for(let i of n)r.set(i,o),o+=i.length;return r}function Ut(e){if(typeof Buffer<"u")return Buffer.from(U(e)).toString("hex");let t="0123456789abcdef",n="";for(let r of [...U(e)])n+=t[r>>4]+t[r&15];return n}function Dt(e){return Uint8Array.from(e.match(/.{1,2}/g).map(t=>parseInt(t,16)))}function vt(e,t=!1){let n=U(e),r="";if(typeof Buffer<"u")r=Buffer.from(n).toString("base64");else {let o="";for(let i=0;i<n.byteLength;i++)o+=String.fromCharCode(n[i]);r=btoa(o);}return t?r.replaceAll("=",""):r}function Po(e){let t=U(e);if(typeof Buffer<"u")return Buffer.from(t).toString("base64url").replaceAll("=","");let n="";for(let r=0;r<t.byteLength;r++)n+=String.fromCharCode(t[r]);return btoa(n).replaceAll("+","-").replaceAll("/","_").replaceAll("=","")}function Hn(e){if(e=e.replaceAll("-","+").replaceAll("_","/"),typeof Buffer<"u"){let r=Buffer.from(e,"base64");return new Uint8Array(r.buffer,r.byteOffset,r.byteLength)}let t=atob(e),n=new Uint8Array(t.length);for(let r=0;r<t.length;r++)n[r]=t.charCodeAt(r);return n}function So(e){return Lt(Hn(e))}function Et(e,t){if(e.byteLength!==t.byteLength)return !1;let n=U(e),r=U(t);for(let o=0;o<n.length;o++)if(n[o]!==r[o])return !1;return !0}function $e(e){return At(F(e))}function Ve(e){return JSON.parse(Lt(e))}function Pt(e,t){if(typeof e!="string")if(e instanceof ArrayBuffer&&e.byteLength!==void 0)e=String.fromCharCode.apply(String,[].slice.call(new Uint8Array(e)));else if(Array.isArray(e))e=String.fromCharCode.apply(String,e);else if(e.constructor===Uint8Array)e=String.fromCharCode.apply(String,[].slice.call(e));else return !1;t=t||16;let n=[],r="0123456789ABCDEF";for(let o=0;o<e.length;o+=t){let i=e.slice(o,Math.min(o+t,e.length)),a=`0000${o.toString(16)}`.slice(-4),s=i.split("").map(c=>{let f=c.charCodeAt(0);return ` ${r[(240&f)>>4]}${r[15&f]}`}).join("");s+=" ".repeat(t-i.length);let u=i.replace(/[\x00-\x1F\x20\x7F-\xA0\xAD]/g,".");u+=" ".repeat(t-i.length),n.push(`${a} ${s} ${u}`);}return n.join(`
|
|
2
|
+
`)}var Q;function Ct(){return Q===void 0&&(Q=(typeof TextDecoder>"u"?null:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0}))??null,Q&&Q.decode(new Uint8Array).length===1&&(Q=null)),Q}var Rt="Unexpected end of array",It="Integer out of Range",je=class{constructor(t){this.arr=t,this.pos=0;}};function Te(e){return new je(e)}function Ne(e,t){let n=ce(e.arr.buffer,e.pos+e.arr.byteOffset,t);return e.pos+=t,n}function ee(e){let t=0,n=1,r=e.arr.length;for(;e.pos<r;){let o=e.arr[e.pos++];if(t=t+(o&127)*n,n*=128,o<128)return t;if(t>Number.MAX_SAFE_INTEGER)throw new Error(It)}throw new Error(Rt)}function Ae(e){return Ne(e,ee(e))}function ue(e){return e.arr[e.pos++]}function Ft(e){let t=e.arr[e.pos]+(e.arr[e.pos+1]<<8);return e.pos+=2,t}function kt(e){let t=e.arr[e.pos]+(e.arr[e.pos+1]<<8)+(e.arr[e.pos+2]<<16)+(e.arr[e.pos+3]<<24)>>>0;return e.pos+=4,t}function He(e){let t=e.arr[e.pos++],n=t&63,r=64,o=(t&64)>0?-1:1;if(!(t&128))return o*n;let i=e.arr.length;for(;e.pos<i;){if(t=e.arr[e.pos++],n=n+(t&127)*r,r*=128,t<128)return o*n;if(n>Number.MAX_SAFE_INTEGER)throw new Error(It)}throw new Error(Rt)}function qn(e){let t=ee(e);if(t===0)return "";{let n=String.fromCodePoint(ue(e));if(--t<100)for(;t--;)n+=String.fromCodePoint(ue(e));else for(;t>0;){let r=t<1e4?t:1e4,o=e.arr.subarray(e.pos,e.pos+r);e.pos+=r,n+=String.fromCodePoint.apply(null,o),t-=r;}return decodeURIComponent(escape(n))}}function we(e){let t=Ct();return t?t.decode(Ae(e)):qn(e)}function ze(e,t){let n=new DataView(e.arr.buffer,e.arr.byteOffset+e.pos,t);return e.pos+=t,n}function Ge(e){return ze(e,4).getFloat32(0,!1)}function Jn(e){return ze(e,8).getFloat64(0,!1)}function Wn(e){return ze(e,8).getBigInt64(0,!1)}var Zn=[e=>{},e=>null,He,Ge,Jn,Wn,e=>!1,e=>!0,we,e=>{let t=ee(e),n={};for(let r=0;r<t;r++){let o=we(e);n[o]=te(e);}return n},e=>{let t=ee(e),n=[];for(let r=0;r<t;r++)n.push(te(e));return n},Ae];function te(e){return Zn[127-ue(e)](e)}function ce(e,t,n){return new Uint8Array(e,t,n)}var qe=class{constructor(){this.cpos=0,this.cbuf=new Uint8Array(100),this.bufs=[];}};function De(){return new qe}function Je(e){let t=e.cpos;for(let n=0;n<e.bufs.length;n++)t+=e.bufs[n].length;return t}function ve(e){let t=new Uint8Array(Je(e)),n=0;for(let r=0;r<e.bufs.length;r++){let o=e.bufs[r];t.set(o,n),n+=o.length;}return t.set(ce(e.cbuf.buffer,0,e.cpos),n),t}function Kn(e,t){let n=e.cbuf.length;n-e.cpos<t&&(e.bufs.push(ce(e.cbuf.buffer,0,e.cpos)),e.cbuf=new Uint8Array(Math.max(n,t)*2),e.cpos=0);}function D(e,t){let n=e.cbuf.length;e.cpos===n&&(e.bufs.push(e.cbuf),e.cbuf=new Uint8Array(n*2),e.cpos=0),e.cbuf[e.cpos++]=t;}var _t=D;function $t(e,t){D(e,t&255),D(e,t>>>8&255);}function Vt(e,t){for(let n=0;n<4;n++)D(e,t&255),t>>>=8;}function J(e,t){for(;t>127;)D(e,128|127&t),t=Math.floor(t/128);D(e,127&t);}function Yn(e){return e!==0?e<0:1/e<0}function We(e,t){let n=Yn(t);for(n&&(t=-t),D(e,(t>63?128:0)|(n?64:0)|63&t),t=Math.floor(t/64);t>0;)D(e,(t>127?128:0)|127&t),t=Math.floor(t/128);}function Ee(e,t){let n=e.cbuf.length,r=e.cpos,o=Math.min(n-r,t.length),i=t.length-o;e.cbuf.set(t.subarray(0,o),r),e.cpos+=o,i>0&&(e.bufs.push(e.cbuf),e.cbuf=new Uint8Array(Math.max(n*2,i)),e.cbuf.set(t.subarray(o)),e.cpos=i);}function Pe(e,t){J(e,t.byteLength),Ee(e,t);}function Qn(e,t){let n=unescape(encodeURIComponent(t)),r=n.length;J(e,r);for(let o=0;o<r;o++)D(e,n.codePointAt(o));}function Ue(e,t){return Qn(e,t)}function Ze(e,t){Kn(e,t);let n=new DataView(e.cbuf.buffer,e.cpos,t);return e.cpos+=t,n}function Ke(e,t){return Ze(e,4).setFloat32(0,t,!1)}function er(e,t){return Ze(e,8).setFloat64(0,t,!1)}function tr(e,t){return Ze(e,8).setBigInt64(0,t,!1)}var Le;function nr(e){return Le==null&&(Le=new DataView(new ArrayBuffer(4))),Le.setFloat32(0,e),Le.getFloat32(0)===e}function re(e,t){switch(typeof t){case"string":D(e,119),Ue(e,t);break;case"number":Number.isInteger(t)&&Math.abs(t)<=2147483647?(D(e,125),We(e,t)):nr(t)?(D(e,124),Ke(e,t)):(D(e,123),er(e,t));break;case"bigint":D(e,122),tr(e,t);break;case"object":if(t===null)D(e,126);else if(Array.isArray(t)){D(e,117),J(e,t.length);for(let n=0;n<t.length;n++)re(e,t[n]);}else if(t instanceof Uint8Array)D(e,116),Pe(e,t);else {D(e,118);let n=Object.keys(t);J(e,n.length);for(let r=0;r<n.length;r++){let o=n[r];Ue(e,o),re(e,t[o]);}}break;case"boolean":D(e,t?120:121);break;default:D(e,127);}}var jt=class{async encode(t){let n=De();return re(n,t),ve(n)}async decode(t){return te(Te(U(t)))}};function qo(e){let t=De();return re(t,e),ve(t)}function Jo(e){return te(Te(U(e)))}function Wo(e){let t=De();return e!=null&&Ee(t,U(e)),{writeBytes:(n,r)=>{let o=U(n);wt(!(r!=null&&o.length!==r),`Expected ${r} bytes, got ${o.length}`),Ee(t,o);},writeBytesVar:n=>Pe(t,U(n)),writeUintVar:n=>J(t,n),writeUint8:n=>_t(t,n),writeUint16:n=>$t(t,n),writeUint32:n=>Vt(t,n),writeIntVar:n=>We(t,n),writeFloat:n=>Ke(t,n),writeStringVar:n=>Ue(t,n),write:n=>re(t,n),getUint8Array:()=>ve(t),getLength:()=>Je(t)}}function Zo(e){let t=Te(U(e));return {readBytes:n=>Ne(t,n),readBytesVar:()=>Ae(t),readUintVar:()=>ee(t),readUint8:()=>ue(t),readUint16:()=>Ft(t),readUint32:()=>kt(t),readIntVar:()=>He(t),readFloat:()=>Ge(t),readStringVar:()=>we(t),read:()=>te(t),getOffset:()=>t.pos||0}}function Ko(e=0){return {setBit:(t,n=!0)=>n?e|=1<<t:e&=~(1<<t),unsetBit:t=>e&=1<<t,toggleBit:t=>e^=1<<t,getBit:t=>(e&1<<t)!==0,getValue:()=>e}}async function rr(e){return await e.arrayBuffer()}async function Yo(e){let t=await rr(e);if(t!=null)return U(t)}function oe(e=16){let t=new Uint8Array(e);if(typeof crypto<"u"&&crypto.getRandomValues)crypto.getRandomValues(t);else for(let n=0;n<e;n++)t[n]=Math.floor(Math.random()*256);return t}var Ht="SHA-256",Ye="AES-GCM",Nt="PBKDF2",or=1e5;async function ei(e,t=Ht){return U(await crypto.subtle.digest(t,U(e)))}async function ti(e,t={}){let n=U(e),r=await crypto.subtle.importKey("raw",n,Nt,!1,["deriveKey"]);return await crypto.subtle.deriveKey({name:Nt,salt:t.salt?U(t.salt):new Uint8Array(0),iterations:t.iterations??or,hash:Ht},r,{name:Ye,length:256},!0,["encrypt","decrypt"])}function zt(){return new Uint8Array([1,1])}async function Gt(e,t){let n=zt(),r=oe(12),o=await crypto.subtle.encrypt({name:Ye,iv:r},t,e),i=new Uint8Array(o),a=n.length+r.length+i.length,s=new Uint8Array(a),u=0;return s.set(n,u),u+=n.length,s.set(r,u),u+=r.length,s.set(i,u),s}async function qt(e,t){let n=e.subarray(0,2);if(!Et(n,zt()))return Promise.reject(new Error(`Unknown magic ${n}`));let r=e.subarray(2,2+12),o=e.subarray(2+12,e.length),i=await crypto.subtle.decrypt({name:Ye,iv:r},t,o);return new Uint8Array(i)}function ir(){return crypto.getRandomValues(new Uint32Array(1))[0]/4294967295}function P(){return typeof crypto<"u"?ir():Math.random()}function ri(e=.25){return P()<e}function oi(e=100,t=0){return t+Math.floor(P()*(e-t))}function ii(e=100,t=0){return t+P()*(e-t)}function si(e,t,n){return Math.max(e,Math.min(n,t))}function sr(e){return e.reduce((t,n)=>t+n,0)}function ai(e){return sr(e)/e.length}function ui(e){return !/^1?$|^(11+?)\1+$/.test("1".repeat(e))}function ci(e){for(let t=2;t<e;t++)if(e%t===0)return !1;return e>1}var Xe=6;function li(e=0,t=1,n){Xe=((n??Xe)*9301+49297)%233280;let r=Xe/233280;return t+r*(e-t)}function ar(e=""){let[t="",n="asc"]=e.split(" ");return n=n.toLowerCase(),{field:t,orderby:n,asc:n!=="desc",desc:n==="desc"}}function pi(e,t=!0){return `${e} ${t?"asc":"desc"}`}function Qe(e,t,n=!0){let r=e||0,o=t||0;return r>o?n?1:-1:r<o?n?-1:1:0}function di(e,...t){if(t.length>0){let n=t.map(ar),r=Array.from(e);return r.sort((o,i)=>{for(let{field:a,asc:s}of n){let u=Qe(o[a],i[a],s);if(u!==0)return u}return 0}),r}return e}function et(e){return e.filter((t,n)=>e.indexOf(t)===n)}function ur(e,t){return et(e.filter(n=>!t.includes(n)))}function cr(...e){return et(e.reduce((t=[],n)=>t.concat(n),[]))}function ie(...e){return e.flat(1/0)}function lr(e,t){return et(e).filter(n=>t.includes(n))}function hi(e,t){return ur(cr(e,t),lr(e,t))}function Jt(e,t){if(e&&Array.isArray(e)){let n;for(;(n=e.indexOf(t))!==-1;)e.splice(n,1);return e}return []}function xi(e,t){return e.includes(t)||e.push(t),e}function tt(e,t){return e.splice(0,e.length,...e.filter(t)),e}function bi(e,t){let n=e.findIndex(r=>r===t);return n>=0?e.splice(n,1):e.push(t),e}function wi(e){return e.splice(0,e.length),e}function fr(e,t=Qe){return Array.from(e).sort(t)}function Ti(e){return fr(e,(t,n)=>t-n)}function pr(e,t){return e.length===t.length&&e.every((n,r)=>n===t[r])}function Wt(e){return e.sort(()=>P()>.5?1:-1),e}function Ai(e){return Wt(Array.from(e))}function Li(e){for(;e.length>1;){let t=Array.from(e);if(Wt(t),!pr(e,t))return t}return e}function Ui(e){return e[Math.floor(P()*e.length)]}function Di(...e){return ie(e).reduce((t,n)=>t!=null?n>t?n:t:n,void 0)}function vi(...e){return ie(e).reduce((t,n)=>t!=null?n<t?n:t:n,void 0)}function Ei(...e){return ie(e).reduce((t,n)=>t+n,0)}function Pi(...e){let t=ie(e);return t.reduce((n,r)=>n+r,0)/t.length}function Si(e,t){let n=[],r=0,o=e.length;for(;r<o;)n.push(e.slice(r,r+=t));return n}function Ci(e=0,t){if(e<=0)return [];let n=new Array(e);for(let r=0;r<e;r++)n[r]=t instanceof Function?t(r):t;return n}var dr={2:"01",8:"01234567",11:"0123456789a",16:"0123456789abcdef",32:"0123456789abcdefghjkmnpqrtuvwxyz","32-crockford":"0123456789ABCDEFGHJKMNPQRSTVWXYZ","32-geohash":"0123456789bcdefghjkmnpqrstuvwxyz","32-agnoster":"0123456789abcdefghjkmnpqrtuvwxyz","32-rfc":"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567","32-hex":"0123456789ABCDEFGHIJKLMNOPQRSTUV","32-zbase":"ybndrfg8ejkmcpqxot1uwisza345h769",36:"0123456789abcdefghijklmnopqrstuvwxyz",58:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",62:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",64:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/","64-url":"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",66:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_.!~",85:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz!#$%&()*+-;<=>?@^_`{|}~"};function gr(e){let t=dr[String(e)];if(!t)if(typeof e=="string")t=e;else throw new Error(`Unknown base ${e}`);if(t.length>=255)throw new TypeError("Alphabet too long");let n=new Uint8Array(256);for(let c=0;c<n.length;c++)n[c]=255;for(let c=0;c<t.length;c++){let f=t.charAt(c),l=f.charCodeAt(0);if(n[l]!==255)throw new TypeError(`${f} is ambiguous`);n[l]=c;}let r=t.length,o=t.charAt(0),i=Math.log(r)/Math.log(256),a=Math.log(256)/Math.log(r);function s(c,f=-1){let l=U(c);if(l.byteLength===0)return "";let m=0,g=0,p=l.byteLength;for(;g!==p&&l[g]===0;)g++;let d=(p-g)*a+1>>>0,w=new Uint8Array(d);for(;g!==p;){let S=l[g],B=0;for(let h=d-1;(S!==0||B<m)&&h!==-1;h--,B++)S+=256*w[h]>>>0,w[h]=S%r>>>0,S=S/r>>>0;if(S!==0)throw new Error("Non-zero carry");m=B,g++;}let x=d-m;for(;x!==d&&w[x]===0;)x++;let v="";for(;x<d;++x)v+=t.charAt(w[x]);return f>0?v.padStart(f,o):v}function u(c,f=-1){if(typeof c!="string")throw new TypeError("Expected String");if(c.length===0)return new Uint8Array;c=c.replace(/\s+/gi,"");let l=0,m=0;for(;c[l]===o;)l++;let g=(c.length-l)*i+1>>>0,p=new Uint8Array(g);for(;c[l];){let w=n[c.charCodeAt(l)];if(w===255)throw new Error(`Unsupported character "${c[l]}"`);let x=0;for(let v=g-1;(w!==0||x<m)&&v!==-1;v--,x++)w+=r*p[v]>>>0,p[v]=w%256>>>0,w=w/256>>>0;if(w!==0)throw new Error("Non-zero carry");m=x,l++;}let d=g-m;for(;d!==g&&p[d]===0;)d++;return f>0?new Uint8Array([...new Uint8Array(f-p.length+d),...p.slice(d)]):p.slice(d)}return {encode:s,decode:u}}var Se;function N(e){Se==null&&(Se=new Map);function t(){let o=Se.get(e);return o==null&&(o=gr(e),Se.set(e,o)),o}function n(o,i=-1){return t().encode(o,i)}function r(o,i=-1){return t().decode(o,i)}return {encode:n,decode:r}}function nt(e,t=-1){return N(32).encode(e,t)}function Zt(e,t=-1){return N(32).decode(e.toLocaleLowerCase().replaceAll("l","1").replaceAll("s","5").replaceAll("o","0").replaceAll("i","1"),t)}function Ii(e,t=-1){return N(16).encode(e,t)}function Fi(e,t=-1){return N(16).decode(e,t)}function ki(e,t=-1){return N(58).encode(e,t)}function Bi(e,t=-1){return N(58).decode(e,t)}function rt(e,t=-1){return N(62).encode(e,t)}function Kt(e,t=-1){return N(62).decode(e,t)}function Oi(e,t){return Math.ceil(e*(Math.log(256)/Math.log(t)))}var $i=e=>(e.length>0&&(/^[A-Z0-9_\-\ ]*$/g.test(e)&&(e=e.toLowerCase()),e=e.replace(/^[-_\ ]+/gi,"").replace(/[-_\ ]+$/gi,"").replace(/[-_\ ]+([a-z0-9])/gi,(t,n)=>n.toUpperCase()),e=e[0].toLowerCase()+e.substring(1)),e);function yr(e){return e.charAt(0).toUpperCase()+e.toLowerCase().slice(1)}function Vi(e){return e.replace(/\w\S*/g,yr)}function ji(e,t="-"){return t=typeof t>"u"?"_":t,e.replace(/([a-z\d])([A-Z])/g,`$1${t}$2`).replace(/([A-Z]+)([A-Z][a-z\d]+)/g,`$1${t}$2`).toLowerCase()}var Yt=["1","true","yes","y","on"];function zi(e,t=!1){return e==null||typeof e!="string"?t:Yt.includes(String(e).trim().toLowerCase())}function Gi(e,t=0){return e==null||typeof e!="string"?t:parseInt(e.trim(),10)??t}function qi(e,t=0){return e==null||typeof e!="string"?t:parseFloat(e.trim())??t}function mr(e,t=!1){return e==null?t:typeof e=="boolean"?e:typeof e=="number"?e!==0:Yt.includes(String(e).trim().toLowerCase())}function hr(e,t=0){return e==null?t:typeof e=="boolean"?e?1:0:typeof e=="number"?Math.floor(e):parseInt(String(e).trim(),10)??t}function xr(e,t=0){return e==null?t:typeof e=="boolean"?e?1:0:typeof e=="number"?Math.floor(e):parseFloat(String(e).trim())??t}function ot(e,t=""){return e==null?t:String(e)??t}var Ji=xr,Wi=hr,Zi=ot,Ki=mr;function br(e,t={}){let{trace:n=!0,pretty:r=!0}=t;return e.map(o=>{if(o&&typeof o=="object"){if(r&&(o instanceof Uint8Array||o instanceof ArrayBuffer))return `
|
|
3
3
|
${Pt(o)}
|
|
4
4
|
`;if(o instanceof Error)return n?`${o.name||"Error"}: ${o.message}
|
|
5
|
-
${o.stack}`:`${o.name||"Error"}: ${o.message}`;try{return r?JSON.stringify(o,null,2):JSON.stringify(o)}catch{}}return String(o)})}function Zi(e,t={}){return xr(e,t).join(" ")}function Ki(e){try{return decodeURIComponent(escape(e))}catch{}return e}var Xt=864e5;function st(e){return Math.floor(e/1e4)}function Qt(e){return Math.floor(e/100%100)}function br(e){return Math.floor(e%100)}function Xi(e){return [st(e),Qt(e),br(e)]}function en(e,t=!1){return t?new Date(`${Tr(e)}T00:00:00.000Z`):new Date(e/1e4,e/100%100-1,e%100)}function tn(){return Me(new Date)}function Qi(e,t=!1){if(typeof e=="number")return e<100?void 0:e;if(typeof e=="string")return nn(e);if(Array.isArray(e)&&e.length===3){let[n,r,o]=e;return at(n,r,o)}else if(e instanceof Date)return Me(e,t)}function es(e){return en(e,!0)}function Me(e,t=!1){return t?nn(e.toISOString()):e.getFullYear()*1e4+(e.getMonth()+1)*100+e.getDate()}function ts(e){return Me(e,!0)}function it(e,t=!0){return en(e,t).getTime()}function wr(e,t=!0){return Me(new Date(e),t)}function Tr(e,t="-"){let n=String(e);return n.slice(0,4)+t+n.slice(4,6)+t+n.slice(6,8)}function at(e,t=1,n=1){if(!(t<1||t>12||n<1||n>31))return e*1e4+t*100+n}function nn(e){let t=String(e).replace(/[^0-9]/g,"").slice(0,8);if(t.length===8)return +t}function ns(e,t=0){let n=st(e),r=Qt(e);return t!==0&&(r+=t,n+=Math.floor((r-1)/12),r=Math.floor((r-1)%12)+1,r===0&&(r=12)),at(n,r,1)}function rs(e,t=0){let n=st(e);return at(n+t,1,1)}function Ce(e,t){return wr(it(e)+t*864e5)}function os(e,t){return Math.round((it(t)-it(e))/864e5)}function is(e,t){let n=[];for(t==null&&(t=tn()),e<0&&(e=Ce(t,e+1));e<=t;)n.push(e),e=Ce(e,1);return n}function*ss(e,t){let n=[];for(t==null&&(t=tn()),e<0&&(e=Ce(t,e+1));e<=t;)yield e,e=Ce(e,1);return n}function rn(){let e,t;return [new Promise((r,o)=>{e=r,t=o;}),e,t]}async function us(e){return new Promise(t=>setTimeout(t,e))}async function cs(){return new Promise(e=>setTimeout(e,0))}async function ls(e,t,n="timeoutReached"){return new Promise(async(r,o)=>{let i=!1,a=setTimeout(()=>{i=!0,r(n);},t);try{let s=await e;clearTimeout(a),i||r(s);}catch(s){clearTimeout(a),i||o(s);}})}function fs(e){return e==="timeoutReached"||e?.name==="Timeout reached"}async function on(e,t){return t<=0?await e:new Promise(async(n,r)=>{let o=!1,i=setTimeout(()=>{o=!0,r(new Error("Timeout reached"));},t);try{let a=await e;clearTimeout(i),o||n(a);}catch(a){clearTimeout(i),o||r(a);}})}function ps(e,t,n=1e3){return new Promise((r,o)=>{let i=u=>{s&&(clearTimeout(s),a(),r(u));},a=()=>{s=null,e.off?e.off(t,i):e.removeEventListener&&e.removeEventListener(t,i);},s=setTimeout(()=>{a(),o(new Error("Did not response in time"));},n);e.on?e.on(t,i):e.addEventListener&&e.addEventListener(t,i);})}function R(e){return !!(e&&(e instanceof Promise||typeof e.then=="function"))}function _(e){return Promise.resolve(e)}var A=class{get value(){return this.days}constructor(t){if(typeof t=="number"){this.days=t;return}if(t!=null&&(t=A.from(t)?.days),t==null){let n=new Date;this.days=n.getFullYear()*1e4+(n.getMonth()+1)*100+n.getDate();}else this.days=t;}static fromNumber(t){return new A(t)}static fromString(t){return A.from(+t.replace(/[^0-9]/g,"").slice(0,8))}static fromDate(t,n=!1){return n?A.fromString(t.toISOString().substr(0,10)):A.from(t.getFullYear()*1e4+(t.getMonth()+1)*100+t.getDate())}static fromDateGMT(t){return A.fromDate(t,!0)}static from(t,n=!1){if(typeof t=="number")return t<100?void 0:new A(t);if(typeof t=="string")return A.fromString(t);if(Array.isArray(t)&&t.length===3){let[r,o=1,i=1]=t;return o<1||o>12||i<1||i>31?void 0:new A(r*1e4+o*100+i)}else {if(t instanceof Date)return A.fromDate(t,n);if(t instanceof A)return t}}toNumber(){return this.days}toJson(){return this.days}toString(t="-"){let n=String(this.days);return n.slice(0,4)+t+n.slice(4,6)+t+n.slice(6,8)}toDate(t=!1){return t?new Date(`${this.toString()}T00:00:00.000Z`):new Date(this.days/1e4,this.days/100%100-1,this.days%100)}toDateGMT(){return this.toDate(!0)}get year(){return Math.floor(this.days/1e4)}get month(){return Math.floor(this.days/100%100)}get day(){return Math.floor(this.days%100)}dayOffset(t){return A.fromDateGMT(new Date(this.toDateGMT().getTime()+t*864e5))}monthStart(){return A.from([this.year,this.month,1])}yearStart(){return A.from([this.year,1,1])}monthOffset(t){let n=this.month+t,r=Math.floor((n-1)%12)+1;r===0&&(r=12);let o=Math.floor((n-1)/12);return A.from([this.year+o,r,this.day])}daysUntil(t){return Math.round((new A(t)?.toDateGMT().getTime()-this.toDateGMT().getTime())/864e5)}yesterday(){return this.dayOffset(-1)}tomorrow(){return this.dayOffset(1)}};async function ys(e,t,n){let r=A.from(e),o=A.from(t);for(;r&&o&&r?.days<=o?.days;){let i=n(r);R(i)&&await i,r=r.dayOffset(1);}}function ms(){return new A}function hs(e){return new A(e)}function xs(e){return A.fromDate(new Date(e)).days}function Ar(e,t=2){return +(+e).toFixed(t)}function ws(e,t=2){return +(+e/10**t).toFixed(t)}function Ts(e,t=2){return Math.round(+e*10**t)}function As(e,t=2){return t*(Ar(e,t)%1)}function $(e){return e!=null&&typeof e=="object"}function ut(e){return Object(e)!==e}function V(e){return Array.isArray(e)}function Re(e){return $(e)&&!V(e)}function Us(e){return e?.constructor===Object}function sn(e){return typeof e=="string"}function an(e){return typeof e=="number"&&!isNaN(e)}function Ds(e){return an(e)&&Number.isInteger(e)}function vs(e){return an(e)&&Number.isSafeInteger(e)}function un(e){return typeof e=="boolean"}function Es(e){return e==null}function Ps(e){return e==null}function Ss(e){return $(e)&&e.constructor.name==="Uint8Array"}function Cs(e){return e!=null}function Ms(e){return e!=null&&e!==!1&&e!==!0}function Lr(e,t,n=new WeakSet){if(e===t)return !0;if(n.has(t)||(ut(t)||n.add(t),!(e instanceof Object)||!(t instanceof Object))||e.constructor!==t.constructor||e.length!==t.length)return !1;for(let r in e){if(!e.hasOwnProperty(r))continue;if(!t.hasOwnProperty(r))return !1;let o=e[r],i=t[r];if(!Lr(o,i,n))return !1}for(let r in t)if(t.hasOwnProperty(r)&&!e.hasOwnProperty(r))return !1;return !0}function Ur(e,t=new WeakSet){if(t.has(e))return "[Circular ~]";if(ut(e)||t.add(e),Re(e)){for(let n in e)if(e.hasOwnProperty(n)){if(e[n]===void 0){delete e[n];continue}Ur(e[n],t);}}else if(V(e))for(let n=e.length-1;n>=0;n--)e[n]===void 0&&e.splice(n,1);return e}function Ie(e,...t){for(let n of t)$(e)||(e={}),!(n==null||!$(n))&&Object.keys(n).forEach(r=>{let o=e[r],i=n[r];Array.isArray(o)&&Array.isArray(i)?e[r]=o.concat(i):$(o)&&$(i)?e[r]=Ie(Object.assign({},o),i):e[r]=i;});return e}function Dr(e,t,n={cyclesFix:!0},r=[]){let o=[],i=Array.isArray(e);for(let s in e){let u=e[s],c=i?+s:s;if(!(s in t)){o.push({type:"del",path:[c]});continue}let f=t[s],l=typeof u=="object"&&typeof f=="object";if(u&&f&&l&&!["Date","RegExp","String","Number"].includes(Object.getPrototypeOf(u).constructor.name)&&(!n.cyclesFix||!r.includes(u))){let m=Dr(u,f,n,n.cyclesFix?r.concat([u]):[]);o=[...o,...m.map(g=>(g.path.unshift(c),g))];}else u!==f&&!(l&&(isNaN(u)?`${u}`==`${f}`:+u==+f))&&o.push({path:[c],type:"upd",value:f});}let a=Array.isArray(t);for(let s in t)s in e||o.push({type:"new",path:[a?+s:s],value:t[s]});return o}var cn=e=>e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/'/g,"'").replace(/"/g,"""),Bs=e=>e.replace(/</gi,"<").replace(/>/gi,">").replace(/"/gi,'"').replace(/'/gi,"'").replace(/&/gi,"&");function _s(e,t,n=[]){return e.filter(r=>!t.some(o=>!o(r))).map(r=>{for(let o of n)r=o(r);return r}).filter(r=>r!=null)}function $s(e,t){return e.reduce((n,r)=>{let o=String(r[t]);return (n[o]=n[o]||[]).push(r),n},{})}function Vs(e,t){return Array.from(e.reduce((n,r)=>n.add(r[t]),new Set))}function js(e,t){return e.map(n=>n[t])}function zs(e,t){return $(e)?Object.fromEntries(Object.entries(e).map(([n,r])=>{let o=t(n,r);return V(o)&&o.length===2?o:[n,o]}).filter(n=>n!=null)):{}}function Gs(e,t){return t.dispose&&e.dispose&&t.dispose.add(e.dispose),Object.assign(e,t)}function qs(e){return Object.keys(e).length<=0}var ln=/[\u0000-\u001F\u0080-\u009F]/g,vr=/^\.+/,Er=/\.+$/;function fn(){return /[<>:"/\\|?*\u0000-\u001F]/g}function Pr(){return /^(con|prn|aux|nul|com\d|lpt\d)$/i}function Ws(e,t="_"){if(typeof e!="string")throw new TypeError("Expected a string");if(fn().test(t)&&ln.test(t))throw new Error("Replacement string cannot contain reserved filename characters");return e=e.replace(fn(),t).replace(ln,t).replace(vr,t).replace(Er,""),e=Pr().test(e)?e+t:e,e.slice(0,100)}var Sr=/[\\\-\[\]\/{}()*+?.^$|]/g;function pn(e){return e?e instanceof RegExp?e.source:e.replace(Sr,"\\$&"):""}var fe=e=>Math.abs(e)%1===.5,dn=e=>e%2===0,Ys=e=>Math.ceil(e),Xs=e=>Math.floor(e),Qs=e=>Math.round(e),ea=e=>{let t=Math.round(e);return fe(e)&&dn(t)?t-1:t},ta=e=>fe(e)?Math.sign(e)*Math.ceil(Math.abs(e)):Math.round(e),na=e=>fe(e)?Math.floor(e):Math.round(e),ra=e=>{let t=Math.round(e);return fe(e)?dn(t)?t:t-1:t},oa=e=>fe(e)?Math.sign(e)*Math.floor(Math.abs(e)):Math.round(e);function gn(e){return e.reduce((t,n)=>Math.min(t,n.sort_weight||0),0)-1-P()}function yn(e){return e.reduce((t,n)=>Math.max(t,n.sort_weight||0),0)+1+P()}function aa(e,t,n){let r=n.length,o=e<t;if(r<=0||e>=r-1)return yn(n);if(e<=0)return gn(n);n=Cr([...n]);let i=o?-1:0,a=n[e+i].sort_weight||0,u=(n[e+i+1].sort_weight||0)-a;if(u===0)return o?gn(n):yn(n);let c=a+u/2,f=u*.01*(P()-.5);return c+f}function Cr(e){return e.sort((t,n)=>(t.sort_weight||0)-(n.sort_weight||0)),e}function la(e={}){let{getter:t=s=>s.sort}=e;function n(s){return s.sort((u,c)=>(t(u)||0)-(t(c)||0)),s}function r(s){return s.reduce((u,c)=>Math.min(u,t(c)||0),0)-1-P()}function o(s){return s.reduce((u,c)=>Math.max(u,t(c)||0),0)+1+P()}function i(s,u){s==null&&(s=(u??0)-1),u==null&&(u=(s??0)+1);let c=u-s,f=s+c/2,l=c*.01*(P()-.5);return f+l}function a(s,u,c){let f=c.length,l=s<u;if(f<=0||s>=f-1)return o(c);if(s<=0)return r(c);c=n([...c]);let m=l?-1:0,g=t(c[s+m])||0,d=(t(c[s+m+1])||0)-g;if(d===0)return l?r(c):o(c);let w=g+d/2,x=d*.01*(P()-.5);return w+x}return {start:r,end:o,between:i,move:a,items:n}}var Mr=/((?:(?:(?:https?|ftp):)?\/\/)(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u00A1-\uFFFF][a-z0-9\u00A1-\uFFFF_-]{0,62})?[a-z0-9\u00A1-\uFFFF]\.)+(?:[a-z\u00A1-\uFFFF]{2,}\.?))(?::\d{2,5})?(?:[/?#]\S*)?)/gim;function da(e){return e.split(Mr).map((t,n)=>{let r=cn(t);return n%2?`<a target="_blank" href="${r}">${Rr(r)}</a>`:r}).join("")}function Rr(e){return e.replace(/^https?:\/\/(www\.)?/,"").replace(/\/$/,"")}function mn(e){let t=[];for(let[n,r]of Object.entries(e))if(r!=null){Array.isArray(r)||(r=[r]);for(let o of r)o!=null&&t.push(`${encodeURIComponent(n)}=${encodeURIComponent(String(o))}`);}return t.join("&")}function ga(e){let t={},n=(e[0]==="?"?e.substr(1):e).split("&");for(let r=0;r<n.length;r++){let o=n[r].split("="),i=decodeURIComponent(o[0]),a=decodeURIComponent(o[1]||"");t[i]!=null?(Array.isArray(t[i])||(t[i]=[t[i]]),t[i].push(a)):t[i]=a;}return t}function ha(e,t,n){let r=e[t];return r===void 0&&(r=n(t,e),e[t]=r),r}async function xa(e,t,n){let r=e[t];return r===void 0&&(r=await n(t,e),e[t]=r),r}function ba(e){return e!=null?e.size!=null?e.size:e.length!=null?e.length:Object.keys(e).length:0}function wa(e){return e!=null&&e.length>0?e[e.length-1]:void 0}function Ta(e){try{if(e!=null)return Array.isArray(e)||typeof e=="string"?e.length<=0:e?.size!=null?e.size<=0:Object.keys(e).length<=0}catch(t){console.warn("Failed to check if empty for",e,t);}return !0}function ct(e){return Object(e)!==e?e:JSON.parse(F(e))}function Aa(e){return Object(e)!==e?e:JSON.parse(F(e))}function La(e){let t=new Map;return n=>{if(t.has(n))return t.get(n);let r=e(n);return t.set(n,r),r}}function Ua(e){let t=new Map;return async(...n)=>{let r=F(n);if(t.has(r))return t.get(r);let o=await e(...n);return t.set(r,o),o}}function Da(e,t){let n=[];for(let r=0;r<e;r++)n.push(t(r,e));return n}var Ir=/\\\s|\s+|#[^\n]*\n?/gm,Fr=/\(\?P?<(\w[\w\d_]+)>|\((?!\?(:|\!|=|<=|<\!))/gm,hn=/^((?:\(\?[\w$]+\))?)\(\?<([=!])([\s\S]*?)\)/gm;function kr(e){return typeof e=="string"?e:e.source||""}function Ea(e){return e.replace(/[-\[\]{}()*+?.,\\^$|#\s]/g,"\\$&")}var xn=class{constructor(t,n){this.namedGroups={};this.names=[];let r=n??"",o;if(t instanceof RegExp?(n==null&&(r=t.flags),o=t.source):o=t,r&&r.includes("x")&&(r=r.replace("x",""),o=o.replace(Ir,s=>s[0]==="\\"?s:"")),!(t instanceof RegExp)){let s=0;o=o.replace(Fr,(u,c)=>(s+=1,c?(c!=="index"&&c!=="length"&&!this.namedGroups[c]&&(this.namedGroups[c]=s),"("):u)),this.names=Object.keys(this.namedGroups);}o=kr(o),hn.lastIndex=0;let a=hn.exec(o);a&&(this.lookBehind={rx:new RegExp(`${a[3]}$(?!\\s)`),expect:a?a[2]==="=":!a},o=o.substr(a[0].length)),this.rx=new RegExp(o,r);}get lastIndex(){return this.rx.lastIndex}set lastIndex(t){this.rx.lastIndex=t;}_handleMatch(t){if(this.lookBehind){let n=t.input.slice(0,t.index);if(this.lookBehind.expect!==this.lookBehind.rx.test(n))return null}for(let n of this.names)t[n]=t[this.namedGroups[n]];return t}exec(t){let n;for(;n=this.rx.exec(t);)if(this.rx.lastIndex===n.index&&this.rx.lastIndex++,n=this._handleMatch(n),n!=null)return n}execAll(t){let n=[],r;for(this.rx.lastIndex=0;r=this.exec(t);)n.push(r);return this.rx.lastIndex=0,n}replace(t,n){let r=typeof n=="function"?n:()=>n;return t.replace(this.rx,o=>r(o))}};var Br=",";function Ca(e,t={}){let{separator:n=Br}=t,r="";for(let o=0;o<e.length;o++)r+=`${e[o].map(i=>{if(i==null||i==="")return "";if(un(i))return i?1:0;let a=String(i);return (Re(i)||V(i))&&(a=F(i)),a.includes('"')||a.includes(`
|
|
5
|
+
${o.stack}`:`${o.name||"Error"}: ${o.message}`;try{return r?JSON.stringify(o,null,2):JSON.stringify(o)}catch{}}return String(o)})}function Yi(e,t={}){return br(e,t).join(" ")}function Xi(e){try{return decodeURIComponent(escape(e))}catch{}return e}var Xt=864e5;function st(e){return Math.floor(e/1e4)}function Qt(e){return Math.floor(e/100%100)}function wr(e){return Math.floor(e%100)}function es(e){return [st(e),Qt(e),wr(e)]}function en(e,t=!1){return t?new Date(`${Ar(e)}T00:00:00.000Z`):new Date(e/1e4,e/100%100-1,e%100)}function tn(){return Me(new Date)}function ts(e,t=!1){if(typeof e=="number")return e<100?void 0:e;if(typeof e=="string")return nn(e);if(Array.isArray(e)&&e.length===3){let[n,r,o]=e;return at(n,r,o)}else if(e instanceof Date)return Me(e,t)}function ns(e){return en(e,!0)}function Me(e,t=!1){return t?nn(e.toISOString()):e.getFullYear()*1e4+(e.getMonth()+1)*100+e.getDate()}function rs(e){return Me(e,!0)}function it(e,t=!0){return en(e,t).getTime()}function Tr(e,t=!0){return Me(new Date(e),t)}function Ar(e,t="-"){let n=String(e);return n.slice(0,4)+t+n.slice(4,6)+t+n.slice(6,8)}function at(e,t=1,n=1){if(!(t<1||t>12||n<1||n>31))return e*1e4+t*100+n}function nn(e){let t=String(e).replace(/[^0-9]/g,"").slice(0,8);if(t.length===8)return +t}function os(e,t=0){let n=st(e),r=Qt(e);return t!==0&&(r+=t,n+=Math.floor((r-1)/12),r=Math.floor((r-1)%12)+1,r===0&&(r=12)),at(n,r,1)}function is(e,t=0){let n=st(e);return at(n+t,1,1)}function Ce(e,t){return Tr(it(e)+t*864e5)}function ss(e,t){return Math.round((it(t)-it(e))/864e5)}function as(e,t){let n=[];for(t==null&&(t=tn()),e<0&&(e=Ce(t,e+1));e<=t;)n.push(e),e=Ce(e,1);return n}function*us(e,t){let n=[];for(t==null&&(t=tn()),e<0&&(e=Ce(t,e+1));e<=t;)yield e,e=Ce(e,1);return n}function rn(){let e,t;return [new Promise((r,o)=>{e=r,t=o;}),e,t]}async function ls(e){return new Promise(t=>setTimeout(t,e))}async function fs(){return new Promise(e=>setTimeout(e,0))}async function ps(e,t,n="timeoutReached"){return new Promise(async(r,o)=>{let i=!1,a=setTimeout(()=>{i=!0,r(n);},t);try{let s=await e;clearTimeout(a),i||r(s);}catch(s){clearTimeout(a),i||o(s);}})}function ds(e){return e==="timeoutReached"||e?.name==="Timeout reached"}async function on(e,t){return t<=0?await e:new Promise(async(n,r)=>{let o=!1,i=setTimeout(()=>{o=!0,r(new Error("Timeout reached"));},t);try{let a=await e;clearTimeout(i),o||n(a);}catch(a){clearTimeout(i),o||r(a);}})}function gs(e,t,n=1e3){return new Promise((r,o)=>{let i=u=>{s&&(clearTimeout(s),a(),r(u));},a=()=>{s=null,e.off?e.off(t,i):e.removeEventListener&&e.removeEventListener(t,i);},s=setTimeout(()=>{a(),o(new Error("Did not response in time"));},n);e.on?e.on(t,i):e.addEventListener&&e.addEventListener(t,i);})}function R(e){return !!(e&&(e instanceof Promise||typeof e.then=="function"))}function _(e){return Promise.resolve(e)}var A=class{get value(){return this.days}constructor(t){if(typeof t=="number"){this.days=t;return}if(t!=null&&(t=A.from(t)?.days),t==null){let n=new Date;this.days=n.getFullYear()*1e4+(n.getMonth()+1)*100+n.getDate();}else this.days=t;}static fromNumber(t){return new A(t)}static fromString(t){return A.from(+t.replace(/[^0-9]/g,"").slice(0,8))}static fromDate(t,n=!1){return n?A.fromString(t.toISOString().substr(0,10)):A.from(t.getFullYear()*1e4+(t.getMonth()+1)*100+t.getDate())}static fromDateGMT(t){return A.fromDate(t,!0)}static from(t,n=!1){if(typeof t=="number")return t<100?void 0:new A(t);if(typeof t=="string")return A.fromString(t);if(Array.isArray(t)&&t.length===3){let[r,o=1,i=1]=t;return o<1||o>12||i<1||i>31?void 0:new A(r*1e4+o*100+i)}else {if(t instanceof Date)return A.fromDate(t,n);if(t instanceof A)return t}}toNumber(){return this.days}toJson(){return this.days}toString(t="-"){let n=String(this.days);return n.slice(0,4)+t+n.slice(4,6)+t+n.slice(6,8)}toDate(t=!1){return t?new Date(`${this.toString()}T00:00:00.000Z`):new Date(this.days/1e4,this.days/100%100-1,this.days%100)}toDateGMT(){return this.toDate(!0)}get year(){return Math.floor(this.days/1e4)}get month(){return Math.floor(this.days/100%100)}get day(){return Math.floor(this.days%100)}dayOffset(t){return A.fromDateGMT(new Date(this.toDateGMT().getTime()+t*864e5))}monthStart(){return A.from([this.year,this.month,1])}yearStart(){return A.from([this.year,1,1])}monthOffset(t){let n=this.month+t,r=Math.floor((n-1)%12)+1;r===0&&(r=12);let o=Math.floor((n-1)/12);return A.from([this.year+o,r,this.day])}daysUntil(t){return Math.round((new A(t)?.toDateGMT().getTime()-this.toDateGMT().getTime())/864e5)}yesterday(){return this.dayOffset(-1)}tomorrow(){return this.dayOffset(1)}};async function hs(e,t,n){let r=A.from(e),o=A.from(t);for(;r&&o&&r?.days<=o?.days;){let i=n(r);R(i)&&await i,r=r.dayOffset(1);}}function xs(){return new A}function bs(e){return new A(e)}function ws(e){return A.fromDate(new Date(e)).days}function Lr(e,t=2){return +(+e).toFixed(t)}function As(e,t=2){return +(+e/10**t).toFixed(t)}function Ls(e,t=2){return Math.round(+e*10**t)}function Us(e,t=2){return t*(Lr(e,t)%1)}function $(e){return e!=null&&typeof e=="object"}function ut(e){return Object(e)!==e}function V(e){return Array.isArray(e)}function Re(e){return $(e)&&!V(e)}function vs(e){return e?.constructor===Object}function sn(e){return typeof e=="string"}function an(e){return typeof e=="number"&&!isNaN(e)}function Es(e){return an(e)&&Number.isInteger(e)}function Ps(e){return an(e)&&Number.isSafeInteger(e)}function un(e){return typeof e=="boolean"}function Ss(e){return e==null}function Cs(e){return e==null}function Ms(e){return $(e)&&e.constructor.name==="Uint8Array"}function Rs(e){return e!=null}function Is(e){return e!=null&&e!==!1&&e!==!0}function Ur(e,t,n=new WeakSet){if(e===t)return !0;if(n.has(t)||(ut(t)||n.add(t),!(e instanceof Object)||!(t instanceof Object))||e.constructor!==t.constructor||e.length!==t.length)return !1;for(let r in e){if(!e.hasOwnProperty(r))continue;if(!t.hasOwnProperty(r))return !1;let o=e[r],i=t[r];if(!Ur(o,i,n))return !1}for(let r in t)if(t.hasOwnProperty(r)&&!e.hasOwnProperty(r))return !1;return !0}function Dr(e,t=new WeakSet){if(t.has(e))return "[Circular ~]";if(ut(e)||t.add(e),Re(e)){for(let n in e)if(e.hasOwnProperty(n)){if(e[n]===void 0){delete e[n];continue}Dr(e[n],t);}}else if(V(e))for(let n=e.length-1;n>=0;n--)e[n]===void 0&&e.splice(n,1);return e}function Ie(e,...t){for(let n of t)$(e)||(e={}),!(n==null||!$(n))&&Object.keys(n).forEach(r=>{let o=e[r],i=n[r];Array.isArray(o)&&Array.isArray(i)?e[r]=o.concat(i):$(o)&&$(i)?e[r]=Ie(Object.assign({},o),i):e[r]=i;});return e}function vr(e,t,n={cyclesFix:!0},r=[]){let o=[],i=Array.isArray(e);for(let s in e){let u=e[s],c=i?+s:s;if(!(s in t)){o.push({type:"del",path:[c]});continue}let f=t[s],l=typeof u=="object"&&typeof f=="object";if(u&&f&&l&&!["Date","RegExp","String","Number"].includes(Object.getPrototypeOf(u).constructor.name)&&(!n.cyclesFix||!r.includes(u))){let m=vr(u,f,n,n.cyclesFix?r.concat([u]):[]);o=[...o,...m.map(g=>(g.path.unshift(c),g))];}else u!==f&&!(l&&(isNaN(u)?`${u}`==`${f}`:+u==+f))&&o.push({path:[c],type:"upd",value:f});}let a=Array.isArray(t);for(let s in t)s in e||o.push({type:"new",path:[a?+s:s],value:t[s]});return o}var cn=e=>e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/'/g,"'").replace(/"/g,"""),_s=e=>e.replace(/</gi,"<").replace(/>/gi,">").replace(/"/gi,'"').replace(/'/gi,"'").replace(/&/gi,"&");function Vs(e,t,n=[]){return e.filter(r=>!t.some(o=>!o(r))).map(r=>{for(let o of n)r=o(r);return r}).filter(r=>r!=null)}function js(e,t){return e.reduce((n,r)=>{let o=String(r[t]);return (n[o]=n[o]||[]).push(r),n},{})}function Ns(e,t){return Array.from(e.reduce((n,r)=>n.add(r[t]),new Set))}function Hs(e,t){return e.map(n=>n[t])}function qs(e,t){return $(e)?Object.fromEntries(Object.entries(e).map(([n,r])=>{let o=t(n,r);return V(o)&&o.length===2?o:[n,o]}).filter(n=>n!=null)):{}}function Js(e,t){return t.dispose&&e.dispose&&t.dispose.add(e.dispose),Object.assign(e,t)}function Ws(e){return Object.keys(e).length<=0}var ln=/[\u0000-\u001F\u0080-\u009F]/g,Er=/^\.+/,Pr=/\.+$/;function fn(){return /[<>:"/\\|?*\u0000-\u001F]/g}function Sr(){return /^(con|prn|aux|nul|com\d|lpt\d)$/i}function Ks(e,t="_"){if(typeof e!="string")throw new TypeError("Expected a string");if(fn().test(t)&&ln.test(t))throw new Error("Replacement string cannot contain reserved filename characters");return e=e.replace(fn(),t).replace(ln,t).replace(Er,t).replace(Pr,""),e=Sr().test(e)?e+t:e,e.slice(0,100)}var Cr=/[\\\-\[\]\/{}()*+?.^$|]/g;function pn(e){return e?e instanceof RegExp?e.source:e.replace(Cr,"\\$&"):""}var fe=e=>Math.abs(e)%1===.5,dn=e=>e%2===0,Qs=e=>Math.ceil(e),ea=e=>Math.floor(e),ta=e=>Math.round(e),na=e=>{let t=Math.round(e);return fe(e)&&dn(t)?t-1:t},ra=e=>fe(e)?Math.sign(e)*Math.ceil(Math.abs(e)):Math.round(e),oa=e=>fe(e)?Math.floor(e):Math.round(e),ia=e=>{let t=Math.round(e);return fe(e)?dn(t)?t:t-1:t},sa=e=>fe(e)?Math.sign(e)*Math.floor(Math.abs(e)):Math.round(e);function gn(e){return e.reduce((t,n)=>Math.min(t,n.sort_weight||0),0)-1-P()}function yn(e){return e.reduce((t,n)=>Math.max(t,n.sort_weight||0),0)+1+P()}function ca(e,t,n){let r=n.length,o=e<t;if(r<=0||e>=r-1)return yn(n);if(e<=0)return gn(n);n=Mr([...n]);let i=o?-1:0,a=n[e+i].sort_weight||0,u=(n[e+i+1].sort_weight||0)-a;if(u===0)return o?gn(n):yn(n);let c=a+u/2,f=u*.01*(P()-.5);return c+f}function Mr(e){return e.sort((t,n)=>(t.sort_weight||0)-(n.sort_weight||0)),e}function pa(e={}){let{getter:t=s=>s.sort}=e;function n(s){return s.sort((u,c)=>(t(u)||0)-(t(c)||0)),s}function r(s){return s.reduce((u,c)=>Math.min(u,t(c)||0),0)-1-P()}function o(s){return s.reduce((u,c)=>Math.max(u,t(c)||0),0)+1+P()}function i(s,u){s==null&&(s=(u??0)-1),u==null&&(u=(s??0)+1);let c=u-s,f=s+c/2,l=c*.01*(P()-.5);return f+l}function a(s,u,c){let f=c.length,l=s<u;if(f<=0||s>=f-1)return o(c);if(s<=0)return r(c);c=n([...c]);let m=l?-1:0,g=t(c[s+m])||0,d=(t(c[s+m+1])||0)-g;if(d===0)return l?r(c):o(c);let w=g+d/2,x=d*.01*(P()-.5);return w+x}return {start:r,end:o,between:i,move:a,items:n}}var Rr=/((?:(?:(?:https?|ftp):)?\/\/)(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u00A1-\uFFFF][a-z0-9\u00A1-\uFFFF_-]{0,62})?[a-z0-9\u00A1-\uFFFF]\.)+(?:[a-z\u00A1-\uFFFF]{2,}\.?))(?::\d{2,5})?(?:[/?#]\S*)?)/gim;function ya(e){return e.split(Rr).map((t,n)=>{let r=cn(t);return n%2?`<a target="_blank" href="${r}">${Ir(r)}</a>`:r}).join("")}function Ir(e){return e.replace(/^https?:\/\/(www\.)?/,"").replace(/\/$/,"")}function mn(e){let t=[];for(let[n,r]of Object.entries(e))if(r!=null){Array.isArray(r)||(r=[r]);for(let o of r)o!=null&&t.push(`${encodeURIComponent(n)}=${encodeURIComponent(String(o))}`);}return t.join("&")}function ma(e){let t={},n=(e[0]==="?"?e.substr(1):e).split("&");for(let r=0;r<n.length;r++){let o=n[r].split("="),i=decodeURIComponent(o[0]),a=decodeURIComponent(o[1]||"");t[i]!=null?(Array.isArray(t[i])||(t[i]=[t[i]]),t[i].push(a)):t[i]=a;}return t}function ba(e,t,n){let r=e[t];return r===void 0&&(r=n(t,e),e[t]=r),r}async function wa(e,t,n){let r=e[t];return r===void 0&&(r=await n(t,e),e[t]=r),r}function Ta(e){return e!=null?e.size!=null?e.size:e.length!=null?e.length:Object.keys(e).length:0}function Aa(e){return e!=null&&e.length>0?e[e.length-1]:void 0}function La(e){try{if(e!=null)return Array.isArray(e)||typeof e=="string"?e.length<=0:e?.size!=null?e.size<=0:Object.keys(e).length<=0}catch(t){console.warn("Failed to check if empty for",e,t);}return !0}function ct(e){return Object(e)!==e?e:JSON.parse(F(e))}function Ua(e){return Object(e)!==e?e:JSON.parse(F(e))}function Da(e){let t=new Map;return n=>{if(t.has(n))return t.get(n);let r=e(n);return t.set(n,r),r}}function va(e){let t=new Map;return async(...n)=>{let r=F(n);if(t.has(r))return t.get(r);let o=await e(...n);return t.set(r,o),o}}function Ea(e,t){let n=[];for(let r=0;r<e;r++)n.push(t(r,e));return n}var Fr=/\\\s|\s+|#[^\n]*\n?/gm,kr=/\(\?P?<(\w[\w\d_]+)>|\((?!\?(:|\!|=|<=|<\!))/gm,hn=/^((?:\(\?[\w$]+\))?)\(\?<([=!])([\s\S]*?)\)/gm;function Br(e){return typeof e=="string"?e:e.source||""}function Sa(e){return e.replace(/[-\[\]{}()*+?.,\\^$|#\s]/g,"\\$&")}var xn=class{constructor(t,n){this.namedGroups={};this.names=[];let r=n??"",o;if(t instanceof RegExp?(n==null&&(r=t.flags),o=t.source):o=t,r&&r.includes("x")&&(r=r.replace("x",""),o=o.replace(Fr,s=>s[0]==="\\"?s:"")),!(t instanceof RegExp)){let s=0;o=o.replace(kr,(u,c)=>(s+=1,c?(c!=="index"&&c!=="length"&&!this.namedGroups[c]&&(this.namedGroups[c]=s),"("):u)),this.names=Object.keys(this.namedGroups);}o=Br(o),hn.lastIndex=0;let a=hn.exec(o);a&&(this.lookBehind={rx:new RegExp(`${a[3]}$(?!\\s)`),expect:a?a[2]==="=":!a},o=o.substr(a[0].length)),this.rx=new RegExp(o,r);}get lastIndex(){return this.rx.lastIndex}set lastIndex(t){this.rx.lastIndex=t;}_handleMatch(t){if(this.lookBehind){let n=t.input.slice(0,t.index);if(this.lookBehind.expect!==this.lookBehind.rx.test(n))return null}for(let n of this.names)t[n]=t[this.namedGroups[n]];return t}exec(t){let n;for(;n=this.rx.exec(t);)if(this.rx.lastIndex===n.index&&this.rx.lastIndex++,n=this._handleMatch(n),n!=null)return n}execAll(t){let n=[],r;for(this.rx.lastIndex=0;r=this.exec(t);)n.push(r);return this.rx.lastIndex=0,n}replace(t,n){let r=typeof n=="function"?n:()=>n;return t.replace(this.rx,o=>r(o))}};var Or=",";function Ra(e,t={}){let{separator:n=Or}=t,r="";for(let o=0;o<e.length;o++)r+=`${e[o].map(i=>{if(i==null||i==="")return "";if(un(i))return i?1:0;let a=String(i);return (Re(i)||V(i))&&(a=F(i)),a.includes('"')||a.includes(`
|
|
6
6
|
`)||a.includes(n)?`"${a.replace(/"/g,'""')}"`:a}).join(n)}
|
|
7
|
-
`;return r}function
|
|
7
|
+
`;return r}function _r(e,t={}){let n=/("((?:(?:[^"]*?)(?:"")?)*)"|([^,;\t\n]*))([,;\t]|\n|\r\n)/g;t.separator&&(n=new RegExp(n.source.replaceAll(",;\\t",pn(t.separator)),n.flags));let r=[],o=[],i,a=`${e.replaceAll(`\r
|
|
8
8
|
`,`
|
|
9
9
|
`).trim()}
|
|
10
10
|
`;for(;i=n.exec(a);){let s=i[2]??i[3]??"";s=s.replaceAll('""','"'),o.push(s),i[4]===`
|
|
11
|
-
`&&(r.push(o),o=[]);}return r}function Ma(e,t={}){let n=Or(e,t),r=n[0];return n.slice(1).map(o=>Object.fromEntries(o.map((i,a)=>[r[a],i])))}async function _r(e){typeof e=="function"?await _(e()):R(e)?await e:typeof e.dispose=="function"?await _(e.dispose()):R(e.dispose)?await e.dispose:typeof e.cleanup=="function"?await _(e.cleanup()):R(e.cleanup)&&await e.cleanup;}function pe(e){let t=e;t!=null&&(sn(t)?t={name:t}:"debug"in t&&"label"in t&&(t={name:t.label,log:t}));let n=t?.name,r=t?.log??M("zeed:dispose"),o=[],i=async u=>{u!=null&&o.includes(u)&&(tt(o,c=>c!==u),await _r(u));},a=async()=>{for(n&&r.debug(`dispose "${n}": ${o.length} entries`);o.length>0;)await i(o[0]);},s=u=>{if(u!=null)return o.unshift(u),()=>i(u)};return Object.assign(a,{track:s,add:s,untrack:i,dispose:a,exec:a,getSize(){return o.length},isDisposed(){return o.length<=0}})}var Oa=pe;function _a(e={}){let{mode:t="fifo"}=e,n=[],r=async(i=!1)=>{for(;n.length>0;){let a=n[0];if(tt(n,s=>s!==a),typeof a=="function"){let s=a();if(R(s)){if(i)throw new Error(`Expected sync only function, but found async: ${a}`);await s;}}else if(R(a)){if(i)throw new Error(`Expected sync only function, but found async: ${a}`);await a;}else throw new Error(`Unhandled disposable: ${a}`)}};return Object.assign(r,{add:i=>{t==="lifo"?n.unshift(i):n.push(i);},exec:r,getSize(){return n.length}})}function $a(e,t=0){let n=setTimeout(e,t);return ()=>{n&&(clearTimeout(n),n=void 0);}}function Va(e,t){let n=setInterval(e,t);return ()=>{n&&(clearInterval(n),n=void 0);}}function ja(e,t,n,...r){return e==null?()=>{}:(e.on?e.on(t,n,...r):e.addEventListener&&e.addEventListener(t,n,...r),()=>{e.off?e.off(t,n,...r):e.removeEventListener&&e.removeEventListener(t,n,...r);})}function za(){let e=!0;return (t,n)=>{let r=!1;if(e){e=!1;try{t(),r=!0;}finally{e=!0;}}else n!==void 0&&n();return r}}function Ga(){let e=!0;return async(t,n)=>{let r=!1;if(e){e=!1;try{let o=t();R(o)&&await o,r=!0;}finally{e=!0;}}else if(n!==void 0){let o=n();R(o)&&await o;}return r}}var I=class{constructor(){this.subscribers={};this.subscribersOnAny=[];this._logEmitter=M("zeed:emitter","error");this.dispose=pe();this.call=new Proxy({},{get:(t,n)=>async(...r)=>await this.emit(n,...r)});}async emit(t,...n){let r=!1;try{let o=this.subscribers[t]||[];if(this._logEmitter.debug("emit",this?.constructor?.name,t,...n,o),this.subscribersOnAny.forEach(i=>i(t,...n)),o.length>0){let i=o.map(a=>{try{return _(a(...n))}catch(s){this._logEmitter.warn("emit warning:",s);}return null}).filter(a=>a!=null);r=!0,await Promise.all(i);}}catch(o){this._logEmitter.error("emit exception",o);}return r}onAny(t){this.subscribersOnAny.push(t);}on(t,n){let r=this.subscribers[t]||[];return r.push(n),this.subscribers[t]=r,()=>{this.off(t,n);}}onCall(t){for(let[n,r]of Object.entries(t))this.on(n,r);}once(t,n){let r=async(...o)=>(this.off(t,r),await _(n(...o)));return this.on(t,r),()=>{this.off(t,n);}}off(t,n){return this.subscribers[t]=(this.subscribers[t]||[]).filter(r=>n&&r!==n),this}removeAllListeners(){return this.subscribers={},this}};function Xa(){let e=K().emitter;return e||(e=new I,K().emitter=e),e}function Qa(e,t){let n=Math.round(P()*100),r=[],o,i=(s,u)=>{let c={key:s,obj:u};r.push(c),o&&o();};return t?e.on?e.on(t,s=>{i(t,s);}):e.addEventListener?e.addEventListener(t,s=>{i(t,s);}):e.log.error(n,"Cannot listen to key"):e.onAny?e.onAny((s,u)=>{i(s,u);}):e.log.error(n,"cannot listen to all for",e),(s,u=!0)=>new Promise((c,f)=>{s||(s=t,s||r.length&&(s=r[0].key)),o=()=>{for(;r.length>0;){let l=r.shift();if(l.key===s)o=void 0,c(l.obj);else {if(u)continue;f(new Error(`Expected ${s}, but found ${l.key} with value=${l.obj}`));}break}},o();})}var bn=()=>Date.now();function tu(e){return e>999?`${(e/1e3).toFixed(1)}s`:`${e.toFixed(2)}ms`}function nu(...e){for(let t of e){if(t instanceof Date)return t;if(typeof t=="string"){let n=null;if(t.includes(":"))try{n=new Date(t);}catch{}if(!(n instanceof Date)){let r=/(\d\d\d\d)-(\d\d)-(\d\d)/.exec(t);r&&(n=new Date(+r[1],+r[2]-1,+r[3],12,0));}if(n instanceof Date)return n}}}var Fe=16;function ft(){return oe(Fe)}function $r(e=ft()){return rt(e,22)}function Vr(e){return rt(e,22)}function jr(e){return Kt(e,Fe)}function Nr(e=ft()){return nt(e,26)}function Hr(e){return nt(e,26)}function zr(e){return Zt(e,Fe)}var Gr="10000000-1000-4000-8000-100000000000",qr=function(){return typeof crypto<"u"&&crypto.randomUUID!=null?crypto.randomUUID():Gr.replace(/[018]/g,e=>(e^oe(1)[0]&15>>e/4).toString(16))};function Jr(e){let t=Ut(e);return `${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16)}`}function Wr(e){return Dt(e.replaceAll("-",""))}var wn=16e11;function Zr(e){let t=new Uint8Array([0,0,0,0,0,0]),n=t.length-1;for(let r=0;r<t.length;r++){let o=e&255;t[n-r]=o,e=(e-o)/256;}return t}function Tn(){let e=bn()-wn;return new Uint8Array([...Zr(e),...oe(10)])}function uu(){return Yr(Tn())}function cu(e){return Kr(Ln(e))}function Kr(e){return new Date(wn+e.slice(0,6).reduce((t,n)=>t*256+n,0))}function lu(){return new Uint32Array(oe(4))[0]}var pt={base62:{uuid:$r,uuidDecode:jr,uuidEncode:Vr},base32:{uuid:Nr,uuidDecode:zr,uuidEncode:Hr},uuidv4:{uuid:qr,uuidDecode:Wr,uuidEncode:Jr}},ke="base62",An=!1;function fu(e,t=!1){ke=e,An=t;}function W(){return pt[ke].uuid(An?Tn():ft())}function Ln(e){return pt[ke].uuidDecode(e)}function Yr(e){return pt[ke].uuidEncode(e)}function pu(e){try{return Ln(e).length===Fe}catch{}return !1}var lt={};function k(e="id"){return lt[e]==null&&(lt[e]=0),`${e}-${lt[e]++}`}var Xr=0;function du(){return `id-${Xr++}`}var dt=class extends I{constructor(){super(...arguments);this.id=W();}close(){this.dispose();}},Be=class extends dt{constructor(){super(...arguments);this.isConnected=!0;}postMessage(n){this.other?.emit("message",{data:n,origin:"local",lastEventId:W()});}};function hu(){let e=new Be,t=new Be;return e.other=t,t.other=e,[e,t]}var Un=class{async encode(t){return t}async decode(t){return t}},se=class{async encode(t){return $e(t)}async decode(t){return Ve(t)}},Dn=class{constructor(t){this.key=t;}async encode(t){let n=$e(t);return await Gt(n,this.key)}async decode(t){let n=await qt(t,this.key);return Ve(n)}};var vn=(e,t,n={})=>new Proxy(n,{get:(r,o)=>o in r?r[o]:(...i)=>e(o,i,t)});function Eu(e={}){let{name:t=k("hub"),encoder:n=new se,retryAfter:r=1e3,ignoreUnhandled:o=!0,logLevel:i=!1}=e,a=M(t,i),s={},u,c=[],f,l={},m=()=>{clearTimeout(f);},g=async()=>{if(clearTimeout(f),u){if(u.isConnected)for(;c.length;){let x=c[0];try{u.postMessage(await n.encode(x)),c.shift();}catch(v){a.warn("postMessage",v);break}}c.length>0&&r>0&&(f=setTimeout(g,r));}},p=async x=>{a("enqueue postMessage",x),c.push(x),await g();},d=async x=>{u=x,u.on("connect",g),u.on("message",async v=>{a("onmessage",typeof v);let{name:S,args:B,id:h,result:y,error:T}=await n.decode(v.data);if(S){a(`name ${S} id ${h}`);try{if(s[S]==null)throw new Error(`handler for ${S} was not found`);let L=s[S](...B);R(L)&&(L=await L),a(`result ${L}`),h&&await p({id:h,result:L});}catch(L){let b=L instanceof Error?L:new Error(ot(L));a.warn("execution error",b.name),await p({id:h,error:{message:b.message,stack:b.stack,name:b.name}});}}else if(h)if(a(`response for id=${h}: result=${y}, error=${T}`),l[h]==null)y===void 0?a(`skip response for ${h}`):a.warn(`no response hook for ${h}`);else {let[L,b]=l[h];if(L&&b)if(delete l[h],T){let E=new Error(T.message);E.stack=T.stack,E.name=T.name,a.warn("reject",E.name),b(E);}else a("resolve",y),L(y);}else o||a.warn("Unhandled message",v);}),await g();},w=async(x,v,S={})=>{let{timeout:B=5e3}=S,h=W();return await p({name:x,args:v,id:h}),on(new Promise((y,T)=>l[h]=[y,T]),B)};return e.channel&&d(e.channel),{dispose:m,connect:d,listen(x){Object.assign(s,x);},send(){return vn(w,{},{options(x){return vn(w,{...x})}})}}}var gt=class extends I{constructor(n){super();this.publish=this.emit.bind(this);this.subscribe=this.on.bind(this);let{name:r,encoder:o=new se,channel:i,debug:a=!1}=n;this.channel=i,this.encoder=o,this.debug=a,this.name=r??this.channel.id??k("pubsub"),this.log=M(`${this.shortId}`),this.debug&&(this.channel.on("connect",()=>{this.log("channel connected");}),this.channel.on("disconnect",()=>{this.log("channel disconnected");})),this.channel.on("message",async({data:s})=>{let u=await this.encoder.decode(s);if(this.debug?this.log(`channel message, event=${u?.event}, info=`,u):this.log(`channel message, event=${u?.event}`),u){let{event:c,args:f}=u;await this.emitSuper(c,...f);}});}get shortId(){return this.name.substr(0,6)}async emitSuper(n,...r){return await super.emit(n,...r)}async emit(n,...r){try{if(this.debug?this.log(`emit(${String(n)})`,n):this.log(`emit(${String(n)})`,r.length),!this.channel.isConnected)return this.log.warn("channel not connected"),!1;let o=await this.encoder.encode({event:n,args:r});return this.channel.postMessage(o),!0}catch(o){this.log.warn(`emit(${String(n)})`,o);}return !1}};function Iu(e){return new gt(e)}var Qr=1;var En=e=>e,eo=En;function ku(e,t){let{post:n,on:r,eventNames:o=[],serialize:i=En,deserialize:a=eo}=t,s=new Map;return r(async u=>{let c=a(u),[f,l,m,g]=c;if(f===1||f===2){let p,d;if(g!=null)try{let w=e[g];p=await w(...l);}catch(w){d=String(w);}else d="Method implementation missing";f===1&&m&&n(i(d?[4,d,m]:[3,p,m]));}else if(m){let p=s.get(m);p!=null&&(f===4?p.reject(l):p.resolve(l)),s.delete(m);}}),new Proxy({},{get(u,c){let f=(...m)=>{n(i([2,m,null,c]));};if(t.onlyEvents||o.includes(c))return f.asEvent=f,f;let l=(...m)=>new Promise((g,p)=>{let d=Qr++;s.set(d,{resolve:g,reject:p}),n(i([1,m,d,c]));});return l.asEvent=f,l}})}var Z=class extends I{constructor(n={}){super();this._isCancelled=!1;this._resetWhenFinished=!0;this._children=[];this._totalUnits=n.totalUnits??0,this._completedUnits=n.completeUnits??0,this._resetWhenFinished=n.resetWhenFinished??!0,this.name=n.name??k("progress"),this.dispose.add(async()=>{for(let r of this._children)await r.dispose();await this.emit("progressDispose",this);});}update(){this.emit("progressChanged",this),this._isCancelled&&this._resetWhenFinished&&this.getTotalUnits()<=this.getCompletedUnits()&&this.reset();}reset(){if(this._isCancelled){this._isCancelled=!1;for(let n of this._children)n.reset();this.update();}}async cancel(){if(!this._isCancelled){this._isCancelled=!0,await this.emit("progressCancelled",this);for(let n of this._children)await n.cancel();this.update();}}addChild(n){n.on("progressDispose",()=>this.removeChild(n)),n.on("progressChanged",()=>this.update()),this._children.includes(n)||this._children.push(n),this.update();}createChildProgress(n){let r=new Z(n);return this.addChild(r),r}removeChild(n){Jt(this._children,n),this.update();}getTotalUnits(){if(this.isIndeterminate())return 0;let n=this._totalUnits;for(let r of this._children)n+=r.getTotalUnits();return n}getCompletedUnits(){if(this.isIndeterminate())return 0;let n=this._completedUnits;for(let r of this._children)n+=r.getCompletedUnits();return n}isIndeterminate(){return this._totalUnits<=0&&this._children.length<=0}isCancelled(){return this._isCancelled}isFinished(){return this.dispose.isDisposed()||!this.isIndeterminate()&&this.getTotalUnits()<=this.getCompletedUnits()}getFraction(){if(this.isIndeterminate())return 0;let n=this.getCompletedUnits()/this.getTotalUnits();return isNaN(n)&&(n=0),Math.min(1,Math.max(0,n))}getChildrenCount(){return this._children.length}setTotalUnits(n,r){this._totalUnits=n,r!=null&&(this._completedUnits=r),this.update();}incTotalUnits(n=1){this._totalUnits+=n,this.update();}setCompletetedUnits(n){this._completedUnits=n,this.update();}setCompleted(){this._completedUnits=this._totalUnits,this.update();}incCompletedUnits(n=1){this._completedUnits+=n,this.update();}toString(n=0){let r=`${" ".repeat(n)}${this.name}: ${this._completedUnits} of ${this._totalUnits} units, ${Math.floor(this.getFraction()*100)} %, cancel=${this._isCancelled}
|
|
12
|
-
`;for(let o of this._children)r+=o.toString(n+1);return n===0?r.trim():r}};function
|
|
11
|
+
`&&(r.push(o),o=[]);}return r}function Ia(e,t={}){let n=_r(e,t),r=n[0];return n.slice(1).map(o=>Object.fromEntries(o.map((i,a)=>[r[a],i])))}async function $r(e){typeof e=="function"?await _(e()):R(e)?await e:typeof e.dispose=="function"?await _(e.dispose()):R(e.dispose)?await e.dispose:typeof e.cleanup=="function"?await _(e.cleanup()):R(e.cleanup)&&await e.cleanup;}function pe(e){let t=e;t!=null&&(sn(t)?t={name:t}:"debug"in t&&"label"in t&&(t={name:t.label,log:t}));let n=t?.name,r=t?.log??M("zeed:dispose"),o=[],i=async u=>{u!=null&&o.includes(u)&&(tt(o,c=>c!==u),await $r(u));},a=async()=>{for(n&&r.debug(`dispose "${n}": ${o.length} entries`);o.length>0;)await i(o[0]);},s=u=>{if(u!=null)return o.unshift(u),()=>i(u)};return Object.assign(a,{track:s,add:s,untrack:i,dispose:a,exec:a,getSize(){return o.length},isDisposed(){return o.length<=0}})}var $a=pe;function Va(e={}){let{mode:t="fifo"}=e,n=[],r=async(i=!1)=>{for(;n.length>0;){let a=n[0];if(tt(n,s=>s!==a),typeof a=="function"){let s=a();if(R(s)){if(i)throw new Error(`Expected sync only function, but found async: ${a}`);await s;}}else if(R(a)){if(i)throw new Error(`Expected sync only function, but found async: ${a}`);await a;}else throw new Error(`Unhandled disposable: ${a}`)}};return Object.assign(r,{add:i=>{t==="lifo"?n.unshift(i):n.push(i);},exec:r,getSize(){return n.length}})}function ja(e,t=0){let n=setTimeout(e,t);return ()=>{n&&(clearTimeout(n),n=void 0);}}function Na(e,t){let n=setInterval(e,t);return ()=>{n&&(clearInterval(n),n=void 0);}}function Ha(e,t,n,...r){return e==null?()=>{}:(e.on?e.on(t,n,...r):e.addEventListener&&e.addEventListener(t,n,...r),()=>{e.off?e.off(t,n,...r):e.removeEventListener&&e.removeEventListener(t,n,...r);})}function qa(){let e=!0;return (t,n)=>{let r=!1;if(e){e=!1;try{t(),r=!0;}finally{e=!0;}}else n!==void 0&&n();return r}}function Ja(){let e=!0;return async(t,n)=>{let r=!1;if(e){e=!1;try{let o=t();R(o)&&await o,r=!0;}finally{e=!0;}}else if(n!==void 0){let o=n();R(o)&&await o;}return r}}var I=class{constructor(){this.subscribers={};this.subscribersOnAny=[];this._logEmitter=M("zeed:emitter","error");this.dispose=pe();this.call=new Proxy({},{get:(t,n)=>async(...r)=>await this.emit(n,...r)});}async emit(t,...n){let r=!1;try{let o=this.subscribers[t]||[];if(this._logEmitter.debug("emit",this?.constructor?.name,t,...n,o),this.subscribersOnAny.forEach(i=>i(t,...n)),o.length>0){let i=o.map(a=>{try{return _(a(...n))}catch(s){this._logEmitter.warn("emit warning:",s);}return null}).filter(a=>a!=null);r=!0,await Promise.all(i);}}catch(o){this._logEmitter.error("emit exception",o);}return r}onAny(t){this.subscribersOnAny.push(t);}on(t,n){let r=this.subscribers[t]||[];return r.push(n),this.subscribers[t]=r,()=>{this.off(t,n);}}onCall(t){for(let[n,r]of Object.entries(t))this.on(n,r);}once(t,n){let r=async(...o)=>(this.off(t,r),await _(n(...o)));return this.on(t,r),()=>{this.off(t,n);}}off(t,n){return this.subscribers[t]=(this.subscribers[t]||[]).filter(r=>n&&r!==n),this}removeAllListeners(){return this.subscribers={},this}};function eu(){let e=K().emitter;return e||(e=new I,K().emitter=e),e}function tu(e,t){let n=Math.round(P()*100),r=[],o,i=(s,u)=>{let c={key:s,obj:u};r.push(c),o&&o();};return t?e.on?e.on(t,s=>{i(t,s);}):e.addEventListener?e.addEventListener(t,s=>{i(t,s);}):e.log.error(n,"Cannot listen to key"):e.onAny?e.onAny((s,u)=>{i(s,u);}):e.log.error(n,"cannot listen to all for",e),(s,u=!0)=>new Promise((c,f)=>{s||(s=t,s||r.length&&(s=r[0].key)),o=()=>{for(;r.length>0;){let l=r.shift();if(l.key===s)o=void 0,c(l.obj);else {if(u)continue;f(new Error(`Expected ${s}, but found ${l.key} with value=${l.obj}`));}break}},o();})}var wn=()=>Date.now();function Vr(e){return e>999?`${(e/1e3).toFixed(1)}s`:`${e.toFixed(2)}ms`}function ru(...e){for(let t of e){if(t instanceof Date)return t;if(typeof t=="string"){let n=null;if(t.includes(":"))try{n=new Date(t);}catch{}if(!(n instanceof Date)){let r=/(\d\d\d\d)-(\d\d)-(\d\d)/.exec(t);r&&(n=new Date(+r[1],+r[2]-1,+r[3],12,0));}if(n instanceof Date)return n}}}var bn=()=>typeof performance<"u"?performance.now():Date.now();function ou(){let e=bn();return function(){let t=bn()-e;return Vr(t)}}var Fe=16;function ft(){return oe(Fe)}function jr(e=ft()){return rt(e,22)}function Nr(e){return rt(e,22)}function Hr(e){return Kt(e,Fe)}function zr(e=ft()){return nt(e,26)}function Gr(e){return nt(e,26)}function qr(e){return Zt(e,Fe)}var Jr="10000000-1000-4000-8000-100000000000",Wr=function(){return typeof crypto<"u"&&crypto.randomUUID!=null?crypto.randomUUID():Jr.replace(/[018]/g,e=>(e^oe(1)[0]&15>>e/4).toString(16))};function Zr(e){let t=Ut(e);return `${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16)}`}function Kr(e){return Dt(e.replaceAll("-",""))}var Tn=16e11;function Yr(e){let t=new Uint8Array([0,0,0,0,0,0]),n=t.length-1;for(let r=0;r<t.length;r++){let o=e&255;t[n-r]=o,e=(e-o)/256;}return t}function An(){let e=wn()-Tn;return new Uint8Array([...Yr(e),...oe(10)])}function lu(){return Qr(An())}function fu(e){return Xr(Un(e))}function Xr(e){return new Date(Tn+e.slice(0,6).reduce((t,n)=>t*256+n,0))}function pu(){return new Uint32Array(oe(4))[0]}var pt={base62:{uuid:jr,uuidDecode:Hr,uuidEncode:Nr},base32:{uuid:zr,uuidDecode:qr,uuidEncode:Gr},uuidv4:{uuid:Wr,uuidDecode:Kr,uuidEncode:Zr}},ke="base62",Ln=!1;function du(e,t=!1){ke=e,Ln=t;}function W(){return pt[ke].uuid(Ln?An():ft())}function Un(e){return pt[ke].uuidDecode(e)}function Qr(e){return pt[ke].uuidEncode(e)}function gu(e){try{return Un(e).length===Fe}catch{}return !1}var lt={};function k(e="id"){return lt[e]==null&&(lt[e]=0),`${e}-${lt[e]++}`}var eo=0;function yu(){return `id-${eo++}`}var dt=class extends I{constructor(){super(...arguments);this.id=W();}close(){this.dispose();}},Be=class extends dt{constructor(){super(...arguments);this.isConnected=!0;}postMessage(n){this.other?.emit("message",{data:n,origin:"local",lastEventId:W()});}};function bu(){let e=new Be,t=new Be;return e.other=t,t.other=e,[e,t]}var Dn=class{async encode(t){return t}async decode(t){return t}},se=class{async encode(t){return $e(t)}async decode(t){return Ve(t)}},vn=class{constructor(t){this.key=t;}async encode(t){let n=$e(t);return await Gt(n,this.key)}async decode(t){let n=await qt(t,this.key);return Ve(n)}};var En=(e,t,n={})=>new Proxy(n,{get:(r,o)=>o in r?r[o]:(...i)=>e(o,i,t)});function Su(e={}){let{name:t=k("hub"),encoder:n=new se,retryAfter:r=1e3,ignoreUnhandled:o=!0,logLevel:i=!1}=e,a=M(t,i),s={},u,c=[],f,l={},m=()=>{clearTimeout(f);},g=async()=>{if(clearTimeout(f),u){if(u.isConnected)for(;c.length;){let x=c[0];try{u.postMessage(await n.encode(x)),c.shift();}catch(v){a.warn("postMessage",v);break}}c.length>0&&r>0&&(f=setTimeout(g,r));}},p=async x=>{a("enqueue postMessage",x),c.push(x),await g();},d=async x=>{u=x,u.on("connect",g),u.on("message",async v=>{a("onmessage",typeof v);let{name:S,args:B,id:h,result:y,error:T}=await n.decode(v.data);if(S){a(`name ${S} id ${h}`);try{if(s[S]==null)throw new Error(`handler for ${S} was not found`);let L=s[S](...B);R(L)&&(L=await L),a(`result ${L}`),h&&await p({id:h,result:L});}catch(L){let b=L instanceof Error?L:new Error(ot(L));a.warn("execution error",b.name),await p({id:h,error:{message:b.message,stack:b.stack,name:b.name}});}}else if(h)if(a(`response for id=${h}: result=${y}, error=${T}`),l[h]==null)y===void 0?a(`skip response for ${h}`):a.warn(`no response hook for ${h}`);else {let[L,b]=l[h];if(L&&b)if(delete l[h],T){let E=new Error(T.message);E.stack=T.stack,E.name=T.name,a.warn("reject",E.name),b(E);}else a("resolve",y),L(y);}else o||a.warn("Unhandled message",v);}),await g();},w=async(x,v,S={})=>{let{timeout:B=5e3}=S,h=W();return await p({name:x,args:v,id:h}),on(new Promise((y,T)=>l[h]=[y,T]),B)};return e.channel&&d(e.channel),{dispose:m,connect:d,listen(x){Object.assign(s,x);},send(){return En(w,{},{options(x){return En(w,{...x})}})}}}var gt=class extends I{constructor(n){super();this.publish=this.emit.bind(this);this.subscribe=this.on.bind(this);let{name:r,encoder:o=new se,channel:i,debug:a=!1}=n;this.channel=i,this.encoder=o,this.debug=a,this.name=r??this.channel.id??k("pubsub"),this.log=M(`${this.shortId}`),this.debug&&(this.channel.on("connect",()=>{this.log("channel connected");}),this.channel.on("disconnect",()=>{this.log("channel disconnected");})),this.channel.on("message",async({data:s})=>{let u=await this.encoder.decode(s);if(this.debug?this.log(`channel message, event=${u?.event}, info=`,u):this.log(`channel message, event=${u?.event}`),u){let{event:c,args:f}=u;await this.emitSuper(c,...f);}});}get shortId(){return this.name.substr(0,6)}async emitSuper(n,...r){return await super.emit(n,...r)}async emit(n,...r){try{if(this.debug?this.log(`emit(${String(n)})`,n):this.log(`emit(${String(n)})`,r.length),!this.channel.isConnected)return this.log.warn("channel not connected"),!1;let o=await this.encoder.encode({event:n,args:r});return this.channel.postMessage(o),!0}catch(o){this.log.warn(`emit(${String(n)})`,o);}return !1}};function ku(e){return new gt(e)}var to=1;var Pn=e=>e,no=Pn;function Ou(e,t){let{post:n,on:r,eventNames:o=[],serialize:i=Pn,deserialize:a=no}=t,s=new Map;return r(async u=>{let c=a(u),[f,l,m,g]=c;if(f===1||f===2){let p,d;if(g!=null)try{let w=e[g];p=await w(...l);}catch(w){d=String(w);}else d="Method implementation missing";f===1&&m&&n(i(d?[4,d,m]:[3,p,m]));}else if(m){let p=s.get(m);p!=null&&(f===4?p.reject(l):p.resolve(l)),s.delete(m);}}),new Proxy({},{get(u,c){let f=(...m)=>{n(i([2,m,null,c]));};if(t.onlyEvents||o.includes(c))return f.asEvent=f,f;let l=(...m)=>new Promise((g,p)=>{let d=to++;s.set(d,{resolve:g,reject:p}),n(i([1,m,d,c]));});return l.asEvent=f,l}})}var Z=class extends I{constructor(n={}){super();this._isCancelled=!1;this._resetWhenFinished=!0;this._children=[];this._totalUnits=n.totalUnits??0,this._completedUnits=n.completeUnits??0,this._resetWhenFinished=n.resetWhenFinished??!0,this.name=n.name??k("progress"),this.dispose.add(async()=>{for(let r of this._children)await r.dispose();await this.emit("progressDispose",this);});}update(){this.emit("progressChanged",this),this._isCancelled&&this._resetWhenFinished&&this.getTotalUnits()<=this.getCompletedUnits()&&this.reset();}reset(){if(this._isCancelled){this._isCancelled=!1;for(let n of this._children)n.reset();this.update();}}async cancel(){if(!this._isCancelled){this._isCancelled=!0,await this.emit("progressCancelled",this);for(let n of this._children)await n.cancel();this.update();}}addChild(n){n.on("progressDispose",()=>this.removeChild(n)),n.on("progressChanged",()=>this.update()),this._children.includes(n)||this._children.push(n),this.update();}createChildProgress(n){let r=new Z(n);return this.addChild(r),r}removeChild(n){Jt(this._children,n),this.update();}getTotalUnits(){if(this.isIndeterminate())return 0;let n=this._totalUnits;for(let r of this._children)n+=r.getTotalUnits();return n}getCompletedUnits(){if(this.isIndeterminate())return 0;let n=this._completedUnits;for(let r of this._children)n+=r.getCompletedUnits();return n}isIndeterminate(){return this._totalUnits<=0&&this._children.length<=0}isCancelled(){return this._isCancelled}isFinished(){return this.dispose.isDisposed()||!this.isIndeterminate()&&this.getTotalUnits()<=this.getCompletedUnits()}getFraction(){if(this.isIndeterminate())return 0;let n=this.getCompletedUnits()/this.getTotalUnits();return isNaN(n)&&(n=0),Math.min(1,Math.max(0,n))}getChildrenCount(){return this._children.length}setTotalUnits(n,r){this._totalUnits=n,r!=null&&(this._completedUnits=r),this.update();}incTotalUnits(n=1){this._totalUnits+=n,this.update();}setCompletetedUnits(n){this._completedUnits=n,this.update();}setCompleted(){this._completedUnits=this._totalUnits,this.update();}incCompletedUnits(n=1){this._completedUnits+=n,this.update();}toString(n=0){let r=`${" ".repeat(n)}${this.name}: ${this._completedUnits} of ${this._totalUnits} units, ${Math.floor(this.getFraction()*100)} %, cancel=${this._isCancelled}
|
|
12
|
+
`;for(let o of this._children)r+=o.toString(n+1);return n===0?r.trim():r}};function Wu(e={}){let{maxParallel:t=3,name:n=k("pool"),idConflictResolution:r="memoize"}=e,o=new I,i=pe();i.add(v);let a=new Z({name:n});a.on("progressCancelled",v);let s=0,u=0,c=0,f=0,l={};async function m(){if(s>0){let[h,y]=rn();return o.once("didFinish",y),h}}async function g(){for(let h of Object.keys(l))l[h].state==="finished"&&(await l[h].progress.dispose(),delete l[h]);}function p(){o.emit("didFinish"),s=0,u=0,g(),a.reset();}function d(){let h=0,y=0;for(let{max:T,resolved:L,state:b}of Object.values(l))h+=T,y+=b==="finished"?T:Math.min(T,L);o.emit("didUpdate",s,u,h,y);}function w(){if(d(),s>0&&s===u&&p(),c>=t)return;let h=Object.values(l).filter(y=>y.state==="waiting");if(h.length>0){let y;for(let T of h)T.group!=null&&Object.values(l).some(L=>L.state==="running"&&L.id!==T.id&&L.group===T.group)||(y==null||T.priority<y.priority)&&(y=T);if(y!=null){let T=y.id,L=y.done;y.state="running",++c,o.emit("didStart",T);let b=E=>{y&&(y.result=E,y.state="finished",y.resolved=y.max,y.progress?.setCompleted()),--c,++u,w();};y.task(y).then(E=>{L(E),o.emit("didResolve",T,E),b(E);}).catch(E=>{L(),o.emit("didReject",T,E),b();});}}}function x(h){let y=l[h];y&&y.state==="waiting"&&(l[h].state="finished",++u,o.emit("didCancel",h),l[h].progress.dispose(),d());}function v(){Object.keys(l).forEach(x);}function S(h){return l[h]!=null}function B(h,y={}){let T,L=new Promise(C=>T=C),b=y.id??W();if(l[b]!=null){let C=y.idConflictResolution??r;if(C==="replace")x(b);else if(C==="memoize"||C==="prioritize"){let mt=l[b];return C==="prioritize"&&(mt.priority=++f),{id:b,promise:(async()=>{if(mt.state==="finished")return l[b].result})(),dispose:()=>x(b),cancel:()=>x(b)}}else throw new Error(`Pool task with id=${b} already exists!`)}let E=new Z({name:b,totalUnits:y.max??1,completeUnits:y.resolved??0});return a.addChild(E),l[b]={id:b,task:h,priority:++f,group:y.group,state:"waiting",max:y.max??1,resolved:y.resolved??0,done:T,payload:y.payload,progress:E,setMax(C){E.setTotalUnits(C),l[b].max=C,d();},setResolved(C){E.setCompletetedUnits(C),l[b].resolved=C,d();},incResolved(C=1){E.incCompletedUnits(C),l[b].resolved+=C,d();}},++s,w(),{id:b,promise:L,dispose:()=>x(b),cancel:()=>x(b)}}return {events:o,cancel:x,cancelAll:v,hasById:S,progress:a,enqueue:B,dispose:i,waitFinishAll:m}}var Sn=class extends I{constructor(n={}){super();this.queue=[];this.waitToFinish=[];this.countMax=0;this.countResolved=0;this.paused=!1;let{name:r=k("queue"),logLevel:o}=n;this.name=r,this.log=M(`zeed:queue:${r}`,o??X);}async performNext(){if(this.log("performNext, queue.length =",this.queue.length),this.currentTask!=null){this.log("performNext => skip while another task is running");return}if(this.paused){this.log("performNext => skip while is paused");return}for(;this.currentTask==null&&!this.paused;){let n=this.queue.shift();if(this.log(`performNext => ${n?.name}`),n==null)break;this.countResolved===0&&this.emit("didStart",this.countMax);let{name:r,task:o,resolve:i}=n;this.currentTask=o();let a;try{this.log.info(`start task ${r}`),a=await this.currentTask,this.log(`finished task ${r} with result =`,a);}catch(s){this.log.warn("Error performing task",s);}i(a),this.currentTask=void 0,this.countResolved+=1,this.emit("didUpdate",this.countMax,this.countResolved);}for(this.queue.length===0&&(this.emit("didFinish"),this.countMax=0,this.countResolved=0);this.waitToFinish.length>0;)this.waitToFinish.shift()();}async enqueue(n,r={}){let{immediate:o=!1,name:i=k(this.name)}=r;return o?(this.log.info(`immediate execution ${i}`),await n()):(this.log(`enqueue ${i}`),new Promise(a=>{this.queue.push({name:i,task:n,resolve:a}),this.countMax+=1,this.emit("didUpdate",this.countMax,this.countResolved),this.performNext();}))}async enqueueReentrant(n,r={}){return this.enqueue(n,{immediate:this.currentTask!=null,name:r.name})}async cancelAll(n=!0){this.log("cancelAll"),this.emit("didCancel");let r=this.queue.map(o=>o.resolve);this.queue=[],r.forEach(o=>o(void 0)),await this.wait();}async pause(){this.log("pause"),this.paused=!0,await this.wait();}resume(){this.log("resume"),this.paused=!1,this.performNext();}async wait(){if(this.log("wait"),!(this.currentTask==null&&(this.queue.length===0||this.paused)))return new Promise(n=>{this.waitToFinish.push(n);})}get isPaused(){return this.paused}get hasTasks(){return this.queue.length!==0}};function nc(e,t={}){let {delay:n=100,trailing:r=!0,leading:o=!0}=t,i=0,a=0,s=0,u;function f(){return i?(clearTimeout(i),i=void 0,!0):!1}function l(...m){let g=Date.now(),p=g-a,d=()=>{s=0,a=Date.now(),e.apply(this,m);};if(u=d,p>n||!i){o&&(p>n?d():++s);let w=p>n?n:n-p;f(),a=g,i=setTimeout(()=>{i=0,r&&(!o||s>0)&&u?.();},w);}else ++s;}return l.cancel=f,l.stop=()=>{f()&&u&&u();},l.immediate=async function(...g){f(),a=Date.now(),e.apply(this,g);},l.dispose=()=>l.stop(),l}function rc(e,t={}){let{delay:n=100}=t,r=0,o=!1,i;function a(){r&&(clearTimeout(r),r=0);}async function s(){try{if(a(),i!=null){let f=[...i];i=void 0,o=!0,await _(e(...f)),o=!1,i!=null&&(a(),r=setTimeout(s,n));}}catch{}}function u(...f){i=[...f],a(),o===!1&&(r=setTimeout(s,n));}async function c(...f){a(),i=[...f],await s();}return u.cancel=a,u.dispose=a,u.immediate=c,u}function ic(e=globalThis?.location?.hostname??""){return ["::ffff:127.0.0.1","localhost","127.0.0.1","","::1","::"].includes(e)||e.startsWith("192.168.")||e.startsWith("10.0.")||e.endsWith(".local")}function uc(e){let{level:t=void 0,filter:n=void 0,messages:r=[]}=e,o=Y(n),i=de(t);return a=>{i(a.level)&&o(a.name)&&r.push(a);}}var yt={cache:"no-cache",redirect:"follow",headers:{}};function ro(e){let t=/:\/\/([^@]*)@/gi.exec(e);if(t&&t[1]){let[n,r]=t[1].split(":",2);return {url:e.replace(`${t[1]}@`,""),username:n,password:r}}}async function Cn(e,t={},n=fetch){try{V(t)&&(t=Ie({},...ie(t)));let r=ro(String(e));r&&(e=r.url,t=Ie({},t,oo(r.username,r.password))),t.headers!=null&&!(t.headers instanceof Headers)&&(t.headers=new Headers(t.headers));let o=await n(String(e),t);if(o.status<400)return o;let i=M("zeed:network");try{i.warn(`Fetch of ${String(e)} returned status=${o.status}. Options:`,t),i.warn(`Response: ${await o.text()}`);}catch(a){i.error("Exception:",a);}}catch(r){M("zeed:network").error("fetchBasic",r);}}async function dc(e,t={},n=fetch){try{let r=await Cn(e,[{method:"GET",headers:{Accept:"application/json"}},t],n);if(r)return await r.json()}catch(r){M("zeed:network").error("fetchJSON error:",r);}}async function gc(e,t={},n=fetch){try{let r=await Cn(e,[yt,{method:"GET"},t],n);if(r)return await r.text()}catch(r){M("zeed:network").error("fetchHTML error:",r);}}function yc(e,t="POST"){return {method:t,...yt,headers:{"Content-Type":"application/x-www-form-urlencoded; charset=utf-8"},body:mn(e)}}function mc(e,t="POST"){return {method:t,...yt,headers:{"Content-Type":"application/json; charset=utf-8"},body:F(e)}}function oo(e,t){return {headers:{Authorization:`Basic ${vt(`${e}:${t}`)}`}}}function Mn(){if(typeof window<"u")return window}function io(){if(typeof navigator<"u")return navigator}function xc(){return Mn()??typeof WorkerGlobalScope<"u"?self:typeof global<"u"?global:Function("return this;")()}function bc(e={ios:!1,macos:!1,windows:!1,beaker:!1,electron:!1,wkwebview:!1,pwa:!1,pwaInstalled:!1,browser:!1,node:!1,worker:!1,test:!1,jest:!1,macosNative:!1,iosNative:!1,appleNative:!1,touch:!1}){let t=io(),n=Mn();return e.ios=t?.platform?.match(/(iPhone|iPod|iPad)/i)!=null,e.macos=!!t?.platform?.startsWith("Mac"),e.windows=!!t?.platform?.startsWith("Win"),e.beaker=n?.beaker!=null,e.electron=(t?.userAgent?.toLowerCase()?.indexOf(" electron/")||-1)>-1&&!e.beaker,e.wkwebview=n?.webkit?.messageHandlers!=null,e.pwa=t?.serviceWorker!=null,e.pwaInstalled=t?.standalone||n?.matchMedia?.("(display-mode: standalone)")?.matches,e.node=typeof process<"u"&&process?.release?.name==="node",e.browser=!e.electron&&!e.wkwebview&&!e.node,e.worker=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope,e.jest=typeof jest<"u"||typeof vitest<"u",e.test=e.jest,e.macosNative=e.wkwebview&&e.macos,e.iosNative=e.wkwebview&&e.ios,e.appleNative=e.wkwebview,e.touch=n&&"ontouchstart"in n||(t?.maxTouchPoints||0)>1||t?.msPointerEnabled&&n?.MSGesture||n?.DocumentTouch&&document instanceof DocumentTouch,e}function so(){return typeof window<"u"&&globalThis===window}function wc(e){so()?window.addEventListener("beforeunload",e):typeof process<"u"&&process.on("exit",()=>e);}var Rn=class{constructor(t={}){this.store={};}setItem(t,n){this.store[t]=ct(n);}getItem(t){return ct(this.store[t])}removeItem(t){delete this.store[t];}clear(){this.store={};}allKeys(){return Object.keys(this.store)}};var Uc=()=>{};
|
|
13
13
|
|
|
14
|
-
export {
|
|
14
|
+
export { ei as $, $i as $a, Lr as $b, wa as $c, Be as $d, At as A, tt as Aa, Me as Ab, Ns as Ac, Vr as Ad, bc as Ae, Lt as B, bi as Ba, rs as Bb, Hs as Bc, ru as Bd, so as Be, U as C, wi as Ca, it as Cb, qs as Cc, bn as Cd, wc as Ce, Eo as D, fr as Da, Tr as Db, Js as Dc, ou as Dd, Rn as De, Ut as E, Ti as Ea, Ar as Eb, Ws as Ec, ft as Ed, Uc as Ee, Dt as F, pr as Fa, at as Fb, Ks as Fc, jr as Fd, vt as G, Wt as Ga, nn as Gb, pn as Gc, Nr as Gd, Po as H, Ai as Ha, os as Hb, fe as Hc, Hr as Hd, Hn as I, Li as Ia, is as Ib, dn as Ic, zr as Id, So as J, Ui as Ja, Ce as Jb, Qs as Jc, Gr as Jd, Et as K, Di as Ka, ss as Kb, ea as Kc, qr as Kd, $e as L, vi as La, as as Lb, ta as Lc, Wr as Ld, Ve as M, Ei as Ma, us as Mb, na as Mc, Zr as Md, Pt as N, Pi as Na, rn as Nb, ra as Nc, Kr as Nd, jt as O, Si as Oa, ls as Ob, oa as Oc, An as Od, qo as P, Ci as Pa, fs as Pb, ia as Pc, lu as Pd, Jo as Q, gr as Qa, ps as Qb, sa as Qc, fu as Qd, Wo as R, N as Ra, ds as Rb, gn as Rc, Xr as Rd, Zo as S, nt as Sa, on as Sb, yn as Sc, pu as Sd, Ko as T, Zt as Ta, gs as Tb, ca as Tc, du as Td, rr as U, Ii as Ua, R as Ub, Mr as Uc, W as Ud, Yo as V, Fi as Va, _ as Vb, pa as Vc, Un as Vd, oe as W, ki as Wa, A as Wb, ya as Wc, Qr as Wd, Ht as X, Bi as Xa, hs as Xb, Ir as Xc, gu as Xd, Ye as Y, rt as Ya, xs as Yb, mn as Yc, k as Yd, Nt as Z, Kt as Za, bs as Zb, ma as Zc, yu as Zd, or as _, Oi as _a, ws as _b, ba as _c, dt as _d, K as a, ti as aa, yr as ab, As as ac, Ta as ad, bu as ae, Fn as b, Gt as ba, Vi as bb, Ls as bc, Aa as bd, Dn as be, Y as c, qt as ca, ji as cb, Us as cc, La as cd, se as ce, Oe as d, ir as da, zi as db, $ as dc, ct as dd, vn as de, de as e, P as ea, Gi as eb, ut as ec, Ua as ed, En as ee, ge as f, ri as fa, qi as fb, V as fc, Da as fd, Su as fe, j as g, oi as ga, mr as gb, Re as gc, va as gd, gt as ge, q as h, ii as ha, hr as hb, vs as hc, Ea as hd, ku as he, H as i, si as ia, xr as ib, sn as ic, Br as id, Ou as ie, z as j, sr as ja, ot as jb, an as jc, Sa as jd, Z as je, G as k, ai as ka, Ji as kb, Es as kc, xn as kd, Wu as ke, ye as l, ui as la, Wi as lb, Ps as lc, Ra as ld, Sn as le, X as m, ci as ma, Zi as mb, un as mc, _r as md, nc as me, ht as n, li as na, Ki as nb, Ss as nc, Ia as nd, rc as ne, xt as o, ar as oa, br as ob, Cs as oc, pe as od, ic as oe, On as p, pi as pa, Yi as pb, Ms as pc, $a as pd, uc as pe, bt as q, Qe as qa, Xi as qb, Rs as qc, Va as qd, ro as qe, M as r, di as ra, Xt as rb, Is as rc, ja as rd, Cn as re, _n as s, et as sa, st as sb, Ur as sc, Na as sd, dc as se, $n as t, ur as ta, Qt as tb, Dr as tc, Ha as td, gc as te, wt as u, cr as ua, wr as ub, Ie as uc, qa as ud, yc as ue, Lo as v, ie as va, es as vb, vr as vc, Ja as vd, mc as ve, F as w, lr as wa, en as wb, cn as wc, I as wd, oo as we, Uo as x, hi as xa, tn as xb, _s as xc, eu as xd, Mn as xe, jn as y, Jt as ya, ts as yb, Vs as yc, tu as yd, io as ye, Nn as z, xi as za, ns as zb, js as zc, wn as zd, xc as ze };
|
|
15
15
|
//# sourceMappingURL=out.js.map
|
|
16
|
-
//# sourceMappingURL=chunk-
|
|
16
|
+
//# sourceMappingURL=chunk-OYG7IFNC.js.map
|