@legit-sdk/assistant-ui 0.2.4 → 0.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,29 +1,33 @@
1
1
  // @legit-sdk/assistant-ui bundle (ESM)
2
2
  // Generated by esbuild
3
3
 
4
- var SO=Object.create;var Ji=Object.defineProperty;var FO=Object.getOwnPropertyDescriptor;var TO=Object.getOwnPropertyNames;var RO=Object.getPrototypeOf,OO=Object.prototype.hasOwnProperty;var fy=t=>{throw TypeError(t)};var kO=(t,e,r)=>e in t?Ji(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var l=(t,e)=>Ji(t,"name",{value:e,configurable:!0}),se=(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 xO=(t,e)=>()=>(t&&(e=t(t=0)),e);var T=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),AO=(t,e)=>{for(var r in e)Ji(t,r,{get:e[r],enumerable:!0})},uy=(t,e,r,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of TO(e))!OO.call(t,n)&&n!==r&&Ji(t,n,{get:()=>e[n],enumerable:!(i=FO(e,n))||i.enumerable});return t};var ce=(t,e,r)=>(r=t!=null?SO(RO(t)):{},uy(e||!t||!t.__esModule?Ji(r,"default",{value:t,enumerable:!0}):r,t)),th=t=>uy(Ji({},"__esModule",{value:!0}),t);var G=(t,e,r)=>kO(t,typeof e!="symbol"?e+"":e,r),hy=(t,e,r)=>e.has(t)||fy("Cannot "+r);var ea=(t,e,r)=>(hy(t,e,"read from private field"),r?r.call(t):e.get(t)),ta=(t,e,r)=>e.has(t)?fy("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),ra=(t,e,r,i)=>(hy(t,e,"write to private field"),i?i.call(t,r):e.set(t,r),r);var Ct=T(vn=>{"use strict";Object.defineProperty(vn,"__esModule",{value:!0});vn.constants=vn.SEP=void 0;vn.SEP="/";vn.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 oh=T(la=>{"use strict";Object.defineProperty(la,"__esModule",{value:!0});la.Stats=void 0;var IO=Ct(),{S_IFMT:$O,S_IFDIR:BO,S_IFREG:MO,S_IFBLK:jO,S_IFCHR:LO,S_IFLNK:qO,S_IFIFO:UO,S_IFSOCK:WO}=IO.constants,Lo=class Lo{static build(e,r=!1){let i=new Lo,{uid:n,gid:s,atime:a,mtime:f,ctime:o}=e,c=r?h=>BigInt(h):h=>h;i.uid=c(n),i.gid=c(s),i.rdev=c(e.rdev),i.blksize=c(4096),i.ino=c(e.ino),i.size=c(e.getSize()),i.blocks=c(1),i.atime=a,i.mtime=f,i.ctime=o,i.birthtime=o,i.atimeMs=c(a.getTime()),i.mtimeMs=c(f.getTime());let u=c(o.getTime());if(i.ctimeMs=u,i.birthtimeMs=u,r){i.atimeNs=BigInt(a.getTime())*BigInt(1e6),i.mtimeNs=BigInt(f.getTime())*BigInt(1e6);let h=BigInt(o.getTime())*BigInt(1e6);i.ctimeNs=h,i.birthtimeNs=h}return i.dev=c(0),i.mode=c(e.mode),i.nlink=c(e.nlink),i}_checkModeProperty(e){return(Number(this.mode)&$O)===e}isDirectory(){return this._checkModeProperty(BO)}isFile(){return this._checkModeProperty(MO)}isBlockDevice(){return this._checkModeProperty(jO)}isCharacterDevice(){return this._checkModeProperty(LO)}isSymbolicLink(){return this._checkModeProperty(qO)}isFIFO(){return this._checkModeProperty(UO)}isSocket(){return this._checkModeProperty(WO)}};l(Lo,"Stats");var jo=Lo;la.Stats=jo;la.default=jo});var Cy=T(qo=>{"use strict";Object.defineProperty(qo,"__esModule",{value:!0});qo.Buffer=void 0;var zO=se("node:buffer");Object.defineProperty(qo,"Buffer",{enumerable:!0,get:l(function(){return zO.Buffer},"get")})});var Pr=T(Ar=>{"use strict";Object.defineProperty(Ar,"__esModule",{value:!0});Ar.bufferFrom=Ar.bufferAllocUnsafe=Ar.Buffer=void 0;var Uo=Cy();Object.defineProperty(Ar,"Buffer",{enumerable:!0,get:l(function(){return Uo.Buffer},"get")});function Iy(t,...e){return new Uo.Buffer(t,...e)}l(Iy,"bufferV0P12Ponyfill");var HO=Uo.Buffer.allocUnsafe||Iy;Ar.bufferAllocUnsafe=HO;var VO=Uo.Buffer.from||Iy;Ar.bufferFrom=VO});var lh=T(En=>{"use strict";Object.defineProperty(En,"__esModule",{value:!0});En.inherits=GO;En.promisify=KO;En.inspect=ch;En.format=JO;function GO(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(GO,"inherits");function KO(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(KO,"promisify");function ch(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=>ch(r)).join(", ")} ]`:typeof t=="object"?`{ ${Object.entries(t).map(([r,i])=>`${r}: ${ch(i)}`).join(", ")} }`:String(t)}l(ch,"inspect");function JO(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(JO,"format")});var fa=T(qe=>{"use strict";Object.defineProperty(qe,"__esModule",{value:!0});qe.AssertionError=qe.RangeError=qe.TypeError=qe.Error=void 0;qe.message=My;qe.E=Nr;var fh=lh(),$y=typeof Symbol>"u"?"_kCode":Symbol("code"),By={};function hh(t){var e;return e=class extends t{constructor(i,...n){super(My(i,n)),this.code=i,this[$y]=i,this.name=`${super.name} [${this[$y]}]`}},l(e,"NodeError"),e}l(hh,"makeNodeError");var Wo=globalThis,dh=class dh extends Wo.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,fh.inspect)(e.actual).slice(0,128)} ${e.operator} ${(0,fh.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(dh,"AssertionError");var uh=dh;qe.AssertionError=uh;function My(t,e){if(typeof t!="string")throw new qe.Error("Error message key must be a string");let r=By[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=fh.format,e===void 0||e.length===0)return r;e.unshift(r)}return String(i.apply(null,e))}l(My,"message");function Nr(t,e){By[t]=typeof e=="function"?e:String(e)}l(Nr,"E");qe.Error=hh(Wo.Error);qe.TypeError=hh(Wo.TypeError);qe.RangeError=hh(Wo.RangeError);Nr("ERR_DIR_CLOSED","Directory handle was closed");Nr("ERR_DIR_CONCURRENT_OPERATION","Cannot do synchronous work on directory handle with concurrent asynchronous operations");Nr("ERR_INVALID_FILE_URL_HOST",'File URL host must be "localhost" or empty on %s');Nr("ERR_INVALID_FILE_URL_PATH","File URL path %s");Nr("ERR_INVALID_OPT_VALUE",(t,e)=>`The value "${String(e)}" is invalid for option "${t}"`);Nr("ERR_INVALID_OPT_VALUE_ENCODING",t=>`The value "${String(t)}" is invalid for option "encoding"`);Nr("ERR_INVALID_ARG_VALUE","Unable to open file as blob")});var ua=T(di=>{"use strict";Object.defineProperty(di,"__esModule",{value:!0});di.ENCODING_UTF8=void 0;di.assertEncoding=YO;di.strToEncoding=ZO;var ph=Pr(),XO=fa();di.ENCODING_UTF8="utf8";function YO(t){if(t&&!ph.Buffer.isEncoding(t))throw new XO.TypeError("ERR_INVALID_OPT_VALUE_ENCODING",t)}l(YO,"assertEncoding");function ZO(t,e){return!e||e===di.ENCODING_UTF8?t:e==="buffer"?new ph.Buffer(t):new ph.Buffer(t).toString(e)}l(ZO,"strToEncoding")});var Vo=T(ha=>{"use strict";Object.defineProperty(ha,"__esModule",{value:!0});ha.Dirent=void 0;var QO=Ct(),ek=ua(),{S_IFMT:tk,S_IFDIR:rk,S_IFREG:ik,S_IFBLK:nk,S_IFCHR:sk,S_IFLNK:ak,S_IFIFO:ok,S_IFSOCK:ck}=QO.constants,Ho=class Ho{constructor(){this.name="",this.path="",this.parentPath="",this.mode=0}static build(e,r){let i=new Ho,{mode:n}=e.getNode();return i.name=(0,ek.strToEncoding)(e.getName(),r),i.mode=n,i.path=e.getParentPath(),i.parentPath=i.path,i}_checkModeProperty(e){return(this.mode&tk)===e}isDirectory(){return this._checkModeProperty(rk)}isFile(){return this._checkModeProperty(ik)}isBlockDevice(){return this._checkModeProperty(nk)}isCharacterDevice(){return this._checkModeProperty(sk)}isSymbolicLink(){return this._checkModeProperty(ak)}isFIFO(){return this._checkModeProperty(ok)}isSocket(){return this._checkModeProperty(ck)}};l(Ho,"Dirent");var zo=Ho;ha.Dirent=zo;ha.default=zo});var Sn=T(_e=>{"use strict";Object.defineProperty(_e,"__esModule",{value:!0});_e.basename=_e.isAbsolute=_e.normalize=_e.dirname=_e.relative=_e.join=_e.posix=_e.sep=_e.resolve=void 0;var ur=se("node:path");Object.defineProperty(_e,"resolve",{enumerable:!0,get:l(function(){return ur.resolve},"get")});Object.defineProperty(_e,"sep",{enumerable:!0,get:l(function(){return ur.sep},"get")});Object.defineProperty(_e,"posix",{enumerable:!0,get:l(function(){return ur.posix},"get")});Object.defineProperty(_e,"join",{enumerable:!0,get:l(function(){return ur.join},"get")});Object.defineProperty(_e,"relative",{enumerable:!0,get:l(function(){return ur.relative},"get")});Object.defineProperty(_e,"dirname",{enumerable:!0,get:l(function(){return ur.dirname},"get")});Object.defineProperty(_e,"normalize",{enumerable:!0,get:l(function(){return ur.normalize},"get")});Object.defineProperty(_e,"isAbsolute",{enumerable:!0,get:l(function(){return ur.isAbsolute},"get")});Object.defineProperty(_e,"basename",{enumerable:!0,get:l(function(){return ur.basename},"get")})});var Xo={};AO(Xo,{__addDisposableResource:()=>lg,__assign:()=>Go,__asyncDelegator:()=>tg,__asyncGenerator:()=>eg,__asyncValues:()=>rg,__await:()=>Fn,__awaiter:()=>Ky,__classPrivateFieldGet:()=>ag,__classPrivateFieldIn:()=>cg,__classPrivateFieldSet:()=>og,__createBinding:()=>Jo,__decorate:()=>qy,__disposeResources:()=>fg,__esDecorate:()=>Wy,__exportStar:()=>Xy,__extends:()=>jy,__generator:()=>Jy,__importDefault:()=>sg,__importStar:()=>ng,__makeTemplateObject:()=>ig,__metadata:()=>Gy,__param:()=>Uy,__propKey:()=>Hy,__read:()=>yh,__rest:()=>Ly,__rewriteRelativeImportExtension:()=>ug,__runInitializers:()=>zy,__setFunctionName:()=>Vy,__spread:()=>Yy,__spreadArray:()=>Qy,__spreadArrays:()=>Zy,__values:()=>Ko,default:()=>uk});function jy(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");mh(t,e);function r(){this.constructor=t}l(r,"__"),t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function Ly(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 qy(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 f=t.length-1;f>=0;f--)(a=t[f])&&(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 Uy(t,e){return function(r,i){e(r,i,t)}}function Wy(t,e,r,i,n,s){function a(g){if(g!==void 0&&typeof g!="function")throw new TypeError("Function expected");return g}l(a,"accept");for(var f=i.kind,o=f==="getter"?"get":f==="setter"?"set":"value",c=!e&&t?i.static?t:t.prototype:null,u=e||(c?Object.getOwnPropertyDescriptor(c,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(a(g||null))};var y=(0,r[p])(f==="accessor"?{get:u.get,set:u.set}:u[o],m);if(f==="accessor"){if(y===void 0)continue;if(y===null||typeof y!="object")throw new TypeError("Object expected");(h=a(y.get))&&(u.get=h),(h=a(y.set))&&(u.set=h),(h=a(y.init))&&n.unshift(h)}else(h=a(y))&&(f==="field"?n.unshift(h):u[o]=h)}c&&Object.defineProperty(c,i.name,u),d=!0}function zy(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 Hy(t){return typeof t=="symbol"?t:"".concat(t)}function Vy(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 Gy(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function Ky(t,e,r,i){function n(s){return s instanceof r?s:new r(function(a){a(s)})}return l(n,"adopt"),new(r||(r=Promise))(function(s,a){function f(u){try{c(i.next(u))}catch(h){a(h)}}l(f,"fulfilled");function o(u){try{c(i.throw(u))}catch(h){a(h)}}l(o,"rejected");function c(u){u.done?s(u.value):n(u.value).then(f,o)}l(c,"step"),c((i=i.apply(t,e||[])).next())})}function Jy(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,a=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return a.next=f(0),a.throw=f(1),a.return=f(2),typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function f(c){return function(u){return o([c,u])}}function o(c){if(i)throw new TypeError("Generator is already executing.");for(;a&&(a=0,c[0]&&(r=0)),r;)try{if(i=1,n&&(s=c[0]&2?n.return:c[0]?n.throw||((s=n.return)&&s.call(n),0):n.next)&&!(s=s.call(n,c[1])).done)return s;switch(n=0,s&&(c=[c[0]&2,s.value]),c[0]){case 0:case 1:s=c;break;case 4:return r.label++,{value:c[1],done:!1};case 5:r.label++,n=c[1],c=[0];continue;case 7:c=r.ops.pop(),r.trys.pop();continue;default:if(s=r.trys,!(s=s.length>0&&s[s.length-1])&&(c[0]===6||c[0]===2)){r=0;continue}if(c[0]===3&&(!s||c[1]>s[0]&&c[1]<s[3])){r.label=c[1];break}if(c[0]===6&&r.label<s[1]){r.label=s[1],s=c;break}if(s&&r.label<s[2]){r.label=s[2],r.ops.push(c);break}s[2]&&r.ops.pop(),r.trys.pop();continue}c=e.call(t,r)}catch(u){c=[6,u],n=0}finally{i=s=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}function Xy(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Jo(e,t,r)}function Ko(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 yh(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(f){a={error:f}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(a)throw a.error}}return s}function Yy(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(yh(arguments[e]));return t}function Zy(){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,f=s.length;a<f;a++,n++)i[n]=s[a];return i}function Qy(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 Fn(t){return this instanceof Fn?(this.v=t,this):new Fn(t)}function eg(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",a),n[Symbol.asyncIterator]=function(){return this},n;function a(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||o(p,w)})},m&&(n[p]=m(n[p])))}function o(p,m){try{c(i[p](m))}catch(w){d(s[0][3],w)}}function c(p){p.value instanceof Fn?Promise.resolve(p.value.v).then(u,h):d(s[0][2],p)}function u(p){o("next",p)}function h(p){o("throw",p)}function d(p,m){p(m),s.shift(),s.length&&o(s[0][0],s[0][1])}}function tg(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:Fn(t[n](a)),done:!1}:s?s(a):a}:s}}function rg(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 Ko=="function"?Ko(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(f,o){a=t[s](a),n(f,o,a.done,a.value)})}}function n(s,a,f,o){Promise.resolve(o).then(function(c){s({value:c,done:f})},a)}}function ig(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function ng(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r=wh(t),i=0;i<r.length;i++)r[i]!=="default"&&Jo(e,t,r[i]);return lk(e,t),e}function sg(t){return t&&t.__esModule?t:{default:t}}function ag(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 og(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 cg(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 lg(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 fg(t){function e(s){t.error=t.hasError?new fk(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(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 l(n,"next"),n()}function ug(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 mh,Go,Jo,lk,wh,fk,uk,Yo=xO(()=>{mh=l(function(t,e){return mh=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])},mh(t,e)},"extendStatics");l(jy,"__extends");Go=l(function(){return Go=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"),Go.apply(this,arguments)},"__assign");l(Ly,"__rest");l(qy,"__decorate");l(Uy,"__param");l(Wy,"__esDecorate");l(zy,"__runInitializers");l(Hy,"__propKey");l(Vy,"__setFunctionName");l(Gy,"__metadata");l(Ky,"__awaiter");l(Jy,"__generator");Jo=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(Xy,"__exportStar");l(Ko,"__values");l(yh,"__read");l(Yy,"__spread");l(Zy,"__spreadArrays");l(Qy,"__spreadArray");l(Fn,"__await");l(eg,"__asyncGenerator");l(tg,"__asyncDelegator");l(rg,"__asyncValues");l(ig,"__makeTemplateObject");lk=Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e},wh=l(function(t){return wh=Object.getOwnPropertyNames||function(e){var r=[];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(r[r.length]=i);return r},wh(t)},"ownKeys");l(ng,"__importStar");l(sg,"__importDefault");l(ag,"__classPrivateFieldGet");l(og,"__classPrivateFieldSet");l(cg,"__classPrivateFieldIn");l(lg,"__addDisposableResource");fk=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(fg,"__disposeResources");l(ug,"__rewriteRelativeImportExtension");uk={__extends:jy,__assign:Go,__rest:Ly,__decorate:qy,__param:Uy,__esDecorate:Wy,__runInitializers:zy,__propKey:Hy,__setFunctionName:Vy,__metadata:Gy,__awaiter:Ky,__generator:Jy,__createBinding:Jo,__exportStar:Xy,__values:Ko,__read:yh,__spread:Yy,__spreadArrays:Zy,__spreadArray:Qy,__await:Fn,__asyncGenerator:eg,__asyncDelegator:tg,__asyncValues:rg,__makeTemplateObject:ig,__importStar:ng,__importDefault:sg,__classPrivateFieldGet:ag,__classPrivateFieldSet:og,__classPrivateFieldIn:cg,__addDisposableResource:lg,__disposeResources:fg,__rewriteRelativeImportExtension:ug}});var dg=T(hg=>{"use strict";Object.defineProperty(hg,"__esModule",{value:!0})});var bh=T(Zo=>{"use strict";Object.defineProperty(Zo,"__esModule",{value:!0});Zo.flattenJSON=void 0;var pg=Pr(),gh=Sn(),hk=gh.posix?gh.posix.join:gh.join,dk=l(t=>{let e={};function r(i,n){for(let s in n){let a=n[s],f=hk(i,s);typeof a=="string"||a instanceof pg.Buffer?e[f]=a:typeof a=="object"&&a!==null&&!(a instanceof pg.Buffer)&&Object.keys(a).length>0?r(f,a):e[f]=null}}return l(r,"flatten"),r("",t),e},"flattenJSON");Zo.flattenJSON=dk});var da=T(Qo=>{"use strict";Object.defineProperty(Qo,"__esModule",{value:!0});Qo.FanOut=void 0;var vh=class vh{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(vh,"FanOut");var _h=vh;Qo.FanOut=_h});var tc=T(ec=>{"use strict";Object.defineProperty(ec,"__esModule",{value:!0});ec.createProcess=mg;var pk=l(()=>{if(typeof process<"u")return process;try{return se("process")}catch{return}},"maybeReturnProcess");function mg(){let t=pk()||{};return t.cwd||(t.cwd=()=>"/"),t.emitWarning||(t.emitWarning=(e,r)=>{console.warn(`${r}${r?": ":""}${e}`)}),t.env||(t.env={}),t}l(mg,"createProcess");ec.default=mg()});var Fh=T(nc=>{"use strict";Object.defineProperty(nc,"__esModule",{value:!0});nc.Node=void 0;var mk=da(),yg=tc(),bt=Pr(),wk=Ct(),{S_IFMT:hr,S_IFDIR:yk,S_IFREG:gk,S_IFLNK:wg,S_IFCHR:bk}=wk.constants,rc=l(()=>yg.default.getuid?.()??0,"getuid"),ic=l(()=>yg.default.getgid?.()??0,"getgid"),Sh=class Sh{constructor(e,r=438){this.changes=new mk.FanOut,this._uid=rc(),this._gid=ic(),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&~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.buf=(0,bt.bufferFrom)(e,"utf8"),this.touch()}getBuffer(){return this.atime=new Date,this.buf||(this.buf=(0,bt.bufferAllocUnsafe)(0)),(0,bt.bufferFrom)(this.buf)}setBuffer(e){this.buf=(0,bt.bufferFrom)(e),this.touch()}getSize(){return this.buf?this.buf.length:0}setModeProperty(e){this.mode=e}isFile(){return(this.mode&hr)===gk}isDirectory(){return(this.mode&hr)===yk}isSymlink(){return(this.mode&hr)===wg}isCharacterDevice(){return(this.mode&hr)===bk}makeSymlink(e){this.mode=wg|438,this.symlink=e}write(e,r=0,i=e.length,n=0){if(this.buf||(this.buf=(0,bt.bufferAllocUnsafe)(0)),n+i>this.buf.length){let s=(0,bt.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,bt.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 bt.Buffer?e:bt.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,bt.bufferAllocUnsafe)(0);else if(this.buf||(this.buf=(0,bt.bufferAllocUnsafe)(0)),e<=this.buf.length)this.buf=this.buf.slice(0,e);else{let r=(0,bt.bufferAllocUnsafe)(e);this.buf.copy(r),r.fill(0,this.buf.length),this.buf=r}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=rc(),r=ic()){return!!(this.perm&4||r===this.gid&&this.perm&32||e===this.uid&&this.perm&256)}canWrite(e=rc(),r=ic()){return!!(this.perm&2||r===this.gid&&this.perm&16||e===this.uid&&this.perm&128)}canExecute(e=rc(),r=ic()){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(Sh,"Node");var Eh=Sh;nc.Node=Eh});var Rh=T(sc=>{"use strict";Object.defineProperty(sc,"__esModule",{value:!0});sc.Link=void 0;var _k=Ct(),vk=da(),{S_IFREG:Ek}=_k.constants,pa=class pa{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 vk.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(Ek|438)){let i=new pa(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 pa(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(pa,"Link");var Th=pa;sc.Link=Th});var xh=T(ac=>{"use strict";Object.defineProperty(ac,"__esModule",{value:!0});ac.File=void 0;var Sk=Ct(),{O_APPEND:Fk}=Sk.constants,kh=class kh{constructor(e,r,i,n){this.link=e,this.node=r,this.flags=i,this.fd=n,this.position=0,this.flags&Fk&&(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(kh,"File");var Oh=kh;ac.File=Oh});var On=T(Rn=>{"use strict";Object.defineProperty(Rn,"__esModule",{value:!0});Rn.FLAGS=Rn.ERRSTR=void 0;var Tk=Ct();Rn.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:gg,O_WRONLY:oc,O_RDWR:Tn,O_CREAT:Dr,O_EXCL:cc,O_TRUNC:lc,O_APPEND:fc,O_SYNC:bg}=Tk.constants,_g;(function(t){t[t.r=gg]="r",t[t["r+"]=Tn]="r+",t[t.rs=gg|bg]="rs",t[t.sr=t.rs]="sr",t[t["rs+"]=Tn|bg]="rs+",t[t["sr+"]=t["rs+"]]="sr+",t[t.w=oc|Dr|lc]="w",t[t.wx=oc|Dr|lc|cc]="wx",t[t.xw=t.wx]="xw",t[t["w+"]=Tn|Dr|lc]="w+",t[t["wx+"]=Tn|Dr|lc|cc]="wx+",t[t["xw+"]=t["wx+"]]="xw+",t[t.a=oc|fc|Dr]="a",t[t.ax=oc|fc|Dr|cc]="ax",t[t.xa=t.ax]="xa",t[t["a+"]=Tn|fc|Dr]="a+",t[t["ax+"]=Tn|fc|Dr|cc]="ax+",t[t["xa+"]=t["ax+"]]="xa+"})(_g||(Rn.FLAGS=_g={}))});var Ph=T(Ah=>{"use strict";Object.defineProperty(Ah,"__esModule",{value:!0});Ah.default=typeof queueMicrotask=="function"?queueMicrotask:t=>Promise.resolve().then(()=>t()).catch(()=>{})});var pc=T(Ae=>{"use strict";Object.defineProperty(Ae,"__esModule",{value:!0});Ae.filenameToSteps=Ae.resolve=Ae.unixify=Ae.isWin=void 0;Ae.isFd=Eg;Ae.validateFd=Ik;Ae.dataToBuffer=$k;var hc=Sn(),uc=Pr(),vg=tc(),Rk=ua(),Ok=On();Ae.isWin=vg.default.platform==="win32";var kk=hc.resolve,xk=hc.posix?hc.posix.sep:hc.sep,Ak=l((t,e)=>{let r=t[e];return e>0&&(r==="/"||Ae.isWin&&r==="\\")},"isSeparator"),Pk=l(t=>{let e=t.length-1;if(e<2)return t;for(;Ak(t,e);)e--;return t.substr(0,e+1)},"removeTrailingSeparator"),Nk=l((t,e)=>{if(typeof t!="string")throw new TypeError("expected a string");return t=t.replace(/[\\\/]+/g,"/"),e!==!1&&(t=Pk(t)),t},"normalizePath"),Dk=l((t,e=!0)=>Ae.isWin?(t=Nk(t,e),t.replace(/^([a-zA-Z]+:|\.\/)/,"")):t,"unixify");Ae.unixify=Dk;var dc=l((t,e=vg.default.cwd())=>kk(e,t),"resolve");Ae.resolve=dc;if(Ae.isWin){let t=dc;Ae.resolve=dc=l((e,r)=>(0,Ae.unixify)(t(e,r)),"resolve")}var Ck=l((t,e)=>{let i=dc(t,e).substring(1);return i?i.split(xk):[]},"filenameToSteps");Ae.filenameToSteps=Ck;function Eg(t){return t>>>0===t}l(Eg,"isFd");function Ik(t){if(!Eg(t))throw TypeError(Ok.ERRSTR.FD)}l(Ik,"validateFd");function $k(t,e=Rk.ENCODING_UTF8){return uc.Buffer.isBuffer(t)?t:t instanceof Uint8Array?(0,uc.bufferFrom)(t):e==="buffer"?(0,uc.bufferFrom)(String(t),"utf8"):(0,uc.bufferFrom)(String(t),e)}l($k,"dataToBuffer")});var Cr=T(Re=>{"use strict";Object.defineProperty(Re,"__esModule",{value:!0});Re.getWriteSyncArgs=Re.getWriteArgs=Re.bufToUint8=void 0;Re.promisify=Mk;Re.validateCallback=Sg;Re.modeToNumber=Fg;Re.nullCheck=Tg;Re.pathToFilename=qk;Re.createError=ix;Re.genRndStr6=nx;Re.flagsToNumber=sx;Re.streamToBuffer=ax;Re.bufferToEncoding=fx;Re.isReadableStream=ux;var ma=On(),Nh=fa(),Dh=Pr(),Bk=Ph(),mc=pc();function Mk(t,e,r=i=>i){return(...i)=>new Promise((n,s)=>{t[e].bind(t)(...i,(a,f)=>a?s(a):n(r(f)))})}l(Mk,"promisify");function Sg(t){if(typeof t!="function")throw TypeError(ma.ERRSTR.CB);return t}l(Sg,"validateCallback");function jk(t,e){if(typeof t=="number")return t;if(typeof t=="string")return parseInt(t,8);if(e)return Fg(e)}l(jk,"_modeToNumber");function Fg(t,e){let r=jk(t,e);if(typeof r!="number"||isNaN(r))throw new TypeError(ma.ERRSTR.MODE_INT);return r}l(Fg,"modeToNumber");function Tg(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,Bk.default)(()=>{e(r)}),!1}return!0}l(Tg,"nullCheck");function Lk(t){if(t.hostname!=="")throw new Nh.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 Nh.TypeError("ERR_INVALID_FILE_URL_PATH","must not include encoded / characters")}return decodeURIComponent(e)}l(Lk,"getPathFromURLPosix");function qk(t){if(t instanceof Uint8Array&&(t=(0,Dh.bufferFrom)(t)),typeof t!="string"&&!Dh.Buffer.isBuffer(t)){try{if(!(t instanceof se("url").URL))throw new TypeError(ma.ERRSTR.PATH_STR)}catch{throw new TypeError(ma.ERRSTR.PATH_STR)}t=Lk(t)}let e=String(t);return Tg(e),e}l(qk,"pathToFilename");var Uk="ENOENT",Wk="EBADF",zk="EINVAL",Hk="EPERM",Vk="EPROTO",Gk="EEXIST",Kk="ENOTDIR",Jk="EMFILE",Xk="EACCES",Yk="EISDIR",Zk="ENOTEMPTY",Qk="ENOSYS",ex="ERR_FS_EISDIR",tx="ERR_OUT_OF_RANGE";function rx(t,e="",r="",i=""){let n="";switch(r&&(n=` '${r}'`),i&&(n+=` -> '${i}'`),t){case Uk:return`ENOENT: no such file or directory, ${e}${n}`;case Wk:return`EBADF: bad file descriptor, ${e}${n}`;case zk:return`EINVAL: invalid argument, ${e}${n}`;case Hk:return`EPERM: operation not permitted, ${e}${n}`;case Vk:return`EPROTO: protocol error, ${e}${n}`;case Gk:return`EEXIST: file already exists, ${e}${n}`;case Kk:return`ENOTDIR: not a directory, ${e}${n}`;case Yk:return`EISDIR: illegal operation on a directory, ${e}${n}`;case Xk:return`EACCES: permission denied, ${e}${n}`;case Zk:return`ENOTEMPTY: directory not empty, ${e}${n}`;case Jk:return`EMFILE: too many open files, ${e}${n}`;case Qk:return`ENOSYS: function not implemented, ${e}${n}`;case ex:return`[ERR_FS_EISDIR]: Path is a directory: ${e} returned EISDIR (is a directory) ${r}`;case tx:return`[ERR_OUT_OF_RANGE]: value out of range, ${e}${n}`;default:return`${t}: error occurred, ${e}${n}`}}l(rx,"formatError");function ix(t,e="",r="",i="",n=Error){let s=new n(rx(t,e,r,i));return s.code=t,r&&(s.path=r),s}l(ix,"createError");function nx(){return Math.random().toString(36).slice(2,8).padEnd(6,"0")}l(nx,"genRndStr6");function sx(t){if(typeof t=="number")return t;if(typeof t=="string"){let e=ma.FLAGS[t];if(typeof e<"u")return e}throw new Nh.TypeError("ERR_INVALID_OPT_VALUE","flags",t)}l(sx,"flagsToNumber");function ax(t){let e=[];return new Promise((r,i)=>{t.on("data",n=>e.push(n)),t.on("end",()=>r(Dh.Buffer.concat(e))),t.on("error",i)})}l(ax,"streamToBuffer");var ox=l(t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),"bufToUint8");Re.bufToUint8=ox;var cx=l((t,e,r,i,n,s)=>{(0,mc.validateFd)(t);let a=0,f,o=null,c,u,h=typeof e,d=typeof r,p=typeof i,m=typeof n;h!=="string"?d==="function"?u=r:p==="function"?(a=r|0,u=i):m==="function"?(a=r|0,f=i,u=n):(a=r|0,f=i,o=n,u=s):d==="function"?u=r:p==="function"?(o=r,u=i):m==="function"&&(o=r,c=i,u=n);let w=(0,mc.dataToBuffer)(e,c);h!=="string"?typeof f>"u"&&(f=w.length):(a=0,f=w.length);let y=Sg(u);return[t,h==="string",w,a,f,o,y]},"getWriteArgs");Re.getWriteArgs=cx;var lx=l((t,e,r,i,n)=>{(0,mc.validateFd)(t);let s,a,f,o,c=typeof e!="string";c?(a=(r||0)|0,f=i,o=n):(o=r,s=i);let u=(0,mc.dataToBuffer)(e,s);return c?typeof f>"u"&&(f=u.length):(a=0,f=u.length),[t,u,a||0,f,o]},"getWriteSyncArgs");Re.getWriteSyncArgs=lx;function fx(t,e){return!e||e==="buffer"?t:t.toString(e)}l(fx,"bufferToEncoding");function ux(t){return t!==null&&typeof t=="object"&&typeof t.pipe=="function"&&typeof t.on=="function"&&t.readable===!0}l(ux,"isReadableStream")});var Pg=T(gc=>{"use strict";Object.defineProperty(gc,"__esModule",{value:!0});gc.Superblock=void 0;var Pe=Sn(),hx=Fh(),Rg=Rh(),dx=xh(),px=Pr(),Og=tc(),Jt=Ct(),kg=On(),H=Cr(),It=pc(),mx=bh(),kn=Pe.posix?Pe.posix.sep:Pe.sep,xg=Pe.posix?Pe.posix.relative:Pe.relative,wx=Pe.posix?Pe.posix.join:Pe.join,{O_RDONLY:Ch,O_WRONLY:wc,O_RDWR:Ih,O_CREAT:Ag,O_EXCL:yx,O_TRUNC:gx,O_APPEND:bx,O_DIRECTORY:_x}=Jt.constants,xn=class xn{static fromJSON(e,r){let i=new xn;return i.fromJSON(e,r),i}static fromNestedJSON(e,r){let i=new xn;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 f=this.openFile(i,n,s,a);if(!f)throw(0,H.createError)("ENOENT","open",i);return f.fd},this.writeFile=(i,n,s,a)=>{let f=typeof i=="number",o;f?o=i:o=this.open((0,H.pathToFilename)(i),s,a);let c=0,u=n.length,h=s&bx?void 0:0;try{for(;u>0;){let d=this.write(o,n,c,u,h);c+=d,u-=d,h!==void 0&&(h+=d)}}finally{f||this.close(o)}},this.read=(i,n,s,a,f)=>{if(n.byteLength<a)throw(0,H.createError)("ERR_OUT_OF_RANGE","read",void 0,void 0,RangeError);let o=this.getFileByFdOrThrow(i);if(o.node.isSymlink())throw(0,H.createError)("EPERM","read",o.link.getPath());return o.read(n,Number(s),Number(a),f===-1||typeof f!="number"?void 0:f)},this.readv=(i,n,s)=>{let a=this.getFileByFdOrThrow(i),f=s??void 0;f===-1&&(f=void 0);let o=0;for(let c of n){let u=a.read(c,0,c.byteLength,f);if(f=void 0,o+=u,u<c.byteLength)break}return o},this.link=(i,n)=>{let s;try{s=this.getLinkOrThrow(i,"link")}catch(u){throw u.code&&(u=(0,H.createError)(u.code,"link",i,n)),u}let a=(0,Pe.dirname)(n),f;try{f=this.getLinkOrThrow(a,"link")}catch(u){throw u.code&&(u=(0,H.createError)(u.code,"link",i,n)),u}let o=(0,Pe.basename)(n);if(f.getChild(o))throw(0,H.createError)("EEXIST","link",i,n);let c=s.getNode();c.nlink++,f.createChild(o,c)},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,It.filenameToSteps)(n),a;try{a=this.getLinkParentAsDirOrThrow(s)}catch(u){throw u.code&&(u=(0,H.createError)(u.code,"symlink",i,n)),u}let f=s[s.length-1];if(a.getChild(f))throw(0,H.createError)("EEXIST","symlink",i,n);let o=a.getNode();if(!o.canExecute()||!o.canWrite())throw(0,H.createError)("EACCES","symlink",i,n);let c=a.createChild(f);return c.getNode().makeSymlink(i),c},this.rename=(i,n)=>{let s;try{s=this.getResolvedLinkOrThrow(i)}catch(h){throw h.code&&(h=(0,H.createError)(h.code,"rename",i,n)),h}let a;try{a=this.getLinkParentAsDirOrThrow(n)}catch(h){throw h.code&&(h=(0,H.createError)(h.code,"rename",i,n)),h}let f=s.parent;if(!f)throw(0,H.createError)("EINVAL","rename",i,n);let o=f.getNode(),c=a.getNode();if(!o.canExecute()||!o.canWrite()||!c.canExecute()||!c.canWrite())throw(0,H.createError)("EACCES","rename",i,n);f.deleteChild(s);let u=(0,Pe.basename)(n);s.name=u,s.steps=[...a.steps,u],a.setChild(s.getName(),s)},this.mkdir=(i,n)=>{let s=(0,It.filenameToSteps)(i);if(!s.length)throw(0,H.createError)("EEXIST","mkdir",i);let a=this.getLinkParentAsDirOrThrow(i,"mkdir"),f=s[s.length-1];if(a.getChild(f))throw(0,H.createError)("EEXIST","mkdir",i);let o=a.getNode();if(!o.canWrite()||!o.canExecute())throw(0,H.createError)("EACCES","mkdir",i);a.createChild(f,this.createNode(Jt.constants.S_IFDIR|n))},this.mkdirp=(i,n)=>{let s=!1,a=(0,It.filenameToSteps)(i),f=null,o=a.length;for(o=a.length;o>=0&&(f=this.getResolvedLink(a.slice(0,o)),!f);o--);for(f||(f=this.root,o=0),f=this.getResolvedLinkOrThrow(Pe.sep+a.slice(0,o).join(Pe.sep),"mkdir"),o;o<a.length;o++){let c=f.getNode();if(c.isDirectory()){if(!c.canExecute()||!c.canWrite())throw(0,H.createError)("EACCES","mkdir",i)}else throw(0,H.createError)("ENOTDIR","mkdir",i);s=!0,f=f.createChild(a[o],this.createNode(Jt.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,H.createError)("ENOTEMPTY","rmdir",i);this.deleteLink(s)},this.rm=(i,n=!1,s=!1)=>{let a;try{a=this.getResolvedLinkOrThrow(i,"stat")}catch(f){if(f.code==="ENOENT"&&n)return;throw f}if(a.getNode().isDirectory()&&!s)throw(0,H.createError)("ERR_FS_EISDIR","rm",i);if(!a.parent?.getNode().canWrite())throw(0,H.createError)("EACCES","rm",i);this.deleteLink(a)},this.close=i=>{(0,It.validateFd)(i);let n=this.getFileByFdOrThrow(i,"close");this.closeFile(n)};let r=this.createLink();r.setNode(this.createNode(Jt.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 Rg.Link(this,void 0,"");if(!r)throw new Error("createLink: name cannot be empty");let s=n??(i?511:438),f=n&&n&Jt.constants.S_IFMT?n&Jt.constants.S_IFMT:i?Jt.constants.S_IFDIR:Jt.constants.S_IFREG,o=s&~Jt.constants.S_IFMT|f;return e.createChild(r,this.createNode(o))}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:xn.fd--}createNode(e){let r=new hx.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,f;e instanceof Rg.Link?(a=e.steps,f=kn+a.join(kn)):typeof e=="string"?(a=(0,It.filenameToSteps)(e),f=e):(a=e,f=kn+a.join(kn));let o=this.root,c=0;for(;c<a.length;){let u=o.getNode();if(u.isDirectory()){if(n&&!u.canExecute())throw(0,H.createError)("EACCES",s,f)}else if(c<a.length-1)throw(0,H.createError)("ENOTDIR",s,f);if(o=o.getChild(a[c])??null,!o){if(i)throw(0,H.createError)("ENOENT",s,f);return null}if(u=o?.getNode(),u.isSymlink()&&(r||c<a.length-1)){let h=(0,Pe.isAbsolute)(u.symlink)?u.symlink:wx((0,Pe.dirname)(o.getPath()),u.symlink);a=(0,It.filenameToSteps)(h).concat(a.slice(c+1)),o=this.root,c=0;continue}if(i&&!u.isDirectory()&&c<a.length-1){let h=Og.default.platform==="win32"?"ENOENT":"ENOTDIR";throw(0,H.createError)(h,s,f)}c++}return o}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,H.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,It.filenameToSteps)(e)).slice(0,-1),n=kn+i.join(kn),s=this.getLinkOrThrow(n,r);if(!s.getNode().isDirectory())throw(0,H.createError)("ENOTDIR",r,n);return s}getFileByFd(e){return this.fds[String(e)]}getFileByFdOrThrow(e,r){if(!(0,It.isFd)(e))throw TypeError(kg.ERRSTR.FD);let i=this.getFileByFd(e);if(!i)throw(0,H.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 o of a.keys()){if(o==="."||o==="..")continue;s=!1;let c=e.getChild(o);if(!c)throw new Error("_toJSON: unexpected undefined");let u=c.getNode();if(u.isFile()){let h=c.getPath();i&&(h=xg(i,h)),r[h]=n?u.getBuffer():u.getString()}else u.isDirectory()&&this._toJSON(c,r,i,n)}let f=e.getPath();return i&&(f=xg(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 a of e){let f=(0,H.pathToFilename)(a),o=this.getResolvedLink(f);o&&s.push(o)}}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=Og.default.cwd()){for(let i in e){let n=e[i];if(i=(0,It.resolve)(i,r),typeof n=="string"||n instanceof px.Buffer){let s=(0,Pe.dirname)(i);this.mkdirp(s,511);let a=(0,It.dataToBuffer)(n);this.writeFile(i,a,kg.FLAGS.w,438)}else this.mkdirp(i,511)}}fromNestedJSON(e,r){this.fromJSON((0,mx.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(Jt.constants.S_IFDIR|511))}mountSync(e,r){this.fromJSON(r,e)}openLink(e,r,i=!0){if(this.openFiles>=this.maxFiles)throw(0,H.createError)("EMFILE","open",e.getPath());let n=e;i&&(n=this.getResolvedLinkOrThrow(e.getPath(),"open"));let s=n.getNode();if(s.isDirectory()){if((r&(Ch|Ih|wc))!==Ch)throw(0,H.createError)("EISDIR","open",e.getPath())}else if(r&_x)throw(0,H.createError)("ENOTDIR","open",e.getPath());if((r&(Ch|Ih|wc))!==wc&&!s.canRead()||r&(wc|Ih)&&!s.canWrite())throw(0,H.createError)("EACCES","open",e.getPath());let a=new dx.File(e,s,r,this.newFdNumber());return this.fds[a.fd]=a,this.openFiles++,r&gx&&a.truncate(),a}openFile(e,r,i,n=!0){let s=(0,It.filenameToSteps)(e),a;try{if(a=n?this.getResolvedLinkOrThrow(e,"open"):this.getLinkOrThrow(e,"open"),a&&r&Ag&&r&yx)throw(0,H.createError)("EEXIST","open",e)}catch(f){if(f.code==="ENOENT"&&r&Ag){let o=(0,Pe.dirname)(e),c=this.getResolvedLinkOrThrow(o),u=c.getNode();if(!u.isDirectory())throw(0,H.createError)("ENOTDIR","open",e);if(!u.canExecute()||!u.canWrite())throw(0,H.createError)("EACCES","open",e);i??(i=438),a=this.createLink(c,s[s.length-1],!1,i)}else throw f}if(a)return this.openLink(a,r,n);throw(0,H.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,H.createError)("EBADF","write",a.link.getPath());return a.write(r,i,n,s===-1||typeof s!="number"?void 0:s)}};l(xn,"Superblock");var yc=xn;gc.Superblock=yc;yc.fd=2147483647});var Dg=T(_t=>{"use strict";Object.defineProperty(_t,"__esModule",{value:!0});_t.Superblock=_t.File=_t.Link=_t.Node=void 0;var Ng=(Yo(),th(Xo));Ng.__exportStar(dg(),_t);Ng.__exportStar(bh(),_t);var vx=Fh();Object.defineProperty(_t,"Node",{enumerable:!0,get:l(function(){return vx.Node},"get")});var Ex=Rh();Object.defineProperty(_t,"Link",{enumerable:!0,get:l(function(){return Ex.Link},"get")});var Sx=xh();Object.defineProperty(_t,"File",{enumerable:!0,get:l(function(){return Sx.File},"get")});var Fx=Pg();Object.defineProperty(_t,"Superblock",{enumerable:!0,get:l(function(){return Fx.Superblock},"get")})});var Cg=T(wa=>{"use strict";Object.defineProperty(wa,"__esModule",{value:!0});wa.StatFs=void 0;var _c=class _c{static build(e,r=!1){let i=new _c,n=r?u=>BigInt(u):u=>u;i.type=n(2240043254),i.bsize=n(4096);let s=Object.keys(e.inodes).length,a=1e6,f=Math.min(s*2,a),o=a-f;i.blocks=n(a),i.bfree=n(o),i.bavail=n(o);let c=1e6;return i.files=n(c),i.ffree=n(c-s),i}};l(_c,"StatFs");var bc=_c;wa.StatFs=bc;wa.default=bc});var Ig=T($h=>{"use strict";Object.defineProperty($h,"__esModule",{value:!0});function Tx(t,e,r){let i=setTimeout.apply(globalThis,arguments);return i&&typeof i=="object"&&typeof i.unref=="function"&&i.unref(),i}l(Tx,"setTimeoutUnref");$h.default=Tx});var Bg=T(An=>{"use strict";Object.defineProperty(An,"__esModule",{value:!0});An.Writable=An.Readable=void 0;var $g=se("node:stream");Object.defineProperty(An,"Readable",{enumerable:!0,get:l(function(){return $g.Readable},"get")});Object.defineProperty(An,"Writable",{enumerable:!0,get:l(function(){return $g.Writable},"get")})});var Bh=T(vc=>{"use strict";Object.defineProperty(vc,"__esModule",{value:!0});vc.EventEmitter=void 0;var Rx=se("node:events");Object.defineProperty(vc,"EventEmitter",{enumerable:!0,get:l(function(){return Rx.EventEmitter},"get")})});var Mg=T(Ec=>{"use strict";Object.defineProperty(Ec,"__esModule",{value:!0});Ec.FileHandle=void 0;var Ue=Cr(),Ox=Bh(),jh=class jh extends Ox.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,Ue.promisify)(this.fs,"appendFile")(this.fd,e,r)}chmod(e){return(0,Ue.promisify)(this.fs,"fchmod")(this.fd,e)}chown(e,r){return(0,Ue.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,Ue.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,Ue.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 a=>{try{let f=a.byobRequest?.view;if(!f){let c=new Uint8Array(16384),u=await this.read(c,0,c.length,n);if(u.bytesRead===0){a.close(),s();return}n+=u.bytesRead,a.enqueue(c.slice(0,u.bytesRead));return}let o=await this.read(f,f.byteOffset,f.byteLength,n);if(o.bytesRead===0){a.close(),s();return}n+=o.bytesRead,a.byobRequest.respond(o.bytesRead)}catch(f){a.error(f),s()}},"pull"),cancel:l(async()=>{s()},"cancel")})}async read(e,r,i,n){let s=n??this.position,a=await(0,Ue.promisify)(this.fs,"read",f=>({bytesRead:f,buffer:e}))(this.fd,e,r,i,s);return n==null&&(this.position+=a.bytesRead),a}readv(e,r){return(0,Ue.promisify)(this.fs,"readv",i=>({bytesRead:i,buffers:e}))(this.fd,e,r)}readFile(e){return(0,Ue.promisify)(this.fs,"readFile")(this.fd,e)}stat(e){return(0,Ue.promisify)(this.fs,"fstat")(this.fd,e)}sync(){return(0,Ue.promisify)(this.fs,"fsync")(this.fd)}truncate(e){return(0,Ue.promisify)(this.fs,"ftruncate")(this.fd,e)}utimes(e,r){return(0,Ue.promisify)(this.fs,"futimes")(this.fd,e,r)}async write(e,r,i,n){let s=typeof n!="number",a=s?this.position:n,f=await(0,Ue.promisify)(this.fs,"write",o=>({bytesWritten:o,buffer:e}))(this.fd,e,r,i,a);return s&&(this.position+=f.bytesWritten),f}writev(e,r){return(0,Ue.promisify)(this.fs,"writev",i=>({bytesWritten:i,buffers:e}))(this.fd,e,r)}writeFile(e,r){return(0,Ue.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,Ue.promisify)(this.fs,"close")(this.fd).then(this.closeResolve,this.closeReject))}};l(jh,"FileHandle");var Mh=jh;Ec.FileHandle=Mh});var jg=T(Sc=>{"use strict";Object.defineProperty(Sc,"__esModule",{value:!0});Sc.FsPromises=void 0;var te=Cr(),kx=Ct(),Uh=class Uh{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(Uh,"FSWatchAsyncIterator");var Lh=Uh,Wh=class Wh{constructor(e,r){this.fs=e,this.FileHandle=r,this.constants=kx.constants,this.cp=(0,te.promisify)(this.fs,"cp"),this.opendir=(0,te.promisify)(this.fs,"opendir"),this.statfs=(0,te.promisify)(this.fs,"statfs"),this.lutimes=(0,te.promisify)(this.fs,"lutimes"),this.glob=(0,te.promisify)(this.fs,"glob"),this.access=(0,te.promisify)(this.fs,"access"),this.chmod=(0,te.promisify)(this.fs,"chmod"),this.chown=(0,te.promisify)(this.fs,"chown"),this.copyFile=(0,te.promisify)(this.fs,"copyFile"),this.lchmod=(0,te.promisify)(this.fs,"lchmod"),this.lchown=(0,te.promisify)(this.fs,"lchown"),this.link=(0,te.promisify)(this.fs,"link"),this.lstat=(0,te.promisify)(this.fs,"lstat"),this.mkdir=(0,te.promisify)(this.fs,"mkdir"),this.mkdtemp=(0,te.promisify)(this.fs,"mkdtemp"),this.readdir=(0,te.promisify)(this.fs,"readdir"),this.readlink=(0,te.promisify)(this.fs,"readlink"),this.realpath=(0,te.promisify)(this.fs,"realpath"),this.rename=(0,te.promisify)(this.fs,"rename"),this.rmdir=(0,te.promisify)(this.fs,"rmdir"),this.rm=(0,te.promisify)(this.fs,"rm"),this.stat=(0,te.promisify)(this.fs,"stat"),this.symlink=(0,te.promisify)(this.fs,"symlink"),this.truncate=(0,te.promisify)(this.fs,"truncate"),this.unlink=(0,te.promisify)(this.fs,"unlink"),this.utimes=(0,te.promisify)(this.fs,"utimes"),this.readFile=(i,n)=>(0,te.promisify)(this.fs,"readFile")(i instanceof this.FileHandle?i.fd:i,n),this.appendFile=(i,n,s)=>(0,te.promisify)(this.fs,"appendFile")(i instanceof this.FileHandle?i.fd:i,n,s),this.open=(i,n="r",s)=>(0,te.promisify)(this.fs,"open",a=>new this.FileHandle(this.fs,a))(i,n,s),this.writeFile=(i,n,s)=>((0,te.isReadableStream)(n)?(0,te.streamToBuffer)(n):Promise.resolve(n)).then(f=>(0,te.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 Lh(this.fs,i,s)}}};l(Wh,"FsPromises");var qh=Wh;Sc.FsPromises=qh});var Lg=T(Fc=>{"use strict";Object.defineProperty(Fc,"__esModule",{value:!0});Fc.printTree=void 0;var xx=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 a=n===i,f=s(t+(a?" ":"\u2502")+" "),o=f?a?"\u2514\u2500":"\u251C\u2500":"\u2502";r+=`
5
- `+t+o+(f?" "+f:"")}return r},"printTree");Fc.printTree=xx});var qg=T(Tc=>{"use strict";Object.defineProperty(Tc,"__esModule",{value:!0});Tc.printBinary=void 0;var Ax=l((t="",e)=>{let r=e[0],i=e[1],n="";return r&&(n+=`
4
+ var tN=Object.create;var En=Object.defineProperty;var rN=Object.getOwnPropertyDescriptor;var iN=Object.getOwnPropertyNames;var nN=Object.getPrototypeOf,sN=Object.prototype.hasOwnProperty;var $0=t=>{throw TypeError(t)};var oN=(t,e,r)=>e in t?En(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var l=(t,e)=>En(t,"name",{value:e,configurable:!0}),ie=(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 aN=(t,e)=>()=>(t&&(e=t(t=0)),e);var T=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),cN=(t,e)=>{for(var r in e)En(t,r,{get:e[r],enumerable:!0})},B0=(t,e,r,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of iN(e))!sN.call(t,n)&&n!==r&&En(t,n,{get:()=>e[n],enumerable:!(i=rN(e,n))||i.enumerable});return t};var ce=(t,e,r)=>(r=t!=null?tN(nN(t)):{},B0(e||!t||!t.__esModule?En(r,"default",{value:t,enumerable:!0}):r,t)),Od=t=>B0(En({},"__esModule",{value:!0}),t);var U=(t,e,r)=>oN(t,typeof e!="symbol"?e+"":e,r),M0=(t,e,r)=>e.has(t)||$0("Cannot "+r);var Jo=(t,e,r)=>(M0(t,e,"read from private field"),r?r.call(t):e.get(t)),Ko=(t,e,r)=>e.has(t)?$0("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),Xo=(t,e,r,i)=>(M0(t,e,"write to private field"),i?i.call(t,r):e.set(t,r),r);var Vt=T(is=>{"use strict";Object.defineProperty(is,"__esModule",{value:!0});is.constants=is.SEP=void 0;is.SEP="/";is.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 Md=T(ia=>{"use strict";Object.defineProperty(ia,"__esModule",{value:!0});ia.Stats=void 0;var wN=Vt(),{S_IFMT:yN,S_IFDIR:gN,S_IFREG:bN,S_IFBLK:_N,S_IFCHR:SN,S_IFLNK:vN,S_IFIFO:EN,S_IFSOCK:FN}=wN.constants,Gc=class Gc{static build(e,r=!1){let i=new Gc,{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)&yN)===e}isDirectory(){return this._checkModeProperty(gN)}isFile(){return this._checkModeProperty(bN)}isBlockDevice(){return this._checkModeProperty(_N)}isCharacterDevice(){return this._checkModeProperty(SN)}isSymbolicLink(){return this._checkModeProperty(vN)}isFIFO(){return this._checkModeProperty(EN)}isSocket(){return this._checkModeProperty(FN)}};l(Gc,"Stats");var Vc=Gc;ia.Stats=Vc;ia.default=Vc});var mb=T(Jc=>{"use strict";Object.defineProperty(Jc,"__esModule",{value:!0});Jc.Buffer=void 0;var TN=ie("node:buffer");Object.defineProperty(Jc,"Buffer",{enumerable:!0,get:l(function(){return TN.Buffer},"get")})});var Kr=T(Jr=>{"use strict";Object.defineProperty(Jr,"__esModule",{value:!0});Jr.bufferFrom=Jr.bufferAllocUnsafe=Jr.Buffer=void 0;var Kc=mb();Object.defineProperty(Jr,"Buffer",{enumerable:!0,get:l(function(){return Kc.Buffer},"get")});function wb(t,...e){return new Kc.Buffer(t,...e)}l(wb,"bufferV0P12Ponyfill");var kN=Kc.Buffer.allocUnsafe||wb;Jr.bufferAllocUnsafe=kN;var RN=Kc.Buffer.from||wb;Jr.bufferFrom=RN});var jd=T(ns=>{"use strict";Object.defineProperty(ns,"__esModule",{value:!0});ns.inherits=ON;ns.promisify=xN;ns.inspect=Ld;ns.format=AN;function ON(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(ON,"inherits");function xN(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(xN,"promisify");function Ld(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=>Ld(r)).join(", ")} ]`:typeof t=="object"?`{ ${Object.entries(t).map(([r,i])=>`${r}: ${Ld(i)}`).join(", ")} }`:String(t)}l(Ld,"inspect");function AN(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(AN,"format")});var na=T(Je=>{"use strict";Object.defineProperty(Je,"__esModule",{value:!0});Je.AssertionError=Je.RangeError=Je.TypeError=Je.Error=void 0;Je.message=bb;Je.E=Xr;var qd=jd(),yb=typeof Symbol>"u"?"_kCode":Symbol("code"),gb={};function Wd(t){var e;return e=class extends t{constructor(i,...n){super(bb(i,n)),this.code=i,this[yb]=i,this.name=`${super.name} [${this[yb]}]`}},l(e,"NodeError"),e}l(Wd,"makeNodeError");var Xc=globalThis,zd=class zd extends Xc.Error{constructor(e){if(typeof e!="object"||e===null)throw new Je.TypeError("ERR_INVALID_ARG_TYPE","options","object");e.message?super(e.message):super(`${(0,qd.inspect)(e.actual).slice(0,128)} ${e.operator} ${(0,qd.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,Je.Error.captureStackTrace(this,e.stackStartFunction)}};l(zd,"AssertionError");var Ud=zd;Je.AssertionError=Ud;function bb(t,e){if(typeof t!="string")throw new Je.Error("Error message key must be a string");let r=gb[t];if(!r)throw new Je.Error(`An invalid error message key was used: ${t}.`);let i;if(typeof r=="function")i=r;else{if(i=qd.format,e===void 0||e.length===0)return r;e.unshift(r)}return String(i.apply(null,e))}l(bb,"message");function Xr(t,e){gb[t]=typeof e=="function"?e:String(e)}l(Xr,"E");Je.Error=Wd(Xc.Error);Je.TypeError=Wd(Xc.TypeError);Je.RangeError=Wd(Xc.RangeError);Xr("ERR_DIR_CLOSED","Directory handle was closed");Xr("ERR_DIR_CONCURRENT_OPERATION","Cannot do synchronous work on directory handle with concurrent asynchronous operations");Xr("ERR_INVALID_FILE_URL_HOST",'File URL host must be "localhost" or empty on %s');Xr("ERR_INVALID_FILE_URL_PATH","File URL path %s");Xr("ERR_INVALID_OPT_VALUE",(t,e)=>`The value "${String(e)}" is invalid for option "${t}"`);Xr("ERR_INVALID_OPT_VALUE_ENCODING",t=>`The value "${String(t)}" is invalid for option "encoding"`);Xr("ERR_INVALID_ARG_VALUE","Unable to open file as blob")});var sa=T(Ci=>{"use strict";Object.defineProperty(Ci,"__esModule",{value:!0});Ci.ENCODING_UTF8=void 0;Ci.assertEncoding=NN;Ci.strToEncoding=DN;var Hd=Kr(),PN=na();Ci.ENCODING_UTF8="utf8";function NN(t){if(t&&!Hd.Buffer.isEncoding(t))throw new PN.TypeError("ERR_INVALID_OPT_VALUE_ENCODING",t)}l(NN,"assertEncoding");function DN(t,e){return!e||e===Ci.ENCODING_UTF8?t:e==="buffer"?new Hd.Buffer(t):new Hd.Buffer(t).toString(e)}l(DN,"strToEncoding")});var Qc=T(oa=>{"use strict";Object.defineProperty(oa,"__esModule",{value:!0});oa.Dirent=void 0;var CN=Vt(),IN=sa(),{S_IFMT:$N,S_IFDIR:BN,S_IFREG:MN,S_IFBLK:LN,S_IFCHR:jN,S_IFLNK:qN,S_IFIFO:UN,S_IFSOCK:WN}=CN.constants,Zc=class Zc{constructor(){this.name="",this.path="",this.parentPath="",this.mode=0}static build(e,r){let i=new Zc,{mode:n}=e.getNode();return i.name=(0,IN.strToEncoding)(e.getName(),r),i.mode=n,i.path=e.getParentPath(),i.parentPath=i.path,i}_checkModeProperty(e){return(this.mode&$N)===e}isDirectory(){return this._checkModeProperty(BN)}isFile(){return this._checkModeProperty(MN)}isBlockDevice(){return this._checkModeProperty(LN)}isCharacterDevice(){return this._checkModeProperty(jN)}isSymbolicLink(){return this._checkModeProperty(qN)}isFIFO(){return this._checkModeProperty(UN)}isSocket(){return this._checkModeProperty(WN)}};l(Zc,"Dirent");var Yc=Zc;oa.Dirent=Yc;oa.default=Yc});var ss=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 Rr=ie("node:path");Object.defineProperty(ke,"resolve",{enumerable:!0,get:l(function(){return Rr.resolve},"get")});Object.defineProperty(ke,"sep",{enumerable:!0,get:l(function(){return Rr.sep},"get")});Object.defineProperty(ke,"posix",{enumerable:!0,get:l(function(){return Rr.posix},"get")});Object.defineProperty(ke,"join",{enumerable:!0,get:l(function(){return Rr.join},"get")});Object.defineProperty(ke,"relative",{enumerable:!0,get:l(function(){return Rr.relative},"get")});Object.defineProperty(ke,"dirname",{enumerable:!0,get:l(function(){return Rr.dirname},"get")});Object.defineProperty(ke,"normalize",{enumerable:!0,get:l(function(){return Rr.normalize},"get")});Object.defineProperty(ke,"isAbsolute",{enumerable:!0,get:l(function(){return Rr.isAbsolute},"get")});Object.defineProperty(ke,"basename",{enumerable:!0,get:l(function(){return Rr.basename},"get")})});var il={};cN(il,{__addDisposableResource:()=>zb,__assign:()=>el,__asyncDelegator:()=>$b,__asyncGenerator:()=>Ib,__asyncValues:()=>Bb,__await:()=>os,__awaiter:()=>xb,__classPrivateFieldGet:()=>qb,__classPrivateFieldIn:()=>Wb,__classPrivateFieldSet:()=>Ub,__createBinding:()=>rl,__decorate:()=>vb,__disposeResources:()=>Hb,__esDecorate:()=>Fb,__exportStar:()=>Pb,__extends:()=>_b,__generator:()=>Ab,__importDefault:()=>jb,__importStar:()=>Lb,__makeTemplateObject:()=>Mb,__metadata:()=>Ob,__param:()=>Eb,__propKey:()=>kb,__read:()=>Jd,__rest:()=>Sb,__rewriteRelativeImportExtension:()=>Vb,__runInitializers:()=>Tb,__setFunctionName:()=>Rb,__spread:()=>Nb,__spreadArray:()=>Cb,__spreadArrays:()=>Db,__values:()=>tl,default:()=>VN});function _b(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");Vd(t,e);function r(){this.constructor=t}l(r,"__"),t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function Sb(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 vb(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 Eb(t,e){return function(r,i){e(r,i,t)}}function Fb(t,e,r,i,n,s){function o(b){if(b!==void 0&&typeof b!="function")throw new TypeError("Function expected");return b}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(b){if(d)throw new TypeError("Cannot add initializers after decoration has completed");s.push(o(b||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 Tb(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 kb(t){return typeof t=="symbol"?t:"".concat(t)}function Rb(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 Ob(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function xb(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 Ab(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 Pb(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&rl(e,t,r)}function tl(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 Jd(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 Nb(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(Jd(arguments[e]));return t}function Db(){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 Cb(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 os(t){return this instanceof os?(this.v=t,this):new os(t)}function Ib(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,b){s.push([p,w,y,b])>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 os?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 $b(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:os(t[n](o)),done:!1}:s?s(o):o}:s}}function Bb(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 tl=="function"?tl(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 Mb(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function Lb(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r=Gd(t),i=0;i<r.length;i++)r[i]!=="default"&&rl(e,t,r[i]);return zN(e,t),e}function jb(t){return t&&t.__esModule?t:{default:t}}function qb(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 Ub(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 Wb(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 zb(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 Hb(t){function e(s){t.error=t.hasError?new HN(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 Vb(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 Vd,el,rl,zN,Gd,HN,VN,nl=aN(()=>{Vd=l(function(t,e){return Vd=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])},Vd(t,e)},"extendStatics");l(_b,"__extends");el=l(function(){return el=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"),el.apply(this,arguments)},"__assign");l(Sb,"__rest");l(vb,"__decorate");l(Eb,"__param");l(Fb,"__esDecorate");l(Tb,"__runInitializers");l(kb,"__propKey");l(Rb,"__setFunctionName");l(Ob,"__metadata");l(xb,"__awaiter");l(Ab,"__generator");rl=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(Pb,"__exportStar");l(tl,"__values");l(Jd,"__read");l(Nb,"__spread");l(Db,"__spreadArrays");l(Cb,"__spreadArray");l(os,"__await");l(Ib,"__asyncGenerator");l($b,"__asyncDelegator");l(Bb,"__asyncValues");l(Mb,"__makeTemplateObject");zN=Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e},Gd=l(function(t){return Gd=Object.getOwnPropertyNames||function(e){var r=[];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(r[r.length]=i);return r},Gd(t)},"ownKeys");l(Lb,"__importStar");l(jb,"__importDefault");l(qb,"__classPrivateFieldGet");l(Ub,"__classPrivateFieldSet");l(Wb,"__classPrivateFieldIn");l(zb,"__addDisposableResource");HN=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(Hb,"__disposeResources");l(Vb,"__rewriteRelativeImportExtension");VN={__extends:_b,__assign:el,__rest:Sb,__decorate:vb,__param:Eb,__esDecorate:Fb,__runInitializers:Tb,__propKey:kb,__setFunctionName:Rb,__metadata:Ob,__awaiter:xb,__generator:Ab,__createBinding:rl,__exportStar:Pb,__values:tl,__read:Jd,__spread:Nb,__spreadArrays:Db,__spreadArray:Cb,__await:os,__asyncGenerator:Ib,__asyncDelegator:$b,__asyncValues:Bb,__makeTemplateObject:Mb,__importStar:Lb,__importDefault:jb,__classPrivateFieldGet:qb,__classPrivateFieldSet:Ub,__classPrivateFieldIn:Wb,__addDisposableResource:zb,__disposeResources:Hb,__rewriteRelativeImportExtension:Vb}});var Jb=T(Gb=>{"use strict";Object.defineProperty(Gb,"__esModule",{value:!0})});var Xd=T(sl=>{"use strict";Object.defineProperty(sl,"__esModule",{value:!0});sl.flattenJSON=void 0;var Kb=Kr(),Kd=ss(),GN=Kd.posix?Kd.posix.join:Kd.join,JN=l(t=>{let e={};function r(i,n){for(let s in n){let o=n[s],f=GN(i,s);typeof o=="string"||o instanceof Kb.Buffer?e[f]=o:typeof o=="object"&&o!==null&&!(o instanceof Kb.Buffer)&&Object.keys(o).length>0?r(f,o):e[f]=null}}return l(r,"flatten"),r("",t),e},"flattenJSON");sl.flattenJSON=JN});var aa=T(ol=>{"use strict";Object.defineProperty(ol,"__esModule",{value:!0});ol.FanOut=void 0;var Zd=class Zd{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(Zd,"FanOut");var Yd=Zd;ol.FanOut=Yd});var cl=T(al=>{"use strict";Object.defineProperty(al,"__esModule",{value:!0});al.createProcess=Xb;var KN=l(()=>{if(typeof process<"u")return process;try{return ie("process")}catch{return}},"maybeReturnProcess");function Xb(){let t=KN()||{};return t.cwd||(t.cwd=()=>"/"),t.emitWarning||(t.emitWarning=(e,r)=>{console.warn(`${r}${r?": ":""}${e}`)}),t.env||(t.env={}),t}l(Xb,"createProcess");al.default=Xb()});var tp=T(ul=>{"use strict";Object.defineProperty(ul,"__esModule",{value:!0});ul.Node=void 0;var XN=aa(),Zb=cl(),xt=Kr(),YN=Vt(),{S_IFMT:Or,S_IFDIR:ZN,S_IFREG:QN,S_IFLNK:Yb,S_IFCHR:eD}=YN.constants,ll=l(()=>Zb.default.getuid?.()??0,"getuid"),fl=l(()=>Zb.default.getgid?.()??0,"getgid"),ep=class ep{constructor(e,r=438){this.changes=new XN.FanOut,this._uid=ll(),this._gid=fl(),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&~Or}set perm(e){this.mode=this.mode&Or|e&~Or,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,xt.bufferFrom)(e,"utf8"),this.touch()}getBuffer(){return this.atime=new Date,this.buf||(this.buf=(0,xt.bufferAllocUnsafe)(0)),(0,xt.bufferFrom)(this.buf)}setBuffer(e){this.buf=(0,xt.bufferFrom)(e),this.touch()}getSize(){return this.buf?this.buf.length:0}setModeProperty(e){this.mode=e}isFile(){return(this.mode&Or)===QN}isDirectory(){return(this.mode&Or)===ZN}isSymlink(){return(this.mode&Or)===Yb}isCharacterDevice(){return(this.mode&Or)===eD}makeSymlink(e){this.mode=Yb|438,this.symlink=e}write(e,r=0,i=e.length,n=0){if(this.buf||(this.buf=(0,xt.bufferAllocUnsafe)(0)),n+i>this.buf.length){let s=(0,xt.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,xt.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 xt.Buffer?e:xt.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,xt.bufferAllocUnsafe)(0);else if(this.buf||(this.buf=(0,xt.bufferAllocUnsafe)(0)),e<=this.buf.length)this.buf=this.buf.slice(0,e);else{let r=(0,xt.bufferAllocUnsafe)(e);this.buf.copy(r),r.fill(0,this.buf.length),this.buf=r}this.touch()}chmod(e){this.mode=this.mode&Or|e&~Or,this.touch()}chown(e,r){this.uid=e,this.gid=r,this.touch()}touch(){this.mtime=new Date,this.changes.emit(["modify"])}canRead(e=ll(),r=fl()){return!!(this.perm&4||r===this.gid&&this.perm&32||e===this.uid&&this.perm&256)}canWrite(e=ll(),r=fl()){return!!(this.perm&2||r===this.gid&&this.perm&16||e===this.uid&&this.perm&128)}canExecute(e=ll(),r=fl()){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(ep,"Node");var Qd=ep;ul.Node=Qd});var ip=T(hl=>{"use strict";Object.defineProperty(hl,"__esModule",{value:!0});hl.Link=void 0;var tD=Vt(),rD=aa(),{S_IFREG:iD}=tD.constants,ca=class ca{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 rD.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(iD|438)){let i=new ca(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 ca(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(ca,"Link");var rp=ca;hl.Link=rp});var op=T(dl=>{"use strict";Object.defineProperty(dl,"__esModule",{value:!0});dl.File=void 0;var nD=Vt(),{O_APPEND:sD}=nD.constants,sp=class sp{constructor(e,r,i,n){this.link=e,this.node=r,this.flags=i,this.fd=n,this.position=0,this.flags&sD&&(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(sp,"File");var np=sp;dl.File=np});var ls=T(cs=>{"use strict";Object.defineProperty(cs,"__esModule",{value:!0});cs.FLAGS=cs.ERRSTR=void 0;var oD=Vt();cs.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:Qb,O_WRONLY:pl,O_RDWR:as,O_CREAT:Yr,O_EXCL:ml,O_TRUNC:wl,O_APPEND:yl,O_SYNC:e_}=oD.constants,t_;(function(t){t[t.r=Qb]="r",t[t["r+"]=as]="r+",t[t.rs=Qb|e_]="rs",t[t.sr=t.rs]="sr",t[t["rs+"]=as|e_]="rs+",t[t["sr+"]=t["rs+"]]="sr+",t[t.w=pl|Yr|wl]="w",t[t.wx=pl|Yr|wl|ml]="wx",t[t.xw=t.wx]="xw",t[t["w+"]=as|Yr|wl]="w+",t[t["wx+"]=as|Yr|wl|ml]="wx+",t[t["xw+"]=t["wx+"]]="xw+",t[t.a=pl|yl|Yr]="a",t[t.ax=pl|yl|Yr|ml]="ax",t[t.xa=t.ax]="xa",t[t["a+"]=as|yl|Yr]="a+",t[t["ax+"]=as|yl|Yr|ml]="ax+",t[t["xa+"]=t["ax+"]]="xa+"})(t_||(cs.FLAGS=t_={}))});var cp=T(ap=>{"use strict";Object.defineProperty(ap,"__esModule",{value:!0});ap.default=typeof queueMicrotask=="function"?queueMicrotask:t=>Promise.resolve().then(()=>t()).catch(()=>{})});var Sl=T(Be=>{"use strict";Object.defineProperty(Be,"__esModule",{value:!0});Be.filenameToSteps=Be.resolve=Be.unixify=Be.isWin=void 0;Be.isFd=i_;Be.validateFd=wD;Be.dataToBuffer=yD;var bl=ss(),gl=Kr(),r_=cl(),aD=sa(),cD=ls();Be.isWin=r_.default.platform==="win32";var lD=bl.resolve,fD=bl.posix?bl.posix.sep:bl.sep,uD=l((t,e)=>{let r=t[e];return e>0&&(r==="/"||Be.isWin&&r==="\\")},"isSeparator"),hD=l(t=>{let e=t.length-1;if(e<2)return t;for(;uD(t,e);)e--;return t.substr(0,e+1)},"removeTrailingSeparator"),dD=l((t,e)=>{if(typeof t!="string")throw new TypeError("expected a string");return t=t.replace(/[\\\/]+/g,"/"),e!==!1&&(t=hD(t)),t},"normalizePath"),pD=l((t,e=!0)=>Be.isWin?(t=dD(t,e),t.replace(/^([a-zA-Z]+:|\.\/)/,"")):t,"unixify");Be.unixify=pD;var _l=l((t,e=r_.default.cwd())=>lD(e,t),"resolve");Be.resolve=_l;if(Be.isWin){let t=_l;Be.resolve=_l=l((e,r)=>(0,Be.unixify)(t(e,r)),"resolve")}var mD=l((t,e)=>{let i=_l(t,e).substring(1);return i?i.split(fD):[]},"filenameToSteps");Be.filenameToSteps=mD;function i_(t){return t>>>0===t}l(i_,"isFd");function wD(t){if(!i_(t))throw TypeError(cD.ERRSTR.FD)}l(wD,"validateFd");function yD(t,e=aD.ENCODING_UTF8){return gl.Buffer.isBuffer(t)?t:t instanceof Uint8Array?(0,gl.bufferFrom)(t):e==="buffer"?(0,gl.bufferFrom)(String(t),"utf8"):(0,gl.bufferFrom)(String(t),e)}l(yD,"dataToBuffer")});var Zr=T(Ne=>{"use strict";Object.defineProperty(Ne,"__esModule",{value:!0});Ne.getWriteSyncArgs=Ne.getWriteArgs=Ne.bufToUint8=void 0;Ne.promisify=bD;Ne.validateCallback=n_;Ne.modeToNumber=s_;Ne.nullCheck=o_;Ne.pathToFilename=vD;Ne.createError=MD;Ne.genRndStr6=LD;Ne.flagsToNumber=jD;Ne.streamToBuffer=qD;Ne.bufferToEncoding=HD;Ne.isReadableStream=VD;var la=ls(),lp=na(),fp=Kr(),gD=cp(),vl=Sl();function bD(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(bD,"promisify");function n_(t){if(typeof t!="function")throw TypeError(la.ERRSTR.CB);return t}l(n_,"validateCallback");function _D(t,e){if(typeof t=="number")return t;if(typeof t=="string")return parseInt(t,8);if(e)return s_(e)}l(_D,"_modeToNumber");function s_(t,e){let r=_D(t,e);if(typeof r!="number"||isNaN(r))throw new TypeError(la.ERRSTR.MODE_INT);return r}l(s_,"modeToNumber");function o_(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,gD.default)(()=>{e(r)}),!1}return!0}l(o_,"nullCheck");function SD(t){if(t.hostname!=="")throw new lp.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 lp.TypeError("ERR_INVALID_FILE_URL_PATH","must not include encoded / characters")}return decodeURIComponent(e)}l(SD,"getPathFromURLPosix");function vD(t){if(t instanceof Uint8Array&&(t=(0,fp.bufferFrom)(t)),typeof t!="string"&&!fp.Buffer.isBuffer(t)){try{if(!(t instanceof ie("url").URL))throw new TypeError(la.ERRSTR.PATH_STR)}catch{throw new TypeError(la.ERRSTR.PATH_STR)}t=SD(t)}let e=String(t);return o_(e),e}l(vD,"pathToFilename");var ED="ENOENT",FD="EBADF",TD="EINVAL",kD="EPERM",RD="EPROTO",OD="EEXIST",xD="ENOTDIR",AD="EMFILE",PD="EACCES",ND="EISDIR",DD="ENOTEMPTY",CD="ENOSYS",ID="ERR_FS_EISDIR",$D="ERR_OUT_OF_RANGE";function BD(t,e="",r="",i=""){let n="";switch(r&&(n=` '${r}'`),i&&(n+=` -> '${i}'`),t){case ED:return`ENOENT: no such file or directory, ${e}${n}`;case FD:return`EBADF: bad file descriptor, ${e}${n}`;case TD:return`EINVAL: invalid argument, ${e}${n}`;case kD:return`EPERM: operation not permitted, ${e}${n}`;case RD:return`EPROTO: protocol error, ${e}${n}`;case OD:return`EEXIST: file already exists, ${e}${n}`;case xD:return`ENOTDIR: not a directory, ${e}${n}`;case ND:return`EISDIR: illegal operation on a directory, ${e}${n}`;case PD:return`EACCES: permission denied, ${e}${n}`;case DD:return`ENOTEMPTY: directory not empty, ${e}${n}`;case AD:return`EMFILE: too many open files, ${e}${n}`;case CD:return`ENOSYS: function not implemented, ${e}${n}`;case ID:return`[ERR_FS_EISDIR]: Path is a directory: ${e} returned EISDIR (is a directory) ${r}`;case $D:return`[ERR_OUT_OF_RANGE]: value out of range, ${e}${n}`;default:return`${t}: error occurred, ${e}${n}`}}l(BD,"formatError");function MD(t,e="",r="",i="",n=Error){let s=new n(BD(t,e,r,i));return s.code=t,r&&(s.path=r),s}l(MD,"createError");function LD(){return Math.random().toString(36).slice(2,8).padEnd(6,"0")}l(LD,"genRndStr6");function jD(t){if(typeof t=="number")return t;if(typeof t=="string"){let e=la.FLAGS[t];if(typeof e<"u")return e}throw new lp.TypeError("ERR_INVALID_OPT_VALUE","flags",t)}l(jD,"flagsToNumber");function qD(t){let e=[];return new Promise((r,i)=>{t.on("data",n=>e.push(n)),t.on("end",()=>r(fp.Buffer.concat(e))),t.on("error",i)})}l(qD,"streamToBuffer");var UD=l(t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),"bufToUint8");Ne.bufToUint8=UD;var WD=l((t,e,r,i,n,s)=>{(0,vl.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,vl.dataToBuffer)(e,a);h!=="string"?typeof f>"u"&&(f=w.length):(o=0,f=w.length);let y=n_(u);return[t,h==="string",w,o,f,c,y]},"getWriteArgs");Ne.getWriteArgs=WD;var zD=l((t,e,r,i,n)=>{(0,vl.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,vl.dataToBuffer)(e,s);return a?typeof f>"u"&&(f=u.length):(o=0,f=u.length),[t,u,o||0,f,c]},"getWriteSyncArgs");Ne.getWriteSyncArgs=zD;function HD(t,e){return!e||e==="buffer"?t:t.toString(e)}l(HD,"bufferToEncoding");function VD(t){return t!==null&&typeof t=="object"&&typeof t.pipe=="function"&&typeof t.on=="function"&&t.readable===!0}l(VD,"isReadableStream")});var h_=T(Tl=>{"use strict";Object.defineProperty(Tl,"__esModule",{value:!0});Tl.Superblock=void 0;var Me=ss(),GD=tp(),a_=ip(),JD=op(),KD=Kr(),c_=cl(),ar=Vt(),l_=ls(),V=Zr(),Gt=Sl(),XD=Xd(),fs=Me.posix?Me.posix.sep:Me.sep,f_=Me.posix?Me.posix.relative:Me.relative,YD=Me.posix?Me.posix.join:Me.join,{O_RDONLY:up,O_WRONLY:El,O_RDWR:hp,O_CREAT:u_,O_EXCL:ZD,O_TRUNC:QD,O_APPEND:eC,O_DIRECTORY:tC}=ar.constants,us=class us{static fromJSON(e,r){let i=new us;return i.fromJSON(e,r),i}static fromNestedJSON(e,r){let i=new us;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,V.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,V.pathToFilename)(i),s,o);let a=0,u=n.length,h=s&eC?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,V.createError)("ERR_OUT_OF_RANGE","read",void 0,void 0,RangeError);let c=this.getFileByFdOrThrow(i);if(c.node.isSymlink())throw(0,V.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,V.createError)(u.code,"link",i,n)),u}let o=(0,Me.dirname)(n),f;try{f=this.getLinkOrThrow(o,"link")}catch(u){throw u.code&&(u=(0,V.createError)(u.code,"link",i,n)),u}let c=(0,Me.basename)(n);if(f.getChild(c))throw(0,V.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,Gt.filenameToSteps)(n),o;try{o=this.getLinkParentAsDirOrThrow(s)}catch(u){throw u.code&&(u=(0,V.createError)(u.code,"symlink",i,n)),u}let f=s[s.length-1];if(o.getChild(f))throw(0,V.createError)("EEXIST","symlink",i,n);let c=o.getNode();if(!c.canExecute()||!c.canWrite())throw(0,V.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,V.createError)(h.code,"rename",i,n)),h}let o;try{o=this.getLinkParentAsDirOrThrow(n)}catch(h){throw h.code&&(h=(0,V.createError)(h.code,"rename",i,n)),h}let f=s.parent;if(!f)throw(0,V.createError)("EINVAL","rename",i,n);let c=f.getNode(),a=o.getNode();if(!c.canExecute()||!c.canWrite()||!a.canExecute()||!a.canWrite())throw(0,V.createError)("EACCES","rename",i,n);f.deleteChild(s);let u=(0,Me.basename)(n);s.name=u,s.steps=[...o.steps,u],o.setChild(s.getName(),s)},this.mkdir=(i,n)=>{let s=(0,Gt.filenameToSteps)(i);if(!s.length)throw(0,V.createError)("EEXIST","mkdir",i);let o=this.getLinkParentAsDirOrThrow(i,"mkdir"),f=s[s.length-1];if(o.getChild(f))throw(0,V.createError)("EEXIST","mkdir",i);let c=o.getNode();if(!c.canWrite()||!c.canExecute())throw(0,V.createError)("EACCES","mkdir",i);o.createChild(f,this.createNode(ar.constants.S_IFDIR|n))},this.mkdirp=(i,n)=>{let s=!1,o=(0,Gt.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(Me.sep+o.slice(0,c).join(Me.sep),"mkdir"),c;c<o.length;c++){let a=f.getNode();if(a.isDirectory()){if(!a.canExecute()||!a.canWrite())throw(0,V.createError)("EACCES","mkdir",i)}else throw(0,V.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,V.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,V.createError)("ERR_FS_EISDIR","rm",i);if(!o.parent?.getNode().canWrite())throw(0,V.createError)("EACCES","rm",i);this.deleteLink(o)},this.close=i=>{(0,Gt.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 a_.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:us.fd--}createNode(e){let r=new GD.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 a_.Link?(o=e.steps,f=fs+o.join(fs)):typeof e=="string"?(o=(0,Gt.filenameToSteps)(e),f=e):(o=e,f=fs+o.join(fs));let c=this.root,a=0;for(;a<o.length;){let u=c.getNode();if(u.isDirectory()){if(n&&!u.canExecute())throw(0,V.createError)("EACCES",s,f)}else if(a<o.length-1)throw(0,V.createError)("ENOTDIR",s,f);if(c=c.getChild(o[a])??null,!c){if(i)throw(0,V.createError)("ENOENT",s,f);return null}if(u=c?.getNode(),u.isSymlink()&&(r||a<o.length-1)){let h=(0,Me.isAbsolute)(u.symlink)?u.symlink:YD((0,Me.dirname)(c.getPath()),u.symlink);o=(0,Gt.filenameToSteps)(h).concat(o.slice(a+1)),c=this.root,a=0;continue}if(i&&!u.isDirectory()&&a<o.length-1){let h=c_.default.platform==="win32"?"ENOENT":"ENOTDIR";throw(0,V.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,V.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,Gt.filenameToSteps)(e)).slice(0,-1),n=fs+i.join(fs),s=this.getLinkOrThrow(n,r);if(!s.getNode().isDirectory())throw(0,V.createError)("ENOTDIR",r,n);return s}getFileByFd(e){return this.fds[String(e)]}getFileByFdOrThrow(e,r){if(!(0,Gt.isFd)(e))throw TypeError(l_.ERRSTR.FD);let i=this.getFileByFd(e);if(!i)throw(0,V.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=f_(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=f_(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,V.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=c_.default.cwd()){for(let i in e){let n=e[i];if(i=(0,Gt.resolve)(i,r),typeof n=="string"||n instanceof KD.Buffer){let s=(0,Me.dirname)(i);this.mkdirp(s,511);let o=(0,Gt.dataToBuffer)(n);this.writeFile(i,o,l_.FLAGS.w,438)}else this.mkdirp(i,511)}}fromNestedJSON(e,r){this.fromJSON((0,XD.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,V.createError)("EMFILE","open",e.getPath());let n=e;i&&(n=this.getResolvedLinkOrThrow(e.getPath(),"open"));let s=n.getNode();if(s.isDirectory()){if((r&(up|hp|El))!==up)throw(0,V.createError)("EISDIR","open",e.getPath())}else if(r&tC)throw(0,V.createError)("ENOTDIR","open",e.getPath());if((r&(up|hp|El))!==El&&!s.canRead()||r&(El|hp)&&!s.canWrite())throw(0,V.createError)("EACCES","open",e.getPath());let o=new JD.File(e,s,r,this.newFdNumber());return this.fds[o.fd]=o,this.openFiles++,r&QD&&o.truncate(),o}openFile(e,r,i,n=!0){let s=(0,Gt.filenameToSteps)(e),o;try{if(o=n?this.getResolvedLinkOrThrow(e,"open"):this.getLinkOrThrow(e,"open"),o&&r&u_&&r&ZD)throw(0,V.createError)("EEXIST","open",e)}catch(f){if(f.code==="ENOENT"&&r&u_){let c=(0,Me.dirname)(e),a=this.getResolvedLinkOrThrow(c),u=a.getNode();if(!u.isDirectory())throw(0,V.createError)("ENOTDIR","open",e);if(!u.canExecute()||!u.canWrite())throw(0,V.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,V.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,V.createError)("EBADF","write",o.link.getPath());return o.write(r,i,n,s===-1||typeof s!="number"?void 0:s)}};l(us,"Superblock");var Fl=us;Tl.Superblock=Fl;Fl.fd=2147483647});var p_=T(At=>{"use strict";Object.defineProperty(At,"__esModule",{value:!0});At.Superblock=At.File=At.Link=At.Node=void 0;var d_=(nl(),Od(il));d_.__exportStar(Jb(),At);d_.__exportStar(Xd(),At);var rC=tp();Object.defineProperty(At,"Node",{enumerable:!0,get:l(function(){return rC.Node},"get")});var iC=ip();Object.defineProperty(At,"Link",{enumerable:!0,get:l(function(){return iC.Link},"get")});var nC=op();Object.defineProperty(At,"File",{enumerable:!0,get:l(function(){return nC.File},"get")});var sC=h_();Object.defineProperty(At,"Superblock",{enumerable:!0,get:l(function(){return sC.Superblock},"get")})});var m_=T(fa=>{"use strict";Object.defineProperty(fa,"__esModule",{value:!0});fa.StatFs=void 0;var Rl=class Rl{static build(e,r=!1){let i=new Rl,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(Rl,"StatFs");var kl=Rl;fa.StatFs=kl;fa.default=kl});var w_=T(dp=>{"use strict";Object.defineProperty(dp,"__esModule",{value:!0});function oC(t,e,r){let i=setTimeout.apply(globalThis,arguments);return i&&typeof i=="object"&&typeof i.unref=="function"&&i.unref(),i}l(oC,"setTimeoutUnref");dp.default=oC});var g_=T(hs=>{"use strict";Object.defineProperty(hs,"__esModule",{value:!0});hs.Writable=hs.Readable=void 0;var y_=ie("node:stream");Object.defineProperty(hs,"Readable",{enumerable:!0,get:l(function(){return y_.Readable},"get")});Object.defineProperty(hs,"Writable",{enumerable:!0,get:l(function(){return y_.Writable},"get")})});var pp=T(Ol=>{"use strict";Object.defineProperty(Ol,"__esModule",{value:!0});Ol.EventEmitter=void 0;var aC=ie("node:events");Object.defineProperty(Ol,"EventEmitter",{enumerable:!0,get:l(function(){return aC.EventEmitter},"get")})});var b_=T(xl=>{"use strict";Object.defineProperty(xl,"__esModule",{value:!0});xl.FileHandle=void 0;var Ke=Zr(),cC=pp(),wp=class wp extends cC.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,Ke.promisify)(this.fs,"appendFile")(this.fd,e,r)}chmod(e){return(0,Ke.promisify)(this.fs,"fchmod")(this.fd,e)}chown(e,r){return(0,Ke.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,Ke.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,Ke.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,Ke.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,Ke.promisify)(this.fs,"readv",i=>({bytesRead:i,buffers:e}))(this.fd,e,r)}readFile(e){return(0,Ke.promisify)(this.fs,"readFile")(this.fd,e)}stat(e){return(0,Ke.promisify)(this.fs,"fstat")(this.fd,e)}sync(){return(0,Ke.promisify)(this.fs,"fsync")(this.fd)}truncate(e){return(0,Ke.promisify)(this.fs,"ftruncate")(this.fd,e)}utimes(e,r){return(0,Ke.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,Ke.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,Ke.promisify)(this.fs,"writev",i=>({bytesWritten:i,buffers:e}))(this.fd,e,r)}writeFile(e,r){return(0,Ke.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,Ke.promisify)(this.fs,"close")(this.fd).then(this.closeResolve,this.closeReject))}};l(wp,"FileHandle");var mp=wp;xl.FileHandle=mp});var __=T(Al=>{"use strict";Object.defineProperty(Al,"__esModule",{value:!0});Al.FsPromises=void 0;var ne=Zr(),lC=Vt(),bp=class bp{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(bp,"FSWatchAsyncIterator");var yp=bp,_p=class _p{constructor(e,r){this.fs=e,this.FileHandle=r,this.constants=lC.constants,this.cp=(0,ne.promisify)(this.fs,"cp"),this.opendir=(0,ne.promisify)(this.fs,"opendir"),this.statfs=(0,ne.promisify)(this.fs,"statfs"),this.lutimes=(0,ne.promisify)(this.fs,"lutimes"),this.glob=(0,ne.promisify)(this.fs,"glob"),this.access=(0,ne.promisify)(this.fs,"access"),this.chmod=(0,ne.promisify)(this.fs,"chmod"),this.chown=(0,ne.promisify)(this.fs,"chown"),this.copyFile=(0,ne.promisify)(this.fs,"copyFile"),this.lchmod=(0,ne.promisify)(this.fs,"lchmod"),this.lchown=(0,ne.promisify)(this.fs,"lchown"),this.link=(0,ne.promisify)(this.fs,"link"),this.lstat=(0,ne.promisify)(this.fs,"lstat"),this.mkdir=(0,ne.promisify)(this.fs,"mkdir"),this.mkdtemp=(0,ne.promisify)(this.fs,"mkdtemp"),this.readdir=(0,ne.promisify)(this.fs,"readdir"),this.readlink=(0,ne.promisify)(this.fs,"readlink"),this.realpath=(0,ne.promisify)(this.fs,"realpath"),this.rename=(0,ne.promisify)(this.fs,"rename"),this.rmdir=(0,ne.promisify)(this.fs,"rmdir"),this.rm=(0,ne.promisify)(this.fs,"rm"),this.stat=(0,ne.promisify)(this.fs,"stat"),this.symlink=(0,ne.promisify)(this.fs,"symlink"),this.truncate=(0,ne.promisify)(this.fs,"truncate"),this.unlink=(0,ne.promisify)(this.fs,"unlink"),this.utimes=(0,ne.promisify)(this.fs,"utimes"),this.readFile=(i,n)=>(0,ne.promisify)(this.fs,"readFile")(i instanceof this.FileHandle?i.fd:i,n),this.appendFile=(i,n,s)=>(0,ne.promisify)(this.fs,"appendFile")(i instanceof this.FileHandle?i.fd:i,n,s),this.open=(i,n="r",s)=>(0,ne.promisify)(this.fs,"open",o=>new this.FileHandle(this.fs,o))(i,n,s),this.writeFile=(i,n,s)=>((0,ne.isReadableStream)(n)?(0,ne.streamToBuffer)(n):Promise.resolve(n)).then(f=>(0,ne.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 yp(this.fs,i,s)}}};l(_p,"FsPromises");var gp=_p;Al.FsPromises=gp});var S_=T(Pl=>{"use strict";Object.defineProperty(Pl,"__esModule",{value:!0});Pl.printTree=void 0;var fC=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+(f?" "+f:"")}return r},"printTree");Pl.printTree=fC});var v_=T(Nl=>{"use strict";Object.defineProperty(Nl,"__esModule",{value:!0});Nl.printBinary=void 0;var uC=l((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");Tc.printBinary=Ax});var Ug=T(Rc=>{"use strict";Object.defineProperty(Rc,"__esModule",{value:!0});Rc.printJson=void 0;var Px=l((t="",e,r=2)=>(JSON.stringify(e,null,r)||"nil").split(`
7
+ `+t+"\u2192 "+i(t+" ")),n},"printBinary");Nl.printBinary=uC});var E_=T(Dl=>{"use strict";Object.defineProperty(Dl,"__esModule",{value:!0});Dl.printJson=void 0;var hC=l((t="",e,r=2)=>(JSON.stringify(e,null,r)||"nil").split(`
8
8
  `).join(`
9
- `+t),"printJson");Rc.printJson=Px});var Hh=T(ya=>{"use strict";Object.defineProperty(ya,"__esModule",{value:!0});var zh=(Yo(),th(Xo));zh.__exportStar(Lg(),ya);zh.__exportStar(qg(),ya);zh.__exportStar(Ug(),ya)});var Wg=T(We=>{"use strict";Object.defineProperty(We,"__esModule",{value:!0});We.newNotAllowedError=We.newTypeMismatchError=We.newNotFoundError=We.assertCanWrite=We.assertName=We.basename=We.ctx=void 0;var Nx=l((t={})=>({separator:"/",syncHandleAllowed:!1,mode:"read",...t}),"ctx");We.ctx=Nx;var Dx=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");We.basename=Dx;var Cx=/^(\.{1,2})$|^(.*([\/\\]).*)$/,Ix=l((t,e,r)=>{if(!t||Cx.test(t))throw new TypeError(`Failed to execute '${e}' on '${r}': Name is not allowed.`)},"assertName");We.assertName=Ix;var $x=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");We.assertCanWrite=$x;var Bx=l(()=>new DOMException("A requested file or directory could not be found at the time an operation was processed.","NotFoundError"),"newNotFoundError");We.newNotFoundError=Bx;var Mx=l(()=>new DOMException("The path supplied exists, but was not an entry of requested type.","TypeMismatchError"),"newTypeMismatchError");We.newTypeMismatchError=Mx;var jx=l(()=>new DOMException("Permission not granted.","NotAllowedError"),"newNotAllowedError");We.newNotAllowedError=jx});var zg=T(ga=>{"use strict";Object.defineProperty(ga,"__esModule",{value:!0});ga.toTreeSync=void 0;var Lx=Hh(),qx=Wg(),Ux=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,a=" (...)";if(s>0){let o=t.readdirSync(i,{withFileTypes:!0});a=(0,Lx.printTree)(n,o.map(c=>u=>c.isDirectory()?(0,ga.toTreeSync)(t,{dir:i+c.name,depth:s-1,tab:u}):c.isSymbolicLink()?""+c.name+" \u2192 "+t.readlinkSync(i+c.name):""+c.name))}return(0,qx.basename)(i,r)+r+a},"toTreeSync");ga.toTreeSync=Ux});var Gg=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=Vg;j.optsGenerator=dr;j.optsAndCbGenerator=pi;var Oc=On(),Wx=ua(),Vh=Cr(),Hg={mode:511,recursive:!1},zx=l(t=>typeof t=="number"?Object.assign({},Hg,{mode:t}):Object.assign({},Hg,t),"getMkdirOptions");j.getMkdirOptions=zx;var Hx=l(t=>`Expected options to be either an object or a string, but got ${t} instead`,"ERRSTR_OPTS");function Vg(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(Hx(i))}}else return t;return r.encoding!=="buffer"&&(0,Wx.assertEncoding)(r.encoding),r}l(Vg,"getOptions");function dr(t){return e=>Vg(t,e)}l(dr,"optsGenerator");function pi(t){return(e,r)=>typeof e=="function"?[t(),e]:[t(e),(0,Vh.validateCallback)(r)]}l(pi,"optsAndCbGenerator");j.optsDefaults={encoding:"utf8"};j.getDefaultOpts=dr(j.optsDefaults);j.getDefaultOptsAndCb=pi(j.getDefaultOpts);var Vx={recursive:!1},Gx=l(t=>Object.assign({},Vx,t),"getRmdirOptions");j.getRmdirOptions=Gx;var Kx=dr(j.optsDefaults);j.getRmOptsAndCb=pi(Kx);var Jx={flag:"r"};j.getReadFileOptions=dr(Jx);var Xx={encoding:"utf8",recursive:!1,withFileTypes:!1};j.getReaddirOptions=dr(Xx);j.getReaddirOptsAndCb=pi(j.getReaddirOptions);var Yx={encoding:"utf8",bufferSize:32,recursive:!1};j.getOpendirOptions=dr(Yx);j.getOpendirOptsAndCb=pi(j.getOpendirOptions);var Zx={encoding:"utf8",mode:438,flag:Oc.FLAGS[Oc.FLAGS.a]};j.getAppendFileOpts=dr(Zx);j.getAppendFileOptsAndCb=pi(j.getAppendFileOpts);var Qx={bigint:!1},eA=l((t={})=>Object.assign({},Qx,t),"getStatOptions");j.getStatOptions=eA;var tA=l((t,e)=>typeof t=="function"?[(0,j.getStatOptions)(),t]:[(0,j.getStatOptions)(t),(0,Vh.validateCallback)(e)],"getStatOptsAndCb");j.getStatOptsAndCb=tA;var rA={bigint:!1},iA=l((t={})=>Object.assign({},rA,t),"getStatfsOptions");j.getStatfsOptions=iA;var nA=l((t,e)=>typeof t=="function"?[(0,j.getStatfsOptions)(),t]:[(0,j.getStatfsOptions)(t),(0,Vh.validateCallback)(e)],"getStatfsOptsAndCb");j.getStatfsOptsAndCb=nA;var sA=j.optsDefaults;j.getRealpathOptions=dr(sA);j.getRealpathOptsAndCb=pi(j.getRealpathOptions);j.writeFileDefaults={encoding:"utf8",mode:438,flag:Oc.FLAGS[Oc.FLAGS.w]};j.getWriteFileOptions=dr(j.writeFileDefaults)});var Jg=T(kc=>{"use strict";Object.defineProperty(kc,"__esModule",{value:!0});kc.Dir=void 0;var Kg=Cr(),aA=Vo(),mi=fa(),Kh=class Kh{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]()),aA.default.build(s,this.options.encoding)}while(!r);return null}close(e){if(e===void 0)return this.closed?Promise.reject(new mi.Error("ERR_DIR_CLOSED")):new Promise((r,i)=>{this.close(n=>{n?i(n):r()})});if((0,Kg.validateCallback)(e),this.closed){process.nextTick(e,new mi.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 mi.Error("ERR_DIR_CLOSED");if(this.operationQueue!==null)throw new mi.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,Kg.validateCallback)(e),this.closed){process.nextTick(e,new mi.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 mi.Error("ERR_DIR_CLOSED");if(this.operationQueue!==null)throw new mi.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(Kh,"Dir");var Gh=Kh;kc.Dir=Gh});var Jh=T(pr=>{"use strict";Object.defineProperty(pr,"__esModule",{value:!0});pr.toMatcher=pr.toRegex=void 0;var oA=l(t=>/[.^$+{}()|\\]/.test(t)?`\\${t}`:t,"escapeRe"),cA=l((t,e,r,i)=>{let n=e,s=[],a="",f=1;for(;n<t.length&&f>0;){let u=t[n];if(u==="(")f++,a+=u,n++;else if(u===")")if(f--,f===0){s.push(a),n++;break}else a+=u,n++;else u==="|"&&f===1?(s.push(a),a="",n++):(a+=u,n++)}if(f!==0)return;let o="",c=s.length;for(let u=0;u<c;u++)o+=(o?"|":"")+(0,pr.toRegex)(s[u],i).source.replace(/^\^/,"").replace(/\$$/,"");switch(r){case"?":return[`(?:${o})?`,n];case"*":return[`(?:${o})*`,n];case"+":return[`(?:${o})+`,n];case"@":return[`(?:${o})`,n];case"!":return[`(?!${o})[^/]*`,n]}},"parseExtGlob"),lA=l((t,e)=>{let r="",i=0,n=l(()=>{i++;let f=[],o="",c=!1;for(;i<t.length;){let h=t[i];if(h==="}"){f.push(o),i++,c=!0;break}if(h===","){f.push(o),o="",i++;continue}o+=h,i++}return c?`(?:${f.map(h=>(0,pr.toRegex)(h,e).source.replace(/^\^/,"").replace(/\$$/,"")).join("|")})`:"\\{"+oA(o)},"parseBraceGroup"),s=!!e?.extglob;for(;i<t.length;){let f=t[i];if(s&&t[i+1]==="("&&(f==="?"||f==="*"||f==="+"||f==="@"||f==="!")){let o=cA(t,i+2,f,e);if(o){r+=o[0],i=o[1];continue}}switch(f){case"*":{if(t[i+1]==="*"){let o=i+2;for(;t[o]==="*";)o++;t[o]==="/"?(r+="(?:.*/)?",i=o+1):(r+=".*",i=o)}else r+="[^/]*",i++;break}case"?":r+="[^/]",i++;break;case"[":{let o="[";for(i++,i<t.length&&t[i]==="!"&&(o+="^",i++),i<t.length&&t[i]==="]"&&(o+="]",i++);i<t.length&&t[i]!=="]";){let c=t[i];o+=c==="\\"?"\\\\":c,i++}if(i<t.length&&t[i]==="]")o+="]",i++;else{r+="\\[";continue}r+=o;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 a=e?.nocase?"i":"";return new RegExp("^"+r+"$",a)},"toRegex");pr.toRegex=lA;var fA=/^\/(.{1,4096})\/([gimsuy]{0,6})$/,uA=l((t,e)=>{let r=[],i=Array.isArray(t)?t:[t];for(let n of i)if(typeof n=="string"){let s=fA.exec(n);if(s){let[,a,f]=s;r.push(new RegExp(a,f))}else r.push((0,pr.toRegex)(n,e))}else r.push(n);return r.length?new Function("p","return "+r.map(n=>n+".test(p)").join("||")):()=>!1},"toMatcher");pr.toMatcher=uA});var Zg=T(Yh=>{"use strict";Object.defineProperty(Yh,"__esModule",{value:!0});Yh.globSync=yA;var wi=Sn(),hA=Jh(),Xg=Cr(),dA=wi.posix.join,pA=wi.posix.relative,mA=wi.posix.resolve;function Yg(t,e){return(0,hA.toRegex)(e).test(t)}l(Yg,"matchesPattern");function wA(t,e){return e?typeof e=="function"?e(t):(Array.isArray(e)?e:[e]).some(i=>Yg(t,i)):!1}l(wA,"isExcluded");function Xh(t,e,r,i,n=0){let s=[],a=i.maxdepth??1/0,f=i.cwd?(0,Xg.pathToFilename)(i.cwd):process.cwd();if(n>a)return s;try{let o=t.readdirSync(e,{withFileTypes:!0});for(let c of o){let u=dA(e,c.name.toString()),h=pA(f,u);if(wA(h,i.exclude))continue;if(r.some(p=>Yg(h,p))&&s.push(h),c.isDirectory()&&n<a){let p=Xh(t,u,r,i,n+1);s.push(...p)}}}catch{}return s}l(Xh,"walkDirectory");function yA(t,e,r={}){let i=r.cwd?(0,Xg.pathToFilename)(r.cwd):process.cwd(),n=mA(i),s={cwd:n,exclude:r.exclude,maxdepth:r.maxdepth,withFileTypes:r.withFileTypes||!1},a=[];if(wi.posix.isAbsolute(e)){let f=wi.posix.dirname(e),o=wi.posix.basename(e),c=Xh(t,f,[o],{...s,cwd:f});a.push(...c.map(u=>wi.posix.resolve(f,u)))}else{let f=Xh(t,n,[e],s);a.push(...f)}return a=[...new Set(a)].sort(),a}l(yA,"globSync")});var s0=T(ct=>{"use strict";Object.defineProperty(ct,"__esModule",{value:!0});ct.FSWatcher=ct.StatWatcher=ct.Volume=void 0;ct.pathToSteps=CA;ct.dataToStr=IA;ct.toUnixTimestamp=ot;var ve=Sn(),td=Dg(),Zh=oh(),gA=Vo(),bA=Cg(),Dn=Pr(),Dc=Ph(),_A=Ig(),Cc=Bg(),vA=Ct(),r0=Bh(),yi=ua(),EA=Mg(),i0=lh(),SA=jg(),FA=zg(),Ac=On(),TA=fa(),Y=Gg(),A=Cr(),RA=Jg(),$e=pc(),OA=ve.resolve,{O_SYMLINK:Qg,F_OK:Qh,R_OK:kA,W_OK:xA,X_OK:AA,COPYFILE_EXCL:PA,COPYFILE_FICLONE_FORCE:NA}=vA.constants,S6=ve.posix?ve.posix.sep:ve.sep,xc=ve.posix?ve.posix.relative:ve.relative,ed=ve.posix?ve.posix.join:ve.join,e0=ve.posix?ve.posix.dirname:ve.dirname,t0=ve.posix?ve.posix.normalize:ve.normalize,DA=128;function CA(t){return(0,$e.filenameToSteps)((0,A.pathToFilename)(t))}l(CA,"pathToSteps");function IA(t,e=yi.ENCODING_UTF8){return Dn.Buffer.isBuffer(t)?t.toString(e):t instanceof Uint8Array?(0,Dn.bufferFrom)(t).toString(e):String(t)}l(IA,"dataToStr");function ot(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(ot,"toUnixTimestamp");function Pn(t){if(typeof t!="number")throw TypeError(Ac.ERRSTR.UID)}l(Pn,"validateUid");function Nn(t){if(typeof t!="number")throw TypeError(Ac.ERRSTR.GID)}l(Nn,"validateGid");var rd=class rd{get promises(){if(this.promisesApi===null)throw new Error("Promise is not supported in this environment.");return this.promisesApi}constructor(e=new td.Superblock){this._core=e,this.promisesApi=new SA.FsPromises(this,EA.FileHandle),this.openSync=(o,c,u=438)=>{let h=(0,A.modeToNumber)(u),d=(0,A.pathToFilename)(o),p=(0,A.flagsToNumber)(c);return this._core.open(d,p,h,!(p&Qg))},this.open=(o,c,u,h)=>{let d=u,p=h;typeof u=="function"&&(d=438,p=u),d=d||438;let m=(0,A.modeToNumber)(d),w=(0,A.pathToFilename)(o),y=(0,A.flagsToNumber)(c);this.wrapAsync(this._core.open,[w,y,m,!(y&Qg)],p)},this.closeSync=o=>{this._core.close(o)},this.close=(o,c)=>{(0,$e.validateFd)(o);let u=this._core.getFileByFdOrThrow(o,"close");this.wrapAsync(this._core.close,[u.fd],c)},this.readSync=(o,c,u,h,d)=>((0,$e.validateFd)(o),this._core.read(o,c,u,h,d)),this.read=(o,c,u,h,d,p)=>{if((0,A.validateCallback)(p),h===0)return(0,Dc.default)(()=>{p&&p(null,0,c)});Promise.resolve().then(()=>{try{let m=this._core.read(o,c,u,h,d);p(null,m,c)}catch(m){p(m)}})},this.readv=(o,c,u,h)=>{let d=u,p=h;typeof u=="function"&&([d,p]=[null,u]),(0,A.validateCallback)(p),Promise.resolve().then(()=>{try{let m=this._core.readv(o,c,d);p(null,m,c)}catch(m){p(m)}})},this.readvSync=(o,c,u)=>((0,$e.validateFd)(o),this._core.readv(o,c,u??null)),this._readfile=(o,c,u)=>{let h,p=typeof o=="number"&&(0,$e.isFd)(o),m;if(p)m=o;else{let w=(0,A.pathToFilename)(o),y=String(o),g=y.length>1&&y.endsWith("/"),_=this._core.getResolvedLinkOrThrow(w,"open"),F=_.getNode();if(F.isDirectory())throw(0,A.createError)("EISDIR","open",_.getPath());if(g&&F.isFile())throw(0,A.createError)("ENOTDIR","open",y);m=this.openSync(o,c)}try{h=(0,A.bufferToEncoding)(this._core.getFileByFdOrThrow(m).getBuffer(),u)}finally{p||this.closeSync(m)}return h},this.readFileSync=(o,c)=>{let u=(0,Y.getReadFileOptions)(c),h=(0,A.flagsToNumber)(u.flag);return this._readfile(o,h,u.encoding)},this.readFile=(o,c,u)=>{let[h,d]=(0,Y.optsAndCbGenerator)(Y.getReadFileOptions)(c,u),p=(0,A.flagsToNumber)(h.flag);this.wrapAsync(this._readfile,[o,p,h.encoding],d)},this.writeSync=(o,c,u,h,d)=>{let[,p,m,w,y]=(0,A.getWriteSyncArgs)(o,c,u,h,d);return this._write(o,p,m,w,y)},this.write=(o,c,u,h,d,p)=>{let[,m,w,y,g,_,F]=(0,A.getWriteArgs)(o,c,u,h,d,p);Promise.resolve().then(()=>{try{let R=this._write(o,w,y,g,_);m?F(null,R,c):F(null,R,w)}catch(R){F(R)}})},this.writev=(o,c,u,h)=>{let d=u,p=h;typeof u=="function"&&([d,p]=[null,u]),(0,A.validateCallback)(p),Promise.resolve().then(()=>{try{let m=this.writevBase(o,c,d);p(null,m,c)}catch(m){p(m)}})},this.writevSync=(o,c,u)=>((0,$e.validateFd)(o),this.writevBase(o,c,u??null)),this.writeFileSync=(o,c,u)=>{let h=(0,Y.getWriteFileOptions)(u),d=(0,A.flagsToNumber)(h.flag),p=(0,A.modeToNumber)(h.mode),m=(0,$e.dataToBuffer)(c,h.encoding);this._core.writeFile(o,m,d,p)},this.writeFile=(o,c,u,h)=>{let d=u,p=h;typeof u=="function"&&([d,p]=[Y.writeFileDefaults,u]);let m=(0,A.validateCallback)(p),w=(0,Y.getWriteFileOptions)(d),y=(0,A.flagsToNumber)(w.flag),g=(0,A.modeToNumber)(w.mode),_=(0,$e.dataToBuffer)(c,w.encoding);this.wrapAsync(this._core.writeFile,[o,_,y,g],m)},this.copyFileSync=(o,c,u)=>{let h=(0,A.pathToFilename)(o),d=(0,A.pathToFilename)(c);return this._copyFile(h,d,(u||0)|0)},this.copyFile=(o,c,u,h)=>{let d=(0,A.pathToFilename)(o),p=(0,A.pathToFilename)(c),m,w;typeof u=="function"?[m,w]=[0,u]:[m,w]=[u,h],(0,A.validateCallback)(w),this.wrapAsync(this._copyFile,[d,p,m],w)},this._cp=(o,c,u)=>{if(u.filter&&!u.filter(o,c))return;let h=u.dereference?this.statSync(o):this.lstatSync(o),d=null;try{d=this.lstatSync(c)}catch(p){if(p.code!=="ENOENT")throw p}if(d&&h.ino===d.ino&&h.dev===d.dev)throw(0,A.createError)("EINVAL","cp",o,c);if(d){if(h.isDirectory()&&!d.isDirectory())throw(0,A.createError)("EISDIR","cp",o,c);if(!h.isDirectory()&&d.isDirectory())throw(0,A.createError)("ENOTDIR","cp",o,c)}if(h.isDirectory()&&this.isSrcSubdir(o,c))throw(0,A.createError)("EINVAL","cp",o,c);{let p=e0(c);this.existsSync(p)||this.mkdirSync(p,{recursive:!0})}if(h.isDirectory()){if(!u.recursive)throw(0,A.createError)("EISDIR","cp",o);this.cpDirSync(h,d,o,c,u)}else if(h.isFile()||h.isCharacterDevice()||h.isBlockDevice())this.cpFileSync(h,d,o,c,u);else if(h.isSymbolicLink()&&!u.dereference)this.cpSymlinkSync(d,o,c,u);else throw(0,A.createError)("EINVAL","cp",o)},this.linkSync=(o,c)=>{let u=(0,A.pathToFilename)(o),h=(0,A.pathToFilename)(c);this._core.link(u,h)},this.link=(o,c,u)=>{let h=(0,A.pathToFilename)(o),d=(0,A.pathToFilename)(c);this.wrapAsync(this._core.link,[h,d],u)},this.unlinkSync=o=>{let c=(0,A.pathToFilename)(o);this._core.unlink(c)},this.unlink=(o,c)=>{let u=(0,A.pathToFilename)(o);this.wrapAsync(this._core.unlink,[u],c)},this.symlinkSync=(o,c,u)=>{let h=(0,A.pathToFilename)(o),d=(0,A.pathToFilename)(c);this._core.symlink(h,d)},this.symlink=(o,c,u,h)=>{let d=(0,A.validateCallback)(typeof u=="function"?u:h),p=(0,A.pathToFilename)(o),m=(0,A.pathToFilename)(c);this.wrapAsync(this._core.symlink,[p,m],d)},this._lstat=(o,c=!1,u=!1)=>{let h;try{h=this._core.getLinkOrThrow(o,"lstat")}catch(d){if(d.code==="ENOENT"&&!u)return;throw d}return Zh.default.build(h.getNode(),c)},this.lstatSync=(o,c)=>{let{throwIfNoEntry:u=!0,bigint:h=!1}=(0,Y.getStatOptions)(c);return this._lstat((0,A.pathToFilename)(o),h,u)},this.renameSync=(o,c)=>{let u=(0,A.pathToFilename)(o),h=(0,A.pathToFilename)(c);this._core.rename(u,h)},this.rename=(o,c,u)=>{let h=(0,A.pathToFilename)(o),d=(0,A.pathToFilename)(c);this.wrapAsync(this._core.rename,[h,d],u)},this.existsSync=o=>{try{return this._exists((0,A.pathToFilename)(o))}catch{return!1}},this.exists=(o,c)=>{let u=(0,A.pathToFilename)(o);if(typeof c!="function")throw Error(Ac.ERRSTR.CB);Promise.resolve().then(()=>{try{c(this._exists(u))}catch{c(!1)}})},this.accessSync=(o,c=Qh)=>{let u=(0,A.pathToFilename)(o);c=c|0,this._access(u,c)},this.access=(o,c,u)=>{let h=Qh,d;typeof c!="function"?[h,d]=[c|0,(0,A.validateCallback)(u)]:d=c;let p=(0,A.pathToFilename)(o);this.wrapAsync(this._access,[p,h],d)},this.appendFileSync=(o,c,u)=>{let h=(0,Y.getAppendFileOpts)(u);(!h.flag||(0,$e.isFd)(o))&&(h.flag="a"),this.writeFileSync(o,c,h)},this.appendFile=(o,c,u,h)=>{let[d,p]=(0,Y.getAppendFileOptsAndCb)(u,h);(!d.flag||(0,$e.isFd)(o))&&(d.flag="a"),this.writeFile(o,c,d,p)},this._readdir=(o,c)=>{let u=(0,$e.filenameToSteps)(o),h=this._core.getResolvedLinkOrThrow(o,"scandir"),d=h.getNode();if(!d.isDirectory())throw(0,A.createError)("ENOTDIR","scandir",o);if(!d.canRead())throw(0,A.createError)("EACCES","scandir",o);let p=[];for(let w of h.children.keys()){let y=h.getChild(w);if(!(!y||w==="."||w==="..")&&(p.push(gA.default.build(y,c.encoding)),c.recursive&&y.children.size)){let g={...c,recursive:!0,withFileTypes:!0},_=this._readdir(y.getPath(),g);p.push(..._)}}if(!$e.isWin&&c.encoding!=="buffer"&&p.sort((w,y)=>w.name<y.name?-1:w.name>y.name?1:0),c.withFileTypes)return p;let m=o;return $e.isWin&&(m=m.replace(/\\/g,"/")),p.map(w=>{if(c.recursive){let y=ed(w.parentPath,w.name.toString());return $e.isWin&&(y=y.replace(/\\/g,"/")),y.replace(m+ve.posix.sep,"")}return w.name})},this.readdirSync=(o,c)=>{let u=(0,Y.getReaddirOptions)(c),h=(0,A.pathToFilename)(o);return this._readdir(h,u)},this.readdir=(o,c,u)=>{let[h,d]=(0,Y.getReaddirOptsAndCb)(c,u),p=(0,A.pathToFilename)(o);this.wrapAsync(this._readdir,[p,h],d)},this._readlink=(o,c)=>{let h=this._core.getLinkOrThrow(o,"readlink").getNode();if(!h.isSymlink())throw(0,A.createError)("EINVAL","readlink",o);return(0,yi.strToEncoding)(h.symlink,c)},this.readlinkSync=(o,c)=>{let u=(0,Y.getDefaultOpts)(c),h=(0,A.pathToFilename)(o);return this._readlink(h,u.encoding)},this.readlink=(o,c,u)=>{let[h,d]=(0,Y.getDefaultOptsAndCb)(c,u),p=(0,A.pathToFilename)(o);this.wrapAsync(this._readlink,[p,h.encoding],d)},this._fsync=o=>{this._core.getFileByFdOrThrow(o,"fsync")},this.fsyncSync=o=>{this._fsync(o)},this.fsync=(o,c)=>{this.wrapAsync(this._fsync,[o],c)},this._fdatasync=o=>{this._core.getFileByFdOrThrow(o,"fdatasync")},this.fdatasyncSync=o=>{this._fdatasync(o)},this.fdatasync=(o,c)=>{this.wrapAsync(this._fdatasync,[o],c)},this._ftruncate=(o,c)=>{this._core.getFileByFdOrThrow(o,"ftruncate").truncate(c)},this.ftruncateSync=(o,c)=>{this._ftruncate(o,c)},this.ftruncate=(o,c,u)=>{let h=typeof c=="number"?c:0,d=(0,A.validateCallback)(typeof c=="number"?u:c);this.wrapAsync(this._ftruncate,[o,h],d)},this._truncate=(o,c)=>{let u=this.openSync(o,"r+");try{this.ftruncateSync(u,c)}finally{this.closeSync(u)}},this.truncateSync=(o,c)=>{if((0,$e.isFd)(o))return this.ftruncateSync(o,c);this._truncate(o,c)},this.truncate=(o,c,u)=>{let h=typeof c=="number"?c:0,d=(0,A.validateCallback)(typeof c=="number"?u:c);if((0,$e.isFd)(o))return this.ftruncate(o,h,d);this.wrapAsync(this._truncate,[o,h],d)},this._futimes=(o,c,u)=>{let d=this._core.getFileByFdOrThrow(o,"futimes").node;d.atime=new Date(c*1e3),d.mtime=new Date(u*1e3)},this.futimesSync=(o,c,u)=>{this._futimes(o,ot(c),ot(u))},this.futimes=(o,c,u,h)=>{this.wrapAsync(this._futimes,[o,ot(c),ot(u)],h)},this._utimes=(o,c,u,h=!0)=>{let d=this._core,m=(h?d.getResolvedLinkOrThrow(o,"utimes"):d.getLinkOrThrow(o,"lutimes")).getNode();m.atime=new Date(c*1e3),m.mtime=new Date(u*1e3)},this.utimesSync=(o,c,u)=>{this._utimes((0,A.pathToFilename)(o),ot(c),ot(u),!0)},this.utimes=(o,c,u,h)=>{this.wrapAsync(this._utimes,[(0,A.pathToFilename)(o),ot(c),ot(u),!0],h)},this.lutimesSync=(o,c,u)=>{this._utimes((0,A.pathToFilename)(o),ot(c),ot(u),!1)},this.lutimes=(o,c,u,h)=>{this.wrapAsync(this._utimes,[(0,A.pathToFilename)(o),ot(c),ot(u),!1],h)},this.mkdirSync=(o,c)=>{let u=(0,Y.getMkdirOptions)(c),h=(0,A.modeToNumber)(u.mode,511),d=(0,A.pathToFilename)(o);if(u.recursive)return this._core.mkdirp(d,h);this._core.mkdir(d,h)},this.mkdir=(o,c,u)=>{let h=(0,Y.getMkdirOptions)(c),d=(0,A.validateCallback)(typeof c=="function"?c:u),p=(0,A.modeToNumber)(h.mode,511),m=(0,A.pathToFilename)(o);h.recursive?this.wrapAsync(this._core.mkdirp,[m,p],d):this.wrapAsync(this._core.mkdir,[m,p],d)},this._mkdtemp=(o,c,u=5)=>{let h=o+(0,A.genRndStr6)();try{return this._core.mkdir(h,511),(0,yi.strToEncoding)(h,c)}catch(d){if(d.code==="EEXIST"){if(u>1)return this._mkdtemp(o,c,u-1);throw Error("Could not create temp dir.")}else throw d}},this.mkdtempSync=(o,c)=>{let{encoding:u}=(0,Y.getDefaultOpts)(c);if(!o||typeof o!="string")throw new TypeError("filename prefix is required");return(0,A.nullCheck)(o),this._mkdtemp(o,u)},this.mkdtemp=(o,c,u)=>{let[{encoding:h},d]=(0,Y.getDefaultOptsAndCb)(c,u);if(!o||typeof o!="string")throw new TypeError("filename prefix is required");(0,A.nullCheck)(o)&&this.wrapAsync(this._mkdtemp,[o,h],d)},this.rmdirSync=(o,c)=>{let u=(0,Y.getRmdirOptions)(c);this._core.rmdir((0,A.pathToFilename)(o),u.recursive)},this.rmdir=(o,c,u)=>{let h=(0,Y.getRmdirOptions)(c),d=(0,A.validateCallback)(typeof c=="function"?c:u);this.wrapAsync(this._core.rmdir,[(0,A.pathToFilename)(o),h.recursive],d)},this.rmSync=(o,c)=>{this._core.rm((0,A.pathToFilename)(o),c?.force,c?.recursive)},this.rm=(o,c,u)=>{let[h,d]=(0,Y.getRmOptsAndCb)(c,u);this.wrapAsync(this._core.rm,[(0,A.pathToFilename)(o),h?.force,h?.recursive],d)},this._fchmod=(o,c)=>{this._core.getFileByFdOrThrow(o,"fchmod").chmod(c)},this.fchmodSync=(o,c)=>{this._fchmod(o,(0,A.modeToNumber)(c))},this.fchmod=(o,c,u)=>{this.wrapAsync(this._fchmod,[o,(0,A.modeToNumber)(c)],u)},this._chmod=(o,c,u=!0)=>{(u?this._core.getResolvedLinkOrThrow(o,"chmod"):this._core.getLinkOrThrow(o,"chmod")).getNode().chmod(c)},this.chmodSync=(o,c)=>{let u=(0,A.modeToNumber)(c),h=(0,A.pathToFilename)(o);this._chmod(h,u,!0)},this.chmod=(o,c,u)=>{let h=(0,A.modeToNumber)(c),d=(0,A.pathToFilename)(o);this.wrapAsync(this._chmod,[d,h],u)},this._lchmod=(o,c)=>{this._chmod(o,c,!1)},this.lchmodSync=(o,c)=>{let u=(0,A.modeToNumber)(c),h=(0,A.pathToFilename)(o);this._lchmod(h,u)},this.lchmod=(o,c,u)=>{let h=(0,A.modeToNumber)(c),d=(0,A.pathToFilename)(o);this.wrapAsync(this._lchmod,[d,h],u)},this._fchown=(o,c,u)=>{this._core.getFileByFdOrThrow(o,"fchown").chown(c,u)},this.fchownSync=(o,c,u)=>{Pn(c),Nn(u),this._fchown(o,c,u)},this.fchown=(o,c,u,h)=>{Pn(c),Nn(u),this.wrapAsync(this._fchown,[o,c,u],h)},this._chown=(o,c,u)=>{this._core.getResolvedLinkOrThrow(o,"chown").getNode().chown(c,u)},this.chownSync=(o,c,u)=>{Pn(c),Nn(u),this._chown((0,A.pathToFilename)(o),c,u)},this.chown=(o,c,u,h)=>{Pn(c),Nn(u),this.wrapAsync(this._chown,[(0,A.pathToFilename)(o),c,u],h)},this._lchown=(o,c,u)=>{this._core.getLinkOrThrow(o,"lchown").getNode().chown(c,u)},this.lchownSync=(o,c,u)=>{Pn(c),Nn(u),this._lchown((0,A.pathToFilename)(o),c,u)},this.lchown=(o,c,u,h)=>{Pn(c),Nn(u),this.wrapAsync(this._lchown,[(0,A.pathToFilename)(o),c,u],h)},this.statWatchers={},this.cpSync=(o,c,u)=>{let h=(0,A.pathToFilename)(o),d=(0,A.pathToFilename)(c),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=(o,c,u,h)=>{let d=(0,A.pathToFilename)(o),p=(0,A.pathToFilename)(c),m,w;typeof u=="function"?[m,w]=[{},u]:[m,w]=[u||{},h],(0,A.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(o,c)=>{let u=(0,A.pathToFilename)(o),h;try{h=this._core.getResolvedLinkOrThrow(u,"open")}catch(w){throw w&&typeof w=="object"&&w.code==="ENOENT"?new TA.TypeError("ERR_INVALID_ARG_VALUE"):w}let p=h.getNode().getBuffer(),m=c?.type||"";return new Blob([p],{type:m})},this.glob=(o,...c)=>{let[u,h]=c.length===1?[{},c[0]]:[c[0],c[1]];this.wrapAsync(this._globSync,[o,u||{}],h)},this.globSync=(o,c={})=>this._globSync(o,c),this._globSync=(o,c={})=>{let{globSync:u}=Zg();return u(this,o,c)},this._opendir=(o,c)=>{let u=this._core.getResolvedLinkOrThrow(o,"scandir");if(!u.getNode().isDirectory())throw(0,A.createError)("ENOTDIR","scandir",o);return new RA.Dir(u,c)},this.opendirSync=(o,c)=>{let u=(0,Y.getOpendirOptions)(c),h=(0,A.pathToFilename)(o);return this._opendir(h,u)},this.opendir=(o,c,u)=>{let[h,d]=(0,Y.getOpendirOptsAndCb)(c,u),p=(0,A.pathToFilename)(o);this.wrapAsync(this._opendir,[p,h],d)};let r=this;this.StatWatcher=class extends Pc{constructor(){super(r)}};let i=Xt;this.ReadStream=class extends i{constructor(...o){super(r,...o)}};let n=Et;this.WriteStream=class extends n{constructor(...o){super(r,...o)}},this.FSWatcher=class extends Nc{constructor(){super(r)}};let s=l((o,c)=>{let u=this._core.getResolvedLinkOrThrow(o,"realpath");return(0,yi.strToEncoding)(u.getPath()||"/",c)},"_realpath"),a=l((o,c,u)=>{let[h,d]=(0,Y.getRealpathOptsAndCb)(c,u),p=(0,A.pathToFilename)(o);r.wrapAsync(s,[p,h.encoding],d)},"realpathImpl"),f=l((o,c)=>s((0,A.pathToFilename)(o),(0,Y.getRealpathOptions)(c).encoding),"realpathSyncImpl");this.realpath=a,this.realpath.native=a,this.realpathSync=f,this.realpathSync.native=f}wrapAsync(e,r,i){(0,A.validateCallback)(i),Promise.resolve().then(()=>{let n;try{n=e.apply(this,r)}catch(s){i(s);return}i(null,n)})}toTree(e={separator:ve.sep}){return(0,FA.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,A.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 f of r){let o=Dn.Buffer.from(f.buffer,f.byteOffset,f.byteLength),c=n.write(o,0,o.byteLength,s);if(s=void 0,a+=c,c<o.byteLength)break}return a}_copyFile(e,r,i){let n=this.readFileSync(e);if(i&PA&&this.existsSync(r))throw(0,A.createError)("EEXIST","copyFile",e,r);if(i&NA)throw(0,A.createError)("ENOSYS","copyFile",e,r);this._core.writeFile(r,n,Ac.FLAGS.w,438)}isSrcSubdir(e,r){try{let i=t0(e.startsWith("/")?e:"/"+e),n=t0(r.startsWith("/")?r:"/"+r);if(i===n)return!0;let s=xc(i,n);return s===""||!s.startsWith("..")&&!(0,ve.isAbsolute)(s)}catch{return!1}}cpFileSync(e,r,i,n,s){if(r){if(s.errorOnExist)throw(0,A.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 f of a){let o=ed(i,String(f)),c=ed(n,String(f));s.filter&&!s.filter(o,c)||this._cp(o,c,s)}this.chmodSync(n,Number(e.mode))}cpSymlinkSync(e,r,i,n){let s=String(this.readlinkSync(r));!n.verbatimSymlinks&&!(0,ve.isAbsolute)(s)&&(s=OA(e0(r),s)),e&&this.unlinkSync(i),this.symlinkSync(s,i)}lstat(e,r,i){let[{throwIfNoEntry:n=!0,bigint:s=!1},a]=(0,Y.getStatOptsAndCb)(r,i);this.wrapAsync(this._lstat,[(0,A.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 Zh.default.build(n.getNode(),r)}statSync(e,r){let{bigint:i=!0,throwIfNoEntry:n=!0}=(0,Y.getStatOptions)(r);return this._stat((0,A.pathToFilename)(e),i,n)}stat(e,r,i){let[{bigint:n=!1,throwIfNoEntry:s=!0},a]=(0,Y.getStatOptsAndCb)(r,i);this.wrapAsync(this._stat,[(0,A.pathToFilename)(e),n,s],a)}fstatBase(e,r=!1){let i=this._core.getFileByFd(e);if(!i)throw(0,A.createError)("EBADF","fstat");return Zh.default.build(i.node,r)}fstatSync(e,r){return this.fstatBase(e,(0,Y.getStatOptions)(r).bigint)}fstat(e,r,i){let[n,s]=(0,Y.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!==Qh&&(r&kA&&!n.canRead()||r&xA&&!n.canWrite()||r&AA&&!n.canExecute()))throw(0,A.createError)("EACCES","access",e)}watchFile(e,r,i){let n=(0,A.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 f=5007,o=!0;s&&typeof s=="object"&&(typeof s.interval=="number"&&(f=s.interval),typeof s.persistent=="boolean"&&(o=s.persistent));let c=this.statWatchers[n];return c||(c=new this.StatWatcher,c.start(n,o,f),this.statWatchers[n]=c),c.addListener("change",a),c}unwatchFile(e,r){let i=(0,A.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,A.pathToFilename)(e),s=r;typeof r=="function"&&(i=r,s=null);let{persistent:a,recursive:f,encoding:o}=(0,Y.getDefaultOpts)(s);a===void 0&&(a=!0),f===void 0&&(f=!1);let c=new this.FSWatcher;return c.start(n,a,f,o),i&&c.addListener("change",i),c}_statfs(e,r=!1){return this._core.getResolvedLinkOrThrow(e,"statfs"),bA.default.build(this._core,r)}statfsSync(e,r){let{bigint:i=!1}=(0,Y.getStatfsOptions)(r);return this._statfs((0,A.pathToFilename)(e),i)}statfs(e,r,i){let[{bigint:n=!1},s]=(0,Y.getStatfsOptsAndCb)(r,i);this.wrapAsync(this._statfs,[(0,A.pathToFilename)(e),n],s)}};l(rd,"Volume");var gi=rd;ct.Volume=gi;gi.fromJSON=(t,e)=>new gi(td.Superblock.fromJSON(t,e));gi.fromNestedJSON=(t,e)=>new gi(td.Superblock.fromNestedJSON(t,e));function $A(t){t.emit("stop")}l($A,"emitStop");var id=class id extends r0.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,A.pathToFilename)(e),this.setTimeout=r?setTimeout.bind(globalThis):_A.default,this.interval=i,this.prev=this.vol.statSync(this.filename),this.loop()}stop(){clearTimeout(this.timeoutRef),(0,Dc.default)(()=>{$A.call(this,this)})}};l(id,"StatWatcher");var Pc=id;ct.StatWatcher=Pc;var vt;function BA(t){vt=(0,Dn.bufferAllocUnsafe)(t),vt.used=0}l(BA,"allocNewPool");(0,i0.inherits)(Xt,Cc.Readable);ct.ReadStream=Xt;function Xt(t,e,r){if(!(this instanceof Xt))return new Xt(t,e,r);if(this._vol=t,r=Object.assign({},(0,Y.getOptions)(r,{})),r.highWaterMark===void 0&&(r.highWaterMark=64*1024),Cc.Readable.call(this,r),this.path=(0,A.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(Xt,"FsReadStream");Xt.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()})};Xt.prototype._read=function(t){if(typeof this.fd!="number")return this.once("open",function(){this._read(t)});if(this.destroyed)return;(!vt||vt.length-vt.used<DA)&&BA(this._readableState.highWaterMark);var e=vt,r=Math.min(vt.length-vt.used,t),i=vt.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,vt,vt.used,r,this.pos,s),this.pos!==void 0&&(this.pos+=r),vt.used+=r;function s(a,f){if(a)n.autoClose&&n.destroy&&n.destroy(),n.emit("error",a);else{var o=null;f>0&&(n.bytesRead+=f,o=e.slice(i,i+f)),n.push(o)}}l(s,"onread")};Xt.prototype._destroy=function(t,e){this.close(r=>{e(t||r)})};Xt.prototype.close=function(t){if(t&&this.once("close",t),this.closed||typeof this.fd!="number"){if(typeof this.fd!="number"){this.once("open",n0);return}return(0,Dc.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 n0(t){this.close()}l(n0,"closeOnOpen");(0,i0.inherits)(Et,Cc.Writable);ct.WriteStream=Et;function Et(t,e,r){if(!(this instanceof Et))return new Et(t,e,r);if(this._vol=t,r=Object.assign({},(0,Y.getOptions)(r,{})),Cc.Writable.call(this,r),this.path=(0,A.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(Et,"FsWriteStream");Et.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))};Et.prototype._write=function(t,e,r){if(!(t instanceof Dn.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)};Et.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 f=t[a].chunk;n[a]=f,s+=f.length}let o=Dn.Buffer.concat(n);this._vol.write(this.fd,o,0,o.length,this.pos,(c,u)=>{if(c)return r.destroy&&r.destroy(),e(c);r.bytesWritten+=u,e()}),this.pos!==void 0&&(this.pos+=s)};Et.prototype.close=function(t){if(t&&this.once("close",t),this.closed||typeof this.fd!="number"){if(typeof this.fd!="number"){this.once("open",n0);return}return(0,Dc.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};Et.prototype._destroy=Xt.prototype._destroy;Et.prototype.destroySoon=Et.prototype.end;var nd=class nd extends r0.EventEmitter{constructor(e){super(),this._filename="",this._filenameEncoded="",this._recursive=!1,this._encoding=yi.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=yi.ENCODING_UTF8){this._filename=(0,A.pathToFilename)(e),this._steps=(0,$e.filenameToSteps)(this._filename),this._filenameEncoded=(0,yi.strToEncoding)(this._filename),this._recursive=i,this._encoding=n;try{this._link=this._vol._core.getLinkOrThrow(this._filename,"FSWatcher")}catch(o){let c=new Error(`watch ${this._filename} ${o.code}`);throw c.code=o.code,c.errno=o.code,c}let s=l(o=>{let c=o.getPath(),u=o.getNode(),h=l(()=>{let m=xc(this._filename,c);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"),a=l(o=>{let c=o.getNode(),u=l(m=>{this.emit("change","rename",xc(this._filename,m.getPath())),s(m),a(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,R]of y.children.entries())R&&F!=="."&&F!==".."&&w(R)},"removeLinkNodeListeners");w(m),this.emit("change","rename",xc(this._filename,m.getPath()))},"onLinkChildDelete");for(let[m,w]of o.children.entries())w&&m!=="."&&m!==".."&&s(w);let d=o.changes.listen(([m,w])=>{m==="child:add"?u(w):m==="child:del"&&h(w)});if((this._listenerRemovers.get(c.ino)??[]).push(()=>{d()}),i)for(let[m,w]of o.children.entries())w&&m!=="."&&m!==".."&&a(w)},"watchLinkChildrenChanged");s(this._link),a(this._link);let f=this._link.parent;f&&f.changes.listen(([o,c])=>{o==="child:del"&&this._onParentChild(c)}),r&&this._persist()}close(){clearTimeout(this._timer),this._listenerRemovers.forEach(e=>{e.forEach(r=>r())}),this._listenerRemovers.clear(),this._parentChangesUnsub?.()}};l(nd,"FSWatcher");var Nc=nd;ct.FSWatcher=Nc});var a0=T(Ic=>{"use strict";Object.defineProperty(Ic,"__esModule",{value:!0});Ic.fsSynchronousApiList=void 0;Ic.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 o0=T($c=>{"use strict";Object.defineProperty($c,"__esModule",{value:!0});$c.fsCallbackApiList=void 0;$c.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 Cn=T((lt,Bc)=>{"use strict";Object.defineProperty(lt,"__esModule",{value:!0});lt.memfs=lt.fs=lt.vol=lt.Volume=void 0;lt.createFsFromVolume=sd;var MA=oh(),jA=Vo(),Mc=s0();Object.defineProperty(lt,"Volume",{enumerable:!0,get:l(function(){return Mc.Volume},"get")});var c0=Ct(),LA=a0(),qA=o0(),{F_OK:UA,R_OK:WA,W_OK:zA,X_OK:HA}=c0.constants;lt.vol=new Mc.Volume;function sd(t){let e={F_OK:UA,R_OK:WA,W_OK:zA,X_OK:HA,constants:c0.constants,Stats:MA.default,Dirent:jA.default};for(let r of LA.fsSynchronousApiList)typeof t[r]=="function"&&(e[r]=t[r].bind(t));for(let r of qA.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=Mc.toUnixTimestamp,e.__vol=t,e}l(sd,"createFsFromVolume");lt.fs=sd(lt.vol);var VA=l((t={},e="/")=>{let r=Mc.Volume.fromNestedJSON(t,e);return{fs:sd(r),vol:r}},"memfs");lt.memfs=VA;Bc.exports={...Bc.exports,...lt.fs};Bc.exports.semantic=!0});var md=T((D6,qc)=>{function u0(t){return Array.isArray(t)?t:[t]}l(u0,"makeArray");var GA=void 0,od="",l0=" ",ad="\\",KA=/^\s+$/,JA=/(?:[^\\]|^)\\$/,XA=/^\\!/,YA=/^\\#/,ZA=/\r?\n/g,QA=/^\.{0,2}\/|^\.{1,2}$/,eP=/\/$/,In="/",h0="node-ignore";typeof Symbol<"u"&&(h0=Symbol.for("node-ignore"));var d0=h0,$n=l((t,e,r)=>(Object.defineProperty(t,e,{value:r}),r),"define"),tP=/([0-z])-([0-z])/g,p0=l(()=>!1,"RETURN_FALSE"),rP=l(t=>t.replace(tP,(e,r,i)=>r.charCodeAt(0)<=i.charCodeAt(0)?e:od),"sanitizeRange"),iP=l(t=>{let{length:e}=t;return t.slice(0,e-e%2)},"cleanRangeBackSlash"),nP=[[/^\uFEFF/,()=>od],[/((?:\\\\)*?)(\\?\s+)$/,(t,e,r)=>e+(r.indexOf("\\")===0?l0:od)],[/(\\+?)\s/g,(t,e)=>{let{length:r}=e;return e.slice(0,r-r%2)+l0}],[/[\\$.|*+(){^]/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,()=>ad],[/\\\\/g,()=>ad],[/(\\)?\[([^\]/]*?)(\\*)($|\])/g,(t,e,r,i,n)=>e===ad?`\\[${r}${iP(i)}${n}`:n==="]"&&i.length%2===0?`[${rP(r)}${i}]`:"[]"],[/(?:[^*])$/,t=>/\/$/.test(t)?`${t}$`:`${t}(?=$|\\/$)`]],sP=/(^|\\\/)?\\\*$/,ba="regex",jc="checkRegex",f0="_",aP={[ba](t,e){return`${e?`${e}[^/]+`:"[^/]*"}(?=$|\\/$)`},[jc](t,e){return`${e?`${e}[^/]*`:"[^/]*"}(?=$|\\/$)`}},oP=l(t=>nP.reduce((e,[r,i])=>e.replace(r,i.bind(t)),t),"makeRegexPrefix"),Lc=l(t=>typeof t=="string","isString"),cP=l(t=>t&&Lc(t)&&!KA.test(t)&&!JA.test(t)&&t.indexOf("#")!==0,"checkPattern"),lP=l(t=>t.split(ZA).filter(Boolean),"splitPattern"),hd=class hd{constructor(e,r,i,n,s,a){this.pattern=e,this.mark=r,this.negative=s,$n(this,"body",i),$n(this,"ignoreCase",n),$n(this,"regexPrefix",a)}get regex(){let e=f0+ba;return this[e]?this[e]:this._make(ba,e)}get checkRegex(){let e=f0+jc;return this[e]?this[e]:this._make(jc,e)}_make(e,r){let i=this.regexPrefix.replace(sP,aP[e]),n=this.ignoreCase?new RegExp(i,"i"):new RegExp(i);return $n(this,r,n)}};l(hd,"IgnoreRule");var cd=hd,fP=l(({pattern:t,mark:e},r)=>{let i=!1,n=t;n.indexOf("!")===0&&(i=!0,n=n.substr(1)),n=n.replace(XA,"!").replace(YA,"#");let s=oP(n);return new cd(t,e,n,r,i,s)},"createRule"),dd=class dd{constructor(e){this._ignoreCase=e,this._rules=[]}_add(e){if(e&&e[d0]){this._rules=this._rules.concat(e._rules._rules),this._added=!0;return}if(Lc(e)&&(e={pattern:e}),cP(e.pattern)){let r=fP(e,this._ignoreCase);this._added=!0,this._rules.push(r)}}add(e){return this._added=!1,u0(Lc(e)?lP(e):e).forEach(this._add,this),this._added}test(e,r,i){let n=!1,s=!1,a;this._rules.forEach(o=>{let{negative:c}=o;s===c&&n!==s||c&&!n&&!s&&!r||!o[i].test(e)||(n=!c,s=c,a=c?GA:o)});let f={ignored:n,unignored:s};return a&&(f.rule=a),f}};l(dd,"RuleManager");var ld=dd,uP=l((t,e)=>{throw new e(t)},"throwError"),mr=l((t,e,r)=>Lc(t)?t?mr.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"),m0=l(t=>QA.test(t),"isNotRelative");mr.isNotRelative=m0;mr.convert=t=>t;var pd=class pd{constructor({ignorecase:e=!0,ignoreCase:r=e,allowRelativePaths:i=!1}={}){$n(this,d0,!0),this._rules=new ld(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&&mr.convert(e);return mr(s,e,this._strictPathCheck?uP:p0),this._t(s,r,i,n)}checkIgnore(e){if(!eP.test(e))return this.test(e);let r=e.split(In).filter(Boolean);if(r.pop(),r.length){let i=this._t(r.join(In)+In,this._testCache,!0,r);if(i.ignored)return i}return this._rules.test(e,!1,jc)}_t(e,r,i,n){if(e in r)return r[e];if(n||(n=e.split(In).filter(Boolean)),n.pop(),!n.length)return r[e]=this._rules.test(e,i,ba);let s=this._t(n.join(In)+In,r,i,n);return r[e]=s.ignored?s:this._rules.test(e,i,ba)}ignores(e){return this._test(e,this._ignoreCache,!1).ignored}createFilter(){return e=>!this.ignores(e)}filter(e){return u0(e).filter(this.createFilter())}test(e){return this._test(e,this._testCache,!0)}};l(pd,"Ignore");var fd=pd,ud=l(t=>new fd(t),"factory"),hP=l(t=>mr(t&&mr.convert(t),t,p0),"isPathValid"),w0=l(()=>{let t=l(r=>/^\\\\\?\\/.test(r)||/["<>|\u0000-\u001F]+/u.test(r)?r:r.replace(/\\/g,"/"),"makePosix");mr.convert=t;let e=/^[a-z]:\//i;mr.isNotRelative=r=>e.test(r)||m0(r)},"setupWindows");typeof process<"u"&&process.platform==="win32"&&w0();qc.exports=ud;ud.default=ud;qc.exports.isPathValid=hP;$n(qc.exports,Symbol.for("setupWindows"),w0)});var g0=T((I6,y0)=>{"use strict";var ft=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||ft.DEFAULT_TIMEOUT,this.maxOccupationTime=t.maxOccupationTime||ft.DEFAULT_MAX_OCCUPATION_TIME,this.maxExecutionTime=t.maxExecutionTime||ft.DEFAULT_MAX_EXECUTION_TIME,t.maxPending===1/0||Number.isInteger(t.maxPending)&&t.maxPending>=0?this.maxPending=t.maxPending:this.maxPending=ft.DEFAULT_MAX_PENDING},"AsyncLock");ft.DEFAULT_TIMEOUT=0;ft.DEFAULT_MAX_OCCUPATION_TIME=0;ft.DEFAULT_MAX_EXECUTION_TIME=0;ft.DEFAULT_MAX_PENDING=1e3;ft.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(_,F){n=_,s=F})),i=i||{};var f=!1,o=null,c=null,u=null,h=this,d=l(function(_,F,R){c&&(clearTimeout(c),c=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||(a?F?s(F):n(R):typeof r=="function"&&r(F,R),f=!0),_&&h.queues[t]&&h.queues[t].length>0&&h.queues[t].shift()()},"done"),p=l(function(_){if(f)return d(_);o&&(clearTimeout(o),o=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 R=!1;try{e(function(k,D){R||(R=!0,d(_,k,D))})}catch(k){R||(R=!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=l(function(){p(!0)},"taskFn");i.skipQueue?h.queues[t].unshift(w):h.queues[t].push(w);var y=i.timeout||h.timeout;y&&(o=setTimeout(function(){o=null,d(!1,new Error("async-lock timed out in queue "+t))},y))}var g=i.maxOccupationTime||h.maxOccupationTime;if(g&&(c=setTimeout(function(){h.queues[t]&&d(!1,new Error("Maximum occupation time is exceeded in queue "+t))},g)),a)return a};ft.prototype._acquireBatch=function(t,e,r,i){typeof r!="function"&&(i=r,r=null);var n=this,s=l(function(f,o){return function(c){n.acquire(f,o,c,i)}},"getFn"),a=t.reduceRight(function(f,o){return s(o,f)},e);if(typeof r=="function")a(r);else return new this.Promise(function(f,o){a.length===1?a(function(c,u){c?o(c):f(u)}):f(a())})};ft.prototype.isBusy=function(t){return t?!!this.queues[t]:Object.keys(this.queues).length>0};ft.prototype._promiseTry=function(t){try{return this.Promise.resolve(t())}catch(e){return this.Promise.reject(e)}};y0.exports=ft});var _0=T((B6,b0)=>{"use strict";b0.exports=g0()});var v0=T((M6,wd)=>{typeof Object.create=="function"?wd.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"):wd.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 bi=T((L6,gd)=>{try{if(yd=se("util"),typeof yd.inherits!="function")throw"";gd.exports=yd.inherits}catch{gd.exports=v0()}var yd});var _a=T((bd,S0)=>{var Uc=se("buffer"),Yt=Uc.Buffer;function E0(t,e){for(var r in t)e[r]=t[r]}l(E0,"copyProps");Yt.from&&Yt.alloc&&Yt.allocUnsafe&&Yt.allocUnsafeSlow?S0.exports=Uc:(E0(Uc,bd),bd.Buffer=_i);function _i(t,e,r){return Yt(t,e,r)}l(_i,"SafeBuffer");_i.prototype=Object.create(Yt.prototype);E0(Yt,_i);_i.from=function(t,e,r){if(typeof t=="number")throw new TypeError("Argument must not be a number");return Yt(t,e,r)};_i.alloc=function(t,e,r){if(typeof t!="number")throw new TypeError("Argument must be a number");var i=Yt(t);return e!==void 0?typeof r=="string"?i.fill(e,r):i.fill(e):i.fill(0),i};_i.allocUnsafe=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return Yt(t)};_i.allocUnsafeSlow=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return Uc.SlowBuffer(t)}});var T0=T((U6,F0)=>{var dP={}.toString;F0.exports=Array.isArray||function(t){return dP.call(t)=="[object Array]"}});var Bn=T((W6,R0)=>{"use strict";R0.exports=TypeError});var _d=T((z6,O0)=>{"use strict";O0.exports=Object});var x0=T((H6,k0)=>{"use strict";k0.exports=Error});var P0=T((V6,A0)=>{"use strict";A0.exports=EvalError});var D0=T((G6,N0)=>{"use strict";N0.exports=RangeError});var I0=T((K6,C0)=>{"use strict";C0.exports=ReferenceError});var vd=T((J6,$0)=>{"use strict";$0.exports=SyntaxError});var M0=T((X6,B0)=>{"use strict";B0.exports=URIError});var L0=T((Y6,j0)=>{"use strict";j0.exports=Math.abs});var U0=T((Z6,q0)=>{"use strict";q0.exports=Math.floor});var z0=T((Q6,W0)=>{"use strict";W0.exports=Math.max});var V0=T((e3,H0)=>{"use strict";H0.exports=Math.min});var K0=T((t3,G0)=>{"use strict";G0.exports=Math.pow});var X0=T((r3,J0)=>{"use strict";J0.exports=Math.round});var Z0=T((i3,Y0)=>{"use strict";Y0.exports=Number.isNaN||l(function(e){return e!==e},"isNaN")});var eb=T((s3,Q0)=>{"use strict";var pP=Z0();Q0.exports=l(function(e){return pP(e)||e===0?e:e<0?-1:1},"sign")});var rb=T((o3,tb)=>{"use strict";tb.exports=Object.getOwnPropertyDescriptor});var Mn=T((c3,ib)=>{"use strict";var Wc=rb();if(Wc)try{Wc([],"length")}catch{Wc=null}ib.exports=Wc});var va=T((l3,nb)=>{"use strict";var zc=Object.defineProperty||!1;if(zc)try{zc({},"a",{value:1})}catch{zc=!1}nb.exports=zc});var Ed=T((f3,sb)=>{"use strict";sb.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 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 f=Object.getOwnPropertyDescriptor(e,r);if(f.value!==n||f.enumerable!==!0)return!1}return!0},"hasSymbols")});var cb=T((h3,ob)=>{"use strict";var ab=typeof Symbol<"u"&&Symbol,mP=Ed();ob.exports=l(function(){return typeof ab!="function"||typeof Symbol!="function"||typeof ab("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:mP()},"hasNativeSymbols")});var Sd=T((p3,lb)=>{"use strict";lb.exports=typeof Reflect<"u"&&Reflect.getPrototypeOf||null});var Fd=T((m3,fb)=>{"use strict";var wP=_d();fb.exports=wP.getPrototypeOf||null});var db=T((w3,hb)=>{"use strict";var yP="Function.prototype.bind called on incompatible ",gP=Object.prototype.toString,bP=Math.max,_P="[object Function]",ub=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"),vP=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"),EP=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");hb.exports=l(function(e){var r=this;if(typeof r!="function"||gP.apply(r)!==_P)throw new TypeError(yP+r);for(var i=vP(arguments,1),n,s=l(function(){if(this instanceof n){var u=r.apply(this,ub(i,arguments));return Object(u)===u?u:this}return r.apply(e,ub(i,arguments))},"binder"),a=bP(0,r.length-i.length),f=[],o=0;o<a;o++)f[o]="$"+o;if(n=Function("binder","return function ("+EP(f,",")+"){ return binder.apply(this,arguments); }")(s),r.prototype){var c=l(function(){},"Empty");c.prototype=r.prototype,n.prototype=new c,c.prototype=null}return n},"bind")});var jn=T((g3,pb)=>{"use strict";var SP=db();pb.exports=Function.prototype.bind||SP});var Hc=T((b3,mb)=>{"use strict";mb.exports=Function.prototype.call});var Vc=T((_3,wb)=>{"use strict";wb.exports=Function.prototype.apply});var gb=T((v3,yb)=>{"use strict";yb.exports=typeof Reflect<"u"&&Reflect&&Reflect.apply});var Td=T((E3,bb)=>{"use strict";var FP=jn(),TP=Vc(),RP=Hc(),OP=gb();bb.exports=OP||FP.call(RP,TP)});var Gc=T((S3,_b)=>{"use strict";var kP=jn(),xP=Bn(),AP=Hc(),PP=Td();_b.exports=l(function(e){if(e.length<1||typeof e[0]!="function")throw new xP("a function is required");return PP(kP,AP,e)},"callBindBasic")});var Rb=T((T3,Tb)=>{"use strict";var NP=Gc(),vb=Mn(),Sb;try{Sb=[].__proto__===Array.prototype}catch(t){if(!t||typeof t!="object"||!("code"in t)||t.code!=="ERR_PROTO_ACCESS")throw t}var Rd=!!Sb&&vb&&vb(Object.prototype,"__proto__"),Fb=Object,Eb=Fb.getPrototypeOf;Tb.exports=Rd&&typeof Rd.get=="function"?NP([Rd.get]):typeof Eb=="function"?l(function(e){return Eb(e==null?e:Fb(e))},"getDunder"):!1});var Od=T((O3,Ab)=>{"use strict";var Ob=Sd(),kb=Fd(),xb=Rb();Ab.exports=Ob?l(function(e){return Ob(e)},"getProto"):kb?l(function(e){if(!e||typeof e!="object"&&typeof e!="function")throw new TypeError("getProto: not an object");return kb(e)},"getProto"):xb?l(function(e){return xb(e)},"getProto"):null});var Nb=T((x3,Pb)=>{"use strict";var DP=Function.prototype.call,CP=Object.prototype.hasOwnProperty,IP=jn();Pb.exports=IP.call(DP,CP)});var Ad=T((A3,Mb)=>{"use strict";var J,$P=_d(),BP=x0(),MP=P0(),jP=D0(),LP=I0(),Wn=vd(),Un=Bn(),qP=M0(),UP=L0(),WP=U0(),zP=z0(),HP=V0(),VP=K0(),GP=X0(),KP=eb(),$b=Function,kd=l(function(t){try{return $b('"use strict"; return ('+t+").constructor;")()}catch{}},"getEvalledConstructor"),Ea=Mn(),JP=va(),xd=l(function(){throw new Un},"throwTypeError"),XP=Ea?function(){try{return arguments.callee,xd}catch{try{return Ea(arguments,"callee").get}catch{return xd}}}():xd,Ln=cb()(),Ne=Od(),YP=Fd(),ZP=Sd(),Bb=Vc(),Sa=Hc(),qn={},QP=typeof Uint8Array>"u"||!Ne?J:Ne(Uint8Array),vi={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?J:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?J:ArrayBuffer,"%ArrayIteratorPrototype%":Ln&&Ne?Ne([][Symbol.iterator]()):J,"%AsyncFromSyncIteratorPrototype%":J,"%AsyncFunction%":qn,"%AsyncGenerator%":qn,"%AsyncGeneratorFunction%":qn,"%AsyncIteratorPrototype%":qn,"%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%":BP,"%eval%":eval,"%EvalError%":MP,"%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%":$b,"%GeneratorFunction%":qn,"%Int8Array%":typeof Int8Array>"u"?J:Int8Array,"%Int16Array%":typeof Int16Array>"u"?J:Int16Array,"%Int32Array%":typeof Int32Array>"u"?J:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Ln&&Ne?Ne(Ne([][Symbol.iterator]())):J,"%JSON%":typeof JSON=="object"?JSON:J,"%Map%":typeof Map>"u"?J:Map,"%MapIteratorPrototype%":typeof Map>"u"||!Ln||!Ne?J:Ne(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":$P,"%Object.getOwnPropertyDescriptor%":Ea,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?J:Promise,"%Proxy%":typeof Proxy>"u"?J:Proxy,"%RangeError%":jP,"%ReferenceError%":LP,"%Reflect%":typeof Reflect>"u"?J:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?J:Set,"%SetIteratorPrototype%":typeof Set>"u"||!Ln||!Ne?J:Ne(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?J:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Ln&&Ne?Ne(""[Symbol.iterator]()):J,"%Symbol%":Ln?Symbol:J,"%SyntaxError%":Wn,"%ThrowTypeError%":XP,"%TypedArray%":QP,"%TypeError%":Un,"%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%":qP,"%WeakMap%":typeof WeakMap>"u"?J:WeakMap,"%WeakRef%":typeof WeakRef>"u"?J:WeakRef,"%WeakSet%":typeof WeakSet>"u"?J:WeakSet,"%Function.prototype.call%":Sa,"%Function.prototype.apply%":Bb,"%Object.defineProperty%":JP,"%Object.getPrototypeOf%":YP,"%Math.abs%":UP,"%Math.floor%":WP,"%Math.max%":zP,"%Math.min%":HP,"%Math.pow%":VP,"%Math.round%":GP,"%Math.sign%":KP,"%Reflect.getPrototypeOf%":ZP};if(Ne)try{null.error}catch(t){Db=Ne(Ne(t)),vi["%Error.prototype%"]=Db}var Db,eN=l(function t(e){var r;if(e==="%AsyncFunction%")r=kd("async function () {}");else if(e==="%GeneratorFunction%")r=kd("function* () {}");else if(e==="%AsyncGeneratorFunction%")r=kd("async function* () {}");else if(e==="%AsyncGenerator%"){var i=t("%AsyncGeneratorFunction%");i&&(r=i.prototype)}else if(e==="%AsyncIteratorPrototype%"){var n=t("%AsyncGenerator%");n&&Ne&&(r=Ne(n.prototype))}return vi[e]=r,r},"doEval"),Cb={__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"]},Fa=jn(),Kc=Nb(),tN=Fa.call(Sa,Array.prototype.concat),rN=Fa.call(Bb,Array.prototype.splice),Ib=Fa.call(Sa,String.prototype.replace),Jc=Fa.call(Sa,String.prototype.slice),iN=Fa.call(Sa,RegExp.prototype.exec),nN=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,sN=/\\(\\)?/g,aN=l(function(e){var r=Jc(e,0,1),i=Jc(e,-1);if(r==="%"&&i!=="%")throw new Wn("invalid intrinsic syntax, expected closing `%`");if(i==="%"&&r!=="%")throw new Wn("invalid intrinsic syntax, expected opening `%`");var n=[];return Ib(e,nN,function(s,a,f,o){n[n.length]=f?Ib(o,sN,"$1"):a||s}),n},"stringToPath"),oN=l(function(e,r){var i=e,n;if(Kc(Cb,i)&&(n=Cb[i],i="%"+n[0]+"%"),Kc(vi,i)){var s=vi[i];if(s===qn&&(s=eN(i)),typeof s>"u"&&!r)throw new Un("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:n,name:i,value:s}}throw new Wn("intrinsic "+e+" does not exist!")},"getBaseIntrinsic");Mb.exports=l(function(e,r){if(typeof e!="string"||e.length===0)throw new Un("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof r!="boolean")throw new Un('"allowMissing" argument must be a boolean');if(iN(/^%?[^%]*%?$/,e)===null)throw new Wn("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var i=aN(e),n=i.length>0?i[0]:"",s=oN("%"+n+"%",r),a=s.name,f=s.value,o=!1,c=s.alias;c&&(n=c[0],rN(i,tN([0,1],c)));for(var u=1,h=!0;u<i.length;u+=1){var d=i[u],p=Jc(d,0,1),m=Jc(d,-1);if((p==='"'||p==="'"||p==="`"||m==='"'||m==="'"||m==="`")&&p!==m)throw new Wn("property names with quotes must have matching quotes");if((d==="constructor"||!h)&&(o=!0),n+="."+d,a="%"+n+"%",Kc(vi,a))f=vi[a];else if(f!=null){if(!(d in f)){if(!r)throw new Un("base intrinsic for "+e+" exists, but the property is not available.");return}if(Ea&&u+1>=i.length){var w=Ea(f,d);h=!!w,h&&"get"in w&&!("originalValue"in w.get)?f=w.get:f=f[d]}else h=Kc(f,d),f=f[d];h&&!o&&(vi[a]=f)}}return f},"GetIntrinsic")});var Pd=T((N3,qb)=>{"use strict";var jb=Ad(),Lb=Gc(),cN=Lb([jb("%String.prototype.indexOf%")]);qb.exports=l(function(e,r){var i=jb(e,!!r);return typeof i=="function"&&cN(e,".prototype.")>-1?Lb([i]):i},"callBoundIntrinsic")});var Hb=T((C3,zb)=>{"use strict";var Wb=Function.prototype.toString,zn=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,Dd,Xc;if(typeof zn=="function"&&typeof Object.defineProperty=="function")try{Dd=Object.defineProperty({},"length",{get:l(function(){throw Xc},"get")}),Xc={},zn(function(){throw 42},null,Dd)}catch(t){t!==Xc&&(zn=null)}else zn=null;var lN=/^\s*class\b/,Cd=l(function(e){try{var r=Wb.call(e);return lN.test(r)}catch{return!1}},"isES6ClassFunction"),Nd=l(function(e){try{return Cd(e)?!1:(Wb.call(e),!0)}catch{return!1}},"tryFunctionToStr"),Yc=Object.prototype.toString,fN="[object Object]",uN="[object Function]",hN="[object GeneratorFunction]",dN="[object HTMLAllCollection]",pN="[object HTML document.all class]",mN="[object HTMLCollection]",wN=typeof Symbol=="function"&&!!Symbol.toStringTag,yN=!(0 in[,]),Id=l(function(){return!1},"isDocumentDotAll");typeof document=="object"&&(Ub=document.all,Yc.call(Ub)===Yc.call(document.all)&&(Id=l(function(e){if((yN||!e)&&(typeof e>"u"||typeof e=="object"))try{var r=Yc.call(e);return(r===dN||r===pN||r===mN||r===fN)&&e("")==null}catch{}return!1},"isDocumentDotAll")));var Ub;zb.exports=l(zn?function(e){if(Id(e))return!0;if(!e||typeof e!="function"&&typeof e!="object")return!1;try{zn(e,null,Dd)}catch(r){if(r!==Xc)return!1}return!Cd(e)&&Nd(e)}:function(e){if(Id(e))return!0;if(!e||typeof e!="function"&&typeof e!="object")return!1;if(wN)return Nd(e);if(Cd(e))return!1;var r=Yc.call(e);return r!==uN&&r!==hN&&!/^\[object HTML/.test(r)?!1:Nd(e)},"isCallable")});var Kb=T(($3,Gb)=>{"use strict";var gN=Hb(),bN=Object.prototype.toString,Vb=Object.prototype.hasOwnProperty,_N=l(function(e,r,i){for(var n=0,s=e.length;n<s;n++)Vb.call(e,n)&&(i==null?r(e[n],n,e):r.call(i,e[n],n,e))},"forEachArray"),vN=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"),EN=l(function(e,r,i){for(var n in e)Vb.call(e,n)&&(i==null?r(e[n],n,e):r.call(i,e[n],n,e))},"forEachObject");function SN(t){return bN.call(t)==="[object Array]"}l(SN,"isArray");Gb.exports=l(function(e,r,i){if(!gN(r))throw new TypeError("iterator must be a function");var n;arguments.length>=3&&(n=i),SN(e)?_N(e,r,n):typeof e=="string"?vN(e,r,n):EN(e,r,n)},"forEach")});var Xb=T((M3,Jb)=>{"use strict";Jb.exports=["Float16Array","Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"]});var Zb=T((j3,Yb)=>{"use strict";var $d=Xb(),FN=globalThis;Yb.exports=l(function(){for(var e=[],r=0;r<$d.length;r++)typeof FN[$d[r]]=="function"&&(e[e.length]=$d[r]);return e},"availableTypedArrays")});var r_=T((q3,t_)=>{"use strict";var Qb=va(),TN=vd(),Hn=Bn(),e_=Mn();t_.exports=l(function(e,r,i){if(!e||typeof e!="object"&&typeof e!="function")throw new Hn("`obj` must be an object or a function`");if(typeof r!="string"&&typeof r!="symbol")throw new Hn("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new Hn("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new Hn("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new Hn("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new Hn("`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,f=arguments.length>6?arguments[6]:!1,o=!!e_&&e_(e,r);if(Qb)Qb(e,r,{configurable:a===null&&o?o.configurable:!a,enumerable:n===null&&o?o.enumerable:!n,value:i,writable:s===null&&o?o.writable:!s});else if(f||!n&&!s&&!a)e[r]=i;else throw new TN("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},"defineDataProperty")});var s_=T((W3,n_)=>{"use strict";var Bd=va(),i_=l(function(){return!!Bd},"hasPropertyDescriptors");i_.hasArrayLengthDefineBug=l(function(){if(!Bd)return null;try{return Bd([],"length",{value:1}).length!==1}catch{return!0}},"hasArrayLengthDefineBug");n_.exports=i_});var f_=T((H3,l_)=>{"use strict";var RN=Ad(),a_=r_(),ON=s_()(),o_=Mn(),c_=Bn(),kN=RN("%Math.floor%");l_.exports=l(function(e,r){if(typeof e!="function")throw new c_("`fn` is not a function");if(typeof r!="number"||r<0||r>4294967295||kN(r)!==r)throw new c_("`length` must be a positive 32-bit integer");var i=arguments.length>2&&!!arguments[2],n=!0,s=!0;if("length"in e&&o_){var a=o_(e,"length");a&&!a.configurable&&(n=!1),a&&!a.writable&&(s=!1)}return(n||s||!i)&&(ON?a_(e,"length",r,!0,!0):a_(e,"length",r)),e},"setFunctionLength")});var h_=T((G3,u_)=>{"use strict";var xN=jn(),AN=Vc(),PN=Td();u_.exports=l(function(){return PN(xN,AN,arguments)},"applyBind")});var m_=T((J3,Zc)=>{"use strict";var NN=f_(),d_=va(),DN=Gc(),p_=h_();Zc.exports=l(function(e){var r=DN(arguments),i=e.length-(arguments.length-1);return NN(r,1+(i>0?i:0),!0)},"callBind");d_?d_(Zc.exports,"apply",{value:p_}):Zc.exports.apply=p_});var y_=T((Y3,w_)=>{"use strict";var CN=Ed();w_.exports=l(function(){return CN()&&!!Symbol.toStringTag},"hasToStringTagShams")});var E_=T((Q3,v_)=>{"use strict";var tl=Kb(),IN=Zb(),g_=m_(),jd=Pd(),el=Mn(),Qc=Od(),$N=jd("Object.prototype.toString"),__=y_()(),b_=globalThis,Md=IN(),Ld=jd("String.prototype.slice"),BN=jd("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"),rl={__proto__:null};__&&el&&Qc?tl(Md,function(t){var e=new b_[t];if(Symbol.toStringTag in e&&Qc){var r=Qc(e),i=el(r,Symbol.toStringTag);if(!i&&r){var n=Qc(r);i=el(n,Symbol.toStringTag)}rl["$"+t]=g_(i.get)}}):tl(Md,function(t){var e=new b_[t],r=e.slice||e.set;r&&(rl["$"+t]=g_(r))});var MN=l(function(e){var r=!1;return tl(rl,function(i,n){if(!r)try{"$"+i(e)===n&&(r=Ld(n,1))}catch{}}),r},"tryAllTypedArrays"),jN=l(function(e){var r=!1;return tl(rl,function(i,n){if(!r)try{i(e),r=Ld(n,1)}catch{}}),r},"tryAllSlices");v_.exports=l(function(e){if(!e||typeof e!="object")return!1;if(!__){var r=Ld($N(e),8,-1);return BN(Md,r)>-1?r:r!=="Object"?!1:jN(e)}return el?MN(e):null},"whichTypedArray")});var F_=T((tW,S_)=>{"use strict";var LN=E_();S_.exports=l(function(e){return!!LN(e)},"isTypedArray")});var R_=T((iW,T_)=>{"use strict";var qN=Bn(),UN=Pd(),WN=UN("TypedArray.prototype.buffer",!0),zN=F_();T_.exports=WN||l(function(e){if(!zN(e))throw new qN("Not a Typed Array");return e.buffer},"typedArrayBuffer")});var x_=T((sW,k_)=>{"use strict";var $t=_a().Buffer,HN=T0(),VN=R_(),GN=ArrayBuffer.isView||l(function(e){try{return VN(e),!0}catch{return!1}},"isView"),KN=typeof Uint8Array<"u",O_=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u",JN=O_&&($t.prototype instanceof Uint8Array||$t.TYPED_ARRAY_SUPPORT);k_.exports=l(function(e,r){if($t.isBuffer(e))return e.constructor&&!("isBuffer"in e)?$t.from(e):e;if(typeof e=="string")return $t.from(e,r);if(O_&&GN(e)){if(e.byteLength===0)return $t.alloc(0);if(JN){var i=$t.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=$t.from(n);if(s.length===e.byteLength)return s}if(KN&&e instanceof Uint8Array)return $t.from(e);var a=HN(e);if(a)for(var f=0;f<e.length;f+=1){var o=e[f];if(typeof o!="number"||o<0||o>255||~~o!==o)throw new RangeError("Array items must be numbers in the range 0-255.")}if(a||$t.isBuffer(e)&&e.constructor&&typeof e.constructor.isBuffer=="function"&&e.constructor.isBuffer(e))return $t.from(e);throw new TypeError('The "data" argument must be a string, an Array, a Buffer, a Uint8Array, or a DataView.')},"toBuffer")});var P_=T((oW,A_)=>{"use strict";var XN=_a().Buffer,YN=x_();function il(t,e){this._block=XN.alloc(t),this._finalSize=e,this._blockSize=t,this._len=0}l(il,"Hash");il.prototype.update=function(t,e){t=YN(t,e||"utf8");for(var r=this._block,i=this._blockSize,n=t.length,s=this._len,a=0;a<n;){for(var f=s%i,o=Math.min(n-a,i-f),c=0;c<o;c++)r[f+c]=t[a+c];s+=o,a+=o,s%i===0&&this._update(r)}return this._len+=n,this};il.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};il.prototype._update=function(){throw new Error("_update must be implemented by subclass")};A_.exports=il});var C_=T((lW,D_)=>{"use strict";var ZN=bi(),N_=P_(),QN=_a().Buffer,eD=[1518500249,1859775393,-1894007588,-899497514],tD=new Array(80);function Ta(){this.init(),this._w=tD,N_.call(this,64,56)}l(Ta,"Sha1");ZN(Ta,N_);Ta.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function rD(t){return t<<1|t>>>31}l(rD,"rotl1");function iD(t){return t<<5|t>>>27}l(iD,"rotl5");function nD(t){return t<<30|t>>>2}l(nD,"rotl30");function sD(t,e,r,i){return t===0?e&r|~e&i:t===2?e&r|e&i|r&i:e^r^i}l(sD,"ft");Ta.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,f=0;f<16;++f)e[f]=t.readInt32BE(f*4);for(;f<80;++f)e[f]=rD(e[f-3]^e[f-8]^e[f-14]^e[f-16]);for(var o=0;o<80;++o){var c=~~(o/20),u=iD(r)+sD(c,i,n,s)+a+e[o]+eD[c]|0;a=s,s=n,n=nD(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=a+this._e|0};Ta.prototype._hash=function(){var t=QN.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};D_.exports=Ta});var B_=T((uW,$_)=>{"use strict";function Zt(t){if(typeof t!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}l(Zt,"assertPath");function I_(t,e){for(var r="",i=0,n=-1,s=0,a,f=0;f<=t.length;++f){if(f<t.length)a=t.charCodeAt(f);else{if(a===47)break;a=47}if(a===47){if(!(n===f-1||s===1))if(n!==f-1&&s===2){if(r.length<2||i!==2||r.charCodeAt(r.length-1)!==46||r.charCodeAt(r.length-2)!==46){if(r.length>2){var o=r.lastIndexOf("/");if(o!==r.length-1){o===-1?(r="",i=0):(r=r.slice(0,o),i=r.length-1-r.lastIndexOf("/")),n=f,s=0;continue}}else if(r.length===2||r.length===1){r="",i=0,n=f,s=0;continue}}e&&(r.length>0?r+="/..":r="..",i=2)}else r.length>0?r+="/"+t.slice(n+1,f):r=t.slice(n+1,f),i=f-n-1;n=f,s=0}else a===46&&s!==-1?++s:s=-1}return r}l(I_,"normalizeStringPosix");function aD(t,e){var r=e.dir||e.root,i=e.base||(e.name||"")+(e.ext||"");return r?r===e.root?r+i:r+t+i:i}l(aD,"_format");var Vn={resolve:l(function(){for(var e="",r=!1,i,n=arguments.length-1;n>=-1&&!r;n--){var s;n>=0?s=arguments[n]:(i===void 0&&(i=process.cwd()),s=i),Zt(s),s.length!==0&&(e=s+"/"+e,r=s.charCodeAt(0)===47)}return e=I_(e,!r),r?e.length>0?"/"+e:"/":e.length>0?e:"."},"resolve"),normalize:l(function(e){if(Zt(e),e.length===0)return".";var r=e.charCodeAt(0)===47,i=e.charCodeAt(e.length-1)===47;return e=I_(e,!r),e.length===0&&!r&&(e="."),e.length>0&&i&&(e+="/"),r?"/"+e:e},"normalize"),isAbsolute:l(function(e){return Zt(e),e.length>0&&e.charCodeAt(0)===47},"isAbsolute"),join:l(function(){if(arguments.length===0)return".";for(var e,r=0;r<arguments.length;++r){var i=arguments[r];Zt(i),i.length>0&&(e===void 0?e=i:e+="/"+i)}return e===void 0?".":Vn.normalize(e)},"join"),relative:l(function(e,r){if(Zt(e),Zt(r),e===r||(e=Vn.resolve(e),r=Vn.resolve(r),e===r))return"";for(var i=1;i<e.length&&e.charCodeAt(i)===47;++i);for(var n=e.length,s=n-i,a=1;a<r.length&&r.charCodeAt(a)===47;++a);for(var f=r.length,o=f-a,c=s<o?s:o,u=-1,h=0;h<=c;++h){if(h===c){if(o>c){if(r.charCodeAt(a+h)===47)return r.slice(a+h+1);if(h===0)return r.slice(a+h)}else s>c&&(e.charCodeAt(i+h)===47?u=h:h===0&&(u=0));break}var d=e.charCodeAt(i+h),p=r.charCodeAt(a+h);if(d!==p)break;d===47&&(u=h)}var m="";for(h=i+u+1;h<=n;++h)(h===n||e.charCodeAt(h)===47)&&(m.length===0?m+="..":m+="/..");return m.length>0?m+r.slice(a+u):(a+=u,r.charCodeAt(a)===47&&++a,r.slice(a))},"relative"),_makeLong:l(function(e){return e},"_makeLong"),dirname:l(function(e){if(Zt(e),e.length===0)return".";for(var r=e.charCodeAt(0),i=r===47,n=-1,s=!0,a=e.length-1;a>=1;--a)if(r=e.charCodeAt(a),r===47){if(!s){n=a;break}}else s=!1;return n===-1?i?"/":".":i&&n===1?"//":e.slice(0,n)},"dirname"),basename:l(function(e,r){if(r!==void 0&&typeof r!="string")throw new TypeError('"ext" argument must be a string');Zt(e);var i=0,n=-1,s=!0,a;if(r!==void 0&&r.length>0&&r.length<=e.length){if(r.length===e.length&&r===e)return"";var f=r.length-1,o=-1;for(a=e.length-1;a>=0;--a){var c=e.charCodeAt(a);if(c===47){if(!s){i=a+1;break}}else o===-1&&(s=!1,o=a+1),f>=0&&(c===r.charCodeAt(f)?--f===-1&&(n=a):(f=-1,n=o))}return i===n?n=o:n===-1&&(n=e.length),e.slice(i,n)}else{for(a=e.length-1;a>=0;--a)if(e.charCodeAt(a)===47){if(!s){i=a+1;break}}else n===-1&&(s=!1,n=a+1);return n===-1?"":e.slice(i,n)}},"basename"),extname:l(function(e){Zt(e);for(var r=-1,i=0,n=-1,s=!0,a=0,f=e.length-1;f>=0;--f){var o=e.charCodeAt(f);if(o===47){if(!s){i=f+1;break}continue}n===-1&&(s=!1,n=f+1),o===46?r===-1?r=f:a!==1&&(a=1):r!==-1&&(a=-1)}return r===-1||n===-1||a===0||a===1&&r===n-1&&r===i+1?"":e.slice(r,n)},"extname"),format:l(function(e){if(e===null||typeof e!="object")throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof e);return aD("/",e)},"format"),parse:l(function(e){Zt(e);var r={root:"",dir:"",base:"",ext:"",name:""};if(e.length===0)return r;var i=e.charCodeAt(0),n=i===47,s;n?(r.root="/",s=1):s=0;for(var a=-1,f=0,o=-1,c=!0,u=e.length-1,h=0;u>=s;--u){if(i=e.charCodeAt(u),i===47){if(!c){f=u+1;break}continue}o===-1&&(c=!1,o=u+1),i===46?a===-1?a=u:h!==1&&(h=1):a!==-1&&(h=-1)}return a===-1||o===-1||h===0||h===1&&a===o-1&&a===f+1?o!==-1&&(f===0&&n?r.base=r.name=e.slice(1,o):r.base=r.name=e.slice(f,o)):(f===0&&n?(r.name=e.slice(1,a),r.base=e.slice(1,o)):(r.name=e.slice(f,a),r.base=e.slice(f,o)),r.ext=e.slice(a,o)),f>0?r.dir=e.slice(0,f-1):n&&(r.dir="/"),r},"parse"),sep:"/",delimiter:":",win32:null,posix:null};Vn.posix=Vn;$_.exports=Vn});var j_=T(qd=>{var M_;(function(t){typeof DO_NOT_EXPORT_CRC>"u"?typeof qd=="object"?t(qd):typeof define=="function"&&define.amd?define(function(){var e={};return t(e),e}):t(M_={}):t(M_={})})(function(t){t.version="1.2.2";function e(){for(var v=0,O=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,O[E]=v;return typeof Int32Array<"u"?new Int32Array(O):O}l(e,"signed_crc_table");var r=e();function i(v){var O=0,E=0,N=0,x=typeof Int32Array<"u"?new Int32Array(4096):new Array(4096);for(N=0;N!=256;++N)x[N]=v[N];for(N=0;N!=256;++N)for(E=v[N],O=256+N;O<4096;O+=256)E=x[O]=E>>>8^v[E&255];var I=[];for(N=1;N!=16;++N)I[N-1]=typeof Int32Array<"u"?x.subarray(N*256,N*256+256):x.slice(N*256,N*256+256);return I}l(i,"slice_by_16_tables");var n=i(r),s=n[0],a=n[1],f=n[2],o=n[3],c=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 R(v,O){for(var E=O^-1,N=0,x=v.length;N<x;)E=E>>>8^r[(E^v.charCodeAt(N++))&255];return~E}l(R,"crc32_bstr");function k(v,O){for(var E=O^-1,N=v.length-15,x=0;x<N;)E=F[v[x++]^E&255]^_[v[x++]^E>>8&255]^g[v[x++]^E>>16&255]^y[v[x++]^E>>>24]^w[v[x++]]^m[v[x++]]^p[v[x++]]^d[v[x++]]^h[v[x++]]^u[v[x++]]^c[v[x++]]^o[v[x++]]^f[v[x++]]^a[v[x++]]^s[v[x++]]^r[v[x++]];for(N+=15;x<N;)E=E>>>8^r[(E^v[x++])&255];return~E}l(k,"crc32_buf");function D(v,O){for(var E=O^-1,N=0,x=v.length,I=0,q=0;N<x;)I=v.charCodeAt(N++),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,q=v.charCodeAt(N++)&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|q>>6&15|(I&3)<<4))&255],E=E>>>8^r[(E^(128|q&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}l(D,"crc32_str"),t.table=r,t.bstr=R,t.buf=k,t.str=D})});var wr=T(Je=>{"use strict";var oD=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";function cD(t,e){return Object.prototype.hasOwnProperty.call(t,e)}l(cD,"_has");Je.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)cD(r,i)&&(t[i]=r[i])}}return t};Je.shrinkBuf=function(t,e){return t.length===e?t:t.subarray?t.subarray(0,e):(t.length=e,t)};var lD={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,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")},fD={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")};Je.setTyped=function(t){t?(Je.Buf8=Uint8Array,Je.Buf16=Uint16Array,Je.Buf32=Int32Array,Je.assign(Je,lD)):(Je.Buf8=Array,Je.Buf16=Array,Je.Buf32=Array,Je.assign(Je,fD))};Je.setTyped(oD)});var cv=T(Jn=>{"use strict";var uD=wr(),hD=4,L_=0,q_=1,dD=2;function Kn(t){for(var e=t.length;--e>=0;)t[e]=0}l(Kn,"zero");var pD=0,G_=1,mD=2,wD=3,yD=258,Kd=29,Pa=256,Oa=Pa+1+Kd,Gn=30,Jd=19,K_=2*Oa+1,Ei=15,Ud=16,gD=7,Xd=256,J_=16,X_=17,Y_=18,Vd=[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],nl=[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],bD=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],Z_=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],_D=512,yr=new Array((Oa+2)*2);Kn(yr);var Ra=new Array(Gn*2);Kn(Ra);var ka=new Array(_D);Kn(ka);var xa=new Array(yD-wD+1);Kn(xa);var Yd=new Array(Kd);Kn(Yd);var sl=new Array(Gn);Kn(sl);function Wd(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(Wd,"StaticTreeDesc");var Q_,ev,tv;function zd(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e}l(zd,"TreeDesc");function rv(t){return t<256?ka[t]:ka[256+(t>>>7)]}l(rv,"d_code");function Aa(t,e){t.pending_buf[t.pending++]=e&255,t.pending_buf[t.pending++]=e>>>8&255}l(Aa,"put_short");function Qe(t,e,r){t.bi_valid>Ud-r?(t.bi_buf|=e<<t.bi_valid&65535,Aa(t,t.bi_buf),t.bi_buf=e>>Ud-t.bi_valid,t.bi_valid+=r-Ud):(t.bi_buf|=e<<t.bi_valid&65535,t.bi_valid+=r)}l(Qe,"send_bits");function Qt(t,e,r){Qe(t,r[e*2],r[e*2+1])}l(Qt,"send_code");function iv(t,e){var r=0;do r|=t&1,t>>>=1,r<<=1;while(--e>0);return r>>>1}l(iv,"bi_reverse");function vD(t){t.bi_valid===16?(Aa(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(vD,"bi_flush");function ED(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,f=e.stat_desc.extra_base,o=e.stat_desc.max_length,c,u,h,d,p,m,w=0;for(d=0;d<=Ei;d++)t.bl_count[d]=0;for(r[t.heap[t.heap_max]*2+1]=0,c=t.heap_max+1;c<K_;c++)u=t.heap[c],d=r[r[u*2+1]*2+1]+1,d>o&&(d=o,w++),r[u*2+1]=d,!(u>i)&&(t.bl_count[d]++,p=0,u>=f&&(p=a[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=o-1;t.bl_count[d]===0;)d--;t.bl_count[d]--,t.bl_count[d+1]+=2,t.bl_count[o]--,w-=2}while(w>0);for(d=o;d!==0;d--)for(u=t.bl_count[d];u!==0;)h=t.heap[--c],!(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(ED,"gen_bitlen");function nv(t,e,r){var i=new Array(Ei+1),n=0,s,a;for(s=1;s<=Ei;s++)i[s]=n=n+r[s-1]<<1;for(a=0;a<=e;a++){var f=t[a*2+1];f!==0&&(t[a*2]=iv(i[f]++,f))}}l(nv,"gen_codes");function SD(){var t,e,r,i,n,s=new Array(Ei+1);for(r=0,i=0;i<Kd-1;i++)for(Yd[i]=r,t=0;t<1<<Vd[i];t++)xa[r++]=i;for(xa[r-1]=i,n=0,i=0;i<16;i++)for(sl[i]=n,t=0;t<1<<nl[i];t++)ka[n++]=i;for(n>>=7;i<Gn;i++)for(sl[i]=n<<7,t=0;t<1<<nl[i]-7;t++)ka[256+n++]=i;for(e=0;e<=Ei;e++)s[e]=0;for(t=0;t<=143;)yr[t*2+1]=8,t++,s[8]++;for(;t<=255;)yr[t*2+1]=9,t++,s[9]++;for(;t<=279;)yr[t*2+1]=7,t++,s[7]++;for(;t<=287;)yr[t*2+1]=8,t++,s[8]++;for(nv(yr,Oa+1,s),t=0;t<Gn;t++)Ra[t*2+1]=5,Ra[t*2]=iv(t,5);Q_=new Wd(yr,Vd,Pa+1,Oa,Ei),ev=new Wd(Ra,nl,0,Gn,Ei),tv=new Wd(new Array(0),bD,0,Jd,gD)}l(SD,"tr_static_init");function sv(t){var e;for(e=0;e<Oa;e++)t.dyn_ltree[e*2]=0;for(e=0;e<Gn;e++)t.dyn_dtree[e*2]=0;for(e=0;e<Jd;e++)t.bl_tree[e*2]=0;t.dyn_ltree[Xd*2]=1,t.opt_len=t.static_len=0,t.last_lit=t.matches=0}l(sv,"init_block");function av(t){t.bi_valid>8?Aa(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(av,"bi_windup");function FD(t,e,r,i){av(t),i&&(Aa(t,r),Aa(t,~r)),uD.arraySet(t.pending_buf,t.window,e,r,t.pending),t.pending+=r}l(FD,"copy_block");function U_(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(U_,"smaller");function Hd(t,e,r){for(var i=t.heap[r],n=r<<1;n<=t.heap_len&&(n<t.heap_len&&U_(e,t.heap[n+1],t.heap[n],t.depth)&&n++,!U_(e,i,t.heap[n],t.depth));)t.heap[r]=t.heap[n],r=n,n<<=1;t.heap[r]=i}l(Hd,"pqdownheap");function W_(t,e,r){var i,n,s=0,a,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?Qt(t,n,e):(a=xa[n],Qt(t,a+Pa+1,e),f=Vd[a],f!==0&&(n-=Yd[a],Qe(t,n,f)),i--,a=rv(i),Qt(t,a,r),f=nl[a],f!==0&&(i-=sl[a],Qe(t,i,f)));while(s<t.last_lit);Qt(t,Xd,e)}l(W_,"compress_block");function Gd(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,f,o=-1,c;for(t.heap_len=0,t.heap_max=K_,a=0;a<s;a++)r[a*2]!==0?(t.heap[++t.heap_len]=o=a,t.depth[a]=0):r[a*2+1]=0;for(;t.heap_len<2;)c=t.heap[++t.heap_len]=o<2?++o:0,r[c*2]=1,t.depth[c]=0,t.opt_len--,n&&(t.static_len-=i[c*2+1]);for(e.max_code=o,a=t.heap_len>>1;a>=1;a--)Hd(t,r,a);c=s;do a=t.heap[1],t.heap[1]=t.heap[t.heap_len--],Hd(t,r,1),f=t.heap[1],t.heap[--t.heap_max]=a,t.heap[--t.heap_max]=f,r[c*2]=r[a*2]+r[f*2],t.depth[c]=(t.depth[a]>=t.depth[f]?t.depth[a]:t.depth[f])+1,r[a*2+1]=r[f*2+1]=c,t.heap[1]=c++,Hd(t,r,1);while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],ED(t,e),nv(r,o,t.bl_count)}l(Gd,"build_tree");function z_(t,e,r){var i,n=-1,s,a=e[0*2+1],f=0,o=7,c=4;for(a===0&&(o=138,c=3),e[(r+1)*2+1]=65535,i=0;i<=r;i++)s=a,a=e[(i+1)*2+1],!(++f<o&&s===a)&&(f<c?t.bl_tree[s*2]+=f:s!==0?(s!==n&&t.bl_tree[s*2]++,t.bl_tree[J_*2]++):f<=10?t.bl_tree[X_*2]++:t.bl_tree[Y_*2]++,f=0,n=s,a===0?(o=138,c=3):s===a?(o=6,c=3):(o=7,c=4))}l(z_,"scan_tree");function H_(t,e,r){var i,n=-1,s,a=e[0*2+1],f=0,o=7,c=4;for(a===0&&(o=138,c=3),i=0;i<=r;i++)if(s=a,a=e[(i+1)*2+1],!(++f<o&&s===a)){if(f<c)do Qt(t,s,t.bl_tree);while(--f!==0);else s!==0?(s!==n&&(Qt(t,s,t.bl_tree),f--),Qt(t,J_,t.bl_tree),Qe(t,f-3,2)):f<=10?(Qt(t,X_,t.bl_tree),Qe(t,f-3,3)):(Qt(t,Y_,t.bl_tree),Qe(t,f-11,7));f=0,n=s,a===0?(o=138,c=3):s===a?(o=6,c=3):(o=7,c=4)}}l(H_,"send_tree");function TD(t){var e;for(z_(t,t.dyn_ltree,t.l_desc.max_code),z_(t,t.dyn_dtree,t.d_desc.max_code),Gd(t,t.bl_desc),e=Jd-1;e>=3&&t.bl_tree[Z_[e]*2+1]===0;e--);return t.opt_len+=3*(e+1)+5+5+4,e}l(TD,"build_bl_tree");function RD(t,e,r,i){var n;for(Qe(t,e-257,5),Qe(t,r-1,5),Qe(t,i-4,4),n=0;n<i;n++)Qe(t,t.bl_tree[Z_[n]*2+1],3);H_(t,t.dyn_ltree,e-1),H_(t,t.dyn_dtree,r-1)}l(RD,"send_all_trees");function OD(t){var e=4093624447,r;for(r=0;r<=31;r++,e>>>=1)if(e&1&&t.dyn_ltree[r*2]!==0)return L_;if(t.dyn_ltree[9*2]!==0||t.dyn_ltree[10*2]!==0||t.dyn_ltree[13*2]!==0)return q_;for(r=32;r<Pa;r++)if(t.dyn_ltree[r*2]!==0)return q_;return L_}l(OD,"detect_data_type");var V_=!1;function kD(t){V_||(SD(),V_=!0),t.l_desc=new zd(t.dyn_ltree,Q_),t.d_desc=new zd(t.dyn_dtree,ev),t.bl_desc=new zd(t.bl_tree,tv),t.bi_buf=0,t.bi_valid=0,sv(t)}l(kD,"_tr_init");function ov(t,e,r,i){Qe(t,(pD<<1)+(i?1:0),3),FD(t,e,r,!0)}l(ov,"_tr_stored_block");function xD(t){Qe(t,G_<<1,3),Qt(t,Xd,yr),vD(t)}l(xD,"_tr_align");function AD(t,e,r,i){var n,s,a=0;t.level>0?(t.strm.data_type===dD&&(t.strm.data_type=OD(t)),Gd(t,t.l_desc),Gd(t,t.d_desc),a=TD(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?ov(t,e,r,i):t.strategy===hD||s===n?(Qe(t,(G_<<1)+(i?1:0),3),W_(t,yr,Ra)):(Qe(t,(mD<<1)+(i?1:0),3),RD(t,t.l_desc.max_code+1,t.d_desc.max_code+1,a+1),W_(t,t.dyn_ltree,t.dyn_dtree)),sv(t),i&&av(t)}l(AD,"_tr_flush_block");function PD(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[(xa[r]+Pa+1)*2]++,t.dyn_dtree[rv(e)*2]++),t.last_lit===t.lit_bufsize-1}l(PD,"_tr_tally");Jn._tr_init=kD;Jn._tr_stored_block=ov;Jn._tr_flush_block=AD;Jn._tr_tally=PD;Jn._tr_align=xD});var Zd=T((bW,lv)=>{"use strict";function ND(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}l(ND,"adler32");lv.exports=ND});var Qd=T((vW,fv)=>{"use strict";function DD(){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(DD,"makeTable");var CD=DD();function ID(t,e,r,i){var n=CD,s=i+r;t^=-1;for(var a=i;a<s;a++)t=t>>>8^n[(t^e[a])&255];return t^-1}l(ID,"crc32");fv.exports=ID});var al=T((SW,uv)=>{"use strict";uv.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 _v=T(rr=>{"use strict";var Xe=wr(),St=cv(),mv=Zd(),Ir=Qd(),$D=al(),Ri=0,BD=1,MD=3,Lr=4,hv=5,tr=0,dv=1,Ft=-2,jD=-3,ep=-5,LD=-1,qD=1,ol=2,UD=3,WD=4,zD=0,HD=2,ul=8,VD=9,GD=15,KD=8,JD=29,XD=256,rp=XD+1+JD,YD=30,ZD=19,QD=2*rp+1,eC=15,X=3,Mr=258,Bt=Mr+X+1,tC=32,hl=42,ip=69,cl=73,ll=91,fl=103,Si=113,Da=666,Oe=1,Ca=2,Fi=3,Zn=4,rC=3;function jr(t,e){return t.msg=$D[e],e}l(jr,"err");function pv(t){return(t<<1)-(t>4?9:0)}l(pv,"rank");function Br(t){for(var e=t.length;--e>=0;)t[e]=0}l(Br,"zero");function $r(t){var e=t.state,r=e.pending;r>t.avail_out&&(r=t.avail_out),r!==0&&(Xe.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($r,"flush_pending");function Be(t,e){St._tr_flush_block(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,$r(t.strm)}l(Be,"flush_block_only");function re(t,e){t.pending_buf[t.pending++]=e}l(re,"put_byte");function Na(t,e){t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=e&255}l(Na,"putShortMSB");function iC(t,e,r,i){var n=t.avail_in;return n>i&&(n=i),n===0?0:(t.avail_in-=n,Xe.arraySet(e,t.input,t.next_in,n,r),t.state.wrap===1?t.adler=mv(t.adler,e,n,r):t.state.wrap===2&&(t.adler=Ir(t.adler,e,n,r)),t.next_in+=n,t.total_in+=n,n)}l(iC,"read_buf");function wv(t,e){var r=t.max_chain_length,i=t.strstart,n,s,a=t.prev_length,f=t.nice_match,o=t.strstart>t.w_size-Bt?t.strstart-(t.w_size-Bt):0,c=t.window,u=t.w_mask,h=t.prev,d=t.strstart+Mr,p=c[i+a-1],m=c[i+a];t.prev_length>=t.good_match&&(r>>=2),f>t.lookahead&&(f=t.lookahead);do if(n=e,!(c[n+a]!==m||c[n+a-1]!==p||c[n]!==c[i]||c[++n]!==c[i+1])){i+=2,n++;do;while(c[++i]===c[++n]&&c[++i]===c[++n]&&c[++i]===c[++n]&&c[++i]===c[++n]&&c[++i]===c[++n]&&c[++i]===c[++n]&&c[++i]===c[++n]&&c[++i]===c[++n]&&i<d);if(s=Mr-(d-i),i=d-Mr,s>a){if(t.match_start=e,a=s,s>=f)break;p=c[i+a-1],m=c[i+a]}}while((e=h[e&u])>o&&--r!==0);return a<=t.lookahead?a:t.lookahead}l(wv,"longest_match");function Ti(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-Bt)){Xe.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=iC(t.strm,t.window,t.strstart+t.lookahead,s),t.lookahead+=i,t.lookahead+t.insert>=X)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+X-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<X)););}while(t.lookahead<Bt&&t.strm.avail_in!==0)}l(Ti,"fill_window");function nC(t,e){var r=65535;for(r>t.pending_buf_size-5&&(r=t.pending_buf_size-5);;){if(t.lookahead<=1){if(Ti(t),t.lookahead===0&&e===Ri)return Oe;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,Be(t,!1),t.strm.avail_out===0)||t.strstart-t.block_start>=t.w_size-Bt&&(Be(t,!1),t.strm.avail_out===0))return Oe}return t.insert=0,e===Lr?(Be(t,!0),t.strm.avail_out===0?Fi:Zn):(t.strstart>t.block_start&&(Be(t,!1),t.strm.avail_out===0),Oe)}l(nC,"deflate_stored");function tp(t,e){for(var r,i;;){if(t.lookahead<Bt){if(Ti(t),t.lookahead<Bt&&e===Ri)return Oe;if(t.lookahead===0)break}if(r=0,t.lookahead>=X&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+X-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-Bt&&(t.match_length=wv(t,r)),t.match_length>=X)if(i=St._tr_tally(t,t.strstart-t.match_start,t.match_length-X),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=X){t.match_length--;do t.strstart++,t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+X-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=St._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++;if(i&&(Be(t,!1),t.strm.avail_out===0))return Oe}return t.insert=t.strstart<X-1?t.strstart:X-1,e===Lr?(Be(t,!0),t.strm.avail_out===0?Fi:Zn):t.last_lit&&(Be(t,!1),t.strm.avail_out===0)?Oe:Ca}l(tp,"deflate_fast");function Xn(t,e){for(var r,i,n;;){if(t.lookahead<Bt){if(Ti(t),t.lookahead<Bt&&e===Ri)return Oe;if(t.lookahead===0)break}if(r=0,t.lookahead>=X&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+X-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=X-1,r!==0&&t.prev_length<t.max_lazy_match&&t.strstart-r<=t.w_size-Bt&&(t.match_length=wv(t,r),t.match_length<=5&&(t.strategy===qD||t.match_length===X&&t.strstart-t.match_start>4096)&&(t.match_length=X-1)),t.prev_length>=X&&t.match_length<=t.prev_length){n=t.strstart+t.lookahead-X,i=St._tr_tally(t,t.strstart-1-t.prev_match,t.prev_length-X),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+X-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=X-1,t.strstart++,i&&(Be(t,!1),t.strm.avail_out===0))return Oe}else if(t.match_available){if(i=St._tr_tally(t,0,t.window[t.strstart-1]),i&&Be(t,!1),t.strstart++,t.lookahead--,t.strm.avail_out===0)return Oe}else t.match_available=1,t.strstart++,t.lookahead--}return t.match_available&&(i=St._tr_tally(t,0,t.window[t.strstart-1]),t.match_available=0),t.insert=t.strstart<X-1?t.strstart:X-1,e===Lr?(Be(t,!0),t.strm.avail_out===0?Fi:Zn):t.last_lit&&(Be(t,!1),t.strm.avail_out===0)?Oe:Ca}l(Xn,"deflate_slow");function sC(t,e){for(var r,i,n,s,a=t.window;;){if(t.lookahead<=Mr){if(Ti(t),t.lookahead<=Mr&&e===Ri)return Oe;if(t.lookahead===0)break}if(t.match_length=0,t.lookahead>=X&&t.strstart>0&&(n=t.strstart-1,i=a[n],i===a[++n]&&i===a[++n]&&i===a[++n])){s=t.strstart+Mr;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=Mr-(s-n),t.match_length>t.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=X?(r=St._tr_tally(t,1,t.match_length-X),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(r=St._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),r&&(Be(t,!1),t.strm.avail_out===0))return Oe}return t.insert=0,e===Lr?(Be(t,!0),t.strm.avail_out===0?Fi:Zn):t.last_lit&&(Be(t,!1),t.strm.avail_out===0)?Oe:Ca}l(sC,"deflate_rle");function aC(t,e){for(var r;;){if(t.lookahead===0&&(Ti(t),t.lookahead===0)){if(e===Ri)return Oe;break}if(t.match_length=0,r=St._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,r&&(Be(t,!1),t.strm.avail_out===0))return Oe}return t.insert=0,e===Lr?(Be(t,!0),t.strm.avail_out===0?Fi:Zn):t.last_lit&&(Be(t,!1),t.strm.avail_out===0)?Oe:Ca}l(aC,"deflate_huff");function er(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(er,"Config");var Yn;Yn=[new er(0,0,0,0,nC),new er(4,4,8,4,tp),new er(4,5,16,8,tp),new er(4,6,32,32,tp),new er(4,4,16,16,Xn),new er(8,16,32,32,Xn),new er(8,16,128,128,Xn),new er(8,32,128,256,Xn),new er(32,128,258,1024,Xn),new er(32,258,258,4096,Xn)];function oC(t){t.window_size=2*t.w_size,Br(t.head),t.max_lazy_match=Yn[t.level].max_lazy,t.good_match=Yn[t.level].good_length,t.nice_match=Yn[t.level].nice_length,t.max_chain_length=Yn[t.level].max_chain,t.strstart=0,t.block_start=0,t.lookahead=0,t.insert=0,t.match_length=t.prev_length=X-1,t.match_available=0,t.ins_h=0}l(oC,"lm_init");function cC(){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=ul,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 Xe.Buf16(QD*2),this.dyn_dtree=new Xe.Buf16((2*YD+1)*2),this.bl_tree=new Xe.Buf16((2*ZD+1)*2),Br(this.dyn_ltree),Br(this.dyn_dtree),Br(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Xe.Buf16(eC+1),this.heap=new Xe.Buf16(2*rp+1),Br(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Xe.Buf16(2*rp+1),Br(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(cC,"DeflateState");function yv(t){var e;return!t||!t.state?jr(t,Ft):(t.total_in=t.total_out=0,t.data_type=HD,e=t.state,e.pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=e.wrap?hl:Si,t.adler=e.wrap===2?0:1,e.last_flush=Ri,St._tr_init(e),tr)}l(yv,"deflateResetKeep");function gv(t){var e=yv(t);return e===tr&&oC(t.state),e}l(gv,"deflateReset");function lC(t,e){return!t||!t.state||t.state.wrap!==2?Ft:(t.state.gzhead=e,tr)}l(lC,"deflateSetHeader");function bv(t,e,r,i,n,s){if(!t)return Ft;var a=1;if(e===LD&&(e=6),i<0?(a=0,i=-i):i>15&&(a=2,i-=16),n<1||n>VD||r!==ul||i<8||i>15||e<0||e>9||s<0||s>WD)return jr(t,Ft);i===8&&(i=9);var f=new cC;return t.state=f,f.strm=t,f.wrap=a,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+X-1)/X),f.window=new Xe.Buf8(f.w_size*2),f.head=new Xe.Buf16(f.hash_size),f.prev=new Xe.Buf16(f.w_size),f.lit_bufsize=1<<n+6,f.pending_buf_size=f.lit_bufsize*4,f.pending_buf=new Xe.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,gv(t)}l(bv,"deflateInit2");function fC(t,e){return bv(t,e,ul,GD,KD,zD)}l(fC,"deflateInit");function uC(t,e){var r,i,n,s;if(!t||!t.state||e>hv||e<0)return t?jr(t,Ft):Ft;if(i=t.state,!t.output||!t.input&&t.avail_in!==0||i.status===Da&&e!==Lr)return jr(t,t.avail_out===0?ep:Ft);if(i.strm=t,r=i.last_flush,i.last_flush=e,i.status===hl)if(i.wrap===2)t.adler=0,re(i,31),re(i,139),re(i,8),i.gzhead?(re(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)),re(i,i.gzhead.time&255),re(i,i.gzhead.time>>8&255),re(i,i.gzhead.time>>16&255),re(i,i.gzhead.time>>24&255),re(i,i.level===9?2:i.strategy>=ol||i.level<2?4:0),re(i,i.gzhead.os&255),i.gzhead.extra&&i.gzhead.extra.length&&(re(i,i.gzhead.extra.length&255),re(i,i.gzhead.extra.length>>8&255)),i.gzhead.hcrc&&(t.adler=Ir(t.adler,i.pending_buf,i.pending,0)),i.gzindex=0,i.status=ip):(re(i,0),re(i,0),re(i,0),re(i,0),re(i,0),re(i,i.level===9?2:i.strategy>=ol||i.level<2?4:0),re(i,rC),i.status=Si);else{var a=ul+(i.w_bits-8<<4)<<8,f=-1;i.strategy>=ol||i.level<2?f=0:i.level<6?f=1:i.level===6?f=2:f=3,a|=f<<6,i.strstart!==0&&(a|=tC),a+=31-a%31,i.status=Si,Na(i,a),i.strstart!==0&&(Na(i,t.adler>>>16),Na(i,t.adler&65535)),t.adler=1}if(i.status===ip)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=Ir(t.adler,i.pending_buf,i.pending-n,n)),$r(t),n=i.pending,i.pending===i.pending_buf_size));)re(i,i.gzhead.extra[i.gzindex]&255),i.gzindex++;i.gzhead.hcrc&&i.pending>n&&(t.adler=Ir(t.adler,i.pending_buf,i.pending-n,n)),i.gzindex===i.gzhead.extra.length&&(i.gzindex=0,i.status=cl)}else i.status=cl;if(i.status===cl)if(i.gzhead.name){n=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>n&&(t.adler=Ir(t.adler,i.pending_buf,i.pending-n,n)),$r(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,re(i,s)}while(s!==0);i.gzhead.hcrc&&i.pending>n&&(t.adler=Ir(t.adler,i.pending_buf,i.pending-n,n)),s===0&&(i.gzindex=0,i.status=ll)}else i.status=ll;if(i.status===ll)if(i.gzhead.comment){n=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>n&&(t.adler=Ir(t.adler,i.pending_buf,i.pending-n,n)),$r(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,re(i,s)}while(s!==0);i.gzhead.hcrc&&i.pending>n&&(t.adler=Ir(t.adler,i.pending_buf,i.pending-n,n)),s===0&&(i.status=fl)}else i.status=fl;if(i.status===fl&&(i.gzhead.hcrc?(i.pending+2>i.pending_buf_size&&$r(t),i.pending+2<=i.pending_buf_size&&(re(i,t.adler&255),re(i,t.adler>>8&255),t.adler=0,i.status=Si)):i.status=Si),i.pending!==0){if($r(t),t.avail_out===0)return i.last_flush=-1,tr}else if(t.avail_in===0&&pv(e)<=pv(r)&&e!==Lr)return jr(t,ep);if(i.status===Da&&t.avail_in!==0)return jr(t,ep);if(t.avail_in!==0||i.lookahead!==0||e!==Ri&&i.status!==Da){var o=i.strategy===ol?aC(i,e):i.strategy===UD?sC(i,e):Yn[i.level].func(i,e);if((o===Fi||o===Zn)&&(i.status=Da),o===Oe||o===Fi)return t.avail_out===0&&(i.last_flush=-1),tr;if(o===Ca&&(e===BD?St._tr_align(i):e!==hv&&(St._tr_stored_block(i,0,0,!1),e===MD&&(Br(i.head),i.lookahead===0&&(i.strstart=0,i.block_start=0,i.insert=0))),$r(t),t.avail_out===0))return i.last_flush=-1,tr}return e!==Lr?tr:i.wrap<=0?dv:(i.wrap===2?(re(i,t.adler&255),re(i,t.adler>>8&255),re(i,t.adler>>16&255),re(i,t.adler>>24&255),re(i,t.total_in&255),re(i,t.total_in>>8&255),re(i,t.total_in>>16&255),re(i,t.total_in>>24&255)):(Na(i,t.adler>>>16),Na(i,t.adler&65535)),$r(t),i.wrap>0&&(i.wrap=-i.wrap),i.pending!==0?tr:dv)}l(uC,"deflate");function hC(t){var e;return!t||!t.state?Ft:(e=t.state.status,e!==hl&&e!==ip&&e!==cl&&e!==ll&&e!==fl&&e!==Si&&e!==Da?jr(t,Ft):(t.state=null,e===Si?jr(t,jD):tr))}l(hC,"deflateEnd");function dC(t,e){var r=e.length,i,n,s,a,f,o,c,u;if(!t||!t.state||(i=t.state,a=i.wrap,a===2||a===1&&i.status!==hl||i.lookahead))return Ft;for(a===1&&(t.adler=mv(t.adler,e,r,0)),i.wrap=0,r>=i.w_size&&(a===0&&(Br(i.head),i.strstart=0,i.block_start=0,i.insert=0),u=new Xe.Buf8(i.w_size),Xe.arraySet(u,e,r-i.w_size,i.w_size,0),e=u,r=i.w_size),f=t.avail_in,o=t.next_in,c=t.input,t.avail_in=r,t.next_in=0,t.input=e,Ti(i);i.lookahead>=X;){n=i.strstart,s=i.lookahead-(X-1);do i.ins_h=(i.ins_h<<i.hash_shift^i.window[n+X-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=X-1,Ti(i)}return i.strstart+=i.lookahead,i.block_start=i.strstart,i.insert=i.lookahead,i.lookahead=0,i.match_length=i.prev_length=X-1,i.match_available=0,t.next_in=o,t.input=c,t.avail_in=f,i.wrap=a,tr}l(dC,"deflateSetDictionary");rr.deflateInit=fC;rr.deflateInit2=bv;rr.deflateReset=gv;rr.deflateResetKeep=yv;rr.deflateSetHeader=lC;rr.deflate=uC;rr.deflateEnd=hC;rr.deflateSetDictionary=dC;rr.deflateInfo="pako deflate (from Nodeca project)"});var np=T(Qn=>{"use strict";var dl=wr(),vv=!0,Ev=!0;try{String.fromCharCode.apply(null,[0])}catch{vv=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{Ev=!1}var Ia=new dl.Buf8(256);for(gr=0;gr<256;gr++)Ia[gr]=gr>=252?6:gr>=248?5:gr>=240?4:gr>=224?3:gr>=192?2:1;var gr;Ia[254]=Ia[254]=1;Qn.string2buf=function(t){var e,r,i,n,s,a=t.length,f=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++)),f+=r<128?1:r<2048?2:r<65536?3:4;for(e=new dl.Buf8(f),s=0,n=0;s<f;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 Sv(t,e){if(e<65534&&(t.subarray&&Ev||!t.subarray&&vv))return String.fromCharCode.apply(null,dl.shrinkBuf(t,e));for(var r="",i=0;i<e;i++)r+=String.fromCharCode(t[i]);return r}l(Sv,"buf2binstring");Qn.buf2binstring=function(t){return Sv(t,t.length)};Qn.binstring2buf=function(t){for(var e=new dl.Buf8(t.length),r=0,i=e.length;r<i;r++)e[r]=t.charCodeAt(r);return e};Qn.buf2string=function(t,e){var r,i,n,s,a=e||t.length,f=new Array(a*2);for(i=0,r=0;r<a;){if(n=t[r++],n<128){f[i++]=n;continue}if(s=Ia[n],s>4){f[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){f[i++]=65533;continue}n<65536?f[i++]=n:(n-=65536,f[i++]=55296|n>>10&1023,f[i++]=56320|n&1023)}return Sv(f,i)};Qn.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+Ia[t[r]]>e?r:e}});var sp=T((kW,Fv)=>{"use strict";function pC(){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(pC,"ZStream");Fv.exports=pC});var kv=T(Ma=>{"use strict";var $a=_v(),Ba=wr(),op=np(),cp=al(),mC=sp(),Ov=Object.prototype.toString,wC=0,ap=4,es=0,Tv=1,Rv=2,yC=-1,gC=0,bC=8;function Oi(t){if(!(this instanceof Oi))return new Oi(t);this.options=Ba.assign({level:yC,method:bC,chunkSize:16384,windowBits:15,memLevel:8,strategy:gC,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 mC,this.strm.avail_out=0;var r=$a.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(r!==es)throw new Error(cp[r]);if(e.header&&$a.deflateSetHeader(this.strm,e.header),e.dictionary){var i;if(typeof e.dictionary=="string"?i=op.string2buf(e.dictionary):Ov.call(e.dictionary)==="[object ArrayBuffer]"?i=new Uint8Array(e.dictionary):i=e.dictionary,r=$a.deflateSetDictionary(this.strm,i),r!==es)throw new Error(cp[r]);this._dict_set=!0}}l(Oi,"Deflate");Oi.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?ap:wC,typeof t=="string"?r.input=op.string2buf(t):Ov.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 Ba.Buf8(i),r.next_out=0,r.avail_out=i),n=$a.deflate(r,s),n!==Tv&&n!==es)return this.onEnd(n),this.ended=!0,!1;(r.avail_out===0||r.avail_in===0&&(s===ap||s===Rv))&&(this.options.to==="string"?this.onData(op.buf2binstring(Ba.shrinkBuf(r.output,r.next_out))):this.onData(Ba.shrinkBuf(r.output,r.next_out)))}while((r.avail_in>0||r.avail_out===0)&&n!==Tv);return s===ap?(n=$a.deflateEnd(this.strm),this.onEnd(n),this.ended=!0,n===es):(s===Rv&&(this.onEnd(es),r.avail_out=0),!0)};Oi.prototype.onData=function(t){this.chunks.push(t)};Oi.prototype.onEnd=function(t){t===es&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=Ba.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};function lp(t,e){var r=new Oi(e);if(r.push(t,!0),r.err)throw r.msg||cp[r.err];return r.result}l(lp,"deflate");function _C(t,e){return e=e||{},e.raw=!0,lp(t,e)}l(_C,"deflateRaw");function vC(t,e){return e=e||{},e.gzip=!0,lp(t,e)}l(vC,"gzip");Ma.Deflate=Oi;Ma.deflate=lp;Ma.deflateRaw=_C;Ma.gzip=vC});var Av=T((NW,xv)=>{"use strict";var pl=30,EC=12;xv.exports=l(function(e,r){var i,n,s,a,f,o,c,u,h,d,p,m,w,y,g,_,F,R,k,D,v,O,E,N,x;i=e.state,n=e.next_in,N=e.input,s=n+(e.avail_in-5),a=e.next_out,x=e.output,f=a-(r-e.avail_out),o=a+(e.avail_out-257),c=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+=N[n++]<<w,w+=8,m+=N[n++]<<w,w+=8),R=y[m&_];t:for(;;){if(k=R>>>24,m>>>=k,w-=k,k=R>>>16&255,k===0)x[a++]=R&65535;else if(k&16){D=R&65535,k&=15,k&&(w<k&&(m+=N[n++]<<w,w+=8),D+=m&(1<<k)-1,m>>>=k,w-=k),w<15&&(m+=N[n++]<<w,w+=8,m+=N[n++]<<w,w+=8),R=g[m&F];r:for(;;){if(k=R>>>24,m>>>=k,w-=k,k=R>>>16&255,k&16){if(v=R&65535,k&=15,w<k&&(m+=N[n++]<<w,w+=8,w<k&&(m+=N[n++]<<w,w+=8)),v+=m&(1<<k)-1,v>c){e.msg="invalid distance too far back",i.mode=pl;break e}if(m>>>=k,w-=k,k=a-f,v>k){if(k=v-k,k>h&&i.sane){e.msg="invalid distance too far back",i.mode=pl;break e}if(O=0,E=p,d===0){if(O+=u-k,k<D){D-=k;do x[a++]=p[O++];while(--k);O=a-v,E=x}}else if(d<k){if(O+=u+d-k,k-=d,k<D){D-=k;do x[a++]=p[O++];while(--k);if(O=0,d<D){k=d,D-=k;do x[a++]=p[O++];while(--k);O=a-v,E=x}}}else if(O+=d-k,k<D){D-=k;do x[a++]=p[O++];while(--k);O=a-v,E=x}for(;D>2;)x[a++]=E[O++],x[a++]=E[O++],x[a++]=E[O++],D-=3;D&&(x[a++]=E[O++],D>1&&(x[a++]=E[O++]))}else{O=a-v;do x[a++]=x[O++],x[a++]=x[O++],x[a++]=x[O++],D-=3;while(D>2);D&&(x[a++]=x[O++],D>1&&(x[a++]=x[O++]))}}else if(k&64){e.msg="invalid distance code",i.mode=pl;break e}else{R=g[(R&65535)+(m&(1<<k)-1)];continue r}break}}else if(k&64)if(k&32){i.mode=EC;break e}else{e.msg="invalid literal/length code",i.mode=pl;break e}else{R=y[(R&65535)+(m&(1<<k)-1)];continue t}break}}while(n<s&&a<o);D=w>>3,n-=D,w-=D<<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<o?257+(o-a):257-(a-o),i.hold=m,i.bits=w},"inflate_fast")});var Bv=T((CW,$v)=>{"use strict";var Pv=wr(),ts=15,Nv=852,Dv=592,Cv=0,fp=1,Iv=2,SC=[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],FC=[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],TC=[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],RC=[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];$v.exports=l(function(e,r,i,n,s,a,f,o){var c=o.bits,u=0,h=0,d=0,p=0,m=0,w=0,y=0,g=0,_=0,F=0,R,k,D,v,O,E=null,N=0,x,I=new Pv.Buf16(ts+1),q=new Pv.Buf16(ts+1),z=null,be=0,Vt,yt,Dt;for(u=0;u<=ts;u++)I[u]=0;for(h=0;h<n;h++)I[r[i+h]]++;for(m=c,p=ts;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,o.bits=1,0;for(d=1;d<p&&I[d]===0;d++);for(m<d&&(m=d),g=1,u=1;u<=ts;u++)if(g<<=1,g-=I[u],g<0)return-1;if(g>0&&(e===Cv||p!==1))return-1;for(q[1]=0,u=1;u<ts;u++)q[u+1]=q[u]+I[u];for(h=0;h<n;h++)r[i+h]!==0&&(f[q[r[i+h]]++]=h);if(e===Cv?(E=z=f,x=19):e===fp?(E=SC,N-=257,z=FC,be-=257,x=256):(E=TC,z=RC,x=-1),F=0,h=0,u=d,O=a,w=m,y=0,D=-1,_=1<<m,v=_-1,e===fp&&_>Nv||e===Iv&&_>Dv)return 1;for(;;){Vt=u-y,f[h]<x?(yt=0,Dt=f[h]):f[h]>x?(yt=z[be+f[h]],Dt=E[N+f[h]]):(yt=96,Dt=0),R=1<<u-y,k=1<<w,d=k;do k-=R,s[O+(F>>y)+k]=Vt<<24|yt<<16|Dt|0;while(k!==0);for(R=1<<u-1;F&R;)R>>=1;if(R!==0?(F&=R-1,F+=R):F=0,h++,--I[u]===0){if(u===p)break;u=r[i+f[h]]}if(u>m&&(F&v)!==D){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===fp&&_>Nv||e===Iv&&_>Dv)return 1;D=F&v,s[D]=m<<24|w<<16|O-a|0}}return F!==0&&(s[O+F]=u-y<<24|64<<16|0),o.bits=m,0},"inflate_table")});var gE=T(Mt=>{"use strict";var ut=wr(),wp=Zd(),ir=Qd(),OC=Av(),ja=Bv(),kC=0,lE=1,fE=2,Mv=4,xC=5,ml=6,ki=0,AC=1,PC=2,Tt=-2,uE=-3,yp=-4,NC=-5,jv=8,hE=1,Lv=2,qv=3,Uv=4,Wv=5,zv=6,Hv=7,Vv=8,Gv=9,Kv=10,gl=11,br=12,up=13,Jv=14,hp=15,Xv=16,Yv=17,Zv=18,Qv=19,wl=20,yl=21,eE=22,tE=23,rE=24,iE=25,nE=26,dp=27,sE=28,aE=29,ue=30,gp=31,DC=32,CC=852,IC=592,$C=15,BC=$C;function oE(t){return(t>>>24&255)+(t>>>8&65280)+((t&65280)<<8)+((t&255)<<24)}l(oE,"zswap32");function MC(){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 ut.Buf16(320),this.work=new ut.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}l(MC,"InflateState");function dE(t){var e;return!t||!t.state?Tt:(e=t.state,t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=e.wrap&1),e.mode=hE,e.last=0,e.havedict=0,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new ut.Buf32(CC),e.distcode=e.distdyn=new ut.Buf32(IC),e.sane=1,e.back=-1,ki)}l(dE,"inflateResetKeep");function pE(t){var e;return!t||!t.state?Tt:(e=t.state,e.wsize=0,e.whave=0,e.wnext=0,dE(t))}l(pE,"inflateReset");function mE(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))?Tt:(i.window!==null&&i.wbits!==e&&(i.window=null),i.wrap=r,i.wbits=e,pE(t))}l(mE,"inflateReset2");function wE(t,e){var r,i;return t?(i=new MC,t.state=i,i.window=null,r=mE(t,e),r!==ki&&(t.state=null),r):Tt}l(wE,"inflateInit2");function jC(t){return wE(t,BC)}l(jC,"inflateInit");var cE=!0,pp,mp;function LC(t){if(cE){var e;for(pp=new ut.Buf32(512),mp=new ut.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(ja(lE,t.lens,0,288,pp,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;ja(fE,t.lens,0,32,mp,0,t.work,{bits:5}),cE=!1}t.lencode=pp,t.lenbits=9,t.distcode=mp,t.distbits=5}l(LC,"fixedtables");function yE(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 ut.Buf8(s.wsize)),i>=s.wsize?(ut.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),ut.arraySet(s.window,e,r-i,n,s.wnext),i-=n,i?(ut.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(yE,"updatewindow");function qC(t,e){var r,i,n,s,a,f,o,c,u,h,d,p,m,w,y=0,g,_,F,R,k,D,v,O,E=new ut.Buf8(4),N,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 Tt;r=t.state,r.mode===br&&(r.mode=up),a=t.next_out,n=t.output,o=t.avail_out,s=t.next_in,i=t.input,f=t.avail_in,c=r.hold,u=r.bits,h=f,d=o,O=ki;e:for(;;)switch(r.mode){case hE:if(r.wrap===0){r.mode=up;break}for(;u<16;){if(f===0)break e;f--,c+=i[s++]<<u,u+=8}if(r.wrap&2&&c===35615){r.check=0,E[0]=c&255,E[1]=c>>>8&255,r.check=ir(r.check,E,2,0),c=0,u=0,r.mode=Lv;break}if(r.flags=0,r.head&&(r.head.done=!1),!(r.wrap&1)||(((c&255)<<8)+(c>>8))%31){t.msg="incorrect header check",r.mode=ue;break}if((c&15)!==jv){t.msg="unknown compression method",r.mode=ue;break}if(c>>>=4,u-=4,v=(c&15)+8,r.wbits===0)r.wbits=v;else if(v>r.wbits){t.msg="invalid window size",r.mode=ue;break}r.dmax=1<<v,t.adler=r.check=1,r.mode=c&512?Kv:br,c=0,u=0;break;case Lv:for(;u<16;){if(f===0)break e;f--,c+=i[s++]<<u,u+=8}if(r.flags=c,(r.flags&255)!==jv){t.msg="unknown compression method",r.mode=ue;break}if(r.flags&57344){t.msg="unknown header flags set",r.mode=ue;break}r.head&&(r.head.text=c>>8&1),r.flags&512&&(E[0]=c&255,E[1]=c>>>8&255,r.check=ir(r.check,E,2,0)),c=0,u=0,r.mode=qv;case qv:for(;u<32;){if(f===0)break e;f--,c+=i[s++]<<u,u+=8}r.head&&(r.head.time=c),r.flags&512&&(E[0]=c&255,E[1]=c>>>8&255,E[2]=c>>>16&255,E[3]=c>>>24&255,r.check=ir(r.check,E,4,0)),c=0,u=0,r.mode=Uv;case Uv:for(;u<16;){if(f===0)break e;f--,c+=i[s++]<<u,u+=8}r.head&&(r.head.xflags=c&255,r.head.os=c>>8),r.flags&512&&(E[0]=c&255,E[1]=c>>>8&255,r.check=ir(r.check,E,2,0)),c=0,u=0,r.mode=Wv;case Wv:if(r.flags&1024){for(;u<16;){if(f===0)break e;f--,c+=i[s++]<<u,u+=8}r.length=c,r.head&&(r.head.extra_len=c),r.flags&512&&(E[0]=c&255,E[1]=c>>>8&255,r.check=ir(r.check,E,2,0)),c=0,u=0}else r.head&&(r.head.extra=null);r.mode=zv;case zv:if(r.flags&1024&&(p=r.length,p>f&&(p=f),p&&(r.head&&(v=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Array(r.head.extra_len)),ut.arraySet(r.head.extra,i,s,p,v)),r.flags&512&&(r.check=ir(r.check,i,p,s)),f-=p,s+=p,r.length-=p),r.length))break e;r.length=0,r.mode=Hv;case Hv:if(r.flags&2048){if(f===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<f);if(r.flags&512&&(r.check=ir(r.check,i,p,s)),f-=p,s+=p,v)break e}else r.head&&(r.head.name=null);r.length=0,r.mode=Vv;case Vv:if(r.flags&4096){if(f===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<f);if(r.flags&512&&(r.check=ir(r.check,i,p,s)),f-=p,s+=p,v)break e}else r.head&&(r.head.comment=null);r.mode=Gv;case Gv:if(r.flags&512){for(;u<16;){if(f===0)break e;f--,c+=i[s++]<<u,u+=8}if(c!==(r.check&65535)){t.msg="header crc mismatch",r.mode=ue;break}c=0,u=0}r.head&&(r.head.hcrc=r.flags>>9&1,r.head.done=!0),t.adler=r.check=0,r.mode=br;break;case Kv:for(;u<32;){if(f===0)break e;f--,c+=i[s++]<<u,u+=8}t.adler=r.check=oE(c),c=0,u=0,r.mode=gl;case gl:if(r.havedict===0)return t.next_out=a,t.avail_out=o,t.next_in=s,t.avail_in=f,r.hold=c,r.bits=u,PC;t.adler=r.check=1,r.mode=br;case br:if(e===xC||e===ml)break e;case up:if(r.last){c>>>=u&7,u-=u&7,r.mode=dp;break}for(;u<3;){if(f===0)break e;f--,c+=i[s++]<<u,u+=8}switch(r.last=c&1,c>>>=1,u-=1,c&3){case 0:r.mode=Jv;break;case 1:if(LC(r),r.mode=wl,e===ml){c>>>=2,u-=2;break e}break;case 2:r.mode=Yv;break;case 3:t.msg="invalid block type",r.mode=ue}c>>>=2,u-=2;break;case Jv:for(c>>>=u&7,u-=u&7;u<32;){if(f===0)break e;f--,c+=i[s++]<<u,u+=8}if((c&65535)!==(c>>>16^65535)){t.msg="invalid stored block lengths",r.mode=ue;break}if(r.length=c&65535,c=0,u=0,r.mode=hp,e===ml)break e;case hp:r.mode=Xv;case Xv:if(p=r.length,p){if(p>f&&(p=f),p>o&&(p=o),p===0)break e;ut.arraySet(n,i,s,p,a),f-=p,s+=p,o-=p,a+=p,r.length-=p;break}r.mode=br;break;case Yv:for(;u<14;){if(f===0)break e;f--,c+=i[s++]<<u,u+=8}if(r.nlen=(c&31)+257,c>>>=5,u-=5,r.ndist=(c&31)+1,c>>>=5,u-=5,r.ncode=(c&15)+4,c>>>=4,u-=4,r.nlen>286||r.ndist>30){t.msg="too many length or distance symbols",r.mode=ue;break}r.have=0,r.mode=Zv;case Zv:for(;r.have<r.ncode;){for(;u<3;){if(f===0)break e;f--,c+=i[s++]<<u,u+=8}r.lens[I[r.have++]]=c&7,c>>>=3,u-=3}for(;r.have<19;)r.lens[I[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,N={bits:r.lenbits},O=ja(kC,r.lens,0,19,r.lencode,0,r.work,N),r.lenbits=N.bits,O){t.msg="invalid code lengths set",r.mode=ue;break}r.have=0,r.mode=Qv;case Qv:for(;r.have<r.nlen+r.ndist;){for(;y=r.lencode[c&(1<<r.lenbits)-1],g=y>>>24,_=y>>>16&255,F=y&65535,!(g<=u);){if(f===0)break e;f--,c+=i[s++]<<u,u+=8}if(F<16)c>>>=g,u-=g,r.lens[r.have++]=F;else{if(F===16){for(x=g+2;u<x;){if(f===0)break e;f--,c+=i[s++]<<u,u+=8}if(c>>>=g,u-=g,r.have===0){t.msg="invalid bit length repeat",r.mode=ue;break}v=r.lens[r.have-1],p=3+(c&3),c>>>=2,u-=2}else if(F===17){for(x=g+3;u<x;){if(f===0)break e;f--,c+=i[s++]<<u,u+=8}c>>>=g,u-=g,v=0,p=3+(c&7),c>>>=3,u-=3}else{for(x=g+7;u<x;){if(f===0)break e;f--,c+=i[s++]<<u,u+=8}c>>>=g,u-=g,v=0,p=11+(c&127),c>>>=7,u-=7}if(r.have+p>r.nlen+r.ndist){t.msg="invalid bit length repeat",r.mode=ue;break}for(;p--;)r.lens[r.have++]=v}}if(r.mode===ue)break;if(r.lens[256]===0){t.msg="invalid code -- missing end-of-block",r.mode=ue;break}if(r.lenbits=9,N={bits:r.lenbits},O=ja(lE,r.lens,0,r.nlen,r.lencode,0,r.work,N),r.lenbits=N.bits,O){t.msg="invalid literal/lengths set",r.mode=ue;break}if(r.distbits=6,r.distcode=r.distdyn,N={bits:r.distbits},O=ja(fE,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,N),r.distbits=N.bits,O){t.msg="invalid distances set",r.mode=ue;break}if(r.mode=wl,e===ml)break e;case wl:r.mode=yl;case yl:if(f>=6&&o>=258){t.next_out=a,t.avail_out=o,t.next_in=s,t.avail_in=f,r.hold=c,r.bits=u,OC(t,d),a=t.next_out,n=t.output,o=t.avail_out,s=t.next_in,i=t.input,f=t.avail_in,c=r.hold,u=r.bits,r.mode===br&&(r.back=-1);break}for(r.back=0;y=r.lencode[c&(1<<r.lenbits)-1],g=y>>>24,_=y>>>16&255,F=y&65535,!(g<=u);){if(f===0)break e;f--,c+=i[s++]<<u,u+=8}if(_&&!(_&240)){for(R=g,k=_,D=F;y=r.lencode[D+((c&(1<<R+k)-1)>>R)],g=y>>>24,_=y>>>16&255,F=y&65535,!(R+g<=u);){if(f===0)break e;f--,c+=i[s++]<<u,u+=8}c>>>=R,u-=R,r.back+=R}if(c>>>=g,u-=g,r.back+=g,r.length=F,_===0){r.mode=nE;break}if(_&32){r.back=-1,r.mode=br;break}if(_&64){t.msg="invalid literal/length code",r.mode=ue;break}r.extra=_&15,r.mode=eE;case eE:if(r.extra){for(x=r.extra;u<x;){if(f===0)break e;f--,c+=i[s++]<<u,u+=8}r.length+=c&(1<<r.extra)-1,c>>>=r.extra,u-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=tE;case tE:for(;y=r.distcode[c&(1<<r.distbits)-1],g=y>>>24,_=y>>>16&255,F=y&65535,!(g<=u);){if(f===0)break e;f--,c+=i[s++]<<u,u+=8}if(!(_&240)){for(R=g,k=_,D=F;y=r.distcode[D+((c&(1<<R+k)-1)>>R)],g=y>>>24,_=y>>>16&255,F=y&65535,!(R+g<=u);){if(f===0)break e;f--,c+=i[s++]<<u,u+=8}c>>>=R,u-=R,r.back+=R}if(c>>>=g,u-=g,r.back+=g,_&64){t.msg="invalid distance code",r.mode=ue;break}r.offset=F,r.extra=_&15,r.mode=rE;case rE:if(r.extra){for(x=r.extra;u<x;){if(f===0)break e;f--,c+=i[s++]<<u,u+=8}r.offset+=c&(1<<r.extra)-1,c>>>=r.extra,u-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){t.msg="invalid distance too far back",r.mode=ue;break}r.mode=iE;case iE:if(o===0)break e;if(p=d-o,r.offset>p){if(p=r.offset-p,p>r.whave&&r.sane){t.msg="invalid distance too far back",r.mode=ue;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>o&&(p=o),o-=p,r.length-=p;do n[a++]=w[m++];while(--p);r.length===0&&(r.mode=yl);break;case nE:if(o===0)break e;n[a++]=r.length,o--,r.mode=yl;break;case dp:if(r.wrap){for(;u<32;){if(f===0)break e;f--,c|=i[s++]<<u,u+=8}if(d-=o,t.total_out+=d,r.total+=d,d&&(t.adler=r.check=r.flags?ir(r.check,n,d,a-d):wp(r.check,n,d,a-d)),d=o,(r.flags?c:oE(c))!==r.check){t.msg="incorrect data check",r.mode=ue;break}c=0,u=0}r.mode=sE;case sE:if(r.wrap&&r.flags){for(;u<32;){if(f===0)break e;f--,c+=i[s++]<<u,u+=8}if(c!==(r.total&4294967295)){t.msg="incorrect length check",r.mode=ue;break}c=0,u=0}r.mode=aE;case aE:O=AC;break e;case ue:O=uE;break e;case gp:return yp;case DC:default:return Tt}return t.next_out=a,t.avail_out=o,t.next_in=s,t.avail_in=f,r.hold=c,r.bits=u,(r.wsize||d!==t.avail_out&&r.mode<ue&&(r.mode<dp||e!==Mv))&&yE(t,t.output,t.next_out,d-t.avail_out)?(r.mode=gp,yp):(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?ir(r.check,n,d,t.next_out-d):wp(r.check,n,d,t.next_out-d)),t.data_type=r.bits+(r.last?64:0)+(r.mode===br?128:0)+(r.mode===wl||r.mode===hp?256:0),(h===0&&d===0||e===Mv)&&O===ki&&(O=NC),O)}l(qC,"inflate");function UC(t){if(!t||!t.state)return Tt;var e=t.state;return e.window&&(e.window=null),t.state=null,ki}l(UC,"inflateEnd");function WC(t,e){var r;return!t||!t.state||(r=t.state,!(r.wrap&2))?Tt:(r.head=e,e.done=!1,ki)}l(WC,"inflateGetHeader");function zC(t,e){var r=e.length,i,n,s;return!t||!t.state||(i=t.state,i.wrap!==0&&i.mode!==gl)?Tt:i.mode===gl&&(n=1,n=wp(n,e,r,0),n!==i.check)?uE:(s=yE(t,e,r,r),s?(i.mode=gp,yp):(i.havedict=1,ki))}l(zC,"inflateSetDictionary");Mt.inflateReset=pE;Mt.inflateReset2=mE;Mt.inflateResetKeep=dE;Mt.inflateInit=jC;Mt.inflateInit2=wE;Mt.inflate=qC;Mt.inflateEnd=UC;Mt.inflateGetHeader=WC;Mt.inflateSetDictionary=zC;Mt.inflateInfo="pako inflate (from Nodeca project)"});var bp=T((MW,bE)=>{"use strict";bE.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 vE=T((jW,_E)=>{"use strict";function HC(){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(HC,"GZheader");_E.exports=HC});var SE=T(qa=>{"use strict";var rs=gE(),La=wr(),bl=np(),ye=bp(),_p=al(),VC=sp(),GC=vE(),EE=Object.prototype.toString;function xi(t){if(!(this instanceof xi))return new xi(t);this.options=La.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 VC,this.strm.avail_out=0;var r=rs.inflateInit2(this.strm,e.windowBits);if(r!==ye.Z_OK)throw new Error(_p[r]);if(this.header=new GC,rs.inflateGetHeader(this.strm,this.header),e.dictionary&&(typeof e.dictionary=="string"?e.dictionary=bl.string2buf(e.dictionary):EE.call(e.dictionary)==="[object ArrayBuffer]"&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(r=rs.inflateSetDictionary(this.strm,e.dictionary),r!==ye.Z_OK)))throw new Error(_p[r])}l(xi,"Inflate");xi.prototype.push=function(t,e){var r=this.strm,i=this.options.chunkSize,n=this.options.dictionary,s,a,f,o,c,u=!1;if(this.ended)return!1;a=e===~~e?e:e===!0?ye.Z_FINISH:ye.Z_NO_FLUSH,typeof t=="string"?r.input=bl.binstring2buf(t):EE.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),s=rs.inflate(r,ye.Z_NO_FLUSH),s===ye.Z_NEED_DICT&&n&&(s=rs.inflateSetDictionary(this.strm,n)),s===ye.Z_BUF_ERROR&&u===!0&&(s=ye.Z_OK,u=!1),s!==ye.Z_STREAM_END&&s!==ye.Z_OK)return this.onEnd(s),this.ended=!0,!1;r.next_out&&(r.avail_out===0||s===ye.Z_STREAM_END||r.avail_in===0&&(a===ye.Z_FINISH||a===ye.Z_SYNC_FLUSH))&&(this.options.to==="string"?(f=bl.utf8border(r.output,r.next_out),o=r.next_out-f,c=bl.buf2string(r.output,f),r.next_out=o,r.avail_out=i-o,o&&La.arraySet(r.output,r.output,f,o,0),this.onData(c)):this.onData(La.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!==ye.Z_STREAM_END);return s===ye.Z_STREAM_END&&(a=ye.Z_FINISH),a===ye.Z_FINISH?(s=rs.inflateEnd(this.strm),this.onEnd(s),this.ended=!0,s===ye.Z_OK):(a===ye.Z_SYNC_FLUSH&&(this.onEnd(ye.Z_OK),r.avail_out=0),!0)};xi.prototype.onData=function(t){this.chunks.push(t)};xi.prototype.onEnd=function(t){t===ye.Z_OK&&(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 vp(t,e){var r=new xi(e);if(r.push(t,!0),r.err)throw r.msg||_p[r.err];return r.result}l(vp,"inflate");function KC(t,e){return e=e||{},e.raw=!0,vp(t,e)}l(KC,"inflateRaw");qa.Inflate=xi;qa.inflate=vp;qa.inflateRaw=KC;qa.ungzip=vp});var RE=T((WW,TE)=>{"use strict";var JC=wr().assign,XC=kv(),YC=SE(),ZC=bp(),FE={};JC(FE,XC,YC,ZC);TE.exports=FE});var xE=T((zW,kE)=>{"use strict";var OE=l((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,f)=>{a?s(a):n(f)}):r.push(n),t.apply(this,r)})},"processFn");kE.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 a=l(f=>typeof f=="string"?s===f:f.test(s),"match");return e.include?e.include.some(a):!e.exclude.some(a)},"filter"),n;r==="function"?n=l(function(...s){return e.excludeMain?t(...s):OE(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)?OE(a,e):a}return n}});var ME=T((VW,BE)=>{function AE(t){return Array.isArray(t)?t:[t]}l(AE,"makeArray");var Fp="",PE=" ",Ep="\\",QC=/^\s+$/,eI=/(?:[^\\]|^)\\$/,tI=/^\\!/,rI=/^\\#/,iI=/\r?\n/g,nI=/^\.*\/|^\.+$/,Sp="/",CE="node-ignore";typeof Symbol<"u"&&(CE=Symbol.for("node-ignore"));var NE=CE,sI=l((t,e,r)=>Object.defineProperty(t,e,{value:r}),"define"),aI=/([0-z])-([0-z])/g,IE=l(()=>!1,"RETURN_FALSE"),oI=l(t=>t.replace(aI,(e,r,i)=>r.charCodeAt(0)<=i.charCodeAt(0)?e:Fp),"sanitizeRange"),cI=l(t=>{let{length:e}=t;return t.slice(0,e-e%2)},"cleanRangeBackSlash"),lI=[[/^\uFEFF/,()=>Fp],[/((?:\\\\)*?)(\\?\s+)$/,(t,e,r)=>e+(r.indexOf("\\")===0?PE:Fp)],[/(\\+?)\s/g,(t,e)=>{let{length:r}=e;return e.slice(0,r-r%2)+PE}],[/[\\$.|*+(){^]/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,()=>Ep],[/\\\\/g,()=>Ep],[/(\\)?\[([^\]/]*?)(\\*)($|\])/g,(t,e,r,i,n)=>e===Ep?`\\[${r}${cI(i)}${n}`:n==="]"&&i.length%2===0?`[${oI(r)}${i}]`:"[]"],[/(?:[^*])$/,t=>/\/$/.test(t)?`${t}$`:`${t}(?=$|\\/$)`],[/(\^|\\\/)?\\\*$/,(t,e)=>`${e?`${e}[^/]+`:"[^/]*"}(?=$|\\/$)`]],DE=Object.create(null),fI=l((t,e)=>{let r=DE[t];return r||(r=lI.reduce((i,[n,s])=>i.replace(n,s.bind(t)),t),DE[t]=r),e?new RegExp(r,"i"):new RegExp(r)},"makeRegex"),Op=l(t=>typeof t=="string","isString"),uI=l(t=>t&&Op(t)&&!QC.test(t)&&!eI.test(t)&&t.indexOf("#")!==0,"checkPattern"),hI=l(t=>t.split(iI),"splitPattern"),kp=class kp{constructor(e,r,i,n){this.origin=e,this.pattern=r,this.negative=i,this.regex=n}};l(kp,"IgnoreRule");var Tp=kp,dI=l((t,e)=>{let r=t,i=!1;t.indexOf("!")===0&&(i=!0,t=t.substr(1)),t=t.replace(tI,"!").replace(rI,"#");let n=fI(t,e);return new Tp(r,t,i,n)},"createRule"),pI=l((t,e)=>{throw new e(t)},"throwError"),_r=l((t,e,r)=>Op(t)?t?_r.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"),$E=l(t=>nI.test(t),"isNotRelative");_r.isNotRelative=$E;_r.convert=t=>t;var xp=class xp{constructor({ignorecase:e=!0,ignoreCase:r=e,allowRelativePaths:i=!1}={}){sI(this,NE,!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[NE]){this._rules=this._rules.concat(e._rules),this._added=!0;return}if(uI(e)){let r=dI(e,this._ignoreCase);this._added=!0,this._rules.push(r)}}add(e){return this._added=!1,AE(Op(e)?hI(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&&_r.convert(e);return _r(s,e,this._allowRelativePaths?IE:pI),this._t(s,r,i,n)}_t(e,r,i,n){if(e in r)return r[e];if(n||(n=e.split(Sp)),n.pop(),!n.length)return r[e]=this._testOne(e,i);let s=this._t(n.join(Sp)+Sp,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 AE(e).filter(this.createFilter())}test(e){return this._test(e,this._testCache,!0)}};l(xp,"Ignore");var Rp=xp,_l=l(t=>new Rp(t),"factory"),mI=l(t=>_r(t&&_r.convert(t),t,IE),"isPathValid");_l.isPathValid=mI;_l.default=_l;BE.exports=_l;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");_r.convert=t;let e=/^[a-z]:\//i;_r.isNotRelative=r=>e.test(r)||$E(r)}});var LE=T((KW,jE)=>{"use strict";function wI(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}l(wI,"escapeRegExp");function nr(t,e,r){return e=e instanceof RegExp?e:new RegExp(wI(e),"g"),t.replace(e,r)}l(nr,"replaceAll");var yI={clean:l(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")};jE.exports=yI});var UE=T((XW,qE)=>{"use strict";var gI=/(^|[/.])([/.]|$)|^@$|@{|[\x00-\x20\x7f~^:?*[\\]|\.lock(\/|$)/;qE.exports=l(function(e,r){if(typeof e!="string")throw new TypeError("Reference name must be a string");return!gI.test(e)&&(!!r||e.includes("/"))},"validRef")});var zE=T((ZW,WE)=>{WE.exports=function(t,e){var r=t,i=e,n=r.length,s=i.length,a=!1,f=null,o=n+1,c=[],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,a=!0,o=n+1)},"init"),F=l(function(v,O,E){return{x:v,y:O,k:E}},"P"),R=l(function(v,O){return{elem:v,t:O}},"seselem"),k=l(function(v,O,E){var N,x,I;for(O>E?N=c[v-1+o]:N=c[v+1+o],I=Math.max(O,E),x=I-v;x<n&&I<s&&r[x]===i[I];)++x,++I;return c[v+o]=u.length,u[u.length]=new F(x,I,N),I},"snake"),D=l(function(v){var O,E,N,x,I;for(O=E=1,N=x=0,I=v.length-1;I>=0;--I)for(;N<v[I].x||x<v[I].y;)v[I].y-v[I].x>x-N?(a?h[h.length]=new R(i[x],p):h[h.length]=new R(i[x],w),++E,++x):v[I].y-v[I].x<x-N?(a?h[h.length]=new R(r[N],w):h[h.length]=new R(r[N],p),++O,++N):(h[h.length]=new R(r[N],m),d+=r[N],++O,++E,++N,++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 v,O,E,N,x,I,q,z;for(v=s-n,O=n+s+3,E={},q=0;q<O;++q)E[q]=-1,c[q]=-1;N=-1;do{for(++N,z=-N;z<=v-1;++z)E[z+o]=k(z,E[z-1+o]+1,E[z+1+o]);for(z=v+N;z>=v+1;--z)E[z+o]=k(z,E[z-1+o]+1,E[z+1+o]);E[v+o]=k(v,E[v-1+o]+1,E[v+1+o])}while(E[v+o]!==s);for(f=v+2*N,x=c[v+o],I=[];x!==-1;)I[I.length]=new F(u[x].x,u[x].y,null),x=u[x].k;D(I)},"compose")}}});var GE=T((ez,VE)=>{var bI=zE();function _I(t,e){var r=new bI(t,e);r.compose();for(var i=r.getses(),n,s,a=t.length-1,f=e.length-1,o=i.length-1;o>=0;--o)i[o].t===r.SES_COMMON?(s?(s.chain={file1index:a,file2index:f,chain:null},s=s.chain):(n={file1index:a,file2index:f,chain:null},s=n),a--,f--):i[o].t===r.SES_DELETE?a--:i[o].t===r.SES_ADD&&f--;var c={file1index:-1,file2index:-1,chain:null};return s?(s.chain=c,n):c}l(_I,"longestCommonSubsequence");function HE(t,e){for(var r=[],i=t.length,n=e.length,s=_I(t,e);s!==null;s=s.chain){var a=i-s.file1index-1,f=n-s.file2index-1;i=s.file1index,n=s.file2index,(a||f)&&r.push({file1:[i+1,a],file2:[n+1,f]})}return r.reverse(),r}l(HE,"diffIndices");function vI(t,e,r){var i,n=HE(e,t),s=HE(e,r),a=[];function f(q,z){a.push([q.file1[0],z,q.file1[1],q.file2[0],q.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);a.sort(function(q,z){return q[0]-z[0]});var o=[],c=0;function u(q){q>c&&(o.push([1,c,q-c]),c=q)}l(u,"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 y=a[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&&o.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 F=p[1],R=_[F],k=p[0],D=k+p[2],v=p[3],O=v+p[4];R[0]=Math.min(v,R[0]),R[1]=Math.max(O,R[1]),R[2]=Math.min(k,R[2]),R[3]=Math.max(D,R[3])}var E=_[0][0]+(m-_[0][2]),N=_[0][1]+(w-_[0][3]),x=_[2][0]+(m-_[2][2]),I=_[2][1]+(w-_[2][3]);o.push([-1,E,N-E,m,w-m,x,I-x])}c=w}return u(e.length),o}l(vI,"diff3MergeIndices");function EI(t,e,r){var i=[],n=[t,e,r],s=vI(t,e,r),a=[];function f(){a.length&&i.push({ok:a}),a=[]}l(f,"flushOk");function o(p){for(var m=0;m<p.length;m++)a.push(p[m])}l(o,"pushOk");function c(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(c,"isTrueConflict");for(var u=0;u<s.length;u++){var h=s[u],d=h[0];d==-1?c(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]}})):o(n[0].slice(h[1],h[1]+h[2])):o(n[d].slice(h[1],h[1]+h[2]))}return f(),i}l(EI,"diff3Merge");VE.exports=EI});var ke=T(B=>{"use strict";Object.defineProperty(B,"__esModule",{value:!0});function Sr(t){return t&&typeof t=="object"&&"default"in t?t.default:t}l(Sr,"_interopDefault");var za=Sr(_0()),wS=Sr(C_()),C=B_(),SI=Sr(j_()),tm=Sr(RE()),Ap=Sr(xE()),FI=Sr(ME()),Ha=Sr(LE()),Va=Sr(UE()),TI=Sr(GE()),Dl=class Dl 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 Dl(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(Dl,"BaseError");var Z=Dl,Cl=class Cl extends Z{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=Cl.code,this.data={filepaths:e}}};l(Cl,"UnmergedPathsError");var Ga=Cl;Ga.code="UnmergedPathsError";var Il=class Il extends Z{constructor(e){super(`An internal error caused this command to fail. Please file a bug report at https://github.com/isomorphic-git/isomorphic-git/issues with this error message: ${e}`),this.code=this.name=Il.code,this.data={message:e}}};l(Il,"InternalError");var W=Il;W.code="InternalError";var $l=class $l extends Z{constructor(e){super(`The filepath "${e}" contains unsafe character sequences`),this.code=this.name=$l.code,this.data={filepath:e}}};l($l,"UnsafeFilepathError");var as=$l;as.code="UnsafeFilepathError";var cm=class cm{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}};l(cm,"BufferCursor");var Rt=cm;function bf(t,e){return-(t<e)||+(t>e)}l(bf,"compareStrings");function yS(t,e){return bf(t.path,e.path)}l(yS,"comparePath");function gS(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}l(gS,"normalizeMode");var sr=2**32;function KE(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]}l(KE,"SecondsNanoseconds");function os(t){let[e,r]=KE(t.ctimeSeconds,t.ctimeNanoseconds,t.ctimeMs,t.ctime),[i,n]=KE(t.mtimeSeconds,t.mtimeNanoseconds,t.mtimeMs,t.mtime);return{ctimeSeconds:e%sr,ctimeNanoseconds:r%sr,mtimeSeconds:i%sr,mtimeNanoseconds:n%sr,dev:t.dev%sr,ino:t.ino%sr,mode:gS(t.mode%sr),uid:t.uid%sr,gid:t.gid%sr,size:t.size>-1?t.size%sr:0}}l(os,"normalizeStats");function RI(t){let e="";for(let r of new Uint8Array(t))r<16&&(e+="0"),e+=r.toString(16);return e}l(RI,"toHex");var Pp=null;async function Er(t){return Pp===null&&(Pp=await kI()),Pp?bS(t):OI(t)}l(Er,"shasum");function OI(t){return new wS().update(t).digest("hex")}l(OI,"shasumSync");async function bS(t){let e=await crypto.subtle.digest("SHA-1",t);return RI(e)}l(bS,"subtleSHA1");async function kI(){try{return await bS(new Uint8Array([]))==="da39a3ee5e6b4b0d3255bfef95601890afd80709"}catch{}return!1}l(kI,"testSubtleSHA1");function xI(t){return{assumeValid:!!(t&32768),extended:!!(t&16384),stage:(t&12288)>>12,nameLength:t&4095}}l(xI,"parseCacheEntryFlags");function AI(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)}l(AI,"renderCacheEntryFlags");var Ur=class Ur{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 Ur.fromBuffer(e);if(e===null)return new Ur(null);throw new W("invalid type passed to GitIndex.from")}static async fromBuffer(e){if(e.length===0)throw new W("Index file is empty (.git/index)");let r=new Ur,i=new Rt(e),n=i.toString("utf8",4);if(n!=="DIRC")throw new W(`Invalid dircache magic file number: ${n}`);let s=await Er(e.slice(0,-20)),a=e.slice(-20).toString("hex");if(a!==s)throw new W(`Invalid checksum in GitIndex buffer: expected ${a} but saw ${s}`);let f=i.readUInt32BE();if(f!==2)throw new W(`Unsupported dircache version: ${f}`);let o=i.readUInt32BE(),c=0;for(;!i.eof()&&c<o;){let u={};u.ctimeSeconds=i.readUInt32BE(),u.ctimeNanoseconds=i.readUInt32BE(),u.mtimeSeconds=i.readUInt32BE(),u.mtimeNanoseconds=i.readUInt32BE(),u.dev=i.readUInt32BE(),u.ino=i.readUInt32BE(),u.mode=i.readUInt32BE(),u.uid=i.readUInt32BE(),u.gid=i.readUInt32BE(),u.size=i.readUInt32BE(),u.oid=i.slice(20).toString("hex");let h=i.readUInt16BE();u.flags=xI(h);let d=e.indexOf(0,i.tell()+1)-i.tell();if(d<1)throw new W(`Got a path length of: ${d}`);if(u.path=i.toString("utf8",d),u.path.includes("..\\")||u.path.includes("../"))throw new as(u.path);let p=8-(i.tell()-12)%8;for(p===0&&(p=8);p--;){let m=i.readUInt8();if(m!==0)throw new W(`Expected 1-8 null characters but got '${m}' after ${u.path}`);if(i.eof())throw new W("Unexpected end of file")}u.stages=[],r._addEntry(u),c++}return r}get unmergedPaths(){return[...this._unmergedPaths]}get entries(){return[...this._entries.values()].sort(yS)}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=os(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(`
10
- `)}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 Rt(n),a=os(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(AI(e)),s.write(e.path,r.length,"utf8"),n}async toObject(){let e=Buffer.alloc(12),r=new Rt(e);r.write("DIRC",4,"utf8"),r.writeUInt32BE(2),r.writeUInt32BE(this.entriesFlat.length);let i=[];for(let f of this.entries)if(i.push(Ur._entryToBuffer(f)),f.stages.length>1)for(let o of f.stages)o&&o!==f&&i.push(Ur._entryToBuffer(o));i=await Promise.all(i);let n=Buffer.concat(i),s=Buffer.concat([e,n]),a=await Er(s);return Buffer.concat([s,Buffer.from(a,"hex")])}};l(Ur,"GitIndex");var Wp=Ur;function Sl(t,e,r=!0,i=!0){let n=os(t),s=os(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}l(Sl,"compareStats");var Np=null,Dp=Symbol("IndexCache");function PI(){return{map:new Map,stats:new Map}}l(PI,"createCache");async function NI(t,e,r){let[i,n]=await Promise.all([t.lstat(e),t.read(e)]),s=await Wp.from(n);r.map.set(e,s),r.stats.set(e,i)}l(NI,"updateCachedIndexFile");async function DI(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:Sl(i,n)}l(DI,"isIndexStale");var lm=class lm{static async acquire({fs:e,gitdir:r,cache:i,allowUnmerged:n=!0},s){i[Dp]||(i[Dp]=PI());let a=`${r}/index`;Np===null&&(Np=new za({maxPending:1/0}));let f,o=[];return await Np.acquire(a,async()=>{let c=i[Dp];await DI(e,a,c)&&await NI(e,a,c);let u=c.map.get(a);if(o=u.unmergedPaths,o.length&&!n)throw new Ga(o);if(f=await s(u),u._dirty){let h=await u.toObject();await e.write(a,h),c.stats.set(a,await e.lstat(a)),u._dirty=!1}}),f}};l(lm,"GitIndexManager");var ge=lm;function Fl(t){let e=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\"));return e>-1&&(t=t.slice(e+1)),t}l(Fl,"basename");function cs(t){let e=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\"));return e===-1?".":e===0?"/":t.slice(0,e)}l(cs,"dirname");function _S(t){let e=new Map,r=l(function(n){if(!e.has(n)){let s={type:"tree",fullpath:n,basename:Fl(n),metadata:{},children:[]};e.set(n,s),s.parent=r(cs(n)),s.parent&&s.parent!==s&&s.parent.children.push(s)}return e.get(n)},"mkdir"),i=l(function(n,s){if(!e.has(n)){let a={type:"blob",fullpath:n,basename:Fl(n),metadata:s,parent:r(cs(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}l(_S,"flatFileListToDirectoryStructure");function CI(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 W(`Unexpected GitTree entry mode: ${t.toString(8)}`)}l(CI,"mode2type");var fm=class fm{constructor({fs:e,gitdir:r,cache:i}){var s;this.treePromise=ge.acquire({fs:e,gitdir:r,cache:i},async function(a){return _S(a.entries)});let n=this;this.ConstructEntry=(s=class{constructor(f){this._fullpath=f,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)}},l(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(bf),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"?{}:os(i.metadata);e._type=i.type==="tree"?"tree":CI(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}};l(fm,"GitWalkerIndex");var zp=fm,_f=Symbol("GitWalkSymbol");function Ii(){let t=Object.create(null);return Object.defineProperty(t,_f,{value:l(function({fs:e,gitdir:r,cache:i}){return new zp({fs:e,gitdir:r,cache:i})},"value")}),Object.freeze(t),t}l(Ii,"STAGE");var Bl=class Bl extends Z{constructor(e){super(`Could not find ${e}.`),this.code=this.name=Bl.code,this.data={what:e}}};l(Bl,"NotFoundError");var oe=Bl;oe.code="NotFoundError";var Ml=class Ml extends Z{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=Ml.code,this.data={oid:e,actual:r,expected:i,filepath:n}}};l(Ml,"ObjectTypeError");var Ye=Ml;Ye.code="ObjectTypeError";var jl=class jl extends Z{constructor(e){super(`Expected a 40-char hex object id but saw "${e}".`),this.code=this.name=jl.code,this.data={value:e}}};l(jl,"InvalidOidError");var zr=jl;zr.code="InvalidOidError";var Ll=class Ll extends Z{constructor(e){super(`Could not find a fetch refspec for remote "${e}". Make sure the config file has an entry like the following:
9
+ `+t),"printJson");Dl.printJson=hC});var vp=T(ua=>{"use strict";Object.defineProperty(ua,"__esModule",{value:!0});var Sp=(nl(),Od(il));Sp.__exportStar(S_(),ua);Sp.__exportStar(v_(),ua);Sp.__exportStar(E_(),ua)});var F_=T(Xe=>{"use strict";Object.defineProperty(Xe,"__esModule",{value:!0});Xe.newNotAllowedError=Xe.newTypeMismatchError=Xe.newNotFoundError=Xe.assertCanWrite=Xe.assertName=Xe.basename=Xe.ctx=void 0;var dC=l((t={})=>({separator:"/",syncHandleAllowed:!1,mode:"read",...t}),"ctx");Xe.ctx=dC;var pC=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");Xe.basename=pC;var mC=/^(\.{1,2})$|^(.*([\/\\]).*)$/,wC=l((t,e,r)=>{if(!t||mC.test(t))throw new TypeError(`Failed to execute '${e}' on '${r}': Name is not allowed.`)},"assertName");Xe.assertName=wC;var yC=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");Xe.assertCanWrite=yC;var gC=l(()=>new DOMException("A requested file or directory could not be found at the time an operation was processed.","NotFoundError"),"newNotFoundError");Xe.newNotFoundError=gC;var bC=l(()=>new DOMException("The path supplied exists, but was not an entry of requested type.","TypeMismatchError"),"newTypeMismatchError");Xe.newTypeMismatchError=bC;var _C=l(()=>new DOMException("Permission not granted.","NotAllowedError"),"newNotAllowedError");Xe.newNotAllowedError=_C});var T_=T(ha=>{"use strict";Object.defineProperty(ha,"__esModule",{value:!0});ha.toTreeSync=void 0;var SC=vp(),vC=F_(),EC=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,SC.printTree)(n,c.map(a=>u=>a.isDirectory()?(0,ha.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,vC.basename)(i,r)+r+o},"toTreeSync");ha.toTreeSync=EC});var O_=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=R_;j.optsGenerator=xr;j.optsAndCbGenerator=Ii;var Cl=ls(),FC=sa(),Ep=Zr(),k_={mode:511,recursive:!1},TC=l(t=>typeof t=="number"?Object.assign({},k_,{mode:t}):Object.assign({},k_,t),"getMkdirOptions");j.getMkdirOptions=TC;var kC=l(t=>`Expected options to be either an object or a string, but got ${t} instead`,"ERRSTR_OPTS");function R_(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(kC(i))}}else return t;return r.encoding!=="buffer"&&(0,FC.assertEncoding)(r.encoding),r}l(R_,"getOptions");function xr(t){return e=>R_(t,e)}l(xr,"optsGenerator");function Ii(t){return(e,r)=>typeof e=="function"?[t(),e]:[t(e),(0,Ep.validateCallback)(r)]}l(Ii,"optsAndCbGenerator");j.optsDefaults={encoding:"utf8"};j.getDefaultOpts=xr(j.optsDefaults);j.getDefaultOptsAndCb=Ii(j.getDefaultOpts);var RC={recursive:!1},OC=l(t=>Object.assign({},RC,t),"getRmdirOptions");j.getRmdirOptions=OC;var xC=xr(j.optsDefaults);j.getRmOptsAndCb=Ii(xC);var AC={flag:"r"};j.getReadFileOptions=xr(AC);var PC={encoding:"utf8",recursive:!1,withFileTypes:!1};j.getReaddirOptions=xr(PC);j.getReaddirOptsAndCb=Ii(j.getReaddirOptions);var NC={encoding:"utf8",bufferSize:32,recursive:!1};j.getOpendirOptions=xr(NC);j.getOpendirOptsAndCb=Ii(j.getOpendirOptions);var DC={encoding:"utf8",mode:438,flag:Cl.FLAGS[Cl.FLAGS.a]};j.getAppendFileOpts=xr(DC);j.getAppendFileOptsAndCb=Ii(j.getAppendFileOpts);var CC={bigint:!1},IC=l((t={})=>Object.assign({},CC,t),"getStatOptions");j.getStatOptions=IC;var $C=l((t,e)=>typeof t=="function"?[(0,j.getStatOptions)(),t]:[(0,j.getStatOptions)(t),(0,Ep.validateCallback)(e)],"getStatOptsAndCb");j.getStatOptsAndCb=$C;var BC={bigint:!1},MC=l((t={})=>Object.assign({},BC,t),"getStatfsOptions");j.getStatfsOptions=MC;var LC=l((t,e)=>typeof t=="function"?[(0,j.getStatfsOptions)(),t]:[(0,j.getStatfsOptions)(t),(0,Ep.validateCallback)(e)],"getStatfsOptsAndCb");j.getStatfsOptsAndCb=LC;var jC=j.optsDefaults;j.getRealpathOptions=xr(jC);j.getRealpathOptsAndCb=Ii(j.getRealpathOptions);j.writeFileDefaults={encoding:"utf8",mode:438,flag:Cl.FLAGS[Cl.FLAGS.w]};j.getWriteFileOptions=xr(j.writeFileDefaults)});var A_=T(Il=>{"use strict";Object.defineProperty(Il,"__esModule",{value:!0});Il.Dir=void 0;var x_=Zr(),qC=Qc(),$i=na(),Tp=class Tp{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]()),qC.default.build(s,this.options.encoding)}while(!r);return null}close(e){if(e===void 0)return this.closed?Promise.reject(new $i.Error("ERR_DIR_CLOSED")):new Promise((r,i)=>{this.close(n=>{n?i(n):r()})});if((0,x_.validateCallback)(e),this.closed){process.nextTick(e,new $i.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 $i.Error("ERR_DIR_CLOSED");if(this.operationQueue!==null)throw new $i.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,x_.validateCallback)(e),this.closed){process.nextTick(e,new $i.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 $i.Error("ERR_DIR_CLOSED");if(this.operationQueue!==null)throw new $i.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(Tp,"Dir");var Fp=Tp;Il.Dir=Fp});var kp=T(Ar=>{"use strict";Object.defineProperty(Ar,"__esModule",{value:!0});Ar.toMatcher=Ar.toRegex=void 0;var UC=l(t=>/[.^$+{}()|\\]/.test(t)?`\\${t}`:t,"escapeRe"),WC=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,Ar.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"),zC=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,Ar.toRegex)(h,e).source.replace(/^\^/,"").replace(/\$$/,"")).join("|")})`:"\\{"+UC(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=WC(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");Ar.toRegex=zC;var HC=/^\/(.{1,4096})\/([gimsuy]{0,6})$/,VC=l((t,e)=>{let r=[],i=Array.isArray(t)?t:[t];for(let n of i)if(typeof n=="string"){let s=HC.exec(n);if(s){let[,o,f]=s;r.push(new RegExp(o,f))}else r.push((0,Ar.toRegex)(n,e))}else r.push(n);return r.length?new Function("p","return "+r.map(n=>n+".test(p)").join("||")):()=>!1},"toMatcher");Ar.toMatcher=VC});var D_=T(Op=>{"use strict";Object.defineProperty(Op,"__esModule",{value:!0});Op.globSync=ZC;var Bi=ss(),GC=kp(),P_=Zr(),JC=Bi.posix.join,KC=Bi.posix.relative,XC=Bi.posix.resolve;function N_(t,e){return(0,GC.toRegex)(e).test(t)}l(N_,"matchesPattern");function YC(t,e){return e?typeof e=="function"?e(t):(Array.isArray(e)?e:[e]).some(i=>N_(t,i)):!1}l(YC,"isExcluded");function Rp(t,e,r,i,n=0){let s=[],o=i.maxdepth??1/0,f=i.cwd?(0,P_.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=JC(e,a.name.toString()),h=KC(f,u);if(YC(h,i.exclude))continue;if(r.some(p=>N_(h,p))&&s.push(h),a.isDirectory()&&n<o){let p=Rp(t,u,r,i,n+1);s.push(...p)}}}catch{}return s}l(Rp,"walkDirectory");function ZC(t,e,r={}){let i=r.cwd?(0,P_.pathToFilename)(r.cwd):process.cwd(),n=XC(i),s={cwd:n,exclude:r.exclude,maxdepth:r.maxdepth,withFileTypes:r.withFileTypes||!1},o=[];if(Bi.posix.isAbsolute(e)){let f=Bi.posix.dirname(e),c=Bi.posix.basename(e),a=Rp(t,f,[c],{...s,cwd:f});o.push(...a.map(u=>Bi.posix.resolve(f,u)))}else{let f=Rp(t,n,[e],s);o.push(...f)}return o=[...new Set(o)].sort(),o}l(ZC,"globSync")});var j_=T(bt=>{"use strict";Object.defineProperty(bt,"__esModule",{value:!0});bt.FSWatcher=bt.StatWatcher=bt.Volume=void 0;bt.pathToSteps=mI;bt.dataToStr=wI;bt.toUnixTimestamp=gt;var Re=ss(),Np=p_(),xp=Md(),QC=Qc(),eI=m_(),ms=Kr(),jl=cp(),tI=w_(),ql=g_(),rI=Vt(),B_=pp(),Mi=sa(),iI=b_(),M_=jd(),nI=__(),sI=T_(),Bl=ls(),oI=na(),Q=O_(),P=Zr(),aI=A_(),We=Sl(),cI=Re.resolve,{O_SYMLINK:C_,F_OK:Ap,R_OK:lI,W_OK:fI,X_OK:uI,COPYFILE_EXCL:hI,COPYFILE_FICLONE_FORCE:dI}=rI.constants,g9=Re.posix?Re.posix.sep:Re.sep,$l=Re.posix?Re.posix.relative:Re.relative,Pp=Re.posix?Re.posix.join:Re.join,I_=Re.posix?Re.posix.dirname:Re.dirname,$_=Re.posix?Re.posix.normalize:Re.normalize,pI=128;function mI(t){return(0,We.filenameToSteps)((0,P.pathToFilename)(t))}l(mI,"pathToSteps");function wI(t,e=Mi.ENCODING_UTF8){return ms.Buffer.isBuffer(t)?t.toString(e):t instanceof Uint8Array?(0,ms.bufferFrom)(t).toString(e):String(t)}l(wI,"dataToStr");function gt(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(gt,"toUnixTimestamp");function ds(t){if(typeof t!="number")throw TypeError(Bl.ERRSTR.UID)}l(ds,"validateUid");function ps(t){if(typeof t!="number")throw TypeError(Bl.ERRSTR.GID)}l(ps,"validateGid");var Dp=class Dp{get promises(){if(this.promisesApi===null)throw new Error("Promise is not supported in this environment.");return this.promisesApi}constructor(e=new Np.Superblock){this._core=e,this.promisesApi=new nI.FsPromises(this,iI.FileHandle),this.openSync=(c,a,u=438)=>{let h=(0,P.modeToNumber)(u),d=(0,P.pathToFilename)(c),p=(0,P.flagsToNumber)(a);return this._core.open(d,p,h,!(p&C_))},this.open=(c,a,u,h)=>{let d=u,p=h;typeof u=="function"&&(d=438,p=u),d=d||438;let m=(0,P.modeToNumber)(d),w=(0,P.pathToFilename)(c),y=(0,P.flagsToNumber)(a);this.wrapAsync(this._core.open,[w,y,m,!(y&C_)],p)},this.closeSync=c=>{this._core.close(c)},this.close=(c,a)=>{(0,We.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,We.validateFd)(c),this._core.read(c,a,u,h,d)),this.read=(c,a,u,h,d,p)=>{if((0,P.validateCallback)(p),h===0)return(0,jl.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,P.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,We.validateFd)(c),this._core.readv(c,a,u??null)),this._readfile=(c,a,u)=>{let h,p=typeof c=="number"&&(0,We.isFd)(c),m;if(p)m=c;else{let w=(0,P.pathToFilename)(c),y=String(c),b=y.length>1&&y.endsWith("/"),_=this._core.getResolvedLinkOrThrow(w,"open"),F=_.getNode();if(F.isDirectory())throw(0,P.createError)("EISDIR","open",_.getPath());if(b&&F.isFile())throw(0,P.createError)("ENOTDIR","open",y);m=this.openSync(c,a)}try{h=(0,P.bufferToEncoding)(this._core.getFileByFdOrThrow(m).getBuffer(),u)}finally{p||this.closeSync(m)}return h},this.readFileSync=(c,a)=>{let u=(0,Q.getReadFileOptions)(a),h=(0,P.flagsToNumber)(u.flag);return this._readfile(c,h,u.encoding)},this.readFile=(c,a,u)=>{let[h,d]=(0,Q.optsAndCbGenerator)(Q.getReadFileOptions)(a,u),p=(0,P.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,P.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,b,_,F]=(0,P.getWriteArgs)(c,a,u,h,d,p);Promise.resolve().then(()=>{try{let E=this._write(c,w,y,b,_);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,P.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,We.validateFd)(c),this.writevBase(c,a,u??null)),this.writeFileSync=(c,a,u)=>{let h=(0,Q.getWriteFileOptions)(u),d=(0,P.flagsToNumber)(h.flag),p=(0,P.modeToNumber)(h.mode),m=(0,We.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]=[Q.writeFileDefaults,u]);let m=(0,P.validateCallback)(p),w=(0,Q.getWriteFileOptions)(d),y=(0,P.flagsToNumber)(w.flag),b=(0,P.modeToNumber)(w.mode),_=(0,We.dataToBuffer)(a,w.encoding);this.wrapAsync(this._core.writeFile,[c,_,y,b],m)},this.copyFileSync=(c,a,u)=>{let h=(0,P.pathToFilename)(c),d=(0,P.pathToFilename)(a);return this._copyFile(h,d,(u||0)|0)},this.copyFile=(c,a,u,h)=>{let d=(0,P.pathToFilename)(c),p=(0,P.pathToFilename)(a),m,w;typeof u=="function"?[m,w]=[0,u]:[m,w]=[u,h],(0,P.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,P.createError)("EINVAL","cp",c,a);if(d){if(h.isDirectory()&&!d.isDirectory())throw(0,P.createError)("EISDIR","cp",c,a);if(!h.isDirectory()&&d.isDirectory())throw(0,P.createError)("ENOTDIR","cp",c,a)}if(h.isDirectory()&&this.isSrcSubdir(c,a))throw(0,P.createError)("EINVAL","cp",c,a);{let p=I_(a);this.existsSync(p)||this.mkdirSync(p,{recursive:!0})}if(h.isDirectory()){if(!u.recursive)throw(0,P.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,P.createError)("EINVAL","cp",c)},this.linkSync=(c,a)=>{let u=(0,P.pathToFilename)(c),h=(0,P.pathToFilename)(a);this._core.link(u,h)},this.link=(c,a,u)=>{let h=(0,P.pathToFilename)(c),d=(0,P.pathToFilename)(a);this.wrapAsync(this._core.link,[h,d],u)},this.unlinkSync=c=>{let a=(0,P.pathToFilename)(c);this._core.unlink(a)},this.unlink=(c,a)=>{let u=(0,P.pathToFilename)(c);this.wrapAsync(this._core.unlink,[u],a)},this.symlinkSync=(c,a,u)=>{let h=(0,P.pathToFilename)(c),d=(0,P.pathToFilename)(a);this._core.symlink(h,d)},this.symlink=(c,a,u,h)=>{let d=(0,P.validateCallback)(typeof u=="function"?u:h),p=(0,P.pathToFilename)(c),m=(0,P.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 xp.default.build(h.getNode(),a)},this.lstatSync=(c,a)=>{let{throwIfNoEntry:u=!0,bigint:h=!1}=(0,Q.getStatOptions)(a);return this._lstat((0,P.pathToFilename)(c),h,u)},this.renameSync=(c,a)=>{let u=(0,P.pathToFilename)(c),h=(0,P.pathToFilename)(a);this._core.rename(u,h)},this.rename=(c,a,u)=>{let h=(0,P.pathToFilename)(c),d=(0,P.pathToFilename)(a);this.wrapAsync(this._core.rename,[h,d],u)},this.existsSync=c=>{try{return this._exists((0,P.pathToFilename)(c))}catch{return!1}},this.exists=(c,a)=>{let u=(0,P.pathToFilename)(c);if(typeof a!="function")throw Error(Bl.ERRSTR.CB);Promise.resolve().then(()=>{try{a(this._exists(u))}catch{a(!1)}})},this.accessSync=(c,a=Ap)=>{let u=(0,P.pathToFilename)(c);a=a|0,this._access(u,a)},this.access=(c,a,u)=>{let h=Ap,d;typeof a!="function"?[h,d]=[a|0,(0,P.validateCallback)(u)]:d=a;let p=(0,P.pathToFilename)(c);this.wrapAsync(this._access,[p,h],d)},this.appendFileSync=(c,a,u)=>{let h=(0,Q.getAppendFileOpts)(u);(!h.flag||(0,We.isFd)(c))&&(h.flag="a"),this.writeFileSync(c,a,h)},this.appendFile=(c,a,u,h)=>{let[d,p]=(0,Q.getAppendFileOptsAndCb)(u,h);(!d.flag||(0,We.isFd)(c))&&(d.flag="a"),this.writeFile(c,a,d,p)},this._readdir=(c,a)=>{let u=(0,We.filenameToSteps)(c),h=this._core.getResolvedLinkOrThrow(c,"scandir"),d=h.getNode();if(!d.isDirectory())throw(0,P.createError)("ENOTDIR","scandir",c);if(!d.canRead())throw(0,P.createError)("EACCES","scandir",c);let p=[];for(let w of h.children.keys()){let y=h.getChild(w);if(!(!y||w==="."||w==="..")&&(p.push(QC.default.build(y,a.encoding)),a.recursive&&y.children.size)){let b={...a,recursive:!0,withFileTypes:!0},_=this._readdir(y.getPath(),b);p.push(..._)}}if(!We.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 We.isWin&&(m=m.replace(/\\/g,"/")),p.map(w=>{if(a.recursive){let y=Pp(w.parentPath,w.name.toString());return We.isWin&&(y=y.replace(/\\/g,"/")),y.replace(m+Re.posix.sep,"")}return w.name})},this.readdirSync=(c,a)=>{let u=(0,Q.getReaddirOptions)(a),h=(0,P.pathToFilename)(c);return this._readdir(h,u)},this.readdir=(c,a,u)=>{let[h,d]=(0,Q.getReaddirOptsAndCb)(a,u),p=(0,P.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,P.createError)("EINVAL","readlink",c);return(0,Mi.strToEncoding)(h.symlink,a)},this.readlinkSync=(c,a)=>{let u=(0,Q.getDefaultOpts)(a),h=(0,P.pathToFilename)(c);return this._readlink(h,u.encoding)},this.readlink=(c,a,u)=>{let[h,d]=(0,Q.getDefaultOptsAndCb)(a,u),p=(0,P.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,P.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,We.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,P.validateCallback)(typeof a=="number"?u:a);if((0,We.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,gt(a),gt(u))},this.futimes=(c,a,u,h)=>{this.wrapAsync(this._futimes,[c,gt(a),gt(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,P.pathToFilename)(c),gt(a),gt(u),!0)},this.utimes=(c,a,u,h)=>{this.wrapAsync(this._utimes,[(0,P.pathToFilename)(c),gt(a),gt(u),!0],h)},this.lutimesSync=(c,a,u)=>{this._utimes((0,P.pathToFilename)(c),gt(a),gt(u),!1)},this.lutimes=(c,a,u,h)=>{this.wrapAsync(this._utimes,[(0,P.pathToFilename)(c),gt(a),gt(u),!1],h)},this.mkdirSync=(c,a)=>{let u=(0,Q.getMkdirOptions)(a),h=(0,P.modeToNumber)(u.mode,511),d=(0,P.pathToFilename)(c);if(u.recursive)return this._core.mkdirp(d,h);this._core.mkdir(d,h)},this.mkdir=(c,a,u)=>{let h=(0,Q.getMkdirOptions)(a),d=(0,P.validateCallback)(typeof a=="function"?a:u),p=(0,P.modeToNumber)(h.mode,511),m=(0,P.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,P.genRndStr6)();try{return this._core.mkdir(h,511),(0,Mi.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,Q.getDefaultOpts)(a);if(!c||typeof c!="string")throw new TypeError("filename prefix is required");return(0,P.nullCheck)(c),this._mkdtemp(c,u)},this.mkdtemp=(c,a,u)=>{let[{encoding:h},d]=(0,Q.getDefaultOptsAndCb)(a,u);if(!c||typeof c!="string")throw new TypeError("filename prefix is required");(0,P.nullCheck)(c)&&this.wrapAsync(this._mkdtemp,[c,h],d)},this.rmdirSync=(c,a)=>{let u=(0,Q.getRmdirOptions)(a);this._core.rmdir((0,P.pathToFilename)(c),u.recursive)},this.rmdir=(c,a,u)=>{let h=(0,Q.getRmdirOptions)(a),d=(0,P.validateCallback)(typeof a=="function"?a:u);this.wrapAsync(this._core.rmdir,[(0,P.pathToFilename)(c),h.recursive],d)},this.rmSync=(c,a)=>{this._core.rm((0,P.pathToFilename)(c),a?.force,a?.recursive)},this.rm=(c,a,u)=>{let[h,d]=(0,Q.getRmOptsAndCb)(a,u);this.wrapAsync(this._core.rm,[(0,P.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,P.modeToNumber)(a))},this.fchmod=(c,a,u)=>{this.wrapAsync(this._fchmod,[c,(0,P.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,P.modeToNumber)(a),h=(0,P.pathToFilename)(c);this._chmod(h,u,!0)},this.chmod=(c,a,u)=>{let h=(0,P.modeToNumber)(a),d=(0,P.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,P.modeToNumber)(a),h=(0,P.pathToFilename)(c);this._lchmod(h,u)},this.lchmod=(c,a,u)=>{let h=(0,P.modeToNumber)(a),d=(0,P.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)=>{ds(a),ps(u),this._fchown(c,a,u)},this.fchown=(c,a,u,h)=>{ds(a),ps(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)=>{ds(a),ps(u),this._chown((0,P.pathToFilename)(c),a,u)},this.chown=(c,a,u,h)=>{ds(a),ps(u),this.wrapAsync(this._chown,[(0,P.pathToFilename)(c),a,u],h)},this._lchown=(c,a,u)=>{this._core.getLinkOrThrow(c,"lchown").getNode().chown(a,u)},this.lchownSync=(c,a,u)=>{ds(a),ps(u),this._lchown((0,P.pathToFilename)(c),a,u)},this.lchown=(c,a,u,h)=>{ds(a),ps(u),this.wrapAsync(this._lchown,[(0,P.pathToFilename)(c),a,u],h)},this.statWatchers={},this.cpSync=(c,a,u)=>{let h=(0,P.pathToFilename)(c),d=(0,P.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,P.pathToFilename)(c),p=(0,P.pathToFilename)(a),m,w;typeof u=="function"?[m,w]=[{},u]:[m,w]=[u||{},h],(0,P.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,P.pathToFilename)(c),h;try{h=this._core.getResolvedLinkOrThrow(u,"open")}catch(w){throw w&&typeof w=="object"&&w.code==="ENOENT"?new oI.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}=D_();return u(this,c,a)},this._opendir=(c,a)=>{let u=this._core.getResolvedLinkOrThrow(c,"scandir");if(!u.getNode().isDirectory())throw(0,P.createError)("ENOTDIR","scandir",c);return new aI.Dir(u,a)},this.opendirSync=(c,a)=>{let u=(0,Q.getOpendirOptions)(a),h=(0,P.pathToFilename)(c);return this._opendir(h,u)},this.opendir=(c,a,u)=>{let[h,d]=(0,Q.getOpendirOptsAndCb)(a,u),p=(0,P.pathToFilename)(c);this.wrapAsync(this._opendir,[p,h],d)};let r=this;this.StatWatcher=class extends Ml{constructor(){super(r)}};let i=cr;this.ReadStream=class extends i{constructor(...c){super(r,...c)}};let n=Nt;this.WriteStream=class extends n{constructor(...c){super(r,...c)}},this.FSWatcher=class extends Ll{constructor(){super(r)}};let s=l((c,a)=>{let u=this._core.getResolvedLinkOrThrow(c,"realpath");return(0,Mi.strToEncoding)(u.getPath()||"/",a)},"_realpath"),o=l((c,a,u)=>{let[h,d]=(0,Q.getRealpathOptsAndCb)(a,u),p=(0,P.pathToFilename)(c);r.wrapAsync(s,[p,h.encoding],d)},"realpathImpl"),f=l((c,a)=>s((0,P.pathToFilename)(c),(0,Q.getRealpathOptions)(a).encoding),"realpathSyncImpl");this.realpath=o,this.realpath.native=o,this.realpathSync=f,this.realpathSync.native=f}wrapAsync(e,r,i){(0,P.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,sI.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,P.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=ms.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&hI&&this.existsSync(r))throw(0,P.createError)("EEXIST","copyFile",e,r);if(i&dI)throw(0,P.createError)("ENOSYS","copyFile",e,r);this._core.writeFile(r,n,Bl.FLAGS.w,438)}isSrcSubdir(e,r){try{let i=$_(e.startsWith("/")?e:"/"+e),n=$_(r.startsWith("/")?r:"/"+r);if(i===n)return!0;let s=$l(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,P.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=Pp(i,String(f)),a=Pp(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=cI(I_(r),s)),e&&this.unlinkSync(i),this.symlinkSync(s,i)}lstat(e,r,i){let[{throwIfNoEntry:n=!0,bigint:s=!1},o]=(0,Q.getStatOptsAndCb)(r,i);this.wrapAsync(this._lstat,[(0,P.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 xp.default.build(n.getNode(),r)}statSync(e,r){let{bigint:i=!0,throwIfNoEntry:n=!0}=(0,Q.getStatOptions)(r);return this._stat((0,P.pathToFilename)(e),i,n)}stat(e,r,i){let[{bigint:n=!1,throwIfNoEntry:s=!0},o]=(0,Q.getStatOptsAndCb)(r,i);this.wrapAsync(this._stat,[(0,P.pathToFilename)(e),n,s],o)}fstatBase(e,r=!1){let i=this._core.getFileByFd(e);if(!i)throw(0,P.createError)("EBADF","fstat");return xp.default.build(i.node,r)}fstatSync(e,r){return this.fstatBase(e,(0,Q.getStatOptions)(r).bigint)}fstat(e,r,i){let[n,s]=(0,Q.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!==Ap&&(r&lI&&!n.canRead()||r&fI&&!n.canWrite()||r&uI&&!n.canExecute()))throw(0,P.createError)("EACCES","access",e)}watchFile(e,r,i){let n=(0,P.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,P.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,P.pathToFilename)(e),s=r;typeof r=="function"&&(i=r,s=null);let{persistent:o,recursive:f,encoding:c}=(0,Q.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"),eI.default.build(this._core,r)}statfsSync(e,r){let{bigint:i=!1}=(0,Q.getStatfsOptions)(r);return this._statfs((0,P.pathToFilename)(e),i)}statfs(e,r,i){let[{bigint:n=!1},s]=(0,Q.getStatfsOptsAndCb)(r,i);this.wrapAsync(this._statfs,[(0,P.pathToFilename)(e),n],s)}};l(Dp,"Volume");var Li=Dp;bt.Volume=Li;Li.fromJSON=(t,e)=>new Li(Np.Superblock.fromJSON(t,e));Li.fromNestedJSON=(t,e)=>new Li(Np.Superblock.fromNestedJSON(t,e));function yI(t){t.emit("stop")}l(yI,"emitStop");var Cp=class Cp extends B_.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,P.pathToFilename)(e),this.setTimeout=r?setTimeout.bind(globalThis):tI.default,this.interval=i,this.prev=this.vol.statSync(this.filename),this.loop()}stop(){clearTimeout(this.timeoutRef),(0,jl.default)(()=>{yI.call(this,this)})}};l(Cp,"StatWatcher");var Ml=Cp;bt.StatWatcher=Ml;var Pt;function gI(t){Pt=(0,ms.bufferAllocUnsafe)(t),Pt.used=0}l(gI,"allocNewPool");(0,M_.inherits)(cr,ql.Readable);bt.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,Q.getOptions)(r,{})),r.highWaterMark===void 0&&(r.highWaterMark=64*1024),ql.Readable.call(this,r),this.path=(0,P.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;(!Pt||Pt.length-Pt.used<pI)&&gI(this._readableState.highWaterMark);var e=Pt,r=Math.min(Pt.length-Pt.used,t),i=Pt.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,Pt,Pt.used,r,this.pos,s),this.pos!==void 0&&(this.pos+=r),Pt.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",L_);return}return(0,jl.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 L_(t){this.close()}l(L_,"closeOnOpen");(0,M_.inherits)(Nt,ql.Writable);bt.WriteStream=Nt;function Nt(t,e,r){if(!(this instanceof Nt))return new Nt(t,e,r);if(this._vol=t,r=Object.assign({},(0,Q.getOptions)(r,{})),ql.Writable.call(this,r),this.path=(0,P.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(Nt,"FsWriteStream");Nt.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))};Nt.prototype._write=function(t,e,r){if(!(t instanceof ms.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)};Nt.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=ms.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)};Nt.prototype.close=function(t){if(t&&this.once("close",t),this.closed||typeof this.fd!="number"){if(typeof this.fd!="number"){this.once("open",L_);return}return(0,jl.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};Nt.prototype._destroy=cr.prototype._destroy;Nt.prototype.destroySoon=Nt.prototype.end;var Ip=class Ip extends B_.EventEmitter{constructor(e){super(),this._filename="",this._filenameEncoded="",this._recursive=!1,this._encoding=Mi.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=Mi.ENCODING_UTF8){this._filename=(0,P.pathToFilename)(e),this._steps=(0,We.filenameToSteps)(this._filename),this._filenameEncoded=(0,Mi.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=$l(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",$l(this._filename,m.getPath())),s(m),o(m)},"onLinkChildAdd"),h=l(m=>{let w=l(y=>{let b=y.getNode().ino,_=this._listenerRemovers.get(b);_&&(_.forEach(F=>F()),this._listenerRemovers.delete(b));for(let[F,E]of y.children.entries())E&&F!=="."&&F!==".."&&w(E)},"removeLinkNodeListeners");w(m),this.emit("change","rename",$l(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(Ip,"FSWatcher");var Ll=Ip;bt.FSWatcher=Ll});var q_=T(Ul=>{"use strict";Object.defineProperty(Ul,"__esModule",{value:!0});Ul.fsSynchronousApiList=void 0;Ul.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 U_=T(Wl=>{"use strict";Object.defineProperty(Wl,"__esModule",{value:!0});Wl.fsCallbackApiList=void 0;Wl.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 ws=T((_t,zl)=>{"use strict";Object.defineProperty(_t,"__esModule",{value:!0});_t.memfs=_t.fs=_t.vol=_t.Volume=void 0;_t.createFsFromVolume=$p;var bI=Md(),_I=Qc(),Hl=j_();Object.defineProperty(_t,"Volume",{enumerable:!0,get:l(function(){return Hl.Volume},"get")});var W_=Vt(),SI=q_(),vI=U_(),{F_OK:EI,R_OK:FI,W_OK:TI,X_OK:kI}=W_.constants;_t.vol=new Hl.Volume;function $p(t){let e={F_OK:EI,R_OK:FI,W_OK:TI,X_OK:kI,constants:W_.constants,Stats:bI.default,Dirent:_I.default};for(let r of SI.fsSynchronousApiList)typeof t[r]=="function"&&(e[r]=t[r].bind(t));for(let r of vI.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=Hl.toUnixTimestamp,e.__vol=t,e}l($p,"createFsFromVolume");_t.fs=$p(_t.vol);var RI=l((t={},e="/")=>{let r=Hl.Volume.fromNestedJSON(t,e);return{fs:$p(r),vol:r}},"memfs");_t.memfs=RI;zl.exports={...zl.exports,..._t.fs};zl.exports.semantic=!0});var Vp=T((O9,Jl)=>{function V_(t){return Array.isArray(t)?t:[t]}l(V_,"makeArray");var OI=void 0,Mp="",z_=" ",Bp="\\",xI=/^\s+$/,AI=/(?:[^\\]|^)\\$/,PI=/^\\!/,NI=/^\\#/,DI=/\r?\n/g,CI=/^\.{0,2}\/|^\.{1,2}$/,II=/\/$/,ys="/",G_="node-ignore";typeof Symbol<"u"&&(G_=Symbol.for("node-ignore"));var J_=G_,gs=l((t,e,r)=>(Object.defineProperty(t,e,{value:r}),r),"define"),$I=/([0-z])-([0-z])/g,K_=l(()=>!1,"RETURN_FALSE"),BI=l(t=>t.replace($I,(e,r,i)=>r.charCodeAt(0)<=i.charCodeAt(0)?e:Mp),"sanitizeRange"),MI=l(t=>{let{length:e}=t;return t.slice(0,e-e%2)},"cleanRangeBackSlash"),LI=[[/^\uFEFF/,()=>Mp],[/((?:\\\\)*?)(\\?\s+)$/,(t,e,r)=>e+(r.indexOf("\\")===0?z_:Mp)],[/(\\+?)\s/g,(t,e)=>{let{length:r}=e;return e.slice(0,r-r%2)+z_}],[/[\\$.|*+(){^]/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,()=>Bp],[/\\\\/g,()=>Bp],[/(\\)?\[([^\]/]*?)(\\*)($|\])/g,(t,e,r,i,n)=>e===Bp?`\\[${r}${MI(i)}${n}`:n==="]"&&i.length%2===0?`[${BI(r)}${i}]`:"[]"],[/(?:[^*])$/,t=>/\/$/.test(t)?`${t}$`:`${t}(?=$|\\/$)`]],jI=/(^|\\\/)?\\\*$/,da="regex",Vl="checkRegex",H_="_",qI={[da](t,e){return`${e?`${e}[^/]+`:"[^/]*"}(?=$|\\/$)`},[Vl](t,e){return`${e?`${e}[^/]*`:"[^/]*"}(?=$|\\/$)`}},UI=l(t=>LI.reduce((e,[r,i])=>e.replace(r,i.bind(t)),t),"makeRegexPrefix"),Gl=l(t=>typeof t=="string","isString"),WI=l(t=>t&&Gl(t)&&!xI.test(t)&&!AI.test(t)&&t.indexOf("#")!==0,"checkPattern"),zI=l(t=>t.split(DI).filter(Boolean),"splitPattern"),Wp=class Wp{constructor(e,r,i,n,s,o){this.pattern=e,this.mark=r,this.negative=s,gs(this,"body",i),gs(this,"ignoreCase",n),gs(this,"regexPrefix",o)}get regex(){let e=H_+da;return this[e]?this[e]:this._make(da,e)}get checkRegex(){let e=H_+Vl;return this[e]?this[e]:this._make(Vl,e)}_make(e,r){let i=this.regexPrefix.replace(jI,qI[e]),n=this.ignoreCase?new RegExp(i,"i"):new RegExp(i);return gs(this,r,n)}};l(Wp,"IgnoreRule");var Lp=Wp,HI=l(({pattern:t,mark:e},r)=>{let i=!1,n=t;n.indexOf("!")===0&&(i=!0,n=n.substr(1)),n=n.replace(PI,"!").replace(NI,"#");let s=UI(n);return new Lp(t,e,n,r,i,s)},"createRule"),zp=class zp{constructor(e){this._ignoreCase=e,this._rules=[]}_add(e){if(e&&e[J_]){this._rules=this._rules.concat(e._rules._rules),this._added=!0;return}if(Gl(e)&&(e={pattern:e}),WI(e.pattern)){let r=HI(e,this._ignoreCase);this._added=!0,this._rules.push(r)}}add(e){return this._added=!1,V_(Gl(e)?zI(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?OI:c)});let f={ignored:n,unignored:s};return o&&(f.rule=o),f}};l(zp,"RuleManager");var jp=zp,VI=l((t,e)=>{throw new e(t)},"throwError"),Pr=l((t,e,r)=>Gl(t)?t?Pr.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"),X_=l(t=>CI.test(t),"isNotRelative");Pr.isNotRelative=X_;Pr.convert=t=>t;var Hp=class Hp{constructor({ignorecase:e=!0,ignoreCase:r=e,allowRelativePaths:i=!1}={}){gs(this,J_,!0),this._rules=new jp(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&&Pr.convert(e);return Pr(s,e,this._strictPathCheck?VI:K_),this._t(s,r,i,n)}checkIgnore(e){if(!II.test(e))return this.test(e);let r=e.split(ys).filter(Boolean);if(r.pop(),r.length){let i=this._t(r.join(ys)+ys,this._testCache,!0,r);if(i.ignored)return i}return this._rules.test(e,!1,Vl)}_t(e,r,i,n){if(e in r)return r[e];if(n||(n=e.split(ys).filter(Boolean)),n.pop(),!n.length)return r[e]=this._rules.test(e,i,da);let s=this._t(n.join(ys)+ys,r,i,n);return r[e]=s.ignored?s:this._rules.test(e,i,da)}ignores(e){return this._test(e,this._ignoreCache,!1).ignored}createFilter(){return e=>!this.ignores(e)}filter(e){return V_(e).filter(this.createFilter())}test(e){return this._test(e,this._testCache,!0)}};l(Hp,"Ignore");var qp=Hp,Up=l(t=>new qp(t),"factory"),GI=l(t=>Pr(t&&Pr.convert(t),t,K_),"isPathValid"),Y_=l(()=>{let t=l(r=>/^\\\\\?\\/.test(r)||/["<>|\u0000-\u001F]+/u.test(r)?r:r.replace(/\\/g,"/"),"makePosix");Pr.convert=t;let e=/^[a-z]:\//i;Pr.isNotRelative=r=>e.test(r)||X_(r)},"setupWindows");typeof process<"u"&&process.platform==="win32"&&Y_();Jl.exports=Up;Up.default=Up;Jl.exports.isPathValid=GI;gs(Jl.exports,Symbol.for("setupWindows"),Y_)});var Q_=T((A9,Z_)=>{"use strict";var St=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||St.DEFAULT_TIMEOUT,this.maxOccupationTime=t.maxOccupationTime||St.DEFAULT_MAX_OCCUPATION_TIME,this.maxExecutionTime=t.maxExecutionTime||St.DEFAULT_MAX_EXECUTION_TIME,t.maxPending===1/0||Number.isInteger(t.maxPending)&&t.maxPending>=0?this.maxPending=t.maxPending:this.maxPending=St.DEFAULT_MAX_PENDING},"AsyncLock");St.DEFAULT_TIMEOUT=0;St.DEFAULT_MAX_OCCUPATION_TIME=0;St.DEFAULT_MAX_EXECUTION_TIME=0;St.DEFAULT_MAX_PENDING=1e3;St.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,D){E||(E=!0,d(_,R,D))})}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 b=i.maxOccupationTime||h.maxOccupationTime;if(b&&(a=setTimeout(function(){h.queues[t]&&d(!1,new Error("Maximum occupation time is exceeded in queue "+t))},b)),o)return o};St.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())})};St.prototype.isBusy=function(t){return t?!!this.queues[t]:Object.keys(this.queues).length>0};St.prototype._promiseTry=function(t){try{return this.Promise.resolve(t())}catch(e){return this.Promise.reject(e)}};Z_.exports=St});var tS=T((N9,eS)=>{"use strict";eS.exports=Q_()});var rS=T((D9,Gp)=>{typeof Object.create=="function"?Gp.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"):Gp.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 iS=T((I9,Kp)=>{try{if(Jp=ie("util"),typeof Jp.inherits!="function")throw"";Kp.exports=Jp.inherits}catch{Kp.exports=rS()}var Jp});var pa=T((Xp,sS)=>{var Kl=ie("buffer"),lr=Kl.Buffer;function nS(t,e){for(var r in t)e[r]=t[r]}l(nS,"copyProps");lr.from&&lr.alloc&&lr.allocUnsafe&&lr.allocUnsafeSlow?sS.exports=Kl:(nS(Kl,Xp),Xp.Buffer=ji);function ji(t,e,r){return lr(t,e,r)}l(ji,"SafeBuffer");ji.prototype=Object.create(lr.prototype);nS(lr,ji);ji.from=function(t,e,r){if(typeof t=="number")throw new TypeError("Argument must not be a number");return lr(t,e,r)};ji.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};ji.allocUnsafe=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return lr(t)};ji.allocUnsafeSlow=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return Kl.SlowBuffer(t)}});var aS=T((B9,oS)=>{var JI={}.toString;oS.exports=Array.isArray||function(t){return JI.call(t)=="[object Array]"}});var bs=T((M9,cS)=>{"use strict";cS.exports=TypeError});var Yp=T((L9,lS)=>{"use strict";lS.exports=Object});var uS=T((j9,fS)=>{"use strict";fS.exports=Error});var dS=T((q9,hS)=>{"use strict";hS.exports=EvalError});var mS=T((U9,pS)=>{"use strict";pS.exports=RangeError});var yS=T((W9,wS)=>{"use strict";wS.exports=ReferenceError});var Zp=T((z9,gS)=>{"use strict";gS.exports=SyntaxError});var _S=T((H9,bS)=>{"use strict";bS.exports=URIError});var vS=T((V9,SS)=>{"use strict";SS.exports=Math.abs});var FS=T((G9,ES)=>{"use strict";ES.exports=Math.floor});var kS=T((J9,TS)=>{"use strict";TS.exports=Math.max});var OS=T((K9,RS)=>{"use strict";RS.exports=Math.min});var AS=T((X9,xS)=>{"use strict";xS.exports=Math.pow});var NS=T((Y9,PS)=>{"use strict";PS.exports=Math.round});var CS=T((Z9,DS)=>{"use strict";DS.exports=Number.isNaN||l(function(e){return e!==e},"isNaN")});var $S=T((eJ,IS)=>{"use strict";var KI=CS();IS.exports=l(function(e){return KI(e)||e===0?e:e<0?-1:1},"sign")});var MS=T((rJ,BS)=>{"use strict";BS.exports=Object.getOwnPropertyDescriptor});var _s=T((iJ,LS)=>{"use strict";var Xl=MS();if(Xl)try{Xl([],"length")}catch{Xl=null}LS.exports=Xl});var ma=T((nJ,jS)=>{"use strict";var Yl=Object.defineProperty||!1;if(Yl)try{Yl({},"a",{value:1})}catch{Yl=!1}jS.exports=Yl});var Qp=T((sJ,qS)=>{"use strict";qS.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 zS=T((aJ,WS)=>{"use strict";var US=typeof Symbol<"u"&&Symbol,XI=Qp();WS.exports=l(function(){return typeof US!="function"||typeof Symbol!="function"||typeof US("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:XI()},"hasNativeSymbols")});var em=T((lJ,HS)=>{"use strict";HS.exports=typeof Reflect<"u"&&Reflect.getPrototypeOf||null});var tm=T((fJ,VS)=>{"use strict";var YI=Yp();VS.exports=YI.getPrototypeOf||null});var KS=T((uJ,JS)=>{"use strict";var ZI="Function.prototype.bind called on incompatible ",QI=Object.prototype.toString,e$=Math.max,t$="[object Function]",GS=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"),r$=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"),i$=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");JS.exports=l(function(e){var r=this;if(typeof r!="function"||QI.apply(r)!==t$)throw new TypeError(ZI+r);for(var i=r$(arguments,1),n,s=l(function(){if(this instanceof n){var u=r.apply(this,GS(i,arguments));return Object(u)===u?u:this}return r.apply(e,GS(i,arguments))},"binder"),o=e$(0,r.length-i.length),f=[],c=0;c<o;c++)f[c]="$"+c;if(n=Function("binder","return function ("+i$(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 Ss=T((dJ,XS)=>{"use strict";var n$=KS();XS.exports=Function.prototype.bind||n$});var Zl=T((pJ,YS)=>{"use strict";YS.exports=Function.prototype.call});var Ql=T((mJ,ZS)=>{"use strict";ZS.exports=Function.prototype.apply});var ev=T((wJ,QS)=>{"use strict";QS.exports=typeof Reflect<"u"&&Reflect&&Reflect.apply});var rm=T((yJ,tv)=>{"use strict";var s$=Ss(),o$=Ql(),a$=Zl(),c$=ev();tv.exports=c$||s$.call(a$,o$)});var ef=T((gJ,rv)=>{"use strict";var l$=Ss(),f$=bs(),u$=Zl(),h$=rm();rv.exports=l(function(e){if(e.length<1||typeof e[0]!="function")throw new f$("a function is required");return h$(l$,u$,e)},"callBindBasic")});var cv=T((_J,av)=>{"use strict";var d$=ef(),iv=_s(),sv;try{sv=[].__proto__===Array.prototype}catch(t){if(!t||typeof t!="object"||!("code"in t)||t.code!=="ERR_PROTO_ACCESS")throw t}var im=!!sv&&iv&&iv(Object.prototype,"__proto__"),ov=Object,nv=ov.getPrototypeOf;av.exports=im&&typeof im.get=="function"?d$([im.get]):typeof nv=="function"?l(function(e){return nv(e==null?e:ov(e))},"getDunder"):!1});var nm=T((vJ,hv)=>{"use strict";var lv=em(),fv=tm(),uv=cv();hv.exports=lv?l(function(e){return lv(e)},"getProto"):fv?l(function(e){if(!e||typeof e!="object"&&typeof e!="function")throw new TypeError("getProto: not an object");return fv(e)},"getProto"):uv?l(function(e){return uv(e)},"getProto"):null});var pv=T((FJ,dv)=>{"use strict";var p$=Function.prototype.call,m$=Object.prototype.hasOwnProperty,w$=Ss();dv.exports=w$.call(p$,m$)});var am=T((TJ,_v)=>{"use strict";var K,y$=Yp(),g$=uS(),b$=dS(),_$=mS(),S$=yS(),Ts=Zp(),Fs=bs(),v$=_S(),E$=vS(),F$=FS(),T$=kS(),k$=OS(),R$=AS(),O$=NS(),x$=$S(),gv=Function,sm=l(function(t){try{return gv('"use strict"; return ('+t+").constructor;")()}catch{}},"getEvalledConstructor"),wa=_s(),A$=ma(),om=l(function(){throw new Fs},"throwTypeError"),P$=wa?function(){try{return arguments.callee,om}catch{try{return wa(arguments,"callee").get}catch{return om}}}():om,vs=zS()(),Le=nm(),N$=tm(),D$=em(),bv=Ql(),ya=Zl(),Es={},C$=typeof Uint8Array>"u"||!Le?K:Le(Uint8Array),qi={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?K:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?K:ArrayBuffer,"%ArrayIteratorPrototype%":vs&&Le?Le([][Symbol.iterator]()):K,"%AsyncFromSyncIteratorPrototype%":K,"%AsyncFunction%":Es,"%AsyncGenerator%":Es,"%AsyncGeneratorFunction%":Es,"%AsyncIteratorPrototype%":Es,"%Atomics%":typeof Atomics>"u"?K:Atomics,"%BigInt%":typeof BigInt>"u"?K:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?K:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?K:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?K:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":g$,"%eval%":eval,"%EvalError%":b$,"%Float16Array%":typeof Float16Array>"u"?K:Float16Array,"%Float32Array%":typeof Float32Array>"u"?K:Float32Array,"%Float64Array%":typeof Float64Array>"u"?K:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?K:FinalizationRegistry,"%Function%":gv,"%GeneratorFunction%":Es,"%Int8Array%":typeof Int8Array>"u"?K:Int8Array,"%Int16Array%":typeof Int16Array>"u"?K:Int16Array,"%Int32Array%":typeof Int32Array>"u"?K:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":vs&&Le?Le(Le([][Symbol.iterator]())):K,"%JSON%":typeof JSON=="object"?JSON:K,"%Map%":typeof Map>"u"?K:Map,"%MapIteratorPrototype%":typeof Map>"u"||!vs||!Le?K:Le(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":y$,"%Object.getOwnPropertyDescriptor%":wa,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?K:Promise,"%Proxy%":typeof Proxy>"u"?K:Proxy,"%RangeError%":_$,"%ReferenceError%":S$,"%Reflect%":typeof Reflect>"u"?K:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?K:Set,"%SetIteratorPrototype%":typeof Set>"u"||!vs||!Le?K:Le(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?K:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":vs&&Le?Le(""[Symbol.iterator]()):K,"%Symbol%":vs?Symbol:K,"%SyntaxError%":Ts,"%ThrowTypeError%":P$,"%TypedArray%":C$,"%TypeError%":Fs,"%Uint8Array%":typeof Uint8Array>"u"?K:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?K:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?K:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?K:Uint32Array,"%URIError%":v$,"%WeakMap%":typeof WeakMap>"u"?K:WeakMap,"%WeakRef%":typeof WeakRef>"u"?K:WeakRef,"%WeakSet%":typeof WeakSet>"u"?K:WeakSet,"%Function.prototype.call%":ya,"%Function.prototype.apply%":bv,"%Object.defineProperty%":A$,"%Object.getPrototypeOf%":N$,"%Math.abs%":E$,"%Math.floor%":F$,"%Math.max%":T$,"%Math.min%":k$,"%Math.pow%":R$,"%Math.round%":O$,"%Math.sign%":x$,"%Reflect.getPrototypeOf%":D$};if(Le)try{null.error}catch(t){mv=Le(Le(t)),qi["%Error.prototype%"]=mv}var mv,I$=l(function t(e){var r;if(e==="%AsyncFunction%")r=sm("async function () {}");else if(e==="%GeneratorFunction%")r=sm("function* () {}");else if(e==="%AsyncGeneratorFunction%")r=sm("async function* () {}");else if(e==="%AsyncGenerator%"){var i=t("%AsyncGeneratorFunction%");i&&(r=i.prototype)}else if(e==="%AsyncIteratorPrototype%"){var n=t("%AsyncGenerator%");n&&Le&&(r=Le(n.prototype))}return qi[e]=r,r},"doEval"),wv={__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"]},ga=Ss(),tf=pv(),$$=ga.call(ya,Array.prototype.concat),B$=ga.call(bv,Array.prototype.splice),yv=ga.call(ya,String.prototype.replace),rf=ga.call(ya,String.prototype.slice),M$=ga.call(ya,RegExp.prototype.exec),L$=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,j$=/\\(\\)?/g,q$=l(function(e){var r=rf(e,0,1),i=rf(e,-1);if(r==="%"&&i!=="%")throw new Ts("invalid intrinsic syntax, expected closing `%`");if(i==="%"&&r!=="%")throw new Ts("invalid intrinsic syntax, expected opening `%`");var n=[];return yv(e,L$,function(s,o,f,c){n[n.length]=f?yv(c,j$,"$1"):o||s}),n},"stringToPath"),U$=l(function(e,r){var i=e,n;if(tf(wv,i)&&(n=wv[i],i="%"+n[0]+"%"),tf(qi,i)){var s=qi[i];if(s===Es&&(s=I$(i)),typeof s>"u"&&!r)throw new Fs("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:n,name:i,value:s}}throw new Ts("intrinsic "+e+" does not exist!")},"getBaseIntrinsic");_v.exports=l(function(e,r){if(typeof e!="string"||e.length===0)throw new Fs("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof r!="boolean")throw new Fs('"allowMissing" argument must be a boolean');if(M$(/^%?[^%]*%?$/,e)===null)throw new Ts("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var i=q$(e),n=i.length>0?i[0]:"",s=U$("%"+n+"%",r),o=s.name,f=s.value,c=!1,a=s.alias;a&&(n=a[0],B$(i,$$([0,1],a)));for(var u=1,h=!0;u<i.length;u+=1){var d=i[u],p=rf(d,0,1),m=rf(d,-1);if((p==='"'||p==="'"||p==="`"||m==='"'||m==="'"||m==="`")&&p!==m)throw new Ts("property names with quotes must have matching quotes");if((d==="constructor"||!h)&&(c=!0),n+="."+d,o="%"+n+"%",tf(qi,o))f=qi[o];else if(f!=null){if(!(d in f)){if(!r)throw new Fs("base intrinsic for "+e+" exists, but the property is not available.");return}if(wa&&u+1>=i.length){var w=wa(f,d);h=!!w,h&&"get"in w&&!("originalValue"in w.get)?f=w.get:f=f[d]}else h=tf(f,d),f=f[d];h&&!c&&(qi[o]=f)}}return f},"GetIntrinsic")});var cm=T((RJ,Ev)=>{"use strict";var Sv=am(),vv=ef(),W$=vv([Sv("%String.prototype.indexOf%")]);Ev.exports=l(function(e,r){var i=Sv(e,!!r);return typeof i=="function"&&W$(e,".prototype.")>-1?vv([i]):i},"callBoundIntrinsic")});var Rv=T((xJ,kv)=>{"use strict";var Tv=Function.prototype.toString,ks=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,fm,nf;if(typeof ks=="function"&&typeof Object.defineProperty=="function")try{fm=Object.defineProperty({},"length",{get:l(function(){throw nf},"get")}),nf={},ks(function(){throw 42},null,fm)}catch(t){t!==nf&&(ks=null)}else ks=null;var z$=/^\s*class\b/,um=l(function(e){try{var r=Tv.call(e);return z$.test(r)}catch{return!1}},"isES6ClassFunction"),lm=l(function(e){try{return um(e)?!1:(Tv.call(e),!0)}catch{return!1}},"tryFunctionToStr"),sf=Object.prototype.toString,H$="[object Object]",V$="[object Function]",G$="[object GeneratorFunction]",J$="[object HTMLAllCollection]",K$="[object HTML document.all class]",X$="[object HTMLCollection]",Y$=typeof Symbol=="function"&&!!Symbol.toStringTag,Z$=!(0 in[,]),hm=l(function(){return!1},"isDocumentDotAll");typeof document=="object"&&(Fv=document.all,sf.call(Fv)===sf.call(document.all)&&(hm=l(function(e){if((Z$||!e)&&(typeof e>"u"||typeof e=="object"))try{var r=sf.call(e);return(r===J$||r===K$||r===X$||r===H$)&&e("")==null}catch{}return!1},"isDocumentDotAll")));var Fv;kv.exports=l(ks?function(e){if(hm(e))return!0;if(!e||typeof e!="function"&&typeof e!="object")return!1;try{ks(e,null,fm)}catch(r){if(r!==nf)return!1}return!um(e)&&lm(e)}:function(e){if(hm(e))return!0;if(!e||typeof e!="function"&&typeof e!="object")return!1;if(Y$)return lm(e);if(um(e))return!1;var r=sf.call(e);return r!==V$&&r!==G$&&!/^\[object HTML/.test(r)?!1:lm(e)},"isCallable")});var Av=T((PJ,xv)=>{"use strict";var Q$=Rv(),e2=Object.prototype.toString,Ov=Object.prototype.hasOwnProperty,t2=l(function(e,r,i){for(var n=0,s=e.length;n<s;n++)Ov.call(e,n)&&(i==null?r(e[n],n,e):r.call(i,e[n],n,e))},"forEachArray"),r2=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"),i2=l(function(e,r,i){for(var n in e)Ov.call(e,n)&&(i==null?r(e[n],n,e):r.call(i,e[n],n,e))},"forEachObject");function n2(t){return e2.call(t)==="[object Array]"}l(n2,"isArray");xv.exports=l(function(e,r,i){if(!Q$(r))throw new TypeError("iterator must be a function");var n;arguments.length>=3&&(n=i),n2(e)?t2(e,r,n):typeof e=="string"?r2(e,r,n):i2(e,r,n)},"forEach")});var Nv=T((DJ,Pv)=>{"use strict";Pv.exports=["Float16Array","Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"]});var Cv=T((CJ,Dv)=>{"use strict";var dm=Nv(),s2=globalThis;Dv.exports=l(function(){for(var e=[],r=0;r<dm.length;r++)typeof s2[dm[r]]=="function"&&(e[e.length]=dm[r]);return e},"availableTypedArrays")});var Mv=T(($J,Bv)=>{"use strict";var Iv=ma(),o2=Zp(),Rs=bs(),$v=_s();Bv.exports=l(function(e,r,i){if(!e||typeof e!="object"&&typeof e!="function")throw new Rs("`obj` must be an object or a function`");if(typeof r!="string"&&typeof r!="symbol")throw new Rs("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new Rs("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new Rs("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new Rs("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new Rs("`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=!!$v&&$v(e,r);if(Iv)Iv(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 o2("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},"defineDataProperty")});var qv=T((MJ,jv)=>{"use strict";var pm=ma(),Lv=l(function(){return!!pm},"hasPropertyDescriptors");Lv.hasArrayLengthDefineBug=l(function(){if(!pm)return null;try{return pm([],"length",{value:1}).length!==1}catch{return!0}},"hasArrayLengthDefineBug");jv.exports=Lv});var Vv=T((jJ,Hv)=>{"use strict";var a2=am(),Uv=Mv(),c2=qv()(),Wv=_s(),zv=bs(),l2=a2("%Math.floor%");Hv.exports=l(function(e,r){if(typeof e!="function")throw new zv("`fn` is not a function");if(typeof r!="number"||r<0||r>4294967295||l2(r)!==r)throw new zv("`length` must be a positive 32-bit integer");var i=arguments.length>2&&!!arguments[2],n=!0,s=!0;if("length"in e&&Wv){var o=Wv(e,"length");o&&!o.configurable&&(n=!1),o&&!o.writable&&(s=!1)}return(n||s||!i)&&(c2?Uv(e,"length",r,!0,!0):Uv(e,"length",r)),e},"setFunctionLength")});var Jv=T((UJ,Gv)=>{"use strict";var f2=Ss(),u2=Ql(),h2=rm();Gv.exports=l(function(){return h2(f2,u2,arguments)},"applyBind")});var Yv=T((zJ,of)=>{"use strict";var d2=Vv(),Kv=ma(),p2=ef(),Xv=Jv();of.exports=l(function(e){var r=p2(arguments),i=e.length-(arguments.length-1);return d2(r,1+(i>0?i:0),!0)},"callBind");Kv?Kv(of.exports,"apply",{value:Xv}):of.exports.apply=Xv});var Qv=T((VJ,Zv)=>{"use strict";var m2=Qp();Zv.exports=l(function(){return m2()&&!!Symbol.toStringTag},"hasToStringTagShams")});var nE=T((JJ,iE)=>{"use strict";var lf=Av(),w2=Cv(),eE=Yv(),wm=cm(),cf=_s(),af=nm(),y2=wm("Object.prototype.toString"),rE=Qv()(),tE=globalThis,mm=w2(),ym=wm("String.prototype.slice"),g2=wm("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"),ff={__proto__:null};rE&&cf&&af?lf(mm,function(t){var e=new tE[t];if(Symbol.toStringTag in e&&af){var r=af(e),i=cf(r,Symbol.toStringTag);if(!i&&r){var n=af(r);i=cf(n,Symbol.toStringTag)}ff["$"+t]=eE(i.get)}}):lf(mm,function(t){var e=new tE[t],r=e.slice||e.set;r&&(ff["$"+t]=eE(r))});var b2=l(function(e){var r=!1;return lf(ff,function(i,n){if(!r)try{"$"+i(e)===n&&(r=ym(n,1))}catch{}}),r},"tryAllTypedArrays"),_2=l(function(e){var r=!1;return lf(ff,function(i,n){if(!r)try{i(e),r=ym(n,1)}catch{}}),r},"tryAllSlices");iE.exports=l(function(e){if(!e||typeof e!="object")return!1;if(!rE){var r=ym(y2(e),8,-1);return g2(mm,r)>-1?r:r!=="Object"?!1:_2(e)}return cf?b2(e):null},"whichTypedArray")});var oE=T((XJ,sE)=>{"use strict";var S2=nE();sE.exports=l(function(e){return!!S2(e)},"isTypedArray")});var cE=T((ZJ,aE)=>{"use strict";var v2=bs(),E2=cm(),F2=E2("TypedArray.prototype.buffer",!0),T2=oE();aE.exports=F2||l(function(e){if(!T2(e))throw new v2("Not a Typed Array");return e.buffer},"typedArrayBuffer")});var uE=T((eK,fE)=>{"use strict";var Jt=pa().Buffer,k2=aS(),R2=cE(),O2=ArrayBuffer.isView||l(function(e){try{return R2(e),!0}catch{return!1}},"isView"),x2=typeof Uint8Array<"u",lE=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u",A2=lE&&(Jt.prototype instanceof Uint8Array||Jt.TYPED_ARRAY_SUPPORT);fE.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(lE&&O2(e)){if(e.byteLength===0)return Jt.alloc(0);if(A2){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(x2&&e instanceof Uint8Array)return Jt.from(e);var o=k2(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 dE=T((rK,hE)=>{"use strict";var P2=pa().Buffer,N2=uE();function uf(t,e){this._block=P2.alloc(t),this._finalSize=e,this._blockSize=t,this._len=0}l(uf,"Hash");uf.prototype.update=function(t,e){t=N2(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};uf.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};uf.prototype._update=function(){throw new Error("_update must be implemented by subclass")};hE.exports=uf});var wE=T((nK,mE)=>{"use strict";var D2=iS(),pE=dE(),C2=pa().Buffer,I2=[1518500249,1859775393,-1894007588,-899497514],$2=new Array(80);function ba(){this.init(),this._w=$2,pE.call(this,64,56)}l(ba,"Sha1");D2(ba,pE);ba.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function B2(t){return t<<1|t>>>31}l(B2,"rotl1");function M2(t){return t<<5|t>>>27}l(M2,"rotl5");function L2(t){return t<<30|t>>>2}l(L2,"rotl30");function j2(t,e,r,i){return t===0?e&r|~e&i:t===2?e&r|e&i|r&i:e^r^i}l(j2,"ft");ba.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]=B2(e[f-3]^e[f-8]^e[f-14]^e[f-16]);for(var c=0;c<80;++c){var a=~~(c/20),u=M2(r)+j2(a,i,n,s)+o+e[c]+I2[a]|0;o=s,s=n,n=L2(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};ba.prototype._hash=function(){var t=C2.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};mE.exports=ba});var gE=T(gm=>{var yE;(function(t){typeof DO_NOT_EXPORT_CRC>"u"?typeof gm=="object"?t(gm):typeof define=="function"&&define.amd?define(function(){var e={};return t(e),e}):t(yE={}):t(yE={})})(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],b=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]^b[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 D(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(D,"crc32_str"),t.table=r,t.bstr=E,t.buf=R,t.str=D})});var Nr=T(nt=>{"use strict";var q2=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";function U2(t,e){return Object.prototype.hasOwnProperty.call(t,e)}l(U2,"_has");nt.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)U2(r,i)&&(t[i]=r[i])}}return t};nt.shrinkBuf=function(t,e){return t.length===e?t:t.subarray?t.subarray(0,e):(t.length=e,t)};var W2={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")},z2={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")};nt.setTyped=function(t){t?(nt.Buf8=Uint8Array,nt.Buf16=Uint16Array,nt.Buf32=Int32Array,nt.assign(nt,W2)):(nt.Buf8=Array,nt.Buf16=Array,nt.Buf32=Array,nt.assign(nt,z2))};nt.setTyped(q2)});var qE=T(As=>{"use strict";var H2=Nr(),V2=4,bE=0,_E=1,G2=2;function xs(t){for(var e=t.length;--e>=0;)t[e]=0}l(xs,"zero");var J2=0,kE=1,K2=2,X2=3,Y2=258,Tm=29,Ta=256,Sa=Ta+1+Tm,Os=30,km=19,RE=2*Sa+1,Ui=15,bm=16,Z2=7,Rm=256,OE=16,xE=17,AE=18,Em=[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],hf=[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],Q2=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],PE=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],eB=512,Dr=new Array((Sa+2)*2);xs(Dr);var _a=new Array(Os*2);xs(_a);var va=new Array(eB);xs(va);var Ea=new Array(Y2-X2+1);xs(Ea);var Om=new Array(Tm);xs(Om);var df=new Array(Os);xs(df);function _m(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(_m,"StaticTreeDesc");var NE,DE,CE;function Sm(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e}l(Sm,"TreeDesc");function IE(t){return t<256?va[t]:va[256+(t>>>7)]}l(IE,"d_code");function Fa(t,e){t.pending_buf[t.pending++]=e&255,t.pending_buf[t.pending++]=e>>>8&255}l(Fa,"put_short");function ut(t,e,r){t.bi_valid>bm-r?(t.bi_buf|=e<<t.bi_valid&65535,Fa(t,t.bi_buf),t.bi_buf=e>>bm-t.bi_valid,t.bi_valid+=r-bm):(t.bi_buf|=e<<t.bi_valid&65535,t.bi_valid+=r)}l(ut,"send_bits");function fr(t,e,r){ut(t,r[e*2],r[e*2+1])}l(fr,"send_code");function $E(t,e){var r=0;do r|=t&1,t>>>=1,r<<=1;while(--e>0);return r>>>1}l($E,"bi_reverse");function tB(t){t.bi_valid===16?(Fa(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(tB,"bi_flush");function rB(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<=Ui;d++)t.bl_count[d]=0;for(r[t.heap[t.heap_max]*2+1]=0,a=t.heap_max+1;a<RE;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(rB,"gen_bitlen");function BE(t,e,r){var i=new Array(Ui+1),n=0,s,o;for(s=1;s<=Ui;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]=$E(i[f]++,f))}}l(BE,"gen_codes");function iB(){var t,e,r,i,n,s=new Array(Ui+1);for(r=0,i=0;i<Tm-1;i++)for(Om[i]=r,t=0;t<1<<Em[i];t++)Ea[r++]=i;for(Ea[r-1]=i,n=0,i=0;i<16;i++)for(df[i]=n,t=0;t<1<<hf[i];t++)va[n++]=i;for(n>>=7;i<Os;i++)for(df[i]=n<<7,t=0;t<1<<hf[i]-7;t++)va[256+n++]=i;for(e=0;e<=Ui;e++)s[e]=0;for(t=0;t<=143;)Dr[t*2+1]=8,t++,s[8]++;for(;t<=255;)Dr[t*2+1]=9,t++,s[9]++;for(;t<=279;)Dr[t*2+1]=7,t++,s[7]++;for(;t<=287;)Dr[t*2+1]=8,t++,s[8]++;for(BE(Dr,Sa+1,s),t=0;t<Os;t++)_a[t*2+1]=5,_a[t*2]=$E(t,5);NE=new _m(Dr,Em,Ta+1,Sa,Ui),DE=new _m(_a,hf,0,Os,Ui),CE=new _m(new Array(0),Q2,0,km,Z2)}l(iB,"tr_static_init");function ME(t){var e;for(e=0;e<Sa;e++)t.dyn_ltree[e*2]=0;for(e=0;e<Os;e++)t.dyn_dtree[e*2]=0;for(e=0;e<km;e++)t.bl_tree[e*2]=0;t.dyn_ltree[Rm*2]=1,t.opt_len=t.static_len=0,t.last_lit=t.matches=0}l(ME,"init_block");function LE(t){t.bi_valid>8?Fa(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(LE,"bi_windup");function nB(t,e,r,i){LE(t),i&&(Fa(t,r),Fa(t,~r)),H2.arraySet(t.pending_buf,t.window,e,r,t.pending),t.pending+=r}l(nB,"copy_block");function SE(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(SE,"smaller");function vm(t,e,r){for(var i=t.heap[r],n=r<<1;n<=t.heap_len&&(n<t.heap_len&&SE(e,t.heap[n+1],t.heap[n],t.depth)&&n++,!SE(e,i,t.heap[n],t.depth));)t.heap[r]=t.heap[n],r=n,n<<=1;t.heap[r]=i}l(vm,"pqdownheap");function vE(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=Ea[n],fr(t,o+Ta+1,e),f=Em[o],f!==0&&(n-=Om[o],ut(t,n,f)),i--,o=IE(i),fr(t,o,r),f=hf[o],f!==0&&(i-=df[o],ut(t,i,f)));while(s<t.last_lit);fr(t,Rm,e)}l(vE,"compress_block");function Fm(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=RE,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--)vm(t,r,o);a=s;do o=t.heap[1],t.heap[1]=t.heap[t.heap_len--],vm(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++,vm(t,r,1);while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],rB(t,e),BE(r,c,t.bl_count)}l(Fm,"build_tree");function EE(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[OE*2]++):f<=10?t.bl_tree[xE*2]++:t.bl_tree[AE*2]++,f=0,n=s,o===0?(c=138,a=3):s===o?(c=6,a=3):(c=7,a=4))}l(EE,"scan_tree");function FE(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,OE,t.bl_tree),ut(t,f-3,2)):f<=10?(fr(t,xE,t.bl_tree),ut(t,f-3,3)):(fr(t,AE,t.bl_tree),ut(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(FE,"send_tree");function sB(t){var e;for(EE(t,t.dyn_ltree,t.l_desc.max_code),EE(t,t.dyn_dtree,t.d_desc.max_code),Fm(t,t.bl_desc),e=km-1;e>=3&&t.bl_tree[PE[e]*2+1]===0;e--);return t.opt_len+=3*(e+1)+5+5+4,e}l(sB,"build_bl_tree");function oB(t,e,r,i){var n;for(ut(t,e-257,5),ut(t,r-1,5),ut(t,i-4,4),n=0;n<i;n++)ut(t,t.bl_tree[PE[n]*2+1],3);FE(t,t.dyn_ltree,e-1),FE(t,t.dyn_dtree,r-1)}l(oB,"send_all_trees");function aB(t){var e=4093624447,r;for(r=0;r<=31;r++,e>>>=1)if(e&1&&t.dyn_ltree[r*2]!==0)return bE;if(t.dyn_ltree[9*2]!==0||t.dyn_ltree[10*2]!==0||t.dyn_ltree[13*2]!==0)return _E;for(r=32;r<Ta;r++)if(t.dyn_ltree[r*2]!==0)return _E;return bE}l(aB,"detect_data_type");var TE=!1;function cB(t){TE||(iB(),TE=!0),t.l_desc=new Sm(t.dyn_ltree,NE),t.d_desc=new Sm(t.dyn_dtree,DE),t.bl_desc=new Sm(t.bl_tree,CE),t.bi_buf=0,t.bi_valid=0,ME(t)}l(cB,"_tr_init");function jE(t,e,r,i){ut(t,(J2<<1)+(i?1:0),3),nB(t,e,r,!0)}l(jE,"_tr_stored_block");function lB(t){ut(t,kE<<1,3),fr(t,Rm,Dr),tB(t)}l(lB,"_tr_align");function fB(t,e,r,i){var n,s,o=0;t.level>0?(t.strm.data_type===G2&&(t.strm.data_type=aB(t)),Fm(t,t.l_desc),Fm(t,t.d_desc),o=sB(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?jE(t,e,r,i):t.strategy===V2||s===n?(ut(t,(kE<<1)+(i?1:0),3),vE(t,Dr,_a)):(ut(t,(K2<<1)+(i?1:0),3),oB(t,t.l_desc.max_code+1,t.d_desc.max_code+1,o+1),vE(t,t.dyn_ltree,t.dyn_dtree)),ME(t),i&&LE(t)}l(fB,"_tr_flush_block");function uB(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[(Ea[r]+Ta+1)*2]++,t.dyn_dtree[IE(e)*2]++),t.last_lit===t.lit_bufsize-1}l(uB,"_tr_tally");As._tr_init=cB;As._tr_stored_block=jE;As._tr_flush_block=fB;As._tr_tally=uB;As._tr_align=lB});var xm=T((hK,UE)=>{"use strict";function hB(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(hB,"adler32");UE.exports=hB});var Am=T((pK,WE)=>{"use strict";function dB(){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(dB,"makeTable");var pB=dB();function mB(t,e,r,i){var n=pB,s=i+r;t^=-1;for(var o=i;o<s;o++)t=t>>>8^n[(t^e[o])&255];return t^-1}l(mB,"crc32");WE.exports=mB});var pf=T((wK,zE)=>{"use strict";zE.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 QE=T(dr=>{"use strict";var st=Nr(),Dt=qE(),JE=xm(),Qr=Am(),wB=pf(),Vi=0,yB=1,gB=3,ni=4,HE=5,hr=0,VE=1,Ct=-2,bB=-3,Pm=-5,_B=-1,SB=1,mf=2,vB=3,EB=4,FB=0,TB=2,bf=8,kB=9,RB=15,OB=8,xB=29,AB=256,Dm=AB+1+xB,PB=30,NB=19,DB=2*Dm+1,CB=15,Z=3,ri=258,Kt=ri+Z+1,IB=32,_f=42,Cm=69,wf=73,yf=91,gf=103,Wi=113,Ra=666,De=1,Oa=2,zi=3,Ds=4,$B=3;function ii(t,e){return t.msg=wB[e],e}l(ii,"err");function GE(t){return(t<<1)-(t>4?9:0)}l(GE,"rank");function ti(t){for(var e=t.length;--e>=0;)t[e]=0}l(ti,"zero");function ei(t){var e=t.state,r=e.pending;r>t.avail_out&&(r=t.avail_out),r!==0&&(st.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(ei,"flush_pending");function ze(t,e){Dt._tr_flush_block(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,ei(t.strm)}l(ze,"flush_block_only");function se(t,e){t.pending_buf[t.pending++]=e}l(se,"put_byte");function ka(t,e){t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=e&255}l(ka,"putShortMSB");function BB(t,e,r,i){var n=t.avail_in;return n>i&&(n=i),n===0?0:(t.avail_in-=n,st.arraySet(e,t.input,t.next_in,n,r),t.state.wrap===1?t.adler=JE(t.adler,e,n,r):t.state.wrap===2&&(t.adler=Qr(t.adler,e,n,r)),t.next_in+=n,t.total_in+=n,n)}l(BB,"read_buf");function KE(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-Kt?t.strstart-(t.w_size-Kt):0,a=t.window,u=t.w_mask,h=t.prev,d=t.strstart+ri,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=ri-(d-i),i=d-ri,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(KE,"longest_match");function Hi(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-Kt)){st.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=BB(t.strm,t.window,t.strstart+t.lookahead,s),t.lookahead+=i,t.lookahead+t.insert>=Z)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+Z-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<Z)););}while(t.lookahead<Kt&&t.strm.avail_in!==0)}l(Hi,"fill_window");function MB(t,e){var r=65535;for(r>t.pending_buf_size-5&&(r=t.pending_buf_size-5);;){if(t.lookahead<=1){if(Hi(t),t.lookahead===0&&e===Vi)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,ze(t,!1),t.strm.avail_out===0)||t.strstart-t.block_start>=t.w_size-Kt&&(ze(t,!1),t.strm.avail_out===0))return De}return t.insert=0,e===ni?(ze(t,!0),t.strm.avail_out===0?zi:Ds):(t.strstart>t.block_start&&(ze(t,!1),t.strm.avail_out===0),De)}l(MB,"deflate_stored");function Nm(t,e){for(var r,i;;){if(t.lookahead<Kt){if(Hi(t),t.lookahead<Kt&&e===Vi)return De;if(t.lookahead===0)break}if(r=0,t.lookahead>=Z&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+Z-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-Kt&&(t.match_length=KE(t,r)),t.match_length>=Z)if(i=Dt._tr_tally(t,t.strstart-t.match_start,t.match_length-Z),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=Z){t.match_length--;do t.strstart++,t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+Z-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=Dt._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++;if(i&&(ze(t,!1),t.strm.avail_out===0))return De}return t.insert=t.strstart<Z-1?t.strstart:Z-1,e===ni?(ze(t,!0),t.strm.avail_out===0?zi:Ds):t.last_lit&&(ze(t,!1),t.strm.avail_out===0)?De:Oa}l(Nm,"deflate_fast");function Ps(t,e){for(var r,i,n;;){if(t.lookahead<Kt){if(Hi(t),t.lookahead<Kt&&e===Vi)return De;if(t.lookahead===0)break}if(r=0,t.lookahead>=Z&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+Z-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=Z-1,r!==0&&t.prev_length<t.max_lazy_match&&t.strstart-r<=t.w_size-Kt&&(t.match_length=KE(t,r),t.match_length<=5&&(t.strategy===SB||t.match_length===Z&&t.strstart-t.match_start>4096)&&(t.match_length=Z-1)),t.prev_length>=Z&&t.match_length<=t.prev_length){n=t.strstart+t.lookahead-Z,i=Dt._tr_tally(t,t.strstart-1-t.prev_match,t.prev_length-Z),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+Z-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=Z-1,t.strstart++,i&&(ze(t,!1),t.strm.avail_out===0))return De}else if(t.match_available){if(i=Dt._tr_tally(t,0,t.window[t.strstart-1]),i&&ze(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=Dt._tr_tally(t,0,t.window[t.strstart-1]),t.match_available=0),t.insert=t.strstart<Z-1?t.strstart:Z-1,e===ni?(ze(t,!0),t.strm.avail_out===0?zi:Ds):t.last_lit&&(ze(t,!1),t.strm.avail_out===0)?De:Oa}l(Ps,"deflate_slow");function LB(t,e){for(var r,i,n,s,o=t.window;;){if(t.lookahead<=ri){if(Hi(t),t.lookahead<=ri&&e===Vi)return De;if(t.lookahead===0)break}if(t.match_length=0,t.lookahead>=Z&&t.strstart>0&&(n=t.strstart-1,i=o[n],i===o[++n]&&i===o[++n]&&i===o[++n])){s=t.strstart+ri;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=ri-(s-n),t.match_length>t.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=Z?(r=Dt._tr_tally(t,1,t.match_length-Z),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(r=Dt._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),r&&(ze(t,!1),t.strm.avail_out===0))return De}return t.insert=0,e===ni?(ze(t,!0),t.strm.avail_out===0?zi:Ds):t.last_lit&&(ze(t,!1),t.strm.avail_out===0)?De:Oa}l(LB,"deflate_rle");function jB(t,e){for(var r;;){if(t.lookahead===0&&(Hi(t),t.lookahead===0)){if(e===Vi)return De;break}if(t.match_length=0,r=Dt._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,r&&(ze(t,!1),t.strm.avail_out===0))return De}return t.insert=0,e===ni?(ze(t,!0),t.strm.avail_out===0?zi:Ds):t.last_lit&&(ze(t,!1),t.strm.avail_out===0)?De:Oa}l(jB,"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 Ns;Ns=[new ur(0,0,0,0,MB),new ur(4,4,8,4,Nm),new ur(4,5,16,8,Nm),new ur(4,6,32,32,Nm),new ur(4,4,16,16,Ps),new ur(8,16,32,32,Ps),new ur(8,16,128,128,Ps),new ur(8,32,128,256,Ps),new ur(32,128,258,1024,Ps),new ur(32,258,258,4096,Ps)];function qB(t){t.window_size=2*t.w_size,ti(t.head),t.max_lazy_match=Ns[t.level].max_lazy,t.good_match=Ns[t.level].good_length,t.nice_match=Ns[t.level].nice_length,t.max_chain_length=Ns[t.level].max_chain,t.strstart=0,t.block_start=0,t.lookahead=0,t.insert=0,t.match_length=t.prev_length=Z-1,t.match_available=0,t.ins_h=0}l(qB,"lm_init");function UB(){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=bf,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 st.Buf16(DB*2),this.dyn_dtree=new st.Buf16((2*PB+1)*2),this.bl_tree=new st.Buf16((2*NB+1)*2),ti(this.dyn_ltree),ti(this.dyn_dtree),ti(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new st.Buf16(CB+1),this.heap=new st.Buf16(2*Dm+1),ti(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new st.Buf16(2*Dm+1),ti(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(UB,"DeflateState");function XE(t){var e;return!t||!t.state?ii(t,Ct):(t.total_in=t.total_out=0,t.data_type=TB,e=t.state,e.pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=e.wrap?_f:Wi,t.adler=e.wrap===2?0:1,e.last_flush=Vi,Dt._tr_init(e),hr)}l(XE,"deflateResetKeep");function YE(t){var e=XE(t);return e===hr&&qB(t.state),e}l(YE,"deflateReset");function WB(t,e){return!t||!t.state||t.state.wrap!==2?Ct:(t.state.gzhead=e,hr)}l(WB,"deflateSetHeader");function ZE(t,e,r,i,n,s){if(!t)return Ct;var o=1;if(e===_B&&(e=6),i<0?(o=0,i=-i):i>15&&(o=2,i-=16),n<1||n>kB||r!==bf||i<8||i>15||e<0||e>9||s<0||s>EB)return ii(t,Ct);i===8&&(i=9);var f=new UB;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+Z-1)/Z),f.window=new st.Buf8(f.w_size*2),f.head=new st.Buf16(f.hash_size),f.prev=new st.Buf16(f.w_size),f.lit_bufsize=1<<n+6,f.pending_buf_size=f.lit_bufsize*4,f.pending_buf=new st.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,YE(t)}l(ZE,"deflateInit2");function zB(t,e){return ZE(t,e,bf,RB,OB,FB)}l(zB,"deflateInit");function HB(t,e){var r,i,n,s;if(!t||!t.state||e>HE||e<0)return t?ii(t,Ct):Ct;if(i=t.state,!t.output||!t.input&&t.avail_in!==0||i.status===Ra&&e!==ni)return ii(t,t.avail_out===0?Pm:Ct);if(i.strm=t,r=i.last_flush,i.last_flush=e,i.status===_f)if(i.wrap===2)t.adler=0,se(i,31),se(i,139),se(i,8),i.gzhead?(se(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)),se(i,i.gzhead.time&255),se(i,i.gzhead.time>>8&255),se(i,i.gzhead.time>>16&255),se(i,i.gzhead.time>>24&255),se(i,i.level===9?2:i.strategy>=mf||i.level<2?4:0),se(i,i.gzhead.os&255),i.gzhead.extra&&i.gzhead.extra.length&&(se(i,i.gzhead.extra.length&255),se(i,i.gzhead.extra.length>>8&255)),i.gzhead.hcrc&&(t.adler=Qr(t.adler,i.pending_buf,i.pending,0)),i.gzindex=0,i.status=Cm):(se(i,0),se(i,0),se(i,0),se(i,0),se(i,0),se(i,i.level===9?2:i.strategy>=mf||i.level<2?4:0),se(i,$B),i.status=Wi);else{var o=bf+(i.w_bits-8<<4)<<8,f=-1;i.strategy>=mf||i.level<2?f=0:i.level<6?f=1:i.level===6?f=2:f=3,o|=f<<6,i.strstart!==0&&(o|=IB),o+=31-o%31,i.status=Wi,ka(i,o),i.strstart!==0&&(ka(i,t.adler>>>16),ka(i,t.adler&65535)),t.adler=1}if(i.status===Cm)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=Qr(t.adler,i.pending_buf,i.pending-n,n)),ei(t),n=i.pending,i.pending===i.pending_buf_size));)se(i,i.gzhead.extra[i.gzindex]&255),i.gzindex++;i.gzhead.hcrc&&i.pending>n&&(t.adler=Qr(t.adler,i.pending_buf,i.pending-n,n)),i.gzindex===i.gzhead.extra.length&&(i.gzindex=0,i.status=wf)}else i.status=wf;if(i.status===wf)if(i.gzhead.name){n=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>n&&(t.adler=Qr(t.adler,i.pending_buf,i.pending-n,n)),ei(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,se(i,s)}while(s!==0);i.gzhead.hcrc&&i.pending>n&&(t.adler=Qr(t.adler,i.pending_buf,i.pending-n,n)),s===0&&(i.gzindex=0,i.status=yf)}else i.status=yf;if(i.status===yf)if(i.gzhead.comment){n=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>n&&(t.adler=Qr(t.adler,i.pending_buf,i.pending-n,n)),ei(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,se(i,s)}while(s!==0);i.gzhead.hcrc&&i.pending>n&&(t.adler=Qr(t.adler,i.pending_buf,i.pending-n,n)),s===0&&(i.status=gf)}else i.status=gf;if(i.status===gf&&(i.gzhead.hcrc?(i.pending+2>i.pending_buf_size&&ei(t),i.pending+2<=i.pending_buf_size&&(se(i,t.adler&255),se(i,t.adler>>8&255),t.adler=0,i.status=Wi)):i.status=Wi),i.pending!==0){if(ei(t),t.avail_out===0)return i.last_flush=-1,hr}else if(t.avail_in===0&&GE(e)<=GE(r)&&e!==ni)return ii(t,Pm);if(i.status===Ra&&t.avail_in!==0)return ii(t,Pm);if(t.avail_in!==0||i.lookahead!==0||e!==Vi&&i.status!==Ra){var c=i.strategy===mf?jB(i,e):i.strategy===vB?LB(i,e):Ns[i.level].func(i,e);if((c===zi||c===Ds)&&(i.status=Ra),c===De||c===zi)return t.avail_out===0&&(i.last_flush=-1),hr;if(c===Oa&&(e===yB?Dt._tr_align(i):e!==HE&&(Dt._tr_stored_block(i,0,0,!1),e===gB&&(ti(i.head),i.lookahead===0&&(i.strstart=0,i.block_start=0,i.insert=0))),ei(t),t.avail_out===0))return i.last_flush=-1,hr}return e!==ni?hr:i.wrap<=0?VE:(i.wrap===2?(se(i,t.adler&255),se(i,t.adler>>8&255),se(i,t.adler>>16&255),se(i,t.adler>>24&255),se(i,t.total_in&255),se(i,t.total_in>>8&255),se(i,t.total_in>>16&255),se(i,t.total_in>>24&255)):(ka(i,t.adler>>>16),ka(i,t.adler&65535)),ei(t),i.wrap>0&&(i.wrap=-i.wrap),i.pending!==0?hr:VE)}l(HB,"deflate");function VB(t){var e;return!t||!t.state?Ct:(e=t.state.status,e!==_f&&e!==Cm&&e!==wf&&e!==yf&&e!==gf&&e!==Wi&&e!==Ra?ii(t,Ct):(t.state=null,e===Wi?ii(t,bB):hr))}l(VB,"deflateEnd");function GB(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!==_f||i.lookahead))return Ct;for(o===1&&(t.adler=JE(t.adler,e,r,0)),i.wrap=0,r>=i.w_size&&(o===0&&(ti(i.head),i.strstart=0,i.block_start=0,i.insert=0),u=new st.Buf8(i.w_size),st.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,Hi(i);i.lookahead>=Z;){n=i.strstart,s=i.lookahead-(Z-1);do i.ins_h=(i.ins_h<<i.hash_shift^i.window[n+Z-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=Z-1,Hi(i)}return i.strstart+=i.lookahead,i.block_start=i.strstart,i.insert=i.lookahead,i.lookahead=0,i.match_length=i.prev_length=Z-1,i.match_available=0,t.next_in=c,t.input=a,t.avail_in=f,i.wrap=o,hr}l(GB,"deflateSetDictionary");dr.deflateInit=zB;dr.deflateInit2=ZE;dr.deflateReset=YE;dr.deflateResetKeep=XE;dr.deflateSetHeader=WB;dr.deflate=HB;dr.deflateEnd=VB;dr.deflateSetDictionary=GB;dr.deflateInfo="pako deflate (from Nodeca project)"});var Im=T(Cs=>{"use strict";var Sf=Nr(),eF=!0,tF=!0;try{String.fromCharCode.apply(null,[0])}catch{eF=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{tF=!1}var xa=new Sf.Buf8(256);for(Cr=0;Cr<256;Cr++)xa[Cr]=Cr>=252?6:Cr>=248?5:Cr>=240?4:Cr>=224?3:Cr>=192?2:1;var Cr;xa[254]=xa[254]=1;Cs.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 Sf.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 rF(t,e){if(e<65534&&(t.subarray&&tF||!t.subarray&&eF))return String.fromCharCode.apply(null,Sf.shrinkBuf(t,e));for(var r="",i=0;i<e;i++)r+=String.fromCharCode(t[i]);return r}l(rF,"buf2binstring");Cs.buf2binstring=function(t){return rF(t,t.length)};Cs.binstring2buf=function(t){for(var e=new Sf.Buf8(t.length),r=0,i=e.length;r<i;r++)e[r]=t.charCodeAt(r);return e};Cs.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=xa[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 rF(f,i)};Cs.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+xa[t[r]]>e?r:e}});var $m=T((SK,iF)=>{"use strict";function JB(){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(JB,"ZStream");iF.exports=JB});var aF=T(Na=>{"use strict";var Aa=QE(),Pa=Nr(),Mm=Im(),Lm=pf(),KB=$m(),oF=Object.prototype.toString,XB=0,Bm=4,Is=0,nF=1,sF=2,YB=-1,ZB=0,QB=8;function Gi(t){if(!(this instanceof Gi))return new Gi(t);this.options=Pa.assign({level:YB,method:QB,chunkSize:16384,windowBits:15,memLevel:8,strategy:ZB,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 KB,this.strm.avail_out=0;var r=Aa.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(r!==Is)throw new Error(Lm[r]);if(e.header&&Aa.deflateSetHeader(this.strm,e.header),e.dictionary){var i;if(typeof e.dictionary=="string"?i=Mm.string2buf(e.dictionary):oF.call(e.dictionary)==="[object ArrayBuffer]"?i=new Uint8Array(e.dictionary):i=e.dictionary,r=Aa.deflateSetDictionary(this.strm,i),r!==Is)throw new Error(Lm[r]);this._dict_set=!0}}l(Gi,"Deflate");Gi.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?Bm:XB,typeof t=="string"?r.input=Mm.string2buf(t):oF.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 Pa.Buf8(i),r.next_out=0,r.avail_out=i),n=Aa.deflate(r,s),n!==nF&&n!==Is)return this.onEnd(n),this.ended=!0,!1;(r.avail_out===0||r.avail_in===0&&(s===Bm||s===sF))&&(this.options.to==="string"?this.onData(Mm.buf2binstring(Pa.shrinkBuf(r.output,r.next_out))):this.onData(Pa.shrinkBuf(r.output,r.next_out)))}while((r.avail_in>0||r.avail_out===0)&&n!==nF);return s===Bm?(n=Aa.deflateEnd(this.strm),this.onEnd(n),this.ended=!0,n===Is):(s===sF&&(this.onEnd(Is),r.avail_out=0),!0)};Gi.prototype.onData=function(t){this.chunks.push(t)};Gi.prototype.onEnd=function(t){t===Is&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=Pa.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};function jm(t,e){var r=new Gi(e);if(r.push(t,!0),r.err)throw r.msg||Lm[r.err];return r.result}l(jm,"deflate");function eM(t,e){return e=e||{},e.raw=!0,jm(t,e)}l(eM,"deflateRaw");function tM(t,e){return e=e||{},e.gzip=!0,jm(t,e)}l(tM,"gzip");Na.Deflate=Gi;Na.deflate=jm;Na.deflateRaw=eM;Na.gzip=tM});var lF=T((TK,cF)=>{"use strict";var vf=30,rM=12;cF.exports=l(function(e,r){var i,n,s,o,f,c,a,u,h,d,p,m,w,y,b,_,F,E,R,D,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,b=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){D=E&65535,R&=15,R&&(w<R&&(m+=A[n++]<<w,w+=8),D+=m&(1<<R)-1,m>>>=R,w-=R),w<15&&(m+=A[n++]<<w,w+=8,m+=A[n++]<<w,w+=8),E=b[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=vf;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=vf;break e}if(O=0,v=p,d===0){if(O+=u-R,R<D){D-=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<D){D-=R;do x[o++]=p[O++];while(--R);if(O=0,d<D){R=d,D-=R;do x[o++]=p[O++];while(--R);O=o-S,v=x}}}else if(O+=d-R,R<D){D-=R;do x[o++]=p[O++];while(--R);O=o-S,v=x}for(;D>2;)x[o++]=v[O++],x[o++]=v[O++],x[o++]=v[O++],D-=3;D&&(x[o++]=v[O++],D>1&&(x[o++]=v[O++]))}else{O=o-S;do x[o++]=x[O++],x[o++]=x[O++],x[o++]=x[O++],D-=3;while(D>2);D&&(x[o++]=x[O++],D>1&&(x[o++]=x[O++]))}}else if(R&64){e.msg="invalid distance code",i.mode=vf;break e}else{E=b[(E&65535)+(m&(1<<R)-1)];continue r}break}}else if(R&64)if(R&32){i.mode=rM;break e}else{e.msg="invalid literal/length code",i.mode=vf;break e}else{E=y[(E&65535)+(m&(1<<R)-1)];continue t}break}}while(n<s&&o<c);D=w>>3,n-=D,w-=D<<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 wF=T((RK,mF)=>{"use strict";var fF=Nr(),$s=15,uF=852,hF=592,dF=0,qm=1,pF=2,iM=[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],nM=[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],sM=[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],oM=[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];mF.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,b=0,_=0,F=0,E,R,D,S,O,v=null,A=0,x,I=new fF.Buf16($s+1),M=new fF.Buf16($s+1),H=null,Te=0,ft,zt,Ht;for(u=0;u<=$s;u++)I[u]=0;for(h=0;h<n;h++)I[r[i+h]]++;for(m=a,p=$s;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),b=1,u=1;u<=$s;u++)if(b<<=1,b-=I[u],b<0)return-1;if(b>0&&(e===dF||p!==1))return-1;for(M[1]=0,u=1;u<$s;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===dF?(v=H=f,x=19):e===qm?(v=iM,A-=257,H=nM,Te-=257,x=256):(v=sM,H=oM,x=-1),F=0,h=0,u=d,O=o,w=m,y=0,D=-1,_=1<<m,S=_-1,e===qm&&_>uF||e===pF&&_>hF)return 1;for(;;){ft=u-y,f[h]<x?(zt=0,Ht=f[h]):f[h]>x?(zt=H[Te+f[h]],Ht=v[A+f[h]]):(zt=96,Ht=0),E=1<<u-y,R=1<<w,d=R;do R-=E,s[O+(F>>y)+R]=ft<<24|zt<<16|Ht|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)!==D){for(y===0&&(y=m),O+=d,w=u-y,b=1<<w;w+y<p&&(b-=I[w+y],!(b<=0));)w++,b<<=1;if(_+=1<<w,e===qm&&_>uF||e===pF&&_>hF)return 1;D=F&S,s[D]=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 YF=T(Xt=>{"use strict";var vt=Nr(),Gm=xm(),pr=Am(),aM=lF(),Da=wF(),cM=0,UF=1,WF=2,yF=4,lM=5,Ef=6,Ji=0,fM=1,uM=2,It=-2,zF=-3,Jm=-4,hM=-5,gF=8,HF=1,bF=2,_F=3,SF=4,vF=5,EF=6,FF=7,TF=8,kF=9,RF=10,kf=11,Ir=12,Um=13,OF=14,Wm=15,xF=16,AF=17,PF=18,NF=19,Ff=20,Tf=21,DF=22,CF=23,IF=24,$F=25,BF=26,zm=27,MF=28,LF=29,we=30,Km=31,dM=32,pM=852,mM=592,wM=15,yM=wM;function jF(t){return(t>>>24&255)+(t>>>8&65280)+((t&65280)<<8)+((t&255)<<24)}l(jF,"zswap32");function gM(){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 vt.Buf16(320),this.work=new vt.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}l(gM,"InflateState");function VF(t){var e;return!t||!t.state?It:(e=t.state,t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=e.wrap&1),e.mode=HF,e.last=0,e.havedict=0,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new vt.Buf32(pM),e.distcode=e.distdyn=new vt.Buf32(mM),e.sane=1,e.back=-1,Ji)}l(VF,"inflateResetKeep");function GF(t){var e;return!t||!t.state?It:(e=t.state,e.wsize=0,e.whave=0,e.wnext=0,VF(t))}l(GF,"inflateReset");function JF(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))?It:(i.window!==null&&i.wbits!==e&&(i.window=null),i.wrap=r,i.wbits=e,GF(t))}l(JF,"inflateReset2");function KF(t,e){var r,i;return t?(i=new gM,t.state=i,i.window=null,r=JF(t,e),r!==Ji&&(t.state=null),r):It}l(KF,"inflateInit2");function bM(t){return KF(t,yM)}l(bM,"inflateInit");var qF=!0,Hm,Vm;function _M(t){if(qF){var e;for(Hm=new vt.Buf32(512),Vm=new vt.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(Da(UF,t.lens,0,288,Hm,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;Da(WF,t.lens,0,32,Vm,0,t.work,{bits:5}),qF=!1}t.lencode=Hm,t.lenbits=9,t.distcode=Vm,t.distbits=5}l(_M,"fixedtables");function XF(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 vt.Buf8(s.wsize)),i>=s.wsize?(vt.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),vt.arraySet(s.window,e,r-i,n,s.wnext),i-=n,i?(vt.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(XF,"updatewindow");function SM(t,e){var r,i,n,s,o,f,c,a,u,h,d,p,m,w,y=0,b,_,F,E,R,D,S,O,v=new vt.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 It;r=t.state,r.mode===Ir&&(r.mode=Um),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=Ji;e:for(;;)switch(r.mode){case HF:if(r.wrap===0){r.mode=Um;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=bF;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=we;break}if((a&15)!==gF){t.msg="unknown compression method",r.mode=we;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=we;break}r.dmax=1<<S,t.adler=r.check=1,r.mode=a&512?RF:Ir,a=0,u=0;break;case bF:for(;u<16;){if(f===0)break e;f--,a+=i[s++]<<u,u+=8}if(r.flags=a,(r.flags&255)!==gF){t.msg="unknown compression method",r.mode=we;break}if(r.flags&57344){t.msg="unknown header flags set",r.mode=we;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=_F;case _F: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=SF;case SF: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=vF;case vF: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=EF;case EF: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)),vt.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=FF;case FF: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=TF;case TF: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=kF;case kF: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=we;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=Ir;break;case RF:for(;u<32;){if(f===0)break e;f--,a+=i[s++]<<u,u+=8}t.adler=r.check=jF(a),a=0,u=0,r.mode=kf;case kf: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,uM;t.adler=r.check=1,r.mode=Ir;case Ir:if(e===lM||e===Ef)break e;case Um:if(r.last){a>>>=u&7,u-=u&7,r.mode=zm;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=OF;break;case 1:if(_M(r),r.mode=Ff,e===Ef){a>>>=2,u-=2;break e}break;case 2:r.mode=AF;break;case 3:t.msg="invalid block type",r.mode=we}a>>>=2,u-=2;break;case OF: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=we;break}if(r.length=a&65535,a=0,u=0,r.mode=Wm,e===Ef)break e;case Wm:r.mode=xF;case xF:if(p=r.length,p){if(p>f&&(p=f),p>c&&(p=c),p===0)break e;vt.arraySet(n,i,s,p,o),f-=p,s+=p,c-=p,o+=p,r.length-=p;break}r.mode=Ir;break;case AF: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=we;break}r.have=0,r.mode=PF;case PF: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=Da(cM,r.lens,0,19,r.lencode,0,r.work,A),r.lenbits=A.bits,O){t.msg="invalid code lengths set",r.mode=we;break}r.have=0,r.mode=NF;case NF:for(;r.have<r.nlen+r.ndist;){for(;y=r.lencode[a&(1<<r.lenbits)-1],b=y>>>24,_=y>>>16&255,F=y&65535,!(b<=u);){if(f===0)break e;f--,a+=i[s++]<<u,u+=8}if(F<16)a>>>=b,u-=b,r.lens[r.have++]=F;else{if(F===16){for(x=b+2;u<x;){if(f===0)break e;f--,a+=i[s++]<<u,u+=8}if(a>>>=b,u-=b,r.have===0){t.msg="invalid bit length repeat",r.mode=we;break}S=r.lens[r.have-1],p=3+(a&3),a>>>=2,u-=2}else if(F===17){for(x=b+3;u<x;){if(f===0)break e;f--,a+=i[s++]<<u,u+=8}a>>>=b,u-=b,S=0,p=3+(a&7),a>>>=3,u-=3}else{for(x=b+7;u<x;){if(f===0)break e;f--,a+=i[s++]<<u,u+=8}a>>>=b,u-=b,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=we;break}for(;p--;)r.lens[r.have++]=S}}if(r.mode===we)break;if(r.lens[256]===0){t.msg="invalid code -- missing end-of-block",r.mode=we;break}if(r.lenbits=9,A={bits:r.lenbits},O=Da(UF,r.lens,0,r.nlen,r.lencode,0,r.work,A),r.lenbits=A.bits,O){t.msg="invalid literal/lengths set",r.mode=we;break}if(r.distbits=6,r.distcode=r.distdyn,A={bits:r.distbits},O=Da(WF,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,A),r.distbits=A.bits,O){t.msg="invalid distances set",r.mode=we;break}if(r.mode=Ff,e===Ef)break e;case Ff:r.mode=Tf;case Tf: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,aM(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===Ir&&(r.back=-1);break}for(r.back=0;y=r.lencode[a&(1<<r.lenbits)-1],b=y>>>24,_=y>>>16&255,F=y&65535,!(b<=u);){if(f===0)break e;f--,a+=i[s++]<<u,u+=8}if(_&&!(_&240)){for(E=b,R=_,D=F;y=r.lencode[D+((a&(1<<E+R)-1)>>E)],b=y>>>24,_=y>>>16&255,F=y&65535,!(E+b<=u);){if(f===0)break e;f--,a+=i[s++]<<u,u+=8}a>>>=E,u-=E,r.back+=E}if(a>>>=b,u-=b,r.back+=b,r.length=F,_===0){r.mode=BF;break}if(_&32){r.back=-1,r.mode=Ir;break}if(_&64){t.msg="invalid literal/length code",r.mode=we;break}r.extra=_&15,r.mode=DF;case DF: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=CF;case CF:for(;y=r.distcode[a&(1<<r.distbits)-1],b=y>>>24,_=y>>>16&255,F=y&65535,!(b<=u);){if(f===0)break e;f--,a+=i[s++]<<u,u+=8}if(!(_&240)){for(E=b,R=_,D=F;y=r.distcode[D+((a&(1<<E+R)-1)>>E)],b=y>>>24,_=y>>>16&255,F=y&65535,!(E+b<=u);){if(f===0)break e;f--,a+=i[s++]<<u,u+=8}a>>>=E,u-=E,r.back+=E}if(a>>>=b,u-=b,r.back+=b,_&64){t.msg="invalid distance code",r.mode=we;break}r.offset=F,r.extra=_&15,r.mode=IF;case IF: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=we;break}r.mode=$F;case $F: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=we;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=Tf);break;case BF:if(c===0)break e;n[o++]=r.length,c--,r.mode=Tf;break;case zm: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):Gm(r.check,n,d,o-d)),d=c,(r.flags?a:jF(a))!==r.check){t.msg="incorrect data check",r.mode=we;break}a=0,u=0}r.mode=MF;case MF: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=we;break}a=0,u=0}r.mode=LF;case LF:O=fM;break e;case we:O=zF;break e;case Km:return Jm;case dM:default:return It}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<we&&(r.mode<zm||e!==yF))&&XF(t,t.output,t.next_out,d-t.avail_out)?(r.mode=Km,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):Gm(r.check,n,d,t.next_out-d)),t.data_type=r.bits+(r.last?64:0)+(r.mode===Ir?128:0)+(r.mode===Ff||r.mode===Wm?256:0),(h===0&&d===0||e===yF)&&O===Ji&&(O=hM),O)}l(SM,"inflate");function vM(t){if(!t||!t.state)return It;var e=t.state;return e.window&&(e.window=null),t.state=null,Ji}l(vM,"inflateEnd");function EM(t,e){var r;return!t||!t.state||(r=t.state,!(r.wrap&2))?It:(r.head=e,e.done=!1,Ji)}l(EM,"inflateGetHeader");function FM(t,e){var r=e.length,i,n,s;return!t||!t.state||(i=t.state,i.wrap!==0&&i.mode!==kf)?It:i.mode===kf&&(n=1,n=Gm(n,e,r,0),n!==i.check)?zF:(s=XF(t,e,r,r),s?(i.mode=Km,Jm):(i.havedict=1,Ji))}l(FM,"inflateSetDictionary");Xt.inflateReset=GF;Xt.inflateReset2=JF;Xt.inflateResetKeep=VF;Xt.inflateInit=bM;Xt.inflateInit2=KF;Xt.inflate=SM;Xt.inflateEnd=vM;Xt.inflateGetHeader=EM;Xt.inflateSetDictionary=FM;Xt.inflateInfo="pako inflate (from Nodeca project)"});var Xm=T((PK,ZF)=>{"use strict";ZF.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 eT=T((NK,QF)=>{"use strict";function TM(){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(TM,"GZheader");QF.exports=TM});var rT=T(Ia=>{"use strict";var Bs=YF(),Ca=Nr(),Rf=Im(),ve=Xm(),Ym=pf(),kM=$m(),RM=eT(),tT=Object.prototype.toString;function Ki(t){if(!(this instanceof Ki))return new Ki(t);this.options=Ca.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 kM,this.strm.avail_out=0;var r=Bs.inflateInit2(this.strm,e.windowBits);if(r!==ve.Z_OK)throw new Error(Ym[r]);if(this.header=new RM,Bs.inflateGetHeader(this.strm,this.header),e.dictionary&&(typeof e.dictionary=="string"?e.dictionary=Rf.string2buf(e.dictionary):tT.call(e.dictionary)==="[object ArrayBuffer]"&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(r=Bs.inflateSetDictionary(this.strm,e.dictionary),r!==ve.Z_OK)))throw new Error(Ym[r])}l(Ki,"Inflate");Ki.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?ve.Z_FINISH:ve.Z_NO_FLUSH,typeof t=="string"?r.input=Rf.binstring2buf(t):tT.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 Ca.Buf8(i),r.next_out=0,r.avail_out=i),s=Bs.inflate(r,ve.Z_NO_FLUSH),s===ve.Z_NEED_DICT&&n&&(s=Bs.inflateSetDictionary(this.strm,n)),s===ve.Z_BUF_ERROR&&u===!0&&(s=ve.Z_OK,u=!1),s!==ve.Z_STREAM_END&&s!==ve.Z_OK)return this.onEnd(s),this.ended=!0,!1;r.next_out&&(r.avail_out===0||s===ve.Z_STREAM_END||r.avail_in===0&&(o===ve.Z_FINISH||o===ve.Z_SYNC_FLUSH))&&(this.options.to==="string"?(f=Rf.utf8border(r.output,r.next_out),c=r.next_out-f,a=Rf.buf2string(r.output,f),r.next_out=c,r.avail_out=i-c,c&&Ca.arraySet(r.output,r.output,f,c,0),this.onData(a)):this.onData(Ca.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!==ve.Z_STREAM_END);return s===ve.Z_STREAM_END&&(o=ve.Z_FINISH),o===ve.Z_FINISH?(s=Bs.inflateEnd(this.strm),this.onEnd(s),this.ended=!0,s===ve.Z_OK):(o===ve.Z_SYNC_FLUSH&&(this.onEnd(ve.Z_OK),r.avail_out=0),!0)};Ki.prototype.onData=function(t){this.chunks.push(t)};Ki.prototype.onEnd=function(t){t===ve.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=Ca.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};function Zm(t,e){var r=new Ki(e);if(r.push(t,!0),r.err)throw r.msg||Ym[r.err];return r.result}l(Zm,"inflate");function OM(t,e){return e=e||{},e.raw=!0,Zm(t,e)}l(OM,"inflateRaw");Ia.Inflate=Ki;Ia.inflate=Zm;Ia.inflateRaw=OM;Ia.ungzip=Zm});var sT=T(($K,nT)=>{"use strict";var xM=Nr().assign,AM=aF(),PM=rT(),NM=Xm(),iT={};xM(iT,AM,PM,NM);nT.exports=iT});var cT=T((BK,aT)=>{"use strict";var oT=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");aT.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):oT(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)?oT(o,e):o}return n}});var yT=T((LK,wT)=>{function lT(t){return Array.isArray(t)?t:[t]}l(lT,"makeArray");var tw="",fT=" ",Qm="\\",DM=/^\s+$/,CM=/(?:[^\\]|^)\\$/,IM=/^\\!/,$M=/^\\#/,BM=/\r?\n/g,MM=/^\.*\/|^\.+$/,ew="/",dT="node-ignore";typeof Symbol<"u"&&(dT=Symbol.for("node-ignore"));var uT=dT,LM=l((t,e,r)=>Object.defineProperty(t,e,{value:r}),"define"),jM=/([0-z])-([0-z])/g,pT=l(()=>!1,"RETURN_FALSE"),qM=l(t=>t.replace(jM,(e,r,i)=>r.charCodeAt(0)<=i.charCodeAt(0)?e:tw),"sanitizeRange"),UM=l(t=>{let{length:e}=t;return t.slice(0,e-e%2)},"cleanRangeBackSlash"),WM=[[/^\uFEFF/,()=>tw],[/((?:\\\\)*?)(\\?\s+)$/,(t,e,r)=>e+(r.indexOf("\\")===0?fT:tw)],[/(\\+?)\s/g,(t,e)=>{let{length:r}=e;return e.slice(0,r-r%2)+fT}],[/[\\$.|*+(){^]/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,()=>Qm],[/\\\\/g,()=>Qm],[/(\\)?\[([^\]/]*?)(\\*)($|\])/g,(t,e,r,i,n)=>e===Qm?`\\[${r}${UM(i)}${n}`:n==="]"&&i.length%2===0?`[${qM(r)}${i}]`:"[]"],[/(?:[^*])$/,t=>/\/$/.test(t)?`${t}$`:`${t}(?=$|\\/$)`],[/(\^|\\\/)?\\\*$/,(t,e)=>`${e?`${e}[^/]+`:"[^/]*"}(?=$|\\/$)`]],hT=Object.create(null),zM=l((t,e)=>{let r=hT[t];return r||(r=WM.reduce((i,[n,s])=>i.replace(n,s.bind(t)),t),hT[t]=r),e?new RegExp(r,"i"):new RegExp(r)},"makeRegex"),nw=l(t=>typeof t=="string","isString"),HM=l(t=>t&&nw(t)&&!DM.test(t)&&!CM.test(t)&&t.indexOf("#")!==0,"checkPattern"),VM=l(t=>t.split(BM),"splitPattern"),sw=class sw{constructor(e,r,i,n){this.origin=e,this.pattern=r,this.negative=i,this.regex=n}};l(sw,"IgnoreRule");var rw=sw,GM=l((t,e)=>{let r=t,i=!1;t.indexOf("!")===0&&(i=!0,t=t.substr(1)),t=t.replace(IM,"!").replace($M,"#");let n=zM(t,e);return new rw(r,t,i,n)},"createRule"),JM=l((t,e)=>{throw new e(t)},"throwError"),$r=l((t,e,r)=>nw(t)?t?$r.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"),mT=l(t=>MM.test(t),"isNotRelative");$r.isNotRelative=mT;$r.convert=t=>t;var ow=class ow{constructor({ignorecase:e=!0,ignoreCase:r=e,allowRelativePaths:i=!1}={}){LM(this,uT,!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[uT]){this._rules=this._rules.concat(e._rules),this._added=!0;return}if(HM(e)){let r=GM(e,this._ignoreCase);this._added=!0,this._rules.push(r)}}add(e){return this._added=!1,lT(nw(e)?VM(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&&$r.convert(e);return $r(s,e,this._allowRelativePaths?pT:JM),this._t(s,r,i,n)}_t(e,r,i,n){if(e in r)return r[e];if(n||(n=e.split(ew)),n.pop(),!n.length)return r[e]=this._testOne(e,i);let s=this._t(n.join(ew)+ew,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 lT(e).filter(this.createFilter())}test(e){return this._test(e,this._testCache,!0)}};l(ow,"Ignore");var iw=ow,Of=l(t=>new iw(t),"factory"),KM=l(t=>$r(t&&$r.convert(t),t,pT),"isPathValid");Of.isPathValid=KM;Of.default=Of;wT.exports=Of;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");$r.convert=t;let e=/^[a-z]:\//i;$r.isNotRelative=r=>e.test(r)||mT(r)}});var bT=T((qK,gT)=>{"use strict";function XM(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}l(XM,"escapeRegExp");function mr(t,e,r){return e=e instanceof RegExp?e:new RegExp(XM(e),"g"),t.replace(e,r)}l(mr,"replaceAll");var YM={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")};gT.exports=YM});var ST=T((WK,_T)=>{_T.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,b,_=l(function(){n>=s&&(y=r,b=n,r=i,i=y,n=s,s=b,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"),D=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,H;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,H=-A;H<=S-1;++H)v[H+c]=R(H,v[H-1+c]+1,v[H+1+c]);for(H=S+A;H>=S+1;--H)v[H+c]=R(H,v[H-1+c]+1,v[H+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;D(I)},"compose")}}});var FT=T((HK,ET)=>{var ZM=ST();function QM(t,e){var r=new ZM(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(QM,"longestCommonSubsequence");function vT(t,e){for(var r=[],i=t.length,n=e.length,s=QM(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(vT,"diffIndices");function eL(t,e,r){var i,n=vT(e,t),s=vT(e,r),o=[];function f(M,H){o.push([M.file1[0],H,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,H){return M[0]-H[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],b=y[0];if(b>w)break;w=Math.max(w,b+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],D=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(D,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(eL,"diff3MergeIndices");function tL(t,e,r){var i=[],n=[t,e,r],s=eL(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(tL,"diff3Merge");ET.exports=tL});var Fe=T(B=>{"use strict";Object.defineProperty(B,"__esModule",{value:!0});function pi(t){return t&&typeof t=="object"&&"default"in t?t.default:t}l(pi,"_interopDefault");var Ma=pi(tS()),GT=pi(wE()),rL=pi(gE()),Nw=pi(sT()),aw=pi(cT()),iL=pi(yT()),La=pi(bT()),nL=pi(FT()),qf=class qf 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 qf(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(qf,"BaseError");var ee=qf,Uf=class Uf extends ee{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=Uf.code,this.data={filepaths:e}}};l(Uf,"UnmergedPathsError");var ja=Uf;ja.code="UnmergedPathsError";var Wf=class Wf extends ee{constructor(e){super(`An internal error caused this command to fail.
10
+
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
+
13
+ Please file a bug report at https://github.com/isomorphic-git/isomorphic-git/issues with this error message: ${e}`),this.code=this.name=Wf.code,this.data={message:e}}};l(Wf,"InternalError");var z=Wf;z.code="InternalError";var zf=class zf extends ee{constructor(e){super(`The filepath "${e}" contains unsafe character sequences`),this.code=this.name=zf.code,this.data={filepath:e}}};l(zf,"UnsafeFilepathError");var qs=zf;qs.code="UnsafeFilepathError";var Lw=class Lw{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}};l(Lw,"BufferCursor");var $t=Lw;function ku(t,e){return-(t<e)||+(t>e)}l(ku,"compareStrings");function JT(t,e){return ku(t.path,e.path)}l(JT,"comparePath");function KT(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}l(KT,"normalizeMode");var wr=2**32;function TT(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]}l(TT,"SecondsNanoseconds");function Us(t){let[e,r]=TT(t.ctimeSeconds,t.ctimeNanoseconds,t.ctimeMs,t.ctime),[i,n]=TT(t.mtimeSeconds,t.mtimeNanoseconds,t.mtimeMs,t.mtime);return{ctimeSeconds:e%wr,ctimeNanoseconds:r%wr,mtimeSeconds:i%wr,mtimeNanoseconds:n%wr,dev:t.dev%wr,ino:t.ino%wr,mode:KT(t.mode%wr),uid:t.uid%wr,gid:t.gid%wr,size:t.size>-1?t.size%wr:0}}l(Us,"normalizeStats");function sL(t){let e="";for(let r of new Uint8Array(t))r<16&&(e+="0"),e+=r.toString(16);return e}l(sL,"toHex");var cw=null;async function Mr(t){return cw===null&&(cw=await aL()),cw?XT(t):oL(t)}l(Mr,"shasum");function oL(t){return new GT().update(t).digest("hex")}l(oL,"shasumSync");async function XT(t){let e=await crypto.subtle.digest("SHA-1",t);return sL(e)}l(XT,"subtleSHA1");async function aL(){try{return await XT(new Uint8Array([]))==="da39a3ee5e6b4b0d3255bfef95601890afd80709"}catch{}return!1}l(aL,"testSubtleSHA1");function cL(t){return{assumeValid:!!(t&32768),extended:!!(t&16384),stage:(t&12288)>>12,nameLength:t&4095}}l(cL,"parseCacheEntryFlags");function lL(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)}l(lL,"renderCacheEntryFlags");var oi=class oi{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 oi.fromBuffer(e);if(e===null)return new oi(null);throw new z("invalid type passed to GitIndex.from")}static async fromBuffer(e){if(e.length===0)throw new z("Index file is empty (.git/index)");let r=new oi,i=new $t(e),n=i.toString("utf8",4);if(n!=="DIRC")throw new z(`Invalid dircache magic file number: ${n}`);let s=await Mr(e.slice(0,-20)),o=e.slice(-20).toString("hex");if(o!==s)throw new z(`Invalid checksum in GitIndex buffer: expected ${o} but saw ${s}`);let f=i.readUInt32BE();if(f!==2)throw new z(`Unsupported dircache version: ${f}`);let c=i.readUInt32BE(),a=0;for(;!i.eof()&&a<c;){let u={};u.ctimeSeconds=i.readUInt32BE(),u.ctimeNanoseconds=i.readUInt32BE(),u.mtimeSeconds=i.readUInt32BE(),u.mtimeNanoseconds=i.readUInt32BE(),u.dev=i.readUInt32BE(),u.ino=i.readUInt32BE(),u.mode=i.readUInt32BE(),u.uid=i.readUInt32BE(),u.gid=i.readUInt32BE(),u.size=i.readUInt32BE(),u.oid=i.slice(20).toString("hex");let h=i.readUInt16BE();u.flags=cL(h);let d=e.indexOf(0,i.tell()+1)-i.tell();if(d<1)throw new z(`Got a path length of: ${d}`);if(u.path=i.toString("utf8",d),u.path.includes("..\\")||u.path.includes("../"))throw new qs(u.path);let p=8-(i.tell()-12)%8;for(p===0&&(p=8);p--;){let m=i.readUInt8();if(m!==0)throw new z(`Expected 1-8 null characters but got '${m}' after ${u.path}`);if(i.eof())throw new z("Unexpected end of file")}u.stages=[],r._addEntry(u),a++}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=Us(r);let s=Buffer.from(e),o={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(o),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 $t(n),o=Us(e);return s.writeUInt32BE(o.ctimeSeconds),s.writeUInt32BE(o.ctimeNanoseconds),s.writeUInt32BE(o.mtimeSeconds),s.writeUInt32BE(o.mtimeNanoseconds),s.writeUInt32BE(o.dev),s.writeUInt32BE(o.ino),s.writeUInt32BE(o.mode),s.writeUInt32BE(o.uid),s.writeUInt32BE(o.gid),s.writeUInt32BE(o.size),s.write(e.oid,20,"hex"),s.writeUInt16BE(lL(e)),s.write(e.path,r.length,"utf8"),n}async toObject(){let e=Buffer.alloc(12),r=new $t(e);r.write("DIRC",4,"utf8"),r.writeUInt32BE(2),r.writeUInt32BE(this.entriesFlat.length);let i=[];for(let f of this.entries)if(i.push(oi._entryToBuffer(f)),f.stages.length>1)for(let c of f.stages)c&&c!==f&&i.push(oi._entryToBuffer(c));i=await Promise.all(i);let n=Buffer.concat(i),s=Buffer.concat([e,n]),o=await Mr(s);return Buffer.concat([s,Buffer.from(o,"hex")])}};l(oi,"GitIndex");var _w=oi;function Pf(t,e,r=!0,i=!0){let n=Us(t),s=Us(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}l(Pf,"compareStats");var lw=null,fw=Symbol("IndexCache");function fL(){return{map:new Map,stats:new Map}}l(fL,"createCache");async function uL(t,e,r){let[i,n]=await Promise.all([t.lstat(e),t.read(e)]),s=await _w.from(n);r.map.set(e,s),r.stats.set(e,i)}l(uL,"updateCachedIndexFile");async function hL(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:Pf(i,n)}l(hL,"isIndexStale");var jw=class jw{static async acquire({fs:e,gitdir:r,cache:i,allowUnmerged:n=!0},s){i[fw]||(i[fw]=fL());let o=`${r}/index`;lw===null&&(lw=new Ma({maxPending:1/0}));let f,c=[];return await lw.acquire(o,async()=>{let a=i[fw];await hL(e,o,a)&&await uL(e,o,a);let u=a.map.get(o);if(c=u.unmergedPaths,c.length&&!n)throw new ja(c);if(f=await s(u),u._dirty){let h=await u.toObject();await e.write(o,h),a.stats.set(o,await e.lstat(o)),u._dirty=!1}}),f}};l(jw,"GitIndexManager");var Ee=jw;function Nf(t){let e=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\"));return e>-1&&(t=t.slice(e+1)),t}l(Nf,"basename");function Ws(t){let e=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\"));return e===-1?".":e===0?"/":t.slice(0,e)}l(Ws,"dirname");function YT(t){let e=new Map,r=l(function(n){if(!e.has(n)){let s={type:"tree",fullpath:n,basename:Nf(n),metadata:{},children:[]};e.set(n,s),s.parent=r(Ws(n)),s.parent&&s.parent!==s&&s.parent.children.push(s)}return e.get(n)},"mkdir"),i=l(function(n,s){if(!e.has(n)){let o={type:"blob",fullpath:n,basename:Nf(n),metadata:s,parent:r(Ws(n)),children:[]};o.parent&&o.parent.children.push(o),e.set(n,o)}return e.get(n)},"mkfile");r(".");for(let n of t)i(n.path,n);return e}l(YT,"flatFileListToDirectoryStructure");function dL(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 z(`Unexpected GitTree entry mode: ${t.toString(8)}`)}l(dL,"mode2type");var qw=class qw{constructor({fs:e,gitdir:r,cache:i}){var s;this.treePromise=Ee.acquire({fs:e,gitdir:r,cache:i},async function(o){return YT(o.entries)});let n=this;this.ConstructEntry=(s=class{constructor(f){this._fullpath=f,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)}},l(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(o=>o.fullpath);return s.sort(ku),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"?{}:Us(i.metadata);e._type=i.type==="tree"?"tree":dL(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}};l(qw,"GitWalkerIndex");var Sw=qw,Ru=Symbol("GitWalkSymbol");function tn(){let t=Object.create(null);return Object.defineProperty(t,Ru,{value:l(function({fs:e,gitdir:r,cache:i}){return new Sw({fs:e,gitdir:r,cache:i})},"value")}),Object.freeze(t),t}l(tn,"STAGE");var Hf=class Hf extends ee{constructor(e){super(`Could not find ${e}.`),this.code=this.name=Hf.code,this.data={what:e}}};l(Hf,"NotFoundError");var le=Hf;le.code="NotFoundError";var Vf=class Vf extends ee{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=Vf.code,this.data={oid:e,actual:r,expected:i,filepath:n}}};l(Vf,"ObjectTypeError");var ot=Vf;ot.code="ObjectTypeError";var Gf=class Gf extends ee{constructor(e){super(`Expected a 40-char hex object id but saw "${e}".`),this.code=this.name=Gf.code,this.data={value:e}}};l(Gf,"InvalidOidError");var ci=Gf;ci.code="InvalidOidError";var Jf=class Jf extends ee{constructor(e){super(`Could not find a fetch refspec for remote "${e}". Make sure the config file has an entry like the following:
11
15
  [remote "${e}"]
12
16
  fetch = +refs/heads/*:refs/remotes/origin/*
13
- `),this.code=this.name=Ll.code,this.data={remote:e}}};l(Ll,"NoRefspecError");var Ka=Ll;Ka.code="NoRefspecError";var ql=class ql{constructor(e){if(this.refs=new Map,this.parsedConfig=[],e){let r=null;this.parsedConfig=e.trim().split(`
14
- `).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 ql(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(`
17
+ `),this.code=this.name=Jf.code,this.data={remote:e}}};l(Jf,"NoRefspecError");var qa=Jf;qa.code="NoRefspecError";var Kf=class Kf{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 Kf(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(`
15
19
  `)+`
16
- `}};l(ql,"GitPackedRefs");var Tl=ql,Ul=class Ul{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),f=r==="+",o=n==="*";if(o!==(a==="*"))throw new W("Invalid refspec");return new Ul({remotePath:i,localPath:s,force:f,matchPrefix:o})}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}};l(Ul,"GitRefSpec");var Rl=Ul,Wl=class Wl{constructor(e=[]){this.rules=e}static from(e){let r=[];for(let i of e)r.push(Rl.from(i));return new Wl(r)}add(e){let r=Rl.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(/\/$/,""))}};l(Wl,"GitRefSpecSet");var Hp=Wl;function II(t,e){let r=t.replace(/\^\{\}$/,""),i=e.replace(/\^\{\}$/,""),n=-(r<i)||+(r>i);return n===0?t.endsWith("^{}")?1:-1:n}l(II,"compareRefNames");var $I=l(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"),Ua=l(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"),JE={core:{filemode:Ua,bare:Ua,logallrefupdates:Ua,symlinks:Ua,ignorecase:Ua,bigFileThreshold:$I}},BI=/^\[([A-Za-z0-9-.]+)(?: "(.*)")?\]$/,MI=/^[A-Za-z0-9-.]+$/,jI=/^([A-Za-z][A-Za-z-]*)(?: *= *(.*))?$/,LI=/^[A-Za-z][A-Za-z-]*$/,qI=/^(.*?)( *[#;].*)$/,UI=l(t=>{let e=BI.exec(t);if(e!=null){let[r,i]=e.slice(1);return[r,i]}return null},"extractSectionLine"),WI=l(t=>{let e=jI.exec(t);if(e!=null){let[r,i="true"]=e.slice(1),n=zI(i),s=HI(n);return[r,s]}return null},"extractVariableLine"),zI=l(t=>{let e=qI.exec(t);if(e==null)return t;let[r,i]=e.slice(1);return XE(r)&&XE(i)?`${r}${i}`:r},"removeComments"),XE=l(t=>(t.match(/(?:^|[^\\])"/g)||[]).length%2!==0,"hasOddNumberOfQuotes"),HI=l(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"),YE=l(t=>t!=null?t.toLowerCase():null,"lower"),Vp=l((t,e,r)=>[YE(t),e,YE(r)].filter(i=>i!=null).join("."),"getPath"),ZE=l(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:Vp(r,n,i),sectionPath:Vp(r,n,null),isSection:!!r}},"normalizePath"),VI=l((t,e)=>t.reduce((r,i,n)=>e(i)?n:r,-1),"findLastIndex"),zl=class zl{constructor(e){let r=null,i=null;this.parsedConfig=e?e.split(`
17
- `).map(n=>{let s=null,a=null,f=n.trim(),o=UI(f),c=o!=null;if(c)[r,i]=o;else{let h=WI(f);h!=null&&([s,a]=h)}let u=Vp(r,i,s);return{line:n,isSection:c,section:r,subsection:i,name:s,value:a,path:u}}):[]}static from(e){return new zl(e)}async get(e,r=!1){let i=ZE(e).path,n=this.parsedConfig.filter(s=>s.path===i).map(({section:s,name:a,value:f})=>{let o=JE[s]&&JE[s][a];return o?o(f):f});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:f,sectionPath:o,isSection:c}=ZE(e),u=VI(this.parsedConfig,h=>h.path===f);if(r==null)u!==-1&&this.parsedConfig.splice(u,1);else if(u!==-1){let h=this.parsedConfig[u],d=Object.assign({},h,{name:a,value:r,modified:!0});i?this.parsedConfig.splice(u+1,0,d):this.parsedConfig[u]=d}else{let h=this.parsedConfig.findIndex(p=>p.path===o),d={section:n,subsection:s,name:a,value:r,modified:!0,path:f};if(MI.test(n)&&LI.test(a))if(h>=0)this.parsedConfig.splice(h+1,0,d);else{let p={isSection:c,section:n,subsection:s,modified:!0,path:o};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(`
18
- `)}};l(zl,"GitConfig");var Gp=zl,um=class um{static async get({fs:e,gitdir:r}){let i=await e.read(`${r}/config`,{encoding:"utf8"});return Gp.from(i)}static async save({fs:e,gitdir:r,config:i}){await e.write(`${r}/config`,i.toString(),{encoding:"utf8"})}};l(um,"GitConfigManager");var me=um,vl=l(t=>[`${t}`,`refs/${t}`,`refs/tags/${t}`,`refs/heads/${t}`,`refs/remotes/${t}`,`refs/remotes/${t}/HEAD`],"refpaths"),GI=["config","description","index","shallow","commondir"],Cp;async function qr(t,e){return Cp===void 0&&(Cp=new za),Cp.acquire(t,e)}l(qr,"acquireLock");var Ee=class Ee{static async updateRemoteRefs({fs:e,gitdir:r,remote:i,refs:n,symrefs:s,tags:a,refspecs:f=void 0,prune:o=!1,pruneTags:c=!1}){for(let y of n.values())if(!y.match(/[0-9a-f]{40}/))throw new zr(y);let u=await me.get({fs:e,gitdir:r});if(!f){if(f=await u.getall(`remote.${i}.fetch`),f.length===0)throw new Ka(i);f.unshift(`+HEAD:refs/remotes/${i}/HEAD`)}let h=Hp.from(f),d=new Map;if(c){let y=await Ee.listRefs({fs:e,gitdir:r,filepath:"refs/tags"});await Ee.deleteRefs({fs:e,gitdir:r,refs:y.map(g=>`refs/tags/${g}`)})}if(a){for(let y of n.keys())if(y.startsWith("refs/tags")&&!y.endsWith("^{}")&&!await Ee.exists({fs:e,gitdir:r,ref:y})){let g=n.get(y);d.set(y,g)}}let p=h.translate([...n.keys()]);for(let[y,g]of p){let _=n.get(y);d.set(g,_)}let m=h.translate([...s.keys()]);for(let[y,g]of m){let _=s.get(y),F=h.translateOne(_);F&&d.set(g,`ref: ${F}`)}let w=[];if(o){for(let y of h.localNamespaces()){let g=(await Ee.listRefs({fs:e,gitdir:r,filepath:y})).map(_=>`${y}/${_}`);for(let _ of g)d.has(_)||w.push(_)}w.length>0&&await Ee.deleteRefs({fs:e,gitdir:r,refs:w})}for(let[y,g]of d)await qr(y,async()=>e.write(C.join(r,y),`${g.trim()}
19
- `,"utf8"));return{pruned:w}}static async writeRef({fs:e,gitdir:r,ref:i,value:n}){if(!n.match(/[0-9a-f]{40}/))throw new zr(n);await qr(i,async()=>e.write(C.join(r,i),`${n.trim()}
20
- `,"utf8"))}static async writeSymbolicRef({fs:e,gitdir:r,ref:i,value:n}){await qr(i,async()=>e.write(C.join(r,i),`ref: ${n.trim()}
21
- `,"utf8"))}static async deleteRef({fs:e,gitdir:r,ref:i}){return Ee.deleteRefs({fs:e,gitdir:r,refs:[i]})}static async deleteRefs({fs:e,gitdir:r,refs:i}){await Promise.all(i.map(f=>e.rm(C.join(r,f))));let n=await qr("packed-refs",async()=>e.read(`${r}/packed-refs`,{encoding:"utf8"})),s=Tl.from(n),a=s.refs.size;for(let f of i)s.refs.has(f)&&s.delete(f);s.refs.size<a&&(n=s.toString(),await qr("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),Ee.resolve({fs:e,gitdir:r,ref:i,depth:n});if(i.length===40&&/[0-9a-f]{40}/.test(i))return i;let s=await Ee.packedRefs({fs:e,gitdir:r}),a=vl(i).filter(f=>!GI.includes(f));for(let f of a){let o=await qr(f,async()=>await e.read(`${r}/${f}`,{encoding:"utf8"})||s.get(f));if(o)return Ee.resolve({fs:e,gitdir:r,ref:o.trim(),depth:n})}throw new oe(i)}static async exists({fs:e,gitdir:r,ref:i}){try{return await Ee.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 Ee.packedRefs({fs:e,gitdir:r}),s=vl(i);for(let a of s)if(await qr(a,async()=>e.exists(`${r}/${a}`))||n.has(a))return a;throw new oe(i)}static async expandAgainstMap({ref:e,map:r}){let i=vl(e);for(let n of i)if(await r.has(n))return n;throw new oe(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),Ee.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=vl(e);for(let a of s){let f=n.get(a);if(f)return Ee.resolveAgainstMap({ref:f.trim(),fullref:a,depth:i,map:n})}throw new oe(e)}static async packedRefs({fs:e,gitdir:r}){let i=await qr("packed-refs",async()=>e.read(`${r}/packed-refs`,{encoding:"utf8"}));return Tl.from(i).refs}static async listRefs({fs:e,gitdir:r,filepath:i}){let n=Ee.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(II),s}static async listBranches({fs:e,gitdir:r,remote:i}){return i?Ee.listRefs({fs:e,gitdir:r,filepath:`refs/remotes/${i}`}):Ee.listRefs({fs:e,gitdir:r,filepath:"refs/heads"})}static async listTags({fs:e,gitdir:r}){return(await Ee.listRefs({fs:e,gitdir:r,filepath:"refs/tags"})).filter(n=>!n.endsWith("^{}"))}};l(Ee,"GitRefManager");var $=Ee;function KI(t,e){return bf(QE(t),QE(e))}l(KI,"compareTreeEntryPath");function QE(t){return t.mode==="040000"?t.path+"/":t.path}l(QE,"appendSlashIfDir");function vS(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 W(`Unexpected GitTree entry mode: ${t}`)}l(vS,"mode2type$1");function JI(t){let e=[],r=0;for(;r<t.length;){let i=t.indexOf(32,r);if(i===-1)throw new W(`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 W(`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=vS(s),f=t.slice(i+1,n).toString("utf8");if(f.includes("\\")||f.includes("/"))throw new as(f);let o=t.slice(n+1,n+21).toString("hex");r=n+21,e.push({mode:s,path:f,oid:o,type:a})}return e}l(JI,"parseBuffer");function XI(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 W(`Could not understand file mode: ${t}`)}l(XI,"limitModeToAllowed");function YI(t){return!t.oid&&t.sha&&(t.oid=t.sha),t.mode=XI(t.mode),t.type||(t.type=vS(t.mode)),t}l(YI,"nudgeIntoShape");var Hl=class Hl{constructor(e){if(Buffer.isBuffer(e))this._entries=JI(e);else if(Array.isArray(e))this._entries=e.map(YI);else throw new W("invalid type passed to GitTree constructor");this._entries.sort(yS)}static from(e){return new Hl(e)}render(){return this._entries.map(e=>`${e.mode} ${e.type} ${e.oid} ${e.path}`).join(`
22
- `)}toObject(){let e=[...this._entries];return e.sort(KI),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]),f=Buffer.from(r.oid,"hex");return Buffer.concat([i,n,s,a,f])}))}entries(){return this._entries}*[Symbol.iterator](){for(let e of this._entries)yield e}};l(Hl,"GitTree");var rt=Hl,hm=class hm{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 f=0;f<n;f++)a[f]=i.charCodeAt(f);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 W(`Length mismatch: expected ${s} bytes but got ${a} instead.`);return{type:n,object:Buffer.from(e.slice(i+1))}}};l(hm,"GitObject");var Hr=hm;async function ES({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(ES,"readObjectLoose");function ZI(t,e){let r=new Rt(t),i=eS(r);if(i!==e.byteLength)throw new W(`applyDelta expected source buffer to be ${i} bytes but the provided buffer was ${e.length} bytes`);let n=eS(r),s,a=rS(r,e);if(a.byteLength===n)s=a;else{s=Buffer.alloc(n);let f=new Rt(s);for(f.copy(a);!r.eof();)f.copy(rS(r,e));let o=f.tell();if(n!==o)throw new W(`applyDelta expected target buffer to be ${n} bytes but the resulting buffer was ${o} bytes`)}return s}l(ZI,"applyDelta");function eS(t){let e=0,r=0,i=null;do i=t.readUInt8(),e|=(i&127)<<r,r+=7;while(i&128);return e}l(eS,"readVarIntLE");function tS(t,e,r){let i=0,n=0;for(;r--;)e&1&&(i|=t.readUInt8()<<n),e>>=1,n+=8;return i}l(tS,"readCompactLE");function rS(t,e){let r=t.readUInt8(),i=128,n=15,s=112;if(r&i){let a=tS(t,r&n,4),f=tS(t,(r&s)>>4,3);return f===0&&(f=65536),e.slice(a,a+f)}else return t.slice(r)}l(rS,"readOp");function QI(t){let e=[t];return{next(){return Promise.resolve({done:e.length===0,value:e.pop()})},return(){return e=[],{}},[Symbol.asyncIterator](){return this}}}l(QI,"fromValue");function SS(t){return t[Symbol.asyncIterator]?t[Symbol.asyncIterator]():t[Symbol.iterator]?t[Symbol.iterator]():t.next?t:QI(t)}l(SS,"getIterator");var dm=class dm{constructor(e){if(typeof Buffer>"u")throw new Error("Missing Buffer dependency");this.stream=SS(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>e2(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(dm,"StreamReader");var Ol=dm;function e2(t){return t.reduce((e,r)=>e+r.length,0)}l(e2,"lengthBuffers");async function t2(t,e){let r=new Ol(t),i=await r.read(4);if(i=i.toString("utf8"),i!=="PACK")throw new W(`Invalid PACK header '${i}'`);let n=await r.read(4);if(n=n.readUInt32BE(0),n!==2)throw new W(`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:f,length:o,ofs:c,reference:u}=await r2(r),h=new tm.Inflate;for(;!h.result;){let d=await r.chunk();if(!d)break;if(h.push(d,!1),h.err)throw new W(`Pako error: ${h.msg}`);if(h.result){if(h.result.length!==o)throw new W("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:a,end:p,reference:u,ofs:c})}}}}l(t2,"listpack");async function r2(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 f=[];do e=await t.byte(),n|=(e&127)<<a,a+=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(r2,"parseHeader");var Ip=!1;async function FS(t){return Ip===null&&(Ip=n2()),Ip?i2(t):tm.inflate(t)}l(FS,"inflate");async function i2(t){let e=new DecompressionStream("deflate"),r=new Blob([t]).stream().pipeThrough(e);return new Uint8Array(await new Response(r).arrayBuffer())}l(i2,"browserInflate");function n2(){try{if(new DecompressionStream("deflate"))return!0}catch{}return!1}l(n2,"testDecompressionStream");function s2(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(s2,"decodeVarInt");function a2(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(a2,"otherVarIntDecode");var Wa=class Wa{constructor(e){Object.assign(this,e),this.offsetCache={}}static async fromIdx({idx:e,getExternalRefDelta:r}){let i=new Rt(e);if(i.slice(4).toString("hex")!=="ff744f63")return;let s=i.readUInt32BE();if(s!==2)throw new W(`Unable to read version ${s} packfile IDX. (Only version 2 supported)`);if(e.byteLength>2048*1024*1024)throw new W("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(),f=[];for(let u=0;u<a;u++){let h=i.slice(20).toString("hex");f[u]=h}i.seek(i.tell()+4*a);let o=new Map;for(let u=0;u<a;u++)o.set(f[u],i.readUInt32BE());let c=i.slice(20).toString("hex");return new Wa({hashes:f,crcs:{},offsets:o,packfileSha:c,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"),f=[],o={},c=new Map,u=null,h=null;await t2([e],async({data:y,type:g,reference:_,offset:F,num:R})=>{u===null&&(u=R);let k=Math.floor((u-R)*100/u);k!==h&&i&&await i({phase:"Receiving objects",loaded:u-R,total:u}),h=k,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],R=SI.buf(e.slice(g,_))>>>0;F.end=_,F.crc=R}let p=new Wa({pack:Promise.resolve(e),packfileSha:a,crcs:o,hashes:f,offsets:c,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:R}=await p.readSlice({start:y});w[p.readDepth]+=1;let k=await Er(Hr.wrap({type:F,object:R}));_.oid=k,f.push(k),c.set(k,y),o[k]=_.crc}catch{continue}}return f.sort(),p}async toBuffer(){let e=[],r=l((c,u)=>{e.push(Buffer.from(c,u))},"write");r("ff744f63","hex"),r("00000002","hex");let i=new Rt(Buffer.alloc(256*4));for(let c=0;c<256;c++){let u=0;for(let h of this.hashes)parseInt(h.slice(0,2),16)<=c&&u++;i.writeUInt32BE(u)}e.push(i.buffer);for(let c of this.hashes)r(c,"hex");let n=new Rt(Buffer.alloc(this.hashes.length*4));for(let c of this.hashes)n.writeUInt32BE(this.crcs[c]);e.push(n.buffer);let s=new Rt(Buffer.alloc(this.hashes.length*4));for(let c of this.hashes)s.writeUInt32BE(this.offsets.get(c));e.push(s.buffer),r(this.packfileSha,"hex");let a=Buffer.concat(e),f=await Er(a),o=Buffer.alloc(20);return o.write(f,"hex"),Buffer.concat([a,o])}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 W(`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 W("Tried to read from a GitPackIndex with no packfile loaded into memory");let i=(await this.pack).slice(e),n=new Rt(i),s=n.readUInt8(),a=s&112,f=r[a];if(f===void 0)throw new W("Unrecognized type: 0b"+a.toString(2));let o=s&15,c=o;s&128&&(c=a2(n,o));let h=null,d=null;if(f==="ofs_delta"){let m=s2(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 FS(p)),d.byteLength!==c)throw new W(`Packfile told us object would have length ${c} but it had length ${d.byteLength}`);return h&&(d=Buffer.from(ZI(d,h))),this.readDepth>3&&(this.offsetCache[e]={type:f,object:d}),{type:f,format:"content",object:d}}};l(Wa,"GitPackIndex");var Ja=Wa,El=Symbol("PackfileCache");async function o2({fs:t,filename:e,getExternalRefDelta:r,emitter:i,emitterPrefix:n}){let s=await t.read(e);return Ja.fromIdx({idx:s,getExternalRefDelta:r})}l(o2,"loadPackIndex");function rm({fs:t,cache:e,filename:r,getExternalRefDelta:i,emitter:n,emitterPrefix:s}){e[El]||(e[El]=new Map);let a=e[El].get(r);return a||(a=o2({fs:t,filename:r,getExternalRefDelta:i,emitter:n,emitterPrefix:s}),e[El].set(r,a)),a}l(rm,"readPackIndex");async function c2({fs:t,cache:e,gitdir:r,oid:i,format:n="content",getExternalRefDelta:s}){let a=await t.readdir(C.join(r,"objects/pack"));a=a.filter(f=>f.endsWith(".idx"));for(let f of a){let o=`${r}/objects/pack/${f}`,c=await rm({fs:t,cache:e,filename:o,getExternalRefDelta:s});if(c.error)throw new W(c.error);if(c.offsets.has(i)){if(!c.pack){let h=o.replace(/idx$/,"pack");c.pack=t.read(h)}let u=await c.read({oid:i,getExternalRefDelta:s});return u.format="content",u.source=`objects/pack/${f.replace(/idx$/,"pack")}`,u}}return null}l(c2,"readObjectPacked");async function fe({fs:t,cache:e,gitdir:r,oid:i,format:n="content"}){let s=l(u=>fe({fs:t,cache:e,gitdir:r,oid:u}),"getExternalRefDelta"),a;if(i==="4b825dc642cb6eb9a060e54bf8d69288fbee4904"&&(a={format:"wrapped",object:Buffer.from("tree 0\0")}),a||(a=await ES({fs:t,gitdir:r,oid:i})),!a){if(a=await c2({fs:t,cache:e,gitdir:r,oid:i,getExternalRefDelta:s}),!a)throw new oe(i);return a}if(n==="deflated"||(a.format==="deflated"&&(a.object=Buffer.from(await FS(a.object)),a.format="wrapped"),n==="wrapped"))return a;let f=await Er(a.object);if(f!==i)throw new W(`SHA check failed! Expected ${i}, computed ${f}`);let{object:o,type:c}=Hr.unwrap(a.object);if(a.type=c,a.object=o,a.format="content",n==="content")return a;throw new W(`invalid requested format "${n}"`)}l(fe,"_readObject");var Vl=class Vl extends Z{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=Vl.code,this.data={noun:e,where:r,canForce:i}}};l(Vl,"AlreadyExistsError");var jt=Vl;jt.code="AlreadyExistsError";var Gl=class Gl extends Z{constructor(e,r,i){super(`Found multiple ${e} matching "${r}" (${i.join(", ")}). Use a longer abbreviation length to disambiguate them.`),this.code=this.name=Gl.code,this.data={nouns:e,short:r,matches:i}}};l(Gl,"AmbiguousError");var Xa=Gl;Xa.code="AmbiguousError";var Kl=class Kl extends Z{constructor(e){super(`Your local changes to the following files would be overwritten by checkout: ${e.join(", ")}`),this.code=this.name=Kl.code,this.data={filepaths:e}}};l(Kl,"CheckoutConflictError");var Ya=Kl;Ya.code="CheckoutConflictError";var Jl=class Jl extends Z{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=Jl.code,this.data={ref:e,oid:r}}};l(Jl,"CommitNotFetchedError");var Za=Jl;Za.code="CommitNotFetchedError";var Xl=class Xl extends Z{constructor(){super("Empty response from git server."),this.code=this.name=Xl.code,this.data={}}};l(Xl,"EmptyServerResponseError");var Qa=Xl;Qa.code="EmptyServerResponseError";var Yl=class Yl extends Z{constructor(){super("A simple fast-forward merge was not possible."),this.code=this.name=Yl.code,this.data={}}};l(Yl,"FastForwardError");var eo=Yl;eo.code="FastForwardError";var Zl=class Zl extends Z{constructor(e,r){super(`One or more branches were not updated: ${e}`),this.code=this.name=Zl.code,this.data={prettyDetails:e,result:r}}};l(Zl,"GitPushError");var to=Zl;to.code="GitPushError";var Ql=class Ql extends Z{constructor(e,r,i){super(`HTTP Error: ${e} ${r}`),this.code=this.name=Ql.code,this.data={statusCode:e,statusMessage:r,response:i}}};l(Ql,"HttpError");var ls=Ql;ls.code="HttpError";var ef=class ef extends Z{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=ef.code,this.data={reason:e}}};l(ef,"InvalidFilepathError");var Vr=ef;Vr.code="InvalidFilepathError";var tf=class tf extends Z{constructor(e,r){super(`"${e}" would be an invalid git reference. (Hint: a valid alternative would be "${r}".)`),this.code=this.name=tf.code,this.data={ref:e,suggestion:r}}};l(tf,"InvalidRefNameError");var Lt=tf;Lt.code="InvalidRefNameError";var rf=class rf extends Z{constructor(e){super(`Maximum search depth of ${e} exceeded.`),this.code=this.name=rf.code,this.data={depth:e}}};l(rf,"MaxDepthError");var ro=rf;ro.code="MaxDepthError";var nf=class nf extends Z{constructor(){super("Merges with conflicts are not supported yet."),this.code=this.name=nf.code,this.data={}}};l(nf,"MergeNotSupportedError");var fs=nf;fs.code="MergeNotSupportedError";var sf=class sf extends Z{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=sf.code,this.data={filepaths:e,bothModified:r,deleteByUs:i,deleteByTheirs:n}}};l(sf,"MergeConflictError");var us=sf;us.code="MergeConflictError";var af=class af extends Z{constructor(e){super(`No name was provided for ${e} in the argument or in the .git/config file.`),this.code=this.name=af.code,this.data={role:e}}};l(af,"MissingNameError");var ze=af;ze.code="MissingNameError";var of=class of extends Z{constructor(e){super(`The function requires a "${e}" parameter but none was provided.`),this.code=this.name=of.code,this.data={parameter:e}}};l(of,"MissingParameterError");var tt=of;tt.code="MissingParameterError";var cf=class cf extends Z{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=cf.code,this.data={errors:e},this.errors=e}};l(cf,"MultipleGitError");var io=cf;io.code="MultipleGitError";var lf=class lf extends Z{constructor(e,r){super(`Expected "${e}" but received "${r}".`),this.code=this.name=lf.code,this.data={expected:e,actual:r}}};l(lf,"ParseError");var Ni=lf;Ni.code="ParseError";var ff=class ff extends Z{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=ff.code,this.data={reason:e}}};l(ff,"PushRejectedError");var hs=ff;hs.code="PushRejectedError";var uf=class uf extends Z{constructor(e,r){super(`Remote does not support the "${e}" so the "${r}" parameter cannot be used.`),this.code=this.name=uf.code,this.data={capability:e,parameter:r}}};l(uf,"RemoteCapabilityError");var Wr=uf;Wr.code="RemoteCapabilityError";var hf=class hf extends Z{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=hf.code,this.data={preview:e,response:r}}};l(hf,"SmartHttpError");var no=hf;no.code="SmartHttpError";var df=class df extends Z{constructor(e,r,i){super(`Git remote "${e}" uses an unrecognized transport protocol: "${r}"`),this.code=this.name=df.code,this.data={url:e,transport:r,suggestion:i}}};l(df,"UnknownTransportError");var so=df;so.code="UnknownTransportError";var pf=class pf extends Z{constructor(e){super(`Cannot parse remote URL: "${e}"`),this.code=this.name=pf.code,this.data={url:e}}};l(pf,"UrlParseError");var ao=pf;ao.code="UrlParseError";var mf=class mf extends Z{constructor(){super("The operation was canceled."),this.code=this.name=mf.code,this.data={}}};l(mf,"UserCanceledError");var ds=mf;ds.code="UserCanceledError";var wf=class wf extends Z{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=wf.code,this.data={filepath:e}}};l(wf,"IndexResetError");var oo=wf;oo.code="IndexResetError";var yf=class yf extends Z{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=yf.code,this.data={ref:e}}};l(yf,"NoCommitError");var co=yf;co.code="NoCommitError";var TS=Object.freeze({__proto__:null,AlreadyExistsError:jt,AmbiguousError:Xa,CheckoutConflictError:Ya,CommitNotFetchedError:Za,EmptyServerResponseError:Qa,FastForwardError:eo,GitPushError:to,HttpError:ls,InternalError:W,InvalidFilepathError:Vr,InvalidOidError:zr,InvalidRefNameError:Lt,MaxDepthError:ro,MergeNotSupportedError:fs,MergeConflictError:us,MissingNameError:ze,MissingParameterError:tt,MultipleGitError:io,NoRefspecError:Ka,NotFoundError:oe,ObjectTypeError:Ye,ParseError:Ni,PushRejectedError:hs,RemoteCapabilityError:Wr,SmartHttpError:no,UnknownTransportError:so,UnsafeFilepathError:as,UrlParseError:ao,UserCanceledError:ds,UnmergedPathsError:Ga,IndexResetError:oo,NoCommitError:co});function Kp({name:t,email:e,timestamp:r,timezoneOffset:i}){return i=l2(i),`${t} <${e}> ${r} ${i}`}l(Kp,"formatAuthor");function l2(t){let e=f2(u2(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(l2,"formatTimezoneOffset");function f2(t){return Math.sign(t)||(Object.is(t,-0)?-1:1)}l(f2,"simpleSign");function u2(t){return t===0?t:-t}l(u2,"negateExceptForZero");function vr(t){return t=t.replace(/\r/g,""),t=t.replace(/^\n+/,""),t=t.replace(/\n+$/,"")+`
23
- `,t}l(vr,"normalizeNewlines");function kl(t){let[,e,r,i,n]=t.match(/^(.*) <(.*)> (.*) (.*)$/);return{name:e,email:r,timestamp:Number(i),timezoneOffset:h2(n)}}l(kl,"parseAuthor");function h2(t){let[,e,r,i]=t.match(/(\+|-)(\d\d)(\d\d)/);return i=(e==="+"?1:-1)*(Number(r)*60+Number(i)),d2(i)}l(h2,"parseTimezoneOffset");function d2(t){return t===0?t:-t}l(d2,"negateExceptForZero$1");var is=class is{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=is.render(e);else throw new W("invalid type passed to GitAnnotatedTag constructor")}static from(e){return new is(e)}static render(e){return`object ${e.object}
20
+ `}};l(Kf,"GitPackedRefs");var Df=Kf,Xf=class Xf{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,o]=e.match(/^(\+?)(.*?)(\*?):(.*?)(\*?)$/).slice(1),f=r==="+",c=n==="*";if(c!==(o==="*"))throw new z("Invalid refspec");return new Xf({remotePath:i,localPath:s,force:f,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}};l(Xf,"GitRefSpec");var Cf=Xf,Yf=class Yf{constructor(e=[]){this.rules=e}static from(e){let r=[];for(let i of e)r.push(Cf.from(i));return new Yf(r)}add(e){let r=Cf.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(/\/$/,""))}};l(Yf,"GitRefSpecSet");var vw=Yf;function pL(t,e){let r=t.replace(/\^\{\}$/,""),i=e.replace(/\^\{\}$/,""),n=-(r<i)||+(r>i);return n===0?t.endsWith("^{}")?1:-1:n}l(pL,"compareRefNames");function mL(t,e){let r="",i=0,n=-1,s=0,o="\0";for(let f=0;f<=t.length;++f){if(f<t.length)o=t[f];else{if(o==="/")break;o="/"}if(o==="/"){if(!(n===f-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=f,s=0;continue}else if(r.length!==0){r="",i=0,n=f,s=0;continue}}e&&(r+=r.length>0?"/..":"..",i=2)}else r.length>0?r+="/"+t.slice(n+1,f):r=t.slice(n+1,f),i=f-n-1;n=f,s=0}else o==="."&&s!==-1?++s:s=-1}return r}l(mL,"normalizeString");function wL(t){if(!t.length)return".";let e=t[0]==="/",r=t.at(-1)==="/";return t=mL(t,!e),t.length?(r&&(t+="/"),e?`/${t}`:t):e?"/":r?"./":"."}l(wL,"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?".":wL(e)}l(C,"join");var yL=l(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"),$a=l(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"),kT={core:{filemode:$a,bare:$a,logallrefupdates:$a,symlinks:$a,ignorecase:$a,bigFileThreshold:yL}},gL=/^\[([A-Za-z0-9-.]+)(?: "(.*)")?\]$/,bL=/^[A-Za-z0-9-.]+$/,_L=/^([A-Za-z][A-Za-z-]*)(?: *= *(.*))?$/,SL=/^[A-Za-z][A-Za-z-]*$/,vL=/^(.*?)( *[#;].*)$/,EL=l(t=>{let e=gL.exec(t);if(e!=null){let[r,i]=e.slice(1);return[r,i]}return null},"extractSectionLine"),FL=l(t=>{let e=_L.exec(t);if(e!=null){let[r,i="true"]=e.slice(1),n=TL(i),s=kL(n);return[r,s]}return null},"extractVariableLine"),TL=l(t=>{let e=vL.exec(t);if(e==null)return t;let[r,i]=e.slice(1);return RT(r)&&RT(i)?`${r}${i}`:r},"removeComments"),RT=l(t=>(t.match(/(?:^|[^\\])"/g)||[]).length%2!==0,"hasOddNumberOfQuotes"),kL=l(t=>t.split("").reduce((e,r,i,n)=>{let s=r==='"'&&n[i-1]!=="\\",o=r==="\\"&&n[i+1]==='"';return s||o?e:e+r},""),"removeQuotes"),OT=l(t=>t!=null?t.toLowerCase():null,"lower"),Ew=l((t,e,r)=>[OT(t),e,OT(r)].filter(i=>i!=null).join("."),"getPath"),xT=l(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:Ew(r,n,i),sectionPath:Ew(r,n,null),isSection:!!r}},"normalizePath"),RL=l((t,e)=>t.reduce((r,i,n)=>e(i)?n:r,-1),"findLastIndex"),Zf=class Zf{constructor(e){let r=null,i=null;this.parsedConfig=e?e.split(`
21
+ `).map(n=>{let s=null,o=null,f=n.trim(),c=EL(f),a=c!=null;if(a)[r,i]=c;else{let h=FL(f);h!=null&&([s,o]=h)}let u=Ew(r,i,s);return{line:n,isSection:a,section:r,subsection:i,name:s,value:o,path:u}}):[]}static from(e){return new Zf(e)}async get(e,r=!1){let i=xT(e).path,n=this.parsedConfig.filter(s=>s.path===i).map(({section:s,name:o,value:f})=>{let c=kT[s]&&kT[s][o];return c?c(f):f});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:o,path:f,sectionPath:c,isSection:a}=xT(e),u=RL(this.parsedConfig,h=>h.path===f);if(r==null)u!==-1&&this.parsedConfig.splice(u,1);else if(u!==-1){let h=this.parsedConfig[u],d=Object.assign({},h,{name:o,value:r,modified:!0});i?this.parsedConfig.splice(u+1,0,d):this.parsedConfig[u]=d}else{let h=this.parsedConfig.findIndex(p=>p.path===c),d={section:n,subsection:s,name:o,value:r,modified:!0,path:f};if(bL.test(n)&&SL.test(o))if(h>=0)this.parsedConfig.splice(h+1,0,d);else{let p={isSection:a,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:o=!1})=>o?n!=null&&s!=null?typeof s=="string"&&/[#;]/.test(s)?` ${n} = "${s}"`:` ${n} = ${s}`:i!=null?`[${r} "${i}"]`:`[${r}]`:e).join(`
22
+ `)}};l(Zf,"GitConfig");var Fw=Zf,Uw=class Uw{static async get({fs:e,gitdir:r}){let i=await e.read(`${r}/config`,{encoding:"utf8"});return Fw.from(i)}static async save({fs:e,gitdir:r,config:i}){await e.write(`${r}/config`,i.toString(),{encoding:"utf8"})}};l(Uw,"GitConfigManager");var Se=Uw,xf=l(t=>[`${t}`,`refs/${t}`,`refs/tags/${t}`,`refs/heads/${t}`,`refs/remotes/${t}`,`refs/remotes/${t}/HEAD`],"refpaths"),OL=["config","description","index","shallow","commondir"],uw;async function si(t,e){return uw===void 0&&(uw=new Ma),uw.acquire(t,e)}l(si,"acquireLock");var Oe=class Oe{static async updateRemoteRefs({fs:e,gitdir:r,remote:i,refs:n,symrefs:s,tags:o,refspecs:f=void 0,prune:c=!1,pruneTags:a=!1}){for(let y of n.values())if(!y.match(/[0-9a-f]{40}/))throw new ci(y);let u=await Se.get({fs:e,gitdir:r});if(!f){if(f=await u.getall(`remote.${i}.fetch`),f.length===0)throw new qa(i);f.unshift(`+HEAD:refs/remotes/${i}/HEAD`)}let h=vw.from(f),d=new Map;if(a){let y=await Oe.listRefs({fs:e,gitdir:r,filepath:"refs/tags"});await Oe.deleteRefs({fs:e,gitdir:r,refs:y.map(b=>`refs/tags/${b}`)})}if(o){for(let y of n.keys())if(y.startsWith("refs/tags")&&!y.endsWith("^{}")&&!await Oe.exists({fs:e,gitdir:r,ref:y})){let b=n.get(y);d.set(y,b)}}let p=h.translate([...n.keys()]);for(let[y,b]of p){let _=n.get(y);d.set(b,_)}let m=h.translate([...s.keys()]);for(let[y,b]of m){let _=s.get(y),F=h.translateOne(_);F&&d.set(b,`ref: ${F}`)}let w=[];if(c){for(let y of h.localNamespaces()){let b=(await Oe.listRefs({fs:e,gitdir:r,filepath:y})).map(_=>`${y}/${_}`);for(let _ of b)d.has(_)||w.push(_)}w.length>0&&await Oe.deleteRefs({fs:e,gitdir:r,refs:w})}for(let[y,b]of d)await si(y,async()=>e.write(C(r,y),`${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 ci(n);await si(i,async()=>e.write(C(r,i),`${n.trim()}
24
+ `,"utf8"))}static async writeSymbolicRef({fs:e,gitdir:r,ref:i,value:n}){await si(i,async()=>e.write(C(r,i),`ref: ${n.trim()}
25
+ `,"utf8"))}static async deleteRef({fs:e,gitdir:r,ref:i}){return Oe.deleteRefs({fs:e,gitdir:r,refs:[i]})}static async deleteRefs({fs:e,gitdir:r,refs:i}){await Promise.all(i.map(f=>e.rm(C(r,f))));let n=await si("packed-refs",async()=>e.read(`${r}/packed-refs`,{encoding:"utf8"})),s=Df.from(n),o=s.refs.size;for(let f of i)s.refs.has(f)&&s.delete(f);s.refs.size<o&&(n=s.toString(),await si("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),Oe.resolve({fs:e,gitdir:r,ref:i,depth:n});if(i.length===40&&/[0-9a-f]{40}/.test(i))return i;let s=await Oe.packedRefs({fs:e,gitdir:r}),o=xf(i).filter(f=>!OL.includes(f));for(let f of o){let c=await si(f,async()=>await e.read(`${r}/${f}`,{encoding:"utf8"})||s.get(f));if(c)return Oe.resolve({fs:e,gitdir:r,ref:c.trim(),depth:n})}throw new le(i)}static async exists({fs:e,gitdir:r,ref:i}){try{return await Oe.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 Oe.packedRefs({fs:e,gitdir:r}),s=xf(i);for(let o of s)if(await si(o,async()=>e.exists(`${r}/${o}`))||n.has(o))return o;throw new le(i)}static async expandAgainstMap({ref:e,map:r}){let i=xf(e);for(let n of i)if(await r.has(n))return n;throw new le(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),Oe.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=xf(e);for(let o of s){let f=n.get(o);if(f)return Oe.resolveAgainstMap({ref:f.trim(),fullref:o,depth:i,map:n})}throw new le(e)}static async packedRefs({fs:e,gitdir:r}){let i=await si("packed-refs",async()=>e.read(`${r}/packed-refs`,{encoding:"utf8"}));return Df.from(i).refs}static async listRefs({fs:e,gitdir:r,filepath:i}){let n=Oe.packedRefs({fs:e,gitdir:r}),s=null;try{s=await e.readdirDeep(`${r}/${i}`),s=s.map(o=>o.replace(`${r}/${i}/`,""))}catch{s=[]}for(let o of(await n).keys())o.startsWith(i)&&(o=o.replace(i+"/",""),s.includes(o)||s.push(o));return s.sort(pL),s}static async listBranches({fs:e,gitdir:r,remote:i}){return i?Oe.listRefs({fs:e,gitdir:r,filepath:`refs/remotes/${i}`}):Oe.listRefs({fs:e,gitdir:r,filepath:"refs/heads"})}static async listTags({fs:e,gitdir:r}){return(await Oe.listRefs({fs:e,gitdir:r,filepath:"refs/tags"})).filter(n=>!n.endsWith("^{}"))}};l(Oe,"GitRefManager");var $=Oe;function xL(t,e){return ku(AT(t),AT(e))}l(xL,"compareTreeEntryPath");function AT(t){return t.mode==="040000"?t.path+"/":t.path}l(AT,"appendSlashIfDir");function ZT(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 z(`Unexpected GitTree entry mode: ${t}`)}l(ZT,"mode2type$1");function AL(t){let e=[],r=0;for(;r<t.length;){let i=t.indexOf(32,r);if(i===-1)throw new z(`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 z(`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 o=ZT(s),f=t.slice(i+1,n).toString("utf8");if(f.includes("\\")||f.includes("/"))throw new qs(f);let c=t.slice(n+1,n+21).toString("hex");r=n+21,e.push({mode:s,path:f,oid:c,type:o})}return e}l(AL,"parseBuffer");function PL(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 z(`Could not understand file mode: ${t}`)}l(PL,"limitModeToAllowed");function NL(t){return!t.oid&&t.sha&&(t.oid=t.sha),t.mode=PL(t.mode),t.type||(t.type=ZT(t.mode)),t}l(NL,"nudgeIntoShape");var Qf=class Qf{constructor(e){if(Buffer.isBuffer(e))this._entries=AL(e);else if(Array.isArray(e))this._entries=e.map(NL);else throw new z("invalid type passed to GitTree constructor");this._entries.sort(JT)}static from(e){return new Qf(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(xL),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(Qf,"GitTree");var pt=Qf,Ww=class Ww{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 z(`Length mismatch: expected ${s} bytes but got ${o} instead.`);return{type:n,object:Buffer.from(e.slice(i+1))}}};l(Ww,"GitObject");var li=Ww;async function QT({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(QT,"readObjectLoose");function DL(t,e){let r=new $t(t),i=PT(r);if(i!==e.byteLength)throw new z(`applyDelta expected source buffer to be ${i} bytes but the provided buffer was ${e.length} bytes`);let n=PT(r),s,o=DT(r,e);if(o.byteLength===n)s=o;else{s=Buffer.alloc(n);let f=new $t(s);for(f.copy(o);!r.eof();)f.copy(DT(r,e));let c=f.tell();if(n!==c)throw new z(`applyDelta expected target buffer to be ${n} bytes but the resulting buffer was ${c} bytes`)}return s}l(DL,"applyDelta");function PT(t){let e=0,r=0,i=null;do i=t.readUInt8(),e|=(i&127)<<r,r+=7;while(i&128);return e}l(PT,"readVarIntLE");function NT(t,e,r){let i=0,n=0;for(;r--;)e&1&&(i|=t.readUInt8()<<n),e>>=1,n+=8;return i}l(NT,"readCompactLE");function DT(t,e){let r=t.readUInt8(),i=128,n=15,s=112;if(r&i){let o=NT(t,r&n,4),f=NT(t,(r&s)>>4,3);return f===0&&(f=65536),e.slice(o,o+f)}else return t.slice(r)}l(DT,"readOp");function CL(t){let e=[t];return{next(){return Promise.resolve({done:e.length===0,value:e.pop()})},return(){return e=[],{}},[Symbol.asyncIterator](){return this}}}l(CL,"fromValue");function e1(t){return t[Symbol.asyncIterator]?t[Symbol.asyncIterator]():t[Symbol.iterator]?t[Symbol.iterator]():t.next?t:CL(t)}l(e1,"getIterator");var zw=class zw{constructor(e){if(typeof Buffer>"u")throw new Error("Missing Buffer dependency");this.stream=e1(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>IL(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(zw,"StreamReader");var If=zw;function IL(t){return t.reduce((e,r)=>e+r.length,0)}l(IL,"lengthBuffers");async function $L(t,e){let r=new If(t),i=await r.read(4);if(i=i.toString("utf8"),i!=="PACK")throw new z(`Invalid PACK header '${i}'`);let n=await r.read(4);if(n=n.readUInt32BE(0),n!==2)throw new z(`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 BL(r),h=new Nw.Inflate;for(;!h.result;){let d=await r.chunk();if(!d)break;if(h.push(d,!1),h.err)throw new z(`Pako error: ${h.msg}`);if(h.result){if(h.result.length!==c)throw new z("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($L,"listpack");async function BL(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(BL,"parseHeader");var hw=!1;async function t1(t){return hw===null&&(hw=LL()),hw?ML(t):Nw.inflate(t)}l(t1,"inflate");async function ML(t){let e=new DecompressionStream("deflate"),r=new Blob([t]).stream().pipeThrough(e);return new Uint8Array(await new Response(r).arrayBuffer())}l(ML,"browserInflate");function LL(){try{if(new DecompressionStream("deflate"))return!0}catch{}return!1}l(LL,"testDecompressionStream");function jL(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(jL,"decodeVarInt");function qL(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(qL,"otherVarIntDecode");var Ba=class Ba{constructor(e){Object.assign(this,e),this.offsetCache={}}static async fromIdx({idx:e,getExternalRefDelta:r}){let i=new $t(e);if(i.slice(4).toString("hex")!=="ff744f63")return;let s=i.readUInt32BE();if(s!==2)throw new z(`Unable to read version ${s} packfile IDX. (Only version 2 supported)`);if(e.byteLength>2048*1024*1024)throw new z("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 Ba({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 $L([e],async({data:y,type:b,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,b=n[b],["commit","tree","blob","tag"].includes(b)?s[F]={type:b,offset:F}:b==="ofs-delta"?s[F]={type:b,offset:F}:b==="ref-delta"&&(s[F]={type:b,offset:F})});let d=Object.keys(s).map(Number);for(let[y,b]of d.entries()){let _=y+1===d.length?e.byteLength-20:d[y+1],F=s[b],E=rL.buf(e.slice(b,_))>>>0;F.end=_,F.crc=E}let p=new Ba({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 b=Math.floor(m*100/u);b!==h&&i&&await i({phase:"Resolving deltas",loaded:m,total:u}),m++,h=b;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 Mr(li.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 $t(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 $t(Buffer.alloc(this.hashes.length*4));for(let a of this.hashes)n.writeUInt32BE(this.crcs[a]);e.push(n.buffer);let s=new $t(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 Mr(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 z(`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 z("Tried to read from a GitPackIndex with no packfile loaded into memory");let i=(await this.pack).slice(e),n=new $t(i),s=n.readUInt8(),o=s&112,f=r[o];if(f===void 0)throw new z("Unrecognized type: 0b"+o.toString(2));let c=s&15,a=c;s&128&&(a=qL(n,c));let h=null,d=null;if(f==="ofs_delta"){let m=jL(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 t1(p)),d.byteLength!==a)throw new z(`Packfile told us object would have length ${a} but it had length ${d.byteLength}`);return h&&(d=Buffer.from(DL(d,h))),this.readDepth>3&&(this.offsetCache[e]={type:f,object:d}),{type:f,format:"content",object:d}}};l(Ba,"GitPackIndex");var Ua=Ba,Af=Symbol("PackfileCache");async function UL({fs:t,filename:e,getExternalRefDelta:r,emitter:i,emitterPrefix:n}){let s=await t.read(e);return Ua.fromIdx({idx:s,getExternalRefDelta:r})}l(UL,"loadPackIndex");function Dw({fs:t,cache:e,filename:r,getExternalRefDelta:i,emitter:n,emitterPrefix:s}){e[Af]||(e[Af]=new Map);let o=e[Af].get(r);return o||(o=UL({fs:t,filename:r,getExternalRefDelta:i,emitter:n,emitterPrefix:s}),e[Af].set(r,o)),o}l(Dw,"readPackIndex");async function WL({fs:t,cache:e,gitdir:r,oid:i,format:n="content",getExternalRefDelta:s}){let o=await t.readdir(C(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 z(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(WL,"readObjectPacked");async function he({fs:t,cache:e,gitdir:r,oid:i,format:n="content"}){let s=l(u=>he({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 QT({fs:t,gitdir:r,oid:i})),!o){if(o=await WL({fs:t,cache:e,gitdir:r,oid:i,getExternalRefDelta:s}),!o)throw new le(i);return o}if(n==="deflated"||(o.format==="deflated"&&(o.object=Buffer.from(await t1(o.object)),o.format="wrapped"),n==="wrapped"))return o;let f=await Mr(o.object);if(f!==i)throw new z(`SHA check failed! Expected ${i}, computed ${f}`);let{object:c,type:a}=li.unwrap(o.object);if(o.type=a,o.object=c,o.format="content",n==="content")return o;throw new z(`invalid requested format "${n}"`)}l(he,"_readObject");var eu=class eu extends ee{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=eu.code,this.data={noun:e,where:r,canForce:i}}};l(eu,"AlreadyExistsError");var Yt=eu;Yt.code="AlreadyExistsError";var tu=class tu extends ee{constructor(e,r,i){super(`Found multiple ${e} matching "${r}" (${i.join(", ")}). Use a longer abbreviation length to disambiguate them.`),this.code=this.name=tu.code,this.data={nouns:e,short:r,matches:i}}};l(tu,"AmbiguousError");var Wa=tu;Wa.code="AmbiguousError";var ru=class ru extends ee{constructor(e){super(`Your local changes to the following files would be overwritten by checkout: ${e.join(", ")}`),this.code=this.name=ru.code,this.data={filepaths:e}}};l(ru,"CheckoutConflictError");var za=ru;za.code="CheckoutConflictError";var iu=class iu extends ee{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=iu.code,this.data={ref:e,oid:r}}};l(iu,"CommitNotFetchedError");var Ha=iu;Ha.code="CommitNotFetchedError";var nu=class nu extends ee{constructor(){super("Empty response from git server."),this.code=this.name=nu.code,this.data={}}};l(nu,"EmptyServerResponseError");var Va=nu;Va.code="EmptyServerResponseError";var su=class su extends ee{constructor(){super("A simple fast-forward merge was not possible."),this.code=this.name=su.code,this.data={}}};l(su,"FastForwardError");var Ga=su;Ga.code="FastForwardError";var ou=class ou extends ee{constructor(e,r){super(`One or more branches were not updated: ${e}`),this.code=this.name=ou.code,this.data={prettyDetails:e,result:r}}};l(ou,"GitPushError");var Ja=ou;Ja.code="GitPushError";var au=class au extends ee{constructor(e,r,i){super(`HTTP Error: ${e} ${r}`),this.code=this.name=au.code,this.data={statusCode:e,statusMessage:r,response:i}}};l(au,"HttpError");var zs=au;zs.code="HttpError";var cu=class cu extends ee{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=cu.code,this.data={reason:e}}};l(cu,"InvalidFilepathError");var fi=cu;fi.code="InvalidFilepathError";var lu=class lu extends ee{constructor(e,r){super(`"${e}" would be an invalid git reference. (Hint: a valid alternative would be "${r}".)`),this.code=this.name=lu.code,this.data={ref:e,suggestion:r}}};l(lu,"InvalidRefNameError");var Zt=lu;Zt.code="InvalidRefNameError";var fu=class fu extends ee{constructor(e){super(`Maximum search depth of ${e} exceeded.`),this.code=this.name=fu.code,this.data={depth:e}}};l(fu,"MaxDepthError");var Ka=fu;Ka.code="MaxDepthError";var uu=class uu extends ee{constructor(){super("Merges with conflicts are not supported yet."),this.code=this.name=uu.code,this.data={}}};l(uu,"MergeNotSupportedError");var Hs=uu;Hs.code="MergeNotSupportedError";var hu=class hu extends ee{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=hu.code,this.data={filepaths:e,bothModified:r,deleteByUs:i,deleteByTheirs:n}}};l(hu,"MergeConflictError");var Vs=hu;Vs.code="MergeConflictError";var du=class du extends ee{constructor(e){super(`No name was provided for ${e} in the argument or in the .git/config file.`),this.code=this.name=du.code,this.data={role:e}}};l(du,"MissingNameError");var Ye=du;Ye.code="MissingNameError";var pu=class pu extends ee{constructor(e){super(`The function requires a "${e}" parameter but none was provided.`),this.code=this.name=pu.code,this.data={parameter:e}}};l(pu,"MissingParameterError");var dt=pu;dt.code="MissingParameterError";var mu=class mu extends ee{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=mu.code,this.data={errors:e},this.errors=e}};l(mu,"MultipleGitError");var Xa=mu;Xa.code="MultipleGitError";var wu=class wu extends ee{constructor(e,r){super(`Expected "${e}" but received "${r}".`),this.code=this.name=wu.code,this.data={expected:e,actual:r}}};l(wu,"ParseError");var Zi=wu;Zi.code="ParseError";var yu=class yu extends ee{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=yu.code,this.data={reason:e}}};l(yu,"PushRejectedError");var Gs=yu;Gs.code="PushRejectedError";var gu=class gu extends ee{constructor(e,r){super(`Remote does not support the "${e}" so the "${r}" parameter cannot be used.`),this.code=this.name=gu.code,this.data={capability:e,parameter:r}}};l(gu,"RemoteCapabilityError");var ai=gu;ai.code="RemoteCapabilityError";var bu=class bu extends ee{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=bu.code,this.data={preview:e,response:r}}};l(bu,"SmartHttpError");var Ya=bu;Ya.code="SmartHttpError";var _u=class _u extends ee{constructor(e,r,i){super(`Git remote "${e}" uses an unrecognized transport protocol: "${r}"`),this.code=this.name=_u.code,this.data={url:e,transport:r,suggestion:i}}};l(_u,"UnknownTransportError");var Za=_u;Za.code="UnknownTransportError";var Su=class Su extends ee{constructor(e){super(`Cannot parse remote URL: "${e}"`),this.code=this.name=Su.code,this.data={url:e}}};l(Su,"UrlParseError");var Qa=Su;Qa.code="UrlParseError";var vu=class vu extends ee{constructor(){super("The operation was canceled."),this.code=this.name=vu.code,this.data={}}};l(vu,"UserCanceledError");var Js=vu;Js.code="UserCanceledError";var Eu=class Eu extends ee{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=Eu.code,this.data={filepath:e}}};l(Eu,"IndexResetError");var ec=Eu;ec.code="IndexResetError";var Fu=class Fu extends ee{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=Fu.code,this.data={ref:e}}};l(Fu,"NoCommitError");var tc=Fu;tc.code="NoCommitError";var r1=Object.freeze({__proto__:null,AlreadyExistsError:Yt,AmbiguousError:Wa,CheckoutConflictError:za,CommitNotFetchedError:Ha,EmptyServerResponseError:Va,FastForwardError:Ga,GitPushError:Ja,HttpError:zs,InternalError:z,InvalidFilepathError:fi,InvalidOidError:ci,InvalidRefNameError:Zt,MaxDepthError:Ka,MergeNotSupportedError:Hs,MergeConflictError:Vs,MissingNameError:Ye,MissingParameterError:dt,MultipleGitError:Xa,NoRefspecError:qa,NotFoundError:le,ObjectTypeError:ot,ParseError:Zi,PushRejectedError:Gs,RemoteCapabilityError:ai,SmartHttpError:Ya,UnknownTransportError:Za,UnsafeFilepathError:qs,UrlParseError:Qa,UserCanceledError:Js,UnmergedPathsError:ja,IndexResetError:ec,NoCommitError:tc});function Tw({name:t,email:e,timestamp:r,timezoneOffset:i}){return i=zL(i),`${t} <${e}> ${r} ${i}`}l(Tw,"formatAuthor");function zL(t){let e=HL(VL(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(zL,"formatTimezoneOffset");function HL(t){return Math.sign(t)||(Object.is(t,-0)?-1:1)}l(HL,"simpleSign");function VL(t){return t===0?t:-t}l(VL,"negateExceptForZero");function Br(t){return t=t.replace(/\r/g,""),t=t.replace(/^\n+/,""),t=t.replace(/\n+$/,"")+`
27
+ `,t}l(Br,"normalizeNewlines");function $f(t){let[,e,r,i,n]=t.match(/^(.*) <(.*)> (.*) (.*)$/);return{name:e,email:r,timestamp:Number(i),timezoneOffset:GL(n)}}l($f,"parseAuthor");function GL(t){let[,e,r,i]=t.match(/(\+|-)(\d\d)(\d\d)/);return i=(e==="+"?1:-1)*(Number(r)*60+Number(i)),JL(i)}l(GL,"parseTimezoneOffset");function JL(t){return t===0?t:-t}l(JL,"negateExceptForZero$1");var Ms=class Ms{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=Ms.render(e);else throw new z("invalid type passed to GitAnnotatedTag constructor")}static from(e){return new Ms(e)}static render(e){return`object ${e.object}
24
28
  type ${e.type}
25
29
  tag ${e.tag}
26
- tagger ${Kp(e.tagger)}
30
+ tagger ${Tw(e.tagger)}
27
31
 
28
32
  ${e.message}
29
33
  ${e.gpgsig?e.gpgsig:""}`}justHeaders(){return this._tag.slice(0,this._tag.indexOf(`
@@ -32,49 +36,49 @@ ${e.gpgsig?e.gpgsig:""}`}justHeaders(){return this._tag.slice(0,this._tag.indexO
32
36
 
33
37
  `)+2)}parse(){return Object.assign(this.headers(),{message:this.message(),gpgsig:this.gpgsig()})}render(){return this._tag}headers(){let e=this.justHeaders().split(`
34
38
  `),r=[];for(let n of e)n[0]===" "?r[r.length-1]+=`
35
- `+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=kl(i.tagger)),i.committer&&(i.committer=kl(i.committer)),i}withoutSignature(){let e=vr(this._tag);return e.indexOf(`
39
+ `+n.slice(1):r.push(n);let i={};for(let n of r){let s=n.slice(0,n.indexOf(" ")),o=n.slice(n.indexOf(" ")+1);Array.isArray(i[s])?i[s].push(o):i[s]=o}return i.tagger&&(i.tagger=$f(i.tagger)),i.committer&&(i.committer=$f(i.committer)),i}withoutSignature(){let e=Br(this._tag);return e.indexOf(`
36
40
  -----BEGIN PGP SIGNATURE-----`)===-1?e:e.slice(0,e.lastIndexOf(`
37
41
  -----BEGIN PGP SIGNATURE-----`))}gpgsig(){if(this._tag.indexOf(`
38
- -----BEGIN PGP SIGNATURE-----`)===-1)return;let e=this._tag.slice(this._tag.indexOf("-----BEGIN PGP SIGNATURE-----"),this._tag.indexOf("-----END PGP SIGNATURE-----")+27);return vr(e)}payload(){return this.withoutSignature()+`
39
- `}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=vr(s);let a=n+s;return is.from(a)}};l(is,"GitAnnotatedTag");var dt=is;function $p(t){return t.trim().split(`
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 Br(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=Br(s);let o=n+s;return Ms.from(o)}};l(Ms,"GitAnnotatedTag");var Ft=Ms;function dw(t){return t.trim().split(`
40
44
  `).map(e=>" "+e).join(`
41
45
  `)+`
42
- `}l($p,"indent");function p2(t){return t.split(`
46
+ `}l(dw,"indent");function KL(t){return t.split(`
43
47
  `).map(e=>e.replace(/^ /,"")).join(`
44
- `)}l(p2,"outdent");var et=class et{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=et.render(e);else throw new W("invalid type passed to GitCommit constructor")}static fromPayloadSignature({payload:e,signature:r}){let i=et.justHeaders(e),n=et.justMessage(e),s=vr(i+`
45
- gpgsig`+$p(r)+`
46
- `+n);return new et(s)}static from(e){return new et(e)}toObject(){return Buffer.from(this._commit,"utf8")}headers(){return this.parseHeaders()}message(){return et.justMessage(this._commit)}parse(){return Object.assign({message:this.message()},this.headers())}static justMessage(e){return vr(e.slice(e.indexOf(`
48
+ `)}l(KL,"outdent");var ht=class ht{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=ht.render(e);else throw new z("invalid type passed to GitCommit constructor")}static fromPayloadSignature({payload:e,signature:r}){let i=ht.justHeaders(e),n=ht.justMessage(e),s=Br(i+`
49
+ gpgsig`+dw(r)+`
50
+ `+n);return new ht(s)}static from(e){return new ht(e)}toObject(){return Buffer.from(this._commit,"utf8")}headers(){return this.parseHeaders()}message(){return ht.justMessage(this._commit)}parse(){return Object.assign({message:this.message()},this.headers())}static justMessage(e){return Br(e.slice(e.indexOf(`
47
51
 
48
52
  `)+2))}static justHeaders(e){return e.slice(0,e.indexOf(`
49
53
 
50
- `))}parseHeaders(){let e=et.justHeaders(this._commit).split(`
54
+ `))}parseHeaders(){let e=ht.justHeaders(this._commit).split(`
51
55
  `),r=[];for(let n of e)n[0]===" "?r[r.length-1]+=`
52
- `+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=kl(i.author)),i.committer&&(i.committer=kl(i.committer)),i}static renderHeaders(e){let r="";if(e.tree?r+=`tree ${e.tree}
56
+ `+n.slice(1):r.push(n);let i={parent:[]};for(let n of r){let s=n.slice(0,n.indexOf(" ")),o=n.slice(n.indexOf(" ")+1);Array.isArray(i[s])?i[s].push(o):i[s]=o}return i.author&&(i.author=$f(i.author)),i.committer&&(i.committer=$f(i.committer)),i}static renderHeaders(e){let r="";if(e.tree?r+=`tree ${e.tree}
53
57
  `:r+=`tree 4b825dc642cb6eb9a060e54bf8d69288fbee4904
54
- `,e.parent){if(e.parent.length===void 0)throw new W("commit 'parent' property should be an array");for(let s of e.parent)r+=`parent ${s}
55
- `}let i=e.author;r+=`author ${Kp(i)}
56
- `;let n=e.committer||e.author;return r+=`committer ${Kp(n)}
57
- `,e.gpgsig&&(r+="gpgsig"+$p(e.gpgsig)),r}static render(e){return et.renderHeaders(e)+`
58
- `+vr(e.message)}render(){return this._commit}withoutSignature(){let e=vr(this._commit);if(e.indexOf(`
58
+ `,e.parent){if(e.parent.length===void 0)throw new z("commit 'parent' property should be an array");for(let s of e.parent)r+=`parent ${s}
59
+ `}let i=e.author;r+=`author ${Tw(i)}
60
+ `;let n=e.committer||e.author;return r+=`committer ${Tw(n)}
61
+ `,e.gpgsig&&(r+="gpgsig"+dw(e.gpgsig)),r}static render(e){return ht.renderHeaders(e)+`
62
+ `+Br(e.message)}render(){return this._commit}withoutSignature(){let e=Br(this._commit);if(e.indexOf(`
59
63
  gpgsig`)===-1)return e;let r=e.slice(0,e.indexOf(`
60
64
  gpgsig`)),i=e.slice(e.indexOf(`-----END PGP SIGNATURE-----
61
- `)+28);return vr(r+`
62
- `+i)}isolateSignature(){let e=this._commit.slice(this._commit.indexOf("-----BEGIN PGP SIGNATURE-----"),this._commit.indexOf("-----END PGP SIGNATURE-----")+27);return p2(e)}static async sign(e,r,i){let n=e.withoutSignature(),s=et.justMessage(e._commit),{signature:a}=await r({payload:n,secretKey:i});a=vr(a);let o=et.justHeaders(e._commit)+`
63
- gpgsig`+$p(a)+`
64
- `+s;return et.from(o)}};l(et,"GitCommit");var it=et;async function ps({fs:t,cache:e,gitdir:r,oid:i}){if(i==="4b825dc642cb6eb9a060e54bf8d69288fbee4904")return{tree:rt.from([]),oid:i};let{type:n,object:s}=await fe({fs:t,cache:e,gitdir:r,oid:i});if(n==="tag")return i=dt.from(s).parse().object,ps({fs:t,cache:e,gitdir:r,oid:i});if(n==="commit")return i=it.from(s).parse().tree,ps({fs:t,cache:e,gitdir:r,oid:i});if(n!=="tree")throw new Ye(i,n,"tree");return{tree:rt.from(s),oid:i}}l(ps,"resolveTree");var pm=class pm{constructor({fs:e,gitdir:r,ref:i,cache:n}){var a;this.fs=e,this.cache=n,this.gitdir=r,this.mapPromise=(async()=>{let f=new Map,o;try{o=await $.resolve({fs:e,gitdir:r,ref:i})}catch(u){u instanceof oe&&(o="4b825dc642cb6eb9a060e54bf8d69288fbee4904")}let c=await ps({fs:e,cache:this.cache,gitdir:r,oid:o});return c.type="tree",c.mode="40000",f.set(".",c),f})();let s=this;this.ConstructEntry=(a=class{constructor(o){this._fullpath=o,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)}},l(a,"TreeEntry"),a)}async readdir(e){let r=e._fullpath,{fs:i,cache:n,gitdir:s}=this,a=await this.mapPromise,f=a.get(r);if(!f)throw new Error(`No obj for ${r}`);let o=f.oid;if(!o)throw new Error(`No oid for obj ${JSON.stringify(f)}`);if(f.type!=="tree")return null;let{type:c,object:u}=await fe({fs:i,cache:n,gitdir:s,oid:o});if(c!==f.type)throw new Ye(o,c,f.type);let h=rt.from(u);for(let d of h)a.set(C.join(r,d.path),d);return h.entries().map(d=>C.join(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=gS(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,f=r.get(e._fullpath).oid,{type:o,object:c}=await fe({fs:i,cache:n,gitdir:s,oid:f});o!=="blob"?e._content=void 0:e._content=new Uint8Array(c)}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}};l(pm,"GitWalkerRepo");var Jp=pm;function ht({ref:t="HEAD"}={}){let e=Object.create(null);return Object.defineProperty(e,_f,{value:l(function({fs:r,gitdir:i,cache:n}){return new Jp({fs:r,gitdir:i,ref:t,cache:n})},"value")}),Object.freeze(e),e}l(ht,"TREE");var mm=class mm{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(o){this._fullpath=o,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)}},l(a,"WorkdirEntry"),a)}async readdir(e){let r=e._fullpath,{fs:i,dir:n}=this,s=await i.readdir(C.join(n,r));return s===null?null:s.map(a=>C.join(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=os(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"),f=await r.read(`${i}/${e._fullpath}`,{autocrlf:a});e._actualSize=f.length,e._stat&&e._stat.size===-1&&(e._stat.size=e._actualSize),e._content=new Uint8Array(f)}}return e._content}async oid(e){if(e._oid===!1){let r=this,{fs:i,gitdir:n,cache:s}=this,a;await ge.acquire({fs:i,gitdir:n,cache:s},async function(f){let o=f.entriesMap.get(e._fullpath),c=await e.stat(),h=await(await r._getGitConfig(i,n)).get("core.filemode"),d=typeof process<"u"?process.platform!=="win32":!0;if(!o||Sl(c,o,h,d)){let p=await e.content();p===void 0?a=void 0:(a=await Er(Hr.wrap({type:"blob",object:p})),o&&a===o.oid&&(!h||c.mode===o.mode)&&Sl(c,o,h,d)&&f.insert({filepath:e._fullpath,stats:c,oid:a}))}else a=o.oid}),e._oid=a}return e._oid}async _getGitConfig(e,r){return this.config?this.config:(this.config=await me.get({fs:e,gitdir:r}),this.config)}};l(mm,"GitWalkerFs");var Xp=mm;function _s(){let t=Object.create(null);return Object.defineProperty(t,_f,{value:l(function({fs:e,dir:r,gitdir:i,cache:n}){return new Xp({fs:e,dir:r,gitdir:i,cache:n})},"value")}),Object.freeze(t),t}l(_s,"WORKDIR");function m2(t,e){let r=e-t;return Array.from({length:r},(i,n)=>t+n)}l(m2,"arrayRange");var RS=typeof Array.prototype.flat>"u"?t=>t.reduce((e,r)=>e.concat(r),[]):t=>t.flat(),wm=class wm{constructor(){this.value=null}consider(e){e!=null&&(this.value===null?this.value=e:e<this.value&&(this.value=e))}reset(){this.value=null}};l(wm,"RunningMinimum");var Yp=wm;function*w2(t){let e=new Yp,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}}l(w2,"unionOfIterators");async function Gr({fs:t,cache:e,dir:r,gitdir:i,trees:n,map:s=l(async(o,c)=>c,"map"),reduce:a=l(async(o,c)=>{let u=RS(c);return o!==void 0&&u.unshift(o),u},"reduce"),iterate:f=l((o,c)=>Promise.all([...c].map(o)),"iterate")}){let o=n.map(p=>p[_f]({fs:t,dir:r,gitdir:i,cache:e})),c=new Array(o.length).fill("."),u=m2(0,o.length),h=l(async p=>{u.map(y=>{let g=p[y];p[y]=g&&new o[y].ConstructEntry(g)});let w=(await Promise.all(u.map(y=>{let g=p[y];return g?o[y].readdir(g):[]}))).map(y=>(y===null?[]:y)[Symbol.iterator]());return{entries:p,children:w2(w)}},"unionWalkerFromReaddir"),d=l(async p=>{let{entries:m,children:w}=await h(p),y=m.find(_=>_&&_._fullpath)._fullpath,g=await s(y,m);if(g!==null){let _=await f(d,w);return _=_.filter(F=>F!==void 0),a(g,_)}},"walk");return d(c)}l(Gr,"_walk");async function Zp(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.join(e,i);return t.lstat(n).then(s=>{if(s)return s.isDirectory()?Zp(t,n):t.rm(n)})})).then(()=>t.rmdir(e)):await t.rmdir(e)}l(Zp,"rmRecursive");function y2(t){return g2(t)&&iS(t.then)&&iS(t.catch)}l(y2,"isPromiseLike");function g2(t){return t&&typeof t=="object"}l(g2,"isObject");function iS(t){return typeof t=="function"}l(iS,"isFunction");function nS(t){return y2(l(r=>{try{return r.readFile().catch(i=>i)}catch(i){return i}},"test")(t))}l(nS,"isPromiseFs");var sS=["readFile","writeFile","mkdir","rmdir","unlink","stat","lstat","readdir","readlink","symlink"];function aS(t,e){if(nS(e))for(let r of sS)t[`_${r}`]=e[r].bind(e);else for(let r of sS)t[`_${r}`]=Ap(e[r].bind(e));nS(e)?e.rm?t._rm=e.rm.bind(e):e.rmdir.length>1?t._rm=e.rmdir.bind(e):t._rm=Zp.bind(null,t):e.rm?t._rm=Ap(e.rm.bind(e)):e.rmdir.length>2?t._rm=Ap(e.rmdir.bind(e)):t._rm=Zp.bind(null,t)}l(aS,"bindFs");var ym=class ym{constructor(e){if(typeof e._original_unwrapped_fs<"u")return e;let r=Object.getOwnPropertyDescriptor(e,"promises");r&&r.enumerable?aS(this,e.promises):aS(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,`
65
- `),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);return}catch{await this.mkdir(cs(e)),await this._writeFile(e,r,i)}}async mkdir(e,r=!1){try{await this._mkdir(e);return}catch(i){if(i===null||i.code==="EEXIST")return;if(r)throw i;if(i.code==="ENOENT"){let n=cs(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(bf),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(ym,"FileSystem");var M=ym;function S(t,e){if(e===void 0)throw new tt(t)}l(S,"assertParameter");async function xl(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(xl,"modified");async function OS({fs:t,dir:e,gitdir:r=C.join(e,".git"),commit:i="HEAD",cache:n={}}){try{S("fs",t),S("dir",e),S("gitdir",r);let s=new M(t),a=[ht({ref:i}),_s(),Ii()],f=[];await ge.acquire({fs:s,gitdir:r,cache:n},async function(c){f=c.unmergedPaths});let o=await Gr({fs:s,cache:n,dir:e,gitdir:r,trees:a,map:l(async function(c,[u,h,d]){let p=!await xl(h,d),m=f.includes(c),w=!await xl(d,u);if(p||m)return u?{path:c,mode:await u.mode(),oid:await u.oid(),type:await u.type(),content:await u.content()}:void 0;if(w)return!1;throw new oo(c)},"map")});await ge.acquire({fs:s,gitdir:r,cache:n},async function(c){for(let u of o)if(u!==!1){if(!u){await s.rmdir(`${e}/${u.path}`,{recursive:!0}),c.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}),c.insert({filepath:u.path,oid:u.oid,stage:0})}}})}catch(s){throw s.caller="git.abortMerge",s}}l(OS,"abortMerge");var gm=class gm{static async isIgnored({fs:e,dir:r,gitdir:i=C.join(r,".git"),filepath:n}){if(Fl(n)===".git")return!0;if(n===".")return!1;let s="",a=C.join(i,"info","exclude");await e.exists(a)&&(s=await e.read(a,"utf8"));let f=[{gitignore:C.join(r,".gitignore"),filepath:n}],o=n.split("/").filter(Boolean);for(let u=1;u<o.length;u++){let h=o.slice(0,u).join("/"),d=o.slice(u).join("/");f.push({gitignore:C.join(r,h,".gitignore"),filepath:d})}let c=!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=FI().add(s);d.add(h);let p=cs(u.filepath);if(p!=="."&&d.ignores(p))return!0;c?c=!d.test(u.filepath).unignored:c=d.test(u.filepath).ignored}return c}};l(gm,"GitIgnoreManager");var Kr=gm;async function b2({fs:t,gitdir:e,object:r,format:i,oid:n}){if(i!=="deflated")throw new W("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)}l(b2,"writeObjectLoose");var Bp=null;async function kS(t){return Bp===null&&(Bp=v2()),Bp?_2(t):tm.deflate(t)}l(kS,"deflate");async function _2(t){let e=new CompressionStream("deflate"),r=new Blob([t]).stream().pipeThrough(e);return new Uint8Array(await new Response(r).arrayBuffer())}l(_2,"browserDeflate");function v2(){try{return new CompressionStream("deflate").writable.close(),new Blob([]).stream().cancel(),!0}catch{return!1}}l(v2,"testCompressionStream");async function nt({fs:t,gitdir:e,type:r,object:i,format:n="content",oid:s=void 0,dryRun:a=!1}){return n!=="deflated"&&(n!=="wrapped"&&(i=Hr.wrap({type:r,object:i})),s=await Er(i),i=Buffer.from(await kS(i))),a||await b2({fs:t,gitdir:e,object:i,format:"deflated",oid:s}),s}l(nt,"_writeObject");function xS(t){let e;for(;~(e=t.indexOf(92));)t[e]=47;return t}l(xS,"posixifyPathBuffer");async function AS({fs:t,dir:e,gitdir:r=C.join(e,".git"),filepath:i,cache:n={},force:s=!1,parallel:a=!0}){try{S("fs",t),S("dir",e),S("gitdir",r),S("filepath",i);let f=new M(t);await ge.acquire({fs:f,gitdir:r,cache:n},async o=>{let u=await(await me.get({fs:f,gitdir:r})).get("core.autocrlf");return Qp({dir:e,gitdir:r,fs:f,filepath:i,index:o,force:s,parallel:a,autocrlf:u})})}catch(f){throw f.caller="git.add",f}}l(AS,"add");async function Qp({dir:t,gitdir:e,fs:r,filepath:i,index:n,force:s,parallel:a,autocrlf:f}){i=Array.isArray(i)?i:[i];let o=i.map(async d=>{if(!s&&await Kr.isIgnored({fs:r,dir:t,gitdir:e,filepath:d}))return;let p=await r.lstat(C.join(t,d));if(!p)throw new oe(d);if(p.isDirectory()){let m=await r.readdir(C.join(t,d));if(a){let w=m.map(y=>Qp({dir:t,gitdir:e,fs:r,filepath:[C.join(d,y)],index:n,force:s,parallel:a,autocrlf:f}));await Promise.all(w)}else for(let w of m)await Qp({dir:t,gitdir:e,fs:r,filepath:[C.join(d,w)],index:n,force:s,parallel:a,autocrlf:f})}else{let m=p.isSymbolicLink()?await r.readlink(C.join(t,d)).then(xS):await r.read(C.join(t,d),{autocrlf:f});if(m===null)throw new oe(d);let w=await nt({fs:r,gitdir:e,type:"blob",object:m});n.insert({filepath:d,stats:p,oid:w})}}),c=await Promise.allSettled(o),u=c.filter(d=>d.status==="rejected").map(d=>d.reason);if(u.length>1)throw new io(u);if(u.length===1)throw u[0];return c.filter(d=>d.status==="fulfilled"&&d.value).map(d=>d.value)}l(Qp,"addToIndex");async function lo({fs:t,gitdir:e,path:r}){return(await me.get({fs:t,gitdir:e})).get(r)}l(lo,"_getConfig");function PS(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(PS,"assignDefined");async function Jr({fs:t,gitdir:e,author:r,commit:i}){let n=Math.floor(Date.now()/1e3),s={name:await lo({fs:t,gitdir:e,path:"user.name"}),email:await lo({fs:t,gitdir:e,path:"user.email"})||"",timestamp:n,timezoneOffset:new Date(n*1e3).getTimezoneOffset()},a=PS({},s,i?i.author:void 0,r);if(a.name!==void 0)return a}l(Jr,"normalizeAuthorObject");async function ms({fs:t,gitdir:e,author:r,committer:i,commit:n}){let s=Math.floor(Date.now()/1e3),a={name:await lo({fs:t,gitdir:e,path:"user.name"}),email:await lo({fs:t,gitdir:e,path:"user.email"})||"",timestamp:s,timezoneOffset:new Date(s*1e3).getTimezoneOffset()},f=PS({},a,n?n.committer:void 0,r,i);if(f.name!==void 0)return f}l(ms,"normalizeCommitterObject");async function NS({fs:t,cache:e,gitdir:r,oid:i}){let{type:n,object:s}=await fe({fs:t,cache:e,gitdir:r,oid:i});if(n==="tag")return i=dt.from(s).parse().object,NS({fs:t,cache:e,gitdir:r,oid:i});if(n!=="commit")throw new Ye(i,n,"commit");return{commit:it.from(s),oid:i}}l(NS,"resolveCommit");async function ws({fs:t,cache:e,gitdir:r,oid:i}){let{commit:n,oid:s}=await NS({fs:t,cache:e,gitdir:r,oid:i});return{oid:s,commit:n.parse(),payload:n.withoutSignature()}}l(ws,"_readCommit");async function vf({fs:t,cache:e,onSign:r,gitdir:i,message:n,author:s,committer:a,signingKey:f,amend:o=!1,dryRun:c=!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 ws({fs:t,gitdir:i,oid:w,cache:{}})}catch{m=!0}if(o&&m)throw new co(h);let g=o?await Jr({fs:t,gitdir:i,author:s,commit:y.commit}):await Jr({fs:t,gitdir:i,author:s});if(!g)throw new ze("author");let _=o?await ms({fs:t,gitdir:i,author:g,committer:a,commit:y.commit}):await ms({fs:t,gitdir:i,author:g,committer:a});if(!_)throw new ze("committer");return ge.acquire({fs:t,gitdir:i,cache:e,allowUnmerged:!1},async function(F){let k=_S(F.entries).get(".");if(p||(p=await DS({fs:t,gitdir:i,inode:k,dryRun:c})),d?d=await Promise.all(d.map(O=>$.resolve({fs:t,gitdir:i,ref:O}))):o?d=y.commit.parent:d=w?[w]:[],!n)if(o)n=y.commit.message;else throw new tt("message");let D=it.from({tree:p,parent:d,author:g,committer:_,message:n});f&&(D=await it.sign(D,r,f));let v=await nt({fs:t,gitdir:i,type:"commit",object:D.toObject(),dryRun:c});return!u&&!c&&await $.writeRef({fs:t,gitdir:i,ref:h,value:v}),v})}l(vf,"_commit");async function DS({fs:t,gitdir:e,inode:r,dryRun:i}){let n=r.children;for(let o of n)o.type==="tree"&&(o.metadata.mode="040000",o.metadata.oid=await DS({fs:t,gitdir:e,inode:o,dryRun:i}));let s=n.map(o=>({mode:o.metadata.mode,path:o.basename,oid:o.metadata.oid,type:o.type})),a=rt.from(s);return await nt({fs:t,gitdir:e,type:"tree",object:a.toObject(),dryRun:i})}l(DS,"constructTree");async function fo({fs:t,cache:e,gitdir:r,oid:i,filepath:n}){if(n.startsWith("/"))throw new Vr("leading-slash");if(n.endsWith("/"))throw new Vr("trailing-slash");let s=i,a=await ps({fs:t,cache:e,gitdir:r,oid:i}),f=a.tree;if(n==="")i=a.oid;else{let o=n.split("/");i=await CS({fs:t,cache:e,gitdir:r,tree:f,pathArray:o,oid:s,filepath:n})}return i}l(fo,"resolveFilepath");async function CS({fs:t,cache:e,gitdir:r,tree:i,pathArray:n,oid:s,filepath:a}){let f=n.shift();for(let o of i)if(o.path===f){if(n.length===0)return o.oid;{let{type:c,object:u}=await fe({fs:t,cache:e,gitdir:r,oid:o.oid});if(c!=="tree")throw new Ye(s,c,"tree",a);return i=rt.from(u),CS({fs:t,cache:e,gitdir:r,tree:i,pathArray:n,oid:s,filepath:a})}}throw new oe(`file or directory found at "${s}:${a}"`)}l(CS,"_resolveFilepath");async function vs({fs:t,cache:e,gitdir:r,oid:i,filepath:n=void 0}){n!==void 0&&(i=await fo({fs:t,cache:e,gitdir:r,oid:i,filepath:n}));let{tree:s,oid:a}=await ps({fs:t,cache:e,gitdir:r,oid:i});return{oid:a,tree:s.entries()}}l(vs,"_readTree");async function uo({fs:t,gitdir:e,tree:r}){let i=rt.from(r).toObject();return await nt({fs:t,gitdir:e,type:"tree",object:i,format:"content"})}l(uo,"_writeTree");async function E2({fs:t,cache:e,onSign:r,gitdir:i,ref:n,oid:s,note:a,force:f,author:o,committer:c,signingKey:u}){let h;try{h=await $.resolve({gitdir:i,fs:t,ref:n})}catch(g){if(!(g instanceof oe))throw g}let p=(await vs({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 jt("note",s);typeof a=="string"&&(a=Buffer.from(a,"utf8"));let m=await nt({fs:t,gitdir:i,type:"blob",object:a,format:"content"});p.push({mode:"100644",path:s,oid:m,type:"blob"});let w=await uo({fs:t,gitdir:i,tree:p});return await vf({fs:t,cache:e,onSign:r,gitdir:i,ref:n,tree:w,parent:h&&[h],message:`Note added by 'isomorphic-git addNote'
66
- `,author:o,committer:c,signingKey:u})}l(E2,"_addNote");async function IS({fs:t,onSign:e,dir:r,gitdir:i=C.join(r,".git"),ref:n="refs/notes/commits",oid:s,note:a,force:f,author:o,committer:c,signingKey:u,cache:h={}}){try{S("fs",t),S("gitdir",i),S("oid",s),S("note",a),u&&S("onSign",e);let d=new M(t),p=await Jr({fs:d,gitdir:i,author:o});if(!p)throw new ze("author");let m=await ms({fs:d,gitdir:i,author:p,committer:c});if(!m)throw new ze("committer");return await E2({fs:new M(d),cache:h,onSign:e,gitdir:i,ref:n,oid:s,note:a,force:f,author:p,committer:m,signingKey:u})}catch(d){throw d.caller="git.addNote",d}}l(IS,"addNote");async function $S({fs:t,gitdir:e,remote:r,url:i,force:n}){if(!Va(r,!0))throw new Lt(r,Ha.clean(r));let s=await me.get({fs:t,gitdir:e});if(!n&&(await s.getSubsections("remote")).includes(r)&&i!==await s.get(`remote.${r}.url`))throw new jt("remote",r);await s.set(`remote.${r}.url`,i),await s.set(`remote.${r}.fetch`,`+refs/heads/*:refs/remotes/${r}/*`),await me.save({fs:t,gitdir:e,config:s})}l($S,"_addRemote");async function BS({fs:t,dir:e,gitdir:r=C.join(e,".git"),remote:i,url:n,force:s=!1}){try{return S("fs",t),S("gitdir",r),S("remote",i),S("url",n),await $S({fs:new M(t),gitdir:r,remote:i,url:n,force:s})}catch(a){throw a.caller="git.addRemote",a}}l(BS,"addRemote");async function S2({fs:t,cache:e,onSign:r,gitdir:i,ref:n,tagger:s,message:a=n,gpgsig:f,object:o,signingKey:c,force:u=!1}){if(n=n.startsWith("refs/tags/")?n:`refs/tags/${n}`,!u&&await $.exists({fs:t,gitdir:i,ref:n}))throw new jt("tag",n);let h=await $.resolve({fs:t,gitdir:i,ref:o||"HEAD"}),{type:d}=await fe({fs:t,cache:e,gitdir:i,oid:h}),p=dt.from({object:h,type:d,tag:n.replace("refs/tags/",""),tagger:s,message:a,gpgsig:f});c&&(p=await dt.sign(p,r,c));let m=await nt({fs:t,gitdir:i,type:"tag",object:p.toObject()});await $.writeRef({fs:t,gitdir:i,ref:n,value:m})}l(S2,"_annotatedTag");async function MS({fs:t,onSign:e,dir:r,gitdir:i=C.join(r,".git"),ref:n,tagger:s,message:a=n,gpgsig:f,object:o,signingKey:c,force:u=!1,cache:h={}}){try{S("fs",t),S("gitdir",i),S("ref",n),c&&S("onSign",e);let d=new M(t),p=await Jr({fs:d,gitdir:i,author:s});if(!p)throw new ze("tagger");return await S2({fs:d,cache:h,onSign:e,gitdir:i,ref:n,tagger:p,message:a,gpgsig:f,object:o,signingKey:c,force:u})}catch(d){throw d.caller="git.annotatedTag",d}}l(MS,"annotatedTag");async function F2({fs:t,gitdir:e,ref:r,object:i,checkout:n=!1,force:s=!1}){if(!Va(r,!0))throw new Lt(r,Ha.clean(r));let a=`refs/heads/${r}`;if(!s&&await $.exists({fs:t,gitdir:e,ref:a}))throw new jt("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:a,value:f}),n&&await $.writeSymbolicRef({fs:t,gitdir:e,ref:"HEAD",value:a})}l(F2,"_branch");async function jS({fs:t,dir:e,gitdir:r=C.join(e,".git"),ref:i,object:n,checkout:s=!1,force:a=!1}){try{return S("fs",t),S("gitdir",r),S("ref",i),await F2({fs:new M(t),gitdir:r,ref:i,object:n,checkout:s,force:a})}catch(f){throw f.caller="git.branch",f}}l(jS,"branch");var LS=l((t,e)=>t==="."||e==null||e.length===0||e==="."?!0:e.length>=t.length?e.startsWith(t):t.startsWith(e),"worthWalking");async function im({fs:t,cache:e,onProgress:r,onPostCheckout:i,dir:n,gitdir:s,remote:a,ref:f,filepaths:o,noCheckout:c,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=`${a}/${f}`;if(g=await $.resolve({fs:t,gitdir:s,ref:F}),p){let R=await me.get({fs:t,gitdir:s});await R.set(`branch.${f}.remote`,a),await R.set(`branch.${f}.merge`,`refs/heads/${f}`),await me.save({fs:t,gitdir:s,config:R})}await $.writeRef({fs:t,gitdir:s,ref:`refs/heads/${f}`,value:g})}if(!c){let _;try{_=await T2({fs:t,cache:e,onProgress:r,dir:n,gitdir:s,ref:f,force:d,filepaths:o})}catch(v){throw v instanceof oe&&v.data.what===g?new Za(f,g):v}let F=_.filter(([v])=>v==="conflict").map(([v,O])=>O);if(F.length>0)throw new Ya(F);let R=_.filter(([v])=>v==="error").map(([v,O])=>O);if(R.length>0)throw new W(R.join(", "));if(h){i&&await i({previousHead:y,newHead:g,type:o!=null&&o.length>0?"file":"branch"});return}let k=0,D=_.length;if(await ge.acquire({fs:t,gitdir:s,cache:e},async function(v){await Promise.all(_.filter(([O])=>O==="delete"||O==="delete-index").map(async function([O,E]){let N=`${n}/${E}`;O==="delete"&&await t.rm(N),v.delete({filepath:E}),r&&await r({phase:"Updating workdir",loaded:++k,total:D})}))}),await ge.acquire({fs:t,gitdir:s,cache:e},async function(v){for(let[O,E]of _)if(O==="rmdir"||O==="rmdir-index"){let N=`${n}/${E}`;try{O==="rmdir"&&await t.rmdir(N),v.delete({filepath:E}),r&&await r({phase:"Updating workdir",loaded:++k,total:D})}catch(x){if(x.code==="ENOTEMPTY")console.log(`Did not delete ${E} because directory is not empty`);else throw x}}}),await Promise.all(_.filter(([v])=>v==="mkdir"||v==="mkdir-index").map(async function([v,O]){let E=`${n}/${O}`;await t.mkdir(E),r&&await r({phase:"Updating workdir",loaded:++k,total:D})})),m){let v=_.filter(([E])=>E==="create"||E==="create-index"||E==="update"||E==="mkdir-index"),O=await oS("Update Working Dir",v.map(([E,N,x,I,q])=>()=>O2({fs:t,cache:e,gitdir:s,dir:n},[E,N,x,I,q])),r,w);await ge.acquire({fs:t,gitdir:s,cache:e,allowUnmerged:!0},async function(E){await oS("Update Index",O.map(([N,x,I])=>()=>R2({index:E,fullpath:N,oid:x,stats:I})),r,w)})}else await ge.acquire({fs:t,gitdir:s,cache:e,allowUnmerged:!0},async function(v){await Promise.all(_.filter(([O])=>O==="create"||O==="create-index"||O==="update"||O==="mkdir-index").map(async function([O,E,N,x,I]){let q=`${n}/${E}`;try{if(O!=="create-index"&&O!=="mkdir-index"){let{object:be}=await fe({fs:t,cache:e,gitdir:s,oid:N});if(I&&await t.rm(q),x===33188)await t.write(q,be);else if(x===33261)await t.write(q,be,{mode:511});else if(x===40960)await t.writelink(q,be);else throw new W(`Invalid mode 0o${x.toString(8)} detected in blob ${N}`)}let z=await t.lstat(q);x===33261&&(z.mode=493),O==="mkdir-index"&&(z.mode=57344),v.insert({filepath:E,stats:z,oid:N}),r&&await r({phase:"Updating workdir",loaded:++k,total:D})}catch(z){console.log(z)}}))});i&&await i({previousHead:y,newHead:g,type:o!=null&&o.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(im,"_checkout");async function T2({fs:t,cache:e,onProgress:r,dir:i,gitdir:n,ref:s,force:a,filepaths:f}){let o=0;return Gr({fs:t,cache:e,dir:i,gitdir:n,trees:[ht({ref:s}),_s(),Ii()],map:l(async function(c,[u,h,d]){if(c===".")return;if(f&&!f.some(m=>LS(c,m)))return null;switch(r&&await r({phase:"Analyzing workdir",loaded:++o}),[!!d,!!u,!!h].map(Number).join("")){case"000":return;case"001":return a&&f&&f.includes(c)?["delete",c]:void 0;case"010":switch(await u.type()){case"tree":return["mkdir",c];case"blob":return["create",c,await u.oid(),await u.mode()];case"commit":return["mkdir-index",c,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",c];case"blob-blob":return await u.oid()!==await h.oid()?a?["update",c,await u.oid(),await u.mode(),await u.mode()!==await h.mode()]:["conflict",c]:await u.mode()!==await h.mode()?a?["update",c,await u.oid(),await u.mode(),!0]:["conflict",c]:["create-index",c,await u.oid(),await u.mode()];case"commit-tree":return;case"commit-blob":return["conflict",c];default:return["error",`new entry Unhandled type ${u.type}`]}case"100":return["delete-index",c];case"101":switch(await d.type()){case"tree":return["rmdir-index",c];case"blob":return await d.oid()!==await h.oid()?a?["delete",c]:["conflict",c]:["delete",c];case"commit":return["rmdir-index",c];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()&&!a)return;if(h){if(await h.oid()!==await d.oid()&&await h.oid()!==await u.oid())return a?["update",c,await u.oid(),await u.mode(),await u.mode()!==await h.mode()]:["conflict",c]}else if(a)return["update",c,await u.oid(),await u.mode(),await u.mode()!==await d.mode()];return await u.mode()!==await d.mode()?["update",c,await u.oid(),await u.mode(),!0]:await u.oid()!==await d.oid()?["update",c,await u.oid(),await u.mode(),!1]:void 0}case"tree-blob":return["update-dir-to-blob",c,await u.oid()];case"blob-tree":return["update-blob-to-tree",c];case"commit-commit":return["mkdir-index",c,await u.oid(),await u.mode()];default:return["error",`update entry Unhandled type ${await d.type()}-${await u.type()}`]}}},"map"),reduce:l(async function(c,u){return u=RS(u),c?c&&c[0]==="rmdir"?(u.push(c),u):(u.unshift(c),u):u},"reduce")})}l(T2,"analyze");async function R2({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(R2,"updateIndex");async function O2({fs:t,cache:e,gitdir:r,dir:i},[n,s,a,f,o]){let c=`${i}/${s}`;if(n!=="create-index"&&n!=="mkdir-index"){let{object:h}=await fe({fs:t,cache:e,gitdir:r,oid:a});if(o&&await t.rm(c),f===33188)await t.write(c,h);else if(f===33261)await t.write(c,h,{mode:511});else if(f===40960)await t.writelink(c,h);else throw new W(`Invalid mode 0o${f.toString(8)} detected in blob ${a}`)}let u=await t.lstat(c);return f===33261&&(u.mode=493),n==="mkdir-index"&&(u.mode=57344),[s,a,u]}l(O2,"updateWorkingDir");async function oS(t,e,r,i){let n=[];try{for(let s=0;s<e.length;s+=i){let a=e.slice(s,s+i).map(o=>o());(await Promise.allSettled(a)).forEach(o=>{o.status==="fulfilled"&&n.push(o.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}l(oS,"batchAllSettled");async function nm({fs:t,onProgress:e,onPostCheckout:r,dir:i,gitdir:n=C.join(i,".git"),remote:s="origin",ref:a,filepaths:f,noCheckout:o=!1,noUpdateHead:c=a===void 0,dryRun:u=!1,force:h=!1,track:d=!0,cache:p={},nonBlocking:m=!1,batchSize:w=100}){try{S("fs",t),S("dir",i),S("gitdir",n);let y=a||"HEAD";return await im({fs:new M(t),cache:p,onProgress:e,onPostCheckout:r,dir:i,gitdir:n,remote:s,ref:y,filepaths:f,noCheckout:o,noUpdateHead:c,dryRun:u,force:h,track:d,nonBlocking:m,batchSize:w})}catch(y){throw y.caller="git.checkout",y}}l(nm,"checkout");var k2=new RegExp("^refs/(heads/|tags/|remotes/)?(.*)");function Pi(t){let e=k2.exec(t);return e?e[1]==="remotes/"&&t.endsWith("/HEAD")?e[2].slice(0,-5):e[2]:t}l(Pi,"abbreviateRef");async function Xr({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:Pi(n)}l(Xr,"_currentBranch");function x2(t){return t=t.replace(/^git@([^:]+):/,"https://$1/"),t=t.replace(/^ssh:\/\//,"https://"),t}l(x2,"translateSSHtoHTTP");function qS({username:t="",password:e=""}){return`Basic ${Buffer.from(`${t}:${e}`).toString("base64")}`}l(qS,"calculateBasicAuthHeader");async function ho(t,e){let r=SS(t);for(;;){let{value:i,done:n}=await r.next();if(i&&await e(i),n)break}r.return&&r.return()}l(ho,"forAwait");async function Al(t){let e=0,r=[];await ho(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(Al,"collect");function cS(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(cS,"extractAuthFromUrl");function em(t,e){let r=e.toString(16);return"0".repeat(t-r.length)+r}l(em,"padHex");var bm=class bm{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=em(4,r);return Buffer.concat([Buffer.from(i,"utf8"),e])}static streamReader(e){let r=new Ol(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(bm,"GitPktLine");var pe=bm;async function lS(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(lS,"parseCapabilitiesV2");async function fS(t,{service:e}){let r=new Set,i=new Map,n=new Map,s=pe.streamReader(t),a=await s();for(;a===null;)a=await s();if(a===!0)throw new Qa;if(a.includes("version 2"))return lS(s);if(a.toString("utf8").replace(/\n$/,"")!==`# service=${e}`)throw new Ni(`# service=${e}\\n`,a.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 lS(s);let[o,c]=Mp(f,"\0","\\x00");if(c.split(" ").map(u=>r.add(u)),o!=="0000000000000000000000000000000000000000 capabilities^{}"){let[u,h]=Mp(o," "," ");for(i.set(h,u);;){let d=await s();if(d===!0)break;if(d!==null){let[p,m]=Mp(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(fS,"parseRefsAdResponse");function Mp(t,e,r){let i=t.trim().split(e);if(i.length!==2)throw new Ni(`Two strings separated by '${r}'`,t.toString("utf8"));return i}l(Mp,"splitAndAssert");var uS=l((t,e)=>t.endsWith("?")?`${t}${e}`:`${t}/${e.replace(/^https?:\/\//,"")}`,"corsProxify"),hS=l((t,e)=>{(e.username||e.password)&&(t.Authorization=qS(e)),e.headers&&Object.assign(t,e.headers)},"updateHeaders"),jp=l(async t=>{try{let e=Buffer.from(await Al(t.body)),r=e.toString("utf8");return{preview:r.length<256?r:r.slice(0,256)+"...",response:r,data:e}}catch{return{}}},"stringifyBody"),_m=class _m{static async capabilities(){return["discover","connect"]}static async discover({http:e,onProgress:r,onAuth:i,onAuthSuccess:n,onAuthFailure:s,corsProxy:a,service:f,url:o,headers:c,protocolVersion:u}){let{url:h,auth:d}=cS(o),p=a?uS(a,h):h;(d.username||d.password)&&(c.Authorization=qS(d)),u===2&&(c["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:c}),w=!1,m.statusCode===401||m.statusCode===203){let g=y?s:i;if(g){if(d=await g(h,{...d,headers:{...c}}),d&&d.cancel)throw new ds;d&&(hS(c,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 jp(m);throw new ls(m.statusCode,m.statusMessage,g)}if(m.headers["content-type"]===`application/x-${f}-advertisement`){let g=await fS(m.body,{service:f});return g.auth=d,g}else{let{preview:g,response:_,data:F}=await jp(m);try{let R=await fS([F],{service:f});return R.auth=d,R}catch{throw new no(g,_)}}}static async connect({http:e,onProgress:r,corsProxy:i,service:n,url:s,auth:a,body:f,headers:o}){let c=cS(s);c&&(s=c.url),i&&(s=uS(i,s)),o["content-type"]=`application/x-${n}-request`,o.accept=`application/x-${n}-result`,hS(o,a);let u=await e.request({onProgress:r,method:"POST",url:`${s}/${n}`,body:f,headers:o});if(u.statusCode!==200){let{response:h}=jp(u);throw new ls(u.statusCode,u.statusMessage,h)}return u}};l(_m,"GitRemoteHTTP");var ys=_m,vm=class vm{static getRemoteHelperFor({url:e}){let r=new Map;r.set("http",ys),r.set("https",ys);let i=A2({url:e});if(!i)throw new ao(e);if(r.has(i.transport))return r.get(i.transport);throw new so(e,i.transport,i.transport==="ssh"?x2(e):void 0)}};l(vm,"GitRemoteManager");var gs=vm;function A2({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(A2,"parseRemoteUrl");var Ai=null,Em=class Em{static async read({fs:e,gitdir:r}){Ai===null&&(Ai=new za);let i=C.join(r,"shallow"),n=new Set;return await Ai.acquire(i,async function(){let s=await e.read(i,{encoding:"utf8"});if(s===null||s.trim()==="")return n;s.trim().split(`
67
- `).map(a=>n.add(a))}),n}static async write({fs:e,gitdir:r,oids:i}){Ai===null&&(Ai=new za);let n=C.join(r,"shallow");if(i.size>0){let s=[...i].join(`
65
+ `)+28);return Br(r+`
66
+ `+i)}isolateSignature(){let e=this._commit.slice(this._commit.indexOf("-----BEGIN PGP SIGNATURE-----"),this._commit.indexOf("-----END PGP SIGNATURE-----")+27);return KL(e)}static async sign(e,r,i){let n=e.withoutSignature(),s=ht.justMessage(e._commit),{signature:o}=await r({payload:n,secretKey:i});o=Br(o);let c=ht.justHeaders(e._commit)+`
67
+ gpgsig`+dw(o)+`
68
+ `+s;return ht.from(c)}};l(ht,"GitCommit");var mt=ht;async function Ks({fs:t,cache:e,gitdir:r,oid:i}){if(i==="4b825dc642cb6eb9a060e54bf8d69288fbee4904")return{tree:pt.from([]),oid:i};let{type:n,object:s}=await he({fs:t,cache:e,gitdir:r,oid:i});if(n==="tag")return i=Ft.from(s).parse().object,Ks({fs:t,cache:e,gitdir:r,oid:i});if(n==="commit")return i=mt.from(s).parse().tree,Ks({fs:t,cache:e,gitdir:r,oid:i});if(n!=="tree")throw new ot(i,n,"tree");return{tree:pt.from(s),oid:i}}l(Ks,"resolveTree");var Hw=class Hw{constructor({fs:e,gitdir:r,ref:i,cache:n}){var o;this.fs=e,this.cache=n,this.gitdir=r,this.mapPromise=(async()=>{let f=new Map,c;try{c=await $.resolve({fs:e,gitdir:r,ref:i})}catch(u){u instanceof le&&(c="4b825dc642cb6eb9a060e54bf8d69288fbee4904")}let a=await Ks({fs:e,cache:this.cache,gitdir:r,oid:c});return a.type="tree",a.mode="40000",f.set(".",a),f})();let s=this;this.ConstructEntry=(o=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)}},l(o,"TreeEntry"),o)}async readdir(e){let r=e._fullpath,{fs:i,cache:n,gitdir:s}=this,o=await this.mapPromise,f=o.get(r);if(!f)throw new Error(`No obj for ${r}`);let c=f.oid;if(!c)throw new Error(`No oid for obj ${JSON.stringify(f)}`);if(f.type!=="tree")return null;let{type:a,object:u}=await he({fs:i,cache:n,gitdir:s,oid:c});if(a!==f.type)throw new ot(c,a,f.type);let h=pt.from(u);for(let d of h)o.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=KT(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,f=r.get(e._fullpath).oid,{type:c,object:a}=await he({fs:i,cache:n,gitdir:s,oid:f});c!=="blob"?e._content=void 0:e._content=new Uint8Array(a)}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}};l(Hw,"GitWalkerRepo");var kw=Hw;function Et({ref:t="HEAD"}={}){let e=Object.create(null);return Object.defineProperty(e,Ru,{value:l(function({fs:r,gitdir:i,cache:n}){return new kw({fs:r,gitdir:i,ref:t,cache:n})},"value")}),Object.freeze(e),e}l(Et,"TREE");var Vw=class Vw{constructor({fs:e,dir:r,gitdir:i,cache:n}){var o;this.fs=e,this.cache=n,this.dir=r,this.gitdir=i,this.config=null;let s=this;this.ConstructEntry=(o=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)}},l(o,"WorkdirEntry"),o)}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(o=>C(r,o))}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=Us(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 o=await(await this._getGitConfig(r,n)).get("core.autocrlf"),f=await r.read(`${i}/${e._fullpath}`,{autocrlf:o});e._actualSize=f.length,e._stat&&e._stat.size===-1&&(e._stat.size=e._actualSize),e._content=new Uint8Array(f)}}return e._content}async oid(e){if(e._oid===!1){let r=this,{fs:i,gitdir:n,cache:s}=this,o;await Ee.acquire({fs:i,gitdir:n,cache:s},async function(f){let c=f.entriesMap.get(e._fullpath),a=await e.stat(),h=await(await r._getGitConfig(i,n)).get("core.filemode"),d=typeof process<"u"?process.platform!=="win32":!0;if(!c||Pf(a,c,h,d)){let p=await e.content();p===void 0?o=void 0:(o=await Mr(li.wrap({type:"blob",object:p})),c&&o===c.oid&&(!h||a.mode===c.mode)&&Pf(a,c,h,d)&&f.insert({filepath:e._fullpath,stats:a,oid:o}))}else o=c.oid}),e._oid=o}return e._oid}async _getGitConfig(e,r){return this.config?this.config:(this.config=await Se.get({fs:e,gitdir:r}),this.config)}};l(Vw,"GitWalkerFs");var Rw=Vw;function to(){let t=Object.create(null);return Object.defineProperty(t,Ru,{value:l(function({fs:e,dir:r,gitdir:i,cache:n}){return new Rw({fs:e,dir:r,gitdir:i,cache:n})},"value")}),Object.freeze(t),t}l(to,"WORKDIR");function XL(t,e){let r=e-t;return Array.from({length:r},(i,n)=>t+n)}l(XL,"arrayRange");var i1=typeof Array.prototype.flat>"u"?t=>t.reduce((e,r)=>e.concat(r),[]):t=>t.flat(),Gw=class Gw{constructor(){this.value=null}consider(e){e!=null&&(this.value===null?this.value=e:e<this.value&&(this.value=e))}reset(){this.value=null}};l(Gw,"RunningMinimum");var Ow=Gw;function*YL(t){let e=new Ow,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 o=0;o<n;o++)i[o]!==void 0&&i[o]===r?(s[o]=i[o],i[o]=t[o].next().value):s[o]=null,i[o]!==void 0&&e.consider(i[o]);if(yield s,e.value===null)return}}l(YL,"unionOfIterators");async function ui({fs:t,cache:e,dir:r,gitdir:i,trees:n,map:s=l(async(c,a)=>a,"map"),reduce:o=l(async(c,a)=>{let u=i1(a);return c!==void 0&&u.unshift(c),u},"reduce"),iterate:f=l((c,a)=>Promise.all([...a].map(c)),"iterate")}){let c=n.map(p=>p[Ru]({fs:t,dir:r,gitdir:i,cache:e})),a=new Array(c.length).fill("."),u=XL(0,c.length),h=l(async p=>{u.forEach(y=>{let b=p[y];p[y]=b&&new c[y].ConstructEntry(b)});let w=(await Promise.all(u.map(y=>{let b=p[y];return b?c[y].readdir(b):[]}))).map(y=>(y===null?[]:y)[Symbol.iterator]());return{entries:p,children:YL(w)}},"unionWalkerFromReaddir"),d=l(async p=>{let{entries:m,children:w}=await h(p),y=m.find(_=>_&&_._fullpath)._fullpath,b=await s(y,m);if(b!==null){let _=await f(d,w);return _=_.filter(F=>F!==void 0),o(b,_)}},"walk");return d(a)}l(ui,"_walk");async function xw(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()?xw(t,n):t.rm(n)})})).then(()=>t.rmdir(e)):await t.rmdir(e)}l(xw,"rmRecursive");function ZL(t){return QL(t)&&CT(t.then)&&CT(t.catch)}l(ZL,"isPromiseLike");function QL(t){return t&&typeof t=="object"}l(QL,"isObject");function CT(t){return typeof t=="function"}l(CT,"isFunction");function IT(t){return ZL(l(r=>{try{return r.readFile().catch(i=>i)}catch(i){return i}},"test")(t))}l(IT,"isPromiseFs");var $T=["readFile","writeFile","mkdir","rmdir","unlink","stat","lstat","readdir","readlink","symlink"];function BT(t,e){if(IT(e))for(let r of $T)t[`_${r}`]=e[r].bind(e);else for(let r of $T)t[`_${r}`]=aw(e[r].bind(e));IT(e)?e.rm?t._rm=e.rm.bind(e):e.rmdir.length>1?t._rm=e.rmdir.bind(e):t._rm=xw.bind(null,t):e.rm?t._rm=aw(e.rm.bind(e)):e.rmdir.length>2?t._rm=aw(e.rmdir.bind(e)):t._rm=xw.bind(null,t)}l(BT,"bindFs");var Jw=class Jw{constructor(e){if(typeof e._original_unwrapped_fs<"u")return e;let r=Object.getOwnPropertyDescriptor(e,"promises");r&&r.enumerable?BT(this,e.promises):BT(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(Ws(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=Ws(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(ku),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 dt(t)}l(k,"assertParameter");async function Bf(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(Bf,"modified");async function n1({fs:t,dir:e,gitdir:r=C(e,".git"),commit:i="HEAD",cache:n={}}){try{k("fs",t),k("dir",e),k("gitdir",r);let s=new L(t),o=[Et({ref:i}),to(),tn()],f=[];await Ee.acquire({fs:s,gitdir:r,cache:n},async function(a){f=a.unmergedPaths});let c=await ui({fs:s,cache:n,dir:e,gitdir:r,trees:o,map:l(async function(a,[u,h,d]){let p=!await Bf(h,d),m=f.includes(a),w=!await Bf(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 ec(a)},"map")});await Ee.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(n1,"abortMerge");var Kw=class Kw{static async isIgnored({fs:e,dir:r,gitdir:i=C(r,".git"),filepath:n}){if(Nf(n)===".git")return!0;if(n===".")return!1;let s="",o=C(i,"info","exclude");await e.exists(o)&&(s=await e.read(o,"utf8"));let f=[{gitignore:C(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:C(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=iL().add(s);d.add(h);let p=Ws(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(Kw,"GitIgnoreManager");var hi=Kw;async function ej({fs:t,gitdir:e,object:r,format:i,oid:n}){if(i!=="deflated")throw new z("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(ej,"writeObjectLoose");var pw=null;async function s1(t){return pw===null&&(pw=rj()),pw?tj(t):Nw.deflate(t)}l(s1,"deflate");async function tj(t){let e=new CompressionStream("deflate"),r=new Blob([t]).stream().pipeThrough(e);return new Uint8Array(await new Response(r).arrayBuffer())}l(tj,"browserDeflate");function rj(){try{return new CompressionStream("deflate").writable.close(),new Blob([]).stream().cancel(),!0}catch{return!1}}l(rj,"testCompressionStream");async function wt({fs:t,gitdir:e,type:r,object:i,format:n="content",oid:s=void 0,dryRun:o=!1}){return n!=="deflated"&&(n!=="wrapped"&&(i=li.wrap({type:r,object:i})),s=await Mr(i),i=Buffer.from(await s1(i))),o||await ej({fs:t,gitdir:e,object:i,format:"deflated",oid:s}),s}l(wt,"_writeObject");function o1(t){let e;for(;~(e=t.indexOf(92));)t[e]=47;return t}l(o1,"posixifyPathBuffer");async function a1({fs:t,dir:e,gitdir:r=C(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 Ee.acquire({fs:f,gitdir:r,cache:n},async c=>{let u=await(await Se.get({fs:f,gitdir:r})).get("core.autocrlf");return Aw({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(a1,"add");async function Aw({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 hi.isIgnored({fs:r,dir:t,gitdir:e,filepath:d}))return;let p=await r.lstat(C(t,d));if(!p)throw new le(d);if(p.isDirectory()){let m=await r.readdir(C(t,d));if(o){let w=m.map(y=>Aw({dir:t,gitdir:e,fs:r,filepath:[C(d,y)],index:n,force:s,parallel:o,autocrlf:f}));await Promise.all(w)}else for(let w of m)await Aw({dir:t,gitdir:e,fs:r,filepath:[C(d,w)],index:n,force:s,parallel:o,autocrlf:f})}else{let m=p.isSymbolicLink()?await r.readlink(C(t,d)).then(o1):await r.read(C(t,d),{autocrlf:f});if(m===null)throw new le(d);let w=await wt({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 Xa(u);if(u.length===1)throw u[0];return a.filter(d=>d.status==="fulfilled"&&d.value).map(d=>d.value)}l(Aw,"addToIndex");async function rc({fs:t,gitdir:e,path:r}){return(await Se.get({fs:t,gitdir:e})).get(r)}l(rc,"_getConfig");function c1(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(c1,"assignDefined");async function di({fs:t,gitdir:e,author:r,commit:i}){let n=Math.floor(Date.now()/1e3),s={name:await rc({fs:t,gitdir:e,path:"user.name"}),email:await rc({fs:t,gitdir:e,path:"user.email"})||"",timestamp:n,timezoneOffset:new Date(n*1e3).getTimezoneOffset()},o=c1({},s,i?i.author:void 0,r);if(o.name!==void 0)return o}l(di,"normalizeAuthorObject");async function Xs({fs:t,gitdir:e,author:r,committer:i,commit:n}){let s=Math.floor(Date.now()/1e3),o={name:await rc({fs:t,gitdir:e,path:"user.name"}),email:await rc({fs:t,gitdir:e,path:"user.email"})||"",timestamp:s,timezoneOffset:new Date(s*1e3).getTimezoneOffset()},f=c1({},o,n?n.committer:void 0,r,i);if(f.name!==void 0)return f}l(Xs,"normalizeCommitterObject");async function l1({fs:t,cache:e,gitdir:r,oid:i}){let{type:n,object:s}=await he({fs:t,cache:e,gitdir:r,oid:i});if(n==="tag")return i=Ft.from(s).parse().object,l1({fs:t,cache:e,gitdir:r,oid:i});if(n!=="commit")throw new ot(i,n,"commit");return{commit:mt.from(s),oid:i}}l(l1,"resolveCommit");async function Ys({fs:t,cache:e,gitdir:r,oid:i}){let{commit:n,oid:s}=await l1({fs:t,cache:e,gitdir:r,oid:i});return{oid:s,commit:n.parse(),payload:n.withoutSignature()}}l(Ys,"_readCommit");async function Ou({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 Ys({fs:t,gitdir:i,oid:w,cache:{}})}catch{m=!0}if(c&&m)throw new tc(h);let b=c?await di({fs:t,gitdir:i,author:s,commit:y.commit}):await di({fs:t,gitdir:i,author:s});if(!b)throw new Ye("author");let _=c?await Xs({fs:t,gitdir:i,author:b,committer:o,commit:y.commit}):await Xs({fs:t,gitdir:i,author:b,committer:o});if(!_)throw new Ye("committer");return Ee.acquire({fs:t,gitdir:i,cache:e,allowUnmerged:!1},async function(F){let R=YT(F.entries).get(".");if(p||(p=await f1({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 dt("message");let D=mt.from({tree:p,parent:d,author:b,committer:_,message:n});f&&(D=await mt.sign(D,r,f));let S=await wt({fs:t,gitdir:i,type:"commit",object:D.toObject(),dryRun:a});return!u&&!a&&await $.writeRef({fs:t,gitdir:i,ref:h,value:S}),S})}l(Ou,"_commit");async function f1({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 f1({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=pt.from(s);return await wt({fs:t,gitdir:e,type:"tree",object:o.toObject(),dryRun:i})}l(f1,"constructTree");async function nc({fs:t,cache:e,gitdir:r,oid:i,filepath:n}){if(n.startsWith("/"))throw new fi("leading-slash");if(n.endsWith("/"))throw new fi("trailing-slash");let s=i,o=await Ks({fs:t,cache:e,gitdir:r,oid:i}),f=o.tree;if(n==="")i=o.oid;else{let c=n.split("/");i=await u1({fs:t,cache:e,gitdir:r,tree:f,pathArray:c,oid:s,filepath:n})}return i}l(nc,"resolveFilepath");async function u1({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 he({fs:t,cache:e,gitdir:r,oid:c.oid});if(a!=="tree")throw new ot(s,a,"tree",o);return i=pt.from(u),u1({fs:t,cache:e,gitdir:r,tree:i,pathArray:n,oid:s,filepath:o})}}throw new le(`file or directory found at "${s}:${o}"`)}l(u1,"_resolveFilepath");async function ro({fs:t,cache:e,gitdir:r,oid:i,filepath:n=void 0}){n!==void 0&&(i=await nc({fs:t,cache:e,gitdir:r,oid:i,filepath:n}));let{tree:s,oid:o}=await Ks({fs:t,cache:e,gitdir:r,oid:i});return{oid:o,tree:s.entries()}}l(ro,"_readTree");async function sc({fs:t,gitdir:e,tree:r}){let i=pt.from(r).toObject();return await wt({fs:t,gitdir:e,type:"tree",object:i,format:"content"})}l(sc,"_writeTree");async function ij({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(b){if(!(b instanceof le))throw b}let p=(await ro({fs:t,cache:e,gitdir:i,oid:h||"4b825dc642cb6eb9a060e54bf8d69288fbee4904"})).tree;if(f)p=p.filter(b=>b.path!==s);else for(let b of p)if(b.path===s)throw new Yt("note",s);typeof o=="string"&&(o=Buffer.from(o,"utf8"));let m=await wt({fs:t,gitdir:i,type:"blob",object:o,format:"content"});p.push({mode:"100644",path:s,oid:m,type:"blob"});let w=await sc({fs:t,gitdir:i,tree:p});return await Ou({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(ij,"_addNote");async function h1({fs:t,onSign:e,dir:r,gitdir:i=C(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 di({fs:d,gitdir:i,author:c});if(!p)throw new Ye("author");let m=await Xs({fs:d,gitdir:i,author:p,committer:a});if(!m)throw new Ye("committer");return await ij({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(h1,"addNote");var nj=/(^|[/.])([/.]|$)|^@$|@{|[\x00-\x20\x7f~^:?*[\\]|\.lock(\/|$)/;function ic(t,e){if(typeof t!="string")throw new TypeError("Reference name must be a string");return!nj.test(t)&&(!!e||t.includes("/"))}l(ic,"isValidRef");async function d1({fs:t,gitdir:e,remote:r,url:i,force:n}){if(!ic(r,!0))throw new Zt(r,La.clean(r));let s=await Se.get({fs:t,gitdir:e});if(!n&&(await s.getSubsections("remote")).includes(r)&&i!==await s.get(`remote.${r}.url`))throw new Yt("remote",r);await s.set(`remote.${r}.url`,i),await s.set(`remote.${r}.fetch`,`+refs/heads/*:refs/remotes/${r}/*`),await Se.save({fs:t,gitdir:e,config:s})}l(d1,"_addRemote");async function p1({fs:t,dir:e,gitdir:r=C(e,".git"),remote:i,url:n,force:s=!1}){try{return k("fs",t),k("gitdir",r),k("remote",i),k("url",n),await d1({fs:new L(t),gitdir:r,remote:i,url:n,force:s})}catch(o){throw o.caller="git.addRemote",o}}l(p1,"addRemote");async function sj({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 Yt("tag",n);let h=await $.resolve({fs:t,gitdir:i,ref:c||"HEAD"}),{type:d}=await he({fs:t,cache:e,gitdir:i,oid:h}),p=Ft.from({object:h,type:d,tag:n.replace("refs/tags/",""),tagger:s,message:o,gpgsig:f});a&&(p=await Ft.sign(p,r,a));let m=await wt({fs:t,gitdir:i,type:"tag",object:p.toObject()});await $.writeRef({fs:t,gitdir:i,ref:n,value:m})}l(sj,"_annotatedTag");async function m1({fs:t,onSign:e,dir:r,gitdir:i=C(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 di({fs:d,gitdir:i,author:s});if(!p)throw new Ye("tagger");return await sj({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(m1,"annotatedTag");async function oj({fs:t,gitdir:e,ref:r,object:i,checkout:n=!1,force:s=!1}){if(!ic(r,!0))throw new Zt(r,La.clean(r));let o=`refs/heads/${r}`;if(!s&&await $.exists({fs:t,gitdir:e,ref:o}))throw new Yt("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(oj,"_branch");async function w1({fs:t,dir:e,gitdir:r=C(e,".git"),ref:i,object:n,checkout:s=!1,force:o=!1}){try{return k("fs",t),k("gitdir",r),k("ref",i),await oj({fs:new L(t),gitdir:r,ref:i,object:n,checkout:s,force:o})}catch(f){throw f.caller="git.branch",f}}l(w1,"branch");var y1=l((t,e)=>t==="."||e==null||e.length===0||e==="."?!0:e.length>=t.length?e.startsWith(t):t.startsWith(e),"worthWalking");async function Cw({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 b;try{b=await $.resolve({fs:t,gitdir:s,ref:f})}catch(_){if(f==="HEAD")throw _;let F=`${o}/${f}`;if(b=await $.resolve({fs:t,gitdir:s,ref:F}),p){let E=await Se.get({fs:t,gitdir:s});await E.set(`branch.${f}.remote`,o),await E.set(`branch.${f}.merge`,`refs/heads/${f}`),await Se.save({fs:t,gitdir:s,config:E})}await $.writeRef({fs:t,gitdir:s,ref:`refs/heads/${f}`,value:b})}if(!a){let _;try{_=await aj({fs:t,cache:e,onProgress:r,dir:n,gitdir:s,ref:f,force:d,filepaths:c})}catch(S){throw S instanceof le&&S.data.what===b?new Ha(f,b):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 z(E.join(", "));if(h){i&&await i({previousHead:y,newHead:b,type:c!=null&&c.length>0?"file":"branch"});return}let R=0,D=_.length;if(await Ee.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:D})}))}),await Ee.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:D})}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:D})})),m){let S=_.filter(([v])=>v==="create"||v==="create-index"||v==="update"||v==="mkdir-index"),O=await MT("Update Working Dir",S.map(([v,A,x,I,M])=>()=>lj({fs:t,cache:e,gitdir:s,dir:n},[v,A,x,I,M])),r,w);await Ee.acquire({fs:t,gitdir:s,cache:e,allowUnmerged:!0},async function(v){await MT("Update Index",O.map(([A,x,I])=>()=>cj({index:v,fullpath:A,oid:x,stats:I})),r,w)})}else await Ee.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:Te}=await he({fs:t,cache:e,gitdir:s,oid:A});if(I&&await t.rm(M),x===33188)await t.write(M,Te);else if(x===33261)await t.write(M,Te,{mode:511});else if(x===40960)await t.writelink(M,Te);else throw new z(`Invalid mode 0o${x.toString(8)} detected in blob ${A}`)}let H=await t.lstat(M);x===33261&&(H.mode=493),O==="mkdir-index"&&(H.mode=57344),S.insert({filepath:v,stats:H,oid:A}),r&&await r({phase:"Updating workdir",loaded:++R,total:D})}catch(H){console.log(H)}}))});i&&await i({previousHead:y,newHead:b,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:b})}}l(Cw,"_checkout");async function aj({fs:t,cache:e,onProgress:r,dir:i,gitdir:n,ref:s,force:o,filepaths:f}){let c=0;return ui({fs:t,cache:e,dir:i,gitdir:n,trees:[Et({ref:s}),to(),tn()],map:l(async function(a,[u,h,d]){if(a===".")return;if(f&&!f.some(m=>y1(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=i1(u),a?a&&a[0]==="rmdir"?(u.push(a),u):(u.unshift(a),u):u},"reduce")})}l(aj,"analyze");async function cj({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(cj,"updateIndex");async function lj({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 he({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 z(`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(lj,"updateWorkingDir");async function MT(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(MT,"batchAllSettled");async function Iw({fs:t,onProgress:e,onPostCheckout:r,dir:i,gitdir:n=C(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 Cw({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(Iw,"checkout");var fj=/^refs\/(heads\/|tags\/|remotes\/)?(.*)/;function Yi(t){let e=fj.exec(t);return e?e[1]==="remotes/"&&t.endsWith("/HEAD")?e[2].slice(0,-5):e[2]:t}l(Yi,"abbreviateRef");async function mi({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:Yi(n)}l(mi,"_currentBranch");function uj(t){return t=t.replace(/^git@([^:]+):/,"https://$1/"),t=t.replace(/^ssh:\/\//,"https://"),t}l(uj,"translateSSHtoHTTP");function g1({username:t="",password:e=""}){return`Basic ${Buffer.from(`${t}:${e}`).toString("base64")}`}l(g1,"calculateBasicAuthHeader");async function oc(t,e){let r=e1(t);for(;;){let{value:i,done:n}=await r.next();if(i&&await e(i),n)break}r.return&&r.return()}l(oc,"forAwait");async function Mf(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}l(Mf,"collect");function LT(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(LT,"extractAuthFromUrl");function Pw(t,e){let r=e.toString(16);return"0".repeat(t-r.length)+r}l(Pw,"padHex");var Xw=class Xw{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=Pw(4,r);return Buffer.concat([Buffer.from(i,"utf8"),e])}static streamReader(e){let r=new If(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(Xw,"GitPktLine");var be=Xw;async function jT(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(jT,"parseCapabilitiesV2");async function qT(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 Va;if(o.includes("version 2"))return jT(s);if(o.toString("utf8").replace(/\n$/,"")!==`# service=${e}`)throw new Zi(`# 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 jT(s);let[c,a]=mw(f,"\0","\\x00");if(a.split(" ").map(u=>r.add(u)),c!=="0000000000000000000000000000000000000000 capabilities^{}"){let[u,h]=mw(c," "," ");for(i.set(h,u);;){let d=await s();if(d===!0)break;if(d!==null){let[p,m]=mw(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(qT,"parseRefsAdResponse");function mw(t,e,r){let i=t.trim().split(e);if(i.length!==2)throw new Zi(`Two strings separated by '${r}'`,t.toString("utf8"));return i}l(mw,"splitAndAssert");var UT=l((t,e)=>t.endsWith("?")?`${t}${e}`:`${t}/${e.replace(/^https?:\/\//,"")}`,"corsProxify"),WT=l((t,e)=>{(e.username||e.password)&&(t.Authorization=g1(e)),e.headers&&Object.assign(t,e.headers)},"updateHeaders"),ww=l(async t=>{try{let e=Buffer.from(await Mf(t.body)),r=e.toString("utf8");return{preview:r.length<256?r:r.slice(0,256)+"...",response:r,data:e}}catch{return{}}},"stringifyBody"),Yw=class Yw{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}=LT(c),p=o?UT(o,h):h;(d.username||d.password)&&(a.Authorization=g1(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 b=y?s:i;if(b){if(d=await b(h,{...d,headers:{...a}}),d&&d.cancel)throw new Js;d&&(WT(a,d),y=!0,w=!0)}}else m.statusCode===200&&y&&n&&await n(h,d);while(w);if(m.statusCode!==200){let{response:b}=await ww(m);throw new zs(m.statusCode,m.statusMessage,b)}if(m.headers["content-type"]===`application/x-${f}-advertisement`){let b=await qT(m.body,{service:f});return b.auth=d,b}else{let{preview:b,response:_,data:F}=await ww(m);try{let E=await qT([F],{service:f});return E.auth=d,E}catch{throw new Ya(b,_)}}}static async connect({http:e,onProgress:r,corsProxy:i,service:n,url:s,auth:o,body:f,headers:c}){let a=LT(s);a&&(s=a.url),i&&(s=UT(i,s)),c["content-type"]=`application/x-${n}-request`,c.accept=`application/x-${n}-result`,WT(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}=ww(u);throw new zs(u.statusCode,u.statusMessage,h)}return u}};l(Yw,"GitRemoteHTTP");var Zs=Yw,Zw=class Zw{static getRemoteHelperFor({url:e}){let r=new Map;r.set("http",Zs),r.set("https",Zs);let i=hj({url:e});if(!i)throw new Qa(e);if(r.has(i.transport))return r.get(i.transport);throw new Za(e,i.transport,i.transport==="ssh"?uj(e):void 0)}};l(Zw,"GitRemoteManager");var Qs=Zw;function hj({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(hj,"parseRemoteUrl");var Xi=null,Qw=class Qw{static async read({fs:e,gitdir:r}){Xi===null&&(Xi=new Ma);let i=C(r,"shallow"),n=new Set;return await Xi.acquire(i,async function(){let s=await e.read(i,{encoding:"utf8"});if(s===null||s.trim()==="")return n;s.trim().split(`
71
+ `).map(o=>n.add(o))}),n}static async write({fs:e,gitdir:r,oids:i}){Xi===null&&(Xi=new Ma);let n=C(r,"shallow");if(i.size>0){let s=[...i].join(`
68
72
  `)+`
69
- `;await Ai.acquire(n,async function(){await e.write(n,s,{encoding:"utf8"})})}else await Ai.acquire(n,async function(){await e.rm(n)})}};l(Em,"GitShallowManager");var Di=Em;async function P2({fs:t,gitdir:e,oid:r}){let i=`objects/${r.slice(0,2)}/${r.slice(2)}`;return t.exists(`${e}/${i}`)}l(P2,"hasObjectLoose");async function N2({fs:t,cache:e,gitdir:r,oid:i,getExternalRefDelta:n}){let s=await t.readdir(C.join(r,"objects/pack"));s=s.filter(a=>a.endsWith(".idx"));for(let a of s){let f=`${r}/objects/pack/${a}`,o=await rm({fs:t,cache:e,filename:f,getExternalRefDelta:n});if(o.error)throw new W(o.error);if(o.offsets.has(i))return!0}return!1}l(N2,"hasObjectPacked");async function dS({fs:t,cache:e,gitdir:r,oid:i,format:n="content"}){let s=l(f=>fe({fs:t,cache:e,gitdir:r,oid:f}),"getExternalRefDelta"),a=await P2({fs:t,gitdir:r,oid:i});return a||(a=await N2({fs:t,cache:e,gitdir:r,oid:i,getExternalRefDelta:s})),a}l(dS,"hasObject");function D2(t){let n="5041434b"+"00000002"+"00000000";return t.slice(0,12).toString("hex")===n}l(D2,"emptyPackfile");function US(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)})}l(US,"filterCapabilities");var Ef={name:"isomorphic-git",version:"1.34.0",agent:"git/isomorphic-git@1.34.0"},Sm=class Sm{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})}};l(Sm,"FIFO");var ss=Sm;function C2(t){let e=t.indexOf("\r"),r=t.indexOf(`
70
- `);return e===-1&&r===-1?-1:e===-1?r+1:r===-1?e+1:r===e+1?r+1:Math.min(e,r)+1}l(C2,"findSplit");function WS(t){let e=new ss,r="";return(async()=>(await ho(t,i=>{for(i=i.toString("utf8"),r+=i;;){let n=C2(r);if(n===-1)break;e.write(r.slice(0,n)),r=r.slice(n)}}),r.length>0&&e.write(r),e.end()))(),e}l(WS,"splitLines");var Fm=class Fm{static demux(e){let r=pe.streamReader(e),i=new ss,n=new ss,s=new ss,a=l(async function(){let f=await r();if(f===null)return a();if(f===!0){i.end(),s.end(),e.error?n.destroy(e.error):n.end();return}switch(f[0]){case 1:{n.write(f.slice(1));break}case 2:{s.write(f.slice(1));break}case 3:{let o=f.slice(1);s.write(o),i.end(),s.end(),n.destroy(new Error(o.toString("utf8")));return}default:i.write(f)}a()},"nextBit");return a(),{packetlines:i,packfile:n,progress:s}}};l(Fm,"GitSideBand");var Pl=Fm;async function I2(t){let{packetlines:e,packfile:r,progress:i}=Pl.demux(t),n=[],s=[],a=[],f=!1,o=!1;return new Promise((c,u)=>{ho(e,h=>{let d=h.toString("utf8").trim();if(d.startsWith("shallow")){let p=d.slice(-41).trim();p.length!==40&&u(new zr(p)),n.push(p)}else if(d.startsWith("unshallow")){let p=d.slice(-41).trim();p.length!==40&&u(new zr(p)),s.push(p)}else if(d.startsWith("ACK")){let[,p,m]=d.split(" ");a.push({oid:p,status:m}),m||(o=!0)}else d.startsWith("NAK")?(f=!0,o=!0):(o=!0,f=!0);o&&(t.error?u(t.error):c({shallows:n,unshallows:s,acks:a,nak:f,packfile:r,progress:i}))}).finally(()=>{o||(t.error?u(t.error):c({shallows:n,unshallows:s,acks:a,nak:f,packfile:r,progress:i}))})})}l(I2,"parseUploadPackResponse");function $2({capabilities:t=[],wants:e=[],haves:r=[],shallows:i=[],depth:n=null,since:s=null,exclude:a=[]}){let f=[];e=[...new Set(e)];let o=` ${t.join(" ")}`;for(let c of e)f.push(pe.encode(`want ${c}${o}
71
- `)),o="";for(let c of i)f.push(pe.encode(`shallow ${c}
72
- `));n!==null&&f.push(pe.encode(`deepen ${n}
73
- `)),s!==null&&f.push(pe.encode(`deepen-since ${Math.floor(s.valueOf()/1e3)}
74
- `));for(let c of a)f.push(pe.encode(`deepen-not ${c}
75
- `));f.push(pe.flush());for(let c of r)f.push(pe.encode(`have ${c}
76
- `));return f.push(pe.encode(`done
77
- `)),f}l($2,"writeUploadPackRequest");async function sm({fs:t,cache:e,http:r,onProgress:i,onMessage:n,onAuth:s,onAuthSuccess:a,onAuthFailure:f,gitdir:o,ref:c,remoteRef:u,remote:h,url:d,corsProxy:p,depth:m=null,since:w=null,exclude:y=[],relative:g=!1,tags:_=!1,singleBranch:F=!1,headers:R={},prune:k=!1,pruneTags:D=!1}){let v=c||await Xr({fs:t,gitdir:o,test:!0}),O=await me.get({fs:t,gitdir:o}),E=h||v&&await O.get(`branch.${v}.remote`)||"origin",N=d||await O.get(`remote.${E}.url`);if(typeof N>"u")throw new tt("remote OR url");let x=u||v&&await O.get(`branch.${v}.merge`)||c||"HEAD";p===void 0&&(p=await O.get("http.corsProxy"));let I=gs.getRemoteHelperFor({url:N}),q=await I.discover({http:r,onAuth:s,onAuthSuccess:a,onAuthFailure:f,corsProxy:p,service:"git-upload-pack",url:N,headers:R,protocolVersion:1}),z=q.auth,be=q.refs;if(be.size===0)return{defaultBranch:null,fetchHead:null,fetchHeadDescription:null};if(m!==null&&!q.capabilities.has("shallow"))throw new Wr("shallow","depth");if(w!==null&&!q.capabilities.has("deepen-since"))throw new Wr("deepen-since","since");if(y.length>0&&!q.capabilities.has("deepen-not"))throw new Wr("deepen-not","exclude");if(g===!0&&!q.capabilities.has("deepen-relative"))throw new Wr("deepen-relative","relative");let{oid:Vt,fullref:yt}=$.resolveAgainstMap({ref:x,map:be});for(let ae of be.keys())ae===yt||ae==="HEAD"||ae.startsWith("refs/heads/")||_&&ae.startsWith("refs/tags/")||be.delete(ae);let Dt=US([...q.capabilities],["multi_ack_detailed","no-done","side-band-64k","ofs-delta",`agent=${Ef.agent}`]);g&&Dt.push("deepen-relative");let Yu=F?[Vt]:be.values(),Zu=F?[v]:await $.listRefs({fs:t,gitdir:o,filepath:"refs"}),at=[];for(let ae of Zu)try{ae=await $.expand({fs:t,gitdir:o,ref:ae});let Ie=await $.resolve({fs:t,gitdir:o,ref:ae});await dS({fs:t,cache:e,gitdir:o,oid:Ie})&&at.push(Ie)}catch{}at=[...new Set(at)];let de=await Di.read({fs:t,gitdir:o}),Gt=q.capabilities.has("shallow")?[...de]:[],Le=$2({capabilities:Dt,wants:Yu,haves:at,shallows:Gt,depth:m,since:w,exclude:y}),Ys=Buffer.from(await Al(Le)),ui=await I.connect({http:r,onProgress:i,corsProxy:p,service:"git-upload-pack",url:N,auth:z,body:[Ys],headers:R}),Te=await I2(ui.body);ui.headers&&(Te.headers=ui.headers);for(let ae of Te.shallows)if(!de.has(ae))try{let{object:Ie}=await fe({fs:t,cache:e,gitdir:o,oid:ae}),gt=new it(Ie),Kt=await Promise.all(gt.headers().parent.map(Qs=>dS({fs:t,cache:e,gitdir:o,oid:Qs})));Kt.length===0||Kt.every(Qs=>Qs)||de.add(ae)}catch{de.add(ae)}for(let ae of Te.unshallows)de.delete(ae);if(await Di.write({fs:t,gitdir:o,oids:de}),F){let ae=new Map([[yt,Vt]]),Ie=new Map,gt=10,Kt=yt;for(;gt--;){let eh=q.symrefs.get(Kt);if(eh===void 0)break;Ie.set(Kt,eh),Kt=eh}let Qu=be.get(Kt);Qu&&ae.set(Kt,Qu);let{pruned:Qs}=await $.updateRemoteRefs({fs:t,gitdir:o,remote:E,refs:ae,symrefs:Ie,tags:_,prune:k});k&&(Te.pruned=Qs)}else{let{pruned:ae}=await $.updateRemoteRefs({fs:t,gitdir:o,remote:E,refs:be,symrefs:q.symrefs,tags:_,prune:k,pruneTags:D});k&&(Te.pruned=ae)}if(Te.HEAD=q.symrefs.get("HEAD"),Te.HEAD===void 0){let{oid:ae}=$.resolveAgainstMap({ref:"HEAD",map:be});for(let[Ie,gt]of be.entries())if(Ie!=="HEAD"&&gt===ae){Te.HEAD=Ie;break}}let EO=yt.startsWith("refs/tags")?"tag":"branch";if(Te.FETCH_HEAD={oid:Vt,description:`${EO} '${Pi(yt)}' of ${N}`},i||n){let ae=WS(Te.progress);ho(ae,async Ie=>{if(n&&await n(Ie),i){let gt=Ie.match(/([^:]*).*\((\d+?)\/(\d+?)\)/);gt&&await i({phase:gt[1].trim(),loaded:parseInt(gt[2],10),total:parseInt(gt[3],10)})}})}let Co=Buffer.from(await Al(Te.packfile));if(ui.body.error)throw ui.body.error;let ly=Co.slice(-20).toString("hex"),Zs={defaultBranch:Te.HEAD,fetchHead:Te.FETCH_HEAD.oid,fetchHeadDescription:Te.FETCH_HEAD.description};if(Te.headers&&(Zs.headers=Te.headers),k&&(Zs.pruned=Te.pruned),ly!==""&&!D2(Co)){Zs.packfile=`objects/pack/pack-${ly}.pack`;let ae=C.join(o,Zs.packfile);await t.write(ae,Co);let Ie=l(Kt=>fe({fs:t,cache:e,gitdir:o,oid:Kt}),"getExternalRefDelta"),gt=await Ja.fromPack({pack:Co,getExternalRefDelta:Ie,onProgress:i});await t.write(ae.replace(/\.pack$/,".idx"),await gt.toBuffer())}return Zs}l(sm,"_fetch");async function zS({fs:t,bare:e=!1,dir:r,gitdir:i=e?r:C.join(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]
73
+ `;await Xi.acquire(n,async function(){await e.write(n,s,{encoding:"utf8"})})}else await Xi.acquire(n,async function(){await e.rm(n)})}};l(Qw,"GitShallowManager");var Qi=Qw;async function dj({fs:t,gitdir:e,oid:r}){let i=`objects/${r.slice(0,2)}/${r.slice(2)}`;return t.exists(`${e}/${i}`)}l(dj,"hasObjectLoose");async function pj({fs:t,cache:e,gitdir:r,oid:i,getExternalRefDelta:n}){let s=await t.readdir(C(r,"objects/pack"));s=s.filter(o=>o.endsWith(".idx"));for(let o of s){let f=`${r}/objects/pack/${o}`,c=await Dw({fs:t,cache:e,filename:f,getExternalRefDelta:n});if(c.error)throw new z(c.error);if(c.offsets.has(i))return!0}return!1}l(pj,"hasObjectPacked");async function zT({fs:t,cache:e,gitdir:r,oid:i,format:n="content"}){let s=l(f=>he({fs:t,cache:e,gitdir:r,oid:f}),"getExternalRefDelta"),o=await dj({fs:t,gitdir:r,oid:i});return o||(o=await pj({fs:t,cache:e,gitdir:r,oid:i,getExternalRefDelta:s})),o}l(zT,"hasObject");function mj(t){let n="5041434b"+"00000002"+"00000000";return t.slice(0,12).toString("hex")===n}l(mj,"emptyPackfile");function b1(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)})}l(b1,"filterCapabilities");var xu={name:"isomorphic-git",version:"0.0.0-development",agent:"git/isomorphic-git@0.0.0-development"},ey=class ey{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})}};l(ey,"FIFO");var js=ey;function wj(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}l(wj,"findSplit");function _1(t){let e=new js,r="";return(async()=>(await oc(t,i=>{for(i=i.toString("utf8"),r+=i;;){let n=wj(r);if(n===-1)break;e.write(r.slice(0,n)),r=r.slice(n)}}),r.length>0&&e.write(r),e.end()))(),e}l(_1,"splitLines");var ty=class ty{static demux(e){let r=be.streamReader(e),i=new js,n=new js,s=new js,o=l(async function(){let f=await r();if(f===null)return o();if(f===!0){i.end(),s.end(),e.error?n.destroy(e.error):n.end();return}switch(f[0]){case 1:{n.write(f.slice(1));break}case 2:{s.write(f.slice(1));break}case 3:{let c=f.slice(1);s.write(c),i.end(),s.end(),n.destroy(new Error(c.toString("utf8")));return}default:i.write(f)}o()},"nextBit");return o(),{packetlines:i,packfile:n,progress:s}}};l(ty,"GitSideBand");var Lf=ty;async function yj(t){let{packetlines:e,packfile:r,progress:i}=Lf.demux(t),n=[],s=[],o=[],f=!1,c=!1;return new Promise((a,u)=>{oc(e,h=>{let d=h.toString("utf8").trim();if(d.startsWith("shallow")){let p=d.slice(-41).trim();p.length!==40&&u(new ci(p)),n.push(p)}else if(d.startsWith("unshallow")){let p=d.slice(-41).trim();p.length!==40&&u(new ci(p)),s.push(p)}else if(d.startsWith("ACK")){let[,p,m]=d.split(" ");o.push({oid:p,status:m}),m||(c=!0)}else d.startsWith("NAK")?(f=!0,c=!0):(c=!0,f=!0);c&&(t.error?u(t.error):a({shallows:n,unshallows:s,acks:o,nak:f,packfile:r,progress:i}))}).finally(()=>{c||(t.error?u(t.error):a({shallows:n,unshallows:s,acks:o,nak:f,packfile:r,progress:i}))})})}l(yj,"parseUploadPackResponse");function gj({capabilities:t=[],wants:e=[],haves:r=[],shallows:i=[],depth:n=null,since:s=null,exclude:o=[]}){let f=[];e=[...new Set(e)];let c=` ${t.join(" ")}`;for(let a of e)f.push(be.encode(`want ${a}${c}
75
+ `)),c="";for(let a of i)f.push(be.encode(`shallow ${a}
76
+ `));n!==null&&f.push(be.encode(`deepen ${n}
77
+ `)),s!==null&&f.push(be.encode(`deepen-since ${Math.floor(s.valueOf()/1e3)}
78
+ `));for(let a of o)f.push(be.encode(`deepen-not ${a}
79
+ `));f.push(be.flush());for(let a of r)f.push(be.encode(`have ${a}
80
+ `));return f.push(be.encode(`done
81
+ `)),f}l(gj,"writeUploadPackRequest");async function $w({fs:t,cache:e,http:r,onProgress:i,onMessage:n,onAuth:s,onAuthSuccess:o,onAuthFailure:f,gitdir:c,ref:a,remoteRef:u,remote:h,url:d,corsProxy:p,depth:m=null,since:w=null,exclude:y=[],relative:b=!1,tags:_=!1,singleBranch:F=!1,headers:E={},prune:R=!1,pruneTags:D=!1}){let S=a||await mi({fs:t,gitdir:c,test:!0}),O=await Se.get({fs:t,gitdir:c}),v=h||S&&await O.get(`branch.${S}.remote`)||"origin",A=d||await O.get(`remote.${v}.url`);if(typeof A>"u")throw new dt("remote OR url");let x=u||S&&await O.get(`branch.${S}.merge`)||a||"HEAD";p===void 0&&(p=await O.get("http.corsProxy"));let I=Qs.getRemoteHelperFor({url:A}),M=await I.discover({http:r,onAuth:s,onAuthSuccess:o,onAuthFailure:f,corsProxy:p,service:"git-upload-pack",url:A,headers:E,protocolVersion:1}),H=M.auth,Te=M.refs;if(Te.size===0)return{defaultBranch:null,fetchHead:null,fetchHeadDescription:null};if(m!==null&&!M.capabilities.has("shallow"))throw new ai("shallow","depth");if(w!==null&&!M.capabilities.has("deepen-since"))throw new ai("deepen-since","since");if(y.length>0&&!M.capabilities.has("deepen-not"))throw new ai("deepen-not","exclude");if(b===!0&&!M.capabilities.has("deepen-relative"))throw new ai("deepen-relative","relative");let ft,zt;try{let re=$.resolveAgainstMap({ref:x,map:Te});ft=re.fullref,zt=re.oid}catch{}for(let re of Te.keys())re===ft||re==="HEAD"||re.startsWith("refs/heads/")||_&&re.startsWith("refs/tags/")||Te.delete(re);let Ht=b1([...M.capabilities],["multi_ack_detailed","no-done","side-band-64k","ofs-delta",`agent=${xu.agent}`]);b&&Ht.push("deepen-relative");let Fd=F?[zt]:Te.values(),Td=F?[S]:await $.listRefs({fs:t,gitdir:c,filepath:"refs"}),yt=[];for(let re of Td)try{re=await $.expand({fs:t,gitdir:c,ref:re});let Ue=await $.resolve({fs:t,gitdir:c,ref:re});await zT({fs:t,cache:e,gitdir:c,oid:Ue})&&yt.push(Ue)}catch{}yt=[...new Set(yt)];let ge=await Qi.read({fs:t,gitdir:c}),sr=M.capabilities.has("shallow")?[...ge]:[],Ge=gj({capabilities:Ht,wants:Fd,haves:yt,shallows:sr,depth:m,since:w,exclude:y}),Ho=Buffer.from(await Mf(Ge)),Ai=await I.connect({http:r,onProgress:i,corsProxy:p,service:"git-upload-pack",url:A,auth:H,body:[Ho],headers:E}),Pe=await yj(Ai.body);Ai.headers&&(Pe.headers=Ai.headers);for(let re of Pe.shallows)if(!ge.has(re))try{let{object:Ue}=await he({fs:t,cache:e,gitdir:c,oid:re}),Ot=new mt(Ue),or=await Promise.all(Ot.headers().parent.map(Go=>zT({fs:t,cache:e,gitdir:c,oid:Go})));or.length===0||or.every(Go=>Go)||ge.add(re)}catch{ge.add(re)}for(let re of Pe.unshallows)ge.delete(re);if(await Qi.write({fs:t,gitdir:c,oids:ge}),F){let re=new Map([[ft,zt]]),Ue=new Map,Ot=10,or=ft;for(;Ot--;){let Rd=M.symrefs.get(or);if(Rd===void 0)break;Ue.set(or,Rd),or=Rd}let kd=Te.get(or);kd&&re.set(or,kd);let{pruned:Go}=await $.updateRemoteRefs({fs:t,gitdir:c,remote:v,refs:re,symrefs:Ue,tags:_,prune:R});R&&(Pe.pruned=Go)}else{let{pruned:re}=await $.updateRemoteRefs({fs:t,gitdir:c,remote:v,refs:Te,symrefs:M.symrefs,tags:_,prune:R,pruneTags:D});R&&(Pe.pruned=re)}if(Pe.HEAD=M.symrefs.get("HEAD"),Pe.HEAD===void 0)try{let{oid:re}=$.resolveAgainstMap({ref:"HEAD",map:Te});for(let[Ue,Ot]of Te.entries())if(Ue!=="HEAD"&&Ot===re){Pe.HEAD=Ue;break}}catch{}let eN=ft&&ft.startsWith("refs/tags")?"tag":"branch";if(Pe.FETCH_HEAD={oid:zt,description:`${eN} '${Yi(ft)}' of ${A}`},i||n){let re=_1(Pe.progress);oc(re,async Ue=>{if(n&&await n(Ue),i){let Ot=Ue.match(/([^:]*).*\((\d+?)\/(\d+?)\)/);Ot&&await i({phase:Ot[1].trim(),loaded:parseInt(Ot[2],10),total:parseInt(Ot[3],10)})}})}let Mc=Buffer.from(await Mf(Pe.packfile));if(Ai.body.error)throw Ai.body.error;let I0=Mc.slice(-20).toString("hex"),Vo={defaultBranch:Pe.HEAD,fetchHead:Pe.FETCH_HEAD.oid,fetchHeadDescription:Pe.FETCH_HEAD.description};if(Pe.headers&&(Vo.headers=Pe.headers),R&&(Vo.pruned=Pe.pruned),I0!==""&&!mj(Mc)){Vo.packfile=`objects/pack/pack-${I0}.pack`;let re=C(c,Vo.packfile);await t.write(re,Mc);let Ue=l(or=>he({fs:t,cache:e,gitdir:c,oid:or}),"getExternalRefDelta"),Ot=await Ua.fromPack({pack:Mc,getExternalRefDelta:Ue,onProgress:i});await t.write(re.replace(/\.pack$/,".idx"),await Ot.toBuffer())}return Vo}l($w,"_fetch");async function S1({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(o=>i+"/"+o);for(let o of s)await t.mkdir(o);await t.write(i+"/config",`[core]
78
82
  repositoryformatversion = 0
79
83
  filemode = false
80
84
  bare = ${e}
@@ -82,31 +86,59 @@ gpgsig`+$p(a)+`
82
86
  `)+` symlinks = false
83
87
  ignorecase = true
84
88
  `),await t.write(i+"/HEAD",`ref: refs/heads/${n}
85
- `)}l(zS,"_init");async function B2({fs:t,cache:e,http:r,onProgress:i,onMessage:n,onAuth:s,onAuthSuccess:a,onAuthFailure:f,onPostCheckout:o,dir:c,gitdir:u,url:h,corsProxy:d,ref:p,remote:m,depth:w,since:y,exclude:g,relative:_,singleBranch:F,noCheckout:R,noTags:k,headers:D,nonBlocking:v,batchSize:O=100}){try{if(await zS({fs:t,gitdir:u}),await $S({fs:t,gitdir:u,remote:m,url:h,force:!1}),d){let x=await me.get({fs:t,gitdir:u});await x.set("http.corsProxy",d),await me.save({fs:t,gitdir:u,config:x})}let{defaultBranch:E,fetchHead:N}=await sm({fs:t,cache:e,http:r,onProgress:i,onMessage:n,onAuth:s,onAuthSuccess:a,onAuthFailure:f,gitdir:u,ref:p,remote:m,corsProxy:d,depth:w,since:y,exclude:g,relative:_,singleBranch:F,headers:D,tags:!k});if(N===null)return;p=p||E,p=p.replace("refs/heads/",""),await im({fs:t,cache:e,onProgress:i,onPostCheckout:o,dir:c,gitdir:u,ref:p,remote:m,noCheckout:R,nonBlocking:v,batchSize:O})}catch(E){throw await t.rmdir(u,{recursive:!0,maxRetries:10}).catch(()=>{}),E}}l(B2,"_clone");async function HS({fs:t,http:e,onProgress:r,onMessage:i,onAuth:n,onAuthSuccess:s,onAuthFailure:a,onPostCheckout:f,dir:o,gitdir:c=C.join(o,".git"),url:u,corsProxy:h=void 0,ref:d=void 0,remote:p="origin",depth:m=void 0,since:w=void 0,exclude:y=[],relative:g=!1,singleBranch:_=!1,noCheckout:F=!1,noTags:R=!1,headers:k={},cache:D={},nonBlocking:v=!1,batchSize:O=100}){try{return S("fs",t),S("http",e),S("gitdir",c),F||S("dir",o),S("url",u),await B2({fs:new M(t),cache:D,http:e,onProgress:r,onMessage:i,onAuth:n,onAuthSuccess:s,onAuthFailure:a,onPostCheckout:f,dir:o,gitdir:c,url:u,corsProxy:h,ref:d,remote:p,depth:m,since:w,exclude:y,relative:g,singleBranch:_,noCheckout:F,noTags:R,headers:k,nonBlocking:v,batchSize:O})}catch(E){throw E.caller="git.clone",E}}l(HS,"clone");async function VS({fs:t,onSign:e,dir:r,gitdir:i=C.join(r,".git"),message:n,author:s,committer:a,signingKey:f,amend:o=!1,dryRun:c=!1,noUpdateBranch:u=!1,ref:h,parent:d,tree:p,cache:m={}}){try{S("fs",t),o||S("message",n),f&&S("onSign",e);let w=new M(t);return await vf({fs:w,cache:m,onSign:e,gitdir:i,message:n,author:s,committer:a,signingKey:f,amend:o,dryRun:c,noUpdateBranch:u,ref:h,parent:d,tree:p})}catch(w){throw w.caller="git.commit",w}}l(VS,"commit");async function GS({fs:t,dir:e,gitdir:r=C.join(e,".git"),fullname:i=!1,test:n=!1}){try{return S("fs",t),S("gitdir",r),await Xr({fs:new M(t),gitdir:r,fullname:i,test:n})}catch(s){throw s.caller="git.currentBranch",s}}l(GS,"currentBranch");async function M2({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 oe(r);let n=await $.expand({fs:t,gitdir:e,ref:r}),s=await Xr({fs:t,gitdir:e,fullname:!0});if(n===s){let o=await $.resolve({fs:t,gitdir:e,ref:n});await $.writeRef({fs:t,gitdir:e,ref:"HEAD",value:o})}await $.deleteRef({fs:t,gitdir:e,ref:n});let a=Pi(r),f=await me.get({fs:t,gitdir:e});await f.deleteSection("branch",a),await me.save({fs:t,gitdir:e,config:f})}l(M2,"_deleteBranch");async function KS({fs:t,dir:e,gitdir:r=C.join(e,".git"),ref:i}){try{return S("fs",t),S("ref",i),await M2({fs:new M(t),gitdir:r,ref:i})}catch(n){throw n.caller="git.deleteBranch",n}}l(KS,"deleteBranch");async function JS({fs:t,dir:e,gitdir:r=C.join(e,".git"),ref:i}){try{S("fs",t),S("ref",i),await $.deleteRef({fs:new M(t),gitdir:r,ref:i})}catch(n){throw n.caller="git.deleteRef",n}}l(JS,"deleteRef");async function j2({fs:t,gitdir:e,remote:r}){let i=await me.get({fs:t,gitdir:e});await i.deleteSection("remote",r),await me.save({fs:t,gitdir:e,config:i})}l(j2,"_deleteRemote");async function XS({fs:t,dir:e,gitdir:r=C.join(e,".git"),remote:i}){try{return S("fs",t),S("remote",i),await j2({fs:new M(t),gitdir:r,remote:i})}catch(n){throw n.caller="git.deleteRemote",n}}l(XS,"deleteRemote");async function L2({fs:t,gitdir:e,ref:r}){r=r.startsWith("refs/tags/")?r:`refs/tags/${r}`,await $.deleteRef({fs:t,gitdir:e,ref:r})}l(L2,"_deleteTag");async function YS({fs:t,dir:e,gitdir:r=C.join(e,".git"),ref:i}){try{return S("fs",t),S("ref",i),await L2({fs:new M(t),gitdir:r,ref:i})}catch(n){throw n.caller="git.deleteTag",n}}l(YS,"deleteTag");async function q2({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))}l(q2,"expandOidLoose");async function U2({fs:t,cache:e,gitdir:r,oid:i,getExternalRefDelta:n}){let s=[],a=await t.readdir(C.join(r,"objects/pack"));a=a.filter(f=>f.endsWith(".idx"));for(let f of a){let o=`${r}/objects/pack/${f}`,c=await rm({fs:t,cache:e,filename:o,getExternalRefDelta:n});if(c.error)throw new W(c.error);for(let u of c.offsets.keys())u.startsWith(i)&&s.push(u)}return s}l(U2,"expandOidPacked");async function W2({fs:t,cache:e,gitdir:r,oid:i}){let n=l(f=>fe({fs:t,cache:e,gitdir:r,oid:f}),"getExternalRefDelta"),s=await q2({fs:t,gitdir:r,oid:i}),a=await U2({fs:t,cache:e,gitdir:r,oid:i,getExternalRefDelta:n});for(let f of a)s.indexOf(f)===-1&&s.push(f);if(s.length===1)return s[0];throw s.length>1?new Xa("oids",i,s):new oe(`an object matching "${i}"`)}l(W2,"_expandOid");async function ZS({fs:t,dir:e,gitdir:r=C.join(e,".git"),oid:i,cache:n={}}){try{return S("fs",t),S("gitdir",r),S("oid",i),await W2({fs:new M(t),cache:n,gitdir:r,oid:i})}catch(s){throw s.caller="git.expandOid",s}}l(ZS,"expandOid");async function QS({fs:t,dir:e,gitdir:r=C.join(e,".git"),ref:i}){try{return S("fs",t),S("gitdir",r),S("ref",i),await $.expand({fs:new M(t),gitdir:r,ref:i})}catch(n){throw n.caller="git.expandRef",n}}l(QS,"expandRef");async function am({fs:t,cache:e,gitdir:r,oids:i}){let n={},s=i.length,a=i.map((f,o)=>({index:o,oid:f}));for(;a.length;){let f=new Set;for(let{oid:c,index:u}of a)n[c]||(n[c]=new Set),n[c].add(u),n[c].size===s&&f.add(c);if(f.size>0)return[...f];let o=new Map;for(let{oid:c,index:u}of a)try{let{object:h}=await fe({fs:t,cache:e,gitdir:r,oid:c}),d=it.from(h),{parent:p}=d.parseHeaders();for(let m of p)(!n[m]||!n[m].has(u))&&o.set(m+":"+u,{oid:m,index:u})}catch{}a=Array.from(o.values())}return[]}l(am,"_findMergeBase");var Lp=/^.*(\r?\n|$)/gm;function z2({branches:t,contents:e}){let r=t[1],i=t[2],n=e[0],s=e[1],a=e[2],f=s.match(Lp),o=n.match(Lp),c=a.match(Lp),u=TI(f,o,c),h=7,d="",p=!0;for(let m of u)m.ok&&(d+=m.ok.join("")),m.conflict&&(p=!1,d+=`${"<".repeat(h)} ${r}
89
+ `)}l(S1,"_init");async function bj({fs:t,cache:e,http:r,onProgress:i,onMessage:n,onAuth:s,onAuthSuccess:o,onAuthFailure:f,onPostCheckout:c,dir:a,gitdir:u,url:h,corsProxy:d,ref:p,remote:m,depth:w,since:y,exclude:b,relative:_,singleBranch:F,noCheckout:E,noTags:R,headers:D,nonBlocking:S,batchSize:O=100}){try{if(await S1({fs:t,gitdir:u}),await d1({fs:t,gitdir:u,remote:m,url:h,force:!1}),d){let x=await Se.get({fs:t,gitdir:u});await x.set("http.corsProxy",d),await Se.save({fs:t,gitdir:u,config:x})}let{defaultBranch:v,fetchHead:A}=await $w({fs:t,cache:e,http:r,onProgress:i,onMessage:n,onAuth:s,onAuthSuccess:o,onAuthFailure:f,gitdir:u,ref:p,remote:m,corsProxy:d,depth:w,since:y,exclude:b,relative:_,singleBranch:F,headers:D,tags:!R});if(A===null)return;p=p||v,p=p.replace("refs/heads/",""),await Cw({fs:t,cache:e,onProgress:i,onPostCheckout:c,dir:a,gitdir:u,ref:p,remote:m,noCheckout:E,nonBlocking:S,batchSize:O})}catch(v){throw await t.rmdir(u,{recursive:!0,maxRetries:10}).catch(()=>{}),v}}l(bj,"_clone");async function v1({fs:t,http:e,onProgress:r,onMessage:i,onAuth:n,onAuthSuccess:s,onAuthFailure:o,onPostCheckout:f,dir:c,gitdir:a=C(c,".git"),url:u,corsProxy:h=void 0,ref:d=void 0,remote:p="origin",depth:m=void 0,since:w=void 0,exclude:y=[],relative:b=!1,singleBranch:_=!1,noCheckout:F=!1,noTags:E=!1,headers:R={},cache:D={},nonBlocking:S=!1,batchSize:O=100}){try{return k("fs",t),k("http",e),k("gitdir",a),F||k("dir",c),k("url",u),await bj({fs:new L(t),cache:D,http:e,onProgress:r,onMessage:i,onAuth:n,onAuthSuccess:s,onAuthFailure:o,onPostCheckout:f,dir:c,gitdir:a,url:u,corsProxy:h,ref:d,remote:p,depth:m,since:w,exclude:y,relative:b,singleBranch:_,noCheckout:F,noTags:E,headers:R,nonBlocking:S,batchSize:O})}catch(v){throw v.caller="git.clone",v}}l(v1,"clone");async function E1({fs:t,onSign:e,dir:r,gitdir:i=C(r,".git"),message:n,author:s,committer:o,signingKey:f,amend:c=!1,dryRun:a=!1,noUpdateBranch:u=!1,ref:h,parent:d,tree:p,cache:m={}}){try{k("fs",t),c||k("message",n),f&&k("onSign",e);let w=new L(t);return await Ou({fs:w,cache:m,onSign:e,gitdir:i,message:n,author:s,committer:o,signingKey:f,amend:c,dryRun:a,noUpdateBranch:u,ref:h,parent:d,tree:p})}catch(w){throw w.caller="git.commit",w}}l(E1,"commit");async function F1({fs:t,dir:e,gitdir:r=C(e,".git"),fullname:i=!1,test:n=!1}){try{return k("fs",t),k("gitdir",r),await mi({fs:new L(t),gitdir:r,fullname:i,test:n})}catch(s){throw s.caller="git.currentBranch",s}}l(F1,"currentBranch");async function _j({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 le(r);let n=await $.expand({fs:t,gitdir:e,ref:r}),s=await mi({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 o=Yi(r),f=await Se.get({fs:t,gitdir:e});await f.deleteSection("branch",o),await Se.save({fs:t,gitdir:e,config:f})}l(_j,"_deleteBranch");async function T1({fs:t,dir:e,gitdir:r=C(e,".git"),ref:i}){try{return k("fs",t),k("ref",i),await _j({fs:new L(t),gitdir:r,ref:i})}catch(n){throw n.caller="git.deleteBranch",n}}l(T1,"deleteBranch");async function k1({fs:t,dir:e,gitdir:r=C(e,".git"),ref:i}){try{k("fs",t),k("ref",i),await $.deleteRef({fs:new L(t),gitdir:r,ref:i})}catch(n){throw n.caller="git.deleteRef",n}}l(k1,"deleteRef");async function Sj({fs:t,gitdir:e,remote:r}){let i=await Se.get({fs:t,gitdir:e});await i.deleteSection("remote",r),await Se.save({fs:t,gitdir:e,config:i})}l(Sj,"_deleteRemote");async function R1({fs:t,dir:e,gitdir:r=C(e,".git"),remote:i}){try{return k("fs",t),k("remote",i),await Sj({fs:new L(t),gitdir:r,remote:i})}catch(n){throw n.caller="git.deleteRemote",n}}l(R1,"deleteRemote");async function vj({fs:t,gitdir:e,ref:r}){r=r.startsWith("refs/tags/")?r:`refs/tags/${r}`,await $.deleteRef({fs:t,gitdir:e,ref:r})}l(vj,"_deleteTag");async function O1({fs:t,dir:e,gitdir:r=C(e,".git"),ref:i}){try{return k("fs",t),k("ref",i),await vj({fs:new L(t),gitdir:r,ref:i})}catch(n){throw n.caller="git.deleteTag",n}}l(O1,"deleteTag");async function Ej({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))}l(Ej,"expandOidLoose");async function Fj({fs:t,cache:e,gitdir:r,oid:i,getExternalRefDelta:n}){let s=[],o=await t.readdir(C(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:n});if(a.error)throw new z(a.error);for(let u of a.offsets.keys())u.startsWith(i)&&s.push(u)}return s}l(Fj,"expandOidPacked");async function Tj({fs:t,cache:e,gitdir:r,oid:i}){let n=l(f=>he({fs:t,cache:e,gitdir:r,oid:f}),"getExternalRefDelta"),s=await Ej({fs:t,gitdir:r,oid:i}),o=await Fj({fs:t,cache:e,gitdir:r,oid:i,getExternalRefDelta:n});for(let f of o)s.indexOf(f)===-1&&s.push(f);if(s.length===1)return s[0];throw s.length>1?new Wa("oids",i,s):new le(`an object matching "${i}"`)}l(Tj,"_expandOid");async function x1({fs:t,dir:e,gitdir:r=C(e,".git"),oid:i,cache:n={}}){try{return k("fs",t),k("gitdir",r),k("oid",i),await Tj({fs:new L(t),cache:n,gitdir:r,oid:i})}catch(s){throw s.caller="git.expandOid",s}}l(x1,"expandOid");async function A1({fs:t,dir:e,gitdir:r=C(e,".git"),ref:i}){try{return k("fs",t),k("gitdir",r),k("ref",i),await $.expand({fs:new L(t),gitdir:r,ref:i})}catch(n){throw n.caller="git.expandRef",n}}l(A1,"expandRef");async function Bw({fs:t,cache:e,gitdir:r,oids:i}){let n={},s=i.length,o=i.map((f,c)=>({index:c,oid:f}));for(;o.length;){let f=new Set;for(let{oid:a,index:u}of o)n[a]||(n[a]=new Set),n[a].add(u),n[a].size===s&&f.add(a);if(f.size>0)return[...f];let c=new Map;for(let{oid:a,index:u}of o)try{let{object:h}=await he({fs:t,cache:e,gitdir:r,oid:a}),d=mt.from(h),{parent:p}=d.parseHeaders();for(let m of p)(!n[m]||!n[m].has(u))&&c.set(m+":"+u,{oid:m,index:u})}catch{}o=Array.from(c.values())}return[]}l(Bw,"_findMergeBase");var yw=/^.*(\r?\n|$)/gm;function kj({branches:t,contents:e}){let r=t[1],i=t[2],n=e[0],s=e[1],o=e[2],f=s.match(yw),c=n.match(yw),a=o.match(yw),u=nL(f,c,a),h=7,d="",p=!0;for(let m of u)m.ok&&(d+=m.ok.join("")),m.conflict&&(p=!1,d+=`${"<".repeat(h)} ${r}
86
90
  `,d+=m.conflict.a.join(""),d+=`${"=".repeat(h)}
87
91
  `,d+=m.conflict.b.join(""),d+=`${">".repeat(h)} ${i}
88
- `);return{cleanMerge:p,mergedText:d}}l(z2,"mergeFile");async function H2({fs:t,cache:e,dir:r,gitdir:i=C.join(r,".git"),index:n,ourOid:s,baseOid:a,theirOid:f,ourName:o="ours",baseName:c="base",theirName:u="theirs",dryRun:h=!1,abortOnConflict:d=!0,mergeDriver:p}){let m=ht({ref:s}),w=ht({ref:a}),y=ht({ref:f}),g=[],_=[],F=[],R=[],k=await Gr({fs:t,cache:e,dir:r,gitdir:i,trees:[m,w,y],map:l(async function(D,[v,O,E]){let N=Fl(D),x=await xl(v,O),I=await xl(E,O);switch(`${x}-${I}`){case"false-false":return{mode:await O.mode(),path:N,oid:await O.oid(),type:await O.type()};case"false-true":return!E&&await v.type()==="tree"?{mode:await v.mode(),path:N,oid:await v.oid(),type:await v.type()}:E?{mode:await E.mode(),path:N,oid:await E.oid(),type:await E.type()}:void 0;case"true-false":return!v&&await E.type()==="tree"?{mode:await E.mode(),path:N,oid:await E.oid(),type:await E.type()}:v?{mode:await v.mode(),path:N,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:N,oid:await v.oid(),type:"tree"};if(v&&E&&await v.type()==="blob"&&await E.type()==="blob")return V2({fs:t,gitdir:i,path:N,ours:v,base:O,theirs:E,ourName:o,baseName:c,theirName:u,mergeDriver:p}).then(async q=>{if(q.cleanMerge)d||n.insert({filepath:D,oid:q.mergeResult.oid,stage:0});else if(g.push(D),_.push(D),!d){let z="";O&&await O.type()==="blob"&&(z=await O.oid());let be=await v.oid(),Vt=await E.oid();n.delete({filepath:D}),z&&n.insert({filepath:D,oid:z,stage:1}),n.insert({filepath:D,oid:be,stage:2}),n.insert({filepath:D,oid:Vt,stage:3})}return q.mergeResult});if(O&&!v&&E&&await O.type()==="blob"&&await E.type()==="blob"){if(g.push(D),F.push(D),!d){let q=await O.oid(),z=await E.oid();n.delete({filepath:D}),n.insert({filepath:D,oid:q,stage:1}),n.insert({filepath:D,oid:z,stage:3})}return{mode:await E.mode(),oid:await E.oid(),type:"blob",path:N}}if(O&&v&&!E&&await O.type()==="blob"&&await v.type()==="blob"){if(g.push(D),R.push(D),!d){let q=await O.oid(),z=await v.oid();n.delete({filepath:D}),n.insert({filepath:D,oid:q,stage:1}),n.insert({filepath:D,oid:z,stage:2})}return{mode:await v.mode(),oid:await v.oid(),type:"blob",path:N}}if(O&&!v&&!E&&(await O.type()==="blob"||await O.type()==="tree"))return;throw new fs}}},"map"),reduce:g.length!==0&&(!r||d)?void 0:async(D,v)=>{let O=v.filter(Boolean);if(D&&!(D&&D.type==="tree"&&O.length===0&&D.path!==".")){if(O.length>0||D.path==="."&&O.length===0){let N=new rt(O).toObject(),x=await nt({fs:t,gitdir:i,type:"tree",object:N,dryRun:h});D.oid=x}return D}}});return g.length!==0?(r&&!d&&await Gr({fs:t,cache:e,dir:r,gitdir:i,trees:[ht({ref:k.oid})],map:l(async function(D,[v]){let O=`${r}/${D}`;if(await v.type()==="blob"){let E=await v.mode(),N=new TextDecoder().decode(await v.content());await t.write(O,N,{mode:E})}return!0},"map")}),new us(g,_,F,R)):k.oid}l(H2,"mergeTree");async function V2({fs:t,gitdir:e,path:r,ours:i,base:n,theirs:s,ourName:a,theirName:f,baseName:o,dryRun:c,mergeDriver:u=z2}){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:[o,a,f],contents:[m,y,g],path:r}),R=await nt({fs:t,gitdir:e,type:"blob",object:Buffer.from(_,"utf8"),dryRun:c});return{cleanMerge:F,mergeResult:{mode:w,path:r,oid:R,type:h}}}l(V2,"mergeBlobs");async function eF({fs:t,cache:e,dir:r,gitdir:i,ours:n,theirs:s,fastForward:a=!0,fastForwardOnly:f=!1,dryRun:o=!1,noUpdateBranch:c=!1,abortOnConflict:u=!0,message:h,author:d,committer:p,signingKey:m,onSign:w,mergeDriver:y,allowUnrelatedHistories:g=!1}){n===void 0&&(n=await Xr({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}),R=await am({fs:t,cache:e,gitdir:i,oids:[_,F]});if(R.length!==1)if(R.length===0&&g)R.push("4b825dc642cb6eb9a060e54bf8d69288fbee4904");else throw new fs;let k=R[0];if(k===F)return{oid:_,alreadyMerged:!0};if(a&&k===_)return!o&&!c&&await $.writeRef({fs:t,gitdir:i,ref:n,value:F}),{oid:F,fastForward:!0};{if(f)throw new eo;let D=await ge.acquire({fs:t,gitdir:i,cache:e,allowUnmerged:!1},async O=>H2({fs:t,cache:e,dir:r,gitdir:i,index:O,ourOid:_,theirOid:F,baseOid:k,ourName:Pi(n),baseName:"base",theirName:Pi(s),dryRun:o,abortOnConflict:u,mergeDriver:y}));if(D instanceof us)throw D;return h||(h=`Merge branch '${Pi(s)}' into ${Pi(n)}`),{oid:await vf({fs:t,cache:e,gitdir:i,message:h,ref:n,tree:D,parent:[_,F],author:d,committer:p,signingKey:m,onSign:w,dryRun:o,noUpdateBranch:c}),tree:D,mergeCommit:!0}}}l(eF,"_merge");async function tF({fs:t,cache:e,http:r,onProgress:i,onMessage:n,onAuth:s,onAuthSuccess:a,onAuthFailure:f,dir:o,gitdir:c,ref:u,url:h,remote:d,remoteRef:p,prune:m,pruneTags:w,fastForward:y,fastForwardOnly:g,corsProxy:_,singleBranch:F,headers:R,author:k,committer:D,signingKey:v}){try{if(!u){let N=await Xr({fs:t,gitdir:c});if(!N)throw new tt("ref");u=N}let{fetchHead:O,fetchHeadDescription:E}=await sm({fs:t,cache:e,http:r,onProgress:i,onMessage:n,onAuth:s,onAuthSuccess:a,onAuthFailure:f,gitdir:c,corsProxy:_,ref:u,url:h,remote:d,remoteRef:p,singleBranch:F,headers:R,prune:m,pruneTags:w});await eF({fs:t,cache:e,gitdir:c,ours:u,theirs:O,fastForward:y,fastForwardOnly:g,message:`Merge ${E}`,author:k,committer:D,signingKey:v,dryRun:!1,noUpdateBranch:!1}),await im({fs:t,cache:e,onProgress:i,dir:o,gitdir:c,ref:u,remote:d,noCheckout:!1})}catch(O){throw O.caller="git.pull",O}}l(tF,"_pull");async function rF({fs:t,http:e,onProgress:r,onMessage:i,onAuth:n,onAuthSuccess:s,onAuthFailure:a,dir:f,gitdir:o=C.join(f,".git"),ref:c,url:u,remote:h,remoteRef:d,corsProxy:p,singleBranch:m,headers:w={},cache:y={}}){try{S("fs",t),S("http",e),S("gitdir",o);let g={name:"",email:"",timestamp:Date.now(),timezoneOffset:0};return await tF({fs:new M(t),cache:y,http:e,onProgress:r,onMessage:i,onAuth:n,onAuthSuccess:s,onAuthFailure:a,dir:f,gitdir:o,ref:c,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(rF,"fastForward");async function iF({fs:t,http:e,onProgress:r,onMessage:i,onAuth:n,onAuthSuccess:s,onAuthFailure:a,dir:f,gitdir:o=C.join(f,".git"),ref:c,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:R={},prune:k=!1,pruneTags:D=!1,cache:v={}}){try{return S("fs",t),S("http",e),S("gitdir",o),await sm({fs:new M(t),cache:v,http:e,onProgress:r,onMessage:i,onAuth:n,onAuthSuccess:s,onAuthFailure:a,gitdir:o,ref:c,remote:u,remoteRef:h,url:d,corsProxy:p,depth:m,since:w,exclude:y,relative:g,tags:_,singleBranch:F,headers:R,prune:k,pruneTags:D})}catch(O){throw O.caller="git.fetch",O}}l(iF,"fetch");async function nF({fs:t,dir:e,gitdir:r=C.join(e,".git"),oids:i,cache:n={}}){try{return S("fs",t),S("gitdir",r),S("oids",i),await am({fs:new M(t),cache:n,gitdir:r,oids:i})}catch(s){throw s.caller="git.findMergeBase",s}}l(nF,"findMergeBase");async function sF({fs:t,filepath:e}){if(await t.exists(C.join(e,".git")))return e;{let r=cs(e);if(r===e)throw new oe(`git root for ${e}`);return sF({fs:t,filepath:r})}}l(sF,"_findRoot");async function aF({fs:t,filepath:e}){try{return S("fs",t),S("filepath",e),await sF({fs:new M(t),filepath:e})}catch(r){throw r.caller="git.findRoot",r}}l(aF,"findRoot");async function oF({fs:t,dir:e,gitdir:r=C.join(e,".git"),path:i}){try{return S("fs",t),S("gitdir",r),S("path",i),await lo({fs:new M(t),gitdir:r,path:i})}catch(n){throw n.caller="git.getConfig",n}}l(oF,"getConfig");async function G2({fs:t,gitdir:e,path:r}){return(await me.get({fs:t,gitdir:e})).getall(r)}l(G2,"_getConfigAll");async function cF({fs:t,dir:e,gitdir:r=C.join(e,".git"),path:i}){try{return S("fs",t),S("gitdir",r),S("path",i),await G2({fs:new M(t),gitdir:r,path:i})}catch(n){throw n.caller="git.getConfigAll",n}}l(cF,"getConfigAll");async function lF({http:t,onAuth:e,onAuthSuccess:r,onAuthFailure:i,corsProxy:n,url:s,headers:a={},forPush:f=!1}){try{S("http",t),S("url",s);let c=await gs.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:a,protocolVersion:1}),u={capabilities:[...c.capabilities]};for(let[h,d]of c.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 c.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(o){throw o.caller="git.getRemoteInfo",o}}l(lF,"getRemoteInfo");function fF(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 o=s.replace("^{}",""),c=n[n.length-1],u=c.ref===o?c:n.find(h=>h.ref===o);if(u===void 0)throw new Error("I did not expect this to happen");u.peeled=a}continue}let f={ref:s,oid:a};r&&t.symrefs.has(s)&&(f.target=t.symrefs.get(s)),n.push(f)}return n}l(fF,"formatInfoRefs");async function uF({http:t,onAuth:e,onAuthSuccess:r,onAuthFailure:i,corsProxy:n,url:s,headers:a={},forPush:f=!1,protocolVersion:o=2}){try{S("http",t),S("url",s);let u=await gs.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:a,protocolVersion:o});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:fF(u,void 0,!0,!0)}}catch(c){throw c.caller="git.getRemoteInfo2",c}}l(uF,"getRemoteInfo2");async function K2({type:t,object:e,format:r="content",oid:i=void 0}){return r!=="deflated"&&(r!=="wrapped"&&(e=Hr.wrap({type:t,object:e})),i=await Er(e)),{oid:i,object:e}}l(K2,"hashObject");async function hF({object:t}){try{S("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 K2({type:e,format:"content",object:t});return{oid:r,type:e,object:i,format:"wrapped"}}catch(e){throw e.caller="git.hashBlob",e}}l(hF,"hashBlob");async function J2({fs:t,cache:e,onProgress:r,dir:i,gitdir:n,filepath:s}){try{s=C.join(i,s);let a=await t.read(s),f=l(c=>fe({fs:t,cache:e,gitdir:n,oid:c}),"getExternalRefDelta"),o=await Ja.fromPack({pack:a,getExternalRefDelta:f,onProgress:r});return await t.write(s.replace(/\.pack$/,".idx"),await o.toBuffer()),{oids:[...o.hashes]}}catch(a){throw a.caller="git.indexPack",a}}l(J2,"_indexPack");async function dF({fs:t,onProgress:e,dir:r,gitdir:i=C.join(r,".git"),filepath:n,cache:s={}}){try{return S("fs",t),S("dir",r),S("gitdir",r),S("filepath",n),await J2({fs:new M(t),cache:s,onProgress:e,dir:r,gitdir:i,filepath:n})}catch(a){throw a.caller="git.indexPack",a}}l(dF,"indexPack");async function pF({fs:t,bare:e=!1,dir:r,gitdir:i=e?r:C.join(r,".git"),defaultBranch:n="master"}){try{return S("fs",t),S("gitdir",i),e||S("dir",r),await zS({fs:new M(t),bare:e,dir:r,gitdir:i,defaultBranch:n})}catch(s){throw s.caller="git.init",s}}l(pF,"init");async function mF({fs:t,cache:e,gitdir:r,oid:i,ancestor:n,depth:s}){let a=await Di.read({fs:t,gitdir:r});if(!i)throw new tt("oid");if(!n)throw new tt("ancestor");if(i===n)return!1;let f=[i],o=new Set,c=0;for(;f.length;){if(c++===s)throw new ro(s);let u=f.shift(),{type:h,object:d}=await fe({fs:t,cache:e,gitdir:r,oid:u});if(h!=="commit")throw new Ye(u,h,"commit");let p=it.from(d).parse();for(let m of p.parent)if(m===n)return!0;if(!a.has(u))for(let m of p.parent)o.has(m)||(f.push(m),o.add(m))}return!1}l(mF,"_isDescendent");async function wF({fs:t,dir:e,gitdir:r=C.join(e,".git"),oid:i,ancestor:n,depth:s=-1,cache:a={}}){try{return S("fs",t),S("gitdir",r),S("oid",i),S("ancestor",n),await mF({fs:new M(t),cache:a,gitdir:r,oid:i,ancestor:n,depth:s})}catch(f){throw f.caller="git.isDescendent",f}}l(wF,"isDescendent");async function yF({fs:t,dir:e,gitdir:r=C.join(e,".git"),filepath:i}){try{return S("fs",t),S("dir",e),S("gitdir",r),S("filepath",i),Kr.isIgnored({fs:new M(t),dir:e,gitdir:r,filepath:i})}catch(n){throw n.caller="git.isIgnored",n}}l(yF,"isIgnored");async function gF({fs:t,dir:e,gitdir:r=C.join(e,".git"),remote:i}){try{return S("fs",t),S("gitdir",r),$.listBranches({fs:new M(t),gitdir:r,remote:i})}catch(n){throw n.caller="git.listBranches",n}}l(gF,"listBranches");async function X2({fs:t,gitdir:e,ref:r,cache:i}){if(r){let n=await $.resolve({gitdir:e,fs:t,ref:r}),s=[];return await bF({fs:t,cache:i,gitdir:e,oid:n,filenames:s,prefix:""}),s}else return ge.acquire({fs:t,gitdir:e,cache:i},async function(n){return n.entries.map(s=>s.path)})}l(X2,"_listFiles");async function bF({fs:t,cache:e,gitdir:r,oid:i,filenames:n,prefix:s}){let{tree:a}=await vs({fs:t,cache:e,gitdir:r,oid:i});for(let f of a)f.type==="tree"?await bF({fs:t,cache:e,gitdir:r,oid:f.oid,filenames:n,prefix:C.join(s,f.path)}):n.push(C.join(s,f.path))}l(bF,"accumulateFilesFromOid");async function _F({fs:t,dir:e,gitdir:r=C.join(e,".git"),ref:i,cache:n={}}){try{return S("fs",t),S("gitdir",r),await X2({fs:new M(t),cache:n,gitdir:r,ref:i})}catch(s){throw s.caller="git.listFiles",s}}l(_F,"listFiles");async function Y2({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 oe)return[]}return(await vs({fs:t,cache:e,gitdir:r,oid:n})).tree.map(f=>({target:f.path,note:f.oid}))}l(Y2,"_listNotes");async function vF({fs:t,dir:e,gitdir:r=C.join(e,".git"),ref:i="refs/notes/commits",cache:n={}}){try{return S("fs",t),S("gitdir",r),S("ref",i),await Y2({fs:new M(t),cache:n,gitdir:r,ref:i})}catch(s){throw s.caller="git.listNotes",s}}l(vF,"listNotes");async function EF({fs:t,dir:e,gitdir:r=C.join(e,".git"),filepath:i}){try{return S("fs",t),S("gitdir",r),$.listRefs({fs:new M(t),gitdir:r,filepath:i})}catch(n){throw n.caller="git.listRefs",n}}l(EF,"listRefs");async function Z2({fs:t,gitdir:e}){let r=await me.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}}))}l(Z2,"_listRemotes");async function SF({fs:t,dir:e,gitdir:r=C.join(e,".git")}){try{return S("fs",t),S("gitdir",r),await Z2({fs:new M(t),gitdir:r})}catch(i){throw i.caller="git.listRemotes",i}}l(SF,"listRemotes");async function Q2(t){let e=pe.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(" "),f={ref:s,oid:n};for(let o of a){let[c,u]=o.split(":");c==="symref-target"?f.target=u:c==="peeled"&&(f.peeled=u)}r.push(f)}return r}l(Q2,"parseListRefsResponse");async function e$({prefix:t,symrefs:e,peelTags:r}){let i=[];return i.push(pe.encode(`command=ls-refs
89
- `)),i.push(pe.encode(`agent=${Ef.agent}
90
- `)),(r||e||t)&&i.push(pe.delim()),r&&i.push(pe.encode("peel")),e&&i.push(pe.encode("symrefs")),t&&i.push(pe.encode(`ref-prefix ${t}`)),i.push(pe.flush()),i}l(e$,"writeListRefsRequest");async function FF({http:t,onAuth:e,onAuthSuccess:r,onAuthFailure:i,corsProxy:n,url:s,headers:a={},forPush:f=!1,protocolVersion:o=2,prefix:c,symrefs:u,peelTags:h}){try{S("http",t),S("url",s);let d=await ys.discover({http:t,onAuth:e,onAuthSuccess:r,onAuthFailure:i,corsProxy:n,service:f?"git-receive-pack":"git-upload-pack",url:s,headers:a,protocolVersion:o});if(d.protocolVersion===1)return fF(d,c,u,h);let p=await e$({prefix:c,symrefs:u,peelTags:h}),m=await ys.connect({http:t,auth:d.auth,headers:a,corsProxy:n,service:f?"git-receive-pack":"git-upload-pack",url:s,body:p});return Q2(m.body)}catch(d){throw d.caller="git.listServerRefs",d}}l(FF,"listServerRefs");async function TF({fs:t,dir:e,gitdir:r=C.join(e,".git")}){try{return S("fs",t),S("gitdir",r),$.listTags({fs:new M(t),gitdir:r})}catch(i){throw i.caller="git.listTags",i}}l(TF,"listTags");function t$(t,e){return t.committer.timestamp-e.committer.timestamp}l(t$,"compareAge");var r$="e69de29bb2d1d6434b8b29ae775ad8c2e48c5391";async function pS({fs:t,cache:e,gitdir:r,oid:i,fileId:n}){if(n===r$)return;let s=i,a,f=await ps({fs:t,cache:e,gitdir:r,oid:i}),o=f.tree;return n===f.oid?a=f.path:(a=await RF({fs:t,cache:e,gitdir:r,tree:o,fileId:n,oid:s}),Array.isArray(a)&&(a.length===0?a=void 0:a.length===1&&(a=a[0]))),a}l(pS,"resolveFileIdInTree");async function RF({fs:t,cache:e,gitdir:r,tree:i,fileId:n,oid:s,filepaths:a=[],parentPath:f=""}){let o=i.entries().map(function(c){let u;return c.oid===n?(u=C.join(f,c.path),a.push(u)):c.type==="tree"&&(u=fe({fs:t,cache:e,gitdir:r,oid:c.oid}).then(function({object:h}){return RF({fs:t,cache:e,gitdir:r,tree:rt.from(h),fileId:n,oid:s,filepaths:a,parentPath:C.join(f,c.path)})})),u});return await Promise.all(o),a}l(RF,"_resolveFileId");async function i$({fs:t,cache:e,gitdir:r,filepath:i,ref:n,depth:s,since:a,force:f,follow:o}){let c=typeof a>"u"?void 0:Math.floor(a.valueOf()/1e3),u=[],h=await Di.read({fs:t,gitdir:r}),d=await $.resolve({fs:t,gitdir:r,ref:n}),p=[await ws({fs:t,cache:e,gitdir:r,oid:d})],m,w,y;function g(_){y&&i&&u.push(_)}for(l(g,"endCommit");p.length>0;){let _=p.pop();if(c!==void 0&&_.commit.committer.timestamp<=c)break;if(i){let F;try{F=await fo({fs:t,cache:e,gitdir:r,oid:_.commit.tree,filepath:i}),w&&m!==F&&u.push(w),m=F,w=_,y=!0}catch(R){if(R instanceof oe){let k=o&&m;if(k&&(k=await pS({fs:t,cache:e,gitdir:r,oid:_.commit.tree,fileId:m}),k))if(Array.isArray(k)){if(w){let D=await pS({fs:t,cache:e,gitdir:r,oid:w.commit.tree,fileId:m});if(Array.isArray(D))if(k=k.filter(v=>D.indexOf(v)===-1),k.length===1)k=k[0],i=k,w&&u.push(w);else{k=!1,w&&u.push(w);break}}}else i=k,w&&u.push(w);if(!k){if(y&&m&&(u.push(w),!f))break;if(!f&&!o)throw R}w=_,y=!1}else throw R}}else u.push(_);if(s!==void 0&&u.length===s){g(_);break}if(!h.has(_.oid))for(let F of _.commit.parent){let R=await ws({fs:t,cache:e,gitdir:r,oid:F});p.map(k=>k.oid).includes(R.oid)||p.push(R)}p.length===0&&g(_),p.sort((F,R)=>t$(F.commit,R.commit))}return u}l(i$,"_log");async function OF({fs:t,dir:e,gitdir:r=C.join(e,".git"),filepath:i,ref:n="HEAD",depth:s,since:a,force:f,follow:o,cache:c={}}){try{return S("fs",t),S("gitdir",r),S("ref",n),await i$({fs:new M(t),cache:c,gitdir:r,filepath:i,ref:n,depth:s,since:a,force:f,follow:o})}catch(u){throw u.caller="git.log",u}}l(OF,"log");async function kF({fs:t,onSign:e,dir:r,gitdir:i=C.join(r,".git"),ours:n,theirs:s,fastForward:a=!0,fastForwardOnly:f=!1,dryRun:o=!1,noUpdateBranch:c=!1,abortOnConflict:u=!0,message:h,author:d,committer:p,signingKey:m,cache:w={},mergeDriver:y,allowUnrelatedHistories:g=!1}){try{S("fs",t),m&&S("onSign",e);let _=new M(t),F=await Jr({fs:_,gitdir:i,author:d});if(!F&&(!f||!a))throw new ze("author");let R=await ms({fs:_,gitdir:i,author:F,committer:p});if(!R&&(!f||!a))throw new ze("committer");return await eF({fs:_,cache:w,dir:r,gitdir:i,ours:n,theirs:s,fastForward:a,fastForwardOnly:f,dryRun:o,noUpdateBranch:c,abortOnConflict:u,message:h,author:F,committer:R,signingKey:m,onSign:e,mergeDriver:y,allowUnrelatedHistories:g})}catch(_){throw _.caller="git.merge",_}}l(kF,"merge");var n$={commit:16,tree:32,blob:48,tag:64,ofs_delta:96,ref_delta:112};async function xF({fs:t,cache:e,dir:r,gitdir:i=C.join(r,".git"),oids:n}){let s=new wS,a=[];function f(u,h){let d=Buffer.from(u,h);a.push(d),s.update(d)}l(f,"write");async function o({stype:u,object:h}){let d=n$[u],p=h.length,m=p>15?128:0,w=p&15;p=p>>>4;let y=(m|d|w).toString(16);for(f(y,"hex");m;)m=p>127?128:0,y=m|p&127,f(em(2,y),"hex"),p=p>>>7;f(Buffer.from(await kS(h)))}l(o,"writeObject"),f("PACK"),f("00000002","hex"),f(em(8,n.length),"hex");for(let u of n){let{type:h,object:d}=await fe({fs:t,cache:e,gitdir:i,oid:u});await o({write:f,object:d,stype:h})}let c=s.digest();return a.push(c),a}l(xF,"_pack");async function s$({fs:t,cache:e,gitdir:r,oids:i,write:n}){let s=await xF({fs:t,cache:e,gitdir:r,oids:i}),a=Buffer.from(await Al(s)),o=`pack-${a.slice(-20).toString("hex")}.pack`;return n?(await t.write(C.join(r,`objects/pack/${o}`),a),{filename:o}):{filename:o,packfile:new Uint8Array(a)}}l(s$,"_packObjects");async function AF({fs:t,dir:e,gitdir:r=C.join(e,".git"),oids:i,write:n=!1,cache:s={}}){try{return S("fs",t),S("gitdir",r),S("oids",i),await s$({fs:new M(t),cache:s,gitdir:r,oids:i,write:n})}catch(a){throw a.caller="git.packObjects",a}}l(AF,"packObjects");async function PF({fs:t,http:e,onProgress:r,onMessage:i,onAuth:n,onAuthSuccess:s,onAuthFailure:a,dir:f,gitdir:o=C.join(f,".git"),ref:c,url:u,remote:h,remoteRef:d,prune:p=!1,pruneTags:m=!1,fastForward:w=!0,fastForwardOnly:y=!1,corsProxy:g,singleBranch:_,headers:F={},author:R,committer:k,signingKey:D,cache:v={}}){try{S("fs",t),S("gitdir",o);let O=new M(t),E=await Jr({fs:O,gitdir:o,author:R});if(!E)throw new ze("author");let N=await ms({fs:O,gitdir:o,author:E,committer:k});if(!N)throw new ze("committer");return await tF({fs:O,cache:v,http:e,onProgress:r,onMessage:i,onAuth:n,onAuthSuccess:s,onAuthFailure:a,dir:f,gitdir:o,ref:c,url:u,remote:h,remoteRef:d,fastForward:w,fastForwardOnly:y,corsProxy:g,singleBranch:_,headers:F,author:E,committer:N,signingKey:D,prune:p,pruneTags:m})}catch(O){throw O.caller="git.pull",O}}l(PF,"pull");async function a$({fs:t,cache:e,dir:r,gitdir:i=C.join(r,".git"),start:n,finish:s}){let a=await Di.read({fs:t,gitdir:i}),f=new Set,o=new Set;for(let h of n)f.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});o.add(d)}catch{}let c=new Set;async function u(h){c.add(h);let{type:d,object:p}=await fe({fs:t,cache:e,gitdir:i,oid:h});if(d==="tag"){let w=dt.from(p).headers().object;return u(w)}if(d!=="commit")throw new Ye(h,d,"commit");if(!a.has(h)){let w=it.from(p).headers().parent;for(h of w)!o.has(h)&&!c.has(h)&&await u(h)}}l(u,"walk");for(let h of f)await u(h);return c}l(a$,"listCommitsAndTags");async function qp({fs:t,cache:e,dir:r,gitdir:i=C.join(r,".git"),oids:n}){let s=new Set;async function a(f){if(s.has(f))return;s.add(f);let{type:o,object:c}=await fe({fs:t,cache:e,gitdir:i,oid:f});if(o==="tag"){let h=dt.from(c).headers().object;await a(h)}else if(o==="commit"){let h=it.from(c).headers().tree;await a(h)}else if(o==="tree"){let u=rt.from(c);for(let h of u)h.type==="blob"&&s.add(h.oid),h.type==="tree"&&await a(h.oid)}}l(a,"walk");for(let f of n)await a(f);return s}l(qp,"listObjects");async function o$(t){let e={},r="",i=pe.streamReader(t),n=await i();for(;n!==!0;)n!==null&&(r+=n.toString("utf8")+`
92
+ `);return{cleanMerge:p,mergedText:d}}l(kj,"mergeFile");async function Rj({fs:t,cache:e,dir:r,gitdir:i=C(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=Et({ref:s}),w=Et({ref:o}),y=Et({ref:f}),b=[],_=[],F=[],E=[],R=await ui({fs:t,cache:e,dir:r,gitdir:i,trees:[m,w,y],map:l(async function(D,[S,O,v]){let A=Nf(D),x=await Bf(S,O),I=await Bf(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 Oj({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:D,oid:M.mergeResult.oid,stage:0});else if(b.push(D),_.push(D),!d){let H="";O&&await O.type()==="blob"&&(H=await O.oid());let Te=await S.oid(),ft=await v.oid();n.delete({filepath:D}),H&&n.insert({filepath:D,oid:H,stage:1}),n.insert({filepath:D,oid:Te,stage:2}),n.insert({filepath:D,oid:ft,stage:3})}return M.mergeResult});if(O&&!S&&v&&await O.type()==="blob"&&await v.type()==="blob"){if(b.push(D),F.push(D),!d){let M=await O.oid(),H=await v.oid();n.delete({filepath:D}),n.insert({filepath:D,oid:M,stage:1}),n.insert({filepath:D,oid:H,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(b.push(D),E.push(D),!d){let M=await O.oid(),H=await S.oid();n.delete({filepath:D}),n.insert({filepath:D,oid:M,stage:1}),n.insert({filepath:D,oid:H,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 Hs}}},"map"),reduce:b.length!==0&&(!r||d)?void 0:async(D,S)=>{let O=S.filter(Boolean);if(D&&!(D&&D.type==="tree"&&O.length===0&&D.path!==".")){if(O.length>0||D.path==="."&&O.length===0){let A=new pt(O).toObject(),x=await wt({fs:t,gitdir:i,type:"tree",object:A,dryRun:h});D.oid=x}return D}}});return b.length!==0?(r&&!d&&await ui({fs:t,cache:e,dir:r,gitdir:i,trees:[Et({ref:R.oid})],map:l(async function(D,[S]){let O=`${r}/${D}`;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 Vs(b,_,F,E)):R.oid}l(Rj,"mergeTree");async function Oj({fs:t,gitdir:e,path:r,ours:i,base:n,theirs:s,ourName:o,theirName:f,baseName:c,dryRun:a,mergeDriver:u=kj}){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"),b=Buffer.from(await s.content()).toString("utf8"),{mergedText:_,cleanMerge:F}=await u({branches:[c,o,f],contents:[m,y,b],path:r}),E=await wt({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(Oj,"mergeBlobs");async function P1({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:b=!1}){n===void 0&&(n=await mi({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 Bw({fs:t,cache:e,gitdir:i,oids:[_,F]});if(E.length!==1)if(E.length===0&&b)E.push("4b825dc642cb6eb9a060e54bf8d69288fbee4904");else throw new Hs;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 Ga;let D=await Ee.acquire({fs:t,gitdir:i,cache:e,allowUnmerged:!1},async O=>Rj({fs:t,cache:e,dir:r,gitdir:i,index:O,ourOid:_,theirOid:F,baseOid:R,ourName:Yi(n),baseName:"base",theirName:Yi(s),dryRun:c,abortOnConflict:u,mergeDriver:y}));if(D instanceof Vs)throw D;return h||(h=`Merge branch '${Yi(s)}' into ${Yi(n)}`),{oid:await Ou({fs:t,cache:e,gitdir:i,message:h,ref:n,tree:D,parent:[_,F],author:d,committer:p,signingKey:m,onSign:w,dryRun:c,noUpdateBranch:a}),tree:D,mergeCommit:!0}}}l(P1,"_merge");async function N1({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:b,corsProxy:_,singleBranch:F,headers:E,author:R,committer:D,signingKey:S}){try{if(!u){let A=await mi({fs:t,gitdir:a});if(!A)throw new dt("ref");u=A}let{fetchHead:O,fetchHeadDescription:v}=await $w({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 P1({fs:t,cache:e,gitdir:a,ours:u,theirs:O,fastForward:y,fastForwardOnly:b,message:`Merge ${v}`,author:R,committer:D,signingKey:S,dryRun:!1,noUpdateBranch:!1}),await Cw({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(N1,"_pull");async function D1({fs:t,http:e,onProgress:r,onMessage:i,onAuth:n,onAuthSuccess:s,onAuthFailure:o,dir:f,gitdir:c=C(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 b={name:"",email:"",timestamp:Date.now(),timezoneOffset:0};return await N1({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:b,committer:b})}catch(b){throw b.caller="git.fastForward",b}}l(D1,"fastForward");async function C1({fs:t,http:e,onProgress:r,onMessage:i,onAuth:n,onAuthSuccess:s,onAuthFailure:o,dir:f,gitdir:c=C(f,".git"),ref:a,remote:u,remoteRef:h,url:d,corsProxy:p,depth:m=null,since:w=null,exclude:y=[],relative:b=!1,tags:_=!1,singleBranch:F=!1,headers:E={},prune:R=!1,pruneTags:D=!1,cache:S={}}){try{return k("fs",t),k("http",e),k("gitdir",c),await $w({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:b,tags:_,singleBranch:F,headers:E,prune:R,pruneTags:D})}catch(O){throw O.caller="git.fetch",O}}l(C1,"fetch");async function I1({fs:t,dir:e,gitdir:r=C(e,".git"),oids:i,cache:n={}}){try{return k("fs",t),k("gitdir",r),k("oids",i),await Bw({fs:new L(t),cache:n,gitdir:r,oids:i})}catch(s){throw s.caller="git.findMergeBase",s}}l(I1,"findMergeBase");async function $1({fs:t,filepath:e}){if(await t.exists(C(e,".git")))return e;{let r=Ws(e);if(r===e)throw new le(`git root for ${e}`);return $1({fs:t,filepath:r})}}l($1,"_findRoot");async function B1({fs:t,filepath:e}){try{return k("fs",t),k("filepath",e),await $1({fs:new L(t),filepath:e})}catch(r){throw r.caller="git.findRoot",r}}l(B1,"findRoot");async function M1({fs:t,dir:e,gitdir:r=C(e,".git"),path:i}){try{return k("fs",t),k("gitdir",r),k("path",i),await rc({fs:new L(t),gitdir:r,path:i})}catch(n){throw n.caller="git.getConfig",n}}l(M1,"getConfig");async function xj({fs:t,gitdir:e,path:r}){return(await Se.get({fs:t,gitdir:e})).getall(r)}l(xj,"_getConfigAll");async function L1({fs:t,dir:e,gitdir:r=C(e,".git"),path:i}){try{return k("fs",t),k("gitdir",r),k("path",i),await xj({fs:new L(t),gitdir:r,path:i})}catch(n){throw n.caller="git.getConfigAll",n}}l(L1,"getConfigAll");async function j1({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 Qs.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(j1,"getRemoteInfo");function q1(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(q1,"formatInfoRefs");async function U1({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 Qs.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:q1(u,void 0,!0,!0)}}catch(a){throw a.caller="git.getRemoteInfo2",a}}l(U1,"getRemoteInfo2");async function Aj({type:t,object:e,format:r="content",oid:i=void 0}){return r!=="deflated"&&(r!=="wrapped"&&(e=li.wrap({type:t,object:e})),i=await Mr(e)),{oid:i,object:e}}l(Aj,"hashObject");async function W1({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 Aj({type:e,format:"content",object:t});return{oid:r,type:e,object:i,format:"wrapped"}}catch(e){throw e.caller="git.hashBlob",e}}l(W1,"hashBlob");async function Pj({fs:t,cache:e,onProgress:r,dir:i,gitdir:n,filepath:s}){try{s=C(i,s);let o=await t.read(s),f=l(a=>he({fs:t,cache:e,gitdir:n,oid:a}),"getExternalRefDelta"),c=await Ua.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(Pj,"_indexPack");async function z1({fs:t,onProgress:e,dir:r,gitdir:i=C(r,".git"),filepath:n,cache:s={}}){try{return k("fs",t),k("dir",r),k("gitdir",r),k("filepath",n),await Pj({fs:new L(t),cache:s,onProgress:e,dir:r,gitdir:i,filepath:n})}catch(o){throw o.caller="git.indexPack",o}}l(z1,"indexPack");async function H1({fs:t,bare:e=!1,dir:r,gitdir:i=e?r:C(r,".git"),defaultBranch:n="master"}){try{return k("fs",t),k("gitdir",i),e||k("dir",r),await S1({fs:new L(t),bare:e,dir:r,gitdir:i,defaultBranch:n})}catch(s){throw s.caller="git.init",s}}l(H1,"init");async function V1({fs:t,cache:e,gitdir:r,oid:i,ancestor:n,depth:s}){let o=await Qi.read({fs:t,gitdir:r});if(!i)throw new dt("oid");if(!n)throw new dt("ancestor");if(i===n)return!1;let f=[i],c=new Set,a=0;for(;f.length;){if(a++===s)throw new Ka(s);let u=f.shift(),{type:h,object:d}=await he({fs:t,cache:e,gitdir:r,oid:u});if(h!=="commit")throw new ot(u,h,"commit");let p=mt.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(V1,"_isDescendent");async function G1({fs:t,dir:e,gitdir:r=C(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 V1({fs:new L(t),cache:o,gitdir:r,oid:i,ancestor:n,depth:s})}catch(f){throw f.caller="git.isDescendent",f}}l(G1,"isDescendent");async function J1({fs:t,dir:e,gitdir:r=C(e,".git"),filepath:i}){try{return k("fs",t),k("dir",e),k("gitdir",r),k("filepath",i),hi.isIgnored({fs:new L(t),dir:e,gitdir:r,filepath:i})}catch(n){throw n.caller="git.isIgnored",n}}l(J1,"isIgnored");async function K1({fs:t,dir:e,gitdir:r=C(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(K1,"listBranches");async function Nj({fs:t,gitdir:e,ref:r,cache:i}){if(r){let n=await $.resolve({gitdir:e,fs:t,ref:r}),s=[];return await X1({fs:t,cache:i,gitdir:e,oid:n,filenames:s,prefix:""}),s}else return Ee.acquire({fs:t,gitdir:e,cache:i},async function(n){return n.entries.map(s=>s.path)})}l(Nj,"_listFiles");async function X1({fs:t,cache:e,gitdir:r,oid:i,filenames:n,prefix:s}){let{tree:o}=await ro({fs:t,cache:e,gitdir:r,oid:i});for(let f of o)f.type==="tree"?await X1({fs:t,cache:e,gitdir:r,oid:f.oid,filenames:n,prefix:C(s,f.path)}):n.push(C(s,f.path))}l(X1,"accumulateFilesFromOid");async function Y1({fs:t,dir:e,gitdir:r=C(e,".git"),ref:i,cache:n={}}){try{return k("fs",t),k("gitdir",r),await Nj({fs:new L(t),cache:n,gitdir:r,ref:i})}catch(s){throw s.caller="git.listFiles",s}}l(Y1,"listFiles");async function Dj({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 le)return[]}return(await ro({fs:t,cache:e,gitdir:r,oid:n})).tree.map(f=>({target:f.path,note:f.oid}))}l(Dj,"_listNotes");async function Z1({fs:t,dir:e,gitdir:r=C(e,".git"),ref:i="refs/notes/commits",cache:n={}}){try{return k("fs",t),k("gitdir",r),k("ref",i),await Dj({fs:new L(t),cache:n,gitdir:r,ref:i})}catch(s){throw s.caller="git.listNotes",s}}l(Z1,"listNotes");async function Q1({fs:t,dir:e,gitdir:r=C(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(Q1,"listRefs");async function Cj({fs:t,gitdir:e}){let r=await Se.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(Cj,"_listRemotes");async function ek({fs:t,dir:e,gitdir:r=C(e,".git")}){try{return k("fs",t),k("gitdir",r),await Cj({fs:new L(t),gitdir:r})}catch(i){throw i.caller="git.listRemotes",i}}l(ek,"listRemotes");async function Ij(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(Ij,"parseListRefsResponse");async function $j({prefix:t,symrefs:e,peelTags:r}){let i=[];return i.push(be.encode(`command=ls-refs
93
+ `)),i.push(be.encode(`agent=${xu.agent}
94
+ `)),(r||e||t)&&i.push(be.delim()),r&&i.push(be.encode("peel")),e&&i.push(be.encode("symrefs")),t&&i.push(be.encode(`ref-prefix ${t}`)),i.push(be.flush()),i}l($j,"writeListRefsRequest");async function tk({http:t,onAuth:e,onAuthSuccess:r,onAuthFailure:i,corsProxy:n,url:s,headers:o={},forPush:f=!1,protocolVersion:c=2,prefix:a,symrefs:u,peelTags:h}){try{k("http",t),k("url",s);let d=await Zs.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(d.protocolVersion===1)return q1(d,a,u,h);let p=await $j({prefix:a,symrefs:u,peelTags:h}),m=await Zs.connect({http:t,auth:d.auth,headers:o,corsProxy:n,service:f?"git-receive-pack":"git-upload-pack",url:s,body:p});return Ij(m.body)}catch(d){throw d.caller="git.listServerRefs",d}}l(tk,"listServerRefs");async function rk({fs:t,dir:e,gitdir:r=C(e,".git")}){try{return k("fs",t),k("gitdir",r),$.listTags({fs:new L(t),gitdir:r})}catch(i){throw i.caller="git.listTags",i}}l(rk,"listTags");function Bj(t,e){return t.committer.timestamp-e.committer.timestamp}l(Bj,"compareAge");var Mj="e69de29bb2d1d6434b8b29ae775ad8c2e48c5391";async function HT({fs:t,cache:e,gitdir:r,oid:i,fileId:n}){if(n===Mj)return;let s=i,o,f=await Ks({fs:t,cache:e,gitdir:r,oid:i}),c=f.tree;return n===f.oid?o=f.path:(o=await ik({fs:t,cache:e,gitdir:r,tree:c,fileId:n,oid:s}),Array.isArray(o)&&(o.length===0?o=void 0:o.length===1&&(o=o[0]))),o}l(HT,"resolveFileIdInTree");async function ik({fs:t,cache:e,gitdir:r,tree:i,fileId:n,oid:s,filepaths:o=[],parentPath:f=""}){let c=i.entries().map(function(a){let u;return a.oid===n?(u=C(f,a.path),o.push(u)):a.type==="tree"&&(u=he({fs:t,cache:e,gitdir:r,oid:a.oid}).then(function({object:h}){return ik({fs:t,cache:e,gitdir:r,tree:pt.from(h),fileId:n,oid:s,filepaths:o,parentPath:C(f,a.path)})})),u});return await Promise.all(c),o}l(ik,"_resolveFileId");async function Lj({fs:t,cache:e,gitdir:r,filepath:i,ref:n,depth:s,since:o,force:f,follow:c}){let a=typeof o>"u"?void 0:Math.floor(o.valueOf()/1e3),u=[],h=await Qi.read({fs:t,gitdir:r}),d=await $.resolve({fs:t,gitdir:r,ref:n}),p=[await Ys({fs:t,cache:e,gitdir:r,oid:d})],m,w,y;function b(_){y&&i&&u.push(_)}for(l(b,"endCommit");p.length>0;){let _=p.pop();if(a!==void 0&&_.commit.committer.timestamp<=a)break;if(i){let F;try{F=await nc({fs:t,cache:e,gitdir:r,oid:_.commit.tree,filepath:i}),w&&m!==F&&u.push(w),m=F,w=_,y=!0}catch(E){if(E instanceof le){let R=c&&m;if(R&&(R=await HT({fs:t,cache:e,gitdir:r,oid:_.commit.tree,fileId:m}),R))if(Array.isArray(R)){if(w){let D=await HT({fs:t,cache:e,gitdir:r,oid:w.commit.tree,fileId:m});if(Array.isArray(D))if(R=R.filter(S=>D.indexOf(S)===-1),R.length===1)R=R[0],i=R,w&&u.push(w);else{R=!1,w&&u.push(w);break}}}else i=R,w&&u.push(w);if(!R){if(y&&m&&(u.push(w),!f))break;if(!f&&!c)throw E}w=_,y=!1}else throw E}}else u.push(_);if(s!==void 0&&u.length===s){b(_);break}if(!h.has(_.oid))for(let F of _.commit.parent){let E=await Ys({fs:t,cache:e,gitdir:r,oid:F});p.map(R=>R.oid).includes(E.oid)||p.push(E)}p.length===0&&b(_),p.sort((F,E)=>Bj(F.commit,E.commit))}return u}l(Lj,"_log");async function nk({fs:t,dir:e,gitdir:r=C(e,".git"),filepath:i,ref:n="HEAD",depth:s,since:o,force:f,follow:c,cache:a={}}){try{return k("fs",t),k("gitdir",r),k("ref",n),await Lj({fs:new L(t),cache:a,gitdir:r,filepath:i,ref:n,depth:s,since:o,force:f,follow:c})}catch(u){throw u.caller="git.log",u}}l(nk,"log");async function sk({fs:t,onSign:e,dir:r,gitdir:i=C(r,".git"),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,cache:w={},mergeDriver:y,allowUnrelatedHistories:b=!1}){try{k("fs",t),m&&k("onSign",e);let _=new L(t),F=await di({fs:_,gitdir:i,author:d});if(!F&&(!f||!o))throw new Ye("author");let E=await Xs({fs:_,gitdir:i,author:F,committer:p});if(!E&&(!f||!o))throw new Ye("committer");return await P1({fs:_,cache:w,dir:r,gitdir:i,ours:n,theirs:s,fastForward:o,fastForwardOnly:f,dryRun:c,noUpdateBranch:a,abortOnConflict:u,message:h,author:F,committer:E,signingKey:m,onSign:e,mergeDriver:y,allowUnrelatedHistories:b})}catch(_){throw _.caller="git.merge",_}}l(sk,"merge");var jj={commit:16,tree:32,blob:48,tag:64,ofs_delta:96,ref_delta:112};async function ok({fs:t,cache:e,dir:r,gitdir:i=C(r,".git"),oids:n}){let s=new GT,o=[];function f(u,h){let d=Buffer.from(u,h);o.push(d),s.update(d)}l(f,"write");async function c({stype:u,object:h}){let d=jj[u],p=h.length,m=p>15?128:0,w=p&15;p=p>>>4;let y=(m|d|w).toString(16);for(f(y,"hex");m;)m=p>127?128:0,y=m|p&127,f(Pw(2,y),"hex"),p=p>>>7;f(Buffer.from(await s1(h)))}l(c,"writeObject"),f("PACK"),f("00000002","hex"),f(Pw(8,n.length),"hex");for(let u of n){let{type:h,object:d}=await he({fs:t,cache:e,gitdir:i,oid:u});await c({write:f,object:d,stype:h})}let a=s.digest();return o.push(a),o}l(ok,"_pack");async function qj({fs:t,cache:e,gitdir:r,oids:i,write:n}){let s=await ok({fs:t,cache:e,gitdir:r,oids:i}),o=Buffer.from(await Mf(s)),c=`pack-${o.slice(-20).toString("hex")}.pack`;return n?(await t.write(C(r,`objects/pack/${c}`),o),{filename:c}):{filename:c,packfile:new Uint8Array(o)}}l(qj,"_packObjects");async function ak({fs:t,dir:e,gitdir:r=C(e,".git"),oids:i,write:n=!1,cache:s={}}){try{return k("fs",t),k("gitdir",r),k("oids",i),await qj({fs:new L(t),cache:s,gitdir:r,oids:i,write:n})}catch(o){throw o.caller="git.packObjects",o}}l(ak,"packObjects");async function ck({fs:t,http:e,onProgress:r,onMessage:i,onAuth:n,onAuthSuccess:s,onAuthFailure:o,dir:f,gitdir:c=C(f,".git"),ref:a,url:u,remote:h,remoteRef:d,prune:p=!1,pruneTags:m=!1,fastForward:w=!0,fastForwardOnly:y=!1,corsProxy:b,singleBranch:_,headers:F={},author:E,committer:R,signingKey:D,cache:S={}}){try{k("fs",t),k("gitdir",c);let O=new L(t),v=await di({fs:O,gitdir:c,author:E});if(!v)throw new Ye("author");let A=await Xs({fs:O,gitdir:c,author:v,committer:R});if(!A)throw new Ye("committer");return await N1({fs:O,cache:S,http:e,onProgress:r,onMessage:i,onAuth:n,onAuthSuccess:s,onAuthFailure:o,dir:f,gitdir:c,ref:a,url:u,remote:h,remoteRef:d,fastForward:w,fastForwardOnly:y,corsProxy:b,singleBranch:_,headers:F,author:v,committer:A,signingKey:D,prune:p,pruneTags:m})}catch(O){throw O.caller="git.pull",O}}l(ck,"pull");async function Uj({fs:t,cache:e,dir:r,gitdir:i=C(r,".git"),start:n,finish:s}){let o=await Qi.read({fs:t,gitdir:i}),f=new Set,c=new Set;for(let h of n)f.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 a=new Set;async function u(h){a.add(h);let{type:d,object:p}=await he({fs:t,cache:e,gitdir:i,oid:h});if(d==="tag"){let w=Ft.from(p).headers().object;return u(w)}if(d!=="commit")throw new ot(h,d,"commit");if(!o.has(h)){let w=mt.from(p).headers().parent;for(h of w)!c.has(h)&&!a.has(h)&&await u(h)}}l(u,"walk");for(let h of f)await u(h);return a}l(Uj,"listCommitsAndTags");async function gw({fs:t,cache:e,dir:r,gitdir:i=C(r,".git"),oids:n}){let s=new Set;async function o(f){if(s.has(f))return;s.add(f);let{type:c,object:a}=await he({fs:t,cache:e,gitdir:i,oid:f});if(c==="tag"){let h=Ft.from(a).headers().object;await o(h)}else if(c==="commit"){let h=mt.from(a).headers().tree;await o(h)}else if(c==="tree"){let u=pt.from(a);for(let h of u)h.type==="blob"&&s.add(h.oid),h.type==="tree"&&await o(h.oid)}}l(o,"walk");for(let f of n)await o(f);return s}l(gw,"listObjects");async function Wj(t){let e={},r="",i=be.streamReader(t),n=await i();for(;n!==!0;)n!==null&&(r+=n.toString("utf8")+`
91
95
  `),n=await i();let s=r.toString("utf8").split(`
92
- `);if(n=s.shift(),!n.startsWith("unpack "))throw new Ni('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 f=a.slice(0,2),o=a.slice(3),c=o.indexOf(" ");c===-1&&(c=o.length);let u=o.slice(0,c),h=o.slice(c+1);e.refs[u]={ok:f==="ok",error:h}}return e}l(o$,"parseReceivePackResponse");async function c$({capabilities:t=[],triplets:e=[]}){let r=[],i=`\0 ${t.join(" ")}`;for(let n of e)r.push(pe.encode(`${n.oldoid} ${n.oid} ${n.fullRef}${i}
93
- `)),i="";return r.push(pe.flush()),r}l(c$,"writeReceivePackRequest");async function l$({fs:t,cache:e,http:r,onProgress:i,onMessage:n,onAuth:s,onAuthSuccess:a,onAuthFailure:f,onPrePush:o,gitdir:c,ref:u,remoteRef:h,remote:d,url:p,force:m=!1,delete:w=!1,corsProxy:y,headers:g={}}){let _=u||await Xr({fs:t,gitdir:c});if(typeof _>"u")throw new tt("ref");let F=await me.get({fs:t,gitdir:c});d=d||await F.get(`branch.${_}.pushRemote`)||await F.get("remote.pushDefault")||await F.get(`branch.${_}.remote`)||"origin";let R=p||await F.get(`remote.${d}.pushurl`)||await F.get(`remote.${d}.url`);if(typeof R>"u")throw new tt("remote OR url");let k=h||await F.get(`branch.${_}.merge`);if(typeof R>"u")throw new tt("remoteRef");y===void 0&&(y=await F.get("http.corsProxy"));let D=await $.expand({fs:t,gitdir:c,ref:_}),v=w?"0000000000000000000000000000000000000000":await $.resolve({fs:t,gitdir:c,ref:D}),O=gs.getRemoteHelperFor({url:R}),E=await O.discover({http:r,onAuth:s,onAuthSuccess:a,onAuthFailure:f,corsProxy:y,service:"git-receive-pack",url:R,headers:g,protocolVersion:1}),N=E.auth,x;if(!k)x=D;else try{x=await $.expandAgainstMap({ref:k,map:E.refs})}catch(de){if(de instanceof oe)x=k.startsWith("refs/")?k:`refs/heads/${k}`;else throw de}let I=E.refs.get(x)||"0000000000000000000000000000000000000000";if(o&&!await o({remote:d,url:R,localRef:{ref:w?"(delete)":D,oid:v},remoteRef:{ref:x,oid:I}}))throw new ds;let q=!E.capabilities.has("no-thin"),z=new Set;if(!w){let de=[...E.refs.values()],Gt=new Set;if(I!=="0000000000000000000000000000000000000000"){let Le=await am({fs:t,cache:e,gitdir:c,oids:[v,I]});for(let Ys of Le)de.push(Ys);q&&(Gt=await qp({fs:t,cache:e,gitdir:c,oids:Le}))}if(!de.includes(v)){let Le=await a$({fs:t,cache:e,gitdir:c,start:[v],finish:de});z=await qp({fs:t,cache:e,gitdir:c,oids:Le})}if(q){try{let Le=await $.resolve({fs:t,gitdir:c,ref:`refs/remotes/${d}/HEAD`,depth:2}),{oid:Ys}=await $.resolveAgainstMap({ref:Le.replace(`refs/remotes/${d}/`,""),fullref:Le,map:E.refs}),ui=[Ys];for(let Te of await qp({fs:t,cache:e,gitdir:c,oids:ui}))Gt.add(Te)}catch{}for(let Le of Gt)z.delete(Le)}if(v===I&&(m=!0),!m){if(D.startsWith("refs/tags")&&I!=="0000000000000000000000000000000000000000")throw new hs("tag-exists");if(v!=="0000000000000000000000000000000000000000"&&I!=="0000000000000000000000000000000000000000"&&!await mF({fs:t,cache:e,gitdir:c,oid:v,ancestor:I,depth:-1}))throw new hs("not-fast-forward")}}let be=US([...E.capabilities],["report-status","side-band-64k",`agent=${Ef.agent}`]),Vt=await c$({capabilities:be,triplets:[{oldoid:I,oid:v,fullRef:x}]}),yt=w?[]:await xF({fs:t,cache:e,gitdir:c,oids:[...z]}),Dt=await O.connect({http:r,onProgress:i,corsProxy:y,service:"git-receive-pack",url:R,auth:N,headers:g,body:[...Vt,...yt]}),{packfile:Yu,progress:Zu}=await Pl.demux(Dt.body);if(n){let de=WS(Zu);ho(de,async Gt=>{await n(Gt)})}let at=await o$(Yu);if(Dt.headers&&(at.headers=Dt.headers),d&&at.ok&&at.refs[x].ok&&!D.startsWith("refs/tags")){let de=`refs/remotes/${d}/${x.replace("refs/heads","")}`;w?await $.deleteRef({fs:t,gitdir:c,ref:de}):await $.writeRef({fs:t,gitdir:c,ref:de,value:v})}if(at.ok&&Object.values(at.refs).every(de=>de.ok))return at;{let de=Object.entries(at.refs).filter(([Gt,Le])=>!Le.ok).map(([Gt,Le])=>`
94
- - ${Gt}: ${Le.error}`).join("");throw new to(de,at)}}l(l$,"_push");async function NF({fs:t,http:e,onProgress:r,onMessage:i,onAuth:n,onAuthSuccess:s,onAuthFailure:a,onPrePush:f,dir:o,gitdir:c=C.join(o,".git"),ref:u,remoteRef:h,remote:d="origin",url:p,force:m=!1,delete:w=!1,corsProxy:y,headers:g={},cache:_={}}){try{return S("fs",t),S("http",e),S("gitdir",c),await l$({fs:new M(t),cache:_,http:e,onProgress:r,onMessage:i,onAuth:n,onAuthSuccess:s,onAuthFailure:a,onPrePush:f,gitdir:c,ref:u,remoteRef:h,remote:d,url:p,force:m,delete:w,corsProxy:y,headers:g})}catch(F){throw F.caller="git.push",F}}l(NF,"push");async function DF({fs:t,cache:e,gitdir:r,oid:i}){let{type:n,object:s}=await fe({fs:t,cache:e,gitdir:r,oid:i});if(n==="tag")return i=dt.from(s).parse().object,DF({fs:t,cache:e,gitdir:r,oid:i});if(n!=="blob")throw new Ye(i,n,"blob");return{oid:i,blob:new Uint8Array(s)}}l(DF,"resolveBlob");async function CF({fs:t,cache:e,gitdir:r,oid:i,filepath:n=void 0}){return n!==void 0&&(i=await fo({fs:t,cache:e,gitdir:r,oid:i,filepath:n})),await DF({fs:t,cache:e,gitdir:r,oid:i})}l(CF,"_readBlob");async function IF({fs:t,dir:e,gitdir:r=C.join(e,".git"),oid:i,filepath:n,cache:s={}}){try{return S("fs",t),S("gitdir",r),S("oid",i),await CF({fs:new M(t),cache:s,gitdir:r,oid:i,filepath:n})}catch(a){throw a.caller="git.readBlob",a}}l(IF,"readBlob");async function om({fs:t,dir:e,gitdir:r=C.join(e,".git"),oid:i,cache:n={}}){try{return S("fs",t),S("gitdir",r),S("oid",i),await ws({fs:new M(t),cache:n,gitdir:r,oid:i})}catch(s){throw s.caller="git.readCommit",s}}l(om,"readCommit");async function f$({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 CF({fs:t,cache:e,gitdir:r,oid:s,filepath:n});return a}l(f$,"_readNote");async function $F({fs:t,dir:e,gitdir:r=C.join(e,".git"),ref:i="refs/notes/commits",oid:n,cache:s={}}){try{return S("fs",t),S("gitdir",r),S("ref",i),S("oid",n),await f$({fs:new M(t),cache:s,gitdir:r,ref:i,oid:n})}catch(a){throw a.caller="git.readNote",a}}l($F,"readNote");async function BF({fs:t,dir:e,gitdir:r=C.join(e,".git"),oid:i,format:n="parsed",filepath:s=void 0,encoding:a=void 0,cache:f={}}){try{S("fs",t),S("gitdir",r),S("oid",i);let o=new M(t);s!==void 0&&(i=await fo({fs:o,cache:f,gitdir:r,oid:i,filepath:s}));let u=await fe({fs:o,cache:f,gitdir:r,oid:i,format:n==="parsed"?"content":n});if(u.oid=i,n==="parsed")switch(u.format="parsed",u.type){case"commit":u.object=it.from(u.object).parse();break;case"tree":u.object=rt.from(u.object).entries();break;case"blob":a?u.object=u.object.toString(a):(u.object=new Uint8Array(u.object),u.format="content");break;case"tag":u.object=dt.from(u.object).parse();break;default:throw new Ye(u.oid,u.type,"blob|commit|tag|tree")}else(u.format==="deflated"||u.format==="wrapped")&&(u.type=u.format);return u}catch(o){throw o.caller="git.readObject",o}}l(BF,"readObject");async function u$({fs:t,cache:e,gitdir:r,oid:i}){let{type:n,object:s}=await fe({fs:t,cache:e,gitdir:r,oid:i,format:"content"});if(n!=="tag")throw new Ye(i,n,"tag");let a=dt.from(s);return{oid:i,tag:a.parse(),payload:a.payload()}}l(u$,"_readTag");async function MF({fs:t,dir:e,gitdir:r=C.join(e,".git"),oid:i,cache:n={}}){try{return S("fs",t),S("gitdir",r),S("oid",i),await u$({fs:new M(t),cache:n,gitdir:r,oid:i})}catch(s){throw s.caller="git.readTag",s}}l(MF,"readTag");async function jF({fs:t,dir:e,gitdir:r=C.join(e,".git"),oid:i,filepath:n=void 0,cache:s={}}){try{return S("fs",t),S("gitdir",r),S("oid",i),await vs({fs:new M(t),cache:s,gitdir:r,oid:i,filepath:n})}catch(a){throw a.caller="git.readTree",a}}l(jF,"readTree");async function LF({fs:t,dir:e,gitdir:r=C.join(e,".git"),filepath:i,cache:n={}}){try{S("fs",t),S("gitdir",r),S("filepath",i),await ge.acquire({fs:new M(t),gitdir:r,cache:n},async function(s){s.delete({filepath:i})})}catch(s){throw s.caller="git.remove",s}}l(LF,"remove");async function h$({fs:t,cache:e,onSign:r,gitdir:i,ref:n="refs/notes/commits",oid:s,author:a,committer:f,signingKey:o}){let c;try{c=await $.resolve({gitdir:i,fs:t,ref:n})}catch(m){if(!(m instanceof oe))throw m}let h=(await vs({fs:t,gitdir:i,oid:c||"4b825dc642cb6eb9a060e54bf8d69288fbee4904"})).tree;h=h.filter(m=>m.path!==s);let d=await uo({fs:t,gitdir:i,tree:h});return await vf({fs:t,cache:e,onSign:r,gitdir:i,ref:n,tree:d,parent:c&&[c],message:`Note removed by 'isomorphic-git removeNote'
95
- `,author:a,committer:f,signingKey:o})}l(h$,"_removeNote");async function qF({fs:t,onSign:e,dir:r,gitdir:i=C.join(r,".git"),ref:n="refs/notes/commits",oid:s,author:a,committer:f,signingKey:o,cache:c={}}){try{S("fs",t),S("gitdir",i),S("oid",s);let u=new M(t),h=await Jr({fs:u,gitdir:i,author:a});if(!h)throw new ze("author");let d=await ms({fs:u,gitdir:i,author:h,committer:f});if(!d)throw new ze("committer");return await h$({fs:u,cache:c,onSign:e,gitdir:i,ref:n,oid:s,author:h,committer:d,signingKey:o})}catch(u){throw u.caller="git.removeNote",u}}l(qF,"removeNote");async function d$({fs:t,gitdir:e,oldref:r,ref:i,checkout:n=!1}){if(!Va(i,!0))throw new Lt(i,Ha.clean(i));if(!Va(r,!0))throw new Lt(r,Ha.clean(r));let s=`refs/heads/${r}`,a=`refs/heads/${i}`;if(await $.exists({fs:t,gitdir:e,ref:a}))throw new jt("branch",i,!1);let o=await $.resolve({fs:t,gitdir:e,ref:s,depth:1});await $.writeRef({fs:t,gitdir:e,ref:a,value:o}),await $.deleteRef({fs:t,gitdir:e,ref:s});let u=await Xr({fs:t,gitdir:e,fullname:!0})===s;(n||u)&&await $.writeSymbolicRef({fs:t,gitdir:e,ref:"HEAD",value:a})}l(d$,"_renameBranch");async function UF({fs:t,dir:e,gitdir:r=C.join(e,".git"),ref:i,oldref:n,checkout:s=!1}){try{return S("fs",t),S("gitdir",r),S("ref",i),S("oldref",n),await d$({fs:new M(t),gitdir:r,ref:i,oldref:n,checkout:s})}catch(a){throw a.caller="git.renameBranch",a}}l(UF,"renameBranch");async function WF({gitdir:t,type:e,object:r}){return Er(Hr.wrap({type:e,object:r}))}l(WF,"hashObject$1");async function zF({fs:t,dir:e,gitdir:r=C.join(e,".git"),filepath:i,ref:n,cache:s={}}){try{S("fs",t),S("gitdir",r),S("filepath",i);let a=new M(t),f,o;try{f=await $.resolve({fs:a,gitdir:r,ref:n||"HEAD"})}catch(h){if(n)throw h}if(f)try{f=await fo({fs:a,cache:s,gitdir:r,oid:f,filepath:i})}catch{f=null}let c={ctime:new Date(0),mtime:new Date(0),dev:0,ino:0,mode:0,uid:0,gid:0,size:0},u=e&&await a.read(C.join(e,i));u&&(o=await WF({gitdir:r,type:"blob",object:u}),f===o&&(c=await a.lstat(C.join(e,i)))),await ge.acquire({fs:a,gitdir:r,cache:s},async function(h){h.delete({filepath:i}),f&&h.insert({filepath:i,stats:c,oid:f})})}catch(a){throw a.caller="git.reset",a}}l(zF,"resetIndex");async function HF({fs:t,dir:e,gitdir:r=C.join(e,".git"),ref:i,depth:n}){try{return S("fs",t),S("gitdir",r),S("ref",i),await $.resolve({fs:new M(t),gitdir:r,ref:i,depth:n})}catch(s){throw s.caller="git.resolveRef",s}}l(HF,"resolveRef");async function VF({fs:t,dir:e,gitdir:r=C.join(e,".git"),path:i,value:n,append:s=!1}){try{S("fs",t),S("gitdir",r),S("path",i);let a=new M(t),f=await me.get({fs:a,gitdir:r});s?await f.append(i,n):await f.set(i,n),await me.save({fs:a,gitdir:r,config:f})}catch(a){throw a.caller="git.setConfig",a}}l(VF,"setConfig");async function GF({fs:t,gitdir:e,commit:r}){let i=it.from(r).toObject();return await nt({fs:t,gitdir:e,type:"commit",object:i,format:"content"})}l(GF,"_writeCommit");var gf=class gf{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),f=gf.timezoneOffsetForRefLogEntry;return`${s} ${r} ${n} ${e.email} ${a} ${f} ${i}
96
+ `);if(n=s.shift(),!n.startsWith("unpack "))throw new Zi('unpack ok" or "unpack [error message]',n);e.ok=n==="unpack ok",e.ok||(e.error=n.slice(7)),e.refs={};for(let o of s){if(o.trim()==="")continue;let f=o.slice(0,2),c=o.slice(3),a=c.indexOf(" ");a===-1&&(a=c.length);let u=c.slice(0,a),h=c.slice(a+1);e.refs[u]={ok:f==="ok",error:h}}return e}l(Wj,"parseReceivePackResponse");async function zj({capabilities:t=[],triplets:e=[]}){let r=[],i=`\0 ${t.join(" ")}`;for(let n of e)r.push(be.encode(`${n.oldoid} ${n.oid} ${n.fullRef}${i}
97
+ `)),i="";return r.push(be.flush()),r}l(zj,"writeReceivePackRequest");async function Hj({fs:t,cache:e,http:r,onProgress:i,onMessage:n,onAuth:s,onAuthSuccess:o,onAuthFailure:f,onPrePush:c,gitdir:a,ref:u,remoteRef:h,remote:d,url:p,force:m=!1,delete:w=!1,corsProxy:y,headers:b={}}){let _=u||await mi({fs:t,gitdir:a});if(typeof _>"u")throw new dt("ref");let F=await Se.get({fs:t,gitdir:a});d=d||await F.get(`branch.${_}.pushRemote`)||await F.get("remote.pushDefault")||await F.get(`branch.${_}.remote`)||"origin";let E=p||await F.get(`remote.${d}.pushurl`)||await F.get(`remote.${d}.url`);if(typeof E>"u")throw new dt("remote OR url");let R=h||await F.get(`branch.${_}.merge`);if(typeof E>"u")throw new dt("remoteRef");y===void 0&&(y=await F.get("http.corsProxy"));let D=await $.expand({fs:t,gitdir:a,ref:_}),S=w?"0000000000000000000000000000000000000000":await $.resolve({fs:t,gitdir:a,ref:D}),O=Qs.getRemoteHelperFor({url:E}),v=await O.discover({http:r,onAuth:s,onAuthSuccess:o,onAuthFailure:f,corsProxy:y,service:"git-receive-pack",url:E,headers:b,protocolVersion:1}),A=v.auth,x;if(!R)x=D;else try{x=await $.expandAgainstMap({ref:R,map:v.refs})}catch(ge){if(ge instanceof le)x=R.startsWith("refs/")?R:`refs/heads/${R}`;else throw ge}let I=v.refs.get(x)||"0000000000000000000000000000000000000000";if(c&&!await c({remote:d,url:E,localRef:{ref:w?"(delete)":D,oid:S},remoteRef:{ref:x,oid:I}}))throw new Js;let M=!v.capabilities.has("no-thin"),H=new Set;if(!w){let ge=[...v.refs.values()],sr=new Set;if(I!=="0000000000000000000000000000000000000000"){let Ge=await Bw({fs:t,cache:e,gitdir:a,oids:[S,I]});for(let Ho of Ge)ge.push(Ho);M&&(sr=await gw({fs:t,cache:e,gitdir:a,oids:Ge}))}if(!ge.includes(S)){let Ge=await Uj({fs:t,cache:e,gitdir:a,start:[S],finish:ge});H=await gw({fs:t,cache:e,gitdir:a,oids:Ge})}if(M){try{let Ge=await $.resolve({fs:t,gitdir:a,ref:`refs/remotes/${d}/HEAD`,depth:2}),{oid:Ho}=await $.resolveAgainstMap({ref:Ge.replace(`refs/remotes/${d}/`,""),fullref:Ge,map:v.refs}),Ai=[Ho];for(let Pe of await gw({fs:t,cache:e,gitdir:a,oids:Ai}))sr.add(Pe)}catch{}for(let Ge of sr)H.delete(Ge)}if(S===I&&(m=!0),!m){if(D.startsWith("refs/tags")&&I!=="0000000000000000000000000000000000000000")throw new Gs("tag-exists");if(S!=="0000000000000000000000000000000000000000"&&I!=="0000000000000000000000000000000000000000"&&!await V1({fs:t,cache:e,gitdir:a,oid:S,ancestor:I,depth:-1}))throw new Gs("not-fast-forward")}}let Te=b1([...v.capabilities],["report-status","side-band-64k",`agent=${xu.agent}`]),ft=await zj({capabilities:Te,triplets:[{oldoid:I,oid:S,fullRef:x}]}),zt=w?[]:await ok({fs:t,cache:e,gitdir:a,oids:[...H]}),Ht=await O.connect({http:r,onProgress:i,corsProxy:y,service:"git-receive-pack",url:E,auth:A,headers:b,body:[...ft,...zt]}),{packfile:Fd,progress:Td}=await Lf.demux(Ht.body);if(n){let ge=_1(Td);oc(ge,async sr=>{await n(sr)})}let yt=await Wj(Fd);if(Ht.headers&&(yt.headers=Ht.headers),d&&yt.ok&&yt.refs[x].ok&&!D.startsWith("refs/tags")){let ge=`refs/remotes/${d}/${x.replace("refs/heads","")}`;w?await $.deleteRef({fs:t,gitdir:a,ref:ge}):await $.writeRef({fs:t,gitdir:a,ref:ge,value:S})}if(yt.ok&&Object.values(yt.refs).every(ge=>ge.ok))return yt;{let ge=Object.entries(yt.refs).filter(([sr,Ge])=>!Ge.ok).map(([sr,Ge])=>`
98
+ - ${sr}: ${Ge.error}`).join("");throw new Ja(ge,yt)}}l(Hj,"_push");async function lk({fs:t,http:e,onProgress:r,onMessage:i,onAuth:n,onAuthSuccess:s,onAuthFailure:o,onPrePush:f,dir:c,gitdir:a=C(c,".git"),ref:u,remoteRef:h,remote:d="origin",url:p,force:m=!1,delete:w=!1,corsProxy:y,headers:b={},cache:_={}}){try{return k("fs",t),k("http",e),k("gitdir",a),await Hj({fs:new L(t),cache:_,http:e,onProgress:r,onMessage:i,onAuth:n,onAuthSuccess:s,onAuthFailure:o,onPrePush:f,gitdir:a,ref:u,remoteRef:h,remote:d,url:p,force:m,delete:w,corsProxy:y,headers:b})}catch(F){throw F.caller="git.push",F}}l(lk,"push");async function fk({fs:t,cache:e,gitdir:r,oid:i}){let{type:n,object:s}=await he({fs:t,cache:e,gitdir:r,oid:i});if(n==="tag")return i=Ft.from(s).parse().object,fk({fs:t,cache:e,gitdir:r,oid:i});if(n!=="blob")throw new ot(i,n,"blob");return{oid:i,blob:new Uint8Array(s)}}l(fk,"resolveBlob");async function uk({fs:t,cache:e,gitdir:r,oid:i,filepath:n=void 0}){return n!==void 0&&(i=await nc({fs:t,cache:e,gitdir:r,oid:i,filepath:n})),await fk({fs:t,cache:e,gitdir:r,oid:i})}l(uk,"_readBlob");async function hk({fs:t,dir:e,gitdir:r=C(e,".git"),oid:i,filepath:n,cache:s={}}){try{return k("fs",t),k("gitdir",r),k("oid",i),await uk({fs:new L(t),cache:s,gitdir:r,oid:i,filepath:n})}catch(o){throw o.caller="git.readBlob",o}}l(hk,"readBlob");async function Mw({fs:t,dir:e,gitdir:r=C(e,".git"),oid:i,cache:n={}}){try{return k("fs",t),k("gitdir",r),k("oid",i),await Ys({fs:new L(t),cache:n,gitdir:r,oid:i})}catch(s){throw s.caller="git.readCommit",s}}l(Mw,"readCommit");async function Vj({fs:t,cache:e,gitdir:r,ref:i="refs/notes/commits",oid:n}){let s=await $.resolve({gitdir:r,fs:t,ref:i}),{blob:o}=await uk({fs:t,cache:e,gitdir:r,oid:s,filepath:n});return o}l(Vj,"_readNote");async function dk({fs:t,dir:e,gitdir:r=C(e,".git"),ref:i="refs/notes/commits",oid:n,cache:s={}}){try{return k("fs",t),k("gitdir",r),k("ref",i),k("oid",n),await Vj({fs:new L(t),cache:s,gitdir:r,ref:i,oid:n})}catch(o){throw o.caller="git.readNote",o}}l(dk,"readNote");async function pk({fs:t,dir:e,gitdir:r=C(e,".git"),oid:i,format:n="parsed",filepath:s=void 0,encoding:o=void 0,cache:f={}}){try{k("fs",t),k("gitdir",r),k("oid",i);let c=new L(t);s!==void 0&&(i=await nc({fs:c,cache:f,gitdir:r,oid:i,filepath:s}));let u=await he({fs:c,cache:f,gitdir:r,oid:i,format:n==="parsed"?"content":n});if(u.oid=i,n==="parsed")switch(u.format="parsed",u.type){case"commit":u.object=mt.from(u.object).parse();break;case"tree":u.object=pt.from(u.object).entries();break;case"blob":o?u.object=u.object.toString(o):(u.object=new Uint8Array(u.object),u.format="content");break;case"tag":u.object=Ft.from(u.object).parse();break;default:throw new ot(u.oid,u.type,"blob|commit|tag|tree")}else(u.format==="deflated"||u.format==="wrapped")&&(u.type=u.format);return u}catch(c){throw c.caller="git.readObject",c}}l(pk,"readObject");async function Gj({fs:t,cache:e,gitdir:r,oid:i}){let{type:n,object:s}=await he({fs:t,cache:e,gitdir:r,oid:i,format:"content"});if(n!=="tag")throw new ot(i,n,"tag");let o=Ft.from(s);return{oid:i,tag:o.parse(),payload:o.payload()}}l(Gj,"_readTag");async function mk({fs:t,dir:e,gitdir:r=C(e,".git"),oid:i,cache:n={}}){try{return k("fs",t),k("gitdir",r),k("oid",i),await Gj({fs:new L(t),cache:n,gitdir:r,oid:i})}catch(s){throw s.caller="git.readTag",s}}l(mk,"readTag");async function wk({fs:t,dir:e,gitdir:r=C(e,".git"),oid:i,filepath:n=void 0,cache:s={}}){try{return k("fs",t),k("gitdir",r),k("oid",i),await ro({fs:new L(t),cache:s,gitdir:r,oid:i,filepath:n})}catch(o){throw o.caller="git.readTree",o}}l(wk,"readTree");async function yk({fs:t,dir:e,gitdir:r=C(e,".git"),filepath:i,cache:n={}}){try{k("fs",t),k("gitdir",r),k("filepath",i),await Ee.acquire({fs:new L(t),gitdir:r,cache:n},async function(s){s.delete({filepath:i})})}catch(s){throw s.caller="git.remove",s}}l(yk,"remove");async function Jj({fs:t,cache:e,onSign:r,gitdir:i,ref:n="refs/notes/commits",oid:s,author:o,committer:f,signingKey:c}){let a;try{a=await $.resolve({gitdir:i,fs:t,ref:n})}catch(m){if(!(m instanceof le))throw m}let h=(await ro({fs:t,cache:e,gitdir:i,oid:a||"4b825dc642cb6eb9a060e54bf8d69288fbee4904"})).tree;h=h.filter(m=>m.path!==s);let d=await sc({fs:t,gitdir:i,tree:h});return await Ou({fs:t,cache:e,onSign:r,gitdir:i,ref:n,tree:d,parent:a&&[a],message:`Note removed by 'isomorphic-git removeNote'
99
+ `,author:o,committer:f,signingKey:c})}l(Jj,"_removeNote");async function gk({fs:t,onSign:e,dir:r,gitdir:i=C(r,".git"),ref:n="refs/notes/commits",oid:s,author:o,committer:f,signingKey:c,cache:a={}}){try{k("fs",t),k("gitdir",i),k("oid",s);let u=new L(t),h=await di({fs:u,gitdir:i,author:o});if(!h)throw new Ye("author");let d=await Xs({fs:u,gitdir:i,author:h,committer:f});if(!d)throw new Ye("committer");return await Jj({fs:u,cache:a,onSign:e,gitdir:i,ref:n,oid:s,author:h,committer:d,signingKey:c})}catch(u){throw u.caller="git.removeNote",u}}l(gk,"removeNote");async function Kj({fs:t,gitdir:e,oldref:r,ref:i,checkout:n=!1}){if(!ic(i,!0))throw new Zt(i,La.clean(i));if(!ic(r,!0))throw new Zt(r,La.clean(r));let s=`refs/heads/${r}`,o=`refs/heads/${i}`;if(await $.exists({fs:t,gitdir:e,ref:o}))throw new Yt("branch",i,!1);let c=await $.resolve({fs:t,gitdir:e,ref:s,depth:1});await $.writeRef({fs:t,gitdir:e,ref:o,value:c}),await $.deleteRef({fs:t,gitdir:e,ref:s});let u=await mi({fs:t,gitdir:e,fullname:!0})===s;(n||u)&&await $.writeSymbolicRef({fs:t,gitdir:e,ref:"HEAD",value:o})}l(Kj,"_renameBranch");async function bk({fs:t,dir:e,gitdir:r=C(e,".git"),ref:i,oldref:n,checkout:s=!1}){try{return k("fs",t),k("gitdir",r),k("ref",i),k("oldref",n),await Kj({fs:new L(t),gitdir:r,ref:i,oldref:n,checkout:s})}catch(o){throw o.caller="git.renameBranch",o}}l(bk,"renameBranch");async function _k({gitdir:t,type:e,object:r}){return Mr(li.wrap({type:e,object:r}))}l(_k,"hashObject$1");async function Sk({fs:t,dir:e,gitdir:r=C(e,".git"),filepath:i,ref:n,cache:s={}}){try{k("fs",t),k("gitdir",r),k("filepath",i);let o=new L(t),f,c;try{f=await $.resolve({fs:o,gitdir:r,ref:n||"HEAD"})}catch(h){if(n)throw h}if(f)try{f=await nc({fs:o,cache:s,gitdir:r,oid:f,filepath:i})}catch{f=null}let a={ctime:new Date(0),mtime:new Date(0),dev:0,ino:0,mode:0,uid:0,gid:0,size:0},u=e&&await o.read(C(e,i));u&&(c=await _k({gitdir:r,type:"blob",object:u}),f===c&&(a=await o.lstat(C(e,i)))),await Ee.acquire({fs:o,gitdir:r,cache:s},async function(h){h.delete({filepath:i}),f&&h.insert({filepath:i,stats:a,oid:f})})}catch(o){throw o.caller="git.reset",o}}l(Sk,"resetIndex");async function vk({fs:t,dir:e,gitdir:r=C(e,".git"),ref:i,depth:n}){try{return k("fs",t),k("gitdir",r),k("ref",i),await $.resolve({fs:new L(t),gitdir:r,ref:i,depth:n})}catch(s){throw s.caller="git.resolveRef",s}}l(vk,"resolveRef");async function Ek({fs:t,dir:e,gitdir:r=C(e,".git"),path:i,value:n,append:s=!1}){try{k("fs",t),k("gitdir",r),k("path",i);let o=new L(t),f=await Se.get({fs:o,gitdir:r});s?await f.append(i,n):await f.set(i,n),await Se.save({fs:o,gitdir:r,config:f})}catch(o){throw o.caller="git.setConfig",o}}l(Ek,"setConfig");async function Fk({fs:t,gitdir:e,commit:r}){let i=mt.from(r).toObject();return await wt({fs:t,gitdir:e,type:"commit",object:i,format:"content"})}l(Fk,"_writeCommit");var Tu=class Tu{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",o=Math.floor(Date.now()/1e3),f=Tu.timezoneOffsetForRefLogEntry;return`${s} ${r} ${n} ${e.email} ${o} ${f} ${i}
96
100
  `}static getStashReflogEntry(e,r=!1){return e.split(`
97
- `).filter(s=>s).reverse().map((s,a)=>r?`stash@{${a}}: ${s.split(" ")[1]}`:s)}};l(gf,"GitRefStash");var Nl=gf,p$={stage:Ii,workdir:_s},Up;async function bs(t,e){return Up===void 0&&(Up=new za),Up.acquire(t,e)}l(bs,"acquireLock$1");async function m$(t,e,r,i,n=null){let s=C.join(r,i),a=await t.lstat(s);if(!a)throw new oe(s);if(a.isDirectory())throw new W(`${s}: file expected, but found directory`);let f=n?await ES({fs:t,gitdir:e,oid:n}):void 0,o=f?n:void 0;return f||await bs({fs:t,gitdir:e,currentFilepath:s},async()=>{let c=a.isSymbolicLink()?await t.readlink(s).then(xS):await t.read(s);if(c===null)throw new oe(s);o=await nt({fs:t,gitdir:e,type:"blob",object:c})}),o}l(m$,"checkAndWriteBlob");async function w$({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 uo({fs:t,gitdir:r,tree:a}),s.mode=16384}}else s.type==="blob"&&(s.oid=await m$(t,r,e,s.path,s.oid),s.mode=33188);return s.path=s.path.split("/").pop(),s}return l(n,"processTreeEntry"),Promise.all(i.map(n))}l(w$,"processTreeEntries");async function mS({fs:t,dir:e,gitdir:r,treePair:i}){let n=i[1]==="stage",s=i.map(p=>typeof p=="string"?p$[p]():p),a=[],u=await Gr({fs:t,cache:{},dir:e,gitdir:r,trees:s,map:l(async(p,[m,w])=>{if(!(p==="."||await Kr.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:l(async(p,m)=>(m=m.filter(Boolean),p?(p.children=m,p):m.length>0?m:void 0),"reduce"),iterate:l(async(p,m)=>{let w=[];for(let y of m){let[g,_]=y;n?_&&(await t.exists(`${e}/${_.toString()}`)?w.push(y):a.push([null,_])):g&&(_?w.push(y):a.push([g,null]))}return w.length?Promise.all(w.map(p)):[]},"iterate")});if(a.length===0||u.length===0)return null;let d=(await w$({fs:t,dir:e,gitdir:r,entries:u})).filter(Boolean).map(p=>({mode:p.mode,path:p.path,oid:p.oid,type:p.type}));return uo({fs:t,gitdir:r,tree:d})}l(mS,"writeTreeChanges");async function y$({fs:t,dir:e,gitdir:r,stashCommit:i,parentCommit:n,wasStaged:s}){let a=[],f=[],o=await Gr({fs:t,cache:{},dir:e,gitdir:r,trees:[ht({ref:n}),ht({ref:i})],map:l(async(c,[u,h])=>{if(c==="."||await Kr.isIgnored({fs:t,dir:e,gitdir:r,filepath:c}))return;let d=h?await h.type():await u.type();if(d!=="tree"&&d!=="blob")return;if(!h&&u){let m=d==="tree"?"rmdir":"rm";return d==="tree"&&a.push(c),d==="blob"&&s&&f.push({filepath:c,oid:await u.oid()}),{method:m,filepath:c}}let p=await h.oid();if(!u||await u.oid()!==p)return d==="tree"?{method:"mkdir",filepath:c}:(s&&f.push({filepath:c,oid:p,stats:await t.lstat(C.join(e,c))}),{method:"write",filepath:c,oid:p})},"map")});await bs({fs:t,gitdir:r,dirRemoved:a,ops:o},async()=>{for(let c of o){let u=C.join(e,c.filepath);switch(c.method){case"rmdir":await t.rmdir(u);break;case"mkdir":await t.mkdir(u);break;case"rm":await t.rm(u);break;case"write":if(!a.some(h=>u.startsWith(h))){let{object:h}=await fe({fs:t,cache:{},gitdir:r,oid:c.oid});await t.exists(u)&&await t.rm(u),await t.write(u,h)}break}}}),await ge.acquire({fs:t,gitdir:r,cache:{}},async c=>{f.forEach(({filepath:u,stats:h,oid:d})=>{c.insert({filepath:u,stats:h,oid:d})})})}l(y$,"applyTreeChanges");var ns=class ns{constructor({fs:e,dir:r,gitdir:i=C.join(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.join(this.gitdir,ns.refStash)}get refLogsStashPath(){return C.join(this.gitdir,ns.refLogsStash)}async getAuthor(){if(!this._author&&(this._author=await Jr({fs:this.fs,gitdir:this.gitdir,author:{}}),!this._author))throw new ze("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 GF({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 Lt(`stash@${e}`,"number that is in range of [0, num of stash pushed]");let i=await this.getStashSHA(e,r);return i?ws({fs:this.fs,cache:{},gitdir:this.gitdir,oid:i}):{}}async writeStashRef(e){return $.writeRef({fs:this.fs,gitdir:this.gitdir,ref:ns.refStash,value:e})}async writeStashReflogEntry({stashCommit:e,message:r}){let i=await this.getAuthor(),n=Nl.createStashReflogEntry(i,e,r),s=this.refLogsStashPath;await bs({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 Nl.getStashReflogEntry(r,e)}};l(ns,"GitStashManager");var Ci=ns;async function KF({fs:t,dir:e,gitdir:r,message:i=""}){let n=new Ci({fs:t,dir:e,gitdir:r});await n.getAuthor();let s=await Xr({fs:t,gitdir:r,fullname:!1}),a=await $.resolve({fs:t,gitdir:r,ref:"HEAD"}),o=(await om({fs:t,dir:e,gitdir:r,oid:a})).commit.message,c=[a],u=null,h=ht({ref:"HEAD"}),d=await mS({fs:t,dir:e,gitdir:r,treePair:[ht({ref:"HEAD"}),"stage"]});if(d){let y=await n.writeStashCommit({message:`stash-Index: WIP on ${s} - ${new Date().toISOString()}`,tree:d,parent:c});c.push(y),u=d,h=Ii()}let p=await mS({fs:t,dir:e,gitdir:r,treePair:[h,"workdir"]});if(p){let y=await n.writeStashCommit({message:`stash-WorkDir: WIP on ${s} - ${new Date().toISOString()}`,tree:p,parent:[c[c.length-1]]});c.push(y),u=p}if(!u||!d&&!p)throw new oe("changes, nothing to stash");let m=(i.trim()||`WIP on ${s}`)+`: ${a.substring(0,7)} ${o}`;return{stashCommit:await n.writeStashCommit({message:m,tree:u,parent:c}),stashMsg:m,branch:s,stashMgr:n}}l(KF,"_createStashCommit");async function g$({fs:t,dir:e,gitdir:r,message:i=""}){let{stashCommit:n,stashMsg:s,branch:a,stashMgr:f}=await KF({fs:t,dir:e,gitdir:r,message:i});return await f.writeStashRef(n),await f.writeStashReflogEntry({stashCommit:n,message:s}),await nm({fs:t,dir:e,gitdir:r,ref:a,track:!1,force:!0}),n}l(g$,"_stashPush");async function b$({fs:t,dir:e,gitdir:r,message:i=""}){let{stashCommit:n}=await KF({fs:t,dir:e,gitdir:r,message:i});return n}l(b$,"_stashCreate");async function JF({fs:t,dir:e,gitdir:r,refIdx:i=0}){let s=await new Ci({fs:t,dir:e,gitdir:r}).readStashCommit(i),{parent:a=null}=s.commit?s.commit:{};if(!(!a||!Array.isArray(a)))for(let f=0;f<a.length-1;f++){let c=(await ws({fs:t,cache:{},gitdir:r,oid:a[f+1]})).commit.message.startsWith("stash-Index");await y$({fs:t,dir:e,gitdir:r,stashCommit:a[f+1],parentCommit:a[f],wasStaged:c})}}l(JF,"_stashApply");async function XF({fs:t,dir:e,gitdir:r,refIdx:i=0}){let n=new Ci({fs:t,dir:e,gitdir:r});if(!(await n.readStashCommit(i)).commit)return;let a=n.refStashPath;await bs(a,async()=>{await t.exists(a)&&await t.rm(a)});let f=await n.readStashReflogs({parsed:!1});if(!f.length)return;f.splice(i,1);let o=n.refLogsStashPath;await bs({reflogEntries:f,stashReflogPath:o,stashMgr:n},async()=>{if(f.length){await t.write(o,f.reverse().join(`
101
+ `).filter(s=>s).reverse().map((s,o)=>r?`stash@{${o}}: ${s.split(" ")[1]}`:s)}};l(Tu,"GitRefStash");var jf=Tu,Xj={stage:tn,workdir:to},bw;async function eo(t,e){return bw===void 0&&(bw=new Ma),bw.acquire(t,e)}l(eo,"acquireLock$1");async function Yj(t,e,r,i,n=null){let s=C(r,i),o=await t.lstat(s);if(!o)throw new le(s);if(o.isDirectory())throw new z(`${s}: file expected, but found directory`);let f=n?await QT({fs:t,gitdir:e,oid:n}):void 0,c=f?n:void 0;return f||await eo({fs:t,gitdir:e,currentFilepath:s},async()=>{let a=o.isSymbolicLink()?await t.readlink(s).then(o1):await t.read(s);if(a===null)throw new le(s);c=await wt({fs:t,gitdir:e,type:"blob",object:a})}),c}l(Yj,"checkAndWriteBlob");async function Zj({fs:t,dir:e,gitdir:r,entries:i}){async function n(s){if(s.type==="tree"){if(!s.oid){let o=await Promise.all(s.children.map(n));s.oid=await sc({fs:t,gitdir:r,tree:o}),s.mode=16384}}else s.type==="blob"&&(s.oid=await Yj(t,r,e,s.path,s.oid),s.mode=33188);return s.path=s.path.split("/").pop(),s}return l(n,"processTreeEntry"),Promise.all(i.map(n))}l(Zj,"processTreeEntries");async function VT({fs:t,dir:e,gitdir:r,treePair:i}){let n=i[1]==="stage",s=i.map(p=>typeof p=="string"?Xj[p]():p),o=[],u=await ui({fs:t,cache:{},dir:e,gitdir:r,trees:s,map:l(async(p,[m,w])=>{if(!(p==="."||await hi.isIgnored({fs:t,dir:e,gitdir:r,filepath:p}))&&w)return(!m||await m.oid()!==await w.oid()&&await w.oid()!==void 0)&&o.push([m,w]),{mode:await w.mode(),path:p,oid:await w.oid(),type:await w.type()}},"map"),reduce:l(async(p,m)=>(m=m.filter(Boolean),p?(p.children=m,p):m.length>0?m:void 0),"reduce"),iterate:l(async(p,m)=>{let w=[];for(let y of m){let[b,_]=y;n?_&&(await t.exists(`${e}/${_.toString()}`)?w.push(y):o.push([null,_])):b&&(_?w.push(y):o.push([b,null]))}return w.length?Promise.all(w.map(p)):[]},"iterate")});if(o.length===0||u.length===0)return null;let d=(await Zj({fs:t,dir:e,gitdir:r,entries:u})).filter(Boolean).map(p=>({mode:p.mode,path:p.path,oid:p.oid,type:p.type}));return sc({fs:t,gitdir:r,tree:d})}l(VT,"writeTreeChanges");async function Qj({fs:t,dir:e,gitdir:r,stashCommit:i,parentCommit:n,wasStaged:s}){let o=[],f=[],c=await ui({fs:t,cache:{},dir:e,gitdir:r,trees:[Et({ref:n}),Et({ref:i})],map:l(async(a,[u,h])=>{if(a==="."||await hi.isIgnored({fs:t,dir:e,gitdir:r,filepath:a}))return;let d=h?await h.type():await u.type();if(d!=="tree"&&d!=="blob")return;if(!h&&u){let m=d==="tree"?"rmdir":"rm";return d==="tree"&&o.push(a),d==="blob"&&s&&f.push({filepath:a,oid:await u.oid()}),{method:m,filepath:a}}let p=await h.oid();if(!u||await u.oid()!==p)return d==="tree"?{method:"mkdir",filepath:a}:(s&&f.push({filepath:a,oid:p,stats:await t.lstat(C(e,a))}),{method:"write",filepath:a,oid:p})},"map")});await eo({fs:t,gitdir:r,dirRemoved:o,ops:c},async()=>{for(let a of c){let u=C(e,a.filepath);switch(a.method){case"rmdir":await t.rmdir(u);break;case"mkdir":await t.mkdir(u);break;case"rm":await t.rm(u);break;case"write":if(!o.some(h=>u.startsWith(h))){let{object:h}=await he({fs:t,cache:{},gitdir:r,oid:a.oid});await t.exists(u)&&await t.rm(u),await t.write(u,h)}break}}}),await Ee.acquire({fs:t,gitdir:r,cache:{}},async a=>{f.forEach(({filepath:u,stats:h,oid:d})=>{a.insert({filepath:u,stats:h,oid:d})})})}l(Qj,"applyTreeChanges");var Ls=class Ls{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,Ls.refStash)}get refLogsStashPath(){return C(this.gitdir,Ls.refLogsStash)}async getAuthor(){if(!this._author&&(this._author=await di({fs:this.fs,gitdir:this.gitdir,author:{}}),!this._author))throw new Ye("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 Fk({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 Zt(`stash@${e}`,"number that is in range of [0, num of stash pushed]");let i=await this.getStashSHA(e,r);return i?Ys({fs:this.fs,cache:{},gitdir:this.gitdir,oid:i}):{}}async writeStashRef(e){return $.writeRef({fs:this.fs,gitdir:this.gitdir,ref:Ls.refStash,value:e})}async writeStashReflogEntry({stashCommit:e,message:r}){let i=await this.getAuthor(),n=jf.createStashReflogEntry(i,e,r),s=this.refLogsStashPath;await eo({filepath:s,entry:n},async()=>{let o=await this.fs.exists(s)?await this.fs.read(s,"utf8"):"";await this.fs.write(s,o+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 jf.getStashReflogEntry(r,e)}};l(Ls,"GitStashManager");var en=Ls;async function Tk({fs:t,dir:e,gitdir:r,message:i=""}){let n=new en({fs:t,dir:e,gitdir:r});await n.getAuthor();let s=await mi({fs:t,gitdir:r,fullname:!1}),o=await $.resolve({fs:t,gitdir:r,ref:"HEAD"}),c=(await Mw({fs:t,dir:e,gitdir:r,oid:o})).commit.message,a=[o],u=null,h=Et({ref:"HEAD"}),d=await VT({fs:t,dir:e,gitdir:r,treePair:[Et({ref:"HEAD"}),"stage"]});if(d){let y=await n.writeStashCommit({message:`stash-Index: WIP on ${s} - ${new Date().toISOString()}`,tree:d,parent:a});a.push(y),u=d,h=tn()}let p=await VT({fs:t,dir:e,gitdir:r,treePair:[h,"workdir"]});if(p){let y=await n.writeStashCommit({message:`stash-WorkDir: WIP on ${s} - ${new Date().toISOString()}`,tree:p,parent:[a[a.length-1]]});a.push(y),u=p}if(!u||!d&&!p)throw new le("changes, nothing to stash");let m=(i.trim()||`WIP on ${s}`)+`: ${o.substring(0,7)} ${c}`;return{stashCommit:await n.writeStashCommit({message:m,tree:u,parent:a}),stashMsg:m,branch:s,stashMgr:n}}l(Tk,"_createStashCommit");async function eq({fs:t,dir:e,gitdir:r,message:i=""}){let{stashCommit:n,stashMsg:s,branch:o,stashMgr:f}=await Tk({fs:t,dir:e,gitdir:r,message:i});return await f.writeStashRef(n),await f.writeStashReflogEntry({stashCommit:n,message:s}),await Iw({fs:t,dir:e,gitdir:r,ref:o,track:!1,force:!0}),n}l(eq,"_stashPush");async function tq({fs:t,dir:e,gitdir:r,message:i=""}){let{stashCommit:n}=await Tk({fs:t,dir:e,gitdir:r,message:i});return n}l(tq,"_stashCreate");async function kk({fs:t,dir:e,gitdir:r,refIdx:i=0}){let s=await new en({fs:t,dir:e,gitdir:r}).readStashCommit(i),{parent:o=null}=s.commit?s.commit:{};if(!(!o||!Array.isArray(o)))for(let f=0;f<o.length-1;f++){let a=(await Ys({fs:t,cache:{},gitdir:r,oid:o[f+1]})).commit.message.startsWith("stash-Index");await Qj({fs:t,dir:e,gitdir:r,stashCommit:o[f+1],parentCommit:o[f],wasStaged:a})}}l(kk,"_stashApply");async function Rk({fs:t,dir:e,gitdir:r,refIdx:i=0}){let n=new en({fs:t,dir:e,gitdir:r});if(!(await n.readStashCommit(i)).commit)return;let o=n.refStashPath;await eo(o,async()=>{await t.exists(o)&&await t.rm(o)});let f=await n.readStashReflogs({parsed:!1});if(!f.length)return;f.splice(i,1);let c=n.refLogsStashPath;await eo({reflogEntries:f,stashReflogPath:c,stashMgr:n},async()=>{if(f.length){await t.write(c,f.reverse().join(`
98
102
  `)+`
99
- `,"utf8");let c=f[f.length-1].split(" ")[1];await n.writeStashRef(c)}else await t.rm(o)})}l(XF,"_stashDrop");async function _$({fs:t,dir:e,gitdir:r}){return new Ci({fs:t,dir:e,gitdir:r}).readStashReflogs({parsed:!0})}l(_$,"_stashList");async function v$({fs:t,dir:e,gitdir:r}){let i=new Ci({fs:t,dir:e,gitdir:r}),n=[i.refStashPath,i.refLogsStashPath];await bs(n,async()=>{await Promise.all(n.map(async s=>{if(await t.exists(s))return t.rm(s)}))})}l(v$,"_stashClear");async function E$({fs:t,dir:e,gitdir:r,refIdx:i=0}){await JF({fs:t,dir:e,gitdir:r,refIdx:i}),await XF({fs:t,dir:e,gitdir:r,refIdx:i})}l(E$,"_stashPop");async function YF({fs:t,dir:e,gitdir:r=C.join(e,".git"),op:i="push",message:n="",refIdx:s=0}){S("fs",t),S("dir",e),S("gitdir",r),S("op",i);let a={push:g$,apply:JF,drop:XF,list:_$,clear:v$,pop:E$,create:b$},f=["apply","drop","pop"];try{let o=new M(t);["refs","logs","logs/refs"].map(h=>C.join(r,h)).forEach(async h=>{await o.exists(h)||await o.mkdir(h)});let u=a[i];if(u){if(f.includes(i)&&s<0)throw new Lt(`stash@${s}`,"number that is in range of [0, num of stash pushed]");return await u({fs:o,dir:e,gitdir:r,message:n,refIdx:s})}throw new Error(`To be implemented: ${i}`)}catch(o){throw o.caller="git.stash",o}}l(YF,"stash");async function ZF({fs:t,dir:e,gitdir:r=C.join(e,".git"),filepath:i,cache:n={}}){try{S("fs",t),S("gitdir",r),S("filepath",i);let s=new M(t);if(await Kr.isIgnored({fs:s,gitdir:r,dir:e,filepath:i}))return"ignored";let f=await S$({fs:s,cache:n,gitdir:r}),o=await QF({fs:s,cache:n,gitdir:r,tree:f,path:i}),c=await ge.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(C.join(e,i)),h=o!==null,d=c!==null,p=u!==null,m=l(async()=>{if(d&&!Sl(c,u))return c.oid;{let w=await s.read(C.join(e,i)),y=await WF({gitdir:r,type:"blob",object:w});return d&&c.oid===y&&u.size!==-1&&ge.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()===c.oid?"added":"*added";if(h&&!p&&!d)return"deleted";if(h&&!p&&d)return o===c.oid,"*deleted";if(h&&p&&!d)return await m()===o?"*undeleted":"*undeletemodified";if(h&&p&&d){let w=await m();return w===o?w===c.oid?"unmodified":"*unmodified":w===c.oid?"modified":"*modified"}}catch(s){throw s.caller="git.status",s}}l(ZF,"status");async function QF({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:f,object:o}=await fe({fs:t,cache:e,gitdir:r,oid:a.oid});if(f==="tree"){let c=rt.from(o);return QF({fs:t,cache:e,gitdir:r,tree:c,path:n})}if(f==="blob")throw new Ye(a.oid,f,"blob",n.join("/"))}return null}l(QF,"getOidAtPath");async function S$({fs:t,cache:e,gitdir:r}){let i;try{i=await $.resolve({fs:t,gitdir:r,ref:"HEAD"})}catch(s){if(s instanceof oe)return[]}let{tree:n}=await vs({fs:t,cache:e,gitdir:r,oid:i});return n}l(S$,"getHeadTree");async function e1({fs:t,dir:e,gitdir:r=C.join(e,".git"),ref:i="HEAD",filepaths:n=["."],filter:s,cache:a={},ignored:f=!1}){try{S("fs",t),S("gitdir",r),S("ref",i);let o=new M(t);return await Gr({fs:o,cache:a,dir:e,gitdir:r,trees:[ht({ref:i}),_s(),Ii()],map:l(async function(c,[u,h,d]){if(!u&&!d&&h&&!f&&await Kr.isIgnored({fs:o,dir:e,filepath:c})||!n.some(D=>LS(c,D)))return null;if(s&&!s(c))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 R=[void 0,g,F,_],k=R.map(D=>R.indexOf(D));return k.shift(),[c,...k]},"map")})}catch(o){throw o.caller="git.statusMatrix",o}}l(e1,"statusMatrix");async function t1({fs:t,dir:e,gitdir:r=C.join(e,".git"),ref:i,object:n,force:s=!1}){try{S("fs",t),S("gitdir",r),S("ref",i);let a=new M(t);if(i===void 0)throw new tt("ref");i=i.startsWith("refs/tags/")?i:`refs/tags/${i}`;let f=await $.resolve({fs:a,gitdir:r,ref:n||"HEAD"});if(!s&&await $.exists({fs:a,gitdir:r,ref:i}))throw new jt("tag",i);await $.writeRef({fs:a,gitdir:r,ref:i,value:f})}catch(a){throw a.caller="git.tag",a}}l(t1,"tag");async function r1({fs:t,dir:e,gitdir:r=C.join(e,".git"),cache:i={},filepath:n,oid:s,mode:a,add:f,remove:o,force:c}){try{S("fs",t),S("gitdir",r),S("filepath",n);let u=new M(t);if(o)return await ge.acquire({fs:u,gitdir:r,cache:i},async function(d){if(!c){let p=await u.lstat(C.join(e,n));if(p){if(p.isDirectory())throw new Vr("directory");return}}d.has({filepath:n})&&d.delete({filepath:n})});let h;if(!s){if(h=await u.lstat(C.join(e,n)),!h)throw new oe(`file at "${n}" on disk and "remove" not set`);if(h.isDirectory())throw new Vr("directory")}return await ge.acquire({fs:u,gitdir:r,cache:i},async function(d){if(!f&&!d.has({filepath:n}))throw new oe(`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 u.readlink(C.join(e,n)):await u.read(C.join(e,n));s=await nt({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(r1,"updateIndex$1");function i1(){try{return Ef.version}catch(t){throw t.caller="git.version",t}}l(i1,"version");async function n1({fs:t,dir:e,gitdir:r=C.join(e,".git"),trees:i,map:n,reduce:s,iterate:a,cache:f={}}){try{return S("fs",t),S("gitdir",r),S("trees",i),await Gr({fs:new M(t),cache:f,dir:e,gitdir:r,trees:i,map:n,reduce:s,iterate:a})}catch(o){throw o.caller="git.walk",o}}l(n1,"walk");async function s1({fs:t,dir:e,gitdir:r=C.join(e,".git"),blob:i}){try{return S("fs",t),S("gitdir",r),S("blob",i),await nt({fs:new M(t),gitdir:r,type:"blob",object:i,format:"content"})}catch(n){throw n.caller="git.writeBlob",n}}l(s1,"writeBlob");async function a1({fs:t,dir:e,gitdir:r=C.join(e,".git"),commit:i}){try{return S("fs",t),S("gitdir",r),S("commit",i),await GF({fs:new M(t),gitdir:r,commit:i})}catch(n){throw n.caller="git.writeCommit",n}}l(a1,"writeCommit");async function o1({fs:t,dir:e,gitdir:r=C.join(e,".git"),type:i,object:n,format:s="parsed",oid:a,encoding:f=void 0}){try{let o=new M(t);if(s==="parsed"){switch(i){case"commit":n=it.from(n).toObject();break;case"tree":n=rt.from(n).toObject();break;case"blob":n=Buffer.from(n,f);break;case"tag":n=dt.from(n).toObject();break;default:throw new Ye(a||"",i,"blob|commit|tag|tree")}s="content"}return a=await nt({fs:o,gitdir:r,type:i,object:n,oid:a,format:s}),a}catch(o){throw o.caller="git.writeObject",o}}l(o1,"writeObject");async function c1({fs:t,dir:e,gitdir:r=C.join(e,".git"),ref:i,value:n,force:s=!1,symbolic:a=!1}){try{S("fs",t),S("gitdir",r),S("ref",i),S("value",n);let f=new M(t);if(!Va(i,!0))throw new Lt(i,Ha.clean(i));if(!s&&await $.exists({fs:f,gitdir:r,ref:i}))throw new jt("ref",i);a?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(c1,"writeRef");async function F$({fs:t,gitdir:e,tag:r}){let i=dt.from(r).toObject();return await nt({fs:t,gitdir:e,type:"tag",object:i,format:"content"})}l(F$,"_writeTag");async function l1({fs:t,dir:e,gitdir:r=C.join(e,".git"),tag:i}){try{return S("fs",t),S("gitdir",r),S("tag",i),await F$({fs:new M(t),gitdir:r,tag:i})}catch(n){throw n.caller="git.writeTag",n}}l(l1,"writeTag");async function f1({fs:t,dir:e,gitdir:r=C.join(e,".git"),tree:i}){try{return S("fs",t),S("gitdir",r),S("tree",i),await uo({fs:new M(t),gitdir:r,tree:i})}catch(n){throw n.caller="git.writeTree",n}}l(f1,"writeTree");var T$={Errors:TS,STAGE:Ii,TREE:ht,WORKDIR:_s,add:AS,abortMerge:OS,addNote:IS,addRemote:BS,annotatedTag:MS,branch:jS,checkout:nm,clone:HS,commit:VS,getConfig:oF,getConfigAll:cF,setConfig:VF,currentBranch:GS,deleteBranch:KS,deleteRef:JS,deleteRemote:XS,deleteTag:YS,expandOid:ZS,expandRef:QS,fastForward:rF,fetch:iF,findMergeBase:nF,findRoot:aF,getRemoteInfo:lF,getRemoteInfo2:uF,hashBlob:hF,indexPack:dF,init:pF,isDescendent:wF,isIgnored:yF,listBranches:gF,listFiles:_F,listNotes:vF,listRefs:EF,listRemotes:SF,listServerRefs:FF,listTags:TF,log:OF,merge:kF,packObjects:AF,pull:PF,push:NF,readBlob:IF,readCommit:om,readNote:$F,readObject:BF,readTag:MF,readTree:jF,remove:LF,removeNote:qF,renameBranch:UF,resetIndex:zF,updateIndex:r1,resolveRef:HF,status:ZF,statusMatrix:e1,tag:t1,version:i1,walk:n1,writeBlob:s1,writeCommit:a1,writeObject:o1,writeRef:c1,writeTag:l1,writeTree:f1,stash:YF};B.Errors=TS;B.STAGE=Ii;B.TREE=ht;B.WORKDIR=_s;B.abortMerge=OS;B.add=AS;B.addNote=IS;B.addRemote=BS;B.annotatedTag=MS;B.branch=jS;B.checkout=nm;B.clone=HS;B.commit=VS;B.currentBranch=GS;B.default=T$;B.deleteBranch=KS;B.deleteRef=JS;B.deleteRemote=XS;B.deleteTag=YS;B.expandOid=ZS;B.expandRef=QS;B.fastForward=rF;B.fetch=iF;B.findMergeBase=nF;B.findRoot=aF;B.getConfig=oF;B.getConfigAll=cF;B.getRemoteInfo=lF;B.getRemoteInfo2=uF;B.hashBlob=hF;B.indexPack=dF;B.init=pF;B.isDescendent=wF;B.isIgnored=yF;B.listBranches=gF;B.listFiles=_F;B.listNotes=vF;B.listRefs=EF;B.listRemotes=SF;B.listServerRefs=FF;B.listTags=TF;B.log=OF;B.merge=kF;B.packObjects=AF;B.pull=PF;B.push=NF;B.readBlob=IF;B.readCommit=om;B.readNote=$F;B.readObject=BF;B.readTag=MF;B.readTree=jF;B.remove=LF;B.removeNote=qF;B.renameBranch=UF;B.resetIndex=zF;B.resolveRef=HF;B.setConfig=VF;B.stash=YF;B.status=ZF;B.statusMatrix=e1;B.tag=t1;B.updateIndex=r1;B.version=i1;B.walk=n1;B.writeBlob=s1;B.writeCommit=a1;B.writeObject=o1;B.writeRef=c1;B.writeTag=l1;B.writeTree=f1});var h1=T((nz,u1)=>{u1.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 p1=T((sz,d1)=>{"use strict";var R$=["aborted","complete","headers","httpVersion","httpVersionMinor","httpVersionMajor","method","rawHeaders","rawTrailers","setTimeout","socket","statusCode","statusMessage","trailers","url"];d1.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(R$)),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 w1=T((az,m1)=>{"use strict";var{Transform:O$,PassThrough:k$}=se("stream"),Tm=se("zlib"),x$=p1();m1.exports=t=>{let e=(t.headers["content-encoding"]||"").toLowerCase();if(!["gzip","deflate","br"].includes(e))return t;let r=e==="br";if(r&&typeof Tm.createBrotliDecompress!="function")return t.destroy(new Error("Brotli is not supported on Node.js < 12")),t;let i=!0,n=new O$({transform(f,o,c){i=!1,c(null,f)},flush(f){f()}}),s=new k$({autoDestroy:!1,destroy(f,o){t.destroy(),o(f)}}),a=r?Tm.createBrotliDecompress():Tm.createUnzip();return a.once("error",f=>{if(i&&!t.readable){s.end();return}s.destroy(f)}),x$(t,s),t.pipe(n).pipe(a).pipe(s),s}});var b1=T((oz,g1)=>{g1.exports=y1;function y1(t,e){if(t&&e)return y1(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(f){s[f]=a[f]}),s}l(r,"wrapper")}l(y1,"wrappy")});var E1=T((lz,Rm)=>{var _1=b1();Rm.exports=_1(Sf);Rm.exports.strict=_1(v1);Sf.proto=Sf(function(){Object.defineProperty(Function.prototype,"once",{value:l(function(){return Sf(this)},"value"),configurable:!0}),Object.defineProperty(Function.prototype,"onceStrict",{value:l(function(){return v1(this)},"value"),configurable:!0})});function Sf(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(Sf,"once");function v1(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(v1,"onceStrict")});var R1=T((uz,T1)=>{T1.exports=Es;var A$=h1(),S1=w1(),P$=se("http"),N$=se("https"),D$=E1(),C$=se("querystring"),F1=se("url"),Om=l(t=>t!==null&&typeof t=="object"&&typeof t.pipe=="function","isStream");function Es(t,e){if(t=Object.assign({maxRedirects:10},typeof t=="string"?{url:t}:t),e=D$(e),t.url){let{hostname:f,port:o,protocol:c,auth:u,path:h}=F1.parse(t.url);delete t.url,!f&&!o&&!c&&!u?t.path=h:Object.assign(t,{hostname:f,port:o,protocol:c,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&&!Om(t.body)?JSON.stringify(t.body):t.body:t.form&&(i=typeof t.form=="string"?t.form:C$.stringify(t.form),t.headers["content-type"]="application/x-www-form-urlencoded"),i&&(t.method||(t.method="POST"),Om(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:"?N$:P$).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 c=F1.parse(t.url).hostname;return c!==null&&c!==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")):Es(t,e)}let o=typeof S1=="function"&&t.method!=="HEAD";e(null,o?S1(f):f)});return a.on("timeout",()=>{a.abort(),e(new Error("Request timed out"))}),a.on("error",e),Om(i)?i.on("error",e).pipe(a):a.end(i),a}l(Es,"simpleGet");Es.concat=(t,e)=>Es(t,(r,i)=>{if(r)return e(r);A$(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=>{Es[t]=(e,r)=>(typeof e=="string"&&(e={url:e}),Es(Object.assign({method:t.toUpperCase()},e),r))})});var km=T((dz,O1)=>{O1.exports=se("stream")});var D1=T((pz,N1)=>{"use strict";function k1(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable})),r.push.apply(r,i)}return r}l(k1,"ownKeys");function x1(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?k1(Object(r),!0).forEach(function(i){I$(t,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):k1(Object(r)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(r,i))})}return t}l(x1,"_objectSpread");function I$(t,e,r){return e=P1(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}l(I$,"_defineProperty");function $$(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}l($$,"_classCallCheck");function A1(t,e){for(var r=0;r<e.length;r++){var i=e[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,P1(i.key),i)}}l(A1,"_defineProperties");function B$(t,e,r){return e&&A1(t.prototype,e),r&&A1(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}l(B$,"_createClass");function P1(t){var e=M$(t,"string");return typeof e=="symbol"?e:String(e)}l(P1,"_toPropertyKey");function M$(t,e){if(typeof t!="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var i=r.call(t,e||"default");if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}l(M$,"_toPrimitive");var j$=se("buffer"),Ff=j$.Buffer,L$=se("util"),xm=L$.inspect,q$=xm&&xm.custom||"inspect";function U$(t,e,r){Ff.prototype.copy.call(t,e,r)}l(U$,"copyBuffer");N1.exports=function(){function t(){$$(this,t),this.head=null,this.tail=null,this.length=0}return l(t,"BufferList"),B$(t,[{key:"push",value:l(function(r){var i={data:r,next:null};this.length>0?this.tail.next=i:this.head=i,this.tail=i,++this.length},"push")},{key:"unshift",value:l(function(r){var i={data:r,next:this.head};this.length===0&&(this.tail=i),this.head=i,++this.length},"unshift")},{key:"shift",value:l(function(){if(this.length!==0){var r=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,r}},"shift")},{key:"clear",value:l(function(){this.head=this.tail=null,this.length=0},"clear")},{key:"join",value:l(function(r){if(this.length===0)return"";for(var i=this.head,n=""+i.data;i=i.next;)n+=r+i.data;return n},"join")},{key:"concat",value:l(function(r){if(this.length===0)return Ff.alloc(0);for(var i=Ff.allocUnsafe(r>>>0),n=this.head,s=0;n;)U$(n.data,i,s),s+=n.data.length,n=n.next;return i},"concat")},{key:"consume",value:l(function(r,i){var n;return r<this.head.data.length?(n=this.head.data.slice(0,r),this.head.data=this.head.data.slice(r)):r===this.head.data.length?n=this.shift():n=i?this._getString(r):this._getBuffer(r),n},"consume")},{key:"first",value:l(function(){return this.head.data},"first")},{key:"_getString",value:l(function(r){var i=this.head,n=1,s=i.data;for(r-=s.length;i=i.next;){var a=i.data,f=r>a.length?a.length:r;if(f===a.length?s+=a:s+=a.slice(0,r),r-=f,r===0){f===a.length?(++n,i.next?this.head=i.next:this.head=this.tail=null):(this.head=i,i.data=a.slice(f));break}++n}return this.length-=n,s},"_getString")},{key:"_getBuffer",value:l(function(r){var i=Ff.allocUnsafe(r),n=this.head,s=1;for(n.data.copy(i),r-=n.data.length;n=n.next;){var a=n.data,f=r>a.length?a.length:r;if(a.copy(i,i.length-r,0,f),r-=f,r===0){f===a.length?(++s,n.next?this.head=n.next:this.head=this.tail=null):(this.head=n,n.data=a.slice(f));break}++s}return this.length-=s,i},"_getBuffer")},{key:q$,value:l(function(r,i){return xm(this,x1(x1({},i),{},{depth:0,customInspect:!1}))},"value")}]),t}()});var Pm=T((wz,I1)=>{"use strict";function W$(t,e){var r=this,i=this._readableState&&this._readableState.destroyed,n=this._writableState&&this._writableState.destroyed;return i||n?(e?e(t):t&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,process.nextTick(Am,this,t)):process.nextTick(Am,this,t)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(t||null,function(s){!e&&s?r._writableState?r._writableState.errorEmitted?process.nextTick(Tf,r):(r._writableState.errorEmitted=!0,process.nextTick(C1,r,s)):process.nextTick(C1,r,s):e?(process.nextTick(Tf,r),e(s)):process.nextTick(Tf,r)}),this)}l(W$,"destroy");function C1(t,e){Am(t,e),Tf(t)}l(C1,"emitErrorAndCloseNT");function Tf(t){t._writableState&&!t._writableState.emitClose||t._readableState&&!t._readableState.emitClose||t.emit("close")}l(Tf,"emitCloseNT");function z$(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}l(z$,"undestroy");function Am(t,e){t.emit("error",e)}l(Am,"emitErrorNT");function H$(t,e){var r=t._readableState,i=t._writableState;r&&r.autoDestroy||i&&i.autoDestroy?t.destroy(e):t.emit("error",e)}l(H$,"errorOrDestroy");I1.exports={destroy:W$,undestroy:z$,errorOrDestroy:H$}});var Yr=T((gz,M1)=>{"use strict";var B1={};function Ot(t,e,r){r||(r=Error);function i(a,f,o){return typeof e=="string"?e:e(a,f,o)}l(i,"getMessage");let s=class s extends r{constructor(f,o,c){super(i(f,o,c))}};l(s,"NodeError");let n=s;n.prototype.name=r.name,n.prototype.code=t,B1[t]=n}l(Ot,"createErrorType");function $1(t,e){if(Array.isArray(t)){let r=t.length;return t=t.map(i=>String(i)),r>2?`one of ${e} ${t.slice(0,r-1).join(", ")}, or `+t[r-1]:r===2?`one of ${e} ${t[0]} or ${t[1]}`:`of ${e} ${t[0]}`}else return`of ${e} ${String(t)}`}l($1,"oneOf");function V$(t,e,r){return t.substr(!r||r<0?0:+r,e.length)===e}l(V$,"startsWith");function G$(t,e,r){return(r===void 0||r>t.length)&&(r=t.length),t.substring(r-e.length,r)===e}l(G$,"endsWith");function K$(t,e,r){return typeof r!="number"&&(r=0),r+e.length>t.length?!1:t.indexOf(e,r)!==-1}l(K$,"includes");Ot("ERR_INVALID_OPT_VALUE",function(t,e){return'The value "'+e+'" is invalid for option "'+t+'"'},TypeError);Ot("ERR_INVALID_ARG_TYPE",function(t,e,r){let i;typeof e=="string"&&V$(e,"not ")?(i="must not be",e=e.replace(/^not /,"")):i="must be";let n;if(G$(t," argument"))n=`The ${t} ${i} ${$1(e,"type")}`;else{let s=K$(t,".")?"property":"argument";n=`The "${t}" ${s} ${i} ${$1(e,"type")}`}return n+=`. Received type ${typeof r}`,n},TypeError);Ot("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF");Ot("ERR_METHOD_NOT_IMPLEMENTED",function(t){return"The "+t+" method is not implemented"});Ot("ERR_STREAM_PREMATURE_CLOSE","Premature close");Ot("ERR_STREAM_DESTROYED",function(t){return"Cannot call "+t+" after a stream was destroyed"});Ot("ERR_MULTIPLE_CALLBACK","Callback called multiple times");Ot("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable");Ot("ERR_STREAM_WRITE_AFTER_END","write after end");Ot("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);Ot("ERR_UNKNOWN_ENCODING",function(t){return"Unknown encoding: "+t},TypeError);Ot("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event");M1.exports.codes=B1});var Nm=T((_z,j1)=>{"use strict";var J$=Yr().codes.ERR_INVALID_OPT_VALUE;function X$(t,e,r){return t.highWaterMark!=null?t.highWaterMark:e?t[r]:null}l(X$,"highWaterMarkFrom");function Y$(t,e,r,i){var n=X$(e,i,r);if(n!=null){if(!(isFinite(n)&&Math.floor(n)===n)||n<0){var s=i?r:"highWaterMark";throw new J$(s,n)}return Math.floor(n)}return t.objectMode?16:16*1024}l(Y$,"getHighWaterMark");j1.exports={getHighWaterMark:Y$}});var q1=T((Ez,L1)=>{L1.exports=se("util").deprecate});var Im=T((Sz,G1)=>{"use strict";G1.exports=we;function W1(t){var e=this;this.next=null,this.entry=null,this.finish=function(){FB(e,t)}}l(W1,"CorkedRequest");var Ss;we.WritableState=mo;var Z$={deprecate:q1()},z1=km(),Of=se("buffer").Buffer,Q$=(typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function eB(t){return Of.from(t)}l(eB,"_uint8ArrayToBuffer");function tB(t){return Of.isBuffer(t)||t instanceof Q$}l(tB,"_isUint8Array");var Cm=Pm(),rB=Nm(),iB=rB.getHighWaterMark,Zr=Yr().codes,nB=Zr.ERR_INVALID_ARG_TYPE,sB=Zr.ERR_METHOD_NOT_IMPLEMENTED,aB=Zr.ERR_MULTIPLE_CALLBACK,oB=Zr.ERR_STREAM_CANNOT_PIPE,cB=Zr.ERR_STREAM_DESTROYED,lB=Zr.ERR_STREAM_NULL_VALUES,fB=Zr.ERR_STREAM_WRITE_AFTER_END,uB=Zr.ERR_UNKNOWN_ENCODING,Fs=Cm.errorOrDestroy;bi()(we,z1);function hB(){}l(hB,"nop");function mo(t,e,r){Ss=Ss||$i(),t=t||{},typeof r!="boolean"&&(r=e instanceof Ss),this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.writableObjectMode),this.highWaterMark=iB(this,t,"writableHighWaterMark",r),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var i=t.decodeStrings===!1;this.decodeStrings=!i,this.defaultEncoding=t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(n){bB(e,n)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=t.emitClose!==!1,this.autoDestroy=!!t.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new W1(this)}l(mo,"WritableState");mo.prototype.getBuffer=l(function(){for(var e=this.bufferedRequest,r=[];e;)r.push(e),e=e.next;return r},"getBuffer");(function(){try{Object.defineProperty(mo.prototype,"buffer",{get:Z$.deprecate(l(function(){return this.getBuffer()},"writableStateBufferGetter"),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}})();var Rf;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(Rf=Function.prototype[Symbol.hasInstance],Object.defineProperty(we,Symbol.hasInstance,{value:l(function(e){return Rf.call(this,e)?!0:this!==we?!1:e&&e._writableState instanceof mo},"value")})):Rf=l(function(e){return e instanceof this},"realHasInstance");function we(t){Ss=Ss||$i();var e=this instanceof Ss;if(!e&&!Rf.call(we,this))return new we(t);this._writableState=new mo(t,this,e),this.writable=!0,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)),z1.call(this)}l(we,"Writable");we.prototype.pipe=function(){Fs(this,new oB)};function dB(t,e){var r=new fB;Fs(t,r),process.nextTick(e,r)}l(dB,"writeAfterEnd");function pB(t,e,r,i){var n;return r===null?n=new lB:typeof r!="string"&&!e.objectMode&&(n=new nB("chunk",["string","Buffer"],r)),n?(Fs(t,n),process.nextTick(i,n),!1):!0}l(pB,"validChunk");we.prototype.write=function(t,e,r){var i=this._writableState,n=!1,s=!i.objectMode&&tB(t);return s&&!Of.isBuffer(t)&&(t=eB(t)),typeof e=="function"&&(r=e,e=null),s?e="buffer":e||(e=i.defaultEncoding),typeof r!="function"&&(r=hB),i.ending?dB(this,r):(s||pB(this,i,t,r))&&(i.pendingcb++,n=wB(this,i,s,t,e,r)),n};we.prototype.cork=function(){this._writableState.corked++};we.prototype.uncork=function(){var t=this._writableState;t.corked&&(t.corked--,!t.writing&&!t.corked&&!t.bufferProcessing&&t.bufferedRequest&&H1(this,t))};we.prototype.setDefaultEncoding=l(function(e){if(typeof e=="string"&&(e=e.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new uB(e);return this._writableState.defaultEncoding=e,this},"setDefaultEncoding");Object.defineProperty(we.prototype,"writableBuffer",{enumerable:!1,get:l(function(){return this._writableState&&this._writableState.getBuffer()},"get")});function mB(t,e,r){return!t.objectMode&&t.decodeStrings!==!1&&typeof e=="string"&&(e=Of.from(e,r)),e}l(mB,"decodeChunk");Object.defineProperty(we.prototype,"writableHighWaterMark",{enumerable:!1,get:l(function(){return this._writableState.highWaterMark},"get")});function wB(t,e,r,i,n,s){if(!r){var a=mB(e,i,n);i!==a&&(r=!0,n="buffer",i=a)}var f=e.objectMode?1:i.length;e.length+=f;var o=e.length<e.highWaterMark;if(o||(e.needDrain=!0),e.writing||e.corked){var c=e.lastBufferedRequest;e.lastBufferedRequest={chunk:i,encoding:n,isBuf:r,callback:s,next:null},c?c.next=e.lastBufferedRequest:e.bufferedRequest=e.lastBufferedRequest,e.bufferedRequestCount+=1}else Dm(t,e,!1,f,i,n,s);return o}l(wB,"writeOrBuffer");function Dm(t,e,r,i,n,s,a){e.writelen=i,e.writecb=a,e.writing=!0,e.sync=!0,e.destroyed?e.onwrite(new cB("write")):r?t._writev(n,e.onwrite):t._write(n,s,e.onwrite),e.sync=!1}l(Dm,"doWrite");function yB(t,e,r,i,n){--e.pendingcb,r?(process.nextTick(n,i),process.nextTick(po,t,e),t._writableState.errorEmitted=!0,Fs(t,i)):(n(i),t._writableState.errorEmitted=!0,Fs(t,i),po(t,e))}l(yB,"onwriteError");function gB(t){t.writing=!1,t.writecb=null,t.length-=t.writelen,t.writelen=0}l(gB,"onwriteStateUpdate");function bB(t,e){var r=t._writableState,i=r.sync,n=r.writecb;if(typeof n!="function")throw new aB;if(gB(r),e)yB(t,r,i,e,n);else{var s=V1(r)||t.destroyed;!s&&!r.corked&&!r.bufferProcessing&&r.bufferedRequest&&H1(t,r),i?process.nextTick(U1,t,r,s,n):U1(t,r,s,n)}}l(bB,"onwrite");function U1(t,e,r,i){r||_B(t,e),e.pendingcb--,i(),po(t,e)}l(U1,"afterWrite");function _B(t,e){e.length===0&&e.needDrain&&(e.needDrain=!1,t.emit("drain"))}l(_B,"onwriteDrain");function H1(t,e){e.bufferProcessing=!0;var r=e.bufferedRequest;if(t._writev&&r&&r.next){var i=e.bufferedRequestCount,n=new Array(i),s=e.corkedRequestsFree;s.entry=r;for(var a=0,f=!0;r;)n[a]=r,r.isBuf||(f=!1),r=r.next,a+=1;n.allBuffers=f,Dm(t,e,!0,e.length,n,"",s.finish),e.pendingcb++,e.lastBufferedRequest=null,s.next?(e.corkedRequestsFree=s.next,s.next=null):e.corkedRequestsFree=new W1(e),e.bufferedRequestCount=0}else{for(;r;){var o=r.chunk,c=r.encoding,u=r.callback,h=e.objectMode?1:o.length;if(Dm(t,e,!1,h,o,c,u),r=r.next,e.bufferedRequestCount--,e.writing)break}r===null&&(e.lastBufferedRequest=null)}e.bufferedRequest=r,e.bufferProcessing=!1}l(H1,"clearBuffer");we.prototype._write=function(t,e,r){r(new sB("_write()"))};we.prototype._writev=null;we.prototype.end=function(t,e,r){var i=this._writableState;return typeof t=="function"?(r=t,t=null,e=null):typeof e=="function"&&(r=e,e=null),t!=null&&this.write(t,e),i.corked&&(i.corked=1,this.uncork()),i.ending||SB(this,i,r),this};Object.defineProperty(we.prototype,"writableLength",{enumerable:!1,get:l(function(){return this._writableState.length},"get")});function V1(t){return t.ending&&t.length===0&&t.bufferedRequest===null&&!t.finished&&!t.writing}l(V1,"needFinish");function vB(t,e){t._final(function(r){e.pendingcb--,r&&Fs(t,r),e.prefinished=!0,t.emit("prefinish"),po(t,e)})}l(vB,"callFinal");function EB(t,e){!e.prefinished&&!e.finalCalled&&(typeof t._final=="function"&&!e.destroyed?(e.pendingcb++,e.finalCalled=!0,process.nextTick(vB,t,e)):(e.prefinished=!0,t.emit("prefinish")))}l(EB,"prefinish");function po(t,e){var r=V1(e);if(r&&(EB(t,e),e.pendingcb===0&&(e.finished=!0,t.emit("finish"),e.autoDestroy))){var i=t._readableState;(!i||i.autoDestroy&&i.endEmitted)&&t.destroy()}return r}l(po,"finishMaybe");function SB(t,e,r){e.ending=!0,po(t,e),r&&(e.finished?process.nextTick(r):t.once("finish",r)),e.ended=!0,t.writable=!1}l(SB,"endWritable");function FB(t,e,r){var i=t.entry;for(t.entry=null;i;){var n=i.callback;e.pendingcb--,n(r),i=i.next}e.corkedRequestsFree.next=t}l(FB,"onCorkedFinish");Object.defineProperty(we.prototype,"destroyed",{enumerable:!1,get:l(function(){return this._writableState===void 0?!1:this._writableState.destroyed},"get"),set:l(function(e){this._writableState&&(this._writableState.destroyed=e)},"set")});we.prototype.destroy=Cm.destroy;we.prototype._undestroy=Cm.undestroy;we.prototype._destroy=function(t,e){e(t)}});var $i=T((Tz,J1)=>{"use strict";var TB=Object.keys||function(t){var e=[];for(var r in t)e.push(r);return e};J1.exports=ar;var K1=Mm(),Bm=Im();bi()(ar,K1);for($m=TB(Bm.prototype),kf=0;kf<$m.length;kf++)xf=$m[kf],ar.prototype[xf]||(ar.prototype[xf]=Bm.prototype[xf]);var $m,xf,kf;function ar(t){if(!(this instanceof ar))return new ar(t);K1.call(this,t),Bm.call(this,t),this.allowHalfOpen=!0,t&&(t.readable===!1&&(this.readable=!1),t.writable===!1&&(this.writable=!1),t.allowHalfOpen===!1&&(this.allowHalfOpen=!1,this.once("end",RB)))}l(ar,"Duplex");Object.defineProperty(ar.prototype,"writableHighWaterMark",{enumerable:!1,get:l(function(){return this._writableState.highWaterMark},"get")});Object.defineProperty(ar.prototype,"writableBuffer",{enumerable:!1,get:l(function(){return this._writableState&&this._writableState.getBuffer()},"get")});Object.defineProperty(ar.prototype,"writableLength",{enumerable:!1,get:l(function(){return this._writableState.length},"get")});function RB(){this._writableState.ended||process.nextTick(OB,this)}l(RB,"onend");function OB(t){t.end()}l(OB,"onEndNT");Object.defineProperty(ar.prototype,"destroyed",{enumerable:!1,get:l(function(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},"get"),set:l(function(e){this._readableState===void 0||this._writableState===void 0||(this._readableState.destroyed=e,this._writableState.destroyed=e)},"set")})});var qm=T(Y1=>{"use strict";var Lm=_a().Buffer,X1=Lm.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 kB(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(kB,"_normalizeEncoding");function xB(t){var e=kB(t);if(typeof e!="string"&&(Lm.isEncoding===X1||!X1(t)))throw new Error("Unknown encoding: "+t);return e||t}l(xB,"normalizeEncoding");Y1.StringDecoder=wo;function wo(t){this.encoding=xB(t);var e;switch(this.encoding){case"utf16le":this.text=IB,this.end=$B,e=4;break;case"utf8":this.fillLast=NB,e=4;break;case"base64":this.text=BB,this.end=MB,e=3;break;default:this.write=jB,this.end=LB;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=Lm.allocUnsafe(e)}l(wo,"StringDecoder");wo.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||""};wo.prototype.end=CB;wo.prototype.text=DB;wo.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 jm(t){return t<=127?0:t>>5===6?2:t>>4===14?3:t>>3===30?4:t>>6===2?-1:-2}l(jm,"utf8CheckByte");function AB(t,e,r){var i=e.length-1;if(i<r)return 0;var n=jm(e[i]);return n>=0?(n>0&&(t.lastNeed=n-1),n):--i<r||n===-2?0:(n=jm(e[i]),n>=0?(n>0&&(t.lastNeed=n-2),n):--i<r||n===-2?0:(n=jm(e[i]),n>=0?(n>0&&(n===2?n=0:t.lastNeed=n-3),n):0))}l(AB,"utf8CheckIncomplete");function PB(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(PB,"utf8CheckExtraBytes");function NB(t){var e=this.lastTotal-this.lastNeed,r=PB(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(NB,"utf8FillLast");function DB(t,e){var r=AB(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(DB,"utf8Text");function CB(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"\uFFFD":e}l(CB,"utf8End");function IB(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(IB,"utf16Text");function $B(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($B,"utf16End");function BB(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(BB,"base64Text");function MB(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}l(MB,"base64End");function jB(t){return t.toString(this.encoding)}l(jB,"simpleWrite");function LB(t){return t&&t.length?this.write(t):""}l(LB,"simpleEnd")});var Af=T((xz,eT)=>{"use strict";var Z1=Yr().codes.ERR_STREAM_PREMATURE_CLOSE;function qB(t){var e=!1;return function(){if(!e){e=!0;for(var r=arguments.length,i=new Array(r),n=0;n<r;n++)i[n]=arguments[n];t.apply(this,i)}}}l(qB,"once");function UB(){}l(UB,"noop");function WB(t){return t.setHeader&&typeof t.abort=="function"}l(WB,"isRequest");function Q1(t,e,r){if(typeof e=="function")return Q1(t,null,e);e||(e={}),r=qB(r||UB);var i=e.readable||e.readable!==!1&&t.readable,n=e.writable||e.writable!==!1&&t.writable,s=l(function(){t.writable||f()},"onlegacyfinish"),a=t._writableState&&t._writableState.finished,f=l(function(){n=!1,a=!0,i||r.call(t)},"onfinish"),o=t._readableState&&t._readableState.endEmitted,c=l(function(){i=!1,o=!0,n||r.call(t)},"onend"),u=l(function(m){r.call(t,m)},"onerror"),h=l(function(){var m;if(i&&!o)return(!t._readableState||!t._readableState.ended)&&(m=new Z1),r.call(t,m);if(n&&!a)return(!t._writableState||!t._writableState.ended)&&(m=new Z1),r.call(t,m)},"onclose"),d=l(function(){t.req.on("finish",f)},"onrequest");return WB(t)?(t.on("complete",f),t.on("abort",h),t.req?d():t.on("request",d)):n&&!t._writableState&&(t.on("end",s),t.on("close",s)),t.on("end",c),t.on("finish",f),e.error!==!1&&t.on("error",u),t.on("close",h),function(){t.removeListener("complete",f),t.removeListener("abort",h),t.removeListener("request",d),t.req&&t.req.removeListener("finish",f),t.removeListener("end",s),t.removeListener("close",s),t.removeListener("finish",f),t.removeListener("end",c),t.removeListener("error",u),t.removeListener("close",h)}}l(Q1,"eos");eT.exports=Q1});var rT=T((Pz,tT)=>{"use strict";var Pf;function Qr(t,e,r){return e=zB(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}l(Qr,"_defineProperty");function zB(t){var e=HB(t,"string");return typeof e=="symbol"?e:String(e)}l(zB,"_toPropertyKey");function HB(t,e){if(typeof t!="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var i=r.call(t,e||"default");if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}l(HB,"_toPrimitive");var VB=Af(),ei=Symbol("lastResolve"),Bi=Symbol("lastReject"),yo=Symbol("error"),Nf=Symbol("ended"),Mi=Symbol("lastPromise"),Um=Symbol("handlePromise"),ji=Symbol("stream");function ti(t,e){return{value:t,done:e}}l(ti,"createIterResult");function GB(t){var e=t[ei];if(e!==null){var r=t[ji].read();r!==null&&(t[Mi]=null,t[ei]=null,t[Bi]=null,e(ti(r,!1)))}}l(GB,"readAndResolve");function KB(t){process.nextTick(GB,t)}l(KB,"onReadable");function JB(t,e){return function(r,i){t.then(function(){if(e[Nf]){r(ti(void 0,!0));return}e[Um](r,i)},i)}}l(JB,"wrapForNext");var XB=Object.getPrototypeOf(function(){}),YB=Object.setPrototypeOf((Pf={get stream(){return this[ji]},next:l(function(){var e=this,r=this[yo];if(r!==null)return Promise.reject(r);if(this[Nf])return Promise.resolve(ti(void 0,!0));if(this[ji].destroyed)return new Promise(function(a,f){process.nextTick(function(){e[yo]?f(e[yo]):a(ti(void 0,!0))})});var i=this[Mi],n;if(i)n=new Promise(JB(i,this));else{var s=this[ji].read();if(s!==null)return Promise.resolve(ti(s,!1));n=new Promise(this[Um])}return this[Mi]=n,n},"next")},Qr(Pf,Symbol.asyncIterator,function(){return this}),Qr(Pf,"return",l(function(){var e=this;return new Promise(function(r,i){e[ji].destroy(null,function(n){if(n){i(n);return}r(ti(void 0,!0))})})},"_return")),Pf),XB),ZB=l(function(e){var r,i=Object.create(YB,(r={},Qr(r,ji,{value:e,writable:!0}),Qr(r,ei,{value:null,writable:!0}),Qr(r,Bi,{value:null,writable:!0}),Qr(r,yo,{value:null,writable:!0}),Qr(r,Nf,{value:e._readableState.endEmitted,writable:!0}),Qr(r,Um,{value:l(function(s,a){var f=i[ji].read();f?(i[Mi]=null,i[ei]=null,i[Bi]=null,s(ti(f,!1))):(i[ei]=s,i[Bi]=a)},"value"),writable:!0}),r));return i[Mi]=null,VB(e,function(n){if(n&&n.code!=="ERR_STREAM_PREMATURE_CLOSE"){var s=i[Bi];s!==null&&(i[Mi]=null,i[ei]=null,i[Bi]=null,s(n)),i[yo]=n;return}var a=i[ei];a!==null&&(i[Mi]=null,i[ei]=null,i[Bi]=null,a(ti(void 0,!0))),i[Nf]=!0}),e.on("readable",KB.bind(null,i)),i},"createReadableStreamAsyncIterator");tT.exports=ZB});var aT=T((Dz,sT)=>{"use strict";function iT(t,e,r,i,n,s,a){try{var f=t[s](a),o=f.value}catch(c){r(c);return}f.done?e(o):Promise.resolve(o).then(i,n)}l(iT,"asyncGeneratorStep");function QB(t){return function(){var e=this,r=arguments;return new Promise(function(i,n){var s=t.apply(e,r);function a(o){iT(s,i,n,a,f,"next",o)}l(a,"_next");function f(o){iT(s,i,n,a,f,"throw",o)}l(f,"_throw"),a(void 0)})}}l(QB,"_asyncToGenerator");function nT(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable})),r.push.apply(r,i)}return r}l(nT,"ownKeys");function eM(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?nT(Object(r),!0).forEach(function(i){tM(t,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):nT(Object(r)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(r,i))})}return t}l(eM,"_objectSpread");function tM(t,e,r){return e=rM(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}l(tM,"_defineProperty");function rM(t){var e=iM(t,"string");return typeof e=="symbol"?e:String(e)}l(rM,"_toPropertyKey");function iM(t,e){if(typeof t!="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var i=r.call(t,e||"default");if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}l(iM,"_toPrimitive");var nM=Yr().codes.ERR_INVALID_ARG_TYPE;function sM(t,e,r){var i;if(e&&typeof e.next=="function")i=e;else if(e&&e[Symbol.asyncIterator])i=e[Symbol.asyncIterator]();else if(e&&e[Symbol.iterator])i=e[Symbol.iterator]();else throw new nM("iterable",["Iterable"],e);var n=new t(eM({objectMode:!0},r)),s=!1;n._read=function(){s||(s=!0,a())};function a(){return f.apply(this,arguments)}l(a,"next");function f(){return f=QB(function*(){try{var o=yield i.next(),c=o.value,u=o.done;u?n.push(null):n.push(yield c)?a():s=!1}catch(h){n.destroy(h)}}),f.apply(this,arguments)}return l(f,"_next2"),n}l(sM,"from");sT.exports=sM});var Mm=T(($z,wT)=>{"use strict";wT.exports=ee;var Ts;ee.ReadableState=fT;var Iz=se("events").EventEmitter,lT=l(function(e,r){return e.listeners(r).length},"EElistenerCount"),bo=km(),Df=se("buffer").Buffer,aM=(typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function oM(t){return Df.from(t)}l(oM,"_uint8ArrayToBuffer");function cM(t){return Df.isBuffer(t)||t instanceof aM}l(cM,"_isUint8Array");var Wm=se("util"),K;Wm&&Wm.debuglog?K=Wm.debuglog("stream"):K=l(function(){},"debug");var lM=D1(),Xm=Pm(),fM=Nm(),uM=fM.getHighWaterMark,Cf=Yr().codes,hM=Cf.ERR_INVALID_ARG_TYPE,dM=Cf.ERR_STREAM_PUSH_AFTER_EOF,pM=Cf.ERR_METHOD_NOT_IMPLEMENTED,mM=Cf.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,Rs,zm,Hm;bi()(ee,bo);var go=Xm.errorOrDestroy,Vm=["error","close","destroy","pause","resume"];function wM(t,e,r){if(typeof t.prependListener=="function")return t.prependListener(e,r);!t._events||!t._events[e]?t.on(e,r):Array.isArray(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]}l(wM,"prependListener");function fT(t,e,r){Ts=Ts||$i(),t=t||{},typeof r!="boolean"&&(r=e instanceof Ts),this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.readableObjectMode),this.highWaterMark=uM(this,t,"readableHighWaterMark",r),this.buffer=new lM,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=t.emitClose!==!1,this.autoDestroy=!!t.autoDestroy,this.destroyed=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(Rs||(Rs=qm().StringDecoder),this.decoder=new Rs(t.encoding),this.encoding=t.encoding)}l(fT,"ReadableState");function ee(t){if(Ts=Ts||$i(),!(this instanceof ee))return new ee(t);var e=this instanceof Ts;this._readableState=new fT(t,this,e),this.readable=!0,t&&(typeof t.read=="function"&&(this._read=t.read),typeof t.destroy=="function"&&(this._destroy=t.destroy)),bo.call(this)}l(ee,"Readable");Object.defineProperty(ee.prototype,"destroyed",{enumerable:!1,get:l(function(){return this._readableState===void 0?!1:this._readableState.destroyed},"get"),set:l(function(e){this._readableState&&(this._readableState.destroyed=e)},"set")});ee.prototype.destroy=Xm.destroy;ee.prototype._undestroy=Xm.undestroy;ee.prototype._destroy=function(t,e){e(t)};ee.prototype.push=function(t,e){var r=this._readableState,i;return r.objectMode?i=!0:typeof t=="string"&&(e=e||r.defaultEncoding,e!==r.encoding&&(t=Df.from(t,e),e=""),i=!0),uT(this,t,e,!1,i)};ee.prototype.unshift=function(t){return uT(this,t,null,!0,!1)};function uT(t,e,r,i,n){K("readableAddChunk",e);var s=t._readableState;if(e===null)s.reading=!1,bM(t,s);else{var a;if(n||(a=yM(s,e)),a)go(t,a);else if(s.objectMode||e&&e.length>0)if(typeof e!="string"&&!s.objectMode&&Object.getPrototypeOf(e)!==Df.prototype&&(e=oM(e)),i)s.endEmitted?go(t,new mM):Gm(t,s,e,!0);else if(s.ended)go(t,new dM);else{if(s.destroyed)return!1;s.reading=!1,s.decoder&&!r?(e=s.decoder.write(e),s.objectMode||e.length!==0?Gm(t,s,e,!1):Jm(t,s)):Gm(t,s,e,!1)}else i||(s.reading=!1,Jm(t,s))}return!s.ended&&(s.length<s.highWaterMark||s.length===0)}l(uT,"readableAddChunk");function Gm(t,e,r,i){e.flowing&&e.length===0&&!e.sync?(e.awaitDrain=0,t.emit("data",r)):(e.length+=e.objectMode?1:r.length,i?e.buffer.unshift(r):e.buffer.push(r),e.needReadable&&If(t)),Jm(t,e)}l(Gm,"addChunk");function yM(t,e){var r;return!cM(e)&&typeof e!="string"&&e!==void 0&&!t.objectMode&&(r=new hM("chunk",["string","Buffer","Uint8Array"],e)),r}l(yM,"chunkInvalid");ee.prototype.isPaused=function(){return this._readableState.flowing===!1};ee.prototype.setEncoding=function(t){Rs||(Rs=qm().StringDecoder);var e=new Rs(t);this._readableState.decoder=e,this._readableState.encoding=this._readableState.decoder.encoding;for(var r=this._readableState.buffer.head,i="";r!==null;)i+=e.write(r.data),r=r.next;return this._readableState.buffer.clear(),i!==""&&this._readableState.buffer.push(i),this._readableState.length=i.length,this};var oT=1073741824;function gM(t){return t>=oT?t=oT:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}l(gM,"computeNewHighWaterMark");function cT(t,e){return t<=0||e.length===0&&e.ended?0:e.objectMode?1:t!==t?e.flowing&&e.length?e.buffer.head.data.length:e.length:(t>e.highWaterMark&&(e.highWaterMark=gM(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}l(cT,"howMuchToRead");ee.prototype.read=function(t){K("read",t),t=parseInt(t,10);var e=this._readableState,r=t;if(t!==0&&(e.emittedReadable=!1),t===0&&e.needReadable&&((e.highWaterMark!==0?e.length>=e.highWaterMark:e.length>0)||e.ended))return K("read: emitReadable",e.length,e.ended),e.length===0&&e.ended?Km(this):If(this),null;if(t=cT(t,e),t===0&&e.ended)return e.length===0&&Km(this),null;var i=e.needReadable;K("need readable",i),(e.length===0||e.length-t<e.highWaterMark)&&(i=!0,K("length less than watermark",i)),e.ended||e.reading?(i=!1,K("reading or ended",i)):i&&(K("do read"),e.reading=!0,e.sync=!0,e.length===0&&(e.needReadable=!0),this._read(e.highWaterMark),e.sync=!1,e.reading||(t=cT(r,e)));var n;return t>0?n=pT(t,e):n=null,n===null?(e.needReadable=e.length<=e.highWaterMark,t=0):(e.length-=t,e.awaitDrain=0),e.length===0&&(e.ended||(e.needReadable=!0),r!==t&&e.ended&&Km(this)),n!==null&&this.emit("data",n),n};function bM(t,e){if(K("onEofChunk"),!e.ended){if(e.decoder){var r=e.decoder.end();r&&r.length&&(e.buffer.push(r),e.length+=e.objectMode?1:r.length)}e.ended=!0,e.sync?If(t):(e.needReadable=!1,e.emittedReadable||(e.emittedReadable=!0,hT(t)))}}l(bM,"onEofChunk");function If(t){var e=t._readableState;K("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(K("emitReadable",e.flowing),e.emittedReadable=!0,process.nextTick(hT,t))}l(If,"emitReadable");function hT(t){var e=t._readableState;K("emitReadable_",e.destroyed,e.length,e.ended),!e.destroyed&&(e.length||e.ended)&&(t.emit("readable"),e.emittedReadable=!1),e.needReadable=!e.flowing&&!e.ended&&e.length<=e.highWaterMark,Ym(t)}l(hT,"emitReadable_");function Jm(t,e){e.readingMore||(e.readingMore=!0,process.nextTick(_M,t,e))}l(Jm,"maybeReadMore");function _M(t,e){for(;!e.reading&&!e.ended&&(e.length<e.highWaterMark||e.flowing&&e.length===0);){var r=e.length;if(K("maybeReadMore read 0"),t.read(0),r===e.length)break}e.readingMore=!1}l(_M,"maybeReadMore_");ee.prototype._read=function(t){go(this,new pM("_read()"))};ee.prototype.pipe=function(t,e){var r=this,i=this._readableState;switch(i.pipesCount){case 0:i.pipes=t;break;case 1:i.pipes=[i.pipes,t];break;default:i.pipes.push(t);break}i.pipesCount+=1,K("pipe count=%d opts=%j",i.pipesCount,e);var n=(!e||e.end!==!1)&&t!==process.stdout&&t!==process.stderr,s=n?f:w;i.endEmitted?process.nextTick(s):r.once("end",s),t.on("unpipe",a);function a(y,g){K("onunpipe"),y===r&&g&&g.hasUnpiped===!1&&(g.hasUnpiped=!0,u())}l(a,"onunpipe");function f(){K("onend"),t.end()}l(f,"onend");var o=vM(r);t.on("drain",o);var c=!1;function u(){K("cleanup"),t.removeListener("close",p),t.removeListener("finish",m),t.removeListener("drain",o),t.removeListener("error",d),t.removeListener("unpipe",a),r.removeListener("end",f),r.removeListener("end",w),r.removeListener("data",h),c=!0,i.awaitDrain&&(!t._writableState||t._writableState.needDrain)&&o()}l(u,"cleanup"),r.on("data",h);function h(y){K("ondata");var g=t.write(y);K("dest.write",g),g===!1&&((i.pipesCount===1&&i.pipes===t||i.pipesCount>1&&mT(i.pipes,t)!==-1)&&!c&&(K("false write response, pause",i.awaitDrain),i.awaitDrain++),r.pause())}l(h,"ondata");function d(y){K("onerror",y),w(),t.removeListener("error",d),lT(t,"error")===0&&go(t,y)}l(d,"onerror"),wM(t,"error",d);function p(){t.removeListener("finish",m),w()}l(p,"onclose"),t.once("close",p);function m(){K("onfinish"),t.removeListener("close",p),w()}l(m,"onfinish"),t.once("finish",m);function w(){K("unpipe"),r.unpipe(t)}return l(w,"unpipe"),t.emit("pipe",r),i.flowing||(K("pipe resume"),r.resume()),t};function vM(t){return l(function(){var r=t._readableState;K("pipeOnDrain",r.awaitDrain),r.awaitDrain&&r.awaitDrain--,r.awaitDrain===0&&lT(t,"data")&&(r.flowing=!0,Ym(t))},"pipeOnDrainFunctionResult")}l(vM,"pipeOnDrain");ee.prototype.unpipe=function(t){var e=this._readableState,r={hasUnpiped:!1};if(e.pipesCount===0)return this;if(e.pipesCount===1)return t&&t!==e.pipes?this:(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,r),this);if(!t){var i=e.pipes,n=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var s=0;s<n;s++)i[s].emit("unpipe",this,{hasUnpiped:!1});return this}var a=mT(e.pipes,t);return a===-1?this:(e.pipes.splice(a,1),e.pipesCount-=1,e.pipesCount===1&&(e.pipes=e.pipes[0]),t.emit("unpipe",this,r),this)};ee.prototype.on=function(t,e){var r=bo.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,K("on readable",i.length,i.reading),i.length?If(this):i.reading||process.nextTick(EM,this)),r};ee.prototype.addListener=ee.prototype.on;ee.prototype.removeListener=function(t,e){var r=bo.prototype.removeListener.call(this,t,e);return t==="readable"&&process.nextTick(dT,this),r};ee.prototype.removeAllListeners=function(t){var e=bo.prototype.removeAllListeners.apply(this,arguments);return(t==="readable"||t===void 0)&&process.nextTick(dT,this),e};function dT(t){var e=t._readableState;e.readableListening=t.listenerCount("readable")>0,e.resumeScheduled&&!e.paused?e.flowing=!0:t.listenerCount("data")>0&&t.resume()}l(dT,"updateReadableListening");function EM(t){K("readable nexttick read 0"),t.read(0)}l(EM,"nReadingNextTick");ee.prototype.resume=function(){var t=this._readableState;return t.flowing||(K("resume"),t.flowing=!t.readableListening,SM(this,t)),t.paused=!1,this};function SM(t,e){e.resumeScheduled||(e.resumeScheduled=!0,process.nextTick(FM,t,e))}l(SM,"resume");function FM(t,e){K("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),Ym(t),e.flowing&&!e.reading&&t.read(0)}l(FM,"resume_");ee.prototype.pause=function(){return K("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(K("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this};function Ym(t){var e=t._readableState;for(K("flow",e.flowing);e.flowing&&t.read()!==null;);}l(Ym,"flow");ee.prototype.wrap=function(t){var e=this,r=this._readableState,i=!1;t.on("end",function(){if(K("wrapped end"),r.decoder&&!r.ended){var a=r.decoder.end();a&&a.length&&e.push(a)}e.push(null)}),t.on("data",function(a){if(K("wrapped data"),r.decoder&&(a=r.decoder.write(a)),!(r.objectMode&&a==null)&&!(!r.objectMode&&(!a||!a.length))){var f=e.push(a);f||(i=!0,t.pause())}});for(var n in t)this[n]===void 0&&typeof t[n]=="function"&&(this[n]=l(function(f){return l(function(){return t[f].apply(t,arguments)},"methodWrapReturnFunction")},"methodWrap")(n));for(var s=0;s<Vm.length;s++)t.on(Vm[s],this.emit.bind(this,Vm[s]));return this._read=function(a){K("wrapped _read",a),i&&(i=!1,t.resume())},this};typeof Symbol=="function"&&(ee.prototype[Symbol.asyncIterator]=function(){return zm===void 0&&(zm=rT()),zm(this)});Object.defineProperty(ee.prototype,"readableHighWaterMark",{enumerable:!1,get:l(function(){return this._readableState.highWaterMark},"get")});Object.defineProperty(ee.prototype,"readableBuffer",{enumerable:!1,get:l(function(){return this._readableState&&this._readableState.buffer},"get")});Object.defineProperty(ee.prototype,"readableFlowing",{enumerable:!1,get:l(function(){return this._readableState.flowing},"get"),set:l(function(e){this._readableState&&(this._readableState.flowing=e)},"set")});ee._fromList=pT;Object.defineProperty(ee.prototype,"readableLength",{enumerable:!1,get:l(function(){return this._readableState.length},"get")});function pT(t,e){if(e.length===0)return null;var 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(pT,"fromList");function Km(t){var e=t._readableState;K("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,process.nextTick(TM,e,t))}l(Km,"endReadable");function TM(t,e){if(K("endReadableNT",t.endEmitted,t.length),!t.endEmitted&&t.length===0&&(t.endEmitted=!0,e.readable=!1,e.emit("end"),t.autoDestroy)){var r=e._writableState;(!r||r.autoDestroy&&r.finished)&&e.destroy()}}l(TM,"endReadableNT");typeof Symbol=="function"&&(ee.from=function(t,e){return Hm===void 0&&(Hm=aT()),Hm(ee,t,e)});function mT(t,e){for(var r=0,i=t.length;r<i;r++)if(t[r]===e)return r;return-1}l(mT,"indexOf")});var Zm=T((Mz,gT)=>{"use strict";gT.exports=Fr;var $f=Yr().codes,RM=$f.ERR_METHOD_NOT_IMPLEMENTED,OM=$f.ERR_MULTIPLE_CALLBACK,kM=$f.ERR_TRANSFORM_ALREADY_TRANSFORMING,xM=$f.ERR_TRANSFORM_WITH_LENGTH_0,Bf=$i();bi()(Fr,Bf);function AM(t,e){var r=this._transformState;r.transforming=!1;var i=r.writecb;if(i===null)return this.emit("error",new OM);r.writechunk=null,r.writecb=null,e!=null&&this.push(e),i(t);var n=this._readableState;n.reading=!1,(n.needReadable||n.length<n.highWaterMark)&&this._read(n.highWaterMark)}l(AM,"afterTransform");function Fr(t){if(!(this instanceof Fr))return new Fr(t);Bf.call(this,t),this._transformState={afterTransform:AM.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,t&&(typeof t.transform=="function"&&(this._transform=t.transform),typeof t.flush=="function"&&(this._flush=t.flush)),this.on("prefinish",PM)}l(Fr,"Transform");function PM(){var t=this;typeof this._flush=="function"&&!this._readableState.destroyed?this._flush(function(e,r){yT(t,e,r)}):yT(this,null,null)}l(PM,"prefinish");Fr.prototype.push=function(t,e){return this._transformState.needTransform=!1,Bf.prototype.push.call(this,t,e)};Fr.prototype._transform=function(t,e,r){r(new RM("_transform()"))};Fr.prototype._write=function(t,e,r){var i=this._transformState;if(i.writecb=r,i.writechunk=t,i.writeencoding=e,!i.transforming){var n=this._readableState;(i.needTransform||n.needReadable||n.length<n.highWaterMark)&&this._read(n.highWaterMark)}};Fr.prototype._read=function(t){var e=this._transformState;e.writechunk!==null&&!e.transforming?(e.transforming=!0,this._transform(e.writechunk,e.writeencoding,e.afterTransform)):e.needTransform=!0};Fr.prototype._destroy=function(t,e){Bf.prototype._destroy.call(this,t,function(r){e(r)})};function yT(t,e,r){if(e)return t.emit("error",e);if(r!=null&&t.push(r),t._writableState.length)throw new xM;if(t._transformState.transforming)throw new kM;return t.push(null)}l(yT,"done")});var vT=T((Lz,_T)=>{"use strict";_T.exports=_o;var bT=Zm();bi()(_o,bT);function _o(t){if(!(this instanceof _o))return new _o(t);bT.call(this,t)}l(_o,"PassThrough");_o.prototype._transform=function(t,e,r){r(null,t)}});var RT=T((Uz,TT)=>{"use strict";var Qm;function NM(t){var e=!1;return function(){e||(e=!0,t.apply(void 0,arguments))}}l(NM,"once");var FT=Yr().codes,DM=FT.ERR_MISSING_ARGS,CM=FT.ERR_STREAM_DESTROYED;function ET(t){if(t)throw t}l(ET,"noop");function IM(t){return t.setHeader&&typeof t.abort=="function"}l(IM,"isRequest");function $M(t,e,r,i){i=NM(i);var n=!1;t.on("close",function(){n=!0}),Qm===void 0&&(Qm=Af()),Qm(t,{readable:e,writable:r},function(a){if(a)return i(a);n=!0,i()});var s=!1;return function(a){if(!n&&!s){if(s=!0,IM(t))return t.abort();if(typeof t.destroy=="function")return t.destroy();i(a||new CM("pipe"))}}}l($M,"destroyer");function ST(t){t()}l(ST,"call");function BM(t,e){return t.pipe(e)}l(BM,"pipe");function MM(t){return!t.length||typeof t[t.length-1]!="function"?ET:t.pop()}l(MM,"popCallback");function jM(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];var i=MM(e);if(Array.isArray(e[0])&&(e=e[0]),e.length<2)throw new DM("streams");var n,s=e.map(function(a,f){var o=f<e.length-1,c=f>0;return $M(a,o,c,function(u){n||(n=u),u&&s.forEach(ST),!o&&(s.forEach(ST),i(n))})});return e.reduce(BM)}l(jM,"pipeline");TT.exports=jM});var OT=T((kt,Eo)=>{var vo=se("stream");process.env.READABLE_STREAM==="disable"&&vo?(Eo.exports=vo.Readable,Object.assign(Eo.exports,vo),Eo.exports.Stream=vo):(kt=Eo.exports=Mm(),kt.Stream=vo||kt,kt.Readable=kt,kt.Writable=Im(),kt.Duplex=$i(),kt.Transform=Zm(),kt.PassThrough=vT(),kt.finished=Af(),kt.pipeline=RT())});var zt=T(Ms=>{"use strict";Object.defineProperty(Ms,"__esModule",{value:!0});Ms.constants=Ms.SEP=void 0;Ms.SEP="/";Ms.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 uw=T(Fo=>{"use strict";Object.defineProperty(Fo,"__esModule",{value:!0});Fo.Stats=void 0;var cj=zt(),{S_IFMT:lj,S_IFDIR:fj,S_IFREG:uj,S_IFBLK:hj,S_IFCHR:dj,S_IFLNK:pj,S_IFIFO:mj,S_IFSOCK:wj}=cj.constants,tu=class tu{static build(e,r=!1){let i=new tu,{uid:n,gid:s,atime:a,mtime:f,ctime:o}=e,c=r?h=>BigInt(h):h=>h;i.uid=c(n),i.gid=c(s),i.rdev=c(e.rdev),i.blksize=c(4096),i.ino=c(e.ino),i.size=c(e.getSize()),i.blocks=c(1),i.atime=a,i.mtime=f,i.ctime=o,i.birthtime=o,i.atimeMs=c(a.getTime()),i.mtimeMs=c(f.getTime());let u=c(o.getTime());if(i.ctimeMs=u,i.birthtimeMs=u,r){i.atimeNs=BigInt(a.getTime())*BigInt(1e6),i.mtimeNs=BigInt(f.getTime())*BigInt(1e6);let h=BigInt(o.getTime())*BigInt(1e6);i.ctimeNs=h,i.birthtimeNs=h}return i.dev=c(0),i.mode=c(e.mode),i.nlink=c(e.nlink),i}_checkModeProperty(e){return(Number(this.mode)&lj)===e}isDirectory(){return this._checkModeProperty(fj)}isFile(){return this._checkModeProperty(uj)}isBlockDevice(){return this._checkModeProperty(hj)}isCharacterDevice(){return this._checkModeProperty(dj)}isSymbolicLink(){return this._checkModeProperty(pj)}isFIFO(){return this._checkModeProperty(mj)}isSocket(){return this._checkModeProperty(wj)}};l(tu,"Stats");var eu=tu;Fo.Stats=eu;Fo.default=eu});var hR=T(ru=>{"use strict";Object.defineProperty(ru,"__esModule",{value:!0});ru.Buffer=void 0;var yj=se("node:buffer");Object.defineProperty(ru,"Buffer",{enumerable:!0,get:l(function(){return yj.Buffer},"get")})});var si=T(ni=>{"use strict";Object.defineProperty(ni,"__esModule",{value:!0});ni.bufferFrom=ni.bufferAllocUnsafe=ni.Buffer=void 0;var iu=hR();Object.defineProperty(ni,"Buffer",{enumerable:!0,get:l(function(){return iu.Buffer},"get")});function dR(t,...e){return new iu.Buffer(t,...e)}l(dR,"bufferV0P12Ponyfill");var gj=iu.Buffer.allocUnsafe||dR;ni.bufferAllocUnsafe=gj;var bj=iu.Buffer.from||dR;ni.bufferFrom=bj});var dw=T(js=>{"use strict";Object.defineProperty(js,"__esModule",{value:!0});js.inherits=_j;js.promisify=vj;js.inspect=hw;js.format=Ej;function _j(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(_j,"inherits");function vj(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(vj,"promisify");function hw(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=>hw(r)).join(", ")} ]`:typeof t=="object"?`{ ${Object.entries(t).map(([r,i])=>`${r}: ${hw(i)}`).join(", ")} }`:String(t)}l(hw,"inspect");function Ej(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(Ej,"format")});var To=T(Ve=>{"use strict";Object.defineProperty(Ve,"__esModule",{value:!0});Ve.AssertionError=Ve.RangeError=Ve.TypeError=Ve.Error=void 0;Ve.message=wR;Ve.E=ai;var pw=dw(),pR=typeof Symbol>"u"?"_kCode":Symbol("code"),mR={};function ww(t){var e;return e=class extends t{constructor(i,...n){super(wR(i,n)),this.code=i,this[pR]=i,this.name=`${super.name} [${this[pR]}]`}},l(e,"NodeError"),e}l(ww,"makeNodeError");var nu=globalThis,yw=class yw extends nu.Error{constructor(e){if(typeof e!="object"||e===null)throw new Ve.TypeError("ERR_INVALID_ARG_TYPE","options","object");e.message?super(e.message):super(`${(0,pw.inspect)(e.actual).slice(0,128)} ${e.operator} ${(0,pw.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,Ve.Error.captureStackTrace(this,e.stackStartFunction)}};l(yw,"AssertionError");var mw=yw;Ve.AssertionError=mw;function wR(t,e){if(typeof t!="string")throw new Ve.Error("Error message key must be a string");let r=mR[t];if(!r)throw new Ve.Error(`An invalid error message key was used: ${t}.`);let i;if(typeof r=="function")i=r;else{if(i=pw.format,e===void 0||e.length===0)return r;e.unshift(r)}return String(i.apply(null,e))}l(wR,"message");function ai(t,e){mR[t]=typeof e=="function"?e:String(e)}l(ai,"E");Ve.Error=ww(nu.Error);Ve.TypeError=ww(nu.TypeError);Ve.RangeError=ww(nu.RangeError);ai("ERR_DIR_CLOSED","Directory handle was closed");ai("ERR_DIR_CONCURRENT_OPERATION","Cannot do synchronous work on directory handle with concurrent asynchronous operations");ai("ERR_INVALID_FILE_URL_HOST",'File URL host must be "localhost" or empty on %s');ai("ERR_INVALID_FILE_URL_PATH","File URL path %s");ai("ERR_INVALID_OPT_VALUE",(t,e)=>`The value "${String(e)}" is invalid for option "${t}"`);ai("ERR_INVALID_OPT_VALUE_ENCODING",t=>`The value "${String(t)}" is invalid for option "encoding"`);ai("ERR_INVALID_ARG_VALUE","Unable to open file as blob")});var Ro=T(Wi=>{"use strict";Object.defineProperty(Wi,"__esModule",{value:!0});Wi.ENCODING_UTF8=void 0;Wi.assertEncoding=Fj;Wi.strToEncoding=Tj;var gw=si(),Sj=To();Wi.ENCODING_UTF8="utf8";function Fj(t){if(t&&!gw.Buffer.isEncoding(t))throw new Sj.TypeError("ERR_INVALID_OPT_VALUE_ENCODING",t)}l(Fj,"assertEncoding");function Tj(t,e){return!e||e===Wi.ENCODING_UTF8?t:e==="buffer"?new gw.Buffer(t):new gw.Buffer(t).toString(e)}l(Tj,"strToEncoding")});var ou=T(Oo=>{"use strict";Object.defineProperty(Oo,"__esModule",{value:!0});Oo.Dirent=void 0;var Rj=zt(),Oj=Ro(),{S_IFMT:kj,S_IFDIR:xj,S_IFREG:Aj,S_IFBLK:Pj,S_IFCHR:Nj,S_IFLNK:Dj,S_IFIFO:Cj,S_IFSOCK:Ij}=Rj.constants,au=class au{constructor(){this.name="",this.path="",this.parentPath="",this.mode=0}static build(e,r){let i=new au,{mode:n}=e.getNode();return i.name=(0,Oj.strToEncoding)(e.getName(),r),i.mode=n,i.path=e.getParentPath(),i.parentPath=i.path,i}_checkModeProperty(e){return(this.mode&kj)===e}isDirectory(){return this._checkModeProperty(xj)}isFile(){return this._checkModeProperty(Aj)}isBlockDevice(){return this._checkModeProperty(Pj)}isCharacterDevice(){return this._checkModeProperty(Nj)}isSymbolicLink(){return this._checkModeProperty(Dj)}isFIFO(){return this._checkModeProperty(Cj)}isSocket(){return this._checkModeProperty(Ij)}};l(au,"Dirent");var su=au;Oo.Dirent=su;Oo.default=su});var Ls=T(Se=>{"use strict";Object.defineProperty(Se,"__esModule",{value:!0});Se.basename=Se.isAbsolute=Se.normalize=Se.dirname=Se.relative=Se.join=Se.posix=Se.sep=Se.resolve=void 0;var Rr=se("node:path");Object.defineProperty(Se,"resolve",{enumerable:!0,get:l(function(){return Rr.resolve},"get")});Object.defineProperty(Se,"sep",{enumerable:!0,get:l(function(){return Rr.sep},"get")});Object.defineProperty(Se,"posix",{enumerable:!0,get:l(function(){return Rr.posix},"get")});Object.defineProperty(Se,"join",{enumerable:!0,get:l(function(){return Rr.join},"get")});Object.defineProperty(Se,"relative",{enumerable:!0,get:l(function(){return Rr.relative},"get")});Object.defineProperty(Se,"dirname",{enumerable:!0,get:l(function(){return Rr.dirname},"get")});Object.defineProperty(Se,"normalize",{enumerable:!0,get:l(function(){return Rr.normalize},"get")});Object.defineProperty(Se,"isAbsolute",{enumerable:!0,get:l(function(){return Rr.isAbsolute},"get")});Object.defineProperty(Se,"basename",{enumerable:!0,get:l(function(){return Rr.basename},"get")})});var gR=T(yR=>{"use strict";Object.defineProperty(yR,"__esModule",{value:!0})});var _w=T(cu=>{"use strict";Object.defineProperty(cu,"__esModule",{value:!0});cu.flattenJSON=void 0;var bR=si(),bw=Ls(),$j=bw.posix?bw.posix.join:bw.join,Bj=l(t=>{let e={};function r(i,n){for(let s in n){let a=n[s],f=$j(i,s);typeof a=="string"||a instanceof bR.Buffer?e[f]=a:typeof a=="object"&&a!==null&&!(a instanceof bR.Buffer)&&Object.keys(a).length>0?r(f,a):e[f]=null}}return l(r,"flatten"),r("",t),e},"flattenJSON");cu.flattenJSON=Bj});var fu=T(lu=>{"use strict";Object.defineProperty(lu,"__esModule",{value:!0});lu.createProcess=_R;var Mj=l(()=>{if(typeof process<"u")return process;try{return se("process")}catch{return}},"maybeReturnProcess");function _R(){let t=Mj()||{};return t.cwd||(t.cwd=()=>"/"),t.emitWarning||(t.emitWarning=(e,r)=>{console.warn(`${r}${r?": ":""}${e}`)}),t.env||(t.env={}),t}l(_R,"createProcess");lu.default=_R()});var Sw=T(du=>{"use strict";Object.defineProperty(du,"__esModule",{value:!0});du.Node=void 0;var jj=da(),SR=fu(),kr=si(),Lj=zt(),{S_IFMT:Or,S_IFDIR:qj,S_IFREG:Uj,S_IFLNK:vR,S_IFCHR:Wj}=Lj.constants,uu=l(()=>SR.default.getuid?.()??0,"getuid"),hu=l(()=>SR.default.getgid?.()??0,"getgid"),ER=(0,kr.bufferAllocUnsafe)(0),Ew=class Ew{constructor(e,r=438){this.changes=new jj.FanOut,this._uid=uu(),this._gid=hu(),this._atime=new Date,this._mtime=new Date,this._ctime=new Date,this.buf=ER,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&~Or}set perm(e){this.mode=this.mode&Or|e&~Or,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,kr.bufferFrom)(e,"utf8"))}getBuffer(){return this.atime=new Date,this.buf||(this.buf=(0,kr.bufferAllocUnsafe)(0)),(0,kr.bufferFrom)(this.buf.subarray(0,this.size))}setBuffer(e){let r=(0,kr.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&Or)===Uj}isDirectory(){return(this.mode&Or)===qj}isSymlink(){return(this.mode&Or)===vR}isCharacterDevice(){return(this.mode&Or)===Wj}makeSymlink(e){this.mode=vR|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 f=Math.max(this.capacity*2,64);for(;f<a;)f*=2;let o=(0,kr.bufferAllocUnsafe)(f);this.size>0&&this.buf.copy(o,0,0,this.size),this.buf=o,this.capacity=f}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 kr.Buffer?e:kr.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=ER,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,kr.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&Or|e&~Or,this.touch()}chown(e,r){this.uid=e,this.gid=r,this.touch()}touch(){this.mtime=new Date,this.changes.emit(["modify"])}canRead(e=uu(),r=hu()){return!!(this.perm&4||r===this.gid&&this.perm&32||e===this.uid&&this.perm&256)}canWrite(e=uu(),r=hu()){return!!(this.perm&2||r===this.gid&&this.perm&16||e===this.uid&&this.perm&128)}canExecute(e=uu(),r=hu()){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(Ew,"Node");var vw=Ew;du.Node=vw});var Tw=T(pu=>{"use strict";Object.defineProperty(pu,"__esModule",{value:!0});pu.Link=void 0;var zj=zt(),Hj=da(),{S_IFREG:Vj}=zj.constants,ko=class ko{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 Hj.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(Vj|438)){let i=new ko(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 ko(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(ko,"Link");var Fw=ko;pu.Link=Fw});var kw=T(mu=>{"use strict";Object.defineProperty(mu,"__esModule",{value:!0});mu.File=void 0;var Gj=zt(),{O_APPEND:Kj}=Gj.constants,Ow=class Ow{constructor(e,r,i,n){this.link=e,this.node=r,this.flags=i,this.fd=n,this.position=0,this.flags&Kj&&(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(Ow,"File");var Rw=Ow;mu.File=Rw});var Ws=T(Us=>{"use strict";Object.defineProperty(Us,"__esModule",{value:!0});Us.FLAGS=Us.ERRSTR=void 0;var Jj=zt();Us.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:FR,O_WRONLY:wu,O_RDWR:qs,O_CREAT:oi,O_EXCL:yu,O_TRUNC:gu,O_APPEND:bu,O_SYNC:TR}=Jj.constants,RR;(function(t){t[t.r=FR]="r",t[t["r+"]=qs]="r+",t[t.rs=FR|TR]="rs",t[t.sr=t.rs]="sr",t[t["rs+"]=qs|TR]="rs+",t[t["sr+"]=t["rs+"]]="sr+",t[t.w=wu|oi|gu]="w",t[t.wx=wu|oi|gu|yu]="wx",t[t.xw=t.wx]="xw",t[t["w+"]=qs|oi|gu]="w+",t[t["wx+"]=qs|oi|gu|yu]="wx+",t[t["xw+"]=t["wx+"]]="xw+",t[t.a=wu|bu|oi]="a",t[t.ax=wu|bu|oi|yu]="ax",t[t.xa=t.ax]="xa",t[t["a+"]=qs|bu|oi]="a+",t[t["ax+"]=qs|bu|oi|yu]="ax+",t[t["xa+"]=t["ax+"]]="xa+"})(RR||(Us.FLAGS=RR={}))});var Aw=T(xw=>{"use strict";Object.defineProperty(xw,"__esModule",{value:!0});xw.default=typeof queueMicrotask=="function"?queueMicrotask:t=>Promise.resolve().then(()=>t()).catch(()=>{})});var Su=T(De=>{"use strict";Object.defineProperty(De,"__esModule",{value:!0});De.filenameToSteps=De.resolve=De.unixify=De.isWin=void 0;De.isFd=kR;De.validateFd=sL;De.dataToBuffer=aL;var vu=Ls(),_u=si(),OR=fu(),Xj=Ro(),Yj=Ws();De.isWin=OR.default.platform==="win32";var Zj=vu.resolve,Qj=vu.posix?vu.posix.sep:vu.sep,eL=l((t,e)=>{let r=t[e];return e>0&&(r==="/"||De.isWin&&r==="\\")},"isSeparator"),tL=l(t=>{let e=t.length-1;if(e<2)return t;for(;eL(t,e);)e--;return t.substr(0,e+1)},"removeTrailingSeparator"),rL=l((t,e)=>{if(typeof t!="string")throw new TypeError("expected a string");return t=t.replace(/[\\\/]+/g,"/"),e!==!1&&(t=tL(t)),t},"normalizePath"),iL=l((t,e=!0)=>De.isWin?(t=rL(t,e),t.replace(/^([a-zA-Z]+:|\.\/)/,"")):t,"unixify");De.unixify=iL;var Eu=l((t,e=OR.default.cwd())=>Zj(e,t),"resolve");De.resolve=Eu;if(De.isWin){let t=Eu;De.resolve=Eu=l((e,r)=>(0,De.unixify)(t(e,r)),"resolve")}var nL=l((t,e)=>{let i=Eu(t,e).substring(1);return i?i.split(Qj):[]},"filenameToSteps");De.filenameToSteps=nL;function kR(t){return t>>>0===t}l(kR,"isFd");function sL(t){if(!kR(t))throw TypeError(Yj.ERRSTR.FD)}l(sL,"validateFd");function aL(t,e=Xj.ENCODING_UTF8){return _u.Buffer.isBuffer(t)?t:t instanceof Uint8Array?(0,_u.bufferFrom)(t):e==="buffer"?(0,_u.bufferFrom)(String(t),"utf8"):(0,_u.bufferFrom)(String(t),e)}l(aL,"dataToBuffer")});var ci=T(xe=>{"use strict";Object.defineProperty(xe,"__esModule",{value:!0});xe.getWriteSyncArgs=xe.getWriteArgs=xe.bufToUint8=void 0;xe.promisify=cL;xe.validateCallback=xR;xe.modeToNumber=AR;xe.nullCheck=PR;xe.pathToFilename=uL;xe.createError=OL;xe.genRndStr6=kL;xe.flagsToNumber=xL;xe.streamToBuffer=AL;xe.bufferToEncoding=CL;xe.isReadableStream=IL;var xo=Ws(),Pw=To(),Nw=si(),oL=Aw(),Fu=Su();function cL(t,e,r=i=>i){return(...i)=>new Promise((n,s)=>{t[e].bind(t)(...i,(a,f)=>a?s(a):n(r(f)))})}l(cL,"promisify");function xR(t){if(typeof t!="function")throw TypeError(xo.ERRSTR.CB);return t}l(xR,"validateCallback");function lL(t,e){if(typeof t=="number")return t;if(typeof t=="string")return parseInt(t,8);if(e)return AR(e)}l(lL,"_modeToNumber");function AR(t,e){let r=lL(t,e);if(typeof r!="number"||isNaN(r))throw new TypeError(xo.ERRSTR.MODE_INT);return r}l(AR,"modeToNumber");function PR(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,oL.default)(()=>{e(r)}),!1}return!0}l(PR,"nullCheck");function fL(t){if(t.hostname!=="")throw new Pw.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 Pw.TypeError("ERR_INVALID_FILE_URL_PATH","must not include encoded / characters")}return decodeURIComponent(e)}l(fL,"getPathFromURLPosix");function uL(t){if(t instanceof Uint8Array&&(t=(0,Nw.bufferFrom)(t)),typeof t!="string"&&!Nw.Buffer.isBuffer(t)){try{if(!(t instanceof se("url").URL))throw new TypeError(xo.ERRSTR.PATH_STR)}catch{throw new TypeError(xo.ERRSTR.PATH_STR)}t=fL(t)}let e=String(t);return PR(e),e}l(uL,"pathToFilename");var hL="ENOENT",dL="EBADF",pL="EINVAL",mL="EPERM",wL="EPROTO",yL="EEXIST",gL="ENOTDIR",bL="EMFILE",_L="EACCES",vL="EISDIR",EL="ENOTEMPTY",SL="ENOSYS",FL="ERR_FS_EISDIR",TL="ERR_OUT_OF_RANGE";function RL(t,e="",r="",i=""){let n="";switch(r&&(n=` '${r}'`),i&&(n+=` -> '${i}'`),t){case hL:return`ENOENT: no such file or directory, ${e}${n}`;case dL:return`EBADF: bad file descriptor, ${e}${n}`;case pL:return`EINVAL: invalid argument, ${e}${n}`;case mL:return`EPERM: operation not permitted, ${e}${n}`;case wL:return`EPROTO: protocol error, ${e}${n}`;case yL:return`EEXIST: file already exists, ${e}${n}`;case gL:return`ENOTDIR: not a directory, ${e}${n}`;case vL:return`EISDIR: illegal operation on a directory, ${e}${n}`;case _L:return`EACCES: permission denied, ${e}${n}`;case EL:return`ENOTEMPTY: directory not empty, ${e}${n}`;case bL:return`EMFILE: too many open files, ${e}${n}`;case SL:return`ENOSYS: function not implemented, ${e}${n}`;case FL:return`[ERR_FS_EISDIR]: Path is a directory: ${e} returned EISDIR (is a directory) ${r}`;case TL:return`[ERR_OUT_OF_RANGE]: value out of range, ${e}${n}`;default:return`${t}: error occurred, ${e}${n}`}}l(RL,"formatError");function OL(t,e="",r="",i="",n=Error){let s=new n(RL(t,e,r,i));return s.code=t,r&&(s.path=r),s}l(OL,"createError");function kL(){return Math.random().toString(36).slice(2,8).padEnd(6,"0")}l(kL,"genRndStr6");function xL(t){if(typeof t=="number")return t;if(typeof t=="string"){let e=xo.FLAGS[t];if(typeof e<"u")return e}throw new Pw.TypeError("ERR_INVALID_OPT_VALUE","flags",t)}l(xL,"flagsToNumber");function AL(t){let e=[];return new Promise((r,i)=>{t.on("data",n=>e.push(n)),t.on("end",()=>r(Nw.Buffer.concat(e))),t.on("error",i)})}l(AL,"streamToBuffer");var PL=l(t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),"bufToUint8");xe.bufToUint8=PL;var NL=l((t,e,r,i,n,s)=>{(0,Fu.validateFd)(t);let a=0,f,o=null,c,u,h=typeof e,d=typeof r,p=typeof i,m=typeof n;h!=="string"?d==="function"?u=r:p==="function"?(a=r|0,u=i):m==="function"?(a=r|0,f=i,u=n):(a=r|0,f=i,o=n,u=s):d==="function"?u=r:p==="function"?(o=r,u=i):m==="function"&&(o=r,c=i,u=n);let w=(0,Fu.dataToBuffer)(e,c);h!=="string"?typeof f>"u"&&(f=w.length):(a=0,f=w.length);let y=xR(u);return[t,h==="string",w,a,f,o,y]},"getWriteArgs");xe.getWriteArgs=NL;var DL=l((t,e,r,i,n)=>{(0,Fu.validateFd)(t);let s,a,f,o,c=typeof e!="string";c?(a=(r||0)|0,f=i,o=n):(o=r,s=i);let u=(0,Fu.dataToBuffer)(e,s);return c?typeof f>"u"&&(f=u.length):(a=0,f=u.length),[t,u,a||0,f,o]},"getWriteSyncArgs");xe.getWriteSyncArgs=DL;function CL(t,e){return!e||e==="buffer"?t:t.toString(e)}l(CL,"bufferToEncoding");function IL(t){return t!==null&&typeof t=="object"&&typeof t.pipe=="function"&&typeof t.on=="function"&&t.readable===!0}l(IL,"isReadableStream")});var BR=T(Ou=>{"use strict";Object.defineProperty(Ou,"__esModule",{value:!0});Ou.Superblock=void 0;var Ce=Ls(),$L=Sw(),NR=Tw(),BL=kw(),ML=si(),DR=fu(),cr=zt(),CR=Ws(),V=ci(),Ht=Su(),jL=_w(),zs=Ce.posix?Ce.posix.sep:Ce.sep,IR=Ce.posix?Ce.posix.relative:Ce.relative,LL=Ce.posix?Ce.posix.join:Ce.join,{O_RDONLY:Dw,O_WRONLY:Tu,O_RDWR:Cw,O_CREAT:$R,O_EXCL:qL,O_TRUNC:UL,O_APPEND:WL,O_DIRECTORY:zL}=cr.constants,Hs=class Hs{static fromJSON(e,r){let i=new Hs;return i.fromJSON(e,r),i}static fromNestedJSON(e,r){let i=new Hs;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 f=this.openFile(i,n,s,a);if(!f)throw(0,V.createError)("ENOENT","open",i);return f.fd},this.writeFile=(i,n,s,a)=>{let f=typeof i=="number",o;f?o=i:o=this.open((0,V.pathToFilename)(i),s,a);let c=0,u=n.length,h=s&WL?void 0:0;try{for(;u>0;){let d=this.write(o,n,c,u,h);c+=d,u-=d,h!==void 0&&(h+=d)}}finally{f||this.close(o)}},this.read=(i,n,s,a,f)=>{if(n.byteLength<a)throw(0,V.createError)("ERR_OUT_OF_RANGE","read",void 0,void 0,RangeError);let o=this.getFileByFdOrThrow(i);if(o.node.isSymlink())throw(0,V.createError)("EPERM","read",o.link.getPath());return o.read(n,Number(s),Number(a),f===-1||typeof f!="number"?void 0:f)},this.readv=(i,n,s)=>{let a=this.getFileByFdOrThrow(i),f=s??void 0;f===-1&&(f=void 0);let o=0;for(let c of n){let u=a.read(c,0,c.byteLength,f);if(f=void 0,o+=u,u<c.byteLength)break}return o},this.link=(i,n)=>{let s;try{s=this.getLinkOrThrow(i,"link")}catch(u){throw u.code&&(u=(0,V.createError)(u.code,"link",i,n)),u}let a=(0,Ce.dirname)(n),f;try{f=this.getLinkOrThrow(a,"link")}catch(u){throw u.code&&(u=(0,V.createError)(u.code,"link",i,n)),u}let o=(0,Ce.basename)(n);if(f.getChild(o))throw(0,V.createError)("EEXIST","link",i,n);let c=s.getNode();c.nlink++,f.createChild(o,c)},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,Ht.filenameToSteps)(n),a;try{a=this.getLinkParentAsDirOrThrow(s)}catch(u){throw u.code&&(u=(0,V.createError)(u.code,"symlink",i,n)),u}let f=s[s.length-1];if(a.getChild(f))throw(0,V.createError)("EEXIST","symlink",i,n);let o=a.getNode();if(!o.canExecute()||!o.canWrite())throw(0,V.createError)("EACCES","symlink",i,n);let c=a.createChild(f);return c.getNode().makeSymlink(i),c},this.rename=(i,n)=>{let s;try{s=this.getResolvedLinkOrThrow(i)}catch(h){throw h.code&&(h=(0,V.createError)(h.code,"rename",i,n)),h}let a;try{a=this.getLinkParentAsDirOrThrow(n)}catch(h){throw h.code&&(h=(0,V.createError)(h.code,"rename",i,n)),h}let f=s.parent;if(!f)throw(0,V.createError)("EINVAL","rename",i,n);let o=f.getNode(),c=a.getNode();if(!o.canExecute()||!o.canWrite()||!c.canExecute()||!c.canWrite())throw(0,V.createError)("EACCES","rename",i,n);f.deleteChild(s);let u=(0,Ce.basename)(n);s.name=u,s.steps=[...a.steps,u],a.setChild(s.getName(),s)},this.mkdir=(i,n)=>{let s=(0,Ht.filenameToSteps)(i);if(!s.length)throw(0,V.createError)("EEXIST","mkdir",i);let a=this.getLinkParentAsDirOrThrow(i,"mkdir"),f=s[s.length-1];if(a.getChild(f))throw(0,V.createError)("EEXIST","mkdir",i);let o=a.getNode();if(!o.canWrite()||!o.canExecute())throw(0,V.createError)("EACCES","mkdir",i);a.createChild(f,this.createNode(cr.constants.S_IFDIR|n))},this.mkdirp=(i,n)=>{let s=!1,a=(0,Ht.filenameToSteps)(i),f=null,o=a.length;for(o=a.length;o>=0&&(f=this.getResolvedLink(a.slice(0,o)),!f);o--);for(f||(f=this.root,o=0),f=this.getResolvedLinkOrThrow(Ce.sep+a.slice(0,o).join(Ce.sep),"mkdir"),o;o<a.length;o++){let c=f.getNode();if(c.isDirectory()){if(!c.canExecute()||!c.canWrite())throw(0,V.createError)("EACCES","mkdir",i)}else throw(0,V.createError)("ENOTDIR","mkdir",i);s=!0,f=f.createChild(a[o],this.createNode(cr.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,V.createError)("ENOTEMPTY","rmdir",i);this.deleteLink(s)},this.rm=(i,n=!1,s=!1)=>{let a;try{a=this.getResolvedLinkOrThrow(i,"stat")}catch(f){if(f.code==="ENOENT"&&n)return;throw f}if(a.getNode().isDirectory()&&!s)throw(0,V.createError)("ERR_FS_EISDIR","rm",i);if(!a.parent?.getNode().canWrite())throw(0,V.createError)("EACCES","rm",i);this.deleteLink(a)},this.close=i=>{(0,Ht.validateFd)(i);let n=this.getFileByFdOrThrow(i,"close");this.closeFile(n)};let r=this.createLink();r.setNode(this.createNode(cr.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 NR.Link(this,void 0,"");if(!r)throw new Error("createLink: name cannot be empty");let s=n??(i?511:438),f=n&&n&cr.constants.S_IFMT?n&cr.constants.S_IFMT:i?cr.constants.S_IFDIR:cr.constants.S_IFREG,o=s&~cr.constants.S_IFMT|f;return e.createChild(r,this.createNode(o))}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:Hs.fd--}createNode(e){let r=new $L.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,f;e instanceof NR.Link?(a=e.steps,f=zs+a.join(zs)):typeof e=="string"?(a=(0,Ht.filenameToSteps)(e),f=e):(a=e,f=zs+a.join(zs));let o=this.root,c=0;for(;c<a.length;){let u=o.getNode();if(u.isDirectory()){if(n&&!u.canExecute())throw(0,V.createError)("EACCES",s,f)}else if(c<a.length-1)throw(0,V.createError)("ENOTDIR",s,f);if(o=o.getChild(a[c])??null,!o){if(i)throw(0,V.createError)("ENOENT",s,f);return null}if(u=o?.getNode(),u.isSymlink()&&(r||c<a.length-1)){let h=(0,Ce.isAbsolute)(u.symlink)?u.symlink:LL((0,Ce.dirname)(o.getPath()),u.symlink);a=(0,Ht.filenameToSteps)(h).concat(a.slice(c+1)),o=this.root,c=0;continue}if(i&&!u.isDirectory()&&c<a.length-1){let h=DR.default.platform==="win32"?"ENOENT":"ENOTDIR";throw(0,V.createError)(h,s,f)}c++}return o}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,V.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,Ht.filenameToSteps)(e)).slice(0,-1),n=zs+i.join(zs),s=this.getLinkOrThrow(n,r);if(!s.getNode().isDirectory())throw(0,V.createError)("ENOTDIR",r,n);return s}getFileByFd(e){return this.fds[String(e)]}getFileByFdOrThrow(e,r){if(!(0,Ht.isFd)(e))throw TypeError(CR.ERRSTR.FD);let i=this.getFileByFd(e);if(!i)throw(0,V.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 o of a.keys()){if(o==="."||o==="..")continue;s=!1;let c=e.getChild(o);if(!c)throw new Error("_toJSON: unexpected undefined");let u=c.getNode();if(u.isFile()){let h=c.getPath();i&&(h=IR(i,h)),r[h]=n?u.getBuffer():u.getString()}else u.isDirectory()&&this._toJSON(c,r,i,n)}let f=e.getPath();return i&&(f=IR(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 a of e){let f=(0,V.pathToFilename)(a),o=this.getResolvedLink(f);o&&s.push(o)}}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=DR.default.cwd()){for(let i in e){let n=e[i];if(i=(0,Ht.resolve)(i,r),typeof n=="string"||n instanceof ML.Buffer){let s=(0,Ce.dirname)(i);this.mkdirp(s,511);let a=(0,Ht.dataToBuffer)(n);this.writeFile(i,a,CR.FLAGS.w,438)}else this.mkdirp(i,511)}}fromNestedJSON(e,r){this.fromJSON((0,jL.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(cr.constants.S_IFDIR|511))}mountSync(e,r){this.fromJSON(r,e)}openLink(e,r,i=!0){if(this.openFiles>=this.maxFiles)throw(0,V.createError)("EMFILE","open",e.getPath());let n=e;i&&(n=this.getResolvedLinkOrThrow(e.getPath(),"open"));let s=n.getNode();if(s.isDirectory()){if((r&(Dw|Cw|Tu))!==Dw)throw(0,V.createError)("EISDIR","open",e.getPath())}else if(r&zL)throw(0,V.createError)("ENOTDIR","open",e.getPath());if((r&(Dw|Cw|Tu))!==Tu&&!s.canRead()||r&(Tu|Cw)&&!s.canWrite())throw(0,V.createError)("EACCES","open",e.getPath());let a=new BL.File(e,s,r,this.newFdNumber());return this.fds[a.fd]=a,this.openFiles++,r&UL&&a.truncate(),a}openFile(e,r,i,n=!0){let s=(0,Ht.filenameToSteps)(e),a;try{if(a=n?this.getResolvedLinkOrThrow(e,"open"):this.getLinkOrThrow(e,"open"),a&&r&$R&&r&qL)throw(0,V.createError)("EEXIST","open",e)}catch(f){if(f.code==="ENOENT"&&r&$R){let o=(0,Ce.dirname)(e),c=this.getResolvedLinkOrThrow(o),u=c.getNode();if(!u.isDirectory())throw(0,V.createError)("ENOTDIR","open",e);if(!u.canExecute()||!u.canWrite())throw(0,V.createError)("EACCES","open",e);i??(i=438),a=this.createLink(c,s[s.length-1],!1,i)}else throw f}if(a)return this.openLink(a,r,n);throw(0,V.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,V.createError)("EBADF","write",a.link.getPath());return a.write(r,i,n,s===-1||typeof s!="number"?void 0:s)}};l(Hs,"Superblock");var Ru=Hs;Ou.Superblock=Ru;Ru.fd=2147483647});var jR=T(At=>{"use strict";Object.defineProperty(At,"__esModule",{value:!0});At.Superblock=At.File=At.Link=At.Node=void 0;var MR=(Yo(),th(Xo));MR.__exportStar(gR(),At);MR.__exportStar(_w(),At);var HL=Sw();Object.defineProperty(At,"Node",{enumerable:!0,get:l(function(){return HL.Node},"get")});var VL=Tw();Object.defineProperty(At,"Link",{enumerable:!0,get:l(function(){return VL.Link},"get")});var GL=kw();Object.defineProperty(At,"File",{enumerable:!0,get:l(function(){return GL.File},"get")});var KL=BR();Object.defineProperty(At,"Superblock",{enumerable:!0,get:l(function(){return KL.Superblock},"get")})});var LR=T(Ao=>{"use strict";Object.defineProperty(Ao,"__esModule",{value:!0});Ao.StatFs=void 0;var xu=class xu{static build(e,r=!1){let i=new xu,n=r?u=>BigInt(u):u=>u;i.type=n(2240043254),i.bsize=n(4096);let s=Object.keys(e.inodes).length,a=1e6,f=Math.min(s*2,a),o=a-f;i.blocks=n(a),i.bfree=n(o),i.bavail=n(o);let c=1e6;return i.files=n(c),i.ffree=n(c-s),i}};l(xu,"StatFs");var ku=xu;Ao.StatFs=ku;Ao.default=ku});var qR=T(Iw=>{"use strict";Object.defineProperty(Iw,"__esModule",{value:!0});function JL(t,e,r){let i=setTimeout.apply(globalThis,arguments);return i&&typeof i=="object"&&typeof i.unref=="function"&&i.unref(),i}l(JL,"setTimeoutUnref");Iw.default=JL});var WR=T(Vs=>{"use strict";Object.defineProperty(Vs,"__esModule",{value:!0});Vs.Writable=Vs.Readable=void 0;var UR=se("node:stream");Object.defineProperty(Vs,"Readable",{enumerable:!0,get:l(function(){return UR.Readable},"get")});Object.defineProperty(Vs,"Writable",{enumerable:!0,get:l(function(){return UR.Writable},"get")})});var $w=T(Au=>{"use strict";Object.defineProperty(Au,"__esModule",{value:!0});Au.EventEmitter=void 0;var XL=se("node:events");Object.defineProperty(Au,"EventEmitter",{enumerable:!0,get:l(function(){return XL.EventEmitter},"get")})});var zR=T(Pu=>{"use strict";Object.defineProperty(Pu,"__esModule",{value:!0});Pu.FileHandle=void 0;var Ge=ci(),YL=$w(),Mw=class Mw extends YL.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,Ge.promisify)(this.fs,"appendFile")(this.fd,e,r)}chmod(e){return(0,Ge.promisify)(this.fs,"fchmod")(this.fd,e)}chown(e,r){return(0,Ge.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,Ge.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,Ge.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 a=>{try{let f=a.byobRequest?.view;if(!f){let c=new Uint8Array(16384),u=await this.read(c,0,c.length,n);if(u.bytesRead===0){a.close(),s();return}n+=u.bytesRead,a.enqueue(c.slice(0,u.bytesRead));return}let o=await this.read(f,f.byteOffset,f.byteLength,n);if(o.bytesRead===0){a.close(),s();return}n+=o.bytesRead,a.byobRequest.respond(o.bytesRead)}catch(f){a.error(f),s()}},"pull"),cancel:l(async()=>{s()},"cancel")})}async read(e,r,i,n){let s=n??this.position,a=await(0,Ge.promisify)(this.fs,"read",f=>({bytesRead:f,buffer:e}))(this.fd,e,r,i,s);return n==null&&(this.position+=a.bytesRead),a}readv(e,r){return(0,Ge.promisify)(this.fs,"readv",i=>({bytesRead:i,buffers:e}))(this.fd,e,r)}readFile(e){return(0,Ge.promisify)(this.fs,"readFile")(this.fd,e)}stat(e){return(0,Ge.promisify)(this.fs,"fstat")(this.fd,e)}sync(){return(0,Ge.promisify)(this.fs,"fsync")(this.fd)}truncate(e){return(0,Ge.promisify)(this.fs,"ftruncate")(this.fd,e)}utimes(e,r){return(0,Ge.promisify)(this.fs,"futimes")(this.fd,e,r)}async write(e,r,i,n){let s=typeof n!="number",a=s?this.position:n,f=await(0,Ge.promisify)(this.fs,"write",o=>({bytesWritten:o,buffer:e}))(this.fd,e,r,i,a);return s&&(this.position+=f.bytesWritten),f}writev(e,r){return(0,Ge.promisify)(this.fs,"writev",i=>({bytesWritten:i,buffers:e}))(this.fd,e,r)}writeFile(e,r){return(0,Ge.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,Ge.promisify)(this.fs,"close")(this.fd).then(this.closeResolve,this.closeReject))}};l(Mw,"FileHandle");var Bw=Mw;Pu.FileHandle=Bw});var HR=T(Nu=>{"use strict";Object.defineProperty(Nu,"__esModule",{value:!0});Nu.FsPromises=void 0;var ie=ci(),ZL=zt(),qw=class qw{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(qw,"FSWatchAsyncIterator");var jw=qw,Uw=class Uw{constructor(e,r){this.fs=e,this.FileHandle=r,this.constants=ZL.constants,this.cp=(0,ie.promisify)(this.fs,"cp"),this.opendir=(0,ie.promisify)(this.fs,"opendir"),this.statfs=(0,ie.promisify)(this.fs,"statfs"),this.lutimes=(0,ie.promisify)(this.fs,"lutimes"),this.glob=(0,ie.promisify)(this.fs,"glob"),this.access=(0,ie.promisify)(this.fs,"access"),this.chmod=(0,ie.promisify)(this.fs,"chmod"),this.chown=(0,ie.promisify)(this.fs,"chown"),this.copyFile=(0,ie.promisify)(this.fs,"copyFile"),this.lchmod=(0,ie.promisify)(this.fs,"lchmod"),this.lchown=(0,ie.promisify)(this.fs,"lchown"),this.link=(0,ie.promisify)(this.fs,"link"),this.lstat=(0,ie.promisify)(this.fs,"lstat"),this.mkdir=(0,ie.promisify)(this.fs,"mkdir"),this.mkdtemp=(0,ie.promisify)(this.fs,"mkdtemp"),this.readdir=(0,ie.promisify)(this.fs,"readdir"),this.readlink=(0,ie.promisify)(this.fs,"readlink"),this.realpath=(0,ie.promisify)(this.fs,"realpath"),this.rename=(0,ie.promisify)(this.fs,"rename"),this.rmdir=(0,ie.promisify)(this.fs,"rmdir"),this.rm=(0,ie.promisify)(this.fs,"rm"),this.stat=(0,ie.promisify)(this.fs,"stat"),this.symlink=(0,ie.promisify)(this.fs,"symlink"),this.truncate=(0,ie.promisify)(this.fs,"truncate"),this.unlink=(0,ie.promisify)(this.fs,"unlink"),this.utimes=(0,ie.promisify)(this.fs,"utimes"),this.readFile=(i,n)=>(0,ie.promisify)(this.fs,"readFile")(i instanceof this.FileHandle?i.fd:i,n),this.appendFile=(i,n,s)=>(0,ie.promisify)(this.fs,"appendFile")(i instanceof this.FileHandle?i.fd:i,n,s),this.open=(i,n="r",s)=>(0,ie.promisify)(this.fs,"open",a=>new this.FileHandle(this.fs,a))(i,n,s),this.writeFile=(i,n,s)=>((0,ie.isReadableStream)(n)?(0,ie.streamToBuffer)(n):Promise.resolve(n)).then(f=>(0,ie.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 jw(this.fs,i,s)}}};l(Uw,"FsPromises");var Lw=Uw;Nu.FsPromises=Lw});var VR=T(Ke=>{"use strict";Object.defineProperty(Ke,"__esModule",{value:!0});Ke.newNotAllowedError=Ke.newTypeMismatchError=Ke.newNotFoundError=Ke.assertCanWrite=Ke.assertName=Ke.basename=Ke.ctx=void 0;var QL=l((t={})=>({separator:"/",syncHandleAllowed:!1,mode:"read",...t}),"ctx");Ke.ctx=QL;var eq=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");Ke.basename=eq;var tq=/^(\.{1,2})$|^(.*([\/\\]).*)$/,rq=l((t,e,r)=>{if(!t||tq.test(t))throw new TypeError(`Failed to execute '${e}' on '${r}': Name is not allowed.`)},"assertName");Ke.assertName=rq;var iq=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");Ke.assertCanWrite=iq;var nq=l(()=>new DOMException("A requested file or directory could not be found at the time an operation was processed.","NotFoundError"),"newNotFoundError");Ke.newNotFoundError=nq;var sq=l(()=>new DOMException("The path supplied exists, but was not an entry of requested type.","TypeMismatchError"),"newTypeMismatchError");Ke.newTypeMismatchError=sq;var aq=l(()=>new DOMException("Permission not granted.","NotAllowedError"),"newNotAllowedError");Ke.newNotAllowedError=aq});var GR=T(Po=>{"use strict";Object.defineProperty(Po,"__esModule",{value:!0});Po.toTreeSync=void 0;var oq=Hh(),cq=VR(),lq=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,a=" (...)";if(s>0){let o=t.readdirSync(i,{withFileTypes:!0});a=(0,oq.printTree)(n,o.map(c=>u=>c.isDirectory()?(0,Po.toTreeSync)(t,{dir:i+c.name,depth:s-1,tab:u}):c.isSymbolicLink()?""+c.name+" \u2192 "+t.readlinkSync(i+c.name):""+c.name))}return(0,cq.basename)(i,r)+r+a},"toTreeSync");Po.toTreeSync=lq});var XR=T(L=>{"use strict";Object.defineProperty(L,"__esModule",{value:!0});L.getWriteFileOptions=L.writeFileDefaults=L.getRealpathOptsAndCb=L.getRealpathOptions=L.getStatfsOptsAndCb=L.getStatfsOptions=L.getStatOptsAndCb=L.getStatOptions=L.getAppendFileOptsAndCb=L.getAppendFileOpts=L.getOpendirOptsAndCb=L.getOpendirOptions=L.getReaddirOptsAndCb=L.getReaddirOptions=L.getReadFileOptions=L.getRmOptsAndCb=L.getRmdirOptions=L.getDefaultOptsAndCb=L.getDefaultOpts=L.optsDefaults=L.getMkdirOptions=void 0;L.getOptions=JR;L.optsGenerator=xr;L.optsAndCbGenerator=zi;var Du=Ws(),fq=Ro(),Ww=ci(),KR={mode:511,recursive:!1},uq=l(t=>typeof t=="number"?Object.assign({},KR,{mode:t}):Object.assign({},KR,t),"getMkdirOptions");L.getMkdirOptions=uq;var hq=l(t=>`Expected options to be either an object or a string, but got ${t} instead`,"ERRSTR_OPTS");function JR(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(hq(i))}}else return t;return r.encoding!=="buffer"&&(0,fq.assertEncoding)(r.encoding),r}l(JR,"getOptions");function xr(t){return e=>JR(t,e)}l(xr,"optsGenerator");function zi(t){return(e,r)=>typeof e=="function"?[t(),e]:[t(e),(0,Ww.validateCallback)(r)]}l(zi,"optsAndCbGenerator");L.optsDefaults={encoding:"utf8"};L.getDefaultOpts=xr(L.optsDefaults);L.getDefaultOptsAndCb=zi(L.getDefaultOpts);var dq={recursive:!1},pq=l(t=>Object.assign({},dq,t),"getRmdirOptions");L.getRmdirOptions=pq;var mq=xr(L.optsDefaults);L.getRmOptsAndCb=zi(mq);var wq={flag:"r"};L.getReadFileOptions=xr(wq);var yq={encoding:"utf8",recursive:!1,withFileTypes:!1};L.getReaddirOptions=xr(yq);L.getReaddirOptsAndCb=zi(L.getReaddirOptions);var gq={encoding:"utf8",bufferSize:32,recursive:!1};L.getOpendirOptions=xr(gq);L.getOpendirOptsAndCb=zi(L.getOpendirOptions);var bq={encoding:"utf8",mode:438,flag:Du.FLAGS[Du.FLAGS.a]};L.getAppendFileOpts=xr(bq);L.getAppendFileOptsAndCb=zi(L.getAppendFileOpts);var _q={bigint:!1},vq=l((t={})=>Object.assign({},_q,t),"getStatOptions");L.getStatOptions=vq;var Eq=l((t,e)=>typeof t=="function"?[(0,L.getStatOptions)(),t]:[(0,L.getStatOptions)(t),(0,Ww.validateCallback)(e)],"getStatOptsAndCb");L.getStatOptsAndCb=Eq;var Sq={bigint:!1},Fq=l((t={})=>Object.assign({},Sq,t),"getStatfsOptions");L.getStatfsOptions=Fq;var Tq=l((t,e)=>typeof t=="function"?[(0,L.getStatfsOptions)(),t]:[(0,L.getStatfsOptions)(t),(0,Ww.validateCallback)(e)],"getStatfsOptsAndCb");L.getStatfsOptsAndCb=Tq;var Rq=L.optsDefaults;L.getRealpathOptions=xr(Rq);L.getRealpathOptsAndCb=zi(L.getRealpathOptions);L.writeFileDefaults={encoding:"utf8",mode:438,flag:Du.FLAGS[Du.FLAGS.w]};L.getWriteFileOptions=xr(L.writeFileDefaults)});var ZR=T(Cu=>{"use strict";Object.defineProperty(Cu,"__esModule",{value:!0});Cu.Dir=void 0;var YR=ci(),Oq=ou(),Hi=To(),Hw=class Hw{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]()),Oq.default.build(s,this.options.encoding)}while(!r);return null}close(e){if(e===void 0)return this.closed?Promise.reject(new Hi.Error("ERR_DIR_CLOSED")):new Promise((r,i)=>{this.close(n=>{n?i(n):r()})});if((0,YR.validateCallback)(e),this.closed){process.nextTick(e,new Hi.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 Hi.Error("ERR_DIR_CLOSED");if(this.operationQueue!==null)throw new Hi.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,YR.validateCallback)(e),this.closed){process.nextTick(e,new Hi.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 Hi.Error("ERR_DIR_CLOSED");if(this.operationQueue!==null)throw new Hi.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(Hw,"Dir");var zw=Hw;Cu.Dir=zw});var tO=T(Gw=>{"use strict";Object.defineProperty(Gw,"__esModule",{value:!0});Gw.globSync=Dq;var Vi=Ls(),kq=Jh(),QR=ci(),xq=Vi.posix.join,Aq=Vi.posix.relative,Pq=Vi.posix.resolve;function eO(t,e){return(0,kq.toRegex)(e).test(t)}l(eO,"matchesPattern");function Nq(t,e){return e?typeof e=="function"?e(t):(Array.isArray(e)?e:[e]).some(i=>eO(t,i)):!1}l(Nq,"isExcluded");function Vw(t,e,r,i,n=0){let s=[],a=i.maxdepth??1/0,f=i.cwd?(0,QR.pathToFilename)(i.cwd):process.cwd();if(n>a)return s;try{let o=t.readdirSync(e,{withFileTypes:!0});for(let c of o){let u=xq(e,c.name.toString()),h=Aq(f,u);if(Nq(h,i.exclude))continue;if(r.some(p=>eO(h,p))&&s.push(h),c.isDirectory()&&n<a){let p=Vw(t,u,r,i,n+1);s.push(...p)}}}catch{}return s}l(Vw,"walkDirectory");function Dq(t,e,r={}){let i=r.cwd?(0,QR.pathToFilename)(r.cwd):process.cwd(),n=Pq(i),s={cwd:n,exclude:r.exclude,maxdepth:r.maxdepth,withFileTypes:r.withFileTypes||!1},a=[];if(Vi.posix.isAbsolute(e)){let f=Vi.posix.dirname(e),o=Vi.posix.basename(e),c=Vw(t,f,[o],{...s,cwd:f});a.push(...c.map(u=>Vi.posix.resolve(f,u)))}else{let f=Vw(t,n,[e],s);a.push(...f)}return a=[...new Set(a)].sort(),a}l(Dq,"globSync")});var cO=T(mt=>{"use strict";Object.defineProperty(mt,"__esModule",{value:!0});mt.FSWatcher=mt.StatWatcher=mt.Volume=void 0;mt.pathToSteps=Xq;mt.dataToStr=Yq;mt.toUnixTimestamp=pt;var Fe=Ls(),Yw=jR(),Kw=uw(),Cq=ou(),Iq=LR(),Js=si(),ju=Aw(),$q=qR(),Lu=WR(),Bq=zt(),sO=$w(),Gi=Ro(),Mq=zR(),aO=dw(),jq=HR(),Lq=GR(),$u=Ws(),qq=To(),Q=XR(),P=ci(),Uq=ZR(),je=Su(),Wq=Fe.resolve,{O_SYMLINK:rO,F_OK:Jw,R_OK:zq,W_OK:Hq,X_OK:Vq,COPYFILE_EXCL:Gq,COPYFILE_FICLONE_FORCE:Kq}=Bq.constants,r5=Fe.posix?Fe.posix.sep:Fe.sep,Iu=Fe.posix?Fe.posix.relative:Fe.relative,Xw=Fe.posix?Fe.posix.join:Fe.join,iO=Fe.posix?Fe.posix.dirname:Fe.dirname,nO=Fe.posix?Fe.posix.normalize:Fe.normalize,Jq=128;function Xq(t){return(0,je.filenameToSteps)((0,P.pathToFilename)(t))}l(Xq,"pathToSteps");function Yq(t,e=Gi.ENCODING_UTF8){return Js.Buffer.isBuffer(t)?t.toString(e):t instanceof Uint8Array?(0,Js.bufferFrom)(t).toString(e):String(t)}l(Yq,"dataToStr");function pt(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(pt,"toUnixTimestamp");function Gs(t){if(typeof t!="number")throw TypeError($u.ERRSTR.UID)}l(Gs,"validateUid");function Ks(t){if(typeof t!="number")throw TypeError($u.ERRSTR.GID)}l(Ks,"validateGid");var Zw=class Zw{get promises(){if(this.promisesApi===null)throw new Error("Promise is not supported in this environment.");return this.promisesApi}constructor(e=new Yw.Superblock){this._core=e,this.promisesApi=new jq.FsPromises(this,Mq.FileHandle),this.openSync=(o,c,u=438)=>{let h=(0,P.modeToNumber)(u),d=(0,P.pathToFilename)(o),p=(0,P.flagsToNumber)(c);return this._core.open(d,p,h,!(p&rO))},this.open=(o,c,u,h)=>{let d=u,p=h;typeof u=="function"&&(d=438,p=u),d=d||438;let m=(0,P.modeToNumber)(d),w=(0,P.pathToFilename)(o),y=(0,P.flagsToNumber)(c);this.wrapAsync(this._core.open,[w,y,m,!(y&rO)],p)},this.closeSync=o=>{this._core.close(o)},this.close=(o,c)=>{(0,je.validateFd)(o);let u=this._core.getFileByFdOrThrow(o,"close");this.wrapAsync(this._core.close,[u.fd],c)},this.readSync=(o,c,u,h,d)=>((0,je.validateFd)(o),this._core.read(o,c,u,h,d)),this.read=(o,c,u,h,d,p)=>{if((0,P.validateCallback)(p),h===0)return(0,ju.default)(()=>{p&&p(null,0,c)});Promise.resolve().then(()=>{try{let m=this._core.read(o,c,u,h,d);p(null,m,c)}catch(m){p(m)}})},this.readv=(o,c,u,h)=>{let d=u,p=h;typeof u=="function"&&([d,p]=[null,u]),(0,P.validateCallback)(p),Promise.resolve().then(()=>{try{let m=this._core.readv(o,c,d);p(null,m,c)}catch(m){p(m)}})},this.readvSync=(o,c,u)=>((0,je.validateFd)(o),this._core.readv(o,c,u??null)),this._readfile=(o,c,u)=>{let h,p=typeof o=="number"&&(0,je.isFd)(o),m;if(p)m=o;else{let w=(0,P.pathToFilename)(o),y=String(o),g=y.length>1&&y.endsWith("/"),_=this._core.getResolvedLinkOrThrow(w,"open"),F=_.getNode();if(F.isDirectory())throw(0,P.createError)("EISDIR","open",_.getPath());if(g&&F.isFile())throw(0,P.createError)("ENOTDIR","open",y);m=this.openSync(o,c)}try{h=(0,P.bufferToEncoding)(this._core.getFileByFdOrThrow(m).getBuffer(),u)}finally{p||this.closeSync(m)}return h},this.readFileSync=(o,c)=>{let u=(0,Q.getReadFileOptions)(c),h=(0,P.flagsToNumber)(u.flag);return this._readfile(o,h,u.encoding)},this.readFile=(o,c,u)=>{let[h,d]=(0,Q.optsAndCbGenerator)(Q.getReadFileOptions)(c,u),p=(0,P.flagsToNumber)(h.flag);this.wrapAsync(this._readfile,[o,p,h.encoding],d)},this.writeSync=(o,c,u,h,d)=>{let[,p,m,w,y]=(0,P.getWriteSyncArgs)(o,c,u,h,d);return this._write(o,p,m,w,y)},this.write=(o,c,u,h,d,p)=>{let[,m,w,y,g,_,F]=(0,P.getWriteArgs)(o,c,u,h,d,p);Promise.resolve().then(()=>{try{let R=this._write(o,w,y,g,_);m?F(null,R,c):F(null,R,w)}catch(R){F(R)}})},this.writev=(o,c,u,h)=>{let d=u,p=h;typeof u=="function"&&([d,p]=[null,u]),(0,P.validateCallback)(p),Promise.resolve().then(()=>{try{let m=this.writevBase(o,c,d);p(null,m,c)}catch(m){p(m)}})},this.writevSync=(o,c,u)=>((0,je.validateFd)(o),this.writevBase(o,c,u??null)),this.writeFileSync=(o,c,u)=>{let h=(0,Q.getWriteFileOptions)(u),d=(0,P.flagsToNumber)(h.flag),p=(0,P.modeToNumber)(h.mode),m=(0,je.dataToBuffer)(c,h.encoding);this._core.writeFile(o,m,d,p)},this.writeFile=(o,c,u,h)=>{let d=u,p=h;typeof u=="function"&&([d,p]=[Q.writeFileDefaults,u]);let m=(0,P.validateCallback)(p),w=(0,Q.getWriteFileOptions)(d),y=(0,P.flagsToNumber)(w.flag),g=(0,P.modeToNumber)(w.mode),_=(0,je.dataToBuffer)(c,w.encoding);this.wrapAsync(this._core.writeFile,[o,_,y,g],m)},this.copyFileSync=(o,c,u)=>{let h=(0,P.pathToFilename)(o),d=(0,P.pathToFilename)(c);return this._copyFile(h,d,(u||0)|0)},this.copyFile=(o,c,u,h)=>{let d=(0,P.pathToFilename)(o),p=(0,P.pathToFilename)(c),m,w;typeof u=="function"?[m,w]=[0,u]:[m,w]=[u,h],(0,P.validateCallback)(w),this.wrapAsync(this._copyFile,[d,p,m],w)},this._cp=(o,c,u)=>{if(u.filter&&!u.filter(o,c))return;let h=u.dereference?this.statSync(o):this.lstatSync(o),d=null;try{d=this.lstatSync(c)}catch(p){if(p.code!=="ENOENT")throw p}if(d&&h.ino===d.ino&&h.dev===d.dev)throw(0,P.createError)("EINVAL","cp",o,c);if(d){if(h.isDirectory()&&!d.isDirectory())throw(0,P.createError)("EISDIR","cp",o,c);if(!h.isDirectory()&&d.isDirectory())throw(0,P.createError)("ENOTDIR","cp",o,c)}if(h.isDirectory()&&this.isSrcSubdir(o,c))throw(0,P.createError)("EINVAL","cp",o,c);{let p=iO(c);this.existsSync(p)||this.mkdirSync(p,{recursive:!0})}if(h.isDirectory()){if(!u.recursive)throw(0,P.createError)("EISDIR","cp",o);this.cpDirSync(h,d,o,c,u)}else if(h.isFile()||h.isCharacterDevice()||h.isBlockDevice())this.cpFileSync(h,d,o,c,u);else if(h.isSymbolicLink()&&!u.dereference)this.cpSymlinkSync(d,o,c,u);else throw(0,P.createError)("EINVAL","cp",o)},this.linkSync=(o,c)=>{let u=(0,P.pathToFilename)(o),h=(0,P.pathToFilename)(c);this._core.link(u,h)},this.link=(o,c,u)=>{let h=(0,P.pathToFilename)(o),d=(0,P.pathToFilename)(c);this.wrapAsync(this._core.link,[h,d],u)},this.unlinkSync=o=>{let c=(0,P.pathToFilename)(o);this._core.unlink(c)},this.unlink=(o,c)=>{let u=(0,P.pathToFilename)(o);this.wrapAsync(this._core.unlink,[u],c)},this.symlinkSync=(o,c,u)=>{let h=(0,P.pathToFilename)(o),d=(0,P.pathToFilename)(c);this._core.symlink(h,d)},this.symlink=(o,c,u,h)=>{let d=(0,P.validateCallback)(typeof u=="function"?u:h),p=(0,P.pathToFilename)(o),m=(0,P.pathToFilename)(c);this.wrapAsync(this._core.symlink,[p,m],d)},this._lstat=(o,c=!1,u=!1)=>{let h;try{h=this._core.getLinkOrThrow(o,"lstat")}catch(d){if(d.code==="ENOENT"&&!u)return;throw d}return Kw.default.build(h.getNode(),c)},this.lstatSync=(o,c)=>{let{throwIfNoEntry:u=!0,bigint:h=!1}=(0,Q.getStatOptions)(c);return this._lstat((0,P.pathToFilename)(o),h,u)},this.renameSync=(o,c)=>{let u=(0,P.pathToFilename)(o),h=(0,P.pathToFilename)(c);this._core.rename(u,h)},this.rename=(o,c,u)=>{let h=(0,P.pathToFilename)(o),d=(0,P.pathToFilename)(c);this.wrapAsync(this._core.rename,[h,d],u)},this.existsSync=o=>{try{return this._exists((0,P.pathToFilename)(o))}catch{return!1}},this.exists=(o,c)=>{let u=(0,P.pathToFilename)(o);if(typeof c!="function")throw Error($u.ERRSTR.CB);Promise.resolve().then(()=>{try{c(this._exists(u))}catch{c(!1)}})},this.accessSync=(o,c=Jw)=>{let u=(0,P.pathToFilename)(o);c=c|0,this._access(u,c)},this.access=(o,c,u)=>{let h=Jw,d;typeof c!="function"?[h,d]=[c|0,(0,P.validateCallback)(u)]:d=c;let p=(0,P.pathToFilename)(o);this.wrapAsync(this._access,[p,h],d)},this.appendFileSync=(o,c,u)=>{let h=(0,Q.getAppendFileOpts)(u);(!h.flag||(0,je.isFd)(o))&&(h.flag="a"),this.writeFileSync(o,c,h)},this.appendFile=(o,c,u,h)=>{let[d,p]=(0,Q.getAppendFileOptsAndCb)(u,h);(!d.flag||(0,je.isFd)(o))&&(d.flag="a"),this.writeFile(o,c,d,p)},this._readdir=(o,c)=>{let u=(0,je.filenameToSteps)(o),h=this._core.getResolvedLinkOrThrow(o,"scandir"),d=h.getNode();if(!d.isDirectory())throw(0,P.createError)("ENOTDIR","scandir",o);if(!d.canRead())throw(0,P.createError)("EACCES","scandir",o);let p=[];for(let w of h.children.keys()){let y=h.getChild(w);if(!(!y||w==="."||w==="..")&&(p.push(Cq.default.build(y,c.encoding)),c.recursive&&y.children.size)){let g={...c,recursive:!0,withFileTypes:!0},_=this._readdir(y.getPath(),g);p.push(..._)}}if(!je.isWin&&c.encoding!=="buffer"&&p.sort((w,y)=>w.name<y.name?-1:w.name>y.name?1:0),c.withFileTypes)return p;let m=o;return je.isWin&&(m=m.replace(/\\/g,"/")),p.map(w=>{if(c.recursive){let y=Xw(w.parentPath,w.name.toString());return je.isWin&&(y=y.replace(/\\/g,"/")),y.replace(m+Fe.posix.sep,"")}return w.name})},this.readdirSync=(o,c)=>{let u=(0,Q.getReaddirOptions)(c),h=(0,P.pathToFilename)(o);return this._readdir(h,u)},this.readdir=(o,c,u)=>{let[h,d]=(0,Q.getReaddirOptsAndCb)(c,u),p=(0,P.pathToFilename)(o);this.wrapAsync(this._readdir,[p,h],d)},this._readlink=(o,c)=>{let h=this._core.getLinkOrThrow(o,"readlink").getNode();if(!h.isSymlink())throw(0,P.createError)("EINVAL","readlink",o);return(0,Gi.strToEncoding)(h.symlink,c)},this.readlinkSync=(o,c)=>{let u=(0,Q.getDefaultOpts)(c),h=(0,P.pathToFilename)(o);return this._readlink(h,u.encoding)},this.readlink=(o,c,u)=>{let[h,d]=(0,Q.getDefaultOptsAndCb)(c,u),p=(0,P.pathToFilename)(o);this.wrapAsync(this._readlink,[p,h.encoding],d)},this._fsync=o=>{this._core.getFileByFdOrThrow(o,"fsync")},this.fsyncSync=o=>{this._fsync(o)},this.fsync=(o,c)=>{this.wrapAsync(this._fsync,[o],c)},this._fdatasync=o=>{this._core.getFileByFdOrThrow(o,"fdatasync")},this.fdatasyncSync=o=>{this._fdatasync(o)},this.fdatasync=(o,c)=>{this.wrapAsync(this._fdatasync,[o],c)},this._ftruncate=(o,c)=>{this._core.getFileByFdOrThrow(o,"ftruncate").truncate(c)},this.ftruncateSync=(o,c)=>{this._ftruncate(o,c)},this.ftruncate=(o,c,u)=>{let h=typeof c=="number"?c:0,d=(0,P.validateCallback)(typeof c=="number"?u:c);this.wrapAsync(this._ftruncate,[o,h],d)},this._truncate=(o,c)=>{let u=this.openSync(o,"r+");try{this.ftruncateSync(u,c)}finally{this.closeSync(u)}},this.truncateSync=(o,c)=>{if((0,je.isFd)(o))return this.ftruncateSync(o,c);this._truncate(o,c)},this.truncate=(o,c,u)=>{let h=typeof c=="number"?c:0,d=(0,P.validateCallback)(typeof c=="number"?u:c);if((0,je.isFd)(o))return this.ftruncate(o,h,d);this.wrapAsync(this._truncate,[o,h],d)},this._futimes=(o,c,u)=>{let d=this._core.getFileByFdOrThrow(o,"futimes").node;d.atime=new Date(c*1e3),d.mtime=new Date(u*1e3)},this.futimesSync=(o,c,u)=>{this._futimes(o,pt(c),pt(u))},this.futimes=(o,c,u,h)=>{this.wrapAsync(this._futimes,[o,pt(c),pt(u)],h)},this._utimes=(o,c,u,h=!0)=>{let d=this._core,m=(h?d.getResolvedLinkOrThrow(o,"utimes"):d.getLinkOrThrow(o,"lutimes")).getNode();m.atime=new Date(c*1e3),m.mtime=new Date(u*1e3)},this.utimesSync=(o,c,u)=>{this._utimes((0,P.pathToFilename)(o),pt(c),pt(u),!0)},this.utimes=(o,c,u,h)=>{this.wrapAsync(this._utimes,[(0,P.pathToFilename)(o),pt(c),pt(u),!0],h)},this.lutimesSync=(o,c,u)=>{this._utimes((0,P.pathToFilename)(o),pt(c),pt(u),!1)},this.lutimes=(o,c,u,h)=>{this.wrapAsync(this._utimes,[(0,P.pathToFilename)(o),pt(c),pt(u),!1],h)},this.mkdirSync=(o,c)=>{let u=(0,Q.getMkdirOptions)(c),h=(0,P.modeToNumber)(u.mode,511),d=(0,P.pathToFilename)(o);if(u.recursive)return this._core.mkdirp(d,h);this._core.mkdir(d,h)},this.mkdir=(o,c,u)=>{let h=(0,Q.getMkdirOptions)(c),d=(0,P.validateCallback)(typeof c=="function"?c:u),p=(0,P.modeToNumber)(h.mode,511),m=(0,P.pathToFilename)(o);h.recursive?this.wrapAsync(this._core.mkdirp,[m,p],d):this.wrapAsync(this._core.mkdir,[m,p],d)},this._mkdtemp=(o,c,u=5)=>{let h=o+(0,P.genRndStr6)();try{return this._core.mkdir(h,511),(0,Gi.strToEncoding)(h,c)}catch(d){if(d.code==="EEXIST"){if(u>1)return this._mkdtemp(o,c,u-1);throw Error("Could not create temp dir.")}else throw d}},this.mkdtempSync=(o,c)=>{let{encoding:u}=(0,Q.getDefaultOpts)(c);if(!o||typeof o!="string")throw new TypeError("filename prefix is required");return(0,P.nullCheck)(o),this._mkdtemp(o,u)},this.mkdtemp=(o,c,u)=>{let[{encoding:h},d]=(0,Q.getDefaultOptsAndCb)(c,u);if(!o||typeof o!="string")throw new TypeError("filename prefix is required");(0,P.nullCheck)(o)&&this.wrapAsync(this._mkdtemp,[o,h],d)},this.rmdirSync=(o,c)=>{let u=(0,Q.getRmdirOptions)(c);this._core.rmdir((0,P.pathToFilename)(o),u.recursive)},this.rmdir=(o,c,u)=>{let h=(0,Q.getRmdirOptions)(c),d=(0,P.validateCallback)(typeof c=="function"?c:u);this.wrapAsync(this._core.rmdir,[(0,P.pathToFilename)(o),h.recursive],d)},this.rmSync=(o,c)=>{this._core.rm((0,P.pathToFilename)(o),c?.force,c?.recursive)},this.rm=(o,c,u)=>{let[h,d]=(0,Q.getRmOptsAndCb)(c,u);this.wrapAsync(this._core.rm,[(0,P.pathToFilename)(o),h?.force,h?.recursive],d)},this._fchmod=(o,c)=>{this._core.getFileByFdOrThrow(o,"fchmod").chmod(c)},this.fchmodSync=(o,c)=>{this._fchmod(o,(0,P.modeToNumber)(c))},this.fchmod=(o,c,u)=>{this.wrapAsync(this._fchmod,[o,(0,P.modeToNumber)(c)],u)},this._chmod=(o,c,u=!0)=>{(u?this._core.getResolvedLinkOrThrow(o,"chmod"):this._core.getLinkOrThrow(o,"chmod")).getNode().chmod(c)},this.chmodSync=(o,c)=>{let u=(0,P.modeToNumber)(c),h=(0,P.pathToFilename)(o);this._chmod(h,u,!0)},this.chmod=(o,c,u)=>{let h=(0,P.modeToNumber)(c),d=(0,P.pathToFilename)(o);this.wrapAsync(this._chmod,[d,h],u)},this._lchmod=(o,c)=>{this._chmod(o,c,!1)},this.lchmodSync=(o,c)=>{let u=(0,P.modeToNumber)(c),h=(0,P.pathToFilename)(o);this._lchmod(h,u)},this.lchmod=(o,c,u)=>{let h=(0,P.modeToNumber)(c),d=(0,P.pathToFilename)(o);this.wrapAsync(this._lchmod,[d,h],u)},this._fchown=(o,c,u)=>{this._core.getFileByFdOrThrow(o,"fchown").chown(c,u)},this.fchownSync=(o,c,u)=>{Gs(c),Ks(u),this._fchown(o,c,u)},this.fchown=(o,c,u,h)=>{Gs(c),Ks(u),this.wrapAsync(this._fchown,[o,c,u],h)},this._chown=(o,c,u)=>{this._core.getResolvedLinkOrThrow(o,"chown").getNode().chown(c,u)},this.chownSync=(o,c,u)=>{Gs(c),Ks(u),this._chown((0,P.pathToFilename)(o),c,u)},this.chown=(o,c,u,h)=>{Gs(c),Ks(u),this.wrapAsync(this._chown,[(0,P.pathToFilename)(o),c,u],h)},this._lchown=(o,c,u)=>{this._core.getLinkOrThrow(o,"lchown").getNode().chown(c,u)},this.lchownSync=(o,c,u)=>{Gs(c),Ks(u),this._lchown((0,P.pathToFilename)(o),c,u)},this.lchown=(o,c,u,h)=>{Gs(c),Ks(u),this.wrapAsync(this._lchown,[(0,P.pathToFilename)(o),c,u],h)},this.statWatchers={},this.cpSync=(o,c,u)=>{let h=(0,P.pathToFilename)(o),d=(0,P.pathToFilename)(c),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=(o,c,u,h)=>{let d=(0,P.pathToFilename)(o),p=(0,P.pathToFilename)(c),m,w;typeof u=="function"?[m,w]=[{},u]:[m,w]=[u||{},h],(0,P.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(o,c)=>{let u=(0,P.pathToFilename)(o),h;try{h=this._core.getResolvedLinkOrThrow(u,"open")}catch(w){throw w&&typeof w=="object"&&w.code==="ENOENT"?new qq.TypeError("ERR_INVALID_ARG_VALUE"):w}let p=h.getNode().getBuffer(),m=c?.type||"";return new Blob([p],{type:m})},this.glob=(o,...c)=>{let[u,h]=c.length===1?[{},c[0]]:[c[0],c[1]];this.wrapAsync(this._globSync,[o,u||{}],h)},this.globSync=(o,c={})=>this._globSync(o,c),this._globSync=(o,c={})=>{let{globSync:u}=tO();return u(this,o,c)},this._opendir=(o,c)=>{let u=this._core.getResolvedLinkOrThrow(o,"scandir");if(!u.getNode().isDirectory())throw(0,P.createError)("ENOTDIR","scandir",o);return new Uq.Dir(u,c)},this.opendirSync=(o,c)=>{let u=(0,Q.getOpendirOptions)(c),h=(0,P.pathToFilename)(o);return this._opendir(h,u)},this.opendir=(o,c,u)=>{let[h,d]=(0,Q.getOpendirOptsAndCb)(c,u),p=(0,P.pathToFilename)(o);this.wrapAsync(this._opendir,[p,h],d)};let r=this;this.StatWatcher=class extends Bu{constructor(){super(r)}};let i=lr;this.ReadStream=class extends i{constructor(...o){super(r,...o)}};let n=Nt;this.WriteStream=class extends n{constructor(...o){super(r,...o)}},this.FSWatcher=class extends Mu{constructor(){super(r)}};let s=l((o,c)=>{let u=this._core.getResolvedLinkOrThrow(o,"realpath");return(0,Gi.strToEncoding)(u.getPath()||"/",c)},"_realpath"),a=l((o,c,u)=>{let[h,d]=(0,Q.getRealpathOptsAndCb)(c,u),p=(0,P.pathToFilename)(o);r.wrapAsync(s,[p,h.encoding],d)},"realpathImpl"),f=l((o,c)=>s((0,P.pathToFilename)(o),(0,Q.getRealpathOptions)(c).encoding),"realpathSyncImpl");this.realpath=a,this.realpath.native=a,this.realpathSync=f,this.realpathSync.native=f}wrapAsync(e,r,i){(0,P.validateCallback)(i),Promise.resolve().then(()=>{let n;try{n=e.apply(this,r)}catch(s){i(s);return}i(null,n)})}toTree(e={separator:Fe.sep}){return(0,Lq.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,P.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 f of r){let o=Js.Buffer.from(f.buffer,f.byteOffset,f.byteLength),c=n.write(o,0,o.byteLength,s);if(s=void 0,a+=c,c<o.byteLength)break}return a}_copyFile(e,r,i){let n=this.readFileSync(e);if(i&Gq&&this.existsSync(r))throw(0,P.createError)("EEXIST","copyFile",e,r);if(i&Kq)throw(0,P.createError)("ENOSYS","copyFile",e,r);this._core.writeFile(r,n,$u.FLAGS.w,438)}isSrcSubdir(e,r){try{let i=nO(e.startsWith("/")?e:"/"+e),n=nO(r.startsWith("/")?r:"/"+r);if(i===n)return!0;let s=Iu(i,n);return s===""||!s.startsWith("..")&&!(0,Fe.isAbsolute)(s)}catch{return!1}}cpFileSync(e,r,i,n,s){if(r){if(s.errorOnExist)throw(0,P.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 f of a){let o=Xw(i,String(f)),c=Xw(n,String(f));s.filter&&!s.filter(o,c)||this._cp(o,c,s)}this.chmodSync(n,Number(e.mode))}cpSymlinkSync(e,r,i,n){let s=String(this.readlinkSync(r));!n.verbatimSymlinks&&!(0,Fe.isAbsolute)(s)&&(s=Wq(iO(r),s)),e&&this.unlinkSync(i),this.symlinkSync(s,i)}lstat(e,r,i){let[{throwIfNoEntry:n=!0,bigint:s=!1},a]=(0,Q.getStatOptsAndCb)(r,i);this.wrapAsync(this._lstat,[(0,P.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 Kw.default.build(n.getNode(),r)}statSync(e,r){let{bigint:i=!0,throwIfNoEntry:n=!0}=(0,Q.getStatOptions)(r);return this._stat((0,P.pathToFilename)(e),i,n)}stat(e,r,i){let[{bigint:n=!1,throwIfNoEntry:s=!0},a]=(0,Q.getStatOptsAndCb)(r,i);this.wrapAsync(this._stat,[(0,P.pathToFilename)(e),n,s],a)}fstatBase(e,r=!1){let i=this._core.getFileByFd(e);if(!i)throw(0,P.createError)("EBADF","fstat");return Kw.default.build(i.node,r)}fstatSync(e,r){return this.fstatBase(e,(0,Q.getStatOptions)(r).bigint)}fstat(e,r,i){let[n,s]=(0,Q.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!==Jw&&(r&zq&&!n.canRead()||r&Hq&&!n.canWrite()||r&Vq&&!n.canExecute()))throw(0,P.createError)("EACCES","access",e)}watchFile(e,r,i){let n=(0,P.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 f=5007,o=!0;s&&typeof s=="object"&&(typeof s.interval=="number"&&(f=s.interval),typeof s.persistent=="boolean"&&(o=s.persistent));let c=this.statWatchers[n];return c||(c=new this.StatWatcher,c.start(n,o,f),this.statWatchers[n]=c),c.addListener("change",a),c}unwatchFile(e,r){let i=(0,P.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,P.pathToFilename)(e),s=r;typeof r=="function"&&(i=r,s=null);let{persistent:a,recursive:f,encoding:o}=(0,Q.getDefaultOpts)(s);a===void 0&&(a=!0),f===void 0&&(f=!1);let c=new this.FSWatcher;return c.start(n,a,f,o),i&&c.addListener("change",i),c}_statfs(e,r=!1){return this._core.getResolvedLinkOrThrow(e,"statfs"),Iq.default.build(this._core,r)}statfsSync(e,r){let{bigint:i=!1}=(0,Q.getStatfsOptions)(r);return this._statfs((0,P.pathToFilename)(e),i)}statfs(e,r,i){let[{bigint:n=!1},s]=(0,Q.getStatfsOptsAndCb)(r,i);this.wrapAsync(this._statfs,[(0,P.pathToFilename)(e),n],s)}};l(Zw,"Volume");var Ki=Zw;mt.Volume=Ki;Ki.fromJSON=(t,e)=>new Ki(Yw.Superblock.fromJSON(t,e));Ki.fromNestedJSON=(t,e)=>new Ki(Yw.Superblock.fromNestedJSON(t,e));function Zq(t){t.emit("stop")}l(Zq,"emitStop");var Qw=class Qw extends sO.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,P.pathToFilename)(e),this.setTimeout=r?setTimeout.bind(globalThis):$q.default,this.interval=i,this.prev=this.vol.statSync(this.filename),this.loop()}stop(){clearTimeout(this.timeoutRef),(0,ju.default)(()=>{Zq.call(this,this)})}};l(Qw,"StatWatcher");var Bu=Qw;mt.StatWatcher=Bu;var Pt;function Qq(t){Pt=(0,Js.bufferAllocUnsafe)(t),Pt.used=0}l(Qq,"allocNewPool");(0,aO.inherits)(lr,Lu.Readable);mt.ReadStream=lr;function lr(t,e,r){if(!(this instanceof lr))return new lr(t,e,r);if(this._vol=t,r=Object.assign({},(0,Q.getOptions)(r,{})),r.highWaterMark===void 0&&(r.highWaterMark=64*1024),Lu.Readable.call(this,r),this.path=(0,P.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(lr,"FsReadStream");lr.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()})};lr.prototype._read=function(t){if(typeof this.fd!="number")return this.once("open",function(){this._read(t)});if(this.destroyed)return;(!Pt||Pt.length-Pt.used<Jq)&&Qq(this._readableState.highWaterMark);var e=Pt,r=Math.min(Pt.length-Pt.used,t),i=Pt.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,Pt,Pt.used,r,this.pos,s),this.pos!==void 0&&(this.pos+=r),Pt.used+=r;function s(a,f){if(a)n.autoClose&&n.destroy&&n.destroy(),n.emit("error",a);else{var o=null;f>0&&(n.bytesRead+=f,o=e.slice(i,i+f)),n.push(o)}}l(s,"onread")};lr.prototype._destroy=function(t,e){this.close(r=>{e(t||r)})};lr.prototype.close=function(t){if(t&&this.once("close",t),this.closed||typeof this.fd!="number"){if(typeof this.fd!="number"){this.once("open",oO);return}return(0,ju.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 oO(t){this.close()}l(oO,"closeOnOpen");(0,aO.inherits)(Nt,Lu.Writable);mt.WriteStream=Nt;function Nt(t,e,r){if(!(this instanceof Nt))return new Nt(t,e,r);if(this._vol=t,r=Object.assign({},(0,Q.getOptions)(r,{})),Lu.Writable.call(this,r),this.path=(0,P.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(Nt,"FsWriteStream");Nt.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))};Nt.prototype._write=function(t,e,r){if(!(t instanceof Js.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)};Nt.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 f=t[a].chunk;n[a]=f,s+=f.length}let o=Js.Buffer.concat(n);this._vol.write(this.fd,o,0,o.length,this.pos,(c,u)=>{if(c)return r.destroy&&r.destroy(),e(c);r.bytesWritten+=u,e()}),this.pos!==void 0&&(this.pos+=s)};Nt.prototype.close=function(t){if(t&&this.once("close",t),this.closed||typeof this.fd!="number"){if(typeof this.fd!="number"){this.once("open",oO);return}return(0,ju.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};Nt.prototype._destroy=lr.prototype._destroy;Nt.prototype.destroySoon=Nt.prototype.end;var ey=class ey extends sO.EventEmitter{constructor(e){super(),this._filename="",this._filenameEncoded="",this._recursive=!1,this._encoding=Gi.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=Gi.ENCODING_UTF8){this._filename=(0,P.pathToFilename)(e),this._steps=(0,je.filenameToSteps)(this._filename),this._filenameEncoded=(0,Gi.strToEncoding)(this._filename),this._recursive=i,this._encoding=n;try{this._link=this._vol._core.getLinkOrThrow(this._filename,"FSWatcher")}catch(o){let c=new Error(`watch ${this._filename} ${o.code}`);throw c.code=o.code,c.errno=o.code,c}let s=l(o=>{let c=o.getPath(),u=o.getNode(),h=l(()=>{let m=Iu(this._filename,c);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"),a=l(o=>{let c=o.getNode(),u=l(m=>{this.emit("change","rename",Iu(this._filename,m.getPath())),s(m),a(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,R]of y.children.entries())R&&F!=="."&&F!==".."&&w(R)},"removeLinkNodeListeners");w(m),this.emit("change","rename",Iu(this._filename,m.getPath()))},"onLinkChildDelete");for(let[m,w]of o.children.entries())w&&m!=="."&&m!==".."&&s(w);let d=o.changes.listen(([m,w])=>{m==="child:add"?u(w):m==="child:del"&&h(w)});if((this._listenerRemovers.get(c.ino)??[]).push(()=>{d()}),i)for(let[m,w]of o.children.entries())w&&m!=="."&&m!==".."&&a(w)},"watchLinkChildrenChanged");s(this._link),a(this._link);let f=this._link.parent;f&&f.changes.listen(([o,c])=>{o==="child:del"&&this._onParentChild(c)}),r&&this._persist()}close(){clearTimeout(this._timer),this._listenerRemovers.forEach(e=>{e.forEach(r=>r())}),this._listenerRemovers.clear(),this._parentChangesUnsub?.()}};l(ey,"FSWatcher");var Mu=ey;mt.FSWatcher=Mu});var lO=T(qu=>{"use strict";Object.defineProperty(qu,"__esModule",{value:!0});qu.fsSynchronousApiList=void 0;qu.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 fO=T(Uu=>{"use strict";Object.defineProperty(Uu,"__esModule",{value:!0});Uu.fsCallbackApiList=void 0;Uu.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 hO=T((wt,Wu)=>{"use strict";Object.defineProperty(wt,"__esModule",{value:!0});wt.memfs=wt.fs=wt.vol=wt.Volume=void 0;wt.createFsFromVolume=ty;var e8=uw(),t8=ou(),zu=cO();Object.defineProperty(wt,"Volume",{enumerable:!0,get:l(function(){return zu.Volume},"get")});var uO=zt(),r8=lO(),i8=fO(),{F_OK:n8,R_OK:s8,W_OK:a8,X_OK:o8}=uO.constants;wt.vol=new zu.Volume;function ty(t){let e={F_OK:n8,R_OK:s8,W_OK:a8,X_OK:o8,constants:uO.constants,Stats:e8.default,Dirent:t8.default};for(let r of r8.fsSynchronousApiList)typeof t[r]=="function"&&(e[r]=t[r].bind(t));for(let r of i8.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=zu.toUnixTimestamp,e.__vol=t,e}l(ty,"createFsFromVolume");wt.fs=ty(wt.vol);var c8=l((t={},e="/")=>{let r=zu.Volume.fromNestedJSON(t,e);return{fs:ty(r),vol:r}},"memfs");wt.memfs=c8;Wu.exports={...Wu.exports,...wt.fs};Wu.exports.semantic=!0});var dy=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),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"),ia,Xi,rh=(Xi=class{constructor(e){G(this,"strategy","jwt");G(this,"cachedToken",null);G(this,"tokenExpiry",null);ta(this,ia);ra(this,ia,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 ea(this,ia).call(this);return r?(this.cachedToken=r,this.tokenExpiry=dy(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=dy(n)}},ia=new WeakMap,l(Xi,"AssistantCloudJWTAuthStrategy"),Xi),na,sa,aa,Yi,py=(Yi=class{constructor(e,r,i){G(this,"strategy","api-key");ta(this,na);ta(this,sa);ta(this,aa);ra(this,na,e),ra(this,sa,r),ra(this,aa,i)}async getAuthHeaders(){return{Authorization:`Bearer ${ea(this,na)}`,"Aui-User-Id":ea(this,sa),"Aui-Workspace-Id":ea(this,aa)}}readAuthHeaders(){}},na=new WeakMap,sa=new WeakMap,aa=new WeakMap,l(Yi,"AssistantCloudAPIKeyAuthStrategy"),Yi),Io="aui:refresh_token",Zi,my=(Zi=class{constructor(e){G(this,"strategy","anon");G(this,"baseUrl");G(this,"jwtStrategy");this.baseUrl=e,this.jwtStrategy=new rh(async()=>{let r=Date.now(),i=localStorage.getItem(Io),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(Io,JSON.stringify(p)),d}}else localStorage.removeItem(Io);let s=await fetch(`${this.baseUrl}/v1/auth/tokens/anonymous`,{method:"POST"});if(!s.ok)return null;let a=await s.json(),{access_token:f,refresh_token:o}=a;return!f||!o?null:(localStorage.setItem(Io,JSON.stringify(o)),f)})}async getAuthHeaders(){return this.jwtStrategy.getAuthHeaders()}readAuthHeaders(e){this.jwtStrategy.readAuthHeaders(e)}},l(Zi,"AssistantCloudAnonymousAuthStrategy"),Zi);var Qi,PO=(Qi=class extends Error{constructor(e){super(e),this.name="APIError"}},l(Qi,"CloudAPIError"),Qi),en,wy=(en=class{constructor(e){G(this,"_auth");G(this,"_baseUrl");if("authToken"in e)this._baseUrl=e.baseUrl,this._auth=new rh(e.authToken);else if("apiKey"in e)this._baseUrl="https://backend.assistant-api.com",this._auth=new py(e.apiKey,e.userId,e.workspaceId);else if("anonymous"in e)this._baseUrl=e.baseUrl,this._auth=new my(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[o,c]of Object.entries(r.query))c!==!1&&(c===!0?s.set(o,"true"):s.set(o,c.toString()));let a=new URL(`${this._baseUrl}/v1${e}`);a.search=s.toString();let f=await fetch(a,{method:r.method??"GET",headers:n,body:r.body?JSON.stringify(r.body):null});if(this._auth.readAuthHeaders(f.headers),!f.ok){let o=await f.text();try{let c=JSON.parse(o);throw new PO(c.message)}catch{throw new Error(`Request failed with status ${f.status}, ${o}`)}}return f}async makeRequest(e,r={}){return(await this.makeRawRequest(e,r)).json()}},l(en,"AssistantCloudAPI"),en);var tn,yy=(tn=class{constructor(e){this.cloud=e}async create(){return this.cloud.makeRequest("/auth/tokens",{method:"POST"})}},l(tn,"AssistantCloudAuthTokens"),tn);var fr={toResponse(t,e){return new Response(fr.toByteStream(t,e),{headers:e.headers??{}})},fromResponse(t,e){return fr.fromByteStream(t.body,e)},toByteStream(t,e){return t.pipeThrough(e)},fromByteStream(t,e){return t.pipeThrough(e)}};var $o=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 gy=l(()=>{let t=[],e=!1,r,i,n=l(a=>{a.promise||(a.promise=a.reader.read().then(({done:f,value:o})=>{a.promise=void 0,f?(t.splice(t.indexOf(a),1),e&&t.length===0&&r.close()):r.enqueue(o),i?.resolve(),i=void 0}).catch(f=>{console.error(f),t.forEach(o=>{o.reader.cancel()}),t.length=0,r.error(f),i?.reject(f),i=void 0}))},"handlePull");return{readable:new ReadableStream({start(a){r=a},pull(){return i=$o(),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 f={reader:a.getReader()};t.push(f),n(f)},enqueue(a){this.addStream(new ReadableStream({start(f){f.enqueue(a),f.close()}}))}}},"createMergeStream");var rn,by=(rn=class{constructor(e){G(this,"_controller");G(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(rn,"TextStreamControllerImpl"),rn),ih=l(t=>new ReadableStream({start(e){return t.start?.(new by(e))},pull(e){return t.pull?.(new by(e))},cancel(e){return t.cancel?.(e)}}),"createTextStream"),nh=l(()=>{let t;return[ih({start(r){t=r}}),t]},"createTextStreamController");var nn,_y=(nn=class{constructor(e){G(this,"_isClosed",!1);G(this,"_mergeTask");G(this,"_argsTextController");this._controller=e;let r=ih({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(nn,"ToolCallStreamControllerImpl"),nn),NO=l(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)}}),"createToolCallStream"),vy=l(()=>{let t;return[NO({start(r){t=r}}),t]},"createToolCallStreamController");var sn,Bo=(sn=class{constructor(){G(this,"value",-1)}up(){return++this.value}},l(sn,"Counter"),sn);var an,Ey=(an=class extends TransformStream{constructor(e){super({transform(r,i){i.enqueue({...r,path:[e,...r.path]})}})}},l(an,"PathAppendEncoder"),an),on,K8=(on=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(on,"PathAppendDecoder"),on),cn,Sy=(cn=class extends TransformStream{constructor(e){let r=new Bo,i=new Map;super({transform(n,s){n.type==="part-start"&&n.path.length===0&&i.set(r.up(),e.up());let[a,...f]=n.path;if(a===void 0){s.enqueue(n);return}let o=i.get(a);if(o===void 0)throw new Error("Path not found");s.enqueue({...n,path:[o,...f]})}})}},l(cn,"PathMergeEncoder"),cn);var ln,Fy=(ln=class extends TransformStream{constructor(e,r,i){let[n,s]=oa(),a;super({start(f){return a=n.pipeTo(new WritableStream({write(o){f.enqueue(o)},abort(o){f.error(o)},close(){f.terminate()}})).catch(o=>{f.error(o)}),e.start?.(s)},transform(f){return e.transform?.(f,s)},async flush(){await e.flush?.(s),s.close(),await a}},r,i)}},l(ln,"AssistantTransformStream"),ln);var fn,Mo=(fn=class extends TransformStream{constructor(e){super();let r=e(super.readable);Object.defineProperty(this,"readable",{value:r,writable:!1})}},l(fn,"PipeableTransformStream"),fn);var le=(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))(le||{});var un,Ty=(un=class extends TransformStream{constructor(){super({transform:l((e,r)=>{r.enqueue(`${e.type}:${JSON.stringify(e.value)}
100
- `)},"transform")})}},l(un,"DataStreamChunkEncoder"),un),hn,DO=(hn=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(hn,"DataStreamChunkDecoder"),hn);var dn,Ry=(dn=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(dn,"AssistantMetaTransformStream"),dn);var pn,sh=(pn=class extends Mo{constructor(){super(r=>{let i=new TransformStream({transform(n,s){let a=n.type;switch(a){case"part-start":{let f=n.part;if(f.type==="tool-call"){let{type:o,...c}=f;s.enqueue({type:le.StartToolCall,value:c})}if(f.type==="source"){let{type:o,...c}=f;s.enqueue({type:le.Source,value:c})}break}case"text-delta":{let f=n.meta;switch(f.type){case"text":{f.parentId?s.enqueue({type:le.AuiTextDelta,value:{textDelta:n.textDelta,parentId:f.parentId}}):s.enqueue({type:le.TextDelta,value:n.textDelta});break}case"reasoning":{f.parentId?s.enqueue({type:le.AuiReasoningDelta,value:{reasoningDelta:n.textDelta,parentId:f.parentId}}):s.enqueue({type:le.ReasoningDelta,value:n.textDelta});break}case"tool-call":{s.enqueue({type:le.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:le.ToolCallResult,value:{toolCallId:f.toolCallId,result:n.result,artifact:n.artifact,...n.isError?{isError:n.isError}:{}}});break}case"step-start":{let{type:f,...o}=n;s.enqueue({type:le.StartStep,value:o});break}case"step-finish":{let{type:f,...o}=n;s.enqueue({type:le.FinishStep,value:o});break}case"message-finish":{let{type:f,...o}=n;s.enqueue({type:le.FinishMessage,value:o});break}case"error":{s.enqueue({type:le.Error,value:n.error});break}case"annotations":{s.enqueue({type:le.Annotation,value:n.annotations});break}case"data":{s.enqueue({type:le.Data,value:n.data});break}case"update-state":{s.enqueue({type:le.AuiUpdateStateOperations,value:n.operations});break}case"tool-call-args-text-finish":case"part-finish":break;default:{let f=a;throw new Error(`Unsupported chunk type: ${f}`)}}}});return r.pipeThrough(new Ry).pipeThrough(i).pipeThrough(new Ty).pipeThrough(new TextEncoderStream)});G(this,"headers",new Headers({"Content-Type":"text/plain; charset=utf-8","x-vercel-ai-data-stream":"v1"}))}},l(pn,"DataStreamEncoder"),pn),uU=[le.StartToolCall,le.ToolCall,le.TextDelta,le.ReasoningDelta,le.Source,le.Error,le.FinishStep,le.FinishMessage,le.AuiTextDelta,le.AuiReasoningDelta];var Oy=l((t,e=21)=>(r=e)=>{let i="",n=r|0;for(;n--;)i+=t[Math.random()*t.length|0];return i},"customAlphabet");var ky=Oy("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",7);var hi,CO=(hi=class{constructor(e){G(this,"_state");G(this,"_parentId");this._state=e||{merger:gy(),contentCounter:new Bo}}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 Ey(this._state.contentCounter.value)))}merge(e){this._state.merger.addStream(e.pipeThrough(new Sy(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]=nh();return this._addPart({type:"text"},e),r}addReasoningPart(){let[e,r]=nh();return this._addPart({type:"reasoning"},e),r}addToolCallPart(e){let r=typeof e=="string"?{toolName:e}:e,i=r.toolName,n=r.toolCallId??ky(),[s,a]=vy();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 hi(this._state);return r._parentId=e,r}close(){this._state.append?.controller?.close(),this._state.merger.seal(),this._state.closeSubscriber?.()}},l(hi,"_AssistantStreamControllerImpl"),hi);function xy(t){let e=new CO;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(xy,"createAssistantStream");function oa(){let{resolve:t,promise:e}=$o(),r;return[xy(n=>(r=n,r.__internal_subscribeToClose(t),e)),r]}l(oa,"createAssistantStreamController");var mn,ca=(mn=class extends Mo{constructor(){super(e=>{let r=new Fy({transform(i,n){n.appendText(i)}});return e.pipeThrough(new TextDecoderStream).pipeThrough(r)})}},l(mn,"PlainTextDecoder"),mn);var wn,Ay=(wn=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 fr.fromResponse(r,new ca)}},l(wn,"AssistantCloudRuns"),wn);var yn,Py=(yn=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(yn,"AssistantCloudThreadMessages"),yn);var gn,Ny=(gn=class{constructor(e){G(this,"messages");this.cloud=e,this.messages=new Py(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 bn,Dy=(bn=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(bn,"AssistantCloudFiles"),bn);var _n,ah=(_n=class{constructor(e){G(this,"threads");G(this,"auth");G(this,"runs");G(this,"files");let r=new wy(e);this.threads=new Ny(r),this.auth={tokens:new yy(r)},this.runs=new Ay(r),this.files=new Dy(r)}},l(_n,"AssistantCloud"),_n);var Kf=ce(Cn(),1),Jf=ce(Cn(),1),KT=ce(md(),1),Xf=ce(Cn(),1),XT=ce(md(),1),tw=ce(ke(),1),Yf=ce(Cn(),1),iw=ce(ke(),1),Wt=ce(ke(),1),ne=ce(ke(),1),Hf=ce(ke(),1),ii=ce(ke(),1),Lf=ce(ke(),1),qf=ce(ke(),1),Uf=ce(ke(),1),st=ce(ke(),1),oR=ce(ke(),1),Li=ce(ke(),1),Os=ce(ke(),1),lw=ce(ke(),1),or=ce(ke(),1),Ze=ce(ke(),1);import*as ew from"path";import*as UT from"path";import*as HT from"path";import*as jf from"path";import*as rw from"path";var kT=ce(R1(),1);function LM(t){let e=[t];return{next(){return Promise.resolve({done:e.length===0,value:e.pop()})},return(){return e=[],{}},[Symbol.asyncIterator](){return this}}}l(LM,"fromValue");function qM(t){return t[Symbol.asyncIterator]?t[Symbol.asyncIterator]():t[Symbol.iterator]?t[Symbol.iterator]():t.next?t:LM(t)}l(qM,"getIterator");async function xT(t,e){let r=qM(t);for(;;){let{value:i,done:n}=await r.next();if(i&&await e(i),n)break}r.return&&r.return()}l(xT,"forAwait");function UM(t){let{PassThrough:e}=OT(),r=new e;return setTimeout(async()=>{await xT(t,i=>r.write(i)),r.end()},1),r}l(UM,"asyncIteratorToStream");async function WM(t){let e=0,r=[];await xT(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(WM,"collect");function zM(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}}}l(zM,"fromNodeStream");async function HM({onProgress:t,url:e,method:r="GET",headers:i={},agent:n,body:s}){return s&&Array.isArray(s)?s=Buffer.from(await WM(s)):s&&(s=UM(s)),new Promise((a,f)=>{(0,kT.default)({url:e,method:r,headers:i,agent:n,body:s},(o,c)=>{if(o)return f(o);try{let u=zM(c);a({url:c.url,method:c.method,statusCode:c.statusCode,statusMessage:c.statusMessage,body:u,headers:c.headers})}catch(u){f(u)}})})}l(HM,"request");var VM={request:HM},Mf=VM;var He=ce(ke(),1),Zf=ce(Cn(),1),fw=ce(ke(),1);var MT=Object.defineProperty,GM=l((t,e,r)=>e in t?MT(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,"ot"),b=l((t,e)=>MT(t,"name",{value:e,configurable:!0}),"n"),U=l((t,e,r)=>GM(t,typeof e!="symbol"?e+"":e,r),"p"),xs,jT=(xs=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.subFilesystems].reverse()){let i=await r.readdir(this.dirPath);for(let n of i)e.add(n)}for(let r of Array.from(e)){let i=this.dirPath+"/"+r;await this.compositFs.hiddenFilesFileSystem?.responsible(i)||this.entries.push({name:r,path:i})}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(xs,"he"),xs);b(jT,"CompositeFsDir");var LT=jT,As,qT=(As=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)}},l(As,"pe"),As);b(qT,"CompositFsFileHandle");var Gf=qT,Ps,WT=(Ps=class{constructor({name:e,parentFs:r,gitRoot:i}){U(this,"compositFs"),U(this,"gitRoot"),U(this,"name"),this.name=e,this.compositFs=r,this.gitRoot=i}toStr(e){return typeof e=="string"?e:Buffer.isBuffer(e)?e.toString():e&&typeof e=="object"&&"fd"in e?`FileHandle(fd=${e.fd})`:String(e)}async open(e,r,i){throw new Error(`open not implemented for: ${this.toStr(e)}`)}async access(e,r){throw new Error(`access not implemented for: ${this.toStr(e)}`)}async stat(e,r){throw new Error(`lstat not implemented for: ${this.toStr(e)}`)}async lstat(e,r){throw new Error(`lstat not implemented for: ${this.toStr(e)}`)}async opendir(e,r){throw new Error(`opendir not implemented for: ${this.toStr(e)}`)}async link(e,r){throw new Error(`link not implemented for: ${this.toStr(e)}`)}async mkdir(e,r){throw new Error(`mkdir not implemented for: ${this.toStr(e)}`)}async readdir(e,r){throw new Error(`readdir not implemented for: ${this.toStr(e)}`)}async readlink(e,...r){throw new Error(`readlink not implemented for: ${this.toStr(e)}`)}async unlink(e){throw new Error(`unlink not implemented for: ${this.toStr(e)}`)}async rename(e,r){throw new Error(`rename not implemented for: ${this.toStr(e)}`)}async rmdir(e,...r){throw new Error(`rmdir not implemented for: ${this.toStr(e)}`)}async symlink(e,r,i){throw new Error(`symlink not implemented for: ${this.toStr(r)}`)}async lookup(e){throw new Error(`lookup not implemented for: ${this.toStr(e)}`)}resolvePath(e){throw new Error(`resolvePath not implemented for fd: ${e}`)}async close(e){this.compositFs.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: ${this.toStr(e)}`)}async writeFile(e,r,i){throw new Error(`writeFile not implemented for: ${this.toStr(e)}`)}},l(Ps,"ue"),Ps);b(WT,"BaseCompositeSubFs");var So=WT,Ns,zT=(Ns=class extends So{constructor({name:e,parentFs:r,gitRoot:i}){if(super({name:e,parentFs:r,gitRoot:i}),U(this,"openFh",new Map),U(this,"memFs",(0,Kf.createFsFromVolume)(new Kf.Volume)),U(this,"targetFs"),this.compositFs=r,this.gitRoot=i,this.compositFs.parentFs===void 0)throw new Error("PassThroughSubFs not allowed in root fs");this.targetFs=this.compositFs.parentFs}async responsible(e){return!0}fileType(){return 4}async open(e,r,i){let n=UT.dirname(e),s=await this.targetFs.promises.open(e,r,i);return this.openFh.set(s.fd,s),new Gf({fs:this,compositeFs:this.compositFs,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: ${this.toStr(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 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 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 a;if(typeof r=="string"){let f=typeof i=="object"&&i.encoding?i.encoding:"utf8";a=Buffer.from(r,f)}else Buffer.isBuffer(r)?a=r:a=Buffer.from(r);await s.write(a,0,a.length,0)}finally{await this.targetFs.close(s)}}},l(Ns,"Fe"),Ns);b(zT,"PassThroughSubFs");var KM=zT,Ds,VT=(Ds=class extends So{constructor({name:e,parentFs:r,gitRoot:i,passThroughFs:n}){super({name:e,parentFs:r,gitRoot:i}),U(this,"openFh",new Map),U(this,"memFs",(0,Jf.createFsFromVolume)(new Jf.Volume)),U(this,"targetFs"),this.compositFs=r,this.gitRoot=i,this.targetFs=n}async responsible(e){return!0}fileType(){return 4}async open(e,r,i){let n=HT.dirname(e),s=await this.targetFs.promises.open(e,r,i);return this.openFh.set(s.fd,s),new Gf({fs:this,compositeFs:this.compositFs,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 LT(this.compositFs,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: ${this.toStr(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)}},l(Ds,"ge"),Ds);b(VT,"PassThroughToAsyncFsSubFs");var JM=VT,Cs,GT=(Cs=class{constructor({name:e,parentFs:r,storageFs:i,gitRoot:n,defaultBranch:s="main"}){if(U(this,"promises"),U(this,"gitRoot"),U(this,"ephemeralFilesFileSystem"),U(this,"hiddenFilesFileSystem"),U(this,"passThroughFileSystem"),U(this,"subFilesystems",[]),U(this,"parentFs"),U(this,"name"),U(this,"defaultBranch"),U(this,"pathToFileDescriptors",new Map),U(this,"openFileHandles",new Map),U(this,"logOperation"),this.name=e,this.parentFs=r,this.gitRoot=n,this.defaultBranch=s,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)},!r&&i){this.passThroughFileSystem=new JM({name:e+"-passthrough",passThroughFs:i,gitRoot:n,parentFs:this});return}if(!i&&r){this.passThroughFileSystem=new KM({name:e+"-passthrough",parentFs:this,gitRoot:n});return}throw new Error("invalid configuration")}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)}setEphemeralFilesSubFs(e){this.ephemeralFilesFileSystem=e}setHiddenFilesSubFs(e){this.hiddenFilesFileSystem=e}addSubFs(e){this.subFilesystems.push(e)}async getResponsibleFs(e){if(!e.toString().startsWith(this.gitRoot)&&this.gitRoot!=="./")throw new Error("tried to access a file ("+e+") outside of the legit folder: "+this.gitRoot);if(!this.hiddenFilesFileSystem)throw new Error(this.name+" intialize hidden fs first!");if(!this.ephemeralFilesFileSystem)throw new Error(this.name+" intialize ephemeral fs first!");if(await this.hiddenFilesFileSystem.responsible(e.toString()))return this.hiddenFilesFileSystem;if(await this.ephemeralFilesFileSystem.responsible(e.toString()))return this.ephemeralFilesFileSystem;for(let r of this.subFilesystems)if(await r.responsible(e.toString()))return r;return this.passThroughFileSystem}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 opendir(e,r){await this.logOperation?.({fsName:this.name,path:e.toString(),operation:"opendir",operationArgs:{options:r}});let i=e.toString();if(!i.startsWith(this.gitRoot))throw new Error("tried to access a directory ("+i+") outside of the legit folder: "+this.gitRoot);return new LT(this,i)}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 readdir(e,r){await this.logOperation?.({fsName:this.name,path:e.toString(),operation:"readdir",operationArgs:{options:r}});let i=new Set;for(let n of[...this.subFilesystems].reverse()){let s=await n.readdir(e,r);for(let a of s)await this.ephemeralFilesFileSystem?.responsible((e=="/"?"":e)+"/"+a)||i.add(a)}try{let n=await this.passThroughFileSystem.readdir(e,r);for(let s of n)await this.ephemeralFilesFileSystem?.responsible((e=="/"?"":e)+"/"+s)||i.add(s)}catch(n){if(n.code!=="ENOENT")throw new Error("error reading ephemeral fs: "+n)}try{let n=await this.ephemeralFilesFileSystem.readdir(e,r);for(let s of n)i.add(s)}catch(n){if(n.code!=="ENOENT")throw new Error("error reading ephemeral fs: "+n)}for(let n of i){let s=(e=="/"?"":e)+"/"+n;await this.hiddenFilesFileSystem.responsible(s)&&i.delete(n)}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 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 link(e,r){throw new Error("not implemented")}async readlink(e,r){throw new Error("not implemented")}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 rename(e,r){if(this.hiddenFilesFileSystem){if(await this.hiddenFilesFileSystem.responsible(ew.basename(e.toString())))throw new Error("Renaming of hidden Files is not allowed "+e);if(await this.hiddenFilesFileSystem.responsible(ew.basename(r.toString())))throw new Error("Renaming to hidden Files is not allowed "+r)}let i=await this.getResponsibleFs(e),n=await this.getResponsibleFs(r);if(i===n)return await this.logOperation?.({fsName:i.name,path:e.toString(),operation:"rename",operationArgs:{oldPath:e,newPath:r}}),i.rename(e,r);let s=await i.open(e.toString(),"r");try{let a=await i.fstat(s),f=Buffer.alloc(a.size);await i.read(s,f,0,a.size,0),await i.close(s),await n.writeFile(r.toString(),f,"utf8"),await i.unlink(e)}catch(a){try{await i.close(s)}catch{}throw a}}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 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:f}=await n.read(a,0,s,0);if(r&&typeof r.encoding=="string")return a.slice(0,f).toString(r.encoding);if(typeof r=="string"){if(r==="utf8"||r==="utf-8")return a.slice(0,f).toString(r);throw new Error("Unsupported encoding: "+r)}return a.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,a,f,o="w";if(typeof i=="string"?a=i:i&&typeof i=="object"&&(a=i.encoding,f=i.mode,o=i.flag||"w"),typeof e=="number"){let c=this.getFilehandle(e);if(!c)throw new Error("Invalid file descriptor");s=c}else if(typeof e=="string")s=await this.open(e,o,f);else throw new Error("only filehandle and path are supported atm");try{let c;if(typeof r=="string")c=Buffer.from(r,a||"utf8");else if(r instanceof Buffer)c=r;else if(r instanceof Uint8Array)c=Buffer.from(r);else throw new Error("Invalid data type for writeFile");let u=0;for(;u<c.length;){let{bytesWritten:h}=await s.write(c,u,c.length-u,u);u+=h}}finally{s&&n&&await s.close()}}},l(Cs,"ye"),Cs);b(GT,"CompositeFs");var AT=GT,Is,JT=(Is=class extends So{constructor({name:e,parentFs:r,gitRoot:i,hiddenFiles:n}){super({name:e,parentFs:r,gitRoot:i}),U(this,"ig"),this.ig=(0,KT.default)(),this.ig.add(n)}async responsible(e){let r=e.replace(/\\/g,"/"),i=r.startsWith("./")?r.slice(2):r;return 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: ${this.toStr(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 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(Is,"be"),Is);b(JT,"HiddenFileSubFs");var PT=JT,$s,YT=($s=class extends So{constructor({name:e,parentFs:r,gitRoot:i,ephemeralPatterns:n}){super({name:e,parentFs:r,gitRoot:i}),U(this,"openFh",new Map),U(this,"memFs",(0,Xf.createFsFromVolume)(new Xf.Volume)),U(this,"ig"),U(this,"patterns"),this.compositFs=r,this.gitRoot=i,this.ig=(0,XT.default)(),this.ig.add(n),this.patterns=n}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.startsWith("./")?r.slice(2):r;return 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=jf.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 Gf({fs:this,compositeFs:this.compositFs,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=jf.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: ${this.toStr(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=jf.dirname(n);return s&&s!=="/"&&s!=="."&&await this.memFs.promises.mkdir(s,{recursive:!0}),this.memFs.promises.writeFile(n,r,i)}},l($s,"ve"),$s);b(YT,"EphemeralSubFs");var NT=YT,XM=new Set([" ","~","^",":","?","*","[","\\"]),YM=[/^\/|\/$/,/\/\//,/\.$/,/\.lock$/,/^@$/,/@\{/],ZT="\u2002";function nw(t){let e=t.codePointAt(0);return!(e>=0&&e<=31||e===127||XM.has(t))}l(nw,"xe");b(nw,"isValidChar");function QT(t){let e="";for(let r of t)r===" "?e+=ZT:nw(r)?e+=r:e+="%"+r.codePointAt(0);for(let r of YM)if(r.test(e))return Array.from(e).map(i=>nw(i)?i:"%"+i.codePointAt(0)).join("");return e}l(QT,"Me");b(QT,"encodeName");function eR(t){return t.replace(/%(\d+)/g,(e,r)=>String.fromCodePoint(parseInt(r,10))).replace(new RegExp(ZT,"g")," ")}l(eR,"ze");b(eR,"decodeName");function zf(t){return t.replace(/\./g,"%2E").replace(/\//g,".")}l(zf,"Q");b(zf,"encodeBranchNameForVfs");function qt(t){return t.replace(/\./g,"/").replace(/%2E/g,".")}l(qt,"N");b(qt,"decodeBranchNameFromVfs");async function Me(t,e,r){try{return await Wt.default.resolveRef({fs:t,dir:e,ref:`refs/heads/${qt(r)}`})}catch{return}}l(Me,"D");b(Me,"tryResolveRef");async function Tr({dir:t,fs:e,treeOid:r,deletePathParts:i,addPathParts:n,addObj:s,addKeepIfEmpty:a,deleteKeepIfNotEmpty:f,keepFilename:o=".keep"}){let[c,...u]=n??[],[h,...d]=i??[],p=[];if(r){let{tree:m}=await Wt.default.readTree({fs:e,dir:t,oid:r});p=[...m]}if(c===h){let m=c;if(m===void 0)throw new Error("illegal arguement - called with out a path part");if(u.length===0)throw new Error("can not move into it self");if(d.length===0)throw new Error("can not move from it self");let w=p.findIndex(F=>F.path===m),y=(w!==-1?p[w]:void 0)?.oid,g=await Tr({dir:t,fs:e,treeOid:y,addPathParts:u,deletePathParts:d,addObj:s,addKeepIfEmpty:a,deleteKeepIfNotEmpty:f});if(g===void 0)throw new Error("on the same path we expect an update - respectivly a newly created subTreeOid");let _=!1;if(g!==y){_=!0;let F={mode:"040000",path:m,oid:g,type:"tree"};w!==-1?p[w]=F:p.push(F)}if(r==null&&!_)throw new Error("Illegal state - if the currentOid is undefined - a new tree should have been created (an update should have happened)");if(_)return await Wt.default.writeTree({fs:e,dir:t,tree:p});if(r===void 0)throw new Error("currentOid should be set - since the sub tree didn't exist and ");return r}else{let m=!1,w;if(h){let y=p.findIndex(_=>_.path===h),g=y!==-1?p[y]:void 0;if(g===void 0)throw new Error("Element doesnt exist in tree");if(d.length>0){if(g&&g.type!=="tree")throw new Error("SubPart of the path for the obj to delete is not a tree");let _=await Tr({dir:t,fs:e,treeOid:g.oid,addPathParts:void 0,deletePathParts:d,addObj:s,addKeepIfEmpty:a,deleteKeepIfNotEmpty:f});if(_===g.oid)throw new Error("in case of a delete we expect a different subtree oid");m=!0,_===void 0?p.splice(y,1):p[y]={mode:"040000",path:h,oid:_,type:"tree"}}else if(m=!0,p.splice(y,1),p.length===0&&a){let _=new Uint8Array(0),F=await Wt.default.writeBlob({fs:e,dir:t,blob:_});p.push({mode:"100644",oid:F,path:o,type:"blob"})}w=g}if(c){let y=p.findIndex(_=>_.path===c),g=y!==-1?p[y]:void 0;if(u.length>0){if(g&&g.type!=="tree")throw new Error("SubPart of the path for the obj to add is not a tree");let _=await Tr({dir:t,fs:e,treeOid:g?.oid,addPathParts:u,deletePathParts:void 0,addObj:s,addKeepIfEmpty:a,deleteKeepIfNotEmpty:f});if(_===void 0)throw new Error("in case we add, we expect an update - respectivly a newly created subTreeOid");if(_!==g?.oid){m=!0;let F={mode:"040000",path:c,oid:_,type:"tree"};if(y!==-1)p[y]=F;else if(p.push(F),f&&p.length>1){let R=p.findIndex(k=>k.path===o);R!==-1&&p.splice(R,1)}}}else{if(m=!0,s){let _={mode:s.type==="tree"?"040000":"100644",path:c,oid:s.oid,type:s.type};if(y!==-1)p[y]=_;else{if(f&&p.length>0){let F=p.findIndex(R=>R.path===o);F!==-1&&p.splice(F,1)}p.push(_)}}if(a&&p.length===0){let _=new Uint8Array(0),F=await Wt.default.writeBlob({fs:e,dir:t,blob:_});p.push({mode:"100644",oid:F,path:o,type:"blob"})}}}if(p.length===0)return;if(m)return await Wt.default.writeTree({fs:e,dir:t,tree:p});if(r===void 0)throw new Error("currentOid should be set - since the sub tree didn't exist and ");return r}}l(Tr,"x");b(Tr,"buildUpdatedTree");async function ks({filePath:t,gitRoot:e,nodeFs:r,commitSha:i,pathParams:n}){if(!n.filePath){let s=await Wt.default.readTree({fs:r,dir:e,oid:i});return{type:"tree",entries:s.tree.map(a=>Ui({parent:t,name:a.path,isDir:a.type==="tree"})),oid:s.oid}}return(await Wt.default.walk({fs:r,dir:e,trees:[Wt.default.TREE({ref:i})],map:b(async(s,[a])=>{if(s===n.filePath&&a){let f=await a.type();if(f==="blob")return{type:"blob",oid:await a.oid()};if(f=="tree"){let o=await Wt.default.readTree({fs:r,dir:e,oid:await a.oid()});return{type:"tree",entries:o.tree.map(c=>Ui({parent:t,name:c.path,isDir:c.type==="tree"})),oid:o.oid}}}},"map")})).find(s=>s!==void 0)}l(ks,"_");b(ks,"resolveGitObjAtPath");function Ui(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(Ui,"$");b(Ui,"toDirEntry");var tR={type:"gitBranchesListVirtualFile",rootType:"folder",getStats:b(async({gitRoot:t,nodeFs:e})=>{let r=t+"/.git";try{return await e.stat(r)}catch{throw new Error(`ENOENT: no such file or directory, stat '${r}'`)}},"getStats"),getFile:b(async({gitRoot:t,nodeFs:e,filePath:r})=>{try{let i=await iw.default.listBranches({fs:e,dir:t}),n=await Promise.all(i.map(async s=>{let a=await iw.default.resolveRef({fs:e,dir:t,ref:s});return Ui({parent:r,name:zf(s),isDir:!0})}));return{type:"directory",content:n,mode:493,size:n}}catch(i){throw i}},"getFile"),rename:b(async t=>{throw new Error("not implemented")},"rename"),mkdir:b(async function(t){throw new Error("not implemented")},"mkdir")},qi,rR=(qi=class extends Error{constructor(e,r){super(e),U(this,"code","ENOENT"),U(this,"path"),this.name="ENOENTError",this.path=r,Object.setPrototypeOf(this,qi.prototype)}},l(qi,"ne"),qi);b(rR,"ENOENTError");var sw=rR;async function he(t,e){try{let r=await Hf.default.getConfig({fs:e,dir:t,path:"user.legit-current-branch"});if(r)return zf(r)}catch{}try{let r=await Hf.default.getConfig({fs:e,dir:t,path:"init.defaultBranch"});return zf(r)||"main"}catch{return"main"}}l(he,"b");b(he,"getCurrentBranch");async function iR(t,e,r){await Hf.default.setConfig({fs:e,dir:t,path:"user.legit-current-branch",value:qt(r)})}l(iR,"We");b(iR,"setCurrentBranch");var Vf={type:"gitBranchFileVirtualFile",rootType:"folder",getStats:b(async({gitRoot:t,nodeFs:e,filePath:r,cacheFs:i,pathParams:n})=>{n.branchName===void 0&&(n.branchName=await he(t,e));let s=await Me(e,t,n.branchName);if(!s)throw new sw(`ENOENT: no such file or directory, stat '${r}'`,r);let a=await ks({filePath:r,gitRoot:t,nodeFs:e,commitSha:s,pathParams:n});if(!a)throw new sw(`ENOENT: no such file or directory, stat '${r}'`,r);let f=await ne.default.readCommit({fs:e,dir:t,oid:s}),{commit:o}=f,c=await ne.default.log({fs:e,dir:t,ref:s,filepath:n.filePath,depth:1}),u=o.committer.timestamp*1e3,h=c.length>0?c[0].commit.committer.timestamp*1e3:u;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:h,mtimeMs:h,ctimeMs:h,birthtimeMs:u,atime:new Date(h),mtime:new Date(h),ctime:new Date(h),birthtime:new Date(h)};{let{blob:d}=await ne.default.readBlob({fs:e,dir:t,oid:a.oid});return{mode:420,size:d.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(d.length/4096),atimeMs:h,mtimeMs:h,ctimeMs:h,birthtimeMs:h,atime:new Date(h),mtime:new Date(h),ctime:new Date(h),birthtime:new Date(h)}}},"getStats"),getFile:b(async({filePath:t,gitRoot:e,nodeFs:r,cacheFs:i,pathParams:n})=>{n.branchName===void 0&&(n.branchName=await he(e,r));try{let s=await Me(r,e,n.branchName);if(!s){let f=await ne.default.resolveRef({fs:r,dir:e,ref:"HEAD"});await ne.default.branch({fs:r,dir:e,ref:n.branchName,object:f}),s=await ne.default.resolveRef({fs:r,ref:`refs/heads/${n.branchName}`,dir:e})}let a=await ks({filePath:t,gitRoot:e,nodeFs:r,commitSha:s,pathParams:n});if(!a)return;if(a.type==="blob"){let{blob:f}=await ne.default.readBlob({fs:r,dir:e,oid:a.oid});return{type:"file",content:Buffer.from(f),mode:420,size:f.length,oid:a.oid}}else{let f=[];try{let o=await i.promises.stat(t);if(o&&o.isDirectory()){let c=await i.promises.readdir(t,{withFileTypes:!0});f.push(...c)}}catch{}return{type:"directory",content:Array.from(new Set([...f,...a.entries])).map(o=>({...o,name:o.name.toString(),path:`${t}`,parentPath:`${t}`})),mode:493}}}catch{return}},"getFile"),unlink:b(async({filePath:t,gitRoot:e,nodeFs:r,cacheFs:i,pathParams:n,author:s})=>{if(n.branchName===void 0&&(n.branchName=await he(e,r)),!n.filePath)throw new Error("filePath should be in pathParams");let a=await Me(r,e,n.branchName);if(!a)throw new Error("Invalid branch file path - branch must exist");let f=await ne.default.readTree({fs:r,dir:e,oid:a}),o=await Tr({dir:e,fs:r,treeOid:f.oid,deletePathParts:n.filePath.split("/"),addPathParts:void 0,addObj:void 0,deleteKeepIfNotEmpty:!1,addKeepIfEmpty:!0,keepFilename:".keep"});if(o!==f.oid){let c=await ne.default.commit({fs:r,dir:e,message:`Delete ${n.filePath}`,tree:o,noUpdateBranch:!0,parent:[a],author:s});await ne.default.writeRef({fs:r,dir:e,ref:`refs/heads/${qt(n.branchName)}`,value:c,force:!0})}},"unlink"),writeFile:b(async({filePath:t,gitRoot:e,nodeFs:r,content:i,cacheFs:n,pathParams:s,author:a})=>{if(s.branchName===void 0&&(s.branchName=await he(e,r)),s.filePath===void 0)throw new Error("filePath should be in pathParams");let f;typeof i=="string"?f=new TextEncoder().encode(i):f=new Uint8Array(i);let o=await ne.default.writeBlob({fs:r,dir:e,blob:f}),c=await Me(r,e,s.branchName);if(!c){let d=await ne.default.resolveRef({fs:r,dir:e,ref:"HEAD"});if(await ne.default.branch({fs:r,dir:e,ref:qt(s.branchName),object:d}),c=await Me(r,e,s.branchName),!c)throw new Error("Could not create branch for writeFile")}let u=await ne.default.readTree({fs:r,dir:e,oid:c}),h=await Tr({dir:e,fs:r,treeOid:u.oid,deletePathParts:void 0,addPathParts:s.filePath.split("/"),addObj:{type:"blob",oid:o},deleteKeepIfNotEmpty:!0,addKeepIfEmpty:!1,keepFilename:".keep"});if(h!==u.oid){let d=await ne.default.commit({fs:r,dir:e,message:`\u{1F4BE} Change '${s.filePath}'`,tree:h,noUpdateBranch:!0,parent:[c],author:a});await ne.default.writeRef({fs:r,dir:e,ref:`refs/heads/${qt(s.branchName)}`,value:d,force:!0})}},"writeFile"),rename:b(async function({filePath:t,newPath:e,gitRoot:r,nodeFs:i,pathParams:n,newPathParams:s,author:a}){if(n.branchName===void 0&&(n.branchName=await he(r,i)),n.filePath===void 0)throw new Error("filePath should be in pathParams");if(s.branchName===void 0&&(s.branchName=await he(r,i)),s.filePath===void 0)throw new Error("filePath should be in newPathParams");let f=await Me(i,r,n.branchName);if(!f)throw new Error("Invalid branch file path - source branch must exist");let o=await Me(i,r,s.branchName);if(!o){let d=await ne.default.resolveRef({fs:i,dir:r,ref:"HEAD"});if(await ne.default.branch({fs:i,dir:r,ref:qt(s.branchName),object:d}),o=await Me(i,r,s.branchName),o===void 0)throw new Error("Could not create branch for rename operation")}if(s.branchName!==n.branchName)throw new Error("cross branch move not implemented yet");let c=await ks({gitRoot:r,nodeFs:i,commitSha:f,filePath:t,pathParams:n});if(c===void 0)throw new Error("no obj at path exists");let u=await Tr({dir:r,fs:i,deletePathParts:n.filePath.split("/"),addPathParts:s.filePath.split("/"),addObj:c.type==="blob"?{type:"blob",oid:c.oid}:{type:"tree",oid:c.oid,entries:c.entries.map(d=>d.name.toString())},treeOid:o,addKeepIfEmpty:!0,deleteKeepIfNotEmpty:!0}),h=await ne.default.readTree({fs:i,dir:r,oid:f});if(u!==h.oid){let d=await ne.default.commit({fs:i,dir:r,message:`\u{1F500} Rename '${n.filePath}' to '${s.filePath}'`,tree:u,noUpdateBranch:!0,parent:[o],author:a});await ne.default.writeRef({fs:i,dir:r,ref:`refs/heads/${qt(s.branchName)}`,value:d,force:!0})}},"rename"),mkdir:b(async function(t){if(t.pathParams.branchName===void 0&&(t.pathParams.branchName=await he(t.gitRoot,t.nodeFs)),t.pathParams.filePath===void 0)throw new Error("filePath should be in pathParams");try{throw await Vf.getStats(t),new Error("Folder exists")}catch{}t.filePath.endsWith("/")&&(t.filePath=t.filePath.replace(/\/+$/,"")),t.pathParams&&typeof t.pathParams.filePath=="string"&&(t.pathParams.filePath=t.pathParams.filePath.replace(/\/+$/,""));let e=await Me(t.nodeFs,t.gitRoot,t.pathParams.branchName);if(!e){let a=await ne.default.resolveRef({fs:t.nodeFs,dir:t.gitRoot,ref:"HEAD"});if(await ne.default.branch({fs:t.nodeFs,dir:t.gitRoot,ref:qt(t.pathParams.branchName),object:a}),e=await Me(t.nodeFs,t.gitRoot,t.pathParams.branchName),e===void 0)throw new Error("Could not create branch for mkdir operation")}let r=await ne.default.readTree({fs:t.nodeFs,dir:t.gitRoot,oid:e}),i=new Uint8Array(0),n=await ne.default.writeBlob({fs:t.nodeFs,dir:t.gitRoot,blob:i}),s=await Tr({dir:t.gitRoot,fs:t.nodeFs,treeOid:r.oid,deletePathParts:void 0,addPathParts:[...t.pathParams.filePath.split("/"),".keep"],addObj:{type:"blob",oid:n},deleteKeepIfNotEmpty:!0,addKeepIfEmpty:!0,keepFilename:".keep"});if(s!==r.oid){let a=await ne.default.commit({fs:t.nodeFs,dir:t.gitRoot,message:`\u{1F4BE} Change '${t.pathParams.filePath}'`,tree:s,noUpdateBranch:!0,parent:[e],author:t.author});await ne.default.writeRef({fs:t.nodeFs,dir:t.gitRoot,ref:`refs/heads/${qt(t.pathParams.branchName)}`,value:a,force:!0})}},"mkdir"),rmdir:b(async({filePath:t,gitRoot:e,nodeFs:r,cacheFs:i,pathParams:n,author:s})=>{if(n.branchName===void 0&&(n.branchName=await he(e,r)),!n.filePath)throw new Error("filePath should be in pathParams");let a=await Me(r,e,n.branchName);if(!a)throw new Error("Invalid branch file path - branch must exist");let f=await ne.default.readTree({fs:r,dir:e,oid:a}),o=await Tr({dir:e,fs:r,treeOid:f.oid,deletePathParts:n.filePath.split("/"),addPathParts:void 0,addObj:void 0,deleteKeepIfNotEmpty:!1,addKeepIfEmpty:!0,keepFilename:".keep"});if(o!==f.oid){let c=await ne.default.commit({fs:r,dir:e,message:`Delete ${n.filePath}`,tree:o,noUpdateBranch:!0,parent:[a],author:s});await ne.default.writeRef({fs:r,dir:e,ref:`refs/heads/${qt(n.branchName)}`,value:c,force:!0})}},"rmdir")},aw={type:"gitBranchHeadVirtualFile",rootType:"file",getStats:b(async({gitRoot:t,nodeFs:e,pathParams:r})=>{r.branchName===void 0&&(r.branchName=await he(t,e));let i;try{i=await ii.default.resolveRef({fs:e,dir:t,ref:r.branchName})}catch{i=await ii.default.resolveRef({fs:e,dir:t,ref:`refs/heads/${r.branchName}`})}let n=await ii.default.readCommit({fs:e,dir:t,oid:i}),{commit:s}=n,a=s.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(40/4096),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({gitRoot:t,nodeFs:e,pathParams:r})=>{r.branchName===void 0&&(r.branchName=await he(t,e));try{let i;try{i=await ii.default.resolveRef({fs:e,dir:t,ref:r.branchName})}catch{i=await ii.default.resolveRef({fs:e,dir:t,ref:`refs/heads/${r.branchName}`})}return{type:"file",content:i+`
101
- `,mode:420,size:i.length}}catch{return}},"getFile"),writeFile:b(async({filePath:t,gitRoot:e,nodeFs:r,content:i,cacheFs:n,pathParams:s})=>{console.log("gitBranchHeadVirtualFile writeFile called",{pathParams:s,content:i}),s.branchName===void 0&&(s.branchName=await he(e,r));let a=i.toString().trim();try{await ii.default.readCommit({fs:r,dir:e,oid:a})}catch{throw new Error(`Commit ${a} does not exist in the repository`)}await ii.default.writeRef({fs:r,dir:e,ref:"refs/heads/"+s.branchName,value:a,force:!0})},"writeFile"),rename(t){throw new Error("not implementsd")},mkdir:b(async function(t){throw new Error("not implemented")},"mkdir")},ZM={type:"gitBranchTipVirtualFile",rootType:"file",getStats:b(async t=>{let e=t.gitRoot+"/.git";try{return await t.nodeFs.stat(e)}catch{throw new Error(`ENOENT: no such file or directory, stat '${e}'`)}},"getStats"),getFile:b(async({filePath:t,gitRoot:e,nodeFs:r,pathParams:i})=>{if(!i.branchName)throw new Error("branchName should be in pathParams");let n=await Me(r,e,i.branchName);if(n!==void 0)return{type:"file",content:n+`
102
- `,mode:420,size:n.length+1}},"getFile"),rename(t){throw new Error("not implementsd")},mkdir:b(async function(t){throw new Error("not implemented")},"mkdir")},nR={type:"gitCommitFileVirtualFile",rootType:"file",getStats:b(async({filePath:t,gitRoot:e,nodeFs:r,pathParams:i})=>{if(!i.sha_1_1_2)throw new Error("sha_1_1_2 should be in pathParams");if(!i.sha1_3__40)throw new Error("sha1_3__40 should be in pathParams");let n=i.sha_1_1_2+i.sha1_3__40,s=await ks({filePath:t,gitRoot:e,nodeFs:r,commitSha:n,pathParams:i});if(!s)throw new sw(`ENOENT: no such file or directory, stat '${t}'`,t);let a=await Lf.default.readCommit({fs:r,dir:e,oid:n}),{commit:f}=a,o=f.committer.timestamp*1e3;if(s.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:o,mtimeMs:o,ctimeMs:o,birthtimeMs:o,atime:new Date(o),mtime:new Date(o),ctime:new Date(o),birthtime:new Date(o)};{let{blob:c}=await Lf.default.readBlob({fs:r,dir:e,oid:s.oid});return{mode:420,size:c.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(c.length/4096),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:b(async({filePath:t,gitRoot:e,nodeFs:r,pathParams:i})=>{if(!i.sha_1_1_2)throw new Error("sha_1_1_2 should be in pathParams");if(!i.sha1_3__40)throw new Error("sha1_3__40 should be in pathParams");let n=i.sha_1_1_2+i.sha1_3__40;try{let s=await ks({filePath:t,gitRoot:e,nodeFs:r,commitSha:n,pathParams:i});if(!s)return;if(s.type==="blob"){let{blob:a}=await Lf.default.readBlob({fs:r,dir:e,oid:s.oid});return{type:"file",content:Buffer.from(a),mode:420,size:a.length,oid:s.oid}}else return{type:"directory",content:Array.from(new Set([...s.entries.filter(a=>a.name!==".keep")])).map(a=>({...a,name:a.name.toString(),path:`${t}`,parentPath:`${t}`})),mode:493}}catch{return}},"getFile"),rename(t){throw new Error("not implementsd")},mkdir:b(async function(t){throw new Error("not implemented")},"mkdir")};function sR(t,e,r){return t===0&&e===2&&r===0?"untracked":t===1&&e===0&&r===0?"deleted":t===1&&e===2&&r!==0?"modified":t===0&&e===2&&r===2?"added":"unknown"}l(sR,"gt");b(sR,"getFileStatus");var QM={type:"gitStatusVirtualFile",rootType:"file",getStats:b(async t=>{let e=t.gitRoot+"/.git";try{return await t.nodeFs.stat(e)}catch{throw new Error(`ENOENT: no such file or directory, stat '${e}'`)}},"getStats"),getFile:b(async({gitRoot:t,nodeFs:e})=>{try{let r=await qf.default.currentBranch({fs:e,dir:t})||"HEAD",i=await qf.default.resolveRef({fs:e,dir:t,ref:"HEAD"}),n=(await qf.default.statusMatrix({fs:e,dir:t})).filter(([,a,f,o])=>a!==f||f!==o).map(([a,f,o,c])=>({path:a,status:sR(f,o,c)})),s=JSON.stringify({branch:r,commit:i,clean:n.length===0,files:n},null,2);return{type:"file",content:s,mode:33188,size:Buffer.byteLength(s)}}catch(r){throw console.error(r),r}},"getFile"),rename(t){throw new Error("not implementsd")},mkdir:b(async function(t){throw new Error("not implemented")},"mkdir")},ow={type:"legitVirtualFile",rootType:"folder",getStats:b(async({gitRoot:t,nodeFs:e})=>{let r=t+"/.git";try{return await e.stat(r)}catch{throw new Error(`ENOENT: no such file or directory, stat '${r}'`)}},"getStats"),getFile:b(async({gitRoot:t,nodeFs:e})=>{throw new Error("not implemented")},"getFile"),rename(t){throw new Error("not implemented")},mkdir:b(async function(t){throw new Error("not implemented")},"mkdir")},ej=[ow,QM,nR,tR,Vf,aw,ZM],Bs,aR=(Bs=class{constructor(e){this.routes=e,U(this,"compiledRoutes");let r={},i=b((n,s)=>{if(typeof n.type=="string"){r[s]={handler:n,siblings:[]};let a=n}else{let a=[];for(let[f,o]of Object.entries(n))if(f==="."){if(r[s])throw new Error(`Conflict: multiple handlers for path '${s}', '.' and optional '[[parameter_name]]' defined?`);r[s]={handler:o,siblings:a}}else if(f.startsWith("[[")&&f.endsWith("]]")){if(r[s])throw new Error(`Conflict: multiple handlers for path '${s}', '.' and optional '[[parameter_name]]' defined?`);r[s]={handler:o,siblings:a},f.startsWith("[[...")?r[s?`${s}/${f}`:f]={handler:o,siblings:[]}:i(o,s?`${s}/${f}`:f)}else f.startsWith("[")&&f.endsWith("]")?f.startsWith("[...")?r[s?`${s}/${f}`:f]={handler:o,siblings:[]}:i(o,s?`${s}/${f}`:f):(a.push({segment:f,type:o["."]?"folder":"file"}),i(o,s?`${s}/${f}`:f))}},"walk");i(e,""),this.compiledRoutes=Object.entries(r).map(([n,s])=>{let a=[],f=n.split("/").map(o=>{if(o.startsWith("[[")&&o.endsWith("]]")){let c=o.slice(2,-2).replace(/^\.\.\./,"");return a.push(c),"(.*)"}if(o.startsWith("[")&&o.endsWith("]")){let c=o.slice(1,-1);return a.push(c),"([^/]+)"}return o.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}).join("/");return{regex:new RegExp(`^${f}$`),paramNames:a,staticSiblings:s.siblings,handler:s.handler}})}match(e){e.length>1&&e.endsWith("/")&&(e=e.replace(/\/+$/,""));for(let{regex:r,paramNames:i,handler:n,staticSiblings:s}of this.compiledRoutes){let a=e.match(r);if(!a)continue;let f={};for(let o=0;o<i.length;o++)f[i[o]]=decodeURIComponent(a[o+1]||"");return{handler:n,params:f,staticSiblings:s}}}},l(Bs,"Se"),Bs);b(aR,"LegitPathRouter");var tj=aR,DT={type:"gitCommitVirtualFolder",rootType:"folder",getStats:b(async t=>{let e=t.gitRoot+"/.git";try{return await t.nodeFs.stat(e)}catch{throw new Error(`ENOENT: no such file or directory, stat '${e}'`)}},"getStats"),getFile:b(async({filePath:t,gitRoot:e,nodeFs:r,pathParams:i})=>{let n=await Uf.default.listBranches({fs:r,dir:e}),s=new Set,a=new Set;for(let c of n){let u=`refs/heads/${c}`;try{let h=await Uf.default.resolveRef({fs:r,dir:e,ref:u});s.add(h)}catch{}}for(let c of s){let u=await Uf.default.log({fs:r,dir:e,ref:c});for(let h of u)a.add(h.oid)}if(!i.sha_1_1_2){let c=new Set;for(let h of a)if(c.add(h.slice(0,2)),c.size>=256)break;let u=Array.from(c).sort().map(h=>Ui({parent:t,name:h,isDir:!0}));return{type:"directory",content:u,mode:493,size:u}}let f=new Set;for(let c of a)c.startsWith(i.sha_1_1_2)&&f.add(c.slice(2,40));let o=Array.from(f).sort().map(c=>Ui({parent:t,name:c,isDir:!0}));return{type:"directory",content:o,mode:493,size:o.length}},"getFile"),rename(t){throw new Error("not implementsd")},mkdir:b(async function(t){throw new Error("not implemented")},"mkdir")},cR="-operation";async function xt(t,e,r){return(await oR.default.listBranches({fs:t,dir:e})).filter(i=>i.endsWith("__"+r+cR))[0]}l(xt,"O");b(xt,"resolveOperationBranchName");var CT={type:"gitBranchOperationVirtualFile",rootType:"file",getStats:b(async t=>{let{gitRoot:e,nodeFs:r,pathParams:i}=t;i.branchName===void 0&&(i.branchName=await he(e,r));let n;try{n=await st.default.resolveRef({fs:r,dir:e,ref:`refs/heads/${i.branchName}`})}catch{throw new Error(`Base Branch ${i.branchName} for operations does not exis`)}let s=await xt(r,e,i.branchName),a=!1;if(s)try{n=await st.default.resolveRef({fs:r,dir:e,ref:s}),a=!0}catch{try{n=await st.default.resolveRef({fs:r,dir:e,ref:`refs/heads/${s}`}),a=!0}catch{}}let f=await st.default.readCommit({fs:r,dir:e,oid:n}),{commit:o}=f,c=o.committer.timestamp*1e3;try{return{mode:420,size:40,atimeMs:c,mtimeMs:c,ctimeMs:c,birthtimeMs:c,atime:new Date(c),mtime:new Date(c),ctime:new Date(c),birthtime:new Date(c),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 t=>{let{gitRoot:e,nodeFs:r,pathParams:i}=t;i.branchName===void 0&&(i.branchName=await he(e,r));let n=await xt(r,e,i.branchName),s,a=!1;return n?(s=await st.default.resolveRef({fs:r,dir:e,ref:`refs/heads/${n}`}),a=!0):s=await st.default.resolveRef({fs:r,dir:e,ref:`refs/heads/${i.branchName}`}),{type:"file",content:Buffer.from(s),mode:420,size:s.length}},"getFile"),writeFile:b(async({filePath:t,gitRoot:e,nodeFs:r,content:i,cacheFs:n,pathParams:s,author:a})=>{s.branchName===void 0&&(s.branchName=await he(e,r));let f;typeof i=="string"?f=new TextEncoder().encode(i):f=new Uint8Array(i);let o=await st.default.writeBlob({fs:r,dir:e,blob:f}),c=await Me(r,e,s.branchName);if(!c)throw new Error("Invalid branch file path - branch doesn't exist");let u=await xt(r,e,s.branchName),h=!1;u||(u="legit/__"+s.branchName+cR,await st.default.branch({fs:r,dir:e,ref:u,object:c}),h=!0);let d=await st.default.resolveRef({fs:r,dir:e,ref:`refs/heads/${u}`}),p=await st.default.readTree({fs:r,dir:e,oid:c}),m;i instanceof ArrayBuffer?m=Buffer.from(i).toString("utf-8"):typeof i=="string"?m=i:i instanceof Uint8Array?m=Buffer.from(i).toString("utf-8"):m=String(i);let w=!1;if(!h){let g=await st.default.findMergeBase({fs:r,dir:e,oids:w?[d]:[d,c]});g.length===1&&g[0]===c&&(w=!0)}let y=await st.default.commit({fs:r,dir:e,message:m,tree:p.oid,noUpdateBranch:!0,author:a,parent:w?h?[c,c]:[d]:[d,c]});await st.default.writeRef({fs:r,dir:e,ref:`refs/heads/${u}`,value:y,force:!0})},"writeFile"),rename:b(async function({filePath:t,newPath:e,gitRoot:r,nodeFs:i,pathParams:n,newPathParams:s}){throw new Error("not implemented")},"rename"),mkdir:b(async function(t){throw new Error("not implemented")},"mkdir")},cw={type:"gitBranchOperationsVirtualFile",rootType:"file",getStats:b(async t=>{let{gitRoot:e,nodeFs:r,pathParams:i}=t;i.branchName===void 0&&(i.branchName=await he(e,r));let n=await xt(r,e,i.branchName),s,a=!1;if(n)try{s=await Li.default.resolveRef({fs:r,dir:e,ref:n}),a=!0}catch{try{s=await Li.default.resolveRef({fs:r,dir:e,ref:`refs/heads/${n}`}),a=!0}catch{throw new Error(`Base Branch ${i.branchName} for operations does not exis`)}}else try{s=await Li.default.resolveRef({fs:r,dir:e,ref:`refs/heads/${i.branchName}`})}catch{throw new Error(`Base Branch ${i.branchName} for operations does not exis`)}let f=await Li.default.readCommit({fs:r,dir:e,oid:s}),{commit:o}=f,c=o.committer.timestamp*1e3;try{return{mode:420,size:(a?await cw.getFile(t):void 0)?.content?.length??0,atimeMs:c,mtimeMs:c,ctimeMs:c,birthtimeMs:c,atime:new Date(c),mtime:new Date(c),ctime:new Date(c),birthtime:new Date(c),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 t=>{let{gitRoot:e,nodeFs:r,pathParams:i}=t;i.branchName===void 0&&(i.branchName=await he(e,r));let n=await xt(r,e,i.branchName),s=[];if(n){let o=await Li.default.resolveRef({fs:r,dir:e,ref:`refs/heads/${n}`}),c=!1,u=o;for(;u&&!c;){let h=await Li.default.readCommit({fs:r,dir:e,oid:u});s.push({oid:h.oid,parentOids:h.commit.parent,message:h.commit.message,originBranchOid:"unset"}),u=h.commit.parent&&h.commit.parent.length>0?h.commit.parent[0]:null,h.commit.parent.length===2&&h.commit.parent[0]===h.commit.parent[1]&&(c=!0)}}let a;for(let o=s.length-1;o>=0;o--){let c=s[o];if(a===void 0){if(c.parentOids.length!==2&&c.parentOids[0]!==c.parentOids[1])throw new Error(`Operation commit ${c.oid} does not have two parents as expected`);a=c.parentOids[1]}c.parentOids.length===2&&(a=c.parentOids[1]),c.originBranchOid=a}let f=Buffer.from(JSON.stringify(s,null,2),"utf-8");return{type:"file",content:f,mode:420,size:f.length}},"getFile"),rename:b(async function(t){throw new Error("not implemented")},"rename"),mkdir:b(async function(t){throw new Error("not implemented")},"mkdir")},rj={type:"getThreadName",rootType:"file",getStats:b(async t=>{let{gitRoot:e,nodeFs:r,pathParams:i}=t,n;try{n=await Os.default.resolveRef({fs:r,dir:e,ref:`refs/heads/${i.branchName}`})}catch{throw new Error(`Base Branch ${i.branchName} for operations does not exis`)}let s=await xt(r,e,i.branchName),a=!1;if(s)try{n=await Os.default.resolveRef({fs:r,dir:e,ref:s}),a=!0}catch{try{n=await Os.default.resolveRef({fs:r,dir:e,ref:`refs/heads/${s}`}),a=!0}catch{}}let f=await Os.default.readCommit({fs:r,dir:e,oid:n}),{commit:o}=f,c=o.committer.timestamp*1e3;try{return{mode:420,size:40,atimeMs:c,mtimeMs:c,ctimeMs:c,birthtimeMs:c,atime:new Date(c),mtime:new Date(c),ctime:new Date(c),birthtime:new Date(c),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 t=>{let{gitRoot:e,nodeFs:r,pathParams:i}=t,n=await xt(r,e,i.branchName),s;if(n){let a="legit/",f=`__${i.branchName}-operation`;return n.startsWith(a)&&n.endsWith(f)?s=n.slice(a.length,n.length-f.length):s=n,{type:"file",content:Buffer.from(eR(s)),mode:420,size:s.length}}return{type:"file",content:Buffer.from(""),mode:420,size:0}},"getFile"),writeFile:b(async({filePath:t,gitRoot:e,nodeFs:r,content:i,cacheFs:n,pathParams:s})=>{if(s.branchName===void 0)throw new Error("branchName should be in pathParams");let a=await xt(r,e,s.branchName);if(a){let f=`legit/${QT(i.toString())}__${s.branchName}-operation`;await Os.default.renameBranch({fs:r,dir:e,oldref:a,ref:f}),a=f}},"writeFile"),rename:b(async function({filePath:t,newPath:e,gitRoot:r,nodeFs:i,pathParams:n,newPathParams:s}){throw new Error("not implemented")},"rename"),mkdir:b(async function(t){throw new Error("not implemented")},"mkdir")},IT={type:"gitBranchHistory",rootType:"file",getStats:b(async({gitRoot:t,nodeFs:e,pathParams:r})=>{r.branchName===void 0&&(r.branchName=await he(t,e));let i=await Me(e,t,r.branchName);if(!i)throw new Error(`Branch ${r.branchName} does not exist`);let n=await lw.default.readCommit({fs:e,dir:t,oid:i}),{commit:s}=n,a=s.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(40/4096),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 t=>{let{gitRoot:e,nodeFs:r,pathParams:i}=t,n=i.branchName;n===void 0&&(n=await he(e,r));let s=[];if(n){let f=await Me(r,e,n),o=!1,c=f;for(;c&&!o;){let u=await lw.default.readCommit({fs:r,dir:e,oid:c});s.push({oid:u.oid,...u.commit}),c=u.commit.parent[0]}}let a=Buffer.from(JSON.stringify(s,null,2),"utf-8");return{type:"file",content:a,mode:420,size:a.length}},"getFile"),rename:b(async t=>{throw new Error("not implemented")},"rename"),mkdir:b(async function(t){throw new Error("not implemented")},"mkdir")},$T={type:"gitBranchOperationHeadVirtualFile",rootType:"file",getStats:b(async({gitRoot:t,nodeFs:e,pathParams:r})=>{r.branchName===void 0&&(r.branchName=await he(t,e));let i=await xt(e,t,r.branchName);if(!i){let o=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(40/4096),atimeMs:o.getTime(),mtimeMs:o.getTime(),ctimeMs:o.getTime(),birthtimeMs:o.getTime(),atime:o,mtime:o,ctime:o,birthtime:o}}let n;try{n=await or.default.resolveRef({fs:e,dir:t,ref:i})}catch{n=await or.default.resolveRef({fs:e,dir:t,ref:`refs/heads/${i}`})}let s=await or.default.readCommit({fs:e,dir:t,oid:n}),{commit:a}=s,f=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(40/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:b(async({gitRoot:t,nodeFs:e,pathParams:r})=>{r.branchName===void 0&&(r.branchName=await he(t,e));let i=await xt(e,t,r.branchName);if(!i)return{type:"file",content:"",mode:420,size:0};try{let n;try{n=await or.default.resolveRef({fs:e,dir:t,ref:i})}catch{n=await or.default.resolveRef({fs:e,dir:t,ref:`refs/heads/${i}`})}return{type:"file",content:n+`
103
- `,mode:420,size:n.length}}catch{return}},"getFile"),writeFile:b(async({filePath:t,gitRoot:e,nodeFs:r,content:i,cacheFs:n,pathParams:s})=>{s.branchName===void 0&&(s.branchName=await he(e,r));let a=await xt(r,e,s.branchName),f=await or.default.resolveRef({fs:r,dir:e,ref:`refs/heads/${a}`});if(!a)throw new Error(`Operation branch name could not be resolved for branch ${s.branchName}`);let o=i.toString().trim(),c,u,h=!1;if(!f)throw new Error(`Operation branch ref could not be resolved for branch ${a}`);let d=f;for(;d&&!h;){let p=await or.default.readCommit({fs:r,dir:e,oid:d});if(p.oid===o&&(c=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(c!==void 0){u=p.commit.parent[1];break}}}if(c===void 0)throw new Error(`Cant rollback to ${o} couldn't find newOperationBranchHead ${c}`);if(u===void 0)throw new Error(`Cant rollback to ${o} couldn't find newBranchHead ${u}`);await or.default.writeRef({fs:r,dir:e,ref:"refs/heads/"+a,value:c,force:!0}),await or.default.writeRef({fs:r,dir:e,ref:"refs/heads/"+s.branchName,value:u,force:!0})},"writeFile"),rename(t){throw new Error("not implementsd")},mkdir:b(async function(t){throw new Error("not implemented")},"mkdir")},ij={type:"gitCurrentBranchVirtualFile",rootType:"folder",getStats:b(async({gitRoot:t,nodeFs:e})=>{let r=(await he(t,e)).length;return{mode:420,size:r,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(r/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:b(async({gitRoot:t,nodeFs:e})=>{let r=await he(t,e);return{type:"file",content:r+`
104
- `,mode:420,size:r.length+1}},"getFile"),writeFile:b(async({gitRoot:t,nodeFs:e,content:r})=>{let i=r.toString().trim();if(!await Me(e,t,i))throw new Error(`Branch ${i} does not exist in the repository`);await iR(t,e,i)},"writeFile"),rename(t){throw new Error("not implemented")},mkdir:b(async function(t){throw new Error("not implemented")},"mkdir")},Ut,Wf=(Ut=class extends So{constructor({name:e,parentFs:r,gitStorageFs:i,gitRoot:n,virtualFiles:s=ej}){super({name:e,parentFs:r,gitRoot:n}),U(this,"memFs"),U(this,"openFh",{}),U(this,"virtualFiles"),U(this,"legitFileNames"),U(this,"storageFs"),this.gitRoot=n,this.storageFs=i,this.memFs=(0,Yf.createFsFromVolume)(new Yf.Volume),this.virtualFiles=s,this.legitFileNames=["branches","commits"]}async getAuthor(){let e=await tw.default.getConfig({fs:this.storageFs,dir:this.gitRoot,path:"user.name"}),r=await tw.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}isLegitPath(e){return e.includes(`/${Ut.LEGIT_DIR}/`)||e.includes(`/${Ut.LEGIT_DIR}`)}getRouteHandler(e){let r=e;this.gitRoot&&e.startsWith(this.gitRoot)&&(this.gitRoot==="/"?r=e.slice(this.gitRoot.length):r=e.slice(this.gitRoot.length+1));let i=r.indexOf(`/${Ut.LEGIT_DIR}`);if(i===-1)return Ut.pathRouter.match(r);let n=r.slice(i+1);return Ut.pathRouter.match(r)}async open(e,r,i){let n=this.getRouteHandler(e);if(!n)throw new Error("Not a virtual legit file");if(n?.handler.writeFile===void 0&&(r.includes("w")||r.includes("a")))throw new Error(`Write operations not allowed for ${n?.handler.type}`);if(r.includes("x")&&n?.handler.type!=="gitBranchFileVirtualFile")throw new Error(`Exclusive operations not allowed for ${n?.handler.type}`);let s=await n.handler.getFile({cacheFs:this.memFs,filePath:e,gitRoot:this.gitRoot,nodeFs:this.storageFs,pathParams:n.params,author:await this.getAuthor()}),a=!1;for(let h of Object.values(this.openFh))h.path===e&&(a=!0);if((s||a)&&r.includes("x"))throw Object.assign(new Error(`EEXIST: file already exists, open '${e}'`),{code:"EEXIST",errno:-17,syscall:"open",path:e});if(!s&&!a&&!(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 f=rw.dirname(e);if(await this.memFs.promises.mkdir(f,{recursive:!0}),s===void 0&&!r.includes("x")||s&&s.type==="file")try{let h=await this.memFs.promises.access(e)}catch{await this.memFs.promises.writeFile(e,"")}let o=await this.memFs.promises.open(e,r,i),c=o.fd,u=new Gf({fs:this,compositeFs:this.compositFs,subFsFileDescriptor:c,parentFsFileDescriptors:[]});return this.openFh[c]={path:e,mode:r,fh:o,openSha:s?.oid,readSha:void 0,unflushed:[]},(r.includes("x")||r.includes("w"))&&this.openFh[c].unflushed.push({length:0,start:0}),u}async mkdir(e,r){let i=e.toString(),n=this.getRouteHandler(i),s=r?{options:r}:{};try{await n?.handler.mkdir({cacheFs:this.memFs,filePath:e.toString(),nodeFs:this.storageFs,gitRoot:this.gitRoot,pathParams:n.params,...s,author:await this.getAuthor()});let a=typeof r=="object"?{...r,recursive:!0}:{recursive:!0};await this.memFs.promises.mkdir(e,a);let f=i.split("/"),o="";for(let c=1;c<=f.length;c++){o=f.slice(0,c).join("/");try{if((await this.memFs.promises.stat(o)).isDirectory()){let u=await this.memFs.promises.open(o,"r");this.openFh[u.fd]={path:o,mode:"r",fh:u,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(a=>a.path===i&&a.unflushed.length>0);if(n&&n.unflushed.length>0)return await n.fh.stat(r);let s=this.getRouteHandler(i);if(!s)throw new Error(`ENOENT: no such file or directory, stat '${i}'`);return await s.handler.getStats({cacheFs:this.memFs,filePath:i,gitRoot:this.gitRoot,nodeFs:this.storageFs,pathParams:s.params,author:await this.getAuthor()})}async lstat(e,r){return this.stat(e,r)}async readdir(e,r){let i=e.toString(),n=this.getRouteHandler(i);if(!n)throw new Error(`ENOENT: no such file or directory, scandir '${i}'`);let s=await n?.handler.getFile({cacheFs:this.memFs,filePath:i,gitRoot:this.gitRoot,nodeFs:this.storageFs,pathParams:n.params,author:await this.getAuthor()});if(s){if(s.type!=="directory")throw new Error("not a folder");let a=n?.staticSiblings??[],f=Array.from(new Set([...s.content,...a.map(o=>Ui({name:o.segment,parent:i,isDir:o.type==="folder"}))])).sort((o,c)=>o.name.localeCompare(c.name,void 0,{numeric:!0,sensitivity:"base"}));return r?.withFileTypes?f:f.map(o=>o.name)}return[]}async read(e,r,i,n,s){let a=e.subFsFileDescriptor,f=this.openFh[a];if(!f)throw new Error("Invalid file handle");if(f.unflushed.length===0){let o=this.getRouteHandler(f.path),c=await o.handler.getFile({cacheFs:this.memFs,filePath:f.path,gitRoot:this.gitRoot,nodeFs:this.storageFs,pathParams:o?.params,author:await this.getAuthor()});if(!c?.content)throw new Error("couldnt access content");if(c.type!=="file")throw new Error("not a file");let u=typeof c.content=="string"?Buffer.from(c.content):c.content,h=typeof s=="number"?s:0,d=Math.min(h+n,u.length),p=Math.max(0,d-h);return u.copy(r,i,h,h+p),{bytesRead:p,buffer:r}}return await f.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 f=a.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(a.unflushed.length===0){let h=this.getRouteHandler(a.path),d=await h.handler.getFile({cacheFs:this.memFs,filePath:a.path,gitRoot:this.gitRoot,nodeFs:this.storageFs,pathParams:h.params,author:await this.getAuthor()});d&&d.oid&&(await this.memFs.promises.writeFile(a.path,d.content),a.readSha=d.oid)}let o=await a.fh.write(r,i,n,s),c=i??0,u=s??0;return a.unflushed.push({start:u,length:n||r.byteLength-c+u}),o}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=this.getRouteHandler(i.path);if(n&&n.handler.writeFile){let s=await this.memFs.promises.readFile(i.path);await n.handler.writeFile({cacheFs:this.memFs,filePath:i.path,gitRoot:this.gitRoot,nodeFs:this.storageFs,content:s,pathParams:n.params,author:await this.getAuthor()})}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,f=Buffer.alloc(a);return await this.read(s,f,0,a,0),await this.close(s),n?f.toString(n):f}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 f=await this.open(e,n,a);try{let o;typeof r=="string"?o=Buffer.from(r,s):Buffer.isBuffer(r)?o=r:r instanceof Uint8Array?o=Buffer.from(r):ArrayBuffer.isView(r)?o=Buffer.from(r.buffer,r.byteOffset,r.byteLength):o=Buffer.from(r),await this.write(f,o,0,o.length,0)}finally{await this.close(f)}}async rename(e,r){let i=e.toString(),n=r.toString(),s=this.getRouteHandler(i),a=this.getRouteHandler(n);if(s?.handler.type==="gitBranchFileVirtualFile"&&a?.handler.type==="gitBranchFileVirtualFile"){let f=!0;try{await this.memFs.promises.access(n)}catch{f=!1}let o=!0;try{await this.stat(n)}catch{o=!1}let c=!0;try{await this.stat(i)}catch{c=!1}let u=!0;try{await this.memFs.promises.access(i)}catch{u=!1}if(u){let p=rw.dirname(n);try{await this.memFs.promises.access(p)}catch{await this.memFs.promises.mkdir(p,{recursive:!0})}await this.memFs.promises.rename(e,r)}let h=this.getRouteHandler(i);if(!h)throw new Error("VF not found");let d=await h.handler.rename({cacheFs:this.memFs,filePath:i,gitRoot:this.gitRoot,nodeFs:this.storageFs,newPath:n,pathParams:h?.params??{},newPathParams:a?.params??{},author:await this.getAuthor()})}else throw new Error(`Unsupported rename operation from ${s?.handler.type} to ${a?.handler.type}`)}async fchmod(e,r){}async unlink(e){let r=e.toString(),i=this.getRouteHandler(r);if(i?.handler.unlink!==void 0)try{await i.handler.unlink({cacheFs:this.memFs,filePath:r,nodeFs:this.storageFs,gitRoot:this.gitRoot,pathParams:i.params,author:await this.getAuthor()})}catch(n){let s=!1;for(let[a,f]of Object.entries(this.openFh))f.path===r&&f.unflushed.length>0&&(s=!0);if(!s)throw n}finally{let n=!1;for(let[s,a]of Object.entries(this.openFh))a.path===r&&(n=!0,await a.fh.close(),delete this.openFh[Number(s)]);n&&await this.memFs.promises.unlink(r)}else throw new Error(`Cannot unlink ${i?.handler.type} files`)}async rmdir(e,...r){let i=e.toString(),n=this.getRouteHandler(i);if(n?.handler.rmdir!==void 0){await n.handler.rmdir({cacheFs:this.memFs,filePath:i,nodeFs:this.storageFs,gitRoot:this.gitRoot,pathParams:n.params,author:await this.getAuthor()});let s=!1;for(let[a,f]of Object.entries(this.openFh))f.path===i&&(s=!0,await f.fh.close(),delete this.openFh[Number(a)]);s&&await this.memFs.promises.rmdir(i,{recursive:!0})}else throw new Error(`Cannot rmdir
105
- ${n?.handler.type} directories`)}fileType(){return 10}},l(Ut,"V"),Ut);b(Wf,"GitSubFs"),U(Wf,"LEGIT_DIR",".legit"),U(Wf,"pathRouter",new tj({".legit":{".":ow,operation:CT,head:aw,operationHead:$T,operationHistory:cw,history:IT,currentBranch:ij,branches:{".":tR,"[branchName]":{".legit":{".":ow,operation:CT,head:aw,operationHead:$T,operationHistory:cw,history:IT,threadName:rj},"[[...filePath]]":Vf}},commits:{".":DT,"[sha_1_1_2]":{".":DT,"[sha1_3__40]":{"[[...filePath]]":nR}}}},"[[...filePath]]":Vf}));var nj=Wf,ri="legit",sj=b(({fs:t,gitRepoPath:e,serverUrl:r="https://hub.legitcontrol.com",auth:i,anonymousBranch:n,authHeaderPrefix:s="Bearer "})=>{let a=!1;async function f(y){let g=await i.getMaxAccessTokenForBranch(y);if(!g)throw new Error(`No access token for branch ${y}`);await Ze.default.fetch({fs:t,http:Mf,dir:e,singleBranch:!0,ref:`${y}`,remote:ri,url:r,headers:{Authorization:`${s}${g}`}});let _=await Ze.default.resolveRef({fs:t,dir:e,ref:`${ri}/${y}`});await Ze.default.writeRef({fs:t,dir:e,ref:`refs/heads/${y}`,value:_})}l(f,"l"),b(f,"loadBranch");let o=[];async function c(){let y=await i.getMaxAccessTokenForBranch("todo");await Ze.default.fetch({fs:t,http:Mf,dir:e,remote:ri,url:r,headers:{Authorization:`${s}${y}`}});let g=await Ze.default.listBranches({fs:t,dir:e});for(let _ of g){if(_===n)continue;let F=`${ri}/${_}`,R,k;try{R=await Ze.default.resolveRef({fs:t,dir:e,ref:_})}catch(D){console.log(`Could not resolve local ref ${_}:`,D)}try{k=await Ze.default.resolveRef({fs:t,dir:e,ref:F})}catch{k=void 0}if(R&&k){if(R!==k){let D=await Ze.default.findMergeBase({fs:t,dir:e,oids:[R,k]});if(D[0]!==R&&D[0]!==k){let v=await Ze.default.merge({fs:t,dir:e,ours:R,theirs:k,fastForwardOnly:!1,abortOnConflict:!1,author:{name:"Your Name",email:"your.email@example.com"},mergeDriver:b(async({branches:O,contents:E,path:N})=>{let[x,I,q]=E;return console.log(`Merging ${O[0]} with ${O[1]}...`),console.log("merged:"),console.log(E),{cleanMerge:!0,mergedText:q===void 0?I:q}},"mergeDriver")});await Ze.default.writeRef({fs:t,dir:e,ref:`refs/heads/${_}`,value:v.oid,force:!0})}D[0]===R?(console.log(`branch ${_} differs - remote ahaed, not behind`),await Ze.default.writeRef({fs:t,dir:e,ref:`refs/heads/${_}`,value:k,force:!0})):D[0]===k?(console.log(`branch ${_} differs - local ahead, not behind`),o.push(_)):(console.log(`branch ${_} differs - both changed`),o.push(_))}}else R&&!k&&o.push(_)}}l(c,"m"),b(c,"pull");async function u(y){if((await i.getUser()).type!=="local")for(let g of y){let _=await i.getMaxAccessTokenForBranch(g);await Ze.default.push({fs:t,http:Mf,dir:e,remote:ri,url:r,ref:g,headers:{Authorization:`Bearer ${_}`}})}}l(u,"c"),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 Ze.default.getConfig({fs:t,dir:e,path:`remote.${ri}.fetch`})||await Ze.default.setConfig({fs:t,dir:e,path:`remote.${ri}.fetch`,value:`+refs/heads/*:refs/remotes/${ri}/*`});try{await c();let y=[...new Set(o)].filter(g=>g.indexOf(n)===-1);await d(y),o=[]}catch(y){console.error("Error monitoring changes:",y)}finally{a&&setTimeout(p,1e3)}}l(p,"h"),b(p,"pullPushTick");function m(){a=!0,p()}l(m,"g"),b(m,"startSync");function w(){a=!1}return l(w,"T"),b(w,"stopSync"),{start:b(()=>{a||(m(),a=!0)},"start"),stop:b(()=>{w()},"stop"),isRunning:b(()=>a,"isRunning"),loadBranch:f,sequentialPush:d}},"createLegitSyncService"),aj=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 lR(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(lR,"Ze");b(lR,"encodeConfigJson");function fR(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(fR,"et");b(fR,"decodeConfigJson");var BT="user.legit-tokens";function uR({storageFs:t,gitRoot:e}){return{getUserTokens:b(async r=>{let i=await fw.default.getConfig({fs:t,dir:e,path:BT});return i?fR(i):{accessTokens:[]}},"getUserTokens"),setUserTokens:b(async(r,i)=>await fw.default.setConfig({fs:t,dir:e,path:BT,value:lR(i)}),"setUserTokens")}}l(uR,"rt");b(uR,"createGitConfigTokenStore");async function oj(t){let e=new Zf.Volume,r=(0,Zf.createFsFromVolume)(e);return Qf({...t,storageFs:t?.storageFs?t.storageFs:r,gitRoot:t?.gitRoot||"/"})}l(oj,"$s");b(oj,"openLegitFsWithMemoryFs");async function Qf({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://sync.legitcontrol.com",publicKey:a}){await t.promises.readdir(e+"/.git").then(()=>!0).catch(()=>!1)||(await He.default.init({fs:t,dir:"/",defaultBranch:r}),await t.promises.writeFile(e+"/.keep",""),await He.default.add({fs:t,dir:"/",filepath:".keep"}),await He.default.commit({fs:t,dir:"/",message:"Initial commit",author:{name:"Test",email:"test@example.com"}}),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=new AT({name:"root",parentFs:void 0,storageFs:t,gitRoot:e}),o=new NT({name:"root-ephemeral",parentFs:f,gitRoot:e,ephemeralPatterns:[]}),c=new PT({name:"root-hidden",parentFs:f,gitRoot:e,hiddenFiles:[]});f.setHiddenFilesSubFs(c),f.setEphemeralFilesSubFs(o);let u=new AT({name:"git",parentFs:f,storageFs:void 0,gitRoot:e,defaultBranch:r}),h=new nj({name:"git-subfs",parentFs:u,gitRoot:e,gitStorageFs:f}),d=i?[".git"]:[".git",".keep"],p=new PT({name:"git-hidden-subfs",parentFs:u,gitRoot:e,hiddenFiles:d}),m=new NT({name:"git-ephemeral-subfs",parentFs:u,gitRoot:e,ephemeralPatterns:["**/._*","**/.DS_Store","**/.AppleDouble/","**/.AppleDB","**/.AppleDesktop","**/.Spotlight-V100","**/.TemporaryItems","**/.Trashes","**/.fseventsd","**/.VolumeIcon.icns","**/.ql_disablethumbnails","**/.~lock.*","**/lu[0-9a-zA-Z]*.tmp","**/.metaentries.json.tmp","**/**.sb-**"]});u.addSubFs(h),u.setHiddenFilesSubFs(p),u.setEphemeralFilesSubFs(m);let w=uR({storageFs:t,gitRoot:e}),y=aj(w,a),g=sj({fs:t,gitRepoPath:e,serverUrl:s,auth:y,anonymousBranch:r}),_=Object.assign(u,{auth:y,sync:g,setLogger(F){f.setLoggger(F),u.setLoggger(F)},push:b(async F=>{},"push"),shareCurrentBranch:b(async()=>{if((await y.getUser()).type==="local")throw new Error("login first - for example anonymously using legitfs.auth.signInAnonymously()");let F=await _.getCurrentBranch();return F===r&&(F=(await y.getUser()).id,await He.default.renameBranch({fs:t,dir:e,oldref:r,ref:F})),await g.sequentialPush([F]),_.setCurrentBranch(F),F},"shareCurrentBranch"),setCurrentBranch:b(async F=>{(await He.default.listBranches({fs:t,dir:e})).includes(F)||await g?.loadBranch(F);let R=(await He.default.listBranches({fs:t,dir:e})).includes(F);if(console.log("branchExistsAfter",R),!R)throw new Error(`Branch ${F} does not exist`);await He.default.setConfig({fs:t,dir:e,path:"init.defaultBranch",value:F})},"setCurrentBranch"),getCurrentBranch:b(async()=>{let F=await He.default.getConfig({fs:t,dir:e,path:"init.defaultBranch"});if(!F)throw new Error("No current branch set");return F},"getCurrentBranch")});return _}l(Qf,"kt");b(Qf,"openLegitFs");var Gz=b(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("/"),f=r+".legit/branches/"+n+"/.legit/operation",o=JSON.stringify(e.operationArgs,(c,u)=>Buffer.isBuffer(u)?{__buffer__:u.toString("base64")}:u);await t.writeFile(f,`[${e.fsName}].${e.operation}(${e.fd?e.fd.fd+" - ":""}${e.path})
103
+ `,"utf8");let a=f[f.length-1].split(" ")[1];await n.writeStashRef(a)}else await t.rm(c)})}l(Rk,"_stashDrop");async function rq({fs:t,dir:e,gitdir:r}){return new en({fs:t,dir:e,gitdir:r}).readStashReflogs({parsed:!0})}l(rq,"_stashList");async function iq({fs:t,dir:e,gitdir:r}){let i=new en({fs:t,dir:e,gitdir:r}),n=[i.refStashPath,i.refLogsStashPath];await eo(n,async()=>{await Promise.all(n.map(async s=>{if(await t.exists(s))return t.rm(s)}))})}l(iq,"_stashClear");async function nq({fs:t,dir:e,gitdir:r,refIdx:i=0}){await kk({fs:t,dir:e,gitdir:r,refIdx:i}),await Rk({fs:t,dir:e,gitdir:r,refIdx:i})}l(nq,"_stashPop");async function Ok({fs:t,dir:e,gitdir:r=C(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:eq,apply:kk,drop:Rk,list:rq,clear:iq,pop:nq,create:tq},f=["apply","drop","pop"];try{let c=new L(t);["refs","logs","logs/refs"].map(h=>C(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 Zt(`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(Ok,"stash");async function xk({fs:t,dir:e,gitdir:r=C(e,".git"),filepath:i,cache:n={}}){try{k("fs",t),k("gitdir",r),k("filepath",i);let s=new L(t);if(await hi.isIgnored({fs:s,gitdir:r,dir:e,filepath:i}))return"ignored";let f=await sq({fs:s,cache:n,gitdir:r}),c=await Ak({fs:s,cache:n,gitdir:r,tree:f,path:i}),a=await Ee.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(C(e,i)),h=c!==null,d=a!==null,p=u!==null,m=l(async()=>{if(d&&!Pf(a,u))return a.oid;{let w=await s.read(C(e,i)),y=await _k({gitdir:r,type:"blob",object:w});return d&&a.oid===y&&u.size!==-1&&Ee.acquire({fs:s,gitdir:r,cache:n},async function(b){b.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(xk,"status");async function Ak({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 he({fs:t,cache:e,gitdir:r,oid:o.oid});if(f==="tree"){let a=pt.from(c);return Ak({fs:t,cache:e,gitdir:r,tree:a,path:n})}if(f==="blob")throw new ot(o.oid,f,"blob",n.join("/"))}return null}l(Ak,"getOidAtPath");async function sq({fs:t,cache:e,gitdir:r}){let i;try{i=await $.resolve({fs:t,gitdir:r,ref:"HEAD"})}catch(s){if(s instanceof le)return[]}let{tree:n}=await ro({fs:t,cache:e,gitdir:r,oid:i});return n}l(sq,"getHeadTree");async function Pk({fs:t,dir:e,gitdir:r=C(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 ui({fs:c,cache:o,dir:e,gitdir:r,trees:[Et({ref:i}),to(),tn()],map:l(async function(a,[u,h,d]){if(!u&&!d&&h&&!f&&await hi.isIgnored({fs:c,dir:e,filepath:a})||!n.some(D=>y1(a,D)))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 b=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,b,F,_],R=E.map(D=>E.indexOf(D));return R.shift(),[a,...R]},"map")})}catch(c){throw c.caller="git.statusMatrix",c}}l(Pk,"statusMatrix");async function Nk({fs:t,dir:e,gitdir:r=C(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 dt("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 Yt("tag",i);await $.writeRef({fs:o,gitdir:r,ref:i,value:f})}catch(o){throw o.caller="git.tag",o}}l(Nk,"tag");async function Dk({fs:t,dir:e,gitdir:r=C(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 Ee.acquire({fs:u,gitdir:r,cache:i},async function(d){if(!a){let p=await u.lstat(C(e,n));if(p){if(p.isDirectory())throw new fi("directory");return}}d.has({filepath:n})&&d.delete({filepath:n})});let h;if(!s){if(h=await u.lstat(C(e,n)),!h)throw new le(`file at "${n}" on disk and "remove" not set`);if(h.isDirectory())throw new fi("directory")}return await Ee.acquire({fs:u,gitdir:r,cache:i},async function(d){if(!f&&!d.has({filepath:n}))throw new le(`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(C(e,n)):await u.read(C(e,n));s=await wt({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(Dk,"updateIndex$1");function Ck(){try{return xu.version}catch(t){throw t.caller="git.version",t}}l(Ck,"version");async function Ik({fs:t,dir:e,gitdir:r=C(e,".git"),trees:i,map:n,reduce:s,iterate:o,cache:f={}}){try{return k("fs",t),k("gitdir",r),k("trees",i),await ui({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(Ik,"walk");async function $k({fs:t,dir:e,gitdir:r=C(e,".git"),blob:i}){try{return k("fs",t),k("gitdir",r),k("blob",i),await wt({fs:new L(t),gitdir:r,type:"blob",object:i,format:"content"})}catch(n){throw n.caller="git.writeBlob",n}}l($k,"writeBlob");async function Bk({fs:t,dir:e,gitdir:r=C(e,".git"),commit:i}){try{return k("fs",t),k("gitdir",r),k("commit",i),await Fk({fs:new L(t),gitdir:r,commit:i})}catch(n){throw n.caller="git.writeCommit",n}}l(Bk,"writeCommit");async function Mk({fs:t,dir:e,gitdir:r=C(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=mt.from(n).toObject();break;case"tree":n=pt.from(n).toObject();break;case"blob":n=Buffer.from(n,f);break;case"tag":n=Ft.from(n).toObject();break;default:throw new ot(o||"",i,"blob|commit|tag|tree")}s="content"}return o=await wt({fs:c,gitdir:r,type:i,object:n,oid:o,format:s}),o}catch(c){throw c.caller="git.writeObject",c}}l(Mk,"writeObject");async function Lk({fs:t,dir:e,gitdir:r=C(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(!ic(i,!0))throw new Zt(i,La.clean(i));if(!s&&await $.exists({fs:f,gitdir:r,ref:i}))throw new Yt("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(Lk,"writeRef");async function oq({fs:t,gitdir:e,tag:r}){let i=Ft.from(r).toObject();return await wt({fs:t,gitdir:e,type:"tag",object:i,format:"content"})}l(oq,"_writeTag");async function jk({fs:t,dir:e,gitdir:r=C(e,".git"),tag:i}){try{return k("fs",t),k("gitdir",r),k("tag",i),await oq({fs:new L(t),gitdir:r,tag:i})}catch(n){throw n.caller="git.writeTag",n}}l(jk,"writeTag");async function qk({fs:t,dir:e,gitdir:r=C(e,".git"),tree:i}){try{return k("fs",t),k("gitdir",r),k("tree",i),await sc({fs:new L(t),gitdir:r,tree:i})}catch(n){throw n.caller="git.writeTree",n}}l(qk,"writeTree");var aq={Errors:r1,STAGE:tn,TREE:Et,WORKDIR:to,add:a1,abortMerge:n1,addNote:h1,addRemote:p1,annotatedTag:m1,branch:w1,checkout:Iw,clone:v1,commit:E1,getConfig:M1,getConfigAll:L1,setConfig:Ek,currentBranch:F1,deleteBranch:T1,deleteRef:k1,deleteRemote:R1,deleteTag:O1,expandOid:x1,expandRef:A1,fastForward:D1,fetch:C1,findMergeBase:I1,findRoot:B1,getRemoteInfo:j1,getRemoteInfo2:U1,hashBlob:W1,indexPack:z1,init:H1,isDescendent:G1,isIgnored:J1,listBranches:K1,listFiles:Y1,listNotes:Z1,listRefs:Q1,listRemotes:ek,listServerRefs:tk,listTags:rk,log:nk,merge:sk,packObjects:ak,pull:ck,push:lk,readBlob:hk,readCommit:Mw,readNote:dk,readObject:pk,readTag:mk,readTree:wk,remove:yk,removeNote:gk,renameBranch:bk,resetIndex:Sk,updateIndex:Dk,resolveRef:vk,status:xk,statusMatrix:Pk,tag:Nk,version:Ck,walk:Ik,writeBlob:$k,writeCommit:Bk,writeObject:Mk,writeRef:Lk,writeTag:jk,writeTree:qk,stash:Ok};B.Errors=r1;B.STAGE=tn;B.TREE=Et;B.WORKDIR=to;B.abortMerge=n1;B.add=a1;B.addNote=h1;B.addRemote=p1;B.annotatedTag=m1;B.branch=w1;B.checkout=Iw;B.clone=v1;B.commit=E1;B.currentBranch=F1;B.default=aq;B.deleteBranch=T1;B.deleteRef=k1;B.deleteRemote=R1;B.deleteTag=O1;B.expandOid=x1;B.expandRef=A1;B.fastForward=D1;B.fetch=C1;B.findMergeBase=I1;B.findRoot=B1;B.getConfig=M1;B.getConfigAll=L1;B.getRemoteInfo=j1;B.getRemoteInfo2=U1;B.hashBlob=W1;B.indexPack=z1;B.init=H1;B.isDescendent=G1;B.isIgnored=J1;B.listBranches=K1;B.listFiles=Y1;B.listNotes=Z1;B.listRefs=Q1;B.listRemotes=ek;B.listServerRefs=tk;B.listTags=rk;B.log=nk;B.merge=sk;B.packObjects=ak;B.pull=ck;B.push=lk;B.readBlob=hk;B.readCommit=Mw;B.readNote=dk;B.readObject=pk;B.readTag=mk;B.readTree=wk;B.remove=yk;B.removeNote=gk;B.renameBranch=bk;B.resetIndex=Sk;B.resolveRef=vk;B.setConfig=Ek;B.stash=Ok;B.status=xk;B.statusMatrix=Pk;B.tag=Nk;B.updateIndex=Dk;B.version=Ck;B.walk=Ik;B.writeBlob=$k;B.writeCommit=Bk;B.writeObject=Mk;B.writeRef=Lk;B.writeTag=jk;B.writeTree=qk});var Wk=T((KK,Uk)=>{Uk.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 Hk=T((XK,zk)=>{"use strict";var cq=["aborted","complete","headers","httpVersion","httpVersionMinor","httpVersionMajor","method","rawHeaders","rawTrailers","setTimeout","socket","statusCode","statusMessage","trailers","url"];zk.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(cq)),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 Gk=T((YK,Vk)=>{"use strict";var{Transform:lq,PassThrough:fq}=ie("stream"),ry=ie("zlib"),uq=Hk();Vk.exports=t=>{let e=(t.headers["content-encoding"]||"").toLowerCase();if(!["gzip","deflate","br"].includes(e))return t;let r=e==="br";if(r&&typeof ry.createBrotliDecompress!="function")return t.destroy(new Error("Brotli is not supported on Node.js < 12")),t;let i=!0,n=new lq({transform(f,c,a){i=!1,a(null,f)},flush(f){f()}}),s=new fq({autoDestroy:!1,destroy(f,c){t.destroy(),c(f)}}),o=r?ry.createBrotliDecompress():ry.createUnzip();return o.once("error",f=>{if(i&&!t.readable){s.end();return}s.destroy(f)}),uq(t,s),t.pipe(n).pipe(o).pipe(s),s}});var Xk=T((ZK,Kk)=>{Kk.exports=Jk;function Jk(t,e){if(t&&e)return Jk(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(Jk,"wrappy")});var Qk=T((eX,iy)=>{var Yk=Xk();iy.exports=Yk(Au);iy.exports.strict=Yk(Zk);Au.proto=Au(function(){Object.defineProperty(Function.prototype,"once",{value:l(function(){return Au(this)},"value"),configurable:!0}),Object.defineProperty(Function.prototype,"onceStrict",{value:l(function(){return Zk(this)},"value"),configurable:!0})});function Au(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(Au,"once");function Zk(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(Zk,"onceStrict")});var iR=T((rX,rR)=>{rR.exports=io;var hq=Wk(),eR=Gk(),dq=ie("http"),pq=ie("https"),mq=Qk(),wq=ie("querystring"),tR=ie("url"),ny=l(t=>t!==null&&typeof t=="object"&&typeof t.pipe=="function","isStream");function io(t,e){if(t=Object.assign({maxRedirects:10},typeof t=="string"?{url:t}:t),e=mq(e),t.url){let{hostname:f,port:c,protocol:a,auth:u,path:h}=tR.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&&!ny(t.body)?JSON.stringify(t.body):t.body:t.form&&(i=typeof t.form=="string"?t.form:wq.stringify(t.form),t.headers["content-type"]="application/x-www-form-urlencoded"),i&&(t.method||(t.method="POST"),ny(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:"?pq:dq).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=tR.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")):io(t,e)}let c=typeof eR=="function"&&t.method!=="HEAD";e(null,c?eR(f):f)});return o.on("timeout",()=>{o.abort(),e(new Error("Request timed out"))}),o.on("error",e),ny(i)?i.on("error",e).pipe(o):o.end(i),o}l(io,"simpleGet");io.concat=(t,e)=>io(t,(r,i)=>{if(r)return e(r);hq(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=>{io[t]=(e,r)=>(typeof e=="string"&&(e={url:e}),io(Object.assign({method:t.toUpperCase()},e),r))})});var ye=T((nX,nR)=>{"use strict";var oy=class oy 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(oy,"AggregateError");var sy=oy;nR.exports={AggregateError:sy,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 ay=T((oX,sR)=>{"use strict";sR.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 Ze=T((aX,cR)=>{"use strict";var{format:yq,inspect:Pu}=ay(),{AggregateError:gq}=ye(),bq=globalThis.AggregateError||gq,_q=Symbol("kIsNodeError"),Sq=["string","function","number","object","Function","Object","boolean","bigint","symbol"],vq=/^([A-Z][a-z0-9]*)+$/,Eq="__node_internal_",Nu={};function rn(t,e){if(!t)throw new Nu.ERR_INTERNAL_ASSERTION(e)}l(rn,"assert");function oR(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(oR,"addNumericalSeparator");function Fq(t,e,r){if(typeof e=="function")return rn(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 rn(i===r.length,`Code: ${t}; The provided arguments length (${r.length}) does not match the required ones (${i}).`),r.length===0?e:yq(e,...r)}l(Fq,"getMessage");function He(t,e,r){r||(r=Error);let n=class n extends r{constructor(...o){super(Fq(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[_q]=!0,Nu[t]=i}l(He,"E");function aR(t){let e=Eq+t.name;return Object.defineProperty(t,"name",{value:e}),t}l(aR,"hideStackFrames");function Tq(t,e){if(t&&e&&t!==e){if(Array.isArray(e.errors))return e.errors.push(t),e;let r=new bq([e,t],e.message);return r.code=e.code,r}return t||e}l(Tq,"aggregateTwoErrors");var ly=class ly extends Error{constructor(e="The operation was aborted",r=void 0){if(r!==void 0&&typeof r!="object")throw new Nu.ERR_INVALID_ARG_TYPE("options","Object",r);super(e,r),this.code="ABORT_ERR",this.name="AbortError"}};l(ly,"AbortError");var cy=ly;He("ERR_ASSERTION","%s",Error);He("ERR_INVALID_ARG_TYPE",(t,e,r)=>{rn(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)rn(typeof c=="string","All expected entries have to be of type string"),Sq.includes(c)?n.push(c.toLowerCase()):vq.test(c)?s.push(c):(rn(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=Pu(r,{depth:-1});i+=`. Received ${c}`}}else{let c=Pu(r,{colors:!1});c.length>25&&(c=`${c.slice(0,25)}...`),i+=`. Received type ${typeof r} (${c})`}return i},TypeError);He("ERR_INVALID_ARG_VALUE",(t,e,r="is invalid")=>{let i=Pu(e);return i.length>128&&(i=i.slice(0,128)+"..."),`The ${t.includes(".")?"property":"argument"} '${t}' ${r}. Received ${i}`},TypeError);He("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);He("ERR_MISSING_ARGS",(...t)=>{rn(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);He("ERR_OUT_OF_RANGE",(t,e,r)=>{rn(e,'Missing "range" argument');let i;if(Number.isInteger(r)&&Math.abs(r)>2**32)i=oR(String(r));else if(typeof r=="bigint"){i=String(r);let n=BigInt(2)**BigInt(32);(r>n||r<-n)&&(i=oR(i)),i+="n"}else i=Pu(r);return`The value of "${t}" is out of range. It must be ${e}. Received ${i}`},RangeError);He("ERR_MULTIPLE_CALLBACK","Callback called multiple times",Error);He("ERR_METHOD_NOT_IMPLEMENTED","The %s method is not implemented",Error);He("ERR_STREAM_ALREADY_FINISHED","Cannot call %s after a stream was finished",Error);He("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable",Error);He("ERR_STREAM_DESTROYED","Cannot call %s after a stream was destroyed",Error);He("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);He("ERR_STREAM_PREMATURE_CLOSE","Premature close",Error);He("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF",Error);He("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event",Error);He("ERR_STREAM_WRITE_AFTER_END","write after end",Error);He("ERR_UNKNOWN_ENCODING","Unknown encoding: %s",TypeError);cR.exports={AbortError:cy,aggregateTwoErrors:aR(Tq),hideStackFrames:aR,codes:Nu}});var gR=T((lc,cc)=>{"use strict";Object.defineProperty(lc,"__esModule",{value:!0});var pR=new WeakMap,fy=new WeakMap;function de(t){let e=pR.get(t);return console.assert(e!=null,"'this' is expected an Event object, but got",t),e}l(de,"pd");function lR(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(lR,"setCancelFlag");function no(t,e){pR.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,mR(n))}}l(no,"Event");no.prototype={get type(){return de(this).event.type},get target(){return de(this).eventTarget},get currentTarget(){return de(this).currentTarget},composedPath(){let t=de(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 de(this).eventPhase},stopPropagation(){let t=de(this);t.stopped=!0,typeof t.event.stopPropagation=="function"&&t.event.stopPropagation()},stopImmediatePropagation(){let t=de(this);t.stopped=!0,t.immediateStopped=!0,typeof t.event.stopImmediatePropagation=="function"&&t.event.stopImmediatePropagation()},get bubbles(){return!!de(this).event.bubbles},get cancelable(){return!!de(this).event.cancelable},preventDefault(){lR(de(this))},get defaultPrevented(){return de(this).canceled},get composed(){return!!de(this).event.composed},get timeStamp(){return de(this).timeStamp},get srcElement(){return de(this).eventTarget},get cancelBubble(){return de(this).stopped},set cancelBubble(t){if(!t)return;let e=de(this);e.stopped=!0,typeof e.event.cancelBubble=="boolean"&&(e.event.cancelBubble=!0)},get returnValue(){return!de(this).canceled},set returnValue(t){t||lR(de(this))},initEvent(){}};Object.defineProperty(no.prototype,"constructor",{value:no,configurable:!0,writable:!0});typeof window<"u"&&typeof window.Event<"u"&&(Object.setPrototypeOf(no.prototype,window.Event.prototype),fy.set(window.Event.prototype,no));function mR(t){return{get(){return de(this).event[t]},set(e){de(this).event[t]=e},configurable:!0,enumerable:!0}}l(mR,"defineRedirectDescriptor");function kq(t){return{value(){let e=de(this).event;return e[t].apply(e,arguments)},configurable:!0,enumerable:!0}}l(kq,"defineCallDescriptor");function Rq(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?kq(s):mR(s))}}return i}l(Rq,"defineWrapper");function wR(t){if(t==null||t===Object.prototype)return no;let e=fy.get(t);return e==null&&(e=Rq(wR(Object.getPrototypeOf(t)),t),fy.set(t,e)),e}l(wR,"getWrapper");function Oq(t,e){let r=wR(Object.getPrototypeOf(e));return new r(t,e)}l(Oq,"wrapEvent");function xq(t){return de(t).immediateStopped}l(xq,"isStopped");function Aq(t,e){de(t).eventPhase=e}l(Aq,"setEventPhase");function Pq(t,e){de(t).currentTarget=e}l(Pq,"setCurrentTarget");function fR(t,e){de(t).passiveListener=e}l(fR,"setPassiveListener");var yR=new WeakMap,uR=1,hR=2,Du=3;function Cu(t){return t!==null&&typeof t=="object"}l(Cu,"isObject");function ac(t){let e=yR.get(t);if(e==null)throw new TypeError("'this' is expected an EventTarget object, but got another value.");return e}l(ac,"getListeners");function Nq(t){return{get(){let r=ac(this).get(t);for(;r!=null;){if(r.listenerType===Du)return r.listener;r=r.next}return null},set(e){typeof e!="function"&&!Cu(e)&&(e=null);let r=ac(this),i=null,n=r.get(t);for(;n!=null;)n.listenerType===Du?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:Du,passive:!1,once:!1,next:null};i===null?r.set(t,s):i.next=s}},configurable:!0,enumerable:!0}}l(Nq,"defineEventAttributeDescriptor");function uy(t,e){Object.defineProperty(t,`on${e}`,Nq(e))}l(uy,"defineEventAttribute");function dR(t){function e(){Qt.call(this)}l(e,"CustomEventTarget"),e.prototype=Object.create(Qt.prototype,{constructor:{value:e,configurable:!0,writable:!0}});for(let r=0;r<t.length;++r)uy(e.prototype,t[r]);return e}l(dR,"defineCustomEventTarget");function Qt(){if(this instanceof Qt){yR.set(this,new Map);return}if(arguments.length===1&&Array.isArray(arguments[0]))return dR(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 dR(t)}throw new TypeError("Cannot call a class as a function")}l(Qt,"EventTarget");Qt.prototype={addEventListener(t,e,r){if(e==null)return;if(typeof e!="function"&&!Cu(e))throw new TypeError("'listener' should be a function or an object.");let i=ac(this),n=Cu(r),o=(n?!!r.capture:!!r)?uR:hR,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=ac(this),s=(Cu(r)?!!r.capture:!!r)?uR:hR,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=ac(this),r=t.type,i=e.get(r);if(i==null)return!0;let n=Oq(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,fR(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!==Du&&typeof i.listener.handleEvent=="function"&&i.listener.handleEvent(n);if(xq(n))break;i=i.next}return fR(n,null),Aq(n,0),Pq(n,null),!n.defaultPrevented}};Object.defineProperty(Qt.prototype,"constructor",{value:Qt,configurable:!0,writable:!0});typeof window<"u"&&typeof window.EventTarget<"u"&&Object.setPrototypeOf(Qt.prototype,window.EventTarget.prototype);lc.defineEventAttribute=uy;lc.EventTarget=Qt;lc.default=Qt;cc.exports=Qt;cc.exports.EventTarget=cc.exports.default=Qt;cc.exports.defineEventAttribute=uy});var so=T((uc,fc)=>{"use strict";Object.defineProperty(uc,"__esModule",{value:!0});var hy=gR(),dy=class dy extends hy.EventTarget{constructor(){throw super(),new TypeError("AbortSignal cannot be constructed directly")}get aborted(){let e=Iu.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(dy,"AbortSignal");var wi=dy;hy.defineEventAttribute(wi.prototype,"abort");function Dq(){let t=Object.create(wi.prototype);return hy.EventTarget.call(t),Iu.set(t,!1),t}l(Dq,"createAbortSignal");function Cq(t){Iu.get(t)===!1&&(Iu.set(t,!0),t.dispatchEvent({type:"abort"}))}l(Cq,"abortSignal");var Iu=new WeakMap;Object.defineProperties(wi.prototype,{aborted:{enumerable:!0}});typeof Symbol=="function"&&typeof Symbol.toStringTag=="symbol"&&Object.defineProperty(wi.prototype,Symbol.toStringTag,{configurable:!0,value:"AbortSignal"});var py=class py{constructor(){_R.set(this,Dq())}get signal(){return bR(this)}abort(){Cq(bR(this))}};l(py,"AbortController");var yi=py,_R=new WeakMap;function bR(t){let e=_R.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(bR,"getSignal");Object.defineProperties(yi.prototype,{signal:{enumerable:!0},abort:{enumerable:!0}});typeof Symbol=="function"&&typeof Symbol.toStringTag=="symbol"&&Object.defineProperty(yi.prototype,Symbol.toStringTag,{configurable:!0,value:"AbortController"});uc.AbortController=yi;uc.AbortSignal=wi;uc.default=yi;fc.exports=yi;fc.exports.AbortController=fc.exports.default=yi;fc.exports.AbortSignal=wi});var at=T((uX,wy)=>{"use strict";var Iq=ie("buffer"),{format:$q,inspect:Bq}=ay(),{codes:{ERR_INVALID_ARG_TYPE:my}}=Ze(),{kResistStopPropagation:Mq,AggregateError:Lq,SymbolDispose:jq}=ye(),qq=globalThis.AbortSignal||so().AbortSignal,Uq=globalThis.AbortController||so().AbortController,Wq=Object.getPrototypeOf(async function(){}).constructor,SR=globalThis.Blob||Iq.Blob,zq=l(typeof SR<"u"?function(e){return e instanceof SR}:function(e){return!1},"isBlob"),vR=l((t,e)=>{if(t!==void 0&&(t===null||typeof t!="object"||!("aborted"in t)))throw new my(e,"AbortSignal",t)},"validateAbortSignal"),Hq=l((t,e)=>{if(typeof t!="function")throw new my(e,"Function",t)},"validateFunction");wy.exports={AggregateError:Lq,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:$q,inspect:Bq,types:{isAsyncFunction(t){return t instanceof Wq},isArrayBufferView(t){return ArrayBuffer.isView(t)}},isBlob:zq,deprecate(t,e){return t},addAbortListener:ie("events").addAbortListener||l(function(e,r){if(e===void 0)throw new my("signal","AbortSignal",e);vR(e,"signal"),Hq(r,"listener");let i;return e.aborted?queueMicrotask(()=>r()):(e.addEventListener("abort",r,{__proto__:null,once:!0,[Mq]:!0}),i=l(()=>{e.removeEventListener("abort",r)},"removeEventListener")),{__proto__:null,[jq](){var n;(n=i)===null||n===void 0||n()}}},"addAbortListener"),AbortSignalAny:qq.any||l(function(e){if(e.length===1)return e[0];let r=new Uq,i=l(()=>r.abort(),"abort");return e.forEach(n=>{vR(n,"signals"),n.addEventListener("abort",i,{once:!0})}),r.signal.addEventListener("abort",()=>{e.forEach(n=>n.removeEventListener("abort",i))},{once:!0}),r.signal},"AbortSignalAny")};wy.exports.promisify.custom=Symbol.for("nodejs.util.promisify.custom")});var ao=T((dX,NR)=>{"use strict";var{ArrayIsArray:gy,ArrayPrototypeIncludes:kR,ArrayPrototypeJoin:RR,ArrayPrototypeMap:Vq,NumberIsInteger:by,NumberIsNaN:Gq,NumberMAX_SAFE_INTEGER:Jq,NumberMIN_SAFE_INTEGER:Kq,NumberParseInt:Xq,ObjectPrototypeHasOwnProperty:Yq,RegExpPrototypeExec:OR,String:Zq,StringPrototypeToUpperCase:Qq,StringPrototypeTrim:e8}=ye(),{hideStackFrames:Bt,codes:{ERR_SOCKET_BAD_PORT:t8,ERR_INVALID_ARG_TYPE:Qe,ERR_INVALID_ARG_VALUE:oo,ERR_OUT_OF_RANGE:nn,ERR_UNKNOWN_SIGNAL:ER}}=Ze(),{normalizeEncoding:r8}=at(),{isAsyncFunction:i8,isArrayBufferView:n8}=at().types,FR={};function s8(t){return t===(t|0)}l(s8,"isInt32");function o8(t){return t===t>>>0}l(o8,"isUint32");var a8=/^[0-7]+$/,c8="must be a 32-bit unsigned integer or an octal string";function l8(t,e,r){if(typeof t>"u"&&(t=r),typeof t=="string"){if(OR(a8,t)===null)throw new oo(e,t,c8);t=Xq(t,8)}return xR(t,e),t}l(l8,"parseFileMode");var f8=Bt((t,e,r=Kq,i=Jq)=>{if(typeof t!="number")throw new Qe(e,"number",t);if(!by(t))throw new nn(e,"an integer",t);if(t<r||t>i)throw new nn(e,`>= ${r} && <= ${i}`,t)}),u8=Bt((t,e,r=-2147483648,i=2147483647)=>{if(typeof t!="number")throw new Qe(e,"number",t);if(!by(t))throw new nn(e,"an integer",t);if(t<r||t>i)throw new nn(e,`>= ${r} && <= ${i}`,t)}),xR=Bt((t,e,r=!1)=>{if(typeof t!="number")throw new Qe(e,"number",t);if(!by(t))throw new nn(e,"an integer",t);let i=r?1:0,n=4294967295;if(t<i||t>n)throw new nn(e,`>= ${i} && <= ${n}`,t)});function _y(t,e){if(typeof t!="string")throw new Qe(e,"string",t)}l(_y,"validateString");function h8(t,e,r=void 0,i){if(typeof t!="number")throw new Qe(e,"number",t);if(r!=null&&t<r||i!=null&&t>i||(r!=null||i!=null)&&Gq(t))throw new nn(e,`${r!=null?`>= ${r}`:""}${r!=null&&i!=null?" && ":""}${i!=null?`<= ${i}`:""}`,t)}l(h8,"validateNumber");var d8=Bt((t,e,r)=>{if(!kR(r,t)){let n="must be one of: "+RR(Vq(r,s=>typeof s=="string"?`'${s}'`:Zq(s)),", ");throw new oo(e,t,n)}});function AR(t,e){if(typeof t!="boolean")throw new Qe(e,"boolean",t)}l(AR,"validateBoolean");function yy(t,e,r){return t==null||!Yq(t,e)?r:t[e]}l(yy,"getOwnPropertyValueOrDefault");var p8=Bt((t,e,r=null)=>{let i=yy(r,"allowArray",!1),n=yy(r,"allowFunction",!1);if(!yy(r,"nullable",!1)&&t===null||!i&&gy(t)||typeof t!="object"&&(!n||typeof t!="function"))throw new Qe(e,"Object",t)}),m8=Bt((t,e)=>{if(t!=null&&typeof t!="object"&&typeof t!="function")throw new Qe(e,"a dictionary",t)}),$u=Bt((t,e,r=0)=>{if(!gy(t))throw new Qe(e,"Array",t);if(t.length<r){let i=`must be longer than ${r}`;throw new oo(e,t,i)}});function w8(t,e){$u(t,e);for(let r=0;r<t.length;r++)_y(t[r],`${e}[${r}]`)}l(w8,"validateStringArray");function y8(t,e){$u(t,e);for(let r=0;r<t.length;r++)AR(t[r],`${e}[${r}]`)}l(y8,"validateBooleanArray");function g8(t,e){$u(t,e);for(let r=0;r<t.length;r++){let i=t[r],n=`${e}[${r}]`;if(i==null)throw new Qe(n,"AbortSignal",i);PR(i,n)}}l(g8,"validateAbortSignalArray");function b8(t,e="signal"){if(_y(t,e),FR[t]===void 0)throw FR[Qq(t)]!==void 0?new ER(t+" (signals must use all capital letters)"):new ER(t)}l(b8,"validateSignalName");var _8=Bt((t,e="buffer")=>{if(!n8(t))throw new Qe(e,["Buffer","TypedArray","DataView"],t)});function S8(t,e){let r=r8(e),i=t.length;if(r==="hex"&&i%2!==0)throw new oo("encoding",e,`is invalid for data of length ${i}`)}l(S8,"validateEncoding");function v8(t,e="Port",r=!0){if(typeof t!="number"&&typeof t!="string"||typeof t=="string"&&e8(t).length===0||+t!==+t>>>0||t>65535||t===0&&!r)throw new t8(e,t,r);return t|0}l(v8,"validatePort");var PR=Bt((t,e)=>{if(t!==void 0&&(t===null||typeof t!="object"||!("aborted"in t)))throw new Qe(e,"AbortSignal",t)}),E8=Bt((t,e)=>{if(typeof t!="function")throw new Qe(e,"Function",t)}),F8=Bt((t,e)=>{if(typeof t!="function"||i8(t))throw new Qe(e,"Function",t)}),T8=Bt((t,e)=>{if(t!==void 0)throw new Qe(e,"undefined",t)});function k8(t,e,r){if(!kR(r,t))throw new Qe(e,`('${RR(r,"|")}')`,t)}l(k8,"validateUnion");var R8=/^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/;function TR(t,e){if(typeof t>"u"||!OR(R8,t))throw new oo(e,t,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}l(TR,"validateLinkHeaderFormat");function O8(t){if(typeof t=="string")return TR(t,"hints"),t;if(gy(t)){let e=t.length,r="";if(e===0)return r;for(let i=0;i<e;i++){let n=t[i];TR(n,"hints"),r+=n,i!==e-1&&(r+=", ")}return r}throw new oo("hints",t,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}l(O8,"validateLinkHeaderValue");NR.exports={isInt32:s8,isUint32:o8,parseFileMode:l8,validateArray:$u,validateStringArray:w8,validateBooleanArray:y8,validateAbortSignalArray:g8,validateBoolean:AR,validateBuffer:_8,validateDictionary:m8,validateEncoding:S8,validateFunction:E8,validateInt32:u8,validateInteger:f8,validateNumber:h8,validateObject:p8,validateOneOf:d8,validatePlainFunction:F8,validatePort:v8,validateSignalName:b8,validateString:_y,validateUint32:xR,validateUndefined:T8,validateUnion:k8,validateAbortSignal:PR,validateLinkHeaderValue:O8}});var gi=T((mX,DR)=>{DR.exports=globalThis.process});var gr=T((wX,JR)=>{"use strict";var{SymbolAsyncIterator:CR,SymbolIterator:IR,SymbolFor:sn}=ye(),$R=sn("nodejs.stream.destroyed"),BR=sn("nodejs.stream.errored"),Sy=sn("nodejs.stream.readable"),vy=sn("nodejs.stream.writable"),MR=sn("nodejs.stream.disturbed"),x8=sn("nodejs.webstream.isClosedPromise"),A8=sn("nodejs.webstream.controllerErrorFunction");function Bu(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(Bu,"isReadableNodeStream");function Mu(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(Mu,"isWritableNodeStream");function P8(t){return!!(t&&typeof t.pipe=="function"&&t._readableState&&typeof t.on=="function"&&typeof t.write=="function")}l(P8,"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 LR(t){return!!(t&&!yr(t)&&typeof t.pipeThrough=="function"&&typeof t.getReader=="function"&&typeof t.cancel=="function")}l(LR,"isReadableStream");function jR(t){return!!(t&&!yr(t)&&typeof t.getWriter=="function"&&typeof t.abort=="function")}l(jR,"isWritableStream");function qR(t){return!!(t&&!yr(t)&&typeof t.readable=="object"&&typeof t.writable=="object")}l(qR,"isTransformStream");function N8(t){return LR(t)||jR(t)||qR(t)}l(N8,"isWebStream");function D8(t,e){return t==null?!1:e===!0?typeof t[CR]=="function":e===!1?typeof t[IR]=="function":typeof t[CR]=="function"||typeof t[IR]=="function"}l(D8,"isIterable");function Lu(t){if(!yr(t))return null;let e=t._writableState,r=t._readableState,i=e||r;return!!(t.destroyed||t[$R]||i!=null&&i.destroyed)}l(Lu,"isDestroyed");function UR(t){if(!Mu(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(UR,"isWritableEnded");function C8(t,e){if(!Mu(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(C8,"isWritableFinished");function I8(t){if(!Bu(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(I8,"isReadableEnded");function WR(t,e){if(!Bu(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(WR,"isReadableFinished");function zR(t){return t&&t[Sy]!=null?t[Sy]:typeof t?.readable!="boolean"?null:Lu(t)?!1:Bu(t)&&t.readable&&!WR(t)}l(zR,"isReadable");function HR(t){return t&&t[vy]!=null?t[vy]:typeof t?.writable!="boolean"?null:Lu(t)?!1:Mu(t)&&t.writable&&!UR(t)}l(HR,"isWritable");function $8(t,e){return yr(t)?Lu(t)?!0:!(e?.readable!==!1&&zR(t)||e?.writable!==!1&&HR(t)):null}l($8,"isFinished");function B8(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(B8,"isWritableErrored");function M8(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(M8,"isReadableErrored");function L8(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"&&VR(t)?t._closed:null}l(L8,"isClosed");function VR(t){return typeof t._closed=="boolean"&&typeof t._defaultKeepAlive=="boolean"&&typeof t._removedConnection=="boolean"&&typeof t._removedContLen=="boolean"}l(VR,"isOutgoingMessage");function GR(t){return typeof t._sent100=="boolean"&&VR(t)}l(GR,"isServerResponse");function j8(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(j8,"isServerRequest");function q8(t){if(!yr(t))return null;let e=t._writableState,r=t._readableState,i=e||r;return!i&&GR(t)||!!(i&&i.autoDestroy&&i.emitClose&&i.closed===!1)}l(q8,"willEmitClose");function U8(t){var e;return!!(t&&((e=t[MR])!==null&&e!==void 0?e:t.readableDidRead||t.readableAborted))}l(U8,"isDisturbed");function W8(t){var e,r,i,n,s,o,f,c,a,u;return!!(t&&((e=(r=(i=(n=(s=(o=t[BR])!==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(W8,"isErrored");JR.exports={isDestroyed:Lu,kIsDestroyed:$R,isDisturbed:U8,kIsDisturbed:MR,isErrored:W8,kIsErrored:BR,isReadable:zR,kIsReadable:Sy,kIsClosedPromise:x8,kControllerErrorFunction:A8,kIsWritable:vy,isClosed:L8,isDuplexNodeStream:P8,isFinished:$8,isIterable:D8,isReadableNodeStream:Bu,isReadableStream:LR,isReadableEnded:I8,isReadableFinished:WR,isReadableErrored:M8,isNodeStream:yr,isWebStream:N8,isWritable:HR,isWritableNodeStream:Mu,isWritableStream:jR,isWritableEnded:UR,isWritableFinished:C8,isWritableErrored:B8,isServerRequest:j8,isServerResponse:GR,willEmitClose:q8,isTransformStream:qR}});var Lr=T((gX,Ry)=>{"use strict";var bi=gi(),{AbortError:iO,codes:z8}=Ze(),{ERR_INVALID_ARG_TYPE:H8,ERR_STREAM_PREMATURE_CLOSE:KR}=z8,{kEmptyObject:Fy,once:Ty}=at(),{validateAbortSignal:V8,validateFunction:G8,validateObject:J8,validateBoolean:K8}=ao(),{Promise:X8,PromisePrototypeThen:Y8,SymbolDispose:nO}=ye(),{isClosed:Z8,isReadable:XR,isReadableNodeStream:Ey,isReadableStream:Q8,isReadableFinished:YR,isReadableErrored:ZR,isWritable:QR,isWritableNodeStream:eO,isWritableStream:eU,isWritableFinished:tO,isWritableErrored:rO,isNodeStream:tU,willEmitClose:rU,kIsClosedPromise:iU}=gr(),co;function nU(t){return t.setHeader&&typeof t.abort=="function"}l(nU,"isRequest");var ky=l(()=>{},"nop");function sO(t,e,r){var i,n;if(arguments.length===2?(r=e,e=Fy):e==null?e=Fy:J8(e,"options"),G8(r,"callback"),V8(e.signal,"options.signal"),r=Ty(r),Q8(t)||eU(t))return sU(t,e,r);if(!tU(t))throw new H8("stream",["ReadableStream","WritableStream","Stream"],t);let s=(i=e.readable)!==null&&i!==void 0?i:Ey(t),o=(n=e.writable)!==null&&n!==void 0?n:eO(t),f=t._writableState,c=t._readableState,a=l(()=>{t.writable||d()},"onlegacyfinish"),u=rU(t)&&Ey(t)===s&&eO(t)===o,h=tO(t,!1),d=l(()=>{h=!0,t.destroyed&&(u=!1),!(u&&(!t.readable||s))&&(!s||p)&&r.call(t)},"onfinish"),p=YR(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=Z8(t),b=l(()=>{y=!0;let R=rO(t)||ZR(t);if(R&&typeof R!="boolean")return r.call(t,R);if(s&&!p&&Ey(t,!0)&&!YR(t,!1))return r.call(t,new KR);if(o&&!h&&!tO(t,!1))return r.call(t,new KR);r.call(t)},"onclose"),_=l(()=>{y=!0;let R=rO(t)||ZR(t);if(R&&typeof R!="boolean")return r.call(t,R);r.call(t)},"onclosed"),F=l(()=>{t.req.on("finish",d)},"onrequest");nU(t)?(t.on("complete",d),u||t.on("abort",b),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",b),t.on("end",m),t.on("finish",d),e.error!==!1&&t.on("error",w),t.on("close",b),y?bi.nextTick(b):f!=null&&f.errorEmitted||c!=null&&c.errorEmitted?u||bi.nextTick(_):(!s&&(!u||XR(t))&&(h||QR(t)===!1)||!o&&(!u||QR(t))&&(p||XR(t)===!1)||c&&t.req&&t.aborted)&&bi.nextTick(_);let E=l(()=>{r=ky,t.removeListener("aborted",b),t.removeListener("complete",d),t.removeListener("abort",b),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",b)},"cleanup");if(e.signal&&!y){let R=l(()=>{let D=r;E(),D.call(t,new iO(void 0,{cause:e.signal.reason}))},"abort");if(e.signal.aborted)bi.nextTick(R);else{co=co||at().addAbortListener;let D=co(e.signal,R),S=r;r=Ty((...O)=>{D[nO](),S.apply(t,O)})}}return E}l(sO,"eos");function sU(t,e,r){let i=!1,n=ky;if(e.signal)if(n=l(()=>{i=!0,r.call(t,new iO(void 0,{cause:e.signal.reason}))},"abort"),e.signal.aborted)bi.nextTick(n);else{co=co||at().addAbortListener;let o=co(e.signal,n),f=r;r=Ty((...c)=>{o[nO](),f.apply(t,c)})}let s=l((...o)=>{i||bi.nextTick(()=>r.apply(t,o))},"resolverFn");return Y8(t[iU].promise,s,s),ky}l(sU,"eosWeb");function oU(t,e){var r;let i=!1;return e===null&&(e=Fy),(r=e)!==null&&r!==void 0&&r.cleanup&&(K8(e.cleanup,"cleanup"),i=e.cleanup),new X8((n,s)=>{let o=sO(t,e,f=>{i&&o(),f?s(f):n()})})}l(oU,"finished");Ry.exports=sO;Ry.exports.finished=oU});var on=T((_X,dO)=>{"use strict";var br=gi(),{aggregateTwoErrors:aU,codes:{ERR_MULTIPLE_CALLBACK:cU},AbortError:lU}=Ze(),{Symbol:cO}=ye(),{kIsDestroyed:fU,isDestroyed:uU,isFinished:hU,isServerRequest:dU}=gr(),lO=cO("kDestroy"),Oy=cO("kConstruct");function fO(t,e,r){t&&(t.stack,e&&!e.errored&&(e.errored=t),r&&!r.errored&&(r.errored=t))}l(fO,"checkError");function pU(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):(fO(t,i,r),i&&(i.destroyed=!0),r&&(r.destroyed=!0),n.constructed?oO(this,t,e):this.once(lO,function(s){oO(this,aU(s,t),e)}),this)}l(pU,"destroy");function oO(t,e,r){let i=!1;function n(s){if(i)return;i=!0;let o=t._readableState,f=t._writableState;fO(s,f,o),f&&(f.closed=!0),o&&(o.closed=!0),typeof r=="function"&&r(s),s?br.nextTick(mU,t,s):br.nextTick(uO,t)}l(n,"onDestroy");try{t._destroy(e||null,n)}catch(s){n(s)}}l(oO,"_destroy");function mU(t,e){xy(t,e),uO(t)}l(mU,"emitErrorCloseNT");function uO(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(uO,"emitCloseNT");function xy(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(xy,"emitErrorNT");function wU(){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(wU,"undestroy");function Ay(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(xy,t,e):xy(t,e))}l(Ay,"errorOrDestroy");function yU(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(Oy,e),!(t.listenerCount(Oy)>1)&&br.nextTick(gU,t)}l(yU,"construct");function gU(t){let e=!1;function r(i){if(e){Ay(t,i??new cU);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(lO,i):i?Ay(t,i,!0):br.nextTick(bU,t)}l(r,"onConstruct");try{t._construct(i=>{br.nextTick(r,i)})}catch(i){br.nextTick(r,i)}}l(gU,"constructNT");function bU(t){t.emit(Oy)}l(bU,"emitConstructNT");function aO(t){return t?.setHeader&&typeof t.abort=="function"}l(aO,"isRequest");function hO(t){t.emit("close")}l(hO,"emitCloseLegacy");function _U(t,e){t.emit("error",e),br.nextTick(hO,t)}l(_U,"emitErrorCloseLegacy");function SU(t,e){!t||uU(t)||(!e&&!hU(t)&&(e=new lU),dU(t)?(t.socket=null,t.destroy(e)):aO(t)?t.abort():aO(t.req)?t.req.abort():typeof t.destroy=="function"?t.destroy(e):typeof t.close=="function"?t.close():e?br.nextTick(_U,t,e):br.nextTick(hO,t),t.destroyed||(t[fU]=!0))}l(SU,"destroyer");dO.exports={construct:yU,destroyer:SU,destroy:pU,undestroy:wU,errorOrDestroy:Ay}});var Uu=T((vX,mO)=>{"use strict";var{ArrayIsArray:vU,ObjectSetPrototypeOf:pO}=ye(),{EventEmitter:ju}=ie("events");function qu(t){ju.call(this,t)}l(qu,"Stream");pO(qu.prototype,ju.prototype);pO(qu,ju);qu.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(),ju.listenerCount(this,"error")===0&&this.emit("error",u)}l(c,"onerror"),Py(r,"error",c),Py(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 Py(t,e,r){if(typeof t.prependListener=="function")return t.prependListener(e,r);!t._events||!t._events[e]?t.on(e,r):vU(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]}l(Py,"prependListener");mO.exports={Stream:qu,prependListener:Py}});var hc=T((FX,Wu)=>{"use strict";var{SymbolDispose:EU}=ye(),{AbortError:wO,codes:FU}=Ze(),{isNodeStream:yO,isWebStream:TU,kControllerErrorFunction:kU}=gr(),RU=Lr(),{ERR_INVALID_ARG_TYPE:gO}=FU,Ny,OU=l((t,e)=>{if(typeof t!="object"||!("aborted"in t))throw new gO(e,"AbortSignal",t)},"validateAbortSignal");Wu.exports.addAbortSignal=l(function(e,r){if(OU(e,"signal"),!yO(r)&&!TU(r))throw new gO("stream",["ReadableStream","WritableStream","Stream"],r);return Wu.exports.addAbortSignalNoValidate(e,r)},"addAbortSignal");Wu.exports.addAbortSignalNoValidate=function(t,e){if(typeof t!="object"||!("aborted"in t))return e;let r=yO(e)?()=>{e.destroy(new wO(void 0,{cause:t.reason}))}:()=>{e[kU](new wO(void 0,{cause:t.reason}))};if(t.aborted)r();else{Ny=Ny||at().addAbortListener;let i=Ny(t,r);RU(e,i[EU])}return e}});var SO=T((kX,_O)=>{"use strict";var{StringPrototypeSlice:bO,SymbolIterator:xU,TypedArrayPrototypeSet:zu,Uint8Array:AU}=ye(),{Buffer:Dy}=ie("buffer"),{inspect:PU}=at(),lo;_O.exports=(lo=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}*[xU](){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+=bO(s,0,e),this.head=i,i.data=bO(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 AU(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 PU(this,{...r,depth:0,customInspect:!1})}},l(lo,"BufferList"),lo)});var dc=T((OX,TO)=>{"use strict";var{MathFloor:NU,NumberIsInteger:DU}=ye(),{validateInteger:CU}=ao(),{ERR_INVALID_ARG_VALUE:IU}=Ze().codes,vO=16*1024,EO=16;function $U(t,e,r){return t.highWaterMark!=null?t.highWaterMark:e?t[r]:null}l($U,"highWaterMarkFrom");function FO(t){return t?EO:vO}l(FO,"getDefaultHighWaterMark");function BU(t,e){CU(e,"value",0),t?EO=e:vO=e}l(BU,"setDefaultHighWaterMark");function MU(t,e,r,i){let n=$U(e,i,r);if(n!=null){if(!DU(n)||n<0){let s=i?`options.${r}`:"options.highWaterMark";throw new IU(s,n)}return NU(n)}return FO(t.objectMode)}l(MU,"getHighWaterMark");TO.exports={getHighWaterMark:MU,getDefaultHighWaterMark:FO,setDefaultHighWaterMark:BU}});var OO=T(RO=>{"use strict";var Iy=pa().Buffer,kO=Iy.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 LU(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(LU,"_normalizeEncoding");function jU(t){var e=LU(t);if(typeof e!="string"&&(Iy.isEncoding===kO||!kO(t)))throw new Error("Unknown encoding: "+t);return e||t}l(jU,"normalizeEncoding");RO.StringDecoder=pc;function pc(t){this.encoding=jU(t);var e;switch(this.encoding){case"utf16le":this.text=VU,this.end=GU,e=4;break;case"utf8":this.fillLast=WU,e=4;break;case"base64":this.text=JU,this.end=KU,e=3;break;default:this.write=XU,this.end=YU;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=Iy.allocUnsafe(e)}l(pc,"StringDecoder");pc.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||""};pc.prototype.end=HU;pc.prototype.text=zU;pc.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 Cy(t){return t<=127?0:t>>5===6?2:t>>4===14?3:t>>3===30?4:t>>6===2?-1:-2}l(Cy,"utf8CheckByte");function qU(t,e,r){var i=e.length-1;if(i<r)return 0;var n=Cy(e[i]);return n>=0?(n>0&&(t.lastNeed=n-1),n):--i<r||n===-2?0:(n=Cy(e[i]),n>=0?(n>0&&(t.lastNeed=n-2),n):--i<r||n===-2?0:(n=Cy(e[i]),n>=0?(n>0&&(n===2?n=0:t.lastNeed=n-3),n):0))}l(qU,"utf8CheckIncomplete");function UU(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(UU,"utf8CheckExtraBytes");function WU(t){var e=this.lastTotal-this.lastNeed,r=UU(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(WU,"utf8FillLast");function zU(t,e){var r=qU(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(zU,"utf8Text");function HU(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"\uFFFD":e}l(HU,"utf8End");function VU(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(VU,"utf16Text");function GU(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(GU,"utf16End");function JU(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(JU,"base64Text");function KU(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}l(KU,"base64End");function XU(t){return t.toString(this.encoding)}l(XU,"simpleWrite");function YU(t){return t&&t.length?this.write(t):""}l(YU,"simpleEnd")});var $y=T((NX,NO)=>{"use strict";var xO=gi(),{PromisePrototypeThen:ZU,SymbolAsyncIterator:AO,SymbolIterator:PO}=ye(),{Buffer:QU}=ie("buffer"),{ERR_INVALID_ARG_TYPE:eW,ERR_STREAM_NULL_VALUES:tW}=Ze().codes;function rW(t,e,r){let i;if(typeof e=="string"||e instanceof QU)return new t({objectMode:!0,...r,read(){this.push(e),this.push(null)}});let n;if(e&&e[AO])n=!0,i=e[AO]();else if(e&&e[PO])n=!1,i=e[PO]();else throw new eW("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){ZU(f(a),()=>xO.nextTick(u,a),h=>xO.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 tW;if(s.push(h))continue;o=!1}}catch(a){s.destroy(a)}break}}return l(c,"next"),s}l(rW,"from");NO.exports=rW});var wc=T((CX,XO)=>{"use strict";var er=gi(),{ArrayPrototypeIndexOf:iW,NumberIsInteger:nW,NumberIsNaN:sW,NumberParseInt:oW,ObjectDefineProperties:zy,ObjectKeys:aW,ObjectSetPrototypeOf:IO,Promise:$O,SafeSet:cW,SymbolAsyncDispose:lW,SymbolAsyncIterator:fW,Symbol:uW}=ye();XO.exports=G;G.ReadableState=Ju;var{EventEmitter:hW}=ie("events"),{Stream:_i,prependListener:dW}=Uu(),{Buffer:By}=ie("buffer"),{addAbortSignal:pW}=hc(),BO=Lr(),Y=at().debuglog("stream",t=>{Y=t}),mW=SO(),ho=on(),{getHighWaterMark:wW,getDefaultHighWaterMark:yW}=dc(),{aggregateTwoErrors:DO,codes:{ERR_INVALID_ARG_TYPE:gW,ERR_METHOD_NOT_IMPLEMENTED:bW,ERR_OUT_OF_RANGE:_W,ERR_STREAM_PUSH_AFTER_EOF:SW,ERR_STREAM_UNSHIFT_AFTER_END_EVENT:vW},AbortError:EW}=Ze(),{validateObject:FW}=ao(),an=uW("kPaused"),{StringDecoder:MO}=OO(),TW=$y();IO(G.prototype,_i.prototype);IO(G,_i);var My=l(()=>{},"nop"),{errorOrDestroy:fo}=ho,uo=1,kW=2,LO=4,mc=8,jO=16,Hu=32,Vu=64,qO=128,RW=256,OW=512,xW=1024,Uy=2048,Wy=4096,AW=8192,PW=16384,NW=32768,UO=65536,DW=1<<17,CW=1<<18;function Ce(t){return{enumerable:!1,get(){return(this.state&t)!==0},set(e){e?this.state|=t:this.state&=~t}}}l(Ce,"makeBitMapDescriptor");zy(Ju.prototype,{objectMode:Ce(uo),ended:Ce(kW),endEmitted:Ce(LO),reading:Ce(mc),constructed:Ce(jO),sync:Ce(Hu),needReadable:Ce(Vu),emittedReadable:Ce(qO),readableListening:Ce(RW),resumeScheduled:Ce(OW),errorEmitted:Ce(xW),emitClose:Ce(Uy),autoDestroy:Ce(Wy),destroyed:Ce(AW),closed:Ce(PW),closeEmitted:Ce(NW),multiAwaitDrain:Ce(UO),readingMore:Ce(DW),dataEmitted:Ce(CW)});function Ju(t,e,r){typeof r!="boolean"&&(r=e instanceof _r()),this.state=Uy|Wy|jO|Hu,t&&t.objectMode&&(this.state|=uo),r&&t&&t.readableObjectMode&&(this.state|=uo),this.highWaterMark=t?wW(this,t,"readableHighWaterMark",r):yW(!1),this.buffer=new mW,this.length=0,this.pipes=[],this.flowing=null,this[an]=null,t&&t.emitClose===!1&&(this.state&=~Uy),t&&t.autoDestroy===!1&&(this.state&=~Wy),this.errored=null,this.defaultEncoding=t&&t.defaultEncoding||"utf8",this.awaitDrainWriters=null,this.decoder=null,this.encoding=null,t&&t.encoding&&(this.decoder=new MO(t.encoding),this.encoding=t.encoding)}l(Ju,"ReadableState");function G(t){if(!(this instanceof G))return new G(t);let e=this instanceof _r();this._readableState=new Ju(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&&pW(t.signal,this)),_i.call(this,t),ho.construct(this,()=>{this._readableState.needReadable&&Gu(this,this._readableState)})}l(G,"Readable");G.prototype.destroy=ho.destroy;G.prototype._undestroy=ho.undestroy;G.prototype._destroy=function(t,e){e(t)};G.prototype[hW.captureRejectionSymbol]=function(t){this.destroy(t)};G.prototype[lW]=function(){let t;return this.destroyed||(t=this.readableEnded?null:new EW,this.destroy(t)),new $O((e,r)=>BO(this,i=>i&&i!==t?r(i):e(null)))};G.prototype.push=function(t,e){return WO(this,t,e,!1)};G.prototype.unshift=function(t,e){return WO(this,t,e,!0)};function WO(t,e,r,i){Y("readableAddChunk",e);let n=t._readableState,s;if(n.state&uo||(typeof e=="string"?(r=r||n.defaultEncoding,n.encoding!==r&&(i&&n.encoding?e=By.from(e,r).toString(n.encoding):(e=By.from(e,r),r=""))):e instanceof By?r="":_i._isUint8Array(e)?(e=_i._uint8ArrayToBuffer(e),r=""):e!=null&&(s=new gW("chunk",["string","Buffer","Uint8Array"],e))),s)fo(t,s);else if(e===null)n.state&=~mc,BW(t,n);else if(n.state&uo||e&&e.length>0)if(i)if(n.state&LO)fo(t,new vW);else{if(n.destroyed||n.errored)return!1;Ly(t,n,e,!0)}else if(n.ended)fo(t,new SW);else{if(n.destroyed||n.errored)return!1;n.state&=~mc,n.decoder&&!r?(e=n.decoder.write(e),n.objectMode||e.length!==0?Ly(t,n,e,!1):Gu(t,n)):Ly(t,n,e,!1)}else i||(n.state&=~mc,Gu(t,n));return!n.ended&&(n.length<n.highWaterMark||n.length===0)}l(WO,"readableAddChunk");function Ly(t,e,r,i){e.flowing&&e.length===0&&!e.sync&&t.listenerCount("data")>0?(e.state&UO?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&Vu&&Ku(t)),Gu(t,e)}l(Ly,"addChunk");G.prototype.isPaused=function(){let t=this._readableState;return t[an]===!0||t.flowing===!1};G.prototype.setEncoding=function(t){let e=new MO(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 IW=1073741824;function $W(t){if(t>IW)throw new _W("size","<= 1GiB",t);return t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++,t}l($W,"computeNewHighWaterMark");function CO(t,e){return t<=0||e.length===0&&e.ended?0:e.state&uo?1:sW(t)?e.flowing&&e.length?e.buffer.first().length:e.length:t<=e.length?t:e.ended?e.length:0}l(CO,"howMuchToRead");G.prototype.read=function(t){Y("read",t),t===void 0?t=NaN:nW(t)||(t=oW(t,10));let e=this._readableState,r=t;if(t>e.highWaterMark&&(e.highWaterMark=$W(t)),t!==0&&(e.state&=~qO),t===0&&e.needReadable&&((e.highWaterMark!==0?e.length>=e.highWaterMark:e.length>0)||e.ended))return Y("read: emitReadable",e.length,e.ended),e.length===0&&e.ended?jy(this):Ku(this),null;if(t=CO(t,e),t===0&&e.ended)return e.length===0&&jy(this),null;let i=(e.state&Vu)!==0;if(Y("need readable",i),(e.length===0||e.length-t<e.highWaterMark)&&(i=!0,Y("length less than watermark",i)),e.ended||e.reading||e.destroyed||e.errored||!e.constructed)i=!1,Y("reading, ended or constructing",i);else if(i){Y("do read"),e.state|=mc|Hu,e.length===0&&(e.state|=Vu);try{this._read(e.highWaterMark)}catch(s){fo(this,s)}e.state&=~Hu,e.reading||(t=CO(r,e))}let n;return t>0?n=JO(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&&jy(this)),n!==null&&!e.errorEmitted&&!e.closeEmitted&&(e.dataEmitted=!0,this.emit("data",n)),n};function BW(t,e){if(Y("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?Ku(t):(e.needReadable=!1,e.emittedReadable=!0,zO(t))}}l(BW,"onEofChunk");function Ku(t){let e=t._readableState;Y("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(Y("emitReadable",e.flowing),e.emittedReadable=!0,er.nextTick(zO,t))}l(Ku,"emitReadable");function zO(t){let e=t._readableState;Y("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,VO(t)}l(zO,"emitReadable_");function Gu(t,e){!e.readingMore&&e.constructed&&(e.readingMore=!0,er.nextTick(MW,t,e))}l(Gu,"maybeReadMore");function MW(t,e){for(;!e.reading&&!e.ended&&(e.length<e.highWaterMark||e.flowing&&e.length===0);){let r=e.length;if(Y("maybeReadMore read 0"),t.read(0),r===e.length)break}e.readingMore=!1}l(MW,"maybeReadMore_");G.prototype._read=function(t){throw new bW("_read()")};G.prototype.pipe=function(t,e){let r=this,i=this._readableState;i.pipes.length===1&&(i.multiAwaitDrain||(i.multiAwaitDrain=!0,i.awaitDrainWriters=new cW(i.awaitDrainWriters?[i.awaitDrainWriters]:[]))),i.pipes.push(t),Y("pipe count=%d opts=%j",i.pipes.length,e);let s=(!e||e.end!==!1)&&t!==er.stdout&&t!==er.stderr?f:y;i.endEmitted?er.nextTick(s):r.once("end",s),t.on("unpipe",o);function o(b,_){Y("onunpipe"),b===r&&_&&_.hasUnpiped===!1&&(_.hasUnpiped=!0,u())}l(o,"onunpipe");function f(){Y("onend"),t.end()}l(f,"onend");let c,a=!1;function u(){Y("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?(Y("false write response, pause",0),i.awaitDrainWriters=t,i.multiAwaitDrain=!1):i.pipes.length>1&&i.pipes.includes(t)&&(Y("false write response, pause",i.awaitDrainWriters.size),i.awaitDrainWriters.add(t)),r.pause()),c||(c=LW(r,t),t.on("drain",c))}l(h,"pause"),r.on("data",d);function d(b){Y("ondata");let _=t.write(b);Y("dest.write",_),_===!1&&h()}l(d,"ondata");function p(b){if(Y("onerror",b),y(),t.removeListener("error",p),t.listenerCount("error")===0){let _=t._writableState||t._readableState;_&&!_.errorEmitted?fo(t,b):t.emit("error",b)}}l(p,"onerror"),dW(t,"error",p);function m(){t.removeListener("finish",w),y()}l(m,"onclose"),t.once("close",m);function w(){Y("onfinish"),t.removeListener("close",m),y()}l(w,"onfinish"),t.once("finish",w);function y(){Y("unpipe"),r.unpipe(t)}return l(y,"unpipe"),t.emit("pipe",r),t.writableNeedDrain===!0?h():i.flowing||(Y("pipe resume"),r.resume()),t};function LW(t,e){return l(function(){let i=t._readableState;i.awaitDrainWriters===e?(Y("pipeOnDrain",1),i.awaitDrainWriters=null):i.multiAwaitDrain&&(Y("pipeOnDrain",i.awaitDrainWriters.size),i.awaitDrainWriters.delete(e)),(!i.awaitDrainWriters||i.awaitDrainWriters.size===0)&&t.listenerCount("data")&&t.resume()},"pipeOnDrainFunctionResult")}l(LW,"pipeOnDrain");G.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=iW(e.pipes,t);return i===-1?this:(e.pipes.splice(i,1),e.pipes.length===0&&this.pause(),t.emit("unpipe",this,r),this)};G.prototype.on=function(t,e){let r=_i.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,Y("on readable",i.length,i.reading),i.length?Ku(this):i.reading||er.nextTick(jW,this)),r};G.prototype.addListener=G.prototype.on;G.prototype.removeListener=function(t,e){let r=_i.prototype.removeListener.call(this,t,e);return t==="readable"&&er.nextTick(HO,this),r};G.prototype.off=G.prototype.removeListener;G.prototype.removeAllListeners=function(t){let e=_i.prototype.removeAllListeners.apply(this,arguments);return(t==="readable"||t===void 0)&&er.nextTick(HO,this),e};function HO(t){let e=t._readableState;e.readableListening=t.listenerCount("readable")>0,e.resumeScheduled&&e[an]===!1?e.flowing=!0:t.listenerCount("data")>0?t.resume():e.readableListening||(e.flowing=null)}l(HO,"updateReadableListening");function jW(t){Y("readable nexttick read 0"),t.read(0)}l(jW,"nReadingNextTick");G.prototype.resume=function(){let t=this._readableState;return t.flowing||(Y("resume"),t.flowing=!t.readableListening,qW(this,t)),t[an]=!1,this};function qW(t,e){e.resumeScheduled||(e.resumeScheduled=!0,er.nextTick(UW,t,e))}l(qW,"resume");function UW(t,e){Y("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),VO(t),e.flowing&&!e.reading&&t.read(0)}l(UW,"resume_");G.prototype.pause=function(){return Y("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(Y("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState[an]=!0,this};function VO(t){let e=t._readableState;for(Y("flow",e.flowing);e.flowing&&t.read()!==null;);}l(VO,"flow");G.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=>{fo(this,i)}),t.on("close",()=>{this.destroy()}),t.on("destroy",()=>{this.destroy()}),this._read=()=>{e&&t.resume&&(e=!1,t.resume())};let r=aW(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};G.prototype[fW]=function(){return GO(this)};G.prototype.iterator=function(t){return t!==void 0&&FW(t,"options"),GO(this,t)};function GO(t,e){typeof t.read!="function"&&(t=G.wrap(t,{objectMode:!0}));let r=WW(t,e);return r.stream=t,r}l(GO,"streamToAsyncIterator");async function*WW(t,e){let r=My;function i(o){this===t?(r(),r=My):r=o}l(i,"next"),t.on("readable",i);let n,s=BO(t,{writable:!1},o=>{n=o?DO(n,o):null,r(),r=My});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 $O(i)}}}catch(o){throw n=DO(n,o),n}finally{(n||e?.destroyOnReturn!==!1)&&(n===void 0||t._readableState.autoDestroy)?ho.destroyer(t,null):(t.off("readable",i),s())}}l(WW,"createAsyncIterator");zy(G.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}}});zy(Ju.prototype,{pipesCount:{__proto__:null,get(){return this.pipes.length}},paused:{__proto__:null,get(){return this[an]!==!1},set(t){this[an]=!!t}}});G._fromList=JO;function JO(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(JO,"fromList");function jy(t){let e=t._readableState;Y("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,er.nextTick(zW,e,t))}l(jy,"endReadable");function zW(t,e){if(Y("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)er.nextTick(HW,e);else if(t.autoDestroy){let r=e._writableState;(!r||r.autoDestroy&&(r.finished||r.writable===!1))&&e.destroy()}}}l(zW,"endReadableNT");function HW(t){t.writable&&!t.writableEnded&&!t.destroyed&&t.end()}l(HW,"endWritableNT");G.from=function(t,e){return TW(G,t,e)};var qy;function KO(){return qy===void 0&&(qy={}),qy}l(KO,"lazyWebStreams");G.fromWeb=function(t,e){return KO().newStreamReadableFromReadableStream(t,e)};G.toWeb=function(t,e){return KO().newReadableStreamFromStreamReadable(t,e)};G.wrap=function(t,e){var r,i;return new G({objectMode:(r=(i=t.readableObjectMode)!==null&&i!==void 0?i:t.objectMode)!==null&&r!==void 0?r:!0,...e,destroy(n,s){ho.destroyer(t,n),s(n)}}).wrap(t)}});var eh=T(($X,cx)=>{"use strict";var cn=gi(),{ArrayPrototypeSlice:QO,Error:VW,FunctionPrototypeSymbolHasInstance:ex,ObjectDefineProperty:tx,ObjectDefineProperties:GW,ObjectSetPrototypeOf:rx,StringPrototypeToLowerCase:JW,Symbol:KW,SymbolHasInstance:XW}=ye();cx.exports=_e;_e.WritableState=bc;var{EventEmitter:YW}=ie("events"),yc=Uu().Stream,{Buffer:Xu}=ie("buffer"),Qu=on(),{addAbortSignal:ZW}=hc(),{getHighWaterMark:QW,getDefaultHighWaterMark:e6}=dc(),{ERR_INVALID_ARG_TYPE:t6,ERR_METHOD_NOT_IMPLEMENTED:r6,ERR_MULTIPLE_CALLBACK:ix,ERR_STREAM_CANNOT_PIPE:i6,ERR_STREAM_DESTROYED:gc,ERR_STREAM_ALREADY_FINISHED:n6,ERR_STREAM_NULL_VALUES:s6,ERR_STREAM_WRITE_AFTER_END:o6,ERR_UNKNOWN_ENCODING:nx}=Ze().codes,{errorOrDestroy:po}=Qu;rx(_e.prototype,yc.prototype);rx(_e,yc);function Gy(){}l(Gy,"nop");var mo=KW("kOnFinished");function bc(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?QW(this,t,"writableHighWaterMark",r):e6(!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=c6.bind(void 0,e),this.writecb=null,this.writelen=0,this.afterWriteTickInfo=null,Zu(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[mo]=[]}l(bc,"WritableState");function Zu(t){t.buffered=[],t.bufferedIndex=0,t.allBuffers=!0,t.allNoop=!0}l(Zu,"resetBuffer");bc.prototype.getBuffer=l(function(){return QO(this.buffered,this.bufferedIndex)},"getBuffer");tx(bc.prototype,"bufferedRequestCount",{__proto__:null,get(){return this.buffered.length-this.bufferedIndex}});function _e(t){let e=this instanceof _r();if(!e&&!ex(_e,this))return new _e(t);this._writableState=new bc(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&&ZW(t.signal,this)),yc.call(this,t),Qu.construct(this,()=>{let r=this._writableState;r.writing||Ky(this,r),Xy(this,r)})}l(_e,"Writable");tx(_e,XW,{__proto__:null,value:l(function(t){return ex(this,t)?!0:this!==_e?!1:t&&t._writableState instanceof bc},"value")});_e.prototype.pipe=function(){po(this,new i6)};function sx(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"&&!Xu.isEncoding(r))throw new nx(r);typeof i!="function"&&(i=Gy)}if(e===null)throw new s6;if(!n.objectMode)if(typeof e=="string")n.decodeStrings!==!1&&(e=Xu.from(e,r),r="buffer");else if(e instanceof Xu)r="buffer";else if(yc._isUint8Array(e))e=yc._uint8ArrayToBuffer(e),r="buffer";else throw new t6("chunk",["string","Buffer","Uint8Array"],e);let s;return n.ending?s=new o6:n.destroyed&&(s=new gc("write")),s?(cn.nextTick(i,s),po(t,s,!0),s):(n.pendingcb++,a6(t,n,e,r,i))}l(sx,"_write");_e.prototype.write=function(t,e,r){return sx(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||Ky(this,t))};_e.prototype.setDefaultEncoding=l(function(e){if(typeof e=="string"&&(e=JW(e)),!Xu.isEncoding(e))throw new nx(e);return this._writableState.defaultEncoding=e,this},"setDefaultEncoding");function a6(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!==Gy&&(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(a6,"writeOrBuffer");function YO(t,e,r,i,n,s,o){e.writelen=i,e.writecb=o,e.writing=!0,e.sync=!0,e.destroyed?e.onwrite(new gc("write")):r?t._writev(n,e.onwrite):t._write(n,s,e.onwrite),e.sync=!1}l(YO,"doWrite");function ZO(t,e,r,i){--e.pendingcb,i(r),Jy(e),po(t,r)}l(ZO,"onwriteError");function c6(t,e){let r=t._writableState,i=r.sync,n=r.writecb;if(typeof n!="function"){po(t,new ix);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?cn.nextTick(ZO,t,r,e,n):ZO(t,r,e,n)):(r.buffered.length>r.bufferedIndex&&Ky(t,r),i?r.afterWriteTickInfo!==null&&r.afterWriteTickInfo.cb===n?r.afterWriteTickInfo.count++:(r.afterWriteTickInfo={count:1,cb:n,stream:t,state:r},cn.nextTick(l6,r.afterWriteTickInfo)):ox(t,r,1,n))}l(c6,"onwrite");function l6({stream:t,state:e,count:r,cb:i}){return e.afterWriteTickInfo=null,ox(t,e,r,i)}l(l6,"afterWriteTick");function ox(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),Xy(t,e)}l(ox,"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 gc("write"))}let r=t[mo].splice(0);for(let n=0;n<r.length;n++){var i;r[n]((i=t.errored)!==null&&i!==void 0?i:new gc("end"))}Zu(t)}l(Jy,"errorBuffer");function Ky(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?Gy:a=>{for(let u=o;u<r.length;++u)r[u].callback(a)},c=e.allNoop&&o===0?r:QO(r,o);c.allBuffers=e.allBuffers,YO(t,e,!0,e.length,c,"",f),Zu(e)}else{do{let{chunk:f,encoding:c,callback:a}=r[o];r[o++]=null;let u=n?1:f.length;YO(t,e,!1,u,f,c,a)}while(o<r.length&&!e.writing);o===r.length?Zu(e):o>256?(r.splice(0,o),e.bufferedIndex=0):e.bufferedIndex=o}e.bufferProcessing=!1}l(Ky,"clearBuffer");_e.prototype._write=function(t,e,r){if(this._writev)this._writev([{chunk:t,encoding:e}],r);else throw new r6("_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=sx(this,t,e);s instanceof VW&&(n=s)}return i.corked&&(i.corked=1,this.uncork()),n||(!i.errored&&!i.ending?(i.ending=!0,Xy(this,i,!0),i.ended=!0):i.finished?n=new n6("end"):i.destroyed&&(n=new gc("end"))),typeof r=="function"&&(n||i.finished?cn.nextTick(r,n):i[mo].push(r)),this};function Yu(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(Yu,"needFinish");function f6(t,e){let r=!1;function i(n){if(r){po(t,n??ix());return}if(r=!0,e.pendingcb--,n){let s=e[mo].splice(0);for(let o=0;o<s.length;o++)s[o](n);po(t,n,e.sync)}else Yu(e)&&(e.prefinished=!0,t.emit("prefinish"),e.pendingcb++,cn.nextTick(Vy,t,e))}l(i,"onFinish"),e.sync=!0,e.pendingcb++;try{t._final(i)}catch(n){i(n)}e.sync=!1}l(f6,"callFinal");function u6(t,e){!e.prefinished&&!e.finalCalled&&(typeof t._final=="function"&&!e.destroyed?(e.finalCalled=!0,f6(t,e)):(e.prefinished=!0,t.emit("prefinish")))}l(u6,"prefinish");function Xy(t,e,r){Yu(e)&&(u6(t,e),e.pendingcb===0&&(r?(e.pendingcb++,cn.nextTick((i,n)=>{Yu(n)?Vy(i,n):n.pendingcb--},t,e)):Yu(e)&&(e.pendingcb++,Vy(t,e))))}l(Xy,"finishMaybe");function Vy(t,e){e.pendingcb--,e.finished=!0;let r=e[mo].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(Vy,"finish");GW(_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 h6=Qu.destroy;_e.prototype.destroy=function(t,e){let r=this._writableState;return!r.destroyed&&(r.bufferedIndex<r.buffered.length||r[mo].length)&&cn.nextTick(Jy,r),h6.call(this,t,e),this};_e.prototype._undestroy=Qu.undestroy;_e.prototype._destroy=function(t,e){e(t)};_e.prototype[YW.captureRejectionSymbol]=function(t){this.destroy(t)};var Hy;function ax(){return Hy===void 0&&(Hy={}),Hy}l(ax,"lazyWebStreams");_e.fromWeb=function(t,e){return ax().newStreamWritableFromWritableStream(t,e)};_e.toWeb=function(t){return ax().newWritableStreamFromStreamWritable(t)}});var Ex=T((MX,vx)=>{var Yy=gi(),d6=ie("buffer"),{isReadable:p6,isWritable:m6,isIterable:lx,isNodeStream:w6,isReadableNodeStream:fx,isWritableNodeStream:ux,isDuplexNodeStream:y6,isReadableStream:hx,isWritableStream:dx}=gr(),px=Lr(),{AbortError:_x,codes:{ERR_INVALID_ARG_TYPE:g6,ERR_INVALID_RETURN_VALUE:mx}}=Ze(),{destroyer:yo}=on(),b6=_r(),Sx=wc(),_6=eh(),{createDeferredPromise:wx}=at(),yx=$y(),gx=globalThis.Blob||d6.Blob,S6=l(typeof gx<"u"?function(e){return e instanceof gx}:function(e){return!1},"isBlob"),v6=globalThis.AbortController||so().AbortController,{FunctionPrototypeCall:bx}=ye(),Zy=class Zy extends b6{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(Zy,"Duplexify");var Si=Zy;vx.exports=l(function t(e,r){if(y6(e))return e;if(fx(e))return wo({readable:e});if(ux(e))return wo({writable:e});if(w6(e))return wo({writable:!1,readable:!1});if(hx(e))return wo({readable:Sx.fromWeb(e)});if(dx(e))return wo({writable:_6.fromWeb(e)});if(typeof e=="function"){let{value:n,write:s,final:o,destroy:f}=E6(e);if(lx(n))return yx(Si,n,{objectMode:!0,write:s,final:o,destroy:f});let c=n?.then;if(typeof c=="function"){let a,u=bx(c,n,h=>{if(h!=null)throw new mx("nully","body",h)},h=>{yo(a,h)});return a=new Si({objectMode:!0,readable:!1,write:s,final(h){o(async()=>{try{await u,Yy.nextTick(h,null)}catch(d){Yy.nextTick(h,d)}})},destroy:f})}throw new mx("Iterable, AsyncIterable or AsyncFunction",r,n)}if(S6(e))return t(e.arrayBuffer());if(lx(e))return yx(Si,e,{objectMode:!0,writable:!1});if(hx(e?.readable)&&dx(e?.writable))return Si.fromWeb(e);if(typeof e?.writable=="object"||typeof e?.readable=="object"){let n=e!=null&&e.readable?fx(e?.readable)?e?.readable:t(e.readable):void 0,s=e!=null&&e.writable?ux(e?.writable)?e?.writable:t(e.writable):void 0;return wo({readable:n,writable:s})}let i=e?.then;if(typeof i=="function"){let n;return bx(i,e,s=>{s!=null&&n.push(s),n.push(null)},s=>{yo(n,s)}),n=new Si({objectMode:!0,writable:!1,read(){}})}throw new g6(r,["Blob","ReadableStream","WritableStream","Stream","Iterable","AsyncIterable","Function","{ readable, writable } pair","Promise"],e)},"duplexify");function E6(t){let{promise:e,resolve:r}=wx(),i=new v6,n=i.signal;return{value:t(async function*(){for(;;){let o=e;e=null;let{chunk:f,done:c,cb:a}=await o;if(Yy.nextTick(a),c)return;if(n.aborted)throw new _x(void 0,{cause:n.reason});({promise:e,resolve:r}=wx()),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(E6,"fromAsyncGen");function wo(t){let e=t.readable&&typeof t.readable.read!="function"?Sx.wrap(t.readable):t.readable,r=t.writable,i=!!p6(e),n=!!m6(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 Si({readableObjectMode:!!(e!=null&&e.readableObjectMode),writableObjectMode:!!(r!=null&&r.writableObjectMode),readable:i,writable:n}),n&&(px(r,h=>{n=!1,h&&yo(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&&(px(e,h=>{i=!1,h&&yo(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 _x),f=null,s=null,o=null,c===null?d(h):(c=d,yo(r,h),yo(e,h))},a}l(wo,"_duplexify")});var _r=T((jX,kx)=>{"use strict";var{ObjectDefineProperties:F6,ObjectGetOwnPropertyDescriptor:jr,ObjectKeys:T6,ObjectSetPrototypeOf:Fx}=ye();kx.exports=tr;var tg=wc(),Mt=eh();Fx(tr.prototype,tg.prototype);Fx(tr,tg);{let t=T6(Mt.prototype);for(let e=0;e<t.length;e++){let r=t[e];tr.prototype[r]||(tr.prototype[r]=Mt.prototype[r])}}function tr(t){if(!(this instanceof tr))return new tr(t);tg.call(this,t),Mt.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(tr,"Duplex");F6(tr.prototype,{writable:{__proto__:null,...jr(Mt.prototype,"writable")},writableHighWaterMark:{__proto__:null,...jr(Mt.prototype,"writableHighWaterMark")},writableObjectMode:{__proto__:null,...jr(Mt.prototype,"writableObjectMode")},writableBuffer:{__proto__:null,...jr(Mt.prototype,"writableBuffer")},writableLength:{__proto__:null,...jr(Mt.prototype,"writableLength")},writableFinished:{__proto__:null,...jr(Mt.prototype,"writableFinished")},writableCorked:{__proto__:null,...jr(Mt.prototype,"writableCorked")},writableEnded:{__proto__:null,...jr(Mt.prototype,"writableEnded")},writableNeedDrain:{__proto__:null,...jr(Mt.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 Qy;function Tx(){return Qy===void 0&&(Qy={}),Qy}l(Tx,"lazyWebStreams");tr.fromWeb=function(t,e){return Tx().newStreamDuplexFromReadableWritablePair(t,e)};tr.toWeb=function(t){return Tx().newReadableWritablePairFromDuplex(t)};var eg;tr.from=function(t){return eg||(eg=Ex()),eg(t,"body")}});var ng=T((UX,Ox)=>{"use strict";var{ObjectSetPrototypeOf:Rx,Symbol:k6}=ye();Ox.exports=qr;var{ERR_METHOD_NOT_IMPLEMENTED:R6}=Ze().codes,ig=_r(),{getHighWaterMark:O6}=dc();Rx(qr.prototype,ig.prototype);Rx(qr,ig);var _c=k6("kCallback");function qr(t){if(!(this instanceof qr))return new qr(t);let e=t?O6(this,t,"readableHighWaterMark",!0):null;e===0&&(t={...t,highWaterMark:null,readableHighWaterMark:e,writableHighWaterMark:t.writableHighWaterMark||0}),ig.call(this,t),this._readableState.sync=!1,this[_c]=null,t&&(typeof t.transform=="function"&&(this._transform=t.transform),typeof t.flush=="function"&&(this._flush=t.flush)),this.on("prefinish",x6)}l(qr,"Transform");function rg(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(rg,"final");function x6(){this._final!==rg&&rg.call(this)}l(x6,"prefinish");qr.prototype._final=rg;qr.prototype._transform=function(t,e,r){throw new R6("_transform()")};qr.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[_c]=r})};qr.prototype._read=function(){if(this[_c]){let t=this[_c];this[_c]=null,t()}}});var og=T((zX,Ax)=>{"use strict";var{ObjectSetPrototypeOf:xx}=ye();Ax.exports=go;var sg=ng();xx(go.prototype,sg.prototype);xx(go,sg);function go(t){if(!(this instanceof go))return new go(t);sg.call(this,t)}l(go,"PassThrough");go.prototype._transform=function(t,e,r){r(null,t)}});var nh=T((VX,Ix)=>{var Sc=gi(),{ArrayIsArray:A6,Promise:P6,SymbolAsyncIterator:N6,SymbolDispose:D6}=ye(),ih=Lr(),{once:C6}=at(),I6=on(),Px=_r(),{aggregateTwoErrors:$6,codes:{ERR_INVALID_ARG_TYPE:mg,ERR_INVALID_RETURN_VALUE:ag,ERR_MISSING_ARGS:B6,ERR_STREAM_DESTROYED:M6,ERR_STREAM_PREMATURE_CLOSE:L6},AbortError:j6}=Ze(),{validateFunction:q6,validateAbortSignal:U6}=ao(),{isIterable:ln,isReadable:cg,isReadableNodeStream:rh,isNodeStream:Nx,isTransformStream:bo,isWebStream:W6,isReadableStream:lg,isReadableFinished:z6}=gr(),H6=globalThis.AbortController||so().AbortController,fg,ug,hg;function Dx(t,e,r){let i=!1;t.on("close",()=>{i=!0});let n=ih(t,{readable:e,writable:r},s=>{i=!s});return{destroy:l(s=>{i||(i=!0,I6.destroyer(t,s||new M6("pipe")))},"destroy"),cleanup:n}}l(Dx,"destroyer");function V6(t){return q6(t[t.length-1],"streams[stream.length - 1]"),t.pop()}l(V6,"popCallback");function dg(t){if(ln(t))return t;if(rh(t))return G6(t);throw new mg("val",["Readable","Iterable","AsyncIterable"],t)}l(dg,"makeAsyncIterable");async function*G6(t){ug||(ug=wc()),yield*ug.prototype[N6].call(t)}l(G6,"fromReadable");async function th(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 P6((a,u)=>{n?u(n):s=l(()=>{n?u(n):a()},"onresolve")}),"wait");e.on("drain",o);let c=ih(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?$6(n,a):a)}finally{c(),e.off("drain",o)}}l(th,"pumpToNode");async function pg(t,e,r,{end:i}){bo(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(pg,"pumpToWeb");function J6(...t){return Cx(t,C6(V6(t)))}l(J6,"pipeline");function Cx(t,e,r){if(t.length===1&&A6(t[0])&&(t=t[0]),t.length<2)throw new B6("streams");let i=new H6,n=i.signal,s=r?.signal,o=[];U6(s,"options.signal");function f(){m(new j6)}l(f,"abort"),hg=hg||at().addAbortListener;let c;s&&(c=hg(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[D6](),i.abort(),E&&(a||o.forEach(D=>D()),Sc.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,D=F>0,S=R||r?.end!==!1,O=F===t.length-1;if(Nx(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}=Dx(E,R,D);h.push(A),cg(E)&&O&&o.push(x)}E.on("error",v),cg(E)&&O&&o.push(()=>{E.removeListener("error",v)})}if(F===0)if(typeof E=="function"){if(w=E({signal:n}),!ln(w))throw new ag("Iterable, AsyncIterable or Stream","source",w)}else ln(E)||rh(E)||bo(E)?w=E:w=Px.from(E);else if(typeof E=="function"){if(bo(w)){var y;w=dg((y=w)===null||y===void 0?void 0:y.readable)}else w=dg(w);if(w=E(w,{signal:n}),R){if(!ln(w,!0))throw new ag("AsyncIterable",`transform[${F-1}]`,w)}else{var b;fg||(fg=og());let v=new fg({objectMode:!0}),A=(b=w)===null||b===void 0?void 0:b.then;if(typeof A=="function")d++,A.call(w,M=>{u=M,M!=null&&v.write(M),S&&v.end(),Sc.nextTick(p)},M=>{v.destroy(M),Sc.nextTick(p,M)});else if(ln(w,!0))d++,th(w,v,p,{end:S});else if(lg(w)||bo(w)){let M=w.readable||w;d++,th(M,v,p,{end:S})}else throw new ag("AsyncIterable or Promise","destination",w);w=v;let{destroy:x,cleanup:I}=Dx(w,!1,!0);h.push(x),O&&o.push(I)}}else if(Nx(E)){if(rh(w)){d+=2;let v=K6(w,E,p,{end:S});cg(E)&&O&&o.push(v)}else if(bo(w)||lg(w)){let v=w.readable||w;d++,th(v,E,p,{end:S})}else if(ln(w))d++,th(w,E,p,{end:S});else throw new mg("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],w);w=E}else if(W6(E)){if(rh(w))d++,pg(dg(w),E,p,{end:S});else if(lg(w)||ln(w))d++,pg(w,E,p,{end:S});else if(bo(w))d++,pg(w.readable,E,p,{end:S});else throw new mg("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],w);w=E}else w=Px.from(E)}return(n!=null&&n.aborted||s!=null&&s.aborted)&&Sc.nextTick(f),w}l(Cx,"pipelineImpl");function K6(t,e,r,{end:i}){let n=!1;if(e.on("close",()=>{n||r(new L6)}),t.pipe(e,{end:!1}),i){let o=function(){n=!0,e.end()};var s=o;l(o,"endFn"),z6(t)?Sc.nextTick(o):t.once("end",o)}else r();return ih(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)}),ih(e,{readable:!1,writable:!0},r)}l(K6,"pipe");Ix.exports={pipelineImpl:Cx,pipeline:J6}});var yg=T((JX,qx)=>{"use strict";var{pipeline:X6}=nh(),sh=_r(),{destroyer:Y6}=on(),{isNodeStream:oh,isReadable:$x,isWritable:Bx,isWebStream:wg,isTransformStream:fn,isWritableStream:Mx,isReadableStream:Lx}=gr(),{AbortError:Z6,codes:{ERR_INVALID_ARG_VALUE:jx,ERR_MISSING_ARGS:Q6}}=Ze(),e4=Lr();qx.exports=l(function(...e){if(e.length===0)throw new Q6("streams");if(e.length===1)return sh.from(e[0]);let r=[...e];if(typeof e[0]=="function"&&(e[0]=sh.from(e[0])),typeof e[e.length-1]=="function"){let p=e.length-1;e[p]=sh.from(e[p])}for(let p=0;p<e.length;++p)if(!(!oh(e[p])&&!wg(e[p]))){if(p<e.length-1&&!($x(e[p])||Lx(e[p])||fn(e[p])))throw new jx(`streams[${p}]`,r[p],"must be readable");if(p>0&&!(Bx(e[p])||Mx(e[p])||fn(e[p])))throw new jx(`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=X6(e,c),h=!!(Bx(a)||Mx(a)||fn(a)),d=!!($x(u)||Lx(u)||fn(u));if(f=new sh({writableObjectMode:!!(a!=null&&a.writableObjectMode),readableObjectMode:!!(u!=null&&u.readableObjectMode),writable:h,readable:d}),h){if(oh(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(wg(a)){let w=(fn(a)?a.writable:a).getWriter();f._write=async function(y,b,_){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(b){y(b)}}}let p=fn(u)?u.readable:u;e4(p,()=>{if(n){let m=n;n=null,m()}})}if(d){if(oh(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(wg(u)){let m=(fn(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 Z6),s=null,i=null,n=null,o===null?m(p):(o=m,oh(u)&&Y6(u,p))},f},"compose")});var Yx=T((XX,_g)=>{"use strict";var t4=globalThis.AbortController||so().AbortController,{codes:{ERR_INVALID_ARG_VALUE:r4,ERR_INVALID_ARG_TYPE:vc,ERR_MISSING_ARGS:i4,ERR_OUT_OF_RANGE:n4},AbortError:Sr}=Ze(),{validateAbortSignal:un,validateInteger:Ux,validateObject:hn}=ao(),s4=ye().Symbol("kWeak"),o4=ye().Symbol("kResistStopPropagation"),{finished:a4}=Lr(),c4=yg(),{addAbortSignalNoValidate:l4}=hc(),{isWritable:f4,isNodeStream:u4}=gr(),{deprecate:h4}=at(),{ArrayPrototypePush:d4,Boolean:p4,MathFloor:Wx,Number:m4,NumberIsNaN:w4,Promise:zx,PromiseReject:Hx,PromiseResolve:y4,PromisePrototypeThen:Vx,Symbol:Jx}=ye(),ah=Jx("kEmpty"),Gx=Jx("kEof");function g4(t,e){if(e!=null&&hn(e,"options"),e?.signal!=null&&un(e.signal,"options.signal"),u4(t)&&!f4(t))throw new r4("stream",t,"must be writable");let r=c4(this,t);return e!=null&&e.signal&&l4(e.signal,r),r}l(g4,"compose");function ch(t,e){if(typeof t!="function")throw new vc("fn",["Function","AsyncFunction"],t);e!=null&&hn(e,"options"),e?.signal!=null&&un(e.signal,"options.signal");let r=1;e?.concurrency!=null&&(r=Wx(e.concurrency));let i=r-1;return e?.highWaterMark!=null&&(i=Wx(e.highWaterMark)),Ux(r,"options.concurrency",1),Ux(i,"options.highWaterMark",0),i+=r,l(async function*(){let s=at().AbortSignalAny([e?.signal].filter(p4)),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 b of o){if(h)return;if(s.aborted)throw new Sr;try{if(b=t(b,c),b===ah)continue;b=y4(b)}catch(_){b=Hx(_)}d+=1,Vx(b,m,p),f.push(b),a&&(a(),a=null),!h&&(f.length>=i||d>=r)&&await new zx(_=>{u=_})}f.push(Gx)}catch(b){let _=Hx(b);Vx(_,m,p),f.push(_)}finally{h=!0,a&&(a(),a=null)}}l(y,"pump"),y();try{for(;;){for(;f.length>0;){let b=await f[0];if(b===Gx)return;if(s.aborted)throw new Sr;b!==ah&&(yield b),f.shift(),w()}await new zx(b=>{a=b})}}finally{h=!0,u&&(u(),u=null)}},"map").call(this)}l(ch,"map");function b4(t=void 0){return t!=null&&hn(t,"options"),t?.signal!=null&&un(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(b4,"asIndexedPairs");async function Kx(t,e=void 0){for await(let r of bg.call(this,t,e))return!0;return!1}l(Kx,"some");async function _4(t,e=void 0){if(typeof t!="function")throw new vc("fn",["Function","AsyncFunction"],t);return!await Kx.call(this,async(...r)=>!await t(...r),e)}l(_4,"every");async function S4(t,e){for await(let r of bg.call(this,t,e))return r}l(S4,"find");async function v4(t,e){if(typeof t!="function")throw new vc("fn",["Function","AsyncFunction"],t);async function r(i,n){return await t(i,n),ah}l(r,"forEachFn");for await(let i of ch.call(this,r,e));}l(v4,"forEach");function bg(t,e){if(typeof t!="function")throw new vc("fn",["Function","AsyncFunction"],t);async function r(i,n){return await t(i,n)?i:ah}return l(r,"filterFn"),ch.call(this,r,e)}l(bg,"filter");var Sg=class Sg extends i4{constructor(){super("reduce"),this.message="Reduce of an empty stream requires an initial value"}};l(Sg,"ReduceAwareErrMissingArgs");var gg=Sg;async function E4(t,e,r){var i;if(typeof t!="function")throw new vc("reducer",["Function","AsyncFunction"],t);r!=null&&hn(r,"options"),r?.signal!=null&&un(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 a4(this.destroy(a)),a}let s=new t4,o=s.signal;if(r!=null&&r.signal){let a={once:!0,[s4]:this,[o4]:!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 gg}finally{s.abort()}return e}l(E4,"reduce");async function F4(t){t!=null&&hn(t,"options"),t?.signal!=null&&un(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});d4(e,i)}return e}l(F4,"toArray");function T4(t,e){let r=ch.call(this,t,e);return l(async function*(){for await(let n of r)yield*n},"flatMap").call(this)}l(T4,"flatMap");function Xx(t){if(t=m4(t),w4(t))return 0;if(t<0)throw new n4("number",">= 0",t);return t}l(Xx,"toIntegerOrInfinity");function k4(t,e=void 0){return e!=null&&hn(e,"options"),e?.signal!=null&&un(e.signal,"options.signal"),t=Xx(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(k4,"drop");function R4(t,e=void 0){return e!=null&&hn(e,"options"),e?.signal!=null&&un(e.signal,"options.signal"),t=Xx(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(R4,"take");_g.exports.streamReturningOperators={asIndexedPairs:h4(b4,"readable.asIndexedPairs will be removed in a future version."),drop:k4,filter:bg,flatMap:T4,map:ch,take:R4,compose:g4};_g.exports.promiseReturningOperators={every:_4,forEach:v4,reduce:E4,toArray:F4,some:Kx,find:S4}});var vg=T((ZX,Zx)=>{"use strict";var{ArrayPrototypePop:O4,Promise:x4}=ye(),{isIterable:A4,isNodeStream:P4,isWebStream:N4}=gr(),{pipelineImpl:D4}=nh(),{finished:C4}=Lr();Eg();function I4(...t){return new x4((e,r)=>{let i,n,s=t[t.length-1];if(s&&typeof s=="object"&&!P4(s)&&!A4(s)&&!N4(s)){let o=O4(t);i=o.signal,n=o.end}D4(t,(o,f)=>{o?r(o):e(f)},{signal:i,end:n})})}l(I4,"pipeline");Zx.exports={finished:C4,pipeline:I4}});var Eg=T((eY,aA)=>{"use strict";var{Buffer:$4}=ie("buffer"),{ObjectDefineProperty:Ur,ObjectKeys:tA,ReflectApply:rA}=ye(),{promisify:{custom:iA}}=at(),{streamReturningOperators:Qx,promiseReturningOperators:eA}=Yx(),{codes:{ERR_ILLEGAL_CONSTRUCTOR:nA}}=Ze(),B4=yg(),{setDefaultHighWaterMark:M4,getDefaultHighWaterMark:L4}=dc(),{pipeline:sA}=nh(),{destroyer:j4}=on(),oA=Lr(),Fg=vg(),Ec=gr(),pe=aA.exports=Uu().Stream;pe.isDestroyed=Ec.isDestroyed;pe.isDisturbed=Ec.isDisturbed;pe.isErrored=Ec.isErrored;pe.isReadable=Ec.isReadable;pe.isWritable=Ec.isWritable;pe.Readable=wc();for(let t of tA(Qx)){let r=function(...i){if(new.target)throw nA();return pe.Readable.from(rA(e,this,i))};l(r,"fn");let e=Qx[t];Ur(r,"name",{__proto__:null,value:e.name}),Ur(r,"length",{__proto__:null,value:e.length}),Ur(pe.Readable.prototype,t,{__proto__:null,value:r,enumerable:!1,configurable:!0,writable:!0})}for(let t of tA(eA)){let r=function(...i){if(new.target)throw nA();return rA(e,this,i)};l(r,"fn");let e=eA[t];Ur(r,"name",{__proto__:null,value:e.name}),Ur(r,"length",{__proto__:null,value:e.length}),Ur(pe.Readable.prototype,t,{__proto__:null,value:r,enumerable:!1,configurable:!0,writable:!0})}pe.Writable=eh();pe.Duplex=_r();pe.Transform=ng();pe.PassThrough=og();pe.pipeline=sA;var{addAbortSignal:q4}=hc();pe.addAbortSignal=q4;pe.finished=oA;pe.destroy=j4;pe.compose=B4;pe.setDefaultHighWaterMark=M4;pe.getDefaultHighWaterMark=L4;Ur(pe,"promises",{__proto__:null,configurable:!0,enumerable:!0,get(){return Fg}});Ur(sA,iA,{__proto__:null,enumerable:!0,get(){return Fg.pipeline}});Ur(oA,iA,{__proto__:null,enumerable:!0,get(){return Fg.finished}});pe.Stream=pe;pe._isUint8Array=l(function(e){return e instanceof Uint8Array},"isUint8Array");pe._uint8ArrayToBuffer=l(function(e){return $4.from(e.buffer,e.byteOffset,e.byteLength)},"_uint8ArrayToBuffer")});var cA=T((rY,X)=>{"use strict";var Ie=ie("stream");if(Ie&&process.env.READABLE_STREAM==="disable"){let t=Ie.promises;X.exports._uint8ArrayToBuffer=Ie._uint8ArrayToBuffer,X.exports._isUint8Array=Ie._isUint8Array,X.exports.isDisturbed=Ie.isDisturbed,X.exports.isErrored=Ie.isErrored,X.exports.isReadable=Ie.isReadable,X.exports.Readable=Ie.Readable,X.exports.Writable=Ie.Writable,X.exports.Duplex=Ie.Duplex,X.exports.Transform=Ie.Transform,X.exports.PassThrough=Ie.PassThrough,X.exports.addAbortSignal=Ie.addAbortSignal,X.exports.finished=Ie.finished,X.exports.destroy=Ie.destroy,X.exports.pipeline=Ie.pipeline,X.exports.compose=Ie.compose,Object.defineProperty(Ie,"promises",{configurable:!0,enumerable:!0,get(){return t}}),X.exports.Stream=Ie.Stream}else{let t=Eg(),e=vg(),r=t.Readable.destroy;X.exports=t.Readable,X.exports._uint8ArrayToBuffer=t._uint8ArrayToBuffer,X.exports._isUint8Array=t._isUint8Array,X.exports.isDisturbed=t.isDisturbed,X.exports.isErrored=t.isErrored,X.exports.isReadable=t.isReadable,X.exports.Readable=t.Readable,X.exports.Writable=t.Writable,X.exports.Duplex=t.Duplex,X.exports.Transform=t.Transform,X.exports.PassThrough=t.PassThrough,X.exports.addAbortSignal=t.addAbortSignal,X.exports.finished=t.finished,X.exports.destroy=t.destroy,X.exports.destroy=r,X.exports.pipeline=t.pipeline,X.exports.compose=t.compose,Object.defineProperty(t,"promises",{configurable:!0,enumerable:!0,get(){return e}}),X.exports.Stream=t.Stream}X.exports.default=X.exports});var ir=T(No=>{"use strict";Object.defineProperty(No,"__esModule",{value:!0});No.constants=No.SEP=void 0;No.SEP="/";No.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 Bg=T(Oc=>{"use strict";Object.defineProperty(Oc,"__esModule",{value:!0});Oc.Stats=void 0;var m3=ir(),{S_IFMT:w3,S_IFDIR:y3,S_IFREG:g3,S_IFBLK:b3,S_IFCHR:_3,S_IFLNK:S3,S_IFIFO:v3,S_IFSOCK:E3}=m3.constants,Oh=class Oh{static build(e,r=!1){let i=new Oh,{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)&w3)===e}isDirectory(){return this._checkModeProperty(y3)}isFile(){return this._checkModeProperty(g3)}isBlockDevice(){return this._checkModeProperty(b3)}isCharacterDevice(){return this._checkModeProperty(_3)}isSymbolicLink(){return this._checkModeProperty(S3)}isFIFO(){return this._checkModeProperty(v3)}isSocket(){return this._checkModeProperty(E3)}};l(Oh,"Stats");var Rh=Oh;Oc.Stats=Rh;Oc.default=Rh});var zA=T(xh=>{"use strict";Object.defineProperty(xh,"__esModule",{value:!0});xh.Buffer=void 0;var F3=ie("node:buffer");Object.defineProperty(xh,"Buffer",{enumerable:!0,get:l(function(){return F3.Buffer},"get")})});var Fi=T(Ei=>{"use strict";Object.defineProperty(Ei,"__esModule",{value:!0});Ei.bufferFrom=Ei.bufferAllocUnsafe=Ei.Buffer=void 0;var Ah=zA();Object.defineProperty(Ei,"Buffer",{enumerable:!0,get:l(function(){return Ah.Buffer},"get")});function HA(t,...e){return new Ah.Buffer(t,...e)}l(HA,"bufferV0P12Ponyfill");var T3=Ah.Buffer.allocUnsafe||HA;Ei.bufferAllocUnsafe=T3;var k3=Ah.Buffer.from||HA;Ei.bufferFrom=k3});var Lg=T(Do=>{"use strict";Object.defineProperty(Do,"__esModule",{value:!0});Do.inherits=R3;Do.promisify=O3;Do.inspect=Mg;Do.format=x3;function R3(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(R3,"inherits");function O3(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(O3,"promisify");function Mg(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=>Mg(r)).join(", ")} ]`:typeof t=="object"?`{ ${Object.entries(t).map(([r,i])=>`${r}: ${Mg(i)}`).join(", ")} }`:String(t)}l(Mg,"inspect");function x3(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(x3,"format")});var xc=T(tt=>{"use strict";Object.defineProperty(tt,"__esModule",{value:!0});tt.AssertionError=tt.RangeError=tt.TypeError=tt.Error=void 0;tt.message=JA;tt.E=Ti;var jg=Lg(),VA=typeof Symbol>"u"?"_kCode":Symbol("code"),GA={};function Ug(t){var e;return e=class extends t{constructor(i,...n){super(JA(i,n)),this.code=i,this[VA]=i,this.name=`${super.name} [${this[VA]}]`}},l(e,"NodeError"),e}l(Ug,"makeNodeError");var Ph=globalThis,Wg=class Wg extends Ph.Error{constructor(e){if(typeof e!="object"||e===null)throw new tt.TypeError("ERR_INVALID_ARG_TYPE","options","object");e.message?super(e.message):super(`${(0,jg.inspect)(e.actual).slice(0,128)} ${e.operator} ${(0,jg.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,tt.Error.captureStackTrace(this,e.stackStartFunction)}};l(Wg,"AssertionError");var qg=Wg;tt.AssertionError=qg;function JA(t,e){if(typeof t!="string")throw new tt.Error("Error message key must be a string");let r=GA[t];if(!r)throw new tt.Error(`An invalid error message key was used: ${t}.`);let i;if(typeof r=="function")i=r;else{if(i=jg.format,e===void 0||e.length===0)return r;e.unshift(r)}return String(i.apply(null,e))}l(JA,"message");function Ti(t,e){GA[t]=typeof e=="function"?e:String(e)}l(Ti,"E");tt.Error=Ug(Ph.Error);tt.TypeError=Ug(Ph.TypeError);tt.RangeError=Ug(Ph.RangeError);Ti("ERR_DIR_CLOSED","Directory handle was closed");Ti("ERR_DIR_CONCURRENT_OPERATION","Cannot do synchronous work on directory handle with concurrent asynchronous operations");Ti("ERR_INVALID_FILE_URL_HOST",'File URL host must be "localhost" or empty on %s');Ti("ERR_INVALID_FILE_URL_PATH","File URL path %s");Ti("ERR_INVALID_OPT_VALUE",(t,e)=>`The value "${String(e)}" is invalid for option "${t}"`);Ti("ERR_INVALID_OPT_VALUE_ENCODING",t=>`The value "${String(t)}" is invalid for option "encoding"`);Ti("ERR_INVALID_ARG_VALUE","Unable to open file as blob")});var Ac=T(yn=>{"use strict";Object.defineProperty(yn,"__esModule",{value:!0});yn.ENCODING_UTF8=void 0;yn.assertEncoding=P3;yn.strToEncoding=N3;var zg=Fi(),A3=xc();yn.ENCODING_UTF8="utf8";function P3(t){if(t&&!zg.Buffer.isEncoding(t))throw new A3.TypeError("ERR_INVALID_OPT_VALUE_ENCODING",t)}l(P3,"assertEncoding");function N3(t,e){return!e||e===yn.ENCODING_UTF8?t:e==="buffer"?new zg.Buffer(t):new zg.Buffer(t).toString(e)}l(N3,"strToEncoding")});var Ch=T(Pc=>{"use strict";Object.defineProperty(Pc,"__esModule",{value:!0});Pc.Dirent=void 0;var D3=ir(),C3=Ac(),{S_IFMT:I3,S_IFDIR:$3,S_IFREG:B3,S_IFBLK:M3,S_IFCHR:L3,S_IFLNK:j3,S_IFIFO:q3,S_IFSOCK:U3}=D3.constants,Dh=class Dh{constructor(){this.name="",this.path="",this.parentPath="",this.mode=0}static build(e,r){let i=new Dh,{mode:n}=e.getNode();return i.name=(0,C3.strToEncoding)(e.getName(),r),i.mode=n,i.path=e.getParentPath(),i.parentPath=i.path,i}_checkModeProperty(e){return(this.mode&I3)===e}isDirectory(){return this._checkModeProperty($3)}isFile(){return this._checkModeProperty(B3)}isBlockDevice(){return this._checkModeProperty(M3)}isCharacterDevice(){return this._checkModeProperty(L3)}isSymbolicLink(){return this._checkModeProperty(j3)}isFIFO(){return this._checkModeProperty(q3)}isSocket(){return this._checkModeProperty(U3)}};l(Dh,"Dirent");var Nh=Dh;Pc.Dirent=Nh;Pc.default=Nh});var Co=T(xe=>{"use strict";Object.defineProperty(xe,"__esModule",{value:!0});xe.basename=xe.isAbsolute=xe.normalize=xe.dirname=xe.relative=xe.join=xe.posix=xe.sep=xe.resolve=void 0;var zr=ie("node:path");Object.defineProperty(xe,"resolve",{enumerable:!0,get:l(function(){return zr.resolve},"get")});Object.defineProperty(xe,"sep",{enumerable:!0,get:l(function(){return zr.sep},"get")});Object.defineProperty(xe,"posix",{enumerable:!0,get:l(function(){return zr.posix},"get")});Object.defineProperty(xe,"join",{enumerable:!0,get:l(function(){return zr.join},"get")});Object.defineProperty(xe,"relative",{enumerable:!0,get:l(function(){return zr.relative},"get")});Object.defineProperty(xe,"dirname",{enumerable:!0,get:l(function(){return zr.dirname},"get")});Object.defineProperty(xe,"normalize",{enumerable:!0,get:l(function(){return zr.normalize},"get")});Object.defineProperty(xe,"isAbsolute",{enumerable:!0,get:l(function(){return zr.isAbsolute},"get")});Object.defineProperty(xe,"basename",{enumerable:!0,get:l(function(){return zr.basename},"get")})});var XA=T(KA=>{"use strict";Object.defineProperty(KA,"__esModule",{value:!0})});var Vg=T(Ih=>{"use strict";Object.defineProperty(Ih,"__esModule",{value:!0});Ih.flattenJSON=void 0;var YA=Fi(),Hg=Co(),W3=Hg.posix?Hg.posix.join:Hg.join,z3=l(t=>{let e={};function r(i,n){for(let s in n){let o=n[s],f=W3(i,s);typeof o=="string"||o instanceof YA.Buffer?e[f]=o:typeof o=="object"&&o!==null&&!(o instanceof YA.Buffer)&&Object.keys(o).length>0?r(f,o):e[f]=null}}return l(r,"flatten"),r("",t),e},"flattenJSON");Ih.flattenJSON=z3});var Bh=T($h=>{"use strict";Object.defineProperty($h,"__esModule",{value:!0});$h.createProcess=ZA;var H3=l(()=>{if(typeof process<"u")return process;try{return ie("process")}catch{return}},"maybeReturnProcess");function ZA(){let t=H3()||{};return t.cwd||(t.cwd=()=>"/"),t.emitWarning||(t.emitWarning=(e,r)=>{console.warn(`${r}${r?": ":""}${e}`)}),t.env||(t.env={}),t}l(ZA,"createProcess");$h.default=ZA()});var Kg=T(jh=>{"use strict";Object.defineProperty(jh,"__esModule",{value:!0});jh.Node=void 0;var V3=aa(),tP=Bh(),Vr=Fi(),G3=ir(),{S_IFMT:Hr,S_IFDIR:J3,S_IFREG:K3,S_IFLNK:QA,S_IFCHR:X3}=G3.constants,Mh=l(()=>tP.default.getuid?.()??0,"getuid"),Lh=l(()=>tP.default.getgid?.()??0,"getgid"),eP=(0,Vr.bufferAllocUnsafe)(0),Jg=class Jg{constructor(e,r=438){this.changes=new V3.FanOut,this._uid=Mh(),this._gid=Lh(),this._atime=new Date,this._mtime=new Date,this._ctime=new Date,this.buf=eP,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)===K3}isDirectory(){return(this.mode&Hr)===J3}isSymlink(){return(this.mode&Hr)===QA}isCharacterDevice(){return(this.mode&Hr)===X3}makeSymlink(e){this.mode=QA|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=eP,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=Mh(),r=Lh()){return!!(this.perm&4||r===this.gid&&this.perm&32||e===this.uid&&this.perm&256)}canWrite(e=Mh(),r=Lh()){return!!(this.perm&2||r===this.gid&&this.perm&16||e===this.uid&&this.perm&128)}canExecute(e=Mh(),r=Lh()){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(Jg,"Node");var Gg=Jg;jh.Node=Gg});var Yg=T(qh=>{"use strict";Object.defineProperty(qh,"__esModule",{value:!0});qh.Link=void 0;var Y3=ir(),Z3=aa(),{S_IFREG:Q3}=Y3.constants,Nc=class Nc{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 Z3.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(Q3|438)){let i=new Nc(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 Nc(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(Nc,"Link");var Xg=Nc;qh.Link=Xg});var e0=T(Uh=>{"use strict";Object.defineProperty(Uh,"__esModule",{value:!0});Uh.File=void 0;var ez=ir(),{O_APPEND:tz}=ez.constants,Qg=class Qg{constructor(e,r,i,n){this.link=e,this.node=r,this.flags=i,this.fd=n,this.position=0,this.flags&tz&&(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(Qg,"File");var Zg=Qg;Uh.File=Zg});var Bo=T($o=>{"use strict";Object.defineProperty($o,"__esModule",{value:!0});$o.FLAGS=$o.ERRSTR=void 0;var rz=ir();$o.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:rP,O_WRONLY:Wh,O_RDWR:Io,O_CREAT:ki,O_EXCL:zh,O_TRUNC:Hh,O_APPEND:Vh,O_SYNC:iP}=rz.constants,nP;(function(t){t[t.r=rP]="r",t[t["r+"]=Io]="r+",t[t.rs=rP|iP]="rs",t[t.sr=t.rs]="sr",t[t["rs+"]=Io|iP]="rs+",t[t["sr+"]=t["rs+"]]="sr+",t[t.w=Wh|ki|Hh]="w",t[t.wx=Wh|ki|Hh|zh]="wx",t[t.xw=t.wx]="xw",t[t["w+"]=Io|ki|Hh]="w+",t[t["wx+"]=Io|ki|Hh|zh]="wx+",t[t["xw+"]=t["wx+"]]="xw+",t[t.a=Wh|Vh|ki]="a",t[t.ax=Wh|Vh|ki|zh]="ax",t[t.xa=t.ax]="xa",t[t["a+"]=Io|Vh|ki]="a+",t[t["ax+"]=Io|Vh|ki|zh]="ax+",t[t["xa+"]=t["ax+"]]="xa+"})(nP||($o.FLAGS=nP={}))});var r0=T(t0=>{"use strict";Object.defineProperty(t0,"__esModule",{value:!0});t0.default=typeof queueMicrotask=="function"?queueMicrotask:t=>Promise.resolve().then(()=>t()).catch(()=>{})});var Xh=T(je=>{"use strict";Object.defineProperty(je,"__esModule",{value:!0});je.filenameToSteps=je.resolve=je.unixify=je.isWin=void 0;je.isFd=oP;je.validateFd=hz;je.dataToBuffer=dz;var Jh=Co(),Gh=Fi(),sP=Bh(),iz=Ac(),nz=Bo();je.isWin=sP.default.platform==="win32";var sz=Jh.resolve,oz=Jh.posix?Jh.posix.sep:Jh.sep,az=l((t,e)=>{let r=t[e];return e>0&&(r==="/"||je.isWin&&r==="\\")},"isSeparator"),cz=l(t=>{let e=t.length-1;if(e<2)return t;for(;az(t,e);)e--;return t.substr(0,e+1)},"removeTrailingSeparator"),lz=l((t,e)=>{if(typeof t!="string")throw new TypeError("expected a string");return t=t.replace(/[\\\/]+/g,"/"),e!==!1&&(t=cz(t)),t},"normalizePath"),fz=l((t,e=!0)=>je.isWin?(t=lz(t,e),t.replace(/^([a-zA-Z]+:|\.\/)/,"")):t,"unixify");je.unixify=fz;var Kh=l((t,e=sP.default.cwd())=>sz(e,t),"resolve");je.resolve=Kh;if(je.isWin){let t=Kh;je.resolve=Kh=l((e,r)=>(0,je.unixify)(t(e,r)),"resolve")}var uz=l((t,e)=>{let i=Kh(t,e).substring(1);return i?i.split(oz):[]},"filenameToSteps");je.filenameToSteps=uz;function oP(t){return t>>>0===t}l(oP,"isFd");function hz(t){if(!oP(t))throw TypeError(nz.ERRSTR.FD)}l(hz,"validateFd");function dz(t,e=iz.ENCODING_UTF8){return Gh.Buffer.isBuffer(t)?t:t instanceof Uint8Array?(0,Gh.bufferFrom)(t):e==="buffer"?(0,Gh.bufferFrom)(String(t),"utf8"):(0,Gh.bufferFrom)(String(t),e)}l(dz,"dataToBuffer")});var Ri=T($e=>{"use strict";Object.defineProperty($e,"__esModule",{value:!0});$e.getWriteSyncArgs=$e.getWriteArgs=$e.bufToUint8=void 0;$e.promisify=mz;$e.validateCallback=aP;$e.modeToNumber=cP;$e.nullCheck=lP;$e.pathToFilename=gz;$e.createError=Cz;$e.genRndStr6=Iz;$e.flagsToNumber=$z;$e.streamToBuffer=Bz;$e.bufferToEncoding=qz;$e.isReadableStream=Uz;var Dc=Bo(),i0=xc(),n0=Fi(),pz=r0(),Yh=Xh();function mz(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(mz,"promisify");function aP(t){if(typeof t!="function")throw TypeError(Dc.ERRSTR.CB);return t}l(aP,"validateCallback");function wz(t,e){if(typeof t=="number")return t;if(typeof t=="string")return parseInt(t,8);if(e)return cP(e)}l(wz,"_modeToNumber");function cP(t,e){let r=wz(t,e);if(typeof r!="number"||isNaN(r))throw new TypeError(Dc.ERRSTR.MODE_INT);return r}l(cP,"modeToNumber");function lP(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,pz.default)(()=>{e(r)}),!1}return!0}l(lP,"nullCheck");function yz(t){if(t.hostname!=="")throw new i0.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 i0.TypeError("ERR_INVALID_FILE_URL_PATH","must not include encoded / characters")}return decodeURIComponent(e)}l(yz,"getPathFromURLPosix");function gz(t){if(t instanceof Uint8Array&&(t=(0,n0.bufferFrom)(t)),typeof t!="string"&&!n0.Buffer.isBuffer(t)){try{if(!(t instanceof ie("url").URL))throw new TypeError(Dc.ERRSTR.PATH_STR)}catch{throw new TypeError(Dc.ERRSTR.PATH_STR)}t=yz(t)}let e=String(t);return lP(e),e}l(gz,"pathToFilename");var bz="ENOENT",_z="EBADF",Sz="EINVAL",vz="EPERM",Ez="EPROTO",Fz="EEXIST",Tz="ENOTDIR",kz="EMFILE",Rz="EACCES",Oz="EISDIR",xz="ENOTEMPTY",Az="ENOSYS",Pz="ERR_FS_EISDIR",Nz="ERR_OUT_OF_RANGE";function Dz(t,e="",r="",i=""){let n="";switch(r&&(n=` '${r}'`),i&&(n+=` -> '${i}'`),t){case bz:return`ENOENT: no such file or directory, ${e}${n}`;case _z:return`EBADF: bad file descriptor, ${e}${n}`;case Sz:return`EINVAL: invalid argument, ${e}${n}`;case vz:return`EPERM: operation not permitted, ${e}${n}`;case Ez:return`EPROTO: protocol error, ${e}${n}`;case Fz:return`EEXIST: file already exists, ${e}${n}`;case Tz:return`ENOTDIR: not a directory, ${e}${n}`;case Oz:return`EISDIR: illegal operation on a directory, ${e}${n}`;case Rz:return`EACCES: permission denied, ${e}${n}`;case xz:return`ENOTEMPTY: directory not empty, ${e}${n}`;case kz:return`EMFILE: too many open files, ${e}${n}`;case Az:return`ENOSYS: function not implemented, ${e}${n}`;case Pz:return`[ERR_FS_EISDIR]: Path is a directory: ${e} returned EISDIR (is a directory) ${r}`;case Nz:return`[ERR_OUT_OF_RANGE]: value out of range, ${e}${n}`;default:return`${t}: error occurred, ${e}${n}`}}l(Dz,"formatError");function Cz(t,e="",r="",i="",n=Error){let s=new n(Dz(t,e,r,i));return s.code=t,r&&(s.path=r),s}l(Cz,"createError");function Iz(){return Math.random().toString(36).slice(2,8).padEnd(6,"0")}l(Iz,"genRndStr6");function $z(t){if(typeof t=="number")return t;if(typeof t=="string"){let e=Dc.FLAGS[t];if(typeof e<"u")return e}throw new i0.TypeError("ERR_INVALID_OPT_VALUE","flags",t)}l($z,"flagsToNumber");function Bz(t){let e=[];return new Promise((r,i)=>{t.on("data",n=>e.push(n)),t.on("end",()=>r(n0.Buffer.concat(e))),t.on("error",i)})}l(Bz,"streamToBuffer");var Mz=l(t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),"bufToUint8");$e.bufToUint8=Mz;var Lz=l((t,e,r,i,n,s)=>{(0,Yh.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,Yh.dataToBuffer)(e,a);h!=="string"?typeof f>"u"&&(f=w.length):(o=0,f=w.length);let y=aP(u);return[t,h==="string",w,o,f,c,y]},"getWriteArgs");$e.getWriteArgs=Lz;var jz=l((t,e,r,i,n)=>{(0,Yh.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,Yh.dataToBuffer)(e,s);return a?typeof f>"u"&&(f=u.length):(o=0,f=u.length),[t,u,o||0,f,c]},"getWriteSyncArgs");$e.getWriteSyncArgs=jz;function qz(t,e){return!e||e==="buffer"?t:t.toString(e)}l(qz,"bufferToEncoding");function Uz(t){return t!==null&&typeof t=="object"&&typeof t.pipe=="function"&&typeof t.on=="function"&&t.readable===!0}l(Uz,"isReadableStream")});var mP=T(ed=>{"use strict";Object.defineProperty(ed,"__esModule",{value:!0});ed.Superblock=void 0;var qe=Co(),Wz=Kg(),fP=Yg(),zz=e0(),Hz=Fi(),uP=Bh(),Tr=ir(),hP=Bo(),J=Ri(),nr=Xh(),Vz=Vg(),Mo=qe.posix?qe.posix.sep:qe.sep,dP=qe.posix?qe.posix.relative:qe.relative,Gz=qe.posix?qe.posix.join:qe.join,{O_RDONLY:s0,O_WRONLY:Zh,O_RDWR:o0,O_CREAT:pP,O_EXCL:Jz,O_TRUNC:Kz,O_APPEND:Xz,O_DIRECTORY:Yz}=Tr.constants,Lo=class Lo{static fromJSON(e,r){let i=new Lo;return i.fromJSON(e,r),i}static fromNestedJSON(e,r){let i=new Lo;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&Xz?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,qe.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,qe.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,nr.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,qe.basename)(n);s.name=u,s.steps=[...o.steps,u],o.setChild(s.getName(),s)},this.mkdir=(i,n)=>{let s=(0,nr.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(Tr.constants.S_IFDIR|n))},this.mkdirp=(i,n)=>{let s=!1,o=(0,nr.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(qe.sep+o.slice(0,c).join(qe.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(Tr.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,nr.validateFd)(i);let n=this.getFileByFdOrThrow(i,"close");this.closeFile(n)};let r=this.createLink();r.setNode(this.createNode(Tr.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 fP.Link(this,void 0,"");if(!r)throw new Error("createLink: name cannot be empty");let s=n??(i?511:438),f=n&&n&Tr.constants.S_IFMT?n&Tr.constants.S_IFMT:i?Tr.constants.S_IFDIR:Tr.constants.S_IFREG,c=s&~Tr.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:Lo.fd--}createNode(e){let r=new Wz.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 fP.Link?(o=e.steps,f=Mo+o.join(Mo)):typeof e=="string"?(o=(0,nr.filenameToSteps)(e),f=e):(o=e,f=Mo+o.join(Mo));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,qe.isAbsolute)(u.symlink)?u.symlink:Gz((0,qe.dirname)(c.getPath()),u.symlink);o=(0,nr.filenameToSteps)(h).concat(o.slice(a+1)),c=this.root,a=0;continue}if(i&&!u.isDirectory()&&a<o.length-1){let h=uP.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,nr.filenameToSteps)(e)).slice(0,-1),n=Mo+i.join(Mo),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,nr.isFd)(e))throw TypeError(hP.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=dP(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=dP(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=uP.default.cwd()){for(let i in e){let n=e[i];if(i=(0,nr.resolve)(i,r),typeof n=="string"||n instanceof Hz.Buffer){let s=(0,qe.dirname)(i);this.mkdirp(s,511);let o=(0,nr.dataToBuffer)(n);this.writeFile(i,o,hP.FLAGS.w,438)}else this.mkdirp(i,511)}}fromNestedJSON(e,r){this.fromJSON((0,Vz.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(Tr.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&(s0|o0|Zh))!==s0)throw(0,J.createError)("EISDIR","open",e.getPath())}else if(r&Yz)throw(0,J.createError)("ENOTDIR","open",e.getPath());if((r&(s0|o0|Zh))!==Zh&&!s.canRead()||r&(Zh|o0)&&!s.canWrite())throw(0,J.createError)("EACCES","open",e.getPath());let o=new zz.File(e,s,r,this.newFdNumber());return this.fds[o.fd]=o,this.openFiles++,r&Kz&&o.truncate(),o}openFile(e,r,i,n=!0){let s=(0,nr.filenameToSteps)(e),o;try{if(o=n?this.getResolvedLinkOrThrow(e,"open"):this.getLinkOrThrow(e,"open"),o&&r&pP&&r&Jz)throw(0,J.createError)("EEXIST","open",e)}catch(f){if(f.code==="ENOENT"&&r&pP){let c=(0,qe.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(Lo,"Superblock");var Qh=Lo;ed.Superblock=Qh;Qh.fd=2147483647});var yP=T(qt=>{"use strict";Object.defineProperty(qt,"__esModule",{value:!0});qt.Superblock=qt.File=qt.Link=qt.Node=void 0;var wP=(nl(),Od(il));wP.__exportStar(XA(),qt);wP.__exportStar(Vg(),qt);var Zz=Kg();Object.defineProperty(qt,"Node",{enumerable:!0,get:l(function(){return Zz.Node},"get")});var Qz=Yg();Object.defineProperty(qt,"Link",{enumerable:!0,get:l(function(){return Qz.Link},"get")});var eH=e0();Object.defineProperty(qt,"File",{enumerable:!0,get:l(function(){return eH.File},"get")});var tH=mP();Object.defineProperty(qt,"Superblock",{enumerable:!0,get:l(function(){return tH.Superblock},"get")})});var gP=T(Cc=>{"use strict";Object.defineProperty(Cc,"__esModule",{value:!0});Cc.StatFs=void 0;var rd=class rd{static build(e,r=!1){let i=new rd,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(rd,"StatFs");var td=rd;Cc.StatFs=td;Cc.default=td});var bP=T(a0=>{"use strict";Object.defineProperty(a0,"__esModule",{value:!0});function rH(t,e,r){let i=setTimeout.apply(globalThis,arguments);return i&&typeof i=="object"&&typeof i.unref=="function"&&i.unref(),i}l(rH,"setTimeoutUnref");a0.default=rH});var SP=T(jo=>{"use strict";Object.defineProperty(jo,"__esModule",{value:!0});jo.Writable=jo.Readable=void 0;var _P=ie("node:stream");Object.defineProperty(jo,"Readable",{enumerable:!0,get:l(function(){return _P.Readable},"get")});Object.defineProperty(jo,"Writable",{enumerable:!0,get:l(function(){return _P.Writable},"get")})});var c0=T(id=>{"use strict";Object.defineProperty(id,"__esModule",{value:!0});id.EventEmitter=void 0;var iH=ie("node:events");Object.defineProperty(id,"EventEmitter",{enumerable:!0,get:l(function(){return iH.EventEmitter},"get")})});var vP=T(nd=>{"use strict";Object.defineProperty(nd,"__esModule",{value:!0});nd.FileHandle=void 0;var rt=Ri(),nH=c0(),f0=class f0 extends nH.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,rt.promisify)(this.fs,"appendFile")(this.fd,e,r)}chmod(e){return(0,rt.promisify)(this.fs,"fchmod")(this.fd,e)}chown(e,r){return(0,rt.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,rt.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,rt.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,rt.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,rt.promisify)(this.fs,"readv",i=>({bytesRead:i,buffers:e}))(this.fd,e,r)}readFile(e){return(0,rt.promisify)(this.fs,"readFile")(this.fd,e)}stat(e){return(0,rt.promisify)(this.fs,"fstat")(this.fd,e)}sync(){return(0,rt.promisify)(this.fs,"fsync")(this.fd)}truncate(e){return(0,rt.promisify)(this.fs,"ftruncate")(this.fd,e)}utimes(e,r){return(0,rt.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,rt.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,rt.promisify)(this.fs,"writev",i=>({bytesWritten:i,buffers:e}))(this.fd,e,r)}writeFile(e,r){return(0,rt.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,rt.promisify)(this.fs,"close")(this.fd).then(this.closeResolve,this.closeReject))}};l(f0,"FileHandle");var l0=f0;nd.FileHandle=l0});var EP=T(sd=>{"use strict";Object.defineProperty(sd,"__esModule",{value:!0});sd.FsPromises=void 0;var oe=Ri(),sH=ir(),d0=class d0{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(d0,"FSWatchAsyncIterator");var u0=d0,p0=class p0{constructor(e,r){this.fs=e,this.FileHandle=r,this.constants=sH.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",o=>new this.FileHandle(this.fs,o))(i,n,s),this.writeFile=(i,n,s)=>((0,oe.isReadableStream)(n)?(0,oe.streamToBuffer)(n):Promise.resolve(n)).then(f=>(0,oe.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 u0(this.fs,i,s)}}};l(p0,"FsPromises");var h0=p0;sd.FsPromises=h0});var FP=T(it=>{"use strict";Object.defineProperty(it,"__esModule",{value:!0});it.newNotAllowedError=it.newTypeMismatchError=it.newNotFoundError=it.assertCanWrite=it.assertName=it.basename=it.ctx=void 0;var oH=l((t={})=>({separator:"/",syncHandleAllowed:!1,mode:"read",...t}),"ctx");it.ctx=oH;var aH=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");it.basename=aH;var cH=/^(\.{1,2})$|^(.*([\/\\]).*)$/,lH=l((t,e,r)=>{if(!t||cH.test(t))throw new TypeError(`Failed to execute '${e}' on '${r}': Name is not allowed.`)},"assertName");it.assertName=lH;var fH=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");it.assertCanWrite=fH;var uH=l(()=>new DOMException("A requested file or directory could not be found at the time an operation was processed.","NotFoundError"),"newNotFoundError");it.newNotFoundError=uH;var hH=l(()=>new DOMException("The path supplied exists, but was not an entry of requested type.","TypeMismatchError"),"newTypeMismatchError");it.newTypeMismatchError=hH;var dH=l(()=>new DOMException("Permission not granted.","NotAllowedError"),"newNotAllowedError");it.newNotAllowedError=dH});var TP=T(Ic=>{"use strict";Object.defineProperty(Ic,"__esModule",{value:!0});Ic.toTreeSync=void 0;var pH=vp(),mH=FP(),wH=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,pH.printTree)(n,c.map(a=>u=>a.isDirectory()?(0,Ic.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,mH.basename)(i,r)+r+o},"toTreeSync");Ic.toTreeSync=wH});var OP=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=RP;q.optsGenerator=Gr;q.optsAndCbGenerator=gn;var od=Bo(),yH=Ac(),m0=Ri(),kP={mode:511,recursive:!1},gH=l(t=>typeof t=="number"?Object.assign({},kP,{mode:t}):Object.assign({},kP,t),"getMkdirOptions");q.getMkdirOptions=gH;var bH=l(t=>`Expected options to be either an object or a string, but got ${t} instead`,"ERRSTR_OPTS");function RP(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(bH(i))}}else return t;return r.encoding!=="buffer"&&(0,yH.assertEncoding)(r.encoding),r}l(RP,"getOptions");function Gr(t){return e=>RP(t,e)}l(Gr,"optsGenerator");function gn(t){return(e,r)=>typeof e=="function"?[t(),e]:[t(e),(0,m0.validateCallback)(r)]}l(gn,"optsAndCbGenerator");q.optsDefaults={encoding:"utf8"};q.getDefaultOpts=Gr(q.optsDefaults);q.getDefaultOptsAndCb=gn(q.getDefaultOpts);var _H={recursive:!1},SH=l(t=>Object.assign({},_H,t),"getRmdirOptions");q.getRmdirOptions=SH;var vH=Gr(q.optsDefaults);q.getRmOptsAndCb=gn(vH);var EH={flag:"r"};q.getReadFileOptions=Gr(EH);var FH={encoding:"utf8",recursive:!1,withFileTypes:!1};q.getReaddirOptions=Gr(FH);q.getReaddirOptsAndCb=gn(q.getReaddirOptions);var TH={encoding:"utf8",bufferSize:32,recursive:!1};q.getOpendirOptions=Gr(TH);q.getOpendirOptsAndCb=gn(q.getOpendirOptions);var kH={encoding:"utf8",mode:438,flag:od.FLAGS[od.FLAGS.a]};q.getAppendFileOpts=Gr(kH);q.getAppendFileOptsAndCb=gn(q.getAppendFileOpts);var RH={bigint:!1},OH=l((t={})=>Object.assign({},RH,t),"getStatOptions");q.getStatOptions=OH;var xH=l((t,e)=>typeof t=="function"?[(0,q.getStatOptions)(),t]:[(0,q.getStatOptions)(t),(0,m0.validateCallback)(e)],"getStatOptsAndCb");q.getStatOptsAndCb=xH;var AH={bigint:!1},PH=l((t={})=>Object.assign({},AH,t),"getStatfsOptions");q.getStatfsOptions=PH;var NH=l((t,e)=>typeof t=="function"?[(0,q.getStatfsOptions)(),t]:[(0,q.getStatfsOptions)(t),(0,m0.validateCallback)(e)],"getStatfsOptsAndCb");q.getStatfsOptsAndCb=NH;var DH=q.optsDefaults;q.getRealpathOptions=Gr(DH);q.getRealpathOptsAndCb=gn(q.getRealpathOptions);q.writeFileDefaults={encoding:"utf8",mode:438,flag:od.FLAGS[od.FLAGS.w]};q.getWriteFileOptions=Gr(q.writeFileDefaults)});var AP=T(ad=>{"use strict";Object.defineProperty(ad,"__esModule",{value:!0});ad.Dir=void 0;var xP=Ri(),CH=Ch(),bn=xc(),y0=class y0{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]()),CH.default.build(s,this.options.encoding)}while(!r);return null}close(e){if(e===void 0)return this.closed?Promise.reject(new bn.Error("ERR_DIR_CLOSED")):new Promise((r,i)=>{this.close(n=>{n?i(n):r()})});if((0,xP.validateCallback)(e),this.closed){process.nextTick(e,new bn.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 bn.Error("ERR_DIR_CLOSED");if(this.operationQueue!==null)throw new bn.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,xP.validateCallback)(e),this.closed){process.nextTick(e,new bn.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 bn.Error("ERR_DIR_CLOSED");if(this.operationQueue!==null)throw new bn.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(y0,"Dir");var w0=y0;ad.Dir=w0});var DP=T(b0=>{"use strict";Object.defineProperty(b0,"__esModule",{value:!0});b0.globSync=jH;var _n=Co(),IH=kp(),PP=Ri(),$H=_n.posix.join,BH=_n.posix.relative,MH=_n.posix.resolve;function NP(t,e){return(0,IH.toRegex)(e).test(t)}l(NP,"matchesPattern");function LH(t,e){return e?typeof e=="function"?e(t):(Array.isArray(e)?e:[e]).some(i=>NP(t,i)):!1}l(LH,"isExcluded");function g0(t,e,r,i,n=0){let s=[],o=i.maxdepth??1/0,f=i.cwd?(0,PP.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=$H(e,a.name.toString()),h=BH(f,u);if(LH(h,i.exclude))continue;if(r.some(p=>NP(h,p))&&s.push(h),a.isDirectory()&&n<o){let p=g0(t,u,r,i,n+1);s.push(...p)}}}catch{}return s}l(g0,"walkDirectory");function jH(t,e,r={}){let i=r.cwd?(0,PP.pathToFilename)(r.cwd):process.cwd(),n=MH(i),s={cwd:n,exclude:r.exclude,maxdepth:r.maxdepth,withFileTypes:r.withFileTypes||!1},o=[];if(_n.posix.isAbsolute(e)){let f=_n.posix.dirname(e),c=_n.posix.basename(e),a=g0(t,f,[c],{...s,cwd:f});o.push(...a.map(u=>_n.posix.resolve(f,u)))}else{let f=g0(t,n,[e],s);o.push(...f)}return o=[...new Set(o)].sort(),o}l(jH,"globSync")});var jP=T(kt=>{"use strict";Object.defineProperty(kt,"__esModule",{value:!0});kt.FSWatcher=kt.StatWatcher=kt.Volume=void 0;kt.pathToSteps=i5;kt.dataToStr=n5;kt.toUnixTimestamp=Tt;var Ae=Co(),E0=yP(),_0=Bg(),qH=Ch(),UH=gP(),Wo=Fi(),hd=r0(),WH=bP(),dd=SP(),zH=ir(),BP=c0(),Sn=Ac(),HH=vP(),MP=Lg(),VH=EP(),GH=TP(),ld=Bo(),JH=xc(),te=OP(),N=Ri(),KH=AP(),Ve=Xh(),XH=Ae.resolve,{O_SYMLINK:CP,F_OK:S0,R_OK:YH,W_OK:ZH,X_OK:QH,COPYFILE_EXCL:e5,COPYFILE_FICLONE_FORCE:t5}=zH.constants,mZ=Ae.posix?Ae.posix.sep:Ae.sep,cd=Ae.posix?Ae.posix.relative:Ae.relative,v0=Ae.posix?Ae.posix.join:Ae.join,IP=Ae.posix?Ae.posix.dirname:Ae.dirname,$P=Ae.posix?Ae.posix.normalize:Ae.normalize,r5=128;function i5(t){return(0,Ve.filenameToSteps)((0,N.pathToFilename)(t))}l(i5,"pathToSteps");function n5(t,e=Sn.ENCODING_UTF8){return Wo.Buffer.isBuffer(t)?t.toString(e):t instanceof Uint8Array?(0,Wo.bufferFrom)(t).toString(e):String(t)}l(n5,"dataToStr");function Tt(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(Tt,"toUnixTimestamp");function qo(t){if(typeof t!="number")throw TypeError(ld.ERRSTR.UID)}l(qo,"validateUid");function Uo(t){if(typeof t!="number")throw TypeError(ld.ERRSTR.GID)}l(Uo,"validateGid");var F0=class F0{get promises(){if(this.promisesApi===null)throw new Error("Promise is not supported in this environment.");return this.promisesApi}constructor(e=new E0.Superblock){this._core=e,this.promisesApi=new VH.FsPromises(this,HH.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&CP))},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&CP)],p)},this.closeSync=c=>{this._core.close(c)},this.close=(c,a)=>{(0,Ve.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,Ve.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,hd.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,Ve.validateFd)(c),this._core.readv(c,a,u??null)),this._readfile=(c,a,u)=>{let h,p=typeof c=="number"&&(0,Ve.isFd)(c),m;if(p)m=c;else{let w=(0,N.pathToFilename)(c),y=String(c),b=y.length>1&&y.endsWith("/"),_=this._core.getResolvedLinkOrThrow(w,"open"),F=_.getNode();if(F.isDirectory())throw(0,N.createError)("EISDIR","open",_.getPath());if(b&&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,te.getReadFileOptions)(a),h=(0,N.flagsToNumber)(u.flag);return this._readfile(c,h,u.encoding)},this.readFile=(c,a,u)=>{let[h,d]=(0,te.optsAndCbGenerator)(te.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,b,_,F]=(0,N.getWriteArgs)(c,a,u,h,d,p);Promise.resolve().then(()=>{try{let E=this._write(c,w,y,b,_);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,Ve.validateFd)(c),this.writevBase(c,a,u??null)),this.writeFileSync=(c,a,u)=>{let h=(0,te.getWriteFileOptions)(u),d=(0,N.flagsToNumber)(h.flag),p=(0,N.modeToNumber)(h.mode),m=(0,Ve.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]=[te.writeFileDefaults,u]);let m=(0,N.validateCallback)(p),w=(0,te.getWriteFileOptions)(d),y=(0,N.flagsToNumber)(w.flag),b=(0,N.modeToNumber)(w.mode),_=(0,Ve.dataToBuffer)(a,w.encoding);this.wrapAsync(this._core.writeFile,[c,_,y,b],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=IP(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 _0.default.build(h.getNode(),a)},this.lstatSync=(c,a)=>{let{throwIfNoEntry:u=!0,bigint:h=!1}=(0,te.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(ld.ERRSTR.CB);Promise.resolve().then(()=>{try{a(this._exists(u))}catch{a(!1)}})},this.accessSync=(c,a=S0)=>{let u=(0,N.pathToFilename)(c);a=a|0,this._access(u,a)},this.access=(c,a,u)=>{let h=S0,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,te.getAppendFileOpts)(u);(!h.flag||(0,Ve.isFd)(c))&&(h.flag="a"),this.writeFileSync(c,a,h)},this.appendFile=(c,a,u,h)=>{let[d,p]=(0,te.getAppendFileOptsAndCb)(u,h);(!d.flag||(0,Ve.isFd)(c))&&(d.flag="a"),this.writeFile(c,a,d,p)},this._readdir=(c,a)=>{let u=(0,Ve.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(qH.default.build(y,a.encoding)),a.recursive&&y.children.size)){let b={...a,recursive:!0,withFileTypes:!0},_=this._readdir(y.getPath(),b);p.push(..._)}}if(!Ve.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 Ve.isWin&&(m=m.replace(/\\/g,"/")),p.map(w=>{if(a.recursive){let y=v0(w.parentPath,w.name.toString());return Ve.isWin&&(y=y.replace(/\\/g,"/")),y.replace(m+Ae.posix.sep,"")}return w.name})},this.readdirSync=(c,a)=>{let u=(0,te.getReaddirOptions)(a),h=(0,N.pathToFilename)(c);return this._readdir(h,u)},this.readdir=(c,a,u)=>{let[h,d]=(0,te.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,Sn.strToEncoding)(h.symlink,a)},this.readlinkSync=(c,a)=>{let u=(0,te.getDefaultOpts)(a),h=(0,N.pathToFilename)(c);return this._readlink(h,u.encoding)},this.readlink=(c,a,u)=>{let[h,d]=(0,te.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,Ve.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,Ve.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,Tt(a),Tt(u))},this.futimes=(c,a,u,h)=>{this.wrapAsync(this._futimes,[c,Tt(a),Tt(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),Tt(a),Tt(u),!0)},this.utimes=(c,a,u,h)=>{this.wrapAsync(this._utimes,[(0,N.pathToFilename)(c),Tt(a),Tt(u),!0],h)},this.lutimesSync=(c,a,u)=>{this._utimes((0,N.pathToFilename)(c),Tt(a),Tt(u),!1)},this.lutimes=(c,a,u,h)=>{this.wrapAsync(this._utimes,[(0,N.pathToFilename)(c),Tt(a),Tt(u),!1],h)},this.mkdirSync=(c,a)=>{let u=(0,te.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,te.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,Sn.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,te.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,te.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,te.getRmdirOptions)(a);this._core.rmdir((0,N.pathToFilename)(c),u.recursive)},this.rmdir=(c,a,u)=>{let h=(0,te.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,te.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)=>{qo(a),Uo(u),this._fchown(c,a,u)},this.fchown=(c,a,u,h)=>{qo(a),Uo(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)=>{qo(a),Uo(u),this._chown((0,N.pathToFilename)(c),a,u)},this.chown=(c,a,u,h)=>{qo(a),Uo(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)=>{qo(a),Uo(u),this._lchown((0,N.pathToFilename)(c),a,u)},this.lchown=(c,a,u,h)=>{qo(a),Uo(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 JH.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}=DP();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 KH.Dir(u,a)},this.opendirSync=(c,a)=>{let u=(0,te.getOpendirOptions)(a),h=(0,N.pathToFilename)(c);return this._opendir(h,u)},this.opendir=(c,a,u)=>{let[h,d]=(0,te.getOpendirOptsAndCb)(a,u),p=(0,N.pathToFilename)(c);this.wrapAsync(this._opendir,[p,h],d)};let r=this;this.StatWatcher=class extends fd{constructor(){super(r)}};let i=kr;this.ReadStream=class extends i{constructor(...c){super(r,...c)}};let n=Wt;this.WriteStream=class extends n{constructor(...c){super(r,...c)}},this.FSWatcher=class extends ud{constructor(){super(r)}};let s=l((c,a)=>{let u=this._core.getResolvedLinkOrThrow(c,"realpath");return(0,Sn.strToEncoding)(u.getPath()||"/",a)},"_realpath"),o=l((c,a,u)=>{let[h,d]=(0,te.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,te.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:Ae.sep}){return(0,GH.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=Wo.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&e5&&this.existsSync(r))throw(0,N.createError)("EEXIST","copyFile",e,r);if(i&t5)throw(0,N.createError)("ENOSYS","copyFile",e,r);this._core.writeFile(r,n,ld.FLAGS.w,438)}isSrcSubdir(e,r){try{let i=$P(e.startsWith("/")?e:"/"+e),n=$P(r.startsWith("/")?r:"/"+r);if(i===n)return!0;let s=cd(i,n);return s===""||!s.startsWith("..")&&!(0,Ae.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=v0(i,String(f)),a=v0(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,Ae.isAbsolute)(s)&&(s=XH(IP(r),s)),e&&this.unlinkSync(i),this.symlinkSync(s,i)}lstat(e,r,i){let[{throwIfNoEntry:n=!0,bigint:s=!1},o]=(0,te.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 _0.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},o]=(0,te.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 _0.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!==S0&&(r&YH&&!n.canRead()||r&ZH&&!n.canWrite()||r&QH&&!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,te.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"),UH.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)}};l(F0,"Volume");var vn=F0;kt.Volume=vn;vn.fromJSON=(t,e)=>new vn(E0.Superblock.fromJSON(t,e));vn.fromNestedJSON=(t,e)=>new vn(E0.Superblock.fromNestedJSON(t,e));function s5(t){t.emit("stop")}l(s5,"emitStop");var T0=class T0 extends BP.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):WH.default,this.interval=i,this.prev=this.vol.statSync(this.filename),this.loop()}stop(){clearTimeout(this.timeoutRef),(0,hd.default)(()=>{s5.call(this,this)})}};l(T0,"StatWatcher");var fd=T0;kt.StatWatcher=fd;var Ut;function o5(t){Ut=(0,Wo.bufferAllocUnsafe)(t),Ut.used=0}l(o5,"allocNewPool");(0,MP.inherits)(kr,dd.Readable);kt.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),dd.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(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;(!Ut||Ut.length-Ut.used<r5)&&o5(this._readableState.highWaterMark);var e=Ut,r=Math.min(Ut.length-Ut.used,t),i=Ut.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,Ut,Ut.used,r,this.pos,s),this.pos!==void 0&&(this.pos+=r),Ut.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")};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",LP);return}return(0,hd.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 LP(t){this.close()}l(LP,"closeOnOpen");(0,MP.inherits)(Wt,dd.Writable);kt.WriteStream=Wt;function Wt(t,e,r){if(!(this instanceof Wt))return new Wt(t,e,r);if(this._vol=t,r=Object.assign({},(0,te.getOptions)(r,{})),dd.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(Wt,"FsWriteStream");Wt.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))};Wt.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)};Wt.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=Wo.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)};Wt.prototype.close=function(t){if(t&&this.once("close",t),this.closed||typeof this.fd!="number"){if(typeof this.fd!="number"){this.once("open",LP);return}return(0,hd.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};Wt.prototype._destroy=kr.prototype._destroy;Wt.prototype.destroySoon=Wt.prototype.end;var k0=class k0 extends BP.EventEmitter{constructor(e){super(),this._filename="",this._filenameEncoded="",this._recursive=!1,this._encoding=Sn.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=Sn.ENCODING_UTF8){this._filename=(0,N.pathToFilename)(e),this._steps=(0,Ve.filenameToSteps)(this._filename),this._filenameEncoded=(0,Sn.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=cd(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",cd(this._filename,m.getPath())),s(m),o(m)},"onLinkChildAdd"),h=l(m=>{let w=l(y=>{let b=y.getNode().ino,_=this._listenerRemovers.get(b);_&&(_.forEach(F=>F()),this._listenerRemovers.delete(b));for(let[F,E]of y.children.entries())E&&F!=="."&&F!==".."&&w(E)},"removeLinkNodeListeners");w(m),this.emit("change","rename",cd(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(k0,"FSWatcher");var ud=k0;kt.FSWatcher=ud});var qP=T(pd=>{"use strict";Object.defineProperty(pd,"__esModule",{value:!0});pd.fsSynchronousApiList=void 0;pd.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 UP=T(md=>{"use strict";Object.defineProperty(md,"__esModule",{value:!0});md.fsCallbackApiList=void 0;md.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 zP=T((Rt,wd)=>{"use strict";Object.defineProperty(Rt,"__esModule",{value:!0});Rt.memfs=Rt.fs=Rt.vol=Rt.Volume=void 0;Rt.createFsFromVolume=R0;var a5=Bg(),c5=Ch(),yd=jP();Object.defineProperty(Rt,"Volume",{enumerable:!0,get:l(function(){return yd.Volume},"get")});var WP=ir(),l5=qP(),f5=UP(),{F_OK:u5,R_OK:h5,W_OK:d5,X_OK:p5}=WP.constants;Rt.vol=new yd.Volume;function R0(t){let e={F_OK:u5,R_OK:h5,W_OK:d5,X_OK:p5,constants:WP.constants,Stats:a5.default,Dirent:c5.default};for(let r of l5.fsSynchronousApiList)typeof t[r]=="function"&&(e[r]=t[r].bind(t));for(let r of f5.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=yd.toUnixTimestamp,e.__vol=t,e}l(R0,"createFsFromVolume");Rt.fs=R0(Rt.vol);var m5=l((t={},e="/")=>{let r=yd.Volume.fromNestedJSON(t,e);return{fs:R0(r),vol:r}},"memfs");Rt.memfs=m5;wd.exports={...wd.exports,...Rt.fs};wd.exports.semantic=!0});var L0=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"),Yo,Fn,xd=(Fn=class{constructor(e){U(this,"strategy","jwt");U(this,"cachedToken",null);U(this,"tokenExpiry",null);Ko(this,Yo);Xo(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 Jo(this,Yo).call(this);return r?(this.cachedToken=r,this.tokenExpiry=L0(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=L0(n)}},Yo=new WeakMap,l(Fn,"AssistantCloudJWTAuthStrategy"),Fn),Zo,Qo,ea,Tn,j0=(Tn=class{constructor(e,r,i){U(this,"strategy","api-key");Ko(this,Zo);Ko(this,Qo);Ko(this,ea);Xo(this,Zo,e),Xo(this,Qo,r),Xo(this,ea,i)}async getAuthHeaders(){return{Authorization:`Bearer ${Jo(this,Zo)}`,"Aui-User-Id":Jo(this,Qo),"Aui-Workspace-Id":Jo(this,ea)}}readAuthHeaders(){}},Zo=new WeakMap,Qo=new WeakMap,ea=new WeakMap,l(Tn,"AssistantCloudAPIKeyAuthStrategy"),Tn),Lc="aui:refresh_token",kn,q0=(kn=class{constructor(e){U(this,"strategy","anon");U(this,"baseUrl");U(this,"jwtStrategy");this.baseUrl=e,this.jwtStrategy=new xd(async()=>{let r=Date.now(),i=localStorage.getItem(Lc),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(Lc,JSON.stringify(p)),d}}else localStorage.removeItem(Lc);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(Lc,JSON.stringify(c)),f)})}async getAuthHeaders(){return this.jwtStrategy.getAuthHeaders()}readAuthHeaders(e){this.jwtStrategy.readAuthHeaders(e)}},l(kn,"AssistantCloudAnonymousAuthStrategy"),kn);var Rn,lN=(Rn=class extends Error{constructor(e){super(e),this.name="APIError"}},l(Rn,"CloudAPIError"),Rn),On,U0=(On=class{constructor(e){U(this,"_auth");U(this,"_baseUrl");if("authToken"in e)this._baseUrl=e.baseUrl,this._auth=new xd(e.authToken);else if("apiKey"in e)this._baseUrl="https://backend.assistant-api.com",this._auth=new j0(e.apiKey,e.userId,e.workspaceId);else if("anonymous"in e)this._baseUrl=e.baseUrl,this._auth=new q0(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 lN(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(On,"AssistantCloudAPI"),On);var xn,W0=(xn=class{constructor(e){this.cloud=e}async create(){return this.cloud.makeRequest("/auth/tokens",{method:"POST"})}},l(xn,"AssistantCloudAuthTokens"),xn);var ta={toResponse(t,e){return new Response(ta.toByteStream(t,e),{headers:e.headers??{}})},fromResponse(t,e){return ta.fromByteStream(t.body,e)},toByteStream(t,e){return t.pipeThrough(e)},fromByteStream(t,e){return t.pipeThrough(e)}};var jc=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 z0=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=jc(),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 An,H0=(An=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(An,"TextStreamControllerImpl"),An),Ad=l(t=>new ReadableStream({start(e){return t.start?.(new H0(e))},pull(e){return t.pull?.(new H0(e))},cancel(e){return t.cancel?.(e)}}),"createTextStream"),Pd=l(()=>{let t;return[Ad({start(r){t=r}}),t]},"createTextStreamController");var Pn,V0=(Pn=class{constructor(e){U(this,"_isClosed",!1);U(this,"_mergeTask");U(this,"_argsTextController");this._controller=e;let r=Ad({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(Pn,"ToolCallStreamControllerImpl"),Pn),fN=l(t=>new ReadableStream({start(e){return t.start?.(new V0(e))},pull(e){return t.pull?.(new V0(e))},cancel(e){return t.cancel?.(e)}}),"createToolCallStream"),G0=l(()=>{let t;return[fN({start(r){t=r}}),t]},"createToolCallStreamController");var Nn,qc=(Nn=class{constructor(){U(this,"value",-1)}up(){return++this.value}},l(Nn,"Counter"),Nn);var Dn,J0=(Dn=class extends TransformStream{constructor(e){super({transform(r,i){i.enqueue({...r,path:[e,...r.path]})}})}},l(Dn,"PathAppendEncoder"),Dn),Cn,tV=(Cn=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(Cn,"PathAppendDecoder"),Cn),In,K0=(In=class extends TransformStream{constructor(e){let r=new qc,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(In,"PathMergeEncoder"),In);var $n,X0=($n=class extends TransformStream{constructor(e,r,i){let[n,s]=Y0(),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($n,"AssistantTransformStream"),$n);var Bn,Z0=(Bn=class extends TransformStream{constructor(e){super();let r=e(super.readable);Object.defineProperty(this,"readable",{value:r,writable:!1})}},l(Bn,"PipeableTransformStream"),Bn);var Uc=l((t,e=21)=>(r=e)=>{let i="",n=r|0;for(;n--;)i+=t[Math.random()*t.length|0];return i},"customAlphabet");var Q0=Uc("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",7);var Pi,uN=(Pi=class{constructor(e){U(this,"_state");U(this,"_parentId");this._state=e||{merger:z0(),contentCounter:new qc}}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 J0(this._state.contentCounter.value)))}merge(e){this._state.merger.addStream(e.pipeThrough(new K0(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]=Pd();return this._addPart({type:"text"},e),r}addReasoningPart(){let[e,r]=Pd();return this._addPart({type:"reasoning"},e),r}addToolCallPart(e){let r=typeof e=="string"?{toolName:e}:e,i=r.toolName,n=r.toolCallId??Q0(),[s,o]=G0();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 Pi(this._state);return r._parentId=e,r}close(){this._state.append?.controller?.close(),this._state.merger.seal(),this._state.closeSubscriber?.()}},l(Pi,"_AssistantStreamControllerImpl"),Pi);function hN(t){let e=new uN;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(hN,"createAssistantStream");function Y0(){let{resolve:t,promise:e}=jc(),r;return[hN(n=>(r=n,r.__internal_subscribeToClose(t),e)),r]}l(Y0,"createAssistantStreamController");var Mn,Nd=(Mn=class extends Z0{constructor(){super(e=>{let r=new X0({transform(i,n){n.appendText(i)}});return e.pipeThrough(new TextDecoderStream).pipeThrough(r)})}},l(Mn,"PlainTextDecoder"),Mn);var Ln,eb=(Ln=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 ta.fromResponse(r,new Nd)}},l(Ln,"AssistantCloudRuns"),Ln);var jn,tb=(jn=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(jn,"AssistantCloudThreadMessages"),jn);var qn,rb=(qn=class{constructor(e){U(this,"messages");this.cloud=e,this.messages=new tb(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(qn,"AssistantCloudThreads"),qn);var Un,ib=(Un=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(Un,"AssistantCloudFiles"),Un);var Wn,Dd=(Wn=class{constructor(e){U(this,"threads");U(this,"auth");U(this,"runs");U(this,"files");let r=new U0(e);this.threads=new rb(r),this.auth={tokens:new W0(r)},this.runs=new eb(r),this.files=new ib(r)}},l(Wn,"AssistantCloud"),Wn);var Ni={toResponse(t,e){return new Response(Ni.toByteStream(t,e),{headers:e.headers??{}})},fromResponse(t,e){return Ni.fromByteStream(t.body,e)},toByteStream(t,e){return t.pipeThrough(e)},fromByteStream(t,e){return t.pipeThrough(e)}};var Wc=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 nb=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=Wc(),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 zn,sb=(zn=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(zn,"TextStreamControllerImpl"),zn),Cd=l(t=>new ReadableStream({start(e){return t.start?.(new sb(e))},pull(e){return t.pull?.(new sb(e))},cancel(e){return t.cancel?.(e)}}),"createTextStream"),Id=l(()=>{let t;return[Cd({start(r){t=r}}),t]},"createTextStreamController");var Hn,ob=(Hn=class{constructor(e){U(this,"_isClosed",!1);U(this,"_mergeTask");U(this,"_argsTextController");this._controller=e;let r=Cd({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(Hn,"ToolCallStreamControllerImpl"),Hn),dN=l(t=>new ReadableStream({start(e){return t.start?.(new ob(e))},pull(e){return t.pull?.(new ob(e))},cancel(e){return t.cancel?.(e)}}),"createToolCallStream"),ab=l(()=>{let t;return[dN({start(r){t=r}}),t]},"createToolCallStreamController");var Vn,zc=(Vn=class{constructor(){U(this,"value",-1)}up(){return++this.value}},l(Vn,"Counter"),Vn);var Gn,cb=(Gn=class extends TransformStream{constructor(e){super({transform(r,i){i.enqueue({...r,path:[e,...r.path]})}})}},l(Gn,"PathAppendEncoder"),Gn),Jn,f7=(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),Kn,lb=(Kn=class extends TransformStream{constructor(e){let r=new zc,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(Kn,"PathMergeEncoder"),Kn);var Xn,fb=(Xn=class extends TransformStream{constructor(e,r,i){let[n,s]=ra(),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(Xn,"AssistantTransformStream"),Xn);var Yn,Hc=(Yn=class extends TransformStream{constructor(e){super();let r=e(super.readable);Object.defineProperty(this,"readable",{value:r,writable:!1})}},l(Yn,"PipeableTransformStream"),Yn);var fe=(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))(fe||{});var Zn,ub=(Zn=class extends TransformStream{constructor(){super({transform:l((e,r)=>{r.enqueue(`${e.type}:${JSON.stringify(e.value)}
105
+ `)},"transform")})}},l(Zn,"DataStreamChunkEncoder"),Zn),Qn,pN=(Qn=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(Qn,"DataStreamChunkDecoder"),Qn);var es,hb=(es=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(es,"AssistantMetaTransformStream"),es);var ts,$d=(ts=class extends Hc{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:fe.StartToolCall,value:a})}if(f.type==="source"){let{type:c,...a}=f;s.enqueue({type:fe.Source,value:a})}break}case"text-delta":{let f=n.meta;switch(f.type){case"text":{f.parentId?s.enqueue({type:fe.AuiTextDelta,value:{textDelta:n.textDelta,parentId:f.parentId}}):s.enqueue({type:fe.TextDelta,value:n.textDelta});break}case"reasoning":{f.parentId?s.enqueue({type:fe.AuiReasoningDelta,value:{reasoningDelta:n.textDelta,parentId:f.parentId}}):s.enqueue({type:fe.ReasoningDelta,value:n.textDelta});break}case"tool-call":{s.enqueue({type:fe.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:fe.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:fe.StartStep,value:c});break}case"step-finish":{let{type:f,...c}=n;s.enqueue({type:fe.FinishStep,value:c});break}case"message-finish":{let{type:f,...c}=n;s.enqueue({type:fe.FinishMessage,value:c});break}case"error":{s.enqueue({type:fe.Error,value:n.error});break}case"annotations":{s.enqueue({type:fe.Annotation,value:n.annotations});break}case"data":{s.enqueue({type:fe.Data,value:n.data});break}case"update-state":{s.enqueue({type:fe.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 hb).pipeThrough(i).pipeThrough(new ub).pipeThrough(new TextEncoderStream)});U(this,"headers",new Headers({"Content-Type":"text/plain; charset=utf-8","x-vercel-ai-data-stream":"v1"}))}},l(ts,"DataStreamEncoder"),ts),R7=[fe.StartToolCall,fe.ToolCall,fe.TextDelta,fe.ReasoningDelta,fe.Source,fe.Error,fe.FinishStep,fe.FinishMessage,fe.AuiTextDelta,fe.AuiReasoningDelta];var db=Uc("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",7);var Di,mN=(Di=class{constructor(e){U(this,"_state");U(this,"_parentId");this._state=e||{merger:nb(),contentCounter:new zc}}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 cb(this._state.contentCounter.value)))}merge(e){this._state.merger.addStream(e.pipeThrough(new lb(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]=Id();return this._addPart({type:"text"},e),r}addReasoningPart(){let[e,r]=Id();return this._addPart({type:"reasoning"},e),r}addToolCallPart(e){let r=typeof e=="string"?{toolName:e}:e,i=r.toolName,n=r.toolCallId??db(),[s,o]=ab();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 Di(this._state);return r._parentId=e,r}close(){this._state.append?.controller?.close(),this._state.merger.seal(),this._state.closeSubscriber?.()}},l(Di,"_AssistantStreamControllerImpl"),Di);function pb(t){let e=new mN;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(pb,"createAssistantStream");function ra(){let{resolve:t,promise:e}=Wc(),r;return[pb(n=>(r=n,r.__internal_subscribeToClose(t),e)),r]}l(ra,"createAssistantStreamController");var rs,Bd=(rs=class extends Hc{constructor(){super(e=>{let r=new fb({transform(i,n){n.appendText(i)}});return e.pipeThrough(new TextDecoderStream).pipeThrough(r)})}},l(rs,"PlainTextDecoder"),rs);var Sh=ce(ws(),1),kA=ce(Vp(),1),vh=ce(ws(),1),OA=ce(Vp(),1),Eh=ce(ws(),1),kg=ce(Fe(),1),Fh=ce(ws(),1),Fr=ce(Fe(),1),dn=ce(Fe(),1),IA=ce(Fe(),1),ph=ce(Fe(),1),ct=ce(Fe(),1);import*as Tg from"path";import*as vA from"path";import*as uh from"path";import*as AA from"path";import*as Rg from"path";var lA=ce(iR(),1);function U4(t){let e=[t];return{next(){return Promise.resolve({done:e.length===0,value:e.pop()})},return(){return e=[],{}},[Symbol.asyncIterator](){return this}}}l(U4,"fromValue");function W4(t){return t[Symbol.asyncIterator]?t[Symbol.asyncIterator]():t[Symbol.iterator]?t[Symbol.iterator]():t.next?t:U4(t)}l(W4,"getIterator");async function fA(t,e){let r=W4(t);for(;;){let{value:i,done:n}=await r.next();if(i&&await e(i),n)break}r.return&&r.return()}l(fA,"forAwait");function z4(t){let{PassThrough:e}=cA(),r=new e;return setTimeout(async()=>{await fA(t,i=>r.write(i)),r.end()},1),r}l(z4,"asyncIteratorToStream");async function H4(t){let e=0,r=[];await fA(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(H4,"collect");function V4(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(V4,"fromNodeStream");async function G4({onProgress:t,url:e,method:r="GET",headers:i={},agent:n,body:s}){return s&&Array.isArray(s)?s=Buffer.from(await H4(s)):s&&(s=z4(s)),new Promise((o,f)=>{(0,lA.default)({url:e,method:r,headers:i,agent:n,body:s},(c,a)=>{if(c)return f(c);try{let u=V4(a);o({url:a.url,method:a.method,statusCode:a.statusCode,statusMessage:a.statusMessage,body:u,headers:a.headers})}catch(u){f(u)}})})}l(G4,"request");var J4={request:G4},lh=J4;var et=ce(Fe(),1),Th=ce(ws(),1),Pg=ce(Fe(),1),ae=ce(Fe(),1),Cg=ce(Fe(),1),_o=ce(Fe(),1),hh=ce(Fe(),1),dh=ce(Fe(),1),rr=ce(Fe(),1),Fc=ce(Fe(),1),Ig=ce(Fe(),1),vr=ce(Fe(),1),UA=ce(Fe(),1),wh=ce(Fe(),1),pn=ce(Fe(),1);var gA=Object.defineProperty,K4=l((t,e,r)=>e in t?gA(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,"Ft"),g=l((t,e)=>gA(t,"name",{value:e,configurable:!0}),"o"),W=l((t,e,r)=>K4(t,typeof e!="symbol"?e+"":e,r),"p"),vo,bA=(vo=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.subFilesystems].reverse()){let i=await r.readdir(this.dirPath);for(let n of i)e.add(n)}for(let r of Array.from(e)){let i=this.dirPath+"/"+r;await this.compositFs.hiddenFilesFileSystem?.responsible(i)||this.entries.push({name:r,path:i})}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:g(()=>r.isFile(),"isFile"),isDirectory:g(()=>r.isDirectory(),"isDirectory"),isBlockDevice:g(()=>r.isBlockDevice(),"isBlockDevice"),isCharacterDevice:g(()=>r.isCharacterDevice(),"isCharacterDevice"),isSymbolicLink:g(()=>r.isSymbolicLink(),"isSymbolicLink"),isFIFO:g(()=>r.isFIFO(),"isFIFO"),isSocket:g(()=>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:g(()=>r.isFile(),"isFile"),isDirectory:g(()=>r.isDirectory(),"isDirectory"),isBlockDevice:g(()=>r.isBlockDevice(),"isBlockDevice"),isCharacterDevice:g(()=>r.isCharacterDevice(),"isCharacterDevice"),isSymbolicLink:g(()=>r.isSymbolicLink(),"isSymbolicLink"),isFIFO:g(()=>r.isFIFO(),"isFIFO"),isSocket:g(()=>r.isSocket(),"isSocket")}}catch{return this.read()}}async close(){this.closed=!0,this.entries=[]}get path(){return this.dirPath}},l(vo,"he"),vo);g(bA,"CompositeFsDir");var _A=bA,Eo,SA=(Eo=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(Eo,"pe"),Eo);g(SA,"CompositFsFileHandle");var _h=SA,Fo,EA=(Fo=class{constructor({name:e,parentFs:r,gitRoot:i}){W(this,"compositFs"),W(this,"gitRoot"),W(this,"name"),this.name=e,this.compositFs=r,this.gitRoot=i}toStr(e){return typeof e=="string"?e:Buffer.isBuffer(e)?e.toString():e&&typeof e=="object"&&"fd"in e?`FileHandle(fd=${e.fd})`:String(e)}async open(e,r,i){throw new Error(`open not implemented for: ${this.toStr(e)}`)}async access(e,r){throw new Error(`access not implemented for: ${this.toStr(e)}`)}async stat(e,r){throw new Error(`lstat not implemented for: ${this.toStr(e)}`)}async lstat(e,r){throw new Error(`lstat not implemented for: ${this.toStr(e)}`)}async opendir(e,r){throw new Error(`opendir not implemented for: ${this.toStr(e)}`)}async link(e,r){throw new Error(`link not implemented for: ${this.toStr(e)}`)}async mkdir(e,r){throw new Error(`mkdir not implemented for: ${this.toStr(e)}`)}async readdir(e,r){throw new Error(`readdir not implemented for: ${this.toStr(e)}`)}async readlink(e,...r){throw new Error(`readlink not implemented for: ${this.toStr(e)}`)}async unlink(e){throw new Error(`unlink not implemented for: ${this.toStr(e)}`)}async rename(e,r){throw new Error(`rename not implemented for: ${this.toStr(e)}`)}async rmdir(e,...r){throw new Error(`rmdir not implemented for: ${this.toStr(e)}`)}async symlink(e,r,i){throw new Error(`symlink not implemented for: ${this.toStr(r)}`)}async lookup(e){throw new Error(`lookup not implemented for: ${this.toStr(e)}`)}resolvePath(e){throw new Error(`resolvePath not implemented for fd: ${e}`)}async close(e){this.compositFs.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: ${this.toStr(e)}`)}async writeFile(e,r,i){throw new Error(`writeFile not implemented for: ${this.toStr(e)}`)}},l(Fo,"ue"),Fo);g(EA,"BaseCompositeSubFs");var Rc=EA,To,FA=(To=class extends Rc{constructor({name:e,parentFs:r,gitRoot:i,passThroughFs:n}){super({name:e,parentFs:r,gitRoot:i}),W(this,"openFh",new Map),W(this,"memFs",(0,Sh.createFsFromVolume)(new Sh.Volume)),W(this,"targetFs"),this.compositFs=r,this.gitRoot=i,this.targetFs=n}async responsible(e){return!0}fileType(){return 4}async open(e,r,i){let n=vA.dirname(e),s=await this.targetFs.promises.open(e,r,i);return this.openFh.set(s.fd,s),new _h({fs:this,compositeFs:this.compositFs,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 _A(this.compositFs,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: ${this.toStr(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 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 this.targetFs.promises.readFile(e,r)}async writeFile(e,r,i){return this.targetFs.promises.writeFile(e,r,i)}},l(To,"Fe"),To);g(FA,"PassThroughToAsyncFsSubFs");var X4=FA,ko,TA=(ko=class{constructor({name:e,storageFs:r,gitRoot:i,defaultBranch:n="main"}){W(this,"promises"),W(this,"gitRoot"),W(this,"ephemeralFilesFileSystem"),W(this,"hiddenFilesFileSystem"),W(this,"passThroughFileSystem"),W(this,"subFilesystems",[]),W(this,"parentFs"),W(this,"name"),W(this,"defaultBranch"),W(this,"gitCache"),W(this,"pathToFileDescriptors",new Map),W(this,"openFileHandles",new Map),W(this,"logOperation"),this.name=e,this.gitRoot=i,this.defaultBranch=n,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)},this.passThroughFileSystem=new X4({name:e+"-passthrough",passThroughFs:r,gitRoot:i,parentFs: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)}setEphemeralFilesSubFs(e){this.ephemeralFilesFileSystem=e}setHiddenFilesSubFs(e){this.hiddenFilesFileSystem=e}addSubFs(e){this.subFilesystems.push(e)}async getResponsibleFs(e){if(!e.toString().startsWith(this.gitRoot)&&this.gitRoot!=="./")throw new Error("tried to access a file ("+e+") outside of the legit folder: "+this.gitRoot);if(!this.hiddenFilesFileSystem)throw new Error(this.name+" intialize hidden fs first!");if(!this.ephemeralFilesFileSystem)throw new Error(this.name+" intialize ephemeral fs first!");if(await this.hiddenFilesFileSystem.responsible(e.toString()))return this.hiddenFilesFileSystem;if(await this.ephemeralFilesFileSystem.responsible(e.toString()))return this.ephemeralFilesFileSystem;for(let r of this.subFilesystems)if(await r.responsible(e.toString()))return r;return this.passThroughFileSystem}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 opendir(e,r){await this.logOperation?.({fsName:this.name,path:e.toString(),operation:"opendir",operationArgs:{options:r}});let i=e.toString();if(!i.startsWith(this.gitRoot))throw new Error("tried to access a directory ("+i+") outside of the legit folder: "+this.gitRoot);return new _A(this,i)}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 readdir(e,r){await this.logOperation?.({fsName:this.name,path:e.toString(),operation:"readdir",operationArgs:{options:r}});let i=new Set;for(let n of[...this.subFilesystems].reverse()){let s=await n.readdir(e,r);for(let o of s)await this.ephemeralFilesFileSystem?.responsible((e=="/"?"":e)+"/"+o)||i.add(o)}try{let n=await this.passThroughFileSystem.readdir(e,r);for(let s of n)await this.ephemeralFilesFileSystem?.responsible((e=="/"?"":e)+"/"+s)||i.add(s)}catch(n){if(n.code!=="ENOENT")throw new Error("error reading ephemeral fs: "+n)}try{let n=await this.ephemeralFilesFileSystem.readdir(e,r);for(let s of n)i.add(s)}catch(n){if(n.code!=="ENOENT")throw new Error("error reading ephemeral fs: "+n)}for(let n of i){let s=(e=="/"?"":e)+"/"+n;await this.hiddenFilesFileSystem.responsible(s)&&i.delete(n)}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 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 link(e,r){throw new Error("not implemented")}async readlink(e,r){throw new Error("not implemented")}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 rename(e,r){if(this.hiddenFilesFileSystem){if(await this.hiddenFilesFileSystem.responsible(Tg.basename(e.toString())))throw new Error("Renaming of hidden Files is not allowed "+e);if(await this.hiddenFilesFileSystem.responsible(Tg.basename(r.toString())))throw new Error("Renaming to hidden Files is not allowed "+r)}let i=await this.getResponsibleFs(e),n=await this.getResponsibleFs(r);if(i===n)return await this.logOperation?.({fsName:i.name,path:e.toString(),operation:"rename",operationArgs:{oldPath:e,newPath:r}}),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 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 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(ko,"we"),ko);g(TA,"CompositeFs");var Y4=TA,Ro,RA=(Ro=class extends Rc{constructor({name:e,parentFs:r,gitRoot:i,hiddenFiles:n}){super({name:e,parentFs:r,gitRoot:i}),W(this,"ig"),this.ig=(0,kA.default)(),this.ig.add(n)}async responsible(e){let r=e.replace(/\\/g,"/"),i=r.startsWith("./")?r.slice(2):r;return 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: ${this.toStr(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 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(Ro,"ye"),Ro);g(RA,"HiddenFileSubFs");var Z4=RA,Oo,xA=(Oo=class extends Rc{constructor({name:e,parentFs:r,gitRoot:i,ephemeralPatterns:n}){super({name:e,parentFs:r,gitRoot:i}),W(this,"openFh",new Map),W(this,"memFs",(0,vh.createFsFromVolume)(new vh.Volume)),W(this,"ig"),W(this,"patterns"),this.compositFs=r,this.gitRoot=i,this.ig=(0,OA.default)(),this.ig.add(n),this.patterns=n}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.startsWith("./")?r.slice(2):r;return 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=uh.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 _h({fs:this,compositeFs:this.compositFs,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=uh.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: ${this.toStr(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=uh.dirname(n);return s&&s!=="/"&&s!=="."&&await this.memFs.promises.mkdir(s,{recursive:!0}),this.memFs.promises.writeFile(n,r,i)}},l(Oo,"be"),Oo);g(xA,"EphemeralSubFs");var Q4=xA,xo,e3=(xo=class extends Rc{constructor({name:e,parentFs:r,gitRoot:i}){if(super({name:e,parentFs:r,gitRoot:i}),W(this,"openFh",new Map),W(this,"memFs",(0,Eh.createFsFromVolume)(new Eh.Volume)),W(this,"targetFs"),this.compositFs=r,this.gitRoot=i,this.compositFs.parentFs===void 0)throw new Error("PassThroughSubFs not allowed in root fs");this.targetFs=this.compositFs.parentFs}async responsible(e){return!0}fileType(){return 4}async open(e,r,i){let n=AA.dirname(e),s=await this.targetFs.promises.open(e,r,i);return this.openFh.set(s.fd,s),new _h({fs:this,compositeFs:this.compositFs,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: ${this.toStr(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(xo,"ve"),xo);g(e3,"PassThroughSubFs");var Ao,PA=(Ao=class{constructor(e){this.routes=e,W(this,"compiledRoutes");let r={},i=g((n,s)=>{if(typeof n.type=="string"){r[s]={handler:n,siblings:[]};let o=n}else{let o=[];for(let[f,c]of Object.entries(n))if(f==="."){if(r[s])throw new Error(`Conflict: multiple handlers for path '${s}', '.' and optional '[[parameter_name]]' defined?`);r[s]={handler:c,siblings:o}}else if(f.startsWith("[[")&&f.endsWith("]]")){if(r[s])throw new Error(`Conflict: multiple handlers for path '${s}', '.' and optional '[[parameter_name]]' defined?`);r[s]={handler:c,siblings:o},f.startsWith("[[...")?r[s?`${s}/${f}`:f]={handler:c,siblings:[]}:i(c,s?`${s}/${f}`:f)}else f.startsWith("[")&&f.endsWith("]")?f.startsWith("[...")?r[s?`${s}/${f}`:f]={handler:c,siblings:[]}:i(c,s?`${s}/${f}`:f):(o.push({segment:f,type:c["."]?"folder":"file"}),i(c,s?`${s}/${f}`:f))}},"walk");i(e,""),this.compiledRoutes=Object.entries(r).map(([n,s])=>{let o=[],f=n.split("/").map(c=>{if(c.startsWith("[[")&&c.endsWith("]]")){let a=c.slice(2,-2).replace(/^\.\.\./,"");return o.push(a),"(.*)"}if(c.startsWith("[")&&c.endsWith("]")){let a=c.slice(1,-1);return o.push(a),"([^/]+)"}return c.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}).join("/");return{regex:new RegExp(`^${f}$`),paramNames:o,staticSiblings:s.siblings,handler:s.handler}})}match(e){e.length>1&&e.endsWith("/")&&(e=e.replace(/\/+$/,""));for(let{regex:r,paramNames:i,handler:n,staticSiblings:s}of this.compiledRoutes){let o=e.match(r);if(!o)continue;let f={};for(let c=0;c<i.length;c++)f[i[c]]=decodeURIComponent(o[c+1]||"");return{handler:n,params:f,staticSiblings:s}}}},l(Ao,"Pe"),Ao);g(PA,"LegitPathRouter");var t3=PA,r3=new Set([" ","~","^",":","?","*","[","\\"]),i3=[/^\/|\/$/,/\/\//,/\.$/,/\.lock$/,/^@$/,/@\{/],NA="\u2002";function Og(t){let e=t.codePointAt(0);return!(e>=0&&e<=31||e===127||r3.has(t))}l(Og,"Ue");g(Og,"isValidChar");function DA(t){let e="";for(let r of t)r===" "?e+=NA:Og(r)?e+=r:e+="%"+r.codePointAt(0);for(let r of i3)if(r.test(e))return Array.from(e).map(i=>Og(i)?i:"%"+i.codePointAt(0)).join("");return e}l(DA,"Je");g(DA,"encodeName");function CA(t){return t.replace(/%(\d+)/g,(e,r)=>String.fromCodePoint(parseInt(r,10))).replace(new RegExp(NA,"g")," ")}l(CA,"Ke");g(CA,"decodeName");function Po(t){return t.replace(/\./g,"%2E").replace(/\//g,".")}l(Po,"M");g(Po,"encodeBranchNameForVfs");function lt(t){return t.replace(/\./g,"/").replace(/%2E/g,".")}l(lt,"B");g(lt,"decodeBranchNameFromVfs");async function ue(t,e,r,i){try{return await Fr.default.resolveRef({fs:t,dir:e,ref:`refs/heads/${lt(r)}`})}catch{return}}l(ue,"b");g(ue,"tryResolveRef");async function Wr({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 Fr.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),b=(y!==-1?m[y]:void 0)?.oid,_=await Wr({dir:t,fs:e,treeOid:b,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(_!==b){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 Fr.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 b=m.findIndex(F=>F.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 F=await Wr({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(b,1):m[b]={mode:"040000",path:d,oid:F,type:"tree"}}else if(w=!0,m.splice(b,1),m.length===0&&o){let F=new Uint8Array(0),E=await Fr.default.writeBlob({fs:e,dir:t,blob:F});m.push({mode:"100644",oid:E,path:c,type:"blob"})}y=_}if(u){let b=m.findIndex(F=>F.path===u),_=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 F=await Wr({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(b!==-1)m[b]=E;else if(m.push(E),f&&m.length>1){let R=m.findIndex(D=>D.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(b!==-1)m[b]=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 Fr.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 Fr.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(Wr,"x");g(Wr,"buildUpdatedTree");async function $g(t,e,r,i,n=0,s={}){let{tree:o}=await Fr.default.readTree({fs:t,dir:e,oid:r,cache:s});if(i.length===n)return{type:"tree",entries:o.map(a=>Lt({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 Fr.default.readTree({fs:t,dir:e,oid:c.oid,cache:s});return{type:"tree",entries:a.tree.map(u=>Lt({parent:i.join("/"),name:u.path,isDir:u.type==="tree"})),oid:a.oid}}}else if(c.type==="tree")return await $g(t,e,c.oid,i,n+1,s)}}l($g,"qe");g($g,"findGitObjectAtPath");async function So({filePath:t,gitRoot:e,nodeFs:r,commitSha:i,pathParams:n,gitCache:s}){let o=s||{};if(!n.filePath){let c=await Fr.default.readTree({fs:r,dir:e,oid:i,cache:o});return{type:"tree",entries:c.tree.map(a=>Lt({parent:t,name:a.path,isDir:a.type==="tree"})),oid:c.oid}}let f=n.filePath?n.filePath.split("/"):[];return await $g(r,e,i,f,0,o)}l(So,"j");g(So,"resolveGitObjAtPath");function Lt(t){return{name:t.name,isFile:g(()=>!t.isDir,"isFile"),isDirectory:g(()=>t.isDir,"isDirectory"),isBlockDevice:g(()=>!0,"isBlockDevice"),isCharacterDevice:g(()=>!1,"isCharacterDevice"),isSymbolicLink:g(()=>!1,"isSymbolicLink"),isFIFO:g(()=>!1,"isFIFO"),isSocket:g(()=>!1,"isSocket"),parentPath:t.parent,path:t.parent}}l(Lt,"T");g(Lt,"toDirEntry");var mn,xg=(mn=class extends Rc{constructor({name:e,parentFs:r,gitStorageFs:i,gitRoot:n,routerConfig:s}){super({name:e,parentFs:r,gitRoot:n}),W(this,"pathRouter"),W(this,"memFs"),W(this,"openFh",{}),W(this,"storageFs"),this.pathRouter=new t3(s),this.gitRoot=n,this.storageFs=i,this.memFs=(0,Fh.createFsFromVolume)(new Fh.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}getRouteHandler(e){let r=e;this.gitRoot&&e.startsWith(this.gitRoot)&&(this.gitRoot==="/"?r=e.slice(this.gitRoot.length):r=e.slice(this.gitRoot.length+1));let i=r.indexOf(`/${mn.LEGIT_DIR}`);if(i===-1)return this.pathRouter.match(r);let n=r.slice(i+1);return this.pathRouter.match(r)}async open(e,r,i){let n=this.getRouteHandler(e);if(!n)throw new Error("Not a virtual legit file");if(n?.handler.writeFile===void 0&&(r.includes("w")||r.includes("a")))throw new Error(`Write operations not allowed for ${n?.handler.type}`);if(r.includes("x")&&n?.handler.type!=="gitBranchFileVirtualFile"&&n?.handler.type!=="claudeVirtualSessionFileVirtualFile")throw new Error(`Exclusive operations not allowed for ${n?.handler.type}`);let s=await this.getAuthor(),o=await n.handler.getFile({cacheFs:this.memFs,filePath:e,userSpaceFs:this.compositFs,gitRoot:this.gitRoot,nodeFs:this.storageFs,pathParams:n.params,author:s}),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 _h({fs:this,compositeFs:this.compositFs,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.getRouteHandler(i),s=r?{options:r}:{};try{let o=await this.getAuthor();await n?.handler.mkdir({cacheFs:this.memFs,filePath:e.toString(),userSpaceFs:this.compositFs,nodeFs:this.storageFs,gitRoot:this.gitRoot,pathParams:n.params,...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.getRouteHandler(i);if(!s)throw new Error(`ENOENT: no such file or directory, stat '${i}'`);let o=await this.getAuthor();return await s.handler.getStats({cacheFs:this.memFs,filePath:i,userSpaceFs:this.compositFs,gitRoot:this.gitRoot,nodeFs:this.storageFs,pathParams:s.params,author:o})}async lstat(e,r){return this.stat(e,r)}async readdir(e,r){let i=e.toString(),n=this.getRouteHandler(i);if(!n)throw new Error(`ENOENT: no such file or directory, scandir '${i}'`);let s=await this.getAuthor(),o=await n?.handler.getFile({cacheFs:this.memFs,filePath:i,userSpaceFs:this.compositFs,gitRoot:this.gitRoot,nodeFs:this.storageFs,pathParams:n.params,author:s});if(o){if(o.type!=="directory")throw new Error("not a folder");let f=n?.staticSiblings??[],c=Array.from(new Set([...o.content,...f.map(a=>Lt({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.getRouteHandler(f.path),a=await this.getAuthor(),u=await c.handler.getFile({cacheFs:this.memFs,filePath:f.path,userSpaceFs:this.compositFs,gitRoot:this.gitRoot,nodeFs:this.storageFs,pathParams:c?.params,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.getRouteHandler(o.path),d=await this.getAuthor(),p=await h.handler.getFile({cacheFs:this.memFs,filePath:o.path,userSpaceFs:this.compositFs,gitRoot:this.gitRoot,nodeFs:this.storageFs,pathParams:h.params,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){let n=this.getRouteHandler(i.path);if(n&&n.handler.writeFile){let s=await this.memFs.promises.readFile(i.path),o=await this.getAuthor();await n.handler.writeFile({cacheFs:this.memFs,filePath:i.path,userSpaceFs:this.compositFs,gitRoot:this.gitRoot,nodeFs:this.storageFs,content:s,pathParams:n.params,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(),s=this.getRouteHandler(i),o=this.getRouteHandler(n);if(s?.handler.type==="gitBranchFileVirtualFile"&&o?.handler.type==="gitBranchFileVirtualFile"){let f=!0;try{await this.memFs.promises.access(n)}catch{f=!1}let c=!0;try{await this.stat(n)}catch{c=!1}let a=!0;try{await this.stat(i)}catch{a=!1}let u=!0;try{await this.memFs.promises.access(i)}catch{u=!1}if(u){let m=Rg.dirname(n);try{await this.memFs.promises.access(m)}catch{await this.memFs.promises.mkdir(m,{recursive:!0})}await this.memFs.promises.rename(e,r)}let h=this.getRouteHandler(i);if(!h)throw new Error("VF not found");let d=await this.getAuthor(),p=await h.handler.rename({cacheFs:this.memFs,filePath:i,userSpaceFs:this.compositFs,gitRoot:this.gitRoot,nodeFs:this.storageFs,newPath:n,pathParams:h?.params??{},newPathParams:o?.params??{},author:d})}else throw new Error(`Unsupported rename operation from ${s?.handler.type} to ${o?.handler.type}`)}async fchmod(e,r){}async unlink(e){let r=e.toString(),i=this.getRouteHandler(r);if(i?.handler.unlink!==void 0)try{let n=await this.getAuthor();await i.handler.unlink({cacheFs:this.memFs,filePath:r,userSpaceFs:this.compositFs,nodeFs:this.storageFs,gitRoot:this.gitRoot,pathParams:i.params,author:n})}catch(n){let s=!1;for(let[o,f]of Object.entries(this.openFh))f.path===r&&f.unflushed.length>0&&(s=!0);if(!s)throw n}finally{let n=!1;for(let[s,o]of Object.entries(this.openFh))o.path===r&&(n=!0,await o.fh.close(),delete this.openFh[Number(s)]);n&&await this.memFs.promises.unlink(r)}else throw new Error(`Cannot unlink ${i?.handler.type} files`)}async rmdir(e,...r){let i=e.toString(),n=this.getRouteHandler(i);if(n?.handler.rmdir!==void 0){let s=await this.getAuthor();await n.handler.rmdir({cacheFs:this.memFs,filePath:i,userSpaceFs:this.compositFs,nodeFs:this.storageFs,gitRoot:this.gitRoot,pathParams:n.params,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})}else throw new Error(`Cannot rmdir
106
+ ${n?.handler.type} directories`)}fileType(){return 10}},l(mn,"J"),mn);g(xg,"GitSubFs"),W(xg,"LEGIT_DIR",".legit");var n3=xg,$A="-operation";async function jt(t,e,r){return(await IA.default.listBranches({fs:t,dir:e})).filter(i=>i.endsWith("__"+r+$A))[0]}l(jt,"C");g(jt,"resolveOperationBranchName");async function me(t,e){try{let r=await ph.default.getConfig({fs:e,dir:t,path:"user.legit-current-branch"});if(r)return Po(r)}catch{}try{let r=await ph.default.getConfig({fs:e,dir:t,path:"init.defaultBranch"});return Po(r)||"main"}catch{return"main"}}l(me,"k");g(me,"getCurrentBranch");async function BA(t,e,r){await ph.default.setConfig({fs:e,dir:t,path:"user.legit-current-branch",value:lt(r)})}l(BA,"Qe");g(BA,"setCurrentBranch");var Ag={type:"gitBranchOperationsVirtualFile",rootType:"file",getStats:g(async t=>{let{gitRoot:e,nodeFs:r,pathParams:i}=t;i.branchName===void 0&&(i.branchName=await me(e,r));let n=await jt(r,e,i.branchName),s,o=!1;if(n)try{s=await dn.default.resolveRef({fs:r,dir:e,ref:n}),o=!0}catch{try{s=await dn.default.resolveRef({fs:r,dir:e,ref:`refs/heads/${n}`}),o=!0}catch{throw new Error(`Base Branch ${i.branchName} for operations does not exis`)}}else try{s=await dn.default.resolveRef({fs:r,dir:e,ref:`refs/heads/${i.branchName}`})}catch{throw new Error(`Base Branch ${i.branchName} for operations does not exis`)}let f=await dn.default.readCommit({fs:r,dir:e,oid:s}),{commit:c}=f,a=c.committer.timestamp*1e3;try{return{mode:420,size:(o?await Ag.getFile(t):void 0)?.content?.length??0,atimeMs:a,mtimeMs:a,ctimeMs:a,birthtimeMs:a,atime:new Date(a),mtime:new Date(a),ctime:new Date(a),birthtime:new Date(a),isFile:g(()=>!0,"isFile"),isDirectory:g(()=>!1,"isDirectory"),isSymbolicLink:g(()=>!1,"isSymbolicLink"),isBlockDevice:g(()=>!1,"isBlockDevice"),isCharacterDevice:g(()=>!1,"isCharacterDevice"),isSocket:g(()=>!1,"isSocket"),isFIFO:g(()=>!1,"isFIFO"),isFileSync:g(()=>!0,"isFileSync"),isDirectorySync:g(()=>!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:g(async t=>{let{gitRoot:e,nodeFs:r,pathParams:i}=t;i.branchName===void 0&&(i.branchName=await me(e,r));let n=await jt(r,e,i.branchName),s=[];if(n){let c=await dn.default.resolveRef({fs:r,dir:e,ref:`refs/heads/${n}`}),a=!1,u=c;for(;u&&!a;){let h=await dn.default.readCommit({fs:r,dir:e,oid:u});s.push({oid:h.oid,parentOids:h.commit.parent,message:h.commit.message,originBranchOid:"unset"}),u=h.commit.parent&&h.commit.parent.length>0?h.commit.parent[0]:null,h.commit.parent.length===2&&h.commit.parent[0]===h.commit.parent[1]&&(a=!0)}}let o;for(let c=s.length-1;c>=0;c--){let a=s[c];if(o===void 0){if(a.parentOids.length!==2&&a.parentOids[0]!==a.parentOids[1])throw new Error(`Operation commit ${a.oid} does not have two parents as expected`);o=a.parentOids[1]}a.parentOids.length===2&&(o=a.parentOids[1]),a.originBranchOid=o}let f=Buffer.from(JSON.stringify(s,null,2),"utf-8");return{type:"file",content:f,mode:420,size:f.length}},"getFile"),rename:g(async function(t){throw new Error("not implemented")},"rename"),mkdir:g(async function(t){throw new Error("not implemented")},"mkdir")},vi="legit",s3=g(({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 b=await i.getMaxAccessTokenForBranch(y);if(!b)throw new Error(`No access token for branch ${y}`);await ct.default.fetch({fs:t,http:lh,dir:e,singleBranch:!0,ref:`${y}`,remote:vi,url:r,headers:{Authorization:`${s}${b}`}});let _=await ct.default.resolveRef({fs:t,dir:e,ref:`${vi}/${y}`});await ct.default.writeRef({fs:t,dir:e,ref:`refs/heads/${y}`,value:_})}l(f,"l"),g(f,"loadBranch");let c=[];async function a(){let y=await i.getMaxAccessTokenForBranch("todo");await ct.default.fetch({fs:t,http:lh,dir:e,remote:vi,url:r,headers:{Authorization:`${s}${y}`}});let b=await ct.default.listBranches({fs:t,dir:e});for(let _ of b){if(_===n)continue;let F=`${vi}/${_}`,E,R;try{E=await ct.default.resolveRef({fs:t,dir:e,ref:_})}catch(D){console.log(`Could not resolve local ref ${_}:`,D)}try{R=await ct.default.resolveRef({fs:t,dir:e,ref:F})}catch{R=void 0}if(E&&R){if(E!==R){let D=await ct.default.findMergeBase({fs:t,dir:e,oids:[E,R]});if(D[0]!==E&&D[0]!==R){let S=await ct.default.merge({fs:t,dir:e,ours:E,theirs:R,fastForwardOnly:!1,abortOnConflict:!1,author:{name:"Your Name",email:"your.email@example.com"},mergeDriver:g(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 ct.default.writeRef({fs:t,dir:e,ref:`refs/heads/${_}`,value:S.oid,force:!0})}D[0]===E?(console.log(`branch ${_} differs - remote ahaed, not behind`),await ct.default.writeRef({fs:t,dir:e,ref:`refs/heads/${_}`,value:R,force:!0})):D[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,"m"),g(a,"pull");async function u(y){if((await i.getUser()).type!=="local")for(let b of y){let _=await i.getMaxAccessTokenForBranch(b);await ct.default.push({fs:t,http:lh,dir:e,remote:vi,url:r,ref:b,headers:{Authorization:`Bearer ${_}`}})}}l(u,"d"),g(u,"push");let h=Promise.resolve();async function d(y){h=h.then(()=>u(y)),await h}l(d,"h"),g(d,"sequentialPush");async function p(){await ct.default.getConfig({fs:t,dir:e,path:`remote.${vi}.fetch`})||await ct.default.setConfig({fs:t,dir:e,path:`remote.${vi}.fetch`,value:`+refs/heads/*:refs/remotes/${vi}/*`});try{await a();let y=[...new Set(c)].filter(b=>b.indexOf(n)===-1);await d(y),c=[]}catch(y){console.error("Error monitoring changes:",y)}finally{o&&setTimeout(p,1e3)}}l(p,"F"),g(p,"pullPushTick");function m(){o=!0,p()}l(m,"u"),g(m,"startSync");function w(){o=!1}return l(w,"v"),g(w,"stopSync"),{start:g(()=>{o||(m(),o=!0)},"start"),stop:g(()=>{w()},"stop"),isRunning:g(()=>o,"isRunning"),loadBranch:f,sequentialPush:d}},"createLegitSyncService"),o3=g((t,e)=>{let r={type:"local",id:"local",name:"Local User",email:"local@legitcontrol.com"};return{getUser:g(async()=>r,"getUser"),signInAnonymously:g(async()=>{r.type="anonymous",r.id=crypto.randomUUID(),r.email=`anonymous-sha1-${r.id}-@legitcontrol.com`},"signInAnonymously"),addAccessToken:g(async i=>{let n=await t.getUserTokens(r.id);n.accessTokens.push(i),await t.setUserTokens(r.id,n)},"addAccessToken"),getMaxAccessTokenForBranch:g(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 MA(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(MA,"et");g(MA,"encodeConfigJson");function LA(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(LA,"tt");g(LA,"decodeConfigJson");var uA="user.legit-tokens";function jA({storageFs:t,gitRoot:e}){return{getUserTokens:g(async r=>{let i=await Pg.default.getConfig({fs:t,dir:e,path:uA});return i?LA(i):{accessTokens:[]}},"getUserTokens"),setUserTokens:g(async(r,i)=>await Pg.default.setConfig({fs:t,dir:e,path:uA,value:MA(i)}),"setUserTokens")}}l(jA,"st");g(jA,"createGitConfigTokenStore");var wn,qA=(wn=class extends Error{constructor(e,r){super(e),W(this,"code","ENOENT"),W(this,"path"),this.name="ENOENTError",this.path=r,Object.setPrototypeOf(this,wn.prototype)}},l(wn,"se"),wn);g(qA,"ENOENTError");var Ng=qA;function Tc(t){return t&&t.gitCache!==void 0?t.gitCache:t&&t.parentFs?Tc(t.parentFs):{}}l(Tc,"ne");g(Tc,"getGitCacheFromFs");var Dg={type:"gitBranchFileVirtualFile",rootType:"folder",getStats:g(async({gitRoot:t,nodeFs:e,filePath:r,cacheFs:i,pathParams:n,userSpaceFs:s})=>{n.branchName===void 0&&(n.branchName=await me(t,e));let o=await ue(e,t,n.branchName);if(!o)throw new Ng(`ENOENT: no such file or directory, stat '${r}'`,r);let f=await So({filePath:r,gitRoot:t,nodeFs:e,commitSha:o,pathParams:n,gitCache:Tc(s)});if(!f)throw new Ng(`ENOENT: no such file or directory, stat '${r}'`,r);let c=await ae.default.readCommit({fs:e,dir:t,oid:o}),{commit:a}=c,u=await ae.default.log({fs:e,dir:t,ref:o,filepath:n.filePath,depth:1}),h=a.committer.timestamp*1e3,d=u.length>0?u[0].commit.committer.timestamp*1e3:h;if(f.type==="tree")return{mode:420,size:0,isFile:g(()=>!0,"isFile"),isDirectory:g(()=>!0,"isDirectory"),isSymbolicLink:g(()=>!1,"isSymbolicLink"),isBlockDevice:g(()=>!1,"isBlockDevice"),isCharacterDevice:g(()=>!1,"isCharacterDevice"),isSocket:g(()=>!1,"isSocket"),isFIFO:g(()=>!1,"isFIFO"),isFileSync:g(()=>!0,"isFileSync"),isDirectorySync:g(()=>!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:h,atime:new Date(d),mtime:new Date(d),ctime:new Date(d),birthtime:new Date(d)};{let{blob:p}=await ae.default.readBlob({fs:e,dir:t,oid:f.oid});return{mode:420,size:p.length,isFile:g(()=>!0,"isFile"),isDirectory:g(()=>!1,"isDirectory"),isSymbolicLink:g(()=>!1,"isSymbolicLink"),isBlockDevice:g(()=>!1,"isBlockDevice"),isCharacterDevice:g(()=>!1,"isCharacterDevice"),isSocket:g(()=>!1,"isSocket"),isFIFO:g(()=>!1,"isFIFO"),isFileSync:g(()=>!0,"isFileSync"),isDirectorySync:g(()=>!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:g(async({filePath:t,gitRoot:e,nodeFs:r,cacheFs:i,pathParams:n,userSpaceFs:s})=>{n.branchName===void 0&&(n.branchName=await me(e,r));try{let o=await ue(r,e,n.branchName);if(!o){let c=await ae.default.resolveRef({fs:r,dir:e,ref:"HEAD"});if(await ae.default.branch({fs:r,dir:e,ref:n.branchName,object:c}),o=await ue(r,e,n.branchName),!o)throw new Error("Could not create branch for getFile")}let f=await So({filePath:t,gitRoot:e,nodeFs:r,commitSha:o,pathParams:n,gitCache:Tc(s)});if(!f)return;if(f.type==="blob"){let{blob:c}=await ae.default.readBlob({fs:r,dir:e,oid:f.oid});return{type:"file",content:Buffer.from(c),mode:420,size:c.length,oid:f.oid}}else{let c=[];try{let a=await i.promises.stat(t);if(a&&a.isDirectory()){let u=await i.promises.readdir(t,{withFileTypes:!0});c.push(...u)}}catch{}return{type:"directory",content:Array.from(new Set([...c,...f.entries])).map(a=>({...a,name:a.name.toString(),path:`${t}`,parentPath:`${t}`})),mode:493}}}catch{return}},"getFile"),unlink:g(async({filePath:t,gitRoot:e,nodeFs:r,cacheFs:i,pathParams:n,author:s})=>{if(n.branchName===void 0&&(n.branchName=await me(e,r)),!n.filePath)throw new Error("filePath should be in pathParams");let o=await ue(r,e,n.branchName);if(!o)throw new Error("Invalid branch file path - branch must exist");let f=await ae.default.readTree({fs:r,dir:e,oid:o}),c=await Wr({dir:e,fs:r,treeOid:f.oid,deletePathParts:n.filePath.split("/"),addPathParts:void 0,addObj:void 0,deleteKeepIfNotEmpty:!1,addKeepIfEmpty:!0,keepFilename:".keep"});if(c!==f.oid){let a=await ae.default.commit({fs:r,dir:e,message:`Delete ${n.filePath}`,tree:c,noUpdateBranch:!0,parent:[o],author:s});await ae.default.writeRef({fs:r,dir:e,ref:`refs/heads/${lt(n.branchName)}`,value:a,force:!0})}},"unlink"),writeFile:g(async({filePath:t,gitRoot:e,nodeFs:r,content:i,cacheFs:n,pathParams:s,author:o})=>{if(s.branchName===void 0&&(s.branchName=await me(e,r)),s.filePath===void 0)throw new Error("filePath should be in pathParams");let f;typeof i=="string"?f=new TextEncoder().encode(i):f=new Uint8Array(i);let c=await ae.default.writeBlob({fs:r,dir:e,blob:f}),a=await ue(r,e,s.branchName);if(!a){let d=await ae.default.resolveRef({fs:r,dir:e,ref:"HEAD"});if(await ae.default.branch({fs:r,dir:e,ref:lt(s.branchName),object:d}),a=await ue(r,e,s.branchName),!a)throw new Error("Could not create branch for writeFile")}let u=await ae.default.readTree({fs:r,dir:e,oid:a}),h=await Wr({dir:e,fs:r,treeOid:u.oid,deletePathParts:void 0,addPathParts:s.filePath.split("/"),addObj:{type:"blob",oid:c},deleteKeepIfNotEmpty:!0,addKeepIfEmpty:!1,keepFilename:".keep"});if(h!==u.oid){let d=await ae.default.commit({fs:r,dir:e,message:`\u{1F4BE} Change '${s.filePath}'`,tree:h,noUpdateBranch:!0,parent:[a],author:o});await ae.default.writeRef({fs:r,dir:e,ref:`refs/heads/${lt(s.branchName)}`,value:d,force:!0});let p=await ue(r,e,s.branchName);if(d!==p)throw new Error("Failed to update branch after file deletion")}},"writeFile"),rename:g(async function({filePath:t,newPath:e,gitRoot:r,nodeFs:i,pathParams:n,newPathParams:s,author:o,userSpaceFs:f}){if(n.branchName===void 0&&(n.branchName=await me(r,i)),n.filePath===void 0)throw new Error("filePath should be in pathParams");if(s.branchName===void 0&&(s.branchName=await me(r,i)),s.filePath===void 0)throw new Error("filePath should be in newPathParams");let c=await ue(i,r,n.branchName);if(!c)throw new Error("Invalid branch file path - source branch must exist");let a=await ue(i,r,s.branchName);if(!a){let p=await ae.default.resolveRef({fs:i,dir:r,ref:"HEAD"});if(await ae.default.branch({fs:i,dir:r,ref:lt(s.branchName),object:p}),a=await ue(i,r,s.branchName),a===void 0)throw new Error("Could not create branch for rename operation")}if(s.branchName!==n.branchName)throw new Error("cross branch move not implemented yet");let u=await So({gitRoot:r,nodeFs:i,commitSha:c,filePath:t,pathParams:n,gitCache:Tc(f)});if(u===void 0)throw new Error("no obj at path exists");let h=await Wr({dir:r,fs:i,deletePathParts:n.filePath.split("/"),addPathParts:s.filePath.split("/"),addObj:u.type==="blob"?{type:"blob",oid:u.oid}:{type:"tree",oid:u.oid,entries:u.entries.map(p=>p.name.toString())},treeOid:a,addKeepIfEmpty:!0,deleteKeepIfNotEmpty:!0}),d=await ae.default.readTree({fs:i,dir:r,oid:c});if(h!==d.oid){let p=await ae.default.commit({fs:i,dir:r,message:`\u{1F500} Rename '${n.filePath}' to '${s.filePath}'`,tree:h,noUpdateBranch:!0,parent:[a],author:o});await ae.default.writeRef({fs:i,dir:r,ref:`refs/heads/${lt(s.branchName)}`,value:p,force:!0})}},"rename"),mkdir:g(async function(t){t.pathParams.branchName===void 0&&(t.pathParams.branchName=await me(t.gitRoot,t.nodeFs));let e=await ue(t.nodeFs,t.gitRoot,t.pathParams.branchName);if(t.pathParams.filePath===void 0&&(t.pathParams.filePath="/",e!==void 0))throw new Error("Folder exists");try{throw await Dg.getStats(t),new Error("Folder exists")}catch{}if(t.filePath.endsWith("/")&&(t.filePath=t.filePath.replace(/\/+$/,"")),t.pathParams&&typeof t.pathParams.filePath=="string"&&(t.pathParams.filePath=t.pathParams.filePath.replace(/\/+$/,"")),!e){let o=await ae.default.resolveRef({fs:t.nodeFs,dir:t.gitRoot,ref:"HEAD"});if(await ae.default.branch({fs:t.nodeFs,dir:t.gitRoot,ref:lt(t.pathParams.branchName),object:o}),e=await ue(t.nodeFs,t.gitRoot,t.pathParams.branchName),e===void 0)throw new Error("Could not create branch for mkdir operation")}let r=await ae.default.readTree({fs:t.nodeFs,dir:t.gitRoot,oid:e}),i=new Uint8Array(0),n=await ae.default.writeBlob({fs:t.nodeFs,dir:t.gitRoot,blob:i}),s=await Wr({dir:t.gitRoot,fs:t.nodeFs,treeOid:r.oid,deletePathParts:void 0,addPathParts:[...t.pathParams.filePath.split("/"),".keep"],addObj:{type:"blob",oid:n},deleteKeepIfNotEmpty:!0,addKeepIfEmpty:!0,keepFilename:".keep"});if(s!==r.oid){let o=await ae.default.commit({fs:t.nodeFs,dir:t.gitRoot,message:`\u{1F4BE} Change '${t.pathParams.filePath}'`,tree:s,noUpdateBranch:!0,parent:[e],author:t.author});await ae.default.writeRef({fs:t.nodeFs,dir:t.gitRoot,ref:`refs/heads/${lt(t.pathParams.branchName)}`,value:o,force:!0})}},"mkdir"),rmdir:g(async({filePath:t,gitRoot:e,nodeFs:r,cacheFs:i,pathParams:n,author:s})=>{if(n.branchName===void 0&&(n.branchName=await me(e,r)),!n.filePath)throw new Error("filePath should be in pathParams");let o=await ue(r,e,n.branchName);if(!o)throw new Error("Invalid branch file path - branch must exist");let f=await ae.default.readTree({fs:r,dir:e,oid:o}),c=await Wr({dir:e,fs:r,treeOid:f.oid,deletePathParts:n.filePath.split("/"),addPathParts:void 0,addObj:void 0,deleteKeepIfNotEmpty:!1,addKeepIfEmpty:!0,keepFilename:".keep"});if(c!==f.oid){let a=await ae.default.commit({fs:r,dir:e,message:`Delete ${n.filePath}`,tree:c,noUpdateBranch:!0,parent:[o],author:s});await ae.default.writeRef({fs:r,dir:e,ref:`refs/heads/${lt(n.branchName)}`,value:a,force:!0})}},"rmdir")},a3={type:"gitBranchesListVirtualFile",rootType:"folder",getStats:g(async({gitRoot:t,nodeFs:e})=>{let r=t+"/.git";try{return await e.promises.stat(r)}catch{throw new Error(`ENOENT: no such file or directory, stat '${r}'`)}},"getStats"),getFile:g(async({gitRoot:t,nodeFs:e,filePath:r})=>{try{let i=await Cg.default.listBranches({fs:e,dir:t}),n=await Promise.all(i.map(async s=>{let o=await Cg.default.resolveRef({fs:e,dir:t,ref:s});return Lt({parent:r,name:Po(s),isDir:!0})}));return{type:"directory",content:n,mode:493,size:n}}catch(i){throw i}},"getFile"),rename:g(async t=>{throw new Error("not implemented")},"rename"),mkdir:g(async function(t){throw new Error("not implemented")},"mkdir")};function mh(t){return t&&t.gitCache!==void 0?t.gitCache:t&&t.parentFs?mh(t.parentFs):{}}l(mh,"Oe");g(mh,"getGitCacheFromFs");var hA={type:"gitBranchHeadVirtualFile",rootType:"file",getStats:g(async({gitRoot:t,nodeFs:e,pathParams:r,userSpaceFs:i})=>{r.branchName===void 0&&(r.branchName=await me(t,e));let n=await ue(e,t,r.branchName);if(!n)throw new Error(`Branch ${r.branchName} does not exist in the repository`);let s=await _o.default.readCommit({fs:e,dir:t,oid:n,cache:mh(i)}),{commit:o}=s,f=o.committer.timestamp*1e3;return{mode:420,size:40,isFile:g(()=>!0,"isFile"),isDirectory:g(()=>!1,"isDirectory"),isSymbolicLink:g(()=>!1,"isSymbolicLink"),isBlockDevice:g(()=>!1,"isBlockDevice"),isCharacterDevice:g(()=>!1,"isCharacterDevice"),isSocket:g(()=>!1,"isSocket"),isFIFO:g(()=>!1,"isFIFO"),isFileSync:g(()=>!0,"isFileSync"),isDirectorySync:g(()=>!1,"isDirectorySync"),dev:0,ino:0,nlink:1,uid:0,gid:0,rdev:0,blksize:4096,blocks:Math.ceil(40/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:g(async({gitRoot:t,nodeFs:e,pathParams:r,userSpaceFs:i})=>{r.branchName===void 0&&(r.branchName=await me(t,e));try{let n;try{n=await _o.default.resolveRef({fs:e,dir:t,ref:r.branchName})}catch{n=await _o.default.resolveRef({fs:e,dir:t,ref:`refs/heads/${r.branchName}`})}return{type:"file",content:n+`
107
+ `,mode:420,size:n.length}}catch{return}},"getFile"),writeFile:g(async({filePath:t,gitRoot:e,nodeFs:r,content:i,cacheFs:n,pathParams:s,userSpaceFs:o})=>{console.log("gitBranchHeadVirtualFile writeFile called",{pathParams:s,content:i}),s.branchName===void 0&&(s.branchName=await me(e,r));let f=i.toString().trim();try{await _o.default.readCommit({fs:r,dir:e,oid:f,cache:mh(o)})}catch{throw new Error(`Commit ${f} does not exist in the repository`)}await _o.default.writeRef({fs:r,dir:e,ref:"refs/heads/"+s.branchName,value:f,force:!0})},"writeFile"),rename(t){throw new Error("not implementsd")},mkdir:g(async function(t){throw new Error("not implemented")},"mkdir")},dA={type:"legitVirtualFile",rootType:"folder",getStats:g(async({gitRoot:t,nodeFs:e})=>{let r=t+"/.git";try{return await e.promises.stat(r)}catch{throw new Error(`ENOENT: no such file or directory, stat '${r}'`)}},"getStats"),getFile:g(async({gitRoot:t,nodeFs:e})=>({type:"directory",content:[],mode:493,size:0}),"getFile"),rename(t){throw new Error("not implemented")},mkdir:g(async function(t){throw new Error("not implemented")},"mkdir")};function kc(t){return t&&t.gitCache!==void 0?t.gitCache:t&&t.parentFs?kc(t.parentFs):{}}l(kc,"ae");g(kc,"getGitCacheFromFs");var c3={type:"gitCommitFileVirtualFile",rootType:"file",getStats:g(async({filePath:t,gitRoot:e,nodeFs:r,pathParams:i,userSpaceFs:n})=>{if(!i.sha_1_1_2)throw new Error("sha_1_1_2 should be in pathParams");if(!i.sha1_3__40)throw new Error("sha1_3__40 should be in pathParams");let s=i.sha_1_1_2+i.sha1_3__40,o=await So({filePath:t,gitRoot:e,nodeFs:r,commitSha:s,pathParams:i,gitCache:kc(n)});if(!o)throw new Ng(`ENOENT: no such file or directory, stat '${t}'`,t);let f=await hh.default.readCommit({fs:r,dir:e,oid:s}),{commit:c}=f,a=c.committer.timestamp*1e3;if(o.type==="tree")return{mode:420,size:0,isFile:g(()=>!0,"isFile"),isDirectory:g(()=>!0,"isDirectory"),isSymbolicLink:g(()=>!1,"isSymbolicLink"),isBlockDevice:g(()=>!1,"isBlockDevice"),isCharacterDevice:g(()=>!1,"isCharacterDevice"),isSocket:g(()=>!1,"isSocket"),isFIFO:g(()=>!1,"isFIFO"),isFileSync:g(()=>!0,"isFileSync"),isDirectorySync:g(()=>!1,"isDirectorySync"),dev:0,ino:0,nlink:1,uid:0,gid:0,rdev:0,blksize:4096,blocks:0,atimeMs:a,mtimeMs:a,ctimeMs:a,birthtimeMs:a,atime:new Date(a),mtime:new Date(a),ctime:new Date(a),birthtime:new Date(a)};{let{blob:u}=await hh.default.readBlob({fs:r,dir:e,oid:o.oid});return{mode:420,size:u.length,isFile:g(()=>!0,"isFile"),isDirectory:g(()=>!1,"isDirectory"),isSymbolicLink:g(()=>!1,"isSymbolicLink"),isBlockDevice:g(()=>!1,"isBlockDevice"),isCharacterDevice:g(()=>!1,"isCharacterDevice"),isSocket:g(()=>!1,"isSocket"),isFIFO:g(()=>!1,"isFIFO"),isFileSync:g(()=>!0,"isFileSync"),isDirectorySync:g(()=>!1,"isDirectorySync"),dev:0,ino:0,nlink:1,uid:0,gid:0,rdev:0,blksize:4096,blocks:Math.ceil(u.length/4096),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:g(async({filePath:t,gitRoot:e,nodeFs:r,pathParams:i,userSpaceFs:n})=>{if(!i.sha_1_1_2)throw new Error("sha_1_1_2 should be in pathParams");if(!i.sha1_3__40)throw new Error("sha1_3__40 should be in pathParams");let s=i.sha_1_1_2+i.sha1_3__40;try{let o=await So({filePath:t,gitRoot:e,nodeFs:r,commitSha:s,pathParams:i,gitCache:kc(n)});if(!o)return;if(o.type==="blob"){let{blob:f}=await hh.default.readBlob({fs:r,dir:e,oid:o.oid,cache:kc(n)});return{type:"file",content:Buffer.from(f),mode:420,size:f.length,oid:o.oid}}else return{type:"directory",content:Array.from(new Set([...o.entries.filter(f=>f.name!==".keep")])).map(f=>({...f,name:f.name.toString(),path:`${t}`,parentPath:`${t}`})),mode:493}}catch{return}},"getFile"),rename(t){throw new Error("not implementsd")},mkdir:g(async function(t){throw new Error("not implemented")},"mkdir")},pA={type:"gitCommitVirtualFolder",rootType:"folder",getStats:g(async t=>{let e=t.gitRoot+"/.git";try{return await t.nodeFs.promises.stat(e)}catch{throw new Error(`ENOENT: no such file or directory, stat '${e}'`)}},"getStats"),getFile:g(async({filePath:t,gitRoot:e,nodeFs:r,pathParams:i})=>{let n=await dh.default.listBranches({fs:r,dir:e}),s=new Set,o=new Set;for(let a of n){let u=`refs/heads/${a}`;try{let h=await dh.default.resolveRef({fs:r,dir:e,ref:u});s.add(h)}catch{}}for(let a of s){let u=await dh.default.log({fs:r,dir:e,ref:a});for(let h of u)o.add(h.oid)}if(!i.sha_1_1_2){let a=new Set;for(let h of o)if(a.add(h.slice(0,2)),a.size>=256)break;let u=Array.from(a).sort().map(h=>Lt({parent:t,name:h,isDir:!0}));return{type:"directory",content:u,mode:493,size:u}}let f=new Set;for(let a of o)a.startsWith(i.sha_1_1_2)&&f.add(a.slice(2,40));let c=Array.from(f).sort().map(a=>Lt({parent:t,name:a,isDir:!0}));return{type:"directory",content:c,mode:493,size:c.length}},"getFile"),rename(t){throw new Error("not implementsd")},mkdir:g(async function(t){throw new Error("not implemented")},"mkdir")},mA={type:"gitBranchOperationVirtualFile",rootType:"file",getStats:g(async t=>{let{gitRoot:e,nodeFs:r,pathParams:i}=t;i.branchName===void 0&&(i.branchName=await me(e,r));let n=await ue(r,e,i.branchName);if(!n)throw new Error(`Base Branch ${i.branchName} for operations does not exis`);let s=await jt(r,e,i.branchName),o=!1;if(s)try{n=await rr.default.resolveRef({fs:r,dir:e,ref:s}),o=!0}catch{try{n=await rr.default.resolveRef({fs:r,dir:e,ref:`refs/heads/${s}`}),o=!0}catch{}}let f=await rr.default.readCommit({fs:r,dir:e,oid:n}),{commit:c}=f,a=c.committer.timestamp*1e3;try{return{mode:420,size:40,atimeMs:a,mtimeMs:a,ctimeMs:a,birthtimeMs:a,atime:new Date(a),mtime:new Date(a),ctime:new Date(a),birthtime:new Date(a),isFile:g(()=>!0,"isFile"),isDirectory:g(()=>!1,"isDirectory"),isSymbolicLink:g(()=>!1,"isSymbolicLink"),isBlockDevice:g(()=>!1,"isBlockDevice"),isCharacterDevice:g(()=>!1,"isCharacterDevice"),isSocket:g(()=>!1,"isSocket"),isFIFO:g(()=>!1,"isFIFO"),isFileSync:g(()=>!0,"isFileSync"),isDirectorySync:g(()=>!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:g(async t=>{let{gitRoot:e,nodeFs:r,pathParams:i}=t;i.branchName===void 0&&(i.branchName=await me(e,r));let n=await jt(r,e,i.branchName),s,o=!1;if(n){if(s=await ue(r,e,n),o=!0,!s)throw new Error(`Base Branch ${n} for operations does not exis`)}else if(s=await ue(r,e,i.branchName),!s)throw new Error(`Base Branch ${i.branchName} for operations does not exis`);return{type:"file",content:Buffer.from(s),mode:420,size:s.length}},"getFile"),writeFile:g(async({filePath:t,gitRoot:e,nodeFs:r,content:i,cacheFs:n,pathParams:s,author:o})=>{s.branchName===void 0&&(s.branchName=await me(e,r));let f;typeof i=="string"?f=new TextEncoder().encode(i):f=new Uint8Array(i);let c=await rr.default.writeBlob({fs:r,dir:e,blob:f}),a=await ue(r,e,s.branchName);if(!a)throw new Error("Invalid branch file path - branch doesn't exist");let u=await jt(r,e,s.branchName),h=!1;u||(u="legit/__"+s.branchName+$A,await rr.default.branch({fs:r,dir:e,ref:u,object:a}),h=!0);let d=await rr.default.resolveRef({fs:r,dir:e,ref:`refs/heads/${u}`}),p=await rr.default.readTree({fs:r,dir:e,oid:a}),m;i instanceof ArrayBuffer?m=Buffer.from(i).toString("utf-8"):typeof i=="string"?m=i:i instanceof Uint8Array?m=Buffer.from(i).toString("utf-8"):m=String(i);let w=!1;if(!h){let b=await rr.default.findMergeBase({fs:r,dir:e,oids:w?[d]:[d,a]});b.length===1&&b[0]===a&&(w=!0)}let y=await rr.default.commit({fs:r,dir:e,message:m,tree:p.oid,noUpdateBranch:!0,author:o,parent:w?h?[a,a]:[d]:[d,a]});await rr.default.writeRef({fs:r,dir:e,ref:`refs/heads/${u}`,value:y,force:!0})},"writeFile"),rename:g(async function({filePath:t,newPath:e,gitRoot:r,nodeFs:i,pathParams:n,newPathParams:s}){throw new Error("not implemented")},"rename"),mkdir:g(async function(t){throw new Error("not implemented")},"mkdir")},l3={type:"getThreadName",rootType:"file",getStats:g(async t=>{let{gitRoot:e,nodeFs:r,pathParams:i}=t,n=await ue(r,e,i.branchName);if(!n)throw new Error(`Base Branch ${i.branchName} for operations does not exis`);let s=await jt(r,e,i.branchName),o=!1;if(s)try{n=await Fc.default.resolveRef({fs:r,dir:e,ref:s}),o=!0}catch{try{n=await Fc.default.resolveRef({fs:r,dir:e,ref:`refs/heads/${s}`}),o=!0}catch{}}let f=await Fc.default.readCommit({fs:r,dir:e,oid:n}),{commit:c}=f,a=c.committer.timestamp*1e3;try{return{mode:420,size:40,atimeMs:a,mtimeMs:a,ctimeMs:a,birthtimeMs:a,atime:new Date(a),mtime:new Date(a),ctime:new Date(a),birthtime:new Date(a),isFile:g(()=>!0,"isFile"),isDirectory:g(()=>!1,"isDirectory"),isSymbolicLink:g(()=>!1,"isSymbolicLink"),isBlockDevice:g(()=>!1,"isBlockDevice"),isCharacterDevice:g(()=>!1,"isCharacterDevice"),isSocket:g(()=>!1,"isSocket"),isFIFO:g(()=>!1,"isFIFO"),isFileSync:g(()=>!0,"isFileSync"),isDirectorySync:g(()=>!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:g(async t=>{let{gitRoot:e,nodeFs:r,pathParams:i}=t,n=await jt(r,e,i.branchName),s;if(n){let o="legit/",f=`__${i.branchName}-operation`;return n.startsWith(o)&&n.endsWith(f)?s=n.slice(o.length,n.length-f.length):s=n,{type:"file",content:Buffer.from(CA(s)),mode:420,size:s.length}}return{type:"file",content:Buffer.from(""),mode:420,size:0}},"getFile"),writeFile:g(async({filePath:t,gitRoot:e,nodeFs:r,content:i,cacheFs:n,pathParams:s})=>{if(s.branchName===void 0)throw new Error("branchName should be in pathParams");let o=await jt(r,e,s.branchName);if(o){let f=`legit/${DA(i.toString())}__${s.branchName}-operation`;await Fc.default.renameBranch({fs:r,dir:e,oldref:o,ref:f}),o=f}},"writeFile"),rename:g(async function({filePath:t,newPath:e,gitRoot:r,nodeFs:i,pathParams:n,newPathParams:s}){throw new Error("not implemented")},"rename"),mkdir:g(async function(t){throw new Error("not implemented")},"mkdir")},wA={type:"gitBranchHistory",rootType:"file",getStats:g(async({gitRoot:t,nodeFs:e,pathParams:r})=>{r.branchName===void 0&&(r.branchName=await me(t,e));let i=await ue(e,t,r.branchName);if(!i)throw new Error(`Branch ${r.branchName} does not exist`);let n=await Ig.default.readCommit({fs:e,dir:t,oid:i}),{commit:s}=n,o=s.committer.timestamp*1e3;return{mode:420,size:1e5,isFile:g(()=>!0,"isFile"),isDirectory:g(()=>!1,"isDirectory"),isSymbolicLink:g(()=>!1,"isSymbolicLink"),isBlockDevice:g(()=>!1,"isBlockDevice"),isCharacterDevice:g(()=>!1,"isCharacterDevice"),isSocket:g(()=>!1,"isSocket"),isFIFO:g(()=>!1,"isFIFO"),isFileSync:g(()=>!0,"isFileSync"),isDirectorySync:g(()=>!1,"isDirectorySync"),dev:0,ino:0,nlink:1,uid:0,gid:0,rdev:0,blksize:4096,blocks:Math.ceil(40/4096),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:g(async t=>{let{gitRoot:e,nodeFs:r,pathParams:i}=t,n=i.branchName;n===void 0&&(n=await me(e,r));let s=[];if(n){let f=await ue(r,e,n),c=!1,a=f;for(;a&&!c;){let u=await Ig.default.readCommit({fs:r,dir:e,oid:a});s.push({oid:u.oid,...u.commit}),a=u.commit.parent[0]}}let o=Buffer.from(JSON.stringify(s,null,2),"utf-8");return{type:"file",content:o,mode:420,size:o.length}},"getFile"),rename:g(async t=>{throw new Error("not implemented")},"rename"),mkdir:g(async function(t){throw new Error("not implemented")},"mkdir")},yA={type:"gitBranchOperationHeadVirtualFile",rootType:"file",getStats:g(async({gitRoot:t,nodeFs:e,pathParams:r})=>{r.branchName===void 0&&(r.branchName=await me(t,e));let i=await jt(e,t,r.branchName);if(!i){let c=new Date(0);return{mode:420,size:0,isFile:g(()=>!0,"isFile"),isDirectory:g(()=>!1,"isDirectory"),isSymbolicLink:g(()=>!1,"isSymbolicLink"),isBlockDevice:g(()=>!1,"isBlockDevice"),isCharacterDevice:g(()=>!1,"isCharacterDevice"),isSocket:g(()=>!1,"isSocket"),isFIFO:g(()=>!1,"isFIFO"),isFileSync:g(()=>!0,"isFileSync"),isDirectorySync:g(()=>!1,"isDirectorySync"),dev:0,ino:0,nlink:1,uid:0,gid:0,rdev:0,blksize:4096,blocks:Math.ceil(40/4096),atimeMs:c.getTime(),mtimeMs:c.getTime(),ctimeMs:c.getTime(),birthtimeMs:c.getTime(),atime:c,mtime:c,ctime:c,birthtime:c}}let n;try{n=await vr.default.resolveRef({fs:e,dir:t,ref:i})}catch{n=await vr.default.resolveRef({fs:e,dir:t,ref:`refs/heads/${i}`})}let s=await vr.default.readCommit({fs:e,dir:t,oid:n}),{commit:o}=s,f=o.committer.timestamp*1e3;return{mode:420,size:40,isFile:g(()=>!0,"isFile"),isDirectory:g(()=>!1,"isDirectory"),isSymbolicLink:g(()=>!1,"isSymbolicLink"),isBlockDevice:g(()=>!1,"isBlockDevice"),isCharacterDevice:g(()=>!1,"isCharacterDevice"),isSocket:g(()=>!1,"isSocket"),isFIFO:g(()=>!1,"isFIFO"),isFileSync:g(()=>!0,"isFileSync"),isDirectorySync:g(()=>!1,"isDirectorySync"),dev:0,ino:0,nlink:1,uid:0,gid:0,rdev:0,blksize:4096,blocks:Math.ceil(40/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:g(async({gitRoot:t,nodeFs:e,pathParams:r})=>{r.branchName===void 0&&(r.branchName=await me(t,e));let i=await jt(e,t,r.branchName);if(!i)return{type:"file",content:"",mode:420,size:0};try{let n;try{n=await vr.default.resolveRef({fs:e,dir:t,ref:i})}catch{n=await vr.default.resolveRef({fs:e,dir:t,ref:`refs/heads/${i}`})}return{type:"file",content:n+`
108
+ `,mode:420,size:n.length}}catch{return}},"getFile"),writeFile:g(async({filePath:t,gitRoot:e,nodeFs:r,content:i,cacheFs:n,pathParams:s})=>{s.branchName===void 0&&(s.branchName=await me(e,r));let o=await jt(r,e,s.branchName),f=await vr.default.resolveRef({fs:r,dir:e,ref:`refs/heads/${o}`});if(!o)throw new Error(`Operation branch name could not be resolved for branch ${s.branchName}`);let c=i.toString().trim(),a,u,h=!1;if(!f)throw new Error(`Operation branch ref could not be resolved for branch ${o}`);let d=f;for(;d&&!h;){let p=await vr.default.readCommit({fs:r,dir:e,oid:d});if(p.oid===c&&(a=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(a!==void 0){u=p.commit.parent[1];break}}}if(a===void 0)throw new Error(`Cant rollback to ${c} couldn't find newOperationBranchHead ${a}`);if(u===void 0)throw new Error(`Cant rollback to ${c} couldn't find newBranchHead ${u}`);await vr.default.writeRef({fs:r,dir:e,ref:"refs/heads/"+o,value:a,force:!0}),await vr.default.writeRef({fs:r,dir:e,ref:"refs/heads/"+s.branchName,value:u,force:!0})},"writeFile"),rename(t){throw new Error("not implementsd")},mkdir:g(async function(t){throw new Error("not implemented")},"mkdir")};async function yh(t,e){try{let r=await wh.default.getConfig({fs:e,dir:t,path:"user.legit-target-branch"});if(r)return Po(r)}catch{}try{let r=await wh.default.getConfig({fs:e,dir:t,path:"init.defaultBranch"});return Po(r)||"main"}catch{return"main"}}l(yh,"q");g(yh,"getTargetBranch");async function WA(t,e,r){await wh.default.setConfig({fs:e,dir:t,path:"user.legit-target-branch",value:lt(r)})}l(WA,"ct");g(WA,"setTargetBranch");var f3={type:"gitCurrentBranchVirtualFile",rootType:"file",getStats:g(async({gitRoot:t,nodeFs:e})=>{let r=(await me(t,e)).length;return{mode:420,size:r,isFile:g(()=>!0,"isFile"),isDirectory:g(()=>!1,"isDirectory"),isSymbolicLink:g(()=>!1,"isSymbolicLink"),isBlockDevice:g(()=>!1,"isBlockDevice"),isCharacterDevice:g(()=>!1,"isCharacterDevice"),isSocket:g(()=>!1,"isSocket"),isFIFO:g(()=>!1,"isFIFO"),isFileSync:g(()=>!0,"isFileSync"),isDirectorySync:g(()=>!1,"isDirectorySync"),dev:0,ino:0,nlink:1,uid:0,gid:0,rdev:0,blksize:4096,blocks:Math.ceil(r/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:g(async({gitRoot:t,nodeFs:e})=>{let r=await me(t,e);return{type:"file",content:r+`
109
+ `,mode:420,size:r.length+1}},"getFile"),writeFile:g(async({gitRoot:t,nodeFs:e,content:r})=>{let i=r.toString().trim();if(!await ue(e,t,i)){let n=await yh(t,e),s=await ue(e,t,n);if(!s)throw new Error(`Ref branch ${n} does not exist in the repository`);await UA.default.branch({fs:e,dir:t,ref:lt(i),object:s})}await BA(t,e,i)},"writeFile"),rename(t){throw new Error("not implemented")},mkdir:g(async function(t){throw new Error("not implemented")},"mkdir")},Er="session_data",fh=JSON.stringify({env:{CLAUDE_CONFIG_DIR:`.claude/${Er}`}},null,2),u3={type:"claudeVirtualSessionFileVirtualFile",rootType:"folder",getStats:g(async({gitRoot:t,nodeFs:e,filePath:r,cacheFs:i,pathParams:n})=>{let s=r.replace(/\\/g,"/");if(s.endsWith(".claude")||s.endsWith(`.claude/${Er}`)||s.endsWith(`.claude/${Er}/debug`)||s.endsWith(`.claude/${Er}/projects`)||new RegExp(`\\.claude\\/${Er}\\/projects\\/[^/]+$`).test(s)){let f=new Date(0);return{mode:16877,size:0,isFile:g(()=>!1,"isFile"),isDirectory:g(()=>!0,"isDirectory"),isSymbolicLink:g(()=>!1,"isSymbolicLink"),isBlockDevice:g(()=>!1,"isBlockDevice"),isCharacterDevice:g(()=>!1,"isCharacterDevice"),isSocket:g(()=>!1,"isSocket"),isFIFO:g(()=>!1,"isFIFO"),dev:0,ino:0,nlink:1,uid:0,gid:0,rdev:0,blksize:4096,blocks:0,atimeMs:0,mtimeMs:0,ctimeMs:0,birthtimeMs:0,atime:f,mtime:f,ctime:f,birthtime:f}}let o=new Date(0);return s.endsWith(".claude/settings.json")?{mode:420,size:fh.length,isFile:g(()=>!0,"isFile"),isDirectory:g(()=>!1,"isDirectory"),isSymbolicLink:g(()=>!1,"isSymbolicLink"),isBlockDevice:g(()=>!1,"isBlockDevice"),isCharacterDevice:g(()=>!1,"isCharacterDevice"),isSocket:g(()=>!1,"isSocket"),isFIFO:g(()=>!1,"isFIFO"),isFileSync:g(()=>!0,"isFileSync"),isDirectorySync:g(()=>!1,"isDirectorySync"),dev:0,ino:0,nlink:1,uid:0,gid:0,rdev:0,blksize:4096,blocks:Math.ceil(fh.length/4096),atimeMs:o,mtimeMs:o,ctimeMs:o,birthtimeMs:o,atime:o,mtime:o,ctime:o,birthtime:o}:await i.promises.stat(r)},"getStats"),getFile:g(async({filePath:t,gitRoot:e,nodeFs:r,cacheFs:i,pathParams:n})=>{let s=t.replace(/\\/g,"/");if((s.endsWith(".claude")||s.endsWith(".claude/session_data")||s.endsWith(".claude/session_data/projects")||s.endsWith(".claude/session_data/debug")||/\.claude\/session_data\/projects\/[^/]+$/.test(s))&&await i.promises.mkdir(t,{recursive:!0}),s.endsWith(".claude/settings.json"))return{type:"file",content:fh,mode:420,size:fh.length,oid:"unknown"};try{if((await i.promises.stat(t)).isFile()){let o=await i.promises.readFile(t);return{type:"file",content:o,mode:420,size:o.length,oid:"unknown"}}else{let o=await i.promises.readdir(t,{withFileTypes:!0});if(s.endsWith(".claude")){let f=o.find(a=>a.name.toString()==="settings.json");f||o.push(Lt({name:"settings.json",parent:t,isDir:!1}));let c=o.find(a=>a.name.toString()===Er);f||o.push(Lt({name:Er,parent:t,isDir:!0}))}if(s.endsWith(`.claude/${Er}`)&&(o.find(f=>f.name.toString()==="projects")||o.push(Lt({name:"projects",parent:t,isDir:!0}))),s.endsWith(`.claude/${Er}/projects`)&&!o.find(f=>f.name.toString()==="projects")){let f=s.replace(`.claude/${Er}/projects`,"");o.push(Lt({name:f.replaceAll("/","-"),parent:t,isDir:!0}))}return{type:"directory",content:o.map(f=>({...f,name:f.name.toString(),path:`${t}`,parentPath:`${t}`})),mode:493}}}catch{return}},"getFile"),unlink:g(async({filePath:t,gitRoot:e,nodeFs:r,cacheFs:i,pathParams:n,author:s})=>{await i.promises.unlink(t)},"unlink"),writeFile:g(async({filePath:t,gitRoot:e,nodeFs:r,content:i,cacheFs:n,userSpaceFs:s,pathParams:o,author:f})=>{let c=t.replace(/\\/g,"/"),a=/\/projects\/([^/]+)\/([^/]+\.jsonl)$/,u=c.match(a);if(u){let h=u[1],d=u[2];console.log({folder:h,file:d}),await n.promises.stat(t).then(()=>!0).catch(()=>!1)||await n.promises.writeFile(t,"");let p=(await n.promises.readFile(t,"utf-8")).split(`
110
+ `);if(p.length>1){let m=p[p.length-2]||"",w=JSON.parse(m),y="";if(w.type==="user"){let b=w.message?.content;if(Array.isArray(b)&&b[0]?.type==="tool_result"){let _=b[0],F=typeof _.content=="string"?_.content:JSON.stringify(_.content);y=`\u{1F47E} Tool Result (${w.toolUseResult?.type||"unknown"}): ${F}
111
+
112
+ ---
113
+
114
+ `}else y=`\u{1F464} ${typeof b=="string"?b:b?.[0]?.content||"User action"}
115
+
116
+ ---
117
+
118
+ `}else if(w.type==="assistant"){let b=w.message?.content?.[0],_="";b?.type==="text"?_=b.text:b?.type==="tool_use"?_=`Used tool: ${b.name} with input: ${JSON.stringify(b.input)}`:_="Assistant response",y=`\u{1F47E} ${_}
119
+
120
+ ---
121
+
122
+ `}else w.type==="file-history-snapshot"?y=`System: File history snapshot for message ${w.messageId}
123
+
124
+ ---
125
+
126
+ `:y=`System: ${w.type||"unknown action"}
127
+
128
+ ---
129
+
130
+ `;await s.promises.writeFile(e+"/.legit/operation",y+m)}}else console.log("No match"),await n.promises.writeFile(t,i)},"writeFile"),rename:g(async function({filePath:t,newPath:e,gitRoot:r,nodeFs:i,pathParams:n,newPathParams:s,author:o,cacheFs:f}){await f.promises.rename(t,e)},"rename"),mkdir:g(async function(t){await t.cacheFs.promises.mkdir(t.filePath,{recursive:!0})},"mkdir"),rmdir:g(async({filePath:t,gitRoot:e,nodeFs:r,cacheFs:i,pathParams:n,author:s})=>{},"rmdir")};function gh(t){return t&&t.gitCache!==void 0?t.gitCache:t&&t.parentFs?gh(t.parentFs):{}}l(gh,"$e");g(gh,"getGitCacheFromFs");var h3={type:"gitApplyCurrentChangesToVirtualFile",rootType:"file",getStats:g(async({gitRoot:t,nodeFs:e,pathParams:r,userSpaceFs:i})=>{let n=new Date(0);return{mode:420,size:40,isFile:g(()=>!0,"isFile"),isDirectory:g(()=>!1,"isDirectory"),isSymbolicLink:g(()=>!1,"isSymbolicLink"),isBlockDevice:g(()=>!1,"isBlockDevice"),isCharacterDevice:g(()=>!1,"isCharacterDevice"),isSocket:g(()=>!1,"isSocket"),isFIFO:g(()=>!1,"isFIFO"),isFileSync:g(()=>!0,"isFileSync"),isDirectorySync:g(()=>!1,"isDirectorySync"),dev:0,ino:0,nlink:1,uid:0,gid:0,rdev:0,blksize:4096,blocks:Math.ceil(40/4096),atimeMs:n,mtimeMs:n,ctimeMs:n,birthtimeMs:n,atime:n,mtime:n,ctime:n,birthtime:n}},"getStats"),getFile:g(async({gitRoot:t,nodeFs:e,pathParams:r,userSpaceFs:i})=>{try{return{type:"file",content:`
131
+ `,mode:420,size:2}}catch{return}},"getFile"),writeFile:g(async({gitRoot:t,nodeFs:e,content:r,userSpaceFs:i,author:n})=>{let s=await me(t,e),o=r.toString().trim(),f=await ue(e,t,s,gh(i));if(!f)throw new Error(`Source branch ${s} does not exist`);let c=await ue(e,t,o,gh(i));if(!c)throw new Error(`Target branch ${o} does not exist`);let a=await pn.default.readTree({fs:e,dir:t,oid:f});if(await pn.default.readTree({fs:e,dir:t,oid:c})===a)return;let u=await pn.default.commit({fs:e,dir:t,message:"Changes from "+s+" applied to "+o,tree:a.oid,noUpdateBranch:!0,author:n,parent:[f,c]}),h=await pn.default.commit({fs:e,dir:t,message:"Changes from "+s+" applied to "+o,tree:a.oid,noUpdateBranch:!0,author:n,parent:[f,u]});await pn.default.writeRef({fs:e,dir:t,ref:"refs/heads/"+lt(o),value:u,force:!0}),await pn.default.writeRef({fs:e,dir:t,ref:"refs/heads/"+lt(s),value:h,force:!0})},"writeFile"),rename(t){throw new Error("not implementsd")},mkdir:g(async function(t){throw new Error("not implemented")},"mkdir")},d3={type:"gitTargetBranchVirtualFile",rootType:"file",getStats:g(async({gitRoot:t,nodeFs:e})=>{let r=(await yh(t,e)).length;return{mode:420,size:r,isFile:g(()=>!0,"isFile"),isDirectory:g(()=>!1,"isDirectory"),isSymbolicLink:g(()=>!1,"isSymbolicLink"),isBlockDevice:g(()=>!1,"isBlockDevice"),isCharacterDevice:g(()=>!1,"isCharacterDevice"),isSocket:g(()=>!1,"isSocket"),isFIFO:g(()=>!1,"isFIFO"),isFileSync:g(()=>!0,"isFileSync"),isDirectorySync:g(()=>!1,"isDirectorySync"),dev:0,ino:0,nlink:1,uid:0,gid:0,rdev:0,blksize:4096,blocks:Math.ceil(r/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:g(async({gitRoot:t,nodeFs:e})=>{let r=await yh(t,e);return{type:"file",content:r+`
132
+ `,mode:420,size:r.length+1}},"getFile"),writeFile:g(async({gitRoot:t,nodeFs:e,content:r})=>{let i=r.toString().trim();if(!await ue(e,t,i))throw new Error(`Branch ${i} does not exist in the repository`);await WA(t,e,i)},"writeFile"),rename(t){throw new Error("not implemented")},mkdir:g(async function(t){throw new Error("not implemented")},"mkdir")};function bh(t){return t&&t.gitCache!==void 0?t.gitCache:t&&t.parentFs?bh(t.parentFs):{}}l(bh,"xe");g(bh,"getGitCache");async function p3(t){let e=new Th.Volume,r=(0,Th.createFsFromVolume)(e);return kh({...t,storageFs:t?.storageFs?t.storageFs:r,gitRoot:t?.gitRoot||"/"})}l(p3,"hn");g(p3,"openLegitFsWithMemoryFs");async function kh({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://sync.legitcontrol.com",publicKey:o,claudeHandler:f}){await t.promises.readdir(e+"/.git").then(()=>!0).catch(()=>!1)||(await et.default.init({fs:t,dir:"/",defaultBranch:r}),await t.promises.writeFile(e+"/.keep",""),await et.default.add({fs:t,dir:"/",filepath:".keep",cache:bh(t)}),await et.default.commit({fs:t,dir:"/",message:"Initial commit",author:{name:"Test",email:"test@example.com"},cache:bh(t)}),await et.default.setConfig({fs:t,dir:e,path:"init.defaultBranch",value:r})),await et.default.getConfig({fs:t,dir:e,path:"user.legit_user_id"})||await et.default.setConfig({fs:t,dir:e,path:"user.legit_user_id",value:n.name}),await et.default.getConfig({fs:t,dir:e,path:"user.name"})||await et.default.setConfig({fs:t,dir:e,path:"user.name",value:n.name}),await et.default.getConfig({fs:t,dir:e,path:"user.email"})||await et.default.setConfig({fs:t,dir:e,path:"user.email",value:n.email});let c=new Y4({name:"git",storageFs:t,gitRoot:e,defaultBranch:r});c.gitCache={};let a={".legit":{".":dA,operation:mA,head:hA,operationHead:yA,operationHistory:Ag,history:wA,currentBranch:f3,"target-branch":d3,"apply-changes":h3,branches:{".":a3,"[branchName]":{".legit":{".":dA,operation:mA,head:hA,operationHead:yA,operationHistory:Ag,history:wA,threadName:l3},"[[...filePath]]":Dg}},commits:{".":pA,"[sha_1_1_2]":{".":pA,"[sha1_3__40]":{"[[...filePath]]":c3}}}},".claude":{"[[...filePath]]":u3},"[[...filePath]]":Dg};!f&&a[".claude"]&&delete a[".claude"];let u=new n3({name:"git-subfs",parentFs:c,gitRoot:e,gitStorageFs:t,routerConfig:a}),h=i?[".git"]:[".git",".keep"],d=new Z4({name:"git-hidden-subfs",parentFs:c,gitRoot:e,hiddenFiles:h}),p=new Q4({name:"git-ephemeral-subfs",parentFs:c,gitRoot:e,ephemeralPatterns:["**/._*","**/.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-**"]});c.addSubFs(u),c.setHiddenFilesSubFs(d),c.setEphemeralFilesSubFs(p);let m=jA({storageFs:t,gitRoot:e}),w=o3(m,o),y=s3({fs:t,gitRepoPath:e,serverUrl:s,auth:w,anonymousBranch:r}),b=Object.assign(c,{auth:w,sync:y,setLogger(_){c.setLoggger(_)},push:g(async _=>{},"push"),shareCurrentBranch:g(async()=>{if((await w.getUser()).type==="local")throw new Error("login first - for example anonymously using legitfs.auth.signInAnonymously()");let _=await b.getCurrentBranch();return _===r&&(_=(await w.getUser()).id,await et.default.renameBranch({fs:t,dir:e,oldref:r,ref:_})),await y.sequentialPush([_]),b.setCurrentBranch(_),_},"shareCurrentBranch"),setCurrentBranch:g(async _=>{(await et.default.listBranches({fs:t,dir:e})).includes(_)||await y?.loadBranch(_);let F=(await et.default.listBranches({fs:t,dir:e})).includes(_);if(console.log("branchExistsAfter",F),!F)throw new Error(`Branch ${_} does not exist`);await et.default.setConfig({fs:t,dir:e,path:"init.defaultBranch",value:_})},"setCurrentBranch"),getCurrentBranch:g(async()=>{let _=await et.default.getConfig({fs:t,dir:e,path:"init.defaultBranch"});if(!_)throw new Error("No current branch set");return _},"getCurrentBranch")});return b}l(kh,"Lt");g(kh,"openLegitFs");var oY=g(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("/"),o=s.join("/"),f=r+".legit/branches/"+n+"/.legit/operation",c=JSON.stringify(e.operationArgs,(a,u)=>Buffer.isBuffer(u)?{__buffer__:u.toString("base64")}:u);console.log(f,`[${e.fsName}].${e.operation}(${e.fd?e.fd.fd+" - ":""}${e.path})
106
133
 
107
- ${o}
134
+ ${c}
108
135
 
109
- `)},"createFsOperationFileLogger");var gO=ce(hO(),1);import{createContext as l8,useContext as f8,useEffect as u8,useMemo as h8,useState as ry,useCallback as Hu}from"react";import{jsx as m8}from"react/jsx-runtime";var No="main",li="/.legit/branches",pO="/.legit/commits",dO=l(t=>(t.startsWith("/")&&(t=t.slice(1)),`${li}/${No}/${t}`),"resolveThreadPath"),d8=l(t=>t instanceof Error?t:new Error(String(t??"Unknown error")),"normalizeError"),mO=l8(void 0);function p8({children:t}){let[e,r]=ry(null),[i,n]=ry(!0),[s,a]=ry(null);u8(()=>{let d=!1,p=l(async()=>{try{let m=await fi();d||(r(m),a(null),n(!1))}catch(m){if(!d){let w=d8(m);r(null),a(w),n(!1)}}},"load");return n(!0),a(null),p(),()=>{d=!0}},[]);let f=Hu(async(d,p)=>{if(e){let m=dO(d);await e.promises.writeFile(m,p)}},[e]),o=Hu(async d=>{if(e){let p=await Xs(No);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]),c=Hu(async(d,p)=>{if(e)return await yO(d,p)},[e]),u=Hu(async d=>(e&&(console.log("rollback",d),await wO(No,d)),await Vu(No)),[e]),h=h8(()=>({legitFs:e,loading:i,error:s,saveData:f,getMessageDiff:o,getPastState:c,rollback:u,threadId:No,resolvePath:dO}),[e,i,s,f]);return m8(mO.Provider,{value:h,children:t})}l(p8,"LegitFsProvider");function iy(){let t=f8(mO);if(t===void 0)throw new Error("useLegitFs must be used within a LegitFsProvider");return t}l(iy,"useLegitFs");var Gu=null;async function fi(){return Gu||(Gu=Qf({storageFs:gO.default,gitRoot:"/"}),window&&(window.legitFs=await Gu)),Gu}l(fi,"getLegitFs");async function bO(){let t=await fi();try{return(await t.promises.readdir(li)).filter(r=>!r.startsWith("."))}catch(e){if(e.code==="ENOENT")return await t.promises.mkdir(li,{recursive:!0}),[];throw e}}l(bO,"listBranches");async function Vu(t){try{return await(await fi()).promises.readFile(`${li}/${t}/.legit/head`,"utf8")}catch(e){throw console.error("Error reading head from path:",t,e),e}}l(Vu,"readHead");async function wO(t,e){try{await(await fi()).promises.writeFile(`${li}/${t}/.legit/operationHead`,e,"utf8")}catch(r){throw console.error("Error writing head to path:",t,r),r}}l(wO,"writeOperationHead");async function _O(t,e){try{await(await fi()).promises.writeFile(`${li}/${t}/.legit/operation`,e,"utf8")}catch(r){throw console.error("Error writing operation to path:",t,r),r}}l(_O,"writeOperation");async function Xs(t){try{let r=await(await fi()).promises.readFile(`${li}/${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(Xs,"readOperationHistory");async function yO(t,e){try{e.startsWith("/")&&(e=e.slice(1));let r=await fi(),i=`${pO}/${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(yO,"readPastState");var Ku=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 ny=class ny{async list(e,r){let i=await Xs(e);return{messages:(await Ku(i)).map((a,f)=>({...a,height:f,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 _O(e,JSON.stringify(n)),{message_id:i}}};l(ny,"LegitThreadMessages");var Ju=ny;var sy=class sy{constructor(){G(this,"messages",new Ju)}async list(e){return{threads:(await bO()).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(sy,"LegitThreads");var Xu=sy;var oy=class oy extends ah{constructor(r){super(r);G(this,"runtime");G(this,"legitFs",null);this.legitFs=r.legitFs,this.threads=new Xu;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??{},o=new Headers;o.set("Content-Type","application/json");try{let c=await fetch(f.api??"/api/chat",{method:"POST",headers:o,credentials:f.credentials??"same-origin",body:JSON.stringify({messages:n.messages,system:n.system,tools:n.tools,runConfig:f.runConfig??{}})});if(!c.ok)throw new Error(`Request failed with status ${c.status}`);return fr.fromResponse(c,new ca)}catch(c){return console.error("LegitLocal stream failed, falling back to default handler.",c),i.call(this.runs,n)}}}};l(oy,"LegitLocal");var ay=oy;import{ExportedMessageRepository as w8}from"@assistant-ui/react";var y8=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"),g8="aui/v0";function b8(t){if(t.format!==g8)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=y8(t.metadata);return{...e,role:r,content:n,id:e.id??t.id,createdAt:s,metadata:a}}l(b8,"toThreadMessageLike");async function cy({threadId:t,threadApi:e}){console.log("sync initiated");let r=await Xs(t),n=(await Ku(r)).map(b8).filter(s=>s!==null);e?.reset?.(n),e.import(w8.fromArray(n))}l(cy,"syncThreadFromLegitFs");var vO=l(t=>{if(typeof t=="string")return t;if(t===void 0)return"";try{return JSON.stringify(t)}catch{return""}},"serializeStructuredData");var Do=l(t=>t==null?null:typeof t=="string"||typeof t=="number"||typeof t=="boolean"?t:Array.isArray(t)?t.map(e=>Do(e)):typeof t=="object"?Object.fromEntries(Object.entries(t).map(([e,r])=>[e,Do(r)])):JSON.stringify(t),"toJsonValue"),_8=l((t,e)=>e?typeof t=="string"?{type:"error-text",value:t}:{type:"error-json",value:Do(t)}:typeof t=="string"?{type:"text",value:t}:{type:"json",value:Do(t)},"buildToolResultOutput"),v8=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:Do(t.args??t.input??{})};default:return null}},"mapAssistantContentPart"),E8=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:_8(t.result??t.output,!!t.isError)},"mapToolContentPart"),W5=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=>v8(n)).filter(Boolean)};case"tool":{let i=r.map(n=>E8(n)).filter(Boolean);return i.length>0?{role:"tool",content:i}:null}default:return null}}).filter(e=>e!==null),"convertMessagesToModelMessages");async function z5(t){let[e,r]=oa();(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 f=a.id;if(!s.has(f)){let o=r.addToolCallPart({toolCallId:f,toolName:a.toolName});s.set(f,o)}break}case"tool-input-delta":{let f=a.id,o=s.get(f);o&&o.argsText.append(a.delta);break}case"tool-input-end":{let f=a.id,o=s.get(f);o&&o.argsText.close();break}case"tool-call":{let f=a.toolCallId;if(!s.get(f)){let c=r.addToolCallPart({toolCallId:f,toolName:a.toolName,args:a.input});s.set(f,c)}break}case"tool-result":{let f=a.toolCallId,o=s.get(f);o&&o.setResponse({result:vO(a.output),isError:!1});break}case"tool-error":{let f=a.toolCallId,o=s.get(f);o&&o.setResponse({result:vO(a.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=a.usage;r.enqueue({type:"step-finish",path:[],finishReason:a.finishReason,usage:{promptTokens:f.promptTokens??f.prompt?.tokens??0,completionTokens:f.completionTokens??f.completion?.tokens??0},isContinued:!1});break}case"finish":{let f=a.totalUsage;r.enqueue({type:"message-finish",path:[],finishReason:a.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: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 sh;return fr.toResponse(e,i)}l(z5,"streamTextToDataStreamResponse");import{useEffect as S8}from"react";import{useAssistantApi as F8}from"@assistant-ui/react";var T8=100;function Z5(){let{legitFs:t,threadId:e}=iy(),i=F8().thread();return S8(()=>{if(!t||!e)return;let n=!1,s,a=null,f=l(()=>{n||(s=setTimeout(o,T8))},"scheduleNext"),o=l(async()=>{try{let c=await Vu(e);if(n||c===a)return;let{isRunning:u,isLoading:h}=i.getState();if(u||h)return;setTimeout(async()=>{await cy({threadId:e,threadApi:i}),a=c},100)}catch(c){c.code!=="ENOENT"&&console.error("Failed to poll Legit head",c)}finally{f()}},"tick");return f(),()=>{n=!0,s!==void 0&&clearTimeout(s)}},[t,i,e]),null}l(Z5,"LegitFsHeadPoller");export{Z5 as LegitFsHeadPoller,p8 as LegitFsProvider,ay as LegitLocal,W5 as convertMessagesToModelMessages,z5 as streamTextToDataStreamResponse,cy as syncThreadFromLegitFs,iy as useLegitFs};
136
+ `)},"createFsOperationFileLogger");var XP=ce(zP(),1);import{createContext as w5,useContext as y5,useEffect as g5,useMemo as b5,useState as O0,useCallback as gd}from"react";import{jsx as v5}from"react/jsx-runtime";var $c="main",Oi="/.legit/branches",VP="/.legit/commits",HP=l(t=>(t.startsWith("/")&&(t=t.slice(1)),`${Oi}/${$c}/${t}`),"resolveThreadPath"),_5=l(t=>t instanceof Error?t:new Error(String(t??"Unknown error")),"normalizeError"),GP=w5(void 0);function S5({children:t}){let[e,r]=O0(null),[i,n]=O0(!0),[s,o]=O0(null);g5(()=>{let d=!1,p=l(async()=>{try{let m=await xi();d||(r(m),o(null),n(!1))}catch(m){if(!d){let w=_5(m);r(null),o(w),n(!1)}}},"load");return n(!0),o(null),p(),()=>{d=!0}},[]);let f=gd(async(d,p)=>{if(e){let m=HP(d);await e.promises.writeFile(m,p)}},[e]),c=gd(async d=>{if(e){let p=await zo($c);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],b=w?.originBranchOid;return!y||!b?void 0:{newOid:y,oldOid:b}}},[e]),a=gd(async(d,p)=>{if(e)return await KP(d,p)},[e]),u=gd(async d=>(e&&(console.log("rollback",d),await JP($c,d)),await bd($c)),[e]),h=b5(()=>({legitFs:e,loading:i,error:s,saveData:f,getMessageDiff:c,getPastState:a,rollback:u,threadId:$c,resolvePath:HP}),[e,i,s,f]);return v5(GP.Provider,{value:h,children:t})}l(S5,"LegitFsProvider");function x0(){let t=y5(GP);if(t===void 0)throw new Error("useLegitFs must be used within a LegitFsProvider");return t}l(x0,"useLegitFs");var _d=null;async function xi(){return _d||(_d=kh({storageFs:XP.default,gitRoot:"/"}),window&&(window.legitFs=await _d)),_d}l(xi,"getLegitFs");async function YP(){let t=await xi();try{return(await t.promises.readdir(Oi)).filter(r=>!r.startsWith("."))}catch(e){if(e.code==="ENOENT")return await t.promises.mkdir(Oi,{recursive:!0}),[];throw e}}l(YP,"listBranches");async function bd(t){try{return await(await xi()).promises.readFile(`${Oi}/${t}/.legit/head`,"utf8")}catch(e){throw console.error("Error reading head from path:",t,e),e}}l(bd,"readHead");async function JP(t,e){try{await(await xi()).promises.writeFile(`${Oi}/${t}/.legit/operationHead`,e,"utf8")}catch(r){throw console.error("Error writing head to path:",t,r),r}}l(JP,"writeOperationHead");async function ZP(t,e){try{await(await xi()).promises.writeFile(`${Oi}/${t}/.legit/operation`,e,"utf8")}catch(r){throw console.error("Error writing operation to path:",t,r),r}}l(ZP,"writeOperation");async function zo(t){try{let r=await(await xi()).promises.readFile(`${Oi}/${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(zo,"readOperationHistory");async function KP(t,e){try{e.startsWith("/")&&(e=e.slice(1));let r=await xi(),i=`${VP}/${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(KP,"readPastState");var Sd=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 A0=class A0{async list(e,r){let i=await zo(e);return{messages:(await Sd(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 ZP(e,JSON.stringify(n)),{message_id:i}}};l(A0,"LegitThreadMessages");var vd=A0;var P0=class P0{constructor(){U(this,"messages",new vd)}async list(e){return{threads:(await YP()).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(P0,"LegitThreads");var Ed=P0;var D0=class D0 extends Dd{constructor(r){super(r);U(this,"runtime");U(this,"legitFs",null);this.legitFs=r.legitFs,this.threads=new Ed;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 Ni.fromResponse(a,new Bd)}catch(a){return console.error("LegitLocal stream failed, falling back to default handler.",a),i.call(this.runs,n)}}}};l(D0,"LegitLocal");var N0=D0;import{ExportedMessageRepository as E5}from"@assistant-ui/react";var F5=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"),T5="aui/v0";function k5(t){if(t.format!==T5)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=F5(t.metadata);return{...e,role:r,content:n,id:e.id??t.id,createdAt:s,metadata:o}}l(k5,"toThreadMessageLike");async function C0({threadId:t,threadApi:e}){console.log("sync initiated");let r=await zo(t),n=(await Sd(r)).map(k5).filter(s=>s!==null);e?.reset?.(n),e.import(E5.fromArray(n))}l(C0,"syncThreadFromLegitFs");var QP=l(t=>{if(typeof t=="string")return t;if(t===void 0)return"";try{return JSON.stringify(t)}catch{return""}},"serializeStructuredData");var Bc=l(t=>t==null?null:typeof t=="string"||typeof t=="number"||typeof t=="boolean"?t:Array.isArray(t)?t.map(e=>Bc(e)):typeof t=="object"?Object.fromEntries(Object.entries(t).map(([e,r])=>[e,Bc(r)])):JSON.stringify(t),"toJsonValue"),R5=l((t,e)=>e?typeof t=="string"?{type:"error-text",value:t}:{type:"error-json",value:Bc(t)}:typeof t=="string"?{type:"text",value:t}:{type:"json",value:Bc(t)},"buildToolResultOutput"),O5=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:Bc(t.args??t.input??{})};default:return null}},"mapAssistantContentPart"),x5=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:R5(t.result??t.output,!!t.isError)},"mapToolContentPart"),rQ=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=>O5(n)).filter(Boolean)};case"tool":{let i=r.map(n=>x5(n)).filter(Boolean);return i.length>0?{role:"tool",content:i}:null}default:return null}}).filter(e=>e!==null),"convertMessagesToModelMessages");async function iQ(t){let[e,r]=ra();(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:QP(o.output),isError:!1});break}case"tool-error":{let f=o.toolCallId,c=s.get(f);c&&c.setResponse({result:QP(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 $d;return Ni.toResponse(e,i)}l(iQ,"streamTextToDataStreamResponse");import{useEffect as A5}from"react";import{useAssistantApi as P5}from"@assistant-ui/react";var N5=100;function uQ(){let{legitFs:t,threadId:e}=x0(),i=P5().thread();return A5(()=>{if(!t||!e)return;let n=!1,s,o=null,f=l(()=>{n||(s=setTimeout(c,N5))},"scheduleNext"),c=l(async()=>{try{let a=await bd(e);if(n||a===o)return;let{isRunning:u,isLoading:h}=i.getState();if(u||h)return;setTimeout(async()=>{await C0({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(uQ,"LegitFsHeadPoller");export{uQ as LegitFsHeadPoller,S5 as LegitFsProvider,N0 as LegitLocal,rQ as convertMessagesToModelMessages,iQ as streamTextToDataStreamResponse,C0 as syncThreadFromLegitFs,x0 as useLegitFs};
137
+ /*!
138
+ * This code for `path.join` is directly copied from @zenfs/core/path for bundle size improvements.
139
+ * SPDX-License-Identifier: LGPL-3.0-or-later
140
+ * Copyright (c) James Prevett and other ZenFS contributors.
141
+ */
110
142
  /*! Bundled license information:
111
143
 
112
144
  safe-buffer/index.js: