zeed 0.7.96 → 0.7.97
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-ADCVWBB3.js → chunk-7YV5VFZP.js} +2 -2
- package/dist/{chunk-ADCVWBB3.js.map → chunk-7YV5VFZP.js.map} +0 -0
- package/dist/chunk-BHQJ5YK3.js +5 -0
- package/dist/{chunk-LUHXAZ6G.js.map → chunk-BHQJ5YK3.js.map} +1 -1
- package/dist/{chunk-V4FSO3ZW.js → chunk-H5ICAAIH.js} +2 -2
- package/dist/{chunk-V4FSO3ZW.js.map → chunk-H5ICAAIH.js.map} +0 -0
- package/dist/index.all.cjs +9 -9
- package/dist/index.all.cjs.map +1 -1
- package/dist/index.all.js +1 -1
- package/dist/index.browser.cjs +4 -4
- package/dist/index.browser.cjs.map +1 -1
- package/dist/index.browser.js +1 -1
- package/dist/index.node.cjs +9 -9
- package/dist/index.node.cjs.map +1 -1
- package/dist/index.node.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-LUHXAZ6G.js +0 -5
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import{Xa as K,ib as j,oa as $}from"./chunk-
|
|
1
|
+
import{Xa as K,ib as j,oa as $}from"./chunk-BHQJ5YK3.js";import{c as l,q as T,r as F,s as m,x,y as P,z as _}from"./chunk-LNZLD7Y3.js";import O from"fs";import{resolve as ae}from"path";var L=x("zeed:env"),ce=`
|
|
2
2
|
`,fe=/^\s*([\w_.-]+)\s*=\s*(.*)?\s*$/,ge=/\\n/g,ue=/\n|\r|\r\n/;function U(e,t={}){let r={};return e.toString().split(ue).forEach(function(n,i){let o=n.match(fe);if(o!=null){let c=o[1],s=o[2]||"",g=s.length-1,p=s[0]==='"'&&s[g]==='"';s[0]==="'"&&s[g]==="'"||p?(s=s.substring(1,g),p&&(s=s.replace(ge,ce))):s=s.trim(),r[c]=s}else L.debug(`did not match key and value when parsing line ${i+1}: ${n}`)}),r}l(U,"parse");function me(e,t="."){return ae(process.cwd(),e!=null?e:t)}l(me,"stringToPath");function de(e,t=""){return e==null&&(e=t),me(String(e).trim(),t)}l(de,"valueToPath");var R=de;function Ie(e={}){var i,o,c,s;let t=(o=e==null?void 0:e.path)!=null?o:R((i=e==null?void 0:e.filename)!=null?i:".env"),r=(c=e==null?void 0:e.encoding)!=null?c:"utf8",n=(e==null?void 0:e.debug)||!1;n!==!0&&(L.level=m.off);try{let g=O.existsSync(t)?U(O.readFileSync(t,{encoding:r}),{debug:n}):{},p=O.existsSync(t+".local")?U(O.readFileSync(t+".local",{encoding:r}),{debug:n}):{},y=Object.assign({},g,p),f=(s=e==null?void 0:e.env)!=null?s:process.env;return Object.entries(y).forEach(([u,d])=>{typeof(e==null?void 0:e.prefix)=="string"&&(u=(e==null?void 0:e.prefix)+u),Object.prototype.hasOwnProperty.call(f,u)?L.debug(`"${u}" is already defined and will not be overwritten`):d!=null&&(L.info(`set env.${u} = ${d}`),f[u]=d)}),{parsed:y}}catch(g){return L.error(g),{error:g}}}l(Ie,"setupEnv");import{mkdirSync as pe,readdirSync as he,readFileSync as Y,rmSync as ye,unlinkSync as be,writeFileSync as Se}from"fs";import{dirname as ve,resolve as J}from"path";var B=x("zeed:filestorage"),Q=class{constructor(t={}){this.store={};this.fileKeys=void 0;this.pretty=!1;var r,n,i,o;this.dirname=J(process.cwd(),t.path||".fileStorage"),this.pretty=!!t.pretty,this.extension=(r=t.extension)!=null?r:".json",t.extension&&!this.extension.startsWith(".")&&(this.extension="."+this.extension),this.extensionLength=this.extension.length,this.objectToString=(n=t.objectToString)!=null?n:c=>this.pretty?JSON.stringify(c,null,2):JSON.stringify(c),this.objectFromString=(i=t.objectFromString)!=null?i:c=>{try{return JSON.parse(c)}catch(s){B.warn(`fileStorage parse error '${s}' in`,c)}},this.keyToFilename=(o=t.keyToFilename)!=null?o:K}setItem(t,r){this.store[t]=j(r);try{let n=this.objectToString(r),i=this.getPath(t);pe(ve(i),{recursive:!0}),Se(i,n,"utf8")}catch(n){B.error("setItem error",n)}}getPath(t){return J(this.dirname,this.keyToFilename(t)+this.extension)}getBuffer(t){let r=this.getPath(t);return Buffer.from(Y(r))}getItem(t){let r=this.store[t];if(r!==null){if(r!=null)return j(r);try{let n=this.getPath(t),i=Y(n,"utf8");if(i!=null){let o=this.objectFromString(i);return this.store[t]=o,o}}catch(n){B.warn("getItem error",n),this.store[t]=null}}}removeItem(t){if(delete this.store[t],this.fileKeys!=null){let r=this.fileKeys.indexOf(t);r!==-1&&this.fileKeys.splice(r,1)}try{let r=this.getPath(t);be(r)}catch{}}clear(){this.fileKeys=[],this.store={},ye(this.dirname,{recursive:!0,force:!0})}allKeys(){if(this.fileKeys==null)try{this.fileKeys=he(this.dirname,{withFileTypes:!0}).filter(r=>!r.isDirectory()&&r.name.endsWith(this.extension)).map(r=>r.name.slice(0,-this.extensionLength))||[]}catch{}let t=[...this.fileKeys||[]];for(let r of Object.keys(this.store))t.includes(r)||t.push(r);return t.sort(),t}};l(Q,"FileStorage");import{createWriteStream as xe,mkdirSync as Le}from"fs";import{dirname as Ee,resolve as we}from"path";var z={};function V(e,t={}){let{level:r=m.all,filter:n="*"}=t;e=we(process.cwd(),e),Le(Ee(e),{recursive:!0});var i=xe(e,{flags:"a"});let o=T(n),c=F(r);return s=>{if(!c(s.level)||!o(s.name))return;let g=new Date().toISOString(),p=s.name||"",y=z[p||""];y==null&&(z[p]=y);let f=[`[${p||"*"}]`,$(s.messages,{pretty:!1})];function u(...d){i.write(d.join(" ")+`
|
|
3
3
|
`)}switch(l(u,"write"),s.level){case m.info:u(g,"I|* ",...f);break;case m.warn:u(g,"W|** ",...f);break;case m.error:u(g,"E|***",...f);break;default:u(g,"D| ",...f);break}}}l(V,"LoggerFileHandler");import{resolve as Z}from"path";function Ne(e){var t,r;return typeof e!="string"?[]:((r=(t=e==null?void 0:e.split(`
|
|
4
4
|
`))==null?void 0:t.map(n=>{let i=n.match(/^\s+at.*(\((.*)\)|file:\/\/(.*)$)/);if(i){let o=i[3]||i[2];return o.endsWith(")")&&(o=o.slice(0,-1)),o}}))==null?void 0:r.filter(n=>n!=null))||[]}l(Ne,"getStackLlocationList");var D=Z(process.cwd()),ee,te,H=((ee=process.env)==null?void 0:ee.HOME)?Z((te=process.env)==null?void 0:te.HOME):"";function q(e){if(e.includes("/node_modules/"))return"";let t="file://";return e.startsWith(t)?e.substr(t.length):D&&e.startsWith(D)?e.substr(D.length+1):(H&&e.startsWith(H)&&(e="~/"+e.substr(H.length+1)),e)}l(q,"pathStripCwd");function Te(e){let t=e.match(/^\s*at.*(\((.*)\)|file:\/\/(.*)$)/);if(t){let r=t[3]||t[2];return r.endsWith(")")&&(r=r.slice(0,-1)),r}return""}l(Te,"extractFileInfo");function I(e=2,t=!0){var i;let r=new Error().stack||"",n=(i=Ne(r))==null?void 0:i[e];return n&&t&&(n=q(n)),n||""}l(I,"getSourceLocation");function X(){return new Error().stack||""}l(X,"getStack");function C(e,t=!0){let r="",n=new Error().stack||"";if(typeof n=="string"){let i=n.split(`
|
|
5
5
|
`).map(c=>c.trim()),o=i.findIndex(c=>e.some(s=>c.startsWith(s)));r=i[o+1],r&&(r=Te(r)),r&&t&&(r=q(r))}return r}l(C,"getSourceLocationByPrecedingPattern");import re from"tty";function Fe(){try{return re.isatty(process.stdout.fd)}catch{}return!1}l(Fe,"isTTY");var ne=[6,2,3,4,5,1];function $e(e){let t=0;for(let r=0;r<e.length;r++)t=(t<<5)-t+e.charCodeAt(r),t|=0;return ne[Math.abs(t)%ne.length]}l($e,"selectColor");var ie={},Oe=P(),W=re.isatty(process.stderr.fd);function k(...e){return process.stderr.write($(e)+`
|
|
6
6
|
`)}l(k,"log");var E={BOLD:"[1m",UNBOLD:"[2m",RED:"[31m",GREEN:"[32m",BLUE:"[34m",PURPLE:"[35m",GRAY:"[37m",ORANGE:"[38;5;208m",UNCOLOR:"[0m"};var se="[0m";function w(e,t){return`${t===8?E.ORANGE:"[3"+(t<8?t:"8;5;"+t)+"m"}${e}${se}`}l(w,"colorString");function oe(e,t,r=!0){return e.map(n=>{if(typeof n!="string")return n;let i=t,o=se;return r&&(i=`${E.BOLD}${i}`,o=`${o}${E.BOLD}`),`${i}${n}${o}`})}l(oe,"colorStringList");var ke="loggerStackTraceDebug-7d38e5a9214b58d29734374cdb9521fd964d7485";function le(e={}){let{level:t=void 0,filter:r=void 0,colors:n=Fe(),levelHelper:i=!0,nameBrackets:o=!0,padding:c=0,fill:s=0,stack:g=!0}=e,p=T(r),y=F(t);return f=>{var M;if(!y(f.level)||!p(f.name))return;let u=P(),d=f.name||"",N=ie[d||""];N==null&&(N={color:$e(d)},ie[d]=N);let G=_(u-Oe),a,v=o?`[${d}]`:d;if(c>0&&(v=v.padStart(c," ")),s>0&&(v=v.padEnd(s," ")),n&&W){let h=N.color;a=[w(v,h)+" | "],f.level===m.warn?a.push(...oe(f.messages,E.ORANGE)):f.level===m.error?a.push(...oe(f.messages,E.RED)):a.push(...f.messages),a.push(w(`+${G}`,h))}else a=[v,...f.messages],a.push(`+${G}`);if(((M=f.messages)==null?void 0:M[0])===ke&&console.log(X()),g){let h="";typeof g=="boolean"?(h=C(["at Function.","at null.log (","at log ("],!0),h||(h=I(0,!0))):h=I(typeof g=="number"?g:3,!0),h&&a.push(w(`(${h})`,7))}switch(f.level){case m.info:i&&(a[0]="I|* "+a[0]),k(...a);break;case m.warn:i&&(a[0]=(n&&W?w("W|** ",8):"W|** ")+a[0]),k(...a);break;case m.error:i&&(a[0]=(n&&W?w("E|*** ",1):"E|*** ")+a[0]),k(...a);break;default:i&&(a[0]="D| "+a[0]),k(...a);break}}}l(le,"LoggerNodeHandler");import A from"crypto";try{A&&A.webcrypto&&typeof globalThis!="undefined"&&typeof globalThis.crypto=="undefined"&&(globalThis.crypto=A.webcrypto)}catch(e){console.warn("Failed to polyfill webcrypto",e)}function je(){var r;let e=[le({padding:32,nameBrackets:!1})],t=(r=process.env.ZEED_LOG)!=null?r:process.env.LOG;t&&e.unshift(V(R(t))),x.setHandlers(e)}l(je,"setupLogContextNode");je();export{me as a,de as b,R as c,Ie as d,Q as e,V as f,Ne as g,I as h,X as i,C as j,Fe as k,w as l,oe as m,ke as n,le as o};
|
|
7
|
-
//# sourceMappingURL=chunk-
|
|
7
|
+
//# sourceMappingURL=chunk-7YV5VFZP.js.map
|
|
File without changes
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{a as I,b as Q,c as o,s as be,w as ie,x as b,y as Te}from"./chunk-LNZLD7Y3.js";var we=b("bin"),Y;function Ae(e){return typeof TextEncoder=="undefined"?new Uint8Array:(Y!=null?Y:Y=new TextEncoder).encode(e.normalize("NFC"))}o(Ae,"stringToUInt8Array");var X;function Xe(e){return typeof TextDecoder=="undefined"?"":(X!=null?X:X=new TextDecoder("utf-8",{ignoreBOM:!0})).decode(e).normalize("NFC")}o(Xe,"Uint8ArrayToString");function k(e){return e instanceof ArrayBuffer?new Uint8Array(e):typeof e=="string"?Ae(e):e.length?new Uint8Array(e):e}o(k,"toUint8Array");function jt(e){if(typeof Buffer!="undefined")return Buffer.from(k(e)).toString("hex");let t="0123456789abcdef",r="";for(let n of[...k(e)])r+=t[n>>4]+t[n&15];return r}o(jt,"toHex");function Wt(e){let t=k(e);if(typeof Buffer!="undefined")return Buffer.from(t).toString("base64");let r="";for(let n=0;n<t.byteLength;n++)r+=String.fromCharCode(t[n]);return btoa(r)}o(Wt,"toBase64");function Qt(e){let t=k(e);if(typeof Buffer!="undefined")return Buffer.from(t).toString("base64url");let r="";for(let n=0;n<t.byteLength;n++)r+=String.fromCharCode(t[n]);return btoa(r).replace(/\+/g,"-").replace(/\//g,"_")}o(Qt,"toBase64Url");function Me(e,t){if(e.byteLength!==t.byteLength)return!1;let r=k(e),n=k(t);for(let i=0;i<r.length;i++)if(r[i]!==n[i])return!1;return!0}o(Me,"equalBinary");function se(e){try{return Ae(JSON.stringify(e))}catch(t){throw we.warn("jsonToUint8Array",e),t}}o(se,"jsonToUint8Array");function ae(e){try{return JSON.parse(Xe(e))}catch(t){throw we.warn("Uint8ArrayToJson",e),t}}o(ae,"Uint8ArrayToJson");function H(e=16){let t=new Uint8Array(e);if(typeof crypto!="undefined"&&crypto.getRandomValues)crypto.getRandomValues(t);else for(let r=0;r<e;r++)t[r]=Math.floor(Math.random()*256);return t}o(H,"randomUint8Array");var Pe="SHA-256",ue="AES-GCM",Ee="PBKDF2";async function Kt(e,t=Pe){return await crypto.subtle.digest(t,k(e))}o(Kt,"digest");async function Yt(e,t={}){var i;let r=k(e),n=await crypto.subtle.importKey("raw",r,Ee,!1,["deriveKey"]);return await crypto.subtle.deriveKey({name:Ee,salt:t.salt?k(t.salt):new Uint8Array(0),iterations:(i=t.iterations)!=null?i:1e5,hash:Pe},n,{name:ue,length:256},!0,["encrypt","decrypt"])}o(Yt,"deriveKeyPbkdf2");var ee=new Uint8Array([1,1]);async function Le(e,t){let r=H(12),n=await crypto.subtle.encrypt({name:ue,iv:r},t,e),i=new Uint8Array(n),s=ee.length+r.length+i.length,u=new Uint8Array(s),a=0;return u.set(ee,a),a+=ee.length,u.set(r,a),a+=r.length,u.set(i,a),u}o(Le,"encrypt");async function Ce(e,t){let r=e.subarray(0,2);if(!Me(r,ee))return Promise.reject(`Unknown magic ${r}`);let n=e.subarray(2,2+12),i=e.subarray(2+12,e.length),s=await crypto.subtle.decrypt({name:ue,iv:n},t,i);return new Uint8Array(s)}o(Ce,"decrypt");var Ue=",",et=!1,tt=!0;function rt(e){return/^([-+])?([0-9]+(\.[0-9]+)?|Infinity)$/.test(e)?Number(e):NaN}o(rt,"filterFloat");function nt(e){return tt&&e==null?"":et?'="'+String(e).replace(/"/g,'""')+'"':!isNaN(rt(e))&&isFinite(e)?parseFloat(e):'"'+String(e).replace(/"/g,'""')+'"'}o(nt,"escape");function er(e,t){let r="";t&&(r=t.join(Ue)+`\r
|
|
2
|
+
`);for(let n=0;n<e.length;n++)r+=e[n].map(nt).join(Ue)+`\r
|
|
3
|
+
`;return r}o(er,"csv");function ot(e=""){let[t="",r="asc"]=e.split(" ");return r=r.toLowerCase(),{field:t,orderby:r,asc:r!=="desc",desc:r==="desc"}}o(ot,"parseOrderby");function rr(e,t=!0){return`${e} ${t?"asc":"desc"}`}o(rr,"composeOrderby");function ce(e,t,r=!0){let n=e||0,i=t||0;return n>i?r?1:-1:n<i?r?-1:1:0}o(ce,"cmp");function nr(e,...t){if(t.length>0){let r=t.map(ot),n=Array.from(e);return n.sort((i,s)=>{for(let{field:u,asc:a}of r){let c=ce(i[u],s[u],a);if(c!==0)return c}return 0}),n}return e}o(nr,"sortedOrderby");function fe(e){return e.filter((t,r)=>e.indexOf(t)===r)}o(fe,"arrayUnique");function it(e,t){return fe(e.filter(r=>!t.includes(r)))}o(it,"arrayMinus");function st(...e){return fe(e.reduce((t=[],r)=>t.concat(r),[]))}o(st,"arrayUnion");function V(...e){return e.flat(1/0)}o(V,"arrayFlatten");function at(e,t){return fe(e).filter(r=>t.includes(r))}o(at,"arrayIntersection");function sr(e,t){return it(st(e,t),at(e,t))}o(sr,"arraySymmetricDifference");function ar(e,t){if(e&&Array.isArray(e)){let r;for(;(r=e.indexOf(t))!==-1;)e.splice(r,1);return e}return[]}o(ar,"arrayRemoveElement");function ur(e,t){return e.includes(t)||e.push(t),e}o(ur,"arraySetElement");function le(e,t){return e.splice(0,e.length,...e.filter(t)),e}o(le,"arrayFilterInPlace");function cr(e,t){let r=e.findIndex(n=>n===t);return r>=0?e.splice(r,1):e.push(t),e}o(cr,"arrayToggleInPlace");function fr(e){return e.splice(0,e.length),e}o(fr,"arrayEmptyInPlace");function ut(e,t=ce){return Array.from(e).sort(t)}o(ut,"arraySorted");function lr(e){return ut(e,(t,r)=>t-r)}o(lr,"arraySortedNumbers");function ct(e,t){return e.length===t.length&&e.every((r,n)=>r===t[n])}o(ct,"arrayIsEqual");function ke(e){return e.sort(()=>Math.random()>.5?1:-1),e}o(ke,"arrayShuffleInPlace");function pr(e){return ke(Array.from(e))}o(pr,"arrayShuffle");function dr(e){for(;e.length>1;){let t=Array.from(e);if(ke(t),!ct(e,t))return t}return e}o(dr,"arrayShuffleForce");function mr(e){return e[Math.floor(Math.random()*e.length)]}o(mr,"arrayRandomElement");function yr(...e){return V(e).reduce((t,r)=>t!=null?r>t?r:t:r,void 0)}o(yr,"arrayMax");function gr(...e){return V(e).reduce((t,r)=>t!=null?r<t?r:t:r,void 0)}o(gr,"arrayMin");function hr(e=0,t){if(e<=0)return[];let r=new Array(e);for(let n=0;n<e;n++)r[n]=t instanceof Function?t(n):t;return r}o(hr,"createArray");var ft=b("zeed:basex"),lt={"2":"01","8":"01234567","11":"0123456789a","16":"0123456789abcdef","32":"0123456789ABCDEFGHJKMNPQRSTVWXYZ","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 O(e){let t;if(typeof e=="string")t=e;else if(t=lt[e.toString()],t==null)throw new Error(`Unknown base ${e}`);if(t.length>=255)throw new TypeError("Alphabet too long");let r=new Uint8Array(256);for(let f=0;f<r.length;f++)r[f]=255;for(let f=0;f<t.length;f++){let d=t.charAt(f),m=d.charCodeAt(0);if(r[m]!==255)throw new TypeError(d+" is ambiguous");r[m]=f}let n=t.length,i=t.charAt(0),s=Math.log(n)/Math.log(256),u=Math.log(256)/Math.log(n);function a(f,d=-1){let m=k(f);if(m.byteLength===0)return"";let L=0,M=0,P=m.byteLength;for(;M!==P&&m[M]===0;)M++;let x=(P-M)*u+1>>>0,y=new Uint8Array(x);for(;M!==P;){let S=m[M],T=0;for(let D=x-1;(S!==0||T<L)&&D!==-1;D--,T++)S+=256*y[D]>>>0,y[D]=S%n>>>0,S=S/n>>>0;if(S!==0)throw ft.warn("Non-zero carry",m,d,T,x),new Error("Non-zero carry");L=T,M++}let g=x-L;for(;g!==x&&y[g]===0;)g++;let E="";for(;g<x;++g)E+=t.charAt(y[g]);return d>0?E.padStart(d,i):E}o(a,"encode");function c(f,d=-1){if(typeof f!="string")throw new TypeError("Expected String");if(f.length===0)return new Uint8Array;f=f.replace(/\s+/gi,"");let m=0,L=0;for(;f[m]===i;)m++;let M=(f.length-m)*s+1>>>0,P=new Uint8Array(M);for(;f[m];){let y=r[f.charCodeAt(m)];if(y===255)throw new Error(`Unsupported character "${f[m]}"`);let g=0;for(let E=M-1;(y!==0||g<L)&&E!==-1;E--,g++)y+=n*P[E]>>>0,P[E]=y%256>>>0,y=y/256>>>0;if(y!==0)throw new Error("Non-zero carry");L=g,m++}let x=M-L;for(;x!==M&&P[x]===0;)x++;return d>0?new Uint8Array([...new Uint8Array(d-P.length+x),...P.slice(x)]):P.slice(x)}return o(c,"decode"),{encode:a,decode:c}}o(O,"useBase");var{encode:Ar,decode:Mr}=O(16),{encode:Pr,decode:Er}=O(32),{encode:Lr,decode:Cr}=O(58),{encode:Ur,decode:kr}=O(62),{encode:Dr,decode:Sr}=O(62);var Or=o(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,r)=>r.toUpperCase()),e=e[0].toLowerCase()+e.substring(1)),e),"toCamelCase");function pt(e){return e.charAt(0).toUpperCase()+e.toLowerCase().slice(1)}o(pt,"toCapitalize");function Fr(e){return e.replace(/\w\S*/g,pt)}o(Fr,"toCapitalizeWords");function Rr(e,t="-"){return t=typeof t=="undefined"?"_":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()}o(Rr,"fromCamelCase");function dt(e,t){var r=[],n=[];return t==null&&(t=o(function(i,s){return r[0]===s?"[Circular ~]":"[Circular ~."+n.slice(0,r.indexOf(s)).join(".")+"]"},"cycleReplacer")),function(i,s){if(r.length>0){var u=r.indexOf(this);~u?r.splice(u+1):r.push(this),~u?n.splice(u,1/0,i):n.push(i),~r.indexOf(s)&&(s=t==null?void 0:t.call(this,i,s))}else r.push(s);return e==null?s:e.call(this,i,s)}}o(dt,"serializer");function pe(e,t,r,n){return JSON.stringify(e,dt(t,n),r)}o(pe,"jsonStringify");var De=["1","true","yes","y","on"];function Br(e,t=!1){return e==null||typeof e!="string"?t:De.includes(String(e).trim().toLowerCase())}o(Br,"stringToBoolean");function Nr(e,t=0){var r;return e==null||typeof e!="string"?t:(r=parseInt(e.trim(),10))!=null?r:t}o(Nr,"stringToInteger");function zr(e,t=0){var r;return e==null||typeof e!="string"?t:(r=parseFloat(e.trim()))!=null?r:t}o(zr,"stringToFloat");function mt(e,t=!1){return e==null?t:typeof e=="boolean"?e:typeof e=="number"?e!==0:De.includes(String(e).trim().toLowerCase())}o(mt,"valueToBoolean");function yt(e,t=0){var r;return e==null?t:typeof e=="boolean"?e?1:0:typeof e=="number"?Math.floor(e):(r=parseInt(String(e).trim(),10))!=null?r:t}o(yt,"valueToInteger");function gt(e,t=0){var r;return e==null?t:typeof e=="boolean"?e?1:0:typeof e=="number"?Math.floor(e):(r=parseFloat(String(e).trim()))!=null?r:t}o(gt,"valueToFloat");function de(e,t=""){var r;return e==null?t:(r=String(e))!=null?r:t}o(de,"valueToString");var Hr=gt,Jr=yt,qr=de,Gr=mt;function ht(e,t={}){let{trace:r=!0,pretty:n=!0}=t;return e.map(i=>i&&typeof i=="object"?i instanceof Error?r?`${i.name||"Error"}: ${i.message}
|
|
4
|
+
${i.stack}`:`${i.name||"Error"}: ${i.message}`:n?pe(i,null,2):pe(i):String(i))}o(ht,"formatMessages");function Wr(e,t={}){return ht(e,t).join(" ")}o(Wr,"renderMessages");function Qr(e){try{return decodeURIComponent(escape(e))}catch{}return e}o(Qr,"fixBrokenUth8String");var xt={symbol:"$",separator:",",decimal:".",errorOnInvalid:!1,precision:2,pattern:"!#",negativePattern:"-!#",format:At,fromCents:!1},Se=o(e=>Math.round(e),"round"),me=o(e=>Math.pow(10,e),"pow"),bt=o((e,t)=>Se(e/t)*t,"rounding"),Tt=/(\d)(?=(\d{3})+\b)/g,wt=/(\d)(?=(\d\d)+\d\b)/g;function B(e,t={}){return new F(e,t)}o(B,"currency");var re=class{constructor(t,r={}){var u;let n=Object.assign({},xt,r),i=me((u=n.precision)!=null?u:2),s=te(t,n);this.intValue=s,this.value=s/i,n.increment=n.increment||1/i,n.useVedic?n.groups=wt:n.groups=Tt,this._settings=n,this._precision=i}add(t){let{intValue:r,_settings:n,_precision:i}=this;return B((r+=te(t,n))/(n.fromCents?1:i),n)}subtract(t){let{intValue:r,_settings:n,_precision:i}=this;return B((r-=te(t,n))/(n.fromCents?1:i),n)}multiply(t){let{intValue:r,_settings:n,_precision:i}=this;return B((r*=t)/(n.fromCents?1:me(i)),n)}divide(t){let{intValue:r,_settings:n}=this;return B(r/=te(t,n,!1),n)}distribute(t){let{intValue:r,_precision:n,_settings:i}=this,s=[],u=Math[r>=0?"floor":"ceil"](r/t),a=Math.abs(r-u*t),c=i.fromCents?1:n;for(;t!==0;t--){let f=B(u/c,i);a-- >0&&(f=f[r>=0?"add":"subtract"](1/c)),s.push(f)}return s}dollars(){return~~this.value}cents(){let{intValue:t,_precision:r}=this;return~~(t%r)}format(t){let{_settings:r}=this;return typeof t=="function"?t(this,r):r.format(this,Object.assign({},r,t))}toString(){let{intValue:t,_precision:r,_settings:n}=this;return bt(t/r,n.increment).toFixed(n.precision)}toJSON(){return this.value}static sum(...t){return V(t).reduce((r,n)=>B(r).add(n),this.zero)}static avg(...t){let r=V(t);return r.reduce((n,i)=>B(n).add(i),this.zero).divide(r.length)}},F=re;o(F,"Currency"),F.zero=new re(0),F.one=new re(1);function te(e,t,r=!0){let n=0,{decimal:i,errorOnInvalid:s,precision:u,fromCents:a}=t,c=me(u),f=typeof e=="number";if(e instanceof F&&a)return e.intValue;if(f||e instanceof F)n=e instanceof F?e.value:e;else if(typeof e=="string"){let d=new RegExp("[^-\\d"+i+"]","g"),m=new RegExp("\\"+i,"g");n=e.replace(/\((.*)\)/,"-$1").replace(d,"").replace(m,"."),n=n||0}else{if(s)throw Error("Invalid Input");n=0}return a||(n*=c,n=n.toFixed(4)),r?Se(n):n}o(te,"parse");function At(e,t){let{pattern:r,negativePattern:n,symbol:i,separator:s,decimal:u,groups:a}=t,c=(""+e).replace(/^-/,"").split("."),f=c[0],d=c[1];return(e.value>=0?r:n).replace("!",i).replace("#",f.replace(a,"$1"+s)+(d?u+d:""))}o(At,"format");var _=o(e=>Math.abs(e)%1===.5,"isHalf"),Ie=o(e=>e%2===0,"isEven"),Zr=o(e=>Math.ceil(e),"roundUp"),Kr=o(e=>Math.floor(e),"roundDown"),Yr=o(e=>Math.round(e),"roundHalfUp"),Xr=o(e=>{let t=Math.round(e);return _(e)&&Ie(t)?t-1:t},"roundHalfOdd"),en=o(e=>_(e)?Math.sign(e)*Math.ceil(Math.abs(e)):Math.round(e),"roundHalfAwayFromZero"),tn=o(e=>_(e)?Math.floor(e):Math.round(e),"roundHalfDown"),rn=o(e=>{let t=Math.round(e);return _(e)?Ie(t)?t:t-1:t},"roundHalfEven"),nn=o(e=>_(e)?Math.sign(e)*Math.floor(Math.abs(e)):Math.round(e),"roundHalfTowardsZero");var{warn:Oe}=b("zeed:promise");async function an(e){return new Promise(t=>setTimeout(t,e))}o(an,"sleep");async function un(){return new Promise(e=>setTimeout(e,0))}o(un,"immediate");var Fe=Symbol("timeout");async function cn(e,t,r=Fe){return new Promise(async(n,i)=>{let s=!1,u=setTimeout(()=>{s=!0,n(r)},t);try{let a=await e;clearTimeout(u),s||n(a)}catch(a){clearTimeout(u),s||i(a)}})}o(cn,"timeout");var Re=new Error("Timeout reached");function fn(e){return e===Fe||e===Re}o(fn,"isTimeout");async function $e(e,t){return t<=0?await e:new Promise(async(r,n)=>{let i=!1,s=setTimeout(()=>{i=!0,n(Re)},t);try{let u=await e;clearTimeout(s),i||r(u)}catch(u){clearTimeout(s),i||n(u)}})}o($e,"tryTimeout");function ln(e,t,r=1e3){return new Promise((n,i)=>{let s=o(c=>{a&&(clearTimeout(a),u(),n(c))},"fn"),u=o(()=>{a=null,e.off?e.off(t,s):e.removeEventListener?e.removeEventListener(t,s):Oe("No remove listener method found for",e,t)},"done"),a=setTimeout(()=>{u(),i(new Error("Did not response in time"))},r);e.on?e.on(t,s):e.addEventListener?e.addEventListener(t,s):Oe("No listener method found for",e)})}o(ln,"waitOn");function C(e){return Boolean(e&&(e instanceof Promise||typeof e.then=="function"))}o(C,"isPromise");function N(e){return Promise.resolve(e)}o(N,"promisify");var ve=1e3*60*60*24,w=class{constructor(t){var r;if(typeof t=="number"){this.days=t;return}if(t!=null&&(t=(r=w.from(t))==null?void 0:r.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 w(t)}static fromString(t){return new w(+t.replace(/[^0-9]/g,""))}static fromDate(t,r=!1){return r?w.fromString(t.toISOString().substr(0,10)):new w(t.getFullYear()*1e4+(t.getMonth()+1)*100+t.getDate())}static fromDateGMT(t){return w.fromDate(t,!0)}static from(t,r=!1){if(typeof t=="number")return new w(t);if(typeof t=="string")return w.fromString(t);if(t instanceof Date)return w.fromDate(t,r);if(t instanceof w)return t}toNumber(){return this.days}toJson(){return this.days}toString(t="-"){let r=String(this.days);return r.slice(0,4)+t+r.slice(4,6)+t+r.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)}dayOffset(t){return w.fromDateGMT(new Date(this.toDateGMT().getTime()+t*ve))}daysUntil(t){var r;return Math.round((((r=new w(t))==null?void 0:r.toDateGMT().getTime())-this.toDateGMT().getTime())/ve)}yesterday(){return this.dayOffset(-1)}tomorrow(){return this.dayOffset(1)}};o(w,"Day");async function mn(e,t,r){let n=w.from(e),i=w.from(t);for(;n&&i&&(n==null?void 0:n.days)<=(i==null?void 0:i.days);){let s=r(n);C(s)&&await s,n=n.dayOffset(1)}}o(mn,"forEachDay");function yn(){return new w}o(yn,"today");function gn(e){return new w(e)}o(gn,"day");var Be=o(e=>e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/'/g,"'").replace(/"/g,"""),"escapeHTML"),xn=o(e=>e.replace(/</gi,"<").replace(/>/gi,">").replace(/"/gi,'"').replace(/'/gi,"'").replace(/&/gi,"&"),"unescapeHTML");function Tn(e=.25){return Math.random()<e}o(Tn,"randomBoolean");function wn(e=100,t=0){return t+Math.floor(Math.random()*(e-t))}o(wn,"randomInt");function An(e=100,t=0){return t+Math.random()*(e-t)}o(An,"randomFloat");function Mn(e,t,r){return Math.max(e,Math.min(r,t))}o(Mn,"between");var Mt=100,Ne=/[\u0000-\u001F\u0080-\u009F]/g,Pt=/^\.+/,Et=/\.+$/;function ze(){return/[<>:"/\\|?*\u0000-\u001F]/g}o(ze,"filenameReservedRegex");function Lt(){return/^(con|prn|aux|nul|com\d|lpt\d)$/i}o(Lt,"windowsReservedNameRegex");function En(e){if(typeof e!="string")throw new TypeError("Expected a string");let t="_";if(ze().test(t)&&Ne.test(t))throw new Error("Replacement string cannot contain reserved filename characters");return e=e.replace(ze(),t).replace(Ne,t).replace(Pt,t).replace(Et,""),e=Lt().test(e)?e+t:e,e.slice(0,Mt)}o(En,"toValidFilename");var Ct=/[\\\-\[\]\/{}()*+?.^$|]/g;function Cn(e){return e?e instanceof RegExp?e.source:e.replace(Ct,"\\$&"):""}o(Cn,"escapeRegExp");function He(e){return e.reduce((t,r)=>Math.min(t,r.sort_weight||0),0)-1-Math.random()}o(He,"startSortWeight");function Je(e){return e.reduce((t,r)=>Math.max(t,r.sort_weight||0),0)+1+Math.random()}o(Je,"endSortWeight");function kn(e,t,r){let n=r.length,i=e<t;if(n<=0||e>=n-1)return Je(r);if(e<=0)return He(r);r=Ut([...r]);let s=i?-1:0,u=r[e+s].sort_weight||0,c=(r[e+s+1].sort_weight||0)-u;if(c===0)return i?He(r):Je(r);let f=u+c/2,d=c*.01*(Math.random()-.5);return f+d}o(kn,"moveSortWeight");function Ut(e){return e.sort((t,r)=>(t.sort_weight||0)-(r.sort_weight||0)),e}o(Ut,"sortedItems");var kt=/((?:(?:(?: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 In(e){return e.split(kt).map((t,r)=>{let n=Be(t);return r%2?`<a target="_blank" href="${n}">${Dt(n)}</a>`:n}).join("")}o(In,"linkifyPlainText");function Dt(e){return e.replace(/^https?:\/\/(www\.)?/,"").replace(/\/$/,"")}o(Dt,"toHumanReadableUrl");function qe(e){let t=[];for(let[r,n]of Object.entries(e))if(n!=null){Array.isArray(n)||(n=[n]);for(let i of n)i!=null&&t.push(encodeURIComponent(r)+"="+encodeURIComponent(i.toString()||""))}return t.join("&")}o(qe,"encodeQuery");function On(e){let t={},r=(e[0]==="?"?e.substr(1):e).split("&");for(let n=0;n<r.length;n++){let i=r[n].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}o(On,"parseQuery");function Rn(e){return e!=null?e.size!=null?e.size:e.length!=null?e.length:Object.keys(e).length:0}o(Rn,"size");function $n(e){return e!=null&&e.length>0?e[e.length-1]:void 0}o($n,"last");function vn(e){try{if(e!=null)return Array.isArray(e)||typeof e=="string"?e.length<=0:(e==null?void 0:e.size)!=null?e.size<=0:Object.keys(e).length<=0}catch(t){console.error("Failed to check if empty for",e,t)}return!0}o(vn,"empty");function ye(e){return Object(e)!==e?e:JSON.parse(JSON.stringify(e))}o(ye,"cloneObject");function Bn(e){return Object(e)!==e?e:JSON.parse(JSON.stringify(e))}o(Bn,"cloneJsonObject");async function St(e){typeof e=="function"?await N(e()):C(e)?await e:typeof e.dispose=="function"?await N(e.dispose()):C(e.dispose)?await e.dispose:typeof e.cleanup=="function"?await N(e.cleanup()):C(e.cleanup)&&await e.cleanup}o(St,"callDisposer");function It(){let e=[],t=o(async i=>{e.includes(i)&&(le(e,s=>s!==i),await St(i))},"untrack"),r=o(async()=>{for(;e.length>0;)await t(e[0])},"dispose"),n=o(i=>(e.unshift(i),()=>t(i)),"track");return Object.assign(r,{track:n,add:n,untrack:t,dispose:r,exec:r,getSize(){return e.length}})}o(It,"useDispose");var Jn=It;function qn(e={}){let{mode:t="fifo"}=e,r=[],n=o(async(s=!1)=>{for(;r.length>0;){let u=r[0];if(le(r,a=>a!==u),typeof u=="function"){let a=u();if(C(a)){if(s)throw new Error(`Expected sync only function, but found async: ${u}`);await a}}else if(C(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(n,{add:o(s=>{t==="lifo"?r.unshift(s):r.push(s)},"add"),exec:n,getSize(){return r.length}})}o(qn,"useDefer");function Gn(e,t=0){let r=setTimeout(e,t);return()=>{r&&(clearTimeout(r),r=void 0)}}o(Gn,"useTimeout");function jn(e,t){let r=setInterval(e,t);return()=>{r&&(clearInterval(r),r=void 0)}}o(jn,"useInterval");function Wn(e,t,r,...n){return e==null?()=>{}:(e.on?e.on(t,r,...n):e.addEventListener&&e.addEventListener(t,r,...n),()=>{e.off?e.off(t,r,...n):e.removeEventListener&&e.removeEventListener(t,r,...n)})}o(Wn,"useEventListener");function Vn(e=window.location.hostname){return["localhost","127.0.0.1","","::1","::"].includes(e)||e.startsWith("192.168.")||e.startsWith("10.0.")||e.endsWith(".local")}o(Vn,"isLocalHost");var{encode:Ge,decode:Ot}=O(62),{encode:Ft}=O(32);function je(){return H(16)}o(je,"uuidBytes");var Xn=o(()=>new Uint32Array(H(4))[0],"uuid32bit");function Z(){return Ge(je(),22)}o(Z,"uuid");function eo(){return Ft(je(),26)}o(eo,"uuidB32");var ge={};function z(e="id"){return ge[e]==null&&(ge[e]=0),`${e}-${ge[e]++}`}o(z,"uname");var Rt=0;function to(){return`id-${Rt++}`}o(to,"qid");var $t="10000000-1000-4000-8000-100000000000",ro=o(()=>$t.replace(/[018]/g,e=>(e^H(1)[0]&15>>e/4).toString(16)),"uuidv4"),We=16e11;function vt(e){var t=new Uint8Array([0,0,0,0,0,0]);let r=t.length-1;for(var n=0;n<t.length;n++){var i=e&255;t[r-n]=i,e=(e-i)/256}return t}o(vt,"longToByteArray");function Bt(){let e=Te()-We;return new Uint8Array([...vt(e),...H(10)])}o(Bt,"suidBytes");function no(){return Ge(Bt(),22)}o(no,"suid");function oo(e){return Nt(Ot(e,16))}o(oo,"suidDate");function Nt(e){return new Date(We+e.slice(0,6).reduce((t,r)=>t*256+r,0))}o(Nt,"suidBytesDate");var J=b("zeed:emitter"),R=class{constructor(){this.subscribers={};this.subscribersOnAny=[];this.call=new Proxy({},{get:(t,r)=>(...n)=>this.emit(r,...n)})}async emit(t,...r){let n=!1;try{let i=this.subscribers[t]||[];if(this.subscribersOnAny.forEach(s=>s(t,...r)),i.length>0){let s=i.map(u=>{try{return N(u(...r))}catch(a){J.warn("emit warning:",a)}});n=!0,await Promise.all(s)}}catch(i){J.error("emit exception",i)}return n}onAny(t){this.subscribersOnAny.push(t)}on(t,r){let n=this.subscribers[t]||[];return n.push(r),this.subscribers[t]=n,()=>{this.off(t,r)}}onCall(t){for(let[r,n]of Object.entries(t))this.on(r,n)}once(t,r){let n=o(async(...i)=>(this.off(t,n),await N(r(...i))),"onceListener");return this.on(t,n),()=>{this.off(t,r)}}off(t,r){return this.subscribers[t]=(this.subscribers[t]||[]).filter(n=>r&&n!==r),this}removeAllListeners(t){return this.subscribers={},this}dispose(){this.subscribers={},this.subscribersOnAny=[]}};o(R,"Emitter");function co(){let e=ie().emitter;return e||(e=new R,ie().emitter=e),e}o(co,"getGlobalEmitter");var fo=new R;function lo(e,t){let r=Math.round(Math.random()*100);var n=[],i;let s=o((a,c)=>{let f={key:a,obj:c};n.push(f),i&&i()},"incoming");return t?e.on?e.on(t,a=>{s(t,a)}):e.addEventListener?e.addEventListener(t,a=>{s(t,a)}):J.error(r,"Cannot listen to key"):e.onAny?e.onAny((a,c)=>{s(a,c)}):J.error(r,"cannot listen to all for",e),o((a,c=!0)=>new Promise((f,d)=>{a||(a=t,a||n.length&&(a=n[0].key)),i=o(()=>{for(;n.length>0;){let m=n.shift();if(m.key===a)i=void 0,f(m.obj);else{if(c){J.warn(r,`Unhandled event ${a} with value: ${m.obj}`);continue}d(`Expected ${a}, but found ${m.key} with value=${m.obj}`),J.error(r,`Unhandled event ${a} with value: ${m.obj}`)}break}},"lazyResolve"),i()}),"on")}o(lo,"lazyListener");var he=class extends R{constructor(){super(...arguments);this.id=Z()}close(){}};o(he,"Channel");var ne=class extends he{constructor(){super(...arguments);this.isConnected=!0}postMessage(t){var r;(r=this.other)==null||r.emit("message",{data:t,origin:"local",lastEventId:Z()})}};o(ne,"LocalChannel");function go(){let e=new ne,t=new ne;return e.other=t,t.other=e,[e,t]}o(go,"fakeWorkerPair");var q=class{async encode(t){return se(t)}async decode(t){return ae(t)}};o(q,"JsonEncoder");var Qe=class{constructor(t){this.key=t}async encode(t){let r=se(t);return await Le(r,this.key)}async decode(t){let r=await Ce(t,this.key);return ae(r)}};o(Qe,"CryptoEncoder");var Ve=o((e,t,r={})=>new Proxy(r,{get:(n,i)=>i in n?n[i]:(...s)=>e(i,s,t)}),"createPromiseProxy");function Co(e={}){let{name:t=z("hub"),encoder:r=new q,retryAfter:n=1e3,ignoreUnhandled:i=!0}=e,s=b(t),u={},a,c=[],f,d={},m=o(()=>{clearTimeout(f)},"dispose"),L=o(async()=>{if(clearTimeout(f),a){if(a.isConnected)for(;c.length;){let y=c[0];try{a.postMessage(await r.encode(y)),c.shift()}catch(g){s.warn("postMessage",g);break}}c.length>0&&n>0&&(f=setTimeout(L,n))}},"postNext"),M=o(async y=>{s("enqueue postMessage",y),c.push(y),await L()},"postMessage"),P=o(async y=>{a=y,a.on("connect",L),a.on("message",async g=>{s("onmessage",typeof g);let{name:E,args:S,id:T,result:D,error:$}=await r.decode(g.data);if(E){s(`name ${E} id ${T}`);try{if(u[E]==null)throw new Error(`handler for ${E} was not found`);let U=u[E](...S);C(U)&&(U=await U),s(`result ${U}`),T&&M({id:T,result:U})}catch(U){let v=U instanceof Error?U:new Error(de(U));s.warn("execution error",v.name),M({id:T,error:{message:v.message,stack:v.stack,name:v.name}})}}else if(T)if(s(`response for id=${T}: result=${D}, error=${$}`),d[T]==null)D===void 0?s(`skip response for ${T}`):s.warn(`no response hook for ${T}`);else{let[U,v]=d[T];if(U&&v)if(delete d[T],$){let K=new Error($.message);K.stack=$.stack,K.name=$.name,s.warn("reject",K.name),v(K)}else s("resolve",D),U(D)}else i||s.warn("Unhandled message",g)}),L()},"connect"),x=o(async(y,g,E={})=>{let{timeout:S=5e3}=E,T=Z();return M({name:y,args:g,id:T}),$e(new Promise((D,$)=>d[T]=[D,$]),S)},"fetchMessage");return e.channel&&P(e.channel),{dispose:m,connect:P,listen(y){Object.assign(u,y)},send(){return Ve(x,{},{options(y){return Ve(x,I({},y))}})}}}o(Co,"useMessageHub");var xe=class extends R{constructor(t){super();this.publish=this.emit;this.subscribe=this.on;var u;let{name:r,encoder:n=new q,channel:i,debug:s=!1}=t;this.channel=i,this.encoder=n,this.debug=s,this.name=(u=r!=null?r:this.channel.id)!=null?u:z("pubsub"),this.log=b(`${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 c=await this.encoder.decode(a);if(this.debug?this.log(`channel message, event=${c==null?void 0:c.event}, info=`,c):this.log(`channel message, event=${c==null?void 0:c.event}`),c){let{event:f,args:d}=c;await this.emitSuper(f,...d)}})}get shortId(){return this.name.substr(0,6)}async emitSuper(t,...r){return await super.emit(t,...r)}async emit(t,...r){try{if(this.debug?this.log(`emit(${t})`,t):this.log(`emit(${t})`,r.length),!this.channel.isConnected)return this.log.warn("channel not connected"),!1;let n=await this.encoder.encode({event:t,args:r});return this.channel.postMessage(n),!0}catch(n){this.log.warn(`emit(${t})`,n)}return!1}};o(xe,"PubSub");function $o(e){return new xe(e)}o($o,"usePubSub");function No(){let e=!0;return(t,r)=>{let n=!1;if(e){e=!1;try{t(),n=!0}finally{e=!0}}else r!==void 0&&r();return n}}o(No,"useMutex");function zo(){let e=!0;return async(t,r)=>{let n=!1;if(e){e=!1;try{let i=t();C(i)&&await i,n=!0}finally{e=!0}}else if(r!==void 0){let i=r();C(i)&&await i}return n}}o(zo,"useAsyncMutex");var G=b("network"),oe={cache:"no-cache",redirect:"follow"};async function _e(e,t={},r=fetch){try{let n=await r(e,t);if(n.status<400)return n;try{G.warn(`Fetch of ${e} with ${t} returned status=${n.status}`),G.warn(`Response: ${await n.text()}`)}catch(i){G.error("Exception:",i)}}catch(n){G.error("fetchBasic",n)}}o(_e,"fetchBasic");async function Go(e,t={},r=fetch){try{let n=await _e(e,I(Q(I({method:"GET"},oe),{headers:{}}),t),r);if(n)return await n.json()}catch(n){G.error("fetchJSON error:",n)}}o(Go,"fetchJson");function jo(e,t="POST"){return Q(I({method:t},oe),{headers:{"Content-Type":"application/x-www-form-urlencoded; charset=utf-8"},body:qe(e)})}o(jo,"fetchOptionsFormURLEncoded");function Wo(e,t="POST"){return Q(I({method:t},oe),{headers:{"Content-Type":"application/json; charset=utf-8",Accept:"application/json"},body:JSON.stringify(e)})}o(Wo,"fetchOptionsJson");async function Qo(e,t={},r=fetch){try{let n=await _e(e,I(Q(I({method:"GET"},oe),{headers:{}}),t),r);if(n)return await n.text()}catch(n){G.error("fetchHTML error:",n)}}o(Qo,"fetchText");function Ze(){if(typeof window!="undefined")return window}o(Ze,"getWindow");function zt(){if(typeof navigator!="undefined")return navigator}o(zt,"getNavigator");function _o(){var e;return((e=Ze())!=null?e:typeof WorkerGlobalScope!="undefined")?self:typeof global!="undefined"?global:Function("return this;")()}o(_o,"getGlobal");var h=zt(),A=Ze();function Ht(e={ios:!1,macos:!1,windows:!1,beaker:!1,electron:!1,wkwebview:!1,pwa:!1,pwaInstalled:!1,browser:!1,node:!1,worker:!1,jest:!1,macosNative:!1,iosNative:!1,appleNative:!1,touch:!1}){var t,r,n,i,s,u,a,c,f;return e.ios=((t=h==null?void 0:h.platform)==null?void 0:t.match(/(iPhone|iPod|iPad)/i))!=null,e.macos=!!((r=h==null?void 0:h.platform)==null?void 0:r.startsWith("Mac")),e.windows=!!((n=h==null?void 0:h.platform)==null?void 0:n.startsWith("Win")),e.beaker=(A==null?void 0:A.beaker)!=null,e.electron=(((s=(i=h==null?void 0:h.userAgent)==null?void 0:i.toLowerCase())==null?void 0:s.indexOf(" electron/"))||-1)>-1&&!e.beaker,e.wkwebview=((u=A==null?void 0:A.webkit)==null?void 0:u.messageHandlers)!=null,e.pwa=(h==null?void 0:h.serviceWorker)!=null,e.pwaInstalled=(h==null?void 0:h.standalone)||((c=(a=A==null?void 0:A.matchMedia)==null?void 0:a.call(A,"(display-mode: standalone)"))==null?void 0:c.matches),e.node=typeof process!="undefined"&&((f=process==null?void 0:process.release)==null?void 0:f.name)==="node",e.browser=!e.electron&&!e.wkwebview&&!e.node,e.worker=typeof WorkerGlobalScope!="undefined"&&self instanceof WorkerGlobalScope,e.jest=typeof jest!="undefined",e.macosNative=e.wkwebview&&e.macos,e.iosNative=e.wkwebview&&e.ios,e.appleNative=e.wkwebview,e.touch=A&&"ontouchstart"in A||((h==null?void 0:h.maxTouchPoints)||0)>1||(h==null?void 0:h.msPointerEnabled)&&(A==null?void 0:A.MSGesture)||(A==null?void 0:A.DocumentTouch)&&document instanceof DocumentTouch,e}o(Ht,"detect");var Jt=o(()=>typeof window!="undefined"&&globalThis===window,"isBrowser"),Zo=Ht();function Ko(e){Jt()?window.addEventListener("beforeunload",e):typeof process!="undefined"&&process.on("exit",()=>e)}o(Ko,"useExitHandler");function Xo(e={}){let{maxParallel:t=3}=e,r=0,n=0,i={};function s(){if(r>=t)return;let a=Object.values(i).filter(c=>!c.running);if(a.length>0){let c;for(let f of a)(c==null||f.priority<c.priority)&&(c=f);c&&(c.running=!0,++r,c.task().then(f=>{(c==null?void 0:c.id)&&delete i[c.id],--r,s()}).catch(f=>{(c==null?void 0:c.id)&&delete i[c.id],--r,s()}))}}o(s,"performNext");function u(a){let c=i[a];c&&c.running!==!0&&delete i[a]}return o(u,"cancel"),{cancel:u,enqueue(a,c){return i[a]==null&&(i[a]={id:a,task:c,priority:++n,running:!1},s()),()=>u(a)}}}o(Xo,"usePool");var qt=b("zeed:queue"),Ke=class{constructor(t={}){this.queue=[];this.isPaused=!1;this.waitToFinish=[];let{name:r=z("queue"),logLevel:n}=t;this.name=r,this.log=b(`zeed:queue:${r}`),this.log.level=n!=null?n:be.off}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.isPaused){this.log("performNext => skip while is paused");return}for(;this.currentTask==null&&!this.isPaused;){let t=this.queue.shift();if(this.log(`performNext => ${t==null?void 0:t.name}`),t==null)break;let{name:r,task:n,resolve:i}=t;this.currentTask=n();let s;try{this.log.info(`start task ${r}`),s=await this.currentTask,this.log(`finished task ${r} with result =`,s)}catch(u){qt.warn("Error performing task",u)}i(s),this.currentTask=void 0}for(;this.waitToFinish.length>0;)this.waitToFinish.shift()()}async enqueue(t,r={}){let{immediate:n=!1,name:i=z(this.name)}=r;return n?(this.log.info(`immediate execution ${i}`),await t()):(this.log(`enqueue ${i}`),new Promise(s=>{this.queue.push({name:i,task:t,resolve:s}),this.performNext()}))}async enqueueReentrant(t,r={}){return this.enqueue(t,{immediate:this.currentTask!=null,name:r.name})}async cancelAll(t=!0){this.log("cancelAll");let r=this.queue.map(n=>n.resolve);this.queue=[],r.forEach(n=>n(void 0)),await this.wait()}async pause(){this.log("pause"),this.isPaused=!0,await this.wait()}resume(){this.log("resume"),this.isPaused=!1,this.performNext()}async wait(){if(this.log("wait"),!(this.currentTask==null&&(this.queue.length===0||this.isPaused)))return new Promise(t=>{this.waitToFinish.push(t)})}};o(Ke,"SerialQueue");var ui=b("zeed:memstorage"),Ye=class{constructor(t={}){this.store={}}setItem(t,r){this.store[t]=ye(r)}getItem(t){if(this.store.hasOwnProperty(t))return ye(this.store[t])}removeItem(t){delete this.store[t]}clear(){this.store={}}allKeys(){return Object.keys(this.store)}};o(Ye,"MemStorage");var j=!1,W=j?b("zeed:throttle"):()=>{};function li(e,t={}){let{delay:r=100,trailing:n=!0,leading:i=!0}=t,s=0,u=0,a=0,c=Date.now();function f(){s&&(clearTimeout(s),s=void 0)}o(f,"clearExistingTimeout");function d(...m){let L=Date.now(),M=this,P=L-u;function x(){let g=Date.now();return`total ${(g-c).toFixed(1)}ms - elapsed ${(g-u).toFixed(1)}ms - visited ${a}x`}o(x,"debugElapsed");function y(){a=0,u=Date.now(),e.apply(M,m)}if(o(y,"exec"),P>r||!s){j&&W("elapsed",x()),i&&(P>r?(j&&W("\u{1F680} leading",x()),y()):++a);let g=P>r?r:r-P;W(`\u23F1 start timeout with ${g.toFixed(1)}ms}`,x()),f(),u=L,s=setTimeout(()=>{j&&W("\u23F1 reached timeout",x()),s=0,n&&(!i||a>0)&&(j&&W("\u{1F680} trailing",x()),y())},g)}else++a,j&&W("visited",x())}return o(d,"wrapper"),d.cancel=f,d.dispose=f,d}o(li,"throttle");function pi(e,t={}){let{delay:r=100}=t,n=0;function i(){n&&(clearTimeout(n),n=0)}o(i,"clearExistingTimeout");function s(...u){let a=this;i(),n=setTimeout(()=>{n=0,e.apply(a,u)},r)}return o(s,"wrapper"),s.cancel=i,s.dispose=i,s}o(pi,"debounce");export{Ae as a,Xe as b,k as c,jt as d,Wt as e,Qt as f,Me as g,se as h,ae as i,H as j,Kt as k,Yt as l,Le as m,Ce as n,er as o,ot as p,rr as q,ce as r,nr as s,fe as t,it as u,st as v,V as w,at as x,sr as y,ar as z,ur as A,le as B,cr as C,fr as D,ut as E,lr as F,ct as G,ke as H,pr as I,dr as J,mr as K,yr as L,gr as M,hr as N,O,Ar as P,Mr as Q,Pr as R,Er as S,Lr as T,Cr as U,Ur as V,kr as W,Dr as X,Sr as Y,Or as Z,pt as _,Fr as $,Rr as aa,pe as ba,Br as ca,Nr as da,zr as ea,mt as fa,yt as ga,gt as ha,de as ia,Hr as ja,Jr as ka,qr as la,Gr as ma,ht as na,Wr as oa,Qr as pa,B as qa,F as ra,_ as sa,Ie as ta,Zr as ua,Kr as va,Yr as wa,Xr as xa,en as ya,tn as za,rn as Aa,nn as Ba,an as Ca,un as Da,Fe as Ea,cn as Fa,Re as Ga,fn as Ha,$e as Ia,ln as Ja,C as Ka,N as La,ve as Ma,w as Na,mn as Oa,yn as Pa,gn as Qa,Be as Ra,xn as Sa,Tn as Ta,wn as Ua,An as Va,Mn as Wa,En as Xa,Cn as Ya,He as Za,Je as _a,kn as $a,Ut as ab,In as bb,Dt as cb,qe as db,On as eb,Rn as fb,$n as gb,vn as hb,ye as ib,Bn as jb,It as kb,Jn as lb,qn as mb,Gn as nb,jn as ob,Wn as pb,Vn as qb,je as rb,Xn as sb,Z as tb,eo as ub,z as vb,to as wb,ro as xb,Bt as yb,no as zb,oo as Ab,Nt as Bb,R as Cb,co as Db,fo as Eb,lo as Fb,he as Gb,ne as Hb,go as Ib,q as Jb,Qe as Kb,Ve as Lb,Co as Mb,xe as Nb,$o as Ob,No as Pb,zo as Qb,_e as Rb,Go as Sb,jo as Tb,Wo as Ub,Qo as Vb,Ze as Wb,zt as Xb,_o as Yb,Ht as Zb,Jt as _b,Zo as $b,Ko as ac,Xo as bc,Ke as cc,Ye as dc,li as ec,pi as fc};
|
|
5
|
+
//# sourceMappingURL=chunk-BHQJ5YK3.js.map
|