@zenfs/core 0.0.6 → 0.0.7
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/backends/backend.d.ts +3 -2
- package/dist/browser.min.js +4 -4
- package/dist/browser.min.js.map +3 -3
- package/dist/utils.d.ts +0 -10
- package/dist/utils.js +0 -27
- package/package.json +1 -1
package/dist/browser.min.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
var ZenFS=(()=>{var ee=Object.defineProperty,kr=Object.defineProperties,Ir=Object.getOwnPropertyDescriptor,Br=Object.getOwnPropertyDescriptors,Tr=Object.getOwnPropertyNames,Ri=Object.getOwnPropertySymbols,Or=Object.getPrototypeOf,Li=Object.prototype.hasOwnProperty,Nr=Object.prototype.propertyIsEnumerable,Pr=Reflect.get;var P=Math.pow,Di=(s,e,t)=>e in s?ee(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,pt=(s,e)=>{for(var t in e||(e={}))Li.call(e,t)&&Di(s,t,e[t]);if(Ri)for(var t of Ri(e))Nr.call(e,t)&&Di(s,t,e[t]);return s},wt=(s,e)=>kr(s,Br(e)),l=(s,e)=>ee(s,"name",{value:e,configurable:!0});var he=(s,e)=>{for(var t in e)ee(s,t,{get:e[t],enumerable:!0})},Ar=(s,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Tr(e))!Li.call(s,o)&&o!==t&&ee(s,o,{get:()=>e[o],enumerable:!(i=Ir(e,o))||i.enumerable});return s};var Rr=s=>Ar(ee({},"__esModule",{value:!0}),s);var Ui=(s,e,t)=>Pr(Or(s),t,e);var g=(s,e,t)=>new Promise((i,o)=>{var c=m=>{try{d(t.next(m))}catch(y){o(y)}},a=m=>{try{d(t.throw(m))}catch(y){o(y)}},d=m=>m.done?i(m.value):Promise.resolve(m.value).then(c,a);d((t=t.apply(s,e)).next())});var eo={};he(eo,{ActionType:()=>we,ApiError:()=>h,AsyncKeyValueFile:()=>Zt,AsyncKeyValueFileSystem:()=>Ae,AsyncMirror:()=>vt,BaseFile:()=>re,BaseFileSystem:()=>dt,Cred:()=>K,ErrorCode:()=>et,ErrorStrings:()=>Z,FileFlag:()=>O,FileIndex:()=>Qt,FileSystem:()=>Ot,FileType:()=>j,FolderAdapter:()=>yt,InMemory:()=>ht,IndexDirInode:()=>_t,IndexFileInode:()=>de,NoSyncFile:()=>be,OverlayFS:()=>Ft,PreloadFile:()=>at,ROOT_NODE_ID:()=>ft,SimpleSyncRWTransaction:()=>Xt,Stats:()=>X,SyncKeyValueFile:()=>qt,SyncKeyValueFileSystem:()=>Jt,SynchronousFileSystem:()=>Nt,backends:()=>Ne,bufferValidator:()=>_n,checkOptions:()=>We,configure:()=>Qs,copyingSlice:()=>Cn,default:()=>to,fs:()=>Be,getEmptyDirNode:()=>ne,getFileSystem:()=>cr,initialize:()=>ar,isIndexDirInode:()=>Fi,isIndexFileInode:()=>sr,mkdirpSync:()=>ji,randomUUID:()=>zt,registerBackend:()=>nr,setImmediate:()=>Tn,toPromise:()=>Bn,wait:()=>In});var ie={},Mi=!1;function Dr(){if(Mi)return ie;Mi=!0,ie.byteLength=d,ie.toByteArray=y,ie.fromByteArray=v;for(var s=[],e=[],t=typeof Uint8Array!="undefined"?Uint8Array:Array,i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o=0,c=i.length;o<c;++o)s[o]=i[o],e[i.charCodeAt(o)]=o;e["-".charCodeAt(0)]=62,e["_".charCodeAt(0)]=63;function a(x){var C=x.length;if(C%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var F=x.indexOf("=");F===-1&&(F=C);var _=F===C?0:4-F%4;return[F,_]}l(a,"getLens");function d(x){var C=a(x),F=C[0],_=C[1];return(F+_)*3/4-_}l(d,"byteLength");function m(x,C,F){return(C+F)*3/4-F}l(m,"_byteLength");function y(x){var C,F=a(x),_=F[0],N=F[1],D=new t(m(x,_,N)),V=0,ot=N>0?_-4:_,tt;for(tt=0;tt<ot;tt+=4)C=e[x.charCodeAt(tt)]<<18|e[x.charCodeAt(tt+1)]<<12|e[x.charCodeAt(tt+2)]<<6|e[x.charCodeAt(tt+3)],D[V++]=C>>16&255,D[V++]=C>>8&255,D[V++]=C&255;return N===2&&(C=e[x.charCodeAt(tt)]<<2|e[x.charCodeAt(tt+1)]>>4,D[V++]=C&255),N===1&&(C=e[x.charCodeAt(tt)]<<10|e[x.charCodeAt(tt+1)]<<4|e[x.charCodeAt(tt+2)]>>2,D[V++]=C>>8&255,D[V++]=C&255),D}l(y,"toByteArray");function S(x){return s[x>>18&63]+s[x>>12&63]+s[x>>6&63]+s[x&63]}l(S,"tripletToBase64");function w(x,C,F){for(var _,N=[],D=C;D<F;D+=3)_=(x[D]<<16&16711680)+(x[D+1]<<8&65280)+(x[D+2]&255),N.push(S(_));return N.join("")}l(w,"encodeChunk");function v(x){for(var C,F=x.length,_=F%3,N=[],D=16383,V=0,ot=F-_;V<ot;V+=D)N.push(w(x,V,V+D>ot?ot:V+D));return _===1?(C=x[F-1],N.push(s[C>>2]+s[C<<4&63]+"==")):_===2&&(C=(x[F-2]<<8)+x[F-1],N.push(s[C>>10]+s[C>>4&63]+s[C<<2&63]+"=")),N.join("")}return l(v,"fromByteArray"),ie}l(Dr,"dew$2");var me={},zi=!1;function Lr(){if(zi)return me;zi=!0;return me.read=function(s,e,t,i,o){var c,a,d=o*8-i-1,m=(1<<d)-1,y=m>>1,S=-7,w=t?o-1:0,v=t?-1:1,x=s[e+w];for(w+=v,c=x&(1<<-S)-1,x>>=-S,S+=d;S>0;c=c*256+s[e+w],w+=v,S-=8);for(a=c&(1<<-S)-1,c>>=-S,S+=i;S>0;a=a*256+s[e+w],w+=v,S-=8);if(c===0)c=1-y;else{if(c===m)return a?NaN:(x?-1:1)*(1/0);a=a+Math.pow(2,i),c=c-y}return(x?-1:1)*a*Math.pow(2,c-i)},me.write=function(s,e,t,i,o,c){var a,d,m,y=c*8-o-1,S=(1<<y)-1,w=S>>1,v=o===23?Math.pow(2,-24)-Math.pow(2,-77):0,x=i?0:c-1,C=i?1:-1,F=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(d=isNaN(e)?1:0,a=S):(a=Math.floor(Math.log(e)/Math.LN2),e*(m=Math.pow(2,-a))<1&&(a--,m*=2),a+w>=1?e+=v/m:e+=v*Math.pow(2,1-w),e*m>=2&&(a++,m/=2),a+w>=S?(d=0,a=S):a+w>=1?(d=(e*m-1)*Math.pow(2,o),a=a+w):(d=e*Math.pow(2,w-1)*Math.pow(2,o),a=0));o>=8;s[t+x]=d&255,x+=C,d/=256,o-=8);for(a=a<<o|d,y+=o;y>0;s[t+x]=a&255,x+=C,a/=256,y-=8);s[t+x-C]|=F*128},me}l(Lr,"dew$1");var Dt={},Vi=!1;function Ur(){if(Vi)return Dt;Vi=!0;let s=Dr(),e=Lr(),t=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Dt.Buffer=a,Dt.SlowBuffer=N,Dt.INSPECT_MAX_BYTES=50;let i=2147483647;Dt.kMaxLength=i,a.TYPED_ARRAY_SUPPORT=o(),!a.TYPED_ARRAY_SUPPORT&&typeof console!="undefined"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function o(){try{let u=new Uint8Array(1),r={foo:function(){return 42}};return Object.setPrototypeOf(r,Uint8Array.prototype),Object.setPrototypeOf(u,r),u.foo()===42}catch(u){return!1}}l(o,"typedArraySupport"),Object.defineProperty(a.prototype,"parent",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.buffer}}),Object.defineProperty(a.prototype,"offset",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.byteOffset}});function c(u){if(u>i)throw new RangeError('The value "'+u+'" is invalid for option "size"');let r=new Uint8Array(u);return Object.setPrototypeOf(r,a.prototype),r}l(c,"createBuffer");function a(u,r,n){if(typeof u=="number"){if(typeof r=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return S(u)}return d(u,r,n)}l(a,"Buffer"),a.poolSize=8192;function d(u,r,n){if(typeof u=="string")return w(u,r);if(ArrayBuffer.isView(u))return x(u);if(u==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof u);if(bt(u,ArrayBuffer)||u&&bt(u.buffer,ArrayBuffer)||typeof SharedArrayBuffer!="undefined"&&(bt(u,SharedArrayBuffer)||u&&bt(u.buffer,SharedArrayBuffer)))return C(u,r,n);if(typeof u=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let f=u.valueOf&&u.valueOf();if(f!=null&&f!==u)return a.from(f,r,n);let p=F(u);if(p)return p;if(typeof Symbol!="undefined"&&Symbol.toPrimitive!=null&&typeof u[Symbol.toPrimitive]=="function")return a.from(u[Symbol.toPrimitive]("string"),r,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof u)}l(d,"from"),a.from=function(u,r,n){return d(u,r,n)},Object.setPrototypeOf(a.prototype,Uint8Array.prototype),Object.setPrototypeOf(a,Uint8Array);function m(u){if(typeof u!="number")throw new TypeError('"size" argument must be of type number');if(u<0)throw new RangeError('The value "'+u+'" is invalid for option "size"')}l(m,"assertSize");function y(u,r,n){return m(u),u<=0?c(u):r!==void 0?typeof n=="string"?c(u).fill(r,n):c(u).fill(r):c(u)}l(y,"alloc"),a.alloc=function(u,r,n){return y(u,r,n)};function S(u){return m(u),c(u<0?0:_(u)|0)}l(S,"allocUnsafe"),a.allocUnsafe=function(u){return S(u)},a.allocUnsafeSlow=function(u){return S(u)};function w(u,r){if((typeof r!="string"||r==="")&&(r="utf8"),!a.isEncoding(r))throw new TypeError("Unknown encoding: "+r);let n=D(u,r)|0,f=c(n),p=f.write(u,r);return p!==n&&(f=f.slice(0,p)),f}l(w,"fromString");function v(u){let r=u.length<0?0:_(u.length)|0,n=c(r);for(let f=0;f<r;f+=1)n[f]=u[f]&255;return n}l(v,"fromArrayLike");function x(u){if(bt(u,Uint8Array)){let r=new Uint8Array(u);return C(r.buffer,r.byteOffset,r.byteLength)}return v(u)}l(x,"fromArrayView");function C(u,r,n){if(r<0||u.byteLength<r)throw new RangeError('"offset" is outside of buffer bounds');if(u.byteLength<r+(n||0))throw new RangeError('"length" is outside of buffer bounds');let f;return r===void 0&&n===void 0?f=new Uint8Array(u):n===void 0?f=new Uint8Array(u,r):f=new Uint8Array(u,r,n),Object.setPrototypeOf(f,a.prototype),f}l(C,"fromArrayBuffer");function F(u){if(a.isBuffer(u)){let r=_(u.length)|0,n=c(r);return n.length===0||u.copy(n,0,0,r),n}if(u.length!==void 0)return typeof u.length!="number"||Le(u.length)?c(0):v(u);if(u.type==="Buffer"&&Array.isArray(u.data))return v(u.data)}l(F,"fromObject");function _(u){if(u>=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return u|0}l(_,"checked");function N(u){return+u!=u&&(u=0),a.alloc(+u)}l(N,"SlowBuffer"),a.isBuffer=l(function(r){return r!=null&&r._isBuffer===!0&&r!==a.prototype},"isBuffer"),a.compare=l(function(r,n){if(bt(r,Uint8Array)&&(r=a.from(r,r.offset,r.byteLength)),bt(n,Uint8Array)&&(n=a.from(n,n.offset,n.byteLength)),!a.isBuffer(r)||!a.isBuffer(n))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(r===n)return 0;let f=r.length,p=n.length;for(let b=0,E=Math.min(f,p);b<E;++b)if(r[b]!==n[b]){f=r[b],p=n[b];break}return f<p?-1:p<f?1:0},"compare"),a.isEncoding=l(function(r){switch(String(r).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},"isEncoding"),a.concat=l(function(r,n){if(!Array.isArray(r))throw new TypeError('"list" argument must be an Array of Buffers');if(r.length===0)return a.alloc(0);let f;if(n===void 0)for(n=0,f=0;f<r.length;++f)n+=r[f].length;let p=a.allocUnsafe(n),b=0;for(f=0;f<r.length;++f){let E=r[f];if(bt(E,Uint8Array))b+E.length>p.length?(a.isBuffer(E)||(E=a.from(E)),E.copy(p,b)):Uint8Array.prototype.set.call(p,E,b);else if(a.isBuffer(E))E.copy(p,b);else throw new TypeError('"list" argument must be an Array of Buffers');b+=E.length}return p},"concat");function D(u,r){if(a.isBuffer(u))return u.length;if(ArrayBuffer.isView(u)||bt(u,ArrayBuffer))return u.byteLength;if(typeof u!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof u);let n=u.length,f=arguments.length>2&&arguments[2]===!0;if(!f&&n===0)return 0;let p=!1;for(;;)switch(r){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return De(u).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return n*2;case"hex":return n>>>1;case"base64":return Ai(u).length;default:if(p)return f?-1:De(u).length;r=(""+r).toLowerCase(),p=!0}}l(D,"byteLength"),a.byteLength=D;function V(u,r,n){let f=!1;if((r===void 0||r<0)&&(r=0),r>this.length||((n===void 0||n>this.length)&&(n=this.length),n<=0)||(n>>>=0,r>>>=0,n<=r))return"";for(u||(u="utf8");;)switch(u){case"hex":return br(this,r,n);case"utf8":case"utf-8":return Ci(this,r,n);case"ascii":return gr(this,r,n);case"latin1":case"binary":return yr(this,r,n);case"base64":return mr(this,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return wr(this,r,n);default:if(f)throw new TypeError("Unknown encoding: "+u);u=(u+"").toLowerCase(),f=!0}}l(V,"slowToString"),a.prototype._isBuffer=!0;function ot(u,r,n){let f=u[r];u[r]=u[n],u[n]=f}l(ot,"swap"),a.prototype.swap16=l(function(){let r=this.length;if(r%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let n=0;n<r;n+=2)ot(this,n,n+1);return this},"swap16"),a.prototype.swap32=l(function(){let r=this.length;if(r%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let n=0;n<r;n+=4)ot(this,n,n+3),ot(this,n+1,n+2);return this},"swap32"),a.prototype.swap64=l(function(){let r=this.length;if(r%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let n=0;n<r;n+=8)ot(this,n,n+7),ot(this,n+1,n+6),ot(this,n+2,n+5),ot(this,n+3,n+4);return this},"swap64"),a.prototype.toString=l(function(){let r=this.length;return r===0?"":arguments.length===0?Ci(this,0,r):V.apply(this,arguments)},"toString"),a.prototype.toLocaleString=a.prototype.toString,a.prototype.equals=l(function(r){if(!a.isBuffer(r))throw new TypeError("Argument must be a Buffer");return this===r?!0:a.compare(this,r)===0},"equals"),a.prototype.inspect=l(function(){let r="",n=Dt.INSPECT_MAX_BYTES;return r=this.toString("hex",0,n).replace(/(.{2})/g,"$1 ").trim(),this.length>n&&(r+=" ... "),"<Buffer "+r+">"},"inspect"),t&&(a.prototype[t]=a.prototype.inspect),a.prototype.compare=l(function(r,n,f,p,b){if(bt(r,Uint8Array)&&(r=a.from(r,r.offset,r.byteLength)),!a.isBuffer(r))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof r);if(n===void 0&&(n=0),f===void 0&&(f=r?r.length:0),p===void 0&&(p=0),b===void 0&&(b=this.length),n<0||f>r.length||p<0||b>this.length)throw new RangeError("out of range index");if(p>=b&&n>=f)return 0;if(p>=b)return-1;if(n>=f)return 1;if(n>>>=0,f>>>=0,p>>>=0,b>>>=0,this===r)return 0;let E=b-p,T=f-n,W=Math.min(E,T),M=this.slice(p,b),$=r.slice(n,f);for(let L=0;L<W;++L)if(M[L]!==$[L]){E=M[L],T=$[L];break}return E<T?-1:T<E?1:0},"compare");function tt(u,r,n,f,p){if(u.length===0)return-1;if(typeof n=="string"?(f=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,Le(n)&&(n=p?0:u.length-1),n<0&&(n=u.length+n),n>=u.length){if(p)return-1;n=u.length-1}else if(n<0)if(p)n=0;else return-1;if(typeof r=="string"&&(r=a.from(r,f)),a.isBuffer(r))return r.length===0?-1:vi(u,r,n,f,p);if(typeof r=="number")return r=r&255,typeof Uint8Array.prototype.indexOf=="function"?p?Uint8Array.prototype.indexOf.call(u,r,n):Uint8Array.prototype.lastIndexOf.call(u,r,n):vi(u,[r],n,f,p);throw new TypeError("val must be string, number or Buffer")}l(tt,"bidirectionalIndexOf");function vi(u,r,n,f,p){let b=1,E=u.length,T=r.length;if(f!==void 0&&(f=String(f).toLowerCase(),f==="ucs2"||f==="ucs-2"||f==="utf16le"||f==="utf-16le")){if(u.length<2||r.length<2)return-1;b=2,E/=2,T/=2,n/=2}function W($,L){return b===1?$[L]:$.readUInt16BE(L*b)}l(W,"read");let M;if(p){let $=-1;for(M=n;M<E;M++)if(W(u,M)===W(r,$===-1?0:M-$)){if($===-1&&($=M),M-$+1===T)return $*b}else $!==-1&&(M-=M-$),$=-1}else for(n+T>E&&(n=E-T),M=n;M>=0;M--){let $=!0;for(let L=0;L<T;L++)if(W(u,M+L)!==W(r,L)){$=!1;break}if($)return M}return-1}l(vi,"arrayIndexOf"),a.prototype.includes=l(function(r,n,f){return this.indexOf(r,n,f)!==-1},"includes"),a.prototype.indexOf=l(function(r,n,f){return tt(this,r,n,f,!0)},"indexOf"),a.prototype.lastIndexOf=l(function(r,n,f){return tt(this,r,n,f,!1)},"lastIndexOf");function lr(u,r,n,f){n=Number(n)||0;let p=u.length-n;f?(f=Number(f),f>p&&(f=p)):f=p;let b=r.length;f>b/2&&(f=b/2);let E;for(E=0;E<f;++E){let T=parseInt(r.substr(E*2,2),16);if(Le(T))return E;u[n+E]=T}return E}l(lr,"hexWrite");function ur(u,r,n,f){return fe(De(r,u.length-n),u,n,f)}l(ur,"utf8Write");function dr(u,r,n,f){return fe(xr(r),u,n,f)}l(dr,"asciiWrite");function fr(u,r,n,f){return fe(Ai(r),u,n,f)}l(fr,"base64Write");function hr(u,r,n,f){return fe(vr(r,u.length-n),u,n,f)}l(hr,"ucs2Write"),a.prototype.write=l(function(r,n,f,p){if(n===void 0)p="utf8",f=this.length,n=0;else if(f===void 0&&typeof n=="string")p=n,f=this.length,n=0;else if(isFinite(n))n=n>>>0,isFinite(f)?(f=f>>>0,p===void 0&&(p="utf8")):(p=f,f=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let b=this.length-n;if((f===void 0||f>b)&&(f=b),r.length>0&&(f<0||n<0)||n>this.length)throw new RangeError("Attempt to write outside buffer bounds");p||(p="utf8");let E=!1;for(;;)switch(p){case"hex":return lr(this,r,n,f);case"utf8":case"utf-8":return ur(this,r,n,f);case"ascii":case"latin1":case"binary":return dr(this,r,n,f);case"base64":return fr(this,r,n,f);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return hr(this,r,n,f);default:if(E)throw new TypeError("Unknown encoding: "+p);p=(""+p).toLowerCase(),E=!0}},"write"),a.prototype.toJSON=l(function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},"toJSON");function mr(u,r,n){return r===0&&n===u.length?s.fromByteArray(u):s.fromByteArray(u.slice(r,n))}l(mr,"base64Slice");function Ci(u,r,n){n=Math.min(u.length,n);let f=[],p=r;for(;p<n;){let b=u[p],E=null,T=b>239?4:b>223?3:b>191?2:1;if(p+T<=n){let W,M,$,L;switch(T){case 1:b<128&&(E=b);break;case 2:W=u[p+1],(W&192)===128&&(L=(b&31)<<6|W&63,L>127&&(E=L));break;case 3:W=u[p+1],M=u[p+2],(W&192)===128&&(M&192)===128&&(L=(b&15)<<12|(W&63)<<6|M&63,L>2047&&(L<55296||L>57343)&&(E=L));break;case 4:W=u[p+1],M=u[p+2],$=u[p+3],(W&192)===128&&(M&192)===128&&($&192)===128&&(L=(b&15)<<18|(W&63)<<12|(M&63)<<6|$&63,L>65535&&L<1114112&&(E=L))}}E===null?(E=65533,T=1):E>65535&&(E-=65536,f.push(E>>>10&1023|55296),E=56320|E&1023),f.push(E),p+=T}return pr(f)}l(Ci,"utf8Slice");let _i=4096;function pr(u){let r=u.length;if(r<=_i)return String.fromCharCode.apply(String,u);let n="",f=0;for(;f<r;)n+=String.fromCharCode.apply(String,u.slice(f,f+=_i));return n}l(pr,"decodeCodePointsArray");function gr(u,r,n){let f="";n=Math.min(u.length,n);for(let p=r;p<n;++p)f+=String.fromCharCode(u[p]&127);return f}l(gr,"asciiSlice");function yr(u,r,n){let f="";n=Math.min(u.length,n);for(let p=r;p<n;++p)f+=String.fromCharCode(u[p]);return f}l(yr,"latin1Slice");function br(u,r,n){let f=u.length;(!r||r<0)&&(r=0),(!n||n<0||n>f)&&(n=f);let p="";for(let b=r;b<n;++b)p+=Cr[u[b]];return p}l(br,"hexSlice");function wr(u,r,n){let f=u.slice(r,n),p="";for(let b=0;b<f.length-1;b+=2)p+=String.fromCharCode(f[b]+f[b+1]*256);return p}l(wr,"utf16leSlice"),a.prototype.slice=l(function(r,n){let f=this.length;r=~~r,n=n===void 0?f:~~n,r<0?(r+=f,r<0&&(r=0)):r>f&&(r=f),n<0?(n+=f,n<0&&(n=0)):n>f&&(n=f),n<r&&(n=r);let p=this.subarray(r,n);return Object.setPrototypeOf(p,a.prototype),p},"slice");function H(u,r,n){if(u%1!==0||u<0)throw new RangeError("offset is not uint");if(u+r>n)throw new RangeError("Trying to access beyond buffer length")}l(H,"checkOffset"),a.prototype.readUintLE=a.prototype.readUIntLE=l(function(r,n,f){r=r>>>0,n=n>>>0,f||H(r,n,this.length);let p=this[r],b=1,E=0;for(;++E<n&&(b*=256);)p+=this[r+E]*b;return p},"readUIntLE"),a.prototype.readUintBE=a.prototype.readUIntBE=l(function(r,n,f){r=r>>>0,n=n>>>0,f||H(r,n,this.length);let p=this[r+--n],b=1;for(;n>0&&(b*=256);)p+=this[r+--n]*b;return p},"readUIntBE"),a.prototype.readUint8=a.prototype.readUInt8=l(function(r,n){return r=r>>>0,n||H(r,1,this.length),this[r]},"readUInt8"),a.prototype.readUint16LE=a.prototype.readUInt16LE=l(function(r,n){return r=r>>>0,n||H(r,2,this.length),this[r]|this[r+1]<<8},"readUInt16LE"),a.prototype.readUint16BE=a.prototype.readUInt16BE=l(function(r,n){return r=r>>>0,n||H(r,2,this.length),this[r]<<8|this[r+1]},"readUInt16BE"),a.prototype.readUint32LE=a.prototype.readUInt32LE=l(function(r,n){return r=r>>>0,n||H(r,4,this.length),(this[r]|this[r+1]<<8|this[r+2]<<16)+this[r+3]*16777216},"readUInt32LE"),a.prototype.readUint32BE=a.prototype.readUInt32BE=l(function(r,n){return r=r>>>0,n||H(r,4,this.length),this[r]*16777216+(this[r+1]<<16|this[r+2]<<8|this[r+3])},"readUInt32BE"),a.prototype.readBigUInt64LE=kt(l(function(r){r=r>>>0,$t(r,"offset");let n=this[r],f=this[r+7];(n===void 0||f===void 0)&&te(r,this.length-8);let p=n+this[++r]*P(2,8)+this[++r]*P(2,16)+this[++r]*P(2,24),b=this[++r]+this[++r]*P(2,8)+this[++r]*P(2,16)+f*P(2,24);return BigInt(p)+(BigInt(b)<<BigInt(32))},"readBigUInt64LE")),a.prototype.readBigUInt64BE=kt(l(function(r){r=r>>>0,$t(r,"offset");let n=this[r],f=this[r+7];(n===void 0||f===void 0)&&te(r,this.length-8);let p=n*P(2,24)+this[++r]*P(2,16)+this[++r]*P(2,8)+this[++r],b=this[++r]*P(2,24)+this[++r]*P(2,16)+this[++r]*P(2,8)+f;return(BigInt(p)<<BigInt(32))+BigInt(b)},"readBigUInt64BE")),a.prototype.readIntLE=l(function(r,n,f){r=r>>>0,n=n>>>0,f||H(r,n,this.length);let p=this[r],b=1,E=0;for(;++E<n&&(b*=256);)p+=this[r+E]*b;return b*=128,p>=b&&(p-=Math.pow(2,8*n)),p},"readIntLE"),a.prototype.readIntBE=l(function(r,n,f){r=r>>>0,n=n>>>0,f||H(r,n,this.length);let p=n,b=1,E=this[r+--p];for(;p>0&&(b*=256);)E+=this[r+--p]*b;return b*=128,E>=b&&(E-=Math.pow(2,8*n)),E},"readIntBE"),a.prototype.readInt8=l(function(r,n){return r=r>>>0,n||H(r,1,this.length),this[r]&128?(255-this[r]+1)*-1:this[r]},"readInt8"),a.prototype.readInt16LE=l(function(r,n){r=r>>>0,n||H(r,2,this.length);let f=this[r]|this[r+1]<<8;return f&32768?f|4294901760:f},"readInt16LE"),a.prototype.readInt16BE=l(function(r,n){r=r>>>0,n||H(r,2,this.length);let f=this[r+1]|this[r]<<8;return f&32768?f|4294901760:f},"readInt16BE"),a.prototype.readInt32LE=l(function(r,n){return r=r>>>0,n||H(r,4,this.length),this[r]|this[r+1]<<8|this[r+2]<<16|this[r+3]<<24},"readInt32LE"),a.prototype.readInt32BE=l(function(r,n){return r=r>>>0,n||H(r,4,this.length),this[r]<<24|this[r+1]<<16|this[r+2]<<8|this[r+3]},"readInt32BE"),a.prototype.readBigInt64LE=kt(l(function(r){r=r>>>0,$t(r,"offset");let n=this[r],f=this[r+7];(n===void 0||f===void 0)&&te(r,this.length-8);let p=this[r+4]+this[r+5]*P(2,8)+this[r+6]*P(2,16)+(f<<24);return(BigInt(p)<<BigInt(32))+BigInt(n+this[++r]*P(2,8)+this[++r]*P(2,16)+this[++r]*P(2,24))},"readBigInt64LE")),a.prototype.readBigInt64BE=kt(l(function(r){r=r>>>0,$t(r,"offset");let n=this[r],f=this[r+7];(n===void 0||f===void 0)&&te(r,this.length-8);let p=(n<<24)+this[++r]*P(2,16)+this[++r]*P(2,8)+this[++r];return(BigInt(p)<<BigInt(32))+BigInt(this[++r]*P(2,24)+this[++r]*P(2,16)+this[++r]*P(2,8)+f)},"readBigInt64BE")),a.prototype.readFloatLE=l(function(r,n){return r=r>>>0,n||H(r,4,this.length),e.read(this,r,!0,23,4)},"readFloatLE"),a.prototype.readFloatBE=l(function(r,n){return r=r>>>0,n||H(r,4,this.length),e.read(this,r,!1,23,4)},"readFloatBE"),a.prototype.readDoubleLE=l(function(r,n){return r=r>>>0,n||H(r,8,this.length),e.read(this,r,!0,52,8)},"readDoubleLE"),a.prototype.readDoubleBE=l(function(r,n){return r=r>>>0,n||H(r,8,this.length),e.read(this,r,!1,52,8)},"readDoubleBE");function rt(u,r,n,f,p,b){if(!a.isBuffer(u))throw new TypeError('"buffer" argument must be a Buffer instance');if(r>p||r<b)throw new RangeError('"value" argument is out of bounds');if(n+f>u.length)throw new RangeError("Index out of range")}l(rt,"checkInt"),a.prototype.writeUintLE=a.prototype.writeUIntLE=l(function(r,n,f,p){if(r=+r,n=n>>>0,f=f>>>0,!p){let T=Math.pow(2,8*f)-1;rt(this,r,n,f,T,0)}let b=1,E=0;for(this[n]=r&255;++E<f&&(b*=256);)this[n+E]=r/b&255;return n+f},"writeUIntLE"),a.prototype.writeUintBE=a.prototype.writeUIntBE=l(function(r,n,f,p){if(r=+r,n=n>>>0,f=f>>>0,!p){let T=Math.pow(2,8*f)-1;rt(this,r,n,f,T,0)}let b=f-1,E=1;for(this[n+b]=r&255;--b>=0&&(E*=256);)this[n+b]=r/E&255;return n+f},"writeUIntBE"),a.prototype.writeUint8=a.prototype.writeUInt8=l(function(r,n,f){return r=+r,n=n>>>0,f||rt(this,r,n,1,255,0),this[n]=r&255,n+1},"writeUInt8"),a.prototype.writeUint16LE=a.prototype.writeUInt16LE=l(function(r,n,f){return r=+r,n=n>>>0,f||rt(this,r,n,2,65535,0),this[n]=r&255,this[n+1]=r>>>8,n+2},"writeUInt16LE"),a.prototype.writeUint16BE=a.prototype.writeUInt16BE=l(function(r,n,f){return r=+r,n=n>>>0,f||rt(this,r,n,2,65535,0),this[n]=r>>>8,this[n+1]=r&255,n+2},"writeUInt16BE"),a.prototype.writeUint32LE=a.prototype.writeUInt32LE=l(function(r,n,f){return r=+r,n=n>>>0,f||rt(this,r,n,4,4294967295,0),this[n+3]=r>>>24,this[n+2]=r>>>16,this[n+1]=r>>>8,this[n]=r&255,n+4},"writeUInt32LE"),a.prototype.writeUint32BE=a.prototype.writeUInt32BE=l(function(r,n,f){return r=+r,n=n>>>0,f||rt(this,r,n,4,4294967295,0),this[n]=r>>>24,this[n+1]=r>>>16,this[n+2]=r>>>8,this[n+3]=r&255,n+4},"writeUInt32BE");function ki(u,r,n,f,p){Pi(r,f,p,u,n,7);let b=Number(r&BigInt(4294967295));u[n++]=b,b=b>>8,u[n++]=b,b=b>>8,u[n++]=b,b=b>>8,u[n++]=b;let E=Number(r>>BigInt(32)&BigInt(4294967295));return u[n++]=E,E=E>>8,u[n++]=E,E=E>>8,u[n++]=E,E=E>>8,u[n++]=E,n}l(ki,"wrtBigUInt64LE");function Ii(u,r,n,f,p){Pi(r,f,p,u,n,7);let b=Number(r&BigInt(4294967295));u[n+7]=b,b=b>>8,u[n+6]=b,b=b>>8,u[n+5]=b,b=b>>8,u[n+4]=b;let E=Number(r>>BigInt(32)&BigInt(4294967295));return u[n+3]=E,E=E>>8,u[n+2]=E,E=E>>8,u[n+1]=E,E=E>>8,u[n]=E,n+8}l(Ii,"wrtBigUInt64BE"),a.prototype.writeBigUInt64LE=kt(l(function(r,n=0){return ki(this,r,n,BigInt(0),BigInt("0xffffffffffffffff"))},"writeBigUInt64LE")),a.prototype.writeBigUInt64BE=kt(l(function(r,n=0){return Ii(this,r,n,BigInt(0),BigInt("0xffffffffffffffff"))},"writeBigUInt64BE")),a.prototype.writeIntLE=l(function(r,n,f,p){if(r=+r,n=n>>>0,!p){let W=Math.pow(2,8*f-1);rt(this,r,n,f,W-1,-W)}let b=0,E=1,T=0;for(this[n]=r&255;++b<f&&(E*=256);)r<0&&T===0&&this[n+b-1]!==0&&(T=1),this[n+b]=(r/E>>0)-T&255;return n+f},"writeIntLE"),a.prototype.writeIntBE=l(function(r,n,f,p){if(r=+r,n=n>>>0,!p){let W=Math.pow(2,8*f-1);rt(this,r,n,f,W-1,-W)}let b=f-1,E=1,T=0;for(this[n+b]=r&255;--b>=0&&(E*=256);)r<0&&T===0&&this[n+b+1]!==0&&(T=1),this[n+b]=(r/E>>0)-T&255;return n+f},"writeIntBE"),a.prototype.writeInt8=l(function(r,n,f){return r=+r,n=n>>>0,f||rt(this,r,n,1,127,-128),r<0&&(r=255+r+1),this[n]=r&255,n+1},"writeInt8"),a.prototype.writeInt16LE=l(function(r,n,f){return r=+r,n=n>>>0,f||rt(this,r,n,2,32767,-32768),this[n]=r&255,this[n+1]=r>>>8,n+2},"writeInt16LE"),a.prototype.writeInt16BE=l(function(r,n,f){return r=+r,n=n>>>0,f||rt(this,r,n,2,32767,-32768),this[n]=r>>>8,this[n+1]=r&255,n+2},"writeInt16BE"),a.prototype.writeInt32LE=l(function(r,n,f){return r=+r,n=n>>>0,f||rt(this,r,n,4,2147483647,-2147483648),this[n]=r&255,this[n+1]=r>>>8,this[n+2]=r>>>16,this[n+3]=r>>>24,n+4},"writeInt32LE"),a.prototype.writeInt32BE=l(function(r,n,f){return r=+r,n=n>>>0,f||rt(this,r,n,4,2147483647,-2147483648),r<0&&(r=4294967295+r+1),this[n]=r>>>24,this[n+1]=r>>>16,this[n+2]=r>>>8,this[n+3]=r&255,n+4},"writeInt32BE"),a.prototype.writeBigInt64LE=kt(l(function(r,n=0){return ki(this,r,n,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))},"writeBigInt64LE")),a.prototype.writeBigInt64BE=kt(l(function(r,n=0){return Ii(this,r,n,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))},"writeBigInt64BE"));function Bi(u,r,n,f,p,b){if(n+f>u.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}l(Bi,"checkIEEE754");function Ti(u,r,n,f,p){return r=+r,n=n>>>0,p||Bi(u,r,n,4),e.write(u,r,n,f,23,4),n+4}l(Ti,"writeFloat"),a.prototype.writeFloatLE=l(function(r,n,f){return Ti(this,r,n,!0,f)},"writeFloatLE"),a.prototype.writeFloatBE=l(function(r,n,f){return Ti(this,r,n,!1,f)},"writeFloatBE");function Oi(u,r,n,f,p){return r=+r,n=n>>>0,p||Bi(u,r,n,8),e.write(u,r,n,f,52,8),n+8}l(Oi,"writeDouble"),a.prototype.writeDoubleLE=l(function(r,n,f){return Oi(this,r,n,!0,f)},"writeDoubleLE"),a.prototype.writeDoubleBE=l(function(r,n,f){return Oi(this,r,n,!1,f)},"writeDoubleBE"),a.prototype.copy=l(function(r,n,f,p){if(!a.isBuffer(r))throw new TypeError("argument should be a Buffer");if(f||(f=0),!p&&p!==0&&(p=this.length),n>=r.length&&(n=r.length),n||(n=0),p>0&&p<f&&(p=f),p===f||r.length===0||this.length===0)return 0;if(n<0)throw new RangeError("targetStart out of bounds");if(f<0||f>=this.length)throw new RangeError("Index out of range");if(p<0)throw new RangeError("sourceEnd out of bounds");p>this.length&&(p=this.length),r.length-n<p-f&&(p=r.length-n+f);let b=p-f;return this===r&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(n,f,p):Uint8Array.prototype.set.call(r,this.subarray(f,p),n),b},"copy"),a.prototype.fill=l(function(r,n,f,p){if(typeof r=="string"){if(typeof n=="string"?(p=n,n=0,f=this.length):typeof f=="string"&&(p=f,f=this.length),p!==void 0&&typeof p!="string")throw new TypeError("encoding must be a string");if(typeof p=="string"&&!a.isEncoding(p))throw new TypeError("Unknown encoding: "+p);if(r.length===1){let E=r.charCodeAt(0);(p==="utf8"&&E<128||p==="latin1")&&(r=E)}}else typeof r=="number"?r=r&255:typeof r=="boolean"&&(r=Number(r));if(n<0||this.length<n||this.length<f)throw new RangeError("Out of range index");if(f<=n)return this;n=n>>>0,f=f===void 0?this.length:f>>>0,r||(r=0);let b;if(typeof r=="number")for(b=n;b<f;++b)this[b]=r;else{let E=a.isBuffer(r)?r:a.from(r,p),T=E.length;if(T===0)throw new TypeError('The value "'+r+'" is invalid for argument "value"');for(b=0;b<f-n;++b)this[b+n]=E[b%T]}return this},"fill");let Wt={};function Re(u,r,n){Wt[u]=l(class extends n{constructor(){super(),Object.defineProperty(this,"message",{value:r.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${u}]`,this.stack,delete this.name}get code(){return u}set code(p){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:p,writable:!0})}toString(){return`${this.name} [${u}]: ${this.message}`}},"NodeError")}l(Re,"E"),Re("ERR_BUFFER_OUT_OF_BOUNDS",function(u){return u?`${u} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),Re("ERR_INVALID_ARG_TYPE",function(u,r){return`The "${u}" argument must be of type number. Received type ${typeof r}`},TypeError),Re("ERR_OUT_OF_RANGE",function(u,r,n){let f=`The value of "${u}" is out of range.`,p=n;return Number.isInteger(n)&&Math.abs(n)>P(2,32)?p=Ni(String(n)):typeof n=="bigint"&&(p=String(n),(n>P(BigInt(2),BigInt(32))||n<-P(BigInt(2),BigInt(32)))&&(p=Ni(p)),p+="n"),f+=` It must be ${r}. Received ${p}`,f},RangeError);function Ni(u){let r="",n=u.length,f=u[0]==="-"?1:0;for(;n>=f+4;n-=3)r=`_${u.slice(n-3,n)}${r}`;return`${u.slice(0,n)}${r}`}l(Ni,"addNumericalSeparator");function Sr(u,r,n){$t(r,"offset"),(u[r]===void 0||u[r+n]===void 0)&&te(r,u.length-(n+1))}l(Sr,"checkBounds");function Pi(u,r,n,f,p,b){if(u>n||u<r){let E=typeof r=="bigint"?"n":"",T;throw b>3?r===0||r===BigInt(0)?T=`>= 0${E} and < 2${E} ** ${(b+1)*8}${E}`:T=`>= -(2${E} ** ${(b+1)*8-1}${E}) and < 2 ** ${(b+1)*8-1}${E}`:T=`>= ${r}${E} and <= ${n}${E}`,new Wt.ERR_OUT_OF_RANGE("value",T,u)}Sr(f,p,b)}l(Pi,"checkIntBI");function $t(u,r){if(typeof u!="number")throw new Wt.ERR_INVALID_ARG_TYPE(r,"number",u)}l($t,"validateNumber");function te(u,r,n){throw Math.floor(u)!==u?($t(u,n),new Wt.ERR_OUT_OF_RANGE(n||"offset","an integer",u)):r<0?new Wt.ERR_BUFFER_OUT_OF_BOUNDS:new Wt.ERR_OUT_OF_RANGE(n||"offset",`>= ${n?1:0} and <= ${r}`,u)}l(te,"boundsError");let Er=/[^+/0-9A-Za-z-_]/g;function Fr(u){if(u=u.split("=")[0],u=u.trim().replace(Er,""),u.length<2)return"";for(;u.length%4!==0;)u=u+"=";return u}l(Fr,"base64clean");function De(u,r){r=r||1/0;let n,f=u.length,p=null,b=[];for(let E=0;E<f;++E){if(n=u.charCodeAt(E),n>55295&&n<57344){if(!p){if(n>56319){(r-=3)>-1&&b.push(239,191,189);continue}else if(E+1===f){(r-=3)>-1&&b.push(239,191,189);continue}p=n;continue}if(n<56320){(r-=3)>-1&&b.push(239,191,189),p=n;continue}n=(p-55296<<10|n-56320)+65536}else p&&(r-=3)>-1&&b.push(239,191,189);if(p=null,n<128){if((r-=1)<0)break;b.push(n)}else if(n<2048){if((r-=2)<0)break;b.push(n>>6|192,n&63|128)}else if(n<65536){if((r-=3)<0)break;b.push(n>>12|224,n>>6&63|128,n&63|128)}else if(n<1114112){if((r-=4)<0)break;b.push(n>>18|240,n>>12&63|128,n>>6&63|128,n&63|128)}else throw new Error("Invalid code point")}return b}l(De,"utf8ToBytes");function xr(u){let r=[];for(let n=0;n<u.length;++n)r.push(u.charCodeAt(n)&255);return r}l(xr,"asciiToBytes");function vr(u,r){let n,f,p,b=[];for(let E=0;E<u.length&&!((r-=2)<0);++E)n=u.charCodeAt(E),f=n>>8,p=n%256,b.push(p),b.push(f);return b}l(vr,"utf16leToBytes");function Ai(u){return s.toByteArray(Fr(u))}l(Ai,"base64ToBytes");function fe(u,r,n,f){let p;for(p=0;p<f&&!(p+n>=r.length||p>=u.length);++p)r[p+n]=u[p];return p}l(fe,"blitBuffer");function bt(u,r){return u instanceof r||u!=null&&u.constructor!=null&&u.constructor.name!=null&&u.constructor.name===r.name}l(bt,"isInstance");function Le(u){return u!==u}l(Le,"numberIsNaN");let Cr=function(){let u="0123456789abcdef",r=new Array(256);for(let n=0;n<16;++n){let f=n*16;for(let p=0;p<16;++p)r[f+p]=u[n]+u[p]}return r}();function kt(u){return typeof BigInt=="undefined"?_r:u}l(kt,"defineBigIntMethod");function _r(){throw new Error("BigInt not supported")}return l(_r,"BufferBigIntNotDefined"),Dt}l(Ur,"dew");var Lt=Ur();Lt.Buffer;Lt.SlowBuffer;Lt.INSPECT_MAX_BYTES;Lt.kMaxLength;var k=Lt.Buffer,no=Lt.INSPECT_MAX_BYTES,so=Lt.kMaxLength;var Si={};he(Si,{_toUnixTimestamp:()=>Xi,access:()=>gs,accessSync:()=>Gs,appendFile:()=>Yn,appendFileSync:()=>ks,chmod:()=>ds,chmodSync:()=>Ys,chown:()=>ls,chownSync:()=>Ks,close:()=>qn,closeSync:()=>Bs,constants:()=>jt,createReadStream:()=>Ss,createWriteStream:()=>Es,exists:()=>Un,existsSync:()=>Hi,fchmod:()=>es,fchmodSync:()=>Ds,fchown:()=>ts,fchownSync:()=>Rs,fdatasync:()=>Hn,fdatasyncSync:()=>Ns,fstat:()=>Xn,fstatSync:()=>Is,fsync:()=>Gn,fsyncSync:()=>Os,ftruncate:()=>Jn,ftruncateSync:()=>Ts,futimes:()=>is,futimesSync:()=>Ls,getMount:()=>Yt,getMounts:()=>Ji,initialize:()=>Gi,lchmod:()=>fs,lchmodSync:()=>Xs,lchown:()=>us,lchownSync:()=>js,link:()=>os,linkSync:()=>Vs,lstat:()=>zn,lstatSync:()=>vs,lutimes:()=>ms,lutimesSync:()=>Js,mkdir:()=>ns,mkdirSync:()=>Ms,mount:()=>xe,open:()=>$n,openSync:()=>_s,promises:()=>oe,read:()=>Qn,readFile:()=>Kn,readFileSync:()=>Qi,readSync:()=>As,readdir:()=>ss,readdirSync:()=>zs,readlink:()=>cs,readlinkSync:()=>$s,realpath:()=>ps,realpathSync:()=>wi,rename:()=>Ln,renameSync:()=>Fs,rmdir:()=>rs,rmdirSync:()=>Us,stat:()=>Mn,statSync:()=>xs,symlink:()=>as,symlinkSync:()=>Ws,truncate:()=>Vn,truncateSync:()=>Cs,umount:()=>Ke,unlink:()=>Wn,unlinkSync:()=>Zi,unwatchFile:()=>bs,utimes:()=>hs,utimesSync:()=>qs,watch:()=>ws,watchFile:()=>ys,write:()=>Zn,writeFile:()=>jn,writeFileSync:()=>tr,writeSync:()=>Ps});var et=(F=>(F[F.EPERM=1]="EPERM",F[F.ENOENT=2]="ENOENT",F[F.EIO=5]="EIO",F[F.EBADF=9]="EBADF",F[F.EACCES=13]="EACCES",F[F.EBUSY=16]="EBUSY",F[F.EEXIST=17]="EEXIST",F[F.ENOTDIR=20]="ENOTDIR",F[F.EISDIR=21]="EISDIR",F[F.EINVAL=22]="EINVAL",F[F.EFBIG=27]="EFBIG",F[F.ENOSPC=28]="ENOSPC",F[F.EROFS=30]="EROFS",F[F.ENOTEMPTY=39]="ENOTEMPTY",F[F.ENOTSUP=95]="ENOTSUP",F))(et||{}),Z={};Z[1]="Operation not permitted.";Z[2]="No such file or directory.";Z[5]="Input/output error.";Z[9]="Bad file descriptor.";Z[13]="Permission denied.";Z[16]="Resource busy or locked.";Z[17]="File exists.";Z[20]="File is not a directory.";Z[21]="File is a directory.";Z[22]="Invalid argument.";Z[27]="File is too big.";Z[28]="No space left on disk.";Z[30]="Cannot modify a read-only file system.";Z[39]="Directory is not empty.";Z[95]="Operation is not supported.";var h=class extends Error{constructor(t,i=Z[t],o){super(i);this.syscall="";this.errno=t,this.code=et[t],this.path=o,this.message=`Error: ${this.code}: ${i}${this.path?`, '${this.path}'`:""}`}static fromJSON(t){let i=new h(t.errno,t.message,t.path);return i.code=t.code,i.stack=t.stack,i}static fromBuffer(t,i=0){return h.fromJSON(JSON.parse(t.toString("utf8",i+4,i+4+t.readUInt32LE(i))))}static FileError(t,i){return new h(t,Z[t],i)}static EACCES(t){return this.FileError(13,t)}static ENOENT(t){return this.FileError(2,t)}static EEXIST(t){return this.FileError(17,t)}static EISDIR(t){return this.FileError(21,t)}static ENOTDIR(t){return this.FileError(20,t)}static EPERM(t){return this.FileError(1,t)}static ENOTEMPTY(t){return this.FileError(39,t)}toString(){return this.message}toJSON(){return{errno:this.errno,code:this.code,path:this.path,stack:this.stack,message:this.message}}writeToBuffer(t=k.alloc(this.bufferSize()),i=0){let o=t.write(JSON.stringify(this.toJSON()),i+4);return t.writeUInt32LE(o,i),t}bufferSize(){return 4+k.byteLength(JSON.stringify(this.toJSON()))}};l(h,"ApiError");var Ue={},Wi=!1,Kt=typeof globalThis!="undefined"?globalThis:typeof self!="undefined"?self:global;function Mr(){if(Wi)return Ue;Wi=!0;var s=Ue={},e,t;function i(){throw new Error("setTimeout has not been defined")}l(i,"defaultSetTimout");function o(){throw new Error("clearTimeout has not been defined")}l(o,"defaultClearTimeout"),function(){try{typeof setTimeout=="function"?e=setTimeout:e=i}catch(F){e=i}try{typeof clearTimeout=="function"?t=clearTimeout:t=o}catch(F){t=o}}();function c(F){if(e===setTimeout)return setTimeout(F,0);if((e===i||!e)&&setTimeout)return e=setTimeout,setTimeout(F,0);try{return e(F,0)}catch(_){try{return e.call(null,F,0)}catch(N){return e.call(this||Kt,F,0)}}}l(c,"runTimeout");function a(F){if(t===clearTimeout)return clearTimeout(F);if((t===o||!t)&&clearTimeout)return t=clearTimeout,clearTimeout(F);try{return t(F)}catch(_){try{return t.call(null,F)}catch(N){return t.call(this||Kt,F)}}}l(a,"runClearTimeout");var d=[],m=!1,y,S=-1;function w(){!m||!y||(m=!1,y.length?d=y.concat(d):S=-1,d.length&&v())}l(w,"cleanUpNextTick");function v(){if(!m){var F=c(w);m=!0;for(var _=d.length;_;){for(y=d,d=[];++S<_;)y&&y[S].run();S=-1,_=d.length}y=null,m=!1,a(F)}}l(v,"drainQueue"),s.nextTick=function(F){var _=new Array(arguments.length-1);if(arguments.length>1)for(var N=1;N<arguments.length;N++)_[N-1]=arguments[N];d.push(new x(F,_)),d.length===1&&!m&&c(v)};function x(F,_){(this||Kt).fun=F,(this||Kt).array=_}l(x,"Item"),x.prototype.run=function(){(this||Kt).fun.apply(null,(this||Kt).array)},s.title="browser",s.browser=!0,s.env={},s.argv=[],s.version="",s.versions={};function C(){}return l(C,"noop"),s.on=C,s.addListener=C,s.once=C,s.off=C,s.removeListener=C,s.removeAllListeners=C,s.emit=C,s.prependListener=C,s.prependOnceListener=C,s.listeners=function(F){return[]},s.binding=function(F){throw new Error("process.binding is not supported")},s.cwd=function(){return"/"},s.chdir=function(F){throw new Error("process.chdir is not supported")},s.umask=function(){return 0},Ue}l(Mr,"dew");var z=Mr();z.platform="browser";z.addListener;z.argv;z.binding;z.browser;z.chdir;z.cwd;z.emit;z.env;z.listeners;z.nextTick;z.off;z.on;z.once;z.prependListener;z.prependOnceListener;z.removeAllListeners;z.removeListener;z.title;z.umask;z.version;z.versions;var Me={},$i=!1;function zr(){if($i)return Me;$i=!0;var s=z;function e(c){if(typeof c!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(c))}l(e,"assertPath");function t(c,a){for(var d="",m=0,y=-1,S=0,w,v=0;v<=c.length;++v){if(v<c.length)w=c.charCodeAt(v);else{if(w===47)break;w=47}if(w===47){if(!(y===v-1||S===1))if(y!==v-1&&S===2){if(d.length<2||m!==2||d.charCodeAt(d.length-1)!==46||d.charCodeAt(d.length-2)!==46){if(d.length>2){var x=d.lastIndexOf("/");if(x!==d.length-1){x===-1?(d="",m=0):(d=d.slice(0,x),m=d.length-1-d.lastIndexOf("/")),y=v,S=0;continue}}else if(d.length===2||d.length===1){d="",m=0,y=v,S=0;continue}}a&&(d.length>0?d+="/..":d="..",m=2)}else d.length>0?d+="/"+c.slice(y+1,v):d=c.slice(y+1,v),m=v-y-1;y=v,S=0}else w===46&&S!==-1?++S:S=-1}return d}l(t,"normalizeStringPosix");function i(c,a){var d=a.dir||a.root,m=a.base||(a.name||"")+(a.ext||"");return d?d===a.root?d+m:d+c+m:m}l(i,"_format");var o={resolve:l(function(){for(var a="",d=!1,m,y=arguments.length-1;y>=-1&&!d;y--){var S;y>=0?S=arguments[y]:(m===void 0&&(m=s.cwd()),S=m),e(S),S.length!==0&&(a=S+"/"+a,d=S.charCodeAt(0)===47)}return a=t(a,!d),d?a.length>0?"/"+a:"/":a.length>0?a:"."},"resolve"),normalize:l(function(a){if(e(a),a.length===0)return".";var d=a.charCodeAt(0)===47,m=a.charCodeAt(a.length-1)===47;return a=t(a,!d),a.length===0&&!d&&(a="."),a.length>0&&m&&(a+="/"),d?"/"+a:a},"normalize"),isAbsolute:l(function(a){return e(a),a.length>0&&a.charCodeAt(0)===47},"isAbsolute"),join:l(function(){if(arguments.length===0)return".";for(var a,d=0;d<arguments.length;++d){var m=arguments[d];e(m),m.length>0&&(a===void 0?a=m:a+="/"+m)}return a===void 0?".":o.normalize(a)},"join"),relative:l(function(a,d){if(e(a),e(d),a===d||(a=o.resolve(a),d=o.resolve(d),a===d))return"";for(var m=1;m<a.length&&a.charCodeAt(m)===47;++m);for(var y=a.length,S=y-m,w=1;w<d.length&&d.charCodeAt(w)===47;++w);for(var v=d.length,x=v-w,C=S<x?S:x,F=-1,_=0;_<=C;++_){if(_===C){if(x>C){if(d.charCodeAt(w+_)===47)return d.slice(w+_+1);if(_===0)return d.slice(w+_)}else S>C&&(a.charCodeAt(m+_)===47?F=_:_===0&&(F=0));break}var N=a.charCodeAt(m+_),D=d.charCodeAt(w+_);if(N!==D)break;N===47&&(F=_)}var V="";for(_=m+F+1;_<=y;++_)(_===y||a.charCodeAt(_)===47)&&(V.length===0?V+="..":V+="/..");return V.length>0?V+d.slice(w+F):(w+=F,d.charCodeAt(w)===47&&++w,d.slice(w))},"relative"),_makeLong:l(function(a){return a},"_makeLong"),dirname:l(function(a){if(e(a),a.length===0)return".";for(var d=a.charCodeAt(0),m=d===47,y=-1,S=!0,w=a.length-1;w>=1;--w)if(d=a.charCodeAt(w),d===47){if(!S){y=w;break}}else S=!1;return y===-1?m?"/":".":m&&y===1?"//":a.slice(0,y)},"dirname"),basename:l(function(a,d){if(d!==void 0&&typeof d!="string")throw new TypeError('"ext" argument must be a string');e(a);var m=0,y=-1,S=!0,w;if(d!==void 0&&d.length>0&&d.length<=a.length){if(d.length===a.length&&d===a)return"";var v=d.length-1,x=-1;for(w=a.length-1;w>=0;--w){var C=a.charCodeAt(w);if(C===47){if(!S){m=w+1;break}}else x===-1&&(S=!1,x=w+1),v>=0&&(C===d.charCodeAt(v)?--v===-1&&(y=w):(v=-1,y=x))}return m===y?y=x:y===-1&&(y=a.length),a.slice(m,y)}else{for(w=a.length-1;w>=0;--w)if(a.charCodeAt(w)===47){if(!S){m=w+1;break}}else y===-1&&(S=!1,y=w+1);return y===-1?"":a.slice(m,y)}},"basename"),extname:l(function(a){e(a);for(var d=-1,m=0,y=-1,S=!0,w=0,v=a.length-1;v>=0;--v){var x=a.charCodeAt(v);if(x===47){if(!S){m=v+1;break}continue}y===-1&&(S=!1,y=v+1),x===46?d===-1?d=v:w!==1&&(w=1):d!==-1&&(w=-1)}return d===-1||y===-1||w===0||w===1&&d===y-1&&d===m+1?"":a.slice(d,y)},"extname"),format:l(function(a){if(a===null||typeof a!="object")throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof a);return i("/",a)},"format"),parse:l(function(a){e(a);var d={root:"",dir:"",base:"",ext:"",name:""};if(a.length===0)return d;var m=a.charCodeAt(0),y=m===47,S;y?(d.root="/",S=1):S=0;for(var w=-1,v=0,x=-1,C=!0,F=a.length-1,_=0;F>=S;--F){if(m=a.charCodeAt(F),m===47){if(!C){v=F+1;break}continue}x===-1&&(C=!1,x=F+1),m===46?w===-1?w=F:_!==1&&(_=1):w!==-1&&(_=-1)}return w===-1||x===-1||_===0||_===1&&w===x-1&&w===v+1?x!==-1&&(v===0&&y?d.base=d.name=a.slice(1,x):d.base=d.name=a.slice(v,x)):(v===0&&y?(d.name=a.slice(1,w),d.base=a.slice(1,x)):(d.name=a.slice(v,w),d.base=a.slice(v,x)),d.ext=a.slice(w,x)),v>0?d.dir=a.slice(0,v-1):y&&(d.dir="/"),d},"parse"),sep:"/",delimiter:":",win32:null,posix:null};return o.posix=o,Me=o,Me}l(zr,"dew");var Q=zr();var Po=Q._makeLong,it=Q.basename,Ao=Q.delimiter,R=Q.dirname,Ro=Q.extname,Do=Q.format,Lo=Q.isAbsolute,St=Q.join,Uo=Q.normalize,Mo=Q.parse,It=Q.posix,Ki=Q.relative,Et=Q.resolve,Ut=Q.sep,zo=Q.win32;var ze=class{constructor(e,t,i,o,c,a){this.uid=e;this.gid=t;this.suid=i;this.sgid=o;this.euid=c;this.egid=a}},K=ze;l(K,"Cred"),K.Root=new ze(0,0,0,0,0,0);var jt={};he(jt,{COPYFILE_EXCL:()=>$r,COPYFILE_FICLONE:()=>Kr,COPYFILE_FICLONE_FORCE:()=>jr,F_OK:()=>Vr,O_APPEND:()=>Qr,O_CREAT:()=>Jr,O_DIRECT:()=>an,O_DIRECTORY:()=>tn,O_DSYNC:()=>sn,O_EXCL:()=>Gr,O_NOATIME:()=>en,O_NOCTTY:()=>Hr,O_NOFOLLOW:()=>rn,O_NONBLOCK:()=>cn,O_RDONLY:()=>Yr,O_RDWR:()=>qr,O_SYMLINK:()=>on,O_SYNC:()=>nn,O_TRUNC:()=>Zr,O_WRONLY:()=>Xr,R_OK:()=>xt,S_IFBLK:()=>un,S_IFCHR:()=>ln,S_IFDIR:()=>ge,S_IFIFO:()=>dn,S_IFLNK:()=>ye,S_IFMT:()=>ut,S_IFREG:()=>pe,S_IFSOCK:()=>fn,S_IRGRP:()=>bn,S_IROTH:()=>Fn,S_IRUSR:()=>mn,S_IRWXG:()=>yn,S_IRWXO:()=>En,S_IRWXU:()=>hn,S_IWGRP:()=>wn,S_IWOTH:()=>xn,S_IWUSR:()=>pn,S_IXGRP:()=>Sn,S_IXOTH:()=>vn,S_IXUSR:()=>gn,W_OK:()=>Tt,X_OK:()=>Wr});var Vr=0,xt=4,Tt=2,Wr=1,$r=1,Kr=2,jr=4,Yr=0,Xr=1,qr=2,Jr=64,Gr=128,Hr=256,Zr=512,Qr=1024,tn=65536,en=262144,rn=131072,nn=1052672,sn=4096,on=32768,an=16384,cn=2048,ut=61440,pe=32768,ge=16384,ln=8192,un=24576,dn=4096,ye=40960,fn=49152,hn=448,mn=256,pn=128,gn=64,yn=56,bn=32,wn=16,Sn=8,En=7,Fn=4,xn=2,vn=1;var j=(i=>(i[i.FILE=32768]="FILE",i[i.DIRECTORY=16384]="DIRECTORY",i[i.SYMLINK=40960]="SYMLINK",i))(j||{}),X=class{constructor(e,t,i,o,c,a,d,m,y){this.dev=0;this.ino=0;this.rdev=0;this.nlink=1;this.blksize=4096;this.uid=0;this.gid=0;this.fileData=null;this.size=t;let S=0;if(typeof o!="number"&&(S=Date.now(),o=S),typeof c!="number"&&(S||(S=Date.now()),c=S),typeof a!="number"&&(S||(S=Date.now()),a=S),typeof y!="number"&&(S||(S=Date.now()),y=S),typeof d!="number"&&(d=0),typeof m!="number"&&(m=0),this.atimeMs=o,this.ctimeMs=a,this.mtimeMs=c,this.birthtimeMs=y,i)this.mode=i;else switch(e){case j.FILE:this.mode=420;break;case j.DIRECTORY:default:this.mode=511}this.blocks=Math.ceil(t/512),this.mode&61440||(this.mode|=e)}static fromBuffer(e){let t=e.readUInt32LE(0),i=e.readUInt32LE(4),o=e.readDoubleLE(8),c=e.readDoubleLE(16),a=e.readDoubleLE(24),d=e.readUInt32LE(32),m=e.readUInt32LE(36);return new X(i&61440,t,i&-61441,o,c,a,d,m)}static clone(e){return new X(e.mode&61440,e.size,e.mode&-61441,e.atimeMs,e.mtimeMs,e.ctimeMs,e.uid,e.gid,e.birthtimeMs)}get atime(){return new Date(this.atimeMs)}get mtime(){return new Date(this.mtimeMs)}get ctime(){return new Date(this.ctimeMs)}get birthtime(){return new Date(this.birthtimeMs)}toBuffer(){let e=k.alloc(32);return e.writeUInt32LE(this.size,0),e.writeUInt32LE(this.mode,4),e.writeDoubleLE(this.atime.getTime(),8),e.writeDoubleLE(this.mtime.getTime(),16),e.writeDoubleLE(this.ctime.getTime(),24),e.writeUInt32LE(this.uid,32),e.writeUInt32LE(this.gid,36),e}isFile(){return(this.mode&61440)===32768}isDirectory(){return(this.mode&61440)===16384}isSymbolicLink(){return(this.mode&61440)===40960}hasAccess(e,t){if(t.euid===0||t.egid===0)return!0;let i=this.mode&-61441,o=15,c=15,a=15;if(t.euid==this.uid){let y=(3840&i)>>8;o=(e^y)&e}if(t.egid==this.gid){let y=(240&i)>>4;c=(e^y)&e}let d=15&i;return a=(e^d)&e,!(o&c&a)}getCred(e=this.uid,t=this.gid){return new K(e,t,this.uid,this.gid,e,t)}chmod(e){this.mode=this.mode&61440|e}chown(e,t){!isNaN(+e)&&0<=+e&&+e<P(2,32)&&(this.uid=e),!isNaN(+t)&&0<=+t&&+t<P(2,32)&&(this.gid=t)}isSocket(){return!1}isBlockDevice(){return!1}isCharacterDevice(){return!1}isFIFO(){return!1}};l(X,"Stats");var we=(o=>(o[o.NOP=0]="NOP",o[o.THROW_EXCEPTION=1]="THROW_EXCEPTION",o[o.TRUNCATE_FILE=2]="TRUNCATE_FILE",o[o.CREATE_FILE=3]="CREATE_FILE",o))(we||{}),Mt=class{static getFileFlag(e){return Mt.flagCache.has(e)||Mt.flagCache.set(e,new Mt(e)),Mt.flagCache.get(e)}constructor(e){if(this.flagStr=e,Mt.validFlagStrs.indexOf(e)<0)throw new h(22,"Invalid flag: "+e)}getFlagString(){return this.flagStr}getMode(){let e=0;return e<<=1,e+=+this.isReadable(),e<<=1,e+=+this.isWriteable(),e<<=1,e}isReadable(){return this.flagStr.indexOf("r")!==-1||this.flagStr.indexOf("+")!==-1}isWriteable(){return this.flagStr.indexOf("w")!==-1||this.flagStr.indexOf("a")!==-1||this.flagStr.indexOf("+")!==-1}isTruncating(){return this.flagStr.indexOf("w")!==-1}isAppendable(){return this.flagStr.indexOf("a")!==-1}isSynchronous(){return this.flagStr.indexOf("s")!==-1}isExclusive(){return this.flagStr.indexOf("x")!==-1}pathExistsAction(){return this.isExclusive()?1:this.isTruncating()?2:0}pathNotExistsAction(){return(this.isWriteable()||this.isAppendable())&&this.flagStr!=="r+"?3:1}},O=Mt;l(O,"FileFlag"),O.flagCache=new Map,O.validFlagStrs=["r","r+","rs","rs+","w","wx","w+","wx+","a","ax","a+","ax+"];var re=class{sync(){return g(this,null,function*(){throw new h(95)})}syncSync(){throw new h(95)}datasync(){return g(this,null,function*(){return this.sync()})}datasyncSync(){return this.syncSync()}chown(e,t){return g(this,null,function*(){throw new h(95)})}chownSync(e,t){throw new h(95)}chmod(e){return g(this,null,function*(){throw new h(95)})}chmodSync(e){throw new h(95)}utimes(e,t){return g(this,null,function*(){throw new h(95)})}utimesSync(e,t){throw new h(95)}};l(re,"BaseFile");var at=class extends re{constructor(t,i,o,c,a){super();this._pos=0;this._dirty=!1;if(this._fs=t,this._path=i,this._flag=o,this._stat=c,this._buffer=a||k.alloc(0),this._stat.size!==this._buffer.length&&this._flag.isReadable())throw new Error(`Invalid buffer: Buffer is ${this._buffer.length} long, yet Stats object specifies that file is ${this._stat.size} long.`)}getBuffer(){return this._buffer}getStats(){return this._stat}getFlag(){return this._flag}getPath(){return this._path}getPos(){return this._flag.isAppendable()?this._stat.size:this._pos}advancePos(t){return this._pos+=t}setPos(t){return this._pos=t}sync(){return g(this,null,function*(){this.syncSync()})}syncSync(){throw new h(95)}close(){return g(this,null,function*(){this.closeSync()})}closeSync(){throw new h(95)}stat(){return g(this,null,function*(){return X.clone(this._stat)})}statSync(){return X.clone(this._stat)}truncate(t){if(this.truncateSync(t),this._flag.isSynchronous()&&!Yt("/").metadata.synchronous)return this.sync()}truncateSync(t){if(this._dirty=!0,!this._flag.isWriteable())throw new h(1,"File not opened with a writeable mode.");if(this._stat.mtimeMs=Date.now(),t>this._buffer.length){let o=k.alloc(t-this._buffer.length,0);this.writeSync(o,0,o.length,this._buffer.length),this._flag.isSynchronous()&&Yt("/").metadata.synchronous&&this.syncSync();return}this._stat.size=t;let i=k.alloc(t);this._buffer.copy(i,0,0,t),this._buffer=i,this._flag.isSynchronous()&&Yt("/").metadata.synchronous&&this.syncSync()}write(t,i,o,c){return g(this,null,function*(){return this.writeSync(t,i,o,c)})}writeSync(t,i,o,c){if(this._dirty=!0,c==null&&(c=this.getPos()),!this._flag.isWriteable())throw new h(1,"File not opened with a writeable mode.");let a=c+o;if(a>this._stat.size&&(this._stat.size=a,a>this._buffer.length)){let m=k.alloc(a);this._buffer.copy(m),this._buffer=m}let d=t.copy(this._buffer,c,i,i+o);return this._stat.mtimeMs=Date.now(),this._flag.isSynchronous()?(this.syncSync(),d):(this.setPos(c+d),d)}read(t,i,o,c){return g(this,null,function*(){return{bytesRead:this.readSync(t,i,o,c),buffer:t}})}readSync(t,i,o,c){if(!this._flag.isReadable())throw new h(1,"File not opened with a readable mode.");c==null&&(c=this.getPos()),c+o>this._stat.size&&(o=this._stat.size-c);let d=this._buffer.copy(t,i,c,c+o);return this._stat.atimeMs=Date.now(),this._pos=c+o,d}chmod(t){return g(this,null,function*(){this.chmodSync(t)})}chmodSync(t){if(!this._fs.metadata.supportsProperties)throw new h(95);this._dirty=!0,this._stat.chmod(t),this.syncSync()}chown(t,i){return g(this,null,function*(){this.chownSync(t,i)})}chownSync(t,i){if(!this._fs.metadata.supportsProperties)throw new h(95);this._dirty=!0,this._stat.chown(t,i),this.syncSync()}isDirty(){return this._dirty}resetDirty(){this._dirty=!1}};l(at,"PreloadFile");var be=class extends at{constructor(e,t,i,o,c){super(e,t,i,o,c)}sync(){return g(this,null,function*(){})}syncSync(){}close(){return g(this,null,function*(){})}closeSync(){}};l(be,"NoSyncFile");var Ot=class{constructor(e){}};l(Ot,"FileSystem");var Ve=class extends Ot{constructor(t){super();this._ready=Promise.resolve(this)}get metadata(){return{name:this.constructor.name,readonly:!1,synchronous:!1,supportsProperties:!1,supportsLinks:!1,totalSpace:0,freeSpace:0}}whenReady(){return this._ready}openFile(t,i,o){return g(this,null,function*(){throw new h(95)})}createFile(t,i,o,c){return g(this,null,function*(){throw new h(95)})}open(t,i,o,c){return g(this,null,function*(){try{let a=yield this.stat(t,c);switch(i.pathExistsAction()){case 1:throw h.EEXIST(t);case 2:let d=yield this.openFile(t,i,c);if(!d)throw new Error("BFS has reached an impossible code path; please file a bug.");return yield d.truncate(0),yield d.sync(),d;case 0:return this.openFile(t,i,c);default:throw new h(22,"Invalid FileFlag object.")}}catch(a){switch(i.pathNotExistsAction()){case 3:let d=yield this.stat(R(t),c);if(d&&!d.isDirectory())throw h.ENOTDIR(R(t));return this.createFile(t,i,o,c);case 1:throw h.ENOENT(t);default:throw new h(22,"Invalid FileFlag object.")}}})}access(t,i,o){return g(this,null,function*(){throw new h(95)})}accessSync(t,i,o){throw new h(95)}rename(t,i,o){return g(this,null,function*(){throw new h(95)})}renameSync(t,i,o){throw new h(95)}stat(t,i){return g(this,null,function*(){throw new h(95)})}statSync(t,i){throw new h(95)}openFileSync(t,i,o){throw new h(95)}createFileSync(t,i,o,c){throw new h(95)}openSync(t,i,o,c){let a;try{a=this.statSync(t,c)}catch(d){switch(i.pathNotExistsAction()){case 3:if(!this.statSync(R(t),c).isDirectory())throw h.ENOTDIR(R(t));return this.createFileSync(t,i,o,c);case 1:throw h.ENOENT(t);default:throw new h(22,"Invalid FileFlag object.")}}if(!a.hasAccess(o,c))throw h.EACCES(t);switch(i.pathExistsAction()){case 1:throw h.EEXIST(t);case 2:return this.unlinkSync(t,c),this.createFileSync(t,i,a.mode,c);case 0:return this.openFileSync(t,i,c);default:throw new h(22,"Invalid FileFlag object.")}}unlink(t,i){return g(this,null,function*(){throw new h(95)})}unlinkSync(t,i){throw new h(95)}rmdir(t,i){return g(this,null,function*(){throw new h(95)})}rmdirSync(t,i){throw new h(95)}mkdir(t,i,o){return g(this,null,function*(){throw new h(95)})}mkdirSync(t,i,o){throw new h(95)}readdir(t,i){return g(this,null,function*(){throw new h(95)})}readdirSync(t,i){throw new h(95)}exists(t,i){return g(this,null,function*(){try{return yield this.stat(t,i),!0}catch(o){return!1}})}existsSync(t,i){try{return this.statSync(t,i),!0}catch(o){return!1}}realpath(t,i){return g(this,null,function*(){if(this.metadata.supportsLinks){let o=t.split(Ut);for(let c=0;c<o.length;c++){let a=o.slice(0,c+1);o[c]=St(...a)}return o.join(Ut)}else{if(!(yield this.exists(t,i)))throw h.ENOENT(t);return t}})}realpathSync(t,i){if(this.metadata.supportsLinks){let o=t.split(Ut);for(let c=0;c<o.length;c++){let a=o.slice(0,c+1);o[c]=St(...a)}return o.join(Ut)}else{if(this.existsSync(t,i))return t;throw h.ENOENT(t)}}truncate(t,i,o){return g(this,null,function*(){let c=yield this.open(t,O.getFileFlag("r+"),420,o);try{yield c.truncate(i)}finally{yield c.close()}})}truncateSync(t,i,o){let c=this.openSync(t,O.getFileFlag("r+"),420,o);try{c.truncateSync(i)}finally{c.closeSync()}}readFile(t,i,o,c){return g(this,null,function*(){let a=yield this.open(t,o,420,c);try{let d=yield a.stat(),m=k.alloc(d.size);return yield a.read(m,0,d.size,0),yield a.close(),i===null?m:m.toString(i)}finally{yield a.close()}})}readFileSync(t,i,o,c){let a=this.openSync(t,o,420,c);try{let d=a.statSync(),m=k.alloc(d.size);return a.readSync(m,0,d.size,0),a.closeSync(),i===null?m:m.toString(i)}finally{a.closeSync()}}writeFile(t,i,o,c,a,d){return g(this,null,function*(){let m=yield this.open(t,c,a,d);try{typeof i=="string"&&(i=k.from(i,o)),yield m.write(i,0,i.length,0)}finally{yield m.close()}})}writeFileSync(t,i,o,c,a,d){let m=this.openSync(t,c,a,d);try{typeof i=="string"&&(i=k.from(i,o)),m.writeSync(i,0,i.length,0)}finally{m.closeSync()}}appendFile(t,i,o,c,a,d){return g(this,null,function*(){let m=yield this.open(t,c,a,d);try{typeof i=="string"&&(i=k.from(i,o)),yield m.write(i,0,i.length,null)}finally{yield m.close()}})}appendFileSync(t,i,o,c,a,d){let m=this.openSync(t,c,a,d);try{typeof i=="string"&&(i=k.from(i,o)),m.writeSync(i,0,i.length,null)}finally{m.closeSync()}}chmod(t,i,o){return g(this,null,function*(){throw new h(95)})}chmodSync(t,i,o){throw new h(95)}chown(t,i,o,c){return g(this,null,function*(){throw new h(95)})}chownSync(t,i,o,c){throw new h(95)}utimes(t,i,o,c){return g(this,null,function*(){throw new h(95)})}utimesSync(t,i,o,c){throw new h(95)}link(t,i,o){return g(this,null,function*(){throw new h(95)})}linkSync(t,i,o){throw new h(95)}symlink(t,i,o,c){return g(this,null,function*(){throw new h(95)})}symlinkSync(t,i,o,c){throw new h(95)}readlink(t,i){return g(this,null,function*(){throw new h(95)})}readlinkSync(t,i){throw new h(95)}},dt=Ve;l(dt,"BaseFileSystem"),dt.Name=Ve.name;var Nt=class extends dt{get metadata(){return wt(pt({},super.metadata),{synchronous:!0})}access(e,t,i){return g(this,null,function*(){return this.accessSync(e,t,i)})}rename(e,t,i){return g(this,null,function*(){return this.renameSync(e,t,i)})}stat(e,t){return g(this,null,function*(){return this.statSync(e,t)})}open(e,t,i,o){return g(this,null,function*(){return this.openSync(e,t,i,o)})}unlink(e,t){return g(this,null,function*(){return this.unlinkSync(e,t)})}rmdir(e,t){return g(this,null,function*(){return this.rmdirSync(e,t)})}mkdir(e,t,i){return g(this,null,function*(){return this.mkdirSync(e,t,i)})}readdir(e,t){return g(this,null,function*(){return this.readdirSync(e,t)})}chmod(e,t,i){return g(this,null,function*(){return this.chmodSync(e,t,i)})}chown(e,t,i,o){return g(this,null,function*(){return this.chownSync(e,t,i,o)})}utimes(e,t,i,o){return g(this,null,function*(){return this.utimesSync(e,t,i,o)})}link(e,t,i){return g(this,null,function*(){return this.linkSync(e,t,i)})}symlink(e,t,i,o){return g(this,null,function*(){return this.symlinkSync(e,t,i,o)})}readlink(e,t){return g(this,null,function*(){return this.readlinkSync(e,t)})}};l(Nt,"SynchronousFileSystem");var nt=class{constructor(e,t,i,o,c,a,d,m){this.id=e;this.size=t;this.mode=i;this.atime=o;this.mtime=c;this.ctime=a;this.uid=d;this.gid=m}static fromBuffer(e){if(e===void 0)throw new Error("NO");return new nt(e.toString("ascii",38),e.readUInt32LE(0),e.readUInt16LE(4),e.readDoubleLE(6),e.readDoubleLE(14),e.readDoubleLE(22),e.readUInt32LE(30),e.readUInt32LE(34))}toStats(){return new X((this.mode&61440)===j.DIRECTORY?j.DIRECTORY:j.FILE,this.size,this.mode,this.atime,this.mtime,this.ctime,this.uid,this.gid)}getSize(){return 38+this.id.length}toBuffer(e=k.alloc(this.getSize())){return e.writeUInt32LE(this.size,0),e.writeUInt16LE(this.mode,4),e.writeDoubleLE(this.atime,6),e.writeDoubleLE(this.mtime,14),e.writeDoubleLE(this.ctime,22),e.writeUInt32LE(this.uid,30),e.writeUInt32LE(this.gid,34),e.write(this.id,38,this.id.length,"ascii"),e}update(e){let t=!1;this.size!==e.size&&(this.size=e.size,t=!0),this.mode!==e.mode&&(this.mode=e.mode,t=!0);let i=e.atime.getTime();this.atime!==i&&(this.atime=i,t=!0);let o=e.mtime.getTime();this.mtime!==o&&(this.mtime=o,t=!0);let c=e.ctime.getTime();return this.ctime!==c&&(this.ctime=c,t=!0),this.uid!==e.uid&&(this.uid=e.uid,t=!0),this.uid!==e.uid&&(this.uid=e.uid,t=!0),t}isFile(){return(this.mode&61440)===j.FILE}isDirectory(){return(this.mode&61440)===j.DIRECTORY}};l(nt,"Inode");function ji(s,e,t,i){i.existsSync(s,t)||(ji(R(s),e,t,i),i.mkdirSync(s,e,t))}l(ji,"mkdirpSync");function Cn(s,e=0,t=s.length){if(e<0||t<0||t>s.length||e>t)throw new TypeError(`Invalid slice bounds on buffer of length ${s.length}: [${e}, ${t}]`);return s.length===0?k.alloc(0):s.subarray(e,t)}l(Cn,"copyingSlice");function _n(s){return g(this,null,function*(){if(!k.isBuffer(s))throw new h(22,"option must be a Buffer.")})}l(_n,"bufferValidator");function Se(s,e,t,i,o){return Math.min(s+1,e+1,t+1,i===o?e:e+1)}l(Se,"_min");function kn(s,e){if(s===e)return 0;s.length>e.length&&([s,e]=[e,s]);let t=s.length,i=e.length;for(;t>0&&s.charCodeAt(t-1)===e.charCodeAt(i-1);)t--,i--;let o=0;for(;o<t&&s.charCodeAt(o)===e.charCodeAt(o);)o++;if(t-=o,i-=o,t===0||i===1)return i;let c=new Array(t<<1);for(let v=0;v<t;)c[t+v]=s.charCodeAt(o+v),c[v]=++v;let a,d,m,y,S;for(a=0;a+3<i;){let v=e.charCodeAt(o+(d=a)),x=e.charCodeAt(o+(m=a+1)),C=e.charCodeAt(o+(y=a+2)),F=e.charCodeAt(o+(S=a+3)),_=a+=4;for(let N=0;N<t;){let D=c[t+N],V=c[N];d=Se(V,d,m,v,D),m=Se(d,m,y,x,D),y=Se(m,y,S,C,D),_=Se(y,S,_,F,D),c[N++]=_,S=y,y=m,m=d,d=V}}let w=0;for(;a<i;){let v=e.charCodeAt(o+(d=a));w=++a;for(let x=0;x<t;x++){let C=c[x];c[x]=w=C<d||w<d?C>w?w+1:C+1:v===c[t+x]?d:d+1,d=C}}return w}l(kn,"levenshtein");function We(s,e){return g(this,null,function*(){let t=s.Options,i=s.Name,o=0,c=!1,a=!1;for(let d in t)if(Object.prototype.hasOwnProperty.call(t,d)){let m=t[d],y=e&&e[d];if(y==null){if(!m.optional){let S=Object.keys(e).filter(w=>!(w in t)).map(w=>({str:w,distance:kn(d,w)})).filter(w=>w.distance<5).sort((w,v)=>w.distance-v.distance);if(c)return;throw c=!0,new h(22,`[${i}] Required option '${d}' not provided.${S.length>0?` You provided unrecognized option '${S[0].str}'; perhaps you meant to type '${d}'.`:""}
|
|
1
|
+
var ZenFS=(()=>{var ee=Object.defineProperty,kr=Object.defineProperties,Ir=Object.getOwnPropertyDescriptor,Br=Object.getOwnPropertyDescriptors,Tr=Object.getOwnPropertyNames,Ri=Object.getOwnPropertySymbols,Or=Object.getPrototypeOf,Li=Object.prototype.hasOwnProperty,Nr=Object.prototype.propertyIsEnumerable,Pr=Reflect.get;var P=Math.pow,Di=(s,e,t)=>e in s?ee(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,pt=(s,e)=>{for(var t in e||(e={}))Li.call(e,t)&&Di(s,t,e[t]);if(Ri)for(var t of Ri(e))Nr.call(e,t)&&Di(s,t,e[t]);return s},wt=(s,e)=>kr(s,Br(e)),l=(s,e)=>ee(s,"name",{value:e,configurable:!0});var he=(s,e)=>{for(var t in e)ee(s,t,{get:e[t],enumerable:!0})},Ar=(s,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Tr(e))!Li.call(s,o)&&o!==t&&ee(s,o,{get:()=>e[o],enumerable:!(i=Ir(e,o))||i.enumerable});return s};var Rr=s=>Ar(ee({},"__esModule",{value:!0}),s);var Ui=(s,e,t)=>Pr(Or(s),t,e);var g=(s,e,t)=>new Promise((i,o)=>{var c=m=>{try{d(t.next(m))}catch(y){o(y)}},a=m=>{try{d(t.throw(m))}catch(y){o(y)}},d=m=>m.done?i(m.value):Promise.resolve(m.value).then(c,a);d((t=t.apply(s,e)).next())});var Qs={};he(Qs,{ActionType:()=>we,ApiError:()=>h,AsyncKeyValueFile:()=>Zt,AsyncKeyValueFileSystem:()=>Ae,AsyncMirror:()=>vt,BaseFile:()=>re,BaseFileSystem:()=>dt,Cred:()=>K,ErrorCode:()=>et,ErrorStrings:()=>Z,FileFlag:()=>O,FileIndex:()=>Qt,FileSystem:()=>Ot,FileType:()=>j,FolderAdapter:()=>yt,InMemory:()=>ht,IndexDirInode:()=>_t,IndexFileInode:()=>de,NoSyncFile:()=>be,OverlayFS:()=>Ft,PreloadFile:()=>at,ROOT_NODE_ID:()=>ft,SimpleSyncRWTransaction:()=>Xt,Stats:()=>X,SyncKeyValueFile:()=>qt,SyncKeyValueFileSystem:()=>Jt,SynchronousFileSystem:()=>Nt,backends:()=>Ne,checkOptions:()=>We,configure:()=>Hs,default:()=>Zs,fs:()=>Be,getEmptyDirNode:()=>ne,getFileSystem:()=>cr,initialize:()=>ar,isIndexDirInode:()=>Fi,isIndexFileInode:()=>sr,mkdirpSync:()=>ji,randomUUID:()=>zt,registerBackend:()=>nr,setImmediate:()=>In,toPromise:()=>kn,wait:()=>_n});var ie={},Mi=!1;function Dr(){if(Mi)return ie;Mi=!0,ie.byteLength=d,ie.toByteArray=y,ie.fromByteArray=v;for(var s=[],e=[],t=typeof Uint8Array!="undefined"?Uint8Array:Array,i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o=0,c=i.length;o<c;++o)s[o]=i[o],e[i.charCodeAt(o)]=o;e["-".charCodeAt(0)]=62,e["_".charCodeAt(0)]=63;function a(x){var C=x.length;if(C%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var F=x.indexOf("=");F===-1&&(F=C);var _=F===C?0:4-F%4;return[F,_]}l(a,"getLens");function d(x){var C=a(x),F=C[0],_=C[1];return(F+_)*3/4-_}l(d,"byteLength");function m(x,C,F){return(C+F)*3/4-F}l(m,"_byteLength");function y(x){var C,F=a(x),_=F[0],N=F[1],D=new t(m(x,_,N)),V=0,ot=N>0?_-4:_,tt;for(tt=0;tt<ot;tt+=4)C=e[x.charCodeAt(tt)]<<18|e[x.charCodeAt(tt+1)]<<12|e[x.charCodeAt(tt+2)]<<6|e[x.charCodeAt(tt+3)],D[V++]=C>>16&255,D[V++]=C>>8&255,D[V++]=C&255;return N===2&&(C=e[x.charCodeAt(tt)]<<2|e[x.charCodeAt(tt+1)]>>4,D[V++]=C&255),N===1&&(C=e[x.charCodeAt(tt)]<<10|e[x.charCodeAt(tt+1)]<<4|e[x.charCodeAt(tt+2)]>>2,D[V++]=C>>8&255,D[V++]=C&255),D}l(y,"toByteArray");function S(x){return s[x>>18&63]+s[x>>12&63]+s[x>>6&63]+s[x&63]}l(S,"tripletToBase64");function w(x,C,F){for(var _,N=[],D=C;D<F;D+=3)_=(x[D]<<16&16711680)+(x[D+1]<<8&65280)+(x[D+2]&255),N.push(S(_));return N.join("")}l(w,"encodeChunk");function v(x){for(var C,F=x.length,_=F%3,N=[],D=16383,V=0,ot=F-_;V<ot;V+=D)N.push(w(x,V,V+D>ot?ot:V+D));return _===1?(C=x[F-1],N.push(s[C>>2]+s[C<<4&63]+"==")):_===2&&(C=(x[F-2]<<8)+x[F-1],N.push(s[C>>10]+s[C>>4&63]+s[C<<2&63]+"=")),N.join("")}return l(v,"fromByteArray"),ie}l(Dr,"dew$2");var me={},zi=!1;function Lr(){if(zi)return me;zi=!0;return me.read=function(s,e,t,i,o){var c,a,d=o*8-i-1,m=(1<<d)-1,y=m>>1,S=-7,w=t?o-1:0,v=t?-1:1,x=s[e+w];for(w+=v,c=x&(1<<-S)-1,x>>=-S,S+=d;S>0;c=c*256+s[e+w],w+=v,S-=8);for(a=c&(1<<-S)-1,c>>=-S,S+=i;S>0;a=a*256+s[e+w],w+=v,S-=8);if(c===0)c=1-y;else{if(c===m)return a?NaN:(x?-1:1)*(1/0);a=a+Math.pow(2,i),c=c-y}return(x?-1:1)*a*Math.pow(2,c-i)},me.write=function(s,e,t,i,o,c){var a,d,m,y=c*8-o-1,S=(1<<y)-1,w=S>>1,v=o===23?Math.pow(2,-24)-Math.pow(2,-77):0,x=i?0:c-1,C=i?1:-1,F=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(d=isNaN(e)?1:0,a=S):(a=Math.floor(Math.log(e)/Math.LN2),e*(m=Math.pow(2,-a))<1&&(a--,m*=2),a+w>=1?e+=v/m:e+=v*Math.pow(2,1-w),e*m>=2&&(a++,m/=2),a+w>=S?(d=0,a=S):a+w>=1?(d=(e*m-1)*Math.pow(2,o),a=a+w):(d=e*Math.pow(2,w-1)*Math.pow(2,o),a=0));o>=8;s[t+x]=d&255,x+=C,d/=256,o-=8);for(a=a<<o|d,y+=o;y>0;s[t+x]=a&255,x+=C,a/=256,y-=8);s[t+x-C]|=F*128},me}l(Lr,"dew$1");var Dt={},Vi=!1;function Ur(){if(Vi)return Dt;Vi=!0;let s=Dr(),e=Lr(),t=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Dt.Buffer=a,Dt.SlowBuffer=N,Dt.INSPECT_MAX_BYTES=50;let i=2147483647;Dt.kMaxLength=i,a.TYPED_ARRAY_SUPPORT=o(),!a.TYPED_ARRAY_SUPPORT&&typeof console!="undefined"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function o(){try{let u=new Uint8Array(1),r={foo:function(){return 42}};return Object.setPrototypeOf(r,Uint8Array.prototype),Object.setPrototypeOf(u,r),u.foo()===42}catch(u){return!1}}l(o,"typedArraySupport"),Object.defineProperty(a.prototype,"parent",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.buffer}}),Object.defineProperty(a.prototype,"offset",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.byteOffset}});function c(u){if(u>i)throw new RangeError('The value "'+u+'" is invalid for option "size"');let r=new Uint8Array(u);return Object.setPrototypeOf(r,a.prototype),r}l(c,"createBuffer");function a(u,r,n){if(typeof u=="number"){if(typeof r=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return S(u)}return d(u,r,n)}l(a,"Buffer"),a.poolSize=8192;function d(u,r,n){if(typeof u=="string")return w(u,r);if(ArrayBuffer.isView(u))return x(u);if(u==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof u);if(bt(u,ArrayBuffer)||u&&bt(u.buffer,ArrayBuffer)||typeof SharedArrayBuffer!="undefined"&&(bt(u,SharedArrayBuffer)||u&&bt(u.buffer,SharedArrayBuffer)))return C(u,r,n);if(typeof u=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let f=u.valueOf&&u.valueOf();if(f!=null&&f!==u)return a.from(f,r,n);let p=F(u);if(p)return p;if(typeof Symbol!="undefined"&&Symbol.toPrimitive!=null&&typeof u[Symbol.toPrimitive]=="function")return a.from(u[Symbol.toPrimitive]("string"),r,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof u)}l(d,"from"),a.from=function(u,r,n){return d(u,r,n)},Object.setPrototypeOf(a.prototype,Uint8Array.prototype),Object.setPrototypeOf(a,Uint8Array);function m(u){if(typeof u!="number")throw new TypeError('"size" argument must be of type number');if(u<0)throw new RangeError('The value "'+u+'" is invalid for option "size"')}l(m,"assertSize");function y(u,r,n){return m(u),u<=0?c(u):r!==void 0?typeof n=="string"?c(u).fill(r,n):c(u).fill(r):c(u)}l(y,"alloc"),a.alloc=function(u,r,n){return y(u,r,n)};function S(u){return m(u),c(u<0?0:_(u)|0)}l(S,"allocUnsafe"),a.allocUnsafe=function(u){return S(u)},a.allocUnsafeSlow=function(u){return S(u)};function w(u,r){if((typeof r!="string"||r==="")&&(r="utf8"),!a.isEncoding(r))throw new TypeError("Unknown encoding: "+r);let n=D(u,r)|0,f=c(n),p=f.write(u,r);return p!==n&&(f=f.slice(0,p)),f}l(w,"fromString");function v(u){let r=u.length<0?0:_(u.length)|0,n=c(r);for(let f=0;f<r;f+=1)n[f]=u[f]&255;return n}l(v,"fromArrayLike");function x(u){if(bt(u,Uint8Array)){let r=new Uint8Array(u);return C(r.buffer,r.byteOffset,r.byteLength)}return v(u)}l(x,"fromArrayView");function C(u,r,n){if(r<0||u.byteLength<r)throw new RangeError('"offset" is outside of buffer bounds');if(u.byteLength<r+(n||0))throw new RangeError('"length" is outside of buffer bounds');let f;return r===void 0&&n===void 0?f=new Uint8Array(u):n===void 0?f=new Uint8Array(u,r):f=new Uint8Array(u,r,n),Object.setPrototypeOf(f,a.prototype),f}l(C,"fromArrayBuffer");function F(u){if(a.isBuffer(u)){let r=_(u.length)|0,n=c(r);return n.length===0||u.copy(n,0,0,r),n}if(u.length!==void 0)return typeof u.length!="number"||Le(u.length)?c(0):v(u);if(u.type==="Buffer"&&Array.isArray(u.data))return v(u.data)}l(F,"fromObject");function _(u){if(u>=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return u|0}l(_,"checked");function N(u){return+u!=u&&(u=0),a.alloc(+u)}l(N,"SlowBuffer"),a.isBuffer=l(function(r){return r!=null&&r._isBuffer===!0&&r!==a.prototype},"isBuffer"),a.compare=l(function(r,n){if(bt(r,Uint8Array)&&(r=a.from(r,r.offset,r.byteLength)),bt(n,Uint8Array)&&(n=a.from(n,n.offset,n.byteLength)),!a.isBuffer(r)||!a.isBuffer(n))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(r===n)return 0;let f=r.length,p=n.length;for(let b=0,E=Math.min(f,p);b<E;++b)if(r[b]!==n[b]){f=r[b],p=n[b];break}return f<p?-1:p<f?1:0},"compare"),a.isEncoding=l(function(r){switch(String(r).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},"isEncoding"),a.concat=l(function(r,n){if(!Array.isArray(r))throw new TypeError('"list" argument must be an Array of Buffers');if(r.length===0)return a.alloc(0);let f;if(n===void 0)for(n=0,f=0;f<r.length;++f)n+=r[f].length;let p=a.allocUnsafe(n),b=0;for(f=0;f<r.length;++f){let E=r[f];if(bt(E,Uint8Array))b+E.length>p.length?(a.isBuffer(E)||(E=a.from(E)),E.copy(p,b)):Uint8Array.prototype.set.call(p,E,b);else if(a.isBuffer(E))E.copy(p,b);else throw new TypeError('"list" argument must be an Array of Buffers');b+=E.length}return p},"concat");function D(u,r){if(a.isBuffer(u))return u.length;if(ArrayBuffer.isView(u)||bt(u,ArrayBuffer))return u.byteLength;if(typeof u!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof u);let n=u.length,f=arguments.length>2&&arguments[2]===!0;if(!f&&n===0)return 0;let p=!1;for(;;)switch(r){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return De(u).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return n*2;case"hex":return n>>>1;case"base64":return Ai(u).length;default:if(p)return f?-1:De(u).length;r=(""+r).toLowerCase(),p=!0}}l(D,"byteLength"),a.byteLength=D;function V(u,r,n){let f=!1;if((r===void 0||r<0)&&(r=0),r>this.length||((n===void 0||n>this.length)&&(n=this.length),n<=0)||(n>>>=0,r>>>=0,n<=r))return"";for(u||(u="utf8");;)switch(u){case"hex":return br(this,r,n);case"utf8":case"utf-8":return Ci(this,r,n);case"ascii":return gr(this,r,n);case"latin1":case"binary":return yr(this,r,n);case"base64":return mr(this,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return wr(this,r,n);default:if(f)throw new TypeError("Unknown encoding: "+u);u=(u+"").toLowerCase(),f=!0}}l(V,"slowToString"),a.prototype._isBuffer=!0;function ot(u,r,n){let f=u[r];u[r]=u[n],u[n]=f}l(ot,"swap"),a.prototype.swap16=l(function(){let r=this.length;if(r%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let n=0;n<r;n+=2)ot(this,n,n+1);return this},"swap16"),a.prototype.swap32=l(function(){let r=this.length;if(r%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let n=0;n<r;n+=4)ot(this,n,n+3),ot(this,n+1,n+2);return this},"swap32"),a.prototype.swap64=l(function(){let r=this.length;if(r%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let n=0;n<r;n+=8)ot(this,n,n+7),ot(this,n+1,n+6),ot(this,n+2,n+5),ot(this,n+3,n+4);return this},"swap64"),a.prototype.toString=l(function(){let r=this.length;return r===0?"":arguments.length===0?Ci(this,0,r):V.apply(this,arguments)},"toString"),a.prototype.toLocaleString=a.prototype.toString,a.prototype.equals=l(function(r){if(!a.isBuffer(r))throw new TypeError("Argument must be a Buffer");return this===r?!0:a.compare(this,r)===0},"equals"),a.prototype.inspect=l(function(){let r="",n=Dt.INSPECT_MAX_BYTES;return r=this.toString("hex",0,n).replace(/(.{2})/g,"$1 ").trim(),this.length>n&&(r+=" ... "),"<Buffer "+r+">"},"inspect"),t&&(a.prototype[t]=a.prototype.inspect),a.prototype.compare=l(function(r,n,f,p,b){if(bt(r,Uint8Array)&&(r=a.from(r,r.offset,r.byteLength)),!a.isBuffer(r))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof r);if(n===void 0&&(n=0),f===void 0&&(f=r?r.length:0),p===void 0&&(p=0),b===void 0&&(b=this.length),n<0||f>r.length||p<0||b>this.length)throw new RangeError("out of range index");if(p>=b&&n>=f)return 0;if(p>=b)return-1;if(n>=f)return 1;if(n>>>=0,f>>>=0,p>>>=0,b>>>=0,this===r)return 0;let E=b-p,T=f-n,W=Math.min(E,T),M=this.slice(p,b),$=r.slice(n,f);for(let L=0;L<W;++L)if(M[L]!==$[L]){E=M[L],T=$[L];break}return E<T?-1:T<E?1:0},"compare");function tt(u,r,n,f,p){if(u.length===0)return-1;if(typeof n=="string"?(f=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,Le(n)&&(n=p?0:u.length-1),n<0&&(n=u.length+n),n>=u.length){if(p)return-1;n=u.length-1}else if(n<0)if(p)n=0;else return-1;if(typeof r=="string"&&(r=a.from(r,f)),a.isBuffer(r))return r.length===0?-1:vi(u,r,n,f,p);if(typeof r=="number")return r=r&255,typeof Uint8Array.prototype.indexOf=="function"?p?Uint8Array.prototype.indexOf.call(u,r,n):Uint8Array.prototype.lastIndexOf.call(u,r,n):vi(u,[r],n,f,p);throw new TypeError("val must be string, number or Buffer")}l(tt,"bidirectionalIndexOf");function vi(u,r,n,f,p){let b=1,E=u.length,T=r.length;if(f!==void 0&&(f=String(f).toLowerCase(),f==="ucs2"||f==="ucs-2"||f==="utf16le"||f==="utf-16le")){if(u.length<2||r.length<2)return-1;b=2,E/=2,T/=2,n/=2}function W($,L){return b===1?$[L]:$.readUInt16BE(L*b)}l(W,"read");let M;if(p){let $=-1;for(M=n;M<E;M++)if(W(u,M)===W(r,$===-1?0:M-$)){if($===-1&&($=M),M-$+1===T)return $*b}else $!==-1&&(M-=M-$),$=-1}else for(n+T>E&&(n=E-T),M=n;M>=0;M--){let $=!0;for(let L=0;L<T;L++)if(W(u,M+L)!==W(r,L)){$=!1;break}if($)return M}return-1}l(vi,"arrayIndexOf"),a.prototype.includes=l(function(r,n,f){return this.indexOf(r,n,f)!==-1},"includes"),a.prototype.indexOf=l(function(r,n,f){return tt(this,r,n,f,!0)},"indexOf"),a.prototype.lastIndexOf=l(function(r,n,f){return tt(this,r,n,f,!1)},"lastIndexOf");function lr(u,r,n,f){n=Number(n)||0;let p=u.length-n;f?(f=Number(f),f>p&&(f=p)):f=p;let b=r.length;f>b/2&&(f=b/2);let E;for(E=0;E<f;++E){let T=parseInt(r.substr(E*2,2),16);if(Le(T))return E;u[n+E]=T}return E}l(lr,"hexWrite");function ur(u,r,n,f){return fe(De(r,u.length-n),u,n,f)}l(ur,"utf8Write");function dr(u,r,n,f){return fe(xr(r),u,n,f)}l(dr,"asciiWrite");function fr(u,r,n,f){return fe(Ai(r),u,n,f)}l(fr,"base64Write");function hr(u,r,n,f){return fe(vr(r,u.length-n),u,n,f)}l(hr,"ucs2Write"),a.prototype.write=l(function(r,n,f,p){if(n===void 0)p="utf8",f=this.length,n=0;else if(f===void 0&&typeof n=="string")p=n,f=this.length,n=0;else if(isFinite(n))n=n>>>0,isFinite(f)?(f=f>>>0,p===void 0&&(p="utf8")):(p=f,f=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let b=this.length-n;if((f===void 0||f>b)&&(f=b),r.length>0&&(f<0||n<0)||n>this.length)throw new RangeError("Attempt to write outside buffer bounds");p||(p="utf8");let E=!1;for(;;)switch(p){case"hex":return lr(this,r,n,f);case"utf8":case"utf-8":return ur(this,r,n,f);case"ascii":case"latin1":case"binary":return dr(this,r,n,f);case"base64":return fr(this,r,n,f);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return hr(this,r,n,f);default:if(E)throw new TypeError("Unknown encoding: "+p);p=(""+p).toLowerCase(),E=!0}},"write"),a.prototype.toJSON=l(function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},"toJSON");function mr(u,r,n){return r===0&&n===u.length?s.fromByteArray(u):s.fromByteArray(u.slice(r,n))}l(mr,"base64Slice");function Ci(u,r,n){n=Math.min(u.length,n);let f=[],p=r;for(;p<n;){let b=u[p],E=null,T=b>239?4:b>223?3:b>191?2:1;if(p+T<=n){let W,M,$,L;switch(T){case 1:b<128&&(E=b);break;case 2:W=u[p+1],(W&192)===128&&(L=(b&31)<<6|W&63,L>127&&(E=L));break;case 3:W=u[p+1],M=u[p+2],(W&192)===128&&(M&192)===128&&(L=(b&15)<<12|(W&63)<<6|M&63,L>2047&&(L<55296||L>57343)&&(E=L));break;case 4:W=u[p+1],M=u[p+2],$=u[p+3],(W&192)===128&&(M&192)===128&&($&192)===128&&(L=(b&15)<<18|(W&63)<<12|(M&63)<<6|$&63,L>65535&&L<1114112&&(E=L))}}E===null?(E=65533,T=1):E>65535&&(E-=65536,f.push(E>>>10&1023|55296),E=56320|E&1023),f.push(E),p+=T}return pr(f)}l(Ci,"utf8Slice");let _i=4096;function pr(u){let r=u.length;if(r<=_i)return String.fromCharCode.apply(String,u);let n="",f=0;for(;f<r;)n+=String.fromCharCode.apply(String,u.slice(f,f+=_i));return n}l(pr,"decodeCodePointsArray");function gr(u,r,n){let f="";n=Math.min(u.length,n);for(let p=r;p<n;++p)f+=String.fromCharCode(u[p]&127);return f}l(gr,"asciiSlice");function yr(u,r,n){let f="";n=Math.min(u.length,n);for(let p=r;p<n;++p)f+=String.fromCharCode(u[p]);return f}l(yr,"latin1Slice");function br(u,r,n){let f=u.length;(!r||r<0)&&(r=0),(!n||n<0||n>f)&&(n=f);let p="";for(let b=r;b<n;++b)p+=Cr[u[b]];return p}l(br,"hexSlice");function wr(u,r,n){let f=u.slice(r,n),p="";for(let b=0;b<f.length-1;b+=2)p+=String.fromCharCode(f[b]+f[b+1]*256);return p}l(wr,"utf16leSlice"),a.prototype.slice=l(function(r,n){let f=this.length;r=~~r,n=n===void 0?f:~~n,r<0?(r+=f,r<0&&(r=0)):r>f&&(r=f),n<0?(n+=f,n<0&&(n=0)):n>f&&(n=f),n<r&&(n=r);let p=this.subarray(r,n);return Object.setPrototypeOf(p,a.prototype),p},"slice");function H(u,r,n){if(u%1!==0||u<0)throw new RangeError("offset is not uint");if(u+r>n)throw new RangeError("Trying to access beyond buffer length")}l(H,"checkOffset"),a.prototype.readUintLE=a.prototype.readUIntLE=l(function(r,n,f){r=r>>>0,n=n>>>0,f||H(r,n,this.length);let p=this[r],b=1,E=0;for(;++E<n&&(b*=256);)p+=this[r+E]*b;return p},"readUIntLE"),a.prototype.readUintBE=a.prototype.readUIntBE=l(function(r,n,f){r=r>>>0,n=n>>>0,f||H(r,n,this.length);let p=this[r+--n],b=1;for(;n>0&&(b*=256);)p+=this[r+--n]*b;return p},"readUIntBE"),a.prototype.readUint8=a.prototype.readUInt8=l(function(r,n){return r=r>>>0,n||H(r,1,this.length),this[r]},"readUInt8"),a.prototype.readUint16LE=a.prototype.readUInt16LE=l(function(r,n){return r=r>>>0,n||H(r,2,this.length),this[r]|this[r+1]<<8},"readUInt16LE"),a.prototype.readUint16BE=a.prototype.readUInt16BE=l(function(r,n){return r=r>>>0,n||H(r,2,this.length),this[r]<<8|this[r+1]},"readUInt16BE"),a.prototype.readUint32LE=a.prototype.readUInt32LE=l(function(r,n){return r=r>>>0,n||H(r,4,this.length),(this[r]|this[r+1]<<8|this[r+2]<<16)+this[r+3]*16777216},"readUInt32LE"),a.prototype.readUint32BE=a.prototype.readUInt32BE=l(function(r,n){return r=r>>>0,n||H(r,4,this.length),this[r]*16777216+(this[r+1]<<16|this[r+2]<<8|this[r+3])},"readUInt32BE"),a.prototype.readBigUInt64LE=kt(l(function(r){r=r>>>0,$t(r,"offset");let n=this[r],f=this[r+7];(n===void 0||f===void 0)&&te(r,this.length-8);let p=n+this[++r]*P(2,8)+this[++r]*P(2,16)+this[++r]*P(2,24),b=this[++r]+this[++r]*P(2,8)+this[++r]*P(2,16)+f*P(2,24);return BigInt(p)+(BigInt(b)<<BigInt(32))},"readBigUInt64LE")),a.prototype.readBigUInt64BE=kt(l(function(r){r=r>>>0,$t(r,"offset");let n=this[r],f=this[r+7];(n===void 0||f===void 0)&&te(r,this.length-8);let p=n*P(2,24)+this[++r]*P(2,16)+this[++r]*P(2,8)+this[++r],b=this[++r]*P(2,24)+this[++r]*P(2,16)+this[++r]*P(2,8)+f;return(BigInt(p)<<BigInt(32))+BigInt(b)},"readBigUInt64BE")),a.prototype.readIntLE=l(function(r,n,f){r=r>>>0,n=n>>>0,f||H(r,n,this.length);let p=this[r],b=1,E=0;for(;++E<n&&(b*=256);)p+=this[r+E]*b;return b*=128,p>=b&&(p-=Math.pow(2,8*n)),p},"readIntLE"),a.prototype.readIntBE=l(function(r,n,f){r=r>>>0,n=n>>>0,f||H(r,n,this.length);let p=n,b=1,E=this[r+--p];for(;p>0&&(b*=256);)E+=this[r+--p]*b;return b*=128,E>=b&&(E-=Math.pow(2,8*n)),E},"readIntBE"),a.prototype.readInt8=l(function(r,n){return r=r>>>0,n||H(r,1,this.length),this[r]&128?(255-this[r]+1)*-1:this[r]},"readInt8"),a.prototype.readInt16LE=l(function(r,n){r=r>>>0,n||H(r,2,this.length);let f=this[r]|this[r+1]<<8;return f&32768?f|4294901760:f},"readInt16LE"),a.prototype.readInt16BE=l(function(r,n){r=r>>>0,n||H(r,2,this.length);let f=this[r+1]|this[r]<<8;return f&32768?f|4294901760:f},"readInt16BE"),a.prototype.readInt32LE=l(function(r,n){return r=r>>>0,n||H(r,4,this.length),this[r]|this[r+1]<<8|this[r+2]<<16|this[r+3]<<24},"readInt32LE"),a.prototype.readInt32BE=l(function(r,n){return r=r>>>0,n||H(r,4,this.length),this[r]<<24|this[r+1]<<16|this[r+2]<<8|this[r+3]},"readInt32BE"),a.prototype.readBigInt64LE=kt(l(function(r){r=r>>>0,$t(r,"offset");let n=this[r],f=this[r+7];(n===void 0||f===void 0)&&te(r,this.length-8);let p=this[r+4]+this[r+5]*P(2,8)+this[r+6]*P(2,16)+(f<<24);return(BigInt(p)<<BigInt(32))+BigInt(n+this[++r]*P(2,8)+this[++r]*P(2,16)+this[++r]*P(2,24))},"readBigInt64LE")),a.prototype.readBigInt64BE=kt(l(function(r){r=r>>>0,$t(r,"offset");let n=this[r],f=this[r+7];(n===void 0||f===void 0)&&te(r,this.length-8);let p=(n<<24)+this[++r]*P(2,16)+this[++r]*P(2,8)+this[++r];return(BigInt(p)<<BigInt(32))+BigInt(this[++r]*P(2,24)+this[++r]*P(2,16)+this[++r]*P(2,8)+f)},"readBigInt64BE")),a.prototype.readFloatLE=l(function(r,n){return r=r>>>0,n||H(r,4,this.length),e.read(this,r,!0,23,4)},"readFloatLE"),a.prototype.readFloatBE=l(function(r,n){return r=r>>>0,n||H(r,4,this.length),e.read(this,r,!1,23,4)},"readFloatBE"),a.prototype.readDoubleLE=l(function(r,n){return r=r>>>0,n||H(r,8,this.length),e.read(this,r,!0,52,8)},"readDoubleLE"),a.prototype.readDoubleBE=l(function(r,n){return r=r>>>0,n||H(r,8,this.length),e.read(this,r,!1,52,8)},"readDoubleBE");function rt(u,r,n,f,p,b){if(!a.isBuffer(u))throw new TypeError('"buffer" argument must be a Buffer instance');if(r>p||r<b)throw new RangeError('"value" argument is out of bounds');if(n+f>u.length)throw new RangeError("Index out of range")}l(rt,"checkInt"),a.prototype.writeUintLE=a.prototype.writeUIntLE=l(function(r,n,f,p){if(r=+r,n=n>>>0,f=f>>>0,!p){let T=Math.pow(2,8*f)-1;rt(this,r,n,f,T,0)}let b=1,E=0;for(this[n]=r&255;++E<f&&(b*=256);)this[n+E]=r/b&255;return n+f},"writeUIntLE"),a.prototype.writeUintBE=a.prototype.writeUIntBE=l(function(r,n,f,p){if(r=+r,n=n>>>0,f=f>>>0,!p){let T=Math.pow(2,8*f)-1;rt(this,r,n,f,T,0)}let b=f-1,E=1;for(this[n+b]=r&255;--b>=0&&(E*=256);)this[n+b]=r/E&255;return n+f},"writeUIntBE"),a.prototype.writeUint8=a.prototype.writeUInt8=l(function(r,n,f){return r=+r,n=n>>>0,f||rt(this,r,n,1,255,0),this[n]=r&255,n+1},"writeUInt8"),a.prototype.writeUint16LE=a.prototype.writeUInt16LE=l(function(r,n,f){return r=+r,n=n>>>0,f||rt(this,r,n,2,65535,0),this[n]=r&255,this[n+1]=r>>>8,n+2},"writeUInt16LE"),a.prototype.writeUint16BE=a.prototype.writeUInt16BE=l(function(r,n,f){return r=+r,n=n>>>0,f||rt(this,r,n,2,65535,0),this[n]=r>>>8,this[n+1]=r&255,n+2},"writeUInt16BE"),a.prototype.writeUint32LE=a.prototype.writeUInt32LE=l(function(r,n,f){return r=+r,n=n>>>0,f||rt(this,r,n,4,4294967295,0),this[n+3]=r>>>24,this[n+2]=r>>>16,this[n+1]=r>>>8,this[n]=r&255,n+4},"writeUInt32LE"),a.prototype.writeUint32BE=a.prototype.writeUInt32BE=l(function(r,n,f){return r=+r,n=n>>>0,f||rt(this,r,n,4,4294967295,0),this[n]=r>>>24,this[n+1]=r>>>16,this[n+2]=r>>>8,this[n+3]=r&255,n+4},"writeUInt32BE");function ki(u,r,n,f,p){Pi(r,f,p,u,n,7);let b=Number(r&BigInt(4294967295));u[n++]=b,b=b>>8,u[n++]=b,b=b>>8,u[n++]=b,b=b>>8,u[n++]=b;let E=Number(r>>BigInt(32)&BigInt(4294967295));return u[n++]=E,E=E>>8,u[n++]=E,E=E>>8,u[n++]=E,E=E>>8,u[n++]=E,n}l(ki,"wrtBigUInt64LE");function Ii(u,r,n,f,p){Pi(r,f,p,u,n,7);let b=Number(r&BigInt(4294967295));u[n+7]=b,b=b>>8,u[n+6]=b,b=b>>8,u[n+5]=b,b=b>>8,u[n+4]=b;let E=Number(r>>BigInt(32)&BigInt(4294967295));return u[n+3]=E,E=E>>8,u[n+2]=E,E=E>>8,u[n+1]=E,E=E>>8,u[n]=E,n+8}l(Ii,"wrtBigUInt64BE"),a.prototype.writeBigUInt64LE=kt(l(function(r,n=0){return ki(this,r,n,BigInt(0),BigInt("0xffffffffffffffff"))},"writeBigUInt64LE")),a.prototype.writeBigUInt64BE=kt(l(function(r,n=0){return Ii(this,r,n,BigInt(0),BigInt("0xffffffffffffffff"))},"writeBigUInt64BE")),a.prototype.writeIntLE=l(function(r,n,f,p){if(r=+r,n=n>>>0,!p){let W=Math.pow(2,8*f-1);rt(this,r,n,f,W-1,-W)}let b=0,E=1,T=0;for(this[n]=r&255;++b<f&&(E*=256);)r<0&&T===0&&this[n+b-1]!==0&&(T=1),this[n+b]=(r/E>>0)-T&255;return n+f},"writeIntLE"),a.prototype.writeIntBE=l(function(r,n,f,p){if(r=+r,n=n>>>0,!p){let W=Math.pow(2,8*f-1);rt(this,r,n,f,W-1,-W)}let b=f-1,E=1,T=0;for(this[n+b]=r&255;--b>=0&&(E*=256);)r<0&&T===0&&this[n+b+1]!==0&&(T=1),this[n+b]=(r/E>>0)-T&255;return n+f},"writeIntBE"),a.prototype.writeInt8=l(function(r,n,f){return r=+r,n=n>>>0,f||rt(this,r,n,1,127,-128),r<0&&(r=255+r+1),this[n]=r&255,n+1},"writeInt8"),a.prototype.writeInt16LE=l(function(r,n,f){return r=+r,n=n>>>0,f||rt(this,r,n,2,32767,-32768),this[n]=r&255,this[n+1]=r>>>8,n+2},"writeInt16LE"),a.prototype.writeInt16BE=l(function(r,n,f){return r=+r,n=n>>>0,f||rt(this,r,n,2,32767,-32768),this[n]=r>>>8,this[n+1]=r&255,n+2},"writeInt16BE"),a.prototype.writeInt32LE=l(function(r,n,f){return r=+r,n=n>>>0,f||rt(this,r,n,4,2147483647,-2147483648),this[n]=r&255,this[n+1]=r>>>8,this[n+2]=r>>>16,this[n+3]=r>>>24,n+4},"writeInt32LE"),a.prototype.writeInt32BE=l(function(r,n,f){return r=+r,n=n>>>0,f||rt(this,r,n,4,2147483647,-2147483648),r<0&&(r=4294967295+r+1),this[n]=r>>>24,this[n+1]=r>>>16,this[n+2]=r>>>8,this[n+3]=r&255,n+4},"writeInt32BE"),a.prototype.writeBigInt64LE=kt(l(function(r,n=0){return ki(this,r,n,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))},"writeBigInt64LE")),a.prototype.writeBigInt64BE=kt(l(function(r,n=0){return Ii(this,r,n,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))},"writeBigInt64BE"));function Bi(u,r,n,f,p,b){if(n+f>u.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}l(Bi,"checkIEEE754");function Ti(u,r,n,f,p){return r=+r,n=n>>>0,p||Bi(u,r,n,4),e.write(u,r,n,f,23,4),n+4}l(Ti,"writeFloat"),a.prototype.writeFloatLE=l(function(r,n,f){return Ti(this,r,n,!0,f)},"writeFloatLE"),a.prototype.writeFloatBE=l(function(r,n,f){return Ti(this,r,n,!1,f)},"writeFloatBE");function Oi(u,r,n,f,p){return r=+r,n=n>>>0,p||Bi(u,r,n,8),e.write(u,r,n,f,52,8),n+8}l(Oi,"writeDouble"),a.prototype.writeDoubleLE=l(function(r,n,f){return Oi(this,r,n,!0,f)},"writeDoubleLE"),a.prototype.writeDoubleBE=l(function(r,n,f){return Oi(this,r,n,!1,f)},"writeDoubleBE"),a.prototype.copy=l(function(r,n,f,p){if(!a.isBuffer(r))throw new TypeError("argument should be a Buffer");if(f||(f=0),!p&&p!==0&&(p=this.length),n>=r.length&&(n=r.length),n||(n=0),p>0&&p<f&&(p=f),p===f||r.length===0||this.length===0)return 0;if(n<0)throw new RangeError("targetStart out of bounds");if(f<0||f>=this.length)throw new RangeError("Index out of range");if(p<0)throw new RangeError("sourceEnd out of bounds");p>this.length&&(p=this.length),r.length-n<p-f&&(p=r.length-n+f);let b=p-f;return this===r&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(n,f,p):Uint8Array.prototype.set.call(r,this.subarray(f,p),n),b},"copy"),a.prototype.fill=l(function(r,n,f,p){if(typeof r=="string"){if(typeof n=="string"?(p=n,n=0,f=this.length):typeof f=="string"&&(p=f,f=this.length),p!==void 0&&typeof p!="string")throw new TypeError("encoding must be a string");if(typeof p=="string"&&!a.isEncoding(p))throw new TypeError("Unknown encoding: "+p);if(r.length===1){let E=r.charCodeAt(0);(p==="utf8"&&E<128||p==="latin1")&&(r=E)}}else typeof r=="number"?r=r&255:typeof r=="boolean"&&(r=Number(r));if(n<0||this.length<n||this.length<f)throw new RangeError("Out of range index");if(f<=n)return this;n=n>>>0,f=f===void 0?this.length:f>>>0,r||(r=0);let b;if(typeof r=="number")for(b=n;b<f;++b)this[b]=r;else{let E=a.isBuffer(r)?r:a.from(r,p),T=E.length;if(T===0)throw new TypeError('The value "'+r+'" is invalid for argument "value"');for(b=0;b<f-n;++b)this[b+n]=E[b%T]}return this},"fill");let Wt={};function Re(u,r,n){Wt[u]=l(class extends n{constructor(){super(),Object.defineProperty(this,"message",{value:r.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${u}]`,this.stack,delete this.name}get code(){return u}set code(p){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:p,writable:!0})}toString(){return`${this.name} [${u}]: ${this.message}`}},"NodeError")}l(Re,"E"),Re("ERR_BUFFER_OUT_OF_BOUNDS",function(u){return u?`${u} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),Re("ERR_INVALID_ARG_TYPE",function(u,r){return`The "${u}" argument must be of type number. Received type ${typeof r}`},TypeError),Re("ERR_OUT_OF_RANGE",function(u,r,n){let f=`The value of "${u}" is out of range.`,p=n;return Number.isInteger(n)&&Math.abs(n)>P(2,32)?p=Ni(String(n)):typeof n=="bigint"&&(p=String(n),(n>P(BigInt(2),BigInt(32))||n<-P(BigInt(2),BigInt(32)))&&(p=Ni(p)),p+="n"),f+=` It must be ${r}. Received ${p}`,f},RangeError);function Ni(u){let r="",n=u.length,f=u[0]==="-"?1:0;for(;n>=f+4;n-=3)r=`_${u.slice(n-3,n)}${r}`;return`${u.slice(0,n)}${r}`}l(Ni,"addNumericalSeparator");function Sr(u,r,n){$t(r,"offset"),(u[r]===void 0||u[r+n]===void 0)&&te(r,u.length-(n+1))}l(Sr,"checkBounds");function Pi(u,r,n,f,p,b){if(u>n||u<r){let E=typeof r=="bigint"?"n":"",T;throw b>3?r===0||r===BigInt(0)?T=`>= 0${E} and < 2${E} ** ${(b+1)*8}${E}`:T=`>= -(2${E} ** ${(b+1)*8-1}${E}) and < 2 ** ${(b+1)*8-1}${E}`:T=`>= ${r}${E} and <= ${n}${E}`,new Wt.ERR_OUT_OF_RANGE("value",T,u)}Sr(f,p,b)}l(Pi,"checkIntBI");function $t(u,r){if(typeof u!="number")throw new Wt.ERR_INVALID_ARG_TYPE(r,"number",u)}l($t,"validateNumber");function te(u,r,n){throw Math.floor(u)!==u?($t(u,n),new Wt.ERR_OUT_OF_RANGE(n||"offset","an integer",u)):r<0?new Wt.ERR_BUFFER_OUT_OF_BOUNDS:new Wt.ERR_OUT_OF_RANGE(n||"offset",`>= ${n?1:0} and <= ${r}`,u)}l(te,"boundsError");let Er=/[^+/0-9A-Za-z-_]/g;function Fr(u){if(u=u.split("=")[0],u=u.trim().replace(Er,""),u.length<2)return"";for(;u.length%4!==0;)u=u+"=";return u}l(Fr,"base64clean");function De(u,r){r=r||1/0;let n,f=u.length,p=null,b=[];for(let E=0;E<f;++E){if(n=u.charCodeAt(E),n>55295&&n<57344){if(!p){if(n>56319){(r-=3)>-1&&b.push(239,191,189);continue}else if(E+1===f){(r-=3)>-1&&b.push(239,191,189);continue}p=n;continue}if(n<56320){(r-=3)>-1&&b.push(239,191,189),p=n;continue}n=(p-55296<<10|n-56320)+65536}else p&&(r-=3)>-1&&b.push(239,191,189);if(p=null,n<128){if((r-=1)<0)break;b.push(n)}else if(n<2048){if((r-=2)<0)break;b.push(n>>6|192,n&63|128)}else if(n<65536){if((r-=3)<0)break;b.push(n>>12|224,n>>6&63|128,n&63|128)}else if(n<1114112){if((r-=4)<0)break;b.push(n>>18|240,n>>12&63|128,n>>6&63|128,n&63|128)}else throw new Error("Invalid code point")}return b}l(De,"utf8ToBytes");function xr(u){let r=[];for(let n=0;n<u.length;++n)r.push(u.charCodeAt(n)&255);return r}l(xr,"asciiToBytes");function vr(u,r){let n,f,p,b=[];for(let E=0;E<u.length&&!((r-=2)<0);++E)n=u.charCodeAt(E),f=n>>8,p=n%256,b.push(p),b.push(f);return b}l(vr,"utf16leToBytes");function Ai(u){return s.toByteArray(Fr(u))}l(Ai,"base64ToBytes");function fe(u,r,n,f){let p;for(p=0;p<f&&!(p+n>=r.length||p>=u.length);++p)r[p+n]=u[p];return p}l(fe,"blitBuffer");function bt(u,r){return u instanceof r||u!=null&&u.constructor!=null&&u.constructor.name!=null&&u.constructor.name===r.name}l(bt,"isInstance");function Le(u){return u!==u}l(Le,"numberIsNaN");let Cr=function(){let u="0123456789abcdef",r=new Array(256);for(let n=0;n<16;++n){let f=n*16;for(let p=0;p<16;++p)r[f+p]=u[n]+u[p]}return r}();function kt(u){return typeof BigInt=="undefined"?_r:u}l(kt,"defineBigIntMethod");function _r(){throw new Error("BigInt not supported")}return l(_r,"BufferBigIntNotDefined"),Dt}l(Ur,"dew");var Lt=Ur();Lt.Buffer;Lt.SlowBuffer;Lt.INSPECT_MAX_BYTES;Lt.kMaxLength;var k=Lt.Buffer,io=Lt.INSPECT_MAX_BYTES,ro=Lt.kMaxLength;var Si={};he(Si,{_toUnixTimestamp:()=>Xi,access:()=>ms,accessSync:()=>qs,appendFile:()=>Kn,appendFileSync:()=>Cs,chmod:()=>ls,chmodSync:()=>Ks,chown:()=>as,chownSync:()=>Ws,close:()=>Yn,closeSync:()=>ks,constants:()=>jt,createReadStream:()=>bs,createWriteStream:()=>ws,exists:()=>Dn,existsSync:()=>Hi,fchmod:()=>Qn,fchmodSync:()=>As,fchown:()=>Zn,fchownSync:()=>Ps,fdatasync:()=>Jn,fdatasyncSync:()=>Ts,fstat:()=>jn,fstatSync:()=>_s,fsync:()=>qn,fsyncSync:()=>Bs,ftruncate:()=>Xn,ftruncateSync:()=>Is,futimes:()=>ts,futimesSync:()=>Rs,getMount:()=>Yt,getMounts:()=>Ji,initialize:()=>Gi,lchmod:()=>us,lchmodSync:()=>js,lchown:()=>cs,lchownSync:()=>$s,link:()=>ns,linkSync:()=>Ms,lstat:()=>Un,lstatSync:()=>Fs,lutimes:()=>fs,lutimesSync:()=>Xs,mkdir:()=>is,mkdirSync:()=>Ls,mount:()=>xe,open:()=>Vn,openSync:()=>vs,promises:()=>oe,read:()=>Hn,readFile:()=>Wn,readFileSync:()=>Qi,readSync:()=>Ns,readdir:()=>rs,readdirSync:()=>Us,readlink:()=>os,readlinkSync:()=>Vs,realpath:()=>hs,realpathSync:()=>wi,rename:()=>Rn,renameSync:()=>Ss,rmdir:()=>es,rmdirSync:()=>Ds,stat:()=>Ln,statSync:()=>Es,symlink:()=>ss,symlinkSync:()=>zs,truncate:()=>Mn,truncateSync:()=>xs,umount:()=>Ke,unlink:()=>zn,unlinkSync:()=>Zi,unwatchFile:()=>gs,utimes:()=>ds,utimesSync:()=>Ys,watch:()=>ys,watchFile:()=>ps,write:()=>Gn,writeFile:()=>$n,writeFileSync:()=>tr,writeSync:()=>Os});var et=(F=>(F[F.EPERM=1]="EPERM",F[F.ENOENT=2]="ENOENT",F[F.EIO=5]="EIO",F[F.EBADF=9]="EBADF",F[F.EACCES=13]="EACCES",F[F.EBUSY=16]="EBUSY",F[F.EEXIST=17]="EEXIST",F[F.ENOTDIR=20]="ENOTDIR",F[F.EISDIR=21]="EISDIR",F[F.EINVAL=22]="EINVAL",F[F.EFBIG=27]="EFBIG",F[F.ENOSPC=28]="ENOSPC",F[F.EROFS=30]="EROFS",F[F.ENOTEMPTY=39]="ENOTEMPTY",F[F.ENOTSUP=95]="ENOTSUP",F))(et||{}),Z={};Z[1]="Operation not permitted.";Z[2]="No such file or directory.";Z[5]="Input/output error.";Z[9]="Bad file descriptor.";Z[13]="Permission denied.";Z[16]="Resource busy or locked.";Z[17]="File exists.";Z[20]="File is not a directory.";Z[21]="File is a directory.";Z[22]="Invalid argument.";Z[27]="File is too big.";Z[28]="No space left on disk.";Z[30]="Cannot modify a read-only file system.";Z[39]="Directory is not empty.";Z[95]="Operation is not supported.";var h=class extends Error{constructor(t,i=Z[t],o){super(i);this.syscall="";this.errno=t,this.code=et[t],this.path=o,this.message=`Error: ${this.code}: ${i}${this.path?`, '${this.path}'`:""}`}static fromJSON(t){let i=new h(t.errno,t.message,t.path);return i.code=t.code,i.stack=t.stack,i}static fromBuffer(t,i=0){return h.fromJSON(JSON.parse(t.toString("utf8",i+4,i+4+t.readUInt32LE(i))))}static FileError(t,i){return new h(t,Z[t],i)}static EACCES(t){return this.FileError(13,t)}static ENOENT(t){return this.FileError(2,t)}static EEXIST(t){return this.FileError(17,t)}static EISDIR(t){return this.FileError(21,t)}static ENOTDIR(t){return this.FileError(20,t)}static EPERM(t){return this.FileError(1,t)}static ENOTEMPTY(t){return this.FileError(39,t)}toString(){return this.message}toJSON(){return{errno:this.errno,code:this.code,path:this.path,stack:this.stack,message:this.message}}writeToBuffer(t=k.alloc(this.bufferSize()),i=0){let o=t.write(JSON.stringify(this.toJSON()),i+4);return t.writeUInt32LE(o,i),t}bufferSize(){return 4+k.byteLength(JSON.stringify(this.toJSON()))}};l(h,"ApiError");var Ue={},Wi=!1,Kt=typeof globalThis!="undefined"?globalThis:typeof self!="undefined"?self:global;function Mr(){if(Wi)return Ue;Wi=!0;var s=Ue={},e,t;function i(){throw new Error("setTimeout has not been defined")}l(i,"defaultSetTimout");function o(){throw new Error("clearTimeout has not been defined")}l(o,"defaultClearTimeout"),function(){try{typeof setTimeout=="function"?e=setTimeout:e=i}catch(F){e=i}try{typeof clearTimeout=="function"?t=clearTimeout:t=o}catch(F){t=o}}();function c(F){if(e===setTimeout)return setTimeout(F,0);if((e===i||!e)&&setTimeout)return e=setTimeout,setTimeout(F,0);try{return e(F,0)}catch(_){try{return e.call(null,F,0)}catch(N){return e.call(this||Kt,F,0)}}}l(c,"runTimeout");function a(F){if(t===clearTimeout)return clearTimeout(F);if((t===o||!t)&&clearTimeout)return t=clearTimeout,clearTimeout(F);try{return t(F)}catch(_){try{return t.call(null,F)}catch(N){return t.call(this||Kt,F)}}}l(a,"runClearTimeout");var d=[],m=!1,y,S=-1;function w(){!m||!y||(m=!1,y.length?d=y.concat(d):S=-1,d.length&&v())}l(w,"cleanUpNextTick");function v(){if(!m){var F=c(w);m=!0;for(var _=d.length;_;){for(y=d,d=[];++S<_;)y&&y[S].run();S=-1,_=d.length}y=null,m=!1,a(F)}}l(v,"drainQueue"),s.nextTick=function(F){var _=new Array(arguments.length-1);if(arguments.length>1)for(var N=1;N<arguments.length;N++)_[N-1]=arguments[N];d.push(new x(F,_)),d.length===1&&!m&&c(v)};function x(F,_){(this||Kt).fun=F,(this||Kt).array=_}l(x,"Item"),x.prototype.run=function(){(this||Kt).fun.apply(null,(this||Kt).array)},s.title="browser",s.browser=!0,s.env={},s.argv=[],s.version="",s.versions={};function C(){}return l(C,"noop"),s.on=C,s.addListener=C,s.once=C,s.off=C,s.removeListener=C,s.removeAllListeners=C,s.emit=C,s.prependListener=C,s.prependOnceListener=C,s.listeners=function(F){return[]},s.binding=function(F){throw new Error("process.binding is not supported")},s.cwd=function(){return"/"},s.chdir=function(F){throw new Error("process.chdir is not supported")},s.umask=function(){return 0},Ue}l(Mr,"dew");var z=Mr();z.platform="browser";z.addListener;z.argv;z.binding;z.browser;z.chdir;z.cwd;z.emit;z.env;z.listeners;z.nextTick;z.off;z.on;z.once;z.prependListener;z.prependOnceListener;z.removeAllListeners;z.removeListener;z.title;z.umask;z.version;z.versions;var Me={},$i=!1;function zr(){if($i)return Me;$i=!0;var s=z;function e(c){if(typeof c!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(c))}l(e,"assertPath");function t(c,a){for(var d="",m=0,y=-1,S=0,w,v=0;v<=c.length;++v){if(v<c.length)w=c.charCodeAt(v);else{if(w===47)break;w=47}if(w===47){if(!(y===v-1||S===1))if(y!==v-1&&S===2){if(d.length<2||m!==2||d.charCodeAt(d.length-1)!==46||d.charCodeAt(d.length-2)!==46){if(d.length>2){var x=d.lastIndexOf("/");if(x!==d.length-1){x===-1?(d="",m=0):(d=d.slice(0,x),m=d.length-1-d.lastIndexOf("/")),y=v,S=0;continue}}else if(d.length===2||d.length===1){d="",m=0,y=v,S=0;continue}}a&&(d.length>0?d+="/..":d="..",m=2)}else d.length>0?d+="/"+c.slice(y+1,v):d=c.slice(y+1,v),m=v-y-1;y=v,S=0}else w===46&&S!==-1?++S:S=-1}return d}l(t,"normalizeStringPosix");function i(c,a){var d=a.dir||a.root,m=a.base||(a.name||"")+(a.ext||"");return d?d===a.root?d+m:d+c+m:m}l(i,"_format");var o={resolve:l(function(){for(var a="",d=!1,m,y=arguments.length-1;y>=-1&&!d;y--){var S;y>=0?S=arguments[y]:(m===void 0&&(m=s.cwd()),S=m),e(S),S.length!==0&&(a=S+"/"+a,d=S.charCodeAt(0)===47)}return a=t(a,!d),d?a.length>0?"/"+a:"/":a.length>0?a:"."},"resolve"),normalize:l(function(a){if(e(a),a.length===0)return".";var d=a.charCodeAt(0)===47,m=a.charCodeAt(a.length-1)===47;return a=t(a,!d),a.length===0&&!d&&(a="."),a.length>0&&m&&(a+="/"),d?"/"+a:a},"normalize"),isAbsolute:l(function(a){return e(a),a.length>0&&a.charCodeAt(0)===47},"isAbsolute"),join:l(function(){if(arguments.length===0)return".";for(var a,d=0;d<arguments.length;++d){var m=arguments[d];e(m),m.length>0&&(a===void 0?a=m:a+="/"+m)}return a===void 0?".":o.normalize(a)},"join"),relative:l(function(a,d){if(e(a),e(d),a===d||(a=o.resolve(a),d=o.resolve(d),a===d))return"";for(var m=1;m<a.length&&a.charCodeAt(m)===47;++m);for(var y=a.length,S=y-m,w=1;w<d.length&&d.charCodeAt(w)===47;++w);for(var v=d.length,x=v-w,C=S<x?S:x,F=-1,_=0;_<=C;++_){if(_===C){if(x>C){if(d.charCodeAt(w+_)===47)return d.slice(w+_+1);if(_===0)return d.slice(w+_)}else S>C&&(a.charCodeAt(m+_)===47?F=_:_===0&&(F=0));break}var N=a.charCodeAt(m+_),D=d.charCodeAt(w+_);if(N!==D)break;N===47&&(F=_)}var V="";for(_=m+F+1;_<=y;++_)(_===y||a.charCodeAt(_)===47)&&(V.length===0?V+="..":V+="/..");return V.length>0?V+d.slice(w+F):(w+=F,d.charCodeAt(w)===47&&++w,d.slice(w))},"relative"),_makeLong:l(function(a){return a},"_makeLong"),dirname:l(function(a){if(e(a),a.length===0)return".";for(var d=a.charCodeAt(0),m=d===47,y=-1,S=!0,w=a.length-1;w>=1;--w)if(d=a.charCodeAt(w),d===47){if(!S){y=w;break}}else S=!1;return y===-1?m?"/":".":m&&y===1?"//":a.slice(0,y)},"dirname"),basename:l(function(a,d){if(d!==void 0&&typeof d!="string")throw new TypeError('"ext" argument must be a string');e(a);var m=0,y=-1,S=!0,w;if(d!==void 0&&d.length>0&&d.length<=a.length){if(d.length===a.length&&d===a)return"";var v=d.length-1,x=-1;for(w=a.length-1;w>=0;--w){var C=a.charCodeAt(w);if(C===47){if(!S){m=w+1;break}}else x===-1&&(S=!1,x=w+1),v>=0&&(C===d.charCodeAt(v)?--v===-1&&(y=w):(v=-1,y=x))}return m===y?y=x:y===-1&&(y=a.length),a.slice(m,y)}else{for(w=a.length-1;w>=0;--w)if(a.charCodeAt(w)===47){if(!S){m=w+1;break}}else y===-1&&(S=!1,y=w+1);return y===-1?"":a.slice(m,y)}},"basename"),extname:l(function(a){e(a);for(var d=-1,m=0,y=-1,S=!0,w=0,v=a.length-1;v>=0;--v){var x=a.charCodeAt(v);if(x===47){if(!S){m=v+1;break}continue}y===-1&&(S=!1,y=v+1),x===46?d===-1?d=v:w!==1&&(w=1):d!==-1&&(w=-1)}return d===-1||y===-1||w===0||w===1&&d===y-1&&d===m+1?"":a.slice(d,y)},"extname"),format:l(function(a){if(a===null||typeof a!="object")throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof a);return i("/",a)},"format"),parse:l(function(a){e(a);var d={root:"",dir:"",base:"",ext:"",name:""};if(a.length===0)return d;var m=a.charCodeAt(0),y=m===47,S;y?(d.root="/",S=1):S=0;for(var w=-1,v=0,x=-1,C=!0,F=a.length-1,_=0;F>=S;--F){if(m=a.charCodeAt(F),m===47){if(!C){v=F+1;break}continue}x===-1&&(C=!1,x=F+1),m===46?w===-1?w=F:_!==1&&(_=1):w!==-1&&(_=-1)}return w===-1||x===-1||_===0||_===1&&w===x-1&&w===v+1?x!==-1&&(v===0&&y?d.base=d.name=a.slice(1,x):d.base=d.name=a.slice(v,x)):(v===0&&y?(d.name=a.slice(1,w),d.base=a.slice(1,x)):(d.name=a.slice(v,w),d.base=a.slice(v,x)),d.ext=a.slice(w,x)),v>0?d.dir=a.slice(0,v-1):y&&(d.dir="/"),d},"parse"),sep:"/",delimiter:":",win32:null,posix:null};return o.posix=o,Me=o,Me}l(zr,"dew");var Q=zr();var Oo=Q._makeLong,it=Q.basename,No=Q.delimiter,R=Q.dirname,Po=Q.extname,Ao=Q.format,Ro=Q.isAbsolute,St=Q.join,Do=Q.normalize,Lo=Q.parse,It=Q.posix,Ki=Q.relative,Et=Q.resolve,Ut=Q.sep,Uo=Q.win32;var ze=class{constructor(e,t,i,o,c,a){this.uid=e;this.gid=t;this.suid=i;this.sgid=o;this.euid=c;this.egid=a}},K=ze;l(K,"Cred"),K.Root=new ze(0,0,0,0,0,0);var jt={};he(jt,{COPYFILE_EXCL:()=>$r,COPYFILE_FICLONE:()=>Kr,COPYFILE_FICLONE_FORCE:()=>jr,F_OK:()=>Vr,O_APPEND:()=>Qr,O_CREAT:()=>Jr,O_DIRECT:()=>an,O_DIRECTORY:()=>tn,O_DSYNC:()=>sn,O_EXCL:()=>Gr,O_NOATIME:()=>en,O_NOCTTY:()=>Hr,O_NOFOLLOW:()=>rn,O_NONBLOCK:()=>cn,O_RDONLY:()=>Yr,O_RDWR:()=>qr,O_SYMLINK:()=>on,O_SYNC:()=>nn,O_TRUNC:()=>Zr,O_WRONLY:()=>Xr,R_OK:()=>xt,S_IFBLK:()=>un,S_IFCHR:()=>ln,S_IFDIR:()=>ge,S_IFIFO:()=>dn,S_IFLNK:()=>ye,S_IFMT:()=>ut,S_IFREG:()=>pe,S_IFSOCK:()=>fn,S_IRGRP:()=>bn,S_IROTH:()=>Fn,S_IRUSR:()=>mn,S_IRWXG:()=>yn,S_IRWXO:()=>En,S_IRWXU:()=>hn,S_IWGRP:()=>wn,S_IWOTH:()=>xn,S_IWUSR:()=>pn,S_IXGRP:()=>Sn,S_IXOTH:()=>vn,S_IXUSR:()=>gn,W_OK:()=>Tt,X_OK:()=>Wr});var Vr=0,xt=4,Tt=2,Wr=1,$r=1,Kr=2,jr=4,Yr=0,Xr=1,qr=2,Jr=64,Gr=128,Hr=256,Zr=512,Qr=1024,tn=65536,en=262144,rn=131072,nn=1052672,sn=4096,on=32768,an=16384,cn=2048,ut=61440,pe=32768,ge=16384,ln=8192,un=24576,dn=4096,ye=40960,fn=49152,hn=448,mn=256,pn=128,gn=64,yn=56,bn=32,wn=16,Sn=8,En=7,Fn=4,xn=2,vn=1;var j=(i=>(i[i.FILE=32768]="FILE",i[i.DIRECTORY=16384]="DIRECTORY",i[i.SYMLINK=40960]="SYMLINK",i))(j||{}),X=class{constructor(e,t,i,o,c,a,d,m,y){this.dev=0;this.ino=0;this.rdev=0;this.nlink=1;this.blksize=4096;this.uid=0;this.gid=0;this.fileData=null;this.size=t;let S=0;if(typeof o!="number"&&(S=Date.now(),o=S),typeof c!="number"&&(S||(S=Date.now()),c=S),typeof a!="number"&&(S||(S=Date.now()),a=S),typeof y!="number"&&(S||(S=Date.now()),y=S),typeof d!="number"&&(d=0),typeof m!="number"&&(m=0),this.atimeMs=o,this.ctimeMs=a,this.mtimeMs=c,this.birthtimeMs=y,i)this.mode=i;else switch(e){case j.FILE:this.mode=420;break;case j.DIRECTORY:default:this.mode=511}this.blocks=Math.ceil(t/512),this.mode&61440||(this.mode|=e)}static fromBuffer(e){let t=e.readUInt32LE(0),i=e.readUInt32LE(4),o=e.readDoubleLE(8),c=e.readDoubleLE(16),a=e.readDoubleLE(24),d=e.readUInt32LE(32),m=e.readUInt32LE(36);return new X(i&61440,t,i&-61441,o,c,a,d,m)}static clone(e){return new X(e.mode&61440,e.size,e.mode&-61441,e.atimeMs,e.mtimeMs,e.ctimeMs,e.uid,e.gid,e.birthtimeMs)}get atime(){return new Date(this.atimeMs)}get mtime(){return new Date(this.mtimeMs)}get ctime(){return new Date(this.ctimeMs)}get birthtime(){return new Date(this.birthtimeMs)}toBuffer(){let e=k.alloc(32);return e.writeUInt32LE(this.size,0),e.writeUInt32LE(this.mode,4),e.writeDoubleLE(this.atime.getTime(),8),e.writeDoubleLE(this.mtime.getTime(),16),e.writeDoubleLE(this.ctime.getTime(),24),e.writeUInt32LE(this.uid,32),e.writeUInt32LE(this.gid,36),e}isFile(){return(this.mode&61440)===32768}isDirectory(){return(this.mode&61440)===16384}isSymbolicLink(){return(this.mode&61440)===40960}hasAccess(e,t){if(t.euid===0||t.egid===0)return!0;let i=this.mode&-61441,o=15,c=15,a=15;if(t.euid==this.uid){let y=(3840&i)>>8;o=(e^y)&e}if(t.egid==this.gid){let y=(240&i)>>4;c=(e^y)&e}let d=15&i;return a=(e^d)&e,!(o&c&a)}getCred(e=this.uid,t=this.gid){return new K(e,t,this.uid,this.gid,e,t)}chmod(e){this.mode=this.mode&61440|e}chown(e,t){!isNaN(+e)&&0<=+e&&+e<P(2,32)&&(this.uid=e),!isNaN(+t)&&0<=+t&&+t<P(2,32)&&(this.gid=t)}isSocket(){return!1}isBlockDevice(){return!1}isCharacterDevice(){return!1}isFIFO(){return!1}};l(X,"Stats");var we=(o=>(o[o.NOP=0]="NOP",o[o.THROW_EXCEPTION=1]="THROW_EXCEPTION",o[o.TRUNCATE_FILE=2]="TRUNCATE_FILE",o[o.CREATE_FILE=3]="CREATE_FILE",o))(we||{}),Mt=class{static getFileFlag(e){return Mt.flagCache.has(e)||Mt.flagCache.set(e,new Mt(e)),Mt.flagCache.get(e)}constructor(e){if(this.flagStr=e,Mt.validFlagStrs.indexOf(e)<0)throw new h(22,"Invalid flag: "+e)}getFlagString(){return this.flagStr}getMode(){let e=0;return e<<=1,e+=+this.isReadable(),e<<=1,e+=+this.isWriteable(),e<<=1,e}isReadable(){return this.flagStr.indexOf("r")!==-1||this.flagStr.indexOf("+")!==-1}isWriteable(){return this.flagStr.indexOf("w")!==-1||this.flagStr.indexOf("a")!==-1||this.flagStr.indexOf("+")!==-1}isTruncating(){return this.flagStr.indexOf("w")!==-1}isAppendable(){return this.flagStr.indexOf("a")!==-1}isSynchronous(){return this.flagStr.indexOf("s")!==-1}isExclusive(){return this.flagStr.indexOf("x")!==-1}pathExistsAction(){return this.isExclusive()?1:this.isTruncating()?2:0}pathNotExistsAction(){return(this.isWriteable()||this.isAppendable())&&this.flagStr!=="r+"?3:1}},O=Mt;l(O,"FileFlag"),O.flagCache=new Map,O.validFlagStrs=["r","r+","rs","rs+","w","wx","w+","wx+","a","ax","a+","ax+"];var re=class{sync(){return g(this,null,function*(){throw new h(95)})}syncSync(){throw new h(95)}datasync(){return g(this,null,function*(){return this.sync()})}datasyncSync(){return this.syncSync()}chown(e,t){return g(this,null,function*(){throw new h(95)})}chownSync(e,t){throw new h(95)}chmod(e){return g(this,null,function*(){throw new h(95)})}chmodSync(e){throw new h(95)}utimes(e,t){return g(this,null,function*(){throw new h(95)})}utimesSync(e,t){throw new h(95)}};l(re,"BaseFile");var at=class extends re{constructor(t,i,o,c,a){super();this._pos=0;this._dirty=!1;if(this._fs=t,this._path=i,this._flag=o,this._stat=c,this._buffer=a||k.alloc(0),this._stat.size!==this._buffer.length&&this._flag.isReadable())throw new Error(`Invalid buffer: Buffer is ${this._buffer.length} long, yet Stats object specifies that file is ${this._stat.size} long.`)}getBuffer(){return this._buffer}getStats(){return this._stat}getFlag(){return this._flag}getPath(){return this._path}getPos(){return this._flag.isAppendable()?this._stat.size:this._pos}advancePos(t){return this._pos+=t}setPos(t){return this._pos=t}sync(){return g(this,null,function*(){this.syncSync()})}syncSync(){throw new h(95)}close(){return g(this,null,function*(){this.closeSync()})}closeSync(){throw new h(95)}stat(){return g(this,null,function*(){return X.clone(this._stat)})}statSync(){return X.clone(this._stat)}truncate(t){if(this.truncateSync(t),this._flag.isSynchronous()&&!Yt("/").metadata.synchronous)return this.sync()}truncateSync(t){if(this._dirty=!0,!this._flag.isWriteable())throw new h(1,"File not opened with a writeable mode.");if(this._stat.mtimeMs=Date.now(),t>this._buffer.length){let o=k.alloc(t-this._buffer.length,0);this.writeSync(o,0,o.length,this._buffer.length),this._flag.isSynchronous()&&Yt("/").metadata.synchronous&&this.syncSync();return}this._stat.size=t;let i=k.alloc(t);this._buffer.copy(i,0,0,t),this._buffer=i,this._flag.isSynchronous()&&Yt("/").metadata.synchronous&&this.syncSync()}write(t,i,o,c){return g(this,null,function*(){return this.writeSync(t,i,o,c)})}writeSync(t,i,o,c){if(this._dirty=!0,c==null&&(c=this.getPos()),!this._flag.isWriteable())throw new h(1,"File not opened with a writeable mode.");let a=c+o;if(a>this._stat.size&&(this._stat.size=a,a>this._buffer.length)){let m=k.alloc(a);this._buffer.copy(m),this._buffer=m}let d=t.copy(this._buffer,c,i,i+o);return this._stat.mtimeMs=Date.now(),this._flag.isSynchronous()?(this.syncSync(),d):(this.setPos(c+d),d)}read(t,i,o,c){return g(this,null,function*(){return{bytesRead:this.readSync(t,i,o,c),buffer:t}})}readSync(t,i,o,c){if(!this._flag.isReadable())throw new h(1,"File not opened with a readable mode.");c==null&&(c=this.getPos()),c+o>this._stat.size&&(o=this._stat.size-c);let d=this._buffer.copy(t,i,c,c+o);return this._stat.atimeMs=Date.now(),this._pos=c+o,d}chmod(t){return g(this,null,function*(){this.chmodSync(t)})}chmodSync(t){if(!this._fs.metadata.supportsProperties)throw new h(95);this._dirty=!0,this._stat.chmod(t),this.syncSync()}chown(t,i){return g(this,null,function*(){this.chownSync(t,i)})}chownSync(t,i){if(!this._fs.metadata.supportsProperties)throw new h(95);this._dirty=!0,this._stat.chown(t,i),this.syncSync()}isDirty(){return this._dirty}resetDirty(){this._dirty=!1}};l(at,"PreloadFile");var be=class extends at{constructor(e,t,i,o,c){super(e,t,i,o,c)}sync(){return g(this,null,function*(){})}syncSync(){}close(){return g(this,null,function*(){})}closeSync(){}};l(be,"NoSyncFile");var Ot=class{constructor(e){}};l(Ot,"FileSystem");var Ve=class extends Ot{constructor(t){super();this._ready=Promise.resolve(this)}get metadata(){return{name:this.constructor.name,readonly:!1,synchronous:!1,supportsProperties:!1,supportsLinks:!1,totalSpace:0,freeSpace:0}}whenReady(){return this._ready}openFile(t,i,o){return g(this,null,function*(){throw new h(95)})}createFile(t,i,o,c){return g(this,null,function*(){throw new h(95)})}open(t,i,o,c){return g(this,null,function*(){try{let a=yield this.stat(t,c);switch(i.pathExistsAction()){case 1:throw h.EEXIST(t);case 2:let d=yield this.openFile(t,i,c);if(!d)throw new Error("BFS has reached an impossible code path; please file a bug.");return yield d.truncate(0),yield d.sync(),d;case 0:return this.openFile(t,i,c);default:throw new h(22,"Invalid FileFlag object.")}}catch(a){switch(i.pathNotExistsAction()){case 3:let d=yield this.stat(R(t),c);if(d&&!d.isDirectory())throw h.ENOTDIR(R(t));return this.createFile(t,i,o,c);case 1:throw h.ENOENT(t);default:throw new h(22,"Invalid FileFlag object.")}}})}access(t,i,o){return g(this,null,function*(){throw new h(95)})}accessSync(t,i,o){throw new h(95)}rename(t,i,o){return g(this,null,function*(){throw new h(95)})}renameSync(t,i,o){throw new h(95)}stat(t,i){return g(this,null,function*(){throw new h(95)})}statSync(t,i){throw new h(95)}openFileSync(t,i,o){throw new h(95)}createFileSync(t,i,o,c){throw new h(95)}openSync(t,i,o,c){let a;try{a=this.statSync(t,c)}catch(d){switch(i.pathNotExistsAction()){case 3:if(!this.statSync(R(t),c).isDirectory())throw h.ENOTDIR(R(t));return this.createFileSync(t,i,o,c);case 1:throw h.ENOENT(t);default:throw new h(22,"Invalid FileFlag object.")}}if(!a.hasAccess(o,c))throw h.EACCES(t);switch(i.pathExistsAction()){case 1:throw h.EEXIST(t);case 2:return this.unlinkSync(t,c),this.createFileSync(t,i,a.mode,c);case 0:return this.openFileSync(t,i,c);default:throw new h(22,"Invalid FileFlag object.")}}unlink(t,i){return g(this,null,function*(){throw new h(95)})}unlinkSync(t,i){throw new h(95)}rmdir(t,i){return g(this,null,function*(){throw new h(95)})}rmdirSync(t,i){throw new h(95)}mkdir(t,i,o){return g(this,null,function*(){throw new h(95)})}mkdirSync(t,i,o){throw new h(95)}readdir(t,i){return g(this,null,function*(){throw new h(95)})}readdirSync(t,i){throw new h(95)}exists(t,i){return g(this,null,function*(){try{return yield this.stat(t,i),!0}catch(o){return!1}})}existsSync(t,i){try{return this.statSync(t,i),!0}catch(o){return!1}}realpath(t,i){return g(this,null,function*(){if(this.metadata.supportsLinks){let o=t.split(Ut);for(let c=0;c<o.length;c++){let a=o.slice(0,c+1);o[c]=St(...a)}return o.join(Ut)}else{if(!(yield this.exists(t,i)))throw h.ENOENT(t);return t}})}realpathSync(t,i){if(this.metadata.supportsLinks){let o=t.split(Ut);for(let c=0;c<o.length;c++){let a=o.slice(0,c+1);o[c]=St(...a)}return o.join(Ut)}else{if(this.existsSync(t,i))return t;throw h.ENOENT(t)}}truncate(t,i,o){return g(this,null,function*(){let c=yield this.open(t,O.getFileFlag("r+"),420,o);try{yield c.truncate(i)}finally{yield c.close()}})}truncateSync(t,i,o){let c=this.openSync(t,O.getFileFlag("r+"),420,o);try{c.truncateSync(i)}finally{c.closeSync()}}readFile(t,i,o,c){return g(this,null,function*(){let a=yield this.open(t,o,420,c);try{let d=yield a.stat(),m=k.alloc(d.size);return yield a.read(m,0,d.size,0),yield a.close(),i===null?m:m.toString(i)}finally{yield a.close()}})}readFileSync(t,i,o,c){let a=this.openSync(t,o,420,c);try{let d=a.statSync(),m=k.alloc(d.size);return a.readSync(m,0,d.size,0),a.closeSync(),i===null?m:m.toString(i)}finally{a.closeSync()}}writeFile(t,i,o,c,a,d){return g(this,null,function*(){let m=yield this.open(t,c,a,d);try{typeof i=="string"&&(i=k.from(i,o)),yield m.write(i,0,i.length,0)}finally{yield m.close()}})}writeFileSync(t,i,o,c,a,d){let m=this.openSync(t,c,a,d);try{typeof i=="string"&&(i=k.from(i,o)),m.writeSync(i,0,i.length,0)}finally{m.closeSync()}}appendFile(t,i,o,c,a,d){return g(this,null,function*(){let m=yield this.open(t,c,a,d);try{typeof i=="string"&&(i=k.from(i,o)),yield m.write(i,0,i.length,null)}finally{yield m.close()}})}appendFileSync(t,i,o,c,a,d){let m=this.openSync(t,c,a,d);try{typeof i=="string"&&(i=k.from(i,o)),m.writeSync(i,0,i.length,null)}finally{m.closeSync()}}chmod(t,i,o){return g(this,null,function*(){throw new h(95)})}chmodSync(t,i,o){throw new h(95)}chown(t,i,o,c){return g(this,null,function*(){throw new h(95)})}chownSync(t,i,o,c){throw new h(95)}utimes(t,i,o,c){return g(this,null,function*(){throw new h(95)})}utimesSync(t,i,o,c){throw new h(95)}link(t,i,o){return g(this,null,function*(){throw new h(95)})}linkSync(t,i,o){throw new h(95)}symlink(t,i,o,c){return g(this,null,function*(){throw new h(95)})}symlinkSync(t,i,o,c){throw new h(95)}readlink(t,i){return g(this,null,function*(){throw new h(95)})}readlinkSync(t,i){throw new h(95)}},dt=Ve;l(dt,"BaseFileSystem"),dt.Name=Ve.name;var Nt=class extends dt{get metadata(){return wt(pt({},super.metadata),{synchronous:!0})}access(e,t,i){return g(this,null,function*(){return this.accessSync(e,t,i)})}rename(e,t,i){return g(this,null,function*(){return this.renameSync(e,t,i)})}stat(e,t){return g(this,null,function*(){return this.statSync(e,t)})}open(e,t,i,o){return g(this,null,function*(){return this.openSync(e,t,i,o)})}unlink(e,t){return g(this,null,function*(){return this.unlinkSync(e,t)})}rmdir(e,t){return g(this,null,function*(){return this.rmdirSync(e,t)})}mkdir(e,t,i){return g(this,null,function*(){return this.mkdirSync(e,t,i)})}readdir(e,t){return g(this,null,function*(){return this.readdirSync(e,t)})}chmod(e,t,i){return g(this,null,function*(){return this.chmodSync(e,t,i)})}chown(e,t,i,o){return g(this,null,function*(){return this.chownSync(e,t,i,o)})}utimes(e,t,i,o){return g(this,null,function*(){return this.utimesSync(e,t,i,o)})}link(e,t,i){return g(this,null,function*(){return this.linkSync(e,t,i)})}symlink(e,t,i,o){return g(this,null,function*(){return this.symlinkSync(e,t,i,o)})}readlink(e,t){return g(this,null,function*(){return this.readlinkSync(e,t)})}};l(Nt,"SynchronousFileSystem");var nt=class{constructor(e,t,i,o,c,a,d,m){this.id=e;this.size=t;this.mode=i;this.atime=o;this.mtime=c;this.ctime=a;this.uid=d;this.gid=m}static fromBuffer(e){if(e===void 0)throw new Error("NO");return new nt(e.toString("ascii",38),e.readUInt32LE(0),e.readUInt16LE(4),e.readDoubleLE(6),e.readDoubleLE(14),e.readDoubleLE(22),e.readUInt32LE(30),e.readUInt32LE(34))}toStats(){return new X((this.mode&61440)===j.DIRECTORY?j.DIRECTORY:j.FILE,this.size,this.mode,this.atime,this.mtime,this.ctime,this.uid,this.gid)}getSize(){return 38+this.id.length}toBuffer(e=k.alloc(this.getSize())){return e.writeUInt32LE(this.size,0),e.writeUInt16LE(this.mode,4),e.writeDoubleLE(this.atime,6),e.writeDoubleLE(this.mtime,14),e.writeDoubleLE(this.ctime,22),e.writeUInt32LE(this.uid,30),e.writeUInt32LE(this.gid,34),e.write(this.id,38,this.id.length,"ascii"),e}update(e){let t=!1;this.size!==e.size&&(this.size=e.size,t=!0),this.mode!==e.mode&&(this.mode=e.mode,t=!0);let i=e.atime.getTime();this.atime!==i&&(this.atime=i,t=!0);let o=e.mtime.getTime();this.mtime!==o&&(this.mtime=o,t=!0);let c=e.ctime.getTime();return this.ctime!==c&&(this.ctime=c,t=!0),this.uid!==e.uid&&(this.uid=e.uid,t=!0),this.uid!==e.uid&&(this.uid=e.uid,t=!0),t}isFile(){return(this.mode&61440)===j.FILE}isDirectory(){return(this.mode&61440)===j.DIRECTORY}};l(nt,"Inode");function ji(s,e,t,i){i.existsSync(s,t)||(ji(R(s),e,t,i),i.mkdirSync(s,e,t))}l(ji,"mkdirpSync");function Se(s,e,t,i,o){return Math.min(s+1,e+1,t+1,i===o?e:e+1)}l(Se,"_min");function Cn(s,e){if(s===e)return 0;s.length>e.length&&([s,e]=[e,s]);let t=s.length,i=e.length;for(;t>0&&s.charCodeAt(t-1)===e.charCodeAt(i-1);)t--,i--;let o=0;for(;o<t&&s.charCodeAt(o)===e.charCodeAt(o);)o++;if(t-=o,i-=o,t===0||i===1)return i;let c=new Array(t<<1);for(let v=0;v<t;)c[t+v]=s.charCodeAt(o+v),c[v]=++v;let a,d,m,y,S;for(a=0;a+3<i;){let v=e.charCodeAt(o+(d=a)),x=e.charCodeAt(o+(m=a+1)),C=e.charCodeAt(o+(y=a+2)),F=e.charCodeAt(o+(S=a+3)),_=a+=4;for(let N=0;N<t;){let D=c[t+N],V=c[N];d=Se(V,d,m,v,D),m=Se(d,m,y,x,D),y=Se(m,y,S,C,D),_=Se(y,S,_,F,D),c[N++]=_,S=y,y=m,m=d,d=V}}let w=0;for(;a<i;){let v=e.charCodeAt(o+(d=a));w=++a;for(let x=0;x<t;x++){let C=c[x];c[x]=w=C<d||w<d?C>w?w+1:C+1:v===c[t+x]?d:d+1,d=C}}return w}l(Cn,"levenshtein");function We(s,e){return g(this,null,function*(){let t=s.Options,i=s.Name,o=0,c=!1,a=!1;for(let d in t)if(Object.prototype.hasOwnProperty.call(t,d)){let m=t[d],y=e&&e[d];if(y==null){if(!m.optional){let S=Object.keys(e).filter(w=>!(w in t)).map(w=>({str:w,distance:Cn(d,w)})).filter(w=>w.distance<5).sort((w,v)=>w.distance-v.distance);if(c)return;throw c=!0,new h(22,`[${i}] Required option '${d}' not provided.${S.length>0?` You provided unrecognized option '${S[0].str}'; perhaps you meant to type '${d}'.`:""}
|
|
2
2
|
Option description: ${m.description}`)}}else{let S=!1;if(Array.isArray(m.type)?S=m.type.indexOf(typeof y)!==-1:S=typeof y===m.type,S){if(m.validator){o++;try{yield m.validator(y)}catch(w){if(!c){if(w)throw c=!0,w;if(o--,o===0&&a)return}}}}else{if(c)return;throw c=!0,new h(22,`[${i}] Value provided for option ${d} is not the proper type. Expected ${Array.isArray(m.type)?`one of {${m.type.join(", ")}}`:m.type}, but received ${typeof y}
|
|
3
|
-
Option description: ${m.description}`)}}}a=!0})}l(We,"checkOptions");function In(s){return new Promise(e=>{setTimeout(e,s)})}l(In,"wait");function Bn(s){return function(...e){return new Promise((t,i)=>{e.push((o,...c)=>{o?i(o):t(c[0])}),s(...e)})}}l(Bn,"toPromise");var Tn=typeof globalThis.setImmediate=="function"?globalThis.setImmediate:s=>setTimeout(s,0),ft="/";function ne(){return k.from("{}")}l(ne,"getEmptyDirNode");function zt(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(s){let e=Math.random()*16|0;return(s==="x"?e:e&3|8).toString(16)})}l(zt,"randomUUID");var Xt=class{constructor(e){this.store=e;this.originalData={};this.modifiedKeys=[]}get(e){let t=this.store.get(e);return this.stashOldValue(e,t),t}put(e,t,i){return this.markModified(e),this.store.put(e,t,i)}del(e){this.markModified(e),this.store.del(e)}commit(){}abort(){for(let e of this.modifiedKeys){let t=this.originalData[e];t?this.store.put(e,t,!0):this.store.del(e)}}_has(e){return Object.prototype.hasOwnProperty.call(this.originalData,e)}stashOldValue(e,t){this._has(e)||(this.originalData[e]=t)}markModified(e){this.modifiedKeys.indexOf(e)===-1&&(this.modifiedKeys.push(e),this._has(e)||(this.originalData[e]=this.store.get(e)))}};l(Xt,"SimpleSyncRWTransaction");var qt=class extends at{constructor(e,t,i,o,c){super(e,t,i,o,c)}syncSync(){this.isDirty()&&(this._fs._syncSync(this.getPath(),this.getBuffer(),this.getStats()),this.resetDirty())}closeSync(){this.syncSync()}};l(qt,"SyncKeyValueFile");var Jt=class extends Nt{constructor(t){super();this.store=t.store,this.makeRootDirectory()}static isAvailable(){return!0}getName(){return this.store.name()}isReadOnly(){return!1}supportsSymlinks(){return!1}supportsProps(){return!0}supportsSynch(){return!0}empty(){this.store.clear(),this.makeRootDirectory()}accessSync(t,i,o){let c=this.store.beginTransaction("readonly");if(!this.findINode(c,t).toStats().hasAccess(i,o))throw h.EACCES(t)}renameSync(t,i,o){let c=this.store.beginTransaction("readwrite"),a=R(t),d=it(t),m=R(i),y=it(i),S=this.findINode(c,a),w=this.getDirListing(c,a,S);if(!S.toStats().hasAccess(2,o))throw h.EACCES(t);if(!w[d])throw h.ENOENT(t);let v=w[d];if(delete w[d],(m+"/").indexOf(t+"/")===0)throw new h(16,a);let x,C;if(m===a?(x=S,C=w):(x=this.findINode(c,m),C=this.getDirListing(c,m,x)),C[y]){let F=this.getINode(c,i,C[y]);if(F.isFile())try{c.del(F.id),c.del(C[y])}catch(_){throw c.abort(),_}else throw h.EPERM(i)}C[y]=v;try{c.put(S.id,k.from(JSON.stringify(w)),!0),c.put(x.id,k.from(JSON.stringify(C)),!0)}catch(F){throw c.abort(),F}c.commit()}statSync(t,i){let o=this.findINode(this.store.beginTransaction("readonly"),t).toStats();if(!o.hasAccess(4,i))throw h.EACCES(t);return o}createFileSync(t,i,o,c){let a=this.store.beginTransaction("readwrite"),d=k.alloc(0),m=this.commitNewFile(a,t,j.FILE,o,c,d);return new qt(this,t,i,m.toStats(),d)}openFileSync(t,i,o){let c=this.store.beginTransaction("readonly"),a=this.findINode(c,t),d=c.get(a.id);if(!a.toStats().hasAccess(i.getMode(),o))throw h.EACCES(t);if(d===void 0)throw h.ENOENT(t);return new qt(this,t,i,a.toStats(),d)}unlinkSync(t,i){this.removeEntry(t,!1,i)}rmdirSync(t,i){if(this.readdirSync(t,i).length>0)throw h.ENOTEMPTY(t);this.removeEntry(t,!0,i)}mkdirSync(t,i,o){let c=this.store.beginTransaction("readwrite"),a=k.from("{}");this.commitNewFile(c,t,j.DIRECTORY,i,o,a)}readdirSync(t,i){let o=this.store.beginTransaction("readonly"),c=this.findINode(o,t);if(!c.toStats().hasAccess(4,i))throw h.EACCES(t);return Object.keys(this.getDirListing(o,t,c))}chmodSync(t,i,o){this.openFileSync(t,O.getFileFlag("r+"),o).chmodSync(i)}chownSync(t,i,o,c){this.openFileSync(t,O.getFileFlag("r+"),c).chownSync(i,o)}_syncSync(t,i,o){let c=this.store.beginTransaction("readwrite"),a=this._findINode(c,R(t),it(t)),d=this.getINode(c,t,a),m=d.update(o);try{c.put(d.id,i,!0),m&&c.put(a,d.toBuffer(),!0)}catch(y){throw c.abort(),y}c.commit()}makeRootDirectory(){let t=this.store.beginTransaction("readwrite");if(t.get(ft)===void 0){let i=new Date().getTime(),o=new nt(zt(),4096,511|j.DIRECTORY,i,i,i,0,0);t.put(o.id,ne(),!1),t.put(ft,o.toBuffer(),!1),t.commit()}}_findINode(t,i,o,c=new Set){let a=It.join(i,o);if(c.has(a))throw new h(5,"Infinite loop detected while finding inode",a);c.add(a);let d=l(m=>{let y=this.getDirListing(t,i,m);if(y[o])return y[o];throw h.ENOENT(Et(i,o))},"readDirectory");return i==="/"?o===""?ft:d(this.getINode(t,i,ft)):d(this.getINode(t,i+Ut+o,this._findINode(t,R(i),it(i),c)))}findINode(t,i){return this.getINode(t,i,this._findINode(t,R(i),it(i)))}getINode(t,i,o){let c=t.get(o);if(c===void 0)throw h.ENOENT(i);return nt.fromBuffer(c)}getDirListing(t,i,o){if(!o.isDirectory())throw h.ENOTDIR(i);let c=t.get(o.id);if(c===void 0)throw h.ENOENT(i);return JSON.parse(c.toString())}addNewNode(t,i){let c;for(;0<5;)try{return c=zt(),t.put(c,i,!1),c}catch(a){}throw new h(5,"Unable to commit data to key-value store.")}commitNewFile(t,i,o,c,a,d){let m=R(i),y=it(i),S=this.findINode(t,m),w=this.getDirListing(t,m,S),v=new Date().getTime();if(!S.toStats().hasAccess(4,a))throw h.EACCES(i);if(i==="/")throw h.EEXIST(i);if(w[y])throw h.EEXIST(i);let x;try{let C=this.addNewNode(t,d);x=new nt(C,d.length,c|o,v,v,v,a.uid,a.gid);let F=this.addNewNode(t,x.toBuffer());w[y]=F,t.put(S.id,k.from(JSON.stringify(w)),!0)}catch(C){throw t.abort(),C}return t.commit(),x}removeEntry(t,i,o){let c=this.store.beginTransaction("readwrite"),a=R(t),d=this.findINode(c,a),m=this.getDirListing(c,a,d),y=it(t);if(!m[y])throw h.ENOENT(t);let S=m[y],w=this.getINode(c,t,S);if(!w.toStats().hasAccess(2,o))throw h.EACCES(t);if(delete m[y],!i&&w.isDirectory())throw h.EISDIR(t);if(i&&!w.isDirectory())throw h.ENOTDIR(t);try{c.del(w.id),c.del(S),c.put(d.id,k.from(JSON.stringify(m)),!0)}catch(v){throw c.abort(),v}c.commit()}};l(Jt,"SyncKeyValueFileSystem");function Pt(s,e){e=typeof s=="function"?s:e,We(this,s);let t=new this(typeof s=="function"?{}:s);if(typeof e!="function")return t.whenReady();t.whenReady().then(i=>e(null,i)).catch(i=>e(i))}l(Pt,"CreateBackend");var Ee=class{constructor(){this.store=new Map}name(){return ht.Name}clear(){this.store.clear()}beginTransaction(e){return new Xt(this)}get(e){return this.store.get(e)}put(e,t,i){return!i&&this.store.has(e)?!1:(this.store.set(e,t),!0)}del(e){this.store.delete(e)}};l(Ee,"InMemoryStore");var $e=class extends Jt{constructor(){super({store:new Ee})}},ht=$e;l(ht,"InMemoryFileSystem"),ht.Name="InMemory",ht.Create=Pt.bind($e),ht.Options={};function Xi(s){if(typeof s=="number")return s;if(s instanceof Date)return s.getTime()/1e3;throw new Error("Cannot parse time: "+s)}l(Xi,"_toUnixTimestamp");function ct(s,e){switch(typeof s){case"number":return s;case"string":let t=parseInt(s,8);return isNaN(t)?e:t;default:return e}}l(ct,"normalizeMode");function st(s){if(s instanceof Date)return s;if(typeof s=="number")return new Date(s*1e3);throw new h(22,"Invalid time.")}l(st,"normalizeTime");function q(s){if(s.indexOf("\0")>=0)throw new h(22,"Path must be a string without null bytes.");if(s==="")throw new h(22,"Path must not be empty.");return s=s.replaceAll(/\/+/g,"/"),It.resolve(s)}l(q,"normalizePath");function At(s,e,t,i){switch(s===null?"null":typeof s){case"object":return{encoding:typeof s.encoding!="undefined"?s.encoding:e,flag:typeof s.flag!="undefined"?s.flag:t,mode:ct(s.mode,i)};case"string":return{encoding:s,flag:t,mode:i};case"null":case"undefined":case"function":return{encoding:e,flag:t,mode:i};default:throw new TypeError(`"options" must be a string or an object, got ${typeof s} instead.`)}}l(At,"normalizeOptions");function B(){}l(B,"nop");var I=K.Root;function qi(s){I=s}l(qi,"setCred");var Vt=new Map,On=100;function Fe(s){let e=On++;return Vt.set(e,s),e}l(Fe,"getFdForFile");function Y(s){if(!Vt.has(s))throw new h(9,"Invalid file descriptor.");return Vt.get(s)}l(Y,"fd2file");var gt=new Map;ht.Create().then(s=>xe("/",s));function Yt(s){return gt.get(s)}l(Yt,"getMount");function Ji(){return Object.fromEntries(gt.entries())}l(Ji,"getMounts");function xe(s,e){if(s[0]!=="/"&&(s="/"+s),s=It.resolve(s),gt.has(s))throw new h(22,"Mount point "+s+" is already in use.");gt.set(s,e)}l(xe,"mount");function Ke(s){if(s[0]!=="/"&&(s=`/${s}`),s=It.resolve(s),!gt.has(s))throw new h(22,"Mount point "+s+" is already unmounted.");gt.delete(s)}l(Ke,"umount");function mt(s){let e=[...gt].sort((t,i)=>t[0].length>i[0].length?-1:1);for(let[t,i]of e)if(t.length<=s.length&&s.startsWith(t))return s=s.slice(t.length>1?t.length:0),s===""&&(s="/"),{fs:i,path:s,mountPoint:t};throw new h(5,"ZenFS not initialized with a file system")}l(mt,"resolveFS");function Yi(s,e){for(let[t,i]of Object.entries(e))s=s.replaceAll(t,i);return s}l(Yi,"fixPaths");function Rt(s,e){return s.stack=Yi(s.stack,e),s.message=Yi(s.message,e),s}l(Rt,"fixError");function Gi(s){s["/"]&&Ke("/");for(let[e,t]of Object.entries(s)){if(!t.constructor.isAvailable())throw new h(22,`Can not mount "${e}" since the filesystem is unavailable.`);xe(e,t)}}l(Gi,"initialize");var oe={};he(oe,{access:()=>bi,appendFile:()=>Ge,chmod:()=>mi,chown:()=>fi,close:()=>Ze,constants:()=>jt,createReadStream:()=>Rn,createWriteStream:()=>Dn,exists:()=>ve,fchmod:()=>ni,fchown:()=>ri,fdatasync:()=>ei,fstat:()=>He,fsync:()=>ti,ftruncate:()=>Qe,futimes:()=>si,lchmod:()=>pi,lchown:()=>hi,link:()=>li,lstat:()=>Xe,lutimes:()=>yi,mkdir:()=>ai,open:()=>Je,read:()=>ii,readFile:()=>_e,readdir:()=>ci,readlink:()=>di,realpath:()=>se,rename:()=>je,rmdir:()=>oi,stat:()=>Ye,symlink:()=>ui,truncate:()=>qe,unlink:()=>Ce,unwatchFile:()=>Pn,utimes:()=>gi,watch:()=>An,watchFile:()=>Nn,write:()=>Ie,writeFile:()=>ke});function J(){return g(this,arguments,function*(...[s,e,t,...i]){t=q(t);let{fs:o,path:c}=mt(e&&(yield ve(t))?yield se(t):t);try{return o[s](c,...i)}catch(a){throw Rt(a,{[c]:t})}})}l(J,"doOp");function je(s,e){return g(this,null,function*(){s=q(s),e=q(e);let t=mt(s),i=mt(e),o={[t.path]:s,[i.path]:e};try{if(t===i)return t.fs.rename(t.path,i.path,I);let c=yield _e(s);yield ke(e,c),yield Ce(s)}catch(c){throw Rt(c,o)}})}l(je,"rename");function ve(s){return g(this,null,function*(){s=q(s);try{let{fs:e,path:t}=mt(s);return e.exists(t,I)}catch(e){if(e.errno==2)return!1;throw e}})}l(ve,"exists");function Ye(s){return g(this,null,function*(){return J("stat",!0,s,I)})}l(Ye,"stat");function Xe(s){return g(this,null,function*(){return J("stat",!1,s,I)})}l(Xe,"lstat");function qe(s,e=0){return g(this,null,function*(){if(e<0)throw new h(22);return J("truncate",!0,s,e,I)})}l(qe,"truncate");function Ce(s){return g(this,null,function*(){return J("unlink",!1,s,I)})}l(Ce,"unlink");function Je(s,e,t=420){return g(this,null,function*(){let i=yield J("open",!0,s,O.getFileFlag(e),ct(t,420),I);return Fe(i)})}l(Je,"open");function _e(t){return g(this,arguments,function*(s,e={}){let i=At(e,null,"r",null),o=O.getFileFlag(i.flag);if(!o.isReadable())throw new h(22,"Flag passed to readFile must allow for reading.");return J("readFile",!0,s,i.encoding,o,I)})}l(_e,"readFile");function ke(s,e,t){return g(this,null,function*(){let i=At(t,"utf8","w",420),o=O.getFileFlag(i.flag);if(!o.isWriteable())throw new h(22,"Flag passed to writeFile must allow for writing.");return J("writeFile",!0,s,e,i.encoding,o,i.mode,I)})}l(ke,"writeFile");function Ge(s,e,t){return g(this,null,function*(){let i=At(t,"utf8","a",420),o=O.getFileFlag(i.flag);if(!o.isAppendable())throw new h(22,"Flag passed to appendFile must allow for appending.");return J("appendFile",!0,s,e,i.encoding,o,i.mode,I)})}l(Ge,"appendFile");function He(s){return g(this,null,function*(){return Y(s).stat()})}l(He,"fstat");function Ze(s){return g(this,null,function*(){yield Y(s).close(),Vt.delete(s)})}l(Ze,"close");function Qe(s,e=0){return g(this,null,function*(){let t=Y(s);if(e<0)throw new h(22);return t.truncate(e)})}l(Qe,"ftruncate");function ti(s){return g(this,null,function*(){return Y(s).sync()})}l(ti,"fsync");function ei(s){return g(this,null,function*(){return Y(s).datasync()})}l(ei,"fdatasync");function Ie(s,e,t,i,o){return g(this,null,function*(){let c,a=0,d,m;if(typeof e=="string"){m=typeof t=="number"?t:null;let S=typeof i=="string"?i:"utf8";a=0,c=k.from(e,S),d=c.length}else c=e,a=t,d=i,m=typeof o=="number"?o:null;let y=Y(s);return m==null&&(m=y.getPos()),y.write(c,a,d,m)})}l(Ie,"write");function ii(s,e,t,i,o){return g(this,null,function*(){let c=Y(s);return isNaN(+o)&&(o=c.getPos()),c.read(e,t,i,o)})}l(ii,"read");function ri(s,e,t){return g(this,null,function*(){return Y(s).chown(e,t)})}l(ri,"fchown");function ni(s,e){return g(this,null,function*(){let t=typeof e=="string"?parseInt(e,8):e;return Y(s).chmod(t)})}l(ni,"fchmod");function si(s,e,t){return g(this,null,function*(){return Y(s).utimes(st(e),st(t))})}l(si,"futimes");function oi(s){return g(this,null,function*(){return J("rmdir",!0,s,I)})}l(oi,"rmdir");function ai(s,e){return g(this,null,function*(){return J("mkdir",!0,s,ct(e,511),I)})}l(ai,"mkdir");function ci(s){return g(this,null,function*(){s=q(s);let e=yield J("readdir",!0,s,I),t=[...gt.keys()];for(let i of t)if(i.startsWith(s)){let o=i.slice(s.length);if(o.includes("/")||o.length==0)continue;e.push(o)}return e})}l(ci,"readdir");function li(s,e){return g(this,null,function*(){return e=q(e),J("link",!1,s,e,I)})}l(li,"link");function ui(s,e,t="file"){return g(this,null,function*(){if(!["file","dir","junction"].includes(t))throw new h(22,"Invalid type: "+t);return e=q(e),J("symlink",!1,s,e,t,I)})}l(ui,"symlink");function di(s){return g(this,null,function*(){return J("readlink",!1,s,I)})}l(di,"readlink");function fi(s,e,t){return g(this,null,function*(){return J("chown",!0,s,e,t,I)})}l(fi,"chown");function hi(s,e,t){return g(this,null,function*(){return J("chown",!1,s,e,t,I)})}l(hi,"lchown");function mi(s,e){return g(this,null,function*(){let t=ct(e,-1);if(t<0)throw new h(22,"Invalid mode.");return J("chmod",!0,s,t,I)})}l(mi,"chmod");function pi(s,e){return g(this,null,function*(){let t=ct(e,-1);if(t<1)throw new h(22,"Invalid mode.");return J("chmod",!1,q(s),t,I)})}l(pi,"lchmod");function gi(s,e,t){return g(this,null,function*(){return J("utimes",!0,s,st(e),st(t),I)})}l(gi,"utimes");function yi(s,e,t){return g(this,null,function*(){return J("utimes",!1,s,st(e),st(t),I)})}l(yi,"lutimes");function se(t){return g(this,arguments,function*(s,e={}){s=q(s);let{fs:i,path:o,mountPoint:c}=mt(s);try{if(!(yield i.stat(o,I)).isSymbolicLink())return s;let d=c+q(yield i.readlink(o,I));return se(d)}catch(a){throw Rt(a,{[o]:s})}})}l(se,"realpath");function Nn(i,o){return g(this,arguments,function*(s,e,t=B){throw new h(95)})}l(Nn,"watchFile");function Pn(t){return g(this,arguments,function*(s,e=B){throw new h(95)})}l(Pn,"unwatchFile");function An(i,o){return g(this,arguments,function*(s,e,t=B){throw new h(95)})}l(An,"watch");function bi(s,e=384){return g(this,null,function*(){return J("access",!0,s,e,I)})}l(bi,"access");function Rn(s,e){return g(this,null,function*(){throw new h(95)})}l(Rn,"createReadStream");function Dn(s,e){return g(this,null,function*(){throw new h(95)})}l(Dn,"createWriteStream");function Ln(s,e,t=B){je(s,e).then(()=>t()).catch(t)}l(Ln,"rename");function Un(s,e=B){ve(s).then(e).catch(()=>e(!1))}l(Un,"exists");function Mn(s,e=B){Ye(s).then(t=>e(null,t)).catch(e)}l(Mn,"stat");function zn(s,e=B){Xe(s).then(t=>e(null,t)).catch(e)}l(zn,"lstat");function Vn(s,e=0,t=B){t=typeof e=="function"?e:t,qe(s,typeof e=="number"?e:0).then(()=>t()).catch(t)}l(Vn,"truncate");function Wn(s,e=B){Ce(s).then(()=>e()).catch(e)}l(Wn,"unlink");function $n(s,e,t,i=B){let o=ct(t,420);i=typeof t=="function"?t:i,Je(s,e,o).then(c=>i(null,c)).catch(i)}l($n,"open");function Kn(s,e={},t=B){t=typeof e=="function"?e:t,_e(s,typeof e=="function"?null:e)}l(Kn,"readFile");function jn(s,e,t={},i=B){i=typeof t=="function"?t:i,ke(s,e,typeof t=="function"?void 0:t)}l(jn,"writeFile");function Yn(s,e,t,i=B){i=typeof t=="function"?t:i,Ge(s,e,typeof t=="function"?null:t)}l(Yn,"appendFile");function Xn(s,e=B){He(s).then(t=>e(null,t)).catch(e)}l(Xn,"fstat");function qn(s,e=B){Ze(s).then(()=>e()).catch(e)}l(qn,"close");function Jn(s,e,t=B){let i=typeof e=="number"?e:0;t=typeof e=="function"?e:t,Qe(s,i)}l(Jn,"ftruncate");function Gn(s,e=B){ti(s).then(()=>e()).catch(e)}l(Gn,"fsync");function Hn(s,e=B){ei(s).then(()=>e()).catch(e)}l(Hn,"fdatasync");function Zn(s,e,t,i,o,c=B){let a,d,m,y=null,S;if(typeof e=="string"){switch(S="utf8",typeof t){case"function":c=t;break;case"number":y=t,S=typeof i=="string"?i:"utf8",c=typeof o=="function"?o:c;break;default:c=typeof i=="function"?i:typeof o=="function"?o:c,c(new h(22,"Invalid arguments."));return}a=k.from(e,S),d=0,m=a.length;let w=c;Ie(s,a,d,m,y).then(v=>w(null,v,a.toString(S))).catch(w)}else{a=e,d=t,m=i,y=typeof o=="number"?o:null;let w=typeof o=="function"?o:c;Ie(s,a,d,m,y).then(v=>w(null,v,a)).catch(w)}}l(Zn,"write");function Qn(s,e,t,i,o,c=B){ii(s,e,t,i,o).then(({bytesRead:a,buffer:d})=>c(null,a,d)).catch(c)}l(Qn,"read");function ts(s,e,t,i=B){ri(s,e,t).then(()=>i()).catch(i)}l(ts,"fchown");function es(s,e,t){ni(s,e).then(()=>t()).catch(t)}l(es,"fchmod");function is(s,e,t,i=B){si(s,e,t).then(()=>i()).catch(i)}l(is,"futimes");function rs(s,e=B){oi(s).then(()=>e()).catch(e)}l(rs,"rmdir");function ns(s,e,t=B){ai(s,e).then(()=>t()).catch(t)}l(ns,"mkdir");function ss(s,e=B){ci(s).then(t=>e(null,t)).catch(e)}l(ss,"readdir");function os(s,e,t=B){li(s,e).then(()=>t()).catch(t)}l(os,"link");function as(s,e,t,i=B){let o=typeof t=="string"?t:"file";i=typeof t=="function"?t:i,ui(s,e,typeof t=="function"?null:t).then(()=>i()).catch(i)}l(as,"symlink");function cs(s,e=B){di(s).then(t=>e(null,t)).catch(e)}l(cs,"readlink");function ls(s,e,t,i=B){fi(s,e,t).then(()=>i()).catch(i)}l(ls,"chown");function us(s,e,t,i=B){hi(s,e,t).then(()=>i()).catch(i)}l(us,"lchown");function ds(s,e,t=B){mi(s,e).then(()=>t()).catch(t)}l(ds,"chmod");function fs(s,e,t=B){pi(s,e).then(()=>t()).catch(t)}l(fs,"lchmod");function hs(s,e,t,i=B){gi(s,e,t).then(()=>i()).catch(i)}l(hs,"utimes");function ms(s,e,t,i=B){yi(s,e,t).then(()=>i()).catch(i)}l(ms,"lutimes");function ps(s,e,t=B){let i=typeof e=="object"?e:{};t=typeof e=="function"?e:t,se(s,typeof e=="function"?null:e).then(o=>t(null,o)).catch(t)}l(ps,"realpath");function gs(s,e,t=B){let i=typeof e=="number"?e:4;t=typeof e=="function"?e:t,bi(s,typeof e=="function"?null:e).then(()=>t()).catch(t)}l(gs,"access");function ys(s,e,t=B){throw new h(95)}l(ys,"watchFile");function bs(s,e=B){throw new h(95)}l(bs,"unwatchFile");function ws(s,e,t=B){throw new h(95)}l(ws,"watch");function Ss(s,e){throw new h(95)}l(Ss,"createReadStream");function Es(s,e){throw new h(95)}l(Es,"createWriteStream");function G(...[s,e,t,...i]){t=q(t);let{fs:o,path:c}=mt(e&&Hi(t)?wi(t):t);try{return o[s](c,...i)}catch(a){throw Rt(a,{[c]:t})}}l(G,"doOp");function Fs(s,e){s=q(s),e=q(e);let t=mt(s),i=mt(e),o={[t.path]:s,[i.path]:e};try{if(t===i)return t.fs.renameSync(t.path,i.path,I);let c=Qi(s);tr(e,c),Zi(s)}catch(c){throw Rt(c,o)}}l(Fs,"renameSync");function Hi(s){s=q(s);try{let{fs:e,path:t}=mt(s);return e.existsSync(t,I)}catch(e){if(e.errno==2)return!1;throw e}}l(Hi,"existsSync");function xs(s){return G("statSync",!0,s,I)}l(xs,"statSync");function vs(s){return G("statSync",!1,s,I)}l(vs,"lstatSync");function Cs(s,e=0){if(e<0)throw new h(22);return G("truncateSync",!0,s,e,I)}l(Cs,"truncateSync");function Zi(s){return G("unlinkSync",!1,s,I)}l(Zi,"unlinkSync");function _s(s,e,t=420){let i=G("openSync",!0,s,O.getFileFlag(e),ct(t,420),I);return Fe(i)}l(_s,"openSync");function Qi(s,e={}){let t=At(e,null,"r",null),i=O.getFileFlag(t.flag);if(!i.isReadable())throw new h(22,"Flag passed to readFile must allow for reading.");return G("readFileSync",!0,s,t.encoding,i,I)}l(Qi,"readFileSync");function tr(s,e,t){let i=At(t,"utf8","w",420),o=O.getFileFlag(i.flag);if(!o.isWriteable())throw new h(22,"Flag passed to writeFile must allow for writing.");return G("writeFileSync",!0,s,e,i.encoding,o,i.mode,I)}l(tr,"writeFileSync");function ks(s,e,t){let i=At(t,"utf8","a",420),o=O.getFileFlag(i.flag);if(!o.isAppendable())throw new h(22,"Flag passed to appendFile must allow for appending.");return G("appendFileSync",!0,s,e,i.encoding,o,i.mode,I)}l(ks,"appendFileSync");function Is(s){return Y(s).statSync()}l(Is,"fstatSync");function Bs(s){Y(s).closeSync(),Vt.delete(s)}l(Bs,"closeSync");function Ts(s,e=0){let t=Y(s);if(e<0)throw new h(22);t.truncateSync(e)}l(Ts,"ftruncateSync");function Os(s){Y(s).syncSync()}l(Os,"fsyncSync");function Ns(s){Y(s).datasyncSync()}l(Ns,"fdatasyncSync");function Ps(s,e,t,i,o){let c,a=0,d,m;if(typeof e=="string"){m=typeof t=="number"?t:null;let S=typeof i=="string"?i:"utf8";a=0,c=k.from(e,S),d=c.length}else c=e,a=t,d=i,m=typeof o=="number"?o:null;let y=Y(s);return m==null&&(m=y.getPos()),y.writeSync(c,a,d,m)}l(Ps,"writeSync");function As(s,e,t,i,o){let c=Y(s),a=t;return typeof t=="object"&&({offset:a,length:i,position:o}=t),isNaN(+o)&&(o=c.getPos()),c.readSync(e,a,i,o)}l(As,"readSync");function Rs(s,e,t){Y(s).chownSync(e,t)}l(Rs,"fchownSync");function Ds(s,e){let t=typeof e=="string"?parseInt(e,8):e;Y(s).chmodSync(t)}l(Ds,"fchmodSync");function Ls(s,e,t){Y(s).utimesSync(st(e),st(t))}l(Ls,"futimesSync");function Us(s){return G("rmdirSync",!0,s,I)}l(Us,"rmdirSync");function Ms(s,e){G("mkdirSync",!0,s,ct(e,511),I)}l(Ms,"mkdirSync");function zs(s){s=q(s);let e=G("readdirSync",!0,s,I),t=[...gt.keys()];for(let i of t)if(i.startsWith(s)){let o=i.slice(s.length);if(o.includes("/")||o.length==0)continue;e.push(o)}return e}l(zs,"readdirSync");function Vs(s,e){return e=q(e),G("linkSync",!1,s,e,I)}l(Vs,"linkSync");function Ws(s,e,t){if(!["file","dir","junction"].includes(t))throw new h(22,"Invalid type: "+t);return e=q(e),G("symlinkSync",!1,s,e,t,I)}l(Ws,"symlinkSync");function $s(s){return G("readlinkSync",!1,s,I)}l($s,"readlinkSync");function Ks(s,e,t){G("chownSync",!0,s,e,t,I)}l(Ks,"chownSync");function js(s,e,t){G("chownSync",!1,s,e,t,I)}l(js,"lchownSync");function Ys(s,e){let t=ct(e,-1);if(t<0)throw new h(22,"Invalid mode.");G("chmodSync",!0,s,t,I)}l(Ys,"chmodSync");function Xs(s,e){let t=ct(e,-1);if(t<1)throw new h(22,"Invalid mode.");G("chmodSync",!1,s,t,I)}l(Xs,"lchmodSync");function qs(s,e,t){G("utimesSync",!0,s,st(e),st(t),I)}l(qs,"utimesSync");function Js(s,e,t){G("utimesSync",!1,s,st(e),st(t),I)}l(Js,"lutimesSync");function wi(s,e={}){s=q(s);let{fs:t,path:i,mountPoint:o}=mt(s);try{if(!t.statSync(i,I).isSymbolicLink())return s;let a=q(o+t.readlinkSync(i,I));return wi(a)}catch(c){throw Rt(c,{[i]:s})}}l(wi,"realpathSync");function Gs(s,e=384){return G("accessSync",!0,s,e,I)}l(Gs,"accessSync");var Hs=Si,Be=Hs;var Te=class extends at{constructor(e,t,i,o,c){super(e,t,i,o,c)}syncSync(){this.isDirty()&&(this._fs._syncSync(this),this.resetDirty())}closeSync(){this.syncSync()}};l(Te,"MirrorFile");var ae=class extends Nt{constructor({sync:t,async:i}){super();this._queue=[];this._queueRunning=!1;this._isInitialized=!1;this._initializeCallbacks=[];this._sync=t,this._async=i,this._ready=this._initialize()}static isAvailable(){return!0}get metadata(){return wt(pt({},super.metadata),{name:ae.Name,synchronous:!0,supportsProperties:this._sync.metadata.supportsProperties&&this._async.metadata.supportsProperties})}_syncSync(t){let i=t.getStats();this._sync.writeFileSync(t.getPath(),t.getBuffer(),null,O.getFileFlag("w"),i.mode,i.getCred(0,0)),this.enqueueOp({apiMethod:"writeFile",arguments:[t.getPath(),t.getBuffer(),null,t.getFlag(),i.mode,i.getCred(0,0)]})}renameSync(t,i,o){this._sync.renameSync(t,i,o),this.enqueueOp({apiMethod:"rename",arguments:[t,i,o]})}statSync(t,i){return this._sync.statSync(t,i)}openSync(t,i,o,c){return this._sync.openSync(t,i,o,c).closeSync(),new Te(this,t,i,this._sync.statSync(t,c),this._sync.readFileSync(t,null,O.getFileFlag("r"),c))}unlinkSync(t,i){this._sync.unlinkSync(t,i),this.enqueueOp({apiMethod:"unlink",arguments:[t,i]})}rmdirSync(t,i){this._sync.rmdirSync(t,i),this.enqueueOp({apiMethod:"rmdir",arguments:[t,i]})}mkdirSync(t,i,o){this._sync.mkdirSync(t,i,o),this.enqueueOp({apiMethod:"mkdir",arguments:[t,i,o]})}readdirSync(t,i){return this._sync.readdirSync(t,i)}existsSync(t,i){return this._sync.existsSync(t,i)}chmodSync(t,i,o){this._sync.chmodSync(t,i,o),this.enqueueOp({apiMethod:"chmod",arguments:[t,i,o]})}chownSync(t,i,o,c){this._sync.chownSync(t,i,o,c),this.enqueueOp({apiMethod:"chown",arguments:[t,i,o,c]})}utimesSync(t,i,o,c){this._sync.utimesSync(t,i,o,c),this.enqueueOp({apiMethod:"utimes",arguments:[t,i,o,c]})}_initialize(){return g(this,null,function*(){if(!this._isInitialized){let t=l((c,a)=>g(this,null,function*(){if(c!=="/"){let m=yield this._async.stat(c,K.Root);this._sync.mkdirSync(c,a,m.getCred())}let d=yield this._async.readdir(c,K.Root);for(let m of d)yield o(St(c,m))}),"copyDirectory"),i=l((c,a)=>g(this,null,function*(){let d=yield this._async.readFile(c,null,O.getFileFlag("r"),K.Root);this._sync.writeFileSync(c,d,null,O.getFileFlag("w"),a,K.Root)}),"copyFile"),o=l(c=>g(this,null,function*(){let a=yield this._async.stat(c,K.Root);a.isDirectory()?yield t(c,a.mode):yield i(c,a.mode)}),"copyItem");try{yield t("/",0),this._isInitialized=!0}catch(c){throw this._isInitialized=!1,c}}return this})}enqueueOp(t){if(this._queue.push(t),!this._queueRunning){this._queueRunning=!0;let i=l(o=>{if(o)throw new Error(`WARNING: File system has desynchronized. Received following error: ${o}
|
|
4
|
-
$`);if(this._queue.length>0){let c=this._queue.shift();c.arguments.push(i),this._async[c.apiMethod].apply(this._async,c.arguments)}else this._queueRunning=!1},"doNextOp");i()}}},vt=ae;l(vt,"AsyncMirror"),vt.Name="AsyncMirror",vt.Create=Pt.bind(ae),vt.Options={sync:{type:"object",description:"The synchronous file system to mirror the asynchronous file system to.",validator:t=>g(ae,null,function*(){if(!(t!=null&&t.metadata.synchronous))throw new h(22,"'sync' option must be a file system that supports synchronous operations")})},async:{type:"object",description:"The asynchronous file system to mirror."}};var Ei=class extends dt{constructor({folder:t,wrapped:i}){super();this._folder=t,this._wrapped=i,this._ready=this._initialize()}static isAvailable(){return!0}get metadata(){return wt(pt(pt({},super.metadata),this._wrapped.metadata),{supportsLinks:!1})}_initialize(){return g(this,null,function*(){if(!(yield this._wrapped.exists(this._folder,K.Root))&&this._wrapped.metadata.readonly)throw h.ENOENT(this._folder);return yield this._wrapped.mkdir(this._folder,511,K.Root),this})}},yt=Ei;l(yt,"FolderAdapter"),yt.Name="FolderAdapter",yt.Create=Pt.bind(Ei),yt.Options={folder:{type:"string",description:"The folder to use as the root directory"},wrapped:{type:"object",description:"The file system to wrap"}};function er(s,e){if(e!==null&&typeof e=="object"){let t=e,i=t.path;i&&(i="/"+Ki(s,i),t.message=t.message.replace(t.path,i),t.path=i)}return e}l(er,"translateError");function Zs(s,e){return typeof e=="function"?function(t){arguments.length>0&&(arguments[0]=er(s,t)),e.apply(null,arguments)}:e}l(Zs,"wrapCallback");function ir(s,e,t){return s.slice(s.length-4)!=="Sync"?function(){return arguments.length>0&&(e&&(arguments[0]=St(this._folder,arguments[0])),t&&(arguments[1]=St(this._folder,arguments[1])),arguments[arguments.length-1]=Zs(this._folder,arguments[arguments.length-1])),this._wrapped[s].apply(this._wrapped,arguments)}:function(){try{return e&&(arguments[0]=St(this._folder,arguments[0])),t&&(arguments[1]=St(this._folder,arguments[1])),this._wrapped[s].apply(this._wrapped,arguments)}catch(i){throw er(this._folder,i)}}}l(ir,"wrapFunction");["diskSpace","stat","statSync","open","openSync","unlink","unlinkSync","rmdir","rmdirSync","mkdir","mkdirSync","readdir","readdirSync","exists","existsSync","realpath","realpathSync","truncate","truncateSync","readFile","readFileSync","writeFile","writeFileSync","appendFile","appendFileSync","chmod","chmodSync","chown","chownSync","utimes","utimesSync","readlink","readlinkSync"].forEach(s=>{yt.prototype[s]=ir(s,!0,!1)});["rename","renameSync","link","linkSync","symlink","symlinkSync"].forEach(s=>{yt.prototype[s]=ir(s,!0,!0)});var Gt=class{constructor(){this._locks=new Map}lock(e){return new Promise(t=>{this._locks.has(e)?this._locks.get(e).push(t):this._locks.set(e,[])})}unlock(e){if(!this._locks.has(e))throw new Error("unlock of a non-locked mutex");let t=this._locks.get(e).shift();if(t){setTimeout(t,0);return}this._locks.delete(e)}tryLock(e){return this._locks.has(e)?!1:(this._locks.set(e,[]),!0)}isLocked(e){return this._locks.has(e)}};l(Gt,"Mutex");var Ht=class{constructor(e){this._ready=Promise.resolve(this);this._fs=e,this._mu=new Gt}whenReady(){return this._ready}get metadata(){return wt(pt({},this._fs.metadata),{name:"LockedFS<"+this._fs.metadata.name+">"})}get fs(){return this._fs}rename(e,t,i){return g(this,null,function*(){yield this._mu.lock(e),yield this._fs.rename(e,t,i),this._mu.unlock(e)})}renameSync(e,t,i){if(this._mu.isLocked(e))throw new Error("invalid sync call");return this._fs.renameSync(e,t,i)}stat(e,t){return g(this,null,function*(){yield this._mu.lock(e);let i=yield this._fs.stat(e,t);return this._mu.unlock(e),i})}statSync(e,t){if(this._mu.isLocked(e))throw new Error("invalid sync call");return this._fs.statSync(e,t)}access(e,t,i){return g(this,null,function*(){yield this._mu.lock(e),yield this._fs.access(e,t,i),this._mu.unlock(e)})}accessSync(e,t,i){if(this._mu.isLocked(e))throw new Error("invalid sync call");return this._fs.accessSync(e,t,i)}open(e,t,i,o){return g(this,null,function*(){yield this._mu.lock(e);let c=yield this._fs.open(e,t,i,o);return this._mu.unlock(e),c})}openSync(e,t,i,o){if(this._mu.isLocked(e))throw new Error("invalid sync call");return this._fs.openSync(e,t,i,o)}unlink(e,t){return g(this,null,function*(){yield this._mu.lock(e),yield this._fs.unlink(e,t),this._mu.unlock(e)})}unlinkSync(e,t){if(this._mu.isLocked(e))throw new Error("invalid sync call");return this._fs.unlinkSync(e,t)}rmdir(e,t){return g(this,null,function*(){yield this._mu.lock(e),yield this._fs.rmdir(e,t),this._mu.unlock(e)})}rmdirSync(e,t){if(this._mu.isLocked(e))throw new Error("invalid sync call");return this._fs.rmdirSync(e,t)}mkdir(e,t,i){return g(this,null,function*(){yield this._mu.lock(e),yield this._fs.mkdir(e,t,i),this._mu.unlock(e)})}mkdirSync(e,t,i){if(this._mu.isLocked(e))throw new Error("invalid sync call");return this._fs.mkdirSync(e,t,i)}readdir(e,t){return g(this,null,function*(){yield this._mu.lock(e);let i=yield this._fs.readdir(e,t);return this._mu.unlock(e),i})}readdirSync(e,t){if(this._mu.isLocked(e))throw new Error("invalid sync call");return this._fs.readdirSync(e,t)}exists(e,t){return g(this,null,function*(){yield this._mu.lock(e);let i=yield this._fs.exists(e,t);return this._mu.unlock(e),i})}existsSync(e,t){if(this._mu.isLocked(e))throw new Error("invalid sync call");return this._fs.existsSync(e,t)}realpath(e,t){return g(this,null,function*(){yield this._mu.lock(e);let i=yield this._fs.realpath(e,t);return this._mu.unlock(e),i})}realpathSync(e,t){if(this._mu.isLocked(e))throw new Error("invalid sync call");return this._fs.realpathSync(e,t)}truncate(e,t,i){return g(this,null,function*(){yield this._mu.lock(e),yield this._fs.truncate(e,t,i),this._mu.unlock(e)})}truncateSync(e,t,i){if(this._mu.isLocked(e))throw new Error("invalid sync call");return this._fs.truncateSync(e,t,i)}readFile(e,t,i,o){return g(this,null,function*(){yield this._mu.lock(e);let c=yield this._fs.readFile(e,t,i,o);return this._mu.unlock(e),c})}readFileSync(e,t,i,o){if(this._mu.isLocked(e))throw new Error("invalid sync call");return this._fs.readFileSync(e,t,i,o)}writeFile(e,t,i,o,c,a){return g(this,null,function*(){yield this._mu.lock(e),yield this._fs.writeFile(e,t,i,o,c,a),this._mu.unlock(e)})}writeFileSync(e,t,i,o,c,a){if(this._mu.isLocked(e))throw new Error("invalid sync call");return this._fs.writeFileSync(e,t,i,o,c,a)}appendFile(e,t,i,o,c,a){return g(this,null,function*(){yield this._mu.lock(e),yield this._fs.appendFile(e,t,i,o,c,a),this._mu.unlock(e)})}appendFileSync(e,t,i,o,c,a){if(this._mu.isLocked(e))throw new Error("invalid sync call");return this._fs.appendFileSync(e,t,i,o,c,a)}chmod(e,t,i){return g(this,null,function*(){yield this._mu.lock(e),yield this._fs.chmod(e,t,i),this._mu.unlock(e)})}chmodSync(e,t,i){if(this._mu.isLocked(e))throw new Error("invalid sync call");return this._fs.chmodSync(e,t,i)}chown(e,t,i,o){return g(this,null,function*(){yield this._mu.lock(e),yield this._fs.chown(e,t,i,o),this._mu.unlock(e)})}chownSync(e,t,i,o){if(this._mu.isLocked(e))throw new Error("invalid sync call");return this._fs.chownSync(e,t,i,o)}utimes(e,t,i,o){return g(this,null,function*(){yield this._mu.lock(e),yield this._fs.utimes(e,t,i,o),this._mu.unlock(e)})}utimesSync(e,t,i,o){if(this._mu.isLocked(e))throw new Error("invalid sync call");return this._fs.utimesSync(e,t,i,o)}link(e,t,i){return g(this,null,function*(){yield this._mu.lock(e),yield this._fs.link(e,t,i),this._mu.unlock(e)})}linkSync(e,t,i){if(this._mu.isLocked(e))throw new Error("invalid sync call");return this._fs.linkSync(e,t,i)}symlink(e,t,i,o){return g(this,null,function*(){yield this._mu.lock(e),yield this._fs.symlink(e,t,i,o),this._mu.unlock(e)})}symlinkSync(e,t,i,o){if(this._mu.isLocked(e))throw new Error("invalid sync call");return this._fs.symlinkSync(e,t,i,o)}readlink(e,t){return g(this,null,function*(){yield this._mu.lock(e);let i=yield this._fs.readlink(e,t);return this._mu.unlock(e),i})}readlinkSync(e,t){if(this._mu.isLocked(e))throw new Error("invalid sync call");return this._fs.readlinkSync(e,t)}};l(Ht,"LockedFS");var Ct="/.deletedFiles.log";function rr(s){return 146|s}l(rr,"makeModeWritable");function lt(s){return O.getFileFlag(s)}l(lt,"getFlag");var ce=class extends at{constructor(e,t,i,o,c){super(e,t,i,o,c)}sync(){return g(this,null,function*(){this.isDirty()&&(yield this._fs._syncAsync(this),this.resetDirty())})}syncSync(){this.isDirty()&&(this._fs._syncSync(this),this.resetDirty())}close(){return g(this,null,function*(){yield this.sync()})}closeSync(){this.syncSync()}};l(ce,"OverlayFile");var le=class extends dt{constructor({writable:t,readable:i}){super();this._isInitialized=!1;this._deletedFiles={};this._deleteLog="";this._deleteLogUpdatePending=!1;this._deleteLogUpdateNeeded=!1;this._deleteLogError=null;if(this._writable=t,this._readable=i,this._writable.metadata.readonly)throw new h(22,"Writable file system must be writable.")}static isAvailable(){return!0}get metadata(){return wt(pt({},super.metadata),{name:Ft.Name,synchronous:this._readable.metadata.synchronous&&this._writable.metadata.synchronous,supportsProperties:this._readable.metadata.supportsProperties&&this._writable.metadata.supportsProperties})}getOverlayedFileSystems(){return{readable:this._readable,writable:this._writable}}_syncAsync(t){return g(this,null,function*(){let i=t.getStats();return yield this.createParentDirectoriesAsync(t.getPath(),i.getCred(0,0)),this._writable.writeFile(t.getPath(),t.getBuffer(),null,lt("w"),i.mode,i.getCred(0,0))})}_syncSync(t){let i=t.getStats();this.createParentDirectories(t.getPath(),i.getCred(0,0)),this._writable.writeFileSync(t.getPath(),t.getBuffer(),null,lt("w"),i.mode,i.getCred(0,0))}_initialize(){return g(this,null,function*(){if(!this._isInitialized){try{let t=yield this._writable.readFile(Ct,"utf8",lt("r"),K.Root);this._deleteLog=t}catch(t){if(t.errno!==2)throw t}this._isInitialized=!0,this._reparseDeletionLog()}})}getDeletionLog(){return this._deleteLog}restoreDeletionLog(t,i){this._deleteLog=t,this._reparseDeletionLog(),this.updateLog("",i)}rename(t,i,o){return g(this,null,function*(){if(this.checkInitialized(),this.checkPath(t),this.checkPath(i),t===Ct||i===Ct)throw h.EPERM("Cannot rename deletion log.");let c=yield this.stat(t,o);if(c.isDirectory()){if(t===i)return;let a=511;if(yield this.exists(i,o)){let d=yield this.stat(i,o);if(a=d.mode,d.isDirectory()){if((yield this.readdir(i,o)).length>0)throw h.ENOTEMPTY(i)}else throw h.ENOTDIR(i)}if((yield this._writable.exists(t,o))?yield this._writable.rename(t,i,o):(yield this._writable.exists(i,o))||(yield this._writable.mkdir(i,a,o)),yield this._readable.exists(t,o))for(let d of yield this._readable.readdir(t,o))yield this.rename(Et(t,d),Et(i,d),o)}else{if((yield this.exists(i,o))&&(yield this.stat(i,o)).isDirectory())throw h.EISDIR(i);yield this.writeFile(i,yield this.readFile(t,null,lt("r"),o),null,lt("w"),c.mode,o)}t!==i&&(yield this.exists(t,o))&&(yield this.unlink(t,o))})}renameSync(t,i,o){if(this.checkInitialized(),this.checkPath(t),this.checkPath(i),t===Ct||i===Ct)throw h.EPERM("Cannot rename deletion log.");let c=this.statSync(t,o);if(c.isDirectory()){if(t===i)return;let a=511;if(this.existsSync(i,o)){let d=this.statSync(i,o);if(a=d.mode,d.isDirectory()){if(this.readdirSync(i,o).length>0)throw h.ENOTEMPTY(i)}else throw h.ENOTDIR(i)}this._writable.existsSync(t,o)?this._writable.renameSync(t,i,o):this._writable.existsSync(i,o)||this._writable.mkdirSync(i,a,o),this._readable.existsSync(t,o)&&this._readable.readdirSync(t,o).forEach(d=>{this.renameSync(Et(t,d),Et(i,d),o)})}else{if(this.existsSync(i,o)&&this.statSync(i,o).isDirectory())throw h.EISDIR(i);this.writeFileSync(i,this.readFileSync(t,null,lt("r"),o),null,lt("w"),c.mode,o)}t!==i&&this.existsSync(t,o)&&this.unlinkSync(t,o)}stat(t,i){return g(this,null,function*(){this.checkInitialized();try{return this._writable.stat(t,i)}catch(o){if(this._deletedFiles[t])throw h.ENOENT(t);let c=X.clone(yield this._readable.stat(t,i));return c.mode=rr(c.mode),c}})}statSync(t,i){this.checkInitialized();try{return this._writable.statSync(t,i)}catch(o){if(this._deletedFiles[t])throw h.ENOENT(t);let c=X.clone(this._readable.statSync(t,i));return c.mode=rr(c.mode),c}}open(t,i,o,c){return g(this,null,function*(){if(this.checkInitialized(),this.checkPath(t),t===Ct)throw h.EPERM("Cannot open deletion log.");if(yield this.exists(t,c))switch(i.pathExistsAction()){case 2:return yield this.createParentDirectoriesAsync(t,c),this._writable.open(t,i,o,c);case 0:if(yield this._writable.exists(t,c))return this._writable.open(t,i,o,c);{let a=yield this._readable.readFile(t,null,lt("r"),c),d=X.clone(yield this._readable.stat(t,c));return d.mode=o,new ce(this,t,i,d,a)}default:throw h.EEXIST(t)}else switch(i.pathNotExistsAction()){case 3:return yield this.createParentDirectoriesAsync(t,c),this._writable.open(t,i,o,c);default:throw h.ENOENT(t)}})}openSync(t,i,o,c){if(this.checkInitialized(),this.checkPath(t),t===Ct)throw h.EPERM("Cannot open deletion log.");if(this.existsSync(t,c))switch(i.pathExistsAction()){case 2:return this.createParentDirectories(t,c),this._writable.openSync(t,i,o,c);case 0:if(this._writable.existsSync(t,c))return this._writable.openSync(t,i,o,c);{let a=this._readable.readFileSync(t,null,lt("r"),c),d=X.clone(this._readable.statSync(t,c));return d.mode=o,new ce(this,t,i,d,a)}default:throw h.EEXIST(t)}else switch(i.pathNotExistsAction()){case 3:return this.createParentDirectories(t,c),this._writable.openSync(t,i,o,c);default:throw h.ENOENT(t)}}unlink(t,i){return g(this,null,function*(){if(this.checkInitialized(),this.checkPath(t),yield this.exists(t,i))(yield this._writable.exists(t,i))&&(yield this._writable.unlink(t,i)),(yield this.exists(t,i))&&this.deletePath(t,i);else throw h.ENOENT(t)})}unlinkSync(t,i){if(this.checkInitialized(),this.checkPath(t),this.existsSync(t,i))this._writable.existsSync(t,i)&&this._writable.unlinkSync(t,i),this.existsSync(t,i)&&this.deletePath(t,i);else throw h.ENOENT(t)}rmdir(t,i){return g(this,null,function*(){if(this.checkInitialized(),yield this.exists(t,i)){if((yield this._writable.exists(t,i))&&(yield this._writable.rmdir(t,i)),yield this.exists(t,i)){if((yield this.readdir(t,i)).length>0)throw h.ENOTEMPTY(t);this.deletePath(t,i)}}else throw h.ENOENT(t)})}rmdirSync(t,i){if(this.checkInitialized(),this.existsSync(t,i)){if(this._writable.existsSync(t,i)&&this._writable.rmdirSync(t,i),this.existsSync(t,i)){if(this.readdirSync(t,i).length>0)throw h.ENOTEMPTY(t);this.deletePath(t,i)}}else throw h.ENOENT(t)}mkdir(t,i,o){return g(this,null,function*(){if(this.checkInitialized(),yield this.exists(t,o))throw h.EEXIST(t);yield this.createParentDirectoriesAsync(t,o),yield this._writable.mkdir(t,i,o)})}mkdirSync(t,i,o){if(this.checkInitialized(),this.existsSync(t,o))throw h.EEXIST(t);this.createParentDirectories(t,o),this._writable.mkdirSync(t,i,o)}readdir(t,i){return g(this,null,function*(){if(this.checkInitialized(),!(yield this.stat(t,i)).isDirectory())throw h.ENOTDIR(t);let c=[];try{c=c.concat(yield this._writable.readdir(t,i))}catch(d){}try{c=c.concat((yield this._readable.readdir(t,i)).filter(d=>!this._deletedFiles[`${t}/${d}`]))}catch(d){}let a={};return c.filter(d=>{let m=!a[d];return a[d]=!0,m})})}readdirSync(t,i){if(this.checkInitialized(),!this.statSync(t,i).isDirectory())throw h.ENOTDIR(t);let c=[];try{c=c.concat(this._writable.readdirSync(t,i))}catch(d){}try{c=c.concat(this._readable.readdirSync(t,i).filter(d=>!this._deletedFiles[`${t}/${d}`]))}catch(d){}let a={};return c.filter(d=>{let m=!a[d];return a[d]=!0,m})}exists(t,i){return g(this,null,function*(){return this.checkInitialized(),(yield this._writable.exists(t,i))||(yield this._readable.exists(t,i))&&this._deletedFiles[t]!==!0})}existsSync(t,i){return this.checkInitialized(),this._writable.existsSync(t,i)||this._readable.existsSync(t,i)&&this._deletedFiles[t]!==!0}chmod(t,i,o){return g(this,null,function*(){this.checkInitialized(),yield this.operateOnWritableAsync(t,o),yield this._writable.chmod(t,i,o)})}chmodSync(t,i,o){this.checkInitialized(),this.operateOnWritable(t,o),this._writable.chmodSync(t,i,o)}chown(t,i,o,c){return g(this,null,function*(){this.checkInitialized(),yield this.operateOnWritableAsync(t,c),yield this._writable.chown(t,i,o,c)})}chownSync(t,i,o,c){this.checkInitialized(),this.operateOnWritable(t,c),this._writable.chownSync(t,i,o,c)}utimes(t,i,o,c){return g(this,null,function*(){this.checkInitialized(),yield this.operateOnWritableAsync(t,c),yield this._writable.utimes(t,i,o,c)})}utimesSync(t,i,o,c){this.checkInitialized(),this.operateOnWritable(t,c),this._writable.utimesSync(t,i,o,c)}deletePath(t,i){this._deletedFiles[t]=!0,this.updateLog(`d${t}
|
|
3
|
+
Option description: ${m.description}`)}}}a=!0})}l(We,"checkOptions");function _n(s){return new Promise(e=>{setTimeout(e,s)})}l(_n,"wait");function kn(s){return function(...e){return new Promise((t,i)=>{e.push((o,...c)=>{o?i(o):t(c[0])}),s(...e)})}}l(kn,"toPromise");var In=typeof globalThis.setImmediate=="function"?globalThis.setImmediate:s=>setTimeout(s,0),ft="/";function ne(){return k.from("{}")}l(ne,"getEmptyDirNode");function zt(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(s){let e=Math.random()*16|0;return(s==="x"?e:e&3|8).toString(16)})}l(zt,"randomUUID");var Xt=class{constructor(e){this.store=e;this.originalData={};this.modifiedKeys=[]}get(e){let t=this.store.get(e);return this.stashOldValue(e,t),t}put(e,t,i){return this.markModified(e),this.store.put(e,t,i)}del(e){this.markModified(e),this.store.del(e)}commit(){}abort(){for(let e of this.modifiedKeys){let t=this.originalData[e];t?this.store.put(e,t,!0):this.store.del(e)}}_has(e){return Object.prototype.hasOwnProperty.call(this.originalData,e)}stashOldValue(e,t){this._has(e)||(this.originalData[e]=t)}markModified(e){this.modifiedKeys.indexOf(e)===-1&&(this.modifiedKeys.push(e),this._has(e)||(this.originalData[e]=this.store.get(e)))}};l(Xt,"SimpleSyncRWTransaction");var qt=class extends at{constructor(e,t,i,o,c){super(e,t,i,o,c)}syncSync(){this.isDirty()&&(this._fs._syncSync(this.getPath(),this.getBuffer(),this.getStats()),this.resetDirty())}closeSync(){this.syncSync()}};l(qt,"SyncKeyValueFile");var Jt=class extends Nt{constructor(t){super();this.store=t.store,this.makeRootDirectory()}static isAvailable(){return!0}getName(){return this.store.name()}isReadOnly(){return!1}supportsSymlinks(){return!1}supportsProps(){return!0}supportsSynch(){return!0}empty(){this.store.clear(),this.makeRootDirectory()}accessSync(t,i,o){let c=this.store.beginTransaction("readonly");if(!this.findINode(c,t).toStats().hasAccess(i,o))throw h.EACCES(t)}renameSync(t,i,o){let c=this.store.beginTransaction("readwrite"),a=R(t),d=it(t),m=R(i),y=it(i),S=this.findINode(c,a),w=this.getDirListing(c,a,S);if(!S.toStats().hasAccess(2,o))throw h.EACCES(t);if(!w[d])throw h.ENOENT(t);let v=w[d];if(delete w[d],(m+"/").indexOf(t+"/")===0)throw new h(16,a);let x,C;if(m===a?(x=S,C=w):(x=this.findINode(c,m),C=this.getDirListing(c,m,x)),C[y]){let F=this.getINode(c,i,C[y]);if(F.isFile())try{c.del(F.id),c.del(C[y])}catch(_){throw c.abort(),_}else throw h.EPERM(i)}C[y]=v;try{c.put(S.id,k.from(JSON.stringify(w)),!0),c.put(x.id,k.from(JSON.stringify(C)),!0)}catch(F){throw c.abort(),F}c.commit()}statSync(t,i){let o=this.findINode(this.store.beginTransaction("readonly"),t).toStats();if(!o.hasAccess(4,i))throw h.EACCES(t);return o}createFileSync(t,i,o,c){let a=this.store.beginTransaction("readwrite"),d=k.alloc(0),m=this.commitNewFile(a,t,j.FILE,o,c,d);return new qt(this,t,i,m.toStats(),d)}openFileSync(t,i,o){let c=this.store.beginTransaction("readonly"),a=this.findINode(c,t),d=c.get(a.id);if(!a.toStats().hasAccess(i.getMode(),o))throw h.EACCES(t);if(d===void 0)throw h.ENOENT(t);return new qt(this,t,i,a.toStats(),d)}unlinkSync(t,i){this.removeEntry(t,!1,i)}rmdirSync(t,i){if(this.readdirSync(t,i).length>0)throw h.ENOTEMPTY(t);this.removeEntry(t,!0,i)}mkdirSync(t,i,o){let c=this.store.beginTransaction("readwrite"),a=k.from("{}");this.commitNewFile(c,t,j.DIRECTORY,i,o,a)}readdirSync(t,i){let o=this.store.beginTransaction("readonly"),c=this.findINode(o,t);if(!c.toStats().hasAccess(4,i))throw h.EACCES(t);return Object.keys(this.getDirListing(o,t,c))}chmodSync(t,i,o){this.openFileSync(t,O.getFileFlag("r+"),o).chmodSync(i)}chownSync(t,i,o,c){this.openFileSync(t,O.getFileFlag("r+"),c).chownSync(i,o)}_syncSync(t,i,o){let c=this.store.beginTransaction("readwrite"),a=this._findINode(c,R(t),it(t)),d=this.getINode(c,t,a),m=d.update(o);try{c.put(d.id,i,!0),m&&c.put(a,d.toBuffer(),!0)}catch(y){throw c.abort(),y}c.commit()}makeRootDirectory(){let t=this.store.beginTransaction("readwrite");if(t.get(ft)===void 0){let i=new Date().getTime(),o=new nt(zt(),4096,511|j.DIRECTORY,i,i,i,0,0);t.put(o.id,ne(),!1),t.put(ft,o.toBuffer(),!1),t.commit()}}_findINode(t,i,o,c=new Set){let a=It.join(i,o);if(c.has(a))throw new h(5,"Infinite loop detected while finding inode",a);c.add(a);let d=l(m=>{let y=this.getDirListing(t,i,m);if(y[o])return y[o];throw h.ENOENT(Et(i,o))},"readDirectory");return i==="/"?o===""?ft:d(this.getINode(t,i,ft)):d(this.getINode(t,i+Ut+o,this._findINode(t,R(i),it(i),c)))}findINode(t,i){return this.getINode(t,i,this._findINode(t,R(i),it(i)))}getINode(t,i,o){let c=t.get(o);if(c===void 0)throw h.ENOENT(i);return nt.fromBuffer(c)}getDirListing(t,i,o){if(!o.isDirectory())throw h.ENOTDIR(i);let c=t.get(o.id);if(c===void 0)throw h.ENOENT(i);return JSON.parse(c.toString())}addNewNode(t,i){let c;for(;0<5;)try{return c=zt(),t.put(c,i,!1),c}catch(a){}throw new h(5,"Unable to commit data to key-value store.")}commitNewFile(t,i,o,c,a,d){let m=R(i),y=it(i),S=this.findINode(t,m),w=this.getDirListing(t,m,S),v=new Date().getTime();if(!S.toStats().hasAccess(4,a))throw h.EACCES(i);if(i==="/")throw h.EEXIST(i);if(w[y])throw h.EEXIST(i);let x;try{let C=this.addNewNode(t,d);x=new nt(C,d.length,c|o,v,v,v,a.uid,a.gid);let F=this.addNewNode(t,x.toBuffer());w[y]=F,t.put(S.id,k.from(JSON.stringify(w)),!0)}catch(C){throw t.abort(),C}return t.commit(),x}removeEntry(t,i,o){let c=this.store.beginTransaction("readwrite"),a=R(t),d=this.findINode(c,a),m=this.getDirListing(c,a,d),y=it(t);if(!m[y])throw h.ENOENT(t);let S=m[y],w=this.getINode(c,t,S);if(!w.toStats().hasAccess(2,o))throw h.EACCES(t);if(delete m[y],!i&&w.isDirectory())throw h.EISDIR(t);if(i&&!w.isDirectory())throw h.ENOTDIR(t);try{c.del(w.id),c.del(S),c.put(d.id,k.from(JSON.stringify(m)),!0)}catch(v){throw c.abort(),v}c.commit()}};l(Jt,"SyncKeyValueFileSystem");function Pt(s,e){e=typeof s=="function"?s:e,We(this,s);let t=new this(typeof s=="function"?{}:s);if(typeof e!="function")return t.whenReady();t.whenReady().then(i=>e(null,i)).catch(i=>e(i))}l(Pt,"CreateBackend");var Ee=class{constructor(){this.store=new Map}name(){return ht.Name}clear(){this.store.clear()}beginTransaction(e){return new Xt(this)}get(e){return this.store.get(e)}put(e,t,i){return!i&&this.store.has(e)?!1:(this.store.set(e,t),!0)}del(e){this.store.delete(e)}};l(Ee,"InMemoryStore");var $e=class extends Jt{constructor(){super({store:new Ee})}},ht=$e;l(ht,"InMemoryFileSystem"),ht.Name="InMemory",ht.Create=Pt.bind($e),ht.Options={};function Xi(s){if(typeof s=="number")return s;if(s instanceof Date)return s.getTime()/1e3;throw new Error("Cannot parse time: "+s)}l(Xi,"_toUnixTimestamp");function ct(s,e){switch(typeof s){case"number":return s;case"string":let t=parseInt(s,8);return isNaN(t)?e:t;default:return e}}l(ct,"normalizeMode");function st(s){if(s instanceof Date)return s;if(typeof s=="number")return new Date(s*1e3);throw new h(22,"Invalid time.")}l(st,"normalizeTime");function q(s){if(s.indexOf("\0")>=0)throw new h(22,"Path must be a string without null bytes.");if(s==="")throw new h(22,"Path must not be empty.");return s=s.replaceAll(/\/+/g,"/"),It.resolve(s)}l(q,"normalizePath");function At(s,e,t,i){switch(s===null?"null":typeof s){case"object":return{encoding:typeof s.encoding!="undefined"?s.encoding:e,flag:typeof s.flag!="undefined"?s.flag:t,mode:ct(s.mode,i)};case"string":return{encoding:s,flag:t,mode:i};case"null":case"undefined":case"function":return{encoding:e,flag:t,mode:i};default:throw new TypeError(`"options" must be a string or an object, got ${typeof s} instead.`)}}l(At,"normalizeOptions");function B(){}l(B,"nop");var I=K.Root;function qi(s){I=s}l(qi,"setCred");var Vt=new Map,Bn=100;function Fe(s){let e=Bn++;return Vt.set(e,s),e}l(Fe,"getFdForFile");function Y(s){if(!Vt.has(s))throw new h(9,"Invalid file descriptor.");return Vt.get(s)}l(Y,"fd2file");var gt=new Map;ht.Create().then(s=>xe("/",s));function Yt(s){return gt.get(s)}l(Yt,"getMount");function Ji(){return Object.fromEntries(gt.entries())}l(Ji,"getMounts");function xe(s,e){if(s[0]!=="/"&&(s="/"+s),s=It.resolve(s),gt.has(s))throw new h(22,"Mount point "+s+" is already in use.");gt.set(s,e)}l(xe,"mount");function Ke(s){if(s[0]!=="/"&&(s=`/${s}`),s=It.resolve(s),!gt.has(s))throw new h(22,"Mount point "+s+" is already unmounted.");gt.delete(s)}l(Ke,"umount");function mt(s){let e=[...gt].sort((t,i)=>t[0].length>i[0].length?-1:1);for(let[t,i]of e)if(t.length<=s.length&&s.startsWith(t))return s=s.slice(t.length>1?t.length:0),s===""&&(s="/"),{fs:i,path:s,mountPoint:t};throw new h(5,"ZenFS not initialized with a file system")}l(mt,"resolveFS");function Yi(s,e){for(let[t,i]of Object.entries(e))s=s.replaceAll(t,i);return s}l(Yi,"fixPaths");function Rt(s,e){return s.stack=Yi(s.stack,e),s.message=Yi(s.message,e),s}l(Rt,"fixError");function Gi(s){s["/"]&&Ke("/");for(let[e,t]of Object.entries(s)){if(!t.constructor.isAvailable())throw new h(22,`Can not mount "${e}" since the filesystem is unavailable.`);xe(e,t)}}l(Gi,"initialize");var oe={};he(oe,{access:()=>bi,appendFile:()=>Ge,chmod:()=>mi,chown:()=>fi,close:()=>Ze,constants:()=>jt,createReadStream:()=>Pn,createWriteStream:()=>An,exists:()=>ve,fchmod:()=>ni,fchown:()=>ri,fdatasync:()=>ei,fstat:()=>He,fsync:()=>ti,ftruncate:()=>Qe,futimes:()=>si,lchmod:()=>pi,lchown:()=>hi,link:()=>li,lstat:()=>Xe,lutimes:()=>yi,mkdir:()=>ai,open:()=>Je,read:()=>ii,readFile:()=>_e,readdir:()=>ci,readlink:()=>di,realpath:()=>se,rename:()=>je,rmdir:()=>oi,stat:()=>Ye,symlink:()=>ui,truncate:()=>qe,unlink:()=>Ce,unwatchFile:()=>On,utimes:()=>gi,watch:()=>Nn,watchFile:()=>Tn,write:()=>Ie,writeFile:()=>ke});function J(){return g(this,arguments,function*(...[s,e,t,...i]){t=q(t);let{fs:o,path:c}=mt(e&&(yield ve(t))?yield se(t):t);try{return o[s](c,...i)}catch(a){throw Rt(a,{[c]:t})}})}l(J,"doOp");function je(s,e){return g(this,null,function*(){s=q(s),e=q(e);let t=mt(s),i=mt(e),o={[t.path]:s,[i.path]:e};try{if(t===i)return t.fs.rename(t.path,i.path,I);let c=yield _e(s);yield ke(e,c),yield Ce(s)}catch(c){throw Rt(c,o)}})}l(je,"rename");function ve(s){return g(this,null,function*(){s=q(s);try{let{fs:e,path:t}=mt(s);return e.exists(t,I)}catch(e){if(e.errno==2)return!1;throw e}})}l(ve,"exists");function Ye(s){return g(this,null,function*(){return J("stat",!0,s,I)})}l(Ye,"stat");function Xe(s){return g(this,null,function*(){return J("stat",!1,s,I)})}l(Xe,"lstat");function qe(s,e=0){return g(this,null,function*(){if(e<0)throw new h(22);return J("truncate",!0,s,e,I)})}l(qe,"truncate");function Ce(s){return g(this,null,function*(){return J("unlink",!1,s,I)})}l(Ce,"unlink");function Je(s,e,t=420){return g(this,null,function*(){let i=yield J("open",!0,s,O.getFileFlag(e),ct(t,420),I);return Fe(i)})}l(Je,"open");function _e(t){return g(this,arguments,function*(s,e={}){let i=At(e,null,"r",null),o=O.getFileFlag(i.flag);if(!o.isReadable())throw new h(22,"Flag passed to readFile must allow for reading.");return J("readFile",!0,s,i.encoding,o,I)})}l(_e,"readFile");function ke(s,e,t){return g(this,null,function*(){let i=At(t,"utf8","w",420),o=O.getFileFlag(i.flag);if(!o.isWriteable())throw new h(22,"Flag passed to writeFile must allow for writing.");return J("writeFile",!0,s,e,i.encoding,o,i.mode,I)})}l(ke,"writeFile");function Ge(s,e,t){return g(this,null,function*(){let i=At(t,"utf8","a",420),o=O.getFileFlag(i.flag);if(!o.isAppendable())throw new h(22,"Flag passed to appendFile must allow for appending.");return J("appendFile",!0,s,e,i.encoding,o,i.mode,I)})}l(Ge,"appendFile");function He(s){return g(this,null,function*(){return Y(s).stat()})}l(He,"fstat");function Ze(s){return g(this,null,function*(){yield Y(s).close(),Vt.delete(s)})}l(Ze,"close");function Qe(s,e=0){return g(this,null,function*(){let t=Y(s);if(e<0)throw new h(22);return t.truncate(e)})}l(Qe,"ftruncate");function ti(s){return g(this,null,function*(){return Y(s).sync()})}l(ti,"fsync");function ei(s){return g(this,null,function*(){return Y(s).datasync()})}l(ei,"fdatasync");function Ie(s,e,t,i,o){return g(this,null,function*(){let c,a=0,d,m;if(typeof e=="string"){m=typeof t=="number"?t:null;let S=typeof i=="string"?i:"utf8";a=0,c=k.from(e,S),d=c.length}else c=e,a=t,d=i,m=typeof o=="number"?o:null;let y=Y(s);return m==null&&(m=y.getPos()),y.write(c,a,d,m)})}l(Ie,"write");function ii(s,e,t,i,o){return g(this,null,function*(){let c=Y(s);return isNaN(+o)&&(o=c.getPos()),c.read(e,t,i,o)})}l(ii,"read");function ri(s,e,t){return g(this,null,function*(){return Y(s).chown(e,t)})}l(ri,"fchown");function ni(s,e){return g(this,null,function*(){let t=typeof e=="string"?parseInt(e,8):e;return Y(s).chmod(t)})}l(ni,"fchmod");function si(s,e,t){return g(this,null,function*(){return Y(s).utimes(st(e),st(t))})}l(si,"futimes");function oi(s){return g(this,null,function*(){return J("rmdir",!0,s,I)})}l(oi,"rmdir");function ai(s,e){return g(this,null,function*(){return J("mkdir",!0,s,ct(e,511),I)})}l(ai,"mkdir");function ci(s){return g(this,null,function*(){s=q(s);let e=yield J("readdir",!0,s,I),t=[...gt.keys()];for(let i of t)if(i.startsWith(s)){let o=i.slice(s.length);if(o.includes("/")||o.length==0)continue;e.push(o)}return e})}l(ci,"readdir");function li(s,e){return g(this,null,function*(){return e=q(e),J("link",!1,s,e,I)})}l(li,"link");function ui(s,e,t="file"){return g(this,null,function*(){if(!["file","dir","junction"].includes(t))throw new h(22,"Invalid type: "+t);return e=q(e),J("symlink",!1,s,e,t,I)})}l(ui,"symlink");function di(s){return g(this,null,function*(){return J("readlink",!1,s,I)})}l(di,"readlink");function fi(s,e,t){return g(this,null,function*(){return J("chown",!0,s,e,t,I)})}l(fi,"chown");function hi(s,e,t){return g(this,null,function*(){return J("chown",!1,s,e,t,I)})}l(hi,"lchown");function mi(s,e){return g(this,null,function*(){let t=ct(e,-1);if(t<0)throw new h(22,"Invalid mode.");return J("chmod",!0,s,t,I)})}l(mi,"chmod");function pi(s,e){return g(this,null,function*(){let t=ct(e,-1);if(t<1)throw new h(22,"Invalid mode.");return J("chmod",!1,q(s),t,I)})}l(pi,"lchmod");function gi(s,e,t){return g(this,null,function*(){return J("utimes",!0,s,st(e),st(t),I)})}l(gi,"utimes");function yi(s,e,t){return g(this,null,function*(){return J("utimes",!1,s,st(e),st(t),I)})}l(yi,"lutimes");function se(t){return g(this,arguments,function*(s,e={}){s=q(s);let{fs:i,path:o,mountPoint:c}=mt(s);try{if(!(yield i.stat(o,I)).isSymbolicLink())return s;let d=c+q(yield i.readlink(o,I));return se(d)}catch(a){throw Rt(a,{[o]:s})}})}l(se,"realpath");function Tn(i,o){return g(this,arguments,function*(s,e,t=B){throw new h(95)})}l(Tn,"watchFile");function On(t){return g(this,arguments,function*(s,e=B){throw new h(95)})}l(On,"unwatchFile");function Nn(i,o){return g(this,arguments,function*(s,e,t=B){throw new h(95)})}l(Nn,"watch");function bi(s,e=384){return g(this,null,function*(){return J("access",!0,s,e,I)})}l(bi,"access");function Pn(s,e){return g(this,null,function*(){throw new h(95)})}l(Pn,"createReadStream");function An(s,e){return g(this,null,function*(){throw new h(95)})}l(An,"createWriteStream");function Rn(s,e,t=B){je(s,e).then(()=>t()).catch(t)}l(Rn,"rename");function Dn(s,e=B){ve(s).then(e).catch(()=>e(!1))}l(Dn,"exists");function Ln(s,e=B){Ye(s).then(t=>e(null,t)).catch(e)}l(Ln,"stat");function Un(s,e=B){Xe(s).then(t=>e(null,t)).catch(e)}l(Un,"lstat");function Mn(s,e=0,t=B){t=typeof e=="function"?e:t,qe(s,typeof e=="number"?e:0).then(()=>t()).catch(t)}l(Mn,"truncate");function zn(s,e=B){Ce(s).then(()=>e()).catch(e)}l(zn,"unlink");function Vn(s,e,t,i=B){let o=ct(t,420);i=typeof t=="function"?t:i,Je(s,e,o).then(c=>i(null,c)).catch(i)}l(Vn,"open");function Wn(s,e={},t=B){t=typeof e=="function"?e:t,_e(s,typeof e=="function"?null:e)}l(Wn,"readFile");function $n(s,e,t={},i=B){i=typeof t=="function"?t:i,ke(s,e,typeof t=="function"?void 0:t)}l($n,"writeFile");function Kn(s,e,t,i=B){i=typeof t=="function"?t:i,Ge(s,e,typeof t=="function"?null:t)}l(Kn,"appendFile");function jn(s,e=B){He(s).then(t=>e(null,t)).catch(e)}l(jn,"fstat");function Yn(s,e=B){Ze(s).then(()=>e()).catch(e)}l(Yn,"close");function Xn(s,e,t=B){let i=typeof e=="number"?e:0;t=typeof e=="function"?e:t,Qe(s,i)}l(Xn,"ftruncate");function qn(s,e=B){ti(s).then(()=>e()).catch(e)}l(qn,"fsync");function Jn(s,e=B){ei(s).then(()=>e()).catch(e)}l(Jn,"fdatasync");function Gn(s,e,t,i,o,c=B){let a,d,m,y=null,S;if(typeof e=="string"){switch(S="utf8",typeof t){case"function":c=t;break;case"number":y=t,S=typeof i=="string"?i:"utf8",c=typeof o=="function"?o:c;break;default:c=typeof i=="function"?i:typeof o=="function"?o:c,c(new h(22,"Invalid arguments."));return}a=k.from(e,S),d=0,m=a.length;let w=c;Ie(s,a,d,m,y).then(v=>w(null,v,a.toString(S))).catch(w)}else{a=e,d=t,m=i,y=typeof o=="number"?o:null;let w=typeof o=="function"?o:c;Ie(s,a,d,m,y).then(v=>w(null,v,a)).catch(w)}}l(Gn,"write");function Hn(s,e,t,i,o,c=B){ii(s,e,t,i,o).then(({bytesRead:a,buffer:d})=>c(null,a,d)).catch(c)}l(Hn,"read");function Zn(s,e,t,i=B){ri(s,e,t).then(()=>i()).catch(i)}l(Zn,"fchown");function Qn(s,e,t){ni(s,e).then(()=>t()).catch(t)}l(Qn,"fchmod");function ts(s,e,t,i=B){si(s,e,t).then(()=>i()).catch(i)}l(ts,"futimes");function es(s,e=B){oi(s).then(()=>e()).catch(e)}l(es,"rmdir");function is(s,e,t=B){ai(s,e).then(()=>t()).catch(t)}l(is,"mkdir");function rs(s,e=B){ci(s).then(t=>e(null,t)).catch(e)}l(rs,"readdir");function ns(s,e,t=B){li(s,e).then(()=>t()).catch(t)}l(ns,"link");function ss(s,e,t,i=B){let o=typeof t=="string"?t:"file";i=typeof t=="function"?t:i,ui(s,e,typeof t=="function"?null:t).then(()=>i()).catch(i)}l(ss,"symlink");function os(s,e=B){di(s).then(t=>e(null,t)).catch(e)}l(os,"readlink");function as(s,e,t,i=B){fi(s,e,t).then(()=>i()).catch(i)}l(as,"chown");function cs(s,e,t,i=B){hi(s,e,t).then(()=>i()).catch(i)}l(cs,"lchown");function ls(s,e,t=B){mi(s,e).then(()=>t()).catch(t)}l(ls,"chmod");function us(s,e,t=B){pi(s,e).then(()=>t()).catch(t)}l(us,"lchmod");function ds(s,e,t,i=B){gi(s,e,t).then(()=>i()).catch(i)}l(ds,"utimes");function fs(s,e,t,i=B){yi(s,e,t).then(()=>i()).catch(i)}l(fs,"lutimes");function hs(s,e,t=B){let i=typeof e=="object"?e:{};t=typeof e=="function"?e:t,se(s,typeof e=="function"?null:e).then(o=>t(null,o)).catch(t)}l(hs,"realpath");function ms(s,e,t=B){let i=typeof e=="number"?e:4;t=typeof e=="function"?e:t,bi(s,typeof e=="function"?null:e).then(()=>t()).catch(t)}l(ms,"access");function ps(s,e,t=B){throw new h(95)}l(ps,"watchFile");function gs(s,e=B){throw new h(95)}l(gs,"unwatchFile");function ys(s,e,t=B){throw new h(95)}l(ys,"watch");function bs(s,e){throw new h(95)}l(bs,"createReadStream");function ws(s,e){throw new h(95)}l(ws,"createWriteStream");function G(...[s,e,t,...i]){t=q(t);let{fs:o,path:c}=mt(e&&Hi(t)?wi(t):t);try{return o[s](c,...i)}catch(a){throw Rt(a,{[c]:t})}}l(G,"doOp");function Ss(s,e){s=q(s),e=q(e);let t=mt(s),i=mt(e),o={[t.path]:s,[i.path]:e};try{if(t===i)return t.fs.renameSync(t.path,i.path,I);let c=Qi(s);tr(e,c),Zi(s)}catch(c){throw Rt(c,o)}}l(Ss,"renameSync");function Hi(s){s=q(s);try{let{fs:e,path:t}=mt(s);return e.existsSync(t,I)}catch(e){if(e.errno==2)return!1;throw e}}l(Hi,"existsSync");function Es(s){return G("statSync",!0,s,I)}l(Es,"statSync");function Fs(s){return G("statSync",!1,s,I)}l(Fs,"lstatSync");function xs(s,e=0){if(e<0)throw new h(22);return G("truncateSync",!0,s,e,I)}l(xs,"truncateSync");function Zi(s){return G("unlinkSync",!1,s,I)}l(Zi,"unlinkSync");function vs(s,e,t=420){let i=G("openSync",!0,s,O.getFileFlag(e),ct(t,420),I);return Fe(i)}l(vs,"openSync");function Qi(s,e={}){let t=At(e,null,"r",null),i=O.getFileFlag(t.flag);if(!i.isReadable())throw new h(22,"Flag passed to readFile must allow for reading.");return G("readFileSync",!0,s,t.encoding,i,I)}l(Qi,"readFileSync");function tr(s,e,t){let i=At(t,"utf8","w",420),o=O.getFileFlag(i.flag);if(!o.isWriteable())throw new h(22,"Flag passed to writeFile must allow for writing.");return G("writeFileSync",!0,s,e,i.encoding,o,i.mode,I)}l(tr,"writeFileSync");function Cs(s,e,t){let i=At(t,"utf8","a",420),o=O.getFileFlag(i.flag);if(!o.isAppendable())throw new h(22,"Flag passed to appendFile must allow for appending.");return G("appendFileSync",!0,s,e,i.encoding,o,i.mode,I)}l(Cs,"appendFileSync");function _s(s){return Y(s).statSync()}l(_s,"fstatSync");function ks(s){Y(s).closeSync(),Vt.delete(s)}l(ks,"closeSync");function Is(s,e=0){let t=Y(s);if(e<0)throw new h(22);t.truncateSync(e)}l(Is,"ftruncateSync");function Bs(s){Y(s).syncSync()}l(Bs,"fsyncSync");function Ts(s){Y(s).datasyncSync()}l(Ts,"fdatasyncSync");function Os(s,e,t,i,o){let c,a=0,d,m;if(typeof e=="string"){m=typeof t=="number"?t:null;let S=typeof i=="string"?i:"utf8";a=0,c=k.from(e,S),d=c.length}else c=e,a=t,d=i,m=typeof o=="number"?o:null;let y=Y(s);return m==null&&(m=y.getPos()),y.writeSync(c,a,d,m)}l(Os,"writeSync");function Ns(s,e,t,i,o){let c=Y(s),a=t;return typeof t=="object"&&({offset:a,length:i,position:o}=t),isNaN(+o)&&(o=c.getPos()),c.readSync(e,a,i,o)}l(Ns,"readSync");function Ps(s,e,t){Y(s).chownSync(e,t)}l(Ps,"fchownSync");function As(s,e){let t=typeof e=="string"?parseInt(e,8):e;Y(s).chmodSync(t)}l(As,"fchmodSync");function Rs(s,e,t){Y(s).utimesSync(st(e),st(t))}l(Rs,"futimesSync");function Ds(s){return G("rmdirSync",!0,s,I)}l(Ds,"rmdirSync");function Ls(s,e){G("mkdirSync",!0,s,ct(e,511),I)}l(Ls,"mkdirSync");function Us(s){s=q(s);let e=G("readdirSync",!0,s,I),t=[...gt.keys()];for(let i of t)if(i.startsWith(s)){let o=i.slice(s.length);if(o.includes("/")||o.length==0)continue;e.push(o)}return e}l(Us,"readdirSync");function Ms(s,e){return e=q(e),G("linkSync",!1,s,e,I)}l(Ms,"linkSync");function zs(s,e,t){if(!["file","dir","junction"].includes(t))throw new h(22,"Invalid type: "+t);return e=q(e),G("symlinkSync",!1,s,e,t,I)}l(zs,"symlinkSync");function Vs(s){return G("readlinkSync",!1,s,I)}l(Vs,"readlinkSync");function Ws(s,e,t){G("chownSync",!0,s,e,t,I)}l(Ws,"chownSync");function $s(s,e,t){G("chownSync",!1,s,e,t,I)}l($s,"lchownSync");function Ks(s,e){let t=ct(e,-1);if(t<0)throw new h(22,"Invalid mode.");G("chmodSync",!0,s,t,I)}l(Ks,"chmodSync");function js(s,e){let t=ct(e,-1);if(t<1)throw new h(22,"Invalid mode.");G("chmodSync",!1,s,t,I)}l(js,"lchmodSync");function Ys(s,e,t){G("utimesSync",!0,s,st(e),st(t),I)}l(Ys,"utimesSync");function Xs(s,e,t){G("utimesSync",!1,s,st(e),st(t),I)}l(Xs,"lutimesSync");function wi(s,e={}){s=q(s);let{fs:t,path:i,mountPoint:o}=mt(s);try{if(!t.statSync(i,I).isSymbolicLink())return s;let a=q(o+t.readlinkSync(i,I));return wi(a)}catch(c){throw Rt(c,{[i]:s})}}l(wi,"realpathSync");function qs(s,e=384){return G("accessSync",!0,s,e,I)}l(qs,"accessSync");var Js=Si,Be=Js;var Te=class extends at{constructor(e,t,i,o,c){super(e,t,i,o,c)}syncSync(){this.isDirty()&&(this._fs._syncSync(this),this.resetDirty())}closeSync(){this.syncSync()}};l(Te,"MirrorFile");var ae=class extends Nt{constructor({sync:t,async:i}){super();this._queue=[];this._queueRunning=!1;this._isInitialized=!1;this._initializeCallbacks=[];this._sync=t,this._async=i,this._ready=this._initialize()}static isAvailable(){return!0}get metadata(){return wt(pt({},super.metadata),{name:ae.Name,synchronous:!0,supportsProperties:this._sync.metadata.supportsProperties&&this._async.metadata.supportsProperties})}_syncSync(t){let i=t.getStats();this._sync.writeFileSync(t.getPath(),t.getBuffer(),null,O.getFileFlag("w"),i.mode,i.getCred(0,0)),this.enqueueOp({apiMethod:"writeFile",arguments:[t.getPath(),t.getBuffer(),null,t.getFlag(),i.mode,i.getCred(0,0)]})}renameSync(t,i,o){this._sync.renameSync(t,i,o),this.enqueueOp({apiMethod:"rename",arguments:[t,i,o]})}statSync(t,i){return this._sync.statSync(t,i)}openSync(t,i,o,c){return this._sync.openSync(t,i,o,c).closeSync(),new Te(this,t,i,this._sync.statSync(t,c),this._sync.readFileSync(t,null,O.getFileFlag("r"),c))}unlinkSync(t,i){this._sync.unlinkSync(t,i),this.enqueueOp({apiMethod:"unlink",arguments:[t,i]})}rmdirSync(t,i){this._sync.rmdirSync(t,i),this.enqueueOp({apiMethod:"rmdir",arguments:[t,i]})}mkdirSync(t,i,o){this._sync.mkdirSync(t,i,o),this.enqueueOp({apiMethod:"mkdir",arguments:[t,i,o]})}readdirSync(t,i){return this._sync.readdirSync(t,i)}existsSync(t,i){return this._sync.existsSync(t,i)}chmodSync(t,i,o){this._sync.chmodSync(t,i,o),this.enqueueOp({apiMethod:"chmod",arguments:[t,i,o]})}chownSync(t,i,o,c){this._sync.chownSync(t,i,o,c),this.enqueueOp({apiMethod:"chown",arguments:[t,i,o,c]})}utimesSync(t,i,o,c){this._sync.utimesSync(t,i,o,c),this.enqueueOp({apiMethod:"utimes",arguments:[t,i,o,c]})}_initialize(){return g(this,null,function*(){if(!this._isInitialized){let t=l((c,a)=>g(this,null,function*(){if(c!=="/"){let m=yield this._async.stat(c,K.Root);this._sync.mkdirSync(c,a,m.getCred())}let d=yield this._async.readdir(c,K.Root);for(let m of d)yield o(St(c,m))}),"copyDirectory"),i=l((c,a)=>g(this,null,function*(){let d=yield this._async.readFile(c,null,O.getFileFlag("r"),K.Root);this._sync.writeFileSync(c,d,null,O.getFileFlag("w"),a,K.Root)}),"copyFile"),o=l(c=>g(this,null,function*(){let a=yield this._async.stat(c,K.Root);a.isDirectory()?yield t(c,a.mode):yield i(c,a.mode)}),"copyItem");try{yield t("/",0),this._isInitialized=!0}catch(c){throw this._isInitialized=!1,c}}return this})}enqueueOp(t){if(this._queue.push(t),!this._queueRunning){this._queueRunning=!0;let i=l(o=>{if(o)throw new Error(`WARNING: File system has desynchronized. Received following error: ${o}
|
|
4
|
+
$`);if(this._queue.length>0){let c=this._queue.shift();c.arguments.push(i),this._async[c.apiMethod].apply(this._async,c.arguments)}else this._queueRunning=!1},"doNextOp");i()}}},vt=ae;l(vt,"AsyncMirror"),vt.Name="AsyncMirror",vt.Create=Pt.bind(ae),vt.Options={sync:{type:"object",description:"The synchronous file system to mirror the asynchronous file system to.",validator:t=>g(ae,null,function*(){if(!(t!=null&&t.metadata.synchronous))throw new h(22,"'sync' option must be a file system that supports synchronous operations")})},async:{type:"object",description:"The asynchronous file system to mirror."}};var Ei=class extends dt{constructor({folder:t,wrapped:i}){super();this._folder=t,this._wrapped=i,this._ready=this._initialize()}static isAvailable(){return!0}get metadata(){return wt(pt(pt({},super.metadata),this._wrapped.metadata),{supportsLinks:!1})}_initialize(){return g(this,null,function*(){if(!(yield this._wrapped.exists(this._folder,K.Root))&&this._wrapped.metadata.readonly)throw h.ENOENT(this._folder);return yield this._wrapped.mkdir(this._folder,511,K.Root),this})}},yt=Ei;l(yt,"FolderAdapter"),yt.Name="FolderAdapter",yt.Create=Pt.bind(Ei),yt.Options={folder:{type:"string",description:"The folder to use as the root directory"},wrapped:{type:"object",description:"The file system to wrap"}};function er(s,e){if(e!==null&&typeof e=="object"){let t=e,i=t.path;i&&(i="/"+Ki(s,i),t.message=t.message.replace(t.path,i),t.path=i)}return e}l(er,"translateError");function Gs(s,e){return typeof e=="function"?function(t){arguments.length>0&&(arguments[0]=er(s,t)),e.apply(null,arguments)}:e}l(Gs,"wrapCallback");function ir(s,e,t){return s.slice(s.length-4)!=="Sync"?function(){return arguments.length>0&&(e&&(arguments[0]=St(this._folder,arguments[0])),t&&(arguments[1]=St(this._folder,arguments[1])),arguments[arguments.length-1]=Gs(this._folder,arguments[arguments.length-1])),this._wrapped[s].apply(this._wrapped,arguments)}:function(){try{return e&&(arguments[0]=St(this._folder,arguments[0])),t&&(arguments[1]=St(this._folder,arguments[1])),this._wrapped[s].apply(this._wrapped,arguments)}catch(i){throw er(this._folder,i)}}}l(ir,"wrapFunction");["diskSpace","stat","statSync","open","openSync","unlink","unlinkSync","rmdir","rmdirSync","mkdir","mkdirSync","readdir","readdirSync","exists","existsSync","realpath","realpathSync","truncate","truncateSync","readFile","readFileSync","writeFile","writeFileSync","appendFile","appendFileSync","chmod","chmodSync","chown","chownSync","utimes","utimesSync","readlink","readlinkSync"].forEach(s=>{yt.prototype[s]=ir(s,!0,!1)});["rename","renameSync","link","linkSync","symlink","symlinkSync"].forEach(s=>{yt.prototype[s]=ir(s,!0,!0)});var Gt=class{constructor(){this._locks=new Map}lock(e){return new Promise(t=>{this._locks.has(e)?this._locks.get(e).push(t):this._locks.set(e,[])})}unlock(e){if(!this._locks.has(e))throw new Error("unlock of a non-locked mutex");let t=this._locks.get(e).shift();if(t){setTimeout(t,0);return}this._locks.delete(e)}tryLock(e){return this._locks.has(e)?!1:(this._locks.set(e,[]),!0)}isLocked(e){return this._locks.has(e)}};l(Gt,"Mutex");var Ht=class{constructor(e){this._ready=Promise.resolve(this);this._fs=e,this._mu=new Gt}whenReady(){return this._ready}get metadata(){return wt(pt({},this._fs.metadata),{name:"LockedFS<"+this._fs.metadata.name+">"})}get fs(){return this._fs}rename(e,t,i){return g(this,null,function*(){yield this._mu.lock(e),yield this._fs.rename(e,t,i),this._mu.unlock(e)})}renameSync(e,t,i){if(this._mu.isLocked(e))throw new Error("invalid sync call");return this._fs.renameSync(e,t,i)}stat(e,t){return g(this,null,function*(){yield this._mu.lock(e);let i=yield this._fs.stat(e,t);return this._mu.unlock(e),i})}statSync(e,t){if(this._mu.isLocked(e))throw new Error("invalid sync call");return this._fs.statSync(e,t)}access(e,t,i){return g(this,null,function*(){yield this._mu.lock(e),yield this._fs.access(e,t,i),this._mu.unlock(e)})}accessSync(e,t,i){if(this._mu.isLocked(e))throw new Error("invalid sync call");return this._fs.accessSync(e,t,i)}open(e,t,i,o){return g(this,null,function*(){yield this._mu.lock(e);let c=yield this._fs.open(e,t,i,o);return this._mu.unlock(e),c})}openSync(e,t,i,o){if(this._mu.isLocked(e))throw new Error("invalid sync call");return this._fs.openSync(e,t,i,o)}unlink(e,t){return g(this,null,function*(){yield this._mu.lock(e),yield this._fs.unlink(e,t),this._mu.unlock(e)})}unlinkSync(e,t){if(this._mu.isLocked(e))throw new Error("invalid sync call");return this._fs.unlinkSync(e,t)}rmdir(e,t){return g(this,null,function*(){yield this._mu.lock(e),yield this._fs.rmdir(e,t),this._mu.unlock(e)})}rmdirSync(e,t){if(this._mu.isLocked(e))throw new Error("invalid sync call");return this._fs.rmdirSync(e,t)}mkdir(e,t,i){return g(this,null,function*(){yield this._mu.lock(e),yield this._fs.mkdir(e,t,i),this._mu.unlock(e)})}mkdirSync(e,t,i){if(this._mu.isLocked(e))throw new Error("invalid sync call");return this._fs.mkdirSync(e,t,i)}readdir(e,t){return g(this,null,function*(){yield this._mu.lock(e);let i=yield this._fs.readdir(e,t);return this._mu.unlock(e),i})}readdirSync(e,t){if(this._mu.isLocked(e))throw new Error("invalid sync call");return this._fs.readdirSync(e,t)}exists(e,t){return g(this,null,function*(){yield this._mu.lock(e);let i=yield this._fs.exists(e,t);return this._mu.unlock(e),i})}existsSync(e,t){if(this._mu.isLocked(e))throw new Error("invalid sync call");return this._fs.existsSync(e,t)}realpath(e,t){return g(this,null,function*(){yield this._mu.lock(e);let i=yield this._fs.realpath(e,t);return this._mu.unlock(e),i})}realpathSync(e,t){if(this._mu.isLocked(e))throw new Error("invalid sync call");return this._fs.realpathSync(e,t)}truncate(e,t,i){return g(this,null,function*(){yield this._mu.lock(e),yield this._fs.truncate(e,t,i),this._mu.unlock(e)})}truncateSync(e,t,i){if(this._mu.isLocked(e))throw new Error("invalid sync call");return this._fs.truncateSync(e,t,i)}readFile(e,t,i,o){return g(this,null,function*(){yield this._mu.lock(e);let c=yield this._fs.readFile(e,t,i,o);return this._mu.unlock(e),c})}readFileSync(e,t,i,o){if(this._mu.isLocked(e))throw new Error("invalid sync call");return this._fs.readFileSync(e,t,i,o)}writeFile(e,t,i,o,c,a){return g(this,null,function*(){yield this._mu.lock(e),yield this._fs.writeFile(e,t,i,o,c,a),this._mu.unlock(e)})}writeFileSync(e,t,i,o,c,a){if(this._mu.isLocked(e))throw new Error("invalid sync call");return this._fs.writeFileSync(e,t,i,o,c,a)}appendFile(e,t,i,o,c,a){return g(this,null,function*(){yield this._mu.lock(e),yield this._fs.appendFile(e,t,i,o,c,a),this._mu.unlock(e)})}appendFileSync(e,t,i,o,c,a){if(this._mu.isLocked(e))throw new Error("invalid sync call");return this._fs.appendFileSync(e,t,i,o,c,a)}chmod(e,t,i){return g(this,null,function*(){yield this._mu.lock(e),yield this._fs.chmod(e,t,i),this._mu.unlock(e)})}chmodSync(e,t,i){if(this._mu.isLocked(e))throw new Error("invalid sync call");return this._fs.chmodSync(e,t,i)}chown(e,t,i,o){return g(this,null,function*(){yield this._mu.lock(e),yield this._fs.chown(e,t,i,o),this._mu.unlock(e)})}chownSync(e,t,i,o){if(this._mu.isLocked(e))throw new Error("invalid sync call");return this._fs.chownSync(e,t,i,o)}utimes(e,t,i,o){return g(this,null,function*(){yield this._mu.lock(e),yield this._fs.utimes(e,t,i,o),this._mu.unlock(e)})}utimesSync(e,t,i,o){if(this._mu.isLocked(e))throw new Error("invalid sync call");return this._fs.utimesSync(e,t,i,o)}link(e,t,i){return g(this,null,function*(){yield this._mu.lock(e),yield this._fs.link(e,t,i),this._mu.unlock(e)})}linkSync(e,t,i){if(this._mu.isLocked(e))throw new Error("invalid sync call");return this._fs.linkSync(e,t,i)}symlink(e,t,i,o){return g(this,null,function*(){yield this._mu.lock(e),yield this._fs.symlink(e,t,i,o),this._mu.unlock(e)})}symlinkSync(e,t,i,o){if(this._mu.isLocked(e))throw new Error("invalid sync call");return this._fs.symlinkSync(e,t,i,o)}readlink(e,t){return g(this,null,function*(){yield this._mu.lock(e);let i=yield this._fs.readlink(e,t);return this._mu.unlock(e),i})}readlinkSync(e,t){if(this._mu.isLocked(e))throw new Error("invalid sync call");return this._fs.readlinkSync(e,t)}};l(Ht,"LockedFS");var Ct="/.deletedFiles.log";function rr(s){return 146|s}l(rr,"makeModeWritable");function lt(s){return O.getFileFlag(s)}l(lt,"getFlag");var ce=class extends at{constructor(e,t,i,o,c){super(e,t,i,o,c)}sync(){return g(this,null,function*(){this.isDirty()&&(yield this._fs._syncAsync(this),this.resetDirty())})}syncSync(){this.isDirty()&&(this._fs._syncSync(this),this.resetDirty())}close(){return g(this,null,function*(){yield this.sync()})}closeSync(){this.syncSync()}};l(ce,"OverlayFile");var le=class extends dt{constructor({writable:t,readable:i}){super();this._isInitialized=!1;this._deletedFiles={};this._deleteLog="";this._deleteLogUpdatePending=!1;this._deleteLogUpdateNeeded=!1;this._deleteLogError=null;if(this._writable=t,this._readable=i,this._writable.metadata.readonly)throw new h(22,"Writable file system must be writable.")}static isAvailable(){return!0}get metadata(){return wt(pt({},super.metadata),{name:Ft.Name,synchronous:this._readable.metadata.synchronous&&this._writable.metadata.synchronous,supportsProperties:this._readable.metadata.supportsProperties&&this._writable.metadata.supportsProperties})}getOverlayedFileSystems(){return{readable:this._readable,writable:this._writable}}_syncAsync(t){return g(this,null,function*(){let i=t.getStats();return yield this.createParentDirectoriesAsync(t.getPath(),i.getCred(0,0)),this._writable.writeFile(t.getPath(),t.getBuffer(),null,lt("w"),i.mode,i.getCred(0,0))})}_syncSync(t){let i=t.getStats();this.createParentDirectories(t.getPath(),i.getCred(0,0)),this._writable.writeFileSync(t.getPath(),t.getBuffer(),null,lt("w"),i.mode,i.getCred(0,0))}_initialize(){return g(this,null,function*(){if(!this._isInitialized){try{let t=yield this._writable.readFile(Ct,"utf8",lt("r"),K.Root);this._deleteLog=t}catch(t){if(t.errno!==2)throw t}this._isInitialized=!0,this._reparseDeletionLog()}})}getDeletionLog(){return this._deleteLog}restoreDeletionLog(t,i){this._deleteLog=t,this._reparseDeletionLog(),this.updateLog("",i)}rename(t,i,o){return g(this,null,function*(){if(this.checkInitialized(),this.checkPath(t),this.checkPath(i),t===Ct||i===Ct)throw h.EPERM("Cannot rename deletion log.");let c=yield this.stat(t,o);if(c.isDirectory()){if(t===i)return;let a=511;if(yield this.exists(i,o)){let d=yield this.stat(i,o);if(a=d.mode,d.isDirectory()){if((yield this.readdir(i,o)).length>0)throw h.ENOTEMPTY(i)}else throw h.ENOTDIR(i)}if((yield this._writable.exists(t,o))?yield this._writable.rename(t,i,o):(yield this._writable.exists(i,o))||(yield this._writable.mkdir(i,a,o)),yield this._readable.exists(t,o))for(let d of yield this._readable.readdir(t,o))yield this.rename(Et(t,d),Et(i,d),o)}else{if((yield this.exists(i,o))&&(yield this.stat(i,o)).isDirectory())throw h.EISDIR(i);yield this.writeFile(i,yield this.readFile(t,null,lt("r"),o),null,lt("w"),c.mode,o)}t!==i&&(yield this.exists(t,o))&&(yield this.unlink(t,o))})}renameSync(t,i,o){if(this.checkInitialized(),this.checkPath(t),this.checkPath(i),t===Ct||i===Ct)throw h.EPERM("Cannot rename deletion log.");let c=this.statSync(t,o);if(c.isDirectory()){if(t===i)return;let a=511;if(this.existsSync(i,o)){let d=this.statSync(i,o);if(a=d.mode,d.isDirectory()){if(this.readdirSync(i,o).length>0)throw h.ENOTEMPTY(i)}else throw h.ENOTDIR(i)}this._writable.existsSync(t,o)?this._writable.renameSync(t,i,o):this._writable.existsSync(i,o)||this._writable.mkdirSync(i,a,o),this._readable.existsSync(t,o)&&this._readable.readdirSync(t,o).forEach(d=>{this.renameSync(Et(t,d),Et(i,d),o)})}else{if(this.existsSync(i,o)&&this.statSync(i,o).isDirectory())throw h.EISDIR(i);this.writeFileSync(i,this.readFileSync(t,null,lt("r"),o),null,lt("w"),c.mode,o)}t!==i&&this.existsSync(t,o)&&this.unlinkSync(t,o)}stat(t,i){return g(this,null,function*(){this.checkInitialized();try{return this._writable.stat(t,i)}catch(o){if(this._deletedFiles[t])throw h.ENOENT(t);let c=X.clone(yield this._readable.stat(t,i));return c.mode=rr(c.mode),c}})}statSync(t,i){this.checkInitialized();try{return this._writable.statSync(t,i)}catch(o){if(this._deletedFiles[t])throw h.ENOENT(t);let c=X.clone(this._readable.statSync(t,i));return c.mode=rr(c.mode),c}}open(t,i,o,c){return g(this,null,function*(){if(this.checkInitialized(),this.checkPath(t),t===Ct)throw h.EPERM("Cannot open deletion log.");if(yield this.exists(t,c))switch(i.pathExistsAction()){case 2:return yield this.createParentDirectoriesAsync(t,c),this._writable.open(t,i,o,c);case 0:if(yield this._writable.exists(t,c))return this._writable.open(t,i,o,c);{let a=yield this._readable.readFile(t,null,lt("r"),c),d=X.clone(yield this._readable.stat(t,c));return d.mode=o,new ce(this,t,i,d,a)}default:throw h.EEXIST(t)}else switch(i.pathNotExistsAction()){case 3:return yield this.createParentDirectoriesAsync(t,c),this._writable.open(t,i,o,c);default:throw h.ENOENT(t)}})}openSync(t,i,o,c){if(this.checkInitialized(),this.checkPath(t),t===Ct)throw h.EPERM("Cannot open deletion log.");if(this.existsSync(t,c))switch(i.pathExistsAction()){case 2:return this.createParentDirectories(t,c),this._writable.openSync(t,i,o,c);case 0:if(this._writable.existsSync(t,c))return this._writable.openSync(t,i,o,c);{let a=this._readable.readFileSync(t,null,lt("r"),c),d=X.clone(this._readable.statSync(t,c));return d.mode=o,new ce(this,t,i,d,a)}default:throw h.EEXIST(t)}else switch(i.pathNotExistsAction()){case 3:return this.createParentDirectories(t,c),this._writable.openSync(t,i,o,c);default:throw h.ENOENT(t)}}unlink(t,i){return g(this,null,function*(){if(this.checkInitialized(),this.checkPath(t),yield this.exists(t,i))(yield this._writable.exists(t,i))&&(yield this._writable.unlink(t,i)),(yield this.exists(t,i))&&this.deletePath(t,i);else throw h.ENOENT(t)})}unlinkSync(t,i){if(this.checkInitialized(),this.checkPath(t),this.existsSync(t,i))this._writable.existsSync(t,i)&&this._writable.unlinkSync(t,i),this.existsSync(t,i)&&this.deletePath(t,i);else throw h.ENOENT(t)}rmdir(t,i){return g(this,null,function*(){if(this.checkInitialized(),yield this.exists(t,i)){if((yield this._writable.exists(t,i))&&(yield this._writable.rmdir(t,i)),yield this.exists(t,i)){if((yield this.readdir(t,i)).length>0)throw h.ENOTEMPTY(t);this.deletePath(t,i)}}else throw h.ENOENT(t)})}rmdirSync(t,i){if(this.checkInitialized(),this.existsSync(t,i)){if(this._writable.existsSync(t,i)&&this._writable.rmdirSync(t,i),this.existsSync(t,i)){if(this.readdirSync(t,i).length>0)throw h.ENOTEMPTY(t);this.deletePath(t,i)}}else throw h.ENOENT(t)}mkdir(t,i,o){return g(this,null,function*(){if(this.checkInitialized(),yield this.exists(t,o))throw h.EEXIST(t);yield this.createParentDirectoriesAsync(t,o),yield this._writable.mkdir(t,i,o)})}mkdirSync(t,i,o){if(this.checkInitialized(),this.existsSync(t,o))throw h.EEXIST(t);this.createParentDirectories(t,o),this._writable.mkdirSync(t,i,o)}readdir(t,i){return g(this,null,function*(){if(this.checkInitialized(),!(yield this.stat(t,i)).isDirectory())throw h.ENOTDIR(t);let c=[];try{c=c.concat(yield this._writable.readdir(t,i))}catch(d){}try{c=c.concat((yield this._readable.readdir(t,i)).filter(d=>!this._deletedFiles[`${t}/${d}`]))}catch(d){}let a={};return c.filter(d=>{let m=!a[d];return a[d]=!0,m})})}readdirSync(t,i){if(this.checkInitialized(),!this.statSync(t,i).isDirectory())throw h.ENOTDIR(t);let c=[];try{c=c.concat(this._writable.readdirSync(t,i))}catch(d){}try{c=c.concat(this._readable.readdirSync(t,i).filter(d=>!this._deletedFiles[`${t}/${d}`]))}catch(d){}let a={};return c.filter(d=>{let m=!a[d];return a[d]=!0,m})}exists(t,i){return g(this,null,function*(){return this.checkInitialized(),(yield this._writable.exists(t,i))||(yield this._readable.exists(t,i))&&this._deletedFiles[t]!==!0})}existsSync(t,i){return this.checkInitialized(),this._writable.existsSync(t,i)||this._readable.existsSync(t,i)&&this._deletedFiles[t]!==!0}chmod(t,i,o){return g(this,null,function*(){this.checkInitialized(),yield this.operateOnWritableAsync(t,o),yield this._writable.chmod(t,i,o)})}chmodSync(t,i,o){this.checkInitialized(),this.operateOnWritable(t,o),this._writable.chmodSync(t,i,o)}chown(t,i,o,c){return g(this,null,function*(){this.checkInitialized(),yield this.operateOnWritableAsync(t,c),yield this._writable.chown(t,i,o,c)})}chownSync(t,i,o,c){this.checkInitialized(),this.operateOnWritable(t,c),this._writable.chownSync(t,i,o,c)}utimes(t,i,o,c){return g(this,null,function*(){this.checkInitialized(),yield this.operateOnWritableAsync(t,c),yield this._writable.utimes(t,i,o,c)})}utimesSync(t,i,o,c){this.checkInitialized(),this.operateOnWritable(t,c),this._writable.utimesSync(t,i,o,c)}deletePath(t,i){this._deletedFiles[t]=!0,this.updateLog(`d${t}
|
|
5
5
|
`,i)}updateLog(t,i){this._deleteLog+=t,this._deleteLogUpdatePending?this._deleteLogUpdateNeeded=!0:(this._deleteLogUpdatePending=!0,this._writable.writeFile(Ct,this._deleteLog,"utf8",O.getFileFlag("w"),420,i).then(()=>{this._deleteLogUpdateNeeded&&(this._deleteLogUpdateNeeded=!1,this.updateLog("",i))}).catch(o=>{this._deleteLogError=o}).finally(()=>{this._deleteLogUpdatePending=!1}))}_reparseDeletionLog(){this._deletedFiles={},this._deleteLog.split(`
|
|
6
|
-
`).forEach(t=>{this._deletedFiles[t.slice(1)]=t.slice(0,1)==="d"})}checkInitialized(){if(this._isInitialized){if(this._deleteLogError!==null){let t=this._deleteLogError;throw this._deleteLogError=null,t}}else throw new h(1,"OverlayFS is not initialized. Please initialize OverlayFS using its initialize() method before using it.")}checkPath(t){if(t===Ct)throw h.EPERM(t)}createParentDirectories(t,i){let o=R(t),c=[];for(;!this._writable.existsSync(o,i);)c.push(o),o=R(o);c=c.reverse();for(let a of c)this._writable.mkdirSync(a,this.statSync(a,i).mode,i)}createParentDirectoriesAsync(t,i){return g(this,null,function*(){let o=R(t),c=[];for(;!(yield this._writable.exists(o,i));)c.push(o),o=R(o);c=c.reverse();for(let a of c){let d=yield this.stat(a,i);yield this._writable.mkdir(a,d.mode,i)}})}operateOnWritable(t,i){if(!this.existsSync(t,i))throw h.ENOENT(t);this._writable.existsSync(t,i)||this.copyToWritable(t,i)}operateOnWritableAsync(t,i){return g(this,null,function*(){if(!(yield this.exists(t,i)))throw h.ENOENT(t);if(!(yield this._writable.exists(t,i)))return this.copyToWritableAsync(t,i)})}copyToWritable(t,i){let o=this.statSync(t,i);o.isDirectory()?this._writable.mkdirSync(t,o.mode,i):this.writeFileSync(t,this._readable.readFileSync(t,null,lt("r"),i),null,lt("w"),o.mode,i)}copyToWritableAsync(t,i){return g(this,null,function*(){let o=yield this.stat(t,i);o.isDirectory()?yield this._writable.mkdir(t,o.mode,i):yield this.writeFile(t,yield this._readable.readFile(t,null,lt("r"),i),null,lt("w"),o.mode,i)})}};l(le,"UnlockedOverlayFS");var Oe=class extends Ht{static isAvailable(){return le.isAvailable()}constructor(e){super(new le(e)),this._ready=this._initialize()}getOverlayedFileSystems(){return super.fs.getOverlayedFileSystems()}getDeletionLog(){return super.fs.getDeletionLog()}resDeletionLog(){return super.fs.getDeletionLog()}unwrap(){return super.fs}_initialize(){return g(this,null,function*(){return yield Ui(Oe.prototype,this,"fs")._initialize(),this})}},Ft=Oe;l(Ft,"OverlayFS"),Ft.Name="OverlayFS",Ft.Create=Pt.bind(Oe),Ft.Options={writable:{type:"object",description:"The file system to write modified files to."},readable:{type:"object",description:"The file system that initially populates this file system."}};var Ne={};function nr(...s){for(let e of s)Ne[e.Name]=e}l(nr,"registerBackend");nr(vt,yt,ht,Ft);var ue=class{constructor(e,t){this.key=e;this.value=t;this.prev=null;this.next=null}};l(ue,"LRUNode");var Pe=class{constructor(e){this.limit=e;this.size=0;this.map={};this.head=null;this.tail=null}set(e,t){let i=new ue(e,t);this.map[e]?(this.map[e].value=i.value,this.remove(i.key)):this.size>=this.limit&&(delete this.map[this.tail.key],this.size--,this.tail=this.tail.prev,this.tail.next=null),this.setHead(i)}get(e){if(this.map[e]){let t=this.map[e].value,i=new ue(e,t);return this.remove(e),this.setHead(i),t}else return null}remove(e){let t=this.map[e];t&&(t.prev!==null?t.prev.next=t.next:this.head=t.next,t.next!==null?t.next.prev=t.prev:this.tail=t.prev,delete this.map[e],this.size--)}removeAll(){this.size=0,this.map={},this.head=null,this.tail=null}setHead(e){e.next=this.head,e.prev=null,this.head!==null&&(this.head.prev=e),this.head=e,this.tail===null&&(this.tail=e),this.size++,this.map[e.key]=e}};l(Pe,"LRUCache");var Zt=class extends at{constructor(e,t,i,o,c){super(e,t,i,o,c)}sync(){return g(this,null,function*(){this.isDirty()&&(yield this._fs._sync(this.getPath(),this.getBuffer(),this.getStats()),this.resetDirty())})}close(){return g(this,null,function*(){this.sync()})}};l(Zt,"AsyncKeyValueFile");var Ae=class extends dt{constructor(t){super();this._cache=null;t>0&&(this._cache=new Pe(t))}static isAvailable(){return!0}init(t){return g(this,null,function*(){this.store=t,yield this.makeRootDirectory()})}getName(){return this.store.name()}isReadOnly(){return!1}supportsSymlinks(){return!1}supportsProps(){return!0}supportsSynch(){return!1}empty(){return g(this,null,function*(){this._cache&&this._cache.removeAll(),yield this.store.clear(),yield this.makeRootDirectory()})}access(t,i,o){return g(this,null,function*(){let c=this.store.beginTransaction("readonly"),a=yield this.findINode(c,t);if(!a)throw h.ENOENT(t);if(!a.toStats().hasAccess(i,o))throw h.EACCES(t)})}rename(t,i,o){return g(this,null,function*(){let c=this._cache;this._cache&&(this._cache=null,c.removeAll());try{let a=this.store.beginTransaction("readwrite"),d=R(t),m=it(t),y=R(i),S=it(i),w=yield this.findINode(a,d),v=yield this.getDirListing(a,d,w);if(!w.toStats().hasAccess(2,o))throw h.EACCES(t);if(!v[m])throw h.ENOENT(t);let x=v[m];if(delete v[m],(y+"/").indexOf(t+"/")===0)throw new h(16,d);let C,F;if(y===d?(C=w,F=v):(C=yield this.findINode(a,y),F=yield this.getDirListing(a,y,C)),F[S]){let _=yield this.getINode(a,i,F[S]);if(_.isFile())try{yield a.del(_.id),yield a.del(F[S])}catch(N){throw yield a.abort(),N}else throw h.EPERM(i)}F[S]=x;try{yield a.put(w.id,k.from(JSON.stringify(v)),!0),yield a.put(C.id,k.from(JSON.stringify(F)),!0)}catch(_){throw yield a.abort(),_}yield a.commit()}finally{c&&(this._cache=c)}})}stat(t,i){return g(this,null,function*(){let o=this.store.beginTransaction("readonly"),a=(yield this.findINode(o,t)).toStats();if(!a.hasAccess(4,i))throw h.EACCES(t);return a})}createFile(t,i,o,c){return g(this,null,function*(){let a=this.store.beginTransaction("readwrite"),d=k.alloc(0),m=yield this.commitNewFile(a,t,j.FILE,o,c,d);return new Zt(this,t,i,m.toStats(),d)})}openFile(t,i,o){return g(this,null,function*(){let c=this.store.beginTransaction("readonly"),a=yield this.findINode(c,t),d=yield c.get(a.id);if(!a.toStats().hasAccess(i.getMode(),o))throw h.EACCES(t);if(d===void 0)throw h.ENOENT(t);return new Zt(this,t,i,a.toStats(),d)})}unlink(t,i){return g(this,null,function*(){return this.removeEntry(t,!1,i)})}rmdir(t,i){return g(this,null,function*(){if((yield this.readdir(t,i)).length>0)throw h.ENOTEMPTY(t);yield this.removeEntry(t,!0,i)})}mkdir(t,i,o){return g(this,null,function*(){let c=this.store.beginTransaction("readwrite"),a=k.from("{}");yield this.commitNewFile(c,t,j.DIRECTORY,i,o,a)})}readdir(t,i){return g(this,null,function*(){let o=this.store.beginTransaction("readonly"),c=yield this.findINode(o,t);if(!c.toStats().hasAccess(4,i))throw h.EACCES(t);return Object.keys(yield this.getDirListing(o,t,c))})}chmod(t,i,o){return g(this,null,function*(){yield(yield this.openFile(t,O.getFileFlag("r+"),o)).chmod(i)})}chown(t,i,o,c){return g(this,null,function*(){yield(yield this.openFile(t,O.getFileFlag("r+"),c)).chown(i,o)})}_sync(t,i,o){return g(this,null,function*(){let c=this.store.beginTransaction("readwrite"),a=yield this._findINode(c,R(t),it(t)),d=yield this.getINode(c,t,a),m=d.update(o);try{yield c.put(d.id,i,!0),m&&(yield c.put(a,d.toBuffer(),!0))}catch(y){throw yield c.abort(),y}yield c.commit()})}makeRootDirectory(){return g(this,null,function*(){let t=this.store.beginTransaction("readwrite");if((yield t.get(ft))===void 0){let i=new Date().getTime(),o=new nt(zt(),4096,511|j.DIRECTORY,i,i,i,0,0);yield t.put(o.id,ne(),!1),yield t.put(ft,o.toBuffer(),!1),yield t.commit()}})}_findINode(a,d,m){return g(this,arguments,function*(t,i,o,c=new Set){let y=It.join(i,o);if(c.has(y))throw new h(5,"Infinite loop detected while finding inode",y);if(c.add(y),this._cache){let S=this._cache.get(y);if(S)return S}if(i==="/"){if(o==="")return this._cache&&this._cache.set(y,ft),ft;{let S=yield this.getINode(t,i,ft),w=yield this.getDirListing(t,i,S);if(w[o]){let v=w[o];return this._cache&&this._cache.set(y,v),v}else throw h.ENOENT(Et(i,o))}}else{let S=yield this.findINode(t,i,c),w=yield this.getDirListing(t,i,S);if(w[o]){let v=w[o];return this._cache&&this._cache.set(y,v),v}else throw h.ENOENT(Et(i,o))}})}findINode(c,a){return g(this,arguments,function*(t,i,o=new Set){let d=yield this._findINode(t,R(i),it(i),o);return this.getINode(t,i,d)})}getINode(t,i,o){return g(this,null,function*(){let c=yield t.get(o);if(!c)throw h.ENOENT(i);return nt.fromBuffer(c)})}getDirListing(t,i,o){return g(this,null,function*(){if(!o.isDirectory())throw h.ENOTDIR(i);let c=yield t.get(o.id);try{return JSON.parse(c.toString())}catch(a){throw h.ENOENT(i)}})}addNewNode(t,i){return g(this,null,function*(){let o=0,c=l(()=>g(this,null,function*(){if(++o===5)throw new h(5,"Unable to commit data to key-value store.");{let a=zt();return(yield t.put(a,i,!1))?a:c()}}),"reroll");return c()})}commitNewFile(t,i,o,c,a,d){return g(this,null,function*(){let m=R(i),y=it(i),S=yield this.findINode(t,m),w=yield this.getDirListing(t,m,S),v=new Date().getTime();if(!S.toStats().hasAccess(2,a))throw h.EACCES(i);if(i==="/")throw h.EEXIST(i);if(w[y])throw yield t.abort(),h.EEXIST(i);try{let x=yield this.addNewNode(t,d),C=new nt(x,d.length,c|o,v,v,v,a.uid,a.gid),F=yield this.addNewNode(t,C.toBuffer());return w[y]=F,yield t.put(S.id,k.from(JSON.stringify(w)),!0),yield t.commit(),C}catch(x){throw t.abort(),x}})}removeEntry(t,i,o){return g(this,null,function*(){this._cache&&this._cache.remove(t);let c=this.store.beginTransaction("readwrite"),a=R(t),d=yield this.findINode(c,a),m=yield this.getDirListing(c,a,d),y=it(t);if(!m[y])throw h.ENOENT(t);let S=m[y],w=yield this.getINode(c,t,S);if(!w.toStats().hasAccess(2,o))throw h.EACCES(t);if(delete m[y],!i&&w.isDirectory())throw h.EISDIR(t);if(i&&!w.isDirectory())throw h.ENOTDIR(t);try{yield c.del(w.id),yield c.del(S),yield c.put(d.id,k.from(JSON.stringify(m)),!0)}catch(v){throw yield c.abort(),v}yield c.commit()})}};l(Ae,"AsyncKeyValueFileSystem");var Qt=class{static fromListing(e){let t=new Qt,i=new _t;t._index["/"]=i;let o=[["",e,i]];for(;o.length>0;){let c,a=o.pop(),d=a[0],m=a[1],y=a[2];for(let S in m)if(Object.prototype.hasOwnProperty.call(m,S)){let w=m[S],v=`${d}/${S}`;w?(t._index[v]=c=new _t,o.push([v,w,c])):c=new de(new X(j.FILE,-1,365)),y&&(y._ls[S]=c)}}return t}constructor(){this._index={},this.addPath("/",new _t)}fileIterator(e){for(let t in this._index)if(Object.prototype.hasOwnProperty.call(this._index,t)){let i=this._index[t],o=i.getListing();for(let c of o){let a=i.getItem(c);sr(a)&&e(a.getData())}}}addPath(e,t){if(!t)throw new Error("Inode must be specified");if(e[0]!=="/")throw new Error("Path must be absolute, got: "+e);if(Object.prototype.hasOwnProperty.call(this._index,e))return this._index[e]===t;let i=this._split_path(e),o=i[0],c=i[1],a=this._index[o];return a===void 0&&e!=="/"&&(a=new _t,!this.addPath(o,a))||e!=="/"&&!a.addItem(c,t)?!1:(Fi(t)&&(this._index[e]=t),!0)}addPathFast(e,t){let i=e.lastIndexOf("/"),o=i===0?"/":e.substring(0,i),c=e.substring(i+1),a=this._index[o];return a===void 0&&(a=new _t,this.addPathFast(o,a)),a.addItem(c,t)?(t.isDir()&&(this._index[e]=t),!0):!1}removePath(e){let t=this._split_path(e),i=t[0],o=t[1],c=this._index[i];if(c===void 0)return null;let a=c.remItem(o);if(a===null)return null;if(Fi(a)){let d=a.getListing();for(let m of d)this.removePath(e+"/"+m);e!=="/"&&delete this._index[e]}return a}ls(e){let t=this._index[e];return t===void 0?null:t.getListing()}getInode(e){let t=this._split_path(e),i=t[0],o=t[1],c=this._index[i];return c===void 0?null:i===e?c:c.getItem(o)}_split_path(e){let t=R(e),i=e.substr(t.length+(t==="/"?0:1));return[t,i]}};l(Qt,"FileIndex");var de=class{constructor(e){this.data=e}isFile(){return!0}isDir(){return!1}getData(){return this.data}setData(e){this.data=e}toStats(){return new X(j.FILE,4096,438)}};l(de,"IndexFileInode");var _t=class{constructor(e=null){this.data=e;this._ls={}}isFile(){return!1}isDir(){return!0}getData(){return this.data}getStats(){return new X(j.DIRECTORY,4096,365)}toStats(){return this.getStats()}getListing(){return Object.keys(this._ls)}getItem(e){let t=this._ls[e];return t||null}addItem(e,t){return e in this._ls?!1:(this._ls[e]=t,!0)}remItem(e){let t=this._ls[e];return t===void 0?null:(delete this._ls[e],t)}};l(_t,"IndexDirInode");function sr(s){return!!s&&s.isFile()}l(sr,"isIndexFileInode");function Fi(s){return!!s&&s.isDir()}l(Fi,"isIndexDirInode");function ar(s,e=0,t=0){return qi(new K(e,t,e,t,e,t)),Be.initialize(s)}l(ar,"initialize");function or(s){return g(this,null,function*(){("fs"in s||s instanceof Ot)&&(s={"/":s});for(let[e,t]of Object.entries(s))typeof t!="number"&&(e=e.toString(),!(t instanceof Ot)&&(typeof t=="string"&&(t={fs:t}),s[e]=yield cr(t)));return ar(s)})}l(or,"_configure");function Qs(s,e){if(typeof e!="function")return or(s);or(s).then(()=>e()).catch(t=>e(t))}l(Qs,"configure");function xi(t){return g(this,arguments,function*({fs:s,options:e={}}){if(!s)throw new h(1,'Missing "fs" property on configuration object.');if(typeof e!="object"||e===null)throw new h(22,'Invalid "options" property on configuration object.');let i=Object.keys(e).filter(c=>c!="fs");for(let c of i){let a=e[c];if(a===null||typeof a!="object"||!("fs"in a))continue;let d=yield xi(a);e[c]=d}let o=Ne[s];if(o)return o.Create(e);throw new h(1,`File system ${s} is not available in ZenFS.`)})}l(xi,"_getFileSystem");function cr(s,e){if(typeof e!="function")return xi(s);xi(s).then(t=>e(null,t)).catch(t=>e(t))}l(cr,"getFileSystem");var to=Be;return Rr(eo);})();
|
|
6
|
+
`).forEach(t=>{this._deletedFiles[t.slice(1)]=t.slice(0,1)==="d"})}checkInitialized(){if(this._isInitialized){if(this._deleteLogError!==null){let t=this._deleteLogError;throw this._deleteLogError=null,t}}else throw new h(1,"OverlayFS is not initialized. Please initialize OverlayFS using its initialize() method before using it.")}checkPath(t){if(t===Ct)throw h.EPERM(t)}createParentDirectories(t,i){let o=R(t),c=[];for(;!this._writable.existsSync(o,i);)c.push(o),o=R(o);c=c.reverse();for(let a of c)this._writable.mkdirSync(a,this.statSync(a,i).mode,i)}createParentDirectoriesAsync(t,i){return g(this,null,function*(){let o=R(t),c=[];for(;!(yield this._writable.exists(o,i));)c.push(o),o=R(o);c=c.reverse();for(let a of c){let d=yield this.stat(a,i);yield this._writable.mkdir(a,d.mode,i)}})}operateOnWritable(t,i){if(!this.existsSync(t,i))throw h.ENOENT(t);this._writable.existsSync(t,i)||this.copyToWritable(t,i)}operateOnWritableAsync(t,i){return g(this,null,function*(){if(!(yield this.exists(t,i)))throw h.ENOENT(t);if(!(yield this._writable.exists(t,i)))return this.copyToWritableAsync(t,i)})}copyToWritable(t,i){let o=this.statSync(t,i);o.isDirectory()?this._writable.mkdirSync(t,o.mode,i):this.writeFileSync(t,this._readable.readFileSync(t,null,lt("r"),i),null,lt("w"),o.mode,i)}copyToWritableAsync(t,i){return g(this,null,function*(){let o=yield this.stat(t,i);o.isDirectory()?yield this._writable.mkdir(t,o.mode,i):yield this.writeFile(t,yield this._readable.readFile(t,null,lt("r"),i),null,lt("w"),o.mode,i)})}};l(le,"UnlockedOverlayFS");var Oe=class extends Ht{static isAvailable(){return le.isAvailable()}constructor(e){super(new le(e)),this._ready=this._initialize()}getOverlayedFileSystems(){return super.fs.getOverlayedFileSystems()}getDeletionLog(){return super.fs.getDeletionLog()}resDeletionLog(){return super.fs.getDeletionLog()}unwrap(){return super.fs}_initialize(){return g(this,null,function*(){return yield Ui(Oe.prototype,this,"fs")._initialize(),this})}},Ft=Oe;l(Ft,"OverlayFS"),Ft.Name="OverlayFS",Ft.Create=Pt.bind(Oe),Ft.Options={writable:{type:"object",description:"The file system to write modified files to."},readable:{type:"object",description:"The file system that initially populates this file system."}};var Ne={};function nr(...s){for(let e of s)Ne[e.Name]=e}l(nr,"registerBackend");nr(vt,yt,ht,Ft);var ue=class{constructor(e,t){this.key=e;this.value=t;this.prev=null;this.next=null}};l(ue,"LRUNode");var Pe=class{constructor(e){this.limit=e;this.size=0;this.map={};this.head=null;this.tail=null}set(e,t){let i=new ue(e,t);this.map[e]?(this.map[e].value=i.value,this.remove(i.key)):this.size>=this.limit&&(delete this.map[this.tail.key],this.size--,this.tail=this.tail.prev,this.tail.next=null),this.setHead(i)}get(e){if(this.map[e]){let t=this.map[e].value,i=new ue(e,t);return this.remove(e),this.setHead(i),t}else return null}remove(e){let t=this.map[e];t&&(t.prev!==null?t.prev.next=t.next:this.head=t.next,t.next!==null?t.next.prev=t.prev:this.tail=t.prev,delete this.map[e],this.size--)}removeAll(){this.size=0,this.map={},this.head=null,this.tail=null}setHead(e){e.next=this.head,e.prev=null,this.head!==null&&(this.head.prev=e),this.head=e,this.tail===null&&(this.tail=e),this.size++,this.map[e.key]=e}};l(Pe,"LRUCache");var Zt=class extends at{constructor(e,t,i,o,c){super(e,t,i,o,c)}sync(){return g(this,null,function*(){this.isDirty()&&(yield this._fs._sync(this.getPath(),this.getBuffer(),this.getStats()),this.resetDirty())})}close(){return g(this,null,function*(){this.sync()})}};l(Zt,"AsyncKeyValueFile");var Ae=class extends dt{constructor(t){super();this._cache=null;t>0&&(this._cache=new Pe(t))}static isAvailable(){return!0}init(t){return g(this,null,function*(){this.store=t,yield this.makeRootDirectory()})}getName(){return this.store.name()}isReadOnly(){return!1}supportsSymlinks(){return!1}supportsProps(){return!0}supportsSynch(){return!1}empty(){return g(this,null,function*(){this._cache&&this._cache.removeAll(),yield this.store.clear(),yield this.makeRootDirectory()})}access(t,i,o){return g(this,null,function*(){let c=this.store.beginTransaction("readonly"),a=yield this.findINode(c,t);if(!a)throw h.ENOENT(t);if(!a.toStats().hasAccess(i,o))throw h.EACCES(t)})}rename(t,i,o){return g(this,null,function*(){let c=this._cache;this._cache&&(this._cache=null,c.removeAll());try{let a=this.store.beginTransaction("readwrite"),d=R(t),m=it(t),y=R(i),S=it(i),w=yield this.findINode(a,d),v=yield this.getDirListing(a,d,w);if(!w.toStats().hasAccess(2,o))throw h.EACCES(t);if(!v[m])throw h.ENOENT(t);let x=v[m];if(delete v[m],(y+"/").indexOf(t+"/")===0)throw new h(16,d);let C,F;if(y===d?(C=w,F=v):(C=yield this.findINode(a,y),F=yield this.getDirListing(a,y,C)),F[S]){let _=yield this.getINode(a,i,F[S]);if(_.isFile())try{yield a.del(_.id),yield a.del(F[S])}catch(N){throw yield a.abort(),N}else throw h.EPERM(i)}F[S]=x;try{yield a.put(w.id,k.from(JSON.stringify(v)),!0),yield a.put(C.id,k.from(JSON.stringify(F)),!0)}catch(_){throw yield a.abort(),_}yield a.commit()}finally{c&&(this._cache=c)}})}stat(t,i){return g(this,null,function*(){let o=this.store.beginTransaction("readonly"),a=(yield this.findINode(o,t)).toStats();if(!a.hasAccess(4,i))throw h.EACCES(t);return a})}createFile(t,i,o,c){return g(this,null,function*(){let a=this.store.beginTransaction("readwrite"),d=k.alloc(0),m=yield this.commitNewFile(a,t,j.FILE,o,c,d);return new Zt(this,t,i,m.toStats(),d)})}openFile(t,i,o){return g(this,null,function*(){let c=this.store.beginTransaction("readonly"),a=yield this.findINode(c,t),d=yield c.get(a.id);if(!a.toStats().hasAccess(i.getMode(),o))throw h.EACCES(t);if(d===void 0)throw h.ENOENT(t);return new Zt(this,t,i,a.toStats(),d)})}unlink(t,i){return g(this,null,function*(){return this.removeEntry(t,!1,i)})}rmdir(t,i){return g(this,null,function*(){if((yield this.readdir(t,i)).length>0)throw h.ENOTEMPTY(t);yield this.removeEntry(t,!0,i)})}mkdir(t,i,o){return g(this,null,function*(){let c=this.store.beginTransaction("readwrite"),a=k.from("{}");yield this.commitNewFile(c,t,j.DIRECTORY,i,o,a)})}readdir(t,i){return g(this,null,function*(){let o=this.store.beginTransaction("readonly"),c=yield this.findINode(o,t);if(!c.toStats().hasAccess(4,i))throw h.EACCES(t);return Object.keys(yield this.getDirListing(o,t,c))})}chmod(t,i,o){return g(this,null,function*(){yield(yield this.openFile(t,O.getFileFlag("r+"),o)).chmod(i)})}chown(t,i,o,c){return g(this,null,function*(){yield(yield this.openFile(t,O.getFileFlag("r+"),c)).chown(i,o)})}_sync(t,i,o){return g(this,null,function*(){let c=this.store.beginTransaction("readwrite"),a=yield this._findINode(c,R(t),it(t)),d=yield this.getINode(c,t,a),m=d.update(o);try{yield c.put(d.id,i,!0),m&&(yield c.put(a,d.toBuffer(),!0))}catch(y){throw yield c.abort(),y}yield c.commit()})}makeRootDirectory(){return g(this,null,function*(){let t=this.store.beginTransaction("readwrite");if((yield t.get(ft))===void 0){let i=new Date().getTime(),o=new nt(zt(),4096,511|j.DIRECTORY,i,i,i,0,0);yield t.put(o.id,ne(),!1),yield t.put(ft,o.toBuffer(),!1),yield t.commit()}})}_findINode(a,d,m){return g(this,arguments,function*(t,i,o,c=new Set){let y=It.join(i,o);if(c.has(y))throw new h(5,"Infinite loop detected while finding inode",y);if(c.add(y),this._cache){let S=this._cache.get(y);if(S)return S}if(i==="/"){if(o==="")return this._cache&&this._cache.set(y,ft),ft;{let S=yield this.getINode(t,i,ft),w=yield this.getDirListing(t,i,S);if(w[o]){let v=w[o];return this._cache&&this._cache.set(y,v),v}else throw h.ENOENT(Et(i,o))}}else{let S=yield this.findINode(t,i,c),w=yield this.getDirListing(t,i,S);if(w[o]){let v=w[o];return this._cache&&this._cache.set(y,v),v}else throw h.ENOENT(Et(i,o))}})}findINode(c,a){return g(this,arguments,function*(t,i,o=new Set){let d=yield this._findINode(t,R(i),it(i),o);return this.getINode(t,i,d)})}getINode(t,i,o){return g(this,null,function*(){let c=yield t.get(o);if(!c)throw h.ENOENT(i);return nt.fromBuffer(c)})}getDirListing(t,i,o){return g(this,null,function*(){if(!o.isDirectory())throw h.ENOTDIR(i);let c=yield t.get(o.id);try{return JSON.parse(c.toString())}catch(a){throw h.ENOENT(i)}})}addNewNode(t,i){return g(this,null,function*(){let o=0,c=l(()=>g(this,null,function*(){if(++o===5)throw new h(5,"Unable to commit data to key-value store.");{let a=zt();return(yield t.put(a,i,!1))?a:c()}}),"reroll");return c()})}commitNewFile(t,i,o,c,a,d){return g(this,null,function*(){let m=R(i),y=it(i),S=yield this.findINode(t,m),w=yield this.getDirListing(t,m,S),v=new Date().getTime();if(!S.toStats().hasAccess(2,a))throw h.EACCES(i);if(i==="/")throw h.EEXIST(i);if(w[y])throw yield t.abort(),h.EEXIST(i);try{let x=yield this.addNewNode(t,d),C=new nt(x,d.length,c|o,v,v,v,a.uid,a.gid),F=yield this.addNewNode(t,C.toBuffer());return w[y]=F,yield t.put(S.id,k.from(JSON.stringify(w)),!0),yield t.commit(),C}catch(x){throw t.abort(),x}})}removeEntry(t,i,o){return g(this,null,function*(){this._cache&&this._cache.remove(t);let c=this.store.beginTransaction("readwrite"),a=R(t),d=yield this.findINode(c,a),m=yield this.getDirListing(c,a,d),y=it(t);if(!m[y])throw h.ENOENT(t);let S=m[y],w=yield this.getINode(c,t,S);if(!w.toStats().hasAccess(2,o))throw h.EACCES(t);if(delete m[y],!i&&w.isDirectory())throw h.EISDIR(t);if(i&&!w.isDirectory())throw h.ENOTDIR(t);try{yield c.del(w.id),yield c.del(S),yield c.put(d.id,k.from(JSON.stringify(m)),!0)}catch(v){throw yield c.abort(),v}yield c.commit()})}};l(Ae,"AsyncKeyValueFileSystem");var Qt=class{static fromListing(e){let t=new Qt,i=new _t;t._index["/"]=i;let o=[["",e,i]];for(;o.length>0;){let c,a=o.pop(),d=a[0],m=a[1],y=a[2];for(let S in m)if(Object.prototype.hasOwnProperty.call(m,S)){let w=m[S],v=`${d}/${S}`;w?(t._index[v]=c=new _t,o.push([v,w,c])):c=new de(new X(j.FILE,-1,365)),y&&(y._ls[S]=c)}}return t}constructor(){this._index={},this.addPath("/",new _t)}fileIterator(e){for(let t in this._index)if(Object.prototype.hasOwnProperty.call(this._index,t)){let i=this._index[t],o=i.getListing();for(let c of o){let a=i.getItem(c);sr(a)&&e(a.getData())}}}addPath(e,t){if(!t)throw new Error("Inode must be specified");if(e[0]!=="/")throw new Error("Path must be absolute, got: "+e);if(Object.prototype.hasOwnProperty.call(this._index,e))return this._index[e]===t;let i=this._split_path(e),o=i[0],c=i[1],a=this._index[o];return a===void 0&&e!=="/"&&(a=new _t,!this.addPath(o,a))||e!=="/"&&!a.addItem(c,t)?!1:(Fi(t)&&(this._index[e]=t),!0)}addPathFast(e,t){let i=e.lastIndexOf("/"),o=i===0?"/":e.substring(0,i),c=e.substring(i+1),a=this._index[o];return a===void 0&&(a=new _t,this.addPathFast(o,a)),a.addItem(c,t)?(t.isDir()&&(this._index[e]=t),!0):!1}removePath(e){let t=this._split_path(e),i=t[0],o=t[1],c=this._index[i];if(c===void 0)return null;let a=c.remItem(o);if(a===null)return null;if(Fi(a)){let d=a.getListing();for(let m of d)this.removePath(e+"/"+m);e!=="/"&&delete this._index[e]}return a}ls(e){let t=this._index[e];return t===void 0?null:t.getListing()}getInode(e){let t=this._split_path(e),i=t[0],o=t[1],c=this._index[i];return c===void 0?null:i===e?c:c.getItem(o)}_split_path(e){let t=R(e),i=e.substr(t.length+(t==="/"?0:1));return[t,i]}};l(Qt,"FileIndex");var de=class{constructor(e){this.data=e}isFile(){return!0}isDir(){return!1}getData(){return this.data}setData(e){this.data=e}toStats(){return new X(j.FILE,4096,438)}};l(de,"IndexFileInode");var _t=class{constructor(e=null){this.data=e;this._ls={}}isFile(){return!1}isDir(){return!0}getData(){return this.data}getStats(){return new X(j.DIRECTORY,4096,365)}toStats(){return this.getStats()}getListing(){return Object.keys(this._ls)}getItem(e){let t=this._ls[e];return t||null}addItem(e,t){return e in this._ls?!1:(this._ls[e]=t,!0)}remItem(e){let t=this._ls[e];return t===void 0?null:(delete this._ls[e],t)}};l(_t,"IndexDirInode");function sr(s){return!!s&&s.isFile()}l(sr,"isIndexFileInode");function Fi(s){return!!s&&s.isDir()}l(Fi,"isIndexDirInode");function ar(s,e=0,t=0){return qi(new K(e,t,e,t,e,t)),Be.initialize(s)}l(ar,"initialize");function or(s){return g(this,null,function*(){("fs"in s||s instanceof Ot)&&(s={"/":s});for(let[e,t]of Object.entries(s))typeof t!="number"&&(e=e.toString(),!(t instanceof Ot)&&(typeof t=="string"&&(t={fs:t}),s[e]=yield cr(t)));return ar(s)})}l(or,"_configure");function Hs(s,e){if(typeof e!="function")return or(s);or(s).then(()=>e()).catch(t=>e(t))}l(Hs,"configure");function xi(t){return g(this,arguments,function*({fs:s,options:e={}}){if(!s)throw new h(1,'Missing "fs" property on configuration object.');if(typeof e!="object"||e===null)throw new h(22,'Invalid "options" property on configuration object.');let i=Object.keys(e).filter(c=>c!="fs");for(let c of i){let a=e[c];if(a===null||typeof a!="object"||!("fs"in a))continue;let d=yield xi(a);e[c]=d}let o=Ne[s];if(o)return o.Create(e);throw new h(1,`File system ${s} is not available in ZenFS.`)})}l(xi,"_getFileSystem");function cr(s,e){if(typeof e!="function")return xi(s);xi(s).then(t=>e(null,t)).catch(t=>e(t))}l(cr,"getFileSystem");var Zs=Be;return Rr(Qs);})();
|
|
7
7
|
/*! Bundled license information:
|
|
8
8
|
|
|
9
9
|
@jspm/core/nodelibs/browser/buffer.js:
|