@legit-sdk/assistant-ui 0.2.11 → 0.2.12
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/index.js +70 -65
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,33 +1,33 @@
|
|
|
1
1
|
// @legit-sdk/assistant-ui bundle (ESM)
|
|
2
2
|
// Generated by esbuild
|
|
3
3
|
|
|
4
|
-
var cN=Object.create;var xn=Object.defineProperty;var lN=Object.getOwnPropertyDescriptor;var fN=Object.getOwnPropertyNames;var uN=Object.getPrototypeOf,hN=Object.prototype.hasOwnProperty;var Cb=t=>{throw TypeError(t)};var dN=(t,e,r)=>e in t?xn(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var l=(t,e)=>xn(t,"name",{value:e,configurable:!0}),ne=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,r)=>(typeof require<"u"?require:e)[r]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var pN=(t,e)=>()=>(t&&(e=t(t=0)),e);var T=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),mN=(t,e)=>{for(var r in e)xn(t,r,{get:e[r],enumerable:!0})},Db=(t,e,r,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of fN(e))!hN.call(t,n)&&n!==r&&xn(t,n,{get:()=>e[n],enumerable:!(i=lN(e,n))||i.enumerable});return t};var le=(t,e,r)=>(r=t!=null?cN(uN(t)):{},Db(e||!t||!t.__esModule?xn(r,"default",{value:t,enumerable:!0}):r,t)),Ad=t=>Db(xn({},"__esModule",{value:!0}),t);var U=(t,e,r)=>dN(t,typeof e!="symbol"?e+"":e,r),Ib=(t,e,r)=>e.has(t)||Cb("Cannot "+r);var ta=(t,e,r)=>(Ib(t,e,"read from private field"),r?r.call(t):e.get(t)),ra=(t,e,r)=>e.has(t)?Cb("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),ia=(t,e,r,i)=>(Ib(t,e,"write to private field"),i?i.call(t,r):e.set(t,r),r);var rl=T((X7,tl)=>{function p0(t){return Array.isArray(t)?t:[t]}l(p0,"makeArray");var EN=void 0,qd="",h0=" ",jd="\\",FN=/^\s+$/,TN=/(?:[^\\]|^)\\$/,kN=/^\\!/,RN=/^\\#/,ON=/\r?\n/g,xN=/^\.{0,2}\/|^\.{1,2}$/,AN=/\/$/,ls="/",m0="node-ignore";typeof Symbol<"u"&&(m0=Symbol.for("node-ignore"));var w0=m0,fs=l((t,e,r)=>(Object.defineProperty(t,e,{value:r}),r),"define"),PN=/([0-z])-([0-z])/g,y0=l(()=>!1,"RETURN_FALSE"),NN=l(t=>t.replace(PN,(e,r,i)=>r.charCodeAt(0)<=i.charCodeAt(0)?e:qd),"sanitizeRange"),CN=l(t=>{let{length:e}=t;return t.slice(0,e-e%2)},"cleanRangeBackSlash"),DN=[[/^\uFEFF/,()=>qd],[/((?:\\\\)*?)(\\?\s+)$/,(t,e,r)=>e+(r.indexOf("\\")===0?h0:qd)],[/(\\+?)\s/g,(t,e)=>{let{length:r}=e;return e.slice(0,r-r%2)+h0}],[/[\\$.|*+(){^]/g,t=>`\\${t}`],[/(?!\\)\?/g,()=>"[^/]"],[/^\//,()=>"^"],[/\//g,()=>"\\/"],[/^\^*\\\*\\\*\\\//,()=>"^(?:.*\\/)?"],[/^(?=[^^])/,l(function(){return/\/(?!$)/.test(this)?"^":"(?:^|\\/)"},"startingReplacer")],[/\\\/\\\*\\\*(?=\\\/|$)/g,(t,e,r)=>e+6<r.length?"(?:\\/[^\\/]+)*":"\\/.+"],[/(^|[^\\]+)(\\\*)+(?=.+)/g,(t,e,r)=>{let i=r.replace(/\\\*/g,"[^\\/]*");return e+i}],[/\\\\\\(?=[$.|*+(){^])/g,()=>jd],[/\\\\/g,()=>jd],[/(\\)?\[([^\]/]*?)(\\*)($|\])/g,(t,e,r,i,n)=>e===jd?`\\[${r}${CN(i)}${n}`:n==="]"&&i.length%2===0?`[${NN(r)}${i}]`:"[]"],[/(?:[^*])$/,t=>/\/$/.test(t)?`${t}$`:`${t}(?=$|\\/$)`]],IN=/(^|\\\/)?\\\*$/,fa="regex",Qc="checkRegex",d0="_",$N={[fa](t,e){return`${e?`${e}[^/]+`:"[^/]*"}(?=$|\\/$)`},[Qc](t,e){return`${e?`${e}[^/]*`:"[^/]*"}(?=$|\\/$)`}},BN=l(t=>DN.reduce((e,[r,i])=>e.replace(r,i.bind(t)),t),"makeRegexPrefix"),el=l(t=>typeof t=="string","isString"),MN=l(t=>t&&el(t)&&!FN.test(t)&&!TN.test(t)&&t.indexOf("#")!==0,"checkPattern"),LN=l(t=>t.split(ON).filter(Boolean),"splitPattern"),Vd=class Vd{constructor(e,r,i,n,s,o){this.pattern=e,this.mark=r,this.negative=s,fs(this,"body",i),fs(this,"ignoreCase",n),fs(this,"regexPrefix",o)}get regex(){let e=d0+fa;return this[e]?this[e]:this._make(fa,e)}get checkRegex(){let e=d0+Qc;return this[e]?this[e]:this._make(Qc,e)}_make(e,r){let i=this.regexPrefix.replace(IN,$N[e]),n=this.ignoreCase?new RegExp(i,"i"):new RegExp(i);return fs(this,r,n)}};l(Vd,"IgnoreRule");var Ud=Vd,jN=l(({pattern:t,mark:e},r)=>{let i=!1,n=t;n.indexOf("!")===0&&(i=!0,n=n.substr(1)),n=n.replace(kN,"!").replace(RN,"#");let s=BN(n);return new Ud(t,e,n,r,i,s)},"createRule"),Gd=class Gd{constructor(e){this._ignoreCase=e,this._rules=[]}_add(e){if(e&&e[w0]){this._rules=this._rules.concat(e._rules._rules),this._added=!0;return}if(el(e)&&(e={pattern:e}),MN(e.pattern)){let r=jN(e,this._ignoreCase);this._added=!0,this._rules.push(r)}}add(e){return this._added=!1,p0(el(e)?LN(e):e).forEach(this._add,this),this._added}test(e,r,i){let n=!1,s=!1,o;this._rules.forEach(c=>{let{negative:a}=c;s===a&&n!==s||a&&!n&&!s&&!r||!c[i].test(e)||(n=!a,s=a,o=a?EN:c)});let f={ignored:n,unignored:s};return o&&(f.rule=o),f}};l(Gd,"RuleManager");var Wd=Gd,qN=l((t,e)=>{throw new e(t)},"throwError"),Tr=l((t,e,r)=>el(t)?t?Tr.isNotRelative(t)?r(`path should be a \`path.relative()\`d string, but got "${e}"`,RangeError):!0:r("path must not be empty",TypeError):r(`path must be a string, but got \`${e}\``,TypeError),"checkPath"),g0=l(t=>xN.test(t),"isNotRelative");Tr.isNotRelative=g0;Tr.convert=t=>t;var Kd=class Kd{constructor({ignorecase:e=!0,ignoreCase:r=e,allowRelativePaths:i=!1}={}){fs(this,w0,!0),this._rules=new Wd(r),this._strictPathCheck=!i,this._initCache()}_initCache(){this._ignoreCache=Object.create(null),this._testCache=Object.create(null)}add(e){return this._rules.add(e)&&this._initCache(),this}addPattern(e){return this.add(e)}_test(e,r,i,n){let s=e&&Tr.convert(e);return Tr(s,e,this._strictPathCheck?qN:y0),this._t(s,r,i,n)}checkIgnore(e){if(!AN.test(e))return this.test(e);let r=e.split(ls).filter(Boolean);if(r.pop(),r.length){let i=this._t(r.join(ls)+ls,this._testCache,!0,r);if(i.ignored)return i}return this._rules.test(e,!1,Qc)}_t(e,r,i,n){if(e in r)return r[e];if(n||(n=e.split(ls).filter(Boolean)),n.pop(),!n.length)return r[e]=this._rules.test(e,i,fa);let s=this._t(n.join(ls)+ls,r,i,n);return r[e]=s.ignored?s:this._rules.test(e,i,fa)}ignores(e){return this._test(e,this._ignoreCache,!1).ignored}createFilter(){return e=>!this.ignores(e)}filter(e){return p0(e).filter(this.createFilter())}test(e){return this._test(e,this._testCache,!0)}};l(Kd,"Ignore");var zd=Kd,Hd=l(t=>new zd(t),"factory"),UN=l(t=>Tr(t&&Tr.convert(t),t,y0),"isPathValid"),b0=l(()=>{let t=l(r=>/^\\\\\?\\/.test(r)||/["<>|\u0000-\u001F]+/u.test(r)?r:r.replace(/\\/g,"/"),"makePosix");Tr.convert=t;let e=/^[a-z]:\//i;Tr.isNotRelative=r=>e.test(r)||g0(r)},"setupWindows");typeof process<"u"&&process.platform==="win32"&&b0();tl.exports=Hd;Hd.default=Hd;tl.exports.isPathValid=UN;fs(tl.exports,Symbol.for("setupWindows"),b0)});var Gt=T(us=>{"use strict";Object.defineProperty(us,"__esModule",{value:!0});us.constants=us.SEP=void 0;us.SEP="/";us.constants={O_RDONLY:0,O_WRONLY:1,O_RDWR:2,S_IFMT:61440,S_IFREG:32768,S_IFDIR:16384,S_IFCHR:8192,S_IFBLK:24576,S_IFIFO:4096,S_IFLNK:40960,S_IFSOCK:49152,O_CREAT:64,O_EXCL:128,O_NOCTTY:256,O_TRUNC:512,O_APPEND:1024,O_DIRECTORY:65536,O_NOATIME:262144,O_NOFOLLOW:131072,O_SYNC:1052672,O_SYMLINK:2097152,O_DIRECT:16384,O_NONBLOCK:2048,S_IRWXU:448,S_IRUSR:256,S_IWUSR:128,S_IXUSR:64,S_IRWXG:56,S_IRGRP:32,S_IWGRP:16,S_IXGRP:8,S_IRWXO:7,S_IROTH:4,S_IWOTH:2,S_IXOTH:1,F_OK:0,R_OK:4,W_OK:2,X_OK:1,UV_FS_SYMLINK_DIR:1,UV_FS_SYMLINK_JUNCTION:2,UV_FS_COPYFILE_EXCL:1,UV_FS_COPYFILE_FICLONE:2,UV_FS_COPYFILE_FICLONE_FORCE:4,COPYFILE_EXCL:1,COPYFILE_FICLONE:2,COPYFILE_FICLONE_FORCE:4}});var Jd=T(ua=>{"use strict";Object.defineProperty(ua,"__esModule",{value:!0});ua.Stats=void 0;var WN=Gt(),{S_IFMT:zN,S_IFDIR:HN,S_IFREG:VN,S_IFBLK:GN,S_IFCHR:KN,S_IFLNK:JN,S_IFIFO:XN,S_IFSOCK:YN}=WN.constants,nl=class nl{static build(e,r=!1){let i=new nl,{uid:n,gid:s,atime:o,mtime:f,ctime:c}=e,a=r?h=>BigInt(h):h=>h;i.uid=a(n),i.gid=a(s),i.rdev=a(e.rdev),i.blksize=a(4096),i.ino=a(e.ino),i.size=a(e.getSize()),i.blocks=a(1),i.atime=o,i.mtime=f,i.ctime=c,i.birthtime=c,i.atimeMs=a(o.getTime()),i.mtimeMs=a(f.getTime());let u=a(c.getTime());if(i.ctimeMs=u,i.birthtimeMs=u,r){i.atimeNs=BigInt(o.getTime())*BigInt(1e6),i.mtimeNs=BigInt(f.getTime())*BigInt(1e6);let h=BigInt(c.getTime())*BigInt(1e6);i.ctimeNs=h,i.birthtimeNs=h}return i.dev=a(0),i.mode=a(e.mode),i.nlink=a(e.nlink),i}_checkModeProperty(e){return(Number(this.mode)&zN)===e}isDirectory(){return this._checkModeProperty(HN)}isFile(){return this._checkModeProperty(VN)}isBlockDevice(){return this._checkModeProperty(GN)}isCharacterDevice(){return this._checkModeProperty(KN)}isSymbolicLink(){return this._checkModeProperty(JN)}isFIFO(){return this._checkModeProperty(XN)}isSocket(){return this._checkModeProperty(YN)}};l(nl,"Stats");var il=nl;ua.Stats=il;ua.default=il});var _0=T(sl=>{"use strict";Object.defineProperty(sl,"__esModule",{value:!0});sl.Buffer=void 0;var ZN=ne("node:buffer");Object.defineProperty(sl,"Buffer",{enumerable:!0,get:l(function(){return ZN.Buffer},"get")})});var Xr=T(Jr=>{"use strict";Object.defineProperty(Jr,"__esModule",{value:!0});Jr.bufferFrom=Jr.bufferAllocUnsafe=Jr.Buffer=void 0;var ol=_0();Object.defineProperty(Jr,"Buffer",{enumerable:!0,get:l(function(){return ol.Buffer},"get")});function S0(t,...e){return new ol.Buffer(t,...e)}l(S0,"bufferV0P12Ponyfill");var QN=ol.Buffer.allocUnsafe||S0;Jr.bufferAllocUnsafe=QN;var eC=ol.Buffer.from||S0;Jr.bufferFrom=eC});var Yd=T(hs=>{"use strict";Object.defineProperty(hs,"__esModule",{value:!0});hs.inherits=tC;hs.promisify=rC;hs.inspect=Xd;hs.format=iC;function tC(t,e){if(t==null)throw new TypeError("The constructor to inherit from is not defined");if(e==null)throw new TypeError("The super constructor to inherit from is not defined");t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}l(tC,"inherits");function rC(t){if(typeof t!="function")throw new TypeError('The "original" argument must be of type function');return function(...e){return new Promise((r,i)=>{t.call(this,...e,(n,s)=>{n?i(n):r(s)})})}}l(rC,"promisify");function Xd(t){return t===null?"null":t===void 0?"undefined":typeof t=="string"?`'${t}'`:typeof t=="number"||typeof t=="boolean"?String(t):Array.isArray(t)?`[ ${t.map(r=>Xd(r)).join(", ")} ]`:typeof t=="object"?`{ ${Object.entries(t).map(([r,i])=>`${r}: ${Xd(i)}`).join(", ")} }`:String(t)}l(Xd,"inspect");function iC(t,...e){if(e.length===0)return t;let r=t,i=0;for(r=r.replace(/%[sdj%]/g,n=>{if(i>=e.length)return n;let s=e[i++];switch(n){case"%s":return String(s);case"%d":return Number(s).toString();case"%j":try{return JSON.stringify(s)}catch{return"[Circular]"}case"%%":return"%";default:return n}});i<e.length;)r+=" "+String(e[i++]);return r}l(iC,"format")});var ha=T(Qe=>{"use strict";Object.defineProperty(Qe,"__esModule",{value:!0});Qe.AssertionError=Qe.RangeError=Qe.TypeError=Qe.Error=void 0;Qe.message=F0;Qe.E=Yr;var Zd=Yd(),v0=typeof Symbol>"u"?"_kCode":Symbol("code"),E0={};function ep(t){var e;return e=class extends t{constructor(i,...n){super(F0(i,n)),this.code=i,this[v0]=i,this.name=`${super.name} [${this[v0]}]`}},l(e,"NodeError"),e}l(ep,"makeNodeError");var al=globalThis,tp=class tp extends al.Error{constructor(e){if(typeof e!="object"||e===null)throw new Qe.TypeError("ERR_INVALID_ARG_TYPE","options","object");e.message?super(e.message):super(`${(0,Zd.inspect)(e.actual).slice(0,128)} ${e.operator} ${(0,Zd.inspect)(e.expected).slice(0,128)}`),this.generatedMessage=!e.message,this.name="AssertionError [ERR_ASSERTION]",this.code="ERR_ASSERTION",this.actual=e.actual,this.expected=e.expected,this.operator=e.operator,Qe.Error.captureStackTrace(this,e.stackStartFunction)}};l(tp,"AssertionError");var Qd=tp;Qe.AssertionError=Qd;function F0(t,e){if(typeof t!="string")throw new Qe.Error("Error message key must be a string");let r=E0[t];if(!r)throw new Qe.Error(`An invalid error message key was used: ${t}.`);let i;if(typeof r=="function")i=r;else{if(i=Zd.format,e===void 0||e.length===0)return r;e.unshift(r)}return String(i.apply(null,e))}l(F0,"message");function Yr(t,e){E0[t]=typeof e=="function"?e:String(e)}l(Yr,"E");Qe.Error=ep(al.Error);Qe.TypeError=ep(al.TypeError);Qe.RangeError=ep(al.RangeError);Yr("ERR_DIR_CLOSED","Directory handle was closed");Yr("ERR_DIR_CONCURRENT_OPERATION","Cannot do synchronous work on directory handle with concurrent asynchronous operations");Yr("ERR_INVALID_FILE_URL_HOST",'File URL host must be "localhost" or empty on %s');Yr("ERR_INVALID_FILE_URL_PATH","File URL path %s");Yr("ERR_INVALID_OPT_VALUE",(t,e)=>`The value "${String(e)}" is invalid for option "${t}"`);Yr("ERR_INVALID_OPT_VALUE_ENCODING",t=>`The value "${String(t)}" is invalid for option "encoding"`);Yr("ERR_INVALID_ARG_VALUE","Unable to open file as blob")});var da=T(Mi=>{"use strict";Object.defineProperty(Mi,"__esModule",{value:!0});Mi.ENCODING_UTF8=void 0;Mi.assertEncoding=sC;Mi.strToEncoding=oC;var rp=Xr(),nC=ha();Mi.ENCODING_UTF8="utf8";function sC(t){if(t&&!rp.Buffer.isEncoding(t))throw new nC.TypeError("ERR_INVALID_OPT_VALUE_ENCODING",t)}l(sC,"assertEncoding");function oC(t,e){return!e||e===Mi.ENCODING_UTF8?t:e==="buffer"?new rp.Buffer(t):new rp.Buffer(t).toString(e)}l(oC,"strToEncoding")});var fl=T(pa=>{"use strict";Object.defineProperty(pa,"__esModule",{value:!0});pa.Dirent=void 0;var aC=Gt(),cC=da(),{S_IFMT:lC,S_IFDIR:fC,S_IFREG:uC,S_IFBLK:hC,S_IFCHR:dC,S_IFLNK:pC,S_IFIFO:mC,S_IFSOCK:wC}=aC.constants,ll=class ll{constructor(){this.name="",this.path="",this.parentPath="",this.mode=0}static build(e,r){let i=new ll,{mode:n}=e.getNode();return i.name=(0,cC.strToEncoding)(e.getName(),r),i.mode=n,i.path=e.getParentPath(),i.parentPath=i.path,i}_checkModeProperty(e){return(this.mode&lC)===e}isDirectory(){return this._checkModeProperty(fC)}isFile(){return this._checkModeProperty(uC)}isBlockDevice(){return this._checkModeProperty(hC)}isCharacterDevice(){return this._checkModeProperty(dC)}isSymbolicLink(){return this._checkModeProperty(pC)}isFIFO(){return this._checkModeProperty(mC)}isSocket(){return this._checkModeProperty(wC)}};l(ll,"Dirent");var cl=ll;pa.Dirent=cl;pa.default=cl});var ds=T(ke=>{"use strict";Object.defineProperty(ke,"__esModule",{value:!0});ke.basename=ke.isAbsolute=ke.normalize=ke.dirname=ke.relative=ke.join=ke.posix=ke.sep=ke.resolve=void 0;var kr=ne("node:path");Object.defineProperty(ke,"resolve",{enumerable:!0,get:l(function(){return kr.resolve},"get")});Object.defineProperty(ke,"sep",{enumerable:!0,get:l(function(){return kr.sep},"get")});Object.defineProperty(ke,"posix",{enumerable:!0,get:l(function(){return kr.posix},"get")});Object.defineProperty(ke,"join",{enumerable:!0,get:l(function(){return kr.join},"get")});Object.defineProperty(ke,"relative",{enumerable:!0,get:l(function(){return kr.relative},"get")});Object.defineProperty(ke,"dirname",{enumerable:!0,get:l(function(){return kr.dirname},"get")});Object.defineProperty(ke,"normalize",{enumerable:!0,get:l(function(){return kr.normalize},"get")});Object.defineProperty(ke,"isAbsolute",{enumerable:!0,get:l(function(){return kr.isAbsolute},"get")});Object.defineProperty(ke,"basename",{enumerable:!0,get:l(function(){return kr.basename},"get")})});var pl={};mN(pl,{__addDisposableResource:()=>J0,__assign:()=>ul,__asyncDelegator:()=>q0,__asyncGenerator:()=>j0,__asyncValues:()=>U0,__await:()=>ps,__awaiter:()=>D0,__classPrivateFieldGet:()=>V0,__classPrivateFieldIn:()=>K0,__classPrivateFieldSet:()=>G0,__createBinding:()=>dl,__decorate:()=>R0,__disposeResources:()=>X0,__esDecorate:()=>x0,__exportStar:()=>$0,__extends:()=>T0,__generator:()=>I0,__importDefault:()=>H0,__importStar:()=>z0,__makeTemplateObject:()=>W0,__metadata:()=>C0,__param:()=>O0,__propKey:()=>P0,__read:()=>sp,__rest:()=>k0,__rewriteRelativeImportExtension:()=>Y0,__runInitializers:()=>A0,__setFunctionName:()=>N0,__spread:()=>B0,__spreadArray:()=>L0,__spreadArrays:()=>M0,__values:()=>hl,default:()=>bC});function T0(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");ip(t,e);function r(){this.constructor=t}l(r,"__"),t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function k0(t,e){var r={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(r[i]=t[i]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,i=Object.getOwnPropertySymbols(t);n<i.length;n++)e.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(t,i[n])&&(r[i[n]]=t[i[n]]);return r}function R0(t,e,r,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,r):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,i);else for(var f=t.length-1;f>=0;f--)(o=t[f])&&(s=(n<3?o(s):n>3?o(e,r,s):o(e,r))||s);return n>3&&s&&Object.defineProperty(e,r,s),s}function O0(t,e){return function(r,i){e(r,i,t)}}function x0(t,e,r,i,n,s){function o(g){if(g!==void 0&&typeof g!="function")throw new TypeError("Function expected");return g}l(o,"accept");for(var f=i.kind,c=f==="getter"?"get":f==="setter"?"set":"value",a=!e&&t?i.static?t:t.prototype:null,u=e||(a?Object.getOwnPropertyDescriptor(a,i.name):{}),h,d=!1,p=r.length-1;p>=0;p--){var m={};for(var w in i)m[w]=w==="access"?{}:i[w];for(var w in i.access)m.access[w]=i.access[w];m.addInitializer=function(g){if(d)throw new TypeError("Cannot add initializers after decoration has completed");s.push(o(g||null))};var y=(0,r[p])(f==="accessor"?{get:u.get,set:u.set}:u[c],m);if(f==="accessor"){if(y===void 0)continue;if(y===null||typeof y!="object")throw new TypeError("Object expected");(h=o(y.get))&&(u.get=h),(h=o(y.set))&&(u.set=h),(h=o(y.init))&&n.unshift(h)}else(h=o(y))&&(f==="field"?n.unshift(h):u[c]=h)}a&&Object.defineProperty(a,i.name,u),d=!0}function A0(t,e,r){for(var i=arguments.length>2,n=0;n<e.length;n++)r=i?e[n].call(t,r):e[n].call(t);return i?r:void 0}function P0(t){return typeof t=="symbol"?t:"".concat(t)}function N0(t,e,r){return typeof e=="symbol"&&(e=e.description?"[".concat(e.description,"]"):""),Object.defineProperty(t,"name",{configurable:!0,value:r?"".concat(r," ",e):e})}function C0(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function D0(t,e,r,i){function n(s){return s instanceof r?s:new r(function(o){o(s)})}return l(n,"adopt"),new(r||(r=Promise))(function(s,o){function f(u){try{a(i.next(u))}catch(h){o(h)}}l(f,"fulfilled");function c(u){try{a(i.throw(u))}catch(h){o(h)}}l(c,"rejected");function a(u){u.done?s(u.value):n(u.value).then(f,c)}l(a,"step"),a((i=i.apply(t,e||[])).next())})}function I0(t,e){var r={label:0,sent:l(function(){if(s[0]&1)throw s[1];return s[1]},"sent"),trys:[],ops:[]},i,n,s,o=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return o.next=f(0),o.throw=f(1),o.return=f(2),typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function f(a){return function(u){return c([a,u])}}function c(a){if(i)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(r=0)),r;)try{if(i=1,n&&(s=a[0]&2?n.return:a[0]?n.throw||((s=n.return)&&s.call(n),0):n.next)&&!(s=s.call(n,a[1])).done)return s;switch(n=0,s&&(a=[a[0]&2,s.value]),a[0]){case 0:case 1:s=a;break;case 4:return r.label++,{value:a[1],done:!1};case 5:r.label++,n=a[1],a=[0];continue;case 7:a=r.ops.pop(),r.trys.pop();continue;default:if(s=r.trys,!(s=s.length>0&&s[s.length-1])&&(a[0]===6||a[0]===2)){r=0;continue}if(a[0]===3&&(!s||a[1]>s[0]&&a[1]<s[3])){r.label=a[1];break}if(a[0]===6&&r.label<s[1]){r.label=s[1],s=a;break}if(s&&r.label<s[2]){r.label=s[2],r.ops.push(a);break}s[2]&&r.ops.pop(),r.trys.pop();continue}a=e.call(t,r)}catch(u){a=[6,u],n=0}finally{i=s=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}}function $0(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&dl(e,t,r)}function hl(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],i=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:l(function(){return t&&i>=t.length&&(t=void 0),{value:t&&t[i++],done:!t}},"next")};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function sp(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var i=r.call(t),n,s=[],o;try{for(;(e===void 0||e-- >0)&&!(n=i.next()).done;)s.push(n.value)}catch(f){o={error:f}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return s}function B0(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(sp(arguments[e]));return t}function M0(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;for(var i=Array(t),n=0,e=0;e<r;e++)for(var s=arguments[e],o=0,f=s.length;o<f;o++,n++)i[n]=s[o];return i}function L0(t,e,r){if(r||arguments.length===2)for(var i=0,n=e.length,s;i<n;i++)(s||!(i in e))&&(s||(s=Array.prototype.slice.call(e,0,i)),s[i]=e[i]);return t.concat(s||Array.prototype.slice.call(e))}function ps(t){return this instanceof ps?(this.v=t,this):new ps(t)}function j0(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i=r.apply(t,e||[]),n,s=[];return n=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),f("next"),f("throw"),f("return",o),n[Symbol.asyncIterator]=function(){return this},n;function o(p){return function(m){return Promise.resolve(m).then(p,h)}}function f(p,m){i[p]&&(n[p]=function(w){return new Promise(function(y,g){s.push([p,w,y,g])>1||c(p,w)})},m&&(n[p]=m(n[p])))}function c(p,m){try{a(i[p](m))}catch(w){d(s[0][3],w)}}function a(p){p.value instanceof ps?Promise.resolve(p.value.v).then(u,h):d(s[0][2],p)}function u(p){c("next",p)}function h(p){c("throw",p)}function d(p,m){p(m),s.shift(),s.length&&c(s[0][0],s[0][1])}}function q0(t){var e,r;return e={},i("next"),i("throw",function(n){throw n}),i("return"),e[Symbol.iterator]=function(){return this},e;function i(n,s){e[n]=t[n]?function(o){return(r=!r)?{value:ps(t[n](o)),done:!1}:s?s(o):o}:s}}function U0(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof hl=="function"?hl(t):t[Symbol.iterator](),r={},i("next"),i("throw"),i("return"),r[Symbol.asyncIterator]=function(){return this},r);function i(s){r[s]=t[s]&&function(o){return new Promise(function(f,c){o=t[s](o),n(f,c,o.done,o.value)})}}function n(s,o,f,c){Promise.resolve(c).then(function(a){s({value:a,done:f})},o)}}function W0(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function z0(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r=np(t),i=0;i<r.length;i++)r[i]!=="default"&&dl(e,t,r[i]);return yC(e,t),e}function H0(t){return t&&t.__esModule?t:{default:t}}function V0(t,e,r,i){if(r==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?i:r==="a"?i.call(t):i?i.value:e.get(t)}function G0(t,e,r,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(t,r):n?n.value=r:e.set(t,r),r}function K0(t,e){if(e===null||typeof e!="object"&&typeof e!="function")throw new TypeError("Cannot use 'in' operator on non-object");return typeof t=="function"?e===t:t.has(e)}function J0(t,e,r){if(e!=null){if(typeof e!="object"&&typeof e!="function")throw new TypeError("Object expected.");var i,n;if(r){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");i=e[Symbol.asyncDispose]}if(i===void 0){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");i=e[Symbol.dispose],r&&(n=i)}if(typeof i!="function")throw new TypeError("Object not disposable.");n&&(i=l(function(){try{n.call(this)}catch(s){return Promise.reject(s)}},"dispose")),t.stack.push({value:e,dispose:i,async:r})}else r&&t.stack.push({async:!0});return e}function X0(t){function e(s){t.error=t.hasError?new gC(s,t.error,"An error was suppressed during disposal."):s,t.hasError=!0}l(e,"fail");var r,i=0;function n(){for(;r=t.stack.pop();)try{if(!r.async&&i===1)return i=0,t.stack.push(r),Promise.resolve().then(n);if(r.dispose){var s=r.dispose.call(r.value);if(r.async)return i|=2,Promise.resolve(s).then(n,function(o){return e(o),n()})}else i|=1}catch(o){e(o)}if(i===1)return t.hasError?Promise.reject(t.error):Promise.resolve();if(t.hasError)throw t.error}return l(n,"next"),n()}function Y0(t,e){return typeof t=="string"&&/^\.\.?\//.test(t)?t.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i,function(r,i,n,s,o){return i?e?".jsx":".js":n&&(!s||!o)?r:n+s+"."+o.toLowerCase()+"js"}):t}var ip,ul,dl,yC,np,gC,bC,ml=pN(()=>{ip=l(function(t,e){return ip=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(r[n]=i[n])},ip(t,e)},"extendStatics");l(T0,"__extends");ul=l(function(){return ul=Object.assign||l(function(e){for(var r,i=1,n=arguments.length;i<n;i++){r=arguments[i];for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(e[s]=r[s])}return e},"__assign"),ul.apply(this,arguments)},"__assign");l(k0,"__rest");l(R0,"__decorate");l(O0,"__param");l(x0,"__esDecorate");l(A0,"__runInitializers");l(P0,"__propKey");l(N0,"__setFunctionName");l(C0,"__metadata");l(D0,"__awaiter");l(I0,"__generator");dl=Object.create?function(t,e,r,i){i===void 0&&(i=r);var n=Object.getOwnPropertyDescriptor(e,r);(!n||("get"in n?!e.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:l(function(){return e[r]},"get")}),Object.defineProperty(t,i,n)}:function(t,e,r,i){i===void 0&&(i=r),t[i]=e[r]};l($0,"__exportStar");l(hl,"__values");l(sp,"__read");l(B0,"__spread");l(M0,"__spreadArrays");l(L0,"__spreadArray");l(ps,"__await");l(j0,"__asyncGenerator");l(q0,"__asyncDelegator");l(U0,"__asyncValues");l(W0,"__makeTemplateObject");yC=Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e},np=l(function(t){return np=Object.getOwnPropertyNames||function(e){var r=[];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(r[r.length]=i);return r},np(t)},"ownKeys");l(z0,"__importStar");l(H0,"__importDefault");l(V0,"__classPrivateFieldGet");l(G0,"__classPrivateFieldSet");l(K0,"__classPrivateFieldIn");l(J0,"__addDisposableResource");gC=typeof SuppressedError=="function"?SuppressedError:function(t,e,r){var i=new Error(r);return i.name="SuppressedError",i.error=t,i.suppressed=e,i};l(X0,"__disposeResources");l(Y0,"__rewriteRelativeImportExtension");bC={__extends:T0,__assign:ul,__rest:k0,__decorate:R0,__param:O0,__esDecorate:x0,__runInitializers:A0,__propKey:P0,__setFunctionName:N0,__metadata:C0,__awaiter:D0,__generator:I0,__createBinding:dl,__exportStar:$0,__values:hl,__read:sp,__spread:B0,__spreadArrays:M0,__spreadArray:L0,__await:ps,__asyncGenerator:j0,__asyncDelegator:q0,__asyncValues:U0,__makeTemplateObject:W0,__importStar:z0,__importDefault:H0,__classPrivateFieldGet:V0,__classPrivateFieldSet:G0,__classPrivateFieldIn:K0,__addDisposableResource:J0,__disposeResources:X0,__rewriteRelativeImportExtension:Y0}});var Q0=T(Z0=>{"use strict";Object.defineProperty(Z0,"__esModule",{value:!0})});var ap=T(wl=>{"use strict";Object.defineProperty(wl,"__esModule",{value:!0});wl.flattenJSON=void 0;var e_=Xr(),op=ds(),_C=op.posix?op.posix.join:op.join,SC=l(t=>{let e={};function r(i,n){for(let s in n){let o=n[s],f=_C(i,s);typeof o=="string"||o instanceof e_.Buffer?e[f]=o:typeof o=="object"&&o!==null&&!(o instanceof e_.Buffer)&&Object.keys(o).length>0?r(f,o):e[f]=null}}return l(r,"flatten"),r("",t),e},"flattenJSON");wl.flattenJSON=SC});var ma=T(yl=>{"use strict";Object.defineProperty(yl,"__esModule",{value:!0});yl.FanOut=void 0;var lp=class lp{constructor(){this.listeners=new Set}emit(e){this.listeners.forEach(r=>r(e))}listen(e){let r=this.listeners;return r.add(e),()=>r.delete(e)}};l(lp,"FanOut");var cp=lp;yl.FanOut=cp});var bl=T(gl=>{"use strict";Object.defineProperty(gl,"__esModule",{value:!0});gl.createProcess=t_;var vC=l(()=>{if(typeof process<"u")return process;try{return ne("process")}catch{return}},"maybeReturnProcess");function t_(){let t=vC()||{};return t.cwd||(t.cwd=()=>"/"),t.emitWarning||(t.emitWarning=(e,r)=>{console.warn(`${r}${r?": ":""}${e}`)}),t.env||(t.env={}),t}l(t_,"createProcess");gl.default=t_()});var hp=T(vl=>{"use strict";Object.defineProperty(vl,"__esModule",{value:!0});vl.Node=void 0;var EC=ma(),i_=bl(),Dt=Xr(),FC=Gt(),{S_IFMT:Rr,S_IFDIR:TC,S_IFREG:kC,S_IFLNK:r_,S_IFCHR:RC}=FC.constants,_l=l(()=>i_.default.getuid?.()??0,"getuid"),Sl=l(()=>i_.default.getgid?.()??0,"getgid"),up=class up{constructor(e,r=438){this.changes=new EC.FanOut,this._uid=_l(),this._gid=Sl(),this._atime=new Date,this._mtime=new Date,this._ctime=new Date,this.rdev=0,this._nlink=1,this.mode=r,this.ino=e}set ctime(e){this._ctime=e}get ctime(){return this._ctime}set uid(e){this._uid=e,this.ctime=new Date}get uid(){return this._uid}set gid(e){this._gid=e,this.ctime=new Date}get gid(){return this._gid}set atime(e){this._atime=e}get atime(){return this._atime}set mtime(e){this._mtime=e,this.ctime=new Date}get mtime(){return this._mtime}get perm(){return this.mode&~Rr}set perm(e){this.mode=this.mode&Rr|e&~Rr,this.ctime=new Date}set nlink(e){this._nlink=e,this.ctime=new Date}get nlink(){return this._nlink}getString(e="utf8"){return this.atime=new Date,this.getBuffer().toString(e)}setString(e){this.buf=(0,Dt.bufferFrom)(e,"utf8"),this.touch()}getBuffer(){return this.atime=new Date,this.buf||(this.buf=(0,Dt.bufferAllocUnsafe)(0)),(0,Dt.bufferFrom)(this.buf)}setBuffer(e){this.buf=(0,Dt.bufferFrom)(e),this.touch()}getSize(){return this.buf?this.buf.length:0}setModeProperty(e){this.mode=e}isFile(){return(this.mode&Rr)===kC}isDirectory(){return(this.mode&Rr)===TC}isSymlink(){return(this.mode&Rr)===r_}isCharacterDevice(){return(this.mode&Rr)===RC}makeSymlink(e){this.mode=r_|438,this.symlink=e}write(e,r=0,i=e.length,n=0){if(this.buf||(this.buf=(0,Dt.bufferAllocUnsafe)(0)),n+i>this.buf.length){let s=(0,Dt.bufferAllocUnsafe)(n+i);this.buf.copy(s,0,0,this.buf.length),this.buf=s}return e.copy(this.buf,n,r,r+i),this.touch(),i}read(e,r=0,i=e.byteLength,n=0){if(this.atime=new Date,this.buf||(this.buf=(0,Dt.bufferAllocUnsafe)(0)),n>=this.buf.length)return 0;let s=i;s>e.byteLength&&(s=e.byteLength),s+n>this.buf.length&&(s=this.buf.length-n);let o=e instanceof Dt.Buffer?e:Dt.Buffer.from(e.buffer,e.byteOffset,e.byteLength);return this.buf.copy(o,r,n,n+s),s}truncate(e=0){if(!e)this.buf=(0,Dt.bufferAllocUnsafe)(0);else if(this.buf||(this.buf=(0,Dt.bufferAllocUnsafe)(0)),e<=this.buf.length)this.buf=this.buf.slice(0,e);else{let r=(0,Dt.bufferAllocUnsafe)(e);this.buf.copy(r),r.fill(0,this.buf.length),this.buf=r}this.touch()}chmod(e){this.mode=this.mode&Rr|e&~Rr,this.touch()}chown(e,r){this.uid=e,this.gid=r,this.touch()}touch(){this.mtime=new Date,this.changes.emit(["modify"])}canRead(e=_l(),r=Sl()){return!!(this.perm&4||r===this.gid&&this.perm&32||e===this.uid&&this.perm&256)}canWrite(e=_l(),r=Sl()){return!!(this.perm&2||r===this.gid&&this.perm&16||e===this.uid&&this.perm&128)}canExecute(e=_l(),r=Sl()){return!!(this.perm&1||r===this.gid&&this.perm&8||e===this.uid&&this.perm&64)}del(){this.changes.emit(["delete"])}toJSON(){return{ino:this.ino,uid:this.uid,gid:this.gid,atime:this.atime.getTime(),mtime:this.mtime.getTime(),ctime:this.ctime.getTime(),perm:this.perm,mode:this.mode,nlink:this.nlink,symlink:this.symlink,data:this.getString()}}};l(up,"Node");var fp=up;vl.Node=fp});var pp=T(El=>{"use strict";Object.defineProperty(El,"__esModule",{value:!0});El.Link=void 0;var OC=Gt(),xC=ma(),{S_IFREG:AC}=OC.constants,wa=class wa{get steps(){return this._steps}set steps(e){this._steps=e;for(let[r,i]of this.children.entries())r==="."||r===".."||i?.syncSteps()}constructor(e,r,i){this.changes=new xC.FanOut,this.children=new Map,this._steps=[],this.ino=0,this.length=0,this.vol=e,this.parent=r,this.name=i,this.syncSteps()}setNode(e){this.node=e,this.ino=e.ino}getNode(){return this.node}createChild(e,r=this.vol.createNode(AC|438)){let i=new wa(this.vol,this,e);return i.setNode(r),r.isDirectory()&&(i.children.set(".",i),i.getNode().nlink++),this.setChild(e,i),i}setChild(e,r=new wa(this.vol,this,e)){return this.children.set(e,r),r.parent=this,this.length++,r.getNode().isDirectory()&&(r.children.set("..",this),this.getNode().nlink++),this.getNode().mtime=new Date,this.changes.emit(["child:add",r,this]),r}deleteChild(e){e.getNode().isDirectory()&&(e.children.delete(".."),this.getNode().nlink--),this.children.delete(e.getName()),this.length--,this.getNode().mtime=new Date,this.changes.emit(["child:del",e,this])}getChild(e){return this.getNode().atime=new Date,this.children.get(e)}getPath(){return this.steps.join("/")}getParentPath(){return this.steps.slice(0,-1).join("/")}getName(){return this.steps[this.steps.length-1]}toJSON(){return{steps:this.steps,ino:this.ino,children:Array.from(this.children.keys())}}syncSteps(){this.steps=this.parent?this.parent.steps.concat([this.name]):[this.name]}};l(wa,"Link");var dp=wa;El.Link=dp});var yp=T(Fl=>{"use strict";Object.defineProperty(Fl,"__esModule",{value:!0});Fl.File=void 0;var PC=Gt(),{O_APPEND:NC}=PC.constants,wp=class wp{constructor(e,r,i,n){this.link=e,this.node=r,this.flags=i,this.fd=n,this.position=0,this.flags&NC&&(this.position=this.getSize())}getString(e="utf8"){return this.node.getString()}setString(e){this.node.setString(e)}getBuffer(){return this.node.getBuffer()}setBuffer(e){this.node.setBuffer(e)}getSize(){return this.node.getSize()}truncate(e){this.node.truncate(e)}seekTo(e){this.position=e}write(e,r=0,i=e.length,n){typeof n!="number"&&(n=this.position);let s=this.node.write(e,r,i,n);return this.position=n+s,s}read(e,r=0,i=e.byteLength,n){typeof n!="number"&&(n=this.position);let s=this.node.read(e,r,i,n);return this.position=n+s,s}chmod(e){this.node.chmod(e)}chown(e,r){this.node.chown(e,r)}};l(wp,"File");var mp=wp;Fl.File=mp});var ys=T(ws=>{"use strict";Object.defineProperty(ws,"__esModule",{value:!0});ws.FLAGS=ws.ERRSTR=void 0;var CC=Gt();ws.ERRSTR={PATH_STR:"path must be a string, Buffer, or Uint8Array",FD:"fd must be a file descriptor",MODE_INT:"mode must be an int",CB:"callback must be a function",UID:"uid must be an unsigned int",GID:"gid must be an unsigned int",LEN:"len must be an integer",ATIME:"atime must be an integer",MTIME:"mtime must be an integer",PREFIX:"filename prefix is required",BUFFER:"buffer must be an instance of Buffer or StaticBuffer",OFFSET:"offset must be an integer",LENGTH:"length must be an integer",POSITION:"position must be an integer"};var{O_RDONLY:n_,O_WRONLY:Tl,O_RDWR:ms,O_CREAT:Zr,O_EXCL:kl,O_TRUNC:Rl,O_APPEND:Ol,O_SYNC:s_}=CC.constants,o_;(function(t){t[t.r=n_]="r",t[t["r+"]=ms]="r+",t[t.rs=n_|s_]="rs",t[t.sr=t.rs]="sr",t[t["rs+"]=ms|s_]="rs+",t[t["sr+"]=t["rs+"]]="sr+",t[t.w=Tl|Zr|Rl]="w",t[t.wx=Tl|Zr|Rl|kl]="wx",t[t.xw=t.wx]="xw",t[t["w+"]=ms|Zr|Rl]="w+",t[t["wx+"]=ms|Zr|Rl|kl]="wx+",t[t["xw+"]=t["wx+"]]="xw+",t[t.a=Tl|Ol|Zr]="a",t[t.ax=Tl|Ol|Zr|kl]="ax",t[t.xa=t.ax]="xa",t[t["a+"]=ms|Ol|Zr]="a+",t[t["ax+"]=ms|Ol|Zr|kl]="ax+",t[t["xa+"]=t["ax+"]]="xa+"})(o_||(ws.FLAGS=o_={}))});var bp=T(gp=>{"use strict";Object.defineProperty(gp,"__esModule",{value:!0});gp.default=typeof queueMicrotask=="function"?queueMicrotask:t=>Promise.resolve().then(()=>t()).catch(()=>{})});var Nl=T(Le=>{"use strict";Object.defineProperty(Le,"__esModule",{value:!0});Le.filenameToSteps=Le.resolve=Le.unixify=Le.isWin=void 0;Le.isFd=c_;Le.validateFd=WC;Le.dataToBuffer=zC;var Al=ds(),xl=Xr(),a_=bl(),DC=da(),IC=ys();Le.isWin=a_.default.platform==="win32";var $C=Al.resolve,BC=Al.posix?Al.posix.sep:Al.sep,MC=l((t,e)=>{let r=t[e];return e>0&&(r==="/"||Le.isWin&&r==="\\")},"isSeparator"),LC=l(t=>{let e=t.length-1;if(e<2)return t;for(;MC(t,e);)e--;return t.substr(0,e+1)},"removeTrailingSeparator"),jC=l((t,e)=>{if(typeof t!="string")throw new TypeError("expected a string");return t=t.replace(/[\\\/]+/g,"/"),e!==!1&&(t=LC(t)),t},"normalizePath"),qC=l((t,e=!0)=>Le.isWin?(t=jC(t,e),t.replace(/^([a-zA-Z]+:|\.\/)/,"")):t,"unixify");Le.unixify=qC;var Pl=l((t,e=a_.default.cwd())=>$C(e,t),"resolve");Le.resolve=Pl;if(Le.isWin){let t=Pl;Le.resolve=Pl=l((e,r)=>(0,Le.unixify)(t(e,r)),"resolve")}var UC=l((t,e)=>{let i=Pl(t,e).substring(1);return i?i.split(BC):[]},"filenameToSteps");Le.filenameToSteps=UC;function c_(t){return t>>>0===t}l(c_,"isFd");function WC(t){if(!c_(t))throw TypeError(IC.ERRSTR.FD)}l(WC,"validateFd");function zC(t,e=DC.ENCODING_UTF8){return xl.Buffer.isBuffer(t)?t:t instanceof Uint8Array?(0,xl.bufferFrom)(t):e==="buffer"?(0,xl.bufferFrom)(String(t),"utf8"):(0,xl.bufferFrom)(String(t),e)}l(zC,"dataToBuffer")});var Qr=T(Ce=>{"use strict";Object.defineProperty(Ce,"__esModule",{value:!0});Ce.getWriteSyncArgs=Ce.getWriteArgs=Ce.bufToUint8=void 0;Ce.promisify=VC;Ce.validateCallback=l_;Ce.modeToNumber=f_;Ce.nullCheck=u_;Ce.pathToFilename=JC;Ce.createError=uD;Ce.genRndStr6=hD;Ce.flagsToNumber=dD;Ce.streamToBuffer=pD;Ce.bufferToEncoding=gD;Ce.isReadableStream=bD;var ya=ys(),_p=ha(),Sp=Xr(),HC=bp(),Cl=Nl();function VC(t,e,r=i=>i){return(...i)=>new Promise((n,s)=>{t[e].bind(t)(...i,(o,f)=>o?s(o):n(r(f)))})}l(VC,"promisify");function l_(t){if(typeof t!="function")throw TypeError(ya.ERRSTR.CB);return t}l(l_,"validateCallback");function GC(t,e){if(typeof t=="number")return t;if(typeof t=="string")return parseInt(t,8);if(e)return f_(e)}l(GC,"_modeToNumber");function f_(t,e){let r=GC(t,e);if(typeof r!="number"||isNaN(r))throw new TypeError(ya.ERRSTR.MODE_INT);return r}l(f_,"modeToNumber");function u_(t,e){if((""+t).indexOf("\0")!==-1){let r=new Error("Path must be a string without null bytes");if(r.code="ENOENT",typeof e!="function")throw r;return(0,HC.default)(()=>{e(r)}),!1}return!0}l(u_,"nullCheck");function KC(t){if(t.hostname!=="")throw new _p.TypeError("ERR_INVALID_FILE_URL_HOST",process.platform);let e=t.pathname;for(let r=0;r<e.length;r++)if(e[r]==="%"){let i=e.codePointAt(r+2)|32;if(e[r+1]==="2"&&i===102)throw new _p.TypeError("ERR_INVALID_FILE_URL_PATH","must not include encoded / characters")}return decodeURIComponent(e)}l(KC,"getPathFromURLPosix");function JC(t){if(t instanceof Uint8Array&&(t=(0,Sp.bufferFrom)(t)),typeof t!="string"&&!Sp.Buffer.isBuffer(t)){try{if(!(t instanceof ne("url").URL))throw new TypeError(ya.ERRSTR.PATH_STR)}catch{throw new TypeError(ya.ERRSTR.PATH_STR)}t=KC(t)}let e=String(t);return u_(e),e}l(JC,"pathToFilename");var XC="ENOENT",YC="EBADF",ZC="EINVAL",QC="EPERM",eD="EPROTO",tD="EEXIST",rD="ENOTDIR",iD="EMFILE",nD="EACCES",sD="EISDIR",oD="ENOTEMPTY",aD="ENOSYS",cD="ERR_FS_EISDIR",lD="ERR_OUT_OF_RANGE";function fD(t,e="",r="",i=""){let n="";switch(r&&(n=` '${r}'`),i&&(n+=` -> '${i}'`),t){case XC:return`ENOENT: no such file or directory, ${e}${n}`;case YC:return`EBADF: bad file descriptor, ${e}${n}`;case ZC:return`EINVAL: invalid argument, ${e}${n}`;case QC:return`EPERM: operation not permitted, ${e}${n}`;case eD:return`EPROTO: protocol error, ${e}${n}`;case tD:return`EEXIST: file already exists, ${e}${n}`;case rD:return`ENOTDIR: not a directory, ${e}${n}`;case sD:return`EISDIR: illegal operation on a directory, ${e}${n}`;case nD:return`EACCES: permission denied, ${e}${n}`;case oD:return`ENOTEMPTY: directory not empty, ${e}${n}`;case iD:return`EMFILE: too many open files, ${e}${n}`;case aD:return`ENOSYS: function not implemented, ${e}${n}`;case cD:return`[ERR_FS_EISDIR]: Path is a directory: ${e} returned EISDIR (is a directory) ${r}`;case lD:return`[ERR_OUT_OF_RANGE]: value out of range, ${e}${n}`;default:return`${t}: error occurred, ${e}${n}`}}l(fD,"formatError");function uD(t,e="",r="",i="",n=Error){let s=new n(fD(t,e,r,i));return s.code=t,r&&(s.path=r),s}l(uD,"createError");function hD(){return Math.random().toString(36).slice(2,8).padEnd(6,"0")}l(hD,"genRndStr6");function dD(t){if(typeof t=="number")return t;if(typeof t=="string"){let e=ya.FLAGS[t];if(typeof e<"u")return e}throw new _p.TypeError("ERR_INVALID_OPT_VALUE","flags",t)}l(dD,"flagsToNumber");function pD(t){let e=[];return new Promise((r,i)=>{t.on("data",n=>e.push(n)),t.on("end",()=>r(Sp.Buffer.concat(e))),t.on("error",i)})}l(pD,"streamToBuffer");var mD=l(t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),"bufToUint8");Ce.bufToUint8=mD;var wD=l((t,e,r,i,n,s)=>{(0,Cl.validateFd)(t);let o=0,f,c=null,a,u,h=typeof e,d=typeof r,p=typeof i,m=typeof n;h!=="string"?d==="function"?u=r:p==="function"?(o=r|0,u=i):m==="function"?(o=r|0,f=i,u=n):(o=r|0,f=i,c=n,u=s):d==="function"?u=r:p==="function"?(c=r,u=i):m==="function"&&(c=r,a=i,u=n);let w=(0,Cl.dataToBuffer)(e,a);h!=="string"?typeof f>"u"&&(f=w.length):(o=0,f=w.length);let y=l_(u);return[t,h==="string",w,o,f,c,y]},"getWriteArgs");Ce.getWriteArgs=wD;var yD=l((t,e,r,i,n)=>{(0,Cl.validateFd)(t);let s,o,f,c,a=typeof e!="string";a?(o=(r||0)|0,f=i,c=n):(c=r,s=i);let u=(0,Cl.dataToBuffer)(e,s);return a?typeof f>"u"&&(f=u.length):(o=0,f=u.length),[t,u,o||0,f,c]},"getWriteSyncArgs");Ce.getWriteSyncArgs=yD;function gD(t,e){return!e||e==="buffer"?t:t.toString(e)}l(gD,"bufferToEncoding");function bD(t){return t!==null&&typeof t=="object"&&typeof t.pipe=="function"&&typeof t.on=="function"&&t.readable===!0}l(bD,"isReadableStream")});var y_=T($l=>{"use strict";Object.defineProperty($l,"__esModule",{value:!0});$l.Superblock=void 0;var je=ds(),_D=hp(),h_=pp(),SD=yp(),vD=Xr(),d_=bl(),ar=Gt(),p_=ys(),G=Qr(),Kt=Nl(),ED=ap(),gs=je.posix?je.posix.sep:je.sep,m_=je.posix?je.posix.relative:je.relative,FD=je.posix?je.posix.join:je.join,{O_RDONLY:vp,O_WRONLY:Dl,O_RDWR:Ep,O_CREAT:w_,O_EXCL:TD,O_TRUNC:kD,O_APPEND:RD,O_DIRECTORY:OD}=ar.constants,bs=class bs{static fromJSON(e,r){let i=new bs;return i.fromJSON(e,r),i}static fromNestedJSON(e,r){let i=new bs;return i.fromNestedJSON(e,r),i}constructor(e={}){this.ino=0,this.inodes={},this.releasedInos=[],this.fds={},this.releasedFds=[],this.maxFiles=1e4,this.openFiles=0,this.open=(i,n,s,o=!0)=>{let f=this.openFile(i,n,s,o);if(!f)throw(0,G.createError)("ENOENT","open",i);return f.fd},this.writeFile=(i,n,s,o)=>{let f=typeof i=="number",c;f?c=i:c=this.open((0,G.pathToFilename)(i),s,o);let a=0,u=n.length,h=s&RD?void 0:0;try{for(;u>0;){let d=this.write(c,n,a,u,h);a+=d,u-=d,h!==void 0&&(h+=d)}}finally{f||this.close(c)}},this.read=(i,n,s,o,f)=>{if(n.byteLength<o)throw(0,G.createError)("ERR_OUT_OF_RANGE","read",void 0,void 0,RangeError);let c=this.getFileByFdOrThrow(i);if(c.node.isSymlink())throw(0,G.createError)("EPERM","read",c.link.getPath());return c.read(n,Number(s),Number(o),f===-1||typeof f!="number"?void 0:f)},this.readv=(i,n,s)=>{let o=this.getFileByFdOrThrow(i),f=s??void 0;f===-1&&(f=void 0);let c=0;for(let a of n){let u=o.read(a,0,a.byteLength,f);if(f=void 0,c+=u,u<a.byteLength)break}return c},this.link=(i,n)=>{let s;try{s=this.getLinkOrThrow(i,"link")}catch(u){throw u.code&&(u=(0,G.createError)(u.code,"link",i,n)),u}let o=(0,je.dirname)(n),f;try{f=this.getLinkOrThrow(o,"link")}catch(u){throw u.code&&(u=(0,G.createError)(u.code,"link",i,n)),u}let c=(0,je.basename)(n);if(f.getChild(c))throw(0,G.createError)("EEXIST","link",i,n);let a=s.getNode();a.nlink++,f.createChild(c,a)},this.unlink=i=>{let n=this.getLinkOrThrow(i,"unlink");if(n.length)throw Error("Dir not empty...");this.deleteLink(n);let s=n.getNode();s.nlink--,s.nlink<=0&&this.deleteNode(s)},this.symlink=(i,n)=>{let s=(0,Kt.filenameToSteps)(n),o;try{o=this.getLinkParentAsDirOrThrow(s)}catch(u){throw u.code&&(u=(0,G.createError)(u.code,"symlink",i,n)),u}let f=s[s.length-1];if(o.getChild(f))throw(0,G.createError)("EEXIST","symlink",i,n);let c=o.getNode();if(!c.canExecute()||!c.canWrite())throw(0,G.createError)("EACCES","symlink",i,n);let a=o.createChild(f);return a.getNode().makeSymlink(i),a},this.rename=(i,n)=>{let s;try{s=this.getResolvedLinkOrThrow(i)}catch(h){throw h.code&&(h=(0,G.createError)(h.code,"rename",i,n)),h}let o;try{o=this.getLinkParentAsDirOrThrow(n)}catch(h){throw h.code&&(h=(0,G.createError)(h.code,"rename",i,n)),h}let f=s.parent;if(!f)throw(0,G.createError)("EINVAL","rename",i,n);let c=f.getNode(),a=o.getNode();if(!c.canExecute()||!c.canWrite()||!a.canExecute()||!a.canWrite())throw(0,G.createError)("EACCES","rename",i,n);f.deleteChild(s);let u=(0,je.basename)(n);s.name=u,s.steps=[...o.steps,u],o.setChild(s.getName(),s)},this.mkdir=(i,n)=>{let s=(0,Kt.filenameToSteps)(i);if(!s.length)throw(0,G.createError)("EEXIST","mkdir",i);let o=this.getLinkParentAsDirOrThrow(i,"mkdir"),f=s[s.length-1];if(o.getChild(f))throw(0,G.createError)("EEXIST","mkdir",i);let c=o.getNode();if(!c.canWrite()||!c.canExecute())throw(0,G.createError)("EACCES","mkdir",i);o.createChild(f,this.createNode(ar.constants.S_IFDIR|n))},this.mkdirp=(i,n)=>{let s=!1,o=(0,Kt.filenameToSteps)(i),f=null,c=o.length;for(c=o.length;c>=0&&(f=this.getResolvedLink(o.slice(0,c)),!f);c--);for(f||(f=this.root,c=0),f=this.getResolvedLinkOrThrow(je.sep+o.slice(0,c).join(je.sep),"mkdir"),c;c<o.length;c++){let a=f.getNode();if(a.isDirectory()){if(!a.canExecute()||!a.canWrite())throw(0,G.createError)("EACCES","mkdir",i)}else throw(0,G.createError)("ENOTDIR","mkdir",i);s=!0,f=f.createChild(o[c],this.createNode(ar.constants.S_IFDIR|n))}return s?i:void 0},this.rmdir=(i,n=!1)=>{let s=this.getLinkAsDirOrThrow(i,"rmdir");if(s.length&&!n)throw(0,G.createError)("ENOTEMPTY","rmdir",i);this.deleteLink(s)},this.rm=(i,n=!1,s=!1)=>{let o;try{o=this.getResolvedLinkOrThrow(i,"stat")}catch(f){if(f.code==="ENOENT"&&n)return;throw f}if(o.getNode().isDirectory()&&!s)throw(0,G.createError)("ERR_FS_EISDIR","rm",i);if(!o.parent?.getNode().canWrite())throw(0,G.createError)("EACCES","rm",i);this.deleteLink(o)},this.close=i=>{(0,Kt.validateFd)(i);let n=this.getFileByFdOrThrow(i,"close");this.closeFile(n)};let r=this.createLink();r.setNode(this.createNode(ar.constants.S_IFDIR|511)),r.setChild(".",r),r.getNode().nlink++,r.setChild("..",r),r.getNode().nlink++,this.root=r}createLink(e,r,i=!1,n){if(!e)return new h_.Link(this,void 0,"");if(!r)throw new Error("createLink: name cannot be empty");let s=n??(i?511:438),f=n&&n&ar.constants.S_IFMT?n&ar.constants.S_IFMT:i?ar.constants.S_IFDIR:ar.constants.S_IFREG,c=s&~ar.constants.S_IFMT|f;return e.createChild(r,this.createNode(c))}deleteLink(e){let r=e.parent;return r?(r.deleteChild(e),!0):!1}newInoNumber(){let e=this.releasedInos.pop();return e||(this.ino=(this.ino+1)%4294967295,this.ino)}newFdNumber(){let e=this.releasedFds.pop();return typeof e=="number"?e:bs.fd--}createNode(e){let r=new _D.Node(this.newInoNumber(),e);return this.inodes[r.ino]=r,r}deleteNode(e){e.del(),delete this.inodes[e.ino],this.releasedInos.push(e.ino)}walk(e,r=!1,i=!1,n=!1,s){let o,f;e instanceof h_.Link?(o=e.steps,f=gs+o.join(gs)):typeof e=="string"?(o=(0,Kt.filenameToSteps)(e),f=e):(o=e,f=gs+o.join(gs));let c=this.root,a=0;for(;a<o.length;){let u=c.getNode();if(u.isDirectory()){if(n&&!u.canExecute())throw(0,G.createError)("EACCES",s,f)}else if(a<o.length-1)throw(0,G.createError)("ENOTDIR",s,f);if(c=c.getChild(o[a])??null,!c){if(i)throw(0,G.createError)("ENOENT",s,f);return null}if(u=c?.getNode(),u.isSymlink()&&(r||a<o.length-1)){let h=(0,je.isAbsolute)(u.symlink)?u.symlink:FD((0,je.dirname)(c.getPath()),u.symlink);o=(0,Kt.filenameToSteps)(h).concat(o.slice(a+1)),c=this.root,a=0;continue}if(i&&!u.isDirectory()&&a<o.length-1){let h=d_.default.platform==="win32"?"ENOENT":"ENOTDIR";throw(0,G.createError)(h,s,f)}a++}return c}getLink(e){return this.walk(e,!1,!1,!1)}getLinkOrThrow(e,r){return this.walk(e,!1,!0,!0,r)}getResolvedLink(e){return this.walk(e,!0,!1,!1)}getResolvedLinkOrThrow(e,r){return this.walk(e,!0,!0,!0,r)}resolveSymlinks(e){return this.getResolvedLink(e.steps.slice(1))}getLinkAsDirOrThrow(e,r){let i=this.getLinkOrThrow(e,r);if(!i.getNode().isDirectory())throw(0,G.createError)("ENOTDIR",r,e);return i}getLinkParent(e){return this.getLink(e.slice(0,-1))}getLinkParentAsDirOrThrow(e,r){let i=(e instanceof Array?e:(0,Kt.filenameToSteps)(e)).slice(0,-1),n=gs+i.join(gs),s=this.getLinkOrThrow(n,r);if(!s.getNode().isDirectory())throw(0,G.createError)("ENOTDIR",r,n);return s}getFileByFd(e){return this.fds[String(e)]}getFileByFdOrThrow(e,r){if(!(0,Kt.isFd)(e))throw TypeError(p_.ERRSTR.FD);let i=this.getFileByFd(e);if(!i)throw(0,G.createError)("EBADF",r);return i}_toJSON(e=this.root,r={},i,n){let s=!0,o=e.children;e.getNode().isFile()&&(o=new Map([[e.getName(),e.parent.getChild(e.getName())]]),e=e.parent);for(let c of o.keys()){if(c==="."||c==="..")continue;s=!1;let a=e.getChild(c);if(!a)throw new Error("_toJSON: unexpected undefined");let u=a.getNode();if(u.isFile()){let h=a.getPath();i&&(h=m_(i,h)),r[h]=n?u.getBuffer():u.getString()}else u.isDirectory()&&this._toJSON(a,r,i,n)}let f=e.getPath();return i&&(f=m_(i,f)),f&&s&&(r[f]=null),r}toJSON(e,r={},i=!1,n=!1){let s=[];if(e){Array.isArray(e)||(e=[e]);for(let o of e){let f=(0,G.pathToFilename)(o),c=this.getResolvedLink(f);c&&s.push(c)}}else s.push(this.root);if(!s.length)return r;for(let o of s)this._toJSON(o,r,i?o.getPath():"",n);return r}fromJSON(e,r=d_.default.cwd()){for(let i in e){let n=e[i];if(i=(0,Kt.resolve)(i,r),typeof n=="string"||n instanceof vD.Buffer){let s=(0,je.dirname)(i);this.mkdirp(s,511);let o=(0,Kt.dataToBuffer)(n);this.writeFile(i,o,p_.FLAGS.w,438)}else this.mkdirp(i,511)}}fromNestedJSON(e,r){this.fromJSON((0,ED.flattenJSON)(e),r)}reset(){this.ino=0,this.inodes={},this.releasedInos=[],this.fds={},this.releasedFds=[],this.openFiles=0,this.root=this.createLink(),this.root.setNode(this.createNode(ar.constants.S_IFDIR|511))}mountSync(e,r){this.fromJSON(r,e)}openLink(e,r,i=!0){if(this.openFiles>=this.maxFiles)throw(0,G.createError)("EMFILE","open",e.getPath());let n=e;i&&(n=this.getResolvedLinkOrThrow(e.getPath(),"open"));let s=n.getNode();if(s.isDirectory()){if((r&(vp|Ep|Dl))!==vp)throw(0,G.createError)("EISDIR","open",e.getPath())}else if(r&OD)throw(0,G.createError)("ENOTDIR","open",e.getPath());if((r&(vp|Ep|Dl))!==Dl&&!s.canRead()||r&(Dl|Ep)&&!s.canWrite())throw(0,G.createError)("EACCES","open",e.getPath());let o=new SD.File(e,s,r,this.newFdNumber());return this.fds[o.fd]=o,this.openFiles++,r&kD&&o.truncate(),o}openFile(e,r,i,n=!0){let s=(0,Kt.filenameToSteps)(e),o;try{if(o=n?this.getResolvedLinkOrThrow(e,"open"):this.getLinkOrThrow(e,"open"),o&&r&w_&&r&TD)throw(0,G.createError)("EEXIST","open",e)}catch(f){if(f.code==="ENOENT"&&r&w_){let c=(0,je.dirname)(e),a=this.getResolvedLinkOrThrow(c),u=a.getNode();if(!u.isDirectory())throw(0,G.createError)("ENOTDIR","open",e);if(!u.canExecute()||!u.canWrite())throw(0,G.createError)("EACCES","open",e);i??(i=438),o=this.createLink(a,s[s.length-1],!1,i)}else throw f}if(o)return this.openLink(o,r,n);throw(0,G.createError)("ENOENT","open",e)}closeFile(e){this.fds[e.fd]&&(this.openFiles--,delete this.fds[e.fd],this.releasedFds.push(e.fd))}write(e,r,i,n,s){let o=this.getFileByFdOrThrow(e,"write");if(o.node.isSymlink())throw(0,G.createError)("EBADF","write",o.link.getPath());return o.write(r,i,n,s===-1||typeof s!="number"?void 0:s)}};l(bs,"Superblock");var Il=bs;$l.Superblock=Il;Il.fd=2147483647});var b_=T(It=>{"use strict";Object.defineProperty(It,"__esModule",{value:!0});It.Superblock=It.File=It.Link=It.Node=void 0;var g_=(ml(),Ad(pl));g_.__exportStar(Q0(),It);g_.__exportStar(ap(),It);var xD=hp();Object.defineProperty(It,"Node",{enumerable:!0,get:l(function(){return xD.Node},"get")});var AD=pp();Object.defineProperty(It,"Link",{enumerable:!0,get:l(function(){return AD.Link},"get")});var PD=yp();Object.defineProperty(It,"File",{enumerable:!0,get:l(function(){return PD.File},"get")});var ND=y_();Object.defineProperty(It,"Superblock",{enumerable:!0,get:l(function(){return ND.Superblock},"get")})});var __=T(ga=>{"use strict";Object.defineProperty(ga,"__esModule",{value:!0});ga.StatFs=void 0;var Ml=class Ml{static build(e,r=!1){let i=new Ml,n=r?u=>BigInt(u):u=>u;i.type=n(2240043254),i.bsize=n(4096);let s=Object.keys(e.inodes).length,o=1e6,f=Math.min(s*2,o),c=o-f;i.blocks=n(o),i.bfree=n(c),i.bavail=n(c);let a=1e6;return i.files=n(a),i.ffree=n(a-s),i}};l(Ml,"StatFs");var Bl=Ml;ga.StatFs=Bl;ga.default=Bl});var S_=T(Fp=>{"use strict";Object.defineProperty(Fp,"__esModule",{value:!0});function CD(t,e,r){let i=setTimeout.apply(globalThis,arguments);return i&&typeof i=="object"&&typeof i.unref=="function"&&i.unref(),i}l(CD,"setTimeoutUnref");Fp.default=CD});var E_=T(_s=>{"use strict";Object.defineProperty(_s,"__esModule",{value:!0});_s.Writable=_s.Readable=void 0;var v_=ne("node:stream");Object.defineProperty(_s,"Readable",{enumerable:!0,get:l(function(){return v_.Readable},"get")});Object.defineProperty(_s,"Writable",{enumerable:!0,get:l(function(){return v_.Writable},"get")})});var Tp=T(Ll=>{"use strict";Object.defineProperty(Ll,"__esModule",{value:!0});Ll.EventEmitter=void 0;var DD=ne("node:events");Object.defineProperty(Ll,"EventEmitter",{enumerable:!0,get:l(function(){return DD.EventEmitter},"get")})});var F_=T(jl=>{"use strict";Object.defineProperty(jl,"__esModule",{value:!0});jl.FileHandle=void 0;var et=Qr(),ID=Tp(),Rp=class Rp extends ID.EventEmitter{constructor(e,r){super(),this.refs=1,this.closePromise=null,this.position=0,this.readableWebStreamLocked=!1,this.fs=e,this.fd=r}getAsyncId(){return this.fd}appendFile(e,r){return(0,et.promisify)(this.fs,"appendFile")(this.fd,e,r)}chmod(e){return(0,et.promisify)(this.fs,"fchmod")(this.fd,e)}chown(e,r){return(0,et.promisify)(this.fs,"fchown")(this.fd,e,r)}close(){if(this.fd===-1)return Promise.resolve();if(this.closePromise)return this.closePromise;if(this.refs--,this.refs===0){let e=this.fd;this.fd=-1,this.closePromise=(0,et.promisify)(this.fs,"close")(e).finally(()=>{this.closePromise=null})}else this.closePromise=new Promise((e,r)=>{this.closeResolve=e,this.closeReject=r}).finally(()=>{this.closePromise=null,this.closeReject=void 0,this.closeResolve=void 0});return this.emit("close"),this.closePromise}datasync(){return(0,et.promisify)(this.fs,"fdatasync")(this.fd)}createReadStream(e){return this.fs.createReadStream("",{...e,fd:this})}createWriteStream(e){return this.fs.createWriteStream("",{...e,fd:this})}readableWebStream(e={}){let{type:r="bytes",autoClose:i=!1}=e,n=0;if(this.fd===-1)throw new Error("The FileHandle is closed");if(this.closePromise)throw new Error("The FileHandle is closing");if(this.readableWebStreamLocked)throw new Error("An error will be thrown if this method is called more than once or is called after the FileHandle is closed or closing.");this.readableWebStreamLocked=!0,this.ref();let s=l(()=>{this.readableWebStreamLocked=!1,this.unref(),i&&this.close().catch(()=>{})},"unlockAndCleanup");return new ReadableStream({type:r==="bytes"?"bytes":void 0,autoAllocateChunkSize:16384,pull:l(async o=>{try{let f=o.byobRequest?.view;if(!f){let a=new Uint8Array(16384),u=await this.read(a,0,a.length,n);if(u.bytesRead===0){o.close(),s();return}n+=u.bytesRead,o.enqueue(a.slice(0,u.bytesRead));return}let c=await this.read(f,f.byteOffset,f.byteLength,n);if(c.bytesRead===0){o.close(),s();return}n+=c.bytesRead,o.byobRequest.respond(c.bytesRead)}catch(f){o.error(f),s()}},"pull"),cancel:l(async()=>{s()},"cancel")})}async read(e,r,i,n){let s=n??this.position,o=await(0,et.promisify)(this.fs,"read",f=>({bytesRead:f,buffer:e}))(this.fd,e,r,i,s);return n==null&&(this.position+=o.bytesRead),o}readv(e,r){return(0,et.promisify)(this.fs,"readv",i=>({bytesRead:i,buffers:e}))(this.fd,e,r)}readFile(e){return(0,et.promisify)(this.fs,"readFile")(this.fd,e)}stat(e){return(0,et.promisify)(this.fs,"fstat")(this.fd,e)}sync(){return(0,et.promisify)(this.fs,"fsync")(this.fd)}truncate(e){return(0,et.promisify)(this.fs,"ftruncate")(this.fd,e)}utimes(e,r){return(0,et.promisify)(this.fs,"futimes")(this.fd,e,r)}async write(e,r,i,n){let s=typeof n!="number",o=s?this.position:n,f=await(0,et.promisify)(this.fs,"write",c=>({bytesWritten:c,buffer:e}))(this.fd,e,r,i,o);return s&&(this.position+=f.bytesWritten),f}writev(e,r){return(0,et.promisify)(this.fs,"writev",i=>({bytesWritten:i,buffers:e}))(this.fd,e,r)}writeFile(e,r){return(0,et.promisify)(this.fs,"writeFile")(this.fd,e,r)}async[Symbol.asyncDispose](){await this.close()}ref(){this.refs++}unref(){this.refs--,this.refs===0&&(this.fd=-1,this.closeResolve&&(0,et.promisify)(this.fs,"close")(this.fd).then(this.closeResolve,this.closeReject))}};l(Rp,"FileHandle");var kp=Rp;jl.FileHandle=kp});var T_=T(ql=>{"use strict";Object.defineProperty(ql,"__esModule",{value:!0});ql.FsPromises=void 0;var se=Qr(),$D=Gt(),Ap=class Ap{constructor(e,r,i={}){if(this.fs=e,this.path=r,this.options=i,this.eventQueue=[],this.resolveQueue=[],this.finished=!1,this.maxQueue=i.maxQueue||2048,this.overflow=i.overflow||"ignore",this.startWatching(),i.signal){if(i.signal.aborted){this.finish();return}i.signal.addEventListener("abort",()=>{this.finish()})}}startWatching(){try{this.watcher=this.fs.watch(this.path,this.options,(e,r)=>{this.enqueueEvent({eventType:e,filename:r})})}catch(e){throw this.finish(),e}}enqueueEvent(e){if(!this.finished){if(this.eventQueue.length>=this.maxQueue)if(this.overflow==="throw"){let r=new Error(`Watch queue overflow: more than ${this.maxQueue} events queued`);this.finish(r);return}else this.eventQueue.shift(),console.warn(`Watch queue overflow: dropping event due to exceeding maxQueue of ${this.maxQueue}`);if(this.eventQueue.push(e),this.resolveQueue.length>0){let{resolve:r}=this.resolveQueue.shift(),i=this.eventQueue.shift();r({value:i,done:!1})}}}finish(e){if(!this.finished)for(this.finished=!0,this.watcher&&(this.watcher.close(),this.watcher=null);this.resolveQueue.length>0;){let{resolve:r,reject:i}=this.resolveQueue.shift();e?i(e):r({value:void 0,done:!0})}}async next(){return this.finished?{value:void 0,done:!0}:this.eventQueue.length>0?{value:this.eventQueue.shift(),done:!1}:new Promise((e,r)=>{this.resolveQueue.push({resolve:e,reject:r})})}async return(){return this.finish(),{value:void 0,done:!0}}async throw(e){throw this.finish(e),e}[Symbol.asyncIterator](){return this}};l(Ap,"FSWatchAsyncIterator");var Op=Ap,Pp=class Pp{constructor(e,r){this.fs=e,this.FileHandle=r,this.constants=$D.constants,this.cp=(0,se.promisify)(this.fs,"cp"),this.opendir=(0,se.promisify)(this.fs,"opendir"),this.statfs=(0,se.promisify)(this.fs,"statfs"),this.lutimes=(0,se.promisify)(this.fs,"lutimes"),this.glob=(0,se.promisify)(this.fs,"glob"),this.access=(0,se.promisify)(this.fs,"access"),this.chmod=(0,se.promisify)(this.fs,"chmod"),this.chown=(0,se.promisify)(this.fs,"chown"),this.copyFile=(0,se.promisify)(this.fs,"copyFile"),this.lchmod=(0,se.promisify)(this.fs,"lchmod"),this.lchown=(0,se.promisify)(this.fs,"lchown"),this.link=(0,se.promisify)(this.fs,"link"),this.lstat=(0,se.promisify)(this.fs,"lstat"),this.mkdir=(0,se.promisify)(this.fs,"mkdir"),this.mkdtemp=(0,se.promisify)(this.fs,"mkdtemp"),this.readdir=(0,se.promisify)(this.fs,"readdir"),this.readlink=(0,se.promisify)(this.fs,"readlink"),this.realpath=(0,se.promisify)(this.fs,"realpath"),this.rename=(0,se.promisify)(this.fs,"rename"),this.rmdir=(0,se.promisify)(this.fs,"rmdir"),this.rm=(0,se.promisify)(this.fs,"rm"),this.stat=(0,se.promisify)(this.fs,"stat"),this.symlink=(0,se.promisify)(this.fs,"symlink"),this.truncate=(0,se.promisify)(this.fs,"truncate"),this.unlink=(0,se.promisify)(this.fs,"unlink"),this.utimes=(0,se.promisify)(this.fs,"utimes"),this.readFile=(i,n)=>(0,se.promisify)(this.fs,"readFile")(i instanceof this.FileHandle?i.fd:i,n),this.appendFile=(i,n,s)=>(0,se.promisify)(this.fs,"appendFile")(i instanceof this.FileHandle?i.fd:i,n,s),this.open=(i,n="r",s)=>(0,se.promisify)(this.fs,"open",o=>new this.FileHandle(this.fs,o))(i,n,s),this.writeFile=(i,n,s)=>((0,se.isReadableStream)(n)?(0,se.streamToBuffer)(n):Promise.resolve(n)).then(f=>(0,se.promisify)(this.fs,"writeFile")(i instanceof this.FileHandle?i.fd:i,f,s)),this.watch=(i,n)=>{let s=typeof n=="string"?{encoding:n}:n||{};return new Op(this.fs,i,s)}}};l(Pp,"FsPromises");var xp=Pp;ql.FsPromises=xp});var k_=T(Ul=>{"use strict";Object.defineProperty(Ul,"__esModule",{value:!0});Ul.printTree=void 0;var BD=l((t="",e)=>{let r="",i=e.length-1;for(;i>=0&&!e[i];i--);for(let n=0;n<=i;n++){let s=e[n];if(!s)continue;let o=n===i,f=s(t+(o?" ":"\u2502")+" "),c=f?o?"\u2514\u2500":"\u251C\u2500":"\u2502";r+=`
|
|
5
|
-
`+t+c+(
|
|
4
|
+
var RI=Object.create;var hs=Object.defineProperty;var AI=Object.getOwnPropertyDescriptor;var PI=Object.getOwnPropertyNames;var NI=Object.getPrototypeOf,DI=Object.prototype.hasOwnProperty;var O_=t=>{throw TypeError(t)};var CI=(t,e,r)=>e in t?hs(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var u=(t,e)=>hs(t,"name",{value:e,configurable:!0}),ne=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,r)=>(typeof require<"u"?require:e)[r]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var II=(t,e)=>()=>(t&&(e=t(t=0)),e);var x=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),$I=(t,e)=>{for(var r in e)hs(t,r,{get:e[r],enumerable:!0})},R_=(t,e,r,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of PI(e))!DI.call(t,n)&&n!==r&&hs(t,n,{get:()=>e[n],enumerable:!(i=AI(e,n))||i.enumerable});return t};var de=(t,e,r)=>(r=t!=null?RI(NI(t)):{},R_(e||!t||!t.__esModule?hs(r,"default",{value:t,enumerable:!0}):r,t)),Yp=t=>R_(hs({},"__esModule",{value:!0}),t);var W=(t,e,r)=>CI(t,typeof e!="symbol"?e+"":e,r),A_=(t,e,r)=>e.has(t)||O_("Cannot "+r);var Zo=(t,e,r)=>(A_(t,e,"read from private field"),r?r.call(t):e.get(t)),Ko=(t,e,r)=>e.has(t)?O_("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),Jo=(t,e,r,i)=>(A_(t,e,"write to private field"),i?i.call(t,r):e.set(t,r),r);var uf=x((ZY,ff)=>{function cv(t){return Array.isArray(t)?t:[t]}u(cv,"makeArray");var WI=void 0,lm="",ov=" ",om="\\",HI=/^\s+$/,VI=/(?:[^\\]|^)\\$/,GI=/^\\!/,ZI=/^\\#/,KI=/\r?\n/g,JI=/^\.{0,2}\/|^\.{1,2}$/,YI=/\/$/,Vs="/",fv="node-ignore";typeof Symbol<"u"&&(fv=Symbol.for("node-ignore"));var uv=fv,Gs=u((t,e,r)=>(Object.defineProperty(t,e,{value:r}),r),"define"),XI=/([0-z])-([0-z])/g,hv=u(()=>!1,"RETURN_FALSE"),QI=u(t=>t.replace(XI,(e,r,i)=>r.charCodeAt(0)<=i.charCodeAt(0)?e:lm),"sanitizeRange"),e2=u(t=>{let{length:e}=t;return t.slice(0,e-e%2)},"cleanRangeBackSlash"),t2=[[/^\uFEFF/,()=>lm],[/((?:\\\\)*?)(\\?\s+)$/,(t,e,r)=>e+(r.indexOf("\\")===0?ov:lm)],[/(\\+?)\s/g,(t,e)=>{let{length:r}=e;return e.slice(0,r-r%2)+ov}],[/[\\$.|*+(){^]/g,t=>`\\${t}`],[/(?!\\)\?/g,()=>"[^/]"],[/^\//,()=>"^"],[/\//g,()=>"\\/"],[/^\^*\\\*\\\*\\\//,()=>"^(?:.*\\/)?"],[/^(?=[^^])/,u(function(){return/\/(?!$)/.test(this)?"^":"(?:^|\\/)"},"startingReplacer")],[/\\\/\\\*\\\*(?=\\\/|$)/g,(t,e,r)=>e+6<r.length?"(?:\\/[^\\/]+)*":"\\/.+"],[/(^|[^\\]+)(\\\*)+(?=.+)/g,(t,e,r)=>{let i=r.replace(/\\\*/g,"[^\\/]*");return e+i}],[/\\\\\\(?=[$.|*+(){^])/g,()=>om],[/\\\\/g,()=>om],[/(\\)?\[([^\]/]*?)(\\*)($|\])/g,(t,e,r,i,n)=>e===om?`\\[${r}${e2(i)}${n}`:n==="]"&&i.length%2===0?`[${QI(r)}${i}]`:"[]"],[/(?:[^*])$/,t=>/\/$/.test(t)?`${t}$`:`${t}(?=$|\\/$)`]],r2=/(^|\\\/)?\\\*$/,il="regex",lf="checkRegex",lv="_",i2={[il](t,e){return`${e?`${e}[^/]+`:"[^/]*"}(?=$|\\/$)`},[lf](t,e){return`${e?`${e}[^/]*`:"[^/]*"}(?=$|\\/$)`}},n2=u(t=>t2.reduce((e,[r,i])=>e.replace(r,i.bind(t)),t),"makeRegexPrefix"),cf=u(t=>typeof t=="string","isString"),s2=u(t=>t&&cf(t)&&!HI.test(t)&&!VI.test(t)&&t.indexOf("#")!==0,"checkPattern"),a2=u(t=>t.split(KI).filter(Boolean),"splitPattern"),dm=class dm{constructor(e,r,i,n,s,a){this.pattern=e,this.mark=r,this.negative=s,Gs(this,"body",i),Gs(this,"ignoreCase",n),Gs(this,"regexPrefix",a)}get regex(){let e=lv+il;return this[e]?this[e]:this._make(il,e)}get checkRegex(){let e=lv+lf;return this[e]?this[e]:this._make(lf,e)}_make(e,r){let i=this.regexPrefix.replace(r2,i2[e]),n=this.ignoreCase?new RegExp(i,"i"):new RegExp(i);return Gs(this,r,n)}};u(dm,"IgnoreRule");var cm=dm,o2=u(({pattern:t,mark:e},r)=>{let i=!1,n=t;n.indexOf("!")===0&&(i=!0,n=n.substr(1)),n=n.replace(GI,"!").replace(ZI,"#");let s=n2(n);return new cm(t,e,n,r,i,s)},"createRule"),pm=class pm{constructor(e){this._ignoreCase=e,this._rules=[]}_add(e){if(e&&e[uv]){this._rules=this._rules.concat(e._rules._rules),this._added=!0;return}if(cf(e)&&(e={pattern:e}),s2(e.pattern)){let r=o2(e,this._ignoreCase);this._added=!0,this._rules.push(r)}}add(e){return this._added=!1,cv(cf(e)?a2(e):e).forEach(this._add,this),this._added}test(e,r,i){let n=!1,s=!1,a;this._rules.forEach(c=>{let{negative:o}=c;s===o&&n!==s||o&&!n&&!s&&!r||!c[i].test(e)||(n=!o,s=o,a=o?WI:c)});let l={ignored:n,unignored:s};return a&&(l.rule=a),l}};u(pm,"RuleManager");var fm=pm,l2=u((t,e)=>{throw new e(t)},"throwError"),Zr=u((t,e,r)=>cf(t)?t?Zr.isNotRelative(t)?r(`path should be a \`path.relative()\`d string, but got "${e}"`,RangeError):!0:r("path must not be empty",TypeError):r(`path must be a string, but got \`${e}\``,TypeError),"checkPath"),dv=u(t=>JI.test(t),"isNotRelative");Zr.isNotRelative=dv;Zr.convert=t=>t;var mm=class mm{constructor({ignorecase:e=!0,ignoreCase:r=e,allowRelativePaths:i=!1}={}){Gs(this,uv,!0),this._rules=new fm(r),this._strictPathCheck=!i,this._initCache()}_initCache(){this._ignoreCache=Object.create(null),this._testCache=Object.create(null)}add(e){return this._rules.add(e)&&this._initCache(),this}addPattern(e){return this.add(e)}_test(e,r,i,n){let s=e&&Zr.convert(e);return Zr(s,e,this._strictPathCheck?l2:hv),this._t(s,r,i,n)}checkIgnore(e){if(!YI.test(e))return this.test(e);let r=e.split(Vs).filter(Boolean);if(r.pop(),r.length){let i=this._t(r.join(Vs)+Vs,this._testCache,!0,r);if(i.ignored)return i}return this._rules.test(e,!1,lf)}_t(e,r,i,n){if(e in r)return r[e];if(n||(n=e.split(Vs).filter(Boolean)),n.pop(),!n.length)return r[e]=this._rules.test(e,i,il);let s=this._t(n.join(Vs)+Vs,r,i,n);return r[e]=s.ignored?s:this._rules.test(e,i,il)}ignores(e){return this._test(e,this._ignoreCache,!1).ignored}createFilter(){return e=>!this.ignores(e)}filter(e){return cv(e).filter(this.createFilter())}test(e){return this._test(e,this._testCache,!0)}};u(mm,"Ignore");var um=mm,hm=u(t=>new um(t),"factory"),c2=u(t=>Zr(t&&Zr.convert(t),t,hv),"isPathValid"),pv=u(()=>{let t=u(r=>/^\\\\\?\\/.test(r)||/["<>|\u0000-\u001F]+/u.test(r)?r:r.replace(/\\/g,"/"),"makePosix");Zr.convert=t;let e=/^[a-z]:\//i;Zr.isNotRelative=r=>e.test(r)||dv(r)},"setupWindows");typeof process<"u"&&process.platform==="win32"&&pv();ff.exports=hm;hm.default=hm;ff.exports.isPathValid=c2;Gs(ff.exports,Symbol.for("setupWindows"),pv)});var lr=x(Zs=>{"use strict";Object.defineProperty(Zs,"__esModule",{value:!0});Zs.constants=Zs.SEP=void 0;Zs.SEP="/";Zs.constants={O_RDONLY:0,O_WRONLY:1,O_RDWR:2,S_IFMT:61440,S_IFREG:32768,S_IFDIR:16384,S_IFCHR:8192,S_IFBLK:24576,S_IFIFO:4096,S_IFLNK:40960,S_IFSOCK:49152,O_CREAT:64,O_EXCL:128,O_NOCTTY:256,O_TRUNC:512,O_APPEND:1024,O_DIRECTORY:65536,O_NOATIME:262144,O_NOFOLLOW:131072,O_SYNC:1052672,O_SYMLINK:2097152,O_DIRECT:16384,O_NONBLOCK:2048,S_IRWXU:448,S_IRUSR:256,S_IWUSR:128,S_IXUSR:64,S_IRWXG:56,S_IRGRP:32,S_IWGRP:16,S_IXGRP:8,S_IRWXO:7,S_IROTH:4,S_IWOTH:2,S_IXOTH:1,F_OK:0,R_OK:4,W_OK:2,X_OK:1,UV_FS_SYMLINK_DIR:1,UV_FS_SYMLINK_JUNCTION:2,UV_FS_COPYFILE_EXCL:1,UV_FS_COPYFILE_FICLONE:2,UV_FS_COPYFILE_FICLONE_FORCE:4,COPYFILE_EXCL:1,COPYFILE_FICLONE:2,COPYFILE_FICLONE_FORCE:4}});var wm=x(nl=>{"use strict";Object.defineProperty(nl,"__esModule",{value:!0});nl.Stats=void 0;var f2=lr(),{S_IFMT:u2,S_IFDIR:h2,S_IFREG:d2,S_IFBLK:p2,S_IFCHR:m2,S_IFLNK:w2,S_IFIFO:y2,S_IFSOCK:g2}=f2.constants,df=class df{static build(e,r=!1){let i=new df,{uid:n,gid:s,atime:a,mtime:l,ctime:c}=e,o=r?h=>BigInt(h):h=>h;i.uid=o(n),i.gid=o(s),i.rdev=o(e.rdev),i.blksize=o(4096),i.ino=o(e.ino),i.size=o(e.getSize()),i.blocks=o(1),i.atime=a,i.mtime=l,i.ctime=c,i.birthtime=c,i.atimeMs=o(a.getTime()),i.mtimeMs=o(l.getTime());let f=o(c.getTime());if(i.ctimeMs=f,i.birthtimeMs=f,r){i.atimeNs=BigInt(a.getTime())*BigInt(1e6),i.mtimeNs=BigInt(l.getTime())*BigInt(1e6);let h=BigInt(c.getTime())*BigInt(1e6);i.ctimeNs=h,i.birthtimeNs=h}return i.dev=o(0),i.mode=o(e.mode),i.nlink=o(e.nlink),i}_checkModeProperty(e){return(Number(this.mode)&u2)===e}isDirectory(){return this._checkModeProperty(h2)}isFile(){return this._checkModeProperty(d2)}isBlockDevice(){return this._checkModeProperty(p2)}isCharacterDevice(){return this._checkModeProperty(m2)}isSymbolicLink(){return this._checkModeProperty(w2)}isFIFO(){return this._checkModeProperty(y2)}isSocket(){return this._checkModeProperty(g2)}};u(df,"Stats");var hf=df;nl.Stats=hf;nl.default=hf});var mv=x(pf=>{"use strict";Object.defineProperty(pf,"__esModule",{value:!0});pf.Buffer=void 0;var b2=ne("node:buffer");Object.defineProperty(pf,"Buffer",{enumerable:!0,get:u(function(){return b2.Buffer},"get")})});var Si=x(vi=>{"use strict";Object.defineProperty(vi,"__esModule",{value:!0});vi.bufferFrom=vi.bufferAllocUnsafe=vi.Buffer=void 0;var mf=mv();Object.defineProperty(vi,"Buffer",{enumerable:!0,get:u(function(){return mf.Buffer},"get")});function wv(t,...e){return new mf.Buffer(t,...e)}u(wv,"bufferV0P12Ponyfill");var _2=mf.Buffer.allocUnsafe||wv;vi.bufferAllocUnsafe=_2;var v2=mf.Buffer.from||wv;vi.bufferFrom=v2});var gm=x(Ks=>{"use strict";Object.defineProperty(Ks,"__esModule",{value:!0});Ks.inherits=S2;Ks.promisify=E2;Ks.inspect=ym;Ks.format=F2;function S2(t,e){if(t==null)throw new TypeError("The constructor to inherit from is not defined");if(e==null)throw new TypeError("The super constructor to inherit from is not defined");t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}u(S2,"inherits");function E2(t){if(typeof t!="function")throw new TypeError('The "original" argument must be of type function');return function(...e){return new Promise((r,i)=>{t.call(this,...e,(n,s)=>{n?i(n):r(s)})})}}u(E2,"promisify");function ym(t){return t===null?"null":t===void 0?"undefined":typeof t=="string"?`'${t}'`:typeof t=="number"||typeof t=="boolean"?String(t):Array.isArray(t)?`[ ${t.map(r=>ym(r)).join(", ")} ]`:typeof t=="object"?`{ ${Object.entries(t).map(([r,i])=>`${r}: ${ym(i)}`).join(", ")} }`:String(t)}u(ym,"inspect");function F2(t,...e){if(e.length===0)return t;let r=t,i=0;for(r=r.replace(/%[sdj%]/g,n=>{if(i>=e.length)return n;let s=e[i++];switch(n){case"%s":return String(s);case"%d":return Number(s).toString();case"%j":try{return JSON.stringify(s)}catch{return"[Circular]"}case"%%":return"%";default:return n}});i<e.length;)r+=" "+String(e[i++]);return r}u(F2,"format")});var sl=x(ot=>{"use strict";Object.defineProperty(ot,"__esModule",{value:!0});ot.AssertionError=ot.RangeError=ot.TypeError=ot.Error=void 0;ot.message=bv;ot.E=Ei;var bm=gm(),yv=typeof Symbol>"u"?"_kCode":Symbol("code"),gv={};function vm(t){var e;return e=class extends t{constructor(i,...n){super(bv(i,n)),this.code=i,this[yv]=i,this.name=`${super.name} [${this[yv]}]`}},u(e,"NodeError"),e}u(vm,"makeNodeError");var wf=globalThis,Sm=class Sm extends wf.Error{constructor(e){if(typeof e!="object"||e===null)throw new ot.TypeError("ERR_INVALID_ARG_TYPE","options","object");e.message?super(e.message):super(`${(0,bm.inspect)(e.actual).slice(0,128)} ${e.operator} ${(0,bm.inspect)(e.expected).slice(0,128)}`),this.generatedMessage=!e.message,this.name="AssertionError [ERR_ASSERTION]",this.code="ERR_ASSERTION",this.actual=e.actual,this.expected=e.expected,this.operator=e.operator,ot.Error.captureStackTrace(this,e.stackStartFunction)}};u(Sm,"AssertionError");var _m=Sm;ot.AssertionError=_m;function bv(t,e){if(typeof t!="string")throw new ot.Error("Error message key must be a string");let r=gv[t];if(!r)throw new ot.Error(`An invalid error message key was used: ${t}.`);let i;if(typeof r=="function")i=r;else{if(i=bm.format,e===void 0||e.length===0)return r;e.unshift(r)}return String(i.apply(null,e))}u(bv,"message");function Ei(t,e){gv[t]=typeof e=="function"?e:String(e)}u(Ei,"E");ot.Error=vm(wf.Error);ot.TypeError=vm(wf.TypeError);ot.RangeError=vm(wf.RangeError);Ei("ERR_DIR_CLOSED","Directory handle was closed");Ei("ERR_DIR_CONCURRENT_OPERATION","Cannot do synchronous work on directory handle with concurrent asynchronous operations");Ei("ERR_INVALID_FILE_URL_HOST",'File URL host must be "localhost" or empty on %s');Ei("ERR_INVALID_FILE_URL_PATH","File URL path %s");Ei("ERR_INVALID_OPT_VALUE",(t,e)=>`The value "${String(e)}" is invalid for option "${t}"`);Ei("ERR_INVALID_OPT_VALUE_ENCODING",t=>`The value "${String(t)}" is invalid for option "encoding"`);Ei("ERR_INVALID_ARG_VALUE","Unable to open file as blob")});var al=x(dn=>{"use strict";Object.defineProperty(dn,"__esModule",{value:!0});dn.ENCODING_UTF8=void 0;dn.assertEncoding=T2;dn.strToEncoding=x2;var Em=Si(),k2=sl();dn.ENCODING_UTF8="utf8";function T2(t){if(t&&!Em.Buffer.isEncoding(t))throw new k2.TypeError("ERR_INVALID_OPT_VALUE_ENCODING",t)}u(T2,"assertEncoding");function x2(t,e){return!e||e===dn.ENCODING_UTF8?t:e==="buffer"?new Em.Buffer(t):new Em.Buffer(t).toString(e)}u(x2,"strToEncoding")});var bf=x(ol=>{"use strict";Object.defineProperty(ol,"__esModule",{value:!0});ol.Dirent=void 0;var O2=lr(),R2=al(),{S_IFMT:A2,S_IFDIR:P2,S_IFREG:N2,S_IFBLK:D2,S_IFCHR:C2,S_IFLNK:I2,S_IFIFO:$2,S_IFSOCK:B2}=O2.constants,gf=class gf{constructor(){this.name="",this.path="",this.parentPath="",this.mode=0}static build(e,r){let i=new gf,{mode:n}=e.getNode();return i.name=(0,R2.strToEncoding)(e.getName(),r),i.mode=n,i.path=e.getParentPath(),i.parentPath=i.path,i}_checkModeProperty(e){return(this.mode&A2)===e}isDirectory(){return this._checkModeProperty(P2)}isFile(){return this._checkModeProperty(N2)}isBlockDevice(){return this._checkModeProperty(D2)}isCharacterDevice(){return this._checkModeProperty(C2)}isSymbolicLink(){return this._checkModeProperty(I2)}isFIFO(){return this._checkModeProperty($2)}isSocket(){return this._checkModeProperty(B2)}};u(gf,"Dirent");var yf=gf;ol.Dirent=yf;ol.default=yf});var Js=x(Ie=>{"use strict";Object.defineProperty(Ie,"__esModule",{value:!0});Ie.basename=Ie.isAbsolute=Ie.normalize=Ie.dirname=Ie.relative=Ie.join=Ie.posix=Ie.sep=Ie.resolve=void 0;var Kr=ne("node:path");Object.defineProperty(Ie,"resolve",{enumerable:!0,get:u(function(){return Kr.resolve},"get")});Object.defineProperty(Ie,"sep",{enumerable:!0,get:u(function(){return Kr.sep},"get")});Object.defineProperty(Ie,"posix",{enumerable:!0,get:u(function(){return Kr.posix},"get")});Object.defineProperty(Ie,"join",{enumerable:!0,get:u(function(){return Kr.join},"get")});Object.defineProperty(Ie,"relative",{enumerable:!0,get:u(function(){return Kr.relative},"get")});Object.defineProperty(Ie,"dirname",{enumerable:!0,get:u(function(){return Kr.dirname},"get")});Object.defineProperty(Ie,"normalize",{enumerable:!0,get:u(function(){return Kr.normalize},"get")});Object.defineProperty(Ie,"isAbsolute",{enumerable:!0,get:u(function(){return Kr.isAbsolute},"get")});Object.defineProperty(Ie,"basename",{enumerable:!0,get:u(function(){return Kr.basename},"get")})});var Ef={};$I(Ef,{__addDisposableResource:()=>Wv,__assign:()=>_f,__asyncDelegator:()=>$v,__asyncGenerator:()=>Iv,__asyncValues:()=>Bv,__await:()=>Ys,__awaiter:()=>Rv,__classPrivateFieldGet:()=>qv,__classPrivateFieldIn:()=>zv,__classPrivateFieldSet:()=>Uv,__createBinding:()=>Sf,__decorate:()=>Sv,__disposeResources:()=>Hv,__esDecorate:()=>Fv,__exportStar:()=>Pv,__extends:()=>_v,__generator:()=>Av,__importDefault:()=>jv,__importStar:()=>Mv,__makeTemplateObject:()=>Lv,__metadata:()=>Ov,__param:()=>Ev,__propKey:()=>Tv,__read:()=>Tm,__rest:()=>vv,__rewriteRelativeImportExtension:()=>Vv,__runInitializers:()=>kv,__setFunctionName:()=>xv,__spread:()=>Nv,__spreadArray:()=>Cv,__spreadArrays:()=>Dv,__values:()=>vf,default:()=>j2});function _v(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");Fm(t,e);function r(){this.constructor=t}u(r,"__"),t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function vv(t,e){var r={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(r[i]=t[i]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,i=Object.getOwnPropertySymbols(t);n<i.length;n++)e.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(t,i[n])&&(r[i[n]]=t[i[n]]);return r}function Sv(t,e,r,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,r):i,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,i);else for(var l=t.length-1;l>=0;l--)(a=t[l])&&(s=(n<3?a(s):n>3?a(e,r,s):a(e,r))||s);return n>3&&s&&Object.defineProperty(e,r,s),s}function Ev(t,e){return function(r,i){e(r,i,t)}}function Fv(t,e,r,i,n,s){function a(b){if(b!==void 0&&typeof b!="function")throw new TypeError("Function expected");return b}u(a,"accept");for(var l=i.kind,c=l==="getter"?"get":l==="setter"?"set":"value",o=!e&&t?i.static?t:t.prototype:null,f=e||(o?Object.getOwnPropertyDescriptor(o,i.name):{}),h,d=!1,p=r.length-1;p>=0;p--){var m={};for(var w in i)m[w]=w==="access"?{}:i[w];for(var w in i.access)m.access[w]=i.access[w];m.addInitializer=function(b){if(d)throw new TypeError("Cannot add initializers after decoration has completed");s.push(a(b||null))};var g=(0,r[p])(l==="accessor"?{get:f.get,set:f.set}:f[c],m);if(l==="accessor"){if(g===void 0)continue;if(g===null||typeof g!="object")throw new TypeError("Object expected");(h=a(g.get))&&(f.get=h),(h=a(g.set))&&(f.set=h),(h=a(g.init))&&n.unshift(h)}else(h=a(g))&&(l==="field"?n.unshift(h):f[c]=h)}o&&Object.defineProperty(o,i.name,f),d=!0}function kv(t,e,r){for(var i=arguments.length>2,n=0;n<e.length;n++)r=i?e[n].call(t,r):e[n].call(t);return i?r:void 0}function Tv(t){return typeof t=="symbol"?t:"".concat(t)}function xv(t,e,r){return typeof e=="symbol"&&(e=e.description?"[".concat(e.description,"]"):""),Object.defineProperty(t,"name",{configurable:!0,value:r?"".concat(r," ",e):e})}function Ov(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function Rv(t,e,r,i){function n(s){return s instanceof r?s:new r(function(a){a(s)})}return u(n,"adopt"),new(r||(r=Promise))(function(s,a){function l(f){try{o(i.next(f))}catch(h){a(h)}}u(l,"fulfilled");function c(f){try{o(i.throw(f))}catch(h){a(h)}}u(c,"rejected");function o(f){f.done?s(f.value):n(f.value).then(l,c)}u(o,"step"),o((i=i.apply(t,e||[])).next())})}function Av(t,e){var r={label:0,sent:u(function(){if(s[0]&1)throw s[1];return s[1]},"sent"),trys:[],ops:[]},i,n,s,a=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return a.next=l(0),a.throw=l(1),a.return=l(2),typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function l(o){return function(f){return c([o,f])}}function c(o){if(i)throw new TypeError("Generator is already executing.");for(;a&&(a=0,o[0]&&(r=0)),r;)try{if(i=1,n&&(s=o[0]&2?n.return:o[0]?n.throw||((s=n.return)&&s.call(n),0):n.next)&&!(s=s.call(n,o[1])).done)return s;switch(n=0,s&&(o=[o[0]&2,s.value]),o[0]){case 0:case 1:s=o;break;case 4:return r.label++,{value:o[1],done:!1};case 5:r.label++,n=o[1],o=[0];continue;case 7:o=r.ops.pop(),r.trys.pop();continue;default:if(s=r.trys,!(s=s.length>0&&s[s.length-1])&&(o[0]===6||o[0]===2)){r=0;continue}if(o[0]===3&&(!s||o[1]>s[0]&&o[1]<s[3])){r.label=o[1];break}if(o[0]===6&&r.label<s[1]){r.label=s[1],s=o;break}if(s&&r.label<s[2]){r.label=s[2],r.ops.push(o);break}s[2]&&r.ops.pop(),r.trys.pop();continue}o=e.call(t,r)}catch(f){o=[6,f],n=0}finally{i=s=0}if(o[0]&5)throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}}function Pv(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Sf(e,t,r)}function vf(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],i=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:u(function(){return t&&i>=t.length&&(t=void 0),{value:t&&t[i++],done:!t}},"next")};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Tm(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var i=r.call(t),n,s=[],a;try{for(;(e===void 0||e-- >0)&&!(n=i.next()).done;)s.push(n.value)}catch(l){a={error:l}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(a)throw a.error}}return s}function Nv(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(Tm(arguments[e]));return t}function Dv(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;for(var i=Array(t),n=0,e=0;e<r;e++)for(var s=arguments[e],a=0,l=s.length;a<l;a++,n++)i[n]=s[a];return i}function Cv(t,e,r){if(r||arguments.length===2)for(var i=0,n=e.length,s;i<n;i++)(s||!(i in e))&&(s||(s=Array.prototype.slice.call(e,0,i)),s[i]=e[i]);return t.concat(s||Array.prototype.slice.call(e))}function Ys(t){return this instanceof Ys?(this.v=t,this):new Ys(t)}function Iv(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i=r.apply(t,e||[]),n,s=[];return n=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),l("next"),l("throw"),l("return",a),n[Symbol.asyncIterator]=function(){return this},n;function a(p){return function(m){return Promise.resolve(m).then(p,h)}}function l(p,m){i[p]&&(n[p]=function(w){return new Promise(function(g,b){s.push([p,w,g,b])>1||c(p,w)})},m&&(n[p]=m(n[p])))}function c(p,m){try{o(i[p](m))}catch(w){d(s[0][3],w)}}function o(p){p.value instanceof Ys?Promise.resolve(p.value.v).then(f,h):d(s[0][2],p)}function f(p){c("next",p)}function h(p){c("throw",p)}function d(p,m){p(m),s.shift(),s.length&&c(s[0][0],s[0][1])}}function $v(t){var e,r;return e={},i("next"),i("throw",function(n){throw n}),i("return"),e[Symbol.iterator]=function(){return this},e;function i(n,s){e[n]=t[n]?function(a){return(r=!r)?{value:Ys(t[n](a)),done:!1}:s?s(a):a}:s}}function Bv(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof vf=="function"?vf(t):t[Symbol.iterator](),r={},i("next"),i("throw"),i("return"),r[Symbol.asyncIterator]=function(){return this},r);function i(s){r[s]=t[s]&&function(a){return new Promise(function(l,c){a=t[s](a),n(l,c,a.done,a.value)})}}function n(s,a,l,c){Promise.resolve(c).then(function(o){s({value:o,done:l})},a)}}function Lv(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function Mv(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r=km(t),i=0;i<r.length;i++)r[i]!=="default"&&Sf(e,t,r[i]);return L2(e,t),e}function jv(t){return t&&t.__esModule?t:{default:t}}function qv(t,e,r,i){if(r==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?i:r==="a"?i.call(t):i?i.value:e.get(t)}function Uv(t,e,r,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(t,r):n?n.value=r:e.set(t,r),r}function zv(t,e){if(e===null||typeof e!="object"&&typeof e!="function")throw new TypeError("Cannot use 'in' operator on non-object");return typeof t=="function"?e===t:t.has(e)}function Wv(t,e,r){if(e!=null){if(typeof e!="object"&&typeof e!="function")throw new TypeError("Object expected.");var i,n;if(r){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");i=e[Symbol.asyncDispose]}if(i===void 0){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");i=e[Symbol.dispose],r&&(n=i)}if(typeof i!="function")throw new TypeError("Object not disposable.");n&&(i=u(function(){try{n.call(this)}catch(s){return Promise.reject(s)}},"dispose")),t.stack.push({value:e,dispose:i,async:r})}else r&&t.stack.push({async:!0});return e}function Hv(t){function e(s){t.error=t.hasError?new M2(s,t.error,"An error was suppressed during disposal."):s,t.hasError=!0}u(e,"fail");var r,i=0;function n(){for(;r=t.stack.pop();)try{if(!r.async&&i===1)return i=0,t.stack.push(r),Promise.resolve().then(n);if(r.dispose){var s=r.dispose.call(r.value);if(r.async)return i|=2,Promise.resolve(s).then(n,function(a){return e(a),n()})}else i|=1}catch(a){e(a)}if(i===1)return t.hasError?Promise.reject(t.error):Promise.resolve();if(t.hasError)throw t.error}return u(n,"next"),n()}function Vv(t,e){return typeof t=="string"&&/^\.\.?\//.test(t)?t.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i,function(r,i,n,s,a){return i?e?".jsx":".js":n&&(!s||!a)?r:n+s+"."+a.toLowerCase()+"js"}):t}var Fm,_f,Sf,L2,km,M2,j2,Ff=II(()=>{Fm=u(function(t,e){return Fm=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(r[n]=i[n])},Fm(t,e)},"extendStatics");u(_v,"__extends");_f=u(function(){return _f=Object.assign||u(function(e){for(var r,i=1,n=arguments.length;i<n;i++){r=arguments[i];for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(e[s]=r[s])}return e},"__assign"),_f.apply(this,arguments)},"__assign");u(vv,"__rest");u(Sv,"__decorate");u(Ev,"__param");u(Fv,"__esDecorate");u(kv,"__runInitializers");u(Tv,"__propKey");u(xv,"__setFunctionName");u(Ov,"__metadata");u(Rv,"__awaiter");u(Av,"__generator");Sf=Object.create?function(t,e,r,i){i===void 0&&(i=r);var n=Object.getOwnPropertyDescriptor(e,r);(!n||("get"in n?!e.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:u(function(){return e[r]},"get")}),Object.defineProperty(t,i,n)}:function(t,e,r,i){i===void 0&&(i=r),t[i]=e[r]};u(Pv,"__exportStar");u(vf,"__values");u(Tm,"__read");u(Nv,"__spread");u(Dv,"__spreadArrays");u(Cv,"__spreadArray");u(Ys,"__await");u(Iv,"__asyncGenerator");u($v,"__asyncDelegator");u(Bv,"__asyncValues");u(Lv,"__makeTemplateObject");L2=Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e},km=u(function(t){return km=Object.getOwnPropertyNames||function(e){var r=[];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(r[r.length]=i);return r},km(t)},"ownKeys");u(Mv,"__importStar");u(jv,"__importDefault");u(qv,"__classPrivateFieldGet");u(Uv,"__classPrivateFieldSet");u(zv,"__classPrivateFieldIn");u(Wv,"__addDisposableResource");M2=typeof SuppressedError=="function"?SuppressedError:function(t,e,r){var i=new Error(r);return i.name="SuppressedError",i.error=t,i.suppressed=e,i};u(Hv,"__disposeResources");u(Vv,"__rewriteRelativeImportExtension");j2={__extends:_v,__assign:_f,__rest:vv,__decorate:Sv,__param:Ev,__esDecorate:Fv,__runInitializers:kv,__propKey:Tv,__setFunctionName:xv,__metadata:Ov,__awaiter:Rv,__generator:Av,__createBinding:Sf,__exportStar:Pv,__values:vf,__read:Tm,__spread:Nv,__spreadArrays:Dv,__spreadArray:Cv,__await:Ys,__asyncGenerator:Iv,__asyncDelegator:$v,__asyncValues:Bv,__makeTemplateObject:Lv,__importStar:Mv,__importDefault:jv,__classPrivateFieldGet:qv,__classPrivateFieldSet:Uv,__classPrivateFieldIn:zv,__addDisposableResource:Wv,__disposeResources:Hv,__rewriteRelativeImportExtension:Vv}});var Zv=x(Gv=>{"use strict";Object.defineProperty(Gv,"__esModule",{value:!0})});var Om=x(kf=>{"use strict";Object.defineProperty(kf,"__esModule",{value:!0});kf.flattenJSON=void 0;var Kv=Si(),xm=Js(),q2=xm.posix?xm.posix.join:xm.join,U2=u(t=>{let e={};function r(i,n){for(let s in n){let a=n[s],l=q2(i,s);typeof a=="string"||a instanceof Kv.Buffer?e[l]=a:typeof a=="object"&&a!==null&&!(a instanceof Kv.Buffer)&&Object.keys(a).length>0?r(l,a):e[l]=null}}return u(r,"flatten"),r("",t),e},"flattenJSON");kf.flattenJSON=U2});var ll=x(Tf=>{"use strict";Object.defineProperty(Tf,"__esModule",{value:!0});Tf.FanOut=void 0;var Am=class Am{constructor(){this.listeners=new Set}emit(e){this.listeners.forEach(r=>r(e))}listen(e){let r=this.listeners;return r.add(e),()=>r.delete(e)}};u(Am,"FanOut");var Rm=Am;Tf.FanOut=Rm});var Of=x(xf=>{"use strict";Object.defineProperty(xf,"__esModule",{value:!0});xf.createProcess=Jv;var z2=u(()=>{if(typeof process<"u")return process;try{return ne("process")}catch{return}},"maybeReturnProcess");function Jv(){let t=z2()||{};return t.cwd||(t.cwd=()=>"/"),t.emitWarning||(t.emitWarning=(e,r)=>{console.warn(`${r}${r?": ":""}${e}`)}),t.env||(t.env={}),t}u(Jv,"createProcess");xf.default=Jv()});var Dm=x(Pf=>{"use strict";Object.defineProperty(Pf,"__esModule",{value:!0});Pf.Node=void 0;var W2=ll(),Xv=Of(),Zt=Si(),H2=lr(),{S_IFMT:Jr,S_IFDIR:V2,S_IFREG:G2,S_IFLNK:Yv,S_IFCHR:Z2}=H2.constants,Rf=u(()=>Xv.default.getuid?.()??0,"getuid"),Af=u(()=>Xv.default.getgid?.()??0,"getgid"),Nm=class Nm{constructor(e,r=438){this.changes=new W2.FanOut,this._uid=Rf(),this._gid=Af(),this._atime=new Date,this._mtime=new Date,this._ctime=new Date,this.rdev=0,this._nlink=1,this.mode=r,this.ino=e}set ctime(e){this._ctime=e}get ctime(){return this._ctime}set uid(e){this._uid=e,this.ctime=new Date}get uid(){return this._uid}set gid(e){this._gid=e,this.ctime=new Date}get gid(){return this._gid}set atime(e){this._atime=e}get atime(){return this._atime}set mtime(e){this._mtime=e,this.ctime=new Date}get mtime(){return this._mtime}get perm(){return this.mode&~Jr}set perm(e){this.mode=this.mode&Jr|e&~Jr,this.ctime=new Date}set nlink(e){this._nlink=e,this.ctime=new Date}get nlink(){return this._nlink}getString(e="utf8"){return this.atime=new Date,this.getBuffer().toString(e)}setString(e){this.buf=(0,Zt.bufferFrom)(e,"utf8"),this.touch()}getBuffer(){return this.atime=new Date,this.buf||(this.buf=(0,Zt.bufferAllocUnsafe)(0)),(0,Zt.bufferFrom)(this.buf)}setBuffer(e){this.buf=(0,Zt.bufferFrom)(e),this.touch()}getSize(){return this.buf?this.buf.length:0}setModeProperty(e){this.mode=e}isFile(){return(this.mode&Jr)===G2}isDirectory(){return(this.mode&Jr)===V2}isSymlink(){return(this.mode&Jr)===Yv}isCharacterDevice(){return(this.mode&Jr)===Z2}makeSymlink(e){this.mode=Yv|438,this.symlink=e}write(e,r=0,i=e.length,n=0){if(this.buf||(this.buf=(0,Zt.bufferAllocUnsafe)(0)),n+i>this.buf.length){let s=(0,Zt.bufferAllocUnsafe)(n+i);this.buf.copy(s,0,0,this.buf.length),this.buf=s}return e.copy(this.buf,n,r,r+i),this.touch(),i}read(e,r=0,i=e.byteLength,n=0){if(this.atime=new Date,this.buf||(this.buf=(0,Zt.bufferAllocUnsafe)(0)),n>=this.buf.length)return 0;let s=i;s>e.byteLength&&(s=e.byteLength),s+n>this.buf.length&&(s=this.buf.length-n);let a=e instanceof Zt.Buffer?e:Zt.Buffer.from(e.buffer,e.byteOffset,e.byteLength);return this.buf.copy(a,r,n,n+s),s}truncate(e=0){if(!e)this.buf=(0,Zt.bufferAllocUnsafe)(0);else if(this.buf||(this.buf=(0,Zt.bufferAllocUnsafe)(0)),e<=this.buf.length)this.buf=this.buf.slice(0,e);else{let r=(0,Zt.bufferAllocUnsafe)(e);this.buf.copy(r),r.fill(0,this.buf.length),this.buf=r}this.touch()}chmod(e){this.mode=this.mode&Jr|e&~Jr,this.touch()}chown(e,r){this.uid=e,this.gid=r,this.touch()}touch(){this.mtime=new Date,this.changes.emit(["modify"])}canRead(e=Rf(),r=Af()){return!!(this.perm&4||r===this.gid&&this.perm&32||e===this.uid&&this.perm&256)}canWrite(e=Rf(),r=Af()){return!!(this.perm&2||r===this.gid&&this.perm&16||e===this.uid&&this.perm&128)}canExecute(e=Rf(),r=Af()){return!!(this.perm&1||r===this.gid&&this.perm&8||e===this.uid&&this.perm&64)}del(){this.changes.emit(["delete"])}toJSON(){return{ino:this.ino,uid:this.uid,gid:this.gid,atime:this.atime.getTime(),mtime:this.mtime.getTime(),ctime:this.ctime.getTime(),perm:this.perm,mode:this.mode,nlink:this.nlink,symlink:this.symlink,data:this.getString()}}};u(Nm,"Node");var Pm=Nm;Pf.Node=Pm});var Im=x(Nf=>{"use strict";Object.defineProperty(Nf,"__esModule",{value:!0});Nf.Link=void 0;var K2=lr(),J2=ll(),{S_IFREG:Y2}=K2.constants,cl=class cl{get steps(){return this._steps}set steps(e){this._steps=e;for(let[r,i]of this.children.entries())r==="."||r===".."||i?.syncSteps()}constructor(e,r,i){this.changes=new J2.FanOut,this.children=new Map,this._steps=[],this.ino=0,this.length=0,this.vol=e,this.parent=r,this.name=i,this.syncSteps()}setNode(e){this.node=e,this.ino=e.ino}getNode(){return this.node}createChild(e,r=this.vol.createNode(Y2|438)){let i=new cl(this.vol,this,e);return i.setNode(r),r.isDirectory()&&(i.children.set(".",i),i.getNode().nlink++),this.setChild(e,i),i}setChild(e,r=new cl(this.vol,this,e)){return this.children.set(e,r),r.parent=this,this.length++,r.getNode().isDirectory()&&(r.children.set("..",this),this.getNode().nlink++),this.getNode().mtime=new Date,this.changes.emit(["child:add",r,this]),r}deleteChild(e){e.getNode().isDirectory()&&(e.children.delete(".."),this.getNode().nlink--),this.children.delete(e.getName()),this.length--,this.getNode().mtime=new Date,this.changes.emit(["child:del",e,this])}getChild(e){return this.getNode().atime=new Date,this.children.get(e)}getPath(){return this.steps.join("/")}getParentPath(){return this.steps.slice(0,-1).join("/")}getName(){return this.steps[this.steps.length-1]}toJSON(){return{steps:this.steps,ino:this.ino,children:Array.from(this.children.keys())}}syncSteps(){this.steps=this.parent?this.parent.steps.concat([this.name]):[this.name]}};u(cl,"Link");var Cm=cl;Nf.Link=Cm});var Lm=x(Df=>{"use strict";Object.defineProperty(Df,"__esModule",{value:!0});Df.File=void 0;var X2=lr(),{O_APPEND:Q2}=X2.constants,Bm=class Bm{constructor(e,r,i,n){this.link=e,this.node=r,this.flags=i,this.fd=n,this.position=0,this.flags&Q2&&(this.position=this.getSize())}getString(e="utf8"){return this.node.getString()}setString(e){this.node.setString(e)}getBuffer(){return this.node.getBuffer()}setBuffer(e){this.node.setBuffer(e)}getSize(){return this.node.getSize()}truncate(e){this.node.truncate(e)}seekTo(e){this.position=e}write(e,r=0,i=e.length,n){typeof n!="number"&&(n=this.position);let s=this.node.write(e,r,i,n);return this.position=n+s,s}read(e,r=0,i=e.byteLength,n){typeof n!="number"&&(n=this.position);let s=this.node.read(e,r,i,n);return this.position=n+s,s}chmod(e){this.node.chmod(e)}chown(e,r){this.node.chown(e,r)}};u(Bm,"File");var $m=Bm;Df.File=$m});var ea=x(Qs=>{"use strict";Object.defineProperty(Qs,"__esModule",{value:!0});Qs.FLAGS=Qs.ERRSTR=void 0;var e$=lr();Qs.ERRSTR={PATH_STR:"path must be a string, Buffer, or Uint8Array",FD:"fd must be a file descriptor",MODE_INT:"mode must be an int",CB:"callback must be a function",UID:"uid must be an unsigned int",GID:"gid must be an unsigned int",LEN:"len must be an integer",ATIME:"atime must be an integer",MTIME:"mtime must be an integer",PREFIX:"filename prefix is required",BUFFER:"buffer must be an instance of Buffer or StaticBuffer",OFFSET:"offset must be an integer",LENGTH:"length must be an integer",POSITION:"position must be an integer"};var{O_RDONLY:Qv,O_WRONLY:Cf,O_RDWR:Xs,O_CREAT:Fi,O_EXCL:If,O_TRUNC:$f,O_APPEND:Bf,O_SYNC:eS}=e$.constants,tS;(function(t){t[t.r=Qv]="r",t[t["r+"]=Xs]="r+",t[t.rs=Qv|eS]="rs",t[t.sr=t.rs]="sr",t[t["rs+"]=Xs|eS]="rs+",t[t["sr+"]=t["rs+"]]="sr+",t[t.w=Cf|Fi|$f]="w",t[t.wx=Cf|Fi|$f|If]="wx",t[t.xw=t.wx]="xw",t[t["w+"]=Xs|Fi|$f]="w+",t[t["wx+"]=Xs|Fi|$f|If]="wx+",t[t["xw+"]=t["wx+"]]="xw+",t[t.a=Cf|Bf|Fi]="a",t[t.ax=Cf|Bf|Fi|If]="ax",t[t.xa=t.ax]="xa",t[t["a+"]=Xs|Bf|Fi]="a+",t[t["ax+"]=Xs|Bf|Fi|If]="ax+",t[t["xa+"]=t["ax+"]]="xa+"})(tS||(Qs.FLAGS=tS={}))});var jm=x(Mm=>{"use strict";Object.defineProperty(Mm,"__esModule",{value:!0});Mm.default=typeof queueMicrotask=="function"?queueMicrotask:t=>Promise.resolve().then(()=>t()).catch(()=>{})});var qf=x(Ge=>{"use strict";Object.defineProperty(Ge,"__esModule",{value:!0});Ge.filenameToSteps=Ge.resolve=Ge.unixify=Ge.isWin=void 0;Ge.isFd=iS;Ge.validateFd=f$;Ge.dataToBuffer=u$;var Mf=Js(),Lf=Si(),rS=Of(),t$=al(),r$=ea();Ge.isWin=rS.default.platform==="win32";var i$=Mf.resolve,n$=Mf.posix?Mf.posix.sep:Mf.sep,s$=u((t,e)=>{let r=t[e];return e>0&&(r==="/"||Ge.isWin&&r==="\\")},"isSeparator"),a$=u(t=>{let e=t.length-1;if(e<2)return t;for(;s$(t,e);)e--;return t.substr(0,e+1)},"removeTrailingSeparator"),o$=u((t,e)=>{if(typeof t!="string")throw new TypeError("expected a string");return t=t.replace(/[\\\/]+/g,"/"),e!==!1&&(t=a$(t)),t},"normalizePath"),l$=u((t,e=!0)=>Ge.isWin?(t=o$(t,e),t.replace(/^([a-zA-Z]+:|\.\/)/,"")):t,"unixify");Ge.unixify=l$;var jf=u((t,e=rS.default.cwd())=>i$(e,t),"resolve");Ge.resolve=jf;if(Ge.isWin){let t=jf;Ge.resolve=jf=u((e,r)=>(0,Ge.unixify)(t(e,r)),"resolve")}var c$=u((t,e)=>{let i=jf(t,e).substring(1);return i?i.split(n$):[]},"filenameToSteps");Ge.filenameToSteps=c$;function iS(t){return t>>>0===t}u(iS,"isFd");function f$(t){if(!iS(t))throw TypeError(r$.ERRSTR.FD)}u(f$,"validateFd");function u$(t,e=t$.ENCODING_UTF8){return Lf.Buffer.isBuffer(t)?t:t instanceof Uint8Array?(0,Lf.bufferFrom)(t):e==="buffer"?(0,Lf.bufferFrom)(String(t),"utf8"):(0,Lf.bufferFrom)(String(t),e)}u(u$,"dataToBuffer")});var ki=x(qe=>{"use strict";Object.defineProperty(qe,"__esModule",{value:!0});qe.getWriteSyncArgs=qe.getWriteArgs=qe.bufToUint8=void 0;qe.promisify=d$;qe.validateCallback=nS;qe.modeToNumber=sS;qe.nullCheck=aS;qe.pathToFilename=w$;qe.createError=N$;qe.genRndStr6=D$;qe.flagsToNumber=C$;qe.streamToBuffer=I$;qe.bufferToEncoding=M$;qe.isReadableStream=j$;var fl=ea(),qm=sl(),Um=Si(),h$=jm(),Uf=qf();function d$(t,e,r=i=>i){return(...i)=>new Promise((n,s)=>{t[e].bind(t)(...i,(a,l)=>a?s(a):n(r(l)))})}u(d$,"promisify");function nS(t){if(typeof t!="function")throw TypeError(fl.ERRSTR.CB);return t}u(nS,"validateCallback");function p$(t,e){if(typeof t=="number")return t;if(typeof t=="string")return parseInt(t,8);if(e)return sS(e)}u(p$,"_modeToNumber");function sS(t,e){let r=p$(t,e);if(typeof r!="number"||isNaN(r))throw new TypeError(fl.ERRSTR.MODE_INT);return r}u(sS,"modeToNumber");function aS(t,e){if((""+t).indexOf("\0")!==-1){let r=new Error("Path must be a string without null bytes");if(r.code="ENOENT",typeof e!="function")throw r;return(0,h$.default)(()=>{e(r)}),!1}return!0}u(aS,"nullCheck");function m$(t){if(t.hostname!=="")throw new qm.TypeError("ERR_INVALID_FILE_URL_HOST",process.platform);let e=t.pathname;for(let r=0;r<e.length;r++)if(e[r]==="%"){let i=e.codePointAt(r+2)|32;if(e[r+1]==="2"&&i===102)throw new qm.TypeError("ERR_INVALID_FILE_URL_PATH","must not include encoded / characters")}return decodeURIComponent(e)}u(m$,"getPathFromURLPosix");function w$(t){if(t instanceof Uint8Array&&(t=(0,Um.bufferFrom)(t)),typeof t!="string"&&!Um.Buffer.isBuffer(t)){try{if(!(t instanceof ne("url").URL))throw new TypeError(fl.ERRSTR.PATH_STR)}catch{throw new TypeError(fl.ERRSTR.PATH_STR)}t=m$(t)}let e=String(t);return aS(e),e}u(w$,"pathToFilename");var y$="ENOENT",g$="EBADF",b$="EINVAL",_$="EPERM",v$="EPROTO",S$="EEXIST",E$="ENOTDIR",F$="EMFILE",k$="EACCES",T$="EISDIR",x$="ENOTEMPTY",O$="ENOSYS",R$="ERR_FS_EISDIR",A$="ERR_OUT_OF_RANGE";function P$(t,e="",r="",i=""){let n="";switch(r&&(n=` '${r}'`),i&&(n+=` -> '${i}'`),t){case y$:return`ENOENT: no such file or directory, ${e}${n}`;case g$:return`EBADF: bad file descriptor, ${e}${n}`;case b$:return`EINVAL: invalid argument, ${e}${n}`;case _$:return`EPERM: operation not permitted, ${e}${n}`;case v$:return`EPROTO: protocol error, ${e}${n}`;case S$:return`EEXIST: file already exists, ${e}${n}`;case E$:return`ENOTDIR: not a directory, ${e}${n}`;case T$:return`EISDIR: illegal operation on a directory, ${e}${n}`;case k$:return`EACCES: permission denied, ${e}${n}`;case x$:return`ENOTEMPTY: directory not empty, ${e}${n}`;case F$:return`EMFILE: too many open files, ${e}${n}`;case O$:return`ENOSYS: function not implemented, ${e}${n}`;case R$:return`[ERR_FS_EISDIR]: Path is a directory: ${e} returned EISDIR (is a directory) ${r}`;case A$:return`[ERR_OUT_OF_RANGE]: value out of range, ${e}${n}`;default:return`${t}: error occurred, ${e}${n}`}}u(P$,"formatError");function N$(t,e="",r="",i="",n=Error){let s=new n(P$(t,e,r,i));return s.code=t,r&&(s.path=r),s}u(N$,"createError");function D$(){return Math.random().toString(36).slice(2,8).padEnd(6,"0")}u(D$,"genRndStr6");function C$(t){if(typeof t=="number")return t;if(typeof t=="string"){let e=fl.FLAGS[t];if(typeof e<"u")return e}throw new qm.TypeError("ERR_INVALID_OPT_VALUE","flags",t)}u(C$,"flagsToNumber");function I$(t){let e=[];return new Promise((r,i)=>{t.on("data",n=>e.push(n)),t.on("end",()=>r(Um.Buffer.concat(e))),t.on("error",i)})}u(I$,"streamToBuffer");var $$=u(t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),"bufToUint8");qe.bufToUint8=$$;var B$=u((t,e,r,i,n,s)=>{(0,Uf.validateFd)(t);let a=0,l,c=null,o,f,h=typeof e,d=typeof r,p=typeof i,m=typeof n;h!=="string"?d==="function"?f=r:p==="function"?(a=r|0,f=i):m==="function"?(a=r|0,l=i,f=n):(a=r|0,l=i,c=n,f=s):d==="function"?f=r:p==="function"?(c=r,f=i):m==="function"&&(c=r,o=i,f=n);let w=(0,Uf.dataToBuffer)(e,o);h!=="string"?typeof l>"u"&&(l=w.length):(a=0,l=w.length);let g=nS(f);return[t,h==="string",w,a,l,c,g]},"getWriteArgs");qe.getWriteArgs=B$;var L$=u((t,e,r,i,n)=>{(0,Uf.validateFd)(t);let s,a,l,c,o=typeof e!="string";o?(a=(r||0)|0,l=i,c=n):(c=r,s=i);let f=(0,Uf.dataToBuffer)(e,s);return o?typeof l>"u"&&(l=f.length):(a=0,l=f.length),[t,f,a||0,l,c]},"getWriteSyncArgs");qe.getWriteSyncArgs=L$;function M$(t,e){return!e||e==="buffer"?t:t.toString(e)}u(M$,"bufferToEncoding");function j$(t){return t!==null&&typeof t=="object"&&typeof t.pipe=="function"&&typeof t.on=="function"&&t.readable===!0}u(j$,"isReadableStream")});var hS=x(Hf=>{"use strict";Object.defineProperty(Hf,"__esModule",{value:!0});Hf.Superblock=void 0;var Ze=Js(),q$=Dm(),oS=Im(),U$=Lm(),z$=Si(),lS=Of(),Fr=lr(),cS=ea(),G=ki(),cr=qf(),W$=Om(),ta=Ze.posix?Ze.posix.sep:Ze.sep,fS=Ze.posix?Ze.posix.relative:Ze.relative,H$=Ze.posix?Ze.posix.join:Ze.join,{O_RDONLY:zm,O_WRONLY:zf,O_RDWR:Wm,O_CREAT:uS,O_EXCL:V$,O_TRUNC:G$,O_APPEND:Z$,O_DIRECTORY:K$}=Fr.constants,ra=class ra{static fromJSON(e,r){let i=new ra;return i.fromJSON(e,r),i}static fromNestedJSON(e,r){let i=new ra;return i.fromNestedJSON(e,r),i}constructor(e={}){this.ino=0,this.inodes={},this.releasedInos=[],this.fds={},this.releasedFds=[],this.maxFiles=1e4,this.openFiles=0,this.open=(i,n,s,a=!0)=>{let l=this.openFile(i,n,s,a);if(!l)throw(0,G.createError)("ENOENT","open",i);return l.fd},this.writeFile=(i,n,s,a)=>{let l=typeof i=="number",c;l?c=i:c=this.open((0,G.pathToFilename)(i),s,a);let o=0,f=n.length,h=s&Z$?void 0:0;try{for(;f>0;){let d=this.write(c,n,o,f,h);o+=d,f-=d,h!==void 0&&(h+=d)}}finally{l||this.close(c)}},this.read=(i,n,s,a,l)=>{if(n.byteLength<a)throw(0,G.createError)("ERR_OUT_OF_RANGE","read",void 0,void 0,RangeError);let c=this.getFileByFdOrThrow(i);if(c.node.isSymlink())throw(0,G.createError)("EPERM","read",c.link.getPath());return c.read(n,Number(s),Number(a),l===-1||typeof l!="number"?void 0:l)},this.readv=(i,n,s)=>{let a=this.getFileByFdOrThrow(i),l=s??void 0;l===-1&&(l=void 0);let c=0;for(let o of n){let f=a.read(o,0,o.byteLength,l);if(l=void 0,c+=f,f<o.byteLength)break}return c},this.link=(i,n)=>{let s;try{s=this.getLinkOrThrow(i,"link")}catch(f){throw f.code&&(f=(0,G.createError)(f.code,"link",i,n)),f}let a=(0,Ze.dirname)(n),l;try{l=this.getLinkOrThrow(a,"link")}catch(f){throw f.code&&(f=(0,G.createError)(f.code,"link",i,n)),f}let c=(0,Ze.basename)(n);if(l.getChild(c))throw(0,G.createError)("EEXIST","link",i,n);let o=s.getNode();o.nlink++,l.createChild(c,o)},this.unlink=i=>{let n=this.getLinkOrThrow(i,"unlink");if(n.length)throw Error("Dir not empty...");this.deleteLink(n);let s=n.getNode();s.nlink--,s.nlink<=0&&this.deleteNode(s)},this.symlink=(i,n)=>{let s=(0,cr.filenameToSteps)(n),a;try{a=this.getLinkParentAsDirOrThrow(s)}catch(f){throw f.code&&(f=(0,G.createError)(f.code,"symlink",i,n)),f}let l=s[s.length-1];if(a.getChild(l))throw(0,G.createError)("EEXIST","symlink",i,n);let c=a.getNode();if(!c.canExecute()||!c.canWrite())throw(0,G.createError)("EACCES","symlink",i,n);let o=a.createChild(l);return o.getNode().makeSymlink(i),o},this.rename=(i,n)=>{let s;try{s=this.getResolvedLinkOrThrow(i)}catch(h){throw h.code&&(h=(0,G.createError)(h.code,"rename",i,n)),h}let a;try{a=this.getLinkParentAsDirOrThrow(n)}catch(h){throw h.code&&(h=(0,G.createError)(h.code,"rename",i,n)),h}let l=s.parent;if(!l)throw(0,G.createError)("EINVAL","rename",i,n);let c=l.getNode(),o=a.getNode();if(!c.canExecute()||!c.canWrite()||!o.canExecute()||!o.canWrite())throw(0,G.createError)("EACCES","rename",i,n);l.deleteChild(s);let f=(0,Ze.basename)(n);s.name=f,s.steps=[...a.steps,f],a.setChild(s.getName(),s)},this.mkdir=(i,n)=>{let s=(0,cr.filenameToSteps)(i);if(!s.length)throw(0,G.createError)("EEXIST","mkdir",i);let a=this.getLinkParentAsDirOrThrow(i,"mkdir"),l=s[s.length-1];if(a.getChild(l))throw(0,G.createError)("EEXIST","mkdir",i);let c=a.getNode();if(!c.canWrite()||!c.canExecute())throw(0,G.createError)("EACCES","mkdir",i);a.createChild(l,this.createNode(Fr.constants.S_IFDIR|n))},this.mkdirp=(i,n)=>{let s=!1,a=(0,cr.filenameToSteps)(i),l=null,c=a.length;for(c=a.length;c>=0&&(l=this.getResolvedLink(a.slice(0,c)),!l);c--);for(l||(l=this.root,c=0),l=this.getResolvedLinkOrThrow(Ze.sep+a.slice(0,c).join(Ze.sep),"mkdir"),c;c<a.length;c++){let o=l.getNode();if(o.isDirectory()){if(!o.canExecute()||!o.canWrite())throw(0,G.createError)("EACCES","mkdir",i)}else throw(0,G.createError)("ENOTDIR","mkdir",i);s=!0,l=l.createChild(a[c],this.createNode(Fr.constants.S_IFDIR|n))}return s?i:void 0},this.rmdir=(i,n=!1)=>{let s=this.getLinkAsDirOrThrow(i,"rmdir");if(s.length&&!n)throw(0,G.createError)("ENOTEMPTY","rmdir",i);this.deleteLink(s)},this.rm=(i,n=!1,s=!1)=>{let a;try{a=this.getResolvedLinkOrThrow(i,"stat")}catch(l){if(l.code==="ENOENT"&&n)return;throw l}if(a.getNode().isDirectory()&&!s)throw(0,G.createError)("ERR_FS_EISDIR","rm",i);if(!a.parent?.getNode().canWrite())throw(0,G.createError)("EACCES","rm",i);this.deleteLink(a)},this.close=i=>{(0,cr.validateFd)(i);let n=this.getFileByFdOrThrow(i,"close");this.closeFile(n)};let r=this.createLink();r.setNode(this.createNode(Fr.constants.S_IFDIR|511)),r.setChild(".",r),r.getNode().nlink++,r.setChild("..",r),r.getNode().nlink++,this.root=r}createLink(e,r,i=!1,n){if(!e)return new oS.Link(this,void 0,"");if(!r)throw new Error("createLink: name cannot be empty");let s=n??(i?511:438),l=n&&n&Fr.constants.S_IFMT?n&Fr.constants.S_IFMT:i?Fr.constants.S_IFDIR:Fr.constants.S_IFREG,c=s&~Fr.constants.S_IFMT|l;return e.createChild(r,this.createNode(c))}deleteLink(e){let r=e.parent;return r?(r.deleteChild(e),!0):!1}newInoNumber(){let e=this.releasedInos.pop();return e||(this.ino=(this.ino+1)%4294967295,this.ino)}newFdNumber(){let e=this.releasedFds.pop();return typeof e=="number"?e:ra.fd--}createNode(e){let r=new q$.Node(this.newInoNumber(),e);return this.inodes[r.ino]=r,r}deleteNode(e){e.del(),delete this.inodes[e.ino],this.releasedInos.push(e.ino)}walk(e,r=!1,i=!1,n=!1,s){let a,l;e instanceof oS.Link?(a=e.steps,l=ta+a.join(ta)):typeof e=="string"?(a=(0,cr.filenameToSteps)(e),l=e):(a=e,l=ta+a.join(ta));let c=this.root,o=0;for(;o<a.length;){let f=c.getNode();if(f.isDirectory()){if(n&&!f.canExecute())throw(0,G.createError)("EACCES",s,l)}else if(o<a.length-1)throw(0,G.createError)("ENOTDIR",s,l);if(c=c.getChild(a[o])??null,!c){if(i)throw(0,G.createError)("ENOENT",s,l);return null}if(f=c?.getNode(),f.isSymlink()&&(r||o<a.length-1)){let h=(0,Ze.isAbsolute)(f.symlink)?f.symlink:H$((0,Ze.dirname)(c.getPath()),f.symlink);a=(0,cr.filenameToSteps)(h).concat(a.slice(o+1)),c=this.root,o=0;continue}if(i&&!f.isDirectory()&&o<a.length-1){let h=lS.default.platform==="win32"?"ENOENT":"ENOTDIR";throw(0,G.createError)(h,s,l)}o++}return c}getLink(e){return this.walk(e,!1,!1,!1)}getLinkOrThrow(e,r){return this.walk(e,!1,!0,!0,r)}getResolvedLink(e){return this.walk(e,!0,!1,!1)}getResolvedLinkOrThrow(e,r){return this.walk(e,!0,!0,!0,r)}resolveSymlinks(e){return this.getResolvedLink(e.steps.slice(1))}getLinkAsDirOrThrow(e,r){let i=this.getLinkOrThrow(e,r);if(!i.getNode().isDirectory())throw(0,G.createError)("ENOTDIR",r,e);return i}getLinkParent(e){return this.getLink(e.slice(0,-1))}getLinkParentAsDirOrThrow(e,r){let i=(e instanceof Array?e:(0,cr.filenameToSteps)(e)).slice(0,-1),n=ta+i.join(ta),s=this.getLinkOrThrow(n,r);if(!s.getNode().isDirectory())throw(0,G.createError)("ENOTDIR",r,n);return s}getFileByFd(e){return this.fds[String(e)]}getFileByFdOrThrow(e,r){if(!(0,cr.isFd)(e))throw TypeError(cS.ERRSTR.FD);let i=this.getFileByFd(e);if(!i)throw(0,G.createError)("EBADF",r);return i}_toJSON(e=this.root,r={},i,n){let s=!0,a=e.children;e.getNode().isFile()&&(a=new Map([[e.getName(),e.parent.getChild(e.getName())]]),e=e.parent);for(let c of a.keys()){if(c==="."||c==="..")continue;s=!1;let o=e.getChild(c);if(!o)throw new Error("_toJSON: unexpected undefined");let f=o.getNode();if(f.isFile()){let h=o.getPath();i&&(h=fS(i,h)),r[h]=n?f.getBuffer():f.getString()}else f.isDirectory()&&this._toJSON(o,r,i,n)}let l=e.getPath();return i&&(l=fS(i,l)),l&&s&&(r[l]=null),r}toJSON(e,r={},i=!1,n=!1){let s=[];if(e){Array.isArray(e)||(e=[e]);for(let a of e){let l=(0,G.pathToFilename)(a),c=this.getResolvedLink(l);c&&s.push(c)}}else s.push(this.root);if(!s.length)return r;for(let a of s)this._toJSON(a,r,i?a.getPath():"",n);return r}fromJSON(e,r=lS.default.cwd()){for(let i in e){let n=e[i];if(i=(0,cr.resolve)(i,r),typeof n=="string"||n instanceof z$.Buffer){let s=(0,Ze.dirname)(i);this.mkdirp(s,511);let a=(0,cr.dataToBuffer)(n);this.writeFile(i,a,cS.FLAGS.w,438)}else this.mkdirp(i,511)}}fromNestedJSON(e,r){this.fromJSON((0,W$.flattenJSON)(e),r)}reset(){this.ino=0,this.inodes={},this.releasedInos=[],this.fds={},this.releasedFds=[],this.openFiles=0,this.root=this.createLink(),this.root.setNode(this.createNode(Fr.constants.S_IFDIR|511))}mountSync(e,r){this.fromJSON(r,e)}openLink(e,r,i=!0){if(this.openFiles>=this.maxFiles)throw(0,G.createError)("EMFILE","open",e.getPath());let n=e;i&&(n=this.getResolvedLinkOrThrow(e.getPath(),"open"));let s=n.getNode();if(s.isDirectory()){if((r&(zm|Wm|zf))!==zm)throw(0,G.createError)("EISDIR","open",e.getPath())}else if(r&K$)throw(0,G.createError)("ENOTDIR","open",e.getPath());if((r&(zm|Wm|zf))!==zf&&!s.canRead()||r&(zf|Wm)&&!s.canWrite())throw(0,G.createError)("EACCES","open",e.getPath());let a=new U$.File(e,s,r,this.newFdNumber());return this.fds[a.fd]=a,this.openFiles++,r&G$&&a.truncate(),a}openFile(e,r,i,n=!0){let s=(0,cr.filenameToSteps)(e),a;try{if(a=n?this.getResolvedLinkOrThrow(e,"open"):this.getLinkOrThrow(e,"open"),a&&r&uS&&r&V$)throw(0,G.createError)("EEXIST","open",e)}catch(l){if(l.code==="ENOENT"&&r&uS){let c=(0,Ze.dirname)(e),o=this.getResolvedLinkOrThrow(c),f=o.getNode();if(!f.isDirectory())throw(0,G.createError)("ENOTDIR","open",e);if(!f.canExecute()||!f.canWrite())throw(0,G.createError)("EACCES","open",e);i??(i=438),a=this.createLink(o,s[s.length-1],!1,i)}else throw l}if(a)return this.openLink(a,r,n);throw(0,G.createError)("ENOENT","open",e)}closeFile(e){this.fds[e.fd]&&(this.openFiles--,delete this.fds[e.fd],this.releasedFds.push(e.fd))}write(e,r,i,n,s){let a=this.getFileByFdOrThrow(e,"write");if(a.node.isSymlink())throw(0,G.createError)("EBADF","write",a.link.getPath());return a.write(r,i,n,s===-1||typeof s!="number"?void 0:s)}};u(ra,"Superblock");var Wf=ra;Hf.Superblock=Wf;Wf.fd=2147483647});var pS=x(Kt=>{"use strict";Object.defineProperty(Kt,"__esModule",{value:!0});Kt.Superblock=Kt.File=Kt.Link=Kt.Node=void 0;var dS=(Ff(),Yp(Ef));dS.__exportStar(Zv(),Kt);dS.__exportStar(Om(),Kt);var J$=Dm();Object.defineProperty(Kt,"Node",{enumerable:!0,get:u(function(){return J$.Node},"get")});var Y$=Im();Object.defineProperty(Kt,"Link",{enumerable:!0,get:u(function(){return Y$.Link},"get")});var X$=Lm();Object.defineProperty(Kt,"File",{enumerable:!0,get:u(function(){return X$.File},"get")});var Q$=hS();Object.defineProperty(Kt,"Superblock",{enumerable:!0,get:u(function(){return Q$.Superblock},"get")})});var mS=x(ul=>{"use strict";Object.defineProperty(ul,"__esModule",{value:!0});ul.StatFs=void 0;var Gf=class Gf{static build(e,r=!1){let i=new Gf,n=r?f=>BigInt(f):f=>f;i.type=n(2240043254),i.bsize=n(4096);let s=Object.keys(e.inodes).length,a=1e6,l=Math.min(s*2,a),c=a-l;i.blocks=n(a),i.bfree=n(c),i.bavail=n(c);let o=1e6;return i.files=n(o),i.ffree=n(o-s),i}};u(Gf,"StatFs");var Vf=Gf;ul.StatFs=Vf;ul.default=Vf});var wS=x(Hm=>{"use strict";Object.defineProperty(Hm,"__esModule",{value:!0});function eB(t,e,r){let i=setTimeout.apply(globalThis,arguments);return i&&typeof i=="object"&&typeof i.unref=="function"&&i.unref(),i}u(eB,"setTimeoutUnref");Hm.default=eB});var gS=x(ia=>{"use strict";Object.defineProperty(ia,"__esModule",{value:!0});ia.Writable=ia.Readable=void 0;var yS=ne("node:stream");Object.defineProperty(ia,"Readable",{enumerable:!0,get:u(function(){return yS.Readable},"get")});Object.defineProperty(ia,"Writable",{enumerable:!0,get:u(function(){return yS.Writable},"get")})});var Vm=x(Zf=>{"use strict";Object.defineProperty(Zf,"__esModule",{value:!0});Zf.EventEmitter=void 0;var tB=ne("node:events");Object.defineProperty(Zf,"EventEmitter",{enumerable:!0,get:u(function(){return tB.EventEmitter},"get")})});var bS=x(Kf=>{"use strict";Object.defineProperty(Kf,"__esModule",{value:!0});Kf.FileHandle=void 0;var lt=ki(),rB=Vm(),Zm=class Zm extends rB.EventEmitter{constructor(e,r){super(),this.refs=1,this.closePromise=null,this.position=0,this.readableWebStreamLocked=!1,this.fs=e,this.fd=r}getAsyncId(){return this.fd}appendFile(e,r){return(0,lt.promisify)(this.fs,"appendFile")(this.fd,e,r)}chmod(e){return(0,lt.promisify)(this.fs,"fchmod")(this.fd,e)}chown(e,r){return(0,lt.promisify)(this.fs,"fchown")(this.fd,e,r)}close(){if(this.fd===-1)return Promise.resolve();if(this.closePromise)return this.closePromise;if(this.refs--,this.refs===0){let e=this.fd;this.fd=-1,this.closePromise=(0,lt.promisify)(this.fs,"close")(e).finally(()=>{this.closePromise=null})}else this.closePromise=new Promise((e,r)=>{this.closeResolve=e,this.closeReject=r}).finally(()=>{this.closePromise=null,this.closeReject=void 0,this.closeResolve=void 0});return this.emit("close"),this.closePromise}datasync(){return(0,lt.promisify)(this.fs,"fdatasync")(this.fd)}createReadStream(e){return this.fs.createReadStream("",{...e,fd:this})}createWriteStream(e){return this.fs.createWriteStream("",{...e,fd:this})}readableWebStream(e={}){let{type:r="bytes",autoClose:i=!1}=e,n=0;if(this.fd===-1)throw new Error("The FileHandle is closed");if(this.closePromise)throw new Error("The FileHandle is closing");if(this.readableWebStreamLocked)throw new Error("An error will be thrown if this method is called more than once or is called after the FileHandle is closed or closing.");this.readableWebStreamLocked=!0,this.ref();let s=u(()=>{this.readableWebStreamLocked=!1,this.unref(),i&&this.close().catch(()=>{})},"unlockAndCleanup");return new ReadableStream({type:r==="bytes"?"bytes":void 0,autoAllocateChunkSize:16384,pull:u(async a=>{try{let l=a.byobRequest?.view;if(!l){let o=new Uint8Array(16384),f=await this.read(o,0,o.length,n);if(f.bytesRead===0){a.close(),s();return}n+=f.bytesRead,a.enqueue(o.slice(0,f.bytesRead));return}let c=await this.read(l,l.byteOffset,l.byteLength,n);if(c.bytesRead===0){a.close(),s();return}n+=c.bytesRead,a.byobRequest.respond(c.bytesRead)}catch(l){a.error(l),s()}},"pull"),cancel:u(async()=>{s()},"cancel")})}async read(e,r,i,n){let s=n??this.position,a=await(0,lt.promisify)(this.fs,"read",l=>({bytesRead:l,buffer:e}))(this.fd,e,r,i,s);return n==null&&(this.position+=a.bytesRead),a}readv(e,r){return(0,lt.promisify)(this.fs,"readv",i=>({bytesRead:i,buffers:e}))(this.fd,e,r)}readFile(e){return(0,lt.promisify)(this.fs,"readFile")(this.fd,e)}stat(e){return(0,lt.promisify)(this.fs,"fstat")(this.fd,e)}sync(){return(0,lt.promisify)(this.fs,"fsync")(this.fd)}truncate(e){return(0,lt.promisify)(this.fs,"ftruncate")(this.fd,e)}utimes(e,r){return(0,lt.promisify)(this.fs,"futimes")(this.fd,e,r)}async write(e,r,i,n){let s=typeof n!="number",a=s?this.position:n,l=await(0,lt.promisify)(this.fs,"write",c=>({bytesWritten:c,buffer:e}))(this.fd,e,r,i,a);return s&&(this.position+=l.bytesWritten),l}writev(e,r){return(0,lt.promisify)(this.fs,"writev",i=>({bytesWritten:i,buffers:e}))(this.fd,e,r)}writeFile(e,r){return(0,lt.promisify)(this.fs,"writeFile")(this.fd,e,r)}async[Symbol.asyncDispose](){await this.close()}ref(){this.refs++}unref(){this.refs--,this.refs===0&&(this.fd=-1,this.closeResolve&&(0,lt.promisify)(this.fs,"close")(this.fd).then(this.closeResolve,this.closeReject))}};u(Zm,"FileHandle");var Gm=Zm;Kf.FileHandle=Gm});var _S=x(Jf=>{"use strict";Object.defineProperty(Jf,"__esModule",{value:!0});Jf.FsPromises=void 0;var se=ki(),iB=lr(),Ym=class Ym{constructor(e,r,i={}){if(this.fs=e,this.path=r,this.options=i,this.eventQueue=[],this.resolveQueue=[],this.finished=!1,this.maxQueue=i.maxQueue||2048,this.overflow=i.overflow||"ignore",this.startWatching(),i.signal){if(i.signal.aborted){this.finish();return}i.signal.addEventListener("abort",()=>{this.finish()})}}startWatching(){try{this.watcher=this.fs.watch(this.path,this.options,(e,r)=>{this.enqueueEvent({eventType:e,filename:r})})}catch(e){throw this.finish(),e}}enqueueEvent(e){if(!this.finished){if(this.eventQueue.length>=this.maxQueue)if(this.overflow==="throw"){let r=new Error(`Watch queue overflow: more than ${this.maxQueue} events queued`);this.finish(r);return}else this.eventQueue.shift(),console.warn(`Watch queue overflow: dropping event due to exceeding maxQueue of ${this.maxQueue}`);if(this.eventQueue.push(e),this.resolveQueue.length>0){let{resolve:r}=this.resolveQueue.shift(),i=this.eventQueue.shift();r({value:i,done:!1})}}}finish(e){if(!this.finished)for(this.finished=!0,this.watcher&&(this.watcher.close(),this.watcher=null);this.resolveQueue.length>0;){let{resolve:r,reject:i}=this.resolveQueue.shift();e?i(e):r({value:void 0,done:!0})}}async next(){return this.finished?{value:void 0,done:!0}:this.eventQueue.length>0?{value:this.eventQueue.shift(),done:!1}:new Promise((e,r)=>{this.resolveQueue.push({resolve:e,reject:r})})}async return(){return this.finish(),{value:void 0,done:!0}}async throw(e){throw this.finish(e),e}[Symbol.asyncIterator](){return this}};u(Ym,"FSWatchAsyncIterator");var Km=Ym,Xm=class Xm{constructor(e,r){this.fs=e,this.FileHandle=r,this.constants=iB.constants,this.cp=(0,se.promisify)(this.fs,"cp"),this.opendir=(0,se.promisify)(this.fs,"opendir"),this.statfs=(0,se.promisify)(this.fs,"statfs"),this.lutimes=(0,se.promisify)(this.fs,"lutimes"),this.glob=(0,se.promisify)(this.fs,"glob"),this.access=(0,se.promisify)(this.fs,"access"),this.chmod=(0,se.promisify)(this.fs,"chmod"),this.chown=(0,se.promisify)(this.fs,"chown"),this.copyFile=(0,se.promisify)(this.fs,"copyFile"),this.lchmod=(0,se.promisify)(this.fs,"lchmod"),this.lchown=(0,se.promisify)(this.fs,"lchown"),this.link=(0,se.promisify)(this.fs,"link"),this.lstat=(0,se.promisify)(this.fs,"lstat"),this.mkdir=(0,se.promisify)(this.fs,"mkdir"),this.mkdtemp=(0,se.promisify)(this.fs,"mkdtemp"),this.readdir=(0,se.promisify)(this.fs,"readdir"),this.readlink=(0,se.promisify)(this.fs,"readlink"),this.realpath=(0,se.promisify)(this.fs,"realpath"),this.rename=(0,se.promisify)(this.fs,"rename"),this.rmdir=(0,se.promisify)(this.fs,"rmdir"),this.rm=(0,se.promisify)(this.fs,"rm"),this.stat=(0,se.promisify)(this.fs,"stat"),this.symlink=(0,se.promisify)(this.fs,"symlink"),this.truncate=(0,se.promisify)(this.fs,"truncate"),this.unlink=(0,se.promisify)(this.fs,"unlink"),this.utimes=(0,se.promisify)(this.fs,"utimes"),this.readFile=(i,n)=>(0,se.promisify)(this.fs,"readFile")(i instanceof this.FileHandle?i.fd:i,n),this.appendFile=(i,n,s)=>(0,se.promisify)(this.fs,"appendFile")(i instanceof this.FileHandle?i.fd:i,n,s),this.open=(i,n="r",s)=>(0,se.promisify)(this.fs,"open",a=>new this.FileHandle(this.fs,a))(i,n,s),this.writeFile=(i,n,s)=>((0,se.isReadableStream)(n)?(0,se.streamToBuffer)(n):Promise.resolve(n)).then(l=>(0,se.promisify)(this.fs,"writeFile")(i instanceof this.FileHandle?i.fd:i,l,s)),this.watch=(i,n)=>{let s=typeof n=="string"?{encoding:n}:n||{};return new Km(this.fs,i,s)}}};u(Xm,"FsPromises");var Jm=Xm;Jf.FsPromises=Jm});var vS=x(Yf=>{"use strict";Object.defineProperty(Yf,"__esModule",{value:!0});Yf.printTree=void 0;var nB=u((t="",e)=>{let r="",i=e.length-1;for(;i>=0&&!e[i];i--);for(let n=0;n<=i;n++){let s=e[n];if(!s)continue;let a=n===i,l=s(t+(a?" ":"\u2502")+" "),c=l?a?"\u2514\u2500":"\u251C\u2500":"\u2502";r+=`
|
|
5
|
+
`+t+c+(l?" "+l:"")}return r},"printTree");Yf.printTree=nB});var SS=x(Xf=>{"use strict";Object.defineProperty(Xf,"__esModule",{value:!0});Xf.printBinary=void 0;var sB=u((t="",e)=>{let r=e[0],i=e[1],n="";return r&&(n+=`
|
|
6
6
|
`+t+"\u2190 "+r(t+" ")),i&&(n+=`
|
|
7
|
-
`+t+"\u2192 "+i(t+" ")),n},"printBinary");
|
|
7
|
+
`+t+"\u2192 "+i(t+" ")),n},"printBinary");Xf.printBinary=sB});var ES=x(Qf=>{"use strict";Object.defineProperty(Qf,"__esModule",{value:!0});Qf.printJson=void 0;var aB=u((t="",e,r=2)=>(JSON.stringify(e,null,r)||"nil").split(`
|
|
8
8
|
`).join(`
|
|
9
|
-
`+t),"printJson");zl.printJson=LD});var Cp=T(ba=>{"use strict";Object.defineProperty(ba,"__esModule",{value:!0});var Np=(ml(),Ad(pl));Np.__exportStar(k_(),ba);Np.__exportStar(R_(),ba);Np.__exportStar(O_(),ba)});var x_=T(tt=>{"use strict";Object.defineProperty(tt,"__esModule",{value:!0});tt.newNotAllowedError=tt.newTypeMismatchError=tt.newNotFoundError=tt.assertCanWrite=tt.assertName=tt.basename=tt.ctx=void 0;var jD=l((t={})=>({separator:"/",syncHandleAllowed:!1,mode:"read",...t}),"ctx");tt.ctx=jD;var qD=l((t,e)=>{t[t.length-1]===e&&(t=t.slice(0,-1));let r=t.lastIndexOf(e);return r===-1?t:t.slice(r+1)},"basename");tt.basename=qD;var UD=/^(\.{1,2})$|^(.*([\/\\]).*)$/,WD=l((t,e,r)=>{if(!t||UD.test(t))throw new TypeError(`Failed to execute '${e}' on '${r}': Name is not allowed.`)},"assertName");tt.assertName=WD;var zD=l(t=>{if(t!=="readwrite")throw new DOMException("The request is not allowed by the user agent or the platform in the current context.","NotAllowedError")},"assertCanWrite");tt.assertCanWrite=zD;var HD=l(()=>new DOMException("A requested file or directory could not be found at the time an operation was processed.","NotFoundError"),"newNotFoundError");tt.newNotFoundError=HD;var VD=l(()=>new DOMException("The path supplied exists, but was not an entry of requested type.","TypeMismatchError"),"newTypeMismatchError");tt.newTypeMismatchError=VD;var GD=l(()=>new DOMException("Permission not granted.","NotAllowedError"),"newNotAllowedError");tt.newNotAllowedError=GD});var A_=T(_a=>{"use strict";Object.defineProperty(_a,"__esModule",{value:!0});_a.toTreeSync=void 0;var KD=Cp(),JD=x_(),XD=l((t,e={})=>{let r=e.separator||"/",i=e.dir||r;i[i.length-1]!==r&&(i+=r);let n=e.tab||"",s=e.depth??10,o=" (...)";if(s>0){let c=t.readdirSync(i,{withFileTypes:!0});o=(0,KD.printTree)(n,c.map(a=>u=>a.isDirectory()?(0,_a.toTreeSync)(t,{dir:i+a.name,depth:s-1,tab:u}):a.isSymbolicLink()?""+a.name+" \u2192 "+t.readlinkSync(i+a.name):""+a.name))}return(0,JD.basename)(i,r)+r+o},"toTreeSync");_a.toTreeSync=XD});var C_=T(j=>{"use strict";Object.defineProperty(j,"__esModule",{value:!0});j.getWriteFileOptions=j.writeFileDefaults=j.getRealpathOptsAndCb=j.getRealpathOptions=j.getStatfsOptsAndCb=j.getStatfsOptions=j.getStatOptsAndCb=j.getStatOptions=j.getAppendFileOptsAndCb=j.getAppendFileOpts=j.getOpendirOptsAndCb=j.getOpendirOptions=j.getReaddirOptsAndCb=j.getReaddirOptions=j.getReadFileOptions=j.getRmOptsAndCb=j.getRmdirOptions=j.getDefaultOptsAndCb=j.getDefaultOpts=j.optsDefaults=j.getMkdirOptions=void 0;j.getOptions=N_;j.optsGenerator=Or;j.optsAndCbGenerator=Li;var Hl=ys(),YD=da(),Dp=Qr(),P_={mode:511,recursive:!1},ZD=l(t=>typeof t=="number"?Object.assign({},P_,{mode:t}):Object.assign({},P_,t),"getMkdirOptions");j.getMkdirOptions=ZD;var QD=l(t=>`Expected options to be either an object or a string, but got ${t} instead`,"ERRSTR_OPTS");function N_(t,e){let r;if(e){let i=typeof e;switch(i){case"string":r=Object.assign({},t,{encoding:e});break;case"object":r=Object.assign({},t,e);break;default:throw TypeError(QD(i))}}else return t;return r.encoding!=="buffer"&&(0,YD.assertEncoding)(r.encoding),r}l(N_,"getOptions");function Or(t){return e=>N_(t,e)}l(Or,"optsGenerator");function Li(t){return(e,r)=>typeof e=="function"?[t(),e]:[t(e),(0,Dp.validateCallback)(r)]}l(Li,"optsAndCbGenerator");j.optsDefaults={encoding:"utf8"};j.getDefaultOpts=Or(j.optsDefaults);j.getDefaultOptsAndCb=Li(j.getDefaultOpts);var eI={recursive:!1},tI=l(t=>Object.assign({},eI,t),"getRmdirOptions");j.getRmdirOptions=tI;var rI=Or(j.optsDefaults);j.getRmOptsAndCb=Li(rI);var iI={flag:"r"};j.getReadFileOptions=Or(iI);var nI={encoding:"utf8",recursive:!1,withFileTypes:!1};j.getReaddirOptions=Or(nI);j.getReaddirOptsAndCb=Li(j.getReaddirOptions);var sI={encoding:"utf8",bufferSize:32,recursive:!1};j.getOpendirOptions=Or(sI);j.getOpendirOptsAndCb=Li(j.getOpendirOptions);var oI={encoding:"utf8",mode:438,flag:Hl.FLAGS[Hl.FLAGS.a]};j.getAppendFileOpts=Or(oI);j.getAppendFileOptsAndCb=Li(j.getAppendFileOpts);var aI={bigint:!1},cI=l((t={})=>Object.assign({},aI,t),"getStatOptions");j.getStatOptions=cI;var lI=l((t,e)=>typeof t=="function"?[(0,j.getStatOptions)(),t]:[(0,j.getStatOptions)(t),(0,Dp.validateCallback)(e)],"getStatOptsAndCb");j.getStatOptsAndCb=lI;var fI={bigint:!1},uI=l((t={})=>Object.assign({},fI,t),"getStatfsOptions");j.getStatfsOptions=uI;var hI=l((t,e)=>typeof t=="function"?[(0,j.getStatfsOptions)(),t]:[(0,j.getStatfsOptions)(t),(0,Dp.validateCallback)(e)],"getStatfsOptsAndCb");j.getStatfsOptsAndCb=hI;var dI=j.optsDefaults;j.getRealpathOptions=Or(dI);j.getRealpathOptsAndCb=Li(j.getRealpathOptions);j.writeFileDefaults={encoding:"utf8",mode:438,flag:Hl.FLAGS[Hl.FLAGS.w]};j.getWriteFileOptions=Or(j.writeFileDefaults)});var I_=T(Vl=>{"use strict";Object.defineProperty(Vl,"__esModule",{value:!0});Vl.Dir=void 0;var D_=Qr(),pI=fl(),ji=ha(),$p=class $p{constructor(e,r){this.link=e,this.options=r,this.iteratorInfo=[],this.closed=!1,this.operationQueue=null,this.path=e.getPath(),this.iteratorInfo.push(e.children[Symbol.iterator]())}closeBase(){}readBase(e){let r,i,n,s;do{do if({done:r,value:i}=e[e.length-1].next(),!r)[n,s]=i;else break;while(n==="."||n==="..");if(r){if(e.pop(),e.length===0)break;r=!1}else return this.options.recursive&&s.children.size&&e.push(s.children[Symbol.iterator]()),pI.default.build(s,this.options.encoding)}while(!r);return null}close(e){if(e===void 0)return this.closed?Promise.reject(new ji.Error("ERR_DIR_CLOSED")):new Promise((r,i)=>{this.close(n=>{n?i(n):r()})});if((0,D_.validateCallback)(e),this.closed){process.nextTick(e,new ji.Error("ERR_DIR_CLOSED"));return}if(this.operationQueue!==null){this.operationQueue.push(()=>{this.close(e)});return}this.closed=!0;try{this.closeBase(),process.nextTick(e)}catch(r){process.nextTick(e,r)}}closeSync(){if(this.closed)throw new ji.Error("ERR_DIR_CLOSED");if(this.operationQueue!==null)throw new ji.Error("ERR_DIR_CONCURRENT_OPERATION");this.closed=!0,this.closeBase()}read(e){if(e===void 0)return new Promise((r,i)=>{this.read((n,s)=>{n?i(n):r(s??null)})});if((0,D_.validateCallback)(e),this.closed){process.nextTick(e,new ji.Error("ERR_DIR_CLOSED"));return}if(this.operationQueue!==null){this.operationQueue.push(()=>{this.read(e)});return}this.operationQueue=[];try{let r=this.readBase(this.iteratorInfo);process.nextTick(()=>{let i=this.operationQueue;this.operationQueue=null;for(let n of i)n();e(null,r)})}catch(r){process.nextTick(()=>{let i=this.operationQueue;this.operationQueue=null;for(let n of i)n();e(r)})}}readSync(){if(this.closed)throw new ji.Error("ERR_DIR_CLOSED");if(this.operationQueue!==null)throw new ji.Error("ERR_DIR_CONCURRENT_OPERATION");return this.readBase(this.iteratorInfo)}[Symbol.asyncIterator](){return{next:l(async()=>{try{let e=await this.read();return e!==null?{done:!1,value:e}:{done:!0,value:void 0}}catch(e){throw e}},"next"),[Symbol.asyncIterator](){return this}}}};l($p,"Dir");var Ip=$p;Vl.Dir=Ip});var Bp=T(xr=>{"use strict";Object.defineProperty(xr,"__esModule",{value:!0});xr.toMatcher=xr.toRegex=void 0;var mI=l(t=>/[.^$+{}()|\\]/.test(t)?`\\${t}`:t,"escapeRe"),wI=l((t,e,r,i)=>{let n=e,s=[],o="",f=1;for(;n<t.length&&f>0;){let u=t[n];if(u==="(")f++,o+=u,n++;else if(u===")")if(f--,f===0){s.push(o),n++;break}else o+=u,n++;else u==="|"&&f===1?(s.push(o),o="",n++):(o+=u,n++)}if(f!==0)return;let c="",a=s.length;for(let u=0;u<a;u++)c+=(c?"|":"")+(0,xr.toRegex)(s[u],i).source.replace(/^\^/,"").replace(/\$$/,"");switch(r){case"?":return[`(?:${c})?`,n];case"*":return[`(?:${c})*`,n];case"+":return[`(?:${c})+`,n];case"@":return[`(?:${c})`,n];case"!":return[`(?!${c})[^/]*`,n]}},"parseExtGlob"),yI=l((t,e)=>{let r="",i=0,n=l(()=>{i++;let f=[],c="",a=!1;for(;i<t.length;){let h=t[i];if(h==="}"){f.push(c),i++,a=!0;break}if(h===","){f.push(c),c="",i++;continue}c+=h,i++}return a?`(?:${f.map(h=>(0,xr.toRegex)(h,e).source.replace(/^\^/,"").replace(/\$$/,"")).join("|")})`:"\\{"+mI(c)},"parseBraceGroup"),s=!!e?.extglob;for(;i<t.length;){let f=t[i];if(s&&t[i+1]==="("&&(f==="?"||f==="*"||f==="+"||f==="@"||f==="!")){let c=wI(t,i+2,f,e);if(c){r+=c[0],i=c[1];continue}}switch(f){case"*":{if(t[i+1]==="*"){let c=i+2;for(;t[c]==="*";)c++;t[c]==="/"?(r+="(?:.*/)?",i=c+1):(r+=".*",i=c)}else r+="[^/]*",i++;break}case"?":r+="[^/]",i++;break;case"[":{let c="[";for(i++,i<t.length&&t[i]==="!"&&(c+="^",i++),i<t.length&&t[i]==="]"&&(c+="]",i++);i<t.length&&t[i]!=="]";){let a=t[i];c+=a==="\\"?"\\\\":a,i++}if(i<t.length&&t[i]==="]")c+="]",i++;else{r+="\\[";continue}r+=c;break}case"{":{r+=n();break}case"/":r+="/",i++;break;case".":case"^":case"$":case"+":case"(":case")":case"|":case"\\":r+=`\\${f}`,i++;break;default:r+=f,i++;break}}let o=e?.nocase?"i":"";return new RegExp("^"+r+"$",o)},"toRegex");xr.toRegex=yI;var gI=/^\/(.{1,4096})\/([gimsuy]{0,6})$/,bI=l((t,e)=>{let r=[],i=Array.isArray(t)?t:[t];for(let n of i)if(typeof n=="string"){let s=gI.exec(n);if(s){let[,o,f]=s;r.push(new RegExp(o,f))}else r.push((0,xr.toRegex)(n,e))}else r.push(n);return r.length?new Function("p","return "+r.map(n=>n+".test(p)").join("||")):()=>!1},"toMatcher");xr.toMatcher=bI});var M_=T(Lp=>{"use strict";Object.defineProperty(Lp,"__esModule",{value:!0});Lp.globSync=TI;var qi=ds(),_I=Bp(),$_=Qr(),SI=qi.posix.join,vI=qi.posix.relative,EI=qi.posix.resolve;function B_(t,e){return(0,_I.toRegex)(e).test(t)}l(B_,"matchesPattern");function FI(t,e){return e?typeof e=="function"?e(t):(Array.isArray(e)?e:[e]).some(i=>B_(t,i)):!1}l(FI,"isExcluded");function Mp(t,e,r,i,n=0){let s=[],o=i.maxdepth??1/0,f=i.cwd?(0,$_.pathToFilename)(i.cwd):process.cwd();if(n>o)return s;try{let c=t.readdirSync(e,{withFileTypes:!0});for(let a of c){let u=SI(e,a.name.toString()),h=vI(f,u);if(FI(h,i.exclude))continue;if(r.some(p=>B_(h,p))&&s.push(h),a.isDirectory()&&n<o){let p=Mp(t,u,r,i,n+1);s.push(...p)}}}catch{}return s}l(Mp,"walkDirectory");function TI(t,e,r={}){let i=r.cwd?(0,$_.pathToFilename)(r.cwd):process.cwd(),n=EI(i),s={cwd:n,exclude:r.exclude,maxdepth:r.maxdepth,withFileTypes:r.withFileTypes||!1},o=[];if(qi.posix.isAbsolute(e)){let f=qi.posix.dirname(e),c=qi.posix.basename(e),a=Mp(t,f,[c],{...s,cwd:f});o.push(...a.map(u=>qi.posix.resolve(f,u)))}else{let f=Mp(t,n,[e],s);o.push(...f)}return o=[...new Set(o)].sort(),o}l(TI,"globSync")});var H_=T(Et=>{"use strict";Object.defineProperty(Et,"__esModule",{value:!0});Et.FSWatcher=Et.StatWatcher=Et.Volume=void 0;Et.pathToSteps=UI;Et.dataToStr=WI;Et.toUnixTimestamp=vt;var Re=ds(),Wp=b_(),jp=Jd(),kI=fl(),RI=__(),Es=Xr(),Yl=bp(),OI=S_(),Zl=E_(),xI=Gt(),U_=Tp(),Ui=da(),AI=F_(),W_=Yd(),PI=T_(),NI=A_(),Kl=ys(),CI=ha(),ee=C_(),N=Qr(),DI=I_(),Ge=Nl(),II=Re.resolve,{O_SYMLINK:L_,F_OK:qp,R_OK:$I,W_OK:BI,X_OK:MI,COPYFILE_EXCL:LI,COPYFILE_FICLONE_FORCE:jI}=xI.constants,w9=Re.posix?Re.posix.sep:Re.sep,Gl=Re.posix?Re.posix.relative:Re.relative,Up=Re.posix?Re.posix.join:Re.join,j_=Re.posix?Re.posix.dirname:Re.dirname,q_=Re.posix?Re.posix.normalize:Re.normalize,qI=128;function UI(t){return(0,Ge.filenameToSteps)((0,N.pathToFilename)(t))}l(UI,"pathToSteps");function WI(t,e=Ui.ENCODING_UTF8){return Es.Buffer.isBuffer(t)?t.toString(e):t instanceof Uint8Array?(0,Es.bufferFrom)(t).toString(e):String(t)}l(WI,"dataToStr");function vt(t){if(typeof t=="string"&&+t==t)return+t;if(t instanceof Date)return t.getTime()/1e3;if(isFinite(t))return t<0?Date.now()/1e3:t;throw new Error("Cannot parse time: "+t)}l(vt,"toUnixTimestamp");function Ss(t){if(typeof t!="number")throw TypeError(Kl.ERRSTR.UID)}l(Ss,"validateUid");function vs(t){if(typeof t!="number")throw TypeError(Kl.ERRSTR.GID)}l(vs,"validateGid");var zp=class zp{get promises(){if(this.promisesApi===null)throw new Error("Promise is not supported in this environment.");return this.promisesApi}constructor(e=new Wp.Superblock){this._core=e,this.promisesApi=new PI.FsPromises(this,AI.FileHandle),this.openSync=(c,a,u=438)=>{let h=(0,N.modeToNumber)(u),d=(0,N.pathToFilename)(c),p=(0,N.flagsToNumber)(a);return this._core.open(d,p,h,!(p&L_))},this.open=(c,a,u,h)=>{let d=u,p=h;typeof u=="function"&&(d=438,p=u),d=d||438;let m=(0,N.modeToNumber)(d),w=(0,N.pathToFilename)(c),y=(0,N.flagsToNumber)(a);this.wrapAsync(this._core.open,[w,y,m,!(y&L_)],p)},this.closeSync=c=>{this._core.close(c)},this.close=(c,a)=>{(0,Ge.validateFd)(c);let u=this._core.getFileByFdOrThrow(c,"close");this.wrapAsync(this._core.close,[u.fd],a)},this.readSync=(c,a,u,h,d)=>((0,Ge.validateFd)(c),this._core.read(c,a,u,h,d)),this.read=(c,a,u,h,d,p)=>{if((0,N.validateCallback)(p),h===0)return(0,Yl.default)(()=>{p&&p(null,0,a)});Promise.resolve().then(()=>{try{let m=this._core.read(c,a,u,h,d);p(null,m,a)}catch(m){p(m)}})},this.readv=(c,a,u,h)=>{let d=u,p=h;typeof u=="function"&&([d,p]=[null,u]),(0,N.validateCallback)(p),Promise.resolve().then(()=>{try{let m=this._core.readv(c,a,d);p(null,m,a)}catch(m){p(m)}})},this.readvSync=(c,a,u)=>((0,Ge.validateFd)(c),this._core.readv(c,a,u??null)),this._readfile=(c,a,u)=>{let h,p=typeof c=="number"&&(0,Ge.isFd)(c),m;if(p)m=c;else{let w=(0,N.pathToFilename)(c),y=String(c),g=y.length>1&&y.endsWith("/"),_=this._core.getResolvedLinkOrThrow(w,"open"),F=_.getNode();if(F.isDirectory())throw(0,N.createError)("EISDIR","open",_.getPath());if(g&&F.isFile())throw(0,N.createError)("ENOTDIR","open",y);m=this.openSync(c,a)}try{h=(0,N.bufferToEncoding)(this._core.getFileByFdOrThrow(m).getBuffer(),u)}finally{p||this.closeSync(m)}return h},this.readFileSync=(c,a)=>{let u=(0,ee.getReadFileOptions)(a),h=(0,N.flagsToNumber)(u.flag);return this._readfile(c,h,u.encoding)},this.readFile=(c,a,u)=>{let[h,d]=(0,ee.optsAndCbGenerator)(ee.getReadFileOptions)(a,u),p=(0,N.flagsToNumber)(h.flag);this.wrapAsync(this._readfile,[c,p,h.encoding],d)},this.writeSync=(c,a,u,h,d)=>{let[,p,m,w,y]=(0,N.getWriteSyncArgs)(c,a,u,h,d);return this._write(c,p,m,w,y)},this.write=(c,a,u,h,d,p)=>{let[,m,w,y,g,_,F]=(0,N.getWriteArgs)(c,a,u,h,d,p);Promise.resolve().then(()=>{try{let E=this._write(c,w,y,g,_);m?F(null,E,a):F(null,E,w)}catch(E){F(E)}})},this.writev=(c,a,u,h)=>{let d=u,p=h;typeof u=="function"&&([d,p]=[null,u]),(0,N.validateCallback)(p),Promise.resolve().then(()=>{try{let m=this.writevBase(c,a,d);p(null,m,a)}catch(m){p(m)}})},this.writevSync=(c,a,u)=>((0,Ge.validateFd)(c),this.writevBase(c,a,u??null)),this.writeFileSync=(c,a,u)=>{let h=(0,ee.getWriteFileOptions)(u),d=(0,N.flagsToNumber)(h.flag),p=(0,N.modeToNumber)(h.mode),m=(0,Ge.dataToBuffer)(a,h.encoding);this._core.writeFile(c,m,d,p)},this.writeFile=(c,a,u,h)=>{let d=u,p=h;typeof u=="function"&&([d,p]=[ee.writeFileDefaults,u]);let m=(0,N.validateCallback)(p),w=(0,ee.getWriteFileOptions)(d),y=(0,N.flagsToNumber)(w.flag),g=(0,N.modeToNumber)(w.mode),_=(0,Ge.dataToBuffer)(a,w.encoding);this.wrapAsync(this._core.writeFile,[c,_,y,g],m)},this.copyFileSync=(c,a,u)=>{let h=(0,N.pathToFilename)(c),d=(0,N.pathToFilename)(a);return this._copyFile(h,d,(u||0)|0)},this.copyFile=(c,a,u,h)=>{let d=(0,N.pathToFilename)(c),p=(0,N.pathToFilename)(a),m,w;typeof u=="function"?[m,w]=[0,u]:[m,w]=[u,h],(0,N.validateCallback)(w),this.wrapAsync(this._copyFile,[d,p,m],w)},this._cp=(c,a,u)=>{if(u.filter&&!u.filter(c,a))return;let h=u.dereference?this.statSync(c):this.lstatSync(c),d=null;try{d=this.lstatSync(a)}catch(p){if(p.code!=="ENOENT")throw p}if(d&&h.ino===d.ino&&h.dev===d.dev)throw(0,N.createError)("EINVAL","cp",c,a);if(d){if(h.isDirectory()&&!d.isDirectory())throw(0,N.createError)("EISDIR","cp",c,a);if(!h.isDirectory()&&d.isDirectory())throw(0,N.createError)("ENOTDIR","cp",c,a)}if(h.isDirectory()&&this.isSrcSubdir(c,a))throw(0,N.createError)("EINVAL","cp",c,a);{let p=j_(a);this.existsSync(p)||this.mkdirSync(p,{recursive:!0})}if(h.isDirectory()){if(!u.recursive)throw(0,N.createError)("EISDIR","cp",c);this.cpDirSync(h,d,c,a,u)}else if(h.isFile()||h.isCharacterDevice()||h.isBlockDevice())this.cpFileSync(h,d,c,a,u);else if(h.isSymbolicLink()&&!u.dereference)this.cpSymlinkSync(d,c,a,u);else throw(0,N.createError)("EINVAL","cp",c)},this.linkSync=(c,a)=>{let u=(0,N.pathToFilename)(c),h=(0,N.pathToFilename)(a);this._core.link(u,h)},this.link=(c,a,u)=>{let h=(0,N.pathToFilename)(c),d=(0,N.pathToFilename)(a);this.wrapAsync(this._core.link,[h,d],u)},this.unlinkSync=c=>{let a=(0,N.pathToFilename)(c);this._core.unlink(a)},this.unlink=(c,a)=>{let u=(0,N.pathToFilename)(c);this.wrapAsync(this._core.unlink,[u],a)},this.symlinkSync=(c,a,u)=>{let h=(0,N.pathToFilename)(c),d=(0,N.pathToFilename)(a);this._core.symlink(h,d)},this.symlink=(c,a,u,h)=>{let d=(0,N.validateCallback)(typeof u=="function"?u:h),p=(0,N.pathToFilename)(c),m=(0,N.pathToFilename)(a);this.wrapAsync(this._core.symlink,[p,m],d)},this._lstat=(c,a=!1,u=!1)=>{let h;try{h=this._core.getLinkOrThrow(c,"lstat")}catch(d){if(d.code==="ENOENT"&&!u)return;throw d}return jp.default.build(h.getNode(),a)},this.lstatSync=(c,a)=>{let{throwIfNoEntry:u=!0,bigint:h=!1}=(0,ee.getStatOptions)(a);return this._lstat((0,N.pathToFilename)(c),h,u)},this.renameSync=(c,a)=>{let u=(0,N.pathToFilename)(c),h=(0,N.pathToFilename)(a);this._core.rename(u,h)},this.rename=(c,a,u)=>{let h=(0,N.pathToFilename)(c),d=(0,N.pathToFilename)(a);this.wrapAsync(this._core.rename,[h,d],u)},this.existsSync=c=>{try{return this._exists((0,N.pathToFilename)(c))}catch{return!1}},this.exists=(c,a)=>{let u=(0,N.pathToFilename)(c);if(typeof a!="function")throw Error(Kl.ERRSTR.CB);Promise.resolve().then(()=>{try{a(this._exists(u))}catch{a(!1)}})},this.accessSync=(c,a=qp)=>{let u=(0,N.pathToFilename)(c);a=a|0,this._access(u,a)},this.access=(c,a,u)=>{let h=qp,d;typeof a!="function"?[h,d]=[a|0,(0,N.validateCallback)(u)]:d=a;let p=(0,N.pathToFilename)(c);this.wrapAsync(this._access,[p,h],d)},this.appendFileSync=(c,a,u)=>{let h=(0,ee.getAppendFileOpts)(u);(!h.flag||(0,Ge.isFd)(c))&&(h.flag="a"),this.writeFileSync(c,a,h)},this.appendFile=(c,a,u,h)=>{let[d,p]=(0,ee.getAppendFileOptsAndCb)(u,h);(!d.flag||(0,Ge.isFd)(c))&&(d.flag="a"),this.writeFile(c,a,d,p)},this._readdir=(c,a)=>{let u=(0,Ge.filenameToSteps)(c),h=this._core.getResolvedLinkOrThrow(c,"scandir"),d=h.getNode();if(!d.isDirectory())throw(0,N.createError)("ENOTDIR","scandir",c);if(!d.canRead())throw(0,N.createError)("EACCES","scandir",c);let p=[];for(let w of h.children.keys()){let y=h.getChild(w);if(!(!y||w==="."||w==="..")&&(p.push(kI.default.build(y,a.encoding)),a.recursive&&y.children.size)){let g={...a,recursive:!0,withFileTypes:!0},_=this._readdir(y.getPath(),g);p.push(..._)}}if(!Ge.isWin&&a.encoding!=="buffer"&&p.sort((w,y)=>w.name<y.name?-1:w.name>y.name?1:0),a.withFileTypes)return p;let m=c;return Ge.isWin&&(m=m.replace(/\\/g,"/")),p.map(w=>{if(a.recursive){let y=Up(w.parentPath,w.name.toString());return Ge.isWin&&(y=y.replace(/\\/g,"/")),y.replace(m+Re.posix.sep,"")}return w.name})},this.readdirSync=(c,a)=>{let u=(0,ee.getReaddirOptions)(a),h=(0,N.pathToFilename)(c);return this._readdir(h,u)},this.readdir=(c,a,u)=>{let[h,d]=(0,ee.getReaddirOptsAndCb)(a,u),p=(0,N.pathToFilename)(c);this.wrapAsync(this._readdir,[p,h],d)},this._readlink=(c,a)=>{let h=this._core.getLinkOrThrow(c,"readlink").getNode();if(!h.isSymlink())throw(0,N.createError)("EINVAL","readlink",c);return(0,Ui.strToEncoding)(h.symlink,a)},this.readlinkSync=(c,a)=>{let u=(0,ee.getDefaultOpts)(a),h=(0,N.pathToFilename)(c);return this._readlink(h,u.encoding)},this.readlink=(c,a,u)=>{let[h,d]=(0,ee.getDefaultOptsAndCb)(a,u),p=(0,N.pathToFilename)(c);this.wrapAsync(this._readlink,[p,h.encoding],d)},this._fsync=c=>{this._core.getFileByFdOrThrow(c,"fsync")},this.fsyncSync=c=>{this._fsync(c)},this.fsync=(c,a)=>{this.wrapAsync(this._fsync,[c],a)},this._fdatasync=c=>{this._core.getFileByFdOrThrow(c,"fdatasync")},this.fdatasyncSync=c=>{this._fdatasync(c)},this.fdatasync=(c,a)=>{this.wrapAsync(this._fdatasync,[c],a)},this._ftruncate=(c,a)=>{this._core.getFileByFdOrThrow(c,"ftruncate").truncate(a)},this.ftruncateSync=(c,a)=>{this._ftruncate(c,a)},this.ftruncate=(c,a,u)=>{let h=typeof a=="number"?a:0,d=(0,N.validateCallback)(typeof a=="number"?u:a);this.wrapAsync(this._ftruncate,[c,h],d)},this._truncate=(c,a)=>{let u=this.openSync(c,"r+");try{this.ftruncateSync(u,a)}finally{this.closeSync(u)}},this.truncateSync=(c,a)=>{if((0,Ge.isFd)(c))return this.ftruncateSync(c,a);this._truncate(c,a)},this.truncate=(c,a,u)=>{let h=typeof a=="number"?a:0,d=(0,N.validateCallback)(typeof a=="number"?u:a);if((0,Ge.isFd)(c))return this.ftruncate(c,h,d);this.wrapAsync(this._truncate,[c,h],d)},this._futimes=(c,a,u)=>{let d=this._core.getFileByFdOrThrow(c,"futimes").node;d.atime=new Date(a*1e3),d.mtime=new Date(u*1e3)},this.futimesSync=(c,a,u)=>{this._futimes(c,vt(a),vt(u))},this.futimes=(c,a,u,h)=>{this.wrapAsync(this._futimes,[c,vt(a),vt(u)],h)},this._utimes=(c,a,u,h=!0)=>{let d=this._core,m=(h?d.getResolvedLinkOrThrow(c,"utimes"):d.getLinkOrThrow(c,"lutimes")).getNode();m.atime=new Date(a*1e3),m.mtime=new Date(u*1e3)},this.utimesSync=(c,a,u)=>{this._utimes((0,N.pathToFilename)(c),vt(a),vt(u),!0)},this.utimes=(c,a,u,h)=>{this.wrapAsync(this._utimes,[(0,N.pathToFilename)(c),vt(a),vt(u),!0],h)},this.lutimesSync=(c,a,u)=>{this._utimes((0,N.pathToFilename)(c),vt(a),vt(u),!1)},this.lutimes=(c,a,u,h)=>{this.wrapAsync(this._utimes,[(0,N.pathToFilename)(c),vt(a),vt(u),!1],h)},this.mkdirSync=(c,a)=>{let u=(0,ee.getMkdirOptions)(a),h=(0,N.modeToNumber)(u.mode,511),d=(0,N.pathToFilename)(c);if(u.recursive)return this._core.mkdirp(d,h);this._core.mkdir(d,h)},this.mkdir=(c,a,u)=>{let h=(0,ee.getMkdirOptions)(a),d=(0,N.validateCallback)(typeof a=="function"?a:u),p=(0,N.modeToNumber)(h.mode,511),m=(0,N.pathToFilename)(c);h.recursive?this.wrapAsync(this._core.mkdirp,[m,p],d):this.wrapAsync(this._core.mkdir,[m,p],d)},this._mkdtemp=(c,a,u=5)=>{let h=c+(0,N.genRndStr6)();try{return this._core.mkdir(h,511),(0,Ui.strToEncoding)(h,a)}catch(d){if(d.code==="EEXIST"){if(u>1)return this._mkdtemp(c,a,u-1);throw Error("Could not create temp dir.")}else throw d}},this.mkdtempSync=(c,a)=>{let{encoding:u}=(0,ee.getDefaultOpts)(a);if(!c||typeof c!="string")throw new TypeError("filename prefix is required");return(0,N.nullCheck)(c),this._mkdtemp(c,u)},this.mkdtemp=(c,a,u)=>{let[{encoding:h},d]=(0,ee.getDefaultOptsAndCb)(a,u);if(!c||typeof c!="string")throw new TypeError("filename prefix is required");(0,N.nullCheck)(c)&&this.wrapAsync(this._mkdtemp,[c,h],d)},this.rmdirSync=(c,a)=>{let u=(0,ee.getRmdirOptions)(a);this._core.rmdir((0,N.pathToFilename)(c),u.recursive)},this.rmdir=(c,a,u)=>{let h=(0,ee.getRmdirOptions)(a),d=(0,N.validateCallback)(typeof a=="function"?a:u);this.wrapAsync(this._core.rmdir,[(0,N.pathToFilename)(c),h.recursive],d)},this.rmSync=(c,a)=>{this._core.rm((0,N.pathToFilename)(c),a?.force,a?.recursive)},this.rm=(c,a,u)=>{let[h,d]=(0,ee.getRmOptsAndCb)(a,u);this.wrapAsync(this._core.rm,[(0,N.pathToFilename)(c),h?.force,h?.recursive],d)},this._fchmod=(c,a)=>{this._core.getFileByFdOrThrow(c,"fchmod").chmod(a)},this.fchmodSync=(c,a)=>{this._fchmod(c,(0,N.modeToNumber)(a))},this.fchmod=(c,a,u)=>{this.wrapAsync(this._fchmod,[c,(0,N.modeToNumber)(a)],u)},this._chmod=(c,a,u=!0)=>{(u?this._core.getResolvedLinkOrThrow(c,"chmod"):this._core.getLinkOrThrow(c,"chmod")).getNode().chmod(a)},this.chmodSync=(c,a)=>{let u=(0,N.modeToNumber)(a),h=(0,N.pathToFilename)(c);this._chmod(h,u,!0)},this.chmod=(c,a,u)=>{let h=(0,N.modeToNumber)(a),d=(0,N.pathToFilename)(c);this.wrapAsync(this._chmod,[d,h],u)},this._lchmod=(c,a)=>{this._chmod(c,a,!1)},this.lchmodSync=(c,a)=>{let u=(0,N.modeToNumber)(a),h=(0,N.pathToFilename)(c);this._lchmod(h,u)},this.lchmod=(c,a,u)=>{let h=(0,N.modeToNumber)(a),d=(0,N.pathToFilename)(c);this.wrapAsync(this._lchmod,[d,h],u)},this._fchown=(c,a,u)=>{this._core.getFileByFdOrThrow(c,"fchown").chown(a,u)},this.fchownSync=(c,a,u)=>{Ss(a),vs(u),this._fchown(c,a,u)},this.fchown=(c,a,u,h)=>{Ss(a),vs(u),this.wrapAsync(this._fchown,[c,a,u],h)},this._chown=(c,a,u)=>{this._core.getResolvedLinkOrThrow(c,"chown").getNode().chown(a,u)},this.chownSync=(c,a,u)=>{Ss(a),vs(u),this._chown((0,N.pathToFilename)(c),a,u)},this.chown=(c,a,u,h)=>{Ss(a),vs(u),this.wrapAsync(this._chown,[(0,N.pathToFilename)(c),a,u],h)},this._lchown=(c,a,u)=>{this._core.getLinkOrThrow(c,"lchown").getNode().chown(a,u)},this.lchownSync=(c,a,u)=>{Ss(a),vs(u),this._lchown((0,N.pathToFilename)(c),a,u)},this.lchown=(c,a,u,h)=>{Ss(a),vs(u),this.wrapAsync(this._lchown,[(0,N.pathToFilename)(c),a,u],h)},this.statWatchers={},this.cpSync=(c,a,u)=>{let h=(0,N.pathToFilename)(c),d=(0,N.pathToFilename)(a),p={dereference:u?.dereference??!1,errorOnExist:u?.errorOnExist??!1,filter:u?.filter,force:u?.force??!0,mode:u?.mode??0,preserveTimestamps:u?.preserveTimestamps??!1,recursive:u?.recursive??!1,verbatimSymlinks:u?.verbatimSymlinks??!1};return this._cp(h,d,p)},this.cp=(c,a,u,h)=>{let d=(0,N.pathToFilename)(c),p=(0,N.pathToFilename)(a),m,w;typeof u=="function"?[m,w]=[{},u]:[m,w]=[u||{},h],(0,N.validateCallback)(w);let y={dereference:m?.dereference??!1,errorOnExist:m?.errorOnExist??!1,filter:m?.filter,force:m?.force??!0,mode:m?.mode??0,preserveTimestamps:m?.preserveTimestamps??!1,recursive:m?.recursive??!1,verbatimSymlinks:m?.verbatimSymlinks??!1};this.wrapAsync(this._cp,[d,p,y],w)},this.openAsBlob=async(c,a)=>{let u=(0,N.pathToFilename)(c),h;try{h=this._core.getResolvedLinkOrThrow(u,"open")}catch(w){throw w&&typeof w=="object"&&w.code==="ENOENT"?new CI.TypeError("ERR_INVALID_ARG_VALUE"):w}let p=h.getNode().getBuffer(),m=a?.type||"";return new Blob([p],{type:m})},this.glob=(c,...a)=>{let[u,h]=a.length===1?[{},a[0]]:[a[0],a[1]];this.wrapAsync(this._globSync,[c,u||{}],h)},this.globSync=(c,a={})=>this._globSync(c,a),this._globSync=(c,a={})=>{let{globSync:u}=M_();return u(this,c,a)},this._opendir=(c,a)=>{let u=this._core.getResolvedLinkOrThrow(c,"scandir");if(!u.getNode().isDirectory())throw(0,N.createError)("ENOTDIR","scandir",c);return new DI.Dir(u,a)},this.opendirSync=(c,a)=>{let u=(0,ee.getOpendirOptions)(a),h=(0,N.pathToFilename)(c);return this._opendir(h,u)},this.opendir=(c,a,u)=>{let[h,d]=(0,ee.getOpendirOptsAndCb)(a,u),p=(0,N.pathToFilename)(c);this.wrapAsync(this._opendir,[p,h],d)};let r=this;this.StatWatcher=class extends Jl{constructor(){super(r)}};let i=cr;this.ReadStream=class extends i{constructor(...c){super(r,...c)}};let n=Bt;this.WriteStream=class extends n{constructor(...c){super(r,...c)}},this.FSWatcher=class extends Xl{constructor(){super(r)}};let s=l((c,a)=>{let u=this._core.getResolvedLinkOrThrow(c,"realpath");return(0,Ui.strToEncoding)(u.getPath()||"/",a)},"_realpath"),o=l((c,a,u)=>{let[h,d]=(0,ee.getRealpathOptsAndCb)(a,u),p=(0,N.pathToFilename)(c);r.wrapAsync(s,[p,h.encoding],d)},"realpathImpl"),f=l((c,a)=>s((0,N.pathToFilename)(c),(0,ee.getRealpathOptions)(a).encoding),"realpathSyncImpl");this.realpath=o,this.realpath.native=o,this.realpathSync=f,this.realpathSync.native=f}wrapAsync(e,r,i){(0,N.validateCallback)(i),Promise.resolve().then(()=>{let n;try{n=e.apply(this,r)}catch(s){i(s);return}i(null,n)})}toTree(e={separator:Re.sep}){return(0,NI.toTreeSync)(this,e)}reset(){this._core.reset()}toJSON(e,r={},i=!1,n=!1){return this._core.toJSON(e,r,i,n)}fromJSON(e,r){return this._core.fromJSON(e,r)}fromNestedJSON(e,r){return this._core.fromNestedJSON(e,r)}mountSync(e,r){this._core.fromJSON(r,e)}_write(e,r,i,n,s){let o=this._core.getFileByFdOrThrow(e,"write");if(o.node.isSymlink())throw(0,N.createError)("EBADF","write",o.link.getPath());return o.write(r,i,n,s===-1||typeof s!="number"?void 0:s)}writevBase(e,r,i){let n=this._core.getFileByFdOrThrow(e),s=i??void 0;s===-1&&(s=void 0);let o=0;for(let f of r){let c=Es.Buffer.from(f.buffer,f.byteOffset,f.byteLength),a=n.write(c,0,c.byteLength,s);if(s=void 0,o+=a,a<c.byteLength)break}return o}_copyFile(e,r,i){let n=this.readFileSync(e);if(i&LI&&this.existsSync(r))throw(0,N.createError)("EEXIST","copyFile",e,r);if(i&jI)throw(0,N.createError)("ENOSYS","copyFile",e,r);this._core.writeFile(r,n,Kl.FLAGS.w,438)}isSrcSubdir(e,r){try{let i=q_(e.startsWith("/")?e:"/"+e),n=q_(r.startsWith("/")?r:"/"+r);if(i===n)return!0;let s=Gl(i,n);return s===""||!s.startsWith("..")&&!(0,Re.isAbsolute)(s)}catch{return!1}}cpFileSync(e,r,i,n,s){if(r){if(s.errorOnExist)throw(0,N.createError)("EEXIST","cp",n);if(!s.force)return;this.unlinkSync(n)}this.copyFileSync(i,n,s.mode),s.preserveTimestamps&&this.utimesSync(n,e.atime,e.mtime),this.chmodSync(n,Number(e.mode))}cpDirSync(e,r,i,n,s){r||this.mkdirSync(n);let o=this.readdirSync(i);for(let f of o){let c=Up(i,String(f)),a=Up(n,String(f));s.filter&&!s.filter(c,a)||this._cp(c,a,s)}this.chmodSync(n,Number(e.mode))}cpSymlinkSync(e,r,i,n){let s=String(this.readlinkSync(r));!n.verbatimSymlinks&&!(0,Re.isAbsolute)(s)&&(s=II(j_(r),s)),e&&this.unlinkSync(i),this.symlinkSync(s,i)}lstat(e,r,i){let[{throwIfNoEntry:n=!0,bigint:s=!1},o]=(0,ee.getStatOptsAndCb)(r,i);this.wrapAsync(this._lstat,[(0,N.pathToFilename)(e),s,n],o)}_stat(e,r=!1,i=!0){let n;try{n=this._core.getResolvedLinkOrThrow(e,"stat")}catch(s){if(s.code==="ENOENT"&&!i)return;throw s}return jp.default.build(n.getNode(),r)}statSync(e,r){let{bigint:i=!0,throwIfNoEntry:n=!0}=(0,ee.getStatOptions)(r);return this._stat((0,N.pathToFilename)(e),i,n)}stat(e,r,i){let[{bigint:n=!1,throwIfNoEntry:s=!0},o]=(0,ee.getStatOptsAndCb)(r,i);this.wrapAsync(this._stat,[(0,N.pathToFilename)(e),n,s],o)}fstatBase(e,r=!1){let i=this._core.getFileByFd(e);if(!i)throw(0,N.createError)("EBADF","fstat");return jp.default.build(i.node,r)}fstatSync(e,r){return this.fstatBase(e,(0,ee.getStatOptions)(r).bigint)}fstat(e,r,i){let[n,s]=(0,ee.getStatOptsAndCb)(r,i);this.wrapAsync(this.fstatBase,[e,n.bigint],s)}_exists(e){return!!this._stat(e)}_access(e,r){let n=this._core.getLinkOrThrow(e,"access").getNode();if(r!==qp&&(r&$I&&!n.canRead()||r&BI&&!n.canWrite()||r&MI&&!n.canExecute()))throw(0,N.createError)("EACCES","access",e)}watchFile(e,r,i){let n=(0,N.pathToFilename)(e),s=r,o=i;if(typeof s=="function"&&(o=r,s=null),typeof o!="function")throw Error('"watchFile()" requires a listener function');let f=5007,c=!0;s&&typeof s=="object"&&(typeof s.interval=="number"&&(f=s.interval),typeof s.persistent=="boolean"&&(c=s.persistent));let a=this.statWatchers[n];return a||(a=new this.StatWatcher,a.start(n,c,f),this.statWatchers[n]=a),a.addListener("change",o),a}unwatchFile(e,r){let i=(0,N.pathToFilename)(e),n=this.statWatchers[i];n&&(typeof r=="function"?n.removeListener("change",r):n.removeAllListeners("change"),n.listenerCount("change")===0&&(n.stop(),delete this.statWatchers[i]))}createReadStream(e,r){return new this.ReadStream(e,r)}createWriteStream(e,r){return new this.WriteStream(e,r)}watch(e,r,i){let n=(0,N.pathToFilename)(e),s=r;typeof r=="function"&&(i=r,s=null);let{persistent:o,recursive:f,encoding:c}=(0,ee.getDefaultOpts)(s);o===void 0&&(o=!0),f===void 0&&(f=!1);let a=new this.FSWatcher;return a.start(n,o,f,c),i&&a.addListener("change",i),a}_statfs(e,r=!1){return this._core.getResolvedLinkOrThrow(e,"statfs"),RI.default.build(this._core,r)}statfsSync(e,r){let{bigint:i=!1}=(0,ee.getStatfsOptions)(r);return this._statfs((0,N.pathToFilename)(e),i)}statfs(e,r,i){let[{bigint:n=!1},s]=(0,ee.getStatfsOptsAndCb)(r,i);this.wrapAsync(this._statfs,[(0,N.pathToFilename)(e),n],s)}};l(zp,"Volume");var Wi=zp;Et.Volume=Wi;Wi.fromJSON=(t,e)=>new Wi(Wp.Superblock.fromJSON(t,e));Wi.fromNestedJSON=(t,e)=>new Wi(Wp.Superblock.fromNestedJSON(t,e));function zI(t){t.emit("stop")}l(zI,"emitStop");var Hp=class Hp extends U_.EventEmitter{constructor(e){super(),this.onInterval=()=>{try{let r=this.vol.statSync(this.filename);this.hasChanged(r)&&(this.emit("change",r,this.prev),this.prev=r)}finally{this.loop()}},this.vol=e}loop(){this.timeoutRef=this.setTimeout(this.onInterval,this.interval)}hasChanged(e){return e.mtimeMs>this.prev.mtimeMs||e.nlink!==this.prev.nlink}start(e,r=!0,i=5007){this.filename=(0,N.pathToFilename)(e),this.setTimeout=r?setTimeout.bind(globalThis):OI.default,this.interval=i,this.prev=this.vol.statSync(this.filename),this.loop()}stop(){clearTimeout(this.timeoutRef),(0,Yl.default)(()=>{zI.call(this,this)})}};l(Hp,"StatWatcher");var Jl=Hp;Et.StatWatcher=Jl;var $t;function HI(t){$t=(0,Es.bufferAllocUnsafe)(t),$t.used=0}l(HI,"allocNewPool");(0,W_.inherits)(cr,Zl.Readable);Et.ReadStream=cr;function cr(t,e,r){if(!(this instanceof cr))return new cr(t,e,r);if(this._vol=t,r=Object.assign({},(0,ee.getOptions)(r,{})),r.highWaterMark===void 0&&(r.highWaterMark=64*1024),Zl.Readable.call(this,r),this.path=(0,N.pathToFilename)(e),this.fd=r.fd===void 0?null:typeof r.fd!="number"?r.fd.fd:r.fd,this.flags=r.flags===void 0?"r":r.flags,this.mode=r.mode===void 0?438:r.mode,this.start=r.start,this.end=r.end,this.autoClose=r.autoClose===void 0?!0:r.autoClose,this.pos=void 0,this.bytesRead=0,this.start!==void 0){if(typeof this.start!="number")throw new TypeError('"start" option must be a Number');if(this.end===void 0)this.end=1/0;else if(typeof this.end!="number")throw new TypeError('"end" option must be a Number');if(this.start>this.end)throw new Error('"start" option must be <= "end" option');this.pos=this.start}typeof this.fd!="number"&&this.open(),this.on("end",function(){this.autoClose&&this.destroy&&this.destroy()})}l(cr,"FsReadStream");cr.prototype.open=function(){var t=this;this._vol.open(this.path,this.flags,this.mode,(e,r)=>{if(e){t.autoClose&&t.destroy&&t.destroy(),t.emit("error",e);return}t.fd=r,t.emit("open",r),t.read()})};cr.prototype._read=function(t){if(typeof this.fd!="number")return this.once("open",function(){this._read(t)});if(this.destroyed)return;(!$t||$t.length-$t.used<qI)&&HI(this._readableState.highWaterMark);var e=$t,r=Math.min($t.length-$t.used,t),i=$t.used;if(this.pos!==void 0&&(r=Math.min(this.end-this.pos+1,r)),r<=0)return this.push(null);var n=this;this._vol.read(this.fd,$t,$t.used,r,this.pos,s),this.pos!==void 0&&(this.pos+=r),$t.used+=r;function s(o,f){if(o)n.autoClose&&n.destroy&&n.destroy(),n.emit("error",o);else{var c=null;f>0&&(n.bytesRead+=f,c=e.slice(i,i+f)),n.push(c)}}l(s,"onread")};cr.prototype._destroy=function(t,e){this.close(r=>{e(t||r)})};cr.prototype.close=function(t){if(t&&this.once("close",t),this.closed||typeof this.fd!="number"){if(typeof this.fd!="number"){this.once("open",z_);return}return(0,Yl.default)(()=>this.emit("close"))}typeof this._readableState?.closed=="boolean"?this._readableState.closed=!0:this.closed=!0,this._vol.close(this.fd,e=>{e?this.emit("error",e):this.emit("close")}),this.fd=null};function z_(t){this.close()}l(z_,"closeOnOpen");(0,W_.inherits)(Bt,Zl.Writable);Et.WriteStream=Bt;function Bt(t,e,r){if(!(this instanceof Bt))return new Bt(t,e,r);if(this._vol=t,r=Object.assign({},(0,ee.getOptions)(r,{})),Zl.Writable.call(this,r),this.path=(0,N.pathToFilename)(e),this.fd=r.fd===void 0?null:typeof r.fd!="number"?r.fd.fd:r.fd,this.flags=r.flags===void 0?"w":r.flags,this.mode=r.mode===void 0?438:r.mode,this.start=r.start,this.autoClose=r.autoClose===void 0?!0:!!r.autoClose,this.pos=void 0,this.bytesWritten=0,this.pending=!0,this.start!==void 0){if(typeof this.start!="number")throw new TypeError('"start" option must be a Number');if(this.start<0)throw new Error('"start" must be >= zero');this.pos=this.start}r.encoding&&this.setDefaultEncoding(r.encoding),typeof this.fd!="number"&&this.open(),this.once("finish",function(){this.autoClose&&this.close()})}l(Bt,"FsWriteStream");Bt.prototype.open=function(){this._vol.open(this.path,this.flags,this.mode,function(t,e){if(t){this.autoClose&&this.destroy&&this.destroy(),this.emit("error",t);return}this.fd=e,this.pending=!1,this.emit("open",e)}.bind(this))};Bt.prototype._write=function(t,e,r){if(!(t instanceof Es.Buffer||t instanceof Uint8Array))return this.emit("error",new Error("Invalid data"));if(typeof this.fd!="number")return this.once("open",function(){this._write(t,e,r)});var i=this;this._vol.write(this.fd,t,0,t.length,this.pos,(n,s)=>{if(n)return i.autoClose&&i.destroy&&i.destroy(),r(n);i.bytesWritten+=s,r()}),this.pos!==void 0&&(this.pos+=t.length)};Bt.prototype._writev=function(t,e){if(typeof this.fd!="number")return this.once("open",function(){this._writev(t,e)});let r=this,i=t.length,n=new Array(i);for(var s=0,o=0;o<i;o++){var f=t[o].chunk;n[o]=f,s+=f.length}let c=Es.Buffer.concat(n);this._vol.write(this.fd,c,0,c.length,this.pos,(a,u)=>{if(a)return r.destroy&&r.destroy(),e(a);r.bytesWritten+=u,e()}),this.pos!==void 0&&(this.pos+=s)};Bt.prototype.close=function(t){if(t&&this.once("close",t),this.closed||typeof this.fd!="number"){if(typeof this.fd!="number"){this.once("open",z_);return}return(0,Yl.default)(()=>this.emit("close"))}typeof this._writableState?.closed=="boolean"?this._writableState.closed=!0:this.closed=!0,this._vol.close(this.fd,e=>{e?this.emit("error",e):this.emit("close")}),this.fd=null};Bt.prototype._destroy=cr.prototype._destroy;Bt.prototype.destroySoon=Bt.prototype.end;var Vp=class Vp extends U_.EventEmitter{constructor(e){super(),this._filename="",this._filenameEncoded="",this._recursive=!1,this._encoding=Ui.ENCODING_UTF8,this._listenerRemovers=new Map,this._onParentChild=r=>{r.getName()===this._getName()&&this._emit("rename")},this._emit=r=>{this.emit("change",r,this._filenameEncoded)},this._persist=()=>{this._timer=setTimeout(this._persist,1e6)},this._vol=e}_getName(){return this._steps[this._steps.length-1]}start(e,r=!0,i=!1,n=Ui.ENCODING_UTF8){this._filename=(0,N.pathToFilename)(e),this._steps=(0,Ge.filenameToSteps)(this._filename),this._filenameEncoded=(0,Ui.strToEncoding)(this._filename),this._recursive=i,this._encoding=n;try{this._link=this._vol._core.getLinkOrThrow(this._filename,"FSWatcher")}catch(c){let a=new Error(`watch ${this._filename} ${c.code}`);throw a.code=c.code,a.errno=c.code,a}let s=l(c=>{let a=c.getPath(),u=c.getNode(),h=l(()=>{let m=Gl(this._filename,a);return m||(m=this._getName()),this.emit("change","change",m)},"onNodeChange"),d=u.changes.listen(([m])=>{m==="modify"&&h()}),p=this._listenerRemovers.get(u.ino)??[];p.push(()=>d()),this._listenerRemovers.set(u.ino,p)},"watchLinkNodeChanged"),o=l(c=>{let a=c.getNode(),u=l(m=>{this.emit("change","rename",Gl(this._filename,m.getPath())),s(m),o(m)},"onLinkChildAdd"),h=l(m=>{let w=l(y=>{let g=y.getNode().ino,_=this._listenerRemovers.get(g);_&&(_.forEach(F=>F()),this._listenerRemovers.delete(g));for(let[F,E]of y.children.entries())E&&F!=="."&&F!==".."&&w(E)},"removeLinkNodeListeners");w(m),this.emit("change","rename",Gl(this._filename,m.getPath()))},"onLinkChildDelete");for(let[m,w]of c.children.entries())w&&m!=="."&&m!==".."&&s(w);let d=c.changes.listen(([m,w])=>{m==="child:add"?u(w):m==="child:del"&&h(w)});if((this._listenerRemovers.get(a.ino)??[]).push(()=>{d()}),i)for(let[m,w]of c.children.entries())w&&m!=="."&&m!==".."&&o(w)},"watchLinkChildrenChanged");s(this._link),o(this._link);let f=this._link.parent;f&&f.changes.listen(([c,a])=>{c==="child:del"&&this._onParentChild(a)}),r&&this._persist()}close(){clearTimeout(this._timer),this._listenerRemovers.forEach(e=>{e.forEach(r=>r())}),this._listenerRemovers.clear(),this._parentChangesUnsub?.()}};l(Vp,"FSWatcher");var Xl=Vp;Et.FSWatcher=Xl});var V_=T(Ql=>{"use strict";Object.defineProperty(Ql,"__esModule",{value:!0});Ql.fsSynchronousApiList=void 0;Ql.fsSynchronousApiList=["accessSync","appendFileSync","chmodSync","chownSync","closeSync","copyFileSync","existsSync","fchmodSync","fchownSync","fdatasyncSync","fstatSync","fsyncSync","ftruncateSync","futimesSync","lchmodSync","lchownSync","linkSync","lstatSync","mkdirSync","mkdtempSync","openSync","opendirSync","readdirSync","readFileSync","readlinkSync","readSync","readvSync","realpathSync","renameSync","rmdirSync","rmSync","statSync","symlinkSync","truncateSync","unlinkSync","utimesSync","lutimesSync","writeFileSync","writeSync","writevSync"]});var G_=T(ef=>{"use strict";Object.defineProperty(ef,"__esModule",{value:!0});ef.fsCallbackApiList=void 0;ef.fsCallbackApiList=["access","appendFile","chmod","chown","close","copyFile","cp","createReadStream","createWriteStream","exists","fchmod","fchown","fdatasync","fstat","fsync","ftruncate","futimes","lchmod","lchown","link","lstat","mkdir","mkdtemp","open","openAsBlob","opendir","read","readv","readdir","readFile","readlink","realpath","rename","rm","rmdir","stat","statfs","symlink","truncate","unlink","unwatchFile","utimes","lutimes","watch","watchFile","write","writev","writeFile"]});var Sa=T((Ft,tf)=>{"use strict";Object.defineProperty(Ft,"__esModule",{value:!0});Ft.memfs=Ft.fs=Ft.vol=Ft.Volume=void 0;Ft.createFsFromVolume=Gp;var VI=Jd(),GI=fl(),rf=H_();Object.defineProperty(Ft,"Volume",{enumerable:!0,get:l(function(){return rf.Volume},"get")});var K_=Gt(),KI=V_(),JI=G_(),{F_OK:XI,R_OK:YI,W_OK:ZI,X_OK:QI}=K_.constants;Ft.vol=new rf.Volume;function Gp(t){let e={F_OK:XI,R_OK:YI,W_OK:ZI,X_OK:QI,constants:K_.constants,Stats:VI.default,Dirent:GI.default};for(let r of KI.fsSynchronousApiList)typeof t[r]=="function"&&(e[r]=t[r].bind(t));for(let r of JI.fsCallbackApiList)typeof t[r]=="function"&&(e[r]=t[r].bind(t));return e.StatWatcher=t.StatWatcher,e.FSWatcher=t.FSWatcher,e.WriteStream=t.WriteStream,e.ReadStream=t.ReadStream,e.promises=t.promises,typeof t.realpath=="function"&&(e.realpath=t.realpath.bind(t),typeof t.realpath.native=="function"&&(e.realpath.native=t.realpath.native.bind(t))),typeof t.realpathSync=="function"&&(e.realpathSync=t.realpathSync.bind(t),typeof t.realpathSync.native=="function"&&(e.realpathSync.native=t.realpathSync.native.bind(t))),e._toUnixTimestamp=rf.toUnixTimestamp,e.__vol=t,e}l(Gp,"createFsFromVolume");Ft.fs=Gp(Ft.vol);var e$=l((t={},e="/")=>{let r=rf.Volume.fromNestedJSON(t,e);return{fs:Gp(r),vol:r}},"memfs");Ft.memfs=e$;tf.exports={...tf.exports,...Ft.fs};tf.exports.semantic=!0});var X_=T((k9,J_)=>{"use strict";var Tt=l(function(t){if(t=t||{},this.Promise=t.Promise||Promise,this.queues=Object.create(null),this.domainReentrant=t.domainReentrant||!1,this.domainReentrant){if(typeof process>"u"||typeof process.domain>"u")throw new Error("Domain-reentrant locks require `process.domain` to exist. Please flip `opts.domainReentrant = false`, use a NodeJS version that still implements Domain, or install a browser polyfill.");this.domains=Object.create(null)}this.timeout=t.timeout||Tt.DEFAULT_TIMEOUT,this.maxOccupationTime=t.maxOccupationTime||Tt.DEFAULT_MAX_OCCUPATION_TIME,this.maxExecutionTime=t.maxExecutionTime||Tt.DEFAULT_MAX_EXECUTION_TIME,t.maxPending===1/0||Number.isInteger(t.maxPending)&&t.maxPending>=0?this.maxPending=t.maxPending:this.maxPending=Tt.DEFAULT_MAX_PENDING},"AsyncLock");Tt.DEFAULT_TIMEOUT=0;Tt.DEFAULT_MAX_OCCUPATION_TIME=0;Tt.DEFAULT_MAX_EXECUTION_TIME=0;Tt.DEFAULT_MAX_PENDING=1e3;Tt.prototype.acquire=function(t,e,r,i){if(Array.isArray(t))return this._acquireBatch(t,e,r,i);if(typeof e!="function")throw new Error("You must pass a function to execute");var n=null,s=null,o=null;typeof r!="function"&&(i=r,r=null,o=new this.Promise(function(_,F){n=_,s=F})),i=i||{};var f=!1,c=null,a=null,u=null,h=this,d=l(function(_,F,E){a&&(clearTimeout(a),a=null),u&&(clearTimeout(u),u=null),_&&(h.queues[t]&&h.queues[t].length===0&&delete h.queues[t],h.domainReentrant&&delete h.domains[t]),f||(o?F?s(F):n(E):typeof r=="function"&&r(F,E),f=!0),_&&h.queues[t]&&h.queues[t].length>0&&h.queues[t].shift()()},"done"),p=l(function(_){if(f)return d(_);c&&(clearTimeout(c),c=null),h.domainReentrant&&_&&(h.domains[t]=process.domain);var F=i.maxExecutionTime||h.maxExecutionTime;if(F&&(u=setTimeout(function(){h.queues[t]&&d(_,new Error("Maximum execution time is exceeded "+t))},F)),e.length===1){var E=!1;try{e(function(R,P){E||(E=!0,d(_,R,P))})}catch(R){E||(E=!0,d(_,R))}}else h._promiseTry(function(){return e()}).then(function(R){d(_,void 0,R)},function(R){d(_,R)})},"exec");h.domainReentrant&&process.domain&&(p=process.domain.bind(p));var m=i.maxPending||h.maxPending;if(!h.queues[t])h.queues[t]=[],p(!0);else if(h.domainReentrant&&process.domain&&process.domain===h.domains[t])p(!1);else if(h.queues[t].length>=m)d(!1,new Error("Too many pending tasks in queue "+t));else{var w=l(function(){p(!0)},"taskFn");i.skipQueue?h.queues[t].unshift(w):h.queues[t].push(w);var y=i.timeout||h.timeout;y&&(c=setTimeout(function(){c=null,d(!1,new Error("async-lock timed out in queue "+t))},y))}var g=i.maxOccupationTime||h.maxOccupationTime;if(g&&(a=setTimeout(function(){h.queues[t]&&d(!1,new Error("Maximum occupation time is exceeded in queue "+t))},g)),o)return o};Tt.prototype._acquireBatch=function(t,e,r,i){typeof r!="function"&&(i=r,r=null);var n=this,s=l(function(f,c){return function(a){n.acquire(f,c,a,i)}},"getFn"),o=t.reduceRight(function(f,c){return s(c,f)},e);if(typeof r=="function")o(r);else return new this.Promise(function(f,c){o.length===1?o(function(a,u){a?c(a):f(u)}):f(o())})};Tt.prototype.isBusy=function(t){return t?!!this.queues[t]:Object.keys(this.queues).length>0};Tt.prototype._promiseTry=function(t){try{return this.Promise.resolve(t())}catch(e){return this.Promise.reject(e)}};J_.exports=Tt});var Z_=T((O9,Y_)=>{"use strict";Y_.exports=X_()});var Q_=T((x9,Kp)=>{typeof Object.create=="function"?Kp.exports=l(function(e,r){r&&(e.super_=r,e.prototype=Object.create(r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))},"inherits"):Kp.exports=l(function(e,r){if(r){e.super_=r;var i=l(function(){},"TempCtor");i.prototype=r.prototype,e.prototype=new i,e.prototype.constructor=e}},"inherits")});var eS=T((P9,Xp)=>{try{if(Jp=ne("util"),typeof Jp.inherits!="function")throw"";Xp.exports=Jp.inherits}catch{Xp.exports=Q_()}var Jp});var va=T((Yp,rS)=>{var nf=ne("buffer"),lr=nf.Buffer;function tS(t,e){for(var r in t)e[r]=t[r]}l(tS,"copyProps");lr.from&&lr.alloc&&lr.allocUnsafe&&lr.allocUnsafeSlow?rS.exports=nf:(tS(nf,Yp),Yp.Buffer=zi);function zi(t,e,r){return lr(t,e,r)}l(zi,"SafeBuffer");zi.prototype=Object.create(lr.prototype);tS(lr,zi);zi.from=function(t,e,r){if(typeof t=="number")throw new TypeError("Argument must not be a number");return lr(t,e,r)};zi.alloc=function(t,e,r){if(typeof t!="number")throw new TypeError("Argument must be a number");var i=lr(t);return e!==void 0?typeof r=="string"?i.fill(e,r):i.fill(e):i.fill(0),i};zi.allocUnsafe=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return lr(t)};zi.allocUnsafeSlow=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return nf.SlowBuffer(t)}});var nS=T((C9,iS)=>{var t$={}.toString;iS.exports=Array.isArray||function(t){return t$.call(t)=="[object Array]"}});var Fs=T((D9,sS)=>{"use strict";sS.exports=TypeError});var Zp=T((I9,oS)=>{"use strict";oS.exports=Object});var cS=T(($9,aS)=>{"use strict";aS.exports=Error});var fS=T((B9,lS)=>{"use strict";lS.exports=EvalError});var hS=T((M9,uS)=>{"use strict";uS.exports=RangeError});var pS=T((L9,dS)=>{"use strict";dS.exports=ReferenceError});var Qp=T((j9,mS)=>{"use strict";mS.exports=SyntaxError});var yS=T((q9,wS)=>{"use strict";wS.exports=URIError});var bS=T((U9,gS)=>{"use strict";gS.exports=Math.abs});var SS=T((W9,_S)=>{"use strict";_S.exports=Math.floor});var ES=T((z9,vS)=>{"use strict";vS.exports=Math.max});var TS=T((H9,FS)=>{"use strict";FS.exports=Math.min});var RS=T((V9,kS)=>{"use strict";kS.exports=Math.pow});var xS=T((G9,OS)=>{"use strict";OS.exports=Math.round});var PS=T((K9,AS)=>{"use strict";AS.exports=Number.isNaN||l(function(e){return e!==e},"isNaN")});var CS=T((X9,NS)=>{"use strict";var r$=PS();NS.exports=l(function(e){return r$(e)||e===0?e:e<0?-1:1},"sign")});var IS=T((Z9,DS)=>{"use strict";DS.exports=Object.getOwnPropertyDescriptor});var Ts=T((Q9,$S)=>{"use strict";var sf=IS();if(sf)try{sf([],"length")}catch{sf=null}$S.exports=sf});var Ea=T((eK,BS)=>{"use strict";var of=Object.defineProperty||!1;if(of)try{of({},"a",{value:1})}catch{of=!1}BS.exports=of});var em=T((tK,MS)=>{"use strict";MS.exports=l(function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var e={},r=Symbol("test"),i=Object(r);if(typeof r=="string"||Object.prototype.toString.call(r)!=="[object Symbol]"||Object.prototype.toString.call(i)!=="[object Symbol]")return!1;var n=42;e[r]=n;for(var s in e)return!1;if(typeof Object.keys=="function"&&Object.keys(e).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(e).length!==0)return!1;var o=Object.getOwnPropertySymbols(e);if(o.length!==1||o[0]!==r||!Object.prototype.propertyIsEnumerable.call(e,r))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var f=Object.getOwnPropertyDescriptor(e,r);if(f.value!==n||f.enumerable!==!0)return!1}return!0},"hasSymbols")});var qS=T((iK,jS)=>{"use strict";var LS=typeof Symbol<"u"&&Symbol,i$=em();jS.exports=l(function(){return typeof LS!="function"||typeof Symbol!="function"||typeof LS("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:i$()},"hasNativeSymbols")});var tm=T((sK,US)=>{"use strict";US.exports=typeof Reflect<"u"&&Reflect.getPrototypeOf||null});var rm=T((oK,WS)=>{"use strict";var n$=Zp();WS.exports=n$.getPrototypeOf||null});var VS=T((aK,HS)=>{"use strict";var s$="Function.prototype.bind called on incompatible ",o$=Object.prototype.toString,a$=Math.max,c$="[object Function]",zS=l(function(e,r){for(var i=[],n=0;n<e.length;n+=1)i[n]=e[n];for(var s=0;s<r.length;s+=1)i[s+e.length]=r[s];return i},"concatty"),l$=l(function(e,r){for(var i=[],n=r||0,s=0;n<e.length;n+=1,s+=1)i[s]=e[n];return i},"slicy"),f$=l(function(t,e){for(var r="",i=0;i<t.length;i+=1)r+=t[i],i+1<t.length&&(r+=e);return r},"joiny");HS.exports=l(function(e){var r=this;if(typeof r!="function"||o$.apply(r)!==c$)throw new TypeError(s$+r);for(var i=l$(arguments,1),n,s=l(function(){if(this instanceof n){var u=r.apply(this,zS(i,arguments));return Object(u)===u?u:this}return r.apply(e,zS(i,arguments))},"binder"),o=a$(0,r.length-i.length),f=[],c=0;c<o;c++)f[c]="$"+c;if(n=Function("binder","return function ("+f$(f,",")+"){ return binder.apply(this,arguments); }")(s),r.prototype){var a=l(function(){},"Empty");a.prototype=r.prototype,n.prototype=new a,a.prototype=null}return n},"bind")});var ks=T((lK,GS)=>{"use strict";var u$=VS();GS.exports=Function.prototype.bind||u$});var af=T((fK,KS)=>{"use strict";KS.exports=Function.prototype.call});var cf=T((uK,JS)=>{"use strict";JS.exports=Function.prototype.apply});var YS=T((hK,XS)=>{"use strict";XS.exports=typeof Reflect<"u"&&Reflect&&Reflect.apply});var im=T((dK,ZS)=>{"use strict";var h$=ks(),d$=cf(),p$=af(),m$=YS();ZS.exports=m$||h$.call(p$,d$)});var lf=T((pK,QS)=>{"use strict";var w$=ks(),y$=Fs(),g$=af(),b$=im();QS.exports=l(function(e){if(e.length<1||typeof e[0]!="function")throw new y$("a function is required");return b$(w$,g$,e)},"callBindBasic")});var sv=T((wK,nv)=>{"use strict";var _$=lf(),ev=Ts(),rv;try{rv=[].__proto__===Array.prototype}catch(t){if(!t||typeof t!="object"||!("code"in t)||t.code!=="ERR_PROTO_ACCESS")throw t}var nm=!!rv&&ev&&ev(Object.prototype,"__proto__"),iv=Object,tv=iv.getPrototypeOf;nv.exports=nm&&typeof nm.get=="function"?_$([nm.get]):typeof tv=="function"?l(function(e){return tv(e==null?e:iv(e))},"getDunder"):!1});var sm=T((gK,lv)=>{"use strict";var ov=tm(),av=rm(),cv=sv();lv.exports=ov?l(function(e){return ov(e)},"getProto"):av?l(function(e){if(!e||typeof e!="object"&&typeof e!="function")throw new TypeError("getProto: not an object");return av(e)},"getProto"):cv?l(function(e){return cv(e)},"getProto"):null});var uv=T((_K,fv)=>{"use strict";var S$=Function.prototype.call,v$=Object.prototype.hasOwnProperty,E$=ks();fv.exports=E$.call(S$,v$)});var cm=T((SK,yv)=>{"use strict";var X,F$=Zp(),T$=cS(),k$=fS(),R$=hS(),O$=pS(),As=Qp(),xs=Fs(),x$=yS(),A$=bS(),P$=SS(),N$=ES(),C$=TS(),D$=RS(),I$=xS(),$$=CS(),mv=Function,om=l(function(t){try{return mv('"use strict"; return ('+t+").constructor;")()}catch{}},"getEvalledConstructor"),Fa=Ts(),B$=Ea(),am=l(function(){throw new xs},"throwTypeError"),M$=Fa?function(){try{return arguments.callee,am}catch{try{return Fa(arguments,"callee").get}catch{return am}}}():am,Rs=qS()(),qe=sm(),L$=rm(),j$=tm(),wv=cf(),Ta=af(),Os={},q$=typeof Uint8Array>"u"||!qe?X:qe(Uint8Array),Hi={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?X:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?X:ArrayBuffer,"%ArrayIteratorPrototype%":Rs&&qe?qe([][Symbol.iterator]()):X,"%AsyncFromSyncIteratorPrototype%":X,"%AsyncFunction%":Os,"%AsyncGenerator%":Os,"%AsyncGeneratorFunction%":Os,"%AsyncIteratorPrototype%":Os,"%Atomics%":typeof Atomics>"u"?X:Atomics,"%BigInt%":typeof BigInt>"u"?X:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?X:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?X:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?X:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":T$,"%eval%":eval,"%EvalError%":k$,"%Float16Array%":typeof Float16Array>"u"?X:Float16Array,"%Float32Array%":typeof Float32Array>"u"?X:Float32Array,"%Float64Array%":typeof Float64Array>"u"?X:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?X:FinalizationRegistry,"%Function%":mv,"%GeneratorFunction%":Os,"%Int8Array%":typeof Int8Array>"u"?X:Int8Array,"%Int16Array%":typeof Int16Array>"u"?X:Int16Array,"%Int32Array%":typeof Int32Array>"u"?X:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Rs&&qe?qe(qe([][Symbol.iterator]())):X,"%JSON%":typeof JSON=="object"?JSON:X,"%Map%":typeof Map>"u"?X:Map,"%MapIteratorPrototype%":typeof Map>"u"||!Rs||!qe?X:qe(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":F$,"%Object.getOwnPropertyDescriptor%":Fa,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?X:Promise,"%Proxy%":typeof Proxy>"u"?X:Proxy,"%RangeError%":R$,"%ReferenceError%":O$,"%Reflect%":typeof Reflect>"u"?X:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?X:Set,"%SetIteratorPrototype%":typeof Set>"u"||!Rs||!qe?X:qe(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?X:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Rs&&qe?qe(""[Symbol.iterator]()):X,"%Symbol%":Rs?Symbol:X,"%SyntaxError%":As,"%ThrowTypeError%":M$,"%TypedArray%":q$,"%TypeError%":xs,"%Uint8Array%":typeof Uint8Array>"u"?X:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?X:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?X:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?X:Uint32Array,"%URIError%":x$,"%WeakMap%":typeof WeakMap>"u"?X:WeakMap,"%WeakRef%":typeof WeakRef>"u"?X:WeakRef,"%WeakSet%":typeof WeakSet>"u"?X:WeakSet,"%Function.prototype.call%":Ta,"%Function.prototype.apply%":wv,"%Object.defineProperty%":B$,"%Object.getPrototypeOf%":L$,"%Math.abs%":A$,"%Math.floor%":P$,"%Math.max%":N$,"%Math.min%":C$,"%Math.pow%":D$,"%Math.round%":I$,"%Math.sign%":$$,"%Reflect.getPrototypeOf%":j$};if(qe)try{null.error}catch(t){hv=qe(qe(t)),Hi["%Error.prototype%"]=hv}var hv,U$=l(function t(e){var r;if(e==="%AsyncFunction%")r=om("async function () {}");else if(e==="%GeneratorFunction%")r=om("function* () {}");else if(e==="%AsyncGeneratorFunction%")r=om("async function* () {}");else if(e==="%AsyncGenerator%"){var i=t("%AsyncGeneratorFunction%");i&&(r=i.prototype)}else if(e==="%AsyncIteratorPrototype%"){var n=t("%AsyncGenerator%");n&&qe&&(r=qe(n.prototype))}return Hi[e]=r,r},"doEval"),dv={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},ka=ks(),ff=uv(),W$=ka.call(Ta,Array.prototype.concat),z$=ka.call(wv,Array.prototype.splice),pv=ka.call(Ta,String.prototype.replace),uf=ka.call(Ta,String.prototype.slice),H$=ka.call(Ta,RegExp.prototype.exec),V$=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,G$=/\\(\\)?/g,K$=l(function(e){var r=uf(e,0,1),i=uf(e,-1);if(r==="%"&&i!=="%")throw new As("invalid intrinsic syntax, expected closing `%`");if(i==="%"&&r!=="%")throw new As("invalid intrinsic syntax, expected opening `%`");var n=[];return pv(e,V$,function(s,o,f,c){n[n.length]=f?pv(c,G$,"$1"):o||s}),n},"stringToPath"),J$=l(function(e,r){var i=e,n;if(ff(dv,i)&&(n=dv[i],i="%"+n[0]+"%"),ff(Hi,i)){var s=Hi[i];if(s===Os&&(s=U$(i)),typeof s>"u"&&!r)throw new xs("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:n,name:i,value:s}}throw new As("intrinsic "+e+" does not exist!")},"getBaseIntrinsic");yv.exports=l(function(e,r){if(typeof e!="string"||e.length===0)throw new xs("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof r!="boolean")throw new xs('"allowMissing" argument must be a boolean');if(H$(/^%?[^%]*%?$/,e)===null)throw new As("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var i=K$(e),n=i.length>0?i[0]:"",s=J$("%"+n+"%",r),o=s.name,f=s.value,c=!1,a=s.alias;a&&(n=a[0],z$(i,W$([0,1],a)));for(var u=1,h=!0;u<i.length;u+=1){var d=i[u],p=uf(d,0,1),m=uf(d,-1);if((p==='"'||p==="'"||p==="`"||m==='"'||m==="'"||m==="`")&&p!==m)throw new As("property names with quotes must have matching quotes");if((d==="constructor"||!h)&&(c=!0),n+="."+d,o="%"+n+"%",ff(Hi,o))f=Hi[o];else if(f!=null){if(!(d in f)){if(!r)throw new xs("base intrinsic for "+e+" exists, but the property is not available.");return}if(Fa&&u+1>=i.length){var w=Fa(f,d);h=!!w,h&&"get"in w&&!("originalValue"in w.get)?f=w.get:f=f[d]}else h=ff(f,d),f=f[d];h&&!c&&(Hi[o]=f)}}return f},"GetIntrinsic")});var lm=T((EK,_v)=>{"use strict";var gv=cm(),bv=lf(),X$=bv([gv("%String.prototype.indexOf%")]);_v.exports=l(function(e,r){var i=gv(e,!!r);return typeof i=="function"&&X$(e,".prototype.")>-1?bv([i]):i},"callBoundIntrinsic")});var Fv=T((TK,Ev)=>{"use strict";var vv=Function.prototype.toString,Ps=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,um,hf;if(typeof Ps=="function"&&typeof Object.defineProperty=="function")try{um=Object.defineProperty({},"length",{get:l(function(){throw hf},"get")}),hf={},Ps(function(){throw 42},null,um)}catch(t){t!==hf&&(Ps=null)}else Ps=null;var Y$=/^\s*class\b/,hm=l(function(e){try{var r=vv.call(e);return Y$.test(r)}catch{return!1}},"isES6ClassFunction"),fm=l(function(e){try{return hm(e)?!1:(vv.call(e),!0)}catch{return!1}},"tryFunctionToStr"),df=Object.prototype.toString,Z$="[object Object]",Q$="[object Function]",e2="[object GeneratorFunction]",t2="[object HTMLAllCollection]",r2="[object HTML document.all class]",i2="[object HTMLCollection]",n2=typeof Symbol=="function"&&!!Symbol.toStringTag,s2=!(0 in[,]),dm=l(function(){return!1},"isDocumentDotAll");typeof document=="object"&&(Sv=document.all,df.call(Sv)===df.call(document.all)&&(dm=l(function(e){if((s2||!e)&&(typeof e>"u"||typeof e=="object"))try{var r=df.call(e);return(r===t2||r===r2||r===i2||r===Z$)&&e("")==null}catch{}return!1},"isDocumentDotAll")));var Sv;Ev.exports=l(Ps?function(e){if(dm(e))return!0;if(!e||typeof e!="function"&&typeof e!="object")return!1;try{Ps(e,null,um)}catch(r){if(r!==hf)return!1}return!hm(e)&&fm(e)}:function(e){if(dm(e))return!0;if(!e||typeof e!="function"&&typeof e!="object")return!1;if(n2)return fm(e);if(hm(e))return!1;var r=df.call(e);return r!==Q$&&r!==e2&&!/^\[object HTML/.test(r)?!1:fm(e)},"isCallable")});var Rv=T((RK,kv)=>{"use strict";var o2=Fv(),a2=Object.prototype.toString,Tv=Object.prototype.hasOwnProperty,c2=l(function(e,r,i){for(var n=0,s=e.length;n<s;n++)Tv.call(e,n)&&(i==null?r(e[n],n,e):r.call(i,e[n],n,e))},"forEachArray"),l2=l(function(e,r,i){for(var n=0,s=e.length;n<s;n++)i==null?r(e.charAt(n),n,e):r.call(i,e.charAt(n),n,e)},"forEachString"),f2=l(function(e,r,i){for(var n in e)Tv.call(e,n)&&(i==null?r(e[n],n,e):r.call(i,e[n],n,e))},"forEachObject");function u2(t){return a2.call(t)==="[object Array]"}l(u2,"isArray");kv.exports=l(function(e,r,i){if(!o2(r))throw new TypeError("iterator must be a function");var n;arguments.length>=3&&(n=i),u2(e)?c2(e,r,n):typeof e=="string"?l2(e,r,n):f2(e,r,n)},"forEach")});var xv=T((xK,Ov)=>{"use strict";Ov.exports=["Float16Array","Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"]});var Pv=T((AK,Av)=>{"use strict";var pm=xv(),h2=globalThis;Av.exports=l(function(){for(var e=[],r=0;r<pm.length;r++)typeof h2[pm[r]]=="function"&&(e[e.length]=pm[r]);return e},"availableTypedArrays")});var Iv=T((NK,Dv)=>{"use strict";var Nv=Ea(),d2=Qp(),Ns=Fs(),Cv=Ts();Dv.exports=l(function(e,r,i){if(!e||typeof e!="object"&&typeof e!="function")throw new Ns("`obj` must be an object or a function`");if(typeof r!="string"&&typeof r!="symbol")throw new Ns("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new Ns("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new Ns("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new Ns("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new Ns("`loose`, if provided, must be a boolean");var n=arguments.length>3?arguments[3]:null,s=arguments.length>4?arguments[4]:null,o=arguments.length>5?arguments[5]:null,f=arguments.length>6?arguments[6]:!1,c=!!Cv&&Cv(e,r);if(Nv)Nv(e,r,{configurable:o===null&&c?c.configurable:!o,enumerable:n===null&&c?c.enumerable:!n,value:i,writable:s===null&&c?c.writable:!s});else if(f||!n&&!s&&!o)e[r]=i;else throw new d2("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},"defineDataProperty")});var Mv=T((DK,Bv)=>{"use strict";var mm=Ea(),$v=l(function(){return!!mm},"hasPropertyDescriptors");$v.hasArrayLengthDefineBug=l(function(){if(!mm)return null;try{return mm([],"length",{value:1}).length!==1}catch{return!0}},"hasArrayLengthDefineBug");Bv.exports=$v});var Wv=T(($K,Uv)=>{"use strict";var p2=cm(),Lv=Iv(),m2=Mv()(),jv=Ts(),qv=Fs(),w2=p2("%Math.floor%");Uv.exports=l(function(e,r){if(typeof e!="function")throw new qv("`fn` is not a function");if(typeof r!="number"||r<0||r>4294967295||w2(r)!==r)throw new qv("`length` must be a positive 32-bit integer");var i=arguments.length>2&&!!arguments[2],n=!0,s=!0;if("length"in e&&jv){var o=jv(e,"length");o&&!o.configurable&&(n=!1),o&&!o.writable&&(s=!1)}return(n||s||!i)&&(m2?Lv(e,"length",r,!0,!0):Lv(e,"length",r)),e},"setFunctionLength")});var Hv=T((MK,zv)=>{"use strict";var y2=ks(),g2=cf(),b2=im();zv.exports=l(function(){return b2(y2,g2,arguments)},"applyBind")});var Kv=T((jK,pf)=>{"use strict";var _2=Wv(),Vv=Ea(),S2=lf(),Gv=Hv();pf.exports=l(function(e){var r=S2(arguments),i=e.length-(arguments.length-1);return _2(r,1+(i>0?i:0),!0)},"callBind");Vv?Vv(pf.exports,"apply",{value:Gv}):pf.exports.apply=Gv});var Xv=T((UK,Jv)=>{"use strict";var v2=em();Jv.exports=l(function(){return v2()&&!!Symbol.toStringTag},"hasToStringTagShams")});var tE=T((zK,eE)=>{"use strict";var yf=Rv(),E2=Pv(),Yv=Kv(),ym=lm(),wf=Ts(),mf=sm(),F2=ym("Object.prototype.toString"),Qv=Xv()(),Zv=globalThis,wm=E2(),gm=ym("String.prototype.slice"),T2=ym("Array.prototype.indexOf",!0)||l(function(e,r){for(var i=0;i<e.length;i+=1)if(e[i]===r)return i;return-1},"indexOf"),gf={__proto__:null};Qv&&wf&&mf?yf(wm,function(t){var e=new Zv[t];if(Symbol.toStringTag in e&&mf){var r=mf(e),i=wf(r,Symbol.toStringTag);if(!i&&r){var n=mf(r);i=wf(n,Symbol.toStringTag)}gf["$"+t]=Yv(i.get)}}):yf(wm,function(t){var e=new Zv[t],r=e.slice||e.set;r&&(gf["$"+t]=Yv(r))});var k2=l(function(e){var r=!1;return yf(gf,function(i,n){if(!r)try{"$"+i(e)===n&&(r=gm(n,1))}catch{}}),r},"tryAllTypedArrays"),R2=l(function(e){var r=!1;return yf(gf,function(i,n){if(!r)try{i(e),r=gm(n,1)}catch{}}),r},"tryAllSlices");eE.exports=l(function(e){if(!e||typeof e!="object")return!1;if(!Qv){var r=gm(F2(e),8,-1);return T2(wm,r)>-1?r:r!=="Object"?!1:R2(e)}return wf?k2(e):null},"whichTypedArray")});var iE=T((VK,rE)=>{"use strict";var O2=tE();rE.exports=l(function(e){return!!O2(e)},"isTypedArray")});var sE=T((KK,nE)=>{"use strict";var x2=Fs(),A2=lm(),P2=A2("TypedArray.prototype.buffer",!0),N2=iE();nE.exports=P2||l(function(e){if(!N2(e))throw new x2("Not a Typed Array");return e.buffer},"typedArrayBuffer")});var cE=T((XK,aE)=>{"use strict";var Jt=va().Buffer,C2=nS(),D2=sE(),I2=ArrayBuffer.isView||l(function(e){try{return D2(e),!0}catch{return!1}},"isView"),$2=typeof Uint8Array<"u",oE=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u",B2=oE&&(Jt.prototype instanceof Uint8Array||Jt.TYPED_ARRAY_SUPPORT);aE.exports=l(function(e,r){if(Jt.isBuffer(e))return e.constructor&&!("isBuffer"in e)?Jt.from(e):e;if(typeof e=="string")return Jt.from(e,r);if(oE&&I2(e)){if(e.byteLength===0)return Jt.alloc(0);if(B2){var i=Jt.from(e.buffer,e.byteOffset,e.byteLength);if(i.byteLength===e.byteLength)return i}var n=e instanceof Uint8Array?e:new Uint8Array(e.buffer,e.byteOffset,e.byteLength),s=Jt.from(n);if(s.length===e.byteLength)return s}if($2&&e instanceof Uint8Array)return Jt.from(e);var o=C2(e);if(o)for(var f=0;f<e.length;f+=1){var c=e[f];if(typeof c!="number"||c<0||c>255||~~c!==c)throw new RangeError("Array items must be numbers in the range 0-255.")}if(o||Jt.isBuffer(e)&&e.constructor&&typeof e.constructor.isBuffer=="function"&&e.constructor.isBuffer(e))return Jt.from(e);throw new TypeError('The "data" argument must be a string, an Array, a Buffer, a Uint8Array, or a DataView.')},"toBuffer")});var fE=T((ZK,lE)=>{"use strict";var M2=va().Buffer,L2=cE();function bf(t,e){this._block=M2.alloc(t),this._finalSize=e,this._blockSize=t,this._len=0}l(bf,"Hash");bf.prototype.update=function(t,e){t=L2(t,e||"utf8");for(var r=this._block,i=this._blockSize,n=t.length,s=this._len,o=0;o<n;){for(var f=s%i,c=Math.min(n-o,i-f),a=0;a<c;a++)r[f+a]=t[o+a];s+=c,o+=c,s%i===0&&this._update(r)}return this._len+=n,this};bf.prototype.digest=function(t){var e=this._len%this._blockSize;this._block[e]=128,this._block.fill(0,e+1),e>=this._finalSize&&(this._update(this._block),this._block.fill(0));var r=this._len*8;if(r<=4294967295)this._block.writeUInt32BE(r,this._blockSize-4);else{var i=(r&4294967295)>>>0,n=(r-i)/4294967296;this._block.writeUInt32BE(n,this._blockSize-8),this._block.writeUInt32BE(i,this._blockSize-4)}this._update(this._block);var s=this._hash();return t?s.toString(t):s};bf.prototype._update=function(){throw new Error("_update must be implemented by subclass")};lE.exports=bf});var dE=T((eJ,hE)=>{"use strict";var j2=eS(),uE=fE(),q2=va().Buffer,U2=[1518500249,1859775393,-1894007588,-899497514],W2=new Array(80);function Ra(){this.init(),this._w=W2,uE.call(this,64,56)}l(Ra,"Sha1");j2(Ra,uE);Ra.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function z2(t){return t<<1|t>>>31}l(z2,"rotl1");function H2(t){return t<<5|t>>>27}l(H2,"rotl5");function V2(t){return t<<30|t>>>2}l(V2,"rotl30");function G2(t,e,r,i){return t===0?e&r|~e&i:t===2?e&r|e&i|r&i:e^r^i}l(G2,"ft");Ra.prototype._update=function(t){for(var e=this._w,r=this._a|0,i=this._b|0,n=this._c|0,s=this._d|0,o=this._e|0,f=0;f<16;++f)e[f]=t.readInt32BE(f*4);for(;f<80;++f)e[f]=z2(e[f-3]^e[f-8]^e[f-14]^e[f-16]);for(var c=0;c<80;++c){var a=~~(c/20),u=H2(r)+G2(a,i,n,s)+o+e[c]+U2[a]|0;o=s,s=n,n=V2(i),i=r,r=u}this._a=r+this._a|0,this._b=i+this._b|0,this._c=n+this._c|0,this._d=s+this._d|0,this._e=o+this._e|0};Ra.prototype._hash=function(){var t=q2.allocUnsafe(20);return t.writeInt32BE(this._a|0,0),t.writeInt32BE(this._b|0,4),t.writeInt32BE(this._c|0,8),t.writeInt32BE(this._d|0,12),t.writeInt32BE(this._e|0,16),t};hE.exports=Ra});var mE=T(bm=>{var pE;(function(t){typeof DO_NOT_EXPORT_CRC>"u"?typeof bm=="object"?t(bm):typeof define=="function"&&define.amd?define(function(){var e={};return t(e),e}):t(pE={}):t(pE={})})(function(t){t.version="1.2.2";function e(){for(var S=0,O=new Array(256),v=0;v!=256;++v)S=v,S=S&1?-306674912^S>>>1:S>>>1,S=S&1?-306674912^S>>>1:S>>>1,S=S&1?-306674912^S>>>1:S>>>1,S=S&1?-306674912^S>>>1:S>>>1,S=S&1?-306674912^S>>>1:S>>>1,S=S&1?-306674912^S>>>1:S>>>1,S=S&1?-306674912^S>>>1:S>>>1,S=S&1?-306674912^S>>>1:S>>>1,O[v]=S;return typeof Int32Array<"u"?new Int32Array(O):O}l(e,"signed_crc_table");var r=e();function i(S){var O=0,v=0,A=0,x=typeof Int32Array<"u"?new Int32Array(4096):new Array(4096);for(A=0;A!=256;++A)x[A]=S[A];for(A=0;A!=256;++A)for(v=S[A],O=256+A;O<4096;O+=256)v=x[O]=v>>>8^S[v&255];var I=[];for(A=1;A!=16;++A)I[A-1]=typeof Int32Array<"u"?x.subarray(A*256,A*256+256):x.slice(A*256,A*256+256);return I}l(i,"slice_by_16_tables");var n=i(r),s=n[0],o=n[1],f=n[2],c=n[3],a=n[4],u=n[5],h=n[6],d=n[7],p=n[8],m=n[9],w=n[10],y=n[11],g=n[12],_=n[13],F=n[14];function E(S,O){for(var v=O^-1,A=0,x=S.length;A<x;)v=v>>>8^r[(v^S.charCodeAt(A++))&255];return~v}l(E,"crc32_bstr");function R(S,O){for(var v=O^-1,A=S.length-15,x=0;x<A;)v=F[S[x++]^v&255]^_[S[x++]^v>>8&255]^g[S[x++]^v>>16&255]^y[S[x++]^v>>>24]^w[S[x++]]^m[S[x++]]^p[S[x++]]^d[S[x++]]^h[S[x++]]^u[S[x++]]^a[S[x++]]^c[S[x++]]^f[S[x++]]^o[S[x++]]^s[S[x++]]^r[S[x++]];for(A+=15;x<A;)v=v>>>8^r[(v^S[x++])&255];return~v}l(R,"crc32_buf");function P(S,O){for(var v=O^-1,A=0,x=S.length,I=0,M=0;A<x;)I=S.charCodeAt(A++),I<128?v=v>>>8^r[(v^I)&255]:I<2048?(v=v>>>8^r[(v^(192|I>>6&31))&255],v=v>>>8^r[(v^(128|I&63))&255]):I>=55296&&I<57344?(I=(I&1023)+64,M=S.charCodeAt(A++)&1023,v=v>>>8^r[(v^(240|I>>8&7))&255],v=v>>>8^r[(v^(128|I>>2&63))&255],v=v>>>8^r[(v^(128|M>>6&15|(I&3)<<4))&255],v=v>>>8^r[(v^(128|M&63))&255]):(v=v>>>8^r[(v^(224|I>>12&15))&255],v=v>>>8^r[(v^(128|I>>6&63))&255],v=v>>>8^r[(v^(128|I&63))&255]);return~v}l(P,"crc32_str"),t.table=r,t.bstr=E,t.buf=R,t.str=P})});var Ar=T(lt=>{"use strict";var K2=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";function J2(t,e){return Object.prototype.hasOwnProperty.call(t,e)}l(J2,"_has");lt.assign=function(t){for(var e=Array.prototype.slice.call(arguments,1);e.length;){var r=e.shift();if(r){if(typeof r!="object")throw new TypeError(r+"must be non-object");for(var i in r)J2(r,i)&&(t[i]=r[i])}}return t};lt.shrinkBuf=function(t,e){return t.length===e?t:t.subarray?t.subarray(0,e):(t.length=e,t)};var X2={arraySet:l(function(t,e,r,i,n){if(e.subarray&&t.subarray){t.set(e.subarray(r,r+i),n);return}for(var s=0;s<i;s++)t[n+s]=e[r+s]},"arraySet"),flattenChunks:l(function(t){var e,r,i,n,s,o;for(i=0,e=0,r=t.length;e<r;e++)i+=t[e].length;for(o=new Uint8Array(i),n=0,e=0,r=t.length;e<r;e++)s=t[e],o.set(s,n),n+=s.length;return o},"flattenChunks")},Y2={arraySet:l(function(t,e,r,i,n){for(var s=0;s<i;s++)t[n+s]=e[r+s]},"arraySet"),flattenChunks:l(function(t){return[].concat.apply([],t)},"flattenChunks")};lt.setTyped=function(t){t?(lt.Buf8=Uint8Array,lt.Buf16=Uint16Array,lt.Buf32=Int32Array,lt.assign(lt,X2)):(lt.Buf8=Array,lt.Buf16=Array,lt.Buf32=Array,lt.assign(lt,Y2))};lt.setTyped(K2)});var ME=T(Is=>{"use strict";var Z2=Ar(),Q2=4,wE=0,yE=1,eB=2;function Ds(t){for(var e=t.length;--e>=0;)t[e]=0}l(Ds,"zero");var tB=0,EE=1,rB=2,iB=3,nB=258,km=29,Ca=256,xa=Ca+1+km,Cs=30,Rm=19,FE=2*xa+1,Vi=15,_m=16,sB=7,Om=256,TE=16,kE=17,RE=18,Fm=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],_f=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],oB=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],OE=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],aB=512,Pr=new Array((xa+2)*2);Ds(Pr);var Oa=new Array(Cs*2);Ds(Oa);var Aa=new Array(aB);Ds(Aa);var Pa=new Array(nB-iB+1);Ds(Pa);var xm=new Array(km);Ds(xm);var Sf=new Array(Cs);Ds(Sf);function Sm(t,e,r,i,n){this.static_tree=t,this.extra_bits=e,this.extra_base=r,this.elems=i,this.max_length=n,this.has_stree=t&&t.length}l(Sm,"StaticTreeDesc");var xE,AE,PE;function vm(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e}l(vm,"TreeDesc");function NE(t){return t<256?Aa[t]:Aa[256+(t>>>7)]}l(NE,"d_code");function Na(t,e){t.pending_buf[t.pending++]=e&255,t.pending_buf[t.pending++]=e>>>8&255}l(Na,"put_short");function mt(t,e,r){t.bi_valid>_m-r?(t.bi_buf|=e<<t.bi_valid&65535,Na(t,t.bi_buf),t.bi_buf=e>>_m-t.bi_valid,t.bi_valid+=r-_m):(t.bi_buf|=e<<t.bi_valid&65535,t.bi_valid+=r)}l(mt,"send_bits");function fr(t,e,r){mt(t,r[e*2],r[e*2+1])}l(fr,"send_code");function CE(t,e){var r=0;do r|=t&1,t>>>=1,r<<=1;while(--e>0);return r>>>1}l(CE,"bi_reverse");function cB(t){t.bi_valid===16?(Na(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):t.bi_valid>=8&&(t.pending_buf[t.pending++]=t.bi_buf&255,t.bi_buf>>=8,t.bi_valid-=8)}l(cB,"bi_flush");function lB(t,e){var r=e.dyn_tree,i=e.max_code,n=e.stat_desc.static_tree,s=e.stat_desc.has_stree,o=e.stat_desc.extra_bits,f=e.stat_desc.extra_base,c=e.stat_desc.max_length,a,u,h,d,p,m,w=0;for(d=0;d<=Vi;d++)t.bl_count[d]=0;for(r[t.heap[t.heap_max]*2+1]=0,a=t.heap_max+1;a<FE;a++)u=t.heap[a],d=r[r[u*2+1]*2+1]+1,d>c&&(d=c,w++),r[u*2+1]=d,!(u>i)&&(t.bl_count[d]++,p=0,u>=f&&(p=o[u-f]),m=r[u*2],t.opt_len+=m*(d+p),s&&(t.static_len+=m*(n[u*2+1]+p)));if(w!==0){do{for(d=c-1;t.bl_count[d]===0;)d--;t.bl_count[d]--,t.bl_count[d+1]+=2,t.bl_count[c]--,w-=2}while(w>0);for(d=c;d!==0;d--)for(u=t.bl_count[d];u!==0;)h=t.heap[--a],!(h>i)&&(r[h*2+1]!==d&&(t.opt_len+=(d-r[h*2+1])*r[h*2],r[h*2+1]=d),u--)}}l(lB,"gen_bitlen");function DE(t,e,r){var i=new Array(Vi+1),n=0,s,o;for(s=1;s<=Vi;s++)i[s]=n=n+r[s-1]<<1;for(o=0;o<=e;o++){var f=t[o*2+1];f!==0&&(t[o*2]=CE(i[f]++,f))}}l(DE,"gen_codes");function fB(){var t,e,r,i,n,s=new Array(Vi+1);for(r=0,i=0;i<km-1;i++)for(xm[i]=r,t=0;t<1<<Fm[i];t++)Pa[r++]=i;for(Pa[r-1]=i,n=0,i=0;i<16;i++)for(Sf[i]=n,t=0;t<1<<_f[i];t++)Aa[n++]=i;for(n>>=7;i<Cs;i++)for(Sf[i]=n<<7,t=0;t<1<<_f[i]-7;t++)Aa[256+n++]=i;for(e=0;e<=Vi;e++)s[e]=0;for(t=0;t<=143;)Pr[t*2+1]=8,t++,s[8]++;for(;t<=255;)Pr[t*2+1]=9,t++,s[9]++;for(;t<=279;)Pr[t*2+1]=7,t++,s[7]++;for(;t<=287;)Pr[t*2+1]=8,t++,s[8]++;for(DE(Pr,xa+1,s),t=0;t<Cs;t++)Oa[t*2+1]=5,Oa[t*2]=CE(t,5);xE=new Sm(Pr,Fm,Ca+1,xa,Vi),AE=new Sm(Oa,_f,0,Cs,Vi),PE=new Sm(new Array(0),oB,0,Rm,sB)}l(fB,"tr_static_init");function IE(t){var e;for(e=0;e<xa;e++)t.dyn_ltree[e*2]=0;for(e=0;e<Cs;e++)t.dyn_dtree[e*2]=0;for(e=0;e<Rm;e++)t.bl_tree[e*2]=0;t.dyn_ltree[Om*2]=1,t.opt_len=t.static_len=0,t.last_lit=t.matches=0}l(IE,"init_block");function $E(t){t.bi_valid>8?Na(t,t.bi_buf):t.bi_valid>0&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0}l($E,"bi_windup");function uB(t,e,r,i){$E(t),i&&(Na(t,r),Na(t,~r)),Z2.arraySet(t.pending_buf,t.window,e,r,t.pending),t.pending+=r}l(uB,"copy_block");function gE(t,e,r,i){var n=e*2,s=r*2;return t[n]<t[s]||t[n]===t[s]&&i[e]<=i[r]}l(gE,"smaller");function Em(t,e,r){for(var i=t.heap[r],n=r<<1;n<=t.heap_len&&(n<t.heap_len&&gE(e,t.heap[n+1],t.heap[n],t.depth)&&n++,!gE(e,i,t.heap[n],t.depth));)t.heap[r]=t.heap[n],r=n,n<<=1;t.heap[r]=i}l(Em,"pqdownheap");function bE(t,e,r){var i,n,s=0,o,f;if(t.last_lit!==0)do i=t.pending_buf[t.d_buf+s*2]<<8|t.pending_buf[t.d_buf+s*2+1],n=t.pending_buf[t.l_buf+s],s++,i===0?fr(t,n,e):(o=Pa[n],fr(t,o+Ca+1,e),f=Fm[o],f!==0&&(n-=xm[o],mt(t,n,f)),i--,o=NE(i),fr(t,o,r),f=_f[o],f!==0&&(i-=Sf[o],mt(t,i,f)));while(s<t.last_lit);fr(t,Om,e)}l(bE,"compress_block");function Tm(t,e){var r=e.dyn_tree,i=e.stat_desc.static_tree,n=e.stat_desc.has_stree,s=e.stat_desc.elems,o,f,c=-1,a;for(t.heap_len=0,t.heap_max=FE,o=0;o<s;o++)r[o*2]!==0?(t.heap[++t.heap_len]=c=o,t.depth[o]=0):r[o*2+1]=0;for(;t.heap_len<2;)a=t.heap[++t.heap_len]=c<2?++c:0,r[a*2]=1,t.depth[a]=0,t.opt_len--,n&&(t.static_len-=i[a*2+1]);for(e.max_code=c,o=t.heap_len>>1;o>=1;o--)Em(t,r,o);a=s;do o=t.heap[1],t.heap[1]=t.heap[t.heap_len--],Em(t,r,1),f=t.heap[1],t.heap[--t.heap_max]=o,t.heap[--t.heap_max]=f,r[a*2]=r[o*2]+r[f*2],t.depth[a]=(t.depth[o]>=t.depth[f]?t.depth[o]:t.depth[f])+1,r[o*2+1]=r[f*2+1]=a,t.heap[1]=a++,Em(t,r,1);while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],lB(t,e),DE(r,c,t.bl_count)}l(Tm,"build_tree");function _E(t,e,r){var i,n=-1,s,o=e[0*2+1],f=0,c=7,a=4;for(o===0&&(c=138,a=3),e[(r+1)*2+1]=65535,i=0;i<=r;i++)s=o,o=e[(i+1)*2+1],!(++f<c&&s===o)&&(f<a?t.bl_tree[s*2]+=f:s!==0?(s!==n&&t.bl_tree[s*2]++,t.bl_tree[TE*2]++):f<=10?t.bl_tree[kE*2]++:t.bl_tree[RE*2]++,f=0,n=s,o===0?(c=138,a=3):s===o?(c=6,a=3):(c=7,a=4))}l(_E,"scan_tree");function SE(t,e,r){var i,n=-1,s,o=e[0*2+1],f=0,c=7,a=4;for(o===0&&(c=138,a=3),i=0;i<=r;i++)if(s=o,o=e[(i+1)*2+1],!(++f<c&&s===o)){if(f<a)do fr(t,s,t.bl_tree);while(--f!==0);else s!==0?(s!==n&&(fr(t,s,t.bl_tree),f--),fr(t,TE,t.bl_tree),mt(t,f-3,2)):f<=10?(fr(t,kE,t.bl_tree),mt(t,f-3,3)):(fr(t,RE,t.bl_tree),mt(t,f-11,7));f=0,n=s,o===0?(c=138,a=3):s===o?(c=6,a=3):(c=7,a=4)}}l(SE,"send_tree");function hB(t){var e;for(_E(t,t.dyn_ltree,t.l_desc.max_code),_E(t,t.dyn_dtree,t.d_desc.max_code),Tm(t,t.bl_desc),e=Rm-1;e>=3&&t.bl_tree[OE[e]*2+1]===0;e--);return t.opt_len+=3*(e+1)+5+5+4,e}l(hB,"build_bl_tree");function dB(t,e,r,i){var n;for(mt(t,e-257,5),mt(t,r-1,5),mt(t,i-4,4),n=0;n<i;n++)mt(t,t.bl_tree[OE[n]*2+1],3);SE(t,t.dyn_ltree,e-1),SE(t,t.dyn_dtree,r-1)}l(dB,"send_all_trees");function pB(t){var e=4093624447,r;for(r=0;r<=31;r++,e>>>=1)if(e&1&&t.dyn_ltree[r*2]!==0)return wE;if(t.dyn_ltree[9*2]!==0||t.dyn_ltree[10*2]!==0||t.dyn_ltree[13*2]!==0)return yE;for(r=32;r<Ca;r++)if(t.dyn_ltree[r*2]!==0)return yE;return wE}l(pB,"detect_data_type");var vE=!1;function mB(t){vE||(fB(),vE=!0),t.l_desc=new vm(t.dyn_ltree,xE),t.d_desc=new vm(t.dyn_dtree,AE),t.bl_desc=new vm(t.bl_tree,PE),t.bi_buf=0,t.bi_valid=0,IE(t)}l(mB,"_tr_init");function BE(t,e,r,i){mt(t,(tB<<1)+(i?1:0),3),uB(t,e,r,!0)}l(BE,"_tr_stored_block");function wB(t){mt(t,EE<<1,3),fr(t,Om,Pr),cB(t)}l(wB,"_tr_align");function yB(t,e,r,i){var n,s,o=0;t.level>0?(t.strm.data_type===eB&&(t.strm.data_type=pB(t)),Tm(t,t.l_desc),Tm(t,t.d_desc),o=hB(t),n=t.opt_len+3+7>>>3,s=t.static_len+3+7>>>3,s<=n&&(n=s)):n=s=r+5,r+4<=n&&e!==-1?BE(t,e,r,i):t.strategy===Q2||s===n?(mt(t,(EE<<1)+(i?1:0),3),bE(t,Pr,Oa)):(mt(t,(rB<<1)+(i?1:0),3),dB(t,t.l_desc.max_code+1,t.d_desc.max_code+1,o+1),bE(t,t.dyn_ltree,t.dyn_dtree)),IE(t),i&&$E(t)}l(yB,"_tr_flush_block");function gB(t,e,r){return t.pending_buf[t.d_buf+t.last_lit*2]=e>>>8&255,t.pending_buf[t.d_buf+t.last_lit*2+1]=e&255,t.pending_buf[t.l_buf+t.last_lit]=r&255,t.last_lit++,e===0?t.dyn_ltree[r*2]++:(t.matches++,e--,t.dyn_ltree[(Pa[r]+Ca+1)*2]++,t.dyn_dtree[NE(e)*2]++),t.last_lit===t.lit_bufsize-1}l(gB,"_tr_tally");Is._tr_init=mB;Is._tr_stored_block=BE;Is._tr_flush_block=yB;Is._tr_tally=gB;Is._tr_align=wB});var Am=T((cJ,LE)=>{"use strict";function bB(t,e,r,i){for(var n=t&65535|0,s=t>>>16&65535|0,o=0;r!==0;){o=r>2e3?2e3:r,r-=o;do n=n+e[i++]|0,s=s+n|0;while(--o);n%=65521,s%=65521}return n|s<<16|0}l(bB,"adler32");LE.exports=bB});var Pm=T((fJ,jE)=>{"use strict";function _B(){for(var t,e=[],r=0;r<256;r++){t=r;for(var i=0;i<8;i++)t=t&1?3988292384^t>>>1:t>>>1;e[r]=t}return e}l(_B,"makeTable");var SB=_B();function vB(t,e,r,i){var n=SB,s=i+r;t^=-1;for(var o=i;o<s;o++)t=t>>>8^n[(t^e[o])&255];return t^-1}l(vB,"crc32");jE.exports=vB});var vf=T((hJ,qE)=>{"use strict";qE.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}});var XE=T(dr=>{"use strict";var ft=Ar(),Mt=ME(),HE=Am(),ei=Pm(),EB=vf(),Xi=0,FB=1,TB=3,si=4,UE=5,hr=0,WE=1,Lt=-2,kB=-3,Nm=-5,RB=-1,OB=1,Ef=2,xB=3,AB=4,PB=0,NB=2,Rf=8,CB=9,DB=15,IB=8,$B=29,BB=256,Dm=BB+1+$B,MB=30,LB=19,jB=2*Dm+1,qB=15,Q=3,ii=258,Xt=ii+Q+1,UB=32,Of=42,Im=69,Ff=73,Tf=91,kf=103,Gi=113,Ia=666,De=1,$a=2,Ki=3,Ms=4,WB=3;function ni(t,e){return t.msg=EB[e],e}l(ni,"err");function zE(t){return(t<<1)-(t>4?9:0)}l(zE,"rank");function ri(t){for(var e=t.length;--e>=0;)t[e]=0}l(ri,"zero");function ti(t){var e=t.state,r=e.pending;r>t.avail_out&&(r=t.avail_out),r!==0&&(ft.arraySet(t.output,e.pending_buf,e.pending_out,r,t.next_out),t.next_out+=r,e.pending_out+=r,t.total_out+=r,t.avail_out-=r,e.pending-=r,e.pending===0&&(e.pending_out=0))}l(ti,"flush_pending");function Ke(t,e){Mt._tr_flush_block(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,ti(t.strm)}l(Ke,"flush_block_only");function oe(t,e){t.pending_buf[t.pending++]=e}l(oe,"put_byte");function Da(t,e){t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=e&255}l(Da,"putShortMSB");function zB(t,e,r,i){var n=t.avail_in;return n>i&&(n=i),n===0?0:(t.avail_in-=n,ft.arraySet(e,t.input,t.next_in,n,r),t.state.wrap===1?t.adler=HE(t.adler,e,n,r):t.state.wrap===2&&(t.adler=ei(t.adler,e,n,r)),t.next_in+=n,t.total_in+=n,n)}l(zB,"read_buf");function VE(t,e){var r=t.max_chain_length,i=t.strstart,n,s,o=t.prev_length,f=t.nice_match,c=t.strstart>t.w_size-Xt?t.strstart-(t.w_size-Xt):0,a=t.window,u=t.w_mask,h=t.prev,d=t.strstart+ii,p=a[i+o-1],m=a[i+o];t.prev_length>=t.good_match&&(r>>=2),f>t.lookahead&&(f=t.lookahead);do if(n=e,!(a[n+o]!==m||a[n+o-1]!==p||a[n]!==a[i]||a[++n]!==a[i+1])){i+=2,n++;do;while(a[++i]===a[++n]&&a[++i]===a[++n]&&a[++i]===a[++n]&&a[++i]===a[++n]&&a[++i]===a[++n]&&a[++i]===a[++n]&&a[++i]===a[++n]&&a[++i]===a[++n]&&i<d);if(s=ii-(d-i),i=d-ii,s>o){if(t.match_start=e,o=s,s>=f)break;p=a[i+o-1],m=a[i+o]}}while((e=h[e&u])>c&&--r!==0);return o<=t.lookahead?o:t.lookahead}l(VE,"longest_match");function Ji(t){var e=t.w_size,r,i,n,s,o;do{if(s=t.window_size-t.lookahead-t.strstart,t.strstart>=e+(e-Xt)){ft.arraySet(t.window,t.window,e,e,0),t.match_start-=e,t.strstart-=e,t.block_start-=e,i=t.hash_size,r=i;do n=t.head[--r],t.head[r]=n>=e?n-e:0;while(--i);i=e,r=i;do n=t.prev[--r],t.prev[r]=n>=e?n-e:0;while(--i);s+=e}if(t.strm.avail_in===0)break;if(i=zB(t.strm,t.window,t.strstart+t.lookahead,s),t.lookahead+=i,t.lookahead+t.insert>=Q)for(o=t.strstart-t.insert,t.ins_h=t.window[o],t.ins_h=(t.ins_h<<t.hash_shift^t.window[o+1])&t.hash_mask;t.insert&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[o+Q-1])&t.hash_mask,t.prev[o&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=o,o++,t.insert--,!(t.lookahead+t.insert<Q)););}while(t.lookahead<Xt&&t.strm.avail_in!==0)}l(Ji,"fill_window");function HB(t,e){var r=65535;for(r>t.pending_buf_size-5&&(r=t.pending_buf_size-5);;){if(t.lookahead<=1){if(Ji(t),t.lookahead===0&&e===Xi)return De;if(t.lookahead===0)break}t.strstart+=t.lookahead,t.lookahead=0;var i=t.block_start+r;if((t.strstart===0||t.strstart>=i)&&(t.lookahead=t.strstart-i,t.strstart=i,Ke(t,!1),t.strm.avail_out===0)||t.strstart-t.block_start>=t.w_size-Xt&&(Ke(t,!1),t.strm.avail_out===0))return De}return t.insert=0,e===si?(Ke(t,!0),t.strm.avail_out===0?Ki:Ms):(t.strstart>t.block_start&&(Ke(t,!1),t.strm.avail_out===0),De)}l(HB,"deflate_stored");function Cm(t,e){for(var r,i;;){if(t.lookahead<Xt){if(Ji(t),t.lookahead<Xt&&e===Xi)return De;if(t.lookahead===0)break}if(r=0,t.lookahead>=Q&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+Q-1])&t.hash_mask,r=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),r!==0&&t.strstart-r<=t.w_size-Xt&&(t.match_length=VE(t,r)),t.match_length>=Q)if(i=Mt._tr_tally(t,t.strstart-t.match_start,t.match_length-Q),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=Q){t.match_length--;do t.strstart++,t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+Q-1])&t.hash_mask,r=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart;while(--t.match_length!==0);t.strstart++}else t.strstart+=t.match_length,t.match_length=0,t.ins_h=t.window[t.strstart],t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+1])&t.hash_mask;else i=Mt._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++;if(i&&(Ke(t,!1),t.strm.avail_out===0))return De}return t.insert=t.strstart<Q-1?t.strstart:Q-1,e===si?(Ke(t,!0),t.strm.avail_out===0?Ki:Ms):t.last_lit&&(Ke(t,!1),t.strm.avail_out===0)?De:$a}l(Cm,"deflate_fast");function $s(t,e){for(var r,i,n;;){if(t.lookahead<Xt){if(Ji(t),t.lookahead<Xt&&e===Xi)return De;if(t.lookahead===0)break}if(r=0,t.lookahead>=Q&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+Q-1])&t.hash_mask,r=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),t.prev_length=t.match_length,t.prev_match=t.match_start,t.match_length=Q-1,r!==0&&t.prev_length<t.max_lazy_match&&t.strstart-r<=t.w_size-Xt&&(t.match_length=VE(t,r),t.match_length<=5&&(t.strategy===OB||t.match_length===Q&&t.strstart-t.match_start>4096)&&(t.match_length=Q-1)),t.prev_length>=Q&&t.match_length<=t.prev_length){n=t.strstart+t.lookahead-Q,i=Mt._tr_tally(t,t.strstart-1-t.prev_match,t.prev_length-Q),t.lookahead-=t.prev_length-1,t.prev_length-=2;do++t.strstart<=n&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+Q-1])&t.hash_mask,r=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart);while(--t.prev_length!==0);if(t.match_available=0,t.match_length=Q-1,t.strstart++,i&&(Ke(t,!1),t.strm.avail_out===0))return De}else if(t.match_available){if(i=Mt._tr_tally(t,0,t.window[t.strstart-1]),i&&Ke(t,!1),t.strstart++,t.lookahead--,t.strm.avail_out===0)return De}else t.match_available=1,t.strstart++,t.lookahead--}return t.match_available&&(i=Mt._tr_tally(t,0,t.window[t.strstart-1]),t.match_available=0),t.insert=t.strstart<Q-1?t.strstart:Q-1,e===si?(Ke(t,!0),t.strm.avail_out===0?Ki:Ms):t.last_lit&&(Ke(t,!1),t.strm.avail_out===0)?De:$a}l($s,"deflate_slow");function VB(t,e){for(var r,i,n,s,o=t.window;;){if(t.lookahead<=ii){if(Ji(t),t.lookahead<=ii&&e===Xi)return De;if(t.lookahead===0)break}if(t.match_length=0,t.lookahead>=Q&&t.strstart>0&&(n=t.strstart-1,i=o[n],i===o[++n]&&i===o[++n]&&i===o[++n])){s=t.strstart+ii;do;while(i===o[++n]&&i===o[++n]&&i===o[++n]&&i===o[++n]&&i===o[++n]&&i===o[++n]&&i===o[++n]&&i===o[++n]&&n<s);t.match_length=ii-(s-n),t.match_length>t.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=Q?(r=Mt._tr_tally(t,1,t.match_length-Q),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(r=Mt._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),r&&(Ke(t,!1),t.strm.avail_out===0))return De}return t.insert=0,e===si?(Ke(t,!0),t.strm.avail_out===0?Ki:Ms):t.last_lit&&(Ke(t,!1),t.strm.avail_out===0)?De:$a}l(VB,"deflate_rle");function GB(t,e){for(var r;;){if(t.lookahead===0&&(Ji(t),t.lookahead===0)){if(e===Xi)return De;break}if(t.match_length=0,r=Mt._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,r&&(Ke(t,!1),t.strm.avail_out===0))return De}return t.insert=0,e===si?(Ke(t,!0),t.strm.avail_out===0?Ki:Ms):t.last_lit&&(Ke(t,!1),t.strm.avail_out===0)?De:$a}l(GB,"deflate_huff");function ur(t,e,r,i,n){this.good_length=t,this.max_lazy=e,this.nice_length=r,this.max_chain=i,this.func=n}l(ur,"Config");var Bs;Bs=[new ur(0,0,0,0,HB),new ur(4,4,8,4,Cm),new ur(4,5,16,8,Cm),new ur(4,6,32,32,Cm),new ur(4,4,16,16,$s),new ur(8,16,32,32,$s),new ur(8,16,128,128,$s),new ur(8,32,128,256,$s),new ur(32,128,258,1024,$s),new ur(32,258,258,4096,$s)];function KB(t){t.window_size=2*t.w_size,ri(t.head),t.max_lazy_match=Bs[t.level].max_lazy,t.good_match=Bs[t.level].good_length,t.nice_match=Bs[t.level].nice_length,t.max_chain_length=Bs[t.level].max_chain,t.strstart=0,t.block_start=0,t.lookahead=0,t.insert=0,t.match_length=t.prev_length=Q-1,t.match_available=0,t.ins_h=0}l(KB,"lm_init");function JB(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=Rf,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new ft.Buf16(jB*2),this.dyn_dtree=new ft.Buf16((2*MB+1)*2),this.bl_tree=new ft.Buf16((2*LB+1)*2),ri(this.dyn_ltree),ri(this.dyn_dtree),ri(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new ft.Buf16(qB+1),this.heap=new ft.Buf16(2*Dm+1),ri(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new ft.Buf16(2*Dm+1),ri(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}l(JB,"DeflateState");function GE(t){var e;return!t||!t.state?ni(t,Lt):(t.total_in=t.total_out=0,t.data_type=NB,e=t.state,e.pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=e.wrap?Of:Gi,t.adler=e.wrap===2?0:1,e.last_flush=Xi,Mt._tr_init(e),hr)}l(GE,"deflateResetKeep");function KE(t){var e=GE(t);return e===hr&&KB(t.state),e}l(KE,"deflateReset");function XB(t,e){return!t||!t.state||t.state.wrap!==2?Lt:(t.state.gzhead=e,hr)}l(XB,"deflateSetHeader");function JE(t,e,r,i,n,s){if(!t)return Lt;var o=1;if(e===RB&&(e=6),i<0?(o=0,i=-i):i>15&&(o=2,i-=16),n<1||n>CB||r!==Rf||i<8||i>15||e<0||e>9||s<0||s>AB)return ni(t,Lt);i===8&&(i=9);var f=new JB;return t.state=f,f.strm=t,f.wrap=o,f.gzhead=null,f.w_bits=i,f.w_size=1<<f.w_bits,f.w_mask=f.w_size-1,f.hash_bits=n+7,f.hash_size=1<<f.hash_bits,f.hash_mask=f.hash_size-1,f.hash_shift=~~((f.hash_bits+Q-1)/Q),f.window=new ft.Buf8(f.w_size*2),f.head=new ft.Buf16(f.hash_size),f.prev=new ft.Buf16(f.w_size),f.lit_bufsize=1<<n+6,f.pending_buf_size=f.lit_bufsize*4,f.pending_buf=new ft.Buf8(f.pending_buf_size),f.d_buf=1*f.lit_bufsize,f.l_buf=3*f.lit_bufsize,f.level=e,f.strategy=s,f.method=r,KE(t)}l(JE,"deflateInit2");function YB(t,e){return JE(t,e,Rf,DB,IB,PB)}l(YB,"deflateInit");function ZB(t,e){var r,i,n,s;if(!t||!t.state||e>UE||e<0)return t?ni(t,Lt):Lt;if(i=t.state,!t.output||!t.input&&t.avail_in!==0||i.status===Ia&&e!==si)return ni(t,t.avail_out===0?Nm:Lt);if(i.strm=t,r=i.last_flush,i.last_flush=e,i.status===Of)if(i.wrap===2)t.adler=0,oe(i,31),oe(i,139),oe(i,8),i.gzhead?(oe(i,(i.gzhead.text?1:0)+(i.gzhead.hcrc?2:0)+(i.gzhead.extra?4:0)+(i.gzhead.name?8:0)+(i.gzhead.comment?16:0)),oe(i,i.gzhead.time&255),oe(i,i.gzhead.time>>8&255),oe(i,i.gzhead.time>>16&255),oe(i,i.gzhead.time>>24&255),oe(i,i.level===9?2:i.strategy>=Ef||i.level<2?4:0),oe(i,i.gzhead.os&255),i.gzhead.extra&&i.gzhead.extra.length&&(oe(i,i.gzhead.extra.length&255),oe(i,i.gzhead.extra.length>>8&255)),i.gzhead.hcrc&&(t.adler=ei(t.adler,i.pending_buf,i.pending,0)),i.gzindex=0,i.status=Im):(oe(i,0),oe(i,0),oe(i,0),oe(i,0),oe(i,0),oe(i,i.level===9?2:i.strategy>=Ef||i.level<2?4:0),oe(i,WB),i.status=Gi);else{var o=Rf+(i.w_bits-8<<4)<<8,f=-1;i.strategy>=Ef||i.level<2?f=0:i.level<6?f=1:i.level===6?f=2:f=3,o|=f<<6,i.strstart!==0&&(o|=UB),o+=31-o%31,i.status=Gi,Da(i,o),i.strstart!==0&&(Da(i,t.adler>>>16),Da(i,t.adler&65535)),t.adler=1}if(i.status===Im)if(i.gzhead.extra){for(n=i.pending;i.gzindex<(i.gzhead.extra.length&65535)&&!(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>n&&(t.adler=ei(t.adler,i.pending_buf,i.pending-n,n)),ti(t),n=i.pending,i.pending===i.pending_buf_size));)oe(i,i.gzhead.extra[i.gzindex]&255),i.gzindex++;i.gzhead.hcrc&&i.pending>n&&(t.adler=ei(t.adler,i.pending_buf,i.pending-n,n)),i.gzindex===i.gzhead.extra.length&&(i.gzindex=0,i.status=Ff)}else i.status=Ff;if(i.status===Ff)if(i.gzhead.name){n=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>n&&(t.adler=ei(t.adler,i.pending_buf,i.pending-n,n)),ti(t),n=i.pending,i.pending===i.pending_buf_size)){s=1;break}i.gzindex<i.gzhead.name.length?s=i.gzhead.name.charCodeAt(i.gzindex++)&255:s=0,oe(i,s)}while(s!==0);i.gzhead.hcrc&&i.pending>n&&(t.adler=ei(t.adler,i.pending_buf,i.pending-n,n)),s===0&&(i.gzindex=0,i.status=Tf)}else i.status=Tf;if(i.status===Tf)if(i.gzhead.comment){n=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>n&&(t.adler=ei(t.adler,i.pending_buf,i.pending-n,n)),ti(t),n=i.pending,i.pending===i.pending_buf_size)){s=1;break}i.gzindex<i.gzhead.comment.length?s=i.gzhead.comment.charCodeAt(i.gzindex++)&255:s=0,oe(i,s)}while(s!==0);i.gzhead.hcrc&&i.pending>n&&(t.adler=ei(t.adler,i.pending_buf,i.pending-n,n)),s===0&&(i.status=kf)}else i.status=kf;if(i.status===kf&&(i.gzhead.hcrc?(i.pending+2>i.pending_buf_size&&ti(t),i.pending+2<=i.pending_buf_size&&(oe(i,t.adler&255),oe(i,t.adler>>8&255),t.adler=0,i.status=Gi)):i.status=Gi),i.pending!==0){if(ti(t),t.avail_out===0)return i.last_flush=-1,hr}else if(t.avail_in===0&&zE(e)<=zE(r)&&e!==si)return ni(t,Nm);if(i.status===Ia&&t.avail_in!==0)return ni(t,Nm);if(t.avail_in!==0||i.lookahead!==0||e!==Xi&&i.status!==Ia){var c=i.strategy===Ef?GB(i,e):i.strategy===xB?VB(i,e):Bs[i.level].func(i,e);if((c===Ki||c===Ms)&&(i.status=Ia),c===De||c===Ki)return t.avail_out===0&&(i.last_flush=-1),hr;if(c===$a&&(e===FB?Mt._tr_align(i):e!==UE&&(Mt._tr_stored_block(i,0,0,!1),e===TB&&(ri(i.head),i.lookahead===0&&(i.strstart=0,i.block_start=0,i.insert=0))),ti(t),t.avail_out===0))return i.last_flush=-1,hr}return e!==si?hr:i.wrap<=0?WE:(i.wrap===2?(oe(i,t.adler&255),oe(i,t.adler>>8&255),oe(i,t.adler>>16&255),oe(i,t.adler>>24&255),oe(i,t.total_in&255),oe(i,t.total_in>>8&255),oe(i,t.total_in>>16&255),oe(i,t.total_in>>24&255)):(Da(i,t.adler>>>16),Da(i,t.adler&65535)),ti(t),i.wrap>0&&(i.wrap=-i.wrap),i.pending!==0?hr:WE)}l(ZB,"deflate");function QB(t){var e;return!t||!t.state?Lt:(e=t.state.status,e!==Of&&e!==Im&&e!==Ff&&e!==Tf&&e!==kf&&e!==Gi&&e!==Ia?ni(t,Lt):(t.state=null,e===Gi?ni(t,kB):hr))}l(QB,"deflateEnd");function eM(t,e){var r=e.length,i,n,s,o,f,c,a,u;if(!t||!t.state||(i=t.state,o=i.wrap,o===2||o===1&&i.status!==Of||i.lookahead))return Lt;for(o===1&&(t.adler=HE(t.adler,e,r,0)),i.wrap=0,r>=i.w_size&&(o===0&&(ri(i.head),i.strstart=0,i.block_start=0,i.insert=0),u=new ft.Buf8(i.w_size),ft.arraySet(u,e,r-i.w_size,i.w_size,0),e=u,r=i.w_size),f=t.avail_in,c=t.next_in,a=t.input,t.avail_in=r,t.next_in=0,t.input=e,Ji(i);i.lookahead>=Q;){n=i.strstart,s=i.lookahead-(Q-1);do i.ins_h=(i.ins_h<<i.hash_shift^i.window[n+Q-1])&i.hash_mask,i.prev[n&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=n,n++;while(--s);i.strstart=n,i.lookahead=Q-1,Ji(i)}return i.strstart+=i.lookahead,i.block_start=i.strstart,i.insert=i.lookahead,i.lookahead=0,i.match_length=i.prev_length=Q-1,i.match_available=0,t.next_in=c,t.input=a,t.avail_in=f,i.wrap=o,hr}l(eM,"deflateSetDictionary");dr.deflateInit=YB;dr.deflateInit2=JE;dr.deflateReset=KE;dr.deflateResetKeep=GE;dr.deflateSetHeader=XB;dr.deflate=ZB;dr.deflateEnd=QB;dr.deflateSetDictionary=eM;dr.deflateInfo="pako deflate (from Nodeca project)"});var $m=T(Ls=>{"use strict";var xf=Ar(),YE=!0,ZE=!0;try{String.fromCharCode.apply(null,[0])}catch{YE=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{ZE=!1}var Ba=new xf.Buf8(256);for(Nr=0;Nr<256;Nr++)Ba[Nr]=Nr>=252?6:Nr>=248?5:Nr>=240?4:Nr>=224?3:Nr>=192?2:1;var Nr;Ba[254]=Ba[254]=1;Ls.string2buf=function(t){var e,r,i,n,s,o=t.length,f=0;for(n=0;n<o;n++)r=t.charCodeAt(n),(r&64512)===55296&&n+1<o&&(i=t.charCodeAt(n+1),(i&64512)===56320&&(r=65536+(r-55296<<10)+(i-56320),n++)),f+=r<128?1:r<2048?2:r<65536?3:4;for(e=new xf.Buf8(f),s=0,n=0;s<f;n++)r=t.charCodeAt(n),(r&64512)===55296&&n+1<o&&(i=t.charCodeAt(n+1),(i&64512)===56320&&(r=65536+(r-55296<<10)+(i-56320),n++)),r<128?e[s++]=r:r<2048?(e[s++]=192|r>>>6,e[s++]=128|r&63):r<65536?(e[s++]=224|r>>>12,e[s++]=128|r>>>6&63,e[s++]=128|r&63):(e[s++]=240|r>>>18,e[s++]=128|r>>>12&63,e[s++]=128|r>>>6&63,e[s++]=128|r&63);return e};function QE(t,e){if(e<65534&&(t.subarray&&ZE||!t.subarray&&YE))return String.fromCharCode.apply(null,xf.shrinkBuf(t,e));for(var r="",i=0;i<e;i++)r+=String.fromCharCode(t[i]);return r}l(QE,"buf2binstring");Ls.buf2binstring=function(t){return QE(t,t.length)};Ls.binstring2buf=function(t){for(var e=new xf.Buf8(t.length),r=0,i=e.length;r<i;r++)e[r]=t.charCodeAt(r);return e};Ls.buf2string=function(t,e){var r,i,n,s,o=e||t.length,f=new Array(o*2);for(i=0,r=0;r<o;){if(n=t[r++],n<128){f[i++]=n;continue}if(s=Ba[n],s>4){f[i++]=65533,r+=s-1;continue}for(n&=s===2?31:s===3?15:7;s>1&&r<o;)n=n<<6|t[r++]&63,s--;if(s>1){f[i++]=65533;continue}n<65536?f[i++]=n:(n-=65536,f[i++]=55296|n>>10&1023,f[i++]=56320|n&1023)}return QE(f,i)};Ls.utf8border=function(t,e){var r;for(e=e||t.length,e>t.length&&(e=t.length),r=e-1;r>=0&&(t[r]&192)===128;)r--;return r<0||r===0?e:r+Ba[t[r]]>e?r:e}});var Bm=T((yJ,eF)=>{"use strict";function tM(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}l(tM,"ZStream");eF.exports=tM});var nF=T(ja=>{"use strict";var Ma=XE(),La=Ar(),Lm=$m(),jm=vf(),rM=Bm(),iF=Object.prototype.toString,iM=0,Mm=4,js=0,tF=1,rF=2,nM=-1,sM=0,oM=8;function Yi(t){if(!(this instanceof Yi))return new Yi(t);this.options=La.assign({level:nM,method:oM,chunkSize:16384,windowBits:15,memLevel:8,strategy:sM,to:""},t||{});var e=this.options;e.raw&&e.windowBits>0?e.windowBits=-e.windowBits:e.gzip&&e.windowBits>0&&e.windowBits<16&&(e.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new rM,this.strm.avail_out=0;var r=Ma.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(r!==js)throw new Error(jm[r]);if(e.header&&Ma.deflateSetHeader(this.strm,e.header),e.dictionary){var i;if(typeof e.dictionary=="string"?i=Lm.string2buf(e.dictionary):iF.call(e.dictionary)==="[object ArrayBuffer]"?i=new Uint8Array(e.dictionary):i=e.dictionary,r=Ma.deflateSetDictionary(this.strm,i),r!==js)throw new Error(jm[r]);this._dict_set=!0}}l(Yi,"Deflate");Yi.prototype.push=function(t,e){var r=this.strm,i=this.options.chunkSize,n,s;if(this.ended)return!1;s=e===~~e?e:e===!0?Mm:iM,typeof t=="string"?r.input=Lm.string2buf(t):iF.call(t)==="[object ArrayBuffer]"?r.input=new Uint8Array(t):r.input=t,r.next_in=0,r.avail_in=r.input.length;do{if(r.avail_out===0&&(r.output=new La.Buf8(i),r.next_out=0,r.avail_out=i),n=Ma.deflate(r,s),n!==tF&&n!==js)return this.onEnd(n),this.ended=!0,!1;(r.avail_out===0||r.avail_in===0&&(s===Mm||s===rF))&&(this.options.to==="string"?this.onData(Lm.buf2binstring(La.shrinkBuf(r.output,r.next_out))):this.onData(La.shrinkBuf(r.output,r.next_out)))}while((r.avail_in>0||r.avail_out===0)&&n!==tF);return s===Mm?(n=Ma.deflateEnd(this.strm),this.onEnd(n),this.ended=!0,n===js):(s===rF&&(this.onEnd(js),r.avail_out=0),!0)};Yi.prototype.onData=function(t){this.chunks.push(t)};Yi.prototype.onEnd=function(t){t===js&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=La.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};function qm(t,e){var r=new Yi(e);if(r.push(t,!0),r.err)throw r.msg||jm[r.err];return r.result}l(qm,"deflate");function aM(t,e){return e=e||{},e.raw=!0,qm(t,e)}l(aM,"deflateRaw");function cM(t,e){return e=e||{},e.gzip=!0,qm(t,e)}l(cM,"gzip");ja.Deflate=Yi;ja.deflate=qm;ja.deflateRaw=aM;ja.gzip=cM});var oF=T((SJ,sF)=>{"use strict";var Af=30,lM=12;sF.exports=l(function(e,r){var i,n,s,o,f,c,a,u,h,d,p,m,w,y,g,_,F,E,R,P,S,O,v,A,x;i=e.state,n=e.next_in,A=e.input,s=n+(e.avail_in-5),o=e.next_out,x=e.output,f=o-(r-e.avail_out),c=o+(e.avail_out-257),a=i.dmax,u=i.wsize,h=i.whave,d=i.wnext,p=i.window,m=i.hold,w=i.bits,y=i.lencode,g=i.distcode,_=(1<<i.lenbits)-1,F=(1<<i.distbits)-1;e:do{w<15&&(m+=A[n++]<<w,w+=8,m+=A[n++]<<w,w+=8),E=y[m&_];t:for(;;){if(R=E>>>24,m>>>=R,w-=R,R=E>>>16&255,R===0)x[o++]=E&65535;else if(R&16){P=E&65535,R&=15,R&&(w<R&&(m+=A[n++]<<w,w+=8),P+=m&(1<<R)-1,m>>>=R,w-=R),w<15&&(m+=A[n++]<<w,w+=8,m+=A[n++]<<w,w+=8),E=g[m&F];r:for(;;){if(R=E>>>24,m>>>=R,w-=R,R=E>>>16&255,R&16){if(S=E&65535,R&=15,w<R&&(m+=A[n++]<<w,w+=8,w<R&&(m+=A[n++]<<w,w+=8)),S+=m&(1<<R)-1,S>a){e.msg="invalid distance too far back",i.mode=Af;break e}if(m>>>=R,w-=R,R=o-f,S>R){if(R=S-R,R>h&&i.sane){e.msg="invalid distance too far back",i.mode=Af;break e}if(O=0,v=p,d===0){if(O+=u-R,R<P){P-=R;do x[o++]=p[O++];while(--R);O=o-S,v=x}}else if(d<R){if(O+=u+d-R,R-=d,R<P){P-=R;do x[o++]=p[O++];while(--R);if(O=0,d<P){R=d,P-=R;do x[o++]=p[O++];while(--R);O=o-S,v=x}}}else if(O+=d-R,R<P){P-=R;do x[o++]=p[O++];while(--R);O=o-S,v=x}for(;P>2;)x[o++]=v[O++],x[o++]=v[O++],x[o++]=v[O++],P-=3;P&&(x[o++]=v[O++],P>1&&(x[o++]=v[O++]))}else{O=o-S;do x[o++]=x[O++],x[o++]=x[O++],x[o++]=x[O++],P-=3;while(P>2);P&&(x[o++]=x[O++],P>1&&(x[o++]=x[O++]))}}else if(R&64){e.msg="invalid distance code",i.mode=Af;break e}else{E=g[(E&65535)+(m&(1<<R)-1)];continue r}break}}else if(R&64)if(R&32){i.mode=lM;break e}else{e.msg="invalid literal/length code",i.mode=Af;break e}else{E=y[(E&65535)+(m&(1<<R)-1)];continue t}break}}while(n<s&&o<c);P=w>>3,n-=P,w-=P<<3,m&=(1<<w)-1,e.next_in=n,e.next_out=o,e.avail_in=n<s?5+(s-n):5-(n-s),e.avail_out=o<c?257+(c-o):257-(o-c),i.hold=m,i.bits=w},"inflate_fast")});var dF=T((EJ,hF)=>{"use strict";var aF=Ar(),qs=15,cF=852,lF=592,fF=0,Um=1,uF=2,fM=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],uM=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],hM=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],dM=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];hF.exports=l(function(e,r,i,n,s,o,f,c){var a=c.bits,u=0,h=0,d=0,p=0,m=0,w=0,y=0,g=0,_=0,F=0,E,R,P,S,O,v=null,A=0,x,I=new aF.Buf16(qs+1),M=new aF.Buf16(qs+1),z=null,Se=0,Ye,pt,St;for(u=0;u<=qs;u++)I[u]=0;for(h=0;h<n;h++)I[r[i+h]]++;for(m=a,p=qs;p>=1&&I[p]===0;p--);if(m>p&&(m=p),p===0)return s[o++]=1<<24|64<<16|0,s[o++]=1<<24|64<<16|0,c.bits=1,0;for(d=1;d<p&&I[d]===0;d++);for(m<d&&(m=d),g=1,u=1;u<=qs;u++)if(g<<=1,g-=I[u],g<0)return-1;if(g>0&&(e===fF||p!==1))return-1;for(M[1]=0,u=1;u<qs;u++)M[u+1]=M[u]+I[u];for(h=0;h<n;h++)r[i+h]!==0&&(f[M[r[i+h]]++]=h);if(e===fF?(v=z=f,x=19):e===Um?(v=fM,A-=257,z=uM,Se-=257,x=256):(v=hM,z=dM,x=-1),F=0,h=0,u=d,O=o,w=m,y=0,P=-1,_=1<<m,S=_-1,e===Um&&_>cF||e===uF&&_>lF)return 1;for(;;){Ye=u-y,f[h]<x?(pt=0,St=f[h]):f[h]>x?(pt=z[Se+f[h]],St=v[A+f[h]]):(pt=96,St=0),E=1<<u-y,R=1<<w,d=R;do R-=E,s[O+(F>>y)+R]=Ye<<24|pt<<16|St|0;while(R!==0);for(E=1<<u-1;F&E;)E>>=1;if(E!==0?(F&=E-1,F+=E):F=0,h++,--I[u]===0){if(u===p)break;u=r[i+f[h]]}if(u>m&&(F&S)!==P){for(y===0&&(y=m),O+=d,w=u-y,g=1<<w;w+y<p&&(g-=I[w+y],!(g<=0));)w++,g<<=1;if(_+=1<<w,e===Um&&_>cF||e===uF&&_>lF)return 1;P=F&S,s[P]=m<<24|w<<16|O-o|0}}return F!==0&&(s[O+F]=u-y<<24|64<<16|0),c.bits=m,0},"inflate_table")});var KF=T(Yt=>{"use strict";var kt=Ar(),Km=Am(),pr=Pm(),pM=oF(),qa=dF(),mM=0,LF=1,jF=2,pF=4,wM=5,Pf=6,Zi=0,yM=1,gM=2,jt=-2,qF=-3,Jm=-4,bM=-5,mF=8,UF=1,wF=2,yF=3,gF=4,bF=5,_F=6,SF=7,vF=8,EF=9,FF=10,Df=11,Cr=12,Wm=13,TF=14,zm=15,kF=16,RF=17,OF=18,xF=19,Nf=20,Cf=21,AF=22,PF=23,NF=24,CF=25,DF=26,Hm=27,IF=28,$F=29,ye=30,Xm=31,_M=32,SM=852,vM=592,EM=15,FM=EM;function BF(t){return(t>>>24&255)+(t>>>8&65280)+((t&65280)<<8)+((t&255)<<24)}l(BF,"zswap32");function TM(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new kt.Buf16(320),this.work=new kt.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}l(TM,"InflateState");function WF(t){var e;return!t||!t.state?jt:(e=t.state,t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=e.wrap&1),e.mode=UF,e.last=0,e.havedict=0,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new kt.Buf32(SM),e.distcode=e.distdyn=new kt.Buf32(vM),e.sane=1,e.back=-1,Zi)}l(WF,"inflateResetKeep");function zF(t){var e;return!t||!t.state?jt:(e=t.state,e.wsize=0,e.whave=0,e.wnext=0,WF(t))}l(zF,"inflateReset");function HF(t,e){var r,i;return!t||!t.state||(i=t.state,e<0?(r=0,e=-e):(r=(e>>4)+1,e<48&&(e&=15)),e&&(e<8||e>15))?jt:(i.window!==null&&i.wbits!==e&&(i.window=null),i.wrap=r,i.wbits=e,zF(t))}l(HF,"inflateReset2");function VF(t,e){var r,i;return t?(i=new TM,t.state=i,i.window=null,r=HF(t,e),r!==Zi&&(t.state=null),r):jt}l(VF,"inflateInit2");function kM(t){return VF(t,FM)}l(kM,"inflateInit");var MF=!0,Vm,Gm;function RM(t){if(MF){var e;for(Vm=new kt.Buf32(512),Gm=new kt.Buf32(32),e=0;e<144;)t.lens[e++]=8;for(;e<256;)t.lens[e++]=9;for(;e<280;)t.lens[e++]=7;for(;e<288;)t.lens[e++]=8;for(qa(LF,t.lens,0,288,Vm,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;qa(jF,t.lens,0,32,Gm,0,t.work,{bits:5}),MF=!1}t.lencode=Vm,t.lenbits=9,t.distcode=Gm,t.distbits=5}l(RM,"fixedtables");function GF(t,e,r,i){var n,s=t.state;return s.window===null&&(s.wsize=1<<s.wbits,s.wnext=0,s.whave=0,s.window=new kt.Buf8(s.wsize)),i>=s.wsize?(kt.arraySet(s.window,e,r-s.wsize,s.wsize,0),s.wnext=0,s.whave=s.wsize):(n=s.wsize-s.wnext,n>i&&(n=i),kt.arraySet(s.window,e,r-i,n,s.wnext),i-=n,i?(kt.arraySet(s.window,e,r-i,i,0),s.wnext=i,s.whave=s.wsize):(s.wnext+=n,s.wnext===s.wsize&&(s.wnext=0),s.whave<s.wsize&&(s.whave+=n))),0}l(GF,"updatewindow");function OM(t,e){var r,i,n,s,o,f,c,a,u,h,d,p,m,w,y=0,g,_,F,E,R,P,S,O,v=new kt.Buf8(4),A,x,I=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!t||!t.state||!t.output||!t.input&&t.avail_in!==0)return jt;r=t.state,r.mode===Cr&&(r.mode=Wm),o=t.next_out,n=t.output,c=t.avail_out,s=t.next_in,i=t.input,f=t.avail_in,a=r.hold,u=r.bits,h=f,d=c,O=Zi;e:for(;;)switch(r.mode){case UF:if(r.wrap===0){r.mode=Wm;break}for(;u<16;){if(f===0)break e;f--,a+=i[s++]<<u,u+=8}if(r.wrap&2&&a===35615){r.check=0,v[0]=a&255,v[1]=a>>>8&255,r.check=pr(r.check,v,2,0),a=0,u=0,r.mode=wF;break}if(r.flags=0,r.head&&(r.head.done=!1),!(r.wrap&1)||(((a&255)<<8)+(a>>8))%31){t.msg="incorrect header check",r.mode=ye;break}if((a&15)!==mF){t.msg="unknown compression method",r.mode=ye;break}if(a>>>=4,u-=4,S=(a&15)+8,r.wbits===0)r.wbits=S;else if(S>r.wbits){t.msg="invalid window size",r.mode=ye;break}r.dmax=1<<S,t.adler=r.check=1,r.mode=a&512?FF:Cr,a=0,u=0;break;case wF:for(;u<16;){if(f===0)break e;f--,a+=i[s++]<<u,u+=8}if(r.flags=a,(r.flags&255)!==mF){t.msg="unknown compression method",r.mode=ye;break}if(r.flags&57344){t.msg="unknown header flags set",r.mode=ye;break}r.head&&(r.head.text=a>>8&1),r.flags&512&&(v[0]=a&255,v[1]=a>>>8&255,r.check=pr(r.check,v,2,0)),a=0,u=0,r.mode=yF;case yF:for(;u<32;){if(f===0)break e;f--,a+=i[s++]<<u,u+=8}r.head&&(r.head.time=a),r.flags&512&&(v[0]=a&255,v[1]=a>>>8&255,v[2]=a>>>16&255,v[3]=a>>>24&255,r.check=pr(r.check,v,4,0)),a=0,u=0,r.mode=gF;case gF:for(;u<16;){if(f===0)break e;f--,a+=i[s++]<<u,u+=8}r.head&&(r.head.xflags=a&255,r.head.os=a>>8),r.flags&512&&(v[0]=a&255,v[1]=a>>>8&255,r.check=pr(r.check,v,2,0)),a=0,u=0,r.mode=bF;case bF:if(r.flags&1024){for(;u<16;){if(f===0)break e;f--,a+=i[s++]<<u,u+=8}r.length=a,r.head&&(r.head.extra_len=a),r.flags&512&&(v[0]=a&255,v[1]=a>>>8&255,r.check=pr(r.check,v,2,0)),a=0,u=0}else r.head&&(r.head.extra=null);r.mode=_F;case _F:if(r.flags&1024&&(p=r.length,p>f&&(p=f),p&&(r.head&&(S=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Array(r.head.extra_len)),kt.arraySet(r.head.extra,i,s,p,S)),r.flags&512&&(r.check=pr(r.check,i,p,s)),f-=p,s+=p,r.length-=p),r.length))break e;r.length=0,r.mode=SF;case SF:if(r.flags&2048){if(f===0)break e;p=0;do S=i[s+p++],r.head&&S&&r.length<65536&&(r.head.name+=String.fromCharCode(S));while(S&&p<f);if(r.flags&512&&(r.check=pr(r.check,i,p,s)),f-=p,s+=p,S)break e}else r.head&&(r.head.name=null);r.length=0,r.mode=vF;case vF:if(r.flags&4096){if(f===0)break e;p=0;do S=i[s+p++],r.head&&S&&r.length<65536&&(r.head.comment+=String.fromCharCode(S));while(S&&p<f);if(r.flags&512&&(r.check=pr(r.check,i,p,s)),f-=p,s+=p,S)break e}else r.head&&(r.head.comment=null);r.mode=EF;case EF:if(r.flags&512){for(;u<16;){if(f===0)break e;f--,a+=i[s++]<<u,u+=8}if(a!==(r.check&65535)){t.msg="header crc mismatch",r.mode=ye;break}a=0,u=0}r.head&&(r.head.hcrc=r.flags>>9&1,r.head.done=!0),t.adler=r.check=0,r.mode=Cr;break;case FF:for(;u<32;){if(f===0)break e;f--,a+=i[s++]<<u,u+=8}t.adler=r.check=BF(a),a=0,u=0,r.mode=Df;case Df:if(r.havedict===0)return t.next_out=o,t.avail_out=c,t.next_in=s,t.avail_in=f,r.hold=a,r.bits=u,gM;t.adler=r.check=1,r.mode=Cr;case Cr:if(e===wM||e===Pf)break e;case Wm:if(r.last){a>>>=u&7,u-=u&7,r.mode=Hm;break}for(;u<3;){if(f===0)break e;f--,a+=i[s++]<<u,u+=8}switch(r.last=a&1,a>>>=1,u-=1,a&3){case 0:r.mode=TF;break;case 1:if(RM(r),r.mode=Nf,e===Pf){a>>>=2,u-=2;break e}break;case 2:r.mode=RF;break;case 3:t.msg="invalid block type",r.mode=ye}a>>>=2,u-=2;break;case TF:for(a>>>=u&7,u-=u&7;u<32;){if(f===0)break e;f--,a+=i[s++]<<u,u+=8}if((a&65535)!==(a>>>16^65535)){t.msg="invalid stored block lengths",r.mode=ye;break}if(r.length=a&65535,a=0,u=0,r.mode=zm,e===Pf)break e;case zm:r.mode=kF;case kF:if(p=r.length,p){if(p>f&&(p=f),p>c&&(p=c),p===0)break e;kt.arraySet(n,i,s,p,o),f-=p,s+=p,c-=p,o+=p,r.length-=p;break}r.mode=Cr;break;case RF:for(;u<14;){if(f===0)break e;f--,a+=i[s++]<<u,u+=8}if(r.nlen=(a&31)+257,a>>>=5,u-=5,r.ndist=(a&31)+1,a>>>=5,u-=5,r.ncode=(a&15)+4,a>>>=4,u-=4,r.nlen>286||r.ndist>30){t.msg="too many length or distance symbols",r.mode=ye;break}r.have=0,r.mode=OF;case OF:for(;r.have<r.ncode;){for(;u<3;){if(f===0)break e;f--,a+=i[s++]<<u,u+=8}r.lens[I[r.have++]]=a&7,a>>>=3,u-=3}for(;r.have<19;)r.lens[I[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,A={bits:r.lenbits},O=qa(mM,r.lens,0,19,r.lencode,0,r.work,A),r.lenbits=A.bits,O){t.msg="invalid code lengths set",r.mode=ye;break}r.have=0,r.mode=xF;case xF:for(;r.have<r.nlen+r.ndist;){for(;y=r.lencode[a&(1<<r.lenbits)-1],g=y>>>24,_=y>>>16&255,F=y&65535,!(g<=u);){if(f===0)break e;f--,a+=i[s++]<<u,u+=8}if(F<16)a>>>=g,u-=g,r.lens[r.have++]=F;else{if(F===16){for(x=g+2;u<x;){if(f===0)break e;f--,a+=i[s++]<<u,u+=8}if(a>>>=g,u-=g,r.have===0){t.msg="invalid bit length repeat",r.mode=ye;break}S=r.lens[r.have-1],p=3+(a&3),a>>>=2,u-=2}else if(F===17){for(x=g+3;u<x;){if(f===0)break e;f--,a+=i[s++]<<u,u+=8}a>>>=g,u-=g,S=0,p=3+(a&7),a>>>=3,u-=3}else{for(x=g+7;u<x;){if(f===0)break e;f--,a+=i[s++]<<u,u+=8}a>>>=g,u-=g,S=0,p=11+(a&127),a>>>=7,u-=7}if(r.have+p>r.nlen+r.ndist){t.msg="invalid bit length repeat",r.mode=ye;break}for(;p--;)r.lens[r.have++]=S}}if(r.mode===ye)break;if(r.lens[256]===0){t.msg="invalid code -- missing end-of-block",r.mode=ye;break}if(r.lenbits=9,A={bits:r.lenbits},O=qa(LF,r.lens,0,r.nlen,r.lencode,0,r.work,A),r.lenbits=A.bits,O){t.msg="invalid literal/lengths set",r.mode=ye;break}if(r.distbits=6,r.distcode=r.distdyn,A={bits:r.distbits},O=qa(jF,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,A),r.distbits=A.bits,O){t.msg="invalid distances set",r.mode=ye;break}if(r.mode=Nf,e===Pf)break e;case Nf:r.mode=Cf;case Cf:if(f>=6&&c>=258){t.next_out=o,t.avail_out=c,t.next_in=s,t.avail_in=f,r.hold=a,r.bits=u,pM(t,d),o=t.next_out,n=t.output,c=t.avail_out,s=t.next_in,i=t.input,f=t.avail_in,a=r.hold,u=r.bits,r.mode===Cr&&(r.back=-1);break}for(r.back=0;y=r.lencode[a&(1<<r.lenbits)-1],g=y>>>24,_=y>>>16&255,F=y&65535,!(g<=u);){if(f===0)break e;f--,a+=i[s++]<<u,u+=8}if(_&&!(_&240)){for(E=g,R=_,P=F;y=r.lencode[P+((a&(1<<E+R)-1)>>E)],g=y>>>24,_=y>>>16&255,F=y&65535,!(E+g<=u);){if(f===0)break e;f--,a+=i[s++]<<u,u+=8}a>>>=E,u-=E,r.back+=E}if(a>>>=g,u-=g,r.back+=g,r.length=F,_===0){r.mode=DF;break}if(_&32){r.back=-1,r.mode=Cr;break}if(_&64){t.msg="invalid literal/length code",r.mode=ye;break}r.extra=_&15,r.mode=AF;case AF:if(r.extra){for(x=r.extra;u<x;){if(f===0)break e;f--,a+=i[s++]<<u,u+=8}r.length+=a&(1<<r.extra)-1,a>>>=r.extra,u-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=PF;case PF:for(;y=r.distcode[a&(1<<r.distbits)-1],g=y>>>24,_=y>>>16&255,F=y&65535,!(g<=u);){if(f===0)break e;f--,a+=i[s++]<<u,u+=8}if(!(_&240)){for(E=g,R=_,P=F;y=r.distcode[P+((a&(1<<E+R)-1)>>E)],g=y>>>24,_=y>>>16&255,F=y&65535,!(E+g<=u);){if(f===0)break e;f--,a+=i[s++]<<u,u+=8}a>>>=E,u-=E,r.back+=E}if(a>>>=g,u-=g,r.back+=g,_&64){t.msg="invalid distance code",r.mode=ye;break}r.offset=F,r.extra=_&15,r.mode=NF;case NF:if(r.extra){for(x=r.extra;u<x;){if(f===0)break e;f--,a+=i[s++]<<u,u+=8}r.offset+=a&(1<<r.extra)-1,a>>>=r.extra,u-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){t.msg="invalid distance too far back",r.mode=ye;break}r.mode=CF;case CF:if(c===0)break e;if(p=d-c,r.offset>p){if(p=r.offset-p,p>r.whave&&r.sane){t.msg="invalid distance too far back",r.mode=ye;break}p>r.wnext?(p-=r.wnext,m=r.wsize-p):m=r.wnext-p,p>r.length&&(p=r.length),w=r.window}else w=n,m=o-r.offset,p=r.length;p>c&&(p=c),c-=p,r.length-=p;do n[o++]=w[m++];while(--p);r.length===0&&(r.mode=Cf);break;case DF:if(c===0)break e;n[o++]=r.length,c--,r.mode=Cf;break;case Hm:if(r.wrap){for(;u<32;){if(f===0)break e;f--,a|=i[s++]<<u,u+=8}if(d-=c,t.total_out+=d,r.total+=d,d&&(t.adler=r.check=r.flags?pr(r.check,n,d,o-d):Km(r.check,n,d,o-d)),d=c,(r.flags?a:BF(a))!==r.check){t.msg="incorrect data check",r.mode=ye;break}a=0,u=0}r.mode=IF;case IF:if(r.wrap&&r.flags){for(;u<32;){if(f===0)break e;f--,a+=i[s++]<<u,u+=8}if(a!==(r.total&4294967295)){t.msg="incorrect length check",r.mode=ye;break}a=0,u=0}r.mode=$F;case $F:O=yM;break e;case ye:O=qF;break e;case Xm:return Jm;case _M:default:return jt}return t.next_out=o,t.avail_out=c,t.next_in=s,t.avail_in=f,r.hold=a,r.bits=u,(r.wsize||d!==t.avail_out&&r.mode<ye&&(r.mode<Hm||e!==pF))&&GF(t,t.output,t.next_out,d-t.avail_out)?(r.mode=Xm,Jm):(h-=t.avail_in,d-=t.avail_out,t.total_in+=h,t.total_out+=d,r.total+=d,r.wrap&&d&&(t.adler=r.check=r.flags?pr(r.check,n,d,t.next_out-d):Km(r.check,n,d,t.next_out-d)),t.data_type=r.bits+(r.last?64:0)+(r.mode===Cr?128:0)+(r.mode===Nf||r.mode===zm?256:0),(h===0&&d===0||e===pF)&&O===Zi&&(O=bM),O)}l(OM,"inflate");function xM(t){if(!t||!t.state)return jt;var e=t.state;return e.window&&(e.window=null),t.state=null,Zi}l(xM,"inflateEnd");function AM(t,e){var r;return!t||!t.state||(r=t.state,!(r.wrap&2))?jt:(r.head=e,e.done=!1,Zi)}l(AM,"inflateGetHeader");function PM(t,e){var r=e.length,i,n,s;return!t||!t.state||(i=t.state,i.wrap!==0&&i.mode!==Df)?jt:i.mode===Df&&(n=1,n=Km(n,e,r,0),n!==i.check)?qF:(s=GF(t,e,r,r),s?(i.mode=Xm,Jm):(i.havedict=1,Zi))}l(PM,"inflateSetDictionary");Yt.inflateReset=zF;Yt.inflateReset2=HF;Yt.inflateResetKeep=WF;Yt.inflateInit=kM;Yt.inflateInit2=VF;Yt.inflate=OM;Yt.inflateEnd=xM;Yt.inflateGetHeader=AM;Yt.inflateSetDictionary=PM;Yt.inflateInfo="pako inflate (from Nodeca project)"});var Ym=T((RJ,JF)=>{"use strict";JF.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}});var YF=T((OJ,XF)=>{"use strict";function NM(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}l(NM,"GZheader");XF.exports=NM});var QF=T(Wa=>{"use strict";var Us=KF(),Ua=Ar(),If=$m(),Fe=Ym(),Zm=vf(),CM=Bm(),DM=YF(),ZF=Object.prototype.toString;function Qi(t){if(!(this instanceof Qi))return new Qi(t);this.options=Ua.assign({chunkSize:16384,windowBits:0,to:""},t||{});var e=this.options;e.raw&&e.windowBits>=0&&e.windowBits<16&&(e.windowBits=-e.windowBits,e.windowBits===0&&(e.windowBits=-15)),e.windowBits>=0&&e.windowBits<16&&!(t&&t.windowBits)&&(e.windowBits+=32),e.windowBits>15&&e.windowBits<48&&(e.windowBits&15||(e.windowBits|=15)),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new CM,this.strm.avail_out=0;var r=Us.inflateInit2(this.strm,e.windowBits);if(r!==Fe.Z_OK)throw new Error(Zm[r]);if(this.header=new DM,Us.inflateGetHeader(this.strm,this.header),e.dictionary&&(typeof e.dictionary=="string"?e.dictionary=If.string2buf(e.dictionary):ZF.call(e.dictionary)==="[object ArrayBuffer]"&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(r=Us.inflateSetDictionary(this.strm,e.dictionary),r!==Fe.Z_OK)))throw new Error(Zm[r])}l(Qi,"Inflate");Qi.prototype.push=function(t,e){var r=this.strm,i=this.options.chunkSize,n=this.options.dictionary,s,o,f,c,a,u=!1;if(this.ended)return!1;o=e===~~e?e:e===!0?Fe.Z_FINISH:Fe.Z_NO_FLUSH,typeof t=="string"?r.input=If.binstring2buf(t):ZF.call(t)==="[object ArrayBuffer]"?r.input=new Uint8Array(t):r.input=t,r.next_in=0,r.avail_in=r.input.length;do{if(r.avail_out===0&&(r.output=new Ua.Buf8(i),r.next_out=0,r.avail_out=i),s=Us.inflate(r,Fe.Z_NO_FLUSH),s===Fe.Z_NEED_DICT&&n&&(s=Us.inflateSetDictionary(this.strm,n)),s===Fe.Z_BUF_ERROR&&u===!0&&(s=Fe.Z_OK,u=!1),s!==Fe.Z_STREAM_END&&s!==Fe.Z_OK)return this.onEnd(s),this.ended=!0,!1;r.next_out&&(r.avail_out===0||s===Fe.Z_STREAM_END||r.avail_in===0&&(o===Fe.Z_FINISH||o===Fe.Z_SYNC_FLUSH))&&(this.options.to==="string"?(f=If.utf8border(r.output,r.next_out),c=r.next_out-f,a=If.buf2string(r.output,f),r.next_out=c,r.avail_out=i-c,c&&Ua.arraySet(r.output,r.output,f,c,0),this.onData(a)):this.onData(Ua.shrinkBuf(r.output,r.next_out))),r.avail_in===0&&r.avail_out===0&&(u=!0)}while((r.avail_in>0||r.avail_out===0)&&s!==Fe.Z_STREAM_END);return s===Fe.Z_STREAM_END&&(o=Fe.Z_FINISH),o===Fe.Z_FINISH?(s=Us.inflateEnd(this.strm),this.onEnd(s),this.ended=!0,s===Fe.Z_OK):(o===Fe.Z_SYNC_FLUSH&&(this.onEnd(Fe.Z_OK),r.avail_out=0),!0)};Qi.prototype.onData=function(t){this.chunks.push(t)};Qi.prototype.onEnd=function(t){t===Fe.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=Ua.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};function Qm(t,e){var r=new Qi(e);if(r.push(t,!0),r.err)throw r.msg||Zm[r.err];return r.result}l(Qm,"inflate");function IM(t,e){return e=e||{},e.raw=!0,Qm(t,e)}l(IM,"inflateRaw");Wa.Inflate=Qi;Wa.inflate=Qm;Wa.inflateRaw=IM;Wa.ungzip=Qm});var rT=T((NJ,tT)=>{"use strict";var $M=Ar().assign,BM=nF(),MM=QF(),LM=Ym(),eT={};$M(eT,BM,MM,LM);tT.exports=eT});var sT=T((CJ,nT)=>{"use strict";var iT=l((t,e)=>function(...r){let i=e.promiseModule;return new i((n,s)=>{e.multiArgs?r.push((...o)=>{e.errorFirst?o[0]?s(o):(o.shift(),n(o)):n(o)}):e.errorFirst?r.push((o,f)=>{o?s(o):n(f)}):r.push(n),t.apply(this,r)})},"processFn");nT.exports=(t,e)=>{e=Object.assign({exclude:[/.+(Sync|Stream)$/],errorFirst:!0,promiseModule:Promise},e);let r=typeof t;if(!(t!==null&&(r==="object"||r==="function")))throw new TypeError(`Expected \`input\` to be a \`Function\` or \`Object\`, got \`${t===null?"null":r}\``);let i=l(s=>{let o=l(f=>typeof f=="string"?s===f:f.test(s),"match");return e.include?e.include.some(o):!e.exclude.some(o)},"filter"),n;r==="function"?n=l(function(...s){return e.excludeMain?t(...s):iT(t,e).apply(this,s)},"ret"):n=Object.create(Object.getPrototypeOf(t));for(let s in t){let o=t[s];n[s]=typeof o=="function"&&i(s)?iT(o,e):o}return n}});var pT=T((IJ,dT)=>{function oT(t){return Array.isArray(t)?t:[t]}l(oT,"makeArray");var rw="",aT=" ",ew="\\",jM=/^\s+$/,qM=/(?:[^\\]|^)\\$/,UM=/^\\!/,WM=/^\\#/,zM=/\r?\n/g,HM=/^\.*\/|^\.+$/,tw="/",fT="node-ignore";typeof Symbol<"u"&&(fT=Symbol.for("node-ignore"));var cT=fT,VM=l((t,e,r)=>Object.defineProperty(t,e,{value:r}),"define"),GM=/([0-z])-([0-z])/g,uT=l(()=>!1,"RETURN_FALSE"),KM=l(t=>t.replace(GM,(e,r,i)=>r.charCodeAt(0)<=i.charCodeAt(0)?e:rw),"sanitizeRange"),JM=l(t=>{let{length:e}=t;return t.slice(0,e-e%2)},"cleanRangeBackSlash"),XM=[[/^\uFEFF/,()=>rw],[/((?:\\\\)*?)(\\?\s+)$/,(t,e,r)=>e+(r.indexOf("\\")===0?aT:rw)],[/(\\+?)\s/g,(t,e)=>{let{length:r}=e;return e.slice(0,r-r%2)+aT}],[/[\\$.|*+(){^]/g,t=>`\\${t}`],[/(?!\\)\?/g,()=>"[^/]"],[/^\//,()=>"^"],[/\//g,()=>"\\/"],[/^\^*\\\*\\\*\\\//,()=>"^(?:.*\\/)?"],[/^(?=[^^])/,l(function(){return/\/(?!$)/.test(this)?"^":"(?:^|\\/)"},"startingReplacer")],[/\\\/\\\*\\\*(?=\\\/|$)/g,(t,e,r)=>e+6<r.length?"(?:\\/[^\\/]+)*":"\\/.+"],[/(^|[^\\]+)(\\\*)+(?=.+)/g,(t,e,r)=>{let i=r.replace(/\\\*/g,"[^\\/]*");return e+i}],[/\\\\\\(?=[$.|*+(){^])/g,()=>ew],[/\\\\/g,()=>ew],[/(\\)?\[([^\]/]*?)(\\*)($|\])/g,(t,e,r,i,n)=>e===ew?`\\[${r}${JM(i)}${n}`:n==="]"&&i.length%2===0?`[${KM(r)}${i}]`:"[]"],[/(?:[^*])$/,t=>/\/$/.test(t)?`${t}$`:`${t}(?=$|\\/$)`],[/(\^|\\\/)?\\\*$/,(t,e)=>`${e?`${e}[^/]+`:"[^/]*"}(?=$|\\/$)`]],lT=Object.create(null),YM=l((t,e)=>{let r=lT[t];return r||(r=XM.reduce((i,[n,s])=>i.replace(n,s.bind(t)),t),lT[t]=r),e?new RegExp(r,"i"):new RegExp(r)},"makeRegex"),sw=l(t=>typeof t=="string","isString"),ZM=l(t=>t&&sw(t)&&!jM.test(t)&&!qM.test(t)&&t.indexOf("#")!==0,"checkPattern"),QM=l(t=>t.split(zM),"splitPattern"),ow=class ow{constructor(e,r,i,n){this.origin=e,this.pattern=r,this.negative=i,this.regex=n}};l(ow,"IgnoreRule");var iw=ow,eL=l((t,e)=>{let r=t,i=!1;t.indexOf("!")===0&&(i=!0,t=t.substr(1)),t=t.replace(UM,"!").replace(WM,"#");let n=YM(t,e);return new iw(r,t,i,n)},"createRule"),tL=l((t,e)=>{throw new e(t)},"throwError"),Dr=l((t,e,r)=>sw(t)?t?Dr.isNotRelative(t)?r(`path should be a \`path.relative()\`d string, but got "${e}"`,RangeError):!0:r("path must not be empty",TypeError):r(`path must be a string, but got \`${e}\``,TypeError),"checkPath"),hT=l(t=>HM.test(t),"isNotRelative");Dr.isNotRelative=hT;Dr.convert=t=>t;var aw=class aw{constructor({ignorecase:e=!0,ignoreCase:r=e,allowRelativePaths:i=!1}={}){VM(this,cT,!0),this._rules=[],this._ignoreCase=r,this._allowRelativePaths=i,this._initCache()}_initCache(){this._ignoreCache=Object.create(null),this._testCache=Object.create(null)}_addPattern(e){if(e&&e[cT]){this._rules=this._rules.concat(e._rules),this._added=!0;return}if(ZM(e)){let r=eL(e,this._ignoreCase);this._added=!0,this._rules.push(r)}}add(e){return this._added=!1,oT(sw(e)?QM(e):e).forEach(this._addPattern,this),this._added&&this._initCache(),this}addPattern(e){return this.add(e)}_testOne(e,r){let i=!1,n=!1;return this._rules.forEach(s=>{let{negative:o}=s;if(n===o&&i!==n||o&&!i&&!n&&!r)return;s.regex.test(e)&&(i=!o,n=o)}),{ignored:i,unignored:n}}_test(e,r,i,n){let s=e&&Dr.convert(e);return Dr(s,e,this._allowRelativePaths?uT:tL),this._t(s,r,i,n)}_t(e,r,i,n){if(e in r)return r[e];if(n||(n=e.split(tw)),n.pop(),!n.length)return r[e]=this._testOne(e,i);let s=this._t(n.join(tw)+tw,r,i,n);return r[e]=s.ignored?s:this._testOne(e,i)}ignores(e){return this._test(e,this._ignoreCache,!1).ignored}createFilter(){return e=>!this.ignores(e)}filter(e){return oT(e).filter(this.createFilter())}test(e){return this._test(e,this._testCache,!0)}};l(aw,"Ignore");var nw=aw,$f=l(t=>new nw(t),"factory"),rL=l(t=>Dr(t&&Dr.convert(t),t,uT),"isPathValid");$f.isPathValid=rL;$f.default=$f;dT.exports=$f;if(typeof process<"u"&&(process.env&&process.env.IGNORE_TEST_WIN32||process.platform==="win32")){let t=l(r=>/^\\\\\?\\/.test(r)||/["<>|\u0000-\u001F]+/u.test(r)?r:r.replace(/\\/g,"/"),"makePosix");Dr.convert=t;let e=/^[a-z]:\//i;Dr.isNotRelative=r=>e.test(r)||hT(r)}});var wT=T((BJ,mT)=>{"use strict";function iL(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}l(iL,"escapeRegExp");function mr(t,e,r){return e=e instanceof RegExp?e:new RegExp(iL(e),"g"),t.replace(e,r)}l(mr,"replaceAll");var nL={clean:l(function(e){if(typeof e!="string")throw new Error("Expected a string, received: "+e);return e=mr(e,"./","/"),e=mr(e,"..","."),e=mr(e," ","-"),e=mr(e,/^[~^:?*\\\-]/g,""),e=mr(e,/[~^:?*\\]/g,"-"),e=mr(e,/[~^:?*\\\-]$/g,""),e=mr(e,"@{","-"),e=mr(e,/\.$/g,""),e=mr(e,/\/$/g,""),e=mr(e,/\.lock$/g,""),e},"clean")};mT.exports=nL});var gT=T((LJ,yT)=>{yT.exports=function(t,e){var r=t,i=e,n=r.length,s=i.length,o=!1,f=null,c=n+1,a=[],u=[],h=[],d="",p=-1,m=0,w=1,y,g,_=l(function(){n>=s&&(y=r,g=n,r=i,i=y,n=s,s=g,o=!0,c=n+1)},"init"),F=l(function(S,O,v){return{x:S,y:O,k:v}},"P"),E=l(function(S,O){return{elem:S,t:O}},"seselem"),R=l(function(S,O,v){var A,x,I;for(O>v?A=a[S-1+c]:A=a[S+1+c],I=Math.max(O,v),x=I-S;x<n&&I<s&&r[x]===i[I];)++x,++I;return a[S+c]=u.length,u[u.length]=new F(x,I,A),I},"snake"),P=l(function(S){var O,v,A,x,I;for(O=v=1,A=x=0,I=S.length-1;I>=0;--I)for(;A<S[I].x||x<S[I].y;)S[I].y-S[I].x>x-A?(o?h[h.length]=new E(i[x],p):h[h.length]=new E(i[x],w),++v,++x):S[I].y-S[I].x<x-A?(o?h[h.length]=new E(r[A],w):h[h.length]=new E(r[A],p),++O,++A):(h[h.length]=new E(r[A],m),d+=r[A],++O,++v,++A,++x)},"recordseq");return _(),{SES_DELETE:-1,SES_COMMON:0,SES_ADD:1,editdistance:l(function(){return f},"editdistance"),getlcs:l(function(){return d},"getlcs"),getses:l(function(){return h},"getses"),compose:l(function(){var S,O,v,A,x,I,M,z;for(S=s-n,O=n+s+3,v={},M=0;M<O;++M)v[M]=-1,a[M]=-1;A=-1;do{for(++A,z=-A;z<=S-1;++z)v[z+c]=R(z,v[z-1+c]+1,v[z+1+c]);for(z=S+A;z>=S+1;--z)v[z+c]=R(z,v[z-1+c]+1,v[z+1+c]);v[S+c]=R(S,v[S-1+c]+1,v[S+1+c])}while(v[S+c]!==s);for(f=S+2*A,x=a[S+c],I=[];x!==-1;)I[I.length]=new F(u[x].x,u[x].y,null),x=u[x].k;P(I)},"compose")}}});var ST=T((qJ,_T)=>{var sL=gT();function oL(t,e){var r=new sL(t,e);r.compose();for(var i=r.getses(),n,s,o=t.length-1,f=e.length-1,c=i.length-1;c>=0;--c)i[c].t===r.SES_COMMON?(s?(s.chain={file1index:o,file2index:f,chain:null},s=s.chain):(n={file1index:o,file2index:f,chain:null},s=n),o--,f--):i[c].t===r.SES_DELETE?o--:i[c].t===r.SES_ADD&&f--;var a={file1index:-1,file2index:-1,chain:null};return s?(s.chain=a,n):a}l(oL,"longestCommonSubsequence");function bT(t,e){for(var r=[],i=t.length,n=e.length,s=oL(t,e);s!==null;s=s.chain){var o=i-s.file1index-1,f=n-s.file2index-1;i=s.file1index,n=s.file2index,(o||f)&&r.push({file1:[i+1,o],file2:[n+1,f]})}return r.reverse(),r}l(bT,"diffIndices");function aL(t,e,r){var i,n=bT(e,t),s=bT(e,r),o=[];function f(M,z){o.push([M.file1[0],z,M.file1[1],M.file2[0],M.file2[1]])}for(l(f,"addHunk"),i=0;i<n.length;i++)f(n[i],0);for(i=0;i<s.length;i++)f(s[i],2);o.sort(function(M,z){return M[0]-z[0]});var c=[],a=0;function u(M){M>a&&(c.push([1,a,M-a]),a=M)}l(u,"copyCommon");for(var h=0;h<o.length;h++){for(var d=h,p=o[h],m=p[0],w=m+p[2];h<o.length-1;){var y=o[h+1],g=y[0];if(g>w)break;w=Math.max(w,g+y[2]),h++}if(u(m),d==h)p[4]>0&&c.push([p[1],p[3],p[4]]);else{var _={0:[t.length,-1,e.length,-1],2:[r.length,-1,e.length,-1]};for(i=d;i<=h;i++){p=o[i];var F=p[1],E=_[F],R=p[0],P=R+p[2],S=p[3],O=S+p[4];E[0]=Math.min(S,E[0]),E[1]=Math.max(O,E[1]),E[2]=Math.min(R,E[2]),E[3]=Math.max(P,E[3])}var v=_[0][0]+(m-_[0][2]),A=_[0][1]+(w-_[0][3]),x=_[2][0]+(m-_[2][2]),I=_[2][1]+(w-_[2][3]);c.push([-1,v,A-v,m,w-m,x,I-x])}a=w}return u(e.length),c}l(aL,"diff3MergeIndices");function cL(t,e,r){var i=[],n=[t,e,r],s=aL(t,e,r),o=[];function f(){o.length&&i.push({ok:o}),o=[]}l(f,"flushOk");function c(p){for(var m=0;m<p.length;m++)o.push(p[m])}l(c,"pushOk");function a(p){if(p[2]!=p[6])return!0;for(var m=p[1],w=p[5],y=0;y<p[2];y++)if(t[y+m]!=r[y+w])return!0;return!1}l(a,"isTrueConflict");for(var u=0;u<s.length;u++){var h=s[u],d=h[0];d==-1?a(h)?(f(),i.push({conflict:{a:t.slice(h[1],h[1]+h[2]),aIndex:h[1],o:e.slice(h[3],h[3]+h[4]),oIndex:h[3],b:r.slice(h[5],h[5]+h[6]),bIndex:h[5]}})):c(n[0].slice(h[1],h[1]+h[2])):c(n[d].slice(h[1],h[1]+h[2]))}return f(),i}l(cL,"diff3Merge");_T.exports=cL});var xe=T(B=>{"use strict";Object.defineProperty(B,"__esModule",{value:!0});function mi(t){return t&&typeof t=="object"&&"default"in t?t.default:t}l(mi,"_interopDefault");var Va=mi(Z_()),zT=mi(dE()),lL=mi(mE()),Cw=mi(rT()),cw=mi(sT()),fL=mi(pT()),Ga=mi(wT()),uL=mi(ST()),Jf=class Jf extends Error{constructor(e){super(e),this.caller=""}toJSON(){return{code:this.code,data:this.data,caller:this.caller,message:this.message,stack:this.stack}}fromJSON(e){let r=new Jf(e.message);return r.code=e.code,r.data=e.data,r.caller=e.caller,r.stack=e.stack,r}get isIsomorphicGitError(){return!0}};l(Jf,"BaseError");var te=Jf,Xf=class Xf extends te{constructor(e){super(`Modifying the index is not possible because you have unmerged files: ${e.toString}. Fix them up in the work tree, and then use 'git add/rm as appropriate to mark resolution and make a commit.`),this.code=this.name=Xf.code,this.data={filepaths:e}}};l(Xf,"UnmergedPathsError");var Ka=Xf;Ka.code="UnmergedPathsError";var Yf=class Yf extends te{constructor(e){super(`An internal error caused this command to fail.
|
|
9
|
+
`+t),"printJson");Qf.printJson=aB});var ew=x(hl=>{"use strict";Object.defineProperty(hl,"__esModule",{value:!0});var Qm=(Ff(),Yp(Ef));Qm.__exportStar(vS(),hl);Qm.__exportStar(SS(),hl);Qm.__exportStar(ES(),hl)});var FS=x(ct=>{"use strict";Object.defineProperty(ct,"__esModule",{value:!0});ct.newNotAllowedError=ct.newTypeMismatchError=ct.newNotFoundError=ct.assertCanWrite=ct.assertName=ct.basename=ct.ctx=void 0;var oB=u((t={})=>({separator:"/",syncHandleAllowed:!1,mode:"read",...t}),"ctx");ct.ctx=oB;var lB=u((t,e)=>{t[t.length-1]===e&&(t=t.slice(0,-1));let r=t.lastIndexOf(e);return r===-1?t:t.slice(r+1)},"basename");ct.basename=lB;var cB=/^(\.{1,2})$|^(.*([\/\\]).*)$/,fB=u((t,e,r)=>{if(!t||cB.test(t))throw new TypeError(`Failed to execute '${e}' on '${r}': Name is not allowed.`)},"assertName");ct.assertName=fB;var uB=u(t=>{if(t!=="readwrite")throw new DOMException("The request is not allowed by the user agent or the platform in the current context.","NotAllowedError")},"assertCanWrite");ct.assertCanWrite=uB;var hB=u(()=>new DOMException("A requested file or directory could not be found at the time an operation was processed.","NotFoundError"),"newNotFoundError");ct.newNotFoundError=hB;var dB=u(()=>new DOMException("The path supplied exists, but was not an entry of requested type.","TypeMismatchError"),"newTypeMismatchError");ct.newTypeMismatchError=dB;var pB=u(()=>new DOMException("Permission not granted.","NotAllowedError"),"newNotAllowedError");ct.newNotAllowedError=pB});var kS=x(dl=>{"use strict";Object.defineProperty(dl,"__esModule",{value:!0});dl.toTreeSync=void 0;var mB=ew(),wB=FS(),yB=u((t,e={})=>{let r=e.separator||"/",i=e.dir||r;i[i.length-1]!==r&&(i+=r);let n=e.tab||"",s=e.depth??10,a=" (...)";if(s>0){let c=t.readdirSync(i,{withFileTypes:!0});a=(0,mB.printTree)(n,c.map(o=>f=>o.isDirectory()?(0,dl.toTreeSync)(t,{dir:i+o.name,depth:s-1,tab:f}):o.isSymbolicLink()?""+o.name+" \u2192 "+t.readlinkSync(i+o.name):""+o.name))}return(0,wB.basename)(i,r)+r+a},"toTreeSync");dl.toTreeSync=yB});var OS=x(j=>{"use strict";Object.defineProperty(j,"__esModule",{value:!0});j.getWriteFileOptions=j.writeFileDefaults=j.getRealpathOptsAndCb=j.getRealpathOptions=j.getStatfsOptsAndCb=j.getStatfsOptions=j.getStatOptsAndCb=j.getStatOptions=j.getAppendFileOptsAndCb=j.getAppendFileOpts=j.getOpendirOptsAndCb=j.getOpendirOptions=j.getReaddirOptsAndCb=j.getReaddirOptions=j.getReadFileOptions=j.getRmOptsAndCb=j.getRmdirOptions=j.getDefaultOptsAndCb=j.getDefaultOpts=j.optsDefaults=j.getMkdirOptions=void 0;j.getOptions=xS;j.optsGenerator=Yr;j.optsAndCbGenerator=pn;var eu=ea(),gB=al(),tw=ki(),TS={mode:511,recursive:!1},bB=u(t=>typeof t=="number"?Object.assign({},TS,{mode:t}):Object.assign({},TS,t),"getMkdirOptions");j.getMkdirOptions=bB;var _B=u(t=>`Expected options to be either an object or a string, but got ${t} instead`,"ERRSTR_OPTS");function xS(t,e){let r;if(e){let i=typeof e;switch(i){case"string":r=Object.assign({},t,{encoding:e});break;case"object":r=Object.assign({},t,e);break;default:throw TypeError(_B(i))}}else return t;return r.encoding!=="buffer"&&(0,gB.assertEncoding)(r.encoding),r}u(xS,"getOptions");function Yr(t){return e=>xS(t,e)}u(Yr,"optsGenerator");function pn(t){return(e,r)=>typeof e=="function"?[t(),e]:[t(e),(0,tw.validateCallback)(r)]}u(pn,"optsAndCbGenerator");j.optsDefaults={encoding:"utf8"};j.getDefaultOpts=Yr(j.optsDefaults);j.getDefaultOptsAndCb=pn(j.getDefaultOpts);var vB={recursive:!1},SB=u(t=>Object.assign({},vB,t),"getRmdirOptions");j.getRmdirOptions=SB;var EB=Yr(j.optsDefaults);j.getRmOptsAndCb=pn(EB);var FB={flag:"r"};j.getReadFileOptions=Yr(FB);var kB={encoding:"utf8",recursive:!1,withFileTypes:!1};j.getReaddirOptions=Yr(kB);j.getReaddirOptsAndCb=pn(j.getReaddirOptions);var TB={encoding:"utf8",bufferSize:32,recursive:!1};j.getOpendirOptions=Yr(TB);j.getOpendirOptsAndCb=pn(j.getOpendirOptions);var xB={encoding:"utf8",mode:438,flag:eu.FLAGS[eu.FLAGS.a]};j.getAppendFileOpts=Yr(xB);j.getAppendFileOptsAndCb=pn(j.getAppendFileOpts);var OB={bigint:!1},RB=u((t={})=>Object.assign({},OB,t),"getStatOptions");j.getStatOptions=RB;var AB=u((t,e)=>typeof t=="function"?[(0,j.getStatOptions)(),t]:[(0,j.getStatOptions)(t),(0,tw.validateCallback)(e)],"getStatOptsAndCb");j.getStatOptsAndCb=AB;var PB={bigint:!1},NB=u((t={})=>Object.assign({},PB,t),"getStatfsOptions");j.getStatfsOptions=NB;var DB=u((t,e)=>typeof t=="function"?[(0,j.getStatfsOptions)(),t]:[(0,j.getStatfsOptions)(t),(0,tw.validateCallback)(e)],"getStatfsOptsAndCb");j.getStatfsOptsAndCb=DB;var CB=j.optsDefaults;j.getRealpathOptions=Yr(CB);j.getRealpathOptsAndCb=pn(j.getRealpathOptions);j.writeFileDefaults={encoding:"utf8",mode:438,flag:eu.FLAGS[eu.FLAGS.w]};j.getWriteFileOptions=Yr(j.writeFileDefaults)});var AS=x(tu=>{"use strict";Object.defineProperty(tu,"__esModule",{value:!0});tu.Dir=void 0;var RS=ki(),IB=bf(),mn=sl(),iw=class iw{constructor(e,r){this.link=e,this.options=r,this.iteratorInfo=[],this.closed=!1,this.operationQueue=null,this.path=e.getPath(),this.iteratorInfo.push(e.children[Symbol.iterator]())}closeBase(){}readBase(e){let r,i,n,s;do{do if({done:r,value:i}=e[e.length-1].next(),!r)[n,s]=i;else break;while(n==="."||n==="..");if(r){if(e.pop(),e.length===0)break;r=!1}else return this.options.recursive&&s.children.size&&e.push(s.children[Symbol.iterator]()),IB.default.build(s,this.options.encoding)}while(!r);return null}close(e){if(e===void 0)return this.closed?Promise.reject(new mn.Error("ERR_DIR_CLOSED")):new Promise((r,i)=>{this.close(n=>{n?i(n):r()})});if((0,RS.validateCallback)(e),this.closed){process.nextTick(e,new mn.Error("ERR_DIR_CLOSED"));return}if(this.operationQueue!==null){this.operationQueue.push(()=>{this.close(e)});return}this.closed=!0;try{this.closeBase(),process.nextTick(e)}catch(r){process.nextTick(e,r)}}closeSync(){if(this.closed)throw new mn.Error("ERR_DIR_CLOSED");if(this.operationQueue!==null)throw new mn.Error("ERR_DIR_CONCURRENT_OPERATION");this.closed=!0,this.closeBase()}read(e){if(e===void 0)return new Promise((r,i)=>{this.read((n,s)=>{n?i(n):r(s??null)})});if((0,RS.validateCallback)(e),this.closed){process.nextTick(e,new mn.Error("ERR_DIR_CLOSED"));return}if(this.operationQueue!==null){this.operationQueue.push(()=>{this.read(e)});return}this.operationQueue=[];try{let r=this.readBase(this.iteratorInfo);process.nextTick(()=>{let i=this.operationQueue;this.operationQueue=null;for(let n of i)n();e(null,r)})}catch(r){process.nextTick(()=>{let i=this.operationQueue;this.operationQueue=null;for(let n of i)n();e(r)})}}readSync(){if(this.closed)throw new mn.Error("ERR_DIR_CLOSED");if(this.operationQueue!==null)throw new mn.Error("ERR_DIR_CONCURRENT_OPERATION");return this.readBase(this.iteratorInfo)}[Symbol.asyncIterator](){return{next:u(async()=>{try{let e=await this.read();return e!==null?{done:!1,value:e}:{done:!0,value:void 0}}catch(e){throw e}},"next"),[Symbol.asyncIterator](){return this}}}};u(iw,"Dir");var rw=iw;tu.Dir=rw});var nw=x(Xr=>{"use strict";Object.defineProperty(Xr,"__esModule",{value:!0});Xr.toMatcher=Xr.toRegex=void 0;var $B=u(t=>/[.^$+{}()|\\]/.test(t)?`\\${t}`:t,"escapeRe"),BB=u((t,e,r,i)=>{let n=e,s=[],a="",l=1;for(;n<t.length&&l>0;){let f=t[n];if(f==="(")l++,a+=f,n++;else if(f===")")if(l--,l===0){s.push(a),n++;break}else a+=f,n++;else f==="|"&&l===1?(s.push(a),a="",n++):(a+=f,n++)}if(l!==0)return;let c="",o=s.length;for(let f=0;f<o;f++)c+=(c?"|":"")+(0,Xr.toRegex)(s[f],i).source.replace(/^\^/,"").replace(/\$$/,"");switch(r){case"?":return[`(?:${c})?`,n];case"*":return[`(?:${c})*`,n];case"+":return[`(?:${c})+`,n];case"@":return[`(?:${c})`,n];case"!":return[`(?!${c})[^/]*`,n]}},"parseExtGlob"),LB=u((t,e)=>{let r="",i=0,n=u(()=>{i++;let l=[],c="",o=!1;for(;i<t.length;){let h=t[i];if(h==="}"){l.push(c),i++,o=!0;break}if(h===","){l.push(c),c="",i++;continue}c+=h,i++}return o?`(?:${l.map(h=>(0,Xr.toRegex)(h,e).source.replace(/^\^/,"").replace(/\$$/,"")).join("|")})`:"\\{"+$B(c)},"parseBraceGroup"),s=!!e?.extglob;for(;i<t.length;){let l=t[i];if(s&&t[i+1]==="("&&(l==="?"||l==="*"||l==="+"||l==="@"||l==="!")){let c=BB(t,i+2,l,e);if(c){r+=c[0],i=c[1];continue}}switch(l){case"*":{if(t[i+1]==="*"){let c=i+2;for(;t[c]==="*";)c++;t[c]==="/"?(r+="(?:.*/)?",i=c+1):(r+=".*",i=c)}else r+="[^/]*",i++;break}case"?":r+="[^/]",i++;break;case"[":{let c="[";for(i++,i<t.length&&t[i]==="!"&&(c+="^",i++),i<t.length&&t[i]==="]"&&(c+="]",i++);i<t.length&&t[i]!=="]";){let o=t[i];c+=o==="\\"?"\\\\":o,i++}if(i<t.length&&t[i]==="]")c+="]",i++;else{r+="\\[";continue}r+=c;break}case"{":{r+=n();break}case"/":r+="/",i++;break;case".":case"^":case"$":case"+":case"(":case")":case"|":case"\\":r+=`\\${l}`,i++;break;default:r+=l,i++;break}}let a=e?.nocase?"i":"";return new RegExp("^"+r+"$",a)},"toRegex");Xr.toRegex=LB;var MB=/^\/(.{1,4096})\/([gimsuy]{0,6})$/,jB=u((t,e)=>{let r=[],i=Array.isArray(t)?t:[t];for(let n of i)if(typeof n=="string"){let s=MB.exec(n);if(s){let[,a,l]=s;r.push(new RegExp(a,l))}else r.push((0,Xr.toRegex)(n,e))}else r.push(n);return r.length?new Function("p","return "+r.map(n=>n+".test(p)").join("||")):()=>!1},"toMatcher");Xr.toMatcher=jB});var DS=x(aw=>{"use strict";Object.defineProperty(aw,"__esModule",{value:!0});aw.globSync=VB;var wn=Js(),qB=nw(),PS=ki(),UB=wn.posix.join,zB=wn.posix.relative,WB=wn.posix.resolve;function NS(t,e){return(0,qB.toRegex)(e).test(t)}u(NS,"matchesPattern");function HB(t,e){return e?typeof e=="function"?e(t):(Array.isArray(e)?e:[e]).some(i=>NS(t,i)):!1}u(HB,"isExcluded");function sw(t,e,r,i,n=0){let s=[],a=i.maxdepth??1/0,l=i.cwd?(0,PS.pathToFilename)(i.cwd):process.cwd();if(n>a)return s;try{let c=t.readdirSync(e,{withFileTypes:!0});for(let o of c){let f=UB(e,o.name.toString()),h=zB(l,f);if(HB(h,i.exclude))continue;if(r.some(p=>NS(h,p))&&s.push(h),o.isDirectory()&&n<a){let p=sw(t,f,r,i,n+1);s.push(...p)}}}catch{}return s}u(sw,"walkDirectory");function VB(t,e,r={}){let i=r.cwd?(0,PS.pathToFilename)(r.cwd):process.cwd(),n=WB(i),s={cwd:n,exclude:r.exclude,maxdepth:r.maxdepth,withFileTypes:r.withFileTypes||!1},a=[];if(wn.posix.isAbsolute(e)){let l=wn.posix.dirname(e),c=wn.posix.basename(e),o=sw(t,l,[c],{...s,cwd:l});a.push(...o.map(f=>wn.posix.resolve(l,f)))}else{let l=sw(t,n,[e],s);a.push(...l)}return a=[...new Set(a)].sort(),a}u(VB,"globSync")});var jS=x($t=>{"use strict";Object.defineProperty($t,"__esModule",{value:!0});$t.FSWatcher=$t.StatWatcher=$t.Volume=void 0;$t.pathToSteps=cL;$t.dataToStr=fL;$t.toUnixTimestamp=It;var $e=Js(),fw=pS(),ow=wm(),GB=bf(),ZB=mS(),aa=Si(),au=jm(),KB=wS(),ou=gS(),JB=lr(),BS=Vm(),yn=al(),YB=bS(),LS=gm(),XB=_S(),QB=kS(),iu=ea(),eL=sl(),te=OS(),N=ki(),tL=AS(),et=qf(),rL=$e.resolve,{O_SYMLINK:CS,F_OK:lw,R_OK:iL,W_OK:nL,X_OK:sL,COPYFILE_EXCL:aL,COPYFILE_FICLONE_FORCE:oL}=JB.constants,pQ=$e.posix?$e.posix.sep:$e.sep,ru=$e.posix?$e.posix.relative:$e.relative,cw=$e.posix?$e.posix.join:$e.join,IS=$e.posix?$e.posix.dirname:$e.dirname,$S=$e.posix?$e.posix.normalize:$e.normalize,lL=128;function cL(t){return(0,et.filenameToSteps)((0,N.pathToFilename)(t))}u(cL,"pathToSteps");function fL(t,e=yn.ENCODING_UTF8){return aa.Buffer.isBuffer(t)?t.toString(e):t instanceof Uint8Array?(0,aa.bufferFrom)(t).toString(e):String(t)}u(fL,"dataToStr");function It(t){if(typeof t=="string"&&+t==t)return+t;if(t instanceof Date)return t.getTime()/1e3;if(isFinite(t))return t<0?Date.now()/1e3:t;throw new Error("Cannot parse time: "+t)}u(It,"toUnixTimestamp");function na(t){if(typeof t!="number")throw TypeError(iu.ERRSTR.UID)}u(na,"validateUid");function sa(t){if(typeof t!="number")throw TypeError(iu.ERRSTR.GID)}u(sa,"validateGid");var uw=class uw{get promises(){if(this.promisesApi===null)throw new Error("Promise is not supported in this environment.");return this.promisesApi}constructor(e=new fw.Superblock){this._core=e,this.promisesApi=new XB.FsPromises(this,YB.FileHandle),this.openSync=(c,o,f=438)=>{let h=(0,N.modeToNumber)(f),d=(0,N.pathToFilename)(c),p=(0,N.flagsToNumber)(o);return this._core.open(d,p,h,!(p&CS))},this.open=(c,o,f,h)=>{let d=f,p=h;typeof f=="function"&&(d=438,p=f),d=d||438;let m=(0,N.modeToNumber)(d),w=(0,N.pathToFilename)(c),g=(0,N.flagsToNumber)(o);this.wrapAsync(this._core.open,[w,g,m,!(g&CS)],p)},this.closeSync=c=>{this._core.close(c)},this.close=(c,o)=>{(0,et.validateFd)(c);let f=this._core.getFileByFdOrThrow(c,"close");this.wrapAsync(this._core.close,[f.fd],o)},this.readSync=(c,o,f,h,d)=>((0,et.validateFd)(c),this._core.read(c,o,f,h,d)),this.read=(c,o,f,h,d,p)=>{if((0,N.validateCallback)(p),h===0)return(0,au.default)(()=>{p&&p(null,0,o)});Promise.resolve().then(()=>{try{let m=this._core.read(c,o,f,h,d);p(null,m,o)}catch(m){p(m)}})},this.readv=(c,o,f,h)=>{let d=f,p=h;typeof f=="function"&&([d,p]=[null,f]),(0,N.validateCallback)(p),Promise.resolve().then(()=>{try{let m=this._core.readv(c,o,d);p(null,m,o)}catch(m){p(m)}})},this.readvSync=(c,o,f)=>((0,et.validateFd)(c),this._core.readv(c,o,f??null)),this._readfile=(c,o,f)=>{let h,p=typeof c=="number"&&(0,et.isFd)(c),m;if(p)m=c;else{let w=(0,N.pathToFilename)(c),g=String(c),b=g.length>1&&g.endsWith("/"),_=this._core.getResolvedLinkOrThrow(w,"open"),S=_.getNode();if(S.isDirectory())throw(0,N.createError)("EISDIR","open",_.getPath());if(b&&S.isFile())throw(0,N.createError)("ENOTDIR","open",g);m=this.openSync(c,o)}try{h=(0,N.bufferToEncoding)(this._core.getFileByFdOrThrow(m).getBuffer(),f)}finally{p||this.closeSync(m)}return h},this.readFileSync=(c,o)=>{let f=(0,te.getReadFileOptions)(o),h=(0,N.flagsToNumber)(f.flag);return this._readfile(c,h,f.encoding)},this.readFile=(c,o,f)=>{let[h,d]=(0,te.optsAndCbGenerator)(te.getReadFileOptions)(o,f),p=(0,N.flagsToNumber)(h.flag);this.wrapAsync(this._readfile,[c,p,h.encoding],d)},this.writeSync=(c,o,f,h,d)=>{let[,p,m,w,g]=(0,N.getWriteSyncArgs)(c,o,f,h,d);return this._write(c,p,m,w,g)},this.write=(c,o,f,h,d,p)=>{let[,m,w,g,b,_,S]=(0,N.getWriteArgs)(c,o,f,h,d,p);Promise.resolve().then(()=>{try{let F=this._write(c,w,g,b,_);m?S(null,F,o):S(null,F,w)}catch(F){S(F)}})},this.writev=(c,o,f,h)=>{let d=f,p=h;typeof f=="function"&&([d,p]=[null,f]),(0,N.validateCallback)(p),Promise.resolve().then(()=>{try{let m=this.writevBase(c,o,d);p(null,m,o)}catch(m){p(m)}})},this.writevSync=(c,o,f)=>((0,et.validateFd)(c),this.writevBase(c,o,f??null)),this.writeFileSync=(c,o,f)=>{let h=(0,te.getWriteFileOptions)(f),d=(0,N.flagsToNumber)(h.flag),p=(0,N.modeToNumber)(h.mode),m=(0,et.dataToBuffer)(o,h.encoding);this._core.writeFile(c,m,d,p)},this.writeFile=(c,o,f,h)=>{let d=f,p=h;typeof f=="function"&&([d,p]=[te.writeFileDefaults,f]);let m=(0,N.validateCallback)(p),w=(0,te.getWriteFileOptions)(d),g=(0,N.flagsToNumber)(w.flag),b=(0,N.modeToNumber)(w.mode),_=(0,et.dataToBuffer)(o,w.encoding);this.wrapAsync(this._core.writeFile,[c,_,g,b],m)},this.copyFileSync=(c,o,f)=>{let h=(0,N.pathToFilename)(c),d=(0,N.pathToFilename)(o);return this._copyFile(h,d,(f||0)|0)},this.copyFile=(c,o,f,h)=>{let d=(0,N.pathToFilename)(c),p=(0,N.pathToFilename)(o),m,w;typeof f=="function"?[m,w]=[0,f]:[m,w]=[f,h],(0,N.validateCallback)(w),this.wrapAsync(this._copyFile,[d,p,m],w)},this._cp=(c,o,f)=>{if(f.filter&&!f.filter(c,o))return;let h=f.dereference?this.statSync(c):this.lstatSync(c),d=null;try{d=this.lstatSync(o)}catch(p){if(p.code!=="ENOENT")throw p}if(d&&h.ino===d.ino&&h.dev===d.dev)throw(0,N.createError)("EINVAL","cp",c,o);if(d){if(h.isDirectory()&&!d.isDirectory())throw(0,N.createError)("EISDIR","cp",c,o);if(!h.isDirectory()&&d.isDirectory())throw(0,N.createError)("ENOTDIR","cp",c,o)}if(h.isDirectory()&&this.isSrcSubdir(c,o))throw(0,N.createError)("EINVAL","cp",c,o);{let p=IS(o);this.existsSync(p)||this.mkdirSync(p,{recursive:!0})}if(h.isDirectory()){if(!f.recursive)throw(0,N.createError)("EISDIR","cp",c);this.cpDirSync(h,d,c,o,f)}else if(h.isFile()||h.isCharacterDevice()||h.isBlockDevice())this.cpFileSync(h,d,c,o,f);else if(h.isSymbolicLink()&&!f.dereference)this.cpSymlinkSync(d,c,o,f);else throw(0,N.createError)("EINVAL","cp",c)},this.linkSync=(c,o)=>{let f=(0,N.pathToFilename)(c),h=(0,N.pathToFilename)(o);this._core.link(f,h)},this.link=(c,o,f)=>{let h=(0,N.pathToFilename)(c),d=(0,N.pathToFilename)(o);this.wrapAsync(this._core.link,[h,d],f)},this.unlinkSync=c=>{let o=(0,N.pathToFilename)(c);this._core.unlink(o)},this.unlink=(c,o)=>{let f=(0,N.pathToFilename)(c);this.wrapAsync(this._core.unlink,[f],o)},this.symlinkSync=(c,o,f)=>{let h=(0,N.pathToFilename)(c),d=(0,N.pathToFilename)(o);this._core.symlink(h,d)},this.symlink=(c,o,f,h)=>{let d=(0,N.validateCallback)(typeof f=="function"?f:h),p=(0,N.pathToFilename)(c),m=(0,N.pathToFilename)(o);this.wrapAsync(this._core.symlink,[p,m],d)},this._lstat=(c,o=!1,f=!1)=>{let h;try{h=this._core.getLinkOrThrow(c,"lstat")}catch(d){if(d.code==="ENOENT"&&!f)return;throw d}return ow.default.build(h.getNode(),o)},this.lstatSync=(c,o)=>{let{throwIfNoEntry:f=!0,bigint:h=!1}=(0,te.getStatOptions)(o);return this._lstat((0,N.pathToFilename)(c),h,f)},this.renameSync=(c,o)=>{let f=(0,N.pathToFilename)(c),h=(0,N.pathToFilename)(o);this._core.rename(f,h)},this.rename=(c,o,f)=>{let h=(0,N.pathToFilename)(c),d=(0,N.pathToFilename)(o);this.wrapAsync(this._core.rename,[h,d],f)},this.existsSync=c=>{try{return this._exists((0,N.pathToFilename)(c))}catch{return!1}},this.exists=(c,o)=>{let f=(0,N.pathToFilename)(c);if(typeof o!="function")throw Error(iu.ERRSTR.CB);Promise.resolve().then(()=>{try{o(this._exists(f))}catch{o(!1)}})},this.accessSync=(c,o=lw)=>{let f=(0,N.pathToFilename)(c);o=o|0,this._access(f,o)},this.access=(c,o,f)=>{let h=lw,d;typeof o!="function"?[h,d]=[o|0,(0,N.validateCallback)(f)]:d=o;let p=(0,N.pathToFilename)(c);this.wrapAsync(this._access,[p,h],d)},this.appendFileSync=(c,o,f)=>{let h=(0,te.getAppendFileOpts)(f);(!h.flag||(0,et.isFd)(c))&&(h.flag="a"),this.writeFileSync(c,o,h)},this.appendFile=(c,o,f,h)=>{let[d,p]=(0,te.getAppendFileOptsAndCb)(f,h);(!d.flag||(0,et.isFd)(c))&&(d.flag="a"),this.writeFile(c,o,d,p)},this._readdir=(c,o)=>{let f=(0,et.filenameToSteps)(c),h=this._core.getResolvedLinkOrThrow(c,"scandir"),d=h.getNode();if(!d.isDirectory())throw(0,N.createError)("ENOTDIR","scandir",c);if(!d.canRead())throw(0,N.createError)("EACCES","scandir",c);let p=[];for(let w of h.children.keys()){let g=h.getChild(w);if(!(!g||w==="."||w==="..")&&(p.push(GB.default.build(g,o.encoding)),o.recursive&&g.children.size)){let b={...o,recursive:!0,withFileTypes:!0},_=this._readdir(g.getPath(),b);p.push(..._)}}if(!et.isWin&&o.encoding!=="buffer"&&p.sort((w,g)=>w.name<g.name?-1:w.name>g.name?1:0),o.withFileTypes)return p;let m=c;return et.isWin&&(m=m.replace(/\\/g,"/")),p.map(w=>{if(o.recursive){let g=cw(w.parentPath,w.name.toString());return et.isWin&&(g=g.replace(/\\/g,"/")),g.replace(m+$e.posix.sep,"")}return w.name})},this.readdirSync=(c,o)=>{let f=(0,te.getReaddirOptions)(o),h=(0,N.pathToFilename)(c);return this._readdir(h,f)},this.readdir=(c,o,f)=>{let[h,d]=(0,te.getReaddirOptsAndCb)(o,f),p=(0,N.pathToFilename)(c);this.wrapAsync(this._readdir,[p,h],d)},this._readlink=(c,o)=>{let h=this._core.getLinkOrThrow(c,"readlink").getNode();if(!h.isSymlink())throw(0,N.createError)("EINVAL","readlink",c);return(0,yn.strToEncoding)(h.symlink,o)},this.readlinkSync=(c,o)=>{let f=(0,te.getDefaultOpts)(o),h=(0,N.pathToFilename)(c);return this._readlink(h,f.encoding)},this.readlink=(c,o,f)=>{let[h,d]=(0,te.getDefaultOptsAndCb)(o,f),p=(0,N.pathToFilename)(c);this.wrapAsync(this._readlink,[p,h.encoding],d)},this._fsync=c=>{this._core.getFileByFdOrThrow(c,"fsync")},this.fsyncSync=c=>{this._fsync(c)},this.fsync=(c,o)=>{this.wrapAsync(this._fsync,[c],o)},this._fdatasync=c=>{this._core.getFileByFdOrThrow(c,"fdatasync")},this.fdatasyncSync=c=>{this._fdatasync(c)},this.fdatasync=(c,o)=>{this.wrapAsync(this._fdatasync,[c],o)},this._ftruncate=(c,o)=>{this._core.getFileByFdOrThrow(c,"ftruncate").truncate(o)},this.ftruncateSync=(c,o)=>{this._ftruncate(c,o)},this.ftruncate=(c,o,f)=>{let h=typeof o=="number"?o:0,d=(0,N.validateCallback)(typeof o=="number"?f:o);this.wrapAsync(this._ftruncate,[c,h],d)},this._truncate=(c,o)=>{let f=this.openSync(c,"r+");try{this.ftruncateSync(f,o)}finally{this.closeSync(f)}},this.truncateSync=(c,o)=>{if((0,et.isFd)(c))return this.ftruncateSync(c,o);this._truncate(c,o)},this.truncate=(c,o,f)=>{let h=typeof o=="number"?o:0,d=(0,N.validateCallback)(typeof o=="number"?f:o);if((0,et.isFd)(c))return this.ftruncate(c,h,d);this.wrapAsync(this._truncate,[c,h],d)},this._futimes=(c,o,f)=>{let d=this._core.getFileByFdOrThrow(c,"futimes").node;d.atime=new Date(o*1e3),d.mtime=new Date(f*1e3)},this.futimesSync=(c,o,f)=>{this._futimes(c,It(o),It(f))},this.futimes=(c,o,f,h)=>{this.wrapAsync(this._futimes,[c,It(o),It(f)],h)},this._utimes=(c,o,f,h=!0)=>{let d=this._core,m=(h?d.getResolvedLinkOrThrow(c,"utimes"):d.getLinkOrThrow(c,"lutimes")).getNode();m.atime=new Date(o*1e3),m.mtime=new Date(f*1e3)},this.utimesSync=(c,o,f)=>{this._utimes((0,N.pathToFilename)(c),It(o),It(f),!0)},this.utimes=(c,o,f,h)=>{this.wrapAsync(this._utimes,[(0,N.pathToFilename)(c),It(o),It(f),!0],h)},this.lutimesSync=(c,o,f)=>{this._utimes((0,N.pathToFilename)(c),It(o),It(f),!1)},this.lutimes=(c,o,f,h)=>{this.wrapAsync(this._utimes,[(0,N.pathToFilename)(c),It(o),It(f),!1],h)},this.mkdirSync=(c,o)=>{let f=(0,te.getMkdirOptions)(o),h=(0,N.modeToNumber)(f.mode,511),d=(0,N.pathToFilename)(c);if(f.recursive)return this._core.mkdirp(d,h);this._core.mkdir(d,h)},this.mkdir=(c,o,f)=>{let h=(0,te.getMkdirOptions)(o),d=(0,N.validateCallback)(typeof o=="function"?o:f),p=(0,N.modeToNumber)(h.mode,511),m=(0,N.pathToFilename)(c);h.recursive?this.wrapAsync(this._core.mkdirp,[m,p],d):this.wrapAsync(this._core.mkdir,[m,p],d)},this._mkdtemp=(c,o,f=5)=>{let h=c+(0,N.genRndStr6)();try{return this._core.mkdir(h,511),(0,yn.strToEncoding)(h,o)}catch(d){if(d.code==="EEXIST"){if(f>1)return this._mkdtemp(c,o,f-1);throw Error("Could not create temp dir.")}else throw d}},this.mkdtempSync=(c,o)=>{let{encoding:f}=(0,te.getDefaultOpts)(o);if(!c||typeof c!="string")throw new TypeError("filename prefix is required");return(0,N.nullCheck)(c),this._mkdtemp(c,f)},this.mkdtemp=(c,o,f)=>{let[{encoding:h},d]=(0,te.getDefaultOptsAndCb)(o,f);if(!c||typeof c!="string")throw new TypeError("filename prefix is required");(0,N.nullCheck)(c)&&this.wrapAsync(this._mkdtemp,[c,h],d)},this.rmdirSync=(c,o)=>{let f=(0,te.getRmdirOptions)(o);this._core.rmdir((0,N.pathToFilename)(c),f.recursive)},this.rmdir=(c,o,f)=>{let h=(0,te.getRmdirOptions)(o),d=(0,N.validateCallback)(typeof o=="function"?o:f);this.wrapAsync(this._core.rmdir,[(0,N.pathToFilename)(c),h.recursive],d)},this.rmSync=(c,o)=>{this._core.rm((0,N.pathToFilename)(c),o?.force,o?.recursive)},this.rm=(c,o,f)=>{let[h,d]=(0,te.getRmOptsAndCb)(o,f);this.wrapAsync(this._core.rm,[(0,N.pathToFilename)(c),h?.force,h?.recursive],d)},this._fchmod=(c,o)=>{this._core.getFileByFdOrThrow(c,"fchmod").chmod(o)},this.fchmodSync=(c,o)=>{this._fchmod(c,(0,N.modeToNumber)(o))},this.fchmod=(c,o,f)=>{this.wrapAsync(this._fchmod,[c,(0,N.modeToNumber)(o)],f)},this._chmod=(c,o,f=!0)=>{(f?this._core.getResolvedLinkOrThrow(c,"chmod"):this._core.getLinkOrThrow(c,"chmod")).getNode().chmod(o)},this.chmodSync=(c,o)=>{let f=(0,N.modeToNumber)(o),h=(0,N.pathToFilename)(c);this._chmod(h,f,!0)},this.chmod=(c,o,f)=>{let h=(0,N.modeToNumber)(o),d=(0,N.pathToFilename)(c);this.wrapAsync(this._chmod,[d,h],f)},this._lchmod=(c,o)=>{this._chmod(c,o,!1)},this.lchmodSync=(c,o)=>{let f=(0,N.modeToNumber)(o),h=(0,N.pathToFilename)(c);this._lchmod(h,f)},this.lchmod=(c,o,f)=>{let h=(0,N.modeToNumber)(o),d=(0,N.pathToFilename)(c);this.wrapAsync(this._lchmod,[d,h],f)},this._fchown=(c,o,f)=>{this._core.getFileByFdOrThrow(c,"fchown").chown(o,f)},this.fchownSync=(c,o,f)=>{na(o),sa(f),this._fchown(c,o,f)},this.fchown=(c,o,f,h)=>{na(o),sa(f),this.wrapAsync(this._fchown,[c,o,f],h)},this._chown=(c,o,f)=>{this._core.getResolvedLinkOrThrow(c,"chown").getNode().chown(o,f)},this.chownSync=(c,o,f)=>{na(o),sa(f),this._chown((0,N.pathToFilename)(c),o,f)},this.chown=(c,o,f,h)=>{na(o),sa(f),this.wrapAsync(this._chown,[(0,N.pathToFilename)(c),o,f],h)},this._lchown=(c,o,f)=>{this._core.getLinkOrThrow(c,"lchown").getNode().chown(o,f)},this.lchownSync=(c,o,f)=>{na(o),sa(f),this._lchown((0,N.pathToFilename)(c),o,f)},this.lchown=(c,o,f,h)=>{na(o),sa(f),this.wrapAsync(this._lchown,[(0,N.pathToFilename)(c),o,f],h)},this.statWatchers={},this.cpSync=(c,o,f)=>{let h=(0,N.pathToFilename)(c),d=(0,N.pathToFilename)(o),p={dereference:f?.dereference??!1,errorOnExist:f?.errorOnExist??!1,filter:f?.filter,force:f?.force??!0,mode:f?.mode??0,preserveTimestamps:f?.preserveTimestamps??!1,recursive:f?.recursive??!1,verbatimSymlinks:f?.verbatimSymlinks??!1};return this._cp(h,d,p)},this.cp=(c,o,f,h)=>{let d=(0,N.pathToFilename)(c),p=(0,N.pathToFilename)(o),m,w;typeof f=="function"?[m,w]=[{},f]:[m,w]=[f||{},h],(0,N.validateCallback)(w);let g={dereference:m?.dereference??!1,errorOnExist:m?.errorOnExist??!1,filter:m?.filter,force:m?.force??!0,mode:m?.mode??0,preserveTimestamps:m?.preserveTimestamps??!1,recursive:m?.recursive??!1,verbatimSymlinks:m?.verbatimSymlinks??!1};this.wrapAsync(this._cp,[d,p,g],w)},this.openAsBlob=async(c,o)=>{let f=(0,N.pathToFilename)(c),h;try{h=this._core.getResolvedLinkOrThrow(f,"open")}catch(w){throw w&&typeof w=="object"&&w.code==="ENOENT"?new eL.TypeError("ERR_INVALID_ARG_VALUE"):w}let p=h.getNode().getBuffer(),m=o?.type||"";return new Blob([p],{type:m})},this.glob=(c,...o)=>{let[f,h]=o.length===1?[{},o[0]]:[o[0],o[1]];this.wrapAsync(this._globSync,[c,f||{}],h)},this.globSync=(c,o={})=>this._globSync(c,o),this._globSync=(c,o={})=>{let{globSync:f}=DS();return f(this,c,o)},this._opendir=(c,o)=>{let f=this._core.getResolvedLinkOrThrow(c,"scandir");if(!f.getNode().isDirectory())throw(0,N.createError)("ENOTDIR","scandir",c);return new tL.Dir(f,o)},this.opendirSync=(c,o)=>{let f=(0,te.getOpendirOptions)(o),h=(0,N.pathToFilename)(c);return this._opendir(h,f)},this.opendir=(c,o,f)=>{let[h,d]=(0,te.getOpendirOptsAndCb)(o,f),p=(0,N.pathToFilename)(c);this.wrapAsync(this._opendir,[p,h],d)};let r=this;this.StatWatcher=class extends nu{constructor(){super(r)}};let i=kr;this.ReadStream=class extends i{constructor(...c){super(r,...c)}};let n=Yt;this.WriteStream=class extends n{constructor(...c){super(r,...c)}},this.FSWatcher=class extends su{constructor(){super(r)}};let s=u((c,o)=>{let f=this._core.getResolvedLinkOrThrow(c,"realpath");return(0,yn.strToEncoding)(f.getPath()||"/",o)},"_realpath"),a=u((c,o,f)=>{let[h,d]=(0,te.getRealpathOptsAndCb)(o,f),p=(0,N.pathToFilename)(c);r.wrapAsync(s,[p,h.encoding],d)},"realpathImpl"),l=u((c,o)=>s((0,N.pathToFilename)(c),(0,te.getRealpathOptions)(o).encoding),"realpathSyncImpl");this.realpath=a,this.realpath.native=a,this.realpathSync=l,this.realpathSync.native=l}wrapAsync(e,r,i){(0,N.validateCallback)(i),Promise.resolve().then(()=>{let n;try{n=e.apply(this,r)}catch(s){i(s);return}i(null,n)})}toTree(e={separator:$e.sep}){return(0,QB.toTreeSync)(this,e)}reset(){this._core.reset()}toJSON(e,r={},i=!1,n=!1){return this._core.toJSON(e,r,i,n)}fromJSON(e,r){return this._core.fromJSON(e,r)}fromNestedJSON(e,r){return this._core.fromNestedJSON(e,r)}mountSync(e,r){this._core.fromJSON(r,e)}_write(e,r,i,n,s){let a=this._core.getFileByFdOrThrow(e,"write");if(a.node.isSymlink())throw(0,N.createError)("EBADF","write",a.link.getPath());return a.write(r,i,n,s===-1||typeof s!="number"?void 0:s)}writevBase(e,r,i){let n=this._core.getFileByFdOrThrow(e),s=i??void 0;s===-1&&(s=void 0);let a=0;for(let l of r){let c=aa.Buffer.from(l.buffer,l.byteOffset,l.byteLength),o=n.write(c,0,c.byteLength,s);if(s=void 0,a+=o,o<c.byteLength)break}return a}_copyFile(e,r,i){let n=this.readFileSync(e);if(i&aL&&this.existsSync(r))throw(0,N.createError)("EEXIST","copyFile",e,r);if(i&oL)throw(0,N.createError)("ENOSYS","copyFile",e,r);this._core.writeFile(r,n,iu.FLAGS.w,438)}isSrcSubdir(e,r){try{let i=$S(e.startsWith("/")?e:"/"+e),n=$S(r.startsWith("/")?r:"/"+r);if(i===n)return!0;let s=ru(i,n);return s===""||!s.startsWith("..")&&!(0,$e.isAbsolute)(s)}catch{return!1}}cpFileSync(e,r,i,n,s){if(r){if(s.errorOnExist)throw(0,N.createError)("EEXIST","cp",n);if(!s.force)return;this.unlinkSync(n)}this.copyFileSync(i,n,s.mode),s.preserveTimestamps&&this.utimesSync(n,e.atime,e.mtime),this.chmodSync(n,Number(e.mode))}cpDirSync(e,r,i,n,s){r||this.mkdirSync(n);let a=this.readdirSync(i);for(let l of a){let c=cw(i,String(l)),o=cw(n,String(l));s.filter&&!s.filter(c,o)||this._cp(c,o,s)}this.chmodSync(n,Number(e.mode))}cpSymlinkSync(e,r,i,n){let s=String(this.readlinkSync(r));!n.verbatimSymlinks&&!(0,$e.isAbsolute)(s)&&(s=rL(IS(r),s)),e&&this.unlinkSync(i),this.symlinkSync(s,i)}lstat(e,r,i){let[{throwIfNoEntry:n=!0,bigint:s=!1},a]=(0,te.getStatOptsAndCb)(r,i);this.wrapAsync(this._lstat,[(0,N.pathToFilename)(e),s,n],a)}_stat(e,r=!1,i=!0){let n;try{n=this._core.getResolvedLinkOrThrow(e,"stat")}catch(s){if(s.code==="ENOENT"&&!i)return;throw s}return ow.default.build(n.getNode(),r)}statSync(e,r){let{bigint:i=!0,throwIfNoEntry:n=!0}=(0,te.getStatOptions)(r);return this._stat((0,N.pathToFilename)(e),i,n)}stat(e,r,i){let[{bigint:n=!1,throwIfNoEntry:s=!0},a]=(0,te.getStatOptsAndCb)(r,i);this.wrapAsync(this._stat,[(0,N.pathToFilename)(e),n,s],a)}fstatBase(e,r=!1){let i=this._core.getFileByFd(e);if(!i)throw(0,N.createError)("EBADF","fstat");return ow.default.build(i.node,r)}fstatSync(e,r){return this.fstatBase(e,(0,te.getStatOptions)(r).bigint)}fstat(e,r,i){let[n,s]=(0,te.getStatOptsAndCb)(r,i);this.wrapAsync(this.fstatBase,[e,n.bigint],s)}_exists(e){return!!this._stat(e)}_access(e,r){let n=this._core.getLinkOrThrow(e,"access").getNode();if(r!==lw&&(r&iL&&!n.canRead()||r&nL&&!n.canWrite()||r&sL&&!n.canExecute()))throw(0,N.createError)("EACCES","access",e)}watchFile(e,r,i){let n=(0,N.pathToFilename)(e),s=r,a=i;if(typeof s=="function"&&(a=r,s=null),typeof a!="function")throw Error('"watchFile()" requires a listener function');let l=5007,c=!0;s&&typeof s=="object"&&(typeof s.interval=="number"&&(l=s.interval),typeof s.persistent=="boolean"&&(c=s.persistent));let o=this.statWatchers[n];return o||(o=new this.StatWatcher,o.start(n,c,l),this.statWatchers[n]=o),o.addListener("change",a),o}unwatchFile(e,r){let i=(0,N.pathToFilename)(e),n=this.statWatchers[i];n&&(typeof r=="function"?n.removeListener("change",r):n.removeAllListeners("change"),n.listenerCount("change")===0&&(n.stop(),delete this.statWatchers[i]))}createReadStream(e,r){return new this.ReadStream(e,r)}createWriteStream(e,r){return new this.WriteStream(e,r)}watch(e,r,i){let n=(0,N.pathToFilename)(e),s=r;typeof r=="function"&&(i=r,s=null);let{persistent:a,recursive:l,encoding:c}=(0,te.getDefaultOpts)(s);a===void 0&&(a=!0),l===void 0&&(l=!1);let o=new this.FSWatcher;return o.start(n,a,l,c),i&&o.addListener("change",i),o}_statfs(e,r=!1){return this._core.getResolvedLinkOrThrow(e,"statfs"),ZB.default.build(this._core,r)}statfsSync(e,r){let{bigint:i=!1}=(0,te.getStatfsOptions)(r);return this._statfs((0,N.pathToFilename)(e),i)}statfs(e,r,i){let[{bigint:n=!1},s]=(0,te.getStatfsOptsAndCb)(r,i);this.wrapAsync(this._statfs,[(0,N.pathToFilename)(e),n],s)}};u(uw,"Volume");var gn=uw;$t.Volume=gn;gn.fromJSON=(t,e)=>new gn(fw.Superblock.fromJSON(t,e));gn.fromNestedJSON=(t,e)=>new gn(fw.Superblock.fromNestedJSON(t,e));function uL(t){t.emit("stop")}u(uL,"emitStop");var hw=class hw extends BS.EventEmitter{constructor(e){super(),this.onInterval=()=>{try{let r=this.vol.statSync(this.filename);this.hasChanged(r)&&(this.emit("change",r,this.prev),this.prev=r)}finally{this.loop()}},this.vol=e}loop(){this.timeoutRef=this.setTimeout(this.onInterval,this.interval)}hasChanged(e){return e.mtimeMs>this.prev.mtimeMs||e.nlink!==this.prev.nlink}start(e,r=!0,i=5007){this.filename=(0,N.pathToFilename)(e),this.setTimeout=r?setTimeout.bind(globalThis):KB.default,this.interval=i,this.prev=this.vol.statSync(this.filename),this.loop()}stop(){clearTimeout(this.timeoutRef),(0,au.default)(()=>{uL.call(this,this)})}};u(hw,"StatWatcher");var nu=hw;$t.StatWatcher=nu;var Jt;function hL(t){Jt=(0,aa.bufferAllocUnsafe)(t),Jt.used=0}u(hL,"allocNewPool");(0,LS.inherits)(kr,ou.Readable);$t.ReadStream=kr;function kr(t,e,r){if(!(this instanceof kr))return new kr(t,e,r);if(this._vol=t,r=Object.assign({},(0,te.getOptions)(r,{})),r.highWaterMark===void 0&&(r.highWaterMark=64*1024),ou.Readable.call(this,r),this.path=(0,N.pathToFilename)(e),this.fd=r.fd===void 0?null:typeof r.fd!="number"?r.fd.fd:r.fd,this.flags=r.flags===void 0?"r":r.flags,this.mode=r.mode===void 0?438:r.mode,this.start=r.start,this.end=r.end,this.autoClose=r.autoClose===void 0?!0:r.autoClose,this.pos=void 0,this.bytesRead=0,this.start!==void 0){if(typeof this.start!="number")throw new TypeError('"start" option must be a Number');if(this.end===void 0)this.end=1/0;else if(typeof this.end!="number")throw new TypeError('"end" option must be a Number');if(this.start>this.end)throw new Error('"start" option must be <= "end" option');this.pos=this.start}typeof this.fd!="number"&&this.open(),this.on("end",function(){this.autoClose&&this.destroy&&this.destroy()})}u(kr,"FsReadStream");kr.prototype.open=function(){var t=this;this._vol.open(this.path,this.flags,this.mode,(e,r)=>{if(e){t.autoClose&&t.destroy&&t.destroy(),t.emit("error",e);return}t.fd=r,t.emit("open",r),t.read()})};kr.prototype._read=function(t){if(typeof this.fd!="number")return this.once("open",function(){this._read(t)});if(this.destroyed)return;(!Jt||Jt.length-Jt.used<lL)&&hL(this._readableState.highWaterMark);var e=Jt,r=Math.min(Jt.length-Jt.used,t),i=Jt.used;if(this.pos!==void 0&&(r=Math.min(this.end-this.pos+1,r)),r<=0)return this.push(null);var n=this;this._vol.read(this.fd,Jt,Jt.used,r,this.pos,s),this.pos!==void 0&&(this.pos+=r),Jt.used+=r;function s(a,l){if(a)n.autoClose&&n.destroy&&n.destroy(),n.emit("error",a);else{var c=null;l>0&&(n.bytesRead+=l,c=e.slice(i,i+l)),n.push(c)}}u(s,"onread")};kr.prototype._destroy=function(t,e){this.close(r=>{e(t||r)})};kr.prototype.close=function(t){if(t&&this.once("close",t),this.closed||typeof this.fd!="number"){if(typeof this.fd!="number"){this.once("open",MS);return}return(0,au.default)(()=>this.emit("close"))}typeof this._readableState?.closed=="boolean"?this._readableState.closed=!0:this.closed=!0,this._vol.close(this.fd,e=>{e?this.emit("error",e):this.emit("close")}),this.fd=null};function MS(t){this.close()}u(MS,"closeOnOpen");(0,LS.inherits)(Yt,ou.Writable);$t.WriteStream=Yt;function Yt(t,e,r){if(!(this instanceof Yt))return new Yt(t,e,r);if(this._vol=t,r=Object.assign({},(0,te.getOptions)(r,{})),ou.Writable.call(this,r),this.path=(0,N.pathToFilename)(e),this.fd=r.fd===void 0?null:typeof r.fd!="number"?r.fd.fd:r.fd,this.flags=r.flags===void 0?"w":r.flags,this.mode=r.mode===void 0?438:r.mode,this.start=r.start,this.autoClose=r.autoClose===void 0?!0:!!r.autoClose,this.pos=void 0,this.bytesWritten=0,this.pending=!0,this.start!==void 0){if(typeof this.start!="number")throw new TypeError('"start" option must be a Number');if(this.start<0)throw new Error('"start" must be >= zero');this.pos=this.start}r.encoding&&this.setDefaultEncoding(r.encoding),typeof this.fd!="number"&&this.open(),this.once("finish",function(){this.autoClose&&this.close()})}u(Yt,"FsWriteStream");Yt.prototype.open=function(){this._vol.open(this.path,this.flags,this.mode,function(t,e){if(t){this.autoClose&&this.destroy&&this.destroy(),this.emit("error",t);return}this.fd=e,this.pending=!1,this.emit("open",e)}.bind(this))};Yt.prototype._write=function(t,e,r){if(!(t instanceof aa.Buffer||t instanceof Uint8Array))return this.emit("error",new Error("Invalid data"));if(typeof this.fd!="number")return this.once("open",function(){this._write(t,e,r)});var i=this;this._vol.write(this.fd,t,0,t.length,this.pos,(n,s)=>{if(n)return i.autoClose&&i.destroy&&i.destroy(),r(n);i.bytesWritten+=s,r()}),this.pos!==void 0&&(this.pos+=t.length)};Yt.prototype._writev=function(t,e){if(typeof this.fd!="number")return this.once("open",function(){this._writev(t,e)});let r=this,i=t.length,n=new Array(i);for(var s=0,a=0;a<i;a++){var l=t[a].chunk;n[a]=l,s+=l.length}let c=aa.Buffer.concat(n);this._vol.write(this.fd,c,0,c.length,this.pos,(o,f)=>{if(o)return r.destroy&&r.destroy(),e(o);r.bytesWritten+=f,e()}),this.pos!==void 0&&(this.pos+=s)};Yt.prototype.close=function(t){if(t&&this.once("close",t),this.closed||typeof this.fd!="number"){if(typeof this.fd!="number"){this.once("open",MS);return}return(0,au.default)(()=>this.emit("close"))}typeof this._writableState?.closed=="boolean"?this._writableState.closed=!0:this.closed=!0,this._vol.close(this.fd,e=>{e?this.emit("error",e):this.emit("close")}),this.fd=null};Yt.prototype._destroy=kr.prototype._destroy;Yt.prototype.destroySoon=Yt.prototype.end;var dw=class dw extends BS.EventEmitter{constructor(e){super(),this._filename="",this._filenameEncoded="",this._recursive=!1,this._encoding=yn.ENCODING_UTF8,this._listenerRemovers=new Map,this._onParentChild=r=>{r.getName()===this._getName()&&this._emit("rename")},this._emit=r=>{this.emit("change",r,this._filenameEncoded)},this._persist=()=>{this._timer=setTimeout(this._persist,1e6)},this._vol=e}_getName(){return this._steps[this._steps.length-1]}start(e,r=!0,i=!1,n=yn.ENCODING_UTF8){this._filename=(0,N.pathToFilename)(e),this._steps=(0,et.filenameToSteps)(this._filename),this._filenameEncoded=(0,yn.strToEncoding)(this._filename),this._recursive=i,this._encoding=n;try{this._link=this._vol._core.getLinkOrThrow(this._filename,"FSWatcher")}catch(c){let o=new Error(`watch ${this._filename} ${c.code}`);throw o.code=c.code,o.errno=c.code,o}let s=u(c=>{let o=c.getPath(),f=c.getNode(),h=u(()=>{let m=ru(this._filename,o);return m||(m=this._getName()),this.emit("change","change",m)},"onNodeChange"),d=f.changes.listen(([m])=>{m==="modify"&&h()}),p=this._listenerRemovers.get(f.ino)??[];p.push(()=>d()),this._listenerRemovers.set(f.ino,p)},"watchLinkNodeChanged"),a=u(c=>{let o=c.getNode(),f=u(m=>{this.emit("change","rename",ru(this._filename,m.getPath())),s(m),a(m)},"onLinkChildAdd"),h=u(m=>{let w=u(g=>{let b=g.getNode().ino,_=this._listenerRemovers.get(b);_&&(_.forEach(S=>S()),this._listenerRemovers.delete(b));for(let[S,F]of g.children.entries())F&&S!=="."&&S!==".."&&w(F)},"removeLinkNodeListeners");w(m),this.emit("change","rename",ru(this._filename,m.getPath()))},"onLinkChildDelete");for(let[m,w]of c.children.entries())w&&m!=="."&&m!==".."&&s(w);let d=c.changes.listen(([m,w])=>{m==="child:add"?f(w):m==="child:del"&&h(w)});if((this._listenerRemovers.get(o.ino)??[]).push(()=>{d()}),i)for(let[m,w]of c.children.entries())w&&m!=="."&&m!==".."&&a(w)},"watchLinkChildrenChanged");s(this._link),a(this._link);let l=this._link.parent;l&&l.changes.listen(([c,o])=>{c==="child:del"&&this._onParentChild(o)}),r&&this._persist()}close(){clearTimeout(this._timer),this._listenerRemovers.forEach(e=>{e.forEach(r=>r())}),this._listenerRemovers.clear(),this._parentChangesUnsub?.()}};u(dw,"FSWatcher");var su=dw;$t.FSWatcher=su});var qS=x(lu=>{"use strict";Object.defineProperty(lu,"__esModule",{value:!0});lu.fsSynchronousApiList=void 0;lu.fsSynchronousApiList=["accessSync","appendFileSync","chmodSync","chownSync","closeSync","copyFileSync","existsSync","fchmodSync","fchownSync","fdatasyncSync","fstatSync","fsyncSync","ftruncateSync","futimesSync","lchmodSync","lchownSync","linkSync","lstatSync","mkdirSync","mkdtempSync","openSync","opendirSync","readdirSync","readFileSync","readlinkSync","readSync","readvSync","realpathSync","renameSync","rmdirSync","rmSync","statSync","symlinkSync","truncateSync","unlinkSync","utimesSync","lutimesSync","writeFileSync","writeSync","writevSync"]});var US=x(cu=>{"use strict";Object.defineProperty(cu,"__esModule",{value:!0});cu.fsCallbackApiList=void 0;cu.fsCallbackApiList=["access","appendFile","chmod","chown","close","copyFile","cp","createReadStream","createWriteStream","exists","fchmod","fchown","fdatasync","fstat","fsync","ftruncate","futimes","lchmod","lchown","link","lstat","mkdir","mkdtemp","open","openAsBlob","opendir","read","readv","readdir","readFile","readlink","realpath","rename","rm","rmdir","stat","statfs","symlink","truncate","unlink","unwatchFile","utimes","lutimes","watch","watchFile","write","writev","writeFile"]});var pl=x((Bt,fu)=>{"use strict";Object.defineProperty(Bt,"__esModule",{value:!0});Bt.memfs=Bt.fs=Bt.vol=Bt.Volume=void 0;Bt.createFsFromVolume=pw;var dL=wm(),pL=bf(),uu=jS();Object.defineProperty(Bt,"Volume",{enumerable:!0,get:u(function(){return uu.Volume},"get")});var zS=lr(),mL=qS(),wL=US(),{F_OK:yL,R_OK:gL,W_OK:bL,X_OK:_L}=zS.constants;Bt.vol=new uu.Volume;function pw(t){let e={F_OK:yL,R_OK:gL,W_OK:bL,X_OK:_L,constants:zS.constants,Stats:dL.default,Dirent:pL.default};for(let r of mL.fsSynchronousApiList)typeof t[r]=="function"&&(e[r]=t[r].bind(t));for(let r of wL.fsCallbackApiList)typeof t[r]=="function"&&(e[r]=t[r].bind(t));return e.StatWatcher=t.StatWatcher,e.FSWatcher=t.FSWatcher,e.WriteStream=t.WriteStream,e.ReadStream=t.ReadStream,e.promises=t.promises,typeof t.realpath=="function"&&(e.realpath=t.realpath.bind(t),typeof t.realpath.native=="function"&&(e.realpath.native=t.realpath.native.bind(t))),typeof t.realpathSync=="function"&&(e.realpathSync=t.realpathSync.bind(t),typeof t.realpathSync.native=="function"&&(e.realpathSync.native=t.realpathSync.native.bind(t))),e._toUnixTimestamp=uu.toUnixTimestamp,e.__vol=t,e}u(pw,"createFsFromVolume");Bt.fs=pw(Bt.vol);var vL=u((t={},e="/")=>{let r=uu.Volume.fromNestedJSON(t,e);return{fs:pw(r),vol:r}},"memfs");Bt.memfs=vL;fu.exports={...fu.exports,...Bt.fs};fu.exports.semantic=!0});var HS=x((FQ,WS)=>{"use strict";var Lt=u(function(t){if(t=t||{},this.Promise=t.Promise||Promise,this.queues=Object.create(null),this.domainReentrant=t.domainReentrant||!1,this.domainReentrant){if(typeof process>"u"||typeof process.domain>"u")throw new Error("Domain-reentrant locks require `process.domain` to exist. Please flip `opts.domainReentrant = false`, use a NodeJS version that still implements Domain, or install a browser polyfill.");this.domains=Object.create(null)}this.timeout=t.timeout||Lt.DEFAULT_TIMEOUT,this.maxOccupationTime=t.maxOccupationTime||Lt.DEFAULT_MAX_OCCUPATION_TIME,this.maxExecutionTime=t.maxExecutionTime||Lt.DEFAULT_MAX_EXECUTION_TIME,t.maxPending===1/0||Number.isInteger(t.maxPending)&&t.maxPending>=0?this.maxPending=t.maxPending:this.maxPending=Lt.DEFAULT_MAX_PENDING},"AsyncLock");Lt.DEFAULT_TIMEOUT=0;Lt.DEFAULT_MAX_OCCUPATION_TIME=0;Lt.DEFAULT_MAX_EXECUTION_TIME=0;Lt.DEFAULT_MAX_PENDING=1e3;Lt.prototype.acquire=function(t,e,r,i){if(Array.isArray(t))return this._acquireBatch(t,e,r,i);if(typeof e!="function")throw new Error("You must pass a function to execute");var n=null,s=null,a=null;typeof r!="function"&&(i=r,r=null,a=new this.Promise(function(_,S){n=_,s=S})),i=i||{};var l=!1,c=null,o=null,f=null,h=this,d=u(function(_,S,F){o&&(clearTimeout(o),o=null),f&&(clearTimeout(f),f=null),_&&(h.queues[t]&&h.queues[t].length===0&&delete h.queues[t],h.domainReentrant&&delete h.domains[t]),l||(a?S?s(S):n(F):typeof r=="function"&&r(S,F),l=!0),_&&h.queues[t]&&h.queues[t].length>0&&h.queues[t].shift()()},"done"),p=u(function(_){if(l)return d(_);c&&(clearTimeout(c),c=null),h.domainReentrant&&_&&(h.domains[t]=process.domain);var S=i.maxExecutionTime||h.maxExecutionTime;if(S&&(f=setTimeout(function(){h.queues[t]&&d(_,new Error("Maximum execution time is exceeded "+t))},S)),e.length===1){var F=!1;try{e(function(k,A){F||(F=!0,d(_,k,A))})}catch(k){F||(F=!0,d(_,k))}}else h._promiseTry(function(){return e()}).then(function(k){d(_,void 0,k)},function(k){d(_,k)})},"exec");h.domainReentrant&&process.domain&&(p=process.domain.bind(p));var m=i.maxPending||h.maxPending;if(!h.queues[t])h.queues[t]=[],p(!0);else if(h.domainReentrant&&process.domain&&process.domain===h.domains[t])p(!1);else if(h.queues[t].length>=m)d(!1,new Error("Too many pending tasks in queue "+t));else{var w=u(function(){p(!0)},"taskFn");i.skipQueue?h.queues[t].unshift(w):h.queues[t].push(w);var g=i.timeout||h.timeout;g&&(c=setTimeout(function(){c=null,d(!1,new Error("async-lock timed out in queue "+t))},g))}var b=i.maxOccupationTime||h.maxOccupationTime;if(b&&(o=setTimeout(function(){h.queues[t]&&d(!1,new Error("Maximum occupation time is exceeded in queue "+t))},b)),a)return a};Lt.prototype._acquireBatch=function(t,e,r,i){typeof r!="function"&&(i=r,r=null);var n=this,s=u(function(l,c){return function(o){n.acquire(l,c,o,i)}},"getFn"),a=t.reduceRight(function(l,c){return s(c,l)},e);if(typeof r=="function")a(r);else return new this.Promise(function(l,c){a.length===1?a(function(o,f){o?c(o):l(f)}):l(a())})};Lt.prototype.isBusy=function(t){return t?!!this.queues[t]:Object.keys(this.queues).length>0};Lt.prototype._promiseTry=function(t){try{return this.Promise.resolve(t())}catch(e){return this.Promise.reject(e)}};WS.exports=Lt});var GS=x((TQ,VS)=>{"use strict";VS.exports=HS()});var ZS=x((xQ,mw)=>{typeof Object.create=="function"?mw.exports=u(function(e,r){r&&(e.super_=r,e.prototype=Object.create(r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))},"inherits"):mw.exports=u(function(e,r){if(r){e.super_=r;var i=u(function(){},"TempCtor");i.prototype=r.prototype,e.prototype=new i,e.prototype.constructor=e}},"inherits")});var KS=x((RQ,yw)=>{try{if(ww=ne("util"),typeof ww.inherits!="function")throw"";yw.exports=ww.inherits}catch{yw.exports=ZS()}var ww});var ml=x((gw,YS)=>{var hu=ne("buffer"),Tr=hu.Buffer;function JS(t,e){for(var r in t)e[r]=t[r]}u(JS,"copyProps");Tr.from&&Tr.alloc&&Tr.allocUnsafe&&Tr.allocUnsafeSlow?YS.exports=hu:(JS(hu,gw),gw.Buffer=bn);function bn(t,e,r){return Tr(t,e,r)}u(bn,"SafeBuffer");bn.prototype=Object.create(Tr.prototype);JS(Tr,bn);bn.from=function(t,e,r){if(typeof t=="number")throw new TypeError("Argument must not be a number");return Tr(t,e,r)};bn.alloc=function(t,e,r){if(typeof t!="number")throw new TypeError("Argument must be a number");var i=Tr(t);return e!==void 0?typeof r=="string"?i.fill(e,r):i.fill(e):i.fill(0),i};bn.allocUnsafe=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return Tr(t)};bn.allocUnsafeSlow=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return hu.SlowBuffer(t)}});var QS=x((PQ,XS)=>{var SL={}.toString;XS.exports=Array.isArray||function(t){return SL.call(t)=="[object Array]"}});var oa=x((NQ,eE)=>{"use strict";eE.exports=TypeError});var bw=x((DQ,tE)=>{"use strict";tE.exports=Object});var iE=x((CQ,rE)=>{"use strict";rE.exports=Error});var sE=x((IQ,nE)=>{"use strict";nE.exports=EvalError});var oE=x(($Q,aE)=>{"use strict";aE.exports=RangeError});var cE=x((BQ,lE)=>{"use strict";lE.exports=ReferenceError});var _w=x((LQ,fE)=>{"use strict";fE.exports=SyntaxError});var hE=x((MQ,uE)=>{"use strict";uE.exports=URIError});var pE=x((jQ,dE)=>{"use strict";dE.exports=Math.abs});var wE=x((qQ,mE)=>{"use strict";mE.exports=Math.floor});var gE=x((UQ,yE)=>{"use strict";yE.exports=Math.max});var _E=x((zQ,bE)=>{"use strict";bE.exports=Math.min});var SE=x((WQ,vE)=>{"use strict";vE.exports=Math.pow});var FE=x((HQ,EE)=>{"use strict";EE.exports=Math.round});var TE=x((VQ,kE)=>{"use strict";kE.exports=Number.isNaN||u(function(e){return e!==e},"isNaN")});var OE=x((ZQ,xE)=>{"use strict";var EL=TE();xE.exports=u(function(e){return EL(e)||e===0?e:e<0?-1:1},"sign")});var AE=x((JQ,RE)=>{"use strict";RE.exports=Object.getOwnPropertyDescriptor});var la=x((YQ,PE)=>{"use strict";var du=AE();if(du)try{du([],"length")}catch{du=null}PE.exports=du});var wl=x((XQ,NE)=>{"use strict";var pu=Object.defineProperty||!1;if(pu)try{pu({},"a",{value:1})}catch{pu=!1}NE.exports=pu});var vw=x((QQ,DE)=>{"use strict";DE.exports=u(function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var e={},r=Symbol("test"),i=Object(r);if(typeof r=="string"||Object.prototype.toString.call(r)!=="[object Symbol]"||Object.prototype.toString.call(i)!=="[object Symbol]")return!1;var n=42;e[r]=n;for(var s in e)return!1;if(typeof Object.keys=="function"&&Object.keys(e).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(e).length!==0)return!1;var a=Object.getOwnPropertySymbols(e);if(a.length!==1||a[0]!==r||!Object.prototype.propertyIsEnumerable.call(e,r))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var l=Object.getOwnPropertyDescriptor(e,r);if(l.value!==n||l.enumerable!==!0)return!1}return!0},"hasSymbols")});var $E=x((tee,IE)=>{"use strict";var CE=typeof Symbol<"u"&&Symbol,FL=vw();IE.exports=u(function(){return typeof CE!="function"||typeof Symbol!="function"||typeof CE("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:FL()},"hasNativeSymbols")});var Sw=x((iee,BE)=>{"use strict";BE.exports=typeof Reflect<"u"&&Reflect.getPrototypeOf||null});var Ew=x((nee,LE)=>{"use strict";var kL=bw();LE.exports=kL.getPrototypeOf||null});var qE=x((see,jE)=>{"use strict";var TL="Function.prototype.bind called on incompatible ",xL=Object.prototype.toString,OL=Math.max,RL="[object Function]",ME=u(function(e,r){for(var i=[],n=0;n<e.length;n+=1)i[n]=e[n];for(var s=0;s<r.length;s+=1)i[s+e.length]=r[s];return i},"concatty"),AL=u(function(e,r){for(var i=[],n=r||0,s=0;n<e.length;n+=1,s+=1)i[s]=e[n];return i},"slicy"),PL=u(function(t,e){for(var r="",i=0;i<t.length;i+=1)r+=t[i],i+1<t.length&&(r+=e);return r},"joiny");jE.exports=u(function(e){var r=this;if(typeof r!="function"||xL.apply(r)!==RL)throw new TypeError(TL+r);for(var i=AL(arguments,1),n,s=u(function(){if(this instanceof n){var f=r.apply(this,ME(i,arguments));return Object(f)===f?f:this}return r.apply(e,ME(i,arguments))},"binder"),a=OL(0,r.length-i.length),l=[],c=0;c<a;c++)l[c]="$"+c;if(n=Function("binder","return function ("+PL(l,",")+"){ return binder.apply(this,arguments); }")(s),r.prototype){var o=u(function(){},"Empty");o.prototype=r.prototype,n.prototype=new o,o.prototype=null}return n},"bind")});var ca=x((oee,UE)=>{"use strict";var NL=qE();UE.exports=Function.prototype.bind||NL});var mu=x((lee,zE)=>{"use strict";zE.exports=Function.prototype.call});var wu=x((cee,WE)=>{"use strict";WE.exports=Function.prototype.apply});var VE=x((fee,HE)=>{"use strict";HE.exports=typeof Reflect<"u"&&Reflect&&Reflect.apply});var Fw=x((uee,GE)=>{"use strict";var DL=ca(),CL=wu(),IL=mu(),$L=VE();GE.exports=$L||DL.call(IL,CL)});var yu=x((hee,ZE)=>{"use strict";var BL=ca(),LL=oa(),ML=mu(),jL=Fw();ZE.exports=u(function(e){if(e.length<1||typeof e[0]!="function")throw new LL("a function is required");return jL(BL,ML,e)},"callBindBasic")});var e1=x((pee,QE)=>{"use strict";var qL=yu(),KE=la(),YE;try{YE=[].__proto__===Array.prototype}catch(t){if(!t||typeof t!="object"||!("code"in t)||t.code!=="ERR_PROTO_ACCESS")throw t}var kw=!!YE&&KE&&KE(Object.prototype,"__proto__"),XE=Object,JE=XE.getPrototypeOf;QE.exports=kw&&typeof kw.get=="function"?qL([kw.get]):typeof JE=="function"?u(function(e){return JE(e==null?e:XE(e))},"getDunder"):!1});var Tw=x((wee,n1)=>{"use strict";var t1=Sw(),r1=Ew(),i1=e1();n1.exports=t1?u(function(e){return t1(e)},"getProto"):r1?u(function(e){if(!e||typeof e!="object"&&typeof e!="function")throw new TypeError("getProto: not an object");return r1(e)},"getProto"):i1?u(function(e){return i1(e)},"getProto"):null});var a1=x((gee,s1)=>{"use strict";var UL=Function.prototype.call,zL=Object.prototype.hasOwnProperty,WL=ca();s1.exports=WL.call(UL,zL)});var Rw=x((bee,h1)=>{"use strict";var J,HL=bw(),VL=iE(),GL=sE(),ZL=oE(),KL=cE(),da=_w(),ha=oa(),JL=hE(),YL=pE(),XL=wE(),QL=gE(),eM=_E(),tM=SE(),rM=FE(),iM=OE(),f1=Function,xw=u(function(t){try{return f1('"use strict"; return ('+t+").constructor;")()}catch{}},"getEvalledConstructor"),yl=la(),nM=wl(),Ow=u(function(){throw new ha},"throwTypeError"),sM=yl?function(){try{return arguments.callee,Ow}catch{try{return yl(arguments,"callee").get}catch{return Ow}}}():Ow,fa=$E()(),Ke=Tw(),aM=Ew(),oM=Sw(),u1=wu(),gl=mu(),ua={},lM=typeof Uint8Array>"u"||!Ke?J:Ke(Uint8Array),_n={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?J:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?J:ArrayBuffer,"%ArrayIteratorPrototype%":fa&&Ke?Ke([][Symbol.iterator]()):J,"%AsyncFromSyncIteratorPrototype%":J,"%AsyncFunction%":ua,"%AsyncGenerator%":ua,"%AsyncGeneratorFunction%":ua,"%AsyncIteratorPrototype%":ua,"%Atomics%":typeof Atomics>"u"?J:Atomics,"%BigInt%":typeof BigInt>"u"?J:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?J:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?J:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?J:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":VL,"%eval%":eval,"%EvalError%":GL,"%Float16Array%":typeof Float16Array>"u"?J:Float16Array,"%Float32Array%":typeof Float32Array>"u"?J:Float32Array,"%Float64Array%":typeof Float64Array>"u"?J:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?J:FinalizationRegistry,"%Function%":f1,"%GeneratorFunction%":ua,"%Int8Array%":typeof Int8Array>"u"?J:Int8Array,"%Int16Array%":typeof Int16Array>"u"?J:Int16Array,"%Int32Array%":typeof Int32Array>"u"?J:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":fa&&Ke?Ke(Ke([][Symbol.iterator]())):J,"%JSON%":typeof JSON=="object"?JSON:J,"%Map%":typeof Map>"u"?J:Map,"%MapIteratorPrototype%":typeof Map>"u"||!fa||!Ke?J:Ke(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":HL,"%Object.getOwnPropertyDescriptor%":yl,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?J:Promise,"%Proxy%":typeof Proxy>"u"?J:Proxy,"%RangeError%":ZL,"%ReferenceError%":KL,"%Reflect%":typeof Reflect>"u"?J:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?J:Set,"%SetIteratorPrototype%":typeof Set>"u"||!fa||!Ke?J:Ke(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?J:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":fa&&Ke?Ke(""[Symbol.iterator]()):J,"%Symbol%":fa?Symbol:J,"%SyntaxError%":da,"%ThrowTypeError%":sM,"%TypedArray%":lM,"%TypeError%":ha,"%Uint8Array%":typeof Uint8Array>"u"?J:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?J:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?J:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?J:Uint32Array,"%URIError%":JL,"%WeakMap%":typeof WeakMap>"u"?J:WeakMap,"%WeakRef%":typeof WeakRef>"u"?J:WeakRef,"%WeakSet%":typeof WeakSet>"u"?J:WeakSet,"%Function.prototype.call%":gl,"%Function.prototype.apply%":u1,"%Object.defineProperty%":nM,"%Object.getPrototypeOf%":aM,"%Math.abs%":YL,"%Math.floor%":XL,"%Math.max%":QL,"%Math.min%":eM,"%Math.pow%":tM,"%Math.round%":rM,"%Math.sign%":iM,"%Reflect.getPrototypeOf%":oM};if(Ke)try{null.error}catch(t){o1=Ke(Ke(t)),_n["%Error.prototype%"]=o1}var o1,cM=u(function t(e){var r;if(e==="%AsyncFunction%")r=xw("async function () {}");else if(e==="%GeneratorFunction%")r=xw("function* () {}");else if(e==="%AsyncGeneratorFunction%")r=xw("async function* () {}");else if(e==="%AsyncGenerator%"){var i=t("%AsyncGeneratorFunction%");i&&(r=i.prototype)}else if(e==="%AsyncIteratorPrototype%"){var n=t("%AsyncGenerator%");n&&Ke&&(r=Ke(n.prototype))}return _n[e]=r,r},"doEval"),l1={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},bl=ca(),gu=a1(),fM=bl.call(gl,Array.prototype.concat),uM=bl.call(u1,Array.prototype.splice),c1=bl.call(gl,String.prototype.replace),bu=bl.call(gl,String.prototype.slice),hM=bl.call(gl,RegExp.prototype.exec),dM=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,pM=/\\(\\)?/g,mM=u(function(e){var r=bu(e,0,1),i=bu(e,-1);if(r==="%"&&i!=="%")throw new da("invalid intrinsic syntax, expected closing `%`");if(i==="%"&&r!=="%")throw new da("invalid intrinsic syntax, expected opening `%`");var n=[];return c1(e,dM,function(s,a,l,c){n[n.length]=l?c1(c,pM,"$1"):a||s}),n},"stringToPath"),wM=u(function(e,r){var i=e,n;if(gu(l1,i)&&(n=l1[i],i="%"+n[0]+"%"),gu(_n,i)){var s=_n[i];if(s===ua&&(s=cM(i)),typeof s>"u"&&!r)throw new ha("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:n,name:i,value:s}}throw new da("intrinsic "+e+" does not exist!")},"getBaseIntrinsic");h1.exports=u(function(e,r){if(typeof e!="string"||e.length===0)throw new ha("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof r!="boolean")throw new ha('"allowMissing" argument must be a boolean');if(hM(/^%?[^%]*%?$/,e)===null)throw new da("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var i=mM(e),n=i.length>0?i[0]:"",s=wM("%"+n+"%",r),a=s.name,l=s.value,c=!1,o=s.alias;o&&(n=o[0],uM(i,fM([0,1],o)));for(var f=1,h=!0;f<i.length;f+=1){var d=i[f],p=bu(d,0,1),m=bu(d,-1);if((p==='"'||p==="'"||p==="`"||m==='"'||m==="'"||m==="`")&&p!==m)throw new da("property names with quotes must have matching quotes");if((d==="constructor"||!h)&&(c=!0),n+="."+d,a="%"+n+"%",gu(_n,a))l=_n[a];else if(l!=null){if(!(d in l)){if(!r)throw new ha("base intrinsic for "+e+" exists, but the property is not available.");return}if(yl&&f+1>=i.length){var w=yl(l,d);h=!!w,h&&"get"in w&&!("originalValue"in w.get)?l=w.get:l=l[d]}else h=gu(l,d),l=l[d];h&&!c&&(_n[a]=l)}}return l},"GetIntrinsic")});var Aw=x((vee,m1)=>{"use strict";var d1=Rw(),p1=yu(),yM=p1([d1("%String.prototype.indexOf%")]);m1.exports=u(function(e,r){var i=d1(e,!!r);return typeof i=="function"&&yM(e,".prototype.")>-1?p1([i]):i},"callBoundIntrinsic")});var b1=x((Eee,g1)=>{"use strict";var y1=Function.prototype.toString,pa=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,Nw,_u;if(typeof pa=="function"&&typeof Object.defineProperty=="function")try{Nw=Object.defineProperty({},"length",{get:u(function(){throw _u},"get")}),_u={},pa(function(){throw 42},null,Nw)}catch(t){t!==_u&&(pa=null)}else pa=null;var gM=/^\s*class\b/,Dw=u(function(e){try{var r=y1.call(e);return gM.test(r)}catch{return!1}},"isES6ClassFunction"),Pw=u(function(e){try{return Dw(e)?!1:(y1.call(e),!0)}catch{return!1}},"tryFunctionToStr"),vu=Object.prototype.toString,bM="[object Object]",_M="[object Function]",vM="[object GeneratorFunction]",SM="[object HTMLAllCollection]",EM="[object HTML document.all class]",FM="[object HTMLCollection]",kM=typeof Symbol=="function"&&!!Symbol.toStringTag,TM=!(0 in[,]),Cw=u(function(){return!1},"isDocumentDotAll");typeof document=="object"&&(w1=document.all,vu.call(w1)===vu.call(document.all)&&(Cw=u(function(e){if((TM||!e)&&(typeof e>"u"||typeof e=="object"))try{var r=vu.call(e);return(r===SM||r===EM||r===FM||r===bM)&&e("")==null}catch{}return!1},"isDocumentDotAll")));var w1;g1.exports=u(pa?function(e){if(Cw(e))return!0;if(!e||typeof e!="function"&&typeof e!="object")return!1;try{pa(e,null,Nw)}catch(r){if(r!==_u)return!1}return!Dw(e)&&Pw(e)}:function(e){if(Cw(e))return!0;if(!e||typeof e!="function"&&typeof e!="object")return!1;if(kM)return Pw(e);if(Dw(e))return!1;var r=vu.call(e);return r!==_M&&r!==vM&&!/^\[object HTML/.test(r)?!1:Pw(e)},"isCallable")});var S1=x((kee,v1)=>{"use strict";var xM=b1(),OM=Object.prototype.toString,_1=Object.prototype.hasOwnProperty,RM=u(function(e,r,i){for(var n=0,s=e.length;n<s;n++)_1.call(e,n)&&(i==null?r(e[n],n,e):r.call(i,e[n],n,e))},"forEachArray"),AM=u(function(e,r,i){for(var n=0,s=e.length;n<s;n++)i==null?r(e.charAt(n),n,e):r.call(i,e.charAt(n),n,e)},"forEachString"),PM=u(function(e,r,i){for(var n in e)_1.call(e,n)&&(i==null?r(e[n],n,e):r.call(i,e[n],n,e))},"forEachObject");function NM(t){return OM.call(t)==="[object Array]"}u(NM,"isArray");v1.exports=u(function(e,r,i){if(!xM(r))throw new TypeError("iterator must be a function");var n;arguments.length>=3&&(n=i),NM(e)?RM(e,r,n):typeof e=="string"?AM(e,r,n):PM(e,r,n)},"forEach")});var F1=x((xee,E1)=>{"use strict";E1.exports=["Float16Array","Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"]});var T1=x((Oee,k1)=>{"use strict";var Iw=F1(),DM=globalThis;k1.exports=u(function(){for(var e=[],r=0;r<Iw.length;r++)typeof DM[Iw[r]]=="function"&&(e[e.length]=Iw[r]);return e},"availableTypedArrays")});var A1=x((Aee,R1)=>{"use strict";var x1=wl(),CM=_w(),ma=oa(),O1=la();R1.exports=u(function(e,r,i){if(!e||typeof e!="object"&&typeof e!="function")throw new ma("`obj` must be an object or a function`");if(typeof r!="string"&&typeof r!="symbol")throw new ma("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new ma("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new ma("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new ma("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new ma("`loose`, if provided, must be a boolean");var n=arguments.length>3?arguments[3]:null,s=arguments.length>4?arguments[4]:null,a=arguments.length>5?arguments[5]:null,l=arguments.length>6?arguments[6]:!1,c=!!O1&&O1(e,r);if(x1)x1(e,r,{configurable:a===null&&c?c.configurable:!a,enumerable:n===null&&c?c.enumerable:!n,value:i,writable:s===null&&c?c.writable:!s});else if(l||!n&&!s&&!a)e[r]=i;else throw new CM("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},"defineDataProperty")});var D1=x((Nee,N1)=>{"use strict";var $w=wl(),P1=u(function(){return!!$w},"hasPropertyDescriptors");P1.hasArrayLengthDefineBug=u(function(){if(!$w)return null;try{return $w([],"length",{value:1}).length!==1}catch{return!0}},"hasArrayLengthDefineBug");N1.exports=P1});var L1=x((Cee,B1)=>{"use strict";var IM=Rw(),C1=A1(),$M=D1()(),I1=la(),$1=oa(),BM=IM("%Math.floor%");B1.exports=u(function(e,r){if(typeof e!="function")throw new $1("`fn` is not a function");if(typeof r!="number"||r<0||r>4294967295||BM(r)!==r)throw new $1("`length` must be a positive 32-bit integer");var i=arguments.length>2&&!!arguments[2],n=!0,s=!0;if("length"in e&&I1){var a=I1(e,"length");a&&!a.configurable&&(n=!1),a&&!a.writable&&(s=!1)}return(n||s||!i)&&($M?C1(e,"length",r,!0,!0):C1(e,"length",r)),e},"setFunctionLength")});var j1=x(($ee,M1)=>{"use strict";var LM=ca(),MM=wu(),jM=Fw();M1.exports=u(function(){return jM(LM,MM,arguments)},"applyBind")});var z1=x((Lee,Su)=>{"use strict";var qM=L1(),q1=wl(),UM=yu(),U1=j1();Su.exports=u(function(e){var r=UM(arguments),i=e.length-(arguments.length-1);return qM(r,1+(i>0?i:0),!0)},"callBind");q1?q1(Su.exports,"apply",{value:U1}):Su.exports.apply=U1});var H1=x((jee,W1)=>{"use strict";var zM=vw();W1.exports=u(function(){return zM()&&!!Symbol.toStringTag},"hasToStringTagShams")});var J1=x((Uee,K1)=>{"use strict";var ku=S1(),WM=T1(),V1=z1(),Lw=Aw(),Fu=la(),Eu=Tw(),HM=Lw("Object.prototype.toString"),Z1=H1()(),G1=globalThis,Bw=WM(),Mw=Lw("String.prototype.slice"),VM=Lw("Array.prototype.indexOf",!0)||u(function(e,r){for(var i=0;i<e.length;i+=1)if(e[i]===r)return i;return-1},"indexOf"),Tu={__proto__:null};Z1&&Fu&&Eu?ku(Bw,function(t){var e=new G1[t];if(Symbol.toStringTag in e&&Eu){var r=Eu(e),i=Fu(r,Symbol.toStringTag);if(!i&&r){var n=Eu(r);i=Fu(n,Symbol.toStringTag)}Tu["$"+t]=V1(i.get)}}):ku(Bw,function(t){var e=new G1[t],r=e.slice||e.set;r&&(Tu["$"+t]=V1(r))});var GM=u(function(e){var r=!1;return ku(Tu,function(i,n){if(!r)try{"$"+i(e)===n&&(r=Mw(n,1))}catch{}}),r},"tryAllTypedArrays"),ZM=u(function(e){var r=!1;return ku(Tu,function(i,n){if(!r)try{i(e),r=Mw(n,1)}catch{}}),r},"tryAllSlices");K1.exports=u(function(e){if(!e||typeof e!="object")return!1;if(!Z1){var r=Mw(HM(e),8,-1);return VM(Bw,r)>-1?r:r!=="Object"?!1:ZM(e)}return Fu?GM(e):null},"whichTypedArray")});var X1=x((Wee,Y1)=>{"use strict";var KM=J1();Y1.exports=u(function(e){return!!KM(e)},"isTypedArray")});var eF=x((Vee,Q1)=>{"use strict";var JM=oa(),YM=Aw(),XM=YM("TypedArray.prototype.buffer",!0),QM=X1();Q1.exports=XM||u(function(e){if(!QM(e))throw new JM("Not a Typed Array");return e.buffer},"typedArrayBuffer")});var iF=x((Zee,rF)=>{"use strict";var fr=ml().Buffer,ej=QS(),tj=eF(),rj=ArrayBuffer.isView||u(function(e){try{return tj(e),!0}catch{return!1}},"isView"),ij=typeof Uint8Array<"u",tF=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u",nj=tF&&(fr.prototype instanceof Uint8Array||fr.TYPED_ARRAY_SUPPORT);rF.exports=u(function(e,r){if(fr.isBuffer(e))return e.constructor&&!("isBuffer"in e)?fr.from(e):e;if(typeof e=="string")return fr.from(e,r);if(tF&&rj(e)){if(e.byteLength===0)return fr.alloc(0);if(nj){var i=fr.from(e.buffer,e.byteOffset,e.byteLength);if(i.byteLength===e.byteLength)return i}var n=e instanceof Uint8Array?e:new Uint8Array(e.buffer,e.byteOffset,e.byteLength),s=fr.from(n);if(s.length===e.byteLength)return s}if(ij&&e instanceof Uint8Array)return fr.from(e);var a=ej(e);if(a)for(var l=0;l<e.length;l+=1){var c=e[l];if(typeof c!="number"||c<0||c>255||~~c!==c)throw new RangeError("Array items must be numbers in the range 0-255.")}if(a||fr.isBuffer(e)&&e.constructor&&typeof e.constructor.isBuffer=="function"&&e.constructor.isBuffer(e))return fr.from(e);throw new TypeError('The "data" argument must be a string, an Array, a Buffer, a Uint8Array, or a DataView.')},"toBuffer")});var sF=x((Jee,nF)=>{"use strict";var sj=ml().Buffer,aj=iF();function xu(t,e){this._block=sj.alloc(t),this._finalSize=e,this._blockSize=t,this._len=0}u(xu,"Hash");xu.prototype.update=function(t,e){t=aj(t,e||"utf8");for(var r=this._block,i=this._blockSize,n=t.length,s=this._len,a=0;a<n;){for(var l=s%i,c=Math.min(n-a,i-l),o=0;o<c;o++)r[l+o]=t[a+o];s+=c,a+=c,s%i===0&&this._update(r)}return this._len+=n,this};xu.prototype.digest=function(t){var e=this._len%this._blockSize;this._block[e]=128,this._block.fill(0,e+1),e>=this._finalSize&&(this._update(this._block),this._block.fill(0));var r=this._len*8;if(r<=4294967295)this._block.writeUInt32BE(r,this._blockSize-4);else{var i=(r&4294967295)>>>0,n=(r-i)/4294967296;this._block.writeUInt32BE(n,this._blockSize-8),this._block.writeUInt32BE(i,this._blockSize-4)}this._update(this._block);var s=this._hash();return t?s.toString(t):s};xu.prototype._update=function(){throw new Error("_update must be implemented by subclass")};nF.exports=xu});var lF=x((Xee,oF)=>{"use strict";var oj=KS(),aF=sF(),lj=ml().Buffer,cj=[1518500249,1859775393,-1894007588,-899497514],fj=new Array(80);function _l(){this.init(),this._w=fj,aF.call(this,64,56)}u(_l,"Sha1");oj(_l,aF);_l.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function uj(t){return t<<1|t>>>31}u(uj,"rotl1");function hj(t){return t<<5|t>>>27}u(hj,"rotl5");function dj(t){return t<<30|t>>>2}u(dj,"rotl30");function pj(t,e,r,i){return t===0?e&r|~e&i:t===2?e&r|e&i|r&i:e^r^i}u(pj,"ft");_l.prototype._update=function(t){for(var e=this._w,r=this._a|0,i=this._b|0,n=this._c|0,s=this._d|0,a=this._e|0,l=0;l<16;++l)e[l]=t.readInt32BE(l*4);for(;l<80;++l)e[l]=uj(e[l-3]^e[l-8]^e[l-14]^e[l-16]);for(var c=0;c<80;++c){var o=~~(c/20),f=hj(r)+pj(o,i,n,s)+a+e[c]+cj[o]|0;a=s,s=n,n=dj(i),i=r,r=f}this._a=r+this._a|0,this._b=i+this._b|0,this._c=n+this._c|0,this._d=s+this._d|0,this._e=a+this._e|0};_l.prototype._hash=function(){var t=lj.allocUnsafe(20);return t.writeInt32BE(this._a|0,0),t.writeInt32BE(this._b|0,4),t.writeInt32BE(this._c|0,8),t.writeInt32BE(this._d|0,12),t.writeInt32BE(this._e|0,16),t};oF.exports=_l});var fF=x(jw=>{var cF;(function(t){typeof DO_NOT_EXPORT_CRC>"u"?typeof jw=="object"?t(jw):typeof define=="function"&&define.amd?define(function(){var e={};return t(e),e}):t(cF={}):t(cF={})})(function(t){t.version="1.2.2";function e(){for(var v=0,T=new Array(256),E=0;E!=256;++E)v=E,v=v&1?-306674912^v>>>1:v>>>1,v=v&1?-306674912^v>>>1:v>>>1,v=v&1?-306674912^v>>>1:v>>>1,v=v&1?-306674912^v>>>1:v>>>1,v=v&1?-306674912^v>>>1:v>>>1,v=v&1?-306674912^v>>>1:v>>>1,v=v&1?-306674912^v>>>1:v>>>1,v=v&1?-306674912^v>>>1:v>>>1,T[E]=v;return typeof Int32Array<"u"?new Int32Array(T):T}u(e,"signed_crc_table");var r=e();function i(v){var T=0,E=0,R=0,P=typeof Int32Array<"u"?new Int32Array(4096):new Array(4096);for(R=0;R!=256;++R)P[R]=v[R];for(R=0;R!=256;++R)for(E=v[R],T=256+R;T<4096;T+=256)E=P[T]=E>>>8^v[E&255];var I=[];for(R=1;R!=16;++R)I[R-1]=typeof Int32Array<"u"?P.subarray(R*256,R*256+256):P.slice(R*256,R*256+256);return I}u(i,"slice_by_16_tables");var n=i(r),s=n[0],a=n[1],l=n[2],c=n[3],o=n[4],f=n[5],h=n[6],d=n[7],p=n[8],m=n[9],w=n[10],g=n[11],b=n[12],_=n[13],S=n[14];function F(v,T){for(var E=T^-1,R=0,P=v.length;R<P;)E=E>>>8^r[(E^v.charCodeAt(R++))&255];return~E}u(F,"crc32_bstr");function k(v,T){for(var E=T^-1,R=v.length-15,P=0;P<R;)E=S[v[P++]^E&255]^_[v[P++]^E>>8&255]^b[v[P++]^E>>16&255]^g[v[P++]^E>>>24]^w[v[P++]]^m[v[P++]]^p[v[P++]]^d[v[P++]]^h[v[P++]]^f[v[P++]]^o[v[P++]]^c[v[P++]]^l[v[P++]]^a[v[P++]]^s[v[P++]]^r[v[P++]];for(R+=15;P<R;)E=E>>>8^r[(E^v[P++])&255];return~E}u(k,"crc32_buf");function A(v,T){for(var E=T^-1,R=0,P=v.length,I=0,B=0;R<P;)I=v.charCodeAt(R++),I<128?E=E>>>8^r[(E^I)&255]:I<2048?(E=E>>>8^r[(E^(192|I>>6&31))&255],E=E>>>8^r[(E^(128|I&63))&255]):I>=55296&&I<57344?(I=(I&1023)+64,B=v.charCodeAt(R++)&1023,E=E>>>8^r[(E^(240|I>>8&7))&255],E=E>>>8^r[(E^(128|I>>2&63))&255],E=E>>>8^r[(E^(128|B>>6&15|(I&3)<<4))&255],E=E>>>8^r[(E^(128|B&63))&255]):(E=E>>>8^r[(E^(224|I>>12&15))&255],E=E>>>8^r[(E^(128|I>>6&63))&255],E=E>>>8^r[(E^(128|I&63))&255]);return~E}u(A,"crc32_str"),t.table=r,t.bstr=F,t.buf=k,t.str=A})});var Qr=x(gt=>{"use strict";var mj=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";function wj(t,e){return Object.prototype.hasOwnProperty.call(t,e)}u(wj,"_has");gt.assign=function(t){for(var e=Array.prototype.slice.call(arguments,1);e.length;){var r=e.shift();if(r){if(typeof r!="object")throw new TypeError(r+"must be non-object");for(var i in r)wj(r,i)&&(t[i]=r[i])}}return t};gt.shrinkBuf=function(t,e){return t.length===e?t:t.subarray?t.subarray(0,e):(t.length=e,t)};var yj={arraySet:u(function(t,e,r,i,n){if(e.subarray&&t.subarray){t.set(e.subarray(r,r+i),n);return}for(var s=0;s<i;s++)t[n+s]=e[r+s]},"arraySet"),flattenChunks:u(function(t){var e,r,i,n,s,a;for(i=0,e=0,r=t.length;e<r;e++)i+=t[e].length;for(a=new Uint8Array(i),n=0,e=0,r=t.length;e<r;e++)s=t[e],a.set(s,n),n+=s.length;return a},"flattenChunks")},gj={arraySet:u(function(t,e,r,i,n){for(var s=0;s<i;s++)t[n+s]=e[r+s]},"arraySet"),flattenChunks:u(function(t){return[].concat.apply([],t)},"flattenChunks")};gt.setTyped=function(t){t?(gt.Buf8=Uint8Array,gt.Buf16=Uint16Array,gt.Buf32=Int32Array,gt.assign(gt,yj)):(gt.Buf8=Array,gt.Buf16=Array,gt.Buf32=Array,gt.assign(gt,gj))};gt.setTyped(mj)});var DF=x(ga=>{"use strict";var bj=Qr(),_j=4,uF=0,hF=1,vj=2;function ya(t){for(var e=t.length;--e>=0;)t[e]=0}u(ya,"zero");var Sj=0,gF=1,Ej=2,Fj=3,kj=258,Gw=29,Tl=256,Sl=Tl+1+Gw,wa=30,Zw=19,bF=2*Sl+1,vn=15,qw=16,Tj=7,Kw=256,_F=16,vF=17,SF=18,Hw=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],Ou=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],xj=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],EF=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],Oj=512,ei=new Array((Sl+2)*2);ya(ei);var vl=new Array(wa*2);ya(vl);var El=new Array(Oj);ya(El);var Fl=new Array(kj-Fj+1);ya(Fl);var Jw=new Array(Gw);ya(Jw);var Ru=new Array(wa);ya(Ru);function Uw(t,e,r,i,n){this.static_tree=t,this.extra_bits=e,this.extra_base=r,this.elems=i,this.max_length=n,this.has_stree=t&&t.length}u(Uw,"StaticTreeDesc");var FF,kF,TF;function zw(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e}u(zw,"TreeDesc");function xF(t){return t<256?El[t]:El[256+(t>>>7)]}u(xF,"d_code");function kl(t,e){t.pending_buf[t.pending++]=e&255,t.pending_buf[t.pending++]=e>>>8&255}u(kl,"put_short");function Tt(t,e,r){t.bi_valid>qw-r?(t.bi_buf|=e<<t.bi_valid&65535,kl(t,t.bi_buf),t.bi_buf=e>>qw-t.bi_valid,t.bi_valid+=r-qw):(t.bi_buf|=e<<t.bi_valid&65535,t.bi_valid+=r)}u(Tt,"send_bits");function xr(t,e,r){Tt(t,r[e*2],r[e*2+1])}u(xr,"send_code");function OF(t,e){var r=0;do r|=t&1,t>>>=1,r<<=1;while(--e>0);return r>>>1}u(OF,"bi_reverse");function Rj(t){t.bi_valid===16?(kl(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):t.bi_valid>=8&&(t.pending_buf[t.pending++]=t.bi_buf&255,t.bi_buf>>=8,t.bi_valid-=8)}u(Rj,"bi_flush");function Aj(t,e){var r=e.dyn_tree,i=e.max_code,n=e.stat_desc.static_tree,s=e.stat_desc.has_stree,a=e.stat_desc.extra_bits,l=e.stat_desc.extra_base,c=e.stat_desc.max_length,o,f,h,d,p,m,w=0;for(d=0;d<=vn;d++)t.bl_count[d]=0;for(r[t.heap[t.heap_max]*2+1]=0,o=t.heap_max+1;o<bF;o++)f=t.heap[o],d=r[r[f*2+1]*2+1]+1,d>c&&(d=c,w++),r[f*2+1]=d,!(f>i)&&(t.bl_count[d]++,p=0,f>=l&&(p=a[f-l]),m=r[f*2],t.opt_len+=m*(d+p),s&&(t.static_len+=m*(n[f*2+1]+p)));if(w!==0){do{for(d=c-1;t.bl_count[d]===0;)d--;t.bl_count[d]--,t.bl_count[d+1]+=2,t.bl_count[c]--,w-=2}while(w>0);for(d=c;d!==0;d--)for(f=t.bl_count[d];f!==0;)h=t.heap[--o],!(h>i)&&(r[h*2+1]!==d&&(t.opt_len+=(d-r[h*2+1])*r[h*2],r[h*2+1]=d),f--)}}u(Aj,"gen_bitlen");function RF(t,e,r){var i=new Array(vn+1),n=0,s,a;for(s=1;s<=vn;s++)i[s]=n=n+r[s-1]<<1;for(a=0;a<=e;a++){var l=t[a*2+1];l!==0&&(t[a*2]=OF(i[l]++,l))}}u(RF,"gen_codes");function Pj(){var t,e,r,i,n,s=new Array(vn+1);for(r=0,i=0;i<Gw-1;i++)for(Jw[i]=r,t=0;t<1<<Hw[i];t++)Fl[r++]=i;for(Fl[r-1]=i,n=0,i=0;i<16;i++)for(Ru[i]=n,t=0;t<1<<Ou[i];t++)El[n++]=i;for(n>>=7;i<wa;i++)for(Ru[i]=n<<7,t=0;t<1<<Ou[i]-7;t++)El[256+n++]=i;for(e=0;e<=vn;e++)s[e]=0;for(t=0;t<=143;)ei[t*2+1]=8,t++,s[8]++;for(;t<=255;)ei[t*2+1]=9,t++,s[9]++;for(;t<=279;)ei[t*2+1]=7,t++,s[7]++;for(;t<=287;)ei[t*2+1]=8,t++,s[8]++;for(RF(ei,Sl+1,s),t=0;t<wa;t++)vl[t*2+1]=5,vl[t*2]=OF(t,5);FF=new Uw(ei,Hw,Tl+1,Sl,vn),kF=new Uw(vl,Ou,0,wa,vn),TF=new Uw(new Array(0),xj,0,Zw,Tj)}u(Pj,"tr_static_init");function AF(t){var e;for(e=0;e<Sl;e++)t.dyn_ltree[e*2]=0;for(e=0;e<wa;e++)t.dyn_dtree[e*2]=0;for(e=0;e<Zw;e++)t.bl_tree[e*2]=0;t.dyn_ltree[Kw*2]=1,t.opt_len=t.static_len=0,t.last_lit=t.matches=0}u(AF,"init_block");function PF(t){t.bi_valid>8?kl(t,t.bi_buf):t.bi_valid>0&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0}u(PF,"bi_windup");function Nj(t,e,r,i){PF(t),i&&(kl(t,r),kl(t,~r)),bj.arraySet(t.pending_buf,t.window,e,r,t.pending),t.pending+=r}u(Nj,"copy_block");function dF(t,e,r,i){var n=e*2,s=r*2;return t[n]<t[s]||t[n]===t[s]&&i[e]<=i[r]}u(dF,"smaller");function Ww(t,e,r){for(var i=t.heap[r],n=r<<1;n<=t.heap_len&&(n<t.heap_len&&dF(e,t.heap[n+1],t.heap[n],t.depth)&&n++,!dF(e,i,t.heap[n],t.depth));)t.heap[r]=t.heap[n],r=n,n<<=1;t.heap[r]=i}u(Ww,"pqdownheap");function pF(t,e,r){var i,n,s=0,a,l;if(t.last_lit!==0)do i=t.pending_buf[t.d_buf+s*2]<<8|t.pending_buf[t.d_buf+s*2+1],n=t.pending_buf[t.l_buf+s],s++,i===0?xr(t,n,e):(a=Fl[n],xr(t,a+Tl+1,e),l=Hw[a],l!==0&&(n-=Jw[a],Tt(t,n,l)),i--,a=xF(i),xr(t,a,r),l=Ou[a],l!==0&&(i-=Ru[a],Tt(t,i,l)));while(s<t.last_lit);xr(t,Kw,e)}u(pF,"compress_block");function Vw(t,e){var r=e.dyn_tree,i=e.stat_desc.static_tree,n=e.stat_desc.has_stree,s=e.stat_desc.elems,a,l,c=-1,o;for(t.heap_len=0,t.heap_max=bF,a=0;a<s;a++)r[a*2]!==0?(t.heap[++t.heap_len]=c=a,t.depth[a]=0):r[a*2+1]=0;for(;t.heap_len<2;)o=t.heap[++t.heap_len]=c<2?++c:0,r[o*2]=1,t.depth[o]=0,t.opt_len--,n&&(t.static_len-=i[o*2+1]);for(e.max_code=c,a=t.heap_len>>1;a>=1;a--)Ww(t,r,a);o=s;do a=t.heap[1],t.heap[1]=t.heap[t.heap_len--],Ww(t,r,1),l=t.heap[1],t.heap[--t.heap_max]=a,t.heap[--t.heap_max]=l,r[o*2]=r[a*2]+r[l*2],t.depth[o]=(t.depth[a]>=t.depth[l]?t.depth[a]:t.depth[l])+1,r[a*2+1]=r[l*2+1]=o,t.heap[1]=o++,Ww(t,r,1);while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],Aj(t,e),RF(r,c,t.bl_count)}u(Vw,"build_tree");function mF(t,e,r){var i,n=-1,s,a=e[0*2+1],l=0,c=7,o=4;for(a===0&&(c=138,o=3),e[(r+1)*2+1]=65535,i=0;i<=r;i++)s=a,a=e[(i+1)*2+1],!(++l<c&&s===a)&&(l<o?t.bl_tree[s*2]+=l:s!==0?(s!==n&&t.bl_tree[s*2]++,t.bl_tree[_F*2]++):l<=10?t.bl_tree[vF*2]++:t.bl_tree[SF*2]++,l=0,n=s,a===0?(c=138,o=3):s===a?(c=6,o=3):(c=7,o=4))}u(mF,"scan_tree");function wF(t,e,r){var i,n=-1,s,a=e[0*2+1],l=0,c=7,o=4;for(a===0&&(c=138,o=3),i=0;i<=r;i++)if(s=a,a=e[(i+1)*2+1],!(++l<c&&s===a)){if(l<o)do xr(t,s,t.bl_tree);while(--l!==0);else s!==0?(s!==n&&(xr(t,s,t.bl_tree),l--),xr(t,_F,t.bl_tree),Tt(t,l-3,2)):l<=10?(xr(t,vF,t.bl_tree),Tt(t,l-3,3)):(xr(t,SF,t.bl_tree),Tt(t,l-11,7));l=0,n=s,a===0?(c=138,o=3):s===a?(c=6,o=3):(c=7,o=4)}}u(wF,"send_tree");function Dj(t){var e;for(mF(t,t.dyn_ltree,t.l_desc.max_code),mF(t,t.dyn_dtree,t.d_desc.max_code),Vw(t,t.bl_desc),e=Zw-1;e>=3&&t.bl_tree[EF[e]*2+1]===0;e--);return t.opt_len+=3*(e+1)+5+5+4,e}u(Dj,"build_bl_tree");function Cj(t,e,r,i){var n;for(Tt(t,e-257,5),Tt(t,r-1,5),Tt(t,i-4,4),n=0;n<i;n++)Tt(t,t.bl_tree[EF[n]*2+1],3);wF(t,t.dyn_ltree,e-1),wF(t,t.dyn_dtree,r-1)}u(Cj,"send_all_trees");function Ij(t){var e=4093624447,r;for(r=0;r<=31;r++,e>>>=1)if(e&1&&t.dyn_ltree[r*2]!==0)return uF;if(t.dyn_ltree[9*2]!==0||t.dyn_ltree[10*2]!==0||t.dyn_ltree[13*2]!==0)return hF;for(r=32;r<Tl;r++)if(t.dyn_ltree[r*2]!==0)return hF;return uF}u(Ij,"detect_data_type");var yF=!1;function $j(t){yF||(Pj(),yF=!0),t.l_desc=new zw(t.dyn_ltree,FF),t.d_desc=new zw(t.dyn_dtree,kF),t.bl_desc=new zw(t.bl_tree,TF),t.bi_buf=0,t.bi_valid=0,AF(t)}u($j,"_tr_init");function NF(t,e,r,i){Tt(t,(Sj<<1)+(i?1:0),3),Nj(t,e,r,!0)}u(NF,"_tr_stored_block");function Bj(t){Tt(t,gF<<1,3),xr(t,Kw,ei),Rj(t)}u(Bj,"_tr_align");function Lj(t,e,r,i){var n,s,a=0;t.level>0?(t.strm.data_type===vj&&(t.strm.data_type=Ij(t)),Vw(t,t.l_desc),Vw(t,t.d_desc),a=Dj(t),n=t.opt_len+3+7>>>3,s=t.static_len+3+7>>>3,s<=n&&(n=s)):n=s=r+5,r+4<=n&&e!==-1?NF(t,e,r,i):t.strategy===_j||s===n?(Tt(t,(gF<<1)+(i?1:0),3),pF(t,ei,vl)):(Tt(t,(Ej<<1)+(i?1:0),3),Cj(t,t.l_desc.max_code+1,t.d_desc.max_code+1,a+1),pF(t,t.dyn_ltree,t.dyn_dtree)),AF(t),i&&PF(t)}u(Lj,"_tr_flush_block");function Mj(t,e,r){return t.pending_buf[t.d_buf+t.last_lit*2]=e>>>8&255,t.pending_buf[t.d_buf+t.last_lit*2+1]=e&255,t.pending_buf[t.l_buf+t.last_lit]=r&255,t.last_lit++,e===0?t.dyn_ltree[r*2]++:(t.matches++,e--,t.dyn_ltree[(Fl[r]+Tl+1)*2]++,t.dyn_dtree[xF(e)*2]++),t.last_lit===t.lit_bufsize-1}u(Mj,"_tr_tally");ga._tr_init=$j;ga._tr_stored_block=NF;ga._tr_flush_block=Lj;ga._tr_tally=Mj;ga._tr_align=Bj});var Yw=x((ate,CF)=>{"use strict";function jj(t,e,r,i){for(var n=t&65535|0,s=t>>>16&65535|0,a=0;r!==0;){a=r>2e3?2e3:r,r-=a;do n=n+e[i++]|0,s=s+n|0;while(--a);n%=65521,s%=65521}return n|s<<16|0}u(jj,"adler32");CF.exports=jj});var Xw=x((lte,IF)=>{"use strict";function qj(){for(var t,e=[],r=0;r<256;r++){t=r;for(var i=0;i<8;i++)t=t&1?3988292384^t>>>1:t>>>1;e[r]=t}return e}u(qj,"makeTable");var Uj=qj();function zj(t,e,r,i){var n=Uj,s=i+r;t^=-1;for(var a=i;a<s;a++)t=t>>>8^n[(t^e[a])&255];return t^-1}u(zj,"crc32");IF.exports=zj});var Au=x((fte,$F)=>{"use strict";$F.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}});var HF=x(Ar=>{"use strict";var bt=Qr(),Xt=DF(),jF=Yw(),Ti=Xw(),Wj=Au(),kn=0,Hj=1,Vj=3,Pi=4,BF=5,Rr=0,LF=1,Qt=-2,Gj=-3,Qw=-5,Zj=-1,Kj=1,Pu=2,Jj=3,Yj=4,Xj=0,Qj=2,Iu=8,e8=9,t8=15,r8=8,i8=29,n8=256,ty=n8+1+i8,s8=30,a8=19,o8=2*ty+1,l8=15,Q=3,Ri=258,ur=Ri+Q+1,c8=32,$u=42,ry=69,Nu=73,Du=91,Cu=103,Sn=113,Ol=666,Ue=1,Rl=2,En=3,va=4,f8=3;function Ai(t,e){return t.msg=Wj[e],e}u(Ai,"err");function MF(t){return(t<<1)-(t>4?9:0)}u(MF,"rank");function Oi(t){for(var e=t.length;--e>=0;)t[e]=0}u(Oi,"zero");function xi(t){var e=t.state,r=e.pending;r>t.avail_out&&(r=t.avail_out),r!==0&&(bt.arraySet(t.output,e.pending_buf,e.pending_out,r,t.next_out),t.next_out+=r,e.pending_out+=r,t.total_out+=r,t.avail_out-=r,e.pending-=r,e.pending===0&&(e.pending_out=0))}u(xi,"flush_pending");function tt(t,e){Xt._tr_flush_block(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,xi(t.strm)}u(tt,"flush_block_only");function ae(t,e){t.pending_buf[t.pending++]=e}u(ae,"put_byte");function xl(t,e){t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=e&255}u(xl,"putShortMSB");function u8(t,e,r,i){var n=t.avail_in;return n>i&&(n=i),n===0?0:(t.avail_in-=n,bt.arraySet(e,t.input,t.next_in,n,r),t.state.wrap===1?t.adler=jF(t.adler,e,n,r):t.state.wrap===2&&(t.adler=Ti(t.adler,e,n,r)),t.next_in+=n,t.total_in+=n,n)}u(u8,"read_buf");function qF(t,e){var r=t.max_chain_length,i=t.strstart,n,s,a=t.prev_length,l=t.nice_match,c=t.strstart>t.w_size-ur?t.strstart-(t.w_size-ur):0,o=t.window,f=t.w_mask,h=t.prev,d=t.strstart+Ri,p=o[i+a-1],m=o[i+a];t.prev_length>=t.good_match&&(r>>=2),l>t.lookahead&&(l=t.lookahead);do if(n=e,!(o[n+a]!==m||o[n+a-1]!==p||o[n]!==o[i]||o[++n]!==o[i+1])){i+=2,n++;do;while(o[++i]===o[++n]&&o[++i]===o[++n]&&o[++i]===o[++n]&&o[++i]===o[++n]&&o[++i]===o[++n]&&o[++i]===o[++n]&&o[++i]===o[++n]&&o[++i]===o[++n]&&i<d);if(s=Ri-(d-i),i=d-Ri,s>a){if(t.match_start=e,a=s,s>=l)break;p=o[i+a-1],m=o[i+a]}}while((e=h[e&f])>c&&--r!==0);return a<=t.lookahead?a:t.lookahead}u(qF,"longest_match");function Fn(t){var e=t.w_size,r,i,n,s,a;do{if(s=t.window_size-t.lookahead-t.strstart,t.strstart>=e+(e-ur)){bt.arraySet(t.window,t.window,e,e,0),t.match_start-=e,t.strstart-=e,t.block_start-=e,i=t.hash_size,r=i;do n=t.head[--r],t.head[r]=n>=e?n-e:0;while(--i);i=e,r=i;do n=t.prev[--r],t.prev[r]=n>=e?n-e:0;while(--i);s+=e}if(t.strm.avail_in===0)break;if(i=u8(t.strm,t.window,t.strstart+t.lookahead,s),t.lookahead+=i,t.lookahead+t.insert>=Q)for(a=t.strstart-t.insert,t.ins_h=t.window[a],t.ins_h=(t.ins_h<<t.hash_shift^t.window[a+1])&t.hash_mask;t.insert&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[a+Q-1])&t.hash_mask,t.prev[a&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=a,a++,t.insert--,!(t.lookahead+t.insert<Q)););}while(t.lookahead<ur&&t.strm.avail_in!==0)}u(Fn,"fill_window");function h8(t,e){var r=65535;for(r>t.pending_buf_size-5&&(r=t.pending_buf_size-5);;){if(t.lookahead<=1){if(Fn(t),t.lookahead===0&&e===kn)return Ue;if(t.lookahead===0)break}t.strstart+=t.lookahead,t.lookahead=0;var i=t.block_start+r;if((t.strstart===0||t.strstart>=i)&&(t.lookahead=t.strstart-i,t.strstart=i,tt(t,!1),t.strm.avail_out===0)||t.strstart-t.block_start>=t.w_size-ur&&(tt(t,!1),t.strm.avail_out===0))return Ue}return t.insert=0,e===Pi?(tt(t,!0),t.strm.avail_out===0?En:va):(t.strstart>t.block_start&&(tt(t,!1),t.strm.avail_out===0),Ue)}u(h8,"deflate_stored");function ey(t,e){for(var r,i;;){if(t.lookahead<ur){if(Fn(t),t.lookahead<ur&&e===kn)return Ue;if(t.lookahead===0)break}if(r=0,t.lookahead>=Q&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+Q-1])&t.hash_mask,r=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),r!==0&&t.strstart-r<=t.w_size-ur&&(t.match_length=qF(t,r)),t.match_length>=Q)if(i=Xt._tr_tally(t,t.strstart-t.match_start,t.match_length-Q),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=Q){t.match_length--;do t.strstart++,t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+Q-1])&t.hash_mask,r=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart;while(--t.match_length!==0);t.strstart++}else t.strstart+=t.match_length,t.match_length=0,t.ins_h=t.window[t.strstart],t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+1])&t.hash_mask;else i=Xt._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++;if(i&&(tt(t,!1),t.strm.avail_out===0))return Ue}return t.insert=t.strstart<Q-1?t.strstart:Q-1,e===Pi?(tt(t,!0),t.strm.avail_out===0?En:va):t.last_lit&&(tt(t,!1),t.strm.avail_out===0)?Ue:Rl}u(ey,"deflate_fast");function ba(t,e){for(var r,i,n;;){if(t.lookahead<ur){if(Fn(t),t.lookahead<ur&&e===kn)return Ue;if(t.lookahead===0)break}if(r=0,t.lookahead>=Q&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+Q-1])&t.hash_mask,r=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),t.prev_length=t.match_length,t.prev_match=t.match_start,t.match_length=Q-1,r!==0&&t.prev_length<t.max_lazy_match&&t.strstart-r<=t.w_size-ur&&(t.match_length=qF(t,r),t.match_length<=5&&(t.strategy===Kj||t.match_length===Q&&t.strstart-t.match_start>4096)&&(t.match_length=Q-1)),t.prev_length>=Q&&t.match_length<=t.prev_length){n=t.strstart+t.lookahead-Q,i=Xt._tr_tally(t,t.strstart-1-t.prev_match,t.prev_length-Q),t.lookahead-=t.prev_length-1,t.prev_length-=2;do++t.strstart<=n&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+Q-1])&t.hash_mask,r=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart);while(--t.prev_length!==0);if(t.match_available=0,t.match_length=Q-1,t.strstart++,i&&(tt(t,!1),t.strm.avail_out===0))return Ue}else if(t.match_available){if(i=Xt._tr_tally(t,0,t.window[t.strstart-1]),i&&tt(t,!1),t.strstart++,t.lookahead--,t.strm.avail_out===0)return Ue}else t.match_available=1,t.strstart++,t.lookahead--}return t.match_available&&(i=Xt._tr_tally(t,0,t.window[t.strstart-1]),t.match_available=0),t.insert=t.strstart<Q-1?t.strstart:Q-1,e===Pi?(tt(t,!0),t.strm.avail_out===0?En:va):t.last_lit&&(tt(t,!1),t.strm.avail_out===0)?Ue:Rl}u(ba,"deflate_slow");function d8(t,e){for(var r,i,n,s,a=t.window;;){if(t.lookahead<=Ri){if(Fn(t),t.lookahead<=Ri&&e===kn)return Ue;if(t.lookahead===0)break}if(t.match_length=0,t.lookahead>=Q&&t.strstart>0&&(n=t.strstart-1,i=a[n],i===a[++n]&&i===a[++n]&&i===a[++n])){s=t.strstart+Ri;do;while(i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&n<s);t.match_length=Ri-(s-n),t.match_length>t.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=Q?(r=Xt._tr_tally(t,1,t.match_length-Q),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(r=Xt._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),r&&(tt(t,!1),t.strm.avail_out===0))return Ue}return t.insert=0,e===Pi?(tt(t,!0),t.strm.avail_out===0?En:va):t.last_lit&&(tt(t,!1),t.strm.avail_out===0)?Ue:Rl}u(d8,"deflate_rle");function p8(t,e){for(var r;;){if(t.lookahead===0&&(Fn(t),t.lookahead===0)){if(e===kn)return Ue;break}if(t.match_length=0,r=Xt._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,r&&(tt(t,!1),t.strm.avail_out===0))return Ue}return t.insert=0,e===Pi?(tt(t,!0),t.strm.avail_out===0?En:va):t.last_lit&&(tt(t,!1),t.strm.avail_out===0)?Ue:Rl}u(p8,"deflate_huff");function Or(t,e,r,i,n){this.good_length=t,this.max_lazy=e,this.nice_length=r,this.max_chain=i,this.func=n}u(Or,"Config");var _a;_a=[new Or(0,0,0,0,h8),new Or(4,4,8,4,ey),new Or(4,5,16,8,ey),new Or(4,6,32,32,ey),new Or(4,4,16,16,ba),new Or(8,16,32,32,ba),new Or(8,16,128,128,ba),new Or(8,32,128,256,ba),new Or(32,128,258,1024,ba),new Or(32,258,258,4096,ba)];function m8(t){t.window_size=2*t.w_size,Oi(t.head),t.max_lazy_match=_a[t.level].max_lazy,t.good_match=_a[t.level].good_length,t.nice_match=_a[t.level].nice_length,t.max_chain_length=_a[t.level].max_chain,t.strstart=0,t.block_start=0,t.lookahead=0,t.insert=0,t.match_length=t.prev_length=Q-1,t.match_available=0,t.ins_h=0}u(m8,"lm_init");function w8(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=Iu,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new bt.Buf16(o8*2),this.dyn_dtree=new bt.Buf16((2*s8+1)*2),this.bl_tree=new bt.Buf16((2*a8+1)*2),Oi(this.dyn_ltree),Oi(this.dyn_dtree),Oi(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new bt.Buf16(l8+1),this.heap=new bt.Buf16(2*ty+1),Oi(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new bt.Buf16(2*ty+1),Oi(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}u(w8,"DeflateState");function UF(t){var e;return!t||!t.state?Ai(t,Qt):(t.total_in=t.total_out=0,t.data_type=Qj,e=t.state,e.pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=e.wrap?$u:Sn,t.adler=e.wrap===2?0:1,e.last_flush=kn,Xt._tr_init(e),Rr)}u(UF,"deflateResetKeep");function zF(t){var e=UF(t);return e===Rr&&m8(t.state),e}u(zF,"deflateReset");function y8(t,e){return!t||!t.state||t.state.wrap!==2?Qt:(t.state.gzhead=e,Rr)}u(y8,"deflateSetHeader");function WF(t,e,r,i,n,s){if(!t)return Qt;var a=1;if(e===Zj&&(e=6),i<0?(a=0,i=-i):i>15&&(a=2,i-=16),n<1||n>e8||r!==Iu||i<8||i>15||e<0||e>9||s<0||s>Yj)return Ai(t,Qt);i===8&&(i=9);var l=new w8;return t.state=l,l.strm=t,l.wrap=a,l.gzhead=null,l.w_bits=i,l.w_size=1<<l.w_bits,l.w_mask=l.w_size-1,l.hash_bits=n+7,l.hash_size=1<<l.hash_bits,l.hash_mask=l.hash_size-1,l.hash_shift=~~((l.hash_bits+Q-1)/Q),l.window=new bt.Buf8(l.w_size*2),l.head=new bt.Buf16(l.hash_size),l.prev=new bt.Buf16(l.w_size),l.lit_bufsize=1<<n+6,l.pending_buf_size=l.lit_bufsize*4,l.pending_buf=new bt.Buf8(l.pending_buf_size),l.d_buf=1*l.lit_bufsize,l.l_buf=3*l.lit_bufsize,l.level=e,l.strategy=s,l.method=r,zF(t)}u(WF,"deflateInit2");function g8(t,e){return WF(t,e,Iu,t8,r8,Xj)}u(g8,"deflateInit");function b8(t,e){var r,i,n,s;if(!t||!t.state||e>BF||e<0)return t?Ai(t,Qt):Qt;if(i=t.state,!t.output||!t.input&&t.avail_in!==0||i.status===Ol&&e!==Pi)return Ai(t,t.avail_out===0?Qw:Qt);if(i.strm=t,r=i.last_flush,i.last_flush=e,i.status===$u)if(i.wrap===2)t.adler=0,ae(i,31),ae(i,139),ae(i,8),i.gzhead?(ae(i,(i.gzhead.text?1:0)+(i.gzhead.hcrc?2:0)+(i.gzhead.extra?4:0)+(i.gzhead.name?8:0)+(i.gzhead.comment?16:0)),ae(i,i.gzhead.time&255),ae(i,i.gzhead.time>>8&255),ae(i,i.gzhead.time>>16&255),ae(i,i.gzhead.time>>24&255),ae(i,i.level===9?2:i.strategy>=Pu||i.level<2?4:0),ae(i,i.gzhead.os&255),i.gzhead.extra&&i.gzhead.extra.length&&(ae(i,i.gzhead.extra.length&255),ae(i,i.gzhead.extra.length>>8&255)),i.gzhead.hcrc&&(t.adler=Ti(t.adler,i.pending_buf,i.pending,0)),i.gzindex=0,i.status=ry):(ae(i,0),ae(i,0),ae(i,0),ae(i,0),ae(i,0),ae(i,i.level===9?2:i.strategy>=Pu||i.level<2?4:0),ae(i,f8),i.status=Sn);else{var a=Iu+(i.w_bits-8<<4)<<8,l=-1;i.strategy>=Pu||i.level<2?l=0:i.level<6?l=1:i.level===6?l=2:l=3,a|=l<<6,i.strstart!==0&&(a|=c8),a+=31-a%31,i.status=Sn,xl(i,a),i.strstart!==0&&(xl(i,t.adler>>>16),xl(i,t.adler&65535)),t.adler=1}if(i.status===ry)if(i.gzhead.extra){for(n=i.pending;i.gzindex<(i.gzhead.extra.length&65535)&&!(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>n&&(t.adler=Ti(t.adler,i.pending_buf,i.pending-n,n)),xi(t),n=i.pending,i.pending===i.pending_buf_size));)ae(i,i.gzhead.extra[i.gzindex]&255),i.gzindex++;i.gzhead.hcrc&&i.pending>n&&(t.adler=Ti(t.adler,i.pending_buf,i.pending-n,n)),i.gzindex===i.gzhead.extra.length&&(i.gzindex=0,i.status=Nu)}else i.status=Nu;if(i.status===Nu)if(i.gzhead.name){n=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>n&&(t.adler=Ti(t.adler,i.pending_buf,i.pending-n,n)),xi(t),n=i.pending,i.pending===i.pending_buf_size)){s=1;break}i.gzindex<i.gzhead.name.length?s=i.gzhead.name.charCodeAt(i.gzindex++)&255:s=0,ae(i,s)}while(s!==0);i.gzhead.hcrc&&i.pending>n&&(t.adler=Ti(t.adler,i.pending_buf,i.pending-n,n)),s===0&&(i.gzindex=0,i.status=Du)}else i.status=Du;if(i.status===Du)if(i.gzhead.comment){n=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>n&&(t.adler=Ti(t.adler,i.pending_buf,i.pending-n,n)),xi(t),n=i.pending,i.pending===i.pending_buf_size)){s=1;break}i.gzindex<i.gzhead.comment.length?s=i.gzhead.comment.charCodeAt(i.gzindex++)&255:s=0,ae(i,s)}while(s!==0);i.gzhead.hcrc&&i.pending>n&&(t.adler=Ti(t.adler,i.pending_buf,i.pending-n,n)),s===0&&(i.status=Cu)}else i.status=Cu;if(i.status===Cu&&(i.gzhead.hcrc?(i.pending+2>i.pending_buf_size&&xi(t),i.pending+2<=i.pending_buf_size&&(ae(i,t.adler&255),ae(i,t.adler>>8&255),t.adler=0,i.status=Sn)):i.status=Sn),i.pending!==0){if(xi(t),t.avail_out===0)return i.last_flush=-1,Rr}else if(t.avail_in===0&&MF(e)<=MF(r)&&e!==Pi)return Ai(t,Qw);if(i.status===Ol&&t.avail_in!==0)return Ai(t,Qw);if(t.avail_in!==0||i.lookahead!==0||e!==kn&&i.status!==Ol){var c=i.strategy===Pu?p8(i,e):i.strategy===Jj?d8(i,e):_a[i.level].func(i,e);if((c===En||c===va)&&(i.status=Ol),c===Ue||c===En)return t.avail_out===0&&(i.last_flush=-1),Rr;if(c===Rl&&(e===Hj?Xt._tr_align(i):e!==BF&&(Xt._tr_stored_block(i,0,0,!1),e===Vj&&(Oi(i.head),i.lookahead===0&&(i.strstart=0,i.block_start=0,i.insert=0))),xi(t),t.avail_out===0))return i.last_flush=-1,Rr}return e!==Pi?Rr:i.wrap<=0?LF:(i.wrap===2?(ae(i,t.adler&255),ae(i,t.adler>>8&255),ae(i,t.adler>>16&255),ae(i,t.adler>>24&255),ae(i,t.total_in&255),ae(i,t.total_in>>8&255),ae(i,t.total_in>>16&255),ae(i,t.total_in>>24&255)):(xl(i,t.adler>>>16),xl(i,t.adler&65535)),xi(t),i.wrap>0&&(i.wrap=-i.wrap),i.pending!==0?Rr:LF)}u(b8,"deflate");function _8(t){var e;return!t||!t.state?Qt:(e=t.state.status,e!==$u&&e!==ry&&e!==Nu&&e!==Du&&e!==Cu&&e!==Sn&&e!==Ol?Ai(t,Qt):(t.state=null,e===Sn?Ai(t,Gj):Rr))}u(_8,"deflateEnd");function v8(t,e){var r=e.length,i,n,s,a,l,c,o,f;if(!t||!t.state||(i=t.state,a=i.wrap,a===2||a===1&&i.status!==$u||i.lookahead))return Qt;for(a===1&&(t.adler=jF(t.adler,e,r,0)),i.wrap=0,r>=i.w_size&&(a===0&&(Oi(i.head),i.strstart=0,i.block_start=0,i.insert=0),f=new bt.Buf8(i.w_size),bt.arraySet(f,e,r-i.w_size,i.w_size,0),e=f,r=i.w_size),l=t.avail_in,c=t.next_in,o=t.input,t.avail_in=r,t.next_in=0,t.input=e,Fn(i);i.lookahead>=Q;){n=i.strstart,s=i.lookahead-(Q-1);do i.ins_h=(i.ins_h<<i.hash_shift^i.window[n+Q-1])&i.hash_mask,i.prev[n&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=n,n++;while(--s);i.strstart=n,i.lookahead=Q-1,Fn(i)}return i.strstart+=i.lookahead,i.block_start=i.strstart,i.insert=i.lookahead,i.lookahead=0,i.match_length=i.prev_length=Q-1,i.match_available=0,t.next_in=c,t.input=o,t.avail_in=l,i.wrap=a,Rr}u(v8,"deflateSetDictionary");Ar.deflateInit=g8;Ar.deflateInit2=WF;Ar.deflateReset=zF;Ar.deflateResetKeep=UF;Ar.deflateSetHeader=y8;Ar.deflate=b8;Ar.deflateEnd=_8;Ar.deflateSetDictionary=v8;Ar.deflateInfo="pako deflate (from Nodeca project)"});var iy=x(Sa=>{"use strict";var Bu=Qr(),VF=!0,GF=!0;try{String.fromCharCode.apply(null,[0])}catch{VF=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{GF=!1}var Al=new Bu.Buf8(256);for(ti=0;ti<256;ti++)Al[ti]=ti>=252?6:ti>=248?5:ti>=240?4:ti>=224?3:ti>=192?2:1;var ti;Al[254]=Al[254]=1;Sa.string2buf=function(t){var e,r,i,n,s,a=t.length,l=0;for(n=0;n<a;n++)r=t.charCodeAt(n),(r&64512)===55296&&n+1<a&&(i=t.charCodeAt(n+1),(i&64512)===56320&&(r=65536+(r-55296<<10)+(i-56320),n++)),l+=r<128?1:r<2048?2:r<65536?3:4;for(e=new Bu.Buf8(l),s=0,n=0;s<l;n++)r=t.charCodeAt(n),(r&64512)===55296&&n+1<a&&(i=t.charCodeAt(n+1),(i&64512)===56320&&(r=65536+(r-55296<<10)+(i-56320),n++)),r<128?e[s++]=r:r<2048?(e[s++]=192|r>>>6,e[s++]=128|r&63):r<65536?(e[s++]=224|r>>>12,e[s++]=128|r>>>6&63,e[s++]=128|r&63):(e[s++]=240|r>>>18,e[s++]=128|r>>>12&63,e[s++]=128|r>>>6&63,e[s++]=128|r&63);return e};function ZF(t,e){if(e<65534&&(t.subarray&&GF||!t.subarray&&VF))return String.fromCharCode.apply(null,Bu.shrinkBuf(t,e));for(var r="",i=0;i<e;i++)r+=String.fromCharCode(t[i]);return r}u(ZF,"buf2binstring");Sa.buf2binstring=function(t){return ZF(t,t.length)};Sa.binstring2buf=function(t){for(var e=new Bu.Buf8(t.length),r=0,i=e.length;r<i;r++)e[r]=t.charCodeAt(r);return e};Sa.buf2string=function(t,e){var r,i,n,s,a=e||t.length,l=new Array(a*2);for(i=0,r=0;r<a;){if(n=t[r++],n<128){l[i++]=n;continue}if(s=Al[n],s>4){l[i++]=65533,r+=s-1;continue}for(n&=s===2?31:s===3?15:7;s>1&&r<a;)n=n<<6|t[r++]&63,s--;if(s>1){l[i++]=65533;continue}n<65536?l[i++]=n:(n-=65536,l[i++]=55296|n>>10&1023,l[i++]=56320|n&1023)}return ZF(l,i)};Sa.utf8border=function(t,e){var r;for(e=e||t.length,e>t.length&&(e=t.length),r=e-1;r>=0&&(t[r]&192)===128;)r--;return r<0||r===0?e:r+Al[t[r]]>e?r:e}});var ny=x((mte,KF)=>{"use strict";function S8(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}u(S8,"ZStream");KF.exports=S8});var QF=x(Dl=>{"use strict";var Pl=HF(),Nl=Qr(),ay=iy(),oy=Au(),E8=ny(),XF=Object.prototype.toString,F8=0,sy=4,Ea=0,JF=1,YF=2,k8=-1,T8=0,x8=8;function Tn(t){if(!(this instanceof Tn))return new Tn(t);this.options=Nl.assign({level:k8,method:x8,chunkSize:16384,windowBits:15,memLevel:8,strategy:T8,to:""},t||{});var e=this.options;e.raw&&e.windowBits>0?e.windowBits=-e.windowBits:e.gzip&&e.windowBits>0&&e.windowBits<16&&(e.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new E8,this.strm.avail_out=0;var r=Pl.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(r!==Ea)throw new Error(oy[r]);if(e.header&&Pl.deflateSetHeader(this.strm,e.header),e.dictionary){var i;if(typeof e.dictionary=="string"?i=ay.string2buf(e.dictionary):XF.call(e.dictionary)==="[object ArrayBuffer]"?i=new Uint8Array(e.dictionary):i=e.dictionary,r=Pl.deflateSetDictionary(this.strm,i),r!==Ea)throw new Error(oy[r]);this._dict_set=!0}}u(Tn,"Deflate");Tn.prototype.push=function(t,e){var r=this.strm,i=this.options.chunkSize,n,s;if(this.ended)return!1;s=e===~~e?e:e===!0?sy:F8,typeof t=="string"?r.input=ay.string2buf(t):XF.call(t)==="[object ArrayBuffer]"?r.input=new Uint8Array(t):r.input=t,r.next_in=0,r.avail_in=r.input.length;do{if(r.avail_out===0&&(r.output=new Nl.Buf8(i),r.next_out=0,r.avail_out=i),n=Pl.deflate(r,s),n!==JF&&n!==Ea)return this.onEnd(n),this.ended=!0,!1;(r.avail_out===0||r.avail_in===0&&(s===sy||s===YF))&&(this.options.to==="string"?this.onData(ay.buf2binstring(Nl.shrinkBuf(r.output,r.next_out))):this.onData(Nl.shrinkBuf(r.output,r.next_out)))}while((r.avail_in>0||r.avail_out===0)&&n!==JF);return s===sy?(n=Pl.deflateEnd(this.strm),this.onEnd(n),this.ended=!0,n===Ea):(s===YF&&(this.onEnd(Ea),r.avail_out=0),!0)};Tn.prototype.onData=function(t){this.chunks.push(t)};Tn.prototype.onEnd=function(t){t===Ea&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=Nl.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};function ly(t,e){var r=new Tn(e);if(r.push(t,!0),r.err)throw r.msg||oy[r.err];return r.result}u(ly,"deflate");function O8(t,e){return e=e||{},e.raw=!0,ly(t,e)}u(O8,"deflateRaw");function R8(t,e){return e=e||{},e.gzip=!0,ly(t,e)}u(R8,"gzip");Dl.Deflate=Tn;Dl.deflate=ly;Dl.deflateRaw=O8;Dl.gzip=R8});var tk=x((bte,ek)=>{"use strict";var Lu=30,A8=12;ek.exports=u(function(e,r){var i,n,s,a,l,c,o,f,h,d,p,m,w,g,b,_,S,F,k,A,v,T,E,R,P;i=e.state,n=e.next_in,R=e.input,s=n+(e.avail_in-5),a=e.next_out,P=e.output,l=a-(r-e.avail_out),c=a+(e.avail_out-257),o=i.dmax,f=i.wsize,h=i.whave,d=i.wnext,p=i.window,m=i.hold,w=i.bits,g=i.lencode,b=i.distcode,_=(1<<i.lenbits)-1,S=(1<<i.distbits)-1;e:do{w<15&&(m+=R[n++]<<w,w+=8,m+=R[n++]<<w,w+=8),F=g[m&_];t:for(;;){if(k=F>>>24,m>>>=k,w-=k,k=F>>>16&255,k===0)P[a++]=F&65535;else if(k&16){A=F&65535,k&=15,k&&(w<k&&(m+=R[n++]<<w,w+=8),A+=m&(1<<k)-1,m>>>=k,w-=k),w<15&&(m+=R[n++]<<w,w+=8,m+=R[n++]<<w,w+=8),F=b[m&S];r:for(;;){if(k=F>>>24,m>>>=k,w-=k,k=F>>>16&255,k&16){if(v=F&65535,k&=15,w<k&&(m+=R[n++]<<w,w+=8,w<k&&(m+=R[n++]<<w,w+=8)),v+=m&(1<<k)-1,v>o){e.msg="invalid distance too far back",i.mode=Lu;break e}if(m>>>=k,w-=k,k=a-l,v>k){if(k=v-k,k>h&&i.sane){e.msg="invalid distance too far back",i.mode=Lu;break e}if(T=0,E=p,d===0){if(T+=f-k,k<A){A-=k;do P[a++]=p[T++];while(--k);T=a-v,E=P}}else if(d<k){if(T+=f+d-k,k-=d,k<A){A-=k;do P[a++]=p[T++];while(--k);if(T=0,d<A){k=d,A-=k;do P[a++]=p[T++];while(--k);T=a-v,E=P}}}else if(T+=d-k,k<A){A-=k;do P[a++]=p[T++];while(--k);T=a-v,E=P}for(;A>2;)P[a++]=E[T++],P[a++]=E[T++],P[a++]=E[T++],A-=3;A&&(P[a++]=E[T++],A>1&&(P[a++]=E[T++]))}else{T=a-v;do P[a++]=P[T++],P[a++]=P[T++],P[a++]=P[T++],A-=3;while(A>2);A&&(P[a++]=P[T++],A>1&&(P[a++]=P[T++]))}}else if(k&64){e.msg="invalid distance code",i.mode=Lu;break e}else{F=b[(F&65535)+(m&(1<<k)-1)];continue r}break}}else if(k&64)if(k&32){i.mode=A8;break e}else{e.msg="invalid literal/length code",i.mode=Lu;break e}else{F=g[(F&65535)+(m&(1<<k)-1)];continue t}break}}while(n<s&&a<c);A=w>>3,n-=A,w-=A<<3,m&=(1<<w)-1,e.next_in=n,e.next_out=a,e.avail_in=n<s?5+(s-n):5-(n-s),e.avail_out=a<c?257+(c-a):257-(a-c),i.hold=m,i.bits=w},"inflate_fast")});var lk=x((vte,ok)=>{"use strict";var rk=Qr(),Fa=15,ik=852,nk=592,sk=0,cy=1,ak=2,P8=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],N8=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],D8=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],C8=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];ok.exports=u(function(e,r,i,n,s,a,l,c){var o=c.bits,f=0,h=0,d=0,p=0,m=0,w=0,g=0,b=0,_=0,S=0,F,k,A,v,T,E=null,R=0,P,I=new rk.Buf16(Fa+1),B=new rk.Buf16(Fa+1),z=null,we=0,st,Dt,Ft;for(f=0;f<=Fa;f++)I[f]=0;for(h=0;h<n;h++)I[r[i+h]]++;for(m=o,p=Fa;p>=1&&I[p]===0;p--);if(m>p&&(m=p),p===0)return s[a++]=1<<24|64<<16|0,s[a++]=1<<24|64<<16|0,c.bits=1,0;for(d=1;d<p&&I[d]===0;d++);for(m<d&&(m=d),b=1,f=1;f<=Fa;f++)if(b<<=1,b-=I[f],b<0)return-1;if(b>0&&(e===sk||p!==1))return-1;for(B[1]=0,f=1;f<Fa;f++)B[f+1]=B[f]+I[f];for(h=0;h<n;h++)r[i+h]!==0&&(l[B[r[i+h]]++]=h);if(e===sk?(E=z=l,P=19):e===cy?(E=P8,R-=257,z=N8,we-=257,P=256):(E=D8,z=C8,P=-1),S=0,h=0,f=d,T=a,w=m,g=0,A=-1,_=1<<m,v=_-1,e===cy&&_>ik||e===ak&&_>nk)return 1;for(;;){st=f-g,l[h]<P?(Dt=0,Ft=l[h]):l[h]>P?(Dt=z[we+l[h]],Ft=E[R+l[h]]):(Dt=96,Ft=0),F=1<<f-g,k=1<<w,d=k;do k-=F,s[T+(S>>g)+k]=st<<24|Dt<<16|Ft|0;while(k!==0);for(F=1<<f-1;S&F;)F>>=1;if(F!==0?(S&=F-1,S+=F):S=0,h++,--I[f]===0){if(f===p)break;f=r[i+l[h]]}if(f>m&&(S&v)!==A){for(g===0&&(g=m),T+=d,w=f-g,b=1<<w;w+g<p&&(b-=I[w+g],!(b<=0));)w++,b<<=1;if(_+=1<<w,e===cy&&_>ik||e===ak&&_>nk)return 1;A=S&v,s[A]=m<<24|w<<16|T-a|0}}return S!==0&&(s[T+S]=f-g<<24|64<<16|0),c.bits=m,0},"inflate_table")});var zk=x(hr=>{"use strict";var Mt=Qr(),my=Yw(),Pr=Xw(),I8=tk(),Cl=lk(),$8=0,Ck=1,Ik=2,ck=4,B8=5,Mu=6,xn=0,L8=1,M8=2,er=-2,$k=-3,wy=-4,j8=-5,fk=8,Bk=1,uk=2,hk=3,dk=4,pk=5,mk=6,wk=7,yk=8,gk=9,bk=10,Uu=11,ri=12,fy=13,_k=14,uy=15,vk=16,Sk=17,Ek=18,Fk=19,ju=20,qu=21,kk=22,Tk=23,xk=24,Ok=25,Rk=26,hy=27,Ak=28,Pk=29,Se=30,yy=31,q8=32,U8=852,z8=592,W8=15,H8=W8;function Nk(t){return(t>>>24&255)+(t>>>8&65280)+((t&65280)<<8)+((t&255)<<24)}u(Nk,"zswap32");function V8(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Mt.Buf16(320),this.work=new Mt.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}u(V8,"InflateState");function Lk(t){var e;return!t||!t.state?er:(e=t.state,t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=e.wrap&1),e.mode=Bk,e.last=0,e.havedict=0,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new Mt.Buf32(U8),e.distcode=e.distdyn=new Mt.Buf32(z8),e.sane=1,e.back=-1,xn)}u(Lk,"inflateResetKeep");function Mk(t){var e;return!t||!t.state?er:(e=t.state,e.wsize=0,e.whave=0,e.wnext=0,Lk(t))}u(Mk,"inflateReset");function jk(t,e){var r,i;return!t||!t.state||(i=t.state,e<0?(r=0,e=-e):(r=(e>>4)+1,e<48&&(e&=15)),e&&(e<8||e>15))?er:(i.window!==null&&i.wbits!==e&&(i.window=null),i.wrap=r,i.wbits=e,Mk(t))}u(jk,"inflateReset2");function qk(t,e){var r,i;return t?(i=new V8,t.state=i,i.window=null,r=jk(t,e),r!==xn&&(t.state=null),r):er}u(qk,"inflateInit2");function G8(t){return qk(t,H8)}u(G8,"inflateInit");var Dk=!0,dy,py;function Z8(t){if(Dk){var e;for(dy=new Mt.Buf32(512),py=new Mt.Buf32(32),e=0;e<144;)t.lens[e++]=8;for(;e<256;)t.lens[e++]=9;for(;e<280;)t.lens[e++]=7;for(;e<288;)t.lens[e++]=8;for(Cl(Ck,t.lens,0,288,dy,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;Cl(Ik,t.lens,0,32,py,0,t.work,{bits:5}),Dk=!1}t.lencode=dy,t.lenbits=9,t.distcode=py,t.distbits=5}u(Z8,"fixedtables");function Uk(t,e,r,i){var n,s=t.state;return s.window===null&&(s.wsize=1<<s.wbits,s.wnext=0,s.whave=0,s.window=new Mt.Buf8(s.wsize)),i>=s.wsize?(Mt.arraySet(s.window,e,r-s.wsize,s.wsize,0),s.wnext=0,s.whave=s.wsize):(n=s.wsize-s.wnext,n>i&&(n=i),Mt.arraySet(s.window,e,r-i,n,s.wnext),i-=n,i?(Mt.arraySet(s.window,e,r-i,i,0),s.wnext=i,s.whave=s.wsize):(s.wnext+=n,s.wnext===s.wsize&&(s.wnext=0),s.whave<s.wsize&&(s.whave+=n))),0}u(Uk,"updatewindow");function K8(t,e){var r,i,n,s,a,l,c,o,f,h,d,p,m,w,g=0,b,_,S,F,k,A,v,T,E=new Mt.Buf8(4),R,P,I=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!t||!t.state||!t.output||!t.input&&t.avail_in!==0)return er;r=t.state,r.mode===ri&&(r.mode=fy),a=t.next_out,n=t.output,c=t.avail_out,s=t.next_in,i=t.input,l=t.avail_in,o=r.hold,f=r.bits,h=l,d=c,T=xn;e:for(;;)switch(r.mode){case Bk:if(r.wrap===0){r.mode=fy;break}for(;f<16;){if(l===0)break e;l--,o+=i[s++]<<f,f+=8}if(r.wrap&2&&o===35615){r.check=0,E[0]=o&255,E[1]=o>>>8&255,r.check=Pr(r.check,E,2,0),o=0,f=0,r.mode=uk;break}if(r.flags=0,r.head&&(r.head.done=!1),!(r.wrap&1)||(((o&255)<<8)+(o>>8))%31){t.msg="incorrect header check",r.mode=Se;break}if((o&15)!==fk){t.msg="unknown compression method",r.mode=Se;break}if(o>>>=4,f-=4,v=(o&15)+8,r.wbits===0)r.wbits=v;else if(v>r.wbits){t.msg="invalid window size",r.mode=Se;break}r.dmax=1<<v,t.adler=r.check=1,r.mode=o&512?bk:ri,o=0,f=0;break;case uk:for(;f<16;){if(l===0)break e;l--,o+=i[s++]<<f,f+=8}if(r.flags=o,(r.flags&255)!==fk){t.msg="unknown compression method",r.mode=Se;break}if(r.flags&57344){t.msg="unknown header flags set",r.mode=Se;break}r.head&&(r.head.text=o>>8&1),r.flags&512&&(E[0]=o&255,E[1]=o>>>8&255,r.check=Pr(r.check,E,2,0)),o=0,f=0,r.mode=hk;case hk:for(;f<32;){if(l===0)break e;l--,o+=i[s++]<<f,f+=8}r.head&&(r.head.time=o),r.flags&512&&(E[0]=o&255,E[1]=o>>>8&255,E[2]=o>>>16&255,E[3]=o>>>24&255,r.check=Pr(r.check,E,4,0)),o=0,f=0,r.mode=dk;case dk:for(;f<16;){if(l===0)break e;l--,o+=i[s++]<<f,f+=8}r.head&&(r.head.xflags=o&255,r.head.os=o>>8),r.flags&512&&(E[0]=o&255,E[1]=o>>>8&255,r.check=Pr(r.check,E,2,0)),o=0,f=0,r.mode=pk;case pk:if(r.flags&1024){for(;f<16;){if(l===0)break e;l--,o+=i[s++]<<f,f+=8}r.length=o,r.head&&(r.head.extra_len=o),r.flags&512&&(E[0]=o&255,E[1]=o>>>8&255,r.check=Pr(r.check,E,2,0)),o=0,f=0}else r.head&&(r.head.extra=null);r.mode=mk;case mk:if(r.flags&1024&&(p=r.length,p>l&&(p=l),p&&(r.head&&(v=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Array(r.head.extra_len)),Mt.arraySet(r.head.extra,i,s,p,v)),r.flags&512&&(r.check=Pr(r.check,i,p,s)),l-=p,s+=p,r.length-=p),r.length))break e;r.length=0,r.mode=wk;case wk:if(r.flags&2048){if(l===0)break e;p=0;do v=i[s+p++],r.head&&v&&r.length<65536&&(r.head.name+=String.fromCharCode(v));while(v&&p<l);if(r.flags&512&&(r.check=Pr(r.check,i,p,s)),l-=p,s+=p,v)break e}else r.head&&(r.head.name=null);r.length=0,r.mode=yk;case yk:if(r.flags&4096){if(l===0)break e;p=0;do v=i[s+p++],r.head&&v&&r.length<65536&&(r.head.comment+=String.fromCharCode(v));while(v&&p<l);if(r.flags&512&&(r.check=Pr(r.check,i,p,s)),l-=p,s+=p,v)break e}else r.head&&(r.head.comment=null);r.mode=gk;case gk:if(r.flags&512){for(;f<16;){if(l===0)break e;l--,o+=i[s++]<<f,f+=8}if(o!==(r.check&65535)){t.msg="header crc mismatch",r.mode=Se;break}o=0,f=0}r.head&&(r.head.hcrc=r.flags>>9&1,r.head.done=!0),t.adler=r.check=0,r.mode=ri;break;case bk:for(;f<32;){if(l===0)break e;l--,o+=i[s++]<<f,f+=8}t.adler=r.check=Nk(o),o=0,f=0,r.mode=Uu;case Uu:if(r.havedict===0)return t.next_out=a,t.avail_out=c,t.next_in=s,t.avail_in=l,r.hold=o,r.bits=f,M8;t.adler=r.check=1,r.mode=ri;case ri:if(e===B8||e===Mu)break e;case fy:if(r.last){o>>>=f&7,f-=f&7,r.mode=hy;break}for(;f<3;){if(l===0)break e;l--,o+=i[s++]<<f,f+=8}switch(r.last=o&1,o>>>=1,f-=1,o&3){case 0:r.mode=_k;break;case 1:if(Z8(r),r.mode=ju,e===Mu){o>>>=2,f-=2;break e}break;case 2:r.mode=Sk;break;case 3:t.msg="invalid block type",r.mode=Se}o>>>=2,f-=2;break;case _k:for(o>>>=f&7,f-=f&7;f<32;){if(l===0)break e;l--,o+=i[s++]<<f,f+=8}if((o&65535)!==(o>>>16^65535)){t.msg="invalid stored block lengths",r.mode=Se;break}if(r.length=o&65535,o=0,f=0,r.mode=uy,e===Mu)break e;case uy:r.mode=vk;case vk:if(p=r.length,p){if(p>l&&(p=l),p>c&&(p=c),p===0)break e;Mt.arraySet(n,i,s,p,a),l-=p,s+=p,c-=p,a+=p,r.length-=p;break}r.mode=ri;break;case Sk:for(;f<14;){if(l===0)break e;l--,o+=i[s++]<<f,f+=8}if(r.nlen=(o&31)+257,o>>>=5,f-=5,r.ndist=(o&31)+1,o>>>=5,f-=5,r.ncode=(o&15)+4,o>>>=4,f-=4,r.nlen>286||r.ndist>30){t.msg="too many length or distance symbols",r.mode=Se;break}r.have=0,r.mode=Ek;case Ek:for(;r.have<r.ncode;){for(;f<3;){if(l===0)break e;l--,o+=i[s++]<<f,f+=8}r.lens[I[r.have++]]=o&7,o>>>=3,f-=3}for(;r.have<19;)r.lens[I[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,R={bits:r.lenbits},T=Cl($8,r.lens,0,19,r.lencode,0,r.work,R),r.lenbits=R.bits,T){t.msg="invalid code lengths set",r.mode=Se;break}r.have=0,r.mode=Fk;case Fk:for(;r.have<r.nlen+r.ndist;){for(;g=r.lencode[o&(1<<r.lenbits)-1],b=g>>>24,_=g>>>16&255,S=g&65535,!(b<=f);){if(l===0)break e;l--,o+=i[s++]<<f,f+=8}if(S<16)o>>>=b,f-=b,r.lens[r.have++]=S;else{if(S===16){for(P=b+2;f<P;){if(l===0)break e;l--,o+=i[s++]<<f,f+=8}if(o>>>=b,f-=b,r.have===0){t.msg="invalid bit length repeat",r.mode=Se;break}v=r.lens[r.have-1],p=3+(o&3),o>>>=2,f-=2}else if(S===17){for(P=b+3;f<P;){if(l===0)break e;l--,o+=i[s++]<<f,f+=8}o>>>=b,f-=b,v=0,p=3+(o&7),o>>>=3,f-=3}else{for(P=b+7;f<P;){if(l===0)break e;l--,o+=i[s++]<<f,f+=8}o>>>=b,f-=b,v=0,p=11+(o&127),o>>>=7,f-=7}if(r.have+p>r.nlen+r.ndist){t.msg="invalid bit length repeat",r.mode=Se;break}for(;p--;)r.lens[r.have++]=v}}if(r.mode===Se)break;if(r.lens[256]===0){t.msg="invalid code -- missing end-of-block",r.mode=Se;break}if(r.lenbits=9,R={bits:r.lenbits},T=Cl(Ck,r.lens,0,r.nlen,r.lencode,0,r.work,R),r.lenbits=R.bits,T){t.msg="invalid literal/lengths set",r.mode=Se;break}if(r.distbits=6,r.distcode=r.distdyn,R={bits:r.distbits},T=Cl(Ik,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,R),r.distbits=R.bits,T){t.msg="invalid distances set",r.mode=Se;break}if(r.mode=ju,e===Mu)break e;case ju:r.mode=qu;case qu:if(l>=6&&c>=258){t.next_out=a,t.avail_out=c,t.next_in=s,t.avail_in=l,r.hold=o,r.bits=f,I8(t,d),a=t.next_out,n=t.output,c=t.avail_out,s=t.next_in,i=t.input,l=t.avail_in,o=r.hold,f=r.bits,r.mode===ri&&(r.back=-1);break}for(r.back=0;g=r.lencode[o&(1<<r.lenbits)-1],b=g>>>24,_=g>>>16&255,S=g&65535,!(b<=f);){if(l===0)break e;l--,o+=i[s++]<<f,f+=8}if(_&&!(_&240)){for(F=b,k=_,A=S;g=r.lencode[A+((o&(1<<F+k)-1)>>F)],b=g>>>24,_=g>>>16&255,S=g&65535,!(F+b<=f);){if(l===0)break e;l--,o+=i[s++]<<f,f+=8}o>>>=F,f-=F,r.back+=F}if(o>>>=b,f-=b,r.back+=b,r.length=S,_===0){r.mode=Rk;break}if(_&32){r.back=-1,r.mode=ri;break}if(_&64){t.msg="invalid literal/length code",r.mode=Se;break}r.extra=_&15,r.mode=kk;case kk:if(r.extra){for(P=r.extra;f<P;){if(l===0)break e;l--,o+=i[s++]<<f,f+=8}r.length+=o&(1<<r.extra)-1,o>>>=r.extra,f-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=Tk;case Tk:for(;g=r.distcode[o&(1<<r.distbits)-1],b=g>>>24,_=g>>>16&255,S=g&65535,!(b<=f);){if(l===0)break e;l--,o+=i[s++]<<f,f+=8}if(!(_&240)){for(F=b,k=_,A=S;g=r.distcode[A+((o&(1<<F+k)-1)>>F)],b=g>>>24,_=g>>>16&255,S=g&65535,!(F+b<=f);){if(l===0)break e;l--,o+=i[s++]<<f,f+=8}o>>>=F,f-=F,r.back+=F}if(o>>>=b,f-=b,r.back+=b,_&64){t.msg="invalid distance code",r.mode=Se;break}r.offset=S,r.extra=_&15,r.mode=xk;case xk:if(r.extra){for(P=r.extra;f<P;){if(l===0)break e;l--,o+=i[s++]<<f,f+=8}r.offset+=o&(1<<r.extra)-1,o>>>=r.extra,f-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){t.msg="invalid distance too far back",r.mode=Se;break}r.mode=Ok;case Ok:if(c===0)break e;if(p=d-c,r.offset>p){if(p=r.offset-p,p>r.whave&&r.sane){t.msg="invalid distance too far back",r.mode=Se;break}p>r.wnext?(p-=r.wnext,m=r.wsize-p):m=r.wnext-p,p>r.length&&(p=r.length),w=r.window}else w=n,m=a-r.offset,p=r.length;p>c&&(p=c),c-=p,r.length-=p;do n[a++]=w[m++];while(--p);r.length===0&&(r.mode=qu);break;case Rk:if(c===0)break e;n[a++]=r.length,c--,r.mode=qu;break;case hy:if(r.wrap){for(;f<32;){if(l===0)break e;l--,o|=i[s++]<<f,f+=8}if(d-=c,t.total_out+=d,r.total+=d,d&&(t.adler=r.check=r.flags?Pr(r.check,n,d,a-d):my(r.check,n,d,a-d)),d=c,(r.flags?o:Nk(o))!==r.check){t.msg="incorrect data check",r.mode=Se;break}o=0,f=0}r.mode=Ak;case Ak:if(r.wrap&&r.flags){for(;f<32;){if(l===0)break e;l--,o+=i[s++]<<f,f+=8}if(o!==(r.total&4294967295)){t.msg="incorrect length check",r.mode=Se;break}o=0,f=0}r.mode=Pk;case Pk:T=L8;break e;case Se:T=$k;break e;case yy:return wy;case q8:default:return er}return t.next_out=a,t.avail_out=c,t.next_in=s,t.avail_in=l,r.hold=o,r.bits=f,(r.wsize||d!==t.avail_out&&r.mode<Se&&(r.mode<hy||e!==ck))&&Uk(t,t.output,t.next_out,d-t.avail_out)?(r.mode=yy,wy):(h-=t.avail_in,d-=t.avail_out,t.total_in+=h,t.total_out+=d,r.total+=d,r.wrap&&d&&(t.adler=r.check=r.flags?Pr(r.check,n,d,t.next_out-d):my(r.check,n,d,t.next_out-d)),t.data_type=r.bits+(r.last?64:0)+(r.mode===ri?128:0)+(r.mode===ju||r.mode===uy?256:0),(h===0&&d===0||e===ck)&&T===xn&&(T=j8),T)}u(K8,"inflate");function J8(t){if(!t||!t.state)return er;var e=t.state;return e.window&&(e.window=null),t.state=null,xn}u(J8,"inflateEnd");function Y8(t,e){var r;return!t||!t.state||(r=t.state,!(r.wrap&2))?er:(r.head=e,e.done=!1,xn)}u(Y8,"inflateGetHeader");function X8(t,e){var r=e.length,i,n,s;return!t||!t.state||(i=t.state,i.wrap!==0&&i.mode!==Uu)?er:i.mode===Uu&&(n=1,n=my(n,e,r,0),n!==i.check)?$k:(s=Uk(t,e,r,r),s?(i.mode=yy,wy):(i.havedict=1,xn))}u(X8,"inflateSetDictionary");hr.inflateReset=Mk;hr.inflateReset2=jk;hr.inflateResetKeep=Lk;hr.inflateInit=G8;hr.inflateInit2=qk;hr.inflate=K8;hr.inflateEnd=J8;hr.inflateGetHeader=Y8;hr.inflateSetDictionary=X8;hr.inflateInfo="pako inflate (from Nodeca project)"});var gy=x((kte,Wk)=>{"use strict";Wk.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}});var Vk=x((Tte,Hk)=>{"use strict";function Q8(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}u(Q8,"GZheader");Hk.exports=Q8});var Zk=x($l=>{"use strict";var ka=zk(),Il=Qr(),zu=iy(),Ae=gy(),by=Au(),e6=ny(),t6=Vk(),Gk=Object.prototype.toString;function On(t){if(!(this instanceof On))return new On(t);this.options=Il.assign({chunkSize:16384,windowBits:0,to:""},t||{});var e=this.options;e.raw&&e.windowBits>=0&&e.windowBits<16&&(e.windowBits=-e.windowBits,e.windowBits===0&&(e.windowBits=-15)),e.windowBits>=0&&e.windowBits<16&&!(t&&t.windowBits)&&(e.windowBits+=32),e.windowBits>15&&e.windowBits<48&&(e.windowBits&15||(e.windowBits|=15)),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new e6,this.strm.avail_out=0;var r=ka.inflateInit2(this.strm,e.windowBits);if(r!==Ae.Z_OK)throw new Error(by[r]);if(this.header=new t6,ka.inflateGetHeader(this.strm,this.header),e.dictionary&&(typeof e.dictionary=="string"?e.dictionary=zu.string2buf(e.dictionary):Gk.call(e.dictionary)==="[object ArrayBuffer]"&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(r=ka.inflateSetDictionary(this.strm,e.dictionary),r!==Ae.Z_OK)))throw new Error(by[r])}u(On,"Inflate");On.prototype.push=function(t,e){var r=this.strm,i=this.options.chunkSize,n=this.options.dictionary,s,a,l,c,o,f=!1;if(this.ended)return!1;a=e===~~e?e:e===!0?Ae.Z_FINISH:Ae.Z_NO_FLUSH,typeof t=="string"?r.input=zu.binstring2buf(t):Gk.call(t)==="[object ArrayBuffer]"?r.input=new Uint8Array(t):r.input=t,r.next_in=0,r.avail_in=r.input.length;do{if(r.avail_out===0&&(r.output=new Il.Buf8(i),r.next_out=0,r.avail_out=i),s=ka.inflate(r,Ae.Z_NO_FLUSH),s===Ae.Z_NEED_DICT&&n&&(s=ka.inflateSetDictionary(this.strm,n)),s===Ae.Z_BUF_ERROR&&f===!0&&(s=Ae.Z_OK,f=!1),s!==Ae.Z_STREAM_END&&s!==Ae.Z_OK)return this.onEnd(s),this.ended=!0,!1;r.next_out&&(r.avail_out===0||s===Ae.Z_STREAM_END||r.avail_in===0&&(a===Ae.Z_FINISH||a===Ae.Z_SYNC_FLUSH))&&(this.options.to==="string"?(l=zu.utf8border(r.output,r.next_out),c=r.next_out-l,o=zu.buf2string(r.output,l),r.next_out=c,r.avail_out=i-c,c&&Il.arraySet(r.output,r.output,l,c,0),this.onData(o)):this.onData(Il.shrinkBuf(r.output,r.next_out))),r.avail_in===0&&r.avail_out===0&&(f=!0)}while((r.avail_in>0||r.avail_out===0)&&s!==Ae.Z_STREAM_END);return s===Ae.Z_STREAM_END&&(a=Ae.Z_FINISH),a===Ae.Z_FINISH?(s=ka.inflateEnd(this.strm),this.onEnd(s),this.ended=!0,s===Ae.Z_OK):(a===Ae.Z_SYNC_FLUSH&&(this.onEnd(Ae.Z_OK),r.avail_out=0),!0)};On.prototype.onData=function(t){this.chunks.push(t)};On.prototype.onEnd=function(t){t===Ae.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=Il.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};function _y(t,e){var r=new On(e);if(r.push(t,!0),r.err)throw r.msg||by[r.err];return r.result}u(_y,"inflate");function r6(t,e){return e=e||{},e.raw=!0,_y(t,e)}u(r6,"inflateRaw");$l.Inflate=On;$l.inflate=_y;$l.inflateRaw=r6;$l.ungzip=_y});var Yk=x((Ate,Jk)=>{"use strict";var i6=Qr().assign,n6=QF(),s6=Zk(),a6=gy(),Kk={};i6(Kk,n6,s6,a6);Jk.exports=Kk});var eT=x((Pte,Qk)=>{"use strict";var Xk=u((t,e)=>function(...r){let i=e.promiseModule;return new i((n,s)=>{e.multiArgs?r.push((...a)=>{e.errorFirst?a[0]?s(a):(a.shift(),n(a)):n(a)}):e.errorFirst?r.push((a,l)=>{a?s(a):n(l)}):r.push(n),t.apply(this,r)})},"processFn");Qk.exports=(t,e)=>{e=Object.assign({exclude:[/.+(Sync|Stream)$/],errorFirst:!0,promiseModule:Promise},e);let r=typeof t;if(!(t!==null&&(r==="object"||r==="function")))throw new TypeError(`Expected \`input\` to be a \`Function\` or \`Object\`, got \`${t===null?"null":r}\``);let i=u(s=>{let a=u(l=>typeof l=="string"?s===l:l.test(s),"match");return e.include?e.include.some(a):!e.exclude.some(a)},"filter"),n;r==="function"?n=u(function(...s){return e.excludeMain?t(...s):Xk(t,e).apply(this,s)},"ret"):n=Object.create(Object.getPrototypeOf(t));for(let s in t){let a=t[s];n[s]=typeof a=="function"&&i(s)?Xk(a,e):a}return n}});var cT=x((Dte,lT)=>{function tT(t){return Array.isArray(t)?t:[t]}u(tT,"makeArray");var Ey="",rT=" ",vy="\\",o6=/^\s+$/,l6=/(?:[^\\]|^)\\$/,c6=/^\\!/,f6=/^\\#/,u6=/\r?\n/g,h6=/^\.*\/|^\.+$/,Sy="/",sT="node-ignore";typeof Symbol<"u"&&(sT=Symbol.for("node-ignore"));var iT=sT,d6=u((t,e,r)=>Object.defineProperty(t,e,{value:r}),"define"),p6=/([0-z])-([0-z])/g,aT=u(()=>!1,"RETURN_FALSE"),m6=u(t=>t.replace(p6,(e,r,i)=>r.charCodeAt(0)<=i.charCodeAt(0)?e:Ey),"sanitizeRange"),w6=u(t=>{let{length:e}=t;return t.slice(0,e-e%2)},"cleanRangeBackSlash"),y6=[[/^\uFEFF/,()=>Ey],[/((?:\\\\)*?)(\\?\s+)$/,(t,e,r)=>e+(r.indexOf("\\")===0?rT:Ey)],[/(\\+?)\s/g,(t,e)=>{let{length:r}=e;return e.slice(0,r-r%2)+rT}],[/[\\$.|*+(){^]/g,t=>`\\${t}`],[/(?!\\)\?/g,()=>"[^/]"],[/^\//,()=>"^"],[/\//g,()=>"\\/"],[/^\^*\\\*\\\*\\\//,()=>"^(?:.*\\/)?"],[/^(?=[^^])/,u(function(){return/\/(?!$)/.test(this)?"^":"(?:^|\\/)"},"startingReplacer")],[/\\\/\\\*\\\*(?=\\\/|$)/g,(t,e,r)=>e+6<r.length?"(?:\\/[^\\/]+)*":"\\/.+"],[/(^|[^\\]+)(\\\*)+(?=.+)/g,(t,e,r)=>{let i=r.replace(/\\\*/g,"[^\\/]*");return e+i}],[/\\\\\\(?=[$.|*+(){^])/g,()=>vy],[/\\\\/g,()=>vy],[/(\\)?\[([^\]/]*?)(\\*)($|\])/g,(t,e,r,i,n)=>e===vy?`\\[${r}${w6(i)}${n}`:n==="]"&&i.length%2===0?`[${m6(r)}${i}]`:"[]"],[/(?:[^*])$/,t=>/\/$/.test(t)?`${t}$`:`${t}(?=$|\\/$)`],[/(\^|\\\/)?\\\*$/,(t,e)=>`${e?`${e}[^/]+`:"[^/]*"}(?=$|\\/$)`]],nT=Object.create(null),g6=u((t,e)=>{let r=nT[t];return r||(r=y6.reduce((i,[n,s])=>i.replace(n,s.bind(t)),t),nT[t]=r),e?new RegExp(r,"i"):new RegExp(r)},"makeRegex"),Ty=u(t=>typeof t=="string","isString"),b6=u(t=>t&&Ty(t)&&!o6.test(t)&&!l6.test(t)&&t.indexOf("#")!==0,"checkPattern"),_6=u(t=>t.split(u6),"splitPattern"),xy=class xy{constructor(e,r,i,n){this.origin=e,this.pattern=r,this.negative=i,this.regex=n}};u(xy,"IgnoreRule");var Fy=xy,v6=u((t,e)=>{let r=t,i=!1;t.indexOf("!")===0&&(i=!0,t=t.substr(1)),t=t.replace(c6,"!").replace(f6,"#");let n=g6(t,e);return new Fy(r,t,i,n)},"createRule"),S6=u((t,e)=>{throw new e(t)},"throwError"),ii=u((t,e,r)=>Ty(t)?t?ii.isNotRelative(t)?r(`path should be a \`path.relative()\`d string, but got "${e}"`,RangeError):!0:r("path must not be empty",TypeError):r(`path must be a string, but got \`${e}\``,TypeError),"checkPath"),oT=u(t=>h6.test(t),"isNotRelative");ii.isNotRelative=oT;ii.convert=t=>t;var Oy=class Oy{constructor({ignorecase:e=!0,ignoreCase:r=e,allowRelativePaths:i=!1}={}){d6(this,iT,!0),this._rules=[],this._ignoreCase=r,this._allowRelativePaths=i,this._initCache()}_initCache(){this._ignoreCache=Object.create(null),this._testCache=Object.create(null)}_addPattern(e){if(e&&e[iT]){this._rules=this._rules.concat(e._rules),this._added=!0;return}if(b6(e)){let r=v6(e,this._ignoreCase);this._added=!0,this._rules.push(r)}}add(e){return this._added=!1,tT(Ty(e)?_6(e):e).forEach(this._addPattern,this),this._added&&this._initCache(),this}addPattern(e){return this.add(e)}_testOne(e,r){let i=!1,n=!1;return this._rules.forEach(s=>{let{negative:a}=s;if(n===a&&i!==n||a&&!i&&!n&&!r)return;s.regex.test(e)&&(i=!a,n=a)}),{ignored:i,unignored:n}}_test(e,r,i,n){let s=e&&ii.convert(e);return ii(s,e,this._allowRelativePaths?aT:S6),this._t(s,r,i,n)}_t(e,r,i,n){if(e in r)return r[e];if(n||(n=e.split(Sy)),n.pop(),!n.length)return r[e]=this._testOne(e,i);let s=this._t(n.join(Sy)+Sy,r,i,n);return r[e]=s.ignored?s:this._testOne(e,i)}ignores(e){return this._test(e,this._ignoreCache,!1).ignored}createFilter(){return e=>!this.ignores(e)}filter(e){return tT(e).filter(this.createFilter())}test(e){return this._test(e,this._testCache,!0)}};u(Oy,"Ignore");var ky=Oy,Wu=u(t=>new ky(t),"factory"),E6=u(t=>ii(t&&ii.convert(t),t,aT),"isPathValid");Wu.isPathValid=E6;Wu.default=Wu;lT.exports=Wu;if(typeof process<"u"&&(process.env&&process.env.IGNORE_TEST_WIN32||process.platform==="win32")){let t=u(r=>/^\\\\\?\\/.test(r)||/["<>|\u0000-\u001F]+/u.test(r)?r:r.replace(/\\/g,"/"),"makePosix");ii.convert=t;let e=/^[a-z]:\//i;ii.isNotRelative=r=>e.test(r)||oT(r)}});var uT=x((Ite,fT)=>{"use strict";function F6(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}u(F6,"escapeRegExp");function Nr(t,e,r){return e=e instanceof RegExp?e:new RegExp(F6(e),"g"),t.replace(e,r)}u(Nr,"replaceAll");var k6={clean:u(function(e){if(typeof e!="string")throw new Error("Expected a string, received: "+e);return e=Nr(e,"./","/"),e=Nr(e,"..","."),e=Nr(e," ","-"),e=Nr(e,/^[~^:?*\\\-]/g,""),e=Nr(e,/[~^:?*\\]/g,"-"),e=Nr(e,/[~^:?*\\\-]$/g,""),e=Nr(e,"@{","-"),e=Nr(e,/\.$/g,""),e=Nr(e,/\/$/g,""),e=Nr(e,/\.lock$/g,""),e},"clean")};fT.exports=k6});var dT=x((Bte,hT)=>{hT.exports=function(t,e){var r=t,i=e,n=r.length,s=i.length,a=!1,l=null,c=n+1,o=[],f=[],h=[],d="",p=-1,m=0,w=1,g,b,_=u(function(){n>=s&&(g=r,b=n,r=i,i=g,n=s,s=b,a=!0,c=n+1)},"init"),S=u(function(v,T,E){return{x:v,y:T,k:E}},"P"),F=u(function(v,T){return{elem:v,t:T}},"seselem"),k=u(function(v,T,E){var R,P,I;for(T>E?R=o[v-1+c]:R=o[v+1+c],I=Math.max(T,E),P=I-v;P<n&&I<s&&r[P]===i[I];)++P,++I;return o[v+c]=f.length,f[f.length]=new S(P,I,R),I},"snake"),A=u(function(v){var T,E,R,P,I;for(T=E=1,R=P=0,I=v.length-1;I>=0;--I)for(;R<v[I].x||P<v[I].y;)v[I].y-v[I].x>P-R?(a?h[h.length]=new F(i[P],p):h[h.length]=new F(i[P],w),++E,++P):v[I].y-v[I].x<P-R?(a?h[h.length]=new F(r[R],w):h[h.length]=new F(r[R],p),++T,++R):(h[h.length]=new F(r[R],m),d+=r[R],++T,++E,++R,++P)},"recordseq");return _(),{SES_DELETE:-1,SES_COMMON:0,SES_ADD:1,editdistance:u(function(){return l},"editdistance"),getlcs:u(function(){return d},"getlcs"),getses:u(function(){return h},"getses"),compose:u(function(){var v,T,E,R,P,I,B,z;for(v=s-n,T=n+s+3,E={},B=0;B<T;++B)E[B]=-1,o[B]=-1;R=-1;do{for(++R,z=-R;z<=v-1;++z)E[z+c]=k(z,E[z-1+c]+1,E[z+1+c]);for(z=v+R;z>=v+1;--z)E[z+c]=k(z,E[z-1+c]+1,E[z+1+c]);E[v+c]=k(v,E[v-1+c]+1,E[v+1+c])}while(E[v+c]!==s);for(l=v+2*R,P=o[v+c],I=[];P!==-1;)I[I.length]=new S(f[P].x,f[P].y,null),P=f[P].k;A(I)},"compose")}}});var wT=x((Mte,mT)=>{var T6=dT();function x6(t,e){var r=new T6(t,e);r.compose();for(var i=r.getses(),n,s,a=t.length-1,l=e.length-1,c=i.length-1;c>=0;--c)i[c].t===r.SES_COMMON?(s?(s.chain={file1index:a,file2index:l,chain:null},s=s.chain):(n={file1index:a,file2index:l,chain:null},s=n),a--,l--):i[c].t===r.SES_DELETE?a--:i[c].t===r.SES_ADD&&l--;var o={file1index:-1,file2index:-1,chain:null};return s?(s.chain=o,n):o}u(x6,"longestCommonSubsequence");function pT(t,e){for(var r=[],i=t.length,n=e.length,s=x6(t,e);s!==null;s=s.chain){var a=i-s.file1index-1,l=n-s.file2index-1;i=s.file1index,n=s.file2index,(a||l)&&r.push({file1:[i+1,a],file2:[n+1,l]})}return r.reverse(),r}u(pT,"diffIndices");function O6(t,e,r){var i,n=pT(e,t),s=pT(e,r),a=[];function l(B,z){a.push([B.file1[0],z,B.file1[1],B.file2[0],B.file2[1]])}for(u(l,"addHunk"),i=0;i<n.length;i++)l(n[i],0);for(i=0;i<s.length;i++)l(s[i],2);a.sort(function(B,z){return B[0]-z[0]});var c=[],o=0;function f(B){B>o&&(c.push([1,o,B-o]),o=B)}u(f,"copyCommon");for(var h=0;h<a.length;h++){for(var d=h,p=a[h],m=p[0],w=m+p[2];h<a.length-1;){var g=a[h+1],b=g[0];if(b>w)break;w=Math.max(w,b+g[2]),h++}if(f(m),d==h)p[4]>0&&c.push([p[1],p[3],p[4]]);else{var _={0:[t.length,-1,e.length,-1],2:[r.length,-1,e.length,-1]};for(i=d;i<=h;i++){p=a[i];var S=p[1],F=_[S],k=p[0],A=k+p[2],v=p[3],T=v+p[4];F[0]=Math.min(v,F[0]),F[1]=Math.max(T,F[1]),F[2]=Math.min(k,F[2]),F[3]=Math.max(A,F[3])}var E=_[0][0]+(m-_[0][2]),R=_[0][1]+(w-_[0][3]),P=_[2][0]+(m-_[2][2]),I=_[2][1]+(w-_[2][3]);c.push([-1,E,R-E,m,w-m,P,I-P])}o=w}return f(e.length),c}u(O6,"diff3MergeIndices");function R6(t,e,r){var i=[],n=[t,e,r],s=O6(t,e,r),a=[];function l(){a.length&&i.push({ok:a}),a=[]}u(l,"flushOk");function c(p){for(var m=0;m<p.length;m++)a.push(p[m])}u(c,"pushOk");function o(p){if(p[2]!=p[6])return!0;for(var m=p[1],w=p[5],g=0;g<p[2];g++)if(t[g+m]!=r[g+w])return!0;return!1}u(o,"isTrueConflict");for(var f=0;f<s.length;f++){var h=s[f],d=h[0];d==-1?o(h)?(l(),i.push({conflict:{a:t.slice(h[1],h[1]+h[2]),aIndex:h[1],o:e.slice(h[3],h[3]+h[4]),oIndex:h[3],b:r.slice(h[5],h[5]+h[6]),bIndex:h[5]}})):c(n[0].slice(h[1],h[1]+h[2])):c(n[d].slice(h[1],h[1]+h[2]))}return l(),i}u(R6,"diff3Merge");mT.exports=R6});var Le=x(L=>{"use strict";Object.defineProperty(L,"__esModule",{value:!0});function qi(t){return t&&typeof t=="object"&&"default"in t?t.default:t}u(qi,"_interopDefault");var Ml=qi(GS()),MT=qi(lF()),A6=qi(fF()),eg=qi(Yk()),Ry=qi(eT()),P6=qi(cT()),jl=qi(uT()),N6=qi(wT()),ih=class ih extends Error{constructor(e){super(e),this.caller=""}toJSON(){return{code:this.code,data:this.data,caller:this.caller,message:this.message,stack:this.stack}}fromJSON(e){let r=new ih(e.message);return r.code=e.code,r.data=e.data,r.caller=e.caller,r.stack=e.stack,r}get isIsomorphicGitError(){return!0}};u(ih,"BaseError");var re=ih,nh=class nh extends re{constructor(e){super(`Modifying the index is not possible because you have unmerged files: ${e.toString}. Fix them up in the work tree, and then use 'git add/rm as appropriate to mark resolution and make a commit.`),this.code=this.name=nh.code,this.data={filepaths:e}}};u(nh,"UnmergedPathsError");var ql=nh;ql.code="UnmergedPathsError";var sh=class sh extends re{constructor(e){super(`An internal error caused this command to fail.
|
|
10
10
|
|
|
11
11
|
If you're not a developer, report the bug to the developers of the application you're using. If this is a bug in isomorphic-git then you should create a proper bug yourselves. The bug should include a minimal reproduction and details about the version and environment.
|
|
12
12
|
|
|
13
|
-
Please file a bug report at https://github.com/isomorphic-git/isomorphic-git/issues with this error message: ${e}`),this.code=this.name=
|
|
14
|
-
`)}static async _entryToBuffer(e){let r=Buffer.from(e.path),i=Math.ceil((62+r.length+1)/8)*8,n=Buffer.alloc(i),s=new
|
|
13
|
+
Please file a bug report at https://github.com/isomorphic-git/isomorphic-git/issues with this error message: ${e}`),this.code=this.name=sh.code,this.data={message:e}}};u(sh,"InternalError");var H=sh;H.code="InternalError";var ah=class ah extends re{constructor(e){super(`The filepath "${e}" contains unsafe character sequences`),this.code=this.name=ah.code,this.data={filepath:e}}};u(ah,"UnsafeFilepathError");var Ra=ah;Ra.code="UnsafeFilepathError";var og=class og{constructor(e){this.buffer=e,this._start=0}eof(){return this._start>=this.buffer.length}tell(){return this._start}seek(e){this._start=e}slice(e){let r=this.buffer.slice(this._start,this._start+e);return this._start+=e,r}toString(e,r){let i=this.buffer.toString(e,this._start,this._start+r);return this._start+=r,i}write(e,r,i){let n=this.buffer.write(e,this._start,r,i);return this._start+=r,n}copy(e,r,i){let n=e.copy(this.buffer,this._start,r,i);return this._start+=n,n}readUInt8(){let e=this.buffer.readUInt8(this._start);return this._start+=1,e}writeUInt8(e){let r=this.buffer.writeUInt8(e,this._start);return this._start+=1,r}readUInt16BE(){let e=this.buffer.readUInt16BE(this._start);return this._start+=2,e}writeUInt16BE(e){let r=this.buffer.writeUInt16BE(e,this._start);return this._start+=2,r}readUInt32BE(){let e=this.buffer.readUInt32BE(this._start);return this._start+=4,e}writeUInt32BE(e){let r=this.buffer.writeUInt32BE(e,this._start);return this._start+=4,r}};u(og,"BufferCursor");var tr=og;function Uh(t,e){return-(t<e)||+(t>e)}u(Uh,"compareStrings");function jT(t,e){return Uh(t.path,e.path)}u(jT,"comparePath");function qT(t){let e=t>0?t>>12:0;e!==4&&e!==8&&e!==10&&e!==14&&(e=8);let r=t&511;return r&73?r=493:r=420,e!==8&&(r=0),(e<<12)+r}u(qT,"normalizeMode");var Dr=2**32;function yT(t,e,r,i){if(t!==void 0&&e!==void 0)return[t,e];r===void 0&&(r=i.valueOf());let n=Math.floor(r/1e3),s=(r-n*1e3)*1e6;return[n,s]}u(yT,"SecondsNanoseconds");function Aa(t){let[e,r]=yT(t.ctimeSeconds,t.ctimeNanoseconds,t.ctimeMs,t.ctime),[i,n]=yT(t.mtimeSeconds,t.mtimeNanoseconds,t.mtimeMs,t.mtime);return{ctimeSeconds:e%Dr,ctimeNanoseconds:r%Dr,mtimeSeconds:i%Dr,mtimeNanoseconds:n%Dr,dev:t.dev%Dr,ino:t.ino%Dr,mode:qT(t.mode%Dr),uid:t.uid%Dr,gid:t.gid%Dr,size:t.size>-1?t.size%Dr:0}}u(Aa,"normalizeStats");function D6(t){let e="";for(let r of new Uint8Array(t))r<16&&(e+="0"),e+=r.toString(16);return e}u(D6,"toHex");var Ay=null;async function si(t){return Ay===null&&(Ay=await I6()),Ay?UT(t):C6(t)}u(si,"shasum");function C6(t){return new MT().update(t).digest("hex")}u(C6,"shasumSync");async function UT(t){let e=await crypto.subtle.digest("SHA-1",t);return D6(e)}u(UT,"subtleSHA1");async function I6(){try{return await UT(new Uint8Array([]))==="da39a3ee5e6b4b0d3255bfef95601890afd80709"}catch{}return!1}u(I6,"testSubtleSHA1");function $6(t){return{assumeValid:!!(t&32768),extended:!!(t&16384),stage:(t&12288)>>12,nameLength:t&4095}}u($6,"parseCacheEntryFlags");function B6(t){let e=t.flags;return e.extended=!1,e.nameLength=Math.min(Buffer.from(t.path).length,4095),(e.assumeValid?32768:0)+(e.extended?16384:0)+((e.stage&3)<<12)+(e.nameLength&4095)}u(B6,"renderCacheEntryFlags");var Di=class Di{constructor(e,r){this._dirty=!1,this._unmergedPaths=r||new Set,this._entries=e||new Map}_addEntry(e){if(e.flags.stage===0)e.stages=[e],this._entries.set(e.path,e),this._unmergedPaths.delete(e.path);else{let r=this._entries.get(e.path);r||(this._entries.set(e.path,e),r=e),r.stages[e.flags.stage]=e,this._unmergedPaths.add(e.path)}}static async from(e){if(Buffer.isBuffer(e))return Di.fromBuffer(e);if(e===null)return new Di(null);throw new H("invalid type passed to GitIndex.from")}static async fromBuffer(e){if(e.length===0)throw new H("Index file is empty (.git/index)");let r=new Di,i=new tr(e),n=i.toString("utf8",4);if(n!=="DIRC")throw new H(`Invalid dircache magic file number: ${n}`);let s=await si(e.slice(0,-20)),a=e.slice(-20).toString("hex");if(a!==s)throw new H(`Invalid checksum in GitIndex buffer: expected ${a} but saw ${s}`);let l=i.readUInt32BE();if(l!==2)throw new H(`Unsupported dircache version: ${l}`);let c=i.readUInt32BE(),o=0;for(;!i.eof()&&o<c;){let f={};f.ctimeSeconds=i.readUInt32BE(),f.ctimeNanoseconds=i.readUInt32BE(),f.mtimeSeconds=i.readUInt32BE(),f.mtimeNanoseconds=i.readUInt32BE(),f.dev=i.readUInt32BE(),f.ino=i.readUInt32BE(),f.mode=i.readUInt32BE(),f.uid=i.readUInt32BE(),f.gid=i.readUInt32BE(),f.size=i.readUInt32BE(),f.oid=i.slice(20).toString("hex");let h=i.readUInt16BE();f.flags=$6(h);let d=e.indexOf(0,i.tell()+1)-i.tell();if(d<1)throw new H(`Got a path length of: ${d}`);if(f.path=i.toString("utf8",d),f.path.includes("..\\")||f.path.includes("../"))throw new Ra(f.path);let p=8-(i.tell()-12)%8;for(p===0&&(p=8);p--;){let m=i.readUInt8();if(m!==0)throw new H(`Expected 1-8 null characters but got '${m}' after ${f.path}`);if(i.eof())throw new H("Unexpected end of file")}f.stages=[],r._addEntry(f),o++}return r}get unmergedPaths(){return[...this._unmergedPaths]}get entries(){return[...this._entries.values()].sort(jT)}get entriesMap(){return this._entries}get entriesFlat(){return[...this.entries].flatMap(e=>e.stages.length>1?e.stages.filter(r=>r):e)}*[Symbol.iterator](){for(let e of this.entries)yield e}insert({filepath:e,stats:r,oid:i,stage:n=0}){r||(r={ctimeSeconds:0,ctimeNanoseconds:0,mtimeSeconds:0,mtimeNanoseconds:0,dev:0,ino:0,mode:0,uid:0,gid:0,size:0}),r=Aa(r);let s=Buffer.from(e),a={ctimeSeconds:r.ctimeSeconds,ctimeNanoseconds:r.ctimeNanoseconds,mtimeSeconds:r.mtimeSeconds,mtimeNanoseconds:r.mtimeNanoseconds,dev:r.dev,ino:r.ino,mode:r.mode||33188,uid:r.uid,gid:r.gid,size:r.size,path:e,oid:i,flags:{assumeValid:!1,extended:!1,stage:n,nameLength:s.length<4095?s.length:4095},stages:[]};this._addEntry(a),this._dirty=!0}delete({filepath:e}){if(this._entries.has(e))this._entries.delete(e);else for(let r of this._entries.keys())r.startsWith(e+"/")&&this._entries.delete(r);this._unmergedPaths.has(e)&&this._unmergedPaths.delete(e),this._dirty=!0}clear(){this._entries.clear(),this._dirty=!0}has({filepath:e}){return this._entries.has(e)}render(){return this.entries.map(e=>`${e.mode.toString(8)} ${e.oid} ${e.path}`).join(`
|
|
14
|
+
`)}static async _entryToBuffer(e){let r=Buffer.from(e.path),i=Math.ceil((62+r.length+1)/8)*8,n=Buffer.alloc(i),s=new tr(n),a=Aa(e);return s.writeUInt32BE(a.ctimeSeconds),s.writeUInt32BE(a.ctimeNanoseconds),s.writeUInt32BE(a.mtimeSeconds),s.writeUInt32BE(a.mtimeNanoseconds),s.writeUInt32BE(a.dev),s.writeUInt32BE(a.ino),s.writeUInt32BE(a.mode),s.writeUInt32BE(a.uid),s.writeUInt32BE(a.gid),s.writeUInt32BE(a.size),s.write(e.oid,20,"hex"),s.writeUInt16BE(B6(e)),s.write(e.path,r.length,"utf8"),n}async toObject(){let e=Buffer.alloc(12),r=new tr(e);r.write("DIRC",4,"utf8"),r.writeUInt32BE(2),r.writeUInt32BE(this.entriesFlat.length);let i=[];for(let l of this.entries)if(i.push(Di._entryToBuffer(l)),l.stages.length>1)for(let c of l.stages)c&&c!==l&&i.push(Di._entryToBuffer(c));i=await Promise.all(i);let n=Buffer.concat(i),s=Buffer.concat([e,n]),a=await si(s);return Buffer.concat([s,Buffer.from(a,"hex")])}};u(Di,"GitIndex");var Uy=Di;function Gu(t,e,r=!0,i=!0){let n=Aa(t),s=Aa(e);return r&&n.mode!==s.mode||n.mtimeSeconds!==s.mtimeSeconds||n.ctimeSeconds!==s.ctimeSeconds||n.uid!==s.uid||n.gid!==s.gid||i&&n.ino!==s.ino||n.size!==s.size}u(Gu,"compareStats");var Py=null,Ny=Symbol("IndexCache");function L6(){return{map:new Map,stats:new Map}}u(L6,"createCache");async function M6(t,e,r){let[i,n]=await Promise.all([t.lstat(e),t.read(e)]),s=await Uy.from(n);r.map.set(e,s),r.stats.set(e,i)}u(M6,"updateCachedIndexFile");async function j6(t,e,r){let i=r.stats.get(e);if(i===void 0)return!0;if(i===null)return!1;let n=await t.lstat(e);return n===null?!1:Gu(i,n)}u(j6,"isIndexStale");var lg=class lg{static async acquire({fs:e,gitdir:r,cache:i,allowUnmerged:n=!0},s){i[Ny]||(i[Ny]=L6());let a=`${r}/index`;Py===null&&(Py=new Ml({maxPending:1/0}));let l,c=[];return await Py.acquire(a,async()=>{let o=i[Ny];await j6(e,a,o)&&await M6(e,a,o);let f=o.map.get(a);if(c=f.unmergedPaths,c.length&&!n)throw new ql(c);if(l=await s(f),f._dirty){let h=await f.toObject();await e.write(a,h),o.stats.set(a,await e.lstat(a)),f._dirty=!1}}),l}};u(lg,"GitIndexManager");var Pe=lg;function Zu(t){let e=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\"));return e>-1&&(t=t.slice(e+1)),t}u(Zu,"basename");function Pa(t){let e=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\"));return e===-1?".":e===0?"/":t.slice(0,e)}u(Pa,"dirname");function zT(t){let e=new Map,r=u(function(n){if(!e.has(n)){let s={type:"tree",fullpath:n,basename:Zu(n),metadata:{},children:[]};e.set(n,s),s.parent=r(Pa(n)),s.parent&&s.parent!==s&&s.parent.children.push(s)}return e.get(n)},"mkdir"),i=u(function(n,s){if(!e.has(n)){let a={type:"blob",fullpath:n,basename:Zu(n),metadata:s,parent:r(Pa(n)),children:[]};a.parent&&a.parent.children.push(a),e.set(n,a)}return e.get(n)},"mkfile");r(".");for(let n of t)i(n.path,n);return e}u(zT,"flatFileListToDirectoryStructure");function q6(t){switch(t){case 16384:return"tree";case 33188:return"blob";case 33261:return"blob";case 40960:return"blob";case 57344:return"commit"}throw new H(`Unexpected GitTree entry mode: ${t.toString(8)}`)}u(q6,"mode2type");var cg=class cg{constructor({fs:e,gitdir:r,cache:i}){var s;this.treePromise=Pe.acquire({fs:e,gitdir:r,cache:i},async function(a){return zT(a.entries)});let n=this;this.ConstructEntry=(s=class{constructor(l){this._fullpath=l,this._type=!1,this._mode=!1,this._stat=!1,this._oid=!1}async type(){return n.type(this)}async mode(){return n.mode(this)}async stat(){return n.stat(this)}async content(){return n.content(this)}async oid(){return n.oid(this)}},u(s,"StageEntry"),s)}async readdir(e){let r=e._fullpath,n=(await this.treePromise).get(r);if(!n||n.type==="blob")return null;if(n.type!=="tree")throw new Error(`ENOTDIR: not a directory, scandir '${r}'`);let s=n.children.map(a=>a.fullpath);return s.sort(Uh),s}async type(e){return e._type===!1&&await e.stat(),e._type}async mode(e){return e._mode===!1&&await e.stat(),e._mode}async stat(e){if(e._stat===!1){let i=(await this.treePromise).get(e._fullpath);if(!i)throw new Error(`ENOENT: no such file or directory, lstat '${e._fullpath}'`);let n=i.type==="tree"?{}:Aa(i.metadata);e._type=i.type==="tree"?"tree":q6(n.mode),e._mode=n.mode,i.type==="tree"?e._stat=void 0:e._stat=n}return e._stat}async content(e){}async oid(e){if(e._oid===!1){let i=(await this.treePromise).get(e._fullpath);e._oid=i.metadata.oid}return e._oid}};u(cg,"GitWalkerIndex");var zy=cg,zh=Symbol("GitWalkSymbol");function Cn(){let t=Object.create(null);return Object.defineProperty(t,zh,{value:u(function({fs:e,gitdir:r,cache:i}){return new zy({fs:e,gitdir:r,cache:i})},"value")}),Object.freeze(t),t}u(Cn,"STAGE");var oh=class oh extends re{constructor(e){super(`Could not find ${e}.`),this.code=this.name=oh.code,this.data={what:e}}};u(oh,"NotFoundError");var pe=oh;pe.code="NotFoundError";var lh=class lh extends re{constructor(e,r,i,n){super(`Object ${e} ${n?`at ${n}`:""}was anticipated to be a ${i} but it is a ${r}.`),this.code=this.name=lh.code,this.data={oid:e,actual:r,expected:i,filepath:n}}};u(lh,"ObjectTypeError");var _t=lh;_t.code="ObjectTypeError";var ch=class ch extends re{constructor(e){super(`Expected a 40-char hex object id but saw "${e}".`),this.code=this.name=ch.code,this.data={value:e}}};u(ch,"InvalidOidError");var Ii=ch;Ii.code="InvalidOidError";var fh=class fh extends re{constructor(e){super(`Could not find a fetch refspec for remote "${e}". Make sure the config file has an entry like the following:
|
|
15
15
|
[remote "${e}"]
|
|
16
16
|
fetch = +refs/heads/*:refs/remotes/origin/*
|
|
17
|
-
`),this.code=this.name=
|
|
18
|
-
`).map(i=>{if(/^\s*#/.test(i))return{line:i,comment:!0};let n=i.indexOf(" ");if(i.startsWith("^")){let s=i.slice(1);return this.refs.set(r+"^{}",s),{line:i,ref:r,peeled:s}}else{let s=i.slice(0,n);return r=i.slice(n+1),this.refs.set(r,s),{line:i,ref:r,oid:s}}})}return this}static from(e){return new
|
|
17
|
+
`),this.code=this.name=fh.code,this.data={remote:e}}};u(fh,"NoRefspecError");var Ul=fh;Ul.code="NoRefspecError";var uh=class uh{constructor(e){if(this.refs=new Map,this.parsedConfig=[],e){let r=null;this.parsedConfig=e.trim().split(`
|
|
18
|
+
`).map(i=>{if(/^\s*#/.test(i))return{line:i,comment:!0};let n=i.indexOf(" ");if(i.startsWith("^")){let s=i.slice(1);return this.refs.set(r+"^{}",s),{line:i,ref:r,peeled:s}}else{let s=i.slice(0,n);return r=i.slice(n+1),this.refs.set(r,s),{line:i,ref:r,oid:s}}})}return this}static from(e){return new uh(e)}delete(e){this.parsedConfig=this.parsedConfig.filter(r=>r.ref!==e),this.refs.delete(e)}toString(){return this.parsedConfig.map(({line:e})=>e).join(`
|
|
19
19
|
`)+`
|
|
20
|
-
`}};
|
|
21
|
-
`).map(n=>{let s=null,
|
|
22
|
-
`)}};
|
|
23
|
-
`,"utf8"));return{pruned:w}}static async writeRef({fs:e,gitdir:r,ref:i,value:n}){if(!n.match(/[0-9a-f]{40}/))throw new
|
|
24
|
-
`,"utf8"))}static async writeSymbolicRef({fs:e,gitdir:r,ref:i,value:n}){await
|
|
25
|
-
`,"utf8"))}static async deleteRef({fs:e,gitdir:r,ref:i}){return
|
|
26
|
-
`)}toObject(){let e=[...this._entries];return e.sort($L),Buffer.concat(e.map(r=>{let i=Buffer.from(r.mode.replace(/^0/,"")),n=Buffer.from(" "),s=Buffer.from(r.path,"utf8"),o=Buffer.from([0]),f=Buffer.from(r.oid,"hex");return Buffer.concat([i,n,s,o,f])}))}entries(){return this._entries}*[Symbol.iterator](){for(let e of this._entries)yield e}};l(au,"GitTree");var gt=au,zw=class zw{static wrap({type:e,object:r}){let i=`${e} ${r.length}\0`,n=i.length,s=n+r.length,o=new Uint8Array(s);for(let f=0;f<n;f++)o[f]=i.charCodeAt(f);return o.set(r,n),o}static unwrap(e){let r=e.indexOf(32),i=e.indexOf(0),n=e.slice(0,r).toString("utf8"),s=e.slice(r+1,i).toString("utf8"),o=e.length-(i+1);if(parseInt(s)!==o)throw new H(`Length mismatch: expected ${s} bytes but got ${o} instead.`);return{type:n,object:Buffer.from(e.slice(i+1))}}};l(zw,"GitObject");var fi=zw;async function XT({fs:t,gitdir:e,oid:r}){let i=`objects/${r.slice(0,2)}/${r.slice(2)}`,n=await t.read(`${e}/${i}`);return n?{object:n,format:"deflated",source:i}:null}l(XT,"readObjectLoose");function jL(t,e){let r=new qt(t),i=OT(r);if(i!==e.byteLength)throw new H(`applyDelta expected source buffer to be ${i} bytes but the provided buffer was ${e.length} bytes`);let n=OT(r),s,o=AT(r,e);if(o.byteLength===n)s=o;else{s=Buffer.alloc(n);let f=new qt(s);for(f.copy(o);!r.eof();)f.copy(AT(r,e));let c=f.tell();if(n!==c)throw new H(`applyDelta expected target buffer to be ${n} bytes but the resulting buffer was ${c} bytes`)}return s}l(jL,"applyDelta");function OT(t){let e=0,r=0,i=null;do i=t.readUInt8(),e|=(i&127)<<r,r+=7;while(i&128);return e}l(OT,"readVarIntLE");function xT(t,e,r){let i=0,n=0;for(;r--;)e&1&&(i|=t.readUInt8()<<n),e>>=1,n+=8;return i}l(xT,"readCompactLE");function AT(t,e){let r=t.readUInt8(),i=128,n=15,s=112;if(r&i){let o=xT(t,r&n,4),f=xT(t,(r&s)>>4,3);return f===0&&(f=65536),e.slice(o,o+f)}else return t.slice(r)}l(AT,"readOp");function qL(t){let e=[t];return{next(){return Promise.resolve({done:e.length===0,value:e.pop()})},return(){return e=[],{}},[Symbol.asyncIterator](){return this}}}l(qL,"fromValue");function YT(t){return t[Symbol.asyncIterator]?t[Symbol.asyncIterator]():t[Symbol.iterator]?t[Symbol.iterator]():t.next?t:qL(t)}l(YT,"getIterator");var Hw=class Hw{constructor(e){if(typeof Buffer>"u")throw new Error("Missing Buffer dependency");this.stream=YT(e),this.buffer=null,this.cursor=0,this.undoCursor=0,this.started=!1,this._ended=!1,this._discardedBytes=0}eof(){return this._ended&&this.cursor===this.buffer.length}tell(){return this._discardedBytes+this.cursor}async byte(){if(!this.eof()&&(this.started||await this._init(),!(this.cursor===this.buffer.length&&(await this._loadnext(),this._ended))))return this._moveCursor(1),this.buffer[this.undoCursor]}async chunk(){if(!this.eof()&&(this.started||await this._init(),!(this.cursor===this.buffer.length&&(await this._loadnext(),this._ended))))return this._moveCursor(this.buffer.length),this.buffer.slice(this.undoCursor,this.cursor)}async read(e){if(!this.eof())return this.started||await this._init(),this.cursor+e>this.buffer.length&&(this._trim(),await this._accumulate(e)),this._moveCursor(e),this.buffer.slice(this.undoCursor,this.cursor)}async skip(e){this.eof()||(this.started||await this._init(),this.cursor+e>this.buffer.length&&(this._trim(),await this._accumulate(e)),this._moveCursor(e))}async undo(){this.cursor=this.undoCursor}async _next(){this.started=!0;let{done:e,value:r}=await this.stream.next();return e&&(this._ended=!0,!r)?Buffer.alloc(0):(r&&(r=Buffer.from(r)),r)}_trim(){this.buffer=this.buffer.slice(this.undoCursor),this.cursor-=this.undoCursor,this._discardedBytes+=this.undoCursor,this.undoCursor=0}_moveCursor(e){this.undoCursor=this.cursor,this.cursor+=e,this.cursor>this.buffer.length&&(this.cursor=this.buffer.length)}async _accumulate(e){if(this._ended)return;let r=[this.buffer];for(;this.cursor+e>UL(r);){let i=await this._next();if(this._ended)break;r.push(i)}this.buffer=Buffer.concat(r)}async _loadnext(){this._discardedBytes+=this.buffer.length,this.undoCursor=0,this.cursor=0,this.buffer=await this._next()}async _init(){this.buffer=await this._next()}};l(Hw,"StreamReader");var Wf=Hw;function UL(t){return t.reduce((e,r)=>e+r.length,0)}l(UL,"lengthBuffers");async function WL(t,e){let r=new Wf(t),i=await r.read(4);if(i=i.toString("utf8"),i!=="PACK")throw new H(`Invalid PACK header '${i}'`);let n=await r.read(4);if(n=n.readUInt32BE(0),n!==2)throw new H(`Invalid packfile version: ${n}`);let s=await r.read(4);if(s=s.readUInt32BE(0),!(s<1))for(;!r.eof()&&s--;){let o=r.tell(),{type:f,length:c,ofs:a,reference:u}=await zL(r),h=new Cw.Inflate;for(;!h.result;){let d=await r.chunk();if(!d)break;if(h.push(d,!1),h.err)throw new H(`Pako error: ${h.msg}`);if(h.result){if(h.result.length!==c)throw new H("Inflated object size is different from that stated in packfile.");await r.undo(),await r.read(d.length-h.strm.avail_in);let p=r.tell();await e({data:h.result,type:f,num:s,offset:o,end:p,reference:u,ofs:a})}}}}l(WL,"listpack");async function zL(t){let e=await t.byte(),r=e>>4&7,i=e&15;if(e&128){let o=4;do e=await t.byte(),i|=(e&127)<<o,o+=7;while(e&128)}let n,s;if(r===6){let o=0;n=0;let f=[];do e=await t.byte(),n|=(e&127)<<o,o+=7,f.push(e);while(e&128);s=Buffer.from(f)}return r===7&&(s=await t.read(20)),{type:r,length:i,ofs:n,reference:s}}l(zL,"parseHeader");var dw=!1;async function ZT(t){return dw===null&&(dw=VL()),dw?HL(t):Cw.inflate(t)}l(ZT,"inflate");async function HL(t){let e=new DecompressionStream("deflate"),r=new Blob([t]).stream().pipeThrough(e);return new Uint8Array(await new Response(r).arrayBuffer())}l(HL,"browserInflate");function VL(){try{if(new DecompressionStream("deflate"))return!0}catch{}return!1}l(VL,"testDecompressionStream");function GL(t){let e=[],r=0,i=0;do{r=t.readUInt8();let n=r&127;e.push(n),i=r&128}while(i);return e.reduce((n,s)=>n+1<<7|s,-1)}l(GL,"decodeVarInt");function KL(t,e){let r=e,i=4,n=null;do n=t.readUInt8(),r|=(n&127)<<i,i+=7;while(n&128);return r}l(KL,"otherVarIntDecode");var Ha=class Ha{constructor(e){Object.assign(this,e),this.offsetCache={}}static async fromIdx({idx:e,getExternalRefDelta:r}){let i=new qt(e);if(i.slice(4).toString("hex")!=="ff744f63")return;let s=i.readUInt32BE();if(s!==2)throw new H(`Unable to read version ${s} packfile IDX. (Only version 2 supported)`);if(e.byteLength>2048*1024*1024)throw new H("To keep implementation simple, I haven't implemented the layer 5 feature needed to support packfiles > 2GB in size.");i.seek(i.tell()+4*255);let o=i.readUInt32BE(),f=[];for(let u=0;u<o;u++){let h=i.slice(20).toString("hex");f[u]=h}i.seek(i.tell()+4*o);let c=new Map;for(let u=0;u<o;u++)c.set(f[u],i.readUInt32BE());let a=i.slice(20).toString("hex");return new Ha({hashes:f,crcs:{},offsets:c,packfileSha:a,getExternalRefDelta:r})}static async fromPack({pack:e,getExternalRefDelta:r,onProgress:i}){let n={1:"commit",2:"tree",3:"blob",4:"tag",6:"ofs-delta",7:"ref-delta"},s={},o=e.slice(-20).toString("hex"),f=[],c={},a=new Map,u=null,h=null;await WL([e],async({data:y,type:g,reference:_,offset:F,num:E})=>{u===null&&(u=E);let R=Math.floor((u-E)*100/u);R!==h&&i&&await i({phase:"Receiving objects",loaded:u-E,total:u}),h=R,g=n[g],["commit","tree","blob","tag"].includes(g)?s[F]={type:g,offset:F}:g==="ofs-delta"?s[F]={type:g,offset:F}:g==="ref-delta"&&(s[F]={type:g,offset:F})});let d=Object.keys(s).map(Number);for(let[y,g]of d.entries()){let _=y+1===d.length?e.byteLength-20:d[y+1],F=s[g],E=lL.buf(e.slice(g,_))>>>0;F.end=_,F.crc=E}let p=new Ha({pack:Promise.resolve(e),packfileSha:o,crcs:c,hashes:f,offsets:a,getExternalRefDelta:r});h=null;let m=0,w=[0,0,0,0,0,0,0,0,0,0,0,0];for(let y in s){y=Number(y);let g=Math.floor(m*100/u);g!==h&&i&&await i({phase:"Resolving deltas",loaded:m,total:u}),m++,h=g;let _=s[y];if(!_.oid)try{p.readDepth=0,p.externalReadDepth=0;let{type:F,object:E}=await p.readSlice({start:y});w[p.readDepth]+=1;let R=await $r(fi.wrap({type:F,object:E}));_.oid=R,f.push(R),a.set(R,y),c[R]=_.crc}catch{continue}}return f.sort(),p}async toBuffer(){let e=[],r=l((a,u)=>{e.push(Buffer.from(a,u))},"write");r("ff744f63","hex"),r("00000002","hex");let i=new qt(Buffer.alloc(256*4));for(let a=0;a<256;a++){let u=0;for(let h of this.hashes)parseInt(h.slice(0,2),16)<=a&&u++;i.writeUInt32BE(u)}e.push(i.buffer);for(let a of this.hashes)r(a,"hex");let n=new qt(Buffer.alloc(this.hashes.length*4));for(let a of this.hashes)n.writeUInt32BE(this.crcs[a]);e.push(n.buffer);let s=new qt(Buffer.alloc(this.hashes.length*4));for(let a of this.hashes)s.writeUInt32BE(this.offsets.get(a));e.push(s.buffer),r(this.packfileSha,"hex");let o=Buffer.concat(e),f=await $r(o),c=Buffer.alloc(20);return c.write(f,"hex"),Buffer.concat([o,c])}async load({pack:e}){this.pack=e}async unload(){this.pack=null}async read({oid:e}){if(!this.offsets.get(e)){if(this.getExternalRefDelta)return this.externalReadDepth++,this.getExternalRefDelta(e);throw new H(`Could not read object ${e} from packfile`)}let r=this.offsets.get(e);return this.readSlice({start:r})}async readSlice({start:e}){if(this.offsetCache[e])return Object.assign({},this.offsetCache[e]);this.readDepth++;let r={16:"commit",32:"tree",48:"blob",64:"tag",96:"ofs_delta",112:"ref_delta"};if(!this.pack)throw new H("Tried to read from a GitPackIndex with no packfile loaded into memory");let i=(await this.pack).slice(e),n=new qt(i),s=n.readUInt8(),o=s&112,f=r[o];if(f===void 0)throw new H("Unrecognized type: 0b"+o.toString(2));let c=s&15,a=c;s&128&&(a=KL(n,c));let h=null,d=null;if(f==="ofs_delta"){let m=GL(n),w=e-m;({object:h,type:f}=await this.readSlice({start:w}))}if(f==="ref_delta"){let m=n.slice(20).toString("hex");({object:h,type:f}=await this.read({oid:m}))}let p=i.slice(n.tell());if(d=Buffer.from(await ZT(p)),d.byteLength!==a)throw new H(`Packfile told us object would have length ${a} but it had length ${d.byteLength}`);return h&&(d=Buffer.from(jL(d,h))),this.readDepth>3&&(this.offsetCache[e]={type:f,object:d}),{type:f,format:"content",object:d}}};l(Ha,"GitPackIndex");var Xa=Ha,Mf=Symbol("PackfileCache");async function JL({fs:t,filename:e,getExternalRefDelta:r,emitter:i,emitterPrefix:n}){let s=await t.read(e);return Xa.fromIdx({idx:s,getExternalRefDelta:r})}l(JL,"loadPackIndex");function Dw({fs:t,cache:e,filename:r,getExternalRefDelta:i,emitter:n,emitterPrefix:s}){e[Mf]||(e[Mf]=new Map);let o=e[Mf].get(r);return o||(o=JL({fs:t,filename:r,getExternalRefDelta:i,emitter:n,emitterPrefix:s}),e[Mf].set(r,o)),o}l(Dw,"readPackIndex");async function XL({fs:t,cache:e,gitdir:r,oid:i,format:n="content",getExternalRefDelta:s}){let o=await t.readdir(D(r,"objects/pack"));o=o.filter(f=>f.endsWith(".idx"));for(let f of o){let c=`${r}/objects/pack/${f}`,a=await Dw({fs:t,cache:e,filename:c,getExternalRefDelta:s});if(a.error)throw new H(a.error);if(a.offsets.has(i)){if(!a.pack){let h=c.replace(/idx$/,"pack");a.pack=t.read(h)}let u=await a.read({oid:i,getExternalRefDelta:s});return u.format="content",u.source=`objects/pack/${f.replace(/idx$/,"pack")}`,u}}return null}l(XL,"readObjectPacked");async function de({fs:t,cache:e,gitdir:r,oid:i,format:n="content"}){let s=l(u=>de({fs:t,cache:e,gitdir:r,oid:u}),"getExternalRefDelta"),o;if(i==="4b825dc642cb6eb9a060e54bf8d69288fbee4904"&&(o={format:"wrapped",object:Buffer.from("tree 0\0")}),o||(o=await XT({fs:t,gitdir:r,oid:i})),!o){if(o=await XL({fs:t,cache:e,gitdir:r,oid:i,getExternalRefDelta:s}),!o)throw new fe(i);return o}if(n==="deflated"||(o.format==="deflated"&&(o.object=Buffer.from(await ZT(o.object)),o.format="wrapped"),n==="wrapped"))return o;let f=await $r(o.object);if(f!==i)throw new H(`SHA check failed! Expected ${i}, computed ${f}`);let{object:c,type:a}=fi.unwrap(o.object);if(o.type=a,o.object=c,o.format="content",n==="content")return o;throw new H(`invalid requested format "${n}"`)}l(de,"_readObject");var cu=class cu extends te{constructor(e,r,i=!0){super(`Failed to create ${e} at ${r} because it already exists.${i?` (Hint: use 'force: true' parameter to overwrite existing ${e}.)`:""}`),this.code=this.name=cu.code,this.data={noun:e,where:r,canForce:i}}};l(cu,"AlreadyExistsError");var Zt=cu;Zt.code="AlreadyExistsError";var lu=class lu extends te{constructor(e,r,i){super(`Found multiple ${e} matching "${r}" (${i.join(", ")}). Use a longer abbreviation length to disambiguate them.`),this.code=this.name=lu.code,this.data={nouns:e,short:r,matches:i}}};l(lu,"AmbiguousError");var Ya=lu;Ya.code="AmbiguousError";var fu=class fu extends te{constructor(e){super(`Your local changes to the following files would be overwritten by checkout: ${e.join(", ")}`),this.code=this.name=fu.code,this.data={filepaths:e}}};l(fu,"CheckoutConflictError");var Za=fu;Za.code="CheckoutConflictError";var uu=class uu extends te{constructor(e,r){super(`Failed to checkout "${e}" because commit ${r} is not available locally. Do a git fetch to make the branch available locally.`),this.code=this.name=uu.code,this.data={ref:e,oid:r}}};l(uu,"CommitNotFetchedError");var Qa=uu;Qa.code="CommitNotFetchedError";var hu=class hu extends te{constructor(){super("Empty response from git server."),this.code=this.name=hu.code,this.data={}}};l(hu,"EmptyServerResponseError");var ec=hu;ec.code="EmptyServerResponseError";var du=class du extends te{constructor(){super("A simple fast-forward merge was not possible."),this.code=this.name=du.code,this.data={}}};l(du,"FastForwardError");var tc=du;tc.code="FastForwardError";var pu=class pu extends te{constructor(e,r){super(`One or more branches were not updated: ${e}`),this.code=this.name=pu.code,this.data={prettyDetails:e,result:r}}};l(pu,"GitPushError");var rc=pu;rc.code="GitPushError";var mu=class mu extends te{constructor(e,r,i){super(`HTTP Error: ${e} ${r}`),this.code=this.name=mu.code,this.data={statusCode:e,statusMessage:r,response:i}}};l(mu,"HttpError");var Js=mu;Js.code="HttpError";var wu=class wu extends te{constructor(e){let r="invalid filepath";e==="leading-slash"||e==="trailing-slash"?r='"filepath" parameter should not include leading or trailing directory separators because these can cause problems on some platforms.':e==="directory"&&(r='"filepath" should not be a directory.'),super(r),this.code=this.name=wu.code,this.data={reason:e}}};l(wu,"InvalidFilepathError");var ui=wu;ui.code="InvalidFilepathError";var yu=class yu extends te{constructor(e,r){super(`"${e}" would be an invalid git reference. (Hint: a valid alternative would be "${r}".)`),this.code=this.name=yu.code,this.data={ref:e,suggestion:r}}};l(yu,"InvalidRefNameError");var Qt=yu;Qt.code="InvalidRefNameError";var gu=class gu extends te{constructor(e){super(`Maximum search depth of ${e} exceeded.`),this.code=this.name=gu.code,this.data={depth:e}}};l(gu,"MaxDepthError");var ic=gu;ic.code="MaxDepthError";var bu=class bu extends te{constructor(){super("Merges with conflicts are not supported yet."),this.code=this.name=bu.code,this.data={}}};l(bu,"MergeNotSupportedError");var Xs=bu;Xs.code="MergeNotSupportedError";var _u=class _u extends te{constructor(e,r,i,n){super(`Automatic merge failed with one or more merge conflicts in the following files: ${e.toString()}. Fix conflicts then commit the result.`),this.code=this.name=_u.code,this.data={filepaths:e,bothModified:r,deleteByUs:i,deleteByTheirs:n}}};l(_u,"MergeConflictError");var Ys=_u;Ys.code="MergeConflictError";var Su=class Su extends te{constructor(e){super(`No name was provided for ${e} in the argument or in the .git/config file.`),this.code=this.name=Su.code,this.data={role:e}}};l(Su,"MissingNameError");var rt=Su;rt.code="MissingNameError";var vu=class vu extends te{constructor(e){super(`The function requires a "${e}" parameter but none was provided.`),this.code=this.name=vu.code,this.data={parameter:e}}};l(vu,"MissingParameterError");var yt=vu;yt.code="MissingParameterError";var Eu=class Eu extends te{constructor(e){super('There are multiple errors that were thrown by the method. Please refer to the "errors" property to see more'),this.code=this.name=Eu.code,this.data={errors:e},this.errors=e}};l(Eu,"MultipleGitError");var nc=Eu;nc.code="MultipleGitError";var Fu=class Fu extends te{constructor(e,r){super(`Expected "${e}" but received "${r}".`),this.code=this.name=Fu.code,this.data={expected:e,actual:r}}};l(Fu,"ParseError");var rn=Fu;rn.code="ParseError";var Tu=class Tu extends te{constructor(e){let r="";e==="not-fast-forward"?r=" because it was not a simple fast-forward":e==="tag-exists"&&(r=" because tag already exists"),super(`Push rejected${r}. Use "force: true" to override.`),this.code=this.name=Tu.code,this.data={reason:e}}};l(Tu,"PushRejectedError");var Zs=Tu;Zs.code="PushRejectedError";var ku=class ku extends te{constructor(e,r){super(`Remote does not support the "${e}" so the "${r}" parameter cannot be used.`),this.code=this.name=ku.code,this.data={capability:e,parameter:r}}};l(ku,"RemoteCapabilityError");var ci=ku;ci.code="RemoteCapabilityError";var Ru=class Ru extends te{constructor(e,r){super(`Remote did not reply using the "smart" HTTP protocol. Expected "001e# service=git-upload-pack" but received: ${e}`),this.code=this.name=Ru.code,this.data={preview:e,response:r}}};l(Ru,"SmartHttpError");var sc=Ru;sc.code="SmartHttpError";var Ou=class Ou extends te{constructor(e,r,i){super(`Git remote "${e}" uses an unrecognized transport protocol: "${r}"`),this.code=this.name=Ou.code,this.data={url:e,transport:r,suggestion:i}}};l(Ou,"UnknownTransportError");var oc=Ou;oc.code="UnknownTransportError";var xu=class xu extends te{constructor(e){super(`Cannot parse remote URL: "${e}"`),this.code=this.name=xu.code,this.data={url:e}}};l(xu,"UrlParseError");var ac=xu;ac.code="UrlParseError";var Au=class Au extends te{constructor(){super("The operation was canceled."),this.code=this.name=Au.code,this.data={}}};l(Au,"UserCanceledError");var Qs=Au;Qs.code="UserCanceledError";var Pu=class Pu extends te{constructor(e){super(`Could not merge index: Entry for '${e}' is not up to date. Either reset the index entry to HEAD, or stage your unstaged changes.`),this.code=this.name=Pu.code,this.data={filepath:e}}};l(Pu,"IndexResetError");var cc=Pu;cc.code="IndexResetError";var Nu=class Nu extends te{constructor(e){super(`"${e}" does not point to any commit. You're maybe working on a repository with no commits yet. `),this.code=this.name=Nu.code,this.data={ref:e}}};l(Nu,"NoCommitError");var lc=Nu;lc.code="NoCommitError";var QT=Object.freeze({__proto__:null,AlreadyExistsError:Zt,AmbiguousError:Ya,CheckoutConflictError:Za,CommitNotFetchedError:Qa,EmptyServerResponseError:ec,FastForwardError:tc,GitPushError:rc,HttpError:Js,InternalError:H,InvalidFilepathError:ui,InvalidOidError:li,InvalidRefNameError:Qt,MaxDepthError:ic,MergeNotSupportedError:Xs,MergeConflictError:Ys,MissingNameError:rt,MissingParameterError:yt,MultipleGitError:nc,NoRefspecError:Ja,NotFoundError:fe,ObjectTypeError:ut,ParseError:rn,PushRejectedError:Zs,RemoteCapabilityError:ci,SmartHttpError:sc,UnknownTransportError:oc,UnsafeFilepathError:Vs,UrlParseError:ac,UserCanceledError:Qs,UnmergedPathsError:Ka,IndexResetError:cc,NoCommitError:lc});function kw({name:t,email:e,timestamp:r,timezoneOffset:i}){return i=YL(i),`${t} <${e}> ${r} ${i}`}l(kw,"formatAuthor");function YL(t){let e=ZL(QL(t));t=Math.abs(t);let r=Math.floor(t/60);t-=r*60;let i=String(r),n=String(t);return i.length<2&&(i="0"+i),n.length<2&&(n="0"+n),(e===-1?"-":"+")+i+n}l(YL,"formatTimezoneOffset");function ZL(t){return Math.sign(t)||(Object.is(t,-0)?-1:1)}l(ZL,"simpleSign");function QL(t){return t===0?t:-t}l(QL,"negateExceptForZero");function Ir(t){return t=t.replace(/\r/g,""),t=t.replace(/^\n+/,""),t=t.replace(/\n+$/,"")+`
|
|
27
|
-
`,t}
|
|
20
|
+
`}};u(uh,"GitPackedRefs");var Ku=uh,hh=class hh{constructor({remotePath:e,localPath:r,force:i,matchPrefix:n}){Object.assign(this,{remotePath:e,localPath:r,force:i,matchPrefix:n})}static from(e){let[r,i,n,s,a]=e.match(/^(\+?)(.*?)(\*?):(.*?)(\*?)$/).slice(1),l=r==="+",c=n==="*";if(c!==(a==="*"))throw new H("Invalid refspec");return new hh({remotePath:i,localPath:s,force:l,matchPrefix:c})}translate(e){if(this.matchPrefix){if(e.startsWith(this.remotePath))return this.localPath+e.replace(this.remotePath,"")}else if(e===this.remotePath)return this.localPath;return null}reverseTranslate(e){if(this.matchPrefix){if(e.startsWith(this.localPath))return this.remotePath+e.replace(this.localPath,"")}else if(e===this.localPath)return this.remotePath;return null}};u(hh,"GitRefSpec");var Ju=hh,dh=class dh{constructor(e=[]){this.rules=e}static from(e){let r=[];for(let i of e)r.push(Ju.from(i));return new dh(r)}add(e){let r=Ju.from(e);this.rules.push(r)}translate(e){let r=[];for(let i of this.rules)for(let n of e){let s=i.translate(n);s&&r.push([n,s])}return r}translateOne(e){let r=null;for(let i of this.rules){let n=i.translate(e);n&&(r=n)}return r}localNamespaces(){return this.rules.filter(e=>e.matchPrefix).map(e=>e.localPath.replace(/\/$/,""))}};u(dh,"GitRefSpecSet");var Wy=dh;function U6(t,e){let r=t.replace(/\^\{\}$/,""),i=e.replace(/\^\{\}$/,""),n=-(r<i)||+(r>i);return n===0?t.endsWith("^{}")?1:-1:n}u(U6,"compareRefNames");function z6(t,e){let r="",i=0,n=-1,s=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||s===1))if(s===2){if(r.length<2||i!==2||r.at(-1)!=="."||r.at(-2)!=="."){if(r.length>2){let c=r.lastIndexOf("/");c===-1?(r="",i=0):(r=r.slice(0,c),i=r.length-1-r.lastIndexOf("/")),n=l,s=0;continue}else if(r.length!==0){r="",i=0,n=l,s=0;continue}}e&&(r+=r.length>0?"/..":"..",i=2)}else r.length>0?r+="/"+t.slice(n+1,l):r=t.slice(n+1,l),i=l-n-1;n=l,s=0}else a==="."&&s!==-1?++s:s=-1}return r}u(z6,"normalizeString");function W6(t){if(!t.length)return".";let e=t[0]==="/",r=t.at(-1)==="/";return t=z6(t,!e),t.length?(r&&(t+="/"),e?`/${t}`:t):e?"/":r?"./":"."}u(W6,"normalize");function C(...t){if(t.length===0)return".";let e;for(let r=0;r<t.length;++r){let i=t[r];i.length>0&&(e===void 0?e=i:e+="/"+i)}return e===void 0?".":W6(e)}u(C,"join");var H6=u(t=>{if(typeof t=="number")return t;t=t.toLowerCase();let e=parseInt(t);return t.endsWith("k")&&(e*=1024),t.endsWith("m")&&(e*=1024*1024),t.endsWith("g")&&(e*=1024*1024*1024),e},"num"),Bl=u(t=>{if(typeof t=="boolean")return t;if(t=t.trim().toLowerCase(),t==="true"||t==="yes"||t==="on")return!0;if(t==="false"||t==="no"||t==="off")return!1;throw Error(`Expected 'true', 'false', 'yes', 'no', 'on', or 'off', but got ${t}`)},"bool"),gT={core:{filemode:Bl,bare:Bl,logallrefupdates:Bl,symlinks:Bl,ignorecase:Bl,bigFileThreshold:H6}},V6=/^\[([A-Za-z0-9-.]+)(?: "(.*)")?\]$/,G6=/^[A-Za-z0-9-.]+$/,Z6=/^([A-Za-z][A-Za-z-]*)(?: *= *(.*))?$/,K6=/^[A-Za-z][A-Za-z-]*$/,J6=/^(.*?)( *[#;].*)$/,Y6=u(t=>{let e=V6.exec(t);if(e!=null){let[r,i]=e.slice(1);return[r,i]}return null},"extractSectionLine"),X6=u(t=>{let e=Z6.exec(t);if(e!=null){let[r,i="true"]=e.slice(1),n=Q6(i),s=eq(n);return[r,s]}return null},"extractVariableLine"),Q6=u(t=>{let e=J6.exec(t);if(e==null)return t;let[r,i]=e.slice(1);return bT(r)&&bT(i)?`${r}${i}`:r},"removeComments"),bT=u(t=>(t.match(/(?:^|[^\\])"/g)||[]).length%2!==0,"hasOddNumberOfQuotes"),eq=u(t=>t.split("").reduce((e,r,i,n)=>{let s=r==='"'&&n[i-1]!=="\\",a=r==="\\"&&n[i+1]==='"';return s||a?e:e+r},""),"removeQuotes"),_T=u(t=>t!=null?t.toLowerCase():null,"lower"),Hy=u((t,e,r)=>[_T(t),e,_T(r)].filter(i=>i!=null).join("."),"getPath"),vT=u(t=>{let e=t.split("."),r=e.shift(),i=e.pop(),n=e.length?e.join("."):void 0;return{section:r,subsection:n,name:i,path:Hy(r,n,i),sectionPath:Hy(r,n,null),isSection:!!r}},"normalizePath"),tq=u((t,e)=>t.reduce((r,i,n)=>e(i)?n:r,-1),"findLastIndex"),ph=class ph{constructor(e){let r=null,i=null;this.parsedConfig=e?e.split(`
|
|
21
|
+
`).map(n=>{let s=null,a=null,l=n.trim(),c=Y6(l),o=c!=null;if(o)[r,i]=c;else{let h=X6(l);h!=null&&([s,a]=h)}let f=Hy(r,i,s);return{line:n,isSection:o,section:r,subsection:i,name:s,value:a,path:f}}):[]}static from(e){return new ph(e)}async get(e,r=!1){let i=vT(e).path,n=this.parsedConfig.filter(s=>s.path===i).map(({section:s,name:a,value:l})=>{let c=gT[s]&&gT[s][a];return c?c(l):l});return r?n:n.pop()}async getall(e){return this.get(e,!0)}async getSubsections(e){return this.parsedConfig.filter(r=>r.isSection&&r.section===e).map(r=>r.subsection)}async deleteSection(e,r){this.parsedConfig=this.parsedConfig.filter(i=>!(i.section===e&&i.subsection===r))}async append(e,r){return this.set(e,r,!0)}async set(e,r,i=!1){let{section:n,subsection:s,name:a,path:l,sectionPath:c,isSection:o}=vT(e),f=tq(this.parsedConfig,h=>h.path===l);if(r==null)f!==-1&&this.parsedConfig.splice(f,1);else if(f!==-1){let h=this.parsedConfig[f],d=Object.assign({},h,{name:a,value:r,modified:!0});i?this.parsedConfig.splice(f+1,0,d):this.parsedConfig[f]=d}else{let h=this.parsedConfig.findIndex(p=>p.path===c),d={section:n,subsection:s,name:a,value:r,modified:!0,path:l};if(G6.test(n)&&K6.test(a))if(h>=0)this.parsedConfig.splice(h+1,0,d);else{let p={isSection:o,section:n,subsection:s,modified:!0,path:c};this.parsedConfig.push(p,d)}}}toString(){return this.parsedConfig.map(({line:e,section:r,subsection:i,name:n,value:s,modified:a=!1})=>a?n!=null&&s!=null?typeof s=="string"&&/[#;]/.test(s)?` ${n} = "${s}"`:` ${n} = ${s}`:i!=null?`[${r} "${i}"]`:`[${r}]`:e).join(`
|
|
22
|
+
`)}};u(ph,"GitConfig");var Vy=ph,fg=class fg{static async get({fs:e,gitdir:r}){let i=await e.read(`${r}/config`,{encoding:"utf8"});return Vy.from(i)}static async save({fs:e,gitdir:r,config:i}){await e.write(`${r}/config`,i.toString(),{encoding:"utf8"})}};u(fg,"GitConfigManager");var Oe=fg,Hu=u(t=>[`${t}`,`refs/${t}`,`refs/tags/${t}`,`refs/heads/${t}`,`refs/remotes/${t}`,`refs/remotes/${t}/HEAD`],"refpaths"),rq=["config","description","index","shallow","commondir"],Dy;async function Ni(t,e){return Dy===void 0&&(Dy=new Ml),Dy.acquire(t,e)}u(Ni,"acquireLock");var Be=class Be{static async updateRemoteRefs({fs:e,gitdir:r,remote:i,refs:n,symrefs:s,tags:a,refspecs:l=void 0,prune:c=!1,pruneTags:o=!1}){for(let g of n.values())if(!g.match(/[0-9a-f]{40}/))throw new Ii(g);let f=await Oe.get({fs:e,gitdir:r});if(!l){if(l=await f.getall(`remote.${i}.fetch`),l.length===0)throw new Ul(i);l.unshift(`+HEAD:refs/remotes/${i}/HEAD`)}let h=Wy.from(l),d=new Map;if(o){let g=await Be.listRefs({fs:e,gitdir:r,filepath:"refs/tags"});await Be.deleteRefs({fs:e,gitdir:r,refs:g.map(b=>`refs/tags/${b}`)})}if(a){for(let g of n.keys())if(g.startsWith("refs/tags")&&!g.endsWith("^{}")&&!await Be.exists({fs:e,gitdir:r,ref:g})){let b=n.get(g);d.set(g,b)}}let p=h.translate([...n.keys()]);for(let[g,b]of p){let _=n.get(g);d.set(b,_)}let m=h.translate([...s.keys()]);for(let[g,b]of m){let _=s.get(g),S=h.translateOne(_);S&&d.set(b,`ref: ${S}`)}let w=[];if(c){for(let g of h.localNamespaces()){let b=(await Be.listRefs({fs:e,gitdir:r,filepath:g})).map(_=>`${g}/${_}`);for(let _ of b)d.has(_)||w.push(_)}w.length>0&&await Be.deleteRefs({fs:e,gitdir:r,refs:w})}for(let[g,b]of d)await Ni(g,async()=>e.write(C(r,g),`${b.trim()}
|
|
23
|
+
`,"utf8"));return{pruned:w}}static async writeRef({fs:e,gitdir:r,ref:i,value:n}){if(!n.match(/[0-9a-f]{40}/))throw new Ii(n);await Ni(i,async()=>e.write(C(r,i),`${n.trim()}
|
|
24
|
+
`,"utf8"))}static async writeSymbolicRef({fs:e,gitdir:r,ref:i,value:n}){await Ni(i,async()=>e.write(C(r,i),`ref: ${n.trim()}
|
|
25
|
+
`,"utf8"))}static async deleteRef({fs:e,gitdir:r,ref:i}){return Be.deleteRefs({fs:e,gitdir:r,refs:[i]})}static async deleteRefs({fs:e,gitdir:r,refs:i}){await Promise.all(i.map(l=>e.rm(C(r,l))));let n=await Ni("packed-refs",async()=>e.read(`${r}/packed-refs`,{encoding:"utf8"})),s=Ku.from(n),a=s.refs.size;for(let l of i)s.refs.has(l)&&s.delete(l);s.refs.size<a&&(n=s.toString(),await Ni("packed-refs",async()=>e.write(`${r}/packed-refs`,n,{encoding:"utf8"})))}static async resolve({fs:e,gitdir:r,ref:i,depth:n=void 0}){if(n!==void 0&&(n--,n===-1))return i;if(i.startsWith("ref: "))return i=i.slice(5),Be.resolve({fs:e,gitdir:r,ref:i,depth:n});if(i.length===40&&/[0-9a-f]{40}/.test(i))return i;let s=await Be.packedRefs({fs:e,gitdir:r}),a=Hu(i).filter(l=>!rq.includes(l));for(let l of a){let c=await Ni(l,async()=>await e.read(`${r}/${l}`,{encoding:"utf8"})||s.get(l));if(c)return Be.resolve({fs:e,gitdir:r,ref:c.trim(),depth:n})}throw new pe(i)}static async exists({fs:e,gitdir:r,ref:i}){try{return await Be.expand({fs:e,gitdir:r,ref:i}),!0}catch{return!1}}static async expand({fs:e,gitdir:r,ref:i}){if(i.length===40&&/[0-9a-f]{40}/.test(i))return i;let n=await Be.packedRefs({fs:e,gitdir:r}),s=Hu(i);for(let a of s)if(await Ni(a,async()=>e.exists(`${r}/${a}`))||n.has(a))return a;throw new pe(i)}static async expandAgainstMap({ref:e,map:r}){let i=Hu(e);for(let n of i)if(await r.has(n))return n;throw new pe(e)}static resolveAgainstMap({ref:e,fullref:r=e,depth:i=void 0,map:n}){if(i!==void 0&&(i--,i===-1))return{fullref:r,oid:e};if(e.startsWith("ref: "))return e=e.slice(5),Be.resolveAgainstMap({ref:e,fullref:r,depth:i,map:n});if(e.length===40&&/[0-9a-f]{40}/.test(e))return{fullref:r,oid:e};let s=Hu(e);for(let a of s){let l=n.get(a);if(l)return Be.resolveAgainstMap({ref:l.trim(),fullref:a,depth:i,map:n})}throw new pe(e)}static async packedRefs({fs:e,gitdir:r}){let i=await Ni("packed-refs",async()=>e.read(`${r}/packed-refs`,{encoding:"utf8"}));return Ku.from(i).refs}static async listRefs({fs:e,gitdir:r,filepath:i}){let n=Be.packedRefs({fs:e,gitdir:r}),s=null;try{s=await e.readdirDeep(`${r}/${i}`),s=s.map(a=>a.replace(`${r}/${i}/`,""))}catch{s=[]}for(let a of(await n).keys())a.startsWith(i)&&(a=a.replace(i+"/",""),s.includes(a)||s.push(a));return s.sort(U6),s}static async listBranches({fs:e,gitdir:r,remote:i}){return i?Be.listRefs({fs:e,gitdir:r,filepath:`refs/remotes/${i}`}):Be.listRefs({fs:e,gitdir:r,filepath:"refs/heads"})}static async listTags({fs:e,gitdir:r}){return(await Be.listRefs({fs:e,gitdir:r,filepath:"refs/tags"})).filter(n=>!n.endsWith("^{}"))}};u(Be,"GitRefManager");var $=Be;function iq(t,e){return Uh(ST(t),ST(e))}u(iq,"compareTreeEntryPath");function ST(t){return t.mode==="040000"?t.path+"/":t.path}u(ST,"appendSlashIfDir");function WT(t){switch(t){case"040000":return"tree";case"100644":return"blob";case"100755":return"blob";case"120000":return"blob";case"160000":return"commit"}throw new H(`Unexpected GitTree entry mode: ${t}`)}u(WT,"mode2type$1");function nq(t){let e=[],r=0;for(;r<t.length;){let i=t.indexOf(32,r);if(i===-1)throw new H(`GitTree: Error parsing buffer at byte location ${r}: Could not find the next space character.`);let n=t.indexOf(0,r);if(n===-1)throw new H(`GitTree: Error parsing buffer at byte location ${r}: Could not find the next null character.`);let s=t.slice(r,i).toString("utf8");s==="40000"&&(s="040000");let a=WT(s),l=t.slice(i+1,n).toString("utf8");if(l.includes("\\")||l.includes("/"))throw new Ra(l);let c=t.slice(n+1,n+21).toString("hex");r=n+21,e.push({mode:s,path:l,oid:c,type:a})}return e}u(nq,"parseBuffer");function sq(t){if(typeof t=="number"&&(t=t.toString(8)),t.match(/^0?4.*/))return"040000";if(t.match(/^1006.*/))return"100644";if(t.match(/^1007.*/))return"100755";if(t.match(/^120.*/))return"120000";if(t.match(/^160.*/))return"160000";throw new H(`Could not understand file mode: ${t}`)}u(sq,"limitModeToAllowed");function aq(t){return!t.oid&&t.sha&&(t.oid=t.sha),t.mode=sq(t.mode),t.type||(t.type=WT(t.mode)),t}u(aq,"nudgeIntoShape");var mh=class mh{constructor(e){if(Buffer.isBuffer(e))this._entries=nq(e);else if(Array.isArray(e))this._entries=e.map(aq);else throw new H("invalid type passed to GitTree constructor");this._entries.sort(jT)}static from(e){return new mh(e)}render(){return this._entries.map(e=>`${e.mode} ${e.type} ${e.oid} ${e.path}`).join(`
|
|
26
|
+
`)}toObject(){let e=[...this._entries];return e.sort(iq),Buffer.concat(e.map(r=>{let i=Buffer.from(r.mode.replace(/^0/,"")),n=Buffer.from(" "),s=Buffer.from(r.path,"utf8"),a=Buffer.from([0]),l=Buffer.from(r.oid,"hex");return Buffer.concat([i,n,s,a,l])}))}entries(){return this._entries}*[Symbol.iterator](){for(let e of this._entries)yield e}};u(mh,"GitTree");var Rt=mh,ug=class ug{static wrap({type:e,object:r}){let i=`${e} ${r.length}\0`,n=i.length,s=n+r.length,a=new Uint8Array(s);for(let l=0;l<n;l++)a[l]=i.charCodeAt(l);return a.set(r,n),a}static unwrap(e){let r=e.indexOf(32),i=e.indexOf(0),n=e.slice(0,r).toString("utf8"),s=e.slice(r+1,i).toString("utf8"),a=e.length-(i+1);if(parseInt(s)!==a)throw new H(`Length mismatch: expected ${s} bytes but got ${a} instead.`);return{type:n,object:Buffer.from(e.slice(i+1))}}};u(ug,"GitObject");var $i=ug;async function HT({fs:t,gitdir:e,oid:r}){let i=`objects/${r.slice(0,2)}/${r.slice(2)}`,n=await t.read(`${e}/${i}`);return n?{object:n,format:"deflated",source:i}:null}u(HT,"readObjectLoose");function oq(t,e){let r=new tr(t),i=ET(r);if(i!==e.byteLength)throw new H(`applyDelta expected source buffer to be ${i} bytes but the provided buffer was ${e.length} bytes`);let n=ET(r),s,a=kT(r,e);if(a.byteLength===n)s=a;else{s=Buffer.alloc(n);let l=new tr(s);for(l.copy(a);!r.eof();)l.copy(kT(r,e));let c=l.tell();if(n!==c)throw new H(`applyDelta expected target buffer to be ${n} bytes but the resulting buffer was ${c} bytes`)}return s}u(oq,"applyDelta");function ET(t){let e=0,r=0,i=null;do i=t.readUInt8(),e|=(i&127)<<r,r+=7;while(i&128);return e}u(ET,"readVarIntLE");function FT(t,e,r){let i=0,n=0;for(;r--;)e&1&&(i|=t.readUInt8()<<n),e>>=1,n+=8;return i}u(FT,"readCompactLE");function kT(t,e){let r=t.readUInt8(),i=128,n=15,s=112;if(r&i){let a=FT(t,r&n,4),l=FT(t,(r&s)>>4,3);return l===0&&(l=65536),e.slice(a,a+l)}else return t.slice(r)}u(kT,"readOp");function lq(t){let e=[t];return{next(){return Promise.resolve({done:e.length===0,value:e.pop()})},return(){return e=[],{}},[Symbol.asyncIterator](){return this}}}u(lq,"fromValue");function VT(t){return t[Symbol.asyncIterator]?t[Symbol.asyncIterator]():t[Symbol.iterator]?t[Symbol.iterator]():t.next?t:lq(t)}u(VT,"getIterator");var hg=class hg{constructor(e){if(typeof Buffer>"u")throw new Error("Missing Buffer dependency");this.stream=VT(e),this.buffer=null,this.cursor=0,this.undoCursor=0,this.started=!1,this._ended=!1,this._discardedBytes=0}eof(){return this._ended&&this.cursor===this.buffer.length}tell(){return this._discardedBytes+this.cursor}async byte(){if(!this.eof()&&(this.started||await this._init(),!(this.cursor===this.buffer.length&&(await this._loadnext(),this._ended))))return this._moveCursor(1),this.buffer[this.undoCursor]}async chunk(){if(!this.eof()&&(this.started||await this._init(),!(this.cursor===this.buffer.length&&(await this._loadnext(),this._ended))))return this._moveCursor(this.buffer.length),this.buffer.slice(this.undoCursor,this.cursor)}async read(e){if(!this.eof())return this.started||await this._init(),this.cursor+e>this.buffer.length&&(this._trim(),await this._accumulate(e)),this._moveCursor(e),this.buffer.slice(this.undoCursor,this.cursor)}async skip(e){this.eof()||(this.started||await this._init(),this.cursor+e>this.buffer.length&&(this._trim(),await this._accumulate(e)),this._moveCursor(e))}async undo(){this.cursor=this.undoCursor}async _next(){this.started=!0;let{done:e,value:r}=await this.stream.next();return e&&(this._ended=!0,!r)?Buffer.alloc(0):(r&&(r=Buffer.from(r)),r)}_trim(){this.buffer=this.buffer.slice(this.undoCursor),this.cursor-=this.undoCursor,this._discardedBytes+=this.undoCursor,this.undoCursor=0}_moveCursor(e){this.undoCursor=this.cursor,this.cursor+=e,this.cursor>this.buffer.length&&(this.cursor=this.buffer.length)}async _accumulate(e){if(this._ended)return;let r=[this.buffer];for(;this.cursor+e>cq(r);){let i=await this._next();if(this._ended)break;r.push(i)}this.buffer=Buffer.concat(r)}async _loadnext(){this._discardedBytes+=this.buffer.length,this.undoCursor=0,this.cursor=0,this.buffer=await this._next()}async _init(){this.buffer=await this._next()}};u(hg,"StreamReader");var Yu=hg;function cq(t){return t.reduce((e,r)=>e+r.length,0)}u(cq,"lengthBuffers");async function fq(t,e){let r=new Yu(t),i=await r.read(4);if(i=i.toString("utf8"),i!=="PACK")throw new H(`Invalid PACK header '${i}'`);let n=await r.read(4);if(n=n.readUInt32BE(0),n!==2)throw new H(`Invalid packfile version: ${n}`);let s=await r.read(4);if(s=s.readUInt32BE(0),!(s<1))for(;!r.eof()&&s--;){let a=r.tell(),{type:l,length:c,ofs:o,reference:f}=await uq(r),h=new eg.Inflate;for(;!h.result;){let d=await r.chunk();if(!d)break;if(h.push(d,!1),h.err)throw new H(`Pako error: ${h.msg}`);if(h.result){if(h.result.length!==c)throw new H("Inflated object size is different from that stated in packfile.");await r.undo(),await r.read(d.length-h.strm.avail_in);let p=r.tell();await e({data:h.result,type:l,num:s,offset:a,end:p,reference:f,ofs:o})}}}}u(fq,"listpack");async function uq(t){let e=await t.byte(),r=e>>4&7,i=e&15;if(e&128){let a=4;do e=await t.byte(),i|=(e&127)<<a,a+=7;while(e&128)}let n,s;if(r===6){let a=0;n=0;let l=[];do e=await t.byte(),n|=(e&127)<<a,a+=7,l.push(e);while(e&128);s=Buffer.from(l)}return r===7&&(s=await t.read(20)),{type:r,length:i,ofs:n,reference:s}}u(uq,"parseHeader");var Cy=!1;async function GT(t){return Cy===null&&(Cy=dq()),Cy?hq(t):eg.inflate(t)}u(GT,"inflate");async function hq(t){let e=new DecompressionStream("deflate"),r=new Blob([t]).stream().pipeThrough(e);return new Uint8Array(await new Response(r).arrayBuffer())}u(hq,"browserInflate");function dq(){try{if(new DecompressionStream("deflate"))return!0}catch{}return!1}u(dq,"testDecompressionStream");function pq(t){let e=[],r=0,i=0;do{r=t.readUInt8();let n=r&127;e.push(n),i=r&128}while(i);return e.reduce((n,s)=>n+1<<7|s,-1)}u(pq,"decodeVarInt");function mq(t,e){let r=e,i=4,n=null;do n=t.readUInt8(),r|=(n&127)<<i,i+=7;while(n&128);return r}u(mq,"otherVarIntDecode");var Ll=class Ll{constructor(e){Object.assign(this,e),this.offsetCache={}}static async fromIdx({idx:e,getExternalRefDelta:r}){let i=new tr(e);if(i.slice(4).toString("hex")!=="ff744f63")return;let s=i.readUInt32BE();if(s!==2)throw new H(`Unable to read version ${s} packfile IDX. (Only version 2 supported)`);if(e.byteLength>2048*1024*1024)throw new H("To keep implementation simple, I haven't implemented the layer 5 feature needed to support packfiles > 2GB in size.");i.seek(i.tell()+4*255);let a=i.readUInt32BE(),l=[];for(let f=0;f<a;f++){let h=i.slice(20).toString("hex");l[f]=h}i.seek(i.tell()+4*a);let c=new Map;for(let f=0;f<a;f++)c.set(l[f],i.readUInt32BE());let o=i.slice(20).toString("hex");return new Ll({hashes:l,crcs:{},offsets:c,packfileSha:o,getExternalRefDelta:r})}static async fromPack({pack:e,getExternalRefDelta:r,onProgress:i}){let n={1:"commit",2:"tree",3:"blob",4:"tag",6:"ofs-delta",7:"ref-delta"},s={},a=e.slice(-20).toString("hex"),l=[],c={},o=new Map,f=null,h=null;await fq([e],async({data:g,type:b,reference:_,offset:S,num:F})=>{f===null&&(f=F);let k=Math.floor((f-F)*100/f);k!==h&&i&&await i({phase:"Receiving objects",loaded:f-F,total:f}),h=k,b=n[b],["commit","tree","blob","tag"].includes(b)?s[S]={type:b,offset:S}:b==="ofs-delta"?s[S]={type:b,offset:S}:b==="ref-delta"&&(s[S]={type:b,offset:S})});let d=Object.keys(s).map(Number);for(let[g,b]of d.entries()){let _=g+1===d.length?e.byteLength-20:d[g+1],S=s[b],F=A6.buf(e.slice(b,_))>>>0;S.end=_,S.crc=F}let p=new Ll({pack:Promise.resolve(e),packfileSha:a,crcs:c,hashes:l,offsets:o,getExternalRefDelta:r});h=null;let m=0,w=[0,0,0,0,0,0,0,0,0,0,0,0];for(let g in s){g=Number(g);let b=Math.floor(m*100/f);b!==h&&i&&await i({phase:"Resolving deltas",loaded:m,total:f}),m++,h=b;let _=s[g];if(!_.oid)try{p.readDepth=0,p.externalReadDepth=0;let{type:S,object:F}=await p.readSlice({start:g});w[p.readDepth]+=1;let k=await si($i.wrap({type:S,object:F}));_.oid=k,l.push(k),o.set(k,g),c[k]=_.crc}catch{continue}}return l.sort(),p}async toBuffer(){let e=[],r=u((o,f)=>{e.push(Buffer.from(o,f))},"write");r("ff744f63","hex"),r("00000002","hex");let i=new tr(Buffer.alloc(256*4));for(let o=0;o<256;o++){let f=0;for(let h of this.hashes)parseInt(h.slice(0,2),16)<=o&&f++;i.writeUInt32BE(f)}e.push(i.buffer);for(let o of this.hashes)r(o,"hex");let n=new tr(Buffer.alloc(this.hashes.length*4));for(let o of this.hashes)n.writeUInt32BE(this.crcs[o]);e.push(n.buffer);let s=new tr(Buffer.alloc(this.hashes.length*4));for(let o of this.hashes)s.writeUInt32BE(this.offsets.get(o));e.push(s.buffer),r(this.packfileSha,"hex");let a=Buffer.concat(e),l=await si(a),c=Buffer.alloc(20);return c.write(l,"hex"),Buffer.concat([a,c])}async load({pack:e}){this.pack=e}async unload(){this.pack=null}async read({oid:e}){if(!this.offsets.get(e)){if(this.getExternalRefDelta)return this.externalReadDepth++,this.getExternalRefDelta(e);throw new H(`Could not read object ${e} from packfile`)}let r=this.offsets.get(e);return this.readSlice({start:r})}async readSlice({start:e}){if(this.offsetCache[e])return Object.assign({},this.offsetCache[e]);this.readDepth++;let r={16:"commit",32:"tree",48:"blob",64:"tag",96:"ofs_delta",112:"ref_delta"};if(!this.pack)throw new H("Tried to read from a GitPackIndex with no packfile loaded into memory");let i=(await this.pack).slice(e),n=new tr(i),s=n.readUInt8(),a=s&112,l=r[a];if(l===void 0)throw new H("Unrecognized type: 0b"+a.toString(2));let c=s&15,o=c;s&128&&(o=mq(n,c));let h=null,d=null;if(l==="ofs_delta"){let m=pq(n),w=e-m;({object:h,type:l}=await this.readSlice({start:w}))}if(l==="ref_delta"){let m=n.slice(20).toString("hex");({object:h,type:l}=await this.read({oid:m}))}let p=i.slice(n.tell());if(d=Buffer.from(await GT(p)),d.byteLength!==o)throw new H(`Packfile told us object would have length ${o} but it had length ${d.byteLength}`);return h&&(d=Buffer.from(oq(d,h))),this.readDepth>3&&(this.offsetCache[e]={type:l,object:d}),{type:l,format:"content",object:d}}};u(Ll,"GitPackIndex");var zl=Ll,Vu=Symbol("PackfileCache");async function wq({fs:t,filename:e,getExternalRefDelta:r,emitter:i,emitterPrefix:n}){let s=await t.read(e);return zl.fromIdx({idx:s,getExternalRefDelta:r})}u(wq,"loadPackIndex");function tg({fs:t,cache:e,filename:r,getExternalRefDelta:i,emitter:n,emitterPrefix:s}){e[Vu]||(e[Vu]=new Map);let a=e[Vu].get(r);return a||(a=wq({fs:t,filename:r,getExternalRefDelta:i,emitter:n,emitterPrefix:s}),e[Vu].set(r,a)),a}u(tg,"readPackIndex");async function yq({fs:t,cache:e,gitdir:r,oid:i,format:n="content",getExternalRefDelta:s}){let a=await t.readdir(C(r,"objects/pack"));a=a.filter(l=>l.endsWith(".idx"));for(let l of a){let c=`${r}/objects/pack/${l}`,o=await tg({fs:t,cache:e,filename:c,getExternalRefDelta:s});if(o.error)throw new H(o.error);if(o.offsets.has(i)){if(!o.pack){let h=c.replace(/idx$/,"pack");o.pack=t.read(h)}let f=await o.read({oid:i,getExternalRefDelta:s});return f.format="content",f.source=`objects/pack/${l.replace(/idx$/,"pack")}`,f}}return null}u(yq,"readObjectPacked");async function ge({fs:t,cache:e,gitdir:r,oid:i,format:n="content"}){let s=u(f=>ge({fs:t,cache:e,gitdir:r,oid:f}),"getExternalRefDelta"),a;if(i==="4b825dc642cb6eb9a060e54bf8d69288fbee4904"&&(a={format:"wrapped",object:Buffer.from("tree 0\0")}),a||(a=await HT({fs:t,gitdir:r,oid:i})),!a){if(a=await yq({fs:t,cache:e,gitdir:r,oid:i,getExternalRefDelta:s}),!a)throw new pe(i);return a}if(n==="deflated"||(a.format==="deflated"&&(a.object=Buffer.from(await GT(a.object)),a.format="wrapped"),n==="wrapped"))return a;let l=await si(a.object);if(l!==i)throw new H(`SHA check failed! Expected ${i}, computed ${l}`);let{object:c,type:o}=$i.unwrap(a.object);if(a.type=o,a.object=c,a.format="content",n==="content")return a;throw new H(`invalid requested format "${n}"`)}u(ge,"_readObject");var wh=class wh extends re{constructor(e,r,i=!0){super(`Failed to create ${e} at ${r} because it already exists.${i?` (Hint: use 'force: true' parameter to overwrite existing ${e}.)`:""}`),this.code=this.name=wh.code,this.data={noun:e,where:r,canForce:i}}};u(wh,"AlreadyExistsError");var dr=wh;dr.code="AlreadyExistsError";var yh=class yh extends re{constructor(e,r,i){super(`Found multiple ${e} matching "${r}" (${i.join(", ")}). Use a longer abbreviation length to disambiguate them.`),this.code=this.name=yh.code,this.data={nouns:e,short:r,matches:i}}};u(yh,"AmbiguousError");var Wl=yh;Wl.code="AmbiguousError";var gh=class gh extends re{constructor(e){super(`Your local changes to the following files would be overwritten by checkout: ${e.join(", ")}`),this.code=this.name=gh.code,this.data={filepaths:e}}};u(gh,"CheckoutConflictError");var Hl=gh;Hl.code="CheckoutConflictError";var bh=class bh extends re{constructor(e,r){super(`Failed to checkout "${e}" because commit ${r} is not available locally. Do a git fetch to make the branch available locally.`),this.code=this.name=bh.code,this.data={ref:e,oid:r}}};u(bh,"CommitNotFetchedError");var Vl=bh;Vl.code="CommitNotFetchedError";var _h=class _h extends re{constructor(){super("Empty response from git server."),this.code=this.name=_h.code,this.data={}}};u(_h,"EmptyServerResponseError");var Gl=_h;Gl.code="EmptyServerResponseError";var vh=class vh extends re{constructor(){super("A simple fast-forward merge was not possible."),this.code=this.name=vh.code,this.data={}}};u(vh,"FastForwardError");var Zl=vh;Zl.code="FastForwardError";var Sh=class Sh extends re{constructor(e,r){super(`One or more branches were not updated: ${e}`),this.code=this.name=Sh.code,this.data={prettyDetails:e,result:r}}};u(Sh,"GitPushError");var Kl=Sh;Kl.code="GitPushError";var Eh=class Eh extends re{constructor(e,r,i){super(`HTTP Error: ${e} ${r}`),this.code=this.name=Eh.code,this.data={statusCode:e,statusMessage:r,response:i}}};u(Eh,"HttpError");var Na=Eh;Na.code="HttpError";var Fh=class Fh extends re{constructor(e){let r="invalid filepath";e==="leading-slash"||e==="trailing-slash"?r='"filepath" parameter should not include leading or trailing directory separators because these can cause problems on some platforms.':e==="directory"&&(r='"filepath" should not be a directory.'),super(r),this.code=this.name=Fh.code,this.data={reason:e}}};u(Fh,"InvalidFilepathError");var Bi=Fh;Bi.code="InvalidFilepathError";var kh=class kh extends re{constructor(e,r){super(`"${e}" would be an invalid git reference. (Hint: a valid alternative would be "${r}".)`),this.code=this.name=kh.code,this.data={ref:e,suggestion:r}}};u(kh,"InvalidRefNameError");var pr=kh;pr.code="InvalidRefNameError";var Th=class Th extends re{constructor(e){super(`Maximum search depth of ${e} exceeded.`),this.code=this.name=Th.code,this.data={depth:e}}};u(Th,"MaxDepthError");var Jl=Th;Jl.code="MaxDepthError";var xh=class xh extends re{constructor(){super("Merges with conflicts are not supported yet."),this.code=this.name=xh.code,this.data={}}};u(xh,"MergeNotSupportedError");var Da=xh;Da.code="MergeNotSupportedError";var Oh=class Oh extends re{constructor(e,r,i,n){super(`Automatic merge failed with one or more merge conflicts in the following files: ${e.toString()}. Fix conflicts then commit the result.`),this.code=this.name=Oh.code,this.data={filepaths:e,bothModified:r,deleteByUs:i,deleteByTheirs:n}}};u(Oh,"MergeConflictError");var Ca=Oh;Ca.code="MergeConflictError";var Rh=class Rh extends re{constructor(e){super(`No name was provided for ${e} in the argument or in the .git/config file.`),this.code=this.name=Rh.code,this.data={role:e}}};u(Rh,"MissingNameError");var ft=Rh;ft.code="MissingNameError";var Ah=class Ah extends re{constructor(e){super(`The function requires a "${e}" parameter but none was provided.`),this.code=this.name=Ah.code,this.data={parameter:e}}};u(Ah,"MissingParameterError");var Ot=Ah;Ot.code="MissingParameterError";var Ph=class Ph extends re{constructor(e){super('There are multiple errors that were thrown by the method. Please refer to the "errors" property to see more'),this.code=this.name=Ph.code,this.data={errors:e},this.errors=e}};u(Ph,"MultipleGitError");var Yl=Ph;Yl.code="MultipleGitError";var Nh=class Nh extends re{constructor(e,r){super(`Expected "${e}" but received "${r}".`),this.code=this.name=Nh.code,this.data={expected:e,actual:r}}};u(Nh,"ParseError");var Pn=Nh;Pn.code="ParseError";var Dh=class Dh extends re{constructor(e){let r="";e==="not-fast-forward"?r=" because it was not a simple fast-forward":e==="tag-exists"&&(r=" because tag already exists"),super(`Push rejected${r}. Use "force: true" to override.`),this.code=this.name=Dh.code,this.data={reason:e}}};u(Dh,"PushRejectedError");var Ia=Dh;Ia.code="PushRejectedError";var Ch=class Ch extends re{constructor(e,r){super(`Remote does not support the "${e}" so the "${r}" parameter cannot be used.`),this.code=this.name=Ch.code,this.data={capability:e,parameter:r}}};u(Ch,"RemoteCapabilityError");var Ci=Ch;Ci.code="RemoteCapabilityError";var Ih=class Ih extends re{constructor(e,r){super(`Remote did not reply using the "smart" HTTP protocol. Expected "001e# service=git-upload-pack" but received: ${e}`),this.code=this.name=Ih.code,this.data={preview:e,response:r}}};u(Ih,"SmartHttpError");var Xl=Ih;Xl.code="SmartHttpError";var $h=class $h extends re{constructor(e,r,i){super(`Git remote "${e}" uses an unrecognized transport protocol: "${r}"`),this.code=this.name=$h.code,this.data={url:e,transport:r,suggestion:i}}};u($h,"UnknownTransportError");var Ql=$h;Ql.code="UnknownTransportError";var Bh=class Bh extends re{constructor(e){super(`Cannot parse remote URL: "${e}"`),this.code=this.name=Bh.code,this.data={url:e}}};u(Bh,"UrlParseError");var ec=Bh;ec.code="UrlParseError";var Lh=class Lh extends re{constructor(){super("The operation was canceled."),this.code=this.name=Lh.code,this.data={}}};u(Lh,"UserCanceledError");var $a=Lh;$a.code="UserCanceledError";var Mh=class Mh extends re{constructor(e){super(`Could not merge index: Entry for '${e}' is not up to date. Either reset the index entry to HEAD, or stage your unstaged changes.`),this.code=this.name=Mh.code,this.data={filepath:e}}};u(Mh,"IndexResetError");var tc=Mh;tc.code="IndexResetError";var jh=class jh extends re{constructor(e){super(`"${e}" does not point to any commit. You're maybe working on a repository with no commits yet. `),this.code=this.name=jh.code,this.data={ref:e}}};u(jh,"NoCommitError");var rc=jh;rc.code="NoCommitError";var ZT=Object.freeze({__proto__:null,AlreadyExistsError:dr,AmbiguousError:Wl,CheckoutConflictError:Hl,CommitNotFetchedError:Vl,EmptyServerResponseError:Gl,FastForwardError:Zl,GitPushError:Kl,HttpError:Na,InternalError:H,InvalidFilepathError:Bi,InvalidOidError:Ii,InvalidRefNameError:pr,MaxDepthError:Jl,MergeNotSupportedError:Da,MergeConflictError:Ca,MissingNameError:ft,MissingParameterError:Ot,MultipleGitError:Yl,NoRefspecError:Ul,NotFoundError:pe,ObjectTypeError:_t,ParseError:Pn,PushRejectedError:Ia,RemoteCapabilityError:Ci,SmartHttpError:Xl,UnknownTransportError:Ql,UnsafeFilepathError:Ra,UrlParseError:ec,UserCanceledError:$a,UnmergedPathsError:ql,IndexResetError:tc,NoCommitError:rc});function Gy({name:t,email:e,timestamp:r,timezoneOffset:i}){return i=gq(i),`${t} <${e}> ${r} ${i}`}u(Gy,"formatAuthor");function gq(t){let e=bq(_q(t));t=Math.abs(t);let r=Math.floor(t/60);t-=r*60;let i=String(r),n=String(t);return i.length<2&&(i="0"+i),n.length<2&&(n="0"+n),(e===-1?"-":"+")+i+n}u(gq,"formatTimezoneOffset");function bq(t){return Math.sign(t)||(Object.is(t,-0)?-1:1)}u(bq,"simpleSign");function _q(t){return t===0?t:-t}u(_q,"negateExceptForZero");function ni(t){return t=t.replace(/\r/g,""),t=t.replace(/^\n+/,""),t=t.replace(/\n+$/,"")+`
|
|
27
|
+
`,t}u(ni,"normalizeNewlines");function Xu(t){let[,e,r,i,n]=t.match(/^(.*) <(.*)> (.*) (.*)$/);return{name:e,email:r,timestamp:Number(i),timezoneOffset:vq(n)}}u(Xu,"parseAuthor");function vq(t){let[,e,r,i]=t.match(/(\+|-)(\d\d)(\d\d)/);return i=(e==="+"?1:-1)*(Number(r)*60+Number(i)),Sq(i)}u(vq,"parseTimezoneOffset");function Sq(t){return t===0?t:-t}u(Sq,"negateExceptForZero$1");var Ta=class Ta{constructor(e){if(typeof e=="string")this._tag=e;else if(Buffer.isBuffer(e))this._tag=e.toString("utf8");else if(typeof e=="object")this._tag=Ta.render(e);else throw new H("invalid type passed to GitAnnotatedTag constructor")}static from(e){return new Ta(e)}static render(e){return`object ${e.object}
|
|
28
28
|
type ${e.type}
|
|
29
29
|
tag ${e.tag}
|
|
30
|
-
tagger ${
|
|
30
|
+
tagger ${Gy(e.tagger)}
|
|
31
31
|
|
|
32
32
|
${e.message}
|
|
33
33
|
${e.gpgsig?e.gpgsig:""}`}justHeaders(){return this._tag.slice(0,this._tag.indexOf(`
|
|
@@ -36,49 +36,49 @@ ${e.gpgsig?e.gpgsig:""}`}justHeaders(){return this._tag.slice(0,this._tag.indexO
|
|
|
36
36
|
|
|
37
37
|
`)+2)}parse(){return Object.assign(this.headers(),{message:this.message(),gpgsig:this.gpgsig()})}render(){return this._tag}headers(){let e=this.justHeaders().split(`
|
|
38
38
|
`),r=[];for(let n of e)n[0]===" "?r[r.length-1]+=`
|
|
39
|
-
`+n.slice(1):r.push(n);let i={};for(let n of r){let s=n.slice(0,n.indexOf(" ")),
|
|
39
|
+
`+n.slice(1):r.push(n);let i={};for(let n of r){let s=n.slice(0,n.indexOf(" ")),a=n.slice(n.indexOf(" ")+1);Array.isArray(i[s])?i[s].push(a):i[s]=a}return i.tagger&&(i.tagger=Xu(i.tagger)),i.committer&&(i.committer=Xu(i.committer)),i}withoutSignature(){let e=ni(this._tag);return e.indexOf(`
|
|
40
40
|
-----BEGIN PGP SIGNATURE-----`)===-1?e:e.slice(0,e.lastIndexOf(`
|
|
41
41
|
-----BEGIN PGP SIGNATURE-----`))}gpgsig(){if(this._tag.indexOf(`
|
|
42
|
-
-----BEGIN PGP SIGNATURE-----`)===-1)return;let e=this._tag.slice(this._tag.indexOf("-----BEGIN PGP SIGNATURE-----"),this._tag.indexOf("-----END PGP SIGNATURE-----")+27);return
|
|
43
|
-
`}toObject(){return Buffer.from(this._tag,"utf8")}static async sign(e,r,i){let n=e.payload(),{signature:s}=await r({payload:n,secretKey:i});s=
|
|
42
|
+
-----BEGIN PGP SIGNATURE-----`)===-1)return;let e=this._tag.slice(this._tag.indexOf("-----BEGIN PGP SIGNATURE-----"),this._tag.indexOf("-----END PGP SIGNATURE-----")+27);return ni(e)}payload(){return this.withoutSignature()+`
|
|
43
|
+
`}toObject(){return Buffer.from(this._tag,"utf8")}static async sign(e,r,i){let n=e.payload(),{signature:s}=await r({payload:n,secretKey:i});s=ni(s);let a=n+s;return Ta.from(a)}};u(Ta,"GitAnnotatedTag");var qt=Ta;function Iy(t){return t.trim().split(`
|
|
44
44
|
`).map(e=>" "+e).join(`
|
|
45
45
|
`)+`
|
|
46
|
-
`}
|
|
46
|
+
`}u(Iy,"indent");function Eq(t){return t.split(`
|
|
47
47
|
`).map(e=>e.replace(/^ /,"")).join(`
|
|
48
|
-
`)}
|
|
49
|
-
gpgsig`+
|
|
50
|
-
`+n);return new
|
|
48
|
+
`)}u(Eq,"outdent");var xt=class xt{constructor(e){if(typeof e=="string")this._commit=e;else if(Buffer.isBuffer(e))this._commit=e.toString("utf8");else if(typeof e=="object")this._commit=xt.render(e);else throw new H("invalid type passed to GitCommit constructor")}static fromPayloadSignature({payload:e,signature:r}){let i=xt.justHeaders(e),n=xt.justMessage(e),s=ni(i+`
|
|
49
|
+
gpgsig`+Iy(r)+`
|
|
50
|
+
`+n);return new xt(s)}static from(e){return new xt(e)}toObject(){return Buffer.from(this._commit,"utf8")}headers(){return this.parseHeaders()}message(){return xt.justMessage(this._commit)}parse(){return Object.assign({message:this.message()},this.headers())}static justMessage(e){return ni(e.slice(e.indexOf(`
|
|
51
51
|
|
|
52
52
|
`)+2))}static justHeaders(e){return e.slice(0,e.indexOf(`
|
|
53
53
|
|
|
54
|
-
`))}parseHeaders(){let e=
|
|
54
|
+
`))}parseHeaders(){let e=xt.justHeaders(this._commit).split(`
|
|
55
55
|
`),r=[];for(let n of e)n[0]===" "?r[r.length-1]+=`
|
|
56
|
-
`+n.slice(1):r.push(n);let i={parent:[]};for(let n of r){let s=n.slice(0,n.indexOf(" ")),
|
|
56
|
+
`+n.slice(1):r.push(n);let i={parent:[]};for(let n of r){let s=n.slice(0,n.indexOf(" ")),a=n.slice(n.indexOf(" ")+1);Array.isArray(i[s])?i[s].push(a):i[s]=a}return i.author&&(i.author=Xu(i.author)),i.committer&&(i.committer=Xu(i.committer)),i}static renderHeaders(e){let r="";if(e.tree?r+=`tree ${e.tree}
|
|
57
57
|
`:r+=`tree 4b825dc642cb6eb9a060e54bf8d69288fbee4904
|
|
58
58
|
`,e.parent){if(e.parent.length===void 0)throw new H("commit 'parent' property should be an array");for(let s of e.parent)r+=`parent ${s}
|
|
59
|
-
`}let i=e.author;r+=`author ${
|
|
60
|
-
`;let n=e.committer||e.author;return r+=`committer ${
|
|
61
|
-
`,e.gpgsig&&(r+="gpgsig"+
|
|
62
|
-
`+
|
|
59
|
+
`}let i=e.author;r+=`author ${Gy(i)}
|
|
60
|
+
`;let n=e.committer||e.author;return r+=`committer ${Gy(n)}
|
|
61
|
+
`,e.gpgsig&&(r+="gpgsig"+Iy(e.gpgsig)),r}static render(e){return xt.renderHeaders(e)+`
|
|
62
|
+
`+ni(e.message)}render(){return this._commit}withoutSignature(){let e=ni(this._commit);if(e.indexOf(`
|
|
63
63
|
gpgsig`)===-1)return e;let r=e.slice(0,e.indexOf(`
|
|
64
64
|
gpgsig`)),i=e.slice(e.indexOf(`-----END PGP SIGNATURE-----
|
|
65
|
-
`)+28);return
|
|
66
|
-
`+i)}isolateSignature(){let e=this._commit.slice(this._commit.indexOf("-----BEGIN PGP SIGNATURE-----"),this._commit.indexOf("-----END PGP SIGNATURE-----")+27);return
|
|
67
|
-
gpgsig`+
|
|
68
|
-
`+s;return
|
|
69
|
-
`),i=new TextEncoder().encode(i)}catch{}return typeof i!="string"&&(i=Buffer.from(i)),i}catch{return null}}async write(e,r,i={}){try{await this._writeFile(e,r,i)}catch{await this.mkdir(Ks(e)),await this._writeFile(e,r,i)}}async mkdir(e,r=!1){try{await this._mkdir(e)}catch(i){if(i===null||i.code==="EEXIST")return;if(r)throw i;if(i.code==="ENOENT"){let n=Ks(e);if(n==="."||n==="/"||n===e)throw i;await this.mkdir(n),await this.mkdir(e,!0)}}}async rm(e){try{await this._unlink(e)}catch(r){if(r.code!=="ENOENT")throw r}}async rmdir(e,r){try{r&&r.recursive?await this._rm(e,r):await this._rmdir(e)}catch(i){if(i.code!=="ENOENT")throw i}}async readdir(e){try{let r=await this._readdir(e);return r.sort(Du),r}catch(r){return r.code==="ENOTDIR"?null:[]}}async readdirDeep(e){let r=await this._readdir(e);return(await Promise.all(r.map(async n=>{let s=e+"/"+n;return(await this._stat(s)).isDirectory()?this.readdirDeep(s):s}))).reduce((n,s)=>n.concat(s),[])}async lstat(e){try{return await this._lstat(e)}catch(r){if(r.code==="ENOENT"||(r.code||"").includes("ENS"))return null;throw r}}async readlink(e,r={encoding:"buffer"}){try{let i=await this._readlink(e,r);return Buffer.isBuffer(i)?i:Buffer.from(i)}catch(i){if(i.code==="ENOENT"||(i.code||"").includes("ENS"))return null;throw i}}async writelink(e,r){return this._symlink(r.toString("utf8"),e)}};l(Jw,"FileSystem");var L=Jw;function k(t,e){if(e===void 0)throw new yt(t)}l(k,"assertParameter");async function Hf(t,e){return!t&&!e?!1:t&&!e||!t&&e?!0:!(await t.type()==="tree"&&await e.type()==="tree"||await t.type()===await e.type()&&await t.mode()===await e.mode()&&await t.oid()===await e.oid())}l(Hf,"modified");async function t1({fs:t,dir:e,gitdir:r=D(e,".git"),commit:i="HEAD",cache:n={}}){try{k("fs",t),k("dir",e),k("gitdir",r);let s=new L(t),o=[Rt({ref:i}),oo(),on()],f=[];await Te.acquire({fs:s,gitdir:r,cache:n},async function(a){f=a.unmergedPaths});let c=await hi({fs:s,cache:n,dir:e,gitdir:r,trees:o,map:l(async function(a,[u,h,d]){let p=!await Hf(h,d),m=f.includes(a),w=!await Hf(d,u);if(p||m)return u?{path:a,mode:await u.mode(),oid:await u.oid(),type:await u.type(),content:await u.content()}:void 0;if(w)return!1;throw new cc(a)},"map")});await Te.acquire({fs:s,gitdir:r,cache:n},async function(a){for(let u of c)if(u!==!1){if(!u){await s.rmdir(`${e}/${u.path}`,{recursive:!0}),a.delete({filepath:u.path});continue}if(u.type==="blob"){let h=new TextDecoder().decode(u.content);await s.write(`${e}/${u.path}`,h,{mode:u.mode}),a.insert({filepath:u.path,oid:u.oid,stage:0})}}})}catch(s){throw s.caller="git.abortMerge",s}}l(t1,"abortMerge");var Xw=class Xw{static async isIgnored({fs:e,dir:r,gitdir:i=D(r,".git"),filepath:n}){if(jf(n)===".git")return!0;if(n===".")return!1;let s="",o=D(i,"info","exclude");await e.exists(o)&&(s=await e.read(o,"utf8"));let f=[{gitignore:D(r,".gitignore"),filepath:n}],c=n.split("/").filter(Boolean);for(let u=1;u<c.length;u++){let h=c.slice(0,u).join("/"),d=c.slice(u).join("/");f.push({gitignore:D(r,h,".gitignore"),filepath:d})}let a=!1;for(let u of f){let h;try{h=await e.read(u.gitignore,"utf8")}catch(m){if(m.code==="NOENT")continue}let d=fL().add(s);d.add(h);let p=Ks(u.filepath);if(p!=="."&&d.ignores(p))return!0;a?a=!d.test(u.filepath).unignored:a=d.test(u.filepath).ignored}return a}};l(Xw,"GitIgnoreManager");var di=Xw;async function aj({fs:t,gitdir:e,object:r,format:i,oid:n}){if(i!=="deflated")throw new H("GitObjectStoreLoose expects objects to write to be in deflated format");let s=`objects/${n.slice(0,2)}/${n.slice(2)}`,o=`${e}/${s}`;await t.exists(o)||await t.write(o,r)}l(aj,"writeObjectLoose");var mw=null;async function r1(t){return mw===null&&(mw=lj()),mw?cj(t):Cw.deflate(t)}l(r1,"deflate");async function cj(t){let e=new CompressionStream("deflate"),r=new Blob([t]).stream().pipeThrough(e);return new Uint8Array(await new Response(r).arrayBuffer())}l(cj,"browserDeflate");function lj(){try{return new CompressionStream("deflate").writable.close(),new Blob([]).stream().cancel(),!0}catch{return!1}}l(lj,"testCompressionStream");async function _t({fs:t,gitdir:e,type:r,object:i,format:n="content",oid:s=void 0,dryRun:o=!1}){return n!=="deflated"&&(n!=="wrapped"&&(i=fi.wrap({type:r,object:i})),s=await $r(i),i=Buffer.from(await r1(i))),o||await aj({fs:t,gitdir:e,object:i,format:"deflated",oid:s}),s}l(_t,"_writeObject");function i1(t){let e;for(;~(e=t.indexOf(92));)t[e]=47;return t}l(i1,"posixifyPathBuffer");async function n1({fs:t,dir:e,gitdir:r=D(e,".git"),filepath:i,cache:n={},force:s=!1,parallel:o=!0}){try{k("fs",t),k("dir",e),k("gitdir",r),k("filepath",i);let f=new L(t);await Te.acquire({fs:f,gitdir:r,cache:n},async c=>{let u=await(await ve.get({fs:f,gitdir:r})).get("core.autocrlf");return Pw({dir:e,gitdir:r,fs:f,filepath:i,index:c,force:s,parallel:o,autocrlf:u})})}catch(f){throw f.caller="git.add",f}}l(n1,"add");async function Pw({dir:t,gitdir:e,fs:r,filepath:i,index:n,force:s,parallel:o,autocrlf:f}){i=Array.isArray(i)?i:[i];let c=i.map(async d=>{if(!s&&await di.isIgnored({fs:r,dir:t,gitdir:e,filepath:d}))return;let p=await r.lstat(D(t,d));if(!p)throw new fe(d);if(p.isDirectory()){let m=await r.readdir(D(t,d));if(o){let w=m.map(y=>Pw({dir:t,gitdir:e,fs:r,filepath:[D(d,y)],index:n,force:s,parallel:o,autocrlf:f}));await Promise.all(w)}else for(let w of m)await Pw({dir:t,gitdir:e,fs:r,filepath:[D(d,w)],index:n,force:s,parallel:o,autocrlf:f})}else{let m=p.isSymbolicLink()?await r.readlink(D(t,d)).then(i1):await r.read(D(t,d),{autocrlf:f});if(m===null)throw new fe(d);let w=await _t({fs:r,gitdir:e,type:"blob",object:m});n.insert({filepath:d,stats:p,oid:w})}}),a=await Promise.allSettled(c),u=a.filter(d=>d.status==="rejected").map(d=>d.reason);if(u.length>1)throw new nc(u);if(u.length===1)throw u[0];return a.filter(d=>d.status==="fulfilled"&&d.value).map(d=>d.value)}l(Pw,"addToIndex");async function fc({fs:t,gitdir:e,path:r}){return(await ve.get({fs:t,gitdir:e})).get(r)}l(fc,"_getConfig");function s1(t,...e){for(let r of e)if(r)for(let i of Object.keys(r)){let n=r[i];n!==void 0&&(t[i]=n)}return t}l(s1,"assignDefined");async function pi({fs:t,gitdir:e,author:r,commit:i}){let n=Math.floor(Date.now()/1e3),s={name:await fc({fs:t,gitdir:e,path:"user.name"}),email:await fc({fs:t,gitdir:e,path:"user.email"})||"",timestamp:n,timezoneOffset:new Date(n*1e3).getTimezoneOffset()},o=s1({},s,i?i.author:void 0,r);if(o.name!==void 0)return o}l(pi,"normalizeAuthorObject");async function to({fs:t,gitdir:e,author:r,committer:i,commit:n}){let s=Math.floor(Date.now()/1e3),o={name:await fc({fs:t,gitdir:e,path:"user.name"}),email:await fc({fs:t,gitdir:e,path:"user.email"})||"",timestamp:s,timezoneOffset:new Date(s*1e3).getTimezoneOffset()},f=s1({},o,n?n.committer:void 0,r,i);if(f.name!==void 0)return f}l(to,"normalizeCommitterObject");async function o1({fs:t,cache:e,gitdir:r,oid:i}){let{type:n,object:s}=await de({fs:t,cache:e,gitdir:r,oid:i});if(n==="tag")return i=Ot.from(s).parse().object,o1({fs:t,cache:e,gitdir:r,oid:i});if(n!=="commit")throw new ut(i,n,"commit");return{commit:bt.from(s),oid:i}}l(o1,"resolveCommit");async function ro({fs:t,cache:e,gitdir:r,oid:i}){let{commit:n,oid:s}=await o1({fs:t,cache:e,gitdir:r,oid:i});return{oid:s,commit:n.parse(),payload:n.withoutSignature()}}l(ro,"_readCommit");async function $u({fs:t,cache:e,onSign:r,gitdir:i,message:n,author:s,committer:o,signingKey:f,amend:c=!1,dryRun:a=!1,noUpdateBranch:u=!1,ref:h,parent:d,tree:p}){let m=!1;h||(h=await $.resolve({fs:t,gitdir:i,ref:"HEAD",depth:2}));let w,y;try{w=await $.resolve({fs:t,gitdir:i,ref:h}),y=await ro({fs:t,gitdir:i,oid:w,cache:{}})}catch{m=!0}if(c&&m)throw new lc(h);let g=c?await pi({fs:t,gitdir:i,author:s,commit:y.commit}):await pi({fs:t,gitdir:i,author:s});if(!g)throw new rt("author");let _=c?await to({fs:t,gitdir:i,author:g,committer:o,commit:y.commit}):await to({fs:t,gitdir:i,author:g,committer:o});if(!_)throw new rt("committer");return Te.acquire({fs:t,gitdir:i,cache:e,allowUnmerged:!1},async function(F){let R=KT(F.entries).get(".");if(p||(p=await a1({fs:t,gitdir:i,inode:R,dryRun:a})),d?d=await Promise.all(d.map(O=>$.resolve({fs:t,gitdir:i,ref:O}))):c?d=y.commit.parent:d=w?[w]:[],!n)if(c)n=y.commit.message;else throw new yt("message");let P=bt.from({tree:p,parent:d,author:g,committer:_,message:n});f&&(P=await bt.sign(P,r,f));let S=await _t({fs:t,gitdir:i,type:"commit",object:P.toObject(),dryRun:a});return!u&&!a&&await $.writeRef({fs:t,gitdir:i,ref:h,value:S}),S})}l($u,"_commit");async function a1({fs:t,gitdir:e,inode:r,dryRun:i}){let n=r.children;for(let c of n)c.type==="tree"&&(c.metadata.mode="040000",c.metadata.oid=await a1({fs:t,gitdir:e,inode:c,dryRun:i}));let s=n.map(c=>({mode:c.metadata.mode,path:c.basename,oid:c.metadata.oid,type:c.type})),o=gt.from(s);return await _t({fs:t,gitdir:e,type:"tree",object:o.toObject(),dryRun:i})}l(a1,"constructTree");async function hc({fs:t,cache:e,gitdir:r,oid:i,filepath:n}){if(n.startsWith("/"))throw new ui("leading-slash");if(n.endsWith("/"))throw new ui("trailing-slash");let s=i,o=await eo({fs:t,cache:e,gitdir:r,oid:i}),f=o.tree;if(n==="")i=o.oid;else{let c=n.split("/");i=await c1({fs:t,cache:e,gitdir:r,tree:f,pathArray:c,oid:s,filepath:n})}return i}l(hc,"resolveFilepath");async function c1({fs:t,cache:e,gitdir:r,tree:i,pathArray:n,oid:s,filepath:o}){let f=n.shift();for(let c of i)if(c.path===f){if(n.length===0)return c.oid;{let{type:a,object:u}=await de({fs:t,cache:e,gitdir:r,oid:c.oid});if(a!=="tree")throw new ut(s,a,"tree",o);return i=gt.from(u),c1({fs:t,cache:e,gitdir:r,tree:i,pathArray:n,oid:s,filepath:o})}}throw new fe(`file or directory found at "${s}:${o}"`)}l(c1,"_resolveFilepath");async function ao({fs:t,cache:e,gitdir:r,oid:i,filepath:n=void 0}){n!==void 0&&(i=await hc({fs:t,cache:e,gitdir:r,oid:i,filepath:n}));let{tree:s,oid:o}=await eo({fs:t,cache:e,gitdir:r,oid:i});return{oid:o,tree:s.entries()}}l(ao,"_readTree");async function dc({fs:t,gitdir:e,tree:r}){let i=gt.from(r).toObject();return await _t({fs:t,gitdir:e,type:"tree",object:i,format:"content"})}l(dc,"_writeTree");async function fj({fs:t,cache:e,onSign:r,gitdir:i,ref:n,oid:s,note:o,force:f,author:c,committer:a,signingKey:u}){let h;try{h=await $.resolve({gitdir:i,fs:t,ref:n})}catch(g){if(!(g instanceof fe))throw g}let p=(await ao({fs:t,cache:e,gitdir:i,oid:h||"4b825dc642cb6eb9a060e54bf8d69288fbee4904"})).tree;if(f)p=p.filter(g=>g.path!==s);else for(let g of p)if(g.path===s)throw new Zt("note",s);typeof o=="string"&&(o=Buffer.from(o,"utf8"));let m=await _t({fs:t,gitdir:i,type:"blob",object:o,format:"content"});p.push({mode:"100644",path:s,oid:m,type:"blob"});let w=await dc({fs:t,gitdir:i,tree:p});return await $u({fs:t,cache:e,onSign:r,gitdir:i,ref:n,tree:w,parent:h&&[h],message:`Note added by 'isomorphic-git addNote'
|
|
70
|
-
`,author:c,committer:a,signingKey:u})}l(fj,"_addNote");async function l1({fs:t,onSign:e,dir:r,gitdir:i=D(r,".git"),ref:n="refs/notes/commits",oid:s,note:o,force:f,author:c,committer:a,signingKey:u,cache:h={}}){try{k("fs",t),k("gitdir",i),k("oid",s),k("note",o),u&&k("onSign",e);let d=new L(t),p=await pi({fs:d,gitdir:i,author:c});if(!p)throw new rt("author");let m=await to({fs:d,gitdir:i,author:p,committer:a});if(!m)throw new rt("committer");return await fj({fs:new L(d),cache:h,onSign:e,gitdir:i,ref:n,oid:s,note:o,force:f,author:p,committer:m,signingKey:u})}catch(d){throw d.caller="git.addNote",d}}l(l1,"addNote");var uj=/(^|[/.])([/.]|$)|^@$|@{|[\x00-\x20\x7f~^:?*[\\]|\.lock(\/|$)/;function uc(t,e){if(typeof t!="string")throw new TypeError("Reference name must be a string");return!uj.test(t)&&(!!e||t.includes("/"))}l(uc,"isValidRef");async function f1({fs:t,gitdir:e,remote:r,url:i,force:n}){if(!uc(r,!0))throw new Qt(r,Ga.clean(r));let s=await ve.get({fs:t,gitdir:e});if(!n&&(await s.getSubsections("remote")).includes(r)&&i!==await s.get(`remote.${r}.url`))throw new Zt("remote",r);await s.set(`remote.${r}.url`,i),await s.set(`remote.${r}.fetch`,`+refs/heads/*:refs/remotes/${r}/*`),await ve.save({fs:t,gitdir:e,config:s})}l(f1,"_addRemote");async function u1({fs:t,dir:e,gitdir:r=D(e,".git"),remote:i,url:n,force:s=!1}){try{return k("fs",t),k("gitdir",r),k("remote",i),k("url",n),await f1({fs:new L(t),gitdir:r,remote:i,url:n,force:s})}catch(o){throw o.caller="git.addRemote",o}}l(u1,"addRemote");async function hj({fs:t,cache:e,onSign:r,gitdir:i,ref:n,tagger:s,message:o=n,gpgsig:f,object:c,signingKey:a,force:u=!1}){if(n=n.startsWith("refs/tags/")?n:`refs/tags/${n}`,!u&&await $.exists({fs:t,gitdir:i,ref:n}))throw new Zt("tag",n);let h=await $.resolve({fs:t,gitdir:i,ref:c||"HEAD"}),{type:d}=await de({fs:t,cache:e,gitdir:i,oid:h}),p=Ot.from({object:h,type:d,tag:n.replace("refs/tags/",""),tagger:s,message:o,gpgsig:f});a&&(p=await Ot.sign(p,r,a));let m=await _t({fs:t,gitdir:i,type:"tag",object:p.toObject()});await $.writeRef({fs:t,gitdir:i,ref:n,value:m})}l(hj,"_annotatedTag");async function h1({fs:t,onSign:e,dir:r,gitdir:i=D(r,".git"),ref:n,tagger:s,message:o=n,gpgsig:f,object:c,signingKey:a,force:u=!1,cache:h={}}){try{k("fs",t),k("gitdir",i),k("ref",n),a&&k("onSign",e);let d=new L(t),p=await pi({fs:d,gitdir:i,author:s});if(!p)throw new rt("tagger");return await hj({fs:d,cache:h,onSign:e,gitdir:i,ref:n,tagger:p,message:o,gpgsig:f,object:c,signingKey:a,force:u})}catch(d){throw d.caller="git.annotatedTag",d}}l(h1,"annotatedTag");async function dj({fs:t,gitdir:e,ref:r,object:i,checkout:n=!1,force:s=!1}){if(!uc(r,!0))throw new Qt(r,Ga.clean(r));let o=`refs/heads/${r}`;if(!s&&await $.exists({fs:t,gitdir:e,ref:o}))throw new Zt("branch",r,!1);let f;try{f=await $.resolve({fs:t,gitdir:e,ref:i||"HEAD"})}catch{}f&&await $.writeRef({fs:t,gitdir:e,ref:o,value:f}),n&&await $.writeSymbolicRef({fs:t,gitdir:e,ref:"HEAD",value:o})}l(dj,"_branch");async function d1({fs:t,dir:e,gitdir:r=D(e,".git"),ref:i,object:n,checkout:s=!1,force:o=!1}){try{return k("fs",t),k("gitdir",r),k("ref",i),await dj({fs:new L(t),gitdir:r,ref:i,object:n,checkout:s,force:o})}catch(f){throw f.caller="git.branch",f}}l(d1,"branch");var p1=l((t,e)=>t==="."||e==null||e.length===0||e==="."?!0:e.length>=t.length?e.startsWith(t):t.startsWith(e),"worthWalking");async function Iw({fs:t,cache:e,onProgress:r,onPostCheckout:i,dir:n,gitdir:s,remote:o,ref:f,filepaths:c,noCheckout:a,noUpdateHead:u,dryRun:h,force:d,track:p=!0,nonBlocking:m=!1,batchSize:w=100}){let y;if(i)try{y=await $.resolve({fs:t,gitdir:s,ref:"HEAD"})}catch{y="0000000000000000000000000000000000000000"}let g;try{g=await $.resolve({fs:t,gitdir:s,ref:f})}catch(_){if(f==="HEAD")throw _;let F=`${o}/${f}`;if(g=await $.resolve({fs:t,gitdir:s,ref:F}),p){let E=await ve.get({fs:t,gitdir:s});await E.set(`branch.${f}.remote`,o),await E.set(`branch.${f}.merge`,`refs/heads/${f}`),await ve.save({fs:t,gitdir:s,config:E})}await $.writeRef({fs:t,gitdir:s,ref:`refs/heads/${f}`,value:g})}if(!a){let _;try{_=await pj({fs:t,cache:e,onProgress:r,dir:n,gitdir:s,ref:f,force:d,filepaths:c})}catch(S){throw S instanceof fe&&S.data.what===g?new Qa(f,g):S}let F=_.filter(([S])=>S==="conflict").map(([S,O])=>O);if(F.length>0)throw new Za(F);let E=_.filter(([S])=>S==="error").map(([S,O])=>O);if(E.length>0)throw new H(E.join(", "));if(h){i&&await i({previousHead:y,newHead:g,type:c!=null&&c.length>0?"file":"branch"});return}let R=0,P=_.length;if(await Te.acquire({fs:t,gitdir:s,cache:e},async function(S){await Promise.all(_.filter(([O])=>O==="delete"||O==="delete-index").map(async function([O,v]){let A=`${n}/${v}`;O==="delete"&&await t.rm(A),S.delete({filepath:v}),r&&await r({phase:"Updating workdir",loaded:++R,total:P})}))}),await Te.acquire({fs:t,gitdir:s,cache:e},async function(S){for(let[O,v]of _)if(O==="rmdir"||O==="rmdir-index"){let A=`${n}/${v}`;try{O==="rmdir"&&await t.rmdir(A),S.delete({filepath:v}),r&&await r({phase:"Updating workdir",loaded:++R,total:P})}catch(x){if(x.code==="ENOTEMPTY")console.log(`Did not delete ${v} because directory is not empty`);else throw x}}}),await Promise.all(_.filter(([S])=>S==="mkdir"||S==="mkdir-index").map(async function([S,O]){let v=`${n}/${O}`;await t.mkdir(v),r&&await r({phase:"Updating workdir",loaded:++R,total:P})})),m){let S=_.filter(([v])=>v==="create"||v==="create-index"||v==="update"||v==="mkdir-index"),O=await IT("Update Working Dir",S.map(([v,A,x,I,M])=>()=>wj({fs:t,cache:e,gitdir:s,dir:n},[v,A,x,I,M])),r,w);await Te.acquire({fs:t,gitdir:s,cache:e,allowUnmerged:!0},async function(v){await IT("Update Index",O.map(([A,x,I])=>()=>mj({index:v,fullpath:A,oid:x,stats:I})),r,w)})}else await Te.acquire({fs:t,gitdir:s,cache:e,allowUnmerged:!0},async function(S){await Promise.all(_.filter(([O])=>O==="create"||O==="create-index"||O==="update"||O==="mkdir-index").map(async function([O,v,A,x,I]){let M=`${n}/${v}`;try{if(O!=="create-index"&&O!=="mkdir-index"){let{object:Se}=await de({fs:t,cache:e,gitdir:s,oid:A});if(I&&await t.rm(M),x===33188)await t.write(M,Se);else if(x===33261)await t.write(M,Se,{mode:511});else if(x===40960)await t.writelink(M,Se);else throw new H(`Invalid mode 0o${x.toString(8)} detected in blob ${A}`)}let z=await t.lstat(M);x===33261&&(z.mode=493),O==="mkdir-index"&&(z.mode=57344),S.insert({filepath:v,stats:z,oid:A}),r&&await r({phase:"Updating workdir",loaded:++R,total:P})}catch(z){console.log(z)}}))});i&&await i({previousHead:y,newHead:g,type:c!=null&&c.length>0?"file":"branch"})}if(!u){let _=await $.expand({fs:t,gitdir:s,ref:f});_.startsWith("refs/heads")?await $.writeSymbolicRef({fs:t,gitdir:s,ref:"HEAD",value:_}):await $.writeRef({fs:t,gitdir:s,ref:"HEAD",value:g})}}l(Iw,"_checkout");async function pj({fs:t,cache:e,onProgress:r,dir:i,gitdir:n,ref:s,force:o,filepaths:f}){let c=0;return hi({fs:t,cache:e,dir:i,gitdir:n,trees:[Rt({ref:s}),oo(),on()],map:l(async function(a,[u,h,d]){if(a===".")return;if(f&&!f.some(m=>p1(a,m)))return null;switch(r&&await r({phase:"Analyzing workdir",loaded:++c}),[!!d,!!u,!!h].map(Number).join("")){case"000":return;case"001":return o&&f&&f.includes(a)?["delete",a]:void 0;case"010":switch(await u.type()){case"tree":return["mkdir",a];case"blob":return["create",a,await u.oid(),await u.mode()];case"commit":return["mkdir-index",a,await u.oid(),await u.mode()];default:return["error",`new entry Unhandled type ${await u.type()}`]}case"011":switch(`${await u.type()}-${await h.type()}`){case"tree-tree":return;case"tree-blob":case"blob-tree":return["conflict",a];case"blob-blob":return await u.oid()!==await h.oid()?o?["update",a,await u.oid(),await u.mode(),await u.mode()!==await h.mode()]:["conflict",a]:await u.mode()!==await h.mode()?o?["update",a,await u.oid(),await u.mode(),!0]:["conflict",a]:["create-index",a,await u.oid(),await u.mode()];case"commit-tree":return;case"commit-blob":return["conflict",a];default:return["error",`new entry Unhandled type ${u.type}`]}case"100":return["delete-index",a];case"101":switch(await d.type()){case"tree":return["rmdir-index",a];case"blob":return await d.oid()!==await h.oid()?o?["delete",a]:["conflict",a]:["delete",a];case"commit":return["rmdir-index",a];default:return["error",`delete entry Unhandled type ${await d.type()}`]}case"110":case"111":switch(`${await d.type()}-${await u.type()}`){case"tree-tree":return;case"blob-blob":{if(await d.oid()===await u.oid()&&await d.mode()===await u.mode()&&!o)return;if(h){if(await h.oid()!==await d.oid()&&await h.oid()!==await u.oid())return o?["update",a,await u.oid(),await u.mode(),await u.mode()!==await h.mode()]:["conflict",a]}else if(o)return["update",a,await u.oid(),await u.mode(),await u.mode()!==await d.mode()];return await u.mode()!==await d.mode()?["update",a,await u.oid(),await u.mode(),!0]:await u.oid()!==await d.oid()?["update",a,await u.oid(),await u.mode(),!1]:void 0}case"tree-blob":return["update-dir-to-blob",a,await u.oid()];case"blob-tree":return["update-blob-to-tree",a];case"commit-commit":return["mkdir-index",a,await u.oid(),await u.mode()];default:return["error",`update entry Unhandled type ${await d.type()}-${await u.type()}`]}}},"map"),reduce:l(async function(a,u){return u=e1(u),a?a&&a[0]==="rmdir"?(u.push(a),u):(u.unshift(a),u):u},"reduce")})}l(pj,"analyze");async function mj({index:t,fullpath:e,stats:r,oid:i}){try{t.insert({filepath:e,stats:r,oid:i})}catch(n){console.warn(`Error inserting ${e} into index:`,n)}}l(mj,"updateIndex");async function wj({fs:t,cache:e,gitdir:r,dir:i},[n,s,o,f,c]){let a=`${i}/${s}`;if(n!=="create-index"&&n!=="mkdir-index"){let{object:h}=await de({fs:t,cache:e,gitdir:r,oid:o});if(c&&await t.rm(a),f===33188)await t.write(a,h);else if(f===33261)await t.write(a,h,{mode:511});else if(f===40960)await t.writelink(a,h);else throw new H(`Invalid mode 0o${f.toString(8)} detected in blob ${o}`)}let u=await t.lstat(a);return f===33261&&(u.mode=493),n==="mkdir-index"&&(u.mode=57344),[s,o,u]}l(wj,"updateWorkingDir");async function IT(t,e,r,i){let n=[];try{for(let s=0;s<e.length;s+=i){let o=e.slice(s,s+i).map(c=>c());(await Promise.allSettled(o)).forEach(c=>{c.status==="fulfilled"&&n.push(c.value)}),r&&await r({phase:"Updating workdir",loaded:s+o.length,total:e.length})}return n}catch(s){console.error(`Error during ${t}: ${s}`)}return n}l(IT,"batchAllSettled");async function $w({fs:t,onProgress:e,onPostCheckout:r,dir:i,gitdir:n=D(i,".git"),remote:s="origin",ref:o,filepaths:f,noCheckout:c=!1,noUpdateHead:a=o===void 0,dryRun:u=!1,force:h=!1,track:d=!0,cache:p={},nonBlocking:m=!1,batchSize:w=100}){try{k("fs",t),k("dir",i),k("gitdir",n);let y=o||"HEAD";return await Iw({fs:new L(t),cache:p,onProgress:e,onPostCheckout:r,dir:i,gitdir:n,remote:s,ref:y,filepaths:f,noCheckout:c,noUpdateHead:a,dryRun:u,force:h,track:d,nonBlocking:m,batchSize:w})}catch(y){throw y.caller="git.checkout",y}}l($w,"checkout");var yj=/^refs\/(heads\/|tags\/|remotes\/)?(.*)/;function tn(t){let e=yj.exec(t);return e?e[1]==="remotes/"&&t.endsWith("/HEAD")?e[2].slice(0,-5):e[2]:t}l(tn,"abbreviateRef");async function wi({fs:t,gitdir:e,fullname:r=!1,test:i=!1}){let n=await $.resolve({fs:t,gitdir:e,ref:"HEAD",depth:2});if(i)try{await $.resolve({fs:t,gitdir:e,ref:n})}catch{return}if(n.startsWith("refs/"))return r?n:tn(n)}l(wi,"_currentBranch");function gj(t){return t=t.replace(/^git@([^:]+):/,"https://$1/"),t=t.replace(/^ssh:\/\//,"https://"),t}l(gj,"translateSSHtoHTTP");function m1({username:t="",password:e=""}){return`Basic ${Buffer.from(`${t}:${e}`).toString("base64")}`}l(m1,"calculateBasicAuthHeader");async function pc(t,e){let r=YT(t);for(;;){let{value:i,done:n}=await r.next();if(i&&await e(i),n)break}r.return&&r.return()}l(pc,"forAwait");async function Vf(t){let e=0,r=[];await pc(t,s=>{r.push(s),e+=s.byteLength});let i=new Uint8Array(e),n=0;for(let s of r)i.set(s,n),n+=s.byteLength;return i}l(Vf,"collect");function $T(t){let e=t.match(/^https?:\/\/([^/]+)@/);if(e==null)return{url:t,auth:{}};e=e[1];let[r,i]=e.split(":");return t=t.replace(`${e}@`,""),{url:t,auth:{username:r,password:i}}}l($T,"extractAuthFromUrl");function Nw(t,e){let r=e.toString(16);return"0".repeat(t-r.length)+r}l(Nw,"padHex");var Yw=class Yw{static flush(){return Buffer.from("0000","utf8")}static delim(){return Buffer.from("0001","utf8")}static encode(e){typeof e=="string"&&(e=Buffer.from(e));let r=e.length+4,i=Nw(4,r);return Buffer.concat([Buffer.from(i,"utf8"),e])}static streamReader(e){let r=new Wf(e);return l(async function(){try{let n=await r.read(4);if(n==null)return!0;if(n=parseInt(n.toString("utf8"),16),n===0||n===1)return null;let s=await r.read(n-4);return s??!0}catch(n){return e.error=n,!0}},"read")}};l(Yw,"GitPktLine");var be=Yw;async function BT(t){let e={},r;for(;r=await t(),r!==!0;){if(r===null)continue;r=r.toString("utf8").replace(/\n$/,"");let i=r.indexOf("=");if(i>-1){let n=r.slice(0,i),s=r.slice(i+1);e[n]=s}else e[r]=!0}return{protocolVersion:2,capabilities2:e}}l(BT,"parseCapabilitiesV2");async function MT(t,{service:e}){let r=new Set,i=new Map,n=new Map,s=be.streamReader(t),o=await s();for(;o===null;)o=await s();if(o===!0)throw new ec;if(o.includes("version 2"))return BT(s);if(o.toString("utf8").replace(/\n$/,"")!==`# service=${e}`)throw new rn(`# service=${e}\\n`,o.toString("utf8"));let f=await s();for(;f===null;)f=await s();if(f===!0)return{capabilities:r,refs:i,symrefs:n};if(f=f.toString("utf8"),f.includes("version 2"))return BT(s);let[c,a]=ww(f,"\0","\\x00");if(a.split(" ").map(u=>r.add(u)),c!=="0000000000000000000000000000000000000000 capabilities^{}"){let[u,h]=ww(c," "," ");for(i.set(h,u);;){let d=await s();if(d===!0)break;if(d!==null){let[p,m]=ww(d.toString("utf8")," "," ");i.set(m,p)}}}for(let u of r)if(u.startsWith("symref=")){let h=u.match(/symref=([^:]+):(.*)/);h.length===3&&n.set(h[1],h[2])}return{protocolVersion:1,capabilities:r,refs:i,symrefs:n}}l(MT,"parseRefsAdResponse");function ww(t,e,r){let i=t.trim().split(e);if(i.length!==2)throw new rn(`Two strings separated by '${r}'`,t.toString("utf8"));return i}l(ww,"splitAndAssert");var LT=l((t,e)=>t.endsWith("?")?`${t}${e}`:`${t}/${e.replace(/^https?:\/\//,"")}`,"corsProxify"),jT=l((t,e)=>{(e.username||e.password)&&(t.Authorization=m1(e)),e.headers&&Object.assign(t,e.headers)},"updateHeaders"),yw=l(async t=>{try{let e=Buffer.from(await Vf(t.body)),r=e.toString("utf8");return{preview:r.length<256?r:r.slice(0,256)+"...",response:r,data:e}}catch{return{}}},"stringifyBody"),Zw=class Zw{static async capabilities(){return["discover","connect"]}static async discover({http:e,onProgress:r,onAuth:i,onAuthSuccess:n,onAuthFailure:s,corsProxy:o,service:f,url:c,headers:a,protocolVersion:u}){let{url:h,auth:d}=$T(c),p=o?LT(o,h):h;(d.username||d.password)&&(a.Authorization=m1(d)),u===2&&(a["Git-Protocol"]="version=2");let m,w,y=!1;do if(m=await e.request({onProgress:r,method:"GET",url:`${p}/info/refs?service=${f}`,headers:a}),w=!1,m.statusCode===401||m.statusCode===203){let g=y?s:i;if(g){if(d=await g(h,{...d,headers:{...a}}),d&&d.cancel)throw new Qs;d&&(jT(a,d),y=!0,w=!0)}}else m.statusCode===200&&y&&n&&await n(h,d);while(w);if(m.statusCode!==200){let{response:g}=await yw(m);throw new Js(m.statusCode,m.statusMessage,g)}if(m.headers["content-type"]===`application/x-${f}-advertisement`){let g=await MT(m.body,{service:f});return g.auth=d,g}else{let{preview:g,response:_,data:F}=await yw(m);try{let E=await MT([F],{service:f});return E.auth=d,E}catch{throw new sc(g,_)}}}static async connect({http:e,onProgress:r,corsProxy:i,service:n,url:s,auth:o,body:f,headers:c}){let a=$T(s);a&&(s=a.url),i&&(s=LT(i,s)),c["content-type"]=`application/x-${n}-request`,c.accept=`application/x-${n}-result`,jT(c,o);let u=await e.request({onProgress:r,method:"POST",url:`${s}/${n}`,body:f,headers:c});if(u.statusCode!==200){let{response:h}=yw(u);throw new Js(u.statusCode,u.statusMessage,h)}return u}};l(Zw,"GitRemoteHTTP");var io=Zw,Qw=class Qw{static getRemoteHelperFor({url:e}){let r=new Map;r.set("http",io),r.set("https",io);let i=bj({url:e});if(!i)throw new ac(e);if(r.has(i.transport))return r.get(i.transport);throw new oc(e,i.transport,i.transport==="ssh"?gj(e):void 0)}};l(Qw,"GitRemoteManager");var no=Qw;function bj({url:t}){if(t.startsWith("git@"))return{transport:"ssh",address:t};let e=t.match(/(\w+)(:\/\/|::)(.*)/);if(e!==null){if(e[2]==="://")return{transport:e[1],address:e[0]};if(e[2]==="::")return{transport:e[1],address:e[3]}}}l(bj,"parseRemoteUrl");var en=null,ey=class ey{static async read({fs:e,gitdir:r}){en===null&&(en=new Va);let i=D(r,"shallow"),n=new Set;return await en.acquire(i,async function(){let s=await e.read(i,{encoding:"utf8"});if(s===null||s.trim()==="")return n;s.trim().split(`
|
|
71
|
-
`).map(
|
|
65
|
+
`)+28);return ni(r+`
|
|
66
|
+
`+i)}isolateSignature(){let e=this._commit.slice(this._commit.indexOf("-----BEGIN PGP SIGNATURE-----"),this._commit.indexOf("-----END PGP SIGNATURE-----")+27);return Eq(e)}static async sign(e,r,i){let n=e.withoutSignature(),s=xt.justMessage(e._commit),{signature:a}=await r({payload:n,secretKey:i});a=ni(a);let c=xt.justHeaders(e._commit)+`
|
|
67
|
+
gpgsig`+Iy(a)+`
|
|
68
|
+
`+s;return xt.from(c)}};u(xt,"GitCommit");var At=xt;async function Ba({fs:t,cache:e,gitdir:r,oid:i}){if(i==="4b825dc642cb6eb9a060e54bf8d69288fbee4904")return{tree:Rt.from([]),oid:i};let{type:n,object:s}=await ge({fs:t,cache:e,gitdir:r,oid:i});if(n==="tag")return i=qt.from(s).parse().object,Ba({fs:t,cache:e,gitdir:r,oid:i});if(n==="commit")return i=At.from(s).parse().tree,Ba({fs:t,cache:e,gitdir:r,oid:i});if(n!=="tree")throw new _t(i,n,"tree");return{tree:Rt.from(s),oid:i}}u(Ba,"resolveTree");var dg=class dg{constructor({fs:e,gitdir:r,ref:i,cache:n}){var a;this.fs=e,this.cache=n,this.gitdir=r,this.mapPromise=(async()=>{let l=new Map,c;try{c=await $.resolve({fs:e,gitdir:r,ref:i})}catch(f){f instanceof pe&&(c="4b825dc642cb6eb9a060e54bf8d69288fbee4904")}let o=await Ba({fs:e,cache:this.cache,gitdir:r,oid:c});return o.type="tree",o.mode="40000",l.set(".",o),l})();let s=this;this.ConstructEntry=(a=class{constructor(c){this._fullpath=c,this._type=!1,this._mode=!1,this._stat=!1,this._content=!1,this._oid=!1}async type(){return s.type(this)}async mode(){return s.mode(this)}async stat(){return s.stat(this)}async content(){return s.content(this)}async oid(){return s.oid(this)}},u(a,"TreeEntry"),a)}async readdir(e){let r=e._fullpath,{fs:i,cache:n,gitdir:s}=this,a=await this.mapPromise,l=a.get(r);if(!l)throw new Error(`No obj for ${r}`);let c=l.oid;if(!c)throw new Error(`No oid for obj ${JSON.stringify(l)}`);if(l.type!=="tree")return null;let{type:o,object:f}=await ge({fs:i,cache:n,gitdir:s,oid:c});if(o!==l.type)throw new _t(c,o,l.type);let h=Rt.from(f);for(let d of h)a.set(C(r,d.path),d);return h.entries().map(d=>C(r,d.path))}async type(e){if(e._type===!1){let r=await this.mapPromise,{type:i}=r.get(e._fullpath);e._type=i}return e._type}async mode(e){if(e._mode===!1){let r=await this.mapPromise,{mode:i}=r.get(e._fullpath);e._mode=qT(parseInt(i,8))}return e._mode}async stat(e){}async content(e){if(e._content===!1){let r=await this.mapPromise,{fs:i,cache:n,gitdir:s}=this,l=r.get(e._fullpath).oid,{type:c,object:o}=await ge({fs:i,cache:n,gitdir:s,oid:l});c!=="blob"?e._content=void 0:e._content=new Uint8Array(o)}return e._content}async oid(e){if(e._oid===!1){let i=(await this.mapPromise).get(e._fullpath);e._oid=i.oid}return e._oid}};u(dg,"GitWalkerRepo");var Zy=dg;function jt({ref:t="HEAD"}={}){let e=Object.create(null);return Object.defineProperty(e,zh,{value:u(function({fs:r,gitdir:i,cache:n}){return new Zy({fs:r,gitdir:i,ref:t,cache:n})},"value")}),Object.freeze(e),e}u(jt,"TREE");var pg=class pg{constructor({fs:e,dir:r,gitdir:i,cache:n}){var a;this.fs=e,this.cache=n,this.dir=r,this.gitdir=i,this.config=null;let s=this;this.ConstructEntry=(a=class{constructor(c){this._fullpath=c,this._type=!1,this._mode=!1,this._stat=!1,this._content=!1,this._oid=!1}async type(){return s.type(this)}async mode(){return s.mode(this)}async stat(){return s.stat(this)}async content(){return s.content(this)}async oid(){return s.oid(this)}},u(a,"WorkdirEntry"),a)}async readdir(e){let r=e._fullpath,{fs:i,dir:n}=this,s=await i.readdir(C(n,r));return s===null?null:s.map(a=>C(r,a))}async type(e){return e._type===!1&&await e.stat(),e._type}async mode(e){return e._mode===!1&&await e.stat(),e._mode}async stat(e){if(e._stat===!1){let{fs:r,dir:i}=this,n=await r.lstat(`${i}/${e._fullpath}`);if(!n)throw new Error(`ENOENT: no such file or directory, lstat '${e._fullpath}'`);let s=n.isDirectory()?"tree":"blob";s==="blob"&&!n.isFile()&&!n.isSymbolicLink()&&(s="special"),e._type=s,n=Aa(n),e._mode=n.mode,n.size===-1&&e._actualSize&&(n.size=e._actualSize),e._stat=n}return e._stat}async content(e){if(e._content===!1){let{fs:r,dir:i,gitdir:n}=this;if(await e.type()==="tree")e._content=void 0;else{let a=await(await this._getGitConfig(r,n)).get("core.autocrlf"),l=await r.read(`${i}/${e._fullpath}`,{autocrlf:a});e._actualSize=l.length,e._stat&&e._stat.size===-1&&(e._stat.size=e._actualSize),e._content=new Uint8Array(l)}}return e._content}async oid(e){if(e._oid===!1){let r=this,{fs:i,gitdir:n,cache:s}=this,a;await Pe.acquire({fs:i,gitdir:n,cache:s},async function(l){let c=l.entriesMap.get(e._fullpath),o=await e.stat(),h=await(await r._getGitConfig(i,n)).get("core.filemode"),d=typeof process<"u"?process.platform!=="win32":!0;if(!c||Gu(o,c,h,d)){let p=await e.content();p===void 0?a=void 0:(a=await si($i.wrap({type:"blob",object:p})),c&&a===c.oid&&(!h||o.mode===c.mode)&&Gu(o,c,h,d)&&l.insert({filepath:e._fullpath,stats:o,oid:a}))}else a=c.oid}),e._oid=a}return e._oid}async _getGitConfig(e,r){return this.config?this.config:(this.config=await Oe.get({fs:e,gitdir:r}),this.config)}};u(pg,"GitWalkerFs");var Ky=pg;function za(){let t=Object.create(null);return Object.defineProperty(t,zh,{value:u(function({fs:e,dir:r,gitdir:i,cache:n}){return new Ky({fs:e,dir:r,gitdir:i,cache:n})},"value")}),Object.freeze(t),t}u(za,"WORKDIR");function Fq(t,e){let r=e-t;return Array.from({length:r},(i,n)=>t+n)}u(Fq,"arrayRange");var KT=typeof Array.prototype.flat>"u"?t=>t.reduce((e,r)=>e.concat(r),[]):t=>t.flat(),mg=class mg{constructor(){this.value=null}consider(e){e!=null&&(this.value===null?this.value=e:e<this.value&&(this.value=e))}reset(){this.value=null}};u(mg,"RunningMinimum");var Jy=mg;function*kq(t){let e=new Jy,r,i=[],n=t.length;for(let s=0;s<n;s++)i[s]=t[s].next().value,i[s]!==void 0&&e.consider(i[s]);if(e.value!==null)for(;;){let s=[];r=e.value,e.reset();for(let a=0;a<n;a++)i[a]!==void 0&&i[a]===r?(s[a]=i[a],i[a]=t[a].next().value):s[a]=null,i[a]!==void 0&&e.consider(i[a]);if(yield s,e.value===null)return}}u(kq,"unionOfIterators");async function Li({fs:t,cache:e,dir:r,gitdir:i,trees:n,map:s=u(async(c,o)=>o,"map"),reduce:a=u(async(c,o)=>{let f=KT(o);return c!==void 0&&f.unshift(c),f},"reduce"),iterate:l=u((c,o)=>Promise.all([...o].map(c)),"iterate")}){let c=n.map(p=>p[zh]({fs:t,dir:r,gitdir:i,cache:e})),o=new Array(c.length).fill("."),f=Fq(0,c.length),h=u(async p=>{f.forEach(g=>{let b=p[g];p[g]=b&&new c[g].ConstructEntry(b)});let w=(await Promise.all(f.map(g=>{let b=p[g];return b?c[g].readdir(b):[]}))).map(g=>(g===null?[]:g)[Symbol.iterator]());return{entries:p,children:kq(w)}},"unionWalkerFromReaddir"),d=u(async p=>{let{entries:m,children:w}=await h(p),g=m.find(_=>_&&_._fullpath)._fullpath,b=await s(g,m);if(b!==null){let _=await l(d,w);return _=_.filter(S=>S!==void 0),a(b,_)}},"walk");return d(o)}u(Li,"_walk");async function Yy(t,e){let r=await t.readdir(e);r==null?await t.rm(e):r.length?await Promise.all(r.map(i=>{let n=C(e,i);return t.lstat(n).then(s=>{if(s)return s.isDirectory()?Yy(t,n):t.rm(n)})})).then(()=>t.rmdir(e)):await t.rmdir(e)}u(Yy,"rmRecursive");function Tq(t){return xq(t)&&TT(t.then)&&TT(t.catch)}u(Tq,"isPromiseLike");function xq(t){return t&&typeof t=="object"}u(xq,"isObject");function TT(t){return typeof t=="function"}u(TT,"isFunction");function xT(t){return Tq(u(r=>{try{return r.readFile().catch(i=>i)}catch(i){return i}},"test")(t))}u(xT,"isPromiseFs");var OT=["readFile","writeFile","mkdir","rmdir","unlink","stat","lstat","readdir","readlink","symlink"];function RT(t,e){if(xT(e))for(let r of OT)t[`_${r}`]=e[r].bind(e);else for(let r of OT)t[`_${r}`]=Ry(e[r].bind(e));xT(e)?e.rm?t._rm=e.rm.bind(e):e.rmdir.length>1?t._rm=e.rmdir.bind(e):t._rm=Yy.bind(null,t):e.rm?t._rm=Ry(e.rm.bind(e)):e.rmdir.length>2?t._rm=Ry(e.rmdir.bind(e)):t._rm=Yy.bind(null,t)}u(RT,"bindFs");var wg=class wg{constructor(e){if(typeof e._original_unwrapped_fs<"u")return e;let r=Object.getOwnPropertyDescriptor(e,"promises");r&&r.enumerable?RT(this,e.promises):RT(this,e),this._original_unwrapped_fs=e}async exists(e,r={}){try{return await this._stat(e),!0}catch(i){if(i.code==="ENOENT"||i.code==="ENOTDIR"||(i.code||"").includes("ENS"))return!1;throw console.log('Unhandled error in "FileSystem.exists()" function',i),i}}async read(e,r={}){try{let i=await this._readFile(e,r);if(r.autocrlf==="true")try{i=new TextDecoder("utf8",{fatal:!0}).decode(i),i=i.replace(/\r\n/g,`
|
|
69
|
+
`),i=new TextEncoder().encode(i)}catch{}return typeof i!="string"&&(i=Buffer.from(i)),i}catch{return null}}async write(e,r,i={}){try{await this._writeFile(e,r,i)}catch{await this.mkdir(Pa(e)),await this._writeFile(e,r,i)}}async mkdir(e,r=!1){try{await this._mkdir(e)}catch(i){if(i===null||i.code==="EEXIST")return;if(r)throw i;if(i.code==="ENOENT"){let n=Pa(e);if(n==="."||n==="/"||n===e)throw i;await this.mkdir(n),await this.mkdir(e,!0)}}}async rm(e){try{await this._unlink(e)}catch(r){if(r.code!=="ENOENT")throw r}}async rmdir(e,r){try{r&&r.recursive?await this._rm(e,r):await this._rmdir(e)}catch(i){if(i.code!=="ENOENT")throw i}}async readdir(e){try{let r=await this._readdir(e);return r.sort(Uh),r}catch(r){return r.code==="ENOTDIR"?null:[]}}async readdirDeep(e){let r=await this._readdir(e);return(await Promise.all(r.map(async n=>{let s=e+"/"+n;return(await this._stat(s)).isDirectory()?this.readdirDeep(s):s}))).reduce((n,s)=>n.concat(s),[])}async lstat(e){try{return await this._lstat(e)}catch(r){if(r.code==="ENOENT"||(r.code||"").includes("ENS"))return null;throw r}}async readlink(e,r={encoding:"buffer"}){try{let i=await this._readlink(e,r);return Buffer.isBuffer(i)?i:Buffer.from(i)}catch(i){if(i.code==="ENOENT"||(i.code||"").includes("ENS"))return null;throw i}}async writelink(e,r){return this._symlink(r.toString("utf8"),e)}};u(wg,"FileSystem");var M=wg;function O(t,e){if(e===void 0)throw new Ot(t)}u(O,"assertParameter");async function Qu(t,e){return!t&&!e?!1:t&&!e||!t&&e?!0:!(await t.type()==="tree"&&await e.type()==="tree"||await t.type()===await e.type()&&await t.mode()===await e.mode()&&await t.oid()===await e.oid())}u(Qu,"modified");async function JT({fs:t,dir:e,gitdir:r=C(e,".git"),commit:i="HEAD",cache:n={}}){try{O("fs",t),O("dir",e),O("gitdir",r);let s=new M(t),a=[jt({ref:i}),za(),Cn()],l=[];await Pe.acquire({fs:s,gitdir:r,cache:n},async function(o){l=o.unmergedPaths});let c=await Li({fs:s,cache:n,dir:e,gitdir:r,trees:a,map:u(async function(o,[f,h,d]){let p=!await Qu(h,d),m=l.includes(o),w=!await Qu(d,f);if(p||m)return f?{path:o,mode:await f.mode(),oid:await f.oid(),type:await f.type(),content:await f.content()}:void 0;if(w)return!1;throw new tc(o)},"map")});await Pe.acquire({fs:s,gitdir:r,cache:n},async function(o){for(let f of c)if(f!==!1){if(!f){await s.rmdir(`${e}/${f.path}`,{recursive:!0}),o.delete({filepath:f.path});continue}if(f.type==="blob"){let h=new TextDecoder().decode(f.content);await s.write(`${e}/${f.path}`,h,{mode:f.mode}),o.insert({filepath:f.path,oid:f.oid,stage:0})}}})}catch(s){throw s.caller="git.abortMerge",s}}u(JT,"abortMerge");var yg=class yg{static async isIgnored({fs:e,dir:r,gitdir:i=C(r,".git"),filepath:n}){if(Zu(n)===".git")return!0;if(n===".")return!1;let s="",a=C(i,"info","exclude");await e.exists(a)&&(s=await e.read(a,"utf8"));let l=[{gitignore:C(r,".gitignore"),filepath:n}],c=n.split("/").filter(Boolean);for(let f=1;f<c.length;f++){let h=c.slice(0,f).join("/"),d=c.slice(f).join("/");l.push({gitignore:C(r,h,".gitignore"),filepath:d})}let o=!1;for(let f of l){let h;try{h=await e.read(f.gitignore,"utf8")}catch(m){if(m.code==="NOENT")continue}let d=P6().add(s);d.add(h);let p=Pa(f.filepath);if(p!=="."&&d.ignores(p))return!0;o?o=!d.test(f.filepath).unignored:o=d.test(f.filepath).ignored}return o}};u(yg,"GitIgnoreManager");var Mi=yg;async function Oq({fs:t,gitdir:e,object:r,format:i,oid:n}){if(i!=="deflated")throw new H("GitObjectStoreLoose expects objects to write to be in deflated format");let s=`objects/${n.slice(0,2)}/${n.slice(2)}`,a=`${e}/${s}`;await t.exists(a)||await t.write(a,r)}u(Oq,"writeObjectLoose");var $y=null;async function YT(t){return $y===null&&($y=Aq()),$y?Rq(t):eg.deflate(t)}u(YT,"deflate");async function Rq(t){let e=new CompressionStream("deflate"),r=new Blob([t]).stream().pipeThrough(e);return new Uint8Array(await new Response(r).arrayBuffer())}u(Rq,"browserDeflate");function Aq(){try{return new CompressionStream("deflate").writable.close(),new Blob([]).stream().cancel(),!0}catch{return!1}}u(Aq,"testCompressionStream");async function Pt({fs:t,gitdir:e,type:r,object:i,format:n="content",oid:s=void 0,dryRun:a=!1}){return n!=="deflated"&&(n!=="wrapped"&&(i=$i.wrap({type:r,object:i})),s=await si(i),i=Buffer.from(await YT(i))),a||await Oq({fs:t,gitdir:e,object:i,format:"deflated",oid:s}),s}u(Pt,"_writeObject");function XT(t){let e;for(;~(e=t.indexOf(92));)t[e]=47;return t}u(XT,"posixifyPathBuffer");async function QT({fs:t,dir:e,gitdir:r=C(e,".git"),filepath:i,cache:n={},force:s=!1,parallel:a=!0}){try{O("fs",t),O("dir",e),O("gitdir",r),O("filepath",i);let l=new M(t);await Pe.acquire({fs:l,gitdir:r,cache:n},async c=>{let f=await(await Oe.get({fs:l,gitdir:r})).get("core.autocrlf");return Xy({dir:e,gitdir:r,fs:l,filepath:i,index:c,force:s,parallel:a,autocrlf:f})})}catch(l){throw l.caller="git.add",l}}u(QT,"add");async function Xy({dir:t,gitdir:e,fs:r,filepath:i,index:n,force:s,parallel:a,autocrlf:l}){i=Array.isArray(i)?i:[i];let c=i.map(async d=>{if(!s&&await Mi.isIgnored({fs:r,dir:t,gitdir:e,filepath:d}))return;let p=await r.lstat(C(t,d));if(!p)throw new pe(d);if(p.isDirectory()){let m=await r.readdir(C(t,d));if(a){let w=m.map(g=>Xy({dir:t,gitdir:e,fs:r,filepath:[C(d,g)],index:n,force:s,parallel:a,autocrlf:l}));await Promise.all(w)}else for(let w of m)await Xy({dir:t,gitdir:e,fs:r,filepath:[C(d,w)],index:n,force:s,parallel:a,autocrlf:l})}else{let m=p.isSymbolicLink()?await r.readlink(C(t,d)).then(XT):await r.read(C(t,d),{autocrlf:l});if(m===null)throw new pe(d);let w=await Pt({fs:r,gitdir:e,type:"blob",object:m});n.insert({filepath:d,stats:p,oid:w})}}),o=await Promise.allSettled(c),f=o.filter(d=>d.status==="rejected").map(d=>d.reason);if(f.length>1)throw new Yl(f);if(f.length===1)throw f[0];return o.filter(d=>d.status==="fulfilled"&&d.value).map(d=>d.value)}u(Xy,"addToIndex");async function ic({fs:t,gitdir:e,path:r}){return(await Oe.get({fs:t,gitdir:e})).get(r)}u(ic,"_getConfig");function ex(t,...e){for(let r of e)if(r)for(let i of Object.keys(r)){let n=r[i];n!==void 0&&(t[i]=n)}return t}u(ex,"assignDefined");async function ji({fs:t,gitdir:e,author:r,commit:i}){let n=Math.floor(Date.now()/1e3),s={name:await ic({fs:t,gitdir:e,path:"user.name"}),email:await ic({fs:t,gitdir:e,path:"user.email"})||"",timestamp:n,timezoneOffset:new Date(n*1e3).getTimezoneOffset()},a=ex({},s,i?i.author:void 0,r);if(a.name!==void 0)return a}u(ji,"normalizeAuthorObject");async function La({fs:t,gitdir:e,author:r,committer:i,commit:n}){let s=Math.floor(Date.now()/1e3),a={name:await ic({fs:t,gitdir:e,path:"user.name"}),email:await ic({fs:t,gitdir:e,path:"user.email"})||"",timestamp:s,timezoneOffset:new Date(s*1e3).getTimezoneOffset()},l=ex({},a,n?n.committer:void 0,r,i);if(l.name!==void 0)return l}u(La,"normalizeCommitterObject");async function tx({fs:t,cache:e,gitdir:r,oid:i}){let{type:n,object:s}=await ge({fs:t,cache:e,gitdir:r,oid:i});if(n==="tag")return i=qt.from(s).parse().object,tx({fs:t,cache:e,gitdir:r,oid:i});if(n!=="commit")throw new _t(i,n,"commit");return{commit:At.from(s),oid:i}}u(tx,"resolveCommit");async function Ma({fs:t,cache:e,gitdir:r,oid:i}){let{commit:n,oid:s}=await tx({fs:t,cache:e,gitdir:r,oid:i});return{oid:s,commit:n.parse(),payload:n.withoutSignature()}}u(Ma,"_readCommit");async function Wh({fs:t,cache:e,onSign:r,gitdir:i,message:n,author:s,committer:a,signingKey:l,amend:c=!1,dryRun:o=!1,noUpdateBranch:f=!1,ref:h,parent:d,tree:p}){let m=!1;h||(h=await $.resolve({fs:t,gitdir:i,ref:"HEAD",depth:2}));let w,g;try{w=await $.resolve({fs:t,gitdir:i,ref:h}),g=await Ma({fs:t,gitdir:i,oid:w,cache:{}})}catch{m=!0}if(c&&m)throw new rc(h);let b=c?await ji({fs:t,gitdir:i,author:s,commit:g.commit}):await ji({fs:t,gitdir:i,author:s});if(!b)throw new ft("author");let _=c?await La({fs:t,gitdir:i,author:b,committer:a,commit:g.commit}):await La({fs:t,gitdir:i,author:b,committer:a});if(!_)throw new ft("committer");return Pe.acquire({fs:t,gitdir:i,cache:e,allowUnmerged:!1},async function(S){let k=zT(S.entries).get(".");if(p||(p=await rx({fs:t,gitdir:i,inode:k,dryRun:o})),d?d=await Promise.all(d.map(T=>$.resolve({fs:t,gitdir:i,ref:T}))):c?d=g.commit.parent:d=w?[w]:[],!n)if(c)n=g.commit.message;else throw new Ot("message");let A=At.from({tree:p,parent:d,author:b,committer:_,message:n});l&&(A=await At.sign(A,r,l));let v=await Pt({fs:t,gitdir:i,type:"commit",object:A.toObject(),dryRun:o});return!f&&!o&&await $.writeRef({fs:t,gitdir:i,ref:h,value:v}),v})}u(Wh,"_commit");async function rx({fs:t,gitdir:e,inode:r,dryRun:i}){let n=r.children;for(let c of n)c.type==="tree"&&(c.metadata.mode="040000",c.metadata.oid=await rx({fs:t,gitdir:e,inode:c,dryRun:i}));let s=n.map(c=>({mode:c.metadata.mode,path:c.basename,oid:c.metadata.oid,type:c.type})),a=Rt.from(s);return await Pt({fs:t,gitdir:e,type:"tree",object:a.toObject(),dryRun:i})}u(rx,"constructTree");async function sc({fs:t,cache:e,gitdir:r,oid:i,filepath:n}){if(n.startsWith("/"))throw new Bi("leading-slash");if(n.endsWith("/"))throw new Bi("trailing-slash");let s=i,a=await Ba({fs:t,cache:e,gitdir:r,oid:i}),l=a.tree;if(n==="")i=a.oid;else{let c=n.split("/");i=await ix({fs:t,cache:e,gitdir:r,tree:l,pathArray:c,oid:s,filepath:n})}return i}u(sc,"resolveFilepath");async function ix({fs:t,cache:e,gitdir:r,tree:i,pathArray:n,oid:s,filepath:a}){let l=n.shift();for(let c of i)if(c.path===l){if(n.length===0)return c.oid;{let{type:o,object:f}=await ge({fs:t,cache:e,gitdir:r,oid:c.oid});if(o!=="tree")throw new _t(s,o,"tree",a);return i=Rt.from(f),ix({fs:t,cache:e,gitdir:r,tree:i,pathArray:n,oid:s,filepath:a})}}throw new pe(`file or directory found at "${s}:${a}"`)}u(ix,"_resolveFilepath");async function Wa({fs:t,cache:e,gitdir:r,oid:i,filepath:n=void 0}){n!==void 0&&(i=await sc({fs:t,cache:e,gitdir:r,oid:i,filepath:n}));let{tree:s,oid:a}=await Ba({fs:t,cache:e,gitdir:r,oid:i});return{oid:a,tree:s.entries()}}u(Wa,"_readTree");async function ac({fs:t,gitdir:e,tree:r}){let i=Rt.from(r).toObject();return await Pt({fs:t,gitdir:e,type:"tree",object:i,format:"content"})}u(ac,"_writeTree");async function Pq({fs:t,cache:e,onSign:r,gitdir:i,ref:n,oid:s,note:a,force:l,author:c,committer:o,signingKey:f}){let h;try{h=await $.resolve({gitdir:i,fs:t,ref:n})}catch(b){if(!(b instanceof pe))throw b}let p=(await Wa({fs:t,cache:e,gitdir:i,oid:h||"4b825dc642cb6eb9a060e54bf8d69288fbee4904"})).tree;if(l)p=p.filter(b=>b.path!==s);else for(let b of p)if(b.path===s)throw new dr("note",s);typeof a=="string"&&(a=Buffer.from(a,"utf8"));let m=await Pt({fs:t,gitdir:i,type:"blob",object:a,format:"content"});p.push({mode:"100644",path:s,oid:m,type:"blob"});let w=await ac({fs:t,gitdir:i,tree:p});return await Wh({fs:t,cache:e,onSign:r,gitdir:i,ref:n,tree:w,parent:h&&[h],message:`Note added by 'isomorphic-git addNote'
|
|
70
|
+
`,author:c,committer:o,signingKey:f})}u(Pq,"_addNote");async function nx({fs:t,onSign:e,dir:r,gitdir:i=C(r,".git"),ref:n="refs/notes/commits",oid:s,note:a,force:l,author:c,committer:o,signingKey:f,cache:h={}}){try{O("fs",t),O("gitdir",i),O("oid",s),O("note",a),f&&O("onSign",e);let d=new M(t),p=await ji({fs:d,gitdir:i,author:c});if(!p)throw new ft("author");let m=await La({fs:d,gitdir:i,author:p,committer:o});if(!m)throw new ft("committer");return await Pq({fs:new M(d),cache:h,onSign:e,gitdir:i,ref:n,oid:s,note:a,force:l,author:p,committer:m,signingKey:f})}catch(d){throw d.caller="git.addNote",d}}u(nx,"addNote");var Nq=/(^|[/.])([/.]|$)|^@$|@{|[\x00-\x20\x7f~^:?*[\\]|\.lock(\/|$)/;function nc(t,e){if(typeof t!="string")throw new TypeError("Reference name must be a string");return!Nq.test(t)&&(!!e||t.includes("/"))}u(nc,"isValidRef");async function sx({fs:t,gitdir:e,remote:r,url:i,force:n}){if(!nc(r,!0))throw new pr(r,jl.clean(r));let s=await Oe.get({fs:t,gitdir:e});if(!n&&(await s.getSubsections("remote")).includes(r)&&i!==await s.get(`remote.${r}.url`))throw new dr("remote",r);await s.set(`remote.${r}.url`,i),await s.set(`remote.${r}.fetch`,`+refs/heads/*:refs/remotes/${r}/*`),await Oe.save({fs:t,gitdir:e,config:s})}u(sx,"_addRemote");async function ax({fs:t,dir:e,gitdir:r=C(e,".git"),remote:i,url:n,force:s=!1}){try{return O("fs",t),O("gitdir",r),O("remote",i),O("url",n),await sx({fs:new M(t),gitdir:r,remote:i,url:n,force:s})}catch(a){throw a.caller="git.addRemote",a}}u(ax,"addRemote");async function Dq({fs:t,cache:e,onSign:r,gitdir:i,ref:n,tagger:s,message:a=n,gpgsig:l,object:c,signingKey:o,force:f=!1}){if(n=n.startsWith("refs/tags/")?n:`refs/tags/${n}`,!f&&await $.exists({fs:t,gitdir:i,ref:n}))throw new dr("tag",n);let h=await $.resolve({fs:t,gitdir:i,ref:c||"HEAD"}),{type:d}=await ge({fs:t,cache:e,gitdir:i,oid:h}),p=qt.from({object:h,type:d,tag:n.replace("refs/tags/",""),tagger:s,message:a,gpgsig:l});o&&(p=await qt.sign(p,r,o));let m=await Pt({fs:t,gitdir:i,type:"tag",object:p.toObject()});await $.writeRef({fs:t,gitdir:i,ref:n,value:m})}u(Dq,"_annotatedTag");async function ox({fs:t,onSign:e,dir:r,gitdir:i=C(r,".git"),ref:n,tagger:s,message:a=n,gpgsig:l,object:c,signingKey:o,force:f=!1,cache:h={}}){try{O("fs",t),O("gitdir",i),O("ref",n),o&&O("onSign",e);let d=new M(t),p=await ji({fs:d,gitdir:i,author:s});if(!p)throw new ft("tagger");return await Dq({fs:d,cache:h,onSign:e,gitdir:i,ref:n,tagger:p,message:a,gpgsig:l,object:c,signingKey:o,force:f})}catch(d){throw d.caller="git.annotatedTag",d}}u(ox,"annotatedTag");async function Cq({fs:t,gitdir:e,ref:r,object:i,checkout:n=!1,force:s=!1}){if(!nc(r,!0))throw new pr(r,jl.clean(r));let a=`refs/heads/${r}`;if(!s&&await $.exists({fs:t,gitdir:e,ref:a}))throw new dr("branch",r,!1);let l;try{l=await $.resolve({fs:t,gitdir:e,ref:i||"HEAD"})}catch{}l&&await $.writeRef({fs:t,gitdir:e,ref:a,value:l}),n&&await $.writeSymbolicRef({fs:t,gitdir:e,ref:"HEAD",value:a})}u(Cq,"_branch");async function lx({fs:t,dir:e,gitdir:r=C(e,".git"),ref:i,object:n,checkout:s=!1,force:a=!1}){try{return O("fs",t),O("gitdir",r),O("ref",i),await Cq({fs:new M(t),gitdir:r,ref:i,object:n,checkout:s,force:a})}catch(l){throw l.caller="git.branch",l}}u(lx,"branch");var cx=u((t,e)=>t==="."||e==null||e.length===0||e==="."?!0:e.length>=t.length?e.startsWith(t):t.startsWith(e),"worthWalking");async function rg({fs:t,cache:e,onProgress:r,onPostCheckout:i,dir:n,gitdir:s,remote:a,ref:l,filepaths:c,noCheckout:o,noUpdateHead:f,dryRun:h,force:d,track:p=!0,nonBlocking:m=!1,batchSize:w=100}){let g;if(i)try{g=await $.resolve({fs:t,gitdir:s,ref:"HEAD"})}catch{g="0000000000000000000000000000000000000000"}let b;try{b=await $.resolve({fs:t,gitdir:s,ref:l})}catch(_){if(l==="HEAD")throw _;let S=`${a}/${l}`;if(b=await $.resolve({fs:t,gitdir:s,ref:S}),p){let F=await Oe.get({fs:t,gitdir:s});await F.set(`branch.${l}.remote`,a),await F.set(`branch.${l}.merge`,`refs/heads/${l}`),await Oe.save({fs:t,gitdir:s,config:F})}await $.writeRef({fs:t,gitdir:s,ref:`refs/heads/${l}`,value:b})}if(!o){let _;try{_=await Iq({fs:t,cache:e,onProgress:r,dir:n,gitdir:s,ref:l,force:d,filepaths:c})}catch(v){throw v instanceof pe&&v.data.what===b?new Vl(l,b):v}let S=_.filter(([v])=>v==="conflict").map(([v,T])=>T);if(S.length>0)throw new Hl(S);let F=_.filter(([v])=>v==="error").map(([v,T])=>T);if(F.length>0)throw new H(F.join(", "));if(h){i&&await i({previousHead:g,newHead:b,type:c!=null&&c.length>0?"file":"branch"});return}let k=0,A=_.length;if(await Pe.acquire({fs:t,gitdir:s,cache:e},async function(v){await Promise.all(_.filter(([T])=>T==="delete"||T==="delete-index").map(async function([T,E]){let R=`${n}/${E}`;T==="delete"&&await t.rm(R),v.delete({filepath:E}),r&&await r({phase:"Updating workdir",loaded:++k,total:A})}))}),await Pe.acquire({fs:t,gitdir:s,cache:e},async function(v){for(let[T,E]of _)if(T==="rmdir"||T==="rmdir-index"){let R=`${n}/${E}`;try{T==="rmdir"&&await t.rmdir(R),v.delete({filepath:E}),r&&await r({phase:"Updating workdir",loaded:++k,total:A})}catch(P){if(P.code==="ENOTEMPTY")console.log(`Did not delete ${E} because directory is not empty`);else throw P}}}),await Promise.all(_.filter(([v])=>v==="mkdir"||v==="mkdir-index").map(async function([v,T]){let E=`${n}/${T}`;await t.mkdir(E),r&&await r({phase:"Updating workdir",loaded:++k,total:A})})),m){let v=_.filter(([E])=>E==="create"||E==="create-index"||E==="update"||E==="mkdir-index"),T=await AT("Update Working Dir",v.map(([E,R,P,I,B])=>()=>Bq({fs:t,cache:e,gitdir:s,dir:n},[E,R,P,I,B])),r,w);await Pe.acquire({fs:t,gitdir:s,cache:e,allowUnmerged:!0},async function(E){await AT("Update Index",T.map(([R,P,I])=>()=>$q({index:E,fullpath:R,oid:P,stats:I})),r,w)})}else await Pe.acquire({fs:t,gitdir:s,cache:e,allowUnmerged:!0},async function(v){await Promise.all(_.filter(([T])=>T==="create"||T==="create-index"||T==="update"||T==="mkdir-index").map(async function([T,E,R,P,I]){let B=`${n}/${E}`;try{if(T!=="create-index"&&T!=="mkdir-index"){let{object:we}=await ge({fs:t,cache:e,gitdir:s,oid:R});if(I&&await t.rm(B),P===33188)await t.write(B,we);else if(P===33261)await t.write(B,we,{mode:511});else if(P===40960)await t.writelink(B,we);else throw new H(`Invalid mode 0o${P.toString(8)} detected in blob ${R}`)}let z=await t.lstat(B);P===33261&&(z.mode=493),T==="mkdir-index"&&(z.mode=57344),v.insert({filepath:E,stats:z,oid:R}),r&&await r({phase:"Updating workdir",loaded:++k,total:A})}catch(z){console.log(z)}}))});i&&await i({previousHead:g,newHead:b,type:c!=null&&c.length>0?"file":"branch"})}if(!f){let _=await $.expand({fs:t,gitdir:s,ref:l});_.startsWith("refs/heads")?await $.writeSymbolicRef({fs:t,gitdir:s,ref:"HEAD",value:_}):await $.writeRef({fs:t,gitdir:s,ref:"HEAD",value:b})}}u(rg,"_checkout");async function Iq({fs:t,cache:e,onProgress:r,dir:i,gitdir:n,ref:s,force:a,filepaths:l}){let c=0;return Li({fs:t,cache:e,dir:i,gitdir:n,trees:[jt({ref:s}),za(),Cn()],map:u(async function(o,[f,h,d]){if(o===".")return;if(l&&!l.some(m=>cx(o,m)))return null;switch(r&&await r({phase:"Analyzing workdir",loaded:++c}),[!!d,!!f,!!h].map(Number).join("")){case"000":return;case"001":return a&&l&&l.includes(o)?["delete",o]:void 0;case"010":switch(await f.type()){case"tree":return["mkdir",o];case"blob":return["create",o,await f.oid(),await f.mode()];case"commit":return["mkdir-index",o,await f.oid(),await f.mode()];default:return["error",`new entry Unhandled type ${await f.type()}`]}case"011":switch(`${await f.type()}-${await h.type()}`){case"tree-tree":return;case"tree-blob":case"blob-tree":return["conflict",o];case"blob-blob":return await f.oid()!==await h.oid()?a?["update",o,await f.oid(),await f.mode(),await f.mode()!==await h.mode()]:["conflict",o]:await f.mode()!==await h.mode()?a?["update",o,await f.oid(),await f.mode(),!0]:["conflict",o]:["create-index",o,await f.oid(),await f.mode()];case"commit-tree":return;case"commit-blob":return["conflict",o];default:return["error",`new entry Unhandled type ${f.type}`]}case"100":return["delete-index",o];case"101":switch(await d.type()){case"tree":return["rmdir-index",o];case"blob":return await d.oid()!==await h.oid()?a?["delete",o]:["conflict",o]:["delete",o];case"commit":return["rmdir-index",o];default:return["error",`delete entry Unhandled type ${await d.type()}`]}case"110":case"111":switch(`${await d.type()}-${await f.type()}`){case"tree-tree":return;case"blob-blob":{if(await d.oid()===await f.oid()&&await d.mode()===await f.mode()&&!a)return;if(h){if(await h.oid()!==await d.oid()&&await h.oid()!==await f.oid())return a?["update",o,await f.oid(),await f.mode(),await f.mode()!==await h.mode()]:["conflict",o]}else if(a)return["update",o,await f.oid(),await f.mode(),await f.mode()!==await d.mode()];return await f.mode()!==await d.mode()?["update",o,await f.oid(),await f.mode(),!0]:await f.oid()!==await d.oid()?["update",o,await f.oid(),await f.mode(),!1]:void 0}case"tree-blob":return["update-dir-to-blob",o,await f.oid()];case"blob-tree":return["update-blob-to-tree",o];case"commit-commit":return["mkdir-index",o,await f.oid(),await f.mode()];default:return["error",`update entry Unhandled type ${await d.type()}-${await f.type()}`]}}},"map"),reduce:u(async function(o,f){return f=KT(f),o?o&&o[0]==="rmdir"?(f.push(o),f):(f.unshift(o),f):f},"reduce")})}u(Iq,"analyze");async function $q({index:t,fullpath:e,stats:r,oid:i}){try{t.insert({filepath:e,stats:r,oid:i})}catch(n){console.warn(`Error inserting ${e} into index:`,n)}}u($q,"updateIndex");async function Bq({fs:t,cache:e,gitdir:r,dir:i},[n,s,a,l,c]){let o=`${i}/${s}`;if(n!=="create-index"&&n!=="mkdir-index"){let{object:h}=await ge({fs:t,cache:e,gitdir:r,oid:a});if(c&&await t.rm(o),l===33188)await t.write(o,h);else if(l===33261)await t.write(o,h,{mode:511});else if(l===40960)await t.writelink(o,h);else throw new H(`Invalid mode 0o${l.toString(8)} detected in blob ${a}`)}let f=await t.lstat(o);return l===33261&&(f.mode=493),n==="mkdir-index"&&(f.mode=57344),[s,a,f]}u(Bq,"updateWorkingDir");async function AT(t,e,r,i){let n=[];try{for(let s=0;s<e.length;s+=i){let a=e.slice(s,s+i).map(c=>c());(await Promise.allSettled(a)).forEach(c=>{c.status==="fulfilled"&&n.push(c.value)}),r&&await r({phase:"Updating workdir",loaded:s+a.length,total:e.length})}return n}catch(s){console.error(`Error during ${t}: ${s}`)}return n}u(AT,"batchAllSettled");async function ig({fs:t,onProgress:e,onPostCheckout:r,dir:i,gitdir:n=C(i,".git"),remote:s="origin",ref:a,filepaths:l,noCheckout:c=!1,noUpdateHead:o=a===void 0,dryRun:f=!1,force:h=!1,track:d=!0,cache:p={},nonBlocking:m=!1,batchSize:w=100}){try{O("fs",t),O("dir",i),O("gitdir",n);let g=a||"HEAD";return await rg({fs:new M(t),cache:p,onProgress:e,onPostCheckout:r,dir:i,gitdir:n,remote:s,ref:g,filepaths:l,noCheckout:c,noUpdateHead:o,dryRun:f,force:h,track:d,nonBlocking:m,batchSize:w})}catch(g){throw g.caller="git.checkout",g}}u(ig,"checkout");var Lq=/^refs\/(heads\/|tags\/|remotes\/)?(.*)/;function An(t){let e=Lq.exec(t);return e?e[1]==="remotes/"&&t.endsWith("/HEAD")?e[2].slice(0,-5):e[2]:t}u(An,"abbreviateRef");async function Ui({fs:t,gitdir:e,fullname:r=!1,test:i=!1}){let n=await $.resolve({fs:t,gitdir:e,ref:"HEAD",depth:2});if(i)try{await $.resolve({fs:t,gitdir:e,ref:n})}catch{return}if(n.startsWith("refs/"))return r?n:An(n)}u(Ui,"_currentBranch");function Mq(t){return t=t.replace(/^git@([^:]+):/,"https://$1/"),t=t.replace(/^ssh:\/\//,"https://"),t}u(Mq,"translateSSHtoHTTP");function fx({username:t="",password:e=""}){return`Basic ${Buffer.from(`${t}:${e}`).toString("base64")}`}u(fx,"calculateBasicAuthHeader");async function oc(t,e){let r=VT(t);for(;;){let{value:i,done:n}=await r.next();if(i&&await e(i),n)break}r.return&&r.return()}u(oc,"forAwait");async function eh(t){let e=0,r=[];await oc(t,s=>{r.push(s),e+=s.byteLength});let i=new Uint8Array(e),n=0;for(let s of r)i.set(s,n),n+=s.byteLength;return i}u(eh,"collect");function PT(t){let e=t.match(/^https?:\/\/([^/]+)@/);if(e==null)return{url:t,auth:{}};e=e[1];let[r,i]=e.split(":");return t=t.replace(`${e}@`,""),{url:t,auth:{username:r,password:i}}}u(PT,"extractAuthFromUrl");function Qy(t,e){let r=e.toString(16);return"0".repeat(t-r.length)+r}u(Qy,"padHex");var gg=class gg{static flush(){return Buffer.from("0000","utf8")}static delim(){return Buffer.from("0001","utf8")}static encode(e){typeof e=="string"&&(e=Buffer.from(e));let r=e.length+4,i=Qy(4,r);return Buffer.concat([Buffer.from(i,"utf8"),e])}static streamReader(e){let r=new Yu(e);return u(async function(){try{let n=await r.read(4);if(n==null)return!0;if(n=parseInt(n.toString("utf8"),16),n===0||n===1)return null;let s=await r.read(n-4);return s??!0}catch(n){return e.error=n,!0}},"read")}};u(gg,"GitPktLine");var Te=gg;async function NT(t){let e={},r;for(;r=await t(),r!==!0;){if(r===null)continue;r=r.toString("utf8").replace(/\n$/,"");let i=r.indexOf("=");if(i>-1){let n=r.slice(0,i),s=r.slice(i+1);e[n]=s}else e[r]=!0}return{protocolVersion:2,capabilities2:e}}u(NT,"parseCapabilitiesV2");async function DT(t,{service:e}){let r=new Set,i=new Map,n=new Map,s=Te.streamReader(t),a=await s();for(;a===null;)a=await s();if(a===!0)throw new Gl;if(a.includes("version 2"))return NT(s);if(a.toString("utf8").replace(/\n$/,"")!==`# service=${e}`)throw new Pn(`# service=${e}\\n`,a.toString("utf8"));let l=await s();for(;l===null;)l=await s();if(l===!0)return{capabilities:r,refs:i,symrefs:n};if(l=l.toString("utf8"),l.includes("version 2"))return NT(s);let[c,o]=By(l,"\0","\\x00");if(o.split(" ").map(f=>r.add(f)),c!=="0000000000000000000000000000000000000000 capabilities^{}"){let[f,h]=By(c," "," ");for(i.set(h,f);;){let d=await s();if(d===!0)break;if(d!==null){let[p,m]=By(d.toString("utf8")," "," ");i.set(m,p)}}}for(let f of r)if(f.startsWith("symref=")){let h=f.match(/symref=([^:]+):(.*)/);h.length===3&&n.set(h[1],h[2])}return{protocolVersion:1,capabilities:r,refs:i,symrefs:n}}u(DT,"parseRefsAdResponse");function By(t,e,r){let i=t.trim().split(e);if(i.length!==2)throw new Pn(`Two strings separated by '${r}'`,t.toString("utf8"));return i}u(By,"splitAndAssert");var CT=u((t,e)=>t.endsWith("?")?`${t}${e}`:`${t}/${e.replace(/^https?:\/\//,"")}`,"corsProxify"),IT=u((t,e)=>{(e.username||e.password)&&(t.Authorization=fx(e)),e.headers&&Object.assign(t,e.headers)},"updateHeaders"),Ly=u(async t=>{try{let e=Buffer.from(await eh(t.body)),r=e.toString("utf8");return{preview:r.length<256?r:r.slice(0,256)+"...",response:r,data:e}}catch{return{}}},"stringifyBody"),bg=class bg{static async capabilities(){return["discover","connect"]}static async discover({http:e,onProgress:r,onAuth:i,onAuthSuccess:n,onAuthFailure:s,corsProxy:a,service:l,url:c,headers:o,protocolVersion:f}){let{url:h,auth:d}=PT(c),p=a?CT(a,h):h;(d.username||d.password)&&(o.Authorization=fx(d)),f===2&&(o["Git-Protocol"]="version=2");let m,w,g=!1;do if(m=await e.request({onProgress:r,method:"GET",url:`${p}/info/refs?service=${l}`,headers:o}),w=!1,m.statusCode===401||m.statusCode===203){let b=g?s:i;if(b){if(d=await b(h,{...d,headers:{...o}}),d&&d.cancel)throw new $a;d&&(IT(o,d),g=!0,w=!0)}}else m.statusCode===200&&g&&n&&await n(h,d);while(w);if(m.statusCode!==200){let{response:b}=await Ly(m);throw new Na(m.statusCode,m.statusMessage,b)}if(m.headers["content-type"]===`application/x-${l}-advertisement`){let b=await DT(m.body,{service:l});return b.auth=d,b}else{let{preview:b,response:_,data:S}=await Ly(m);try{let F=await DT([S],{service:l});return F.auth=d,F}catch{throw new Xl(b,_)}}}static async connect({http:e,onProgress:r,corsProxy:i,service:n,url:s,auth:a,body:l,headers:c}){let o=PT(s);o&&(s=o.url),i&&(s=CT(i,s)),c["content-type"]=`application/x-${n}-request`,c.accept=`application/x-${n}-result`,IT(c,a);let f=await e.request({onProgress:r,method:"POST",url:`${s}/${n}`,body:l,headers:c});if(f.statusCode!==200){let{response:h}=Ly(f);throw new Na(f.statusCode,f.statusMessage,h)}return f}};u(bg,"GitRemoteHTTP");var ja=bg,_g=class _g{static getRemoteHelperFor({url:e}){let r=new Map;r.set("http",ja),r.set("https",ja);let i=jq({url:e});if(!i)throw new ec(e);if(r.has(i.transport))return r.get(i.transport);throw new Ql(e,i.transport,i.transport==="ssh"?Mq(e):void 0)}};u(_g,"GitRemoteManager");var qa=_g;function jq({url:t}){if(t.startsWith("git@"))return{transport:"ssh",address:t};let e=t.match(/(\w+)(:\/\/|::)(.*)/);if(e!==null){if(e[2]==="://")return{transport:e[1],address:e[0]};if(e[2]==="::")return{transport:e[1],address:e[3]}}}u(jq,"parseRemoteUrl");var Rn=null,vg=class vg{static async read({fs:e,gitdir:r}){Rn===null&&(Rn=new Ml);let i=C(r,"shallow"),n=new Set;return await Rn.acquire(i,async function(){let s=await e.read(i,{encoding:"utf8"});if(s===null||s.trim()==="")return n;s.trim().split(`
|
|
71
|
+
`).map(a=>n.add(a))}),n}static async write({fs:e,gitdir:r,oids:i}){Rn===null&&(Rn=new Ml);let n=C(r,"shallow");if(i.size>0){let s=[...i].join(`
|
|
72
72
|
`)+`
|
|
73
|
-
`;await
|
|
74
|
-
`);return e===-1&&r===-1?-1:e===-1?r+1:r===-1?e+1:r===e+1?r+1:Math.min(e,r)+1}
|
|
75
|
-
`)),c="";for(let
|
|
76
|
-
`));n!==null&&
|
|
77
|
-
`)),s!==null&&
|
|
78
|
-
`));for(let
|
|
79
|
-
`));
|
|
80
|
-
`));return
|
|
81
|
-
`)),
|
|
73
|
+
`;await Rn.acquire(n,async function(){await e.write(n,s,{encoding:"utf8"})})}else await Rn.acquire(n,async function(){await e.rm(n)})}};u(vg,"GitShallowManager");var Nn=vg;async function qq({fs:t,gitdir:e,oid:r}){let i=`objects/${r.slice(0,2)}/${r.slice(2)}`;return t.exists(`${e}/${i}`)}u(qq,"hasObjectLoose");async function Uq({fs:t,cache:e,gitdir:r,oid:i,getExternalRefDelta:n}){let s=await t.readdir(C(r,"objects/pack"));s=s.filter(a=>a.endsWith(".idx"));for(let a of s){let l=`${r}/objects/pack/${a}`,c=await tg({fs:t,cache:e,filename:l,getExternalRefDelta:n});if(c.error)throw new H(c.error);if(c.offsets.has(i))return!0}return!1}u(Uq,"hasObjectPacked");async function $T({fs:t,cache:e,gitdir:r,oid:i,format:n="content"}){let s=u(l=>ge({fs:t,cache:e,gitdir:r,oid:l}),"getExternalRefDelta"),a=await qq({fs:t,gitdir:r,oid:i});return a||(a=await Uq({fs:t,cache:e,gitdir:r,oid:i,getExternalRefDelta:s})),a}u($T,"hasObject");function zq(t){let n="5041434b"+"00000002"+"00000000";return t.slice(0,12).toString("hex")===n}u(zq,"emptyPackfile");function ux(t,e){let r=t.map(i=>i.split("=",1)[0]);return e.filter(i=>{let n=i.split("=",1)[0];return r.includes(n)})}u(ux,"filterCapabilities");var Hh={name:"isomorphic-git",version:"1.34.1",agent:"git/isomorphic-git@1.34.1"},Sg=class Sg{constructor(){this._queue=[]}write(e){if(this._ended)throw Error("You cannot write to a FIFO that has already been ended!");if(this._waiting){let r=this._waiting;this._waiting=null,r({value:e})}else this._queue.push(e)}end(){if(this._ended=!0,this._waiting){let e=this._waiting;this._waiting=null,e({done:!0})}}destroy(e){this.error=e,this.end()}async next(){if(this._queue.length>0)return{value:this._queue.shift()};if(this._ended)return{done:!0};if(this._waiting)throw Error("You cannot call read until the previous call to read has returned!");return new Promise(e=>{this._waiting=e})}};u(Sg,"FIFO");var Oa=Sg;function Wq(t){let e=t.indexOf("\r"),r=t.indexOf(`
|
|
74
|
+
`);return e===-1&&r===-1?-1:e===-1?r+1:r===-1?e+1:r===e+1?r+1:Math.min(e,r)+1}u(Wq,"findSplit");function hx(t){let e=new Oa,r="";return(async()=>(await oc(t,i=>{for(i=i.toString("utf8"),r+=i;;){let n=Wq(r);if(n===-1)break;e.write(r.slice(0,n)),r=r.slice(n)}}),r.length>0&&e.write(r),e.end()))(),e}u(hx,"splitLines");var Eg=class Eg{static demux(e){let r=Te.streamReader(e),i=new Oa,n=new Oa,s=new Oa,a=u(async function(){let l=await r();if(l===null)return a();if(l===!0){i.end(),s.end(),e.error?n.destroy(e.error):n.end();return}switch(l[0]){case 1:{n.write(l.slice(1));break}case 2:{s.write(l.slice(1));break}case 3:{let c=l.slice(1);s.write(c),i.end(),s.end(),n.destroy(new Error(c.toString("utf8")));return}default:i.write(l)}a()},"nextBit");return a(),{packetlines:i,packfile:n,progress:s}}};u(Eg,"GitSideBand");var th=Eg;async function Hq(t){let{packetlines:e,packfile:r,progress:i}=th.demux(t),n=[],s=[],a=[],l=!1,c=!1;return new Promise((o,f)=>{oc(e,h=>{let d=h.toString("utf8").trim();if(d.startsWith("shallow")){let p=d.slice(-41).trim();p.length!==40&&f(new Ii(p)),n.push(p)}else if(d.startsWith("unshallow")){let p=d.slice(-41).trim();p.length!==40&&f(new Ii(p)),s.push(p)}else if(d.startsWith("ACK")){let[,p,m]=d.split(" ");a.push({oid:p,status:m}),m||(c=!0)}else d.startsWith("NAK")?(l=!0,c=!0):(c=!0,l=!0);c&&(t.error?f(t.error):o({shallows:n,unshallows:s,acks:a,nak:l,packfile:r,progress:i}))}).finally(()=>{c||(t.error?f(t.error):o({shallows:n,unshallows:s,acks:a,nak:l,packfile:r,progress:i}))})})}u(Hq,"parseUploadPackResponse");function Vq({capabilities:t=[],wants:e=[],haves:r=[],shallows:i=[],depth:n=null,since:s=null,exclude:a=[]}){let l=[];e=[...new Set(e)];let c=` ${t.join(" ")}`;for(let o of e)l.push(Te.encode(`want ${o}${c}
|
|
75
|
+
`)),c="";for(let o of i)l.push(Te.encode(`shallow ${o}
|
|
76
|
+
`));n!==null&&l.push(Te.encode(`deepen ${n}
|
|
77
|
+
`)),s!==null&&l.push(Te.encode(`deepen-since ${Math.floor(s.valueOf()/1e3)}
|
|
78
|
+
`));for(let o of a)l.push(Te.encode(`deepen-not ${o}
|
|
79
|
+
`));l.push(Te.flush());for(let o of r)l.push(Te.encode(`have ${o}
|
|
80
|
+
`));return l.push(Te.encode(`done
|
|
81
|
+
`)),l}u(Vq,"writeUploadPackRequest");async function ng({fs:t,cache:e,http:r,onProgress:i,onMessage:n,onAuth:s,onAuthSuccess:a,onAuthFailure:l,gitdir:c,ref:o,remoteRef:f,remote:h,url:d,corsProxy:p,depth:m=null,since:w=null,exclude:g=[],relative:b=!1,tags:_=!1,singleBranch:S=!1,headers:F={},prune:k=!1,pruneTags:A=!1}){let v=o||await Ui({fs:t,gitdir:c,test:!0}),T=await Oe.get({fs:t,gitdir:c}),E=h||v&&await T.get(`branch.${v}.remote`)||"origin",R=d||await T.get(`remote.${E}.url`);if(typeof R>"u")throw new Ot("remote OR url");let P=f||v&&await T.get(`branch.${v}.merge`)||o||"HEAD";p===void 0&&(p=await T.get("http.corsProxy"));let I=qa.getRemoteHelperFor({url:R}),B=await I.discover({http:r,onAuth:s,onAuthSuccess:a,onAuthFailure:l,corsProxy:p,service:"git-upload-pack",url:R,headers:F,protocolVersion:1}),z=B.auth,we=B.refs;if(we.size===0)return{defaultBranch:null,fetchHead:null,fetchHeadDescription:null};if(m!==null&&!B.capabilities.has("shallow"))throw new Ci("shallow","depth");if(w!==null&&!B.capabilities.has("deepen-since"))throw new Ci("deepen-since","since");if(g.length>0&&!B.capabilities.has("deepen-not"))throw new Ci("deepen-not","exclude");if(b===!0&&!B.capabilities.has("deepen-relative"))throw new Ci("deepen-relative","relative");let st,Dt;try{let V=$.resolveAgainstMap({ref:P,map:we});st=V.fullref,Dt=V.oid}catch{}for(let V of we.keys())V===st||V==="HEAD"||V.startsWith("refs/heads/")||_&&V.startsWith("refs/tags/")||we.delete(V);let Ft=ux([...B.capabilities],["multi_ack_detailed","no-done","side-band-64k","ofs-delta",`agent=${Hh.agent}`]);b&&Ft.push("deepen-relative");let Vo=S?[Dt]:we.values(),us=S?[v]:await $.listRefs({fs:t,gitdir:c,filepath:"refs"}),wt=[];for(let V of us)try{V=await $.expand({fs:t,gitdir:c,ref:V});let fe=await $.resolve({fs:t,gitdir:c,ref:V});await $T({fs:t,cache:e,gitdir:c,oid:fe})&&wt.push(fe)}catch{}wt=[...new Set(wt)];let he=await Nn.read({fs:t,gitdir:c}),kt=B.capabilities.has("shallow")?[...he]:[],De=Vq({capabilities:Ft,wants:Vo,haves:wt,shallows:kt,depth:m,since:w,exclude:g}),le=Buffer.from(await eh(De)),Re=await I.connect({http:r,onProgress:i,corsProxy:p,service:"git-upload-pack",url:R,auth:z,body:[le],headers:F}),ke=await Hq(Re.body);Re.headers&&(ke.headers=Re.headers);for(let V of ke.shallows)if(!he.has(V))try{let{object:fe}=await ge({fs:t,cache:e,gitdir:c,oid:V}),Ce=new At(fe),at=await Promise.all(Ce.headers().parent.map(Vr=>$T({fs:t,cache:e,gitdir:c,oid:Vr})));at.length===0||at.every(Vr=>Vr)||he.add(V)}catch{he.add(V)}for(let V of ke.unshallows)he.delete(V);if(await Nn.write({fs:t,gitdir:c,oids:he}),S){let V=new Map([[st,Dt]]),fe=new Map,Ce=10,at=st;for(;Ce--;){let Gr=B.symrefs.get(at);if(Gr===void 0)break;fe.set(at,Gr),at=Gr}let _i=we.get(at);_i&&V.set(at,_i);let{pruned:Vr}=await $.updateRemoteRefs({fs:t,gitdir:c,remote:E,refs:V,symrefs:fe,tags:_,prune:k});k&&(ke.pruned=Vr)}else{let{pruned:V}=await $.updateRemoteRefs({fs:t,gitdir:c,remote:E,refs:we,symrefs:B.symrefs,tags:_,prune:k,pruneTags:A});k&&(ke.pruned=V)}if(ke.HEAD=B.symrefs.get("HEAD"),ke.HEAD===void 0)try{let{oid:V}=$.resolveAgainstMap({ref:"HEAD",map:we});for(let[fe,Ce]of we.entries())if(fe!=="HEAD"&&Ce===V){ke.HEAD=fe;break}}catch{}let Go=st&&st.startsWith("refs/tags")?"tag":"branch";if(ke.FETCH_HEAD={oid:Dt,description:`${Go} '${An(st)}' of ${R}`},i||n){let V=hx(ke.progress);oc(V,async fe=>{if(n&&await n(fe),i){let Ce=fe.match(/([^:]*).*\((\d+?)\/(\d+?)\)/);Ce&&await i({phase:Ce[1].trim(),loaded:parseInt(Ce[2],10),total:parseInt(Ce[3],10)})}})}let Er=Buffer.from(await eh(ke.packfile));if(Re.body.error)throw Re.body.error;let yt=Er.slice(-20).toString("hex"),Ct={defaultBranch:ke.HEAD,fetchHead:ke.FETCH_HEAD.oid,fetchHeadDescription:ke.FETCH_HEAD.description};if(ke.headers&&(Ct.headers=ke.headers),k&&(Ct.pruned=ke.pruned),yt!==""&&!zq(Er)){Ct.packfile=`objects/pack/pack-${yt}.pack`;let V=C(c,Ct.packfile);await t.write(V,Er);let fe=u(at=>ge({fs:t,cache:e,gitdir:c,oid:at}),"getExternalRefDelta"),Ce=await zl.fromPack({pack:Er,getExternalRefDelta:fe,onProgress:i});await t.write(V.replace(/\.pack$/,".idx"),await Ce.toBuffer())}return Ct}u(ng,"_fetch");async function dx({fs:t,bare:e=!1,dir:r,gitdir:i=e?r:C(r,".git"),defaultBranch:n="master"}){if(await t.exists(i+"/config"))return;let s=["hooks","info","objects/info","objects/pack","refs/heads","refs/tags"];s=s.map(a=>i+"/"+a);for(let a of s)await t.mkdir(a);await t.write(i+"/config",`[core]
|
|
82
82
|
repositoryformatversion = 0
|
|
83
83
|
filemode = false
|
|
84
84
|
bare = ${e}
|
|
@@ -86,33 +86,33 @@ gpgsig`+pw(o)+`
|
|
|
86
86
|
`)+` symlinks = false
|
|
87
87
|
ignorecase = true
|
|
88
88
|
`),await t.write(i+"/HEAD",`ref: refs/heads/${n}
|
|
89
|
-
`)}
|
|
89
|
+
`)}u(dx,"_init");async function Gq({fs:t,cache:e,http:r,onProgress:i,onMessage:n,onAuth:s,onAuthSuccess:a,onAuthFailure:l,onPostCheckout:c,dir:o,gitdir:f,url:h,corsProxy:d,ref:p,remote:m,depth:w,since:g,exclude:b,relative:_,singleBranch:S,noCheckout:F,noTags:k,headers:A,nonBlocking:v,batchSize:T=100}){try{if(await dx({fs:t,gitdir:f}),await sx({fs:t,gitdir:f,remote:m,url:h,force:!1}),d){let P=await Oe.get({fs:t,gitdir:f});await P.set("http.corsProxy",d),await Oe.save({fs:t,gitdir:f,config:P})}let{defaultBranch:E,fetchHead:R}=await ng({fs:t,cache:e,http:r,onProgress:i,onMessage:n,onAuth:s,onAuthSuccess:a,onAuthFailure:l,gitdir:f,ref:p,remote:m,corsProxy:d,depth:w,since:g,exclude:b,relative:_,singleBranch:S,headers:A,tags:!k});if(R===null)return;p=p||E,p=p.replace("refs/heads/",""),await rg({fs:t,cache:e,onProgress:i,onPostCheckout:c,dir:o,gitdir:f,ref:p,remote:m,noCheckout:F,nonBlocking:v,batchSize:T})}catch(E){throw await t.rmdir(f,{recursive:!0,maxRetries:10}).catch(()=>{}),E}}u(Gq,"_clone");async function px({fs:t,http:e,onProgress:r,onMessage:i,onAuth:n,onAuthSuccess:s,onAuthFailure:a,onPostCheckout:l,dir:c,gitdir:o=C(c,".git"),url:f,corsProxy:h=void 0,ref:d=void 0,remote:p="origin",depth:m=void 0,since:w=void 0,exclude:g=[],relative:b=!1,singleBranch:_=!1,noCheckout:S=!1,noTags:F=!1,headers:k={},cache:A={},nonBlocking:v=!1,batchSize:T=100}){try{return O("fs",t),O("http",e),O("gitdir",o),S||O("dir",c),O("url",f),await Gq({fs:new M(t),cache:A,http:e,onProgress:r,onMessage:i,onAuth:n,onAuthSuccess:s,onAuthFailure:a,onPostCheckout:l,dir:c,gitdir:o,url:f,corsProxy:h,ref:d,remote:p,depth:m,since:w,exclude:g,relative:b,singleBranch:_,noCheckout:S,noTags:F,headers:k,nonBlocking:v,batchSize:T})}catch(E){throw E.caller="git.clone",E}}u(px,"clone");async function mx({fs:t,onSign:e,dir:r,gitdir:i=C(r,".git"),message:n,author:s,committer:a,signingKey:l,amend:c=!1,dryRun:o=!1,noUpdateBranch:f=!1,ref:h,parent:d,tree:p,cache:m={}}){try{O("fs",t),c||O("message",n),l&&O("onSign",e);let w=new M(t);return await Wh({fs:w,cache:m,onSign:e,gitdir:i,message:n,author:s,committer:a,signingKey:l,amend:c,dryRun:o,noUpdateBranch:f,ref:h,parent:d,tree:p})}catch(w){throw w.caller="git.commit",w}}u(mx,"commit");async function wx({fs:t,dir:e,gitdir:r=C(e,".git"),fullname:i=!1,test:n=!1}){try{return O("fs",t),O("gitdir",r),await Ui({fs:new M(t),gitdir:r,fullname:i,test:n})}catch(s){throw s.caller="git.currentBranch",s}}u(wx,"currentBranch");async function Zq({fs:t,gitdir:e,ref:r}){if(r=r.startsWith("refs/heads/")?r:`refs/heads/${r}`,!await $.exists({fs:t,gitdir:e,ref:r}))throw new pe(r);let n=await $.expand({fs:t,gitdir:e,ref:r}),s=await Ui({fs:t,gitdir:e,fullname:!0});if(n===s){let c=await $.resolve({fs:t,gitdir:e,ref:n});await $.writeRef({fs:t,gitdir:e,ref:"HEAD",value:c})}await $.deleteRef({fs:t,gitdir:e,ref:n});let a=An(r),l=await Oe.get({fs:t,gitdir:e});await l.deleteSection("branch",a),await Oe.save({fs:t,gitdir:e,config:l})}u(Zq,"_deleteBranch");async function yx({fs:t,dir:e,gitdir:r=C(e,".git"),ref:i}){try{return O("fs",t),O("ref",i),await Zq({fs:new M(t),gitdir:r,ref:i})}catch(n){throw n.caller="git.deleteBranch",n}}u(yx,"deleteBranch");async function gx({fs:t,dir:e,gitdir:r=C(e,".git"),ref:i}){try{O("fs",t),O("ref",i),await $.deleteRef({fs:new M(t),gitdir:r,ref:i})}catch(n){throw n.caller="git.deleteRef",n}}u(gx,"deleteRef");async function Kq({fs:t,gitdir:e,remote:r}){let i=await Oe.get({fs:t,gitdir:e});await i.deleteSection("remote",r),await Oe.save({fs:t,gitdir:e,config:i})}u(Kq,"_deleteRemote");async function bx({fs:t,dir:e,gitdir:r=C(e,".git"),remote:i}){try{return O("fs",t),O("remote",i),await Kq({fs:new M(t),gitdir:r,remote:i})}catch(n){throw n.caller="git.deleteRemote",n}}u(bx,"deleteRemote");async function Jq({fs:t,gitdir:e,ref:r}){r=r.startsWith("refs/tags/")?r:`refs/tags/${r}`,await $.deleteRef({fs:t,gitdir:e,ref:r})}u(Jq,"_deleteTag");async function _x({fs:t,dir:e,gitdir:r=C(e,".git"),ref:i}){try{return O("fs",t),O("ref",i),await Jq({fs:new M(t),gitdir:r,ref:i})}catch(n){throw n.caller="git.deleteTag",n}}u(_x,"deleteTag");async function Yq({fs:t,gitdir:e,oid:r}){let i=r.slice(0,2);return(await t.readdir(`${e}/objects/${i}`)).map(s=>`${i}${s}`).filter(s=>s.startsWith(r))}u(Yq,"expandOidLoose");async function Xq({fs:t,cache:e,gitdir:r,oid:i,getExternalRefDelta:n}){let s=[],a=await t.readdir(C(r,"objects/pack"));a=a.filter(l=>l.endsWith(".idx"));for(let l of a){let c=`${r}/objects/pack/${l}`,o=await tg({fs:t,cache:e,filename:c,getExternalRefDelta:n});if(o.error)throw new H(o.error);for(let f of o.offsets.keys())f.startsWith(i)&&s.push(f)}return s}u(Xq,"expandOidPacked");async function Qq({fs:t,cache:e,gitdir:r,oid:i}){let n=u(l=>ge({fs:t,cache:e,gitdir:r,oid:l}),"getExternalRefDelta"),s=await Yq({fs:t,gitdir:r,oid:i}),a=await Xq({fs:t,cache:e,gitdir:r,oid:i,getExternalRefDelta:n});for(let l of a)s.indexOf(l)===-1&&s.push(l);if(s.length===1)return s[0];throw s.length>1?new Wl("oids",i,s):new pe(`an object matching "${i}"`)}u(Qq,"_expandOid");async function vx({fs:t,dir:e,gitdir:r=C(e,".git"),oid:i,cache:n={}}){try{return O("fs",t),O("gitdir",r),O("oid",i),await Qq({fs:new M(t),cache:n,gitdir:r,oid:i})}catch(s){throw s.caller="git.expandOid",s}}u(vx,"expandOid");async function Sx({fs:t,dir:e,gitdir:r=C(e,".git"),ref:i}){try{return O("fs",t),O("gitdir",r),O("ref",i),await $.expand({fs:new M(t),gitdir:r,ref:i})}catch(n){throw n.caller="git.expandRef",n}}u(Sx,"expandRef");async function sg({fs:t,cache:e,gitdir:r,oids:i}){let n={},s=i.length,a=i.map((l,c)=>({index:c,oid:l}));for(;a.length;){let l=new Set;for(let{oid:o,index:f}of a)n[o]||(n[o]=new Set),n[o].add(f),n[o].size===s&&l.add(o);if(l.size>0)return[...l];let c=new Map;for(let{oid:o,index:f}of a)try{let{object:h}=await ge({fs:t,cache:e,gitdir:r,oid:o}),d=At.from(h),{parent:p}=d.parseHeaders();for(let m of p)(!n[m]||!n[m].has(f))&&c.set(m+":"+f,{oid:m,index:f})}catch{}a=Array.from(c.values())}return[]}u(sg,"_findMergeBase");var My=/^.*(\r?\n|$)/gm;function e5({branches:t,contents:e}){let r=t[1],i=t[2],n=e[0],s=e[1],a=e[2],l=s.match(My),c=n.match(My),o=a.match(My),f=N6(l,c,o),h=7,d="",p=!0;for(let m of f)m.ok&&(d+=m.ok.join("")),m.conflict&&(p=!1,d+=`${"<".repeat(h)} ${r}
|
|
90
90
|
`,d+=m.conflict.a.join(""),d+=`${"=".repeat(h)}
|
|
91
91
|
`,d+=m.conflict.b.join(""),d+=`${">".repeat(h)} ${i}
|
|
92
|
-
`);return{cleanMerge:p,mergedText:d}}l(Cj,"mergeFile");async function Dj({fs:t,cache:e,dir:r,gitdir:i=D(r,".git"),index:n,ourOid:s,baseOid:o,theirOid:f,ourName:c="ours",baseName:a="base",theirName:u="theirs",dryRun:h=!1,abortOnConflict:d=!0,mergeDriver:p}){let m=Rt({ref:s}),w=Rt({ref:o}),y=Rt({ref:f}),g=[],_=[],F=[],E=[],R=await hi({fs:t,cache:e,dir:r,gitdir:i,trees:[m,w,y],map:l(async function(P,[S,O,v]){let A=jf(P),x=await Hf(S,O),I=await Hf(v,O);switch(`${x}-${I}`){case"false-false":return{mode:await O.mode(),path:A,oid:await O.oid(),type:await O.type()};case"false-true":return!v&&await S.type()==="tree"?{mode:await S.mode(),path:A,oid:await S.oid(),type:await S.type()}:v?{mode:await v.mode(),path:A,oid:await v.oid(),type:await v.type()}:void 0;case"true-false":return!S&&await v.type()==="tree"?{mode:await v.mode(),path:A,oid:await v.oid(),type:await v.type()}:S?{mode:await S.mode(),path:A,oid:await S.oid(),type:await S.type()}:void 0;case"true-true":{if(S&&v&&await S.type()==="tree"&&await v.type()==="tree")return{mode:await S.mode(),path:A,oid:await S.oid(),type:"tree"};if(S&&v&&await S.type()==="blob"&&await v.type()==="blob")return Ij({fs:t,gitdir:i,path:A,ours:S,base:O,theirs:v,ourName:c,baseName:a,theirName:u,mergeDriver:p}).then(async M=>{if(M.cleanMerge)d||n.insert({filepath:P,oid:M.mergeResult.oid,stage:0});else if(g.push(P),_.push(P),!d){let z="";O&&await O.type()==="blob"&&(z=await O.oid());let Se=await S.oid(),Ye=await v.oid();n.delete({filepath:P}),z&&n.insert({filepath:P,oid:z,stage:1}),n.insert({filepath:P,oid:Se,stage:2}),n.insert({filepath:P,oid:Ye,stage:3})}return M.mergeResult});if(O&&!S&&v&&await O.type()==="blob"&&await v.type()==="blob"){if(g.push(P),F.push(P),!d){let M=await O.oid(),z=await v.oid();n.delete({filepath:P}),n.insert({filepath:P,oid:M,stage:1}),n.insert({filepath:P,oid:z,stage:3})}return{mode:await v.mode(),oid:await v.oid(),type:"blob",path:A}}if(O&&S&&!v&&await O.type()==="blob"&&await S.type()==="blob"){if(g.push(P),E.push(P),!d){let M=await O.oid(),z=await S.oid();n.delete({filepath:P}),n.insert({filepath:P,oid:M,stage:1}),n.insert({filepath:P,oid:z,stage:2})}return{mode:await S.mode(),oid:await S.oid(),type:"blob",path:A}}if(O&&!S&&!v&&(await O.type()==="blob"||await O.type()==="tree"))return;throw new Xs}}},"map"),reduce:g.length!==0&&(!r||d)?void 0:async(P,S)=>{let O=S.filter(Boolean);if(P&&!(P&&P.type==="tree"&&O.length===0&&P.path!==".")){if(O.length>0||P.path==="."&&O.length===0){let A=new gt(O).toObject(),x=await _t({fs:t,gitdir:i,type:"tree",object:A,dryRun:h});P.oid=x}return P}}});return g.length!==0?(r&&!d&&await hi({fs:t,cache:e,dir:r,gitdir:i,trees:[Rt({ref:R.oid})],map:l(async function(P,[S]){let O=`${r}/${P}`;if(await S.type()==="blob"){let v=await S.mode(),A=new TextDecoder().decode(await S.content());await t.write(O,A,{mode:v})}return!0},"map")}),new Ys(g,_,F,E)):R.oid}l(Dj,"mergeTree");async function Ij({fs:t,gitdir:e,path:r,ours:i,base:n,theirs:s,ourName:o,theirName:f,baseName:c,dryRun:a,mergeDriver:u=Cj}){let h="blob",d="100755",p="",m="";n&&await n.type()==="blob"&&(d=await n.mode(),p=await n.oid(),m=Buffer.from(await n.content()).toString("utf8"));let w=d===await i.mode()?await s.mode():await i.mode();if(await i.oid()===await s.oid())return{cleanMerge:!0,mergeResult:{mode:w,path:r,oid:await i.oid(),type:h}};if(await i.oid()===p)return{cleanMerge:!0,mergeResult:{mode:w,path:r,oid:await s.oid(),type:h}};if(await s.oid()===p)return{cleanMerge:!0,mergeResult:{mode:w,path:r,oid:await i.oid(),type:h}};let y=Buffer.from(await i.content()).toString("utf8"),g=Buffer.from(await s.content()).toString("utf8"),{mergedText:_,cleanMerge:F}=await u({branches:[c,o,f],contents:[m,y,g],path:r}),E=await _t({fs:t,gitdir:e,type:"blob",object:Buffer.from(_,"utf8"),dryRun:a});return{cleanMerge:F,mergeResult:{mode:w,path:r,oid:E,type:h}}}l(Ij,"mergeBlobs");async function O1({fs:t,cache:e,dir:r,gitdir:i,ours:n,theirs:s,fastForward:o=!0,fastForwardOnly:f=!1,dryRun:c=!1,noUpdateBranch:a=!1,abortOnConflict:u=!0,message:h,author:d,committer:p,signingKey:m,onSign:w,mergeDriver:y,allowUnrelatedHistories:g=!1}){n===void 0&&(n=await wi({fs:t,gitdir:i,fullname:!0})),n=await $.expand({fs:t,gitdir:i,ref:n}),s=await $.expand({fs:t,gitdir:i,ref:s});let _=await $.resolve({fs:t,gitdir:i,ref:n}),F=await $.resolve({fs:t,gitdir:i,ref:s}),E=await Mw({fs:t,cache:e,gitdir:i,oids:[_,F]});if(E.length!==1)if(E.length===0&&g)E.push("4b825dc642cb6eb9a060e54bf8d69288fbee4904");else throw new Xs;let R=E[0];if(R===F)return{oid:_,alreadyMerged:!0};if(o&&R===_)return!c&&!a&&await $.writeRef({fs:t,gitdir:i,ref:n,value:F}),{oid:F,fastForward:!0};{if(f)throw new tc;let P=await Te.acquire({fs:t,gitdir:i,cache:e,allowUnmerged:!1},async O=>Dj({fs:t,cache:e,dir:r,gitdir:i,index:O,ourOid:_,theirOid:F,baseOid:R,ourName:tn(n),baseName:"base",theirName:tn(s),dryRun:c,abortOnConflict:u,mergeDriver:y}));if(P instanceof Ys)throw P;return h||(h=`Merge branch '${tn(s)}' into ${tn(n)}`),{oid:await $u({fs:t,cache:e,gitdir:i,message:h,ref:n,tree:P,parent:[_,F],author:d,committer:p,signingKey:m,onSign:w,dryRun:c,noUpdateBranch:a}),tree:P,mergeCommit:!0}}}l(O1,"_merge");async function x1({fs:t,cache:e,http:r,onProgress:i,onMessage:n,onAuth:s,onAuthSuccess:o,onAuthFailure:f,dir:c,gitdir:a,ref:u,url:h,remote:d,remoteRef:p,prune:m,pruneTags:w,fastForward:y,fastForwardOnly:g,corsProxy:_,singleBranch:F,headers:E,author:R,committer:P,signingKey:S}){try{if(!u){let A=await wi({fs:t,gitdir:a});if(!A)throw new yt("ref");u=A}let{fetchHead:O,fetchHeadDescription:v}=await Bw({fs:t,cache:e,http:r,onProgress:i,onMessage:n,onAuth:s,onAuthSuccess:o,onAuthFailure:f,gitdir:a,corsProxy:_,ref:u,url:h,remote:d,remoteRef:p,singleBranch:F,headers:E,prune:m,pruneTags:w});await O1({fs:t,cache:e,gitdir:a,ours:u,theirs:O,fastForward:y,fastForwardOnly:g,message:`Merge ${v}`,author:R,committer:P,signingKey:S,dryRun:!1,noUpdateBranch:!1}),await Iw({fs:t,cache:e,onProgress:i,dir:c,gitdir:a,ref:u,remote:d,noCheckout:!1})}catch(O){throw O.caller="git.pull",O}}l(x1,"_pull");async function A1({fs:t,http:e,onProgress:r,onMessage:i,onAuth:n,onAuthSuccess:s,onAuthFailure:o,dir:f,gitdir:c=D(f,".git"),ref:a,url:u,remote:h,remoteRef:d,corsProxy:p,singleBranch:m,headers:w={},cache:y={}}){try{k("fs",t),k("http",e),k("gitdir",c);let g={name:"",email:"",timestamp:Date.now(),timezoneOffset:0};return await x1({fs:new L(t),cache:y,http:e,onProgress:r,onMessage:i,onAuth:n,onAuthSuccess:s,onAuthFailure:o,dir:f,gitdir:c,ref:a,url:u,remote:h,remoteRef:d,fastForwardOnly:!0,corsProxy:p,singleBranch:m,headers:w,author:g,committer:g})}catch(g){throw g.caller="git.fastForward",g}}l(A1,"fastForward");async function P1({fs:t,http:e,onProgress:r,onMessage:i,onAuth:n,onAuthSuccess:s,onAuthFailure:o,dir:f,gitdir:c=D(f,".git"),ref:a,remote:u,remoteRef:h,url:d,corsProxy:p,depth:m=null,since:w=null,exclude:y=[],relative:g=!1,tags:_=!1,singleBranch:F=!1,headers:E={},prune:R=!1,pruneTags:P=!1,cache:S={}}){try{return k("fs",t),k("http",e),k("gitdir",c),await Bw({fs:new L(t),cache:S,http:e,onProgress:r,onMessage:i,onAuth:n,onAuthSuccess:s,onAuthFailure:o,gitdir:c,ref:a,remote:u,remoteRef:h,url:d,corsProxy:p,depth:m,since:w,exclude:y,relative:g,tags:_,singleBranch:F,headers:E,prune:R,pruneTags:P})}catch(O){throw O.caller="git.fetch",O}}l(P1,"fetch");async function N1({fs:t,dir:e,gitdir:r=D(e,".git"),oids:i,cache:n={}}){try{return k("fs",t),k("gitdir",r),k("oids",i),await Mw({fs:new L(t),cache:n,gitdir:r,oids:i})}catch(s){throw s.caller="git.findMergeBase",s}}l(N1,"findMergeBase");async function C1({fs:t,filepath:e}){if(await t.exists(D(e,".git")))return e;{let r=Ks(e);if(r===e)throw new fe(`git root for ${e}`);return C1({fs:t,filepath:r})}}l(C1,"_findRoot");async function D1({fs:t,filepath:e}){try{return k("fs",t),k("filepath",e),await C1({fs:new L(t),filepath:e})}catch(r){throw r.caller="git.findRoot",r}}l(D1,"findRoot");async function I1({fs:t,dir:e,gitdir:r=D(e,".git"),path:i}){try{return k("fs",t),k("gitdir",r),k("path",i),await fc({fs:new L(t),gitdir:r,path:i})}catch(n){throw n.caller="git.getConfig",n}}l(I1,"getConfig");async function $j({fs:t,gitdir:e,path:r}){return(await ve.get({fs:t,gitdir:e})).getall(r)}l($j,"_getConfigAll");async function $1({fs:t,dir:e,gitdir:r=D(e,".git"),path:i}){try{return k("fs",t),k("gitdir",r),k("path",i),await $j({fs:new L(t),gitdir:r,path:i})}catch(n){throw n.caller="git.getConfigAll",n}}l($1,"getConfigAll");async function B1({http:t,onAuth:e,onAuthSuccess:r,onAuthFailure:i,corsProxy:n,url:s,headers:o={},forPush:f=!1}){try{k("http",t),k("url",s);let a=await no.getRemoteHelperFor({url:s}).discover({http:t,onAuth:e,onAuthSuccess:r,onAuthFailure:i,corsProxy:n,service:f?"git-receive-pack":"git-upload-pack",url:s,headers:o,protocolVersion:1}),u={capabilities:[...a.capabilities]};for(let[h,d]of a.refs){let p=h.split("/"),m=p.pop(),w=u;for(let y of p)w[y]=w[y]||{},w=w[y];w[m]=d}for(let[h,d]of a.symrefs){let p=h.split("/"),m=p.pop(),w=u;for(let y of p)w[y]=w[y]||{},w=w[y];w[m]=d}return u}catch(c){throw c.caller="git.getRemoteInfo",c}}l(B1,"getRemoteInfo");function M1(t,e,r,i){let n=[];for(let[s,o]of t.refs){if(e&&!s.startsWith(e))continue;if(s.endsWith("^{}")){if(i){let c=s.replace("^{}",""),a=n[n.length-1],u=a.ref===c?a:n.find(h=>h.ref===c);if(u===void 0)throw new Error("I did not expect this to happen");u.peeled=o}continue}let f={ref:s,oid:o};r&&t.symrefs.has(s)&&(f.target=t.symrefs.get(s)),n.push(f)}return n}l(M1,"formatInfoRefs");async function L1({http:t,onAuth:e,onAuthSuccess:r,onAuthFailure:i,corsProxy:n,url:s,headers:o={},forPush:f=!1,protocolVersion:c=2}){try{k("http",t),k("url",s);let u=await no.getRemoteHelperFor({url:s}).discover({http:t,onAuth:e,onAuthSuccess:r,onAuthFailure:i,corsProxy:n,service:f?"git-receive-pack":"git-upload-pack",url:s,headers:o,protocolVersion:c});if(u.protocolVersion===2)return{protocolVersion:u.protocolVersion,capabilities:u.capabilities2};let h={};for(let d of u.capabilities){let[p,m]=d.split("=");m?h[p]=m:h[p]=!0}return{protocolVersion:1,capabilities:h,refs:M1(u,void 0,!0,!0)}}catch(a){throw a.caller="git.getRemoteInfo2",a}}l(L1,"getRemoteInfo2");async function Bj({type:t,object:e,format:r="content",oid:i=void 0}){return r!=="deflated"&&(r!=="wrapped"&&(e=fi.wrap({type:t,object:e})),i=await $r(e)),{oid:i,object:e}}l(Bj,"hashObject");async function j1({object:t}){try{k("object",t),typeof t=="string"?t=Buffer.from(t,"utf8"):t instanceof Uint8Array||(t=new Uint8Array(t));let e="blob",{oid:r,object:i}=await Bj({type:e,format:"content",object:t});return{oid:r,type:e,object:i,format:"wrapped"}}catch(e){throw e.caller="git.hashBlob",e}}l(j1,"hashBlob");async function Mj({fs:t,cache:e,onProgress:r,dir:i,gitdir:n,filepath:s}){try{s=D(i,s);let o=await t.read(s),f=l(a=>de({fs:t,cache:e,gitdir:n,oid:a}),"getExternalRefDelta"),c=await Xa.fromPack({pack:o,getExternalRefDelta:f,onProgress:r});return await t.write(s.replace(/\.pack$/,".idx"),await c.toBuffer()),{oids:[...c.hashes]}}catch(o){throw o.caller="git.indexPack",o}}l(Mj,"_indexPack");async function q1({fs:t,onProgress:e,dir:r,gitdir:i=D(r,".git"),filepath:n,cache:s={}}){try{return k("fs",t),k("dir",r),k("gitdir",r),k("filepath",n),await Mj({fs:new L(t),cache:s,onProgress:e,dir:r,gitdir:i,filepath:n})}catch(o){throw o.caller="git.indexPack",o}}l(q1,"indexPack");async function U1({fs:t,bare:e=!1,dir:r,gitdir:i=e?r:D(r,".git"),defaultBranch:n="master"}){try{return k("fs",t),k("gitdir",i),e||k("dir",r),await g1({fs:new L(t),bare:e,dir:r,gitdir:i,defaultBranch:n})}catch(s){throw s.caller="git.init",s}}l(U1,"init");async function W1({fs:t,cache:e,gitdir:r,oid:i,ancestor:n,depth:s}){let o=await nn.read({fs:t,gitdir:r});if(!i)throw new yt("oid");if(!n)throw new yt("ancestor");if(i===n)return!1;let f=[i],c=new Set,a=0;for(;f.length;){if(a++===s)throw new ic(s);let u=f.shift(),{type:h,object:d}=await de({fs:t,cache:e,gitdir:r,oid:u});if(h!=="commit")throw new ut(u,h,"commit");let p=bt.from(d).parse();for(let m of p.parent)if(m===n)return!0;if(!o.has(u))for(let m of p.parent)c.has(m)||(f.push(m),c.add(m))}return!1}l(W1,"_isDescendent");async function z1({fs:t,dir:e,gitdir:r=D(e,".git"),oid:i,ancestor:n,depth:s=-1,cache:o={}}){try{return k("fs",t),k("gitdir",r),k("oid",i),k("ancestor",n),await W1({fs:new L(t),cache:o,gitdir:r,oid:i,ancestor:n,depth:s})}catch(f){throw f.caller="git.isDescendent",f}}l(z1,"isDescendent");async function H1({fs:t,dir:e,gitdir:r=D(e,".git"),filepath:i}){try{return k("fs",t),k("dir",e),k("gitdir",r),k("filepath",i),di.isIgnored({fs:new L(t),dir:e,gitdir:r,filepath:i})}catch(n){throw n.caller="git.isIgnored",n}}l(H1,"isIgnored");async function V1({fs:t,dir:e,gitdir:r=D(e,".git"),remote:i}){try{return k("fs",t),k("gitdir",r),$.listBranches({fs:new L(t),gitdir:r,remote:i})}catch(n){throw n.caller="git.listBranches",n}}l(V1,"listBranches");async function Lj({fs:t,gitdir:e,ref:r,cache:i}){if(r){let n=await $.resolve({gitdir:e,fs:t,ref:r}),s=[];return await G1({fs:t,cache:i,gitdir:e,oid:n,filenames:s,prefix:""}),s}else return Te.acquire({fs:t,gitdir:e,cache:i},async function(n){return n.entries.map(s=>s.path)})}l(Lj,"_listFiles");async function G1({fs:t,cache:e,gitdir:r,oid:i,filenames:n,prefix:s}){let{tree:o}=await ao({fs:t,cache:e,gitdir:r,oid:i});for(let f of o)f.type==="tree"?await G1({fs:t,cache:e,gitdir:r,oid:f.oid,filenames:n,prefix:D(s,f.path)}):n.push(D(s,f.path))}l(G1,"accumulateFilesFromOid");async function K1({fs:t,dir:e,gitdir:r=D(e,".git"),ref:i,cache:n={}}){try{return k("fs",t),k("gitdir",r),await Lj({fs:new L(t),cache:n,gitdir:r,ref:i})}catch(s){throw s.caller="git.listFiles",s}}l(K1,"listFiles");async function jj({fs:t,cache:e,gitdir:r,ref:i}){let n;try{n=await $.resolve({gitdir:r,fs:t,ref:i})}catch(f){if(f instanceof fe)return[]}return(await ao({fs:t,cache:e,gitdir:r,oid:n})).tree.map(f=>({target:f.path,note:f.oid}))}l(jj,"_listNotes");async function J1({fs:t,dir:e,gitdir:r=D(e,".git"),ref:i="refs/notes/commits",cache:n={}}){try{return k("fs",t),k("gitdir",r),k("ref",i),await jj({fs:new L(t),cache:n,gitdir:r,ref:i})}catch(s){throw s.caller="git.listNotes",s}}l(J1,"listNotes");async function X1({fs:t,dir:e,gitdir:r=D(e,".git"),filepath:i}){try{return k("fs",t),k("gitdir",r),$.listRefs({fs:new L(t),gitdir:r,filepath:i})}catch(n){throw n.caller="git.listRefs",n}}l(X1,"listRefs");async function qj({fs:t,gitdir:e}){let r=await ve.get({fs:t,gitdir:e}),i=await r.getSubsections("remote");return Promise.all(i.map(async s=>{let o=await r.get(`remote.${s}.url`);return{remote:s,url:o}}))}l(qj,"_listRemotes");async function Y1({fs:t,dir:e,gitdir:r=D(e,".git")}){try{return k("fs",t),k("gitdir",r),await qj({fs:new L(t),gitdir:r})}catch(i){throw i.caller="git.listRemotes",i}}l(Y1,"listRemotes");async function Uj(t){let e=be.streamReader(t),r=[],i;for(;i=await e(),i!==!0;){if(i===null)continue;i=i.toString("utf8").replace(/\n$/,"");let[n,s,...o]=i.split(" "),f={ref:s,oid:n};for(let c of o){let[a,u]=c.split(":");a==="symref-target"?f.target=u:a==="peeled"&&(f.peeled=u)}r.push(f)}return r}l(Uj,"parseListRefsResponse");async function Wj({prefix:t,symrefs:e,peelTags:r}){let i=[];return i.push(be.encode(`command=ls-refs
|
|
93
|
-
`)),i.push(
|
|
94
|
-
`)),(r||e||t)&&i.push(
|
|
92
|
+
`);return{cleanMerge:p,mergedText:d}}u(e5,"mergeFile");async function t5({fs:t,cache:e,dir:r,gitdir:i=C(r,".git"),index:n,ourOid:s,baseOid:a,theirOid:l,ourName:c="ours",baseName:o="base",theirName:f="theirs",dryRun:h=!1,abortOnConflict:d=!0,mergeDriver:p}){let m=jt({ref:s}),w=jt({ref:a}),g=jt({ref:l}),b=[],_=[],S=[],F=[],k=await Li({fs:t,cache:e,dir:r,gitdir:i,trees:[m,w,g],map:u(async function(A,[v,T,E]){let R=Zu(A),P=await Qu(v,T),I=await Qu(E,T);switch(`${P}-${I}`){case"false-false":return{mode:await T.mode(),path:R,oid:await T.oid(),type:await T.type()};case"false-true":return!E&&await v.type()==="tree"?{mode:await v.mode(),path:R,oid:await v.oid(),type:await v.type()}:E?{mode:await E.mode(),path:R,oid:await E.oid(),type:await E.type()}:void 0;case"true-false":return!v&&await E.type()==="tree"?{mode:await E.mode(),path:R,oid:await E.oid(),type:await E.type()}:v?{mode:await v.mode(),path:R,oid:await v.oid(),type:await v.type()}:void 0;case"true-true":{if(v&&E&&await v.type()==="tree"&&await E.type()==="tree")return{mode:await v.mode(),path:R,oid:await v.oid(),type:"tree"};if(v&&E&&await v.type()==="blob"&&await E.type()==="blob")return r5({fs:t,gitdir:i,path:R,ours:v,base:T,theirs:E,ourName:c,baseName:o,theirName:f,mergeDriver:p}).then(async B=>{if(B.cleanMerge)d||n.insert({filepath:A,oid:B.mergeResult.oid,stage:0});else if(b.push(A),_.push(A),!d){let z="";T&&await T.type()==="blob"&&(z=await T.oid());let we=await v.oid(),st=await E.oid();n.delete({filepath:A}),z&&n.insert({filepath:A,oid:z,stage:1}),n.insert({filepath:A,oid:we,stage:2}),n.insert({filepath:A,oid:st,stage:3})}return B.mergeResult});if(T&&!v&&E&&await T.type()==="blob"&&await E.type()==="blob"){if(b.push(A),S.push(A),!d){let B=await T.oid(),z=await E.oid();n.delete({filepath:A}),n.insert({filepath:A,oid:B,stage:1}),n.insert({filepath:A,oid:z,stage:3})}return{mode:await E.mode(),oid:await E.oid(),type:"blob",path:R}}if(T&&v&&!E&&await T.type()==="blob"&&await v.type()==="blob"){if(b.push(A),F.push(A),!d){let B=await T.oid(),z=await v.oid();n.delete({filepath:A}),n.insert({filepath:A,oid:B,stage:1}),n.insert({filepath:A,oid:z,stage:2})}return{mode:await v.mode(),oid:await v.oid(),type:"blob",path:R}}if(T&&!v&&!E&&(await T.type()==="blob"||await T.type()==="tree"))return;throw new Da}}},"map"),reduce:b.length!==0&&(!r||d)?void 0:async(A,v)=>{let T=v.filter(Boolean);if(A&&!(A&&A.type==="tree"&&T.length===0&&A.path!==".")){if(T.length>0||A.path==="."&&T.length===0){let R=new Rt(T).toObject(),P=await Pt({fs:t,gitdir:i,type:"tree",object:R,dryRun:h});A.oid=P}return A}}});return b.length!==0?(r&&!d&&await Li({fs:t,cache:e,dir:r,gitdir:i,trees:[jt({ref:k.oid})],map:u(async function(A,[v]){let T=`${r}/${A}`;if(await v.type()==="blob"){let E=await v.mode(),R=new TextDecoder().decode(await v.content());await t.write(T,R,{mode:E})}return!0},"map")}),new Ca(b,_,S,F)):k.oid}u(t5,"mergeTree");async function r5({fs:t,gitdir:e,path:r,ours:i,base:n,theirs:s,ourName:a,theirName:l,baseName:c,dryRun:o,mergeDriver:f=e5}){let h="blob",d="100755",p="",m="";n&&await n.type()==="blob"&&(d=await n.mode(),p=await n.oid(),m=Buffer.from(await n.content()).toString("utf8"));let w=d===await i.mode()?await s.mode():await i.mode();if(await i.oid()===await s.oid())return{cleanMerge:!0,mergeResult:{mode:w,path:r,oid:await i.oid(),type:h}};if(await i.oid()===p)return{cleanMerge:!0,mergeResult:{mode:w,path:r,oid:await s.oid(),type:h}};if(await s.oid()===p)return{cleanMerge:!0,mergeResult:{mode:w,path:r,oid:await i.oid(),type:h}};let g=Buffer.from(await i.content()).toString("utf8"),b=Buffer.from(await s.content()).toString("utf8"),{mergedText:_,cleanMerge:S}=await f({branches:[c,a,l],contents:[m,g,b],path:r}),F=await Pt({fs:t,gitdir:e,type:"blob",object:Buffer.from(_,"utf8"),dryRun:o});return{cleanMerge:S,mergeResult:{mode:w,path:r,oid:F,type:h}}}u(r5,"mergeBlobs");async function Ex({fs:t,cache:e,dir:r,gitdir:i,ours:n,theirs:s,fastForward:a=!0,fastForwardOnly:l=!1,dryRun:c=!1,noUpdateBranch:o=!1,abortOnConflict:f=!0,message:h,author:d,committer:p,signingKey:m,onSign:w,mergeDriver:g,allowUnrelatedHistories:b=!1}){n===void 0&&(n=await Ui({fs:t,gitdir:i,fullname:!0})),n=await $.expand({fs:t,gitdir:i,ref:n}),s=await $.expand({fs:t,gitdir:i,ref:s});let _=await $.resolve({fs:t,gitdir:i,ref:n}),S=await $.resolve({fs:t,gitdir:i,ref:s}),F=await sg({fs:t,cache:e,gitdir:i,oids:[_,S]});if(F.length!==1)if(F.length===0&&b)F.push("4b825dc642cb6eb9a060e54bf8d69288fbee4904");else throw new Da;let k=F[0];if(k===S)return{oid:_,alreadyMerged:!0};if(a&&k===_)return!c&&!o&&await $.writeRef({fs:t,gitdir:i,ref:n,value:S}),{oid:S,fastForward:!0};{if(l)throw new Zl;let A=await Pe.acquire({fs:t,gitdir:i,cache:e,allowUnmerged:!1},async T=>t5({fs:t,cache:e,dir:r,gitdir:i,index:T,ourOid:_,theirOid:S,baseOid:k,ourName:An(n),baseName:"base",theirName:An(s),dryRun:c,abortOnConflict:f,mergeDriver:g}));if(A instanceof Ca)throw A;return h||(h=`Merge branch '${An(s)}' into ${An(n)}`),{oid:await Wh({fs:t,cache:e,gitdir:i,message:h,ref:n,tree:A,parent:[_,S],author:d,committer:p,signingKey:m,onSign:w,dryRun:c,noUpdateBranch:o}),tree:A,mergeCommit:!0}}}u(Ex,"_merge");async function Fx({fs:t,cache:e,http:r,onProgress:i,onMessage:n,onAuth:s,onAuthSuccess:a,onAuthFailure:l,dir:c,gitdir:o,ref:f,url:h,remote:d,remoteRef:p,prune:m,pruneTags:w,fastForward:g,fastForwardOnly:b,corsProxy:_,singleBranch:S,headers:F,author:k,committer:A,signingKey:v}){try{if(!f){let R=await Ui({fs:t,gitdir:o});if(!R)throw new Ot("ref");f=R}let{fetchHead:T,fetchHeadDescription:E}=await ng({fs:t,cache:e,http:r,onProgress:i,onMessage:n,onAuth:s,onAuthSuccess:a,onAuthFailure:l,gitdir:o,corsProxy:_,ref:f,url:h,remote:d,remoteRef:p,singleBranch:S,headers:F,prune:m,pruneTags:w});await Ex({fs:t,cache:e,gitdir:o,ours:f,theirs:T,fastForward:g,fastForwardOnly:b,message:`Merge ${E}`,author:k,committer:A,signingKey:v,dryRun:!1,noUpdateBranch:!1}),await rg({fs:t,cache:e,onProgress:i,dir:c,gitdir:o,ref:f,remote:d,noCheckout:!1})}catch(T){throw T.caller="git.pull",T}}u(Fx,"_pull");async function kx({fs:t,http:e,onProgress:r,onMessage:i,onAuth:n,onAuthSuccess:s,onAuthFailure:a,dir:l,gitdir:c=C(l,".git"),ref:o,url:f,remote:h,remoteRef:d,corsProxy:p,singleBranch:m,headers:w={},cache:g={}}){try{O("fs",t),O("http",e),O("gitdir",c);let b={name:"",email:"",timestamp:Date.now(),timezoneOffset:0};return await Fx({fs:new M(t),cache:g,http:e,onProgress:r,onMessage:i,onAuth:n,onAuthSuccess:s,onAuthFailure:a,dir:l,gitdir:c,ref:o,url:f,remote:h,remoteRef:d,fastForwardOnly:!0,corsProxy:p,singleBranch:m,headers:w,author:b,committer:b})}catch(b){throw b.caller="git.fastForward",b}}u(kx,"fastForward");async function Tx({fs:t,http:e,onProgress:r,onMessage:i,onAuth:n,onAuthSuccess:s,onAuthFailure:a,dir:l,gitdir:c=C(l,".git"),ref:o,remote:f,remoteRef:h,url:d,corsProxy:p,depth:m=null,since:w=null,exclude:g=[],relative:b=!1,tags:_=!1,singleBranch:S=!1,headers:F={},prune:k=!1,pruneTags:A=!1,cache:v={}}){try{return O("fs",t),O("http",e),O("gitdir",c),await ng({fs:new M(t),cache:v,http:e,onProgress:r,onMessage:i,onAuth:n,onAuthSuccess:s,onAuthFailure:a,gitdir:c,ref:o,remote:f,remoteRef:h,url:d,corsProxy:p,depth:m,since:w,exclude:g,relative:b,tags:_,singleBranch:S,headers:F,prune:k,pruneTags:A})}catch(T){throw T.caller="git.fetch",T}}u(Tx,"fetch");async function xx({fs:t,dir:e,gitdir:r=C(e,".git"),oids:i,cache:n={}}){try{return O("fs",t),O("gitdir",r),O("oids",i),await sg({fs:new M(t),cache:n,gitdir:r,oids:i})}catch(s){throw s.caller="git.findMergeBase",s}}u(xx,"findMergeBase");async function Ox({fs:t,filepath:e}){if(await t.exists(C(e,".git")))return e;{let r=Pa(e);if(r===e)throw new pe(`git root for ${e}`);return Ox({fs:t,filepath:r})}}u(Ox,"_findRoot");async function Rx({fs:t,filepath:e}){try{return O("fs",t),O("filepath",e),await Ox({fs:new M(t),filepath:e})}catch(r){throw r.caller="git.findRoot",r}}u(Rx,"findRoot");async function Ax({fs:t,dir:e,gitdir:r=C(e,".git"),path:i}){try{return O("fs",t),O("gitdir",r),O("path",i),await ic({fs:new M(t),gitdir:r,path:i})}catch(n){throw n.caller="git.getConfig",n}}u(Ax,"getConfig");async function i5({fs:t,gitdir:e,path:r}){return(await Oe.get({fs:t,gitdir:e})).getall(r)}u(i5,"_getConfigAll");async function Px({fs:t,dir:e,gitdir:r=C(e,".git"),path:i}){try{return O("fs",t),O("gitdir",r),O("path",i),await i5({fs:new M(t),gitdir:r,path:i})}catch(n){throw n.caller="git.getConfigAll",n}}u(Px,"getConfigAll");async function Nx({http:t,onAuth:e,onAuthSuccess:r,onAuthFailure:i,corsProxy:n,url:s,headers:a={},forPush:l=!1}){try{O("http",t),O("url",s);let o=await qa.getRemoteHelperFor({url:s}).discover({http:t,onAuth:e,onAuthSuccess:r,onAuthFailure:i,corsProxy:n,service:l?"git-receive-pack":"git-upload-pack",url:s,headers:a,protocolVersion:1}),f={capabilities:[...o.capabilities]};for(let[h,d]of o.refs){let p=h.split("/"),m=p.pop(),w=f;for(let g of p)w[g]=w[g]||{},w=w[g];w[m]=d}for(let[h,d]of o.symrefs){let p=h.split("/"),m=p.pop(),w=f;for(let g of p)w[g]=w[g]||{},w=w[g];w[m]=d}return f}catch(c){throw c.caller="git.getRemoteInfo",c}}u(Nx,"getRemoteInfo");function Dx(t,e,r,i){let n=[];for(let[s,a]of t.refs){if(e&&!s.startsWith(e))continue;if(s.endsWith("^{}")){if(i){let c=s.replace("^{}",""),o=n[n.length-1],f=o.ref===c?o:n.find(h=>h.ref===c);if(f===void 0)throw new Error("I did not expect this to happen");f.peeled=a}continue}let l={ref:s,oid:a};r&&t.symrefs.has(s)&&(l.target=t.symrefs.get(s)),n.push(l)}return n}u(Dx,"formatInfoRefs");async function Cx({http:t,onAuth:e,onAuthSuccess:r,onAuthFailure:i,corsProxy:n,url:s,headers:a={},forPush:l=!1,protocolVersion:c=2}){try{O("http",t),O("url",s);let f=await qa.getRemoteHelperFor({url:s}).discover({http:t,onAuth:e,onAuthSuccess:r,onAuthFailure:i,corsProxy:n,service:l?"git-receive-pack":"git-upload-pack",url:s,headers:a,protocolVersion:c});if(f.protocolVersion===2)return{protocolVersion:f.protocolVersion,capabilities:f.capabilities2};let h={};for(let d of f.capabilities){let[p,m]=d.split("=");m?h[p]=m:h[p]=!0}return{protocolVersion:1,capabilities:h,refs:Dx(f,void 0,!0,!0)}}catch(o){throw o.caller="git.getRemoteInfo2",o}}u(Cx,"getRemoteInfo2");async function n5({type:t,object:e,format:r="content",oid:i=void 0}){return r!=="deflated"&&(r!=="wrapped"&&(e=$i.wrap({type:t,object:e})),i=await si(e)),{oid:i,object:e}}u(n5,"hashObject");async function Ix({object:t}){try{O("object",t),typeof t=="string"?t=Buffer.from(t,"utf8"):t instanceof Uint8Array||(t=new Uint8Array(t));let e="blob",{oid:r,object:i}=await n5({type:e,format:"content",object:t});return{oid:r,type:e,object:i,format:"wrapped"}}catch(e){throw e.caller="git.hashBlob",e}}u(Ix,"hashBlob");async function s5({fs:t,cache:e,onProgress:r,dir:i,gitdir:n,filepath:s}){try{s=C(i,s);let a=await t.read(s),l=u(o=>ge({fs:t,cache:e,gitdir:n,oid:o}),"getExternalRefDelta"),c=await zl.fromPack({pack:a,getExternalRefDelta:l,onProgress:r});return await t.write(s.replace(/\.pack$/,".idx"),await c.toBuffer()),{oids:[...c.hashes]}}catch(a){throw a.caller="git.indexPack",a}}u(s5,"_indexPack");async function $x({fs:t,onProgress:e,dir:r,gitdir:i=C(r,".git"),filepath:n,cache:s={}}){try{return O("fs",t),O("dir",r),O("gitdir",r),O("filepath",n),await s5({fs:new M(t),cache:s,onProgress:e,dir:r,gitdir:i,filepath:n})}catch(a){throw a.caller="git.indexPack",a}}u($x,"indexPack");async function Bx({fs:t,bare:e=!1,dir:r,gitdir:i=e?r:C(r,".git"),defaultBranch:n="master"}){try{return O("fs",t),O("gitdir",i),e||O("dir",r),await dx({fs:new M(t),bare:e,dir:r,gitdir:i,defaultBranch:n})}catch(s){throw s.caller="git.init",s}}u(Bx,"init");async function Lx({fs:t,cache:e,gitdir:r,oid:i,ancestor:n,depth:s}){let a=await Nn.read({fs:t,gitdir:r});if(!i)throw new Ot("oid");if(!n)throw new Ot("ancestor");if(i===n)return!1;let l=[i],c=new Set,o=0;for(;l.length;){if(o++===s)throw new Jl(s);let f=l.shift(),{type:h,object:d}=await ge({fs:t,cache:e,gitdir:r,oid:f});if(h!=="commit")throw new _t(f,h,"commit");let p=At.from(d).parse();for(let m of p.parent)if(m===n)return!0;if(!a.has(f))for(let m of p.parent)c.has(m)||(l.push(m),c.add(m))}return!1}u(Lx,"_isDescendent");async function Mx({fs:t,dir:e,gitdir:r=C(e,".git"),oid:i,ancestor:n,depth:s=-1,cache:a={}}){try{return O("fs",t),O("gitdir",r),O("oid",i),O("ancestor",n),await Lx({fs:new M(t),cache:a,gitdir:r,oid:i,ancestor:n,depth:s})}catch(l){throw l.caller="git.isDescendent",l}}u(Mx,"isDescendent");async function jx({fs:t,dir:e,gitdir:r=C(e,".git"),filepath:i}){try{return O("fs",t),O("dir",e),O("gitdir",r),O("filepath",i),Mi.isIgnored({fs:new M(t),dir:e,gitdir:r,filepath:i})}catch(n){throw n.caller="git.isIgnored",n}}u(jx,"isIgnored");async function qx({fs:t,dir:e,gitdir:r=C(e,".git"),remote:i}){try{return O("fs",t),O("gitdir",r),$.listBranches({fs:new M(t),gitdir:r,remote:i})}catch(n){throw n.caller="git.listBranches",n}}u(qx,"listBranches");async function a5({fs:t,gitdir:e,ref:r,cache:i}){if(r){let n=await $.resolve({gitdir:e,fs:t,ref:r}),s=[];return await Ux({fs:t,cache:i,gitdir:e,oid:n,filenames:s,prefix:""}),s}else return Pe.acquire({fs:t,gitdir:e,cache:i},async function(n){return n.entries.map(s=>s.path)})}u(a5,"_listFiles");async function Ux({fs:t,cache:e,gitdir:r,oid:i,filenames:n,prefix:s}){let{tree:a}=await Wa({fs:t,cache:e,gitdir:r,oid:i});for(let l of a)l.type==="tree"?await Ux({fs:t,cache:e,gitdir:r,oid:l.oid,filenames:n,prefix:C(s,l.path)}):n.push(C(s,l.path))}u(Ux,"accumulateFilesFromOid");async function zx({fs:t,dir:e,gitdir:r=C(e,".git"),ref:i,cache:n={}}){try{return O("fs",t),O("gitdir",r),await a5({fs:new M(t),cache:n,gitdir:r,ref:i})}catch(s){throw s.caller="git.listFiles",s}}u(zx,"listFiles");async function o5({fs:t,cache:e,gitdir:r,ref:i}){let n;try{n=await $.resolve({gitdir:r,fs:t,ref:i})}catch(l){if(l instanceof pe)return[]}return(await Wa({fs:t,cache:e,gitdir:r,oid:n})).tree.map(l=>({target:l.path,note:l.oid}))}u(o5,"_listNotes");async function Wx({fs:t,dir:e,gitdir:r=C(e,".git"),ref:i="refs/notes/commits",cache:n={}}){try{return O("fs",t),O("gitdir",r),O("ref",i),await o5({fs:new M(t),cache:n,gitdir:r,ref:i})}catch(s){throw s.caller="git.listNotes",s}}u(Wx,"listNotes");async function Hx({fs:t,dir:e,gitdir:r=C(e,".git"),filepath:i}){try{return O("fs",t),O("gitdir",r),$.listRefs({fs:new M(t),gitdir:r,filepath:i})}catch(n){throw n.caller="git.listRefs",n}}u(Hx,"listRefs");async function l5({fs:t,gitdir:e}){let r=await Oe.get({fs:t,gitdir:e}),i=await r.getSubsections("remote");return Promise.all(i.map(async s=>{let a=await r.get(`remote.${s}.url`);return{remote:s,url:a}}))}u(l5,"_listRemotes");async function Vx({fs:t,dir:e,gitdir:r=C(e,".git")}){try{return O("fs",t),O("gitdir",r),await l5({fs:new M(t),gitdir:r})}catch(i){throw i.caller="git.listRemotes",i}}u(Vx,"listRemotes");async function c5(t){let e=Te.streamReader(t),r=[],i;for(;i=await e(),i!==!0;){if(i===null)continue;i=i.toString("utf8").replace(/\n$/,"");let[n,s,...a]=i.split(" "),l={ref:s,oid:n};for(let c of a){let[o,f]=c.split(":");o==="symref-target"?l.target=f:o==="peeled"&&(l.peeled=f)}r.push(l)}return r}u(c5,"parseListRefsResponse");async function f5({prefix:t,symrefs:e,peelTags:r}){let i=[];return i.push(Te.encode(`command=ls-refs
|
|
93
|
+
`)),i.push(Te.encode(`agent=${Hh.agent}
|
|
94
|
+
`)),(r||e||t)&&i.push(Te.delim()),r&&i.push(Te.encode("peel")),e&&i.push(Te.encode("symrefs")),t&&i.push(Te.encode(`ref-prefix ${t}`)),i.push(Te.flush()),i}u(f5,"writeListRefsRequest");async function Gx({http:t,onAuth:e,onAuthSuccess:r,onAuthFailure:i,corsProxy:n,url:s,headers:a={},forPush:l=!1,protocolVersion:c=2,prefix:o,symrefs:f,peelTags:h}){try{O("http",t),O("url",s);let d=await ja.discover({http:t,onAuth:e,onAuthSuccess:r,onAuthFailure:i,corsProxy:n,service:l?"git-receive-pack":"git-upload-pack",url:s,headers:a,protocolVersion:c});if(d.protocolVersion===1)return Dx(d,o,f,h);let p=await f5({prefix:o,symrefs:f,peelTags:h}),m=await ja.connect({http:t,auth:d.auth,headers:a,corsProxy:n,service:l?"git-receive-pack":"git-upload-pack",url:s,body:p});return c5(m.body)}catch(d){throw d.caller="git.listServerRefs",d}}u(Gx,"listServerRefs");async function Zx({fs:t,dir:e,gitdir:r=C(e,".git")}){try{return O("fs",t),O("gitdir",r),$.listTags({fs:new M(t),gitdir:r})}catch(i){throw i.caller="git.listTags",i}}u(Zx,"listTags");function u5(t,e){return t.committer.timestamp-e.committer.timestamp}u(u5,"compareAge");var h5="e69de29bb2d1d6434b8b29ae775ad8c2e48c5391";async function BT({fs:t,cache:e,gitdir:r,oid:i,fileId:n}){if(n===h5)return;let s=i,a,l=await Ba({fs:t,cache:e,gitdir:r,oid:i}),c=l.tree;return n===l.oid?a=l.path:(a=await Kx({fs:t,cache:e,gitdir:r,tree:c,fileId:n,oid:s}),Array.isArray(a)&&(a.length===0?a=void 0:a.length===1&&(a=a[0]))),a}u(BT,"resolveFileIdInTree");async function Kx({fs:t,cache:e,gitdir:r,tree:i,fileId:n,oid:s,filepaths:a=[],parentPath:l=""}){let c=i.entries().map(function(o){let f;return o.oid===n?(f=C(l,o.path),a.push(f)):o.type==="tree"&&(f=ge({fs:t,cache:e,gitdir:r,oid:o.oid}).then(function({object:h}){return Kx({fs:t,cache:e,gitdir:r,tree:Rt.from(h),fileId:n,oid:s,filepaths:a,parentPath:C(l,o.path)})})),f});return await Promise.all(c),a}u(Kx,"_resolveFileId");async function d5({fs:t,cache:e,gitdir:r,filepath:i,ref:n,depth:s,since:a,force:l,follow:c}){let o=typeof a>"u"?void 0:Math.floor(a.valueOf()/1e3),f=[],h=await Nn.read({fs:t,gitdir:r}),d=await $.resolve({fs:t,gitdir:r,ref:n}),p=[await Ma({fs:t,cache:e,gitdir:r,oid:d})],m,w,g;function b(_){g&&i&&f.push(_)}for(u(b,"endCommit");p.length>0;){let _=p.pop();if(o!==void 0&&_.commit.committer.timestamp<=o)break;if(i){let S;try{S=await sc({fs:t,cache:e,gitdir:r,oid:_.commit.tree,filepath:i}),w&&m!==S&&f.push(w),m=S,w=_,g=!0}catch(F){if(F instanceof pe){let k=c&&m;if(k&&(k=await BT({fs:t,cache:e,gitdir:r,oid:_.commit.tree,fileId:m}),k))if(Array.isArray(k)){if(w){let A=await BT({fs:t,cache:e,gitdir:r,oid:w.commit.tree,fileId:m});if(Array.isArray(A))if(k=k.filter(v=>A.indexOf(v)===-1),k.length===1)k=k[0],i=k,w&&f.push(w);else{k=!1,w&&f.push(w);break}}}else i=k,w&&f.push(w);if(!k){if(g&&m&&(f.push(w),!l))break;if(!l&&!c)throw F}w=_,g=!1}else throw F}}else f.push(_);if(s!==void 0&&f.length===s){b(_);break}if(!h.has(_.oid))for(let S of _.commit.parent){let F=await Ma({fs:t,cache:e,gitdir:r,oid:S});p.map(k=>k.oid).includes(F.oid)||p.push(F)}p.length===0&&b(_),p.sort((S,F)=>u5(S.commit,F.commit))}return f}u(d5,"_log");async function Jx({fs:t,dir:e,gitdir:r=C(e,".git"),filepath:i,ref:n="HEAD",depth:s,since:a,force:l,follow:c,cache:o={}}){try{return O("fs",t),O("gitdir",r),O("ref",n),await d5({fs:new M(t),cache:o,gitdir:r,filepath:i,ref:n,depth:s,since:a,force:l,follow:c})}catch(f){throw f.caller="git.log",f}}u(Jx,"log");async function Yx({fs:t,onSign:e,dir:r,gitdir:i=C(r,".git"),ours:n,theirs:s,fastForward:a=!0,fastForwardOnly:l=!1,dryRun:c=!1,noUpdateBranch:o=!1,abortOnConflict:f=!0,message:h,author:d,committer:p,signingKey:m,cache:w={},mergeDriver:g,allowUnrelatedHistories:b=!1}){try{O("fs",t),m&&O("onSign",e);let _=new M(t),S=await ji({fs:_,gitdir:i,author:d});if(!S&&(!l||!a))throw new ft("author");let F=await La({fs:_,gitdir:i,author:S,committer:p});if(!F&&(!l||!a))throw new ft("committer");return await Ex({fs:_,cache:w,dir:r,gitdir:i,ours:n,theirs:s,fastForward:a,fastForwardOnly:l,dryRun:c,noUpdateBranch:o,abortOnConflict:f,message:h,author:S,committer:F,signingKey:m,onSign:e,mergeDriver:g,allowUnrelatedHistories:b})}catch(_){throw _.caller="git.merge",_}}u(Yx,"merge");var p5={commit:16,tree:32,blob:48,tag:64,ofs_delta:96,ref_delta:112};async function Xx({fs:t,cache:e,dir:r,gitdir:i=C(r,".git"),oids:n}){let s=new MT,a=[];function l(f,h){let d=Buffer.from(f,h);a.push(d),s.update(d)}u(l,"write");async function c({stype:f,object:h}){let d=p5[f],p=h.length,m=p>15?128:0,w=p&15;p=p>>>4;let g=(m|d|w).toString(16);for(l(g,"hex");m;)m=p>127?128:0,g=m|p&127,l(Qy(2,g),"hex"),p=p>>>7;l(Buffer.from(await YT(h)))}u(c,"writeObject"),l("PACK"),l("00000002","hex"),l(Qy(8,n.length),"hex");for(let f of n){let{type:h,object:d}=await ge({fs:t,cache:e,gitdir:i,oid:f});await c({write:l,object:d,stype:h})}let o=s.digest();return a.push(o),a}u(Xx,"_pack");async function m5({fs:t,cache:e,gitdir:r,oids:i,write:n}){let s=await Xx({fs:t,cache:e,gitdir:r,oids:i}),a=Buffer.from(await eh(s)),c=`pack-${a.slice(-20).toString("hex")}.pack`;return n?(await t.write(C(r,`objects/pack/${c}`),a),{filename:c}):{filename:c,packfile:new Uint8Array(a)}}u(m5,"_packObjects");async function Qx({fs:t,dir:e,gitdir:r=C(e,".git"),oids:i,write:n=!1,cache:s={}}){try{return O("fs",t),O("gitdir",r),O("oids",i),await m5({fs:new M(t),cache:s,gitdir:r,oids:i,write:n})}catch(a){throw a.caller="git.packObjects",a}}u(Qx,"packObjects");async function eO({fs:t,http:e,onProgress:r,onMessage:i,onAuth:n,onAuthSuccess:s,onAuthFailure:a,dir:l,gitdir:c=C(l,".git"),ref:o,url:f,remote:h,remoteRef:d,prune:p=!1,pruneTags:m=!1,fastForward:w=!0,fastForwardOnly:g=!1,corsProxy:b,singleBranch:_,headers:S={},author:F,committer:k,signingKey:A,cache:v={}}){try{O("fs",t),O("gitdir",c);let T=new M(t),E=await ji({fs:T,gitdir:c,author:F});if(!E)throw new ft("author");let R=await La({fs:T,gitdir:c,author:E,committer:k});if(!R)throw new ft("committer");return await Fx({fs:T,cache:v,http:e,onProgress:r,onMessage:i,onAuth:n,onAuthSuccess:s,onAuthFailure:a,dir:l,gitdir:c,ref:o,url:f,remote:h,remoteRef:d,fastForward:w,fastForwardOnly:g,corsProxy:b,singleBranch:_,headers:S,author:E,committer:R,signingKey:A,prune:p,pruneTags:m})}catch(T){throw T.caller="git.pull",T}}u(eO,"pull");async function w5({fs:t,cache:e,dir:r,gitdir:i=C(r,".git"),start:n,finish:s}){let a=await Nn.read({fs:t,gitdir:i}),l=new Set,c=new Set;for(let h of n)l.add(await $.resolve({fs:t,gitdir:i,ref:h}));for(let h of s)try{let d=await $.resolve({fs:t,gitdir:i,ref:h});c.add(d)}catch{}let o=new Set;async function f(h){o.add(h);let{type:d,object:p}=await ge({fs:t,cache:e,gitdir:i,oid:h});if(d==="tag"){let w=qt.from(p).headers().object;return f(w)}if(d!=="commit")throw new _t(h,d,"commit");if(!a.has(h)){let w=At.from(p).headers().parent;for(h of w)!c.has(h)&&!o.has(h)&&await f(h)}}u(f,"walk");for(let h of l)await f(h);return o}u(w5,"listCommitsAndTags");async function jy({fs:t,cache:e,dir:r,gitdir:i=C(r,".git"),oids:n}){let s=new Set;async function a(l){if(s.has(l))return;s.add(l);let{type:c,object:o}=await ge({fs:t,cache:e,gitdir:i,oid:l});if(c==="tag"){let h=qt.from(o).headers().object;await a(h)}else if(c==="commit"){let h=At.from(o).headers().tree;await a(h)}else if(c==="tree"){let f=Rt.from(o);for(let h of f)h.type==="blob"&&s.add(h.oid),h.type==="tree"&&await a(h.oid)}}u(a,"walk");for(let l of n)await a(l);return s}u(jy,"listObjects");async function y5(t){let e={},r="",i=Te.streamReader(t),n=await i();for(;n!==!0;)n!==null&&(r+=n.toString("utf8")+`
|
|
95
95
|
`),n=await i();let s=r.toString("utf8").split(`
|
|
96
|
-
`);if(n=s.shift(),!n.startsWith("unpack "))throw new
|
|
97
|
-
`)),i="";return r.push(
|
|
98
|
-
- ${
|
|
99
|
-
`,author:
|
|
96
|
+
`);if(n=s.shift(),!n.startsWith("unpack "))throw new Pn('unpack ok" or "unpack [error message]',n);e.ok=n==="unpack ok",e.ok||(e.error=n.slice(7)),e.refs={};for(let a of s){if(a.trim()==="")continue;let l=a.slice(0,2),c=a.slice(3),o=c.indexOf(" ");o===-1&&(o=c.length);let f=c.slice(0,o),h=c.slice(o+1);e.refs[f]={ok:l==="ok",error:h}}return e}u(y5,"parseReceivePackResponse");async function g5({capabilities:t=[],triplets:e=[]}){let r=[],i=`\0 ${t.join(" ")}`;for(let n of e)r.push(Te.encode(`${n.oldoid} ${n.oid} ${n.fullRef}${i}
|
|
97
|
+
`)),i="";return r.push(Te.flush()),r}u(g5,"writeReceivePackRequest");async function b5({fs:t,cache:e,http:r,onProgress:i,onMessage:n,onAuth:s,onAuthSuccess:a,onAuthFailure:l,onPrePush:c,gitdir:o,ref:f,remoteRef:h,remote:d,url:p,force:m=!1,delete:w=!1,corsProxy:g,headers:b={}}){let _=f||await Ui({fs:t,gitdir:o});if(typeof _>"u")throw new Ot("ref");let S=await Oe.get({fs:t,gitdir:o});d=d||await S.get(`branch.${_}.pushRemote`)||await S.get("remote.pushDefault")||await S.get(`branch.${_}.remote`)||"origin";let F=p||await S.get(`remote.${d}.pushurl`)||await S.get(`remote.${d}.url`);if(typeof F>"u")throw new Ot("remote OR url");let k=h||await S.get(`branch.${_}.merge`);if(typeof F>"u")throw new Ot("remoteRef");g===void 0&&(g=await S.get("http.corsProxy"));let A=await $.expand({fs:t,gitdir:o,ref:_}),v=w?"0000000000000000000000000000000000000000":await $.resolve({fs:t,gitdir:o,ref:A}),T=qa.getRemoteHelperFor({url:F}),E=await T.discover({http:r,onAuth:s,onAuthSuccess:a,onAuthFailure:l,corsProxy:g,service:"git-receive-pack",url:F,headers:b,protocolVersion:1}),R=E.auth,P;if(!k)P=A;else try{P=await $.expandAgainstMap({ref:k,map:E.refs})}catch(he){if(he instanceof pe)P=k.startsWith("refs/")?k:`refs/heads/${k}`;else throw he}let I=E.refs.get(P)||"0000000000000000000000000000000000000000";if(c&&!await c({remote:d,url:F,localRef:{ref:w?"(delete)":A,oid:v},remoteRef:{ref:P,oid:I}}))throw new $a;let B=!E.capabilities.has("no-thin"),z=new Set;if(!w){let he=[...E.refs.values()],kt=new Set;if(I!=="0000000000000000000000000000000000000000"){let De=await sg({fs:t,cache:e,gitdir:o,oids:[v,I]});for(let le of De)he.push(le);B&&(kt=await jy({fs:t,cache:e,gitdir:o,oids:De}))}if(!he.includes(v)){let De=await w5({fs:t,cache:e,gitdir:o,start:[v],finish:he});z=await jy({fs:t,cache:e,gitdir:o,oids:De})}if(B){try{let De=await $.resolve({fs:t,gitdir:o,ref:`refs/remotes/${d}/HEAD`,depth:2}),{oid:le}=await $.resolveAgainstMap({ref:De.replace(`refs/remotes/${d}/`,""),fullref:De,map:E.refs}),Re=[le];for(let ke of await jy({fs:t,cache:e,gitdir:o,oids:Re}))kt.add(ke)}catch{}for(let De of kt)z.delete(De)}if(v===I&&(m=!0),!m){if(A.startsWith("refs/tags")&&I!=="0000000000000000000000000000000000000000")throw new Ia("tag-exists");if(v!=="0000000000000000000000000000000000000000"&&I!=="0000000000000000000000000000000000000000"&&!await Lx({fs:t,cache:e,gitdir:o,oid:v,ancestor:I,depth:-1}))throw new Ia("not-fast-forward")}}let we=ux([...E.capabilities],["report-status","side-band-64k",`agent=${Hh.agent}`]),st=await g5({capabilities:we,triplets:[{oldoid:I,oid:v,fullRef:P}]}),Dt=w?[]:await Xx({fs:t,cache:e,gitdir:o,oids:[...z]}),Ft=await T.connect({http:r,onProgress:i,corsProxy:g,service:"git-receive-pack",url:F,auth:R,headers:b,body:[...st,...Dt]}),{packfile:Vo,progress:us}=await th.demux(Ft.body);if(n){let he=hx(us);oc(he,async kt=>{await n(kt)})}let wt=await y5(Vo);if(Ft.headers&&(wt.headers=Ft.headers),d&&wt.ok&&wt.refs[P].ok&&!A.startsWith("refs/tags")){let he=`refs/remotes/${d}/${P.replace("refs/heads","")}`;w?await $.deleteRef({fs:t,gitdir:o,ref:he}):await $.writeRef({fs:t,gitdir:o,ref:he,value:v})}if(wt.ok&&Object.values(wt.refs).every(he=>he.ok))return wt;{let he=Object.entries(wt.refs).filter(([kt,De])=>!De.ok).map(([kt,De])=>`
|
|
98
|
+
- ${kt}: ${De.error}`).join("");throw new Kl(he,wt)}}u(b5,"_push");async function tO({fs:t,http:e,onProgress:r,onMessage:i,onAuth:n,onAuthSuccess:s,onAuthFailure:a,onPrePush:l,dir:c,gitdir:o=C(c,".git"),ref:f,remoteRef:h,remote:d="origin",url:p,force:m=!1,delete:w=!1,corsProxy:g,headers:b={},cache:_={}}){try{return O("fs",t),O("http",e),O("gitdir",o),await b5({fs:new M(t),cache:_,http:e,onProgress:r,onMessage:i,onAuth:n,onAuthSuccess:s,onAuthFailure:a,onPrePush:l,gitdir:o,ref:f,remoteRef:h,remote:d,url:p,force:m,delete:w,corsProxy:g,headers:b})}catch(S){throw S.caller="git.push",S}}u(tO,"push");async function rO({fs:t,cache:e,gitdir:r,oid:i}){let{type:n,object:s}=await ge({fs:t,cache:e,gitdir:r,oid:i});if(n==="tag")return i=qt.from(s).parse().object,rO({fs:t,cache:e,gitdir:r,oid:i});if(n!=="blob")throw new _t(i,n,"blob");return{oid:i,blob:new Uint8Array(s)}}u(rO,"resolveBlob");async function iO({fs:t,cache:e,gitdir:r,oid:i,filepath:n=void 0}){return n!==void 0&&(i=await sc({fs:t,cache:e,gitdir:r,oid:i,filepath:n})),await rO({fs:t,cache:e,gitdir:r,oid:i})}u(iO,"_readBlob");async function nO({fs:t,dir:e,gitdir:r=C(e,".git"),oid:i,filepath:n,cache:s={}}){try{return O("fs",t),O("gitdir",r),O("oid",i),await iO({fs:new M(t),cache:s,gitdir:r,oid:i,filepath:n})}catch(a){throw a.caller="git.readBlob",a}}u(nO,"readBlob");async function ag({fs:t,dir:e,gitdir:r=C(e,".git"),oid:i,cache:n={}}){try{return O("fs",t),O("gitdir",r),O("oid",i),await Ma({fs:new M(t),cache:n,gitdir:r,oid:i})}catch(s){throw s.caller="git.readCommit",s}}u(ag,"readCommit");async function _5({fs:t,cache:e,gitdir:r,ref:i="refs/notes/commits",oid:n}){let s=await $.resolve({gitdir:r,fs:t,ref:i}),{blob:a}=await iO({fs:t,cache:e,gitdir:r,oid:s,filepath:n});return a}u(_5,"_readNote");async function sO({fs:t,dir:e,gitdir:r=C(e,".git"),ref:i="refs/notes/commits",oid:n,cache:s={}}){try{return O("fs",t),O("gitdir",r),O("ref",i),O("oid",n),await _5({fs:new M(t),cache:s,gitdir:r,ref:i,oid:n})}catch(a){throw a.caller="git.readNote",a}}u(sO,"readNote");async function aO({fs:t,dir:e,gitdir:r=C(e,".git"),oid:i,format:n="parsed",filepath:s=void 0,encoding:a=void 0,cache:l={}}){try{O("fs",t),O("gitdir",r),O("oid",i);let c=new M(t);s!==void 0&&(i=await sc({fs:c,cache:l,gitdir:r,oid:i,filepath:s}));let f=await ge({fs:c,cache:l,gitdir:r,oid:i,format:n==="parsed"?"content":n});if(f.oid=i,n==="parsed")switch(f.format="parsed",f.type){case"commit":f.object=At.from(f.object).parse();break;case"tree":f.object=Rt.from(f.object).entries();break;case"blob":a?f.object=f.object.toString(a):(f.object=new Uint8Array(f.object),f.format="content");break;case"tag":f.object=qt.from(f.object).parse();break;default:throw new _t(f.oid,f.type,"blob|commit|tag|tree")}else(f.format==="deflated"||f.format==="wrapped")&&(f.type=f.format);return f}catch(c){throw c.caller="git.readObject",c}}u(aO,"readObject");async function v5({fs:t,cache:e,gitdir:r,oid:i}){let{type:n,object:s}=await ge({fs:t,cache:e,gitdir:r,oid:i,format:"content"});if(n!=="tag")throw new _t(i,n,"tag");let a=qt.from(s);return{oid:i,tag:a.parse(),payload:a.payload()}}u(v5,"_readTag");async function oO({fs:t,dir:e,gitdir:r=C(e,".git"),oid:i,cache:n={}}){try{return O("fs",t),O("gitdir",r),O("oid",i),await v5({fs:new M(t),cache:n,gitdir:r,oid:i})}catch(s){throw s.caller="git.readTag",s}}u(oO,"readTag");async function lO({fs:t,dir:e,gitdir:r=C(e,".git"),oid:i,filepath:n=void 0,cache:s={}}){try{return O("fs",t),O("gitdir",r),O("oid",i),await Wa({fs:new M(t),cache:s,gitdir:r,oid:i,filepath:n})}catch(a){throw a.caller="git.readTree",a}}u(lO,"readTree");async function cO({fs:t,dir:e,gitdir:r=C(e,".git"),filepath:i,cache:n={}}){try{O("fs",t),O("gitdir",r),O("filepath",i),await Pe.acquire({fs:new M(t),gitdir:r,cache:n},async function(s){s.delete({filepath:i})})}catch(s){throw s.caller="git.remove",s}}u(cO,"remove");async function S5({fs:t,cache:e,onSign:r,gitdir:i,ref:n="refs/notes/commits",oid:s,author:a,committer:l,signingKey:c}){let o;try{o=await $.resolve({gitdir:i,fs:t,ref:n})}catch(m){if(!(m instanceof pe))throw m}let h=(await Wa({fs:t,cache:e,gitdir:i,oid:o||"4b825dc642cb6eb9a060e54bf8d69288fbee4904"})).tree;h=h.filter(m=>m.path!==s);let d=await ac({fs:t,gitdir:i,tree:h});return await Wh({fs:t,cache:e,onSign:r,gitdir:i,ref:n,tree:d,parent:o&&[o],message:`Note removed by 'isomorphic-git removeNote'
|
|
99
|
+
`,author:a,committer:l,signingKey:c})}u(S5,"_removeNote");async function fO({fs:t,onSign:e,dir:r,gitdir:i=C(r,".git"),ref:n="refs/notes/commits",oid:s,author:a,committer:l,signingKey:c,cache:o={}}){try{O("fs",t),O("gitdir",i),O("oid",s);let f=new M(t),h=await ji({fs:f,gitdir:i,author:a});if(!h)throw new ft("author");let d=await La({fs:f,gitdir:i,author:h,committer:l});if(!d)throw new ft("committer");return await S5({fs:f,cache:o,onSign:e,gitdir:i,ref:n,oid:s,author:h,committer:d,signingKey:c})}catch(f){throw f.caller="git.removeNote",f}}u(fO,"removeNote");async function E5({fs:t,gitdir:e,oldref:r,ref:i,checkout:n=!1}){if(!nc(i,!0))throw new pr(i,jl.clean(i));if(!nc(r,!0))throw new pr(r,jl.clean(r));let s=`refs/heads/${r}`,a=`refs/heads/${i}`;if(await $.exists({fs:t,gitdir:e,ref:a}))throw new dr("branch",i,!1);let c=await $.resolve({fs:t,gitdir:e,ref:s,depth:1});await $.writeRef({fs:t,gitdir:e,ref:a,value:c}),await $.deleteRef({fs:t,gitdir:e,ref:s});let f=await Ui({fs:t,gitdir:e,fullname:!0})===s;(n||f)&&await $.writeSymbolicRef({fs:t,gitdir:e,ref:"HEAD",value:a})}u(E5,"_renameBranch");async function uO({fs:t,dir:e,gitdir:r=C(e,".git"),ref:i,oldref:n,checkout:s=!1}){try{return O("fs",t),O("gitdir",r),O("ref",i),O("oldref",n),await E5({fs:new M(t),gitdir:r,ref:i,oldref:n,checkout:s})}catch(a){throw a.caller="git.renameBranch",a}}u(uO,"renameBranch");async function hO({gitdir:t,type:e,object:r}){return si($i.wrap({type:e,object:r}))}u(hO,"hashObject$1");async function dO({fs:t,dir:e,gitdir:r=C(e,".git"),filepath:i,ref:n,cache:s={}}){try{O("fs",t),O("gitdir",r),O("filepath",i);let a=new M(t),l,c;try{l=await $.resolve({fs:a,gitdir:r,ref:n||"HEAD"})}catch(h){if(n)throw h}if(l)try{l=await sc({fs:a,cache:s,gitdir:r,oid:l,filepath:i})}catch{l=null}let o={ctime:new Date(0),mtime:new Date(0),dev:0,ino:0,mode:0,uid:0,gid:0,size:0},f=e&&await a.read(C(e,i));f&&(c=await hO({gitdir:r,type:"blob",object:f}),l===c&&(o=await a.lstat(C(e,i)))),await Pe.acquire({fs:a,gitdir:r,cache:s},async function(h){h.delete({filepath:i}),l&&h.insert({filepath:i,stats:o,oid:l})})}catch(a){throw a.caller="git.reset",a}}u(dO,"resetIndex");async function pO({fs:t,dir:e,gitdir:r=C(e,".git"),ref:i,depth:n}){try{return O("fs",t),O("gitdir",r),O("ref",i),await $.resolve({fs:new M(t),gitdir:r,ref:i,depth:n})}catch(s){throw s.caller="git.resolveRef",s}}u(pO,"resolveRef");async function mO({fs:t,dir:e,gitdir:r=C(e,".git"),path:i,value:n,append:s=!1}){try{O("fs",t),O("gitdir",r),O("path",i);let a=new M(t),l=await Oe.get({fs:a,gitdir:r});s?await l.append(i,n):await l.set(i,n),await Oe.save({fs:a,gitdir:r,config:l})}catch(a){throw a.caller="git.setConfig",a}}u(mO,"setConfig");async function wO({fs:t,gitdir:e,commit:r}){let i=At.from(r).toObject();return await Pt({fs:t,gitdir:e,type:"commit",object:i,format:"content"})}u(wO,"_writeCommit");var qh=class qh{static get timezoneOffsetForRefLogEntry(){let e=new Date().getTimezoneOffset(),r=Math.abs(Math.floor(e/60)),i=Math.abs(e%60).toString().padStart(2,"0");return`${e>0?"-":"+"}${r.toString().padStart(2,"0")}${i}`}static createStashReflogEntry(e,r,i){let n=e.name.replace(/\s/g,""),s="0000000000000000000000000000000000000000",a=Math.floor(Date.now()/1e3),l=qh.timezoneOffsetForRefLogEntry;return`${s} ${r} ${n} ${e.email} ${a} ${l} ${i}
|
|
100
100
|
`}static getStashReflogEntry(e,r=!1){return e.split(`
|
|
101
|
-
`).filter(s=>s).reverse().map((s,
|
|
101
|
+
`).filter(s=>s).reverse().map((s,a)=>r?`stash@{${a}}: ${s.split(" ")[1]}`:s)}};u(qh,"GitRefStash");var rh=qh,F5={stage:Cn,workdir:za},qy;async function Ua(t,e){return qy===void 0&&(qy=new Ml),qy.acquire(t,e)}u(Ua,"acquireLock$1");async function k5(t,e,r,i,n=null){let s=C(r,i),a=await t.lstat(s);if(!a)throw new pe(s);if(a.isDirectory())throw new H(`${s}: file expected, but found directory`);let l=n?await HT({fs:t,gitdir:e,oid:n}):void 0,c=l?n:void 0;return l||await Ua({fs:t,gitdir:e,currentFilepath:s},async()=>{let o=a.isSymbolicLink()?await t.readlink(s).then(XT):await t.read(s);if(o===null)throw new pe(s);c=await Pt({fs:t,gitdir:e,type:"blob",object:o})}),c}u(k5,"checkAndWriteBlob");async function T5({fs:t,dir:e,gitdir:r,entries:i}){async function n(s){if(s.type==="tree"){if(!s.oid){let a=await Promise.all(s.children.map(n));s.oid=await ac({fs:t,gitdir:r,tree:a}),s.mode=16384}}else s.type==="blob"&&(s.oid=await k5(t,r,e,s.path,s.oid),s.mode=33188);return s.path=s.path.split("/").pop(),s}return u(n,"processTreeEntry"),Promise.all(i.map(n))}u(T5,"processTreeEntries");async function LT({fs:t,dir:e,gitdir:r,treePair:i}){let n=i[1]==="stage",s=i.map(p=>typeof p=="string"?F5[p]():p),a=[],f=await Li({fs:t,cache:{},dir:e,gitdir:r,trees:s,map:u(async(p,[m,w])=>{if(!(p==="."||await Mi.isIgnored({fs:t,dir:e,gitdir:r,filepath:p}))&&w)return(!m||await m.oid()!==await w.oid()&&await w.oid()!==void 0)&&a.push([m,w]),{mode:await w.mode(),path:p,oid:await w.oid(),type:await w.type()}},"map"),reduce:u(async(p,m)=>(m=m.filter(Boolean),p?(p.children=m,p):m.length>0?m:void 0),"reduce"),iterate:u(async(p,m)=>{let w=[];for(let g of m){let[b,_]=g;n?_&&(await t.exists(`${e}/${_.toString()}`)?w.push(g):a.push([null,_])):b&&(_?w.push(g):a.push([b,null]))}return w.length?Promise.all(w.map(p)):[]},"iterate")});if(a.length===0||f.length===0)return null;let d=(await T5({fs:t,dir:e,gitdir:r,entries:f})).filter(Boolean).map(p=>({mode:p.mode,path:p.path,oid:p.oid,type:p.type}));return ac({fs:t,gitdir:r,tree:d})}u(LT,"writeTreeChanges");async function x5({fs:t,dir:e,gitdir:r,stashCommit:i,parentCommit:n,wasStaged:s}){let a=[],l=[],c=await Li({fs:t,cache:{},dir:e,gitdir:r,trees:[jt({ref:n}),jt({ref:i})],map:u(async(o,[f,h])=>{if(o==="."||await Mi.isIgnored({fs:t,dir:e,gitdir:r,filepath:o}))return;let d=h?await h.type():await f.type();if(d!=="tree"&&d!=="blob")return;if(!h&&f){let m=d==="tree"?"rmdir":"rm";return d==="tree"&&a.push(o),d==="blob"&&s&&l.push({filepath:o,oid:await f.oid()}),{method:m,filepath:o}}let p=await h.oid();if(!f||await f.oid()!==p)return d==="tree"?{method:"mkdir",filepath:o}:(s&&l.push({filepath:o,oid:p,stats:await t.lstat(C(e,o))}),{method:"write",filepath:o,oid:p})},"map")});await Ua({fs:t,gitdir:r,dirRemoved:a,ops:c},async()=>{for(let o of c){let f=C(e,o.filepath);switch(o.method){case"rmdir":await t.rmdir(f);break;case"mkdir":await t.mkdir(f);break;case"rm":await t.rm(f);break;case"write":if(!a.some(h=>f.startsWith(h))){let{object:h}=await ge({fs:t,cache:{},gitdir:r,oid:o.oid});await t.exists(f)&&await t.rm(f),await t.write(f,h)}break}}}),await Pe.acquire({fs:t,gitdir:r,cache:{}},async o=>{l.forEach(({filepath:f,stats:h,oid:d})=>{o.insert({filepath:f,stats:h,oid:d})})})}u(x5,"applyTreeChanges");var xa=class xa{constructor({fs:e,dir:r,gitdir:i=C(r,".git")}){Object.assign(this,{fs:e,dir:r,gitdir:i,_author:null})}static get refStash(){return"refs/stash"}static get refLogsStash(){return"logs/refs/stash"}get refStashPath(){return C(this.gitdir,xa.refStash)}get refLogsStashPath(){return C(this.gitdir,xa.refLogsStash)}async getAuthor(){if(!this._author&&(this._author=await ji({fs:this.fs,gitdir:this.gitdir,author:{}}),!this._author))throw new ft("author");return this._author}async getStashSHA(e,r){return await this.fs.exists(this.refStashPath)?(r||await this.readStashReflogs({parsed:!1}))[e].split(" ")[1]:null}async writeStashCommit({message:e,tree:r,parent:i}){return wO({fs:this.fs,gitdir:this.gitdir,commit:{message:e,tree:r,parent:i,author:await this.getAuthor(),committer:await this.getAuthor()}})}async readStashCommit(e){let r=await this.readStashReflogs({parsed:!1});if(e!==0&&(e<0||e>r.length-1))throw new pr(`stash@${e}`,"number that is in range of [0, num of stash pushed]");let i=await this.getStashSHA(e,r);return i?Ma({fs:this.fs,cache:{},gitdir:this.gitdir,oid:i}):{}}async writeStashRef(e){return $.writeRef({fs:this.fs,gitdir:this.gitdir,ref:xa.refStash,value:e})}async writeStashReflogEntry({stashCommit:e,message:r}){let i=await this.getAuthor(),n=rh.createStashReflogEntry(i,e,r),s=this.refLogsStashPath;await Ua({filepath:s,entry:n},async()=>{let a=await this.fs.exists(s)?await this.fs.read(s,"utf8"):"";await this.fs.write(s,a+n,"utf8")})}async readStashReflogs({parsed:e=!1}){if(!await this.fs.exists(this.refLogsStashPath))return[];let r=await this.fs.read(this.refLogsStashPath,"utf8");return rh.getStashReflogEntry(r,e)}};u(xa,"GitStashManager");var Dn=xa;async function yO({fs:t,dir:e,gitdir:r,message:i=""}){let n=new Dn({fs:t,dir:e,gitdir:r});await n.getAuthor();let s=await Ui({fs:t,gitdir:r,fullname:!1}),a=await $.resolve({fs:t,gitdir:r,ref:"HEAD"}),c=(await ag({fs:t,dir:e,gitdir:r,oid:a})).commit.message,o=[a],f=null,h=jt({ref:"HEAD"}),d=await LT({fs:t,dir:e,gitdir:r,treePair:[jt({ref:"HEAD"}),"stage"]});if(d){let g=await n.writeStashCommit({message:`stash-Index: WIP on ${s} - ${new Date().toISOString()}`,tree:d,parent:o});o.push(g),f=d,h=Cn()}let p=await LT({fs:t,dir:e,gitdir:r,treePair:[h,"workdir"]});if(p){let g=await n.writeStashCommit({message:`stash-WorkDir: WIP on ${s} - ${new Date().toISOString()}`,tree:p,parent:[o[o.length-1]]});o.push(g),f=p}if(!f||!d&&!p)throw new pe("changes, nothing to stash");let m=(i.trim()||`WIP on ${s}`)+`: ${a.substring(0,7)} ${c}`;return{stashCommit:await n.writeStashCommit({message:m,tree:f,parent:o}),stashMsg:m,branch:s,stashMgr:n}}u(yO,"_createStashCommit");async function O5({fs:t,dir:e,gitdir:r,message:i=""}){let{stashCommit:n,stashMsg:s,branch:a,stashMgr:l}=await yO({fs:t,dir:e,gitdir:r,message:i});return await l.writeStashRef(n),await l.writeStashReflogEntry({stashCommit:n,message:s}),await ig({fs:t,dir:e,gitdir:r,ref:a,track:!1,force:!0}),n}u(O5,"_stashPush");async function R5({fs:t,dir:e,gitdir:r,message:i=""}){let{stashCommit:n}=await yO({fs:t,dir:e,gitdir:r,message:i});return n}u(R5,"_stashCreate");async function gO({fs:t,dir:e,gitdir:r,refIdx:i=0}){let s=await new Dn({fs:t,dir:e,gitdir:r}).readStashCommit(i),{parent:a=null}=s.commit?s.commit:{};if(!(!a||!Array.isArray(a)))for(let l=0;l<a.length-1;l++){let o=(await Ma({fs:t,cache:{},gitdir:r,oid:a[l+1]})).commit.message.startsWith("stash-Index");await x5({fs:t,dir:e,gitdir:r,stashCommit:a[l+1],parentCommit:a[l],wasStaged:o})}}u(gO,"_stashApply");async function bO({fs:t,dir:e,gitdir:r,refIdx:i=0}){let n=new Dn({fs:t,dir:e,gitdir:r});if(!(await n.readStashCommit(i)).commit)return;let a=n.refStashPath;await Ua(a,async()=>{await t.exists(a)&&await t.rm(a)});let l=await n.readStashReflogs({parsed:!1});if(!l.length)return;l.splice(i,1);let c=n.refLogsStashPath;await Ua({reflogEntries:l,stashReflogPath:c,stashMgr:n},async()=>{if(l.length){await t.write(c,l.reverse().join(`
|
|
102
102
|
`)+`
|
|
103
|
-
`,"utf8");let a=f[f.length-1].split(" ")[1];await n.writeStashRef(a)}else await t.rm(c)})}l(Fk,"_stashDrop");async function lq({fs:t,dir:e,gitdir:r}){return new sn({fs:t,dir:e,gitdir:r}).readStashReflogs({parsed:!0})}l(lq,"_stashList");async function fq({fs:t,dir:e,gitdir:r}){let i=new sn({fs:t,dir:e,gitdir:r}),n=[i.refStashPath,i.refLogsStashPath];await so(n,async()=>{await Promise.all(n.map(async s=>{if(await t.exists(s))return t.rm(s)}))})}l(fq,"_stashClear");async function uq({fs:t,dir:e,gitdir:r,refIdx:i=0}){await Ek({fs:t,dir:e,gitdir:r,refIdx:i}),await Fk({fs:t,dir:e,gitdir:r,refIdx:i})}l(uq,"_stashPop");async function Tk({fs:t,dir:e,gitdir:r=D(e,".git"),op:i="push",message:n="",refIdx:s=0}){k("fs",t),k("dir",e),k("gitdir",r),k("op",i);let o={push:aq,apply:Ek,drop:Fk,list:lq,clear:fq,pop:uq,create:cq},f=["apply","drop","pop"];try{let c=new L(t);["refs","logs","logs/refs"].map(h=>D(r,h)).forEach(async h=>{await c.exists(h)||await c.mkdir(h)});let u=o[i];if(u){if(f.includes(i)&&s<0)throw new Qt(`stash@${s}`,"number that is in range of [0, num of stash pushed]");return await u({fs:c,dir:e,gitdir:r,message:n,refIdx:s})}throw new Error(`To be implemented: ${i}`)}catch(c){throw c.caller="git.stash",c}}l(Tk,"stash");async function kk({fs:t,dir:e,gitdir:r=D(e,".git"),filepath:i,cache:n={}}){try{k("fs",t),k("gitdir",r),k("filepath",i);let s=new L(t);if(await di.isIgnored({fs:s,gitdir:r,dir:e,filepath:i}))return"ignored";let f=await hq({fs:s,cache:n,gitdir:r}),c=await Rk({fs:s,cache:n,gitdir:r,tree:f,path:i}),a=await Te.acquire({fs:s,gitdir:r,cache:n},async function(w){for(let y of w)if(y.path===i)return y;return null}),u=await s.lstat(D(e,i)),h=c!==null,d=a!==null,p=u!==null,m=l(async()=>{if(d&&!Lf(a,u))return a.oid;{let w=await s.read(D(e,i)),y=await yk({gitdir:r,type:"blob",object:w});return d&&a.oid===y&&u.size!==-1&&Te.acquire({fs:s,gitdir:r,cache:n},async function(g){g.insert({filepath:i,stats:u,oid:y})}),y}},"getWorkdirOid");if(!h&&!p&&!d)return"absent";if(!h&&!p&&d)return"*absent";if(!h&&p&&!d)return"*added";if(!h&&p&&d)return await m()===a.oid?"added":"*added";if(h&&!p&&!d)return"deleted";if(h&&!p&&d)return c===a.oid,"*deleted";if(h&&p&&!d)return await m()===c?"*undeleted":"*undeletemodified";if(h&&p&&d){let w=await m();return w===c?w===a.oid?"unmodified":"*unmodified":w===a.oid?"modified":"*modified"}}catch(s){throw s.caller="git.status",s}}l(kk,"status");async function Rk({fs:t,cache:e,gitdir:r,tree:i,path:n}){typeof n=="string"&&(n=n.split("/"));let s=n.shift();for(let o of i)if(o.path===s){if(n.length===0)return o.oid;let{type:f,object:c}=await de({fs:t,cache:e,gitdir:r,oid:o.oid});if(f==="tree"){let a=gt.from(c);return Rk({fs:t,cache:e,gitdir:r,tree:a,path:n})}if(f==="blob")throw new ut(o.oid,f,"blob",n.join("/"))}return null}l(Rk,"getOidAtPath");async function hq({fs:t,cache:e,gitdir:r}){let i;try{i=await $.resolve({fs:t,gitdir:r,ref:"HEAD"})}catch(s){if(s instanceof fe)return[]}let{tree:n}=await ao({fs:t,cache:e,gitdir:r,oid:i});return n}l(hq,"getHeadTree");async function Ok({fs:t,dir:e,gitdir:r=D(e,".git"),ref:i="HEAD",filepaths:n=["."],filter:s,cache:o={},ignored:f=!1}){try{k("fs",t),k("gitdir",r),k("ref",i);let c=new L(t);return await hi({fs:c,cache:o,dir:e,gitdir:r,trees:[Rt({ref:i}),oo(),on()],map:l(async function(a,[u,h,d]){if(!u&&!d&&h&&!f&&await di.isIgnored({fs:c,dir:e,filepath:a})||!n.some(P=>p1(a,P)))return null;if(s&&!s(a))return;let[p,m,w]=await Promise.all([u&&u.type(),h&&h.type(),d&&d.type()]),y=[p,m,w].includes("blob");if((p==="tree"||p==="special")&&!y)return;if(p==="commit")return null;if((m==="tree"||m==="special")&&!y)return;if(w==="commit")return null;if((w==="tree"||w==="special")&&!y)return;let g=p==="blob"?await u.oid():void 0,_=w==="blob"?await d.oid():void 0,F;p!=="blob"&&m==="blob"&&w!=="blob"?F="42":m==="blob"&&(F=await h.oid());let E=[void 0,g,F,_],R=E.map(P=>E.indexOf(P));return R.shift(),[a,...R]},"map")})}catch(c){throw c.caller="git.statusMatrix",c}}l(Ok,"statusMatrix");async function xk({fs:t,dir:e,gitdir:r=D(e,".git"),ref:i,object:n,force:s=!1}){try{k("fs",t),k("gitdir",r),k("ref",i);let o=new L(t);if(i===void 0)throw new yt("ref");i=i.startsWith("refs/tags/")?i:`refs/tags/${i}`;let f=await $.resolve({fs:o,gitdir:r,ref:n||"HEAD"});if(!s&&await $.exists({fs:o,gitdir:r,ref:i}))throw new Zt("tag",i);await $.writeRef({fs:o,gitdir:r,ref:i,value:f})}catch(o){throw o.caller="git.tag",o}}l(xk,"tag");async function Ak({fs:t,dir:e,gitdir:r=D(e,".git"),cache:i={},filepath:n,oid:s,mode:o,add:f,remove:c,force:a}){try{k("fs",t),k("gitdir",r),k("filepath",n);let u=new L(t);if(c)return await Te.acquire({fs:u,gitdir:r,cache:i},async function(d){if(!a){let p=await u.lstat(D(e,n));if(p){if(p.isDirectory())throw new ui("directory");return}}d.has({filepath:n})&&d.delete({filepath:n})});let h;if(!s){if(h=await u.lstat(D(e,n)),!h)throw new fe(`file at "${n}" on disk and "remove" not set`);if(h.isDirectory())throw new ui("directory")}return await Te.acquire({fs:u,gitdir:r,cache:i},async function(d){if(!f&&!d.has({filepath:n}))throw new fe(`file at "${n}" in index and "add" not set`);let p;if(s)p={ctime:new Date(0),mtime:new Date(0),dev:0,ino:0,mode:o,uid:0,gid:0,size:0};else{p=h;let m=p.isSymbolicLink()?await u.readlink(D(e,n)):await u.read(D(e,n));s=await _t({fs:u,gitdir:r,type:"blob",format:"content",object:m})}return d.insert({filepath:n,oid:s,stats:p}),s})}catch(u){throw u.caller="git.updateIndex",u}}l(Ak,"updateIndex$1");function Pk(){try{return Bu.version}catch(t){throw t.caller="git.version",t}}l(Pk,"version");async function Nk({fs:t,dir:e,gitdir:r=D(e,".git"),trees:i,map:n,reduce:s,iterate:o,cache:f={}}){try{return k("fs",t),k("gitdir",r),k("trees",i),await hi({fs:new L(t),cache:f,dir:e,gitdir:r,trees:i,map:n,reduce:s,iterate:o})}catch(c){throw c.caller="git.walk",c}}l(Nk,"walk");async function Ck({fs:t,dir:e,gitdir:r=D(e,".git"),blob:i}){try{return k("fs",t),k("gitdir",r),k("blob",i),await _t({fs:new L(t),gitdir:r,type:"blob",object:i,format:"content"})}catch(n){throw n.caller="git.writeBlob",n}}l(Ck,"writeBlob");async function Dk({fs:t,dir:e,gitdir:r=D(e,".git"),commit:i}){try{return k("fs",t),k("gitdir",r),k("commit",i),await Sk({fs:new L(t),gitdir:r,commit:i})}catch(n){throw n.caller="git.writeCommit",n}}l(Dk,"writeCommit");async function Ik({fs:t,dir:e,gitdir:r=D(e,".git"),type:i,object:n,format:s="parsed",oid:o,encoding:f=void 0}){try{let c=new L(t);if(s==="parsed"){switch(i){case"commit":n=bt.from(n).toObject();break;case"tree":n=gt.from(n).toObject();break;case"blob":n=Buffer.from(n,f);break;case"tag":n=Ot.from(n).toObject();break;default:throw new ut(o||"",i,"blob|commit|tag|tree")}s="content"}return o=await _t({fs:c,gitdir:r,type:i,object:n,oid:o,format:s}),o}catch(c){throw c.caller="git.writeObject",c}}l(Ik,"writeObject");async function $k({fs:t,dir:e,gitdir:r=D(e,".git"),ref:i,value:n,force:s=!1,symbolic:o=!1}){try{k("fs",t),k("gitdir",r),k("ref",i),k("value",n);let f=new L(t);if(!uc(i,!0))throw new Qt(i,Ga.clean(i));if(!s&&await $.exists({fs:f,gitdir:r,ref:i}))throw new Zt("ref",i);o?await $.writeSymbolicRef({fs:f,gitdir:r,ref:i,value:n}):(n=await $.resolve({fs:f,gitdir:r,ref:n}),await $.writeRef({fs:f,gitdir:r,ref:i,value:n}))}catch(f){throw f.caller="git.writeRef",f}}l($k,"writeRef");async function dq({fs:t,gitdir:e,tag:r}){let i=Ot.from(r).toObject();return await _t({fs:t,gitdir:e,type:"tag",object:i,format:"content"})}l(dq,"_writeTag");async function Bk({fs:t,dir:e,gitdir:r=D(e,".git"),tag:i}){try{return k("fs",t),k("gitdir",r),k("tag",i),await dq({fs:new L(t),gitdir:r,tag:i})}catch(n){throw n.caller="git.writeTag",n}}l(Bk,"writeTag");async function Mk({fs:t,dir:e,gitdir:r=D(e,".git"),tree:i}){try{return k("fs",t),k("gitdir",r),k("tree",i),await dc({fs:new L(t),gitdir:r,tree:i})}catch(n){throw n.caller="git.writeTree",n}}l(Mk,"writeTree");var pq={Errors:QT,STAGE:on,TREE:Rt,WORKDIR:oo,add:n1,abortMerge:t1,addNote:l1,addRemote:u1,annotatedTag:h1,branch:d1,checkout:$w,clone:b1,commit:_1,getConfig:I1,getConfigAll:$1,setConfig:_k,currentBranch:S1,deleteBranch:v1,deleteRef:E1,deleteRemote:F1,deleteTag:T1,expandOid:k1,expandRef:R1,fastForward:A1,fetch:P1,findMergeBase:N1,findRoot:D1,getRemoteInfo:B1,getRemoteInfo2:L1,hashBlob:j1,indexPack:q1,init:U1,isDescendent:z1,isIgnored:H1,listBranches:V1,listFiles:K1,listNotes:J1,listRefs:X1,listRemotes:Y1,listServerRefs:Z1,listTags:Q1,log:tk,merge:rk,packObjects:nk,pull:sk,push:ok,readBlob:lk,readCommit:Lw,readNote:fk,readObject:uk,readTag:hk,readTree:dk,remove:pk,removeNote:mk,renameBranch:wk,resetIndex:gk,updateIndex:Ak,resolveRef:bk,status:kk,statusMatrix:Ok,tag:xk,version:Pk,walk:Nk,writeBlob:Ck,writeCommit:Dk,writeObject:Ik,writeRef:$k,writeTag:Bk,writeTree:Mk,stash:Tk};B.Errors=QT;B.STAGE=on;B.TREE=Rt;B.WORKDIR=oo;B.abortMerge=t1;B.add=n1;B.addNote=l1;B.addRemote=u1;B.annotatedTag=h1;B.branch=d1;B.checkout=$w;B.clone=b1;B.commit=_1;B.currentBranch=S1;B.default=pq;B.deleteBranch=v1;B.deleteRef=E1;B.deleteRemote=F1;B.deleteTag=T1;B.expandOid=k1;B.expandRef=R1;B.fastForward=A1;B.fetch=P1;B.findMergeBase=N1;B.findRoot=D1;B.getConfig=I1;B.getConfigAll=$1;B.getRemoteInfo=B1;B.getRemoteInfo2=L1;B.hashBlob=j1;B.indexPack=q1;B.init=U1;B.isDescendent=z1;B.isIgnored=H1;B.listBranches=V1;B.listFiles=K1;B.listNotes=J1;B.listRefs=X1;B.listRemotes=Y1;B.listServerRefs=Z1;B.listTags=Q1;B.log=tk;B.merge=rk;B.packObjects=nk;B.pull=sk;B.push=ok;B.readBlob=lk;B.readCommit=Lw;B.readNote=fk;B.readObject=uk;B.readTag=hk;B.readTree=dk;B.remove=pk;B.removeNote=mk;B.renameBranch=wk;B.resetIndex=gk;B.resolveRef=bk;B.setConfig=_k;B.stash=Tk;B.status=kk;B.statusMatrix=Ok;B.tag=xk;B.updateIndex=Ak;B.version=Pk;B.walk=Nk;B.writeBlob=Ck;B.writeCommit=Dk;B.writeObject=Ik;B.writeRef=$k;B.writeTag=Bk;B.writeTree=Mk});var jk=T((HJ,Lk)=>{Lk.exports=function(t,e){var r=[];t.on("data",function(i){r.push(i)}),t.once("end",function(){e&&e(null,Buffer.concat(r)),e=null}),t.once("error",function(i){e&&e(i),e=null})}});var Uk=T((VJ,qk)=>{"use strict";var mq=["aborted","complete","headers","httpVersion","httpVersionMinor","httpVersionMajor","method","rawHeaders","rawTrailers","setTimeout","socket","statusCode","statusMessage","trailers","url"];qk.exports=(t,e)=>{if(e._readableState.autoDestroy)throw new Error("The second stream must have the `autoDestroy` option set to `false`");let r=new Set(Object.keys(t).concat(mq)),i={};for(let n of r)n in e||(i[n]={get(){let s=t[n];return typeof s=="function"?s.bind(t):s},set(s){t[n]=s},enumerable:!0,configurable:!1});return Object.defineProperties(e,i),t.once("aborted",()=>{e.destroy(),e.emit("aborted")}),t.once("close",()=>{t.complete&&e.readable?e.once("end",()=>{e.emit("close")}):e.emit("close")}),e}});var zk=T((GJ,Wk)=>{"use strict";var{Transform:wq,PassThrough:yq}=ne("stream"),iy=ne("zlib"),gq=Uk();Wk.exports=t=>{let e=(t.headers["content-encoding"]||"").toLowerCase();if(!["gzip","deflate","br"].includes(e))return t;let r=e==="br";if(r&&typeof iy.createBrotliDecompress!="function")return t.destroy(new Error("Brotli is not supported on Node.js < 12")),t;let i=!0,n=new wq({transform(f,c,a){i=!1,a(null,f)},flush(f){f()}}),s=new yq({autoDestroy:!1,destroy(f,c){t.destroy(),c(f)}}),o=r?iy.createBrotliDecompress():iy.createUnzip();return o.once("error",f=>{if(i&&!t.readable){s.end();return}s.destroy(f)}),gq(t,s),t.pipe(n).pipe(o).pipe(s),s}});var Gk=T((KJ,Vk)=>{Vk.exports=Hk;function Hk(t,e){if(t&&e)return Hk(t)(e);if(typeof t!="function")throw new TypeError("need wrapper function");return Object.keys(t).forEach(function(i){r[i]=t[i]}),r;function r(){for(var i=new Array(arguments.length),n=0;n<i.length;n++)i[n]=arguments[n];var s=t.apply(this,i),o=i[i.length-1];return typeof s=="function"&&s!==o&&Object.keys(o).forEach(function(f){s[f]=o[f]}),s}l(r,"wrapper")}l(Hk,"wrappy")});var Xk=T((XJ,ny)=>{var Kk=Gk();ny.exports=Kk(Mu);ny.exports.strict=Kk(Jk);Mu.proto=Mu(function(){Object.defineProperty(Function.prototype,"once",{value:l(function(){return Mu(this)},"value"),configurable:!0}),Object.defineProperty(Function.prototype,"onceStrict",{value:l(function(){return Jk(this)},"value"),configurable:!0})});function Mu(t){var e=l(function(){return e.called?e.value:(e.called=!0,e.value=t.apply(this,arguments))},"f");return e.called=!1,e}l(Mu,"once");function Jk(t){var e=l(function(){if(e.called)throw new Error(e.onceError);return e.called=!0,e.value=t.apply(this,arguments)},"f"),r=t.name||"Function wrapped with `once`";return e.onceError=r+" shouldn't be called more than once",e.called=!1,e}l(Jk,"onceStrict")});var eR=T((ZJ,Qk)=>{Qk.exports=co;var bq=jk(),Yk=zk(),_q=ne("http"),Sq=ne("https"),vq=Xk(),Eq=ne("querystring"),Zk=ne("url"),sy=l(t=>t!==null&&typeof t=="object"&&typeof t.pipe=="function","isStream");function co(t,e){if(t=Object.assign({maxRedirects:10},typeof t=="string"?{url:t}:t),e=vq(e),t.url){let{hostname:f,port:c,protocol:a,auth:u,path:h}=Zk.parse(t.url);delete t.url,!f&&!c&&!a&&!u?t.path=h:Object.assign(t,{hostname:f,port:c,protocol:a,auth:u,path:h})}let r={"accept-encoding":"gzip, deflate"};t.headers&&Object.keys(t.headers).forEach(f=>r[f.toLowerCase()]=t.headers[f]),t.headers=r;let i;t.body?i=t.json&&!sy(t.body)?JSON.stringify(t.body):t.body:t.form&&(i=typeof t.form=="string"?t.form:Eq.stringify(t.form),t.headers["content-type"]="application/x-www-form-urlencoded"),i&&(t.method||(t.method="POST"),sy(i)||(t.headers["content-length"]=Buffer.byteLength(i)),t.json&&!t.form&&(t.headers["content-type"]="application/json")),delete t.body,delete t.form,t.json&&(t.headers.accept="application/json"),t.method&&(t.method=t.method.toUpperCase());let n=t.hostname,o=(t.protocol==="https:"?Sq:_q).request(t,f=>{if(t.followRedirects!==!1&&f.statusCode>=300&&f.statusCode<400&&f.headers.location){t.url=f.headers.location,delete t.headers.host,f.resume();let a=Zk.parse(t.url).hostname;return a!==null&&a!==n&&(delete t.headers.cookie,delete t.headers.authorization),t.method==="POST"&&[301,302].includes(f.statusCode)&&(t.method="GET",delete t.headers["content-length"],delete t.headers["content-type"]),t.maxRedirects--===0?e(new Error("too many redirects")):co(t,e)}let c=typeof Yk=="function"&&t.method!=="HEAD";e(null,c?Yk(f):f)});return o.on("timeout",()=>{o.abort(),e(new Error("Request timed out"))}),o.on("error",e),sy(i)?i.on("error",e).pipe(o):o.end(i),o}l(co,"simpleGet");co.concat=(t,e)=>co(t,(r,i)=>{if(r)return e(r);bq(i,(n,s)=>{if(n)return e(n);if(t.json)try{s=JSON.parse(s.toString())}catch(o){return e(o,i,s)}e(null,i,s)})});["get","post","put","patch","head","delete"].forEach(t=>{co[t]=(e,r)=>(typeof e=="string"&&(e={url:e}),co(Object.assign({method:t.toUpperCase()},e),r))})});var ge=T((eX,tR)=>{"use strict";var ay=class ay extends Error{constructor(e){if(!Array.isArray(e))throw new TypeError(`Expected input to be an Array, got ${typeof e}`);let r="";for(let i=0;i<e.length;i++)r+=` ${e[i].stack}
|
|
104
|
-
`;super(r),this.name="AggregateError",this.errors=e}};l(ay,"AggregateError");var oy=ay;tR.exports={AggregateError:oy,ArrayIsArray(t){return Array.isArray(t)},ArrayPrototypeIncludes(t,e){return t.includes(e)},ArrayPrototypeIndexOf(t,e){return t.indexOf(e)},ArrayPrototypeJoin(t,e){return t.join(e)},ArrayPrototypeMap(t,e){return t.map(e)},ArrayPrototypePop(t,e){return t.pop(e)},ArrayPrototypePush(t,e){return t.push(e)},ArrayPrototypeSlice(t,e,r){return t.slice(e,r)},Error,FunctionPrototypeCall(t,e,...r){return t.call(e,...r)},FunctionPrototypeSymbolHasInstance(t,e){return Function.prototype[Symbol.hasInstance].call(t,e)},MathFloor:Math.floor,Number,NumberIsInteger:Number.isInteger,NumberIsNaN:Number.isNaN,NumberMAX_SAFE_INTEGER:Number.MAX_SAFE_INTEGER,NumberMIN_SAFE_INTEGER:Number.MIN_SAFE_INTEGER,NumberParseInt:Number.parseInt,ObjectDefineProperties(t,e){return Object.defineProperties(t,e)},ObjectDefineProperty(t,e,r){return Object.defineProperty(t,e,r)},ObjectGetOwnPropertyDescriptor(t,e){return Object.getOwnPropertyDescriptor(t,e)},ObjectKeys(t){return Object.keys(t)},ObjectSetPrototypeOf(t,e){return Object.setPrototypeOf(t,e)},Promise,PromisePrototypeCatch(t,e){return t.catch(e)},PromisePrototypeThen(t,e,r){return t.then(e,r)},PromiseReject(t){return Promise.reject(t)},PromiseResolve(t){return Promise.resolve(t)},ReflectApply:Reflect.apply,RegExpPrototypeTest(t,e){return t.test(e)},SafeSet:Set,String,StringPrototypeSlice(t,e,r){return t.slice(e,r)},StringPrototypeToLowerCase(t){return t.toLowerCase()},StringPrototypeToUpperCase(t){return t.toUpperCase()},StringPrototypeTrim(t){return t.trim()},Symbol,SymbolFor:Symbol.for,SymbolAsyncIterator:Symbol.asyncIterator,SymbolHasInstance:Symbol.hasInstance,SymbolIterator:Symbol.iterator,SymbolDispose:Symbol.dispose||Symbol("Symbol.dispose"),SymbolAsyncDispose:Symbol.asyncDispose||Symbol("Symbol.asyncDispose"),TypedArrayPrototypeSet(t,e,r){return t.set(e,r)},Boolean,Uint8Array}});var cy=T((rX,rR)=>{"use strict";rR.exports={format(t,...e){return t.replace(/%([sdifj])/g,function(...[r,i]){let n=e.shift();return i==="f"?n.toFixed(6):i==="j"?JSON.stringify(n):i==="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"{}"}}}});var it=T((iX,sR)=>{"use strict";var{format:Fq,inspect:Lu}=cy(),{AggregateError:Tq}=ge(),kq=globalThis.AggregateError||Tq,Rq=Symbol("kIsNodeError"),Oq=["string","function","number","object","Function","Object","boolean","bigint","symbol"],xq=/^([A-Z][a-z0-9]*)+$/,Aq="__node_internal_",ju={};function an(t,e){if(!t)throw new ju.ERR_INTERNAL_ASSERTION(e)}l(an,"assert");function iR(t){let e="",r=t.length,i=t[0]==="-"?1:0;for(;r>=i+4;r-=3)e=`_${t.slice(r-3,r)}${e}`;return`${t.slice(0,r)}${e}`}l(iR,"addNumericalSeparator");function Pq(t,e,r){if(typeof e=="function")return an(e.length<=r.length,`Code: ${t}; The provided arguments length (${r.length}) does not match the required ones (${e.length}).`),e(...r);let i=(e.match(/%[dfijoOs]/g)||[]).length;return an(i===r.length,`Code: ${t}; The provided arguments length (${r.length}) does not match the required ones (${i}).`),r.length===0?e:Fq(e,...r)}l(Pq,"getMessage");function Je(t,e,r){r||(r=Error);let n=class n extends r{constructor(...o){super(Pq(t,e,o))}toString(){return`${this.name} [${t}]: ${this.message}`}};l(n,"NodeError");let i=n;Object.defineProperties(i.prototype,{name:{value:r.name,writable:!0,enumerable:!1,configurable:!0},toString:{value(){return`${this.name} [${t}]: ${this.message}`},writable:!0,enumerable:!1,configurable:!0}}),i.prototype.code=t,i.prototype[Rq]=!0,ju[t]=i}l(Je,"E");function nR(t){let e=Aq+t.name;return Object.defineProperty(t,"name",{value:e}),t}l(nR,"hideStackFrames");function Nq(t,e){if(t&&e&&t!==e){if(Array.isArray(e.errors))return e.errors.push(t),e;let r=new kq([e,t],e.message);return r.code=e.code,r}return t||e}l(Nq,"aggregateTwoErrors");var fy=class fy extends Error{constructor(e="The operation was aborted",r=void 0){if(r!==void 0&&typeof r!="object")throw new ju.ERR_INVALID_ARG_TYPE("options","Object",r);super(e,r),this.code="ABORT_ERR",this.name="AbortError"}};l(fy,"AbortError");var ly=fy;Je("ERR_ASSERTION","%s",Error);Je("ERR_INVALID_ARG_TYPE",(t,e,r)=>{an(typeof t=="string","'name' must be a string"),Array.isArray(e)||(e=[e]);let i="The ";t.endsWith(" argument")?i+=`${t} `:i+=`"${t}" ${t.includes(".")?"property":"argument"} `,i+="must be ";let n=[],s=[],o=[];for(let c of e)an(typeof c=="string","All expected entries have to be of type string"),Oq.includes(c)?n.push(c.toLowerCase()):xq.test(c)?s.push(c):(an(c!=="object",'The value "object" should be written as "Object"'),o.push(c));if(s.length>0){let c=n.indexOf("object");c!==-1&&(n.splice(n,c,1),s.push("Object"))}if(n.length>0){switch(n.length){case 1:i+=`of type ${n[0]}`;break;case 2:i+=`one of type ${n[0]} or ${n[1]}`;break;default:{let c=n.pop();i+=`one of type ${n.join(", ")}, or ${c}`}}(s.length>0||o.length>0)&&(i+=" or ")}if(s.length>0){switch(s.length){case 1:i+=`an instance of ${s[0]}`;break;case 2:i+=`an instance of ${s[0]} or ${s[1]}`;break;default:{let c=s.pop();i+=`an instance of ${s.join(", ")}, or ${c}`}}o.length>0&&(i+=" or ")}switch(o.length){case 0:break;case 1:o[0].toLowerCase()!==o[0]&&(i+="an "),i+=`${o[0]}`;break;case 2:i+=`one of ${o[0]} or ${o[1]}`;break;default:{let c=o.pop();i+=`one of ${o.join(", ")}, or ${c}`}}if(r==null)i+=`. Received ${r}`;else if(typeof r=="function"&&r.name)i+=`. Received function ${r.name}`;else if(typeof r=="object"){var f;if((f=r.constructor)!==null&&f!==void 0&&f.name)i+=`. Received an instance of ${r.constructor.name}`;else{let c=Lu(r,{depth:-1});i+=`. Received ${c}`}}else{let c=Lu(r,{colors:!1});c.length>25&&(c=`${c.slice(0,25)}...`),i+=`. Received type ${typeof r} (${c})`}return i},TypeError);Je("ERR_INVALID_ARG_VALUE",(t,e,r="is invalid")=>{let i=Lu(e);return i.length>128&&(i=i.slice(0,128)+"..."),`The ${t.includes(".")?"property":"argument"} '${t}' ${r}. Received ${i}`},TypeError);Je("ERR_INVALID_RETURN_VALUE",(t,e,r)=>{var i;let n=r!=null&&(i=r.constructor)!==null&&i!==void 0&&i.name?`instance of ${r.constructor.name}`:`type ${typeof r}`;return`Expected ${t} to be returned from the "${e}" function but got ${n}.`},TypeError);Je("ERR_MISSING_ARGS",(...t)=>{an(t.length>0,"At least one arg needs to be specified");let e,r=t.length;switch(t=(Array.isArray(t)?t:[t]).map(i=>`"${i}"`).join(" or "),r){case 1:e+=`The ${t[0]} argument`;break;case 2:e+=`The ${t[0]} and ${t[1]} arguments`;break;default:{let i=t.pop();e+=`The ${t.join(", ")}, and ${i} arguments`}break}return`${e} must be specified`},TypeError);Je("ERR_OUT_OF_RANGE",(t,e,r)=>{an(e,'Missing "range" argument');let i;if(Number.isInteger(r)&&Math.abs(r)>2**32)i=iR(String(r));else if(typeof r=="bigint"){i=String(r);let n=BigInt(2)**BigInt(32);(r>n||r<-n)&&(i=iR(i)),i+="n"}else i=Lu(r);return`The value of "${t}" is out of range. It must be ${e}. Received ${i}`},RangeError);Je("ERR_MULTIPLE_CALLBACK","Callback called multiple times",Error);Je("ERR_METHOD_NOT_IMPLEMENTED","The %s method is not implemented",Error);Je("ERR_STREAM_ALREADY_FINISHED","Cannot call %s after a stream was finished",Error);Je("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable",Error);Je("ERR_STREAM_DESTROYED","Cannot call %s after a stream was destroyed",Error);Je("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);Je("ERR_STREAM_PREMATURE_CLOSE","Premature close",Error);Je("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF",Error);Je("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event",Error);Je("ERR_STREAM_WRITE_AFTER_END","write after end",Error);Je("ERR_UNKNOWN_ENCODING","Unknown encoding: %s",TypeError);sR.exports={AbortError:ly,aggregateTwoErrors:nR(Nq),hideStackFrames:nR,codes:ju}});var mR=T((yc,wc)=>{"use strict";Object.defineProperty(yc,"__esModule",{value:!0});var uR=new WeakMap,uy=new WeakMap;function pe(t){let e=uR.get(t);return console.assert(e!=null,"'this' is expected an Event object, but got",t),e}l(pe,"pd");function oR(t){if(t.passiveListener!=null){typeof console<"u"&&typeof console.error=="function"&&console.error("Unable to preventDefault inside passive event listener invocation.",t.passiveListener);return}t.event.cancelable&&(t.canceled=!0,typeof t.event.preventDefault=="function"&&t.event.preventDefault())}l(oR,"setCancelFlag");function lo(t,e){uR.set(this,{eventTarget:t,event:e,eventPhase:2,currentTarget:t,canceled:!1,stopped:!1,immediateStopped:!1,passiveListener:null,timeStamp:e.timeStamp||Date.now()}),Object.defineProperty(this,"isTrusted",{value:!1,enumerable:!0});let r=Object.keys(e);for(let i=0;i<r.length;++i){let n=r[i];n in this||Object.defineProperty(this,n,hR(n))}}l(lo,"Event");lo.prototype={get type(){return pe(this).event.type},get target(){return pe(this).eventTarget},get currentTarget(){return pe(this).currentTarget},composedPath(){let t=pe(this).currentTarget;return t==null?[]:[t]},get NONE(){return 0},get CAPTURING_PHASE(){return 1},get AT_TARGET(){return 2},get BUBBLING_PHASE(){return 3},get eventPhase(){return pe(this).eventPhase},stopPropagation(){let t=pe(this);t.stopped=!0,typeof t.event.stopPropagation=="function"&&t.event.stopPropagation()},stopImmediatePropagation(){let t=pe(this);t.stopped=!0,t.immediateStopped=!0,typeof t.event.stopImmediatePropagation=="function"&&t.event.stopImmediatePropagation()},get bubbles(){return!!pe(this).event.bubbles},get cancelable(){return!!pe(this).event.cancelable},preventDefault(){oR(pe(this))},get defaultPrevented(){return pe(this).canceled},get composed(){return!!pe(this).event.composed},get timeStamp(){return pe(this).timeStamp},get srcElement(){return pe(this).eventTarget},get cancelBubble(){return pe(this).stopped},set cancelBubble(t){if(!t)return;let e=pe(this);e.stopped=!0,typeof e.event.cancelBubble=="boolean"&&(e.event.cancelBubble=!0)},get returnValue(){return!pe(this).canceled},set returnValue(t){t||oR(pe(this))},initEvent(){}};Object.defineProperty(lo.prototype,"constructor",{value:lo,configurable:!0,writable:!0});typeof window<"u"&&typeof window.Event<"u"&&(Object.setPrototypeOf(lo.prototype,window.Event.prototype),uy.set(window.Event.prototype,lo));function hR(t){return{get(){return pe(this).event[t]},set(e){pe(this).event[t]=e},configurable:!0,enumerable:!0}}l(hR,"defineRedirectDescriptor");function Cq(t){return{value(){let e=pe(this).event;return e[t].apply(e,arguments)},configurable:!0,enumerable:!0}}l(Cq,"defineCallDescriptor");function Dq(t,e){let r=Object.keys(e);if(r.length===0)return t;function i(n,s){t.call(this,n,s)}l(i,"CustomEvent"),i.prototype=Object.create(t.prototype,{constructor:{value:i,configurable:!0,writable:!0}});for(let n=0;n<r.length;++n){let s=r[n];if(!(s in t.prototype)){let f=typeof Object.getOwnPropertyDescriptor(e,s).value=="function";Object.defineProperty(i.prototype,s,f?Cq(s):hR(s))}}return i}l(Dq,"defineWrapper");function dR(t){if(t==null||t===Object.prototype)return lo;let e=uy.get(t);return e==null&&(e=Dq(dR(Object.getPrototypeOf(t)),t),uy.set(t,e)),e}l(dR,"getWrapper");function Iq(t,e){let r=dR(Object.getPrototypeOf(e));return new r(t,e)}l(Iq,"wrapEvent");function $q(t){return pe(t).immediateStopped}l($q,"isStopped");function Bq(t,e){pe(t).eventPhase=e}l(Bq,"setEventPhase");function Mq(t,e){pe(t).currentTarget=e}l(Mq,"setCurrentTarget");function aR(t,e){pe(t).passiveListener=e}l(aR,"setPassiveListener");var pR=new WeakMap,cR=1,lR=2,qu=3;function Uu(t){return t!==null&&typeof t=="object"}l(Uu,"isObject");function mc(t){let e=pR.get(t);if(e==null)throw new TypeError("'this' is expected an EventTarget object, but got another value.");return e}l(mc,"getListeners");function Lq(t){return{get(){let r=mc(this).get(t);for(;r!=null;){if(r.listenerType===qu)return r.listener;r=r.next}return null},set(e){typeof e!="function"&&!Uu(e)&&(e=null);let r=mc(this),i=null,n=r.get(t);for(;n!=null;)n.listenerType===qu?i!==null?i.next=n.next:n.next!==null?r.set(t,n.next):r.delete(t):i=n,n=n.next;if(e!==null){let s={listener:e,listenerType:qu,passive:!1,once:!1,next:null};i===null?r.set(t,s):i.next=s}},configurable:!0,enumerable:!0}}l(Lq,"defineEventAttributeDescriptor");function hy(t,e){Object.defineProperty(t,`on${e}`,Lq(e))}l(hy,"defineEventAttribute");function fR(t){function e(){er.call(this)}l(e,"CustomEventTarget"),e.prototype=Object.create(er.prototype,{constructor:{value:e,configurable:!0,writable:!0}});for(let r=0;r<t.length;++r)hy(e.prototype,t[r]);return e}l(fR,"defineCustomEventTarget");function er(){if(this instanceof er){pR.set(this,new Map);return}if(arguments.length===1&&Array.isArray(arguments[0]))return fR(arguments[0]);if(arguments.length>0){let t=new Array(arguments.length);for(let e=0;e<arguments.length;++e)t[e]=arguments[e];return fR(t)}throw new TypeError("Cannot call a class as a function")}l(er,"EventTarget");er.prototype={addEventListener(t,e,r){if(e==null)return;if(typeof e!="function"&&!Uu(e))throw new TypeError("'listener' should be a function or an object.");let i=mc(this),n=Uu(r),o=(n?!!r.capture:!!r)?cR:lR,f={listener:e,listenerType:o,passive:n&&!!r.passive,once:n&&!!r.once,next:null},c=i.get(t);if(c===void 0){i.set(t,f);return}let a=null;for(;c!=null;){if(c.listener===e&&c.listenerType===o)return;a=c,c=c.next}a.next=f},removeEventListener(t,e,r){if(e==null)return;let i=mc(this),s=(Uu(r)?!!r.capture:!!r)?cR:lR,o=null,f=i.get(t);for(;f!=null;){if(f.listener===e&&f.listenerType===s){o!==null?o.next=f.next:f.next!==null?i.set(t,f.next):i.delete(t);return}o=f,f=f.next}},dispatchEvent(t){if(t==null||typeof t.type!="string")throw new TypeError('"event.type" should be a string.');let e=mc(this),r=t.type,i=e.get(r);if(i==null)return!0;let n=Iq(this,t),s=null;for(;i!=null;){if(i.once?s!==null?s.next=i.next:i.next!==null?e.set(r,i.next):e.delete(r):s=i,aR(n,i.passive?i.listener:null),typeof i.listener=="function")try{i.listener.call(this,n)}catch(o){typeof console<"u"&&typeof console.error=="function"&&console.error(o)}else i.listenerType!==qu&&typeof i.listener.handleEvent=="function"&&i.listener.handleEvent(n);if($q(n))break;i=i.next}return aR(n,null),Bq(n,0),Mq(n,null),!n.defaultPrevented}};Object.defineProperty(er.prototype,"constructor",{value:er,configurable:!0,writable:!0});typeof window<"u"&&typeof window.EventTarget<"u"&&Object.setPrototypeOf(er.prototype,window.EventTarget.prototype);yc.defineEventAttribute=hy;yc.EventTarget=er;yc.default=er;wc.exports=er;wc.exports.EventTarget=wc.exports.default=er;wc.exports.defineEventAttribute=hy});var fo=T((bc,gc)=>{"use strict";Object.defineProperty(bc,"__esModule",{value:!0});var dy=mR(),py=class py extends dy.EventTarget{constructor(){throw super(),new TypeError("AbortSignal cannot be constructed directly")}get aborted(){let e=Wu.get(this);if(typeof e!="boolean")throw new TypeError(`Expected 'this' to be an 'AbortSignal' object, but got ${this===null?"null":typeof this}`);return e}};l(py,"AbortSignal");var yi=py;dy.defineEventAttribute(yi.prototype,"abort");function jq(){let t=Object.create(yi.prototype);return dy.EventTarget.call(t),Wu.set(t,!1),t}l(jq,"createAbortSignal");function qq(t){Wu.get(t)===!1&&(Wu.set(t,!0),t.dispatchEvent({type:"abort"}))}l(qq,"abortSignal");var Wu=new WeakMap;Object.defineProperties(yi.prototype,{aborted:{enumerable:!0}});typeof Symbol=="function"&&typeof Symbol.toStringTag=="symbol"&&Object.defineProperty(yi.prototype,Symbol.toStringTag,{configurable:!0,value:"AbortSignal"});var my=class my{constructor(){yR.set(this,jq())}get signal(){return wR(this)}abort(){qq(wR(this))}};l(my,"AbortController");var gi=my,yR=new WeakMap;function wR(t){let e=yR.get(t);if(e==null)throw new TypeError(`Expected 'this' to be an 'AbortController' object, but got ${t===null?"null":typeof t}`);return e}l(wR,"getSignal");Object.defineProperties(gi.prototype,{signal:{enumerable:!0},abort:{enumerable:!0}});typeof Symbol=="function"&&typeof Symbol.toStringTag=="symbol"&&Object.defineProperty(gi.prototype,Symbol.toStringTag,{configurable:!0,value:"AbortController"});bc.AbortController=gi;bc.AbortSignal=yi;bc.default=gi;gc.exports=gi;gc.exports.AbortController=gc.exports.default=gi;gc.exports.AbortSignal=yi});var ht=T((aX,yy)=>{"use strict";var Uq=ne("buffer"),{format:Wq,inspect:zq}=cy(),{codes:{ERR_INVALID_ARG_TYPE:wy}}=it(),{kResistStopPropagation:Hq,AggregateError:Vq,SymbolDispose:Gq}=ge(),Kq=globalThis.AbortSignal||fo().AbortSignal,Jq=globalThis.AbortController||fo().AbortController,Xq=Object.getPrototypeOf(async function(){}).constructor,gR=globalThis.Blob||Uq.Blob,Yq=l(typeof gR<"u"?function(e){return e instanceof gR}:function(e){return!1},"isBlob"),bR=l((t,e)=>{if(t!==void 0&&(t===null||typeof t!="object"||!("aborted"in t)))throw new wy(e,"AbortSignal",t)},"validateAbortSignal"),Zq=l((t,e)=>{if(typeof t!="function")throw new wy(e,"Function",t)},"validateFunction");yy.exports={AggregateError:Vq,kEmptyObject:Object.freeze({}),once(t){let e=!1;return function(...r){e||(e=!0,t.apply(this,r))}},createDeferredPromise:l(function(){let t,e;return{promise:new Promise((i,n)=>{t=i,e=n}),resolve:t,reject:e}},"createDeferredPromise"),promisify(t){return new Promise((e,r)=>{t((i,...n)=>i?r(i):e(...n))})},debuglog(){return function(){}},format:Wq,inspect:zq,types:{isAsyncFunction(t){return t instanceof Xq},isArrayBufferView(t){return ArrayBuffer.isView(t)}},isBlob:Yq,deprecate(t,e){return t},addAbortListener:ne("events").addAbortListener||l(function(e,r){if(e===void 0)throw new wy("signal","AbortSignal",e);bR(e,"signal"),Zq(r,"listener");let i;return e.aborted?queueMicrotask(()=>r()):(e.addEventListener("abort",r,{__proto__:null,once:!0,[Hq]:!0}),i=l(()=>{e.removeEventListener("abort",r)},"removeEventListener")),{__proto__:null,[Gq](){var n;(n=i)===null||n===void 0||n()}}},"addAbortListener"),AbortSignalAny:Kq.any||l(function(e){if(e.length===1)return e[0];let r=new Jq,i=l(()=>r.abort(),"abort");return e.forEach(n=>{bR(n,"signals"),n.addEventListener("abort",i,{once:!0})}),r.signal.addEventListener("abort",()=>{e.forEach(n=>n.removeEventListener("abort",i))},{once:!0}),r.signal},"AbortSignalAny")};yy.exports.promisify.custom=Symbol.for("nodejs.util.promisify.custom")});var ho=T((lX,xR)=>{"use strict";var{ArrayIsArray:by,ArrayPrototypeIncludes:ER,ArrayPrototypeJoin:FR,ArrayPrototypeMap:Qq,NumberIsInteger:_y,NumberIsNaN:e8,NumberMAX_SAFE_INTEGER:t8,NumberMIN_SAFE_INTEGER:r8,NumberParseInt:i8,ObjectPrototypeHasOwnProperty:n8,RegExpPrototypeExec:TR,String:s8,StringPrototypeToUpperCase:o8,StringPrototypeTrim:a8}=ge(),{hideStackFrames:Ut,codes:{ERR_SOCKET_BAD_PORT:c8,ERR_INVALID_ARG_TYPE:nt,ERR_INVALID_ARG_VALUE:uo,ERR_OUT_OF_RANGE:cn,ERR_UNKNOWN_SIGNAL:_R}}=it(),{normalizeEncoding:l8}=ht(),{isAsyncFunction:f8,isArrayBufferView:u8}=ht().types,SR={};function h8(t){return t===(t|0)}l(h8,"isInt32");function d8(t){return t===t>>>0}l(d8,"isUint32");var p8=/^[0-7]+$/,m8="must be a 32-bit unsigned integer or an octal string";function w8(t,e,r){if(typeof t>"u"&&(t=r),typeof t=="string"){if(TR(p8,t)===null)throw new uo(e,t,m8);t=i8(t,8)}return kR(t,e),t}l(w8,"parseFileMode");var y8=Ut((t,e,r=r8,i=t8)=>{if(typeof t!="number")throw new nt(e,"number",t);if(!_y(t))throw new cn(e,"an integer",t);if(t<r||t>i)throw new cn(e,`>= ${r} && <= ${i}`,t)}),g8=Ut((t,e,r=-2147483648,i=2147483647)=>{if(typeof t!="number")throw new nt(e,"number",t);if(!_y(t))throw new cn(e,"an integer",t);if(t<r||t>i)throw new cn(e,`>= ${r} && <= ${i}`,t)}),kR=Ut((t,e,r=!1)=>{if(typeof t!="number")throw new nt(e,"number",t);if(!_y(t))throw new cn(e,"an integer",t);let i=r?1:0,n=4294967295;if(t<i||t>n)throw new cn(e,`>= ${i} && <= ${n}`,t)});function Sy(t,e){if(typeof t!="string")throw new nt(e,"string",t)}l(Sy,"validateString");function b8(t,e,r=void 0,i){if(typeof t!="number")throw new nt(e,"number",t);if(r!=null&&t<r||i!=null&&t>i||(r!=null||i!=null)&&e8(t))throw new cn(e,`${r!=null?`>= ${r}`:""}${r!=null&&i!=null?" && ":""}${i!=null?`<= ${i}`:""}`,t)}l(b8,"validateNumber");var _8=Ut((t,e,r)=>{if(!ER(r,t)){let n="must be one of: "+FR(Qq(r,s=>typeof s=="string"?`'${s}'`:s8(s)),", ");throw new uo(e,t,n)}});function RR(t,e){if(typeof t!="boolean")throw new nt(e,"boolean",t)}l(RR,"validateBoolean");function gy(t,e,r){return t==null||!n8(t,e)?r:t[e]}l(gy,"getOwnPropertyValueOrDefault");var S8=Ut((t,e,r=null)=>{let i=gy(r,"allowArray",!1),n=gy(r,"allowFunction",!1);if(!gy(r,"nullable",!1)&&t===null||!i&&by(t)||typeof t!="object"&&(!n||typeof t!="function"))throw new nt(e,"Object",t)}),v8=Ut((t,e)=>{if(t!=null&&typeof t!="object"&&typeof t!="function")throw new nt(e,"a dictionary",t)}),zu=Ut((t,e,r=0)=>{if(!by(t))throw new nt(e,"Array",t);if(t.length<r){let i=`must be longer than ${r}`;throw new uo(e,t,i)}});function E8(t,e){zu(t,e);for(let r=0;r<t.length;r++)Sy(t[r],`${e}[${r}]`)}l(E8,"validateStringArray");function F8(t,e){zu(t,e);for(let r=0;r<t.length;r++)RR(t[r],`${e}[${r}]`)}l(F8,"validateBooleanArray");function T8(t,e){zu(t,e);for(let r=0;r<t.length;r++){let i=t[r],n=`${e}[${r}]`;if(i==null)throw new nt(n,"AbortSignal",i);OR(i,n)}}l(T8,"validateAbortSignalArray");function k8(t,e="signal"){if(Sy(t,e),SR[t]===void 0)throw SR[o8(t)]!==void 0?new _R(t+" (signals must use all capital letters)"):new _R(t)}l(k8,"validateSignalName");var R8=Ut((t,e="buffer")=>{if(!u8(t))throw new nt(e,["Buffer","TypedArray","DataView"],t)});function O8(t,e){let r=l8(e),i=t.length;if(r==="hex"&&i%2!==0)throw new uo("encoding",e,`is invalid for data of length ${i}`)}l(O8,"validateEncoding");function x8(t,e="Port",r=!0){if(typeof t!="number"&&typeof t!="string"||typeof t=="string"&&a8(t).length===0||+t!==+t>>>0||t>65535||t===0&&!r)throw new c8(e,t,r);return t|0}l(x8,"validatePort");var OR=Ut((t,e)=>{if(t!==void 0&&(t===null||typeof t!="object"||!("aborted"in t)))throw new nt(e,"AbortSignal",t)}),A8=Ut((t,e)=>{if(typeof t!="function")throw new nt(e,"Function",t)}),P8=Ut((t,e)=>{if(typeof t!="function"||f8(t))throw new nt(e,"Function",t)}),N8=Ut((t,e)=>{if(t!==void 0)throw new nt(e,"undefined",t)});function C8(t,e,r){if(!ER(r,t))throw new nt(e,`('${FR(r,"|")}')`,t)}l(C8,"validateUnion");var D8=/^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/;function vR(t,e){if(typeof t>"u"||!TR(D8,t))throw new uo(e,t,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}l(vR,"validateLinkHeaderFormat");function I8(t){if(typeof t=="string")return vR(t,"hints"),t;if(by(t)){let e=t.length,r="";if(e===0)return r;for(let i=0;i<e;i++){let n=t[i];vR(n,"hints"),r+=n,i!==e-1&&(r+=", ")}return r}throw new uo("hints",t,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}l(I8,"validateLinkHeaderValue");xR.exports={isInt32:h8,isUint32:d8,parseFileMode:w8,validateArray:zu,validateStringArray:E8,validateBooleanArray:F8,validateAbortSignalArray:T8,validateBoolean:RR,validateBuffer:R8,validateDictionary:v8,validateEncoding:O8,validateFunction:A8,validateInt32:g8,validateInteger:y8,validateNumber:b8,validateObject:S8,validateOneOf:_8,validatePlainFunction:P8,validatePort:x8,validateSignalName:k8,validateString:Sy,validateUint32:kR,validateUndefined:N8,validateUnion:C8,validateAbortSignal:OR,validateLinkHeaderValue:I8}});var bi=T((uX,AR)=>{AR.exports=globalThis.process});var gr=T((hX,HR)=>{"use strict";var{SymbolAsyncIterator:PR,SymbolIterator:NR,SymbolFor:ln}=ge(),CR=ln("nodejs.stream.destroyed"),DR=ln("nodejs.stream.errored"),vy=ln("nodejs.stream.readable"),Ey=ln("nodejs.stream.writable"),IR=ln("nodejs.stream.disturbed"),$8=ln("nodejs.webstream.isClosedPromise"),B8=ln("nodejs.webstream.controllerErrorFunction");function Hu(t,e=!1){var r;return!!(t&&typeof t.pipe=="function"&&typeof t.on=="function"&&(!e||typeof t.pause=="function"&&typeof t.resume=="function")&&(!t._writableState||((r=t._readableState)===null||r===void 0?void 0:r.readable)!==!1)&&(!t._writableState||t._readableState))}l(Hu,"isReadableNodeStream");function Vu(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))}l(Vu,"isWritableNodeStream");function M8(t){return!!(t&&typeof t.pipe=="function"&&t._readableState&&typeof t.on=="function"&&typeof t.write=="function")}l(M8,"isDuplexNodeStream");function yr(t){return t&&(t._readableState||t._writableState||typeof t.write=="function"&&typeof t.on=="function"||typeof t.pipe=="function"&&typeof t.on=="function")}l(yr,"isNodeStream");function $R(t){return!!(t&&!yr(t)&&typeof t.pipeThrough=="function"&&typeof t.getReader=="function"&&typeof t.cancel=="function")}l($R,"isReadableStream");function BR(t){return!!(t&&!yr(t)&&typeof t.getWriter=="function"&&typeof t.abort=="function")}l(BR,"isWritableStream");function MR(t){return!!(t&&!yr(t)&&typeof t.readable=="object"&&typeof t.writable=="object")}l(MR,"isTransformStream");function L8(t){return $R(t)||BR(t)||MR(t)}l(L8,"isWebStream");function j8(t,e){return t==null?!1:e===!0?typeof t[PR]=="function":e===!1?typeof t[NR]=="function":typeof t[PR]=="function"||typeof t[NR]=="function"}l(j8,"isIterable");function Gu(t){if(!yr(t))return null;let e=t._writableState,r=t._readableState,i=e||r;return!!(t.destroyed||t[CR]||i!=null&&i.destroyed)}l(Gu,"isDestroyed");function LR(t){if(!Vu(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}l(LR,"isWritableEnded");function q8(t,e){if(!Vu(t))return null;if(t.writableFinished===!0)return!0;let r=t._writableState;return r!=null&&r.errored?!1:typeof r?.finished!="boolean"?null:!!(r.finished||e===!1&&r.ended===!0&&r.length===0)}l(q8,"isWritableFinished");function U8(t){if(!Hu(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}l(U8,"isReadableEnded");function jR(t,e){if(!Hu(t))return null;let r=t._readableState;return r!=null&&r.errored?!1:typeof r?.endEmitted!="boolean"?null:!!(r.endEmitted||e===!1&&r.ended===!0&&r.length===0)}l(jR,"isReadableFinished");function qR(t){return t&&t[vy]!=null?t[vy]:typeof t?.readable!="boolean"?null:Gu(t)?!1:Hu(t)&&t.readable&&!jR(t)}l(qR,"isReadable");function UR(t){return t&&t[Ey]!=null?t[Ey]:typeof t?.writable!="boolean"?null:Gu(t)?!1:Vu(t)&&t.writable&&!LR(t)}l(UR,"isWritable");function W8(t,e){return yr(t)?Gu(t)?!0:!(e?.readable!==!1&&qR(t)||e?.writable!==!1&&UR(t)):null}l(W8,"isFinished");function z8(t){var e,r;return yr(t)?t.writableErrored?t.writableErrored:(e=(r=t._writableState)===null||r===void 0?void 0:r.errored)!==null&&e!==void 0?e:null:null}l(z8,"isWritableErrored");function H8(t){var e,r;return yr(t)?t.readableErrored?t.readableErrored:(e=(r=t._readableState)===null||r===void 0?void 0:r.errored)!==null&&e!==void 0?e:null:null}l(H8,"isReadableErrored");function V8(t){if(!yr(t))return null;if(typeof t.closed=="boolean")return t.closed;let e=t._writableState,r=t._readableState;return typeof e?.closed=="boolean"||typeof r?.closed=="boolean"?e?.closed||r?.closed:typeof t._closed=="boolean"&&WR(t)?t._closed:null}l(V8,"isClosed");function WR(t){return typeof t._closed=="boolean"&&typeof t._defaultKeepAlive=="boolean"&&typeof t._removedConnection=="boolean"&&typeof t._removedContLen=="boolean"}l(WR,"isOutgoingMessage");function zR(t){return typeof t._sent100=="boolean"&&WR(t)}l(zR,"isServerResponse");function G8(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}l(G8,"isServerRequest");function K8(t){if(!yr(t))return null;let e=t._writableState,r=t._readableState,i=e||r;return!i&&zR(t)||!!(i&&i.autoDestroy&&i.emitClose&&i.closed===!1)}l(K8,"willEmitClose");function J8(t){var e;return!!(t&&((e=t[IR])!==null&&e!==void 0?e:t.readableDidRead||t.readableAborted))}l(J8,"isDisturbed");function X8(t){var e,r,i,n,s,o,f,c,a,u;return!!(t&&((e=(r=(i=(n=(s=(o=t[DR])!==null&&o!==void 0?o:t.readableErrored)!==null&&s!==void 0?s:t.writableErrored)!==null&&n!==void 0?n:(f=t._readableState)===null||f===void 0?void 0:f.errorEmitted)!==null&&i!==void 0?i:(c=t._writableState)===null||c===void 0?void 0:c.errorEmitted)!==null&&r!==void 0?r:(a=t._readableState)===null||a===void 0?void 0:a.errored)!==null&&e!==void 0?e:!((u=t._writableState)===null||u===void 0)&&u.errored))}l(X8,"isErrored");HR.exports={isDestroyed:Gu,kIsDestroyed:CR,isDisturbed:J8,kIsDisturbed:IR,isErrored:X8,kIsErrored:DR,isReadable:qR,kIsReadable:vy,kIsClosedPromise:$8,kControllerErrorFunction:B8,kIsWritable:Ey,isClosed:V8,isDuplexNodeStream:M8,isFinished:W8,isIterable:j8,isReadableNodeStream:Hu,isReadableStream:$R,isReadableEnded:U8,isReadableFinished:jR,isReadableErrored:H8,isNodeStream:yr,isWebStream:L8,isWritable:UR,isWritableNodeStream:Vu,isWritableStream:BR,isWritableEnded:LR,isWritableFinished:q8,isWritableErrored:z8,isServerRequest:G8,isServerResponse:zR,willEmitClose:K8,isTransformStream:MR}});var Br=T((pX,Oy)=>{"use strict";var _i=bi(),{AbortError:eO,codes:Y8}=it(),{ERR_INVALID_ARG_TYPE:Z8,ERR_STREAM_PREMATURE_CLOSE:VR}=Y8,{kEmptyObject:Ty,once:ky}=ht(),{validateAbortSignal:Q8,validateFunction:eU,validateObject:tU,validateBoolean:rU}=ho(),{Promise:iU,PromisePrototypeThen:nU,SymbolDispose:tO}=ge(),{isClosed:sU,isReadable:GR,isReadableNodeStream:Fy,isReadableStream:oU,isReadableFinished:KR,isReadableErrored:JR,isWritable:XR,isWritableNodeStream:YR,isWritableStream:aU,isWritableFinished:ZR,isWritableErrored:QR,isNodeStream:cU,willEmitClose:lU,kIsClosedPromise:fU}=gr(),po;function uU(t){return t.setHeader&&typeof t.abort=="function"}l(uU,"isRequest");var Ry=l(()=>{},"nop");function rO(t,e,r){var i,n;if(arguments.length===2?(r=e,e=Ty):e==null?e=Ty:tU(e,"options"),eU(r,"callback"),Q8(e.signal,"options.signal"),r=ky(r),oU(t)||aU(t))return hU(t,e,r);if(!cU(t))throw new Z8("stream",["ReadableStream","WritableStream","Stream"],t);let s=(i=e.readable)!==null&&i!==void 0?i:Fy(t),o=(n=e.writable)!==null&&n!==void 0?n:YR(t),f=t._writableState,c=t._readableState,a=l(()=>{t.writable||d()},"onlegacyfinish"),u=lU(t)&&Fy(t)===s&&YR(t)===o,h=ZR(t,!1),d=l(()=>{h=!0,t.destroyed&&(u=!1),!(u&&(!t.readable||s))&&(!s||p)&&r.call(t)},"onfinish"),p=KR(t,!1),m=l(()=>{p=!0,t.destroyed&&(u=!1),!(u&&(!t.writable||o))&&(!o||h)&&r.call(t)},"onend"),w=l(R=>{r.call(t,R)},"onerror"),y=sU(t),g=l(()=>{y=!0;let R=QR(t)||JR(t);if(R&&typeof R!="boolean")return r.call(t,R);if(s&&!p&&Fy(t,!0)&&!KR(t,!1))return r.call(t,new VR);if(o&&!h&&!ZR(t,!1))return r.call(t,new VR);r.call(t)},"onclose"),_=l(()=>{y=!0;let R=QR(t)||JR(t);if(R&&typeof R!="boolean")return r.call(t,R);r.call(t)},"onclosed"),F=l(()=>{t.req.on("finish",d)},"onrequest");uU(t)?(t.on("complete",d),u||t.on("abort",g),t.req?F():t.on("request",F)):o&&!f&&(t.on("end",a),t.on("close",a)),!u&&typeof t.aborted=="boolean"&&t.on("aborted",g),t.on("end",m),t.on("finish",d),e.error!==!1&&t.on("error",w),t.on("close",g),y?_i.nextTick(g):f!=null&&f.errorEmitted||c!=null&&c.errorEmitted?u||_i.nextTick(_):(!s&&(!u||GR(t))&&(h||XR(t)===!1)||!o&&(!u||XR(t))&&(p||GR(t)===!1)||c&&t.req&&t.aborted)&&_i.nextTick(_);let E=l(()=>{r=Ry,t.removeListener("aborted",g),t.removeListener("complete",d),t.removeListener("abort",g),t.removeListener("request",F),t.req&&t.req.removeListener("finish",d),t.removeListener("end",a),t.removeListener("close",a),t.removeListener("finish",d),t.removeListener("end",m),t.removeListener("error",w),t.removeListener("close",g)},"cleanup");if(e.signal&&!y){let R=l(()=>{let P=r;E(),P.call(t,new eO(void 0,{cause:e.signal.reason}))},"abort");if(e.signal.aborted)_i.nextTick(R);else{po=po||ht().addAbortListener;let P=po(e.signal,R),S=r;r=ky((...O)=>{P[tO](),S.apply(t,O)})}}return E}l(rO,"eos");function hU(t,e,r){let i=!1,n=Ry;if(e.signal)if(n=l(()=>{i=!0,r.call(t,new eO(void 0,{cause:e.signal.reason}))},"abort"),e.signal.aborted)_i.nextTick(n);else{po=po||ht().addAbortListener;let o=po(e.signal,n),f=r;r=ky((...c)=>{o[tO](),f.apply(t,c)})}let s=l((...o)=>{i||_i.nextTick(()=>r.apply(t,o))},"resolverFn");return nU(t[fU].promise,s,s),Ry}l(hU,"eosWeb");function dU(t,e){var r;let i=!1;return e===null&&(e=Ty),(r=e)!==null&&r!==void 0&&r.cleanup&&(rU(e.cleanup,"cleanup"),i=e.cleanup),new iU((n,s)=>{let o=rO(t,e,f=>{i&&o(),f?s(f):n()})})}l(dU,"finished");Oy.exports=rO;Oy.exports.finished=dU});var fn=T((wX,fO)=>{"use strict";var br=bi(),{aggregateTwoErrors:pU,codes:{ERR_MULTIPLE_CALLBACK:mU},AbortError:wU}=it(),{Symbol:sO}=ge(),{kIsDestroyed:yU,isDestroyed:gU,isFinished:bU,isServerRequest:_U}=gr(),oO=sO("kDestroy"),xy=sO("kConstruct");function aO(t,e,r){t&&(t.stack,e&&!e.errored&&(e.errored=t),r&&!r.errored&&(r.errored=t))}l(aO,"checkError");function SU(t,e){let r=this._readableState,i=this._writableState,n=i||r;return i!=null&&i.destroyed||r!=null&&r.destroyed?(typeof e=="function"&&e(),this):(aO(t,i,r),i&&(i.destroyed=!0),r&&(r.destroyed=!0),n.constructed?iO(this,t,e):this.once(oO,function(s){iO(this,pU(s,t),e)}),this)}l(SU,"destroy");function iO(t,e,r){let i=!1;function n(s){if(i)return;i=!0;let o=t._readableState,f=t._writableState;aO(s,f,o),f&&(f.closed=!0),o&&(o.closed=!0),typeof r=="function"&&r(s),s?br.nextTick(vU,t,s):br.nextTick(cO,t)}l(n,"onDestroy");try{t._destroy(e||null,n)}catch(s){n(s)}}l(iO,"_destroy");function vU(t,e){Ay(t,e),cO(t)}l(vU,"emitErrorCloseNT");function cO(t){let e=t._readableState,r=t._writableState;r&&(r.closeEmitted=!0),e&&(e.closeEmitted=!0),(r!=null&&r.emitClose||e!=null&&e.emitClose)&&t.emit("close")}l(cO,"emitCloseNT");function Ay(t,e){let r=t._readableState,i=t._writableState;i!=null&&i.errorEmitted||r!=null&&r.errorEmitted||(i&&(i.errorEmitted=!0),r&&(r.errorEmitted=!0),t.emit("error",e))}l(Ay,"emitErrorNT");function EU(){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)}l(EU,"undestroy");function Py(t,e,r){let i=t._readableState,n=t._writableState;if(n!=null&&n.destroyed||i!=null&&i.destroyed)return this;i!=null&&i.autoDestroy||n!=null&&n.autoDestroy?t.destroy(e):e&&(e.stack,n&&!n.errored&&(n.errored=e),i&&!i.errored&&(i.errored=e),r?br.nextTick(Ay,t,e):Ay(t,e))}l(Py,"errorOrDestroy");function FU(t,e){if(typeof t._construct!="function")return;let r=t._readableState,i=t._writableState;r&&(r.constructed=!1),i&&(i.constructed=!1),t.once(xy,e),!(t.listenerCount(xy)>1)&&br.nextTick(TU,t)}l(FU,"construct");function TU(t){let e=!1;function r(i){if(e){Py(t,i??new mU);return}e=!0;let n=t._readableState,s=t._writableState,o=s||n;n&&(n.constructed=!0),s&&(s.constructed=!0),o.destroyed?t.emit(oO,i):i?Py(t,i,!0):br.nextTick(kU,t)}l(r,"onConstruct");try{t._construct(i=>{br.nextTick(r,i)})}catch(i){br.nextTick(r,i)}}l(TU,"constructNT");function kU(t){t.emit(xy)}l(kU,"emitConstructNT");function nO(t){return t?.setHeader&&typeof t.abort=="function"}l(nO,"isRequest");function lO(t){t.emit("close")}l(lO,"emitCloseLegacy");function RU(t,e){t.emit("error",e),br.nextTick(lO,t)}l(RU,"emitErrorCloseLegacy");function OU(t,e){!t||gU(t)||(!e&&!bU(t)&&(e=new wU),_U(t)?(t.socket=null,t.destroy(e)):nO(t)?t.abort():nO(t.req)?t.req.abort():typeof t.destroy=="function"?t.destroy(e):typeof t.close=="function"?t.close():e?br.nextTick(RU,t,e):br.nextTick(lO,t),t.destroyed||(t[yU]=!0))}l(OU,"destroyer");fO.exports={construct:FU,destroyer:OU,destroy:SU,undestroy:EU,errorOrDestroy:Py}});var Xu=T((gX,hO)=>{"use strict";var{ArrayIsArray:xU,ObjectSetPrototypeOf:uO}=ge(),{EventEmitter:Ku}=ne("events");function Ju(t){Ku.call(this,t)}l(Ju,"Stream");uO(Ju.prototype,Ku.prototype);uO(Ju,Ku);Ju.prototype.pipe=function(t,e){let r=this;function i(u){t.writable&&t.write(u)===!1&&r.pause&&r.pause()}l(i,"ondata"),r.on("data",i);function n(){r.readable&&r.resume&&r.resume()}l(n,"ondrain"),t.on("drain",n),!t._isStdio&&(!e||e.end!==!1)&&(r.on("end",o),r.on("close",f));let s=!1;function o(){s||(s=!0,t.end())}l(o,"onend");function f(){s||(s=!0,typeof t.destroy=="function"&&t.destroy())}l(f,"onclose");function c(u){a(),Ku.listenerCount(this,"error")===0&&this.emit("error",u)}l(c,"onerror"),Ny(r,"error",c),Ny(t,"error",c);function a(){r.removeListener("data",i),t.removeListener("drain",n),r.removeListener("end",o),r.removeListener("close",f),r.removeListener("error",c),t.removeListener("error",c),r.removeListener("end",a),r.removeListener("close",a),t.removeListener("close",a)}return l(a,"cleanup"),r.on("end",a),r.on("close",a),t.on("close",a),t.emit("pipe",r),t};function Ny(t,e,r){if(typeof t.prependListener=="function")return t.prependListener(e,r);!t._events||!t._events[e]?t.on(e,r):xU(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]}l(Ny,"prependListener");hO.exports={Stream:Ju,prependListener:Ny}});var _c=T((_X,Yu)=>{"use strict";var{SymbolDispose:AU}=ge(),{AbortError:dO,codes:PU}=it(),{isNodeStream:pO,isWebStream:NU,kControllerErrorFunction:CU}=gr(),DU=Br(),{ERR_INVALID_ARG_TYPE:mO}=PU,Cy,IU=l((t,e)=>{if(typeof t!="object"||!("aborted"in t))throw new mO(e,"AbortSignal",t)},"validateAbortSignal");Yu.exports.addAbortSignal=l(function(e,r){if(IU(e,"signal"),!pO(r)&&!NU(r))throw new mO("stream",["ReadableStream","WritableStream","Stream"],r);return Yu.exports.addAbortSignalNoValidate(e,r)},"addAbortSignal");Yu.exports.addAbortSignalNoValidate=function(t,e){if(typeof t!="object"||!("aborted"in t))return e;let r=pO(e)?()=>{e.destroy(new dO(void 0,{cause:t.reason}))}:()=>{e[CU](new dO(void 0,{cause:t.reason}))};if(t.aborted)r();else{Cy=Cy||ht().addAbortListener;let i=Cy(t,r);DU(e,i[AU])}return e}});var gO=T((vX,yO)=>{"use strict";var{StringPrototypeSlice:wO,SymbolIterator:$U,TypedArrayPrototypeSet:Zu,Uint8Array:BU}=ge(),{Buffer:Dy}=ne("buffer"),{inspect:MU}=ht(),mo;yO.exports=(mo=class{constructor(){this.head=null,this.tail=null,this.length=0}push(e){let r={data:e,next:null};this.length>0?this.tail.next=r:this.head=r,this.tail=r,++this.length}unshift(e){let r={data:e,next:this.head};this.length===0&&(this.tail=r),this.head=r,++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 r=this.head,i=""+r.data;for(;(r=r.next)!==null;)i+=e+r.data;return i}concat(e){if(this.length===0)return Dy.alloc(0);let r=Dy.allocUnsafe(e>>>0),i=this.head,n=0;for(;i;)Zu(r,i.data,n),n+=i.data.length,i=i.next;return r}consume(e,r){let i=this.head.data;if(e<i.length){let n=i.slice(0,e);return this.head.data=i.slice(e),n}return e===i.length?this.shift():r?this._getString(e):this._getBuffer(e)}first(){return this.head.data}*[$U](){for(let e=this.head;e;e=e.next)yield e.data}_getString(e){let r="",i=this.head,n=0;do{let s=i.data;if(e>s.length)r+=s,e-=s.length;else{e===s.length?(r+=s,++n,i.next?this.head=i.next:this.head=this.tail=null):(r+=wO(s,0,e),this.head=i,i.data=wO(s,e));break}++n}while((i=i.next)!==null);return this.length-=n,r}_getBuffer(e){let r=Dy.allocUnsafe(e),i=e,n=this.head,s=0;do{let o=n.data;if(e>o.length)Zu(r,o,i-e),e-=o.length;else{e===o.length?(Zu(r,o,i-e),++s,n.next?this.head=n.next:this.head=this.tail=null):(Zu(r,new BU(o.buffer,o.byteOffset,e),i-e),this.head=n,n.data=o.slice(e));break}++s}while((n=n.next)!==null);return this.length-=s,r}[Symbol.for("nodejs.util.inspect.custom")](e,r){return MU(this,{...r,depth:0,customInspect:!1})}},l(mo,"BufferList"),mo)});var Sc=T((FX,vO)=>{"use strict";var{MathFloor:LU,NumberIsInteger:jU}=ge(),{validateInteger:qU}=ho(),{ERR_INVALID_ARG_VALUE:UU}=it().codes,bO=16*1024,_O=16;function WU(t,e,r){return t.highWaterMark!=null?t.highWaterMark:e?t[r]:null}l(WU,"highWaterMarkFrom");function SO(t){return t?_O:bO}l(SO,"getDefaultHighWaterMark");function zU(t,e){qU(e,"value",0),t?_O=e:bO=e}l(zU,"setDefaultHighWaterMark");function HU(t,e,r,i){let n=WU(e,i,r);if(n!=null){if(!jU(n)||n<0){let s=i?`options.${r}`:"options.highWaterMark";throw new UU(s,n)}return LU(n)}return SO(t.objectMode)}l(HU,"getHighWaterMark");vO.exports={getHighWaterMark:HU,getDefaultHighWaterMark:SO,setDefaultHighWaterMark:zU}});var TO=T(FO=>{"use strict";var $y=va().Buffer,EO=$y.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 VU(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}}l(VU,"_normalizeEncoding");function GU(t){var e=VU(t);if(typeof e!="string"&&($y.isEncoding===EO||!EO(t)))throw new Error("Unknown encoding: "+t);return e||t}l(GU,"normalizeEncoding");FO.StringDecoder=vc;function vc(t){this.encoding=GU(t);var e;switch(this.encoding){case"utf16le":this.text=QU,this.end=eW,e=4;break;case"utf8":this.fillLast=XU,e=4;break;case"base64":this.text=tW,this.end=rW,e=3;break;default:this.write=iW,this.end=nW;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=$y.allocUnsafe(e)}l(vc,"StringDecoder");vc.prototype.write=function(t){if(t.length===0)return"";var e,r;if(this.lastNeed){if(e=this.fillLast(t),e===void 0)return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r<t.length?e?e+this.text(t,r):this.text(t,r):e||""};vc.prototype.end=ZU;vc.prototype.text=YU;vc.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 Iy(t){return t<=127?0:t>>5===6?2:t>>4===14?3:t>>3===30?4:t>>6===2?-1:-2}l(Iy,"utf8CheckByte");function KU(t,e,r){var i=e.length-1;if(i<r)return 0;var n=Iy(e[i]);return n>=0?(n>0&&(t.lastNeed=n-1),n):--i<r||n===-2?0:(n=Iy(e[i]),n>=0?(n>0&&(t.lastNeed=n-2),n):--i<r||n===-2?0:(n=Iy(e[i]),n>=0?(n>0&&(n===2?n=0:t.lastNeed=n-3),n):0))}l(KU,"utf8CheckIncomplete");function JU(t,e,r){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"}}l(JU,"utf8CheckExtraBytes");function XU(t){var e=this.lastTotal-this.lastNeed,r=JU(this,t,e);if(r!==void 0)return r;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}l(XU,"utf8FillLast");function YU(t,e){var r=KU(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=r;var i=t.length-(r-this.lastNeed);return t.copy(this.lastChar,0,i),t.toString("utf8",e,i)}l(YU,"utf8Text");function ZU(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"\uFFFD":e}l(ZU,"utf8End");function QU(t,e){if((t.length-e)%2===0){var r=t.toString("utf16le",e);if(r){var i=r.charCodeAt(r.length-1);if(i>=55296&&i<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}l(QU,"utf16Text");function eW(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,r)}return e}l(eW,"utf16End");function tW(t,e){var r=(t.length-e)%3;return r===0?t.toString("base64",e):(this.lastNeed=3-r,this.lastTotal=3,r===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-r))}l(tW,"base64Text");function rW(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}l(rW,"base64End");function iW(t){return t.toString(this.encoding)}l(iW,"simpleWrite");function nW(t){return t&&t.length?this.write(t):""}l(nW,"simpleEnd")});var By=T((OX,xO)=>{"use strict";var kO=bi(),{PromisePrototypeThen:sW,SymbolAsyncIterator:RO,SymbolIterator:OO}=ge(),{Buffer:oW}=ne("buffer"),{ERR_INVALID_ARG_TYPE:aW,ERR_STREAM_NULL_VALUES:cW}=it().codes;function lW(t,e,r){let i;if(typeof e=="string"||e instanceof oW)return new t({objectMode:!0,...r,read(){this.push(e),this.push(null)}});let n;if(e&&e[RO])n=!0,i=e[RO]();else if(e&&e[OO])n=!1,i=e[OO]();else throw new aW("iterable",["Iterable"],e);let s=new t({objectMode:!0,highWaterMark:1,...r}),o=!1;s._read=function(){o||(o=!0,c())},s._destroy=function(a,u){sW(f(a),()=>kO.nextTick(u,a),h=>kO.nextTick(u,h||a))};async function f(a){let u=a!=null,h=typeof i.throw=="function";if(u&&h){let{value:d,done:p}=await i.throw(a);if(await d,p)return}if(typeof i.return=="function"){let{value:d}=await i.return();await d}}l(f,"close");async function c(){for(;;){try{let{value:a,done:u}=n?await i.next():i.next();if(u)s.push(null);else{let h=a&&typeof a.then=="function"?await a:a;if(h===null)throw o=!1,new cW;if(s.push(h))continue;o=!1}}catch(a){s.destroy(a)}break}}return l(c,"next"),s}l(lW,"from");xO.exports=lW});var Fc=T((AX,GO)=>{"use strict";var tr=bi(),{ArrayPrototypeIndexOf:fW,NumberIsInteger:uW,NumberIsNaN:hW,NumberParseInt:dW,ObjectDefineProperties:Hy,ObjectKeys:pW,ObjectSetPrototypeOf:NO,Promise:CO,SafeSet:mW,SymbolAsyncDispose:wW,SymbolAsyncIterator:yW,Symbol:gW}=ge();GO.exports=K;K.ReadableState=rh;var{EventEmitter:bW}=ne("events"),{Stream:Si,prependListener:_W}=Xu(),{Buffer:My}=ne("buffer"),{addAbortSignal:SW}=_c(),DO=Br(),Z=ht().debuglog("stream",t=>{Z=t}),vW=gO(),go=fn(),{getHighWaterMark:EW,getDefaultHighWaterMark:FW}=Sc(),{aggregateTwoErrors:AO,codes:{ERR_INVALID_ARG_TYPE:TW,ERR_METHOD_NOT_IMPLEMENTED:kW,ERR_OUT_OF_RANGE:RW,ERR_STREAM_PUSH_AFTER_EOF:OW,ERR_STREAM_UNSHIFT_AFTER_END_EVENT:xW},AbortError:AW}=it(),{validateObject:PW}=ho(),un=gW("kPaused"),{StringDecoder:IO}=TO(),NW=By();NO(K.prototype,Si.prototype);NO(K,Si);var Ly=l(()=>{},"nop"),{errorOrDestroy:wo}=go,yo=1,CW=2,$O=4,Ec=8,BO=16,Qu=32,eh=64,MO=128,DW=256,IW=512,$W=1024,Wy=2048,zy=4096,BW=8192,MW=16384,LW=32768,LO=65536,jW=1<<17,qW=1<<18;function Ie(t){return{enumerable:!1,get(){return(this.state&t)!==0},set(e){e?this.state|=t:this.state&=~t}}}l(Ie,"makeBitMapDescriptor");Hy(rh.prototype,{objectMode:Ie(yo),ended:Ie(CW),endEmitted:Ie($O),reading:Ie(Ec),constructed:Ie(BO),sync:Ie(Qu),needReadable:Ie(eh),emittedReadable:Ie(MO),readableListening:Ie(DW),resumeScheduled:Ie(IW),errorEmitted:Ie($W),emitClose:Ie(Wy),autoDestroy:Ie(zy),destroyed:Ie(BW),closed:Ie(MW),closeEmitted:Ie(LW),multiAwaitDrain:Ie(LO),readingMore:Ie(jW),dataEmitted:Ie(qW)});function rh(t,e,r){typeof r!="boolean"&&(r=e instanceof _r()),this.state=Wy|zy|BO|Qu,t&&t.objectMode&&(this.state|=yo),r&&t&&t.readableObjectMode&&(this.state|=yo),this.highWaterMark=t?EW(this,t,"readableHighWaterMark",r):FW(!1),this.buffer=new vW,this.length=0,this.pipes=[],this.flowing=null,this[un]=null,t&&t.emitClose===!1&&(this.state&=~Wy),t&&t.autoDestroy===!1&&(this.state&=~zy),this.errored=null,this.defaultEncoding=t&&t.defaultEncoding||"utf8",this.awaitDrainWriters=null,this.decoder=null,this.encoding=null,t&&t.encoding&&(this.decoder=new IO(t.encoding),this.encoding=t.encoding)}l(rh,"ReadableState");function K(t){if(!(this instanceof K))return new K(t);let e=this instanceof _r();this._readableState=new rh(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&&SW(t.signal,this)),Si.call(this,t),go.construct(this,()=>{this._readableState.needReadable&&th(this,this._readableState)})}l(K,"Readable");K.prototype.destroy=go.destroy;K.prototype._undestroy=go.undestroy;K.prototype._destroy=function(t,e){e(t)};K.prototype[bW.captureRejectionSymbol]=function(t){this.destroy(t)};K.prototype[wW]=function(){let t;return this.destroyed||(t=this.readableEnded?null:new AW,this.destroy(t)),new CO((e,r)=>DO(this,i=>i&&i!==t?r(i):e(null)))};K.prototype.push=function(t,e){return jO(this,t,e,!1)};K.prototype.unshift=function(t,e){return jO(this,t,e,!0)};function jO(t,e,r,i){Z("readableAddChunk",e);let n=t._readableState,s;if(n.state&yo||(typeof e=="string"?(r=r||n.defaultEncoding,n.encoding!==r&&(i&&n.encoding?e=My.from(e,r).toString(n.encoding):(e=My.from(e,r),r=""))):e instanceof My?r="":Si._isUint8Array(e)?(e=Si._uint8ArrayToBuffer(e),r=""):e!=null&&(s=new TW("chunk",["string","Buffer","Uint8Array"],e))),s)wo(t,s);else if(e===null)n.state&=~Ec,zW(t,n);else if(n.state&yo||e&&e.length>0)if(i)if(n.state&$O)wo(t,new xW);else{if(n.destroyed||n.errored)return!1;jy(t,n,e,!0)}else if(n.ended)wo(t,new OW);else{if(n.destroyed||n.errored)return!1;n.state&=~Ec,n.decoder&&!r?(e=n.decoder.write(e),n.objectMode||e.length!==0?jy(t,n,e,!1):th(t,n)):jy(t,n,e,!1)}else i||(n.state&=~Ec,th(t,n));return!n.ended&&(n.length<n.highWaterMark||n.length===0)}l(jO,"readableAddChunk");function jy(t,e,r,i){e.flowing&&e.length===0&&!e.sync&&t.listenerCount("data")>0?(e.state&LO?e.awaitDrainWriters.clear():e.awaitDrainWriters=null,e.dataEmitted=!0,t.emit("data",r)):(e.length+=e.objectMode?1:r.length,i?e.buffer.unshift(r):e.buffer.push(r),e.state&eh&&ih(t)),th(t,e)}l(jy,"addChunk");K.prototype.isPaused=function(){let t=this._readableState;return t[un]===!0||t.flowing===!1};K.prototype.setEncoding=function(t){let e=new IO(t);this._readableState.decoder=e,this._readableState.encoding=this._readableState.decoder.encoding;let r=this._readableState.buffer,i="";for(let n of r)i+=e.write(n);return r.clear(),i!==""&&r.push(i),this._readableState.length=i.length,this};var UW=1073741824;function WW(t){if(t>UW)throw new RW("size","<= 1GiB",t);return t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++,t}l(WW,"computeNewHighWaterMark");function PO(t,e){return t<=0||e.length===0&&e.ended?0:e.state&yo?1:hW(t)?e.flowing&&e.length?e.buffer.first().length:e.length:t<=e.length?t:e.ended?e.length:0}l(PO,"howMuchToRead");K.prototype.read=function(t){Z("read",t),t===void 0?t=NaN:uW(t)||(t=dW(t,10));let e=this._readableState,r=t;if(t>e.highWaterMark&&(e.highWaterMark=WW(t)),t!==0&&(e.state&=~MO),t===0&&e.needReadable&&((e.highWaterMark!==0?e.length>=e.highWaterMark:e.length>0)||e.ended))return Z("read: emitReadable",e.length,e.ended),e.length===0&&e.ended?qy(this):ih(this),null;if(t=PO(t,e),t===0&&e.ended)return e.length===0&&qy(this),null;let i=(e.state&eh)!==0;if(Z("need readable",i),(e.length===0||e.length-t<e.highWaterMark)&&(i=!0,Z("length less than watermark",i)),e.ended||e.reading||e.destroyed||e.errored||!e.constructed)i=!1,Z("reading, ended or constructing",i);else if(i){Z("do read"),e.state|=Ec|Qu,e.length===0&&(e.state|=eh);try{this._read(e.highWaterMark)}catch(s){wo(this,s)}e.state&=~Qu,e.reading||(t=PO(r,e))}let n;return t>0?n=HO(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),r!==t&&e.ended&&qy(this)),n!==null&&!e.errorEmitted&&!e.closeEmitted&&(e.dataEmitted=!0,this.emit("data",n)),n};function zW(t,e){if(Z("onEofChunk"),!e.ended){if(e.decoder){let r=e.decoder.end();r&&r.length&&(e.buffer.push(r),e.length+=e.objectMode?1:r.length)}e.ended=!0,e.sync?ih(t):(e.needReadable=!1,e.emittedReadable=!0,qO(t))}}l(zW,"onEofChunk");function ih(t){let e=t._readableState;Z("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(Z("emitReadable",e.flowing),e.emittedReadable=!0,tr.nextTick(qO,t))}l(ih,"emitReadable");function qO(t){let e=t._readableState;Z("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,WO(t)}l(qO,"emitReadable_");function th(t,e){!e.readingMore&&e.constructed&&(e.readingMore=!0,tr.nextTick(HW,t,e))}l(th,"maybeReadMore");function HW(t,e){for(;!e.reading&&!e.ended&&(e.length<e.highWaterMark||e.flowing&&e.length===0);){let r=e.length;if(Z("maybeReadMore read 0"),t.read(0),r===e.length)break}e.readingMore=!1}l(HW,"maybeReadMore_");K.prototype._read=function(t){throw new kW("_read()")};K.prototype.pipe=function(t,e){let r=this,i=this._readableState;i.pipes.length===1&&(i.multiAwaitDrain||(i.multiAwaitDrain=!0,i.awaitDrainWriters=new mW(i.awaitDrainWriters?[i.awaitDrainWriters]:[]))),i.pipes.push(t),Z("pipe count=%d opts=%j",i.pipes.length,e);let s=(!e||e.end!==!1)&&t!==tr.stdout&&t!==tr.stderr?f:y;i.endEmitted?tr.nextTick(s):r.once("end",s),t.on("unpipe",o);function o(g,_){Z("onunpipe"),g===r&&_&&_.hasUnpiped===!1&&(_.hasUnpiped=!0,u())}l(o,"onunpipe");function f(){Z("onend"),t.end()}l(f,"onend");let c,a=!1;function u(){Z("cleanup"),t.removeListener("close",m),t.removeListener("finish",w),c&&t.removeListener("drain",c),t.removeListener("error",p),t.removeListener("unpipe",o),r.removeListener("end",f),r.removeListener("end",y),r.removeListener("data",d),a=!0,c&&i.awaitDrainWriters&&(!t._writableState||t._writableState.needDrain)&&c()}l(u,"cleanup");function h(){a||(i.pipes.length===1&&i.pipes[0]===t?(Z("false write response, pause",0),i.awaitDrainWriters=t,i.multiAwaitDrain=!1):i.pipes.length>1&&i.pipes.includes(t)&&(Z("false write response, pause",i.awaitDrainWriters.size),i.awaitDrainWriters.add(t)),r.pause()),c||(c=VW(r,t),t.on("drain",c))}l(h,"pause"),r.on("data",d);function d(g){Z("ondata");let _=t.write(g);Z("dest.write",_),_===!1&&h()}l(d,"ondata");function p(g){if(Z("onerror",g),y(),t.removeListener("error",p),t.listenerCount("error")===0){let _=t._writableState||t._readableState;_&&!_.errorEmitted?wo(t,g):t.emit("error",g)}}l(p,"onerror"),_W(t,"error",p);function m(){t.removeListener("finish",w),y()}l(m,"onclose"),t.once("close",m);function w(){Z("onfinish"),t.removeListener("close",m),y()}l(w,"onfinish"),t.once("finish",w);function y(){Z("unpipe"),r.unpipe(t)}return l(y,"unpipe"),t.emit("pipe",r),t.writableNeedDrain===!0?h():i.flowing||(Z("pipe resume"),r.resume()),t};function VW(t,e){return l(function(){let i=t._readableState;i.awaitDrainWriters===e?(Z("pipeOnDrain",1),i.awaitDrainWriters=null):i.multiAwaitDrain&&(Z("pipeOnDrain",i.awaitDrainWriters.size),i.awaitDrainWriters.delete(e)),(!i.awaitDrainWriters||i.awaitDrainWriters.size===0)&&t.listenerCount("data")&&t.resume()},"pipeOnDrainFunctionResult")}l(VW,"pipeOnDrain");K.prototype.unpipe=function(t){let e=this._readableState,r={hasUnpiped:!1};if(e.pipes.length===0)return this;if(!t){let n=e.pipes;e.pipes=[],this.pause();for(let s=0;s<n.length;s++)n[s].emit("unpipe",this,{hasUnpiped:!1});return this}let i=fW(e.pipes,t);return i===-1?this:(e.pipes.splice(i,1),e.pipes.length===0&&this.pause(),t.emit("unpipe",this,r),this)};K.prototype.on=function(t,e){let r=Si.prototype.on.call(this,t,e),i=this._readableState;return t==="data"?(i.readableListening=this.listenerCount("readable")>0,i.flowing!==!1&&this.resume()):t==="readable"&&!i.endEmitted&&!i.readableListening&&(i.readableListening=i.needReadable=!0,i.flowing=!1,i.emittedReadable=!1,Z("on readable",i.length,i.reading),i.length?ih(this):i.reading||tr.nextTick(GW,this)),r};K.prototype.addListener=K.prototype.on;K.prototype.removeListener=function(t,e){let r=Si.prototype.removeListener.call(this,t,e);return t==="readable"&&tr.nextTick(UO,this),r};K.prototype.off=K.prototype.removeListener;K.prototype.removeAllListeners=function(t){let e=Si.prototype.removeAllListeners.apply(this,arguments);return(t==="readable"||t===void 0)&&tr.nextTick(UO,this),e};function UO(t){let e=t._readableState;e.readableListening=t.listenerCount("readable")>0,e.resumeScheduled&&e[un]===!1?e.flowing=!0:t.listenerCount("data")>0?t.resume():e.readableListening||(e.flowing=null)}l(UO,"updateReadableListening");function GW(t){Z("readable nexttick read 0"),t.read(0)}l(GW,"nReadingNextTick");K.prototype.resume=function(){let t=this._readableState;return t.flowing||(Z("resume"),t.flowing=!t.readableListening,KW(this,t)),t[un]=!1,this};function KW(t,e){e.resumeScheduled||(e.resumeScheduled=!0,tr.nextTick(JW,t,e))}l(KW,"resume");function JW(t,e){Z("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),WO(t),e.flowing&&!e.reading&&t.read(0)}l(JW,"resume_");K.prototype.pause=function(){return Z("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(Z("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState[un]=!0,this};function WO(t){let e=t._readableState;for(Z("flow",e.flowing);e.flowing&&t.read()!==null;);}l(WO,"flow");K.prototype.wrap=function(t){let e=!1;t.on("data",i=>{!this.push(i)&&t.pause&&(e=!0,t.pause())}),t.on("end",()=>{this.push(null)}),t.on("error",i=>{wo(this,i)}),t.on("close",()=>{this.destroy()}),t.on("destroy",()=>{this.destroy()}),this._read=()=>{e&&t.resume&&(e=!1,t.resume())};let r=pW(t);for(let i=1;i<r.length;i++){let n=r[i];this[n]===void 0&&typeof t[n]=="function"&&(this[n]=t[n].bind(t))}return this};K.prototype[yW]=function(){return zO(this)};K.prototype.iterator=function(t){return t!==void 0&&PW(t,"options"),zO(this,t)};function zO(t,e){typeof t.read!="function"&&(t=K.wrap(t,{objectMode:!0}));let r=XW(t,e);return r.stream=t,r}l(zO,"streamToAsyncIterator");async function*XW(t,e){let r=Ly;function i(o){this===t?(r(),r=Ly):r=o}l(i,"next"),t.on("readable",i);let n,s=DO(t,{writable:!1},o=>{n=o?AO(n,o):null,r(),r=Ly});try{for(;;){let o=t.destroyed?null:t.read();if(o!==null)yield o;else{if(n)throw n;if(n===null)return;await new CO(i)}}}catch(o){throw n=AO(n,o),n}finally{(n||e?.destroyOnReturn!==!1)&&(n===void 0||t._readableState.autoDestroy)?go.destroyer(t,null):(t.off("readable",i),s())}}l(XW,"createAsyncIterator");Hy(K.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:l(function(){return this._readableState.dataEmitted},"get")},readableAborted:{__proto__:null,enumerable:!1,get:l(function(){return!!(this._readableState.readable!==!1&&(this._readableState.destroyed||this._readableState.errored)&&!this._readableState.endEmitted)},"get")},readableHighWaterMark:{__proto__:null,enumerable:!1,get:l(function(){return this._readableState.highWaterMark},"get")},readableBuffer:{__proto__:null,enumerable:!1,get:l(function(){return this._readableState&&this._readableState.buffer},"get")},readableFlowing:{__proto__:null,enumerable:!1,get:l(function(){return this._readableState.flowing},"get"),set:l(function(t){this._readableState&&(this._readableState.flowing=t)},"set")},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}}});Hy(rh.prototype,{pipesCount:{__proto__:null,get(){return this.pipes.length}},paused:{__proto__:null,get(){return this[un]!==!1},set(t){this[un]=!!t}}});K._fromList=HO;function HO(t,e){if(e.length===0)return null;let r;return e.objectMode?r=e.buffer.shift():!t||t>=e.length?(e.decoder?r=e.buffer.join(""):e.buffer.length===1?r=e.buffer.first():r=e.buffer.concat(e.length),e.buffer.clear()):r=e.buffer.consume(t,e.decoder),r}l(HO,"fromList");function qy(t){let e=t._readableState;Z("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,tr.nextTick(YW,e,t))}l(qy,"endReadable");function YW(t,e){if(Z("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)tr.nextTick(ZW,e);else if(t.autoDestroy){let r=e._writableState;(!r||r.autoDestroy&&(r.finished||r.writable===!1))&&e.destroy()}}}l(YW,"endReadableNT");function ZW(t){t.writable&&!t.writableEnded&&!t.destroyed&&t.end()}l(ZW,"endWritableNT");K.from=function(t,e){return NW(K,t,e)};var Uy;function VO(){return Uy===void 0&&(Uy={}),Uy}l(VO,"lazyWebStreams");K.fromWeb=function(t,e){return VO().newStreamReadableFromReadableStream(t,e)};K.toWeb=function(t,e){return VO().newReadableStreamFromStreamReadable(t,e)};K.wrap=function(t,e){var r,i;return new K({objectMode:(r=(i=t.readableObjectMode)!==null&&i!==void 0?i:t.objectMode)!==null&&r!==void 0?r:!0,...e,destroy(n,s){go.destroyer(t,n),s(n)}}).wrap(t)}});var ch=T((NX,sx)=>{"use strict";var hn=bi(),{ArrayPrototypeSlice:XO,Error:QW,FunctionPrototypeSymbolHasInstance:YO,ObjectDefineProperty:ZO,ObjectDefineProperties:e6,ObjectSetPrototypeOf:QO,StringPrototypeToLowerCase:t6,Symbol:r6,SymbolHasInstance:i6}=ge();sx.exports=_e;_e.WritableState=Rc;var{EventEmitter:n6}=ne("events"),Tc=Xu().Stream,{Buffer:nh}=ne("buffer"),ah=fn(),{addAbortSignal:s6}=_c(),{getHighWaterMark:o6,getDefaultHighWaterMark:a6}=Sc(),{ERR_INVALID_ARG_TYPE:c6,ERR_METHOD_NOT_IMPLEMENTED:l6,ERR_MULTIPLE_CALLBACK:ex,ERR_STREAM_CANNOT_PIPE:f6,ERR_STREAM_DESTROYED:kc,ERR_STREAM_ALREADY_FINISHED:u6,ERR_STREAM_NULL_VALUES:h6,ERR_STREAM_WRITE_AFTER_END:d6,ERR_UNKNOWN_ENCODING:tx}=it().codes,{errorOrDestroy:bo}=ah;QO(_e.prototype,Tc.prototype);QO(_e,Tc);function Ky(){}l(Ky,"nop");var _o=r6("kOnFinished");function Rc(t,e,r){typeof r!="boolean"&&(r=e instanceof _r()),this.objectMode=!!(t&&t.objectMode),r&&(this.objectMode=this.objectMode||!!(t&&t.writableObjectMode)),this.highWaterMark=t?o6(this,t,"writableHighWaterMark",r):a6(!1),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;let i=!!(t&&t.decodeStrings===!1);this.decodeStrings=!i,this.defaultEncoding=t&&t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=m6.bind(void 0,e),this.writecb=null,this.writelen=0,this.afterWriteTickInfo=null,oh(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[_o]=[]}l(Rc,"WritableState");function oh(t){t.buffered=[],t.bufferedIndex=0,t.allBuffers=!0,t.allNoop=!0}l(oh,"resetBuffer");Rc.prototype.getBuffer=l(function(){return XO(this.buffered,this.bufferedIndex)},"getBuffer");ZO(Rc.prototype,"bufferedRequestCount",{__proto__:null,get(){return this.buffered.length-this.bufferedIndex}});function _e(t){let e=this instanceof _r();if(!e&&!YO(_e,this))return new _e(t);this._writableState=new Rc(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&&s6(t.signal,this)),Tc.call(this,t),ah.construct(this,()=>{let r=this._writableState;r.writing||Xy(this,r),Yy(this,r)})}l(_e,"Writable");ZO(_e,i6,{__proto__:null,value:l(function(t){return YO(this,t)?!0:this!==_e?!1:t&&t._writableState instanceof Rc},"value")});_e.prototype.pipe=function(){bo(this,new f6)};function rx(t,e,r,i){let n=t._writableState;if(typeof r=="function")i=r,r=n.defaultEncoding;else{if(!r)r=n.defaultEncoding;else if(r!=="buffer"&&!nh.isEncoding(r))throw new tx(r);typeof i!="function"&&(i=Ky)}if(e===null)throw new h6;if(!n.objectMode)if(typeof e=="string")n.decodeStrings!==!1&&(e=nh.from(e,r),r="buffer");else if(e instanceof nh)r="buffer";else if(Tc._isUint8Array(e))e=Tc._uint8ArrayToBuffer(e),r="buffer";else throw new c6("chunk",["string","Buffer","Uint8Array"],e);let s;return n.ending?s=new d6:n.destroyed&&(s=new kc("write")),s?(hn.nextTick(i,s),bo(t,s,!0),s):(n.pendingcb++,p6(t,n,e,r,i))}l(rx,"_write");_e.prototype.write=function(t,e,r){return rx(this,t,e,r)===!0};_e.prototype.cork=function(){this._writableState.corked++};_e.prototype.uncork=function(){let t=this._writableState;t.corked&&(t.corked--,t.writing||Xy(this,t))};_e.prototype.setDefaultEncoding=l(function(e){if(typeof e=="string"&&(e=t6(e)),!nh.isEncoding(e))throw new tx(e);return this._writableState.defaultEncoding=e,this},"setDefaultEncoding");function p6(t,e,r,i,n){let s=e.objectMode?1:r.length;e.length+=s;let o=e.length<e.highWaterMark;return o||(e.needDrain=!0),e.writing||e.corked||e.errored||!e.constructed?(e.buffered.push({chunk:r,encoding:i,callback:n}),e.allBuffers&&i!=="buffer"&&(e.allBuffers=!1),e.allNoop&&n!==Ky&&(e.allNoop=!1)):(e.writelen=s,e.writecb=n,e.writing=!0,e.sync=!0,t._write(r,i,e.onwrite),e.sync=!1),o&&!e.errored&&!e.destroyed}l(p6,"writeOrBuffer");function KO(t,e,r,i,n,s,o){e.writelen=i,e.writecb=o,e.writing=!0,e.sync=!0,e.destroyed?e.onwrite(new kc("write")):r?t._writev(n,e.onwrite):t._write(n,s,e.onwrite),e.sync=!1}l(KO,"doWrite");function JO(t,e,r,i){--e.pendingcb,i(r),Jy(e),bo(t,r)}l(JO,"onwriteError");function m6(t,e){let r=t._writableState,i=r.sync,n=r.writecb;if(typeof n!="function"){bo(t,new ex);return}r.writing=!1,r.writecb=null,r.length-=r.writelen,r.writelen=0,e?(e.stack,r.errored||(r.errored=e),t._readableState&&!t._readableState.errored&&(t._readableState.errored=e),i?hn.nextTick(JO,t,r,e,n):JO(t,r,e,n)):(r.buffered.length>r.bufferedIndex&&Xy(t,r),i?r.afterWriteTickInfo!==null&&r.afterWriteTickInfo.cb===n?r.afterWriteTickInfo.count++:(r.afterWriteTickInfo={count:1,cb:n,stream:t,state:r},hn.nextTick(w6,r.afterWriteTickInfo)):ix(t,r,1,n))}l(m6,"onwrite");function w6({stream:t,state:e,count:r,cb:i}){return e.afterWriteTickInfo=null,ix(t,e,r,i)}l(w6,"afterWriteTick");function ix(t,e,r,i){for(!e.ending&&!t.destroyed&&e.length===0&&e.needDrain&&(e.needDrain=!1,t.emit("drain"));r-- >0;)e.pendingcb--,i();e.destroyed&&Jy(e),Yy(t,e)}l(ix,"afterWrite");function Jy(t){if(t.writing)return;for(let n=t.bufferedIndex;n<t.buffered.length;++n){var e;let{chunk:s,callback:o}=t.buffered[n],f=t.objectMode?1:s.length;t.length-=f,o((e=t.errored)!==null&&e!==void 0?e:new kc("write"))}let r=t[_o].splice(0);for(let n=0;n<r.length;n++){var i;r[n]((i=t.errored)!==null&&i!==void 0?i:new kc("end"))}oh(t)}l(Jy,"errorBuffer");function Xy(t,e){if(e.corked||e.bufferProcessing||e.destroyed||!e.constructed)return;let{buffered:r,bufferedIndex:i,objectMode:n}=e,s=r.length-i;if(!s)return;let o=i;if(e.bufferProcessing=!0,s>1&&t._writev){e.pendingcb-=s-1;let f=e.allNoop?Ky:a=>{for(let u=o;u<r.length;++u)r[u].callback(a)},c=e.allNoop&&o===0?r:XO(r,o);c.allBuffers=e.allBuffers,KO(t,e,!0,e.length,c,"",f),oh(e)}else{do{let{chunk:f,encoding:c,callback:a}=r[o];r[o++]=null;let u=n?1:f.length;KO(t,e,!1,u,f,c,a)}while(o<r.length&&!e.writing);o===r.length?oh(e):o>256?(r.splice(0,o),e.bufferedIndex=0):e.bufferedIndex=o}e.bufferProcessing=!1}l(Xy,"clearBuffer");_e.prototype._write=function(t,e,r){if(this._writev)this._writev([{chunk:t,encoding:e}],r);else throw new l6("_write()")};_e.prototype._writev=null;_e.prototype.end=function(t,e,r){let i=this._writableState;typeof t=="function"?(r=t,t=null,e=null):typeof e=="function"&&(r=e,e=null);let n;if(t!=null){let s=rx(this,t,e);s instanceof QW&&(n=s)}return i.corked&&(i.corked=1,this.uncork()),n||(!i.errored&&!i.ending?(i.ending=!0,Yy(this,i,!0),i.ended=!0):i.finished?n=new u6("end"):i.destroyed&&(n=new kc("end"))),typeof r=="function"&&(n||i.finished?hn.nextTick(r,n):i[_o].push(r)),this};function sh(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}l(sh,"needFinish");function y6(t,e){let r=!1;function i(n){if(r){bo(t,n??ex());return}if(r=!0,e.pendingcb--,n){let s=e[_o].splice(0);for(let o=0;o<s.length;o++)s[o](n);bo(t,n,e.sync)}else sh(e)&&(e.prefinished=!0,t.emit("prefinish"),e.pendingcb++,hn.nextTick(Gy,t,e))}l(i,"onFinish"),e.sync=!0,e.pendingcb++;try{t._final(i)}catch(n){i(n)}e.sync=!1}l(y6,"callFinal");function g6(t,e){!e.prefinished&&!e.finalCalled&&(typeof t._final=="function"&&!e.destroyed?(e.finalCalled=!0,y6(t,e)):(e.prefinished=!0,t.emit("prefinish")))}l(g6,"prefinish");function Yy(t,e,r){sh(e)&&(g6(t,e),e.pendingcb===0&&(r?(e.pendingcb++,hn.nextTick((i,n)=>{sh(n)?Gy(i,n):n.pendingcb--},t,e)):sh(e)&&(e.pendingcb++,Gy(t,e))))}l(Yy,"finishMaybe");function Gy(t,e){e.pendingcb--,e.finished=!0;let r=e[_o].splice(0);for(let i=0;i<r.length;i++)r[i]();if(t.emit("finish"),e.autoDestroy){let i=t._readableState;(!i||i.autoDestroy&&(i.endEmitted||i.readable===!1))&&t.destroy()}}l(Gy,"finish");e6(_e.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:l(function(){return!!(this._writableState.writable!==!1&&(this._writableState.destroyed||this._writableState.errored)&&!this._writableState.finished)},"get")}});var b6=ah.destroy;_e.prototype.destroy=function(t,e){let r=this._writableState;return!r.destroyed&&(r.bufferedIndex<r.buffered.length||r[_o].length)&&hn.nextTick(Jy,r),b6.call(this,t,e),this};_e.prototype._undestroy=ah.undestroy;_e.prototype._destroy=function(t,e){e(t)};_e.prototype[n6.captureRejectionSymbol]=function(t){this.destroy(t)};var Vy;function nx(){return Vy===void 0&&(Vy={}),Vy}l(nx,"lazyWebStreams");_e.fromWeb=function(t,e){return nx().newStreamWritableFromWritableStream(t,e)};_e.toWeb=function(t){return nx().newWritableStreamFromStreamWritable(t)}});var _x=T((DX,bx)=>{var Zy=bi(),_6=ne("buffer"),{isReadable:S6,isWritable:v6,isIterable:ox,isNodeStream:E6,isReadableNodeStream:ax,isWritableNodeStream:cx,isDuplexNodeStream:F6,isReadableStream:lx,isWritableStream:fx}=gr(),ux=Br(),{AbortError:yx,codes:{ERR_INVALID_ARG_TYPE:T6,ERR_INVALID_RETURN_VALUE:hx}}=it(),{destroyer:vo}=fn(),k6=_r(),gx=Fc(),R6=ch(),{createDeferredPromise:dx}=ht(),px=By(),mx=globalThis.Blob||_6.Blob,O6=l(typeof mx<"u"?function(e){return e instanceof mx}:function(e){return!1},"isBlob"),x6=globalThis.AbortController||fo().AbortController,{FunctionPrototypeCall:wx}=ge(),Qy=class Qy extends k6{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)}};l(Qy,"Duplexify");var vi=Qy;bx.exports=l(function t(e,r){if(F6(e))return e;if(ax(e))return So({readable:e});if(cx(e))return So({writable:e});if(E6(e))return So({writable:!1,readable:!1});if(lx(e))return So({readable:gx.fromWeb(e)});if(fx(e))return So({writable:R6.fromWeb(e)});if(typeof e=="function"){let{value:n,write:s,final:o,destroy:f}=A6(e);if(ox(n))return px(vi,n,{objectMode:!0,write:s,final:o,destroy:f});let c=n?.then;if(typeof c=="function"){let a,u=wx(c,n,h=>{if(h!=null)throw new hx("nully","body",h)},h=>{vo(a,h)});return a=new vi({objectMode:!0,readable:!1,write:s,final(h){o(async()=>{try{await u,Zy.nextTick(h,null)}catch(d){Zy.nextTick(h,d)}})},destroy:f})}throw new hx("Iterable, AsyncIterable or AsyncFunction",r,n)}if(O6(e))return t(e.arrayBuffer());if(ox(e))return px(vi,e,{objectMode:!0,writable:!1});if(lx(e?.readable)&&fx(e?.writable))return vi.fromWeb(e);if(typeof e?.writable=="object"||typeof e?.readable=="object"){let n=e!=null&&e.readable?ax(e?.readable)?e?.readable:t(e.readable):void 0,s=e!=null&&e.writable?cx(e?.writable)?e?.writable:t(e.writable):void 0;return So({readable:n,writable:s})}let i=e?.then;if(typeof i=="function"){let n;return wx(i,e,s=>{s!=null&&n.push(s),n.push(null)},s=>{vo(n,s)}),n=new vi({objectMode:!0,writable:!1,read(){}})}throw new T6(r,["Blob","ReadableStream","WritableStream","Stream","Iterable","AsyncIterable","Function","{ readable, writable } pair","Promise"],e)},"duplexify");function A6(t){let{promise:e,resolve:r}=dx(),i=new x6,n=i.signal;return{value:t(async function*(){for(;;){let o=e;e=null;let{chunk:f,done:c,cb:a}=await o;if(Zy.nextTick(a),c)return;if(n.aborted)throw new yx(void 0,{cause:n.reason});({promise:e,resolve:r}=dx()),yield f}}(),{signal:n}),write(o,f,c){let a=r;r=null,a({chunk:o,done:!1,cb:c})},final(o){let f=r;r=null,f({done:!0,cb:o})},destroy(o,f){i.abort(),f(o)}}}l(A6,"fromAsyncGen");function So(t){let e=t.readable&&typeof t.readable.read!="function"?gx.wrap(t.readable):t.readable,r=t.writable,i=!!S6(e),n=!!v6(r),s,o,f,c,a;function u(h){let d=c;c=null,d?d(h):h&&a.destroy(h)}return l(u,"onfinished"),a=new vi({readableObjectMode:!!(e!=null&&e.readableObjectMode),writableObjectMode:!!(r!=null&&r.writableObjectMode),readable:i,writable:n}),n&&(ux(r,h=>{n=!1,h&&vo(e,h),u(h)}),a._write=function(h,d,p){r.write(h,d)?p():s=p},a._final=function(h){r.end(),o=h},r.on("drain",function(){if(s){let h=s;s=null,h()}}),r.on("finish",function(){if(o){let h=o;o=null,h()}})),i&&(ux(e,h=>{i=!1,h&&vo(e,h),u(h)}),e.on("readable",function(){if(f){let h=f;f=null,h()}}),e.on("end",function(){a.push(null)}),a._read=function(){for(;;){let h=e.read();if(h===null){f=a._read;return}if(!a.push(h))return}}),a._destroy=function(h,d){!h&&c!==null&&(h=new yx),f=null,s=null,o=null,c===null?d(h):(c=d,vo(r,h),vo(e,h))},a}l(So,"_duplexify")});var _r=T(($X,Ex)=>{"use strict";var{ObjectDefineProperties:P6,ObjectGetOwnPropertyDescriptor:Mr,ObjectKeys:N6,ObjectSetPrototypeOf:Sx}=ge();Ex.exports=rr;var rg=Fc(),Wt=ch();Sx(rr.prototype,rg.prototype);Sx(rr,rg);{let t=N6(Wt.prototype);for(let e=0;e<t.length;e++){let r=t[e];rr.prototype[r]||(rr.prototype[r]=Wt.prototype[r])}}function rr(t){if(!(this instanceof rr))return new rr(t);rg.call(this,t),Wt.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}l(rr,"Duplex");P6(rr.prototype,{writable:{__proto__:null,...Mr(Wt.prototype,"writable")},writableHighWaterMark:{__proto__:null,...Mr(Wt.prototype,"writableHighWaterMark")},writableObjectMode:{__proto__:null,...Mr(Wt.prototype,"writableObjectMode")},writableBuffer:{__proto__:null,...Mr(Wt.prototype,"writableBuffer")},writableLength:{__proto__:null,...Mr(Wt.prototype,"writableLength")},writableFinished:{__proto__:null,...Mr(Wt.prototype,"writableFinished")},writableCorked:{__proto__:null,...Mr(Wt.prototype,"writableCorked")},writableEnded:{__proto__:null,...Mr(Wt.prototype,"writableEnded")},writableNeedDrain:{__proto__:null,...Mr(Wt.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 eg;function vx(){return eg===void 0&&(eg={}),eg}l(vx,"lazyWebStreams");rr.fromWeb=function(t,e){return vx().newStreamDuplexFromReadableWritablePair(t,e)};rr.toWeb=function(t){return vx().newReadableWritablePairFromDuplex(t)};var tg;rr.from=function(t){return tg||(tg=_x()),tg(t,"body")}});var sg=T((MX,Tx)=>{"use strict";var{ObjectSetPrototypeOf:Fx,Symbol:C6}=ge();Tx.exports=Lr;var{ERR_METHOD_NOT_IMPLEMENTED:D6}=it().codes,ng=_r(),{getHighWaterMark:I6}=Sc();Fx(Lr.prototype,ng.prototype);Fx(Lr,ng);var Oc=C6("kCallback");function Lr(t){if(!(this instanceof Lr))return new Lr(t);let e=t?I6(this,t,"readableHighWaterMark",!0):null;e===0&&(t={...t,highWaterMark:null,readableHighWaterMark:e,writableHighWaterMark:t.writableHighWaterMark||0}),ng.call(this,t),this._readableState.sync=!1,this[Oc]=null,t&&(typeof t.transform=="function"&&(this._transform=t.transform),typeof t.flush=="function"&&(this._flush=t.flush)),this.on("prefinish",$6)}l(Lr,"Transform");function ig(t){typeof this._flush=="function"&&!this.destroyed?this._flush((e,r)=>{if(e){t?t(e):this.destroy(e);return}r!=null&&this.push(r),this.push(null),t&&t()}):(this.push(null),t&&t())}l(ig,"final");function $6(){this._final!==ig&&ig.call(this)}l($6,"prefinish");Lr.prototype._final=ig;Lr.prototype._transform=function(t,e,r){throw new D6("_transform()")};Lr.prototype._write=function(t,e,r){let i=this._readableState,n=this._writableState,s=i.length;this._transform(t,e,(o,f)=>{if(o){r(o);return}f!=null&&this.push(f),n.ended||s===i.length||i.length<i.highWaterMark?r():this[Oc]=r})};Lr.prototype._read=function(){if(this[Oc]){let t=this[Oc];this[Oc]=null,t()}}});var ag=T((jX,Rx)=>{"use strict";var{ObjectSetPrototypeOf:kx}=ge();Rx.exports=Eo;var og=sg();kx(Eo.prototype,og.prototype);kx(Eo,og);function Eo(t){if(!(this instanceof Eo))return new Eo(t);og.call(this,t)}l(Eo,"PassThrough");Eo.prototype._transform=function(t,e,r){r(null,t)}});var hh=T((UX,Nx)=>{var xc=bi(),{ArrayIsArray:B6,Promise:M6,SymbolAsyncIterator:L6,SymbolDispose:j6}=ge(),uh=Br(),{once:q6}=ht(),U6=fn(),Ox=_r(),{aggregateTwoErrors:W6,codes:{ERR_INVALID_ARG_TYPE:wg,ERR_INVALID_RETURN_VALUE:cg,ERR_MISSING_ARGS:z6,ERR_STREAM_DESTROYED:H6,ERR_STREAM_PREMATURE_CLOSE:V6},AbortError:G6}=it(),{validateFunction:K6,validateAbortSignal:J6}=ho(),{isIterable:dn,isReadable:lg,isReadableNodeStream:fh,isNodeStream:xx,isTransformStream:Fo,isWebStream:X6,isReadableStream:fg,isReadableFinished:Y6}=gr(),Z6=globalThis.AbortController||fo().AbortController,ug,hg,dg;function Ax(t,e,r){let i=!1;t.on("close",()=>{i=!0});let n=uh(t,{readable:e,writable:r},s=>{i=!s});return{destroy:l(s=>{i||(i=!0,U6.destroyer(t,s||new H6("pipe")))},"destroy"),cleanup:n}}l(Ax,"destroyer");function Q6(t){return K6(t[t.length-1],"streams[stream.length - 1]"),t.pop()}l(Q6,"popCallback");function pg(t){if(dn(t))return t;if(fh(t))return e4(t);throw new wg("val",["Readable","Iterable","AsyncIterable"],t)}l(pg,"makeAsyncIterable");async function*e4(t){hg||(hg=Fc()),yield*hg.prototype[L6].call(t)}l(e4,"fromReadable");async function lh(t,e,r,{end:i}){let n,s=null,o=l(a=>{if(a&&(n=a),s){let u=s;s=null,u()}},"resume"),f=l(()=>new M6((a,u)=>{n?u(n):s=l(()=>{n?u(n):a()},"onresolve")}),"wait");e.on("drain",o);let c=uh(e,{readable:!1},o);try{e.writableNeedDrain&&await f();for await(let a of t)e.write(a)||await f();i&&(e.end(),await f()),r()}catch(a){r(n!==a?W6(n,a):a)}finally{c(),e.off("drain",o)}}l(lh,"pumpToNode");async function mg(t,e,r,{end:i}){Fo(e)&&(e=e.writable);let n=e.getWriter();try{for await(let s of t)await n.ready,n.write(s).catch(()=>{});await n.ready,i&&await n.close(),r()}catch(s){try{await n.abort(s),r(s)}catch(o){r(o)}}}l(mg,"pumpToWeb");function t4(...t){return Px(t,q6(Q6(t)))}l(t4,"pipeline");function Px(t,e,r){if(t.length===1&&B6(t[0])&&(t=t[0]),t.length<2)throw new z6("streams");let i=new Z6,n=i.signal,s=r?.signal,o=[];J6(s,"options.signal");function f(){m(new G6)}l(f,"abort"),dg=dg||ht().addAbortListener;let c;s&&(c=dg(s,f));let a,u,h=[],d=0;function p(F){m(F,--d===0)}l(p,"finish");function m(F,E){var R;if(F&&(!a||a.code==="ERR_STREAM_PREMATURE_CLOSE")&&(a=F),!(!a&&!E)){for(;h.length;)h.shift()(a);(R=c)===null||R===void 0||R[j6](),i.abort(),E&&(a||o.forEach(P=>P()),xc.nextTick(e,a,u))}}l(m,"finishImpl");let w;for(let F=0;F<t.length;F++){let E=t[F],R=F<t.length-1,P=F>0,S=R||r?.end!==!1,O=F===t.length-1;if(xx(E)){let v=function(A){A&&A.name!=="AbortError"&&A.code!=="ERR_STREAM_PREMATURE_CLOSE"&&p(A)};var _=v;if(l(v,"onError"),S){let{destroy:A,cleanup:x}=Ax(E,R,P);h.push(A),lg(E)&&O&&o.push(x)}E.on("error",v),lg(E)&&O&&o.push(()=>{E.removeListener("error",v)})}if(F===0)if(typeof E=="function"){if(w=E({signal:n}),!dn(w))throw new cg("Iterable, AsyncIterable or Stream","source",w)}else dn(E)||fh(E)||Fo(E)?w=E:w=Ox.from(E);else if(typeof E=="function"){if(Fo(w)){var y;w=pg((y=w)===null||y===void 0?void 0:y.readable)}else w=pg(w);if(w=E(w,{signal:n}),R){if(!dn(w,!0))throw new cg("AsyncIterable",`transform[${F-1}]`,w)}else{var g;ug||(ug=ag());let v=new ug({objectMode:!0}),A=(g=w)===null||g===void 0?void 0:g.then;if(typeof A=="function")d++,A.call(w,M=>{u=M,M!=null&&v.write(M),S&&v.end(),xc.nextTick(p)},M=>{v.destroy(M),xc.nextTick(p,M)});else if(dn(w,!0))d++,lh(w,v,p,{end:S});else if(fg(w)||Fo(w)){let M=w.readable||w;d++,lh(M,v,p,{end:S})}else throw new cg("AsyncIterable or Promise","destination",w);w=v;let{destroy:x,cleanup:I}=Ax(w,!1,!0);h.push(x),O&&o.push(I)}}else if(xx(E)){if(fh(w)){d+=2;let v=r4(w,E,p,{end:S});lg(E)&&O&&o.push(v)}else if(Fo(w)||fg(w)){let v=w.readable||w;d++,lh(v,E,p,{end:S})}else if(dn(w))d++,lh(w,E,p,{end:S});else throw new wg("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],w);w=E}else if(X6(E)){if(fh(w))d++,mg(pg(w),E,p,{end:S});else if(fg(w)||dn(w))d++,mg(w,E,p,{end:S});else if(Fo(w))d++,mg(w.readable,E,p,{end:S});else throw new wg("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],w);w=E}else w=Ox.from(E)}return(n!=null&&n.aborted||s!=null&&s.aborted)&&xc.nextTick(f),w}l(Px,"pipelineImpl");function r4(t,e,r,{end:i}){let n=!1;if(e.on("close",()=>{n||r(new V6)}),t.pipe(e,{end:!1}),i){let o=function(){n=!0,e.end()};var s=o;l(o,"endFn"),Y6(t)?xc.nextTick(o):t.once("end",o)}else r();return uh(t,{readable:!0,writable:!1},o=>{let f=t._readableState;o&&o.code==="ERR_STREAM_PREMATURE_CLOSE"&&f&&f.ended&&!f.errored&&!f.errorEmitted?t.once("end",r).once("error",r):r(o)}),uh(e,{readable:!1,writable:!0},r)}l(r4,"pipe");Nx.exports={pipelineImpl:Px,pipeline:t4}});var gg=T((zX,Mx)=>{"use strict";var{pipeline:i4}=hh(),dh=_r(),{destroyer:n4}=fn(),{isNodeStream:ph,isReadable:Cx,isWritable:Dx,isWebStream:yg,isTransformStream:pn,isWritableStream:Ix,isReadableStream:$x}=gr(),{AbortError:s4,codes:{ERR_INVALID_ARG_VALUE:Bx,ERR_MISSING_ARGS:o4}}=it(),a4=Br();Mx.exports=l(function(...e){if(e.length===0)throw new o4("streams");if(e.length===1)return dh.from(e[0]);let r=[...e];if(typeof e[0]=="function"&&(e[0]=dh.from(e[0])),typeof e[e.length-1]=="function"){let p=e.length-1;e[p]=dh.from(e[p])}for(let p=0;p<e.length;++p)if(!(!ph(e[p])&&!yg(e[p]))){if(p<e.length-1&&!(Cx(e[p])||$x(e[p])||pn(e[p])))throw new Bx(`streams[${p}]`,r[p],"must be readable");if(p>0&&!(Dx(e[p])||Ix(e[p])||pn(e[p])))throw new Bx(`streams[${p}]`,r[p],"must be writable")}let i,n,s,o,f;function c(p){let m=o;o=null,m?m(p):p?f.destroy(p):!d&&!h&&f.destroy()}l(c,"onfinished");let a=e[0],u=i4(e,c),h=!!(Dx(a)||Ix(a)||pn(a)),d=!!(Cx(u)||$x(u)||pn(u));if(f=new dh({writableObjectMode:!!(a!=null&&a.writableObjectMode),readableObjectMode:!!(u!=null&&u.readableObjectMode),writable:h,readable:d}),h){if(ph(a))f._write=function(m,w,y){a.write(m,w)?y():i=y},f._final=function(m){a.end(),n=m},a.on("drain",function(){if(i){let m=i;i=null,m()}});else if(yg(a)){let w=(pn(a)?a.writable:a).getWriter();f._write=async function(y,g,_){try{await w.ready,w.write(y).catch(()=>{}),_()}catch(F){_(F)}},f._final=async function(y){try{await w.ready,w.close().catch(()=>{}),n=y}catch(g){y(g)}}}let p=pn(u)?u.readable:u;a4(p,()=>{if(n){let m=n;n=null,m()}})}if(d){if(ph(u))u.on("readable",function(){if(s){let p=s;s=null,p()}}),u.on("end",function(){f.push(null)}),f._read=function(){for(;;){let p=u.read();if(p===null){s=f._read;return}if(!f.push(p))return}};else if(yg(u)){let m=(pn(u)?u.readable:u).getReader();f._read=async function(){for(;;)try{let{value:w,done:y}=await m.read();if(!f.push(w))return;if(y){f.push(null);return}}catch{return}}}}return f._destroy=function(p,m){!p&&o!==null&&(p=new s4),s=null,i=null,n=null,o===null?m(p):(o=m,ph(u)&&n4(u,p))},f},"compose")});var Kx=T((VX,Sg)=>{"use strict";var c4=globalThis.AbortController||fo().AbortController,{codes:{ERR_INVALID_ARG_VALUE:l4,ERR_INVALID_ARG_TYPE:Ac,ERR_MISSING_ARGS:f4,ERR_OUT_OF_RANGE:u4},AbortError:Sr}=it(),{validateAbortSignal:mn,validateInteger:Lx,validateObject:wn}=ho(),h4=ge().Symbol("kWeak"),d4=ge().Symbol("kResistStopPropagation"),{finished:p4}=Br(),m4=gg(),{addAbortSignalNoValidate:w4}=_c(),{isWritable:y4,isNodeStream:g4}=gr(),{deprecate:b4}=ht(),{ArrayPrototypePush:_4,Boolean:S4,MathFloor:jx,Number:v4,NumberIsNaN:E4,Promise:qx,PromiseReject:Ux,PromiseResolve:F4,PromisePrototypeThen:Wx,Symbol:Hx}=ge(),mh=Hx("kEmpty"),zx=Hx("kEof");function T4(t,e){if(e!=null&&wn(e,"options"),e?.signal!=null&&mn(e.signal,"options.signal"),g4(t)&&!y4(t))throw new l4("stream",t,"must be writable");let r=m4(this,t);return e!=null&&e.signal&&w4(e.signal,r),r}l(T4,"compose");function wh(t,e){if(typeof t!="function")throw new Ac("fn",["Function","AsyncFunction"],t);e!=null&&wn(e,"options"),e?.signal!=null&&mn(e.signal,"options.signal");let r=1;e?.concurrency!=null&&(r=jx(e.concurrency));let i=r-1;return e?.highWaterMark!=null&&(i=jx(e.highWaterMark)),Lx(r,"options.concurrency",1),Lx(i,"options.highWaterMark",0),i+=r,l(async function*(){let s=ht().AbortSignalAny([e?.signal].filter(S4)),o=this,f=[],c={signal:s},a,u,h=!1,d=0;function p(){h=!0,m()}l(p,"onCatch");function m(){d-=1,w()}l(m,"afterItemProcessed");function w(){u&&!h&&d<r&&f.length<i&&(u(),u=null)}l(w,"maybeResume");async function y(){try{for await(let g of o){if(h)return;if(s.aborted)throw new Sr;try{if(g=t(g,c),g===mh)continue;g=F4(g)}catch(_){g=Ux(_)}d+=1,Wx(g,m,p),f.push(g),a&&(a(),a=null),!h&&(f.length>=i||d>=r)&&await new qx(_=>{u=_})}f.push(zx)}catch(g){let _=Ux(g);Wx(_,m,p),f.push(_)}finally{h=!0,a&&(a(),a=null)}}l(y,"pump"),y();try{for(;;){for(;f.length>0;){let g=await f[0];if(g===zx)return;if(s.aborted)throw new Sr;g!==mh&&(yield g),f.shift(),w()}await new qx(g=>{a=g})}}finally{h=!0,u&&(u(),u=null)}},"map").call(this)}l(wh,"map");function k4(t=void 0){return t!=null&&wn(t,"options"),t?.signal!=null&&mn(t.signal,"options.signal"),l(async function*(){let r=0;for await(let n of this){var i;if(t!=null&&(i=t.signal)!==null&&i!==void 0&&i.aborted)throw new Sr({cause:t.signal.reason});yield[r++,n]}},"asIndexedPairs").call(this)}l(k4,"asIndexedPairs");async function Vx(t,e=void 0){for await(let r of _g.call(this,t,e))return!0;return!1}l(Vx,"some");async function R4(t,e=void 0){if(typeof t!="function")throw new Ac("fn",["Function","AsyncFunction"],t);return!await Vx.call(this,async(...r)=>!await t(...r),e)}l(R4,"every");async function O4(t,e){for await(let r of _g.call(this,t,e))return r}l(O4,"find");async function x4(t,e){if(typeof t!="function")throw new Ac("fn",["Function","AsyncFunction"],t);async function r(i,n){return await t(i,n),mh}l(r,"forEachFn");for await(let i of wh.call(this,r,e));}l(x4,"forEach");function _g(t,e){if(typeof t!="function")throw new Ac("fn",["Function","AsyncFunction"],t);async function r(i,n){return await t(i,n)?i:mh}return l(r,"filterFn"),wh.call(this,r,e)}l(_g,"filter");var vg=class vg extends f4{constructor(){super("reduce"),this.message="Reduce of an empty stream requires an initial value"}};l(vg,"ReduceAwareErrMissingArgs");var bg=vg;async function A4(t,e,r){var i;if(typeof t!="function")throw new Ac("reducer",["Function","AsyncFunction"],t);r!=null&&wn(r,"options"),r?.signal!=null&&mn(r.signal,"options.signal");let n=arguments.length>1;if(r!=null&&(i=r.signal)!==null&&i!==void 0&&i.aborted){let a=new Sr(void 0,{cause:r.signal.reason});throw this.once("error",()=>{}),await p4(this.destroy(a)),a}let s=new c4,o=s.signal;if(r!=null&&r.signal){let a={once:!0,[h4]:this,[d4]:!0};r.signal.addEventListener("abort",()=>s.abort(),a)}let f=!1;try{for await(let a of this){var c;if(f=!0,r!=null&&(c=r.signal)!==null&&c!==void 0&&c.aborted)throw new Sr;n?e=await t(e,a,{signal:o}):(e=a,n=!0)}if(!f&&!n)throw new bg}finally{s.abort()}return e}l(A4,"reduce");async function P4(t){t!=null&&wn(t,"options"),t?.signal!=null&&mn(t.signal,"options.signal");let e=[];for await(let i of this){var r;if(t!=null&&(r=t.signal)!==null&&r!==void 0&&r.aborted)throw new Sr(void 0,{cause:t.signal.reason});_4(e,i)}return e}l(P4,"toArray");function N4(t,e){let r=wh.call(this,t,e);return l(async function*(){for await(let n of r)yield*n},"flatMap").call(this)}l(N4,"flatMap");function Gx(t){if(t=v4(t),E4(t))return 0;if(t<0)throw new u4("number",">= 0",t);return t}l(Gx,"toIntegerOrInfinity");function C4(t,e=void 0){return e!=null&&wn(e,"options"),e?.signal!=null&&mn(e.signal,"options.signal"),t=Gx(t),l(async function*(){var i;if(e!=null&&(i=e.signal)!==null&&i!==void 0&&i.aborted)throw new Sr;for await(let s of this){var n;if(e!=null&&(n=e.signal)!==null&&n!==void 0&&n.aborted)throw new Sr;t--<=0&&(yield s)}},"drop").call(this)}l(C4,"drop");function D4(t,e=void 0){return e!=null&&wn(e,"options"),e?.signal!=null&&mn(e.signal,"options.signal"),t=Gx(t),l(async function*(){var i;if(e!=null&&(i=e.signal)!==null&&i!==void 0&&i.aborted)throw new Sr;for await(let s of this){var n;if(e!=null&&(n=e.signal)!==null&&n!==void 0&&n.aborted)throw new Sr;if(t-- >0&&(yield s),t<=0)return}},"take").call(this)}l(D4,"take");Sg.exports.streamReturningOperators={asIndexedPairs:b4(k4,"readable.asIndexedPairs will be removed in a future version."),drop:C4,filter:_g,flatMap:N4,map:wh,take:D4,compose:T4};Sg.exports.promiseReturningOperators={every:R4,forEach:x4,reduce:A4,toArray:P4,some:Vx,find:O4}});var Eg=T((KX,Jx)=>{"use strict";var{ArrayPrototypePop:I4,Promise:$4}=ge(),{isIterable:B4,isNodeStream:M4,isWebStream:L4}=gr(),{pipelineImpl:j4}=hh(),{finished:q4}=Br();Fg();function U4(...t){return new $4((e,r)=>{let i,n,s=t[t.length-1];if(s&&typeof s=="object"&&!M4(s)&&!B4(s)&&!L4(s)){let o=I4(t);i=o.signal,n=o.end}j4(t,(o,f)=>{o?r(o):e(f)},{signal:i,end:n})})}l(U4,"pipeline");Jx.exports={finished:q4,pipeline:U4}});var Fg=T((XX,nA)=>{"use strict";var{Buffer:W4}=ne("buffer"),{ObjectDefineProperty:jr,ObjectKeys:Zx,ReflectApply:Qx}=ge(),{promisify:{custom:eA}}=ht(),{streamReturningOperators:Xx,promiseReturningOperators:Yx}=Kx(),{codes:{ERR_ILLEGAL_CONSTRUCTOR:tA}}=it(),z4=gg(),{setDefaultHighWaterMark:H4,getDefaultHighWaterMark:V4}=Sc(),{pipeline:rA}=hh(),{destroyer:G4}=fn(),iA=Br(),Tg=Eg(),Pc=gr(),me=nA.exports=Xu().Stream;me.isDestroyed=Pc.isDestroyed;me.isDisturbed=Pc.isDisturbed;me.isErrored=Pc.isErrored;me.isReadable=Pc.isReadable;me.isWritable=Pc.isWritable;me.Readable=Fc();for(let t of Zx(Xx)){let r=function(...i){if(new.target)throw tA();return me.Readable.from(Qx(e,this,i))};l(r,"fn");let e=Xx[t];jr(r,"name",{__proto__:null,value:e.name}),jr(r,"length",{__proto__:null,value:e.length}),jr(me.Readable.prototype,t,{__proto__:null,value:r,enumerable:!1,configurable:!0,writable:!0})}for(let t of Zx(Yx)){let r=function(...i){if(new.target)throw tA();return Qx(e,this,i)};l(r,"fn");let e=Yx[t];jr(r,"name",{__proto__:null,value:e.name}),jr(r,"length",{__proto__:null,value:e.length}),jr(me.Readable.prototype,t,{__proto__:null,value:r,enumerable:!1,configurable:!0,writable:!0})}me.Writable=ch();me.Duplex=_r();me.Transform=sg();me.PassThrough=ag();me.pipeline=rA;var{addAbortSignal:K4}=_c();me.addAbortSignal=K4;me.finished=iA;me.destroy=G4;me.compose=z4;me.setDefaultHighWaterMark=H4;me.getDefaultHighWaterMark=V4;jr(me,"promises",{__proto__:null,configurable:!0,enumerable:!0,get(){return Tg}});jr(rA,eA,{__proto__:null,enumerable:!0,get(){return Tg.pipeline}});jr(iA,eA,{__proto__:null,enumerable:!0,get(){return Tg.finished}});me.Stream=me;me._isUint8Array=l(function(e){return e instanceof Uint8Array},"isUint8Array");me._uint8ArrayToBuffer=l(function(e){return W4.from(e.buffer,e.byteOffset,e.byteLength)},"_uint8ArrayToBuffer")});var sA=T((ZX,Y)=>{"use strict";var $e=ne("stream");if($e&&process.env.READABLE_STREAM==="disable"){let t=$e.promises;Y.exports._uint8ArrayToBuffer=$e._uint8ArrayToBuffer,Y.exports._isUint8Array=$e._isUint8Array,Y.exports.isDisturbed=$e.isDisturbed,Y.exports.isErrored=$e.isErrored,Y.exports.isReadable=$e.isReadable,Y.exports.Readable=$e.Readable,Y.exports.Writable=$e.Writable,Y.exports.Duplex=$e.Duplex,Y.exports.Transform=$e.Transform,Y.exports.PassThrough=$e.PassThrough,Y.exports.addAbortSignal=$e.addAbortSignal,Y.exports.finished=$e.finished,Y.exports.destroy=$e.destroy,Y.exports.pipeline=$e.pipeline,Y.exports.compose=$e.compose,Object.defineProperty($e,"promises",{configurable:!0,enumerable:!0,get(){return t}}),Y.exports.Stream=$e.Stream}else{let t=Fg(),e=Eg(),r=t.Readable.destroy;Y.exports=t.Readable,Y.exports._uint8ArrayToBuffer=t._uint8ArrayToBuffer,Y.exports._isUint8Array=t._isUint8Array,Y.exports.isDisturbed=t.isDisturbed,Y.exports.isErrored=t.isErrored,Y.exports.isReadable=t.isReadable,Y.exports.Readable=t.Readable,Y.exports.Writable=t.Writable,Y.exports.Duplex=t.Duplex,Y.exports.Transform=t.Transform,Y.exports.PassThrough=t.PassThrough,Y.exports.addAbortSignal=t.addAbortSignal,Y.exports.finished=t.finished,Y.exports.destroy=t.destroy,Y.exports.destroy=r,Y.exports.pipeline=t.pipeline,Y.exports.compose=t.compose,Object.defineProperty(t,"promises",{configurable:!0,enumerable:!0,get(){return e}}),Y.exports.Stream=t.Stream}Y.exports.default=Y.exports});var nr=T(Lo=>{"use strict";Object.defineProperty(Lo,"__esModule",{value:!0});Lo.constants=Lo.SEP=void 0;Lo.SEP="/";Lo.constants={O_RDONLY:0,O_WRONLY:1,O_RDWR:2,S_IFMT:61440,S_IFREG:32768,S_IFDIR:16384,S_IFCHR:8192,S_IFBLK:24576,S_IFIFO:4096,S_IFLNK:40960,S_IFSOCK:49152,O_CREAT:64,O_EXCL:128,O_NOCTTY:256,O_TRUNC:512,O_APPEND:1024,O_DIRECTORY:65536,O_NOATIME:262144,O_NOFOLLOW:131072,O_SYNC:1052672,O_SYMLINK:2097152,O_DIRECT:16384,O_NONBLOCK:2048,S_IRWXU:448,S_IRUSR:256,S_IWUSR:128,S_IXUSR:64,S_IRWXG:56,S_IRGRP:32,S_IWGRP:16,S_IXGRP:8,S_IRWXO:7,S_IROTH:4,S_IWOTH:2,S_IXOTH:1,F_OK:0,R_OK:4,W_OK:2,X_OK:1,UV_FS_SYMLINK_DIR:1,UV_FS_SYMLINK_JUNCTION:2,UV_FS_COPYFILE_EXCL:1,UV_FS_COPYFILE_FICLONE:2,UV_FS_COPYFILE_FICLONE_FORCE:4,COPYFILE_EXCL:1,COPYFILE_FICLONE:2,COPYFILE_FICLONE_FORCE:4}});var Dg=T(Ic=>{"use strict";Object.defineProperty(Ic,"__esModule",{value:!0});Ic.Stats=void 0;var uz=nr(),{S_IFMT:hz,S_IFDIR:dz,S_IFREG:pz,S_IFBLK:mz,S_IFCHR:wz,S_IFLNK:yz,S_IFIFO:gz,S_IFSOCK:bz}=uz.constants,Nh=class Nh{static build(e,r=!1){let i=new Nh,{uid:n,gid:s,atime:o,mtime:f,ctime:c}=e,a=r?h=>BigInt(h):h=>h;i.uid=a(n),i.gid=a(s),i.rdev=a(e.rdev),i.blksize=a(4096),i.ino=a(e.ino),i.size=a(e.getSize()),i.blocks=a(1),i.atime=o,i.mtime=f,i.ctime=c,i.birthtime=c,i.atimeMs=a(o.getTime()),i.mtimeMs=a(f.getTime());let u=a(c.getTime());if(i.ctimeMs=u,i.birthtimeMs=u,r){i.atimeNs=BigInt(o.getTime())*BigInt(1e6),i.mtimeNs=BigInt(f.getTime())*BigInt(1e6);let h=BigInt(c.getTime())*BigInt(1e6);i.ctimeNs=h,i.birthtimeNs=h}return i.dev=a(0),i.mode=a(e.mode),i.nlink=a(e.nlink),i}_checkModeProperty(e){return(Number(this.mode)&hz)===e}isDirectory(){return this._checkModeProperty(dz)}isFile(){return this._checkModeProperty(pz)}isBlockDevice(){return this._checkModeProperty(mz)}isCharacterDevice(){return this._checkModeProperty(wz)}isSymbolicLink(){return this._checkModeProperty(yz)}isFIFO(){return this._checkModeProperty(gz)}isSocket(){return this._checkModeProperty(bz)}};l(Nh,"Stats");var Ph=Nh;Ic.Stats=Ph;Ic.default=Ph});var YA=T(Ch=>{"use strict";Object.defineProperty(Ch,"__esModule",{value:!0});Ch.Buffer=void 0;var _z=ne("node:buffer");Object.defineProperty(Ch,"Buffer",{enumerable:!0,get:l(function(){return _z.Buffer},"get")})});var Ri=T(ki=>{"use strict";Object.defineProperty(ki,"__esModule",{value:!0});ki.bufferFrom=ki.bufferAllocUnsafe=ki.Buffer=void 0;var Dh=YA();Object.defineProperty(ki,"Buffer",{enumerable:!0,get:l(function(){return Dh.Buffer},"get")});function ZA(t,...e){return new Dh.Buffer(t,...e)}l(ZA,"bufferV0P12Ponyfill");var Sz=Dh.Buffer.allocUnsafe||ZA;ki.bufferAllocUnsafe=Sz;var vz=Dh.Buffer.from||ZA;ki.bufferFrom=vz});var $g=T(jo=>{"use strict";Object.defineProperty(jo,"__esModule",{value:!0});jo.inherits=Ez;jo.promisify=Fz;jo.inspect=Ig;jo.format=Tz;function Ez(t,e){if(t==null)throw new TypeError("The constructor to inherit from is not defined");if(e==null)throw new TypeError("The super constructor to inherit from is not defined");t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}l(Ez,"inherits");function Fz(t){if(typeof t!="function")throw new TypeError('The "original" argument must be of type function');return function(...e){return new Promise((r,i)=>{t.call(this,...e,(n,s)=>{n?i(n):r(s)})})}}l(Fz,"promisify");function Ig(t){return t===null?"null":t===void 0?"undefined":typeof t=="string"?`'${t}'`:typeof t=="number"||typeof t=="boolean"?String(t):Array.isArray(t)?`[ ${t.map(r=>Ig(r)).join(", ")} ]`:typeof t=="object"?`{ ${Object.entries(t).map(([r,i])=>`${r}: ${Ig(i)}`).join(", ")} }`:String(t)}l(Ig,"inspect");function Tz(t,...e){if(e.length===0)return t;let r=t,i=0;for(r=r.replace(/%[sdj%]/g,n=>{if(i>=e.length)return n;let s=e[i++];switch(n){case"%s":return String(s);case"%d":return Number(s).toString();case"%j":try{return JSON.stringify(s)}catch{return"[Circular]"}case"%%":return"%";default:return n}});i<e.length;)r+=" "+String(e[i++]);return r}l(Tz,"format")});var $c=T(ot=>{"use strict";Object.defineProperty(ot,"__esModule",{value:!0});ot.AssertionError=ot.RangeError=ot.TypeError=ot.Error=void 0;ot.message=tP;ot.E=Oi;var Bg=$g(),QA=typeof Symbol>"u"?"_kCode":Symbol("code"),eP={};function Lg(t){var e;return e=class extends t{constructor(i,...n){super(tP(i,n)),this.code=i,this[QA]=i,this.name=`${super.name} [${this[QA]}]`}},l(e,"NodeError"),e}l(Lg,"makeNodeError");var Ih=globalThis,jg=class jg extends Ih.Error{constructor(e){if(typeof e!="object"||e===null)throw new ot.TypeError("ERR_INVALID_ARG_TYPE","options","object");e.message?super(e.message):super(`${(0,Bg.inspect)(e.actual).slice(0,128)} ${e.operator} ${(0,Bg.inspect)(e.expected).slice(0,128)}`),this.generatedMessage=!e.message,this.name="AssertionError [ERR_ASSERTION]",this.code="ERR_ASSERTION",this.actual=e.actual,this.expected=e.expected,this.operator=e.operator,ot.Error.captureStackTrace(this,e.stackStartFunction)}};l(jg,"AssertionError");var Mg=jg;ot.AssertionError=Mg;function tP(t,e){if(typeof t!="string")throw new ot.Error("Error message key must be a string");let r=eP[t];if(!r)throw new ot.Error(`An invalid error message key was used: ${t}.`);let i;if(typeof r=="function")i=r;else{if(i=Bg.format,e===void 0||e.length===0)return r;e.unshift(r)}return String(i.apply(null,e))}l(tP,"message");function Oi(t,e){eP[t]=typeof e=="function"?e:String(e)}l(Oi,"E");ot.Error=Lg(Ih.Error);ot.TypeError=Lg(Ih.TypeError);ot.RangeError=Lg(Ih.RangeError);Oi("ERR_DIR_CLOSED","Directory handle was closed");Oi("ERR_DIR_CONCURRENT_OPERATION","Cannot do synchronous work on directory handle with concurrent asynchronous operations");Oi("ERR_INVALID_FILE_URL_HOST",'File URL host must be "localhost" or empty on %s');Oi("ERR_INVALID_FILE_URL_PATH","File URL path %s");Oi("ERR_INVALID_OPT_VALUE",(t,e)=>`The value "${String(e)}" is invalid for option "${t}"`);Oi("ERR_INVALID_OPT_VALUE_ENCODING",t=>`The value "${String(t)}" is invalid for option "encoding"`);Oi("ERR_INVALID_ARG_VALUE","Unable to open file as blob")});var Bc=T(En=>{"use strict";Object.defineProperty(En,"__esModule",{value:!0});En.ENCODING_UTF8=void 0;En.assertEncoding=Rz;En.strToEncoding=Oz;var qg=Ri(),kz=$c();En.ENCODING_UTF8="utf8";function Rz(t){if(t&&!qg.Buffer.isEncoding(t))throw new kz.TypeError("ERR_INVALID_OPT_VALUE_ENCODING",t)}l(Rz,"assertEncoding");function Oz(t,e){return!e||e===En.ENCODING_UTF8?t:e==="buffer"?new qg.Buffer(t):new qg.Buffer(t).toString(e)}l(Oz,"strToEncoding")});var Mh=T(Mc=>{"use strict";Object.defineProperty(Mc,"__esModule",{value:!0});Mc.Dirent=void 0;var xz=nr(),Az=Bc(),{S_IFMT:Pz,S_IFDIR:Nz,S_IFREG:Cz,S_IFBLK:Dz,S_IFCHR:Iz,S_IFLNK:$z,S_IFIFO:Bz,S_IFSOCK:Mz}=xz.constants,Bh=class Bh{constructor(){this.name="",this.path="",this.parentPath="",this.mode=0}static build(e,r){let i=new Bh,{mode:n}=e.getNode();return i.name=(0,Az.strToEncoding)(e.getName(),r),i.mode=n,i.path=e.getParentPath(),i.parentPath=i.path,i}_checkModeProperty(e){return(this.mode&Pz)===e}isDirectory(){return this._checkModeProperty(Nz)}isFile(){return this._checkModeProperty(Cz)}isBlockDevice(){return this._checkModeProperty(Dz)}isCharacterDevice(){return this._checkModeProperty(Iz)}isSymbolicLink(){return this._checkModeProperty($z)}isFIFO(){return this._checkModeProperty(Bz)}isSocket(){return this._checkModeProperty(Mz)}};l(Bh,"Dirent");var $h=Bh;Mc.Dirent=$h;Mc.default=$h});var qo=T(Ae=>{"use strict";Object.defineProperty(Ae,"__esModule",{value:!0});Ae.basename=Ae.isAbsolute=Ae.normalize=Ae.dirname=Ae.relative=Ae.join=Ae.posix=Ae.sep=Ae.resolve=void 0;var zr=ne("node:path");Object.defineProperty(Ae,"resolve",{enumerable:!0,get:l(function(){return zr.resolve},"get")});Object.defineProperty(Ae,"sep",{enumerable:!0,get:l(function(){return zr.sep},"get")});Object.defineProperty(Ae,"posix",{enumerable:!0,get:l(function(){return zr.posix},"get")});Object.defineProperty(Ae,"join",{enumerable:!0,get:l(function(){return zr.join},"get")});Object.defineProperty(Ae,"relative",{enumerable:!0,get:l(function(){return zr.relative},"get")});Object.defineProperty(Ae,"dirname",{enumerable:!0,get:l(function(){return zr.dirname},"get")});Object.defineProperty(Ae,"normalize",{enumerable:!0,get:l(function(){return zr.normalize},"get")});Object.defineProperty(Ae,"isAbsolute",{enumerable:!0,get:l(function(){return zr.isAbsolute},"get")});Object.defineProperty(Ae,"basename",{enumerable:!0,get:l(function(){return zr.basename},"get")})});var iP=T(rP=>{"use strict";Object.defineProperty(rP,"__esModule",{value:!0})});var Wg=T(Lh=>{"use strict";Object.defineProperty(Lh,"__esModule",{value:!0});Lh.flattenJSON=void 0;var nP=Ri(),Ug=qo(),Lz=Ug.posix?Ug.posix.join:Ug.join,jz=l(t=>{let e={};function r(i,n){for(let s in n){let o=n[s],f=Lz(i,s);typeof o=="string"||o instanceof nP.Buffer?e[f]=o:typeof o=="object"&&o!==null&&!(o instanceof nP.Buffer)&&Object.keys(o).length>0?r(f,o):e[f]=null}}return l(r,"flatten"),r("",t),e},"flattenJSON");Lh.flattenJSON=jz});var qh=T(jh=>{"use strict";Object.defineProperty(jh,"__esModule",{value:!0});jh.createProcess=sP;var qz=l(()=>{if(typeof process<"u")return process;try{return ne("process")}catch{return}},"maybeReturnProcess");function sP(){let t=qz()||{};return t.cwd||(t.cwd=()=>"/"),t.emitWarning||(t.emitWarning=(e,r)=>{console.warn(`${r}${r?": ":""}${e}`)}),t.env||(t.env={}),t}l(sP,"createProcess");jh.default=sP()});var Vg=T(zh=>{"use strict";Object.defineProperty(zh,"__esModule",{value:!0});zh.Node=void 0;var Uz=ma(),cP=qh(),Vr=Ri(),Wz=nr(),{S_IFMT:Hr,S_IFDIR:zz,S_IFREG:Hz,S_IFLNK:oP,S_IFCHR:Vz}=Wz.constants,Uh=l(()=>cP.default.getuid?.()??0,"getuid"),Wh=l(()=>cP.default.getgid?.()??0,"getgid"),aP=(0,Vr.bufferAllocUnsafe)(0),Hg=class Hg{constructor(e,r=438){this.changes=new Uz.FanOut,this._uid=Uh(),this._gid=Wh(),this._atime=new Date,this._mtime=new Date,this._ctime=new Date,this.buf=aP,this.capacity=0,this.size=0,this.rdev=0,this._nlink=1,this.mode=r,this.ino=e}set ctime(e){this._ctime=e}get ctime(){return this._ctime}set uid(e){this._uid=e,this.ctime=new Date}get uid(){return this._uid}set gid(e){this._gid=e,this.ctime=new Date}get gid(){return this._gid}set atime(e){this._atime=e}get atime(){return this._atime}set mtime(e){this._mtime=e,this.ctime=new Date}get mtime(){return this._mtime}get perm(){return this.mode&~Hr}set perm(e){this.mode=this.mode&Hr|e&~Hr,this.ctime=new Date}set nlink(e){this._nlink=e,this.ctime=new Date}get nlink(){return this._nlink}getString(e="utf8"){return this.atime=new Date,this.getBuffer().toString(e)}setString(e){this._setBuf((0,Vr.bufferFrom)(e,"utf8"))}getBuffer(){return this.atime=new Date,this.buf||(this.buf=(0,Vr.bufferAllocUnsafe)(0)),(0,Vr.bufferFrom)(this.buf.subarray(0,this.size))}setBuffer(e){let r=(0,Vr.bufferFrom)(e);this._setBuf(r)}_setBuf(e){let r=e.length;this.buf=e,this.capacity=r,this.size=r,this.touch()}getSize(){return this.size}setModeProperty(e){this.mode=e}isFile(){return(this.mode&Hr)===Hz}isDirectory(){return(this.mode&Hr)===zz}isSymlink(){return(this.mode&Hr)===oP}isCharacterDevice(){return(this.mode&Hr)===Vz}makeSymlink(e){this.mode=oP|438,this.symlink=e}write(e,r=0,i=e.length,n=0){let s=e.length;if(r+i>s&&(i=s-r),i<=0)return 0;let o=n+i;if(o>this.capacity){let f=Math.max(this.capacity*2,64);for(;f<o;)f*=2;let c=(0,Vr.bufferAllocUnsafe)(f);this.size>0&&this.buf.copy(c,0,0,this.size),this.buf=c,this.capacity=f}return n>this.size&&this.buf.fill(0,this.size,n),e.copy(this.buf,n,r,r+i),o>this.size&&(this.size=o),this.touch(),i}read(e,r=0,i=e.byteLength,n=0){if(this.atime=new Date,n>=this.size)return 0;let s=i;if(s>e.byteLength&&(s=e.byteLength),s+n>this.size&&(s=this.size-n),s<=0)return 0;let o=e instanceof Vr.Buffer?e:Vr.Buffer.from(e.buffer,e.byteOffset,e.byteLength);return this.buf.copy(o,r,n,n+s),s}truncate(e=0){if(!e){this.buf=aP,this.capacity=0,this.size=0,this.touch();return}if(e<=this.size)this.size=e;else{if(e>this.capacity){let r=Math.max(this.capacity*2,64);for(;r<e;)r*=2;let i=(0,Vr.bufferAllocUnsafe)(r);this.size>0&&this.buf.copy(i,0,0,this.size),i.fill(0,this.size,e),this.buf=i,this.capacity=r}else this.buf.fill(0,this.size,e);this.size=e}this.touch()}chmod(e){this.mode=this.mode&Hr|e&~Hr,this.touch()}chown(e,r){this.uid=e,this.gid=r,this.touch()}touch(){this.mtime=new Date,this.changes.emit(["modify"])}canRead(e=Uh(),r=Wh()){return!!(this.perm&4||r===this.gid&&this.perm&32||e===this.uid&&this.perm&256)}canWrite(e=Uh(),r=Wh()){return!!(this.perm&2||r===this.gid&&this.perm&16||e===this.uid&&this.perm&128)}canExecute(e=Uh(),r=Wh()){return!!(this.perm&1||r===this.gid&&this.perm&8||e===this.uid&&this.perm&64)}del(){this.changes.emit(["delete"])}toJSON(){return{ino:this.ino,uid:this.uid,gid:this.gid,atime:this.atime.getTime(),mtime:this.mtime.getTime(),ctime:this.ctime.getTime(),perm:this.perm,mode:this.mode,nlink:this.nlink,symlink:this.symlink,data:this.getString()}}};l(Hg,"Node");var zg=Hg;zh.Node=zg});var Kg=T(Hh=>{"use strict";Object.defineProperty(Hh,"__esModule",{value:!0});Hh.Link=void 0;var Gz=nr(),Kz=ma(),{S_IFREG:Jz}=Gz.constants,Lc=class Lc{get steps(){return this._steps}set steps(e){this._steps=e;for(let[r,i]of this.children.entries())r==="."||r===".."||i?.syncSteps()}constructor(e,r,i){this.changes=new Kz.FanOut,this.children=new Map,this._steps=[],this.ino=0,this.length=0,this.vol=e,this.parent=r,this.name=i,this.syncSteps()}setNode(e){this.node=e,this.ino=e.ino}getNode(){return this.node}createChild(e,r=this.vol.createNode(Jz|438)){let i=new Lc(this.vol,this,e);return i.setNode(r),r.isDirectory()&&(i.children.set(".",i),i.getNode().nlink++),this.setChild(e,i),i}setChild(e,r=new Lc(this.vol,this,e)){return this.children.set(e,r),r.parent=this,this.length++,r.getNode().isDirectory()&&(r.children.set("..",this),this.getNode().nlink++),this.getNode().mtime=new Date,this.changes.emit(["child:add",r,this]),r}deleteChild(e){e.getNode().isDirectory()&&(e.children.delete(".."),this.getNode().nlink--),this.children.delete(e.getName()),this.length--,this.getNode().mtime=new Date,this.changes.emit(["child:del",e,this])}getChild(e){return this.getNode().atime=new Date,this.children.get(e)}getPath(){return this.steps.join("/")}getParentPath(){return this.steps.slice(0,-1).join("/")}getName(){return this.steps[this.steps.length-1]}toJSON(){return{steps:this.steps,ino:this.ino,children:Array.from(this.children.keys())}}syncSteps(){this.steps=this.parent?this.parent.steps.concat([this.name]):[this.name]}};l(Lc,"Link");var Gg=Lc;Hh.Link=Gg});var Yg=T(Vh=>{"use strict";Object.defineProperty(Vh,"__esModule",{value:!0});Vh.File=void 0;var Xz=nr(),{O_APPEND:Yz}=Xz.constants,Xg=class Xg{constructor(e,r,i,n){this.link=e,this.node=r,this.flags=i,this.fd=n,this.position=0,this.flags&Yz&&(this.position=this.getSize())}getString(e="utf8"){return this.node.getString()}setString(e){this.node.setString(e)}getBuffer(){return this.node.getBuffer()}setBuffer(e){this.node.setBuffer(e)}getSize(){return this.node.getSize()}truncate(e){this.node.truncate(e)}seekTo(e){this.position=e}write(e,r=0,i=e.length,n){typeof n!="number"&&(n=this.position);let s=this.node.write(e,r,i,n);return this.position=n+s,s}read(e,r=0,i=e.byteLength,n){typeof n!="number"&&(n=this.position);let s=this.node.read(e,r,i,n);return this.position=n+s,s}chmod(e){this.node.chmod(e)}chown(e,r){this.node.chown(e,r)}};l(Xg,"File");var Jg=Xg;Vh.File=Jg});var zo=T(Wo=>{"use strict";Object.defineProperty(Wo,"__esModule",{value:!0});Wo.FLAGS=Wo.ERRSTR=void 0;var Zz=nr();Wo.ERRSTR={PATH_STR:"path must be a string, Buffer, or Uint8Array",FD:"fd must be a file descriptor",MODE_INT:"mode must be an int",CB:"callback must be a function",UID:"uid must be an unsigned int",GID:"gid must be an unsigned int",LEN:"len must be an integer",ATIME:"atime must be an integer",MTIME:"mtime must be an integer",PREFIX:"filename prefix is required",BUFFER:"buffer must be an instance of Buffer or StaticBuffer",OFFSET:"offset must be an integer",LENGTH:"length must be an integer",POSITION:"position must be an integer"};var{O_RDONLY:lP,O_WRONLY:Gh,O_RDWR:Uo,O_CREAT:xi,O_EXCL:Kh,O_TRUNC:Jh,O_APPEND:Xh,O_SYNC:fP}=Zz.constants,uP;(function(t){t[t.r=lP]="r",t[t["r+"]=Uo]="r+",t[t.rs=lP|fP]="rs",t[t.sr=t.rs]="sr",t[t["rs+"]=Uo|fP]="rs+",t[t["sr+"]=t["rs+"]]="sr+",t[t.w=Gh|xi|Jh]="w",t[t.wx=Gh|xi|Jh|Kh]="wx",t[t.xw=t.wx]="xw",t[t["w+"]=Uo|xi|Jh]="w+",t[t["wx+"]=Uo|xi|Jh|Kh]="wx+",t[t["xw+"]=t["wx+"]]="xw+",t[t.a=Gh|Xh|xi]="a",t[t.ax=Gh|Xh|xi|Kh]="ax",t[t.xa=t.ax]="xa",t[t["a+"]=Uo|Xh|xi]="a+",t[t["ax+"]=Uo|Xh|xi|Kh]="ax+",t[t["xa+"]=t["ax+"]]="xa+"})(uP||(Wo.FLAGS=uP={}))});var Qg=T(Zg=>{"use strict";Object.defineProperty(Zg,"__esModule",{value:!0});Zg.default=typeof queueMicrotask=="function"?queueMicrotask:t=>Promise.resolve().then(()=>t()).catch(()=>{})});var ed=T(We=>{"use strict";Object.defineProperty(We,"__esModule",{value:!0});We.filenameToSteps=We.resolve=We.unixify=We.isWin=void 0;We.isFd=dP;We.validateFd=c3;We.dataToBuffer=l3;var Zh=qo(),Yh=Ri(),hP=qh(),Qz=Bc(),e3=zo();We.isWin=hP.default.platform==="win32";var t3=Zh.resolve,r3=Zh.posix?Zh.posix.sep:Zh.sep,i3=l((t,e)=>{let r=t[e];return e>0&&(r==="/"||We.isWin&&r==="\\")},"isSeparator"),n3=l(t=>{let e=t.length-1;if(e<2)return t;for(;i3(t,e);)e--;return t.substr(0,e+1)},"removeTrailingSeparator"),s3=l((t,e)=>{if(typeof t!="string")throw new TypeError("expected a string");return t=t.replace(/[\\\/]+/g,"/"),e!==!1&&(t=n3(t)),t},"normalizePath"),o3=l((t,e=!0)=>We.isWin?(t=s3(t,e),t.replace(/^([a-zA-Z]+:|\.\/)/,"")):t,"unixify");We.unixify=o3;var Qh=l((t,e=hP.default.cwd())=>t3(e,t),"resolve");We.resolve=Qh;if(We.isWin){let t=Qh;We.resolve=Qh=l((e,r)=>(0,We.unixify)(t(e,r)),"resolve")}var a3=l((t,e)=>{let i=Qh(t,e).substring(1);return i?i.split(r3):[]},"filenameToSteps");We.filenameToSteps=a3;function dP(t){return t>>>0===t}l(dP,"isFd");function c3(t){if(!dP(t))throw TypeError(e3.ERRSTR.FD)}l(c3,"validateFd");function l3(t,e=Qz.ENCODING_UTF8){return Yh.Buffer.isBuffer(t)?t:t instanceof Uint8Array?(0,Yh.bufferFrom)(t):e==="buffer"?(0,Yh.bufferFrom)(String(t),"utf8"):(0,Yh.bufferFrom)(String(t),e)}l(l3,"dataToBuffer")});var Ai=T(Be=>{"use strict";Object.defineProperty(Be,"__esModule",{value:!0});Be.getWriteSyncArgs=Be.getWriteArgs=Be.bufToUint8=void 0;Be.promisify=u3;Be.validateCallback=pP;Be.modeToNumber=mP;Be.nullCheck=wP;Be.pathToFilename=p3;Be.createError=A3;Be.genRndStr6=P3;Be.flagsToNumber=N3;Be.streamToBuffer=C3;Be.bufferToEncoding=B3;Be.isReadableStream=M3;var jc=zo(),eb=$c(),tb=Ri(),f3=Qg(),td=ed();function u3(t,e,r=i=>i){return(...i)=>new Promise((n,s)=>{t[e].bind(t)(...i,(o,f)=>o?s(o):n(r(f)))})}l(u3,"promisify");function pP(t){if(typeof t!="function")throw TypeError(jc.ERRSTR.CB);return t}l(pP,"validateCallback");function h3(t,e){if(typeof t=="number")return t;if(typeof t=="string")return parseInt(t,8);if(e)return mP(e)}l(h3,"_modeToNumber");function mP(t,e){let r=h3(t,e);if(typeof r!="number"||isNaN(r))throw new TypeError(jc.ERRSTR.MODE_INT);return r}l(mP,"modeToNumber");function wP(t,e){if((""+t).indexOf("\0")!==-1){let r=new Error("Path must be a string without null bytes");if(r.code="ENOENT",typeof e!="function")throw r;return(0,f3.default)(()=>{e(r)}),!1}return!0}l(wP,"nullCheck");function d3(t){if(t.hostname!=="")throw new eb.TypeError("ERR_INVALID_FILE_URL_HOST",process.platform);let e=t.pathname;for(let r=0;r<e.length;r++)if(e[r]==="%"){let i=e.codePointAt(r+2)|32;if(e[r+1]==="2"&&i===102)throw new eb.TypeError("ERR_INVALID_FILE_URL_PATH","must not include encoded / characters")}return decodeURIComponent(e)}l(d3,"getPathFromURLPosix");function p3(t){if(t instanceof Uint8Array&&(t=(0,tb.bufferFrom)(t)),typeof t!="string"&&!tb.Buffer.isBuffer(t)){try{if(!(t instanceof ne("url").URL))throw new TypeError(jc.ERRSTR.PATH_STR)}catch{throw new TypeError(jc.ERRSTR.PATH_STR)}t=d3(t)}let e=String(t);return wP(e),e}l(p3,"pathToFilename");var m3="ENOENT",w3="EBADF",y3="EINVAL",g3="EPERM",b3="EPROTO",_3="EEXIST",S3="ENOTDIR",v3="EMFILE",E3="EACCES",F3="EISDIR",T3="ENOTEMPTY",k3="ENOSYS",R3="ERR_FS_EISDIR",O3="ERR_OUT_OF_RANGE";function x3(t,e="",r="",i=""){let n="";switch(r&&(n=` '${r}'`),i&&(n+=` -> '${i}'`),t){case m3:return`ENOENT: no such file or directory, ${e}${n}`;case w3:return`EBADF: bad file descriptor, ${e}${n}`;case y3:return`EINVAL: invalid argument, ${e}${n}`;case g3:return`EPERM: operation not permitted, ${e}${n}`;case b3:return`EPROTO: protocol error, ${e}${n}`;case _3:return`EEXIST: file already exists, ${e}${n}`;case S3:return`ENOTDIR: not a directory, ${e}${n}`;case F3:return`EISDIR: illegal operation on a directory, ${e}${n}`;case E3:return`EACCES: permission denied, ${e}${n}`;case T3:return`ENOTEMPTY: directory not empty, ${e}${n}`;case v3:return`EMFILE: too many open files, ${e}${n}`;case k3:return`ENOSYS: function not implemented, ${e}${n}`;case R3:return`[ERR_FS_EISDIR]: Path is a directory: ${e} returned EISDIR (is a directory) ${r}`;case O3:return`[ERR_OUT_OF_RANGE]: value out of range, ${e}${n}`;default:return`${t}: error occurred, ${e}${n}`}}l(x3,"formatError");function A3(t,e="",r="",i="",n=Error){let s=new n(x3(t,e,r,i));return s.code=t,r&&(s.path=r),s}l(A3,"createError");function P3(){return Math.random().toString(36).slice(2,8).padEnd(6,"0")}l(P3,"genRndStr6");function N3(t){if(typeof t=="number")return t;if(typeof t=="string"){let e=jc.FLAGS[t];if(typeof e<"u")return e}throw new eb.TypeError("ERR_INVALID_OPT_VALUE","flags",t)}l(N3,"flagsToNumber");function C3(t){let e=[];return new Promise((r,i)=>{t.on("data",n=>e.push(n)),t.on("end",()=>r(tb.Buffer.concat(e))),t.on("error",i)})}l(C3,"streamToBuffer");var D3=l(t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),"bufToUint8");Be.bufToUint8=D3;var I3=l((t,e,r,i,n,s)=>{(0,td.validateFd)(t);let o=0,f,c=null,a,u,h=typeof e,d=typeof r,p=typeof i,m=typeof n;h!=="string"?d==="function"?u=r:p==="function"?(o=r|0,u=i):m==="function"?(o=r|0,f=i,u=n):(o=r|0,f=i,c=n,u=s):d==="function"?u=r:p==="function"?(c=r,u=i):m==="function"&&(c=r,a=i,u=n);let w=(0,td.dataToBuffer)(e,a);h!=="string"?typeof f>"u"&&(f=w.length):(o=0,f=w.length);let y=pP(u);return[t,h==="string",w,o,f,c,y]},"getWriteArgs");Be.getWriteArgs=I3;var $3=l((t,e,r,i,n)=>{(0,td.validateFd)(t);let s,o,f,c,a=typeof e!="string";a?(o=(r||0)|0,f=i,c=n):(c=r,s=i);let u=(0,td.dataToBuffer)(e,s);return a?typeof f>"u"&&(f=u.length):(o=0,f=u.length),[t,u,o||0,f,c]},"getWriteSyncArgs");Be.getWriteSyncArgs=$3;function B3(t,e){return!e||e==="buffer"?t:t.toString(e)}l(B3,"bufferToEncoding");function M3(t){return t!==null&&typeof t=="object"&&typeof t.pipe=="function"&&typeof t.on=="function"&&t.readable===!0}l(M3,"isReadableStream")});var vP=T(nd=>{"use strict";Object.defineProperty(nd,"__esModule",{value:!0});nd.Superblock=void 0;var ze=qo(),L3=Vg(),yP=Kg(),j3=Yg(),q3=Ri(),gP=qh(),Er=nr(),bP=zo(),J=Ai(),sr=ed(),U3=Wg(),Ho=ze.posix?ze.posix.sep:ze.sep,_P=ze.posix?ze.posix.relative:ze.relative,W3=ze.posix?ze.posix.join:ze.join,{O_RDONLY:rb,O_WRONLY:rd,O_RDWR:ib,O_CREAT:SP,O_EXCL:z3,O_TRUNC:H3,O_APPEND:V3,O_DIRECTORY:G3}=Er.constants,Vo=class Vo{static fromJSON(e,r){let i=new Vo;return i.fromJSON(e,r),i}static fromNestedJSON(e,r){let i=new Vo;return i.fromNestedJSON(e,r),i}constructor(e={}){this.ino=0,this.inodes={},this.releasedInos=[],this.fds={},this.releasedFds=[],this.maxFiles=1e4,this.openFiles=0,this.open=(i,n,s,o=!0)=>{let f=this.openFile(i,n,s,o);if(!f)throw(0,J.createError)("ENOENT","open",i);return f.fd},this.writeFile=(i,n,s,o)=>{let f=typeof i=="number",c;f?c=i:c=this.open((0,J.pathToFilename)(i),s,o);let a=0,u=n.length,h=s&V3?void 0:0;try{for(;u>0;){let d=this.write(c,n,a,u,h);a+=d,u-=d,h!==void 0&&(h+=d)}}finally{f||this.close(c)}},this.read=(i,n,s,o,f)=>{if(n.byteLength<o)throw(0,J.createError)("ERR_OUT_OF_RANGE","read",void 0,void 0,RangeError);let c=this.getFileByFdOrThrow(i);if(c.node.isSymlink())throw(0,J.createError)("EPERM","read",c.link.getPath());return c.read(n,Number(s),Number(o),f===-1||typeof f!="number"?void 0:f)},this.readv=(i,n,s)=>{let o=this.getFileByFdOrThrow(i),f=s??void 0;f===-1&&(f=void 0);let c=0;for(let a of n){let u=o.read(a,0,a.byteLength,f);if(f=void 0,c+=u,u<a.byteLength)break}return c},this.link=(i,n)=>{let s;try{s=this.getLinkOrThrow(i,"link")}catch(u){throw u.code&&(u=(0,J.createError)(u.code,"link",i,n)),u}let o=(0,ze.dirname)(n),f;try{f=this.getLinkOrThrow(o,"link")}catch(u){throw u.code&&(u=(0,J.createError)(u.code,"link",i,n)),u}let c=(0,ze.basename)(n);if(f.getChild(c))throw(0,J.createError)("EEXIST","link",i,n);let a=s.getNode();a.nlink++,f.createChild(c,a)},this.unlink=i=>{let n=this.getLinkOrThrow(i,"unlink");if(n.length)throw Error("Dir not empty...");this.deleteLink(n);let s=n.getNode();s.nlink--,s.nlink<=0&&this.deleteNode(s)},this.symlink=(i,n)=>{let s=(0,sr.filenameToSteps)(n),o;try{o=this.getLinkParentAsDirOrThrow(s)}catch(u){throw u.code&&(u=(0,J.createError)(u.code,"symlink",i,n)),u}let f=s[s.length-1];if(o.getChild(f))throw(0,J.createError)("EEXIST","symlink",i,n);let c=o.getNode();if(!c.canExecute()||!c.canWrite())throw(0,J.createError)("EACCES","symlink",i,n);let a=o.createChild(f);return a.getNode().makeSymlink(i),a},this.rename=(i,n)=>{let s;try{s=this.getResolvedLinkOrThrow(i)}catch(h){throw h.code&&(h=(0,J.createError)(h.code,"rename",i,n)),h}let o;try{o=this.getLinkParentAsDirOrThrow(n)}catch(h){throw h.code&&(h=(0,J.createError)(h.code,"rename",i,n)),h}let f=s.parent;if(!f)throw(0,J.createError)("EINVAL","rename",i,n);let c=f.getNode(),a=o.getNode();if(!c.canExecute()||!c.canWrite()||!a.canExecute()||!a.canWrite())throw(0,J.createError)("EACCES","rename",i,n);f.deleteChild(s);let u=(0,ze.basename)(n);s.name=u,s.steps=[...o.steps,u],o.setChild(s.getName(),s)},this.mkdir=(i,n)=>{let s=(0,sr.filenameToSteps)(i);if(!s.length)throw(0,J.createError)("EEXIST","mkdir",i);let o=this.getLinkParentAsDirOrThrow(i,"mkdir"),f=s[s.length-1];if(o.getChild(f))throw(0,J.createError)("EEXIST","mkdir",i);let c=o.getNode();if(!c.canWrite()||!c.canExecute())throw(0,J.createError)("EACCES","mkdir",i);o.createChild(f,this.createNode(Er.constants.S_IFDIR|n))},this.mkdirp=(i,n)=>{let s=!1,o=(0,sr.filenameToSteps)(i),f=null,c=o.length;for(c=o.length;c>=0&&(f=this.getResolvedLink(o.slice(0,c)),!f);c--);for(f||(f=this.root,c=0),f=this.getResolvedLinkOrThrow(ze.sep+o.slice(0,c).join(ze.sep),"mkdir"),c;c<o.length;c++){let a=f.getNode();if(a.isDirectory()){if(!a.canExecute()||!a.canWrite())throw(0,J.createError)("EACCES","mkdir",i)}else throw(0,J.createError)("ENOTDIR","mkdir",i);s=!0,f=f.createChild(o[c],this.createNode(Er.constants.S_IFDIR|n))}return s?i:void 0},this.rmdir=(i,n=!1)=>{let s=this.getLinkAsDirOrThrow(i,"rmdir");if(s.length&&!n)throw(0,J.createError)("ENOTEMPTY","rmdir",i);this.deleteLink(s)},this.rm=(i,n=!1,s=!1)=>{let o;try{o=this.getResolvedLinkOrThrow(i,"stat")}catch(f){if(f.code==="ENOENT"&&n)return;throw f}if(o.getNode().isDirectory()&&!s)throw(0,J.createError)("ERR_FS_EISDIR","rm",i);if(!o.parent?.getNode().canWrite())throw(0,J.createError)("EACCES","rm",i);this.deleteLink(o)},this.close=i=>{(0,sr.validateFd)(i);let n=this.getFileByFdOrThrow(i,"close");this.closeFile(n)};let r=this.createLink();r.setNode(this.createNode(Er.constants.S_IFDIR|511)),r.setChild(".",r),r.getNode().nlink++,r.setChild("..",r),r.getNode().nlink++,this.root=r}createLink(e,r,i=!1,n){if(!e)return new yP.Link(this,void 0,"");if(!r)throw new Error("createLink: name cannot be empty");let s=n??(i?511:438),f=n&&n&Er.constants.S_IFMT?n&Er.constants.S_IFMT:i?Er.constants.S_IFDIR:Er.constants.S_IFREG,c=s&~Er.constants.S_IFMT|f;return e.createChild(r,this.createNode(c))}deleteLink(e){let r=e.parent;return r?(r.deleteChild(e),!0):!1}newInoNumber(){let e=this.releasedInos.pop();return e||(this.ino=(this.ino+1)%4294967295,this.ino)}newFdNumber(){let e=this.releasedFds.pop();return typeof e=="number"?e:Vo.fd--}createNode(e){let r=new L3.Node(this.newInoNumber(),e);return this.inodes[r.ino]=r,r}deleteNode(e){e.del(),delete this.inodes[e.ino],this.releasedInos.push(e.ino)}walk(e,r=!1,i=!1,n=!1,s){let o,f;e instanceof yP.Link?(o=e.steps,f=Ho+o.join(Ho)):typeof e=="string"?(o=(0,sr.filenameToSteps)(e),f=e):(o=e,f=Ho+o.join(Ho));let c=this.root,a=0;for(;a<o.length;){let u=c.getNode();if(u.isDirectory()){if(n&&!u.canExecute())throw(0,J.createError)("EACCES",s,f)}else if(a<o.length-1)throw(0,J.createError)("ENOTDIR",s,f);if(c=c.getChild(o[a])??null,!c){if(i)throw(0,J.createError)("ENOENT",s,f);return null}if(u=c?.getNode(),u.isSymlink()&&(r||a<o.length-1)){let h=(0,ze.isAbsolute)(u.symlink)?u.symlink:W3((0,ze.dirname)(c.getPath()),u.symlink);o=(0,sr.filenameToSteps)(h).concat(o.slice(a+1)),c=this.root,a=0;continue}if(i&&!u.isDirectory()&&a<o.length-1){let h=gP.default.platform==="win32"?"ENOENT":"ENOTDIR";throw(0,J.createError)(h,s,f)}a++}return c}getLink(e){return this.walk(e,!1,!1,!1)}getLinkOrThrow(e,r){return this.walk(e,!1,!0,!0,r)}getResolvedLink(e){return this.walk(e,!0,!1,!1)}getResolvedLinkOrThrow(e,r){return this.walk(e,!0,!0,!0,r)}resolveSymlinks(e){return this.getResolvedLink(e.steps.slice(1))}getLinkAsDirOrThrow(e,r){let i=this.getLinkOrThrow(e,r);if(!i.getNode().isDirectory())throw(0,J.createError)("ENOTDIR",r,e);return i}getLinkParent(e){return this.getLink(e.slice(0,-1))}getLinkParentAsDirOrThrow(e,r){let i=(e instanceof Array?e:(0,sr.filenameToSteps)(e)).slice(0,-1),n=Ho+i.join(Ho),s=this.getLinkOrThrow(n,r);if(!s.getNode().isDirectory())throw(0,J.createError)("ENOTDIR",r,n);return s}getFileByFd(e){return this.fds[String(e)]}getFileByFdOrThrow(e,r){if(!(0,sr.isFd)(e))throw TypeError(bP.ERRSTR.FD);let i=this.getFileByFd(e);if(!i)throw(0,J.createError)("EBADF",r);return i}_toJSON(e=this.root,r={},i,n){let s=!0,o=e.children;e.getNode().isFile()&&(o=new Map([[e.getName(),e.parent.getChild(e.getName())]]),e=e.parent);for(let c of o.keys()){if(c==="."||c==="..")continue;s=!1;let a=e.getChild(c);if(!a)throw new Error("_toJSON: unexpected undefined");let u=a.getNode();if(u.isFile()){let h=a.getPath();i&&(h=_P(i,h)),r[h]=n?u.getBuffer():u.getString()}else u.isDirectory()&&this._toJSON(a,r,i,n)}let f=e.getPath();return i&&(f=_P(i,f)),f&&s&&(r[f]=null),r}toJSON(e,r={},i=!1,n=!1){let s=[];if(e){Array.isArray(e)||(e=[e]);for(let o of e){let f=(0,J.pathToFilename)(o),c=this.getResolvedLink(f);c&&s.push(c)}}else s.push(this.root);if(!s.length)return r;for(let o of s)this._toJSON(o,r,i?o.getPath():"",n);return r}fromJSON(e,r=gP.default.cwd()){for(let i in e){let n=e[i];if(i=(0,sr.resolve)(i,r),typeof n=="string"||n instanceof q3.Buffer){let s=(0,ze.dirname)(i);this.mkdirp(s,511);let o=(0,sr.dataToBuffer)(n);this.writeFile(i,o,bP.FLAGS.w,438)}else this.mkdirp(i,511)}}fromNestedJSON(e,r){this.fromJSON((0,U3.flattenJSON)(e),r)}reset(){this.ino=0,this.inodes={},this.releasedInos=[],this.fds={},this.releasedFds=[],this.openFiles=0,this.root=this.createLink(),this.root.setNode(this.createNode(Er.constants.S_IFDIR|511))}mountSync(e,r){this.fromJSON(r,e)}openLink(e,r,i=!0){if(this.openFiles>=this.maxFiles)throw(0,J.createError)("EMFILE","open",e.getPath());let n=e;i&&(n=this.getResolvedLinkOrThrow(e.getPath(),"open"));let s=n.getNode();if(s.isDirectory()){if((r&(rb|ib|rd))!==rb)throw(0,J.createError)("EISDIR","open",e.getPath())}else if(r&G3)throw(0,J.createError)("ENOTDIR","open",e.getPath());if((r&(rb|ib|rd))!==rd&&!s.canRead()||r&(rd|ib)&&!s.canWrite())throw(0,J.createError)("EACCES","open",e.getPath());let o=new j3.File(e,s,r,this.newFdNumber());return this.fds[o.fd]=o,this.openFiles++,r&H3&&o.truncate(),o}openFile(e,r,i,n=!0){let s=(0,sr.filenameToSteps)(e),o;try{if(o=n?this.getResolvedLinkOrThrow(e,"open"):this.getLinkOrThrow(e,"open"),o&&r&SP&&r&z3)throw(0,J.createError)("EEXIST","open",e)}catch(f){if(f.code==="ENOENT"&&r&SP){let c=(0,ze.dirname)(e),a=this.getResolvedLinkOrThrow(c),u=a.getNode();if(!u.isDirectory())throw(0,J.createError)("ENOTDIR","open",e);if(!u.canExecute()||!u.canWrite())throw(0,J.createError)("EACCES","open",e);i??(i=438),o=this.createLink(a,s[s.length-1],!1,i)}else throw f}if(o)return this.openLink(o,r,n);throw(0,J.createError)("ENOENT","open",e)}closeFile(e){this.fds[e.fd]&&(this.openFiles--,delete this.fds[e.fd],this.releasedFds.push(e.fd))}write(e,r,i,n,s){let o=this.getFileByFdOrThrow(e,"write");if(o.node.isSymlink())throw(0,J.createError)("EBADF","write",o.link.getPath());return o.write(r,i,n,s===-1||typeof s!="number"?void 0:s)}};l(Vo,"Superblock");var id=Vo;nd.Superblock=id;id.fd=2147483647});var FP=T(zt=>{"use strict";Object.defineProperty(zt,"__esModule",{value:!0});zt.Superblock=zt.File=zt.Link=zt.Node=void 0;var EP=(ml(),Ad(pl));EP.__exportStar(iP(),zt);EP.__exportStar(Wg(),zt);var K3=Vg();Object.defineProperty(zt,"Node",{enumerable:!0,get:l(function(){return K3.Node},"get")});var J3=Kg();Object.defineProperty(zt,"Link",{enumerable:!0,get:l(function(){return J3.Link},"get")});var X3=Yg();Object.defineProperty(zt,"File",{enumerable:!0,get:l(function(){return X3.File},"get")});var Y3=vP();Object.defineProperty(zt,"Superblock",{enumerable:!0,get:l(function(){return Y3.Superblock},"get")})});var TP=T(qc=>{"use strict";Object.defineProperty(qc,"__esModule",{value:!0});qc.StatFs=void 0;var od=class od{static build(e,r=!1){let i=new od,n=r?u=>BigInt(u):u=>u;i.type=n(2240043254),i.bsize=n(4096);let s=Object.keys(e.inodes).length,o=1e6,f=Math.min(s*2,o),c=o-f;i.blocks=n(o),i.bfree=n(c),i.bavail=n(c);let a=1e6;return i.files=n(a),i.ffree=n(a-s),i}};l(od,"StatFs");var sd=od;qc.StatFs=sd;qc.default=sd});var kP=T(nb=>{"use strict";Object.defineProperty(nb,"__esModule",{value:!0});function Z3(t,e,r){let i=setTimeout.apply(globalThis,arguments);return i&&typeof i=="object"&&typeof i.unref=="function"&&i.unref(),i}l(Z3,"setTimeoutUnref");nb.default=Z3});var OP=T(Go=>{"use strict";Object.defineProperty(Go,"__esModule",{value:!0});Go.Writable=Go.Readable=void 0;var RP=ne("node:stream");Object.defineProperty(Go,"Readable",{enumerable:!0,get:l(function(){return RP.Readable},"get")});Object.defineProperty(Go,"Writable",{enumerable:!0,get:l(function(){return RP.Writable},"get")})});var sb=T(ad=>{"use strict";Object.defineProperty(ad,"__esModule",{value:!0});ad.EventEmitter=void 0;var Q3=ne("node:events");Object.defineProperty(ad,"EventEmitter",{enumerable:!0,get:l(function(){return Q3.EventEmitter},"get")})});var xP=T(cd=>{"use strict";Object.defineProperty(cd,"__esModule",{value:!0});cd.FileHandle=void 0;var at=Ai(),eH=sb(),ab=class ab extends eH.EventEmitter{constructor(e,r){super(),this.refs=1,this.closePromise=null,this.position=0,this.readableWebStreamLocked=!1,this.fs=e,this.fd=r}getAsyncId(){return this.fd}appendFile(e,r){return(0,at.promisify)(this.fs,"appendFile")(this.fd,e,r)}chmod(e){return(0,at.promisify)(this.fs,"fchmod")(this.fd,e)}chown(e,r){return(0,at.promisify)(this.fs,"fchown")(this.fd,e,r)}close(){if(this.fd===-1)return Promise.resolve();if(this.closePromise)return this.closePromise;if(this.refs--,this.refs===0){let e=this.fd;this.fd=-1,this.closePromise=(0,at.promisify)(this.fs,"close")(e).finally(()=>{this.closePromise=null})}else this.closePromise=new Promise((e,r)=>{this.closeResolve=e,this.closeReject=r}).finally(()=>{this.closePromise=null,this.closeReject=void 0,this.closeResolve=void 0});return this.emit("close"),this.closePromise}datasync(){return(0,at.promisify)(this.fs,"fdatasync")(this.fd)}createReadStream(e){return this.fs.createReadStream("",{...e,fd:this})}createWriteStream(e){return this.fs.createWriteStream("",{...e,fd:this})}readableWebStream(e={}){let{type:r="bytes",autoClose:i=!1}=e,n=0;if(this.fd===-1)throw new Error("The FileHandle is closed");if(this.closePromise)throw new Error("The FileHandle is closing");if(this.readableWebStreamLocked)throw new Error("An error will be thrown if this method is called more than once or is called after the FileHandle is closed or closing.");this.readableWebStreamLocked=!0,this.ref();let s=l(()=>{this.readableWebStreamLocked=!1,this.unref(),i&&this.close().catch(()=>{})},"unlockAndCleanup");return new ReadableStream({type:r==="bytes"?"bytes":void 0,autoAllocateChunkSize:16384,pull:l(async o=>{try{let f=o.byobRequest?.view;if(!f){let a=new Uint8Array(16384),u=await this.read(a,0,a.length,n);if(u.bytesRead===0){o.close(),s();return}n+=u.bytesRead,o.enqueue(a.slice(0,u.bytesRead));return}let c=await this.read(f,f.byteOffset,f.byteLength,n);if(c.bytesRead===0){o.close(),s();return}n+=c.bytesRead,o.byobRequest.respond(c.bytesRead)}catch(f){o.error(f),s()}},"pull"),cancel:l(async()=>{s()},"cancel")})}async read(e,r,i,n){let s=n??this.position,o=await(0,at.promisify)(this.fs,"read",f=>({bytesRead:f,buffer:e}))(this.fd,e,r,i,s);return n==null&&(this.position+=o.bytesRead),o}readv(e,r){return(0,at.promisify)(this.fs,"readv",i=>({bytesRead:i,buffers:e}))(this.fd,e,r)}readFile(e){return(0,at.promisify)(this.fs,"readFile")(this.fd,e)}stat(e){return(0,at.promisify)(this.fs,"fstat")(this.fd,e)}sync(){return(0,at.promisify)(this.fs,"fsync")(this.fd)}truncate(e){return(0,at.promisify)(this.fs,"ftruncate")(this.fd,e)}utimes(e,r){return(0,at.promisify)(this.fs,"futimes")(this.fd,e,r)}async write(e,r,i,n){let s=typeof n!="number",o=s?this.position:n,f=await(0,at.promisify)(this.fs,"write",c=>({bytesWritten:c,buffer:e}))(this.fd,e,r,i,o);return s&&(this.position+=f.bytesWritten),f}writev(e,r){return(0,at.promisify)(this.fs,"writev",i=>({bytesWritten:i,buffers:e}))(this.fd,e,r)}writeFile(e,r){return(0,at.promisify)(this.fs,"writeFile")(this.fd,e,r)}async[Symbol.asyncDispose](){await this.close()}ref(){this.refs++}unref(){this.refs--,this.refs===0&&(this.fd=-1,this.closeResolve&&(0,at.promisify)(this.fs,"close")(this.fd).then(this.closeResolve,this.closeReject))}};l(ab,"FileHandle");var ob=ab;cd.FileHandle=ob});var AP=T(ld=>{"use strict";Object.defineProperty(ld,"__esModule",{value:!0});ld.FsPromises=void 0;var ae=Ai(),tH=nr(),fb=class fb{constructor(e,r,i={}){if(this.fs=e,this.path=r,this.options=i,this.eventQueue=[],this.resolveQueue=[],this.finished=!1,this.maxQueue=i.maxQueue||2048,this.overflow=i.overflow||"ignore",this.startWatching(),i.signal){if(i.signal.aborted){this.finish();return}i.signal.addEventListener("abort",()=>{this.finish()})}}startWatching(){try{this.watcher=this.fs.watch(this.path,this.options,(e,r)=>{this.enqueueEvent({eventType:e,filename:r})})}catch(e){throw this.finish(),e}}enqueueEvent(e){if(!this.finished){if(this.eventQueue.length>=this.maxQueue)if(this.overflow==="throw"){let r=new Error(`Watch queue overflow: more than ${this.maxQueue} events queued`);this.finish(r);return}else this.eventQueue.shift(),console.warn(`Watch queue overflow: dropping event due to exceeding maxQueue of ${this.maxQueue}`);if(this.eventQueue.push(e),this.resolveQueue.length>0){let{resolve:r}=this.resolveQueue.shift(),i=this.eventQueue.shift();r({value:i,done:!1})}}}finish(e){if(!this.finished)for(this.finished=!0,this.watcher&&(this.watcher.close(),this.watcher=null);this.resolveQueue.length>0;){let{resolve:r,reject:i}=this.resolveQueue.shift();e?i(e):r({value:void 0,done:!0})}}async next(){return this.finished?{value:void 0,done:!0}:this.eventQueue.length>0?{value:this.eventQueue.shift(),done:!1}:new Promise((e,r)=>{this.resolveQueue.push({resolve:e,reject:r})})}async return(){return this.finish(),{value:void 0,done:!0}}async throw(e){throw this.finish(e),e}[Symbol.asyncIterator](){return this}};l(fb,"FSWatchAsyncIterator");var cb=fb,ub=class ub{constructor(e,r){this.fs=e,this.FileHandle=r,this.constants=tH.constants,this.cp=(0,ae.promisify)(this.fs,"cp"),this.opendir=(0,ae.promisify)(this.fs,"opendir"),this.statfs=(0,ae.promisify)(this.fs,"statfs"),this.lutimes=(0,ae.promisify)(this.fs,"lutimes"),this.glob=(0,ae.promisify)(this.fs,"glob"),this.access=(0,ae.promisify)(this.fs,"access"),this.chmod=(0,ae.promisify)(this.fs,"chmod"),this.chown=(0,ae.promisify)(this.fs,"chown"),this.copyFile=(0,ae.promisify)(this.fs,"copyFile"),this.lchmod=(0,ae.promisify)(this.fs,"lchmod"),this.lchown=(0,ae.promisify)(this.fs,"lchown"),this.link=(0,ae.promisify)(this.fs,"link"),this.lstat=(0,ae.promisify)(this.fs,"lstat"),this.mkdir=(0,ae.promisify)(this.fs,"mkdir"),this.mkdtemp=(0,ae.promisify)(this.fs,"mkdtemp"),this.readdir=(0,ae.promisify)(this.fs,"readdir"),this.readlink=(0,ae.promisify)(this.fs,"readlink"),this.realpath=(0,ae.promisify)(this.fs,"realpath"),this.rename=(0,ae.promisify)(this.fs,"rename"),this.rmdir=(0,ae.promisify)(this.fs,"rmdir"),this.rm=(0,ae.promisify)(this.fs,"rm"),this.stat=(0,ae.promisify)(this.fs,"stat"),this.symlink=(0,ae.promisify)(this.fs,"symlink"),this.truncate=(0,ae.promisify)(this.fs,"truncate"),this.unlink=(0,ae.promisify)(this.fs,"unlink"),this.utimes=(0,ae.promisify)(this.fs,"utimes"),this.readFile=(i,n)=>(0,ae.promisify)(this.fs,"readFile")(i instanceof this.FileHandle?i.fd:i,n),this.appendFile=(i,n,s)=>(0,ae.promisify)(this.fs,"appendFile")(i instanceof this.FileHandle?i.fd:i,n,s),this.open=(i,n="r",s)=>(0,ae.promisify)(this.fs,"open",o=>new this.FileHandle(this.fs,o))(i,n,s),this.writeFile=(i,n,s)=>((0,ae.isReadableStream)(n)?(0,ae.streamToBuffer)(n):Promise.resolve(n)).then(f=>(0,ae.promisify)(this.fs,"writeFile")(i instanceof this.FileHandle?i.fd:i,f,s)),this.watch=(i,n)=>{let s=typeof n=="string"?{encoding:n}:n||{};return new cb(this.fs,i,s)}}};l(ub,"FsPromises");var lb=ub;ld.FsPromises=lb});var PP=T(ct=>{"use strict";Object.defineProperty(ct,"__esModule",{value:!0});ct.newNotAllowedError=ct.newTypeMismatchError=ct.newNotFoundError=ct.assertCanWrite=ct.assertName=ct.basename=ct.ctx=void 0;var rH=l((t={})=>({separator:"/",syncHandleAllowed:!1,mode:"read",...t}),"ctx");ct.ctx=rH;var iH=l((t,e)=>{t[t.length-1]===e&&(t=t.slice(0,-1));let r=t.lastIndexOf(e);return r===-1?t:t.slice(r+1)},"basename");ct.basename=iH;var nH=/^(\.{1,2})$|^(.*([\/\\]).*)$/,sH=l((t,e,r)=>{if(!t||nH.test(t))throw new TypeError(`Failed to execute '${e}' on '${r}': Name is not allowed.`)},"assertName");ct.assertName=sH;var oH=l(t=>{if(t!=="readwrite")throw new DOMException("The request is not allowed by the user agent or the platform in the current context.","NotAllowedError")},"assertCanWrite");ct.assertCanWrite=oH;var aH=l(()=>new DOMException("A requested file or directory could not be found at the time an operation was processed.","NotFoundError"),"newNotFoundError");ct.newNotFoundError=aH;var cH=l(()=>new DOMException("The path supplied exists, but was not an entry of requested type.","TypeMismatchError"),"newTypeMismatchError");ct.newTypeMismatchError=cH;var lH=l(()=>new DOMException("Permission not granted.","NotAllowedError"),"newNotAllowedError");ct.newNotAllowedError=lH});var NP=T(Uc=>{"use strict";Object.defineProperty(Uc,"__esModule",{value:!0});Uc.toTreeSync=void 0;var fH=Cp(),uH=PP(),hH=l((t,e={})=>{let r=e.separator||"/",i=e.dir||r;i[i.length-1]!==r&&(i+=r);let n=e.tab||"",s=e.depth??10,o=" (...)";if(s>0){let c=t.readdirSync(i,{withFileTypes:!0});o=(0,fH.printTree)(n,c.map(a=>u=>a.isDirectory()?(0,Uc.toTreeSync)(t,{dir:i+a.name,depth:s-1,tab:u}):a.isSymbolicLink()?""+a.name+" \u2192 "+t.readlinkSync(i+a.name):""+a.name))}return(0,uH.basename)(i,r)+r+o},"toTreeSync");Uc.toTreeSync=hH});var IP=T(q=>{"use strict";Object.defineProperty(q,"__esModule",{value:!0});q.getWriteFileOptions=q.writeFileDefaults=q.getRealpathOptsAndCb=q.getRealpathOptions=q.getStatfsOptsAndCb=q.getStatfsOptions=q.getStatOptsAndCb=q.getStatOptions=q.getAppendFileOptsAndCb=q.getAppendFileOpts=q.getOpendirOptsAndCb=q.getOpendirOptions=q.getReaddirOptsAndCb=q.getReaddirOptions=q.getReadFileOptions=q.getRmOptsAndCb=q.getRmdirOptions=q.getDefaultOptsAndCb=q.getDefaultOpts=q.optsDefaults=q.getMkdirOptions=void 0;q.getOptions=DP;q.optsGenerator=Gr;q.optsAndCbGenerator=Fn;var fd=zo(),dH=Bc(),hb=Ai(),CP={mode:511,recursive:!1},pH=l(t=>typeof t=="number"?Object.assign({},CP,{mode:t}):Object.assign({},CP,t),"getMkdirOptions");q.getMkdirOptions=pH;var mH=l(t=>`Expected options to be either an object or a string, but got ${t} instead`,"ERRSTR_OPTS");function DP(t,e){let r;if(e){let i=typeof e;switch(i){case"string":r=Object.assign({},t,{encoding:e});break;case"object":r=Object.assign({},t,e);break;default:throw TypeError(mH(i))}}else return t;return r.encoding!=="buffer"&&(0,dH.assertEncoding)(r.encoding),r}l(DP,"getOptions");function Gr(t){return e=>DP(t,e)}l(Gr,"optsGenerator");function Fn(t){return(e,r)=>typeof e=="function"?[t(),e]:[t(e),(0,hb.validateCallback)(r)]}l(Fn,"optsAndCbGenerator");q.optsDefaults={encoding:"utf8"};q.getDefaultOpts=Gr(q.optsDefaults);q.getDefaultOptsAndCb=Fn(q.getDefaultOpts);var wH={recursive:!1},yH=l(t=>Object.assign({},wH,t),"getRmdirOptions");q.getRmdirOptions=yH;var gH=Gr(q.optsDefaults);q.getRmOptsAndCb=Fn(gH);var bH={flag:"r"};q.getReadFileOptions=Gr(bH);var _H={encoding:"utf8",recursive:!1,withFileTypes:!1};q.getReaddirOptions=Gr(_H);q.getReaddirOptsAndCb=Fn(q.getReaddirOptions);var SH={encoding:"utf8",bufferSize:32,recursive:!1};q.getOpendirOptions=Gr(SH);q.getOpendirOptsAndCb=Fn(q.getOpendirOptions);var vH={encoding:"utf8",mode:438,flag:fd.FLAGS[fd.FLAGS.a]};q.getAppendFileOpts=Gr(vH);q.getAppendFileOptsAndCb=Fn(q.getAppendFileOpts);var EH={bigint:!1},FH=l((t={})=>Object.assign({},EH,t),"getStatOptions");q.getStatOptions=FH;var TH=l((t,e)=>typeof t=="function"?[(0,q.getStatOptions)(),t]:[(0,q.getStatOptions)(t),(0,hb.validateCallback)(e)],"getStatOptsAndCb");q.getStatOptsAndCb=TH;var kH={bigint:!1},RH=l((t={})=>Object.assign({},kH,t),"getStatfsOptions");q.getStatfsOptions=RH;var OH=l((t,e)=>typeof t=="function"?[(0,q.getStatfsOptions)(),t]:[(0,q.getStatfsOptions)(t),(0,hb.validateCallback)(e)],"getStatfsOptsAndCb");q.getStatfsOptsAndCb=OH;var xH=q.optsDefaults;q.getRealpathOptions=Gr(xH);q.getRealpathOptsAndCb=Fn(q.getRealpathOptions);q.writeFileDefaults={encoding:"utf8",mode:438,flag:fd.FLAGS[fd.FLAGS.w]};q.getWriteFileOptions=Gr(q.writeFileDefaults)});var BP=T(ud=>{"use strict";Object.defineProperty(ud,"__esModule",{value:!0});ud.Dir=void 0;var $P=Ai(),AH=Mh(),Tn=$c(),pb=class pb{constructor(e,r){this.link=e,this.options=r,this.iteratorInfo=[],this.closed=!1,this.operationQueue=null,this.path=e.getPath(),this.iteratorInfo.push(e.children[Symbol.iterator]())}closeBase(){}readBase(e){let r,i,n,s;do{do if({done:r,value:i}=e[e.length-1].next(),!r)[n,s]=i;else break;while(n==="."||n==="..");if(r){if(e.pop(),e.length===0)break;r=!1}else return this.options.recursive&&s.children.size&&e.push(s.children[Symbol.iterator]()),AH.default.build(s,this.options.encoding)}while(!r);return null}close(e){if(e===void 0)return this.closed?Promise.reject(new Tn.Error("ERR_DIR_CLOSED")):new Promise((r,i)=>{this.close(n=>{n?i(n):r()})});if((0,$P.validateCallback)(e),this.closed){process.nextTick(e,new Tn.Error("ERR_DIR_CLOSED"));return}if(this.operationQueue!==null){this.operationQueue.push(()=>{this.close(e)});return}this.closed=!0;try{this.closeBase(),process.nextTick(e)}catch(r){process.nextTick(e,r)}}closeSync(){if(this.closed)throw new Tn.Error("ERR_DIR_CLOSED");if(this.operationQueue!==null)throw new Tn.Error("ERR_DIR_CONCURRENT_OPERATION");this.closed=!0,this.closeBase()}read(e){if(e===void 0)return new Promise((r,i)=>{this.read((n,s)=>{n?i(n):r(s??null)})});if((0,$P.validateCallback)(e),this.closed){process.nextTick(e,new Tn.Error("ERR_DIR_CLOSED"));return}if(this.operationQueue!==null){this.operationQueue.push(()=>{this.read(e)});return}this.operationQueue=[];try{let r=this.readBase(this.iteratorInfo);process.nextTick(()=>{let i=this.operationQueue;this.operationQueue=null;for(let n of i)n();e(null,r)})}catch(r){process.nextTick(()=>{let i=this.operationQueue;this.operationQueue=null;for(let n of i)n();e(r)})}}readSync(){if(this.closed)throw new Tn.Error("ERR_DIR_CLOSED");if(this.operationQueue!==null)throw new Tn.Error("ERR_DIR_CONCURRENT_OPERATION");return this.readBase(this.iteratorInfo)}[Symbol.asyncIterator](){return{next:l(async()=>{try{let e=await this.read();return e!==null?{done:!1,value:e}:{done:!0,value:void 0}}catch(e){throw e}},"next"),[Symbol.asyncIterator](){return this}}}};l(pb,"Dir");var db=pb;ud.Dir=db});var jP=T(wb=>{"use strict";Object.defineProperty(wb,"__esModule",{value:!0});wb.globSync=$H;var kn=qo(),PH=Bp(),MP=Ai(),NH=kn.posix.join,CH=kn.posix.relative,DH=kn.posix.resolve;function LP(t,e){return(0,PH.toRegex)(e).test(t)}l(LP,"matchesPattern");function IH(t,e){return e?typeof e=="function"?e(t):(Array.isArray(e)?e:[e]).some(i=>LP(t,i)):!1}l(IH,"isExcluded");function mb(t,e,r,i,n=0){let s=[],o=i.maxdepth??1/0,f=i.cwd?(0,MP.pathToFilename)(i.cwd):process.cwd();if(n>o)return s;try{let c=t.readdirSync(e,{withFileTypes:!0});for(let a of c){let u=NH(e,a.name.toString()),h=CH(f,u);if(IH(h,i.exclude))continue;if(r.some(p=>LP(h,p))&&s.push(h),a.isDirectory()&&n<o){let p=mb(t,u,r,i,n+1);s.push(...p)}}}catch{}return s}l(mb,"walkDirectory");function $H(t,e,r={}){let i=r.cwd?(0,MP.pathToFilename)(r.cwd):process.cwd(),n=DH(i),s={cwd:n,exclude:r.exclude,maxdepth:r.maxdepth,withFileTypes:r.withFileTypes||!1},o=[];if(kn.posix.isAbsolute(e)){let f=kn.posix.dirname(e),c=kn.posix.basename(e),a=mb(t,f,[c],{...s,cwd:f});o.push(...a.map(u=>kn.posix.resolve(f,u)))}else{let f=mb(t,n,[e],s);o.push(...f)}return o=[...new Set(o)].sort(),o}l($H,"globSync")});var GP=T(Pt=>{"use strict";Object.defineProperty(Pt,"__esModule",{value:!0});Pt.FSWatcher=Pt.StatWatcher=Pt.Volume=void 0;Pt.pathToSteps=QH;Pt.dataToStr=e5;Pt.toUnixTimestamp=At;var Pe=qo(),_b=FP(),yb=Dg(),BH=Mh(),MH=TP(),Xo=Ri(),wd=Qg(),LH=kP(),yd=OP(),jH=nr(),zP=sb(),Rn=Bc(),qH=xP(),HP=$g(),UH=AP(),WH=NP(),dd=zo(),zH=$c(),re=IP(),C=Ai(),HH=BP(),Xe=ed(),VH=Pe.resolve,{O_SYMLINK:qP,F_OK:gb,R_OK:GH,W_OK:KH,X_OK:JH,COPYFILE_EXCL:XH,COPYFILE_FICLONE_FORCE:YH}=jH.constants,uZ=Pe.posix?Pe.posix.sep:Pe.sep,hd=Pe.posix?Pe.posix.relative:Pe.relative,bb=Pe.posix?Pe.posix.join:Pe.join,UP=Pe.posix?Pe.posix.dirname:Pe.dirname,WP=Pe.posix?Pe.posix.normalize:Pe.normalize,ZH=128;function QH(t){return(0,Xe.filenameToSteps)((0,C.pathToFilename)(t))}l(QH,"pathToSteps");function e5(t,e=Rn.ENCODING_UTF8){return Xo.Buffer.isBuffer(t)?t.toString(e):t instanceof Uint8Array?(0,Xo.bufferFrom)(t).toString(e):String(t)}l(e5,"dataToStr");function At(t){if(typeof t=="string"&&+t==t)return+t;if(t instanceof Date)return t.getTime()/1e3;if(isFinite(t))return t<0?Date.now()/1e3:t;throw new Error("Cannot parse time: "+t)}l(At,"toUnixTimestamp");function Ko(t){if(typeof t!="number")throw TypeError(dd.ERRSTR.UID)}l(Ko,"validateUid");function Jo(t){if(typeof t!="number")throw TypeError(dd.ERRSTR.GID)}l(Jo,"validateGid");var Sb=class Sb{get promises(){if(this.promisesApi===null)throw new Error("Promise is not supported in this environment.");return this.promisesApi}constructor(e=new _b.Superblock){this._core=e,this.promisesApi=new UH.FsPromises(this,qH.FileHandle),this.openSync=(c,a,u=438)=>{let h=(0,C.modeToNumber)(u),d=(0,C.pathToFilename)(c),p=(0,C.flagsToNumber)(a);return this._core.open(d,p,h,!(p&qP))},this.open=(c,a,u,h)=>{let d=u,p=h;typeof u=="function"&&(d=438,p=u),d=d||438;let m=(0,C.modeToNumber)(d),w=(0,C.pathToFilename)(c),y=(0,C.flagsToNumber)(a);this.wrapAsync(this._core.open,[w,y,m,!(y&qP)],p)},this.closeSync=c=>{this._core.close(c)},this.close=(c,a)=>{(0,Xe.validateFd)(c);let u=this._core.getFileByFdOrThrow(c,"close");this.wrapAsync(this._core.close,[u.fd],a)},this.readSync=(c,a,u,h,d)=>((0,Xe.validateFd)(c),this._core.read(c,a,u,h,d)),this.read=(c,a,u,h,d,p)=>{if((0,C.validateCallback)(p),h===0)return(0,wd.default)(()=>{p&&p(null,0,a)});Promise.resolve().then(()=>{try{let m=this._core.read(c,a,u,h,d);p(null,m,a)}catch(m){p(m)}})},this.readv=(c,a,u,h)=>{let d=u,p=h;typeof u=="function"&&([d,p]=[null,u]),(0,C.validateCallback)(p),Promise.resolve().then(()=>{try{let m=this._core.readv(c,a,d);p(null,m,a)}catch(m){p(m)}})},this.readvSync=(c,a,u)=>((0,Xe.validateFd)(c),this._core.readv(c,a,u??null)),this._readfile=(c,a,u)=>{let h,p=typeof c=="number"&&(0,Xe.isFd)(c),m;if(p)m=c;else{let w=(0,C.pathToFilename)(c),y=String(c),g=y.length>1&&y.endsWith("/"),_=this._core.getResolvedLinkOrThrow(w,"open"),F=_.getNode();if(F.isDirectory())throw(0,C.createError)("EISDIR","open",_.getPath());if(g&&F.isFile())throw(0,C.createError)("ENOTDIR","open",y);m=this.openSync(c,a)}try{h=(0,C.bufferToEncoding)(this._core.getFileByFdOrThrow(m).getBuffer(),u)}finally{p||this.closeSync(m)}return h},this.readFileSync=(c,a)=>{let u=(0,re.getReadFileOptions)(a),h=(0,C.flagsToNumber)(u.flag);return this._readfile(c,h,u.encoding)},this.readFile=(c,a,u)=>{let[h,d]=(0,re.optsAndCbGenerator)(re.getReadFileOptions)(a,u),p=(0,C.flagsToNumber)(h.flag);this.wrapAsync(this._readfile,[c,p,h.encoding],d)},this.writeSync=(c,a,u,h,d)=>{let[,p,m,w,y]=(0,C.getWriteSyncArgs)(c,a,u,h,d);return this._write(c,p,m,w,y)},this.write=(c,a,u,h,d,p)=>{let[,m,w,y,g,_,F]=(0,C.getWriteArgs)(c,a,u,h,d,p);Promise.resolve().then(()=>{try{let E=this._write(c,w,y,g,_);m?F(null,E,a):F(null,E,w)}catch(E){F(E)}})},this.writev=(c,a,u,h)=>{let d=u,p=h;typeof u=="function"&&([d,p]=[null,u]),(0,C.validateCallback)(p),Promise.resolve().then(()=>{try{let m=this.writevBase(c,a,d);p(null,m,a)}catch(m){p(m)}})},this.writevSync=(c,a,u)=>((0,Xe.validateFd)(c),this.writevBase(c,a,u??null)),this.writeFileSync=(c,a,u)=>{let h=(0,re.getWriteFileOptions)(u),d=(0,C.flagsToNumber)(h.flag),p=(0,C.modeToNumber)(h.mode),m=(0,Xe.dataToBuffer)(a,h.encoding);this._core.writeFile(c,m,d,p)},this.writeFile=(c,a,u,h)=>{let d=u,p=h;typeof u=="function"&&([d,p]=[re.writeFileDefaults,u]);let m=(0,C.validateCallback)(p),w=(0,re.getWriteFileOptions)(d),y=(0,C.flagsToNumber)(w.flag),g=(0,C.modeToNumber)(w.mode),_=(0,Xe.dataToBuffer)(a,w.encoding);this.wrapAsync(this._core.writeFile,[c,_,y,g],m)},this.copyFileSync=(c,a,u)=>{let h=(0,C.pathToFilename)(c),d=(0,C.pathToFilename)(a);return this._copyFile(h,d,(u||0)|0)},this.copyFile=(c,a,u,h)=>{let d=(0,C.pathToFilename)(c),p=(0,C.pathToFilename)(a),m,w;typeof u=="function"?[m,w]=[0,u]:[m,w]=[u,h],(0,C.validateCallback)(w),this.wrapAsync(this._copyFile,[d,p,m],w)},this._cp=(c,a,u)=>{if(u.filter&&!u.filter(c,a))return;let h=u.dereference?this.statSync(c):this.lstatSync(c),d=null;try{d=this.lstatSync(a)}catch(p){if(p.code!=="ENOENT")throw p}if(d&&h.ino===d.ino&&h.dev===d.dev)throw(0,C.createError)("EINVAL","cp",c,a);if(d){if(h.isDirectory()&&!d.isDirectory())throw(0,C.createError)("EISDIR","cp",c,a);if(!h.isDirectory()&&d.isDirectory())throw(0,C.createError)("ENOTDIR","cp",c,a)}if(h.isDirectory()&&this.isSrcSubdir(c,a))throw(0,C.createError)("EINVAL","cp",c,a);{let p=UP(a);this.existsSync(p)||this.mkdirSync(p,{recursive:!0})}if(h.isDirectory()){if(!u.recursive)throw(0,C.createError)("EISDIR","cp",c);this.cpDirSync(h,d,c,a,u)}else if(h.isFile()||h.isCharacterDevice()||h.isBlockDevice())this.cpFileSync(h,d,c,a,u);else if(h.isSymbolicLink()&&!u.dereference)this.cpSymlinkSync(d,c,a,u);else throw(0,C.createError)("EINVAL","cp",c)},this.linkSync=(c,a)=>{let u=(0,C.pathToFilename)(c),h=(0,C.pathToFilename)(a);this._core.link(u,h)},this.link=(c,a,u)=>{let h=(0,C.pathToFilename)(c),d=(0,C.pathToFilename)(a);this.wrapAsync(this._core.link,[h,d],u)},this.unlinkSync=c=>{let a=(0,C.pathToFilename)(c);this._core.unlink(a)},this.unlink=(c,a)=>{let u=(0,C.pathToFilename)(c);this.wrapAsync(this._core.unlink,[u],a)},this.symlinkSync=(c,a,u)=>{let h=(0,C.pathToFilename)(c),d=(0,C.pathToFilename)(a);this._core.symlink(h,d)},this.symlink=(c,a,u,h)=>{let d=(0,C.validateCallback)(typeof u=="function"?u:h),p=(0,C.pathToFilename)(c),m=(0,C.pathToFilename)(a);this.wrapAsync(this._core.symlink,[p,m],d)},this._lstat=(c,a=!1,u=!1)=>{let h;try{h=this._core.getLinkOrThrow(c,"lstat")}catch(d){if(d.code==="ENOENT"&&!u)return;throw d}return yb.default.build(h.getNode(),a)},this.lstatSync=(c,a)=>{let{throwIfNoEntry:u=!0,bigint:h=!1}=(0,re.getStatOptions)(a);return this._lstat((0,C.pathToFilename)(c),h,u)},this.renameSync=(c,a)=>{let u=(0,C.pathToFilename)(c),h=(0,C.pathToFilename)(a);this._core.rename(u,h)},this.rename=(c,a,u)=>{let h=(0,C.pathToFilename)(c),d=(0,C.pathToFilename)(a);this.wrapAsync(this._core.rename,[h,d],u)},this.existsSync=c=>{try{return this._exists((0,C.pathToFilename)(c))}catch{return!1}},this.exists=(c,a)=>{let u=(0,C.pathToFilename)(c);if(typeof a!="function")throw Error(dd.ERRSTR.CB);Promise.resolve().then(()=>{try{a(this._exists(u))}catch{a(!1)}})},this.accessSync=(c,a=gb)=>{let u=(0,C.pathToFilename)(c);a=a|0,this._access(u,a)},this.access=(c,a,u)=>{let h=gb,d;typeof a!="function"?[h,d]=[a|0,(0,C.validateCallback)(u)]:d=a;let p=(0,C.pathToFilename)(c);this.wrapAsync(this._access,[p,h],d)},this.appendFileSync=(c,a,u)=>{let h=(0,re.getAppendFileOpts)(u);(!h.flag||(0,Xe.isFd)(c))&&(h.flag="a"),this.writeFileSync(c,a,h)},this.appendFile=(c,a,u,h)=>{let[d,p]=(0,re.getAppendFileOptsAndCb)(u,h);(!d.flag||(0,Xe.isFd)(c))&&(d.flag="a"),this.writeFile(c,a,d,p)},this._readdir=(c,a)=>{let u=(0,Xe.filenameToSteps)(c),h=this._core.getResolvedLinkOrThrow(c,"scandir"),d=h.getNode();if(!d.isDirectory())throw(0,C.createError)("ENOTDIR","scandir",c);if(!d.canRead())throw(0,C.createError)("EACCES","scandir",c);let p=[];for(let w of h.children.keys()){let y=h.getChild(w);if(!(!y||w==="."||w==="..")&&(p.push(BH.default.build(y,a.encoding)),a.recursive&&y.children.size)){let g={...a,recursive:!0,withFileTypes:!0},_=this._readdir(y.getPath(),g);p.push(..._)}}if(!Xe.isWin&&a.encoding!=="buffer"&&p.sort((w,y)=>w.name<y.name?-1:w.name>y.name?1:0),a.withFileTypes)return p;let m=c;return Xe.isWin&&(m=m.replace(/\\/g,"/")),p.map(w=>{if(a.recursive){let y=bb(w.parentPath,w.name.toString());return Xe.isWin&&(y=y.replace(/\\/g,"/")),y.replace(m+Pe.posix.sep,"")}return w.name})},this.readdirSync=(c,a)=>{let u=(0,re.getReaddirOptions)(a),h=(0,C.pathToFilename)(c);return this._readdir(h,u)},this.readdir=(c,a,u)=>{let[h,d]=(0,re.getReaddirOptsAndCb)(a,u),p=(0,C.pathToFilename)(c);this.wrapAsync(this._readdir,[p,h],d)},this._readlink=(c,a)=>{let h=this._core.getLinkOrThrow(c,"readlink").getNode();if(!h.isSymlink())throw(0,C.createError)("EINVAL","readlink",c);return(0,Rn.strToEncoding)(h.symlink,a)},this.readlinkSync=(c,a)=>{let u=(0,re.getDefaultOpts)(a),h=(0,C.pathToFilename)(c);return this._readlink(h,u.encoding)},this.readlink=(c,a,u)=>{let[h,d]=(0,re.getDefaultOptsAndCb)(a,u),p=(0,C.pathToFilename)(c);this.wrapAsync(this._readlink,[p,h.encoding],d)},this._fsync=c=>{this._core.getFileByFdOrThrow(c,"fsync")},this.fsyncSync=c=>{this._fsync(c)},this.fsync=(c,a)=>{this.wrapAsync(this._fsync,[c],a)},this._fdatasync=c=>{this._core.getFileByFdOrThrow(c,"fdatasync")},this.fdatasyncSync=c=>{this._fdatasync(c)},this.fdatasync=(c,a)=>{this.wrapAsync(this._fdatasync,[c],a)},this._ftruncate=(c,a)=>{this._core.getFileByFdOrThrow(c,"ftruncate").truncate(a)},this.ftruncateSync=(c,a)=>{this._ftruncate(c,a)},this.ftruncate=(c,a,u)=>{let h=typeof a=="number"?a:0,d=(0,C.validateCallback)(typeof a=="number"?u:a);this.wrapAsync(this._ftruncate,[c,h],d)},this._truncate=(c,a)=>{let u=this.openSync(c,"r+");try{this.ftruncateSync(u,a)}finally{this.closeSync(u)}},this.truncateSync=(c,a)=>{if((0,Xe.isFd)(c))return this.ftruncateSync(c,a);this._truncate(c,a)},this.truncate=(c,a,u)=>{let h=typeof a=="number"?a:0,d=(0,C.validateCallback)(typeof a=="number"?u:a);if((0,Xe.isFd)(c))return this.ftruncate(c,h,d);this.wrapAsync(this._truncate,[c,h],d)},this._futimes=(c,a,u)=>{let d=this._core.getFileByFdOrThrow(c,"futimes").node;d.atime=new Date(a*1e3),d.mtime=new Date(u*1e3)},this.futimesSync=(c,a,u)=>{this._futimes(c,At(a),At(u))},this.futimes=(c,a,u,h)=>{this.wrapAsync(this._futimes,[c,At(a),At(u)],h)},this._utimes=(c,a,u,h=!0)=>{let d=this._core,m=(h?d.getResolvedLinkOrThrow(c,"utimes"):d.getLinkOrThrow(c,"lutimes")).getNode();m.atime=new Date(a*1e3),m.mtime=new Date(u*1e3)},this.utimesSync=(c,a,u)=>{this._utimes((0,C.pathToFilename)(c),At(a),At(u),!0)},this.utimes=(c,a,u,h)=>{this.wrapAsync(this._utimes,[(0,C.pathToFilename)(c),At(a),At(u),!0],h)},this.lutimesSync=(c,a,u)=>{this._utimes((0,C.pathToFilename)(c),At(a),At(u),!1)},this.lutimes=(c,a,u,h)=>{this.wrapAsync(this._utimes,[(0,C.pathToFilename)(c),At(a),At(u),!1],h)},this.mkdirSync=(c,a)=>{let u=(0,re.getMkdirOptions)(a),h=(0,C.modeToNumber)(u.mode,511),d=(0,C.pathToFilename)(c);if(u.recursive)return this._core.mkdirp(d,h);this._core.mkdir(d,h)},this.mkdir=(c,a,u)=>{let h=(0,re.getMkdirOptions)(a),d=(0,C.validateCallback)(typeof a=="function"?a:u),p=(0,C.modeToNumber)(h.mode,511),m=(0,C.pathToFilename)(c);h.recursive?this.wrapAsync(this._core.mkdirp,[m,p],d):this.wrapAsync(this._core.mkdir,[m,p],d)},this._mkdtemp=(c,a,u=5)=>{let h=c+(0,C.genRndStr6)();try{return this._core.mkdir(h,511),(0,Rn.strToEncoding)(h,a)}catch(d){if(d.code==="EEXIST"){if(u>1)return this._mkdtemp(c,a,u-1);throw Error("Could not create temp dir.")}else throw d}},this.mkdtempSync=(c,a)=>{let{encoding:u}=(0,re.getDefaultOpts)(a);if(!c||typeof c!="string")throw new TypeError("filename prefix is required");return(0,C.nullCheck)(c),this._mkdtemp(c,u)},this.mkdtemp=(c,a,u)=>{let[{encoding:h},d]=(0,re.getDefaultOptsAndCb)(a,u);if(!c||typeof c!="string")throw new TypeError("filename prefix is required");(0,C.nullCheck)(c)&&this.wrapAsync(this._mkdtemp,[c,h],d)},this.rmdirSync=(c,a)=>{let u=(0,re.getRmdirOptions)(a);this._core.rmdir((0,C.pathToFilename)(c),u.recursive)},this.rmdir=(c,a,u)=>{let h=(0,re.getRmdirOptions)(a),d=(0,C.validateCallback)(typeof a=="function"?a:u);this.wrapAsync(this._core.rmdir,[(0,C.pathToFilename)(c),h.recursive],d)},this.rmSync=(c,a)=>{this._core.rm((0,C.pathToFilename)(c),a?.force,a?.recursive)},this.rm=(c,a,u)=>{let[h,d]=(0,re.getRmOptsAndCb)(a,u);this.wrapAsync(this._core.rm,[(0,C.pathToFilename)(c),h?.force,h?.recursive],d)},this._fchmod=(c,a)=>{this._core.getFileByFdOrThrow(c,"fchmod").chmod(a)},this.fchmodSync=(c,a)=>{this._fchmod(c,(0,C.modeToNumber)(a))},this.fchmod=(c,a,u)=>{this.wrapAsync(this._fchmod,[c,(0,C.modeToNumber)(a)],u)},this._chmod=(c,a,u=!0)=>{(u?this._core.getResolvedLinkOrThrow(c,"chmod"):this._core.getLinkOrThrow(c,"chmod")).getNode().chmod(a)},this.chmodSync=(c,a)=>{let u=(0,C.modeToNumber)(a),h=(0,C.pathToFilename)(c);this._chmod(h,u,!0)},this.chmod=(c,a,u)=>{let h=(0,C.modeToNumber)(a),d=(0,C.pathToFilename)(c);this.wrapAsync(this._chmod,[d,h],u)},this._lchmod=(c,a)=>{this._chmod(c,a,!1)},this.lchmodSync=(c,a)=>{let u=(0,C.modeToNumber)(a),h=(0,C.pathToFilename)(c);this._lchmod(h,u)},this.lchmod=(c,a,u)=>{let h=(0,C.modeToNumber)(a),d=(0,C.pathToFilename)(c);this.wrapAsync(this._lchmod,[d,h],u)},this._fchown=(c,a,u)=>{this._core.getFileByFdOrThrow(c,"fchown").chown(a,u)},this.fchownSync=(c,a,u)=>{Ko(a),Jo(u),this._fchown(c,a,u)},this.fchown=(c,a,u,h)=>{Ko(a),Jo(u),this.wrapAsync(this._fchown,[c,a,u],h)},this._chown=(c,a,u)=>{this._core.getResolvedLinkOrThrow(c,"chown").getNode().chown(a,u)},this.chownSync=(c,a,u)=>{Ko(a),Jo(u),this._chown((0,C.pathToFilename)(c),a,u)},this.chown=(c,a,u,h)=>{Ko(a),Jo(u),this.wrapAsync(this._chown,[(0,C.pathToFilename)(c),a,u],h)},this._lchown=(c,a,u)=>{this._core.getLinkOrThrow(c,"lchown").getNode().chown(a,u)},this.lchownSync=(c,a,u)=>{Ko(a),Jo(u),this._lchown((0,C.pathToFilename)(c),a,u)},this.lchown=(c,a,u,h)=>{Ko(a),Jo(u),this.wrapAsync(this._lchown,[(0,C.pathToFilename)(c),a,u],h)},this.statWatchers={},this.cpSync=(c,a,u)=>{let h=(0,C.pathToFilename)(c),d=(0,C.pathToFilename)(a),p={dereference:u?.dereference??!1,errorOnExist:u?.errorOnExist??!1,filter:u?.filter,force:u?.force??!0,mode:u?.mode??0,preserveTimestamps:u?.preserveTimestamps??!1,recursive:u?.recursive??!1,verbatimSymlinks:u?.verbatimSymlinks??!1};return this._cp(h,d,p)},this.cp=(c,a,u,h)=>{let d=(0,C.pathToFilename)(c),p=(0,C.pathToFilename)(a),m,w;typeof u=="function"?[m,w]=[{},u]:[m,w]=[u||{},h],(0,C.validateCallback)(w);let y={dereference:m?.dereference??!1,errorOnExist:m?.errorOnExist??!1,filter:m?.filter,force:m?.force??!0,mode:m?.mode??0,preserveTimestamps:m?.preserveTimestamps??!1,recursive:m?.recursive??!1,verbatimSymlinks:m?.verbatimSymlinks??!1};this.wrapAsync(this._cp,[d,p,y],w)},this.openAsBlob=async(c,a)=>{let u=(0,C.pathToFilename)(c),h;try{h=this._core.getResolvedLinkOrThrow(u,"open")}catch(w){throw w&&typeof w=="object"&&w.code==="ENOENT"?new zH.TypeError("ERR_INVALID_ARG_VALUE"):w}let p=h.getNode().getBuffer(),m=a?.type||"";return new Blob([p],{type:m})},this.glob=(c,...a)=>{let[u,h]=a.length===1?[{},a[0]]:[a[0],a[1]];this.wrapAsync(this._globSync,[c,u||{}],h)},this.globSync=(c,a={})=>this._globSync(c,a),this._globSync=(c,a={})=>{let{globSync:u}=jP();return u(this,c,a)},this._opendir=(c,a)=>{let u=this._core.getResolvedLinkOrThrow(c,"scandir");if(!u.getNode().isDirectory())throw(0,C.createError)("ENOTDIR","scandir",c);return new HH.Dir(u,a)},this.opendirSync=(c,a)=>{let u=(0,re.getOpendirOptions)(a),h=(0,C.pathToFilename)(c);return this._opendir(h,u)},this.opendir=(c,a,u)=>{let[h,d]=(0,re.getOpendirOptsAndCb)(a,u),p=(0,C.pathToFilename)(c);this.wrapAsync(this._opendir,[p,h],d)};let r=this;this.StatWatcher=class extends pd{constructor(){super(r)}};let i=Fr;this.ReadStream=class extends i{constructor(...c){super(r,...c)}};let n=Vt;this.WriteStream=class extends n{constructor(...c){super(r,...c)}},this.FSWatcher=class extends md{constructor(){super(r)}};let s=l((c,a)=>{let u=this._core.getResolvedLinkOrThrow(c,"realpath");return(0,Rn.strToEncoding)(u.getPath()||"/",a)},"_realpath"),o=l((c,a,u)=>{let[h,d]=(0,re.getRealpathOptsAndCb)(a,u),p=(0,C.pathToFilename)(c);r.wrapAsync(s,[p,h.encoding],d)},"realpathImpl"),f=l((c,a)=>s((0,C.pathToFilename)(c),(0,re.getRealpathOptions)(a).encoding),"realpathSyncImpl");this.realpath=o,this.realpath.native=o,this.realpathSync=f,this.realpathSync.native=f}wrapAsync(e,r,i){(0,C.validateCallback)(i),Promise.resolve().then(()=>{let n;try{n=e.apply(this,r)}catch(s){i(s);return}i(null,n)})}toTree(e={separator:Pe.sep}){return(0,WH.toTreeSync)(this,e)}reset(){this._core.reset()}toJSON(e,r={},i=!1,n=!1){return this._core.toJSON(e,r,i,n)}fromJSON(e,r){return this._core.fromJSON(e,r)}fromNestedJSON(e,r){return this._core.fromNestedJSON(e,r)}mountSync(e,r){this._core.fromJSON(r,e)}_write(e,r,i,n,s){let o=this._core.getFileByFdOrThrow(e,"write");if(o.node.isSymlink())throw(0,C.createError)("EBADF","write",o.link.getPath());return o.write(r,i,n,s===-1||typeof s!="number"?void 0:s)}writevBase(e,r,i){let n=this._core.getFileByFdOrThrow(e),s=i??void 0;s===-1&&(s=void 0);let o=0;for(let f of r){let c=Xo.Buffer.from(f.buffer,f.byteOffset,f.byteLength),a=n.write(c,0,c.byteLength,s);if(s=void 0,o+=a,a<c.byteLength)break}return o}_copyFile(e,r,i){let n=this.readFileSync(e);if(i&XH&&this.existsSync(r))throw(0,C.createError)("EEXIST","copyFile",e,r);if(i&YH)throw(0,C.createError)("ENOSYS","copyFile",e,r);this._core.writeFile(r,n,dd.FLAGS.w,438)}isSrcSubdir(e,r){try{let i=WP(e.startsWith("/")?e:"/"+e),n=WP(r.startsWith("/")?r:"/"+r);if(i===n)return!0;let s=hd(i,n);return s===""||!s.startsWith("..")&&!(0,Pe.isAbsolute)(s)}catch{return!1}}cpFileSync(e,r,i,n,s){if(r){if(s.errorOnExist)throw(0,C.createError)("EEXIST","cp",n);if(!s.force)return;this.unlinkSync(n)}this.copyFileSync(i,n,s.mode),s.preserveTimestamps&&this.utimesSync(n,e.atime,e.mtime),this.chmodSync(n,Number(e.mode))}cpDirSync(e,r,i,n,s){r||this.mkdirSync(n);let o=this.readdirSync(i);for(let f of o){let c=bb(i,String(f)),a=bb(n,String(f));s.filter&&!s.filter(c,a)||this._cp(c,a,s)}this.chmodSync(n,Number(e.mode))}cpSymlinkSync(e,r,i,n){let s=String(this.readlinkSync(r));!n.verbatimSymlinks&&!(0,Pe.isAbsolute)(s)&&(s=VH(UP(r),s)),e&&this.unlinkSync(i),this.symlinkSync(s,i)}lstat(e,r,i){let[{throwIfNoEntry:n=!0,bigint:s=!1},o]=(0,re.getStatOptsAndCb)(r,i);this.wrapAsync(this._lstat,[(0,C.pathToFilename)(e),s,n],o)}_stat(e,r=!1,i=!0){let n;try{n=this._core.getResolvedLinkOrThrow(e,"stat")}catch(s){if(s.code==="ENOENT"&&!i)return;throw s}return yb.default.build(n.getNode(),r)}statSync(e,r){let{bigint:i=!0,throwIfNoEntry:n=!0}=(0,re.getStatOptions)(r);return this._stat((0,C.pathToFilename)(e),i,n)}stat(e,r,i){let[{bigint:n=!1,throwIfNoEntry:s=!0},o]=(0,re.getStatOptsAndCb)(r,i);this.wrapAsync(this._stat,[(0,C.pathToFilename)(e),n,s],o)}fstatBase(e,r=!1){let i=this._core.getFileByFd(e);if(!i)throw(0,C.createError)("EBADF","fstat");return yb.default.build(i.node,r)}fstatSync(e,r){return this.fstatBase(e,(0,re.getStatOptions)(r).bigint)}fstat(e,r,i){let[n,s]=(0,re.getStatOptsAndCb)(r,i);this.wrapAsync(this.fstatBase,[e,n.bigint],s)}_exists(e){return!!this._stat(e)}_access(e,r){let n=this._core.getLinkOrThrow(e,"access").getNode();if(r!==gb&&(r&GH&&!n.canRead()||r&KH&&!n.canWrite()||r&JH&&!n.canExecute()))throw(0,C.createError)("EACCES","access",e)}watchFile(e,r,i){let n=(0,C.pathToFilename)(e),s=r,o=i;if(typeof s=="function"&&(o=r,s=null),typeof o!="function")throw Error('"watchFile()" requires a listener function');let f=5007,c=!0;s&&typeof s=="object"&&(typeof s.interval=="number"&&(f=s.interval),typeof s.persistent=="boolean"&&(c=s.persistent));let a=this.statWatchers[n];return a||(a=new this.StatWatcher,a.start(n,c,f),this.statWatchers[n]=a),a.addListener("change",o),a}unwatchFile(e,r){let i=(0,C.pathToFilename)(e),n=this.statWatchers[i];n&&(typeof r=="function"?n.removeListener("change",r):n.removeAllListeners("change"),n.listenerCount("change")===0&&(n.stop(),delete this.statWatchers[i]))}createReadStream(e,r){return new this.ReadStream(e,r)}createWriteStream(e,r){return new this.WriteStream(e,r)}watch(e,r,i){let n=(0,C.pathToFilename)(e),s=r;typeof r=="function"&&(i=r,s=null);let{persistent:o,recursive:f,encoding:c}=(0,re.getDefaultOpts)(s);o===void 0&&(o=!0),f===void 0&&(f=!1);let a=new this.FSWatcher;return a.start(n,o,f,c),i&&a.addListener("change",i),a}_statfs(e,r=!1){return this._core.getResolvedLinkOrThrow(e,"statfs"),MH.default.build(this._core,r)}statfsSync(e,r){let{bigint:i=!1}=(0,re.getStatfsOptions)(r);return this._statfs((0,C.pathToFilename)(e),i)}statfs(e,r,i){let[{bigint:n=!1},s]=(0,re.getStatfsOptsAndCb)(r,i);this.wrapAsync(this._statfs,[(0,C.pathToFilename)(e),n],s)}};l(Sb,"Volume");var On=Sb;Pt.Volume=On;On.fromJSON=(t,e)=>new On(_b.Superblock.fromJSON(t,e));On.fromNestedJSON=(t,e)=>new On(_b.Superblock.fromNestedJSON(t,e));function t5(t){t.emit("stop")}l(t5,"emitStop");var vb=class vb extends zP.EventEmitter{constructor(e){super(),this.onInterval=()=>{try{let r=this.vol.statSync(this.filename);this.hasChanged(r)&&(this.emit("change",r,this.prev),this.prev=r)}finally{this.loop()}},this.vol=e}loop(){this.timeoutRef=this.setTimeout(this.onInterval,this.interval)}hasChanged(e){return e.mtimeMs>this.prev.mtimeMs||e.nlink!==this.prev.nlink}start(e,r=!0,i=5007){this.filename=(0,C.pathToFilename)(e),this.setTimeout=r?setTimeout.bind(globalThis):LH.default,this.interval=i,this.prev=this.vol.statSync(this.filename),this.loop()}stop(){clearTimeout(this.timeoutRef),(0,wd.default)(()=>{t5.call(this,this)})}};l(vb,"StatWatcher");var pd=vb;Pt.StatWatcher=pd;var Ht;function r5(t){Ht=(0,Xo.bufferAllocUnsafe)(t),Ht.used=0}l(r5,"allocNewPool");(0,HP.inherits)(Fr,yd.Readable);Pt.ReadStream=Fr;function Fr(t,e,r){if(!(this instanceof Fr))return new Fr(t,e,r);if(this._vol=t,r=Object.assign({},(0,re.getOptions)(r,{})),r.highWaterMark===void 0&&(r.highWaterMark=64*1024),yd.Readable.call(this,r),this.path=(0,C.pathToFilename)(e),this.fd=r.fd===void 0?null:typeof r.fd!="number"?r.fd.fd:r.fd,this.flags=r.flags===void 0?"r":r.flags,this.mode=r.mode===void 0?438:r.mode,this.start=r.start,this.end=r.end,this.autoClose=r.autoClose===void 0?!0:r.autoClose,this.pos=void 0,this.bytesRead=0,this.start!==void 0){if(typeof this.start!="number")throw new TypeError('"start" option must be a Number');if(this.end===void 0)this.end=1/0;else if(typeof this.end!="number")throw new TypeError('"end" option must be a Number');if(this.start>this.end)throw new Error('"start" option must be <= "end" option');this.pos=this.start}typeof this.fd!="number"&&this.open(),this.on("end",function(){this.autoClose&&this.destroy&&this.destroy()})}l(Fr,"FsReadStream");Fr.prototype.open=function(){var t=this;this._vol.open(this.path,this.flags,this.mode,(e,r)=>{if(e){t.autoClose&&t.destroy&&t.destroy(),t.emit("error",e);return}t.fd=r,t.emit("open",r),t.read()})};Fr.prototype._read=function(t){if(typeof this.fd!="number")return this.once("open",function(){this._read(t)});if(this.destroyed)return;(!Ht||Ht.length-Ht.used<ZH)&&r5(this._readableState.highWaterMark);var e=Ht,r=Math.min(Ht.length-Ht.used,t),i=Ht.used;if(this.pos!==void 0&&(r=Math.min(this.end-this.pos+1,r)),r<=0)return this.push(null);var n=this;this._vol.read(this.fd,Ht,Ht.used,r,this.pos,s),this.pos!==void 0&&(this.pos+=r),Ht.used+=r;function s(o,f){if(o)n.autoClose&&n.destroy&&n.destroy(),n.emit("error",o);else{var c=null;f>0&&(n.bytesRead+=f,c=e.slice(i,i+f)),n.push(c)}}l(s,"onread")};Fr.prototype._destroy=function(t,e){this.close(r=>{e(t||r)})};Fr.prototype.close=function(t){if(t&&this.once("close",t),this.closed||typeof this.fd!="number"){if(typeof this.fd!="number"){this.once("open",VP);return}return(0,wd.default)(()=>this.emit("close"))}typeof this._readableState?.closed=="boolean"?this._readableState.closed=!0:this.closed=!0,this._vol.close(this.fd,e=>{e?this.emit("error",e):this.emit("close")}),this.fd=null};function VP(t){this.close()}l(VP,"closeOnOpen");(0,HP.inherits)(Vt,yd.Writable);Pt.WriteStream=Vt;function Vt(t,e,r){if(!(this instanceof Vt))return new Vt(t,e,r);if(this._vol=t,r=Object.assign({},(0,re.getOptions)(r,{})),yd.Writable.call(this,r),this.path=(0,C.pathToFilename)(e),this.fd=r.fd===void 0?null:typeof r.fd!="number"?r.fd.fd:r.fd,this.flags=r.flags===void 0?"w":r.flags,this.mode=r.mode===void 0?438:r.mode,this.start=r.start,this.autoClose=r.autoClose===void 0?!0:!!r.autoClose,this.pos=void 0,this.bytesWritten=0,this.pending=!0,this.start!==void 0){if(typeof this.start!="number")throw new TypeError('"start" option must be a Number');if(this.start<0)throw new Error('"start" must be >= zero');this.pos=this.start}r.encoding&&this.setDefaultEncoding(r.encoding),typeof this.fd!="number"&&this.open(),this.once("finish",function(){this.autoClose&&this.close()})}l(Vt,"FsWriteStream");Vt.prototype.open=function(){this._vol.open(this.path,this.flags,this.mode,function(t,e){if(t){this.autoClose&&this.destroy&&this.destroy(),this.emit("error",t);return}this.fd=e,this.pending=!1,this.emit("open",e)}.bind(this))};Vt.prototype._write=function(t,e,r){if(!(t instanceof Xo.Buffer||t instanceof Uint8Array))return this.emit("error",new Error("Invalid data"));if(typeof this.fd!="number")return this.once("open",function(){this._write(t,e,r)});var i=this;this._vol.write(this.fd,t,0,t.length,this.pos,(n,s)=>{if(n)return i.autoClose&&i.destroy&&i.destroy(),r(n);i.bytesWritten+=s,r()}),this.pos!==void 0&&(this.pos+=t.length)};Vt.prototype._writev=function(t,e){if(typeof this.fd!="number")return this.once("open",function(){this._writev(t,e)});let r=this,i=t.length,n=new Array(i);for(var s=0,o=0;o<i;o++){var f=t[o].chunk;n[o]=f,s+=f.length}let c=Xo.Buffer.concat(n);this._vol.write(this.fd,c,0,c.length,this.pos,(a,u)=>{if(a)return r.destroy&&r.destroy(),e(a);r.bytesWritten+=u,e()}),this.pos!==void 0&&(this.pos+=s)};Vt.prototype.close=function(t){if(t&&this.once("close",t),this.closed||typeof this.fd!="number"){if(typeof this.fd!="number"){this.once("open",VP);return}return(0,wd.default)(()=>this.emit("close"))}typeof this._writableState?.closed=="boolean"?this._writableState.closed=!0:this.closed=!0,this._vol.close(this.fd,e=>{e?this.emit("error",e):this.emit("close")}),this.fd=null};Vt.prototype._destroy=Fr.prototype._destroy;Vt.prototype.destroySoon=Vt.prototype.end;var Eb=class Eb extends zP.EventEmitter{constructor(e){super(),this._filename="",this._filenameEncoded="",this._recursive=!1,this._encoding=Rn.ENCODING_UTF8,this._listenerRemovers=new Map,this._onParentChild=r=>{r.getName()===this._getName()&&this._emit("rename")},this._emit=r=>{this.emit("change",r,this._filenameEncoded)},this._persist=()=>{this._timer=setTimeout(this._persist,1e6)},this._vol=e}_getName(){return this._steps[this._steps.length-1]}start(e,r=!0,i=!1,n=Rn.ENCODING_UTF8){this._filename=(0,C.pathToFilename)(e),this._steps=(0,Xe.filenameToSteps)(this._filename),this._filenameEncoded=(0,Rn.strToEncoding)(this._filename),this._recursive=i,this._encoding=n;try{this._link=this._vol._core.getLinkOrThrow(this._filename,"FSWatcher")}catch(c){let a=new Error(`watch ${this._filename} ${c.code}`);throw a.code=c.code,a.errno=c.code,a}let s=l(c=>{let a=c.getPath(),u=c.getNode(),h=l(()=>{let m=hd(this._filename,a);return m||(m=this._getName()),this.emit("change","change",m)},"onNodeChange"),d=u.changes.listen(([m])=>{m==="modify"&&h()}),p=this._listenerRemovers.get(u.ino)??[];p.push(()=>d()),this._listenerRemovers.set(u.ino,p)},"watchLinkNodeChanged"),o=l(c=>{let a=c.getNode(),u=l(m=>{this.emit("change","rename",hd(this._filename,m.getPath())),s(m),o(m)},"onLinkChildAdd"),h=l(m=>{let w=l(y=>{let g=y.getNode().ino,_=this._listenerRemovers.get(g);_&&(_.forEach(F=>F()),this._listenerRemovers.delete(g));for(let[F,E]of y.children.entries())E&&F!=="."&&F!==".."&&w(E)},"removeLinkNodeListeners");w(m),this.emit("change","rename",hd(this._filename,m.getPath()))},"onLinkChildDelete");for(let[m,w]of c.children.entries())w&&m!=="."&&m!==".."&&s(w);let d=c.changes.listen(([m,w])=>{m==="child:add"?u(w):m==="child:del"&&h(w)});if((this._listenerRemovers.get(a.ino)??[]).push(()=>{d()}),i)for(let[m,w]of c.children.entries())w&&m!=="."&&m!==".."&&o(w)},"watchLinkChildrenChanged");s(this._link),o(this._link);let f=this._link.parent;f&&f.changes.listen(([c,a])=>{c==="child:del"&&this._onParentChild(a)}),r&&this._persist()}close(){clearTimeout(this._timer),this._listenerRemovers.forEach(e=>{e.forEach(r=>r())}),this._listenerRemovers.clear(),this._parentChangesUnsub?.()}};l(Eb,"FSWatcher");var md=Eb;Pt.FSWatcher=md});var KP=T(gd=>{"use strict";Object.defineProperty(gd,"__esModule",{value:!0});gd.fsSynchronousApiList=void 0;gd.fsSynchronousApiList=["accessSync","appendFileSync","chmodSync","chownSync","closeSync","copyFileSync","existsSync","fchmodSync","fchownSync","fdatasyncSync","fstatSync","fsyncSync","ftruncateSync","futimesSync","lchmodSync","lchownSync","linkSync","lstatSync","mkdirSync","mkdtempSync","openSync","opendirSync","readdirSync","readFileSync","readlinkSync","readSync","readvSync","realpathSync","renameSync","rmdirSync","rmSync","statSync","symlinkSync","truncateSync","unlinkSync","utimesSync","lutimesSync","writeFileSync","writeSync","writevSync"]});var JP=T(bd=>{"use strict";Object.defineProperty(bd,"__esModule",{value:!0});bd.fsCallbackApiList=void 0;bd.fsCallbackApiList=["access","appendFile","chmod","chown","close","copyFile","cp","createReadStream","createWriteStream","exists","fchmod","fchown","fdatasync","fstat","fsync","ftruncate","futimes","lchmod","lchown","link","lstat","mkdir","mkdtemp","open","openAsBlob","opendir","read","readv","readdir","readFile","readlink","realpath","rename","rm","rmdir","stat","statfs","symlink","truncate","unlink","unwatchFile","utimes","lutimes","watch","watchFile","write","writev","writeFile"]});var YP=T((Nt,_d)=>{"use strict";Object.defineProperty(Nt,"__esModule",{value:!0});Nt.memfs=Nt.fs=Nt.vol=Nt.Volume=void 0;Nt.createFsFromVolume=Fb;var i5=Dg(),n5=Mh(),Sd=GP();Object.defineProperty(Nt,"Volume",{enumerable:!0,get:l(function(){return Sd.Volume},"get")});var XP=nr(),s5=KP(),o5=JP(),{F_OK:a5,R_OK:c5,W_OK:l5,X_OK:f5}=XP.constants;Nt.vol=new Sd.Volume;function Fb(t){let e={F_OK:a5,R_OK:c5,W_OK:l5,X_OK:f5,constants:XP.constants,Stats:i5.default,Dirent:n5.default};for(let r of s5.fsSynchronousApiList)typeof t[r]=="function"&&(e[r]=t[r].bind(t));for(let r of o5.fsCallbackApiList)typeof t[r]=="function"&&(e[r]=t[r].bind(t));return e.StatWatcher=t.StatWatcher,e.FSWatcher=t.FSWatcher,e.WriteStream=t.WriteStream,e.ReadStream=t.ReadStream,e.promises=t.promises,typeof t.realpath=="function"&&(e.realpath=t.realpath.bind(t),typeof t.realpath.native=="function"&&(e.realpath.native=t.realpath.native.bind(t))),typeof t.realpathSync=="function"&&(e.realpathSync=t.realpathSync.bind(t),typeof t.realpathSync.native=="function"&&(e.realpathSync.native=t.realpathSync.native.bind(t))),e._toUnixTimestamp=Sd.toUnixTimestamp,e.__vol=t,e}l(Fb,"createFsFromVolume");Nt.fs=Fb(Nt.vol);var u5=l((t={},e="/")=>{let r=Sd.Volume.fromNestedJSON(t,e);return{fs:Fb(r),vol:r}},"memfs");Nt.memfs=u5;_d.exports={..._d.exports,...Nt.fs};_d.exports.semantic=!0});var $b=l(t=>{try{let r=t.split(".")[1];if(!r)throw new Error("Invalid JWT format");let i=r.replace(/-/g,"+").replace(/_/g,"/");for(;i.length%4!==0;)i+="=";let n=atob(i),o=JSON.parse(n).exp;if(!o||typeof o!="number")throw new Error('JWT does not contain a valid "exp" field');return o*1e3}catch(e){throw new Error("Unable to determine the token expiry: "+e)}},"getJwtExpiry"),na,An,Pd=(An=class{constructor(e){U(this,"strategy","jwt");U(this,"cachedToken",null);U(this,"tokenExpiry",null);ra(this,na);ia(this,na,e)}async getAuthHeaders(){let e=Date.now();if(this.cachedToken&&this.tokenExpiry&&this.tokenExpiry-e>30*1e3)return{Authorization:`Bearer ${this.cachedToken}`};let r=await ta(this,na).call(this);return r?(this.cachedToken=r,this.tokenExpiry=$b(r),{Authorization:`Bearer ${r}`}):!1}readAuthHeaders(e){let r=e.get("Authorization");if(!r)return;let[i,n]=r.split(" ");if(i!=="Bearer"||!n)throw new Error("Invalid auth header received");this.cachedToken=n,this.tokenExpiry=$b(n)}},na=new WeakMap,l(An,"AssistantCloudJWTAuthStrategy"),An),sa,oa,aa,Pn,Bb=(Pn=class{constructor(e,r,i){U(this,"strategy","api-key");ra(this,sa);ra(this,oa);ra(this,aa);ia(this,sa,e),ia(this,oa,r),ia(this,aa,i)}async getAuthHeaders(){return{Authorization:`Bearer ${ta(this,sa)}`,"Aui-User-Id":ta(this,oa),"Aui-Workspace-Id":ta(this,aa)}}readAuthHeaders(){}},sa=new WeakMap,oa=new WeakMap,aa=new WeakMap,l(Pn,"AssistantCloudAPIKeyAuthStrategy"),Pn),Vc="aui:refresh_token",Nn,Mb=(Nn=class{constructor(e){U(this,"strategy","anon");U(this,"baseUrl");U(this,"jwtStrategy");this.baseUrl=e,this.jwtStrategy=new Pd(async()=>{let r=Date.now(),i=localStorage.getItem(Vc),n=i?JSON.parse(i):void 0;if(n)if(new Date(n.expires_at).getTime()-r>30*1e3){let u=await fetch(`${this.baseUrl}/v1/auth/tokens/refresh`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({refresh_token:n.token})});if(u.ok){let h=await u.json(),{access_token:d,refresh_token:p}=h;return p&&localStorage.setItem(Vc,JSON.stringify(p)),d}}else localStorage.removeItem(Vc);let s=await fetch(`${this.baseUrl}/v1/auth/tokens/anonymous`,{method:"POST"});if(!s.ok)return null;let o=await s.json(),{access_token:f,refresh_token:c}=o;return!f||!c?null:(localStorage.setItem(Vc,JSON.stringify(c)),f)})}async getAuthHeaders(){return this.jwtStrategy.getAuthHeaders()}readAuthHeaders(e){this.jwtStrategy.readAuthHeaders(e)}},l(Nn,"AssistantCloudAnonymousAuthStrategy"),Nn);var Cn,wN=(Cn=class extends Error{constructor(e){super(e),this.name="APIError"}},l(Cn,"CloudAPIError"),Cn),Dn,Lb=(Dn=class{constructor(e){U(this,"_auth");U(this,"_baseUrl");if("authToken"in e)this._baseUrl=e.baseUrl,this._auth=new Pd(e.authToken);else if("apiKey"in e)this._baseUrl="https://backend.assistant-api.com",this._auth=new Bb(e.apiKey,e.userId,e.workspaceId);else if("anonymous"in e)this._baseUrl=e.baseUrl,this._auth=new Mb(e.baseUrl);else throw new Error("Invalid configuration: Must provide authToken, apiKey, or anonymous configuration")}async initializeAuth(){return!!this._auth.getAuthHeaders()}async makeRawRequest(e,r={}){let i=await this._auth.getAuthHeaders();if(!i)throw new Error("Authorization failed");let n={...i,...r.headers,"Content-Type":"application/json"},s=new URLSearchParams;if(r.query)for(let[c,a]of Object.entries(r.query))a!==!1&&(a===!0?s.set(c,"true"):s.set(c,a.toString()));let o=new URL(`${this._baseUrl}/v1${e}`);o.search=s.toString();let f=await fetch(o,{method:r.method??"GET",headers:n,body:r.body?JSON.stringify(r.body):null});if(this._auth.readAuthHeaders(f.headers),!f.ok){let c=await f.text();try{let a=JSON.parse(c);throw new wN(a.message)}catch{throw new Error(`Request failed with status ${f.status}, ${c}`)}}return f}async makeRequest(e,r={}){return(await this.makeRawRequest(e,r)).json()}},l(Dn,"AssistantCloudAPI"),Dn);var In,jb=(In=class{constructor(e){this.cloud=e}async create(){return this.cloud.makeRequest("/auth/tokens",{method:"POST"})}},l(In,"AssistantCloudAuthTokens"),In);var ca={toResponse(t,e){return new Response(ca.toByteStream(t,e),{headers:e.headers??{}})},fromResponse(t,e){return ca.fromByteStream(t.body,e)},toByteStream(t,e){return t.pipeThrough(e)},fromByteStream(t,e){return t.pipeThrough(e)}};var Gc=l(function(){let t,e,r=new Promise((i,n)=>{t=i,e=n});if(!t||!e)throw new Error("Failed to create promise");return{promise:r,resolve:t,reject:e}},"promiseWithResolvers");var qb=l(()=>{let t=[],e=!1,r,i,n=l(o=>{o.promise||(o.promise=o.reader.read().then(({done:f,value:c})=>{o.promise=void 0,f?(t.splice(t.indexOf(o),1),e&&t.length===0&&r.close()):r.enqueue(c),i?.resolve(),i=void 0}).catch(f=>{console.error(f),t.forEach(c=>{c.reader.cancel()}),t.length=0,r.error(f),i?.reject(f),i=void 0}))},"handlePull");return{readable:new ReadableStream({start(o){r=o},pull(){return i=Gc(),t.forEach(o=>{n(o)}),i.promise},cancel(){t.forEach(o=>{o.reader.cancel()}),t.length=0}}),isSealed(){return e},seal(){e=!0,t.length===0&&r.close()},addStream(o){if(e)throw new Error("Cannot add streams after the run callback has settled.");let f={reader:o.getReader()};t.push(f),n(f)},enqueue(o){this.addStream(new ReadableStream({start(f){f.enqueue(o),f.close()}}))}}},"createMergeStream");var $n,Ub=($n=class{constructor(e){U(this,"_controller");U(this,"_isClosed",!1);this._controller=e}append(e){return this._controller.enqueue({type:"text-delta",path:[],textDelta:e}),this}close(){this._isClosed||(this._isClosed=!0,this._controller.enqueue({type:"part-finish",path:[]}),this._controller.close())}},l($n,"TextStreamControllerImpl"),$n),Nd=l(t=>new ReadableStream({start(e){return t.start?.(new Ub(e))},pull(e){return t.pull?.(new Ub(e))},cancel(e){return t.cancel?.(e)}}),"createTextStream"),Cd=l(()=>{let t;return[Nd({start(r){t=r}}),t]},"createTextStreamController");var Bn,Wb=(Bn=class{constructor(e){U(this,"_isClosed",!1);U(this,"_mergeTask");U(this,"_argsTextController");this._controller=e;let r=Nd({start:l(n=>{this._argsTextController=n},"start")}),i=!1;this._mergeTask=r.pipeTo(new WritableStream({write:l(n=>{switch(n.type){case"text-delta":i=!0,this._controller.enqueue(n);break;case"part-finish":i||this._controller.enqueue({type:"text-delta",textDelta:"{}",path:[]}),this._controller.enqueue({type:"tool-call-args-text-finish",path:[]});break;default:throw new Error(`Unexpected chunk type: ${n.type}`)}},"write")}))}get argsText(){return this._argsTextController}async setResponse(e){this._argsTextController.close(),await Promise.resolve(),this._controller.enqueue({type:"result",path:[],...e.artifact!==void 0?{artifact:e.artifact}:{},result:e.result,isError:e.isError??!1})}async close(){this._isClosed||(this._isClosed=!0,this._argsTextController.close(),await this._mergeTask,this._controller.enqueue({type:"part-finish",path:[]}),this._controller.close())}},l(Bn,"ToolCallStreamControllerImpl"),Bn),yN=l(t=>new ReadableStream({start(e){return t.start?.(new Wb(e))},pull(e){return t.pull?.(new Wb(e))},cancel(e){return t.cancel?.(e)}}),"createToolCallStream"),zb=l(()=>{let t;return[yN({start(r){t=r}}),t]},"createToolCallStreamController");var Mn,Kc=(Mn=class{constructor(){U(this,"value",-1)}up(){return++this.value}},l(Mn,"Counter"),Mn);var Ln,Hb=(Ln=class extends TransformStream{constructor(e){super({transform(r,i){i.enqueue({...r,path:[e,...r.path]})}})}},l(Ln,"PathAppendEncoder"),Ln),jn,Y5=(jn=class extends TransformStream{constructor(e){super({transform(r,i){let{path:[n,...s]}=r;if(e!==n)throw new Error(`Path mismatch: expected ${e}, got ${n}`);i.enqueue({...r,path:s})}})}},l(jn,"PathAppendDecoder"),jn),qn,Vb=(qn=class extends TransformStream{constructor(e){let r=new Kc,i=new Map;super({transform(n,s){n.type==="part-start"&&n.path.length===0&&i.set(r.up(),e.up());let[o,...f]=n.path;if(o===void 0){s.enqueue(n);return}let c=i.get(o);if(c===void 0)throw new Error("Path not found");s.enqueue({...n,path:[c,...f]})}})}},l(qn,"PathMergeEncoder"),qn);var Un,Gb=(Un=class extends TransformStream{constructor(e,r,i){let[n,s]=Kb(),o;super({start(f){return o=n.pipeTo(new WritableStream({write(c){f.enqueue(c)},abort(c){f.error(c)},close(){f.terminate()}})).catch(c=>{f.error(c)}),e.start?.(s)},transform(f){return e.transform?.(f,s)},async flush(){await e.flush?.(s),s.close(),await o}},r,i)}},l(Un,"AssistantTransformStream"),Un);var Wn,Jb=(Wn=class extends TransformStream{constructor(e){super();let r=e(super.readable);Object.defineProperty(this,"readable",{value:r,writable:!1})}},l(Wn,"PipeableTransformStream"),Wn);var Jc=l((t,e=21)=>(r=e)=>{let i="",n=r|0;for(;n--;)i+=t[Math.random()*t.length|0];return i},"customAlphabet");var Xb=Jc("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",7);var Ii,gN=(Ii=class{constructor(e){U(this,"_state");U(this,"_parentId");this._state=e||{merger:qb(),contentCounter:new Kc}}get __internal_isClosed(){return this._state.merger.isSealed()}__internal_getReadable(){return this._state.merger.readable}__internal_subscribeToClose(e){this._state.closeSubscriber=e}_addPart(e,r){this._state.append&&(this._state.append.controller.close(),this._state.append=void 0),this.enqueue({type:"part-start",part:e,path:[]}),this._state.merger.addStream(r.pipeThrough(new Hb(this._state.contentCounter.value)))}merge(e){this._state.merger.addStream(e.pipeThrough(new Vb(this._state.contentCounter)))}appendText(e){this._state.append?.kind!=="text"&&(this._state.append={kind:"text",controller:this.addTextPart()}),this._state.append.controller.append(e)}appendReasoning(e){this._state.append?.kind!=="reasoning"&&(this._state.append={kind:"reasoning",controller:this.addReasoningPart()}),this._state.append.controller.append(e)}addTextPart(){let[e,r]=Cd();return this._addPart({type:"text"},e),r}addReasoningPart(){let[e,r]=Cd();return this._addPart({type:"reasoning"},e),r}addToolCallPart(e){let r=typeof e=="string"?{toolName:e}:e,i=r.toolName,n=r.toolCallId??Xb(),[s,o]=zb();return this._addPart({type:"tool-call",toolName:i,toolCallId:n,...this._parentId&&{parentId:this._parentId}},s),r.argsText!==void 0&&(o.argsText.append(r.argsText),o.argsText.close()),r.args!==void 0&&(o.argsText.append(JSON.stringify(r.args)),o.argsText.close()),r.response!==void 0&&o.setResponse(r.response),o}appendSource(e){this._addPart({...e,...this._parentId&&{parentId:this._parentId}},new ReadableStream({start(r){r.enqueue({type:"part-finish",path:[]}),r.close()}}))}appendFile(e){this._addPart(e,new ReadableStream({start(r){r.enqueue({type:"part-finish",path:[]}),r.close()}}))}enqueue(e){this._state.merger.enqueue(e),e.type==="part-start"&&e.path.length===0&&this._state.contentCounter.up()}withParentId(e){let r=new Ii(this._state);return r._parentId=e,r}close(){this._state.append?.controller?.close(),this._state.merger.seal(),this._state.closeSubscriber?.()}},l(Ii,"_AssistantStreamControllerImpl"),Ii);function bN(t){let e=new gN;return l(async()=>{try{await t(e)}catch(i){throw e.__internal_isClosed||e.enqueue({type:"error",path:[],error:String(i)}),i}finally{e.__internal_isClosed||e.close()}},"runTask")(),e.__internal_getReadable()}l(bN,"createAssistantStream");function Kb(){let{resolve:t,promise:e}=Gc(),r;return[bN(n=>(r=n,r.__internal_subscribeToClose(t),e)),r]}l(Kb,"createAssistantStreamController");var zn,Dd=(zn=class extends Jb{constructor(){super(e=>{let r=new Gb({transform(i,n){n.appendText(i)}});return e.pipeThrough(new TextDecoderStream).pipeThrough(r)})}},l(zn,"PlainTextDecoder"),zn);var Hn,Yb=(Hn=class{constructor(e){this.cloud=e}__internal_getAssistantOptions(e){return{api:this.cloud._baseUrl+"/v1/runs/stream",headers:l(async()=>{let r=await this.cloud._auth.getAuthHeaders();if(!r)throw new Error("Authorization failed");return{...r,Accept:"text/plain"}},"headers"),body:{assistant_id:e,response_format:"vercel-ai-data-stream/v1",thread_id:"unstable_todo"}}}async stream(e){let r=await this.cloud.makeRawRequest("/runs/stream",{method:"POST",headers:{Accept:"text/plain"},body:e});return ca.fromResponse(r,new Dd)}},l(Hn,"AssistantCloudRuns"),Hn);var Vn,Zb=(Vn=class{constructor(e){this.cloud=e}async list(e,r){return this.cloud.makeRequest(`/threads/${encodeURIComponent(e)}/messages`,{query:r})}async create(e,r){return this.cloud.makeRequest(`/threads/${encodeURIComponent(e)}/messages`,{method:"POST",body:r})}},l(Vn,"AssistantCloudThreadMessages"),Vn);var Gn,Qb=(Gn=class{constructor(e){U(this,"messages");this.cloud=e,this.messages=new Zb(e)}async list(e){return this.cloud.makeRequest("/threads",{query:e})}async create(e){return this.cloud.makeRequest("/threads",{method:"POST",body:e})}async update(e,r){return this.cloud.makeRequest(`/threads/${encodeURIComponent(e)}`,{method:"PUT",body:r})}async delete(e){return this.cloud.makeRequest(`/threads/${encodeURIComponent(e)}`,{method:"DELETE"})}},l(Gn,"AssistantCloudThreads"),Gn);var Kn,e0=(Kn=class{constructor(e){this.cloud=e}async pdfToImages(e){return this.cloud.makeRequest("/files/pdf-to-images",{method:"POST",body:e})}async generatePresignedUploadUrl(e){return this.cloud.makeRequest("/files/attachments/generate-presigned-upload-url",{method:"POST",body:e})}},l(Kn,"AssistantCloudFiles"),Kn);var Jn,Id=(Jn=class{constructor(e){U(this,"threads");U(this,"auth");U(this,"runs");U(this,"files");let r=new Lb(e);this.threads=new Qb(r),this.auth={tokens:new jb(r)},this.runs=new Yb(r),this.files=new e0(r)}},l(Jn,"AssistantCloud"),Jn);var $i={toResponse(t,e){return new Response($i.toByteStream(t,e),{headers:e.headers??{}})},fromResponse(t,e){return $i.fromByteStream(t.body,e)},toByteStream(t,e){return t.pipeThrough(e)},fromByteStream(t,e){return t.pipeThrough(e)}};var Xc=l(function(){let t,e,r=new Promise((i,n)=>{t=i,e=n});if(!t||!e)throw new Error("Failed to create promise");return{promise:r,resolve:t,reject:e}},"promiseWithResolvers");var t0=l(()=>{let t=[],e=!1,r,i,n=l(o=>{o.promise||(o.promise=o.reader.read().then(({done:f,value:c})=>{o.promise=void 0,f?(t.splice(t.indexOf(o),1),e&&t.length===0&&r.close()):r.enqueue(c),i?.resolve(),i=void 0}).catch(f=>{console.error(f),t.forEach(c=>{c.reader.cancel()}),t.length=0,r.error(f),i?.reject(f),i=void 0}))},"handlePull");return{readable:new ReadableStream({start(o){r=o},pull(){return i=Xc(),t.forEach(o=>{n(o)}),i.promise},cancel(){t.forEach(o=>{o.reader.cancel()}),t.length=0}}),isSealed(){return e},seal(){e=!0,t.length===0&&r.close()},addStream(o){if(e)throw new Error("Cannot add streams after the run callback has settled.");let f={reader:o.getReader()};t.push(f),n(f)},enqueue(o){this.addStream(new ReadableStream({start(f){f.enqueue(o),f.close()}}))}}},"createMergeStream");var Xn,r0=(Xn=class{constructor(e){U(this,"_controller");U(this,"_isClosed",!1);this._controller=e}append(e){return this._controller.enqueue({type:"text-delta",path:[],textDelta:e}),this}close(){this._isClosed||(this._isClosed=!0,this._controller.enqueue({type:"part-finish",path:[]}),this._controller.close())}},l(Xn,"TextStreamControllerImpl"),Xn),$d=l(t=>new ReadableStream({start(e){return t.start?.(new r0(e))},pull(e){return t.pull?.(new r0(e))},cancel(e){return t.cancel?.(e)}}),"createTextStream"),Bd=l(()=>{let t;return[$d({start(r){t=r}}),t]},"createTextStreamController");var Yn,i0=(Yn=class{constructor(e){U(this,"_isClosed",!1);U(this,"_mergeTask");U(this,"_argsTextController");this._controller=e;let r=$d({start:l(n=>{this._argsTextController=n},"start")}),i=!1;this._mergeTask=r.pipeTo(new WritableStream({write:l(n=>{switch(n.type){case"text-delta":i=!0,this._controller.enqueue(n);break;case"part-finish":i||this._controller.enqueue({type:"text-delta",textDelta:"{}",path:[]}),this._controller.enqueue({type:"tool-call-args-text-finish",path:[]});break;default:throw new Error(`Unexpected chunk type: ${n.type}`)}},"write")}))}get argsText(){return this._argsTextController}async setResponse(e){this._argsTextController.close(),await Promise.resolve(),this._controller.enqueue({type:"result",path:[],...e.artifact!==void 0?{artifact:e.artifact}:{},result:e.result,isError:e.isError??!1})}async close(){this._isClosed||(this._isClosed=!0,this._argsTextController.close(),await this._mergeTask,this._controller.enqueue({type:"part-finish",path:[]}),this._controller.close())}},l(Yn,"ToolCallStreamControllerImpl"),Yn),_N=l(t=>new ReadableStream({start(e){return t.start?.(new i0(e))},pull(e){return t.pull?.(new i0(e))},cancel(e){return t.cancel?.(e)}}),"createToolCallStream"),n0=l(()=>{let t;return[_N({start(r){t=r}}),t]},"createToolCallStreamController");var Zn,Yc=(Zn=class{constructor(){U(this,"value",-1)}up(){return++this.value}},l(Zn,"Counter"),Zn);var Qn,s0=(Qn=class extends TransformStream{constructor(e){super({transform(r,i){i.enqueue({...r,path:[e,...r.path]})}})}},l(Qn,"PathAppendEncoder"),Qn),es,o7=(es=class extends TransformStream{constructor(e){super({transform(r,i){let{path:[n,...s]}=r;if(e!==n)throw new Error(`Path mismatch: expected ${e}, got ${n}`);i.enqueue({...r,path:s})}})}},l(es,"PathAppendDecoder"),es),ts,o0=(ts=class extends TransformStream{constructor(e){let r=new Yc,i=new Map;super({transform(n,s){n.type==="part-start"&&n.path.length===0&&i.set(r.up(),e.up());let[o,...f]=n.path;if(o===void 0){s.enqueue(n);return}let c=i.get(o);if(c===void 0)throw new Error("Path not found");s.enqueue({...n,path:[c,...f]})}})}},l(ts,"PathMergeEncoder"),ts);var rs,a0=(rs=class extends TransformStream{constructor(e,r,i){let[n,s]=la(),o;super({start(f){return o=n.pipeTo(new WritableStream({write(c){f.enqueue(c)},abort(c){f.error(c)},close(){f.terminate()}})).catch(c=>{f.error(c)}),e.start?.(s)},transform(f){return e.transform?.(f,s)},async flush(){await e.flush?.(s),s.close(),await o}},r,i)}},l(rs,"AssistantTransformStream"),rs);var is,Zc=(is=class extends TransformStream{constructor(e){super();let r=e(super.readable);Object.defineProperty(this,"readable",{value:r,writable:!1})}},l(is,"PipeableTransformStream"),is);var he=(t=>(t.TextDelta="0",t.Data="2",t.Error="3",t.Annotation="8",t.ToolCall="9",t.ToolCallResult="a",t.StartToolCall="b",t.ToolCallArgsTextDelta="c",t.FinishMessage="d",t.FinishStep="e",t.StartStep="f",t.ReasoningDelta="g",t.Source="h",t.RedactedReasoning="i",t.ReasoningSignature="j",t.File="k",t.AuiUpdateStateOperations="aui-state",t.AuiTextDelta="aui-text-delta",t.AuiReasoningDelta="aui-reasoning-delta",t))(he||{});var ns,c0=(ns=class extends TransformStream{constructor(){super({transform:l((e,r)=>{r.enqueue(`${e.type}:${JSON.stringify(e.value)}
|
|
105
|
-
`)},"transform")})}},l(ns,"DataStreamChunkEncoder"),ns),ss,SN=(ss=class extends TransformStream{constructor(){super({transform:l((e,r)=>{let i=e.indexOf(":");if(i===-1)throw new Error("Invalid stream part");r.enqueue({type:e.slice(0,i),value:JSON.parse(e.slice(i+1))})},"transform")})}},l(ss,"DataStreamChunkDecoder"),ss);var os,l0=(os=class extends TransformStream{constructor(){let e=[];super({transform(r,i){if(r.type==="part-start"){if(r.path.length!==0){i.error(new Error("Nested parts are not supported"));return}e.push(r.part),i.enqueue(r);return}if(r.type==="text-delta"||r.type==="result"||r.type==="part-finish"||r.type==="tool-call-args-text-finish"){if(r.path.length!==1){i.error(new Error(`${r.type} chunks must have a path of length 1`));return}let n=r.path[0];if(n<0||n>=e.length){i.error(new Error(`Invalid path index: ${n}`));return}let s=e[n];i.enqueue({...r,meta:s});return}i.enqueue(r)}})}},l(os,"AssistantMetaTransformStream"),os);var as,Md=(as=class extends Zc{constructor(){super(r=>{let i=new TransformStream({transform(n,s){let o=n.type;switch(o){case"part-start":{let f=n.part;if(f.type==="tool-call"){let{type:c,...a}=f;s.enqueue({type:he.StartToolCall,value:a})}if(f.type==="source"){let{type:c,...a}=f;s.enqueue({type:he.Source,value:a})}break}case"text-delta":{let f=n.meta;switch(f.type){case"text":{f.parentId?s.enqueue({type:he.AuiTextDelta,value:{textDelta:n.textDelta,parentId:f.parentId}}):s.enqueue({type:he.TextDelta,value:n.textDelta});break}case"reasoning":{f.parentId?s.enqueue({type:he.AuiReasoningDelta,value:{reasoningDelta:n.textDelta,parentId:f.parentId}}):s.enqueue({type:he.ReasoningDelta,value:n.textDelta});break}case"tool-call":{s.enqueue({type:he.ToolCallArgsTextDelta,value:{toolCallId:f.toolCallId,argsTextDelta:n.textDelta}});break}default:throw new Error(`Unsupported part type for text-delta: ${f.type}`)}break}case"result":{let f=n.meta;if(f.type!=="tool-call")throw new Error(`Result chunk on non-tool-call part not supported: ${f.type}`);s.enqueue({type:he.ToolCallResult,value:{toolCallId:f.toolCallId,result:n.result,artifact:n.artifact,...n.isError?{isError:n.isError}:{}}});break}case"step-start":{let{type:f,...c}=n;s.enqueue({type:he.StartStep,value:c});break}case"step-finish":{let{type:f,...c}=n;s.enqueue({type:he.FinishStep,value:c});break}case"message-finish":{let{type:f,...c}=n;s.enqueue({type:he.FinishMessage,value:c});break}case"error":{s.enqueue({type:he.Error,value:n.error});break}case"annotations":{s.enqueue({type:he.Annotation,value:n.annotations});break}case"data":{s.enqueue({type:he.Data,value:n.data});break}case"update-state":{s.enqueue({type:he.AuiUpdateStateOperations,value:n.operations});break}case"tool-call-args-text-finish":case"part-finish":break;default:{let f=o;throw new Error(`Unsupported chunk type: ${f}`)}}}});return r.pipeThrough(new l0).pipeThrough(i).pipeThrough(new c0).pipeThrough(new TextEncoderStream)});U(this,"headers",new Headers({"Content-Type":"text/plain; charset=utf-8","x-vercel-ai-data-stream":"v1"}))}},l(as,"DataStreamEncoder"),as),E7=[he.StartToolCall,he.ToolCall,he.TextDelta,he.ReasoningDelta,he.Source,he.Error,he.FinishStep,he.FinishMessage,he.AuiTextDelta,he.AuiReasoningDelta];var f0=Jc("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",7);var Bi,vN=(Bi=class{constructor(e){U(this,"_state");U(this,"_parentId");this._state=e||{merger:t0(),contentCounter:new Yc}}get __internal_isClosed(){return this._state.merger.isSealed()}__internal_getReadable(){return this._state.merger.readable}__internal_subscribeToClose(e){this._state.closeSubscriber=e}_addPart(e,r){this._state.append&&(this._state.append.controller.close(),this._state.append=void 0),this.enqueue({type:"part-start",part:e,path:[]}),this._state.merger.addStream(r.pipeThrough(new s0(this._state.contentCounter.value)))}merge(e){this._state.merger.addStream(e.pipeThrough(new o0(this._state.contentCounter)))}appendText(e){this._state.append?.kind!=="text"&&(this._state.append={kind:"text",controller:this.addTextPart()}),this._state.append.controller.append(e)}appendReasoning(e){this._state.append?.kind!=="reasoning"&&(this._state.append={kind:"reasoning",controller:this.addReasoningPart()}),this._state.append.controller.append(e)}addTextPart(){let[e,r]=Bd();return this._addPart({type:"text"},e),r}addReasoningPart(){let[e,r]=Bd();return this._addPart({type:"reasoning"},e),r}addToolCallPart(e){let r=typeof e=="string"?{toolName:e}:e,i=r.toolName,n=r.toolCallId??f0(),[s,o]=n0();return this._addPart({type:"tool-call",toolName:i,toolCallId:n,...this._parentId&&{parentId:this._parentId}},s),r.argsText!==void 0&&(o.argsText.append(r.argsText),o.argsText.close()),r.args!==void 0&&(o.argsText.append(JSON.stringify(r.args)),o.argsText.close()),r.response!==void 0&&o.setResponse(r.response),o}appendSource(e){this._addPart({...e,...this._parentId&&{parentId:this._parentId}},new ReadableStream({start(r){r.enqueue({type:"part-finish",path:[]}),r.close()}}))}appendFile(e){this._addPart(e,new ReadableStream({start(r){r.enqueue({type:"part-finish",path:[]}),r.close()}}))}enqueue(e){this._state.merger.enqueue(e),e.type==="part-start"&&e.path.length===0&&this._state.contentCounter.up()}withParentId(e){let r=new Bi(this._state);return r._parentId=e,r}close(){this._state.append?.controller?.close(),this._state.merger.seal(),this._state.closeSubscriber?.()}},l(Bi,"_AssistantStreamControllerImpl"),Bi);function u0(t){let e=new vN;return l(async()=>{try{await t(e)}catch(i){throw e.__internal_isClosed||e.enqueue({type:"error",path:[],error:String(i)}),i}finally{e.__internal_isClosed||e.close()}},"runTask")(),e.__internal_getReadable()}l(u0,"createAssistantStream");function la(){let{resolve:t,promise:e}=Xc(),r;return[u0(n=>(r=n,r.__internal_subscribeToClose(t),e)),r]}l(la,"createAssistantStreamController");var cs,Ld=(cs=class extends Zc{constructor(){super(e=>{let r=new a0({transform(i,n){n.appendText(i)}});return e.pipeThrough(new TextDecoderStream).pipeThrough(r)})}},l(cs,"PlainTextDecoder"),cs);var bA=le(rl(),1),Rh=le(Sa(),1),vA=le(rl(),1),EA=le(rl(),1),Oh=le(Sa(),1),kg=le(xe(),1),xh=le(Sa(),1),vr=le(xe(),1),yn=le(xe(),1),RA=le(xe(),1),vh=le(xe(),1),dt=le(xe(),1);import*as bh from"path";import*as bn from"path";import*as TA from"path";import*as Rg from"path";var oA=le(eR(),1);function J4(t){let e=[t];return{next(){return Promise.resolve({done:e.length===0,value:e.pop()})},return(){return e=[],{}},[Symbol.asyncIterator](){return this}}}l(J4,"fromValue");function X4(t){return t[Symbol.asyncIterator]?t[Symbol.asyncIterator]():t[Symbol.iterator]?t[Symbol.iterator]():t.next?t:J4(t)}l(X4,"getIterator");async function aA(t,e){let r=X4(t);for(;;){let{value:i,done:n}=await r.next();if(i&&await e(i),n)break}r.return&&r.return()}l(aA,"forAwait");function Y4(t){let{PassThrough:e}=sA(),r=new e;return setTimeout(async()=>{await aA(t,i=>r.write(i)),r.end()},1),r}l(Y4,"asyncIteratorToStream");async function Z4(t){let e=0,r=[];await aA(t,s=>{r.push(s),e+=s.byteLength});let i=new Uint8Array(e),n=0;for(let s of r)i.set(s,n),n+=s.byteLength;return i}l(Z4,"collect");function Q4(t){let e=Object.getOwnPropertyDescriptor(t,Symbol.asyncIterator);if(e&&e.enumerable)return t;let r=!1,i=[],n={};return t.on("data",s=>{i.push(s),n.resolve&&(n.resolve({value:i.shift(),done:!1}),n={})}),t.on("error",s=>{n.reject&&(n.reject(s),n={})}),t.on("end",()=>{r=!0,n.resolve&&(n.resolve({done:!0}),n={})}),{next(){return new Promise((s,o)=>{if(i.length===0&&r)return s({done:!0});if(i.length>0)return s({value:i.shift(),done:!1});i.length===0&&!r&&(n={resolve:s,reject:o})})},return(){t.removeAllListeners(),t.destroy&&t.destroy()},[Symbol.asyncIterator](){return this}}}l(Q4,"fromNodeStream");async function ez({onProgress:t,url:e,method:r="GET",headers:i={},agent:n,body:s}){return s&&Array.isArray(s)?s=Buffer.from(await Z4(s)):s&&(s=Y4(s)),new Promise((o,f)=>{(0,oA.default)({url:e,method:r,headers:i,agent:n,body:s},(c,a)=>{if(c)return f(c);try{let u=Q4(a);o({url:a.url,method:a.method,statusCode:a.statusCode,statusMessage:a.statusMessage,body:u,headers:a.headers})}catch(u){f(u)}})})}l(ez,"request");var tz={request:ez},yh=tz;var st=le(xe(),1),Ti=le(Sa(),1),Og=le(xe(),1),ce=le(xe(),1),Ag=le(xe(),1),To=le(xe(),1),_h=le(xe(),1),Sh=le(xe(),1),ir=le(xe(),1),Pg=le(xe(),1),qr=le(xe(),1),zA=le(xe(),1),Fh=le(xe(),1),gn=le(xe(),1);import*as JA from"path";var uA=Object.defineProperty,rz=l((t,e,r)=>e in t?uA(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,"Et"),b=l((t,e)=>uA(t,"name",{value:e,configurable:!0}),"n"),W=l((t,e,r)=>rz(t,typeof e!="symbol"?e+"":e,r),"y"),Ro,hA=(Ro=class{constructor(e,r){W(this,"entries",[]),W(this,"currentIndex",0),W(this,"closed",!1),W(this,"compositFs"),W(this,"dirPath"),W(this,"initialized",!1),this.compositFs=e,this.dirPath=r}async initialize(){if(this.initialized)return;let e=new Set;for(let r of[...this.compositFs.filterLayers].reverse())if(r.readDirFiltering)e=new Set(await r.readDirFiltering(this.dirPath,Array.from(e)));else{let i=await r.readdir(this.dirPath);for(let n of i)e.add(n)}this.initialized=!0}async*[Symbol.asyncIterator](){for(await this.initialize();this.currentIndex<this.entries.length&&!this.closed;){let e=this.entries[this.currentIndex++];try{let r=await this.compositFs.stat(e.path);yield{name:e.name,isFile:b(()=>r.isFile(),"isFile"),isDirectory:b(()=>r.isDirectory(),"isDirectory"),isBlockDevice:b(()=>r.isBlockDevice(),"isBlockDevice"),isCharacterDevice:b(()=>r.isCharacterDevice(),"isCharacterDevice"),isSymbolicLink:b(()=>r.isSymbolicLink(),"isSymbolicLink"),isFIFO:b(()=>r.isFIFO(),"isFIFO"),isSocket:b(()=>r.isSocket(),"isSocket")}}catch(r){console.debug(`Failed to stat ${e.path}:`,r)}}}async read(){if(this.closed)throw new Error("Directory handle is closed");if(await this.initialize(),this.currentIndex>=this.entries.length)return null;let e=this.entries[this.currentIndex++];try{let r=await this.compositFs.stat(e.path);return{name:e.name,isFile:b(()=>r.isFile(),"isFile"),isDirectory:b(()=>r.isDirectory(),"isDirectory"),isBlockDevice:b(()=>r.isBlockDevice(),"isBlockDevice"),isCharacterDevice:b(()=>r.isCharacterDevice(),"isCharacterDevice"),isSymbolicLink:b(()=>r.isSymbolicLink(),"isSymbolicLink"),isFIFO:b(()=>r.isFIFO(),"isFIFO"),isSocket:b(()=>r.isSocket(),"isSocket")}}catch{return this.read()}}async close(){this.closed=!0,this.entries=[]}get path(){return this.dirPath}},l(Ro,"Fe"),Ro);b(hA,"CompositeFsDir");var Ng=hA;function dA(t){let e=t.split("/").filter(Boolean),r=[],i=[],n=!1,s;for(let o of e)if(o.startsWith("[[")&&o.endsWith("]]")){let f=o.slice(2,-2).replace(/^\.\.\./,"");if(r.push(f),o.startsWith("[[..."))n=!0,i.push("(/.*)*"),s=f;else throw new Error("Optional single-segment parameters [[param]] are not supported. Use [[...param]] for catch-all or [param] for required single segment.")}else if(o.startsWith("[")&&o.endsWith("]")){if(o.startsWith("[..."))throw new Error("Required catch-all parameters [...param] are not supported. Use [[...param]] instead.");{let f=o.slice(1,-1);r.push(f),i.push("/([^\\/]+)")}}else o==="."?n=!0:i.push("/"+o.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"));return{regexStr:i.join("")+"$",paramNames:r,folderRoute:n,pathParameter:s}}l(dA,"At");b(dA,"compilePattern");function gh(t){if(t===".")return 1;let e=t.split("/").filter(Boolean),r=Math.pow(2,e.length);for(let i=0;i<e.length;i++){let n=e[i],s;n.startsWith("[[...")?s=10:n.startsWith("[[")?s=50:n.startsWith("[")?s=100:s=1e3+n.length;let o=Math.pow(.9,i);r+=s*o}return r}l(gh,"ge");b(gh,"calculatePriority");function pA(t){if(typeof t.name!="string")return"folder";let e=t;return e.fsType==="folder"?"folder":e.fsType==="file"?"file":"readdir"in e&&typeof e.readdir=="function"?"folder":"file"}l(pA,"Lt");b(pA,"getNodeType");function mA(t){let e=[];function r(i,n){if(typeof i.name=="string"){e.push({pattern:n||".",handler:i,priority:gh(n||"."),staticBaseChildren:[]});return}let s=i,o=[],f=Object.keys(s).filter(c=>c.startsWith("[[")||c===".");if(f.length>1)throw new Error(`Expected exactly one folder handler for ${n||"/"} expected but multuple found: ${f.join(", ")}`);if(f.length===0)throw new Error(`No folder handler for ${n||"/"} founds`);for(let[c,a]of Object.entries(s)){let u=n?`${n}/${c}`:c;if(c==="."){if(typeof a.name!="string")throw new Error(`Folder root '.' at path '${n}' must be a handler, not a folder`);if(a.fsType!=="folder"&&a.fsType!=="fs")throw new Error(`Folder root handler '.' at path '${n}' must be of type 'folder' or 'fs'`);e.push({pattern:n+"/.",handler:a,priority:gh(n),staticBaseChildren:o})}else if(c.startsWith("[["))if(c.startsWith("[[..."))if(typeof a.name=="string"){if(e.push({pattern:u,handler:a,priority:gh(u),staticBaseChildren:o}),a.fsType!=="folder"&&a.fsType!=="fs")throw new Error(`Folder root handler '.' at path '${n}' must be of type 'folder' or 'fs'`)}else r(a,u);else r(a,u);else if(c.startsWith("[")){if(c.startsWith("[..."))throw new Error(`Required catch-all '${c}' is not supported. Use '[[...${c.slice(5,-1)}]]' instead`);r(a,u)}else o.push({segment:c,type:pA(a)}),r(a,u)}}return l(r,"e"),b(r,"walk"),r(t,""),e}l(mA,"Ht");b(mA,"flattenRoutes");var Oo,wA=(Oo=class{constructor(e,r){this.routes=e,this.rootPath=r,W(this,"compiledRoutes");let i=mA(e);this.compiledRoutes=i.map(n=>{let{regexStr:s,paramNames:o,folderRoute:f,pathParameter:c}=dA(n.pattern);return{regex:new RegExp(s),paramNames:o,staticBaseChildren:n.staticBaseChildren,handler:n.handler,priority:n.priority,pattern:n.pattern,folderRoute:f,pathParameter:c}})}match(e){let r=e;r.startsWith(this.rootPath+"/")?r=r.slice(this.rootPath.length+1):r.startsWith(this.rootPath)&&(r=r.slice(this.rootPath.length)),r.startsWith("/")||(r="/"+r),r.length>1&&r.endsWith("/")&&(r=r.slice(0,-1));let i,n={},s=-1,o=this.compiledRoutes,f=[];for(let a of o){let u=r.match(a.regex);if(u)f.push(a);else continue;if(!(!u||a.priority<=s)){n={};for(let h=0;h<a.paramNames.length;h++){let d=u[h+1]||"";d.startsWith("/")&&(d=d.slice(1)),n[a.paramNames[h]]=decodeURIComponent(d)}s=a.priority,i=a}}if(!i||i.handler===void 0)return;let c=[];return i.folderRoute&&(i.pathParameter?n[i.pathParameter]===""&&(c=i.staticBaseChildren.map(a=>({segment:a.segment,type:a.type}))):c=i.staticBaseChildren.map(a=>({segment:a.segment,type:a.type}))),{handler:i.handler,matchingPattern:i.pattern,params:n,staticSiblings:c}}},l(Oo,"ye"),Oo);b(wA,"PathRouter");var iz=wA;function Ee(t){return typeof t=="string"?t:Buffer.isBuffer(t)?t.toString():String(t)}l(Ee,"B");b(Ee,"pathToString");var xo,yA=(xo=class{constructor({name:e,rootPath:r}){W(this,"compositeFs"),W(this,"context"),W(this,"newContext"),W(this,"fsType","fs"),W(this,"rootInstanceId"),W(this,"name"),W(this,"rootPath"),this.name=e,this.rootPath=r,this.rootInstanceId=`${e}-${Date.now()}-${Math.random().toString(36).substr(2,9)}`}attach(e){this.compositeFs=e}withContext(e){let r=Object.create(Object.getPrototypeOf(this));return Object.assign(r,this),r.context=e,r}async open(e,r,i){throw new Error(`open not implemented for: ${Ee(e)}`)}async access(e,r){throw new Error(`access not implemented for: ${Ee(e)}`)}async stat(e,r){throw new Error(`lstat not implemented for: ${Ee(e)}`)}async lstat(e,r){throw new Error(`lstat not implemented for: ${Ee(e)}`)}async opendir(e,r){throw new Error(`opendir not implemented for: ${Ee(e)}`)}async link(e,r){throw new Error(`link not implemented for: ${Ee(e)}`)}async mkdir(e,r){throw new Error(`mkdir not implemented for: ${Ee(e)}`)}async readdir(e,r){throw new Error(`readdir not implemented for: ${Ee(e)}`)}async readlink(e,...r){throw new Error(`readlink not implemented for: ${Ee(e)}`)}async unlink(e){throw new Error(`unlink not implemented for: ${Ee(e)}`)}async rename(e,r){throw new Error(`rename not implemented for: ${Ee(e)}`)}async rmdir(e,...r){throw new Error(`rmdir not implemented for: ${Ee(e)}`)}async symlink(e,r,i){throw new Error(`symlink not implemented for: ${Ee(r)}`)}async lookup(e){throw new Error(`lookup not implemented for: ${Ee(e)}`)}resolvePath(e){throw new Error(`resolvePath not implemented for fd: ${e}`)}async close(e){this.compositeFs.close(e)}async dataSync(e){throw new Error(`dataSync not implemented for: ${e.subFsFileDescriptor}`)}async read(e,r,i,n,s){throw new Error(`read not implemented for: ${e.subFsFileDescriptor}`)}async appendFile(e,r,i){throw new Error(`appendFile not implemented for: ${e.subFsFileDescriptor}`)}async fchmod(e,r){throw new Error(`fchmod not implemented for: ${e.subFsFileDescriptor}`)}async fchown(e,r,i){throw new Error(`fchown not implemented for: ${e.subFsFileDescriptor}`)}async ftruncate(e,r){throw new Error(`ftruncate not implemented for: ${e.subFsFileDescriptor}`)}async fstat(e,r){throw new Error(`fstat not implemented for: ${e.subFsFileDescriptor}`)}async futimes(e,r,i){throw new Error(`futimes not implemented for: ${e.subFsFileDescriptor}`)}async write(e,r,i,n,s){throw new Error(`write not implemented for: ${e.subFsFileDescriptor}`)}async writev(e,r,i){throw new Error(`writev not implemented for: ${e.subFsFileDescriptor}`)}async readv(e,r,i){throw new Error(`readv not implemented for: ${e.subFsFileDescriptor}`)}async readFile(e,r){throw new Error(`readFile not implemented for: ${e}`)}async writeFile(e,r,i){throw new Error(`writeFile not implemented for: ${e}`)}},l(xo,"we"),xo);b(yA,"BaseCompositeSubFs");var vn=yA,Ao,gA=(Ao=class{constructor({name:e,filterLayers:r,routes:i,rootPath:n}){W(this,"promises"),W(this,"filterLayers",[]),W(this,"router"),W(this,"parentFs"),W(this,"name"),W(this,"rootPath"),W(this,"pathToFileDescriptors",new Map),W(this,"openFileHandles",new Map),W(this,"logOperation"),this.name=e,this.rootPath=n;for(let s of r)this.filterLayers.push(s),s.attach(this);this.router=new iz(i,this.rootPath),this.promises={access:this.access.bind(this),opendir:this.opendir.bind(this),mkdir:this.mkdir.bind(this),readdir:this.readdir.bind(this),open:this.open.bind(this),stat:this.stat.bind(this),lstat:this.lstat.bind(this),link:this.link.bind(this),readlink:this.readlink.bind(this),unlink:this.unlink.bind(this),rename:this.rename.bind(this),rmdir:this.rmdir.bind(this),symlink:this.symlink.bind(this),readFile:this.readFile.bind(this),writeFile:this.writeFile.bind(this),getFilehandle:this.getFilehandle.bind(this)}}getNextFileDescriptor(){let e=Array.from(this.openFileHandles.keys());return e.length===0?1:Math.max(...e)+1}setLoggger(e){this.logOperation=e}async logOperationOnFileDescsriptor(e,r,i){if(!this.logOperation)return;let n=[];for(let[s,o]of this.pathToFileDescriptors.entries())o.includes(e.fd)&&n.push(s);if(n.length!==0)return this.logOperation?.({fsName:e.delegate.name,fd:e,path:n[0],operation:r,operationArgs:i})}getFilehandle(e){return this.openFileHandles.get(e)}async getResponsibleFs(e){let r=e.toString();for(let s of this.filterLayers)if(await s.responsible(r)){if(s.withContext!==void 0)return s.withContext({fullPath:r,params:{},staticSiblings:[]});throw new Error(`Filter layer filesystem ${s.name} is not a BaseCompositeSubFs`)}let i=this.router.match(r);if(!i)throw new Error(`No route match for: ${r}`);let n=i.handler;return n.attach(this),n.withContext({fullPath:r,params:i.params,staticSiblings:i.staticSiblings})}async access(e,r){let i=await this.getResponsibleFs(e);return await this.logOperation?.({fsName:i.name,path:e,operation:"access",operationArgs:{mode:r}}),i.access(e,r)}async stat(e,r){let i=e.toString(),n=await this.getResponsibleFs(e);return await this.logOperation?.({fsName:n.name,path:i,operation:"stat",operationArgs:{opts:r}}),n.stat(e)}async lstat(e,r){let i=await this.getResponsibleFs(e);return await this.logOperation?.({fsName:i.name,path:e.toString(),operation:"lstat",operationArgs:{opts:r}}),i.lstat(e,r)}async unlink(e){let r=await this.getResponsibleFs(e);return await this.logOperation?.({fsName:r.name,path:e.toString(),operation:"unlink",operationArgs:{}}),r.unlink(e)}async mkdir(e,r){let i=await this.getResponsibleFs(e);return await this.logOperation?.({fsName:i.name,path:e.toString(),operation:"mkdir",operationArgs:{options:r}}),i.mkdir(e,r)}async rmdir(e,r){let i=await this.getResponsibleFs(e);return await this.logOperation?.({fsName:i.name,path:e.toString(),operation:"rmdir",operationArgs:{dirPath:e,options:r}}),i.rmdir(e,r)}async opendir(e,r){await this.logOperation?.({fsName:this.name,path:e.toString(),operation:"opendir",operationArgs:{options:r}});let i=e.toString();return new Ng(this,i)}async readdir(e,r){await this.logOperation?.({fsName:this.name,path:e.toString(),operation:"readdir",operationArgs:{options:r}});let i=new Set,n=this.router.match(e.toString());if(n?.handler instanceof vn){let s=n?.handler.withContext({fullPath:e.toString(),params:n.params,staticSiblings:n.staticSiblings});s.attach(this),i=new Set(await s.readdir(e,r))}for(let s of[...this.filterLayers].reverse())if(s.readDirFiltering)i=new Set(await s.readDirFiltering(e,Array.from(i)));else{let o=await s.readdir(e,r);for(let f of o)i.add(f)}return Array.from(i)}async open(e,r,i){let n=await this.getResponsibleFs(e);await this.logOperation?.({fsName:n.name,path:e,operation:"open",operationArgs:{flags:r,mode:i}});let s=await n.open(e,r,i),o=this.getNextFileDescriptor();return s.realize(o),this.openFileHandles.set(o,s),this.pathToFileDescriptors.get(e)||this.pathToFileDescriptors.set(e,[]),this.pathToFileDescriptors.get(e).push(o),s}async close(e){try{await e.delegate.close(e)}catch(r){throw r}finally{for(let[r,i]of this.pathToFileDescriptors.entries()){let n=i.indexOf(e.fd);if(n!==-1){i.splice(n,1),i.length===0&&this.pathToFileDescriptors.delete(r);break}}this.openFileHandles.delete(e.fd)}}async link(e,r){throw new Error("not implemented")}async readlink(e,r){throw new Error("not implemented")}async rename(e,r){let i=await this.getResponsibleFs(e),n=await this.getResponsibleFs(r);if(i.rootInstanceId===n.rootInstanceId)return await this.logOperation?.({fsName:i.name,path:e.toString(),operation:"rename",operationArgs:{oldPath:e,newPath:r}}),i.newContext=n.context,i.rename(e,r);let s=await i.open(e.toString(),"r");try{let o=await i.fstat(s),f=Buffer.alloc(o.size);await i.read(s,f,0,o.size,0),await i.close(s),await n.writeFile(r.toString(),f,"utf8"),await i.unlink(e)}catch(o){try{await i.close(s)}catch{}throw o}}async symlink(e,r,i){throw new Error("not implemented")}async readFile(e,r){await this.logOperation?.({fsName:this.name,path:e.toString(),operation:"readFile",operationArgs:{path:e,options:r}});let i=!0,n;if(typeof e=="number"){i=!1;let s=this.getFilehandle(e);if(!s)throw new Error("Invalid file descriptor");n=s}else if(typeof e=="string")n=await this.open(e,"r");else throw new Error("only filehandle and path are supported atm");try{let s=(await n.stat()).size;if(typeof s=="bigint"){if(s>BigInt(Number.MAX_SAFE_INTEGER))throw new Error("File too large to read into buffer");s=Number(s)}let o=Buffer.alloc(s),{bytesRead:f}=await n.read(o,0,s,0);if(r&&typeof r.encoding=="string")return o.slice(0,f).toString(r.encoding);if(typeof r=="string"){if(r==="utf8"||r==="utf-8")return o.slice(0,f).toString(r);throw new Error("Unsupported encoding: "+r)}return o.slice(0,f)}finally{n&&i&&await n.close()}}async writeFile(e,r,i){await this.logOperation?.({fsName:this.name,path:e.toString(),operation:"writeFile",operationArgs:{data:r,options:i}});let n=typeof e!="number",s,o,f,c="w";if(typeof i=="string"?o=i:i&&typeof i=="object"&&(o=i.encoding,f=i.mode,c=i.flag||"w"),typeof e=="number"){let a=this.getFilehandle(e);if(!a)throw new Error("Invalid file descriptor");s=a}else if(typeof e=="string")s=await this.open(e,c,f);else throw new Error("only filehandle and path are supported atm");try{let a;if(typeof r=="string")a=Buffer.from(r,o||"utf8");else if(r instanceof Buffer)a=r;else if(r instanceof Uint8Array)a=Buffer.from(r);else throw new Error("Invalid data type for writeFile");let u=0;for(;u<a.length;){let{bytesWritten:h}=await s.write(a,u,a.length-u,u);u+=h}}finally{s&&n&&await s.close()}}},l(Ao,"be"),Ao);b(gA,"CompositeFs");var cA=gA,Po,_A=(Po=class extends vn{constructor({name:e,hiddenFiles:r,rootPath:i}){super({name:e,rootPath:i}),W(this,"ig"),this.ig=(0,bA.default)(),this.ig.add(r)}async responsible(e){let r=e.replace(/\\/g,"/"),i=r;if(this.rootPath){let n=this.rootPath;r.startsWith(n+"/")?i=r.slice(n.length+1):r.startsWith(n)&&(i=r.slice(n.length))}return i=i.startsWith("./")?i.slice(2):i,i=i.startsWith("/")?i.slice(1):i,i===""||i==="."?!1:this.ig.ignores(i)}fileType(){return 255}error(e){return new Error(`Access to hidden file is not allowed: ${Ee(e)}`)}async open(e,r,i){throw this.error(e)}async access(e){throw this.error(e)}async stat(e){throw this.error(e)}async lstat(e){throw this.error(e)}async opendir(e){throw this.error(e)}async link(e){throw this.error(e)}async mkdir(e){throw this.error(e)}async readDirFiltering(e,r){let i=[];for(let n of r){let s=Ee(e)!=="/"?Ee(e)+"/"+n:"/"+n;await this.responsible(s)||i.push(n)}return i}async readdir(e){throw this.error(e)}async readlink(e){throw this.error(e)}async unlink(e){throw this.error(e)}async rename(e){throw this.error(e)}async rmdir(e){throw this.error(e)}async symlink(e,r){throw this.error(r)}async lookup(e){throw this.error(e)}resolvePath(e){throw new Error(`Access to hidden file is not allowed: resolvePath(${e})`)}async close(e){throw new Error("Access to hidden file is not allowed: close: "+e.subFsFileDescriptor)}async dataSync(e){throw new Error("Access to hidden file is not allowed: dataSync: "+e.subFsFileDescriptor)}async read(e,r,i,n,s){throw new Error("Access to hidden file is not allowed: readFileHandle: "+e.subFsFileDescriptor)}},l(Po,"Pe"),Po);b(_A,"HiddenFileSubFs");var nz=_A,No,SA=(No=class{constructor(e){W(this,"delegate"),W(this,"compositeFs"),W(this,"_subFsFileDescriptor"),W(this,"handleType","file"),W(this,"_compositFsFileDescriptor",-1),this.delegate=e.fs,this._subFsFileDescriptor=e.subFsFileDescriptor,this._compositFsFileDescriptor=-1,this.compositeFs=e.compositeFs;let r=this._subFsFileDescriptor}get fsType(){return this.delegate.fileType()}get subFsFileDescriptor(){return this._subFsFileDescriptor}get fd(){return this._compositFsFileDescriptor}realize(e){if(this._compositFsFileDescriptor!==-1)throw new Error("was already realized");this._compositFsFileDescriptor=e}readableWebStream(e){throw new Error("Method not implemented.")}async appendFile(e,r){return await this.compositeFs.logOperationOnFileDescsriptor(this,"appendFile",{data:e,options:r}),await this.delegate.appendFile(this,e,r)}async chmod(e){return await this.compositeFs.logOperationOnFileDescsriptor(this,"chmod",{mode:e}),this.delegate.fchmod(this,e)}async chown(e,r){return await this.compositeFs.logOperationOnFileDescsriptor(this,"chown",{uid:e,gid:r}),this.delegate.fchown(this,e,r)}async close(){return await this.compositeFs.logOperationOnFileDescsriptor(this,"close",{}),this.compositeFs.close(this)}async datasync(){return await this.compositeFs.logOperationOnFileDescsriptor(this,"datasync",{}),this.delegate.dataSync(this)}async read(e,r,i,n){return await this.compositeFs.logOperationOnFileDescsriptor(this,"read",{targetBufferLength:e.length,offset:r,length:i,position:n}),await this.delegate.read(this,e,r,i,n)}async readv(e,r){return await this.compositeFs.logOperationOnFileDescsriptor(this,"readv",{buffers:e,position:r}),this.delegate.readv(this,e,r)}async stat(e){return await this.compositeFs.logOperationOnFileDescsriptor(this,"stat",{options:e}),this.delegate.fstat(this,e)}async truncate(e){return await this.compositeFs.logOperationOnFileDescsriptor(this,"truncate",{len:e}),this.delegate.ftruncate(this,e)}async utimes(e,r){return await this.compositeFs.logOperationOnFileDescsriptor(this,"utimes",{atime:e,mtime:r}),this.delegate.futimes(this,e,r)}async write(e,r,i,n){return await this.compositeFs.logOperationOnFileDescsriptor(this,"write",{buffer:e,offset:r,length:i,position:n}),this.delegate.write(this,e,r,i,n)}async writev(e,r){return await this.compositeFs.logOperationOnFileDescsriptor(this,"writev",{buffers:e,position:r}),this.delegate.writev(this,e,r)}async sync(){return await this.compositeFs.logOperationOnFileDescsriptor(this,"sync",{}),this.delegate.dataSync(this)}},l(No,"ve"),No);b(SA,"CompositFsFileHandle");var Mo=SA,Co,sz=(Co=class extends vn{constructor({name:e,rootPath:r,ephemeralPatterns:i}){super({name:e,rootPath:r}),W(this,"openFh",new Map),W(this,"memFs",(0,Rh.createFsFromVolume)(new Rh.Volume)),W(this,"ig"),W(this,"patterns"),this.ig=(0,vA.default)(),this.ig.add(i),this.patterns=i}normalizePath(e){let r=typeof e=="string"?e:e.toString();return r.startsWith("/")?r:"/"+r}async responsible(e){let r=e.replace(/\\/g,"/"),i=r;return this.rootPath&&(r.startsWith(this.rootPath+"/")?i=r.slice(this.rootPath.length+1):r.startsWith(this.rootPath)&&(i=r.slice(this.rootPath.length))),i=i.startsWith("./")?i.slice(2):i,i=i.startsWith("/")?i.slice(1):i,i===""||i==="."?!1:this.ig.ignores(i)}fileType(){return 5}async open(e,r,i){let n=this.normalizePath(e),s=bh.dirname(n);s&&s!=="/"&&s!=="."&&await this.memFs.promises.mkdir(s,{recursive:!0});let o=await this.memFs.promises.open(n,r,i);return this.openFh.set(o.fd,o),new Mo({fs:this,compositeFs:this.compositeFs,subFsFileDescriptor:o.fd,parentFsFileDescriptors:[o.fd]})}async access(e,r){let i=this.normalizePath(e);return await this.memFs.promises.access(i,r)}async stat(e,r){let i=this.normalizePath(e);return this.memFs.promises.stat(i,{bigint:!1})}async lstat(e,r){let i=this.normalizePath(e);return this.memFs.promises.lstat(i,{bigint:!1})}async opendir(e,r){let i=this.normalizePath(e);return await this.memFs.promises.opendir(i,r)}async link(e,r){let i=this.normalizePath(e),n=this.normalizePath(r);return await this.memFs.promises.link(i,n)}async mkdir(e,r){let i=this.normalizePath(e);if(!(typeof r=="object"&&r&&"recursive"in r&&r.recursive)){let n=bh.dirname(i);if(n&&n!=="/"&&n!==".")try{await this.memFs.promises.stat(n)}catch{await this.memFs.promises.mkdir(n,{recursive:!0})}}await this.memFs.promises.mkdir(i,r)}async readdir(e,...r){let i=this.normalizePath(e),n=await this.memFs.promises.readdir(i,...r);return console.log("EPHEMERAL: READDIR: ",n),n}async readlink(e){throw new Error("readlink is not implemented for EphemeralFileSubFs")}async unlink(e){let r=this.normalizePath(e);return await this.memFs.promises.unlink(r)}async rename(e,r){let i=this.normalizePath(e),n=this.normalizePath(r);return await this.memFs.promises.rename(i,n)}async rmdir(e,r){let i=this.normalizePath(e);return await this.memFs.promises.rmdir(i,r)}async symlink(e,r,i){let n=this.normalizePath(e),s=this.normalizePath(r);return await this.memFs.promises.symlink(n,s,i)}async lookup(e){throw new Error(`lookup is not implemented for: ${Ee(e)}`)}async close(e){let r=this.openFh.get(e.subFsFileDescriptor);r&&(await r.close(),this.openFh.delete(e.subFsFileDescriptor))}async dataSync(e){let r=this.openFh.get(e.subFsFileDescriptor);if(r)return await r.datasync()}async read(e,r,i,n,s){let o=this.openFh.get(e.subFsFileDescriptor);if(o)return await o.read(r,i,n,s);throw new Error(`File handle not found: ${e.subFsFileDescriptor}`)}async fchmod(e,r){let i=this.openFh.get(e.subFsFileDescriptor);if(i)return await i.chmod(r)}async fchown(e,r,i){let n=this.openFh.get(e.subFsFileDescriptor);if(n)return await n.chown(r,i)}async write(e,r,i,n,s){let o=this.openFh.get(e.subFsFileDescriptor);if(o)return await o.write(r,i,n,s);throw new Error(`File handle not found: ${e.subFsFileDescriptor}`)}async ftruncate(e,r){let i=this.openFh.get(e.subFsFileDescriptor);if(i)return await i.truncate(r)}resolvePath(e){throw new Error(`resolvePath is not implemented: resolvePath(${e})`)}async fstat(e,r){let i=this.openFh.get(e.subFsFileDescriptor);if(i)return await i.stat(r);throw new Error(`File handle not found: ${e.subFsFileDescriptor}`)}async futimes(e,r,i){let n=this.openFh.get(e.subFsFileDescriptor);if(n)return await n.utimes(r,i)}async writev(e,r,i){let n=this.openFh.get(e.subFsFileDescriptor);if(n)return await n.writev(r,i??void 0);throw new Error(`File handle not found: ${e.subFsFileDescriptor}`)}async readv(e,r,i){let n=this.openFh.get(e.subFsFileDescriptor);if(n)return await n.readv(r,i??void 0);throw new Error(`File handle not found: ${e.subFsFileDescriptor}`)}async readFile(e,r){if(typeof e=="string"||Buffer.isBuffer(e)){let i=this.normalizePath(e);return this.memFs.promises.readFile(i,r)}return super.readFile(e,r)}async writeFile(e,r,i){let n=this.normalizePath(e),s=bh.dirname(n);return s&&s!=="/"&&s!=="."&&await this.memFs.promises.mkdir(s,{recursive:!0}),this.memFs.promises.writeFile(n,r,i)}},l(Co,"ke"),Co);b(sz,"EphemeralSubFs");var Do,FA=(Do=class extends vn{constructor({name:e,sourceFs:r,copyToFs:i,copyToRootPath:n,rootPath:s,patterns:o}){super({rootPath:s,name:e}),W(this,"openFh",new Map),W(this,"sourceFs"),W(this,"copyToFs"),W(this,"copyPath"),W(this,"ig"),W(this,"patterns"),this.sourceFs=r,this.copyToFs=i,this.copyPath=n,this.patterns=o,this.ig=(0,EA.default)(),this.ig.add(o)}normalizeCopyPath(e){let r=typeof e=="string"?e:e.toString(),i=r.startsWith("/")?r:"/"+r;return bn.join(this.copyPath,i)}normalizePath(e){let r=typeof e=="string"?e:e.toString();return r.startsWith("/")?r:"/"+r}async responsible(e){let r=e.replace(/\\/g,"/"),i=r;if(this.compositeFs.rootPath){let n=this.compositeFs.rootPath;r.startsWith(n+"/")?i=r.slice(n.length+1):r.startsWith(n)&&(i=r.slice(n.length))}return i=i.startsWith("./")?i.slice(2):i,i=i.startsWith("/")?i.slice(1):i,i===""||i==="."?!1:this.ig.ignores(i)}fileType(){return 6}async isCopied(e){let r=this.normalizeCopyPath(e);try{return await this.copyToFs.promises.access(r),!0}catch{return!1}}async copyFromSource(e){let r=this.normalizeCopyPath(e),i=this.normalizePath(e),n=bn.dirname(r);n&&n!=="/"&&n!=="."&&await this.copyToFs.promises.mkdir(n,{recursive:!0});try{let s=await this.sourceFs.promises.readFile(i);await this.copyToFs.promises.writeFile(r,s)}catch(s){if(s.code!=="ENOENT")throw s}}async open(e,r,i){let n=this.normalizePath(e),s=this.normalizeCopyPath(e);if(r.includes("w")||r.includes("a")||r.includes("+")){let o=bn.dirname(s);if(o&&o!=="/"&&o!=="."&&await this.copyToFs.promises.mkdir(o,{recursive:!0}),!await this.isCopied(e))try{await this.sourceFs.promises.access(n),await this.copyFromSource(e)}catch{}let f=await this.copyToFs.promises.open(s,r,i);return this.openFh.set(f.fd,f),new Mo({fs:this,compositeFs:this.compositeFs,subFsFileDescriptor:f.fd,parentFsFileDescriptors:[f.fd]})}else{let o=await this.isCopied(e),f=o?this.copyToFs:this.sourceFs,c=o?s:n,a=await f.promises.open(c,r,i);return this.openFh.set(a.fd,a),new Mo({fs:this,compositeFs:this.compositeFs,subFsFileDescriptor:a.fd,parentFsFileDescriptors:[a.fd]})}}async access(e,r){let i=this.normalizePath(e),n=this.normalizeCopyPath(e);try{await this.copyToFs.promises.access(n,r);return}catch{return await this.sourceFs.promises.access(i,r)}}async stat(e,r){let i=this.normalizePath(e),n=this.normalizeCopyPath(e);try{return await this.copyToFs.promises.stat(n,{bigint:r?.bigint??!1})}catch{return this.sourceFs.promises.stat(i,{bigint:r?.bigint??!1})}}async lstat(e,r){let i=this.normalizePath(e),n=this.normalizeCopyPath(e);try{return await this.copyToFs.promises.lstat(n,{bigint:r?.bigint??!1})}catch{return this.sourceFs.promises.lstat(i,{bigint:r?.bigint??!1})}}async opendir(e,r){let i=this.normalizePath(e);return new Ng(this.compositeFs,i)}async link(e,r){let i=this.normalizeCopyPath(e),n=this.normalizeCopyPath(r);return await this.copyToFs.promises.link(i,n)}async mkdir(e,r){let i=this.normalizeCopyPath(e);if(!(typeof r=="object"&&r&&"recursive"in r&&r.recursive)){let n=bn.dirname(i);if(n&&n!=="/"&&n!==".")try{await this.copyToFs.promises.stat(n)}catch{await this.copyToFs.promises.mkdir(n,{recursive:!0})}}await this.copyToFs.promises.mkdir(i,r)}async readdir(e,...r){let i=this.normalizePath(e),n=this.normalizeCopyPath(e),s=new Set,o=new Set;try{let f=await this.sourceFs.promises.readdir(i,...r);Array.isArray(f)&&f.forEach(c=>s.add(typeof c=="string"?c:c.name))}catch(f){if(f.code!=="ENOENT")throw f}try{let f=await this.copyToFs.promises.readdir(n,...r);Array.isArray(f)&&f.forEach(c=>o.add(typeof c=="string"?c:c.name))}catch(f){if(f.code!=="ENOENT")throw f}return Array.from(new Set([...s,...o]))}async readlink(e){throw new Error("readlink is not implemented for CopyOnWriteSubFs")}async unlink(e){let r=this.normalizeCopyPath(e);return await this.copyToFs.promises.unlink(r)}async rename(e,r){let i=this.normalizeCopyPath(e),n=this.normalizeCopyPath(r);return await this.copyToFs.promises.rename(i,n)}async rmdir(e,r){let i=this.normalizeCopyPath(e);return await this.copyToFs.promises.rmdir(i,r)}async symlink(e,r,i){let n=this.normalizeCopyPath(e),s=this.normalizeCopyPath(r);return await this.copyToFs.promises.symlink(n,s,i)}async lookup(e){throw new Error(`lookup is not implemented for: ${Ee(e)}`)}resolvePath(e){throw new Error(`resolvePath is not implemented: resolvePath(${e})`)}async close(e){let r=this.openFh.get(e.subFsFileDescriptor);r&&(await r.close(),this.openFh.delete(e.subFsFileDescriptor))}async dataSync(e){let r=this.openFh.get(e.subFsFileDescriptor);if(r)return await r.datasync()}async read(e,r,i,n,s){let o=this.openFh.get(e.subFsFileDescriptor);if(o)return await o.read(r,i,n,s);throw new Error(`File handle not found: ${e.subFsFileDescriptor}`)}async fchmod(e,r){let i=this.openFh.get(e.subFsFileDescriptor);if(i)return await i.chmod(r)}async fchown(e,r,i){let n=this.openFh.get(e.subFsFileDescriptor);if(n)return await n.chown(r,i)}async write(e,r,i,n,s){let o=this.openFh.get(e.subFsFileDescriptor);if(o)return await o.write(r,i,n,s);throw new Error(`File handle not found: ${e.subFsFileDescriptor}`)}async ftruncate(e,r){let i=this.openFh.get(e.subFsFileDescriptor);if(i)return await i.truncate(r)}async fstat(e,r){let i=this.openFh.get(e.subFsFileDescriptor);if(i)return await i.stat(r);throw new Error(`File handle not found: ${e.subFsFileDescriptor}`)}async futimes(e,r,i){let n=this.openFh.get(e.subFsFileDescriptor);if(n)return await n.utimes(r,i)}async writev(e,r,i){let n=this.openFh.get(e.subFsFileDescriptor);if(n)return await n.writev(r,i??void 0);throw new Error(`File handle not found: ${e.subFsFileDescriptor}`)}async readv(e,r,i){let n=this.openFh.get(e.subFsFileDescriptor);if(n)return await n.readv(r,i??void 0);throw new Error(`File handle not found: ${e.subFsFileDescriptor}`)}async readFile(e,r){if(typeof e!="string"&&!Buffer.isBuffer(e))return super.readFile(e,r);let i=this.normalizePath(e),n=this.normalizeCopyPath(e);try{return await this.copyToFs.promises.readFile(n,r)}catch{return this.sourceFs.promises.readFile(i,r)}}async writeFile(e,r,i){let n=this.normalizeCopyPath(e);await this.isCopied(e)||await this.copyFromSource(e);let s=bn.dirname(n);s&&s!=="/"&&s!=="."&&await this.copyToFs.promises.mkdir(s,{recursive:!0}),await this.copyToFs.promises.writeFile(n,r,i)}},l(Do,"Se"),Do);b(FA,"CopyOnWriteSubFs");var lA=FA,Io,oz=(Io=class extends vn{constructor({name:e,parentFs:r,rootPath:i}){if(super({name:e,rootPath:i}),W(this,"openFh",new Map),W(this,"memFs",(0,Oh.createFsFromVolume)(new Oh.Volume)),W(this,"targetFs"),this.compositeFs=r,this.compositeFs.parentFs===void 0)throw new Error("PassThroughSubFs not allowed in root fs");this.targetFs=this.compositeFs.parentFs}async responsible(e){return!0}fileType(){return 4}async open(e,r,i){let n=TA.dirname(e),s=await this.targetFs.promises.open(e,r,i);return this.openFh.set(s.fd,s),new Mo({fs:this,compositeFs:this.compositeFs,subFsFileDescriptor:s.fd,parentFsFileDescriptors:[s.fd]})}async access(e,r){return await this.targetFs.promises.access(e,r)}async stat(e,r){return this.targetFs.promises.stat(e,{bigint:!1})}async lstat(e,r){return this.targetFs.promises.lstat(e,{bigint:!1})}async opendir(e,r){return await this.targetFs.promises.opendir(e,r)}async link(e,r){return await this.targetFs.promises.link(e,r)}async mkdir(e,r){let i=typeof e=="string"?e:e.toString();return await this.targetFs.promises.mkdir(i,r)}async readdir(e,...r){return this.targetFs.promises.readdir(e,...r)}async readlink(e,...r){throw new Error("not implemented")}async unlink(e){return await this.targetFs.promises.unlink(e)}async rename(e,r){return await this.targetFs.promises.rename(e,r)}async rmdir(e,r){return await this.targetFs.promises.rmdir(e,r)}async symlink(e,r,i){return await this.targetFs.promises.symlink(e,r,i)}async lookup(e){throw new Error(`lookup is not implemented for: ${Ee(e)}`)}async close(e){let r=this.openFh.get(e.subFsFileDescriptor);r&&(await r.close(),this.openFh.delete(e.subFsFileDescriptor))}async dataSync(e){let r=this.openFh.get(e.subFsFileDescriptor);if(r)return await r.sync()}async read(e,r,i,n,s){let o=this.openFh.get(e.subFsFileDescriptor);if(o)return await o.read(r,i,n,s);throw new Error(`File handle not found: ${e.subFsFileDescriptor}`)}async fchmod(e,r){let i=this.openFh.get(e.subFsFileDescriptor);if(i)return await i.chmod(r)}async fchown(e,r,i){let n=this.openFh.get(e.subFsFileDescriptor);if(n)return await n.chown(r,i)}async write(e,r,i,n,s){let o=this.openFh.get(e.subFsFileDescriptor);if(o)return await o.write(r,i,n,s);throw new Error(`File handle not found: ${e.subFsFileDescriptor}`)}async ftruncate(e,r){let i=this.openFh.get(e.subFsFileDescriptor);if(i)return await i.truncate(r)}resolvePath(e){throw new Error(`resolvePath is not implemented: resolvePath(${e})`)}async fstat(e,r){let i=this.openFh.get(e.subFsFileDescriptor);if(i)return await i.stat(r);throw new Error(`File handle not found: ${e.subFsFileDescriptor}`)}async futimes(e,r,i){let n=this.openFh.get(e.subFsFileDescriptor);if(n)return await n.utimes(r,i)}async writev(e,r,i){let n=this.openFh.get(e.subFsFileDescriptor);if(n)return await n.writev(r,i??void 0);throw new Error(`File handle not found: ${e.subFsFileDescriptor}`)}async readv(e,r,i){let n=this.openFh.get(e.subFsFileDescriptor);if(n)return await n.readv(r,i??void 0);throw new Error(`File handle not found: ${e.subFsFileDescriptor}`)}async readFile(e,r){return typeof e=="string"||Buffer.isBuffer(e)?this.targetFs.readFile(e.toString(),r):super.readFile(e,r)}async writeFile(e,r,i){let n=typeof i=="object"&&i.flag?i.flag:"w",s=await this.targetFs.open(e,n);try{let o;if(typeof r=="string"){let f=typeof i=="object"&&i.encoding?i.encoding:"utf8";o=Buffer.from(r,f)}else Buffer.isBuffer(r)?o=r:o=Buffer.from(r);await s.write(o,0,o.length,0)}finally{await this.targetFs.close(s)}}},l(Io,"De"),Io);b(oz,"PassThroughSubFs");function Sn(t){return t.replace(/\./g,"%2E").replace(/\//g,".")}l(Sn,"R");b(Sn,"encodeBranchNameForVfs");function Ue(t){return t.replace(/\./g,"/").replace(/%2E/g,".")}l(Ue,"O");b(Ue,"decodeBranchNameFromVfs");async function ue(t,e,r,i){try{return await vr.default.resolveRef({fs:t,dir:e,ref:`refs/heads/${Ue(r)}`})}catch{return}}l(ue,"P");b(ue,"tryResolveRef");async function Ur({dir:t,fs:e,treeOid:r,deletePathParts:i,addPathParts:n,addObj:s,addKeepIfEmpty:o,deleteKeepIfNotEmpty:f,keepFilename:c=".keep",gitCache:a}){let[u,...h]=n??[],[d,...p]=i??[],m=[];if(r){let{tree:w}=await vr.default.readTree({fs:e,dir:t,oid:r,cache:a||{}});m=[...w]}if(u===d){let w=u;if(w===void 0)throw new Error("illegal arguement - called with out a path part");if(h.length===0)throw new Error("can not move into it self");if(p.length===0)throw new Error("can not move from it self");let y=m.findIndex(E=>E.path===w),g=(y!==-1?m[y]:void 0)?.oid,_=await Ur({dir:t,fs:e,treeOid:g,addPathParts:h,deletePathParts:p,addObj:s,addKeepIfEmpty:o,deleteKeepIfNotEmpty:f});if(_===void 0)throw new Error("on the same path we expect an update - respectivly a newly created subTreeOid");let F=!1;if(_!==g){F=!0;let E={mode:"040000",path:w,oid:_,type:"tree"};y!==-1?m[y]=E:m.push(E)}if(r==null&&!F)throw new Error("Illegal state - if the currentOid is undefined - a new tree should have been created (an update should have happened)");if(F)return await vr.default.writeTree({fs:e,dir:t,tree:m});if(r===void 0)throw new Error("currentOid should be set - since the sub tree didn't exist and ");return r}else{let w=!1,y;if(d){let g=m.findIndex(F=>F.path===d),_=g!==-1?m[g]:void 0;if(_===void 0)throw new Error("Element doesnt exist in tree");if(p.length>0){if(_&&_.type!=="tree")throw new Error("SubPart of the path for the obj to delete is not a tree");let F=await Ur({dir:t,fs:e,treeOid:_.oid,addPathParts:void 0,deletePathParts:p,addObj:s,addKeepIfEmpty:o,deleteKeepIfNotEmpty:f});if(F===_.oid)throw new Error("in case of a delete we expect a different subtree oid");w=!0,F===void 0?m.splice(g,1):m[g]={mode:"040000",path:d,oid:F,type:"tree"}}else if(w=!0,m.splice(g,1),m.length===0&&o){let F=new Uint8Array(0),E=await vr.default.writeBlob({fs:e,dir:t,blob:F});m.push({mode:"100644",oid:E,path:c,type:"blob"})}y=_}if(u){let g=m.findIndex(F=>F.path===u),_=g!==-1?m[g]:void 0;if(h.length>0){if(_&&_.type!=="tree")throw new Error("SubPart of the path for the obj to add is not a tree");let F=await Ur({dir:t,fs:e,treeOid:_?.oid,addPathParts:h,deletePathParts:void 0,addObj:s,addKeepIfEmpty:o,deleteKeepIfNotEmpty:f});if(F===void 0)throw new Error("in case we add, we expect an update - respectivly a newly created subTreeOid");if(F!==_?.oid){w=!0;let E={mode:"040000",path:u,oid:F,type:"tree"};if(g!==-1)m[g]=E;else if(m.push(E),f&&m.length>1){let R=m.findIndex(P=>P.path===c);R!==-1&&m.splice(R,1)}}}else{if(w=!0,s){let F={mode:s.type==="tree"?"040000":"100644",path:u,oid:s.oid,type:s.type};if(g!==-1)m[g]=F;else{if(f&&m.length>0){let E=m.findIndex(R=>R.path===c);E!==-1&&m.splice(E,1)}m.push(F)}}if(o&&m.length===0){let F=new Uint8Array(0),E=await vr.default.writeBlob({fs:e,dir:t,blob:F});m.push({mode:"100644",oid:E,path:c,type:"blob"})}}}if(m.length===0)return;if(w)return await vr.default.writeTree({fs:e,dir:t,tree:m});if(r===void 0)throw new Error("currentOid should be set - since the sub tree didn't exist and ");return r}}l(Ur,"V");b(Ur,"buildUpdatedTree");async function Cg(t,e,r,i,n=0,s={}){let{tree:o}=await vr.default.readTree({fs:t,dir:e,oid:r,cache:s});if(i.length===n)return{type:"tree",entries:o.map(a=>Fi({parent:i.join("/"),name:a.path,isDir:a.type==="tree"})),oid:r};let f=i[n],c=o.find(a=>a.path===f);if(c){if(i.length===n+1){if(c.type==="blob")return{type:"blob",oid:c.oid};if(c.type==="tree"){let a=await vr.default.readTree({fs:t,dir:e,oid:c.oid,cache:s});return{type:"tree",entries:a.tree.map(u=>Fi({parent:i.join("/"),name:u.path,isDir:u.type==="tree"})),oid:a.oid}}}else if(c.type==="tree")return await Cg(t,e,c.oid,i,n+1,s)}}l(Cg,"qe");b(Cg,"findGitObjectAtPath");async function ko({filePath:t,gitRoot:e,nodeFs:r,commitSha:i,pathParams:n,gitCache:s}){let o=s||{};if(!n.filePath){let c=await vr.default.readTree({fs:r,dir:e,oid:i,cache:o});return{type:"tree",entries:c.tree.map(a=>Fi({parent:t,name:a.path,isDir:a.type==="tree"})),oid:c.oid}}let f=n.filePath?n.filePath.split("/"):[];return await Cg(r,e,i,f,0,o)}l(ko,"G");b(ko,"resolveGitObjAtPath");function Fi(t){return{name:t.name,isFile:b(()=>!t.isDir,"isFile"),isDirectory:b(()=>t.isDir,"isDirectory"),isBlockDevice:b(()=>!0,"isBlockDevice"),isCharacterDevice:b(()=>!1,"isCharacterDevice"),isSymbolicLink:b(()=>!1,"isSymbolicLink"),isFIFO:b(()=>!1,"isFIFO"),isSocket:b(()=>!1,"isSocket"),parentPath:t.parent,path:t.parent}}l(Fi,"$");b(Fi,"toDirEntry");var $o,kA=($o=class extends vn{constructor({name:e,gitStorageFs:r,gitRoot:i,handler:n,rootPath:s}){super({name:e,rootPath:s}),W(this,"memFs"),W(this,"openFh",{}),W(this,"storageFs"),W(this,"gitRoot"),W(this,"handler"),this.handler=n,this.gitRoot=i,this.storageFs=r,this.memFs=(0,xh.createFsFromVolume)(new xh.Volume)}async getAuthor(){let e=await kg.default.getConfig({fs:this.storageFs,dir:this.gitRoot,path:"user.name"}),r=await kg.default.getConfig({fs:this.storageFs,dir:this.gitRoot,path:"user.email"}),i=Math.floor(Date.now()/1e3),n=new Date().getTimezoneOffset();return{name:e,email:r,date:i,timezoneOffset:n}}async responsible(e){return!0}getRouteParams(){return this.context?.params||{}}getStaticSiblings(){return this.context?.staticSiblings||[]}async open(e,r,i){if(this.handler.writeFile===void 0&&(r.includes("w")||r.includes("a")))throw new Error(`Write operations not allowed for ${this.handler.type}`);if(r.includes("x")&&this.handler.type!=="gitBranchFileVirtualFile"&&this.handler.type!=="claudeVirtualSessionFileVirtualFile")throw new Error(`Exclusive operations not allowed for ${this.handler.type}`);let n=await this.getAuthor(),s=this.getRouteParams(),o=await this.handler.getFile({cacheFs:this.memFs,filePath:e,userSpaceFs:this.compositeFs,gitRoot:this.gitRoot,nodeFs:this.storageFs,pathParams:s,author:n}),f=!1;for(let d of Object.values(this.openFh))d.path===e&&(f=!0);if((o||f)&&r.includes("x"))throw Object.assign(new Error(`EEXIST: file already exists, open '${e}'`),{code:"EEXIST",errno:-17,syscall:"open",path:e});if(!o&&!f&&!(r.includes("w")||r.includes("a")))throw Object.assign(new Error(`ENOENT: no such file or directory, open '${e}'`),{code:"ENOENT",errno:-2,syscall:"open",path:e});let c=Rg.dirname(e);if(await this.memFs.promises.mkdir(c,{recursive:!0}),o===void 0&&!r.includes("x")||o&&o.type==="file")try{let d=await this.memFs.promises.access(e)}catch{await this.memFs.promises.writeFile(e,"")}let a=await this.memFs.promises.open(e,r,i),u=a.fd,h=new Mo({fs:this,compositeFs:this.compositeFs,subFsFileDescriptor:u,parentFsFileDescriptors:[]});return this.openFh[u]={path:e,mode:r,fh:a,openSha:o?.oid,readSha:void 0,unflushed:[]},(r.includes("x")||r.includes("w"))&&this.openFh[u].unflushed.push({length:0,start:0}),h}async mkdir(e,r){let i=e.toString(),n=this.getRouteParams(),s=r?{options:r}:{};try{let o=await this.getAuthor();await this.handler.mkdir({cacheFs:this.memFs,filePath:e.toString(),userSpaceFs:this.compositeFs,nodeFs:this.storageFs,gitRoot:this.gitRoot,pathParams:n,...s,author:o});let f=typeof r=="object"?{...r,recursive:!0}:{recursive:!0};await this.memFs.promises.mkdir(e,f);let c=i.split("/"),a="";for(let u=1;u<=c.length;u++){a=c.slice(0,u).join("/");try{if((await this.memFs.promises.stat(a)).isDirectory()){let h=await this.memFs.promises.open(a,"r");this.openFh[h.fd]={path:a,mode:"r",fh:h,openSha:void 0,readSha:void 0,unflushed:[]}}}catch{}}}catch(o){throw o}}async access(e,r){await this.stat(e)}async futimes(e,r,i){let n=this.openFh[e.subFsFileDescriptor];if(!n)throw new Error("Invalid file handle");return await n.fh.utimes(r,i)}async fstat(e,r){let i=this.openFh[e.subFsFileDescriptor];if(!i)throw new Error("Invalid file handle");return this.stat(i.path,r)}async ftruncate(e,r){let i=this.openFh[e.subFsFileDescriptor];if(!i)throw new Error("Invalid file handle");return i.unflushed.push({length:0,start:0}),await i.fh.truncate(r)}async stat(e,r){let i=e.toString(),n=Object.values(this.openFh).find(f=>f.path===i&&f.unflushed.length>0);if(n&&n.unflushed.length>0)return await n.fh.stat(r);let s=this.getRouteParams(),o=await this.getAuthor();return await this.handler.getStats({cacheFs:this.memFs,filePath:i,userSpaceFs:this.compositeFs,gitRoot:this.gitRoot,nodeFs:this.storageFs,pathParams:s,author:o})}async lstat(e,r){return this.stat(e,r)}async readdir(e,r){let i=e.toString(),n=this.getRouteParams(),s=this.getStaticSiblings(),o=await this.getAuthor(),f=await this.handler.getFile({cacheFs:this.memFs,filePath:i,userSpaceFs:this.compositeFs,gitRoot:this.gitRoot,nodeFs:this.storageFs,pathParams:n,author:o});if(f){if(f.type!=="directory")throw new Error("not a folder");let c=Array.from(new Set([...f.content,...s.map(a=>Fi({name:a.segment,parent:i,isDir:a.type==="folder"}))])).sort((a,u)=>a.name.localeCompare(u.name,void 0,{numeric:!0,sensitivity:"base"}));return r?.withFileTypes?c:c.map(a=>a.name)}return[]}async read(e,r,i,n,s){let o=e.subFsFileDescriptor,f=this.openFh[o];if(!f)throw new Error("Invalid file handle");if(f.unflushed.length===0){let c=this.getRouteParams(),a=await this.getAuthor(),u=await this.handler.getFile({cacheFs:this.memFs,filePath:f.path,userSpaceFs:this.compositeFs,gitRoot:this.gitRoot,nodeFs:this.storageFs,pathParams:c,author:a});if(!u?.content)throw new Error("couldnt access content");if(u.type!=="file")throw new Error("not a file");let h=typeof u.content=="string"?Buffer.from(u.content):u.content,d=typeof s=="number"?s:0,p=Math.min(d+n,h.length),m=Math.max(0,p-d);return h.copy(r,i,d,d+m),{bytesRead:m,buffer:r}}return await f.fh.read(r,i,n,s)}async write(e,r,i,n,s){let o=this.openFh[e.subFsFileDescriptor];if(!o)throw new Error("Invalid file handle");let f=o.mode;if(!f.includes("w")&&!f.includes("a")&&!f.includes("+"))throw Object.assign(new Error("EBADF: bad file descriptor, write"),{code:"EBADF",errno:-9,syscall:"write"});if(o.unflushed.length===0){let h=this.getRouteParams(),d=await this.getAuthor(),p=await this.handler.getFile({cacheFs:this.memFs,filePath:o.path,userSpaceFs:this.compositeFs,gitRoot:this.gitRoot,nodeFs:this.storageFs,pathParams:h,author:d});p&&p.oid&&(await this.memFs.promises.writeFile(o.path,p.content),o.readSha=p.oid)}let c=await o.fh.write(r,i,n,s),a=i??0,u=s??0;return o.unflushed.push({start:u,length:n||r.byteLength-a+u}),c}async close(e){let r=e.subFsFileDescriptor,i=this.openFh[r];if(!i)throw new Error("Invalid file handle");try{await this.dataSync(e),await i.fh.close()}finally{delete this.openFh[r]}}async dataSync(e){let r=e.subFsFileDescriptor,i=this.openFh[r];if(!i)throw new Error("Invalid file handle");if(i.unflushed.length>0){if(this.handler.writeFile){let n=await this.memFs.promises.readFile(i.path),s=this.getRouteParams(),o=await this.getAuthor();await this.handler.writeFile({cacheFs:this.memFs,filePath:i.path,userSpaceFs:this.compositeFs,gitRoot:this.gitRoot,nodeFs:this.storageFs,content:n,pathParams:s,author:o})}i.unflushed=[]}}async readFile(e,r){let i=typeof e=="string"?e:Buffer.isBuffer(e)?e.toString():e.fd?`FileHandle(${e.fd})`:e.toString(),n=null;typeof r=="string"?n=r:r&&typeof r=="object"&&r.encoding&&(n=r.encoding);let s=await this.open(i,"r");try{let o=(await this.fstat(s)).size,f=Buffer.alloc(o);return await this.read(s,f,0,o,0),await this.close(s),n?f.toString(n):f}catch(o){try{await this.close(s)}catch{}throw o}}async writeFile(e,r,i){let n="w",s="utf8",o;typeof i=="string"?s=i:i&&typeof i=="object"&&(i.flag&&(n=String(i.flag)),i.encoding&&(s=i.encoding),i.mode&&(o=typeof i.mode=="string"?parseInt(i.mode,8):i.mode));let f=await this.open(e,n,o);try{let c;typeof r=="string"?c=Buffer.from(r,s):Buffer.isBuffer(r)?c=r:r instanceof Uint8Array?c=Buffer.from(r):ArrayBuffer.isView(r)?c=Buffer.from(r.buffer,r.byteOffset,r.byteLength):c=Buffer.from(r),await this.write(f,c,0,c.length,0)}finally{await this.close(f)}}async rename(e,r){let i=e.toString(),n=r.toString();if(!this.handler.rename)throw new Error(`Rename not supported for ${this.handler.type} files`);let s=await this.memFs.promises.access(n).then(()=>!0).catch(()=>!1),o=await this.stat(n).then(()=>!0).catch(()=>!1),f=await this.stat(i).then(()=>!0).catch(()=>!1);if(await this.memFs.promises.access(i).then(()=>!0).catch(()=>!1)){let u=Rg.dirname(n);try{await this.memFs.promises.access(u)}catch{await this.memFs.promises.mkdir(u,{recursive:!0})}await this.memFs.promises.rename(e,r)}let c=this.getRouteParams(),a=await this.getAuthor();await this.handler.rename({cacheFs:this.memFs,filePath:i,userSpaceFs:this.compositeFs,gitRoot:this.gitRoot,nodeFs:this.storageFs,newPath:n,pathParams:c,newPathParams:this.newContext?.params||{},author:a})}async fchmod(e,r){}async unlink(e){let r=e.toString();if(!this.handler.unlink)throw new Error(`Cannot unlink ${this.handler.type} files`);try{let i=this.getRouteParams(),n=await this.getAuthor();await this.handler.unlink({cacheFs:this.memFs,filePath:r,userSpaceFs:this.compositeFs,nodeFs:this.storageFs,gitRoot:this.gitRoot,pathParams:i,author:n})}catch(i){let n=!1;for(let[s,o]of Object.entries(this.openFh))o.path===r&&o.unflushed.length>0&&(n=!0);if(!n)throw i}finally{let i=!1;for(let[n,s]of Object.entries(this.openFh))s.path===r&&(i=!0,await s.fh.close(),delete this.openFh[Number(n)]);i&&await this.memFs.promises.unlink(r)}}async rmdir(e,...r){let i=e.toString();if(!this.handler.rmdir)throw new Error(`Cannot rmdir ${this.handler.type} directories`);let n=this.getRouteParams(),s=await this.getAuthor();await this.handler.rmdir({cacheFs:this.memFs,filePath:i,userSpaceFs:this.compositeFs,nodeFs:this.storageFs,gitRoot:this.gitRoot,pathParams:n,author:s});let o=!1;for(let[f,c]of Object.entries(this.openFh))c.path===i&&(o=!0,await c.fh.close(),delete this.openFh[Number(f)]);o&&await this.memFs.promises.rmdir(i,{recursive:!0})}fileType(){return 10}},l($o,"Te"),$o);b(kA,"CompositeSubFsAdapter");var xt=kA,OA="-operation";async function Wr(t,e,r){let i=(await RA.default.listBranches({fs:t,dir:e})).filter(n=>n.endsWith(Ue(r)+OA))[0];return i?Sn(i):void 0}l(Wr,"x");b(Wr,"resolveOperationBranchName");async function we(t,e){try{let r=await vh.default.getConfig({fs:e,dir:t,path:"user.legit-current-branch"});if(r)return Sn(r)}catch{}try{let r=await vh.default.getConfig({fs:e,dir:t,path:"init.defaultBranch"});return Sn(r)||"main"}catch{return"main"}}l(we,"v");b(we,"getCurrentBranch");async function xA(t,e,r){await vh.default.setConfig({fs:e,dir:t,path:"user.legit-current-branch",value:Ue(r)})}l(xA,"Qe");b(xA,"setCurrentBranch");function AA({gitStorageFs:t,gitRoot:e,rootPath:r}){let i={type:"gitBranchOperationsVirtualFile",rootType:"file",getStats:b(async s=>{let{gitRoot:o,nodeFs:f,pathParams:c}=s;c.branchName===void 0&&(c.branchName=await we(o,f));let a=await Wr(f,o,c.branchName),u,h=!1;if(a)try{u=await yn.default.resolveRef({fs:f,dir:o,ref:a}),h=!0}catch{try{u=await yn.default.resolveRef({fs:f,dir:o,ref:`refs/heads/${a}`}),h=!0}catch{throw new Error(`Base Branch ${c.branchName} for operations does not exis`)}}else try{u=await yn.default.resolveRef({fs:f,dir:o,ref:`refs/heads/${c.branchName}`})}catch{throw new Error(`Base Branch ${c.branchName} for operations does not exis`)}let d=await yn.default.readCommit({fs:f,dir:o,oid:u}),{commit:p}=d,m=p.committer.timestamp*1e3;try{return{mode:420,size:(h?await n.handler.getFile(s):void 0)?.content?.length??0,atimeMs:m,mtimeMs:m,ctimeMs:m,birthtimeMs:m,atime:new Date(m),mtime:new Date(m),ctime:new Date(m),birthtime:new Date(m),isFile:b(()=>!0,"isFile"),isDirectory:b(()=>!1,"isDirectory"),isSymbolicLink:b(()=>!1,"isSymbolicLink"),isBlockDevice:b(()=>!1,"isBlockDevice"),isCharacterDevice:b(()=>!1,"isCharacterDevice"),isSocket:b(()=>!1,"isSocket"),isFIFO:b(()=>!1,"isFIFO"),isFileSync:b(()=>!0,"isFileSync"),isDirectorySync:b(()=>!1,"isDirectorySync"),dev:0,ino:0,nlink:1,uid:0,gid:0,rdev:0,blksize:4096,blocks:0}}catch{throw new Error("ENOENT: no such file or directory, stat operationHistory")}},"getStats"),getFile:b(async s=>{let{gitRoot:o,nodeFs:f,pathParams:c}=s;c.branchName===void 0&&(c.branchName=await we(o,f));let a=await Wr(f,o,c.branchName),u=[];if(a){let p=await yn.default.resolveRef({fs:f,dir:o,ref:`refs/heads/${a}`}),m=!1,w=p;for(;w&&!m;){let y=await yn.default.readCommit({fs:f,dir:o,oid:w});u.push({oid:y.oid,parentOids:y.commit.parent,message:y.commit.message,originBranchOid:"unset"}),w=y.commit.parent&&y.commit.parent.length>0?y.commit.parent[0]:null,y.commit.parent.length===2&&y.commit.parent[0]===y.commit.parent[1]&&(m=!0)}}let h;for(let p=u.length-1;p>=0;p--){let m=u[p];if(h===void 0){if(m.parentOids.length!==2&&m.parentOids[0]!==m.parentOids[1])throw new Error(`Operation commit ${m.oid} does not have two parents as expected`);h=m.parentOids[1]}m.parentOids.length===2&&(h=m.parentOids[1]),m.originBranchOid=h}let d=Buffer.from(JSON.stringify(u,null,2),"utf-8");return{type:"file",content:d,mode:420,size:d.length}},"getFile"),rename:b(async function(s){throw new Error("not implemented")},"rename"),mkdir:b(async function(s){throw new Error("not implemented")},"mkdir")},n=new xt({name:"branch-operations",gitStorageFs:t,gitRoot:e,rootPath:r||e,handler:i});return n}l(AA,"Ye");b(AA,"createBranchOperationsAdapter");var Ei="legit",az=b(({fs:t,gitRepoPath:e,serverUrl:r="https://hub.legitcontrol.com",auth:i,anonymousBranch:n,authHeaderPrefix:s="Bearer "})=>{let o=!1;async function f(y){let g=await i.getMaxAccessTokenForBranch(y);if(!g)throw new Error(`No access token for branch ${y}`);await dt.default.fetch({fs:t,http:yh,dir:e,singleBranch:!0,ref:`${y}`,remote:Ei,url:r,headers:{Authorization:`${s}${g}`}});let _=await dt.default.resolveRef({fs:t,dir:e,ref:`${Ei}/${y}`});await dt.default.writeRef({fs:t,dir:e,ref:`refs/heads/${y}`,value:_})}l(f,"a"),b(f,"loadBranch");let c=[];async function a(){let y=await i.getMaxAccessTokenForBranch("todo");await dt.default.fetch({fs:t,http:yh,dir:e,remote:Ei,url:r,headers:{Authorization:`${s}${y}`}});let g=await dt.default.listBranches({fs:t,dir:e});for(let _ of g){if(_===n)continue;let F=`${Ei}/${_}`,E,R;try{E=await dt.default.resolveRef({fs:t,dir:e,ref:_})}catch(P){console.log(`Could not resolve local ref ${_}:`,P)}try{R=await dt.default.resolveRef({fs:t,dir:e,ref:F})}catch{R=void 0}if(E&&R){if(E!==R){let P=await dt.default.findMergeBase({fs:t,dir:e,oids:[E,R]});if(P[0]!==E&&P[0]!==R){let S=await dt.default.merge({fs:t,dir:e,ours:E,theirs:R,fastForwardOnly:!1,abortOnConflict:!1,author:{name:"Your Name",email:"your.email@example.com"},mergeDriver:b(async({branches:O,contents:v,path:A})=>{let[x,I,M]=v;return console.log(`Merging ${O[0]} with ${O[1]}...`),console.log("merged:"),console.log(v),{cleanMerge:!0,mergedText:M===void 0?I:M}},"mergeDriver")});await dt.default.writeRef({fs:t,dir:e,ref:`refs/heads/${_}`,value:S.oid,force:!0})}P[0]===E?(console.log(`branch ${_} differs - remote ahaed, not behind`),await dt.default.writeRef({fs:t,dir:e,ref:`refs/heads/${_}`,value:R,force:!0})):P[0]===R?(console.log(`branch ${_} differs - local ahead, not behind`),c.push(_)):(console.log(`branch ${_} differs - both changed`),c.push(_))}}else E&&!R&&c.push(_)}}l(a,"c"),b(a,"pull");async function u(y){if((await i.getUser()).type!=="local")for(let g of y){let _=await i.getMaxAccessTokenForBranch(g);await dt.default.push({fs:t,http:yh,dir:e,remote:Ei,url:r,ref:g,headers:{Authorization:`Bearer ${_}`}})}}l(u,"d"),b(u,"push");let h=Promise.resolve();async function d(y){h=h.then(()=>u(y)),await h}l(d,"u"),b(d,"sequentialPush");async function p(){await dt.default.getConfig({fs:t,dir:e,path:`remote.${Ei}.fetch`})||await dt.default.setConfig({fs:t,dir:e,path:`remote.${Ei}.fetch`,value:`+refs/heads/*:refs/remotes/${Ei}/*`});try{await a();let y=[...new Set(c)].filter(g=>g.indexOf(n)===-1);await d(y),c=[]}catch(y){console.error("Error monitoring changes:",y)}finally{o&&setTimeout(p,1e3)}}l(p,"f"),b(p,"pullPushTick");function m(){o=!0,p()}l(m,"p"),b(m,"startSync");function w(){o=!1}return l(w,"w"),b(w,"stopSync"),{start:b(()=>{o||(m(),o=!0)},"start"),stop:b(()=>{w()},"stop"),isRunning:b(()=>o,"isRunning"),loadBranch:f,sequentialPush:d}},"createLegitSyncService"),cz=b((t,e)=>{let r={type:"local",id:"local",name:"Local User",email:"local@legitcontrol.com"};return{getUser:b(async()=>r,"getUser"),signInAnonymously:b(async()=>{r.type="anonymous",r.id=crypto.randomUUID(),r.email=`anonymous-sha1-${r.id}-@legitcontrol.com`},"signInAnonymously"),addAccessToken:b(async i=>{let n=await t.getUserTokens(r.id);n.accessTokens.push(i),await t.setUserTokens(r.id,n)},"addAccessToken"),getMaxAccessTokenForBranch:b(async i=>{let n=await t.getUserTokens(r.id);if(!(n.accessTokens===void 0||n.accessTokens.length===0))return n.accessTokens[0]},"getMaxAccessTokenForBranch")}},"createSessionManager");function PA(t){let e=JSON.stringify(t),r=new TextEncoder().encode(e),i="";return typeof btoa=="function"?i=btoa(String.fromCharCode(...r)):i=Buffer.from(r).toString("base64"),i.replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}l(PA,"tt");b(PA,"encodeConfigJson");function NA(t){let e=t.replace(/-/g,"+").replace(/_/g,"/")+"===".slice((t.length+3)%4),r;typeof atob=="function"?r=atob(e):r=Buffer.from(e,"base64").toString("binary");let i=Uint8Array.from(r,s=>s.charCodeAt(0)),n=new TextDecoder().decode(i);return JSON.parse(n)}l(NA,"rt");b(NA,"decodeConfigJson");var fA="user.legit-tokens";function CA({storageFs:t,gitRoot:e}){return{getUserTokens:b(async r=>{let i=await Og.default.getConfig({fs:t,dir:e,path:fA});return i?NA(i):{accessTokens:[]}},"getUserTokens"),setUserTokens:b(async(r,i)=>await Og.default.setConfig({fs:t,dir:e,path:fA,value:PA(i)}),"setUserTokens")}}l(CA,"ot");b(CA,"createGitConfigTokenStore");var _n,DA=(_n=class extends Error{constructor(e,r){super(e),W(this,"code","ENOENT"),W(this,"path"),this.name="ENOENTError",this.path=r,Object.setPrototypeOf(this,_n.prototype)}},l(_n,"me"),_n);b(DA,"ENOENTError");var xg=DA;function Nc(t){return t&&t.gitCache!==void 0?t.gitCache:t&&t.parentFs?Nc(t.parentFs):{}}l(Nc,"de");b(Nc,"getGitCacheFromFs");function IA({gitStorageFs:t,gitRoot:e,rootPath:r}){return new xt({name:"branch-file",gitStorageFs:t,gitRoot:e,rootPath:r||e,handler:{type:"gitBranchFileVirtualFile",rootType:"folder",getStats:b(async({gitRoot:i,nodeFs:n,filePath:s,cacheFs:o,pathParams:f,userSpaceFs:c})=>{f.branchName===void 0&&(f.branchName=await we(i,n));let a=await ue(n,i,f.branchName);if(!a)throw new xg(`ENOENT: no such file or directory, stat '${s}'`,s);let u=await ko({filePath:s,gitRoot:i,nodeFs:n,commitSha:a,pathParams:f,gitCache:Nc(c)});if(!u)throw new xg(`ENOENT: no such file or directory, stat '${s}'`,s);let h=await ce.default.readCommit({fs:n,dir:i,oid:a}),{commit:d}=h,p=await ce.default.log({fs:n,dir:i,ref:a,filepath:f.filePath,depth:1}),m=d.committer.timestamp*1e3,w=p.length>0?p[0].commit.committer.timestamp*1e3:m;if(u.type==="tree")return{mode:420,size:0,isFile:b(()=>!0,"isFile"),isDirectory:b(()=>!0,"isDirectory"),isSymbolicLink:b(()=>!1,"isSymbolicLink"),isBlockDevice:b(()=>!1,"isBlockDevice"),isCharacterDevice:b(()=>!1,"isCharacterDevice"),isSocket:b(()=>!1,"isSocket"),isFIFO:b(()=>!1,"isFIFO"),isFileSync:b(()=>!0,"isFileSync"),isDirectorySync:b(()=>!1,"isDirectorySync"),dev:0,ino:0,nlink:1,uid:0,gid:0,rdev:0,blksize:4096,blocks:0,atimeMs:w,mtimeMs:w,ctimeMs:w,birthtimeMs:m,atime:new Date(w),mtime:new Date(w),ctime:new Date(w),birthtime:new Date(w)};{let{blob:y}=await ce.default.readBlob({fs:n,dir:i,oid:u.oid});return{mode:420,size:y.length,isFile:b(()=>!0,"isFile"),isDirectory:b(()=>!1,"isDirectory"),isSymbolicLink:b(()=>!1,"isSymbolicLink"),isBlockDevice:b(()=>!1,"isBlockDevice"),isCharacterDevice:b(()=>!1,"isCharacterDevice"),isSocket:b(()=>!1,"isSocket"),isFIFO:b(()=>!1,"isFIFO"),isFileSync:b(()=>!0,"isFileSync"),isDirectorySync:b(()=>!1,"isDirectorySync"),dev:0,ino:0,nlink:1,uid:0,gid:0,rdev:0,blksize:4096,blocks:Math.ceil(y.length/4096),atimeMs:w,mtimeMs:w,ctimeMs:w,birthtimeMs:w,atime:new Date(w),mtime:new Date(w),ctime:new Date(w),birthtime:new Date(w)}}},"getStats"),getFile:b(async({filePath:i,gitRoot:n,nodeFs:s,cacheFs:o,pathParams:f,userSpaceFs:c})=>{f.branchName===void 0&&(f.branchName=await we(n,s));try{let a=await ue(s,n,f.branchName);if(!a){let h=await ce.default.resolveRef({fs:s,dir:n,ref:"HEAD"});if(await ce.default.branch({fs:s,dir:n,ref:f.branchName,object:h}),a=await ue(s,n,f.branchName),!a)throw new Error("Could not create branch for getFile")}let u=await ko({filePath:i,gitRoot:n,nodeFs:s,commitSha:a,pathParams:f,gitCache:Nc(c)});if(!u)return;if(u.type==="blob"){let{blob:h}=await ce.default.readBlob({fs:s,dir:n,oid:u.oid});return{type:"file",content:Buffer.from(h),mode:420,size:h.length,oid:u.oid}}else{let h=[];try{let d=await o.promises.stat(i);if(d&&d.isDirectory()){let p=await o.promises.readdir(i,{withFileTypes:!0});h.push(...p)}}catch{}return{type:"directory",content:Array.from(new Set([...h,...u.entries])).map(d=>({...d,name:d.name.toString(),path:`${i}`,parentPath:`${i}`})),mode:493}}}catch{return}},"getFile"),unlink:b(async({filePath:i,gitRoot:n,nodeFs:s,cacheFs:o,pathParams:f,author:c})=>{if(f.branchName===void 0&&(f.branchName=await we(n,s)),!f.filePath)throw new Error("filePath should be in pathParams");let a=await ue(s,n,f.branchName);if(!a)throw new Error("Invalid branch file path - branch must exist");let u=await ce.default.readTree({fs:s,dir:n,oid:a}),h=await Ur({dir:n,fs:s,treeOid:u.oid,deletePathParts:f.filePath.split("/"),addPathParts:void 0,addObj:void 0,deleteKeepIfNotEmpty:!1,addKeepIfEmpty:!0,keepFilename:".keep"});if(h!==u.oid){let d=await ce.default.commit({fs:s,dir:n,message:`Delete ${f.filePath}`,tree:h,noUpdateBranch:!0,parent:[a],author:c});await ce.default.writeRef({fs:s,dir:n,ref:`refs/heads/${Ue(f.branchName)}`,value:d,force:!0})}},"unlink"),writeFile:b(async({filePath:i,gitRoot:n,nodeFs:s,content:o,cacheFs:f,pathParams:c,author:a})=>{if(c.branchName===void 0&&(c.branchName=await we(n,s)),c.filePath===void 0)throw new Error("filePath should be in pathParams");let u;typeof o=="string"?u=new TextEncoder().encode(o):u=new Uint8Array(o);let h=await ce.default.writeBlob({fs:s,dir:n,blob:u}),d=await ue(s,n,c.branchName);if(!d){let w=await ce.default.resolveRef({fs:s,dir:n,ref:"HEAD"});if(await ce.default.branch({fs:s,dir:n,ref:Ue(c.branchName),object:w}),d=await ue(s,n,c.branchName),!d)throw new Error("Could not create branch for writeFile")}let p=await ce.default.readTree({fs:s,dir:n,oid:d}),m=await Ur({dir:n,fs:s,treeOid:p.oid,deletePathParts:void 0,addPathParts:c.filePath.split("/"),addObj:{type:"blob",oid:h},deleteKeepIfNotEmpty:!0,addKeepIfEmpty:!1,keepFilename:".keep"});if(m!==p.oid){let w=await ce.default.commit({fs:s,dir:n,message:`\u{1F4BE} Change '${c.filePath}'`,tree:m,noUpdateBranch:!0,parent:[d],author:a});await ce.default.writeRef({fs:s,dir:n,ref:`refs/heads/${Ue(c.branchName)}`,value:w,force:!0});let y=await ue(s,n,c.branchName);if(w!==y)throw new Error("Failed to update branch after file deletion")}},"writeFile"),rename:b(async function({filePath:i,newPath:n,gitRoot:s,nodeFs:o,pathParams:f,newPathParams:c,author:a,userSpaceFs:u}){if(f.branchName===void 0&&(f.branchName=await we(s,o)),f.filePath===void 0)throw new Error("filePath should be in pathParams");if(c.branchName===void 0&&(c.branchName=await we(s,o)),c.filePath===void 0)throw new Error("filePath should be in newPathParams");let h=await ue(o,s,f.branchName);if(!h)throw new Error("Invalid branch file path - source branch must exist");let d=await ue(o,s,c.branchName);if(!d){let y=await ce.default.resolveRef({fs:o,dir:s,ref:"HEAD"});if(await ce.default.branch({fs:o,dir:s,ref:Ue(c.branchName),object:y}),d=await ue(o,s,c.branchName),d===void 0)throw new Error("Could not create branch for rename operation")}if(c.branchName!==f.branchName)throw new Error("cross branch move not implemented yet");let p=await ko({gitRoot:s,nodeFs:o,commitSha:h,filePath:i,pathParams:f,gitCache:Nc(u)});if(p===void 0)throw new Error("no obj at path exists");let m=await Ur({dir:s,fs:o,deletePathParts:f.filePath.split("/"),addPathParts:c.filePath.split("/"),addObj:p.type==="blob"?{type:"blob",oid:p.oid}:{type:"tree",oid:p.oid,entries:p.entries.map(y=>y.name.toString())},treeOid:d,addKeepIfEmpty:!0,deleteKeepIfNotEmpty:!0}),w=await ce.default.readTree({fs:o,dir:s,oid:h});if(m!==w.oid){let y=await ce.default.commit({fs:o,dir:s,message:`\u{1F500} Rename '${f.filePath}' to '${c.filePath}'`,tree:m,noUpdateBranch:!0,parent:[d],author:a});await ce.default.writeRef({fs:o,dir:s,ref:`refs/heads/${Ue(c.branchName)}`,value:y,force:!0})}},"rename"),mkdir:b(async function(i){i.pathParams.branchName===void 0&&(i.pathParams.branchName=await we(i.gitRoot,i.nodeFs));let n=await ue(i.nodeFs,i.gitRoot,i.pathParams.branchName);if(i.pathParams.filePath===""&&(i.pathParams.filePath="/",n!==void 0))throw new Error("Folder exists");try{throw await this.getStats(i),new Error("Folder exists")}catch{}if(i.filePath.endsWith("/")&&(i.filePath=i.filePath.replace(/\/+$/,"")),i.pathParams&&typeof i.pathParams.filePath=="string"&&(i.pathParams.filePath=i.pathParams.filePath.replace(/\/+$/,"")),!n){let a=await ce.default.resolveRef({fs:i.nodeFs,dir:i.gitRoot,ref:"HEAD"});if(await ce.default.branch({fs:i.nodeFs,dir:i.gitRoot,ref:Ue(i.pathParams.branchName),object:a}),n=await ue(i.nodeFs,i.gitRoot,i.pathParams.branchName),n===void 0)throw new Error("Could not create branch for mkdir operation")}let s=await ce.default.readTree({fs:i.nodeFs,dir:i.gitRoot,oid:n}),o=new Uint8Array(0),f=await ce.default.writeBlob({fs:i.nodeFs,dir:i.gitRoot,blob:o}),c=await Ur({dir:i.gitRoot,fs:i.nodeFs,treeOid:s.oid,deletePathParts:void 0,addPathParts:[...i.pathParams.filePath.split("/"),".keep"],addObj:{type:"blob",oid:f},deleteKeepIfNotEmpty:!0,addKeepIfEmpty:!0,keepFilename:".keep"});if(c!==s.oid){let a=await ce.default.commit({fs:i.nodeFs,dir:i.gitRoot,message:`\u{1F4BE} Change '${i.pathParams.filePath}'`,tree:c,noUpdateBranch:!0,parent:[n],author:i.author});await ce.default.writeRef({fs:i.nodeFs,dir:i.gitRoot,ref:`refs/heads/${Ue(i.pathParams.branchName)}`,value:a,force:!0})}},"mkdir"),rmdir:b(async({filePath:i,gitRoot:n,nodeFs:s,cacheFs:o,pathParams:f,author:c})=>{if(f.branchName===void 0&&(f.branchName=await we(n,s)),!f.filePath)throw new Error("filePath should be in pathParams");let a=await ue(s,n,f.branchName);if(!a)throw new Error("Invalid branch file path - branch must exist");let u=await ce.default.readTree({fs:s,dir:n,oid:a}),h=await Ur({dir:n,fs:s,treeOid:u.oid,deletePathParts:f.filePath.split("/"),addPathParts:void 0,addObj:void 0,deleteKeepIfNotEmpty:!1,addKeepIfEmpty:!0,keepFilename:".keep"});if(h!==u.oid){let d=await ce.default.commit({fs:s,dir:n,message:`Delete ${f.filePath}`,tree:h,noUpdateBranch:!0,parent:[a],author:c});await ce.default.writeRef({fs:s,dir:n,ref:`refs/heads/${Ue(f.branchName)}`,value:d,force:!0})}},"rmdir")}})}l(IA,"nt");b(IA,"createBranchFileAdapter");function $A({gitStorageFs:t,gitRoot:e,rootPath:r}){return new xt({name:"branches-list",gitStorageFs:t,gitRoot:e,rootPath:r||e,handler:{type:"gitBranchesListVirtualFile",rootType:"folder",getStats:b(async({gitRoot:i,nodeFs:n})=>{let s=i+"/.git";try{return await n.promises.stat(s)}catch{throw new Error(`ENOENT: no such file or directory, stat '${s}'`)}},"getStats"),getFile:b(async({gitRoot:i,nodeFs:n,filePath:s})=>{try{let o=await Ag.default.listBranches({fs:n,dir:i}),f=await Promise.all(o.map(async c=>{let a=await Ag.default.resolveRef({fs:n,dir:i,ref:c});return Fi({parent:s,name:Sn(c),isDir:!0})}));return{type:"directory",content:f,mode:493,size:f}}catch(o){throw o}},"getFile"),rename:b(async i=>{throw new Error("not implemented")},"rename"),mkdir:b(async function(i){throw new Error("not implemented")},"mkdir")}})}l($A,"lt");b($A,"createBranchesListAdapter");function Eh(t){return t&&t.gitCache!==void 0?t.gitCache:t&&t.parentFs?Eh(t.parentFs):{}}l(Eh,"Ae");b(Eh,"getGitCacheFromFs");function BA({gitStorageFs:t,gitRoot:e,rootPath:r}){return new xt({name:"branch-head",gitStorageFs:t,gitRoot:e,rootPath:r||e,handler:{type:"gitBranchHeadVirtualFile",rootType:"file",getStats:b(async({gitRoot:i,nodeFs:n,pathParams:s,userSpaceFs:o})=>{s.branchName===void 0&&(s.branchName=await we(i,n));let f=await ue(n,i,s.branchName);if(!f)throw new Error(`Branch ${s.branchName} does not exist in the repository`);let c=await To.default.readCommit({fs:n,dir:i,oid:f,cache:Eh(o)}),{commit:a}=c,u=a.committer.timestamp*1e3;return{mode:420,size:40,isFile:b(()=>!0,"isFile"),isDirectory:b(()=>!1,"isDirectory"),isSymbolicLink:b(()=>!1,"isSymbolicLink"),isBlockDevice:b(()=>!1,"isBlockDevice"),isCharacterDevice:b(()=>!1,"isCharacterDevice"),isSocket:b(()=>!1,"isSocket"),isFIFO:b(()=>!1,"isFIFO"),isFileSync:b(()=>!0,"isFileSync"),isDirectorySync:b(()=>!1,"isDirectorySync"),dev:0,ino:0,nlink:1,uid:0,gid:0,rdev:0,blksize:4096,blocks:Math.ceil(.009765625),atimeMs:u,mtimeMs:u,ctimeMs:u,birthtimeMs:u,atime:new Date(u),mtime:new Date(u),ctime:new Date(u),birthtime:new Date(u)}},"getStats"),getFile:b(async({gitRoot:i,nodeFs:n,pathParams:s,userSpaceFs:o})=>{s.branchName===void 0&&(s.branchName=await we(i,n));try{let f;try{f=await To.default.resolveRef({fs:n,dir:i,ref:s.branchName})}catch{f=await To.default.resolveRef({fs:n,dir:i,ref:`refs/heads/${s.branchName}`})}return{type:"file",content:f+`
|
|
106
|
-
`,mode:420,size:f.length}}catch{return}},"getFile"),writeFile:b(async({filePath:i,gitRoot:n,nodeFs:s,content:o,cacheFs:f,pathParams:c,userSpaceFs:a})=>{c.branchName===void 0&&(c.branchName=await we(n,s));let u=o.toString().trim();try{await To.default.readCommit({fs:s,dir:n,oid:u,cache:Eh(a)})}catch{throw new Error(`Commit ${u} does not exist in the repository`)}await To.default.writeRef({fs:s,dir:n,ref:"refs/heads/"+c.branchName,value:u,force:!0})},"writeFile"),rename(i){throw new Error("not implementsd")},mkdir:b(async function(i){throw new Error("not implemented")},"mkdir")}})}l(BA,"ct");b(BA,"createBranchHeadAdapter");function MA({gitStorageFs:t,gitRoot:e,rootPath:r}){return new xt({name:"legit-virtual-file",gitStorageFs:t,gitRoot:e,rootPath:r||e,handler:{type:"legitVirtualFile",rootType:"folder",getStats:b(async({gitRoot:i,nodeFs:n})=>{let s=i+"/.git";try{return await n.promises.stat(s)}catch{throw new Error(`ENOENT: no such file or directory, stat '${s}'`)}},"getStats"),getFile:b(async({gitRoot:i,nodeFs:n})=>({type:"directory",content:[],mode:493,size:0}),"getFile"),rename(i){throw new Error("not implemented")},mkdir:b(async function(i){throw new Error("not implemented")},"mkdir")}})}l(MA,"mt");b(MA,"createLegitVirtualFileAdapter");function Cc(t){return t&&t.gitCache!==void 0?t.gitCache:t&&t.parentFs?Cc(t.parentFs):{}}l(Cc,"he");b(Cc,"getGitCacheFromFs");function LA({gitStorageFs:t,gitRoot:e,rootPath:r}){return new xt({name:"commit-file",gitStorageFs:t,gitRoot:e,rootPath:r||e,handler:{type:"gitCommitFileVirtualFile",rootType:"file",getStats:b(async({filePath:i,gitRoot:n,nodeFs:s,pathParams:o,userSpaceFs:f})=>{if(!o.sha_1_1_2)throw new Error("sha_1_1_2 should be in pathParams");if(!o.sha1_3__40)throw new Error("sha1_3__40 should be in pathParams");let c=o.sha_1_1_2+o.sha1_3__40,a=await ko({filePath:i,gitRoot:n,nodeFs:s,commitSha:c,pathParams:o,gitCache:Cc(f)});if(!a)throw new xg(`ENOENT: no such file or directory, stat '${i}'`,i);let u=await _h.default.readCommit({fs:s,dir:n,oid:c}),{commit:h}=u,d=h.committer.timestamp*1e3;if(a.type==="tree")return{mode:420,size:0,isFile:b(()=>!0,"isFile"),isDirectory:b(()=>!0,"isDirectory"),isSymbolicLink:b(()=>!1,"isSymbolicLink"),isBlockDevice:b(()=>!1,"isBlockDevice"),isCharacterDevice:b(()=>!1,"isCharacterDevice"),isSocket:b(()=>!1,"isSocket"),isFIFO:b(()=>!1,"isFIFO"),isFileSync:b(()=>!0,"isFileSync"),isDirectorySync:b(()=>!1,"isDirectorySync"),dev:0,ino:0,nlink:1,uid:0,gid:0,rdev:0,blksize:4096,blocks:0,atimeMs:d,mtimeMs:d,ctimeMs:d,birthtimeMs:d,atime:new Date(d),mtime:new Date(d),ctime:new Date(d),birthtime:new Date(d)};{let{blob:p}=await _h.default.readBlob({fs:s,dir:n,oid:a.oid});return{mode:420,size:p.length,isFile:b(()=>!0,"isFile"),isDirectory:b(()=>!1,"isDirectory"),isSymbolicLink:b(()=>!1,"isSymbolicLink"),isBlockDevice:b(()=>!1,"isBlockDevice"),isCharacterDevice:b(()=>!1,"isCharacterDevice"),isSocket:b(()=>!1,"isSocket"),isFIFO:b(()=>!1,"isFIFO"),isFileSync:b(()=>!0,"isFileSync"),isDirectorySync:b(()=>!1,"isDirectorySync"),dev:0,ino:0,nlink:1,uid:0,gid:0,rdev:0,blksize:4096,blocks:Math.ceil(p.length/4096),atimeMs:d,mtimeMs:d,ctimeMs:d,birthtimeMs:d,atime:new Date(d),mtime:new Date(d),ctime:new Date(d),birthtime:new Date(d)}}},"getStats"),getFile:b(async({filePath:i,gitRoot:n,nodeFs:s,pathParams:o,userSpaceFs:f})=>{if(!o.sha_1_1_2)throw new Error("sha_1_1_2 should be in pathParams");if(!o.sha1_3__40)throw new Error("sha1_3__40 should be in pathParams");let c=o.sha_1_1_2+o.sha1_3__40;try{let a=await ko({filePath:i,gitRoot:n,nodeFs:s,commitSha:c,pathParams:o,gitCache:Cc(f)});if(!a)return;if(a.type==="blob"){let{blob:u}=await _h.default.readBlob({fs:s,dir:n,oid:a.oid,cache:Cc(f)});return{type:"file",content:Buffer.from(u),mode:420,size:u.length,oid:a.oid}}else return{type:"directory",content:Array.from(new Set([...a.entries.filter(u=>u.name!==".keep")])).map(u=>({...u,name:u.name.toString(),path:`${i}`,parentPath:`${i}`})),mode:493}}catch{return}},"getFile"),rename(i){throw new Error("not implementsd")},mkdir:b(async function(i){throw new Error("not implemented")},"mkdir")}})}l(LA,"dt");b(LA,"createCommitFileAdapter");function jA({gitStorageFs:t,gitRoot:e,rootPath:r}){return new xt({name:"commit-folder",gitStorageFs:t,gitRoot:e,rootPath:r||e,handler:{type:"gitCommitVirtualFolder",rootType:"folder",getStats:b(async i=>{let n=i.gitRoot+"/.git";try{return await i.nodeFs.promises.stat(n)}catch{throw new Error(`ENOENT: no such file or directory, stat '${n}'`)}},"getStats"),getFile:b(async({filePath:i,gitRoot:n,nodeFs:s,pathParams:o})=>{let f=await Sh.default.listBranches({fs:s,dir:n}),c=new Set,a=new Set;for(let d of f){let p=`refs/heads/${d}`;try{let m=await Sh.default.resolveRef({fs:s,dir:n,ref:p});c.add(m)}catch{}}for(let d of c){let p=await Sh.default.log({fs:s,dir:n,ref:d});for(let m of p)a.add(m.oid)}if(!o.sha_1_1_2){let d=new Set;for(let m of a)if(d.add(m.slice(0,2)),d.size>=256)break;let p=Array.from(d).sort().map(m=>Fi({parent:i,name:m,isDir:!0}));return{type:"directory",content:p,mode:493,size:p}}let u=new Set;for(let d of a)d.startsWith(o.sha_1_1_2)&&u.add(d.slice(2,40));let h=Array.from(u).sort().map(d=>Fi({parent:i,name:d,isDir:!0}));return{type:"directory",content:h,mode:493,size:h.length}},"getFile"),rename(i){throw new Error("not implementsd")},mkdir:b(async function(i){throw new Error("not implemented")},"mkdir")}})}l(jA,"ht");b(jA,"createCommitFolderAdapter");function qA({gitStorageFs:t,gitRoot:e,rootPath:r}){return new xt({name:"branch-operation",gitStorageFs:t,gitRoot:e,rootPath:r||e,handler:{type:"gitBranchOperationVirtualFile",rootType:"file",getStats:b(async i=>{let{gitRoot:n,nodeFs:s,pathParams:o}=i;o.branchName===void 0&&(o.branchName=await we(n,s));let f=await ue(s,n,o.branchName);if(!f)throw new Error(`Base Branch ${o.branchName} for operations does not exis`);let c=await Wr(s,n,o.branchName),a=!1;if(c)try{f=await ir.default.resolveRef({fs:s,dir:n,ref:c}),a=!0}catch{try{f=await ir.default.resolveRef({fs:s,dir:n,ref:`refs/heads/${c}`}),a=!0}catch{}}let u=await ir.default.readCommit({fs:s,dir:n,oid:f}),{commit:h}=u,d=h.committer.timestamp*1e3;try{return{mode:420,size:40,atimeMs:d,mtimeMs:d,ctimeMs:d,birthtimeMs:d,atime:new Date(d),mtime:new Date(d),ctime:new Date(d),birthtime:new Date(d),isFile:b(()=>!0,"isFile"),isDirectory:b(()=>!1,"isDirectory"),isSymbolicLink:b(()=>!1,"isSymbolicLink"),isBlockDevice:b(()=>!1,"isBlockDevice"),isCharacterDevice:b(()=>!1,"isCharacterDevice"),isSocket:b(()=>!1,"isSocket"),isFIFO:b(()=>!1,"isFIFO"),isFileSync:b(()=>!0,"isFileSync"),isDirectorySync:b(()=>!1,"isDirectorySync"),dev:0,ino:0,nlink:1,uid:0,gid:0,rdev:0,blksize:4096,blocks:0}}catch{throw new Error("ENOENT: no such file or directory, stat operationHistory")}},"getStats"),getFile:b(async i=>{let{gitRoot:n,nodeFs:s,pathParams:o}=i;o.branchName===void 0&&(o.branchName=await we(n,s));let f=await Wr(s,n,o.branchName),c,a=!1;if(f){if(c=await ue(s,n,f),a=!0,!c)throw new Error(`Base Branch ${f} for operations does not exis`)}else if(c=await ue(s,n,o.branchName),!c)throw new Error(`Base Branch ${o.branchName} for operations does not exis`);return{type:"file",content:Buffer.from(c),mode:420,size:c.length}},"getFile"),writeFile:b(async({filePath:i,gitRoot:n,nodeFs:s,content:o,cacheFs:f,pathParams:c,author:a})=>{c.branchName===void 0&&(c.branchName=await we(n,s));let u;typeof o=="string"?u=new TextEncoder().encode(o):u=new Uint8Array(o);let h=await ir.default.writeBlob({fs:s,dir:n,blob:u}),d=await ue(s,n,c.branchName);if(!d)throw new Error("Invalid branch file path - branch doesn't exist");let p=await Wr(s,n,c.branchName),m=!1;if(!p){p=c.branchName+OA,await ir.default.branch({fs:s,dir:n,ref:Ue(p),object:d});let E=await ir.default.listBranches({fs:s,dir:n});m=!0}let w=await ue(s,n,p),y=await ir.default.readTree({fs:s,dir:n,oid:d}),g;o instanceof ArrayBuffer?g=Buffer.from(o).toString("utf-8"):typeof o=="string"?g=o:o instanceof Uint8Array?g=Buffer.from(o).toString("utf-8"):g=String(o);let _=!1;if(!m){let E=await ir.default.findMergeBase({fs:s,dir:n,oids:_?[w]:[w,d]});E.length===1&&E[0]===d&&(_=!0)}let F=await ir.default.commit({fs:s,dir:n,message:g,tree:y.oid,noUpdateBranch:!0,author:a,parent:_?m?[d,d]:[w]:[w,d]});await ir.default.writeRef({fs:s,dir:n,ref:`refs/heads/${Ue(p)}`,value:F,force:!0})},"writeFile"),rename:b(async function({filePath:i,newPath:n,gitRoot:s,nodeFs:o,pathParams:f,newPathParams:c}){throw new Error("not implemented")},"rename"),mkdir:b(async function(i){throw new Error("not implemented")},"mkdir")}})}l(qA,"pt");b(qA,"createBranchOperationAdapter");function UA({gitStorageFs:t,gitRoot:e,rootPath:r}){return new xt({name:"branch-history",gitStorageFs:t,gitRoot:e,rootPath:r||e,handler:{type:"gitBranchHistory",rootType:"file",getStats:b(async({gitRoot:i,nodeFs:n,pathParams:s})=>{s.branchName===void 0&&(s.branchName=await we(i,n));let o=await ue(n,i,s.branchName);if(!o)throw new Error(`Branch ${s.branchName} does not exist`);let f=await Pg.default.readCommit({fs:n,dir:i,oid:o}),{commit:c}=f,a=c.committer.timestamp*1e3;return{mode:420,size:1e5,isFile:b(()=>!0,"isFile"),isDirectory:b(()=>!1,"isDirectory"),isSymbolicLink:b(()=>!1,"isSymbolicLink"),isBlockDevice:b(()=>!1,"isBlockDevice"),isCharacterDevice:b(()=>!1,"isCharacterDevice"),isSocket:b(()=>!1,"isSocket"),isFIFO:b(()=>!1,"isFIFO"),isFileSync:b(()=>!0,"isFileSync"),isDirectorySync:b(()=>!1,"isDirectorySync"),dev:0,ino:0,nlink:1,uid:0,gid:0,rdev:0,blksize:4096,blocks:Math.ceil(.009765625),atimeMs:a,mtimeMs:a,ctimeMs:a,birthtimeMs:a,atime:new Date(a),mtime:new Date(a),ctime:new Date(a),birthtime:new Date(a)}},"getStats"),getFile:b(async i=>{let{gitRoot:n,nodeFs:s,pathParams:o}=i,f=o.branchName;f===void 0&&(f=await we(n,s));let c=[];if(f){let u=await ue(s,n,f),h=!1,d=u;for(;d&&!h;){let p=await Pg.default.readCommit({fs:s,dir:n,oid:d});c.push({oid:p.oid,...p.commit}),d=p.commit.parent[0]}}let a=Buffer.from(JSON.stringify(c,null,2),"utf-8");return{type:"file",content:a,mode:420,size:a.length}},"getFile"),rename:b(async i=>{throw new Error("not implemented")},"rename"),mkdir:b(async function(i){throw new Error("not implemented")},"mkdir")}})}l(UA,"ut");b(UA,"createBranchHistoryAdapter");function WA({gitStorageFs:t,gitRoot:e,rootPath:r}){return new xt({name:"branch-operation-head",gitStorageFs:t,gitRoot:e,rootPath:r||e,handler:{type:"gitBranchOperationHeadVirtualFile",rootType:"file",getStats:b(async({gitRoot:i,nodeFs:n,pathParams:s})=>{s.branchName===void 0&&(s.branchName=await we(i,n));let o=await Wr(n,i,s.branchName);if(!o){let h=new Date(0);return{mode:420,size:0,isFile:b(()=>!0,"isFile"),isDirectory:b(()=>!1,"isDirectory"),isSymbolicLink:b(()=>!1,"isSymbolicLink"),isBlockDevice:b(()=>!1,"isBlockDevice"),isCharacterDevice:b(()=>!1,"isCharacterDevice"),isSocket:b(()=>!1,"isSocket"),isFIFO:b(()=>!1,"isFIFO"),isFileSync:b(()=>!0,"isFileSync"),isDirectorySync:b(()=>!1,"isDirectorySync"),dev:0,ino:0,nlink:1,uid:0,gid:0,rdev:0,blksize:4096,blocks:Math.ceil(.009765625),atimeMs:h.getTime(),mtimeMs:h.getTime(),ctimeMs:h.getTime(),birthtimeMs:h.getTime(),atime:h,mtime:h,ctime:h,birthtime:h}}let f;try{f=await qr.default.resolveRef({fs:n,dir:i,ref:o})}catch{f=await qr.default.resolveRef({fs:n,dir:i,ref:`refs/heads/${o}`})}let c=await qr.default.readCommit({fs:n,dir:i,oid:f}),{commit:a}=c,u=a.committer.timestamp*1e3;return{mode:420,size:40,isFile:b(()=>!0,"isFile"),isDirectory:b(()=>!1,"isDirectory"),isSymbolicLink:b(()=>!1,"isSymbolicLink"),isBlockDevice:b(()=>!1,"isBlockDevice"),isCharacterDevice:b(()=>!1,"isCharacterDevice"),isSocket:b(()=>!1,"isSocket"),isFIFO:b(()=>!1,"isFIFO"),isFileSync:b(()=>!0,"isFileSync"),isDirectorySync:b(()=>!1,"isDirectorySync"),dev:0,ino:0,nlink:1,uid:0,gid:0,rdev:0,blksize:4096,blocks:Math.ceil(.009765625),atimeMs:u,mtimeMs:u,ctimeMs:u,birthtimeMs:u,atime:new Date(u),mtime:new Date(u),ctime:new Date(u),birthtime:new Date(u)}},"getStats"),getFile:b(async({gitRoot:i,nodeFs:n,pathParams:s})=>{s.branchName===void 0&&(s.branchName=await we(i,n));let o=await Wr(n,i,s.branchName);if(!o)return{type:"file",content:"",mode:420,size:0};try{let f;try{f=await qr.default.resolveRef({fs:n,dir:i,ref:o})}catch{f=await qr.default.resolveRef({fs:n,dir:i,ref:`refs/heads/${o}`})}return{type:"file",content:f+`
|
|
107
|
-
`,mode:420,size:
|
|
108
|
-
`,mode:420,size:
|
|
109
|
-
`,mode:420,size:2}}catch{return}},"getFile"),writeFile:
|
|
110
|
-
`,mode:420,size:
|
|
111
|
-
`).filter(
|
|
103
|
+
`,"utf8");let o=l[l.length-1].split(" ")[1];await n.writeStashRef(o)}else await t.rm(c)})}u(bO,"_stashDrop");async function A5({fs:t,dir:e,gitdir:r}){return new Dn({fs:t,dir:e,gitdir:r}).readStashReflogs({parsed:!0})}u(A5,"_stashList");async function P5({fs:t,dir:e,gitdir:r}){let i=new Dn({fs:t,dir:e,gitdir:r}),n=[i.refStashPath,i.refLogsStashPath];await Ua(n,async()=>{await Promise.all(n.map(async s=>{if(await t.exists(s))return t.rm(s)}))})}u(P5,"_stashClear");async function N5({fs:t,dir:e,gitdir:r,refIdx:i=0}){await gO({fs:t,dir:e,gitdir:r,refIdx:i}),await bO({fs:t,dir:e,gitdir:r,refIdx:i})}u(N5,"_stashPop");async function _O({fs:t,dir:e,gitdir:r=C(e,".git"),op:i="push",message:n="",refIdx:s=0}){O("fs",t),O("dir",e),O("gitdir",r),O("op",i);let a={push:O5,apply:gO,drop:bO,list:A5,clear:P5,pop:N5,create:R5},l=["apply","drop","pop"];try{let c=new M(t);["refs","logs","logs/refs"].map(h=>C(r,h)).forEach(async h=>{await c.exists(h)||await c.mkdir(h)});let f=a[i];if(f){if(l.includes(i)&&s<0)throw new pr(`stash@${s}`,"number that is in range of [0, num of stash pushed]");return await f({fs:c,dir:e,gitdir:r,message:n,refIdx:s})}throw new Error(`To be implemented: ${i}`)}catch(c){throw c.caller="git.stash",c}}u(_O,"stash");async function vO({fs:t,dir:e,gitdir:r=C(e,".git"),filepath:i,cache:n={}}){try{O("fs",t),O("gitdir",r),O("filepath",i);let s=new M(t);if(await Mi.isIgnored({fs:s,gitdir:r,dir:e,filepath:i}))return"ignored";let l=await D5({fs:s,cache:n,gitdir:r}),c=await SO({fs:s,cache:n,gitdir:r,tree:l,path:i}),o=await Pe.acquire({fs:s,gitdir:r,cache:n},async function(w){for(let g of w)if(g.path===i)return g;return null}),f=await s.lstat(C(e,i)),h=c!==null,d=o!==null,p=f!==null,m=u(async()=>{if(d&&!Gu(o,f))return o.oid;{let w=await s.read(C(e,i)),g=await hO({gitdir:r,type:"blob",object:w});return d&&o.oid===g&&f.size!==-1&&Pe.acquire({fs:s,gitdir:r,cache:n},async function(b){b.insert({filepath:i,stats:f,oid:g})}),g}},"getWorkdirOid");if(!h&&!p&&!d)return"absent";if(!h&&!p&&d)return"*absent";if(!h&&p&&!d)return"*added";if(!h&&p&&d)return await m()===o.oid?"added":"*added";if(h&&!p&&!d)return"deleted";if(h&&!p&&d)return c===o.oid,"*deleted";if(h&&p&&!d)return await m()===c?"*undeleted":"*undeletemodified";if(h&&p&&d){let w=await m();return w===c?w===o.oid?"unmodified":"*unmodified":w===o.oid?"modified":"*modified"}}catch(s){throw s.caller="git.status",s}}u(vO,"status");async function SO({fs:t,cache:e,gitdir:r,tree:i,path:n}){typeof n=="string"&&(n=n.split("/"));let s=n.shift();for(let a of i)if(a.path===s){if(n.length===0)return a.oid;let{type:l,object:c}=await ge({fs:t,cache:e,gitdir:r,oid:a.oid});if(l==="tree"){let o=Rt.from(c);return SO({fs:t,cache:e,gitdir:r,tree:o,path:n})}if(l==="blob")throw new _t(a.oid,l,"blob",n.join("/"))}return null}u(SO,"getOidAtPath");async function D5({fs:t,cache:e,gitdir:r}){let i;try{i=await $.resolve({fs:t,gitdir:r,ref:"HEAD"})}catch(s){if(s instanceof pe)return[]}let{tree:n}=await Wa({fs:t,cache:e,gitdir:r,oid:i});return n}u(D5,"getHeadTree");async function EO({fs:t,dir:e,gitdir:r=C(e,".git"),ref:i="HEAD",filepaths:n=["."],filter:s,cache:a={},ignored:l=!1}){try{O("fs",t),O("gitdir",r),O("ref",i);let c=new M(t);return await Li({fs:c,cache:a,dir:e,gitdir:r,trees:[jt({ref:i}),za(),Cn()],map:u(async function(o,[f,h,d]){if(!f&&!d&&h&&!l&&await Mi.isIgnored({fs:c,dir:e,filepath:o})||!n.some(A=>cx(o,A)))return null;if(s&&!s(o))return;let[p,m,w]=await Promise.all([f&&f.type(),h&&h.type(),d&&d.type()]),g=[p,m,w].includes("blob");if((p==="tree"||p==="special")&&!g)return;if(p==="commit")return null;if((m==="tree"||m==="special")&&!g)return;if(w==="commit")return null;if((w==="tree"||w==="special")&&!g)return;let b=p==="blob"?await f.oid():void 0,_=w==="blob"?await d.oid():void 0,S;p!=="blob"&&m==="blob"&&w!=="blob"?S="42":m==="blob"&&(S=await h.oid());let F=[void 0,b,S,_],k=F.map(A=>F.indexOf(A));return k.shift(),[o,...k]},"map")})}catch(c){throw c.caller="git.statusMatrix",c}}u(EO,"statusMatrix");async function FO({fs:t,dir:e,gitdir:r=C(e,".git"),ref:i,object:n,force:s=!1}){try{O("fs",t),O("gitdir",r),O("ref",i);let a=new M(t);if(i===void 0)throw new Ot("ref");i=i.startsWith("refs/tags/")?i:`refs/tags/${i}`;let l=await $.resolve({fs:a,gitdir:r,ref:n||"HEAD"});if(!s&&await $.exists({fs:a,gitdir:r,ref:i}))throw new dr("tag",i);await $.writeRef({fs:a,gitdir:r,ref:i,value:l})}catch(a){throw a.caller="git.tag",a}}u(FO,"tag");async function kO({fs:t,dir:e,gitdir:r=C(e,".git"),cache:i={},filepath:n,oid:s,mode:a,add:l,remove:c,force:o}){try{O("fs",t),O("gitdir",r),O("filepath",n);let f=new M(t);if(c)return await Pe.acquire({fs:f,gitdir:r,cache:i},async function(d){if(!o){let p=await f.lstat(C(e,n));if(p){if(p.isDirectory())throw new Bi("directory");return}}d.has({filepath:n})&&d.delete({filepath:n})});let h;if(!s){if(h=await f.lstat(C(e,n)),!h)throw new pe(`file at "${n}" on disk and "remove" not set`);if(h.isDirectory())throw new Bi("directory")}return await Pe.acquire({fs:f,gitdir:r,cache:i},async function(d){if(!l&&!d.has({filepath:n}))throw new pe(`file at "${n}" in index and "add" not set`);let p;if(s)p={ctime:new Date(0),mtime:new Date(0),dev:0,ino:0,mode:a,uid:0,gid:0,size:0};else{p=h;let m=p.isSymbolicLink()?await f.readlink(C(e,n)):await f.read(C(e,n));s=await Pt({fs:f,gitdir:r,type:"blob",format:"content",object:m})}return d.insert({filepath:n,oid:s,stats:p}),s})}catch(f){throw f.caller="git.updateIndex",f}}u(kO,"updateIndex$1");function TO(){try{return Hh.version}catch(t){throw t.caller="git.version",t}}u(TO,"version");async function xO({fs:t,dir:e,gitdir:r=C(e,".git"),trees:i,map:n,reduce:s,iterate:a,cache:l={}}){try{return O("fs",t),O("gitdir",r),O("trees",i),await Li({fs:new M(t),cache:l,dir:e,gitdir:r,trees:i,map:n,reduce:s,iterate:a})}catch(c){throw c.caller="git.walk",c}}u(xO,"walk");async function OO({fs:t,dir:e,gitdir:r=C(e,".git"),blob:i}){try{return O("fs",t),O("gitdir",r),O("blob",i),await Pt({fs:new M(t),gitdir:r,type:"blob",object:i,format:"content"})}catch(n){throw n.caller="git.writeBlob",n}}u(OO,"writeBlob");async function RO({fs:t,dir:e,gitdir:r=C(e,".git"),commit:i}){try{return O("fs",t),O("gitdir",r),O("commit",i),await wO({fs:new M(t),gitdir:r,commit:i})}catch(n){throw n.caller="git.writeCommit",n}}u(RO,"writeCommit");async function AO({fs:t,dir:e,gitdir:r=C(e,".git"),type:i,object:n,format:s="parsed",oid:a,encoding:l=void 0}){try{let c=new M(t);if(s==="parsed"){switch(i){case"commit":n=At.from(n).toObject();break;case"tree":n=Rt.from(n).toObject();break;case"blob":n=Buffer.from(n,l);break;case"tag":n=qt.from(n).toObject();break;default:throw new _t(a||"",i,"blob|commit|tag|tree")}s="content"}return a=await Pt({fs:c,gitdir:r,type:i,object:n,oid:a,format:s}),a}catch(c){throw c.caller="git.writeObject",c}}u(AO,"writeObject");async function PO({fs:t,dir:e,gitdir:r=C(e,".git"),ref:i,value:n,force:s=!1,symbolic:a=!1}){try{O("fs",t),O("gitdir",r),O("ref",i),O("value",n);let l=new M(t);if(!nc(i,!0))throw new pr(i,jl.clean(i));if(!s&&await $.exists({fs:l,gitdir:r,ref:i}))throw new dr("ref",i);a?await $.writeSymbolicRef({fs:l,gitdir:r,ref:i,value:n}):(n=await $.resolve({fs:l,gitdir:r,ref:n}),await $.writeRef({fs:l,gitdir:r,ref:i,value:n}))}catch(l){throw l.caller="git.writeRef",l}}u(PO,"writeRef");async function C5({fs:t,gitdir:e,tag:r}){let i=qt.from(r).toObject();return await Pt({fs:t,gitdir:e,type:"tag",object:i,format:"content"})}u(C5,"_writeTag");async function NO({fs:t,dir:e,gitdir:r=C(e,".git"),tag:i}){try{return O("fs",t),O("gitdir",r),O("tag",i),await C5({fs:new M(t),gitdir:r,tag:i})}catch(n){throw n.caller="git.writeTag",n}}u(NO,"writeTag");async function DO({fs:t,dir:e,gitdir:r=C(e,".git"),tree:i}){try{return O("fs",t),O("gitdir",r),O("tree",i),await ac({fs:new M(t),gitdir:r,tree:i})}catch(n){throw n.caller="git.writeTree",n}}u(DO,"writeTree");var I5={Errors:ZT,STAGE:Cn,TREE:jt,WORKDIR:za,add:QT,abortMerge:JT,addNote:nx,addRemote:ax,annotatedTag:ox,branch:lx,checkout:ig,clone:px,commit:mx,getConfig:Ax,getConfigAll:Px,setConfig:mO,currentBranch:wx,deleteBranch:yx,deleteRef:gx,deleteRemote:bx,deleteTag:_x,expandOid:vx,expandRef:Sx,fastForward:kx,fetch:Tx,findMergeBase:xx,findRoot:Rx,getRemoteInfo:Nx,getRemoteInfo2:Cx,hashBlob:Ix,indexPack:$x,init:Bx,isDescendent:Mx,isIgnored:jx,listBranches:qx,listFiles:zx,listNotes:Wx,listRefs:Hx,listRemotes:Vx,listServerRefs:Gx,listTags:Zx,log:Jx,merge:Yx,packObjects:Qx,pull:eO,push:tO,readBlob:nO,readCommit:ag,readNote:sO,readObject:aO,readTag:oO,readTree:lO,remove:cO,removeNote:fO,renameBranch:uO,resetIndex:dO,updateIndex:kO,resolveRef:pO,status:vO,statusMatrix:EO,tag:FO,version:TO,walk:xO,writeBlob:OO,writeCommit:RO,writeObject:AO,writeRef:PO,writeTag:NO,writeTree:DO,stash:_O};L.Errors=ZT;L.STAGE=Cn;L.TREE=jt;L.WORKDIR=za;L.abortMerge=JT;L.add=QT;L.addNote=nx;L.addRemote=ax;L.annotatedTag=ox;L.branch=lx;L.checkout=ig;L.clone=px;L.commit=mx;L.currentBranch=wx;L.default=I5;L.deleteBranch=yx;L.deleteRef=gx;L.deleteRemote=bx;L.deleteTag=_x;L.expandOid=vx;L.expandRef=Sx;L.fastForward=kx;L.fetch=Tx;L.findMergeBase=xx;L.findRoot=Rx;L.getConfig=Ax;L.getConfigAll=Px;L.getRemoteInfo=Nx;L.getRemoteInfo2=Cx;L.hashBlob=Ix;L.indexPack=$x;L.init=Bx;L.isDescendent=Mx;L.isIgnored=jx;L.listBranches=qx;L.listFiles=zx;L.listNotes=Wx;L.listRefs=Hx;L.listRemotes=Vx;L.listServerRefs=Gx;L.listTags=Zx;L.log=Jx;L.merge=Yx;L.packObjects=Qx;L.pull=eO;L.push=tO;L.readBlob=nO;L.readCommit=ag;L.readNote=sO;L.readObject=aO;L.readTag=oO;L.readTree=lO;L.remove=cO;L.removeNote=fO;L.renameBranch=uO;L.resetIndex=dO;L.resolveRef=pO;L.setConfig=mO;L.stash=_O;L.status=vO;L.statusMatrix=EO;L.tag=FO;L.updateIndex=kO;L.version=TO;L.walk=xO;L.writeBlob=OO;L.writeCommit=RO;L.writeObject=AO;L.writeRef=PO;L.writeTag=NO;L.writeTree=DO});var IO=x((zte,CO)=>{CO.exports=function(t,e){var r=[];t.on("data",function(i){r.push(i)}),t.once("end",function(){e&&e(null,Buffer.concat(r)),e=null}),t.once("error",function(i){e&&e(i),e=null})}});var BO=x((Wte,$O)=>{"use strict";var $5=["aborted","complete","headers","httpVersion","httpVersionMinor","httpVersionMajor","method","rawHeaders","rawTrailers","setTimeout","socket","statusCode","statusMessage","trailers","url"];$O.exports=(t,e)=>{if(e._readableState.autoDestroy)throw new Error("The second stream must have the `autoDestroy` option set to `false`");let r=new Set(Object.keys(t).concat($5)),i={};for(let n of r)n in e||(i[n]={get(){let s=t[n];return typeof s=="function"?s.bind(t):s},set(s){t[n]=s},enumerable:!0,configurable:!1});return Object.defineProperties(e,i),t.once("aborted",()=>{e.destroy(),e.emit("aborted")}),t.once("close",()=>{t.complete&&e.readable?e.once("end",()=>{e.emit("close")}):e.emit("close")}),e}});var MO=x((Hte,LO)=>{"use strict";var{Transform:B5,PassThrough:L5}=ne("stream"),Fg=ne("zlib"),M5=BO();LO.exports=t=>{let e=(t.headers["content-encoding"]||"").toLowerCase();if(!["gzip","deflate","br"].includes(e))return t;let r=e==="br";if(r&&typeof Fg.createBrotliDecompress!="function")return t.destroy(new Error("Brotli is not supported on Node.js < 12")),t;let i=!0,n=new B5({transform(l,c,o){i=!1,o(null,l)},flush(l){l()}}),s=new L5({autoDestroy:!1,destroy(l,c){t.destroy(),c(l)}}),a=r?Fg.createBrotliDecompress():Fg.createUnzip();return a.once("error",l=>{if(i&&!t.readable){s.end();return}s.destroy(l)}),M5(t,s),t.pipe(n).pipe(a).pipe(s),s}});var UO=x((Vte,qO)=>{qO.exports=jO;function jO(t,e){if(t&&e)return jO(t)(e);if(typeof t!="function")throw new TypeError("need wrapper function");return Object.keys(t).forEach(function(i){r[i]=t[i]}),r;function r(){for(var i=new Array(arguments.length),n=0;n<i.length;n++)i[n]=arguments[n];var s=t.apply(this,i),a=i[i.length-1];return typeof s=="function"&&s!==a&&Object.keys(a).forEach(function(l){s[l]=a[l]}),s}u(r,"wrapper")}u(jO,"wrappy")});var HO=x((Zte,kg)=>{var zO=UO();kg.exports=zO(Vh);kg.exports.strict=zO(WO);Vh.proto=Vh(function(){Object.defineProperty(Function.prototype,"once",{value:u(function(){return Vh(this)},"value"),configurable:!0}),Object.defineProperty(Function.prototype,"onceStrict",{value:u(function(){return WO(this)},"value"),configurable:!0})});function Vh(t){var e=u(function(){return e.called?e.value:(e.called=!0,e.value=t.apply(this,arguments))},"f");return e.called=!1,e}u(Vh,"once");function WO(t){var e=u(function(){if(e.called)throw new Error(e.onceError);return e.called=!0,e.value=t.apply(this,arguments)},"f"),r=t.name||"Function wrapped with `once`";return e.onceError=r+" shouldn't be called more than once",e.called=!1,e}u(WO,"onceStrict")});var KO=x((Jte,ZO)=>{ZO.exports=Ha;var j5=IO(),VO=MO(),q5=ne("http"),U5=ne("https"),z5=HO(),W5=ne("querystring"),GO=ne("url"),Tg=u(t=>t!==null&&typeof t=="object"&&typeof t.pipe=="function","isStream");function Ha(t,e){if(t=Object.assign({maxRedirects:10},typeof t=="string"?{url:t}:t),e=z5(e),t.url){let{hostname:l,port:c,protocol:o,auth:f,path:h}=GO.parse(t.url);delete t.url,!l&&!c&&!o&&!f?t.path=h:Object.assign(t,{hostname:l,port:c,protocol:o,auth:f,path:h})}let r={"accept-encoding":"gzip, deflate"};t.headers&&Object.keys(t.headers).forEach(l=>r[l.toLowerCase()]=t.headers[l]),t.headers=r;let i;t.body?i=t.json&&!Tg(t.body)?JSON.stringify(t.body):t.body:t.form&&(i=typeof t.form=="string"?t.form:W5.stringify(t.form),t.headers["content-type"]="application/x-www-form-urlencoded"),i&&(t.method||(t.method="POST"),Tg(i)||(t.headers["content-length"]=Buffer.byteLength(i)),t.json&&!t.form&&(t.headers["content-type"]="application/json")),delete t.body,delete t.form,t.json&&(t.headers.accept="application/json"),t.method&&(t.method=t.method.toUpperCase());let n=t.hostname,a=(t.protocol==="https:"?U5:q5).request(t,l=>{if(t.followRedirects!==!1&&l.statusCode>=300&&l.statusCode<400&&l.headers.location){t.url=l.headers.location,delete t.headers.host,l.resume();let o=GO.parse(t.url).hostname;return o!==null&&o!==n&&(delete t.headers.cookie,delete t.headers.authorization),t.method==="POST"&&[301,302].includes(l.statusCode)&&(t.method="GET",delete t.headers["content-length"],delete t.headers["content-type"]),t.maxRedirects--===0?e(new Error("too many redirects")):Ha(t,e)}let c=typeof VO=="function"&&t.method!=="HEAD";e(null,c?VO(l):l)});return a.on("timeout",()=>{a.abort(),e(new Error("Request timed out"))}),a.on("error",e),Tg(i)?i.on("error",e).pipe(a):a.end(i),a}u(Ha,"simpleGet");Ha.concat=(t,e)=>Ha(t,(r,i)=>{if(r)return e(r);j5(i,(n,s)=>{if(n)return e(n);if(t.json)try{s=JSON.parse(s.toString())}catch(a){return e(a,i,s)}e(null,i,s)})});["get","post","put","patch","head","delete"].forEach(t=>{Ha[t]=(e,r)=>(typeof e=="string"&&(e={url:e}),Ha(Object.assign({method:t.toUpperCase()},e),r))})});var Ee=x((Xte,JO)=>{"use strict";var Og=class Og extends Error{constructor(e){if(!Array.isArray(e))throw new TypeError(`Expected input to be an Array, got ${typeof e}`);let r="";for(let i=0;i<e.length;i++)r+=` ${e[i].stack}
|
|
104
|
+
`;super(r),this.name="AggregateError",this.errors=e}};u(Og,"AggregateError");var xg=Og;JO.exports={AggregateError:xg,ArrayIsArray(t){return Array.isArray(t)},ArrayPrototypeIncludes(t,e){return t.includes(e)},ArrayPrototypeIndexOf(t,e){return t.indexOf(e)},ArrayPrototypeJoin(t,e){return t.join(e)},ArrayPrototypeMap(t,e){return t.map(e)},ArrayPrototypePop(t,e){return t.pop(e)},ArrayPrototypePush(t,e){return t.push(e)},ArrayPrototypeSlice(t,e,r){return t.slice(e,r)},Error,FunctionPrototypeCall(t,e,...r){return t.call(e,...r)},FunctionPrototypeSymbolHasInstance(t,e){return Function.prototype[Symbol.hasInstance].call(t,e)},MathFloor:Math.floor,Number,NumberIsInteger:Number.isInteger,NumberIsNaN:Number.isNaN,NumberMAX_SAFE_INTEGER:Number.MAX_SAFE_INTEGER,NumberMIN_SAFE_INTEGER:Number.MIN_SAFE_INTEGER,NumberParseInt:Number.parseInt,ObjectDefineProperties(t,e){return Object.defineProperties(t,e)},ObjectDefineProperty(t,e,r){return Object.defineProperty(t,e,r)},ObjectGetOwnPropertyDescriptor(t,e){return Object.getOwnPropertyDescriptor(t,e)},ObjectKeys(t){return Object.keys(t)},ObjectSetPrototypeOf(t,e){return Object.setPrototypeOf(t,e)},Promise,PromisePrototypeCatch(t,e){return t.catch(e)},PromisePrototypeThen(t,e,r){return t.then(e,r)},PromiseReject(t){return Promise.reject(t)},PromiseResolve(t){return Promise.resolve(t)},ReflectApply:Reflect.apply,RegExpPrototypeTest(t,e){return t.test(e)},SafeSet:Set,String,StringPrototypeSlice(t,e,r){return t.slice(e,r)},StringPrototypeToLowerCase(t){return t.toLowerCase()},StringPrototypeToUpperCase(t){return t.toUpperCase()},StringPrototypeTrim(t){return t.trim()},Symbol,SymbolFor:Symbol.for,SymbolAsyncIterator:Symbol.asyncIterator,SymbolHasInstance:Symbol.hasInstance,SymbolIterator:Symbol.iterator,SymbolDispose:Symbol.dispose||Symbol("Symbol.dispose"),SymbolAsyncDispose:Symbol.asyncDispose||Symbol("Symbol.asyncDispose"),TypedArrayPrototypeSet(t,e,r){return t.set(e,r)},Boolean,Uint8Array}});var Rg=x((ere,YO)=>{"use strict";YO.exports={format(t,...e){return t.replace(/%([sdifj])/g,function(...[r,i]){let n=e.shift();return i==="f"?n.toFixed(6):i==="j"?JSON.stringify(n):i==="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"{}"}}}});var ut=x((tre,eR)=>{"use strict";var{format:H5,inspect:Gh}=Rg(),{AggregateError:V5}=Ee(),G5=globalThis.AggregateError||V5,Z5=Symbol("kIsNodeError"),K5=["string","function","number","object","Function","Object","boolean","bigint","symbol"],J5=/^([A-Z][a-z0-9]*)+$/,Y5="__node_internal_",Zh={};function In(t,e){if(!t)throw new Zh.ERR_INTERNAL_ASSERTION(e)}u(In,"assert");function XO(t){let e="",r=t.length,i=t[0]==="-"?1:0;for(;r>=i+4;r-=3)e=`_${t.slice(r-3,r)}${e}`;return`${t.slice(0,r)}${e}`}u(XO,"addNumericalSeparator");function X5(t,e,r){if(typeof e=="function")return In(e.length<=r.length,`Code: ${t}; The provided arguments length (${r.length}) does not match the required ones (${e.length}).`),e(...r);let i=(e.match(/%[dfijoOs]/g)||[]).length;return In(i===r.length,`Code: ${t}; The provided arguments length (${r.length}) does not match the required ones (${i}).`),r.length===0?e:H5(e,...r)}u(X5,"getMessage");function rt(t,e,r){r||(r=Error);let n=class n extends r{constructor(...a){super(X5(t,e,a))}toString(){return`${this.name} [${t}]: ${this.message}`}};u(n,"NodeError");let i=n;Object.defineProperties(i.prototype,{name:{value:r.name,writable:!0,enumerable:!1,configurable:!0},toString:{value(){return`${this.name} [${t}]: ${this.message}`},writable:!0,enumerable:!1,configurable:!0}}),i.prototype.code=t,i.prototype[Z5]=!0,Zh[t]=i}u(rt,"E");function QO(t){let e=Y5+t.name;return Object.defineProperty(t,"name",{value:e}),t}u(QO,"hideStackFrames");function Q5(t,e){if(t&&e&&t!==e){if(Array.isArray(e.errors))return e.errors.push(t),e;let r=new G5([e,t],e.message);return r.code=e.code,r}return t||e}u(Q5,"aggregateTwoErrors");var Pg=class Pg extends Error{constructor(e="The operation was aborted",r=void 0){if(r!==void 0&&typeof r!="object")throw new Zh.ERR_INVALID_ARG_TYPE("options","Object",r);super(e,r),this.code="ABORT_ERR",this.name="AbortError"}};u(Pg,"AbortError");var Ag=Pg;rt("ERR_ASSERTION","%s",Error);rt("ERR_INVALID_ARG_TYPE",(t,e,r)=>{In(typeof t=="string","'name' must be a string"),Array.isArray(e)||(e=[e]);let i="The ";t.endsWith(" argument")?i+=`${t} `:i+=`"${t}" ${t.includes(".")?"property":"argument"} `,i+="must be ";let n=[],s=[],a=[];for(let c of e)In(typeof c=="string","All expected entries have to be of type string"),K5.includes(c)?n.push(c.toLowerCase()):J5.test(c)?s.push(c):(In(c!=="object",'The value "object" should be written as "Object"'),a.push(c));if(s.length>0){let c=n.indexOf("object");c!==-1&&(n.splice(n,c,1),s.push("Object"))}if(n.length>0){switch(n.length){case 1:i+=`of type ${n[0]}`;break;case 2:i+=`one of type ${n[0]} or ${n[1]}`;break;default:{let c=n.pop();i+=`one of type ${n.join(", ")}, or ${c}`}}(s.length>0||a.length>0)&&(i+=" or ")}if(s.length>0){switch(s.length){case 1:i+=`an instance of ${s[0]}`;break;case 2:i+=`an instance of ${s[0]} or ${s[1]}`;break;default:{let c=s.pop();i+=`an instance of ${s.join(", ")}, or ${c}`}}a.length>0&&(i+=" or ")}switch(a.length){case 0:break;case 1:a[0].toLowerCase()!==a[0]&&(i+="an "),i+=`${a[0]}`;break;case 2:i+=`one of ${a[0]} or ${a[1]}`;break;default:{let c=a.pop();i+=`one of ${a.join(", ")}, or ${c}`}}if(r==null)i+=`. Received ${r}`;else if(typeof r=="function"&&r.name)i+=`. Received function ${r.name}`;else if(typeof r=="object"){var l;if((l=r.constructor)!==null&&l!==void 0&&l.name)i+=`. Received an instance of ${r.constructor.name}`;else{let c=Gh(r,{depth:-1});i+=`. Received ${c}`}}else{let c=Gh(r,{colors:!1});c.length>25&&(c=`${c.slice(0,25)}...`),i+=`. Received type ${typeof r} (${c})`}return i},TypeError);rt("ERR_INVALID_ARG_VALUE",(t,e,r="is invalid")=>{let i=Gh(e);return i.length>128&&(i=i.slice(0,128)+"..."),`The ${t.includes(".")?"property":"argument"} '${t}' ${r}. Received ${i}`},TypeError);rt("ERR_INVALID_RETURN_VALUE",(t,e,r)=>{var i;let n=r!=null&&(i=r.constructor)!==null&&i!==void 0&&i.name?`instance of ${r.constructor.name}`:`type ${typeof r}`;return`Expected ${t} to be returned from the "${e}" function but got ${n}.`},TypeError);rt("ERR_MISSING_ARGS",(...t)=>{In(t.length>0,"At least one arg needs to be specified");let e,r=t.length;switch(t=(Array.isArray(t)?t:[t]).map(i=>`"${i}"`).join(" or "),r){case 1:e+=`The ${t[0]} argument`;break;case 2:e+=`The ${t[0]} and ${t[1]} arguments`;break;default:{let i=t.pop();e+=`The ${t.join(", ")}, and ${i} arguments`}break}return`${e} must be specified`},TypeError);rt("ERR_OUT_OF_RANGE",(t,e,r)=>{In(e,'Missing "range" argument');let i;if(Number.isInteger(r)&&Math.abs(r)>2**32)i=XO(String(r));else if(typeof r=="bigint"){i=String(r);let n=BigInt(2)**BigInt(32);(r>n||r<-n)&&(i=XO(i)),i+="n"}else i=Gh(r);return`The value of "${t}" is out of range. It must be ${e}. Received ${i}`},RangeError);rt("ERR_MULTIPLE_CALLBACK","Callback called multiple times",Error);rt("ERR_METHOD_NOT_IMPLEMENTED","The %s method is not implemented",Error);rt("ERR_STREAM_ALREADY_FINISHED","Cannot call %s after a stream was finished",Error);rt("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable",Error);rt("ERR_STREAM_DESTROYED","Cannot call %s after a stream was destroyed",Error);rt("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);rt("ERR_STREAM_PREMATURE_CLOSE","Premature close",Error);rt("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF",Error);rt("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event",Error);rt("ERR_STREAM_WRITE_AFTER_END","write after end",Error);rt("ERR_UNKNOWN_ENCODING","Unknown encoding: %s",TypeError);eR.exports={AbortError:Ag,aggregateTwoErrors:QO(Q5),hideStackFrames:QO,codes:Zh}});var fR=x((fc,cc)=>{"use strict";Object.defineProperty(fc,"__esModule",{value:!0});var aR=new WeakMap,Ng=new WeakMap;function be(t){let e=aR.get(t);return console.assert(e!=null,"'this' is expected an Event object, but got",t),e}u(be,"pd");function tR(t){if(t.passiveListener!=null){typeof console<"u"&&typeof console.error=="function"&&console.error("Unable to preventDefault inside passive event listener invocation.",t.passiveListener);return}t.event.cancelable&&(t.canceled=!0,typeof t.event.preventDefault=="function"&&t.event.preventDefault())}u(tR,"setCancelFlag");function Va(t,e){aR.set(this,{eventTarget:t,event:e,eventPhase:2,currentTarget:t,canceled:!1,stopped:!1,immediateStopped:!1,passiveListener:null,timeStamp:e.timeStamp||Date.now()}),Object.defineProperty(this,"isTrusted",{value:!1,enumerable:!0});let r=Object.keys(e);for(let i=0;i<r.length;++i){let n=r[i];n in this||Object.defineProperty(this,n,oR(n))}}u(Va,"Event");Va.prototype={get type(){return be(this).event.type},get target(){return be(this).eventTarget},get currentTarget(){return be(this).currentTarget},composedPath(){let t=be(this).currentTarget;return t==null?[]:[t]},get NONE(){return 0},get CAPTURING_PHASE(){return 1},get AT_TARGET(){return 2},get BUBBLING_PHASE(){return 3},get eventPhase(){return be(this).eventPhase},stopPropagation(){let t=be(this);t.stopped=!0,typeof t.event.stopPropagation=="function"&&t.event.stopPropagation()},stopImmediatePropagation(){let t=be(this);t.stopped=!0,t.immediateStopped=!0,typeof t.event.stopImmediatePropagation=="function"&&t.event.stopImmediatePropagation()},get bubbles(){return!!be(this).event.bubbles},get cancelable(){return!!be(this).event.cancelable},preventDefault(){tR(be(this))},get defaultPrevented(){return be(this).canceled},get composed(){return!!be(this).event.composed},get timeStamp(){return be(this).timeStamp},get srcElement(){return be(this).eventTarget},get cancelBubble(){return be(this).stopped},set cancelBubble(t){if(!t)return;let e=be(this);e.stopped=!0,typeof e.event.cancelBubble=="boolean"&&(e.event.cancelBubble=!0)},get returnValue(){return!be(this).canceled},set returnValue(t){t||tR(be(this))},initEvent(){}};Object.defineProperty(Va.prototype,"constructor",{value:Va,configurable:!0,writable:!0});typeof window<"u"&&typeof window.Event<"u"&&(Object.setPrototypeOf(Va.prototype,window.Event.prototype),Ng.set(window.Event.prototype,Va));function oR(t){return{get(){return be(this).event[t]},set(e){be(this).event[t]=e},configurable:!0,enumerable:!0}}u(oR,"defineRedirectDescriptor");function eU(t){return{value(){let e=be(this).event;return e[t].apply(e,arguments)},configurable:!0,enumerable:!0}}u(eU,"defineCallDescriptor");function tU(t,e){let r=Object.keys(e);if(r.length===0)return t;function i(n,s){t.call(this,n,s)}u(i,"CustomEvent"),i.prototype=Object.create(t.prototype,{constructor:{value:i,configurable:!0,writable:!0}});for(let n=0;n<r.length;++n){let s=r[n];if(!(s in t.prototype)){let l=typeof Object.getOwnPropertyDescriptor(e,s).value=="function";Object.defineProperty(i.prototype,s,l?eU(s):oR(s))}}return i}u(tU,"defineWrapper");function lR(t){if(t==null||t===Object.prototype)return Va;let e=Ng.get(t);return e==null&&(e=tU(lR(Object.getPrototypeOf(t)),t),Ng.set(t,e)),e}u(lR,"getWrapper");function rU(t,e){let r=lR(Object.getPrototypeOf(e));return new r(t,e)}u(rU,"wrapEvent");function iU(t){return be(t).immediateStopped}u(iU,"isStopped");function nU(t,e){be(t).eventPhase=e}u(nU,"setEventPhase");function sU(t,e){be(t).currentTarget=e}u(sU,"setCurrentTarget");function rR(t,e){be(t).passiveListener=e}u(rR,"setPassiveListener");var cR=new WeakMap,iR=1,nR=2,Kh=3;function Jh(t){return t!==null&&typeof t=="object"}u(Jh,"isObject");function lc(t){let e=cR.get(t);if(e==null)throw new TypeError("'this' is expected an EventTarget object, but got another value.");return e}u(lc,"getListeners");function aU(t){return{get(){let r=lc(this).get(t);for(;r!=null;){if(r.listenerType===Kh)return r.listener;r=r.next}return null},set(e){typeof e!="function"&&!Jh(e)&&(e=null);let r=lc(this),i=null,n=r.get(t);for(;n!=null;)n.listenerType===Kh?i!==null?i.next=n.next:n.next!==null?r.set(t,n.next):r.delete(t):i=n,n=n.next;if(e!==null){let s={listener:e,listenerType:Kh,passive:!1,once:!1,next:null};i===null?r.set(t,s):i.next=s}},configurable:!0,enumerable:!0}}u(aU,"defineEventAttributeDescriptor");function Dg(t,e){Object.defineProperty(t,`on${e}`,aU(e))}u(Dg,"defineEventAttribute");function sR(t){function e(){mr.call(this)}u(e,"CustomEventTarget"),e.prototype=Object.create(mr.prototype,{constructor:{value:e,configurable:!0,writable:!0}});for(let r=0;r<t.length;++r)Dg(e.prototype,t[r]);return e}u(sR,"defineCustomEventTarget");function mr(){if(this instanceof mr){cR.set(this,new Map);return}if(arguments.length===1&&Array.isArray(arguments[0]))return sR(arguments[0]);if(arguments.length>0){let t=new Array(arguments.length);for(let e=0;e<arguments.length;++e)t[e]=arguments[e];return sR(t)}throw new TypeError("Cannot call a class as a function")}u(mr,"EventTarget");mr.prototype={addEventListener(t,e,r){if(e==null)return;if(typeof e!="function"&&!Jh(e))throw new TypeError("'listener' should be a function or an object.");let i=lc(this),n=Jh(r),a=(n?!!r.capture:!!r)?iR:nR,l={listener:e,listenerType:a,passive:n&&!!r.passive,once:n&&!!r.once,next:null},c=i.get(t);if(c===void 0){i.set(t,l);return}let o=null;for(;c!=null;){if(c.listener===e&&c.listenerType===a)return;o=c,c=c.next}o.next=l},removeEventListener(t,e,r){if(e==null)return;let i=lc(this),s=(Jh(r)?!!r.capture:!!r)?iR:nR,a=null,l=i.get(t);for(;l!=null;){if(l.listener===e&&l.listenerType===s){a!==null?a.next=l.next:l.next!==null?i.set(t,l.next):i.delete(t);return}a=l,l=l.next}},dispatchEvent(t){if(t==null||typeof t.type!="string")throw new TypeError('"event.type" should be a string.');let e=lc(this),r=t.type,i=e.get(r);if(i==null)return!0;let n=rU(this,t),s=null;for(;i!=null;){if(i.once?s!==null?s.next=i.next:i.next!==null?e.set(r,i.next):e.delete(r):s=i,rR(n,i.passive?i.listener:null),typeof i.listener=="function")try{i.listener.call(this,n)}catch(a){typeof console<"u"&&typeof console.error=="function"&&console.error(a)}else i.listenerType!==Kh&&typeof i.listener.handleEvent=="function"&&i.listener.handleEvent(n);if(iU(n))break;i=i.next}return rR(n,null),nU(n,0),sU(n,null),!n.defaultPrevented}};Object.defineProperty(mr.prototype,"constructor",{value:mr,configurable:!0,writable:!0});typeof window<"u"&&typeof window.EventTarget<"u"&&Object.setPrototypeOf(mr.prototype,window.EventTarget.prototype);fc.defineEventAttribute=Dg;fc.EventTarget=mr;fc.default=mr;cc.exports=mr;cc.exports.EventTarget=cc.exports.default=mr;cc.exports.defineEventAttribute=Dg});var Ga=x((hc,uc)=>{"use strict";Object.defineProperty(hc,"__esModule",{value:!0});var Cg=fR(),Ig=class Ig extends Cg.EventTarget{constructor(){throw super(),new TypeError("AbortSignal cannot be constructed directly")}get aborted(){let e=Yh.get(this);if(typeof e!="boolean")throw new TypeError(`Expected 'this' to be an 'AbortSignal' object, but got ${this===null?"null":typeof this}`);return e}};u(Ig,"AbortSignal");var zi=Ig;Cg.defineEventAttribute(zi.prototype,"abort");function oU(){let t=Object.create(zi.prototype);return Cg.EventTarget.call(t),Yh.set(t,!1),t}u(oU,"createAbortSignal");function lU(t){Yh.get(t)===!1&&(Yh.set(t,!0),t.dispatchEvent({type:"abort"}))}u(lU,"abortSignal");var Yh=new WeakMap;Object.defineProperties(zi.prototype,{aborted:{enumerable:!0}});typeof Symbol=="function"&&typeof Symbol.toStringTag=="symbol"&&Object.defineProperty(zi.prototype,Symbol.toStringTag,{configurable:!0,value:"AbortSignal"});var $g=class $g{constructor(){hR.set(this,oU())}get signal(){return uR(this)}abort(){lU(uR(this))}};u($g,"AbortController");var Wi=$g,hR=new WeakMap;function uR(t){let e=hR.get(t);if(e==null)throw new TypeError(`Expected 'this' to be an 'AbortController' object, but got ${t===null?"null":typeof t}`);return e}u(uR,"getSignal");Object.defineProperties(Wi.prototype,{signal:{enumerable:!0},abort:{enumerable:!0}});typeof Symbol=="function"&&typeof Symbol.toStringTag=="symbol"&&Object.defineProperty(Wi.prototype,Symbol.toStringTag,{configurable:!0,value:"AbortController"});hc.AbortController=Wi;hc.AbortSignal=zi;hc.default=Wi;uc.exports=Wi;uc.exports.AbortController=uc.exports.default=Wi;uc.exports.AbortSignal=zi});var vt=x((sre,Lg)=>{"use strict";var cU=ne("buffer"),{format:fU,inspect:uU}=Rg(),{codes:{ERR_INVALID_ARG_TYPE:Bg}}=ut(),{kResistStopPropagation:hU,AggregateError:dU,SymbolDispose:pU}=Ee(),mU=globalThis.AbortSignal||Ga().AbortSignal,wU=globalThis.AbortController||Ga().AbortController,yU=Object.getPrototypeOf(async function(){}).constructor,dR=globalThis.Blob||cU.Blob,gU=u(typeof dR<"u"?function(e){return e instanceof dR}:function(e){return!1},"isBlob"),pR=u((t,e)=>{if(t!==void 0&&(t===null||typeof t!="object"||!("aborted"in t)))throw new Bg(e,"AbortSignal",t)},"validateAbortSignal"),bU=u((t,e)=>{if(typeof t!="function")throw new Bg(e,"Function",t)},"validateFunction");Lg.exports={AggregateError:dU,kEmptyObject:Object.freeze({}),once(t){let e=!1;return function(...r){e||(e=!0,t.apply(this,r))}},createDeferredPromise:u(function(){let t,e;return{promise:new Promise((i,n)=>{t=i,e=n}),resolve:t,reject:e}},"createDeferredPromise"),promisify(t){return new Promise((e,r)=>{t((i,...n)=>i?r(i):e(...n))})},debuglog(){return function(){}},format:fU,inspect:uU,types:{isAsyncFunction(t){return t instanceof yU},isArrayBufferView(t){return ArrayBuffer.isView(t)}},isBlob:gU,deprecate(t,e){return t},addAbortListener:ne("events").addAbortListener||u(function(e,r){if(e===void 0)throw new Bg("signal","AbortSignal",e);pR(e,"signal"),bU(r,"listener");let i;return e.aborted?queueMicrotask(()=>r()):(e.addEventListener("abort",r,{__proto__:null,once:!0,[hU]:!0}),i=u(()=>{e.removeEventListener("abort",r)},"removeEventListener")),{__proto__:null,[pU](){var n;(n=i)===null||n===void 0||n()}}},"addAbortListener"),AbortSignalAny:mU.any||u(function(e){if(e.length===1)return e[0];let r=new wU,i=u(()=>r.abort(),"abort");return e.forEach(n=>{pR(n,"signals"),n.addEventListener("abort",i,{once:!0})}),r.signal.addEventListener("abort",()=>{e.forEach(n=>n.removeEventListener("abort",i))},{once:!0}),r.signal},"AbortSignalAny")};Lg.exports.promisify.custom=Symbol.for("nodejs.util.promisify.custom")});var Ka=x((ore,FR)=>{"use strict";var{ArrayIsArray:jg,ArrayPrototypeIncludes:gR,ArrayPrototypeJoin:bR,ArrayPrototypeMap:_U,NumberIsInteger:qg,NumberIsNaN:vU,NumberMAX_SAFE_INTEGER:SU,NumberMIN_SAFE_INTEGER:EU,NumberParseInt:FU,ObjectPrototypeHasOwnProperty:kU,RegExpPrototypeExec:_R,String:TU,StringPrototypeToUpperCase:xU,StringPrototypeTrim:OU}=Ee(),{hideStackFrames:rr,codes:{ERR_SOCKET_BAD_PORT:RU,ERR_INVALID_ARG_TYPE:ht,ERR_INVALID_ARG_VALUE:Za,ERR_OUT_OF_RANGE:$n,ERR_UNKNOWN_SIGNAL:mR}}=ut(),{normalizeEncoding:AU}=vt(),{isAsyncFunction:PU,isArrayBufferView:NU}=vt().types,wR={};function DU(t){return t===(t|0)}u(DU,"isInt32");function CU(t){return t===t>>>0}u(CU,"isUint32");var IU=/^[0-7]+$/,$U="must be a 32-bit unsigned integer or an octal string";function BU(t,e,r){if(typeof t>"u"&&(t=r),typeof t=="string"){if(_R(IU,t)===null)throw new Za(e,t,$U);t=FU(t,8)}return vR(t,e),t}u(BU,"parseFileMode");var LU=rr((t,e,r=EU,i=SU)=>{if(typeof t!="number")throw new ht(e,"number",t);if(!qg(t))throw new $n(e,"an integer",t);if(t<r||t>i)throw new $n(e,`>= ${r} && <= ${i}`,t)}),MU=rr((t,e,r=-2147483648,i=2147483647)=>{if(typeof t!="number")throw new ht(e,"number",t);if(!qg(t))throw new $n(e,"an integer",t);if(t<r||t>i)throw new $n(e,`>= ${r} && <= ${i}`,t)}),vR=rr((t,e,r=!1)=>{if(typeof t!="number")throw new ht(e,"number",t);if(!qg(t))throw new $n(e,"an integer",t);let i=r?1:0,n=4294967295;if(t<i||t>n)throw new $n(e,`>= ${i} && <= ${n}`,t)});function Ug(t,e){if(typeof t!="string")throw new ht(e,"string",t)}u(Ug,"validateString");function jU(t,e,r=void 0,i){if(typeof t!="number")throw new ht(e,"number",t);if(r!=null&&t<r||i!=null&&t>i||(r!=null||i!=null)&&vU(t))throw new $n(e,`${r!=null?`>= ${r}`:""}${r!=null&&i!=null?" && ":""}${i!=null?`<= ${i}`:""}`,t)}u(jU,"validateNumber");var qU=rr((t,e,r)=>{if(!gR(r,t)){let n="must be one of: "+bR(_U(r,s=>typeof s=="string"?`'${s}'`:TU(s)),", ");throw new Za(e,t,n)}});function SR(t,e){if(typeof t!="boolean")throw new ht(e,"boolean",t)}u(SR,"validateBoolean");function Mg(t,e,r){return t==null||!kU(t,e)?r:t[e]}u(Mg,"getOwnPropertyValueOrDefault");var UU=rr((t,e,r=null)=>{let i=Mg(r,"allowArray",!1),n=Mg(r,"allowFunction",!1);if(!Mg(r,"nullable",!1)&&t===null||!i&&jg(t)||typeof t!="object"&&(!n||typeof t!="function"))throw new ht(e,"Object",t)}),zU=rr((t,e)=>{if(t!=null&&typeof t!="object"&&typeof t!="function")throw new ht(e,"a dictionary",t)}),Xh=rr((t,e,r=0)=>{if(!jg(t))throw new ht(e,"Array",t);if(t.length<r){let i=`must be longer than ${r}`;throw new Za(e,t,i)}});function WU(t,e){Xh(t,e);for(let r=0;r<t.length;r++)Ug(t[r],`${e}[${r}]`)}u(WU,"validateStringArray");function HU(t,e){Xh(t,e);for(let r=0;r<t.length;r++)SR(t[r],`${e}[${r}]`)}u(HU,"validateBooleanArray");function VU(t,e){Xh(t,e);for(let r=0;r<t.length;r++){let i=t[r],n=`${e}[${r}]`;if(i==null)throw new ht(n,"AbortSignal",i);ER(i,n)}}u(VU,"validateAbortSignalArray");function GU(t,e="signal"){if(Ug(t,e),wR[t]===void 0)throw wR[xU(t)]!==void 0?new mR(t+" (signals must use all capital letters)"):new mR(t)}u(GU,"validateSignalName");var ZU=rr((t,e="buffer")=>{if(!NU(t))throw new ht(e,["Buffer","TypedArray","DataView"],t)});function KU(t,e){let r=AU(e),i=t.length;if(r==="hex"&&i%2!==0)throw new Za("encoding",e,`is invalid for data of length ${i}`)}u(KU,"validateEncoding");function JU(t,e="Port",r=!0){if(typeof t!="number"&&typeof t!="string"||typeof t=="string"&&OU(t).length===0||+t!==+t>>>0||t>65535||t===0&&!r)throw new RU(e,t,r);return t|0}u(JU,"validatePort");var ER=rr((t,e)=>{if(t!==void 0&&(t===null||typeof t!="object"||!("aborted"in t)))throw new ht(e,"AbortSignal",t)}),YU=rr((t,e)=>{if(typeof t!="function")throw new ht(e,"Function",t)}),XU=rr((t,e)=>{if(typeof t!="function"||PU(t))throw new ht(e,"Function",t)}),QU=rr((t,e)=>{if(t!==void 0)throw new ht(e,"undefined",t)});function e3(t,e,r){if(!gR(r,t))throw new ht(e,`('${bR(r,"|")}')`,t)}u(e3,"validateUnion");var t3=/^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/;function yR(t,e){if(typeof t>"u"||!_R(t3,t))throw new Za(e,t,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}u(yR,"validateLinkHeaderFormat");function r3(t){if(typeof t=="string")return yR(t,"hints"),t;if(jg(t)){let e=t.length,r="";if(e===0)return r;for(let i=0;i<e;i++){let n=t[i];yR(n,"hints"),r+=n,i!==e-1&&(r+=", ")}return r}throw new Za("hints",t,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}u(r3,"validateLinkHeaderValue");FR.exports={isInt32:DU,isUint32:CU,parseFileMode:BU,validateArray:Xh,validateStringArray:WU,validateBooleanArray:HU,validateAbortSignalArray:VU,validateBoolean:SR,validateBuffer:ZU,validateDictionary:zU,validateEncoding:KU,validateFunction:YU,validateInt32:MU,validateInteger:LU,validateNumber:jU,validateObject:UU,validateOneOf:qU,validatePlainFunction:XU,validatePort:JU,validateSignalName:GU,validateString:Ug,validateUint32:vR,validateUndefined:QU,validateUnion:e3,validateAbortSignal:ER,validateLinkHeaderValue:r3}});var Hi=x((cre,kR)=>{kR.exports=globalThis.process});var Ir=x((fre,jR)=>{"use strict";var{SymbolAsyncIterator:TR,SymbolIterator:xR,SymbolFor:Bn}=Ee(),OR=Bn("nodejs.stream.destroyed"),RR=Bn("nodejs.stream.errored"),zg=Bn("nodejs.stream.readable"),Wg=Bn("nodejs.stream.writable"),AR=Bn("nodejs.stream.disturbed"),i3=Bn("nodejs.webstream.isClosedPromise"),n3=Bn("nodejs.webstream.controllerErrorFunction");function Qh(t,e=!1){var r;return!!(t&&typeof t.pipe=="function"&&typeof t.on=="function"&&(!e||typeof t.pause=="function"&&typeof t.resume=="function")&&(!t._writableState||((r=t._readableState)===null||r===void 0?void 0:r.readable)!==!1)&&(!t._writableState||t._readableState))}u(Qh,"isReadableNodeStream");function ed(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))}u(ed,"isWritableNodeStream");function s3(t){return!!(t&&typeof t.pipe=="function"&&t._readableState&&typeof t.on=="function"&&typeof t.write=="function")}u(s3,"isDuplexNodeStream");function Cr(t){return t&&(t._readableState||t._writableState||typeof t.write=="function"&&typeof t.on=="function"||typeof t.pipe=="function"&&typeof t.on=="function")}u(Cr,"isNodeStream");function PR(t){return!!(t&&!Cr(t)&&typeof t.pipeThrough=="function"&&typeof t.getReader=="function"&&typeof t.cancel=="function")}u(PR,"isReadableStream");function NR(t){return!!(t&&!Cr(t)&&typeof t.getWriter=="function"&&typeof t.abort=="function")}u(NR,"isWritableStream");function DR(t){return!!(t&&!Cr(t)&&typeof t.readable=="object"&&typeof t.writable=="object")}u(DR,"isTransformStream");function a3(t){return PR(t)||NR(t)||DR(t)}u(a3,"isWebStream");function o3(t,e){return t==null?!1:e===!0?typeof t[TR]=="function":e===!1?typeof t[xR]=="function":typeof t[TR]=="function"||typeof t[xR]=="function"}u(o3,"isIterable");function td(t){if(!Cr(t))return null;let e=t._writableState,r=t._readableState,i=e||r;return!!(t.destroyed||t[OR]||i!=null&&i.destroyed)}u(td,"isDestroyed");function CR(t){if(!ed(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}u(CR,"isWritableEnded");function l3(t,e){if(!ed(t))return null;if(t.writableFinished===!0)return!0;let r=t._writableState;return r!=null&&r.errored?!1:typeof r?.finished!="boolean"?null:!!(r.finished||e===!1&&r.ended===!0&&r.length===0)}u(l3,"isWritableFinished");function c3(t){if(!Qh(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}u(c3,"isReadableEnded");function IR(t,e){if(!Qh(t))return null;let r=t._readableState;return r!=null&&r.errored?!1:typeof r?.endEmitted!="boolean"?null:!!(r.endEmitted||e===!1&&r.ended===!0&&r.length===0)}u(IR,"isReadableFinished");function $R(t){return t&&t[zg]!=null?t[zg]:typeof t?.readable!="boolean"?null:td(t)?!1:Qh(t)&&t.readable&&!IR(t)}u($R,"isReadable");function BR(t){return t&&t[Wg]!=null?t[Wg]:typeof t?.writable!="boolean"?null:td(t)?!1:ed(t)&&t.writable&&!CR(t)}u(BR,"isWritable");function f3(t,e){return Cr(t)?td(t)?!0:!(e?.readable!==!1&&$R(t)||e?.writable!==!1&&BR(t)):null}u(f3,"isFinished");function u3(t){var e,r;return Cr(t)?t.writableErrored?t.writableErrored:(e=(r=t._writableState)===null||r===void 0?void 0:r.errored)!==null&&e!==void 0?e:null:null}u(u3,"isWritableErrored");function h3(t){var e,r;return Cr(t)?t.readableErrored?t.readableErrored:(e=(r=t._readableState)===null||r===void 0?void 0:r.errored)!==null&&e!==void 0?e:null:null}u(h3,"isReadableErrored");function d3(t){if(!Cr(t))return null;if(typeof t.closed=="boolean")return t.closed;let e=t._writableState,r=t._readableState;return typeof e?.closed=="boolean"||typeof r?.closed=="boolean"?e?.closed||r?.closed:typeof t._closed=="boolean"&&LR(t)?t._closed:null}u(d3,"isClosed");function LR(t){return typeof t._closed=="boolean"&&typeof t._defaultKeepAlive=="boolean"&&typeof t._removedConnection=="boolean"&&typeof t._removedContLen=="boolean"}u(LR,"isOutgoingMessage");function MR(t){return typeof t._sent100=="boolean"&&LR(t)}u(MR,"isServerResponse");function p3(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}u(p3,"isServerRequest");function m3(t){if(!Cr(t))return null;let e=t._writableState,r=t._readableState,i=e||r;return!i&&MR(t)||!!(i&&i.autoDestroy&&i.emitClose&&i.closed===!1)}u(m3,"willEmitClose");function w3(t){var e;return!!(t&&((e=t[AR])!==null&&e!==void 0?e:t.readableDidRead||t.readableAborted))}u(w3,"isDisturbed");function y3(t){var e,r,i,n,s,a,l,c,o,f;return!!(t&&((e=(r=(i=(n=(s=(a=t[RR])!==null&&a!==void 0?a:t.readableErrored)!==null&&s!==void 0?s:t.writableErrored)!==null&&n!==void 0?n:(l=t._readableState)===null||l===void 0?void 0:l.errorEmitted)!==null&&i!==void 0?i:(c=t._writableState)===null||c===void 0?void 0:c.errorEmitted)!==null&&r!==void 0?r:(o=t._readableState)===null||o===void 0?void 0:o.errored)!==null&&e!==void 0?e:!((f=t._writableState)===null||f===void 0)&&f.errored))}u(y3,"isErrored");jR.exports={isDestroyed:td,kIsDestroyed:OR,isDisturbed:w3,kIsDisturbed:AR,isErrored:y3,kIsErrored:RR,isReadable:$R,kIsReadable:zg,kIsClosedPromise:i3,kControllerErrorFunction:n3,kIsWritable:Wg,isClosed:d3,isDuplexNodeStream:s3,isFinished:f3,isIterable:o3,isReadableNodeStream:Qh,isReadableStream:PR,isReadableEnded:c3,isReadableFinished:IR,isReadableErrored:h3,isNodeStream:Cr,isWebStream:a3,isWritable:BR,isWritableNodeStream:ed,isWritableStream:NR,isWritableEnded:CR,isWritableFinished:l3,isWritableErrored:u3,isServerRequest:p3,isServerResponse:MR,willEmitClose:m3,isTransformStream:DR}});var ai=x((hre,Kg)=>{"use strict";var Vi=Hi(),{AbortError:KR,codes:g3}=ut(),{ERR_INVALID_ARG_TYPE:b3,ERR_STREAM_PREMATURE_CLOSE:qR}=g3,{kEmptyObject:Vg,once:Gg}=vt(),{validateAbortSignal:_3,validateFunction:v3,validateObject:S3,validateBoolean:E3}=Ka(),{Promise:F3,PromisePrototypeThen:k3,SymbolDispose:JR}=Ee(),{isClosed:T3,isReadable:UR,isReadableNodeStream:Hg,isReadableStream:x3,isReadableFinished:zR,isReadableErrored:WR,isWritable:HR,isWritableNodeStream:VR,isWritableStream:O3,isWritableFinished:GR,isWritableErrored:ZR,isNodeStream:R3,willEmitClose:A3,kIsClosedPromise:P3}=Ir(),Ja;function N3(t){return t.setHeader&&typeof t.abort=="function"}u(N3,"isRequest");var Zg=u(()=>{},"nop");function YR(t,e,r){var i,n;if(arguments.length===2?(r=e,e=Vg):e==null?e=Vg:S3(e,"options"),v3(r,"callback"),_3(e.signal,"options.signal"),r=Gg(r),x3(t)||O3(t))return D3(t,e,r);if(!R3(t))throw new b3("stream",["ReadableStream","WritableStream","Stream"],t);let s=(i=e.readable)!==null&&i!==void 0?i:Hg(t),a=(n=e.writable)!==null&&n!==void 0?n:VR(t),l=t._writableState,c=t._readableState,o=u(()=>{t.writable||d()},"onlegacyfinish"),f=A3(t)&&Hg(t)===s&&VR(t)===a,h=GR(t,!1),d=u(()=>{h=!0,t.destroyed&&(f=!1),!(f&&(!t.readable||s))&&(!s||p)&&r.call(t)},"onfinish"),p=zR(t,!1),m=u(()=>{p=!0,t.destroyed&&(f=!1),!(f&&(!t.writable||a))&&(!a||h)&&r.call(t)},"onend"),w=u(k=>{r.call(t,k)},"onerror"),g=T3(t),b=u(()=>{g=!0;let k=ZR(t)||WR(t);if(k&&typeof k!="boolean")return r.call(t,k);if(s&&!p&&Hg(t,!0)&&!zR(t,!1))return r.call(t,new qR);if(a&&!h&&!GR(t,!1))return r.call(t,new qR);r.call(t)},"onclose"),_=u(()=>{g=!0;let k=ZR(t)||WR(t);if(k&&typeof k!="boolean")return r.call(t,k);r.call(t)},"onclosed"),S=u(()=>{t.req.on("finish",d)},"onrequest");N3(t)?(t.on("complete",d),f||t.on("abort",b),t.req?S():t.on("request",S)):a&&!l&&(t.on("end",o),t.on("close",o)),!f&&typeof t.aborted=="boolean"&&t.on("aborted",b),t.on("end",m),t.on("finish",d),e.error!==!1&&t.on("error",w),t.on("close",b),g?Vi.nextTick(b):l!=null&&l.errorEmitted||c!=null&&c.errorEmitted?f||Vi.nextTick(_):(!s&&(!f||UR(t))&&(h||HR(t)===!1)||!a&&(!f||HR(t))&&(p||UR(t)===!1)||c&&t.req&&t.aborted)&&Vi.nextTick(_);let F=u(()=>{r=Zg,t.removeListener("aborted",b),t.removeListener("complete",d),t.removeListener("abort",b),t.removeListener("request",S),t.req&&t.req.removeListener("finish",d),t.removeListener("end",o),t.removeListener("close",o),t.removeListener("finish",d),t.removeListener("end",m),t.removeListener("error",w),t.removeListener("close",b)},"cleanup");if(e.signal&&!g){let k=u(()=>{let A=r;F(),A.call(t,new KR(void 0,{cause:e.signal.reason}))},"abort");if(e.signal.aborted)Vi.nextTick(k);else{Ja=Ja||vt().addAbortListener;let A=Ja(e.signal,k),v=r;r=Gg((...T)=>{A[JR](),v.apply(t,T)})}}return F}u(YR,"eos");function D3(t,e,r){let i=!1,n=Zg;if(e.signal)if(n=u(()=>{i=!0,r.call(t,new KR(void 0,{cause:e.signal.reason}))},"abort"),e.signal.aborted)Vi.nextTick(n);else{Ja=Ja||vt().addAbortListener;let a=Ja(e.signal,n),l=r;r=Gg((...c)=>{a[JR](),l.apply(t,c)})}let s=u((...a)=>{i||Vi.nextTick(()=>r.apply(t,a))},"resolverFn");return k3(t[P3].promise,s,s),Zg}u(D3,"eosWeb");function C3(t,e){var r;let i=!1;return e===null&&(e=Vg),(r=e)!==null&&r!==void 0&&r.cleanup&&(E3(e.cleanup,"cleanup"),i=e.cleanup),new F3((n,s)=>{let a=YR(t,e,l=>{i&&a(),l?s(l):n()})})}u(C3,"finished");Kg.exports=YR;Kg.exports.finished=C3});var Ln=x((pre,sA)=>{"use strict";var $r=Hi(),{aggregateTwoErrors:I3,codes:{ERR_MULTIPLE_CALLBACK:$3},AbortError:B3}=ut(),{Symbol:eA}=Ee(),{kIsDestroyed:L3,isDestroyed:M3,isFinished:j3,isServerRequest:q3}=Ir(),tA=eA("kDestroy"),Jg=eA("kConstruct");function rA(t,e,r){t&&(t.stack,e&&!e.errored&&(e.errored=t),r&&!r.errored&&(r.errored=t))}u(rA,"checkError");function U3(t,e){let r=this._readableState,i=this._writableState,n=i||r;return i!=null&&i.destroyed||r!=null&&r.destroyed?(typeof e=="function"&&e(),this):(rA(t,i,r),i&&(i.destroyed=!0),r&&(r.destroyed=!0),n.constructed?XR(this,t,e):this.once(tA,function(s){XR(this,I3(s,t),e)}),this)}u(U3,"destroy");function XR(t,e,r){let i=!1;function n(s){if(i)return;i=!0;let a=t._readableState,l=t._writableState;rA(s,l,a),l&&(l.closed=!0),a&&(a.closed=!0),typeof r=="function"&&r(s),s?$r.nextTick(z3,t,s):$r.nextTick(iA,t)}u(n,"onDestroy");try{t._destroy(e||null,n)}catch(s){n(s)}}u(XR,"_destroy");function z3(t,e){Yg(t,e),iA(t)}u(z3,"emitErrorCloseNT");function iA(t){let e=t._readableState,r=t._writableState;r&&(r.closeEmitted=!0),e&&(e.closeEmitted=!0),(r!=null&&r.emitClose||e!=null&&e.emitClose)&&t.emit("close")}u(iA,"emitCloseNT");function Yg(t,e){let r=t._readableState,i=t._writableState;i!=null&&i.errorEmitted||r!=null&&r.errorEmitted||(i&&(i.errorEmitted=!0),r&&(r.errorEmitted=!0),t.emit("error",e))}u(Yg,"emitErrorNT");function W3(){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)}u(W3,"undestroy");function Xg(t,e,r){let i=t._readableState,n=t._writableState;if(n!=null&&n.destroyed||i!=null&&i.destroyed)return this;i!=null&&i.autoDestroy||n!=null&&n.autoDestroy?t.destroy(e):e&&(e.stack,n&&!n.errored&&(n.errored=e),i&&!i.errored&&(i.errored=e),r?$r.nextTick(Yg,t,e):Yg(t,e))}u(Xg,"errorOrDestroy");function H3(t,e){if(typeof t._construct!="function")return;let r=t._readableState,i=t._writableState;r&&(r.constructed=!1),i&&(i.constructed=!1),t.once(Jg,e),!(t.listenerCount(Jg)>1)&&$r.nextTick(V3,t)}u(H3,"construct");function V3(t){let e=!1;function r(i){if(e){Xg(t,i??new $3);return}e=!0;let n=t._readableState,s=t._writableState,a=s||n;n&&(n.constructed=!0),s&&(s.constructed=!0),a.destroyed?t.emit(tA,i):i?Xg(t,i,!0):$r.nextTick(G3,t)}u(r,"onConstruct");try{t._construct(i=>{$r.nextTick(r,i)})}catch(i){$r.nextTick(r,i)}}u(V3,"constructNT");function G3(t){t.emit(Jg)}u(G3,"emitConstructNT");function QR(t){return t?.setHeader&&typeof t.abort=="function"}u(QR,"isRequest");function nA(t){t.emit("close")}u(nA,"emitCloseLegacy");function Z3(t,e){t.emit("error",e),$r.nextTick(nA,t)}u(Z3,"emitErrorCloseLegacy");function K3(t,e){!t||M3(t)||(!e&&!j3(t)&&(e=new B3),q3(t)?(t.socket=null,t.destroy(e)):QR(t)?t.abort():QR(t.req)?t.req.abort():typeof t.destroy=="function"?t.destroy(e):typeof t.close=="function"?t.close():e?$r.nextTick(Z3,t,e):$r.nextTick(nA,t),t.destroyed||(t[L3]=!0))}u(K3,"destroyer");sA.exports={construct:H3,destroyer:K3,destroy:U3,undestroy:W3,errorOrDestroy:Xg}});var nd=x((wre,oA)=>{"use strict";var{ArrayIsArray:J3,ObjectSetPrototypeOf:aA}=Ee(),{EventEmitter:rd}=ne("events");function id(t){rd.call(this,t)}u(id,"Stream");aA(id.prototype,rd.prototype);aA(id,rd);id.prototype.pipe=function(t,e){let r=this;function i(f){t.writable&&t.write(f)===!1&&r.pause&&r.pause()}u(i,"ondata"),r.on("data",i);function n(){r.readable&&r.resume&&r.resume()}u(n,"ondrain"),t.on("drain",n),!t._isStdio&&(!e||e.end!==!1)&&(r.on("end",a),r.on("close",l));let s=!1;function a(){s||(s=!0,t.end())}u(a,"onend");function l(){s||(s=!0,typeof t.destroy=="function"&&t.destroy())}u(l,"onclose");function c(f){o(),rd.listenerCount(this,"error")===0&&this.emit("error",f)}u(c,"onerror"),Qg(r,"error",c),Qg(t,"error",c);function o(){r.removeListener("data",i),t.removeListener("drain",n),r.removeListener("end",a),r.removeListener("close",l),r.removeListener("error",c),t.removeListener("error",c),r.removeListener("end",o),r.removeListener("close",o),t.removeListener("close",o)}return u(o,"cleanup"),r.on("end",o),r.on("close",o),t.on("close",o),t.emit("pipe",r),t};function Qg(t,e,r){if(typeof t.prependListener=="function")return t.prependListener(e,r);!t._events||!t._events[e]?t.on(e,r):J3(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]}u(Qg,"prependListener");oA.exports={Stream:id,prependListener:Qg}});var dc=x((gre,sd)=>{"use strict";var{SymbolDispose:Y3}=Ee(),{AbortError:lA,codes:X3}=ut(),{isNodeStream:cA,isWebStream:Q3,kControllerErrorFunction:e4}=Ir(),t4=ai(),{ERR_INVALID_ARG_TYPE:fA}=X3,e0,r4=u((t,e)=>{if(typeof t!="object"||!("aborted"in t))throw new fA(e,"AbortSignal",t)},"validateAbortSignal");sd.exports.addAbortSignal=u(function(e,r){if(r4(e,"signal"),!cA(r)&&!Q3(r))throw new fA("stream",["ReadableStream","WritableStream","Stream"],r);return sd.exports.addAbortSignalNoValidate(e,r)},"addAbortSignal");sd.exports.addAbortSignalNoValidate=function(t,e){if(typeof t!="object"||!("aborted"in t))return e;let r=cA(e)?()=>{e.destroy(new lA(void 0,{cause:t.reason}))}:()=>{e[e4](new lA(void 0,{cause:t.reason}))};if(t.aborted)r();else{e0=e0||vt().addAbortListener;let i=e0(t,r);t4(e,i[Y3])}return e}});var dA=x((_re,hA)=>{"use strict";var{StringPrototypeSlice:uA,SymbolIterator:i4,TypedArrayPrototypeSet:ad,Uint8Array:n4}=Ee(),{Buffer:t0}=ne("buffer"),{inspect:s4}=vt(),Ya;hA.exports=(Ya=class{constructor(){this.head=null,this.tail=null,this.length=0}push(e){let r={data:e,next:null};this.length>0?this.tail.next=r:this.head=r,this.tail=r,++this.length}unshift(e){let r={data:e,next:this.head};this.length===0&&(this.tail=r),this.head=r,++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 r=this.head,i=""+r.data;for(;(r=r.next)!==null;)i+=e+r.data;return i}concat(e){if(this.length===0)return t0.alloc(0);let r=t0.allocUnsafe(e>>>0),i=this.head,n=0;for(;i;)ad(r,i.data,n),n+=i.data.length,i=i.next;return r}consume(e,r){let i=this.head.data;if(e<i.length){let n=i.slice(0,e);return this.head.data=i.slice(e),n}return e===i.length?this.shift():r?this._getString(e):this._getBuffer(e)}first(){return this.head.data}*[i4](){for(let e=this.head;e;e=e.next)yield e.data}_getString(e){let r="",i=this.head,n=0;do{let s=i.data;if(e>s.length)r+=s,e-=s.length;else{e===s.length?(r+=s,++n,i.next?this.head=i.next:this.head=this.tail=null):(r+=uA(s,0,e),this.head=i,i.data=uA(s,e));break}++n}while((i=i.next)!==null);return this.length-=n,r}_getBuffer(e){let r=t0.allocUnsafe(e),i=e,n=this.head,s=0;do{let a=n.data;if(e>a.length)ad(r,a,i-e),e-=a.length;else{e===a.length?(ad(r,a,i-e),++s,n.next?this.head=n.next:this.head=this.tail=null):(ad(r,new n4(a.buffer,a.byteOffset,e),i-e),this.head=n,n.data=a.slice(e));break}++s}while((n=n.next)!==null);return this.length-=s,r}[Symbol.for("nodejs.util.inspect.custom")](e,r){return s4(this,{...r,depth:0,customInspect:!1})}},u(Ya,"BufferList"),Ya)});var pc=x((Sre,yA)=>{"use strict";var{MathFloor:a4,NumberIsInteger:o4}=Ee(),{validateInteger:l4}=Ka(),{ERR_INVALID_ARG_VALUE:c4}=ut().codes,pA=16*1024,mA=16;function f4(t,e,r){return t.highWaterMark!=null?t.highWaterMark:e?t[r]:null}u(f4,"highWaterMarkFrom");function wA(t){return t?mA:pA}u(wA,"getDefaultHighWaterMark");function u4(t,e){l4(e,"value",0),t?mA=e:pA=e}u(u4,"setDefaultHighWaterMark");function h4(t,e,r,i){let n=f4(e,i,r);if(n!=null){if(!o4(n)||n<0){let s=i?`options.${r}`:"options.highWaterMark";throw new c4(s,n)}return a4(n)}return wA(t.objectMode)}u(h4,"getHighWaterMark");yA.exports={getHighWaterMark:h4,getDefaultHighWaterMark:wA,setDefaultHighWaterMark:u4}});var _A=x(bA=>{"use strict";var i0=ml().Buffer,gA=i0.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 d4(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}}u(d4,"_normalizeEncoding");function p4(t){var e=d4(t);if(typeof e!="string"&&(i0.isEncoding===gA||!gA(t)))throw new Error("Unknown encoding: "+t);return e||t}u(p4,"normalizeEncoding");bA.StringDecoder=mc;function mc(t){this.encoding=p4(t);var e;switch(this.encoding){case"utf16le":this.text=_4,this.end=v4,e=4;break;case"utf8":this.fillLast=y4,e=4;break;case"base64":this.text=S4,this.end=E4,e=3;break;default:this.write=F4,this.end=k4;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=i0.allocUnsafe(e)}u(mc,"StringDecoder");mc.prototype.write=function(t){if(t.length===0)return"";var e,r;if(this.lastNeed){if(e=this.fillLast(t),e===void 0)return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r<t.length?e?e+this.text(t,r):this.text(t,r):e||""};mc.prototype.end=b4;mc.prototype.text=g4;mc.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 r0(t){return t<=127?0:t>>5===6?2:t>>4===14?3:t>>3===30?4:t>>6===2?-1:-2}u(r0,"utf8CheckByte");function m4(t,e,r){var i=e.length-1;if(i<r)return 0;var n=r0(e[i]);return n>=0?(n>0&&(t.lastNeed=n-1),n):--i<r||n===-2?0:(n=r0(e[i]),n>=0?(n>0&&(t.lastNeed=n-2),n):--i<r||n===-2?0:(n=r0(e[i]),n>=0?(n>0&&(n===2?n=0:t.lastNeed=n-3),n):0))}u(m4,"utf8CheckIncomplete");function w4(t,e,r){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"}}u(w4,"utf8CheckExtraBytes");function y4(t){var e=this.lastTotal-this.lastNeed,r=w4(this,t,e);if(r!==void 0)return r;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}u(y4,"utf8FillLast");function g4(t,e){var r=m4(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=r;var i=t.length-(r-this.lastNeed);return t.copy(this.lastChar,0,i),t.toString("utf8",e,i)}u(g4,"utf8Text");function b4(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"\uFFFD":e}u(b4,"utf8End");function _4(t,e){if((t.length-e)%2===0){var r=t.toString("utf16le",e);if(r){var i=r.charCodeAt(r.length-1);if(i>=55296&&i<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}u(_4,"utf16Text");function v4(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,r)}return e}u(v4,"utf16End");function S4(t,e){var r=(t.length-e)%3;return r===0?t.toString("base64",e):(this.lastNeed=3-r,this.lastTotal=3,r===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-r))}u(S4,"base64Text");function E4(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}u(E4,"base64End");function F4(t){return t.toString(this.encoding)}u(F4,"simpleWrite");function k4(t){return t&&t.length?this.write(t):""}u(k4,"simpleEnd")});var n0=x((Tre,FA)=>{"use strict";var vA=Hi(),{PromisePrototypeThen:T4,SymbolAsyncIterator:SA,SymbolIterator:EA}=Ee(),{Buffer:x4}=ne("buffer"),{ERR_INVALID_ARG_TYPE:O4,ERR_STREAM_NULL_VALUES:R4}=ut().codes;function A4(t,e,r){let i;if(typeof e=="string"||e instanceof x4)return new t({objectMode:!0,...r,read(){this.push(e),this.push(null)}});let n;if(e&&e[SA])n=!0,i=e[SA]();else if(e&&e[EA])n=!1,i=e[EA]();else throw new O4("iterable",["Iterable"],e);let s=new t({objectMode:!0,highWaterMark:1,...r}),a=!1;s._read=function(){a||(a=!0,c())},s._destroy=function(o,f){T4(l(o),()=>vA.nextTick(f,o),h=>vA.nextTick(f,h||o))};async function l(o){let f=o!=null,h=typeof i.throw=="function";if(f&&h){let{value:d,done:p}=await i.throw(o);if(await d,p)return}if(typeof i.return=="function"){let{value:d}=await i.return();await d}}u(l,"close");async function c(){for(;;){try{let{value:o,done:f}=n?await i.next():i.next();if(f)s.push(null);else{let h=o&&typeof o.then=="function"?await o:o;if(h===null)throw a=!1,new R4;if(s.push(h))continue;a=!1}}catch(o){s.destroy(o)}break}}return u(c,"next"),s}u(A4,"from");FA.exports=A4});var yc=x((Ore,UA)=>{"use strict";var wr=Hi(),{ArrayPrototypeIndexOf:P4,NumberIsInteger:N4,NumberIsNaN:D4,NumberParseInt:C4,ObjectDefineProperties:h0,ObjectKeys:I4,ObjectSetPrototypeOf:xA,Promise:OA,SafeSet:$4,SymbolAsyncDispose:B4,SymbolAsyncIterator:L4,Symbol:M4}=Ee();UA.exports=Z;Z.ReadableState=fd;var{EventEmitter:j4}=ne("events"),{Stream:Gi,prependListener:q4}=nd(),{Buffer:s0}=ne("buffer"),{addAbortSignal:U4}=dc(),RA=ai(),X=vt().debuglog("stream",t=>{X=t}),z4=dA(),eo=Ln(),{getHighWaterMark:W4,getDefaultHighWaterMark:H4}=pc(),{aggregateTwoErrors:kA,codes:{ERR_INVALID_ARG_TYPE:V4,ERR_METHOD_NOT_IMPLEMENTED:G4,ERR_OUT_OF_RANGE:Z4,ERR_STREAM_PUSH_AFTER_EOF:K4,ERR_STREAM_UNSHIFT_AFTER_END_EVENT:J4},AbortError:Y4}=ut(),{validateObject:X4}=Ka(),Mn=M4("kPaused"),{StringDecoder:AA}=_A(),Q4=n0();xA(Z.prototype,Gi.prototype);xA(Z,Gi);var a0=u(()=>{},"nop"),{errorOrDestroy:Xa}=eo,Qa=1,ez=2,PA=4,wc=8,NA=16,od=32,ld=64,DA=128,tz=256,rz=512,iz=1024,f0=2048,u0=4096,nz=8192,sz=16384,az=32768,CA=65536,oz=1<<17,lz=1<<18;function ze(t){return{enumerable:!1,get(){return(this.state&t)!==0},set(e){e?this.state|=t:this.state&=~t}}}u(ze,"makeBitMapDescriptor");h0(fd.prototype,{objectMode:ze(Qa),ended:ze(ez),endEmitted:ze(PA),reading:ze(wc),constructed:ze(NA),sync:ze(od),needReadable:ze(ld),emittedReadable:ze(DA),readableListening:ze(tz),resumeScheduled:ze(rz),errorEmitted:ze(iz),emitClose:ze(f0),autoDestroy:ze(u0),destroyed:ze(nz),closed:ze(sz),closeEmitted:ze(az),multiAwaitDrain:ze(CA),readingMore:ze(oz),dataEmitted:ze(lz)});function fd(t,e,r){typeof r!="boolean"&&(r=e instanceof Br()),this.state=f0|u0|NA|od,t&&t.objectMode&&(this.state|=Qa),r&&t&&t.readableObjectMode&&(this.state|=Qa),this.highWaterMark=t?W4(this,t,"readableHighWaterMark",r):H4(!1),this.buffer=new z4,this.length=0,this.pipes=[],this.flowing=null,this[Mn]=null,t&&t.emitClose===!1&&(this.state&=~f0),t&&t.autoDestroy===!1&&(this.state&=~u0),this.errored=null,this.defaultEncoding=t&&t.defaultEncoding||"utf8",this.awaitDrainWriters=null,this.decoder=null,this.encoding=null,t&&t.encoding&&(this.decoder=new AA(t.encoding),this.encoding=t.encoding)}u(fd,"ReadableState");function Z(t){if(!(this instanceof Z))return new Z(t);let e=this instanceof Br();this._readableState=new fd(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&&U4(t.signal,this)),Gi.call(this,t),eo.construct(this,()=>{this._readableState.needReadable&&cd(this,this._readableState)})}u(Z,"Readable");Z.prototype.destroy=eo.destroy;Z.prototype._undestroy=eo.undestroy;Z.prototype._destroy=function(t,e){e(t)};Z.prototype[j4.captureRejectionSymbol]=function(t){this.destroy(t)};Z.prototype[B4]=function(){let t;return this.destroyed||(t=this.readableEnded?null:new Y4,this.destroy(t)),new OA((e,r)=>RA(this,i=>i&&i!==t?r(i):e(null)))};Z.prototype.push=function(t,e){return IA(this,t,e,!1)};Z.prototype.unshift=function(t,e){return IA(this,t,e,!0)};function IA(t,e,r,i){X("readableAddChunk",e);let n=t._readableState,s;if(n.state&Qa||(typeof e=="string"?(r=r||n.defaultEncoding,n.encoding!==r&&(i&&n.encoding?e=s0.from(e,r).toString(n.encoding):(e=s0.from(e,r),r=""))):e instanceof s0?r="":Gi._isUint8Array(e)?(e=Gi._uint8ArrayToBuffer(e),r=""):e!=null&&(s=new V4("chunk",["string","Buffer","Uint8Array"],e))),s)Xa(t,s);else if(e===null)n.state&=~wc,uz(t,n);else if(n.state&Qa||e&&e.length>0)if(i)if(n.state&PA)Xa(t,new J4);else{if(n.destroyed||n.errored)return!1;o0(t,n,e,!0)}else if(n.ended)Xa(t,new K4);else{if(n.destroyed||n.errored)return!1;n.state&=~wc,n.decoder&&!r?(e=n.decoder.write(e),n.objectMode||e.length!==0?o0(t,n,e,!1):cd(t,n)):o0(t,n,e,!1)}else i||(n.state&=~wc,cd(t,n));return!n.ended&&(n.length<n.highWaterMark||n.length===0)}u(IA,"readableAddChunk");function o0(t,e,r,i){e.flowing&&e.length===0&&!e.sync&&t.listenerCount("data")>0?(e.state&CA?e.awaitDrainWriters.clear():e.awaitDrainWriters=null,e.dataEmitted=!0,t.emit("data",r)):(e.length+=e.objectMode?1:r.length,i?e.buffer.unshift(r):e.buffer.push(r),e.state&ld&&ud(t)),cd(t,e)}u(o0,"addChunk");Z.prototype.isPaused=function(){let t=this._readableState;return t[Mn]===!0||t.flowing===!1};Z.prototype.setEncoding=function(t){let e=new AA(t);this._readableState.decoder=e,this._readableState.encoding=this._readableState.decoder.encoding;let r=this._readableState.buffer,i="";for(let n of r)i+=e.write(n);return r.clear(),i!==""&&r.push(i),this._readableState.length=i.length,this};var cz=1073741824;function fz(t){if(t>cz)throw new Z4("size","<= 1GiB",t);return t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++,t}u(fz,"computeNewHighWaterMark");function TA(t,e){return t<=0||e.length===0&&e.ended?0:e.state&Qa?1:D4(t)?e.flowing&&e.length?e.buffer.first().length:e.length:t<=e.length?t:e.ended?e.length:0}u(TA,"howMuchToRead");Z.prototype.read=function(t){X("read",t),t===void 0?t=NaN:N4(t)||(t=C4(t,10));let e=this._readableState,r=t;if(t>e.highWaterMark&&(e.highWaterMark=fz(t)),t!==0&&(e.state&=~DA),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?l0(this):ud(this),null;if(t=TA(t,e),t===0&&e.ended)return e.length===0&&l0(this),null;let i=(e.state&ld)!==0;if(X("need readable",i),(e.length===0||e.length-t<e.highWaterMark)&&(i=!0,X("length less than watermark",i)),e.ended||e.reading||e.destroyed||e.errored||!e.constructed)i=!1,X("reading, ended or constructing",i);else if(i){X("do read"),e.state|=wc|od,e.length===0&&(e.state|=ld);try{this._read(e.highWaterMark)}catch(s){Xa(this,s)}e.state&=~od,e.reading||(t=TA(r,e))}let n;return t>0?n=jA(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),r!==t&&e.ended&&l0(this)),n!==null&&!e.errorEmitted&&!e.closeEmitted&&(e.dataEmitted=!0,this.emit("data",n)),n};function uz(t,e){if(X("onEofChunk"),!e.ended){if(e.decoder){let r=e.decoder.end();r&&r.length&&(e.buffer.push(r),e.length+=e.objectMode?1:r.length)}e.ended=!0,e.sync?ud(t):(e.needReadable=!1,e.emittedReadable=!0,$A(t))}}u(uz,"onEofChunk");function ud(t){let e=t._readableState;X("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(X("emitReadable",e.flowing),e.emittedReadable=!0,wr.nextTick($A,t))}u(ud,"emitReadable");function $A(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,LA(t)}u($A,"emitReadable_");function cd(t,e){!e.readingMore&&e.constructed&&(e.readingMore=!0,wr.nextTick(hz,t,e))}u(cd,"maybeReadMore");function hz(t,e){for(;!e.reading&&!e.ended&&(e.length<e.highWaterMark||e.flowing&&e.length===0);){let r=e.length;if(X("maybeReadMore read 0"),t.read(0),r===e.length)break}e.readingMore=!1}u(hz,"maybeReadMore_");Z.prototype._read=function(t){throw new G4("_read()")};Z.prototype.pipe=function(t,e){let r=this,i=this._readableState;i.pipes.length===1&&(i.multiAwaitDrain||(i.multiAwaitDrain=!0,i.awaitDrainWriters=new $4(i.awaitDrainWriters?[i.awaitDrainWriters]:[]))),i.pipes.push(t),X("pipe count=%d opts=%j",i.pipes.length,e);let s=(!e||e.end!==!1)&&t!==wr.stdout&&t!==wr.stderr?l:g;i.endEmitted?wr.nextTick(s):r.once("end",s),t.on("unpipe",a);function a(b,_){X("onunpipe"),b===r&&_&&_.hasUnpiped===!1&&(_.hasUnpiped=!0,f())}u(a,"onunpipe");function l(){X("onend"),t.end()}u(l,"onend");let c,o=!1;function f(){X("cleanup"),t.removeListener("close",m),t.removeListener("finish",w),c&&t.removeListener("drain",c),t.removeListener("error",p),t.removeListener("unpipe",a),r.removeListener("end",l),r.removeListener("end",g),r.removeListener("data",d),o=!0,c&&i.awaitDrainWriters&&(!t._writableState||t._writableState.needDrain)&&c()}u(f,"cleanup");function h(){o||(i.pipes.length===1&&i.pipes[0]===t?(X("false write response, pause",0),i.awaitDrainWriters=t,i.multiAwaitDrain=!1):i.pipes.length>1&&i.pipes.includes(t)&&(X("false write response, pause",i.awaitDrainWriters.size),i.awaitDrainWriters.add(t)),r.pause()),c||(c=dz(r,t),t.on("drain",c))}u(h,"pause"),r.on("data",d);function d(b){X("ondata");let _=t.write(b);X("dest.write",_),_===!1&&h()}u(d,"ondata");function p(b){if(X("onerror",b),g(),t.removeListener("error",p),t.listenerCount("error")===0){let _=t._writableState||t._readableState;_&&!_.errorEmitted?Xa(t,b):t.emit("error",b)}}u(p,"onerror"),q4(t,"error",p);function m(){t.removeListener("finish",w),g()}u(m,"onclose"),t.once("close",m);function w(){X("onfinish"),t.removeListener("close",m),g()}u(w,"onfinish"),t.once("finish",w);function g(){X("unpipe"),r.unpipe(t)}return u(g,"unpipe"),t.emit("pipe",r),t.writableNeedDrain===!0?h():i.flowing||(X("pipe resume"),r.resume()),t};function dz(t,e){return u(function(){let i=t._readableState;i.awaitDrainWriters===e?(X("pipeOnDrain",1),i.awaitDrainWriters=null):i.multiAwaitDrain&&(X("pipeOnDrain",i.awaitDrainWriters.size),i.awaitDrainWriters.delete(e)),(!i.awaitDrainWriters||i.awaitDrainWriters.size===0)&&t.listenerCount("data")&&t.resume()},"pipeOnDrainFunctionResult")}u(dz,"pipeOnDrain");Z.prototype.unpipe=function(t){let e=this._readableState,r={hasUnpiped:!1};if(e.pipes.length===0)return this;if(!t){let n=e.pipes;e.pipes=[],this.pause();for(let s=0;s<n.length;s++)n[s].emit("unpipe",this,{hasUnpiped:!1});return this}let i=P4(e.pipes,t);return i===-1?this:(e.pipes.splice(i,1),e.pipes.length===0&&this.pause(),t.emit("unpipe",this,r),this)};Z.prototype.on=function(t,e){let r=Gi.prototype.on.call(this,t,e),i=this._readableState;return t==="data"?(i.readableListening=this.listenerCount("readable")>0,i.flowing!==!1&&this.resume()):t==="readable"&&!i.endEmitted&&!i.readableListening&&(i.readableListening=i.needReadable=!0,i.flowing=!1,i.emittedReadable=!1,X("on readable",i.length,i.reading),i.length?ud(this):i.reading||wr.nextTick(pz,this)),r};Z.prototype.addListener=Z.prototype.on;Z.prototype.removeListener=function(t,e){let r=Gi.prototype.removeListener.call(this,t,e);return t==="readable"&&wr.nextTick(BA,this),r};Z.prototype.off=Z.prototype.removeListener;Z.prototype.removeAllListeners=function(t){let e=Gi.prototype.removeAllListeners.apply(this,arguments);return(t==="readable"||t===void 0)&&wr.nextTick(BA,this),e};function BA(t){let e=t._readableState;e.readableListening=t.listenerCount("readable")>0,e.resumeScheduled&&e[Mn]===!1?e.flowing=!0:t.listenerCount("data")>0?t.resume():e.readableListening||(e.flowing=null)}u(BA,"updateReadableListening");function pz(t){X("readable nexttick read 0"),t.read(0)}u(pz,"nReadingNextTick");Z.prototype.resume=function(){let t=this._readableState;return t.flowing||(X("resume"),t.flowing=!t.readableListening,mz(this,t)),t[Mn]=!1,this};function mz(t,e){e.resumeScheduled||(e.resumeScheduled=!0,wr.nextTick(wz,t,e))}u(mz,"resume");function wz(t,e){X("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),LA(t),e.flowing&&!e.reading&&t.read(0)}u(wz,"resume_");Z.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[Mn]=!0,this};function LA(t){let e=t._readableState;for(X("flow",e.flowing);e.flowing&&t.read()!==null;);}u(LA,"flow");Z.prototype.wrap=function(t){let e=!1;t.on("data",i=>{!this.push(i)&&t.pause&&(e=!0,t.pause())}),t.on("end",()=>{this.push(null)}),t.on("error",i=>{Xa(this,i)}),t.on("close",()=>{this.destroy()}),t.on("destroy",()=>{this.destroy()}),this._read=()=>{e&&t.resume&&(e=!1,t.resume())};let r=I4(t);for(let i=1;i<r.length;i++){let n=r[i];this[n]===void 0&&typeof t[n]=="function"&&(this[n]=t[n].bind(t))}return this};Z.prototype[L4]=function(){return MA(this)};Z.prototype.iterator=function(t){return t!==void 0&&X4(t,"options"),MA(this,t)};function MA(t,e){typeof t.read!="function"&&(t=Z.wrap(t,{objectMode:!0}));let r=yz(t,e);return r.stream=t,r}u(MA,"streamToAsyncIterator");async function*yz(t,e){let r=a0;function i(a){this===t?(r(),r=a0):r=a}u(i,"next"),t.on("readable",i);let n,s=RA(t,{writable:!1},a=>{n=a?kA(n,a):null,r(),r=a0});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 OA(i)}}}catch(a){throw n=kA(n,a),n}finally{(n||e?.destroyOnReturn!==!1)&&(n===void 0||t._readableState.autoDestroy)?eo.destroyer(t,null):(t.off("readable",i),s())}}u(yz,"createAsyncIterator");h0(Z.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:u(function(){return this._readableState.dataEmitted},"get")},readableAborted:{__proto__:null,enumerable:!1,get:u(function(){return!!(this._readableState.readable!==!1&&(this._readableState.destroyed||this._readableState.errored)&&!this._readableState.endEmitted)},"get")},readableHighWaterMark:{__proto__:null,enumerable:!1,get:u(function(){return this._readableState.highWaterMark},"get")},readableBuffer:{__proto__:null,enumerable:!1,get:u(function(){return this._readableState&&this._readableState.buffer},"get")},readableFlowing:{__proto__:null,enumerable:!1,get:u(function(){return this._readableState.flowing},"get"),set:u(function(t){this._readableState&&(this._readableState.flowing=t)},"set")},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}}});h0(fd.prototype,{pipesCount:{__proto__:null,get(){return this.pipes.length}},paused:{__proto__:null,get(){return this[Mn]!==!1},set(t){this[Mn]=!!t}}});Z._fromList=jA;function jA(t,e){if(e.length===0)return null;let r;return e.objectMode?r=e.buffer.shift():!t||t>=e.length?(e.decoder?r=e.buffer.join(""):e.buffer.length===1?r=e.buffer.first():r=e.buffer.concat(e.length),e.buffer.clear()):r=e.buffer.consume(t,e.decoder),r}u(jA,"fromList");function l0(t){let e=t._readableState;X("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,wr.nextTick(gz,e,t))}u(l0,"endReadable");function gz(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)wr.nextTick(bz,e);else if(t.autoDestroy){let r=e._writableState;(!r||r.autoDestroy&&(r.finished||r.writable===!1))&&e.destroy()}}}u(gz,"endReadableNT");function bz(t){t.writable&&!t.writableEnded&&!t.destroyed&&t.end()}u(bz,"endWritableNT");Z.from=function(t,e){return Q4(Z,t,e)};var c0;function qA(){return c0===void 0&&(c0={}),c0}u(qA,"lazyWebStreams");Z.fromWeb=function(t,e){return qA().newStreamReadableFromReadableStream(t,e)};Z.toWeb=function(t,e){return qA().newReadableStreamFromStreamReadable(t,e)};Z.wrap=function(t,e){var r,i;return new Z({objectMode:(r=(i=t.readableObjectMode)!==null&&i!==void 0?i:t.objectMode)!==null&&r!==void 0?r:!0,...e,destroy(n,s){eo.destroyer(t,n),s(n)}}).wrap(t)}});var wd=x((Are,eP)=>{"use strict";var jn=Hi(),{ArrayPrototypeSlice:HA,Error:_z,FunctionPrototypeSymbolHasInstance:VA,ObjectDefineProperty:GA,ObjectDefineProperties:vz,ObjectSetPrototypeOf:ZA,StringPrototypeToLowerCase:Sz,Symbol:Ez,SymbolHasInstance:Fz}=Ee();eP.exports=xe;xe.WritableState=_c;var{EventEmitter:kz}=ne("events"),gc=nd().Stream,{Buffer:hd}=ne("buffer"),md=Ln(),{addAbortSignal:Tz}=dc(),{getHighWaterMark:xz,getDefaultHighWaterMark:Oz}=pc(),{ERR_INVALID_ARG_TYPE:Rz,ERR_METHOD_NOT_IMPLEMENTED:Az,ERR_MULTIPLE_CALLBACK:KA,ERR_STREAM_CANNOT_PIPE:Pz,ERR_STREAM_DESTROYED:bc,ERR_STREAM_ALREADY_FINISHED:Nz,ERR_STREAM_NULL_VALUES:Dz,ERR_STREAM_WRITE_AFTER_END:Cz,ERR_UNKNOWN_ENCODING:JA}=ut().codes,{errorOrDestroy:to}=md;ZA(xe.prototype,gc.prototype);ZA(xe,gc);function m0(){}u(m0,"nop");var ro=Ez("kOnFinished");function _c(t,e,r){typeof r!="boolean"&&(r=e instanceof Br()),this.objectMode=!!(t&&t.objectMode),r&&(this.objectMode=this.objectMode||!!(t&&t.writableObjectMode)),this.highWaterMark=t?xz(this,t,"writableHighWaterMark",r):Oz(!1),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;let i=!!(t&&t.decodeStrings===!1);this.decodeStrings=!i,this.defaultEncoding=t&&t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=$z.bind(void 0,e),this.writecb=null,this.writelen=0,this.afterWriteTickInfo=null,pd(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[ro]=[]}u(_c,"WritableState");function pd(t){t.buffered=[],t.bufferedIndex=0,t.allBuffers=!0,t.allNoop=!0}u(pd,"resetBuffer");_c.prototype.getBuffer=u(function(){return HA(this.buffered,this.bufferedIndex)},"getBuffer");GA(_c.prototype,"bufferedRequestCount",{__proto__:null,get(){return this.buffered.length-this.bufferedIndex}});function xe(t){let e=this instanceof Br();if(!e&&!VA(xe,this))return new xe(t);this._writableState=new _c(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&&Tz(t.signal,this)),gc.call(this,t),md.construct(this,()=>{let r=this._writableState;r.writing||y0(this,r),g0(this,r)})}u(xe,"Writable");GA(xe,Fz,{__proto__:null,value:u(function(t){return VA(this,t)?!0:this!==xe?!1:t&&t._writableState instanceof _c},"value")});xe.prototype.pipe=function(){to(this,new Pz)};function YA(t,e,r,i){let n=t._writableState;if(typeof r=="function")i=r,r=n.defaultEncoding;else{if(!r)r=n.defaultEncoding;else if(r!=="buffer"&&!hd.isEncoding(r))throw new JA(r);typeof i!="function"&&(i=m0)}if(e===null)throw new Dz;if(!n.objectMode)if(typeof e=="string")n.decodeStrings!==!1&&(e=hd.from(e,r),r="buffer");else if(e instanceof hd)r="buffer";else if(gc._isUint8Array(e))e=gc._uint8ArrayToBuffer(e),r="buffer";else throw new Rz("chunk",["string","Buffer","Uint8Array"],e);let s;return n.ending?s=new Cz:n.destroyed&&(s=new bc("write")),s?(jn.nextTick(i,s),to(t,s,!0),s):(n.pendingcb++,Iz(t,n,e,r,i))}u(YA,"_write");xe.prototype.write=function(t,e,r){return YA(this,t,e,r)===!0};xe.prototype.cork=function(){this._writableState.corked++};xe.prototype.uncork=function(){let t=this._writableState;t.corked&&(t.corked--,t.writing||y0(this,t))};xe.prototype.setDefaultEncoding=u(function(e){if(typeof e=="string"&&(e=Sz(e)),!hd.isEncoding(e))throw new JA(e);return this._writableState.defaultEncoding=e,this},"setDefaultEncoding");function Iz(t,e,r,i,n){let s=e.objectMode?1:r.length;e.length+=s;let a=e.length<e.highWaterMark;return a||(e.needDrain=!0),e.writing||e.corked||e.errored||!e.constructed?(e.buffered.push({chunk:r,encoding:i,callback:n}),e.allBuffers&&i!=="buffer"&&(e.allBuffers=!1),e.allNoop&&n!==m0&&(e.allNoop=!1)):(e.writelen=s,e.writecb=n,e.writing=!0,e.sync=!0,t._write(r,i,e.onwrite),e.sync=!1),a&&!e.errored&&!e.destroyed}u(Iz,"writeOrBuffer");function zA(t,e,r,i,n,s,a){e.writelen=i,e.writecb=a,e.writing=!0,e.sync=!0,e.destroyed?e.onwrite(new bc("write")):r?t._writev(n,e.onwrite):t._write(n,s,e.onwrite),e.sync=!1}u(zA,"doWrite");function WA(t,e,r,i){--e.pendingcb,i(r),w0(e),to(t,r)}u(WA,"onwriteError");function $z(t,e){let r=t._writableState,i=r.sync,n=r.writecb;if(typeof n!="function"){to(t,new KA);return}r.writing=!1,r.writecb=null,r.length-=r.writelen,r.writelen=0,e?(e.stack,r.errored||(r.errored=e),t._readableState&&!t._readableState.errored&&(t._readableState.errored=e),i?jn.nextTick(WA,t,r,e,n):WA(t,r,e,n)):(r.buffered.length>r.bufferedIndex&&y0(t,r),i?r.afterWriteTickInfo!==null&&r.afterWriteTickInfo.cb===n?r.afterWriteTickInfo.count++:(r.afterWriteTickInfo={count:1,cb:n,stream:t,state:r},jn.nextTick(Bz,r.afterWriteTickInfo)):XA(t,r,1,n))}u($z,"onwrite");function Bz({stream:t,state:e,count:r,cb:i}){return e.afterWriteTickInfo=null,XA(t,e,r,i)}u(Bz,"afterWriteTick");function XA(t,e,r,i){for(!e.ending&&!t.destroyed&&e.length===0&&e.needDrain&&(e.needDrain=!1,t.emit("drain"));r-- >0;)e.pendingcb--,i();e.destroyed&&w0(e),g0(t,e)}u(XA,"afterWrite");function w0(t){if(t.writing)return;for(let n=t.bufferedIndex;n<t.buffered.length;++n){var e;let{chunk:s,callback:a}=t.buffered[n],l=t.objectMode?1:s.length;t.length-=l,a((e=t.errored)!==null&&e!==void 0?e:new bc("write"))}let r=t[ro].splice(0);for(let n=0;n<r.length;n++){var i;r[n]((i=t.errored)!==null&&i!==void 0?i:new bc("end"))}pd(t)}u(w0,"errorBuffer");function y0(t,e){if(e.corked||e.bufferProcessing||e.destroyed||!e.constructed)return;let{buffered:r,bufferedIndex:i,objectMode:n}=e,s=r.length-i;if(!s)return;let a=i;if(e.bufferProcessing=!0,s>1&&t._writev){e.pendingcb-=s-1;let l=e.allNoop?m0:o=>{for(let f=a;f<r.length;++f)r[f].callback(o)},c=e.allNoop&&a===0?r:HA(r,a);c.allBuffers=e.allBuffers,zA(t,e,!0,e.length,c,"",l),pd(e)}else{do{let{chunk:l,encoding:c,callback:o}=r[a];r[a++]=null;let f=n?1:l.length;zA(t,e,!1,f,l,c,o)}while(a<r.length&&!e.writing);a===r.length?pd(e):a>256?(r.splice(0,a),e.bufferedIndex=0):e.bufferedIndex=a}e.bufferProcessing=!1}u(y0,"clearBuffer");xe.prototype._write=function(t,e,r){if(this._writev)this._writev([{chunk:t,encoding:e}],r);else throw new Az("_write()")};xe.prototype._writev=null;xe.prototype.end=function(t,e,r){let i=this._writableState;typeof t=="function"?(r=t,t=null,e=null):typeof e=="function"&&(r=e,e=null);let n;if(t!=null){let s=YA(this,t,e);s instanceof _z&&(n=s)}return i.corked&&(i.corked=1,this.uncork()),n||(!i.errored&&!i.ending?(i.ending=!0,g0(this,i,!0),i.ended=!0):i.finished?n=new Nz("end"):i.destroyed&&(n=new bc("end"))),typeof r=="function"&&(n||i.finished?jn.nextTick(r,n):i[ro].push(r)),this};function dd(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}u(dd,"needFinish");function Lz(t,e){let r=!1;function i(n){if(r){to(t,n??KA());return}if(r=!0,e.pendingcb--,n){let s=e[ro].splice(0);for(let a=0;a<s.length;a++)s[a](n);to(t,n,e.sync)}else dd(e)&&(e.prefinished=!0,t.emit("prefinish"),e.pendingcb++,jn.nextTick(p0,t,e))}u(i,"onFinish"),e.sync=!0,e.pendingcb++;try{t._final(i)}catch(n){i(n)}e.sync=!1}u(Lz,"callFinal");function Mz(t,e){!e.prefinished&&!e.finalCalled&&(typeof t._final=="function"&&!e.destroyed?(e.finalCalled=!0,Lz(t,e)):(e.prefinished=!0,t.emit("prefinish")))}u(Mz,"prefinish");function g0(t,e,r){dd(e)&&(Mz(t,e),e.pendingcb===0&&(r?(e.pendingcb++,jn.nextTick((i,n)=>{dd(n)?p0(i,n):n.pendingcb--},t,e)):dd(e)&&(e.pendingcb++,p0(t,e))))}u(g0,"finishMaybe");function p0(t,e){e.pendingcb--,e.finished=!0;let r=e[ro].splice(0);for(let i=0;i<r.length;i++)r[i]();if(t.emit("finish"),e.autoDestroy){let i=t._readableState;(!i||i.autoDestroy&&(i.endEmitted||i.readable===!1))&&t.destroy()}}u(p0,"finish");vz(xe.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:u(function(){return!!(this._writableState.writable!==!1&&(this._writableState.destroyed||this._writableState.errored)&&!this._writableState.finished)},"get")}});var jz=md.destroy;xe.prototype.destroy=function(t,e){let r=this._writableState;return!r.destroyed&&(r.bufferedIndex<r.buffered.length||r[ro].length)&&jn.nextTick(w0,r),jz.call(this,t,e),this};xe.prototype._undestroy=md.undestroy;xe.prototype._destroy=function(t,e){e(t)};xe.prototype[kz.captureRejectionSymbol]=function(t){this.destroy(t)};var d0;function QA(){return d0===void 0&&(d0={}),d0}u(QA,"lazyWebStreams");xe.fromWeb=function(t,e){return QA().newStreamWritableFromWritableStream(t,e)};xe.toWeb=function(t){return QA().newWritableStreamFromStreamWritable(t)}});var mP=x((Nre,pP)=>{var b0=Hi(),qz=ne("buffer"),{isReadable:Uz,isWritable:zz,isIterable:tP,isNodeStream:Wz,isReadableNodeStream:rP,isWritableNodeStream:iP,isDuplexNodeStream:Hz,isReadableStream:nP,isWritableStream:sP}=Ir(),aP=ai(),{AbortError:hP,codes:{ERR_INVALID_ARG_TYPE:Vz,ERR_INVALID_RETURN_VALUE:oP}}=ut(),{destroyer:no}=Ln(),Gz=Br(),dP=yc(),Zz=wd(),{createDeferredPromise:lP}=vt(),cP=n0(),fP=globalThis.Blob||qz.Blob,Kz=u(typeof fP<"u"?function(e){return e instanceof fP}:function(e){return!1},"isBlob"),Jz=globalThis.AbortController||Ga().AbortController,{FunctionPrototypeCall:uP}=Ee(),_0=class _0 extends Gz{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)}};u(_0,"Duplexify");var Zi=_0;pP.exports=u(function t(e,r){if(Hz(e))return e;if(rP(e))return io({readable:e});if(iP(e))return io({writable:e});if(Wz(e))return io({writable:!1,readable:!1});if(nP(e))return io({readable:dP.fromWeb(e)});if(sP(e))return io({writable:Zz.fromWeb(e)});if(typeof e=="function"){let{value:n,write:s,final:a,destroy:l}=Yz(e);if(tP(n))return cP(Zi,n,{objectMode:!0,write:s,final:a,destroy:l});let c=n?.then;if(typeof c=="function"){let o,f=uP(c,n,h=>{if(h!=null)throw new oP("nully","body",h)},h=>{no(o,h)});return o=new Zi({objectMode:!0,readable:!1,write:s,final(h){a(async()=>{try{await f,b0.nextTick(h,null)}catch(d){b0.nextTick(h,d)}})},destroy:l})}throw new oP("Iterable, AsyncIterable or AsyncFunction",r,n)}if(Kz(e))return t(e.arrayBuffer());if(tP(e))return cP(Zi,e,{objectMode:!0,writable:!1});if(nP(e?.readable)&&sP(e?.writable))return Zi.fromWeb(e);if(typeof e?.writable=="object"||typeof e?.readable=="object"){let n=e!=null&&e.readable?rP(e?.readable)?e?.readable:t(e.readable):void 0,s=e!=null&&e.writable?iP(e?.writable)?e?.writable:t(e.writable):void 0;return io({readable:n,writable:s})}let i=e?.then;if(typeof i=="function"){let n;return uP(i,e,s=>{s!=null&&n.push(s),n.push(null)},s=>{no(n,s)}),n=new Zi({objectMode:!0,writable:!1,read(){}})}throw new Vz(r,["Blob","ReadableStream","WritableStream","Stream","Iterable","AsyncIterable","Function","{ readable, writable } pair","Promise"],e)},"duplexify");function Yz(t){let{promise:e,resolve:r}=lP(),i=new Jz,n=i.signal;return{value:t(async function*(){for(;;){let a=e;e=null;let{chunk:l,done:c,cb:o}=await a;if(b0.nextTick(o),c)return;if(n.aborted)throw new hP(void 0,{cause:n.reason});({promise:e,resolve:r}=lP()),yield l}}(),{signal:n}),write(a,l,c){let o=r;r=null,o({chunk:a,done:!1,cb:c})},final(a){let l=r;r=null,l({done:!0,cb:a})},destroy(a,l){i.abort(),l(a)}}}u(Yz,"fromAsyncGen");function io(t){let e=t.readable&&typeof t.readable.read!="function"?dP.wrap(t.readable):t.readable,r=t.writable,i=!!Uz(e),n=!!zz(r),s,a,l,c,o;function f(h){let d=c;c=null,d?d(h):h&&o.destroy(h)}return u(f,"onfinished"),o=new Zi({readableObjectMode:!!(e!=null&&e.readableObjectMode),writableObjectMode:!!(r!=null&&r.writableObjectMode),readable:i,writable:n}),n&&(aP(r,h=>{n=!1,h&&no(e,h),f(h)}),o._write=function(h,d,p){r.write(h,d)?p():s=p},o._final=function(h){r.end(),a=h},r.on("drain",function(){if(s){let h=s;s=null,h()}}),r.on("finish",function(){if(a){let h=a;a=null,h()}})),i&&(aP(e,h=>{i=!1,h&&no(e,h),f(h)}),e.on("readable",function(){if(l){let h=l;l=null,h()}}),e.on("end",function(){o.push(null)}),o._read=function(){for(;;){let h=e.read();if(h===null){l=o._read;return}if(!o.push(h))return}}),o._destroy=function(h,d){!h&&c!==null&&(h=new hP),l=null,s=null,a=null,c===null?d(h):(c=d,no(r,h),no(e,h))},o}u(io,"_duplexify")});var Br=x((Cre,gP)=>{"use strict";var{ObjectDefineProperties:Xz,ObjectGetOwnPropertyDescriptor:oi,ObjectKeys:Qz,ObjectSetPrototypeOf:wP}=Ee();gP.exports=yr;var E0=yc(),ir=wd();wP(yr.prototype,E0.prototype);wP(yr,E0);{let t=Qz(ir.prototype);for(let e=0;e<t.length;e++){let r=t[e];yr.prototype[r]||(yr.prototype[r]=ir.prototype[r])}}function yr(t){if(!(this instanceof yr))return new yr(t);E0.call(this,t),ir.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}u(yr,"Duplex");Xz(yr.prototype,{writable:{__proto__:null,...oi(ir.prototype,"writable")},writableHighWaterMark:{__proto__:null,...oi(ir.prototype,"writableHighWaterMark")},writableObjectMode:{__proto__:null,...oi(ir.prototype,"writableObjectMode")},writableBuffer:{__proto__:null,...oi(ir.prototype,"writableBuffer")},writableLength:{__proto__:null,...oi(ir.prototype,"writableLength")},writableFinished:{__proto__:null,...oi(ir.prototype,"writableFinished")},writableCorked:{__proto__:null,...oi(ir.prototype,"writableCorked")},writableEnded:{__proto__:null,...oi(ir.prototype,"writableEnded")},writableNeedDrain:{__proto__:null,...oi(ir.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 v0;function yP(){return v0===void 0&&(v0={}),v0}u(yP,"lazyWebStreams");yr.fromWeb=function(t,e){return yP().newStreamDuplexFromReadableWritablePair(t,e)};yr.toWeb=function(t){return yP().newReadableWritablePairFromDuplex(t)};var S0;yr.from=function(t){return S0||(S0=mP()),S0(t,"body")}});var T0=x(($re,_P)=>{"use strict";var{ObjectSetPrototypeOf:bP,Symbol:eW}=Ee();_P.exports=li;var{ERR_METHOD_NOT_IMPLEMENTED:tW}=ut().codes,k0=Br(),{getHighWaterMark:rW}=pc();bP(li.prototype,k0.prototype);bP(li,k0);var vc=eW("kCallback");function li(t){if(!(this instanceof li))return new li(t);let e=t?rW(this,t,"readableHighWaterMark",!0):null;e===0&&(t={...t,highWaterMark:null,readableHighWaterMark:e,writableHighWaterMark:t.writableHighWaterMark||0}),k0.call(this,t),this._readableState.sync=!1,this[vc]=null,t&&(typeof t.transform=="function"&&(this._transform=t.transform),typeof t.flush=="function"&&(this._flush=t.flush)),this.on("prefinish",iW)}u(li,"Transform");function F0(t){typeof this._flush=="function"&&!this.destroyed?this._flush((e,r)=>{if(e){t?t(e):this.destroy(e);return}r!=null&&this.push(r),this.push(null),t&&t()}):(this.push(null),t&&t())}u(F0,"final");function iW(){this._final!==F0&&F0.call(this)}u(iW,"prefinish");li.prototype._final=F0;li.prototype._transform=function(t,e,r){throw new tW("_transform()")};li.prototype._write=function(t,e,r){let i=this._readableState,n=this._writableState,s=i.length;this._transform(t,e,(a,l)=>{if(a){r(a);return}l!=null&&this.push(l),n.ended||s===i.length||i.length<i.highWaterMark?r():this[vc]=r})};li.prototype._read=function(){if(this[vc]){let t=this[vc];this[vc]=null,t()}}});var O0=x((Lre,SP)=>{"use strict";var{ObjectSetPrototypeOf:vP}=Ee();SP.exports=so;var x0=T0();vP(so.prototype,x0.prototype);vP(so,x0);function so(t){if(!(this instanceof so))return new so(t);x0.call(this,t)}u(so,"PassThrough");so.prototype._transform=function(t,e,r){r(null,t)}});var _d=x((jre,xP)=>{var Sc=Hi(),{ArrayIsArray:nW,Promise:sW,SymbolAsyncIterator:aW,SymbolDispose:oW}=Ee(),bd=ai(),{once:lW}=vt(),cW=Ln(),EP=Br(),{aggregateTwoErrors:fW,codes:{ERR_INVALID_ARG_TYPE:B0,ERR_INVALID_RETURN_VALUE:R0,ERR_MISSING_ARGS:uW,ERR_STREAM_DESTROYED:hW,ERR_STREAM_PREMATURE_CLOSE:dW},AbortError:pW}=ut(),{validateFunction:mW,validateAbortSignal:wW}=Ka(),{isIterable:qn,isReadable:A0,isReadableNodeStream:gd,isNodeStream:FP,isTransformStream:ao,isWebStream:yW,isReadableStream:P0,isReadableFinished:gW}=Ir(),bW=globalThis.AbortController||Ga().AbortController,N0,D0,C0;function kP(t,e,r){let i=!1;t.on("close",()=>{i=!0});let n=bd(t,{readable:e,writable:r},s=>{i=!s});return{destroy:u(s=>{i||(i=!0,cW.destroyer(t,s||new hW("pipe")))},"destroy"),cleanup:n}}u(kP,"destroyer");function _W(t){return mW(t[t.length-1],"streams[stream.length - 1]"),t.pop()}u(_W,"popCallback");function I0(t){if(qn(t))return t;if(gd(t))return vW(t);throw new B0("val",["Readable","Iterable","AsyncIterable"],t)}u(I0,"makeAsyncIterable");async function*vW(t){D0||(D0=yc()),yield*D0.prototype[aW].call(t)}u(vW,"fromReadable");async function yd(t,e,r,{end:i}){let n,s=null,a=u(o=>{if(o&&(n=o),s){let f=s;s=null,f()}},"resume"),l=u(()=>new sW((o,f)=>{n?f(n):s=u(()=>{n?f(n):o()},"onresolve")}),"wait");e.on("drain",a);let c=bd(e,{readable:!1},a);try{e.writableNeedDrain&&await l();for await(let o of t)e.write(o)||await l();i&&(e.end(),await l()),r()}catch(o){r(n!==o?fW(n,o):o)}finally{c(),e.off("drain",a)}}u(yd,"pumpToNode");async function $0(t,e,r,{end:i}){ao(e)&&(e=e.writable);let n=e.getWriter();try{for await(let s of t)await n.ready,n.write(s).catch(()=>{});await n.ready,i&&await n.close(),r()}catch(s){try{await n.abort(s),r(s)}catch(a){r(a)}}}u($0,"pumpToWeb");function SW(...t){return TP(t,lW(_W(t)))}u(SW,"pipeline");function TP(t,e,r){if(t.length===1&&nW(t[0])&&(t=t[0]),t.length<2)throw new uW("streams");let i=new bW,n=i.signal,s=r?.signal,a=[];wW(s,"options.signal");function l(){m(new pW)}u(l,"abort"),C0=C0||vt().addAbortListener;let c;s&&(c=C0(s,l));let o,f,h=[],d=0;function p(S){m(S,--d===0)}u(p,"finish");function m(S,F){var k;if(S&&(!o||o.code==="ERR_STREAM_PREMATURE_CLOSE")&&(o=S),!(!o&&!F)){for(;h.length;)h.shift()(o);(k=c)===null||k===void 0||k[oW](),i.abort(),F&&(o||a.forEach(A=>A()),Sc.nextTick(e,o,f))}}u(m,"finishImpl");let w;for(let S=0;S<t.length;S++){let F=t[S],k=S<t.length-1,A=S>0,v=k||r?.end!==!1,T=S===t.length-1;if(FP(F)){let E=function(R){R&&R.name!=="AbortError"&&R.code!=="ERR_STREAM_PREMATURE_CLOSE"&&p(R)};var _=E;if(u(E,"onError"),v){let{destroy:R,cleanup:P}=kP(F,k,A);h.push(R),A0(F)&&T&&a.push(P)}F.on("error",E),A0(F)&&T&&a.push(()=>{F.removeListener("error",E)})}if(S===0)if(typeof F=="function"){if(w=F({signal:n}),!qn(w))throw new R0("Iterable, AsyncIterable or Stream","source",w)}else qn(F)||gd(F)||ao(F)?w=F:w=EP.from(F);else if(typeof F=="function"){if(ao(w)){var g;w=I0((g=w)===null||g===void 0?void 0:g.readable)}else w=I0(w);if(w=F(w,{signal:n}),k){if(!qn(w,!0))throw new R0("AsyncIterable",`transform[${S-1}]`,w)}else{var b;N0||(N0=O0());let E=new N0({objectMode:!0}),R=(b=w)===null||b===void 0?void 0:b.then;if(typeof R=="function")d++,R.call(w,B=>{f=B,B!=null&&E.write(B),v&&E.end(),Sc.nextTick(p)},B=>{E.destroy(B),Sc.nextTick(p,B)});else if(qn(w,!0))d++,yd(w,E,p,{end:v});else if(P0(w)||ao(w)){let B=w.readable||w;d++,yd(B,E,p,{end:v})}else throw new R0("AsyncIterable or Promise","destination",w);w=E;let{destroy:P,cleanup:I}=kP(w,!1,!0);h.push(P),T&&a.push(I)}}else if(FP(F)){if(gd(w)){d+=2;let E=EW(w,F,p,{end:v});A0(F)&&T&&a.push(E)}else if(ao(w)||P0(w)){let E=w.readable||w;d++,yd(E,F,p,{end:v})}else if(qn(w))d++,yd(w,F,p,{end:v});else throw new B0("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],w);w=F}else if(yW(F)){if(gd(w))d++,$0(I0(w),F,p,{end:v});else if(P0(w)||qn(w))d++,$0(w,F,p,{end:v});else if(ao(w))d++,$0(w.readable,F,p,{end:v});else throw new B0("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],w);w=F}else w=EP.from(F)}return(n!=null&&n.aborted||s!=null&&s.aborted)&&Sc.nextTick(l),w}u(TP,"pipelineImpl");function EW(t,e,r,{end:i}){let n=!1;if(e.on("close",()=>{n||r(new dW)}),t.pipe(e,{end:!1}),i){let a=function(){n=!0,e.end()};var s=a;u(a,"endFn"),gW(t)?Sc.nextTick(a):t.once("end",a)}else r();return bd(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",r).once("error",r):r(a)}),bd(e,{readable:!1,writable:!0},r)}u(EW,"pipe");xP.exports={pipelineImpl:TP,pipeline:SW}});var M0=x((Ure,DP)=>{"use strict";var{pipeline:FW}=_d(),vd=Br(),{destroyer:kW}=Ln(),{isNodeStream:Sd,isReadable:OP,isWritable:RP,isWebStream:L0,isTransformStream:Un,isWritableStream:AP,isReadableStream:PP}=Ir(),{AbortError:TW,codes:{ERR_INVALID_ARG_VALUE:NP,ERR_MISSING_ARGS:xW}}=ut(),OW=ai();DP.exports=u(function(...e){if(e.length===0)throw new xW("streams");if(e.length===1)return vd.from(e[0]);let r=[...e];if(typeof e[0]=="function"&&(e[0]=vd.from(e[0])),typeof e[e.length-1]=="function"){let p=e.length-1;e[p]=vd.from(e[p])}for(let p=0;p<e.length;++p)if(!(!Sd(e[p])&&!L0(e[p]))){if(p<e.length-1&&!(OP(e[p])||PP(e[p])||Un(e[p])))throw new NP(`streams[${p}]`,r[p],"must be readable");if(p>0&&!(RP(e[p])||AP(e[p])||Un(e[p])))throw new NP(`streams[${p}]`,r[p],"must be writable")}let i,n,s,a,l;function c(p){let m=a;a=null,m?m(p):p?l.destroy(p):!d&&!h&&l.destroy()}u(c,"onfinished");let o=e[0],f=FW(e,c),h=!!(RP(o)||AP(o)||Un(o)),d=!!(OP(f)||PP(f)||Un(f));if(l=new vd({writableObjectMode:!!(o!=null&&o.writableObjectMode),readableObjectMode:!!(f!=null&&f.readableObjectMode),writable:h,readable:d}),h){if(Sd(o))l._write=function(m,w,g){o.write(m,w)?g():i=g},l._final=function(m){o.end(),n=m},o.on("drain",function(){if(i){let m=i;i=null,m()}});else if(L0(o)){let w=(Un(o)?o.writable:o).getWriter();l._write=async function(g,b,_){try{await w.ready,w.write(g).catch(()=>{}),_()}catch(S){_(S)}},l._final=async function(g){try{await w.ready,w.close().catch(()=>{}),n=g}catch(b){g(b)}}}let p=Un(f)?f.readable:f;OW(p,()=>{if(n){let m=n;n=null,m()}})}if(d){if(Sd(f))f.on("readable",function(){if(s){let p=s;s=null,p()}}),f.on("end",function(){l.push(null)}),l._read=function(){for(;;){let p=f.read();if(p===null){s=l._read;return}if(!l.push(p))return}};else if(L0(f)){let m=(Un(f)?f.readable:f).getReader();l._read=async function(){for(;;)try{let{value:w,done:g}=await m.read();if(!l.push(w))return;if(g){l.push(null);return}}catch{return}}}}return l._destroy=function(p,m){!p&&a!==null&&(p=new TW),s=null,i=null,n=null,a===null?m(p):(a=m,Sd(f)&&kW(f,p))},l},"compose")});var zP=x((Wre,U0)=>{"use strict";var RW=globalThis.AbortController||Ga().AbortController,{codes:{ERR_INVALID_ARG_VALUE:AW,ERR_INVALID_ARG_TYPE:Ec,ERR_MISSING_ARGS:PW,ERR_OUT_OF_RANGE:NW},AbortError:Lr}=ut(),{validateAbortSignal:zn,validateInteger:CP,validateObject:Wn}=Ka(),DW=Ee().Symbol("kWeak"),CW=Ee().Symbol("kResistStopPropagation"),{finished:IW}=ai(),$W=M0(),{addAbortSignalNoValidate:BW}=dc(),{isWritable:LW,isNodeStream:MW}=Ir(),{deprecate:jW}=vt(),{ArrayPrototypePush:qW,Boolean:UW,MathFloor:IP,Number:zW,NumberIsNaN:WW,Promise:$P,PromiseReject:BP,PromiseResolve:HW,PromisePrototypeThen:LP,Symbol:jP}=Ee(),Ed=jP("kEmpty"),MP=jP("kEof");function VW(t,e){if(e!=null&&Wn(e,"options"),e?.signal!=null&&zn(e.signal,"options.signal"),MW(t)&&!LW(t))throw new AW("stream",t,"must be writable");let r=$W(this,t);return e!=null&&e.signal&&BW(e.signal,r),r}u(VW,"compose");function Fd(t,e){if(typeof t!="function")throw new Ec("fn",["Function","AsyncFunction"],t);e!=null&&Wn(e,"options"),e?.signal!=null&&zn(e.signal,"options.signal");let r=1;e?.concurrency!=null&&(r=IP(e.concurrency));let i=r-1;return e?.highWaterMark!=null&&(i=IP(e.highWaterMark)),CP(r,"options.concurrency",1),CP(i,"options.highWaterMark",0),i+=r,u(async function*(){let s=vt().AbortSignalAny([e?.signal].filter(UW)),a=this,l=[],c={signal:s},o,f,h=!1,d=0;function p(){h=!0,m()}u(p,"onCatch");function m(){d-=1,w()}u(m,"afterItemProcessed");function w(){f&&!h&&d<r&&l.length<i&&(f(),f=null)}u(w,"maybeResume");async function g(){try{for await(let b of a){if(h)return;if(s.aborted)throw new Lr;try{if(b=t(b,c),b===Ed)continue;b=HW(b)}catch(_){b=BP(_)}d+=1,LP(b,m,p),l.push(b),o&&(o(),o=null),!h&&(l.length>=i||d>=r)&&await new $P(_=>{f=_})}l.push(MP)}catch(b){let _=BP(b);LP(_,m,p),l.push(_)}finally{h=!0,o&&(o(),o=null)}}u(g,"pump"),g();try{for(;;){for(;l.length>0;){let b=await l[0];if(b===MP)return;if(s.aborted)throw new Lr;b!==Ed&&(yield b),l.shift(),w()}await new $P(b=>{o=b})}}finally{h=!0,f&&(f(),f=null)}},"map").call(this)}u(Fd,"map");function GW(t=void 0){return t!=null&&Wn(t,"options"),t?.signal!=null&&zn(t.signal,"options.signal"),u(async function*(){let r=0;for await(let n of this){var i;if(t!=null&&(i=t.signal)!==null&&i!==void 0&&i.aborted)throw new Lr({cause:t.signal.reason});yield[r++,n]}},"asIndexedPairs").call(this)}u(GW,"asIndexedPairs");async function qP(t,e=void 0){for await(let r of q0.call(this,t,e))return!0;return!1}u(qP,"some");async function ZW(t,e=void 0){if(typeof t!="function")throw new Ec("fn",["Function","AsyncFunction"],t);return!await qP.call(this,async(...r)=>!await t(...r),e)}u(ZW,"every");async function KW(t,e){for await(let r of q0.call(this,t,e))return r}u(KW,"find");async function JW(t,e){if(typeof t!="function")throw new Ec("fn",["Function","AsyncFunction"],t);async function r(i,n){return await t(i,n),Ed}u(r,"forEachFn");for await(let i of Fd.call(this,r,e));}u(JW,"forEach");function q0(t,e){if(typeof t!="function")throw new Ec("fn",["Function","AsyncFunction"],t);async function r(i,n){return await t(i,n)?i:Ed}return u(r,"filterFn"),Fd.call(this,r,e)}u(q0,"filter");var z0=class z0 extends PW{constructor(){super("reduce"),this.message="Reduce of an empty stream requires an initial value"}};u(z0,"ReduceAwareErrMissingArgs");var j0=z0;async function YW(t,e,r){var i;if(typeof t!="function")throw new Ec("reducer",["Function","AsyncFunction"],t);r!=null&&Wn(r,"options"),r?.signal!=null&&zn(r.signal,"options.signal");let n=arguments.length>1;if(r!=null&&(i=r.signal)!==null&&i!==void 0&&i.aborted){let o=new Lr(void 0,{cause:r.signal.reason});throw this.once("error",()=>{}),await IW(this.destroy(o)),o}let s=new RW,a=s.signal;if(r!=null&&r.signal){let o={once:!0,[DW]:this,[CW]:!0};r.signal.addEventListener("abort",()=>s.abort(),o)}let l=!1;try{for await(let o of this){var c;if(l=!0,r!=null&&(c=r.signal)!==null&&c!==void 0&&c.aborted)throw new Lr;n?e=await t(e,o,{signal:a}):(e=o,n=!0)}if(!l&&!n)throw new j0}finally{s.abort()}return e}u(YW,"reduce");async function XW(t){t!=null&&Wn(t,"options"),t?.signal!=null&&zn(t.signal,"options.signal");let e=[];for await(let i of this){var r;if(t!=null&&(r=t.signal)!==null&&r!==void 0&&r.aborted)throw new Lr(void 0,{cause:t.signal.reason});qW(e,i)}return e}u(XW,"toArray");function QW(t,e){let r=Fd.call(this,t,e);return u(async function*(){for await(let n of r)yield*n},"flatMap").call(this)}u(QW,"flatMap");function UP(t){if(t=zW(t),WW(t))return 0;if(t<0)throw new NW("number",">= 0",t);return t}u(UP,"toIntegerOrInfinity");function eH(t,e=void 0){return e!=null&&Wn(e,"options"),e?.signal!=null&&zn(e.signal,"options.signal"),t=UP(t),u(async function*(){var i;if(e!=null&&(i=e.signal)!==null&&i!==void 0&&i.aborted)throw new Lr;for await(let s of this){var n;if(e!=null&&(n=e.signal)!==null&&n!==void 0&&n.aborted)throw new Lr;t--<=0&&(yield s)}},"drop").call(this)}u(eH,"drop");function tH(t,e=void 0){return e!=null&&Wn(e,"options"),e?.signal!=null&&zn(e.signal,"options.signal"),t=UP(t),u(async function*(){var i;if(e!=null&&(i=e.signal)!==null&&i!==void 0&&i.aborted)throw new Lr;for await(let s of this){var n;if(e!=null&&(n=e.signal)!==null&&n!==void 0&&n.aborted)throw new Lr;if(t-- >0&&(yield s),t<=0)return}},"take").call(this)}u(tH,"take");U0.exports.streamReturningOperators={asIndexedPairs:jW(GW,"readable.asIndexedPairs will be removed in a future version."),drop:eH,filter:q0,flatMap:QW,map:Fd,take:tH,compose:VW};U0.exports.promiseReturningOperators={every:ZW,forEach:JW,reduce:YW,toArray:XW,some:qP,find:KW}});var W0=x((Vre,WP)=>{"use strict";var{ArrayPrototypePop:rH,Promise:iH}=Ee(),{isIterable:nH,isNodeStream:sH,isWebStream:aH}=Ir(),{pipelineImpl:oH}=_d(),{finished:lH}=ai();H0();function cH(...t){return new iH((e,r)=>{let i,n,s=t[t.length-1];if(s&&typeof s=="object"&&!sH(s)&&!nH(s)&&!aH(s)){let a=rH(t);i=a.signal,n=a.end}oH(t,(a,l)=>{a?r(a):e(l)},{signal:i,end:n})})}u(cH,"pipeline");WP.exports={finished:lH,pipeline:cH}});var H0=x((Zre,QP)=>{"use strict";var{Buffer:fH}=ne("buffer"),{ObjectDefineProperty:ci,ObjectKeys:GP,ReflectApply:ZP}=Ee(),{promisify:{custom:KP}}=vt(),{streamReturningOperators:HP,promiseReturningOperators:VP}=zP(),{codes:{ERR_ILLEGAL_CONSTRUCTOR:JP}}=ut(),uH=M0(),{setDefaultHighWaterMark:hH,getDefaultHighWaterMark:dH}=pc(),{pipeline:YP}=_d(),{destroyer:pH}=Ln(),XP=ai(),V0=W0(),Fc=Ir(),_e=QP.exports=nd().Stream;_e.isDestroyed=Fc.isDestroyed;_e.isDisturbed=Fc.isDisturbed;_e.isErrored=Fc.isErrored;_e.isReadable=Fc.isReadable;_e.isWritable=Fc.isWritable;_e.Readable=yc();for(let t of GP(HP)){let r=function(...i){if(new.target)throw JP();return _e.Readable.from(ZP(e,this,i))};u(r,"fn");let e=HP[t];ci(r,"name",{__proto__:null,value:e.name}),ci(r,"length",{__proto__:null,value:e.length}),ci(_e.Readable.prototype,t,{__proto__:null,value:r,enumerable:!1,configurable:!0,writable:!0})}for(let t of GP(VP)){let r=function(...i){if(new.target)throw JP();return ZP(e,this,i)};u(r,"fn");let e=VP[t];ci(r,"name",{__proto__:null,value:e.name}),ci(r,"length",{__proto__:null,value:e.length}),ci(_e.Readable.prototype,t,{__proto__:null,value:r,enumerable:!1,configurable:!0,writable:!0})}_e.Writable=wd();_e.Duplex=Br();_e.Transform=T0();_e.PassThrough=O0();_e.pipeline=YP;var{addAbortSignal:mH}=dc();_e.addAbortSignal=mH;_e.finished=XP;_e.destroy=pH;_e.compose=uH;_e.setDefaultHighWaterMark=hH;_e.getDefaultHighWaterMark=dH;ci(_e,"promises",{__proto__:null,configurable:!0,enumerable:!0,get(){return V0}});ci(YP,KP,{__proto__:null,enumerable:!0,get(){return V0.pipeline}});ci(XP,KP,{__proto__:null,enumerable:!0,get(){return V0.finished}});_e.Stream=_e;_e._isUint8Array=u(function(e){return e instanceof Uint8Array},"isUint8Array");_e._uint8ArrayToBuffer=u(function(e){return fH.from(e.buffer,e.byteOffset,e.byteLength)},"_uint8ArrayToBuffer")});var eN=x((Jre,Y)=>{"use strict";var We=ne("stream");if(We&&process.env.READABLE_STREAM==="disable"){let t=We.promises;Y.exports._uint8ArrayToBuffer=We._uint8ArrayToBuffer,Y.exports._isUint8Array=We._isUint8Array,Y.exports.isDisturbed=We.isDisturbed,Y.exports.isErrored=We.isErrored,Y.exports.isReadable=We.isReadable,Y.exports.Readable=We.Readable,Y.exports.Writable=We.Writable,Y.exports.Duplex=We.Duplex,Y.exports.Transform=We.Transform,Y.exports.PassThrough=We.PassThrough,Y.exports.addAbortSignal=We.addAbortSignal,Y.exports.finished=We.finished,Y.exports.destroy=We.destroy,Y.exports.pipeline=We.pipeline,Y.exports.compose=We.compose,Object.defineProperty(We,"promises",{configurable:!0,enumerable:!0,get(){return t}}),Y.exports.Stream=We.Stream}else{let t=H0(),e=W0(),r=t.Readable.destroy;Y.exports=t.Readable,Y.exports._uint8ArrayToBuffer=t._uint8ArrayToBuffer,Y.exports._isUint8Array=t._isUint8Array,Y.exports.isDisturbed=t.isDisturbed,Y.exports.isErrored=t.isErrored,Y.exports.isReadable=t.isReadable,Y.exports.Readable=t.Readable,Y.exports.Writable=t.Writable,Y.exports.Duplex=t.Duplex,Y.exports.Transform=t.Transform,Y.exports.PassThrough=t.PassThrough,Y.exports.addAbortSignal=t.addAbortSignal,Y.exports.finished=t.finished,Y.exports.destroy=t.destroy,Y.exports.destroy=r,Y.exports.pipeline=t.pipeline,Y.exports.compose=t.compose,Object.defineProperty(t,"promises",{configurable:!0,enumerable:!0,get(){return e}}),Y.exports.Stream=t.Stream}Y.exports.default=Y.exports});var vr=x(Do=>{"use strict";Object.defineProperty(Do,"__esModule",{value:!0});Do.constants=Do.SEP=void 0;Do.SEP="/";Do.constants={O_RDONLY:0,O_WRONLY:1,O_RDWR:2,S_IFMT:61440,S_IFREG:32768,S_IFDIR:16384,S_IFCHR:8192,S_IFBLK:24576,S_IFIFO:4096,S_IFLNK:40960,S_IFSOCK:49152,O_CREAT:64,O_EXCL:128,O_NOCTTY:256,O_TRUNC:512,O_APPEND:1024,O_DIRECTORY:65536,O_NOATIME:262144,O_NOFOLLOW:131072,O_SYNC:1052672,O_SYMLINK:2097152,O_DIRECT:16384,O_NONBLOCK:2048,S_IRWXU:448,S_IRUSR:256,S_IWUSR:128,S_IXUSR:64,S_IRWXG:56,S_IRGRP:32,S_IWGRP:16,S_IXGRP:8,S_IRWXO:7,S_IROTH:4,S_IWOTH:2,S_IXOTH:1,F_OK:0,R_OK:4,W_OK:2,X_OK:1,UV_FS_SYMLINK_DIR:1,UV_FS_SYMLINK_JUNCTION:2,UV_FS_COPYFILE_EXCL:1,UV_FS_COPYFILE_FICLONE:2,UV_FS_COPYFILE_FICLONE_FORCE:4,COPYFILE_EXCL:1,COPYFILE_FICLONE:2,COPYFILE_FICLONE_FORCE:4}});var Ab=x(Wc=>{"use strict";Object.defineProperty(Wc,"__esModule",{value:!0});Wc.Stats=void 0;var cV=vr(),{S_IFMT:fV,S_IFDIR:uV,S_IFREG:hV,S_IFBLK:dV,S_IFCHR:pV,S_IFLNK:mV,S_IFIFO:wV,S_IFSOCK:yV}=cV.constants,tp=class tp{static build(e,r=!1){let i=new tp,{uid:n,gid:s,atime:a,mtime:l,ctime:c}=e,o=r?h=>BigInt(h):h=>h;i.uid=o(n),i.gid=o(s),i.rdev=o(e.rdev),i.blksize=o(4096),i.ino=o(e.ino),i.size=o(e.getSize()),i.blocks=o(1),i.atime=a,i.mtime=l,i.ctime=c,i.birthtime=c,i.atimeMs=o(a.getTime()),i.mtimeMs=o(l.getTime());let f=o(c.getTime());if(i.ctimeMs=f,i.birthtimeMs=f,r){i.atimeNs=BigInt(a.getTime())*BigInt(1e6),i.mtimeNs=BigInt(l.getTime())*BigInt(1e6);let h=BigInt(c.getTime())*BigInt(1e6);i.ctimeNs=h,i.birthtimeNs=h}return i.dev=o(0),i.mode=o(e.mode),i.nlink=o(e.nlink),i}_checkModeProperty(e){return(Number(this.mode)&fV)===e}isDirectory(){return this._checkModeProperty(uV)}isFile(){return this._checkModeProperty(hV)}isBlockDevice(){return this._checkModeProperty(dV)}isCharacterDevice(){return this._checkModeProperty(pV)}isSymbolicLink(){return this._checkModeProperty(mV)}isFIFO(){return this._checkModeProperty(wV)}isSocket(){return this._checkModeProperty(yV)}};u(tp,"Stats");var ep=tp;Wc.Stats=ep;Wc.default=ep});var bC=x(rp=>{"use strict";Object.defineProperty(rp,"__esModule",{value:!0});rp.Buffer=void 0;var gV=ne("node:buffer");Object.defineProperty(rp,"Buffer",{enumerable:!0,get:u(function(){return gV.Buffer},"get")})});var nn=x(rn=>{"use strict";Object.defineProperty(rn,"__esModule",{value:!0});rn.bufferFrom=rn.bufferAllocUnsafe=rn.Buffer=void 0;var ip=bC();Object.defineProperty(rn,"Buffer",{enumerable:!0,get:u(function(){return ip.Buffer},"get")});function _C(t,...e){return new ip.Buffer(t,...e)}u(_C,"bufferV0P12Ponyfill");var bV=ip.Buffer.allocUnsafe||_C;rn.bufferAllocUnsafe=bV;var _V=ip.Buffer.from||_C;rn.bufferFrom=_V});var Nb=x(Co=>{"use strict";Object.defineProperty(Co,"__esModule",{value:!0});Co.inherits=vV;Co.promisify=SV;Co.inspect=Pb;Co.format=EV;function vV(t,e){if(t==null)throw new TypeError("The constructor to inherit from is not defined");if(e==null)throw new TypeError("The super constructor to inherit from is not defined");t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}u(vV,"inherits");function SV(t){if(typeof t!="function")throw new TypeError('The "original" argument must be of type function');return function(...e){return new Promise((r,i)=>{t.call(this,...e,(n,s)=>{n?i(n):r(s)})})}}u(SV,"promisify");function Pb(t){return t===null?"null":t===void 0?"undefined":typeof t=="string"?`'${t}'`:typeof t=="number"||typeof t=="boolean"?String(t):Array.isArray(t)?`[ ${t.map(r=>Pb(r)).join(", ")} ]`:typeof t=="object"?`{ ${Object.entries(t).map(([r,i])=>`${r}: ${Pb(i)}`).join(", ")} }`:String(t)}u(Pb,"inspect");function EV(t,...e){if(e.length===0)return t;let r=t,i=0;for(r=r.replace(/%[sdj%]/g,n=>{if(i>=e.length)return n;let s=e[i++];switch(n){case"%s":return String(s);case"%d":return Number(s).toString();case"%j":try{return JSON.stringify(s)}catch{return"[Circular]"}case"%%":return"%";default:return n}});i<e.length;)r+=" "+String(e[i++]);return r}u(EV,"format")});var Hc=x(dt=>{"use strict";Object.defineProperty(dt,"__esModule",{value:!0});dt.AssertionError=dt.RangeError=dt.TypeError=dt.Error=void 0;dt.message=EC;dt.E=sn;var Db=Nb(),vC=typeof Symbol>"u"?"_kCode":Symbol("code"),SC={};function Ib(t){var e;return e=class extends t{constructor(i,...n){super(EC(i,n)),this.code=i,this[vC]=i,this.name=`${super.name} [${this[vC]}]`}},u(e,"NodeError"),e}u(Ib,"makeNodeError");var np=globalThis,$b=class $b extends np.Error{constructor(e){if(typeof e!="object"||e===null)throw new dt.TypeError("ERR_INVALID_ARG_TYPE","options","object");e.message?super(e.message):super(`${(0,Db.inspect)(e.actual).slice(0,128)} ${e.operator} ${(0,Db.inspect)(e.expected).slice(0,128)}`),this.generatedMessage=!e.message,this.name="AssertionError [ERR_ASSERTION]",this.code="ERR_ASSERTION",this.actual=e.actual,this.expected=e.expected,this.operator=e.operator,dt.Error.captureStackTrace(this,e.stackStartFunction)}};u($b,"AssertionError");var Cb=$b;dt.AssertionError=Cb;function EC(t,e){if(typeof t!="string")throw new dt.Error("Error message key must be a string");let r=SC[t];if(!r)throw new dt.Error(`An invalid error message key was used: ${t}.`);let i;if(typeof r=="function")i=r;else{if(i=Db.format,e===void 0||e.length===0)return r;e.unshift(r)}return String(i.apply(null,e))}u(EC,"message");function sn(t,e){SC[t]=typeof e=="function"?e:String(e)}u(sn,"E");dt.Error=Ib(np.Error);dt.TypeError=Ib(np.TypeError);dt.RangeError=Ib(np.RangeError);sn("ERR_DIR_CLOSED","Directory handle was closed");sn("ERR_DIR_CONCURRENT_OPERATION","Cannot do synchronous work on directory handle with concurrent asynchronous operations");sn("ERR_INVALID_FILE_URL_HOST",'File URL host must be "localhost" or empty on %s');sn("ERR_INVALID_FILE_URL_PATH","File URL path %s");sn("ERR_INVALID_OPT_VALUE",(t,e)=>`The value "${String(e)}" is invalid for option "${t}"`);sn("ERR_INVALID_OPT_VALUE_ENCODING",t=>`The value "${String(t)}" is invalid for option "encoding"`);sn("ERR_INVALID_ARG_VALUE","Unable to open file as blob")});var Vc=x(ss=>{"use strict";Object.defineProperty(ss,"__esModule",{value:!0});ss.ENCODING_UTF8=void 0;ss.assertEncoding=kV;ss.strToEncoding=TV;var Bb=nn(),FV=Hc();ss.ENCODING_UTF8="utf8";function kV(t){if(t&&!Bb.Buffer.isEncoding(t))throw new FV.TypeError("ERR_INVALID_OPT_VALUE_ENCODING",t)}u(kV,"assertEncoding");function TV(t,e){return!e||e===ss.ENCODING_UTF8?t:e==="buffer"?new Bb.Buffer(t):new Bb.Buffer(t).toString(e)}u(TV,"strToEncoding")});var op=x(Gc=>{"use strict";Object.defineProperty(Gc,"__esModule",{value:!0});Gc.Dirent=void 0;var xV=vr(),OV=Vc(),{S_IFMT:RV,S_IFDIR:AV,S_IFREG:PV,S_IFBLK:NV,S_IFCHR:DV,S_IFLNK:CV,S_IFIFO:IV,S_IFSOCK:$V}=xV.constants,ap=class ap{constructor(){this.name="",this.path="",this.parentPath="",this.mode=0}static build(e,r){let i=new ap,{mode:n}=e.getNode();return i.name=(0,OV.strToEncoding)(e.getName(),r),i.mode=n,i.path=e.getParentPath(),i.parentPath=i.path,i}_checkModeProperty(e){return(this.mode&RV)===e}isDirectory(){return this._checkModeProperty(AV)}isFile(){return this._checkModeProperty(PV)}isBlockDevice(){return this._checkModeProperty(NV)}isCharacterDevice(){return this._checkModeProperty(DV)}isSymbolicLink(){return this._checkModeProperty(CV)}isFIFO(){return this._checkModeProperty(IV)}isSocket(){return this._checkModeProperty($V)}};u(ap,"Dirent");var sp=ap;Gc.Dirent=sp;Gc.default=sp});var Io=x(Me=>{"use strict";Object.defineProperty(Me,"__esModule",{value:!0});Me.basename=Me.isAbsolute=Me.normalize=Me.dirname=Me.relative=Me.join=Me.posix=Me.sep=Me.resolve=void 0;var wi=ne("node:path");Object.defineProperty(Me,"resolve",{enumerable:!0,get:u(function(){return wi.resolve},"get")});Object.defineProperty(Me,"sep",{enumerable:!0,get:u(function(){return wi.sep},"get")});Object.defineProperty(Me,"posix",{enumerable:!0,get:u(function(){return wi.posix},"get")});Object.defineProperty(Me,"join",{enumerable:!0,get:u(function(){return wi.join},"get")});Object.defineProperty(Me,"relative",{enumerable:!0,get:u(function(){return wi.relative},"get")});Object.defineProperty(Me,"dirname",{enumerable:!0,get:u(function(){return wi.dirname},"get")});Object.defineProperty(Me,"normalize",{enumerable:!0,get:u(function(){return wi.normalize},"get")});Object.defineProperty(Me,"isAbsolute",{enumerable:!0,get:u(function(){return wi.isAbsolute},"get")});Object.defineProperty(Me,"basename",{enumerable:!0,get:u(function(){return wi.basename},"get")})});var kC=x(FC=>{"use strict";Object.defineProperty(FC,"__esModule",{value:!0})});var Mb=x(lp=>{"use strict";Object.defineProperty(lp,"__esModule",{value:!0});lp.flattenJSON=void 0;var TC=nn(),Lb=Io(),BV=Lb.posix?Lb.posix.join:Lb.join,LV=u(t=>{let e={};function r(i,n){for(let s in n){let a=n[s],l=BV(i,s);typeof a=="string"||a instanceof TC.Buffer?e[l]=a:typeof a=="object"&&a!==null&&!(a instanceof TC.Buffer)&&Object.keys(a).length>0?r(l,a):e[l]=null}}return u(r,"flatten"),r("",t),e},"flattenJSON");lp.flattenJSON=LV});var fp=x(cp=>{"use strict";Object.defineProperty(cp,"__esModule",{value:!0});cp.createProcess=xC;var MV=u(()=>{if(typeof process<"u")return process;try{return ne("process")}catch{return}},"maybeReturnProcess");function xC(){let t=MV()||{};return t.cwd||(t.cwd=()=>"/"),t.emitWarning||(t.emitWarning=(e,r)=>{console.warn(`${r}${r?": ":""}${e}`)}),t.env||(t.env={}),t}u(xC,"createProcess");cp.default=xC()});var Ub=x(dp=>{"use strict";Object.defineProperty(dp,"__esModule",{value:!0});dp.Node=void 0;var jV=ll(),AC=fp(),gi=nn(),qV=vr(),{S_IFMT:yi,S_IFDIR:UV,S_IFREG:zV,S_IFLNK:OC,S_IFCHR:WV}=qV.constants,up=u(()=>AC.default.getuid?.()??0,"getuid"),hp=u(()=>AC.default.getgid?.()??0,"getgid"),RC=(0,gi.bufferAllocUnsafe)(0),qb=class qb{constructor(e,r=438){this.changes=new jV.FanOut,this._uid=up(),this._gid=hp(),this._atime=new Date,this._mtime=new Date,this._ctime=new Date,this.buf=RC,this.capacity=0,this.size=0,this.rdev=0,this._nlink=1,this.mode=r,this.ino=e}set ctime(e){this._ctime=e}get ctime(){return this._ctime}set uid(e){this._uid=e,this.ctime=new Date}get uid(){return this._uid}set gid(e){this._gid=e,this.ctime=new Date}get gid(){return this._gid}set atime(e){this._atime=e}get atime(){return this._atime}set mtime(e){this._mtime=e,this.ctime=new Date}get mtime(){return this._mtime}get perm(){return this.mode&~yi}set perm(e){this.mode=this.mode&yi|e&~yi,this.ctime=new Date}set nlink(e){this._nlink=e,this.ctime=new Date}get nlink(){return this._nlink}getString(e="utf8"){return this.atime=new Date,this.getBuffer().toString(e)}setString(e){this._setBuf((0,gi.bufferFrom)(e,"utf8"))}getBuffer(){return this.atime=new Date,this.buf||(this.buf=(0,gi.bufferAllocUnsafe)(0)),(0,gi.bufferFrom)(this.buf.subarray(0,this.size))}setBuffer(e){let r=(0,gi.bufferFrom)(e);this._setBuf(r)}_setBuf(e){let r=e.length;this.buf=e,this.capacity=r,this.size=r,this.touch()}getSize(){return this.size}setModeProperty(e){this.mode=e}isFile(){return(this.mode&yi)===zV}isDirectory(){return(this.mode&yi)===UV}isSymlink(){return(this.mode&yi)===OC}isCharacterDevice(){return(this.mode&yi)===WV}makeSymlink(e){this.mode=OC|438,this.symlink=e}write(e,r=0,i=e.length,n=0){let s=e.length;if(r+i>s&&(i=s-r),i<=0)return 0;let a=n+i;if(a>this.capacity){let l=Math.max(this.capacity*2,64);for(;l<a;)l*=2;let c=(0,gi.bufferAllocUnsafe)(l);this.size>0&&this.buf.copy(c,0,0,this.size),this.buf=c,this.capacity=l}return n>this.size&&this.buf.fill(0,this.size,n),e.copy(this.buf,n,r,r+i),a>this.size&&(this.size=a),this.touch(),i}read(e,r=0,i=e.byteLength,n=0){if(this.atime=new Date,n>=this.size)return 0;let s=i;if(s>e.byteLength&&(s=e.byteLength),s+n>this.size&&(s=this.size-n),s<=0)return 0;let a=e instanceof gi.Buffer?e:gi.Buffer.from(e.buffer,e.byteOffset,e.byteLength);return this.buf.copy(a,r,n,n+s),s}truncate(e=0){if(!e){this.buf=RC,this.capacity=0,this.size=0,this.touch();return}if(e<=this.size)this.size=e;else{if(e>this.capacity){let r=Math.max(this.capacity*2,64);for(;r<e;)r*=2;let i=(0,gi.bufferAllocUnsafe)(r);this.size>0&&this.buf.copy(i,0,0,this.size),i.fill(0,this.size,e),this.buf=i,this.capacity=r}else this.buf.fill(0,this.size,e);this.size=e}this.touch()}chmod(e){this.mode=this.mode&yi|e&~yi,this.touch()}chown(e,r){this.uid=e,this.gid=r,this.touch()}touch(){this.mtime=new Date,this.changes.emit(["modify"])}canRead(e=up(),r=hp()){return!!(this.perm&4||r===this.gid&&this.perm&32||e===this.uid&&this.perm&256)}canWrite(e=up(),r=hp()){return!!(this.perm&2||r===this.gid&&this.perm&16||e===this.uid&&this.perm&128)}canExecute(e=up(),r=hp()){return!!(this.perm&1||r===this.gid&&this.perm&8||e===this.uid&&this.perm&64)}del(){this.changes.emit(["delete"])}toJSON(){return{ino:this.ino,uid:this.uid,gid:this.gid,atime:this.atime.getTime(),mtime:this.mtime.getTime(),ctime:this.ctime.getTime(),perm:this.perm,mode:this.mode,nlink:this.nlink,symlink:this.symlink,data:this.getString()}}};u(qb,"Node");var jb=qb;dp.Node=jb});var Wb=x(pp=>{"use strict";Object.defineProperty(pp,"__esModule",{value:!0});pp.Link=void 0;var HV=vr(),VV=ll(),{S_IFREG:GV}=HV.constants,Zc=class Zc{get steps(){return this._steps}set steps(e){this._steps=e;for(let[r,i]of this.children.entries())r==="."||r===".."||i?.syncSteps()}constructor(e,r,i){this.changes=new VV.FanOut,this.children=new Map,this._steps=[],this.ino=0,this.length=0,this.vol=e,this.parent=r,this.name=i,this.syncSteps()}setNode(e){this.node=e,this.ino=e.ino}getNode(){return this.node}createChild(e,r=this.vol.createNode(GV|438)){let i=new Zc(this.vol,this,e);return i.setNode(r),r.isDirectory()&&(i.children.set(".",i),i.getNode().nlink++),this.setChild(e,i),i}setChild(e,r=new Zc(this.vol,this,e)){return this.children.set(e,r),r.parent=this,this.length++,r.getNode().isDirectory()&&(r.children.set("..",this),this.getNode().nlink++),this.getNode().mtime=new Date,this.changes.emit(["child:add",r,this]),r}deleteChild(e){e.getNode().isDirectory()&&(e.children.delete(".."),this.getNode().nlink--),this.children.delete(e.getName()),this.length--,this.getNode().mtime=new Date,this.changes.emit(["child:del",e,this])}getChild(e){return this.getNode().atime=new Date,this.children.get(e)}getPath(){return this.steps.join("/")}getParentPath(){return this.steps.slice(0,-1).join("/")}getName(){return this.steps[this.steps.length-1]}toJSON(){return{steps:this.steps,ino:this.ino,children:Array.from(this.children.keys())}}syncSteps(){this.steps=this.parent?this.parent.steps.concat([this.name]):[this.name]}};u(Zc,"Link");var zb=Zc;pp.Link=zb});var Gb=x(mp=>{"use strict";Object.defineProperty(mp,"__esModule",{value:!0});mp.File=void 0;var ZV=vr(),{O_APPEND:KV}=ZV.constants,Vb=class Vb{constructor(e,r,i,n){this.link=e,this.node=r,this.flags=i,this.fd=n,this.position=0,this.flags&KV&&(this.position=this.getSize())}getString(e="utf8"){return this.node.getString()}setString(e){this.node.setString(e)}getBuffer(){return this.node.getBuffer()}setBuffer(e){this.node.setBuffer(e)}getSize(){return this.node.getSize()}truncate(e){this.node.truncate(e)}seekTo(e){this.position=e}write(e,r=0,i=e.length,n){typeof n!="number"&&(n=this.position);let s=this.node.write(e,r,i,n);return this.position=n+s,s}read(e,r=0,i=e.byteLength,n){typeof n!="number"&&(n=this.position);let s=this.node.read(e,r,i,n);return this.position=n+s,s}chmod(e){this.node.chmod(e)}chown(e,r){this.node.chown(e,r)}};u(Vb,"File");var Hb=Vb;mp.File=Hb});var Lo=x(Bo=>{"use strict";Object.defineProperty(Bo,"__esModule",{value:!0});Bo.FLAGS=Bo.ERRSTR=void 0;var JV=vr();Bo.ERRSTR={PATH_STR:"path must be a string, Buffer, or Uint8Array",FD:"fd must be a file descriptor",MODE_INT:"mode must be an int",CB:"callback must be a function",UID:"uid must be an unsigned int",GID:"gid must be an unsigned int",LEN:"len must be an integer",ATIME:"atime must be an integer",MTIME:"mtime must be an integer",PREFIX:"filename prefix is required",BUFFER:"buffer must be an instance of Buffer or StaticBuffer",OFFSET:"offset must be an integer",LENGTH:"length must be an integer",POSITION:"position must be an integer"};var{O_RDONLY:PC,O_WRONLY:wp,O_RDWR:$o,O_CREAT:an,O_EXCL:yp,O_TRUNC:gp,O_APPEND:bp,O_SYNC:NC}=JV.constants,DC;(function(t){t[t.r=PC]="r",t[t["r+"]=$o]="r+",t[t.rs=PC|NC]="rs",t[t.sr=t.rs]="sr",t[t["rs+"]=$o|NC]="rs+",t[t["sr+"]=t["rs+"]]="sr+",t[t.w=wp|an|gp]="w",t[t.wx=wp|an|gp|yp]="wx",t[t.xw=t.wx]="xw",t[t["w+"]=$o|an|gp]="w+",t[t["wx+"]=$o|an|gp|yp]="wx+",t[t["xw+"]=t["wx+"]]="xw+",t[t.a=wp|bp|an]="a",t[t.ax=wp|bp|an|yp]="ax",t[t.xa=t.ax]="xa",t[t["a+"]=$o|bp|an]="a+",t[t["ax+"]=$o|bp|an|yp]="ax+",t[t["xa+"]=t["ax+"]]="xa+"})(DC||(Bo.FLAGS=DC={}))});var Kb=x(Zb=>{"use strict";Object.defineProperty(Zb,"__esModule",{value:!0});Zb.default=typeof queueMicrotask=="function"?queueMicrotask:t=>Promise.resolve().then(()=>t()).catch(()=>{})});var Ep=x(Xe=>{"use strict";Object.defineProperty(Xe,"__esModule",{value:!0});Xe.filenameToSteps=Xe.resolve=Xe.unixify=Xe.isWin=void 0;Xe.isFd=IC;Xe.validateFd=aG;Xe.dataToBuffer=oG;var vp=Io(),_p=nn(),CC=fp(),YV=Vc(),XV=Lo();Xe.isWin=CC.default.platform==="win32";var QV=vp.resolve,eG=vp.posix?vp.posix.sep:vp.sep,tG=u((t,e)=>{let r=t[e];return e>0&&(r==="/"||Xe.isWin&&r==="\\")},"isSeparator"),rG=u(t=>{let e=t.length-1;if(e<2)return t;for(;tG(t,e);)e--;return t.substr(0,e+1)},"removeTrailingSeparator"),iG=u((t,e)=>{if(typeof t!="string")throw new TypeError("expected a string");return t=t.replace(/[\\\/]+/g,"/"),e!==!1&&(t=rG(t)),t},"normalizePath"),nG=u((t,e=!0)=>Xe.isWin?(t=iG(t,e),t.replace(/^([a-zA-Z]+:|\.\/)/,"")):t,"unixify");Xe.unixify=nG;var Sp=u((t,e=CC.default.cwd())=>QV(e,t),"resolve");Xe.resolve=Sp;if(Xe.isWin){let t=Sp;Xe.resolve=Sp=u((e,r)=>(0,Xe.unixify)(t(e,r)),"resolve")}var sG=u((t,e)=>{let i=Sp(t,e).substring(1);return i?i.split(eG):[]},"filenameToSteps");Xe.filenameToSteps=sG;function IC(t){return t>>>0===t}u(IC,"isFd");function aG(t){if(!IC(t))throw TypeError(XV.ERRSTR.FD)}u(aG,"validateFd");function oG(t,e=YV.ENCODING_UTF8){return _p.Buffer.isBuffer(t)?t:t instanceof Uint8Array?(0,_p.bufferFrom)(t):e==="buffer"?(0,_p.bufferFrom)(String(t),"utf8"):(0,_p.bufferFrom)(String(t),e)}u(oG,"dataToBuffer")});var on=x(Ve=>{"use strict";Object.defineProperty(Ve,"__esModule",{value:!0});Ve.getWriteSyncArgs=Ve.getWriteArgs=Ve.bufToUint8=void 0;Ve.promisify=cG;Ve.validateCallback=$C;Ve.modeToNumber=BC;Ve.nullCheck=LC;Ve.pathToFilename=hG;Ve.createError=OG;Ve.genRndStr6=RG;Ve.flagsToNumber=AG;Ve.streamToBuffer=PG;Ve.bufferToEncoding=IG;Ve.isReadableStream=$G;var Kc=Lo(),Jb=Hc(),Yb=nn(),lG=Kb(),Fp=Ep();function cG(t,e,r=i=>i){return(...i)=>new Promise((n,s)=>{t[e].bind(t)(...i,(a,l)=>a?s(a):n(r(l)))})}u(cG,"promisify");function $C(t){if(typeof t!="function")throw TypeError(Kc.ERRSTR.CB);return t}u($C,"validateCallback");function fG(t,e){if(typeof t=="number")return t;if(typeof t=="string")return parseInt(t,8);if(e)return BC(e)}u(fG,"_modeToNumber");function BC(t,e){let r=fG(t,e);if(typeof r!="number"||isNaN(r))throw new TypeError(Kc.ERRSTR.MODE_INT);return r}u(BC,"modeToNumber");function LC(t,e){if((""+t).indexOf("\0")!==-1){let r=new Error("Path must be a string without null bytes");if(r.code="ENOENT",typeof e!="function")throw r;return(0,lG.default)(()=>{e(r)}),!1}return!0}u(LC,"nullCheck");function uG(t){if(t.hostname!=="")throw new Jb.TypeError("ERR_INVALID_FILE_URL_HOST",process.platform);let e=t.pathname;for(let r=0;r<e.length;r++)if(e[r]==="%"){let i=e.codePointAt(r+2)|32;if(e[r+1]==="2"&&i===102)throw new Jb.TypeError("ERR_INVALID_FILE_URL_PATH","must not include encoded / characters")}return decodeURIComponent(e)}u(uG,"getPathFromURLPosix");function hG(t){if(t instanceof Uint8Array&&(t=(0,Yb.bufferFrom)(t)),typeof t!="string"&&!Yb.Buffer.isBuffer(t)){try{if(!(t instanceof ne("url").URL))throw new TypeError(Kc.ERRSTR.PATH_STR)}catch{throw new TypeError(Kc.ERRSTR.PATH_STR)}t=uG(t)}let e=String(t);return LC(e),e}u(hG,"pathToFilename");var dG="ENOENT",pG="EBADF",mG="EINVAL",wG="EPERM",yG="EPROTO",gG="EEXIST",bG="ENOTDIR",_G="EMFILE",vG="EACCES",SG="EISDIR",EG="ENOTEMPTY",FG="ENOSYS",kG="ERR_FS_EISDIR",TG="ERR_OUT_OF_RANGE";function xG(t,e="",r="",i=""){let n="";switch(r&&(n=` '${r}'`),i&&(n+=` -> '${i}'`),t){case dG:return`ENOENT: no such file or directory, ${e}${n}`;case pG:return`EBADF: bad file descriptor, ${e}${n}`;case mG:return`EINVAL: invalid argument, ${e}${n}`;case wG:return`EPERM: operation not permitted, ${e}${n}`;case yG:return`EPROTO: protocol error, ${e}${n}`;case gG:return`EEXIST: file already exists, ${e}${n}`;case bG:return`ENOTDIR: not a directory, ${e}${n}`;case SG:return`EISDIR: illegal operation on a directory, ${e}${n}`;case vG:return`EACCES: permission denied, ${e}${n}`;case EG:return`ENOTEMPTY: directory not empty, ${e}${n}`;case _G:return`EMFILE: too many open files, ${e}${n}`;case FG:return`ENOSYS: function not implemented, ${e}${n}`;case kG:return`[ERR_FS_EISDIR]: Path is a directory: ${e} returned EISDIR (is a directory) ${r}`;case TG:return`[ERR_OUT_OF_RANGE]: value out of range, ${e}${n}`;default:return`${t}: error occurred, ${e}${n}`}}u(xG,"formatError");function OG(t,e="",r="",i="",n=Error){let s=new n(xG(t,e,r,i));return s.code=t,r&&(s.path=r),s}u(OG,"createError");function RG(){return Math.random().toString(36).slice(2,8).padEnd(6,"0")}u(RG,"genRndStr6");function AG(t){if(typeof t=="number")return t;if(typeof t=="string"){let e=Kc.FLAGS[t];if(typeof e<"u")return e}throw new Jb.TypeError("ERR_INVALID_OPT_VALUE","flags",t)}u(AG,"flagsToNumber");function PG(t){let e=[];return new Promise((r,i)=>{t.on("data",n=>e.push(n)),t.on("end",()=>r(Yb.Buffer.concat(e))),t.on("error",i)})}u(PG,"streamToBuffer");var NG=u(t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),"bufToUint8");Ve.bufToUint8=NG;var DG=u((t,e,r,i,n,s)=>{(0,Fp.validateFd)(t);let a=0,l,c=null,o,f,h=typeof e,d=typeof r,p=typeof i,m=typeof n;h!=="string"?d==="function"?f=r:p==="function"?(a=r|0,f=i):m==="function"?(a=r|0,l=i,f=n):(a=r|0,l=i,c=n,f=s):d==="function"?f=r:p==="function"?(c=r,f=i):m==="function"&&(c=r,o=i,f=n);let w=(0,Fp.dataToBuffer)(e,o);h!=="string"?typeof l>"u"&&(l=w.length):(a=0,l=w.length);let g=$C(f);return[t,h==="string",w,a,l,c,g]},"getWriteArgs");Ve.getWriteArgs=DG;var CG=u((t,e,r,i,n)=>{(0,Fp.validateFd)(t);let s,a,l,c,o=typeof e!="string";o?(a=(r||0)|0,l=i,c=n):(c=r,s=i);let f=(0,Fp.dataToBuffer)(e,s);return o?typeof l>"u"&&(l=f.length):(a=0,l=f.length),[t,f,a||0,l,c]},"getWriteSyncArgs");Ve.getWriteSyncArgs=CG;function IG(t,e){return!e||e==="buffer"?t:t.toString(e)}u(IG,"bufferToEncoding");function $G(t){return t!==null&&typeof t=="object"&&typeof t.pipe=="function"&&typeof t.on=="function"&&t.readable===!0}u($G,"isReadableStream")});var WC=x(xp=>{"use strict";Object.defineProperty(xp,"__esModule",{value:!0});xp.Superblock=void 0;var Qe=Io(),BG=Ub(),MC=Wb(),LG=Gb(),MG=nn(),jC=fp(),Wr=vr(),qC=Lo(),K=on(),Sr=Ep(),jG=Mb(),Mo=Qe.posix?Qe.posix.sep:Qe.sep,UC=Qe.posix?Qe.posix.relative:Qe.relative,qG=Qe.posix?Qe.posix.join:Qe.join,{O_RDONLY:Xb,O_WRONLY:kp,O_RDWR:Qb,O_CREAT:zC,O_EXCL:UG,O_TRUNC:zG,O_APPEND:WG,O_DIRECTORY:HG}=Wr.constants,jo=class jo{static fromJSON(e,r){let i=new jo;return i.fromJSON(e,r),i}static fromNestedJSON(e,r){let i=new jo;return i.fromNestedJSON(e,r),i}constructor(e={}){this.ino=0,this.inodes={},this.releasedInos=[],this.fds={},this.releasedFds=[],this.maxFiles=1e4,this.openFiles=0,this.open=(i,n,s,a=!0)=>{let l=this.openFile(i,n,s,a);if(!l)throw(0,K.createError)("ENOENT","open",i);return l.fd},this.writeFile=(i,n,s,a)=>{let l=typeof i=="number",c;l?c=i:c=this.open((0,K.pathToFilename)(i),s,a);let o=0,f=n.length,h=s&WG?void 0:0;try{for(;f>0;){let d=this.write(c,n,o,f,h);o+=d,f-=d,h!==void 0&&(h+=d)}}finally{l||this.close(c)}},this.read=(i,n,s,a,l)=>{if(n.byteLength<a)throw(0,K.createError)("ERR_OUT_OF_RANGE","read",void 0,void 0,RangeError);let c=this.getFileByFdOrThrow(i);if(c.node.isSymlink())throw(0,K.createError)("EPERM","read",c.link.getPath());return c.read(n,Number(s),Number(a),l===-1||typeof l!="number"?void 0:l)},this.readv=(i,n,s)=>{let a=this.getFileByFdOrThrow(i),l=s??void 0;l===-1&&(l=void 0);let c=0;for(let o of n){let f=a.read(o,0,o.byteLength,l);if(l=void 0,c+=f,f<o.byteLength)break}return c},this.link=(i,n)=>{let s;try{s=this.getLinkOrThrow(i,"link")}catch(f){throw f.code&&(f=(0,K.createError)(f.code,"link",i,n)),f}let a=(0,Qe.dirname)(n),l;try{l=this.getLinkOrThrow(a,"link")}catch(f){throw f.code&&(f=(0,K.createError)(f.code,"link",i,n)),f}let c=(0,Qe.basename)(n);if(l.getChild(c))throw(0,K.createError)("EEXIST","link",i,n);let o=s.getNode();o.nlink++,l.createChild(c,o)},this.unlink=i=>{let n=this.getLinkOrThrow(i,"unlink");if(n.length)throw Error("Dir not empty...");this.deleteLink(n);let s=n.getNode();s.nlink--,s.nlink<=0&&this.deleteNode(s)},this.symlink=(i,n)=>{let s=(0,Sr.filenameToSteps)(n),a;try{a=this.getLinkParentAsDirOrThrow(s)}catch(f){throw f.code&&(f=(0,K.createError)(f.code,"symlink",i,n)),f}let l=s[s.length-1];if(a.getChild(l))throw(0,K.createError)("EEXIST","symlink",i,n);let c=a.getNode();if(!c.canExecute()||!c.canWrite())throw(0,K.createError)("EACCES","symlink",i,n);let o=a.createChild(l);return o.getNode().makeSymlink(i),o},this.rename=(i,n)=>{let s;try{s=this.getResolvedLinkOrThrow(i)}catch(h){throw h.code&&(h=(0,K.createError)(h.code,"rename",i,n)),h}let a;try{a=this.getLinkParentAsDirOrThrow(n)}catch(h){throw h.code&&(h=(0,K.createError)(h.code,"rename",i,n)),h}let l=s.parent;if(!l)throw(0,K.createError)("EINVAL","rename",i,n);let c=l.getNode(),o=a.getNode();if(!c.canExecute()||!c.canWrite()||!o.canExecute()||!o.canWrite())throw(0,K.createError)("EACCES","rename",i,n);l.deleteChild(s);let f=(0,Qe.basename)(n);s.name=f,s.steps=[...a.steps,f],a.setChild(s.getName(),s)},this.mkdir=(i,n)=>{let s=(0,Sr.filenameToSteps)(i);if(!s.length)throw(0,K.createError)("EEXIST","mkdir",i);let a=this.getLinkParentAsDirOrThrow(i,"mkdir"),l=s[s.length-1];if(a.getChild(l))throw(0,K.createError)("EEXIST","mkdir",i);let c=a.getNode();if(!c.canWrite()||!c.canExecute())throw(0,K.createError)("EACCES","mkdir",i);a.createChild(l,this.createNode(Wr.constants.S_IFDIR|n))},this.mkdirp=(i,n)=>{let s=!1,a=(0,Sr.filenameToSteps)(i),l=null,c=a.length;for(c=a.length;c>=0&&(l=this.getResolvedLink(a.slice(0,c)),!l);c--);for(l||(l=this.root,c=0),l=this.getResolvedLinkOrThrow(Qe.sep+a.slice(0,c).join(Qe.sep),"mkdir"),c;c<a.length;c++){let o=l.getNode();if(o.isDirectory()){if(!o.canExecute()||!o.canWrite())throw(0,K.createError)("EACCES","mkdir",i)}else throw(0,K.createError)("ENOTDIR","mkdir",i);s=!0,l=l.createChild(a[c],this.createNode(Wr.constants.S_IFDIR|n))}return s?i:void 0},this.rmdir=(i,n=!1)=>{let s=this.getLinkAsDirOrThrow(i,"rmdir");if(s.length&&!n)throw(0,K.createError)("ENOTEMPTY","rmdir",i);this.deleteLink(s)},this.rm=(i,n=!1,s=!1)=>{let a;try{a=this.getResolvedLinkOrThrow(i,"stat")}catch(l){if(l.code==="ENOENT"&&n)return;throw l}if(a.getNode().isDirectory()&&!s)throw(0,K.createError)("ERR_FS_EISDIR","rm",i);if(!a.parent?.getNode().canWrite())throw(0,K.createError)("EACCES","rm",i);this.deleteLink(a)},this.close=i=>{(0,Sr.validateFd)(i);let n=this.getFileByFdOrThrow(i,"close");this.closeFile(n)};let r=this.createLink();r.setNode(this.createNode(Wr.constants.S_IFDIR|511)),r.setChild(".",r),r.getNode().nlink++,r.setChild("..",r),r.getNode().nlink++,this.root=r}createLink(e,r,i=!1,n){if(!e)return new MC.Link(this,void 0,"");if(!r)throw new Error("createLink: name cannot be empty");let s=n??(i?511:438),l=n&&n&Wr.constants.S_IFMT?n&Wr.constants.S_IFMT:i?Wr.constants.S_IFDIR:Wr.constants.S_IFREG,c=s&~Wr.constants.S_IFMT|l;return e.createChild(r,this.createNode(c))}deleteLink(e){let r=e.parent;return r?(r.deleteChild(e),!0):!1}newInoNumber(){let e=this.releasedInos.pop();return e||(this.ino=(this.ino+1)%4294967295,this.ino)}newFdNumber(){let e=this.releasedFds.pop();return typeof e=="number"?e:jo.fd--}createNode(e){let r=new BG.Node(this.newInoNumber(),e);return this.inodes[r.ino]=r,r}deleteNode(e){e.del(),delete this.inodes[e.ino],this.releasedInos.push(e.ino)}walk(e,r=!1,i=!1,n=!1,s){let a,l;e instanceof MC.Link?(a=e.steps,l=Mo+a.join(Mo)):typeof e=="string"?(a=(0,Sr.filenameToSteps)(e),l=e):(a=e,l=Mo+a.join(Mo));let c=this.root,o=0;for(;o<a.length;){let f=c.getNode();if(f.isDirectory()){if(n&&!f.canExecute())throw(0,K.createError)("EACCES",s,l)}else if(o<a.length-1)throw(0,K.createError)("ENOTDIR",s,l);if(c=c.getChild(a[o])??null,!c){if(i)throw(0,K.createError)("ENOENT",s,l);return null}if(f=c?.getNode(),f.isSymlink()&&(r||o<a.length-1)){let h=(0,Qe.isAbsolute)(f.symlink)?f.symlink:qG((0,Qe.dirname)(c.getPath()),f.symlink);a=(0,Sr.filenameToSteps)(h).concat(a.slice(o+1)),c=this.root,o=0;continue}if(i&&!f.isDirectory()&&o<a.length-1){let h=jC.default.platform==="win32"?"ENOENT":"ENOTDIR";throw(0,K.createError)(h,s,l)}o++}return c}getLink(e){return this.walk(e,!1,!1,!1)}getLinkOrThrow(e,r){return this.walk(e,!1,!0,!0,r)}getResolvedLink(e){return this.walk(e,!0,!1,!1)}getResolvedLinkOrThrow(e,r){return this.walk(e,!0,!0,!0,r)}resolveSymlinks(e){return this.getResolvedLink(e.steps.slice(1))}getLinkAsDirOrThrow(e,r){let i=this.getLinkOrThrow(e,r);if(!i.getNode().isDirectory())throw(0,K.createError)("ENOTDIR",r,e);return i}getLinkParent(e){return this.getLink(e.slice(0,-1))}getLinkParentAsDirOrThrow(e,r){let i=(e instanceof Array?e:(0,Sr.filenameToSteps)(e)).slice(0,-1),n=Mo+i.join(Mo),s=this.getLinkOrThrow(n,r);if(!s.getNode().isDirectory())throw(0,K.createError)("ENOTDIR",r,n);return s}getFileByFd(e){return this.fds[String(e)]}getFileByFdOrThrow(e,r){if(!(0,Sr.isFd)(e))throw TypeError(qC.ERRSTR.FD);let i=this.getFileByFd(e);if(!i)throw(0,K.createError)("EBADF",r);return i}_toJSON(e=this.root,r={},i,n){let s=!0,a=e.children;e.getNode().isFile()&&(a=new Map([[e.getName(),e.parent.getChild(e.getName())]]),e=e.parent);for(let c of a.keys()){if(c==="."||c==="..")continue;s=!1;let o=e.getChild(c);if(!o)throw new Error("_toJSON: unexpected undefined");let f=o.getNode();if(f.isFile()){let h=o.getPath();i&&(h=UC(i,h)),r[h]=n?f.getBuffer():f.getString()}else f.isDirectory()&&this._toJSON(o,r,i,n)}let l=e.getPath();return i&&(l=UC(i,l)),l&&s&&(r[l]=null),r}toJSON(e,r={},i=!1,n=!1){let s=[];if(e){Array.isArray(e)||(e=[e]);for(let a of e){let l=(0,K.pathToFilename)(a),c=this.getResolvedLink(l);c&&s.push(c)}}else s.push(this.root);if(!s.length)return r;for(let a of s)this._toJSON(a,r,i?a.getPath():"",n);return r}fromJSON(e,r=jC.default.cwd()){for(let i in e){let n=e[i];if(i=(0,Sr.resolve)(i,r),typeof n=="string"||n instanceof MG.Buffer){let s=(0,Qe.dirname)(i);this.mkdirp(s,511);let a=(0,Sr.dataToBuffer)(n);this.writeFile(i,a,qC.FLAGS.w,438)}else this.mkdirp(i,511)}}fromNestedJSON(e,r){this.fromJSON((0,jG.flattenJSON)(e),r)}reset(){this.ino=0,this.inodes={},this.releasedInos=[],this.fds={},this.releasedFds=[],this.openFiles=0,this.root=this.createLink(),this.root.setNode(this.createNode(Wr.constants.S_IFDIR|511))}mountSync(e,r){this.fromJSON(r,e)}openLink(e,r,i=!0){if(this.openFiles>=this.maxFiles)throw(0,K.createError)("EMFILE","open",e.getPath());let n=e;i&&(n=this.getResolvedLinkOrThrow(e.getPath(),"open"));let s=n.getNode();if(s.isDirectory()){if((r&(Xb|Qb|kp))!==Xb)throw(0,K.createError)("EISDIR","open",e.getPath())}else if(r&HG)throw(0,K.createError)("ENOTDIR","open",e.getPath());if((r&(Xb|Qb|kp))!==kp&&!s.canRead()||r&(kp|Qb)&&!s.canWrite())throw(0,K.createError)("EACCES","open",e.getPath());let a=new LG.File(e,s,r,this.newFdNumber());return this.fds[a.fd]=a,this.openFiles++,r&zG&&a.truncate(),a}openFile(e,r,i,n=!0){let s=(0,Sr.filenameToSteps)(e),a;try{if(a=n?this.getResolvedLinkOrThrow(e,"open"):this.getLinkOrThrow(e,"open"),a&&r&zC&&r&UG)throw(0,K.createError)("EEXIST","open",e)}catch(l){if(l.code==="ENOENT"&&r&zC){let c=(0,Qe.dirname)(e),o=this.getResolvedLinkOrThrow(c),f=o.getNode();if(!f.isDirectory())throw(0,K.createError)("ENOTDIR","open",e);if(!f.canExecute()||!f.canWrite())throw(0,K.createError)("EACCES","open",e);i??(i=438),a=this.createLink(o,s[s.length-1],!1,i)}else throw l}if(a)return this.openLink(a,r,n);throw(0,K.createError)("ENOENT","open",e)}closeFile(e){this.fds[e.fd]&&(this.openFiles--,delete this.fds[e.fd],this.releasedFds.push(e.fd))}write(e,r,i,n,s){let a=this.getFileByFdOrThrow(e,"write");if(a.node.isSymlink())throw(0,K.createError)("EBADF","write",a.link.getPath());return a.write(r,i,n,s===-1||typeof s!="number"?void 0:s)}};u(jo,"Superblock");var Tp=jo;xp.Superblock=Tp;Tp.fd=2147483647});var VC=x(sr=>{"use strict";Object.defineProperty(sr,"__esModule",{value:!0});sr.Superblock=sr.File=sr.Link=sr.Node=void 0;var HC=(Ff(),Yp(Ef));HC.__exportStar(kC(),sr);HC.__exportStar(Mb(),sr);var VG=Ub();Object.defineProperty(sr,"Node",{enumerable:!0,get:u(function(){return VG.Node},"get")});var GG=Wb();Object.defineProperty(sr,"Link",{enumerable:!0,get:u(function(){return GG.Link},"get")});var ZG=Gb();Object.defineProperty(sr,"File",{enumerable:!0,get:u(function(){return ZG.File},"get")});var KG=WC();Object.defineProperty(sr,"Superblock",{enumerable:!0,get:u(function(){return KG.Superblock},"get")})});var GC=x(Jc=>{"use strict";Object.defineProperty(Jc,"__esModule",{value:!0});Jc.StatFs=void 0;var Rp=class Rp{static build(e,r=!1){let i=new Rp,n=r?f=>BigInt(f):f=>f;i.type=n(2240043254),i.bsize=n(4096);let s=Object.keys(e.inodes).length,a=1e6,l=Math.min(s*2,a),c=a-l;i.blocks=n(a),i.bfree=n(c),i.bavail=n(c);let o=1e6;return i.files=n(o),i.ffree=n(o-s),i}};u(Rp,"StatFs");var Op=Rp;Jc.StatFs=Op;Jc.default=Op});var ZC=x(e_=>{"use strict";Object.defineProperty(e_,"__esModule",{value:!0});function JG(t,e,r){let i=setTimeout.apply(globalThis,arguments);return i&&typeof i=="object"&&typeof i.unref=="function"&&i.unref(),i}u(JG,"setTimeoutUnref");e_.default=JG});var JC=x(qo=>{"use strict";Object.defineProperty(qo,"__esModule",{value:!0});qo.Writable=qo.Readable=void 0;var KC=ne("node:stream");Object.defineProperty(qo,"Readable",{enumerable:!0,get:u(function(){return KC.Readable},"get")});Object.defineProperty(qo,"Writable",{enumerable:!0,get:u(function(){return KC.Writable},"get")})});var t_=x(Ap=>{"use strict";Object.defineProperty(Ap,"__esModule",{value:!0});Ap.EventEmitter=void 0;var YG=ne("node:events");Object.defineProperty(Ap,"EventEmitter",{enumerable:!0,get:u(function(){return YG.EventEmitter},"get")})});var YC=x(Pp=>{"use strict";Object.defineProperty(Pp,"__esModule",{value:!0});Pp.FileHandle=void 0;var pt=on(),XG=t_(),i_=class i_ extends XG.EventEmitter{constructor(e,r){super(),this.refs=1,this.closePromise=null,this.position=0,this.readableWebStreamLocked=!1,this.fs=e,this.fd=r}getAsyncId(){return this.fd}appendFile(e,r){return(0,pt.promisify)(this.fs,"appendFile")(this.fd,e,r)}chmod(e){return(0,pt.promisify)(this.fs,"fchmod")(this.fd,e)}chown(e,r){return(0,pt.promisify)(this.fs,"fchown")(this.fd,e,r)}close(){if(this.fd===-1)return Promise.resolve();if(this.closePromise)return this.closePromise;if(this.refs--,this.refs===0){let e=this.fd;this.fd=-1,this.closePromise=(0,pt.promisify)(this.fs,"close")(e).finally(()=>{this.closePromise=null})}else this.closePromise=new Promise((e,r)=>{this.closeResolve=e,this.closeReject=r}).finally(()=>{this.closePromise=null,this.closeReject=void 0,this.closeResolve=void 0});return this.emit("close"),this.closePromise}datasync(){return(0,pt.promisify)(this.fs,"fdatasync")(this.fd)}createReadStream(e){return this.fs.createReadStream("",{...e,fd:this})}createWriteStream(e){return this.fs.createWriteStream("",{...e,fd:this})}readableWebStream(e={}){let{type:r="bytes",autoClose:i=!1}=e,n=0;if(this.fd===-1)throw new Error("The FileHandle is closed");if(this.closePromise)throw new Error("The FileHandle is closing");if(this.readableWebStreamLocked)throw new Error("An error will be thrown if this method is called more than once or is called after the FileHandle is closed or closing.");this.readableWebStreamLocked=!0,this.ref();let s=u(()=>{this.readableWebStreamLocked=!1,this.unref(),i&&this.close().catch(()=>{})},"unlockAndCleanup");return new ReadableStream({type:r==="bytes"?"bytes":void 0,autoAllocateChunkSize:16384,pull:u(async a=>{try{let l=a.byobRequest?.view;if(!l){let o=new Uint8Array(16384),f=await this.read(o,0,o.length,n);if(f.bytesRead===0){a.close(),s();return}n+=f.bytesRead,a.enqueue(o.slice(0,f.bytesRead));return}let c=await this.read(l,l.byteOffset,l.byteLength,n);if(c.bytesRead===0){a.close(),s();return}n+=c.bytesRead,a.byobRequest.respond(c.bytesRead)}catch(l){a.error(l),s()}},"pull"),cancel:u(async()=>{s()},"cancel")})}async read(e,r,i,n){let s=n??this.position,a=await(0,pt.promisify)(this.fs,"read",l=>({bytesRead:l,buffer:e}))(this.fd,e,r,i,s);return n==null&&(this.position+=a.bytesRead),a}readv(e,r){return(0,pt.promisify)(this.fs,"readv",i=>({bytesRead:i,buffers:e}))(this.fd,e,r)}readFile(e){return(0,pt.promisify)(this.fs,"readFile")(this.fd,e)}stat(e){return(0,pt.promisify)(this.fs,"fstat")(this.fd,e)}sync(){return(0,pt.promisify)(this.fs,"fsync")(this.fd)}truncate(e){return(0,pt.promisify)(this.fs,"ftruncate")(this.fd,e)}utimes(e,r){return(0,pt.promisify)(this.fs,"futimes")(this.fd,e,r)}async write(e,r,i,n){let s=typeof n!="number",a=s?this.position:n,l=await(0,pt.promisify)(this.fs,"write",c=>({bytesWritten:c,buffer:e}))(this.fd,e,r,i,a);return s&&(this.position+=l.bytesWritten),l}writev(e,r){return(0,pt.promisify)(this.fs,"writev",i=>({bytesWritten:i,buffers:e}))(this.fd,e,r)}writeFile(e,r){return(0,pt.promisify)(this.fs,"writeFile")(this.fd,e,r)}async[Symbol.asyncDispose](){await this.close()}ref(){this.refs++}unref(){this.refs--,this.refs===0&&(this.fd=-1,this.closeResolve&&(0,pt.promisify)(this.fs,"close")(this.fd).then(this.closeResolve,this.closeReject))}};u(i_,"FileHandle");var r_=i_;Pp.FileHandle=r_});var XC=x(Np=>{"use strict";Object.defineProperty(Np,"__esModule",{value:!0});Np.FsPromises=void 0;var oe=on(),QG=vr(),a_=class a_{constructor(e,r,i={}){if(this.fs=e,this.path=r,this.options=i,this.eventQueue=[],this.resolveQueue=[],this.finished=!1,this.maxQueue=i.maxQueue||2048,this.overflow=i.overflow||"ignore",this.startWatching(),i.signal){if(i.signal.aborted){this.finish();return}i.signal.addEventListener("abort",()=>{this.finish()})}}startWatching(){try{this.watcher=this.fs.watch(this.path,this.options,(e,r)=>{this.enqueueEvent({eventType:e,filename:r})})}catch(e){throw this.finish(),e}}enqueueEvent(e){if(!this.finished){if(this.eventQueue.length>=this.maxQueue)if(this.overflow==="throw"){let r=new Error(`Watch queue overflow: more than ${this.maxQueue} events queued`);this.finish(r);return}else this.eventQueue.shift(),console.warn(`Watch queue overflow: dropping event due to exceeding maxQueue of ${this.maxQueue}`);if(this.eventQueue.push(e),this.resolveQueue.length>0){let{resolve:r}=this.resolveQueue.shift(),i=this.eventQueue.shift();r({value:i,done:!1})}}}finish(e){if(!this.finished)for(this.finished=!0,this.watcher&&(this.watcher.close(),this.watcher=null);this.resolveQueue.length>0;){let{resolve:r,reject:i}=this.resolveQueue.shift();e?i(e):r({value:void 0,done:!0})}}async next(){return this.finished?{value:void 0,done:!0}:this.eventQueue.length>0?{value:this.eventQueue.shift(),done:!1}:new Promise((e,r)=>{this.resolveQueue.push({resolve:e,reject:r})})}async return(){return this.finish(),{value:void 0,done:!0}}async throw(e){throw this.finish(e),e}[Symbol.asyncIterator](){return this}};u(a_,"FSWatchAsyncIterator");var n_=a_,o_=class o_{constructor(e,r){this.fs=e,this.FileHandle=r,this.constants=QG.constants,this.cp=(0,oe.promisify)(this.fs,"cp"),this.opendir=(0,oe.promisify)(this.fs,"opendir"),this.statfs=(0,oe.promisify)(this.fs,"statfs"),this.lutimes=(0,oe.promisify)(this.fs,"lutimes"),this.glob=(0,oe.promisify)(this.fs,"glob"),this.access=(0,oe.promisify)(this.fs,"access"),this.chmod=(0,oe.promisify)(this.fs,"chmod"),this.chown=(0,oe.promisify)(this.fs,"chown"),this.copyFile=(0,oe.promisify)(this.fs,"copyFile"),this.lchmod=(0,oe.promisify)(this.fs,"lchmod"),this.lchown=(0,oe.promisify)(this.fs,"lchown"),this.link=(0,oe.promisify)(this.fs,"link"),this.lstat=(0,oe.promisify)(this.fs,"lstat"),this.mkdir=(0,oe.promisify)(this.fs,"mkdir"),this.mkdtemp=(0,oe.promisify)(this.fs,"mkdtemp"),this.readdir=(0,oe.promisify)(this.fs,"readdir"),this.readlink=(0,oe.promisify)(this.fs,"readlink"),this.realpath=(0,oe.promisify)(this.fs,"realpath"),this.rename=(0,oe.promisify)(this.fs,"rename"),this.rmdir=(0,oe.promisify)(this.fs,"rmdir"),this.rm=(0,oe.promisify)(this.fs,"rm"),this.stat=(0,oe.promisify)(this.fs,"stat"),this.symlink=(0,oe.promisify)(this.fs,"symlink"),this.truncate=(0,oe.promisify)(this.fs,"truncate"),this.unlink=(0,oe.promisify)(this.fs,"unlink"),this.utimes=(0,oe.promisify)(this.fs,"utimes"),this.readFile=(i,n)=>(0,oe.promisify)(this.fs,"readFile")(i instanceof this.FileHandle?i.fd:i,n),this.appendFile=(i,n,s)=>(0,oe.promisify)(this.fs,"appendFile")(i instanceof this.FileHandle?i.fd:i,n,s),this.open=(i,n="r",s)=>(0,oe.promisify)(this.fs,"open",a=>new this.FileHandle(this.fs,a))(i,n,s),this.writeFile=(i,n,s)=>((0,oe.isReadableStream)(n)?(0,oe.streamToBuffer)(n):Promise.resolve(n)).then(l=>(0,oe.promisify)(this.fs,"writeFile")(i instanceof this.FileHandle?i.fd:i,l,s)),this.watch=(i,n)=>{let s=typeof n=="string"?{encoding:n}:n||{};return new n_(this.fs,i,s)}}};u(o_,"FsPromises");var s_=o_;Np.FsPromises=s_});var QC=x(mt=>{"use strict";Object.defineProperty(mt,"__esModule",{value:!0});mt.newNotAllowedError=mt.newTypeMismatchError=mt.newNotFoundError=mt.assertCanWrite=mt.assertName=mt.basename=mt.ctx=void 0;var eZ=u((t={})=>({separator:"/",syncHandleAllowed:!1,mode:"read",...t}),"ctx");mt.ctx=eZ;var tZ=u((t,e)=>{t[t.length-1]===e&&(t=t.slice(0,-1));let r=t.lastIndexOf(e);return r===-1?t:t.slice(r+1)},"basename");mt.basename=tZ;var rZ=/^(\.{1,2})$|^(.*([\/\\]).*)$/,iZ=u((t,e,r)=>{if(!t||rZ.test(t))throw new TypeError(`Failed to execute '${e}' on '${r}': Name is not allowed.`)},"assertName");mt.assertName=iZ;var nZ=u(t=>{if(t!=="readwrite")throw new DOMException("The request is not allowed by the user agent or the platform in the current context.","NotAllowedError")},"assertCanWrite");mt.assertCanWrite=nZ;var sZ=u(()=>new DOMException("A requested file or directory could not be found at the time an operation was processed.","NotFoundError"),"newNotFoundError");mt.newNotFoundError=sZ;var aZ=u(()=>new DOMException("The path supplied exists, but was not an entry of requested type.","TypeMismatchError"),"newTypeMismatchError");mt.newTypeMismatchError=aZ;var oZ=u(()=>new DOMException("Permission not granted.","NotAllowedError"),"newNotAllowedError");mt.newNotAllowedError=oZ});var eI=x(Yc=>{"use strict";Object.defineProperty(Yc,"__esModule",{value:!0});Yc.toTreeSync=void 0;var lZ=ew(),cZ=QC(),fZ=u((t,e={})=>{let r=e.separator||"/",i=e.dir||r;i[i.length-1]!==r&&(i+=r);let n=e.tab||"",s=e.depth??10,a=" (...)";if(s>0){let c=t.readdirSync(i,{withFileTypes:!0});a=(0,lZ.printTree)(n,c.map(o=>f=>o.isDirectory()?(0,Yc.toTreeSync)(t,{dir:i+o.name,depth:s-1,tab:f}):o.isSymbolicLink()?""+o.name+" \u2192 "+t.readlinkSync(i+o.name):""+o.name))}return(0,cZ.basename)(i,r)+r+a},"toTreeSync");Yc.toTreeSync=fZ});var iI=x(q=>{"use strict";Object.defineProperty(q,"__esModule",{value:!0});q.getWriteFileOptions=q.writeFileDefaults=q.getRealpathOptsAndCb=q.getRealpathOptions=q.getStatfsOptsAndCb=q.getStatfsOptions=q.getStatOptsAndCb=q.getStatOptions=q.getAppendFileOptsAndCb=q.getAppendFileOpts=q.getOpendirOptsAndCb=q.getOpendirOptions=q.getReaddirOptsAndCb=q.getReaddirOptions=q.getReadFileOptions=q.getRmOptsAndCb=q.getRmdirOptions=q.getDefaultOptsAndCb=q.getDefaultOpts=q.optsDefaults=q.getMkdirOptions=void 0;q.getOptions=rI;q.optsGenerator=bi;q.optsAndCbGenerator=as;var Dp=Lo(),uZ=Vc(),l_=on(),tI={mode:511,recursive:!1},hZ=u(t=>typeof t=="number"?Object.assign({},tI,{mode:t}):Object.assign({},tI,t),"getMkdirOptions");q.getMkdirOptions=hZ;var dZ=u(t=>`Expected options to be either an object or a string, but got ${t} instead`,"ERRSTR_OPTS");function rI(t,e){let r;if(e){let i=typeof e;switch(i){case"string":r=Object.assign({},t,{encoding:e});break;case"object":r=Object.assign({},t,e);break;default:throw TypeError(dZ(i))}}else return t;return r.encoding!=="buffer"&&(0,uZ.assertEncoding)(r.encoding),r}u(rI,"getOptions");function bi(t){return e=>rI(t,e)}u(bi,"optsGenerator");function as(t){return(e,r)=>typeof e=="function"?[t(),e]:[t(e),(0,l_.validateCallback)(r)]}u(as,"optsAndCbGenerator");q.optsDefaults={encoding:"utf8"};q.getDefaultOpts=bi(q.optsDefaults);q.getDefaultOptsAndCb=as(q.getDefaultOpts);var pZ={recursive:!1},mZ=u(t=>Object.assign({},pZ,t),"getRmdirOptions");q.getRmdirOptions=mZ;var wZ=bi(q.optsDefaults);q.getRmOptsAndCb=as(wZ);var yZ={flag:"r"};q.getReadFileOptions=bi(yZ);var gZ={encoding:"utf8",recursive:!1,withFileTypes:!1};q.getReaddirOptions=bi(gZ);q.getReaddirOptsAndCb=as(q.getReaddirOptions);var bZ={encoding:"utf8",bufferSize:32,recursive:!1};q.getOpendirOptions=bi(bZ);q.getOpendirOptsAndCb=as(q.getOpendirOptions);var _Z={encoding:"utf8",mode:438,flag:Dp.FLAGS[Dp.FLAGS.a]};q.getAppendFileOpts=bi(_Z);q.getAppendFileOptsAndCb=as(q.getAppendFileOpts);var vZ={bigint:!1},SZ=u((t={})=>Object.assign({},vZ,t),"getStatOptions");q.getStatOptions=SZ;var EZ=u((t,e)=>typeof t=="function"?[(0,q.getStatOptions)(),t]:[(0,q.getStatOptions)(t),(0,l_.validateCallback)(e)],"getStatOptsAndCb");q.getStatOptsAndCb=EZ;var FZ={bigint:!1},kZ=u((t={})=>Object.assign({},FZ,t),"getStatfsOptions");q.getStatfsOptions=kZ;var TZ=u((t,e)=>typeof t=="function"?[(0,q.getStatfsOptions)(),t]:[(0,q.getStatfsOptions)(t),(0,l_.validateCallback)(e)],"getStatfsOptsAndCb");q.getStatfsOptsAndCb=TZ;var xZ=q.optsDefaults;q.getRealpathOptions=bi(xZ);q.getRealpathOptsAndCb=as(q.getRealpathOptions);q.writeFileDefaults={encoding:"utf8",mode:438,flag:Dp.FLAGS[Dp.FLAGS.w]};q.getWriteFileOptions=bi(q.writeFileDefaults)});var sI=x(Cp=>{"use strict";Object.defineProperty(Cp,"__esModule",{value:!0});Cp.Dir=void 0;var nI=on(),OZ=op(),os=Hc(),f_=class f_{constructor(e,r){this.link=e,this.options=r,this.iteratorInfo=[],this.closed=!1,this.operationQueue=null,this.path=e.getPath(),this.iteratorInfo.push(e.children[Symbol.iterator]())}closeBase(){}readBase(e){let r,i,n,s;do{do if({done:r,value:i}=e[e.length-1].next(),!r)[n,s]=i;else break;while(n==="."||n==="..");if(r){if(e.pop(),e.length===0)break;r=!1}else return this.options.recursive&&s.children.size&&e.push(s.children[Symbol.iterator]()),OZ.default.build(s,this.options.encoding)}while(!r);return null}close(e){if(e===void 0)return this.closed?Promise.reject(new os.Error("ERR_DIR_CLOSED")):new Promise((r,i)=>{this.close(n=>{n?i(n):r()})});if((0,nI.validateCallback)(e),this.closed){process.nextTick(e,new os.Error("ERR_DIR_CLOSED"));return}if(this.operationQueue!==null){this.operationQueue.push(()=>{this.close(e)});return}this.closed=!0;try{this.closeBase(),process.nextTick(e)}catch(r){process.nextTick(e,r)}}closeSync(){if(this.closed)throw new os.Error("ERR_DIR_CLOSED");if(this.operationQueue!==null)throw new os.Error("ERR_DIR_CONCURRENT_OPERATION");this.closed=!0,this.closeBase()}read(e){if(e===void 0)return new Promise((r,i)=>{this.read((n,s)=>{n?i(n):r(s??null)})});if((0,nI.validateCallback)(e),this.closed){process.nextTick(e,new os.Error("ERR_DIR_CLOSED"));return}if(this.operationQueue!==null){this.operationQueue.push(()=>{this.read(e)});return}this.operationQueue=[];try{let r=this.readBase(this.iteratorInfo);process.nextTick(()=>{let i=this.operationQueue;this.operationQueue=null;for(let n of i)n();e(null,r)})}catch(r){process.nextTick(()=>{let i=this.operationQueue;this.operationQueue=null;for(let n of i)n();e(r)})}}readSync(){if(this.closed)throw new os.Error("ERR_DIR_CLOSED");if(this.operationQueue!==null)throw new os.Error("ERR_DIR_CONCURRENT_OPERATION");return this.readBase(this.iteratorInfo)}[Symbol.asyncIterator](){return{next:u(async()=>{try{let e=await this.read();return e!==null?{done:!1,value:e}:{done:!0,value:void 0}}catch(e){throw e}},"next"),[Symbol.asyncIterator](){return this}}}};u(f_,"Dir");var c_=f_;Cp.Dir=c_});var lI=x(h_=>{"use strict";Object.defineProperty(h_,"__esModule",{value:!0});h_.globSync=CZ;var ls=Io(),RZ=nw(),aI=on(),AZ=ls.posix.join,PZ=ls.posix.relative,NZ=ls.posix.resolve;function oI(t,e){return(0,RZ.toRegex)(e).test(t)}u(oI,"matchesPattern");function DZ(t,e){return e?typeof e=="function"?e(t):(Array.isArray(e)?e:[e]).some(i=>oI(t,i)):!1}u(DZ,"isExcluded");function u_(t,e,r,i,n=0){let s=[],a=i.maxdepth??1/0,l=i.cwd?(0,aI.pathToFilename)(i.cwd):process.cwd();if(n>a)return s;try{let c=t.readdirSync(e,{withFileTypes:!0});for(let o of c){let f=AZ(e,o.name.toString()),h=PZ(l,f);if(DZ(h,i.exclude))continue;if(r.some(p=>oI(h,p))&&s.push(h),o.isDirectory()&&n<a){let p=u_(t,f,r,i,n+1);s.push(...p)}}}catch{}return s}u(u_,"walkDirectory");function CZ(t,e,r={}){let i=r.cwd?(0,aI.pathToFilename)(r.cwd):process.cwd(),n=NZ(i),s={cwd:n,exclude:r.exclude,maxdepth:r.maxdepth,withFileTypes:r.withFileTypes||!1},a=[];if(ls.posix.isAbsolute(e)){let l=ls.posix.dirname(e),c=ls.posix.basename(e),o=u_(t,l,[c],{...s,cwd:l});a.push(...o.map(f=>ls.posix.resolve(l,f)))}else{let l=u_(t,n,[e],s);a.push(...l)}return a=[...new Set(a)].sort(),a}u(CZ,"globSync")});var mI=x(Vt=>{"use strict";Object.defineProperty(Vt,"__esModule",{value:!0});Vt.FSWatcher=Vt.StatWatcher=Vt.Volume=void 0;Vt.pathToSteps=YZ;Vt.dataToStr=XZ;Vt.toUnixTimestamp=Ht;var je=Io(),w_=VC(),d_=Ab(),IZ=op(),$Z=GC(),Wo=nn(),Mp=Kb(),BZ=ZC(),jp=JC(),LZ=vr(),hI=t_(),cs=Vc(),MZ=YC(),dI=Nb(),jZ=XC(),qZ=eI(),$p=Lo(),UZ=Hc(),ie=iI(),D=on(),zZ=sI(),nt=Ep(),WZ=je.resolve,{O_SYMLINK:cI,F_OK:p_,R_OK:HZ,W_OK:VZ,X_OK:GZ,COPYFILE_EXCL:ZZ,COPYFILE_FICLONE_FORCE:KZ}=LZ.constants,wne=je.posix?je.posix.sep:je.sep,Ip=je.posix?je.posix.relative:je.relative,m_=je.posix?je.posix.join:je.join,fI=je.posix?je.posix.dirname:je.dirname,uI=je.posix?je.posix.normalize:je.normalize,JZ=128;function YZ(t){return(0,nt.filenameToSteps)((0,D.pathToFilename)(t))}u(YZ,"pathToSteps");function XZ(t,e=cs.ENCODING_UTF8){return Wo.Buffer.isBuffer(t)?t.toString(e):t instanceof Uint8Array?(0,Wo.bufferFrom)(t).toString(e):String(t)}u(XZ,"dataToStr");function Ht(t){if(typeof t=="string"&&+t==t)return+t;if(t instanceof Date)return t.getTime()/1e3;if(isFinite(t))return t<0?Date.now()/1e3:t;throw new Error("Cannot parse time: "+t)}u(Ht,"toUnixTimestamp");function Uo(t){if(typeof t!="number")throw TypeError($p.ERRSTR.UID)}u(Uo,"validateUid");function zo(t){if(typeof t!="number")throw TypeError($p.ERRSTR.GID)}u(zo,"validateGid");var y_=class y_{get promises(){if(this.promisesApi===null)throw new Error("Promise is not supported in this environment.");return this.promisesApi}constructor(e=new w_.Superblock){this._core=e,this.promisesApi=new jZ.FsPromises(this,MZ.FileHandle),this.openSync=(c,o,f=438)=>{let h=(0,D.modeToNumber)(f),d=(0,D.pathToFilename)(c),p=(0,D.flagsToNumber)(o);return this._core.open(d,p,h,!(p&cI))},this.open=(c,o,f,h)=>{let d=f,p=h;typeof f=="function"&&(d=438,p=f),d=d||438;let m=(0,D.modeToNumber)(d),w=(0,D.pathToFilename)(c),g=(0,D.flagsToNumber)(o);this.wrapAsync(this._core.open,[w,g,m,!(g&cI)],p)},this.closeSync=c=>{this._core.close(c)},this.close=(c,o)=>{(0,nt.validateFd)(c);let f=this._core.getFileByFdOrThrow(c,"close");this.wrapAsync(this._core.close,[f.fd],o)},this.readSync=(c,o,f,h,d)=>((0,nt.validateFd)(c),this._core.read(c,o,f,h,d)),this.read=(c,o,f,h,d,p)=>{if((0,D.validateCallback)(p),h===0)return(0,Mp.default)(()=>{p&&p(null,0,o)});Promise.resolve().then(()=>{try{let m=this._core.read(c,o,f,h,d);p(null,m,o)}catch(m){p(m)}})},this.readv=(c,o,f,h)=>{let d=f,p=h;typeof f=="function"&&([d,p]=[null,f]),(0,D.validateCallback)(p),Promise.resolve().then(()=>{try{let m=this._core.readv(c,o,d);p(null,m,o)}catch(m){p(m)}})},this.readvSync=(c,o,f)=>((0,nt.validateFd)(c),this._core.readv(c,o,f??null)),this._readfile=(c,o,f)=>{let h,p=typeof c=="number"&&(0,nt.isFd)(c),m;if(p)m=c;else{let w=(0,D.pathToFilename)(c),g=String(c),b=g.length>1&&g.endsWith("/"),_=this._core.getResolvedLinkOrThrow(w,"open"),S=_.getNode();if(S.isDirectory())throw(0,D.createError)("EISDIR","open",_.getPath());if(b&&S.isFile())throw(0,D.createError)("ENOTDIR","open",g);m=this.openSync(c,o)}try{h=(0,D.bufferToEncoding)(this._core.getFileByFdOrThrow(m).getBuffer(),f)}finally{p||this.closeSync(m)}return h},this.readFileSync=(c,o)=>{let f=(0,ie.getReadFileOptions)(o),h=(0,D.flagsToNumber)(f.flag);return this._readfile(c,h,f.encoding)},this.readFile=(c,o,f)=>{let[h,d]=(0,ie.optsAndCbGenerator)(ie.getReadFileOptions)(o,f),p=(0,D.flagsToNumber)(h.flag);this.wrapAsync(this._readfile,[c,p,h.encoding],d)},this.writeSync=(c,o,f,h,d)=>{let[,p,m,w,g]=(0,D.getWriteSyncArgs)(c,o,f,h,d);return this._write(c,p,m,w,g)},this.write=(c,o,f,h,d,p)=>{let[,m,w,g,b,_,S]=(0,D.getWriteArgs)(c,o,f,h,d,p);Promise.resolve().then(()=>{try{let F=this._write(c,w,g,b,_);m?S(null,F,o):S(null,F,w)}catch(F){S(F)}})},this.writev=(c,o,f,h)=>{let d=f,p=h;typeof f=="function"&&([d,p]=[null,f]),(0,D.validateCallback)(p),Promise.resolve().then(()=>{try{let m=this.writevBase(c,o,d);p(null,m,o)}catch(m){p(m)}})},this.writevSync=(c,o,f)=>((0,nt.validateFd)(c),this.writevBase(c,o,f??null)),this.writeFileSync=(c,o,f)=>{let h=(0,ie.getWriteFileOptions)(f),d=(0,D.flagsToNumber)(h.flag),p=(0,D.modeToNumber)(h.mode),m=(0,nt.dataToBuffer)(o,h.encoding);this._core.writeFile(c,m,d,p)},this.writeFile=(c,o,f,h)=>{let d=f,p=h;typeof f=="function"&&([d,p]=[ie.writeFileDefaults,f]);let m=(0,D.validateCallback)(p),w=(0,ie.getWriteFileOptions)(d),g=(0,D.flagsToNumber)(w.flag),b=(0,D.modeToNumber)(w.mode),_=(0,nt.dataToBuffer)(o,w.encoding);this.wrapAsync(this._core.writeFile,[c,_,g,b],m)},this.copyFileSync=(c,o,f)=>{let h=(0,D.pathToFilename)(c),d=(0,D.pathToFilename)(o);return this._copyFile(h,d,(f||0)|0)},this.copyFile=(c,o,f,h)=>{let d=(0,D.pathToFilename)(c),p=(0,D.pathToFilename)(o),m,w;typeof f=="function"?[m,w]=[0,f]:[m,w]=[f,h],(0,D.validateCallback)(w),this.wrapAsync(this._copyFile,[d,p,m],w)},this._cp=(c,o,f)=>{if(f.filter&&!f.filter(c,o))return;let h=f.dereference?this.statSync(c):this.lstatSync(c),d=null;try{d=this.lstatSync(o)}catch(p){if(p.code!=="ENOENT")throw p}if(d&&h.ino===d.ino&&h.dev===d.dev)throw(0,D.createError)("EINVAL","cp",c,o);if(d){if(h.isDirectory()&&!d.isDirectory())throw(0,D.createError)("EISDIR","cp",c,o);if(!h.isDirectory()&&d.isDirectory())throw(0,D.createError)("ENOTDIR","cp",c,o)}if(h.isDirectory()&&this.isSrcSubdir(c,o))throw(0,D.createError)("EINVAL","cp",c,o);{let p=fI(o);this.existsSync(p)||this.mkdirSync(p,{recursive:!0})}if(h.isDirectory()){if(!f.recursive)throw(0,D.createError)("EISDIR","cp",c);this.cpDirSync(h,d,c,o,f)}else if(h.isFile()||h.isCharacterDevice()||h.isBlockDevice())this.cpFileSync(h,d,c,o,f);else if(h.isSymbolicLink()&&!f.dereference)this.cpSymlinkSync(d,c,o,f);else throw(0,D.createError)("EINVAL","cp",c)},this.linkSync=(c,o)=>{let f=(0,D.pathToFilename)(c),h=(0,D.pathToFilename)(o);this._core.link(f,h)},this.link=(c,o,f)=>{let h=(0,D.pathToFilename)(c),d=(0,D.pathToFilename)(o);this.wrapAsync(this._core.link,[h,d],f)},this.unlinkSync=c=>{let o=(0,D.pathToFilename)(c);this._core.unlink(o)},this.unlink=(c,o)=>{let f=(0,D.pathToFilename)(c);this.wrapAsync(this._core.unlink,[f],o)},this.symlinkSync=(c,o,f)=>{let h=(0,D.pathToFilename)(c),d=(0,D.pathToFilename)(o);this._core.symlink(h,d)},this.symlink=(c,o,f,h)=>{let d=(0,D.validateCallback)(typeof f=="function"?f:h),p=(0,D.pathToFilename)(c),m=(0,D.pathToFilename)(o);this.wrapAsync(this._core.symlink,[p,m],d)},this._lstat=(c,o=!1,f=!1)=>{let h;try{h=this._core.getLinkOrThrow(c,"lstat")}catch(d){if(d.code==="ENOENT"&&!f)return;throw d}return d_.default.build(h.getNode(),o)},this.lstatSync=(c,o)=>{let{throwIfNoEntry:f=!0,bigint:h=!1}=(0,ie.getStatOptions)(o);return this._lstat((0,D.pathToFilename)(c),h,f)},this.renameSync=(c,o)=>{let f=(0,D.pathToFilename)(c),h=(0,D.pathToFilename)(o);this._core.rename(f,h)},this.rename=(c,o,f)=>{let h=(0,D.pathToFilename)(c),d=(0,D.pathToFilename)(o);this.wrapAsync(this._core.rename,[h,d],f)},this.existsSync=c=>{try{return this._exists((0,D.pathToFilename)(c))}catch{return!1}},this.exists=(c,o)=>{let f=(0,D.pathToFilename)(c);if(typeof o!="function")throw Error($p.ERRSTR.CB);Promise.resolve().then(()=>{try{o(this._exists(f))}catch{o(!1)}})},this.accessSync=(c,o=p_)=>{let f=(0,D.pathToFilename)(c);o=o|0,this._access(f,o)},this.access=(c,o,f)=>{let h=p_,d;typeof o!="function"?[h,d]=[o|0,(0,D.validateCallback)(f)]:d=o;let p=(0,D.pathToFilename)(c);this.wrapAsync(this._access,[p,h],d)},this.appendFileSync=(c,o,f)=>{let h=(0,ie.getAppendFileOpts)(f);(!h.flag||(0,nt.isFd)(c))&&(h.flag="a"),this.writeFileSync(c,o,h)},this.appendFile=(c,o,f,h)=>{let[d,p]=(0,ie.getAppendFileOptsAndCb)(f,h);(!d.flag||(0,nt.isFd)(c))&&(d.flag="a"),this.writeFile(c,o,d,p)},this._readdir=(c,o)=>{let f=(0,nt.filenameToSteps)(c),h=this._core.getResolvedLinkOrThrow(c,"scandir"),d=h.getNode();if(!d.isDirectory())throw(0,D.createError)("ENOTDIR","scandir",c);if(!d.canRead())throw(0,D.createError)("EACCES","scandir",c);let p=[];for(let w of h.children.keys()){let g=h.getChild(w);if(!(!g||w==="."||w==="..")&&(p.push(IZ.default.build(g,o.encoding)),o.recursive&&g.children.size)){let b={...o,recursive:!0,withFileTypes:!0},_=this._readdir(g.getPath(),b);p.push(..._)}}if(!nt.isWin&&o.encoding!=="buffer"&&p.sort((w,g)=>w.name<g.name?-1:w.name>g.name?1:0),o.withFileTypes)return p;let m=c;return nt.isWin&&(m=m.replace(/\\/g,"/")),p.map(w=>{if(o.recursive){let g=m_(w.parentPath,w.name.toString());return nt.isWin&&(g=g.replace(/\\/g,"/")),g.replace(m+je.posix.sep,"")}return w.name})},this.readdirSync=(c,o)=>{let f=(0,ie.getReaddirOptions)(o),h=(0,D.pathToFilename)(c);return this._readdir(h,f)},this.readdir=(c,o,f)=>{let[h,d]=(0,ie.getReaddirOptsAndCb)(o,f),p=(0,D.pathToFilename)(c);this.wrapAsync(this._readdir,[p,h],d)},this._readlink=(c,o)=>{let h=this._core.getLinkOrThrow(c,"readlink").getNode();if(!h.isSymlink())throw(0,D.createError)("EINVAL","readlink",c);return(0,cs.strToEncoding)(h.symlink,o)},this.readlinkSync=(c,o)=>{let f=(0,ie.getDefaultOpts)(o),h=(0,D.pathToFilename)(c);return this._readlink(h,f.encoding)},this.readlink=(c,o,f)=>{let[h,d]=(0,ie.getDefaultOptsAndCb)(o,f),p=(0,D.pathToFilename)(c);this.wrapAsync(this._readlink,[p,h.encoding],d)},this._fsync=c=>{this._core.getFileByFdOrThrow(c,"fsync")},this.fsyncSync=c=>{this._fsync(c)},this.fsync=(c,o)=>{this.wrapAsync(this._fsync,[c],o)},this._fdatasync=c=>{this._core.getFileByFdOrThrow(c,"fdatasync")},this.fdatasyncSync=c=>{this._fdatasync(c)},this.fdatasync=(c,o)=>{this.wrapAsync(this._fdatasync,[c],o)},this._ftruncate=(c,o)=>{this._core.getFileByFdOrThrow(c,"ftruncate").truncate(o)},this.ftruncateSync=(c,o)=>{this._ftruncate(c,o)},this.ftruncate=(c,o,f)=>{let h=typeof o=="number"?o:0,d=(0,D.validateCallback)(typeof o=="number"?f:o);this.wrapAsync(this._ftruncate,[c,h],d)},this._truncate=(c,o)=>{let f=this.openSync(c,"r+");try{this.ftruncateSync(f,o)}finally{this.closeSync(f)}},this.truncateSync=(c,o)=>{if((0,nt.isFd)(c))return this.ftruncateSync(c,o);this._truncate(c,o)},this.truncate=(c,o,f)=>{let h=typeof o=="number"?o:0,d=(0,D.validateCallback)(typeof o=="number"?f:o);if((0,nt.isFd)(c))return this.ftruncate(c,h,d);this.wrapAsync(this._truncate,[c,h],d)},this._futimes=(c,o,f)=>{let d=this._core.getFileByFdOrThrow(c,"futimes").node;d.atime=new Date(o*1e3),d.mtime=new Date(f*1e3)},this.futimesSync=(c,o,f)=>{this._futimes(c,Ht(o),Ht(f))},this.futimes=(c,o,f,h)=>{this.wrapAsync(this._futimes,[c,Ht(o),Ht(f)],h)},this._utimes=(c,o,f,h=!0)=>{let d=this._core,m=(h?d.getResolvedLinkOrThrow(c,"utimes"):d.getLinkOrThrow(c,"lutimes")).getNode();m.atime=new Date(o*1e3),m.mtime=new Date(f*1e3)},this.utimesSync=(c,o,f)=>{this._utimes((0,D.pathToFilename)(c),Ht(o),Ht(f),!0)},this.utimes=(c,o,f,h)=>{this.wrapAsync(this._utimes,[(0,D.pathToFilename)(c),Ht(o),Ht(f),!0],h)},this.lutimesSync=(c,o,f)=>{this._utimes((0,D.pathToFilename)(c),Ht(o),Ht(f),!1)},this.lutimes=(c,o,f,h)=>{this.wrapAsync(this._utimes,[(0,D.pathToFilename)(c),Ht(o),Ht(f),!1],h)},this.mkdirSync=(c,o)=>{let f=(0,ie.getMkdirOptions)(o),h=(0,D.modeToNumber)(f.mode,511),d=(0,D.pathToFilename)(c);if(f.recursive)return this._core.mkdirp(d,h);this._core.mkdir(d,h)},this.mkdir=(c,o,f)=>{let h=(0,ie.getMkdirOptions)(o),d=(0,D.validateCallback)(typeof o=="function"?o:f),p=(0,D.modeToNumber)(h.mode,511),m=(0,D.pathToFilename)(c);h.recursive?this.wrapAsync(this._core.mkdirp,[m,p],d):this.wrapAsync(this._core.mkdir,[m,p],d)},this._mkdtemp=(c,o,f=5)=>{let h=c+(0,D.genRndStr6)();try{return this._core.mkdir(h,511),(0,cs.strToEncoding)(h,o)}catch(d){if(d.code==="EEXIST"){if(f>1)return this._mkdtemp(c,o,f-1);throw Error("Could not create temp dir.")}else throw d}},this.mkdtempSync=(c,o)=>{let{encoding:f}=(0,ie.getDefaultOpts)(o);if(!c||typeof c!="string")throw new TypeError("filename prefix is required");return(0,D.nullCheck)(c),this._mkdtemp(c,f)},this.mkdtemp=(c,o,f)=>{let[{encoding:h},d]=(0,ie.getDefaultOptsAndCb)(o,f);if(!c||typeof c!="string")throw new TypeError("filename prefix is required");(0,D.nullCheck)(c)&&this.wrapAsync(this._mkdtemp,[c,h],d)},this.rmdirSync=(c,o)=>{let f=(0,ie.getRmdirOptions)(o);this._core.rmdir((0,D.pathToFilename)(c),f.recursive)},this.rmdir=(c,o,f)=>{let h=(0,ie.getRmdirOptions)(o),d=(0,D.validateCallback)(typeof o=="function"?o:f);this.wrapAsync(this._core.rmdir,[(0,D.pathToFilename)(c),h.recursive],d)},this.rmSync=(c,o)=>{this._core.rm((0,D.pathToFilename)(c),o?.force,o?.recursive)},this.rm=(c,o,f)=>{let[h,d]=(0,ie.getRmOptsAndCb)(o,f);this.wrapAsync(this._core.rm,[(0,D.pathToFilename)(c),h?.force,h?.recursive],d)},this._fchmod=(c,o)=>{this._core.getFileByFdOrThrow(c,"fchmod").chmod(o)},this.fchmodSync=(c,o)=>{this._fchmod(c,(0,D.modeToNumber)(o))},this.fchmod=(c,o,f)=>{this.wrapAsync(this._fchmod,[c,(0,D.modeToNumber)(o)],f)},this._chmod=(c,o,f=!0)=>{(f?this._core.getResolvedLinkOrThrow(c,"chmod"):this._core.getLinkOrThrow(c,"chmod")).getNode().chmod(o)},this.chmodSync=(c,o)=>{let f=(0,D.modeToNumber)(o),h=(0,D.pathToFilename)(c);this._chmod(h,f,!0)},this.chmod=(c,o,f)=>{let h=(0,D.modeToNumber)(o),d=(0,D.pathToFilename)(c);this.wrapAsync(this._chmod,[d,h],f)},this._lchmod=(c,o)=>{this._chmod(c,o,!1)},this.lchmodSync=(c,o)=>{let f=(0,D.modeToNumber)(o),h=(0,D.pathToFilename)(c);this._lchmod(h,f)},this.lchmod=(c,o,f)=>{let h=(0,D.modeToNumber)(o),d=(0,D.pathToFilename)(c);this.wrapAsync(this._lchmod,[d,h],f)},this._fchown=(c,o,f)=>{this._core.getFileByFdOrThrow(c,"fchown").chown(o,f)},this.fchownSync=(c,o,f)=>{Uo(o),zo(f),this._fchown(c,o,f)},this.fchown=(c,o,f,h)=>{Uo(o),zo(f),this.wrapAsync(this._fchown,[c,o,f],h)},this._chown=(c,o,f)=>{this._core.getResolvedLinkOrThrow(c,"chown").getNode().chown(o,f)},this.chownSync=(c,o,f)=>{Uo(o),zo(f),this._chown((0,D.pathToFilename)(c),o,f)},this.chown=(c,o,f,h)=>{Uo(o),zo(f),this.wrapAsync(this._chown,[(0,D.pathToFilename)(c),o,f],h)},this._lchown=(c,o,f)=>{this._core.getLinkOrThrow(c,"lchown").getNode().chown(o,f)},this.lchownSync=(c,o,f)=>{Uo(o),zo(f),this._lchown((0,D.pathToFilename)(c),o,f)},this.lchown=(c,o,f,h)=>{Uo(o),zo(f),this.wrapAsync(this._lchown,[(0,D.pathToFilename)(c),o,f],h)},this.statWatchers={},this.cpSync=(c,o,f)=>{let h=(0,D.pathToFilename)(c),d=(0,D.pathToFilename)(o),p={dereference:f?.dereference??!1,errorOnExist:f?.errorOnExist??!1,filter:f?.filter,force:f?.force??!0,mode:f?.mode??0,preserveTimestamps:f?.preserveTimestamps??!1,recursive:f?.recursive??!1,verbatimSymlinks:f?.verbatimSymlinks??!1};return this._cp(h,d,p)},this.cp=(c,o,f,h)=>{let d=(0,D.pathToFilename)(c),p=(0,D.pathToFilename)(o),m,w;typeof f=="function"?[m,w]=[{},f]:[m,w]=[f||{},h],(0,D.validateCallback)(w);let g={dereference:m?.dereference??!1,errorOnExist:m?.errorOnExist??!1,filter:m?.filter,force:m?.force??!0,mode:m?.mode??0,preserveTimestamps:m?.preserveTimestamps??!1,recursive:m?.recursive??!1,verbatimSymlinks:m?.verbatimSymlinks??!1};this.wrapAsync(this._cp,[d,p,g],w)},this.openAsBlob=async(c,o)=>{let f=(0,D.pathToFilename)(c),h;try{h=this._core.getResolvedLinkOrThrow(f,"open")}catch(w){throw w&&typeof w=="object"&&w.code==="ENOENT"?new UZ.TypeError("ERR_INVALID_ARG_VALUE"):w}let p=h.getNode().getBuffer(),m=o?.type||"";return new Blob([p],{type:m})},this.glob=(c,...o)=>{let[f,h]=o.length===1?[{},o[0]]:[o[0],o[1]];this.wrapAsync(this._globSync,[c,f||{}],h)},this.globSync=(c,o={})=>this._globSync(c,o),this._globSync=(c,o={})=>{let{globSync:f}=lI();return f(this,c,o)},this._opendir=(c,o)=>{let f=this._core.getResolvedLinkOrThrow(c,"scandir");if(!f.getNode().isDirectory())throw(0,D.createError)("ENOTDIR","scandir",c);return new zZ.Dir(f,o)},this.opendirSync=(c,o)=>{let f=(0,ie.getOpendirOptions)(o),h=(0,D.pathToFilename)(c);return this._opendir(h,f)},this.opendir=(c,o,f)=>{let[h,d]=(0,ie.getOpendirOptsAndCb)(o,f),p=(0,D.pathToFilename)(c);this.wrapAsync(this._opendir,[p,h],d)};let r=this;this.StatWatcher=class extends Bp{constructor(){super(r)}};let i=Hr;this.ReadStream=class extends i{constructor(...c){super(r,...c)}};let n=or;this.WriteStream=class extends n{constructor(...c){super(r,...c)}},this.FSWatcher=class extends Lp{constructor(){super(r)}};let s=u((c,o)=>{let f=this._core.getResolvedLinkOrThrow(c,"realpath");return(0,cs.strToEncoding)(f.getPath()||"/",o)},"_realpath"),a=u((c,o,f)=>{let[h,d]=(0,ie.getRealpathOptsAndCb)(o,f),p=(0,D.pathToFilename)(c);r.wrapAsync(s,[p,h.encoding],d)},"realpathImpl"),l=u((c,o)=>s((0,D.pathToFilename)(c),(0,ie.getRealpathOptions)(o).encoding),"realpathSyncImpl");this.realpath=a,this.realpath.native=a,this.realpathSync=l,this.realpathSync.native=l}wrapAsync(e,r,i){(0,D.validateCallback)(i),Promise.resolve().then(()=>{let n;try{n=e.apply(this,r)}catch(s){i(s);return}i(null,n)})}toTree(e={separator:je.sep}){return(0,qZ.toTreeSync)(this,e)}reset(){this._core.reset()}toJSON(e,r={},i=!1,n=!1){return this._core.toJSON(e,r,i,n)}fromJSON(e,r){return this._core.fromJSON(e,r)}fromNestedJSON(e,r){return this._core.fromNestedJSON(e,r)}mountSync(e,r){this._core.fromJSON(r,e)}_write(e,r,i,n,s){let a=this._core.getFileByFdOrThrow(e,"write");if(a.node.isSymlink())throw(0,D.createError)("EBADF","write",a.link.getPath());return a.write(r,i,n,s===-1||typeof s!="number"?void 0:s)}writevBase(e,r,i){let n=this._core.getFileByFdOrThrow(e),s=i??void 0;s===-1&&(s=void 0);let a=0;for(let l of r){let c=Wo.Buffer.from(l.buffer,l.byteOffset,l.byteLength),o=n.write(c,0,c.byteLength,s);if(s=void 0,a+=o,o<c.byteLength)break}return a}_copyFile(e,r,i){let n=this.readFileSync(e);if(i&ZZ&&this.existsSync(r))throw(0,D.createError)("EEXIST","copyFile",e,r);if(i&KZ)throw(0,D.createError)("ENOSYS","copyFile",e,r);this._core.writeFile(r,n,$p.FLAGS.w,438)}isSrcSubdir(e,r){try{let i=uI(e.startsWith("/")?e:"/"+e),n=uI(r.startsWith("/")?r:"/"+r);if(i===n)return!0;let s=Ip(i,n);return s===""||!s.startsWith("..")&&!(0,je.isAbsolute)(s)}catch{return!1}}cpFileSync(e,r,i,n,s){if(r){if(s.errorOnExist)throw(0,D.createError)("EEXIST","cp",n);if(!s.force)return;this.unlinkSync(n)}this.copyFileSync(i,n,s.mode),s.preserveTimestamps&&this.utimesSync(n,e.atime,e.mtime),this.chmodSync(n,Number(e.mode))}cpDirSync(e,r,i,n,s){r||this.mkdirSync(n);let a=this.readdirSync(i);for(let l of a){let c=m_(i,String(l)),o=m_(n,String(l));s.filter&&!s.filter(c,o)||this._cp(c,o,s)}this.chmodSync(n,Number(e.mode))}cpSymlinkSync(e,r,i,n){let s=String(this.readlinkSync(r));!n.verbatimSymlinks&&!(0,je.isAbsolute)(s)&&(s=WZ(fI(r),s)),e&&this.unlinkSync(i),this.symlinkSync(s,i)}lstat(e,r,i){let[{throwIfNoEntry:n=!0,bigint:s=!1},a]=(0,ie.getStatOptsAndCb)(r,i);this.wrapAsync(this._lstat,[(0,D.pathToFilename)(e),s,n],a)}_stat(e,r=!1,i=!0){let n;try{n=this._core.getResolvedLinkOrThrow(e,"stat")}catch(s){if(s.code==="ENOENT"&&!i)return;throw s}return d_.default.build(n.getNode(),r)}statSync(e,r){let{bigint:i=!0,throwIfNoEntry:n=!0}=(0,ie.getStatOptions)(r);return this._stat((0,D.pathToFilename)(e),i,n)}stat(e,r,i){let[{bigint:n=!1,throwIfNoEntry:s=!0},a]=(0,ie.getStatOptsAndCb)(r,i);this.wrapAsync(this._stat,[(0,D.pathToFilename)(e),n,s],a)}fstatBase(e,r=!1){let i=this._core.getFileByFd(e);if(!i)throw(0,D.createError)("EBADF","fstat");return d_.default.build(i.node,r)}fstatSync(e,r){return this.fstatBase(e,(0,ie.getStatOptions)(r).bigint)}fstat(e,r,i){let[n,s]=(0,ie.getStatOptsAndCb)(r,i);this.wrapAsync(this.fstatBase,[e,n.bigint],s)}_exists(e){return!!this._stat(e)}_access(e,r){let n=this._core.getLinkOrThrow(e,"access").getNode();if(r!==p_&&(r&HZ&&!n.canRead()||r&VZ&&!n.canWrite()||r&GZ&&!n.canExecute()))throw(0,D.createError)("EACCES","access",e)}watchFile(e,r,i){let n=(0,D.pathToFilename)(e),s=r,a=i;if(typeof s=="function"&&(a=r,s=null),typeof a!="function")throw Error('"watchFile()" requires a listener function');let l=5007,c=!0;s&&typeof s=="object"&&(typeof s.interval=="number"&&(l=s.interval),typeof s.persistent=="boolean"&&(c=s.persistent));let o=this.statWatchers[n];return o||(o=new this.StatWatcher,o.start(n,c,l),this.statWatchers[n]=o),o.addListener("change",a),o}unwatchFile(e,r){let i=(0,D.pathToFilename)(e),n=this.statWatchers[i];n&&(typeof r=="function"?n.removeListener("change",r):n.removeAllListeners("change"),n.listenerCount("change")===0&&(n.stop(),delete this.statWatchers[i]))}createReadStream(e,r){return new this.ReadStream(e,r)}createWriteStream(e,r){return new this.WriteStream(e,r)}watch(e,r,i){let n=(0,D.pathToFilename)(e),s=r;typeof r=="function"&&(i=r,s=null);let{persistent:a,recursive:l,encoding:c}=(0,ie.getDefaultOpts)(s);a===void 0&&(a=!0),l===void 0&&(l=!1);let o=new this.FSWatcher;return o.start(n,a,l,c),i&&o.addListener("change",i),o}_statfs(e,r=!1){return this._core.getResolvedLinkOrThrow(e,"statfs"),$Z.default.build(this._core,r)}statfsSync(e,r){let{bigint:i=!1}=(0,ie.getStatfsOptions)(r);return this._statfs((0,D.pathToFilename)(e),i)}statfs(e,r,i){let[{bigint:n=!1},s]=(0,ie.getStatfsOptsAndCb)(r,i);this.wrapAsync(this._statfs,[(0,D.pathToFilename)(e),n],s)}};u(y_,"Volume");var fs=y_;Vt.Volume=fs;fs.fromJSON=(t,e)=>new fs(w_.Superblock.fromJSON(t,e));fs.fromNestedJSON=(t,e)=>new fs(w_.Superblock.fromNestedJSON(t,e));function QZ(t){t.emit("stop")}u(QZ,"emitStop");var g_=class g_ extends hI.EventEmitter{constructor(e){super(),this.onInterval=()=>{try{let r=this.vol.statSync(this.filename);this.hasChanged(r)&&(this.emit("change",r,this.prev),this.prev=r)}finally{this.loop()}},this.vol=e}loop(){this.timeoutRef=this.setTimeout(this.onInterval,this.interval)}hasChanged(e){return e.mtimeMs>this.prev.mtimeMs||e.nlink!==this.prev.nlink}start(e,r=!0,i=5007){this.filename=(0,D.pathToFilename)(e),this.setTimeout=r?setTimeout.bind(globalThis):BZ.default,this.interval=i,this.prev=this.vol.statSync(this.filename),this.loop()}stop(){clearTimeout(this.timeoutRef),(0,Mp.default)(()=>{QZ.call(this,this)})}};u(g_,"StatWatcher");var Bp=g_;Vt.StatWatcher=Bp;var ar;function eK(t){ar=(0,Wo.bufferAllocUnsafe)(t),ar.used=0}u(eK,"allocNewPool");(0,dI.inherits)(Hr,jp.Readable);Vt.ReadStream=Hr;function Hr(t,e,r){if(!(this instanceof Hr))return new Hr(t,e,r);if(this._vol=t,r=Object.assign({},(0,ie.getOptions)(r,{})),r.highWaterMark===void 0&&(r.highWaterMark=64*1024),jp.Readable.call(this,r),this.path=(0,D.pathToFilename)(e),this.fd=r.fd===void 0?null:typeof r.fd!="number"?r.fd.fd:r.fd,this.flags=r.flags===void 0?"r":r.flags,this.mode=r.mode===void 0?438:r.mode,this.start=r.start,this.end=r.end,this.autoClose=r.autoClose===void 0?!0:r.autoClose,this.pos=void 0,this.bytesRead=0,this.start!==void 0){if(typeof this.start!="number")throw new TypeError('"start" option must be a Number');if(this.end===void 0)this.end=1/0;else if(typeof this.end!="number")throw new TypeError('"end" option must be a Number');if(this.start>this.end)throw new Error('"start" option must be <= "end" option');this.pos=this.start}typeof this.fd!="number"&&this.open(),this.on("end",function(){this.autoClose&&this.destroy&&this.destroy()})}u(Hr,"FsReadStream");Hr.prototype.open=function(){var t=this;this._vol.open(this.path,this.flags,this.mode,(e,r)=>{if(e){t.autoClose&&t.destroy&&t.destroy(),t.emit("error",e);return}t.fd=r,t.emit("open",r),t.read()})};Hr.prototype._read=function(t){if(typeof this.fd!="number")return this.once("open",function(){this._read(t)});if(this.destroyed)return;(!ar||ar.length-ar.used<JZ)&&eK(this._readableState.highWaterMark);var e=ar,r=Math.min(ar.length-ar.used,t),i=ar.used;if(this.pos!==void 0&&(r=Math.min(this.end-this.pos+1,r)),r<=0)return this.push(null);var n=this;this._vol.read(this.fd,ar,ar.used,r,this.pos,s),this.pos!==void 0&&(this.pos+=r),ar.used+=r;function s(a,l){if(a)n.autoClose&&n.destroy&&n.destroy(),n.emit("error",a);else{var c=null;l>0&&(n.bytesRead+=l,c=e.slice(i,i+l)),n.push(c)}}u(s,"onread")};Hr.prototype._destroy=function(t,e){this.close(r=>{e(t||r)})};Hr.prototype.close=function(t){if(t&&this.once("close",t),this.closed||typeof this.fd!="number"){if(typeof this.fd!="number"){this.once("open",pI);return}return(0,Mp.default)(()=>this.emit("close"))}typeof this._readableState?.closed=="boolean"?this._readableState.closed=!0:this.closed=!0,this._vol.close(this.fd,e=>{e?this.emit("error",e):this.emit("close")}),this.fd=null};function pI(t){this.close()}u(pI,"closeOnOpen");(0,dI.inherits)(or,jp.Writable);Vt.WriteStream=or;function or(t,e,r){if(!(this instanceof or))return new or(t,e,r);if(this._vol=t,r=Object.assign({},(0,ie.getOptions)(r,{})),jp.Writable.call(this,r),this.path=(0,D.pathToFilename)(e),this.fd=r.fd===void 0?null:typeof r.fd!="number"?r.fd.fd:r.fd,this.flags=r.flags===void 0?"w":r.flags,this.mode=r.mode===void 0?438:r.mode,this.start=r.start,this.autoClose=r.autoClose===void 0?!0:!!r.autoClose,this.pos=void 0,this.bytesWritten=0,this.pending=!0,this.start!==void 0){if(typeof this.start!="number")throw new TypeError('"start" option must be a Number');if(this.start<0)throw new Error('"start" must be >= zero');this.pos=this.start}r.encoding&&this.setDefaultEncoding(r.encoding),typeof this.fd!="number"&&this.open(),this.once("finish",function(){this.autoClose&&this.close()})}u(or,"FsWriteStream");or.prototype.open=function(){this._vol.open(this.path,this.flags,this.mode,function(t,e){if(t){this.autoClose&&this.destroy&&this.destroy(),this.emit("error",t);return}this.fd=e,this.pending=!1,this.emit("open",e)}.bind(this))};or.prototype._write=function(t,e,r){if(!(t instanceof Wo.Buffer||t instanceof Uint8Array))return this.emit("error",new Error("Invalid data"));if(typeof this.fd!="number")return this.once("open",function(){this._write(t,e,r)});var i=this;this._vol.write(this.fd,t,0,t.length,this.pos,(n,s)=>{if(n)return i.autoClose&&i.destroy&&i.destroy(),r(n);i.bytesWritten+=s,r()}),this.pos!==void 0&&(this.pos+=t.length)};or.prototype._writev=function(t,e){if(typeof this.fd!="number")return this.once("open",function(){this._writev(t,e)});let r=this,i=t.length,n=new Array(i);for(var s=0,a=0;a<i;a++){var l=t[a].chunk;n[a]=l,s+=l.length}let c=Wo.Buffer.concat(n);this._vol.write(this.fd,c,0,c.length,this.pos,(o,f)=>{if(o)return r.destroy&&r.destroy(),e(o);r.bytesWritten+=f,e()}),this.pos!==void 0&&(this.pos+=s)};or.prototype.close=function(t){if(t&&this.once("close",t),this.closed||typeof this.fd!="number"){if(typeof this.fd!="number"){this.once("open",pI);return}return(0,Mp.default)(()=>this.emit("close"))}typeof this._writableState?.closed=="boolean"?this._writableState.closed=!0:this.closed=!0,this._vol.close(this.fd,e=>{e?this.emit("error",e):this.emit("close")}),this.fd=null};or.prototype._destroy=Hr.prototype._destroy;or.prototype.destroySoon=or.prototype.end;var b_=class b_ extends hI.EventEmitter{constructor(e){super(),this._filename="",this._filenameEncoded="",this._recursive=!1,this._encoding=cs.ENCODING_UTF8,this._listenerRemovers=new Map,this._onParentChild=r=>{r.getName()===this._getName()&&this._emit("rename")},this._emit=r=>{this.emit("change",r,this._filenameEncoded)},this._persist=()=>{this._timer=setTimeout(this._persist,1e6)},this._vol=e}_getName(){return this._steps[this._steps.length-1]}start(e,r=!0,i=!1,n=cs.ENCODING_UTF8){this._filename=(0,D.pathToFilename)(e),this._steps=(0,nt.filenameToSteps)(this._filename),this._filenameEncoded=(0,cs.strToEncoding)(this._filename),this._recursive=i,this._encoding=n;try{this._link=this._vol._core.getLinkOrThrow(this._filename,"FSWatcher")}catch(c){let o=new Error(`watch ${this._filename} ${c.code}`);throw o.code=c.code,o.errno=c.code,o}let s=u(c=>{let o=c.getPath(),f=c.getNode(),h=u(()=>{let m=Ip(this._filename,o);return m||(m=this._getName()),this.emit("change","change",m)},"onNodeChange"),d=f.changes.listen(([m])=>{m==="modify"&&h()}),p=this._listenerRemovers.get(f.ino)??[];p.push(()=>d()),this._listenerRemovers.set(f.ino,p)},"watchLinkNodeChanged"),a=u(c=>{let o=c.getNode(),f=u(m=>{this.emit("change","rename",Ip(this._filename,m.getPath())),s(m),a(m)},"onLinkChildAdd"),h=u(m=>{let w=u(g=>{let b=g.getNode().ino,_=this._listenerRemovers.get(b);_&&(_.forEach(S=>S()),this._listenerRemovers.delete(b));for(let[S,F]of g.children.entries())F&&S!=="."&&S!==".."&&w(F)},"removeLinkNodeListeners");w(m),this.emit("change","rename",Ip(this._filename,m.getPath()))},"onLinkChildDelete");for(let[m,w]of c.children.entries())w&&m!=="."&&m!==".."&&s(w);let d=c.changes.listen(([m,w])=>{m==="child:add"?f(w):m==="child:del"&&h(w)});if((this._listenerRemovers.get(o.ino)??[]).push(()=>{d()}),i)for(let[m,w]of c.children.entries())w&&m!=="."&&m!==".."&&a(w)},"watchLinkChildrenChanged");s(this._link),a(this._link);let l=this._link.parent;l&&l.changes.listen(([c,o])=>{c==="child:del"&&this._onParentChild(o)}),r&&this._persist()}close(){clearTimeout(this._timer),this._listenerRemovers.forEach(e=>{e.forEach(r=>r())}),this._listenerRemovers.clear(),this._parentChangesUnsub?.()}};u(b_,"FSWatcher");var Lp=b_;Vt.FSWatcher=Lp});var wI=x(qp=>{"use strict";Object.defineProperty(qp,"__esModule",{value:!0});qp.fsSynchronousApiList=void 0;qp.fsSynchronousApiList=["accessSync","appendFileSync","chmodSync","chownSync","closeSync","copyFileSync","existsSync","fchmodSync","fchownSync","fdatasyncSync","fstatSync","fsyncSync","ftruncateSync","futimesSync","lchmodSync","lchownSync","linkSync","lstatSync","mkdirSync","mkdtempSync","openSync","opendirSync","readdirSync","readFileSync","readlinkSync","readSync","readvSync","realpathSync","renameSync","rmdirSync","rmSync","statSync","symlinkSync","truncateSync","unlinkSync","utimesSync","lutimesSync","writeFileSync","writeSync","writevSync"]});var yI=x(Up=>{"use strict";Object.defineProperty(Up,"__esModule",{value:!0});Up.fsCallbackApiList=void 0;Up.fsCallbackApiList=["access","appendFile","chmod","chown","close","copyFile","cp","createReadStream","createWriteStream","exists","fchmod","fchown","fdatasync","fstat","fsync","ftruncate","futimes","lchmod","lchown","link","lstat","mkdir","mkdtemp","open","openAsBlob","opendir","read","readv","readdir","readFile","readlink","realpath","rename","rm","rmdir","stat","statfs","symlink","truncate","unlink","unwatchFile","utimes","lutimes","watch","watchFile","write","writev","writeFile"]});var bI=x((Gt,zp)=>{"use strict";Object.defineProperty(Gt,"__esModule",{value:!0});Gt.memfs=Gt.fs=Gt.vol=Gt.Volume=void 0;Gt.createFsFromVolume=__;var tK=Ab(),rK=op(),Wp=mI();Object.defineProperty(Gt,"Volume",{enumerable:!0,get:u(function(){return Wp.Volume},"get")});var gI=vr(),iK=wI(),nK=yI(),{F_OK:sK,R_OK:aK,W_OK:oK,X_OK:lK}=gI.constants;Gt.vol=new Wp.Volume;function __(t){let e={F_OK:sK,R_OK:aK,W_OK:oK,X_OK:lK,constants:gI.constants,Stats:tK.default,Dirent:rK.default};for(let r of iK.fsSynchronousApiList)typeof t[r]=="function"&&(e[r]=t[r].bind(t));for(let r of nK.fsCallbackApiList)typeof t[r]=="function"&&(e[r]=t[r].bind(t));return e.StatWatcher=t.StatWatcher,e.FSWatcher=t.FSWatcher,e.WriteStream=t.WriteStream,e.ReadStream=t.ReadStream,e.promises=t.promises,typeof t.realpath=="function"&&(e.realpath=t.realpath.bind(t),typeof t.realpath.native=="function"&&(e.realpath.native=t.realpath.native.bind(t))),typeof t.realpathSync=="function"&&(e.realpathSync=t.realpathSync.bind(t),typeof t.realpathSync.native=="function"&&(e.realpathSync.native=t.realpathSync.native.bind(t))),e._toUnixTimestamp=Wp.toUnixTimestamp,e.__vol=t,e}u(__,"createFsFromVolume");Gt.fs=__(Gt.vol);var cK=u((t={},e="/")=>{let r=Wp.Volume.fromNestedJSON(t,e);return{fs:__(r),vol:r}},"memfs");Gt.memfs=cK;zp.exports={...zp.exports,...Gt.fs};zp.exports.semantic=!0});var P_=u(t=>{try{let r=t.split(".")[1];if(!r)throw new Error("Invalid JWT format");let i=r.replace(/-/g,"+").replace(/_/g,"/");for(;i.length%4!==0;)i+="=";let n=atob(i),a=JSON.parse(n).exp;if(!a||typeof a!="number")throw new Error('JWT does not contain a valid "exp" field');return a*1e3}catch(e){throw new Error("Unable to determine the token expiry: "+e)}},"getJwtExpiry"),Yo,ds,Xp=(ds=class{constructor(e){W(this,"strategy","jwt");W(this,"cachedToken",null);W(this,"tokenExpiry",null);Ko(this,Yo);Jo(this,Yo,e)}async getAuthHeaders(){let e=Date.now();if(this.cachedToken&&this.tokenExpiry&&this.tokenExpiry-e>30*1e3)return{Authorization:`Bearer ${this.cachedToken}`};let r=await Zo(this,Yo).call(this);return r?(this.cachedToken=r,this.tokenExpiry=P_(r),{Authorization:`Bearer ${r}`}):!1}readAuthHeaders(e){let r=e.get("Authorization");if(!r)return;let[i,n]=r.split(" ");if(i!=="Bearer"||!n)throw new Error("Invalid auth header received");this.cachedToken=n,this.tokenExpiry=P_(n)}},Yo=new WeakMap,u(ds,"AssistantCloudJWTAuthStrategy"),ds),Xo,Qo,el,ps,N_=(ps=class{constructor(e,r,i){W(this,"strategy","api-key");Ko(this,Xo);Ko(this,Qo);Ko(this,el);Jo(this,Xo,e),Jo(this,Qo,r),Jo(this,el,i)}async getAuthHeaders(){return{Authorization:`Bearer ${Zo(this,Xo)}`,"Aui-User-Id":Zo(this,Qo),"Aui-Workspace-Id":Zo(this,el)}}readAuthHeaders(){}},Xo=new WeakMap,Qo=new WeakMap,el=new WeakMap,u(ps,"AssistantCloudAPIKeyAuthStrategy"),ps),ef="aui:refresh_token",ms,D_=(ms=class{constructor(e){W(this,"strategy","anon");W(this,"baseUrl");W(this,"jwtStrategy");this.baseUrl=e,this.jwtStrategy=new Xp(async()=>{let r=Date.now(),i=localStorage.getItem(ef),n=i?JSON.parse(i):void 0;if(n)if(new Date(n.expires_at).getTime()-r>30*1e3){let f=await fetch(`${this.baseUrl}/v1/auth/tokens/refresh`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({refresh_token:n.token})});if(f.ok){let h=await f.json(),{access_token:d,refresh_token:p}=h;return p&&localStorage.setItem(ef,JSON.stringify(p)),d}}else localStorage.removeItem(ef);let s=await fetch(`${this.baseUrl}/v1/auth/tokens/anonymous`,{method:"POST"});if(!s.ok)return null;let a=await s.json(),{access_token:l,refresh_token:c}=a;return!l||!c?null:(localStorage.setItem(ef,JSON.stringify(c)),l)})}async getAuthHeaders(){return this.jwtStrategy.getAuthHeaders()}readAuthHeaders(e){this.jwtStrategy.readAuthHeaders(e)}},u(ms,"AssistantCloudAnonymousAuthStrategy"),ms);var ws,BI=(ws=class extends Error{constructor(e){super(e),this.name="APIError"}},u(ws,"CloudAPIError"),ws),ys,C_=(ys=class{constructor(e){W(this,"_auth");W(this,"_baseUrl");if("authToken"in e)this._baseUrl=e.baseUrl,this._auth=new Xp(e.authToken);else if("apiKey"in e)this._baseUrl="https://backend.assistant-api.com",this._auth=new N_(e.apiKey,e.userId,e.workspaceId);else if("anonymous"in e)this._baseUrl=e.baseUrl,this._auth=new D_(e.baseUrl);else throw new Error("Invalid configuration: Must provide authToken, apiKey, or anonymous configuration")}async initializeAuth(){return!!this._auth.getAuthHeaders()}async makeRawRequest(e,r={}){let i=await this._auth.getAuthHeaders();if(!i)throw new Error("Authorization failed");let n={...i,...r.headers,"Content-Type":"application/json"},s=new URLSearchParams;if(r.query)for(let[c,o]of Object.entries(r.query))o!==!1&&(o===!0?s.set(c,"true"):s.set(c,o.toString()));let a=new URL(`${this._baseUrl}/v1${e}`);a.search=s.toString();let l=await fetch(a,{method:r.method??"GET",headers:n,body:r.body?JSON.stringify(r.body):null});if(this._auth.readAuthHeaders(l.headers),!l.ok){let c=await l.text();try{let o=JSON.parse(c);throw new BI(o.message)}catch{throw new Error(`Request failed with status ${l.status}, ${c}`)}}return l}async makeRequest(e,r={}){return(await this.makeRawRequest(e,r)).json()}},u(ys,"AssistantCloudAPI"),ys);var gs,I_=(gs=class{constructor(e){this.cloud=e}async create(){return this.cloud.makeRequest("/auth/tokens",{method:"POST"})}},u(gs,"AssistantCloudAuthTokens"),gs);var tl={toResponse(t,e){return new Response(tl.toByteStream(t,e),{headers:e.headers??{}})},fromResponse(t,e){return tl.fromByteStream(t.body,e)},toByteStream(t,e){return t.pipeThrough(e)},fromByteStream(t,e){return t.pipeThrough(e)}};var tf=u(function(){let t,e,r=new Promise((i,n)=>{t=i,e=n});if(!t||!e)throw new Error("Failed to create promise");return{promise:r,resolve:t,reject:e}},"promiseWithResolvers");var $_=u(()=>{let t=[],e=!1,r,i,n=u(a=>{a.promise||(a.promise=a.reader.read().then(({done:l,value:c})=>{a.promise=void 0,l?(t.splice(t.indexOf(a),1),e&&t.length===0&&r.close()):r.enqueue(c),i?.resolve(),i=void 0}).catch(l=>{console.error(l),t.forEach(c=>{c.reader.cancel()}),t.length=0,r.error(l),i?.reject(l),i=void 0}))},"handlePull");return{readable:new ReadableStream({start(a){r=a},pull(){return i=tf(),t.forEach(a=>{n(a)}),i.promise},cancel(){t.forEach(a=>{a.reader.cancel()}),t.length=0}}),isSealed(){return e},seal(){e=!0,t.length===0&&r.close()},addStream(a){if(e)throw new Error("Cannot add streams after the run callback has settled.");let l={reader:a.getReader()};t.push(l),n(l)},enqueue(a){this.addStream(new ReadableStream({start(l){l.enqueue(a),l.close()}}))}}},"createMergeStream");var bs,B_=(bs=class{constructor(e){W(this,"_controller");W(this,"_isClosed",!1);this._controller=e}append(e){return this._controller.enqueue({type:"text-delta",path:[],textDelta:e}),this}close(){this._isClosed||(this._isClosed=!0,this._controller.enqueue({type:"part-finish",path:[]}),this._controller.close())}},u(bs,"TextStreamControllerImpl"),bs),Qp=u(t=>new ReadableStream({start(e){return t.start?.(new B_(e))},pull(e){return t.pull?.(new B_(e))},cancel(e){return t.cancel?.(e)}}),"createTextStream"),em=u(()=>{let t;return[Qp({start(r){t=r}}),t]},"createTextStreamController");var _s,L_=(_s=class{constructor(e){W(this,"_isClosed",!1);W(this,"_mergeTask");W(this,"_argsTextController");this._controller=e;let r=Qp({start:u(n=>{this._argsTextController=n},"start")}),i=!1;this._mergeTask=r.pipeTo(new WritableStream({write:u(n=>{switch(n.type){case"text-delta":i=!0,this._controller.enqueue(n);break;case"part-finish":i||this._controller.enqueue({type:"text-delta",textDelta:"{}",path:[]}),this._controller.enqueue({type:"tool-call-args-text-finish",path:[]});break;default:throw new Error(`Unexpected chunk type: ${n.type}`)}},"write")}))}get argsText(){return this._argsTextController}async setResponse(e){this._argsTextController.close(),await Promise.resolve(),this._controller.enqueue({type:"result",path:[],...e.artifact!==void 0?{artifact:e.artifact}:{},result:e.result,isError:e.isError??!1})}async close(){this._isClosed||(this._isClosed=!0,this._argsTextController.close(),await this._mergeTask,this._controller.enqueue({type:"part-finish",path:[]}),this._controller.close())}},u(_s,"ToolCallStreamControllerImpl"),_s),LI=u(t=>new ReadableStream({start(e){return t.start?.(new L_(e))},pull(e){return t.pull?.(new L_(e))},cancel(e){return t.cancel?.(e)}}),"createToolCallStream"),M_=u(()=>{let t;return[LI({start(r){t=r}}),t]},"createToolCallStreamController");var vs,rf=(vs=class{constructor(){W(this,"value",-1)}up(){return++this.value}},u(vs,"Counter"),vs);var Ss,j_=(Ss=class extends TransformStream{constructor(e){super({transform(r,i){i.enqueue({...r,path:[e,...r.path]})}})}},u(Ss,"PathAppendEncoder"),Ss),Es,KK=(Es=class extends TransformStream{constructor(e){super({transform(r,i){let{path:[n,...s]}=r;if(e!==n)throw new Error(`Path mismatch: expected ${e}, got ${n}`);i.enqueue({...r,path:s})}})}},u(Es,"PathAppendDecoder"),Es),Fs,q_=(Fs=class extends TransformStream{constructor(e){let r=new rf,i=new Map;super({transform(n,s){n.type==="part-start"&&n.path.length===0&&i.set(r.up(),e.up());let[a,...l]=n.path;if(a===void 0){s.enqueue(n);return}let c=i.get(a);if(c===void 0)throw new Error("Path not found");s.enqueue({...n,path:[c,...l]})}})}},u(Fs,"PathMergeEncoder"),Fs);var ks,U_=(ks=class extends TransformStream{constructor(e,r,i){let[n,s]=z_(),a;super({start(l){return a=n.pipeTo(new WritableStream({write(c){l.enqueue(c)},abort(c){l.error(c)},close(){l.terminate()}})).catch(c=>{l.error(c)}),e.start?.(s)},transform(l){return e.transform?.(l,s)},async flush(){await e.flush?.(s),s.close(),await a}},r,i)}},u(ks,"AssistantTransformStream"),ks);var Ts,W_=(Ts=class extends TransformStream{constructor(e){super();let r=e(super.readable);Object.defineProperty(this,"readable",{value:r,writable:!1})}},u(Ts,"PipeableTransformStream"),Ts);var nf=u((t,e=21)=>(r=e)=>{let i="",n=r|0;for(;n--;)i+=t[Math.random()*t.length|0];return i},"customAlphabet");var H_=nf("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",7);var fn,MI=(fn=class{constructor(e){W(this,"_state");W(this,"_parentId");this._state=e||{merger:$_(),contentCounter:new rf}}get __internal_isClosed(){return this._state.merger.isSealed()}__internal_getReadable(){return this._state.merger.readable}__internal_subscribeToClose(e){this._state.closeSubscriber=e}_addPart(e,r){this._state.append&&(this._state.append.controller.close(),this._state.append=void 0),this.enqueue({type:"part-start",part:e,path:[]}),this._state.merger.addStream(r.pipeThrough(new j_(this._state.contentCounter.value)))}merge(e){this._state.merger.addStream(e.pipeThrough(new q_(this._state.contentCounter)))}appendText(e){this._state.append?.kind!=="text"&&(this._state.append={kind:"text",controller:this.addTextPart()}),this._state.append.controller.append(e)}appendReasoning(e){this._state.append?.kind!=="reasoning"&&(this._state.append={kind:"reasoning",controller:this.addReasoningPart()}),this._state.append.controller.append(e)}addTextPart(){let[e,r]=em();return this._addPart({type:"text"},e),r}addReasoningPart(){let[e,r]=em();return this._addPart({type:"reasoning"},e),r}addToolCallPart(e){let r=typeof e=="string"?{toolName:e}:e,i=r.toolName,n=r.toolCallId??H_(),[s,a]=M_();return this._addPart({type:"tool-call",toolName:i,toolCallId:n,...this._parentId&&{parentId:this._parentId}},s),r.argsText!==void 0&&(a.argsText.append(r.argsText),a.argsText.close()),r.args!==void 0&&(a.argsText.append(JSON.stringify(r.args)),a.argsText.close()),r.response!==void 0&&a.setResponse(r.response),a}appendSource(e){this._addPart({...e,...this._parentId&&{parentId:this._parentId}},new ReadableStream({start(r){r.enqueue({type:"part-finish",path:[]}),r.close()}}))}appendFile(e){this._addPart(e,new ReadableStream({start(r){r.enqueue({type:"part-finish",path:[]}),r.close()}}))}enqueue(e){this._state.merger.enqueue(e),e.type==="part-start"&&e.path.length===0&&this._state.contentCounter.up()}withParentId(e){let r=new fn(this._state);return r._parentId=e,r}close(){this._state.append?.controller?.close(),this._state.merger.seal(),this._state.closeSubscriber?.()}},u(fn,"_AssistantStreamControllerImpl"),fn);function jI(t){let e=new MI;return u(async()=>{try{await t(e)}catch(i){throw e.__internal_isClosed||e.enqueue({type:"error",path:[],error:String(i)}),i}finally{e.__internal_isClosed||e.close()}},"runTask")(),e.__internal_getReadable()}u(jI,"createAssistantStream");function z_(){let{resolve:t,promise:e}=tf(),r;return[jI(n=>(r=n,r.__internal_subscribeToClose(t),e)),r]}u(z_,"createAssistantStreamController");var xs,tm=(xs=class extends W_{constructor(){super(e=>{let r=new U_({transform(i,n){n.appendText(i)}});return e.pipeThrough(new TextDecoderStream).pipeThrough(r)})}},u(xs,"PlainTextDecoder"),xs);var Os,V_=(Os=class{constructor(e){this.cloud=e}__internal_getAssistantOptions(e){return{api:this.cloud._baseUrl+"/v1/runs/stream",headers:u(async()=>{let r=await this.cloud._auth.getAuthHeaders();if(!r)throw new Error("Authorization failed");return{...r,Accept:"text/plain"}},"headers"),body:{assistant_id:e,response_format:"vercel-ai-data-stream/v1",thread_id:"unstable_todo"}}}async stream(e){let r=await this.cloud.makeRawRequest("/runs/stream",{method:"POST",headers:{Accept:"text/plain"},body:e});return tl.fromResponse(r,new tm)}},u(Os,"AssistantCloudRuns"),Os);var Rs,G_=(Rs=class{constructor(e){this.cloud=e}async list(e,r){return this.cloud.makeRequest(`/threads/${encodeURIComponent(e)}/messages`,{query:r})}async create(e,r){return this.cloud.makeRequest(`/threads/${encodeURIComponent(e)}/messages`,{method:"POST",body:r})}},u(Rs,"AssistantCloudThreadMessages"),Rs);var As,Z_=(As=class{constructor(e){W(this,"messages");this.cloud=e,this.messages=new G_(e)}async list(e){return this.cloud.makeRequest("/threads",{query:e})}async create(e){return this.cloud.makeRequest("/threads",{method:"POST",body:e})}async update(e,r){return this.cloud.makeRequest(`/threads/${encodeURIComponent(e)}`,{method:"PUT",body:r})}async delete(e){return this.cloud.makeRequest(`/threads/${encodeURIComponent(e)}`,{method:"DELETE"})}},u(As,"AssistantCloudThreads"),As);var Ps,K_=(Ps=class{constructor(e){this.cloud=e}async pdfToImages(e){return this.cloud.makeRequest("/files/pdf-to-images",{method:"POST",body:e})}async generatePresignedUploadUrl(e){return this.cloud.makeRequest("/files/attachments/generate-presigned-upload-url",{method:"POST",body:e})}},u(Ps,"AssistantCloudFiles"),Ps);var Ns,rm=(Ns=class{constructor(e){W(this,"threads");W(this,"auth");W(this,"runs");W(this,"files");let r=new C_(e);this.threads=new Z_(r),this.auth={tokens:new I_(r)},this.runs=new V_(r),this.files=new K_(r)}},u(Ns,"AssistantCloud"),Ns);var un={toResponse(t,e){return new Response(un.toByteStream(t,e),{headers:e.headers??{}})},fromResponse(t,e){return un.fromByteStream(t.body,e)},toByteStream(t,e){return t.pipeThrough(e)},fromByteStream(t,e){return t.pipeThrough(e)}};var sf=u(function(){let t,e,r=new Promise((i,n)=>{t=i,e=n});if(!t||!e)throw new Error("Failed to create promise");return{promise:r,resolve:t,reject:e}},"promiseWithResolvers");var J_=u(()=>{let t=[],e=!1,r,i,n=u(a=>{a.promise||(a.promise=a.reader.read().then(({done:l,value:c})=>{a.promise=void 0,l?(t.splice(t.indexOf(a),1),e&&t.length===0&&r.close()):r.enqueue(c),i?.resolve(),i=void 0}).catch(l=>{console.error(l),t.forEach(c=>{c.reader.cancel()}),t.length=0,r.error(l),i?.reject(l),i=void 0}))},"handlePull");return{readable:new ReadableStream({start(a){r=a},pull(){return i=sf(),t.forEach(a=>{n(a)}),i.promise},cancel(){t.forEach(a=>{a.reader.cancel()}),t.length=0}}),isSealed(){return e},seal(){e=!0,t.length===0&&r.close()},addStream(a){if(e)throw new Error("Cannot add streams after the run callback has settled.");let l={reader:a.getReader()};t.push(l),n(l)},enqueue(a){this.addStream(new ReadableStream({start(l){l.enqueue(a),l.close()}}))}}},"createMergeStream");var Ds,Y_=(Ds=class{constructor(e){W(this,"_controller");W(this,"_isClosed",!1);this._controller=e}append(e){return this._controller.enqueue({type:"text-delta",path:[],textDelta:e}),this}close(){this._isClosed||(this._isClosed=!0,this._controller.enqueue({type:"part-finish",path:[]}),this._controller.close())}},u(Ds,"TextStreamControllerImpl"),Ds),im=u(t=>new ReadableStream({start(e){return t.start?.(new Y_(e))},pull(e){return t.pull?.(new Y_(e))},cancel(e){return t.cancel?.(e)}}),"createTextStream"),nm=u(()=>{let t;return[im({start(r){t=r}}),t]},"createTextStreamController");var Cs,X_=(Cs=class{constructor(e){W(this,"_isClosed",!1);W(this,"_mergeTask");W(this,"_argsTextController");this._controller=e;let r=im({start:u(n=>{this._argsTextController=n},"start")}),i=!1;this._mergeTask=r.pipeTo(new WritableStream({write:u(n=>{switch(n.type){case"text-delta":i=!0,this._controller.enqueue(n);break;case"part-finish":i||this._controller.enqueue({type:"text-delta",textDelta:"{}",path:[]}),this._controller.enqueue({type:"tool-call-args-text-finish",path:[]});break;default:throw new Error(`Unexpected chunk type: ${n.type}`)}},"write")}))}get argsText(){return this._argsTextController}async setResponse(e){this._argsTextController.close(),await Promise.resolve(),this._controller.enqueue({type:"result",path:[],...e.artifact!==void 0?{artifact:e.artifact}:{},result:e.result,isError:e.isError??!1})}async close(){this._isClosed||(this._isClosed=!0,this._argsTextController.close(),await this._mergeTask,this._controller.enqueue({type:"part-finish",path:[]}),this._controller.close())}},u(Cs,"ToolCallStreamControllerImpl"),Cs),qI=u(t=>new ReadableStream({start(e){return t.start?.(new X_(e))},pull(e){return t.pull?.(new X_(e))},cancel(e){return t.cancel?.(e)}}),"createToolCallStream"),Q_=u(()=>{let t;return[qI({start(r){t=r}}),t]},"createToolCallStreamController");var Is,af=(Is=class{constructor(){W(this,"value",-1)}up(){return++this.value}},u(Is,"Counter"),Is);var $s,ev=($s=class extends TransformStream{constructor(e){super({transform(r,i){i.enqueue({...r,path:[e,...r.path]})}})}},u($s,"PathAppendEncoder"),$s),Bs,nY=(Bs=class extends TransformStream{constructor(e){super({transform(r,i){let{path:[n,...s]}=r;if(e!==n)throw new Error(`Path mismatch: expected ${e}, got ${n}`);i.enqueue({...r,path:s})}})}},u(Bs,"PathAppendDecoder"),Bs),Ls,tv=(Ls=class extends TransformStream{constructor(e){let r=new af,i=new Map;super({transform(n,s){n.type==="part-start"&&n.path.length===0&&i.set(r.up(),e.up());let[a,...l]=n.path;if(a===void 0){s.enqueue(n);return}let c=i.get(a);if(c===void 0)throw new Error("Path not found");s.enqueue({...n,path:[c,...l]})}})}},u(Ls,"PathMergeEncoder"),Ls);var Ms,rv=(Ms=class extends TransformStream{constructor(e,r,i){let[n,s]=rl(),a;super({start(l){return a=n.pipeTo(new WritableStream({write(c){l.enqueue(c)},abort(c){l.error(c)},close(){l.terminate()}})).catch(c=>{l.error(c)}),e.start?.(s)},transform(l){return e.transform?.(l,s)},async flush(){await e.flush?.(s),s.close(),await a}},r,i)}},u(Ms,"AssistantTransformStream"),Ms);var js,of=(js=class extends TransformStream{constructor(e){super();let r=e(super.readable);Object.defineProperty(this,"readable",{value:r,writable:!1})}},u(js,"PipeableTransformStream"),js);var ye=(t=>(t.TextDelta="0",t.Data="2",t.Error="3",t.Annotation="8",t.ToolCall="9",t.ToolCallResult="a",t.StartToolCall="b",t.ToolCallArgsTextDelta="c",t.FinishMessage="d",t.FinishStep="e",t.StartStep="f",t.ReasoningDelta="g",t.Source="h",t.RedactedReasoning="i",t.ReasoningSignature="j",t.File="k",t.AuiUpdateStateOperations="aui-state",t.AuiTextDelta="aui-text-delta",t.AuiReasoningDelta="aui-reasoning-delta",t))(ye||{});var qs,iv=(qs=class extends TransformStream{constructor(){super({transform:u((e,r)=>{r.enqueue(`${e.type}:${JSON.stringify(e.value)}
|
|
105
|
+
`)},"transform")})}},u(qs,"DataStreamChunkEncoder"),qs),Us,UI=(Us=class extends TransformStream{constructor(){super({transform:u((e,r)=>{let i=e.indexOf(":");if(i===-1)throw new Error("Invalid stream part");r.enqueue({type:e.slice(0,i),value:JSON.parse(e.slice(i+1))})},"transform")})}},u(Us,"DataStreamChunkDecoder"),Us);var zs,nv=(zs=class extends TransformStream{constructor(){let e=[];super({transform(r,i){if(r.type==="part-start"){if(r.path.length!==0){i.error(new Error("Nested parts are not supported"));return}e.push(r.part),i.enqueue(r);return}if(r.type==="text-delta"||r.type==="result"||r.type==="part-finish"||r.type==="tool-call-args-text-finish"){if(r.path.length!==1){i.error(new Error(`${r.type} chunks must have a path of length 1`));return}let n=r.path[0];if(n<0||n>=e.length){i.error(new Error(`Invalid path index: ${n}`));return}let s=e[n];i.enqueue({...r,meta:s});return}i.enqueue(r)}})}},u(zs,"AssistantMetaTransformStream"),zs);var Ws,sm=(Ws=class extends of{constructor(){super(r=>{let i=new TransformStream({transform(n,s){let a=n.type;switch(a){case"part-start":{let l=n.part;if(l.type==="tool-call"){let{type:c,...o}=l;s.enqueue({type:ye.StartToolCall,value:o})}if(l.type==="source"){let{type:c,...o}=l;s.enqueue({type:ye.Source,value:o})}break}case"text-delta":{let l=n.meta;switch(l.type){case"text":{l.parentId?s.enqueue({type:ye.AuiTextDelta,value:{textDelta:n.textDelta,parentId:l.parentId}}):s.enqueue({type:ye.TextDelta,value:n.textDelta});break}case"reasoning":{l.parentId?s.enqueue({type:ye.AuiReasoningDelta,value:{reasoningDelta:n.textDelta,parentId:l.parentId}}):s.enqueue({type:ye.ReasoningDelta,value:n.textDelta});break}case"tool-call":{s.enqueue({type:ye.ToolCallArgsTextDelta,value:{toolCallId:l.toolCallId,argsTextDelta:n.textDelta}});break}default:throw new Error(`Unsupported part type for text-delta: ${l.type}`)}break}case"result":{let l=n.meta;if(l.type!=="tool-call")throw new Error(`Result chunk on non-tool-call part not supported: ${l.type}`);s.enqueue({type:ye.ToolCallResult,value:{toolCallId:l.toolCallId,result:n.result,artifact:n.artifact,...n.isError?{isError:n.isError}:{}}});break}case"step-start":{let{type:l,...c}=n;s.enqueue({type:ye.StartStep,value:c});break}case"step-finish":{let{type:l,...c}=n;s.enqueue({type:ye.FinishStep,value:c});break}case"message-finish":{let{type:l,...c}=n;s.enqueue({type:ye.FinishMessage,value:c});break}case"error":{s.enqueue({type:ye.Error,value:n.error});break}case"annotations":{s.enqueue({type:ye.Annotation,value:n.annotations});break}case"data":{s.enqueue({type:ye.Data,value:n.data});break}case"update-state":{s.enqueue({type:ye.AuiUpdateStateOperations,value:n.operations});break}case"tool-call-args-text-finish":case"part-finish":break;default:{let l=a;throw new Error(`Unsupported chunk type: ${l}`)}}}});return r.pipeThrough(new nv).pipeThrough(i).pipeThrough(new iv).pipeThrough(new TextEncoderStream)});W(this,"headers",new Headers({"Content-Type":"text/plain; charset=utf-8","x-vercel-ai-data-stream":"v1"}))}},u(Ws,"DataStreamEncoder"),Ws),vY=[ye.StartToolCall,ye.ToolCall,ye.TextDelta,ye.ReasoningDelta,ye.Source,ye.Error,ye.FinishStep,ye.FinishMessage,ye.AuiTextDelta,ye.AuiReasoningDelta];var sv=nf("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",7);var hn,zI=(hn=class{constructor(e){W(this,"_state");W(this,"_parentId");this._state=e||{merger:J_(),contentCounter:new af}}get __internal_isClosed(){return this._state.merger.isSealed()}__internal_getReadable(){return this._state.merger.readable}__internal_subscribeToClose(e){this._state.closeSubscriber=e}_addPart(e,r){this._state.append&&(this._state.append.controller.close(),this._state.append=void 0),this.enqueue({type:"part-start",part:e,path:[]}),this._state.merger.addStream(r.pipeThrough(new ev(this._state.contentCounter.value)))}merge(e){this._state.merger.addStream(e.pipeThrough(new tv(this._state.contentCounter)))}appendText(e){this._state.append?.kind!=="text"&&(this._state.append={kind:"text",controller:this.addTextPart()}),this._state.append.controller.append(e)}appendReasoning(e){this._state.append?.kind!=="reasoning"&&(this._state.append={kind:"reasoning",controller:this.addReasoningPart()}),this._state.append.controller.append(e)}addTextPart(){let[e,r]=nm();return this._addPart({type:"text"},e),r}addReasoningPart(){let[e,r]=nm();return this._addPart({type:"reasoning"},e),r}addToolCallPart(e){let r=typeof e=="string"?{toolName:e}:e,i=r.toolName,n=r.toolCallId??sv(),[s,a]=Q_();return this._addPart({type:"tool-call",toolName:i,toolCallId:n,...this._parentId&&{parentId:this._parentId}},s),r.argsText!==void 0&&(a.argsText.append(r.argsText),a.argsText.close()),r.args!==void 0&&(a.argsText.append(JSON.stringify(r.args)),a.argsText.close()),r.response!==void 0&&a.setResponse(r.response),a}appendSource(e){this._addPart({...e,...this._parentId&&{parentId:this._parentId}},new ReadableStream({start(r){r.enqueue({type:"part-finish",path:[]}),r.close()}}))}appendFile(e){this._addPart(e,new ReadableStream({start(r){r.enqueue({type:"part-finish",path:[]}),r.close()}}))}enqueue(e){this._state.merger.enqueue(e),e.type==="part-start"&&e.path.length===0&&this._state.contentCounter.up()}withParentId(e){let r=new hn(this._state);return r._parentId=e,r}close(){this._state.append?.controller?.close(),this._state.merger.seal(),this._state.closeSubscriber?.()}},u(hn,"_AssistantStreamControllerImpl"),hn);function av(t){let e=new zI;return u(async()=>{try{await t(e)}catch(i){throw e.__internal_isClosed||e.enqueue({type:"error",path:[],error:String(i)}),i}finally{e.__internal_isClosed||e.close()}},"runTask")(),e.__internal_getReadable()}u(av,"createAssistantStream");function rl(){let{resolve:t,promise:e}=sf(),r;return[av(n=>(r=n,r.__internal_subscribeToClose(t),e)),r]}u(rl,"createAssistantStreamController");var Hs,am=(Hs=class extends of{constructor(){super(e=>{let r=new rv({transform(i,n){n.appendText(i)}});return e.pipeThrough(new TextDecoderStream).pipeThrough(r)})}},u(Hs,"PlainTextDecoder"),Hs);var QN=de(uf(),1),Hd=de(pl(),1),rD=de(uf(),1),iD=de(uf(),1),sb=de(Le(),1),Vd=de(pl(),1),Hn=de(Le(),1),oD=de(Le(),1),Ld=de(Le(),1),St=de(Le(),1);import*as Nd from"path";import*as Gn from"path";import*as ab from"path";var tN=de(KO(),1);function wH(t){let e=[t];return{next(){return Promise.resolve({done:e.length===0,value:e.pop()})},return(){return e=[],{}},[Symbol.asyncIterator](){return this}}}u(wH,"fromValue");function yH(t){return t[Symbol.asyncIterator]?t[Symbol.asyncIterator]():t[Symbol.iterator]?t[Symbol.iterator]():t.next?t:wH(t)}u(yH,"getIterator");async function rN(t,e){let r=yH(t);for(;;){let{value:i,done:n}=await r.next();if(i&&await e(i),n)break}r.return&&r.return()}u(rN,"forAwait");function gH(t){let{PassThrough:e}=eN(),r=new e;return setTimeout(async()=>{await rN(t,i=>r.write(i)),r.end()},1),r}u(gH,"asyncIteratorToStream");async function bH(t){let e=0,r=[];await rN(t,s=>{r.push(s),e+=s.byteLength});let i=new Uint8Array(e),n=0;for(let s of r)i.set(s,n),n+=s.byteLength;return i}u(bH,"collect");function _H(t){let e=Object.getOwnPropertyDescriptor(t,Symbol.asyncIterator);if(e&&e.enumerable)return t;let r=!1,i=[],n={};return t.on("data",s=>{i.push(s),n.resolve&&(n.resolve({value:i.shift(),done:!1}),n={})}),t.on("error",s=>{n.reject&&(n.reject(s),n={})}),t.on("end",()=>{r=!0,n.resolve&&(n.resolve({done:!0}),n={})}),{next(){return new Promise((s,a)=>{if(i.length===0&&r)return s({done:!0});if(i.length>0)return s({value:i.shift(),done:!1});i.length===0&&!r&&(n={resolve:s,reject:a})})},return(){t.removeAllListeners(),t.destroy&&t.destroy()},[Symbol.asyncIterator](){return this}}}u(_H,"fromNodeStream");async function vH({onProgress:t,url:e,method:r="GET",headers:i={},agent:n,body:s}){return s&&Array.isArray(s)?s=Buffer.from(await bH(s)):s&&(s=gH(s)),new Promise((a,l)=>{(0,tN.default)({url:e,method:r,headers:i,agent:n,body:s},(c,o)=>{if(c)return l(c);try{let f=_H(o);a({url:o.url,method:o.method,statusCode:o.statusCode,statusMessage:o.statusMessage,body:f,headers:o.headers})}catch(f){l(f)}})})}u(vH,"request");var SH={request:vH},kd=SH;var He=de(Le(),1),tn=de(pl(),1),wb=de(Le(),1),ue=de(Le(),1),jr=de(Le(),1),gb=de(Le(),1),co=de(Le(),1),$d=de(Le(),1),Bd=de(Le(),1),br=de(Le(),1),bb=de(Le(),1),ui=de(Le(),1),uC=de(Le(),1),zd=de(Le(),1),Vn=de(Le(),1),Qd=de(pl(),1);import*as WN from"node:fs";import*as wC from"path";import{Stats as aV}from"node:fs";import*as vb from"path";var HN=Object.defineProperty,EH=u((t,e,r)=>e in t?HN(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,"oa"),y=u((t,e)=>HN(t,"name",{value:e,configurable:!0}),"c"),U=u((t,e,r)=>EH(t,typeof e!="symbol"?e+"":e,r),"g"),ho,VN=(ho=class{constructor(e,r){U(this,"entries",[]),U(this,"currentIndex",0),U(this,"closed",!1),U(this,"compositFs"),U(this,"dirPath"),U(this,"initialized",!1),this.compositFs=e,this.dirPath=r}async initialize(){if(this.initialized)return;let e=new Set;for(let r of[...this.compositFs.filterLayers].reverse())if(r.readDirFiltering)e=new Set(await r.readDirFiltering(this.dirPath,Array.from(e)));else{let i=await r.readdir(this.dirPath);for(let n of i)e.add(n)}this.initialized=!0}async*[Symbol.asyncIterator](){for(await this.initialize();this.currentIndex<this.entries.length&&!this.closed;){let e=this.entries[this.currentIndex++];try{let r=await this.compositFs.stat(e.path);yield{name:e.name,isFile:y(()=>r.isFile(),"isFile"),isDirectory:y(()=>r.isDirectory(),"isDirectory"),isBlockDevice:y(()=>r.isBlockDevice(),"isBlockDevice"),isCharacterDevice:y(()=>r.isCharacterDevice(),"isCharacterDevice"),isSymbolicLink:y(()=>r.isSymbolicLink(),"isSymbolicLink"),isFIFO:y(()=>r.isFIFO(),"isFIFO"),isSocket:y(()=>r.isSocket(),"isSocket")}}catch(r){console.debug(`Failed to stat ${e.path}:`,r)}}}async read(){if(this.closed)throw new Error("Directory handle is closed");if(await this.initialize(),this.currentIndex>=this.entries.length)return null;let e=this.entries[this.currentIndex++];try{let r=await this.compositFs.stat(e.path);return{name:e.name,isFile:y(()=>r.isFile(),"isFile"),isDirectory:y(()=>r.isDirectory(),"isDirectory"),isBlockDevice:y(()=>r.isBlockDevice(),"isBlockDevice"),isCharacterDevice:y(()=>r.isCharacterDevice(),"isCharacterDevice"),isSymbolicLink:y(()=>r.isSymbolicLink(),"isSymbolicLink"),isFIFO:y(()=>r.isFIFO(),"isFIFO"),isSocket:y(()=>r.isSocket(),"isSocket")}}catch{return this.read()}}async close(){this.closed=!0,this.entries=[]}get path(){return this.dirPath}},u(ho,"Xt"),ho);y(VN,"CompositeFsDir");var Sb=VN;function GN(t){let e=t.split("/").filter(Boolean),r=[],i=[],n=!1,s;for(let a of e)if(a.startsWith("[[")&&a.endsWith("]]")){let l=a.slice(2,-2).replace(/^\.\.\./,"");if(r.push(l),a.startsWith("[[..."))n=!0,i.push("(/.*)*"),s=l;else throw new Error("Optional single-segment parameters [[param]] are not supported. Use [[...param]] for catch-all or [param] for required single segment.")}else if(a.startsWith("[")&&a.endsWith("]")){if(a.startsWith("[..."))throw new Error("Required catch-all parameters [...param] are not supported. Use [[...param]] instead.");{let l=a.slice(1,-1);r.push(l),i.push("/([^\\/]+)")}}else a==="."?n=!0:i.push("/"+a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"));return{regexStr:i.join("")+"$",paramNames:r,folderRoute:n,pathParameter:s}}u(GN,"la");y(GN,"compilePattern");function Pd(t){if(t===".")return 1;let e=t.split("/").filter(Boolean),r=Math.pow(2,e.length);for(let i=0;i<e.length;i++){let n=e[i],s;n.startsWith("[[...")?s=10:n.startsWith("[[")?s=50:n.startsWith("[")?s=100:s=1e3+n.length;let a=Math.pow(.9,i);r+=s*a}return r}u(Pd,"Yt");y(Pd,"calculatePriority");function ZN(t){if(typeof t.name!="string")return"folder";let e=t;return e.fsType==="folder"?"folder":e.fsType==="file"?"file":"readdir"in e&&typeof e.readdir=="function"?"folder":"file"}u(ZN,"ca");y(ZN,"getNodeType");function KN(t){let e=[];function r(i,n){if(typeof i.name=="string"){e.push({pattern:n||".",handler:i,priority:Pd(n||"."),staticBaseChildren:[]});return}let s=i,a=[],l=Object.keys(s).filter(c=>c.startsWith("[[")||c===".");if(l.length>1)throw new Error(`Expected exactly one folder handler for ${n||"/"} expected but multuple found: ${l.join(", ")}`);if(l.length===0)throw new Error(`No folder handler for ${n||"/"} founds`);for(let[c,o]of Object.entries(s)){let f=n?`${n}/${c}`:c;if(c==="."){if(typeof o.name!="string")throw new Error(`Folder root '.' at path '${n}' must be a handler, not a folder`);if(o.fsType!=="folder"&&o.fsType!=="fs")throw new Error(`Folder root handler '.' at path '${n}' must be of type 'folder' or 'fs'`);e.push({pattern:n+"/.",handler:o,priority:Pd(n),staticBaseChildren:a})}else if(c.startsWith("[["))if(c.startsWith("[[..."))if(typeof o.name=="string"){if(e.push({pattern:f,handler:o,priority:Pd(f),staticBaseChildren:a}),o.fsType!=="folder"&&o.fsType!=="fs")throw new Error(`Folder root handler '.' at path '${n}' must be of type 'folder' or 'fs'`)}else r(o,f);else r(o,f);else if(c.startsWith("[")){if(c.startsWith("[..."))throw new Error(`Required catch-all '${c}' is not supported. Use '[[...${c.slice(5,-1)}]]' instead`);r(o,f)}else a.push({segment:c,type:ZN(o)}),r(o,f)}}return u(r,"e"),y(r,"walk"),r(t,""),e}u(KN,"da");y(KN,"flattenRoutes");var po,JN=(po=class{constructor(e,r){this.routes=e,this.rootPath=r,U(this,"compiledRoutes");let i=KN(e);this.compiledRoutes=i.map(n=>{let{regexStr:s,paramNames:a,folderRoute:l,pathParameter:c}=GN(n.pattern);return{regex:new RegExp(s),paramNames:a,staticBaseChildren:n.staticBaseChildren,handler:n.handler,priority:n.priority,pattern:n.pattern,folderRoute:l,pathParameter:c}})}match(e){let r=e;r.startsWith(this.rootPath+"/")?r=r.slice(this.rootPath.length+1):r.startsWith(this.rootPath)&&(r=r.slice(this.rootPath.length)),r.startsWith("/")||(r="/"+r),r.length>1&&r.endsWith("/")&&(r=r.slice(0,-1));let i,n={},s=-1,a=this.compiledRoutes,l=[];for(let o of a){let f=r.match(o.regex);if(f)l.push(o);else continue;if(!(!f||o.priority<=s)){n={};for(let h=0;h<o.paramNames.length;h++){let d=f[h+1]||"";d.startsWith("/")&&(d=d.slice(1)),n[o.paramNames[h]]=decodeURIComponent(d)}s=o.priority,i=o}}if(!i||i.handler===void 0)return;let c=[];return i.folderRoute&&(i.pathParameter?n[i.pathParameter]===""&&(c=i.staticBaseChildren.map(o=>({segment:o.segment,type:o.type}))):c=i.staticBaseChildren.map(o=>({segment:o.segment,type:o.type}))),{handler:i.handler,matchingPattern:i.pattern,params:n,staticSiblings:c}}},u(po,"Jt"),po);y(JN,"PathRouter");var FH=JN;function Ne(t){return typeof t=="string"?t:Buffer.isBuffer(t)?t.toString():String(t)}u(Ne,"z");y(Ne,"pathToString");var mo,YN=(mo=class{constructor({name:e,rootPath:r}){U(this,"compositeFs"),U(this,"context"),U(this,"newContext"),U(this,"fsType","fs"),U(this,"rootInstanceId"),U(this,"name"),U(this,"rootPath"),this.name=e,this.rootPath=r,this.rootInstanceId=`${e}-${Date.now()}-${Math.random().toString(36).substr(2,9)}`}attach(e){this.compositeFs=e}withContext(e){let r=Object.create(Object.getPrototypeOf(this));return Object.assign(r,this),r.context=e,r}async open(e,r,i){throw new Error(`open not implemented for: ${Ne(e)}`)}async access(e,r){throw new Error(`access not implemented for: ${Ne(e)}`)}async stat(e,r){throw new Error(`lstat not implemented for: ${Ne(e)}`)}async lstat(e,r){throw new Error(`lstat not implemented for: ${Ne(e)}`)}async opendir(e,r){throw new Error(`opendir not implemented for: ${Ne(e)}`)}async link(e,r){throw new Error(`link not implemented for: ${Ne(e)}`)}async mkdir(e,r){throw new Error(`mkdir not implemented for: ${Ne(e)}`)}async readdir(e,r){throw new Error(`readdir not implemented for: ${Ne(e)}`)}async readlink(e,...r){throw new Error(`readlink not implemented for: ${Ne(e)}`)}async unlink(e){throw new Error(`unlink not implemented for: ${Ne(e)}`)}async rename(e,r){throw new Error(`rename not implemented for: ${Ne(e)}`)}async rmdir(e,...r){throw new Error(`rmdir not implemented for: ${Ne(e)}`)}async symlink(e,r,i){throw new Error(`symlink not implemented for: ${Ne(r)}`)}async lookup(e){throw new Error(`lookup not implemented for: ${Ne(e)}`)}resolvePath(e){throw new Error(`resolvePath not implemented for fd: ${e}`)}async close(e){this.compositeFs.close(e)}async dataSync(e){throw new Error(`dataSync not implemented for: ${e.subFsFileDescriptor}`)}async read(e,r,i,n,s){throw new Error(`read not implemented for: ${e.subFsFileDescriptor}`)}async appendFile(e,r,i){throw new Error(`appendFile not implemented for: ${e.subFsFileDescriptor}`)}async fchmod(e,r){throw new Error(`fchmod not implemented for: ${e.subFsFileDescriptor}`)}async fchown(e,r,i){throw new Error(`fchown not implemented for: ${e.subFsFileDescriptor}`)}async ftruncate(e,r){throw new Error(`ftruncate not implemented for: ${e.subFsFileDescriptor}`)}async fstat(e,r){throw new Error(`fstat not implemented for: ${e.subFsFileDescriptor}`)}async futimes(e,r,i){throw new Error(`futimes not implemented for: ${e.subFsFileDescriptor}`)}async write(e,r,i,n,s){throw new Error(`write not implemented for: ${e.subFsFileDescriptor}`)}async writev(e,r,i){throw new Error(`writev not implemented for: ${e.subFsFileDescriptor}`)}async readv(e,r,i){throw new Error(`readv not implemented for: ${e.subFsFileDescriptor}`)}async readFile(e,r){throw new Error(`readFile not implemented for: ${e}`)}async writeFile(e,r,i){throw new Error(`writeFile not implemented for: ${e}`)}},u(mo,"qt"),mo);y(YN,"BaseCompositeSubFs");var rs=YN,wo,XN=(wo=class{constructor({name:e,filterLayers:r,routes:i,rootPath:n}){U(this,"promises"),U(this,"filterLayers",[]),U(this,"router"),U(this,"parentFs"),U(this,"name"),U(this,"rootPath"),U(this,"pathToFileDescriptors",new Map),U(this,"openFileHandles",new Map),U(this,"logOperation"),this.name=e,this.rootPath=n;for(let s of r)this.filterLayers.push(s),s.attach(this);this.router=new FH(i,this.rootPath),this.promises={access:this.access.bind(this),opendir:this.opendir.bind(this),mkdir:this.mkdir.bind(this),readdir:this.readdir.bind(this),open:this.open.bind(this),stat:this.stat.bind(this),lstat:this.lstat.bind(this),link:this.link.bind(this),readlink:this.readlink.bind(this),unlink:this.unlink.bind(this),rename:this.rename.bind(this),rmdir:this.rmdir.bind(this),symlink:this.symlink.bind(this),readFile:this.readFile.bind(this),writeFile:this.writeFile.bind(this),getFilehandle:this.getFilehandle.bind(this)}}getNextFileDescriptor(){let e=Array.from(this.openFileHandles.keys());return e.length===0?1:Math.max(...e)+1}setLoggger(e){this.logOperation=e}async logOperationOnFileDescsriptor(e,r,i){if(!this.logOperation)return;let n=[];for(let[s,a]of this.pathToFileDescriptors.entries())a.includes(e.fd)&&n.push(s);if(n.length!==0)return this.logOperation?.({fsName:e.delegate.name,fd:e,path:n[0],operation:r,operationArgs:i})}getFilehandle(e){return this.openFileHandles.get(e)}async getResponsibleFs(e){let r=e.toString();for(let s of this.filterLayers)if(await s.responsible(r)){if(s.withContext!==void 0)return s.withContext({fullPath:r,params:{},staticSiblings:[]});throw new Error(`Filter layer filesystem ${s.name} is not a BaseCompositeSubFs`)}let i=this.router.match(r);if(!i)throw new Error(`No route match for: ${r}`);let n=i.handler;return n.attach(this),n.withContext({fullPath:r,params:i.params,staticSiblings:i.staticSiblings})}async access(e,r){let i=await this.getResponsibleFs(e);return await this.logOperation?.({fsName:i.name,path:e,operation:"access",operationArgs:{mode:r}}),i.access(e,r)}async stat(e,r){let i=e.toString(),n=await this.getResponsibleFs(e);return await this.logOperation?.({fsName:n.name,path:i,operation:"stat",operationArgs:{opts:r}}),n.stat(e)}async lstat(e,r){let i=await this.getResponsibleFs(e);return await this.logOperation?.({fsName:i.name,path:e.toString(),operation:"lstat",operationArgs:{opts:r}}),i.lstat(e,r)}async unlink(e){let r=await this.getResponsibleFs(e);return await this.logOperation?.({fsName:r.name,path:e.toString(),operation:"unlink",operationArgs:{}}),r.unlink(e)}async mkdir(e,r){let i=await this.getResponsibleFs(e);return await this.logOperation?.({fsName:i.name,path:e.toString(),operation:"mkdir",operationArgs:{options:r}}),i.mkdir(e,r)}async rmdir(e,r){let i=await this.getResponsibleFs(e);return await this.logOperation?.({fsName:i.name,path:e.toString(),operation:"rmdir",operationArgs:{dirPath:e,options:r}}),i.rmdir(e,r)}async opendir(e,r){await this.logOperation?.({fsName:this.name,path:e.toString(),operation:"opendir",operationArgs:{options:r}});let i=e.toString();return new Sb(this,i)}async readdir(e,r){await this.logOperation?.({fsName:this.name,path:e.toString(),operation:"readdir",operationArgs:{options:r}});let i=new Set,n=this.router.match(e.toString());if(n?.handler instanceof rs){let s=n?.handler.withContext({fullPath:e.toString(),params:n.params,staticSiblings:n.staticSiblings});s.attach(this),i=new Set(await s.readdir(e,r))}for(let s of[...this.filterLayers].reverse())if(s.readDirFiltering)i=new Set(await s.readDirFiltering(e,Array.from(i)));else{let a=await s.readdir(e,r);for(let l of a)i.add(l)}return Array.from(i)}async open(e,r,i){let n=await this.getResponsibleFs(e);await this.logOperation?.({fsName:n.name,path:e,operation:"open",operationArgs:{flags:r,mode:i}});let s=await n.open(e,r,i),a=this.getNextFileDescriptor();return s.realize(a),this.openFileHandles.set(a,s),this.pathToFileDescriptors.get(e)||this.pathToFileDescriptors.set(e,[]),this.pathToFileDescriptors.get(e).push(a),s}async close(e){try{await e.delegate.close(e)}catch(r){throw r}finally{for(let[r,i]of this.pathToFileDescriptors.entries()){let n=i.indexOf(e.fd);if(n!==-1){i.splice(n,1),i.length===0&&this.pathToFileDescriptors.delete(r);break}}this.openFileHandles.delete(e.fd)}}async link(e,r){throw new Error("not implemented")}async readlink(e,r){throw new Error("not implemented")}async rename(e,r){let i=await this.getResponsibleFs(e),n=await this.getResponsibleFs(r);if(i.rootInstanceId===n.rootInstanceId)return await this.logOperation?.({fsName:i.name,path:e.toString(),operation:"rename",operationArgs:{oldPath:e,newPath:r}}),i.newContext=n.context,i.rename(e,r);let s=await i.open(e.toString(),"r");try{let a=await i.fstat(s),l=Buffer.alloc(a.size);await i.read(s,l,0,a.size,0),await i.close(s),await n.writeFile(r.toString(),l,"utf8"),await i.unlink(e)}catch(a){try{await i.close(s)}catch{}throw a}}async symlink(e,r,i){throw new Error("not implemented")}async readFile(e,r){await this.logOperation?.({fsName:this.name,path:e.toString(),operation:"readFile",operationArgs:{path:e,options:r}});let i=!0,n;if(typeof e=="number"){i=!1;let s=this.getFilehandle(e);if(!s)throw new Error("Invalid file descriptor");n=s}else if(typeof e=="string")n=await this.open(e,"r");else throw new Error("only filehandle and path are supported atm");try{let s=(await n.stat()).size;if(typeof s=="bigint"){if(s>BigInt(Number.MAX_SAFE_INTEGER))throw new Error("File too large to read into buffer");s=Number(s)}let a=Buffer.alloc(s),{bytesRead:l}=await n.read(a,0,s,0);if(r&&typeof r.encoding=="string")return a.slice(0,l).toString(r.encoding);if(typeof r=="string"){if(r==="utf8"||r==="utf-8")return a.slice(0,l).toString(r);throw new Error("Unsupported encoding: "+r)}return a.slice(0,l)}finally{n&&i&&await n.close()}}async writeFile(e,r,i){await this.logOperation?.({fsName:this.name,path:e.toString(),operation:"writeFile",operationArgs:{data:r,options:i}});let n=typeof e!="number",s,a,l,c="w";if(typeof i=="string"?a=i:i&&typeof i=="object"&&(a=i.encoding,l=i.mode,c=i.flag||"w"),typeof e=="number"){let o=this.getFilehandle(e);if(!o)throw new Error("Invalid file descriptor");s=o}else if(typeof e=="string")s=await this.open(e,c,l);else throw new Error("only filehandle and path are supported atm");try{let o;if(typeof r=="string")o=Buffer.from(r,a||"utf8");else if(r instanceof Buffer)o=r;else if(r instanceof Uint8Array)o=Buffer.from(r);else throw new Error("Invalid data type for writeFile");let f=0;for(;f<o.length;){let{bytesWritten:h}=await s.write(o,f,o.length-f,f);f+=h}}finally{s&&n&&await s.close()}}},u(wo,"Qt"),wo);y(XN,"CompositeFs");var iN=XN,yo,eD=(yo=class extends rs{constructor({name:e,hiddenFiles:r,rootPath:i}){super({name:e,rootPath:i}),U(this,"ig"),this.ig=(0,QN.default)(),this.ig.add(r)}async responsible(e){let r=e.replace(/\\/g,"/"),i=r;if(this.rootPath){let n=this.rootPath;r.startsWith(n+"/")?i=r.slice(n.length+1):r.startsWith(n)&&(i=r.slice(n.length))}return i=i.startsWith("./")?i.slice(2):i,i=i.startsWith("/")?i.slice(1):i,i===""||i==="."?!1:this.ig.ignores(i)}fileType(){return 255}error(e){return new Error(`Access to hidden file is not allowed: ${Ne(e)}`)}async open(e,r,i){throw this.error(e)}async access(e){throw this.error(e)}async stat(e){throw this.error(e)}async lstat(e){throw this.error(e)}async opendir(e){throw this.error(e)}async link(e){throw this.error(e)}async mkdir(e){throw this.error(e)}async readDirFiltering(e,r){let i=[];for(let n of r){let s=Ne(e)!=="/"?Ne(e)+"/"+n:"/"+n;await this.responsible(s)||i.push(n)}return i}async readdir(e){throw this.error(e)}async readlink(e){throw this.error(e)}async unlink(e){throw this.error(e)}async rename(e){throw this.error(e)}async rmdir(e){throw this.error(e)}async symlink(e,r){throw this.error(r)}async lookup(e){throw this.error(e)}resolvePath(e){throw new Error(`Access to hidden file is not allowed: resolvePath(${e})`)}async close(e){throw new Error("Access to hidden file is not allowed: close: "+e.subFsFileDescriptor)}async dataSync(e){throw new Error("Access to hidden file is not allowed: dataSync: "+e.subFsFileDescriptor)}async read(e,r,i,n,s){throw new Error("Access to hidden file is not allowed: readFileHandle: "+e.subFsFileDescriptor)}},u(yo,"ei"),yo);y(eD,"HiddenFileSubFs");var kH=eD,go,tD=(go=class{constructor(e){U(this,"delegate"),U(this,"compositeFs"),U(this,"_subFsFileDescriptor"),U(this,"handleType","file"),U(this,"_compositFsFileDescriptor",-1),this.delegate=e.fs,this._subFsFileDescriptor=e.subFsFileDescriptor,this._compositFsFileDescriptor=-1,this.compositeFs=e.compositeFs;let r=this._subFsFileDescriptor}get fsType(){return this.delegate.fileType()}get subFsFileDescriptor(){return this._subFsFileDescriptor}get fd(){return this._compositFsFileDescriptor}realize(e){if(this._compositFsFileDescriptor!==-1)throw new Error("was already realized");this._compositFsFileDescriptor=e}readableWebStream(e){throw new Error("Method not implemented.")}async appendFile(e,r){return await this.compositeFs.logOperationOnFileDescsriptor(this,"appendFile",{data:e,options:r}),await this.delegate.appendFile(this,e,r)}async chmod(e){return await this.compositeFs.logOperationOnFileDescsriptor(this,"chmod",{mode:e}),this.delegate.fchmod(this,e)}async chown(e,r){return await this.compositeFs.logOperationOnFileDescsriptor(this,"chown",{uid:e,gid:r}),this.delegate.fchown(this,e,r)}async close(){return await this.compositeFs.logOperationOnFileDescsriptor(this,"close",{}),this.compositeFs.close(this)}async datasync(){return await this.compositeFs.logOperationOnFileDescsriptor(this,"datasync",{}),this.delegate.dataSync(this)}async read(e,r,i,n){return await this.compositeFs.logOperationOnFileDescsriptor(this,"read",{targetBufferLength:e.length,offset:r,length:i,position:n}),await this.delegate.read(this,e,r,i,n)}async readv(e,r){return await this.compositeFs.logOperationOnFileDescsriptor(this,"readv",{buffers:e,position:r}),this.delegate.readv(this,e,r)}async stat(e){return await this.compositeFs.logOperationOnFileDescsriptor(this,"stat",{options:e}),this.delegate.fstat(this,e)}async truncate(e){return await this.compositeFs.logOperationOnFileDescsriptor(this,"truncate",{len:e}),this.delegate.ftruncate(this,e)}async utimes(e,r){return await this.compositeFs.logOperationOnFileDescsriptor(this,"utimes",{atime:e,mtime:r}),this.delegate.futimes(this,e,r)}async write(e,r,i,n){return await this.compositeFs.logOperationOnFileDescsriptor(this,"write",{buffer:e,offset:r,length:i,position:n}),this.delegate.write(this,e,r,i,n)}async writev(e,r){return await this.compositeFs.logOperationOnFileDescsriptor(this,"writev",{buffers:e,position:r}),this.delegate.writev(this,e,r)}async sync(){return await this.compositeFs.logOperationOnFileDescsriptor(this,"sync",{}),this.delegate.dataSync(this)}},u(go,"ti"),go);y(tD,"CompositFsFileHandle");var ko=tD,bo,TH=(bo=class extends rs{constructor({name:e,rootPath:r,ephemeralPatterns:i}){super({name:e,rootPath:r}),U(this,"openFh",new Map),U(this,"memFs",(0,Hd.createFsFromVolume)(new Hd.Volume)),U(this,"ig"),U(this,"patterns"),this.ig=(0,rD.default)(),this.ig.add(i),this.patterns=i}normalizePath(e){let r=typeof e=="string"?e:e.toString();return r.startsWith("/")?r:"/"+r}async responsible(e){let r=e.replace(/\\/g,"/"),i=r;return this.rootPath&&(r.startsWith(this.rootPath+"/")?i=r.slice(this.rootPath.length+1):r.startsWith(this.rootPath)&&(i=r.slice(this.rootPath.length))),i=i.startsWith("./")?i.slice(2):i,i=i.startsWith("/")?i.slice(1):i,i===""||i==="."?!1:this.ig.ignores(i)}fileType(){return 5}async open(e,r,i){let n=this.normalizePath(e),s=Nd.dirname(n);s&&s!=="/"&&s!=="."&&await this.memFs.promises.mkdir(s,{recursive:!0});let a=await this.memFs.promises.open(n,r,i);return this.openFh.set(a.fd,a),new ko({fs:this,compositeFs:this.compositeFs,subFsFileDescriptor:a.fd,parentFsFileDescriptors:[a.fd]})}async access(e,r){let i=this.normalizePath(e);return await this.memFs.promises.access(i,r)}async stat(e,r){let i=this.normalizePath(e);return this.memFs.promises.stat(i,{bigint:!1})}async lstat(e,r){let i=this.normalizePath(e);return this.memFs.promises.lstat(i,{bigint:!1})}async opendir(e,r){let i=this.normalizePath(e);return await this.memFs.promises.opendir(i,r)}async link(e,r){let i=this.normalizePath(e),n=this.normalizePath(r);return await this.memFs.promises.link(i,n)}async mkdir(e,r){let i=this.normalizePath(e);if(!(typeof r=="object"&&r&&"recursive"in r&&r.recursive)){let n=Nd.dirname(i);if(n&&n!=="/"&&n!==".")try{await this.memFs.promises.stat(n)}catch{await this.memFs.promises.mkdir(n,{recursive:!0})}}await this.memFs.promises.mkdir(i,r)}async readdir(e,...r){let i=this.normalizePath(e),n=await this.memFs.promises.readdir(i,...r);return console.log("EPHEMERAL: READDIR: ",n),n}async readlink(e){throw new Error("readlink is not implemented for EphemeralFileSubFs")}async unlink(e){let r=this.normalizePath(e);return await this.memFs.promises.unlink(r)}async rename(e,r){let i=this.normalizePath(e),n=this.normalizePath(r);return await this.memFs.promises.rename(i,n)}async rmdir(e,r){let i=this.normalizePath(e);return await this.memFs.promises.rmdir(i,r)}async symlink(e,r,i){let n=this.normalizePath(e),s=this.normalizePath(r);return await this.memFs.promises.symlink(n,s,i)}async lookup(e){throw new Error(`lookup is not implemented for: ${Ne(e)}`)}async close(e){let r=this.openFh.get(e.subFsFileDescriptor);r&&(await r.close(),this.openFh.delete(e.subFsFileDescriptor))}async dataSync(e){let r=this.openFh.get(e.subFsFileDescriptor);if(r)return await r.datasync()}async read(e,r,i,n,s){let a=this.openFh.get(e.subFsFileDescriptor);if(a)return await a.read(r,i,n,s);throw new Error(`File handle not found: ${e.subFsFileDescriptor}`)}async fchmod(e,r){let i=this.openFh.get(e.subFsFileDescriptor);if(i)return await i.chmod(r)}async fchown(e,r,i){let n=this.openFh.get(e.subFsFileDescriptor);if(n)return await n.chown(r,i)}async write(e,r,i,n,s){let a=this.openFh.get(e.subFsFileDescriptor);if(a)return await a.write(r,i,n,s);throw new Error(`File handle not found: ${e.subFsFileDescriptor}`)}async ftruncate(e,r){let i=this.openFh.get(e.subFsFileDescriptor);if(i)return await i.truncate(r)}resolvePath(e){throw new Error(`resolvePath is not implemented: resolvePath(${e})`)}async fstat(e,r){let i=this.openFh.get(e.subFsFileDescriptor);if(i)return await i.stat(r);throw new Error(`File handle not found: ${e.subFsFileDescriptor}`)}async futimes(e,r,i){let n=this.openFh.get(e.subFsFileDescriptor);if(n)return await n.utimes(r,i)}async writev(e,r,i){let n=this.openFh.get(e.subFsFileDescriptor);if(n)return await n.writev(r,i??void 0);throw new Error(`File handle not found: ${e.subFsFileDescriptor}`)}async readv(e,r,i){let n=this.openFh.get(e.subFsFileDescriptor);if(n)return await n.readv(r,i??void 0);throw new Error(`File handle not found: ${e.subFsFileDescriptor}`)}async readFile(e,r){if(typeof e=="string"||Buffer.isBuffer(e)){let i=this.normalizePath(e);return this.memFs.promises.readFile(i,r)}return super.readFile(e,r)}async writeFile(e,r,i){let n=this.normalizePath(e),s=Nd.dirname(n);return s&&s!=="/"&&s!=="."&&await this.memFs.promises.mkdir(s,{recursive:!0}),this.memFs.promises.writeFile(n,r,i)}},u(bo,"ii"),bo);y(TH,"EphemeralSubFs");var _o,nD=(_o=class extends rs{constructor({name:e,sourceFs:r,copyToFs:i,copyToRootPath:n,rootPath:s,patterns:a}){super({rootPath:s,name:e}),U(this,"openFh",new Map),U(this,"sourceFs"),U(this,"copyToFs"),U(this,"copyPath"),U(this,"ig"),U(this,"patterns"),this.sourceFs=r,this.copyToFs=i,this.copyPath=n,this.patterns=a,this.ig=(0,iD.default)(),this.ig.add(a)}normalizeCopyPath(e){let r=typeof e=="string"?e:e.toString(),i=r.startsWith("/")?r:"/"+r;return Gn.join(this.copyPath,i)}normalizePath(e){let r=typeof e=="string"?e:e.toString();return r.startsWith("/")?r:"/"+r}async responsible(e){let r=e.replace(/\\/g,"/"),i=r;if(this.compositeFs.rootPath){let n=this.compositeFs.rootPath;r.startsWith(n+"/")?i=r.slice(n.length+1):r.startsWith(n)&&(i=r.slice(n.length))}return i=i.startsWith("./")?i.slice(2):i,i=i.startsWith("/")?i.slice(1):i,i===""||i==="."?!1:this.ig.ignores(i)}fileType(){return 6}async isCopied(e){let r=this.normalizeCopyPath(e);try{return await this.copyToFs.promises.access(r),!0}catch{return!1}}async copyFromSource(e){let r=this.normalizeCopyPath(e),i=this.normalizePath(e),n=Gn.dirname(r);n&&n!=="/"&&n!=="."&&await this.copyToFs.promises.mkdir(n,{recursive:!0});try{let s=await this.sourceFs.promises.readFile(i);await this.copyToFs.promises.writeFile(r,s)}catch(s){if(s.code!=="ENOENT")throw s}}async open(e,r,i){let n=this.normalizePath(e),s=this.normalizeCopyPath(e);if(r.includes("w")||r.includes("a")||r.includes("+")){let a=Gn.dirname(s);if(a&&a!=="/"&&a!=="."&&await this.copyToFs.promises.mkdir(a,{recursive:!0}),!await this.isCopied(e))try{await this.sourceFs.promises.access(n),await this.copyFromSource(e)}catch{}let l=await this.copyToFs.promises.open(s,r,i);return this.openFh.set(l.fd,l),new ko({fs:this,compositeFs:this.compositeFs,subFsFileDescriptor:l.fd,parentFsFileDescriptors:[l.fd]})}else{let a=await this.isCopied(e),l=a?this.copyToFs:this.sourceFs,c=a?s:n,o=await l.promises.open(c,r,i);return this.openFh.set(o.fd,o),new ko({fs:this,compositeFs:this.compositeFs,subFsFileDescriptor:o.fd,parentFsFileDescriptors:[o.fd]})}}async access(e,r){let i=this.normalizePath(e),n=this.normalizeCopyPath(e);try{await this.copyToFs.promises.access(n,r);return}catch{return await this.sourceFs.promises.access(i,r)}}async stat(e,r){let i=this.normalizePath(e),n=this.normalizeCopyPath(e);try{return await this.copyToFs.promises.stat(n,{bigint:r?.bigint??!1})}catch{return this.sourceFs.promises.stat(i,{bigint:r?.bigint??!1})}}async lstat(e,r){let i=this.normalizePath(e),n=this.normalizeCopyPath(e);try{return await this.copyToFs.promises.lstat(n,{bigint:r?.bigint??!1})}catch{return this.sourceFs.promises.lstat(i,{bigint:r?.bigint??!1})}}async opendir(e,r){let i=this.normalizePath(e);return new Sb(this.compositeFs,i)}async link(e,r){let i=this.normalizeCopyPath(e),n=this.normalizeCopyPath(r);return await this.copyToFs.promises.link(i,n)}async mkdir(e,r){let i=this.normalizeCopyPath(e);if(!(typeof r=="object"&&r&&"recursive"in r&&r.recursive)){let n=Gn.dirname(i);if(n&&n!=="/"&&n!==".")try{await this.copyToFs.promises.stat(n)}catch{await this.copyToFs.promises.mkdir(n,{recursive:!0})}}await this.copyToFs.promises.mkdir(i,r)}async readdir(e,...r){let i=this.normalizePath(e),n=this.normalizeCopyPath(e),s=new Set,a=new Set;try{let l=await this.sourceFs.promises.readdir(i,...r);Array.isArray(l)&&l.forEach(c=>s.add(typeof c=="string"?c:c.name))}catch(l){if(l.code!=="ENOENT")throw l}try{let l=await this.copyToFs.promises.readdir(n,...r);Array.isArray(l)&&l.forEach(c=>a.add(typeof c=="string"?c:c.name))}catch(l){if(l.code!=="ENOENT")throw l}return Array.from(new Set([...s,...a]))}async readlink(e){throw new Error("readlink is not implemented for CopyOnWriteSubFs")}async unlink(e){let r=this.normalizeCopyPath(e);return await this.copyToFs.promises.unlink(r)}async rename(e,r){let i=this.normalizeCopyPath(e),n=this.normalizeCopyPath(r);return await this.copyToFs.promises.rename(i,n)}async rmdir(e,r){let i=this.normalizeCopyPath(e);return await this.copyToFs.promises.rmdir(i,r)}async symlink(e,r,i){let n=this.normalizeCopyPath(e),s=this.normalizeCopyPath(r);return await this.copyToFs.promises.symlink(n,s,i)}async lookup(e){throw new Error(`lookup is not implemented for: ${Ne(e)}`)}resolvePath(e){throw new Error(`resolvePath is not implemented: resolvePath(${e})`)}async close(e){let r=this.openFh.get(e.subFsFileDescriptor);r&&(await r.close(),this.openFh.delete(e.subFsFileDescriptor))}async dataSync(e){let r=this.openFh.get(e.subFsFileDescriptor);if(r)return await r.datasync()}async read(e,r,i,n,s){let a=this.openFh.get(e.subFsFileDescriptor);if(a)return await a.read(r,i,n,s);throw new Error(`File handle not found: ${e.subFsFileDescriptor}`)}async fchmod(e,r){let i=this.openFh.get(e.subFsFileDescriptor);if(i)return await i.chmod(r)}async fchown(e,r,i){let n=this.openFh.get(e.subFsFileDescriptor);if(n)return await n.chown(r,i)}async write(e,r,i,n,s){let a=this.openFh.get(e.subFsFileDescriptor);if(a)return await a.write(r,i,n,s);throw new Error(`File handle not found: ${e.subFsFileDescriptor}`)}async ftruncate(e,r){let i=this.openFh.get(e.subFsFileDescriptor);if(i)return await i.truncate(r)}async fstat(e,r){let i=this.openFh.get(e.subFsFileDescriptor);if(i)return await i.stat(r);throw new Error(`File handle not found: ${e.subFsFileDescriptor}`)}async futimes(e,r,i){let n=this.openFh.get(e.subFsFileDescriptor);if(n)return await n.utimes(r,i)}async writev(e,r,i){let n=this.openFh.get(e.subFsFileDescriptor);if(n)return await n.writev(r,i??void 0);throw new Error(`File handle not found: ${e.subFsFileDescriptor}`)}async readv(e,r,i){let n=this.openFh.get(e.subFsFileDescriptor);if(n)return await n.readv(r,i??void 0);throw new Error(`File handle not found: ${e.subFsFileDescriptor}`)}async readFile(e,r){if(typeof e!="string"&&!Buffer.isBuffer(e))return super.readFile(e,r);let i=this.normalizePath(e),n=this.normalizeCopyPath(e);try{return await this.copyToFs.promises.readFile(n,r)}catch{return this.sourceFs.promises.readFile(i,r)}}async writeFile(e,r,i){let n=this.normalizeCopyPath(e);await this.isCopied(e)||await this.copyFromSource(e);let s=Gn.dirname(n);s&&s!=="/"&&s!=="."&&await this.copyToFs.promises.mkdir(s,{recursive:!0}),await this.copyToFs.promises.writeFile(n,r,i)}},u(_o,"ri"),_o);y(nD,"CopyOnWriteSubFs");var nN=nD;function zr(t){return{name:t.name,isFile:y(()=>!t.isDir,"isFile"),isDirectory:y(()=>t.isDir,"isDirectory"),isBlockDevice:y(()=>!0,"isBlockDevice"),isCharacterDevice:y(()=>!1,"isCharacterDevice"),isSymbolicLink:y(()=>!1,"isSymbolicLink"),isFIFO:y(()=>!1,"isFIFO"),isSocket:y(()=>!1,"isSocket"),parentPath:t.parent,path:t.parent}}u(zr,"V");y(zr,"toDirEntry");var vo,sD=(vo=class extends rs{constructor({name:e,gitStorageFs:r,gitRoot:i,handler:n,rootPath:s}){super({name:e,rootPath:s}),U(this,"memFs"),U(this,"openFh",{}),U(this,"storageFs"),U(this,"gitRoot"),U(this,"handler"),this.handler=n,this.gitRoot=i,this.storageFs=r,this.memFs=(0,Vd.createFsFromVolume)(new Vd.Volume)}async getAuthor(){let e=await sb.default.getConfig({fs:this.storageFs,dir:this.gitRoot,path:"user.name"}),r=await sb.default.getConfig({fs:this.storageFs,dir:this.gitRoot,path:"user.email"}),i=Math.floor(Date.now()/1e3),n=new Date().getTimezoneOffset();return{name:e,email:r,date:i,timezoneOffset:n}}async responsible(e){return!0}getRouteParams(){return this.context?.params||{}}getStaticSiblings(){return this.context?.staticSiblings||[]}async open(e,r,i){if(this.handler.writeFile===void 0&&(r.includes("w")||r.includes("a")))throw new Error(`Write operations not allowed for ${this.handler.type}`);if(r.includes("x")&&this.handler.type!=="gitBranchFileVirtualFile"&&this.handler.type!=="claudeVirtualSessionFileVirtualFile")throw new Error(`Exclusive operations not allowed for ${this.handler.type}`);let n=await this.getAuthor(),s=this.getRouteParams(),a=await this.handler.getFile({cacheFs:this.memFs,filePath:e,userSpaceFs:this.compositeFs,pathParams:s,author:n}),l=!1;for(let d of Object.values(this.openFh))d.path===e&&(l=!0);if((a||l)&&r.includes("x"))throw Object.assign(new Error(`EEXIST: file already exists, open '${e}'`),{code:"EEXIST",errno:-17,syscall:"open",path:e});if(!a&&!l&&!(r.includes("w")||r.includes("a")))throw Object.assign(new Error(`ENOENT: no such file or directory, open '${e}'`),{code:"ENOENT",errno:-2,syscall:"open",path:e});let c=ab.dirname(e);if(await this.memFs.promises.mkdir(c,{recursive:!0}),a===void 0&&!r.includes("x")||a&&a.type==="file")try{let d=await this.memFs.promises.access(e)}catch{await this.memFs.promises.writeFile(e,"")}let o=await this.memFs.promises.open(e,r,i),f=o.fd,h=new ko({fs:this,compositeFs:this.compositeFs,subFsFileDescriptor:f,parentFsFileDescriptors:[]});return this.openFh[f]={path:e,mode:r,fh:o,openSha:a?.oid,readSha:void 0,unflushed:[]},(r.includes("x")||r.includes("w"))&&this.openFh[f].unflushed.push({length:0,start:0}),h}async mkdir(e,r){let i=e.toString(),n=this.getRouteParams(),s=r?{options:r}:{};try{let a=await this.getAuthor();await this.handler.mkdir({cacheFs:this.memFs,filePath:e.toString(),userSpaceFs:this.compositeFs,pathParams:n,...s,author:a});let l=typeof r=="object"?{...r,recursive:!0}:{recursive:!0};await this.memFs.promises.mkdir(e,l);let c=i.split("/"),o="";for(let f=1;f<=c.length;f++){o=c.slice(0,f).join("/");try{if((await this.memFs.promises.stat(o)).isDirectory()){let h=await this.memFs.promises.open(o,"r");this.openFh[h.fd]={path:o,mode:"r",fh:h,openSha:void 0,readSha:void 0,unflushed:[]}}}catch{}}}catch(a){throw a}}async access(e,r){await this.stat(e)}async futimes(e,r,i){let n=this.openFh[e.subFsFileDescriptor];if(!n)throw new Error("Invalid file handle");return await n.fh.utimes(r,i)}async fstat(e,r){let i=this.openFh[e.subFsFileDescriptor];if(!i)throw new Error("Invalid file handle");return this.stat(i.path,r)}async ftruncate(e,r){let i=this.openFh[e.subFsFileDescriptor];if(!i)throw new Error("Invalid file handle");return i.unflushed.push({length:0,start:0}),await i.fh.truncate(r)}async stat(e,r){let i=e.toString(),n=Object.values(this.openFh).find(l=>l.path===i&&l.unflushed.length>0);if(n&&n.unflushed.length>0)return await n.fh.stat(r);let s=this.getRouteParams(),a=await this.getAuthor();return await this.handler.getStats({cacheFs:this.memFs,filePath:i,userSpaceFs:this.compositeFs,pathParams:s,author:a})}async lstat(e,r){return this.stat(e,r)}async readdir(e,r){let i=e.toString(),n=this.getRouteParams(),s=this.getStaticSiblings(),a=await this.getAuthor(),l=await this.handler.getFile({cacheFs:this.memFs,filePath:i,userSpaceFs:this.compositeFs,pathParams:n,author:a});if(l){if(l.type!=="directory")throw new Error("not a folder");let c=Array.from(new Set([...l.content,...s.map(o=>zr({name:o.segment,parent:i,isDir:o.type==="folder"}))])).sort((o,f)=>o.name.localeCompare(f.name,void 0,{numeric:!0,sensitivity:"base"}));return r?.withFileTypes?c:c.map(o=>o.name)}return[]}async read(e,r,i,n,s){let a=e.subFsFileDescriptor,l=this.openFh[a];if(!l)throw new Error("Invalid file handle");if(l.unflushed.length===0){let c=this.getRouteParams(),o=await this.getAuthor(),f=await this.handler.getFile({cacheFs:this.memFs,filePath:l.path,userSpaceFs:this.compositeFs,pathParams:c,author:o});if(!f?.content)throw new Error("couldnt access content");if(f.type!=="file")throw new Error("not a file");let h=typeof f.content=="string"?Buffer.from(f.content):f.content,d=typeof s=="number"?s:0,p=Math.min(d+n,h.length),m=Math.max(0,p-d);return h.copy(r,i,d,d+m),{bytesRead:m,buffer:r}}return await l.fh.read(r,i,n,s)}async write(e,r,i,n,s){let a=this.openFh[e.subFsFileDescriptor];if(!a)throw new Error("Invalid file handle");let l=a.mode;if(!l.includes("w")&&!l.includes("a")&&!l.includes("+"))throw Object.assign(new Error("EBADF: bad file descriptor, write"),{code:"EBADF",errno:-9,syscall:"write"});if(a.unflushed.length===0){let h=this.getRouteParams(),d=await this.getAuthor(),p=await this.handler.getFile({cacheFs:this.memFs,filePath:a.path,userSpaceFs:this.compositeFs,pathParams:h,author:d});p&&p.oid&&(await this.memFs.promises.writeFile(a.path,p.content),a.readSha=p.oid)}let c=await a.fh.write(r,i,n,s),o=i??0,f=s??0;return a.unflushed.push({start:f,length:n||r.byteLength-o+f}),c}async close(e){let r=e.subFsFileDescriptor,i=this.openFh[r];if(!i)throw new Error("Invalid file handle");try{await this.dataSync(e),await i.fh.close()}finally{delete this.openFh[r]}}async dataSync(e){let r=e.subFsFileDescriptor,i=this.openFh[r];if(!i)throw new Error("Invalid file handle");if(i.unflushed.length>0){if(this.handler.writeFile){let n=await this.memFs.promises.readFile(i.path),s=this.getRouteParams(),a=await this.getAuthor();await this.handler.writeFile({cacheFs:this.memFs,filePath:i.path,userSpaceFs:this.compositeFs,content:n,pathParams:s,author:a})}i.unflushed=[]}}async readFile(e,r){let i=typeof e=="string"?e:Buffer.isBuffer(e)?e.toString():e.fd?`FileHandle(${e.fd})`:e.toString(),n=null;typeof r=="string"?n=r:r&&typeof r=="object"&&r.encoding&&(n=r.encoding);let s=await this.open(i,"r");try{let a=(await this.fstat(s)).size,l=Buffer.alloc(a);return await this.read(s,l,0,a,0),await this.close(s),n?l.toString(n):l}catch(a){try{await this.close(s)}catch{}throw a}}async writeFile(e,r,i){let n="w",s="utf8",a;typeof i=="string"?s=i:i&&typeof i=="object"&&(i.flag&&(n=String(i.flag)),i.encoding&&(s=i.encoding),i.mode&&(a=typeof i.mode=="string"?parseInt(i.mode,8):i.mode));let l=await this.open(e,n,a);try{let c;typeof r=="string"?c=Buffer.from(r,s):Buffer.isBuffer(r)?c=r:r instanceof Uint8Array?c=Buffer.from(r):ArrayBuffer.isView(r)?c=Buffer.from(r.buffer,r.byteOffset,r.byteLength):c=Buffer.from(r),await this.write(l,c,0,c.length,0)}finally{await this.close(l)}}async rename(e,r){let i=e.toString(),n=r.toString();if(!this.handler.rename)throw new Error(`Rename not supported for ${this.handler.type} files`);let s=await this.memFs.promises.access(n).then(()=>!0).catch(()=>!1),a=await this.stat(n).then(()=>!0).catch(()=>!1),l=await this.stat(i).then(()=>!0).catch(()=>!1);if(await this.memFs.promises.access(i).then(()=>!0).catch(()=>!1)){let f=ab.dirname(n);try{await this.memFs.promises.access(f)}catch{await this.memFs.promises.mkdir(f,{recursive:!0})}await this.memFs.promises.rename(e,r)}let c=this.getRouteParams(),o=await this.getAuthor();await this.handler.rename({cacheFs:this.memFs,filePath:i,userSpaceFs:this.compositeFs,newPath:n,pathParams:c,newPathParams:this.newContext?.params||{},author:o})}async fchmod(e,r){}async unlink(e){let r=e.toString();if(!this.handler.unlink)throw new Error(`Cannot unlink ${this.handler.type} files`);try{let i=this.getRouteParams(),n=await this.getAuthor();await this.handler.unlink({cacheFs:this.memFs,filePath:r,userSpaceFs:this.compositeFs,pathParams:i,author:n})}catch(i){let n=!1;for(let[s,a]of Object.entries(this.openFh))a.path===r&&a.unflushed.length>0&&(n=!0);if(!n)throw i}finally{let i=!1;for(let[n,s]of Object.entries(this.openFh))s.path===r&&(i=!0,await s.fh.close(),delete this.openFh[Number(n)]);i&&await this.memFs.promises.unlink(r)}}async rmdir(e,...r){let i=e.toString();if(!this.handler.rmdir)throw new Error(`Cannot rmdir ${this.handler.type} directories`);let n=this.getRouteParams(),s=await this.getAuthor();await this.handler.rmdir({cacheFs:this.memFs,filePath:i,userSpaceFs:this.compositeFs,pathParams:n,author:s});let a=!1;for(let[l,c]of Object.entries(this.openFh))c.path===i&&(a=!0,await c.fh.close(),delete this.openFh[Number(l)]);a&&await this.memFs.promises.rmdir(i,{recursive:!0})}fileType(){return 10}},u(vo,"ai"),vo);y(sD,"CompositeSubFsAdapter");var Wt=sD;function aD({gitStorageFs:t,gitRoot:e,rootPath:r}){return new Wt({name:"legit-virtual-file",gitStorageFs:t,gitRoot:e,rootPath:r||e,handler:{type:"legitVirtualFile",rootType:"folder",getStats:y(async i=>{let n=e+"/.git";try{return await t.promises.stat(n)}catch{throw new Error(`ENOENT: no such file or directory, stat '${n}'`)}},"getStats"),getFile:y(async i=>({type:"directory",content:[],mode:493,size:0}),"getFile"),rename(i){throw new Error("not implemented")},mkdir:y(async function(i){throw new Error("not implemented")},"mkdir")}})}u(aD,"ir");y(aD,"createLegitVirtualFileAdapter");function Xn(t){return t.replace(/\./g,"%2E").replace(/\//g,".")}u(Xn,"re");y(Xn,"encodeBranchNameForVfs");function Ye(t){return t.replace(/\./g,"/").replace(/%2E/g,".")}u(Ye,"H");y(Ye,"decodeBranchNameFromVfs");var lD="-operation";async function mi(t,e,r){let i=(await oD.default.listBranches({fs:t,dir:e})).filter(n=>n.endsWith(Ye(r)+lD))[0];return i?Xn(i):void 0}u(mi,"te");y(mi,"resolveOperationBranchName");async function ve(t,e){try{let r=await Ld.default.getConfig({fs:e,dir:t,path:"user.legit-current-branch"});if(r)return Xn(r)}catch{}try{let r=await Ld.default.getConfig({fs:e,dir:t,path:"init.defaultBranch"});return Xn(r)||"main"}catch{return"main"}}u(ve,"O");y(ve,"getCurrentBranch");async function cD(t,e,r){await Ld.default.setConfig({fs:e,dir:t,path:"user.legit-current-branch",value:Ye(r)})}u(cD,"rr");y(cD,"setCurrentBranch");function fD({gitStorageFs:t,gitRoot:e,rootPath:r}){let i={type:"gitBranchOperationsVirtualFile",rootType:"file",getStats:y(async s=>{let{pathParams:a}=s;a.branchName===void 0&&(a.branchName=await ve(e,t));let l=await mi(t,e,a.branchName),c,o=!1;if(l)try{c=await Hn.default.resolveRef({fs:t,dir:e,ref:l}),o=!0}catch{try{c=await Hn.default.resolveRef({fs:t,dir:e,ref:`refs/heads/${l}`}),o=!0}catch{throw new Error(`Base Branch ${a.branchName} for operations does not exis`)}}else try{c=await Hn.default.resolveRef({fs:t,dir:e,ref:`refs/heads/${a.branchName}`})}catch{throw new Error(`Base Branch ${a.branchName} for operations does not exis`)}let f=await Hn.default.readCommit({fs:t,dir:e,oid:c}),{commit:h}=f,d=h.committer.timestamp*1e3;try{return{mode:420,size:(o?await n.handler.getFile(s):void 0)?.content?.length??0,atimeMs:d,mtimeMs:d,ctimeMs:d,birthtimeMs:d,atime:new Date(d),mtime:new Date(d),ctime:new Date(d),birthtime:new Date(d),isFile:y(()=>!0,"isFile"),isDirectory:y(()=>!1,"isDirectory"),isSymbolicLink:y(()=>!1,"isSymbolicLink"),isBlockDevice:y(()=>!1,"isBlockDevice"),isCharacterDevice:y(()=>!1,"isCharacterDevice"),isSocket:y(()=>!1,"isSocket"),isFIFO:y(()=>!1,"isFIFO"),isFileSync:y(()=>!0,"isFileSync"),isDirectorySync:y(()=>!1,"isDirectorySync"),dev:0,ino:0,nlink:1,uid:0,gid:0,rdev:0,blksize:4096,blocks:0}}catch{throw new Error("ENOENT: no such file or directory, stat operationHistory")}},"getStats"),getFile:y(async s=>{let{pathParams:a}=s;a.branchName===void 0&&(a.branchName=await ve(e,t));let l=await mi(t,e,a.branchName),c=[];if(l){let h=await Hn.default.resolveRef({fs:t,dir:e,ref:`refs/heads/${l}`}),d=!1,p=h;for(;p&&!d;){let m=await Hn.default.readCommit({fs:t,dir:e,oid:p});c.push({oid:m.oid,parentOids:m.commit.parent,message:m.commit.message,originBranchOid:"unset"}),p=m.commit.parent&&m.commit.parent.length>0?m.commit.parent[0]:null,m.commit.parent.length===2&&m.commit.parent[0]===m.commit.parent[1]&&(d=!0)}}let o;for(let h=c.length-1;h>=0;h--){let d=c[h];if(o===void 0){if(d.parentOids.length!==2&&d.parentOids[0]!==d.parentOids[1])throw new Error(`Operation commit ${d.oid} does not have two parents as expected`);o=d.parentOids[1]}d.parentOids.length===2&&(o=d.parentOids[1]),d.originBranchOid=o}let f=Buffer.from(JSON.stringify(c,null,2),"utf-8");return{type:"file",content:f,mode:420,size:f.length}},"getFile"),rename:y(async function(s){throw new Error("not implemented")},"rename"),mkdir:y(async function(s){throw new Error("not implemented")},"mkdir")},n=new Wt({name:"branch-operations",gitStorageFs:t,gitRoot:e,rootPath:r||e,handler:i});return n}u(fD,"nr");y(fD,"createBranchOperationsAdapter");var Ki="legit",xH=y(({fs:t,gitRepoPath:e,serverUrl:r="https://hub.legitcontrol.com",auth:i,anonymousBranch:n,authHeaderPrefix:s="Bearer "})=>{let a=!1;async function l(g){let b=await i.getMaxAccessTokenForBranch(g);if(!b)throw new Error(`No access token for branch ${g}`);await St.default.fetch({fs:t,http:kd,dir:e,singleBranch:!0,ref:`${g}`,remote:Ki,url:r,headers:{Authorization:`${s}${b}`}});let _=await St.default.resolveRef({fs:t,dir:e,ref:`${Ki}/${g}`});await St.default.writeRef({fs:t,dir:e,ref:`refs/heads/${g}`,value:_})}u(l,"o"),y(l,"loadBranch");let c=[];async function o(){let g=await i.getMaxAccessTokenForBranch("todo");await St.default.fetch({fs:t,http:kd,dir:e,remote:Ki,url:r,headers:{Authorization:`${s}${g}`}});let b=await St.default.listBranches({fs:t,dir:e});for(let _ of b){if(_===n)continue;let S=`${Ki}/${_}`,F,k;try{F=await St.default.resolveRef({fs:t,dir:e,ref:_})}catch(A){console.log(`Could not resolve local ref ${_}:`,A)}try{k=await St.default.resolveRef({fs:t,dir:e,ref:S})}catch{k=void 0}if(F&&k){if(F!==k){let A=await St.default.findMergeBase({fs:t,dir:e,oids:[F,k]});if(A[0]!==F&&A[0]!==k){let v=await St.default.merge({fs:t,dir:e,ours:F,theirs:k,fastForwardOnly:!1,abortOnConflict:!1,author:{name:"Your Name",email:"your.email@example.com"},mergeDriver:y(async({branches:T,contents:E,path:R})=>{let[P,I,B]=E;return console.log(`Merging ${T[0]} with ${T[1]}...`),console.log("merged:"),console.log(E),{cleanMerge:!0,mergedText:B===void 0?I:B}},"mergeDriver")});await St.default.writeRef({fs:t,dir:e,ref:`refs/heads/${_}`,value:v.oid,force:!0})}A[0]===F?(console.log(`branch ${_} differs - remote ahaed, not behind`),await St.default.writeRef({fs:t,dir:e,ref:`refs/heads/${_}`,value:k,force:!0})):A[0]===k?(console.log(`branch ${_} differs - local ahead, not behind`),c.push(_)):(console.log(`branch ${_} differs - both changed`),c.push(_))}}else F&&!k&&c.push(_)}}u(o,"l"),y(o,"pull");async function f(g){if((await i.getUser()).type!=="local")for(let b of g){let _=await i.getMaxAccessTokenForBranch(b);await St.default.push({fs:t,http:kd,dir:e,remote:Ki,url:r,ref:b,headers:{Authorization:`Bearer ${_}`}})}}u(f,"h"),y(f,"push");let h=Promise.resolve();async function d(g){h=h.then(()=>f(g)),await h}u(d,"f"),y(d,"sequentialPush");async function p(){await St.default.getConfig({fs:t,dir:e,path:`remote.${Ki}.fetch`})||await St.default.setConfig({fs:t,dir:e,path:`remote.${Ki}.fetch`,value:`+refs/heads/*:refs/remotes/${Ki}/*`});try{await o();let g=[...new Set(c)].filter(b=>b.indexOf(n)===-1);await d(g),c=[]}catch(g){console.error("Error monitoring changes:",g)}finally{a&&setTimeout(p,1e3)}}u(p,"p"),y(p,"pullPushTick");function m(){a=!0,p()}u(m,"u"),y(m,"startSync");function w(){a=!1}return u(w,"v"),y(w,"stopSync"),{start:y(()=>{a||(m(),a=!0)},"start"),stop:y(()=>{w()},"stop"),isRunning:y(()=>a,"isRunning"),loadBranch:l,sequentialPush:d}},"createLegitSyncService");function is(t){let e=t.length;for(;--e>=0;)t[e]=0}u(is,"Ke");y(is,"zero$1");var OH=0,uD=1,RH=2,AH=3,PH=258,Eb=29,Uc=256,Dc=Uc+1+Eb,fo=30,Fb=19,hD=2*Dc+1,Zn=15,G0=16,NH=7,kb=256,dD=16,pD=17,mD=18,ob=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),Dd=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),DH=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),wD=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),CH=512,hi=new Array((Dc+2)*2);is(hi);var Oc=new Array(fo*2);is(Oc);var Cc=new Array(CH);is(Cc);var Ic=new Array(PH-AH+1);is(Ic);var Tb=new Array(Eb);is(Tb);var Md=new Array(fo);is(Md);function Cd(t,e,r,i,n){this.static_tree=t,this.extra_bits=e,this.extra_base=r,this.elems=i,this.max_length=n,this.has_stree=t&&t.length}u(Cd,"di");y(Cd,"StaticTreeDesc");var yD,gD,bD;function Id(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e}u(Id,"hi");y(Id,"TreeDesc");var _D=y(t=>t<256?Cc[t]:Cc[256+(t>>>7)],"d_code"),$c=y((t,e)=>{t.pending_buf[t.pending++]=e&255,t.pending_buf[t.pending++]=e>>>8&255},"put_short"),Nt=y((t,e,r)=>{t.bi_valid>G0-r?(t.bi_buf|=e<<t.bi_valid&65535,$c(t,t.bi_buf),t.bi_buf=e>>G0-t.bi_valid,t.bi_valid+=r-G0):(t.bi_buf|=e<<t.bi_valid&65535,t.bi_valid+=r)},"send_bits"),Mr=y((t,e,r)=>{Nt(t,r[e*2],r[e*2+1])},"send_code"),vD=y((t,e)=>{let r=0;do r|=t&1,t>>>=1,r<<=1;while(--e>0);return r>>>1},"bi_reverse"),IH=y(t=>{t.bi_valid===16?($c(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):t.bi_valid>=8&&(t.pending_buf[t.pending++]=t.bi_buf&255,t.bi_buf>>=8,t.bi_valid-=8)},"bi_flush"),$H=y((t,e)=>{let r=e.dyn_tree,i=e.max_code,n=e.stat_desc.static_tree,s=e.stat_desc.has_stree,a=e.stat_desc.extra_bits,l=e.stat_desc.extra_base,c=e.stat_desc.max_length,o,f,h,d,p,m,w=0;for(d=0;d<=Zn;d++)t.bl_count[d]=0;for(r[t.heap[t.heap_max]*2+1]=0,o=t.heap_max+1;o<hD;o++)f=t.heap[o],d=r[r[f*2+1]*2+1]+1,d>c&&(d=c,w++),r[f*2+1]=d,!(f>i)&&(t.bl_count[d]++,p=0,f>=l&&(p=a[f-l]),m=r[f*2],t.opt_len+=m*(d+p),s&&(t.static_len+=m*(n[f*2+1]+p)));if(w!==0){do{for(d=c-1;t.bl_count[d]===0;)d--;t.bl_count[d]--,t.bl_count[d+1]+=2,t.bl_count[c]--,w-=2}while(w>0);for(d=c;d!==0;d--)for(f=t.bl_count[d];f!==0;)h=t.heap[--o],!(h>i)&&(r[h*2+1]!==d&&(t.opt_len+=(d-r[h*2+1])*r[h*2],r[h*2+1]=d),f--)}},"gen_bitlen"),SD=y((t,e,r)=>{let i=new Array(Zn+1),n=0,s,a;for(s=1;s<=Zn;s++)n=n+r[s-1]<<1,i[s]=n;for(a=0;a<=e;a++){let l=t[a*2+1];l!==0&&(t[a*2]=vD(i[l]++,l))}},"gen_codes"),BH=y(()=>{let t,e,r,i,n,s=new Array(Zn+1);for(r=0,i=0;i<Eb-1;i++)for(Tb[i]=r,t=0;t<1<<ob[i];t++)Ic[r++]=i;for(Ic[r-1]=i,n=0,i=0;i<16;i++)for(Md[i]=n,t=0;t<1<<Dd[i];t++)Cc[n++]=i;for(n>>=7;i<fo;i++)for(Md[i]=n<<7,t=0;t<1<<Dd[i]-7;t++)Cc[256+n++]=i;for(e=0;e<=Zn;e++)s[e]=0;for(t=0;t<=143;)hi[t*2+1]=8,t++,s[8]++;for(;t<=255;)hi[t*2+1]=9,t++,s[9]++;for(;t<=279;)hi[t*2+1]=7,t++,s[7]++;for(;t<=287;)hi[t*2+1]=8,t++,s[8]++;for(SD(hi,Dc+1,s),t=0;t<fo;t++)Oc[t*2+1]=5,Oc[t*2]=vD(t,5);yD=new Cd(hi,ob,Uc+1,Dc,Zn),gD=new Cd(Oc,Dd,0,fo,Zn),bD=new Cd(new Array(0),DH,0,Fb,NH)},"tr_static_init"),ED=y(t=>{let e;for(e=0;e<Dc;e++)t.dyn_ltree[e*2]=0;for(e=0;e<fo;e++)t.dyn_dtree[e*2]=0;for(e=0;e<Fb;e++)t.bl_tree[e*2]=0;t.dyn_ltree[kb*2]=1,t.opt_len=t.static_len=0,t.sym_next=t.matches=0},"init_block"),FD=y(t=>{t.bi_valid>8?$c(t,t.bi_buf):t.bi_valid>0&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0},"bi_windup"),sN=y((t,e,r,i)=>{let n=e*2,s=r*2;return t[n]<t[s]||t[n]===t[s]&&i[e]<=i[r]},"smaller"),Z0=y((t,e,r)=>{let i=t.heap[r],n=r<<1;for(;n<=t.heap_len&&(n<t.heap_len&&sN(e,t.heap[n+1],t.heap[n],t.depth)&&n++,!sN(e,i,t.heap[n],t.depth));)t.heap[r]=t.heap[n],r=n,n<<=1;t.heap[r]=i},"pqdownheap"),aN=y((t,e,r)=>{let i,n,s=0,a,l;if(t.sym_next!==0)do i=t.pending_buf[t.sym_buf+s++]&255,i+=(t.pending_buf[t.sym_buf+s++]&255)<<8,n=t.pending_buf[t.sym_buf+s++],i===0?Mr(t,n,e):(a=Ic[n],Mr(t,a+Uc+1,e),l=ob[a],l!==0&&(n-=Tb[a],Nt(t,n,l)),i--,a=_D(i),Mr(t,a,r),l=Dd[a],l!==0&&(i-=Md[a],Nt(t,i,l)));while(s<t.sym_next);Mr(t,kb,e)},"compress_block"),lb=y((t,e)=>{let r=e.dyn_tree,i=e.stat_desc.static_tree,n=e.stat_desc.has_stree,s=e.stat_desc.elems,a,l,c=-1,o;for(t.heap_len=0,t.heap_max=hD,a=0;a<s;a++)r[a*2]!==0?(t.heap[++t.heap_len]=c=a,t.depth[a]=0):r[a*2+1]=0;for(;t.heap_len<2;)o=t.heap[++t.heap_len]=c<2?++c:0,r[o*2]=1,t.depth[o]=0,t.opt_len--,n&&(t.static_len-=i[o*2+1]);for(e.max_code=c,a=t.heap_len>>1;a>=1;a--)Z0(t,r,a);o=s;do a=t.heap[1],t.heap[1]=t.heap[t.heap_len--],Z0(t,r,1),l=t.heap[1],t.heap[--t.heap_max]=a,t.heap[--t.heap_max]=l,r[o*2]=r[a*2]+r[l*2],t.depth[o]=(t.depth[a]>=t.depth[l]?t.depth[a]:t.depth[l])+1,r[a*2+1]=r[l*2+1]=o,t.heap[1]=o++,Z0(t,r,1);while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],$H(t,e),SD(r,c,t.bl_count)},"build_tree"),oN=y((t,e,r)=>{let i,n=-1,s,a=e[0*2+1],l=0,c=7,o=4;for(a===0&&(c=138,o=3),e[(r+1)*2+1]=65535,i=0;i<=r;i++)s=a,a=e[(i+1)*2+1],!(++l<c&&s===a)&&(l<o?t.bl_tree[s*2]+=l:s!==0?(s!==n&&t.bl_tree[s*2]++,t.bl_tree[dD*2]++):l<=10?t.bl_tree[pD*2]++:t.bl_tree[mD*2]++,l=0,n=s,a===0?(c=138,o=3):s===a?(c=6,o=3):(c=7,o=4))},"scan_tree"),lN=y((t,e,r)=>{let i,n=-1,s,a=e[0*2+1],l=0,c=7,o=4;for(a===0&&(c=138,o=3),i=0;i<=r;i++)if(s=a,a=e[(i+1)*2+1],!(++l<c&&s===a)){if(l<o)do Mr(t,s,t.bl_tree);while(--l!==0);else s!==0?(s!==n&&(Mr(t,s,t.bl_tree),l--),Mr(t,dD,t.bl_tree),Nt(t,l-3,2)):l<=10?(Mr(t,pD,t.bl_tree),Nt(t,l-3,3)):(Mr(t,mD,t.bl_tree),Nt(t,l-11,7));l=0,n=s,a===0?(c=138,o=3):s===a?(c=6,o=3):(c=7,o=4)}},"send_tree"),LH=y(t=>{let e;for(oN(t,t.dyn_ltree,t.l_desc.max_code),oN(t,t.dyn_dtree,t.d_desc.max_code),lb(t,t.bl_desc),e=Fb-1;e>=3&&t.bl_tree[wD[e]*2+1]===0;e--);return t.opt_len+=3*(e+1)+5+5+4,e},"build_bl_tree"),MH=y((t,e,r,i)=>{let n;for(Nt(t,e-257,5),Nt(t,r-1,5),Nt(t,i-4,4),n=0;n<i;n++)Nt(t,t.bl_tree[wD[n]*2+1],3);lN(t,t.dyn_ltree,e-1),lN(t,t.dyn_dtree,r-1)},"send_all_trees"),jH=y(t=>{let e=4093624447,r;for(r=0;r<=31;r++,e>>>=1)if(e&1&&t.dyn_ltree[r*2]!==0)return 0;if(t.dyn_ltree[9*2]!==0||t.dyn_ltree[10*2]!==0||t.dyn_ltree[13*2]!==0)return 1;for(r=32;r<Uc;r++)if(t.dyn_ltree[r*2]!==0)return 1;return 0},"detect_data_type"),cN=!1,qH=y(t=>{cN||(BH(),cN=!0),t.l_desc=new Id(t.dyn_ltree,yD),t.d_desc=new Id(t.dyn_dtree,gD),t.bl_desc=new Id(t.bl_tree,bD),t.bi_buf=0,t.bi_valid=0,ED(t)},"_tr_init$1"),kD=y((t,e,r,i)=>{Nt(t,(OH<<1)+(i?1:0),3),FD(t),$c(t,r),$c(t,~r),r&&t.pending_buf.set(t.window.subarray(e,e+r),t.pending),t.pending+=r},"_tr_stored_block$1"),UH=y(t=>{Nt(t,uD<<1,3),Mr(t,kb,hi),IH(t)},"_tr_align$1"),zH=y((t,e,r,i)=>{let n,s,a=0;t.level>0?(t.strm.data_type===2&&(t.strm.data_type=jH(t)),lb(t,t.l_desc),lb(t,t.d_desc),a=LH(t),n=t.opt_len+3+7>>>3,s=t.static_len+3+7>>>3,s<=n&&(n=s)):n=s=r+5,r+4<=n&&e!==-1?kD(t,e,r,i):t.strategy===4||s===n?(Nt(t,(uD<<1)+(i?1:0),3),aN(t,hi,Oc)):(Nt(t,(RH<<1)+(i?1:0),3),MH(t,t.l_desc.max_code+1,t.d_desc.max_code+1,a+1),aN(t,t.dyn_ltree,t.dyn_dtree)),ED(t),i&&FD(t)},"_tr_flush_block$1"),WH=y((t,e,r)=>(t.pending_buf[t.sym_buf+t.sym_next++]=e,t.pending_buf[t.sym_buf+t.sym_next++]=e>>8,t.pending_buf[t.sym_buf+t.sym_next++]=r,e===0?t.dyn_ltree[r*2]++:(t.matches++,e--,t.dyn_ltree[(Ic[r]+Uc+1)*2]++,t.dyn_dtree[_D(e)*2]++),t.sym_next===t.sym_end),"_tr_tally$1"),HH=qH,VH=kD,GH=zH,ZH=WH,KH=UH,JH={_tr_init:HH,_tr_stored_block:VH,_tr_flush_block:GH,_tr_tally:ZH,_tr_align:KH},YH=y((t,e,r,i)=>{let n=t&65535|0,s=t>>>16&65535|0,a=0;for(;r!==0;){a=r>2e3?2e3:r,r-=a;do n=n+e[i++]|0,s=s+n|0;while(--a);n%=65521,s%=65521}return n|s<<16|0},"adler32"),Bc=YH,XH=y(()=>{let t,e=[];for(var r=0;r<256;r++){t=r;for(var i=0;i<8;i++)t=t&1?3988292384^t>>>1:t>>>1;e[r]=t}return e},"makeTable"),QH=new Uint32Array(XH()),e7=y((t,e,r,i)=>{let n=QH,s=i+r;t^=-1;for(let a=i;a<s;a++)t=t>>>8^n[(t^e[a])&255];return t^-1},"crc32"),Je=e7,Qn={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},Oo={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8},{_tr_init:t7,_tr_stored_block:cb,_tr_flush_block:r7,_tr_tally:Xi,_tr_align:i7}=JH,{Z_NO_FLUSH:Qi,Z_PARTIAL_FLUSH:n7,Z_FULL_FLUSH:s7,Z_FINISH:nr,Z_BLOCK:fN,Z_OK:it,Z_STREAM_END:uN,Z_STREAM_ERROR:qr,Z_DATA_ERROR:a7,Z_BUF_ERROR:K0,Z_DEFAULT_COMPRESSION:o7,Z_FILTERED:l7,Z_HUFFMAN_ONLY:Td,Z_RLE:c7,Z_FIXED:f7,Z_DEFAULT_STRATEGY:u7,Z_UNKNOWN:h7,Z_DEFLATED:Gd}=Oo,d7=9,p7=15,m7=8,w7=29,y7=256,fb=y7+1+w7,g7=30,b7=19,_7=2*fb+1,v7=15,ee=3,Yi=258,Ur=Yi+ee+1,S7=32,To=42,xb=57,ub=69,hb=73,db=91,pb=103,Kn=113,Tc=666,Et=1,Ro=2,es=3,Ao=4,E7=3,Jn=y((t,e)=>(t.msg=Qn[e],e),"err"),hN=y(t=>t*2-(t>4?9:0),"rank"),Ji=y(t=>{let e=t.length;for(;--e>=0;)t[e]=0},"zero"),F7=y(t=>{let e,r,i,n=t.w_size;e=t.hash_size,i=e;do r=t.head[--i],t.head[i]=r>=n?r-n:0;while(--e);e=n,i=e;do r=t.prev[--i],t.prev[i]=r>=n?r-n:0;while(--e)},"slide_hash"),k7=y((t,e,r)=>(e<<t.hash_shift^r)&t.hash_mask,"HASH_ZLIB"),en=k7,Ut=y(t=>{let e=t.state,r=e.pending;r>t.avail_out&&(r=t.avail_out),r!==0&&(t.output.set(e.pending_buf.subarray(e.pending_out,e.pending_out+r),t.next_out),t.next_out+=r,e.pending_out+=r,t.total_out+=r,t.avail_out-=r,e.pending-=r,e.pending===0&&(e.pending_out=0))},"flush_pending"),zt=y((t,e)=>{r7(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,Ut(t.strm)},"flush_block_only"),ce=y((t,e)=>{t.pending_buf[t.pending++]=e},"put_byte"),kc=y((t,e)=>{t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=e&255},"putShortMSB"),mb=y((t,e,r,i)=>{let n=t.avail_in;return n>i&&(n=i),n===0?0:(t.avail_in-=n,e.set(t.input.subarray(t.next_in,t.next_in+n),r),t.state.wrap===1?t.adler=Bc(t.adler,e,n,r):t.state.wrap===2&&(t.adler=Je(t.adler,e,n,r)),t.next_in+=n,t.total_in+=n,n)},"read_buf"),TD=y((t,e)=>{let r=t.max_chain_length,i=t.strstart,n,s,a=t.prev_length,l=t.nice_match,c=t.strstart>t.w_size-Ur?t.strstart-(t.w_size-Ur):0,o=t.window,f=t.w_mask,h=t.prev,d=t.strstart+Yi,p=o[i+a-1],m=o[i+a];t.prev_length>=t.good_match&&(r>>=2),l>t.lookahead&&(l=t.lookahead);do if(n=e,!(o[n+a]!==m||o[n+a-1]!==p||o[n]!==o[i]||o[++n]!==o[i+1])){i+=2,n++;do;while(o[++i]===o[++n]&&o[++i]===o[++n]&&o[++i]===o[++n]&&o[++i]===o[++n]&&o[++i]===o[++n]&&o[++i]===o[++n]&&o[++i]===o[++n]&&o[++i]===o[++n]&&i<d);if(s=Yi-(d-i),i=d-Yi,s>a){if(t.match_start=e,a=s,s>=l)break;p=o[i+a-1],m=o[i+a]}}while((e=h[e&f])>c&&--r!==0);return a<=t.lookahead?a:t.lookahead},"longest_match"),xo=y(t=>{let e=t.w_size,r,i,n;do{if(i=t.window_size-t.lookahead-t.strstart,t.strstart>=e+(e-Ur)&&(t.window.set(t.window.subarray(e,e+e-i),0),t.match_start-=e,t.strstart-=e,t.block_start-=e,t.insert>t.strstart&&(t.insert=t.strstart),F7(t),i+=e),t.strm.avail_in===0)break;if(r=mb(t.strm,t.window,t.strstart+t.lookahead,i),t.lookahead+=r,t.lookahead+t.insert>=ee)for(n=t.strstart-t.insert,t.ins_h=t.window[n],t.ins_h=en(t,t.ins_h,t.window[n+1]);t.insert&&(t.ins_h=en(t,t.ins_h,t.window[n+ee-1]),t.prev[n&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=n,n++,t.insert--,!(t.lookahead+t.insert<ee)););}while(t.lookahead<Ur&&t.strm.avail_in!==0)},"fill_window"),xD=y((t,e)=>{let r=t.pending_buf_size-5>t.w_size?t.w_size:t.pending_buf_size-5,i,n,s,a=0,l=t.strm.avail_in;do{if(i=65535,s=t.bi_valid+42>>3,t.strm.avail_out<s||(s=t.strm.avail_out-s,n=t.strstart-t.block_start,i>n+t.strm.avail_in&&(i=n+t.strm.avail_in),i>s&&(i=s),i<r&&(i===0&&e!==nr||e===Qi||i!==n+t.strm.avail_in)))break;a=e===nr&&i===n+t.strm.avail_in?1:0,cb(t,0,0,a),t.pending_buf[t.pending-4]=i,t.pending_buf[t.pending-3]=i>>8,t.pending_buf[t.pending-2]=~i,t.pending_buf[t.pending-1]=~i>>8,Ut(t.strm),n&&(n>i&&(n=i),t.strm.output.set(t.window.subarray(t.block_start,t.block_start+n),t.strm.next_out),t.strm.next_out+=n,t.strm.avail_out-=n,t.strm.total_out+=n,t.block_start+=n,i-=n),i&&(mb(t.strm,t.strm.output,t.strm.next_out,i),t.strm.next_out+=i,t.strm.avail_out-=i,t.strm.total_out+=i)}while(a===0);return l-=t.strm.avail_in,l&&(l>=t.w_size?(t.matches=2,t.window.set(t.strm.input.subarray(t.strm.next_in-t.w_size,t.strm.next_in),0),t.strstart=t.w_size,t.insert=t.strstart):(t.window_size-t.strstart<=l&&(t.strstart-=t.w_size,t.window.set(t.window.subarray(t.w_size,t.w_size+t.strstart),0),t.matches<2&&t.matches++,t.insert>t.strstart&&(t.insert=t.strstart)),t.window.set(t.strm.input.subarray(t.strm.next_in-l,t.strm.next_in),t.strstart),t.strstart+=l,t.insert+=l>t.w_size-t.insert?t.w_size-t.insert:l),t.block_start=t.strstart),t.high_water<t.strstart&&(t.high_water=t.strstart),a?Ao:e!==Qi&&e!==nr&&t.strm.avail_in===0&&t.strstart===t.block_start?Ro:(s=t.window_size-t.strstart,t.strm.avail_in>s&&t.block_start>=t.w_size&&(t.block_start-=t.w_size,t.strstart-=t.w_size,t.window.set(t.window.subarray(t.w_size,t.w_size+t.strstart),0),t.matches<2&&t.matches++,s+=t.w_size,t.insert>t.strstart&&(t.insert=t.strstart)),s>t.strm.avail_in&&(s=t.strm.avail_in),s&&(mb(t.strm,t.window,t.strstart,s),t.strstart+=s,t.insert+=s>t.w_size-t.insert?t.w_size-t.insert:s),t.high_water<t.strstart&&(t.high_water=t.strstart),s=t.bi_valid+42>>3,s=t.pending_buf_size-s>65535?65535:t.pending_buf_size-s,r=s>t.w_size?t.w_size:s,n=t.strstart-t.block_start,(n>=r||(n||e===nr)&&e!==Qi&&t.strm.avail_in===0&&n<=s)&&(i=n>s?s:n,a=e===nr&&t.strm.avail_in===0&&i===n?1:0,cb(t,t.block_start,i,a),t.block_start+=i,Ut(t.strm)),a?es:Et)},"deflate_stored"),J0=y((t,e)=>{let r,i;for(;;){if(t.lookahead<Ur){if(xo(t),t.lookahead<Ur&&e===Qi)return Et;if(t.lookahead===0)break}if(r=0,t.lookahead>=ee&&(t.ins_h=en(t,t.ins_h,t.window[t.strstart+ee-1]),r=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),r!==0&&t.strstart-r<=t.w_size-Ur&&(t.match_length=TD(t,r)),t.match_length>=ee)if(i=Xi(t,t.strstart-t.match_start,t.match_length-ee),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=ee){t.match_length--;do t.strstart++,t.ins_h=en(t,t.ins_h,t.window[t.strstart+ee-1]),r=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart;while(--t.match_length!==0);t.strstart++}else t.strstart+=t.match_length,t.match_length=0,t.ins_h=t.window[t.strstart],t.ins_h=en(t,t.ins_h,t.window[t.strstart+1]);else i=Xi(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++;if(i&&(zt(t,!1),t.strm.avail_out===0))return Et}return t.insert=t.strstart<ee-1?t.strstart:ee-1,e===nr?(zt(t,!0),t.strm.avail_out===0?es:Ao):t.sym_next&&(zt(t,!1),t.strm.avail_out===0)?Et:Ro},"deflate_fast"),oo=y((t,e)=>{let r,i,n;for(;;){if(t.lookahead<Ur){if(xo(t),t.lookahead<Ur&&e===Qi)return Et;if(t.lookahead===0)break}if(r=0,t.lookahead>=ee&&(t.ins_h=en(t,t.ins_h,t.window[t.strstart+ee-1]),r=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),t.prev_length=t.match_length,t.prev_match=t.match_start,t.match_length=ee-1,r!==0&&t.prev_length<t.max_lazy_match&&t.strstart-r<=t.w_size-Ur&&(t.match_length=TD(t,r),t.match_length<=5&&(t.strategy===l7||t.match_length===ee&&t.strstart-t.match_start>4096)&&(t.match_length=ee-1)),t.prev_length>=ee&&t.match_length<=t.prev_length){n=t.strstart+t.lookahead-ee,i=Xi(t,t.strstart-1-t.prev_match,t.prev_length-ee),t.lookahead-=t.prev_length-1,t.prev_length-=2;do++t.strstart<=n&&(t.ins_h=en(t,t.ins_h,t.window[t.strstart+ee-1]),r=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart);while(--t.prev_length!==0);if(t.match_available=0,t.match_length=ee-1,t.strstart++,i&&(zt(t,!1),t.strm.avail_out===0))return Et}else if(t.match_available){if(i=Xi(t,0,t.window[t.strstart-1]),i&&zt(t,!1),t.strstart++,t.lookahead--,t.strm.avail_out===0)return Et}else t.match_available=1,t.strstart++,t.lookahead--}return t.match_available&&(i=Xi(t,0,t.window[t.strstart-1]),t.match_available=0),t.insert=t.strstart<ee-1?t.strstart:ee-1,e===nr?(zt(t,!0),t.strm.avail_out===0?es:Ao):t.sym_next&&(zt(t,!1),t.strm.avail_out===0)?Et:Ro},"deflate_slow"),T7=y((t,e)=>{let r,i,n,s,a=t.window;for(;;){if(t.lookahead<=Yi){if(xo(t),t.lookahead<=Yi&&e===Qi)return Et;if(t.lookahead===0)break}if(t.match_length=0,t.lookahead>=ee&&t.strstart>0&&(n=t.strstart-1,i=a[n],i===a[++n]&&i===a[++n]&&i===a[++n])){s=t.strstart+Yi;do;while(i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&n<s);t.match_length=Yi-(s-n),t.match_length>t.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=ee?(r=Xi(t,1,t.match_length-ee),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(r=Xi(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),r&&(zt(t,!1),t.strm.avail_out===0))return Et}return t.insert=0,e===nr?(zt(t,!0),t.strm.avail_out===0?es:Ao):t.sym_next&&(zt(t,!1),t.strm.avail_out===0)?Et:Ro},"deflate_rle"),x7=y((t,e)=>{let r;for(;;){if(t.lookahead===0&&(xo(t),t.lookahead===0)){if(e===Qi)return Et;break}if(t.match_length=0,r=Xi(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,r&&(zt(t,!1),t.strm.avail_out===0))return Et}return t.insert=0,e===nr?(zt(t,!0),t.strm.avail_out===0?es:Ao):t.sym_next&&(zt(t,!1),t.strm.avail_out===0)?Et:Ro},"deflate_huff");function gr(t,e,r,i,n){this.good_length=t,this.max_lazy=e,this.nice_length=r,this.max_chain=i,this.func=n}u(gr,"ne");y(gr,"Config");var xc=[new gr(0,0,0,0,xD),new gr(4,4,8,4,J0),new gr(4,5,16,8,J0),new gr(4,6,32,32,J0),new gr(4,4,16,16,oo),new gr(8,16,32,32,oo),new gr(8,16,128,128,oo),new gr(8,32,128,256,oo),new gr(32,128,258,1024,oo),new gr(32,258,258,4096,oo)],O7=y(t=>{t.window_size=2*t.w_size,Ji(t.head),t.max_lazy_match=xc[t.level].max_lazy,t.good_match=xc[t.level].good_length,t.nice_match=xc[t.level].nice_length,t.max_chain_length=xc[t.level].max_chain,t.strstart=0,t.block_start=0,t.lookahead=0,t.insert=0,t.match_length=t.prev_length=ee-1,t.match_available=0,t.ins_h=0},"lm_init");function OD(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=Gd,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(_7*2),this.dyn_dtree=new Uint16Array((2*g7+1)*2),this.bl_tree=new Uint16Array((2*b7+1)*2),Ji(this.dyn_ltree),Ji(this.dyn_dtree),Ji(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(v7+1),this.heap=new Uint16Array(2*fb+1),Ji(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(2*fb+1),Ji(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}u(OD,"gs");y(OD,"DeflateState");var zc=y(t=>{if(!t)return 1;let e=t.state;return!e||e.strm!==t||e.status!==To&&e.status!==xb&&e.status!==ub&&e.status!==hb&&e.status!==db&&e.status!==pb&&e.status!==Kn&&e.status!==Tc?1:0},"deflateStateCheck"),RD=y(t=>{if(zc(t))return Jn(t,qr);t.total_in=t.total_out=0,t.data_type=h7;let e=t.state;return e.pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=e.wrap===2?xb:e.wrap?To:Kn,t.adler=e.wrap===2?0:1,e.last_flush=-2,t7(e),it},"deflateResetKeep"),AD=y(t=>{let e=RD(t);return e===it&&O7(t.state),e},"deflateReset"),R7=y((t,e)=>zc(t)||t.state.wrap!==2?qr:(t.state.gzhead=e,it),"deflateSetHeader"),PD=y((t,e,r,i,n,s)=>{if(!t)return qr;let a=1;if(e===o7&&(e=6),i<0?(a=0,i=-i):i>15&&(a=2,i-=16),n<1||n>d7||r!==Gd||i<8||i>15||e<0||e>9||s<0||s>f7||i===8&&a!==1)return Jn(t,qr);i===8&&(i=9);let l=new OD;return t.state=l,l.strm=t,l.status=To,l.wrap=a,l.gzhead=null,l.w_bits=i,l.w_size=1<<l.w_bits,l.w_mask=l.w_size-1,l.hash_bits=n+7,l.hash_size=1<<l.hash_bits,l.hash_mask=l.hash_size-1,l.hash_shift=~~((l.hash_bits+ee-1)/ee),l.window=new Uint8Array(l.w_size*2),l.head=new Uint16Array(l.hash_size),l.prev=new Uint16Array(l.w_size),l.lit_bufsize=1<<n+6,l.pending_buf_size=l.lit_bufsize*4,l.pending_buf=new Uint8Array(l.pending_buf_size),l.sym_buf=l.lit_bufsize,l.sym_end=(l.lit_bufsize-1)*3,l.level=e,l.strategy=s,l.method=r,AD(t)},"deflateInit2"),A7=y((t,e)=>PD(t,e,Gd,p7,m7,u7),"deflateInit"),P7=y((t,e)=>{if(zc(t)||e>fN||e<0)return t?Jn(t,qr):qr;let r=t.state;if(!t.output||t.avail_in!==0&&!t.input||r.status===Tc&&e!==nr)return Jn(t,t.avail_out===0?K0:qr);let i=r.last_flush;if(r.last_flush=e,r.pending!==0){if(Ut(t),t.avail_out===0)return r.last_flush=-1,it}else if(t.avail_in===0&&hN(e)<=hN(i)&&e!==nr)return Jn(t,K0);if(r.status===Tc&&t.avail_in!==0)return Jn(t,K0);if(r.status===To&&r.wrap===0&&(r.status=Kn),r.status===To){let n=Gd+(r.w_bits-8<<4)<<8,s=-1;if(r.strategy>=Td||r.level<2?s=0:r.level<6?s=1:r.level===6?s=2:s=3,n|=s<<6,r.strstart!==0&&(n|=S7),n+=31-n%31,kc(r,n),r.strstart!==0&&(kc(r,t.adler>>>16),kc(r,t.adler&65535)),t.adler=1,r.status=Kn,Ut(t),r.pending!==0)return r.last_flush=-1,it}if(r.status===xb){if(t.adler=0,ce(r,31),ce(r,139),ce(r,8),r.gzhead)ce(r,(r.gzhead.text?1:0)+(r.gzhead.hcrc?2:0)+(r.gzhead.extra?4:0)+(r.gzhead.name?8:0)+(r.gzhead.comment?16:0)),ce(r,r.gzhead.time&255),ce(r,r.gzhead.time>>8&255),ce(r,r.gzhead.time>>16&255),ce(r,r.gzhead.time>>24&255),ce(r,r.level===9?2:r.strategy>=Td||r.level<2?4:0),ce(r,r.gzhead.os&255),r.gzhead.extra&&r.gzhead.extra.length&&(ce(r,r.gzhead.extra.length&255),ce(r,r.gzhead.extra.length>>8&255)),r.gzhead.hcrc&&(t.adler=Je(t.adler,r.pending_buf,r.pending,0)),r.gzindex=0,r.status=ub;else if(ce(r,0),ce(r,0),ce(r,0),ce(r,0),ce(r,0),ce(r,r.level===9?2:r.strategy>=Td||r.level<2?4:0),ce(r,E7),r.status=Kn,Ut(t),r.pending!==0)return r.last_flush=-1,it}if(r.status===ub){if(r.gzhead.extra){let n=r.pending,s=(r.gzhead.extra.length&65535)-r.gzindex;for(;r.pending+s>r.pending_buf_size;){let l=r.pending_buf_size-r.pending;if(r.pending_buf.set(r.gzhead.extra.subarray(r.gzindex,r.gzindex+l),r.pending),r.pending=r.pending_buf_size,r.gzhead.hcrc&&r.pending>n&&(t.adler=Je(t.adler,r.pending_buf,r.pending-n,n)),r.gzindex+=l,Ut(t),r.pending!==0)return r.last_flush=-1,it;n=0,s-=l}let a=new Uint8Array(r.gzhead.extra);r.pending_buf.set(a.subarray(r.gzindex,r.gzindex+s),r.pending),r.pending+=s,r.gzhead.hcrc&&r.pending>n&&(t.adler=Je(t.adler,r.pending_buf,r.pending-n,n)),r.gzindex=0}r.status=hb}if(r.status===hb){if(r.gzhead.name){let n=r.pending,s;do{if(r.pending===r.pending_buf_size){if(r.gzhead.hcrc&&r.pending>n&&(t.adler=Je(t.adler,r.pending_buf,r.pending-n,n)),Ut(t),r.pending!==0)return r.last_flush=-1,it;n=0}r.gzindex<r.gzhead.name.length?s=r.gzhead.name.charCodeAt(r.gzindex++)&255:s=0,ce(r,s)}while(s!==0);r.gzhead.hcrc&&r.pending>n&&(t.adler=Je(t.adler,r.pending_buf,r.pending-n,n)),r.gzindex=0}r.status=db}if(r.status===db){if(r.gzhead.comment){let n=r.pending,s;do{if(r.pending===r.pending_buf_size){if(r.gzhead.hcrc&&r.pending>n&&(t.adler=Je(t.adler,r.pending_buf,r.pending-n,n)),Ut(t),r.pending!==0)return r.last_flush=-1,it;n=0}r.gzindex<r.gzhead.comment.length?s=r.gzhead.comment.charCodeAt(r.gzindex++)&255:s=0,ce(r,s)}while(s!==0);r.gzhead.hcrc&&r.pending>n&&(t.adler=Je(t.adler,r.pending_buf,r.pending-n,n))}r.status=pb}if(r.status===pb){if(r.gzhead.hcrc){if(r.pending+2>r.pending_buf_size&&(Ut(t),r.pending!==0))return r.last_flush=-1,it;ce(r,t.adler&255),ce(r,t.adler>>8&255),t.adler=0}if(r.status=Kn,Ut(t),r.pending!==0)return r.last_flush=-1,it}if(t.avail_in!==0||r.lookahead!==0||e!==Qi&&r.status!==Tc){let n=r.level===0?xD(r,e):r.strategy===Td?x7(r,e):r.strategy===c7?T7(r,e):xc[r.level].func(r,e);if((n===es||n===Ao)&&(r.status=Tc),n===Et||n===es)return t.avail_out===0&&(r.last_flush=-1),it;if(n===Ro&&(e===n7?i7(r):e!==fN&&(cb(r,0,0,!1),e===s7&&(Ji(r.head),r.lookahead===0&&(r.strstart=0,r.block_start=0,r.insert=0))),Ut(t),t.avail_out===0))return r.last_flush=-1,it}return e!==nr?it:r.wrap<=0?uN:(r.wrap===2?(ce(r,t.adler&255),ce(r,t.adler>>8&255),ce(r,t.adler>>16&255),ce(r,t.adler>>24&255),ce(r,t.total_in&255),ce(r,t.total_in>>8&255),ce(r,t.total_in>>16&255),ce(r,t.total_in>>24&255)):(kc(r,t.adler>>>16),kc(r,t.adler&65535)),Ut(t),r.wrap>0&&(r.wrap=-r.wrap),r.pending!==0?it:uN)},"deflate$2"),N7=y(t=>{if(zc(t))return qr;let e=t.state.status;return t.state=null,e===Kn?Jn(t,a7):it},"deflateEnd"),D7=y((t,e)=>{let r=e.length;if(zc(t))return qr;let i=t.state,n=i.wrap;if(n===2||n===1&&i.status!==To||i.lookahead)return qr;if(n===1&&(t.adler=Bc(t.adler,e,r,0)),i.wrap=0,r>=i.w_size){n===0&&(Ji(i.head),i.strstart=0,i.block_start=0,i.insert=0);let c=new Uint8Array(i.w_size);c.set(e.subarray(r-i.w_size,r),0),e=c,r=i.w_size}let s=t.avail_in,a=t.next_in,l=t.input;for(t.avail_in=r,t.next_in=0,t.input=e,xo(i);i.lookahead>=ee;){let c=i.strstart,o=i.lookahead-(ee-1);do i.ins_h=en(i,i.ins_h,i.window[c+ee-1]),i.prev[c&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=c,c++;while(--o);i.strstart=c,i.lookahead=ee-1,xo(i)}return i.strstart+=i.lookahead,i.block_start=i.strstart,i.insert=i.lookahead,i.lookahead=0,i.match_length=i.prev_length=ee-1,i.match_available=0,t.next_in=a,t.input=l,t.avail_in=s,i.wrap=n,it},"deflateSetDictionary"),C7=A7,I7=PD,$7=AD,B7=RD,L7=R7,M7=P7,j7=N7,q7=D7,U7="pako deflate (from Nodeca project)",Rc={deflateInit:C7,deflateInit2:I7,deflateReset:$7,deflateResetKeep:B7,deflateSetHeader:L7,deflate:M7,deflateEnd:j7,deflateSetDictionary:q7,deflateInfo:U7},z7=y((t,e)=>Object.prototype.hasOwnProperty.call(t,e),"_has"),W7=y(function(t){let e=Array.prototype.slice.call(arguments,1);for(;e.length;){let r=e.shift();if(r){if(typeof r!="object")throw new TypeError(r+"must be non-object");for(let i in r)z7(r,i)&&(t[i]=r[i])}}return t},"assign"),H7=y(t=>{let e=0;for(let i=0,n=t.length;i<n;i++)e+=t[i].length;let r=new Uint8Array(e);for(let i=0,n=0,s=t.length;i<s;i++){let a=t[i];r.set(a,n),n+=a.length}return r},"flattenChunks"),Zd={assign:W7,flattenChunks:H7},ND=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{ND=!1}var Lc=new Uint8Array(256);for(let t=0;t<256;t++)Lc[t]=t>=252?6:t>=248?5:t>=240?4:t>=224?3:t>=192?2:1;Lc[254]=Lc[254]=1;var V7=y(t=>{if(typeof TextEncoder=="function"&&TextEncoder.prototype.encode)return new TextEncoder().encode(t);let e,r,i,n,s,a=t.length,l=0;for(n=0;n<a;n++)r=t.charCodeAt(n),(r&64512)===55296&&n+1<a&&(i=t.charCodeAt(n+1),(i&64512)===56320&&(r=65536+(r-55296<<10)+(i-56320),n++)),l+=r<128?1:r<2048?2:r<65536?3:4;for(e=new Uint8Array(l),s=0,n=0;s<l;n++)r=t.charCodeAt(n),(r&64512)===55296&&n+1<a&&(i=t.charCodeAt(n+1),(i&64512)===56320&&(r=65536+(r-55296<<10)+(i-56320),n++)),r<128?e[s++]=r:r<2048?(e[s++]=192|r>>>6,e[s++]=128|r&63):r<65536?(e[s++]=224|r>>>12,e[s++]=128|r>>>6&63,e[s++]=128|r&63):(e[s++]=240|r>>>18,e[s++]=128|r>>>12&63,e[s++]=128|r>>>6&63,e[s++]=128|r&63);return e},"string2buf"),G7=y((t,e)=>{if(e<65534&&t.subarray&&ND)return String.fromCharCode.apply(null,t.length===e?t:t.subarray(0,e));let r="";for(let i=0;i<e;i++)r+=String.fromCharCode(t[i]);return r},"buf2binstring"),Z7=y((t,e)=>{let r=e||t.length;if(typeof TextDecoder=="function"&&TextDecoder.prototype.decode)return new TextDecoder().decode(t.subarray(0,e));let i,n,s=new Array(r*2);for(n=0,i=0;i<r;){let a=t[i++];if(a<128){s[n++]=a;continue}let l=Lc[a];if(l>4){s[n++]=65533,i+=l-1;continue}for(a&=l===2?31:l===3?15:7;l>1&&i<r;)a=a<<6|t[i++]&63,l--;if(l>1){s[n++]=65533;continue}a<65536?s[n++]=a:(a-=65536,s[n++]=55296|a>>10&1023,s[n++]=56320|a&1023)}return G7(s,n)},"buf2string"),K7=y((t,e)=>{e=e||t.length,e>t.length&&(e=t.length);let r=e-1;for(;r>=0&&(t[r]&192)===128;)r--;return r<0||r===0?e:r+Lc[t[r]]>e?r:e},"utf8border"),Mc={string2buf:V7,buf2string:Z7,utf8border:K7};function DD(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}u(DD,"Us");y(DD,"ZStream");var CD=DD,ID=Object.prototype.toString,{Z_NO_FLUSH:J7,Z_SYNC_FLUSH:Y7,Z_FULL_FLUSH:X7,Z_FINISH:Q7,Z_OK:jd,Z_STREAM_END:e9,Z_DEFAULT_COMPRESSION:t9,Z_DEFAULT_STRATEGY:r9,Z_DEFLATED:i9}=Oo;function Po(t){this.options=Zd.assign({level:t9,method:i9,chunkSize:16384,windowBits:15,memLevel:8,strategy:r9},t||{});let e=this.options;e.raw&&e.windowBits>0?e.windowBits=-e.windowBits:e.gzip&&e.windowBits>0&&e.windowBits<16&&(e.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new CD,this.strm.avail_out=0;let r=Rc.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(r!==jd)throw new Error(Qn[r]);if(e.header&&Rc.deflateSetHeader(this.strm,e.header),e.dictionary){let i;if(typeof e.dictionary=="string"?i=Mc.string2buf(e.dictionary):ID.call(e.dictionary)==="[object ArrayBuffer]"?i=new Uint8Array(e.dictionary):i=e.dictionary,r=Rc.deflateSetDictionary(this.strm,i),r!==jd)throw new Error(Qn[r]);this._dict_set=!0}}u(Po,"_t");y(Po,"Deflate$1");Po.prototype.push=function(t,e){let r=this.strm,i=this.options.chunkSize,n,s;if(this.ended)return!1;for(e===~~e?s=e:s=e===!0?Q7:J7,typeof t=="string"?r.input=Mc.string2buf(t):ID.call(t)==="[object ArrayBuffer]"?r.input=new Uint8Array(t):r.input=t,r.next_in=0,r.avail_in=r.input.length;;){if(r.avail_out===0&&(r.output=new Uint8Array(i),r.next_out=0,r.avail_out=i),(s===Y7||s===X7)&&r.avail_out<=6){this.onData(r.output.subarray(0,r.next_out)),r.avail_out=0;continue}if(n=Rc.deflate(r,s),n===e9)return r.next_out>0&&this.onData(r.output.subarray(0,r.next_out)),n=Rc.deflateEnd(this.strm),this.onEnd(n),this.ended=!0,n===jd;if(r.avail_out===0){this.onData(r.output);continue}if(s>0&&r.next_out>0){this.onData(r.output.subarray(0,r.next_out)),r.avail_out=0;continue}if(r.avail_in===0)break}return!0};Po.prototype.onData=function(t){this.chunks.push(t)};Po.prototype.onEnd=function(t){t===jd&&(this.result=Zd.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};function Kd(t,e){let r=new Po(e);if(r.push(t,!0),r.err)throw r.msg||Qn[r.err];return r.result}u(Kd,"zi");y(Kd,"deflate$1");function $D(t,e){return e=e||{},e.raw=!0,Kd(t,e)}u($D,"Js");y($D,"deflateRaw$1");function BD(t,e){return e=e||{},e.gzip=!0,Kd(t,e)}u(BD,"qs");y(BD,"gzip$1");var n9=Po,s9=Kd,a9=$D,o9=BD,l9=Oo,c9={Deflate:n9,deflate:s9,deflateRaw:a9,gzip:o9,constants:l9},xd=16209,f9=16191,u9=y(function(t,e){let r,i,n,s,a,l,c,o,f,h,d,p,m,w,g,b,_,S,F,k,A,v,T,E,R=t.state;r=t.next_in,T=t.input,i=r+(t.avail_in-5),n=t.next_out,E=t.output,s=n-(e-t.avail_out),a=n+(t.avail_out-257),l=R.dmax,c=R.wsize,o=R.whave,f=R.wnext,h=R.window,d=R.hold,p=R.bits,m=R.lencode,w=R.distcode,g=(1<<R.lenbits)-1,b=(1<<R.distbits)-1;e:do{p<15&&(d+=T[r++]<<p,p+=8,d+=T[r++]<<p,p+=8),_=m[d&g];t:for(;;){if(S=_>>>24,d>>>=S,p-=S,S=_>>>16&255,S===0)E[n++]=_&65535;else if(S&16){F=_&65535,S&=15,S&&(p<S&&(d+=T[r++]<<p,p+=8),F+=d&(1<<S)-1,d>>>=S,p-=S),p<15&&(d+=T[r++]<<p,p+=8,d+=T[r++]<<p,p+=8),_=w[d&b];r:for(;;){if(S=_>>>24,d>>>=S,p-=S,S=_>>>16&255,S&16){if(k=_&65535,S&=15,p<S&&(d+=T[r++]<<p,p+=8,p<S&&(d+=T[r++]<<p,p+=8)),k+=d&(1<<S)-1,k>l){t.msg="invalid distance too far back",R.mode=xd;break e}if(d>>>=S,p-=S,S=n-s,k>S){if(S=k-S,S>o&&R.sane){t.msg="invalid distance too far back",R.mode=xd;break e}if(A=0,v=h,f===0){if(A+=c-S,S<F){F-=S;do E[n++]=h[A++];while(--S);A=n-k,v=E}}else if(f<S){if(A+=c+f-S,S-=f,S<F){F-=S;do E[n++]=h[A++];while(--S);if(A=0,f<F){S=f,F-=S;do E[n++]=h[A++];while(--S);A=n-k,v=E}}}else if(A+=f-S,S<F){F-=S;do E[n++]=h[A++];while(--S);A=n-k,v=E}for(;F>2;)E[n++]=v[A++],E[n++]=v[A++],E[n++]=v[A++],F-=3;F&&(E[n++]=v[A++],F>1&&(E[n++]=v[A++]))}else{A=n-k;do E[n++]=E[A++],E[n++]=E[A++],E[n++]=E[A++],F-=3;while(F>2);F&&(E[n++]=E[A++],F>1&&(E[n++]=E[A++]))}}else if(S&64){t.msg="invalid distance code",R.mode=xd;break e}else{_=w[(_&65535)+(d&(1<<S)-1)];continue r}break}}else if(S&64)if(S&32){R.mode=f9;break e}else{t.msg="invalid literal/length code",R.mode=xd;break e}else{_=m[(_&65535)+(d&(1<<S)-1)];continue t}break}}while(r<i&&n<a);F=p>>3,r-=F,p-=F<<3,d&=(1<<p)-1,t.next_in=r,t.next_out=n,t.avail_in=r<i?5+(i-r):5-(r-i),t.avail_out=n<a?257+(a-n):257-(n-a),R.hold=d,R.bits=p},"inflate_fast"),lo=15,dN=852,pN=592,mN=0,Y0=1,wN=2,h9=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0]),d9=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78]),p9=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0]),m9=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]),w9=y((t,e,r,i,n,s,a,l)=>{let c=l.bits,o=0,f=0,h=0,d=0,p=0,m=0,w=0,g=0,b=0,_=0,S,F,k,A,v,T=null,E,R=new Uint16Array(lo+1),P=new Uint16Array(lo+1),I=null,B,z,we;for(o=0;o<=lo;o++)R[o]=0;for(f=0;f<i;f++)R[e[r+f]]++;for(p=c,d=lo;d>=1&&R[d]===0;d--);if(p>d&&(p=d),d===0)return n[s++]=1<<24|64<<16|0,n[s++]=1<<24|64<<16|0,l.bits=1,0;for(h=1;h<d&&R[h]===0;h++);for(p<h&&(p=h),g=1,o=1;o<=lo;o++)if(g<<=1,g-=R[o],g<0)return-1;if(g>0&&(t===mN||d!==1))return-1;for(P[1]=0,o=1;o<lo;o++)P[o+1]=P[o]+R[o];for(f=0;f<i;f++)e[r+f]!==0&&(a[P[e[r+f]]++]=f);if(t===mN?(T=I=a,E=20):t===Y0?(T=h9,I=d9,E=257):(T=p9,I=m9,E=0),_=0,f=0,o=h,v=s,m=p,w=0,k=-1,b=1<<p,A=b-1,t===Y0&&b>dN||t===wN&&b>pN)return 1;for(;;){B=o-w,a[f]+1<E?(z=0,we=a[f]):a[f]>=E?(z=I[a[f]-E],we=T[a[f]-E]):(z=96,we=0),S=1<<o-w,F=1<<m,h=F;do F-=S,n[v+(_>>w)+F]=B<<24|z<<16|we|0;while(F!==0);for(S=1<<o-1;_&S;)S>>=1;if(S!==0?(_&=S-1,_+=S):_=0,f++,--R[o]===0){if(o===d)break;o=e[r+a[f]]}if(o>p&&(_&A)!==k){for(w===0&&(w=p),v+=h,m=o-w,g=1<<m;m+w<d&&(g-=R[m+w],!(g<=0));)m++,g<<=1;if(b+=1<<m,t===Y0&&b>dN||t===wN&&b>pN)return 1;k=_&A,n[k]=p<<24|m<<16|v-s|0}}return _!==0&&(n[v+_]=o-w<<24|64<<16|0),l.bits=p,0},"inflate_table"),Ac=w9,y9=0,LD=1,MD=2,{Z_FINISH:yN,Z_BLOCK:g9,Z_TREES:Od,Z_OK:ts,Z_STREAM_END:b9,Z_NEED_DICT:_9,Z_STREAM_ERROR:_r,Z_DATA_ERROR:jD,Z_MEM_ERROR:qD,Z_BUF_ERROR:v9,Z_DEFLATED:gN}=Oo,Jd=16180,bN=16181,_N=16182,vN=16183,SN=16184,EN=16185,FN=16186,kN=16187,TN=16188,xN=16189,qd=16190,fi=16191,X0=16192,ON=16193,Q0=16194,RN=16195,AN=16196,PN=16197,NN=16198,Rd=16199,Ad=16200,DN=16201,CN=16202,IN=16203,$N=16204,BN=16205,eb=16206,LN=16207,MN=16208,Fe=16209,UD=16210,zD=16211,S9=852,E9=592,F9=15,k9=F9,jN=y(t=>(t>>>24&255)+(t>>>8&65280)+((t&65280)<<8)+((t&255)<<24),"zswap32");function WD(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}u(WD,"vo");y(WD,"InflateState");var ns=y(t=>{if(!t)return 1;let e=t.state;return!e||e.strm!==t||e.mode<Jd||e.mode>zD?1:0},"inflateStateCheck"),HD=y(t=>{if(ns(t))return _r;let e=t.state;return t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=e.wrap&1),e.mode=Jd,e.last=0,e.havedict=0,e.flags=-1,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new Int32Array(S9),e.distcode=e.distdyn=new Int32Array(E9),e.sane=1,e.back=-1,ts},"inflateResetKeep"),VD=y(t=>{if(ns(t))return _r;let e=t.state;return e.wsize=0,e.whave=0,e.wnext=0,HD(t)},"inflateReset"),GD=y((t,e)=>{let r;if(ns(t))return _r;let i=t.state;return e<0?(r=0,e=-e):(r=(e>>4)+5,e<48&&(e&=15)),e&&(e<8||e>15)?_r:(i.window!==null&&i.wbits!==e&&(i.window=null),i.wrap=r,i.wbits=e,VD(t))},"inflateReset2"),ZD=y((t,e)=>{if(!t)return _r;let r=new WD;t.state=r,r.strm=t,r.window=null,r.mode=Jd;let i=GD(t,e);return i!==ts&&(t.state=null),i},"inflateInit2"),T9=y(t=>ZD(t,k9),"inflateInit"),qN=!0,tb,rb,x9=y(t=>{if(qN){tb=new Int32Array(512),rb=new Int32Array(32);let e=0;for(;e<144;)t.lens[e++]=8;for(;e<256;)t.lens[e++]=9;for(;e<280;)t.lens[e++]=7;for(;e<288;)t.lens[e++]=8;for(Ac(LD,t.lens,0,288,tb,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;Ac(MD,t.lens,0,32,rb,0,t.work,{bits:5}),qN=!1}t.lencode=tb,t.lenbits=9,t.distcode=rb,t.distbits=5},"fixedtables"),KD=y((t,e,r,i)=>{let n,s=t.state;return s.window===null&&(s.wsize=1<<s.wbits,s.wnext=0,s.whave=0,s.window=new Uint8Array(s.wsize)),i>=s.wsize?(s.window.set(e.subarray(r-s.wsize,r),0),s.wnext=0,s.whave=s.wsize):(n=s.wsize-s.wnext,n>i&&(n=i),s.window.set(e.subarray(r-i,r-i+n),s.wnext),i-=n,i?(s.window.set(e.subarray(r-i,r),0),s.wnext=i,s.whave=s.wsize):(s.wnext+=n,s.wnext===s.wsize&&(s.wnext=0),s.whave<s.wsize&&(s.whave+=n))),0},"updatewindow"),O9=y((t,e)=>{let r,i,n,s,a,l,c,o,f,h,d,p,m,w,g=0,b,_,S,F,k,A,v,T,E=new Uint8Array(4),R,P,I=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(ns(t)||!t.output||!t.input&&t.avail_in!==0)return _r;r=t.state,r.mode===fi&&(r.mode=X0),a=t.next_out,n=t.output,c=t.avail_out,s=t.next_in,i=t.input,l=t.avail_in,o=r.hold,f=r.bits,h=l,d=c,T=ts;e:for(;;)switch(r.mode){case Jd:if(r.wrap===0){r.mode=X0;break}for(;f<16;){if(l===0)break e;l--,o+=i[s++]<<f,f+=8}if(r.wrap&2&&o===35615){r.wbits===0&&(r.wbits=15),r.check=0,E[0]=o&255,E[1]=o>>>8&255,r.check=Je(r.check,E,2,0),o=0,f=0,r.mode=bN;break}if(r.head&&(r.head.done=!1),!(r.wrap&1)||(((o&255)<<8)+(o>>8))%31){t.msg="incorrect header check",r.mode=Fe;break}if((o&15)!==gN){t.msg="unknown compression method",r.mode=Fe;break}if(o>>>=4,f-=4,v=(o&15)+8,r.wbits===0&&(r.wbits=v),v>15||v>r.wbits){t.msg="invalid window size",r.mode=Fe;break}r.dmax=1<<r.wbits,r.flags=0,t.adler=r.check=1,r.mode=o&512?xN:fi,o=0,f=0;break;case bN:for(;f<16;){if(l===0)break e;l--,o+=i[s++]<<f,f+=8}if(r.flags=o,(r.flags&255)!==gN){t.msg="unknown compression method",r.mode=Fe;break}if(r.flags&57344){t.msg="unknown header flags set",r.mode=Fe;break}r.head&&(r.head.text=o>>8&1),r.flags&512&&r.wrap&4&&(E[0]=o&255,E[1]=o>>>8&255,r.check=Je(r.check,E,2,0)),o=0,f=0,r.mode=_N;case _N:for(;f<32;){if(l===0)break e;l--,o+=i[s++]<<f,f+=8}r.head&&(r.head.time=o),r.flags&512&&r.wrap&4&&(E[0]=o&255,E[1]=o>>>8&255,E[2]=o>>>16&255,E[3]=o>>>24&255,r.check=Je(r.check,E,4,0)),o=0,f=0,r.mode=vN;case vN:for(;f<16;){if(l===0)break e;l--,o+=i[s++]<<f,f+=8}r.head&&(r.head.xflags=o&255,r.head.os=o>>8),r.flags&512&&r.wrap&4&&(E[0]=o&255,E[1]=o>>>8&255,r.check=Je(r.check,E,2,0)),o=0,f=0,r.mode=SN;case SN:if(r.flags&1024){for(;f<16;){if(l===0)break e;l--,o+=i[s++]<<f,f+=8}r.length=o,r.head&&(r.head.extra_len=o),r.flags&512&&r.wrap&4&&(E[0]=o&255,E[1]=o>>>8&255,r.check=Je(r.check,E,2,0)),o=0,f=0}else r.head&&(r.head.extra=null);r.mode=EN;case EN:if(r.flags&1024&&(p=r.length,p>l&&(p=l),p&&(r.head&&(v=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Uint8Array(r.head.extra_len)),r.head.extra.set(i.subarray(s,s+p),v)),r.flags&512&&r.wrap&4&&(r.check=Je(r.check,i,p,s)),l-=p,s+=p,r.length-=p),r.length))break e;r.length=0,r.mode=FN;case FN:if(r.flags&2048){if(l===0)break e;p=0;do v=i[s+p++],r.head&&v&&r.length<65536&&(r.head.name+=String.fromCharCode(v));while(v&&p<l);if(r.flags&512&&r.wrap&4&&(r.check=Je(r.check,i,p,s)),l-=p,s+=p,v)break e}else r.head&&(r.head.name=null);r.length=0,r.mode=kN;case kN:if(r.flags&4096){if(l===0)break e;p=0;do v=i[s+p++],r.head&&v&&r.length<65536&&(r.head.comment+=String.fromCharCode(v));while(v&&p<l);if(r.flags&512&&r.wrap&4&&(r.check=Je(r.check,i,p,s)),l-=p,s+=p,v)break e}else r.head&&(r.head.comment=null);r.mode=TN;case TN:if(r.flags&512){for(;f<16;){if(l===0)break e;l--,o+=i[s++]<<f,f+=8}if(r.wrap&4&&o!==(r.check&65535)){t.msg="header crc mismatch",r.mode=Fe;break}o=0,f=0}r.head&&(r.head.hcrc=r.flags>>9&1,r.head.done=!0),t.adler=r.check=0,r.mode=fi;break;case xN:for(;f<32;){if(l===0)break e;l--,o+=i[s++]<<f,f+=8}t.adler=r.check=jN(o),o=0,f=0,r.mode=qd;case qd:if(r.havedict===0)return t.next_out=a,t.avail_out=c,t.next_in=s,t.avail_in=l,r.hold=o,r.bits=f,_9;t.adler=r.check=1,r.mode=fi;case fi:if(e===g9||e===Od)break e;case X0:if(r.last){o>>>=f&7,f-=f&7,r.mode=eb;break}for(;f<3;){if(l===0)break e;l--,o+=i[s++]<<f,f+=8}switch(r.last=o&1,o>>>=1,f-=1,o&3){case 0:r.mode=ON;break;case 1:if(x9(r),r.mode=Rd,e===Od){o>>>=2,f-=2;break e}break;case 2:r.mode=AN;break;case 3:t.msg="invalid block type",r.mode=Fe}o>>>=2,f-=2;break;case ON:for(o>>>=f&7,f-=f&7;f<32;){if(l===0)break e;l--,o+=i[s++]<<f,f+=8}if((o&65535)!==(o>>>16^65535)){t.msg="invalid stored block lengths",r.mode=Fe;break}if(r.length=o&65535,o=0,f=0,r.mode=Q0,e===Od)break e;case Q0:r.mode=RN;case RN:if(p=r.length,p){if(p>l&&(p=l),p>c&&(p=c),p===0)break e;n.set(i.subarray(s,s+p),a),l-=p,s+=p,c-=p,a+=p,r.length-=p;break}r.mode=fi;break;case AN:for(;f<14;){if(l===0)break e;l--,o+=i[s++]<<f,f+=8}if(r.nlen=(o&31)+257,o>>>=5,f-=5,r.ndist=(o&31)+1,o>>>=5,f-=5,r.ncode=(o&15)+4,o>>>=4,f-=4,r.nlen>286||r.ndist>30){t.msg="too many length or distance symbols",r.mode=Fe;break}r.have=0,r.mode=PN;case PN:for(;r.have<r.ncode;){for(;f<3;){if(l===0)break e;l--,o+=i[s++]<<f,f+=8}r.lens[I[r.have++]]=o&7,o>>>=3,f-=3}for(;r.have<19;)r.lens[I[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,R={bits:r.lenbits},T=Ac(y9,r.lens,0,19,r.lencode,0,r.work,R),r.lenbits=R.bits,T){t.msg="invalid code lengths set",r.mode=Fe;break}r.have=0,r.mode=NN;case NN:for(;r.have<r.nlen+r.ndist;){for(;g=r.lencode[o&(1<<r.lenbits)-1],b=g>>>24,_=g>>>16&255,S=g&65535,!(b<=f);){if(l===0)break e;l--,o+=i[s++]<<f,f+=8}if(S<16)o>>>=b,f-=b,r.lens[r.have++]=S;else{if(S===16){for(P=b+2;f<P;){if(l===0)break e;l--,o+=i[s++]<<f,f+=8}if(o>>>=b,f-=b,r.have===0){t.msg="invalid bit length repeat",r.mode=Fe;break}v=r.lens[r.have-1],p=3+(o&3),o>>>=2,f-=2}else if(S===17){for(P=b+3;f<P;){if(l===0)break e;l--,o+=i[s++]<<f,f+=8}o>>>=b,f-=b,v=0,p=3+(o&7),o>>>=3,f-=3}else{for(P=b+7;f<P;){if(l===0)break e;l--,o+=i[s++]<<f,f+=8}o>>>=b,f-=b,v=0,p=11+(o&127),o>>>=7,f-=7}if(r.have+p>r.nlen+r.ndist){t.msg="invalid bit length repeat",r.mode=Fe;break}for(;p--;)r.lens[r.have++]=v}}if(r.mode===Fe)break;if(r.lens[256]===0){t.msg="invalid code -- missing end-of-block",r.mode=Fe;break}if(r.lenbits=9,R={bits:r.lenbits},T=Ac(LD,r.lens,0,r.nlen,r.lencode,0,r.work,R),r.lenbits=R.bits,T){t.msg="invalid literal/lengths set",r.mode=Fe;break}if(r.distbits=6,r.distcode=r.distdyn,R={bits:r.distbits},T=Ac(MD,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,R),r.distbits=R.bits,T){t.msg="invalid distances set",r.mode=Fe;break}if(r.mode=Rd,e===Od)break e;case Rd:r.mode=Ad;case Ad:if(l>=6&&c>=258){t.next_out=a,t.avail_out=c,t.next_in=s,t.avail_in=l,r.hold=o,r.bits=f,u9(t,d),a=t.next_out,n=t.output,c=t.avail_out,s=t.next_in,i=t.input,l=t.avail_in,o=r.hold,f=r.bits,r.mode===fi&&(r.back=-1);break}for(r.back=0;g=r.lencode[o&(1<<r.lenbits)-1],b=g>>>24,_=g>>>16&255,S=g&65535,!(b<=f);){if(l===0)break e;l--,o+=i[s++]<<f,f+=8}if(_&&!(_&240)){for(F=b,k=_,A=S;g=r.lencode[A+((o&(1<<F+k)-1)>>F)],b=g>>>24,_=g>>>16&255,S=g&65535,!(F+b<=f);){if(l===0)break e;l--,o+=i[s++]<<f,f+=8}o>>>=F,f-=F,r.back+=F}if(o>>>=b,f-=b,r.back+=b,r.length=S,_===0){r.mode=BN;break}if(_&32){r.back=-1,r.mode=fi;break}if(_&64){t.msg="invalid literal/length code",r.mode=Fe;break}r.extra=_&15,r.mode=DN;case DN:if(r.extra){for(P=r.extra;f<P;){if(l===0)break e;l--,o+=i[s++]<<f,f+=8}r.length+=o&(1<<r.extra)-1,o>>>=r.extra,f-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=CN;case CN:for(;g=r.distcode[o&(1<<r.distbits)-1],b=g>>>24,_=g>>>16&255,S=g&65535,!(b<=f);){if(l===0)break e;l--,o+=i[s++]<<f,f+=8}if(!(_&240)){for(F=b,k=_,A=S;g=r.distcode[A+((o&(1<<F+k)-1)>>F)],b=g>>>24,_=g>>>16&255,S=g&65535,!(F+b<=f);){if(l===0)break e;l--,o+=i[s++]<<f,f+=8}o>>>=F,f-=F,r.back+=F}if(o>>>=b,f-=b,r.back+=b,_&64){t.msg="invalid distance code",r.mode=Fe;break}r.offset=S,r.extra=_&15,r.mode=IN;case IN:if(r.extra){for(P=r.extra;f<P;){if(l===0)break e;l--,o+=i[s++]<<f,f+=8}r.offset+=o&(1<<r.extra)-1,o>>>=r.extra,f-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){t.msg="invalid distance too far back",r.mode=Fe;break}r.mode=$N;case $N:if(c===0)break e;if(p=d-c,r.offset>p){if(p=r.offset-p,p>r.whave&&r.sane){t.msg="invalid distance too far back",r.mode=Fe;break}p>r.wnext?(p-=r.wnext,m=r.wsize-p):m=r.wnext-p,p>r.length&&(p=r.length),w=r.window}else w=n,m=a-r.offset,p=r.length;p>c&&(p=c),c-=p,r.length-=p;do n[a++]=w[m++];while(--p);r.length===0&&(r.mode=Ad);break;case BN:if(c===0)break e;n[a++]=r.length,c--,r.mode=Ad;break;case eb:if(r.wrap){for(;f<32;){if(l===0)break e;l--,o|=i[s++]<<f,f+=8}if(d-=c,t.total_out+=d,r.total+=d,r.wrap&4&&d&&(t.adler=r.check=r.flags?Je(r.check,n,d,a-d):Bc(r.check,n,d,a-d)),d=c,r.wrap&4&&(r.flags?o:jN(o))!==r.check){t.msg="incorrect data check",r.mode=Fe;break}o=0,f=0}r.mode=LN;case LN:if(r.wrap&&r.flags){for(;f<32;){if(l===0)break e;l--,o+=i[s++]<<f,f+=8}if(r.wrap&4&&o!==(r.total&4294967295)){t.msg="incorrect length check",r.mode=Fe;break}o=0,f=0}r.mode=MN;case MN:T=b9;break e;case Fe:T=jD;break e;case UD:return qD;case zD:default:return _r}return t.next_out=a,t.avail_out=c,t.next_in=s,t.avail_in=l,r.hold=o,r.bits=f,(r.wsize||d!==t.avail_out&&r.mode<Fe&&(r.mode<eb||e!==yN))&&KD(t,t.output,t.next_out,d-t.avail_out),h-=t.avail_in,d-=t.avail_out,t.total_in+=h,t.total_out+=d,r.total+=d,r.wrap&4&&d&&(t.adler=r.check=r.flags?Je(r.check,n,d,t.next_out-d):Bc(r.check,n,d,t.next_out-d)),t.data_type=r.bits+(r.last?64:0)+(r.mode===fi?128:0)+(r.mode===Rd||r.mode===Q0?256:0),(h===0&&d===0||e===yN)&&T===ts&&(T=v9),T},"inflate$2"),R9=y(t=>{if(ns(t))return _r;let e=t.state;return e.window&&(e.window=null),t.state=null,ts},"inflateEnd"),A9=y((t,e)=>{if(ns(t))return _r;let r=t.state;return r.wrap&2?(r.head=e,e.done=!1,ts):_r},"inflateGetHeader"),P9=y((t,e)=>{let r=e.length,i,n,s;return ns(t)||(i=t.state,i.wrap!==0&&i.mode!==qd)?_r:i.mode===qd&&(n=1,n=Bc(n,e,r,0),n!==i.check)?jD:(s=KD(t,e,r,r),s?(i.mode=UD,qD):(i.havedict=1,ts))},"inflateSetDictionary"),N9=VD,D9=GD,C9=HD,I9=T9,$9=ZD,B9=O9,L9=R9,M9=A9,j9=P9,q9="pako inflate (from Nodeca project)",di={inflateReset:N9,inflateReset2:D9,inflateResetKeep:C9,inflateInit:I9,inflateInit2:$9,inflate:B9,inflateEnd:L9,inflateGetHeader:M9,inflateSetDictionary:j9,inflateInfo:q9};function JD(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}u(JD,"$o");y(JD,"GZheader");var U9=JD,YD=Object.prototype.toString,{Z_NO_FLUSH:z9,Z_FINISH:W9,Z_OK:jc,Z_STREAM_END:ib,Z_NEED_DICT:nb,Z_STREAM_ERROR:H9,Z_DATA_ERROR:UN,Z_MEM_ERROR:V9}=Oo;function No(t){this.options=Zd.assign({chunkSize:1024*64,windowBits:15,to:""},t||{});let e=this.options;e.raw&&e.windowBits>=0&&e.windowBits<16&&(e.windowBits=-e.windowBits,e.windowBits===0&&(e.windowBits=-15)),e.windowBits>=0&&e.windowBits<16&&!(t&&t.windowBits)&&(e.windowBits+=32),e.windowBits>15&&e.windowBits<48&&(e.windowBits&15||(e.windowBits|=15)),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new CD,this.strm.avail_out=0;let r=di.inflateInit2(this.strm,e.windowBits);if(r!==jc)throw new Error(Qn[r]);if(this.header=new U9,di.inflateGetHeader(this.strm,this.header),e.dictionary&&(typeof e.dictionary=="string"?e.dictionary=Mc.string2buf(e.dictionary):YD.call(e.dictionary)==="[object ArrayBuffer]"&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(r=di.inflateSetDictionary(this.strm,e.dictionary),r!==jc)))throw new Error(Qn[r])}u(No,"vt");y(No,"Inflate$1");No.prototype.push=function(t,e){let r=this.strm,i=this.options.chunkSize,n=this.options.dictionary,s,a,l;if(this.ended)return!1;for(e===~~e?a=e:a=e===!0?W9:z9,YD.call(t)==="[object ArrayBuffer]"?r.input=new Uint8Array(t):r.input=t,r.next_in=0,r.avail_in=r.input.length;;){for(r.avail_out===0&&(r.output=new Uint8Array(i),r.next_out=0,r.avail_out=i),s=di.inflate(r,a),s===nb&&n&&(s=di.inflateSetDictionary(r,n),s===jc?s=di.inflate(r,a):s===UN&&(s=nb));r.avail_in>0&&s===ib&&r.state.wrap>0&&t[r.next_in]!==0;)di.inflateReset(r),s=di.inflate(r,a);switch(s){case H9:case UN:case nb:case V9:return this.onEnd(s),this.ended=!0,!1}if(l=r.avail_out,r.next_out&&(r.avail_out===0||s===ib))if(this.options.to==="string"){let c=Mc.utf8border(r.output,r.next_out),o=r.next_out-c,f=Mc.buf2string(r.output,c);r.next_out=o,r.avail_out=i-o,o&&r.output.set(r.output.subarray(c,c+o),0),this.onData(f)}else this.onData(r.output.length===r.next_out?r.output:r.output.subarray(0,r.next_out));if(!(s===jc&&l===0)){if(s===ib)return s=di.inflateEnd(this.strm),this.onEnd(s),this.ended=!0,!0;if(r.avail_in===0)break}}return!0};No.prototype.onData=function(t){this.chunks.push(t)};No.prototype.onEnd=function(t){t===jc&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=Zd.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};function Yd(t,e){let r=new No(e);if(r.push(t),r.err)throw r.msg||Qn[r.err];return r.result}u(Yd,"Hi");y(Yd,"inflate$1");function XD(t,e){return e=e||{},e.raw=!0,Yd(t,e)}u(XD,"Zo");y(XD,"inflateRaw$1");var G9=No,Z9=Yd,K9=XD,J9=Yd,Y9=Oo,X9={Inflate:G9,inflate:Z9,inflateRaw:K9,ungzip:J9,constants:Y9},{Deflate:eie,deflate:Q9,deflateRaw:tie,gzip:rie}=c9,{Inflate:iie,inflate:eV,inflateRaw:nie,ungzip:sie}=X9,tV=Q9,rV=eV,iV=y((t,e)=>{let r={type:"local",id:"local",name:"Local User",email:"local@legitcontrol.com"};return{getUser:y(async()=>r,"getUser"),signInAnonymously:y(async()=>{r.type="anonymous",r.id=crypto.randomUUID(),r.email=`anonymous-sha1-${r.id}-@legitcontrol.com`},"signInAnonymously"),addAccessToken:y(async i=>{let n=await t.getUserTokens(r.id);n.accessTokens.push(i),await t.setUserTokens(r.id,n)},"addAccessToken"),getMaxAccessTokenForBranch:y(async i=>{let n=await t.getUserTokens(r.id);if(!(n.accessTokens===void 0||n.accessTokens.length===0))return n.accessTokens[0]},"getMaxAccessTokenForBranch")}},"createSessionManager");function QD(t){let e=JSON.stringify(t),r=new TextEncoder().encode(e),i="";return typeof btoa=="function"?i=btoa(String.fromCharCode(...r)):i=Buffer.from(r).toString("base64"),i.replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}u(QD,"Tn");y(QD,"encodeConfigJson");function eC(t){let e=t.replace(/-/g,"+").replace(/_/g,"/")+"===".slice((t.length+3)%4),r;typeof atob=="function"?r=atob(e):r=Buffer.from(e,"base64").toString("binary");let i=Uint8Array.from(r,s=>s.charCodeAt(0)),n=new TextDecoder().decode(i);return JSON.parse(n)}u(eC,"Cn");y(eC,"decodeConfigJson");var zN="user.legit-tokens";function tC({storageFs:t,gitRoot:e}){return{getUserTokens:y(async r=>{let i=await wb.default.getConfig({fs:t,dir:e,path:zN});return i?eC(i):{accessTokens:[]}},"getUserTokens"),setUserTokens:y(async(r,i)=>await wb.default.setConfig({fs:t,dir:e,path:zN,value:QD(i)}),"setUserTokens")}}u(tC,"Bn");y(tC,"createGitConfigTokenStore");async function me(t,e,r){try{return await jr.default.resolveRef({fs:t,dir:e,ref:`refs/heads/${Ye(r)}`})}catch{return}}u(me,"T");y(me,"tryResolveRef");async function pi({dir:t,fs:e,treeOid:r,deletePathParts:i,addPathParts:n,addObj:s,addKeepIfEmpty:a,deleteKeepIfNotEmpty:l,keepFilename:c=".keep",gitCache:o}){let[f,...h]=n??[],[d,...p]=i??[],m=[];if(r){let{tree:w}=await jr.default.readTree({fs:e,dir:t,oid:r,cache:o||{}});m=[...w]}if(f===d){let w=f;if(w===void 0)throw new Error("illegal arguement - called with out a path part");if(h.length===0)throw new Error("can not move into it self");if(p.length===0)throw new Error("can not move from it self");let g=m.findIndex(F=>F.path===w),b=(g!==-1?m[g]:void 0)?.oid,_=await pi({dir:t,fs:e,treeOid:b,addPathParts:h,deletePathParts:p,addObj:s,addKeepIfEmpty:a,deleteKeepIfNotEmpty:l});if(_===void 0)throw new Error("on the same path we expect an update - respectivly a newly created subTreeOid");let S=!1;if(_!==b){S=!0;let F={mode:"040000",path:w,oid:_,type:"tree"};g!==-1?m[g]=F:m.push(F)}if(r==null&&!S)throw new Error("Illegal state - if the currentOid is undefined - a new tree should have been created (an update should have happened)");if(S)return await jr.default.writeTree({fs:e,dir:t,tree:m});if(r===void 0)throw new Error("currentOid should be set - since the sub tree didn't exist and ");return r}else{let w=!1,g;if(d){let b=m.findIndex(S=>S.path===d),_=b!==-1?m[b]:void 0;if(_===void 0)throw new Error("Element doesnt exist in tree");if(p.length>0){if(_&&_.type!=="tree")throw new Error("SubPart of the path for the obj to delete is not a tree");let S=await pi({dir:t,fs:e,treeOid:_.oid,addPathParts:void 0,deletePathParts:p,addObj:s,addKeepIfEmpty:a,deleteKeepIfNotEmpty:l});if(S===_.oid)throw new Error("in case of a delete we expect a different subtree oid");w=!0,S===void 0?m.splice(b,1):m[b]={mode:"040000",path:d,oid:S,type:"tree"}}else if(w=!0,m.splice(b,1),m.length===0&&a){let S=new Uint8Array(0),F=await jr.default.writeBlob({fs:e,dir:t,blob:S});m.push({mode:"100644",oid:F,path:c,type:"blob"})}g=_}if(f){let b=m.findIndex(S=>S.path===f),_=b!==-1?m[b]:void 0;if(h.length>0){if(_&&_.type!=="tree")throw new Error("SubPart of the path for the obj to add is not a tree");let S=await pi({dir:t,fs:e,treeOid:_?.oid,addPathParts:h,deletePathParts:void 0,addObj:s,addKeepIfEmpty:a,deleteKeepIfNotEmpty:l});if(S===void 0)throw new Error("in case we add, we expect an update - respectivly a newly created subTreeOid");if(S!==_?.oid){w=!0;let F={mode:"040000",path:f,oid:S,type:"tree"};if(b!==-1)m[b]=F;else if(m.push(F),l&&m.length>1){let k=m.findIndex(A=>A.path===c);k!==-1&&m.splice(k,1)}}}else{if(w=!0,s){let S={mode:s.type==="tree"?"040000":"100644",path:f,oid:s.oid,type:s.type};if(b!==-1)m[b]=S;else{if(l&&m.length>0){let F=m.findIndex(k=>k.path===c);F!==-1&&m.splice(F,1)}m.push(S)}}if(a&&m.length===0){let S=new Uint8Array(0),F=await jr.default.writeBlob({fs:e,dir:t,blob:S});m.push({mode:"100644",oid:F,path:c,type:"blob"})}}}if(m.length===0)return;if(w)return await jr.default.writeTree({fs:e,dir:t,tree:m});if(r===void 0)throw new Error("currentOid should be set - since the sub tree didn't exist and ");return r}}u(pi,"ue");y(pi,"buildUpdatedTree");async function Ob(t,e,r,i,n=0,s={}){let{tree:a}=await jr.default.readTree({fs:t,dir:e,oid:r,cache:s});if(i.length===n)return{type:"tree",entries:a.map(o=>zr({parent:i.join("/"),name:o.path,isDir:o.type==="tree"})),oid:r};let l=i[n],c=a.find(o=>o.path===l);if(c){if(i.length===n+1){if(c.type==="blob")return{type:"blob",oid:c.oid};if(c.type==="tree"){let o=await jr.default.readTree({fs:t,dir:e,oid:c.oid,cache:s});return{type:"tree",entries:o.tree.map(f=>zr({parent:i.join("/"),name:f.path,isDir:f.type==="tree"})),oid:o.oid}}}else if(c.type==="tree")return await Ob(t,e,c.oid,i,n+1,s)}}u(Ob,"In");y(Ob,"findGitObjectAtPath");async function uo({filePath:t,gitRoot:e,nodeFs:r,commitSha:i,pathParams:n,gitCache:s}){let a=s||{};if(!n.filePath){let c=await jr.default.readTree({fs:r,dir:e,oid:i,cache:a});return{type:"tree",entries:c.tree.map(o=>zr({parent:t,name:o.path,isDir:o.type==="tree"})),oid:c.oid}}let l=n.filePath?n.filePath.split("/"):[];return await Ob(r,e,i,l,0,a)}u(uo,"Le");y(uo,"resolveGitObjAtPath");var Yn,rC=(Yn=class extends Error{constructor(e,r){super(e),U(this,"code","ENOENT"),U(this,"path"),this.name="ENOENTError",this.path=r,Object.setPrototypeOf(this,Yn.prototype)}},u(Yn,"Ut"),Yn);y(rC,"ENOENTError");var yb=rC;function Pc(t){return t&&t.gitCache!==void 0?t.gitCache:t&&t.parentFs?Pc(t.parentFs):{}}u(Pc,"jt");y(Pc,"getGitCacheFromFs");function iC({gitStorageFs:t,gitRoot:e,rootPath:r}){return new Wt({name:"branch-file",gitStorageFs:t,gitRoot:e,rootPath:r||e,handler:{type:"gitBranchFileVirtualFile",rootType:"folder",getStats:y(async i=>{let{filePath:n,pathParams:s,userSpaceFs:a}=i;s.branchName===void 0&&(s.branchName=await ve(e,t));let l=await me(t,e,s.branchName);if(!l)throw new yb(`ENOENT: no such file or directory, stat '${n}'`,n);let c=await uo({filePath:n,gitRoot:e,nodeFs:t,commitSha:l,pathParams:s,gitCache:Pc(a)});if(!c)throw new yb(`ENOENT: no such file or directory, stat '${n}'`,n);let o=await ue.default.readCommit({fs:t,dir:e,oid:l}),{commit:f}=o,h=await ue.default.log({fs:t,dir:e,ref:l,filepath:s.filePath,depth:1}),d=f.committer.timestamp*1e3,p=h.length>0?h[0].commit.committer.timestamp*1e3:d;if(c.type==="tree")return{mode:420,size:0,isFile:y(()=>!0,"isFile"),isDirectory:y(()=>!0,"isDirectory"),isSymbolicLink:y(()=>!1,"isSymbolicLink"),isBlockDevice:y(()=>!1,"isBlockDevice"),isCharacterDevice:y(()=>!1,"isCharacterDevice"),isSocket:y(()=>!1,"isSocket"),isFIFO:y(()=>!1,"isFIFO"),isFileSync:y(()=>!0,"isFileSync"),isDirectorySync:y(()=>!1,"isDirectorySync"),dev:0,ino:0,nlink:1,uid:0,gid:0,rdev:0,blksize:4096,blocks:0,atimeMs:p,mtimeMs:p,ctimeMs:p,birthtimeMs:d,atime:new Date(p),mtime:new Date(p),ctime:new Date(p),birthtime:new Date(p)};{let{blob:m}=await ue.default.readBlob({fs:t,dir:e,oid:c.oid});return{mode:420,size:m.length,isFile:y(()=>!0,"isFile"),isDirectory:y(()=>!1,"isDirectory"),isSymbolicLink:y(()=>!1,"isSymbolicLink"),isBlockDevice:y(()=>!1,"isBlockDevice"),isCharacterDevice:y(()=>!1,"isCharacterDevice"),isSocket:y(()=>!1,"isSocket"),isFIFO:y(()=>!1,"isFIFO"),isFileSync:y(()=>!0,"isFileSync"),isDirectorySync:y(()=>!1,"isDirectorySync"),dev:0,ino:0,nlink:1,uid:0,gid:0,rdev:0,blksize:4096,blocks:Math.ceil(m.length/4096),atimeMs:p,mtimeMs:p,ctimeMs:p,birthtimeMs:p,atime:new Date(p),mtime:new Date(p),ctime:new Date(p),birthtime:new Date(p)}}},"getStats"),getFile:y(async i=>{let{filePath:n,cacheFs:s,pathParams:a,userSpaceFs:l}=i;a.branchName===void 0&&(a.branchName=await ve(e,t));try{let c=await me(t,e,a.branchName);if(!c){let f=await ue.default.resolveRef({fs:t,dir:e,ref:"HEAD"});if(await ue.default.branch({fs:t,dir:e,ref:a.branchName,object:f}),c=await me(t,e,a.branchName),!c)throw new Error("Could not create branch for getFile")}let o=await uo({filePath:n,gitRoot:e,nodeFs:t,commitSha:c,pathParams:a,gitCache:Pc(l)});if(!o)return;if(o.type==="blob"){let{blob:f}=await ue.default.readBlob({fs:t,dir:e,oid:o.oid});return{type:"file",content:Buffer.from(f),mode:420,size:f.length,oid:o.oid}}else{let f=[];try{let h=await s.promises.stat(n);if(h&&h.isDirectory()){let d=await s.promises.readdir(n,{withFileTypes:!0});f.push(...d)}}catch{}return{type:"directory",content:Array.from(new Set([...f,...o.entries])).map(h=>({...h,name:h.name.toString(),path:`${n}`,parentPath:`${n}`})),mode:493}}}catch{return}},"getFile"),unlink:y(async i=>{let{pathParams:n,author:s}=i;if(n.branchName===void 0&&(n.branchName=await ve(e,t)),!n.filePath)throw new Error("filePath should be in pathParams");let a=await me(t,e,n.branchName);if(!a)throw new Error("Invalid branch file path - branch must exist");let l=await ue.default.readTree({fs:t,dir:e,oid:a}),c=await pi({dir:e,fs:t,treeOid:l.oid,deletePathParts:n.filePath.split("/"),addPathParts:void 0,addObj:void 0,deleteKeepIfNotEmpty:!1,addKeepIfEmpty:!0,keepFilename:".keep"});if(c!==l.oid){let o=await ue.default.commit({fs:t,dir:e,message:`Delete ${n.filePath}`,tree:c,noUpdateBranch:!0,parent:[a],author:s});await ue.default.writeRef({fs:t,dir:e,ref:`refs/heads/${Ye(n.branchName)}`,value:o,force:!0})}},"unlink"),writeFile:y(async i=>{let{filePath:n,content:s,cacheFs:a,pathParams:l,author:c}=i;if(l.branchName===void 0&&(l.branchName=await ve(e,t)),l.filePath===void 0)throw new Error("filePath should be in pathParams");let o;typeof s=="string"?o=new TextEncoder().encode(s):o=new Uint8Array(s);let f=await ue.default.writeBlob({fs:t,dir:e,blob:o}),h=await me(t,e,l.branchName);if(!h){let m=await ue.default.resolveRef({fs:t,dir:e,ref:"HEAD"});if(await ue.default.branch({fs:t,dir:e,ref:Ye(l.branchName),object:m}),h=await me(t,e,l.branchName),!h)throw new Error("Could not create branch for writeFile")}let d=await ue.default.readTree({fs:t,dir:e,oid:h}),p=await pi({dir:e,fs:t,treeOid:d.oid,deletePathParts:void 0,addPathParts:l.filePath.split("/"),addObj:{type:"blob",oid:f},deleteKeepIfNotEmpty:!0,addKeepIfEmpty:!1,keepFilename:".keep"});if(p!==d.oid){let m=await ue.default.commit({fs:t,dir:e,message:`\u{1F4BE} Change '${l.filePath}'`,tree:p,noUpdateBranch:!0,parent:[h],author:c});await ue.default.writeRef({fs:t,dir:e,ref:`refs/heads/${Ye(l.branchName)}`,value:m,force:!0});let w=await me(t,e,l.branchName);if(m!==w)throw new Error("Failed to update branch after file deletion")}},"writeFile"),rename:y(async function(i){let{filePath:n,newPath:s,pathParams:a,newPathParams:l,author:c,userSpaceFs:o}=i;if(a.branchName===void 0&&(a.branchName=await ve(e,t)),a.filePath===void 0)throw new Error("filePath should be in pathParams");if(l.branchName===void 0&&(l.branchName=await ve(e,t)),l.filePath===void 0)throw new Error("filePath should be in newPathParams");let f=await me(t,e,a.branchName);if(!f)throw new Error("Invalid branch file path - source branch must exist");let h=await me(t,e,l.branchName);if(!h){let w=await ue.default.resolveRef({fs:t,dir:e,ref:"HEAD"});if(await ue.default.branch({fs:t,dir:e,ref:Ye(l.branchName),object:w}),h=await me(t,e,l.branchName),h===void 0)throw new Error("Could not create branch for rename operation")}if(l.branchName!==a.branchName)throw new Error("cross branch move not implemented yet");let d=await uo({gitRoot:e,nodeFs:t,commitSha:f,filePath:n,pathParams:a,gitCache:Pc(o)});if(d===void 0)throw new Error("no obj at path exists");let p=await pi({dir:e,fs:t,deletePathParts:a.filePath.split("/"),addPathParts:l.filePath.split("/"),addObj:d.type==="blob"?{type:"blob",oid:d.oid}:{type:"tree",oid:d.oid,entries:d.entries.map(w=>w.name.toString())},treeOid:h,addKeepIfEmpty:!0,deleteKeepIfNotEmpty:!0}),m=await ue.default.readTree({fs:t,dir:e,oid:f});if(p!==m.oid){let w=await ue.default.commit({fs:t,dir:e,message:`\u{1F500} Rename '${a.filePath}' to '${l.filePath}'`,tree:p,noUpdateBranch:!0,parent:[h],author:c});await ue.default.writeRef({fs:t,dir:e,ref:`refs/heads/${Ye(l.branchName)}`,value:w,force:!0})}},"rename"),mkdir:y(async function(i){i.pathParams.branchName===void 0&&(i.pathParams.branchName=await ve(e,t));let n=await me(t,e,i.pathParams.branchName);if(i.pathParams.filePath===""&&(i.pathParams.filePath="/",n!==void 0))throw new Error("Folder exists");try{throw await this.getStats(i),new Error("Folder exists")}catch{}if(i.filePath.endsWith("/")&&(i.filePath=i.filePath.replace(/\/+$/,"")),i.pathParams&&typeof i.pathParams.filePath=="string"&&(i.pathParams.filePath=i.pathParams.filePath.replace(/\/+$/,"")),!n){let o=await ue.default.resolveRef({fs:t,dir:e,ref:"HEAD"});if(await ue.default.branch({fs:t,dir:e,ref:Ye(i.pathParams.branchName),object:o}),n=await me(t,e,i.pathParams.branchName),n===void 0)throw new Error("Could not create branch for mkdir operation")}let s=await ue.default.readTree({fs:t,dir:e,oid:n}),a=new Uint8Array(0),l=await ue.default.writeBlob({fs:t,dir:e,blob:a}),c=await pi({dir:e,fs:t,treeOid:s.oid,deletePathParts:void 0,addPathParts:[...i.pathParams.filePath.split("/"),".keep"],addObj:{type:"blob",oid:l},deleteKeepIfNotEmpty:!0,addKeepIfEmpty:!0,keepFilename:".keep"});if(c!==s.oid){let o=await ue.default.commit({fs:t,dir:e,message:`\u{1F4BE} Change '${i.pathParams.filePath}'`,tree:c,noUpdateBranch:!0,parent:[n],author:i.author});await ue.default.writeRef({fs:t,dir:e,ref:`refs/heads/${Ye(i.pathParams.branchName)}`,value:o,force:!0})}},"mkdir"),rmdir:y(async i=>{let{pathParams:n,author:s}=i;if(n.branchName===void 0&&(n.branchName=await ve(e,t)),!n.filePath)throw new Error("filePath should be in pathParams");let a=await me(t,e,n.branchName);if(!a)throw new Error("Invalid branch file path - branch must exist");let l=await ue.default.readTree({fs:t,dir:e,oid:a}),c=await pi({dir:e,fs:t,treeOid:l.oid,deletePathParts:n.filePath.split("/"),addPathParts:void 0,addObj:void 0,deleteKeepIfNotEmpty:!1,addKeepIfEmpty:!0,keepFilename:".keep"});if(c!==l.oid){let o=await ue.default.commit({fs:t,dir:e,message:`Delete ${n.filePath}`,tree:c,noUpdateBranch:!0,parent:[a],author:s});await ue.default.writeRef({fs:t,dir:e,ref:`refs/heads/${Ye(n.branchName)}`,value:o,force:!0})}},"rmdir")}})}u(iC,"Nn");y(iC,"createBranchFileAdapter");function nC({gitStorageFs:t,gitRoot:e,rootPath:r}){return new Wt({name:"branches-list",gitStorageFs:t,gitRoot:e,rootPath:r||e,handler:{type:"gitBranchesListVirtualFile",rootType:"folder",getStats:y(async()=>{let i=e+"/.git";try{return await t.promises.stat(i)}catch{throw new Error(`ENOENT: no such file or directory, stat '${i}'`)}},"getStats"),getFile:y(async({filePath:i})=>{try{let n=await gb.default.listBranches({fs:t,dir:e}),s=await Promise.all(n.map(async a=>{let l=await gb.default.resolveRef({fs:t,dir:e,ref:a});return zr({parent:i,name:Xn(a),isDir:!0})}));return{type:"directory",content:s,mode:493,size:s}}catch(n){throw n}},"getFile"),rename:y(async i=>{throw new Error("not implemented")},"rename"),mkdir:y(async function(i){throw new Error("not implemented")},"mkdir")}})}u(nC,"zn");y(nC,"createBranchesListAdapter");function Ud(t){return t&&t.gitCache!==void 0?t.gitCache:t&&t.parentFs?Ud(t.parentFs):{}}u(Ud,"$i");y(Ud,"getGitCacheFromFs");function sC({gitStorageFs:t,gitRoot:e,rootPath:r}){return new Wt({name:"branch-head",gitStorageFs:t,gitRoot:e,rootPath:r||e,handler:{type:"gitBranchHeadVirtualFile",rootType:"file",getStats:y(async({pathParams:i,userSpaceFs:n})=>{i.branchName===void 0&&(i.branchName=await ve(e,t));let s=await me(t,e,i.branchName);if(!s)throw new Error(`Branch ${i.branchName} does not exist in the repository`);let a=await co.default.readCommit({fs:t,dir:e,oid:s,cache:Ud(n)}),{commit:l}=a,c=l.committer.timestamp*1e3;return{mode:420,size:40,isFile:y(()=>!0,"isFile"),isDirectory:y(()=>!1,"isDirectory"),isSymbolicLink:y(()=>!1,"isSymbolicLink"),isBlockDevice:y(()=>!1,"isBlockDevice"),isCharacterDevice:y(()=>!1,"isCharacterDevice"),isSocket:y(()=>!1,"isSocket"),isFIFO:y(()=>!1,"isFIFO"),isFileSync:y(()=>!0,"isFileSync"),isDirectorySync:y(()=>!1,"isDirectorySync"),dev:0,ino:0,nlink:1,uid:0,gid:0,rdev:0,blksize:4096,blocks:Math.ceil(.009765625),atimeMs:c,mtimeMs:c,ctimeMs:c,birthtimeMs:c,atime:new Date(c),mtime:new Date(c),ctime:new Date(c),birthtime:new Date(c)}},"getStats"),getFile:y(async({pathParams:i,userSpaceFs:n})=>{i.branchName===void 0&&(i.branchName=await ve(e,t));try{let s;try{s=await co.default.resolveRef({fs:t,dir:e,ref:i.branchName})}catch{s=await co.default.resolveRef({fs:t,dir:e,ref:`refs/heads/${i.branchName}`})}return{type:"file",content:s+`
|
|
106
|
+
`,mode:420,size:s.length}}catch{return}},"getFile"),writeFile:y(async({content:i,pathParams:n,userSpaceFs:s})=>{n.branchName===void 0&&(n.branchName=await ve(e,t));let a=i.toString().trim();try{await co.default.readCommit({fs:t,dir:e,oid:a,cache:Ud(s)})}catch{throw new Error(`Commit ${a} does not exist in the repository`)}await co.default.writeRef({fs:t,dir:e,ref:"refs/heads/"+n.branchName,value:a,force:!0})},"writeFile"),rename(i){throw new Error("not implementsd")},mkdir:y(async function(i){throw new Error("not implemented")},"mkdir")}})}u(sC,"Hn");y(sC,"createBranchHeadAdapter");function Nc(t){return t&&t.gitCache!==void 0?t.gitCache:t&&t.parentFs?Nc(t.parentFs):{}}u(Nc,"Vt");y(Nc,"getGitCacheFromFs");function aC({gitStorageFs:t,gitRoot:e,rootPath:r}){return new Wt({name:"commit-file",gitStorageFs:t,gitRoot:e,rootPath:r||e,handler:{type:"gitCommitFileVirtualFile",rootType:"file",getStats:y(async({filePath:i,pathParams:n,userSpaceFs:s})=>{if(!n.sha_1_1_2)throw new Error("sha_1_1_2 should be in pathParams");if(!n.sha1_3__40)throw new Error("sha1_3__40 should be in pathParams");let a=n.sha_1_1_2+n.sha1_3__40,l=await uo({filePath:i,gitRoot:e,nodeFs:t,commitSha:a,pathParams:n,gitCache:Nc(s)});if(!l)throw new yb(`ENOENT: no such file or directory, stat '${i}'`,i);let c=await $d.default.readCommit({fs:WN,dir:e,oid:a}),{commit:o}=c,f=o.committer.timestamp*1e3;if(l.type==="tree")return{mode:420,size:0,isFile:y(()=>!0,"isFile"),isDirectory:y(()=>!0,"isDirectory"),isSymbolicLink:y(()=>!1,"isSymbolicLink"),isBlockDevice:y(()=>!1,"isBlockDevice"),isCharacterDevice:y(()=>!1,"isCharacterDevice"),isSocket:y(()=>!1,"isSocket"),isFIFO:y(()=>!1,"isFIFO"),isFileSync:y(()=>!0,"isFileSync"),isDirectorySync:y(()=>!1,"isDirectorySync"),dev:0,ino:0,nlink:1,uid:0,gid:0,rdev:0,blksize:4096,blocks:0,atimeMs:f,mtimeMs:f,ctimeMs:f,birthtimeMs:f,atime:new Date(f),mtime:new Date(f),ctime:new Date(f),birthtime:new Date(f)};{let{blob:h}=await $d.default.readBlob({fs:WN,dir:e,oid:l.oid});return{mode:420,size:h.length,isFile:y(()=>!0,"isFile"),isDirectory:y(()=>!1,"isDirectory"),isSymbolicLink:y(()=>!1,"isSymbolicLink"),isBlockDevice:y(()=>!1,"isBlockDevice"),isCharacterDevice:y(()=>!1,"isCharacterDevice"),isSocket:y(()=>!1,"isSocket"),isFIFO:y(()=>!1,"isFIFO"),isFileSync:y(()=>!0,"isFileSync"),isDirectorySync:y(()=>!1,"isDirectorySync"),dev:0,ino:0,nlink:1,uid:0,gid:0,rdev:0,blksize:4096,blocks:Math.ceil(h.length/4096),atimeMs:f,mtimeMs:f,ctimeMs:f,birthtimeMs:f,atime:new Date(f),mtime:new Date(f),ctime:new Date(f),birthtime:new Date(f)}}},"getStats"),getFile:y(async({filePath:i,pathParams:n,userSpaceFs:s})=>{if(!n.sha_1_1_2)throw new Error("sha_1_1_2 should be in pathParams");if(!n.sha1_3__40)throw new Error("sha1_3__40 should be in pathParams");let a=n.sha_1_1_2+n.sha1_3__40;try{let l=await uo({filePath:i,gitRoot:e,nodeFs:t,commitSha:a,pathParams:n,gitCache:Nc(s)});if(!l)return;if(l.type==="blob"){let{blob:c}=await $d.default.readBlob({fs:t,dir:e,oid:l.oid,cache:Nc(s)});return{type:"file",content:Buffer.from(c),mode:420,size:c.length,oid:l.oid}}else return{type:"directory",content:Array.from(new Set([...l.entries.filter(c=>c.name!==".keep")])).map(c=>({...c,name:c.name.toString(),path:`${i}`,parentPath:`${i}`})),mode:493}}catch{return}},"getFile"),rename(i){throw new Error("not implementsd")},mkdir:y(async function(i){throw new Error("not implemented")},"mkdir")}})}u(aC,"Mn");y(aC,"createCommitFileAdapter");function oC({gitStorageFs:t,gitRoot:e,rootPath:r}){return new Wt({name:"commit-folder",gitStorageFs:t,gitRoot:e,rootPath:r||e,handler:{type:"gitCommitVirtualFolder",rootType:"folder",getStats:y(async i=>{let n=e+"/.git";try{return await t.promises.stat(n)}catch{throw new Error(`ENOENT: no such file or directory, stat '${n}'`)}},"getStats"),getFile:y(async i=>{let{filePath:n,pathParams:s}=i,a=await Bd.default.listBranches({fs:t,dir:e}),l=new Set,c=new Set;for(let h of a){let d=`refs/heads/${h}`;try{let p=await Bd.default.resolveRef({fs:t,dir:e,ref:d});l.add(p)}catch{}}for(let h of l){let d=await Bd.default.log({fs:t,dir:e,ref:h});for(let p of d)c.add(p.oid)}if(!s.sha_1_1_2){let h=new Set;for(let p of c)if(h.add(p.slice(0,2)),h.size>=256)break;let d=Array.from(h).sort().map(p=>zr({parent:n,name:p,isDir:!0}));return{type:"directory",content:d,mode:493,size:d}}let o=new Set;for(let h of c)h.startsWith(s.sha_1_1_2)&&o.add(h.slice(2,40));let f=Array.from(o).sort().map(h=>zr({parent:n,name:h,isDir:!0}));return{type:"directory",content:f,mode:493,size:f.length}},"getFile"),rename(i){throw new Error("not implementsd")},mkdir:y(async function(i){throw new Error("not implemented")},"mkdir")}})}u(oC,"Rn");y(oC,"createCommitFolderAdapter");function lC({gitStorageFs:t,gitRoot:e,rootPath:r}){return new Wt({name:"branch-operation",gitStorageFs:t,gitRoot:e,rootPath:r||e,handler:{type:"gitBranchOperationVirtualFile",rootType:"file",getStats:y(async i=>{let{pathParams:n}=i;n.branchName===void 0&&(n.branchName=await ve(e,t));let s=await me(t,e,n.branchName);if(!s)throw new Error(`Base Branch ${n.branchName} for operations does not exis`);let a=await mi(t,e,n.branchName),l=!1;if(a)try{s=await br.default.resolveRef({fs:t,dir:e,ref:a}),l=!0}catch{try{s=await br.default.resolveRef({fs:t,dir:e,ref:`refs/heads/${a}`}),l=!0}catch{}}let c=await br.default.readCommit({fs:t,dir:e,oid:s}),{commit:o}=c,f=o.committer.timestamp*1e3;try{return{mode:420,size:40,atimeMs:f,mtimeMs:f,ctimeMs:f,birthtimeMs:f,atime:new Date(f),mtime:new Date(f),ctime:new Date(f),birthtime:new Date(f),isFile:y(()=>!0,"isFile"),isDirectory:y(()=>!1,"isDirectory"),isSymbolicLink:y(()=>!1,"isSymbolicLink"),isBlockDevice:y(()=>!1,"isBlockDevice"),isCharacterDevice:y(()=>!1,"isCharacterDevice"),isSocket:y(()=>!1,"isSocket"),isFIFO:y(()=>!1,"isFIFO"),isFileSync:y(()=>!0,"isFileSync"),isDirectorySync:y(()=>!1,"isDirectorySync"),dev:0,ino:0,nlink:1,uid:0,gid:0,rdev:0,blksize:4096,blocks:0}}catch{throw new Error("ENOENT: no such file or directory, stat operationHistory")}},"getStats"),getFile:y(async i=>{let{pathParams:n}=i;n.branchName===void 0&&(n.branchName=await ve(e,t));let s=await mi(t,e,n.branchName),a,l=!1;if(s){if(a=await me(t,e,s),l=!0,!a)throw new Error(`Base Branch ${s} for operations does not exis`)}else if(a=await me(t,e,n.branchName),!a)throw new Error(`Base Branch ${n.branchName} for operations does not exis`);return{type:"file",content:Buffer.from(a),mode:420,size:a.length}},"getFile"),writeFile:y(async i=>{let{content:n,pathParams:s,author:a}=i;s.branchName===void 0&&(s.branchName=await ve(e,t));let l;typeof n=="string"?l=new TextEncoder().encode(n):l=new Uint8Array(n);let c=await br.default.writeBlob({fs:t,dir:e,blob:l}),o=await me(t,e,s.branchName);if(!o)throw new Error("Invalid branch file path - branch doesn't exist");let f=await mi(t,e,s.branchName),h=!1;if(!f){f=s.branchName+lD,await br.default.branch({fs:t,dir:e,ref:Ye(f),object:o});let b=await br.default.listBranches({fs:t,dir:e});h=!0}let d=await me(t,e,f),p=await br.default.readTree({fs:t,dir:e,oid:o}),m;n instanceof ArrayBuffer?m=Buffer.from(n).toString("utf-8"):typeof n=="string"?m=n:n instanceof Uint8Array?m=Buffer.from(n).toString("utf-8"):m=String(n);let w=!1;if(!h){let b=await br.default.findMergeBase({fs:t,dir:e,oids:w?[d]:[d,o]});b.length===1&&b[0]===o&&(w=!0)}let g=await br.default.commit({fs:t,dir:e,message:m,tree:p.oid,noUpdateBranch:!0,author:a,parent:w?h?[o,o]:[d]:[d,o]});await br.default.writeRef({fs:t,dir:e,ref:`refs/heads/${Ye(f)}`,value:g,force:!0})},"writeFile"),rename:y(async function(i){throw new Error("not implemented")},"rename"),mkdir:y(async function(i){throw new Error("not implemented")},"mkdir")}})}u(lC,"Un");y(lC,"createBranchOperationAdapter");function cC({gitStorageFs:t,gitRoot:e,rootPath:r}){return new Wt({name:"branch-history",gitStorageFs:t,gitRoot:e,rootPath:r||e,handler:{type:"gitBranchHistory",rootType:"file",getStats:y(async({pathParams:i})=>{i.branchName===void 0&&(i.branchName=await ve(e,t));let n=await me(t,e,i.branchName);if(!n)throw new Error(`Branch ${i.branchName} does not exist`);let s=await bb.default.readCommit({fs:t,dir:e,oid:n}),{commit:a}=s,l=a.committer.timestamp*1e3;return{mode:420,size:1e5,isFile:y(()=>!0,"isFile"),isDirectory:y(()=>!1,"isDirectory"),isSymbolicLink:y(()=>!1,"isSymbolicLink"),isBlockDevice:y(()=>!1,"isBlockDevice"),isCharacterDevice:y(()=>!1,"isCharacterDevice"),isSocket:y(()=>!1,"isSocket"),isFIFO:y(()=>!1,"isFIFO"),isFileSync:y(()=>!0,"isFileSync"),isDirectorySync:y(()=>!1,"isDirectorySync"),dev:0,ino:0,nlink:1,uid:0,gid:0,rdev:0,blksize:4096,blocks:Math.ceil(.009765625),atimeMs:l,mtimeMs:l,ctimeMs:l,birthtimeMs:l,atime:new Date(l),mtime:new Date(l),ctime:new Date(l),birthtime:new Date(l)}},"getStats"),getFile:y(async i=>{let{pathParams:n}=i,s=n.branchName;s===void 0&&(s=await ve(e,t));let a=[];if(s){let c=await me(t,e,s),o=!1,f=c;for(;f&&!o;){let h=await bb.default.readCommit({fs:t,dir:e,oid:f});a.push({oid:h.oid,...h.commit}),f=h.commit.parent[0]}}let l=Buffer.from(JSON.stringify(a,null,2),"utf-8");return{type:"file",content:l,mode:420,size:l.length}},"getFile"),rename:y(async i=>{throw new Error("not implemented")},"rename"),mkdir:y(async function(i){throw new Error("not implemented")},"mkdir")}})}u(cC,"Vn");y(cC,"createBranchHistoryAdapter");function fC({gitStorageFs:t,gitRoot:e,rootPath:r}){return new Wt({name:"branch-operation-head",gitStorageFs:t,gitRoot:e,rootPath:r||e,handler:{type:"gitBranchOperationHeadVirtualFile",rootType:"file",getStats:y(async i=>{let{pathParams:n}=i;n.branchName===void 0&&(n.branchName=await ve(e,t));let s=await mi(t,e,n.branchName);if(!s){let f=new Date(0);return{mode:420,size:0,isFile:y(()=>!0,"isFile"),isDirectory:y(()=>!1,"isDirectory"),isSymbolicLink:y(()=>!1,"isSymbolicLink"),isBlockDevice:y(()=>!1,"isBlockDevice"),isCharacterDevice:y(()=>!1,"isCharacterDevice"),isSocket:y(()=>!1,"isSocket"),isFIFO:y(()=>!1,"isFIFO"),isFileSync:y(()=>!0,"isFileSync"),isDirectorySync:y(()=>!1,"isDirectorySync"),dev:0,ino:0,nlink:1,uid:0,gid:0,rdev:0,blksize:4096,blocks:Math.ceil(.009765625),atimeMs:f.getTime(),mtimeMs:f.getTime(),ctimeMs:f.getTime(),birthtimeMs:f.getTime(),atime:f,mtime:f,ctime:f,birthtime:f}}let a;try{a=await ui.default.resolveRef({fs:t,dir:e,ref:s})}catch{a=await ui.default.resolveRef({fs:t,dir:e,ref:`refs/heads/${s}`})}let l=await ui.default.readCommit({fs:t,dir:e,oid:a}),{commit:c}=l,o=c.committer.timestamp*1e3;return{mode:420,size:40,isFile:y(()=>!0,"isFile"),isDirectory:y(()=>!1,"isDirectory"),isSymbolicLink:y(()=>!1,"isSymbolicLink"),isBlockDevice:y(()=>!1,"isBlockDevice"),isCharacterDevice:y(()=>!1,"isCharacterDevice"),isSocket:y(()=>!1,"isSocket"),isFIFO:y(()=>!1,"isFIFO"),isFileSync:y(()=>!0,"isFileSync"),isDirectorySync:y(()=>!1,"isDirectorySync"),dev:0,ino:0,nlink:1,uid:0,gid:0,rdev:0,blksize:4096,blocks:Math.ceil(.009765625),atimeMs:o,mtimeMs:o,ctimeMs:o,birthtimeMs:o,atime:new Date(o),mtime:new Date(o),ctime:new Date(o),birthtime:new Date(o)}},"getStats"),getFile:y(async i=>{let{pathParams:n}=i;n.branchName===void 0&&(n.branchName=await ve(e,t));let s=await mi(t,e,n.branchName);if(!s)return{type:"file",content:"",mode:420,size:0};try{let a;try{a=await ui.default.resolveRef({fs:t,dir:e,ref:s})}catch{a=await ui.default.resolveRef({fs:t,dir:e,ref:`refs/heads/${s}`})}return{type:"file",content:a+`
|
|
107
|
+
`,mode:420,size:a.length}}catch{return}},"getFile"),writeFile:y(async i=>{let{content:n,pathParams:s}=i;s.branchName===void 0&&(s.branchName=await ve(e,t));let a=await mi(t,e,s.branchName);if(!a)throw new Error(`Operation branch name could not be resolved for branch ${s.branchName}`);let l=await me(t,e,a),c=n.toString().trim(),o,f,h=!1;if(!l)throw new Error(`Operation branch ref could not be resolved for branch ${a}`);let d=l;for(;d&&!h;){let p=await ui.default.readCommit({fs:t,dir:e,oid:d});if(p.oid===c&&(o=p.oid),d=p.commit.parent&&p.commit.parent.length>0?p.commit.parent[0]:null,p.commit.parent.length===2){if(p.commit.parent[0]===p.commit.parent[1])h=!0;else if(o!==void 0){f=p.commit.parent[1];break}}}if(o===void 0)throw new Error(`Cant rollback to ${c} couldn't find newOperationBranchHead ${o}`);if(f===void 0)throw new Error(`Cant rollback to ${c} couldn't find newBranchHead ${f}`);await ui.default.writeRef({fs:t,dir:e,ref:"refs/heads/"+a,value:o,force:!0}),await ui.default.writeRef({fs:t,dir:e,ref:"refs/heads/"+s.branchName,value:f,force:!0})},"writeFile"),rename(i){throw new Error("not implementsd")},mkdir:y(async function(i){throw new Error("not implemented")},"mkdir")}})}u(fC,"Zn");y(fC,"createBranchOperationHeadAdapter");async function qc(t,e){try{let r=await zd.default.getConfig({fs:e,dir:t,path:"user.legit-reference-branch"});if(r)return Xn(r)}catch{}try{let r=await zd.default.getConfig({fs:e,dir:t,path:"init.defaultBranch"});return Xn(r)||"main"}catch{return"main"}}u(qc,"He");y(qc,"getReferenceBranch");async function hC(t,e,r){await zd.default.setConfig({fs:e,dir:t,path:"user.legit-reference-branch",value:Ye(r)})}u(hC,"Wn");y(hC,"setReferenceBranch");function dC({gitStorageFs:t,gitRoot:e,rootPath:r}){return new Wt({name:"current-branch",gitStorageFs:t,gitRoot:e,rootPath:r||e,handler:{type:"gitCurrentBranchVirtualFile",rootType:"file",getStats:y(async i=>{let n=(await ve(e,t)).length;return{mode:420,size:n,isFile:y(()=>!0,"isFile"),isDirectory:y(()=>!1,"isDirectory"),isSymbolicLink:y(()=>!1,"isSymbolicLink"),isBlockDevice:y(()=>!1,"isBlockDevice"),isCharacterDevice:y(()=>!1,"isCharacterDevice"),isSocket:y(()=>!1,"isSocket"),isFIFO:y(()=>!1,"isFIFO"),isFileSync:y(()=>!0,"isFileSync"),isDirectorySync:y(()=>!1,"isDirectorySync"),dev:0,ino:0,nlink:1,uid:0,gid:0,rdev:0,blksize:4096,blocks:Math.ceil(n/4096),atimeMs:Date.now(),mtimeMs:Date.now(),ctimeMs:Date.now(),birthtimeMs:Date.now(),atime:new Date,mtime:new Date,ctime:new Date,birthtime:new Date}},"getStats"),getFile:y(async i=>{let n=await ve(e,t);return{type:"file",content:n+`
|
|
108
|
+
`,mode:420,size:n.length+1}},"getFile"),writeFile:y(async i=>{let{content:n}=i,s=n.toString().trim();if(!await me(t,e,s)){let a=await qc(e,t),l=await me(t,e,a);if(!l)throw new Error(`Ref branch ${a} does not exist in the repository`);await uC.default.branch({fs:t,dir:e,ref:Ye(s),object:l})}await cD(e,t,s)},"writeFile"),rename(i){throw new Error("not implemented")},mkdir:y(async function(i){throw new Error("not implemented")},"mkdir")}})}u(dC,"Gn");y(dC,"createCurrentBranchAdapter");function pC({gitStorageFs:t,gitRoot:e,rootPath:r}){return new Wt({name:"apply-changes",gitStorageFs:t,gitRoot:e,rootPath:r||e,handler:{type:"gitApplyCurrentChangesToVirtualFile",rootType:"file",getStats:y(async({pathParams:i,userSpaceFs:n})=>{let s=new Date(0);return{mode:420,size:40,isFile:y(()=>!0,"isFile"),isDirectory:y(()=>!1,"isDirectory"),isSymbolicLink:y(()=>!1,"isSymbolicLink"),isBlockDevice:y(()=>!1,"isBlockDevice"),isCharacterDevice:y(()=>!1,"isCharacterDevice"),isSocket:y(()=>!1,"isSocket"),isFIFO:y(()=>!1,"isFIFO"),isFileSync:y(()=>!0,"isFileSync"),isDirectorySync:y(()=>!1,"isDirectorySync"),dev:0,ino:0,nlink:1,uid:0,gid:0,rdev:0,blksize:4096,blocks:Math.ceil(.009765625),atimeMs:s,mtimeMs:s,ctimeMs:s,birthtimeMs:s,atime:s,mtime:s,ctime:s,birthtime:s}},"getStats"),getFile:y(async({pathParams:i,userSpaceFs:n})=>{try{return{type:"file",content:`
|
|
109
|
+
`,mode:420,size:2}}catch{return}},"getFile"),writeFile:y(async i=>{let{content:n,userSpaceFs:s}=i,a=await ve(e,t),l=await qc(e,t),c=n.toString().trim(),o=await me(t,e,a);if(!o)throw new Error(`Source branch ${a} does not exist`);let f=await me(t,e,l);if(!f)throw new Error(`Target branch ${l} does not exist`);let h=await Vn.default.readTree({fs:t,dir:e,oid:o});if(await Vn.default.readTree({fs:t,dir:e,oid:f})===h)return;let d=Math.floor(Date.now()/1e3),p=await Vn.default.commit({fs:t,dir:e,message:c,tree:h.oid,noUpdateBranch:!0,author:{...i.author,timestamp:d},parent:[f]}),m=await Vn.default.commit({fs:t,dir:e,message:"Changes from "+a+" applied to "+l,tree:h.oid,noUpdateBranch:!0,author:{...i.author,timestamp:d-3},parent:[o,p]});await Vn.default.writeRef({fs:t,dir:e,ref:"refs/heads/"+Ye(l),value:p,force:!0}),await Vn.default.writeRef({fs:t,dir:e,ref:"refs/heads/"+Ye(a),value:m,force:!0})},"writeFile"),rename(i){throw new Error("not implementsd")},mkdir:y(async function(i){throw new Error("not implemented")},"mkdir")}})}u(pC,"Kn");y(pC,"createApplyChangesAdapter");function mC({gitStorageFs:t,gitRoot:e,rootPath:r}){return new Wt({name:"reference-branch",gitStorageFs:t,gitRoot:e,rootPath:r||e,handler:{type:"gitReferenceBranchVirtualFile",rootType:"file",getStats:y(async i=>{let n=(await qc(e,t)).length;return{mode:420,size:n,isFile:y(()=>!0,"isFile"),isDirectory:y(()=>!1,"isDirectory"),isSymbolicLink:y(()=>!1,"isSymbolicLink"),isBlockDevice:y(()=>!1,"isBlockDevice"),isCharacterDevice:y(()=>!1,"isCharacterDevice"),isSocket:y(()=>!1,"isSocket"),isFIFO:y(()=>!1,"isFIFO"),isFileSync:y(()=>!0,"isFileSync"),isDirectorySync:y(()=>!1,"isDirectorySync"),dev:0,ino:0,nlink:1,uid:0,gid:0,rdev:0,blksize:4096,blocks:Math.ceil(n/4096),atimeMs:Date.now(),mtimeMs:Date.now(),ctimeMs:Date.now(),birthtimeMs:Date.now(),atime:new Date,mtime:new Date,ctime:new Date,birthtime:new Date}},"getStats"),getFile:y(async i=>{let n=await qc(e,t);return{type:"file",content:n+`
|
|
110
|
+
`,mode:420,size:n.length+1}},"getFile"),writeFile:y(async i=>{let{content:n}=i,s=n.toString().trim();if(!await me(t,e,s))throw new Error(`Branch ${s} does not exist in the repository`);await hC(e,t,s)},"writeFile"),rename(i){throw new Error("not implemented")},mkdir:y(async function(i){throw new Error("not implemented")},"mkdir")}})}u(mC,"Xn");y(mC,"createReferenceBranchAdapter");var So,yC=(So=class extends rs{constructor({name:e,rootPath:r,passThroughFs:i}){super({name:e,rootPath:r}),U(this,"openFh",new Map),U(this,"targetFs"),this.targetFs=i}async responsible(e){return!0}fileType(){return 4}async open(e,r,i){let n=wC.dirname(e),s=await this.targetFs.promises.open(e,r,i);return this.openFh.set(s.fd,s),new ko({fs:this,compositeFs:this.compositeFs,subFsFileDescriptor:s.fd,parentFsFileDescriptors:[]})}async access(e,r){return await this.targetFs.promises.access(e,r)}async stat(e,...r){return this.targetFs.promises.stat(e,{bigint:!1})}async lstat(e,...r){return this.targetFs.promises.lstat(e,{bigint:!1})}async opendir(e,r){let i=await this.targetFs.promises.opendir(e,r);return new Sb(this.compositeFs,e.toString())}async link(e,r){return await this.targetFs.promises.link(e,r)}async mkdir(e,r){await this.targetFs.promises.mkdir(e,r)}async readdir(e,...r){return this.targetFs.promises.readdir(e,...r)}async readlink(e,...r){throw new Error("not implemented")}async unlink(e){return await this.targetFs.promises.unlink(e)}async rename(e,r){return await this.targetFs.promises.rename(e,r)}async rmdir(e,r){return await this.targetFs.promises.rmdir(e,r)}async symlink(e,r,i){return await this.targetFs.promises.symlink(e,r,i)}async lookup(e){throw new Error(`lookup is not implemented for: ${Ne(e)}`)}async close(e){let r=this.openFh.get(e.subFsFileDescriptor);r&&(this.openFh.delete(e.subFsFileDescriptor),await r.close())}async dataSync(e){let r=this.openFh.get(e.subFsFileDescriptor);if(r)return await r.sync()}async read(e,r,i,n,s){let a=this.openFh.get(e.subFsFileDescriptor);if(a)return await a.read(r,i,n,s);throw new Error(`File handle not found: ${e.subFsFileDescriptor}`)}async fchmod(e,r){let i=this.openFh.get(e.subFsFileDescriptor);if(i)return await i.chmod(r)}async fchown(e,r,i){let n=this.openFh.get(e.subFsFileDescriptor);if(n)return await n.chown(r,i)}async write(e,r,i,n,s){let a=this.openFh.get(e.subFsFileDescriptor);if(a)return await a.write(r,i,n,s);throw new Error(`File handle not found: ${e.subFsFileDescriptor}`)}async ftruncate(e,r){let i=this.openFh.get(e.subFsFileDescriptor);if(i)return await i.truncate(r)}resolvePath(e){throw new Error(`resolvePath is not implemented: resolvePath(${e})`)}async fstat(e,r){let i=this.openFh.get(e.subFsFileDescriptor);if(i)return await i.stat(r);throw new Error(`File handle not found: ${e.subFsFileDescriptor}`)}async futimes(e,r,i){let n=this.openFh.get(e.subFsFileDescriptor);if(n)return await n.utimes(r,i)}async writev(e,r,i){let n=this.openFh.get(e.subFsFileDescriptor);if(n)return await n.writev(r,i??void 0);throw new Error(`File handle not found: ${e.subFsFileDescriptor}`)}async readv(e,r,i){let n=this.openFh.get(e.subFsFileDescriptor);if(n)return await n.readv(r,i??void 0);throw new Error(`File handle not found: ${e.subFsFileDescriptor}`)}async readFile(e,r){return this.targetFs.promises.readFile(e,r)}async writeFile(e,r,i){return this.targetFs.promises.writeFile(e,r,i)}},u(So,"ji"),So);y(yC,"PassThroughToAsyncFsSubFs");var nV=yC;function _b(t){return typeof t=="object"&&t!==null&&t!==void 0&&!Array.isArray(t)}u(_b,"Jn");y(_b,"isLegitRouteFolder");function Rb(t,e){let r={...t};for(let i of Object.keys(e)){let n=t[i],s=e[i];n!==void 0&&_b(n)&&_b(s)?r[i]=Rb(n,s):r[i]=s}return r}u(Rb,"qn");y(Rb,"mergeLegitRouteFolders");function Wd(t){return t&&t.gitCache!==void 0?t.gitCache:t&&t.parentFs?Wd(t.parentFs):{}}u(Wd,"Wi");y(Wd,"getGitCache");async function sV(t){let e=new tn.Volume,r=(0,tn.createFsFromVolume)(e);return Xd({...t,storageFs:t?.storageFs?t.storageFs:r,gitRoot:t?.gitRoot||"/"})}u(sV,"Jh");y(sV,"openLegitFsWithMemoryFs");async function Xd({storageFs:t,gitRoot:e,anonymousBranch:r="anonymous",showKeepFiles:i=!1,initialAuthor:n={type:"local",id:"local",name:"Local User",email:"local@legitcontrol.com"},serverUrl:s="https://hub.legitcontrol.com",publicKey:a,ephemaralGitConfig:l=!1,additionalFilterLayers:c,routeOverrides:o}){await t.promises.readdir(e+"/.git").then(()=>!0).catch(()=>!1)||(await He.default.init({fs:t,dir:"/",defaultBranch:r}),await t.promises.writeFile(e+"/.gitignore",""),await t.promises.writeFile(e+"/.keep",""),await He.default.add({fs:t,dir:"/",filepath:".keep",cache:Wd(t)}),await He.default.commit({fs:t,dir:"/",message:"Initial commit",author:{name:"Test",email:"test@example.com"},cache:Wd(t)}),await He.default.setConfig({fs:t,dir:e,path:"init.defaultBranch",value:r})),await He.default.getConfig({fs:t,dir:e,path:"user.legit_user_id"})||await He.default.setConfig({fs:t,dir:e,path:"user.legit_user_id",value:n.name}),await He.default.getConfig({fs:t,dir:e,path:"user.name"})||await He.default.setConfig({fs:t,dir:e,path:"user.name",value:n.name}),await He.default.getConfig({fs:t,dir:e,path:"user.email"})||await He.default.setConfig({fs:t,dir:e,path:"user.email",value:n.email});let f=(0,tn.createFsFromVolume)(new tn.Volume),h=new nN({name:"root-copy-on-write",sourceFs:t,copyToFs:f,copyToRootPath:"/copies",rootPath:e,patterns:l?["**/.git/config"]:[]}),d=new nV({name:"root-passthrough",passThroughFs:t,rootPath:e}),p=new iN({name:"root",filterLayers:[h],rootPath:e,routes:{"[[...relativePath]]":d}}),m={gitStorageFs:p,gitRoot:e,rootPath:e},w=aD(m),g=lC(m),b=sC(m),_=fC(m),S=fD(m),F=cC(m),k=dC(m),A=mC(m),v=pC(m),T=nC(m),E=iC(m),R=oC(m),P=aC(m),I=i?[".git"]:[".git",".keep"],B=new kH({name:"git-hidden-subfs",hiddenFiles:I,rootPath:e}),z=[];try{let le=e+"/.gitignore";z=(await p.readFile(le,"utf8")).split(`
|
|
111
|
+
`).filter(Re=>Re.trim()!==""&&!Re.trim().startsWith("#")).map(Re=>Re.trim())}catch{}let we=["**/._*","**/.DS_Store","**/.AppleDouble/","**/.AppleDB","**/.AppleDesktop","**/.Spotlight-V100","**/.TemporaryItems","**/.Trashes","**/.fseventsd","**/.VolumeIcon.icns","**/.ql_disablethumbnails","**/.~lock.*","**/lu[0-9a-zA-Z]*.tmp","**/.metaentries.json.tmp","**/**.tmp.**","**/**.sb-**",...z],st=(0,tn.createFsFromVolume)(new tn.Volume),Dt=new nN({name:"git-copy-on-write-subfs",sourceFs:p,copyToFs:st,copyToRootPath:"/user-copies",rootPath:e,patterns:we}),Ft={".legit":{".":w,operation:g,head:b,operationHead:_,operationHistory:S,history:F,currentBranch:k,"reference-branch":A,"apply-changes":v,branches:{".":T,"[branchName]":{".legit":{".":w,operation:g,head:b,operationHead:_,operationHistory:S,history:F},"[[...filePath]]":E}},commits:{".":R,"[sha_1_1_2]":{".":R,"[sha1_3__40]":{"[[...filePath]]":P}}}},"[[...filePath]]":{".":E}},Vo=o?Rb(Ft,o):Ft,us=new iN({name:"git",rootPath:e,filterLayers:[B,Dt,...c||[]],routes:Vo}),wt=tC({storageFs:p,gitRoot:e}),he=iV(wt,a),kt=xH({fs:t,gitRepoPath:e,serverUrl:s,auth:he,anonymousBranch:r}),De=Object.assign(us,{auth:he,sync:kt,_storageFs:p,setLogger(le){us.setLoggger(le)},push:y(async le=>{},"push"),shareCurrentBranch:y(async()=>{if((await he.getUser()).type==="local")throw new Error("login first - for example anonymously using legitfs.auth.signInAnonymously()");let le=await De.getCurrentBranch();return le===r&&(le=(await he.getUser()).id,await He.default.renameBranch({fs:t,dir:e,oldref:r,ref:le})),await kt.sequentialPush([le]),De.setCurrentBranch(le),le},"shareCurrentBranch"),setCurrentBranch:y(async le=>{(await He.default.listBranches({fs:t,dir:e})).includes(le)||await kt?.loadBranch(le);let Re=(await He.default.listBranches({fs:t,dir:e})).includes(le);if(console.log("branchExistsAfter",Re),!Re)throw new Error(`Branch ${le} does not exist`);await He.default.setConfig({fs:t,dir:e,path:"init.defaultBranch",value:le})},"setCurrentBranch"),getCurrentBranch:y(async()=>{let le=await He.default.getConfig({fs:t,dir:e,path:"init.defaultBranch"});if(!le)throw new Error("No current branch set");return le},"getCurrentBranch"),loadArchive:y(async le=>{let Re=rV(le),ke=new TextDecoder().decode(Re),Go=JSON.parse(ke),Er=new Map;try{let yt=await He.default.listBranches({fs:t,dir:e});for(let Ct of yt){let V=await He.default.resolveRef({fs:t,dir:e,ref:Ct});Er.set(Ct,V)}}catch{}for(let[yt,Ct]of Object.entries(Go.files)){let V=`${e}/.git/${yt}`;if(yt==="config")continue;let fe=Buffer.from(Ct,"base64");if(yt.startsWith("refs/heads/")||yt.startsWith("refs/tags/")){let Ce=yt.replace(/^refs\/(heads|tags)\//,"");if(!Er.has(Ce))await t.promises.mkdir(V.split("/").slice(0,-1).join("/"),{recursive:!0}),await t.promises.writeFile(V,fe);else{let at=Er.get(Ce),_i=fe.toString("utf-8").trim();try{if(await He.default.isDescendent({fs:t,dir:e,oid:_i,ancestor:at})||at===_i)await t.promises.writeFile(V,fe);else{let Vr=`${Ce}-conflict-${crypto.randomUUID()}`,Gr=`${e}/.git/refs/heads/${Vr}`;await t.promises.mkdir(Gr.split("/").slice(0,-1).join("/"),{recursive:!0}),await t.promises.writeFile(Gr,fe)}}catch{let Vr=`${Ce}-conflict-${crypto.randomUUID()}`,Gr=`${e}/.git/refs/heads/${Vr}`;await t.promises.mkdir(Gr.split("/").slice(0,-1).join("/"),{recursive:!0}),await t.promises.writeFile(Gr,fe)}}}else await t.promises.mkdir(V.split("/").slice(0,-1).join("/"),{recursive:!0}),await t.promises.writeFile(V,fe)}},"loadArchive"),saveArchive:y(async()=>{let le={version:1,files:{}};async function Re(yt,Ct=""){let V=await t.promises.readdir(yt,{withFileTypes:!0});for(let fe of V){let Ce=`${yt}/${fe.name}`,at=Ct?`${Ct}/${fe.name}`:fe.name;if(fe.isDirectory())await Re(Ce,at);else if(fe.isFile()){let _i=await t.promises.readFile(Ce);le.files[at]=Buffer.from(_i).toString("base64")}}}u(Re,"Me"),y(Re,"readDirectoryRecursive");let ke=`${e}/.git`;try{await Re(ke)}catch(yt){console.warn("Failed to read .git folder:",yt)}let Go=JSON.stringify(le),Er=new TextEncoder().encode(Go);return tV(Er)},"saveArchive")});return De}u(Xd,"il");y(Xd,"openLegitFs");var aie=y(t=>async e=>{if(!e.path.includes(".legit/branches/")||(e.path.match(/\.legit/g)||[]).length>1)return;let[r,i]=e.path.split(".legit/branches/"),[n,...s]=i.split("/"),a=s.join("/"),l=r+".legit/branches/"+n+"/.legit/operation",c=JSON.stringify(e.operationArgs,(o,f)=>Buffer.isBuffer(f)?{__buffer__:f.toString("base64")}:f);console.log(l,`[${e.fsName}].${e.operation}(${e.fd?e.fd.fd+" - ":""}${e.path})
|
|
112
112
|
|
|
113
113
|
${c}
|
|
114
114
|
|
|
115
|
-
`)},"createFsOperationFileLogger");var iN=le(YP(),1);import{createContext as h5,useContext as d5,useEffect as p5,useMemo as m5,useState as Tb,useCallback as vd}from"react";import{jsx as g5}from"react/jsx-runtime";var Wc="main",Pi="/.legit/branches",QP="/.legit/commits",ZP=l(t=>(t.startsWith("/")&&(t=t.slice(1)),`${Pi}/${Wc}/${t}`),"resolveThreadPath"),w5=l(t=>t instanceof Error?t:new Error(String(t??"Unknown error")),"normalizeError"),eN=h5(void 0);function y5({children:t}){let[e,r]=Tb(null),[i,n]=Tb(!0),[s,o]=Tb(null);p5(()=>{let d=!1,p=l(async()=>{try{let m=await Ni();d||(r(m),o(null),n(!1))}catch(m){if(!d){let w=w5(m);r(null),o(w),n(!1)}}},"load");return n(!0),o(null),p(),()=>{d=!0}},[]);let f=vd(async(d,p)=>{if(e){let m=ZP(d);await e.promises.writeFile(m,p)}},[e]),c=vd(async d=>{if(e){let p=await Yo(Wc);if(!p)return;let m=p.find(_=>_.oid===d),w=p.find(_=>_.oid===m?.parentOids[0]);if(!m||!w)return;let y=m?.parentOids[1],g=w?.originBranchOid;return!y||!g?void 0:{newOid:y,oldOid:g}}},[e]),a=vd(async(d,p)=>{if(e)return await rN(d,p)},[e]),u=vd(async d=>(e&&(console.log("rollback",d),await tN(Wc,d)),await Ed(Wc)),[e]),h=m5(()=>({legitFs:e,loading:i,error:s,saveData:f,getMessageDiff:c,getPastState:a,rollback:u,threadId:Wc,resolvePath:ZP}),[e,i,s,f]);return g5(eN.Provider,{value:h,children:t})}l(y5,"LegitFsProvider");function kb(){let t=d5(eN);if(t===void 0)throw new Error("useLegitFs must be used within a LegitFsProvider");return t}l(kb,"useLegitFs");var Fd=null;async function Ni(){return Fd||(Fd=Ah({storageFs:iN.default,gitRoot:"/"}),window&&(window.legitFs=await Fd)),Fd}l(Ni,"getLegitFs");async function nN(){let t=await Ni();try{return(await t.promises.readdir(Pi)).filter(r=>!r.startsWith("."))}catch(e){if(e.code==="ENOENT")return await t.promises.mkdir(Pi,{recursive:!0}),[];throw e}}l(nN,"listBranches");async function Ed(t){try{return await(await Ni()).promises.readFile(`${Pi}/${t}/.legit/head`,"utf8")}catch(e){throw console.error("Error reading head from path:",t,e),e}}l(Ed,"readHead");async function tN(t,e){try{await(await Ni()).promises.writeFile(`${Pi}/${t}/.legit/operationHead`,e,"utf8")}catch(r){throw console.error("Error writing head to path:",t,r),r}}l(tN,"writeOperationHead");async function sN(t,e){try{await(await Ni()).promises.writeFile(`${Pi}/${t}/.legit/operation`,e,"utf8")}catch(r){throw console.error("Error writing operation to path:",t,r),r}}l(sN,"writeOperation");async function Yo(t){try{let r=await(await Ni()).promises.readFile(`${Pi}/${t}/.legit/operationHistory`,"utf8");return r.length>0?JSON.parse(r):JSON.parse("[]")}catch(e){throw console.error("Error reading operation history from path:",t,e),e}}l(Yo,"readOperationHistory");async function rN(t,e){try{e.startsWith("/")&&(e=e.slice(1));let r=await Ni(),i=`${QP}/${t.slice(0,2)}/${t.slice(2)}/${e}`;return await r.promises.readFile(i,"utf8")}catch(r){throw console.error("Error reading past state from path:",t,r),r}}l(rN,"readPastState");var Td=l(async t=>{let e=[];for(let r of t){let i,n;try{i=JSON.parse(r.message),n={id:r.oid,height:e.length,parent_id:r.parentOids[0]===r.parentOids[1]?null:r.parentOids[0],metadata:{custom:{depending_branch_commit_id:r.originBranchOid??null}},...i},e.unshift(n)}catch{console.log("Skipping operation with invalid JSON message:",r);continue}}return e},"createUIMessages");var Rb=class Rb{async list(e,r){let i=await Yo(e);return{messages:(await Td(i)).map((o,f)=>({...o,height:f,created_at:new Date(o.created_at),updated_at:new Date(o.updated_at)}))}}async create(e,r){let i=`msg-${Date.now()}-${Math.random().toString(36).slice(2)}`,n={created_at:new Date,updated_at:new Date,format:r.format,content:r.content};return await sN(e,JSON.stringify(n)),{message_id:i}}};l(Rb,"LegitThreadMessages");var kd=Rb;var Ob=class Ob{constructor(){U(this,"messages",new kd)}async list(e){return{threads:(await nN()).map(i=>({id:i,title:i,last_message_at:new Date,metadata:{},external_id:null,project_id:"",created_at:new Date,updated_at:new Date,workspace_id:"local-workspace",is_archived:!1}))}}async create(e){return{thread_id:"main"}}async update(e,r){}async delete(e){}};l(Ob,"LegitThreads");var Rd=Ob;var Ab=class Ab extends Id{constructor(r){super(r);U(this,"runtime");U(this,"legitFs",null);this.legitFs=r.legitFs,this.threads=new Rd;let i=this.runs.stream;this.runs.stream=async n=>{if(!this.runtime)throw new Error("LegitLocal runtime not set");let f=this.runtime.thread.__internal_threadBinding?.getState?.()?.adapters?.chatModel?.options??{},c=new Headers;c.set("Content-Type","application/json");try{let a=await fetch(f.api??"/api/chat",{method:"POST",headers:c,credentials:f.credentials??"same-origin",body:JSON.stringify({messages:n.messages,system:n.system,tools:n.tools,runConfig:f.runConfig??{}})});if(!a.ok)throw new Error(`Request failed with status ${a.status}`);return $i.fromResponse(a,new Ld)}catch(a){return console.error("LegitLocal stream failed, falling back to default handler.",a),i.call(this.runs,n)}}}};l(Ab,"LegitLocal");var xb=Ab;import{ExportedMessageRepository as b5}from"@assistant-ui/react";var _5=l(t=>{if(t&&typeof t=="object"){let e=t,r=e.custom&&typeof e.custom=="object"?e.custom:{};return{...e,custom:r}}return{custom:{}}},"normalizeMetadata"),S5="aui/v0";function v5(t){if(t.format!==S5)return null;let e=t.content;if(!e||typeof e!="object")return null;let r=e.role;if(r!=="assistant"&&r!=="user"&&r!=="system")return null;let i=e.content??[],n=typeof i=="string"||Array.isArray(i)?i:[],s=e.createdAt instanceof Date?e.createdAt:e.createdAt?new Date(e.createdAt):new Date(t.created_at),o=_5(t.metadata);return{...e,role:r,content:n,id:e.id??t.id,createdAt:s,metadata:o}}l(v5,"toThreadMessageLike");async function Pb({threadId:t,threadApi:e}){console.log("sync initiated");let r=await Yo(t),n=(await Td(r)).map(v5).filter(s=>s!==null);e?.reset?.(n),e.import(b5.fromArray(n))}l(Pb,"syncThreadFromLegitFs");var oN=l(t=>{if(typeof t=="string")return t;if(t===void 0)return"";try{return JSON.stringify(t)}catch{return""}},"serializeStructuredData");var zc=l(t=>t==null?null:typeof t=="string"||typeof t=="number"||typeof t=="boolean"?t:Array.isArray(t)?t.map(e=>zc(e)):typeof t=="object"?Object.fromEntries(Object.entries(t).map(([e,r])=>[e,zc(r)])):JSON.stringify(t),"toJsonValue"),E5=l((t,e)=>e?typeof t=="string"?{type:"error-text",value:t}:{type:"error-json",value:zc(t)}:typeof t=="string"?{type:"text",value:t}:{type:"json",value:zc(t)},"buildToolResultOutput"),F5=l(t=>{switch(t.type){case"text":return{type:"text",text:typeof t.text=="string"?t.text:""};case"tool-call":return{type:"tool-call",toolCallId:typeof t.toolCallId=="string"?t.toolCallId:`unknown-${Date.now()}`,toolName:typeof t.toolName=="string"?t.toolName:"unknown",input:zc(t.args??t.input??{})};default:return null}},"mapAssistantContentPart"),T5=l(t=>t.type!=="tool-result"?null:{type:"tool-result",toolCallId:typeof t.toolCallId=="string"?t.toolCallId:`unknown-${Date.now()}`,toolName:typeof t.toolName=="string"?t.toolName:"unknown",output:E5(t.result??t.output,!!t.isError)},"mapToolContentPart"),ZZ=l(t=>t.map(e=>{let r=Array.isArray(e.content)?e.content:[];switch(e.role){case"system":return{role:"system",content:r.map(n=>n.type==="text"&&typeof n.text=="string"?n.text:"").join("")};case"user":return{role:"user",content:r.map(n=>{switch(n.type){case"text":return{type:"text",text:typeof n.text=="string"?n.text:""};default:return null}}).filter(Boolean)};case"assistant":return{role:"assistant",content:r.map(n=>F5(n)).filter(Boolean)};case"tool":{let i=r.map(n=>T5(n)).filter(Boolean);return i.length>0?{role:"tool",content:i}:null}default:return null}}).filter(e=>e!==null),"convertMessagesToModelMessages");async function QZ(t){let[e,r]=la();(async()=>{try{let n=null,s=new Map;for await(let o of t.fullStream)switch(o.type){case"text-start":n=r.addTextPart();break;case"text-delta":n||(n=r.addTextPart()),n.append(o.text);break;case"text-end":n?.close(),n=null;break;case"tool-input-start":{let f=o.id;if(!s.has(f)){let c=r.addToolCallPart({toolCallId:f,toolName:o.toolName});s.set(f,c)}break}case"tool-input-delta":{let f=o.id,c=s.get(f);c&&c.argsText.append(o.delta);break}case"tool-input-end":{let f=o.id,c=s.get(f);c&&c.argsText.close();break}case"tool-call":{let f=o.toolCallId;if(!s.get(f)){let a=r.addToolCallPart({toolCallId:f,toolName:o.toolName,args:o.input});s.set(f,a)}break}case"tool-result":{let f=o.toolCallId,c=s.get(f);c&&c.setResponse({result:oN(o.output),isError:!1});break}case"tool-error":{let f=o.toolCallId,c=s.get(f);c&&c.setResponse({result:oN(o.error),isError:!0});break}case"start-step":{let f=`msg-${Date.now()}-${Math.random().toString(36).slice(2)}`;r.enqueue({type:"step-start",path:[],messageId:f});break}case"finish-step":{let f=o.usage;r.enqueue({type:"step-finish",path:[],finishReason:o.finishReason,usage:{promptTokens:f.promptTokens??f.prompt?.tokens??0,completionTokens:f.completionTokens??f.completion?.tokens??0},isContinued:!1});break}case"finish":{let f=o.totalUsage;r.enqueue({type:"message-finish",path:[],finishReason:o.finishReason,usage:{promptTokens:f.promptTokens??f.prompt?.tokens??0,completionTokens:f.completionTokens??f.completion?.tokens??0}});break}case"error":{r.enqueue({type:"error",path:[],error:o.error instanceof Error?o.error.message:typeof o.error=="string"?o.error:"Unknown error"});break}case"start":case"abort":case"raw":case"reasoning-start":case"reasoning-delta":case"reasoning-end":case"source":case"file":break}n?.close(),s.forEach(o=>o.close()),r.close()}catch(n){r.enqueue({type:"error",path:[],error:n instanceof Error?n.message:typeof n=="string"?n:"Unknown error"}),r.close()}})();let i=new Md;return $i.toResponse(e,i)}l(QZ,"streamTextToDataStreamResponse");import{useEffect as k5}from"react";import{useAssistantApi as R5}from"@assistant-ui/react";var O5=100;function aQ(){let{legitFs:t,threadId:e}=kb(),i=R5().thread();return k5(()=>{if(!t||!e)return;let n=!1,s,o=null,f=l(()=>{n||(s=setTimeout(c,O5))},"scheduleNext"),c=l(async()=>{try{let a=await Ed(e);if(n||a===o)return;let{isRunning:u,isLoading:h}=i.getState();if(u||h)return;setTimeout(async()=>{await Pb({threadId:e,threadApi:i}),o=a},100)}catch(a){a.code!=="ENOENT"&&console.error("Failed to poll Legit head",a)}finally{f()}},"tick");return f(),()=>{n=!0,s!==void 0&&clearTimeout(s)}},[t,i,e]),null}l(aQ,"LegitFsHeadPoller");export{aQ as LegitFsHeadPoller,y5 as LegitFsProvider,xb as LegitLocal,ZZ as convertMessagesToModelMessages,QZ as streamTextToDataStreamResponse,Pb as syncThreadFromLegitFs,kb as useLegitFs};
|
|
115
|
+
`)},"createFsOperationFileLogger"),Eo,gC=(Eo=class extends rs{constructor({name:e,rootPath:r}){super({name:e,rootPath:r}),U(this,"memFs"),U(this,"openFh",{}),this.memFs=(0,Qd.createFsFromVolume)(new Qd.Volume)}isWriteSupported(){return!0}async responsible(e){return!0}getRouteParams(){return this.context?.params||{}}getStaticSiblings(){return this.context?.staticSiblings||[]}async open(e,r,i){if(!this.isWriteSupported()&&(r.includes("w")||r.includes("a")))throw new Error("Write operations not allowed");r.includes("x");let n=!1;try{await this.getStats({path:e,context:this.context}),n=!0}catch{n=!1}let s=!1;for(let f of Object.values(this.openFh))f.path===e&&(s=!0);if((n||s)&&r.includes("x"))throw Object.assign(new Error(`EEXIST: file already exists, open '${e}'`),{code:"EEXIST",errno:-17,syscall:"open",path:e});if(!n&&!s&&!(r.includes("w")||r.includes("a")))throw Object.assign(new Error(`ENOENT: no such file or directory, open '${e}'`),{code:"ENOENT",errno:-2,syscall:"open",path:e});let a=vb.dirname(e);if(await this.memFs.promises.mkdir(a,{recursive:!0}),n)try{await this.memFs.promises.access(e)}catch{await this.memFs.promises.writeFile(e,"")}let l=await this.memFs.promises.open(e,r,i),c=l.fd,o=new ko({fs:this,compositeFs:this.compositeFs,subFsFileDescriptor:c,parentFsFileDescriptors:[]});return this.openFh[c]={path:e,mode:r,fh:l,unflushed:[]},(r.includes("x")||r.includes("w"))&&this.openFh[c].unflushed.push({length:0,start:0}),o}async mkdir(e,r){let i=e.toString();try{await this.createDirectory({path:i,recursive:!0,context:this.context});let n=typeof r=="object"?{...r,recursive:!0}:{recursive:!0};await this.memFs.promises.mkdir(e,n);let s=i.split("/"),a="";for(let l=1;l<=s.length;l++){a=s.slice(0,l).join("/");try{if((await this.memFs.promises.stat(a)).isDirectory()){let c=await this.memFs.promises.open(a,"r");this.openFh[c.fd]={path:a,mode:"r",fh:c,unflushed:[]}}}catch{}}}catch(n){throw n}}async access(e,r){await this.stat(e)}async futimes(e,r,i){let n=this.openFh[e.subFsFileDescriptor];if(!n)throw new Error("Invalid file handle");return await n.fh.utimes(r,i)}async fstat(e,r){let i=this.openFh[e.subFsFileDescriptor];if(!i)throw new Error("Invalid file handle");return this.stat(i.path,r)}async ftruncate(e,r){let i=this.openFh[e.subFsFileDescriptor];if(!i)throw new Error("Invalid file handle");return i.unflushed.push({length:0,start:0}),await i.fh.truncate(r)}async stat(e,r){let i=e.toString(),n=Object.values(this.openFh).find(s=>s.path===i&&s.unflushed.length>0);return n&&n.unflushed.length>0?await n.fh.stat(r):this.getStats({path:i,context:this.context})}async lstat(e,r){return this.stat(e,r)}async readdir(e,r){let i=e.toString(),n=this.getStaticSiblings(),s=await this.readDirectory({path:i,context:this.context}),a=Array.from(new Set([...s,...n.map(l=>zr({name:l.segment,parent:i,isDir:l.type==="folder"}))])).sort((l,c)=>l.name.localeCompare(c.name,void 0,{numeric:!0,sensitivity:"base"}));return r?.withFileTypes?a:a.map(l=>l.name)}async read(e,r,i,n,s){let a=e.subFsFileDescriptor,l=this.openFh[a];if(!l)throw new Error("Invalid file handle");if(l.unflushed.length===0){let c=await this.readFileContent({path:l.path,context:this.context});if(!c?.content)throw new Error("couldnt access content");let o=typeof c.content=="string"?Buffer.from(c.content):c.content,f=typeof s=="number"?s:0,h=Math.min(f+n,o.length),d=Math.max(0,h-f);return o.copy(r,i,f,f+d),{bytesRead:d,buffer:r}}return await l.fh.read(r,i,n,s)}async write(e,r,i,n,s){let a=this.openFh[e.subFsFileDescriptor];if(!a)throw new Error("Invalid file handle");let l=a.mode;if(!l.includes("w")&&!l.includes("a")&&!l.includes("+"))throw Object.assign(new Error("EBADF: bad file descriptor, write"),{code:"EBADF",errno:-9,syscall:"write"});if(a.unflushed.length===0){let h=await this.readFileContent({path:a.path,context:this.context});h&&h.content&&await this.memFs.promises.writeFile(a.path,h.content)}let c=await a.fh.write(r,i,n,s),o=i??0,f=s??0;return a.unflushed.push({start:f,length:n||r.byteLength-o+f}),c}async close(e){let r=e.subFsFileDescriptor,i=this.openFh[r];if(!i)throw new Error("Invalid file handle");try{await this.dataSync(e),await i.fh.close()}finally{delete this.openFh[r]}}async dataSync(e){let r=e.subFsFileDescriptor,i=this.openFh[r];if(!i)throw new Error("Invalid file handle");if(i.unflushed.length>0){let n=await this.memFs.promises.readFile(i.path);await this.writeFileContent({path:i.path,content:n,context:this.context}),i.unflushed=[]}}async readFile(e,r){let i=typeof e=="string"?e:Buffer.isBuffer(e)?e.toString():e.fd?`FileHandle(${e.fd})`:e.toString(),n=null;typeof r=="string"?n=r:r&&typeof r=="object"&&r.encoding&&(n=r.encoding);let s=await this.open(i,"r");try{let a=(await this.fstat(s)).size,l=Buffer.alloc(a);return await this.read(s,l,0,a,0),await this.close(s),n?l.toString(n):l}catch(a){try{await this.close(s)}catch{}throw a}}async writeFile(e,r,i){let n="w",s="utf8",a;typeof i=="string"?s=i:i&&typeof i=="object"&&(i.flag&&(n=String(i.flag)),i.encoding&&(s=i.encoding),i.mode&&(a=typeof i.mode=="string"?parseInt(i.mode,8):i.mode));let l=await this.open(e,n,a);try{let c;typeof r=="string"?c=Buffer.from(r,s):Buffer.isBuffer(r)?c=r:r instanceof Uint8Array?c=Buffer.from(r):ArrayBuffer.isView(r)?c=Buffer.from(r.buffer,r.byteOffset,r.byteLength):c=Buffer.from(r),await this.write(l,c,0,c.length,0)}finally{await this.close(l)}}async rename(e,r){let i=e.toString(),n=r.toString();if(await this.memFs.promises.access(i).then(()=>!0).catch(()=>!1)){let s=vb.dirname(n);try{await this.memFs.promises.access(s)}catch{await this.memFs.promises.mkdir(s,{recursive:!0})}await this.memFs.promises.rename(e,r)}await this.renamePath({oldPath:i,newPath:n,oldContext:this.context,newContext:this.newContext||this.context})}async fchmod(e,r){}async unlink(e){let r=e.toString();try{await this.deleteFile({path:r,context:this.context})}catch(i){let n=!1;for(let[s,a]of Object.entries(this.openFh))a.path===r&&a.unflushed.length>0&&(n=!0);if(!n)throw i}finally{let i=!1;for(let[n,s]of Object.entries(this.openFh))s.path===r&&(i=!0,await s.fh.close(),delete this.openFh[Number(n)]);i&&await this.memFs.promises.unlink(r)}}async rmdir(e,...r){let i=e.toString();await this.removeDirectory({path:i,context:this.context});let n=!1;for(let[s,a]of Object.entries(this.openFh))a.path===i&&(n=!0,await a.fh.close(),delete this.openFh[Number(s)]);n&&await this.memFs.promises.rmdir(i,{recursive:!0})}fileType(){return 10}},u(Eo,"Ki"),Eo);y(gC,"ASimpleCompositeSubfs");var oV=gC,Fo,lV=(Fo=class extends oV{constructor({name:e,rootPath:r,initialData:i}){super({name:e,rootPath:r}),U(this,"storage",new Map),U(this,"nextFileType",1),this.storage.set("/",{type:"directory",entries:new Set,mode:493,createdAt:new Date,modifiedAt:new Date}),i&&this.populateFromInitialData(i,"/")}_debugGetStorage(){return this.storage}populateFromInitialData(e,r){if(typeof e=="string"){this.storage.set(r,{type:"file",content:Buffer.from(e,"utf8"),mode:420,createdAt:new Date,modifiedAt:new Date});let i=this.getParentPath(r);if(i){let n=this.storage.get(i);n&&n.type==="directory"&&n.entries.add(this.getBaseName(r))}}else{let i=this.storage.get(r);if(i&&i.type==="directory")for(let[n,s]of Object.entries(e)){let a=r==="/"?`/${n}`:`${r}/${n}`;i.entries.add(n),this.populateFromInitialData(s,a)}else{let n=new Date;this.storage.set(r,{type:"directory",entries:new Set,mode:493,createdAt:n,modifiedAt:n});let s=this.getParentPath(r);if(s){let l=this.storage.get(s);l&&l.type==="directory"&&l.entries.add(this.getBaseName(r))}let a=this.storage.get(r);if(a&&a.type==="directory")for(let[l,c]of Object.entries(e)){let o=r==="/"?`/${l}`:`${r}/${l}`;a.entries.add(l),this.populateFromInitialData(c,o)}}}}fileType(){return this.nextFileType}async createDirectory(e){let{path:r,recursive:i=!1}=e,n=this.normalizePath(r);if(this.storage.has(n)){if(this.storage.get(n)?.type==="directory")return;throw Object.assign(new Error(`EEXIST: file already exists, mkdir '${r}'`),{code:"EEXIST",errno:-17,syscall:"mkdir",path:n})}if(i){let l=this.getParentPath(n);l&&l!==n&&!this.storage.has(l)&&await this.createDirectory({path:l,recursive:!0,context:e.context})}let s=new Date;this.storage.set(n,{type:"directory",entries:new Set,mode:493,createdAt:s,modifiedAt:s});let a=this.getParentPath(n);if(a){let l=this.storage.get(a);l&&l.type==="directory"&&(l.entries.add(this.getBaseName(n)),l.modifiedAt=s)}}async getStats(e){let r=this.normalizePath(e.path),i=this.storage.get(r);if(!i)throw Object.assign(new Error(`ENOENT: no such file or directory, stat '${e.path}'`),{code:"ENOENT",errno:-2,syscall:"stat",path:r});let n=new aV,s=i.type==="directory"?16877:33188;return n.mode=s,n.size=i.type==="file"?i.content.length:4096,n.mtimeMs=i.modifiedAt.getTime(),n.birthtimeMs=i.createdAt.getTime(),n.ctimeMs=i.modifiedAt.getTime(),n}async readFileContent(e){let r=this.normalizePath(e.path),i=this.storage.get(r);if(!(!i||i.type!=="file"))return{content:i.content}}async writeFileContent(e){let r=this.normalizePath(e.path),i=new Date,n=typeof e.content=="string"?Buffer.from(e.content,"utf8"):e.content,s=this.storage.get(r);if(s){if(s.type==="directory")throw Object.assign(new Error(`EISDIR: illegal operation on a directory, write '${e.path}'`),{code:"EISDIR",errno:-21,syscall:"write",path:r});s.content=n,s.modifiedAt=i}else{this.storage.set(r,{type:"file",content:n,mode:420,createdAt:i,modifiedAt:i});let a=this.getParentPath(r);if(a){let l=this.storage.get(a);l||(await this.createDirectory({path:a,recursive:!0,context:e.context}),l=this.storage.get(a)),l&&l.type==="directory"&&(l.entries.add(this.getBaseName(r)),l.modifiedAt=i)}}}async readDirectory(e){let r=this.normalizePath(e.path),i=this.storage.get(r);if(!i)throw Object.assign(new Error(`ENOENT: no such file or directory, scandir '${e.path}'`),{code:"ENOENT",errno:-2,syscall:"scandir",path:r});if(i.type!=="directory")throw Object.assign(new Error(`ENOTDIR: not a directory, scandir '${e.path}'`),{code:"ENOTDIR",errno:-20,syscall:"scandir",path:r});let n=[];for(let s of i.entries){let a;r==="/"?a="/"+s:a=r+"/"+s;let l=this.storage.get(a);l&&n.push(zr({name:s,parent:r,isDir:l.type==="directory"}))}return n}async renamePath(e){let r=this.normalizePath(e.oldPath),i=this.normalizePath(e.newPath),n=this.storage.get(r);if(!n)throw Object.assign(new Error(`ENOENT: no such file or directory, rename '${e.oldPath}'`),{code:"ENOENT",errno:-2,syscall:"rename",path:r});let s=this.getParentPath(r);if(s){let l=this.storage.get(s);l&&l.type==="directory"&&l.entries.delete(this.getBaseName(r))}this.storage.delete(r),this.storage.set(i,n),n.modifiedAt=new Date;let a=this.getParentPath(i);if(a){let l=this.storage.get(a);l&&l.type==="directory"&&(l.entries.add(this.getBaseName(i)),l.modifiedAt=new Date)}if(n.type==="directory"){let l=Array.from(n.entries);for(let c of l){let o=this.joinPath(r,c),f=this.joinPath(i,c);await this.renamePath({oldPath:o,newPath:f,oldContext:e.oldContext,newContext:e.newContext})}}}async deleteFile(e){let r=this.normalizePath(e.path),i=this.storage.get(r);if(!i)throw Object.assign(new Error(`ENOENT: no such file or directory, unlink '${e.path}'`),{code:"ENOENT",errno:-2,syscall:"unlink",path:r});if(i.type==="directory")throw Object.assign(new Error(`EISDIR: illegal operation on a directory, unlink '${e.path}'`),{code:"EISDIR",errno:-21,syscall:"unlink",path:r});let n=this.getParentPath(r);if(n){let s=this.storage.get(n);s&&s.type==="directory"&&(s.entries.delete(this.getBaseName(r)),s.modifiedAt=new Date)}this.storage.delete(r)}async removeDirectory(e){let r=this.normalizePath(e.path),i=this.storage.get(r);if(!i)throw Object.assign(new Error(`ENOENT: no such file or directory, rmdir '${e.path}'`),{code:"ENOENT",errno:-2,syscall:"rmdir",path:r});if(i.type!=="directory")throw Object.assign(new Error(`ENOTDIR: not a directory, rmdir '${e.path}'`),{code:"ENOTDIR",errno:-20,syscall:"rmdir",path:r});let n=Array.from(i.entries);for(let a of n){let l=this.joinPath(r,a),c=this.storage.get(l);c&&(c.type==="directory"?await this.removeDirectory({path:l,context:e.context}):await this.deleteFile({path:l,context:e.context}))}let s=this.getParentPath(r);if(s){let a=this.storage.get(s);a&&a.type==="directory"&&(a.entries.delete(this.getBaseName(r)),a.modifiedAt=new Date)}this.storage.delete(r)}normalizePath(e){if(!e||e===".")return"/";let r=e.startsWith("/")?e:"/"+e;r!=="/"&&r.endsWith("/")&&(r=r.slice(0,-1));let i=r.split("/").filter(Boolean),n=[];for(let s of i)s!=="."&&(s===".."?n.pop():n.push(s));return"/"+n.join("/")}getParentPath(e){let r=this.normalizePath(e);if(r==="/")return null;let i=r.lastIndexOf("/");return i===0?"/":r.substring(0,i)||"/"}getBaseName(e){let r=this.normalizePath(e);if(r==="/")return"";let i=r.lastIndexOf("/");return r.substring(i+1)}joinPath(...e){return"/"+e.filter(Boolean).map(r=>r.startsWith("/")?r.slice(1):r).filter(r=>r!==".").join("/")}},u(Fo,"Xi"),Fo);y(lV,"SimpleMemorySubFs");var kI=de(bI(),1);import{createContext as fK,useContext as uK,useEffect as hK,useMemo as dK,useState as v_,useCallback as Hp}from"react";import{jsx as wK}from"react/jsx-runtime";var Xc="main",ln="/.legit/branches",vI="/.legit/commits",_I=u(t=>(t.startsWith("/")&&(t=t.slice(1)),`${ln}/${Xc}/${t}`),"resolveThreadPath"),pK=u(t=>t instanceof Error?t:new Error(String(t??"Unknown error")),"normalizeError"),SI=fK(void 0);function mK({children:t}){let[e,r]=v_(null),[i,n]=v_(!0),[s,a]=v_(null);hK(()=>{let d=!1,p=u(async()=>{try{let m=await cn();d||(r(m),a(null),n(!1))}catch(m){if(!d){let w=pK(m);r(null),a(w),n(!1)}}},"load");return n(!0),a(null),p(),()=>{d=!0}},[]);let l=Hp(async(d,p)=>{if(e){let m=_I(d);await e.promises.writeFile(m,p)}},[e]),c=Hp(async d=>{if(e){let p=await Ho(Xc);if(!p)return;let m=p.find(_=>_.oid===d),w=p.find(_=>_.oid===m?.parentOids[0]);if(!m||!w)return;let g=m?.parentOids[1],b=w?.originBranchOid;return!g||!b?void 0:{newOid:g,oldOid:b}}},[e]),o=Hp(async(d,p)=>{if(e)return await FI(d,p)},[e]),f=Hp(async d=>(e&&(console.log("rollback",d),await EI(Xc,d)),await Vp(Xc)),[e]),h=dK(()=>({legitFs:e,loading:i,error:s,saveData:l,getMessageDiff:c,getPastState:o,rollback:f,threadId:Xc,resolvePath:_I}),[e,i,s,l]);return wK(SI.Provider,{value:h,children:t})}u(mK,"LegitFsProvider");function S_(){let t=uK(SI);if(t===void 0)throw new Error("useLegitFs must be used within a LegitFsProvider");return t}u(S_,"useLegitFs");var Gp=null;async function cn(){return Gp||(Gp=Xd({storageFs:kI.default,gitRoot:"/"}),window&&(window.legitFs=await Gp)),Gp}u(cn,"getLegitFs");async function TI(){let t=await cn();try{return(await t.promises.readdir(ln)).filter(r=>!r.startsWith("."))}catch(e){if(e.code==="ENOENT")return await t.promises.mkdir(ln,{recursive:!0}),[];throw e}}u(TI,"listBranches");async function Vp(t){try{return await(await cn()).promises.readFile(`${ln}/${t}/.legit/head`,"utf8")}catch(e){throw console.error("Error reading head from path:",t,e),e}}u(Vp,"readHead");async function EI(t,e){try{await(await cn()).promises.writeFile(`${ln}/${t}/.legit/operationHead`,e,"utf8")}catch(r){throw console.error("Error writing head to path:",t,r),r}}u(EI,"writeOperationHead");async function xI(t,e){try{await(await cn()).promises.writeFile(`${ln}/${t}/.legit/operation`,e,"utf8")}catch(r){throw console.error("Error writing operation to path:",t,r),r}}u(xI,"writeOperation");async function Ho(t){try{let r=await(await cn()).promises.readFile(`${ln}/${t}/.legit/operationHistory`,"utf8");return r.length>0?JSON.parse(r):JSON.parse("[]")}catch(e){throw console.error("Error reading operation history from path:",t,e),e}}u(Ho,"readOperationHistory");async function FI(t,e){try{e.startsWith("/")&&(e=e.slice(1));let r=await cn(),i=`${vI}/${t.slice(0,2)}/${t.slice(2)}/${e}`;return await r.promises.readFile(i,"utf8")}catch(r){throw console.error("Error reading past state from path:",t,r),r}}u(FI,"readPastState");var Zp=u(async t=>{let e=[];for(let r of t){let i,n;try{i=JSON.parse(r.message),n={id:r.oid,height:e.length,parent_id:r.parentOids[0]===r.parentOids[1]?null:r.parentOids[0],metadata:{custom:{depending_branch_commit_id:r.originBranchOid??null}},...i},e.unshift(n)}catch{console.log("Skipping operation with invalid JSON message:",r);continue}}return e},"createUIMessages");var E_=class E_{async list(e,r){let i=await Ho(e);return{messages:(await Zp(i)).map((a,l)=>({...a,height:l,created_at:new Date(a.created_at),updated_at:new Date(a.updated_at)}))}}async create(e,r){let i=`msg-${Date.now()}-${Math.random().toString(36).slice(2)}`,n={created_at:new Date,updated_at:new Date,format:r.format,content:r.content};return await xI(e,JSON.stringify(n)),{message_id:i}}};u(E_,"LegitThreadMessages");var Kp=E_;var F_=class F_{constructor(){W(this,"messages",new Kp)}async list(e){return{threads:(await TI()).map(i=>({id:i,title:i,last_message_at:new Date,metadata:{},external_id:null,project_id:"",created_at:new Date,updated_at:new Date,workspace_id:"local-workspace",is_archived:!1}))}}async create(e){return{thread_id:"main"}}async update(e,r){}async delete(e){}};u(F_,"LegitThreads");var Jp=F_;var T_=class T_ extends rm{constructor(r){super(r);W(this,"runtime");W(this,"legitFs",null);this.legitFs=r.legitFs,this.threads=new Jp;let i=this.runs.stream;this.runs.stream=async n=>{if(!this.runtime)throw new Error("LegitLocal runtime not set");let l=this.runtime.thread.__internal_threadBinding?.getState?.()?.adapters?.chatModel?.options??{},c=new Headers;c.set("Content-Type","application/json");try{let o=await fetch(l.api??"/api/chat",{method:"POST",headers:c,credentials:l.credentials??"same-origin",body:JSON.stringify({messages:n.messages,system:n.system,tools:n.tools,runConfig:l.runConfig??{}})});if(!o.ok)throw new Error(`Request failed with status ${o.status}`);return un.fromResponse(o,new am)}catch(o){return console.error("LegitLocal stream failed, falling back to default handler.",o),i.call(this.runs,n)}}}};u(T_,"LegitLocal");var k_=T_;import{ExportedMessageRepository as yK}from"@assistant-ui/react";var gK=u(t=>{if(t&&typeof t=="object"){let e=t,r=e.custom&&typeof e.custom=="object"?e.custom:{};return{...e,custom:r}}return{custom:{}}},"normalizeMetadata"),bK="aui/v0";function _K(t){if(t.format!==bK)return null;let e=t.content;if(!e||typeof e!="object")return null;let r=e.role;if(r!=="assistant"&&r!=="user"&&r!=="system")return null;let i=e.content??[],n=typeof i=="string"||Array.isArray(i)?i:[],s=e.createdAt instanceof Date?e.createdAt:e.createdAt?new Date(e.createdAt):new Date(t.created_at),a=gK(t.metadata);return{...e,role:r,content:n,id:e.id??t.id,createdAt:s,metadata:a}}u(_K,"toThreadMessageLike");async function x_({threadId:t,threadApi:e}){console.log("sync initiated");let r=await Ho(t),n=(await Zp(r)).map(_K).filter(s=>s!==null);e?.reset?.(n),e.import(yK.fromArray(n))}u(x_,"syncThreadFromLegitFs");var OI=u(t=>{if(typeof t=="string")return t;if(t===void 0)return"";try{return JSON.stringify(t)}catch{return""}},"serializeStructuredData");var Qc=u(t=>t==null?null:typeof t=="string"||typeof t=="number"||typeof t=="boolean"?t:Array.isArray(t)?t.map(e=>Qc(e)):typeof t=="object"?Object.fromEntries(Object.entries(t).map(([e,r])=>[e,Qc(r)])):JSON.stringify(t),"toJsonValue"),vK=u((t,e)=>e?typeof t=="string"?{type:"error-text",value:t}:{type:"error-json",value:Qc(t)}:typeof t=="string"?{type:"text",value:t}:{type:"json",value:Qc(t)},"buildToolResultOutput"),SK=u(t=>{switch(t.type){case"text":return{type:"text",text:typeof t.text=="string"?t.text:""};case"tool-call":return{type:"tool-call",toolCallId:typeof t.toolCallId=="string"?t.toolCallId:`unknown-${Date.now()}`,toolName:typeof t.toolName=="string"?t.toolName:"unknown",input:Qc(t.args??t.input??{})};default:return null}},"mapAssistantContentPart"),EK=u(t=>t.type!=="tool-result"?null:{type:"tool-result",toolCallId:typeof t.toolCallId=="string"?t.toolCallId:`unknown-${Date.now()}`,toolName:typeof t.toolName=="string"?t.toolName:"unknown",output:vK(t.result??t.output,!!t.isError)},"mapToolContentPart"),ise=u(t=>t.map(e=>{let r=Array.isArray(e.content)?e.content:[];switch(e.role){case"system":return{role:"system",content:r.map(n=>n.type==="text"&&typeof n.text=="string"?n.text:"").join("")};case"user":return{role:"user",content:r.map(n=>{switch(n.type){case"text":return{type:"text",text:typeof n.text=="string"?n.text:""};default:return null}}).filter(Boolean)};case"assistant":return{role:"assistant",content:r.map(n=>SK(n)).filter(Boolean)};case"tool":{let i=r.map(n=>EK(n)).filter(Boolean);return i.length>0?{role:"tool",content:i}:null}default:return null}}).filter(e=>e!==null),"convertMessagesToModelMessages");async function nse(t){let[e,r]=rl();(async()=>{try{let n=null,s=new Map;for await(let a of t.fullStream)switch(a.type){case"text-start":n=r.addTextPart();break;case"text-delta":n||(n=r.addTextPart()),n.append(a.text);break;case"text-end":n?.close(),n=null;break;case"tool-input-start":{let l=a.id;if(!s.has(l)){let c=r.addToolCallPart({toolCallId:l,toolName:a.toolName});s.set(l,c)}break}case"tool-input-delta":{let l=a.id,c=s.get(l);c&&c.argsText.append(a.delta);break}case"tool-input-end":{let l=a.id,c=s.get(l);c&&c.argsText.close();break}case"tool-call":{let l=a.toolCallId;if(!s.get(l)){let o=r.addToolCallPart({toolCallId:l,toolName:a.toolName,args:a.input});s.set(l,o)}break}case"tool-result":{let l=a.toolCallId,c=s.get(l);c&&c.setResponse({result:OI(a.output),isError:!1});break}case"tool-error":{let l=a.toolCallId,c=s.get(l);c&&c.setResponse({result:OI(a.error),isError:!0});break}case"start-step":{let l=`msg-${Date.now()}-${Math.random().toString(36).slice(2)}`;r.enqueue({type:"step-start",path:[],messageId:l});break}case"finish-step":{let l=a.usage;r.enqueue({type:"step-finish",path:[],finishReason:a.finishReason,usage:{promptTokens:l.promptTokens??l.prompt?.tokens??0,completionTokens:l.completionTokens??l.completion?.tokens??0},isContinued:!1});break}case"finish":{let l=a.totalUsage;r.enqueue({type:"message-finish",path:[],finishReason:a.finishReason,usage:{promptTokens:l.promptTokens??l.prompt?.tokens??0,completionTokens:l.completionTokens??l.completion?.tokens??0}});break}case"error":{r.enqueue({type:"error",path:[],error:a.error instanceof Error?a.error.message:typeof a.error=="string"?a.error:"Unknown error"});break}case"start":case"abort":case"raw":case"reasoning-start":case"reasoning-delta":case"reasoning-end":case"source":case"file":break}n?.close(),s.forEach(a=>a.close()),r.close()}catch(n){r.enqueue({type:"error",path:[],error:n instanceof Error?n.message:typeof n=="string"?n:"Unknown error"}),r.close()}})();let i=new sm;return un.toResponse(e,i)}u(nse,"streamTextToDataStreamResponse");import{useEffect as FK}from"react";import{useAssistantApi as kK}from"@assistant-ui/react";var TK=100;function hse(){let{legitFs:t,threadId:e}=S_(),i=kK().thread();return FK(()=>{if(!t||!e)return;let n=!1,s,a=null,l=u(()=>{n||(s=setTimeout(c,TK))},"scheduleNext"),c=u(async()=>{try{let o=await Vp(e);if(n||o===a)return;let{isRunning:f,isLoading:h}=i.getState();if(f||h)return;setTimeout(async()=>{await x_({threadId:e,threadApi:i}),a=o},100)}catch(o){o.code!=="ENOENT"&&console.error("Failed to poll Legit head",o)}finally{l()}},"tick");return l(),()=>{n=!0,s!==void 0&&clearTimeout(s)}},[t,i,e]),null}u(hse,"LegitFsHeadPoller");export{hse as LegitFsHeadPoller,mK as LegitFsProvider,k_ as LegitLocal,ise as convertMessagesToModelMessages,nse as streamTextToDataStreamResponse,x_ as syncThreadFromLegitFs,S_ as useLegitFs};
|
|
116
116
|
/*!
|
|
117
117
|
* This code for `path.join` is directly copied from @zenfs/core/path for bundle size improvements.
|
|
118
118
|
* SPDX-License-Identifier: LGPL-3.0-or-later
|
|
@@ -120,6 +120,11 @@ ${c}
|
|
|
120
120
|
*/
|
|
121
121
|
/*! Bundled license information:
|
|
122
122
|
|
|
123
|
+
pako/dist/pako.esm.mjs:
|
|
124
|
+
(*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) *)
|
|
125
|
+
*/
|
|
126
|
+
/*! Bundled license information:
|
|
127
|
+
|
|
123
128
|
safe-buffer/index.js:
|
|
124
129
|
(*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> *)
|
|
125
130
|
|