zeed 0.9.13 → 0.9.14

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.
@@ -1,13 +1,13 @@
1
- var Ot=Object.defineProperty;var r=(e,t)=>Ot(e,"name",{value:t,configurable:!0});function $t(){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")}r($t,"_global");function Q(){let e=$t();return e._zeedGlobal==null&&(e._zeedGlobal={}),e._zeedGlobal}r(Q,"getGlobalContext");function oe(e={}){let{level:t=void 0,filter:n=void 0}=e,o=q(n),i=re(t);return s=>{if(!i(s.level)||!o(s.name))return;let u=s.name?`[${s.name}]`:"";switch(s.level){case 1:console.info(`I|* ${u}`,...s.messages);break;case 2:console.warn(`W|** ${u}`,...s.messages);break;case 3:console.error(`E|*** ${u}`,...s.messages);break;default:console.debug(`D| ${u}`,...s.messages);break}}}r(oe,"LoggerConsoleHandler");var X=(a=>(a[a.all=-1]="all",a[a.debug=0]="debug",a[a.info=1]="info",a[a.warn=2]="warn",a[a.error=3]="error",a[a.fatal=4]="fatal",a[a.off=1/0]="off",a))(X||{}),ze={"*":-1,a:-1,all:-1,d:0,dbg:0,debug:0,i:1,inf:1,info:1,w:2,warn:2,warning:2,e:3,err:3,error:3,fatal:4,off:1/0,"-":1/0};function Ne(e=""){let t=[oe()],n=r(l=>!0,"logCheckNamespace"),o=!1,i=u,s=!1;function u(l="",c){let f=ye(c??-1);function d(p,g){return f<=p?g:()=>{}}r(d,"defineForLogLevel");let h=d(0,(...p)=>{y({name:l,messages:p,level:0})});h.label=l,h.extend=function(p){return i(l?`${l}:${p}`:p)};let y=r(p=>{if(n(l))for(let g of t)g&&g(p)},"emit");return h.debug=d(0,(...p)=>{y({name:l,messages:p,level:0})}),h.info=d(1,(...p)=>{y({name:l,messages:p,level:1})}),h.warn=d(2,(...p)=>{y({name:l,messages:p,level:2})}),h.error=d(3,(...p)=>{y({name:l,messages:p,level:3})}),h.fatal=d(4,(...p)=>{throw y({name:l,messages:p,level:4}),new Error(`${p.map(String).join(" ")}`)}),h.assert=d(4,(p,...g)=>{p||h.fatal(...g)}),h}r(u,"LoggerBaseFactory");function a(l="",c){let f=i(l,c);return s&&f.debug(`+++ init of logger "${l}" on level "${X[f.level]}".`),f}return r(a,"Logger"),a.registerHandler=function(l){t.push(l)},a.setFilter=function(l){n=q(l)},a.setLock=(l=!0)=>o=l,a.setDebug=(l=!0)=>s=l,a.setHandlers=function(l=[]){i!==u&&(i=u),!o&&(t=[...l].filter(c=>typeof c=="function"))},a.level=-1,a.setLogLevel=function(l=-1){o||(a.level=l)},a.setFactory=function(l){o||(i=l)},a}r(Ne,"LoggerContext");function _t(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}r(_t,"getNamespaceFilterString");var Bt=_t(typeof process<"u"?process.env.ZEED??process.env.DEBUG:typeof localStorage<"u"?localStorage.zeed??localStorage.debug:"*");function q(e=Bt){let t,n=[],o=[];if(!e)t=r(function(i){return!1},"fn");else if(e==="*")t=r(function(i){return!0},"fn");else{let i,s=e.split(/[\s,]+/),u=s.length;for(i=0;i<u;i++){if(!s[i])continue;let a=s[i].replace(/\*/g,".*?");a[0]==="-"?n.push(new RegExp(`^${a.substr(1)}$`)):o.push(new RegExp(`^${a}$`))}t=r(function(a){if(n.length===0&&o.length===0)return!0;let l,c;for(l=0,c=n.length;l<c;l++)if(n[l].test(a))return!1;for(l=0,c=o.length;l<c;l++)if(o[l].test(a))return!0;return!1},"fn")}return t.accept=o,t.reject=n,t.filter=e,t}r(q,"useNamespaceFilter");var jt=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 ye(e){if(e===!1)return 1/0;if(typeof e=="number")return e;if(typeof e=="string"){let t=ze[e.toLocaleLowerCase().trim()];if(t!=null)return t}return-1}r(ye,"parseLogLevel");function re(e=jt){let t=ye(e);return n=>n>=t}r(re,"useLevelFilter");var H;function he(){let e=Ne();return e.setHandlers([oe()]),e}r(he,"getLoggerContext");function Ht(){if(H==null)try{let e=Q();e!=null?e?.logger==null?(H=he(),e.logger=H):H=e.logger:H=he()}catch{H=he()}return H}r(Ht,"getGlobalLogger");var D=Ht();var Ge=r((e,t)=>t instanceof Object&&!Array.isArray(t)?Object.keys(t).sort().reduce((n,o)=>(n[o]=t[o],n),{}):t,"_sortedReplacer");function wr(e,t=void 0){return JSON.stringify(e,Ge,t)}r(wr,"jsonStringifySorted");function zt(e,t){let n=[],o=[];return t==null&&(t=r(function(i,s){return n[0]===s?"[Circular ~]":`[Circular ~.${o.slice(0,n.indexOf(s)).join(".")}]`},"cycleReplacer")),function(i,s){if(n.length>0){let u=n.indexOf(this);~u?n.splice(u+1):n.push(this),~u?o.splice(u,1/0,i):o.push(i),~n.indexOf(s)&&(s=t?.call(this,i,s))}else n.push(s);s=Ge(i,s);try{return e==null?s:e.call(this,i,s)}catch{}return String(s)}}r(zt,"serializer");function C(e,t,n,o){return JSON.stringify(e,zt(t,o),n)}r(C,"jsonStringifySafe");var Lr=C;var Ve=D("zeed:bin","error");function Nt(e){let t=unescape(encodeURIComponent(e)),n=t.length,o=new Uint8Array(n);for(let i=0;i<n;i++)o[i]=t.codePointAt(i)||0;return o}r(Nt,"_encodeUtf8Polyfill");function Gt(e){let t=e.length,n="",o=0;for(;t>0;){let i=t<1e4?t:1e4,s=e.subarray(o,o+i);o+=i,n+=String.fromCodePoint.apply(null,s),t-=i}return decodeURIComponent(escape(n))}r(Gt,"_decodeUtf8Polyfill");var ie;function qe(e){if(ie==null&&(ie=Nt,typeof TextEncoder<"u")){let t=new TextEncoder;ie=r(n=>t.encode(n),"_textEncoder")}return ie(e.normalize("NFC"))}r(qe,"stringToUInt8Array");var se;function Je(e){if(se==null&&(se=Gt,typeof TextDecoder<"u")){let t=new TextDecoder("utf-8",{ignoreBOM:!0});se=r(n=>t.decode(n),"_textDecoder")}return se(e).normalize("NFC")}r(Je,"Uint8ArrayToString");function R(e){return e instanceof ArrayBuffer?new Uint8Array(e):typeof e=="string"?qe(e):e.length?new Uint8Array(e):e}r(R,"toUint8Array");function Ur(...e){let t=0,n=e.flat(1).map(s=>{let u=R(s);return t+=u.length,u}),o=new Uint8Array(t),i=0;for(let s of n)o.set(s,i),i+=s.length;return o}r(Ur,"joinToUint8Array");function We(e){if(typeof Buffer<"u")return Buffer.from(R(e)).toString("hex");let t="0123456789abcdef",n="";for(let o of[...R(e)])n+=t[o>>4]+t[o&15];return n}r(We,"toHex");function Ze(e){return Uint8Array.from(e.match(/.{1,2}/g).map(t=>parseInt(t,16)))}r(Ze,"fromHex");function Ke(e,t=!1){let n=R(e),o="";if(typeof Buffer<"u")o=Buffer.from(n).toString("base64");else{let i="";for(let s=0;s<n.byteLength;s++)i+=String.fromCharCode(n[s]);o=btoa(i)}return t?o.replaceAll("=",""):o}r(Ke,"toBase64");function Er(e){let t=R(e);if(typeof Buffer<"u")return Buffer.from(t).toString("base64url").replaceAll("=","");let n="";for(let o=0;o<t.byteLength;o++)n+=String.fromCharCode(t[o]);return btoa(n).replaceAll("+","-").replaceAll("/","_").replaceAll("=","")}r(Er,"toBase64Url");function Vt(e){if(e=e.replaceAll("-","+").replaceAll("_","/"),typeof Buffer<"u"){let o=Buffer.from(e,"base64");return new Uint8Array(o.buffer,o.byteOffset,o.byteLength)}let t=atob(e),n=new Uint8Array(t.length);for(let o=0;o<t.length;o++)n[o]=t.charCodeAt(o);return n}r(Vt,"fromBase64");function Mr(e){return Je(Vt(e))}r(Mr,"fromBase64String");function Ye(e,t){if(e.byteLength!==t.byteLength)return!1;let n=R(e),o=R(t);for(let i=0;i<n.length;i++)if(n[i]!==o[i])return!1;return!0}r(Ye,"equalBinary");function xe(e){try{return qe(C(e))}catch(t){throw Ve.warn("jsonToUint8Array",e),t}}r(xe,"jsonToUint8Array");function be(e){try{return JSON.parse(Je(e))}catch(t){throw Ve.warn("Uint8ArrayToJson",e),t}}r(be,"Uint8ArrayToJson");function Qe(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=[],o="0123456789ABCDEF";for(let i=0;i<e.length;i+=t){let s=e.slice(i,Math.min(i+t,e.length)),u=`0000${i.toString(16)}`.slice(-4),a=s.split("").map(c=>{let f=c.charCodeAt(0);return` ${o[(240&f)>>4]}${o[15&f]}`}).join("");a+=" ".repeat(t-s.length);let l=s.replace(/[\x00-\x1F\x20]/g,".");l+=" ".repeat(t-s.length),n.push(`${u} ${a} ${l}`)}return n.join(`
2
- `)}r(Qe,"Uint8ArrayToHexDump");function J(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}r(J,"randomUint8Array");var et="SHA-256",Te="AES-GCM",Xe="PBKDF2",qt=1e5;async function Fr(e,t=et){return R(await crypto.subtle.digest(t,R(e)))}r(Fr,"digest");async function kr(e,t={}){let n=R(e),o=await crypto.subtle.importKey("raw",n,Xe,!1,["deriveKey"]);return await crypto.subtle.deriveKey({name:Xe,salt:t.salt?R(t.salt):new Uint8Array(0),iterations:t.iterations??qt,hash:et},o,{name:Te,length:256},!0,["encrypt","decrypt"])}r(kr,"deriveKeyPbkdf2");var ae=new Uint8Array([1,1]);async function tt(e,t){let n=J(12),o=await crypto.subtle.encrypt({name:Te,iv:n},t,e),i=new Uint8Array(o),s=ae.length+n.length+i.length,u=new Uint8Array(s),a=0;return u.set(ae,a),a+=ae.length,u.set(n,a),a+=n.length,u.set(i,a),u}r(tt,"encrypt");async function nt(e,t){let n=e.subarray(0,2);if(!Ye(n,ae))return Promise.reject(new Error(`Unknown magic ${n}`));let o=e.subarray(2,2+12),i=e.subarray(2+12,e.length),s=await crypto.subtle.decrypt({name:Te,iv:o},t,i);return new Uint8Array(s)}r(nt,"decrypt");function Jt(){return crypto.getRandomValues(new Uint32Array(1))[0]/4294967295}r(Jt,"getSecureRandom");function E(){return typeof crypto<"u"?Jt():Math.random()}r(E,"getSecureRandomIfPossible");function $r(e=.25){return E()<e}r($r,"randomBoolean");function _r(e=100,t=0){return t+Math.floor(E()*(e-t))}r(_r,"randomInt");function Br(e=100,t=0){return t+E()*(e-t)}r(Br,"randomFloat");function jr(e,t,n){return Math.max(e,Math.min(n,t))}r(jr,"between");function Wt(e){return e.reduce((t,n)=>t+n,0)}r(Wt,"sum");function Hr(e){return Wt(e)/e.length}r(Hr,"avg");function zr(e){return!/^1?$|^(11+?)\1+$/.test("1".repeat(e))}r(zr,"isPrimeRX");function Nr(e){for(let t=2;t<e;t++)if(e%t===0)return!1;return e>1}r(Nr,"isPrime");var we=6;function Gr(e=0,t=1,n){we=((n??we)*9301+49297)%233280;let o=we/233280;return t+o*(e-t)}r(Gr,"seededRandom");function Zt(e=""){let[t="",n="asc"]=e.split(" ");return n=n.toLowerCase(),{field:t,orderby:n,asc:n!=="desc",desc:n==="desc"}}r(Zt,"parseOrderby");function Jr(e,t=!0){return`${e} ${t?"asc":"desc"}`}r(Jr,"composeOrderby");function Le(e,t,n=!0){let o=e||0,i=t||0;return o>i?n?1:-1:o<i?n?-1:1:0}r(Le,"cmp");function Wr(e,...t){if(t.length>0){let n=t.map(Zt),o=Array.from(e);return o.sort((i,s)=>{for(let{field:u,asc:a}of n){let l=Le(i[u],s[u],a);if(l!==0)return l}return 0}),o}return e}r(Wr,"sortedOrderby");function ve(e){return e.filter((t,n)=>e.indexOf(t)===n)}r(ve,"arrayUnique");function Kt(e,t){return ve(e.filter(n=>!t.includes(n)))}r(Kt,"arrayMinus");function Yt(...e){return ve(e.reduce((t=[],n)=>t.concat(n),[]))}r(Yt,"arrayUnion");function W(...e){return e.flat(1/0)}r(W,"arrayFlatten");function Qt(e,t){return ve(e).filter(n=>t.includes(n))}r(Qt,"arrayIntersection");function Xr(e,t){return Kt(Yt(e,t),Qt(e,t))}r(Xr,"arraySymmetricDifference");function rt(e,t){if(e&&Array.isArray(e)){let n;for(;(n=e.indexOf(t))!==-1;)e.splice(n,1);return e}return[]}r(rt,"arrayRemoveElement");function eo(e,t){return e.includes(t)||e.push(t),e}r(eo,"arraySetElement");function Ae(e,t){return e.splice(0,e.length,...e.filter(t)),e}r(Ae,"arrayFilterInPlace");function to(e,t){let n=e.findIndex(o=>o===t);return n>=0?e.splice(n,1):e.push(t),e}r(to,"arrayToggleInPlace");function no(e){return e.splice(0,e.length),e}r(no,"arrayEmptyInPlace");function Xt(e,t=Le){return Array.from(e).sort(t)}r(Xt,"arraySorted");function ro(e){return Xt(e,(t,n)=>t-n)}r(ro,"arraySortedNumbers");function en(e,t){return e.length===t.length&&e.every((n,o)=>n===t[o])}r(en,"arrayIsEqual");function ot(e){return e.sort(()=>E()>.5?1:-1),e}r(ot,"arrayShuffleInPlace");function oo(e){return ot(Array.from(e))}r(oo,"arrayShuffle");function io(e){for(;e.length>1;){let t=Array.from(e);if(ot(t),!en(e,t))return t}return e}r(io,"arrayShuffleForce");function so(e){return e[Math.floor(E()*e.length)]}r(so,"arrayRandomElement");function ao(...e){return W(e).reduce((t,n)=>t!=null?n>t?n:t:n,void 0)}r(ao,"arrayMax");function uo(...e){return W(e).reduce((t,n)=>t!=null?n<t?n:t:n,void 0)}r(uo,"arrayMin");function co(...e){return W(e).reduce((t,n)=>t+n,0)}r(co,"arraySum");function lo(...e){let t=W(e);return t.reduce((n,o)=>n+o,0)/t.length}r(lo,"arrayAvg");function fo(e,t){let n=[],o=0,i=e.length;for(;o<i;)n.push(e.slice(o,o+=t));return n}r(fo,"arrayBatches");function po(e=0,t){if(e<=0)return[];let n=new Array(e);for(let o=0;o<e;o++)n[o]=t instanceof Function?t(o):t;return n}r(po,"createArray");var tn=D("zeed:basex","error"),nn={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 z(e){let t=nn[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),d=f.charCodeAt(0);if(n[d]!==255)throw new TypeError(`${f} is ambiguous`);n[d]=c}let o=t.length,i=t.charAt(0),s=Math.log(o)/Math.log(256),u=Math.log(256)/Math.log(o);function a(c,f=-1){let d=R(c);if(d.byteLength===0)return"";let h=0,y=0,p=d.byteLength;for(;y!==p&&d[y]===0;)y++;let g=(p-y)*u+1>>>0,L=new Uint8Array(g);for(;y!==p;){let m=d[y],A=0;for(let T=g-1;(m!==0||A<h)&&T!==-1;T--,A++)m+=256*L[T]>>>0,L[T]=m%o>>>0,m=m/o>>>0;if(m!==0)throw tn.warn("Non-zero carry",d,f,A,g),new Error("Non-zero carry");h=A,y++}let b=g-h;for(;b!==g&&L[b]===0;)b++;let x="";for(;b<g;++b)x+=t.charAt(L[b]);return f>0?x.padStart(f,i):x}r(a,"encode");function l(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 d=0,h=0;for(;c[d]===i;)d++;let y=(c.length-d)*s+1>>>0,p=new Uint8Array(y);for(;c[d];){let L=n[c.charCodeAt(d)];if(L===255)throw new Error(`Unsupported character "${c[d]}"`);let b=0;for(let x=y-1;(L!==0||b<h)&&x!==-1;x--,b++)L+=o*p[x]>>>0,p[x]=L%256>>>0,L=L/256>>>0;if(L!==0)throw new Error("Non-zero carry");h=b,d++}let g=y-h;for(;g!==y&&p[g]===0;)g++;return f>0?new Uint8Array([...new Uint8Array(f-p.length+g),...p.slice(g)]):p.slice(g)}return r(l,"decode"),{encode:a,decode:l}}r(z,"useBase");var{encode:xo,decode:rn}=z(32);function bo(e){return rn(e.toLocaleLowerCase().replaceAll("l","1").replaceAll("s","5").replaceAll("o","0").replaceAll("i","1"))}r(bo,"decodeBase32");var{encode:To,decode:wo}=z(16),{encode:Lo,decode:vo}=z(58),{encode:Ao,decode:Po}=z(62);function Do(e,t){return Math.ceil(e*(Math.log(256)/Math.log(t)))}r(Do,"estimateSizeForBase");var Mo=r(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),"toCamelCase");function on(e){return e.charAt(0).toUpperCase()+e.toLowerCase().slice(1)}r(on,"toCapitalize");function Ro(e){return e.replace(/\w\S*/g,on)}r(Ro,"toCapitalizeWords");function So(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()}r(So,"fromCamelCase");var it=["1","true","yes","y","on"];function Io(e,t=!1){return e==null||typeof e!="string"?t:it.includes(String(e).trim().toLowerCase())}r(Io,"stringToBoolean");function Oo(e,t=0){return e==null||typeof e!="string"?t:parseInt(e.trim(),10)??t}r(Oo,"stringToInteger");function $o(e,t=0){return e==null||typeof e!="string"?t:parseFloat(e.trim())??t}r($o,"stringToFloat");function sn(e,t=!1){return e==null?t:typeof e=="boolean"?e:typeof e=="number"?e!==0:it.includes(String(e).trim().toLowerCase())}r(sn,"valueToBoolean");function an(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}r(an,"valueToInteger");function un(e,t=0){return e==null?t:typeof e=="boolean"?e?1:0:typeof e=="number"?Math.floor(e):parseFloat(String(e).trim())??t}r(un,"valueToFloat");function Pe(e,t=""){return e==null?t:String(e)??t}r(Pe,"valueToString");var _o=un,Bo=an,jo=Pe,Ho=sn;function cn(e,t={}){let{trace:n=!0,pretty:o=!0}=t;return e.map(i=>{if(i&&typeof i=="object"){if(o&&(i instanceof Uint8Array||i instanceof ArrayBuffer))return`
1
+ var $t=Object.defineProperty;var r=(e,t)=>$t(e,"name",{value:t,configurable:!0});function _t(){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")}r(_t,"_global");function Q(){let e=_t();return e._zeedGlobal==null&&(e._zeedGlobal={}),e._zeedGlobal}r(Q,"getGlobalContext");function oe(e={}){let{level:t=void 0,filter:n=void 0}=e,o=q(n),i=re(t);return s=>{if(!i(s.level)||!o(s.name))return;let u=s.name?`[${s.name}]`:"";switch(s.level){case 1:console.info(`I|* ${u}`,...s.messages);break;case 2:console.warn(`W|** ${u}`,...s.messages);break;case 3:console.error(`E|*** ${u}`,...s.messages);break;default:console.debug(`D| ${u}`,...s.messages);break}}}r(oe,"LoggerConsoleHandler");var X=(a=>(a[a.all=-1]="all",a[a.debug=0]="debug",a[a.info=1]="info",a[a.warn=2]="warn",a[a.error=3]="error",a[a.fatal=4]="fatal",a[a.off=1/0]="off",a))(X||{}),ze={"*":-1,a:-1,all:-1,d:0,dbg:0,debug:0,i:1,inf:1,info:1,w:2,warn:2,warning:2,e:3,err:3,error:3,fatal:4,off:1/0,"-":1/0};function Ne(e=""){let t=[oe()],n=r(l=>!0,"logCheckNamespace"),o=!1,i=u,s=!1;function u(l="",c){let f=ye(c??-1);function d(p,g){return f<=p?g:()=>{}}r(d,"defineForLogLevel");let h=d(0,(...p)=>{y({name:l,messages:p,level:0})});h.label=l,h.extend=function(p){return i(l?`${l}:${p}`:p)};let y=r(p=>{if(n(l))for(let g of t)g&&g(p)},"emit");return h.debug=d(0,(...p)=>{y({name:l,messages:p,level:0})}),h.info=d(1,(...p)=>{y({name:l,messages:p,level:1})}),h.warn=d(2,(...p)=>{y({name:l,messages:p,level:2})}),h.error=d(3,(...p)=>{y({name:l,messages:p,level:3})}),h.fatal=d(4,(...p)=>{throw y({name:l,messages:p,level:4}),new Error(`${p.map(String).join(" ")}`)}),h.assert=d(4,(p,...g)=>{p||h.fatal(...g)}),h}r(u,"LoggerBaseFactory");function a(l="",c){let f=i(l,c);return s&&f.debug(`+++ init of logger "${l}" on level "${X[f.level]}".`),f}return r(a,"Logger"),a.registerHandler=function(l){t.push(l)},a.setFilter=function(l){n=q(l)},a.setLock=(l=!0)=>o=l,a.setDebug=(l=!0)=>s=l,a.setHandlers=function(l=[]){i!==u&&(i=u),!o&&(t=[...l].filter(c=>typeof c=="function"))},a.level=-1,a.setLogLevel=function(l=-1){o||(a.level=l)},a.setFactory=function(l){o||(i=l)},a}r(Ne,"LoggerContext");function Bt(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}r(Bt,"getNamespaceFilterString");var jt=Bt(typeof process<"u"?process.env.ZEED??process.env.DEBUG:typeof localStorage<"u"?localStorage.zeed??localStorage.debug:"*");function q(e=jt){let t,n=[],o=[];if(!e)t=r(function(i){return!1},"fn");else if(e==="*")t=r(function(i){return!0},"fn");else{let i,s=e.split(/[\s,]+/),u=s.length;for(i=0;i<u;i++){if(!s[i])continue;let a=s[i].replace(/\*/g,".*?");a[0]==="-"?n.push(new RegExp(`^${a.substr(1)}$`)):o.push(new RegExp(`^${a}$`))}t=r(function(a){if(n.length===0&&o.length===0)return!0;let l,c;for(l=0,c=n.length;l<c;l++)if(n[l].test(a))return!1;for(l=0,c=o.length;l<c;l++)if(o[l].test(a))return!0;return!1},"fn")}return t.accept=o,t.reject=n,t.filter=e,t}r(q,"useNamespaceFilter");var Ht=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 ye(e){if(e===!1)return 1/0;if(typeof e=="number")return e;if(typeof e=="string"){let t=ze[e.toLocaleLowerCase().trim()];if(t!=null)return t}return-1}r(ye,"parseLogLevel");function re(e=Ht){let t=ye(e);return n=>n>=t}r(re,"useLevelFilter");var H;function he(){let e=Ne();return e.setHandlers([oe()]),e}r(he,"getLoggerContext");function zt(){if(H==null)try{let e=Q();e!=null?e?.logger==null?(H=he(),e.logger=H):H=e.logger:H=he()}catch{H=he()}return H}r(zt,"getGlobalLogger");var D=zt();var Ge=r((e,t)=>t instanceof Object&&!Array.isArray(t)?Object.keys(t).sort().reduce((n,o)=>(n[o]=t[o],n),{}):t,"_sortedReplacer");function Lr(e,t=void 0){return JSON.stringify(e,Ge,t)}r(Lr,"jsonStringifySorted");function Nt(e,t){let n=[],o=[];return t==null&&(t=r(function(i,s){return n[0]===s?"[Circular ~]":`[Circular ~.${o.slice(0,n.indexOf(s)).join(".")}]`},"cycleReplacer")),function(i,s){if(n.length>0){let u=n.indexOf(this);~u?n.splice(u+1):n.push(this),~u?o.splice(u,1/0,i):o.push(i),~n.indexOf(s)&&(s=t?.call(this,i,s))}else n.push(s);s=Ge(i,s);try{return e==null?s:e.call(this,i,s)}catch{}return String(s)}}r(Nt,"serializer");function C(e,t,n,o){return JSON.stringify(e,Nt(t,o),n)}r(C,"jsonStringifySafe");var vr=C;var Ve=D("zeed:bin","error");function Gt(e){let t=unescape(encodeURIComponent(e)),n=t.length,o=new Uint8Array(n);for(let i=0;i<n;i++)o[i]=t.codePointAt(i)||0;return o}r(Gt,"_encodeUtf8Polyfill");function Vt(e){let t=e.length,n="",o=0;for(;t>0;){let i=t<1e4?t:1e4,s=e.subarray(o,o+i);o+=i,n+=String.fromCodePoint.apply(null,s),t-=i}return decodeURIComponent(escape(n))}r(Vt,"_decodeUtf8Polyfill");var ie;function qe(e){if(ie==null&&(ie=Gt,typeof TextEncoder<"u")){let t=new TextEncoder;ie=r(n=>t.encode(n),"_textEncoder")}return ie(e.normalize("NFC"))}r(qe,"stringToUInt8Array");var se;function Je(e){if(se==null&&(se=Vt,typeof TextDecoder<"u")){let t=new TextDecoder("utf-8",{ignoreBOM:!0});se=r(n=>t.decode(n),"_textDecoder")}return se(e).normalize("NFC")}r(Je,"Uint8ArrayToString");function R(e){return e instanceof ArrayBuffer?new Uint8Array(e):typeof e=="string"?qe(e):e.length?new Uint8Array(e):e}r(R,"toUint8Array");function Er(...e){let t=0,n=e.flat(1).map(s=>{let u=R(s);return t+=u.length,u}),o=new Uint8Array(t),i=0;for(let s of n)o.set(s,i),i+=s.length;return o}r(Er,"joinToUint8Array");function We(e){if(typeof Buffer<"u")return Buffer.from(R(e)).toString("hex");let t="0123456789abcdef",n="";for(let o of[...R(e)])n+=t[o>>4]+t[o&15];return n}r(We,"toHex");function Ze(e){return Uint8Array.from(e.match(/.{1,2}/g).map(t=>parseInt(t,16)))}r(Ze,"fromHex");function Ke(e,t=!1){let n=R(e),o="";if(typeof Buffer<"u")o=Buffer.from(n).toString("base64");else{let i="";for(let s=0;s<n.byteLength;s++)i+=String.fromCharCode(n[s]);o=btoa(i)}return t?o.replaceAll("=",""):o}r(Ke,"toBase64");function Mr(e){let t=R(e);if(typeof Buffer<"u")return Buffer.from(t).toString("base64url").replaceAll("=","");let n="";for(let o=0;o<t.byteLength;o++)n+=String.fromCharCode(t[o]);return btoa(n).replaceAll("+","-").replaceAll("/","_").replaceAll("=","")}r(Mr,"toBase64Url");function qt(e){if(e=e.replaceAll("-","+").replaceAll("_","/"),typeof Buffer<"u"){let o=Buffer.from(e,"base64");return new Uint8Array(o.buffer,o.byteOffset,o.byteLength)}let t=atob(e),n=new Uint8Array(t.length);for(let o=0;o<t.length;o++)n[o]=t.charCodeAt(o);return n}r(qt,"fromBase64");function Rr(e){return Je(qt(e))}r(Rr,"fromBase64String");function Ye(e,t){if(e.byteLength!==t.byteLength)return!1;let n=R(e),o=R(t);for(let i=0;i<n.length;i++)if(n[i]!==o[i])return!1;return!0}r(Ye,"equalBinary");function xe(e){try{return qe(C(e))}catch(t){throw Ve.warn("jsonToUint8Array",e),t}}r(xe,"jsonToUint8Array");function be(e){try{return JSON.parse(Je(e))}catch(t){throw Ve.warn("Uint8ArrayToJson",e),t}}r(be,"Uint8ArrayToJson");function Qe(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=[],o="0123456789ABCDEF";for(let i=0;i<e.length;i+=t){let s=e.slice(i,Math.min(i+t,e.length)),u=`0000${i.toString(16)}`.slice(-4),a=s.split("").map(c=>{let f=c.charCodeAt(0);return` ${o[(240&f)>>4]}${o[15&f]}`}).join("");a+=" ".repeat(t-s.length);let l=s.replace(/[\x00-\x1F\x20]/g,".");l+=" ".repeat(t-s.length),n.push(`${u} ${a} ${l}`)}return n.join(`
2
+ `)}r(Qe,"Uint8ArrayToHexDump");function J(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}r(J,"randomUint8Array");var et="SHA-256",Te="AES-GCM",Xe="PBKDF2",Jt=1e5;async function kr(e,t=et){return R(await crypto.subtle.digest(t,R(e)))}r(kr,"digest");async function Ir(e,t={}){let n=R(e),o=await crypto.subtle.importKey("raw",n,Xe,!1,["deriveKey"]);return await crypto.subtle.deriveKey({name:Xe,salt:t.salt?R(t.salt):new Uint8Array(0),iterations:t.iterations??Jt,hash:et},o,{name:Te,length:256},!0,["encrypt","decrypt"])}r(Ir,"deriveKeyPbkdf2");var ae=new Uint8Array([1,1]);async function tt(e,t){let n=J(12),o=await crypto.subtle.encrypt({name:Te,iv:n},t,e),i=new Uint8Array(o),s=ae.length+n.length+i.length,u=new Uint8Array(s),a=0;return u.set(ae,a),a+=ae.length,u.set(n,a),a+=n.length,u.set(i,a),u}r(tt,"encrypt");async function nt(e,t){let n=e.subarray(0,2);if(!Ye(n,ae))return Promise.reject(new Error(`Unknown magic ${n}`));let o=e.subarray(2,2+12),i=e.subarray(2+12,e.length),s=await crypto.subtle.decrypt({name:Te,iv:o},t,i);return new Uint8Array(s)}r(nt,"decrypt");function Wt(){return crypto.getRandomValues(new Uint32Array(1))[0]/4294967295}r(Wt,"getSecureRandom");function E(){return typeof crypto<"u"?Wt():Math.random()}r(E,"getSecureRandomIfPossible");function _r(e=.25){return E()<e}r(_r,"randomBoolean");function Br(e=100,t=0){return t+Math.floor(E()*(e-t))}r(Br,"randomInt");function jr(e=100,t=0){return t+E()*(e-t)}r(jr,"randomFloat");function Hr(e,t,n){return Math.max(e,Math.min(n,t))}r(Hr,"between");function Zt(e){return e.reduce((t,n)=>t+n,0)}r(Zt,"sum");function zr(e){return Zt(e)/e.length}r(zr,"avg");function Nr(e){return!/^1?$|^(11+?)\1+$/.test("1".repeat(e))}r(Nr,"isPrimeRX");function Gr(e){for(let t=2;t<e;t++)if(e%t===0)return!1;return e>1}r(Gr,"isPrime");var we=6;function Vr(e=0,t=1,n){we=((n??we)*9301+49297)%233280;let o=we/233280;return t+o*(e-t)}r(Vr,"seededRandom");function Kt(e=""){let[t="",n="asc"]=e.split(" ");return n=n.toLowerCase(),{field:t,orderby:n,asc:n!=="desc",desc:n==="desc"}}r(Kt,"parseOrderby");function Wr(e,t=!0){return`${e} ${t?"asc":"desc"}`}r(Wr,"composeOrderby");function Le(e,t,n=!0){let o=e||0,i=t||0;return o>i?n?1:-1:o<i?n?-1:1:0}r(Le,"cmp");function Zr(e,...t){if(t.length>0){let n=t.map(Kt),o=Array.from(e);return o.sort((i,s)=>{for(let{field:u,asc:a}of n){let l=Le(i[u],s[u],a);if(l!==0)return l}return 0}),o}return e}r(Zr,"sortedOrderby");function ve(e){return e.filter((t,n)=>e.indexOf(t)===n)}r(ve,"arrayUnique");function Yt(e,t){return ve(e.filter(n=>!t.includes(n)))}r(Yt,"arrayMinus");function Qt(...e){return ve(e.reduce((t=[],n)=>t.concat(n),[]))}r(Qt,"arrayUnion");function W(...e){return e.flat(1/0)}r(W,"arrayFlatten");function Xt(e,t){return ve(e).filter(n=>t.includes(n))}r(Xt,"arrayIntersection");function eo(e,t){return Yt(Qt(e,t),Xt(e,t))}r(eo,"arraySymmetricDifference");function rt(e,t){if(e&&Array.isArray(e)){let n;for(;(n=e.indexOf(t))!==-1;)e.splice(n,1);return e}return[]}r(rt,"arrayRemoveElement");function to(e,t){return e.includes(t)||e.push(t),e}r(to,"arraySetElement");function Ae(e,t){return e.splice(0,e.length,...e.filter(t)),e}r(Ae,"arrayFilterInPlace");function no(e,t){let n=e.findIndex(o=>o===t);return n>=0?e.splice(n,1):e.push(t),e}r(no,"arrayToggleInPlace");function ro(e){return e.splice(0,e.length),e}r(ro,"arrayEmptyInPlace");function en(e,t=Le){return Array.from(e).sort(t)}r(en,"arraySorted");function oo(e){return en(e,(t,n)=>t-n)}r(oo,"arraySortedNumbers");function tn(e,t){return e.length===t.length&&e.every((n,o)=>n===t[o])}r(tn,"arrayIsEqual");function ot(e){return e.sort(()=>E()>.5?1:-1),e}r(ot,"arrayShuffleInPlace");function io(e){return ot(Array.from(e))}r(io,"arrayShuffle");function so(e){for(;e.length>1;){let t=Array.from(e);if(ot(t),!tn(e,t))return t}return e}r(so,"arrayShuffleForce");function ao(e){return e[Math.floor(E()*e.length)]}r(ao,"arrayRandomElement");function uo(...e){return W(e).reduce((t,n)=>t!=null?n>t?n:t:n,void 0)}r(uo,"arrayMax");function co(...e){return W(e).reduce((t,n)=>t!=null?n<t?n:t:n,void 0)}r(co,"arrayMin");function lo(...e){return W(e).reduce((t,n)=>t+n,0)}r(lo,"arraySum");function fo(...e){let t=W(e);return t.reduce((n,o)=>n+o,0)/t.length}r(fo,"arrayAvg");function po(e,t){let n=[],o=0,i=e.length;for(;o<i;)n.push(e.slice(o,o+=t));return n}r(po,"arrayBatches");function go(e=0,t){if(e<=0)return[];let n=new Array(e);for(let o=0;o<e;o++)n[o]=t instanceof Function?t(o):t;return n}r(go,"createArray");var nn=D("zeed:basex","error"),rn={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 z(e){let t=rn[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),d=f.charCodeAt(0);if(n[d]!==255)throw new TypeError(`${f} is ambiguous`);n[d]=c}let o=t.length,i=t.charAt(0),s=Math.log(o)/Math.log(256),u=Math.log(256)/Math.log(o);function a(c,f=-1){let d=R(c);if(d.byteLength===0)return"";let h=0,y=0,p=d.byteLength;for(;y!==p&&d[y]===0;)y++;let g=(p-y)*u+1>>>0,L=new Uint8Array(g);for(;y!==p;){let m=d[y],A=0;for(let T=g-1;(m!==0||A<h)&&T!==-1;T--,A++)m+=256*L[T]>>>0,L[T]=m%o>>>0,m=m/o>>>0;if(m!==0)throw nn.warn("Non-zero carry",d,f,A,g),new Error("Non-zero carry");h=A,y++}let b=g-h;for(;b!==g&&L[b]===0;)b++;let x="";for(;b<g;++b)x+=t.charAt(L[b]);return f>0?x.padStart(f,i):x}r(a,"encode");function l(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 d=0,h=0;for(;c[d]===i;)d++;let y=(c.length-d)*s+1>>>0,p=new Uint8Array(y);for(;c[d];){let L=n[c.charCodeAt(d)];if(L===255)throw new Error(`Unsupported character "${c[d]}"`);let b=0;for(let x=y-1;(L!==0||b<h)&&x!==-1;x--,b++)L+=o*p[x]>>>0,p[x]=L%256>>>0,L=L/256>>>0;if(L!==0)throw new Error("Non-zero carry");h=b,d++}let g=y-h;for(;g!==y&&p[g]===0;)g++;return f>0?new Uint8Array([...new Uint8Array(f-p.length+g),...p.slice(g)]):p.slice(g)}return r(l,"decode"),{encode:a,decode:l}}r(z,"useBase");var{encode:bo,decode:on}=z(32);function To(e){return on(e.toLocaleLowerCase().replaceAll("l","1").replaceAll("s","5").replaceAll("o","0").replaceAll("i","1"))}r(To,"decodeBase32");var{encode:wo,decode:Lo}=z(16),{encode:vo,decode:Ao}=z(58),{encode:Po,decode:Do}=z(62);function Uo(e,t){return Math.ceil(e*(Math.log(256)/Math.log(t)))}r(Uo,"estimateSizeForBase");var Ro=r(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),"toCamelCase");function sn(e){return e.charAt(0).toUpperCase()+e.toLowerCase().slice(1)}r(sn,"toCapitalize");function So(e){return e.replace(/\w\S*/g,sn)}r(So,"toCapitalizeWords");function Co(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()}r(Co,"fromCamelCase");var it=["1","true","yes","y","on"];function Oo(e,t=!1){return e==null||typeof e!="string"?t:it.includes(String(e).trim().toLowerCase())}r(Oo,"stringToBoolean");function $o(e,t=0){return e==null||typeof e!="string"?t:parseInt(e.trim(),10)??t}r($o,"stringToInteger");function _o(e,t=0){return e==null||typeof e!="string"?t:parseFloat(e.trim())??t}r(_o,"stringToFloat");function an(e,t=!1){return e==null?t:typeof e=="boolean"?e:typeof e=="number"?e!==0:it.includes(String(e).trim().toLowerCase())}r(an,"valueToBoolean");function un(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}r(un,"valueToInteger");function cn(e,t=0){return e==null?t:typeof e=="boolean"?e?1:0:typeof e=="number"?Math.floor(e):parseFloat(String(e).trim())??t}r(cn,"valueToFloat");function Pe(e,t=""){return e==null?t:String(e)??t}r(Pe,"valueToString");var Bo=cn,jo=un,Ho=Pe,zo=an;function ln(e,t={}){let{trace:n=!0,pretty:o=!0}=t;return e.map(i=>{if(i&&typeof i=="object"){if(o&&(i instanceof Uint8Array||i instanceof ArrayBuffer))return`
3
3
  ${Qe(i)}
4
4
  `;if(i instanceof Error)return n?`${i.name||"Error"}: ${i.message}
5
- ${i.stack}`:`${i.name||"Error"}: ${i.message}`;try{return o?JSON.stringify(i,null,2):JSON.stringify(i)}catch{}}return String(i)})}r(cn,"formatMessages");function zo(e,t={}){return cn(e,t).join(" ")}r(zo,"renderMessages");function No(e){try{return decodeURIComponent(escape(e))}catch{}return e}r(No,"fixBrokenUth8String");var Ue=864e5;function Ee(e){return Math.floor(e/1e4)}r(Ee,"dayYear");function st(e){return Math.floor(e/100%100)}r(st,"dayMonth");function ln(e){return Math.floor(e%100)}r(ln,"dayDay");function qo(e){return[Ee(e),st(e),ln(e)]}r(qo,"dayToParts");function at(e,t=!1){return t?new Date(`${dn(e)}T00:00:00.000Z`):new Date(e/1e4,e/100%100-1,e%100)}r(at,"dayToDate");function ut(){return ce(new Date)}r(ut,"dayFromToday");function Jo(e,t=!1){if(typeof e=="number")return e<100?void 0:e;if(typeof e=="string")return ct(e);if(Array.isArray(e)&&e.length===3){let[n,o,i]=e;return Me(n,o,i)}else if(e instanceof Date)return ce(e,t)}r(Jo,"dayFromAny");function Wo(e){return at(e,!0)}r(Wo,"dayToDateGMT");function ce(e,t=!1){return t?ct(e.toISOString()):e.getFullYear()*1e4+(e.getMonth()+1)*100+e.getDate()}r(ce,"dayFromDate");function Zo(e){return ce(e,!0)}r(Zo,"dayFromDateGMT");function De(e,t=!0){return at(e,t).getTime()}r(De,"dayToTimestamp");function fn(e,t=!0){return ce(new Date(e),t)}r(fn,"dayFromTimestamp");function dn(e,t="-"){let n=String(e);return n.slice(0,4)+t+n.slice(4,6)+t+n.slice(6,8)}r(dn,"dayToString");function Me(e,t=1,n=1){if(!(t<1||t>12||n<1||n>31))return e*1e4+t*100+n}r(Me,"dayFromParts");function ct(e){let t=String(e).replace(/[^0-9]/g,"").slice(0,8);if(t.length===8)return+t}r(ct,"dayFromString");function Ko(e,t=0){let n=Ee(e),o=st(e);return t!==0&&(o+=t,n+=Math.floor((o-1)/12),o=Math.floor((o-1)%12)+1,o===0&&(o=12)),Me(n,o,1)}r(Ko,"dayMonthStart");function Yo(e,t=0){let n=Ee(e);return Me(n+t,1,1)}r(Yo,"dayYearStart");function ue(e,t){return fn(De(e)+t*864e5)}r(ue,"dayOffset");function Qo(e,t){return Math.round((De(t)-De(e))/864e5)}r(Qo,"dayDiff");function Xo(e,t){let n=[];for(t==null&&(t=ut()),e<0&&(e=ue(t,e+1));e<=t;)n.push(e),e=ue(e,1);return n}r(Xo,"dayRange");function*ei(e,t){let n=[];for(t==null&&(t=ut()),e<0&&(e=ue(t,e+1));e<=t;)yield e,e=ue(e,1);return n}r(ei,"dayIterator");var lt=D("zeed:promise","error");function ft(){let e,t;return[new Promise((o,i)=>{e=o,t=i}),e,t]}r(ft,"createPromise");async function oi(e){return new Promise(t=>setTimeout(t,e))}r(oi,"sleep");async function ii(){return new Promise(e=>setTimeout(e,0))}r(ii,"immediate");var dt=Symbol("timeout");async function si(e,t,n=dt){return new Promise(async(o,i)=>{let s=!1,u=setTimeout(()=>{s=!0,o(n)},t);try{let a=await e;clearTimeout(u),s||o(a)}catch(a){clearTimeout(u),s||i(a)}})}r(si,"timeout");var pt=new Error("Timeout reached");function ai(e){return e===dt||e===pt}r(ai,"isTimeout");async function gt(e,t){return t<=0?await e:new Promise(async(n,o)=>{let i=!1,s=setTimeout(()=>{i=!0,o(pt)},t);try{let u=await e;clearTimeout(s),i||n(u)}catch(u){clearTimeout(s),i||o(u)}})}r(gt,"tryTimeout");function ui(e,t,n=1e3){return new Promise((o,i)=>{let s=r(l=>{a&&(clearTimeout(a),u(),o(l))},"fn"),u=r(()=>{a=null,e.off?e.off(t,s):e.removeEventListener?e.removeEventListener(t,s):lt.warn("No remove listener method found for",e,t)},"done"),a=setTimeout(()=>{u(),i(new Error("Did not response in time"))},n);e.on?e.on(t,s):e.addEventListener?e.addEventListener(t,s):lt.warn("No listener method found for",e)})}r(ui,"waitOn");function S(e){return Boolean(e&&(e instanceof Promise||typeof e.then=="function"))}r(S,"isPromise");function O(e){return Promise.resolve(e)}r(O,"promisify");var P=class{get value(){return this.days}constructor(t){if(typeof t=="number"){this.days=t;return}if(t!=null&&(t=P.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 P(t)}static fromString(t){return P.from(+t.replace(/[^0-9]/g,"").slice(0,8))}static fromDate(t,n=!1){return n?P.fromString(t.toISOString().substr(0,10)):P.from(t.getFullYear()*1e4+(t.getMonth()+1)*100+t.getDate())}static fromDateGMT(t){return P.fromDate(t,!0)}static from(t,n=!1){if(typeof t=="number")return t<100?void 0:new P(t);if(typeof t=="string")return P.fromString(t);if(Array.isArray(t)&&t.length===3){let[o,i=1,s=1]=t;return i<1||i>12||s<1||s>31?void 0:new P(o*1e4+i*100+s)}else{if(t instanceof Date)return P.fromDate(t,n);if(t instanceof P)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 P.fromDateGMT(new Date(this.toDateGMT().getTime()+t*864e5))}monthStart(){return P.from([this.year,this.month,1])}yearStart(){return P.from([this.year,1,1])}monthOffset(t){let n=this.month+t,o=Math.floor((n-1)%12)+1;o===0&&(o=12);let i=Math.floor((n-1)/12);return P.from([this.year+i,o,this.day])}daysUntil(t){return Math.round((new P(t)?.toDateGMT().getTime()-this.toDateGMT().getTime())/864e5)}yesterday(){return this.dayOffset(-1)}tomorrow(){return this.dayOffset(1)}};r(P,"Day");async function pi(e,t,n){let o=P.from(e),i=P.from(t);for(;o&&i&&o?.days<=i?.days;){let s=n(o);S(s)&&await s,o=o.dayOffset(1)}}r(pi,"forEachDay");function gi(){return new P}r(gi,"today");function mi(e){return new P(e)}r(mi,"day");function yi(e){return P.fromDate(new Date(e)).days}r(yi,"dateStringToDays");function pn(e,t=2){return+(+e).toFixed(t)}r(pn,"decimal");function bi(e,t=2){return+(+e/10**t).toFixed(t)}r(bi,"decimalFromCents");function Ti(e,t=2){return Math.round(+e*10**t)}r(Ti,"decimalToCents");function wi(e,t=2){return t*(pn(e,t)%1)}r(wi,"decimalCentsPart");function $(e){return e!=null&&typeof e=="object"}r($,"isObject");function Re(e){return Object(e)!==e}r(Re,"isPrimitive");function _(e){return Array.isArray(e)}r(_,"isArray");function le(e){return $(e)&&!_(e)}r(le,"isRecord");function Ai(e){return e?.constructor===Object}r(Ai,"isRecordPlain");function Pi(e){return typeof e=="string"}r(Pi,"isString");function Di(e){return typeof e=="number"}r(Di,"isNumber");function Ui(e){return typeof e=="number"&&Number.isInteger(e)}r(Ui,"isInteger");function Ei(e){return typeof e=="number"&&Number.isSafeInteger(e)}r(Ei,"isSafeInteger");function mt(e){return typeof e=="boolean"}r(mt,"isBoolean");function Mi(e){return e==null}r(Mi,"isNullOrUndefined");function Ri(e){return e==null}r(Ri,"isNull");function Si(e){return $(e)&&e.constructor.name==="Uint8Array"}r(Si,"isUint8Array");function Ci(e){return e!=null}r(Ci,"isNotNull");function Fi(e){return e!=null&&e!==!1&&e!==!0}r(Fi,"isValue");function gn(e,t,n=new WeakSet){if(e===t)return!0;if(n.has(t)||(Re(t)||n.add(t),!(e instanceof Object)||!(t instanceof Object))||e.constructor!==t.constructor||e.length!==t.length)return!1;for(let o in e){if(!e.hasOwnProperty(o))continue;if(!t.hasOwnProperty(o))return!1;let i=e[o],s=t[o];if(!gn(i,s,n))return!1}for(let o in t)if(t.hasOwnProperty(o)&&!e.hasOwnProperty(o))return!1;return!0}r(gn,"deepEqual");function mn(e,t=new WeakSet){if(t.has(e))return"[Circular ~]";if(Re(e)||t.add(e),le(e)){for(let n in e)if(e.hasOwnProperty(n)){if(e[n]===void 0){delete e[n];continue}mn(e[n],t)}}else if(_(e))for(let n=e.length-1;n>=0;n--)e[n]===void 0&&e.splice(n,1);return e}r(mn,"deepStripUndefinedInPlace");function fe(e,...t){for(let n of t)$(e)||(e={}),!(n==null||!$(n))&&Object.keys(n).forEach(o=>{let i=e[o],s=n[o];Array.isArray(i)&&Array.isArray(s)?e[o]=i.concat(s):$(i)&&$(s)?e[o]=fe(Object.assign({},i),s):e[o]=s});return e}r(fe,"deepMerge");var yt=r(e=>e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/'/g,"&apos;").replace(/"/g,"&quot;"),"escapeHTML"),Bi=r(e=>e.replace(/&lt;/gi,"<").replace(/&gt;/gi,">").replace(/&quot;/gi,'"').replace(/&apos;/gi,"'").replace(/&amp;/gi,"&"),"unescapeHTML");function zi(e,t,n=[]){return e.filter(o=>!t.some(i=>!i(o))).map(o=>{for(let i of n)o=i(o);return o}).filter(o=>o!=null)}r(zi,"listQuery");function Ni(e,t){return e.reduce((n,o)=>{let i=String(o[t]);return(n[i]=n[i]||[]).push(o),n},{})}r(Ni,"listGroupBy");function Gi(e,t){return Array.from(e.reduce((n,o)=>n.add(o[t]),new Set))}r(Gi,"listDistinctUnion");function Vi(e,t){return e.map(n=>n[t])}r(Vi,"listOfKey");function Zi(e,t){return $(e)?Object.fromEntries(Object.entries(e).map(([n,o])=>{let i=t(n,o);return _(i)&&i.length===2?i:[n,i]}).filter(n=>n!=null)):{}}r(Zi,"objectMap");function Ki(e,t){return t.dispose&&e.dispose&&t.dispose.add(e.dispose),Object.assign(e,t)}r(Ki,"objectMergeDisposable");function Yi(e){return Object.keys(e).length<=0}r(Yi,"objectIsEmpty");var ht=/[\u0000-\u001F\u0080-\u009F]/g,yn=/^\.+/,hn=/\.+$/;function xt(){return/[<>:"/\\|?*\u0000-\u001F]/g}r(xt,"filenameReservedRegex");function xn(){return/^(con|prn|aux|nul|com\d|lpt\d)$/i}r(xn,"windowsReservedNameRegex");function es(e,t="_"){if(typeof e!="string")throw new TypeError("Expected a string");if(xt().test(t)&&ht.test(t))throw new Error("Replacement string cannot contain reserved filename characters");return e=e.replace(xt(),t).replace(ht,t).replace(yn,t).replace(hn,""),e=xn().test(e)?e+t:e,e.slice(0,100)}r(es,"toValidFilename");var bn=/[\\\-\[\]\/{}()*+?.^$|]/g;function bt(e){return e?e instanceof RegExp?e.source:e.replace(bn,"\\$&"):""}r(bt,"escapeRegExp");var ee=r(e=>Math.abs(e)%1===.5,"isHalf"),Tt=r(e=>e%2===0,"isEven"),is=r(e=>Math.ceil(e),"roundUp"),ss=r(e=>Math.floor(e),"roundDown"),as=r(e=>Math.round(e),"roundHalfUp"),us=r(e=>{let t=Math.round(e);return ee(e)&&Tt(t)?t-1:t},"roundHalfOdd"),cs=r(e=>ee(e)?Math.sign(e)*Math.ceil(Math.abs(e)):Math.round(e),"roundHalfAwayFromZero"),ls=r(e=>ee(e)?Math.floor(e):Math.round(e),"roundHalfDown"),fs=r(e=>{let t=Math.round(e);return ee(e)?Tt(t)?t:t-1:t},"roundHalfEven"),ds=r(e=>ee(e)?Math.sign(e)*Math.floor(Math.abs(e)):Math.round(e),"roundHalfTowardsZero");function wt(e){return e.reduce((t,n)=>Math.min(t,n.sort_weight||0),0)-1-E()}r(wt,"startSortWeight");function Lt(e){return e.reduce((t,n)=>Math.max(t,n.sort_weight||0),0)+1+E()}r(Lt,"endSortWeight");function ys(e,t,n){let o=n.length,i=e<t;if(o<=0||e>=o-1)return Lt(n);if(e<=0)return wt(n);n=Tn([...n]);let s=i?-1:0,u=n[e+s].sort_weight||0,l=(n[e+s+1].sort_weight||0)-u;if(l===0)return i?wt(n):Lt(n);let c=u+l/2,f=l*.01*(E()-.5);return c+f}r(ys,"moveSortWeight");function Tn(e){return e.sort((t,n)=>(t.sort_weight||0)-(n.sort_weight||0)),e}r(Tn,"sortedItems");function Ts(e={}){let{getter:t=r(a=>a.sort,"getter")}=e;function n(a){return a.sort((l,c)=>(t(l)||0)-(t(c)||0)),a}r(n,"items");function o(a){return a.reduce((l,c)=>Math.min(l,t(c)||0),0)-1-E()}r(o,"start");function i(a){return a.reduce((l,c)=>Math.max(l,t(c)||0),0)+1+E()}r(i,"end");function s(a,l){a==null&&(a=(l??0)-1),l==null&&(l=(a??0)+1);let c=l-a,f=a+c/2,d=c*.01*(E()-.5);return f+d}r(s,"between");function u(a,l,c){let f=c.length,d=a<l;if(f<=0||a>=f-1)return i(c);if(a<=0)return o(c);c=n([...c]);let h=d?-1:0,y=t(c[a+h])||0,g=(t(c[a+h+1])||0)-y;if(g===0)return d?o(c):i(c);let L=y+g/2,b=g*.01*(E()-.5);return L+b}return r(u,"move"),{start:o,end:i,between:s,move:u,items:n}}r(Ts,"useSorted");var wn=/((?:(?:(?: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 As(e){return e.split(wn).map((t,n)=>{let o=yt(t);return n%2?`<a target="_blank" href="${o}">${Ln(o)}</a>`:o}).join("")}r(As,"linkifyPlainText");function Ln(e){return e.replace(/^https?:\/\/(www\.)?/,"").replace(/\/$/,"")}r(Ln,"toHumanReadableUrl");function vt(e){let t=[];for(let[n,o]of Object.entries(e))if(o!=null){Array.isArray(o)||(o=[o]);for(let i of o)i!=null&&t.push(`${encodeURIComponent(n)}=${encodeURIComponent(String(i))}`)}return t.join("&")}r(vt,"encodeQuery");function Ps(e){let t={},n=(e[0]==="?"?e.substr(1):e).split("&");for(let o=0;o<n.length;o++){let i=n[o].split("="),s=decodeURIComponent(i[0]),u=decodeURIComponent(i[1]||"");t[s]!=null?(Array.isArray(t[s])||(t[s]=[t[s]]),t[s].push(u)):t[s]=u}return t}r(Ps,"parseQuery");function Ms(e,t,n){let o=e[t];return o===void 0&&(o=n(t,e),e[t]=o),o}r(Ms,"ensureKey");async function Rs(e,t,n){let o=e[t];return o===void 0&&(o=await n(t,e),e[t]=o),o}r(Rs,"ensureKeyAsync");function Ss(e){return e!=null?e.size!=null?e.size:e.length!=null?e.length:Object.keys(e).length:0}r(Ss,"size");function Cs(e){return e!=null&&e.length>0?e[e.length-1]:void 0}r(Cs,"last");function Fs(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}r(Fs,"empty");function Se(e){return Object(e)!==e?e:JSON.parse(C(e))}r(Se,"cloneObject");function ks(e){return Object(e)!==e?e:JSON.parse(C(e))}r(ks,"cloneJsonObject");function Is(e){let t=new Map;return n=>{if(t.has(n))return t.get(n);let o=e(n);return t.set(n,o),o}}r(Is,"memoize");function Os(e){let t=new Map;return async(...n)=>{let o=C(n);if(t.has(o))return t.get(o);let i=await e(...n);return t.set(o,i),i}}r(Os,"memoizeAsync");function $s(e,t){let n=[];for(let o=0;o<e;o++)n.push(t(o,e));return n}r($s,"forTimes");var vn=/\\\s|\s+|#[^\n]*\n?/gm,An=/\(\?P?<(\w[\w\d_]+)>|\((?!\?(:|\!|=|<=|<\!))/gm,At=/^((?:\(\?[\w$]+\))?)\(\?<([=!])([\s\S]*?)\)/gm,Pn=D("zeed:xrx","error");function Dn(e){return typeof e=="string"?e:e.source||""}r(Dn,"regExpString");function Hs(e){return e.replace(/[-\[\]{}()*+?.,\\^$|#\s]/g,"\\$&")}r(Hs,"regExpEscape");var Ce=class{constructor(t,n){this.namedGroups={};this.names=[];let o=n??"",i;if(t instanceof RegExp?(n==null&&(o=t.flags),i=t.source):i=t,o&&o.includes("x")&&(o=o.replace("x",""),i=i.replace(vn,a=>a[0]==="\\"?a:"")),!(t instanceof RegExp)){let a=0;i=i.replace(An,(l,c)=>(a+=1,c?(c!=="index"&&c!=="length"&&!this.namedGroups[c]?this.namedGroups[c]=a:Pn.error(`Unallowed or duplicate group name: ${c}`),"("):l)),this.names=Object.keys(this.namedGroups)}i=Dn(i),At.lastIndex=0;let u=At.exec(i);u&&(this.lookBehind={rx:new RegExp(`${u[3]}$(?!\\s)`),expect:u?u[2]==="=":!u},i=i.substr(u[0].length)),this.rx=new RegExp(i,o)}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=[],o;for(this.rx.lastIndex=0;o=this.exec(t);)n.push(o);return this.rx.lastIndex=0,n}replace(t,n){let o=typeof n=="function"?n:()=>n;return t.replace(this.rx,i=>o(i))}};r(Ce,"XRX");var Un=",";function ya(e,t={}){let{separator:n=Un}=t,o="";for(let i=0;i<e.length;i++)o+=`${e[i].map(s=>{if(s==null||s==="")return"";if(mt(s))return s?1:0;let u=String(s);return(le(s)||_(s))&&(u=C(s)),u.includes('"')||u.includes(`
5
+ ${i.stack}`:`${i.name||"Error"}: ${i.message}`;try{return o?JSON.stringify(i,null,2):JSON.stringify(i)}catch{}}return String(i)})}r(ln,"formatMessages");function No(e,t={}){return ln(e,t).join(" ")}r(No,"renderMessages");function Go(e){try{return decodeURIComponent(escape(e))}catch{}return e}r(Go,"fixBrokenUth8String");var Ue=864e5;function Ee(e){return Math.floor(e/1e4)}r(Ee,"dayYear");function st(e){return Math.floor(e/100%100)}r(st,"dayMonth");function fn(e){return Math.floor(e%100)}r(fn,"dayDay");function Jo(e){return[Ee(e),st(e),fn(e)]}r(Jo,"dayToParts");function at(e,t=!1){return t?new Date(`${pn(e)}T00:00:00.000Z`):new Date(e/1e4,e/100%100-1,e%100)}r(at,"dayToDate");function ut(){return ce(new Date)}r(ut,"dayFromToday");function Wo(e,t=!1){if(typeof e=="number")return e<100?void 0:e;if(typeof e=="string")return ct(e);if(Array.isArray(e)&&e.length===3){let[n,o,i]=e;return Me(n,o,i)}else if(e instanceof Date)return ce(e,t)}r(Wo,"dayFromAny");function Zo(e){return at(e,!0)}r(Zo,"dayToDateGMT");function ce(e,t=!1){return t?ct(e.toISOString()):e.getFullYear()*1e4+(e.getMonth()+1)*100+e.getDate()}r(ce,"dayFromDate");function Ko(e){return ce(e,!0)}r(Ko,"dayFromDateGMT");function De(e,t=!0){return at(e,t).getTime()}r(De,"dayToTimestamp");function dn(e,t=!0){return ce(new Date(e),t)}r(dn,"dayFromTimestamp");function pn(e,t="-"){let n=String(e);return n.slice(0,4)+t+n.slice(4,6)+t+n.slice(6,8)}r(pn,"dayToString");function Me(e,t=1,n=1){if(!(t<1||t>12||n<1||n>31))return e*1e4+t*100+n}r(Me,"dayFromParts");function ct(e){let t=String(e).replace(/[^0-9]/g,"").slice(0,8);if(t.length===8)return+t}r(ct,"dayFromString");function Yo(e,t=0){let n=Ee(e),o=st(e);return t!==0&&(o+=t,n+=Math.floor((o-1)/12),o=Math.floor((o-1)%12)+1,o===0&&(o=12)),Me(n,o,1)}r(Yo,"dayMonthStart");function Qo(e,t=0){let n=Ee(e);return Me(n+t,1,1)}r(Qo,"dayYearStart");function ue(e,t){return dn(De(e)+t*864e5)}r(ue,"dayOffset");function Xo(e,t){return Math.round((De(t)-De(e))/864e5)}r(Xo,"dayDiff");function ei(e,t){let n=[];for(t==null&&(t=ut()),e<0&&(e=ue(t,e+1));e<=t;)n.push(e),e=ue(e,1);return n}r(ei,"dayRange");function*ti(e,t){let n=[];for(t==null&&(t=ut()),e<0&&(e=ue(t,e+1));e<=t;)yield e,e=ue(e,1);return n}r(ti,"dayIterator");var lt=D("zeed:promise","error");function ft(){let e,t;return[new Promise((o,i)=>{e=o,t=i}),e,t]}r(ft,"createPromise");async function ii(e){return new Promise(t=>setTimeout(t,e))}r(ii,"sleep");async function si(){return new Promise(e=>setTimeout(e,0))}r(si,"immediate");var dt=Symbol("timeout");async function ai(e,t,n=dt){return new Promise(async(o,i)=>{let s=!1,u=setTimeout(()=>{s=!0,o(n)},t);try{let a=await e;clearTimeout(u),s||o(a)}catch(a){clearTimeout(u),s||i(a)}})}r(ai,"timeout");var pt=new Error("Timeout reached");function ui(e){return e===dt||e===pt}r(ui,"isTimeout");async function gt(e,t){return t<=0?await e:new Promise(async(n,o)=>{let i=!1,s=setTimeout(()=>{i=!0,o(pt)},t);try{let u=await e;clearTimeout(s),i||n(u)}catch(u){clearTimeout(s),i||o(u)}})}r(gt,"tryTimeout");function ci(e,t,n=1e3){return new Promise((o,i)=>{let s=r(l=>{a&&(clearTimeout(a),u(),o(l))},"fn"),u=r(()=>{a=null,e.off?e.off(t,s):e.removeEventListener?e.removeEventListener(t,s):lt.warn("No remove listener method found for",e,t)},"done"),a=setTimeout(()=>{u(),i(new Error("Did not response in time"))},n);e.on?e.on(t,s):e.addEventListener?e.addEventListener(t,s):lt.warn("No listener method found for",e)})}r(ci,"waitOn");function S(e){return Boolean(e&&(e instanceof Promise||typeof e.then=="function"))}r(S,"isPromise");function O(e){return Promise.resolve(e)}r(O,"promisify");var P=class{get value(){return this.days}constructor(t){if(typeof t=="number"){this.days=t;return}if(t!=null&&(t=P.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 P(t)}static fromString(t){return P.from(+t.replace(/[^0-9]/g,"").slice(0,8))}static fromDate(t,n=!1){return n?P.fromString(t.toISOString().substr(0,10)):P.from(t.getFullYear()*1e4+(t.getMonth()+1)*100+t.getDate())}static fromDateGMT(t){return P.fromDate(t,!0)}static from(t,n=!1){if(typeof t=="number")return t<100?void 0:new P(t);if(typeof t=="string")return P.fromString(t);if(Array.isArray(t)&&t.length===3){let[o,i=1,s=1]=t;return i<1||i>12||s<1||s>31?void 0:new P(o*1e4+i*100+s)}else{if(t instanceof Date)return P.fromDate(t,n);if(t instanceof P)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 P.fromDateGMT(new Date(this.toDateGMT().getTime()+t*864e5))}monthStart(){return P.from([this.year,this.month,1])}yearStart(){return P.from([this.year,1,1])}monthOffset(t){let n=this.month+t,o=Math.floor((n-1)%12)+1;o===0&&(o=12);let i=Math.floor((n-1)/12);return P.from([this.year+i,o,this.day])}daysUntil(t){return Math.round((new P(t)?.toDateGMT().getTime()-this.toDateGMT().getTime())/864e5)}yesterday(){return this.dayOffset(-1)}tomorrow(){return this.dayOffset(1)}};r(P,"Day");async function gi(e,t,n){let o=P.from(e),i=P.from(t);for(;o&&i&&o?.days<=i?.days;){let s=n(o);S(s)&&await s,o=o.dayOffset(1)}}r(gi,"forEachDay");function mi(){return new P}r(mi,"today");function yi(e){return new P(e)}r(yi,"day");function hi(e){return P.fromDate(new Date(e)).days}r(hi,"dateStringToDays");function gn(e,t=2){return+(+e).toFixed(t)}r(gn,"decimal");function Ti(e,t=2){return+(+e/10**t).toFixed(t)}r(Ti,"decimalFromCents");function wi(e,t=2){return Math.round(+e*10**t)}r(wi,"decimalToCents");function Li(e,t=2){return t*(gn(e,t)%1)}r(Li,"decimalCentsPart");function $(e){return e!=null&&typeof e=="object"}r($,"isObject");function Re(e){return Object(e)!==e}r(Re,"isPrimitive");function _(e){return Array.isArray(e)}r(_,"isArray");function le(e){return $(e)&&!_(e)}r(le,"isRecord");function Pi(e){return e?.constructor===Object}r(Pi,"isRecordPlain");function Di(e){return typeof e=="string"}r(Di,"isString");function mt(e){return typeof e=="number"&&!isNaN(e)}r(mt,"isNumber");function Ui(e){return mt(e)&&Number.isInteger(e)}r(Ui,"isInteger");function Ei(e){return mt(e)&&Number.isSafeInteger(e)}r(Ei,"isSafeInteger");function yt(e){return typeof e=="boolean"}r(yt,"isBoolean");function Mi(e){return e==null}r(Mi,"isNullOrUndefined");function Ri(e){return e==null}r(Ri,"isNull");function Si(e){return $(e)&&e.constructor.name==="Uint8Array"}r(Si,"isUint8Array");function Ci(e){return e!=null}r(Ci,"isNotNull");function Fi(e){return e!=null&&e!==!1&&e!==!0}r(Fi,"isValue");function mn(e,t,n=new WeakSet){if(e===t)return!0;if(n.has(t)||(Re(t)||n.add(t),!(e instanceof Object)||!(t instanceof Object))||e.constructor!==t.constructor||e.length!==t.length)return!1;for(let o in e){if(!e.hasOwnProperty(o))continue;if(!t.hasOwnProperty(o))return!1;let i=e[o],s=t[o];if(!mn(i,s,n))return!1}for(let o in t)if(t.hasOwnProperty(o)&&!e.hasOwnProperty(o))return!1;return!0}r(mn,"deepEqual");function yn(e,t=new WeakSet){if(t.has(e))return"[Circular ~]";if(Re(e)||t.add(e),le(e)){for(let n in e)if(e.hasOwnProperty(n)){if(e[n]===void 0){delete e[n];continue}yn(e[n],t)}}else if(_(e))for(let n=e.length-1;n>=0;n--)e[n]===void 0&&e.splice(n,1);return e}r(yn,"deepStripUndefinedInPlace");function fe(e,...t){for(let n of t)$(e)||(e={}),!(n==null||!$(n))&&Object.keys(n).forEach(o=>{let i=e[o],s=n[o];Array.isArray(i)&&Array.isArray(s)?e[o]=i.concat(s):$(i)&&$(s)?e[o]=fe(Object.assign({},i),s):e[o]=s});return e}r(fe,"deepMerge");var ht=r(e=>e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/'/g,"&apos;").replace(/"/g,"&quot;"),"escapeHTML"),Bi=r(e=>e.replace(/&lt;/gi,"<").replace(/&gt;/gi,">").replace(/&quot;/gi,'"').replace(/&apos;/gi,"'").replace(/&amp;/gi,"&"),"unescapeHTML");function zi(e,t,n=[]){return e.filter(o=>!t.some(i=>!i(o))).map(o=>{for(let i of n)o=i(o);return o}).filter(o=>o!=null)}r(zi,"listQuery");function Ni(e,t){return e.reduce((n,o)=>{let i=String(o[t]);return(n[i]=n[i]||[]).push(o),n},{})}r(Ni,"listGroupBy");function Gi(e,t){return Array.from(e.reduce((n,o)=>n.add(o[t]),new Set))}r(Gi,"listDistinctUnion");function Vi(e,t){return e.map(n=>n[t])}r(Vi,"listOfKey");function Zi(e,t){return $(e)?Object.fromEntries(Object.entries(e).map(([n,o])=>{let i=t(n,o);return _(i)&&i.length===2?i:[n,i]}).filter(n=>n!=null)):{}}r(Zi,"objectMap");function Ki(e,t){return t.dispose&&e.dispose&&t.dispose.add(e.dispose),Object.assign(e,t)}r(Ki,"objectMergeDisposable");function Yi(e){return Object.keys(e).length<=0}r(Yi,"objectIsEmpty");var xt=/[\u0000-\u001F\u0080-\u009F]/g,hn=/^\.+/,xn=/\.+$/;function bt(){return/[<>:"/\\|?*\u0000-\u001F]/g}r(bt,"filenameReservedRegex");function bn(){return/^(con|prn|aux|nul|com\d|lpt\d)$/i}r(bn,"windowsReservedNameRegex");function es(e,t="_"){if(typeof e!="string")throw new TypeError("Expected a string");if(bt().test(t)&&xt.test(t))throw new Error("Replacement string cannot contain reserved filename characters");return e=e.replace(bt(),t).replace(xt,t).replace(hn,t).replace(xn,""),e=bn().test(e)?e+t:e,e.slice(0,100)}r(es,"toValidFilename");var Tn=/[\\\-\[\]\/{}()*+?.^$|]/g;function Tt(e){return e?e instanceof RegExp?e.source:e.replace(Tn,"\\$&"):""}r(Tt,"escapeRegExp");var ee=r(e=>Math.abs(e)%1===.5,"isHalf"),wt=r(e=>e%2===0,"isEven"),is=r(e=>Math.ceil(e),"roundUp"),ss=r(e=>Math.floor(e),"roundDown"),as=r(e=>Math.round(e),"roundHalfUp"),us=r(e=>{let t=Math.round(e);return ee(e)&&wt(t)?t-1:t},"roundHalfOdd"),cs=r(e=>ee(e)?Math.sign(e)*Math.ceil(Math.abs(e)):Math.round(e),"roundHalfAwayFromZero"),ls=r(e=>ee(e)?Math.floor(e):Math.round(e),"roundHalfDown"),fs=r(e=>{let t=Math.round(e);return ee(e)?wt(t)?t:t-1:t},"roundHalfEven"),ds=r(e=>ee(e)?Math.sign(e)*Math.floor(Math.abs(e)):Math.round(e),"roundHalfTowardsZero");function Lt(e){return e.reduce((t,n)=>Math.min(t,n.sort_weight||0),0)-1-E()}r(Lt,"startSortWeight");function vt(e){return e.reduce((t,n)=>Math.max(t,n.sort_weight||0),0)+1+E()}r(vt,"endSortWeight");function ys(e,t,n){let o=n.length,i=e<t;if(o<=0||e>=o-1)return vt(n);if(e<=0)return Lt(n);n=wn([...n]);let s=i?-1:0,u=n[e+s].sort_weight||0,l=(n[e+s+1].sort_weight||0)-u;if(l===0)return i?Lt(n):vt(n);let c=u+l/2,f=l*.01*(E()-.5);return c+f}r(ys,"moveSortWeight");function wn(e){return e.sort((t,n)=>(t.sort_weight||0)-(n.sort_weight||0)),e}r(wn,"sortedItems");function Ts(e={}){let{getter:t=r(a=>a.sort,"getter")}=e;function n(a){return a.sort((l,c)=>(t(l)||0)-(t(c)||0)),a}r(n,"items");function o(a){return a.reduce((l,c)=>Math.min(l,t(c)||0),0)-1-E()}r(o,"start");function i(a){return a.reduce((l,c)=>Math.max(l,t(c)||0),0)+1+E()}r(i,"end");function s(a,l){a==null&&(a=(l??0)-1),l==null&&(l=(a??0)+1);let c=l-a,f=a+c/2,d=c*.01*(E()-.5);return f+d}r(s,"between");function u(a,l,c){let f=c.length,d=a<l;if(f<=0||a>=f-1)return i(c);if(a<=0)return o(c);c=n([...c]);let h=d?-1:0,y=t(c[a+h])||0,g=(t(c[a+h+1])||0)-y;if(g===0)return d?o(c):i(c);let L=y+g/2,b=g*.01*(E()-.5);return L+b}return r(u,"move"),{start:o,end:i,between:s,move:u,items:n}}r(Ts,"useSorted");var Ln=/((?:(?:(?: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 As(e){return e.split(Ln).map((t,n)=>{let o=ht(t);return n%2?`<a target="_blank" href="${o}">${vn(o)}</a>`:o}).join("")}r(As,"linkifyPlainText");function vn(e){return e.replace(/^https?:\/\/(www\.)?/,"").replace(/\/$/,"")}r(vn,"toHumanReadableUrl");function At(e){let t=[];for(let[n,o]of Object.entries(e))if(o!=null){Array.isArray(o)||(o=[o]);for(let i of o)i!=null&&t.push(`${encodeURIComponent(n)}=${encodeURIComponent(String(i))}`)}return t.join("&")}r(At,"encodeQuery");function Ps(e){let t={},n=(e[0]==="?"?e.substr(1):e).split("&");for(let o=0;o<n.length;o++){let i=n[o].split("="),s=decodeURIComponent(i[0]),u=decodeURIComponent(i[1]||"");t[s]!=null?(Array.isArray(t[s])||(t[s]=[t[s]]),t[s].push(u)):t[s]=u}return t}r(Ps,"parseQuery");function Ms(e,t,n){let o=e[t];return o===void 0&&(o=n(t,e),e[t]=o),o}r(Ms,"ensureKey");async function Rs(e,t,n){let o=e[t];return o===void 0&&(o=await n(t,e),e[t]=o),o}r(Rs,"ensureKeyAsync");function Ss(e){return e!=null?e.size!=null?e.size:e.length!=null?e.length:Object.keys(e).length:0}r(Ss,"size");function Cs(e){return e!=null&&e.length>0?e[e.length-1]:void 0}r(Cs,"last");function Fs(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}r(Fs,"empty");function Se(e){return Object(e)!==e?e:JSON.parse(C(e))}r(Se,"cloneObject");function ks(e){return Object(e)!==e?e:JSON.parse(C(e))}r(ks,"cloneJsonObject");function Is(e){let t=new Map;return n=>{if(t.has(n))return t.get(n);let o=e(n);return t.set(n,o),o}}r(Is,"memoize");function Os(e){let t=new Map;return async(...n)=>{let o=C(n);if(t.has(o))return t.get(o);let i=await e(...n);return t.set(o,i),i}}r(Os,"memoizeAsync");function $s(e,t){let n=[];for(let o=0;o<e;o++)n.push(t(o,e));return n}r($s,"forTimes");var An=/\\\s|\s+|#[^\n]*\n?/gm,Pn=/\(\?P?<(\w[\w\d_]+)>|\((?!\?(:|\!|=|<=|<\!))/gm,Pt=/^((?:\(\?[\w$]+\))?)\(\?<([=!])([\s\S]*?)\)/gm,Dn=D("zeed:xrx","error");function Un(e){return typeof e=="string"?e:e.source||""}r(Un,"regExpString");function Hs(e){return e.replace(/[-\[\]{}()*+?.,\\^$|#\s]/g,"\\$&")}r(Hs,"regExpEscape");var Ce=class{constructor(t,n){this.namedGroups={};this.names=[];let o=n??"",i;if(t instanceof RegExp?(n==null&&(o=t.flags),i=t.source):i=t,o&&o.includes("x")&&(o=o.replace("x",""),i=i.replace(An,a=>a[0]==="\\"?a:"")),!(t instanceof RegExp)){let a=0;i=i.replace(Pn,(l,c)=>(a+=1,c?(c!=="index"&&c!=="length"&&!this.namedGroups[c]?this.namedGroups[c]=a:Dn.error(`Unallowed or duplicate group name: ${c}`),"("):l)),this.names=Object.keys(this.namedGroups)}i=Un(i),Pt.lastIndex=0;let u=Pt.exec(i);u&&(this.lookBehind={rx:new RegExp(`${u[3]}$(?!\\s)`),expect:u?u[2]==="=":!u},i=i.substr(u[0].length)),this.rx=new RegExp(i,o)}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=[],o;for(this.rx.lastIndex=0;o=this.exec(t);)n.push(o);return this.rx.lastIndex=0,n}replace(t,n){let o=typeof n=="function"?n:()=>n;return t.replace(this.rx,i=>o(i))}};r(Ce,"XRX");var En=",";function ya(e,t={}){let{separator:n=En}=t,o="";for(let i=0;i<e.length;i++)o+=`${e[i].map(s=>{if(s==null||s==="")return"";if(yt(s))return s?1:0;let u=String(s);return(le(s)||_(s))&&(u=C(s)),u.includes('"')||u.includes(`
6
6
  `)||u.includes(n)?`"${u.replace(/"/g,'""')}"`:u}).join(n)}
7
- `;return o}r(ya,"csvStringify");function En(e,t={}){let n=/("((?:(?:[^"]*?)(?:"")?)*)"|([^,;\t\n]*))([,;\t]|\n|\r\n)/g;t.separator&&(n=new RegExp(n.source.replaceAll(",;\\t",bt(t.separator)),n.flags));let o=[],i=[],s,u=`${e.replaceAll(`\r
7
+ `;return o}r(ya,"csvStringify");function Mn(e,t={}){let n=/("((?:(?:[^"]*?)(?:"")?)*)"|([^,;\t\n]*))([,;\t]|\n|\r\n)/g;t.separator&&(n=new RegExp(n.source.replaceAll(",;\\t",Tt(t.separator)),n.flags));let o=[],i=[],s,u=`${e.replaceAll(`\r
8
8
  `,`
9
9
  `).trim()}
10
10
  `;for(;s=n.exec(u);){let a=s[2]??s[3]??"";a=a.replaceAll('""','"'),i.push(a),s[4]===`
11
- `&&(o.push(i),i=[])}return o}r(En,"csvParse");function ha(e,t={}){let n=En(e,t),o=n[0];return n.slice(1).map(i=>Object.fromEntries(i.map((s,u)=>[o[u],s])))}r(ha,"csvParseToObjects");var Mn=D("zeed:dispose","error");async function Rn(e){typeof e=="function"?await O(e()):S(e)?await e:typeof e.dispose=="function"?await O(e.dispose()):S(e.dispose)?await e.dispose:typeof e.cleanup=="function"?await O(e.cleanup()):S(e.cleanup)&&await e.cleanup}r(Rn,"callDisposer");function Fe(e){let{name:t}=typeof e=="string"?{name:e}:e??{},n=[],o=r(async u=>{u!=null&&n.includes(u)&&(Ae(n,a=>a!==u),await Rn(u))},"untrack"),i=r(async()=>{for(t&&Mn.debug(`dispose ${t}: ${n.length} entries`);n.length>0;)await o(n[0])},"dispose"),s=r(u=>{if(u!=null)return n.unshift(u),()=>o(u)},"track");return Object.assign(i,{track:s,add:s,untrack:o,dispose:i,exec:i,getSize(){return n.length},isDisposed(){return n.length<=0}})}r(Fe,"useDispose");var va=Fe;function Aa(e={}){let{mode:t="fifo"}=e,n=[],o=r(async(s=!1)=>{for(;n.length>0;){let u=n[0];if(Ae(n,a=>a!==u),typeof u=="function"){let a=u();if(S(a)){if(s)throw new Error(`Expected sync only function, but found async: ${u}`);await a}}else if(S(u)){if(s)throw new Error(`Expected sync only function, but found async: ${u}`);await u}else throw new Error(`Unhandled disposable: ${u}`)}},"exec");return Object.assign(o,{add:r(s=>{t==="lifo"?n.unshift(s):n.push(s)},"add"),exec:o,getSize(){return n.length}})}r(Aa,"useDefer");function Pa(e,t=0){let n=setTimeout(e,t);return()=>{n&&(clearTimeout(n),n=void 0)}}r(Pa,"useTimeout");function Da(e,t){let n=setInterval(e,t);return()=>{n&&(clearInterval(n),n=void 0)}}r(Da,"useInterval");function Ua(e,t,n,...o){return e==null?()=>{}:(e.on?e.on(t,n,...o):e.addEventListener&&e.addEventListener(t,n,...o),()=>{e.off?e.off(t,n,...o):e.removeEventListener&&e.removeEventListener(t,n,...o)})}r(Ua,"useEventListener");function Sa(){let e=!0;return(t,n)=>{let o=!1;if(e){e=!1;try{t(),o=!0}finally{e=!0}}else n!==void 0&&n();return o}}r(Sa,"useMutex");function Ca(){let e=!0;return async(t,n)=>{let o=!1;if(e){e=!1;try{let i=t();S(i)&&await i,o=!0}finally{e=!0}}else if(n!==void 0){let i=n();S(i)&&await i}return o}}r(Ca,"useAsyncMutex");var Z=D("zeed:emitter","error"),M=class{constructor(){this.subscribers={};this.subscribersOnAny=[];this.dispose=Fe();this.call=new Proxy({},{get:(t,n)=>async(...o)=>await this.emit(n,...o)})}async emit(t,...n){let o=!1;try{let i=this.subscribers[t]||[];if(this.subscribersOnAny.forEach(s=>s(t,...n)),i.length>0){let s=i.map(u=>{try{return O(u(...n))}catch(a){Z.warn("emit warning:",a)}return null}).filter(u=>u!=null);o=!0,await Promise.all(s)}}catch(i){Z.error("emit exception",i)}return o}onAny(t){this.subscribersOnAny.push(t)}on(t,n){let o=this.subscribers[t]||[];return o.push(n),this.subscribers[t]=o,()=>{this.off(t,n)}}onCall(t){for(let[n,o]of Object.entries(t))this.on(n,o)}once(t,n){let o=r(async(...i)=>(this.off(t,o),await O(n(...i))),"onceListener");return this.on(t,o),()=>{this.off(t,n)}}off(t,n){return this.subscribers[t]=(this.subscribers[t]||[]).filter(o=>n&&o!==n),this}removeAllListeners(){return this.subscribers={},this}};r(M,"Emitter");function ja(){let e=Q().emitter;return e||(e=new M,Q().emitter=e),e}r(ja,"getGlobalEmitter");var Ha=new M;function za(e,t){let n=Math.round(E()*100),o=[],i,s=r((a,l)=>{let c={key:a,obj:l};o.push(c),i&&i()},"incoming");return t?e.on?e.on(t,a=>{s(t,a)}):e.addEventListener?e.addEventListener(t,a=>{s(t,a)}):Z.error(n,"Cannot listen to key"):e.onAny?e.onAny((a,l)=>{s(a,l)}):Z.error(n,"cannot listen to all for",e),r((a,l=!0)=>new Promise((c,f)=>{a||(a=t,a||o.length&&(a=o[0].key)),i=r(()=>{for(;o.length>0;){let d=o.shift();if(d.key===a)i=void 0,c(d.obj);else{if(l){Z.warn(n,`Unhandled event ${a} with value: ${d.obj}`);continue}f(new Error(`Expected ${a}, but found ${d.key} with value=${d.obj}`)),Z.error(n,`Unhandled event ${a} with value: ${d.obj}`)}break}},"lazyResolve"),i()}),"on")}r(za,"lazyListener");var Pt=r(()=>Date.now(),"getTimestamp");function Va(e){return e>999?`${(e/1e3).toFixed(1)}s`:`${e.toFixed(2)}ms`}r(Va,"formatMilliseconds");function qa(...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 o=/(\d\d\d\d)-(\d\d)-(\d\d)/.exec(t);o&&(n=new Date(+o[1],+o[2]-1,+o[3],12,0))}if(n instanceof Date)return n}}}r(qa,"parseDate");var{encode:Dt,decode:Sn}=z(62),{encode:Ut,decode:Cn}=z(32),de=16;function Ie(){return J(de)}r(Ie,"uuidBytes");function Fn(e=Ie()){return Dt(e,22)}r(Fn,"uuidB62");function kn(e){return Dt(e,22)}r(kn,"uuidEncodeB62");function In(e){return Sn(e,de)}r(In,"uuidDecodeB62");function On(e=Ie()){return Ut(e,26)}r(On,"uuidB32");function $n(e){return Ut(e,26)}r($n,"uuidEncodeB32");function _n(e){return Cn(e,de)}r(_n,"uuidDecodeB32");var Bn="10000000-1000-4000-8000-100000000000",jn=typeof crypto<"u"&&crypto.randomUUID!=null?crypto.randomUUID.bind(crypto):()=>Bn.replace(/[018]/g,e=>(e^J(1)[0]&15>>e/4).toString(16));function Hn(e){let t=We(e);return`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16)}`}r(Hn,"uuidEncodeV4");function zn(e){return Ze(e.replaceAll("-",""))}r(zn,"uuidDecodeV4");var Et=16e11;function Nn(e){let t=new Uint8Array([0,0,0,0,0,0]),n=t.length-1;for(let o=0;o<t.length;o++){let i=e&255;t[n-o]=i,e=(e-i)/256}return t}r(Nn,"longToByteArray");function Mt(){let e=Pt()-Et;return new Uint8Array([...Nn(e),...J(10)])}r(Mt,"suidBytes");function Xa(){return Vn(Mt())}r(Xa,"suid");function eu(e){return Gn(St(e))}r(eu,"suidDate");function Gn(e){return new Date(Et+e.slice(0,6).reduce((t,n)=>t*256+n,0))}r(Gn,"suidBytesDate");var tu=r(()=>new Uint32Array(J(4))[0],"uuid32bit"),Oe={base62:{uuid:Fn,uuidDecode:In,uuidEncode:kn},base32:{uuid:On,uuidDecode:_n,uuidEncode:$n},uuidv4:{uuid:jn,uuidDecode:zn,uuidEncode:Hn}},pe="base62",Rt=!1;function nu(e,t=!1){pe=e,Rt=t}r(nu,"setUuidDefaultEncoding");function N(){return Oe[pe].uuid(Rt?Mt():Ie())}r(N,"uuid");function St(e){return Oe[pe].uuidDecode(e)}r(St,"uuidDecode");function Vn(e){return Oe[pe].uuidEncode(e)}r(Vn,"uuidEncode");function ru(e){try{return St(e).length===de}catch{}return!1}r(ru,"uuidIsValid");var ke={};function F(e="id"){return ke[e]==null&&(ke[e]=0),`${e}-${ke[e]++}`}r(F,"uname");var qn=0;function ou(){return`id-${qn++}`}r(ou,"qid");var ge=class extends M{constructor(){super(...arguments);this.id=N()}close(){this.dispose()}};r(ge,"Channel");var te=class extends ge{constructor(){super(...arguments);this.isConnected=!0}postMessage(n){this.other?.emit("message",{data:n,origin:"local",lastEventId:N()})}};r(te,"LocalChannel");function cu(){let e=new te,t=new te;return e.other=t,t.other=e,[e,t]}r(cu,"createLocalChannelPair");var $e=class{async encode(t){return t}async decode(t){return t}};r($e,"NoopEncoder");var G=class{async encode(t){return xe(t)}async decode(t){return be(t)}};r(G,"JsonEncoder");var _e=class{constructor(t){this.key=t}async encode(t){let n=xe(t);return await tt(n,this.key)}async decode(t){let n=await nt(t,this.key);return be(n)}};r(_e,"CryptoEncoder");var Ct=r((e,t,n={})=>new Proxy(n,{get:(o,i)=>i in o?o[i]:(...s)=>e(i,s,t)}),"createPromiseProxy");function wu(e={}){let{name:t=F("hub"),encoder:n=new G,retryAfter:o=1e3,ignoreUnhandled:i=!0,logLevel:s=!1}=e,u=D(t,s),a={},l,c=[],f,d={},h=r(()=>{clearTimeout(f)},"dispose"),y=r(async()=>{if(clearTimeout(f),l){if(l.isConnected)for(;c.length;){let b=c[0];try{l.postMessage(await n.encode(b)),c.shift()}catch(x){u.warn("postMessage",x);break}}c.length>0&&o>0&&(f=setTimeout(y,o))}},"postNext"),p=r(async b=>{u("enqueue postMessage",b),c.push(b),await y()},"postMessage"),g=r(async b=>{l=b,l.on("connect",y),l.on("message",async x=>{u("onmessage",typeof x);let{name:m,args:A,id:T,result:w,error:U}=await n.decode(x.data);if(m){u(`name ${m} id ${T}`);try{if(a[m]==null)throw new Error(`handler for ${m} was not found`);let v=a[m](...A);S(v)&&(v=await v),u(`result ${v}`),T&&await p({id:T,result:v})}catch(v){let I=v instanceof Error?v:new Error(Pe(v));u.warn("execution error",I.name),await p({id:T,error:{message:I.message,stack:I.stack,name:I.name}})}}else if(T)if(u(`response for id=${T}: result=${w}, error=${U}`),d[T]==null)w===void 0?u(`skip response for ${T}`):u.warn(`no response hook for ${T}`);else{let[v,I]=d[T];if(v&&I)if(delete d[T],U){let ne=new Error(U.message);ne.stack=U.stack,ne.name=U.name,u.warn("reject",ne.name),I(ne)}else u("resolve",w),v(w)}else i||u.warn("Unhandled message",x)}),await y()},"connect"),L=r(async(b,x,m={})=>{let{timeout:A=5e3}=m,T=N();return await p({name:b,args:x,id:T}),gt(new Promise((w,U)=>d[T]=[w,U]),A)},"fetchMessage");return e.channel&&g(e.channel),{dispose:h,connect:g,listen(b){Object.assign(a,b)},send(){return Ct(L,{},{options(b){return Ct(L,{...b})}})}}}r(wu,"useMessageHub");var me=class extends M{constructor(n){super();this.publish=this.emit.bind(this);this.subscribe=this.on.bind(this);let{name:o,encoder:i=new G,channel:s,debug:u=!1}=n;this.channel=s,this.encoder=i,this.debug=u,this.name=o??this.channel.id??F("pubsub"),this.log=D(`${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:a})=>{let l=await this.encoder.decode(a);if(this.debug?this.log(`channel message, event=${l?.event}, info=`,l):this.log(`channel message, event=${l?.event}`),l){let{event:c,args:f}=l;await this.emitSuper(c,...f)}})}get shortId(){return this.name.substr(0,6)}async emitSuper(n,...o){return await super.emit(n,...o)}async emit(n,...o){try{if(this.debug?this.log(`emit(${String(n)})`,n):this.log(`emit(${String(n)})`,o.length),!this.channel.isConnected)return this.log.warn("channel not connected"),!1;let i=await this.encoder.encode({event:n,args:o});return this.channel.postMessage(i),!0}catch(i){this.log.warn(`emit(${String(n)})`,i)}return!1}};r(me,"PubSub");function Eu(e){return new me(e)}r(Eu,"usePubSub");var Jn=1;var Ft=r(e=>e,"defaultSerialize"),Wn=Ft;function Su(e,t){let{post:n,on:o,eventNames:i=[],serialize:s=Ft,deserialize:u=Wn}=t,a=new Map;return o(async l=>{let c=u(l),[f,d,h,y]=c;if(f===1||f===2){let p,g;if(y!=null)try{let L=e[y];p=await L(...d)}catch(L){g=String(L)}else g="Method implementation missing";f===1&&h&&n(s(g?[4,g,h]:[3,p,h]))}else if(h){let p=a.get(h);p!=null&&(f===4?p.reject(d):p.resolve(d)),a.delete(h)}}),new Proxy({},{get(l,c){let f=r((...h)=>{n(s([2,h,null,c]))},"sendEvent");if(t.onlyEvents||i.includes(c))return f.asEvent=f,f;let d=r((...h)=>new Promise((y,p)=>{let g=Jn++;a.set(g,{resolve:y,reject:p}),n(s([1,h,g,c]))}),"sendCall");return d.asEvent=f,d}})}r(Su,"useRPC");var B=class extends M{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??F("progress"),this.dispose.add(async()=>{for(let o of this._children)await o.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 o=new B(n);return this.addChild(o),o}removeChild(n){rt(this._children,n),this.update()}getTotalUnits(){if(this.isIndeterminate())return 0;let n=this._totalUnits;for(let o of this._children)n+=o.getTotalUnits();return n}getCompletedUnits(){if(this.isIndeterminate())return 0;let n=this._completedUnits;for(let o of this._children)n+=o.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,o){this._totalUnits=n,o!=null&&(this._completedUnits=o),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 o=`${" ".repeat(n)}${this.name}: ${this._completedUnits} of ${this._totalUnits} units, ${Math.floor(this.getFraction()*100)} %, cancel=${this._isCancelled}
12
- `;for(let i of this._children)o+=i.toString(n+1);return n===0?o.trim():o}};r(B,"Progress");var Zn=(o=>(o[o.waiting=0]="waiting",o[o.running=1]="running",o[o.finished=2]="finished",o))(Zn||{}),Kn=(o=>(o[o.replace=0]="replace",o[o.memoize=1]="memoize",o[o.error=2]="error",o))(Kn||{});function Ku(e={}){let{maxParallel:t=3,name:n=F("pool")}=e,o=new M,i=new B({name:n});i.on("progressCancelled",L);let s=0,u=0,a=0,l=0,c={};async function f(){if(s>0){let[x,m]=ft();return o.once("didFinish",m),x}}r(f,"waitFinishAll");async function d(){for(let x of Object.keys(c))c[x].state===2&&(await c[x].progress.dispose(),delete c[x])}r(d,"cleanupFinished");function h(){o.emit("didFinish"),s=0,u=0,d(),i.reset()}r(h,"didFinish");function y(){let x=0,m=0;for(let{max:A,resolved:T,state:w}of Object.values(c))x+=A,m+=w===2?A:Math.min(A,T);o.emit("didUpdate",s,u,x,m)}r(y,"didUpdate");function p(){if(y(),s>0&&s===u&&h(),a>=t)return;let x=Object.values(c).filter(m=>m.state===0);if(x.length>0){let m;for(let A of x)A.group!=null&&Object.values(c).some(T=>T.state===1&&T.id!==A.id&&T.group===A.group)||(m==null||A.priority<m.priority)&&(m=A);if(m!=null){let A=m.id,T=m.done;m.state=1,++a,o.emit("didStart",A);let w=r(U=>{m&&(m.result=U,m.state=2,m.resolved=m.max),--a,++u,p()},"taskFinished");m.task(m).then(U=>{T(U),o.emit("didResolve",A,U),w(U)}).catch(U=>{T(),o.emit("didReject",A,U),w()})}}}r(p,"performNext");function g(x){let m=c[x];m&&m.state===0&&(c[x].state=2,++u,o.emit("didCancel",x),c[x].progress.dispose(),y())}r(g,"cancel");function L(){Object.keys(c).forEach(g)}r(L,"cancelAll");function b(x,m={}){let A,T=new Promise(v=>A=v),w=m.id??N();if(c[w]!=null){let v=m.idConflictResolution??1;if(v===0)g(w);else if(v===1){let I=c[w];return{id:w,promise:(async()=>{if(I.state===2)return c[w].result})(),dispose:()=>g(w),cancel:()=>g(w)}}else throw new Error(`Pool task with id=${w} already exists!`)}let U=new B({name:w,totalUnits:m.max??1,completeUnits:m.resolved??0});return i.addChild(U),c[w]={id:w,task:x,priority:++l,group:m.group,state:0,max:m.max??1,resolved:m.resolved??0,done:A,payload:m.payload,progress:U,setMax(v){U.setTotalUnits(v),c[w].max=v,y()},setResolved(v){U.setCompletetedUnits(v),c[w].resolved=v,y()},incResolved(v=1){U.incCompletedUnits(v),c[w].resolved+=v,y()}},++s,p(),{id:w,promise:T,dispose:()=>g(w),cancel:()=>g(w)}}return r(b,"enqueue"),{events:o,cancel:g,cancelAll:L,progress:i,enqueue:b,dispose:L,waitFinishAll:f}}r(Ku,"usePool");var Be=class extends M{constructor(n={}){super();this.queue=[];this.waitToFinish=[];this.countMax=0;this.countResolved=0;this.paused=!1;let{name:o=F("queue"),logLevel:i}=n;this.name=o,this.log=D(`zeed:queue:${o}`,i??1/0)}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:o,task:i,resolve:s}=n;this.currentTask=i();let u;try{this.log.info(`start task ${o}`),u=await this.currentTask,this.log(`finished task ${o} with result =`,u)}catch(a){this.log.warn("Error performing task",a)}s(u),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,o={}){let{immediate:i=!1,name:s=F(this.name)}=o;return i?(this.log.info(`immediate execution ${s}`),await n()):(this.log(`enqueue ${s}`),new Promise(u=>{this.queue.push({name:s,task:n,resolve:u}),this.countMax+=1,this.emit("didUpdate",this.countMax,this.countResolved),this.performNext()}))}async enqueueReentrant(n,o={}){return this.enqueue(n,{immediate:this.currentTask!=null,name:o.name})}async cancelAll(n=!0){this.log("cancelAll"),this.emit("didCancel");let o=this.queue.map(i=>i.resolve);this.queue=[],o.forEach(i=>i(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}};r(Be,"SerialQueue");var K=!1,k=K?D("zeed:throttle","error"):()=>{};function ac(e,t={}){let{delay:n=100,trailing:o=!0,leading:i=!0}=t,s=0,u=0,a=0,l,c=Date.now();function f(){return s?(clearTimeout(s),s=void 0,!0):!1}r(f,"clearExistingTimeout");function d(...h){let y=Date.now(),p=y-u;function g(){let b=Date.now();return`total ${(b-c).toFixed(1)}ms - elapsed ${(b-u).toFixed(1)}ms - visited ${a}x`}r(g,"debugElapsed");let L=r(()=>{a=0,u=Date.now(),e.apply(this,h)},"exec");if(l=L,p>n||!s){K&&k("elapsed",g()),i&&(p>n?(K&&k("\u{1F680} leading",g()),L()):++a);let b=p>n?n:n-p;k(`\u23F1 start timeout with ${b.toFixed(1)}ms`,g()),f(),u=y,s=setTimeout(()=>{K&&k("\u23F1 reached timeout",g()),s=0,o&&(!i||a>0)&&(K&&k("\u{1F680} trailing",g()),l?.())},b)}else++a,K&&k("visited",g())}return r(d,"wrapper"),d.cancel=f,d.stop=()=>{f()&&l&&l()},d.immediate=r(async function(...y){f(),u=Date.now(),e.apply(this,y)},"immediate"),d.dispose=()=>d.stop(),d}r(ac,"throttle");function uc(e,t={}){let{delay:n=100}=t,o=0,i=!1,s;function u(){o&&(k("clear"),clearTimeout(o),o=0)}r(u,"clearExistingTimeout");async function a(){try{if(u(),s!=null){k("exec");let f=[...s];s=void 0,i=!0,await O(e(...f)),i=!1,k("exec done"),s!=null&&(u(),k("exec trigger next"),o=setTimeout(a,n))}}catch{}}r(a,"exec");function l(...f){s=[...f],u(),k("trigger"),i===!1&&(o=setTimeout(a,n))}r(l,"wrapper");async function c(...f){u(),s=[...f],await a()}return r(c,"immediate"),l.cancel=u,l.dispose=u,l.immediate=c,l}r(uc,"debounce");function fc(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")}r(fc,"isLocalHost");function mc(e){let{level:t=void 0,filter:n=void 0,messages:o=[]}=e,i=q(n),s=re(t);return u=>{s(u.level)&&i(u.name)&&o.push(u)}}r(mc,"LoggerMemoryHandler");var Y=D("zeed:network","error"),je={cache:"no-cache",redirect:"follow",headers:{}};function Yn(e){let t=/:\/\/([^@]*)@/gi.exec(e);if(t&&t[1]){let[n,o]=t[1].split(":",2);return{url:e.replace(`${t[1]}@`,""),username:n,password:o}}}r(Yn,"parseBasicAuth");async function kt(e,t={},n=fetch){try{_(t)&&(t=fe({},...W(t)));let o=Yn(String(e));o&&(e=o.url,t=fe({},t,Qn(o.username,o.password))),t.headers!=null&&!(t.headers instanceof Headers)&&(t.headers=new Headers(t.headers));let i=await n(String(e),t);if(i.status<400)return i;try{Y.warn(`Fetch of ${String(e)} returned status=${i.status}. Options:`,t),Y.warn(`Response: ${await i.text()}`)}catch(s){Y.error("Exception:",s)}}catch(o){Y.error("fetchBasic",o)}}r(kt,"fetchBasic");async function wc(e,t={},n=fetch){try{let o=await kt(e,[{method:"GET",headers:{Accept:"application/json"}},t],n);if(o)return await o.json()}catch(o){Y.error("fetchJSON error:",o)}}r(wc,"fetchJson");async function Lc(e,t={},n=fetch){try{let o=await kt(e,[je,{method:"GET"},t],n);if(o)return await o.text()}catch(o){Y.error("fetchHTML error:",o)}}r(Lc,"fetchText");function vc(e,t="POST"){return{method:t,...je,headers:{"Content-Type":"application/x-www-form-urlencoded; charset=utf-8"},body:vt(e)}}r(vc,"fetchOptionsFormURLEncoded");function Ac(e,t="POST"){return{method:t,...je,headers:{"Content-Type":"application/json; charset=utf-8"},body:C(e)}}r(Ac,"fetchOptionsJson");function Qn(e,t){return{headers:{Authorization:`Basic ${Ke(`${e}:${t}`)}`}}}r(Qn,"fetchOptionsBasicAuth");function It(){if(typeof window<"u")return window}r(It,"getWindow");function Xn(){if(typeof navigator<"u")return navigator}r(Xn,"getNavigator");function Uc(){return It()??typeof WorkerGlobalScope<"u"?self:typeof global<"u"?global:Function("return this;")()}r(Uc,"getGlobal");var j=Xn(),V=It();function er(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}){return e.ios=j?.platform?.match(/(iPhone|iPod|iPad)/i)!=null,e.macos=!!j?.platform?.startsWith("Mac"),e.windows=!!j?.platform?.startsWith("Win"),e.beaker=V?.beaker!=null,e.electron=(j?.userAgent?.toLowerCase()?.indexOf(" electron/")||-1)>-1&&!e.beaker,e.wkwebview=V?.webkit?.messageHandlers!=null,e.pwa=j?.serviceWorker!=null,e.pwaInstalled=j?.standalone||V?.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=V&&"ontouchstart"in V||(j?.maxTouchPoints||0)>1||j?.msPointerEnabled&&V?.MSGesture||V?.DocumentTouch&&document instanceof DocumentTouch,e}r(er,"detect");var tr=r(()=>typeof window<"u"&&globalThis===window,"isBrowser"),Ec=er();function Mc(e){tr()?window.addEventListener("beforeunload",e):typeof process<"u"&&process.on("exit",()=>e)}r(Mc,"useExitHandler");var He=class{constructor(t={}){this.store={}}setItem(t,n){this.store[t]=Se(n)}getItem(t){return Se(this.store[t])}removeItem(t){delete this.store[t]}clear(){this.store={}}allKeys(){return Object.keys(this.store)}};r(He,"MemStorage");var Ic=r(()=>{},"noop");export{r as a,Q as b,_t as c,q as d,ye as e,re as f,oe as g,X as h,ze as i,Ne as j,Ht as k,D as l,wr as m,C as n,Lr as o,Nt as p,Gt as q,qe as r,Je as s,R as t,Ur as u,We as v,Ze as w,Ke as x,Er as y,Vt as z,Mr as A,Ye as B,xe as C,be as D,Qe as E,J as F,et as G,Te as H,Xe as I,qt as J,Fr as K,kr as L,tt as M,nt as N,Jt as O,E as P,$r as Q,_r as R,Br as S,jr as T,Wt as U,Hr as V,zr as W,Nr as X,Gr as Y,Zt as Z,Jr as _,Le as $,Wr as aa,ve as ba,Kt as ca,Yt as da,W as ea,Qt as fa,Xr as ga,rt as ha,eo as ia,Ae as ja,to as ka,no as la,Xt as ma,ro as na,en as oa,ot as pa,oo as qa,io as ra,so as sa,ao as ta,uo as ua,co as va,lo as wa,fo as xa,po as ya,z as za,xo as Aa,bo as Ba,To as Ca,wo as Da,Lo as Ea,vo as Fa,Ao as Ga,Po as Ha,Do as Ia,Mo as Ja,on as Ka,Ro as La,So as Ma,Io as Na,Oo as Oa,$o as Pa,sn as Qa,an as Ra,un as Sa,Pe as Ta,_o as Ua,Bo as Va,jo as Wa,Ho as Xa,cn as Ya,zo as Za,No as _a,Ue as $a,Ee as ab,st as bb,ln as cb,qo as db,at as eb,ut as fb,Jo as gb,Wo as hb,ce as ib,Zo as jb,De as kb,fn as lb,dn as mb,Me as nb,ct as ob,Ko as pb,Yo as qb,ue as rb,Qo as sb,Xo as tb,ei as ub,ft as vb,oi as wb,ii as xb,dt as yb,si as zb,pt as Ab,ai as Bb,gt as Cb,ui as Db,S as Eb,O as Fb,P as Gb,pi as Hb,gi as Ib,mi as Jb,yi as Kb,pn as Lb,bi as Mb,Ti as Nb,wi as Ob,$ as Pb,Re as Qb,_ as Rb,le as Sb,Ai as Tb,Pi as Ub,Di as Vb,Ui as Wb,Ei as Xb,mt as Yb,Mi as Zb,Ri as _b,Si as $b,Ci as ac,Fi as bc,gn as cc,mn as dc,fe as ec,yt as fc,Bi as gc,zi as hc,Ni as ic,Gi as jc,Vi as kc,Zi as lc,Ki as mc,Yi as nc,es as oc,bt as pc,ee as qc,Tt as rc,is as sc,ss as tc,as as uc,us as vc,cs as wc,ls as xc,fs as yc,ds as zc,wt as Ac,Lt as Bc,ys as Cc,Tn as Dc,Ts as Ec,As as Fc,Ln as Gc,vt as Hc,Ps as Ic,Ms as Jc,Rs as Kc,Ss as Lc,Cs as Mc,Fs as Nc,Se as Oc,ks as Pc,Is as Qc,Os as Rc,$s as Sc,Dn as Tc,Hs as Uc,Ce as Vc,ya as Wc,En as Xc,ha as Yc,Fe as Zc,va as _c,Aa as $c,Pa as ad,Da as bd,Ua as cd,Sa as dd,Ca as ed,M as fd,ja as gd,Ha as hd,za as id,Pt as jd,Va as kd,qa as ld,Ie as md,Fn as nd,kn as od,In as pd,On as qd,$n as rd,_n as sd,jn as td,Hn as ud,zn as vd,Mt as wd,Xa as xd,eu as yd,Gn as zd,tu as Ad,nu as Bd,N as Cd,St as Dd,Vn as Ed,ru as Fd,F as Gd,ou as Hd,ge as Id,te as Jd,cu as Kd,$e as Ld,G as Md,_e as Nd,Ct as Od,wu as Pd,me as Qd,Eu as Rd,Su as Sd,B as Td,Zn as Ud,Kn as Vd,Ku as Wd,Be as Xd,ac as Yd,uc as Zd,fc as _d,mc as $d,Yn as ae,kt as be,wc as ce,Lc as de,vc as ee,Ac as fe,Qn as ge,It as he,Xn as ie,Uc as je,er as ke,tr as le,Ec as me,Mc as ne,He as oe,Ic as pe};
13
- //# sourceMappingURL=chunk-WRWKAGRH.js.map
11
+ `&&(o.push(i),i=[])}return o}r(Mn,"csvParse");function ha(e,t={}){let n=Mn(e,t),o=n[0];return n.slice(1).map(i=>Object.fromEntries(i.map((s,u)=>[o[u],s])))}r(ha,"csvParseToObjects");var Rn=D("zeed:dispose","error");async function Sn(e){typeof e=="function"?await O(e()):S(e)?await e:typeof e.dispose=="function"?await O(e.dispose()):S(e.dispose)?await e.dispose:typeof e.cleanup=="function"?await O(e.cleanup()):S(e.cleanup)&&await e.cleanup}r(Sn,"callDisposer");function Fe(e){let{name:t}=typeof e=="string"?{name:e}:e??{},n=[],o=r(async u=>{u!=null&&n.includes(u)&&(Ae(n,a=>a!==u),await Sn(u))},"untrack"),i=r(async()=>{for(t&&Rn.debug(`dispose ${t}: ${n.length} entries`);n.length>0;)await o(n[0])},"dispose"),s=r(u=>{if(u!=null)return n.unshift(u),()=>o(u)},"track");return Object.assign(i,{track:s,add:s,untrack:o,dispose:i,exec:i,getSize(){return n.length},isDisposed(){return n.length<=0}})}r(Fe,"useDispose");var va=Fe;function Aa(e={}){let{mode:t="fifo"}=e,n=[],o=r(async(s=!1)=>{for(;n.length>0;){let u=n[0];if(Ae(n,a=>a!==u),typeof u=="function"){let a=u();if(S(a)){if(s)throw new Error(`Expected sync only function, but found async: ${u}`);await a}}else if(S(u)){if(s)throw new Error(`Expected sync only function, but found async: ${u}`);await u}else throw new Error(`Unhandled disposable: ${u}`)}},"exec");return Object.assign(o,{add:r(s=>{t==="lifo"?n.unshift(s):n.push(s)},"add"),exec:o,getSize(){return n.length}})}r(Aa,"useDefer");function Pa(e,t=0){let n=setTimeout(e,t);return()=>{n&&(clearTimeout(n),n=void 0)}}r(Pa,"useTimeout");function Da(e,t){let n=setInterval(e,t);return()=>{n&&(clearInterval(n),n=void 0)}}r(Da,"useInterval");function Ua(e,t,n,...o){return e==null?()=>{}:(e.on?e.on(t,n,...o):e.addEventListener&&e.addEventListener(t,n,...o),()=>{e.off?e.off(t,n,...o):e.removeEventListener&&e.removeEventListener(t,n,...o)})}r(Ua,"useEventListener");function Sa(){let e=!0;return(t,n)=>{let o=!1;if(e){e=!1;try{t(),o=!0}finally{e=!0}}else n!==void 0&&n();return o}}r(Sa,"useMutex");function Ca(){let e=!0;return async(t,n)=>{let o=!1;if(e){e=!1;try{let i=t();S(i)&&await i,o=!0}finally{e=!0}}else if(n!==void 0){let i=n();S(i)&&await i}return o}}r(Ca,"useAsyncMutex");var Z=D("zeed:emitter","error"),M=class{constructor(){this.subscribers={};this.subscribersOnAny=[];this.dispose=Fe();this.call=new Proxy({},{get:(t,n)=>async(...o)=>await this.emit(n,...o)})}async emit(t,...n){let o=!1;try{let i=this.subscribers[t]||[];if(this.subscribersOnAny.forEach(s=>s(t,...n)),i.length>0){let s=i.map(u=>{try{return O(u(...n))}catch(a){Z.warn("emit warning:",a)}return null}).filter(u=>u!=null);o=!0,await Promise.all(s)}}catch(i){Z.error("emit exception",i)}return o}onAny(t){this.subscribersOnAny.push(t)}on(t,n){let o=this.subscribers[t]||[];return o.push(n),this.subscribers[t]=o,()=>{this.off(t,n)}}onCall(t){for(let[n,o]of Object.entries(t))this.on(n,o)}once(t,n){let o=r(async(...i)=>(this.off(t,o),await O(n(...i))),"onceListener");return this.on(t,o),()=>{this.off(t,n)}}off(t,n){return this.subscribers[t]=(this.subscribers[t]||[]).filter(o=>n&&o!==n),this}removeAllListeners(){return this.subscribers={},this}};r(M,"Emitter");function ja(){let e=Q().emitter;return e||(e=new M,Q().emitter=e),e}r(ja,"getGlobalEmitter");var Ha=new M;function za(e,t){let n=Math.round(E()*100),o=[],i,s=r((a,l)=>{let c={key:a,obj:l};o.push(c),i&&i()},"incoming");return t?e.on?e.on(t,a=>{s(t,a)}):e.addEventListener?e.addEventListener(t,a=>{s(t,a)}):Z.error(n,"Cannot listen to key"):e.onAny?e.onAny((a,l)=>{s(a,l)}):Z.error(n,"cannot listen to all for",e),r((a,l=!0)=>new Promise((c,f)=>{a||(a=t,a||o.length&&(a=o[0].key)),i=r(()=>{for(;o.length>0;){let d=o.shift();if(d.key===a)i=void 0,c(d.obj);else{if(l){Z.warn(n,`Unhandled event ${a} with value: ${d.obj}`);continue}f(new Error(`Expected ${a}, but found ${d.key} with value=${d.obj}`)),Z.error(n,`Unhandled event ${a} with value: ${d.obj}`)}break}},"lazyResolve"),i()}),"on")}r(za,"lazyListener");var Dt=r(()=>Date.now(),"getTimestamp");function Va(e){return e>999?`${(e/1e3).toFixed(1)}s`:`${e.toFixed(2)}ms`}r(Va,"formatMilliseconds");function qa(...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 o=/(\d\d\d\d)-(\d\d)-(\d\d)/.exec(t);o&&(n=new Date(+o[1],+o[2]-1,+o[3],12,0))}if(n instanceof Date)return n}}}r(qa,"parseDate");var{encode:Ut,decode:Cn}=z(62),{encode:Et,decode:Fn}=z(32),de=16;function Ie(){return J(de)}r(Ie,"uuidBytes");function kn(e=Ie()){return Ut(e,22)}r(kn,"uuidB62");function In(e){return Ut(e,22)}r(In,"uuidEncodeB62");function On(e){return Cn(e,de)}r(On,"uuidDecodeB62");function $n(e=Ie()){return Et(e,26)}r($n,"uuidB32");function _n(e){return Et(e,26)}r(_n,"uuidEncodeB32");function Bn(e){return Fn(e,de)}r(Bn,"uuidDecodeB32");var jn="10000000-1000-4000-8000-100000000000",Hn=typeof crypto<"u"&&crypto.randomUUID!=null?crypto.randomUUID.bind(crypto):()=>jn.replace(/[018]/g,e=>(e^J(1)[0]&15>>e/4).toString(16));function zn(e){let t=We(e);return`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16)}`}r(zn,"uuidEncodeV4");function Nn(e){return Ze(e.replaceAll("-",""))}r(Nn,"uuidDecodeV4");var Mt=16e11;function Gn(e){let t=new Uint8Array([0,0,0,0,0,0]),n=t.length-1;for(let o=0;o<t.length;o++){let i=e&255;t[n-o]=i,e=(e-i)/256}return t}r(Gn,"longToByteArray");function Rt(){let e=Dt()-Mt;return new Uint8Array([...Gn(e),...J(10)])}r(Rt,"suidBytes");function Xa(){return qn(Rt())}r(Xa,"suid");function eu(e){return Vn(Ct(e))}r(eu,"suidDate");function Vn(e){return new Date(Mt+e.slice(0,6).reduce((t,n)=>t*256+n,0))}r(Vn,"suidBytesDate");var tu=r(()=>new Uint32Array(J(4))[0],"uuid32bit"),Oe={base62:{uuid:kn,uuidDecode:On,uuidEncode:In},base32:{uuid:$n,uuidDecode:Bn,uuidEncode:_n},uuidv4:{uuid:Hn,uuidDecode:Nn,uuidEncode:zn}},pe="base62",St=!1;function nu(e,t=!1){pe=e,St=t}r(nu,"setUuidDefaultEncoding");function N(){return Oe[pe].uuid(St?Rt():Ie())}r(N,"uuid");function Ct(e){return Oe[pe].uuidDecode(e)}r(Ct,"uuidDecode");function qn(e){return Oe[pe].uuidEncode(e)}r(qn,"uuidEncode");function ru(e){try{return Ct(e).length===de}catch{}return!1}r(ru,"uuidIsValid");var ke={};function F(e="id"){return ke[e]==null&&(ke[e]=0),`${e}-${ke[e]++}`}r(F,"uname");var Jn=0;function ou(){return`id-${Jn++}`}r(ou,"qid");var ge=class extends M{constructor(){super(...arguments);this.id=N()}close(){this.dispose()}};r(ge,"Channel");var te=class extends ge{constructor(){super(...arguments);this.isConnected=!0}postMessage(n){this.other?.emit("message",{data:n,origin:"local",lastEventId:N()})}};r(te,"LocalChannel");function cu(){let e=new te,t=new te;return e.other=t,t.other=e,[e,t]}r(cu,"createLocalChannelPair");var $e=class{async encode(t){return t}async decode(t){return t}};r($e,"NoopEncoder");var G=class{async encode(t){return xe(t)}async decode(t){return be(t)}};r(G,"JsonEncoder");var _e=class{constructor(t){this.key=t}async encode(t){let n=xe(t);return await tt(n,this.key)}async decode(t){let n=await nt(t,this.key);return be(n)}};r(_e,"CryptoEncoder");var Ft=r((e,t,n={})=>new Proxy(n,{get:(o,i)=>i in o?o[i]:(...s)=>e(i,s,t)}),"createPromiseProxy");function wu(e={}){let{name:t=F("hub"),encoder:n=new G,retryAfter:o=1e3,ignoreUnhandled:i=!0,logLevel:s=!1}=e,u=D(t,s),a={},l,c=[],f,d={},h=r(()=>{clearTimeout(f)},"dispose"),y=r(async()=>{if(clearTimeout(f),l){if(l.isConnected)for(;c.length;){let b=c[0];try{l.postMessage(await n.encode(b)),c.shift()}catch(x){u.warn("postMessage",x);break}}c.length>0&&o>0&&(f=setTimeout(y,o))}},"postNext"),p=r(async b=>{u("enqueue postMessage",b),c.push(b),await y()},"postMessage"),g=r(async b=>{l=b,l.on("connect",y),l.on("message",async x=>{u("onmessage",typeof x);let{name:m,args:A,id:T,result:w,error:U}=await n.decode(x.data);if(m){u(`name ${m} id ${T}`);try{if(a[m]==null)throw new Error(`handler for ${m} was not found`);let v=a[m](...A);S(v)&&(v=await v),u(`result ${v}`),T&&await p({id:T,result:v})}catch(v){let I=v instanceof Error?v:new Error(Pe(v));u.warn("execution error",I.name),await p({id:T,error:{message:I.message,stack:I.stack,name:I.name}})}}else if(T)if(u(`response for id=${T}: result=${w}, error=${U}`),d[T]==null)w===void 0?u(`skip response for ${T}`):u.warn(`no response hook for ${T}`);else{let[v,I]=d[T];if(v&&I)if(delete d[T],U){let ne=new Error(U.message);ne.stack=U.stack,ne.name=U.name,u.warn("reject",ne.name),I(ne)}else u("resolve",w),v(w)}else i||u.warn("Unhandled message",x)}),await y()},"connect"),L=r(async(b,x,m={})=>{let{timeout:A=5e3}=m,T=N();return await p({name:b,args:x,id:T}),gt(new Promise((w,U)=>d[T]=[w,U]),A)},"fetchMessage");return e.channel&&g(e.channel),{dispose:h,connect:g,listen(b){Object.assign(a,b)},send(){return Ft(L,{},{options(b){return Ft(L,{...b})}})}}}r(wu,"useMessageHub");var me=class extends M{constructor(n){super();this.publish=this.emit.bind(this);this.subscribe=this.on.bind(this);let{name:o,encoder:i=new G,channel:s,debug:u=!1}=n;this.channel=s,this.encoder=i,this.debug=u,this.name=o??this.channel.id??F("pubsub"),this.log=D(`${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:a})=>{let l=await this.encoder.decode(a);if(this.debug?this.log(`channel message, event=${l?.event}, info=`,l):this.log(`channel message, event=${l?.event}`),l){let{event:c,args:f}=l;await this.emitSuper(c,...f)}})}get shortId(){return this.name.substr(0,6)}async emitSuper(n,...o){return await super.emit(n,...o)}async emit(n,...o){try{if(this.debug?this.log(`emit(${String(n)})`,n):this.log(`emit(${String(n)})`,o.length),!this.channel.isConnected)return this.log.warn("channel not connected"),!1;let i=await this.encoder.encode({event:n,args:o});return this.channel.postMessage(i),!0}catch(i){this.log.warn(`emit(${String(n)})`,i)}return!1}};r(me,"PubSub");function Eu(e){return new me(e)}r(Eu,"usePubSub");var Wn=1;var kt=r(e=>e,"defaultSerialize"),Zn=kt;function Su(e,t){let{post:n,on:o,eventNames:i=[],serialize:s=kt,deserialize:u=Zn}=t,a=new Map;return o(async l=>{let c=u(l),[f,d,h,y]=c;if(f===1||f===2){let p,g;if(y!=null)try{let L=e[y];p=await L(...d)}catch(L){g=String(L)}else g="Method implementation missing";f===1&&h&&n(s(g?[4,g,h]:[3,p,h]))}else if(h){let p=a.get(h);p!=null&&(f===4?p.reject(d):p.resolve(d)),a.delete(h)}}),new Proxy({},{get(l,c){let f=r((...h)=>{n(s([2,h,null,c]))},"sendEvent");if(t.onlyEvents||i.includes(c))return f.asEvent=f,f;let d=r((...h)=>new Promise((y,p)=>{let g=Wn++;a.set(g,{resolve:y,reject:p}),n(s([1,h,g,c]))}),"sendCall");return d.asEvent=f,d}})}r(Su,"useRPC");var B=class extends M{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??F("progress"),this.dispose.add(async()=>{for(let o of this._children)await o.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 o=new B(n);return this.addChild(o),o}removeChild(n){rt(this._children,n),this.update()}getTotalUnits(){if(this.isIndeterminate())return 0;let n=this._totalUnits;for(let o of this._children)n+=o.getTotalUnits();return n}getCompletedUnits(){if(this.isIndeterminate())return 0;let n=this._completedUnits;for(let o of this._children)n+=o.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,o){this._totalUnits=n,o!=null&&(this._completedUnits=o),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 o=`${" ".repeat(n)}${this.name}: ${this._completedUnits} of ${this._totalUnits} units, ${Math.floor(this.getFraction()*100)} %, cancel=${this._isCancelled}
12
+ `;for(let i of this._children)o+=i.toString(n+1);return n===0?o.trim():o}};r(B,"Progress");var Kn=(o=>(o[o.waiting=0]="waiting",o[o.running=1]="running",o[o.finished=2]="finished",o))(Kn||{}),Yn=(o=>(o[o.replace=0]="replace",o[o.memoize=1]="memoize",o[o.error=2]="error",o))(Yn||{});function Ku(e={}){let{maxParallel:t=3,name:n=F("pool")}=e,o=new M,i=new B({name:n});i.on("progressCancelled",L);let s=0,u=0,a=0,l=0,c={};async function f(){if(s>0){let[x,m]=ft();return o.once("didFinish",m),x}}r(f,"waitFinishAll");async function d(){for(let x of Object.keys(c))c[x].state===2&&(await c[x].progress.dispose(),delete c[x])}r(d,"cleanupFinished");function h(){o.emit("didFinish"),s=0,u=0,d(),i.reset()}r(h,"didFinish");function y(){let x=0,m=0;for(let{max:A,resolved:T,state:w}of Object.values(c))x+=A,m+=w===2?A:Math.min(A,T);o.emit("didUpdate",s,u,x,m)}r(y,"didUpdate");function p(){if(y(),s>0&&s===u&&h(),a>=t)return;let x=Object.values(c).filter(m=>m.state===0);if(x.length>0){let m;for(let A of x)A.group!=null&&Object.values(c).some(T=>T.state===1&&T.id!==A.id&&T.group===A.group)||(m==null||A.priority<m.priority)&&(m=A);if(m!=null){let A=m.id,T=m.done;m.state=1,++a,o.emit("didStart",A);let w=r(U=>{m&&(m.result=U,m.state=2,m.resolved=m.max),--a,++u,p()},"taskFinished");m.task(m).then(U=>{T(U),o.emit("didResolve",A,U),w(U)}).catch(U=>{T(),o.emit("didReject",A,U),w()})}}}r(p,"performNext");function g(x){let m=c[x];m&&m.state===0&&(c[x].state=2,++u,o.emit("didCancel",x),c[x].progress.dispose(),y())}r(g,"cancel");function L(){Object.keys(c).forEach(g)}r(L,"cancelAll");function b(x,m={}){let A,T=new Promise(v=>A=v),w=m.id??N();if(c[w]!=null){let v=m.idConflictResolution??1;if(v===0)g(w);else if(v===1){let I=c[w];return{id:w,promise:(async()=>{if(I.state===2)return c[w].result})(),dispose:()=>g(w),cancel:()=>g(w)}}else throw new Error(`Pool task with id=${w} already exists!`)}let U=new B({name:w,totalUnits:m.max??1,completeUnits:m.resolved??0});return i.addChild(U),c[w]={id:w,task:x,priority:++l,group:m.group,state:0,max:m.max??1,resolved:m.resolved??0,done:A,payload:m.payload,progress:U,setMax(v){U.setTotalUnits(v),c[w].max=v,y()},setResolved(v){U.setCompletetedUnits(v),c[w].resolved=v,y()},incResolved(v=1){U.incCompletedUnits(v),c[w].resolved+=v,y()}},++s,p(),{id:w,promise:T,dispose:()=>g(w),cancel:()=>g(w)}}return r(b,"enqueue"),{events:o,cancel:g,cancelAll:L,progress:i,enqueue:b,dispose:L,waitFinishAll:f}}r(Ku,"usePool");var Be=class extends M{constructor(n={}){super();this.queue=[];this.waitToFinish=[];this.countMax=0;this.countResolved=0;this.paused=!1;let{name:o=F("queue"),logLevel:i}=n;this.name=o,this.log=D(`zeed:queue:${o}`,i??1/0)}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:o,task:i,resolve:s}=n;this.currentTask=i();let u;try{this.log.info(`start task ${o}`),u=await this.currentTask,this.log(`finished task ${o} with result =`,u)}catch(a){this.log.warn("Error performing task",a)}s(u),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,o={}){let{immediate:i=!1,name:s=F(this.name)}=o;return i?(this.log.info(`immediate execution ${s}`),await n()):(this.log(`enqueue ${s}`),new Promise(u=>{this.queue.push({name:s,task:n,resolve:u}),this.countMax+=1,this.emit("didUpdate",this.countMax,this.countResolved),this.performNext()}))}async enqueueReentrant(n,o={}){return this.enqueue(n,{immediate:this.currentTask!=null,name:o.name})}async cancelAll(n=!0){this.log("cancelAll"),this.emit("didCancel");let o=this.queue.map(i=>i.resolve);this.queue=[],o.forEach(i=>i(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}};r(Be,"SerialQueue");var K=!1,k=K?D("zeed:throttle","error"):()=>{};function ac(e,t={}){let{delay:n=100,trailing:o=!0,leading:i=!0}=t,s=0,u=0,a=0,l,c=Date.now();function f(){return s?(clearTimeout(s),s=void 0,!0):!1}r(f,"clearExistingTimeout");function d(...h){let y=Date.now(),p=y-u;function g(){let b=Date.now();return`total ${(b-c).toFixed(1)}ms - elapsed ${(b-u).toFixed(1)}ms - visited ${a}x`}r(g,"debugElapsed");let L=r(()=>{a=0,u=Date.now(),e.apply(this,h)},"exec");if(l=L,p>n||!s){K&&k("elapsed",g()),i&&(p>n?(K&&k("\u{1F680} leading",g()),L()):++a);let b=p>n?n:n-p;k(`\u23F1 start timeout with ${b.toFixed(1)}ms`,g()),f(),u=y,s=setTimeout(()=>{K&&k("\u23F1 reached timeout",g()),s=0,o&&(!i||a>0)&&(K&&k("\u{1F680} trailing",g()),l?.())},b)}else++a,K&&k("visited",g())}return r(d,"wrapper"),d.cancel=f,d.stop=()=>{f()&&l&&l()},d.immediate=r(async function(...y){f(),u=Date.now(),e.apply(this,y)},"immediate"),d.dispose=()=>d.stop(),d}r(ac,"throttle");function uc(e,t={}){let{delay:n=100}=t,o=0,i=!1,s;function u(){o&&(k("clear"),clearTimeout(o),o=0)}r(u,"clearExistingTimeout");async function a(){try{if(u(),s!=null){k("exec");let f=[...s];s=void 0,i=!0,await O(e(...f)),i=!1,k("exec done"),s!=null&&(u(),k("exec trigger next"),o=setTimeout(a,n))}}catch{}}r(a,"exec");function l(...f){s=[...f],u(),k("trigger"),i===!1&&(o=setTimeout(a,n))}r(l,"wrapper");async function c(...f){u(),s=[...f],await a()}return r(c,"immediate"),l.cancel=u,l.dispose=u,l.immediate=c,l}r(uc,"debounce");function fc(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")}r(fc,"isLocalHost");function mc(e){let{level:t=void 0,filter:n=void 0,messages:o=[]}=e,i=q(n),s=re(t);return u=>{s(u.level)&&i(u.name)&&o.push(u)}}r(mc,"LoggerMemoryHandler");var Y=D("zeed:network","error"),je={cache:"no-cache",redirect:"follow",headers:{}};function Qn(e){let t=/:\/\/([^@]*)@/gi.exec(e);if(t&&t[1]){let[n,o]=t[1].split(":",2);return{url:e.replace(`${t[1]}@`,""),username:n,password:o}}}r(Qn,"parseBasicAuth");async function It(e,t={},n=fetch){try{_(t)&&(t=fe({},...W(t)));let o=Qn(String(e));o&&(e=o.url,t=fe({},t,Xn(o.username,o.password))),t.headers!=null&&!(t.headers instanceof Headers)&&(t.headers=new Headers(t.headers));let i=await n(String(e),t);if(i.status<400)return i;try{Y.warn(`Fetch of ${String(e)} returned status=${i.status}. Options:`,t),Y.warn(`Response: ${await i.text()}`)}catch(s){Y.error("Exception:",s)}}catch(o){Y.error("fetchBasic",o)}}r(It,"fetchBasic");async function wc(e,t={},n=fetch){try{let o=await It(e,[{method:"GET",headers:{Accept:"application/json"}},t],n);if(o)return await o.json()}catch(o){Y.error("fetchJSON error:",o)}}r(wc,"fetchJson");async function Lc(e,t={},n=fetch){try{let o=await It(e,[je,{method:"GET"},t],n);if(o)return await o.text()}catch(o){Y.error("fetchHTML error:",o)}}r(Lc,"fetchText");function vc(e,t="POST"){return{method:t,...je,headers:{"Content-Type":"application/x-www-form-urlencoded; charset=utf-8"},body:At(e)}}r(vc,"fetchOptionsFormURLEncoded");function Ac(e,t="POST"){return{method:t,...je,headers:{"Content-Type":"application/json; charset=utf-8"},body:C(e)}}r(Ac,"fetchOptionsJson");function Xn(e,t){return{headers:{Authorization:`Basic ${Ke(`${e}:${t}`)}`}}}r(Xn,"fetchOptionsBasicAuth");function Ot(){if(typeof window<"u")return window}r(Ot,"getWindow");function er(){if(typeof navigator<"u")return navigator}r(er,"getNavigator");function Uc(){return Ot()??typeof WorkerGlobalScope<"u"?self:typeof global<"u"?global:Function("return this;")()}r(Uc,"getGlobal");var j=er(),V=Ot();function tr(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}){return e.ios=j?.platform?.match(/(iPhone|iPod|iPad)/i)!=null,e.macos=!!j?.platform?.startsWith("Mac"),e.windows=!!j?.platform?.startsWith("Win"),e.beaker=V?.beaker!=null,e.electron=(j?.userAgent?.toLowerCase()?.indexOf(" electron/")||-1)>-1&&!e.beaker,e.wkwebview=V?.webkit?.messageHandlers!=null,e.pwa=j?.serviceWorker!=null,e.pwaInstalled=j?.standalone||V?.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=V&&"ontouchstart"in V||(j?.maxTouchPoints||0)>1||j?.msPointerEnabled&&V?.MSGesture||V?.DocumentTouch&&document instanceof DocumentTouch,e}r(tr,"detect");var nr=r(()=>typeof window<"u"&&globalThis===window,"isBrowser"),Ec=tr();function Mc(e){nr()?window.addEventListener("beforeunload",e):typeof process<"u"&&process.on("exit",()=>e)}r(Mc,"useExitHandler");var He=class{constructor(t={}){this.store={}}setItem(t,n){this.store[t]=Se(n)}getItem(t){return Se(this.store[t])}removeItem(t){delete this.store[t]}clear(){this.store={}}allKeys(){return Object.keys(this.store)}};r(He,"MemStorage");var Ic=r(()=>{},"noop");export{r as a,Q as b,Bt as c,q as d,ye as e,re as f,oe as g,X as h,ze as i,Ne as j,zt as k,D as l,Lr as m,C as n,vr as o,Gt as p,Vt as q,qe as r,Je as s,R as t,Er as u,We as v,Ze as w,Ke as x,Mr as y,qt as z,Rr as A,Ye as B,xe as C,be as D,Qe as E,J as F,et as G,Te as H,Xe as I,Jt as J,kr as K,Ir as L,tt as M,nt as N,Wt as O,E as P,_r as Q,Br as R,jr as S,Hr as T,Zt as U,zr as V,Nr as W,Gr as X,Vr as Y,Kt as Z,Wr as _,Le as $,Zr as aa,ve as ba,Yt as ca,Qt as da,W as ea,Xt as fa,eo as ga,rt as ha,to as ia,Ae as ja,no as ka,ro as la,en as ma,oo as na,tn as oa,ot as pa,io as qa,so as ra,ao as sa,uo as ta,co as ua,lo as va,fo as wa,po as xa,go as ya,z as za,bo as Aa,To as Ba,wo as Ca,Lo as Da,vo as Ea,Ao as Fa,Po as Ga,Do as Ha,Uo as Ia,Ro as Ja,sn as Ka,So as La,Co as Ma,Oo as Na,$o as Oa,_o as Pa,an as Qa,un as Ra,cn as Sa,Pe as Ta,Bo as Ua,jo as Va,Ho as Wa,zo as Xa,ln as Ya,No as Za,Go as _a,Ue as $a,Ee as ab,st as bb,fn as cb,Jo as db,at as eb,ut as fb,Wo as gb,Zo as hb,ce as ib,Ko as jb,De as kb,dn as lb,pn as mb,Me as nb,ct as ob,Yo as pb,Qo as qb,ue as rb,Xo as sb,ei as tb,ti as ub,ft as vb,ii as wb,si as xb,dt as yb,ai as zb,pt as Ab,ui as Bb,gt as Cb,ci as Db,S as Eb,O as Fb,P as Gb,gi as Hb,mi as Ib,yi as Jb,hi as Kb,gn as Lb,Ti as Mb,wi as Nb,Li as Ob,$ as Pb,Re as Qb,_ as Rb,le as Sb,Pi as Tb,Di as Ub,mt as Vb,Ui as Wb,Ei as Xb,yt as Yb,Mi as Zb,Ri as _b,Si as $b,Ci as ac,Fi as bc,mn as cc,yn as dc,fe as ec,ht as fc,Bi as gc,zi as hc,Ni as ic,Gi as jc,Vi as kc,Zi as lc,Ki as mc,Yi as nc,es as oc,Tt as pc,ee as qc,wt as rc,is as sc,ss as tc,as as uc,us as vc,cs as wc,ls as xc,fs as yc,ds as zc,Lt as Ac,vt as Bc,ys as Cc,wn as Dc,Ts as Ec,As as Fc,vn as Gc,At as Hc,Ps as Ic,Ms as Jc,Rs as Kc,Ss as Lc,Cs as Mc,Fs as Nc,Se as Oc,ks as Pc,Is as Qc,Os as Rc,$s as Sc,Un as Tc,Hs as Uc,Ce as Vc,ya as Wc,Mn as Xc,ha as Yc,Fe as Zc,va as _c,Aa as $c,Pa as ad,Da as bd,Ua as cd,Sa as dd,Ca as ed,M as fd,ja as gd,Ha as hd,za as id,Dt as jd,Va as kd,qa as ld,Ie as md,kn as nd,In as od,On as pd,$n as qd,_n as rd,Bn as sd,Hn as td,zn as ud,Nn as vd,Rt as wd,Xa as xd,eu as yd,Vn as zd,tu as Ad,nu as Bd,N as Cd,Ct as Dd,qn as Ed,ru as Fd,F as Gd,ou as Hd,ge as Id,te as Jd,cu as Kd,$e as Ld,G as Md,_e as Nd,Ft as Od,wu as Pd,me as Qd,Eu as Rd,Su as Sd,B as Td,Kn as Ud,Yn as Vd,Ku as Wd,Be as Xd,ac as Yd,uc as Zd,fc as _d,mc as $d,Qn as ae,It as be,wc as ce,Lc as de,vc as ee,Ac as fe,Xn as ge,Ot as he,er as ie,Uc as je,tr as ke,nr as le,Ec as me,Mc as ne,He as oe,Ic as pe};
13
+ //# sourceMappingURL=chunk-RFXMRHAW.js.map