@zenfs/core 0.3.3 → 0.3.4
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/FileIndex.d.ts +7 -7
- package/dist/FileIndex.js +9 -9
- package/dist/browser.min.js +1 -1
- package/dist/browser.min.js.map +2 -2
- package/package.json +1 -1
package/dist/FileIndex.d.ts
CHANGED
|
@@ -179,10 +179,10 @@ export declare abstract class FileIndexFS<TIndex> extends FileIndexFS_base {
|
|
|
179
179
|
openFileSync(path: string, flag: FileFlag, cred: Cred): NoSyncFile<this>;
|
|
180
180
|
readdir(path: string): Promise<string[]>;
|
|
181
181
|
readdirSync(path: string): string[];
|
|
182
|
-
protected abstract statFileInode(inode: IndexFileInode<TIndex
|
|
183
|
-
protected abstract statFileInodeSync(inode: IndexFileInode<TIndex
|
|
184
|
-
protected abstract
|
|
185
|
-
protected abstract
|
|
182
|
+
protected abstract statFileInode(inode: IndexFileInode<TIndex>, path: string): Promise<Stats>;
|
|
183
|
+
protected abstract statFileInodeSync(inode: IndexFileInode<TIndex>, path: string): Stats;
|
|
184
|
+
protected abstract openFileInode(inode: IndexFileInode<TIndex>, path: string, flag: FileFlag): Promise<NoSyncFile<this>>;
|
|
185
|
+
protected abstract openFileInodeSync(inode: IndexFileInode<TIndex>, path: string, flag: FileFlag): NoSyncFile<this>;
|
|
186
186
|
}
|
|
187
187
|
declare const SyncFileIndexFS_base: (abstract new (...args: any[]) => {
|
|
188
188
|
metadata(): import("./filesystem.js").FileSystemMetadata;
|
|
@@ -211,8 +211,8 @@ declare const SyncFileIndexFS_base: (abstract new (...args: any[]) => {
|
|
|
211
211
|
syncSync(path: string, data: Uint8Array, stats: Readonly<Stats>): void;
|
|
212
212
|
}) & (abstract new (index: ListingTree) => FileIndexFS<unknown>);
|
|
213
213
|
export declare abstract class SyncFileIndexFS<TIndex> extends SyncFileIndexFS_base {
|
|
214
|
-
protected statFileInode(inode: IndexFileInode<TIndex
|
|
215
|
-
protected
|
|
214
|
+
protected statFileInode(inode: IndexFileInode<TIndex>, path: string): Promise<Stats>;
|
|
215
|
+
protected openFileInode(inode: IndexFileInode<TIndex>, path: string, flag: FileFlag): Promise<NoSyncFile<this>>;
|
|
216
216
|
}
|
|
217
217
|
declare const AsyncFileIndexFS_base: (abstract new (...args: any[]) => {
|
|
218
218
|
metadata(): import("./filesystem.js").FileSystemMetadata;
|
|
@@ -229,6 +229,6 @@ declare const AsyncFileIndexFS_base: (abstract new (...args: any[]) => {
|
|
|
229
229
|
}) & (abstract new (index: ListingTree) => FileIndexFS<unknown>);
|
|
230
230
|
export declare abstract class AsyncFileIndexFS<TIndex> extends AsyncFileIndexFS_base {
|
|
231
231
|
protected statFileInodeSync(): Stats;
|
|
232
|
-
protected
|
|
232
|
+
protected openFileInodeSync(): NoSyncFile<this>;
|
|
233
233
|
}
|
|
234
234
|
export {};
|
package/dist/FileIndex.js
CHANGED
|
@@ -312,7 +312,7 @@ export class FileIndexFS extends Readonly(FileSystem) {
|
|
|
312
312
|
return inode.stats;
|
|
313
313
|
}
|
|
314
314
|
if (inode.isFile()) {
|
|
315
|
-
return this.statFileInode(inode);
|
|
315
|
+
return this.statFileInode(inode, path);
|
|
316
316
|
}
|
|
317
317
|
throw new ApiError(ErrorCode.EINVAL, 'Invalid inode.');
|
|
318
318
|
}
|
|
@@ -325,7 +325,7 @@ export class FileIndexFS extends Readonly(FileSystem) {
|
|
|
325
325
|
return inode.stats;
|
|
326
326
|
}
|
|
327
327
|
if (inode.isFile()) {
|
|
328
|
-
return this.statFileInodeSync(inode);
|
|
328
|
+
return this.statFileInodeSync(inode, path);
|
|
329
329
|
}
|
|
330
330
|
throw new ApiError(ErrorCode.EINVAL, 'Invalid inode.');
|
|
331
331
|
}
|
|
@@ -346,7 +346,7 @@ export class FileIndexFS extends Readonly(FileSystem) {
|
|
|
346
346
|
const stats = inode.stats;
|
|
347
347
|
return new NoSyncFile(this, path, flag, stats, stats.fileData);
|
|
348
348
|
}
|
|
349
|
-
return this.
|
|
349
|
+
return this.openFileInode(inode, path, flag);
|
|
350
350
|
}
|
|
351
351
|
openFileSync(path, flag, cred) {
|
|
352
352
|
if (flag.isWriteable()) {
|
|
@@ -365,7 +365,7 @@ export class FileIndexFS extends Readonly(FileSystem) {
|
|
|
365
365
|
const stats = inode.stats;
|
|
366
366
|
return new NoSyncFile(this, path, flag, stats, stats.fileData);
|
|
367
367
|
}
|
|
368
|
-
return this.
|
|
368
|
+
return this.openFileInodeSync(inode, path, flag);
|
|
369
369
|
}
|
|
370
370
|
async readdir(path) {
|
|
371
371
|
// Check if it exists.
|
|
@@ -391,18 +391,18 @@ export class FileIndexFS extends Readonly(FileSystem) {
|
|
|
391
391
|
}
|
|
392
392
|
}
|
|
393
393
|
export class SyncFileIndexFS extends Sync((FileIndexFS)) {
|
|
394
|
-
async statFileInode(inode) {
|
|
395
|
-
return this.statFileInodeSync(inode);
|
|
394
|
+
async statFileInode(inode, path) {
|
|
395
|
+
return this.statFileInodeSync(inode, path);
|
|
396
396
|
}
|
|
397
|
-
async
|
|
398
|
-
return this.
|
|
397
|
+
async openFileInode(inode, path, flag) {
|
|
398
|
+
return this.openFileInodeSync(inode, path, flag);
|
|
399
399
|
}
|
|
400
400
|
}
|
|
401
401
|
export class AsyncFileIndexFS extends Async((FileIndexFS)) {
|
|
402
402
|
statFileInodeSync() {
|
|
403
403
|
throw new ApiError(ErrorCode.ENOTSUP);
|
|
404
404
|
}
|
|
405
|
-
|
|
405
|
+
openFileInodeSync() {
|
|
406
406
|
throw new ApiError(ErrorCode.ENOTSUP);
|
|
407
407
|
}
|
|
408
408
|
}
|
package/dist/browser.min.js
CHANGED
|
@@ -2,7 +2,7 @@ var ZenFS=(()=>{var Xc=Object.create;var At=Object.defineProperty;var Jc=Object.
|
|
|
2
2
|
`;super(i),this.name="AggregateError",this.errors=e}};s(dr,"AggregateError");Hn.exports={AggregateError:dr,kEmptyObject:Object.freeze({}),once(t){let e=!1;return function(...i){e||(e=!0,t.apply(this,i))}},createDeferredPromise:function(){let t,e;return{promise:new Promise((r,n)=>{t=r,e=n}),resolve:t,reject:e}},promisify(t){return new Promise((e,i)=>{t((r,...n)=>r?i(r):e(...n))})},debuglog(){return function(){}},format(t,...e){return t.replace(/%([sdifj])/g,function(...[i,r]){let n=e.shift();return r==="f"?n.toFixed(6):r==="j"?JSON.stringify(n):r==="s"&&typeof n=="object"?`${n.constructor!==Object?n.constructor.name:""} {}`.trim():n.toString()})},inspect(t){switch(typeof t){case"string":if(t.includes("'"))if(t.includes('"')){if(!t.includes("`")&&!t.includes("${"))return`\`${t}\``}else return`"${t}"`;return`'${t}'`;case"number":return isNaN(t)?"NaN":Object.is(t,-0)?String(t):t;case"bigint":return`${String(t)}n`;case"boolean":case"undefined":return String(t);case"object":return"{}"}},types:{isAsyncFunction(t){return t instanceof dh},isArrayBufferView(t){return ArrayBuffer.isView(t)}},isBlob:hh,deprecate(t,e){return t},addAbortListener:vi().addAbortListener||s(function(e,i){if(e===void 0)throw new ERR_INVALID_ARG_TYPE("signal","AbortSignal",e);Js(e,"signal"),ph(i,"listener");let r;return e.aborted?queueMicrotask(()=>i()):(e.addEventListener("abort",i,{__proto__:null,once:!0,[lh]:!0}),r=s(()=>{e.removeEventListener("abort",i)},"removeEventListener")),{__proto__:null,[ch](){var n;(n=r)===null||n===void 0||n()}}},"addAbortListener"),AbortSignalAny:uh.any||s(function(e){if(e.length===1)return e[0];let i=new fh,r=s(()=>i.abort(),"abort");return e.forEach(n=>{Js(n,"signals"),n.addEventListener("abort",r,{once:!0})}),i.signal.addEventListener("abort",()=>{e.forEach(n=>n.removeEventListener("abort",r))},{once:!0}),i.signal},"AbortSignalAny")};Hn.exports.promisify.custom=Symbol.for("nodejs.util.promisify.custom")});var ie=N((xS,ea)=>{"use strict";var{format:yh,inspect:pr,AggregateError:mh}=Z(),bh=globalThis.AggregateError||mh,gh=Symbol("kIsNodeError"),wh=["string","function","number","object","Function","Object","boolean","bigint","symbol"],Sh=/^([A-Z][a-z0-9]*)+$/,_h="__node_internal_",yr={};function ft(t,e){if(!t)throw new yr.ERR_INTERNAL_ASSERTION(e)}s(ft,"assert");function Qs(t){let e="",i=t.length,r=t[0]==="-"?1:0;for(;i>=r+4;i-=3)e=`_${t.slice(i-3,i)}${e}`;return`${t.slice(0,i)}${e}`}s(Qs,"addNumericalSeparator");function Eh(t,e,i){if(typeof e=="function")return ft(e.length<=i.length,`Code: ${t}; The provided arguments length (${i.length}) does not match the required ones (${e.length}).`),e(...i);let r=(e.match(/%[dfijoOs]/g)||[]).length;return ft(r===i.length,`Code: ${t}; The provided arguments length (${i.length}) does not match the required ones (${r}).`),i.length===0?e:yh(e,...i)}s(Eh,"getMessage");function Q(t,e,i){i||(i=Error);class r extends i{constructor(...o){super(Eh(t,e,o))}toString(){return`${this.name} [${t}]: ${this.message}`}}s(r,"NodeError"),Object.defineProperties(r.prototype,{name:{value:i.name,writable:!0,enumerable:!1,configurable:!0},toString:{value(){return`${this.name} [${t}]: ${this.message}`},writable:!0,enumerable:!1,configurable:!0}}),r.prototype.code=t,r.prototype[gh]=!0,yr[t]=r}s(Q,"E");function Zs(t){let e=_h+t.name;return Object.defineProperty(t,"name",{value:e}),t}s(Zs,"hideStackFrames");function xh(t,e){if(t&&e&&t!==e){if(Array.isArray(e.errors))return e.errors.push(t),e;let i=new bh([e,t],e.message);return i.code=e.code,i}return t||e}s(xh,"aggregateTwoErrors");var hr=class extends Error{constructor(e="The operation was aborted",i=void 0){if(i!==void 0&&typeof i!="object")throw new yr.ERR_INVALID_ARG_TYPE("options","Object",i);super(e,i),this.code="ABORT_ERR",this.name="AbortError"}};s(hr,"AbortError");Q("ERR_ASSERTION","%s",Error);Q("ERR_INVALID_ARG_TYPE",(t,e,i)=>{ft(typeof t=="string","'name' must be a string"),Array.isArray(e)||(e=[e]);let r="The ";t.endsWith(" argument")?r+=`${t} `:r+=`"${t}" ${t.includes(".")?"property":"argument"} `,r+="must be ";let n=[],o=[],a=[];for(let u of e)ft(typeof u=="string","All expected entries have to be of type string"),wh.includes(u)?n.push(u.toLowerCase()):Sh.test(u)?o.push(u):(ft(u!=="object",'The value "object" should be written as "Object"'),a.push(u));if(o.length>0){let u=n.indexOf("object");u!==-1&&(n.splice(n,u,1),o.push("Object"))}if(n.length>0){switch(n.length){case 1:r+=`of type ${n[0]}`;break;case 2:r+=`one of type ${n[0]} or ${n[1]}`;break;default:{let u=n.pop();r+=`one of type ${n.join(", ")}, or ${u}`}}(o.length>0||a.length>0)&&(r+=" or ")}if(o.length>0){switch(o.length){case 1:r+=`an instance of ${o[0]}`;break;case 2:r+=`an instance of ${o[0]} or ${o[1]}`;break;default:{let u=o.pop();r+=`an instance of ${o.join(", ")}, or ${u}`}}a.length>0&&(r+=" or ")}switch(a.length){case 0:break;case 1:a[0].toLowerCase()!==a[0]&&(r+="an "),r+=`${a[0]}`;break;case 2:r+=`one of ${a[0]} or ${a[1]}`;break;default:{let u=a.pop();r+=`one of ${a.join(", ")}, or ${u}`}}if(i==null)r+=`. Received ${i}`;else if(typeof i=="function"&&i.name)r+=`. Received function ${i.name}`;else if(typeof i=="object"){var l;if((l=i.constructor)!==null&&l!==void 0&&l.name)r+=`. Received an instance of ${i.constructor.name}`;else{let u=pr(i,{depth:-1});r+=`. Received ${u}`}}else{let u=pr(i,{colors:!1});u.length>25&&(u=`${u.slice(0,25)}...`),r+=`. Received type ${typeof i} (${u})`}return r},TypeError);Q("ERR_INVALID_ARG_VALUE",(t,e,i="is invalid")=>{let r=pr(e);return r.length>128&&(r=r.slice(0,128)+"..."),`The ${t.includes(".")?"property":"argument"} '${t}' ${i}. Received ${r}`},TypeError);Q("ERR_INVALID_RETURN_VALUE",(t,e,i)=>{var r;let n=i!=null&&(r=i.constructor)!==null&&r!==void 0&&r.name?`instance of ${i.constructor.name}`:`type ${typeof i}`;return`Expected ${t} to be returned from the "${e}" function but got ${n}.`},TypeError);Q("ERR_MISSING_ARGS",(...t)=>{ft(t.length>0,"At least one arg needs to be specified");let e,i=t.length;switch(t=(Array.isArray(t)?t:[t]).map(r=>`"${r}"`).join(" or "),i){case 1:e+=`The ${t[0]} argument`;break;case 2:e+=`The ${t[0]} and ${t[1]} arguments`;break;default:{let r=t.pop();e+=`The ${t.join(", ")}, and ${r} arguments`}break}return`${e} must be specified`},TypeError);Q("ERR_OUT_OF_RANGE",(t,e,i)=>{ft(e,'Missing "range" argument');let r;return Number.isInteger(i)&&Math.abs(i)>2**32?r=Qs(String(i)):typeof i=="bigint"?(r=String(i),(i>2n**32n||i<-(2n**32n))&&(r=Qs(r)),r+="n"):r=pr(i),`The value of "${t}" is out of range. It must be ${e}. Received ${r}`},RangeError);Q("ERR_MULTIPLE_CALLBACK","Callback called multiple times",Error);Q("ERR_METHOD_NOT_IMPLEMENTED","The %s method is not implemented",Error);Q("ERR_STREAM_ALREADY_FINISHED","Cannot call %s after a stream was finished",Error);Q("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable",Error);Q("ERR_STREAM_DESTROYED","Cannot call %s after a stream was destroyed",Error);Q("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);Q("ERR_STREAM_PREMATURE_CLOSE","Premature close",Error);Q("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF",Error);Q("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event",Error);Q("ERR_STREAM_WRITE_AFTER_END","write after end",Error);Q("ERR_UNKNOWN_ENCODING","Unknown encoding: %s",TypeError);ea.exports={AbortError:hr,aggregateTwoErrors:Zs(xh),hideStackFrames:Zs,codes:yr}});var Yt=N((AS,ua)=>{"use strict";var{ArrayIsArray:Yn,ArrayPrototypeIncludes:na,ArrayPrototypeJoin:oa,ArrayPrototypeMap:vh,NumberIsInteger:Gn,NumberIsNaN:Ah,NumberMAX_SAFE_INTEGER:kh,NumberMIN_SAFE_INTEGER:Nh,NumberParseInt:Th,ObjectPrototypeHasOwnProperty:Fh,RegExpPrototypeExec:sa,String:Ih,StringPrototypeToUpperCase:Ph,StringPrototypeTrim:Ch}=O(),{hideStackFrames:me,codes:{ERR_SOCKET_BAD_PORT:Lh,ERR_INVALID_ARG_TYPE:ee,ERR_INVALID_ARG_VALUE:Kt,ERR_OUT_OF_RANGE:dt,ERR_UNKNOWN_SIGNAL:ta}}=ie(),{normalizeEncoding:Rh}=Z(),{isAsyncFunction:Oh,isArrayBufferView:Bh}=Z().types,ia={};function Dh(t){return t===(t|0)}s(Dh,"isInt32");function Mh(t){return t===t>>>0}s(Mh,"isUint32");var Uh=/^[0-7]+$/,Wh="must be a 32-bit unsigned integer or an octal string";function qh(t,e,i){if(typeof t>"u"&&(t=i),typeof t=="string"){if(sa(Uh,t)===null)throw new Kt(e,t,Wh);t=Th(t,8)}return aa(t,e),t}s(qh,"parseFileMode");var jh=me((t,e,i=Nh,r=kh)=>{if(typeof t!="number")throw new ee(e,"number",t);if(!Gn(t))throw new dt(e,"an integer",t);if(t<i||t>r)throw new dt(e,`>= ${i} && <= ${r}`,t)}),$h=me((t,e,i=-2147483648,r=2147483647)=>{if(typeof t!="number")throw new ee(e,"number",t);if(!Gn(t))throw new dt(e,"an integer",t);if(t<i||t>r)throw new dt(e,`>= ${i} && <= ${r}`,t)}),aa=me((t,e,i=!1)=>{if(typeof t!="number")throw new ee(e,"number",t);if(!Gn(t))throw new dt(e,"an integer",t);let r=i?1:0,n=4294967295;if(t<r||t>n)throw new dt(e,`>= ${r} && <= ${n}`,t)});function Xn(t,e){if(typeof t!="string")throw new ee(e,"string",t)}s(Xn,"validateString");function zh(t,e,i=void 0,r){if(typeof t!="number")throw new ee(e,"number",t);if(i!=null&&t<i||r!=null&&t>r||(i!=null||r!=null)&&Ah(t))throw new dt(e,`${i!=null?`>= ${i}`:""}${i!=null&&r!=null?" && ":""}${r!=null?`<= ${r}`:""}`,t)}s(zh,"validateNumber");var Vh=me((t,e,i)=>{if(!na(i,t)){let n="must be one of: "+oa(vh(i,o=>typeof o=="string"?`'${o}'`:Ih(o)),", ");throw new Kt(e,t,n)}});function la(t,e){if(typeof t!="boolean")throw new ee(e,"boolean",t)}s(la,"validateBoolean");function Kn(t,e,i){return t==null||!Fh(t,e)?i:t[e]}s(Kn,"getOwnPropertyValueOrDefault");var Hh=me((t,e,i=null)=>{let r=Kn(i,"allowArray",!1),n=Kn(i,"allowFunction",!1);if(!Kn(i,"nullable",!1)&&t===null||!r&&Yn(t)||typeof t!="object"&&(!n||typeof t!="function"))throw new ee(e,"Object",t)}),Kh=me((t,e)=>{if(t!=null&&typeof t!="object"&&typeof t!="function")throw new ee(e,"a dictionary",t)}),mr=me((t,e,i=0)=>{if(!Yn(t))throw new ee(e,"Array",t);if(t.length<i){let r=`must be longer than ${i}`;throw new Kt(e,t,r)}});function Yh(t,e){mr(t,e);for(let i=0;i<t.length;i++)Xn(t[i],`${e}[${i}]`)}s(Yh,"validateStringArray");function Gh(t,e){mr(t,e);for(let i=0;i<t.length;i++)la(t[i],`${e}[${i}]`)}s(Gh,"validateBooleanArray");function Xh(t,e){mr(t,e);for(let i=0;i<t.length;i++){let r=t[i],n=`${e}[${i}]`;if(r==null)throw new ee(n,"AbortSignal",r);ca(r,n)}}s(Xh,"validateAbortSignalArray");function Jh(t,e="signal"){if(Xn(t,e),ia[t]===void 0)throw ia[Ph(t)]!==void 0?new ta(t+" (signals must use all capital letters)"):new ta(t)}s(Jh,"validateSignalName");var Qh=me((t,e="buffer")=>{if(!Bh(t))throw new ee(e,["Buffer","TypedArray","DataView"],t)});function Zh(t,e){let i=Rh(e),r=t.length;if(i==="hex"&&r%2!==0)throw new Kt("encoding",e,`is invalid for data of length ${r}`)}s(Zh,"validateEncoding");function ep(t,e="Port",i=!0){if(typeof t!="number"&&typeof t!="string"||typeof t=="string"&&Ch(t).length===0||+t!==+t>>>0||t>65535||t===0&&!i)throw new Lh(e,t,i);return t|0}s(ep,"validatePort");var ca=me((t,e)=>{if(t!==void 0&&(t===null||typeof t!="object"||!("aborted"in t)))throw new ee(e,"AbortSignal",t)}),tp=me((t,e)=>{if(typeof t!="function")throw new ee(e,"Function",t)}),ip=me((t,e)=>{if(typeof t!="function"||Oh(t))throw new ee(e,"Function",t)}),rp=me((t,e)=>{if(t!==void 0)throw new ee(e,"undefined",t)});function np(t,e,i){if(!na(i,t))throw new ee(e,`('${oa(i,"|")}')`,t)}s(np,"validateUnion");var op=/^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/;function ra(t,e){if(typeof t>"u"||!sa(op,t))throw new Kt(e,t,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}s(ra,"validateLinkHeaderFormat");function sp(t){if(typeof t=="string")return ra(t,"hints"),t;if(Yn(t)){let e=t.length,i="";if(e===0)return i;for(let r=0;r<e;r++){let n=t[r];ra(n,"hints"),i+=n,r!==e-1&&(i+=", ")}return i}throw new Kt("hints",t,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}s(sp,"validateLinkHeaderValue");ua.exports={isInt32:Dh,isUint32:Mh,parseFileMode:qh,validateArray:mr,validateStringArray:Yh,validateBooleanArray:Gh,validateAbortSignalArray:Xh,validateBoolean:la,validateBuffer:Qh,validateDictionary:Kh,validateEncoding:Zh,validateFunction:tp,validateInt32:$h,validateInteger:jh,validateNumber:zh,validateObject:Hh,validateOneOf:Vh,validatePlainFunction:ip,validatePort:ep,validateSignalName:Jh,validateString:Xn,validateUint32:aa,validateUndefined:rp,validateUnion:np,validateAbortSignal:ca,validateLinkHeaderValue:sp}});var tt=N((NS,pa)=>{var q=pa.exports={},Te,Fe;function Jn(){throw new Error("setTimeout has not been defined")}s(Jn,"defaultSetTimout");function Qn(){throw new Error("clearTimeout has not been defined")}s(Qn,"defaultClearTimeout");(function(){try{typeof setTimeout=="function"?Te=setTimeout:Te=Jn}catch{Te=Jn}try{typeof clearTimeout=="function"?Fe=clearTimeout:Fe=Qn}catch{Fe=Qn}})();function fa(t){if(Te===setTimeout)return setTimeout(t,0);if((Te===Jn||!Te)&&setTimeout)return Te=setTimeout,setTimeout(t,0);try{return Te(t,0)}catch{try{return Te.call(null,t,0)}catch{return Te.call(this,t,0)}}}s(fa,"runTimeout");function ap(t){if(Fe===clearTimeout)return clearTimeout(t);if((Fe===Qn||!Fe)&&clearTimeout)return Fe=clearTimeout,clearTimeout(t);try{return Fe(t)}catch{try{return Fe.call(null,t)}catch{return Fe.call(this,t)}}}s(ap,"runClearTimeout");var Ue=[],Gt=!1,ht,br=-1;function lp(){!Gt||!ht||(Gt=!1,ht.length?Ue=ht.concat(Ue):br=-1,Ue.length&&da())}s(lp,"cleanUpNextTick");function da(){if(!Gt){var t=fa(lp);Gt=!0;for(var e=Ue.length;e;){for(ht=Ue,Ue=[];++br<e;)ht&&ht[br].run();br=-1,e=Ue.length}ht=null,Gt=!1,ap(t)}}s(da,"drainQueue");q.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var i=1;i<arguments.length;i++)e[i-1]=arguments[i];Ue.push(new ha(t,e)),Ue.length===1&&!Gt&&fa(da)};function ha(t,e){this.fun=t,this.array=e}s(ha,"Item");ha.prototype.run=function(){this.fun.apply(null,this.array)};q.title="browser";q.browser=!0;q.env={};q.argv=[];q.version="";q.versions={};function We(){}s(We,"noop");q.on=We;q.addListener=We;q.once=We;q.off=We;q.removeListener=We;q.removeAllListeners=We;q.emit=We;q.prependListener=We;q.prependOnceListener=We;q.listeners=function(t){return[]};q.binding=function(t){throw new Error("process.binding is not supported")};q.cwd=function(){return"/"};q.chdir=function(t){throw new Error("process.chdir is not supported")};q.umask=function(){return 0}});var Pe=N((FS,Fa)=>{"use strict";var{SymbolAsyncIterator:ya,SymbolIterator:ma,SymbolFor:pt}=O(),ba=pt("nodejs.stream.destroyed"),ga=pt("nodejs.stream.errored"),Zn=pt("nodejs.stream.readable"),eo=pt("nodejs.stream.writable"),wa=pt("nodejs.stream.disturbed"),cp=pt("nodejs.webstream.isClosedPromise"),up=pt("nodejs.webstream.controllerErrorFunction");function gr(t,e=!1){var i;return!!(t&&typeof t.pipe=="function"&&typeof t.on=="function"&&(!e||typeof t.pause=="function"&&typeof t.resume=="function")&&(!t._writableState||((i=t._readableState)===null||i===void 0?void 0:i.readable)!==!1)&&(!t._writableState||t._readableState))}s(gr,"isReadableNodeStream");function wr(t){var e;return!!(t&&typeof t.write=="function"&&typeof t.on=="function"&&(!t._readableState||((e=t._writableState)===null||e===void 0?void 0:e.writable)!==!1))}s(wr,"isWritableNodeStream");function fp(t){return!!(t&&typeof t.pipe=="function"&&t._readableState&&typeof t.on=="function"&&typeof t.write=="function")}s(fp,"isDuplexNodeStream");function Ie(t){return t&&(t._readableState||t._writableState||typeof t.write=="function"&&typeof t.on=="function"||typeof t.pipe=="function"&&typeof t.on=="function")}s(Ie,"isNodeStream");function Sa(t){return!!(t&&!Ie(t)&&typeof t.pipeThrough=="function"&&typeof t.getReader=="function"&&typeof t.cancel=="function")}s(Sa,"isReadableStream");function _a(t){return!!(t&&!Ie(t)&&typeof t.getWriter=="function"&&typeof t.abort=="function")}s(_a,"isWritableStream");function Ea(t){return!!(t&&!Ie(t)&&typeof t.readable=="object"&&typeof t.writable=="object")}s(Ea,"isTransformStream");function dp(t){return Sa(t)||_a(t)||Ea(t)}s(dp,"isWebStream");function hp(t,e){return t==null?!1:e===!0?typeof t[ya]=="function":e===!1?typeof t[ma]=="function":typeof t[ya]=="function"||typeof t[ma]=="function"}s(hp,"isIterable");function Sr(t){if(!Ie(t))return null;let e=t._writableState,i=t._readableState,r=e||i;return!!(t.destroyed||t[ba]||r!=null&&r.destroyed)}s(Sr,"isDestroyed");function xa(t){if(!wr(t))return null;if(t.writableEnded===!0)return!0;let e=t._writableState;return e!=null&&e.errored?!1:typeof e?.ended!="boolean"?null:e.ended}s(xa,"isWritableEnded");function pp(t,e){if(!wr(t))return null;if(t.writableFinished===!0)return!0;let i=t._writableState;return i!=null&&i.errored?!1:typeof i?.finished!="boolean"?null:!!(i.finished||e===!1&&i.ended===!0&&i.length===0)}s(pp,"isWritableFinished");function yp(t){if(!gr(t))return null;if(t.readableEnded===!0)return!0;let e=t._readableState;return!e||e.errored?!1:typeof e?.ended!="boolean"?null:e.ended}s(yp,"isReadableEnded");function va(t,e){if(!gr(t))return null;let i=t._readableState;return i!=null&&i.errored?!1:typeof i?.endEmitted!="boolean"?null:!!(i.endEmitted||e===!1&&i.ended===!0&&i.length===0)}s(va,"isReadableFinished");function Aa(t){return t&&t[Zn]!=null?t[Zn]:typeof t?.readable!="boolean"?null:Sr(t)?!1:gr(t)&&t.readable&&!va(t)}s(Aa,"isReadable");function ka(t){return t&&t[eo]!=null?t[eo]:typeof t?.writable!="boolean"?null:Sr(t)?!1:wr(t)&&t.writable&&!xa(t)}s(ka,"isWritable");function mp(t,e){return Ie(t)?Sr(t)?!0:!(e?.readable!==!1&&Aa(t)||e?.writable!==!1&&ka(t)):null}s(mp,"isFinished");function bp(t){var e,i;return Ie(t)?t.writableErrored?t.writableErrored:(e=(i=t._writableState)===null||i===void 0?void 0:i.errored)!==null&&e!==void 0?e:null:null}s(bp,"isWritableErrored");function gp(t){var e,i;return Ie(t)?t.readableErrored?t.readableErrored:(e=(i=t._readableState)===null||i===void 0?void 0:i.errored)!==null&&e!==void 0?e:null:null}s(gp,"isReadableErrored");function wp(t){if(!Ie(t))return null;if(typeof t.closed=="boolean")return t.closed;let e=t._writableState,i=t._readableState;return typeof e?.closed=="boolean"||typeof i?.closed=="boolean"?e?.closed||i?.closed:typeof t._closed=="boolean"&&Na(t)?t._closed:null}s(wp,"isClosed");function Na(t){return typeof t._closed=="boolean"&&typeof t._defaultKeepAlive=="boolean"&&typeof t._removedConnection=="boolean"&&typeof t._removedContLen=="boolean"}s(Na,"isOutgoingMessage");function Ta(t){return typeof t._sent100=="boolean"&&Na(t)}s(Ta,"isServerResponse");function Sp(t){var e;return typeof t._consuming=="boolean"&&typeof t._dumped=="boolean"&&((e=t.req)===null||e===void 0?void 0:e.upgradeOrConnect)===void 0}s(Sp,"isServerRequest");function _p(t){if(!Ie(t))return null;let e=t._writableState,i=t._readableState,r=e||i;return!r&&Ta(t)||!!(r&&r.autoDestroy&&r.emitClose&&r.closed===!1)}s(_p,"willEmitClose");function Ep(t){var e;return!!(t&&((e=t[wa])!==null&&e!==void 0?e:t.readableDidRead||t.readableAborted))}s(Ep,"isDisturbed");function xp(t){var e,i,r,n,o,a,l,u,f,d;return!!(t&&((e=(i=(r=(n=(o=(a=t[ga])!==null&&a!==void 0?a:t.readableErrored)!==null&&o!==void 0?o:t.writableErrored)!==null&&n!==void 0?n:(l=t._readableState)===null||l===void 0?void 0:l.errorEmitted)!==null&&r!==void 0?r:(u=t._writableState)===null||u===void 0?void 0:u.errorEmitted)!==null&&i!==void 0?i:(f=t._readableState)===null||f===void 0?void 0:f.errored)!==null&&e!==void 0?e:!((d=t._writableState)===null||d===void 0)&&d.errored))}s(xp,"isErrored");Fa.exports={isDestroyed:Sr,kIsDestroyed:ba,isDisturbed:Ep,kIsDisturbed:wa,isErrored:xp,kIsErrored:ga,isReadable:Aa,kIsReadable:Zn,kIsClosedPromise:cp,kControllerErrorFunction:up,kIsWritable:eo,isClosed:wp,isDuplexNodeStream:fp,isFinished:mp,isIterable:hp,isReadableNodeStream:gr,isReadableStream:Sa,isReadableEnded:yp,isReadableFinished:va,isReadableErrored:gp,isNodeStream:Ie,isWebStream:dp,isWritable:ka,isWritableNodeStream:wr,isWritableStream:_a,isWritableEnded:xa,isWritableFinished:pp,isWritableErrored:bp,isServerRequest:Sp,isServerResponse:Ta,willEmitClose:_p,isTransformStream:Ea}});var qe=N((PS,oo)=>{var it=tt(),{AbortError:Ma,codes:vp}=ie(),{ERR_INVALID_ARG_TYPE:Ap,ERR_STREAM_PREMATURE_CLOSE:Ia}=vp,{kEmptyObject:io,once:ro}=Z(),{validateAbortSignal:kp,validateFunction:Np,validateObject:Tp,validateBoolean:Fp}=Yt(),{Promise:Ip,PromisePrototypeThen:Pp,SymbolDispose:Ua}=O(),{isClosed:Cp,isReadable:Pa,isReadableNodeStream:to,isReadableStream:Lp,isReadableFinished:Ca,isReadableErrored:La,isWritable:Ra,isWritableNodeStream:Oa,isWritableStream:Rp,isWritableFinished:Ba,isWritableErrored:Da,isNodeStream:Op,willEmitClose:Bp,kIsClosedPromise:Dp}=Pe(),Xt;function Mp(t){return t.setHeader&&typeof t.abort=="function"}s(Mp,"isRequest");var no=s(()=>{},"nop");function Wa(t,e,i){var r,n;if(arguments.length===2?(i=e,e=io):e==null?e=io:Tp(e,"options"),Np(i,"callback"),kp(e.signal,"options.signal"),i=ro(i),Lp(t)||Rp(t))return Up(t,e,i);if(!Op(t))throw new Ap("stream",["ReadableStream","WritableStream","Stream"],t);let o=(r=e.readable)!==null&&r!==void 0?r:to(t),a=(n=e.writable)!==null&&n!==void 0?n:Oa(t),l=t._writableState,u=t._readableState,f=s(()=>{t.writable||b()},"onlegacyfinish"),d=Bp(t)&&to(t)===o&&Oa(t)===a,h=Ba(t,!1),b=s(()=>{h=!0,t.destroyed&&(d=!1),!(d&&(!t.readable||o))&&(!o||m)&&i.call(t)},"onfinish"),m=Ca(t,!1),g=s(()=>{m=!0,t.destroyed&&(d=!1),!(d&&(!t.writable||a))&&(!a||h)&&i.call(t)},"onend"),y=s($=>{i.call(t,$)},"onerror"),k=Cp(t),w=s(()=>{k=!0;let $=Da(t)||La(t);if($&&typeof $!="boolean")return i.call(t,$);if(o&&!m&&to(t,!0)&&!Ca(t,!1))return i.call(t,new Ia);if(a&&!h&&!Ba(t,!1))return i.call(t,new Ia);i.call(t)},"onclose"),F=s(()=>{k=!0;let $=Da(t)||La(t);if($&&typeof $!="boolean")return i.call(t,$);i.call(t)},"onclosed"),D=s(()=>{t.req.on("finish",b)},"onrequest");Mp(t)?(t.on("complete",b),d||t.on("abort",w),t.req?D():t.on("request",D)):a&&!l&&(t.on("end",f),t.on("close",f)),!d&&typeof t.aborted=="boolean"&&t.on("aborted",w),t.on("end",g),t.on("finish",b),e.error!==!1&&t.on("error",y),t.on("close",w),k?it.nextTick(w):l!=null&&l.errorEmitted||u!=null&&u.errorEmitted?d||it.nextTick(F):(!o&&(!d||Pa(t))&&(h||Ra(t)===!1)||!a&&(!d||Ra(t))&&(m||Pa(t)===!1)||u&&t.req&&t.aborted)&&it.nextTick(F);let A=s(()=>{i=no,t.removeListener("aborted",w),t.removeListener("complete",b),t.removeListener("abort",w),t.removeListener("request",D),t.req&&t.req.removeListener("finish",b),t.removeListener("end",f),t.removeListener("close",f),t.removeListener("finish",b),t.removeListener("end",g),t.removeListener("error",y),t.removeListener("close",w)},"cleanup");if(e.signal&&!k){let $=s(()=>{let nt=i;A(),nt.call(t,new Ma(void 0,{cause:e.signal.reason}))},"abort");if(e.signal.aborted)it.nextTick($);else{Xt=Xt||Z().addAbortListener;let nt=Xt(e.signal,$),ue=i;i=ro((...vt)=>{nt[Ua](),ue.apply(t,vt)})}}return A}s(Wa,"eos");function Up(t,e,i){let r=!1,n=no;if(e.signal)if(n=s(()=>{r=!0,i.call(t,new Ma(void 0,{cause:e.signal.reason}))},"abort"),e.signal.aborted)it.nextTick(n);else{Xt=Xt||Z().addAbortListener;let a=Xt(e.signal,n),l=i;i=ro((...u)=>{a[Ua](),l.apply(t,u)})}let o=s((...a)=>{r||it.nextTick(()=>i.apply(t,a))},"resolverFn");return Pp(t[Dp].promise,o,o),no}s(Up,"eosWeb");function Wp(t,e){var i;let r=!1;return e===null&&(e=io),(i=e)!==null&&i!==void 0&&i.cleanup&&(Fp(e.cleanup,"cleanup"),r=e.cleanup),new Ip((n,o)=>{let a=Wa(t,e,l=>{r&&a(),l?o(l):n()})})}s(Wp,"finished");oo.exports=Wa;oo.exports.finished=Wp});var yt=N((LS,Ya)=>{"use strict";var Ce=tt(),{aggregateTwoErrors:qp,codes:{ERR_MULTIPLE_CALLBACK:jp},AbortError:$p}=ie(),{Symbol:$a}=O(),{kIsDestroyed:zp,isDestroyed:Vp,isFinished:Hp,isServerRequest:Kp}=Pe(),za=$a("kDestroy"),so=$a("kConstruct");function Va(t,e,i){t&&(t.stack,e&&!e.errored&&(e.errored=t),i&&!i.errored&&(i.errored=t))}s(Va,"checkError");function Yp(t,e){let i=this._readableState,r=this._writableState,n=r||i;return r!=null&&r.destroyed||i!=null&&i.destroyed?(typeof e=="function"&&e(),this):(Va(t,r,i),r&&(r.destroyed=!0),i&&(i.destroyed=!0),n.constructed?qa(this,t,e):this.once(za,function(o){qa(this,qp(o,t),e)}),this)}s(Yp,"destroy");function qa(t,e,i){let r=!1;function n(o){if(r)return;r=!0;let a=t._readableState,l=t._writableState;Va(o,l,a),l&&(l.closed=!0),a&&(a.closed=!0),typeof i=="function"&&i(o),o?Ce.nextTick(Gp,t,o):Ce.nextTick(Ha,t)}s(n,"onDestroy");try{t._destroy(e||null,n)}catch(o){n(o)}}s(qa,"_destroy");function Gp(t,e){ao(t,e),Ha(t)}s(Gp,"emitErrorCloseNT");function Ha(t){let e=t._readableState,i=t._writableState;i&&(i.closeEmitted=!0),e&&(e.closeEmitted=!0),(i!=null&&i.emitClose||e!=null&&e.emitClose)&&t.emit("close")}s(Ha,"emitCloseNT");function ao(t,e){let i=t._readableState,r=t._writableState;r!=null&&r.errorEmitted||i!=null&&i.errorEmitted||(r&&(r.errorEmitted=!0),i&&(i.errorEmitted=!0),t.emit("error",e))}s(ao,"emitErrorNT");function Xp(){let t=this._readableState,e=this._writableState;t&&(t.constructed=!0,t.closed=!1,t.closeEmitted=!1,t.destroyed=!1,t.errored=null,t.errorEmitted=!1,t.reading=!1,t.ended=t.readable===!1,t.endEmitted=t.readable===!1),e&&(e.constructed=!0,e.destroyed=!1,e.closed=!1,e.closeEmitted=!1,e.errored=null,e.errorEmitted=!1,e.finalCalled=!1,e.prefinished=!1,e.ended=e.writable===!1,e.ending=e.writable===!1,e.finished=e.writable===!1)}s(Xp,"undestroy");function lo(t,e,i){let r=t._readableState,n=t._writableState;if(n!=null&&n.destroyed||r!=null&&r.destroyed)return this;r!=null&&r.autoDestroy||n!=null&&n.autoDestroy?t.destroy(e):e&&(e.stack,n&&!n.errored&&(n.errored=e),r&&!r.errored&&(r.errored=e),i?Ce.nextTick(ao,t,e):ao(t,e))}s(lo,"errorOrDestroy");function Jp(t,e){if(typeof t._construct!="function")return;let i=t._readableState,r=t._writableState;i&&(i.constructed=!1),r&&(r.constructed=!1),t.once(so,e),!(t.listenerCount(so)>1)&&Ce.nextTick(Qp,t)}s(Jp,"construct");function Qp(t){let e=!1;function i(r){if(e){lo(t,r??new jp);return}e=!0;let n=t._readableState,o=t._writableState,a=o||n;n&&(n.constructed=!0),o&&(o.constructed=!0),a.destroyed?t.emit(za,r):r?lo(t,r,!0):Ce.nextTick(Zp,t)}s(i,"onConstruct");try{t._construct(r=>{Ce.nextTick(i,r)})}catch(r){Ce.nextTick(i,r)}}s(Qp,"constructNT");function Zp(t){t.emit(so)}s(Zp,"emitConstructNT");function ja(t){return t?.setHeader&&typeof t.abort=="function"}s(ja,"isRequest");function Ka(t){t.emit("close")}s(Ka,"emitCloseLegacy");function ey(t,e){t.emit("error",e),Ce.nextTick(Ka,t)}s(ey,"emitErrorCloseLegacy");function ty(t,e){!t||Vp(t)||(!e&&!Hp(t)&&(e=new $p),Kp(t)?(t.socket=null,t.destroy(e)):ja(t)?t.abort():ja(t.req)?t.req.abort():typeof t.destroy=="function"?t.destroy(e):typeof t.close=="function"?t.close():e?Ce.nextTick(ey,t,e):Ce.nextTick(Ka,t),t.destroyed||(t[zp]=!0))}s(ty,"destroyer");Ya.exports={construct:Jp,destroyer:ty,destroy:Yp,undestroy:Xp,errorOrDestroy:lo}});var xr=N((OS,Xa)=>{"use strict";var{ArrayIsArray:iy,ObjectSetPrototypeOf:Ga}=O(),{EventEmitter:_r}=vi();function Er(t){_r.call(this,t)}s(Er,"Stream");Ga(Er.prototype,_r.prototype);Ga(Er,_r);Er.prototype.pipe=function(t,e){let i=this;function r(d){t.writable&&t.write(d)===!1&&i.pause&&i.pause()}s(r,"ondata"),i.on("data",r);function n(){i.readable&&i.resume&&i.resume()}s(n,"ondrain"),t.on("drain",n),!t._isStdio&&(!e||e.end!==!1)&&(i.on("end",a),i.on("close",l));let o=!1;function a(){o||(o=!0,t.end())}s(a,"onend");function l(){o||(o=!0,typeof t.destroy=="function"&&t.destroy())}s(l,"onclose");function u(d){f(),_r.listenerCount(this,"error")===0&&this.emit("error",d)}s(u,"onerror"),co(i,"error",u),co(t,"error",u);function f(){i.removeListener("data",r),t.removeListener("drain",n),i.removeListener("end",a),i.removeListener("close",l),i.removeListener("error",u),t.removeListener("error",u),i.removeListener("end",f),i.removeListener("close",f),t.removeListener("close",f)}return s(f,"cleanup"),i.on("end",f),i.on("close",f),t.on("close",f),t.emit("pipe",i),t};function co(t,e,i){if(typeof t.prependListener=="function")return t.prependListener(e,i);!t._events||!t._events[e]?t.on(e,i):iy(t._events[e])?t._events[e].unshift(i):t._events[e]=[i,t._events[e]]}s(co,"prependListener");Xa.exports={Stream:Er,prependListener:co}});var Ai=N((DS,vr)=>{"use strict";var{SymbolDispose:ry}=O(),{AbortError:Ja,codes:ny}=ie(),{isNodeStream:Qa,isWebStream:oy,kControllerErrorFunction:sy}=Pe(),ay=qe(),{ERR_INVALID_ARG_TYPE:Za}=ny,uo,ly=s((t,e)=>{if(typeof t!="object"||!("aborted"in t))throw new Za(e,"AbortSignal",t)},"validateAbortSignal");vr.exports.addAbortSignal=s(function(e,i){if(ly(e,"signal"),!Qa(i)&&!oy(i))throw new Za("stream",["ReadableStream","WritableStream","Stream"],i);return vr.exports.addAbortSignalNoValidate(e,i)},"addAbortSignal");vr.exports.addAbortSignalNoValidate=function(t,e){if(typeof t!="object"||!("aborted"in t))return e;let i=Qa(e)?()=>{e.destroy(new Ja(void 0,{cause:t.reason}))}:()=>{e[sy](new Ja(void 0,{cause:t.reason}))};if(t.aborted)i();else{uo=uo||Z().addAbortListener;let r=uo(t,i);ay(e,r[ry])}return e}});var il=N((WS,tl)=>{"use strict";var{StringPrototypeSlice:el,SymbolIterator:cy,TypedArrayPrototypeSet:Ar,Uint8Array:uy}=O(),{Buffer:fo}=Me(),{inspect:fy}=Z();tl.exports=s(class{constructor(){this.head=null,this.tail=null,this.length=0}push(e){let i={data:e,next:null};this.length>0?this.tail.next=i:this.head=i,this.tail=i,++this.length}unshift(e){let i={data:e,next:this.head};this.length===0&&(this.tail=i),this.head=i,++this.length}shift(){if(this.length===0)return;let e=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,e}clear(){this.head=this.tail=null,this.length=0}join(e){if(this.length===0)return"";let i=this.head,r=""+i.data;for(;(i=i.next)!==null;)r+=e+i.data;return r}concat(e){if(this.length===0)return fo.alloc(0);let i=fo.allocUnsafe(e>>>0),r=this.head,n=0;for(;r;)Ar(i,r.data,n),n+=r.data.length,r=r.next;return i}consume(e,i){let r=this.head.data;if(e<r.length){let n=r.slice(0,e);return this.head.data=r.slice(e),n}return e===r.length?this.shift():i?this._getString(e):this._getBuffer(e)}first(){return this.head.data}*[cy](){for(let e=this.head;e;e=e.next)yield e.data}_getString(e){let i="",r=this.head,n=0;do{let o=r.data;if(e>o.length)i+=o,e-=o.length;else{e===o.length?(i+=o,++n,r.next?this.head=r.next:this.head=this.tail=null):(i+=el(o,0,e),this.head=r,r.data=el(o,e));break}++n}while((r=r.next)!==null);return this.length-=n,i}_getBuffer(e){let i=fo.allocUnsafe(e),r=e,n=this.head,o=0;do{let a=n.data;if(e>a.length)Ar(i,a,r-e),e-=a.length;else{e===a.length?(Ar(i,a,r-e),++o,n.next?this.head=n.next:this.head=this.tail=null):(Ar(i,new uy(a.buffer,a.byteOffset,e),r-e),this.head=n,n.data=a.slice(e));break}++o}while((n=n.next)!==null);return this.length-=o,i}[Symbol.for("nodejs.util.inspect.custom")](e,i){return fy(this,{...i,depth:0,customInspect:!1})}},"BufferList")});var ki=N((jS,sl)=>{"use strict";var{MathFloor:dy,NumberIsInteger:hy}=O(),{validateInteger:py}=Yt(),{ERR_INVALID_ARG_VALUE:yy}=ie().codes,rl=16*1024,nl=16;function my(t,e,i){return t.highWaterMark!=null?t.highWaterMark:e?t[i]:null}s(my,"highWaterMarkFrom");function ol(t){return t?nl:rl}s(ol,"getDefaultHighWaterMark");function by(t,e){py(e,"value",0),t?nl=e:rl=e}s(by,"setDefaultHighWaterMark");function gy(t,e,i,r){let n=my(e,r,i);if(n!=null){if(!hy(n)||n<0){let o=r?`options.${i}`:"options.highWaterMark";throw new yy(o,n)}return dy(n)}return ol(t.objectMode)}s(gy,"getHighWaterMark");sl.exports={getHighWaterMark:gy,getDefaultHighWaterMark:ol,setDefaultHighWaterMark:by}});var cl=N((ho,ll)=>{var kr=Me(),Le=kr.Buffer;function al(t,e){for(var i in t)e[i]=t[i]}s(al,"copyProps");Le.from&&Le.alloc&&Le.allocUnsafe&&Le.allocUnsafeSlow?ll.exports=kr:(al(kr,ho),ho.Buffer=mt);function mt(t,e,i){return Le(t,e,i)}s(mt,"SafeBuffer");mt.prototype=Object.create(Le.prototype);al(Le,mt);mt.from=function(t,e,i){if(typeof t=="number")throw new TypeError("Argument must not be a number");return Le(t,e,i)};mt.alloc=function(t,e,i){if(typeof t!="number")throw new TypeError("Argument must be a number");var r=Le(t);return e!==void 0?typeof i=="string"?r.fill(e,i):r.fill(e):r.fill(0),r};mt.allocUnsafe=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return Le(t)};mt.allocUnsafeSlow=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return kr.SlowBuffer(t)}});var dl=N(fl=>{"use strict";var yo=cl().Buffer,ul=yo.isEncoding||function(t){switch(t=""+t,t&&t.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function wy(t){if(!t)return"utf8";for(var e;;)switch(t){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return t;default:if(e)return;t=(""+t).toLowerCase(),e=!0}}s(wy,"_normalizeEncoding");function Sy(t){var e=wy(t);if(typeof e!="string"&&(yo.isEncoding===ul||!ul(t)))throw new Error("Unknown encoding: "+t);return e||t}s(Sy,"normalizeEncoding");fl.StringDecoder=Ni;function Ni(t){this.encoding=Sy(t);var e;switch(this.encoding){case"utf16le":this.text=ky,this.end=Ny,e=4;break;case"utf8":this.fillLast=xy,e=4;break;case"base64":this.text=Ty,this.end=Fy,e=3;break;default:this.write=Iy,this.end=Py;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=yo.allocUnsafe(e)}s(Ni,"StringDecoder");Ni.prototype.write=function(t){if(t.length===0)return"";var e,i;if(this.lastNeed){if(e=this.fillLast(t),e===void 0)return"";i=this.lastNeed,this.lastNeed=0}else i=0;return i<t.length?e?e+this.text(t,i):this.text(t,i):e||""};Ni.prototype.end=Ay;Ni.prototype.text=vy;Ni.prototype.fillLast=function(t){if(this.lastNeed<=t.length)return t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,t.length),this.lastNeed-=t.length};function po(t){return t<=127?0:t>>5===6?2:t>>4===14?3:t>>3===30?4:t>>6===2?-1:-2}s(po,"utf8CheckByte");function _y(t,e,i){var r=e.length-1;if(r<i)return 0;var n=po(e[r]);return n>=0?(n>0&&(t.lastNeed=n-1),n):--r<i||n===-2?0:(n=po(e[r]),n>=0?(n>0&&(t.lastNeed=n-2),n):--r<i||n===-2?0:(n=po(e[r]),n>=0?(n>0&&(n===2?n=0:t.lastNeed=n-3),n):0))}s(_y,"utf8CheckIncomplete");function Ey(t,e,i){if((e[0]&192)!==128)return t.lastNeed=0,"\uFFFD";if(t.lastNeed>1&&e.length>1){if((e[1]&192)!==128)return t.lastNeed=1,"\uFFFD";if(t.lastNeed>2&&e.length>2&&(e[2]&192)!==128)return t.lastNeed=2,"\uFFFD"}}s(Ey,"utf8CheckExtraBytes");function xy(t){var e=this.lastTotal-this.lastNeed,i=Ey(this,t,e);if(i!==void 0)return i;if(this.lastNeed<=t.length)return t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,e,0,t.length),this.lastNeed-=t.length}s(xy,"utf8FillLast");function vy(t,e){var i=_y(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=i;var r=t.length-(i-this.lastNeed);return t.copy(this.lastChar,0,r),t.toString("utf8",e,r)}s(vy,"utf8Text");function Ay(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"\uFFFD":e}s(Ay,"utf8End");function ky(t,e){if((t.length-e)%2===0){var i=t.toString("utf16le",e);if(i){var r=i.charCodeAt(i.length-1);if(r>=55296&&r<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],i.slice(0,-1)}return i}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}s(ky,"utf16Text");function Ny(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var i=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,i)}return e}s(Ny,"utf16End");function Ty(t,e){var i=(t.length-e)%3;return i===0?t.toString("base64",e):(this.lastNeed=3-i,this.lastTotal=3,i===1?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-i))}s(Ty,"base64Text");function Fy(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}s(Fy,"base64End");function Iy(t){return t.toString(this.encoding)}s(Iy,"simpleWrite");function Py(t){return t&&t.length?this.write(t):""}s(Py,"simpleEnd")});var mo=N((KS,ml)=>{"use strict";var hl=tt(),{PromisePrototypeThen:Cy,SymbolAsyncIterator:pl,SymbolIterator:yl}=O(),{Buffer:Ly}=Me(),{ERR_INVALID_ARG_TYPE:Ry,ERR_STREAM_NULL_VALUES:Oy}=ie().codes;function By(t,e,i){let r;if(typeof e=="string"||e instanceof Ly)return new t({objectMode:!0,...i,read(){this.push(e),this.push(null)}});let n;if(e&&e[pl])n=!0,r=e[pl]();else if(e&&e[yl])n=!1,r=e[yl]();else throw new Ry("iterable",["Iterable"],e);let o=new t({objectMode:!0,highWaterMark:1,...i}),a=!1;o._read=function(){a||(a=!0,u())},o._destroy=function(f,d){Cy(l(f),()=>hl.nextTick(d,f),h=>hl.nextTick(d,h||f))};async function l(f){let d=f!=null,h=typeof r.throw=="function";if(d&&h){let{value:b,done:m}=await r.throw(f);if(await b,m)return}if(typeof r.return=="function"){let{value:b}=await r.return();await b}}s(l,"close");async function u(){for(;;){try{let{value:f,done:d}=n?await r.next():r.next();if(d)o.push(null);else{let h=f&&typeof f.then=="function"?await f:f;if(h===null)throw a=!1,new Oy;if(o.push(h))continue;a=!1}}catch(f){o.destroy(f)}break}}return s(u,"next"),o}s(By,"from");ml.exports=By});var Fi=N((GS,Rl)=>{var Ee=tt(),{ArrayPrototypeIndexOf:Dy,NumberIsInteger:My,NumberIsNaN:Uy,NumberParseInt:Wy,ObjectDefineProperties:vo,ObjectKeys:qy,ObjectSetPrototypeOf:wl,Promise:Sl,SafeSet:jy,SymbolAsyncDispose:$y,SymbolAsyncIterator:zy,Symbol:Vy}=O();Rl.exports=_;_.ReadableState=Ir;var{EventEmitter:Hy}=vi(),{Stream:rt,prependListener:Ky}=xr(),{Buffer:bo}=Me(),{addAbortSignal:Yy}=Ai(),_l=qe(),x=Z().debuglog("stream",t=>{x=t}),Gy=il(),Zt=yt(),{getHighWaterMark:Xy,getDefaultHighWaterMark:Jy}=ki(),{aggregateTwoErrors:bl,codes:{ERR_INVALID_ARG_TYPE:Qy,ERR_METHOD_NOT_IMPLEMENTED:Zy,ERR_OUT_OF_RANGE:em,ERR_STREAM_PUSH_AFTER_EOF:tm,ERR_STREAM_UNSHIFT_AFTER_END_EVENT:im},AbortError:rm}=ie(),{validateObject:nm}=Yt(),bt=Vy("kPaused"),{StringDecoder:El}=dl(),om=mo();wl(_.prototype,rt.prototype);wl(_,rt);var go=s(()=>{},"nop"),{errorOrDestroy:Jt}=Zt,Qt=1<<0,sm=1<<1,xl=1<<2,Ti=1<<3,vl=1<<4,Nr=1<<5,Tr=1<<6,Al=1<<7,am=1<<8,lm=1<<9,cm=1<<10,Eo=1<<11,xo=1<<12,um=1<<13,fm=1<<14,dm=1<<15,kl=1<<16,hm=1<<17,pm=1<<18;function V(t){return{enumerable:!1,get(){return(this.state&t)!==0},set(e){e?this.state|=t:this.state&=~t}}}s(V,"makeBitMapDescriptor");vo(Ir.prototype,{objectMode:V(Qt),ended:V(sm),endEmitted:V(xl),reading:V(Ti),constructed:V(vl),sync:V(Nr),needReadable:V(Tr),emittedReadable:V(Al),readableListening:V(am),resumeScheduled:V(lm),errorEmitted:V(cm),emitClose:V(Eo),autoDestroy:V(xo),destroyed:V(um),closed:V(fm),closeEmitted:V(dm),multiAwaitDrain:V(kl),readingMore:V(hm),dataEmitted:V(pm)});function Ir(t,e,i){typeof i!="boolean"&&(i=e instanceof Re()),this.state=Eo|xo|vl|Nr,t&&t.objectMode&&(this.state|=Qt),i&&t&&t.readableObjectMode&&(this.state|=Qt),this.highWaterMark=t?Xy(this,t,"readableHighWaterMark",i):Jy(!1),this.buffer=new Gy,this.length=0,this.pipes=[],this.flowing=null,this[bt]=null,t&&t.emitClose===!1&&(this.state&=~Eo),t&&t.autoDestroy===!1&&(this.state&=~xo),this.errored=null,this.defaultEncoding=t&&t.defaultEncoding||"utf8",this.awaitDrainWriters=null,this.decoder=null,this.encoding=null,t&&t.encoding&&(this.decoder=new El(t.encoding),this.encoding=t.encoding)}s(Ir,"ReadableState");function _(t){if(!(this instanceof _))return new _(t);let e=this instanceof Re();this._readableState=new Ir(t,this,e),t&&(typeof t.read=="function"&&(this._read=t.read),typeof t.destroy=="function"&&(this._destroy=t.destroy),typeof t.construct=="function"&&(this._construct=t.construct),t.signal&&!e&&Yy(t.signal,this)),rt.call(this,t),Zt.construct(this,()=>{this._readableState.needReadable&&Fr(this,this._readableState)})}s(_,"Readable");_.prototype.destroy=Zt.destroy;_.prototype._undestroy=Zt.undestroy;_.prototype._destroy=function(t,e){e(t)};_.prototype[Hy.captureRejectionSymbol]=function(t){this.destroy(t)};_.prototype[$y]=function(){let t;return this.destroyed||(t=this.readableEnded?null:new rm,this.destroy(t)),new Sl((e,i)=>_l(this,r=>r&&r!==t?i(r):e(null)))};_.prototype.push=function(t,e){return Nl(this,t,e,!1)};_.prototype.unshift=function(t,e){return Nl(this,t,e,!0)};function Nl(t,e,i,r){x("readableAddChunk",e);let n=t._readableState,o;if(n.state&Qt||(typeof e=="string"?(i=i||n.defaultEncoding,n.encoding!==i&&(r&&n.encoding?e=bo.from(e,i).toString(n.encoding):(e=bo.from(e,i),i=""))):e instanceof bo?i="":rt._isUint8Array(e)?(e=rt._uint8ArrayToBuffer(e),i=""):e!=null&&(o=new Qy("chunk",["string","Buffer","Uint8Array"],e))),o)Jt(t,o);else if(e===null)n.state&=~Ti,bm(t,n);else if(n.state&Qt||e&&e.length>0)if(r)if(n.state&xl)Jt(t,new im);else{if(n.destroyed||n.errored)return!1;wo(t,n,e,!0)}else if(n.ended)Jt(t,new tm);else{if(n.destroyed||n.errored)return!1;n.state&=~Ti,n.decoder&&!i?(e=n.decoder.write(e),n.objectMode||e.length!==0?wo(t,n,e,!1):Fr(t,n)):wo(t,n,e,!1)}else r||(n.state&=~Ti,Fr(t,n));return!n.ended&&(n.length<n.highWaterMark||n.length===0)}s(Nl,"readableAddChunk");function wo(t,e,i,r){e.flowing&&e.length===0&&!e.sync&&t.listenerCount("data")>0?(e.state&kl?e.awaitDrainWriters.clear():e.awaitDrainWriters=null,e.dataEmitted=!0,t.emit("data",i)):(e.length+=e.objectMode?1:i.length,r?e.buffer.unshift(i):e.buffer.push(i),e.state&Tr&&Pr(t)),Fr(t,e)}s(wo,"addChunk");_.prototype.isPaused=function(){let t=this._readableState;return t[bt]===!0||t.flowing===!1};_.prototype.setEncoding=function(t){let e=new El(t);this._readableState.decoder=e,this._readableState.encoding=this._readableState.decoder.encoding;let i=this._readableState.buffer,r="";for(let n of i)r+=e.write(n);return i.clear(),r!==""&&i.push(r),this._readableState.length=r.length,this};var ym=1073741824;function mm(t){if(t>ym)throw new em("size","<= 1GiB",t);return t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++,t}s(mm,"computeNewHighWaterMark");function gl(t,e){return t<=0||e.length===0&&e.ended?0:e.state&Qt?1:Uy(t)?e.flowing&&e.length?e.buffer.first().length:e.length:t<=e.length?t:e.ended?e.length:0}s(gl,"howMuchToRead");_.prototype.read=function(t){x("read",t),t===void 0?t=NaN:My(t)||(t=Wy(t,10));let e=this._readableState,i=t;if(t>e.highWaterMark&&(e.highWaterMark=mm(t)),t!==0&&(e.state&=~Al),t===0&&e.needReadable&&((e.highWaterMark!==0?e.length>=e.highWaterMark:e.length>0)||e.ended))return x("read: emitReadable",e.length,e.ended),e.length===0&&e.ended?So(this):Pr(this),null;if(t=gl(t,e),t===0&&e.ended)return e.length===0&&So(this),null;let r=(e.state&Tr)!==0;if(x("need readable",r),(e.length===0||e.length-t<e.highWaterMark)&&(r=!0,x("length less than watermark",r)),e.ended||e.reading||e.destroyed||e.errored||!e.constructed)r=!1,x("reading, ended or constructing",r);else if(r){x("do read"),e.state|=Ti|Nr,e.length===0&&(e.state|=Tr);try{this._read(e.highWaterMark)}catch(o){Jt(this,o)}e.state&=~Nr,e.reading||(t=gl(i,e))}let n;return t>0?n=Cl(t,e):n=null,n===null?(e.needReadable=e.length<=e.highWaterMark,t=0):(e.length-=t,e.multiAwaitDrain?e.awaitDrainWriters.clear():e.awaitDrainWriters=null),e.length===0&&(e.ended||(e.needReadable=!0),i!==t&&e.ended&&So(this)),n!==null&&!e.errorEmitted&&!e.closeEmitted&&(e.dataEmitted=!0,this.emit("data",n)),n};function bm(t,e){if(x("onEofChunk"),!e.ended){if(e.decoder){let i=e.decoder.end();i&&i.length&&(e.buffer.push(i),e.length+=e.objectMode?1:i.length)}e.ended=!0,e.sync?Pr(t):(e.needReadable=!1,e.emittedReadable=!0,Tl(t))}}s(bm,"onEofChunk");function Pr(t){let e=t._readableState;x("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(x("emitReadable",e.flowing),e.emittedReadable=!0,Ee.nextTick(Tl,t))}s(Pr,"emitReadable");function Tl(t){let e=t._readableState;x("emitReadable_",e.destroyed,e.length,e.ended),!e.destroyed&&!e.errored&&(e.length||e.ended)&&(t.emit("readable"),e.emittedReadable=!1),e.needReadable=!e.flowing&&!e.ended&&e.length<=e.highWaterMark,Il(t)}s(Tl,"emitReadable_");function Fr(t,e){!e.readingMore&&e.constructed&&(e.readingMore=!0,Ee.nextTick(gm,t,e))}s(Fr,"maybeReadMore");function gm(t,e){for(;!e.reading&&!e.ended&&(e.length<e.highWaterMark||e.flowing&&e.length===0);){let i=e.length;if(x("maybeReadMore read 0"),t.read(0),i===e.length)break}e.readingMore=!1}s(gm,"maybeReadMore_");_.prototype._read=function(t){throw new Zy("_read()")};_.prototype.pipe=function(t,e){let i=this,r=this._readableState;r.pipes.length===1&&(r.multiAwaitDrain||(r.multiAwaitDrain=!0,r.awaitDrainWriters=new jy(r.awaitDrainWriters?[r.awaitDrainWriters]:[]))),r.pipes.push(t),x("pipe count=%d opts=%j",r.pipes.length,e);let o=(!e||e.end!==!1)&&t!==Ee.stdout&&t!==Ee.stderr?l:k;r.endEmitted?Ee.nextTick(o):i.once("end",o),t.on("unpipe",a);function a(w,F){x("onunpipe"),w===i&&F&&F.hasUnpiped===!1&&(F.hasUnpiped=!0,d())}s(a,"onunpipe");function l(){x("onend"),t.end()}s(l,"onend");let u,f=!1;function d(){x("cleanup"),t.removeListener("close",g),t.removeListener("finish",y),u&&t.removeListener("drain",u),t.removeListener("error",m),t.removeListener("unpipe",a),i.removeListener("end",l),i.removeListener("end",k),i.removeListener("data",b),f=!0,u&&r.awaitDrainWriters&&(!t._writableState||t._writableState.needDrain)&&u()}s(d,"cleanup");function h(){f||(r.pipes.length===1&&r.pipes[0]===t?(x("false write response, pause",0),r.awaitDrainWriters=t,r.multiAwaitDrain=!1):r.pipes.length>1&&r.pipes.includes(t)&&(x("false write response, pause",r.awaitDrainWriters.size),r.awaitDrainWriters.add(t)),i.pause()),u||(u=wm(i,t),t.on("drain",u))}s(h,"pause"),i.on("data",b);function b(w){x("ondata");let F=t.write(w);x("dest.write",F),F===!1&&h()}s(b,"ondata");function m(w){if(x("onerror",w),k(),t.removeListener("error",m),t.listenerCount("error")===0){let F=t._writableState||t._readableState;F&&!F.errorEmitted?Jt(t,w):t.emit("error",w)}}s(m,"onerror"),Ky(t,"error",m);function g(){t.removeListener("finish",y),k()}s(g,"onclose"),t.once("close",g);function y(){x("onfinish"),t.removeListener("close",g),k()}s(y,"onfinish"),t.once("finish",y);function k(){x("unpipe"),i.unpipe(t)}return s(k,"unpipe"),t.emit("pipe",i),t.writableNeedDrain===!0?h():r.flowing||(x("pipe resume"),i.resume()),t};function wm(t,e){return s(function(){let r=t._readableState;r.awaitDrainWriters===e?(x("pipeOnDrain",1),r.awaitDrainWriters=null):r.multiAwaitDrain&&(x("pipeOnDrain",r.awaitDrainWriters.size),r.awaitDrainWriters.delete(e)),(!r.awaitDrainWriters||r.awaitDrainWriters.size===0)&&t.listenerCount("data")&&t.resume()},"pipeOnDrainFunctionResult")}s(wm,"pipeOnDrain");_.prototype.unpipe=function(t){let e=this._readableState,i={hasUnpiped:!1};if(e.pipes.length===0)return this;if(!t){let n=e.pipes;e.pipes=[],this.pause();for(let o=0;o<n.length;o++)n[o].emit("unpipe",this,{hasUnpiped:!1});return this}let r=Dy(e.pipes,t);return r===-1?this:(e.pipes.splice(r,1),e.pipes.length===0&&this.pause(),t.emit("unpipe",this,i),this)};_.prototype.on=function(t,e){let i=rt.prototype.on.call(this,t,e),r=this._readableState;return t==="data"?(r.readableListening=this.listenerCount("readable")>0,r.flowing!==!1&&this.resume()):t==="readable"&&!r.endEmitted&&!r.readableListening&&(r.readableListening=r.needReadable=!0,r.flowing=!1,r.emittedReadable=!1,x("on readable",r.length,r.reading),r.length?Pr(this):r.reading||Ee.nextTick(Sm,this)),i};_.prototype.addListener=_.prototype.on;_.prototype.removeListener=function(t,e){let i=rt.prototype.removeListener.call(this,t,e);return t==="readable"&&Ee.nextTick(Fl,this),i};_.prototype.off=_.prototype.removeListener;_.prototype.removeAllListeners=function(t){let e=rt.prototype.removeAllListeners.apply(this,arguments);return(t==="readable"||t===void 0)&&Ee.nextTick(Fl,this),e};function Fl(t){let e=t._readableState;e.readableListening=t.listenerCount("readable")>0,e.resumeScheduled&&e[bt]===!1?e.flowing=!0:t.listenerCount("data")>0?t.resume():e.readableListening||(e.flowing=null)}s(Fl,"updateReadableListening");function Sm(t){x("readable nexttick read 0"),t.read(0)}s(Sm,"nReadingNextTick");_.prototype.resume=function(){let t=this._readableState;return t.flowing||(x("resume"),t.flowing=!t.readableListening,_m(this,t)),t[bt]=!1,this};function _m(t,e){e.resumeScheduled||(e.resumeScheduled=!0,Ee.nextTick(Em,t,e))}s(_m,"resume");function Em(t,e){x("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),Il(t),e.flowing&&!e.reading&&t.read(0)}s(Em,"resume_");_.prototype.pause=function(){return x("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(x("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState[bt]=!0,this};function Il(t){let e=t._readableState;for(x("flow",e.flowing);e.flowing&&t.read()!==null;);}s(Il,"flow");_.prototype.wrap=function(t){let e=!1;t.on("data",r=>{!this.push(r)&&t.pause&&(e=!0,t.pause())}),t.on("end",()=>{this.push(null)}),t.on("error",r=>{Jt(this,r)}),t.on("close",()=>{this.destroy()}),t.on("destroy",()=>{this.destroy()}),this._read=()=>{e&&t.resume&&(e=!1,t.resume())};let i=qy(t);for(let r=1;r<i.length;r++){let n=i[r];this[n]===void 0&&typeof t[n]=="function"&&(this[n]=t[n].bind(t))}return this};_.prototype[zy]=function(){return Pl(this)};_.prototype.iterator=function(t){return t!==void 0&&nm(t,"options"),Pl(this,t)};function Pl(t,e){typeof t.read!="function"&&(t=_.wrap(t,{objectMode:!0}));let i=xm(t,e);return i.stream=t,i}s(Pl,"streamToAsyncIterator");async function*xm(t,e){let i=go;function r(a){this===t?(i(),i=go):i=a}s(r,"next"),t.on("readable",r);let n,o=_l(t,{writable:!1},a=>{n=a?bl(n,a):null,i(),i=go});try{for(;;){let a=t.destroyed?null:t.read();if(a!==null)yield a;else{if(n)throw n;if(n===null)return;await new Sl(r)}}}catch(a){throw n=bl(n,a),n}finally{(n||e?.destroyOnReturn!==!1)&&(n===void 0||t._readableState.autoDestroy)?Zt.destroyer(t,null):(t.off("readable",r),o())}}s(xm,"createAsyncIterator");vo(_.prototype,{readable:{__proto__:null,get(){let t=this._readableState;return!!t&&t.readable!==!1&&!t.destroyed&&!t.errorEmitted&&!t.endEmitted},set(t){this._readableState&&(this._readableState.readable=!!t)}},readableDidRead:{__proto__:null,enumerable:!1,get:function(){return this._readableState.dataEmitted}},readableAborted:{__proto__:null,enumerable:!1,get:function(){return!!(this._readableState.readable!==!1&&(this._readableState.destroyed||this._readableState.errored)&&!this._readableState.endEmitted)}},readableHighWaterMark:{__proto__:null,enumerable:!1,get:function(){return this._readableState.highWaterMark}},readableBuffer:{__proto__:null,enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}},readableFlowing:{__proto__:null,enumerable:!1,get:function(){return this._readableState.flowing},set:function(t){this._readableState&&(this._readableState.flowing=t)}},readableLength:{__proto__:null,enumerable:!1,get(){return this._readableState.length}},readableObjectMode:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.objectMode:!1}},readableEncoding:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.encoding:null}},errored:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.errored:null}},closed:{__proto__:null,get(){return this._readableState?this._readableState.closed:!1}},destroyed:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.destroyed:!1},set(t){this._readableState&&(this._readableState.destroyed=t)}},readableEnded:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.endEmitted:!1}}});vo(Ir.prototype,{pipesCount:{__proto__:null,get(){return this.pipes.length}},paused:{__proto__:null,get(){return this[bt]!==!1},set(t){this[bt]=!!t}}});_._fromList=Cl;function Cl(t,e){if(e.length===0)return null;let i;return e.objectMode?i=e.buffer.shift():!t||t>=e.length?(e.decoder?i=e.buffer.join(""):e.buffer.length===1?i=e.buffer.first():i=e.buffer.concat(e.length),e.buffer.clear()):i=e.buffer.consume(t,e.decoder),i}s(Cl,"fromList");function So(t){let e=t._readableState;x("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,Ee.nextTick(vm,e,t))}s(So,"endReadable");function vm(t,e){if(x("endReadableNT",t.endEmitted,t.length),!t.errored&&!t.closeEmitted&&!t.endEmitted&&t.length===0){if(t.endEmitted=!0,e.emit("end"),e.writable&&e.allowHalfOpen===!1)Ee.nextTick(Am,e);else if(t.autoDestroy){let i=e._writableState;(!i||i.autoDestroy&&(i.finished||i.writable===!1))&&e.destroy()}}}s(vm,"endReadableNT");function Am(t){t.writable&&!t.writableEnded&&!t.destroyed&&t.end()}s(Am,"endWritableNT");_.from=function(t,e){return om(_,t,e)};var _o;function Ll(){return _o===void 0&&(_o={}),_o}s(Ll,"lazyWebStreams");_.fromWeb=function(t,e){return Ll().newStreamReadableFromReadableStream(t,e)};_.toWeb=function(t,e){return Ll().newReadableStreamFromStreamReadable(t,e)};_.wrap=function(t,e){var i,r;return new _({objectMode:(i=(r=t.readableObjectMode)!==null&&r!==void 0?r:t.objectMode)!==null&&i!==void 0?i:!0,...e,destroy(n,o){Zt.destroyer(t,n),o(n)}}).wrap(t)}});var Br=N((JS,Hl)=>{var gt=tt(),{ArrayPrototypeSlice:Dl,Error:km,FunctionPrototypeSymbolHasInstance:Ml,ObjectDefineProperty:Ul,ObjectDefineProperties:Nm,ObjectSetPrototypeOf:Wl,StringPrototypeToLowerCase:Tm,Symbol:Fm,SymbolHasInstance:Im}=O();Hl.exports=B;B.WritableState=Ci;var{EventEmitter:Pm}=vi(),Ii=xr().Stream,{Buffer:Cr}=Me(),Or=yt(),{addAbortSignal:Cm}=Ai(),{getHighWaterMark:Lm,getDefaultHighWaterMark:Rm}=ki(),{ERR_INVALID_ARG_TYPE:Om,ERR_METHOD_NOT_IMPLEMENTED:Bm,ERR_MULTIPLE_CALLBACK:ql,ERR_STREAM_CANNOT_PIPE:Dm,ERR_STREAM_DESTROYED:Pi,ERR_STREAM_ALREADY_FINISHED:Mm,ERR_STREAM_NULL_VALUES:Um,ERR_STREAM_WRITE_AFTER_END:Wm,ERR_UNKNOWN_ENCODING:jl}=ie().codes,{errorOrDestroy:ei}=Or;Wl(B.prototype,Ii.prototype);Wl(B,Ii);function No(){}s(No,"nop");var ti=Fm("kOnFinished");function Ci(t,e,i){typeof i!="boolean"&&(i=e instanceof Re()),this.objectMode=!!(t&&t.objectMode),i&&(this.objectMode=this.objectMode||!!(t&&t.writableObjectMode)),this.highWaterMark=t?Lm(this,t,"writableHighWaterMark",i):Rm(!1),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;let r=!!(t&&t.decodeStrings===!1);this.decodeStrings=!r,this.defaultEncoding=t&&t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=jm.bind(void 0,e),this.writecb=null,this.writelen=0,this.afterWriteTickInfo=null,Rr(this),this.pendingcb=0,this.constructed=!0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!t||t.emitClose!==!1,this.autoDestroy=!t||t.autoDestroy!==!1,this.errored=null,this.closed=!1,this.closeEmitted=!1,this[ti]=[]}s(Ci,"WritableState");function Rr(t){t.buffered=[],t.bufferedIndex=0,t.allBuffers=!0,t.allNoop=!0}s(Rr,"resetBuffer");Ci.prototype.getBuffer=s(function(){return Dl(this.buffered,this.bufferedIndex)},"getBuffer");Ul(Ci.prototype,"bufferedRequestCount",{__proto__:null,get(){return this.buffered.length-this.bufferedIndex}});function B(t){let e=this instanceof Re();if(!e&&!Ml(B,this))return new B(t);this._writableState=new Ci(t,this,e),t&&(typeof t.write=="function"&&(this._write=t.write),typeof t.writev=="function"&&(this._writev=t.writev),typeof t.destroy=="function"&&(this._destroy=t.destroy),typeof t.final=="function"&&(this._final=t.final),typeof t.construct=="function"&&(this._construct=t.construct),t.signal&&Cm(t.signal,this)),Ii.call(this,t),Or.construct(this,()=>{let i=this._writableState;i.writing||Fo(this,i),Io(this,i)})}s(B,"Writable");Ul(B,Im,{__proto__:null,value:function(t){return Ml(this,t)?!0:this!==B?!1:t&&t._writableState instanceof Ci}});B.prototype.pipe=function(){ei(this,new Dm)};function $l(t,e,i,r){let n=t._writableState;if(typeof i=="function")r=i,i=n.defaultEncoding;else{if(!i)i=n.defaultEncoding;else if(i!=="buffer"&&!Cr.isEncoding(i))throw new jl(i);typeof r!="function"&&(r=No)}if(e===null)throw new Um;if(!n.objectMode)if(typeof e=="string")n.decodeStrings!==!1&&(e=Cr.from(e,i),i="buffer");else if(e instanceof Cr)i="buffer";else if(Ii._isUint8Array(e))e=Ii._uint8ArrayToBuffer(e),i="buffer";else throw new Om("chunk",["string","Buffer","Uint8Array"],e);let o;return n.ending?o=new Wm:n.destroyed&&(o=new Pi("write")),o?(gt.nextTick(r,o),ei(t,o,!0),o):(n.pendingcb++,qm(t,n,e,i,r))}s($l,"_write");B.prototype.write=function(t,e,i){return $l(this,t,e,i)===!0};B.prototype.cork=function(){this._writableState.corked++};B.prototype.uncork=function(){let t=this._writableState;t.corked&&(t.corked--,t.writing||Fo(this,t))};B.prototype.setDefaultEncoding=s(function(e){if(typeof e=="string"&&(e=Tm(e)),!Cr.isEncoding(e))throw new jl(e);return this._writableState.defaultEncoding=e,this},"setDefaultEncoding");function qm(t,e,i,r,n){let o=e.objectMode?1:i.length;e.length+=o;let a=e.length<e.highWaterMark;return a||(e.needDrain=!0),e.writing||e.corked||e.errored||!e.constructed?(e.buffered.push({chunk:i,encoding:r,callback:n}),e.allBuffers&&r!=="buffer"&&(e.allBuffers=!1),e.allNoop&&n!==No&&(e.allNoop=!1)):(e.writelen=o,e.writecb=n,e.writing=!0,e.sync=!0,t._write(i,r,e.onwrite),e.sync=!1),a&&!e.errored&&!e.destroyed}s(qm,"writeOrBuffer");function Ol(t,e,i,r,n,o,a){e.writelen=r,e.writecb=a,e.writing=!0,e.sync=!0,e.destroyed?e.onwrite(new Pi("write")):i?t._writev(n,e.onwrite):t._write(n,o,e.onwrite),e.sync=!1}s(Ol,"doWrite");function Bl(t,e,i,r){--e.pendingcb,r(i),To(e),ei(t,i)}s(Bl,"onwriteError");function jm(t,e){let i=t._writableState,r=i.sync,n=i.writecb;if(typeof n!="function"){ei(t,new ql);return}i.writing=!1,i.writecb=null,i.length-=i.writelen,i.writelen=0,e?(e.stack,i.errored||(i.errored=e),t._readableState&&!t._readableState.errored&&(t._readableState.errored=e),r?gt.nextTick(Bl,t,i,e,n):Bl(t,i,e,n)):(i.buffered.length>i.bufferedIndex&&Fo(t,i),r?i.afterWriteTickInfo!==null&&i.afterWriteTickInfo.cb===n?i.afterWriteTickInfo.count++:(i.afterWriteTickInfo={count:1,cb:n,stream:t,state:i},gt.nextTick($m,i.afterWriteTickInfo)):zl(t,i,1,n))}s(jm,"onwrite");function $m({stream:t,state:e,count:i,cb:r}){return e.afterWriteTickInfo=null,zl(t,e,i,r)}s($m,"afterWriteTick");function zl(t,e,i,r){for(!e.ending&&!t.destroyed&&e.length===0&&e.needDrain&&(e.needDrain=!1,t.emit("drain"));i-- >0;)e.pendingcb--,r();e.destroyed&&To(e),Io(t,e)}s(zl,"afterWrite");function To(t){if(t.writing)return;for(let n=t.bufferedIndex;n<t.buffered.length;++n){var e;let{chunk:o,callback:a}=t.buffered[n],l=t.objectMode?1:o.length;t.length-=l,a((e=t.errored)!==null&&e!==void 0?e:new Pi("write"))}let i=t[ti].splice(0);for(let n=0;n<i.length;n++){var r;i[n]((r=t.errored)!==null&&r!==void 0?r:new Pi("end"))}Rr(t)}s(To,"errorBuffer");function Fo(t,e){if(e.corked||e.bufferProcessing||e.destroyed||!e.constructed)return;let{buffered:i,bufferedIndex:r,objectMode:n}=e,o=i.length-r;if(!o)return;let a=r;if(e.bufferProcessing=!0,o>1&&t._writev){e.pendingcb-=o-1;let l=e.allNoop?No:f=>{for(let d=a;d<i.length;++d)i[d].callback(f)},u=e.allNoop&&a===0?i:Dl(i,a);u.allBuffers=e.allBuffers,Ol(t,e,!0,e.length,u,"",l),Rr(e)}else{do{let{chunk:l,encoding:u,callback:f}=i[a];i[a++]=null;let d=n?1:l.length;Ol(t,e,!1,d,l,u,f)}while(a<i.length&&!e.writing);a===i.length?Rr(e):a>256?(i.splice(0,a),e.bufferedIndex=0):e.bufferedIndex=a}e.bufferProcessing=!1}s(Fo,"clearBuffer");B.prototype._write=function(t,e,i){if(this._writev)this._writev([{chunk:t,encoding:e}],i);else throw new Bm("_write()")};B.prototype._writev=null;B.prototype.end=function(t,e,i){let r=this._writableState;typeof t=="function"?(i=t,t=null,e=null):typeof e=="function"&&(i=e,e=null);let n;if(t!=null){let o=$l(this,t,e);o instanceof km&&(n=o)}return r.corked&&(r.corked=1,this.uncork()),n||(!r.errored&&!r.ending?(r.ending=!0,Io(this,r,!0),r.ended=!0):r.finished?n=new Mm("end"):r.destroyed&&(n=new Pi("end"))),typeof i=="function"&&(n||r.finished?gt.nextTick(i,n):r[ti].push(i)),this};function Lr(t){return t.ending&&!t.destroyed&&t.constructed&&t.length===0&&!t.errored&&t.buffered.length===0&&!t.finished&&!t.writing&&!t.errorEmitted&&!t.closeEmitted}s(Lr,"needFinish");function zm(t,e){let i=!1;function r(n){if(i){ei(t,n??ql());return}if(i=!0,e.pendingcb--,n){let o=e[ti].splice(0);for(let a=0;a<o.length;a++)o[a](n);ei(t,n,e.sync)}else Lr(e)&&(e.prefinished=!0,t.emit("prefinish"),e.pendingcb++,gt.nextTick(ko,t,e))}s(r,"onFinish"),e.sync=!0,e.pendingcb++;try{t._final(r)}catch(n){r(n)}e.sync=!1}s(zm,"callFinal");function Vm(t,e){!e.prefinished&&!e.finalCalled&&(typeof t._final=="function"&&!e.destroyed?(e.finalCalled=!0,zm(t,e)):(e.prefinished=!0,t.emit("prefinish")))}s(Vm,"prefinish");function Io(t,e,i){Lr(e)&&(Vm(t,e),e.pendingcb===0&&(i?(e.pendingcb++,gt.nextTick((r,n)=>{Lr(n)?ko(r,n):n.pendingcb--},t,e)):Lr(e)&&(e.pendingcb++,ko(t,e))))}s(Io,"finishMaybe");function ko(t,e){e.pendingcb--,e.finished=!0;let i=e[ti].splice(0);for(let r=0;r<i.length;r++)i[r]();if(t.emit("finish"),e.autoDestroy){let r=t._readableState;(!r||r.autoDestroy&&(r.endEmitted||r.readable===!1))&&t.destroy()}}s(ko,"finish");Nm(B.prototype,{closed:{__proto__:null,get(){return this._writableState?this._writableState.closed:!1}},destroyed:{__proto__:null,get(){return this._writableState?this._writableState.destroyed:!1},set(t){this._writableState&&(this._writableState.destroyed=t)}},writable:{__proto__:null,get(){let t=this._writableState;return!!t&&t.writable!==!1&&!t.destroyed&&!t.errored&&!t.ending&&!t.ended},set(t){this._writableState&&(this._writableState.writable=!!t)}},writableFinished:{__proto__:null,get(){return this._writableState?this._writableState.finished:!1}},writableObjectMode:{__proto__:null,get(){return this._writableState?this._writableState.objectMode:!1}},writableBuffer:{__proto__:null,get(){return this._writableState&&this._writableState.getBuffer()}},writableEnded:{__proto__:null,get(){return this._writableState?this._writableState.ending:!1}},writableNeedDrain:{__proto__:null,get(){let t=this._writableState;return t?!t.destroyed&&!t.ending&&t.needDrain:!1}},writableHighWaterMark:{__proto__:null,get(){return this._writableState&&this._writableState.highWaterMark}},writableCorked:{__proto__:null,get(){return this._writableState?this._writableState.corked:0}},writableLength:{__proto__:null,get(){return this._writableState&&this._writableState.length}},errored:{__proto__:null,enumerable:!1,get(){return this._writableState?this._writableState.errored:null}},writableAborted:{__proto__:null,enumerable:!1,get:function(){return!!(this._writableState.writable!==!1&&(this._writableState.destroyed||this._writableState.errored)&&!this._writableState.finished)}}});var Hm=Or.destroy;B.prototype.destroy=function(t,e){let i=this._writableState;return!i.destroyed&&(i.bufferedIndex<i.buffered.length||i[ti].length)&>.nextTick(To,i),Hm.call(this,t,e),this};B.prototype._undestroy=Or.undestroy;B.prototype._destroy=function(t,e){e(t)};B.prototype[Pm.captureRejectionSymbol]=function(t){this.destroy(t)};var Ao;function Vl(){return Ao===void 0&&(Ao={}),Ao}s(Vl,"lazyWebStreams");B.fromWeb=function(t,e){return Vl().newStreamWritableFromWritableStream(t,e)};B.toWeb=function(t){return Vl().newWritableStreamFromStreamWritable(t)}});var ac=N((ZS,sc)=>{var Po=tt(),Km=Me(),{isReadable:Ym,isWritable:Gm,isIterable:Kl,isNodeStream:Xm,isReadableNodeStream:Yl,isWritableNodeStream:Gl,isDuplexNodeStream:Jm,isReadableStream:Xl,isWritableStream:Jl}=Pe(),Ql=qe(),{AbortError:nc,codes:{ERR_INVALID_ARG_TYPE:Qm,ERR_INVALID_RETURN_VALUE:Zl}}=ie(),{destroyer:ri}=yt(),Zm=Re(),oc=Fi(),eb=Br(),{createDeferredPromise:ec}=Z(),tc=mo(),ic=globalThis.Blob||Km.Blob,tb=s(typeof ic<"u"?function(e){return e instanceof ic}:function(e){return!1},"isBlob"),ib=globalThis.AbortController||Vt().AbortController,{FunctionPrototypeCall:rc}=O(),je=class extends Zm{constructor(e){super(e),e?.readable===!1&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),e?.writable===!1&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)}};s(je,"Duplexify");sc.exports=s(function t(e,i){if(Jm(e))return e;if(Yl(e))return ii({readable:e});if(Gl(e))return ii({writable:e});if(Xm(e))return ii({writable:!1,readable:!1});if(Xl(e))return ii({readable:oc.fromWeb(e)});if(Jl(e))return ii({writable:eb.fromWeb(e)});if(typeof e=="function"){let{value:n,write:o,final:a,destroy:l}=rb(e);if(Kl(n))return tc(je,n,{objectMode:!0,write:o,final:a,destroy:l});let u=n?.then;if(typeof u=="function"){let f,d=rc(u,n,h=>{if(h!=null)throw new Zl("nully","body",h)},h=>{ri(f,h)});return f=new je({objectMode:!0,readable:!1,write:o,final(h){a(async()=>{try{await d,Po.nextTick(h,null)}catch(b){Po.nextTick(h,b)}})},destroy:l})}throw new Zl("Iterable, AsyncIterable or AsyncFunction",i,n)}if(tb(e))return t(e.arrayBuffer());if(Kl(e))return tc(je,e,{objectMode:!0,writable:!1});if(Xl(e?.readable)&&Jl(e?.writable))return je.fromWeb(e);if(typeof e?.writable=="object"||typeof e?.readable=="object"){let n=e!=null&&e.readable?Yl(e?.readable)?e?.readable:t(e.readable):void 0,o=e!=null&&e.writable?Gl(e?.writable)?e?.writable:t(e.writable):void 0;return ii({readable:n,writable:o})}let r=e?.then;if(typeof r=="function"){let n;return rc(r,e,o=>{o!=null&&n.push(o),n.push(null)},o=>{ri(n,o)}),n=new je({objectMode:!0,writable:!1,read(){}})}throw new Qm(i,["Blob","ReadableStream","WritableStream","Stream","Iterable","AsyncIterable","Function","{ readable, writable } pair","Promise"],e)},"duplexify");function rb(t){let{promise:e,resolve:i}=ec(),r=new ib,n=r.signal;return{value:t(async function*(){for(;;){let a=e;e=null;let{chunk:l,done:u,cb:f}=await a;if(Po.nextTick(f),u)return;if(n.aborted)throw new nc(void 0,{cause:n.reason});({promise:e,resolve:i}=ec()),yield l}}(),{signal:n}),write(a,l,u){let f=i;i=null,f({chunk:a,done:!1,cb:u})},final(a){let l=i;i=null,l({done:!0,cb:a})},destroy(a,l){r.abort(),l(a)}}}s(rb,"fromAsyncGen");function ii(t){let e=t.readable&&typeof t.readable.read!="function"?oc.wrap(t.readable):t.readable,i=t.writable,r=!!Ym(e),n=!!Gm(i),o,a,l,u,f;function d(h){let b=u;u=null,b?b(h):h&&f.destroy(h)}return s(d,"onfinished"),f=new je({readableObjectMode:!!(e!=null&&e.readableObjectMode),writableObjectMode:!!(i!=null&&i.writableObjectMode),readable:r,writable:n}),n&&(Ql(i,h=>{n=!1,h&&ri(e,h),d(h)}),f._write=function(h,b,m){i.write(h,b)?m():o=m},f._final=function(h){i.end(),a=h},i.on("drain",function(){if(o){let h=o;o=null,h()}}),i.on("finish",function(){if(a){let h=a;a=null,h()}})),r&&(Ql(e,h=>{r=!1,h&&ri(e,h),d(h)}),e.on("readable",function(){if(l){let h=l;l=null,h()}}),e.on("end",function(){f.push(null)}),f._read=function(){for(;;){let h=e.read();if(h===null){l=f._read;return}if(!f.push(h))return}}),f._destroy=function(h,b){!h&&u!==null&&(h=new nc),l=null,o=null,a=null,u===null?b(h):(u=b,ri(i,h),ri(e,h))},f}s(ii,"_duplexify")});var Re=N((t_,uc)=>{"use strict";var{ObjectDefineProperties:nb,ObjectGetOwnPropertyDescriptor:$e,ObjectKeys:ob,ObjectSetPrototypeOf:lc}=O();uc.exports=xe;var Ro=Fi(),be=Br();lc(xe.prototype,Ro.prototype);lc(xe,Ro);{let t=ob(be.prototype);for(let e=0;e<t.length;e++){let i=t[e];xe.prototype[i]||(xe.prototype[i]=be.prototype[i])}}function xe(t){if(!(this instanceof xe))return new xe(t);Ro.call(this,t),be.call(this,t),t?(this.allowHalfOpen=t.allowHalfOpen!==!1,t.readable===!1&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),t.writable===!1&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)):this.allowHalfOpen=!0}s(xe,"Duplex");nb(xe.prototype,{writable:{__proto__:null,...$e(be.prototype,"writable")},writableHighWaterMark:{__proto__:null,...$e(be.prototype,"writableHighWaterMark")},writableObjectMode:{__proto__:null,...$e(be.prototype,"writableObjectMode")},writableBuffer:{__proto__:null,...$e(be.prototype,"writableBuffer")},writableLength:{__proto__:null,...$e(be.prototype,"writableLength")},writableFinished:{__proto__:null,...$e(be.prototype,"writableFinished")},writableCorked:{__proto__:null,...$e(be.prototype,"writableCorked")},writableEnded:{__proto__:null,...$e(be.prototype,"writableEnded")},writableNeedDrain:{__proto__:null,...$e(be.prototype,"writableNeedDrain")},destroyed:{__proto__:null,get(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set(t){this._readableState&&this._writableState&&(this._readableState.destroyed=t,this._writableState.destroyed=t)}}});var Co;function cc(){return Co===void 0&&(Co={}),Co}s(cc,"lazyWebStreams");xe.fromWeb=function(t,e){return cc().newStreamDuplexFromReadableWritablePair(t,e)};xe.toWeb=function(t){return cc().newReadableWritablePairFromDuplex(t)};var Lo;xe.from=function(t){return Lo||(Lo=ac()),Lo(t,"body")}});var Do=N((r_,dc)=>{"use strict";var{ObjectSetPrototypeOf:fc,Symbol:sb}=O();dc.exports=ze;var{ERR_METHOD_NOT_IMPLEMENTED:ab}=ie().codes,Bo=Re(),{getHighWaterMark:lb}=ki();fc(ze.prototype,Bo.prototype);fc(ze,Bo);var Li=sb("kCallback");function ze(t){if(!(this instanceof ze))return new ze(t);let e=t?lb(this,t,"readableHighWaterMark",!0):null;e===0&&(t={...t,highWaterMark:null,readableHighWaterMark:e,writableHighWaterMark:t.writableHighWaterMark||0}),Bo.call(this,t),this._readableState.sync=!1,this[Li]=null,t&&(typeof t.transform=="function"&&(this._transform=t.transform),typeof t.flush=="function"&&(this._flush=t.flush)),this.on("prefinish",cb)}s(ze,"Transform");function Oo(t){typeof this._flush=="function"&&!this.destroyed?this._flush((e,i)=>{if(e){t?t(e):this.destroy(e);return}i!=null&&this.push(i),this.push(null),t&&t()}):(this.push(null),t&&t())}s(Oo,"final");function cb(){this._final!==Oo&&Oo.call(this)}s(cb,"prefinish");ze.prototype._final=Oo;ze.prototype._transform=function(t,e,i){throw new ab("_transform()")};ze.prototype._write=function(t,e,i){let r=this._readableState,n=this._writableState,o=r.length;this._transform(t,e,(a,l)=>{if(a){i(a);return}l!=null&&this.push(l),n.ended||o===r.length||r.length<r.highWaterMark?i():this[Li]=i})};ze.prototype._read=function(){if(this[Li]){let t=this[Li];this[Li]=null,t()}}});var Uo=N((o_,pc)=>{"use strict";var{ObjectSetPrototypeOf:hc}=O();pc.exports=ni;var Mo=Do();hc(ni.prototype,Mo.prototype);hc(ni,Mo);function ni(t){if(!(this instanceof ni))return new ni(t);Mo.call(this,t)}s(ni,"PassThrough");ni.prototype._transform=function(t,e,i){i(null,t)}});var Wr=N((a_,wc)=>{var Ri=tt(),{ArrayIsArray:ub,Promise:fb,SymbolAsyncIterator:db,SymbolDispose:hb}=O(),Ur=qe(),{once:pb}=Z(),yb=yt(),yc=Re(),{aggregateTwoErrors:mb,codes:{ERR_INVALID_ARG_TYPE:Yo,ERR_INVALID_RETURN_VALUE:Wo,ERR_MISSING_ARGS:bb,ERR_STREAM_DESTROYED:gb,ERR_STREAM_PREMATURE_CLOSE:wb},AbortError:Sb}=ie(),{validateFunction:_b,validateAbortSignal:Eb}=Yt(),{isIterable:wt,isReadable:qo,isReadableNodeStream:Mr,isNodeStream:mc,isTransformStream:oi,isWebStream:xb,isReadableStream:jo,isReadableFinished:vb}=Pe(),Ab=globalThis.AbortController||Vt().AbortController,$o,zo,Vo;function bc(t,e,i){let r=!1;t.on("close",()=>{r=!0});let n=Ur(t,{readable:e,writable:i},o=>{r=!o});return{destroy:o=>{r||(r=!0,yb.destroyer(t,o||new gb("pipe")))},cleanup:n}}s(bc,"destroyer");function kb(t){return _b(t[t.length-1],"streams[stream.length - 1]"),t.pop()}s(kb,"popCallback");function Ho(t){if(wt(t))return t;if(Mr(t))return Nb(t);throw new Yo("val",["Readable","Iterable","AsyncIterable"],t)}s(Ho,"makeAsyncIterable");async function*Nb(t){zo||(zo=Fi()),yield*zo.prototype[db].call(t)}s(Nb,"fromReadable");async function Dr(t,e,i,{end:r}){let n,o=null,a=s(f=>{if(f&&(n=f),o){let d=o;o=null,d()}},"resume"),l=s(()=>new fb((f,d)=>{n?d(n):o=s(()=>{n?d(n):f()},"onresolve")}),"wait");e.on("drain",a);let u=Ur(e,{readable:!1},a);try{e.writableNeedDrain&&await l();for await(let f of t)e.write(f)||await l();r&&(e.end(),await l()),i()}catch(f){i(n!==f?mb(n,f):f)}finally{u(),e.off("drain",a)}}s(Dr,"pumpToNode");async function Ko(t,e,i,{end:r}){oi(e)&&(e=e.writable);let n=e.getWriter();try{for await(let o of t)await n.ready,n.write(o).catch(()=>{});await n.ready,r&&await n.close(),i()}catch(o){try{await n.abort(o),i(o)}catch(a){i(a)}}}s(Ko,"pumpToWeb");function Tb(...t){return gc(t,pb(kb(t)))}s(Tb,"pipeline");function gc(t,e,i){if(t.length===1&&ub(t[0])&&(t=t[0]),t.length<2)throw new bb("streams");let r=new Ab,n=r.signal,o=i?.signal,a=[];Eb(o,"options.signal");function l(){g(new Sb)}s(l,"abort"),Vo=Vo||Z().addAbortListener;let u;o&&(u=Vo(o,l));let f,d,h=[],b=0;function m(D){g(D,--b===0)}s(m,"finish");function g(D,A){var $;if(D&&(!f||f.code==="ERR_STREAM_PREMATURE_CLOSE")&&(f=D),!(!f&&!A)){for(;h.length;)h.shift()(f);($=u)===null||$===void 0||$[hb](),r.abort(),A&&(f||a.forEach(nt=>nt()),Ri.nextTick(e,f,d))}}s(g,"finishImpl");let y;for(let D=0;D<t.length;D++){let A=t[D],$=D<t.length-1,nt=D>0,ue=$||i?.end!==!1,vt=D===t.length-1;if(mc(A)){let re=function(Be){Be&&Be.name!=="AbortError"&&Be.code!=="ERR_STREAM_PREMATURE_CLOSE"&&m(Be)};var F=re;if(s(re,"onError"),ue){let{destroy:Be,cleanup:nn}=bc(A,$,nt);h.push(Be),qo(A)&&vt&&a.push(nn)}A.on("error",re),qo(A)&&vt&&a.push(()=>{A.removeListener("error",re)})}if(D===0)if(typeof A=="function"){if(y=A({signal:n}),!wt(y))throw new Wo("Iterable, AsyncIterable or Stream","source",y)}else wt(A)||Mr(A)||oi(A)?y=A:y=yc.from(A);else if(typeof A=="function"){if(oi(y)){var k;y=Ho((k=y)===null||k===void 0?void 0:k.readable)}else y=Ho(y);if(y=A(y,{signal:n}),$){if(!wt(y,!0))throw new Wo("AsyncIterable",`transform[${D-1}]`,y)}else{var w;$o||($o=Uo());let re=new $o({objectMode:!0}),Be=(w=y)===null||w===void 0?void 0:w.then;if(typeof Be=="function")b++,Be.call(y,Ke=>{d=Ke,Ke!=null&&re.write(Ke),ue&&re.end(),Ri.nextTick(m)},Ke=>{re.destroy(Ke),Ri.nextTick(m,Ke)});else if(wt(y,!0))b++,Dr(y,re,m,{end:ue});else if(jo(y)||oi(y)){let Ke=y.readable||y;b++,Dr(Ke,re,m,{end:ue})}else throw new Wo("AsyncIterable or Promise","destination",y);y=re;let{destroy:nn,cleanup:Gc}=bc(y,!1,!0);h.push(nn),vt&&a.push(Gc)}}else if(mc(A)){if(Mr(y)){b+=2;let re=Fb(y,A,m,{end:ue});qo(A)&&vt&&a.push(re)}else if(oi(y)||jo(y)){let re=y.readable||y;b++,Dr(re,A,m,{end:ue})}else if(wt(y))b++,Dr(y,A,m,{end:ue});else throw new Yo("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],y);y=A}else if(xb(A)){if(Mr(y))b++,Ko(Ho(y),A,m,{end:ue});else if(jo(y)||wt(y))b++,Ko(y,A,m,{end:ue});else if(oi(y))b++,Ko(y.readable,A,m,{end:ue});else throw new Yo("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],y);y=A}else y=yc.from(A)}return(n!=null&&n.aborted||o!=null&&o.aborted)&&Ri.nextTick(l),y}s(gc,"pipelineImpl");function Fb(t,e,i,{end:r}){let n=!1;if(e.on("close",()=>{n||i(new wb)}),t.pipe(e,{end:!1}),r){let a=function(){n=!0,e.end()};var o=a;s(a,"endFn"),vb(t)?Ri.nextTick(a):t.once("end",a)}else i();return Ur(t,{readable:!0,writable:!1},a=>{let l=t._readableState;a&&a.code==="ERR_STREAM_PREMATURE_CLOSE"&&l&&l.ended&&!l.errored&&!l.errorEmitted?t.once("end",i).once("error",i):i(a)}),Ur(e,{readable:!1,writable:!0},i)}s(Fb,"pipe");wc.exports={pipelineImpl:gc,pipeline:Tb}});var Xo=N((c_,Ac)=>{"use strict";var{pipeline:Ib}=Wr(),qr=Re(),{destroyer:Pb}=yt(),{isNodeStream:jr,isReadable:Sc,isWritable:_c,isWebStream:Go,isTransformStream:St,isWritableStream:Ec,isReadableStream:xc}=Pe(),{AbortError:Cb,codes:{ERR_INVALID_ARG_VALUE:vc,ERR_MISSING_ARGS:Lb}}=ie(),Rb=qe();Ac.exports=s(function(...e){if(e.length===0)throw new Lb("streams");if(e.length===1)return qr.from(e[0]);let i=[...e];if(typeof e[0]=="function"&&(e[0]=qr.from(e[0])),typeof e[e.length-1]=="function"){let m=e.length-1;e[m]=qr.from(e[m])}for(let m=0;m<e.length;++m)if(!(!jr(e[m])&&!Go(e[m]))){if(m<e.length-1&&!(Sc(e[m])||xc(e[m])||St(e[m])))throw new vc(`streams[${m}]`,i[m],"must be readable");if(m>0&&!(_c(e[m])||Ec(e[m])||St(e[m])))throw new vc(`streams[${m}]`,i[m],"must be writable")}let r,n,o,a,l;function u(m){let g=a;a=null,g?g(m):m?l.destroy(m):!b&&!h&&l.destroy()}s(u,"onfinished");let f=e[0],d=Ib(e,u),h=!!(_c(f)||Ec(f)||St(f)),b=!!(Sc(d)||xc(d)||St(d));if(l=new qr({writableObjectMode:!!(f!=null&&f.writableObjectMode),readableObjectMode:!!(d!=null&&d.readableObjectMode),writable:h,readable:b}),h){if(jr(f))l._write=function(g,y,k){f.write(g,y)?k():r=k},l._final=function(g){f.end(),n=g},f.on("drain",function(){if(r){let g=r;r=null,g()}});else if(Go(f)){let y=(St(f)?f.writable:f).getWriter();l._write=async function(k,w,F){try{await y.ready,y.write(k).catch(()=>{}),F()}catch(D){F(D)}},l._final=async function(k){try{await y.ready,y.close().catch(()=>{}),n=k}catch(w){k(w)}}}let m=St(d)?d.readable:d;Rb(m,()=>{if(n){let g=n;n=null,g()}})}if(b){if(jr(d))d.on("readable",function(){if(o){let m=o;o=null,m()}}),d.on("end",function(){l.push(null)}),l._read=function(){for(;;){let m=d.read();if(m===null){o=l._read;return}if(!l.push(m))return}};else if(Go(d)){let g=(St(d)?d.readable:d).getReader();l._read=async function(){for(;;)try{let{value:y,done:k}=await g.read();if(!l.push(y))return;if(k){l.push(null);return}}catch{return}}}}return l._destroy=function(m,g){!m&&a!==null&&(m=new Cb),o=null,r=null,n=null,a===null?g(m):(a=g,jr(d)&&Pb(d,m))},l},"compose")});var Oc=N((f_,Qo)=>{"use strict";var Ob=globalThis.AbortController||Vt().AbortController,{codes:{ERR_INVALID_ARG_VALUE:Bb,ERR_INVALID_ARG_TYPE:Oi,ERR_MISSING_ARGS:Db,ERR_OUT_OF_RANGE:Mb},AbortError:Oe}=ie(),{validateAbortSignal:_t,validateInteger:kc,validateObject:Et}=Yt(),Ub=O().Symbol("kWeak"),Wb=O().Symbol("kResistStopPropagation"),{finished:qb}=qe(),jb=Xo(),{addAbortSignalNoValidate:$b}=Ai(),{isWritable:zb,isNodeStream:Vb}=Pe(),{deprecate:Hb}=Z(),{ArrayPrototypePush:Kb,Boolean:Yb,MathFloor:Nc,Number:Gb,NumberIsNaN:Xb,Promise:Tc,PromiseReject:Fc,PromiseResolve:Jb,PromisePrototypeThen:Ic,Symbol:Cc}=O(),zr=Cc("kEmpty"),Pc=Cc("kEof");function Qb(t,e){if(e!=null&&Et(e,"options"),e?.signal!=null&&_t(e.signal,"options.signal"),Vb(t)&&!zb(t))throw new Bb("stream",t,"must be writable");let i=jb(this,t);return e!=null&&e.signal&&$b(e.signal,i),i}s(Qb,"compose");function Vr(t,e){if(typeof t!="function")throw new Oi("fn",["Function","AsyncFunction"],t);e!=null&&Et(e,"options"),e?.signal!=null&&_t(e.signal,"options.signal");let i=1;e?.concurrency!=null&&(i=Nc(e.concurrency));let r=i-1;return e?.highWaterMark!=null&&(r=Nc(e.highWaterMark)),kc(i,"options.concurrency",1),kc(r,"options.highWaterMark",0),r+=i,s(async function*(){let o=Z().AbortSignalAny([e?.signal].filter(Yb)),a=this,l=[],u={signal:o},f,d,h=!1,b=0;function m(){h=!0,g()}s(m,"onCatch");function g(){b-=1,y()}s(g,"afterItemProcessed");function y(){d&&!h&&b<i&&l.length<r&&(d(),d=null)}s(y,"maybeResume");async function k(){try{for await(let w of a){if(h)return;if(o.aborted)throw new Oe;try{if(w=t(w,u),w===zr)continue;w=Jb(w)}catch(F){w=Fc(F)}b+=1,Ic(w,g,m),l.push(w),f&&(f(),f=null),!h&&(l.length>=r||b>=i)&&await new Tc(F=>{d=F})}l.push(Pc)}catch(w){let F=Fc(w);Ic(F,g,m),l.push(F)}finally{h=!0,f&&(f(),f=null)}}s(k,"pump"),k();try{for(;;){for(;l.length>0;){let w=await l[0];if(w===Pc)return;if(o.aborted)throw new Oe;w!==zr&&(yield w),l.shift(),y()}await new Tc(w=>{f=w})}}finally{h=!0,d&&(d(),d=null)}},"map").call(this)}s(Vr,"map");function Zb(t=void 0){return t!=null&&Et(t,"options"),t?.signal!=null&&_t(t.signal,"options.signal"),s(async function*(){let i=0;for await(let n of this){var r;if(t!=null&&(r=t.signal)!==null&&r!==void 0&&r.aborted)throw new Oe({cause:t.signal.reason});yield[i++,n]}},"asIndexedPairs").call(this)}s(Zb,"asIndexedPairs");async function Lc(t,e=void 0){for await(let i of Jo.call(this,t,e))return!0;return!1}s(Lc,"some");async function eg(t,e=void 0){if(typeof t!="function")throw new Oi("fn",["Function","AsyncFunction"],t);return!await Lc.call(this,async(...i)=>!await t(...i),e)}s(eg,"every");async function tg(t,e){for await(let i of Jo.call(this,t,e))return i}s(tg,"find");async function ig(t,e){if(typeof t!="function")throw new Oi("fn",["Function","AsyncFunction"],t);async function i(r,n){return await t(r,n),zr}s(i,"forEachFn");for await(let r of Vr.call(this,i,e));}s(ig,"forEach");function Jo(t,e){if(typeof t!="function")throw new Oi("fn",["Function","AsyncFunction"],t);async function i(r,n){return await t(r,n)?r:zr}return s(i,"filterFn"),Vr.call(this,i,e)}s(Jo,"filter");var $r=class extends Db{constructor(){super("reduce"),this.message="Reduce of an empty stream requires an initial value"}};s($r,"ReduceAwareErrMissingArgs");async function rg(t,e,i){var r;if(typeof t!="function")throw new Oi("reducer",["Function","AsyncFunction"],t);i!=null&&Et(i,"options"),i?.signal!=null&&_t(i.signal,"options.signal");let n=arguments.length>1;if(i!=null&&(r=i.signal)!==null&&r!==void 0&&r.aborted){let f=new Oe(void 0,{cause:i.signal.reason});throw this.once("error",()=>{}),await qb(this.destroy(f)),f}let o=new Ob,a=o.signal;if(i!=null&&i.signal){let f={once:!0,[Ub]:this,[Wb]:!0};i.signal.addEventListener("abort",()=>o.abort(),f)}let l=!1;try{for await(let f of this){var u;if(l=!0,i!=null&&(u=i.signal)!==null&&u!==void 0&&u.aborted)throw new Oe;n?e=await t(e,f,{signal:a}):(e=f,n=!0)}if(!l&&!n)throw new $r}finally{o.abort()}return e}s(rg,"reduce");async function ng(t){t!=null&&Et(t,"options"),t?.signal!=null&&_t(t.signal,"options.signal");let e=[];for await(let r of this){var i;if(t!=null&&(i=t.signal)!==null&&i!==void 0&&i.aborted)throw new Oe(void 0,{cause:t.signal.reason});Kb(e,r)}return e}s(ng,"toArray");function og(t,e){let i=Vr.call(this,t,e);return s(async function*(){for await(let n of i)yield*n},"flatMap").call(this)}s(og,"flatMap");function Rc(t){if(t=Gb(t),Xb(t))return 0;if(t<0)throw new Mb("number",">= 0",t);return t}s(Rc,"toIntegerOrInfinity");function sg(t,e=void 0){return e!=null&&Et(e,"options"),e?.signal!=null&&_t(e.signal,"options.signal"),t=Rc(t),s(async function*(){var r;if(e!=null&&(r=e.signal)!==null&&r!==void 0&&r.aborted)throw new Oe;for await(let o of this){var n;if(e!=null&&(n=e.signal)!==null&&n!==void 0&&n.aborted)throw new Oe;t--<=0&&(yield o)}},"drop").call(this)}s(sg,"drop");function ag(t,e=void 0){return e!=null&&Et(e,"options"),e?.signal!=null&&_t(e.signal,"options.signal"),t=Rc(t),s(async function*(){var r;if(e!=null&&(r=e.signal)!==null&&r!==void 0&&r.aborted)throw new Oe;for await(let o of this){var n;if(e!=null&&(n=e.signal)!==null&&n!==void 0&&n.aborted)throw new Oe;if(t-- >0&&(yield o),t<=0)return}},"take").call(this)}s(ag,"take");Qo.exports.streamReturningOperators={asIndexedPairs:Hb(Zb,"readable.asIndexedPairs will be removed in a future version."),drop:sg,filter:Jo,flatMap:og,map:Vr,take:ag,compose:Qb};Qo.exports.promiseReturningOperators={every:eg,forEach:ig,reduce:rg,toArray:ng,some:Lc,find:tg}});var Zo=N((h_,Bc)=>{"use strict";var{ArrayPrototypePop:lg,Promise:cg}=O(),{isIterable:ug,isNodeStream:fg,isWebStream:dg}=Pe(),{pipelineImpl:hg}=Wr(),{finished:pg}=qe();es();function yg(...t){return new cg((e,i)=>{let r,n,o=t[t.length-1];if(o&&typeof o=="object"&&!fg(o)&&!ug(o)&&!dg(o)){let a=lg(t);r=a.signal,n=a.end}hg(t,(a,l)=>{a?i(a):e(l)},{signal:r,end:n})})}s(yg,"pipeline");Bc.exports={finished:pg,pipeline:yg}});var es=N((y_,Vc)=>{var{Buffer:mg}=Me(),{ObjectDefineProperty:Ve,ObjectKeys:Uc,ReflectApply:Wc}=O(),{promisify:{custom:qc}}=Z(),{streamReturningOperators:Dc,promiseReturningOperators:Mc}=Oc(),{codes:{ERR_ILLEGAL_CONSTRUCTOR:jc}}=ie(),bg=Xo(),{setDefaultHighWaterMark:gg,getDefaultHighWaterMark:wg}=ki(),{pipeline:$c}=Wr(),{destroyer:Sg}=yt(),zc=qe(),ts=Zo(),Bi=Pe(),L=Vc.exports=xr().Stream;L.isDestroyed=Bi.isDestroyed;L.isDisturbed=Bi.isDisturbed;L.isErrored=Bi.isErrored;L.isReadable=Bi.isReadable;L.isWritable=Bi.isWritable;L.Readable=Fi();for(let t of Uc(Dc)){let i=function(...r){if(new.target)throw jc();return L.Readable.from(Wc(e,this,r))};Eg=i,s(i,"fn");let e=Dc[t];Ve(i,"name",{__proto__:null,value:e.name}),Ve(i,"length",{__proto__:null,value:e.length}),Ve(L.Readable.prototype,t,{__proto__:null,value:i,enumerable:!1,configurable:!0,writable:!0})}var Eg;for(let t of Uc(Mc)){let i=function(...n){if(new.target)throw jc();return Wc(e,this,n)};Eg=i,s(i,"fn");let e=Mc[t];Ve(i,"name",{__proto__:null,value:e.name}),Ve(i,"length",{__proto__:null,value:e.length}),Ve(L.Readable.prototype,t,{__proto__:null,value:i,enumerable:!1,configurable:!0,writable:!0})}var Eg;L.Writable=Br();L.Duplex=Re();L.Transform=Do();L.PassThrough=Uo();L.pipeline=$c;var{addAbortSignal:_g}=Ai();L.addAbortSignal=_g;L.finished=zc;L.destroy=Sg;L.compose=bg;L.setDefaultHighWaterMark=gg;L.getDefaultHighWaterMark=wg;Ve(L,"promises",{__proto__:null,configurable:!0,enumerable:!0,get(){return ts}});Ve($c,qc,{__proto__:null,enumerable:!0,get(){return ts.pipeline}});Ve(zc,qc,{__proto__:null,enumerable:!0,get(){return ts.finished}});L.Stream=L;L._isUint8Array=s(function(e){return e instanceof Uint8Array},"isUint8Array");L._uint8ArrayToBuffer=s(function(e){return mg.from(e.buffer,e.byteOffset,e.byteLength)},"_uint8ArrayToBuffer")});var Hc=N((b_,j)=>{"use strict";var H=es(),xg=Zo(),vg=H.Readable.destroy;j.exports=H.Readable;j.exports._uint8ArrayToBuffer=H._uint8ArrayToBuffer;j.exports._isUint8Array=H._isUint8Array;j.exports.isDisturbed=H.isDisturbed;j.exports.isErrored=H.isErrored;j.exports.isReadable=H.isReadable;j.exports.Readable=H.Readable;j.exports.Writable=H.Writable;j.exports.Duplex=H.Duplex;j.exports.Transform=H.Transform;j.exports.PassThrough=H.PassThrough;j.exports.addAbortSignal=H.addAbortSignal;j.exports.finished=H.finished;j.exports.destroy=H.destroy;j.exports.destroy=vg;j.exports.pipeline=H.pipeline;j.exports.compose=H.compose;Object.defineProperty(H,"promises",{configurable:!0,enumerable:!0,get(){return xg}});j.exports.Stream=H.Stream;j.exports.default=j.exports});var Fg={};qi(Fg,{ActionType:()=>Gi,ApiError:()=>c,Async:()=>pi,AsyncFile:()=>li,AsyncFileIndexFS:()=>rn,AsyncMirror:()=>is,AsyncStoreFS:()=>en,BigIntStats:()=>X,Cred:()=>z,ErrorCode:()=>Y,ErrorStrings:()=>on,File:()=>hi,FileFlag:()=>I,FileIndex:()=>xt,FileIndexFS:()=>ui,FileSystem:()=>J,FileType:()=>C,InMemory:()=>bi,IndexDirInode:()=>He,IndexFileInode:()=>Wi,IndexInode:()=>ci,Inode:()=>de,NoSyncFile:()=>ot,Overlay:()=>ns,PreloadFile:()=>ne,Readonly:()=>an,SimpleSyncRWTransaction:()=>Lt,Stats:()=>M,StatsCommon:()=>It,Sync:()=>st,SyncFile:()=>Yi,SyncFileIndexFS:()=>tn,SyncStoreFS:()=>Rt,SyncStoreFile:()=>mi,backends:()=>Qr,configure:()=>Ng,decode:()=>te,decodeDirListing:()=>yi,default:()=>Tg,encode:()=>U,encodeDirListing:()=>ae,fs:()=>Gr,initialize:()=>Yc,levenshtein:()=>ln,mkdirpSync:()=>fs,randomIno:()=>Ct,registerBackend:()=>Kc,rootIno:()=>he,setImmediate:()=>Mu,size_max:()=>Ki,toPromise:()=>Du,wait:()=>Bu});var Gr={};qi(Gr,{BigIntStats:()=>X,Dir:()=>tr,Dirent:()=>Ze,ReadStream:()=>Hr,Stats:()=>M,WriteStream:()=>Kr,_toUnixTimestamp:()=>hs,access:()=>ud,accessSync:()=>cf,appendFile:()=>Wf,appendFileSync:()=>Vu,chmod:()=>od,chmodSync:()=>of,chown:()=>rd,chownSync:()=>rf,close:()=>jf,closeSync:()=>Qe,constants:()=>di,copyFile:()=>gd,copyFileSync:()=>df,createReadStream:()=>pd,createWriteStream:()=>yd,exists:()=>Cf,existsSync:()=>un,fchmod:()=>Gf,fchmodSync:()=>yn,fchown:()=>Yf,fchownSync:()=>pn,fdatasync:()=>Vf,fdatasyncSync:()=>Yu,fstat:()=>qf,fstatSync:()=>Hu,fsync:()=>zf,fsyncSync:()=>Ku,ftruncate:()=>$f,ftruncateSync:()=>bs,futimes:()=>Xf,futimesSync:()=>mn,initialize:()=>Zi,lchmod:()=>sd,lchmodSync:()=>sf,lchown:()=>nd,lchownSync:()=>nf,link:()=>ed,linkSync:()=>Zu,lopenSync:()=>er,lstat:()=>Rf,lstatSync:()=>qu,lutimes:()=>ld,lutimesSync:()=>lf,mkdir:()=>Qf,mkdirSync:()=>Qu,mkdtemp:()=>bd,mkdtempSync:()=>ff,mount:()=>Qi,mounts:()=>we,open:()=>Df,openSync:()=>gi,opendir:()=>_d,opendirSync:()=>yf,promises:()=>or,read:()=>Kf,readFile:()=>Mf,readFileSync:()=>ms,readSync:()=>Xu,readdir:()=>Zf,readdirSync:()=>bn,readlink:()=>id,readlinkSync:()=>tf,readv:()=>wd,readvSync:()=>hf,realpath:()=>cd,realpathSync:()=>gn,rename:()=>Pf,renameSync:()=>Wu,rm:()=>md,rmSync:()=>uf,rmdir:()=>Jf,rmdirSync:()=>Ju,stat:()=>Lf,statSync:()=>fn,symlink:()=>td,symlinkSync:()=>ef,truncate:()=>Of,truncateSync:()=>ju,umount:()=>cn,unlink:()=>Bf,unlinkSync:()=>ys,unwatchFile:()=>dd,utimes:()=>ad,utimesSync:()=>af,watch:()=>hd,watchFile:()=>fd,write:()=>Hf,writeFile:()=>Uf,writeFileSync:()=>hn,writeSync:()=>Gu,writev:()=>Sd,writevSync:()=>pf});var Y=(y=>(y[y.EPERM=1]="EPERM",y[y.ENOENT=2]="ENOENT",y[y.EIO=5]="EIO",y[y.EBADF=9]="EBADF",y[y.EACCES=13]="EACCES",y[y.EBUSY=16]="EBUSY",y[y.EEXIST=17]="EEXIST",y[y.ENOTDIR=20]="ENOTDIR",y[y.EISDIR=21]="EISDIR",y[y.EINVAL=22]="EINVAL",y[y.EFBIG=27]="EFBIG",y[y.ENOSPC=28]="ENOSPC",y[y.EROFS=30]="EROFS",y[y.ENOTEMPTY=39]="ENOTEMPTY",y[y.ENOTSUP=95]="ENOTSUP",y))(Y||{}),on={[1]:"Operation not permitted.",[2]:"No such file or directory.",[5]:"Input/output error.",[9]:"Bad file descriptor.",[13]:"Permission denied.",[16]:"Resource busy or locked.",[17]:"File exists.",[20]:"File is not a directory.",[21]:"File is a directory.",[22]:"Invalid argument.",[27]:"File is too big.",[28]:"No space left on disk.",[30]:"Cannot modify a read-only file system.",[39]:"Directory is not empty.",[95]:"Operation is not supported."},c=class extends Error{constructor(i,r=on[i],n){super(r);this.errno=i;this.path=n;this.code=Y[i],this.message=`${this.code}: ${r}${this.path?`, '${this.path}'`:""}`}static fromJSON(i){let r=new c(i.errno,i.message,i.path);return r.code=i.code,r.stack=i.stack,r}static OnPath(i,r){return new c(i,on[i],r)}static EACCES(i){return this.OnPath(13,i)}static ENOENT(i){return this.OnPath(2,i)}static EEXIST(i){return this.OnPath(17,i)}static EISDIR(i){return this.OnPath(21,i)}static ENOTDIR(i){return this.OnPath(20,i)}static EPERM(i){return this.OnPath(1,i)}static ENOTEMPTY(i){return this.OnPath(39,i)}code;syscall="";stack;toString(){return this.message}toJSON(){return{errno:this.errno,code:this.code,path:this.path,stack:this.stack,message:this.message}}bufferSize(){return 4+JSON.stringify(this.toJSON()).length}};s(c,"ApiError");var sn=class{constructor(e,i,r,n,o,a){this.uid=e;this.gid=i;this.suid=r;this.sgid=n;this.euid=o;this.egid=a}},z=sn;s(z,"Cred"),fi(z,"Root",new sn(0,0,0,0,0,0));var di={};qi(di,{COPYFILE_EXCL:()=>su,COPYFILE_FICLONE:()=>au,COPYFILE_FICLONE_FORCE:()=>lu,F_OK:()=>nu,O_APPEND:()=>Ft,O_CREAT:()=>ve,O_DIRECT:()=>yu,O_DIRECTORY:()=>uu,O_DSYNC:()=>hu,O_EXCL:()=>Nt,O_NOATIME:()=>fu,O_NOCTTY:()=>cu,O_NOFOLLOW:()=>du,O_NONBLOCK:()=>mu,O_RDONLY:()=>ji,O_RDWR:()=>Ye,O_SYMLINK:()=>pu,O_SYNC:()=>$i,O_TRUNC:()=>Tt,O_WRONLY:()=>kt,R_OK:()=>ge,S_IFBLK:()=>gu,S_IFCHR:()=>bu,S_IFDIR:()=>Vi,S_IFIFO:()=>wu,S_IFLNK:()=>Hi,S_IFMT:()=>G,S_IFREG:()=>zi,S_IFSOCK:()=>Su,S_IRGRP:()=>ku,S_IROTH:()=>Iu,S_IRUSR:()=>Eu,S_IRWXG:()=>Au,S_IRWXO:()=>Fu,S_IRWXU:()=>_u,S_IWGRP:()=>Nu,S_IWOTH:()=>Pu,S_IWUSR:()=>xu,S_IXGRP:()=>Tu,S_IXOTH:()=>Cu,S_IXUSR:()=>vu,W_OK:()=>se,X_OK:()=>ou});var nu=0,ge=4,se=2,ou=1,su=1,au=2,lu=4,ji=0,kt=1,Ye=2,ve=64,Nt=128,cu=256,Tt=512,Ft=1024,uu=65536,fu=262144,du=131072,$i=1052672,hu=4096,pu=32768,yu=16384,mu=2048,G=61440,zi=32768,Vi=16384,bu=8192,gu=24576,wu=4096,Hi=40960,Su=49152,_u=448,Eu=256,xu=128,vu=64,Au=56,ku=32,Nu=16,Tu=8,Fu=7,Iu=4,Pu=2,Cu=1;var C=(r=>(r[r.FILE=32768]="FILE",r[r.DIRECTORY=16384]="DIRECTORY",r[r.SYMLINK=40960]="SYMLINK",r))(C||{}),It=class{get _typename(){return this._isBigint?"bigint":"number"}get _typename_inverse(){return this._isBigint?"number":"bigint"}_convert(e){return this._isBigint?BigInt(e):Number(e)}blocks;mode;dev=this._convert(0);ino=this._convert(0);rdev=this._convert(0);nlink=this._convert(1);blksize=this._convert(4096);uid=this._convert(0);gid=this._convert(0);fileData=null;atimeMs;get atime(){return new Date(Number(this.atimeMs))}set atime(e){this.atimeMs=this._convert(e.getTime())}mtimeMs;get mtime(){return new Date(Number(this.mtimeMs))}set mtime(e){this.mtimeMs=this._convert(e.getTime())}ctimeMs;get ctime(){return new Date(Number(this.ctimeMs))}set ctime(e){this.ctimeMs=this._convert(e.getTime())}birthtimeMs;get birthtime(){return new Date(Number(this.birthtimeMs))}set birthtime(e){this.birthtimeMs=this._convert(e.getTime())}size;constructor(e=C.FILE,i=-1,r,n,o,a,l,u,f){let d=Date.now(),h=s((b,m)=>typeof b==this._typename?b:this._convert(typeof b==this._typename_inverse?b:m),"resolveT");if(this.atimeMs=h(n,d),this.mtimeMs=h(o,d),this.ctimeMs=h(a,d),this.birthtimeMs=h(f,d),this.uid=h(l,0),this.gid=h(u,0),this.size=this._convert(i),r)this.mode=this._convert(r);else switch(e){case C.FILE:this.mode=this._convert(420);break;case C.DIRECTORY:default:this.mode=this._convert(511)}this.blocks=this._convert(Math.ceil(Number(i)/512)),this.mode&61440||(this.mode=this.mode|this._convert(e))}isFile(){return(this.mode&61440)===32768}isDirectory(){return(this.mode&61440)===16384}isSymbolicLink(){return(this.mode&61440)===40960}isSocket(){return!1}isBlockDevice(){return!1}isCharacterDevice(){return!1}isFIFO(){return!1}hasAccess(e,i){if(i.euid===0||i.egid===0)return!0;let r=this.mode&-61441,n=15,o=15,a=15;if(i.euid==this.uid){let f=(3840&r)>>8;n=(e^f)&e}if(i.egid==this.gid){let f=(240&r)>>4;o=(e^f)&e}let l=15&r;return a=(e^l)&e,!(n&o&a)}getCred(e=Number(this.uid),i=Number(this.gid)){return new z(e,i,Number(this.uid),Number(this.gid),e,i)}chmod(e){this.mode=this._convert(this.mode&61440|e)}chown(e,i){e=Number(e),i=Number(i),!isNaN(e)&&0<=e&&e<2**32&&(this.uid=this._convert(e)),!isNaN(i)&&0<=i&&i<2**32&&(this.gid=this._convert(i))}};s(It,"StatsCommon");var M=class extends It{_isBigint=!1;static clone(e){return new M(e.mode&61440,e.size,e.mode&-61441,e.atimeMs,e.mtimeMs,e.ctimeMs,e.uid,e.gid,e.birthtimeMs)}};s(M,"Stats");var X=class extends It{_isBigint=!0;atimeNs;mtimeNs;ctimeNs;birthtimeNs;static clone(e){return new X(Number(e.mode)&61440,BigInt(e.size),BigInt(e.mode)&BigInt(-61441),BigInt(e.atimeMs),BigInt(e.mtimeMs),BigInt(e.ctimeMs),BigInt(e.uid),BigInt(e.gid),BigInt(e.birthtimeMs))}};s(X,"BigIntStats");var Lu="/",ls="/";function Pt(t,e){if(typeof t!="string")throw new TypeError(`"${e}" is not a string`)}s(Pt,"validateString");function cs(t,e){let i="",r=0,n=-1,o=0,a="\0";for(let l=0;l<=t.length;++l){if(l<t.length)a=t[l];else{if(a=="/")break;a="/"}if(a=="/"){if(!(n===l-1||o===1))if(o===2){if(i.length<2||r!==2||i.at(-1)!=="."||i.at(-2)!=="."){if(i.length>2){let u=i.lastIndexOf("/");u===-1?(i="",r=0):(i=i.slice(0,u),r=i.length-1-i.lastIndexOf("/")),n=l,o=0;continue}else if(i.length!==0){i="",r=0,n=l,o=0;continue}}e&&(i+=i.length>0?"/..":"..",r=2)}else i.length>0?i+="/"+t.slice(n+1,l):i=t.slice(n+1,l),r=l-n-1;n=l,o=0}else a==="."&&o!==-1?++o:o=-1}return i}s(cs,"normalizeString");function Ae(...t){let e="",i=!1;for(let r=t.length-1;r>=-1&&!i;r--){let n=r>=0?t[r]:Lu;Pt(n,`paths[${r}]`),n.length!==0&&(e=`${n}/${e}`,i=n[0]==="/")}return e=cs(e,!i),i?`/${e}`:e.length>0?e:"."}s(Ae,"resolve");function Ru(t){if(Pt(t,"path"),t.length===0)return".";let e=t[0]==="/",i=t.at(-1)==="/";return t=cs(t,!e),t.length===0?e?"/":i?"./":".":(i&&(t+="/"),e?`/${t}`:t)}s(Ru,"normalize");function fe(...t){if(t.length===0)return".";let e;for(let i=0;i<t.length;++i){let r=t[i];Pt(r,"path"),r.length>0&&(e===void 0?e=r:e+=`/${r}`)}return e===void 0?".":Ru(e)}s(fe,"join");function E(t){if(Pt(t,"path"),t.length===0)return".";let e=t[0]==="/",i=-1,r=!0;for(let n=t.length-1;n>=1;--n)if(t[n]==="/"){if(!r){i=n;break}}else r=!1;return i===-1?e?"/":".":e&&i===1?"//":t.slice(0,i)}s(E,"dirname");function R(t,e){e!==void 0&&Pt(e,"ext"),Pt(t,"path");let i=0,r=-1,n=!0;if(e!==void 0&&e.length>0&&e.length<=t.length){if(e===t)return"";let o=e.length-1,a=-1;for(let l=t.length-1;l>=0;--l)if(t[l]==="/"){if(!n){i=l+1;break}}else a===-1&&(n=!1,a=l+1),o>=0&&(t[l]===e[o]?--o===-1&&(r=l):(o=-1,r=a));return i===r?r=a:r===-1&&(r=t.length),t.slice(i,r)}for(let o=t.length-1;o>=0;--o)if(t[o]==="/"){if(!n){i=o+1;break}}else r===-1&&(n=!1,r=o+1);return r===-1?"":t.slice(i,r)}s(R,"basename");var Ki=2**32-1,he=0n;function us(){return Math.round(Math.random()*2**32).toString(16)}s(us,"_random");function Ct(){return BigInt("0x"+us()+us())}s(Ct,"randomIno");var de=class{buffer;get data(){return new Uint8Array(this.buffer)}view;constructor(e){let i=!e;if(e??=new ArrayBuffer(50),this.view=new DataView(e),this.buffer=e,!i)return;this.ino=Ct(),this.nlink=1,this.size=4096;let r=Date.now();this.atime=r,this.mtime=r,this.ctime=r}get ino(){return this.view.getBigUint64(0,!0)}set ino(e){this.view.setBigUint64(0,e,!0)}get size(){return this.view.getUint32(8,!0)}set size(e){this.view.setUint32(8,e,!0)}get mode(){return this.view.getUint16(12,!0)}set mode(e){this.view.setUint16(12,e,!0)}get nlink(){return this.view.getUint32(14,!0)}set nlink(e){this.view.setUint32(14,e,!0)}get uid(){return this.view.getUint32(18,!0)}set uid(e){this.view.setUint32(18,e,!0)}get gid(){return this.view.getUint32(22,!0)}set gid(e){this.view.setUint32(22,e,!0)}get atime(){return this.view.getFloat64(26,!0)}set atime(e){this.view.setFloat64(26,e,!0)}get mtime(){return this.view.getFloat64(34,!0)}set mtime(e){this.view.setFloat64(34,e,!0)}get ctime(){return this.view.getFloat64(42,!0)}set ctime(e){this.view.setFloat64(42,e,!0)}toStats(){return new M((this.mode&61440)===C.DIRECTORY?C.DIRECTORY:C.FILE,this.size,this.mode,this.atime,this.mtime,this.ctime,this.uid,this.gid)}sizeof(){return this.buffer.byteLength}update(e){let i=!1;return this.size!==e.size&&(this.size=e.size,i=!0),this.mode!==e.mode&&(this.mode=e.mode,i=!0),this.nlink!==e.nlink&&(this.nlink=e.nlink,i=!0),this.uid!==e.uid&&(this.uid=e.uid,i=!0),this.uid!==e.uid&&(this.uid=e.uid,i=!0),this.atime!==e.atimeMs&&(this.atime=e.atimeMs,i=!0),this.mtime!==e.mtimeMs&&(this.mtime=e.mtimeMs,i=!0),this.ctime!==e.ctimeMs&&(this.ctime=e.ctimeMs,i=!0),i}};s(de,"Inode");var Gi=(n=>(n[n.NOP=0]="NOP",n[n.THROW=1]="THROW",n[n.TRUNCATE=2]="TRUNCATE",n[n.CREATE=3]="CREATE",n))(Gi||{}),Ge=class{static FromString(e){return Ge.flagCache.has(e)||Ge.flagCache.set(e,new Ge(e)),Ge.flagCache.get(e)}flagStr;constructor(e){if(typeof e=="number"&&(e=Ge.NumberToString(e)),Ge.validFlagStrs.indexOf(e)<0)throw new c(22,"Invalid flag string: "+e);this.flagStr=e}static NumberToString(e){switch(e){case 0:return"r";case 1052672:return"rs";case 2:return"r+";case 1052674:return"rs+";case 577:return"w";case 705:return"wx";case 578:return"w+";case 706:return"wx+";case 1089:return"a";case 1217:return"ax";case 1090:return"a+";case 1218:return"ax+";default:throw new c(22,"Invalid flag number: "+e)}}toString(){return this.flagStr}get mode(){let e=0;return e<<=1,e+=+this.isReadable(),e<<=1,e+=+this.isWriteable(),e<<=1,e}isReadable(){return this.flagStr.indexOf("r")!==-1||this.flagStr.indexOf("+")!==-1}isWriteable(){return this.flagStr.indexOf("w")!==-1||this.flagStr.indexOf("a")!==-1||this.flagStr.indexOf("+")!==-1}isTruncating(){return this.flagStr.indexOf("w")!==-1}isAppendable(){return this.flagStr.indexOf("a")!==-1}isSynchronous(){return this.flagStr.indexOf("s")!==-1}isExclusive(){return this.flagStr.indexOf("x")!==-1}pathExistsAction(){return this.isExclusive()?1:this.isTruncating()?2:0}pathNotExistsAction(){return(this.isWriteable()||this.isAppendable())&&this.flagStr!=="r+"?3:1}},I=Ge;s(I,"FileFlag"),fi(I,"flagCache",new Map),fi(I,"validFlagStrs",["r","r+","rs","rs+","w","wx","w+","wx+","a","ax","a+","ax+"]);var hi=class{datasync(){return this.sync()}datasyncSync(){return this.syncSync()}};s(hi,"File");var ne=class extends hi{constructor(i,r,n,o,a=new Uint8Array(new ArrayBuffer(0,{maxByteLength:Ki}))){super();this.fs=i;this.path=r;this.flag=n;this.stats=o;this._buffer=a;if(this.stats.size!=a.byteLength){if(this.flag.isReadable())throw new Error(`Size mismatch: buffer length ${a.byteLength}, stats size ${this.stats.size}`);this._dirty=!0}}_position=0;_dirty=!1;get buffer(){return this._buffer}get position(){return this.flag.isAppendable()?this.stats.size:this._position}set position(i){this._position=i}async stat(){return M.clone(this.stats)}statSync(){return M.clone(this.stats)}truncate(i){if(this.truncateSync(i),this.flag.isSynchronous()&&!this.fs.metadata().synchronous)return this.sync()}truncateSync(i){if(this._dirty=!0,!this.flag.isWriteable())throw new c(1,"File not opened with a writeable mode.");if(this.stats.mtimeMs=Date.now(),i>this._buffer.length){let r=new Uint8Array(i-this._buffer.length);this.writeSync(r,0,r.length,this._buffer.length),this.flag.isSynchronous()&&this.fs.metadata().synchronous&&this.syncSync();return}this.stats.size=i,this._buffer=this._buffer.subarray(0,i),this.flag.isSynchronous()&&this.fs.metadata().synchronous&&this.syncSync()}async write(i,r=0,n=this.stats.size,o=0){return this.writeSync(i,r,n,o)}writeSync(i,r=0,n=this.stats.size,o=0){if(this._dirty=!0,o??=this.position,!this.flag.isWriteable())throw new c(1,"File not opened with a writeable mode.");let a=o+n;if(a>this.stats.size&&(this.stats.size=a,a>this._buffer.byteLength))if(this._buffer.buffer.resizable&&this._buffer.buffer.maxByteLength<=a)this._buffer.buffer.resize(a);else{let u=new Uint8Array(new ArrayBuffer(a,{maxByteLength:Ki}));u.set(this._buffer),this._buffer=u}this._buffer.set(i.slice(r,r+n),o);let l=this._buffer.byteOffset;return this.stats.mtimeMs=Date.now(),this.flag.isSynchronous()?(this.syncSync(),l):(this.position=o+l,l)}async read(i,r=0,n=this.stats.size,o=0){return{bytesRead:this.readSync(i,r,n,o),buffer:i}}readSync(i,r=0,n=this.stats.size,o=0){if(!this.flag.isReadable())throw new c(1,"File not opened with a readable mode.");o??=this.position;let a=o+n;a>this.stats.size&&(a=o+Math.max(this.stats.size-o,0)),this.stats.atimeMs=Date.now(),this._position=a;let l=a-o;return l==0||i.set(this._buffer.slice(o,a),r),l}async chmod(i){this.chmodSync(i)}chmodSync(i){if(!this.fs.metadata().supportsProperties)throw new c(95);this._dirty=!0,this.stats.chmod(i),this.syncSync()}async chown(i,r){this.chownSync(i,r)}chownSync(i,r){if(!this.fs.metadata().supportsProperties)throw new c(95);this._dirty=!0,this.stats.chown(i,r),this.syncSync()}async utimes(i,r){this.utimesSync(i,r)}utimesSync(i,r){if(!this.fs.metadata().supportsProperties)throw new c(95);this._dirty=!0,this.stats.atime=i,this.stats.mtime=r,this.syncSync()}isDirty(){return this._dirty}resetDirty(){this._dirty=!1}_setType(i){return this._dirty=!0,this.stats.mode=this.stats.mode&-61441|i,this.sync()}_setTypeSync(i){this._dirty=!0,this.stats.mode=this.stats.mode&-61441|i,this.syncSync()}};s(ne,"PreloadFile");var Yi=class extends ne{constructor(e,i,r,n,o){super(e,i,r,n,o)}async sync(){this.syncSync()}syncSync(){this.isDirty()&&(this.fs.syncSync(this.path,this._buffer,this.stats),this.resetDirty())}async close(){this.closeSync()}closeSync(){this.syncSync()}};s(Yi,"SyncFile");var ot=class extends ne{constructor(e,i,r,n,o){super(e,i,r,n,o)}async sync(){}syncSync(){}async close(){}closeSync(){}};s(ot,"NoSyncFile");var J=class{metadata(){return{name:this.constructor.name,readonly:!1,synchronous:!1,supportsProperties:!1,totalSpace:0,freeSpace:0}}constructor(e){}async exists(e,i){try{return await this.stat(e,i),!0}catch{return!1}}existsSync(e,i){try{return this.statSync(e,i),!0}catch{return!1}}};s(J,"FileSystem");function st(t){class e extends t{metadata(){return{...super.metadata(),synchronous:!0}}async ready(){return this}async exists(r,n){return this.existsSync(r,n)}async rename(r,n,o){return this.renameSync(r,n,o)}async stat(r,n){return this.statSync(r,n)}async createFile(r,n,o,a){return this.createFileSync(r,n,o,a)}async openFile(r,n,o){return this.openFileSync(r,n,o)}async unlink(r,n){return this.unlinkSync(r,n)}async rmdir(r,n){return this.rmdirSync(r,n)}async mkdir(r,n,o){return this.mkdirSync(r,n,o)}async readdir(r,n){return this.readdirSync(r,n)}async link(r,n,o){return this.linkSync(r,n,o)}async sync(r,n,o){return this.syncSync(r,n,o)}}return s(e,"_SyncFileSystem"),e}s(st,"Sync");function pi(t){class e extends t{metadata(){return{...super.metadata(),synchronous:!1}}renameSync(r,n,o){throw new c(95)}statSync(r,n){throw new c(95)}createFileSync(r,n,o,a){throw new c(95)}openFileSync(r,n,o){throw new c(95)}unlinkSync(r,n){throw new c(95)}rmdirSync(r,n){throw new c(95)}mkdirSync(r,n,o){throw new c(95)}readdirSync(r,n){throw new c(95)}linkSync(r,n,o){throw new c(95)}syncSync(r,n,o){throw new c(95)}}return s(e,"_AsyncFileSystem"),e}s(pi,"Async");function an(t){class e extends t{metadata(){return{...super.metadata(),readonly:!0}}async rename(r,n,o){throw new c(30)}renameSync(r,n,o){throw new c(30)}async createFile(r,n,o,a){throw new c(30)}createFileSync(r,n,o,a){throw new c(30)}async unlink(r,n){throw new c(30)}unlinkSync(r,n){throw new c(30)}async rmdir(r,n){throw new c(30)}rmdirSync(r,n){throw new c(30)}async mkdir(r,n,o){throw new c(30)}mkdirSync(r,n,o){throw new c(30)}async link(r,n,o){throw new c(30)}linkSync(r,n,o){throw new c(30)}async sync(r,n,o){throw new c(30)}syncSync(r,n,o){throw new c(30)}}return s(e,"_ReadonlyFileSystem"),e}s(an,"Readonly");function fs(t,e,i,r){r.existsSync(t,i)||(fs(E(t),e,i,r),r.mkdirSync(t,e,i))}s(fs,"mkdirpSync");function Xi(t,e,i,r,n){return Math.min(t+1,e+1,i+1,r===n?e:e+1)}s(Xi,"_min");function ln(t,e){if(t===e)return 0;t.length>e.length&&([t,e]=[e,t]);let i=t.length,r=e.length;for(;i>0&&t.charCodeAt(i-1)===e.charCodeAt(r-1);)i--,r--;let n=0;for(;n<i&&t.charCodeAt(n)===e.charCodeAt(n);)n++;if(i-=n,r-=n,i===0||r===1)return r;let o=new Array(i<<1);for(let b=0;b<i;)o[i+b]=t.charCodeAt(n+b),o[b]=++b;let a,l,u,f,d;for(a=0;a+3<r;){let b=e.charCodeAt(n+(l=a)),m=e.charCodeAt(n+(u=a+1)),g=e.charCodeAt(n+(f=a+2)),y=e.charCodeAt(n+(d=a+3)),k=a+=4;for(let w=0;w<i;){let F=o[i+w],D=o[w];l=Xi(D,l,u,b,F),u=Xi(l,u,f,m,F),f=Xi(u,f,d,g,F),k=Xi(f,d,k,y,F),o[w++]=k,d=f,f=u,u=l,l=D}}let h=0;for(;a<r;){let b=e.charCodeAt(n+(l=a));h=++a;for(let m=0;m<i;m++){let g=o[m];o[m]=h=g<l||h<l?g>h?h+1:g+1:b===o[i+m]?l:l+1,l=g}}return h}s(ln,"levenshtein");function Bu(t){return new Promise(e=>{setTimeout(e,t)})}s(Bu,"wait");function Du(t){return function(...e){return new Promise((i,r)=>{e.push((n,...o)=>{n?r(n):i(o[0])}),t(...e)})}}s(Du,"toPromise");var Mu=typeof globalThis.setImmediate=="function"?globalThis.setImmediate:t=>setTimeout(t,0);function U(t,e="utf8"){switch(e){case"ascii":return new globalThis.TextEncoder().encode(t).map(i=>i&127);case"latin1":case"binary":case"utf8":case"utf-8":case"base64":case"base64url":case"hex":return new globalThis.TextEncoder().encode(t);case"utf16le":case"ucs2":case"ucs-2":return new globalThis.TextEncoder().encode(t).slice(0,-1);default:throw new c(22,"Invalid encoding: "+e)}}s(U,"encode");function te(t,e="utf8"){switch(e){case"ascii":case"utf8":case"utf-8":return new globalThis.TextDecoder().decode(t);case"latin1":case"binary":return new globalThis.TextDecoder("latin1").decode(t);case"utf16le":case"ucs2":case"ucs-2":let i="";for(let r=0;r<t.length;r+=2){let n=t[r]|t[r+1]<<8;i+=String.fromCharCode(n)}return i;case"base64":return btoa(Array.from(t).map(r=>String.fromCharCode(r)).join(""));case"base64url":return te(t,"base64").replace("/","_").replace("+","-");case"hex":return Array.from(t).map(r=>r.toString(16)).join("");default:throw new c(22,"Invalid encoding: "+e)}}s(te,"decode");function yi(t){return JSON.parse(te(t),(e,i)=>e==""?i:BigInt(i))}s(yi,"decodeDirListing");function ae(t){return U(JSON.stringify(t,(e,i)=>e==""?i:i.toString()))}s(ae,"encodeDirListing");var Lt=class{constructor(e){this.store=e}originalData=new Map;modifiedKeys=new Set;get(e){let i=this.store.get(e);return this.stashOldValue(e,i),i}put(e,i,r){return this.markModified(e),this.store.put(e,i,r)}remove(e){this.markModified(e),this.store.remove(e)}commit(){}abort(){for(let e of this.modifiedKeys){let i=this.originalData.get(e);i?this.store.put(e,i,!0):this.store.remove(e)}}stashOldValue(e,i){this.originalData.has(e)||this.originalData.set(e,i)}markModified(e){this.modifiedKeys.add(e),this.originalData.has(e)||this.originalData.set(e,this.store.get(e))}};s(Lt,"SimpleSyncRWTransaction");var mi=class extends ne{constructor(e,i,r,n,o){super(e,i,r,n,o)}async sync(){this.syncSync()}syncSync(){this.isDirty()&&(this.fs.syncSync(this.path,this._buffer,this.stats),this.resetDirty())}async close(){this.closeSync()}closeSync(){this.syncSync()}};s(mi,"SyncStoreFile");var Rt=class extends st(J){store;constructor(e){super(),this.store=e.store,this.makeRootDirectory()}metadata(){return{...super.metadata(),name:this.store.name}}empty(){this.store.clear(),this.makeRootDirectory()}renameSync(e,i,r){let n=this.store.beginTransaction("readwrite"),o=E(e),a=R(e),l=E(i),u=R(i),f=this.findINode(n,o),d=this.getDirListing(n,f,o);if(!f.toStats().hasAccess(2,r))throw c.EACCES(e);if(!d[a])throw c.ENOENT(e);let h=d[a];if(delete d[a],(l+"/").indexOf(e+"/")==0)throw new c(16,o);let b,m;if(l===o?(b=f,m=d):(b=this.findINode(n,l),m=this.getDirListing(n,b,l)),m[u]){let g=this.getINode(n,m[u],i);if(g.toStats().isFile())try{n.remove(g.ino),n.remove(m[u])}catch(y){throw n.abort(),y}else throw c.EPERM(i)}m[u]=h;try{n.put(f.ino,ae(d),!0),n.put(b.ino,ae(m),!0)}catch(g){throw n.abort(),g}n.commit()}statSync(e,i){let r=this.findINode(this.store.beginTransaction("readonly"),e).toStats();if(!r.hasAccess(4,i))throw c.EACCES(e);return r}createFileSync(e,i,r,n){return this.commitNewFile(e,C.FILE,r,n),this.openFileSync(e,i,n)}openFileSync(e,i,r){let n=this.store.beginTransaction("readonly"),o=this.findINode(n,e),a=n.get(o.ino);if(!o.toStats().hasAccess(i.mode,r))throw c.EACCES(e);if(a===null)throw c.ENOENT(e);return new mi(this,e,i,o.toStats(),a)}unlinkSync(e,i){this.removeEntry(e,!1,i)}rmdirSync(e,i){if(this.readdirSync(e,i).length>0)throw c.ENOTEMPTY(e);this.removeEntry(e,!0,i)}mkdirSync(e,i,r){this.commitNewFile(e,C.DIRECTORY,i,r,U("{}"))}readdirSync(e,i){let r=this.store.beginTransaction("readonly"),n=this.findINode(r,e);if(!n.toStats().hasAccess(4,i))throw c.EACCES(e);return Object.keys(this.getDirListing(r,n,e))}syncSync(e,i,r){let n=this.store.beginTransaction("readwrite"),o=this._findINode(n,E(e),R(e)),a=this.getINode(n,o,e),l=a.update(r);try{n.put(a.ino,i,!0),l&&n.put(o,a.data,!0)}catch(u){throw n.abort(),u}n.commit()}linkSync(e,i,r){let n=this.store.beginTransaction("readwrite"),o=E(e);if(!this.findINode(n,o).toStats().hasAccess(4,r))throw c.EACCES(o);let l=E(i),u=this.findINode(n,l),f=this.getDirListing(n,u,l);if(!u.toStats().hasAccess(2,r))throw c.EACCES(l);let d=this._findINode(n,o,R(e)),h=this.getINode(n,d,e);if(!h.toStats().hasAccess(2,r))throw c.EACCES(i);h.nlink++,f[R(i)]=d;try{n.put(d,h.data,!0),n.put(u.ino,ae(f),!0)}catch(b){throw n.abort(),b}n.commit()}makeRootDirectory(){let e=this.store.beginTransaction("readwrite");if(e.get(he))return;let i=new de;i.mode=511|C.DIRECTORY,e.put(i.ino,U("{}"),!1),e.put(he,i.data,!1),e.commit()}_findINode(e,i,r,n=new Set){let o=fe(i,r);if(n.has(o))throw new c(5,"Infinite loop detected while finding inode",o);if(n.add(o),i!="/"){let a=this._findINode(e,E(i),R(i),n),l=this.getDirListing(e,this.getINode(e,a,i+ls+r),i);if(!(r in l))throw c.ENOENT(Ae(i,r));return l[r]}if(r!=""){let a=this.getDirListing(e,this.getINode(e,he,i),i);if(!(r in a))throw c.ENOENT(Ae(i,r));return a[r]}return he}findINode(e,i){let r=this._findINode(e,E(i),R(i));return this.getINode(e,r,i)}getINode(e,i,r){let n=e.get(i);if(!n)throw c.ENOENT(r);return new de(n.buffer)}getDirListing(e,i,r){if(!i.toStats().isDirectory())throw c.ENOTDIR(r);let n=e.get(i.ino);if(!n)throw c.ENOENT(r);return yi(n)}addNewNode(e,i){let n;for(;0<5;)try{return n=Ct(),e.put(n,i,!1),n}catch{}throw new c(5,"Unable to commit data to key-value store.")}commitNewFile(e,i,r,n,o=new Uint8Array){let a=this.store.beginTransaction("readwrite"),l=E(e),u=R(e),f=this.findINode(a,l),d=this.getDirListing(a,f,l);if(!f.toStats().hasAccess(2,n))throw c.EACCES(e);if(e==="/")throw c.EEXIST(e);if(d[u])throw c.EEXIST(e);let h=new de;try{h.ino=this.addNewNode(a,o),h.size=o.length,h.mode=r|i,h.uid=n.uid,h.gid=n.gid,d[u]=this.addNewNode(a,h.data),a.put(f.ino,ae(d),!0)}catch(b){throw a.abort(),b}return a.commit(),h}removeEntry(e,i,r){let n=this.store.beginTransaction("readwrite"),o=E(e),a=this.findINode(n,o),l=this.getDirListing(n,a,o),u=R(e),f=l[u];if(!f)throw c.ENOENT(e);let d=this.getINode(n,f,e);if(!d.toStats().hasAccess(2,r))throw c.EACCES(e);if(delete l[u],!i&&d.toStats().isDirectory())throw c.EISDIR(e);if(i&&!d.toStats().isDirectory())throw c.ENOTDIR(e);try{n.put(a.ino,ae(l),!0),--d.nlink<1&&(n.remove(d.ino),n.remove(f))}catch(h){throw n.abort(),h}n.commit()}};s(Rt,"SyncStoreFS");var Ji=class{constructor(e="tmp"){this.name=e}store=new Map;clear(){this.store.clear()}beginTransaction(){return new Lt(this)}get(e){return this.store.get(e)}put(e,i,r){return!r&&this.store.has(e)?!1:(this.store.set(e,i),!0)}remove(e){this.store.delete(e)}};s(Ji,"InMemoryStore");var bi={name:"InMemory",isAvailable(){return!0},options:{name:{type:"string",description:"The name of the store"}},create({name:t}){return new Rt({store:new Ji(t)})}};function hs(t){if(typeof t=="number")return Math.floor(t);if(t instanceof Date)return Math.floor(t.getTime()/1e3);throw new Error("Cannot parse time: "+t)}s(hs,"_toUnixTimestamp");function Se(t,e){switch(typeof t){case"number":return t;case"string":let i=parseInt(t,8);if(!isNaN(i))return i}if(typeof e=="number")return e;throw new c(22,"Invalid mode: "+t?.toString())}s(Se,"normalizeMode");function Ot(t){if(t instanceof Date)return t;if(typeof t=="number")return new Date(t*1e3);if(typeof t=="string")return new Date(t);throw new c(22,"Invalid time.")}s(Ot,"normalizeTime");function W(t){if(t.indexOf("\0")>=0)throw new c(22,"Path must be a string without null bytes.");if(t==="")throw new c(22,"Path must not be empty.");return t=t.replaceAll(/\/+/g,"/"),Ae(t)}s(W,"normalizePath");function Xe(t,e,i,r){switch(t===null?"null":typeof t){case"object":return{encoding:typeof t.encoding<"u"?t.encoding:e,flag:typeof t.flag<"u"?t.flag:i,mode:Se(t.mode,r)};case"string":return{encoding:t,flag:i,mode:r};case"null":case"undefined":case"function":return{encoding:e,flag:i,mode:r};default:throw new TypeError(`"options" must be a string or an object, got ${typeof t} instead.`)}}s(Xe,"normalizeOptions");function S(){}s(S,"nop");var v=z.Root;function ps(t){v=t}s(ps,"setCred");var at=new Map,Uu=100;function Bt(t){let e=Uu++;return at.set(e,t),e}s(Bt,"getFdForFile");function T(t){if(!at.has(t))throw new c(9);return at.get(t)}s(T,"fd2file");var we=new Map;Qi("/",bi.create({name:"root"}));function Qi(t,e){if(t[0]!=="/"&&(t="/"+t),t=Ae(t),we.has(t))throw new c(22,"Mount point "+t+" is already in use.");we.set(t,e)}s(Qi,"mount");function cn(t){if(t[0]!=="/"&&(t=`/${t}`),t=Ae(t),!we.has(t))throw new c(22,"Mount point "+t+" is already unmounted.");we.delete(t)}s(cn,"umount");function pe(t){t=W(t);let e=[...we].sort((i,r)=>i[0].length>r[0].length?-1:1);for(let[i,r]of e)if(i.length<=t.length&&t.startsWith(i))return t=t.slice(i.length>1?i.length:0),t===""&&(t="/"),{fs:r,path:t,mountPoint:i};throw new c(5,"ZenFS not initialized with a file system")}s(pe,"resolveFS");function ds(t,e){for(let[i,r]of Object.entries(e))t=t?.replaceAll(i,r);return t}s(ds,"fixPaths");function Je(t,e){return typeof t.stack=="string"&&(t.stack=ds(t.stack,e)),t.message=ds(t.message,e),t}s(Je,"fixError");function Zi(t){"/"in t&&cn("/");for(let[e,i]of Object.entries(t))Qi(e,i)}s(Zi,"initialize");var or={};qi(or,{FileHandle:()=>ce,access:()=>Rn,appendFile:()=>nr,chmod:()=>In,chown:()=>Tn,constants:()=>di,copyFile:()=>If,createReadStream:()=>kf,createWriteStream:()=>Nf,exists:()=>Si,fchmod:()=>_f,fchown:()=>Sf,futimes:()=>Ef,lchmod:()=>Pn,lchown:()=>Fn,link:()=>An,lopen:()=>rr,lstat:()=>Sn,lutimes:()=>Ln,mkdir:()=>vn,mkdtemp:()=>Ff,open:()=>lt,read:()=>wf,readFile:()=>_i,readdir:()=>wi,readlink:()=>Nn,realpath:()=>Ei,rename:()=>wn,rm:()=>Tf,rmdir:()=>xn,stat:()=>Mt,symlink:()=>kn,truncate:()=>_n,unlink:()=>ir,unwatchFile:()=>vf,utimes:()=>Cn,watch:()=>Af,watchFile:()=>xf,write:()=>gf,writeFile:()=>Wt});function le(...[t,e,i,...r]){i=W(i);let{fs:n,path:o}=pe(e&&un(i)?gn(i):i);try{return n[t](o,...r)}catch(a){throw Je(a,{[o]:i})}}s(le,"doOp");function Wu(t,e){t=W(t),e=W(e);let i=pe(t),r=pe(e),n={[i.path]:t,[r.path]:e};try{if(i===r)return i.fs.renameSync(i.path,r.path,v);let o=ms(t);hn(e,o),ys(t)}catch(o){throw Je(o,n)}}s(Wu,"renameSync");function un(t){t=W(t);try{let{fs:e,path:i}=pe(t);return e.existsSync(i,v)}catch(e){if(e.errno==2)return!1;throw e}}s(un,"existsSync");function fn(t,e){let i=le("statSync",!0,t,v);return e?.bigint?X.clone(i):i}s(fn,"statSync");function qu(t,e){let i=le("statSync",!1,t,v);return e?.bigint?X.clone(i):i}s(qu,"lstatSync");function ju(t,e=0){let i=gi(t,"r+");try{bs(i,e)}finally{Qe(i)}}s(ju,"truncateSync");function ys(t){return le("unlinkSync",!1,t,v)}s(ys,"unlinkSync");function Dt(t,e,i,r){let n=W(t),o=Se(i,420),a=I.FromString(e),l;try{l=le("statSync",r,n,v)}catch{switch(a.pathNotExistsAction()){case 3:if(!le("statSync",r,E(n),v).isDirectory())throw c.ENOTDIR(E(n));return le("createFileSync",r,n,a,o,v);case 1:throw c.ENOENT(n);default:throw new c(22,"Invalid FileFlag object.")}}if(!l.hasAccess(o,v))throw c.EACCES(n);switch(a.pathExistsAction()){case 1:throw c.EEXIST(n);case 2:return le("unlinkSync",r,n,v),le("createFileSync",r,n,a,l.mode,v);case 0:return le("openFileSync",r,n,a,v);default:throw new c(22,"Invalid FileFlag object.")}}s(Dt,"_openSync");function gi(t,e,i){return Bt(Dt(t,e,i,!0))}s(gi,"openSync");function er(t,e,i){return Bt(Dt(t,e,i,!1))}s(er,"lopenSync");function dn(t,e,i){let r=Dt(t,e,420,i);try{let n=r.statSync(),o=new Uint8Array(n.size);return r.readSync(o,0,n.size,0),r.closeSync(),o}finally{r.closeSync()}}s(dn,"_readFileSync");function ms(t,e={}){let i=Xe(e,null,"r",420);if(!I.FromString(i.flag).isReadable())throw new c(22,"Flag passed to readFile must allow for reading.");let n=dn(t,i.flag,!0);return i.encoding?te(n,i.encoding):n}s(ms,"readFileSync");function $u(t,e,i,r,n){let o=Dt(t,i,r,n);try{o.writeSync(e,0,e.length,0)}finally{o.closeSync()}}s($u,"_writeFileSync");function hn(t,e,i){let r=Xe(i,"utf8","w",420);if(!I.FromString(r.flag).isWriteable())throw new c(22,"Flag passed to writeFile must allow for writing.");if(typeof e!="string"&&!r.encoding)throw new c(22,"Encoding not specified");let o=typeof e=="string"?U(e,r.encoding):e;if(o===void 0)throw new c(22,"Data not specified");$u(t,o,r.flag,r.mode,!0)}s(hn,"writeFileSync");function zu(t,e,i,r,n){let o=Dt(t,i,r,n);try{o.writeSync(e,0,e.length,null)}finally{o.closeSync()}}s(zu,"_appendFileSync");function Vu(t,e,i){let r=Xe(i,"utf8","a",420);if(!I.FromString(r.flag).isAppendable())throw new c(22,"Flag passed to appendFile must allow for appending.");if(typeof e!="string"&&!r.encoding)throw new c(22,"Encoding not specified");let o=typeof e=="string"?U(e):e;zu(t,o,r.flag,r.mode,!0)}s(Vu,"appendFileSync");function Hu(t,e){let i=T(t).statSync();return e?.bigint?X.clone(i):i}s(Hu,"fstatSync");function Qe(t){T(t).closeSync(),at.delete(t)}s(Qe,"closeSync");function bs(t,e=0){if(e<0)throw new c(22);T(t).truncateSync(e)}s(bs,"ftruncateSync");function Ku(t){T(t).syncSync()}s(Ku,"fsyncSync");function Yu(t){T(t).datasyncSync()}s(Yu,"fdatasyncSync");function Gu(t,e,i,r,n){let o,a=0,l,u;if(typeof e=="string"){u=typeof i=="number"?i:null;let d=typeof r=="string"?r:"utf8";a=0,o=U(e,d),l=o.length}else o=e,a=i,l=r,u=typeof n=="number"?n:null;let f=T(t);return u==null&&(u=f.position),f.writeSync(o,a,l,u)}s(Gu,"writeSync");function Xu(t,e,i,r,n){let o=T(t),a=i;return typeof i=="object"&&({offset:a,length:r,position:n}=i),isNaN(+n)&&(n=o.position),o.readSync(e,a,r,n)}s(Xu,"readSync");function pn(t,e,i){T(t).chownSync(e,i)}s(pn,"fchownSync");function yn(t,e){let i=Se(e,-1);if(i<0)throw new c(22,"Invalid mode.");T(t).chmodSync(i)}s(yn,"fchmodSync");function mn(t,e,i){T(t).utimesSync(Ot(e),Ot(i))}s(mn,"futimesSync");function Ju(t){return le("rmdirSync",!0,t,v)}s(Ju,"rmdirSync");function Qu(t,e){let i=typeof e=="number"||typeof e=="string"?e:e?.mode,r=typeof e=="object"&&e?.recursive;le("mkdirSync",!0,t,Se(i,511),v)}s(Qu,"mkdirSync");function bn(t,e){t=W(t);let i=le("readdirSync",!0,t,v);for(let r of we.keys()){if(!r.startsWith(t))continue;let n=r.slice(t.length);n.includes("/")||n.length==0||i.push(n)}return i.map(r=>typeof e=="object"&&e?.withFileTypes?new Ze(r,fn(fe(t,r))):e=="buffer"||typeof e=="object"&&e.encoding=="buffer"?U(r):r)}s(bn,"readdirSync");function Zu(t,e){return e=W(e),le("linkSync",!1,t,e,v)}s(Zu,"linkSync");function ef(t,e,i="file"){if(!["file","dir","junction"].includes(i))throw new c(22,"Invalid type: "+i);if(un(e))throw c.EEXIST(e);hn(e,t),Dt(e,"r+",420,!1)._setTypeSync(C.SYMLINK)}s(ef,"symlinkSync");function tf(t,e){let i=dn(t,"r",!1),r=typeof e=="object"?e.encoding:e;return r=="buffer"?i:te(i,r)}s(tf,"readlinkSync");function rf(t,e,i){let r=gi(t,"r+");pn(r,e,i),Qe(r)}s(rf,"chownSync");function nf(t,e,i){let r=er(t,"r+");pn(r,e,i),Qe(r)}s(nf,"lchownSync");function of(t,e){let i=gi(t,"r+");yn(i,e),Qe(i)}s(of,"chmodSync");function sf(t,e){let i=er(t,"r+");yn(i,e),Qe(i)}s(sf,"lchmodSync");function af(t,e,i){let r=gi(t,"r+");mn(r,e,i),Qe(r)}s(af,"utimesSync");function lf(t,e,i){let r=er(t,"r+");mn(r,e,i),Qe(r)}s(lf,"lutimesSync");function gn(t,e){t=W(t);let{fs:i,path:r,mountPoint:n}=pe(t);try{if(!i.statSync(r,v).isSymbolicLink())return t;let a=W(n+te(dn(r,"r+",!1)));return gn(a)}catch(o){throw Je(o,{[r]:t})}}s(gn,"realpathSync");function cf(t,e=384){if(!fn(t).hasAccess(e,v))throw new c(13)}s(cf,"accessSync");function uf(t){throw new c(95)}s(uf,"rmSync");function ff(t,e){throw new c(95)}s(ff,"mkdtempSync");function df(t,e,i){throw new c(95)}s(df,"copyFileSync");function hf(t,e,i){throw new c(95)}s(hf,"readvSync");function pf(t,e,i){throw new c(95)}s(pf,"writevSync");function yf(t,e){throw new c(95)}s(yf,"opendirSync");var Ze=class{constructor(e,i){this.name=e;this.stats=i}isFile(){return this.stats.isFile()}isDirectory(){return this.stats.isDirectory()}isBlockDevice(){return this.stats.isBlockDevice()}isCharacterDevice(){return this.stats.isCharacterDevice()}isSymbolicLink(){return this.stats.isSymbolicLink()}isFIFO(){return this.stats.isFIFO()}isSocket(){return this.stats.isSocket()}};s(Ze,"Dirent");var tr=class{constructor(e){this.path=e}closed=!1;checkClosed(){if(this.closed)throw new c(9,"Can not use closed Dir")}_entries;close(e){if(this.closed=!0,!e)return Promise.resolve();e()}closeSync(){this.closed=!0}async _read(){return this._entries||(this._entries=await wi(this.path,{withFileTypes:!0})),this._entries.length==0?null:this._entries.shift()}read(e){if(!e)return this._read();this._read().then(i=>e(null,i))}readSync(){return this._entries||(this._entries=bn(this.path,{withFileTypes:!0})),this._entries.length==0?null:this._entries.shift()}[Symbol.asyncIterator](){let e=this;return{[Symbol.asyncIterator]:this[Symbol.asyncIterator],async next(){let i=await e._read();return i!=null?{done:!1,value:i}:(await e.close(),{done:!0,value:void 0})}}}};s(tr,"Dir");var ce=class{constructor(e){this.fd=e}chown(e,i){return T(this.fd).chown(e,i)}chmod(e){let i=Se(e,-1);if(i<0)throw new c(22,"Invalid mode.");return T(this.fd).chmod(i)}datasync(){return T(this.fd).datasync()}sync(){return T(this.fd).sync()}truncate(e){if(e<0)throw new c(22);return T(this.fd).truncate(e)}utimes(e,i){return T(this.fd).utimes(Ot(e),Ot(i))}appendFile(e,i){return nr(T(this.fd).path,e,i)}read(e,i,r,n){return isNaN(+n)&&(n=T(this.fd).position),T(this.fd).read(e,i,r,n)}readFile(e){return _i(T(this.fd).path,e)}stat(e){return Mt(T(this.fd).path,e)}async write(e,i,r,n){let o,a=0,l;if(typeof e=="string"){n=typeof i=="number"?i:null;let f=typeof r=="string"?r:"utf8";a=0,o=U(e,f),l=o.length}else o=e,a=i,l=r,n=typeof n=="number"?n:null;n??=T(this.fd).position;let u=await T(this.fd).write(o,a,l,n);return{buffer:o,bytesWritten:u}}writeFile(e,i){return Wt(T(this.fd).path,e,i)}writev(e,i){throw new c(95)}readv(e,i){throw new c(95)}async close(){await T(this.fd).close(),at.delete(this.fd)}};s(ce,"FileHandle");async function _e(...[t,e,i,...r]){i=W(i);let{fs:n,path:o}=pe(e&&await Si(i)?await Ei(i):i);try{return n[t](o,...r)}catch(a){throw Je(a,{[o]:i})}}s(_e,"doOp");async function wn(t,e){t=W(t),e=W(e);let{path:i}=pe(t),{fs:r,path:n}=pe(e);try{let o=await _i(t);await Wt(e,o),await ir(t)}catch(o){throw Je(o,{[i]:t,[n]:e})}}s(wn,"rename");async function Si(t){try{let{fs:e,path:i}=pe(t);return e.exists(i,v)}catch(e){if(e.errno==2)return!1;throw e}}s(Si,"exists");async function Mt(t,e){let i=await _e("stat",!0,t,v);return e?.bigint?X.clone(i):i}s(Mt,"stat");async function Sn(t,e){let i=await _e("stat",!1,t,v);return e?.bigint?X.clone(i):i}s(Sn,"lstat");async function _n(t,e=0){let i=await lt(t,"r+");try{await i.truncate(e)}finally{await i.close()}}s(_n,"truncate");async function ir(t){return _e("unlink",!1,t,v)}s(ir,"unlink");async function Ut(t,e,i=420,r){let n=W(t),o=Se(i,420),a=I.FromString(e);try{switch(a.pathExistsAction()){case 1:throw c.EEXIST(n);case 2:let l=await _e("openFile",r,n,a,v);if(!l)throw new c(5,"Impossible code path reached");return await l.truncate(0),await l.sync(),l;case 0:return await _e("openFile",r,n,a,v);default:throw new c(22,"Invalid file flag")}}catch{switch(a.pathNotExistsAction()){case 3:let u=await _e("stat",r,E(n),v);if(u&&!u.isDirectory())throw c.ENOTDIR(E(n));return await _e("createFile",r,n,a,o,v);case 1:throw c.ENOENT(n);default:throw new c(22,"Invalid file flag")}}}s(Ut,"_open");async function lt(t,e,i=420){let r=await Ut(t,e,i,!0);return new ce(Bt(r))}s(lt,"open");async function rr(t,e,i=420){let r=await Ut(t,e,i,!1);return new ce(Bt(r))}s(rr,"lopen");async function En(t,e,i){let r=await Ut(W(t),e,420,i);try{let n=await r.stat(),o=new Uint8Array(n.size);return await r.read(o,0,n.size,0),await r.close(),o}finally{await r.close()}}s(En,"_readFile");async function _i(t,e){let i=Xe(e,null,"r",null);if(!I.FromString(i.flag).isReadable())throw new c(22,"Flag passed must allow for reading.");let n=await En(t,i.flag,!0);return i.encoding?te(n,i.encoding):n}s(_i,"readFile");async function mf(t,e,i,r,n){let o=await Ut(t,i,r,n);try{await o.write(e,0,e.length,0)}finally{await o.close()}}s(mf,"_writeFile");async function Wt(t,e,i){let r=Xe(i,"utf8","w",420);if(!I.FromString(r.flag).isWriteable())throw new c(22,"Flag passed must allow for writing.");if(typeof e!="string"&&!r.encoding)throw new c(22,"Encoding not specified");let o=typeof e=="string"?U(e,r.encoding):e;await mf(t,o,r.flag,r.mode,!0)}s(Wt,"writeFile");async function bf(t,e,i,r,n){let o=await Ut(t,i,r,n);try{await o.write(e,0,e.length,null)}finally{await o.close()}}s(bf,"_appendFile");async function nr(t,e,i){let r=Xe(i,"utf8","a",420);if(!I.FromString(r.flag).isAppendable())throw new c(22,"Flag passed to appendFile must allow for appending.");if(typeof e!="string"&&!r.encoding)throw new c(22,"Encoding not specified");let o=typeof e=="string"?U(e):e;await bf(t,o,r.flag,r.mode,!0)}s(nr,"appendFile");function gf(t,e,i,r,n){return t.write(e,i,r,n)}s(gf,"write");function wf(t,e,i,r,n){return t.read(e,i,r,n)}s(wf,"read");function Sf(t,e,i){return t.chown(e,i)}s(Sf,"fchown");function _f(t,e){return t.chmod(e)}s(_f,"fchmod");function Ef(t,e,i){return t.utimes(e,i)}s(Ef,"futimes");async function xn(t){return _e("rmdir",!0,t,v)}s(xn,"rmdir");async function vn(t,e){await _e("mkdir",!0,t,Se(typeof e=="object"?e?.mode:e,511),v)}s(vn,"mkdir");async function wi(t,e){t=W(t);let i=await _e("readdir",!0,t,v),r=[...we.keys()];for(let o of r)if(o.startsWith(t)){let a=o.slice(t.length);if(a.includes("/")||a.length==0)continue;i.push(a)}let n=[];for(let o of i)n.push(typeof e=="object"&&e?.withFileTypes?new Ze(o,await Mt(fe(t,o))):o);return n}s(wi,"readdir");async function An(t,e){return e=W(e),_e("link",!1,t,e,v)}s(An,"link");async function kn(t,e,i="file"){if(!["file","dir","junction"].includes(i))throw new c(22,"Invalid symlink type: "+i);if(await Si(e))throw c.EEXIST(e);await Wt(e,t),await(await Ut(e,"r+",420,!1))._setType(C.SYMLINK)}s(kn,"symlink");async function Nn(t,e){let i=await En(t,"r",!1),r=typeof e=="object"?e.encoding:e;return r=="buffer"?i:te(i,r)}s(Nn,"readlink");async function Tn(t,e,i){let r=await lt(t,"r+");try{await r.chown(e,i)}finally{await r.close()}}s(Tn,"chown");async function Fn(t,e,i){let r=await rr(t,"r+");try{await r.chown(e,i)}finally{await r.close()}}s(Fn,"lchown");async function In(t,e){let i=await lt(t,"r+");try{await i.chmod(e)}finally{await i.close()}}s(In,"chmod");async function Pn(t,e){let i=await rr(t,"r+");try{await i.chmod(e)}finally{await i.close()}}s(Pn,"lchmod");async function Cn(t,e,i){let r=await lt(t,"r+");try{await r.utimes(e,i)}finally{await r.close()}}s(Cn,"utimes");async function Ln(t,e,i){let r=await rr(t,"r+");try{await r.utimes(e,i)}finally{await r.close()}}s(Ln,"lutimes");async function Ei(t,e){t=W(t);let{fs:i,path:r,mountPoint:n}=pe(t);try{if(!(await i.stat(r,v)).isSymbolicLink())return t;let a=n+W(te(await En(r,"r+",!1)));return Ei(a)}catch(o){throw Je(o,{[r]:t})}}s(Ei,"realpath");async function xf(t,e,i=S){throw new c(95)}s(xf,"watchFile");async function vf(t,e=S){throw new c(95)}s(vf,"unwatchFile");async function Af(t,e,i=S){throw new c(95)}s(Af,"watch");async function Rn(t,e=384){if(!(await Mt(t)).hasAccess(e,v))throw new c(13)}s(Rn,"access");async function kf(t,e){throw new c(95)}s(kf,"createReadStream");async function Nf(t,e){throw new c(95)}s(Nf,"createWriteStream");async function Tf(t){throw new c(95)}s(Tf,"rm");async function Ff(t){throw new c(95)}s(Ff,"mkdtemp");async function If(t){throw new c(95)}s(If,"copyFile");function Pf(t,e,i=S){wn(t,e).then(()=>i()).catch(i)}s(Pf,"rename");function Cf(t,e=S){Si(t).then(e).catch(()=>e(!1))}s(Cf,"exists");function Lf(t,e,i=S){i=typeof e=="function"?e:i,Mt(t,typeof e!="function"?e:{}).then(r=>i(null,r)).catch(i)}s(Lf,"stat");function Rf(t,e,i=S){i=typeof e=="function"?e:i,Sn(t,typeof e!="function"?e:{}).then(r=>i(null,r)).catch(i)}s(Rf,"lstat");function Of(t,e=0,i=S){i=typeof e=="function"?e:i,_n(t,typeof e=="number"?e:0).then(()=>i()).catch(i)}s(Of,"truncate");function Bf(t,e=S){ir(t).then(()=>e()).catch(e)}s(Bf,"unlink");function Df(t,e,i,r=S){let n=Se(i,420);r=typeof i=="function"?i:r,lt(t,e,n).then(o=>r(null,o.fd)).catch(r)}s(Df,"open");function Mf(t,e,i=S){i=typeof e=="function"?e:i,_i(t,typeof e=="function"?null:e).then(r=>i(null,r)).catch(i)}s(Mf,"readFile");function Uf(t,e,i,r=S){r=typeof i=="function"?i:r,Wt(t,e,typeof i!="function"?i:null).then(()=>r(null)).catch(r)}s(Uf,"writeFile");function Wf(t,e,i,r=S){r=typeof i=="function"?i:r,nr(t,e,typeof i=="function"?null:i)}s(Wf,"appendFile");function qf(t,e,i=S){i=typeof e=="function"?e:i,T(t).stat().then(r=>i(null,typeof e=="object"&&e?.bigint?X.clone(r):r)).catch(i)}s(qf,"fstat");function jf(t,e=S){new ce(t).close().then(()=>e()).catch(e)}s(jf,"close");function $f(t,e,i=S){let r=typeof e=="number"?e:0;i=typeof e=="function"?e:i;let n=T(t);if(r<0)throw new c(22);n.truncate(r).then(()=>i()).catch(i)}s($f,"ftruncate");function zf(t,e=S){T(t).sync().then(()=>e()).catch(e)}s(zf,"fsync");function Vf(t,e=S){T(t).datasync().then(()=>e()).catch(e)}s(Vf,"fdatasync");function Hf(t,e,i,r,n,o=S){let a,l,u,f=null,d,h=new ce(t);if(typeof e=="string"){switch(d="utf8",typeof i){case"function":o=i;break;case"number":f=i,d=typeof r=="string"?r:"utf8",o=typeof n=="function"?n:o;break;default:o=typeof r=="function"?r:typeof n=="function"?n:o,o(new c(22,"Invalid arguments."));return}a=U(e),l=0,u=a.length;let b=o;h.write(a,l,u,f).then(({bytesWritten:m})=>b(null,m,te(a))).catch(b)}else{a=e,l=i,u=r,f=typeof n=="number"?n:null;let b=typeof n=="function"?n:o;h.write(a,l,u,f).then(({bytesWritten:m})=>b(null,m,a)).catch(b)}}s(Hf,"write");function Kf(t,e,i,r,n,o=S){new ce(t).read(e,i,r,n).then(({bytesRead:a,buffer:l})=>o(null,a,l)).catch(o)}s(Kf,"read");function Yf(t,e,i,r=S){new ce(t).chown(e,i).then(()=>r()).catch(r)}s(Yf,"fchown");function Gf(t,e,i){new ce(t).chmod(e).then(()=>i()).catch(i)}s(Gf,"fchmod");function Xf(t,e,i,r=S){new ce(t).utimes(e,i).then(()=>r()).catch(r)}s(Xf,"futimes");function Jf(t,e=S){xn(t).then(()=>e()).catch(e)}s(Jf,"rmdir");function Qf(t,e,i=S){vn(t,e).then(()=>i()).catch(i)}s(Qf,"mkdir");function Zf(t,e,i=S){i=typeof e=="function"?e:i,wi(t,typeof e!="function"?e:{}).then(n=>i(null,n)).catch(i)}s(Zf,"readdir");function ed(t,e,i=S){An(t,e).then(()=>i()).catch(i)}s(ed,"link");function td(t,e,i,r=S){let n=typeof i=="string"?i:"file";r=typeof i=="function"?i:r,kn(t,e,n).then(()=>r()).catch(r)}s(td,"symlink");function id(t,e,i=S){i=typeof e=="function"?e:i,Nn(t).then(r=>i(null,r)).catch(i)}s(id,"readlink");function rd(t,e,i,r=S){Tn(t,e,i).then(()=>r()).catch(r)}s(rd,"chown");function nd(t,e,i,r=S){Fn(t,e,i).then(()=>r()).catch(r)}s(nd,"lchown");function od(t,e,i=S){In(t,e).then(()=>i()).catch(i)}s(od,"chmod");function sd(t,e,i=S){Pn(t,e).then(()=>i()).catch(i)}s(sd,"lchmod");function ad(t,e,i,r=S){Cn(t,e,i).then(()=>r()).catch(r)}s(ad,"utimes");function ld(t,e,i,r=S){Ln(t,e,i).then(()=>r()).catch(r)}s(ld,"lutimes");function cd(t,e,i=S){i=typeof e=="function"?e:i,Ei(t,typeof e=="function"?null:e).then(r=>i(null,r)).catch(i)}s(cd,"realpath");function ud(t,e,i=S){let r=typeof e=="number"?e:4;i=typeof e=="function"?e:i,Rn(t,typeof e=="function"?null:e).then(()=>i()).catch(i)}s(ud,"access");function fd(t,e,i=S){throw new c(95)}s(fd,"watchFile");function dd(t,e=S){throw new c(95)}s(dd,"unwatchFile");function hd(t,e,i=S){throw new c(95)}s(hd,"watch");function pd(t,e){throw new c(95)}s(pd,"createReadStream");function yd(t,e){throw new c(95)}s(yd,"createWriteStream");function md(t){new c(95)}s(md,"rm");function bd(t){new c(95)}s(bd,"mkdtemp");function gd(t,e,i,r){new c(95)}s(gd,"copyFile");function wd(t){new c(95)}s(wd,"readv");function Sd(t,e,i,r){throw new c(95)}s(Sd,"writev");function _d(t){throw new c(95)}s(_d,"opendir");var Yr=iu(Hc(),1);var Hr=class extends Yr.Readable{close(e=()=>null){try{super.destroy(),super.emit("close"),e()}catch(i){e(i)}}bytesRead;path;pending;addListener(e,i){return super.addListener(e,i)}on(e,i){return super.on(e,i)}once(e,i){return super.once(e,i)}prependListener(e,i){return super.prependListener(e,i)}prependOnceListener(e,i){return super.prependOnceListener(e,i)}};s(Hr,"ReadStream");var Kr=class extends Yr.Writable{close(e=()=>null){try{super.destroy(),super.emit("close"),e()}catch(i){e(i)}}bytesWritten;path;pending;addListener(e,i){return super.addListener(e,i)}on(e,i){return super.on(e,i)}once(e,i){return super.once(e,i)}prependListener(e,i){return super.prependListener(e,i)}prependOnceListener(e,i){return super.prependOnceListener(e,i)}};s(Kr,"WriteStream");var Xr=class extends ne{constructor(e,i,r,n,o){super(e,i,r,n,o)}async sync(){this.syncSync()}syncSync(){this.isDirty()&&(this.fs.syncSync(this.path,this._buffer,this.stats),this.resetDirty())}async close(){this.closeSync()}closeSync(){this.syncSync()}};s(Xr,"MirrorFile");var si=class extends st(J){_queue=[];_queueRunning=!1;_sync;_async;_isInitialized=!1;_ready;async ready(){return await this._ready,this}constructor({sync:e,async:i}){super(),this._sync=e,this._async=i,this._ready=this._initialize()}metadata(){return{...super.metadata(),name:si.name,synchronous:!0,supportsProperties:this._sync.metadata().supportsProperties&&this._async.metadata().supportsProperties}}syncSync(e,i,r){this._sync.syncSync(e,i,r),this.enqueue({apiMethod:"sync",arguments:[e,i,r]})}openFileSync(e,i,r){return this._sync.openFileSync(e,i,r)}createFileSync(e,i,r,n){let o=this._sync.createFileSync(e,i,r,n);this.enqueue({apiMethod:"createFile",arguments:[e,i,r,n]});let a=o.statSync(),l=new Uint8Array(a.size);return o.readSync(l),new Xr(this,e,i,a,l)}linkSync(e,i,r){this._sync.linkSync(e,i,r),this.enqueue({apiMethod:"link",arguments:[e,i,r]})}renameSync(e,i,r){this._sync.renameSync(e,i,r),this.enqueue({apiMethod:"rename",arguments:[e,i,r]})}statSync(e,i){return this._sync.statSync(e,i)}unlinkSync(e,i){this._sync.unlinkSync(e,i),this.enqueue({apiMethod:"unlink",arguments:[e,i]})}rmdirSync(e,i){this._sync.rmdirSync(e,i),this.enqueue({apiMethod:"rmdir",arguments:[e,i]})}mkdirSync(e,i,r){this._sync.mkdirSync(e,i,r),this.enqueue({apiMethod:"mkdir",arguments:[e,i,r]})}readdirSync(e,i){return this._sync.readdirSync(e,i)}existsSync(e,i){return this._sync.existsSync(e,i)}async crossCopyDirectory(e,i){if(e!=="/"){let n=await this._async.stat(e,z.Root);this._sync.mkdirSync(e,i,n.getCred())}let r=await this._async.readdir(e,z.Root);for(let n of r)await this.crossCopy(fe(e,n))}async crossCopyFile(e,i){let r=await this._async.openFile(e,I.FromString("r"),z.Root),n=this._sync.createFileSync(e,I.FromString("w"),i,z.Root);try{let{size:o}=await r.stat(),a=new Uint8Array(o);await r.read(a),n.writeSync(a)}finally{await r.close(),n.closeSync()}}async crossCopy(e){let i=await this._async.stat(e,z.Root);i.isDirectory()?await this.crossCopyDirectory(e,i.mode):await this.crossCopyFile(e,i.mode)}async _initialize(){if(!this._isInitialized)try{await this.crossCopy("/"),this._isInitialized=!0}catch(e){throw this._isInitialized=!1,e}}async _next(){if(this._queue.length==0){this._queueRunning=!1;return}let e=this._queue.shift();try{await this._async[e.apiMethod](...e.arguments)}catch(i){throw new c(5,"AsyncMirror desync: "+i)}await this._next()}enqueue(e){this._queue.push(e),!this._queueRunning&&(this._queueRunning=!0,this._next())}};s(si,"AsyncMirrorFS");var is={name:"AsyncMirror",options:{sync:{type:"object",description:"The synchronous file system to mirror the asynchronous file system to.",validator:async t=>{if(!t?.metadata().synchronous)throw new c(22,"'sync' option must be a file system that supports synchronous operations")}},async:{type:"object",description:"The asynchronous file system to mirror."}},isAvailable(){return!0},create(t){return new si(t)}};var ai=class{_locks=new Map;lock(e){return new Promise(i=>{this._locks.has(e)?this._locks.get(e).push(i):this._locks.set(e,[])})}unlock(e){if(!this._locks.has(e))throw new Error("unlock of a non-locked mutex");let i=this._locks.get(e).shift();if(i){setTimeout(i,0);return}this._locks.delete(e)}tryLock(e){return this._locks.has(e)?!1:(this._locks.set(e,[]),!0)}isLocked(e){return this._locks.has(e)}};s(ai,"Mutex");var Di=class{constructor(e){this.fs=e}_mu=new ai;async ready(){return await this.fs.ready(),this}metadata(){return{...this.fs.metadata(),name:"Locked<"+this.fs.metadata().name+">"}}async rename(e,i,r){await this._mu.lock(e),await this.fs.rename(e,i,r),this._mu.unlock(e)}renameSync(e,i,r){if(this._mu.isLocked(e))throw new Error("invalid sync call");return this.fs.renameSync(e,i,r)}async stat(e,i){await this._mu.lock(e);let r=await this.fs.stat(e,i);return this._mu.unlock(e),r}statSync(e,i){if(this._mu.isLocked(e))throw new Error("invalid sync call");return this.fs.statSync(e,i)}async openFile(e,i,r){await this._mu.lock(e);let n=await this.fs.openFile(e,i,r);return this._mu.unlock(e),n}openFileSync(e,i,r){if(this._mu.isLocked(e))throw new Error("invalid sync call");return this.fs.openFileSync(e,i,r)}async createFile(e,i,r,n){await this._mu.lock(e);let o=await this.fs.createFile(e,i,r,n);return this._mu.unlock(e),o}createFileSync(e,i,r,n){if(this._mu.isLocked(e))throw new Error("invalid sync call");return this.fs.createFileSync(e,i,r,n)}async unlink(e,i){await this._mu.lock(e),await this.fs.unlink(e,i),this._mu.unlock(e)}unlinkSync(e,i){if(this._mu.isLocked(e))throw new Error("invalid sync call");return this.fs.unlinkSync(e,i)}async rmdir(e,i){await this._mu.lock(e),await this.fs.rmdir(e,i),this._mu.unlock(e)}rmdirSync(e,i){if(this._mu.isLocked(e))throw new Error("invalid sync call");return this.fs.rmdirSync(e,i)}async mkdir(e,i,r){await this._mu.lock(e),await this.fs.mkdir(e,i,r),this._mu.unlock(e)}mkdirSync(e,i,r){if(this._mu.isLocked(e))throw new Error("invalid sync call");return this.fs.mkdirSync(e,i,r)}async readdir(e,i){await this._mu.lock(e);let r=await this.fs.readdir(e,i);return this._mu.unlock(e),r}readdirSync(e,i){if(this._mu.isLocked(e))throw new Error("invalid sync call");return this.fs.readdirSync(e,i)}async exists(e,i){await this._mu.lock(e);let r=await this.fs.exists(e,i);return this._mu.unlock(e),r}existsSync(e,i){if(this._mu.isLocked(e))throw new Error("invalid sync call");return this.fs.existsSync(e,i)}async link(e,i,r){await this._mu.lock(e),await this.fs.link(e,i,r),this._mu.unlock(e)}linkSync(e,i,r){if(this._mu.isLocked(e))throw new Error("invalid sync call");return this.fs.linkSync(e,i,r)}async sync(e,i,r){await this._mu.lock(e),await this.fs.sync(e,i,r),this._mu.unlock(e)}syncSync(e,i,r){if(this._mu.isLocked(e))throw new Error("invalid sync call");return this.fs.syncSync(e,i,r)}};s(Di,"LockedFS");var rs="/.deleted",Mi=class extends ne{constructor(e,i,r,n,o){super(e,i,r,n,o)}async sync(){this.isDirty()&&(await this.fs.sync(this.path,this.buffer,this.stats),this.resetDirty())}syncSync(){this.isDirty()&&(this.fs.syncSync(this.path,this.buffer,this.stats),this.resetDirty())}async close(){await this.sync()}closeSync(){this.syncSync()}};s(Mi,"OverlayFile");var Jr=class extends J{async ready(){return await this._readable.ready(),await this._writable.ready(),await this._ready,this}_writable;_readable;_isInitialized=!1;_deletedFiles=new Set;_deleteLog="";_deleteLogUpdatePending=!1;_deleteLogUpdateNeeded=!1;_deleteLogError;_ready;constructor({writable:e,readable:i}){if(super(),this._writable=e,this._readable=i,this._writable.metadata().readonly)throw new c(22,"Writable file system must be writable.");this._ready=this._initialize()}metadata(){return{...super.metadata(),name:Ui.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}}async sync(e,i,r){let n=r.getCred(0,0);await this.createParentDirectories(e,n),await this._writable.sync(e,i,r)}syncSync(e,i,r){let n=r.getCred(0,0);this.createParentDirectoriesSync(e,n),this._writable.syncSync(e,i,r)}async _initialize(){if(!this._isInitialized){try{let e=await this._writable.openFile(rs,I.FromString("r"),z.Root),{size:i}=await e.stat(),{buffer:r}=await e.read(new Uint8Array(i));this._deleteLog=te(r)}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)}async rename(e,i,r){this.checkInitialized(),this.checkPath(e),this.checkPath(i);try{await this._writable.rename(e,i,r)}catch{if(this._deletedFiles.has(e))throw c.ENOENT(e)}}renameSync(e,i,r){this.checkInitialized(),this.checkPath(e),this.checkPath(i);try{this._writable.renameSync(e,i,r)}catch{if(this._deletedFiles.has(e))throw c.ENOENT(e)}}async stat(e,i){this.checkInitialized();try{return this._writable.stat(e,i)}catch{if(this._deletedFiles.has(e))throw c.ENOENT(e);let n=M.clone(await this._readable.stat(e,i));return n.mode|=146,n}}statSync(e,i){this.checkInitialized();try{return this._writable.statSync(e,i)}catch{if(this._deletedFiles.has(e))throw c.ENOENT(e);let n=M.clone(this._readable.statSync(e,i));return n.mode|=146,n}}async openFile(e,i,r){if(await this._writable.exists(e,r))return this._writable.openFile(e,i,r);let n=await this._readable.openFile(e,I.FromString("r"),r),o=M.clone(await n.stat()),{buffer:a}=await n.read(new Uint8Array(o.size));return new Mi(this,e,i,o,a)}openFileSync(e,i,r){if(this._writable.existsSync(e,r))return this._writable.openFileSync(e,i,r);let n=this._readable.openFileSync(e,I.FromString("r"),r),o=M.clone(n.statSync()),a=new Uint8Array(o.size);return n.readSync(a),new Mi(this,e,i,o,a)}async createFile(e,i,r,n){return this.checkInitialized(),await this._writable.createFile(e,i,r,n),this.openFile(e,i,n)}createFileSync(e,i,r,n){return this.checkInitialized(),this._writable.createFileSync(e,i,r,n),this.openFileSync(e,i,n)}async link(e,i,r){this.checkInitialized(),await this._writable.link(e,i,r)}linkSync(e,i,r){this.checkInitialized(),this._writable.linkSync(e,i,r)}async unlink(e,i){if(this.checkInitialized(),this.checkPath(e),!await this.exists(e,i))throw c.ENOENT(e);await this._writable.exists(e,i)&&await this._writable.unlink(e,i),await this.exists(e,i)&&this.deletePath(e,i)}unlinkSync(e,i){if(this.checkInitialized(),this.checkPath(e),!this.existsSync(e,i))throw c.ENOENT(e);this._writable.existsSync(e,i)&&this._writable.unlinkSync(e,i),this.existsSync(e,i)&&this.deletePath(e,i)}async rmdir(e,i){if(this.checkInitialized(),!await this.exists(e,i))throw c.ENOENT(e);if(await this._writable.exists(e,i)&&await this._writable.rmdir(e,i),await this.exists(e,i)){if((await this.readdir(e,i)).length>0)throw c.ENOTEMPTY(e);this.deletePath(e,i)}}rmdirSync(e,i){if(this.checkInitialized(),!this.existsSync(e,i))throw c.ENOENT(e);if(this._writable.existsSync(e,i)&&this._writable.rmdirSync(e,i),this.existsSync(e,i)){if(this.readdirSync(e,i).length>0)throw c.ENOTEMPTY(e);this.deletePath(e,i)}}async mkdir(e,i,r){if(this.checkInitialized(),await this.exists(e,r))throw c.EEXIST(e);await this.createParentDirectories(e,r),await this._writable.mkdir(e,i,r)}mkdirSync(e,i,r){if(this.checkInitialized(),this.existsSync(e,r))throw c.EEXIST(e);this.createParentDirectoriesSync(e,r),this._writable.mkdirSync(e,i,r)}async readdir(e,i){if(this.checkInitialized(),!(await this.stat(e,i)).isDirectory())throw c.ENOTDIR(e);let n=[];try{n.push(...await this._writable.readdir(e,i))}catch{}try{n.push(...(await this._readable.readdir(e,i)).filter(a=>!this._deletedFiles.has(`${e}/${a}`)))}catch{}let o={};return n.filter(a=>{let l=!o[a];return o[a]=!0,l})}readdirSync(e,i){if(this.checkInitialized(),!this.statSync(e,i).isDirectory())throw c.ENOTDIR(e);let n=[];try{n=n.concat(this._writable.readdirSync(e,i))}catch{}try{n=n.concat(this._readable.readdirSync(e,i).filter(a=>!this._deletedFiles.has(`${e}/${a}`)))}catch{}let o={};return n.filter(a=>{let l=!o[a];return o[a]=!0,l})}deletePath(e,i){this._deletedFiles.add(e),this.updateLog(`d${e}
|
|
3
3
|
`,i)}async updateLog(e,i){if(this._deleteLog+=e,this._deleteLogUpdatePending){this._deleteLogUpdateNeeded=!0;return}this._deleteLogUpdatePending=!0;let r=await this._writable.openFile(rs,I.FromString("w"),i);try{await r.write(U(this._deleteLog)),this._deleteLogUpdateNeeded&&(this._deleteLogUpdateNeeded=!1,this.updateLog("",i))}catch(n){this._deleteLogError=n}finally{this._deleteLogUpdatePending=!1}}_reparseDeletionLog(){this._deletedFiles.clear();for(let e of this._deleteLog.split(`
|
|
4
4
|
`))e.startsWith("d")&&this._deletedFiles.add(e.slice(1))}checkInitialized(){if(!this._isInitialized)throw new c(1,"OverlayFS is not initialized. Please initialize OverlayFS using its initialize() method before using it.");if(!this._deleteLogError)return;let e=this._deleteLogError;throw this._deleteLogError=null,e}checkPath(e){if(e==rs)throw c.EPERM(e)}createParentDirectoriesSync(e,i){let r=E(e),n=[];for(;!this._writable.existsSync(r,i);)n.push(r),r=E(r);n=n.reverse();for(let o of n)this._writable.mkdirSync(o,this.statSync(o,i).mode,i)}async createParentDirectories(e,i){let r=E(e),n=[];for(;!await this._writable.exists(r,i);)n.push(r),r=E(r);n=n.reverse();for(let o of n){let a=await this.stat(o,i);await this._writable.mkdir(o,a.mode,i)}}operateOnWritable(e,i){if(!this.existsSync(e,i))throw c.ENOENT(e);this._writable.existsSync(e,i)||this.copyToWritableSync(e,i)}async operateOnWritableAsync(e,i){if(!await this.exists(e,i))throw c.ENOENT(e);if(!await this._writable.exists(e,i))return this.copyToWritable(e,i)}copyToWritableSync(e,i){let r=this.statSync(e,i);if(r.isDirectory()){this._writable.mkdirSync(e,r.mode,i);return}let n=new Uint8Array(r.size),o=this._readable.openFileSync(e,I.FromString("r"),i);o.readSync(n),o.closeSync();let a=this._writable.openFileSync(e,I.FromString("w"),i);a.writeSync(n),a.closeSync()}async copyToWritable(e,i){let r=await this.stat(e,i);if(r.isDirectory()){await this._writable.mkdir(e,r.mode,i);return}let n=new Uint8Array(r.size),o=await this._readable.openFile(e,I.FromString("r"),i);await o.read(n),await o.close();let a=await this._writable.openFile(e,I.FromString("w"),i);await a.write(n),await a.close()}};s(Jr,"UnlockedOverlayFS");var Ui=class extends Di{async ready(){return await super.ready(),this}constructor(e){super(new Jr(e))}getOverlayedFileSystems(){return super.fs.getOverlayedFileSystems()}getDeletionLog(){return super.fs.getDeletionLog()}resDeletionLog(){return super.fs.getDeletionLog()}unwrap(){return super.fs}};s(Ui,"OverlayFS");var ns={name:"Overlay",options:{writable:{type:"object",required:!0,description:"The file system to write modified files to."},readable:{type:"object",required:!0,description:"The file system that initially populates this file system."}},isAvailable(){return!0},create(t){return new Ui(t)}};var Qr={};function Kc(...t){for(let e of t)Qr[e.name]=e}s(Kc,"registerBackend");Kc(is,bi,ns);function os(t){return t!=null&&typeof t=="object"&&"isAvailable"in t&&typeof t.isAvailable=="function"&&"create"in t&&typeof t.create=="function"}s(os,"isBackend");async function Ag(t,e){if(typeof e!="object"||e===null)throw new c(22,"Invalid options");for(let[i,r]of Object.entries(t.options)){let n=e&&r;if(n==null){if(!r.required)continue;let a=Object.keys(e).filter(l=>!(l in t.options)).map(l=>({str:l,distance:ln(i,l)})).filter(l=>l.distance<5).sort((l,u)=>l.distance-u.distance);throw new c(22,`${t.name}: Required option '${i}' not provided.${a.length>0?` You provided '${a[0].str}', did you mean '${i}'.`:""}`)}if(!(Array.isArray(r.type)?r.type.indexOf(typeof n)!=-1:typeof n==r.type))throw new c(22,`${t.name}: Value provided for option ${i} is not the proper type. Expected ${Array.isArray(r.type)?`one of {${r.type.join(", ")}}`:r.type}, but received ${typeof n}
|
|
5
|
-
Option description: ${r.description}`);r.validator&&await r.validator(n)}}s(Ag,"checkOptions");function kg(t){return t!=null&&typeof t=="object"&&"backend"in t}s(kg,"isBackendConfig");async function ss(t){let{backend:e}=t;if(!e)throw new c(1,"Missing backend");if(typeof t!="object"||t==null)throw new c(22,"Invalid options on configuration object.");let i=Object.keys(t).filter(n=>n!="backend");for(let n of i){let o=t[n];os(o)&&(o={backend:o}),kg(o)&&(t[n]=await ss(o))}if(!e)throw new c(1,`Backend "${e}" is not available`);Ag(e,t);let r=e.create(t);return await r.ready(),r}s(ss,"resolveBackendConfig");var Zr=class{constructor(e){this.limit=e}cache=[];set(e,i){let r=this.cache.findIndex(n=>n.key===e);r!=-1?this.cache.splice(r,1):this.cache.length>=this.limit&&this.cache.shift(),this.cache.push({key:e,value:i})}get(e){let i=this.cache.find(r=>r.key===e);if(i)return this.set(e,i.value),i.value}remove(e){let i=this.cache.findIndex(r=>r.key===e);i!==-1&&this.cache.splice(i,1)}reset(){this.cache=[]}};s(Zr,"LRUCache");var li=class extends ne{constructor(e,i,r,n,o){super(e,i,r,n,o)}async sync(){this.isDirty()&&(await this.fs.sync(this.path,this._buffer,this.stats),this.resetDirty())}syncSync(){throw new c(95)}async close(){this.sync()}closeSync(){throw new c(95)}};s(li,"AsyncFile");var en=class extends pi(J){store;_cache;_ready;ready(){return this._ready}metadata(){return{...super.metadata(),name:this.store.name}}constructor({store:e,cacheSize:i}){super(),i>0&&(this._cache=new Zr(i)),this._ready=this._initialize(e)}async _initialize(e){return this.store=await e,await this.makeRootDirectory(),this}async empty(){this._cache&&this._cache.reset(),await this.store.clear(),await this.makeRootDirectory()}async rename(e,i,r){let n=this._cache;this._cache&&(this._cache=null,n.reset());try{let o=this.store.beginTransaction("readwrite"),a=E(e),l=R(e),u=E(i),f=R(i),d=await this.findINode(o,a),h=await this.getDirListing(o,d,a);if(!d.toStats().hasAccess(2,r))throw c.EACCES(e);if(!h[l])throw c.ENOENT(e);let b=h[l];if(delete h[l],(u+"/").indexOf(e+"/")===0)throw new c(16,a);let m,g;if(u===a?(m=d,g=h):(m=await this.findINode(o,u),g=await this.getDirListing(o,m,u)),g[f]){let y=await this.getINode(o,g[f],i);if(y.toStats().isFile())try{await o.remove(y.ino),await o.remove(g[f])}catch(k){throw await o.abort(),k}else throw c.EPERM(i)}g[f]=b;try{await o.put(d.ino,ae(h),!0),await o.put(m.ino,ae(g),!0)}catch(y){throw await o.abort(),y}await o.commit()}finally{n&&(this._cache=n)}}async stat(e,i){let r=this.store.beginTransaction("readonly"),n=await this.findINode(r,e);if(!n)throw c.ENOENT(e);let o=n.toStats();if(!o.hasAccess(4,i))throw c.EACCES(e);return o}async createFile(e,i,r,n){let o=this.store.beginTransaction("readwrite"),a=new Uint8Array(0),l=await this.commitNewFile(o,e,C.FILE,r,n,a);return new li(this,e,i,l.toStats(),a)}async openFile(e,i,r){let n=this.store.beginTransaction("readonly"),o=await this.findINode(n,e),a=await n.get(o.ino);if(!o.toStats().hasAccess(i.mode,r))throw c.EACCES(e);if(!a)throw c.ENOENT(e);return new li(this,e,i,o.toStats(),a)}async unlink(e,i){return this.removeEntry(e,!1,i)}async rmdir(e,i){if((await this.readdir(e,i)).length>0)throw c.ENOTEMPTY(e);await this.removeEntry(e,!0,i)}async mkdir(e,i,r){let n=this.store.beginTransaction("readwrite"),o=U("{}");await this.commitNewFile(n,e,C.DIRECTORY,i,r,o)}async readdir(e,i){let r=this.store.beginTransaction("readonly"),n=await this.findINode(r,e);if(!n.toStats().hasAccess(4,i))throw c.EACCES(e);return Object.keys(await this.getDirListing(r,n,e))}async sync(e,i,r){let n=this.store.beginTransaction("readwrite"),o=await this._findINode(n,E(e),R(e)),a=await this.getINode(n,o,e),l=a.update(r);try{await n.put(a.ino,i,!0),l&&await n.put(o,a.data,!0)}catch(u){throw await n.abort(),u}await n.commit()}async link(e,i,r){let n=this.store.beginTransaction("readwrite"),o=E(e);if(!(await this.findINode(n,o)).toStats().hasAccess(4,r))throw c.EACCES(o);let l=E(i),u=await this.findINode(n,l),f=await this.getDirListing(n,u,l);if(!u.toStats().hasAccess(2,r))throw c.EACCES(l);let d=await this._findINode(n,o,R(e)),h=await this.getINode(n,d,e);if(!h.toStats().hasAccess(2,r))throw c.EACCES(i);h.nlink++,f[R(i)]=d;try{n.put(d,h.data,!0),n.put(u.ino,ae(f),!0)}catch(b){throw n.abort(),b}n.commit()}async makeRootDirectory(){let e=this.store.beginTransaction("readwrite");if(await e.get(he)===void 0){let i=new de;i.mode=511|C.DIRECTORY,await e.put(i.ino,U("{}"),!1),await e.put(he,i.data,!1),await e.commit()}}async _findINode(e,i,r,n=new Set){let o=fe(i,r);if(n.has(o))throw new c(5,"Infinite loop detected while finding inode",o);if(n.add(o),this._cache){let a=this._cache.get(o);if(a)return a}if(i==="/"){if(r==="")return this._cache&&this._cache.set(o,he),he;{let a=await this.getINode(e,he,i),l=await this.getDirListing(e,a,i);if(l[r]){let u=l[r];return this._cache&&this._cache.set(o,u),u}else throw c.ENOENT(Ae(i,r))}}else{let a=await this.findINode(e,i,n),l=await this.getDirListing(e,a,i);if(l[r]){let u=l[r];return this._cache&&this._cache.set(o,u),u}else throw c.ENOENT(Ae(i,r))}}async findINode(e,i,r=new Set){let n=await this._findINode(e,E(i),R(i),r);return this.getINode(e,n,i)}async getINode(e,i,r){let n=await e.get(i);if(!n)throw c.ENOENT(r);return new de(n.buffer)}async getDirListing(e,i,r){if(!i.toStats().isDirectory())throw c.ENOTDIR(r);let n=await e.get(i.ino);if(!n)throw c.ENOENT(r);return yi(n)}async addNewNode(e,i){let r=0,n=s(async()=>{if(++r===5)throw new c(5,"Unable to commit data to key-value store.");{let o=Ct();return await e.put(o,i,!1)?o:n()}},"reroll");return n()}async commitNewFile(e,i,r,n,o,a){let l=E(i),u=R(i),f=await this.findINode(e,l),d=await this.getDirListing(e,f,l);if(!f.toStats().hasAccess(2,o))throw c.EACCES(i);if(i==="/")throw c.EEXIST(i);if(d[u])throw await e.abort(),c.EEXIST(i);try{let h=new de;return h.ino=await this.addNewNode(e,a),h.mode=n|r,h.uid=o.uid,h.gid=o.gid,h.size=a.length,d[u]=await this.addNewNode(e,h.data),await e.put(f.ino,ae(d),!0),await e.commit(),h}catch(h){throw e.abort(),h}}async removeEntry(e,i,r){this._cache&&this._cache.remove(e);let n=this.store.beginTransaction("readwrite"),o=E(e),a=await this.findINode(n,o),l=await this.getDirListing(n,a,o),u=R(e);if(!l[u])throw c.ENOENT(e);let f=l[u],d=await this.getINode(n,f,e);if(!d.toStats().hasAccess(2,r))throw c.EACCES(e);if(delete l[u],!i&&d.toStats().isDirectory())throw c.EISDIR(e);if(i&&!d.toStats().isDirectory())throw c.ENOTDIR(e);try{await n.put(a.ino,ae(l),!0),--d.nlink<1&&(await n.remove(d.ino),await n.remove(f))}catch(h){throw await n.abort(),h}await n.commit()}};s(en,"AsyncStoreFS");var xt=class{static FromListing(e){let i=new xt,r=new He;i._index.set("/",r);let n=[{pwd:"",tree:e,parent:r}];for(;n.length>0;){let o,{tree:a,pwd:l,parent:u}=n.pop();for(let f in a){if(!Object.hasOwn(a,f))continue;let d=a[f];if(d){let h=l+"/"+f;o=new He,i._index.set(h,o),n.push({pwd:h,tree:d,parent:o})}else o=new Wi(new M(C.FILE,-1,365));u&&u._listing.set(f,o)}}return i}_index=new Map;constructor(){this.add("/",new He)}files(){let e=[];for(let i of this._index.values())for(let r of i.listing){let n=i.get(r);n?.isFile()&&e.push(n)}return e}add(e,i){if(!i)throw new Error("Inode must be specified");if(!e.startsWith("/"))throw new Error("Path must be absolute, got: "+e);if(this._index.has(e))return this._index.get(e)===i;let r=E(e),n=this._index.get(r);return!n&&e!="/"&&(n=new He,!this.add(r,n))||e!="/"&&!n.add(R(e),i)?!1:(i.isDirectory()&&this._index.set(e,i),!0)}addFast(e,i){let r=E(e),n=R(e),o=this._index.get(r);return o||(o=new He,this.addFast(r,o)),o.add(n,i)?(i.isDirectory()&&this._index.set(e,i),!0):!1}remove(e){let i=E(e),r=this._index.get(i);if(!r)return;let n=r.remove(R(e));if(!n)return;if(!n.isDirectory())return n;let o=n.listing;for(let a of o)this.remove(fe(e,a));e!="/"&&this._index.delete(e)}ls(e){return this._index.get(e)?.listing}get(e){let i=E(e),r=this._index.get(i);return i==e?r:r?.get(R(e))}};s(xt,"FileIndex");var ci=class{constructor(e){this.data=e}};s(ci,"IndexInode");var Wi=class extends ci{isFile(){return!0}isDirectory(){return!1}toStats(){return new M(C.FILE,4096,438)}};s(Wi,"IndexFileInode");var He=class extends ci{_listing=new Map;isFile(){return!1}isDirectory(){return!0}get stats(){return new M(C.DIRECTORY,4096,365)}toStats(){return this.stats}get listing(){return[...this._listing.keys()]}get(e){return this._listing.get(e)}add(e,i){return this._listing.has(e)?!1:(this._listing.set(e,i),!0)}remove(e){let i=this._listing.get(e);if(i)return this._listing.delete(e),i}};s(He,"IndexDirInode");var ui=class extends an(J){_index;constructor(e){super(),this._index=xt.FromListing(e)}async stat(e){let i=this._index.get(e);if(!i)throw c.ENOENT(e);if(i.isDirectory())return i.stats;if(i.isFile())return this.statFileInode(i);throw new c(22,"Invalid inode.")}statSync(e){let i=this._index.get(e);if(!i)throw c.ENOENT(e);if(i.isDirectory())return i.stats;if(i.isFile())return this.statFileInodeSync(i);throw new c(22,"Invalid inode.")}async openFile(e,i,r){if(i.isWriteable())throw new c(1,e);let n=this._index.get(e);if(!n)throw c.ENOENT(e);if(!n.toStats().hasAccess(i.mode,r))throw c.EACCES(e);if(n.isDirectory()){let o=n.stats;return new ot(this,e,i,o,o.fileData)}return this.fileForFileInode(n,e,i)}openFileSync(e,i,r){if(i.isWriteable())throw new c(1,e);let n=this._index.get(e);if(!n)throw c.ENOENT(e);if(!n.toStats().hasAccess(i.mode,r))throw c.EACCES(e);if(n.isDirectory()){let o=n.stats;return new ot(this,e,i,o,o.fileData)}return this.fileForFileInodeSync(n,e,i)}async readdir(e){let i=this._index.get(e);if(!i)throw c.ENOENT(e);if(i.isDirectory())return i.listing;throw c.ENOTDIR(e)}readdirSync(e){let i=this._index.get(e);if(!i)throw c.ENOENT(e);if(i.isDirectory())return i.listing;throw c.ENOTDIR(e)}};s(ui,"FileIndexFS");var tn=class extends st(ui){async statFileInode(e){return this.statFileInodeSync(e)}async fileForFileInode(e,i,r){return this.fileForFileInodeSync(e,i,r)}};s(tn,"SyncFileIndexFS");var rn=class extends pi(ui){statFileInodeSync(){throw new c(95)}fileForFileInodeSync(){throw new c(95)}};s(rn,"AsyncFileIndexFS");function Yc(t,e=0,i=0){ps(new z(e,i,e,i,e,i)),Zi(t)}s(Yc,"initialize");async function Ng(t){("backend"in t||t instanceof J)&&(t={"/":t});for(let[e,i]of Object.entries(t))typeof i!="number"&&(i instanceof J||(typeof i=="string"&&(i={backend:Qr[i]}),os(i)&&(i={backend:i}),t[e]=await ss(i)));Yc(t)}s(Ng,"configure");var Tg=Gr;return ru(Fg);})();
|
|
5
|
+
Option description: ${r.description}`);r.validator&&await r.validator(n)}}s(Ag,"checkOptions");function kg(t){return t!=null&&typeof t=="object"&&"backend"in t}s(kg,"isBackendConfig");async function ss(t){let{backend:e}=t;if(!e)throw new c(1,"Missing backend");if(typeof t!="object"||t==null)throw new c(22,"Invalid options on configuration object.");let i=Object.keys(t).filter(n=>n!="backend");for(let n of i){let o=t[n];os(o)&&(o={backend:o}),kg(o)&&(t[n]=await ss(o))}if(!e)throw new c(1,`Backend "${e}" is not available`);Ag(e,t);let r=e.create(t);return await r.ready(),r}s(ss,"resolveBackendConfig");var Zr=class{constructor(e){this.limit=e}cache=[];set(e,i){let r=this.cache.findIndex(n=>n.key===e);r!=-1?this.cache.splice(r,1):this.cache.length>=this.limit&&this.cache.shift(),this.cache.push({key:e,value:i})}get(e){let i=this.cache.find(r=>r.key===e);if(i)return this.set(e,i.value),i.value}remove(e){let i=this.cache.findIndex(r=>r.key===e);i!==-1&&this.cache.splice(i,1)}reset(){this.cache=[]}};s(Zr,"LRUCache");var li=class extends ne{constructor(e,i,r,n,o){super(e,i,r,n,o)}async sync(){this.isDirty()&&(await this.fs.sync(this.path,this._buffer,this.stats),this.resetDirty())}syncSync(){throw new c(95)}async close(){this.sync()}closeSync(){throw new c(95)}};s(li,"AsyncFile");var en=class extends pi(J){store;_cache;_ready;ready(){return this._ready}metadata(){return{...super.metadata(),name:this.store.name}}constructor({store:e,cacheSize:i}){super(),i>0&&(this._cache=new Zr(i)),this._ready=this._initialize(e)}async _initialize(e){return this.store=await e,await this.makeRootDirectory(),this}async empty(){this._cache&&this._cache.reset(),await this.store.clear(),await this.makeRootDirectory()}async rename(e,i,r){let n=this._cache;this._cache&&(this._cache=null,n.reset());try{let o=this.store.beginTransaction("readwrite"),a=E(e),l=R(e),u=E(i),f=R(i),d=await this.findINode(o,a),h=await this.getDirListing(o,d,a);if(!d.toStats().hasAccess(2,r))throw c.EACCES(e);if(!h[l])throw c.ENOENT(e);let b=h[l];if(delete h[l],(u+"/").indexOf(e+"/")===0)throw new c(16,a);let m,g;if(u===a?(m=d,g=h):(m=await this.findINode(o,u),g=await this.getDirListing(o,m,u)),g[f]){let y=await this.getINode(o,g[f],i);if(y.toStats().isFile())try{await o.remove(y.ino),await o.remove(g[f])}catch(k){throw await o.abort(),k}else throw c.EPERM(i)}g[f]=b;try{await o.put(d.ino,ae(h),!0),await o.put(m.ino,ae(g),!0)}catch(y){throw await o.abort(),y}await o.commit()}finally{n&&(this._cache=n)}}async stat(e,i){let r=this.store.beginTransaction("readonly"),n=await this.findINode(r,e);if(!n)throw c.ENOENT(e);let o=n.toStats();if(!o.hasAccess(4,i))throw c.EACCES(e);return o}async createFile(e,i,r,n){let o=this.store.beginTransaction("readwrite"),a=new Uint8Array(0),l=await this.commitNewFile(o,e,C.FILE,r,n,a);return new li(this,e,i,l.toStats(),a)}async openFile(e,i,r){let n=this.store.beginTransaction("readonly"),o=await this.findINode(n,e),a=await n.get(o.ino);if(!o.toStats().hasAccess(i.mode,r))throw c.EACCES(e);if(!a)throw c.ENOENT(e);return new li(this,e,i,o.toStats(),a)}async unlink(e,i){return this.removeEntry(e,!1,i)}async rmdir(e,i){if((await this.readdir(e,i)).length>0)throw c.ENOTEMPTY(e);await this.removeEntry(e,!0,i)}async mkdir(e,i,r){let n=this.store.beginTransaction("readwrite"),o=U("{}");await this.commitNewFile(n,e,C.DIRECTORY,i,r,o)}async readdir(e,i){let r=this.store.beginTransaction("readonly"),n=await this.findINode(r,e);if(!n.toStats().hasAccess(4,i))throw c.EACCES(e);return Object.keys(await this.getDirListing(r,n,e))}async sync(e,i,r){let n=this.store.beginTransaction("readwrite"),o=await this._findINode(n,E(e),R(e)),a=await this.getINode(n,o,e),l=a.update(r);try{await n.put(a.ino,i,!0),l&&await n.put(o,a.data,!0)}catch(u){throw await n.abort(),u}await n.commit()}async link(e,i,r){let n=this.store.beginTransaction("readwrite"),o=E(e);if(!(await this.findINode(n,o)).toStats().hasAccess(4,r))throw c.EACCES(o);let l=E(i),u=await this.findINode(n,l),f=await this.getDirListing(n,u,l);if(!u.toStats().hasAccess(2,r))throw c.EACCES(l);let d=await this._findINode(n,o,R(e)),h=await this.getINode(n,d,e);if(!h.toStats().hasAccess(2,r))throw c.EACCES(i);h.nlink++,f[R(i)]=d;try{n.put(d,h.data,!0),n.put(u.ino,ae(f),!0)}catch(b){throw n.abort(),b}n.commit()}async makeRootDirectory(){let e=this.store.beginTransaction("readwrite");if(await e.get(he)===void 0){let i=new de;i.mode=511|C.DIRECTORY,await e.put(i.ino,U("{}"),!1),await e.put(he,i.data,!1),await e.commit()}}async _findINode(e,i,r,n=new Set){let o=fe(i,r);if(n.has(o))throw new c(5,"Infinite loop detected while finding inode",o);if(n.add(o),this._cache){let a=this._cache.get(o);if(a)return a}if(i==="/"){if(r==="")return this._cache&&this._cache.set(o,he),he;{let a=await this.getINode(e,he,i),l=await this.getDirListing(e,a,i);if(l[r]){let u=l[r];return this._cache&&this._cache.set(o,u),u}else throw c.ENOENT(Ae(i,r))}}else{let a=await this.findINode(e,i,n),l=await this.getDirListing(e,a,i);if(l[r]){let u=l[r];return this._cache&&this._cache.set(o,u),u}else throw c.ENOENT(Ae(i,r))}}async findINode(e,i,r=new Set){let n=await this._findINode(e,E(i),R(i),r);return this.getINode(e,n,i)}async getINode(e,i,r){let n=await e.get(i);if(!n)throw c.ENOENT(r);return new de(n.buffer)}async getDirListing(e,i,r){if(!i.toStats().isDirectory())throw c.ENOTDIR(r);let n=await e.get(i.ino);if(!n)throw c.ENOENT(r);return yi(n)}async addNewNode(e,i){let r=0,n=s(async()=>{if(++r===5)throw new c(5,"Unable to commit data to key-value store.");{let o=Ct();return await e.put(o,i,!1)?o:n()}},"reroll");return n()}async commitNewFile(e,i,r,n,o,a){let l=E(i),u=R(i),f=await this.findINode(e,l),d=await this.getDirListing(e,f,l);if(!f.toStats().hasAccess(2,o))throw c.EACCES(i);if(i==="/")throw c.EEXIST(i);if(d[u])throw await e.abort(),c.EEXIST(i);try{let h=new de;return h.ino=await this.addNewNode(e,a),h.mode=n|r,h.uid=o.uid,h.gid=o.gid,h.size=a.length,d[u]=await this.addNewNode(e,h.data),await e.put(f.ino,ae(d),!0),await e.commit(),h}catch(h){throw e.abort(),h}}async removeEntry(e,i,r){this._cache&&this._cache.remove(e);let n=this.store.beginTransaction("readwrite"),o=E(e),a=await this.findINode(n,o),l=await this.getDirListing(n,a,o),u=R(e);if(!l[u])throw c.ENOENT(e);let f=l[u],d=await this.getINode(n,f,e);if(!d.toStats().hasAccess(2,r))throw c.EACCES(e);if(delete l[u],!i&&d.toStats().isDirectory())throw c.EISDIR(e);if(i&&!d.toStats().isDirectory())throw c.ENOTDIR(e);try{await n.put(a.ino,ae(l),!0),--d.nlink<1&&(await n.remove(d.ino),await n.remove(f))}catch(h){throw await n.abort(),h}await n.commit()}};s(en,"AsyncStoreFS");var xt=class{static FromListing(e){let i=new xt,r=new He;i._index.set("/",r);let n=[{pwd:"",tree:e,parent:r}];for(;n.length>0;){let o,{tree:a,pwd:l,parent:u}=n.pop();for(let f in a){if(!Object.hasOwn(a,f))continue;let d=a[f];if(d){let h=l+"/"+f;o=new He,i._index.set(h,o),n.push({pwd:h,tree:d,parent:o})}else o=new Wi(new M(C.FILE,-1,365));u&&u._listing.set(f,o)}}return i}_index=new Map;constructor(){this.add("/",new He)}files(){let e=[];for(let i of this._index.values())for(let r of i.listing){let n=i.get(r);n?.isFile()&&e.push(n)}return e}add(e,i){if(!i)throw new Error("Inode must be specified");if(!e.startsWith("/"))throw new Error("Path must be absolute, got: "+e);if(this._index.has(e))return this._index.get(e)===i;let r=E(e),n=this._index.get(r);return!n&&e!="/"&&(n=new He,!this.add(r,n))||e!="/"&&!n.add(R(e),i)?!1:(i.isDirectory()&&this._index.set(e,i),!0)}addFast(e,i){let r=E(e),n=R(e),o=this._index.get(r);return o||(o=new He,this.addFast(r,o)),o.add(n,i)?(i.isDirectory()&&this._index.set(e,i),!0):!1}remove(e){let i=E(e),r=this._index.get(i);if(!r)return;let n=r.remove(R(e));if(!n)return;if(!n.isDirectory())return n;let o=n.listing;for(let a of o)this.remove(fe(e,a));e!="/"&&this._index.delete(e)}ls(e){return this._index.get(e)?.listing}get(e){let i=E(e),r=this._index.get(i);return i==e?r:r?.get(R(e))}};s(xt,"FileIndex");var ci=class{constructor(e){this.data=e}};s(ci,"IndexInode");var Wi=class extends ci{isFile(){return!0}isDirectory(){return!1}toStats(){return new M(C.FILE,4096,438)}};s(Wi,"IndexFileInode");var He=class extends ci{_listing=new Map;isFile(){return!1}isDirectory(){return!0}get stats(){return new M(C.DIRECTORY,4096,365)}toStats(){return this.stats}get listing(){return[...this._listing.keys()]}get(e){return this._listing.get(e)}add(e,i){return this._listing.has(e)?!1:(this._listing.set(e,i),!0)}remove(e){let i=this._listing.get(e);if(i)return this._listing.delete(e),i}};s(He,"IndexDirInode");var ui=class extends an(J){_index;constructor(e){super(),this._index=xt.FromListing(e)}async stat(e){let i=this._index.get(e);if(!i)throw c.ENOENT(e);if(i.isDirectory())return i.stats;if(i.isFile())return this.statFileInode(i,e);throw new c(22,"Invalid inode.")}statSync(e){let i=this._index.get(e);if(!i)throw c.ENOENT(e);if(i.isDirectory())return i.stats;if(i.isFile())return this.statFileInodeSync(i,e);throw new c(22,"Invalid inode.")}async openFile(e,i,r){if(i.isWriteable())throw new c(1,e);let n=this._index.get(e);if(!n)throw c.ENOENT(e);if(!n.toStats().hasAccess(i.mode,r))throw c.EACCES(e);if(n.isDirectory()){let o=n.stats;return new ot(this,e,i,o,o.fileData)}return this.openFileInode(n,e,i)}openFileSync(e,i,r){if(i.isWriteable())throw new c(1,e);let n=this._index.get(e);if(!n)throw c.ENOENT(e);if(!n.toStats().hasAccess(i.mode,r))throw c.EACCES(e);if(n.isDirectory()){let o=n.stats;return new ot(this,e,i,o,o.fileData)}return this.openFileInodeSync(n,e,i)}async readdir(e){let i=this._index.get(e);if(!i)throw c.ENOENT(e);if(i.isDirectory())return i.listing;throw c.ENOTDIR(e)}readdirSync(e){let i=this._index.get(e);if(!i)throw c.ENOENT(e);if(i.isDirectory())return i.listing;throw c.ENOTDIR(e)}};s(ui,"FileIndexFS");var tn=class extends st(ui){async statFileInode(e,i){return this.statFileInodeSync(e,i)}async openFileInode(e,i,r){return this.openFileInodeSync(e,i,r)}};s(tn,"SyncFileIndexFS");var rn=class extends pi(ui){statFileInodeSync(){throw new c(95)}openFileInodeSync(){throw new c(95)}};s(rn,"AsyncFileIndexFS");function Yc(t,e=0,i=0){ps(new z(e,i,e,i,e,i)),Zi(t)}s(Yc,"initialize");async function Ng(t){("backend"in t||t instanceof J)&&(t={"/":t});for(let[e,i]of Object.entries(t))typeof i!="number"&&(i instanceof J||(typeof i=="string"&&(i={backend:Qr[i]}),os(i)&&(i={backend:i}),t[e]=await ss(i)));Yc(t)}s(Ng,"configure");var Tg=Gr;return ru(Fg);})();
|
|
6
6
|
/*! Bundled license information:
|
|
7
7
|
|
|
8
8
|
ieee754/index.js:
|