@zenfs/core 0.0.3 → 0.0.5
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/ApiError.d.ts +1 -1
- package/dist/ApiError.js +1 -1
- package/dist/backends/AsyncMirror.d.ts +5 -5
- package/dist/backends/AsyncMirror.js +5 -5
- package/dist/backends/AsyncStore.d.ts +5 -5
- package/dist/backends/AsyncStore.js +7 -7
- package/dist/backends/FolderAdapter.d.ts +2 -2
- package/dist/backends/FolderAdapter.js +4 -4
- package/dist/backends/InMemory.d.ts +3 -3
- package/dist/backends/InMemory.js +2 -2
- package/dist/backends/Locked.d.ts +6 -6
- package/dist/backends/Locked.js +1 -1
- package/dist/backends/OverlayFS.d.ts +6 -6
- package/dist/backends/OverlayFS.js +7 -7
- package/dist/backends/SyncStore.d.ts +5 -5
- package/dist/backends/SyncStore.js +9 -12
- package/dist/backends/backend.d.ts +1 -1
- package/dist/backends/backend.js +1 -1
- package/dist/backends/index.d.ts +5 -5
- package/dist/backends/index.js +4 -4
- package/dist/browser.min.js +5 -5
- package/dist/browser.min.js.map +4 -4
- package/dist/emulation/callbacks.d.ts +4 -4
- package/dist/emulation/callbacks.js +4 -4
- package/dist/emulation/fs.d.ts +3 -3
- package/dist/emulation/fs.js +2 -2
- package/dist/emulation/index.d.ts +5 -5
- package/dist/emulation/index.js +5 -7
- package/dist/emulation/promises.d.ts +5 -5
- package/dist/emulation/promises.js +4 -4
- package/dist/emulation/shared.d.ts +5 -5
- package/dist/emulation/shared.js +5 -4
- package/dist/emulation/sync.d.ts +4 -4
- package/dist/emulation/sync.js +3 -3
- package/dist/file.d.ts +3 -3
- package/dist/file.js +4 -4
- package/dist/filesystem.d.ts +5 -5
- package/dist/filesystem.js +2 -2
- package/dist/index.d.ts +14 -14
- package/dist/index.js +17 -21
- package/dist/inode.d.ts +2 -2
- package/dist/inode.js +1 -1
- package/dist/stats.d.ts +3 -3
- package/dist/stats.js +3 -3
- package/dist/utils.d.ts +4 -4
- package/dist/utils.js +1 -1
- package/package.json +1 -4
package/dist/browser.min.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
var ZenFS=(()=>{var st=Object.defineProperty,Hn=Object.defineProperties,Gn=Object.getOwnPropertyDescriptor,Zn=Object.getOwnPropertyDescriptors,Qn=Object.getOwnPropertyNames,$i=Object.getOwnPropertySymbols,es=Object.getPrototypeOf,ji=Object.prototype.hasOwnProperty,ts=Object.prototype.propertyIsEnumerable,is=Reflect.get;var P=Math.pow,Ki=(n,t,e)=>t in n?st(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,ge=(n,t)=>{for(var e in t||(t={}))ji.call(t,e)&&Ki(n,e,t[e]);if($i)for(var e of $i(t))ts.call(t,e)&&Ki(n,e,t[e]);return n},Se=(n,t)=>Hn(n,Zn(t)),l=(n,t)=>st(n,"name",{value:t,configurable:!0});var ot=(n,t)=>{for(var e in t)st(n,e,{get:t[e],enumerable:!0})},rs=(n,t,e,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Qn(t))!ji.call(n,o)&&o!==e&&st(n,o,{get:()=>t[o],enumerable:!(i=Gn(t,o))||i.enumerable});return n};var ns=n=>rs(st({},"__esModule",{value:!0}),n);var Yi=(n,t,e)=>is(es(n),e,t);var g=(n,t,e)=>new Promise((i,o)=>{var c=m=>{try{d(e.next(m))}catch(b){o(b)}},a=m=>{try{d(e.throw(m))}catch(b){o(b)}},d=m=>m.done?i(m.value):Promise.resolve(m.value).then(c,a);d((e=e.apply(n,t)).next())});var Ca={};ot(Ca,{ActionType:()=>Ct,ApiError:()=>h,AsyncKeyValueFile:()=>rt,AsyncKeyValueFileSystem:()=>zt,AsyncMirror:()=>ke,BaseFile:()=>ct,BaseFileSystem:()=>fe,Cred:()=>q,ErrorCode:()=>ie,ErrorStrings:()=>H,FileFlag:()=>O,FileSystem:()=>Ae,FileType:()=>G,FolderAdapter:()=>be,InMemory:()=>me,NoSyncFile:()=>xt,OverlayFS:()=>Fe,PreloadFile:()=>ce,ROOT_NODE_ID:()=>he,SimpleSyncRWTransaction:()=>Ze,Stats:()=>Q,SyncKeyValueFile:()=>Qe,SyncKeyValueFileSystem:()=>et,SynchronousFileSystem:()=>Pe,backends:()=>Ut,bufferValidator:()=>Js,checkOptions:()=>Gt,configure:()=>Fa,copyingSlice:()=>qs,default:()=>xa,fs:()=>Rt,getEmptyDirNode:()=>lt,getFileSystem:()=>Nn,initialize:()=>Tn,mkdirpSync:()=>pn,randomUUID:()=>Ke,registerBackend:()=>Bn,setImmediate:()=>Qs,toPromise:()=>Zs,wait:()=>Gs});var N={};ot(N,{_debugEnd:()=>Pr,_debugProcess:()=>Ar,_events:()=>Hr,_eventsCount:()=>Gr,_exiting:()=>mr,_fatalExceptions:()=>Ir,_getActiveHandles:()=>br,_getActiveRequests:()=>yr,_kill:()=>Sr,_linkedBinding:()=>fr,_maxListeners:()=>Jr,_preload_modules:()=>Yr,_rawDebug:()=>ur,_startProfilerIdleNotifier:()=>Rr,_stopProfilerIdleNotifier:()=>Lr,_tickCallback:()=>Or,abort:()=>zr,addListener:()=>Zr,allowedNodeEnvironmentFlags:()=>_r,arch:()=>Gi,argv:()=>er,argv0:()=>jr,assert:()=>kr,binding:()=>sr,chdir:()=>cr,config:()=>pr,cpuUsage:()=>wt,cwd:()=>ar,debugPort:()=>Kr,default:()=>cn,dlopen:()=>gr,domain:()=>hr,emit:()=>nn,emitWarning:()=>nr,env:()=>Qi,execArgv:()=>tr,execPath:()=>$r,exit:()=>xr,features:()=>Br,hasUncaughtExceptionCaptureCallback:()=>Nr,hrtime:()=>bt,kill:()=>Fr,listeners:()=>an,memoryUsage:()=>vr,moduleLoadList:()=>dr,nextTick:()=>qi,off:()=>en,on:()=>Ce,once:()=>Qr,openStdin:()=>Cr,pid:()=>Vr,platform:()=>Zi,ppid:()=>Wr,prependListener:()=>sn,prependOnceListener:()=>on,reallyExit:()=>wr,release:()=>lr,removeAllListeners:()=>rn,removeListener:()=>tn,resourceUsage:()=>Er,setSourceMapsEnabled:()=>Xr,setUncaughtExceptionCaptureCallback:()=>Tr,stderr:()=>Ur,stdin:()=>Mr,stdout:()=>Dr,title:()=>Hi,umask:()=>or,uptime:()=>qr,version:()=>ir,versions:()=>rr});function Yt(n){throw new Error("Node.js process "+n+" is not supported by JSPM core outside of Node.js")}l(Yt,"unimplemented");var xe=[],qe=!1,Ue,yt=-1;function ss(){!qe||!Ue||(qe=!1,Ue.length?xe=Ue.concat(xe):yt=-1,xe.length&&Xi())}l(ss,"cleanUpNextTick");function Xi(){if(!qe){var n=setTimeout(ss,0);qe=!0;for(var t=xe.length;t;){for(Ue=xe,xe=[];++yt<t;)Ue&&Ue[yt].run();yt=-1,t=xe.length}Ue=null,qe=!1,clearTimeout(n)}}l(Xi,"drainQueue");function qi(n){var t=new Array(arguments.length-1);if(arguments.length>1)for(var e=1;e<arguments.length;e++)t[e-1]=arguments[e];xe.push(new Ji(n,t)),xe.length===1&&!qe&&setTimeout(Xi,0)}l(qi,"nextTick");function Ji(n,t){this.fun=n,this.array=t}l(Ji,"Item");Ji.prototype.run=function(){this.fun.apply(null,this.array)};var Hi="browser",Gi="x64",Zi="browser",Qi={PATH:"/usr/bin",LANG:navigator.language+".UTF-8",PWD:"/",HOME:"/home",TMP:"/tmp"},er=["/usr/bin/node"],tr=[],ir="v16.8.0",rr={},nr=l(function(n,t){console.warn((t?t+": ":"")+n)},"emitWarning"),sr=l(function(n){Yt("binding")},"binding"),or=l(function(n){return 0},"umask"),ar=l(function(){return"/"},"cwd"),cr=l(function(n){},"chdir"),lr={name:"node",sourceUrl:"",headersUrl:"",libUrl:""};function ee(){}l(ee,"noop");var ur=ee,dr=[];function fr(n){Yt("_linkedBinding")}l(fr,"_linkedBinding");var hr={},mr=!1,pr={};function gr(n){Yt("dlopen")}l(gr,"dlopen");function yr(){return[]}l(yr,"_getActiveRequests");function br(){return[]}l(br,"_getActiveHandles");var wr=ee,Sr=ee,wt=l(function(){return{}},"cpuUsage"),Er=wt,vr=wt,Fr=ee,xr=ee,Cr=ee,_r={};function kr(n,t){if(!n)throw new Error(t||"assertion error")}l(kr,"assert");var Br={inspector:!1,debug:!1,uv:!1,ipv6:!1,tls_alpn:!1,tls_sni:!1,tls_ocsp:!1,tls:!1,cached_builtins:!0},Ir=ee,Tr=ee;function Nr(){return!1}l(Nr,"hasUncaughtExceptionCaptureCallback");var Or=ee,Ar=ee,Pr=ee,Rr=ee,Lr=ee,Dr=void 0,Ur=void 0,Mr=void 0,zr=ee,Vr=2,Wr=1,$r="/bin/usr/node",Kr=9229,jr="node",Yr=[],Xr=ee,Te={now:typeof performance!="undefined"?performance.now.bind(performance):void 0,timing:typeof performance!="undefined"?performance.timing:void 0};Te.now===void 0&&(Kt=Date.now(),Te.timing&&Te.timing.navigationStart&&(Kt=Te.timing.navigationStart),Te.now=()=>Date.now()-Kt);var Kt;function qr(){return Te.now()/1e3}l(qr,"uptime");var jt=1e9;function bt(n){var t=Math.floor((Date.now()-Te.now())*.001),e=Te.now()*.001,i=Math.floor(e)+t,o=Math.floor(e%1*1e9);return n&&(i=i-n[0],o=o-n[1],o<0&&(i--,o+=jt)),[i,o]}l(bt,"hrtime");bt.bigint=function(n){var t=bt(n);return typeof BigInt=="undefined"?t[0]*jt+t[1]:BigInt(t[0]*jt)+BigInt(t[1])};var Jr=10,Hr={},Gr=0;function Ce(){return cn}l(Ce,"on");var Zr=Ce,Qr=Ce,en=Ce,tn=Ce,rn=Ce,nn=ee,sn=Ce,on=Ce;function an(n){return[]}l(an,"listeners");var cn={version:ir,versions:rr,arch:Gi,platform:Zi,release:lr,_rawDebug:ur,moduleLoadList:dr,binding:sr,_linkedBinding:fr,_events:Hr,_eventsCount:Gr,_maxListeners:Jr,on:Ce,addListener:Zr,once:Qr,off:en,removeListener:tn,removeAllListeners:rn,emit:nn,prependListener:sn,prependOnceListener:on,listeners:an,domain:hr,_exiting:mr,config:pr,dlopen:gr,uptime:qr,_getActiveRequests:yr,_getActiveHandles:br,reallyExit:wr,_kill:Sr,cpuUsage:wt,resourceUsage:Er,memoryUsage:vr,kill:Fr,exit:xr,openStdin:Cr,allowedNodeEnvironmentFlags:_r,assert:kr,features:Br,_fatalExceptions:Ir,setUncaughtExceptionCaptureCallback:Tr,hasUncaughtExceptionCaptureCallback:Nr,emitWarning:nr,nextTick:qi,_tickCallback:Or,_debugProcess:Ar,_debugEnd:Pr,_startProfilerIdleNotifier:Rr,_stopProfilerIdleNotifier:Lr,stdout:Dr,stdin:Mr,stderr:Ur,abort:zr,umask:or,chdir:cr,cwd:ar,env:Qi,title:Hi,argv:er,execArgv:tr,pid:Vr,ppid:Wr,execPath:$r,debugPort:Kr,hrtime:bt,argv0:jr,_preload_modules:Yr,setSourceMapsEnabled:Xr};var at={},ln=!1;function os(){if(ln)return at;ln=!0,at.byteLength=d,at.toByteArray=b,at.fromByteArray=x;for(var n=[],t=[],e=typeof Uint8Array!="undefined"?Uint8Array:Array,i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o=0,c=i.length;o<c;++o)n[o]=i[o],t[i.charCodeAt(o)]=o;t["-".charCodeAt(0)]=62,t["_".charCodeAt(0)]=63;function a(F){var C=F.length;if(C%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var v=F.indexOf("=");v===-1&&(v=C);var _=v===C?0:4-v%4;return[v,_]}l(a,"getLens");function d(F){var C=a(F),v=C[0],_=C[1];return(v+_)*3/4-_}l(d,"byteLength");function m(F,C,v){return(C+v)*3/4-v}l(m,"_byteLength");function b(F){var C,v=a(F),_=v[0],A=v[1],L=new e(m(F,_,A)),V=0,ae=A>0?_-4:_,te;for(te=0;te<ae;te+=4)C=t[F.charCodeAt(te)]<<18|t[F.charCodeAt(te+1)]<<12|t[F.charCodeAt(te+2)]<<6|t[F.charCodeAt(te+3)],L[V++]=C>>16&255,L[V++]=C>>8&255,L[V++]=C&255;return A===2&&(C=t[F.charCodeAt(te)]<<2|t[F.charCodeAt(te+1)]>>4,L[V++]=C&255),A===1&&(C=t[F.charCodeAt(te)]<<10|t[F.charCodeAt(te+1)]<<4|t[F.charCodeAt(te+2)]>>2,L[V++]=C>>8&255,L[V++]=C&255),L}l(b,"toByteArray");function S(F){return n[F>>18&63]+n[F>>12&63]+n[F>>6&63]+n[F&63]}l(S,"tripletToBase64");function w(F,C,v){for(var _,A=[],L=C;L<v;L+=3)_=(F[L]<<16&16711680)+(F[L+1]<<8&65280)+(F[L+2]&255),A.push(S(_));return A.join("")}l(w,"encodeChunk");function x(F){for(var C,v=F.length,_=v%3,A=[],L=16383,V=0,ae=v-_;V<ae;V+=L)A.push(w(F,V,V+L>ae?ae:V+L));return _===1?(C=F[v-1],A.push(n[C>>2]+n[C<<4&63]+"==")):_===2&&(C=(F[v-2]<<8)+F[v-1],A.push(n[C>>10]+n[C>>4&63]+n[C<<2&63]+"=")),A.join("")}return l(x,"fromByteArray"),at}l(os,"dew$2");var St={},un=!1;function as(){if(un)return St;un=!0;return St.read=function(n,t,e,i,o){var c,a,d=o*8-i-1,m=(1<<d)-1,b=m>>1,S=-7,w=e?o-1:0,x=e?-1:1,F=n[t+w];for(w+=x,c=F&(1<<-S)-1,F>>=-S,S+=d;S>0;c=c*256+n[t+w],w+=x,S-=8);for(a=c&(1<<-S)-1,c>>=-S,S+=i;S>0;a=a*256+n[t+w],w+=x,S-=8);if(c===0)c=1-b;else{if(c===m)return a?NaN:(F?-1:1)*(1/0);a=a+Math.pow(2,i),c=c-b}return(F?-1:1)*a*Math.pow(2,c-i)},St.write=function(n,t,e,i,o,c){var a,d,m,b=c*8-o-1,S=(1<<b)-1,w=S>>1,x=o===23?Math.pow(2,-24)-Math.pow(2,-77):0,F=i?0:c-1,C=i?1:-1,v=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(d=isNaN(t)?1:0,a=S):(a=Math.floor(Math.log(t)/Math.LN2),t*(m=Math.pow(2,-a))<1&&(a--,m*=2),a+w>=1?t+=x/m:t+=x*Math.pow(2,1-w),t*m>=2&&(a++,m/=2),a+w>=S?(d=0,a=S):a+w>=1?(d=(t*m-1)*Math.pow(2,o),a=a+w):(d=t*Math.pow(2,w-1)*Math.pow(2,o),a=0));o>=8;n[e+F]=d&255,F+=C,d/=256,o-=8);for(a=a<<o|d,b+=o;b>0;n[e+F]=a&255,F+=C,a/=256,b-=8);n[e+F-C]|=v*128},St}l(as,"dew$1");var Me={},dn=!1;function cs(){if(dn)return Me;dn=!0;let n=os(),t=as(),e=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Me.Buffer=a,Me.SlowBuffer=A,Me.INSPECT_MAX_BYTES=50;let i=2147483647;Me.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,s){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,s)}l(a,"Buffer"),a.poolSize=8192;function d(u,r,s){if(typeof u=="string")return w(u,r);if(ArrayBuffer.isView(u))return F(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(we(u,ArrayBuffer)||u&&we(u.buffer,ArrayBuffer)||typeof SharedArrayBuffer!="undefined"&&(we(u,SharedArrayBuffer)||u&&we(u.buffer,SharedArrayBuffer)))return C(u,r,s);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,s);let p=v(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,s);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,s){return d(u,r,s)},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 b(u,r,s){return m(u),u<=0?c(u):r!==void 0?typeof s=="string"?c(u).fill(r,s):c(u).fill(r):c(u)}l(b,"alloc"),a.alloc=function(u,r,s){return b(u,r,s)};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 s=L(u,r)|0,f=c(s),p=f.write(u,r);return p!==s&&(f=f.slice(0,p)),f}l(w,"fromString");function x(u){let r=u.length<0?0:_(u.length)|0,s=c(r);for(let f=0;f<r;f+=1)s[f]=u[f]&255;return s}l(x,"fromArrayLike");function F(u){if(we(u,Uint8Array)){let r=new Uint8Array(u);return C(r.buffer,r.byteOffset,r.byteLength)}return x(u)}l(F,"fromArrayView");function C(u,r,s){if(r<0||u.byteLength<r)throw new RangeError('"offset" is outside of buffer bounds');if(u.byteLength<r+(s||0))throw new RangeError('"length" is outside of buffer bounds');let f;return r===void 0&&s===void 0?f=new Uint8Array(u):s===void 0?f=new Uint8Array(u,r):f=new Uint8Array(u,r,s),Object.setPrototypeOf(f,a.prototype),f}l(C,"fromArrayBuffer");function v(u){if(a.isBuffer(u)){let r=_(u.length)|0,s=c(r);return s.length===0||u.copy(s,0,0,r),s}if(u.length!==void 0)return typeof u.length!="number"||$t(u.length)?c(0):x(u);if(u.type==="Buffer"&&Array.isArray(u.data))return x(u.data)}l(v,"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 A(u){return+u!=u&&(u=0),a.alloc(+u)}l(A,"SlowBuffer"),a.isBuffer=l(function(r){return r!=null&&r._isBuffer===!0&&r!==a.prototype},"isBuffer"),a.compare=l(function(r,s){if(we(r,Uint8Array)&&(r=a.from(r,r.offset,r.byteLength)),we(s,Uint8Array)&&(s=a.from(s,s.offset,s.byteLength)),!a.isBuffer(r)||!a.isBuffer(s))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(r===s)return 0;let f=r.length,p=s.length;for(let y=0,E=Math.min(f,p);y<E;++y)if(r[y]!==s[y]){f=r[y],p=s[y];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,s){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(s===void 0)for(s=0,f=0;f<r.length;++f)s+=r[f].length;let p=a.allocUnsafe(s),y=0;for(f=0;f<r.length;++f){let E=r[f];if(we(E,Uint8Array))y+E.length>p.length?(a.isBuffer(E)||(E=a.from(E)),E.copy(p,y)):Uint8Array.prototype.set.call(p,E,y);else if(a.isBuffer(E))E.copy(p,y);else throw new TypeError('"list" argument must be an Array of Buffers');y+=E.length}return p},"concat");function L(u,r){if(a.isBuffer(u))return u.length;if(ArrayBuffer.isView(u)||we(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 s=u.length,f=arguments.length>2&&arguments[2]===!0;if(!f&&s===0)return 0;let p=!1;for(;;)switch(r){case"ascii":case"latin1":case"binary":return s;case"utf8":case"utf-8":return Wt(u).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return s*2;case"hex":return s>>>1;case"base64":return Wi(u).length;default:if(p)return f?-1:Wt(u).length;r=(""+r).toLowerCase(),p=!0}}l(L,"byteLength"),a.byteLength=L;function V(u,r,s){let f=!1;if((r===void 0||r<0)&&(r=0),r>this.length||((s===void 0||s>this.length)&&(s=this.length),s<=0)||(s>>>=0,r>>>=0,s<=r))return"";for(u||(u="utf8");;)switch(u){case"hex":return Vn(this,r,s);case"utf8":case"utf-8":return Ai(this,r,s);case"ascii":return Mn(this,r,s);case"latin1":case"binary":return zn(this,r,s);case"base64":return Dn(this,r,s);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Wn(this,r,s);default:if(f)throw new TypeError("Unknown encoding: "+u);u=(u+"").toLowerCase(),f=!0}}l(V,"slowToString"),a.prototype._isBuffer=!0;function ae(u,r,s){let f=u[r];u[r]=u[s],u[s]=f}l(ae,"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 s=0;s<r;s+=2)ae(this,s,s+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 s=0;s<r;s+=4)ae(this,s,s+3),ae(this,s+1,s+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 s=0;s<r;s+=8)ae(this,s,s+7),ae(this,s+1,s+6),ae(this,s+2,s+5),ae(this,s+3,s+4);return this},"swap64"),a.prototype.toString=l(function(){let r=this.length;return r===0?"":arguments.length===0?Ai(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="",s=Me.INSPECT_MAX_BYTES;return r=this.toString("hex",0,s).replace(/(.{2})/g,"$1 ").trim(),this.length>s&&(r+=" ... "),"<Buffer "+r+">"},"inspect"),e&&(a.prototype[e]=a.prototype.inspect),a.prototype.compare=l(function(r,s,f,p,y){if(we(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(s===void 0&&(s=0),f===void 0&&(f=r?r.length:0),p===void 0&&(p=0),y===void 0&&(y=this.length),s<0||f>r.length||p<0||y>this.length)throw new RangeError("out of range index");if(p>=y&&s>=f)return 0;if(p>=y)return-1;if(s>=f)return 1;if(s>>>=0,f>>>=0,p>>>=0,y>>>=0,this===r)return 0;let E=y-p,T=f-s,W=Math.min(E,T),M=this.slice(p,y),$=r.slice(s,f);for(let D=0;D<W;++D)if(M[D]!==$[D]){E=M[D],T=$[D];break}return E<T?-1:T<E?1:0},"compare");function te(u,r,s,f,p){if(u.length===0)return-1;if(typeof s=="string"?(f=s,s=0):s>2147483647?s=2147483647:s<-2147483648&&(s=-2147483648),s=+s,$t(s)&&(s=p?0:u.length-1),s<0&&(s=u.length+s),s>=u.length){if(p)return-1;s=u.length-1}else if(s<0)if(p)s=0;else return-1;if(typeof r=="string"&&(r=a.from(r,f)),a.isBuffer(r))return r.length===0?-1:Oi(u,r,s,f,p);if(typeof r=="number")return r=r&255,typeof Uint8Array.prototype.indexOf=="function"?p?Uint8Array.prototype.indexOf.call(u,r,s):Uint8Array.prototype.lastIndexOf.call(u,r,s):Oi(u,[r],s,f,p);throw new TypeError("val must be string, number or Buffer")}l(te,"bidirectionalIndexOf");function Oi(u,r,s,f,p){let y=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;y=2,E/=2,T/=2,s/=2}function W($,D){return y===1?$[D]:$.readUInt16BE(D*y)}l(W,"read");let M;if(p){let $=-1;for(M=s;M<E;M++)if(W(u,M)===W(r,$===-1?0:M-$)){if($===-1&&($=M),M-$+1===T)return $*y}else $!==-1&&(M-=M-$),$=-1}else for(s+T>E&&(s=E-T),M=s;M>=0;M--){let $=!0;for(let D=0;D<T;D++)if(W(u,M+D)!==W(r,D)){$=!1;break}if($)return M}return-1}l(Oi,"arrayIndexOf"),a.prototype.includes=l(function(r,s,f){return this.indexOf(r,s,f)!==-1},"includes"),a.prototype.indexOf=l(function(r,s,f){return te(this,r,s,f,!0)},"indexOf"),a.prototype.lastIndexOf=l(function(r,s,f){return te(this,r,s,f,!1)},"lastIndexOf");function On(u,r,s,f){s=Number(s)||0;let p=u.length-s;f?(f=Number(f),f>p&&(f=p)):f=p;let y=r.length;f>y/2&&(f=y/2);let E;for(E=0;E<f;++E){let T=parseInt(r.substr(E*2,2),16);if($t(T))return E;u[s+E]=T}return E}l(On,"hexWrite");function An(u,r,s,f){return gt(Wt(r,u.length-s),u,s,f)}l(An,"utf8Write");function Pn(u,r,s,f){return gt(Yn(r),u,s,f)}l(Pn,"asciiWrite");function Rn(u,r,s,f){return gt(Wi(r),u,s,f)}l(Rn,"base64Write");function Ln(u,r,s,f){return gt(Xn(r,u.length-s),u,s,f)}l(Ln,"ucs2Write"),a.prototype.write=l(function(r,s,f,p){if(s===void 0)p="utf8",f=this.length,s=0;else if(f===void 0&&typeof s=="string")p=s,f=this.length,s=0;else if(isFinite(s))s=s>>>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 y=this.length-s;if((f===void 0||f>y)&&(f=y),r.length>0&&(f<0||s<0)||s>this.length)throw new RangeError("Attempt to write outside buffer bounds");p||(p="utf8");let E=!1;for(;;)switch(p){case"hex":return On(this,r,s,f);case"utf8":case"utf-8":return An(this,r,s,f);case"ascii":case"latin1":case"binary":return Pn(this,r,s,f);case"base64":return Rn(this,r,s,f);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Ln(this,r,s,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 Dn(u,r,s){return r===0&&s===u.length?n.fromByteArray(u):n.fromByteArray(u.slice(r,s))}l(Dn,"base64Slice");function Ai(u,r,s){s=Math.min(u.length,s);let f=[],p=r;for(;p<s;){let y=u[p],E=null,T=y>239?4:y>223?3:y>191?2:1;if(p+T<=s){let W,M,$,D;switch(T){case 1:y<128&&(E=y);break;case 2:W=u[p+1],(W&192)===128&&(D=(y&31)<<6|W&63,D>127&&(E=D));break;case 3:W=u[p+1],M=u[p+2],(W&192)===128&&(M&192)===128&&(D=(y&15)<<12|(W&63)<<6|M&63,D>2047&&(D<55296||D>57343)&&(E=D));break;case 4:W=u[p+1],M=u[p+2],$=u[p+3],(W&192)===128&&(M&192)===128&&($&192)===128&&(D=(y&15)<<18|(W&63)<<12|(M&63)<<6|$&63,D>65535&&D<1114112&&(E=D))}}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 Un(f)}l(Ai,"utf8Slice");let Pi=4096;function Un(u){let r=u.length;if(r<=Pi)return String.fromCharCode.apply(String,u);let s="",f=0;for(;f<r;)s+=String.fromCharCode.apply(String,u.slice(f,f+=Pi));return s}l(Un,"decodeCodePointsArray");function Mn(u,r,s){let f="";s=Math.min(u.length,s);for(let p=r;p<s;++p)f+=String.fromCharCode(u[p]&127);return f}l(Mn,"asciiSlice");function zn(u,r,s){let f="";s=Math.min(u.length,s);for(let p=r;p<s;++p)f+=String.fromCharCode(u[p]);return f}l(zn,"latin1Slice");function Vn(u,r,s){let f=u.length;(!r||r<0)&&(r=0),(!s||s<0||s>f)&&(s=f);let p="";for(let y=r;y<s;++y)p+=qn[u[y]];return p}l(Vn,"hexSlice");function Wn(u,r,s){let f=u.slice(r,s),p="";for(let y=0;y<f.length-1;y+=2)p+=String.fromCharCode(f[y]+f[y+1]*256);return p}l(Wn,"utf16leSlice"),a.prototype.slice=l(function(r,s){let f=this.length;r=~~r,s=s===void 0?f:~~s,r<0?(r+=f,r<0&&(r=0)):r>f&&(r=f),s<0?(s+=f,s<0&&(s=0)):s>f&&(s=f),s<r&&(s=r);let p=this.subarray(r,s);return Object.setPrototypeOf(p,a.prototype),p},"slice");function J(u,r,s){if(u%1!==0||u<0)throw new RangeError("offset is not uint");if(u+r>s)throw new RangeError("Trying to access beyond buffer length")}l(J,"checkOffset"),a.prototype.readUintLE=a.prototype.readUIntLE=l(function(r,s,f){r=r>>>0,s=s>>>0,f||J(r,s,this.length);let p=this[r],y=1,E=0;for(;++E<s&&(y*=256);)p+=this[r+E]*y;return p},"readUIntLE"),a.prototype.readUintBE=a.prototype.readUIntBE=l(function(r,s,f){r=r>>>0,s=s>>>0,f||J(r,s,this.length);let p=this[r+--s],y=1;for(;s>0&&(y*=256);)p+=this[r+--s]*y;return p},"readUIntBE"),a.prototype.readUint8=a.prototype.readUInt8=l(function(r,s){return r=r>>>0,s||J(r,1,this.length),this[r]},"readUInt8"),a.prototype.readUint16LE=a.prototype.readUInt16LE=l(function(r,s){return r=r>>>0,s||J(r,2,this.length),this[r]|this[r+1]<<8},"readUInt16LE"),a.prototype.readUint16BE=a.prototype.readUInt16BE=l(function(r,s){return r=r>>>0,s||J(r,2,this.length),this[r]<<8|this[r+1]},"readUInt16BE"),a.prototype.readUint32LE=a.prototype.readUInt32LE=l(function(r,s){return r=r>>>0,s||J(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,s){return r=r>>>0,s||J(r,4,this.length),this[r]*16777216+(this[r+1]<<16|this[r+2]<<8|this[r+3])},"readUInt32BE"),a.prototype.readBigUInt64LE=Ie(l(function(r){r=r>>>0,Xe(r,"offset");let s=this[r],f=this[r+7];(s===void 0||f===void 0)&&nt(r,this.length-8);let p=s+this[++r]*P(2,8)+this[++r]*P(2,16)+this[++r]*P(2,24),y=this[++r]+this[++r]*P(2,8)+this[++r]*P(2,16)+f*P(2,24);return BigInt(p)+(BigInt(y)<<BigInt(32))},"readBigUInt64LE")),a.prototype.readBigUInt64BE=Ie(l(function(r){r=r>>>0,Xe(r,"offset");let s=this[r],f=this[r+7];(s===void 0||f===void 0)&&nt(r,this.length-8);let p=s*P(2,24)+this[++r]*P(2,16)+this[++r]*P(2,8)+this[++r],y=this[++r]*P(2,24)+this[++r]*P(2,16)+this[++r]*P(2,8)+f;return(BigInt(p)<<BigInt(32))+BigInt(y)},"readBigUInt64BE")),a.prototype.readIntLE=l(function(r,s,f){r=r>>>0,s=s>>>0,f||J(r,s,this.length);let p=this[r],y=1,E=0;for(;++E<s&&(y*=256);)p+=this[r+E]*y;return y*=128,p>=y&&(p-=Math.pow(2,8*s)),p},"readIntLE"),a.prototype.readIntBE=l(function(r,s,f){r=r>>>0,s=s>>>0,f||J(r,s,this.length);let p=s,y=1,E=this[r+--p];for(;p>0&&(y*=256);)E+=this[r+--p]*y;return y*=128,E>=y&&(E-=Math.pow(2,8*s)),E},"readIntBE"),a.prototype.readInt8=l(function(r,s){return r=r>>>0,s||J(r,1,this.length),this[r]&128?(255-this[r]+1)*-1:this[r]},"readInt8"),a.prototype.readInt16LE=l(function(r,s){r=r>>>0,s||J(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,s){r=r>>>0,s||J(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,s){return r=r>>>0,s||J(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,s){return r=r>>>0,s||J(r,4,this.length),this[r]<<24|this[r+1]<<16|this[r+2]<<8|this[r+3]},"readInt32BE"),a.prototype.readBigInt64LE=Ie(l(function(r){r=r>>>0,Xe(r,"offset");let s=this[r],f=this[r+7];(s===void 0||f===void 0)&&nt(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(s+this[++r]*P(2,8)+this[++r]*P(2,16)+this[++r]*P(2,24))},"readBigInt64LE")),a.prototype.readBigInt64BE=Ie(l(function(r){r=r>>>0,Xe(r,"offset");let s=this[r],f=this[r+7];(s===void 0||f===void 0)&&nt(r,this.length-8);let p=(s<<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,s){return r=r>>>0,s||J(r,4,this.length),t.read(this,r,!0,23,4)},"readFloatLE"),a.prototype.readFloatBE=l(function(r,s){return r=r>>>0,s||J(r,4,this.length),t.read(this,r,!1,23,4)},"readFloatBE"),a.prototype.readDoubleLE=l(function(r,s){return r=r>>>0,s||J(r,8,this.length),t.read(this,r,!0,52,8)},"readDoubleLE"),a.prototype.readDoubleBE=l(function(r,s){return r=r>>>0,s||J(r,8,this.length),t.read(this,r,!1,52,8)},"readDoubleBE");function ne(u,r,s,f,p,y){if(!a.isBuffer(u))throw new TypeError('"buffer" argument must be a Buffer instance');if(r>p||r<y)throw new RangeError('"value" argument is out of bounds');if(s+f>u.length)throw new RangeError("Index out of range")}l(ne,"checkInt"),a.prototype.writeUintLE=a.prototype.writeUIntLE=l(function(r,s,f,p){if(r=+r,s=s>>>0,f=f>>>0,!p){let T=Math.pow(2,8*f)-1;ne(this,r,s,f,T,0)}let y=1,E=0;for(this[s]=r&255;++E<f&&(y*=256);)this[s+E]=r/y&255;return s+f},"writeUIntLE"),a.prototype.writeUintBE=a.prototype.writeUIntBE=l(function(r,s,f,p){if(r=+r,s=s>>>0,f=f>>>0,!p){let T=Math.pow(2,8*f)-1;ne(this,r,s,f,T,0)}let y=f-1,E=1;for(this[s+y]=r&255;--y>=0&&(E*=256);)this[s+y]=r/E&255;return s+f},"writeUIntBE"),a.prototype.writeUint8=a.prototype.writeUInt8=l(function(r,s,f){return r=+r,s=s>>>0,f||ne(this,r,s,1,255,0),this[s]=r&255,s+1},"writeUInt8"),a.prototype.writeUint16LE=a.prototype.writeUInt16LE=l(function(r,s,f){return r=+r,s=s>>>0,f||ne(this,r,s,2,65535,0),this[s]=r&255,this[s+1]=r>>>8,s+2},"writeUInt16LE"),a.prototype.writeUint16BE=a.prototype.writeUInt16BE=l(function(r,s,f){return r=+r,s=s>>>0,f||ne(this,r,s,2,65535,0),this[s]=r>>>8,this[s+1]=r&255,s+2},"writeUInt16BE"),a.prototype.writeUint32LE=a.prototype.writeUInt32LE=l(function(r,s,f){return r=+r,s=s>>>0,f||ne(this,r,s,4,4294967295,0),this[s+3]=r>>>24,this[s+2]=r>>>16,this[s+1]=r>>>8,this[s]=r&255,s+4},"writeUInt32LE"),a.prototype.writeUint32BE=a.prototype.writeUInt32BE=l(function(r,s,f){return r=+r,s=s>>>0,f||ne(this,r,s,4,4294967295,0),this[s]=r>>>24,this[s+1]=r>>>16,this[s+2]=r>>>8,this[s+3]=r&255,s+4},"writeUInt32BE");function Ri(u,r,s,f,p){Vi(r,f,p,u,s,7);let y=Number(r&BigInt(4294967295));u[s++]=y,y=y>>8,u[s++]=y,y=y>>8,u[s++]=y,y=y>>8,u[s++]=y;let E=Number(r>>BigInt(32)&BigInt(4294967295));return u[s++]=E,E=E>>8,u[s++]=E,E=E>>8,u[s++]=E,E=E>>8,u[s++]=E,s}l(Ri,"wrtBigUInt64LE");function Li(u,r,s,f,p){Vi(r,f,p,u,s,7);let y=Number(r&BigInt(4294967295));u[s+7]=y,y=y>>8,u[s+6]=y,y=y>>8,u[s+5]=y,y=y>>8,u[s+4]=y;let E=Number(r>>BigInt(32)&BigInt(4294967295));return u[s+3]=E,E=E>>8,u[s+2]=E,E=E>>8,u[s+1]=E,E=E>>8,u[s]=E,s+8}l(Li,"wrtBigUInt64BE"),a.prototype.writeBigUInt64LE=Ie(l(function(r,s=0){return Ri(this,r,s,BigInt(0),BigInt("0xffffffffffffffff"))},"writeBigUInt64LE")),a.prototype.writeBigUInt64BE=Ie(l(function(r,s=0){return Li(this,r,s,BigInt(0),BigInt("0xffffffffffffffff"))},"writeBigUInt64BE")),a.prototype.writeIntLE=l(function(r,s,f,p){if(r=+r,s=s>>>0,!p){let W=Math.pow(2,8*f-1);ne(this,r,s,f,W-1,-W)}let y=0,E=1,T=0;for(this[s]=r&255;++y<f&&(E*=256);)r<0&&T===0&&this[s+y-1]!==0&&(T=1),this[s+y]=(r/E>>0)-T&255;return s+f},"writeIntLE"),a.prototype.writeIntBE=l(function(r,s,f,p){if(r=+r,s=s>>>0,!p){let W=Math.pow(2,8*f-1);ne(this,r,s,f,W-1,-W)}let y=f-1,E=1,T=0;for(this[s+y]=r&255;--y>=0&&(E*=256);)r<0&&T===0&&this[s+y+1]!==0&&(T=1),this[s+y]=(r/E>>0)-T&255;return s+f},"writeIntBE"),a.prototype.writeInt8=l(function(r,s,f){return r=+r,s=s>>>0,f||ne(this,r,s,1,127,-128),r<0&&(r=255+r+1),this[s]=r&255,s+1},"writeInt8"),a.prototype.writeInt16LE=l(function(r,s,f){return r=+r,s=s>>>0,f||ne(this,r,s,2,32767,-32768),this[s]=r&255,this[s+1]=r>>>8,s+2},"writeInt16LE"),a.prototype.writeInt16BE=l(function(r,s,f){return r=+r,s=s>>>0,f||ne(this,r,s,2,32767,-32768),this[s]=r>>>8,this[s+1]=r&255,s+2},"writeInt16BE"),a.prototype.writeInt32LE=l(function(r,s,f){return r=+r,s=s>>>0,f||ne(this,r,s,4,2147483647,-2147483648),this[s]=r&255,this[s+1]=r>>>8,this[s+2]=r>>>16,this[s+3]=r>>>24,s+4},"writeInt32LE"),a.prototype.writeInt32BE=l(function(r,s,f){return r=+r,s=s>>>0,f||ne(this,r,s,4,2147483647,-2147483648),r<0&&(r=4294967295+r+1),this[s]=r>>>24,this[s+1]=r>>>16,this[s+2]=r>>>8,this[s+3]=r&255,s+4},"writeInt32BE"),a.prototype.writeBigInt64LE=Ie(l(function(r,s=0){return Ri(this,r,s,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))},"writeBigInt64LE")),a.prototype.writeBigInt64BE=Ie(l(function(r,s=0){return Li(this,r,s,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))},"writeBigInt64BE"));function Di(u,r,s,f,p,y){if(s+f>u.length)throw new RangeError("Index out of range");if(s<0)throw new RangeError("Index out of range")}l(Di,"checkIEEE754");function Ui(u,r,s,f,p){return r=+r,s=s>>>0,p||Di(u,r,s,4),t.write(u,r,s,f,23,4),s+4}l(Ui,"writeFloat"),a.prototype.writeFloatLE=l(function(r,s,f){return Ui(this,r,s,!0,f)},"writeFloatLE"),a.prototype.writeFloatBE=l(function(r,s,f){return Ui(this,r,s,!1,f)},"writeFloatBE");function Mi(u,r,s,f,p){return r=+r,s=s>>>0,p||Di(u,r,s,8),t.write(u,r,s,f,52,8),s+8}l(Mi,"writeDouble"),a.prototype.writeDoubleLE=l(function(r,s,f){return Mi(this,r,s,!0,f)},"writeDoubleLE"),a.prototype.writeDoubleBE=l(function(r,s,f){return Mi(this,r,s,!1,f)},"writeDoubleBE"),a.prototype.copy=l(function(r,s,f,p){if(!a.isBuffer(r))throw new TypeError("argument should be a Buffer");if(f||(f=0),!p&&p!==0&&(p=this.length),s>=r.length&&(s=r.length),s||(s=0),p>0&&p<f&&(p=f),p===f||r.length===0||this.length===0)return 0;if(s<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-s<p-f&&(p=r.length-s+f);let y=p-f;return this===r&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(s,f,p):Uint8Array.prototype.set.call(r,this.subarray(f,p),s),y},"copy"),a.prototype.fill=l(function(r,s,f,p){if(typeof r=="string"){if(typeof s=="string"?(p=s,s=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(s<0||this.length<s||this.length<f)throw new RangeError("Out of range index");if(f<=s)return this;s=s>>>0,f=f===void 0?this.length:f>>>0,r||(r=0);let y;if(typeof r=="number")for(y=s;y<f;++y)this[y]=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(y=0;y<f-s;++y)this[y+s]=E[y%T]}return this},"fill");let Ye={};function Vt(u,r,s){Ye[u]=l(class extends s{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(Vt,"E"),Vt("ERR_BUFFER_OUT_OF_BOUNDS",function(u){return u?`${u} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),Vt("ERR_INVALID_ARG_TYPE",function(u,r){return`The "${u}" argument must be of type number. Received type ${typeof r}`},TypeError),Vt("ERR_OUT_OF_RANGE",function(u,r,s){let f=`The value of "${u}" is out of range.`,p=s;return Number.isInteger(s)&&Math.abs(s)>P(2,32)?p=zi(String(s)):typeof s=="bigint"&&(p=String(s),(s>P(BigInt(2),BigInt(32))||s<-P(BigInt(2),BigInt(32)))&&(p=zi(p)),p+="n"),f+=` It must be ${r}. Received ${p}`,f},RangeError);function zi(u){let r="",s=u.length,f=u[0]==="-"?1:0;for(;s>=f+4;s-=3)r=`_${u.slice(s-3,s)}${r}`;return`${u.slice(0,s)}${r}`}l(zi,"addNumericalSeparator");function $n(u,r,s){Xe(r,"offset"),(u[r]===void 0||u[r+s]===void 0)&&nt(r,u.length-(s+1))}l($n,"checkBounds");function Vi(u,r,s,f,p,y){if(u>s||u<r){let E=typeof r=="bigint"?"n":"",T;throw y>3?r===0||r===BigInt(0)?T=`>= 0${E} and < 2${E} ** ${(y+1)*8}${E}`:T=`>= -(2${E} ** ${(y+1)*8-1}${E}) and < 2 ** ${(y+1)*8-1}${E}`:T=`>= ${r}${E} and <= ${s}${E}`,new Ye.ERR_OUT_OF_RANGE("value",T,u)}$n(f,p,y)}l(Vi,"checkIntBI");function Xe(u,r){if(typeof u!="number")throw new Ye.ERR_INVALID_ARG_TYPE(r,"number",u)}l(Xe,"validateNumber");function nt(u,r,s){throw Math.floor(u)!==u?(Xe(u,s),new Ye.ERR_OUT_OF_RANGE(s||"offset","an integer",u)):r<0?new Ye.ERR_BUFFER_OUT_OF_BOUNDS:new Ye.ERR_OUT_OF_RANGE(s||"offset",`>= ${s?1:0} and <= ${r}`,u)}l(nt,"boundsError");let Kn=/[^+/0-9A-Za-z-_]/g;function jn(u){if(u=u.split("=")[0],u=u.trim().replace(Kn,""),u.length<2)return"";for(;u.length%4!==0;)u=u+"=";return u}l(jn,"base64clean");function Wt(u,r){r=r||1/0;let s,f=u.length,p=null,y=[];for(let E=0;E<f;++E){if(s=u.charCodeAt(E),s>55295&&s<57344){if(!p){if(s>56319){(r-=3)>-1&&y.push(239,191,189);continue}else if(E+1===f){(r-=3)>-1&&y.push(239,191,189);continue}p=s;continue}if(s<56320){(r-=3)>-1&&y.push(239,191,189),p=s;continue}s=(p-55296<<10|s-56320)+65536}else p&&(r-=3)>-1&&y.push(239,191,189);if(p=null,s<128){if((r-=1)<0)break;y.push(s)}else if(s<2048){if((r-=2)<0)break;y.push(s>>6|192,s&63|128)}else if(s<65536){if((r-=3)<0)break;y.push(s>>12|224,s>>6&63|128,s&63|128)}else if(s<1114112){if((r-=4)<0)break;y.push(s>>18|240,s>>12&63|128,s>>6&63|128,s&63|128)}else throw new Error("Invalid code point")}return y}l(Wt,"utf8ToBytes");function Yn(u){let r=[];for(let s=0;s<u.length;++s)r.push(u.charCodeAt(s)&255);return r}l(Yn,"asciiToBytes");function Xn(u,r){let s,f,p,y=[];for(let E=0;E<u.length&&!((r-=2)<0);++E)s=u.charCodeAt(E),f=s>>8,p=s%256,y.push(p),y.push(f);return y}l(Xn,"utf16leToBytes");function Wi(u){return n.toByteArray(jn(u))}l(Wi,"base64ToBytes");function gt(u,r,s,f){let p;for(p=0;p<f&&!(p+s>=r.length||p>=u.length);++p)r[p+s]=u[p];return p}l(gt,"blitBuffer");function we(u,r){return u instanceof r||u!=null&&u.constructor!=null&&u.constructor.name!=null&&u.constructor.name===r.name}l(we,"isInstance");function $t(u){return u!==u}l($t,"numberIsNaN");let qn=function(){let u="0123456789abcdef",r=new Array(256);for(let s=0;s<16;++s){let f=s*16;for(let p=0;p<16;++p)r[f+p]=u[s]+u[p]}return r}();function Ie(u){return typeof BigInt=="undefined"?Jn:u}l(Ie,"defineBigIntMethod");function Jn(){throw new Error("BigInt not supported")}return l(Jn,"BufferBigIntNotDefined"),Me}l(cs,"dew");var ze=cs();ze.Buffer;ze.SlowBuffer;ze.INSPECT_MAX_BYTES;ze.kMaxLength;var k=ze.Buffer,Aa=ze.INSPECT_MAX_BYTES,Pa=ze.kMaxLength;var Ii={};ot(Ii,{_toUnixTimestamp:()=>yn,access:()=>zo,accessSync:()=>Sa,appendFile:()=>go,appendFileSync:()=>Go,chmod:()=>Ro,chmodSync:()=>ga,chown:()=>Ao,chownSync:()=>ma,close:()=>bo,closeSync:()=>Qo,constants:()=>He,createReadStream:()=>Ko,createWriteStream:()=>jo,exists:()=>ao,existsSync:()=>En,fchmod:()=>Co,fchmodSync:()=>oa,fchown:()=>xo,fchownSync:()=>sa,fdatasync:()=>Eo,fdatasyncSync:()=>ia,fstat:()=>yo,fstatSync:()=>Zo,fsync:()=>So,fsyncSync:()=>ta,ftruncate:()=>wo,ftruncateSync:()=>ea,futimes:()=>_o,futimesSync:()=>aa,getMount:()=>Ge,getMounts:()=>wn,initialize:()=>Sn,lchmod:()=>Lo,lchmodSync:()=>ya,lchown:()=>Po,lchownSync:()=>pa,link:()=>To,linkSync:()=>da,lstat:()=>lo,lstatSync:()=>qo,lutimes:()=>Uo,lutimesSync:()=>wa,mkdir:()=>Bo,mkdirSync:()=>la,mount:()=>It,open:()=>ho,openSync:()=>Ho,promises:()=>dt,read:()=>Fo,readFile:()=>mo,readFileSync:()=>Fn,readSync:()=>na,readdir:()=>Io,readdirSync:()=>ua,readlink:()=>Oo,readlinkSync:()=>ha,realpath:()=>Mo,realpathSync:()=>Bi,rename:()=>oo,renameSync:()=>Yo,rmdir:()=>ko,rmdirSync:()=>ca,stat:()=>co,statSync:()=>Xo,symlink:()=>No,symlinkSync:()=>fa,truncate:()=>uo,truncateSync:()=>Jo,umount:()=>Qt,unlink:()=>fo,unlinkSync:()=>vn,unwatchFile:()=>Wo,utimes:()=>Do,utimesSync:()=>ba,watch:()=>$o,watchFile:()=>Vo,write:()=>vo,writeFile:()=>po,writeFileSync:()=>xn,writeSync:()=>ra});var ie=(v=>(v[v.EPERM=1]="EPERM",v[v.ENOENT=2]="ENOENT",v[v.EIO=5]="EIO",v[v.EBADF=9]="EBADF",v[v.EACCES=13]="EACCES",v[v.EBUSY=16]="EBUSY",v[v.EEXIST=17]="EEXIST",v[v.ENOTDIR=20]="ENOTDIR",v[v.EISDIR=21]="EISDIR",v[v.EINVAL=22]="EINVAL",v[v.EFBIG=27]="EFBIG",v[v.ENOSPC=28]="ENOSPC",v[v.EROFS=30]="EROFS",v[v.ENOTEMPTY=39]="ENOTEMPTY",v[v.ENOTSUP=95]="ENOTSUP",v))(ie||{}),H={};H[1]="Operation not permitted.";H[2]="No such file or directory.";H[5]="Input/output error.";H[9]="Bad file descriptor.";H[13]="Permission denied.";H[16]="Resource busy or locked.";H[17]="File exists.";H[20]="File is not a directory.";H[21]="File is a directory.";H[22]="Invalid argument.";H[27]="File is too big.";H[28]="No space left on disk.";H[30]="Cannot modify a read-only file system.";H[39]="Directory is not empty.";H[95]="Operation is not supported.";var h=class extends Error{constructor(e,i=H[e],o){super(i);this.syscall="";this.errno=e,this.code=ie[e],this.path=o,this.message=`Error: ${this.code}: ${i}${this.path?`, '${this.path}'`:""}`}static fromJSON(e){let i=new h(e.errno,e.message,e.path);return i.code=e.code,i.stack=e.stack,i}static fromBuffer(e,i=0){return h.fromJSON(JSON.parse(e.toString("utf8",i+4,i+4+e.readUInt32LE(i))))}static FileError(e,i){return new h(e,H[e],i)}static EACCES(e){return this.FileError(13,e)}static ENOENT(e){return this.FileError(2,e)}static EEXIST(e){return this.FileError(17,e)}static EISDIR(e){return this.FileError(21,e)}static ENOTDIR(e){return this.FileError(20,e)}static EPERM(e){return this.FileError(1,e)}static ENOTEMPTY(e){return this.FileError(39,e)}toString(){return this.message}toJSON(){return{errno:this.errno,code:this.code,path:this.path,stack:this.stack,message:this.message}}writeToBuffer(e=k.alloc(this.bufferSize()),i=0){let o=e.write(JSON.stringify(this.toJSON()),i+4);return e.writeUInt32LE(o,i),e}bufferSize(){return 4+k.byteLength(JSON.stringify(this.toJSON()))}};l(h,"ApiError");var Xt={},fn=!1,Je=typeof globalThis!="undefined"?globalThis:typeof self!="undefined"?self:global;function ls(){if(fn)return Xt;fn=!0;var n=Xt={},t,e;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"?t=setTimeout:t=i}catch(v){t=i}try{typeof clearTimeout=="function"?e=clearTimeout:e=o}catch(v){e=o}}();function c(v){if(t===setTimeout)return setTimeout(v,0);if((t===i||!t)&&setTimeout)return t=setTimeout,setTimeout(v,0);try{return t(v,0)}catch(_){try{return t.call(null,v,0)}catch(A){return t.call(this||Je,v,0)}}}l(c,"runTimeout");function a(v){if(e===clearTimeout)return clearTimeout(v);if((e===o||!e)&&clearTimeout)return e=clearTimeout,clearTimeout(v);try{return e(v)}catch(_){try{return e.call(null,v)}catch(A){return e.call(this||Je,v)}}}l(a,"runClearTimeout");var d=[],m=!1,b,S=-1;function w(){!m||!b||(m=!1,b.length?d=b.concat(d):S=-1,d.length&&x())}l(w,"cleanUpNextTick");function x(){if(!m){var v=c(w);m=!0;for(var _=d.length;_;){for(b=d,d=[];++S<_;)b&&b[S].run();S=-1,_=d.length}b=null,m=!1,a(v)}}l(x,"drainQueue"),n.nextTick=function(v){var _=new Array(arguments.length-1);if(arguments.length>1)for(var A=1;A<arguments.length;A++)_[A-1]=arguments[A];d.push(new F(v,_)),d.length===1&&!m&&c(x)};function F(v,_){(this||Je).fun=v,(this||Je).array=_}l(F,"Item"),F.prototype.run=function(){(this||Je).fun.apply(null,(this||Je).array)},n.title="browser",n.browser=!0,n.env={},n.argv=[],n.version="",n.versions={};function C(){}return l(C,"noop"),n.on=C,n.addListener=C,n.once=C,n.off=C,n.removeListener=C,n.removeAllListeners=C,n.emit=C,n.prependListener=C,n.prependOnceListener=C,n.listeners=function(v){return[]},n.binding=function(v){throw new Error("process.binding is not supported")},n.cwd=function(){return"/"},n.chdir=function(v){throw new Error("process.chdir is not supported")},n.umask=function(){return 0},Xt}l(ls,"dew");var z=ls();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 qt={},hn=!1;function us(){if(hn)return qt;hn=!0;var n=z;function t(c){if(typeof c!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(c))}l(t,"assertPath");function e(c,a){for(var d="",m=0,b=-1,S=0,w,x=0;x<=c.length;++x){if(x<c.length)w=c.charCodeAt(x);else{if(w===47)break;w=47}if(w===47){if(!(b===x-1||S===1))if(b!==x-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 F=d.lastIndexOf("/");if(F!==d.length-1){F===-1?(d="",m=0):(d=d.slice(0,F),m=d.length-1-d.lastIndexOf("/")),b=x,S=0;continue}}else if(d.length===2||d.length===1){d="",m=0,b=x,S=0;continue}}a&&(d.length>0?d+="/..":d="..",m=2)}else d.length>0?d+="/"+c.slice(b+1,x):d=c.slice(b+1,x),m=x-b-1;b=x,S=0}else w===46&&S!==-1?++S:S=-1}return d}l(e,"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,b=arguments.length-1;b>=-1&&!d;b--){var S;b>=0?S=arguments[b]:(m===void 0&&(m=n.cwd()),S=m),t(S),S.length!==0&&(a=S+"/"+a,d=S.charCodeAt(0)===47)}return a=e(a,!d),d?a.length>0?"/"+a:"/":a.length>0?a:"."},"resolve"),normalize:l(function(a){if(t(a),a.length===0)return".";var d=a.charCodeAt(0)===47,m=a.charCodeAt(a.length-1)===47;return a=e(a,!d),a.length===0&&!d&&(a="."),a.length>0&&m&&(a+="/"),d?"/"+a:a},"normalize"),isAbsolute:l(function(a){return t(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];t(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(t(a),t(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 b=a.length,S=b-m,w=1;w<d.length&&d.charCodeAt(w)===47;++w);for(var x=d.length,F=x-w,C=S<F?S:F,v=-1,_=0;_<=C;++_){if(_===C){if(F>C){if(d.charCodeAt(w+_)===47)return d.slice(w+_+1);if(_===0)return d.slice(w+_)}else S>C&&(a.charCodeAt(m+_)===47?v=_:_===0&&(v=0));break}var A=a.charCodeAt(m+_),L=d.charCodeAt(w+_);if(A!==L)break;A===47&&(v=_)}var V="";for(_=m+v+1;_<=b;++_)(_===b||a.charCodeAt(_)===47)&&(V.length===0?V+="..":V+="/..");return V.length>0?V+d.slice(w+v):(w+=v,d.charCodeAt(w)===47&&++w,d.slice(w))},"relative"),_makeLong:l(function(a){return a},"_makeLong"),dirname:l(function(a){if(t(a),a.length===0)return".";for(var d=a.charCodeAt(0),m=d===47,b=-1,S=!0,w=a.length-1;w>=1;--w)if(d=a.charCodeAt(w),d===47){if(!S){b=w;break}}else S=!1;return b===-1?m?"/":".":m&&b===1?"//":a.slice(0,b)},"dirname"),basename:l(function(a,d){if(d!==void 0&&typeof d!="string")throw new TypeError('"ext" argument must be a string');t(a);var m=0,b=-1,S=!0,w;if(d!==void 0&&d.length>0&&d.length<=a.length){if(d.length===a.length&&d===a)return"";var x=d.length-1,F=-1;for(w=a.length-1;w>=0;--w){var C=a.charCodeAt(w);if(C===47){if(!S){m=w+1;break}}else F===-1&&(S=!1,F=w+1),x>=0&&(C===d.charCodeAt(x)?--x===-1&&(b=w):(x=-1,b=F))}return m===b?b=F:b===-1&&(b=a.length),a.slice(m,b)}else{for(w=a.length-1;w>=0;--w)if(a.charCodeAt(w)===47){if(!S){m=w+1;break}}else b===-1&&(S=!1,b=w+1);return b===-1?"":a.slice(m,b)}},"basename"),extname:l(function(a){t(a);for(var d=-1,m=0,b=-1,S=!0,w=0,x=a.length-1;x>=0;--x){var F=a.charCodeAt(x);if(F===47){if(!S){m=x+1;break}continue}b===-1&&(S=!1,b=x+1),F===46?d===-1?d=x:w!==1&&(w=1):d!==-1&&(w=-1)}return d===-1||b===-1||w===0||w===1&&d===b-1&&d===m+1?"":a.slice(d,b)},"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){t(a);var d={root:"",dir:"",base:"",ext:"",name:""};if(a.length===0)return d;var m=a.charCodeAt(0),b=m===47,S;b?(d.root="/",S=1):S=0;for(var w=-1,x=0,F=-1,C=!0,v=a.length-1,_=0;v>=S;--v){if(m=a.charCodeAt(v),m===47){if(!C){x=v+1;break}continue}F===-1&&(C=!1,F=v+1),m===46?w===-1?w=v:_!==1&&(_=1):w!==-1&&(_=-1)}return w===-1||F===-1||_===0||_===1&&w===F-1&&w===x+1?F!==-1&&(x===0&&b?d.base=d.name=a.slice(1,F):d.base=d.name=a.slice(x,F)):(x===0&&b?(d.name=a.slice(1,w),d.base=a.slice(1,F)):(d.name=a.slice(x,w),d.base=a.slice(x,F)),d.ext=a.slice(w,F)),x>0?d.dir=a.slice(0,x-1):b&&(d.dir="/"),d},"parse"),sep:"/",delimiter:":",win32:null,posix:null};return o.posix=o,qt=o,qt}l(us,"dew");var Z=us();var ac=Z._makeLong,re=Z.basename,cc=Z.delimiter,U=Z.dirname,lc=Z.extname,uc=Z.format,dc=Z.isAbsolute,Ee=Z.join,fc=Z.normalize,hc=Z.parse,Ne=Z.posix,mn=Z.relative,ve=Z.resolve,Ve=Z.sep,mc=Z.win32;var He={};ot(He,{COPYFILE_EXCL:()=>hs,COPYFILE_FICLONE:()=>ms,COPYFILE_FICLONE_FORCE:()=>ps,F_OK:()=>ds,O_APPEND:()=>Fs,O_CREAT:()=>ws,O_DIRECT:()=>Ts,O_DIRECTORY:()=>xs,O_DSYNC:()=>Bs,O_EXCL:()=>Ss,O_NOATIME:()=>Cs,O_NOCTTY:()=>Es,O_NOFOLLOW:()=>_s,O_NONBLOCK:()=>Ns,O_RDONLY:()=>gs,O_RDWR:()=>bs,O_SYMLINK:()=>Is,O_SYNC:()=>ks,O_TRUNC:()=>vs,O_WRONLY:()=>ys,R_OK:()=>_e,S_IFBLK:()=>As,S_IFCHR:()=>Os,S_IFDIR:()=>vt,S_IFIFO:()=>Ps,S_IFLNK:()=>Ft,S_IFMT:()=>de,S_IFREG:()=>Et,S_IFSOCK:()=>Rs,S_IRGRP:()=>Vs,S_IROTH:()=>js,S_IRUSR:()=>Ds,S_IRWXG:()=>zs,S_IRWXO:()=>Ks,S_IRWXU:()=>Ls,S_IWGRP:()=>Ws,S_IWOTH:()=>Ys,S_IWUSR:()=>Us,S_IXGRP:()=>$s,S_IXOTH:()=>Xs,S_IXUSR:()=>Ms,W_OK:()=>Oe,X_OK:()=>fs});var ds=0,_e=4,Oe=2,fs=1,hs=1,ms=2,ps=4,gs=0,ys=1,bs=2,ws=64,Ss=128,Es=256,vs=512,Fs=1024,xs=65536,Cs=262144,_s=131072,ks=1052672,Bs=4096,Is=32768,Ts=16384,Ns=2048,de=61440,Et=32768,vt=16384,Os=8192,As=24576,Ps=4096,Ft=40960,Rs=49152,Ls=448,Ds=256,Us=128,Ms=64,zs=56,Vs=32,Ws=16,$s=8,Ks=7,js=4,Ys=2,Xs=1;var Jt=class{constructor(t,e,i,o,c,a){this.uid=t;this.gid=e;this.suid=i;this.sgid=o;this.euid=c;this.egid=a}},q=Jt;l(q,"Cred"),q.Root=new Jt(0,0,0,0,0,0);var G=(i=>(i[i.FILE=32768]="FILE",i[i.DIRECTORY=16384]="DIRECTORY",i[i.SYMLINK=40960]="SYMLINK",i))(G||{}),Q=class{constructor(t,e,i,o,c,a,d,m,b){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=e;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 b!="number"&&(S||(S=Date.now()),b=S),typeof d!="number"&&(d=0),typeof m!="number"&&(m=0),this.atimeMs=o,this.ctimeMs=a,this.mtimeMs=c,this.birthtimeMs=b,i)this.mode=i;else switch(t){case G.FILE:this.mode=420;break;case G.DIRECTORY:default:this.mode=511}this.blocks=Math.ceil(e/512),this.mode&61440||(this.mode|=t)}static fromBuffer(t){let e=t.readUInt32LE(0),i=t.readUInt32LE(4),o=t.readDoubleLE(8),c=t.readDoubleLE(16),a=t.readDoubleLE(24),d=t.readUInt32LE(32),m=t.readUInt32LE(36);return new Q(i&61440,e,i&-61441,o,c,a,d,m)}static clone(t){return new Q(t.mode&61440,t.size,t.mode&-61441,t.atimeMs,t.mtimeMs,t.ctimeMs,t.uid,t.gid,t.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 t=k.alloc(32);return t.writeUInt32LE(this.size,0),t.writeUInt32LE(this.mode,4),t.writeDoubleLE(this.atime.getTime(),8),t.writeDoubleLE(this.mtime.getTime(),16),t.writeDoubleLE(this.ctime.getTime(),24),t.writeUInt32LE(this.uid,32),t.writeUInt32LE(this.gid,36),t}isFile(){return(this.mode&61440)===32768}isDirectory(){return(this.mode&61440)===16384}isSymbolicLink(){return(this.mode&61440)===40960}hasAccess(t,e){if(e.euid===0||e.egid===0)return!0;let i=this.mode&-61441,o=15,c=15,a=15;if(e.euid==this.uid){let b=(3840&i)>>8;o=(t^b)&t}if(e.egid==this.gid){let b=(240&i)>>4;c=(t^b)&t}let d=15&i;return a=(t^d)&t,!(o&c&a)}getCred(t=this.uid,e=this.gid){return new q(t,e,this.uid,this.gid,t,e)}chmod(t){this.mode=this.mode&61440|t}chown(t,e){!isNaN(+t)&&0<=+t&&+t<P(2,32)&&(this.uid=t),!isNaN(+e)&&0<=+e&&+e<P(2,32)&&(this.gid=e)}isSocket(){return!1}isBlockDevice(){return!1}isCharacterDevice(){return!1}isFIFO(){return!1}};l(Q,"Stats");var Ct=(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))(Ct||{}),$e=class{static getFileFlag(t){return $e.flagCache.has(t)||$e.flagCache.set(t,new $e(t)),$e.flagCache.get(t)}constructor(t){if(this.flagStr=t,$e.validFlagStrs.indexOf(t)<0)throw new h(22,"Invalid flag: "+t)}getFlagString(){return this.flagStr}getMode(){let t=0;return t<<=1,t+=+this.isReadable(),t<<=1,t+=+this.isWriteable(),t<<=1,t}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=$e;l(O,"FileFlag"),O.flagCache=new Map,O.validFlagStrs=["r","r+","rs","rs+","w","wx","w+","wx+","a","ax","a+","ax+"];var ct=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(t,e){return g(this,null,function*(){throw new h(95)})}chownSync(t,e){throw new h(95)}chmod(t){return g(this,null,function*(){throw new h(95)})}chmodSync(t){throw new h(95)}utimes(t,e){return g(this,null,function*(){throw new h(95)})}utimesSync(t,e){throw new h(95)}};l(ct,"BaseFile");var ce=class extends ct{constructor(e,i,o,c,a){super();this._pos=0;this._dirty=!1;if(this._fs=e,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(e){return this._pos+=e}setPos(e){return this._pos=e}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 Q.clone(this._stat)})}statSync(){return Q.clone(this._stat)}truncate(e){if(this.truncateSync(e),this._flag.isSynchronous()&&!Ge("/").metadata.synchronous)return this.sync()}truncateSync(e){if(this._dirty=!0,!this._flag.isWriteable())throw new h(1,"File not opened with a writeable mode.");if(this._stat.mtimeMs=Date.now(),e>this._buffer.length){let o=k.alloc(e-this._buffer.length,0);this.writeSync(o,0,o.length,this._buffer.length),this._flag.isSynchronous()&&Ge("/").metadata.synchronous&&this.syncSync();return}this._stat.size=e;let i=k.alloc(e);this._buffer.copy(i,0,0,e),this._buffer=i,this._flag.isSynchronous()&&Ge("/").metadata.synchronous&&this.syncSync()}write(e,i,o,c){return g(this,null,function*(){return this.writeSync(e,i,o,c)})}writeSync(e,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=e.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(e,i,o,c){return g(this,null,function*(){return{bytesRead:this.readSync(e,i,o,c),buffer:e}})}readSync(e,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(e,i,c,c+o);return this._stat.atimeMs=Date.now(),this._pos=c+o,d}chmod(e){return g(this,null,function*(){this.chmodSync(e)})}chmodSync(e){if(!this._fs.metadata.supportsProperties)throw new h(95);this._dirty=!0,this._stat.chmod(e),this.syncSync()}chown(e,i){return g(this,null,function*(){this.chownSync(e,i)})}chownSync(e,i){if(!this._fs.metadata.supportsProperties)throw new h(95);this._dirty=!0,this._stat.chown(e,i),this.syncSync()}isDirty(){return this._dirty}resetDirty(){this._dirty=!1}};l(ce,"PreloadFile");var xt=class extends ce{constructor(t,e,i,o,c){super(t,e,i,o,c)}sync(){return g(this,null,function*(){})}syncSync(){}close(){return g(this,null,function*(){})}closeSync(){}};l(xt,"NoSyncFile");var Ae=class{constructor(t){}};l(Ae,"FileSystem");var Ht=class extends Ae{constructor(e){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(e,i,o){return g(this,null,function*(){throw new h(95)})}createFile(e,i,o,c){return g(this,null,function*(){throw new h(95)})}open(e,i,o,c){return g(this,null,function*(){try{let a=yield this.stat(e,c);switch(i.pathExistsAction()){case 1:throw h.EEXIST(e);case 2:let d=yield this.openFile(e,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(e,i,c);default:throw new h(22,"Invalid FileFlag object.")}}catch(a){switch(i.pathNotExistsAction()){case 3:let d=yield this.stat(U(e),c);if(d&&!d.isDirectory())throw h.ENOTDIR(U(e));return this.createFile(e,i,o,c);case 1:throw h.ENOENT(e);default:throw new h(22,"Invalid FileFlag object.")}}})}access(e,i,o){return g(this,null,function*(){throw new h(95)})}accessSync(e,i,o){throw new h(95)}rename(e,i,o){return g(this,null,function*(){throw new h(95)})}renameSync(e,i,o){throw new h(95)}stat(e,i){return g(this,null,function*(){throw new h(95)})}statSync(e,i){throw new h(95)}openFileSync(e,i,o){throw new h(95)}createFileSync(e,i,o,c){throw new h(95)}openSync(e,i,o,c){let a;try{a=this.statSync(e,c)}catch(d){switch(i.pathNotExistsAction()){case 3:if(!this.statSync(U(e),c).isDirectory())throw h.ENOTDIR(U(e));return this.createFileSync(e,i,o,c);case 1:throw h.ENOENT(e);default:throw new h(22,"Invalid FileFlag object.")}}if(!a.hasAccess(o,c))throw h.EACCES(e);switch(i.pathExistsAction()){case 1:throw h.EEXIST(e);case 2:return this.unlinkSync(e,c),this.createFileSync(e,i,a.mode,c);case 0:return this.openFileSync(e,i,c);default:throw new h(22,"Invalid FileFlag object.")}}unlink(e,i){return g(this,null,function*(){throw new h(95)})}unlinkSync(e,i){throw new h(95)}rmdir(e,i){return g(this,null,function*(){throw new h(95)})}rmdirSync(e,i){throw new h(95)}mkdir(e,i,o){return g(this,null,function*(){throw new h(95)})}mkdirSync(e,i,o){throw new h(95)}readdir(e,i){return g(this,null,function*(){throw new h(95)})}readdirSync(e,i){throw new h(95)}exists(e,i){return g(this,null,function*(){try{return yield this.stat(e,i),!0}catch(o){return!1}})}existsSync(e,i){try{return this.statSync(e,i),!0}catch(o){return!1}}realpath(e,i){return g(this,null,function*(){if(this.metadata.supportsLinks){let o=e.split(Ve);for(let c=0;c<o.length;c++){let a=o.slice(0,c+1);o[c]=Ee(...a)}return o.join(Ve)}else{if(!(yield this.exists(e,i)))throw h.ENOENT(e);return e}})}realpathSync(e,i){if(this.metadata.supportsLinks){let o=e.split(Ve);for(let c=0;c<o.length;c++){let a=o.slice(0,c+1);o[c]=Ee(...a)}return o.join(Ve)}else{if(this.existsSync(e,i))return e;throw h.ENOENT(e)}}truncate(e,i,o){return g(this,null,function*(){let c=yield this.open(e,O.getFileFlag("r+"),420,o);try{yield c.truncate(i)}finally{yield c.close()}})}truncateSync(e,i,o){let c=this.openSync(e,O.getFileFlag("r+"),420,o);try{c.truncateSync(i)}finally{c.closeSync()}}readFile(e,i,o,c){return g(this,null,function*(){let a=yield this.open(e,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(e,i,o,c){let a=this.openSync(e,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(e,i,o,c,a,d){return g(this,null,function*(){let m=yield this.open(e,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(e,i,o,c,a,d){let m=this.openSync(e,c,a,d);try{typeof i=="string"&&(i=k.from(i,o)),m.writeSync(i,0,i.length,0)}finally{m.closeSync()}}appendFile(e,i,o,c,a,d){return g(this,null,function*(){let m=yield this.open(e,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(e,i,o,c,a,d){let m=this.openSync(e,c,a,d);try{typeof i=="string"&&(i=k.from(i,o)),m.writeSync(i,0,i.length,null)}finally{m.closeSync()}}chmod(e,i,o){return g(this,null,function*(){throw new h(95)})}chmodSync(e,i,o){throw new h(95)}chown(e,i,o,c){return g(this,null,function*(){throw new h(95)})}chownSync(e,i,o,c){throw new h(95)}utimes(e,i,o,c){return g(this,null,function*(){throw new h(95)})}utimesSync(e,i,o,c){throw new h(95)}link(e,i,o){return g(this,null,function*(){throw new h(95)})}linkSync(e,i,o){throw new h(95)}symlink(e,i,o,c){return g(this,null,function*(){throw new h(95)})}symlinkSync(e,i,o,c){throw new h(95)}readlink(e,i){return g(this,null,function*(){throw new h(95)})}readlinkSync(e,i){throw new h(95)}},fe=Ht;l(fe,"BaseFileSystem"),fe.Name=Ht.name;var Pe=class extends fe{get metadata(){return Se(ge({},super.metadata),{synchronous:!0})}access(t,e,i){return g(this,null,function*(){return this.accessSync(t,e,i)})}rename(t,e,i){return g(this,null,function*(){return this.renameSync(t,e,i)})}stat(t,e){return g(this,null,function*(){return this.statSync(t,e)})}open(t,e,i,o){return g(this,null,function*(){return this.openSync(t,e,i,o)})}unlink(t,e){return g(this,null,function*(){return this.unlinkSync(t,e)})}rmdir(t,e){return g(this,null,function*(){return this.rmdirSync(t,e)})}mkdir(t,e,i){return g(this,null,function*(){return this.mkdirSync(t,e,i)})}readdir(t,e){return g(this,null,function*(){return this.readdirSync(t,e)})}chmod(t,e,i){return g(this,null,function*(){return this.chmodSync(t,e,i)})}chown(t,e,i,o){return g(this,null,function*(){return this.chownSync(t,e,i,o)})}utimes(t,e,i,o){return g(this,null,function*(){return this.utimesSync(t,e,i,o)})}link(t,e,i){return g(this,null,function*(){return this.linkSync(t,e,i)})}symlink(t,e,i,o){return g(this,null,function*(){return this.symlinkSync(t,e,i,o)})}readlink(t,e){return g(this,null,function*(){return this.readlinkSync(t,e)})}};l(Pe,"SynchronousFileSystem");var se=class{constructor(t,e,i,o,c,a,d,m){this.id=t;this.size=e;this.mode=i;this.atime=o;this.mtime=c;this.ctime=a;this.uid=d;this.gid=m}static fromBuffer(t){if(t===void 0)throw new Error("NO");return new se(t.toString("ascii",38),t.readUInt32LE(0),t.readUInt16LE(4),t.readDoubleLE(6),t.readDoubleLE(14),t.readDoubleLE(22),t.readUInt32LE(30),t.readUInt32LE(34))}toStats(){return new Q((this.mode&61440)===G.DIRECTORY?G.DIRECTORY:G.FILE,this.size,this.mode,this.atime,this.mtime,this.ctime,this.uid,this.gid)}getSize(){return 38+this.id.length}toBuffer(t=k.alloc(this.getSize())){return t.writeUInt32LE(this.size,0),t.writeUInt16LE(this.mode,4),t.writeDoubleLE(this.atime,6),t.writeDoubleLE(this.mtime,14),t.writeDoubleLE(this.ctime,22),t.writeUInt32LE(this.uid,30),t.writeUInt32LE(this.gid,34),t.write(this.id,38,this.id.length,"ascii"),t}update(t){let e=!1;this.size!==t.size&&(this.size=t.size,e=!0),this.mode!==t.mode&&(this.mode=t.mode,e=!0);let i=t.atime.getTime();this.atime!==i&&(this.atime=i,e=!0);let o=t.mtime.getTime();this.mtime!==o&&(this.mtime=o,e=!0);let c=t.ctime.getTime();return this.ctime!==c&&(this.ctime=c,e=!0),this.uid!==t.uid&&(this.uid=t.uid,e=!0),this.uid!==t.uid&&(this.uid=t.uid,e=!0),e}isFile(){return(this.mode&61440)===G.FILE}isDirectory(){return(this.mode&61440)===G.DIRECTORY}};l(se,"Inode");function pn(n,t,e,i){i.existsSync(n,e)||(pn(U(n),t,e,i),i.mkdirSync(n,t,e))}l(pn,"mkdirpSync");function qs(n,t=0,e=n.length){if(t<0||e<0||e>n.length||t>e)throw new TypeError(`Invalid slice bounds on buffer of length ${n.length}: [${t}, ${e}]`);return n.length===0?k.alloc(0):n.subarray(t,e)}l(qs,"copyingSlice");function Js(n){return g(this,null,function*(){if(!k.isBuffer(n))throw new h(22,"option must be a Buffer.")})}l(Js,"bufferValidator");function _t(n,t,e,i,o){return Math.min(n+1,t+1,e+1,i===o?t:t+1)}l(_t,"_min");function Hs(n,t){if(n===t)return 0;n.length>t.length&&([n,t]=[t,n]);let e=n.length,i=t.length;for(;e>0&&n.charCodeAt(e-1)===t.charCodeAt(i-1);)e--,i--;let o=0;for(;o<e&&n.charCodeAt(o)===t.charCodeAt(o);)o++;if(e-=o,i-=o,e===0||i===1)return i;let c=new Array(e<<1);for(let x=0;x<e;)c[e+x]=n.charCodeAt(o+x),c[x]=++x;let a,d,m,b,S;for(a=0;a+3<i;){let x=t.charCodeAt(o+(d=a)),F=t.charCodeAt(o+(m=a+1)),C=t.charCodeAt(o+(b=a+2)),v=t.charCodeAt(o+(S=a+3)),_=a+=4;for(let A=0;A<e;){let L=c[e+A],V=c[A];d=_t(V,d,m,x,L),m=_t(d,m,b,F,L),b=_t(m,b,S,C,L),_=_t(b,S,_,v,L),c[A++]=_,S=b,b=m,m=d,d=V}}let w=0;for(;a<i;){let x=t.charCodeAt(o+(d=a));w=++a;for(let F=0;F<e;F++){let C=c[F];c[F]=w=C<d||w<d?C>w?w+1:C+1:x===c[e+F]?d:d+1,d=C}}return w}l(Hs,"levenshtein");function Gt(n,t){return g(this,null,function*(){let e=n.Options,i=n.Name,o=0,c=!1,a=!1;for(let d in e)if(Object.prototype.hasOwnProperty.call(e,d)){let m=e[d],b=t&&t[d];if(b==null){if(!m.optional){let S=Object.keys(t).filter(w=>!(w in e)).map(w=>({str:w,distance:Hs(d,w)})).filter(w=>w.distance<5).sort((w,x)=>w.distance-x.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 Qe=Object.defineProperty,Fr=Object.defineProperties,vr=Object.getOwnPropertyDescriptor,Cr=Object.getOwnPropertyDescriptors,xr=Object.getOwnPropertyNames,Ni=Object.getOwnPropertySymbols,_r=Object.getPrototypeOf,Ai=Object.prototype.hasOwnProperty,kr=Object.prototype.propertyIsEnumerable,Br=Reflect.get;var A=Math.pow,Oi=(s,t,e)=>t in s?Qe(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,pe=(s,t)=>{for(var e in t||(t={}))Ai.call(t,e)&&Oi(s,e,t[e]);if(Ni)for(var e of Ni(t))kr.call(t,e)&&Oi(s,e,t[e]);return s},we=(s,t)=>Fr(s,Cr(t)),l=(s,t)=>Qe(s,"name",{value:t,configurable:!0});var ut=(s,t)=>{for(var e in t)Qe(s,e,{get:t[e],enumerable:!0})},Ir=(s,t,e,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of xr(t))!Ai.call(s,o)&&o!==e&&Qe(s,o,{get:()=>t[o],enumerable:!(i=vr(t,o))||i.enumerable});return s};var Tr=s=>Ir(Qe({},"__esModule",{value:!0}),s);var Pi=(s,t,e)=>Br(_r(s),e,t);var g=(s,t,e)=>new Promise((i,o)=>{var c=m=>{try{d(e.next(m))}catch(b){o(b)}},a=m=>{try{d(e.throw(m))}catch(b){o(b)}},d=m=>m.done?i(m.value):Promise.resolve(m.value).then(c,a);d((e=e.apply(s,t)).next())});var Gs={};ut(Gs,{ActionType:()=>gt,ApiError:()=>h,AsyncKeyValueFile:()=>He,AsyncKeyValueFileSystem:()=>Nt,AsyncMirror:()=>Ce,BaseFile:()=>tt,BaseFileSystem:()=>de,Cred:()=>K,ErrorCode:()=>te,ErrorStrings:()=>G,FileFlag:()=>N,FileSystem:()=>Ie,FileType:()=>H,FolderAdapter:()=>ye,InMemory:()=>he,NoSyncFile:()=>pt,OverlayFS:()=>Fe,PreloadFile:()=>ae,ROOT_NODE_ID:()=>fe,SimpleSyncRWTransaction:()=>Ye,Stats:()=>Q,SyncKeyValueFile:()=>Xe,SyncKeyValueFileSystem:()=>qe,SynchronousFileSystem:()=>Te,backends:()=>It,bufferValidator:()=>En,checkOptions:()=>Mt,configure:()=>qs,copyingSlice:()=>Sn,default:()=>Js,fs:()=>_t,getEmptyDirNode:()=>it,getFileSystem:()=>rr,initialize:()=>ir,mkdirpSync:()=>Vi,randomUUID:()=>Me,registerBackend:()=>er,setImmediate:()=>xn,toPromise:()=>Cn,wait:()=>vn});var et={},Ri=!1;function Nr(){if(Ri)return et;Ri=!0,et.byteLength=d,et.toByteArray=b,et.fromByteArray=C;for(var s=[],t=[],e=typeof Uint8Array!="undefined"?Uint8Array:Array,i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o=0,c=i.length;o<c;++o)s[o]=i[o],t[i.charCodeAt(o)]=o;t["-".charCodeAt(0)]=62,t["_".charCodeAt(0)]=63;function a(v){var x=v.length;if(x%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var F=v.indexOf("=");F===-1&&(F=x);var _=F===x?0:4-F%4;return[F,_]}l(a,"getLens");function d(v){var x=a(v),F=x[0],_=x[1];return(F+_)*3/4-_}l(d,"byteLength");function m(v,x,F){return(x+F)*3/4-F}l(m,"_byteLength");function b(v){var x,F=a(v),_=F[0],O=F[1],R=new e(m(v,_,O)),V=0,oe=O>0?_-4:_,ee;for(ee=0;ee<oe;ee+=4)x=t[v.charCodeAt(ee)]<<18|t[v.charCodeAt(ee+1)]<<12|t[v.charCodeAt(ee+2)]<<6|t[v.charCodeAt(ee+3)],R[V++]=x>>16&255,R[V++]=x>>8&255,R[V++]=x&255;return O===2&&(x=t[v.charCodeAt(ee)]<<2|t[v.charCodeAt(ee+1)]>>4,R[V++]=x&255),O===1&&(x=t[v.charCodeAt(ee)]<<10|t[v.charCodeAt(ee+1)]<<4|t[v.charCodeAt(ee+2)]>>2,R[V++]=x>>8&255,R[V++]=x&255),R}l(b,"toByteArray");function S(v){return s[v>>18&63]+s[v>>12&63]+s[v>>6&63]+s[v&63]}l(S,"tripletToBase64");function w(v,x,F){for(var _,O=[],R=x;R<F;R+=3)_=(v[R]<<16&16711680)+(v[R+1]<<8&65280)+(v[R+2]&255),O.push(S(_));return O.join("")}l(w,"encodeChunk");function C(v){for(var x,F=v.length,_=F%3,O=[],R=16383,V=0,oe=F-_;V<oe;V+=R)O.push(w(v,V,V+R>oe?oe:V+R));return _===1?(x=v[F-1],O.push(s[x>>2]+s[x<<4&63]+"==")):_===2&&(x=(v[F-2]<<8)+v[F-1],O.push(s[x>>10]+s[x>>4&63]+s[x<<2&63]+"=")),O.join("")}return l(C,"fromByteArray"),et}l(Nr,"dew$2");var dt={},Li=!1;function Or(){if(Li)return dt;Li=!0;return dt.read=function(s,t,e,i,o){var c,a,d=o*8-i-1,m=(1<<d)-1,b=m>>1,S=-7,w=e?o-1:0,C=e?-1:1,v=s[t+w];for(w+=C,c=v&(1<<-S)-1,v>>=-S,S+=d;S>0;c=c*256+s[t+w],w+=C,S-=8);for(a=c&(1<<-S)-1,c>>=-S,S+=i;S>0;a=a*256+s[t+w],w+=C,S-=8);if(c===0)c=1-b;else{if(c===m)return a?NaN:(v?-1:1)*(1/0);a=a+Math.pow(2,i),c=c-b}return(v?-1:1)*a*Math.pow(2,c-i)},dt.write=function(s,t,e,i,o,c){var a,d,m,b=c*8-o-1,S=(1<<b)-1,w=S>>1,C=o===23?Math.pow(2,-24)-Math.pow(2,-77):0,v=i?0:c-1,x=i?1:-1,F=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(d=isNaN(t)?1:0,a=S):(a=Math.floor(Math.log(t)/Math.LN2),t*(m=Math.pow(2,-a))<1&&(a--,m*=2),a+w>=1?t+=C/m:t+=C*Math.pow(2,1-w),t*m>=2&&(a++,m/=2),a+w>=S?(d=0,a=S):a+w>=1?(d=(t*m-1)*Math.pow(2,o),a=a+w):(d=t*Math.pow(2,w-1)*Math.pow(2,o),a=0));o>=8;s[e+v]=d&255,v+=x,d/=256,o-=8);for(a=a<<o|d,b+=o;b>0;s[e+v]=a&255,v+=x,a/=256,b-=8);s[e+v-x]|=F*128},dt}l(Or,"dew$1");var Pe={},Di=!1;function Ar(){if(Di)return Pe;Di=!0;let s=Nr(),t=Or(),e=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Pe.Buffer=a,Pe.SlowBuffer=O,Pe.INSPECT_MAX_BYTES=50;let i=2147483647;Pe.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 v(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(be(u,ArrayBuffer)||u&&be(u.buffer,ArrayBuffer)||typeof SharedArrayBuffer!="undefined"&&(be(u,SharedArrayBuffer)||u&&be(u.buffer,SharedArrayBuffer)))return x(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 b(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(b,"alloc"),a.alloc=function(u,r,n){return b(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=R(u,r)|0,f=c(n),p=f.write(u,r);return p!==n&&(f=f.slice(0,p)),f}l(w,"fromString");function C(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(C,"fromArrayLike");function v(u){if(be(u,Uint8Array)){let r=new Uint8Array(u);return x(r.buffer,r.byteOffset,r.byteLength)}return C(u)}l(v,"fromArrayView");function x(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(x,"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"||Pt(u.length)?c(0):C(u);if(u.type==="Buffer"&&Array.isArray(u.data))return C(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 O(u){return+u!=u&&(u=0),a.alloc(+u)}l(O,"SlowBuffer"),a.isBuffer=l(function(r){return r!=null&&r._isBuffer===!0&&r!==a.prototype},"isBuffer"),a.compare=l(function(r,n){if(be(r,Uint8Array)&&(r=a.from(r,r.offset,r.byteLength)),be(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 y=0,E=Math.min(f,p);y<E;++y)if(r[y]!==n[y]){f=r[y],p=n[y];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),y=0;for(f=0;f<r.length;++f){let E=r[f];if(be(E,Uint8Array))y+E.length>p.length?(a.isBuffer(E)||(E=a.from(E)),E.copy(p,y)):Uint8Array.prototype.set.call(p,E,y);else if(a.isBuffer(E))E.copy(p,y);else throw new TypeError('"list" argument must be an Array of Buffers');y+=E.length}return p},"concat");function R(u,r){if(a.isBuffer(u))return u.length;if(ArrayBuffer.isView(u)||be(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 At(u).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return n*2;case"hex":return n>>>1;case"base64":return Ti(u).length;default:if(p)return f?-1:At(u).length;r=(""+r).toLowerCase(),p=!0}}l(R,"byteLength"),a.byteLength=R;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 hr(this,r,n);case"utf8":case"utf-8":return Ei(this,r,n);case"ascii":return dr(this,r,n);case"latin1":case"binary":return fr(this,r,n);case"base64":return lr(this,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return mr(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 oe(u,r,n){let f=u[r];u[r]=u[n],u[n]=f}l(oe,"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)oe(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)oe(this,n,n+3),oe(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)oe(this,n,n+7),oe(this,n+1,n+6),oe(this,n+2,n+5),oe(this,n+3,n+4);return this},"swap64"),a.prototype.toString=l(function(){let r=this.length;return r===0?"":arguments.length===0?Ei(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=Pe.INSPECT_MAX_BYTES;return r=this.toString("hex",0,n).replace(/(.{2})/g,"$1 ").trim(),this.length>n&&(r+=" ... "),"<Buffer "+r+">"},"inspect"),e&&(a.prototype[e]=a.prototype.inspect),a.prototype.compare=l(function(r,n,f,p,y){if(be(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),y===void 0&&(y=this.length),n<0||f>r.length||p<0||y>this.length)throw new RangeError("out of range index");if(p>=y&&n>=f)return 0;if(p>=y)return-1;if(n>=f)return 1;if(n>>>=0,f>>>=0,p>>>=0,y>>>=0,this===r)return 0;let E=y-p,T=f-n,W=Math.min(E,T),M=this.slice(p,y),$=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 ee(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,Pt(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:Si(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):Si(u,[r],n,f,p);throw new TypeError("val must be string, number or Buffer")}l(ee,"bidirectionalIndexOf");function Si(u,r,n,f,p){let y=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;y=2,E/=2,T/=2,n/=2}function W($,L){return y===1?$[L]:$.readUInt16BE(L*y)}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 $*y}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(Si,"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 ee(this,r,n,f,!0)},"indexOf"),a.prototype.lastIndexOf=l(function(r,n,f){return ee(this,r,n,f,!1)},"lastIndexOf");function nr(u,r,n,f){n=Number(n)||0;let p=u.length-n;f?(f=Number(f),f>p&&(f=p)):f=p;let y=r.length;f>y/2&&(f=y/2);let E;for(E=0;E<f;++E){let T=parseInt(r.substr(E*2,2),16);if(Pt(T))return E;u[n+E]=T}return E}l(nr,"hexWrite");function sr(u,r,n,f){return lt(At(r,u.length-n),u,n,f)}l(sr,"utf8Write");function or(u,r,n,f){return lt(br(r),u,n,f)}l(or,"asciiWrite");function ar(u,r,n,f){return lt(Ti(r),u,n,f)}l(ar,"base64Write");function cr(u,r,n,f){return lt(wr(r,u.length-n),u,n,f)}l(cr,"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 y=this.length-n;if((f===void 0||f>y)&&(f=y),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 nr(this,r,n,f);case"utf8":case"utf-8":return sr(this,r,n,f);case"ascii":case"latin1":case"binary":return or(this,r,n,f);case"base64":return ar(this,r,n,f);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return cr(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 lr(u,r,n){return r===0&&n===u.length?s.fromByteArray(u):s.fromByteArray(u.slice(r,n))}l(lr,"base64Slice");function Ei(u,r,n){n=Math.min(u.length,n);let f=[],p=r;for(;p<n;){let y=u[p],E=null,T=y>239?4:y>223?3:y>191?2:1;if(p+T<=n){let W,M,$,L;switch(T){case 1:y<128&&(E=y);break;case 2:W=u[p+1],(W&192)===128&&(L=(y&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=(y&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=(y&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 ur(f)}l(Ei,"utf8Slice");let Fi=4096;function ur(u){let r=u.length;if(r<=Fi)return String.fromCharCode.apply(String,u);let n="",f=0;for(;f<r;)n+=String.fromCharCode.apply(String,u.slice(f,f+=Fi));return n}l(ur,"decodeCodePointsArray");function dr(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(dr,"asciiSlice");function fr(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(fr,"latin1Slice");function hr(u,r,n){let f=u.length;(!r||r<0)&&(r=0),(!n||n<0||n>f)&&(n=f);let p="";for(let y=r;y<n;++y)p+=Sr[u[y]];return p}l(hr,"hexSlice");function mr(u,r,n){let f=u.slice(r,n),p="";for(let y=0;y<f.length-1;y+=2)p+=String.fromCharCode(f[y]+f[y+1]*256);return p}l(mr,"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 J(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(J,"checkOffset"),a.prototype.readUintLE=a.prototype.readUIntLE=l(function(r,n,f){r=r>>>0,n=n>>>0,f||J(r,n,this.length);let p=this[r],y=1,E=0;for(;++E<n&&(y*=256);)p+=this[r+E]*y;return p},"readUIntLE"),a.prototype.readUintBE=a.prototype.readUIntBE=l(function(r,n,f){r=r>>>0,n=n>>>0,f||J(r,n,this.length);let p=this[r+--n],y=1;for(;n>0&&(y*=256);)p+=this[r+--n]*y;return p},"readUIntBE"),a.prototype.readUint8=a.prototype.readUInt8=l(function(r,n){return r=r>>>0,n||J(r,1,this.length),this[r]},"readUInt8"),a.prototype.readUint16LE=a.prototype.readUInt16LE=l(function(r,n){return r=r>>>0,n||J(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||J(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||J(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||J(r,4,this.length),this[r]*16777216+(this[r+1]<<16|this[r+2]<<8|this[r+3])},"readUInt32BE"),a.prototype.readBigUInt64LE=_e(l(function(r){r=r>>>0,We(r,"offset");let n=this[r],f=this[r+7];(n===void 0||f===void 0)&&Ze(r,this.length-8);let p=n+this[++r]*A(2,8)+this[++r]*A(2,16)+this[++r]*A(2,24),y=this[++r]+this[++r]*A(2,8)+this[++r]*A(2,16)+f*A(2,24);return BigInt(p)+(BigInt(y)<<BigInt(32))},"readBigUInt64LE")),a.prototype.readBigUInt64BE=_e(l(function(r){r=r>>>0,We(r,"offset");let n=this[r],f=this[r+7];(n===void 0||f===void 0)&&Ze(r,this.length-8);let p=n*A(2,24)+this[++r]*A(2,16)+this[++r]*A(2,8)+this[++r],y=this[++r]*A(2,24)+this[++r]*A(2,16)+this[++r]*A(2,8)+f;return(BigInt(p)<<BigInt(32))+BigInt(y)},"readBigUInt64BE")),a.prototype.readIntLE=l(function(r,n,f){r=r>>>0,n=n>>>0,f||J(r,n,this.length);let p=this[r],y=1,E=0;for(;++E<n&&(y*=256);)p+=this[r+E]*y;return y*=128,p>=y&&(p-=Math.pow(2,8*n)),p},"readIntLE"),a.prototype.readIntBE=l(function(r,n,f){r=r>>>0,n=n>>>0,f||J(r,n,this.length);let p=n,y=1,E=this[r+--p];for(;p>0&&(y*=256);)E+=this[r+--p]*y;return y*=128,E>=y&&(E-=Math.pow(2,8*n)),E},"readIntBE"),a.prototype.readInt8=l(function(r,n){return r=r>>>0,n||J(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||J(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||J(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||J(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||J(r,4,this.length),this[r]<<24|this[r+1]<<16|this[r+2]<<8|this[r+3]},"readInt32BE"),a.prototype.readBigInt64LE=_e(l(function(r){r=r>>>0,We(r,"offset");let n=this[r],f=this[r+7];(n===void 0||f===void 0)&&Ze(r,this.length-8);let p=this[r+4]+this[r+5]*A(2,8)+this[r+6]*A(2,16)+(f<<24);return(BigInt(p)<<BigInt(32))+BigInt(n+this[++r]*A(2,8)+this[++r]*A(2,16)+this[++r]*A(2,24))},"readBigInt64LE")),a.prototype.readBigInt64BE=_e(l(function(r){r=r>>>0,We(r,"offset");let n=this[r],f=this[r+7];(n===void 0||f===void 0)&&Ze(r,this.length-8);let p=(n<<24)+this[++r]*A(2,16)+this[++r]*A(2,8)+this[++r];return(BigInt(p)<<BigInt(32))+BigInt(this[++r]*A(2,24)+this[++r]*A(2,16)+this[++r]*A(2,8)+f)},"readBigInt64BE")),a.prototype.readFloatLE=l(function(r,n){return r=r>>>0,n||J(r,4,this.length),t.read(this,r,!0,23,4)},"readFloatLE"),a.prototype.readFloatBE=l(function(r,n){return r=r>>>0,n||J(r,4,this.length),t.read(this,r,!1,23,4)},"readFloatBE"),a.prototype.readDoubleLE=l(function(r,n){return r=r>>>0,n||J(r,8,this.length),t.read(this,r,!0,52,8)},"readDoubleLE"),a.prototype.readDoubleBE=l(function(r,n){return r=r>>>0,n||J(r,8,this.length),t.read(this,r,!1,52,8)},"readDoubleBE");function re(u,r,n,f,p,y){if(!a.isBuffer(u))throw new TypeError('"buffer" argument must be a Buffer instance');if(r>p||r<y)throw new RangeError('"value" argument is out of bounds');if(n+f>u.length)throw new RangeError("Index out of range")}l(re,"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;re(this,r,n,f,T,0)}let y=1,E=0;for(this[n]=r&255;++E<f&&(y*=256);)this[n+E]=r/y&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;re(this,r,n,f,T,0)}let y=f-1,E=1;for(this[n+y]=r&255;--y>=0&&(E*=256);)this[n+y]=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||re(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||re(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||re(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||re(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||re(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 vi(u,r,n,f,p){Ii(r,f,p,u,n,7);let y=Number(r&BigInt(4294967295));u[n++]=y,y=y>>8,u[n++]=y,y=y>>8,u[n++]=y,y=y>>8,u[n++]=y;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(vi,"wrtBigUInt64LE");function Ci(u,r,n,f,p){Ii(r,f,p,u,n,7);let y=Number(r&BigInt(4294967295));u[n+7]=y,y=y>>8,u[n+6]=y,y=y>>8,u[n+5]=y,y=y>>8,u[n+4]=y;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(Ci,"wrtBigUInt64BE"),a.prototype.writeBigUInt64LE=_e(l(function(r,n=0){return vi(this,r,n,BigInt(0),BigInt("0xffffffffffffffff"))},"writeBigUInt64LE")),a.prototype.writeBigUInt64BE=_e(l(function(r,n=0){return Ci(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);re(this,r,n,f,W-1,-W)}let y=0,E=1,T=0;for(this[n]=r&255;++y<f&&(E*=256);)r<0&&T===0&&this[n+y-1]!==0&&(T=1),this[n+y]=(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);re(this,r,n,f,W-1,-W)}let y=f-1,E=1,T=0;for(this[n+y]=r&255;--y>=0&&(E*=256);)r<0&&T===0&&this[n+y+1]!==0&&(T=1),this[n+y]=(r/E>>0)-T&255;return n+f},"writeIntBE"),a.prototype.writeInt8=l(function(r,n,f){return r=+r,n=n>>>0,f||re(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||re(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||re(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||re(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||re(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=_e(l(function(r,n=0){return vi(this,r,n,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))},"writeBigInt64LE")),a.prototype.writeBigInt64BE=_e(l(function(r,n=0){return Ci(this,r,n,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))},"writeBigInt64BE"));function xi(u,r,n,f,p,y){if(n+f>u.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}l(xi,"checkIEEE754");function _i(u,r,n,f,p){return r=+r,n=n>>>0,p||xi(u,r,n,4),t.write(u,r,n,f,23,4),n+4}l(_i,"writeFloat"),a.prototype.writeFloatLE=l(function(r,n,f){return _i(this,r,n,!0,f)},"writeFloatLE"),a.prototype.writeFloatBE=l(function(r,n,f){return _i(this,r,n,!1,f)},"writeFloatBE");function ki(u,r,n,f,p){return r=+r,n=n>>>0,p||xi(u,r,n,8),t.write(u,r,n,f,52,8),n+8}l(ki,"writeDouble"),a.prototype.writeDoubleLE=l(function(r,n,f){return ki(this,r,n,!0,f)},"writeDoubleLE"),a.prototype.writeDoubleBE=l(function(r,n,f){return ki(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 y=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),y},"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 y;if(typeof r=="number")for(y=n;y<f;++y)this[y]=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(y=0;y<f-n;++y)this[y+n]=E[y%T]}return this},"fill");let Ve={};function Ot(u,r,n){Ve[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(Ot,"E"),Ot("ERR_BUFFER_OUT_OF_BOUNDS",function(u){return u?`${u} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),Ot("ERR_INVALID_ARG_TYPE",function(u,r){return`The "${u}" argument must be of type number. Received type ${typeof r}`},TypeError),Ot("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)>A(2,32)?p=Bi(String(n)):typeof n=="bigint"&&(p=String(n),(n>A(BigInt(2),BigInt(32))||n<-A(BigInt(2),BigInt(32)))&&(p=Bi(p)),p+="n"),f+=` It must be ${r}. Received ${p}`,f},RangeError);function Bi(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(Bi,"addNumericalSeparator");function pr(u,r,n){We(r,"offset"),(u[r]===void 0||u[r+n]===void 0)&&Ze(r,u.length-(n+1))}l(pr,"checkBounds");function Ii(u,r,n,f,p,y){if(u>n||u<r){let E=typeof r=="bigint"?"n":"",T;throw y>3?r===0||r===BigInt(0)?T=`>= 0${E} and < 2${E} ** ${(y+1)*8}${E}`:T=`>= -(2${E} ** ${(y+1)*8-1}${E}) and < 2 ** ${(y+1)*8-1}${E}`:T=`>= ${r}${E} and <= ${n}${E}`,new Ve.ERR_OUT_OF_RANGE("value",T,u)}pr(f,p,y)}l(Ii,"checkIntBI");function We(u,r){if(typeof u!="number")throw new Ve.ERR_INVALID_ARG_TYPE(r,"number",u)}l(We,"validateNumber");function Ze(u,r,n){throw Math.floor(u)!==u?(We(u,n),new Ve.ERR_OUT_OF_RANGE(n||"offset","an integer",u)):r<0?new Ve.ERR_BUFFER_OUT_OF_BOUNDS:new Ve.ERR_OUT_OF_RANGE(n||"offset",`>= ${n?1:0} and <= ${r}`,u)}l(Ze,"boundsError");let gr=/[^+/0-9A-Za-z-_]/g;function yr(u){if(u=u.split("=")[0],u=u.trim().replace(gr,""),u.length<2)return"";for(;u.length%4!==0;)u=u+"=";return u}l(yr,"base64clean");function At(u,r){r=r||1/0;let n,f=u.length,p=null,y=[];for(let E=0;E<f;++E){if(n=u.charCodeAt(E),n>55295&&n<57344){if(!p){if(n>56319){(r-=3)>-1&&y.push(239,191,189);continue}else if(E+1===f){(r-=3)>-1&&y.push(239,191,189);continue}p=n;continue}if(n<56320){(r-=3)>-1&&y.push(239,191,189),p=n;continue}n=(p-55296<<10|n-56320)+65536}else p&&(r-=3)>-1&&y.push(239,191,189);if(p=null,n<128){if((r-=1)<0)break;y.push(n)}else if(n<2048){if((r-=2)<0)break;y.push(n>>6|192,n&63|128)}else if(n<65536){if((r-=3)<0)break;y.push(n>>12|224,n>>6&63|128,n&63|128)}else if(n<1114112){if((r-=4)<0)break;y.push(n>>18|240,n>>12&63|128,n>>6&63|128,n&63|128)}else throw new Error("Invalid code point")}return y}l(At,"utf8ToBytes");function br(u){let r=[];for(let n=0;n<u.length;++n)r.push(u.charCodeAt(n)&255);return r}l(br,"asciiToBytes");function wr(u,r){let n,f,p,y=[];for(let E=0;E<u.length&&!((r-=2)<0);++E)n=u.charCodeAt(E),f=n>>8,p=n%256,y.push(p),y.push(f);return y}l(wr,"utf16leToBytes");function Ti(u){return s.toByteArray(yr(u))}l(Ti,"base64ToBytes");function lt(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(lt,"blitBuffer");function be(u,r){return u instanceof r||u!=null&&u.constructor!=null&&u.constructor.name!=null&&u.constructor.name===r.name}l(be,"isInstance");function Pt(u){return u!==u}l(Pt,"numberIsNaN");let Sr=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 _e(u){return typeof BigInt=="undefined"?Er:u}l(_e,"defineBigIntMethod");function Er(){throw new Error("BigInt not supported")}return l(Er,"BufferBigIntNotDefined"),Pe}l(Ar,"dew");var Re=Ar();Re.Buffer;Re.SlowBuffer;Re.INSPECT_MAX_BYTES;Re.kMaxLength;var k=Re.Buffer,Qs=Re.INSPECT_MAX_BYTES,eo=Re.kMaxLength;var yi={};ut(yi,{_toUnixTimestamp:()=>$i,access:()=>ds,accessSync:()=>js,appendFile:()=>Vn,appendFileSync:()=>Fs,chmod:()=>os,chmodSync:()=>Vs,chown:()=>ns,chownSync:()=>Ms,close:()=>$n,closeSync:()=>Cs,constants:()=>Ke,createReadStream:()=>ps,createWriteStream:()=>gs,exists:()=>An,existsSync:()=>Xi,fchmod:()=>Gn,fchmodSync:()=>Ns,fchown:()=>Jn,fchownSync:()=>Ts,fdatasync:()=>Yn,fdatasyncSync:()=>ks,fstat:()=>Wn,fstatSync:()=>vs,fsync:()=>jn,fsyncSync:()=>_s,ftruncate:()=>Kn,ftruncateSync:()=>xs,futimes:()=>Hn,futimesSync:()=>Os,getMount:()=>je,getMounts:()=>ji,initialize:()=>Yi,lchmod:()=>as,lchmodSync:()=>Ws,lchown:()=>ss,lchownSync:()=>zs,link:()=>ts,linkSync:()=>Ls,lstat:()=>Rn,lstatSync:()=>ws,lutimes:()=>ls,lutimesSync:()=>Ks,mkdir:()=>Qn,mkdirSync:()=>Ps,mount:()=>St,open:()=>Un,openSync:()=>Es,promises:()=>nt,read:()=>qn,readFile:()=>Mn,readFileSync:()=>Ji,readSync:()=>Is,readdir:()=>es,readdirSync:()=>Rs,readlink:()=>rs,readlinkSync:()=>Us,realpath:()=>us,realpathSync:()=>gi,rename:()=>On,renameSync:()=>ys,rmdir:()=>Zn,rmdirSync:()=>As,stat:()=>Pn,statSync:()=>bs,symlink:()=>is,symlinkSync:()=>Ds,truncate:()=>Ln,truncateSync:()=>Ss,umount:()=>Vt,unlink:()=>Dn,unlinkSync:()=>qi,unwatchFile:()=>hs,utimes:()=>cs,utimesSync:()=>$s,watch:()=>ms,watchFile:()=>fs,write:()=>Xn,writeFile:()=>zn,writeFileSync:()=>Gi,writeSync:()=>Bs});var te=(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))(te||{}),G={};G[1]="Operation not permitted.";G[2]="No such file or directory.";G[5]="Input/output error.";G[9]="Bad file descriptor.";G[13]="Permission denied.";G[16]="Resource busy or locked.";G[17]="File exists.";G[20]="File is not a directory.";G[21]="File is a directory.";G[22]="Invalid argument.";G[27]="File is too big.";G[28]="No space left on disk.";G[30]="Cannot modify a read-only file system.";G[39]="Directory is not empty.";G[95]="Operation is not supported.";var h=class extends Error{constructor(e,i=G[e],o){super(i);this.syscall="";this.errno=e,this.code=te[e],this.path=o,this.message=`Error: ${this.code}: ${i}${this.path?`, '${this.path}'`:""}`}static fromJSON(e){let i=new h(e.errno,e.message,e.path);return i.code=e.code,i.stack=e.stack,i}static fromBuffer(e,i=0){return h.fromJSON(JSON.parse(e.toString("utf8",i+4,i+4+e.readUInt32LE(i))))}static FileError(e,i){return new h(e,G[e],i)}static EACCES(e){return this.FileError(13,e)}static ENOENT(e){return this.FileError(2,e)}static EEXIST(e){return this.FileError(17,e)}static EISDIR(e){return this.FileError(21,e)}static ENOTDIR(e){return this.FileError(20,e)}static EPERM(e){return this.FileError(1,e)}static ENOTEMPTY(e){return this.FileError(39,e)}toString(){return this.message}toJSON(){return{errno:this.errno,code:this.code,path:this.path,stack:this.stack,message:this.message}}writeToBuffer(e=k.alloc(this.bufferSize()),i=0){let o=e.write(JSON.stringify(this.toJSON()),i+4);return e.writeUInt32LE(o,i),e}bufferSize(){return 4+k.byteLength(JSON.stringify(this.toJSON()))}};l(h,"ApiError");var Rt={},Ui=!1,$e=typeof globalThis!="undefined"?globalThis:typeof self!="undefined"?self:global;function Pr(){if(Ui)return Rt;Ui=!0;var s=Rt={},t,e;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"?t=setTimeout:t=i}catch(F){t=i}try{typeof clearTimeout=="function"?e=clearTimeout:e=o}catch(F){e=o}}();function c(F){if(t===setTimeout)return setTimeout(F,0);if((t===i||!t)&&setTimeout)return t=setTimeout,setTimeout(F,0);try{return t(F,0)}catch(_){try{return t.call(null,F,0)}catch(O){return t.call(this||$e,F,0)}}}l(c,"runTimeout");function a(F){if(e===clearTimeout)return clearTimeout(F);if((e===o||!e)&&clearTimeout)return e=clearTimeout,clearTimeout(F);try{return e(F)}catch(_){try{return e.call(null,F)}catch(O){return e.call(this||$e,F)}}}l(a,"runClearTimeout");var d=[],m=!1,b,S=-1;function w(){!m||!b||(m=!1,b.length?d=b.concat(d):S=-1,d.length&&C())}l(w,"cleanUpNextTick");function C(){if(!m){var F=c(w);m=!0;for(var _=d.length;_;){for(b=d,d=[];++S<_;)b&&b[S].run();S=-1,_=d.length}b=null,m=!1,a(F)}}l(C,"drainQueue"),s.nextTick=function(F){var _=new Array(arguments.length-1);if(arguments.length>1)for(var O=1;O<arguments.length;O++)_[O-1]=arguments[O];d.push(new v(F,_)),d.length===1&&!m&&c(C)};function v(F,_){(this||$e).fun=F,(this||$e).array=_}l(v,"Item"),v.prototype.run=function(){(this||$e).fun.apply(null,(this||$e).array)},s.title="browser",s.browser=!0,s.env={},s.argv=[],s.version="",s.versions={};function x(){}return l(x,"noop"),s.on=x,s.addListener=x,s.once=x,s.off=x,s.removeListener=x,s.removeAllListeners=x,s.emit=x,s.prependListener=x,s.prependOnceListener=x,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},Rt}l(Pr,"dew");var z=Pr();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 Lt={},Mi=!1;function Rr(){if(Mi)return Lt;Mi=!0;var s=z;function t(c){if(typeof c!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(c))}l(t,"assertPath");function e(c,a){for(var d="",m=0,b=-1,S=0,w,C=0;C<=c.length;++C){if(C<c.length)w=c.charCodeAt(C);else{if(w===47)break;w=47}if(w===47){if(!(b===C-1||S===1))if(b!==C-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 v=d.lastIndexOf("/");if(v!==d.length-1){v===-1?(d="",m=0):(d=d.slice(0,v),m=d.length-1-d.lastIndexOf("/")),b=C,S=0;continue}}else if(d.length===2||d.length===1){d="",m=0,b=C,S=0;continue}}a&&(d.length>0?d+="/..":d="..",m=2)}else d.length>0?d+="/"+c.slice(b+1,C):d=c.slice(b+1,C),m=C-b-1;b=C,S=0}else w===46&&S!==-1?++S:S=-1}return d}l(e,"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,b=arguments.length-1;b>=-1&&!d;b--){var S;b>=0?S=arguments[b]:(m===void 0&&(m=s.cwd()),S=m),t(S),S.length!==0&&(a=S+"/"+a,d=S.charCodeAt(0)===47)}return a=e(a,!d),d?a.length>0?"/"+a:"/":a.length>0?a:"."},"resolve"),normalize:l(function(a){if(t(a),a.length===0)return".";var d=a.charCodeAt(0)===47,m=a.charCodeAt(a.length-1)===47;return a=e(a,!d),a.length===0&&!d&&(a="."),a.length>0&&m&&(a+="/"),d?"/"+a:a},"normalize"),isAbsolute:l(function(a){return t(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];t(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(t(a),t(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 b=a.length,S=b-m,w=1;w<d.length&&d.charCodeAt(w)===47;++w);for(var C=d.length,v=C-w,x=S<v?S:v,F=-1,_=0;_<=x;++_){if(_===x){if(v>x){if(d.charCodeAt(w+_)===47)return d.slice(w+_+1);if(_===0)return d.slice(w+_)}else S>x&&(a.charCodeAt(m+_)===47?F=_:_===0&&(F=0));break}var O=a.charCodeAt(m+_),R=d.charCodeAt(w+_);if(O!==R)break;O===47&&(F=_)}var V="";for(_=m+F+1;_<=b;++_)(_===b||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(t(a),a.length===0)return".";for(var d=a.charCodeAt(0),m=d===47,b=-1,S=!0,w=a.length-1;w>=1;--w)if(d=a.charCodeAt(w),d===47){if(!S){b=w;break}}else S=!1;return b===-1?m?"/":".":m&&b===1?"//":a.slice(0,b)},"dirname"),basename:l(function(a,d){if(d!==void 0&&typeof d!="string")throw new TypeError('"ext" argument must be a string');t(a);var m=0,b=-1,S=!0,w;if(d!==void 0&&d.length>0&&d.length<=a.length){if(d.length===a.length&&d===a)return"";var C=d.length-1,v=-1;for(w=a.length-1;w>=0;--w){var x=a.charCodeAt(w);if(x===47){if(!S){m=w+1;break}}else v===-1&&(S=!1,v=w+1),C>=0&&(x===d.charCodeAt(C)?--C===-1&&(b=w):(C=-1,b=v))}return m===b?b=v:b===-1&&(b=a.length),a.slice(m,b)}else{for(w=a.length-1;w>=0;--w)if(a.charCodeAt(w)===47){if(!S){m=w+1;break}}else b===-1&&(S=!1,b=w+1);return b===-1?"":a.slice(m,b)}},"basename"),extname:l(function(a){t(a);for(var d=-1,m=0,b=-1,S=!0,w=0,C=a.length-1;C>=0;--C){var v=a.charCodeAt(C);if(v===47){if(!S){m=C+1;break}continue}b===-1&&(S=!1,b=C+1),v===46?d===-1?d=C:w!==1&&(w=1):d!==-1&&(w=-1)}return d===-1||b===-1||w===0||w===1&&d===b-1&&d===m+1?"":a.slice(d,b)},"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){t(a);var d={root:"",dir:"",base:"",ext:"",name:""};if(a.length===0)return d;var m=a.charCodeAt(0),b=m===47,S;b?(d.root="/",S=1):S=0;for(var w=-1,C=0,v=-1,x=!0,F=a.length-1,_=0;F>=S;--F){if(m=a.charCodeAt(F),m===47){if(!x){C=F+1;break}continue}v===-1&&(x=!1,v=F+1),m===46?w===-1?w=F:_!==1&&(_=1):w!==-1&&(_=-1)}return w===-1||v===-1||_===0||_===1&&w===v-1&&w===C+1?v!==-1&&(C===0&&b?d.base=d.name=a.slice(1,v):d.base=d.name=a.slice(C,v)):(C===0&&b?(d.name=a.slice(1,w),d.base=a.slice(1,v)):(d.name=a.slice(C,w),d.base=a.slice(C,v)),d.ext=a.slice(w,v)),C>0?d.dir=a.slice(0,C-1):b&&(d.dir="/"),d},"parse"),sep:"/",delimiter:":",win32:null,posix:null};return o.posix=o,Lt=o,Lt}l(Rr,"dew");var Z=Rr();var Bo=Z._makeLong,ie=Z.basename,Io=Z.delimiter,D=Z.dirname,To=Z.extname,No=Z.format,Oo=Z.isAbsolute,Se=Z.join,Ao=Z.normalize,Po=Z.parse,ke=Z.posix,zi=Z.relative,Ee=Z.resolve,Le=Z.sep,Ro=Z.win32;var Dt=class{constructor(t,e,i,o,c,a){this.uid=t;this.gid=e;this.suid=i;this.sgid=o;this.euid=c;this.egid=a}},K=Dt;l(K,"Cred"),K.Root=new Dt(0,0,0,0,0,0);var Ke={};ut(Ke,{COPYFILE_EXCL:()=>Ur,COPYFILE_FICLONE:()=>Mr,COPYFILE_FICLONE_FORCE:()=>zr,F_OK:()=>Lr,O_APPEND:()=>qr,O_CREAT:()=>Kr,O_DIRECT:()=>tn,O_DIRECTORY:()=>Jr,O_DSYNC:()=>Qr,O_EXCL:()=>jr,O_NOATIME:()=>Gr,O_NOCTTY:()=>Yr,O_NOFOLLOW:()=>Hr,O_NONBLOCK:()=>rn,O_RDONLY:()=>Vr,O_RDWR:()=>$r,O_SYMLINK:()=>en,O_SYNC:()=>Zr,O_TRUNC:()=>Xr,O_WRONLY:()=>Wr,R_OK:()=>ve,S_IFBLK:()=>sn,S_IFCHR:()=>nn,S_IFDIR:()=>ht,S_IFIFO:()=>on,S_IFLNK:()=>mt,S_IFMT:()=>ue,S_IFREG:()=>ft,S_IFSOCK:()=>an,S_IRGRP:()=>hn,S_IROTH:()=>yn,S_IRUSR:()=>ln,S_IRWXG:()=>fn,S_IRWXO:()=>gn,S_IRWXU:()=>cn,S_IWGRP:()=>mn,S_IWOTH:()=>bn,S_IWUSR:()=>un,S_IXGRP:()=>pn,S_IXOTH:()=>wn,S_IXUSR:()=>dn,W_OK:()=>Be,X_OK:()=>Dr});var Lr=0,ve=4,Be=2,Dr=1,Ur=1,Mr=2,zr=4,Vr=0,Wr=1,$r=2,Kr=64,jr=128,Yr=256,Xr=512,qr=1024,Jr=65536,Gr=262144,Hr=131072,Zr=1052672,Qr=4096,en=32768,tn=16384,rn=2048,ue=61440,ft=32768,ht=16384,nn=8192,sn=24576,on=4096,mt=40960,an=49152,cn=448,ln=256,un=128,dn=64,fn=56,hn=32,mn=16,pn=8,gn=7,yn=4,bn=2,wn=1;var H=(i=>(i[i.FILE=32768]="FILE",i[i.DIRECTORY=16384]="DIRECTORY",i[i.SYMLINK=40960]="SYMLINK",i))(H||{}),Q=class{constructor(t,e,i,o,c,a,d,m,b){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=e;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 b!="number"&&(S||(S=Date.now()),b=S),typeof d!="number"&&(d=0),typeof m!="number"&&(m=0),this.atimeMs=o,this.ctimeMs=a,this.mtimeMs=c,this.birthtimeMs=b,i)this.mode=i;else switch(t){case H.FILE:this.mode=420;break;case H.DIRECTORY:default:this.mode=511}this.blocks=Math.ceil(e/512),this.mode&61440||(this.mode|=t)}static fromBuffer(t){let e=t.readUInt32LE(0),i=t.readUInt32LE(4),o=t.readDoubleLE(8),c=t.readDoubleLE(16),a=t.readDoubleLE(24),d=t.readUInt32LE(32),m=t.readUInt32LE(36);return new Q(i&61440,e,i&-61441,o,c,a,d,m)}static clone(t){return new Q(t.mode&61440,t.size,t.mode&-61441,t.atimeMs,t.mtimeMs,t.ctimeMs,t.uid,t.gid,t.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 t=k.alloc(32);return t.writeUInt32LE(this.size,0),t.writeUInt32LE(this.mode,4),t.writeDoubleLE(this.atime.getTime(),8),t.writeDoubleLE(this.mtime.getTime(),16),t.writeDoubleLE(this.ctime.getTime(),24),t.writeUInt32LE(this.uid,32),t.writeUInt32LE(this.gid,36),t}isFile(){return(this.mode&61440)===32768}isDirectory(){return(this.mode&61440)===16384}isSymbolicLink(){return(this.mode&61440)===40960}hasAccess(t,e){if(e.euid===0||e.egid===0)return!0;let i=this.mode&-61441,o=15,c=15,a=15;if(e.euid==this.uid){let b=(3840&i)>>8;o=(t^b)&t}if(e.egid==this.gid){let b=(240&i)>>4;c=(t^b)&t}let d=15&i;return a=(t^d)&t,!(o&c&a)}getCred(t=this.uid,e=this.gid){return new K(t,e,this.uid,this.gid,t,e)}chmod(t){this.mode=this.mode&61440|t}chown(t,e){!isNaN(+t)&&0<=+t&&+t<A(2,32)&&(this.uid=t),!isNaN(+e)&&0<=+e&&+e<A(2,32)&&(this.gid=e)}isSocket(){return!1}isBlockDevice(){return!1}isCharacterDevice(){return!1}isFIFO(){return!1}};l(Q,"Stats");var gt=(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))(gt||{}),Ue=class{static getFileFlag(t){return Ue.flagCache.has(t)||Ue.flagCache.set(t,new Ue(t)),Ue.flagCache.get(t)}constructor(t){if(this.flagStr=t,Ue.validFlagStrs.indexOf(t)<0)throw new h(22,"Invalid flag: "+t)}getFlagString(){return this.flagStr}getMode(){let t=0;return t<<=1,t+=+this.isReadable(),t<<=1,t+=+this.isWriteable(),t<<=1,t}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}},N=Ue;l(N,"FileFlag"),N.flagCache=new Map,N.validFlagStrs=["r","r+","rs","rs+","w","wx","w+","wx+","a","ax","a+","ax+"];var tt=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(t,e){return g(this,null,function*(){throw new h(95)})}chownSync(t,e){throw new h(95)}chmod(t){return g(this,null,function*(){throw new h(95)})}chmodSync(t){throw new h(95)}utimes(t,e){return g(this,null,function*(){throw new h(95)})}utimesSync(t,e){throw new h(95)}};l(tt,"BaseFile");var ae=class extends tt{constructor(e,i,o,c,a){super();this._pos=0;this._dirty=!1;if(this._fs=e,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(e){return this._pos+=e}setPos(e){return this._pos=e}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 Q.clone(this._stat)})}statSync(){return Q.clone(this._stat)}truncate(e){if(this.truncateSync(e),this._flag.isSynchronous()&&!je("/").metadata.synchronous)return this.sync()}truncateSync(e){if(this._dirty=!0,!this._flag.isWriteable())throw new h(1,"File not opened with a writeable mode.");if(this._stat.mtimeMs=Date.now(),e>this._buffer.length){let o=k.alloc(e-this._buffer.length,0);this.writeSync(o,0,o.length,this._buffer.length),this._flag.isSynchronous()&&je("/").metadata.synchronous&&this.syncSync();return}this._stat.size=e;let i=k.alloc(e);this._buffer.copy(i,0,0,e),this._buffer=i,this._flag.isSynchronous()&&je("/").metadata.synchronous&&this.syncSync()}write(e,i,o,c){return g(this,null,function*(){return this.writeSync(e,i,o,c)})}writeSync(e,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=e.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(e,i,o,c){return g(this,null,function*(){return{bytesRead:this.readSync(e,i,o,c),buffer:e}})}readSync(e,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(e,i,c,c+o);return this._stat.atimeMs=Date.now(),this._pos=c+o,d}chmod(e){return g(this,null,function*(){this.chmodSync(e)})}chmodSync(e){if(!this._fs.metadata.supportsProperties)throw new h(95);this._dirty=!0,this._stat.chmod(e),this.syncSync()}chown(e,i){return g(this,null,function*(){this.chownSync(e,i)})}chownSync(e,i){if(!this._fs.metadata.supportsProperties)throw new h(95);this._dirty=!0,this._stat.chown(e,i),this.syncSync()}isDirty(){return this._dirty}resetDirty(){this._dirty=!1}};l(ae,"PreloadFile");var pt=class extends ae{constructor(t,e,i,o,c){super(t,e,i,o,c)}sync(){return g(this,null,function*(){})}syncSync(){}close(){return g(this,null,function*(){})}closeSync(){}};l(pt,"NoSyncFile");var Ie=class{constructor(t){}};l(Ie,"FileSystem");var Ut=class extends Ie{constructor(e){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(e,i,o){return g(this,null,function*(){throw new h(95)})}createFile(e,i,o,c){return g(this,null,function*(){throw new h(95)})}open(e,i,o,c){return g(this,null,function*(){try{let a=yield this.stat(e,c);switch(i.pathExistsAction()){case 1:throw h.EEXIST(e);case 2:let d=yield this.openFile(e,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(e,i,c);default:throw new h(22,"Invalid FileFlag object.")}}catch(a){switch(i.pathNotExistsAction()){case 3:let d=yield this.stat(D(e),c);if(d&&!d.isDirectory())throw h.ENOTDIR(D(e));return this.createFile(e,i,o,c);case 1:throw h.ENOENT(e);default:throw new h(22,"Invalid FileFlag object.")}}})}access(e,i,o){return g(this,null,function*(){throw new h(95)})}accessSync(e,i,o){throw new h(95)}rename(e,i,o){return g(this,null,function*(){throw new h(95)})}renameSync(e,i,o){throw new h(95)}stat(e,i){return g(this,null,function*(){throw new h(95)})}statSync(e,i){throw new h(95)}openFileSync(e,i,o){throw new h(95)}createFileSync(e,i,o,c){throw new h(95)}openSync(e,i,o,c){let a;try{a=this.statSync(e,c)}catch(d){switch(i.pathNotExistsAction()){case 3:if(!this.statSync(D(e),c).isDirectory())throw h.ENOTDIR(D(e));return this.createFileSync(e,i,o,c);case 1:throw h.ENOENT(e);default:throw new h(22,"Invalid FileFlag object.")}}if(!a.hasAccess(o,c))throw h.EACCES(e);switch(i.pathExistsAction()){case 1:throw h.EEXIST(e);case 2:return this.unlinkSync(e,c),this.createFileSync(e,i,a.mode,c);case 0:return this.openFileSync(e,i,c);default:throw new h(22,"Invalid FileFlag object.")}}unlink(e,i){return g(this,null,function*(){throw new h(95)})}unlinkSync(e,i){throw new h(95)}rmdir(e,i){return g(this,null,function*(){throw new h(95)})}rmdirSync(e,i){throw new h(95)}mkdir(e,i,o){return g(this,null,function*(){throw new h(95)})}mkdirSync(e,i,o){throw new h(95)}readdir(e,i){return g(this,null,function*(){throw new h(95)})}readdirSync(e,i){throw new h(95)}exists(e,i){return g(this,null,function*(){try{return yield this.stat(e,i),!0}catch(o){return!1}})}existsSync(e,i){try{return this.statSync(e,i),!0}catch(o){return!1}}realpath(e,i){return g(this,null,function*(){if(this.metadata.supportsLinks){let o=e.split(Le);for(let c=0;c<o.length;c++){let a=o.slice(0,c+1);o[c]=Se(...a)}return o.join(Le)}else{if(!(yield this.exists(e,i)))throw h.ENOENT(e);return e}})}realpathSync(e,i){if(this.metadata.supportsLinks){let o=e.split(Le);for(let c=0;c<o.length;c++){let a=o.slice(0,c+1);o[c]=Se(...a)}return o.join(Le)}else{if(this.existsSync(e,i))return e;throw h.ENOENT(e)}}truncate(e,i,o){return g(this,null,function*(){let c=yield this.open(e,N.getFileFlag("r+"),420,o);try{yield c.truncate(i)}finally{yield c.close()}})}truncateSync(e,i,o){let c=this.openSync(e,N.getFileFlag("r+"),420,o);try{c.truncateSync(i)}finally{c.closeSync()}}readFile(e,i,o,c){return g(this,null,function*(){let a=yield this.open(e,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(e,i,o,c){let a=this.openSync(e,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(e,i,o,c,a,d){return g(this,null,function*(){let m=yield this.open(e,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(e,i,o,c,a,d){let m=this.openSync(e,c,a,d);try{typeof i=="string"&&(i=k.from(i,o)),m.writeSync(i,0,i.length,0)}finally{m.closeSync()}}appendFile(e,i,o,c,a,d){return g(this,null,function*(){let m=yield this.open(e,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(e,i,o,c,a,d){let m=this.openSync(e,c,a,d);try{typeof i=="string"&&(i=k.from(i,o)),m.writeSync(i,0,i.length,null)}finally{m.closeSync()}}chmod(e,i,o){return g(this,null,function*(){throw new h(95)})}chmodSync(e,i,o){throw new h(95)}chown(e,i,o,c){return g(this,null,function*(){throw new h(95)})}chownSync(e,i,o,c){throw new h(95)}utimes(e,i,o,c){return g(this,null,function*(){throw new h(95)})}utimesSync(e,i,o,c){throw new h(95)}link(e,i,o){return g(this,null,function*(){throw new h(95)})}linkSync(e,i,o){throw new h(95)}symlink(e,i,o,c){return g(this,null,function*(){throw new h(95)})}symlinkSync(e,i,o,c){throw new h(95)}readlink(e,i){return g(this,null,function*(){throw new h(95)})}readlinkSync(e,i){throw new h(95)}},de=Ut;l(de,"BaseFileSystem"),de.Name=Ut.name;var Te=class extends de{get metadata(){return we(pe({},super.metadata),{synchronous:!0})}access(t,e,i){return g(this,null,function*(){return this.accessSync(t,e,i)})}rename(t,e,i){return g(this,null,function*(){return this.renameSync(t,e,i)})}stat(t,e){return g(this,null,function*(){return this.statSync(t,e)})}open(t,e,i,o){return g(this,null,function*(){return this.openSync(t,e,i,o)})}unlink(t,e){return g(this,null,function*(){return this.unlinkSync(t,e)})}rmdir(t,e){return g(this,null,function*(){return this.rmdirSync(t,e)})}mkdir(t,e,i){return g(this,null,function*(){return this.mkdirSync(t,e,i)})}readdir(t,e){return g(this,null,function*(){return this.readdirSync(t,e)})}chmod(t,e,i){return g(this,null,function*(){return this.chmodSync(t,e,i)})}chown(t,e,i,o){return g(this,null,function*(){return this.chownSync(t,e,i,o)})}utimes(t,e,i,o){return g(this,null,function*(){return this.utimesSync(t,e,i,o)})}link(t,e,i){return g(this,null,function*(){return this.linkSync(t,e,i)})}symlink(t,e,i,o){return g(this,null,function*(){return this.symlinkSync(t,e,i,o)})}readlink(t,e){return g(this,null,function*(){return this.readlinkSync(t,e)})}};l(Te,"SynchronousFileSystem");var ne=class{constructor(t,e,i,o,c,a,d,m){this.id=t;this.size=e;this.mode=i;this.atime=o;this.mtime=c;this.ctime=a;this.uid=d;this.gid=m}static fromBuffer(t){if(t===void 0)throw new Error("NO");return new ne(t.toString("ascii",38),t.readUInt32LE(0),t.readUInt16LE(4),t.readDoubleLE(6),t.readDoubleLE(14),t.readDoubleLE(22),t.readUInt32LE(30),t.readUInt32LE(34))}toStats(){return new Q((this.mode&61440)===H.DIRECTORY?H.DIRECTORY:H.FILE,this.size,this.mode,this.atime,this.mtime,this.ctime,this.uid,this.gid)}getSize(){return 38+this.id.length}toBuffer(t=k.alloc(this.getSize())){return t.writeUInt32LE(this.size,0),t.writeUInt16LE(this.mode,4),t.writeDoubleLE(this.atime,6),t.writeDoubleLE(this.mtime,14),t.writeDoubleLE(this.ctime,22),t.writeUInt32LE(this.uid,30),t.writeUInt32LE(this.gid,34),t.write(this.id,38,this.id.length,"ascii"),t}update(t){let e=!1;this.size!==t.size&&(this.size=t.size,e=!0),this.mode!==t.mode&&(this.mode=t.mode,e=!0);let i=t.atime.getTime();this.atime!==i&&(this.atime=i,e=!0);let o=t.mtime.getTime();this.mtime!==o&&(this.mtime=o,e=!0);let c=t.ctime.getTime();return this.ctime!==c&&(this.ctime=c,e=!0),this.uid!==t.uid&&(this.uid=t.uid,e=!0),this.uid!==t.uid&&(this.uid=t.uid,e=!0),e}isFile(){return(this.mode&61440)===H.FILE}isDirectory(){return(this.mode&61440)===H.DIRECTORY}};l(ne,"Inode");function Vi(s,t,e,i){i.existsSync(s,e)||(Vi(D(s),t,e,i),i.mkdirSync(s,t,e))}l(Vi,"mkdirpSync");function Sn(s,t=0,e=s.length){if(t<0||e<0||e>s.length||t>e)throw new TypeError(`Invalid slice bounds on buffer of length ${s.length}: [${t}, ${e}]`);return s.length===0?k.alloc(0):s.subarray(t,e)}l(Sn,"copyingSlice");function En(s){return g(this,null,function*(){if(!k.isBuffer(s))throw new h(22,"option must be a Buffer.")})}l(En,"bufferValidator");function yt(s,t,e,i,o){return Math.min(s+1,t+1,e+1,i===o?t:t+1)}l(yt,"_min");function Fn(s,t){if(s===t)return 0;s.length>t.length&&([s,t]=[t,s]);let e=s.length,i=t.length;for(;e>0&&s.charCodeAt(e-1)===t.charCodeAt(i-1);)e--,i--;let o=0;for(;o<e&&s.charCodeAt(o)===t.charCodeAt(o);)o++;if(e-=o,i-=o,e===0||i===1)return i;let c=new Array(e<<1);for(let C=0;C<e;)c[e+C]=s.charCodeAt(o+C),c[C]=++C;let a,d,m,b,S;for(a=0;a+3<i;){let C=t.charCodeAt(o+(d=a)),v=t.charCodeAt(o+(m=a+1)),x=t.charCodeAt(o+(b=a+2)),F=t.charCodeAt(o+(S=a+3)),_=a+=4;for(let O=0;O<e;){let R=c[e+O],V=c[O];d=yt(V,d,m,C,R),m=yt(d,m,b,v,R),b=yt(m,b,S,x,R),_=yt(b,S,_,F,R),c[O++]=_,S=b,b=m,m=d,d=V}}let w=0;for(;a<i;){let C=t.charCodeAt(o+(d=a));w=++a;for(let v=0;v<e;v++){let x=c[v];c[v]=w=x<d||w<d?x>w?w+1:x+1:C===c[e+v]?d:d+1,d=x}}return w}l(Fn,"levenshtein");function Mt(s,t){return g(this,null,function*(){let e=s.Options,i=s.Name,o=0,c=!1,a=!1;for(let d in e)if(Object.prototype.hasOwnProperty.call(e,d)){let m=e[d],b=t&&t[d];if(b==null){if(!m.optional){let S=Object.keys(t).filter(w=>!(w in e)).map(w=>({str:w,distance:Fn(d,w)})).filter(w=>w.distance<5).sort((w,C)=>w.distance-C.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 b)!==-1:S=typeof b===m.type,S){if(m.validator){o++;try{yield m.validator(b)}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 b}
|
|
3
|
-
Option description: ${m.description}`)}}}a=!0})}l(Gt,"checkOptions");function Gs(n){return new Promise(t=>{setTimeout(t,n)})}l(Gs,"wait");function Zs(n){return function(...t){return new Promise((e,i)=>{t.push((o,...c)=>{o?i(o):e(c[0])}),n(...t)})}}l(Zs,"toPromise");var Qs=typeof globalThis.setImmediate=="function"?globalThis.setImmediate:n=>setTimeout(n,0),he="/";function lt(){return k.from("{}")}l(lt,"getEmptyDirNode");function Ke(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(n){let t=Math.random()*16|0;return(n==="x"?t:t&3|8).toString(16)})}l(Ke,"randomUUID");var Ze=class{constructor(t){this.store=t;this.originalData={};this.modifiedKeys=[]}get(t){let e=this.store.get(t);return this.stashOldValue(t,e),e}put(t,e,i){return this.markModified(t),this.store.put(t,e,i)}del(t){this.markModified(t),this.store.del(t)}commit(){}abort(){for(let t of this.modifiedKeys){let e=this.originalData[t];e?this.store.put(t,e,!0):this.store.del(t)}}_has(t){return Object.prototype.hasOwnProperty.call(this.originalData,t)}stashOldValue(t,e){this._has(t)||(this.originalData[t]=e)}markModified(t){this.modifiedKeys.indexOf(t)===-1&&(this.modifiedKeys.push(t),this._has(t)||(this.originalData[t]=this.store.get(t)))}};l(Ze,"SimpleSyncRWTransaction");var Qe=class extends ce{constructor(t,e,i,o,c){super(t,e,i,o,c)}syncSync(){this.isDirty()&&(this._fs._syncSync(this.getPath(),this.getBuffer(),this.getStats()),this.resetDirty())}closeSync(){this.syncSync()}};l(Qe,"SyncKeyValueFile");var et=class extends Pe{constructor(e){super();this.store=e.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(e,i,o){let c=this.store.beginTransaction("readonly");if(!this.findINode(c,e).toStats().hasAccess(i,o))throw h.EACCES(e)}renameSync(e,i,o){let c=this.store.beginTransaction("readwrite"),a=U(e),d=re(e),m=U(i),b=re(i),S=this.findINode(c,a),w=this.getDirListing(c,a,S);if(!S.toStats().hasAccess(2,o))throw h.EACCES(e);if(!w[d])throw h.ENOENT(e);let x=w[d];if(delete w[d],(m+"/").indexOf(e+"/")===0)throw new h(16,a);let F,C;if(m===a?(F=S,C=w):(F=this.findINode(c,m),C=this.getDirListing(c,m,F)),C[b]){let v=this.getINode(c,i,C[b]);if(v.isFile())try{c.del(v.id),c.del(C[b])}catch(_){throw c.abort(),_}else throw h.EPERM(i)}C[b]=x;try{c.put(S.id,k.from(JSON.stringify(w)),!0),c.put(F.id,k.from(JSON.stringify(C)),!0)}catch(v){throw c.abort(),v}c.commit()}statSync(e,i){let o=this.findINode(this.store.beginTransaction("readonly"),e).toStats();if(!o.hasAccess(4,i))throw h.EACCES(e);return o}createFileSync(e,i,o,c){let a=this.store.beginTransaction("readwrite"),d=k.alloc(0),m=this.commitNewFile(a,e,G.FILE,o,c,d);return new Qe(this,e,i,m.toStats(),d)}openFileSync(e,i,o){let c=this.store.beginTransaction("readonly"),a=this.findINode(c,e),d=c.get(a.id);if(!a.toStats().hasAccess(i.getMode(),o))throw h.EACCES(e);if(d===void 0)throw h.ENOENT(e);return new Qe(this,e,i,a.toStats(),d)}unlinkSync(e,i){this.removeEntry(e,!1,i)}rmdirSync(e,i){if(this.readdirSync(e,i).length>0)throw h.ENOTEMPTY(e);this.removeEntry(e,!0,i)}mkdirSync(e,i,o){let c=this.store.beginTransaction("readwrite"),a=k.from("{}");this.commitNewFile(c,e,G.DIRECTORY,i,o,a)}readdirSync(e,i){let o=this.store.beginTransaction("readonly"),c=this.findINode(o,e);if(!c.toStats().hasAccess(4,i))throw h.EACCES(e);return Object.keys(this.getDirListing(o,e,c))}chmodSync(e,i,o){this.openFileSync(e,O.getFileFlag("r+"),o).chmodSync(i)}chownSync(e,i,o,c){this.openFileSync(e,O.getFileFlag("r+"),c).chownSync(i,o)}_syncSync(e,i,o){let c=this.store.beginTransaction("readwrite"),a=this._findINode(c,U(e),re(e)),d=this.getINode(c,e,a),m=d.update(o);try{c.put(d.id,i,!0),m&&c.put(a,d.toBuffer(),!0)}catch(b){throw c.abort(),b}c.commit()}makeRootDirectory(){let e=this.store.beginTransaction("readwrite");if(e.get(he)===void 0){let i=new Date().getTime(),o=new se(Ke(),4096,511|G.DIRECTORY,i,i,i,0,0);e.put(o.id,lt(),!1),e.put(he,o.toBuffer(),!1),e.commit()}}_findINode(e,i,o,c=new Set){let a=Ne.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 b=this.getDirListing(e,i,m);if(b[o])return b[o];throw h.ENOENT(ve(i,o))},"readDirectory");return i==="."&&(i=N.cwd()),i==="/"?o===""?he:d(this.getINode(e,i,he)):d(this.getINode(e,i+Ve+o,this._findINode(e,U(i),re(i),c)))}findINode(e,i){return this.getINode(e,i,this._findINode(e,U(i),re(i)))}getINode(e,i,o){let c=e.get(o);if(c===void 0)throw h.ENOENT(i);return se.fromBuffer(c)}getDirListing(e,i,o){if(!o.isDirectory())throw h.ENOTDIR(i);let c=e.get(o.id);if(c===void 0)throw h.ENOENT(i);return JSON.parse(c.toString())}addNewNode(e,i){let c;for(;0<5;)try{return c=Ke(),e.put(c,i,!1),c}catch(a){}throw new h(5,"Unable to commit data to key-value store.")}commitNewFile(e,i,o,c,a,d){let m=U(i),b=re(i),S=this.findINode(e,m),w=this.getDirListing(e,m,S),x=new Date().getTime();if(!S.toStats().hasAccess(4,a))throw h.EACCES(i);if(i==="/")throw h.EEXIST(i);if(w[b])throw h.EEXIST(i);let F;try{let C=this.addNewNode(e,d);F=new se(C,d.length,c|o,x,x,x,a.uid,a.gid);let v=this.addNewNode(e,F.toBuffer());w[b]=v,e.put(S.id,k.from(JSON.stringify(w)),!0)}catch(C){throw e.abort(),C}return e.commit(),F}removeEntry(e,i,o){let c=this.store.beginTransaction("readwrite"),a=U(e),d=this.findINode(c,a),m=this.getDirListing(c,a,d),b=re(e);if(!m[b])throw h.ENOENT(e);let S=m[b],w=this.getINode(c,e,S);if(!w.toStats().hasAccess(2,o))throw h.EACCES(e);if(delete m[b],!i&&w.isDirectory())throw h.EISDIR(e);if(i&&!w.isDirectory())throw h.ENOTDIR(e);try{c.del(w.id),c.del(S),c.put(d.id,k.from(JSON.stringify(m)),!0)}catch(x){throw c.abort(),x}c.commit()}};l(et,"SyncKeyValueFileSystem");function Re(n,t){t=typeof n=="function"?n:t,Gt(this,n);let e=new this(typeof n=="function"?{}:n);if(typeof t!="function")return e.whenReady();e.whenReady().then(i=>t(null,i)).catch(i=>t(i))}l(Re,"CreateBackend");var kt=class{constructor(){this.store=new Map}name(){return me.Name}clear(){this.store.clear()}beginTransaction(t){return new Ze(this)}get(t){return this.store.get(t)}put(t,e,i){return!i&&this.store.has(t)?!1:(this.store.set(t,e),!0)}del(t){this.store.delete(t)}};l(kt,"InMemoryStore");var Zt=class extends et{constructor(){super({store:new kt})}},me=Zt;l(me,"InMemoryFileSystem"),me.Name="InMemory",me.Create=Re.bind(Zt),me.Options={};function yn(n){if(typeof n=="number")return n;if(n instanceof Date)return n.getTime()/1e3;throw new Error("Cannot parse time: "+n)}l(yn,"_toUnixTimestamp");function le(n,t){switch(typeof n){case"number":return n;case"string":let e=parseInt(n,8);return isNaN(e)?t:e;default:return t}}l(le,"normalizeMode");function oe(n){if(n instanceof Date)return n;if(typeof n=="number")return new Date(n*1e3);throw new h(22,"Invalid time.")}l(oe,"normalizeTime");function j(n){if(n.indexOf("\0")>=0)throw new h(22,"Path must be a string without null bytes.");if(n==="")throw new h(22,"Path must not be empty.");return n=n.replaceAll(/\/+/g,"/"),Ne.resolve(n)}l(j,"normalizePath");function Le(n,t,e,i){switch(n===null?"null":typeof n){case"object":return{encoding:typeof n.encoding!="undefined"?n.encoding:t,flag:typeof n.flag!="undefined"?n.flag:e,mode:le(n.mode,i)};case"string":return{encoding:n,flag:e,mode:i};case"null":case"undefined":case"function":return{encoding:t,flag:e,mode:i};default:throw new TypeError(`"options" must be a string or an object, got ${typeof n} instead.`)}}l(Le,"normalizeOptions");function I(){}l(I,"nop");var B;function bn(n){B=n}l(bn,"setCred");var je=new Map,eo=100;function Bt(n){let t=eo++;return je.set(t,n),t}l(Bt,"getFdForFile");function K(n){if(!je.has(n))throw new h(9,"Invalid file descriptor.");return je.get(n)}l(K,"fd2file");var ye=new Map;me.Create().then(n=>It("/",n));function Ge(n){return ye.get(n)}l(Ge,"getMount");function wn(){return Object.fromEntries(ye.entries())}l(wn,"getMounts");function It(n,t){if(n[0]!=="/"&&(n="/"+n),n=Ne.resolve(n),ye.has(n))throw new h(22,"Mount point "+n+" is already in use.");ye.set(n,t)}l(It,"mount");function Qt(n){if(n[0]!=="/"&&(n=`/${n}`),n=Ne.resolve(n),!ye.has(n))throw new h(22,"Mount point "+n+" is already unmounted.");ye.delete(n)}l(Qt,"umount");function pe(n){let t=[...ye].sort((e,i)=>e[0].length>i[0].length?-1:1);for(let[e,i]of t)if(e.length<=n.length&&n.startsWith(e))return n=n.slice(e.length>1?e.length:0),n===""&&(n="/"),{fs:i,path:n,mountPoint:e};throw new h(5,"ZenFS not initialized with a file system")}l(pe,"resolveFS");function gn(n,t){for(let[e,i]of Object.entries(t))n=n.replaceAll(e,i);return n}l(gn,"fixPaths");function De(n,t){return n.stack=gn(n.stack,t),n.message=gn(n.message,t),n}l(De,"fixError");function Sn(n){n["/"]&&Qt("/");for(let[t,e]of Object.entries(n)){if(!e.constructor.isAvailable())throw new h(22,`Can not mount "${t}" since the filesystem is unavailable.`);It(t,e)}}l(Sn,"initialize");var dt={};ot(dt,{access:()=>ki,appendFile:()=>si,chmod:()=>Fi,chown:()=>Ei,close:()=>ai,constants:()=>He,createReadStream:()=>no,createWriteStream:()=>so,exists:()=>Tt,fchmod:()=>hi,fchown:()=>fi,fdatasync:()=>ui,fstat:()=>oi,fsync:()=>li,ftruncate:()=>ci,futimes:()=>mi,lchmod:()=>xi,lchown:()=>vi,link:()=>bi,lstat:()=>ii,lutimes:()=>_i,mkdir:()=>gi,open:()=>ni,read:()=>di,readFile:()=>Ot,readdir:()=>yi,readlink:()=>Si,realpath:()=>ut,rename:()=>ei,rmdir:()=>pi,stat:()=>ti,symlink:()=>wi,truncate:()=>ri,unlink:()=>Nt,unwatchFile:()=>io,utimes:()=>Ci,watch:()=>ro,watchFile:()=>to,write:()=>Pt,writeFile:()=>At});function Y(){return g(this,arguments,function*(...[n,t,e,...i]){e=j(e);let{fs:o,path:c}=pe(t&&(yield Tt(e))?yield ut(e):e);try{return o[n](c,...i)}catch(a){throw De(a,{[c]:e})}})}l(Y,"doOp");function ei(n,t){return g(this,null,function*(){n=j(n),t=j(t);let e=pe(n),i=pe(t),o={[e.path]:n,[i.path]:t};try{if(e===i)return e.fs.rename(e.path,i.path,B);let c=yield Ot(n);yield At(t,c),yield Nt(n)}catch(c){throw De(c,o)}})}l(ei,"rename");function Tt(n){return g(this,null,function*(){n=j(n);try{let{fs:t,path:e}=pe(n);return t.exists(e,B)}catch(t){if(t.errno==2)return!1;throw t}})}l(Tt,"exists");function ti(n){return g(this,null,function*(){return Y("stat",!0,n,B)})}l(ti,"stat");function ii(n){return g(this,null,function*(){return Y("stat",!1,n,B)})}l(ii,"lstat");function ri(n,t=0){return g(this,null,function*(){if(t<0)throw new h(22);return Y("truncate",!0,n,t,B)})}l(ri,"truncate");function Nt(n){return g(this,null,function*(){return Y("unlink",!1,n,B)})}l(Nt,"unlink");function ni(n,t,e=420){return g(this,null,function*(){let i=yield Y("open",!0,n,O.getFileFlag(t),le(e,420),B);return Bt(i)})}l(ni,"open");function Ot(e){return g(this,arguments,function*(n,t={}){let i=Le(t,null,"r",null),o=O.getFileFlag(i.flag);if(!o.isReadable())throw new h(22,"Flag passed to readFile must allow for reading.");return Y("readFile",!0,n,i.encoding,o,B)})}l(Ot,"readFile");function At(n,t,e){return g(this,null,function*(){let i=Le(e,"utf8","w",420),o=O.getFileFlag(i.flag);if(!o.isWriteable())throw new h(22,"Flag passed to writeFile must allow for writing.");return Y("writeFile",!0,n,t,i.encoding,o,i.mode,B)})}l(At,"writeFile");function si(n,t,e){return g(this,null,function*(){let i=Le(e,"utf8","a",420),o=O.getFileFlag(i.flag);if(!o.isAppendable())throw new h(22,"Flag passed to appendFile must allow for appending.");return Y("appendFile",!0,n,t,i.encoding,o,i.mode,B)})}l(si,"appendFile");function oi(n){return g(this,null,function*(){return K(n).stat()})}l(oi,"fstat");function ai(n){return g(this,null,function*(){yield K(n).close(),je.delete(n)})}l(ai,"close");function ci(n,t=0){return g(this,null,function*(){let e=K(n);if(t<0)throw new h(22);return e.truncate(t)})}l(ci,"ftruncate");function li(n){return g(this,null,function*(){return K(n).sync()})}l(li,"fsync");function ui(n){return g(this,null,function*(){return K(n).datasync()})}l(ui,"fdatasync");function Pt(n,t,e,i,o){return g(this,null,function*(){let c,a=0,d,m;if(typeof t=="string"){m=typeof e=="number"?e:null;let S=typeof i=="string"?i:"utf8";a=0,c=k.from(t,S),d=c.length}else c=t,a=e,d=i,m=typeof o=="number"?o:null;let b=K(n);return m==null&&(m=b.getPos()),b.write(c,a,d,m)})}l(Pt,"write");function di(n,t,e,i,o){return g(this,null,function*(){let c=K(n);return isNaN(+o)&&(o=c.getPos()),c.read(t,e,i,o)})}l(di,"read");function fi(n,t,e){return g(this,null,function*(){return K(n).chown(t,e)})}l(fi,"fchown");function hi(n,t){return g(this,null,function*(){let e=typeof t=="string"?parseInt(t,8):t;return K(n).chmod(e)})}l(hi,"fchmod");function mi(n,t,e){return g(this,null,function*(){return K(n).utimes(oe(t),oe(e))})}l(mi,"futimes");function pi(n){return g(this,null,function*(){return Y("rmdir",!0,n,B)})}l(pi,"rmdir");function gi(n,t){return g(this,null,function*(){return Y("mkdir",!0,n,le(t,511),B)})}l(gi,"mkdir");function yi(n){return g(this,null,function*(){n=j(n);let t=yield Y("readdir",!0,n,B),e=[...ye.keys()];for(let i of e)if(i.startsWith(n)){let o=i.slice(n.length);if(o.includes("/")||o.length==0)continue;t.push(o)}return t})}l(yi,"readdir");function bi(n,t){return g(this,null,function*(){return t=j(t),Y("link",!1,n,t,B)})}l(bi,"link");function wi(n,t,e="file"){return g(this,null,function*(){if(!["file","dir","junction"].includes(e))throw new h(22,"Invalid type: "+e);return t=j(t),Y("symlink",!1,n,t,e,B)})}l(wi,"symlink");function Si(n){return g(this,null,function*(){return Y("readlink",!1,n,B)})}l(Si,"readlink");function Ei(n,t,e){return g(this,null,function*(){return Y("chown",!0,n,t,e,B)})}l(Ei,"chown");function vi(n,t,e){return g(this,null,function*(){return Y("chown",!1,n,t,e,B)})}l(vi,"lchown");function Fi(n,t){return g(this,null,function*(){let e=le(t,-1);if(e<0)throw new h(22,"Invalid mode.");return Y("chmod",!0,n,e,B)})}l(Fi,"chmod");function xi(n,t){return g(this,null,function*(){let e=le(t,-1);if(e<1)throw new h(22,"Invalid mode.");return Y("chmod",!1,j(n),e,B)})}l(xi,"lchmod");function Ci(n,t,e){return g(this,null,function*(){return Y("utimes",!0,n,oe(t),oe(e),B)})}l(Ci,"utimes");function _i(n,t,e){return g(this,null,function*(){return Y("utimes",!1,n,oe(t),oe(e),B)})}l(_i,"lutimes");function ut(e){return g(this,arguments,function*(n,t={}){n=j(n);let{fs:i,path:o,mountPoint:c}=pe(n);try{if(!(yield i.stat(o,B)).isSymbolicLink())return n;let d=c+j(yield i.readlink(o,B));return ut(d)}catch(a){throw De(a,{[o]:n})}})}l(ut,"realpath");function to(i,o){return g(this,arguments,function*(n,t,e=I){throw new h(95)})}l(to,"watchFile");function io(e){return g(this,arguments,function*(n,t=I){throw new h(95)})}l(io,"unwatchFile");function ro(i,o){return g(this,arguments,function*(n,t,e=I){throw new h(95)})}l(ro,"watch");function ki(n,t=384){return g(this,null,function*(){return Y("access",!0,n,t,B)})}l(ki,"access");function no(n,t){return g(this,null,function*(){throw new h(95)})}l(no,"createReadStream");function so(n,t){return g(this,null,function*(){throw new h(95)})}l(so,"createWriteStream");function oo(n,t,e=I){ei(n,t).then(()=>e()).catch(e)}l(oo,"rename");function ao(n,t=I){Tt(n).then(t).catch(()=>t(!1))}l(ao,"exists");function co(n,t=I){ti(n).then(e=>t(null,e)).catch(t)}l(co,"stat");function lo(n,t=I){ii(n).then(e=>t(null,e)).catch(t)}l(lo,"lstat");function uo(n,t=0,e=I){e=typeof t=="function"?t:e,ri(n,typeof t=="number"?t:0).then(()=>e()).catch(e)}l(uo,"truncate");function fo(n,t=I){Nt(n).then(()=>t()).catch(t)}l(fo,"unlink");function ho(n,t,e,i=I){let o=le(e,420);i=typeof e=="function"?e:i,ni(n,t,o).then(c=>i(null,c)).catch(i)}l(ho,"open");function mo(n,t={},e=I){e=typeof t=="function"?t:e,Ot(n,typeof t=="function"?null:t)}l(mo,"readFile");function po(n,t,e={},i=I){i=typeof e=="function"?e:i,At(n,t,typeof e=="function"?void 0:e)}l(po,"writeFile");function go(n,t,e,i=I){i=typeof e=="function"?e:i,si(n,t,typeof e=="function"?null:e)}l(go,"appendFile");function yo(n,t=I){oi(n).then(e=>t(null,e)).catch(t)}l(yo,"fstat");function bo(n,t=I){ai(n).then(()=>t()).catch(t)}l(bo,"close");function wo(n,t,e=I){let i=typeof t=="number"?t:0;e=typeof t=="function"?t:e,ci(n,i)}l(wo,"ftruncate");function So(n,t=I){li(n).then(()=>t()).catch(t)}l(So,"fsync");function Eo(n,t=I){ui(n).then(()=>t()).catch(t)}l(Eo,"fdatasync");function vo(n,t,e,i,o,c=I){let a,d,m,b=null,S;if(typeof t=="string"){switch(S="utf8",typeof e){case"function":c=e;break;case"number":b=e,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(t,S),d=0,m=a.length;let w=c;Pt(n,a,d,m,b).then(x=>w(null,x,a.toString(S))).catch(w)}else{a=t,d=e,m=i,b=typeof o=="number"?o:null;let w=typeof o=="function"?o:c;Pt(n,a,d,m,b).then(x=>w(null,x,a)).catch(w)}}l(vo,"write");function Fo(n,t,e,i,o,c=I){di(n,t,e,i,o).then(({bytesRead:a,buffer:d})=>c(null,a,d)).catch(c)}l(Fo,"read");function xo(n,t,e,i=I){fi(n,t,e).then(()=>i()).catch(i)}l(xo,"fchown");function Co(n,t,e){hi(n,t).then(()=>e()).catch(e)}l(Co,"fchmod");function _o(n,t,e,i=I){mi(n,t,e).then(()=>i()).catch(i)}l(_o,"futimes");function ko(n,t=I){pi(n).then(()=>t()).catch(t)}l(ko,"rmdir");function Bo(n,t,e=I){gi(n,t).then(()=>e()).catch(e)}l(Bo,"mkdir");function Io(n,t=I){yi(n).then(e=>t(null,e)).catch(t)}l(Io,"readdir");function To(n,t,e=I){bi(n,t).then(()=>e()).catch(e)}l(To,"link");function No(n,t,e,i=I){let o=typeof e=="string"?e:"file";i=typeof e=="function"?e:i,wi(n,t,typeof e=="function"?null:e).then(()=>i()).catch(i)}l(No,"symlink");function Oo(n,t=I){Si(n).then(e=>t(null,e)).catch(t)}l(Oo,"readlink");function Ao(n,t,e,i=I){Ei(n,t,e).then(()=>i()).catch(i)}l(Ao,"chown");function Po(n,t,e,i=I){vi(n,t,e).then(()=>i()).catch(i)}l(Po,"lchown");function Ro(n,t,e=I){Fi(n,t).then(()=>e()).catch(e)}l(Ro,"chmod");function Lo(n,t,e=I){xi(n,t).then(()=>e()).catch(e)}l(Lo,"lchmod");function Do(n,t,e,i=I){Ci(n,t,e).then(()=>i()).catch(i)}l(Do,"utimes");function Uo(n,t,e,i=I){_i(n,t,e).then(()=>i()).catch(i)}l(Uo,"lutimes");function Mo(n,t,e=I){let i=typeof t=="object"?t:{};e=typeof t=="function"?t:e,ut(n,typeof t=="function"?null:t).then(o=>e(null,o)).catch(e)}l(Mo,"realpath");function zo(n,t,e=I){let i=typeof t=="number"?t:4;e=typeof t=="function"?t:e,ki(n,typeof t=="function"?null:t).then(()=>e()).catch(e)}l(zo,"access");function Vo(n,t,e=I){throw new h(95)}l(Vo,"watchFile");function Wo(n,t=I){throw new h(95)}l(Wo,"unwatchFile");function $o(n,t,e=I){throw new h(95)}l($o,"watch");function Ko(n,t){throw new h(95)}l(Ko,"createReadStream");function jo(n,t){throw new h(95)}l(jo,"createWriteStream");function X(...[n,t,e,...i]){e=j(e);let{fs:o,path:c}=pe(t&&En(e)?Bi(e):e);try{return o[n](c,...i)}catch(a){throw De(a,{[c]:e})}}l(X,"doOp");function Yo(n,t){n=j(n),t=j(t);let e=pe(n),i=pe(t),o={[e.path]:n,[i.path]:t};try{if(e===i)return e.fs.renameSync(e.path,i.path,B);let c=Fn(n);xn(t,c),vn(n)}catch(c){throw De(c,o)}}l(Yo,"renameSync");function En(n){n=j(n);try{let{fs:t,path:e}=pe(n);return t.existsSync(e,B)}catch(t){if(t.errno==2)return!1;throw t}}l(En,"existsSync");function Xo(n){return X("statSync",!0,n,B)}l(Xo,"statSync");function qo(n){return X("statSync",!1,n,B)}l(qo,"lstatSync");function Jo(n,t=0){if(t<0)throw new h(22);return X("truncateSync",!0,n,t,B)}l(Jo,"truncateSync");function vn(n){return X("unlinkSync",!1,n,B)}l(vn,"unlinkSync");function Ho(n,t,e=420){let i=X("openSync",!0,n,O.getFileFlag(t),le(e,420),B);return Bt(i)}l(Ho,"openSync");function Fn(n,t={}){let e=Le(t,null,"r",null),i=O.getFileFlag(e.flag);if(!i.isReadable())throw new h(22,"Flag passed to readFile must allow for reading.");return X("readFileSync",!0,n,e.encoding,i,B)}l(Fn,"readFileSync");function xn(n,t,e){let i=Le(e,"utf8","w",420),o=O.getFileFlag(i.flag);if(!o.isWriteable())throw new h(22,"Flag passed to writeFile must allow for writing.");return X("writeFileSync",!0,n,t,i.encoding,o,i.mode,B)}l(xn,"writeFileSync");function Go(n,t,e){let i=Le(e,"utf8","a",420),o=O.getFileFlag(i.flag);if(!o.isAppendable())throw new h(22,"Flag passed to appendFile must allow for appending.");return X("appendFileSync",!0,n,t,i.encoding,o,i.mode,B)}l(Go,"appendFileSync");function Zo(n){return K(n).statSync()}l(Zo,"fstatSync");function Qo(n){K(n).closeSync(),je.delete(n)}l(Qo,"closeSync");function ea(n,t=0){let e=K(n);if(t<0)throw new h(22);e.truncateSync(t)}l(ea,"ftruncateSync");function ta(n){K(n).syncSync()}l(ta,"fsyncSync");function ia(n){K(n).datasyncSync()}l(ia,"fdatasyncSync");function ra(n,t,e,i,o){let c,a=0,d,m;if(typeof t=="string"){m=typeof e=="number"?e:null;let S=typeof i=="string"?i:"utf8";a=0,c=k.from(t,S),d=c.length}else c=t,a=e,d=i,m=typeof o=="number"?o:null;let b=K(n);return m==null&&(m=b.getPos()),b.writeSync(c,a,d,m)}l(ra,"writeSync");function na(n,t,e,i,o){let c=K(n),a=e;return typeof e=="object"&&({offset:a,length:i,position:o}=e),isNaN(+o)&&(o=c.getPos()),c.readSync(t,a,i,o)}l(na,"readSync");function sa(n,t,e){K(n).chownSync(t,e)}l(sa,"fchownSync");function oa(n,t){let e=typeof t=="string"?parseInt(t,8):t;K(n).chmodSync(e)}l(oa,"fchmodSync");function aa(n,t,e){K(n).utimesSync(oe(t),oe(e))}l(aa,"futimesSync");function ca(n){return X("rmdirSync",!0,n,B)}l(ca,"rmdirSync");function la(n,t){X("mkdirSync",!0,n,le(t,511),B)}l(la,"mkdirSync");function ua(n){n=j(n);let t=X("readdirSync",!0,n,B),e=[...ye.keys()];for(let i of e)if(i.startsWith(n)){let o=i.slice(n.length);if(o.includes("/")||o.length==0)continue;t.push(o)}return t}l(ua,"readdirSync");function da(n,t){return t=j(t),X("linkSync",!1,n,t,B)}l(da,"linkSync");function fa(n,t,e){if(!["file","dir","junction"].includes(e))throw new h(22,"Invalid type: "+e);return t=j(t),X("symlinkSync",!1,n,t,e,B)}l(fa,"symlinkSync");function ha(n){return X("readlinkSync",!1,n,B)}l(ha,"readlinkSync");function ma(n,t,e){X("chownSync",!0,n,t,e,B)}l(ma,"chownSync");function pa(n,t,e){X("chownSync",!1,n,t,e,B)}l(pa,"lchownSync");function ga(n,t){let e=le(t,-1);if(e<0)throw new h(22,"Invalid mode.");X("chmodSync",!0,n,e,B)}l(ga,"chmodSync");function ya(n,t){let e=le(t,-1);if(e<1)throw new h(22,"Invalid mode.");X("chmodSync",!1,n,e,B)}l(ya,"lchmodSync");function ba(n,t,e){X("utimesSync",!0,n,oe(t),oe(e),B)}l(ba,"utimesSync");function wa(n,t,e){X("utimesSync",!1,n,oe(t),oe(e),B)}l(wa,"lutimesSync");function Bi(n,t={}){n=j(n);let{fs:e,path:i,mountPoint:o}=pe(n);try{if(!e.statSync(i,B).isSymbolicLink())return n;let a=j(o+e.readlinkSync(i,B));return Bi(a)}catch(c){throw De(c,{[i]:n})}}l(Bi,"realpathSync");function Sa(n,t=384){return X("accessSync",!0,n,t,B)}l(Sa,"accessSync");var Ea=Ii,Rt=Ea;var Lt=class extends ce{constructor(t,e,i,o,c){super(t,e,i,o,c)}syncSync(){this.isDirty()&&(this._fs._syncSync(this),this.resetDirty())}closeSync(){this.syncSync()}};l(Lt,"MirrorFile");var ft=class extends Pe{constructor({sync:e,async:i}){super();this._queue=[];this._queueRunning=!1;this._isInitialized=!1;this._initializeCallbacks=[];this._sync=e,this._async=i,this._ready=this._initialize()}static isAvailable(){return!0}get metadata(){return Se(ge({},super.metadata),{name:ft.Name,synchronous:!0,supportsProperties:this._sync.metadata.supportsProperties&&this._async.metadata.supportsProperties})}_syncSync(e){let i=e.getStats();this._sync.writeFileSync(e.getPath(),e.getBuffer(),null,O.getFileFlag("w"),i.mode,i.getCred(0,0)),this.enqueueOp({apiMethod:"writeFile",arguments:[e.getPath(),e.getBuffer(),null,e.getFlag(),i.mode,i.getCred(0,0)]})}renameSync(e,i,o){this._sync.renameSync(e,i,o),this.enqueueOp({apiMethod:"rename",arguments:[e,i,o]})}statSync(e,i){return this._sync.statSync(e,i)}openSync(e,i,o,c){return this._sync.openSync(e,i,o,c).closeSync(),new Lt(this,e,i,this._sync.statSync(e,c),this._sync.readFileSync(e,null,O.getFileFlag("r"),c))}unlinkSync(e,i){this._sync.unlinkSync(e,i),this.enqueueOp({apiMethod:"unlink",arguments:[e,i]})}rmdirSync(e,i){this._sync.rmdirSync(e,i),this.enqueueOp({apiMethod:"rmdir",arguments:[e,i]})}mkdirSync(e,i,o){this._sync.mkdirSync(e,i,o),this.enqueueOp({apiMethod:"mkdir",arguments:[e,i,o]})}readdirSync(e,i){return this._sync.readdirSync(e,i)}existsSync(e,i){return this._sync.existsSync(e,i)}chmodSync(e,i,o){this._sync.chmodSync(e,i,o),this.enqueueOp({apiMethod:"chmod",arguments:[e,i,o]})}chownSync(e,i,o,c){this._sync.chownSync(e,i,o,c),this.enqueueOp({apiMethod:"chown",arguments:[e,i,o,c]})}utimesSync(e,i,o,c){this._sync.utimesSync(e,i,o,c),this.enqueueOp({apiMethod:"utimes",arguments:[e,i,o,c]})}_initialize(){return g(this,null,function*(){if(!this._isInitialized){let e=l((c,a)=>g(this,null,function*(){if(c!=="/"){let m=yield this._async.stat(c,q.Root);this._sync.mkdirSync(c,a,m.getCred())}let d=yield this._async.readdir(c,q.Root);for(let m of d)yield o(Ee(c,m))}),"copyDirectory"),i=l((c,a)=>g(this,null,function*(){let d=yield this._async.readFile(c,null,O.getFileFlag("r"),q.Root);this._sync.writeFileSync(c,d,null,O.getFileFlag("w"),a,q.Root)}),"copyFile"),o=l(c=>g(this,null,function*(){let a=yield this._async.stat(c,q.Root);a.isDirectory()?yield e(c,a.mode):yield i(c,a.mode)}),"copyItem");try{yield e("/",0),this._isInitialized=!0}catch(c){throw this._isInitialized=!1,c}}return this})}enqueueOp(e){if(this._queue.push(e),!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()}}},ke=ft;l(ke,"AsyncMirror"),ke.Name="AsyncMirror",ke.Create=Re.bind(ft),ke.Options={sync:{type:"object",description:"The synchronous file system to mirror the asynchronous file system to.",validator:e=>g(ft,null,function*(){if(!(e!=null&&e.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 Ti=class extends fe{constructor({folder:e,wrapped:i}){super();this._folder=e,this._wrapped=i,this._ready=this._initialize()}static isAvailable(){return!0}get metadata(){return Se(ge(ge({},super.metadata),this._wrapped.metadata),{supportsLinks:!1})}_initialize(){return g(this,null,function*(){if(!(yield this._wrapped.exists(this._folder,q.Root))&&this._wrapped.metadata.readonly)throw h.ENOENT(this._folder);return yield this._wrapped.mkdir(this._folder,511,q.Root),this})}},be=Ti;l(be,"FolderAdapter"),be.Name="FolderAdapter",be.Create=Re.bind(Ti),be.Options={folder:{type:"string",description:"The folder to use as the root directory"},wrapped:{type:"object",description:"The file system to wrap"}};function Cn(n,t){if(t!==null&&typeof t=="object"){let e=t,i=e.path;i&&(i="/"+mn(n,i),e.message=e.message.replace(e.path,i),e.path=i)}return t}l(Cn,"translateError");function va(n,t){return typeof t=="function"?function(e){arguments.length>0&&(arguments[0]=Cn(n,e)),t.apply(null,arguments)}:t}l(va,"wrapCallback");function _n(n,t,e){return n.slice(n.length-4)!=="Sync"?function(){return arguments.length>0&&(t&&(arguments[0]=Ee(this._folder,arguments[0])),e&&(arguments[1]=Ee(this._folder,arguments[1])),arguments[arguments.length-1]=va(this._folder,arguments[arguments.length-1])),this._wrapped[n].apply(this._wrapped,arguments)}:function(){try{return t&&(arguments[0]=Ee(this._folder,arguments[0])),e&&(arguments[1]=Ee(this._folder,arguments[1])),this._wrapped[n].apply(this._wrapped,arguments)}catch(i){throw Cn(this._folder,i)}}}l(_n,"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(n=>{be.prototype[n]=_n(n,!0,!1)});["rename","renameSync","link","linkSync","symlink","symlinkSync"].forEach(n=>{be.prototype[n]=_n(n,!0,!0)});var tt=class{constructor(){this._locks=new Map}lock(t){return new Promise(e=>{this._locks.has(t)?this._locks.get(t).push(e):this._locks.set(t,[])})}unlock(t){if(!this._locks.has(t))throw new Error("unlock of a non-locked mutex");let e=this._locks.get(t).shift();if(e){setTimeout(e,0);return}this._locks.delete(t)}tryLock(t){return this._locks.has(t)?!1:(this._locks.set(t,[]),!0)}isLocked(t){return this._locks.has(t)}};l(tt,"Mutex");var it=class{constructor(t){this._ready=Promise.resolve(this);this._fs=t,this._mu=new tt}whenReady(){return this._ready}get metadata(){return Se(ge({},this._fs.metadata),{name:"LockedFS<"+this._fs.metadata.name+">"})}get fs(){return this._fs}rename(t,e,i){return g(this,null,function*(){yield this._mu.lock(t),yield this._fs.rename(t,e,i),this._mu.unlock(t)})}renameSync(t,e,i){if(this._mu.isLocked(t))throw new Error("invalid sync call");return this._fs.renameSync(t,e,i)}stat(t,e){return g(this,null,function*(){yield this._mu.lock(t);let i=yield this._fs.stat(t,e);return this._mu.unlock(t),i})}statSync(t,e){if(this._mu.isLocked(t))throw new Error("invalid sync call");return this._fs.statSync(t,e)}access(t,e,i){return g(this,null,function*(){yield this._mu.lock(t),yield this._fs.access(t,e,i),this._mu.unlock(t)})}accessSync(t,e,i){if(this._mu.isLocked(t))throw new Error("invalid sync call");return this._fs.accessSync(t,e,i)}open(t,e,i,o){return g(this,null,function*(){yield this._mu.lock(t);let c=yield this._fs.open(t,e,i,o);return this._mu.unlock(t),c})}openSync(t,e,i,o){if(this._mu.isLocked(t))throw new Error("invalid sync call");return this._fs.openSync(t,e,i,o)}unlink(t,e){return g(this,null,function*(){yield this._mu.lock(t),yield this._fs.unlink(t,e),this._mu.unlock(t)})}unlinkSync(t,e){if(this._mu.isLocked(t))throw new Error("invalid sync call");return this._fs.unlinkSync(t,e)}rmdir(t,e){return g(this,null,function*(){yield this._mu.lock(t),yield this._fs.rmdir(t,e),this._mu.unlock(t)})}rmdirSync(t,e){if(this._mu.isLocked(t))throw new Error("invalid sync call");return this._fs.rmdirSync(t,e)}mkdir(t,e,i){return g(this,null,function*(){yield this._mu.lock(t),yield this._fs.mkdir(t,e,i),this._mu.unlock(t)})}mkdirSync(t,e,i){if(this._mu.isLocked(t))throw new Error("invalid sync call");return this._fs.mkdirSync(t,e,i)}readdir(t,e){return g(this,null,function*(){yield this._mu.lock(t);let i=yield this._fs.readdir(t,e);return this._mu.unlock(t),i})}readdirSync(t,e){if(this._mu.isLocked(t))throw new Error("invalid sync call");return this._fs.readdirSync(t,e)}exists(t,e){return g(this,null,function*(){yield this._mu.lock(t);let i=yield this._fs.exists(t,e);return this._mu.unlock(t),i})}existsSync(t,e){if(this._mu.isLocked(t))throw new Error("invalid sync call");return this._fs.existsSync(t,e)}realpath(t,e){return g(this,null,function*(){yield this._mu.lock(t);let i=yield this._fs.realpath(t,e);return this._mu.unlock(t),i})}realpathSync(t,e){if(this._mu.isLocked(t))throw new Error("invalid sync call");return this._fs.realpathSync(t,e)}truncate(t,e,i){return g(this,null,function*(){yield this._mu.lock(t),yield this._fs.truncate(t,e,i),this._mu.unlock(t)})}truncateSync(t,e,i){if(this._mu.isLocked(t))throw new Error("invalid sync call");return this._fs.truncateSync(t,e,i)}readFile(t,e,i,o){return g(this,null,function*(){yield this._mu.lock(t);let c=yield this._fs.readFile(t,e,i,o);return this._mu.unlock(t),c})}readFileSync(t,e,i,o){if(this._mu.isLocked(t))throw new Error("invalid sync call");return this._fs.readFileSync(t,e,i,o)}writeFile(t,e,i,o,c,a){return g(this,null,function*(){yield this._mu.lock(t),yield this._fs.writeFile(t,e,i,o,c,a),this._mu.unlock(t)})}writeFileSync(t,e,i,o,c,a){if(this._mu.isLocked(t))throw new Error("invalid sync call");return this._fs.writeFileSync(t,e,i,o,c,a)}appendFile(t,e,i,o,c,a){return g(this,null,function*(){yield this._mu.lock(t),yield this._fs.appendFile(t,e,i,o,c,a),this._mu.unlock(t)})}appendFileSync(t,e,i,o,c,a){if(this._mu.isLocked(t))throw new Error("invalid sync call");return this._fs.appendFileSync(t,e,i,o,c,a)}chmod(t,e,i){return g(this,null,function*(){yield this._mu.lock(t),yield this._fs.chmod(t,e,i),this._mu.unlock(t)})}chmodSync(t,e,i){if(this._mu.isLocked(t))throw new Error("invalid sync call");return this._fs.chmodSync(t,e,i)}chown(t,e,i,o){return g(this,null,function*(){yield this._mu.lock(t),yield this._fs.chown(t,e,i,o),this._mu.unlock(t)})}chownSync(t,e,i,o){if(this._mu.isLocked(t))throw new Error("invalid sync call");return this._fs.chownSync(t,e,i,o)}utimes(t,e,i,o){return g(this,null,function*(){yield this._mu.lock(t),yield this._fs.utimes(t,e,i,o),this._mu.unlock(t)})}utimesSync(t,e,i,o){if(this._mu.isLocked(t))throw new Error("invalid sync call");return this._fs.utimesSync(t,e,i,o)}link(t,e,i){return g(this,null,function*(){yield this._mu.lock(t),yield this._fs.link(t,e,i),this._mu.unlock(t)})}linkSync(t,e,i){if(this._mu.isLocked(t))throw new Error("invalid sync call");return this._fs.linkSync(t,e,i)}symlink(t,e,i,o){return g(this,null,function*(){yield this._mu.lock(t),yield this._fs.symlink(t,e,i,o),this._mu.unlock(t)})}symlinkSync(t,e,i,o){if(this._mu.isLocked(t))throw new Error("invalid sync call");return this._fs.symlinkSync(t,e,i,o)}readlink(t,e){return g(this,null,function*(){yield this._mu.lock(t);let i=yield this._fs.readlink(t,e);return this._mu.unlock(t),i})}readlinkSync(t,e){if(this._mu.isLocked(t))throw new Error("invalid sync call");return this._fs.readlinkSync(t,e)}};l(it,"LockedFS");var Be="/.deletedFiles.log";function kn(n){return 146|n}l(kn,"makeModeWritable");function ue(n){return O.getFileFlag(n)}l(ue,"getFlag");var ht=class extends ce{constructor(t,e,i,o,c){super(t,e,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(ht,"OverlayFile");var mt=class extends fe{constructor({writable:e,readable:i}){super();this._isInitialized=!1;this._deletedFiles={};this._deleteLog="";this._deleteLogUpdatePending=!1;this._deleteLogUpdateNeeded=!1;this._deleteLogError=null;if(this._writable=e,this._readable=i,this._writable.metadata.readonly)throw new h(22,"Writable file system must be writable.")}static isAvailable(){return!0}get metadata(){return Se(ge({},super.metadata),{name:Fe.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(e){return g(this,null,function*(){let i=e.getStats();return yield this.createParentDirectoriesAsync(e.getPath(),i.getCred(0,0)),this._writable.writeFile(e.getPath(),e.getBuffer(),null,ue("w"),i.mode,i.getCred(0,0))})}_syncSync(e){let i=e.getStats();this.createParentDirectories(e.getPath(),i.getCred(0,0)),this._writable.writeFileSync(e.getPath(),e.getBuffer(),null,ue("w"),i.mode,i.getCred(0,0))}_initialize(){return g(this,null,function*(){if(!this._isInitialized){try{let e=yield this._writable.readFile(Be,"utf8",ue("r"),q.Root);this._deleteLog=e}catch(e){if(e.errno!==2)throw e}this._isInitialized=!0,this._reparseDeletionLog()}})}getDeletionLog(){return this._deleteLog}restoreDeletionLog(e,i){this._deleteLog=e,this._reparseDeletionLog(),this.updateLog("",i)}rename(e,i,o){return g(this,null,function*(){if(this.checkInitialized(),this.checkPath(e),this.checkPath(i),e===Be||i===Be)throw h.EPERM("Cannot rename deletion log.");let c=yield this.stat(e,o);if(c.isDirectory()){if(e===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(e,o))?yield this._writable.rename(e,i,o):(yield this._writable.exists(i,o))||(yield this._writable.mkdir(i,a,o)),yield this._readable.exists(e,o))for(let d of yield this._readable.readdir(e,o))yield this.rename(ve(e,d),ve(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(e,null,ue("r"),o),null,ue("w"),c.mode,o)}e!==i&&(yield this.exists(e,o))&&(yield this.unlink(e,o))})}renameSync(e,i,o){if(this.checkInitialized(),this.checkPath(e),this.checkPath(i),e===Be||i===Be)throw h.EPERM("Cannot rename deletion log.");let c=this.statSync(e,o);if(c.isDirectory()){if(e===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(e,o)?this._writable.renameSync(e,i,o):this._writable.existsSync(i,o)||this._writable.mkdirSync(i,a,o),this._readable.existsSync(e,o)&&this._readable.readdirSync(e,o).forEach(d=>{this.renameSync(ve(e,d),ve(i,d),o)})}else{if(this.existsSync(i,o)&&this.statSync(i,o).isDirectory())throw h.EISDIR(i);this.writeFileSync(i,this.readFileSync(e,null,ue("r"),o),null,ue("w"),c.mode,o)}e!==i&&this.existsSync(e,o)&&this.unlinkSync(e,o)}stat(e,i){return g(this,null,function*(){this.checkInitialized();try{return this._writable.stat(e,i)}catch(o){if(this._deletedFiles[e])throw h.ENOENT(e);let c=Q.clone(yield this._readable.stat(e,i));return c.mode=kn(c.mode),c}})}statSync(e,i){this.checkInitialized();try{return this._writable.statSync(e,i)}catch(o){if(this._deletedFiles[e])throw h.ENOENT(e);let c=Q.clone(this._readable.statSync(e,i));return c.mode=kn(c.mode),c}}open(e,i,o,c){return g(this,null,function*(){if(this.checkInitialized(),this.checkPath(e),e===Be)throw h.EPERM("Cannot open deletion log.");if(yield this.exists(e,c))switch(i.pathExistsAction()){case 2:return yield this.createParentDirectoriesAsync(e,c),this._writable.open(e,i,o,c);case 0:if(yield this._writable.exists(e,c))return this._writable.open(e,i,o,c);{let a=yield this._readable.readFile(e,null,ue("r"),c),d=Q.clone(yield this._readable.stat(e,c));return d.mode=o,new ht(this,e,i,d,a)}default:throw h.EEXIST(e)}else switch(i.pathNotExistsAction()){case 3:return yield this.createParentDirectoriesAsync(e,c),this._writable.open(e,i,o,c);default:throw h.ENOENT(e)}})}openSync(e,i,o,c){if(this.checkInitialized(),this.checkPath(e),e===Be)throw h.EPERM("Cannot open deletion log.");if(this.existsSync(e,c))switch(i.pathExistsAction()){case 2:return this.createParentDirectories(e,c),this._writable.openSync(e,i,o,c);case 0:if(this._writable.existsSync(e,c))return this._writable.openSync(e,i,o,c);{let a=this._readable.readFileSync(e,null,ue("r"),c),d=Q.clone(this._readable.statSync(e,c));return d.mode=o,new ht(this,e,i,d,a)}default:throw h.EEXIST(e)}else switch(i.pathNotExistsAction()){case 3:return this.createParentDirectories(e,c),this._writable.openSync(e,i,o,c);default:throw h.ENOENT(e)}}unlink(e,i){return g(this,null,function*(){if(this.checkInitialized(),this.checkPath(e),yield this.exists(e,i))(yield this._writable.exists(e,i))&&(yield this._writable.unlink(e,i)),(yield this.exists(e,i))&&this.deletePath(e,i);else throw h.ENOENT(e)})}unlinkSync(e,i){if(this.checkInitialized(),this.checkPath(e),this.existsSync(e,i))this._writable.existsSync(e,i)&&this._writable.unlinkSync(e,i),this.existsSync(e,i)&&this.deletePath(e,i);else throw h.ENOENT(e)}rmdir(e,i){return g(this,null,function*(){if(this.checkInitialized(),yield this.exists(e,i)){if((yield this._writable.exists(e,i))&&(yield this._writable.rmdir(e,i)),yield this.exists(e,i)){if((yield this.readdir(e,i)).length>0)throw h.ENOTEMPTY(e);this.deletePath(e,i)}}else throw h.ENOENT(e)})}rmdirSync(e,i){if(this.checkInitialized(),this.existsSync(e,i)){if(this._writable.existsSync(e,i)&&this._writable.rmdirSync(e,i),this.existsSync(e,i)){if(this.readdirSync(e,i).length>0)throw h.ENOTEMPTY(e);this.deletePath(e,i)}}else throw h.ENOENT(e)}mkdir(e,i,o){return g(this,null,function*(){if(this.checkInitialized(),yield this.exists(e,o))throw h.EEXIST(e);yield this.createParentDirectoriesAsync(e,o),yield this._writable.mkdir(e,i,o)})}mkdirSync(e,i,o){if(this.checkInitialized(),this.existsSync(e,o))throw h.EEXIST(e);this.createParentDirectories(e,o),this._writable.mkdirSync(e,i,o)}readdir(e,i){return g(this,null,function*(){if(this.checkInitialized(),!(yield this.stat(e,i)).isDirectory())throw h.ENOTDIR(e);let c=[];try{c=c.concat(yield this._writable.readdir(e,i))}catch(d){}try{c=c.concat((yield this._readable.readdir(e,i)).filter(d=>!this._deletedFiles[`${e}/${d}`]))}catch(d){}let a={};return c.filter(d=>{let m=!a[d];return a[d]=!0,m})})}readdirSync(e,i){if(this.checkInitialized(),!this.statSync(e,i).isDirectory())throw h.ENOTDIR(e);let c=[];try{c=c.concat(this._writable.readdirSync(e,i))}catch(d){}try{c=c.concat(this._readable.readdirSync(e,i).filter(d=>!this._deletedFiles[`${e}/${d}`]))}catch(d){}let a={};return c.filter(d=>{let m=!a[d];return a[d]=!0,m})}exists(e,i){return g(this,null,function*(){return this.checkInitialized(),(yield this._writable.exists(e,i))||(yield this._readable.exists(e,i))&&this._deletedFiles[e]!==!0})}existsSync(e,i){return this.checkInitialized(),this._writable.existsSync(e,i)||this._readable.existsSync(e,i)&&this._deletedFiles[e]!==!0}chmod(e,i,o){return g(this,null,function*(){this.checkInitialized(),yield this.operateOnWritableAsync(e,o),yield this._writable.chmod(e,i,o)})}chmodSync(e,i,o){this.checkInitialized(),this.operateOnWritable(e,o),this._writable.chmodSync(e,i,o)}chown(e,i,o,c){return g(this,null,function*(){this.checkInitialized(),yield this.operateOnWritableAsync(e,c),yield this._writable.chown(e,i,o,c)})}chownSync(e,i,o,c){this.checkInitialized(),this.operateOnWritable(e,c),this._writable.chownSync(e,i,o,c)}utimes(e,i,o,c){return g(this,null,function*(){this.checkInitialized(),yield this.operateOnWritableAsync(e,c),yield this._writable.utimes(e,i,o,c)})}utimesSync(e,i,o,c){this.checkInitialized(),this.operateOnWritable(e,c),this._writable.utimesSync(e,i,o,c)}deletePath(e,i){this._deletedFiles[e]=!0,this.updateLog(`d${e}
|
|
5
|
-
`,i)}updateLog(e,i){this._deleteLog+=e,this._deleteLogUpdatePending?this._deleteLogUpdateNeeded=!0:(this._deleteLogUpdatePending=!0,this._writable.writeFile(
|
|
6
|
-
`).forEach(e=>{this._deletedFiles[e.slice(1)]=e.slice(0,1)==="d"})}checkInitialized(){if(this._isInitialized){if(this._deleteLogError!==null){let e=this._deleteLogError;throw this._deleteLogError=null,e}}else throw new h(1,"OverlayFS is not initialized. Please initialize OverlayFS using its initialize() method before using it.")}checkPath(e){if(e===Be)throw h.EPERM(e)}createParentDirectories(e,i){let o=U(e),c=[];for(;!this._writable.existsSync(o,i);)c.push(o),o=U(o);c=c.reverse();for(let a of c)this._writable.mkdirSync(a,this.statSync(a,i).mode,i)}createParentDirectoriesAsync(e,i){return g(this,null,function*(){let o=U(e),c=[];for(;!(yield this._writable.exists(o,i));)c.push(o),o=U(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(e,i){if(!this.existsSync(e,i))throw h.ENOENT(e);this._writable.existsSync(e,i)||this.copyToWritable(e,i)}operateOnWritableAsync(e,i){return g(this,null,function*(){if(!(yield this.exists(e,i)))throw h.ENOENT(e);if(!(yield this._writable.exists(e,i)))return this.copyToWritableAsync(e,i)})}copyToWritable(e,i){let o=this.statSync(e,i);o.isDirectory()?this._writable.mkdirSync(e,o.mode,i):this.writeFileSync(e,this._readable.readFileSync(e,null,ue("r"),i),null,ue("w"),o.mode,i)}copyToWritableAsync(e,i){return g(this,null,function*(){let o=yield this.stat(e,i);o.isDirectory()?yield this._writable.mkdir(e,o.mode,i):yield this.writeFile(e,yield this._readable.readFile(e,null,ue("r"),i),null,ue("w"),o.mode,i)})}};l(mt,"UnlockedOverlayFS");var Dt=class extends it{static isAvailable(){return mt.isAvailable()}constructor(t){super(new mt(t)),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 Yi(Dt.prototype,this,"fs")._initialize(),this})}},Fe=Dt;l(Fe,"OverlayFS"),Fe.Name="OverlayFS",Fe.Create=Re.bind(Dt),Fe.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 Ut={};function Bn(...n){for(let t of n)Ut[t.Name]=t}l(Bn,"registerBackend");Bn(ke,be,me,Fe);var pt=class{constructor(t,e){this.key=t;this.value=e;this.prev=null;this.next=null}};l(pt,"LRUNode");var Mt=class{constructor(t){this.limit=t;this.size=0;this.map={};this.head=null;this.tail=null}set(t,e){let i=new pt(t,e);this.map[t]?(this.map[t].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(t){if(this.map[t]){let e=this.map[t].value,i=new pt(t,e);return this.remove(t),this.setHead(i),e}else return null}remove(t){let e=this.map[t];e&&(e.prev!==null?e.prev.next=e.next:this.head=e.next,e.next!==null?e.next.prev=e.prev:this.tail=e.prev,delete this.map[t],this.size--)}removeAll(){this.size=0,this.map={},this.head=null,this.tail=null}setHead(t){t.next=this.head,t.prev=null,this.head!==null&&(this.head.prev=t),this.head=t,this.tail===null&&(this.tail=t),this.size++,this.map[t.key]=t}};l(Mt,"LRUCache");var rt=class extends ce{constructor(t,e,i,o,c){super(t,e,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(rt,"AsyncKeyValueFile");var zt=class extends fe{constructor(e){super();this._cache=null;e>0&&(this._cache=new Mt(e))}static isAvailable(){return!0}init(e){return g(this,null,function*(){this.store=e,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(e,i,o){return g(this,null,function*(){let c=this.store.beginTransaction("readonly"),a=yield this.findINode(c,e);if(!a)throw h.ENOENT(e);if(!a.toStats().hasAccess(i,o))throw h.EACCES(e)})}rename(e,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=U(e),m=re(e),b=U(i),S=re(i),w=yield this.findINode(a,d),x=yield this.getDirListing(a,d,w);if(!w.toStats().hasAccess(2,o))throw h.EACCES(e);if(!x[m])throw h.ENOENT(e);let F=x[m];if(delete x[m],(b+"/").indexOf(e+"/")===0)throw new h(16,d);let C,v;if(b===d?(C=w,v=x):(C=yield this.findINode(a,b),v=yield this.getDirListing(a,b,C)),v[S]){let _=yield this.getINode(a,i,v[S]);if(_.isFile())try{yield a.del(_.id),yield a.del(v[S])}catch(A){throw yield a.abort(),A}else throw h.EPERM(i)}v[S]=F;try{yield a.put(w.id,k.from(JSON.stringify(x)),!0),yield a.put(C.id,k.from(JSON.stringify(v)),!0)}catch(_){throw yield a.abort(),_}yield a.commit()}finally{c&&(this._cache=c)}})}stat(e,i){return g(this,null,function*(){let o=this.store.beginTransaction("readonly"),a=(yield this.findINode(o,e)).toStats();if(!a.hasAccess(4,i))throw h.EACCES(e);return a})}createFile(e,i,o,c){return g(this,null,function*(){let a=this.store.beginTransaction("readwrite"),d=k.alloc(0),m=yield this.commitNewFile(a,e,G.FILE,o,c,d);return new rt(this,e,i,m.toStats(),d)})}openFile(e,i,o){return g(this,null,function*(){let c=this.store.beginTransaction("readonly"),a=yield this.findINode(c,e),d=yield c.get(a.id);if(!a.toStats().hasAccess(i.getMode(),o))throw h.EACCES(e);if(d===void 0)throw h.ENOENT(e);return new rt(this,e,i,a.toStats(),d)})}unlink(e,i){return g(this,null,function*(){return this.removeEntry(e,!1,i)})}rmdir(e,i){return g(this,null,function*(){if((yield this.readdir(e,i)).length>0)throw h.ENOTEMPTY(e);yield this.removeEntry(e,!0,i)})}mkdir(e,i,o){return g(this,null,function*(){let c=this.store.beginTransaction("readwrite"),a=k.from("{}");yield this.commitNewFile(c,e,G.DIRECTORY,i,o,a)})}readdir(e,i){return g(this,null,function*(){let o=this.store.beginTransaction("readonly"),c=yield this.findINode(o,e);if(!c.toStats().hasAccess(4,i))throw h.EACCES(e);return Object.keys(yield this.getDirListing(o,e,c))})}chmod(e,i,o){return g(this,null,function*(){yield(yield this.openFile(e,O.getFileFlag("r+"),o)).chmod(i)})}chown(e,i,o,c){return g(this,null,function*(){yield(yield this.openFile(e,O.getFileFlag("r+"),c)).chown(i,o)})}_sync(e,i,o){return g(this,null,function*(){let c=this.store.beginTransaction("readwrite"),a=yield this._findINode(c,U(e),re(e)),d=yield this.getINode(c,e,a),m=d.update(o);try{yield c.put(d.id,i,!0),m&&(yield c.put(a,d.toBuffer(),!0))}catch(b){throw yield c.abort(),b}yield c.commit()})}makeRootDirectory(){return g(this,null,function*(){let e=this.store.beginTransaction("readwrite");if((yield e.get(he))===void 0){let i=new Date().getTime(),o=new se(Ke(),4096,511|G.DIRECTORY,i,i,i,0,0);yield e.put(o.id,lt(),!1),yield e.put(he,o.toBuffer(),!1),yield e.commit()}})}_findINode(a,d,m){return g(this,arguments,function*(e,i,o,c=new Set){let b=Ne.join(i,o);if(c.has(b))throw new h(5,"Infinite loop detected while finding inode",b);if(c.add(b),this._cache){let S=this._cache.get(b);if(S)return S}if(i==="/"){if(o==="")return this._cache&&this._cache.set(b,he),he;{let S=yield this.getINode(e,i,he),w=yield this.getDirListing(e,i,S);if(w[o]){let x=w[o];return this._cache&&this._cache.set(b,x),x}else throw h.ENOENT(ve(i,o))}}else{let S=yield this.findINode(e,i,c),w=yield this.getDirListing(e,i,S);if(w[o]){let x=w[o];return this._cache&&this._cache.set(b,x),x}else throw h.ENOENT(ve(i,o))}})}findINode(c,a){return g(this,arguments,function*(e,i,o=new Set){let d=yield this._findINode(e,U(i),re(i),o);return this.getINode(e,i,d)})}getINode(e,i,o){return g(this,null,function*(){let c=yield e.get(o);if(!c)throw h.ENOENT(i);return se.fromBuffer(c)})}getDirListing(e,i,o){return g(this,null,function*(){if(!o.isDirectory())throw h.ENOTDIR(i);let c=yield e.get(o.id);try{return JSON.parse(c.toString())}catch(a){throw h.ENOENT(i)}})}addNewNode(e,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=Ke();return(yield e.put(a,i,!1))?a:c()}}),"reroll");return c()})}commitNewFile(e,i,o,c,a,d){return g(this,null,function*(){let m=U(i),b=re(i),S=yield this.findINode(e,m),w=yield this.getDirListing(e,m,S),x=new Date().getTime();if(!S.toStats().hasAccess(2,a))throw h.EACCES(i);if(i==="/")throw h.EEXIST(i);if(w[b])throw yield e.abort(),h.EEXIST(i);try{let F=yield this.addNewNode(e,d),C=new se(F,d.length,c|o,x,x,x,a.uid,a.gid),v=yield this.addNewNode(e,C.toBuffer());return w[b]=v,yield e.put(S.id,k.from(JSON.stringify(w)),!0),yield e.commit(),C}catch(F){throw e.abort(),F}})}removeEntry(e,i,o){return g(this,null,function*(){this._cache&&this._cache.remove(e);let c=this.store.beginTransaction("readwrite"),a=U(e),d=yield this.findINode(c,a),m=yield this.getDirListing(c,a,d),b=re(e);if(!m[b])throw h.ENOENT(e);let S=m[b],w=yield this.getINode(c,e,S);if(!w.toStats().hasAccess(2,o))throw h.EACCES(e);if(delete m[b],!i&&w.isDirectory())throw h.EISDIR(e);if(i&&!w.isDirectory())throw h.ENOTDIR(e);try{yield c.del(w.id),yield c.del(S),yield c.put(d.id,k.from(JSON.stringify(m)),!0)}catch(x){throw yield c.abort(),x}yield c.commit()})}};l(zt,"AsyncKeyValueFileSystem");N&&void 0&&(void 0)();function Tn(n,t=0,e=0){return bn(new q(t,e,t,e,t,e)),Rt.initialize(n)}l(Tn,"initialize");function In(n){return g(this,null,function*(){("fs"in n||n instanceof Ae)&&(n={"/":n});for(let[t,e]of Object.entries(n))typeof e!="number"&&(t=t.toString(),!(e instanceof Ae)&&(typeof e=="string"&&(e={fs:e}),n[t]=yield Nn(e)));return Tn(n)})}l(In,"_configure");function Fa(n,t){if(typeof t!="function")return In(n);In(n).then(()=>t()).catch(e=>t(e))}l(Fa,"configure");function Ni(e){return g(this,arguments,function*({fs:n,options:t={}}){if(!n)throw new h(1,'Missing "fs" property on configuration object.');if(typeof t!="object"||t===null)throw new h(22,'Invalid "options" property on configuration object.');let i=Object.keys(t).filter(c=>c!="fs");for(let c of i){let a=t[c];if(a===null||typeof a!="object"||!("fs"in a))continue;let d=yield Ni(a);t[c]=d}let o=Ut[n];if(o)return o.Create(t);throw new h(1,`File system ${n} is not available in ZenFS.`)})}l(Ni,"_getFileSystem");function Nn(n,t){if(typeof t!="function")return Ni(n);Ni(n).then(e=>t(null,e)).catch(e=>t(e))}l(Nn,"getFileSystem");var xa=Rt;return ns(Ca);})();
|
|
3
|
+
Option description: ${m.description}`)}}}a=!0})}l(Mt,"checkOptions");function vn(s){return new Promise(t=>{setTimeout(t,s)})}l(vn,"wait");function Cn(s){return function(...t){return new Promise((e,i)=>{t.push((o,...c)=>{o?i(o):e(c[0])}),s(...t)})}}l(Cn,"toPromise");var xn=typeof globalThis.setImmediate=="function"?globalThis.setImmediate:s=>setTimeout(s,0),fe="/";function it(){return k.from("{}")}l(it,"getEmptyDirNode");function Me(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(s){let t=Math.random()*16|0;return(s==="x"?t:t&3|8).toString(16)})}l(Me,"randomUUID");var Ye=class{constructor(t){this.store=t;this.originalData={};this.modifiedKeys=[]}get(t){let e=this.store.get(t);return this.stashOldValue(t,e),e}put(t,e,i){return this.markModified(t),this.store.put(t,e,i)}del(t){this.markModified(t),this.store.del(t)}commit(){}abort(){for(let t of this.modifiedKeys){let e=this.originalData[t];e?this.store.put(t,e,!0):this.store.del(t)}}_has(t){return Object.prototype.hasOwnProperty.call(this.originalData,t)}stashOldValue(t,e){this._has(t)||(this.originalData[t]=e)}markModified(t){this.modifiedKeys.indexOf(t)===-1&&(this.modifiedKeys.push(t),this._has(t)||(this.originalData[t]=this.store.get(t)))}};l(Ye,"SimpleSyncRWTransaction");var Xe=class extends ae{constructor(t,e,i,o,c){super(t,e,i,o,c)}syncSync(){this.isDirty()&&(this._fs._syncSync(this.getPath(),this.getBuffer(),this.getStats()),this.resetDirty())}closeSync(){this.syncSync()}};l(Xe,"SyncKeyValueFile");var qe=class extends Te{constructor(e){super();this.store=e.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(e,i,o){let c=this.store.beginTransaction("readonly");if(!this.findINode(c,e).toStats().hasAccess(i,o))throw h.EACCES(e)}renameSync(e,i,o){let c=this.store.beginTransaction("readwrite"),a=D(e),d=ie(e),m=D(i),b=ie(i),S=this.findINode(c,a),w=this.getDirListing(c,a,S);if(!S.toStats().hasAccess(2,o))throw h.EACCES(e);if(!w[d])throw h.ENOENT(e);let C=w[d];if(delete w[d],(m+"/").indexOf(e+"/")===0)throw new h(16,a);let v,x;if(m===a?(v=S,x=w):(v=this.findINode(c,m),x=this.getDirListing(c,m,v)),x[b]){let F=this.getINode(c,i,x[b]);if(F.isFile())try{c.del(F.id),c.del(x[b])}catch(_){throw c.abort(),_}else throw h.EPERM(i)}x[b]=C;try{c.put(S.id,k.from(JSON.stringify(w)),!0),c.put(v.id,k.from(JSON.stringify(x)),!0)}catch(F){throw c.abort(),F}c.commit()}statSync(e,i){let o=this.findINode(this.store.beginTransaction("readonly"),e).toStats();if(!o.hasAccess(4,i))throw h.EACCES(e);return o}createFileSync(e,i,o,c){let a=this.store.beginTransaction("readwrite"),d=k.alloc(0),m=this.commitNewFile(a,e,H.FILE,o,c,d);return new Xe(this,e,i,m.toStats(),d)}openFileSync(e,i,o){let c=this.store.beginTransaction("readonly"),a=this.findINode(c,e),d=c.get(a.id);if(!a.toStats().hasAccess(i.getMode(),o))throw h.EACCES(e);if(d===void 0)throw h.ENOENT(e);return new Xe(this,e,i,a.toStats(),d)}unlinkSync(e,i){this.removeEntry(e,!1,i)}rmdirSync(e,i){if(this.readdirSync(e,i).length>0)throw h.ENOTEMPTY(e);this.removeEntry(e,!0,i)}mkdirSync(e,i,o){let c=this.store.beginTransaction("readwrite"),a=k.from("{}");this.commitNewFile(c,e,H.DIRECTORY,i,o,a)}readdirSync(e,i){let o=this.store.beginTransaction("readonly"),c=this.findINode(o,e);if(!c.toStats().hasAccess(4,i))throw h.EACCES(e);return Object.keys(this.getDirListing(o,e,c))}chmodSync(e,i,o){this.openFileSync(e,N.getFileFlag("r+"),o).chmodSync(i)}chownSync(e,i,o,c){this.openFileSync(e,N.getFileFlag("r+"),c).chownSync(i,o)}_syncSync(e,i,o){let c=this.store.beginTransaction("readwrite"),a=this._findINode(c,D(e),ie(e)),d=this.getINode(c,e,a),m=d.update(o);try{c.put(d.id,i,!0),m&&c.put(a,d.toBuffer(),!0)}catch(b){throw c.abort(),b}c.commit()}makeRootDirectory(){let e=this.store.beginTransaction("readwrite");if(e.get(fe)===void 0){let i=new Date().getTime(),o=new ne(Me(),4096,511|H.DIRECTORY,i,i,i,0,0);e.put(o.id,it(),!1),e.put(fe,o.toBuffer(),!1),e.commit()}}_findINode(e,i,o,c=new Set){let a=ke.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 b=this.getDirListing(e,i,m);if(b[o])return b[o];throw h.ENOENT(Ee(i,o))},"readDirectory");return i==="/"?o===""?fe:d(this.getINode(e,i,fe)):d(this.getINode(e,i+Le+o,this._findINode(e,D(i),ie(i),c)))}findINode(e,i){return this.getINode(e,i,this._findINode(e,D(i),ie(i)))}getINode(e,i,o){let c=e.get(o);if(c===void 0)throw h.ENOENT(i);return ne.fromBuffer(c)}getDirListing(e,i,o){if(!o.isDirectory())throw h.ENOTDIR(i);let c=e.get(o.id);if(c===void 0)throw h.ENOENT(i);return JSON.parse(c.toString())}addNewNode(e,i){let c;for(;0<5;)try{return c=Me(),e.put(c,i,!1),c}catch(a){}throw new h(5,"Unable to commit data to key-value store.")}commitNewFile(e,i,o,c,a,d){let m=D(i),b=ie(i),S=this.findINode(e,m),w=this.getDirListing(e,m,S),C=new Date().getTime();if(!S.toStats().hasAccess(4,a))throw h.EACCES(i);if(i==="/")throw h.EEXIST(i);if(w[b])throw h.EEXIST(i);let v;try{let x=this.addNewNode(e,d);v=new ne(x,d.length,c|o,C,C,C,a.uid,a.gid);let F=this.addNewNode(e,v.toBuffer());w[b]=F,e.put(S.id,k.from(JSON.stringify(w)),!0)}catch(x){throw e.abort(),x}return e.commit(),v}removeEntry(e,i,o){let c=this.store.beginTransaction("readwrite"),a=D(e),d=this.findINode(c,a),m=this.getDirListing(c,a,d),b=ie(e);if(!m[b])throw h.ENOENT(e);let S=m[b],w=this.getINode(c,e,S);if(!w.toStats().hasAccess(2,o))throw h.EACCES(e);if(delete m[b],!i&&w.isDirectory())throw h.EISDIR(e);if(i&&!w.isDirectory())throw h.ENOTDIR(e);try{c.del(w.id),c.del(S),c.put(d.id,k.from(JSON.stringify(m)),!0)}catch(C){throw c.abort(),C}c.commit()}};l(qe,"SyncKeyValueFileSystem");function Ne(s,t){t=typeof s=="function"?s:t,Mt(this,s);let e=new this(typeof s=="function"?{}:s);if(typeof t!="function")return e.whenReady();e.whenReady().then(i=>t(null,i)).catch(i=>t(i))}l(Ne,"CreateBackend");var bt=class{constructor(){this.store=new Map}name(){return he.Name}clear(){this.store.clear()}beginTransaction(t){return new Ye(this)}get(t){return this.store.get(t)}put(t,e,i){return!i&&this.store.has(t)?!1:(this.store.set(t,e),!0)}del(t){this.store.delete(t)}};l(bt,"InMemoryStore");var zt=class extends qe{constructor(){super({store:new bt})}},he=zt;l(he,"InMemoryFileSystem"),he.Name="InMemory",he.Create=Ne.bind(zt),he.Options={};function $i(s){if(typeof s=="number")return s;if(s instanceof Date)return s.getTime()/1e3;throw new Error("Cannot parse time: "+s)}l($i,"_toUnixTimestamp");function ce(s,t){switch(typeof s){case"number":return s;case"string":let e=parseInt(s,8);return isNaN(e)?t:e;default:return t}}l(ce,"normalizeMode");function se(s){if(s instanceof Date)return s;if(typeof s=="number")return new Date(s*1e3);throw new h(22,"Invalid time.")}l(se,"normalizeTime");function Y(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,"/"),ke.resolve(s)}l(Y,"normalizePath");function Oe(s,t,e,i){switch(s===null?"null":typeof s){case"object":return{encoding:typeof s.encoding!="undefined"?s.encoding:t,flag:typeof s.flag!="undefined"?s.flag:e,mode:ce(s.mode,i)};case"string":return{encoding:s,flag:e,mode:i};case"null":case"undefined":case"function":return{encoding:t,flag:e,mode:i};default:throw new TypeError(`"options" must be a string or an object, got ${typeof s} instead.`)}}l(Oe,"normalizeOptions");function I(){}l(I,"nop");var B=K.Root;function Ki(s){B=s}l(Ki,"setCred");var ze=new Map,_n=100;function wt(s){let t=_n++;return ze.set(t,s),t}l(wt,"getFdForFile");function j(s){if(!ze.has(s))throw new h(9,"Invalid file descriptor.");return ze.get(s)}l(j,"fd2file");var ge=new Map;he.Create().then(s=>St("/",s));function je(s){return ge.get(s)}l(je,"getMount");function ji(){return Object.fromEntries(ge.entries())}l(ji,"getMounts");function St(s,t){if(s[0]!=="/"&&(s="/"+s),s=ke.resolve(s),ge.has(s))throw new h(22,"Mount point "+s+" is already in use.");ge.set(s,t)}l(St,"mount");function Vt(s){if(s[0]!=="/"&&(s=`/${s}`),s=ke.resolve(s),!ge.has(s))throw new h(22,"Mount point "+s+" is already unmounted.");ge.delete(s)}l(Vt,"umount");function me(s){let t=[...ge].sort((e,i)=>e[0].length>i[0].length?-1:1);for(let[e,i]of t)if(e.length<=s.length&&s.startsWith(e))return s=s.slice(e.length>1?e.length:0),s===""&&(s="/"),{fs:i,path:s,mountPoint:e};throw new h(5,"ZenFS not initialized with a file system")}l(me,"resolveFS");function Wi(s,t){for(let[e,i]of Object.entries(t))s=s.replaceAll(e,i);return s}l(Wi,"fixPaths");function Ae(s,t){return s.stack=Wi(s.stack,t),s.message=Wi(s.message,t),s}l(Ae,"fixError");function Yi(s){s["/"]&&Vt("/");for(let[t,e]of Object.entries(s)){if(!e.constructor.isAvailable())throw new h(22,`Can not mount "${t}" since the filesystem is unavailable.`);St(t,e)}}l(Yi,"initialize");var nt={};ut(nt,{access:()=>pi,appendFile:()=>Xt,chmod:()=>di,chown:()=>li,close:()=>Jt,constants:()=>Ke,createReadStream:()=>Tn,createWriteStream:()=>Nn,exists:()=>Et,fchmod:()=>ti,fchown:()=>ei,fdatasync:()=>Zt,fstat:()=>qt,fsync:()=>Ht,ftruncate:()=>Gt,futimes:()=>ii,lchmod:()=>fi,lchown:()=>ui,link:()=>oi,lstat:()=>Kt,lutimes:()=>mi,mkdir:()=>ni,open:()=>Yt,read:()=>Qt,readFile:()=>vt,readdir:()=>si,readlink:()=>ci,realpath:()=>rt,rename:()=>Wt,rmdir:()=>ri,stat:()=>$t,symlink:()=>ai,truncate:()=>jt,unlink:()=>Ft,unwatchFile:()=>Bn,utimes:()=>hi,watch:()=>In,watchFile:()=>kn,write:()=>xt,writeFile:()=>Ct});function X(){return g(this,arguments,function*(...[s,t,e,...i]){e=Y(e);let{fs:o,path:c}=me(t&&(yield Et(e))?yield rt(e):e);try{return o[s](c,...i)}catch(a){throw Ae(a,{[c]:e})}})}l(X,"doOp");function Wt(s,t){return g(this,null,function*(){s=Y(s),t=Y(t);let e=me(s),i=me(t),o={[e.path]:s,[i.path]:t};try{if(e===i)return e.fs.rename(e.path,i.path,B);let c=yield vt(s);yield Ct(t,c),yield Ft(s)}catch(c){throw Ae(c,o)}})}l(Wt,"rename");function Et(s){return g(this,null,function*(){s=Y(s);try{let{fs:t,path:e}=me(s);return t.exists(e,B)}catch(t){if(t.errno==2)return!1;throw t}})}l(Et,"exists");function $t(s){return g(this,null,function*(){return X("stat",!0,s,B)})}l($t,"stat");function Kt(s){return g(this,null,function*(){return X("stat",!1,s,B)})}l(Kt,"lstat");function jt(s,t=0){return g(this,null,function*(){if(t<0)throw new h(22);return X("truncate",!0,s,t,B)})}l(jt,"truncate");function Ft(s){return g(this,null,function*(){return X("unlink",!1,s,B)})}l(Ft,"unlink");function Yt(s,t,e=420){return g(this,null,function*(){let i=yield X("open",!0,s,N.getFileFlag(t),ce(e,420),B);return wt(i)})}l(Yt,"open");function vt(e){return g(this,arguments,function*(s,t={}){let i=Oe(t,null,"r",null),o=N.getFileFlag(i.flag);if(!o.isReadable())throw new h(22,"Flag passed to readFile must allow for reading.");return X("readFile",!0,s,i.encoding,o,B)})}l(vt,"readFile");function Ct(s,t,e){return g(this,null,function*(){let i=Oe(e,"utf8","w",420),o=N.getFileFlag(i.flag);if(!o.isWriteable())throw new h(22,"Flag passed to writeFile must allow for writing.");return X("writeFile",!0,s,t,i.encoding,o,i.mode,B)})}l(Ct,"writeFile");function Xt(s,t,e){return g(this,null,function*(){let i=Oe(e,"utf8","a",420),o=N.getFileFlag(i.flag);if(!o.isAppendable())throw new h(22,"Flag passed to appendFile must allow for appending.");return X("appendFile",!0,s,t,i.encoding,o,i.mode,B)})}l(Xt,"appendFile");function qt(s){return g(this,null,function*(){return j(s).stat()})}l(qt,"fstat");function Jt(s){return g(this,null,function*(){yield j(s).close(),ze.delete(s)})}l(Jt,"close");function Gt(s,t=0){return g(this,null,function*(){let e=j(s);if(t<0)throw new h(22);return e.truncate(t)})}l(Gt,"ftruncate");function Ht(s){return g(this,null,function*(){return j(s).sync()})}l(Ht,"fsync");function Zt(s){return g(this,null,function*(){return j(s).datasync()})}l(Zt,"fdatasync");function xt(s,t,e,i,o){return g(this,null,function*(){let c,a=0,d,m;if(typeof t=="string"){m=typeof e=="number"?e:null;let S=typeof i=="string"?i:"utf8";a=0,c=k.from(t,S),d=c.length}else c=t,a=e,d=i,m=typeof o=="number"?o:null;let b=j(s);return m==null&&(m=b.getPos()),b.write(c,a,d,m)})}l(xt,"write");function Qt(s,t,e,i,o){return g(this,null,function*(){let c=j(s);return isNaN(+o)&&(o=c.getPos()),c.read(t,e,i,o)})}l(Qt,"read");function ei(s,t,e){return g(this,null,function*(){return j(s).chown(t,e)})}l(ei,"fchown");function ti(s,t){return g(this,null,function*(){let e=typeof t=="string"?parseInt(t,8):t;return j(s).chmod(e)})}l(ti,"fchmod");function ii(s,t,e){return g(this,null,function*(){return j(s).utimes(se(t),se(e))})}l(ii,"futimes");function ri(s){return g(this,null,function*(){return X("rmdir",!0,s,B)})}l(ri,"rmdir");function ni(s,t){return g(this,null,function*(){return X("mkdir",!0,s,ce(t,511),B)})}l(ni,"mkdir");function si(s){return g(this,null,function*(){s=Y(s);let t=yield X("readdir",!0,s,B),e=[...ge.keys()];for(let i of e)if(i.startsWith(s)){let o=i.slice(s.length);if(o.includes("/")||o.length==0)continue;t.push(o)}return t})}l(si,"readdir");function oi(s,t){return g(this,null,function*(){return t=Y(t),X("link",!1,s,t,B)})}l(oi,"link");function ai(s,t,e="file"){return g(this,null,function*(){if(!["file","dir","junction"].includes(e))throw new h(22,"Invalid type: "+e);return t=Y(t),X("symlink",!1,s,t,e,B)})}l(ai,"symlink");function ci(s){return g(this,null,function*(){return X("readlink",!1,s,B)})}l(ci,"readlink");function li(s,t,e){return g(this,null,function*(){return X("chown",!0,s,t,e,B)})}l(li,"chown");function ui(s,t,e){return g(this,null,function*(){return X("chown",!1,s,t,e,B)})}l(ui,"lchown");function di(s,t){return g(this,null,function*(){let e=ce(t,-1);if(e<0)throw new h(22,"Invalid mode.");return X("chmod",!0,s,e,B)})}l(di,"chmod");function fi(s,t){return g(this,null,function*(){let e=ce(t,-1);if(e<1)throw new h(22,"Invalid mode.");return X("chmod",!1,Y(s),e,B)})}l(fi,"lchmod");function hi(s,t,e){return g(this,null,function*(){return X("utimes",!0,s,se(t),se(e),B)})}l(hi,"utimes");function mi(s,t,e){return g(this,null,function*(){return X("utimes",!1,s,se(t),se(e),B)})}l(mi,"lutimes");function rt(e){return g(this,arguments,function*(s,t={}){s=Y(s);let{fs:i,path:o,mountPoint:c}=me(s);try{if(!(yield i.stat(o,B)).isSymbolicLink())return s;let d=c+Y(yield i.readlink(o,B));return rt(d)}catch(a){throw Ae(a,{[o]:s})}})}l(rt,"realpath");function kn(i,o){return g(this,arguments,function*(s,t,e=I){throw new h(95)})}l(kn,"watchFile");function Bn(e){return g(this,arguments,function*(s,t=I){throw new h(95)})}l(Bn,"unwatchFile");function In(i,o){return g(this,arguments,function*(s,t,e=I){throw new h(95)})}l(In,"watch");function pi(s,t=384){return g(this,null,function*(){return X("access",!0,s,t,B)})}l(pi,"access");function Tn(s,t){return g(this,null,function*(){throw new h(95)})}l(Tn,"createReadStream");function Nn(s,t){return g(this,null,function*(){throw new h(95)})}l(Nn,"createWriteStream");function On(s,t,e=I){Wt(s,t).then(()=>e()).catch(e)}l(On,"rename");function An(s,t=I){Et(s).then(t).catch(()=>t(!1))}l(An,"exists");function Pn(s,t=I){$t(s).then(e=>t(null,e)).catch(t)}l(Pn,"stat");function Rn(s,t=I){Kt(s).then(e=>t(null,e)).catch(t)}l(Rn,"lstat");function Ln(s,t=0,e=I){e=typeof t=="function"?t:e,jt(s,typeof t=="number"?t:0).then(()=>e()).catch(e)}l(Ln,"truncate");function Dn(s,t=I){Ft(s).then(()=>t()).catch(t)}l(Dn,"unlink");function Un(s,t,e,i=I){let o=ce(e,420);i=typeof e=="function"?e:i,Yt(s,t,o).then(c=>i(null,c)).catch(i)}l(Un,"open");function Mn(s,t={},e=I){e=typeof t=="function"?t:e,vt(s,typeof t=="function"?null:t)}l(Mn,"readFile");function zn(s,t,e={},i=I){i=typeof e=="function"?e:i,Ct(s,t,typeof e=="function"?void 0:e)}l(zn,"writeFile");function Vn(s,t,e,i=I){i=typeof e=="function"?e:i,Xt(s,t,typeof e=="function"?null:e)}l(Vn,"appendFile");function Wn(s,t=I){qt(s).then(e=>t(null,e)).catch(t)}l(Wn,"fstat");function $n(s,t=I){Jt(s).then(()=>t()).catch(t)}l($n,"close");function Kn(s,t,e=I){let i=typeof t=="number"?t:0;e=typeof t=="function"?t:e,Gt(s,i)}l(Kn,"ftruncate");function jn(s,t=I){Ht(s).then(()=>t()).catch(t)}l(jn,"fsync");function Yn(s,t=I){Zt(s).then(()=>t()).catch(t)}l(Yn,"fdatasync");function Xn(s,t,e,i,o,c=I){let a,d,m,b=null,S;if(typeof t=="string"){switch(S="utf8",typeof e){case"function":c=e;break;case"number":b=e,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(t,S),d=0,m=a.length;let w=c;xt(s,a,d,m,b).then(C=>w(null,C,a.toString(S))).catch(w)}else{a=t,d=e,m=i,b=typeof o=="number"?o:null;let w=typeof o=="function"?o:c;xt(s,a,d,m,b).then(C=>w(null,C,a)).catch(w)}}l(Xn,"write");function qn(s,t,e,i,o,c=I){Qt(s,t,e,i,o).then(({bytesRead:a,buffer:d})=>c(null,a,d)).catch(c)}l(qn,"read");function Jn(s,t,e,i=I){ei(s,t,e).then(()=>i()).catch(i)}l(Jn,"fchown");function Gn(s,t,e){ti(s,t).then(()=>e()).catch(e)}l(Gn,"fchmod");function Hn(s,t,e,i=I){ii(s,t,e).then(()=>i()).catch(i)}l(Hn,"futimes");function Zn(s,t=I){ri(s).then(()=>t()).catch(t)}l(Zn,"rmdir");function Qn(s,t,e=I){ni(s,t).then(()=>e()).catch(e)}l(Qn,"mkdir");function es(s,t=I){si(s).then(e=>t(null,e)).catch(t)}l(es,"readdir");function ts(s,t,e=I){oi(s,t).then(()=>e()).catch(e)}l(ts,"link");function is(s,t,e,i=I){let o=typeof e=="string"?e:"file";i=typeof e=="function"?e:i,ai(s,t,typeof e=="function"?null:e).then(()=>i()).catch(i)}l(is,"symlink");function rs(s,t=I){ci(s).then(e=>t(null,e)).catch(t)}l(rs,"readlink");function ns(s,t,e,i=I){li(s,t,e).then(()=>i()).catch(i)}l(ns,"chown");function ss(s,t,e,i=I){ui(s,t,e).then(()=>i()).catch(i)}l(ss,"lchown");function os(s,t,e=I){di(s,t).then(()=>e()).catch(e)}l(os,"chmod");function as(s,t,e=I){fi(s,t).then(()=>e()).catch(e)}l(as,"lchmod");function cs(s,t,e,i=I){hi(s,t,e).then(()=>i()).catch(i)}l(cs,"utimes");function ls(s,t,e,i=I){mi(s,t,e).then(()=>i()).catch(i)}l(ls,"lutimes");function us(s,t,e=I){let i=typeof t=="object"?t:{};e=typeof t=="function"?t:e,rt(s,typeof t=="function"?null:t).then(o=>e(null,o)).catch(e)}l(us,"realpath");function ds(s,t,e=I){let i=typeof t=="number"?t:4;e=typeof t=="function"?t:e,pi(s,typeof t=="function"?null:t).then(()=>e()).catch(e)}l(ds,"access");function fs(s,t,e=I){throw new h(95)}l(fs,"watchFile");function hs(s,t=I){throw new h(95)}l(hs,"unwatchFile");function ms(s,t,e=I){throw new h(95)}l(ms,"watch");function ps(s,t){throw new h(95)}l(ps,"createReadStream");function gs(s,t){throw new h(95)}l(gs,"createWriteStream");function q(...[s,t,e,...i]){e=Y(e);let{fs:o,path:c}=me(t&&Xi(e)?gi(e):e);try{return o[s](c,...i)}catch(a){throw Ae(a,{[c]:e})}}l(q,"doOp");function ys(s,t){s=Y(s),t=Y(t);let e=me(s),i=me(t),o={[e.path]:s,[i.path]:t};try{if(e===i)return e.fs.renameSync(e.path,i.path,B);let c=Ji(s);Gi(t,c),qi(s)}catch(c){throw Ae(c,o)}}l(ys,"renameSync");function Xi(s){s=Y(s);try{let{fs:t,path:e}=me(s);return t.existsSync(e,B)}catch(t){if(t.errno==2)return!1;throw t}}l(Xi,"existsSync");function bs(s){return q("statSync",!0,s,B)}l(bs,"statSync");function ws(s){return q("statSync",!1,s,B)}l(ws,"lstatSync");function Ss(s,t=0){if(t<0)throw new h(22);return q("truncateSync",!0,s,t,B)}l(Ss,"truncateSync");function qi(s){return q("unlinkSync",!1,s,B)}l(qi,"unlinkSync");function Es(s,t,e=420){let i=q("openSync",!0,s,N.getFileFlag(t),ce(e,420),B);return wt(i)}l(Es,"openSync");function Ji(s,t={}){let e=Oe(t,null,"r",null),i=N.getFileFlag(e.flag);if(!i.isReadable())throw new h(22,"Flag passed to readFile must allow for reading.");return q("readFileSync",!0,s,e.encoding,i,B)}l(Ji,"readFileSync");function Gi(s,t,e){let i=Oe(e,"utf8","w",420),o=N.getFileFlag(i.flag);if(!o.isWriteable())throw new h(22,"Flag passed to writeFile must allow for writing.");return q("writeFileSync",!0,s,t,i.encoding,o,i.mode,B)}l(Gi,"writeFileSync");function Fs(s,t,e){let i=Oe(e,"utf8","a",420),o=N.getFileFlag(i.flag);if(!o.isAppendable())throw new h(22,"Flag passed to appendFile must allow for appending.");return q("appendFileSync",!0,s,t,i.encoding,o,i.mode,B)}l(Fs,"appendFileSync");function vs(s){return j(s).statSync()}l(vs,"fstatSync");function Cs(s){j(s).closeSync(),ze.delete(s)}l(Cs,"closeSync");function xs(s,t=0){let e=j(s);if(t<0)throw new h(22);e.truncateSync(t)}l(xs,"ftruncateSync");function _s(s){j(s).syncSync()}l(_s,"fsyncSync");function ks(s){j(s).datasyncSync()}l(ks,"fdatasyncSync");function Bs(s,t,e,i,o){let c,a=0,d,m;if(typeof t=="string"){m=typeof e=="number"?e:null;let S=typeof i=="string"?i:"utf8";a=0,c=k.from(t,S),d=c.length}else c=t,a=e,d=i,m=typeof o=="number"?o:null;let b=j(s);return m==null&&(m=b.getPos()),b.writeSync(c,a,d,m)}l(Bs,"writeSync");function Is(s,t,e,i,o){let c=j(s),a=e;return typeof e=="object"&&({offset:a,length:i,position:o}=e),isNaN(+o)&&(o=c.getPos()),c.readSync(t,a,i,o)}l(Is,"readSync");function Ts(s,t,e){j(s).chownSync(t,e)}l(Ts,"fchownSync");function Ns(s,t){let e=typeof t=="string"?parseInt(t,8):t;j(s).chmodSync(e)}l(Ns,"fchmodSync");function Os(s,t,e){j(s).utimesSync(se(t),se(e))}l(Os,"futimesSync");function As(s){return q("rmdirSync",!0,s,B)}l(As,"rmdirSync");function Ps(s,t){q("mkdirSync",!0,s,ce(t,511),B)}l(Ps,"mkdirSync");function Rs(s){s=Y(s);let t=q("readdirSync",!0,s,B),e=[...ge.keys()];for(let i of e)if(i.startsWith(s)){let o=i.slice(s.length);if(o.includes("/")||o.length==0)continue;t.push(o)}return t}l(Rs,"readdirSync");function Ls(s,t){return t=Y(t),q("linkSync",!1,s,t,B)}l(Ls,"linkSync");function Ds(s,t,e){if(!["file","dir","junction"].includes(e))throw new h(22,"Invalid type: "+e);return t=Y(t),q("symlinkSync",!1,s,t,e,B)}l(Ds,"symlinkSync");function Us(s){return q("readlinkSync",!1,s,B)}l(Us,"readlinkSync");function Ms(s,t,e){q("chownSync",!0,s,t,e,B)}l(Ms,"chownSync");function zs(s,t,e){q("chownSync",!1,s,t,e,B)}l(zs,"lchownSync");function Vs(s,t){let e=ce(t,-1);if(e<0)throw new h(22,"Invalid mode.");q("chmodSync",!0,s,e,B)}l(Vs,"chmodSync");function Ws(s,t){let e=ce(t,-1);if(e<1)throw new h(22,"Invalid mode.");q("chmodSync",!1,s,e,B)}l(Ws,"lchmodSync");function $s(s,t,e){q("utimesSync",!0,s,se(t),se(e),B)}l($s,"utimesSync");function Ks(s,t,e){q("utimesSync",!1,s,se(t),se(e),B)}l(Ks,"lutimesSync");function gi(s,t={}){s=Y(s);let{fs:e,path:i,mountPoint:o}=me(s);try{if(!e.statSync(i,B).isSymbolicLink())return s;let a=Y(o+e.readlinkSync(i,B));return gi(a)}catch(c){throw Ae(c,{[i]:s})}}l(gi,"realpathSync");function js(s,t=384){return q("accessSync",!0,s,t,B)}l(js,"accessSync");var Ys=yi,_t=Ys;var kt=class extends ae{constructor(t,e,i,o,c){super(t,e,i,o,c)}syncSync(){this.isDirty()&&(this._fs._syncSync(this),this.resetDirty())}closeSync(){this.syncSync()}};l(kt,"MirrorFile");var st=class extends Te{constructor({sync:e,async:i}){super();this._queue=[];this._queueRunning=!1;this._isInitialized=!1;this._initializeCallbacks=[];this._sync=e,this._async=i,this._ready=this._initialize()}static isAvailable(){return!0}get metadata(){return we(pe({},super.metadata),{name:st.Name,synchronous:!0,supportsProperties:this._sync.metadata.supportsProperties&&this._async.metadata.supportsProperties})}_syncSync(e){let i=e.getStats();this._sync.writeFileSync(e.getPath(),e.getBuffer(),null,N.getFileFlag("w"),i.mode,i.getCred(0,0)),this.enqueueOp({apiMethod:"writeFile",arguments:[e.getPath(),e.getBuffer(),null,e.getFlag(),i.mode,i.getCred(0,0)]})}renameSync(e,i,o){this._sync.renameSync(e,i,o),this.enqueueOp({apiMethod:"rename",arguments:[e,i,o]})}statSync(e,i){return this._sync.statSync(e,i)}openSync(e,i,o,c){return this._sync.openSync(e,i,o,c).closeSync(),new kt(this,e,i,this._sync.statSync(e,c),this._sync.readFileSync(e,null,N.getFileFlag("r"),c))}unlinkSync(e,i){this._sync.unlinkSync(e,i),this.enqueueOp({apiMethod:"unlink",arguments:[e,i]})}rmdirSync(e,i){this._sync.rmdirSync(e,i),this.enqueueOp({apiMethod:"rmdir",arguments:[e,i]})}mkdirSync(e,i,o){this._sync.mkdirSync(e,i,o),this.enqueueOp({apiMethod:"mkdir",arguments:[e,i,o]})}readdirSync(e,i){return this._sync.readdirSync(e,i)}existsSync(e,i){return this._sync.existsSync(e,i)}chmodSync(e,i,o){this._sync.chmodSync(e,i,o),this.enqueueOp({apiMethod:"chmod",arguments:[e,i,o]})}chownSync(e,i,o,c){this._sync.chownSync(e,i,o,c),this.enqueueOp({apiMethod:"chown",arguments:[e,i,o,c]})}utimesSync(e,i,o,c){this._sync.utimesSync(e,i,o,c),this.enqueueOp({apiMethod:"utimes",arguments:[e,i,o,c]})}_initialize(){return g(this,null,function*(){if(!this._isInitialized){let e=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(Se(c,m))}),"copyDirectory"),i=l((c,a)=>g(this,null,function*(){let d=yield this._async.readFile(c,null,N.getFileFlag("r"),K.Root);this._sync.writeFileSync(c,d,null,N.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 e(c,a.mode):yield i(c,a.mode)}),"copyItem");try{yield e("/",0),this._isInitialized=!0}catch(c){throw this._isInitialized=!1,c}}return this})}enqueueOp(e){if(this._queue.push(e),!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()}}},Ce=st;l(Ce,"AsyncMirror"),Ce.Name="AsyncMirror",Ce.Create=Ne.bind(st),Ce.Options={sync:{type:"object",description:"The synchronous file system to mirror the asynchronous file system to.",validator:e=>g(st,null,function*(){if(!(e!=null&&e.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 bi=class extends de{constructor({folder:e,wrapped:i}){super();this._folder=e,this._wrapped=i,this._ready=this._initialize()}static isAvailable(){return!0}get metadata(){return we(pe(pe({},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})}},ye=bi;l(ye,"FolderAdapter"),ye.Name="FolderAdapter",ye.Create=Ne.bind(bi),ye.Options={folder:{type:"string",description:"The folder to use as the root directory"},wrapped:{type:"object",description:"The file system to wrap"}};function Hi(s,t){if(t!==null&&typeof t=="object"){let e=t,i=e.path;i&&(i="/"+zi(s,i),e.message=e.message.replace(e.path,i),e.path=i)}return t}l(Hi,"translateError");function Xs(s,t){return typeof t=="function"?function(e){arguments.length>0&&(arguments[0]=Hi(s,e)),t.apply(null,arguments)}:t}l(Xs,"wrapCallback");function Zi(s,t,e){return s.slice(s.length-4)!=="Sync"?function(){return arguments.length>0&&(t&&(arguments[0]=Se(this._folder,arguments[0])),e&&(arguments[1]=Se(this._folder,arguments[1])),arguments[arguments.length-1]=Xs(this._folder,arguments[arguments.length-1])),this._wrapped[s].apply(this._wrapped,arguments)}:function(){try{return t&&(arguments[0]=Se(this._folder,arguments[0])),e&&(arguments[1]=Se(this._folder,arguments[1])),this._wrapped[s].apply(this._wrapped,arguments)}catch(i){throw Hi(this._folder,i)}}}l(Zi,"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=>{ye.prototype[s]=Zi(s,!0,!1)});["rename","renameSync","link","linkSync","symlink","symlinkSync"].forEach(s=>{ye.prototype[s]=Zi(s,!0,!0)});var Je=class{constructor(){this._locks=new Map}lock(t){return new Promise(e=>{this._locks.has(t)?this._locks.get(t).push(e):this._locks.set(t,[])})}unlock(t){if(!this._locks.has(t))throw new Error("unlock of a non-locked mutex");let e=this._locks.get(t).shift();if(e){setTimeout(e,0);return}this._locks.delete(t)}tryLock(t){return this._locks.has(t)?!1:(this._locks.set(t,[]),!0)}isLocked(t){return this._locks.has(t)}};l(Je,"Mutex");var Ge=class{constructor(t){this._ready=Promise.resolve(this);this._fs=t,this._mu=new Je}whenReady(){return this._ready}get metadata(){return we(pe({},this._fs.metadata),{name:"LockedFS<"+this._fs.metadata.name+">"})}get fs(){return this._fs}rename(t,e,i){return g(this,null,function*(){yield this._mu.lock(t),yield this._fs.rename(t,e,i),this._mu.unlock(t)})}renameSync(t,e,i){if(this._mu.isLocked(t))throw new Error("invalid sync call");return this._fs.renameSync(t,e,i)}stat(t,e){return g(this,null,function*(){yield this._mu.lock(t);let i=yield this._fs.stat(t,e);return this._mu.unlock(t),i})}statSync(t,e){if(this._mu.isLocked(t))throw new Error("invalid sync call");return this._fs.statSync(t,e)}access(t,e,i){return g(this,null,function*(){yield this._mu.lock(t),yield this._fs.access(t,e,i),this._mu.unlock(t)})}accessSync(t,e,i){if(this._mu.isLocked(t))throw new Error("invalid sync call");return this._fs.accessSync(t,e,i)}open(t,e,i,o){return g(this,null,function*(){yield this._mu.lock(t);let c=yield this._fs.open(t,e,i,o);return this._mu.unlock(t),c})}openSync(t,e,i,o){if(this._mu.isLocked(t))throw new Error("invalid sync call");return this._fs.openSync(t,e,i,o)}unlink(t,e){return g(this,null,function*(){yield this._mu.lock(t),yield this._fs.unlink(t,e),this._mu.unlock(t)})}unlinkSync(t,e){if(this._mu.isLocked(t))throw new Error("invalid sync call");return this._fs.unlinkSync(t,e)}rmdir(t,e){return g(this,null,function*(){yield this._mu.lock(t),yield this._fs.rmdir(t,e),this._mu.unlock(t)})}rmdirSync(t,e){if(this._mu.isLocked(t))throw new Error("invalid sync call");return this._fs.rmdirSync(t,e)}mkdir(t,e,i){return g(this,null,function*(){yield this._mu.lock(t),yield this._fs.mkdir(t,e,i),this._mu.unlock(t)})}mkdirSync(t,e,i){if(this._mu.isLocked(t))throw new Error("invalid sync call");return this._fs.mkdirSync(t,e,i)}readdir(t,e){return g(this,null,function*(){yield this._mu.lock(t);let i=yield this._fs.readdir(t,e);return this._mu.unlock(t),i})}readdirSync(t,e){if(this._mu.isLocked(t))throw new Error("invalid sync call");return this._fs.readdirSync(t,e)}exists(t,e){return g(this,null,function*(){yield this._mu.lock(t);let i=yield this._fs.exists(t,e);return this._mu.unlock(t),i})}existsSync(t,e){if(this._mu.isLocked(t))throw new Error("invalid sync call");return this._fs.existsSync(t,e)}realpath(t,e){return g(this,null,function*(){yield this._mu.lock(t);let i=yield this._fs.realpath(t,e);return this._mu.unlock(t),i})}realpathSync(t,e){if(this._mu.isLocked(t))throw new Error("invalid sync call");return this._fs.realpathSync(t,e)}truncate(t,e,i){return g(this,null,function*(){yield this._mu.lock(t),yield this._fs.truncate(t,e,i),this._mu.unlock(t)})}truncateSync(t,e,i){if(this._mu.isLocked(t))throw new Error("invalid sync call");return this._fs.truncateSync(t,e,i)}readFile(t,e,i,o){return g(this,null,function*(){yield this._mu.lock(t);let c=yield this._fs.readFile(t,e,i,o);return this._mu.unlock(t),c})}readFileSync(t,e,i,o){if(this._mu.isLocked(t))throw new Error("invalid sync call");return this._fs.readFileSync(t,e,i,o)}writeFile(t,e,i,o,c,a){return g(this,null,function*(){yield this._mu.lock(t),yield this._fs.writeFile(t,e,i,o,c,a),this._mu.unlock(t)})}writeFileSync(t,e,i,o,c,a){if(this._mu.isLocked(t))throw new Error("invalid sync call");return this._fs.writeFileSync(t,e,i,o,c,a)}appendFile(t,e,i,o,c,a){return g(this,null,function*(){yield this._mu.lock(t),yield this._fs.appendFile(t,e,i,o,c,a),this._mu.unlock(t)})}appendFileSync(t,e,i,o,c,a){if(this._mu.isLocked(t))throw new Error("invalid sync call");return this._fs.appendFileSync(t,e,i,o,c,a)}chmod(t,e,i){return g(this,null,function*(){yield this._mu.lock(t),yield this._fs.chmod(t,e,i),this._mu.unlock(t)})}chmodSync(t,e,i){if(this._mu.isLocked(t))throw new Error("invalid sync call");return this._fs.chmodSync(t,e,i)}chown(t,e,i,o){return g(this,null,function*(){yield this._mu.lock(t),yield this._fs.chown(t,e,i,o),this._mu.unlock(t)})}chownSync(t,e,i,o){if(this._mu.isLocked(t))throw new Error("invalid sync call");return this._fs.chownSync(t,e,i,o)}utimes(t,e,i,o){return g(this,null,function*(){yield this._mu.lock(t),yield this._fs.utimes(t,e,i,o),this._mu.unlock(t)})}utimesSync(t,e,i,o){if(this._mu.isLocked(t))throw new Error("invalid sync call");return this._fs.utimesSync(t,e,i,o)}link(t,e,i){return g(this,null,function*(){yield this._mu.lock(t),yield this._fs.link(t,e,i),this._mu.unlock(t)})}linkSync(t,e,i){if(this._mu.isLocked(t))throw new Error("invalid sync call");return this._fs.linkSync(t,e,i)}symlink(t,e,i,o){return g(this,null,function*(){yield this._mu.lock(t),yield this._fs.symlink(t,e,i,o),this._mu.unlock(t)})}symlinkSync(t,e,i,o){if(this._mu.isLocked(t))throw new Error("invalid sync call");return this._fs.symlinkSync(t,e,i,o)}readlink(t,e){return g(this,null,function*(){yield this._mu.lock(t);let i=yield this._fs.readlink(t,e);return this._mu.unlock(t),i})}readlinkSync(t,e){if(this._mu.isLocked(t))throw new Error("invalid sync call");return this._fs.readlinkSync(t,e)}};l(Ge,"LockedFS");var xe="/.deletedFiles.log";function Qi(s){return 146|s}l(Qi,"makeModeWritable");function le(s){return N.getFileFlag(s)}l(le,"getFlag");var ot=class extends ae{constructor(t,e,i,o,c){super(t,e,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(ot,"OverlayFile");var at=class extends de{constructor({writable:e,readable:i}){super();this._isInitialized=!1;this._deletedFiles={};this._deleteLog="";this._deleteLogUpdatePending=!1;this._deleteLogUpdateNeeded=!1;this._deleteLogError=null;if(this._writable=e,this._readable=i,this._writable.metadata.readonly)throw new h(22,"Writable file system must be writable.")}static isAvailable(){return!0}get metadata(){return we(pe({},super.metadata),{name:Fe.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(e){return g(this,null,function*(){let i=e.getStats();return yield this.createParentDirectoriesAsync(e.getPath(),i.getCred(0,0)),this._writable.writeFile(e.getPath(),e.getBuffer(),null,le("w"),i.mode,i.getCred(0,0))})}_syncSync(e){let i=e.getStats();this.createParentDirectories(e.getPath(),i.getCred(0,0)),this._writable.writeFileSync(e.getPath(),e.getBuffer(),null,le("w"),i.mode,i.getCred(0,0))}_initialize(){return g(this,null,function*(){if(!this._isInitialized){try{let e=yield this._writable.readFile(xe,"utf8",le("r"),K.Root);this._deleteLog=e}catch(e){if(e.errno!==2)throw e}this._isInitialized=!0,this._reparseDeletionLog()}})}getDeletionLog(){return this._deleteLog}restoreDeletionLog(e,i){this._deleteLog=e,this._reparseDeletionLog(),this.updateLog("",i)}rename(e,i,o){return g(this,null,function*(){if(this.checkInitialized(),this.checkPath(e),this.checkPath(i),e===xe||i===xe)throw h.EPERM("Cannot rename deletion log.");let c=yield this.stat(e,o);if(c.isDirectory()){if(e===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(e,o))?yield this._writable.rename(e,i,o):(yield this._writable.exists(i,o))||(yield this._writable.mkdir(i,a,o)),yield this._readable.exists(e,o))for(let d of yield this._readable.readdir(e,o))yield this.rename(Ee(e,d),Ee(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(e,null,le("r"),o),null,le("w"),c.mode,o)}e!==i&&(yield this.exists(e,o))&&(yield this.unlink(e,o))})}renameSync(e,i,o){if(this.checkInitialized(),this.checkPath(e),this.checkPath(i),e===xe||i===xe)throw h.EPERM("Cannot rename deletion log.");let c=this.statSync(e,o);if(c.isDirectory()){if(e===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(e,o)?this._writable.renameSync(e,i,o):this._writable.existsSync(i,o)||this._writable.mkdirSync(i,a,o),this._readable.existsSync(e,o)&&this._readable.readdirSync(e,o).forEach(d=>{this.renameSync(Ee(e,d),Ee(i,d),o)})}else{if(this.existsSync(i,o)&&this.statSync(i,o).isDirectory())throw h.EISDIR(i);this.writeFileSync(i,this.readFileSync(e,null,le("r"),o),null,le("w"),c.mode,o)}e!==i&&this.existsSync(e,o)&&this.unlinkSync(e,o)}stat(e,i){return g(this,null,function*(){this.checkInitialized();try{return this._writable.stat(e,i)}catch(o){if(this._deletedFiles[e])throw h.ENOENT(e);let c=Q.clone(yield this._readable.stat(e,i));return c.mode=Qi(c.mode),c}})}statSync(e,i){this.checkInitialized();try{return this._writable.statSync(e,i)}catch(o){if(this._deletedFiles[e])throw h.ENOENT(e);let c=Q.clone(this._readable.statSync(e,i));return c.mode=Qi(c.mode),c}}open(e,i,o,c){return g(this,null,function*(){if(this.checkInitialized(),this.checkPath(e),e===xe)throw h.EPERM("Cannot open deletion log.");if(yield this.exists(e,c))switch(i.pathExistsAction()){case 2:return yield this.createParentDirectoriesAsync(e,c),this._writable.open(e,i,o,c);case 0:if(yield this._writable.exists(e,c))return this._writable.open(e,i,o,c);{let a=yield this._readable.readFile(e,null,le("r"),c),d=Q.clone(yield this._readable.stat(e,c));return d.mode=o,new ot(this,e,i,d,a)}default:throw h.EEXIST(e)}else switch(i.pathNotExistsAction()){case 3:return yield this.createParentDirectoriesAsync(e,c),this._writable.open(e,i,o,c);default:throw h.ENOENT(e)}})}openSync(e,i,o,c){if(this.checkInitialized(),this.checkPath(e),e===xe)throw h.EPERM("Cannot open deletion log.");if(this.existsSync(e,c))switch(i.pathExistsAction()){case 2:return this.createParentDirectories(e,c),this._writable.openSync(e,i,o,c);case 0:if(this._writable.existsSync(e,c))return this._writable.openSync(e,i,o,c);{let a=this._readable.readFileSync(e,null,le("r"),c),d=Q.clone(this._readable.statSync(e,c));return d.mode=o,new ot(this,e,i,d,a)}default:throw h.EEXIST(e)}else switch(i.pathNotExistsAction()){case 3:return this.createParentDirectories(e,c),this._writable.openSync(e,i,o,c);default:throw h.ENOENT(e)}}unlink(e,i){return g(this,null,function*(){if(this.checkInitialized(),this.checkPath(e),yield this.exists(e,i))(yield this._writable.exists(e,i))&&(yield this._writable.unlink(e,i)),(yield this.exists(e,i))&&this.deletePath(e,i);else throw h.ENOENT(e)})}unlinkSync(e,i){if(this.checkInitialized(),this.checkPath(e),this.existsSync(e,i))this._writable.existsSync(e,i)&&this._writable.unlinkSync(e,i),this.existsSync(e,i)&&this.deletePath(e,i);else throw h.ENOENT(e)}rmdir(e,i){return g(this,null,function*(){if(this.checkInitialized(),yield this.exists(e,i)){if((yield this._writable.exists(e,i))&&(yield this._writable.rmdir(e,i)),yield this.exists(e,i)){if((yield this.readdir(e,i)).length>0)throw h.ENOTEMPTY(e);this.deletePath(e,i)}}else throw h.ENOENT(e)})}rmdirSync(e,i){if(this.checkInitialized(),this.existsSync(e,i)){if(this._writable.existsSync(e,i)&&this._writable.rmdirSync(e,i),this.existsSync(e,i)){if(this.readdirSync(e,i).length>0)throw h.ENOTEMPTY(e);this.deletePath(e,i)}}else throw h.ENOENT(e)}mkdir(e,i,o){return g(this,null,function*(){if(this.checkInitialized(),yield this.exists(e,o))throw h.EEXIST(e);yield this.createParentDirectoriesAsync(e,o),yield this._writable.mkdir(e,i,o)})}mkdirSync(e,i,o){if(this.checkInitialized(),this.existsSync(e,o))throw h.EEXIST(e);this.createParentDirectories(e,o),this._writable.mkdirSync(e,i,o)}readdir(e,i){return g(this,null,function*(){if(this.checkInitialized(),!(yield this.stat(e,i)).isDirectory())throw h.ENOTDIR(e);let c=[];try{c=c.concat(yield this._writable.readdir(e,i))}catch(d){}try{c=c.concat((yield this._readable.readdir(e,i)).filter(d=>!this._deletedFiles[`${e}/${d}`]))}catch(d){}let a={};return c.filter(d=>{let m=!a[d];return a[d]=!0,m})})}readdirSync(e,i){if(this.checkInitialized(),!this.statSync(e,i).isDirectory())throw h.ENOTDIR(e);let c=[];try{c=c.concat(this._writable.readdirSync(e,i))}catch(d){}try{c=c.concat(this._readable.readdirSync(e,i).filter(d=>!this._deletedFiles[`${e}/${d}`]))}catch(d){}let a={};return c.filter(d=>{let m=!a[d];return a[d]=!0,m})}exists(e,i){return g(this,null,function*(){return this.checkInitialized(),(yield this._writable.exists(e,i))||(yield this._readable.exists(e,i))&&this._deletedFiles[e]!==!0})}existsSync(e,i){return this.checkInitialized(),this._writable.existsSync(e,i)||this._readable.existsSync(e,i)&&this._deletedFiles[e]!==!0}chmod(e,i,o){return g(this,null,function*(){this.checkInitialized(),yield this.operateOnWritableAsync(e,o),yield this._writable.chmod(e,i,o)})}chmodSync(e,i,o){this.checkInitialized(),this.operateOnWritable(e,o),this._writable.chmodSync(e,i,o)}chown(e,i,o,c){return g(this,null,function*(){this.checkInitialized(),yield this.operateOnWritableAsync(e,c),yield this._writable.chown(e,i,o,c)})}chownSync(e,i,o,c){this.checkInitialized(),this.operateOnWritable(e,c),this._writable.chownSync(e,i,o,c)}utimes(e,i,o,c){return g(this,null,function*(){this.checkInitialized(),yield this.operateOnWritableAsync(e,c),yield this._writable.utimes(e,i,o,c)})}utimesSync(e,i,o,c){this.checkInitialized(),this.operateOnWritable(e,c),this._writable.utimesSync(e,i,o,c)}deletePath(e,i){this._deletedFiles[e]=!0,this.updateLog(`d${e}
|
|
5
|
+
`,i)}updateLog(e,i){this._deleteLog+=e,this._deleteLogUpdatePending?this._deleteLogUpdateNeeded=!0:(this._deleteLogUpdatePending=!0,this._writable.writeFile(xe,this._deleteLog,"utf8",N.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(e=>{this._deletedFiles[e.slice(1)]=e.slice(0,1)==="d"})}checkInitialized(){if(this._isInitialized){if(this._deleteLogError!==null){let e=this._deleteLogError;throw this._deleteLogError=null,e}}else throw new h(1,"OverlayFS is not initialized. Please initialize OverlayFS using its initialize() method before using it.")}checkPath(e){if(e===xe)throw h.EPERM(e)}createParentDirectories(e,i){let o=D(e),c=[];for(;!this._writable.existsSync(o,i);)c.push(o),o=D(o);c=c.reverse();for(let a of c)this._writable.mkdirSync(a,this.statSync(a,i).mode,i)}createParentDirectoriesAsync(e,i){return g(this,null,function*(){let o=D(e),c=[];for(;!(yield this._writable.exists(o,i));)c.push(o),o=D(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(e,i){if(!this.existsSync(e,i))throw h.ENOENT(e);this._writable.existsSync(e,i)||this.copyToWritable(e,i)}operateOnWritableAsync(e,i){return g(this,null,function*(){if(!(yield this.exists(e,i)))throw h.ENOENT(e);if(!(yield this._writable.exists(e,i)))return this.copyToWritableAsync(e,i)})}copyToWritable(e,i){let o=this.statSync(e,i);o.isDirectory()?this._writable.mkdirSync(e,o.mode,i):this.writeFileSync(e,this._readable.readFileSync(e,null,le("r"),i),null,le("w"),o.mode,i)}copyToWritableAsync(e,i){return g(this,null,function*(){let o=yield this.stat(e,i);o.isDirectory()?yield this._writable.mkdir(e,o.mode,i):yield this.writeFile(e,yield this._readable.readFile(e,null,le("r"),i),null,le("w"),o.mode,i)})}};l(at,"UnlockedOverlayFS");var Bt=class extends Ge{static isAvailable(){return at.isAvailable()}constructor(t){super(new at(t)),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 Pi(Bt.prototype,this,"fs")._initialize(),this})}},Fe=Bt;l(Fe,"OverlayFS"),Fe.Name="OverlayFS",Fe.Create=Ne.bind(Bt),Fe.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 It={};function er(...s){for(let t of s)It[t.Name]=t}l(er,"registerBackend");er(Ce,ye,he,Fe);var ct=class{constructor(t,e){this.key=t;this.value=e;this.prev=null;this.next=null}};l(ct,"LRUNode");var Tt=class{constructor(t){this.limit=t;this.size=0;this.map={};this.head=null;this.tail=null}set(t,e){let i=new ct(t,e);this.map[t]?(this.map[t].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(t){if(this.map[t]){let e=this.map[t].value,i=new ct(t,e);return this.remove(t),this.setHead(i),e}else return null}remove(t){let e=this.map[t];e&&(e.prev!==null?e.prev.next=e.next:this.head=e.next,e.next!==null?e.next.prev=e.prev:this.tail=e.prev,delete this.map[t],this.size--)}removeAll(){this.size=0,this.map={},this.head=null,this.tail=null}setHead(t){t.next=this.head,t.prev=null,this.head!==null&&(this.head.prev=t),this.head=t,this.tail===null&&(this.tail=t),this.size++,this.map[t.key]=t}};l(Tt,"LRUCache");var He=class extends ae{constructor(t,e,i,o,c){super(t,e,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(He,"AsyncKeyValueFile");var Nt=class extends de{constructor(e){super();this._cache=null;e>0&&(this._cache=new Tt(e))}static isAvailable(){return!0}init(e){return g(this,null,function*(){this.store=e,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(e,i,o){return g(this,null,function*(){let c=this.store.beginTransaction("readonly"),a=yield this.findINode(c,e);if(!a)throw h.ENOENT(e);if(!a.toStats().hasAccess(i,o))throw h.EACCES(e)})}rename(e,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=D(e),m=ie(e),b=D(i),S=ie(i),w=yield this.findINode(a,d),C=yield this.getDirListing(a,d,w);if(!w.toStats().hasAccess(2,o))throw h.EACCES(e);if(!C[m])throw h.ENOENT(e);let v=C[m];if(delete C[m],(b+"/").indexOf(e+"/")===0)throw new h(16,d);let x,F;if(b===d?(x=w,F=C):(x=yield this.findINode(a,b),F=yield this.getDirListing(a,b,x)),F[S]){let _=yield this.getINode(a,i,F[S]);if(_.isFile())try{yield a.del(_.id),yield a.del(F[S])}catch(O){throw yield a.abort(),O}else throw h.EPERM(i)}F[S]=v;try{yield a.put(w.id,k.from(JSON.stringify(C)),!0),yield a.put(x.id,k.from(JSON.stringify(F)),!0)}catch(_){throw yield a.abort(),_}yield a.commit()}finally{c&&(this._cache=c)}})}stat(e,i){return g(this,null,function*(){let o=this.store.beginTransaction("readonly"),a=(yield this.findINode(o,e)).toStats();if(!a.hasAccess(4,i))throw h.EACCES(e);return a})}createFile(e,i,o,c){return g(this,null,function*(){let a=this.store.beginTransaction("readwrite"),d=k.alloc(0),m=yield this.commitNewFile(a,e,H.FILE,o,c,d);return new He(this,e,i,m.toStats(),d)})}openFile(e,i,o){return g(this,null,function*(){let c=this.store.beginTransaction("readonly"),a=yield this.findINode(c,e),d=yield c.get(a.id);if(!a.toStats().hasAccess(i.getMode(),o))throw h.EACCES(e);if(d===void 0)throw h.ENOENT(e);return new He(this,e,i,a.toStats(),d)})}unlink(e,i){return g(this,null,function*(){return this.removeEntry(e,!1,i)})}rmdir(e,i){return g(this,null,function*(){if((yield this.readdir(e,i)).length>0)throw h.ENOTEMPTY(e);yield this.removeEntry(e,!0,i)})}mkdir(e,i,o){return g(this,null,function*(){let c=this.store.beginTransaction("readwrite"),a=k.from("{}");yield this.commitNewFile(c,e,H.DIRECTORY,i,o,a)})}readdir(e,i){return g(this,null,function*(){let o=this.store.beginTransaction("readonly"),c=yield this.findINode(o,e);if(!c.toStats().hasAccess(4,i))throw h.EACCES(e);return Object.keys(yield this.getDirListing(o,e,c))})}chmod(e,i,o){return g(this,null,function*(){yield(yield this.openFile(e,N.getFileFlag("r+"),o)).chmod(i)})}chown(e,i,o,c){return g(this,null,function*(){yield(yield this.openFile(e,N.getFileFlag("r+"),c)).chown(i,o)})}_sync(e,i,o){return g(this,null,function*(){let c=this.store.beginTransaction("readwrite"),a=yield this._findINode(c,D(e),ie(e)),d=yield this.getINode(c,e,a),m=d.update(o);try{yield c.put(d.id,i,!0),m&&(yield c.put(a,d.toBuffer(),!0))}catch(b){throw yield c.abort(),b}yield c.commit()})}makeRootDirectory(){return g(this,null,function*(){let e=this.store.beginTransaction("readwrite");if((yield e.get(fe))===void 0){let i=new Date().getTime(),o=new ne(Me(),4096,511|H.DIRECTORY,i,i,i,0,0);yield e.put(o.id,it(),!1),yield e.put(fe,o.toBuffer(),!1),yield e.commit()}})}_findINode(a,d,m){return g(this,arguments,function*(e,i,o,c=new Set){let b=ke.join(i,o);if(c.has(b))throw new h(5,"Infinite loop detected while finding inode",b);if(c.add(b),this._cache){let S=this._cache.get(b);if(S)return S}if(i==="/"){if(o==="")return this._cache&&this._cache.set(b,fe),fe;{let S=yield this.getINode(e,i,fe),w=yield this.getDirListing(e,i,S);if(w[o]){let C=w[o];return this._cache&&this._cache.set(b,C),C}else throw h.ENOENT(Ee(i,o))}}else{let S=yield this.findINode(e,i,c),w=yield this.getDirListing(e,i,S);if(w[o]){let C=w[o];return this._cache&&this._cache.set(b,C),C}else throw h.ENOENT(Ee(i,o))}})}findINode(c,a){return g(this,arguments,function*(e,i,o=new Set){let d=yield this._findINode(e,D(i),ie(i),o);return this.getINode(e,i,d)})}getINode(e,i,o){return g(this,null,function*(){let c=yield e.get(o);if(!c)throw h.ENOENT(i);return ne.fromBuffer(c)})}getDirListing(e,i,o){return g(this,null,function*(){if(!o.isDirectory())throw h.ENOTDIR(i);let c=yield e.get(o.id);try{return JSON.parse(c.toString())}catch(a){throw h.ENOENT(i)}})}addNewNode(e,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=Me();return(yield e.put(a,i,!1))?a:c()}}),"reroll");return c()})}commitNewFile(e,i,o,c,a,d){return g(this,null,function*(){let m=D(i),b=ie(i),S=yield this.findINode(e,m),w=yield this.getDirListing(e,m,S),C=new Date().getTime();if(!S.toStats().hasAccess(2,a))throw h.EACCES(i);if(i==="/")throw h.EEXIST(i);if(w[b])throw yield e.abort(),h.EEXIST(i);try{let v=yield this.addNewNode(e,d),x=new ne(v,d.length,c|o,C,C,C,a.uid,a.gid),F=yield this.addNewNode(e,x.toBuffer());return w[b]=F,yield e.put(S.id,k.from(JSON.stringify(w)),!0),yield e.commit(),x}catch(v){throw e.abort(),v}})}removeEntry(e,i,o){return g(this,null,function*(){this._cache&&this._cache.remove(e);let c=this.store.beginTransaction("readwrite"),a=D(e),d=yield this.findINode(c,a),m=yield this.getDirListing(c,a,d),b=ie(e);if(!m[b])throw h.ENOENT(e);let S=m[b],w=yield this.getINode(c,e,S);if(!w.toStats().hasAccess(2,o))throw h.EACCES(e);if(delete m[b],!i&&w.isDirectory())throw h.EISDIR(e);if(i&&!w.isDirectory())throw h.ENOTDIR(e);try{yield c.del(w.id),yield c.del(S),yield c.put(d.id,k.from(JSON.stringify(m)),!0)}catch(C){throw yield c.abort(),C}yield c.commit()})}};l(Nt,"AsyncKeyValueFileSystem");function ir(s,t=0,e=0){return Ki(new K(t,e,t,e,t,e)),_t.initialize(s)}l(ir,"initialize");function tr(s){return g(this,null,function*(){("fs"in s||s instanceof Ie)&&(s={"/":s});for(let[t,e]of Object.entries(s))typeof e!="number"&&(t=t.toString(),!(e instanceof Ie)&&(typeof e=="string"&&(e={fs:e}),s[t]=yield rr(e)));return ir(s)})}l(tr,"_configure");function qs(s,t){if(typeof t!="function")return tr(s);tr(s).then(()=>t()).catch(e=>t(e))}l(qs,"configure");function wi(e){return g(this,arguments,function*({fs:s,options:t={}}){if(!s)throw new h(1,'Missing "fs" property on configuration object.');if(typeof t!="object"||t===null)throw new h(22,'Invalid "options" property on configuration object.');let i=Object.keys(t).filter(c=>c!="fs");for(let c of i){let a=t[c];if(a===null||typeof a!="object"||!("fs"in a))continue;let d=yield wi(a);t[c]=d}let o=It[s];if(o)return o.Create(t);throw new h(1,`File system ${s} is not available in ZenFS.`)})}l(wi,"_getFileSystem");function rr(s,t){if(typeof t!="function")return wi(s);wi(s).then(e=>t(null,e)).catch(e=>t(e))}l(rr,"getFileSystem");var Js=_t;return Tr(Gs);})();
|
|
7
7
|
/*! Bundled license information:
|
|
8
8
|
|
|
9
9
|
@jspm/core/nodelibs/browser/buffer.js:
|