zeed 0.8.54 → 0.8.55

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.
@@ -2,11 +2,11 @@ var kt=Object.defineProperty;var r=(e,t)=>kt(e,"name",{value:t,configurable:!0})
2
2
  `)}r(Qe,"Uint8ArrayToHexDump");function V(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(V,"randomUint8Array");var et="SHA-256",Te="AES-GCM",Xe="PBKDF2",Nt=1e5;async function _r(e,t=et){return P(await crypto.subtle.digest(t,P(e)))}r(_r,"digest");async function zr(e,t={}){let n=P(e),o=await crypto.subtle.importKey("raw",n,Xe,!1,["deriveKey"]);return await crypto.subtle.deriveKey({name:Xe,salt:t.salt?P(t.salt):new Uint8Array(0),iterations:t.iterations??Nt,hash:et},o,{name:Te,length:256},!0,["encrypt","decrypt"])}r(zr,"deriveKeyPbkdf2");var ce=new Uint8Array([1,1]);async function tt(e,t){let n=V(12),o=await crypto.subtle.encrypt({name:Te,iv:n},t,e),i=new Uint8Array(o),s=ce.length+n.length+i.length,u=new Uint8Array(s),a=0;return u.set(ce,a),a+=ce.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,ce))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 qt(){return crypto.getRandomValues(new Uint32Array(1))[0]/4294967295}r(qt,"getSecureRandom");function D(){return typeof crypto<"u"?qt():Math.random()}r(D,"getSecureRandomIfPossible");function qr(e=.25){return D()<e}r(qr,"randomBoolean");function Vr(e=100,t=0){return t+Math.floor(D()*(e-t))}r(Vr,"randomInt");function Jr(e=100,t=0){return t+D()*(e-t)}r(Jr,"randomFloat");function Zr(e,t,n){return Math.max(e,Math.min(n,t))}r(Zr,"between");function Vt(e){return e.reduce((t,n)=>t+n,0)}r(Vt,"sum");function Wr(e){return Vt(e)/e.length}r(Wr,"avg");function Kr(e){return!/^1?$|^(11+?)\1+$/.test("1".repeat(e))}r(Kr,"isPrimeRX");function Yr(e){for(let t=2;t<e;t++)if(e%t===0)return!1;return e>1}r(Yr,"isPrime");var we=6;function Qr(e=0,t=1,n){we=((n??we)*9301+49297)%233280;let o=we/233280;return t+o*(e-t)}r(Qr,"seededRandom");function Jt(e=""){let[t="",n="asc"]=e.split(" ");return n=n.toLowerCase(),{field:t,orderby:n,asc:n!=="desc",desc:n==="desc"}}r(Jt,"parseOrderby");function to(e,t=!0){return`${e} ${t?"asc":"desc"}`}r(to,"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 no(e,...t){if(t.length>0){let n=t.map(Jt),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(no,"sortedOrderby");function Ae(e){return e.filter((t,n)=>e.indexOf(t)===n)}r(Ae,"arrayUnique");function Zt(e,t){return Ae(e.filter(n=>!t.includes(n)))}r(Zt,"arrayMinus");function Wt(...e){return Ae(e.reduce((t=[],n)=>t.concat(n),[]))}r(Wt,"arrayUnion");function J(...e){return e.flat(1/0)}r(J,"arrayFlatten");function Kt(e,t){return Ae(e).filter(n=>t.includes(n))}r(Kt,"arrayIntersection");function ao(e,t){return Zt(Wt(e,t),Kt(e,t))}r(ao,"arraySymmetricDifference");function uo(e,t){if(e&&Array.isArray(e)){let n;for(;(n=e.indexOf(t))!==-1;)e.splice(n,1);return e}return[]}r(uo,"arrayRemoveElement");function co(e,t){return e.includes(t)||e.push(t),e}r(co,"arraySetElement");function ve(e,t){return e.splice(0,e.length,...e.filter(t)),e}r(ve,"arrayFilterInPlace");function lo(e,t){let n=e.findIndex(o=>o===t);return n>=0?e.splice(n,1):e.push(t),e}r(lo,"arrayToggleInPlace");function fo(e){return e.splice(0,e.length),e}r(fo,"arrayEmptyInPlace");function Yt(e,t=Le){return Array.from(e).sort(t)}r(Yt,"arraySorted");function po(e){return Yt(e,(t,n)=>t-n)}r(po,"arraySortedNumbers");function Qt(e,t){return e.length===t.length&&e.every((n,o)=>n===t[o])}r(Qt,"arrayIsEqual");function rt(e){return e.sort(()=>D()>.5?1:-1),e}r(rt,"arrayShuffleInPlace");function go(e){return rt(Array.from(e))}r(go,"arrayShuffle");function mo(e){for(;e.length>1;){let t=Array.from(e);if(rt(t),!Qt(e,t))return t}return e}r(mo,"arrayShuffleForce");function yo(e){return e[Math.floor(D()*e.length)]}r(yo,"arrayRandomElement");function ho(...e){return J(e).reduce((t,n)=>t!=null?n>t?n:t:n,void 0)}r(ho,"arrayMax");function xo(...e){return J(e).reduce((t,n)=>t!=null?n<t?n:t:n,void 0)}r(xo,"arrayMin");function bo(...e){return J(e).reduce((t,n)=>t+n,0)}r(bo,"arraySum");function To(...e){let t=J(e);return t.reduce((n,o)=>n+o,0)/t.length}r(To,"arrayAvg");function wo(e,t){let n=[],o=0,i=e.length;for(;o<i;)n.push(e.slice(o,o+=t));return n}r(wo,"arrayBatches");function Lo(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(Lo,"createArray");var Xt=A("zeed:basex","error"),en={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 H(e){let t=en[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 d=t.charAt(c),g=d.charCodeAt(0);if(n[g]!==255)throw new TypeError(`${d} is ambiguous`);n[g]=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,d=-1){let g=P(c);if(g.byteLength===0)return"";let h=0,y=0,x=g.byteLength;for(;y!==x&&g[y]===0;)y++;let f=(x-y)*u+1>>>0,p=new Uint8Array(f);for(;y!==x;){let b=g[y],w=0;for(let v=f-1;(b!==0||w<h)&&v!==-1;v--,w++)b+=256*p[v]>>>0,p[v]=b%o>>>0,b=b/o>>>0;if(b!==0)throw Xt.warn("Non-zero carry",g,d,w,f),new Error("Non-zero carry");h=w,y++}let m=f-h;for(;m!==f&&p[m]===0;)m++;let T="";for(;m<f;++m)T+=t.charAt(p[m]);return d>0?T.padStart(d,i):T}r(a,"encode");function l(c,d=-1){if(typeof c!="string")throw new TypeError("Expected String");if(c.length===0)return new Uint8Array;c=c.replace(/\s+/gi,"");let g=0,h=0;for(;c[g]===i;)g++;let y=(c.length-g)*s+1>>>0,x=new Uint8Array(y);for(;c[g];){let p=n[c.charCodeAt(g)];if(p===255)throw new Error(`Unsupported character "${c[g]}"`);let m=0;for(let T=y-1;(p!==0||m<h)&&T!==-1;T--,m++)p+=o*x[T]>>>0,x[T]=p%256>>>0,p=p/256>>>0;if(p!==0)throw new Error("Non-zero carry");h=m,g++}let f=y-h;for(;f!==y&&x[f]===0;)f++;return d>0?new Uint8Array([...new Uint8Array(d-x.length+f),...x.slice(f)]):x.slice(f)}return r(l,"decode"),{encode:a,decode:l}}r(H,"useBase");var{encode:Eo,decode:tn}=H(32);function Mo(e){return tn(e.toLocaleLowerCase().replaceAll("l","1").replaceAll("s","5").replaceAll("o","0").replaceAll("i","1"))}r(Mo,"decodeBase32");var{encode:Ro,decode:So}=H(16),{encode:Uo,decode:Fo}=H(58),{encode:ko,decode:Io}=H(62);function Co(e,t){return Math.ceil(e*(Math.log(256)/Math.log(t)))}r(Co,"estimateSizeForBase");var Bo=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 nn(e){return e.charAt(0).toUpperCase()+e.toLowerCase().slice(1)}r(nn,"toCapitalize");function Ho(e){return e.replace(/\w\S*/g,nn)}r(Ho,"toCapitalizeWords");function jo(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(jo,"fromCamelCase");var ot=["1","true","yes","y","on"];function No(e,t=!1){return e==null||typeof e!="string"?t:ot.includes(String(e).trim().toLowerCase())}r(No,"stringToBoolean");function qo(e,t=0){return e==null||typeof e!="string"?t:parseInt(e.trim(),10)??t}r(qo,"stringToInteger");function Vo(e,t=0){return e==null||typeof e!="string"?t:parseFloat(e.trim())??t}r(Vo,"stringToFloat");function rn(e,t=!1){return e==null?t:typeof e=="boolean"?e:typeof e=="number"?e!==0:ot.includes(String(e).trim().toLowerCase())}r(rn,"valueToBoolean");function on(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(on,"valueToInteger");function sn(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(sn,"valueToFloat");function De(e,t=""){return e==null?t:String(e)??t}r(De,"valueToString");var Jo=sn,Zo=on,Wo=De,Ko=rn;function an(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(an,"formatMessages");function Yo(e,t={}){return an(e,t).join(" ")}r(Yo,"renderMessages");function Qo(e){try{return decodeURIComponent(escape(e))}catch{}return e}r(Qo,"fixBrokenUth8String");var Ee=864e5;function Me(e){return Math.floor(e/1e4)}r(Me,"dayYear");function it(e){return Math.floor(e/100%100)}r(it,"dayMonth");function un(e){return Math.floor(e%100)}r(un,"dayDay");function ti(e){return[Me(e),it(e),un(e)]}r(ti,"dayToParts");function st(e,t=!1){return t?new Date(`${ln(e)}T00:00:00.000Z`):new Date(e/1e4,e/100%100-1,e%100)}r(st,"dayToDate");function ni(){return le(new Date)}r(ni,"dayFromToday");function ri(e,t=!1){if(typeof e=="number")return e<100?void 0:e;if(typeof e=="string")return at(e);if(Array.isArray(e)&&e.length===3){let[n,o,i]=e;return Re(n,o,i)}else if(e instanceof Date)return le(e,t)}r(ri,"dayFromAny");function oi(e){return st(e,!0)}r(oi,"dayToDateGMT");function le(e,t=!1){return t?at(e.toISOString()):e.getFullYear()*1e4+(e.getMonth()+1)*100+e.getDate()}r(le,"dayFromDate");function ii(e){return le(e,!0)}r(ii,"dayFromDateGMT");function Pe(e,t=!0){return st(e,t).getTime()}r(Pe,"dayToTimestamp");function cn(e,t=!0){return le(new Date(e),t)}r(cn,"dayFromTimestamp");function ln(e,t="-"){let n=String(e);return n.slice(0,4)+t+n.slice(4,6)+t+n.slice(6,8)}r(ln,"dayToString");function Re(e,t=1,n=1){if(!(t<1||t>12||n<1||n>31))return e*1e4+t*100+n}r(Re,"dayFromParts");function at(e){let t=String(e).replace(/[^0-9]/g,"").slice(0,8);if(t.length===8)return+t}r(at,"dayFromString");function si(e,t=0){let n=Me(e),o=it(e);return t!==0&&(o+=t,n+=Math.floor((o-1)/12),o=Math.floor((o-1)%12)+1,o===0&&(o=12)),Re(n,o,1)}r(si,"dayMonthStart");function ai(e,t=0){let n=Me(e);return Re(n+t,1,1)}r(ai,"dayYearStart");function ui(e,t){return cn(Pe(e)+t*864e5)}r(ui,"dayOffset");function ci(e,t){return Math.round((Pe(t)-Pe(e))/864e5)}r(ci,"dayDiff");var{warn:ut}=A("zeed:promise","error");function ct(){let e,t;return[new Promise((o,i)=>{e=o,t=i}),e,t]}r(ct,"createPromise");async function di(e){return new Promise(t=>setTimeout(t,e))}r(di,"sleep");async function gi(){return new Promise(e=>setTimeout(e,0))}r(gi,"immediate");var lt=Symbol("timeout");async function mi(e,t,n=lt){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(mi,"timeout");var ft=new Error("Timeout reached");function yi(e){return e===lt||e===ft}r(yi,"isTimeout");async function pt(e,t){return t<=0?await e:new Promise(async(n,o)=>{let i=!1,s=setTimeout(()=>{i=!0,o(ft)},t);try{let u=await e;clearTimeout(s),i||n(u)}catch(u){clearTimeout(s),i||o(u)}})}r(pt,"tryTimeout");function hi(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):ut("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):ut("No listener method found for",e)})}r(hi,"waitOn");function E(e){return Boolean(e&&(e instanceof Promise||typeof e.then=="function"))}r(E,"isPromise");function I(e){return Promise.resolve(e)}r(I,"promisify");var L=class{get value(){return this.days}constructor(t){if(typeof t=="number"){this.days=t;return}if(t!=null&&(t=L.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 L(t)}static fromString(t){return L.from(+t.replace(/[^0-9]/g,"").slice(0,8))}static fromDate(t,n=!1){return n?L.fromString(t.toISOString().substr(0,10)):L.from(t.getFullYear()*1e4+(t.getMonth()+1)*100+t.getDate())}static fromDateGMT(t){return L.fromDate(t,!0)}static from(t,n=!1){if(typeof t=="number")return t<100?void 0:new L(t);if(typeof t=="string")return L.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 L(o*1e4+i*100+s)}else{if(t instanceof Date)return L.fromDate(t,n);if(t instanceof L)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 L.fromDateGMT(new Date(this.toDateGMT().getTime()+t*864e5))}monthStart(){return L.from([this.year,this.month,1])}yearStart(){return L.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 L.from([this.year+i,o,this.day])}daysUntil(t){return Math.round((new L(t)?.toDateGMT().getTime()-this.toDateGMT().getTime())/864e5)}yesterday(){return this.dayOffset(-1)}tomorrow(){return this.dayOffset(1)}};r(L,"Day");async function Li(e,t,n){let o=L.from(e),i=L.from(t);for(;o&&i&&o?.days<=i?.days;){let s=n(o);E(s)&&await s,o=o.dayOffset(1)}}r(Li,"forEachDay");function Ai(){return new L}r(Ai,"today");function vi(e){return new L(e)}r(vi,"day");function Di(e){return L.fromDate(new Date(e)).days}r(Di,"dateStringToDays");function fn(e,t=2){return+(+e).toFixed(t)}r(fn,"decimal");function Mi(e,t=2){return+(+e/10**t).toFixed(t)}r(Mi,"decimalFromCents");function Ri(e,t=2){return Math.round(+e*10**t)}r(Ri,"decimalToCents");function Si(e,t=2){return t*(fn(e,t)%1)}r(Si,"decimalCentsPart");var dt=r(e=>e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/'/g,"&apos;").replace(/"/g,"&quot;"),"escapeHTML"),ki=r(e=>e.replace(/&lt;/gi,"<").replace(/&gt;/gi,">").replace(/&quot;/gi,'"').replace(/&apos;/gi,"'").replace(/&amp;/gi,"&"),"unescapeHTML");function Oi(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(Oi,"listQuery");function $i(e,t){return e.reduce((n,o)=>{let i=String(o[t]);return(n[i]=n[i]||[]).push(o),n},{})}r($i,"listGroupBy");function Bi(e,t){return Array.from(e.reduce((n,o)=>n.add(o[t]),new Set))}r(Bi,"listDistinctUnion");function zi(e,t){return F(e)?Object.fromEntries(Object.entries(e).map(([n,o])=>{let i=t(n,o);return k(i)&&i.length===2?i:[n,i]}).filter(n=>n!=null)):{}}r(zi,"objectMap");function Gi(e,t){return t.dispose&&e.dispose&&t.dispose.add(e.dispose),Object.assign(e,t)}r(Gi,"objectMergeDisposable");function Ni(e){return Object.keys(e).length<=0}r(Ni,"objectIsEmpty");var gt=/[\u0000-\u001F\u0080-\u009F]/g,pn=/^\.+/,dn=/\.+$/;function mt(){return/[<>:"/\\|?*\u0000-\u001F]/g}r(mt,"filenameReservedRegex");function gn(){return/^(con|prn|aux|nul|com\d|lpt\d)$/i}r(gn,"windowsReservedNameRegex");function Ji(e,t="_"){if(typeof e!="string")throw new TypeError("Expected a string");if(mt().test(t)&&gt.test(t))throw new Error("Replacement string cannot contain reserved filename characters");return e=e.replace(mt(),t).replace(gt,t).replace(pn,t).replace(dn,""),e=gn().test(e)?e+t:e,e.slice(0,100)}r(Ji,"toValidFilename");var mn=/[\\\-\[\]\/{}()*+?.^$|]/g;function yt(e){return e?e instanceof RegExp?e.source:e.replace(mn,"\\$&"):""}r(yt,"escapeRegExp");var X=r(e=>Math.abs(e)%1===.5,"isHalf"),ht=r(e=>e%2===0,"isEven"),Qi=r(e=>Math.ceil(e),"roundUp"),Xi=r(e=>Math.floor(e),"roundDown"),es=r(e=>Math.round(e),"roundHalfUp"),ts=r(e=>{let t=Math.round(e);return X(e)&&ht(t)?t-1:t},"roundHalfOdd"),ns=r(e=>X(e)?Math.sign(e)*Math.ceil(Math.abs(e)):Math.round(e),"roundHalfAwayFromZero"),rs=r(e=>X(e)?Math.floor(e):Math.round(e),"roundHalfDown"),os=r(e=>{let t=Math.round(e);return X(e)?ht(t)?t:t-1:t},"roundHalfEven"),is=r(e=>X(e)?Math.sign(e)*Math.floor(Math.abs(e)):Math.round(e),"roundHalfTowardsZero");function xt(e){return e.reduce((t,n)=>Math.min(t,n.sort_weight||0),0)-1-D()}r(xt,"startSortWeight");function bt(e){return e.reduce((t,n)=>Math.max(t,n.sort_weight||0),0)+1+D()}r(bt,"endSortWeight");function cs(e,t,n){let o=n.length,i=e<t;if(o<=0||e>=o-1)return bt(n);if(e<=0)return xt(n);n=yn([...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?xt(n):bt(n);let c=u+l/2,d=l*.01*(D()-.5);return c+d}r(cs,"moveSortWeight");function yn(e){return e.sort((t,n)=>(t.sort_weight||0)-(n.sort_weight||0)),e}r(yn,"sortedItems");function ds(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-D()}r(o,"start");function i(a){return a.reduce((l,c)=>Math.max(l,t(c)||0),0)+1+D()}r(i,"end");function s(a,l){a==null&&(a=(l??0)-1),l==null&&(l=(a??0)+1);let c=l-a,d=a+c/2,g=c*.01*(D()-.5);return d+g}r(s,"between");function u(a,l,c){let d=c.length,g=a<l;if(d<=0||a>=d-1)return i(c);if(a<=0)return o(c);c=n([...c]);let h=g?-1:0,y=t(c[a+h])||0,f=(t(c[a+h+1])||0)-y;if(f===0)return g?o(c):i(c);let p=y+f/2,m=f*.01*(D()-.5);return p+m}return r(u,"move"),{start:o,end:i,between:s,move:u,items:n}}r(ds,"useSorted");var hn=/((?:(?:(?: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 hs(e){return e.split(hn).map((t,n)=>{let o=dt(t);return n%2?`<a target="_blank" href="${o}">${xn(o)}</a>`:o}).join("")}r(hs,"linkifyPlainText");function xn(e){return e.replace(/^https?:\/\/(www\.)?/,"").replace(/\/$/,"")}r(xn,"toHumanReadableUrl");function Tt(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(Tt,"encodeQuery");function xs(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(xs,"parseQuery");function Ls(e,t,n){let o=e[t];return o===void 0&&(o=n(t,e),e[t]=o),o}r(Ls,"ensureKey");async function As(e,t,n){let o=e[t];return o===void 0&&(o=await n(t,e),e[t]=o),o}r(As,"ensureKeyAsync");function vs(e){return e!=null?e.size!=null?e.size:e.length!=null?e.length:Object.keys(e).length:0}r(vs,"size");function Ds(e){return e!=null&&e.length>0?e[e.length-1]:void 0}r(Ds,"last");function Ps(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(Ps,"empty");function Se(e){return Object(e)!==e?e:JSON.parse(S(e))}r(Se,"cloneObject");function Es(e){return Object(e)!==e?e:JSON.parse(S(e))}r(Es,"cloneJsonObject");function Ms(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(Ms,"memoize");function Rs(e){let t=new Map;return async(...n)=>{let o=S(n);if(t.has(o))return t.get(o);let i=await e(...n);return t.set(o,i),i}}r(Rs,"memoizeAsync");function Ss(e,t){let n=[];for(let o=0;o<e;o++)n.push(t(o,e));return n}r(Ss,"forTimes");var bn=/\\\s|\s+|#[^\n]*\n?/gm,Tn=/\(\?P?<(\w[\w\d_]+)>|\((?!\?(:|\!|=|<=|<\!))/gm,wt=/^((?:\(\?[\w$]+\))?)\(\?<([=!])([\s\S]*?)\)/gm,wn=A("zeed:xrx","error");function Ln(e){return typeof e=="string"?e:e.source||""}r(Ln,"regExpString");function Is(e){return e.replace(/[-\[\]{}()*+?.,\\^$|#\s]/g,"\\$&")}r(Is,"regExpEscape");var Ue=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(bn,a=>a[0]==="\\"?a:"")),!(t instanceof RegExp)){let a=0;i=i.replace(Tn,(l,c)=>(a+=1,c?(c!=="index"&&c!=="length"&&!this.namedGroups[c]?this.namedGroups[c]=a:wn.error(`Unallowed or duplicate group name: ${c}`),"("):l)),this.names=Object.keys(this.namedGroups)}i=Ln(i),wt.lastIndex=0;let u=wt.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(Ue,"XRX");var An=",";function ca(e,t={}){let{separator:n=An}=t,o="";for(let i=0;i<e.length;i++)o+=`${e[i].map(s=>{if(s==null||s==="")return"";if(_e(s))return s?1:0;let u=String(s);return(ne(s)||k(s))&&(u=S(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(an,"formatMessages");function Yo(e,t={}){return an(e,t).join(" ")}r(Yo,"renderMessages");function Qo(e){try{return decodeURIComponent(escape(e))}catch{}return e}r(Qo,"fixBrokenUth8String");var Ee=864e5;function Me(e){return Math.floor(e/1e4)}r(Me,"dayYear");function it(e){return Math.floor(e/100%100)}r(it,"dayMonth");function un(e){return Math.floor(e%100)}r(un,"dayDay");function ti(e){return[Me(e),it(e),un(e)]}r(ti,"dayToParts");function st(e,t=!1){return t?new Date(`${ln(e)}T00:00:00.000Z`):new Date(e/1e4,e/100%100-1,e%100)}r(st,"dayToDate");function ni(){return le(new Date)}r(ni,"dayFromToday");function ri(e,t=!1){if(typeof e=="number")return e<100?void 0:e;if(typeof e=="string")return at(e);if(Array.isArray(e)&&e.length===3){let[n,o,i]=e;return Re(n,o,i)}else if(e instanceof Date)return le(e,t)}r(ri,"dayFromAny");function oi(e){return st(e,!0)}r(oi,"dayToDateGMT");function le(e,t=!1){return t?at(e.toISOString()):e.getFullYear()*1e4+(e.getMonth()+1)*100+e.getDate()}r(le,"dayFromDate");function ii(e){return le(e,!0)}r(ii,"dayFromDateGMT");function Pe(e,t=!0){return st(e,t).getTime()}r(Pe,"dayToTimestamp");function cn(e,t=!0){return le(new Date(e),t)}r(cn,"dayFromTimestamp");function ln(e,t="-"){let n=String(e);return n.slice(0,4)+t+n.slice(4,6)+t+n.slice(6,8)}r(ln,"dayToString");function Re(e,t=1,n=1){if(!(t<1||t>12||n<1||n>31))return e*1e4+t*100+n}r(Re,"dayFromParts");function at(e){let t=String(e).replace(/[^0-9]/g,"").slice(0,8);if(t.length===8)return+t}r(at,"dayFromString");function si(e,t=0){let n=Me(e),o=it(e);return t!==0&&(o+=t,n+=Math.floor((o-1)/12),o=Math.floor((o-1)%12)+1,o===0&&(o=12)),Re(n,o,1)}r(si,"dayMonthStart");function ai(e,t=0){let n=Me(e);return Re(n+t,1,1)}r(ai,"dayYearStart");function ui(e,t){return cn(Pe(e)+t*864e5)}r(ui,"dayOffset");function ci(e,t){return Math.round((Pe(t)-Pe(e))/864e5)}r(ci,"dayDiff");var{warn:ut}=A("zeed:promise","error");function ct(){let e,t;return[new Promise((o,i)=>{e=o,t=i}),e,t]}r(ct,"createPromise");async function di(e){return new Promise(t=>setTimeout(t,e))}r(di,"sleep");async function gi(){return new Promise(e=>setTimeout(e,0))}r(gi,"immediate");var lt=Symbol("timeout");async function mi(e,t,n=lt){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(mi,"timeout");var ft=new Error("Timeout reached");function yi(e){return e===lt||e===ft}r(yi,"isTimeout");async function pt(e,t){return t<=0?await e:new Promise(async(n,o)=>{let i=!1,s=setTimeout(()=>{i=!0,o(ft)},t);try{let u=await e;clearTimeout(s),i||n(u)}catch(u){clearTimeout(s),i||o(u)}})}r(pt,"tryTimeout");function hi(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):ut("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):ut("No listener method found for",e)})}r(hi,"waitOn");function E(e){return Boolean(e&&(e instanceof Promise||typeof e.then=="function"))}r(E,"isPromise");function I(e){return Promise.resolve(e)}r(I,"promisify");var L=class{get value(){return this.days}constructor(t){if(typeof t=="number"){this.days=t;return}if(t!=null&&(t=L.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 L(t)}static fromString(t){return L.from(+t.replace(/[^0-9]/g,"").slice(0,8))}static fromDate(t,n=!1){return n?L.fromString(t.toISOString().substr(0,10)):L.from(t.getFullYear()*1e4+(t.getMonth()+1)*100+t.getDate())}static fromDateGMT(t){return L.fromDate(t,!0)}static from(t,n=!1){if(typeof t=="number")return t<100?void 0:new L(t);if(typeof t=="string")return L.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 L(o*1e4+i*100+s)}else{if(t instanceof Date)return L.fromDate(t,n);if(t instanceof L)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 L.fromDateGMT(new Date(this.toDateGMT().getTime()+t*864e5))}monthStart(){return L.from([this.year,this.month,1])}yearStart(){return L.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 L.from([this.year+i,o,this.day])}daysUntil(t){return Math.round((new L(t)?.toDateGMT().getTime()-this.toDateGMT().getTime())/864e5)}yesterday(){return this.dayOffset(-1)}tomorrow(){return this.dayOffset(1)}};r(L,"Day");async function Li(e,t,n){let o=L.from(e),i=L.from(t);for(;o&&i&&o?.days<=i?.days;){let s=n(o);E(s)&&await s,o=o.dayOffset(1)}}r(Li,"forEachDay");function Ai(){return new L}r(Ai,"today");function vi(e){return new L(e)}r(vi,"day");function Di(e){return L.fromDate(new Date(e)).days}r(Di,"dateStringToDays");function fn(e,t=2){return+(+e).toFixed(t)}r(fn,"decimal");function Mi(e,t=2){return+(+e/10**t).toFixed(t)}r(Mi,"decimalFromCents");function Ri(e,t=2){return Math.round(+e*10**t)}r(Ri,"decimalToCents");function Si(e,t=2){return t*(fn(e,t)%1)}r(Si,"decimalCentsPart");var dt=r(e=>e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/'/g,"&apos;").replace(/"/g,"&quot;"),"escapeHTML"),ki=r(e=>e.replace(/&lt;/gi,"<").replace(/&gt;/gi,">").replace(/&quot;/gi,'"').replace(/&apos;/gi,"'").replace(/&amp;/gi,"&"),"unescapeHTML");function Oi(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(Oi,"listQuery");function $i(e,t){return e.reduce((n,o)=>{let i=String(o[t]);return(n[i]=n[i]||[]).push(o),n},{})}r($i,"listGroupBy");function Bi(e,t){return Array.from(e.reduce((n,o)=>n.add(o[t]),new Set))}r(Bi,"listDistinctUnion");function Hi(e,t){return e.map(n=>n[t])}r(Hi,"listOfKey");function Gi(e,t){return F(e)?Object.fromEntries(Object.entries(e).map(([n,o])=>{let i=t(n,o);return k(i)&&i.length===2?i:[n,i]}).filter(n=>n!=null)):{}}r(Gi,"objectMap");function Ni(e,t){return t.dispose&&e.dispose&&t.dispose.add(e.dispose),Object.assign(e,t)}r(Ni,"objectMergeDisposable");function qi(e){return Object.keys(e).length<=0}r(qi,"objectIsEmpty");var gt=/[\u0000-\u001F\u0080-\u009F]/g,pn=/^\.+/,dn=/\.+$/;function mt(){return/[<>:"/\\|?*\u0000-\u001F]/g}r(mt,"filenameReservedRegex");function gn(){return/^(con|prn|aux|nul|com\d|lpt\d)$/i}r(gn,"windowsReservedNameRegex");function Zi(e,t="_"){if(typeof e!="string")throw new TypeError("Expected a string");if(mt().test(t)&&gt.test(t))throw new Error("Replacement string cannot contain reserved filename characters");return e=e.replace(mt(),t).replace(gt,t).replace(pn,t).replace(dn,""),e=gn().test(e)?e+t:e,e.slice(0,100)}r(Zi,"toValidFilename");var mn=/[\\\-\[\]\/{}()*+?.^$|]/g;function yt(e){return e?e instanceof RegExp?e.source:e.replace(mn,"\\$&"):""}r(yt,"escapeRegExp");var X=r(e=>Math.abs(e)%1===.5,"isHalf"),ht=r(e=>e%2===0,"isEven"),Xi=r(e=>Math.ceil(e),"roundUp"),es=r(e=>Math.floor(e),"roundDown"),ts=r(e=>Math.round(e),"roundHalfUp"),ns=r(e=>{let t=Math.round(e);return X(e)&&ht(t)?t-1:t},"roundHalfOdd"),rs=r(e=>X(e)?Math.sign(e)*Math.ceil(Math.abs(e)):Math.round(e),"roundHalfAwayFromZero"),os=r(e=>X(e)?Math.floor(e):Math.round(e),"roundHalfDown"),is=r(e=>{let t=Math.round(e);return X(e)?ht(t)?t:t-1:t},"roundHalfEven"),ss=r(e=>X(e)?Math.sign(e)*Math.floor(Math.abs(e)):Math.round(e),"roundHalfTowardsZero");function xt(e){return e.reduce((t,n)=>Math.min(t,n.sort_weight||0),0)-1-D()}r(xt,"startSortWeight");function bt(e){return e.reduce((t,n)=>Math.max(t,n.sort_weight||0),0)+1+D()}r(bt,"endSortWeight");function ls(e,t,n){let o=n.length,i=e<t;if(o<=0||e>=o-1)return bt(n);if(e<=0)return xt(n);n=yn([...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?xt(n):bt(n);let c=u+l/2,d=l*.01*(D()-.5);return c+d}r(ls,"moveSortWeight");function yn(e){return e.sort((t,n)=>(t.sort_weight||0)-(n.sort_weight||0)),e}r(yn,"sortedItems");function gs(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-D()}r(o,"start");function i(a){return a.reduce((l,c)=>Math.max(l,t(c)||0),0)+1+D()}r(i,"end");function s(a,l){a==null&&(a=(l??0)-1),l==null&&(l=(a??0)+1);let c=l-a,d=a+c/2,g=c*.01*(D()-.5);return d+g}r(s,"between");function u(a,l,c){let d=c.length,g=a<l;if(d<=0||a>=d-1)return i(c);if(a<=0)return o(c);c=n([...c]);let h=g?-1:0,y=t(c[a+h])||0,f=(t(c[a+h+1])||0)-y;if(f===0)return g?o(c):i(c);let p=y+f/2,m=f*.01*(D()-.5);return p+m}return r(u,"move"),{start:o,end:i,between:s,move:u,items:n}}r(gs,"useSorted");var hn=/((?:(?:(?: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 xs(e){return e.split(hn).map((t,n)=>{let o=dt(t);return n%2?`<a target="_blank" href="${o}">${xn(o)}</a>`:o}).join("")}r(xs,"linkifyPlainText");function xn(e){return e.replace(/^https?:\/\/(www\.)?/,"").replace(/\/$/,"")}r(xn,"toHumanReadableUrl");function Tt(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(Tt,"encodeQuery");function bs(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(bs,"parseQuery");function As(e,t,n){let o=e[t];return o===void 0&&(o=n(t,e),e[t]=o),o}r(As,"ensureKey");async function vs(e,t,n){let o=e[t];return o===void 0&&(o=await n(t,e),e[t]=o),o}r(vs,"ensureKeyAsync");function Ds(e){return e!=null?e.size!=null?e.size:e.length!=null?e.length:Object.keys(e).length:0}r(Ds,"size");function Ps(e){return e!=null&&e.length>0?e[e.length-1]:void 0}r(Ps,"last");function Es(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(Es,"empty");function Se(e){return Object(e)!==e?e:JSON.parse(S(e))}r(Se,"cloneObject");function Ms(e){return Object(e)!==e?e:JSON.parse(S(e))}r(Ms,"cloneJsonObject");function Rs(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(Rs,"memoize");function Ss(e){let t=new Map;return async(...n)=>{let o=S(n);if(t.has(o))return t.get(o);let i=await e(...n);return t.set(o,i),i}}r(Ss,"memoizeAsync");function Us(e,t){let n=[];for(let o=0;o<e;o++)n.push(t(o,e));return n}r(Us,"forTimes");var bn=/\\\s|\s+|#[^\n]*\n?/gm,Tn=/\(\?P?<(\w[\w\d_]+)>|\((?!\?(:|\!|=|<=|<\!))/gm,wt=/^((?:\(\?[\w$]+\))?)\(\?<([=!])([\s\S]*?)\)/gm,wn=A("zeed:xrx","error");function Ln(e){return typeof e=="string"?e:e.source||""}r(Ln,"regExpString");function Cs(e){return e.replace(/[-\[\]{}()*+?.,\\^$|#\s]/g,"\\$&")}r(Cs,"regExpEscape");var Ue=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(bn,a=>a[0]==="\\"?a:"")),!(t instanceof RegExp)){let a=0;i=i.replace(Tn,(l,c)=>(a+=1,c?(c!=="index"&&c!=="length"&&!this.namedGroups[c]?this.namedGroups[c]=a:wn.error(`Unallowed or duplicate group name: ${c}`),"("):l)),this.names=Object.keys(this.namedGroups)}i=Ln(i),wt.lastIndex=0;let u=wt.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(Ue,"XRX");var An=",";function la(e,t={}){let{separator:n=An}=t,o="";for(let i=0;i<e.length;i++)o+=`${e[i].map(s=>{if(s==null||s==="")return"";if(_e(s))return s?1:0;let u=String(s);return(ne(s)||k(s))&&(u=S(s)),u.includes('"')||u.includes(`
6
6
  `)||u.includes(n)?`"${u.replace(/"/g,'""')}"`:u}).join(n)}
7
- `;return o}r(ca,"csvStringify");function vn(e,t={}){let n=/("((?:(?:[^"]*?)(?:"")?)*)"|([^,;\t\n]*))([,;\t]|\n|\r\n)/g;t.separator&&(n=new RegExp(n.source.replaceAll(",;\\t",yt(t.separator)),n.flags));let o=[],i=[],s,u=`${e.replaceAll(`\r
7
+ `;return o}r(la,"csvStringify");function vn(e,t={}){let n=/("((?:(?:[^"]*?)(?:"")?)*)"|([^,;\t\n]*))([,;\t]|\n|\r\n)/g;t.separator&&(n=new RegExp(n.source.replaceAll(",;\\t",yt(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(vn,"csvParse");function la(e,t={}){let n=vn(e,t),o=n[0];return n.slice(1).map(i=>Object.fromEntries(i.map((s,u)=>[o[u],s])))}r(la,"csvParseToObjects");var Dn=A("zeed:dispose","error");async function Pn(e){typeof e=="function"?await I(e()):E(e)?await e:typeof e.dispose=="function"?await I(e.dispose()):E(e.dispose)?await e.dispose:typeof e.cleanup=="function"?await I(e.cleanup()):E(e.cleanup)&&await e.cleanup}r(Pn,"callDisposer");function Fe(e){let{name:t}=typeof e=="string"?{name:e}:e??{},n=[],o=r(async u=>{u!=null&&n.includes(u)&&(ve(n,a=>a!==u),await Pn(u))},"untrack"),i=r(async()=>{for(t&&Dn.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}})}r(Fe,"useDispose");var ya=Fe;function ha(e={}){let{mode:t="fifo"}=e,n=[],o=r(async(s=!1)=>{for(;n.length>0;){let u=n[0];if(ve(n,a=>a!==u),typeof u=="function"){let a=u();if(E(a)){if(s)throw new Error(`Expected sync only function, but found async: ${u}`);await a}}else if(E(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(ha,"useDefer");function xa(e,t=0){let n=setTimeout(e,t);return()=>{n&&(clearTimeout(n),n=void 0)}}r(xa,"useTimeout");function ba(e,t){let n=setInterval(e,t);return()=>{n&&(clearInterval(n),n=void 0)}}r(ba,"useInterval");function Ta(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(Ta,"useEventListener");function va(){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(va,"useMutex");function Da(){let e=!0;return async(t,n)=>{let o=!1;if(e){e=!1;try{let i=t();E(i)&&await i,o=!0}finally{e=!0}}else if(n!==void 0){let i=n();E(i)&&await i}return o}}r(Da,"useAsyncMutex");var Z=A("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;this.dispose.add(()=>{this.subscribers={},this.subscribersOnAny=[]});try{let i=this.subscribers[t]||[];if(this.subscribersOnAny.forEach(s=>s(t,...n)),i.length>0){let s=i.map(u=>{try{return I(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 I(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 ka(){let e=Y().emitter;return e||(e=new M,Y().emitter=e),e}r(ka,"getGlobalEmitter");var Ia=new M;function Ca(e,t){let n=Math.round(D()*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,d)=>{a||(a=t,a||o.length&&(a=o[0].key)),i=r(()=>{for(;o.length>0;){let g=o.shift();if(g.key===a)i=void 0,c(g.obj);else{if(l){Z.warn(n,`Unhandled event ${a} with value: ${g.obj}`);continue}d(new Error(`Expected ${a}, but found ${g.key} with value=${g.obj}`)),Z.error(n,`Unhandled event ${a} with value: ${g.obj}`)}break}},"lazyResolve"),i()}),"on")}r(Ca,"lazyListener");var Lt=r(()=>Date.now(),"getTimestamp");function Ba(e){return e>999?`${(e/1e3).toFixed(1)}s`:`${e.toFixed(2)}ms`}r(Ba,"formatMilliseconds");function Ha(...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(Ha,"parseDate");var{encode:At,decode:En}=H(62),{encode:vt,decode:Mn}=H(32),fe=16;function Ie(){return V(fe)}r(Ie,"uuidBytes");function Rn(e=Ie()){return At(e,22)}r(Rn,"uuidB62");function Sn(e){return At(e,22)}r(Sn,"uuidEncodeB62");function Un(e){return En(e,fe)}r(Un,"uuidDecodeB62");function Fn(e=Ie()){return vt(e,26)}r(Fn,"uuidB32");function kn(e){return vt(e,26)}r(kn,"uuidEncodeB32");function In(e){return Mn(e,fe)}r(In,"uuidDecodeB32");var Cn="10000000-1000-4000-8000-100000000000",On=typeof crypto<"u"&&crypto.randomUUID!=null?crypto.randomUUID.bind(crypto):()=>Cn.replace(/[018]/g,e=>(e^V(1)[0]&15>>e/4).toString(16));function $n(e){let t=Ze(e);return`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16)}`}r($n,"uuidEncodeV4");function Bn(e){return We(e.replaceAll("-",""))}r(Bn,"uuidDecodeV4");var Dt=16e11;function Hn(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(Hn,"longToByteArray");function Pt(){let e=Lt()-Dt;return new Uint8Array([...Hn(e),...V(10)])}r(Pt,"suidBytes");function Va(){return _n(Pt())}r(Va,"suid");function Ja(e){return jn(Mt(e))}r(Ja,"suidDate");function jn(e){return new Date(Dt+e.slice(0,6).reduce((t,n)=>t*256+n,0))}r(jn,"suidBytesDate");var Za=r(()=>new Uint32Array(V(4))[0],"uuid32bit"),Ce={base62:{uuid:Rn,uuidDecode:Un,uuidEncode:Sn},base32:{uuid:Fn,uuidDecode:In,uuidEncode:kn},uuidv4:{uuid:On,uuidDecode:Bn,uuidEncode:$n}},pe="base62",Et=!1;function Wa(e,t=!1){pe=e,Et=t}r(Wa,"setUuidDefaultEncoding");function j(){return Ce[pe].uuid(Et?Pt():Ie())}r(j,"uuid");function Mt(e){return Ce[pe].uuidDecode(e)}r(Mt,"uuidDecode");function _n(e){return Ce[pe].uuidEncode(e)}r(_n,"uuidEncode");function Ka(e){try{return Mt(e).length===fe}catch{}return!1}r(Ka,"uuidIsValid");var ke={};function _(e="id"){return ke[e]==null&&(ke[e]=0),`${e}-${ke[e]++}`}r(_,"uname");var zn=0;function Ya(){return`id-${zn++}`}r(Ya,"qid");var Gn=(o=>(o[o.waiting=0]="waiting",o[o.running=1]="running",o[o.finished=2]="finished",o))(Gn||{}),Nn=(o=>(o[o.replace=0]="replace",o[o.memoize=1]="memoize",o[o.error=2]="error",o))(Nn||{});function ru(e={}){let{maxParallel:t=3}=e,n=new M,o=0,i=0,s=0,u=0,a={};async function l(){if(o>0){let[f,p]=ct();return n.once("didFinish",p),f}}r(l,"waitFinishAll");function c(){n.emit("didFinish"),o=0,i=0}r(c,"didFinish");function d(){let f=0,p=0;for(let{max:m,resolved:T,state:b}of Object.values(a))f+=m,p+=b===2?m:Math.min(m,T);n.emit("didUpdate",o,i,f,p)}r(d,"didUpdate");function g(){if(d(),o>0&&o===i&&c(),s>=t)return;let f=Object.values(a).filter(p=>p.state===0);if(f.length>0){let p;for(let m of f)m.group!=null&&Object.values(a).some(T=>T.state===1&&T.id!==m.id&&T.group===m.group)||(p==null||m.priority<p.priority)&&(p=m);if(p!=null){let m=p.id,T=p.done;p.state=1,++s,n.emit("didStart",m);let b=r(w=>{p&&(p.result=w,p.state=2,p.resolved=p.max),--s,++i,g()},"taskFinished");p.task(p).then(w=>{T(w),n.emit("didResolve",m,w),b(w)}).catch(w=>{T(),n.emit("didReject",m,w),b()})}}}r(g,"performNext");function h(f){let p=a[f];p&&p.state===0&&(a[f].state=2,++i,n.emit("didCancel",f),d())}r(h,"cancel");function y(){Object.keys(a).forEach(h)}r(y,"cancelAll");function x(f,p={}){let m,T=new Promise(w=>m=w),b=p.id??j();if(a[b]!=null){let w=p.idConflictResolution??1;if(w===0)h(b);else if(w===1){let v=a[b];return{id:b,promise:(async()=>{if(v.state===2)return a[b].result})(),dispose:()=>h(b),cancel:()=>h(b)}}else throw new Error(`Pool task with id=${b} already exists!`)}return a[b]={id:b,task:f,priority:++u,group:p.group,state:0,max:p.max??1,resolved:p.resolved??0,done:m,payload:p.payload,setMax(w){a[b].max=w,d()},setResolved(w){a[b].resolved=w,d()},incResolved(w=1){a[b].resolved+=w,d()}},++o,g(),{id:b,promise:T,dispose:()=>h(b),cancel:()=>h(b)}}return r(x,"enqueue"),{events:n,cancel:h,cancelAll:y,enqueue:x,dispose:y,waitFinishAll:l}}r(ru,"usePool");var Oe=class extends M{constructor(n={}){super();this.queue=[];this.waitToFinish=[];this.countMax=0;this.countResolved=0;this.paused=!1;let{name:o=_("queue"),logLevel:i}=n;this.name=o,this.log=A(`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=_(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(Oe,"SerialQueue");var W=!1,U=W?A("zeed:throttle","error"):()=>{};function gu(e,t={}){let{delay:n=100,trailing:o=!0,leading:i=!0}=t,s=0,u=0,a=0,l,c=Date.now();function d(){return s?(clearTimeout(s),s=void 0,!0):!1}r(d,"clearExistingTimeout");function g(...h){let y=Date.now(),x=y-u;function f(){let m=Date.now();return`total ${(m-c).toFixed(1)}ms - elapsed ${(m-u).toFixed(1)}ms - visited ${a}x`}r(f,"debugElapsed");let p=r(()=>{a=0,u=Date.now(),e.apply(this,h)},"exec");if(l=p,x>n||!s){W&&U("elapsed",f()),i&&(x>n?(W&&U("\u{1F680} leading",f()),p()):++a);let m=x>n?n:n-x;U(`\u23F1 start timeout with ${m.toFixed(1)}ms`,f()),d(),u=y,s=setTimeout(()=>{W&&U("\u23F1 reached timeout",f()),s=0,o&&(!i||a>0)&&(W&&U("\u{1F680} trailing",f()),l?.())},m)}else++a,W&&U("visited",f())}return r(g,"wrapper"),g.cancel=d,g.stop=()=>{d()&&l&&l()},g.immediate=r(async function(...y){d(),u=Date.now(),e.apply(this,y)},"immediate"),g.dispose=()=>g.stop(),g}r(gu,"throttle");function mu(e,t={}){let{delay:n=100}=t,o=0,i=!1,s;function u(){o&&(U("clear"),clearTimeout(o),o=0)}r(u,"clearExistingTimeout");async function a(){try{if(u(),s!=null){U("exec");let d=[...s];s=void 0,i=!0,await I(e(...d)),i=!1,U("exec done"),s!=null&&(u(),U("exec trigger next"),o=setTimeout(a,n))}}catch{}}r(a,"exec");function l(...d){s=[...d],u(),U("trigger"),i===!1&&(o=setTimeout(a,n))}r(l,"wrapper");async function c(...d){u(),s=[...d],await a()}return r(c,"immediate"),l.cancel=u,l.dispose=u,l.immediate=c,l}r(mu,"debounce");function xu(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(xu,"isLocalHost");function Lu(e){let{level:t=void 0,filter:n=void 0,messages:o=[]}=e,i=q(n),s=ie(t);return u=>{!s(u.level)||!i(u.name)||o.push(u)}}r(Lu,"LoggerMemoryHandler");var de=class extends M{constructor(){super(...arguments);this.id=j()}close(){this.dispose()}};r(de,"Channel");var ee=class extends de{constructor(){super(...arguments);this.isConnected=!0}postMessage(n){this.other?.emit("message",{data:n,origin:"local",lastEventId:j()})}};r(ee,"LocalChannel");function Eu(){let e=new ee,t=new ee;return e.other=t,t.other=e,[e,t]}r(Eu,"createLocalChannelPair");var $e=class{async encode(t){return t}async decode(t){return t}};r($e,"NoopEncoder");var z=class{async encode(t){return xe(t)}async decode(t){return be(t)}};r(z,"JsonEncoder");var Be=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(Be,"CryptoEncoder");var Rt=r((e,t,n={})=>new Proxy(n,{get:(o,i)=>i in o?o[i]:(...s)=>e(i,s,t)}),"createPromiseProxy");function Hu(e={}){let{name:t=_("hub"),encoder:n=new z,retryAfter:o=1e3,ignoreUnhandled:i=!0,logLevel:s=!1}=e,u=A(t,s),a={},l,c=[],d,g={},h=r(()=>{clearTimeout(d)},"dispose"),y=r(async()=>{if(clearTimeout(d),l){if(l.isConnected)for(;c.length;){let m=c[0];try{l.postMessage(await n.encode(m)),c.shift()}catch(T){u.warn("postMessage",T);break}}c.length>0&&o>0&&(d=setTimeout(y,o))}},"postNext"),x=r(async m=>{u("enqueue postMessage",m),c.push(m),await y()},"postMessage"),f=r(async m=>{l=m,l.on("connect",y),l.on("message",async T=>{u("onmessage",typeof T);let{name:b,args:w,id:v,result:N,error:O}=await n.decode(T.data);if(b){u(`name ${b} id ${v}`);try{if(a[b]==null)throw new Error(`handler for ${b} was not found`);let R=a[b](...w);E(R)&&(R=await R),u(`result ${R}`),v&&x({id:v,result:R})}catch(R){let $=R instanceof Error?R:new Error(De(R));u.warn("execution error",$.name),x({id:v,error:{message:$.message,stack:$.stack,name:$.name}})}}else if(v)if(u(`response for id=${v}: result=${N}, error=${O}`),g[v]==null)N===void 0?u(`skip response for ${v}`):u.warn(`no response hook for ${v}`);else{let[R,$]=g[v];if(R&&$)if(delete g[v],O){let te=new Error(O.message);te.stack=O.stack,te.name=O.name,u.warn("reject",te.name),$(te)}else u("resolve",N),R(N)}else i||u.warn("Unhandled message",T)}),y()},"connect"),p=r(async(m,T,b={})=>{let{timeout:w=5e3}=b,v=j();return x({name:m,args:T,id:v}),pt(new Promise((N,O)=>g[v]=[N,O]),w)},"fetchMessage");return e.channel&&f(e.channel),{dispose:h,connect:f,listen(m){Object.assign(a,m)},send(){return Rt(p,{},{options(m){return Rt(p,{...m})}})}}}r(Hu,"useMessageHub");var ge=class extends M{constructor(n){super();this.publish=this.emit;this.subscribe=this.on;let{name:o,encoder:i=new z,channel:s,debug:u=!1}=n;this.channel=s,this.encoder=i,this.debug=u,this.name=o??this.channel.id??_("pubsub"),this.log=A(`${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:d}=l;await this.emitSuper(c,...d)}})}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(ge,"PubSub");function Vu(e){return new ge(e)}r(Vu,"usePubSub");var qn=1;var St=r(e=>e,"defaultSerialize"),Vn=St;function Wu(e,t){let{post:n,on:o,eventNames:i=[],serialize:s=St,deserialize:u=Vn}=t,a=new Map;return o(async l=>{let c=u(l),[d,g,h,y]=c;if(d===1||d===2){let x,f;if(y!=null)try{x=await e[y](...g)}catch(p){f=String(p)}else f="Method implementation missing";d===1&&h&&n(s(f?[4,f,h]:[3,x,h]))}else if(h){let x=a.get(h);x!=null&&(d===4?x.reject(g):x.resolve(g)),a.delete(h)}}),new Proxy({},{get(l,c){let d=r((...h)=>{n(s([2,h,null,c]))},"sendEvent");if(t.onlyEvents||i.includes(c))return d.asEvent=d,d;let g=r((...h)=>new Promise((y,x)=>{let f=qn++;a.set(f,{resolve:y,reject:x}),n(s([1,h,f,c]))}),"sendCall");return g.asEvent=d,g}})}r(Wu,"useRPC");var K=A("zeed:network","error"),He={cache:"no-cache",redirect:"follow",headers:{}};function Jn(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(Jn,"parseBasicAuth");async function Ut(e,t={},n=fetch){try{k(t)&&(t=oe({},...J(t)));let o=Jn(String(e));o&&(e=o.url,t=oe({},t,Zn(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{K.warn(`Fetch of ${e} with ${t} returned status=${i.status}`),K.warn(`Response: ${await i.text()}`)}catch(s){K.error("Exception:",s)}}catch(o){K.error("fetchBasic",o)}}r(Ut,"fetchBasic");async function tc(e,t={},n=fetch){try{let o=await Ut(e,[{method:"GET",headers:{Accept:"application/json"}},t],n);if(o)return await o.json()}catch(o){K.error("fetchJSON error:",o)}}r(tc,"fetchJson");async function nc(e,t={},n=fetch){try{let o=await Ut(e,[He,{method:"GET"},t],n);if(o)return await o.text()}catch(o){K.error("fetchHTML error:",o)}}r(nc,"fetchText");function rc(e,t="POST"){return{method:t,...He,headers:{"Content-Type":"application/x-www-form-urlencoded; charset=utf-8"},body:Tt(e)}}r(rc,"fetchOptionsFormURLEncoded");function oc(e,t="POST"){return{method:t,...He,headers:{"Content-Type":"application/json; charset=utf-8"},body:S(e)}}r(oc,"fetchOptionsJson");function Zn(e,t){return{headers:{Authorization:`Basic ${Ke(`${e}:${t}`)}`}}}r(Zn,"fetchOptionsBasicAuth");function Ft(){if(typeof window<"u")return window}r(Ft,"getWindow");function Wn(){if(typeof navigator<"u")return navigator}r(Wn,"getNavigator");function ac(){return Ft()??typeof WorkerGlobalScope<"u"?self:typeof global<"u"?global:Function("return this;")()}r(ac,"getGlobal");var C=Wn(),G=Ft();function Kn(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=C?.platform?.match(/(iPhone|iPod|iPad)/i)!=null,e.macos=!!C?.platform?.startsWith("Mac"),e.windows=!!C?.platform?.startsWith("Win"),e.beaker=G?.beaker!=null,e.electron=(C?.userAgent?.toLowerCase()?.indexOf(" electron/")||-1)>-1&&!e.beaker,e.wkwebview=G?.webkit?.messageHandlers!=null,e.pwa=C?.serviceWorker!=null,e.pwaInstalled=C?.standalone||G?.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=G&&"ontouchstart"in G||(C?.maxTouchPoints||0)>1||C?.msPointerEnabled&&G?.MSGesture||G?.DocumentTouch&&document instanceof DocumentTouch,e}r(Kn,"detect");var Yn=r(()=>typeof window<"u"&&globalThis===window,"isBrowser"),uc=Kn();function cc(e){Yn()?window.addEventListener("beforeunload",e):typeof process<"u"&&process.on("exit",()=>e)}r(cc,"useExitHandler");var je=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(je,"MemStorage");export{r as a,Y as b,F as c,me as d,k as e,ne as f,tr as g,nr as h,rr as i,or as j,_e as k,ir as l,sr as m,re as n,Ct as o,oe as p,Ot as q,q as r,ye as s,ie as t,se as u,Q as v,ze as w,Ge as x,Ht as y,A as z,Rr as A,S as B,Sr as C,_t as D,zt as E,Ve as F,Je as G,P as H,Cr as I,Ze as J,We as K,Ke as L,Or as M,Gt as N,$r as O,Ye as P,xe as Q,be as R,Qe as S,V as T,et as U,Te as V,Xe as W,Nt as X,_r as Y,zr as Z,tt as _,nt as $,qt as aa,D as ba,qr as ca,Vr as da,Jr as ea,Zr as fa,Vt as ga,Wr as ha,Kr as ia,Yr as ja,Qr as ka,Jt as la,to as ma,Le as na,no as oa,Ae as pa,Zt as qa,Wt as ra,J as sa,Kt as ta,ao as ua,uo as va,co as wa,ve as xa,lo as ya,fo as za,Yt as Aa,po as Ba,Qt as Ca,rt as Da,go as Ea,mo as Fa,yo as Ga,ho as Ha,xo as Ia,bo as Ja,To as Ka,wo as La,Lo as Ma,H as Na,Eo as Oa,Mo as Pa,Ro as Qa,So as Ra,Uo as Sa,Fo as Ta,ko as Ua,Io as Va,Co as Wa,Bo as Xa,nn as Ya,Ho as Za,jo as _a,No as $a,qo as ab,Vo as bb,rn as cb,on as db,sn as eb,De as fb,Jo as gb,Zo as hb,Wo as ib,Ko as jb,an as kb,Yo as lb,Qo as mb,Ee as nb,Me as ob,it as pb,un as qb,ti as rb,st as sb,ni as tb,ri as ub,oi as vb,le as wb,ii as xb,Pe as yb,cn as zb,ln as Ab,Re as Bb,at as Cb,si as Db,ai as Eb,ui as Fb,ci as Gb,ct as Hb,di as Ib,gi as Jb,lt as Kb,mi as Lb,ft as Mb,yi as Nb,pt as Ob,hi as Pb,E as Qb,I as Rb,L as Sb,Li as Tb,Ai as Ub,vi as Vb,Di as Wb,fn as Xb,Mi as Yb,Ri as Zb,Si as _b,dt as $b,ki as ac,Oi as bc,$i as cc,Bi as dc,zi as ec,Gi as fc,Ni as gc,Ji as hc,yt as ic,X as jc,ht as kc,Qi as lc,Xi as mc,es as nc,ts as oc,ns as pc,rs as qc,os as rc,is as sc,xt as tc,bt as uc,cs as vc,yn as wc,ds as xc,hs as yc,xn as zc,Tt as Ac,xs as Bc,Ls as Cc,As as Dc,vs as Ec,Ds as Fc,Ps as Gc,Se as Hc,Es as Ic,Ms as Jc,Rs as Kc,Ss as Lc,Ln as Mc,Is as Nc,Ue as Oc,ca as Pc,vn as Qc,la as Rc,Fe as Sc,ya as Tc,ha as Uc,xa as Vc,ba as Wc,Ta as Xc,va as Yc,Da as Zc,M as _c,ka as $c,Ia as ad,Ca as bd,Lt as cd,Ba as dd,Ha as ed,Ie as fd,Rn as gd,Sn as hd,Un as id,Fn as jd,kn as kd,In as ld,On as md,$n as nd,Bn as od,Pt as pd,Va as qd,Ja as rd,jn as sd,Za as td,Wa as ud,j as vd,Mt as wd,_n as xd,Ka as yd,_ as zd,Ya as Ad,Gn as Bd,Nn as Cd,ru as Dd,Oe as Ed,gu as Fd,mu as Gd,xu as Hd,Lu as Id,de as Jd,ee as Kd,Eu as Ld,$e as Md,z as Nd,Be as Od,Rt as Pd,Hu as Qd,ge as Rd,Vu as Sd,Wu as Td,Jn as Ud,Ut as Vd,tc as Wd,nc as Xd,rc as Yd,oc as Zd,Zn as _d,Ft as $d,Wn as ae,ac as be,Kn as ce,Yn as de,uc as ee,cc as fe,je as ge};
12
- //# sourceMappingURL=chunk-TSTVHMYO.js.map
11
+ `&&(o.push(i),i=[])}return o}r(vn,"csvParse");function fa(e,t={}){let n=vn(e,t),o=n[0];return n.slice(1).map(i=>Object.fromEntries(i.map((s,u)=>[o[u],s])))}r(fa,"csvParseToObjects");var Dn=A("zeed:dispose","error");async function Pn(e){typeof e=="function"?await I(e()):E(e)?await e:typeof e.dispose=="function"?await I(e.dispose()):E(e.dispose)?await e.dispose:typeof e.cleanup=="function"?await I(e.cleanup()):E(e.cleanup)&&await e.cleanup}r(Pn,"callDisposer");function Fe(e){let{name:t}=typeof e=="string"?{name:e}:e??{},n=[],o=r(async u=>{u!=null&&n.includes(u)&&(ve(n,a=>a!==u),await Pn(u))},"untrack"),i=r(async()=>{for(t&&Dn.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}})}r(Fe,"useDispose");var ha=Fe;function xa(e={}){let{mode:t="fifo"}=e,n=[],o=r(async(s=!1)=>{for(;n.length>0;){let u=n[0];if(ve(n,a=>a!==u),typeof u=="function"){let a=u();if(E(a)){if(s)throw new Error(`Expected sync only function, but found async: ${u}`);await a}}else if(E(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(xa,"useDefer");function ba(e,t=0){let n=setTimeout(e,t);return()=>{n&&(clearTimeout(n),n=void 0)}}r(ba,"useTimeout");function Ta(e,t){let n=setInterval(e,t);return()=>{n&&(clearInterval(n),n=void 0)}}r(Ta,"useInterval");function wa(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(wa,"useEventListener");function Da(){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(Da,"useMutex");function Pa(){let e=!0;return async(t,n)=>{let o=!1;if(e){e=!1;try{let i=t();E(i)&&await i,o=!0}finally{e=!0}}else if(n!==void 0){let i=n();E(i)&&await i}return o}}r(Pa,"useAsyncMutex");var Z=A("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;this.dispose.add(()=>{this.subscribers={},this.subscribersOnAny=[]});try{let i=this.subscribers[t]||[];if(this.subscribersOnAny.forEach(s=>s(t,...n)),i.length>0){let s=i.map(u=>{try{return I(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 I(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 Ia(){let e=Y().emitter;return e||(e=new M,Y().emitter=e),e}r(Ia,"getGlobalEmitter");var Ca=new M;function Oa(e,t){let n=Math.round(D()*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,d)=>{a||(a=t,a||o.length&&(a=o[0].key)),i=r(()=>{for(;o.length>0;){let g=o.shift();if(g.key===a)i=void 0,c(g.obj);else{if(l){Z.warn(n,`Unhandled event ${a} with value: ${g.obj}`);continue}d(new Error(`Expected ${a}, but found ${g.key} with value=${g.obj}`)),Z.error(n,`Unhandled event ${a} with value: ${g.obj}`)}break}},"lazyResolve"),i()}),"on")}r(Oa,"lazyListener");var Lt=r(()=>Date.now(),"getTimestamp");function Ha(e){return e>999?`${(e/1e3).toFixed(1)}s`:`${e.toFixed(2)}ms`}r(Ha,"formatMilliseconds");function ja(...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(ja,"parseDate");var{encode:At,decode:En}=H(62),{encode:vt,decode:Mn}=H(32),fe=16;function Ie(){return V(fe)}r(Ie,"uuidBytes");function Rn(e=Ie()){return At(e,22)}r(Rn,"uuidB62");function Sn(e){return At(e,22)}r(Sn,"uuidEncodeB62");function Un(e){return En(e,fe)}r(Un,"uuidDecodeB62");function Fn(e=Ie()){return vt(e,26)}r(Fn,"uuidB32");function kn(e){return vt(e,26)}r(kn,"uuidEncodeB32");function In(e){return Mn(e,fe)}r(In,"uuidDecodeB32");var Cn="10000000-1000-4000-8000-100000000000",On=typeof crypto<"u"&&crypto.randomUUID!=null?crypto.randomUUID.bind(crypto):()=>Cn.replace(/[018]/g,e=>(e^V(1)[0]&15>>e/4).toString(16));function $n(e){let t=Ze(e);return`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16)}`}r($n,"uuidEncodeV4");function Bn(e){return We(e.replaceAll("-",""))}r(Bn,"uuidDecodeV4");var Dt=16e11;function Hn(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(Hn,"longToByteArray");function Pt(){let e=Lt()-Dt;return new Uint8Array([...Hn(e),...V(10)])}r(Pt,"suidBytes");function Ja(){return _n(Pt())}r(Ja,"suid");function Za(e){return jn(Mt(e))}r(Za,"suidDate");function jn(e){return new Date(Dt+e.slice(0,6).reduce((t,n)=>t*256+n,0))}r(jn,"suidBytesDate");var Wa=r(()=>new Uint32Array(V(4))[0],"uuid32bit"),Ce={base62:{uuid:Rn,uuidDecode:Un,uuidEncode:Sn},base32:{uuid:Fn,uuidDecode:In,uuidEncode:kn},uuidv4:{uuid:On,uuidDecode:Bn,uuidEncode:$n}},pe="base62",Et=!1;function Ka(e,t=!1){pe=e,Et=t}r(Ka,"setUuidDefaultEncoding");function j(){return Ce[pe].uuid(Et?Pt():Ie())}r(j,"uuid");function Mt(e){return Ce[pe].uuidDecode(e)}r(Mt,"uuidDecode");function _n(e){return Ce[pe].uuidEncode(e)}r(_n,"uuidEncode");function Ya(e){try{return Mt(e).length===fe}catch{}return!1}r(Ya,"uuidIsValid");var ke={};function _(e="id"){return ke[e]==null&&(ke[e]=0),`${e}-${ke[e]++}`}r(_,"uname");var zn=0;function Qa(){return`id-${zn++}`}r(Qa,"qid");var Gn=(o=>(o[o.waiting=0]="waiting",o[o.running=1]="running",o[o.finished=2]="finished",o))(Gn||{}),Nn=(o=>(o[o.replace=0]="replace",o[o.memoize=1]="memoize",o[o.error=2]="error",o))(Nn||{});function ou(e={}){let{maxParallel:t=3}=e,n=new M,o=0,i=0,s=0,u=0,a={};async function l(){if(o>0){let[f,p]=ct();return n.once("didFinish",p),f}}r(l,"waitFinishAll");function c(){n.emit("didFinish"),o=0,i=0}r(c,"didFinish");function d(){let f=0,p=0;for(let{max:m,resolved:T,state:b}of Object.values(a))f+=m,p+=b===2?m:Math.min(m,T);n.emit("didUpdate",o,i,f,p)}r(d,"didUpdate");function g(){if(d(),o>0&&o===i&&c(),s>=t)return;let f=Object.values(a).filter(p=>p.state===0);if(f.length>0){let p;for(let m of f)m.group!=null&&Object.values(a).some(T=>T.state===1&&T.id!==m.id&&T.group===m.group)||(p==null||m.priority<p.priority)&&(p=m);if(p!=null){let m=p.id,T=p.done;p.state=1,++s,n.emit("didStart",m);let b=r(w=>{p&&(p.result=w,p.state=2,p.resolved=p.max),--s,++i,g()},"taskFinished");p.task(p).then(w=>{T(w),n.emit("didResolve",m,w),b(w)}).catch(w=>{T(),n.emit("didReject",m,w),b()})}}}r(g,"performNext");function h(f){let p=a[f];p&&p.state===0&&(a[f].state=2,++i,n.emit("didCancel",f),d())}r(h,"cancel");function y(){Object.keys(a).forEach(h)}r(y,"cancelAll");function x(f,p={}){let m,T=new Promise(w=>m=w),b=p.id??j();if(a[b]!=null){let w=p.idConflictResolution??1;if(w===0)h(b);else if(w===1){let v=a[b];return{id:b,promise:(async()=>{if(v.state===2)return a[b].result})(),dispose:()=>h(b),cancel:()=>h(b)}}else throw new Error(`Pool task with id=${b} already exists!`)}return a[b]={id:b,task:f,priority:++u,group:p.group,state:0,max:p.max??1,resolved:p.resolved??0,done:m,payload:p.payload,setMax(w){a[b].max=w,d()},setResolved(w){a[b].resolved=w,d()},incResolved(w=1){a[b].resolved+=w,d()}},++o,g(),{id:b,promise:T,dispose:()=>h(b),cancel:()=>h(b)}}return r(x,"enqueue"),{events:n,cancel:h,cancelAll:y,enqueue:x,dispose:y,waitFinishAll:l}}r(ou,"usePool");var Oe=class extends M{constructor(n={}){super();this.queue=[];this.waitToFinish=[];this.countMax=0;this.countResolved=0;this.paused=!1;let{name:o=_("queue"),logLevel:i}=n;this.name=o,this.log=A(`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=_(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(Oe,"SerialQueue");var W=!1,U=W?A("zeed:throttle","error"):()=>{};function mu(e,t={}){let{delay:n=100,trailing:o=!0,leading:i=!0}=t,s=0,u=0,a=0,l,c=Date.now();function d(){return s?(clearTimeout(s),s=void 0,!0):!1}r(d,"clearExistingTimeout");function g(...h){let y=Date.now(),x=y-u;function f(){let m=Date.now();return`total ${(m-c).toFixed(1)}ms - elapsed ${(m-u).toFixed(1)}ms - visited ${a}x`}r(f,"debugElapsed");let p=r(()=>{a=0,u=Date.now(),e.apply(this,h)},"exec");if(l=p,x>n||!s){W&&U("elapsed",f()),i&&(x>n?(W&&U("\u{1F680} leading",f()),p()):++a);let m=x>n?n:n-x;U(`\u23F1 start timeout with ${m.toFixed(1)}ms`,f()),d(),u=y,s=setTimeout(()=>{W&&U("\u23F1 reached timeout",f()),s=0,o&&(!i||a>0)&&(W&&U("\u{1F680} trailing",f()),l?.())},m)}else++a,W&&U("visited",f())}return r(g,"wrapper"),g.cancel=d,g.stop=()=>{d()&&l&&l()},g.immediate=r(async function(...y){d(),u=Date.now(),e.apply(this,y)},"immediate"),g.dispose=()=>g.stop(),g}r(mu,"throttle");function yu(e,t={}){let{delay:n=100}=t,o=0,i=!1,s;function u(){o&&(U("clear"),clearTimeout(o),o=0)}r(u,"clearExistingTimeout");async function a(){try{if(u(),s!=null){U("exec");let d=[...s];s=void 0,i=!0,await I(e(...d)),i=!1,U("exec done"),s!=null&&(u(),U("exec trigger next"),o=setTimeout(a,n))}}catch{}}r(a,"exec");function l(...d){s=[...d],u(),U("trigger"),i===!1&&(o=setTimeout(a,n))}r(l,"wrapper");async function c(...d){u(),s=[...d],await a()}return r(c,"immediate"),l.cancel=u,l.dispose=u,l.immediate=c,l}r(yu,"debounce");function bu(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(bu,"isLocalHost");function Au(e){let{level:t=void 0,filter:n=void 0,messages:o=[]}=e,i=q(n),s=ie(t);return u=>{!s(u.level)||!i(u.name)||o.push(u)}}r(Au,"LoggerMemoryHandler");var de=class extends M{constructor(){super(...arguments);this.id=j()}close(){this.dispose()}};r(de,"Channel");var ee=class extends de{constructor(){super(...arguments);this.isConnected=!0}postMessage(n){this.other?.emit("message",{data:n,origin:"local",lastEventId:j()})}};r(ee,"LocalChannel");function Mu(){let e=new ee,t=new ee;return e.other=t,t.other=e,[e,t]}r(Mu,"createLocalChannelPair");var $e=class{async encode(t){return t}async decode(t){return t}};r($e,"NoopEncoder");var z=class{async encode(t){return xe(t)}async decode(t){return be(t)}};r(z,"JsonEncoder");var Be=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(Be,"CryptoEncoder");var Rt=r((e,t,n={})=>new Proxy(n,{get:(o,i)=>i in o?o[i]:(...s)=>e(i,s,t)}),"createPromiseProxy");function ju(e={}){let{name:t=_("hub"),encoder:n=new z,retryAfter:o=1e3,ignoreUnhandled:i=!0,logLevel:s=!1}=e,u=A(t,s),a={},l,c=[],d,g={},h=r(()=>{clearTimeout(d)},"dispose"),y=r(async()=>{if(clearTimeout(d),l){if(l.isConnected)for(;c.length;){let m=c[0];try{l.postMessage(await n.encode(m)),c.shift()}catch(T){u.warn("postMessage",T);break}}c.length>0&&o>0&&(d=setTimeout(y,o))}},"postNext"),x=r(async m=>{u("enqueue postMessage",m),c.push(m),await y()},"postMessage"),f=r(async m=>{l=m,l.on("connect",y),l.on("message",async T=>{u("onmessage",typeof T);let{name:b,args:w,id:v,result:N,error:O}=await n.decode(T.data);if(b){u(`name ${b} id ${v}`);try{if(a[b]==null)throw new Error(`handler for ${b} was not found`);let R=a[b](...w);E(R)&&(R=await R),u(`result ${R}`),v&&x({id:v,result:R})}catch(R){let $=R instanceof Error?R:new Error(De(R));u.warn("execution error",$.name),x({id:v,error:{message:$.message,stack:$.stack,name:$.name}})}}else if(v)if(u(`response for id=${v}: result=${N}, error=${O}`),g[v]==null)N===void 0?u(`skip response for ${v}`):u.warn(`no response hook for ${v}`);else{let[R,$]=g[v];if(R&&$)if(delete g[v],O){let te=new Error(O.message);te.stack=O.stack,te.name=O.name,u.warn("reject",te.name),$(te)}else u("resolve",N),R(N)}else i||u.warn("Unhandled message",T)}),y()},"connect"),p=r(async(m,T,b={})=>{let{timeout:w=5e3}=b,v=j();return x({name:m,args:T,id:v}),pt(new Promise((N,O)=>g[v]=[N,O]),w)},"fetchMessage");return e.channel&&f(e.channel),{dispose:h,connect:f,listen(m){Object.assign(a,m)},send(){return Rt(p,{},{options(m){return Rt(p,{...m})}})}}}r(ju,"useMessageHub");var ge=class extends M{constructor(n){super();this.publish=this.emit;this.subscribe=this.on;let{name:o,encoder:i=new z,channel:s,debug:u=!1}=n;this.channel=s,this.encoder=i,this.debug=u,this.name=o??this.channel.id??_("pubsub"),this.log=A(`${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:d}=l;await this.emitSuper(c,...d)}})}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(ge,"PubSub");function Ju(e){return new ge(e)}r(Ju,"usePubSub");var qn=1;var St=r(e=>e,"defaultSerialize"),Vn=St;function Ku(e,t){let{post:n,on:o,eventNames:i=[],serialize:s=St,deserialize:u=Vn}=t,a=new Map;return o(async l=>{let c=u(l),[d,g,h,y]=c;if(d===1||d===2){let x,f;if(y!=null)try{x=await e[y](...g)}catch(p){f=String(p)}else f="Method implementation missing";d===1&&h&&n(s(f?[4,f,h]:[3,x,h]))}else if(h){let x=a.get(h);x!=null&&(d===4?x.reject(g):x.resolve(g)),a.delete(h)}}),new Proxy({},{get(l,c){let d=r((...h)=>{n(s([2,h,null,c]))},"sendEvent");if(t.onlyEvents||i.includes(c))return d.asEvent=d,d;let g=r((...h)=>new Promise((y,x)=>{let f=qn++;a.set(f,{resolve:y,reject:x}),n(s([1,h,f,c]))}),"sendCall");return g.asEvent=d,g}})}r(Ku,"useRPC");var K=A("zeed:network","error"),He={cache:"no-cache",redirect:"follow",headers:{}};function Jn(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(Jn,"parseBasicAuth");async function Ut(e,t={},n=fetch){try{k(t)&&(t=oe({},...J(t)));let o=Jn(String(e));o&&(e=o.url,t=oe({},t,Zn(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{K.warn(`Fetch of ${e} with ${t} returned status=${i.status}`),K.warn(`Response: ${await i.text()}`)}catch(s){K.error("Exception:",s)}}catch(o){K.error("fetchBasic",o)}}r(Ut,"fetchBasic");async function nc(e,t={},n=fetch){try{let o=await Ut(e,[{method:"GET",headers:{Accept:"application/json"}},t],n);if(o)return await o.json()}catch(o){K.error("fetchJSON error:",o)}}r(nc,"fetchJson");async function rc(e,t={},n=fetch){try{let o=await Ut(e,[He,{method:"GET"},t],n);if(o)return await o.text()}catch(o){K.error("fetchHTML error:",o)}}r(rc,"fetchText");function oc(e,t="POST"){return{method:t,...He,headers:{"Content-Type":"application/x-www-form-urlencoded; charset=utf-8"},body:Tt(e)}}r(oc,"fetchOptionsFormURLEncoded");function ic(e,t="POST"){return{method:t,...He,headers:{"Content-Type":"application/json; charset=utf-8"},body:S(e)}}r(ic,"fetchOptionsJson");function Zn(e,t){return{headers:{Authorization:`Basic ${Ke(`${e}:${t}`)}`}}}r(Zn,"fetchOptionsBasicAuth");function Ft(){if(typeof window<"u")return window}r(Ft,"getWindow");function Wn(){if(typeof navigator<"u")return navigator}r(Wn,"getNavigator");function uc(){return Ft()??typeof WorkerGlobalScope<"u"?self:typeof global<"u"?global:Function("return this;")()}r(uc,"getGlobal");var C=Wn(),G=Ft();function Kn(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=C?.platform?.match(/(iPhone|iPod|iPad)/i)!=null,e.macos=!!C?.platform?.startsWith("Mac"),e.windows=!!C?.platform?.startsWith("Win"),e.beaker=G?.beaker!=null,e.electron=(C?.userAgent?.toLowerCase()?.indexOf(" electron/")||-1)>-1&&!e.beaker,e.wkwebview=G?.webkit?.messageHandlers!=null,e.pwa=C?.serviceWorker!=null,e.pwaInstalled=C?.standalone||G?.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=G&&"ontouchstart"in G||(C?.maxTouchPoints||0)>1||C?.msPointerEnabled&&G?.MSGesture||G?.DocumentTouch&&document instanceof DocumentTouch,e}r(Kn,"detect");var Yn=r(()=>typeof window<"u"&&globalThis===window,"isBrowser"),cc=Kn();function lc(e){Yn()?window.addEventListener("beforeunload",e):typeof process<"u"&&process.on("exit",()=>e)}r(lc,"useExitHandler");var je=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(je,"MemStorage");export{r as a,Y as b,F as c,me as d,k as e,ne as f,tr as g,nr as h,rr as i,or as j,_e as k,ir as l,sr as m,re as n,Ct as o,oe as p,Ot as q,q as r,ye as s,ie as t,se as u,Q as v,ze as w,Ge as x,Ht as y,A as z,Rr as A,S as B,Sr as C,_t as D,zt as E,Ve as F,Je as G,P as H,Cr as I,Ze as J,We as K,Ke as L,Or as M,Gt as N,$r as O,Ye as P,xe as Q,be as R,Qe as S,V as T,et as U,Te as V,Xe as W,Nt as X,_r as Y,zr as Z,tt as _,nt as $,qt as aa,D as ba,qr as ca,Vr as da,Jr as ea,Zr as fa,Vt as ga,Wr as ha,Kr as ia,Yr as ja,Qr as ka,Jt as la,to as ma,Le as na,no as oa,Ae as pa,Zt as qa,Wt as ra,J as sa,Kt as ta,ao as ua,uo as va,co as wa,ve as xa,lo as ya,fo as za,Yt as Aa,po as Ba,Qt as Ca,rt as Da,go as Ea,mo as Fa,yo as Ga,ho as Ha,xo as Ia,bo as Ja,To as Ka,wo as La,Lo as Ma,H as Na,Eo as Oa,Mo as Pa,Ro as Qa,So as Ra,Uo as Sa,Fo as Ta,ko as Ua,Io as Va,Co as Wa,Bo as Xa,nn as Ya,Ho as Za,jo as _a,No as $a,qo as ab,Vo as bb,rn as cb,on as db,sn as eb,De as fb,Jo as gb,Zo as hb,Wo as ib,Ko as jb,an as kb,Yo as lb,Qo as mb,Ee as nb,Me as ob,it as pb,un as qb,ti as rb,st as sb,ni as tb,ri as ub,oi as vb,le as wb,ii as xb,Pe as yb,cn as zb,ln as Ab,Re as Bb,at as Cb,si as Db,ai as Eb,ui as Fb,ci as Gb,ct as Hb,di as Ib,gi as Jb,lt as Kb,mi as Lb,ft as Mb,yi as Nb,pt as Ob,hi as Pb,E as Qb,I as Rb,L as Sb,Li as Tb,Ai as Ub,vi as Vb,Di as Wb,fn as Xb,Mi as Yb,Ri as Zb,Si as _b,dt as $b,ki as ac,Oi as bc,$i as cc,Bi as dc,Hi as ec,Gi as fc,Ni as gc,qi as hc,Zi as ic,yt as jc,X as kc,ht as lc,Xi as mc,es as nc,ts as oc,ns as pc,rs as qc,os as rc,is as sc,ss as tc,xt as uc,bt as vc,ls as wc,yn as xc,gs as yc,xs as zc,xn as Ac,Tt as Bc,bs as Cc,As as Dc,vs as Ec,Ds as Fc,Ps as Gc,Es as Hc,Se as Ic,Ms as Jc,Rs as Kc,Ss as Lc,Us as Mc,Ln as Nc,Cs as Oc,Ue as Pc,la as Qc,vn as Rc,fa as Sc,Fe as Tc,ha as Uc,xa as Vc,ba as Wc,Ta as Xc,wa as Yc,Da as Zc,Pa as _c,M as $c,Ia as ad,Ca as bd,Oa as cd,Lt as dd,Ha as ed,ja as fd,Ie as gd,Rn as hd,Sn as id,Un as jd,Fn as kd,kn as ld,In as md,On as nd,$n as od,Bn as pd,Pt as qd,Ja as rd,Za as sd,jn as td,Wa as ud,Ka as vd,j as wd,Mt as xd,_n as yd,Ya as zd,_ as Ad,Qa as Bd,Gn as Cd,Nn as Dd,ou as Ed,Oe as Fd,mu as Gd,yu as Hd,bu as Id,Au as Jd,de as Kd,ee as Ld,Mu as Md,$e as Nd,z as Od,Be as Pd,Rt as Qd,ju as Rd,ge as Sd,Ju as Td,Ku as Ud,Jn as Vd,Ut as Wd,nc as Xd,rc as Yd,oc as Zd,ic as _d,Zn as $d,Ft as ae,Wn as be,uc as ce,Kn as de,Yn as ee,cc as fe,lc as ge,je as he};
12
+ //# sourceMappingURL=chunk-AWOJTE2Y.js.map