sliccy 6.55.0 → 6.55.2
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/ui/assets/__vite-browser-external-Ttiv38KD.js +1 -0
- package/dist/ui/assets/{account-store-CwFk0vrn.js → account-store-B0inTvu6.js} +1 -1
- package/dist/ui/assets/{account-store-OPlVgm9n.js → account-store-m7EtgLrd.js} +1 -1
- package/dist/ui/assets/{adobe-CV9MxauL.js → adobe-Cf0pn2tU.js} +1 -1
- package/dist/ui/assets/{adobe-C4-28UHy.js → adobe-Cj5x46ow.js} +1 -1
- package/dist/ui/assets/{agent-message-to-chat-BBrEon-e.js → agent-message-to-chat-BpgSdE7h.js} +1 -1
- package/dist/ui/assets/{apply-layout-CU6uv2SV.js → apply-layout-bru2BWxc.js} +1 -1
- package/dist/ui/assets/{apps-nVwOwYNZ.js → apps-DJCljXQk.js} +1 -1
- package/dist/ui/assets/{azure-openai-DE7XJJ_W.js → azure-openai-B15CN8ee.js} +1 -1
- package/dist/ui/assets/{azure-openai-CoNdWu6S.js → azure-openai-DThYpCXW.js} +1 -1
- package/dist/ui/assets/{bsh-watchdog-xGxjlLsx.js → bsh-watchdog-CsAAYkov.js} +1 -1
- package/dist/ui/assets/{cerebras-Da0ljDfP.js → cerebras-B5waaxE6.js} +1 -1
- package/dist/ui/assets/{cerebras-Cb6alYLA.js → cerebras-d0srV-i_.js} +1 -1
- package/dist/ui/assets/{composer-speech-DD_sMRrg.js → composer-speech-Dy0ydNto.js} +1 -1
- package/dist/ui/assets/{connect-surface-C4wPsDoy.js → connect-surface-B6NQaXSg.js} +1 -1
- package/dist/ui/assets/{dip-CJxGQsfn.js → dip-DKzLsmex.js} +1 -1
- package/dist/ui/assets/{dist-4adALD4z.js → dist-BaUI1Dp5.js} +1 -1
- package/dist/ui/assets/{dist-sUBuiXIF.js → dist-C8yMY-ER.js} +1 -1
- package/dist/ui/assets/{dist-CoWnU-QN.js → dist-CrQKODgO.js} +1 -1
- package/dist/ui/assets/{dist-Ca06zVsb.js → dist-DBATBmPe.js} +1 -1
- package/dist/ui/assets/{ensure-speech-assets-DvQPR6oB.js → ensure-speech-assets-DuQaHF0c.js} +1 -1
- package/dist/ui/assets/{esbuild-wasm-DENS1RLU.js → esbuild-wasm-DsMq-s8o.js} +1 -1
- package/dist/ui/assets/fs-BrZitfrE.js +1 -0
- package/dist/ui/assets/fs-CSJFeAoX.js +2 -0
- package/dist/ui/assets/{github-B51gbFRM.js → github-DIpJ-yA9.js} +1 -1
- package/dist/ui/assets/{github-DHy_XZw0.js → github-DiQOI0Pd.js} +2 -2
- package/dist/ui/assets/{github-copilot-CFAaxZPF.js → github-copilot-DJjGcP35.js} +1 -1
- package/dist/ui/assets/{github-copilot-CrE6ukCz.js → github-copilot-DMqtYs8B.js} +1 -1
- package/dist/ui/assets/{github-install-5tP5z8Sp.js → github-install-Ccrjhg5T.js} +1 -1
- package/dist/ui/assets/{github-zip-CXQB6COR.js → github-zip-YBTmfoPU.js} +1 -1
- package/dist/ui/assets/{hear-BzuMQPG-.js → hear-DvNnxDnX.js} +1 -1
- package/dist/ui/assets/{hear-F25gzW4x.js → hear-XJQxHLP8.js} +1 -1
- package/dist/ui/assets/{installer-7ARtKGfs.js → installer-DDJZNOgZ.js} +1 -1
- package/dist/ui/assets/js-realm-worker-BthjWKVF.js +40 -0
- package/dist/ui/assets/{kernel-worker-wEr6Yo6G.js → kernel-worker-DPGAky3U.js} +622 -621
- package/dist/ui/assets/{kokoro-engine-CeOQaPF5.js → kokoro-engine-2bQR6a7X.js} +1 -1
- package/dist/ui/assets/{local-llm-Bj89Xaik.js → local-llm-DVbqW5tQ.js} +1 -1
- package/dist/ui/assets/{local-llm-o-9HoXMQ.js → local-llm-nU3dLruP.js} +1 -1
- package/dist/ui/assets/{magick-wasm-D-VdfkJ_.js → magick-wasm-BYrT_yC4.js} +1 -1
- package/dist/ui/assets/{main-55zLxBLF.js → main-GTxjUHRy.js} +3 -3
- package/dist/ui/assets/{mount-Bbl8m0YN.js → mount-BDdh4EsD.js} +2 -2
- package/dist/ui/assets/{mount-BAQtIqJM.js → mount-Ddl9KcNn.js} +1 -1
- package/dist/ui/assets/{mount-recovery-Dh_lrATP.js → mount-recovery-BvUCHm7S.js} +1 -1
- package/dist/ui/assets/{new-session-DzxiQ6Fo.js → new-session-D8XLocZ8.js} +2 -2
- package/dist/ui/assets/{oauth-bootstrap-D6sh22mp.js → oauth-bootstrap-kZvuJqUX.js} +2 -2
- package/dist/ui/assets/{openai-codex-C2YERBkE.js → openai-codex-BcTtS45y.js} +1 -1
- package/dist/ui/assets/{openai-codex-B6vWughU.js → openai-codex-DzM2nZs7.js} +1 -1
- package/dist/ui/assets/{openrouter-DRSWugHj.js → openrouter-BZEGuNBF.js} +1 -1
- package/dist/ui/assets/{openrouter-D7rca13W.js → openrouter-DiPv3qg9.js} +1 -1
- package/dist/ui/assets/{openrouter-oauth-Ccm-7hP1.js → openrouter-oauth-CbMY1jzk.js} +1 -1
- package/dist/ui/assets/{openrouter-oauth-CM283kz1.js → openrouter-oauth-xSIr9rPt.js} +1 -1
- package/dist/ui/assets/{panel-rpc-handlers-CPDysGzr.js → panel-rpc-handlers-C-a__Bi-.js} +2 -2
- package/dist/ui/assets/{provider-D4_spYyQ.js → provider-B-uE3ZCz.js} +1 -1
- package/dist/ui/assets/{provider-D95ajDI-.js → provider-Be0E_IMW.js} +2 -2
- package/dist/ui/assets/{provider-settings-CZPFzFww.js → provider-settings-Cla-Ao_F.js} +1 -1
- package/dist/ui/assets/{provider-settings-DHCjadXO.js → provider-settings-StjddRwF.js} +1 -1
- package/dist/ui/assets/{provider-store-access-ZzG9_DW9.js → provider-store-access-CkLew2RG.js} +2 -2
- package/dist/ui/assets/provider-store-access-aeWPaRJw.js +1 -0
- package/dist/ui/assets/{providers-Bz8hOO4e.js → providers-Brpn-3iE.js} +1 -1
- package/dist/ui/assets/{providers-CMbA_5pP.js → providers-DR6MxN4s.js} +2 -2
- package/dist/ui/assets/py-realm-worker-B9ZFZSht.js +244 -0
- package/dist/ui/assets/{pyodide-DvV71W1m.js → pyodide-C8BMevjP.js} +2 -2
- package/dist/ui/assets/{quick-llm-r-RNLFOD.js → quick-llm-DX70ALhs.js} +1 -1
- package/dist/ui/assets/{recovery-screen-k0KG52c_.js → recovery-screen-DB1To5sJ.js} +1 -1
- package/dist/ui/assets/{redirect-uri-Dlgdgq9c.js → redirect-uri-BrFcQUXI.js} +1 -1
- package/dist/ui/assets/{session-freezer-BdNDYJka.js → session-freezer-Cq9qF8FZ.js} +3 -3
- package/dist/ui/assets/{setup-feature-flags-remote-Cni0vF5s.js → setup-feature-flags-remote-DE6MSHD9.js} +1 -1
- package/dist/ui/assets/{setup-standalone-prelude-Aaw6ZTqE.js → setup-standalone-prelude-D05fd3f-.js} +1 -1
- package/dist/ui/assets/{setup-sudo-DE101L1A.js → setup-sudo-CmLT9Etp.js} +2 -2
- package/dist/ui/assets/shared-BGkb0Szh.js +1 -0
- package/dist/ui/assets/shared-CvRDmxWf.js +4 -0
- package/dist/ui/assets/sidecar-repair-DSCESX6n.js +1 -0
- package/dist/ui/assets/sidecar-repair-DoQ5IdBR.js +1 -0
- package/dist/ui/assets/{skills-CD6n7K64.js → skills-7beI-IKL.js} +1 -1
- package/dist/ui/assets/{speak-CMtHf-87.js → speak-CAvJu50L.js} +1 -1
- package/dist/ui/assets/{speak-DB1MBC8u.js → speak-pezNrAJe.js} +1 -1
- package/dist/ui/assets/{sprinkle-bridge-CvxVWzkw.js → sprinkle-bridge-CDUlpA1k.js} +1 -1
- package/dist/ui/assets/{sprinkle-manager-BuGjZ5Cc.js → sprinkle-manager-CrFYYcYo.js} +1 -1
- package/dist/ui/assets/{store-PS_6K9ig.js → store-CSk8LOYP.js} +1 -1
- package/dist/ui/assets/{store-B-j0AMTP.js → store-Cxd6lAkh.js} +1 -1
- package/dist/ui/assets/{sudo-C0Frl1uv.js → sudo-C_oJCkxM.js} +1 -1
- package/dist/ui/assets/{tool-result-images-D76DDM2v.js → tool-result-images-Dm6tlkfz.js} +1 -1
- package/dist/ui/assets/{transformers-env-B-CKGy98.js → transformers-env-sSyvbYdA.js} +1 -1
- package/dist/ui/assets/{transformers-env-q0cI8Ngw.js → transformers-env-wpY2kxZs.js} +1 -1
- package/dist/ui/assets/{upgrade-detection-C6lKX0sw.js → upgrade-detection-qNoriX8R.js} +1 -1
- package/dist/ui/assets/{voice-reply-BVyL3pvl.js → voice-reply-C6Q5UBvr.js} +1 -1
- package/dist/ui/assets/{wc-extension-DiMYH909.js → wc-extension-xGmsids-.js} +2 -2
- package/dist/ui/assets/{wc-follower-XRDd6kcV.js → wc-follower-CS5nhoDP.js} +3 -3
- package/dist/ui/assets/{wc-live-CeUom_i0.js → wc-live-BOWfCqId.js} +4 -4
- package/dist/ui/assets/{wc-nav-oFUaoh0U.js → wc-nav-DYVpfhGQ.js} +2 -2
- package/dist/ui/assets/{wc-onboarding-CTPJpqjh.js → wc-onboarding-CUVC-Tlh.js} +2 -2
- package/dist/ui/assets/{wc-placeholder-CbIosT0I.js → wc-placeholder-BRdrJsyS.js} +2 -2
- package/dist/ui/assets/{wc-settings-DMFk0-ha.js → wc-settings-BrLzoBWh.js} +2 -2
- package/dist/ui/assets/{wc-shell-CsrNIkU0.js → wc-shell-DvAzKQ8n.js} +2 -2
- package/dist/ui/assets/{wc-sprinkles-CQZ3LlUK.js → wc-sprinkles-BJ52zD0V.js} +2 -2
- package/dist/ui/assets/{wc-tray-DckHZGXQ.js → wc-tray-D4CqyT3U.js} +2 -2
- package/dist/ui/assets/{wc-tray-scoops-MLGLg0xV.js → wc-tray-scoops-DFuuk86P.js} +1 -1
- package/dist/ui/assets/{whisper-engine-tXDxhSyA.js → whisper-engine-Cy4tNnVy.js} +1 -1
- package/dist/ui/assets/{whisper-session-BQThVgKW.js → whisper-session-BXqEuFVV.js} +2 -2
- package/dist/ui/assets/{xai-grok-BOQIeqyM.js → xai-grok-BEU-yDtv.js} +1 -1
- package/dist/ui/assets/{xai-grok-DtwSyWqH.js → xai-grok-DPl1-t2U.js} +1 -1
- package/dist/ui/index.html +6 -6
- package/dist/ui/packages/webapp/index.html +6 -6
- package/package.json +1 -1
- package/dist/ui/assets/__vite-browser-external-Cyo-aQrT.js +0 -1
- package/dist/ui/assets/fs-B-xI_nsy.js +0 -1
- package/dist/ui/assets/fs-DwsOvha-.js +0 -2
- package/dist/ui/assets/js-realm-worker-BI6pkh3X.js +0 -39
- package/dist/ui/assets/provider-store-access-nDgnx6NL.js +0 -1
- package/dist/ui/assets/py-realm-worker-C2q3f011.js +0 -244
- package/dist/ui/assets/shared-BD0eHnW8.js +0 -1
- package/dist/ui/assets/shared-C34Ci5nb.js +0 -4
- package/dist/ui/assets/sidecar-repair-BXwSWMQD.js +0 -1
- package/dist/ui/assets/sidecar-repair-qfX5Cm1p.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{i as e,n as t,t as n}from"./rolldown-runtime-Dd_uD5pT.js";function r(e,t){if(e.byteLength>=t)return e;if(ArrayBuffer.isView(e)){let n=r(e.buffer,t);return new e.constructor(n,e.byteOffset,t)}let n=typeof SharedArrayBuffer<`u`&&e instanceof SharedArrayBuffer;if(e.maxByteLength>t)return n?e.grow(t):e.resize(t),e;if(n){let n=new SharedArrayBuffer(t);return new Uint8Array(n).set(new Uint8Array(e)),n}try{return e.transfer(t)}catch{let n=new ArrayBuffer(t);return new Uint8Array(n).set(new Uint8Array(e)),n}}var i=class extends DataView{constructor(e,t,n){let{buffer:r,byteOffset:i,byteLength:a}=new Uint8Array(e,t,n);super(r,i,a)}};for(let e of Object.getOwnPropertyNames(DataView.prototype))!e.startsWith(`get`)&&!e.startsWith(`set`)||Object.defineProperty(i.prototype,e,{value:()=>{throw ReferenceError(`Do not use DataView methods on a BufferView.`)},writable:!1,enumerable:!1,configurable:!1});var a=class{id;_size;options;regions=[];get size(){return this._size}set size(e){if(e>=this._size){this._size=e;return}this._size=e;for(let t=this.regions.length-1;t>=0;t--){let n=this.regions[t];if(n.offset>=e){this.regions.splice(t,1);continue}let r=e-n.offset;n.data.byteLength>r&&(n.data=n.data.subarray(0,r)),n.ranges=n.ranges.filter(t=>t.start<e).map(t=>t.end>e?{start:t.start,end:e}:t)}}constructor(e,t,n,r){this.id=e,this._size=t,this.options=n,n.sparse??=!0,n.sparse||this.regions.push({offset:0,data:new Uint8Array(t),ranges:[]}),r?.set(e,this)}collect(){if(!this.options.sparse)return;let{regionGapThreshold:e=4095}=this.options;for(let t=0;t<this.regions.length-1;){let n=this.regions[t],i=this.regions[t+1];if(i.offset-(n.offset+n.data.byteLength)>e){t++;continue}n.ranges.push(...i.ranges),n.ranges.sort((e,t)=>e.start-t.start),n.ranges=n.ranges.reduce((e,t)=>(!e.length||e.at(-1).end<t.start?e.push(t):e.at(-1).end=Math.max(e.at(-1).end,t.end),e),[]),n.data=r(n.data,i.offset+i.data.byteLength),n.data.set(i.data,i.offset-n.offset),this.regions.splice(t+1,1)}}missing(e,t){let n=[];for(let r of this.regions){if(r.offset>=t)break;for(let i of r.ranges)if(!(i.end<=e)&&(i.start>=t||(i.start>e&&n.push({start:e,end:Math.min(i.start,t)}),i.end>e&&(e=Math.max(e,i.end)),e>=t)))break;if(e>=t)break}return e<t&&n.push({start:e,end:t}),n}cached(e,t){let n=[];for(let r of this.regions){if(r.offset>=t)break;for(let i of r.ranges)if(!(i.end<=e)){if(i.start>=t)break;n.push({start:Math.max(e,i.start),end:Math.min(t,i.end)})}}n.sort((e,t)=>e.start-t.start);let r=[];for(let e of n){let t=r.at(-1);t&&e.start<=t.end?t.end=Math.max(t.end,e.end):r.push(e)}return r}regionAt(e){if(this.regions.length)for(let t of this.regions){if(t.offset>e)break;if(e>=t.offset&&e<t.offset+t.data.byteLength)return t}}add(e,t){let n=t+e.byteLength,i=this.regionAt(t);if(i)return i.data=r(i.data,n),i.data.set(e,t),i.ranges.push({start:t,end:n}),i.ranges.sort((e,t)=>e.start-t.start),this.collect(),this;let a={data:e,offset:t,ranges:[{start:t,end:n}]},o=this.regions.findIndex(e=>e.offset>t);return o==-1?this.regions.push(a):this.regions.splice(o,0,a),this.collect(),this}},o=new Uint32Array(256);for(let e=0;e<256;e++){let t=e;for(let e=0;e<8;e++)t=t&1?2197175160^t>>>1:t>>>1;o[e]=t}function s(e){let t=4294967295;for(let n=0;n<e.length;n++)t=t>>>8^o[(t^e[n])&255];return(t^4294967295)>>>0}var c=e(n(((e,t)=>{var n=Object.prototype.hasOwnProperty,r=`~`;function i(){}Object.create&&(i.prototype=Object.create(null),new i().__proto__||(r=!1));function a(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function o(e,t,n,i,o){if(typeof n!=`function`)throw TypeError(`The listener must be a function`);var s=new a(n,i||e,o),c=r?r+t:t;return e._events[c]?e._events[c].fn?e._events[c]=[e._events[c],s]:e._events[c].push(s):(e._events[c]=s,e._eventsCount++),e}function s(e,t){--e._eventsCount===0?e._events=new i:delete e._events[t]}function c(){this._events=new i,this._eventsCount=0}c.prototype.eventNames=function(){var e=[],t,i;if(this._eventsCount===0)return e;for(i in t=this._events)n.call(t,i)&&e.push(r?i.slice(1):i);return Object.getOwnPropertySymbols?e.concat(Object.getOwnPropertySymbols(t)):e},c.prototype.listeners=function(e){var t=r?r+e:e,n=this._events[t];if(!n)return[];if(n.fn)return[n.fn];for(var i=0,a=n.length,o=Array(a);i<a;i++)o[i]=n[i].fn;return o},c.prototype.listenerCount=function(e){var t=r?r+e:e,n=this._events[t];return n?n.fn?1:n.length:0},c.prototype.emit=function(e,t,n,i,a,o){var s=r?r+e:e;if(!this._events[s])return!1;var c=this._events[s],l=arguments.length,u,d;if(c.fn){switch(c.once&&this.removeListener(e,c.fn,void 0,!0),l){case 1:return c.fn.call(c.context),!0;case 2:return c.fn.call(c.context,t),!0;case 3:return c.fn.call(c.context,t,n),!0;case 4:return c.fn.call(c.context,t,n,i),!0;case 5:return c.fn.call(c.context,t,n,i,a),!0;case 6:return c.fn.call(c.context,t,n,i,a,o),!0}for(d=1,u=Array(l-1);d<l;d++)u[d-1]=arguments[d];c.fn.apply(c.context,u)}else{var f=c.length,p;for(d=0;d<f;d++)switch(c[d].once&&this.removeListener(e,c[d].fn,void 0,!0),l){case 1:c[d].fn.call(c[d].context);break;case 2:c[d].fn.call(c[d].context,t);break;case 3:c[d].fn.call(c[d].context,t,n);break;case 4:c[d].fn.call(c[d].context,t,n,i);break;default:if(!u)for(p=1,u=Array(l-1);p<l;p++)u[p-1]=arguments[p];c[d].fn.apply(c[d].context,u)}}return!0},c.prototype.on=function(e,t,n){return o(this,e,t,n,!1)},c.prototype.once=function(e,t,n){return o(this,e,t,n,!0)},c.prototype.removeListener=function(e,t,n,i){var a=r?r+e:e;if(!this._events[a])return this;if(!t)return s(this,a),this;var o=this._events[a];if(o.fn)o.fn===t&&(!i||o.once)&&(!n||o.context===n)&&s(this,a);else{for(var c=0,l=[],u=o.length;c<u;c++)(o[c].fn!==t||i&&!o[c].once||n&&o[c].context!==n)&&l.push(o[c]);l.length?this._events[a]=l.length===1?l[0]:l:s(this,a)}return this},c.prototype.removeAllListeners=function(e){var t;return e?(t=r?r+e:e,this._events[t]&&s(this,t)):(this._events=new i,this._eventsCount=0),this},c.prototype.off=c.prototype.removeListener,c.prototype.addListener=c.prototype.on,c.prefixed=r,c.EventEmitter=c,t!==void 0&&(t.exports=c)}))(),1),l=class extends c.default{[Symbol.toStringTag]=`List`;constructor(e){super(),e&&this.push(...e)}data=new Set;toSet(){return new Set(this.data)}toArray(){return Array.from(this.data)}toJSON(){return Array.from(this.data)}toString(){return this.join(`,`)}_set(e,t,n=!1){if(Math.abs(e)>this.data.size)throw ReferenceError(`Can not set an element outside the bounds of the list`);let r=Array.from(this.data);r.splice(e,+n,t),this.data=new Set(r),this.emit(`update`)}set(e,t){this._set(e,t,!0)}deleteAt(e){if(Math.abs(e)>this.data.size)throw ReferenceError(`Can not delete an element outside the bounds of the list`);this.delete(Array.from(this.data).at(e))}insert(e,t=this.data.size){this._set(t,e,!1)}at(e){if(Math.abs(e)>this.data.size)throw ReferenceError(`Can not access an element outside the bounds of the list`);return Array.from(this.data).at(e)}pop(){let e=Array.from(this.data).pop();return e!==void 0&&this.delete(e),e}push(...e){for(let t of e)this.add(t);return this.data.size}join(e){return Array.from(this.data).join(e)}splice(e,t,...n){if(Math.abs(e)>this.data.size)throw ReferenceError(`Can not splice elements outside the bounds of the list`);let r=Array.from(this.data),i=r.splice(e,t,...n);return this.data=new Set(r),this.emit(`update`),i}add(e){return this.data.add(e),this.emit(`update`),this.emit(`add`,e),this}clear(){this.data.clear(),this.emit(`update`)}delete(e){let t=this.data.delete(e);return this.emit(`update`),t}has(e){return this.data.has(e)}get size(){return this.data.size}entries(){return this.toArray().entries()}keys(){return this.toArray().keys()}values(){return this.data.values()}[Symbol.iterator](){return this.data[Symbol.iterator]()}};function u(e,t){let n=Object.entries(e);return Object.fromEntries(n.filter(([e,n])=>t(e,n)))}function d(e,...t){let n={};for(let r of t.flat())n[r]=e[r];return n}function f(e,...t){return u(e,e=>!t.flat().includes(e))}function p(e){try{return JSON.parse(e),!0}catch{return!1}}function m(e){let t=[];for(let n=e;n&&![`Function`,`Object`].includes(n.constructor.name);n=Object.getPrototypeOf(n))t.push(n.constructor.name);return t}function h(e,t){return Object.fromEntries(Object.entries(e).map(([e,n])=>[e,typeof n==`function`?n.bind(t):n]))}function g(e=Error()){let t=setTimeout(()=>{throw e},5e3);return()=>clearTimeout(t)}function _(e){throw e&&typeof e==`object`&&m(e).includes(`Error`)&&Error?.captureStackTrace(e,_),e}function v(e,t){if(![`getter`,`accessor`].includes(t.kind))throw Error(`@memoize can only be used on getters and auto-accessors`);let n=new WeakMap;function r(){if(n.has(this))return n.get(this);let t=typeof e==`function`?e.call(this):e.get.call(this);return n.set(this,t),t}switch(t.kind){case`getter`:return r;case`accessor`:return{...e,get:r}}}var y=Intl.NumberFormat(`en`,{notation:`compact`});y.format.bind(y);function b(e=0,t=1){return Math.round(Math.random()*(t-e)+e)}function x(e){return e.at(0).toUpperCase()+e.slice(1)}var S=new TextEncoder;function C(e){return S.encode(e)}var w=new TextDecoder;function T(e){if(!e)return``;if(e.buffer instanceof ArrayBuffer&&!e.buffer.resizable)return w.decode(e);let t=new Uint8Array(e.byteLength);return t.set(e),w.decode(t)}function ee(e){let t=new Uint8Array(e.length);for(let n=0;n<e.length;n++)t[n]=e.charCodeAt(n);return t}function E(e){let t=``;for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return t}function te(e){let t=Array.from(e).map(e=>e.toString(16).padStart(2,`0`)).join(``);return`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16,20)}-${t.slice(20)}`}function D(e){let t=e.replace(/-/g,``),n=new Uint8Array(16);for(let e=0;e<16;e++)n[e]=parseInt(t.slice(e*2,e*2+2),16);return n}var O;(function(e){e[e.EPERM=1]=`EPERM`,e[e.ENOENT=2]=`ENOENT`,e[e.ESRCH=3]=`ESRCH`,e[e.EINTR=4]=`EINTR`,e[e.EIO=5]=`EIO`,e[e.ENXIO=6]=`ENXIO`,e[e.E2BIG=7]=`E2BIG`,e[e.ENOEXEC=8]=`ENOEXEC`,e[e.EBADF=9]=`EBADF`,e[e.ECHILD=10]=`ECHILD`,e[e.EAGAIN=11]=`EAGAIN`,e[e.ENOMEM=12]=`ENOMEM`,e[e.EACCES=13]=`EACCES`,e[e.EFAULT=14]=`EFAULT`,e[e.ENOTBLK=15]=`ENOTBLK`,e[e.EBUSY=16]=`EBUSY`,e[e.EEXIST=17]=`EEXIST`,e[e.EXDEV=18]=`EXDEV`,e[e.ENODEV=19]=`ENODEV`,e[e.ENOTDIR=20]=`ENOTDIR`,e[e.EISDIR=21]=`EISDIR`,e[e.EINVAL=22]=`EINVAL`,e[e.ENFILE=23]=`ENFILE`,e[e.EMFILE=24]=`EMFILE`,e[e.ETXTBSY=26]=`ETXTBSY`,e[e.EFBIG=27]=`EFBIG`,e[e.ENOSPC=28]=`ENOSPC`,e[e.ESPIPE=29]=`ESPIPE`,e[e.EROFS=30]=`EROFS`,e[e.EMLINK=31]=`EMLINK`,e[e.EPIPE=32]=`EPIPE`,e[e.EDOM=33]=`EDOM`,e[e.ERANGE=34]=`ERANGE`,e[e.EDEADLK=35]=`EDEADLK`,e[e.ENAMETOOLONG=36]=`ENAMETOOLONG`,e[e.ENOLCK=37]=`ENOLCK`,e[e.ENOSYS=38]=`ENOSYS`,e[e.ENOTEMPTY=39]=`ENOTEMPTY`,e[e.ELOOP=40]=`ELOOP`,e[e.ENOMSG=42]=`ENOMSG`,e[e.EIDRM=43]=`EIDRM`,e[e.ECHRNG=44]=`ECHRNG`,e[e.EL2NSYNC=45]=`EL2NSYNC`,e[e.EL3HLT=46]=`EL3HLT`,e[e.EL3RST=47]=`EL3RST`,e[e.ENRNG=48]=`ENRNG`,e[e.EUNATCH=49]=`EUNATCH`,e[e.ECSI=50]=`ECSI`,e[e.EL2HLT=51]=`EL2HLT`,e[e.EBADE=52]=`EBADE`,e[e.EBADR=53]=`EBADR`,e[e.EXFULL=54]=`EXFULL`,e[e.ENOANO=55]=`ENOANO`,e[e.EBADRQC=56]=`EBADRQC`,e[e.EBADSLT=57]=`EBADSLT`,e[e.EBFONT=59]=`EBFONT`,e[e.ENOSTR=60]=`ENOSTR`,e[e.ENODATA=61]=`ENODATA`,e[e.ETIME=62]=`ETIME`,e[e.ENOSR=63]=`ENOSR`,e[e.ENONET=64]=`ENONET`,e[e.ENOPKG=65]=`ENOPKG`,e[e.EREMOTE=66]=`EREMOTE`,e[e.ENOLINK=67]=`ENOLINK`,e[e.EADV=68]=`EADV`,e[e.ESRMNT=69]=`ESRMNT`,e[e.ECOMM=70]=`ECOMM`,e[e.EPROTO=71]=`EPROTO`,e[e.EMULTIHOP=72]=`EMULTIHOP`,e[e.EDOTDOT=73]=`EDOTDOT`,e[e.EBADMSG=74]=`EBADMSG`,e[e.EOVERFLOW=75]=`EOVERFLOW`,e[e.ENOTUNIQ=76]=`ENOTUNIQ`,e[e.EBADFD=77]=`EBADFD`,e[e.EREMCHG=78]=`EREMCHG`,e[e.ELIBACC=79]=`ELIBACC`,e[e.ELIBBAD=80]=`ELIBBAD`,e[e.ELIBSCN=81]=`ELIBSCN`,e[e.ELIBMAX=82]=`ELIBMAX`,e[e.ELIBEXEC=83]=`ELIBEXEC`,e[e.EILSEQ=84]=`EILSEQ`,e[e.ERESTART=85]=`ERESTART`,e[e.ESTRPIPE=86]=`ESTRPIPE`,e[e.EUSERS=87]=`EUSERS`,e[e.ENOTSOCK=88]=`ENOTSOCK`,e[e.EDESTADDRREQ=89]=`EDESTADDRREQ`,e[e.EMSGSIZE=90]=`EMSGSIZE`,e[e.EPROTOTYPE=91]=`EPROTOTYPE`,e[e.ENOPROTOOPT=92]=`ENOPROTOOPT`,e[e.EPROTONOSUPPORT=93]=`EPROTONOSUPPORT`,e[e.ESOCKTNOSUPPORT=94]=`ESOCKTNOSUPPORT`,e[e.ENOTSUP=95]=`ENOTSUP`,e[e.EPFNOSUPPORT=96]=`EPFNOSUPPORT`,e[e.EAFNOSUPPORT=97]=`EAFNOSUPPORT`,e[e.EADDRINUSE=98]=`EADDRINUSE`,e[e.EADDRNOTAVAIL=99]=`EADDRNOTAVAIL`,e[e.ENETDOWN=100]=`ENETDOWN`,e[e.ENETUNREACH=101]=`ENETUNREACH`,e[e.ENETRESET=102]=`ENETRESET`,e[e.ECONNABORTED=103]=`ECONNABORTED`,e[e.ECONNRESET=104]=`ECONNRESET`,e[e.ENOBUFS=105]=`ENOBUFS`,e[e.EISCONN=106]=`EISCONN`,e[e.ENOTCONN=107]=`ENOTCONN`,e[e.ESHUTDOWN=108]=`ESHUTDOWN`,e[e.ETOOMANYREFS=109]=`ETOOMANYREFS`,e[e.ETIMEDOUT=110]=`ETIMEDOUT`,e[e.ECONNREFUSED=111]=`ECONNREFUSED`,e[e.EHOSTDOWN=112]=`EHOSTDOWN`,e[e.EHOSTUNREACH=113]=`EHOSTUNREACH`,e[e.EALREADY=114]=`EALREADY`,e[e.EINPROGRESS=115]=`EINPROGRESS`,e[e.ESTALE=116]=`ESTALE`,e[e.EEUCLEAN=117]=`EEUCLEAN`,e[e.ENOTNAM=118]=`ENOTNAM`,e[e.ENAVAIL=119]=`ENAVAIL`,e[e.EISNAM=120]=`EISNAM`,e[e.EREMOTEIO=121]=`EREMOTEIO`,e[e.EDQUOT=122]=`EDQUOT`,e[e.ENOMEDIUM=123]=`ENOMEDIUM`,e[e.EMEDIUMTYPE=124]=`EMEDIUMTYPE`,e[e.ECANCELED=125]=`ECANCELED`,e[e.ENOKEY=126]=`ENOKEY`,e[e.EKEYEXPIRED=127]=`EKEYEXPIRED`,e[e.EKEYREVOKED=128]=`EKEYREVOKED`,e[e.EKEYREJECTED=129]=`EKEYREJECTED`,e[e.EOWNERDEAD=130]=`EOWNERDEAD`,e[e.ENOTRECOVERABLE=131]=`ENOTRECOVERABLE`,e[e.ERFKILL=132]=`ERFKILL`,e[e.EHWPOISON=133]=`EHWPOISON`})(O||={});var ne={[O.EPERM]:`operation not permitted`,[O.ENOENT]:`no such file or directory`,[O.ESRCH]:`no such process`,[O.EINTR]:`interrupted system call`,[O.EIO]:`i/o error`,[O.ENXIO]:`no such device or address`,[O.E2BIG]:`argument list too long`,[O.ENOEXEC]:`exec format error`,[O.EBADF]:`bad file descriptor`,[O.ECHILD]:`no child processes`,[O.EAGAIN]:`resource temporarily unavailable`,[O.ENOMEM]:`not enough memory`,[O.EACCES]:`permission denied`,[O.EFAULT]:`bad address in system call argument`,[O.ENOTBLK]:`block device required`,[O.EBUSY]:`resource busy or locked`,[O.EEXIST]:`file already exists`,[O.EXDEV]:`cross-device link not permitted`,[O.ENODEV]:`no such device`,[O.ENOTDIR]:`not a directory`,[O.EISDIR]:`illegal operation on a directory`,[O.EINVAL]:`invalid argument`,[O.ENFILE]:`file table overflow`,[O.EMFILE]:`too many open files`,[O.ETXTBSY]:`text file is busy`,[O.EFBIG]:`file too large`,[O.ENOSPC]:`no space left on device`,[O.ESPIPE]:`invalid seek`,[O.EROFS]:`read-only file system`,[O.EMLINK]:`too many links`,[O.EPIPE]:`broken pipe`,[O.EDOM]:`numerical argument out of domain`,[O.ERANGE]:`result too large`,[O.EDEADLK]:`resource deadlock would occur`,[O.ENAMETOOLONG]:`name too long`,[O.ENOLCK]:`no locks available`,[O.ENOSYS]:`function not implemented`,[O.ENOTEMPTY]:`directory not empty`,[O.ELOOP]:`too many symbolic links encountered`,[O.ENOMSG]:`no message of desired type`,[O.EIDRM]:`identifier removed`,[O.ECHRNG]:`channel number out of range`,[O.EL2NSYNC]:`level 2 not synchronized`,[O.EL3HLT]:`level 3 halted`,[O.EL3RST]:`level 3 reset`,[O.ENRNG]:`link number out of range`,[O.EUNATCH]:`protocol driver not attached`,[O.ECSI]:`no CSI structure available`,[O.EL2HLT]:`level 2 halted`,[O.EBADE]:`invalid exchange`,[O.EBADR]:`invalid request descriptor`,[O.EXFULL]:`exchange full`,[O.ENOANO]:`no anode`,[O.EBADRQC]:`invalid request code`,[O.EBADSLT]:`invalid slot`,[O.EBFONT]:`bad font file format`,[O.ENOSTR]:`device not a stream`,[O.ENODATA]:`no data available`,[O.ETIME]:`timer expired`,[O.ENOSR]:`out of streams resources`,[O.ENONET]:`machine is not on the network`,[O.ENOPKG]:`package not installed`,[O.EREMOTE]:`object is remote`,[O.ENOLINK]:`link has been severed`,[O.EADV]:`advertise error`,[O.ESRMNT]:`srmount error`,[O.ECOMM]:`communication error on send`,[O.EPROTO]:`protocol error`,[O.EMULTIHOP]:`multihop attempted`,[O.EDOTDOT]:`rFS specific error`,[O.EBADMSG]:`bad message`,[O.EOVERFLOW]:`value too large for defined data type`,[O.ENOTUNIQ]:`name not unique on network`,[O.EBADFD]:`file descriptor in bad state`,[O.EREMCHG]:`remote address changed`,[O.ELIBACC]:`can not access a needed shared library`,[O.ELIBBAD]:`accessing a corrupted shared library`,[O.ELIBSCN]:`.lib section in a.out corrupted`,[O.ELIBMAX]:`attempting to link in too many shared libraries`,[O.ELIBEXEC]:`cannot exec a shared library directly`,[O.EILSEQ]:`illegal byte sequence`,[O.ERESTART]:`interrupted system call should be restarted`,[O.ESTRPIPE]:`streams pipe error`,[O.EUSERS]:`too many users`,[O.ENOTSOCK]:`socket operation on non-socket`,[O.EDESTADDRREQ]:`destination address required`,[O.EMSGSIZE]:`message too long`,[O.EPROTOTYPE]:`protocol wrong type for socket`,[O.ENOPROTOOPT]:`protocol not available`,[O.EPROTONOSUPPORT]:`protocol not supported`,[O.ESOCKTNOSUPPORT]:`socket type not supported`,[O.ENOTSUP]:`operation not supported on socket`,[O.EPFNOSUPPORT]:`protocol family not supported`,[O.EAFNOSUPPORT]:`address family not supported`,[O.EADDRINUSE]:`address already in use`,[O.EADDRNOTAVAIL]:`address not available`,[O.ENETDOWN]:`network is down`,[O.ENETUNREACH]:`network is unreachable`,[O.ENETRESET]:`network dropped connection on reset`,[O.ECONNABORTED]:`software caused connection abort`,[O.ECONNRESET]:`connection reset by peer`,[O.ENOBUFS]:`no buffer space available`,[O.EISCONN]:`socket is already connected`,[O.ENOTCONN]:`socket is not connected`,[O.ESHUTDOWN]:`cannot send after transport endpoint shutdown`,[O.ETOOMANYREFS]:`too many references: cannot splice`,[O.ETIMEDOUT]:`connection timed out`,[O.ECONNREFUSED]:`connection refused`,[O.EHOSTDOWN]:`host is down`,[O.EHOSTUNREACH]:`host is unreachable`,[O.EALREADY]:`connection already in progress`,[O.EINPROGRESS]:`operation now in progress`,[O.ESTALE]:`stale file handle`,[O.EEUCLEAN]:`structure needs cleaning`,[O.ENOTNAM]:`not a XENIX named type file`,[O.ENAVAIL]:`no XENIX semaphores available`,[O.EISNAM]:`is a named type file`,[O.EREMOTEIO]:`remote I/O error`,[O.EDQUOT]:`disk quota exceeded`,[O.ENOMEDIUM]:`no medium found`,[O.EMEDIUMTYPE]:`wrong medium type`,[O.ECANCELED]:`operation canceled`,[O.ENOKEY]:`required key not available`,[O.EKEYEXPIRED]:`key has expired`,[O.EKEYREVOKED]:`key has been revoked`,[O.EKEYREJECTED]:`key was rejected by service`,[O.EOWNERDEAD]:`owner died`,[O.ENOTRECOVERABLE]:`state not recoverable`,[O.ERFKILL]:`operation not possible due to RF-kill`,[O.EHWPOISON]:`memory page has hardware error`};function k(e){let t=`${e.code}: ${ne[e.errno]}, ${e.syscall}`;e.path&&(t+=` '${e.path}'`),e.dest&&(t+=` -> '${e.dest}'`);let n=e.message.startsWith(ne[e.errno])||/^E[A-Z0-9]+: /.test(e.message);return e.message&&!n&&(t+=` (${e.message})`),e.message=t,e}var A=class e extends Error{errno;code;path;dest;syscall;constructor(e,t,n={}){let r=O[e];super(t||``),this.errno=e,this.code=r,Object.assign(this,f(n,`message`)),t||k(this),Error.captureStackTrace?.(this,this.constructor)}toString(){return this.message}toJSON(){let e={errno:this.errno,code:this.code,stack:this.stack,message:this.message};return this.path&&(e.path=this.path),this.dest&&(e.dest=this.dest),this.syscall&&(e.syscall=this.syscall),e}static fromJSON(t){let n=t.syscall?new e(t.errno,!1,t):new e(t.errno,t.message);return n.stack=t.stack,n}};function j(e,t,n,r){typeof t==`string`&&(t={syscall:t,path:n,dest:r});let i=new A(O[e],!1,t??{});return Error.captureStackTrace?.(i,j),i}function M(e,t){let n=new A(O[e],t??ne[O[e]]);return Error.captureStackTrace?.(n,M),n}function N(e,t,n){let r=typeof e==`string`?{syscall:e}:e;return t&&(r.path=t),n&&(r.dest=n),function(e){throw Object.assign(e,r),k(e),e}}var P=t({Level:()=>F,alert:()=>le,configure:()=>Te,crit:()=>ue,debug:()=>pe,deprecated:()=>me,emerg:()=>ce,entries:()=>ae,err:()=>I,fancy:()=>ye,format:()=>be,info:()=>fe,isEnabled:()=>we,levelOf:()=>ie,levels:()=>re,log:()=>oe,notice:()=>de,warn:()=>L}),F;(function(e){e[e.EMERG=0]=`EMERG`,e[e.ALERT=1]=`ALERT`,e[e.CRIT=2]=`CRIT`,e[e.ERR=3]=`ERR`,e[e.WARN=4]=`WARN`,e[e.NOTICE=5]=`NOTICE`,e[e.INFO=6]=`INFO`,e[e.DEBUG=7]=`DEBUG`})(F||={});var re=[`emergency`,`alert`,`critical`,`error`,`warning`,`notice`,`info`,`debug`];function ie(e){return re.indexOf(e)}var ae=new l;function oe(e,t){if(!we)return;let n={level:e,message:t,timestamp:new Date,elapsedMs:performance.now()};ae.add(n),xe(n)}function se(e){return function(t){return oe(e,t.toString()),t}}var ce=se(F.EMERG),le=se(F.ALERT),ue=se(F.CRIT),I=se(F.ERR),L=se(F.WARN),de=se(F.NOTICE),fe=se(F.INFO),pe=se(F.DEBUG);function me(e){oe(F.WARN,e+` is deprecated and should not be used.`)}function he(e,t){return`\x1b[${t}m${e}\x1b[0m`}function ge(e){return`[`+(e.elapsedMs/1e3).toFixed(3).padStart(10)+`] `}var _e={ansi:{[F.EMERG]:`1;4;37;41`,[F.ALERT]:`1;37;41`,[F.CRIT]:`1;35`,[F.ERR]:`1;31`,[F.WARN]:`1;33`,[F.NOTICE]:`1;36`,[F.INFO]:`1;37`,[F.DEBUG]:`0;2;37`},css:{[F.EMERG]:`font-weight: bold; text-decoration: underline; color: white; background-color: red;`,[F.ALERT]:`font-weight: bold; color: white; background-color: red;`,[F.CRIT]:`font-weight: bold; color: magenta;`,[F.ERR]:`font-weight: bold; color: red;`,[F.WARN]:`font-weight: bold; color: yellow;`,[F.NOTICE]:`font-weight: bold; color: cyan;`,[F.INFO]:`font-weight: bold; color: white;`,[F.DEBUG]:`opacity: 0.8; color: white;`}},ve={ansi:{[F.EMERG]:`1;31`,[F.ALERT]:`1;31`,[F.CRIT]:`1;31`,[F.ERR]:`31`,[F.WARN]:`33`,[F.NOTICE]:`1;37`,[F.INFO]:`37`,[F.DEBUG]:`2;37`},css:{[F.EMERG]:`font-weight: bold; color: red;`,[F.ALERT]:`font-weight: bold; color: red;`,[F.CRIT]:`font-weight: bold; color: red;`,[F.ERR]:`color: red;`,[F.WARN]:`color: yellow;`,[F.NOTICE]:`font-weight: bold; color: white;`,[F.INFO]:`color: white;`,[F.DEBUG]:`opacity: 0.8; color: white;`}};function ye({style:e,colorize:t}){return function*(n){e==`css`&&(yield t==`level`?`%c%s %c%s`:`%c%s %c%s%s %c%s`),yield*e==`ansi`?[he(ge(n),`2;37`)]:[`opacity: 0.8; color: white;`,ge(n)];let r=e==`ansi`?[he(re[n.level].toUpperCase(),_e.ansi[n.level])]:[_e.css[n.level],re[n.level].toUpperCase()];if(t==`level`){yield*r,yield n.message;return}n.level<F.CRIT&&(yield*r),e==`ansi`?yield he(n.message,ve.ansi[n.level]):yield*[ve.css[n.level],n.message]}}var R=e=>[ge(e),e.message];function be(e){let t=R(e);return typeof t==`string`?[t]:Array.from(t)}var z=console.error;function xe(e){e.level>Se||z(...be(e))}var Se=F.ALERT,Ce=!1,we=!0;function Te(e){if(R=e.format??R,z=e.output??z,Se=typeof e.level==`string`?ie(e.level):e.level??Se,we=e.enabled??we,Ce=e.stack??Ce,e.dumpBacklog)for(let e of ae)xe(e)}function Ee(e){return typeof e==`object`&&!!e&&`create`in e&&typeof e.create==`function`}function De(e,t){return Object.defineProperty(t,"prototype",{value:void 0}),e&&Object.defineProperty(t,"name",{value:e}),t}function Oe(e){return!(e&&e.constructor===Function)||e.prototype===void 0?!1:Function.prototype!==Object.getPrototypeOf(e)||Object.getOwnPropertyNames(e.prototype).length>1}function ke(e,t){if(typeof t!=`object`||!t)throw I(M(`EINVAL`,`Invalid options`));for(let[n,r]of Object.entries(e.options)){let e=t?.[n];if(e==null){if(!r.required){pe(`Using default for option: `+n);continue}throw I(M(`EINVAL`,`Missing required option: `+n))}let i=(t,n=e)=>typeof t==`function`?Oe(t)?e instanceof t:t(e):typeof e===t||e?.constructor?.name===t;if(Array.isArray(r.type)?r.type.some(e=>i(e)):i(r.type))continue;let a=typeof e==`object`&&`constructor`in e?e.constructor.name:typeof e,o=e=>typeof e==`function`?e.name==`type`?e.toString():e.name:e;throw I(M(`EINVAL`,`Incorrect type for "${n}": ${a} (expected ${Array.isArray(r.type)?`one of ${r.type.map(o).join(`, `)}`:o(r.type)})`))}}function Ae(e){return typeof e==`object`&&!!e&&`backend`in e&&Ee(e.backend)}function je(e){return{suid:e.uid,sgid:e.gid,euid:e.uid,egid:e.gid,groups:[],...e}}function Me(e){return e?!e.uid||!e.gid||!e.euid||!e.egid||e.groups.some(e=>!e):!1}var Ne=Symbol(`ZenFSContext`),Pe={[Ne]:!0,id:0,root:`/`,pwd:`/`,credentials:je({uid:0,gid:0}),descriptors:new Map,parent:null,children:[]};function Fe(e){return typeof e==`object`&&e&&Ne in e?e:Pe}var Ie=1;function Le(e,t={}){let{root:n=e.root,pwd:r=e.pwd,credentials:i=structuredClone(e.credentials)}=t,a={[Ne]:!0,id:Ie++,root:n,pwd:r,credentials:je(i),descriptors:new Map,parent:e,children:[]};return Object.defineProperties(a,{id:{configurable:!1,writable:!1},credentials:{configurable:!1,writable:!1},descriptors:{configurable:!1,writable:!1},parent:{configurable:!1,writable:!1},children:{configurable:!1,writable:!1}}),a}var Re=t({COPYFILE_EXCL:()=>1,COPYFILE_FICLONE:()=>2,COPYFILE_FICLONE_FORCE:()=>4,F_OK:()=>0,O_APPEND:()=>ze,O_CREAT:()=>64,O_DIRECT:()=>Ke,O_DIRECTORY:()=>Be,O_DSYNC:()=>We,O_EXCL:()=>128,O_NOATIME:()=>Ve,O_NOCTTY:()=>256,O_NOFOLLOW:()=>He,O_NONBLOCK:()=>qe,O_RDONLY:()=>0,O_RDWR:()=>2,O_SYMLINK:()=>Ge,O_SYNC:()=>Ue,O_TRUNC:()=>512,O_WRONLY:()=>1,R_OK:()=>4,S_IFBLK:()=>Qe,S_IFCHR:()=>et,S_IFDIR:()=>$e,S_IFIFO:()=>tt,S_IFLNK:()=>Xe,S_IFMT:()=>Je,S_IFREG:()=>Ze,S_IFSOCK:()=>Ye,S_IRGRP:()=>32,S_IROTH:()=>4,S_IRUSR:()=>256,S_IRWXG:()=>56,S_IRWXO:()=>7,S_IRWXU:()=>448,S_ISGID:()=>rt,S_ISUID:()=>nt,S_ISVTX:()=>512,S_IWGRP:()=>16,S_IWOTH:()=>2,S_IWUSR:()=>128,S_IXGRP:()=>8,S_IXOTH:()=>1,S_IXUSR:()=>64,UV_FS_O_FILEMAP:()=>0,W_OK:()=>2,X_OK:()=>1,size_max:()=>it}),ze=1024,Be=65536,Ve=262144,He=131072,Ue=1052672,We=4096,Ge=32768,Ke=16384,qe=2048,Je=61440,Ye=49152,Xe=40960,Ze=32768,Qe=24576,$e=16384,et=8192,tt=4096,nt=2048,rt=1024,it=4294967295;function at(e){return`__isArrayType`in e&&e.__isArrayType===!0}function ot(e){return typeof e!=`object`&&typeof e!=`function`||e==null?!1:at(e)?ot(e.type):`name`in e&&`size`in e&&`get`in e&&`set`in e&&typeof e.name==`string`&&typeof e.size==`number`&&typeof e.get==`function`&&typeof e.set==`function`&&st.has(e.name)&&st.get(e.name)?.name===e.name}var st=new Map;function ct(e){if(st.has(e.name))throw ReferenceError(`Type is already registered: ${e.name}`);st.set(e.name,e)}var lt=Symbol(`DataView`);function ut(e){return e[lt]??=new DataView(e),e[lt]}var dt={name:`int8`,size:1,array:Int8Array,get:(e,t)=>ut(e).getInt8(t),set:(e,t,n)=>ut(e).setInt8(t,n)},ft={name:`uint8`,size:1,array:Uint8Array,get:(e,t)=>ut(e).getUint8(t),set:(e,t,n)=>ut(e).setUint8(t,n)},pt={int8:dt,uint8:ft,int16:{name:`int16`,size:2,array:Int16Array,get:(e,t)=>ut(e).getInt16(t,!0),set:(e,t,n)=>ut(e).setInt16(t,n,!0)},uint16:{name:`uint16`,size:2,array:Uint16Array,get:(e,t)=>ut(e).getUint16(t,!0),set:(e,t,n)=>ut(e).setUint16(t,n,!0)},int32:{name:`int32`,size:4,array:Int32Array,get:(e,t)=>ut(e).getInt32(t,!0),set:(e,t,n)=>ut(e).setInt32(t,n,!0)},uint32:{name:`uint32`,size:4,array:Uint32Array,get:(e,t)=>ut(e).getUint32(t,!0),set:(e,t,n)=>ut(e).setUint32(t,n,!0)},int64:{name:`int64`,size:8,array:BigInt64Array,get:(e,t)=>ut(e).getBigInt64(t,!0),set:(e,t,n)=>ut(e).setBigInt64(t,n,!0)},uint64:{name:`uint64`,size:8,array:BigUint64Array,get:(e,t)=>ut(e).getBigUint64(t,!0),set:(e,t,n)=>ut(e).setBigUint64(t,n,!0)},float32:{name:`float32`,size:4,array:Float32Array,get:(e,t)=>ut(e).getFloat32(t,!0),set:(e,t,n)=>ut(e).setFloat32(t,n,!0)},float64:{name:`float64`,size:8,array:Float64Array,get:(e,t)=>ut(e).getFloat64(t,!0),set:(e,t,n)=>ut(e).setFloat64(t,n,!0)}},mt=Object.keys(pt);for(let e of Object.values(pt))ct(e);var ht={...pt,...Object.fromEntries(mt.map(e=>[x(e),pt[e]])),char:ft},gt=Object.keys(ht);function _t(e){return gt.includes(e.toString())}function vt(e){if(!_t(e))throw M(`EINVAL`,`Not a valid primitive type: `+e)}function yt(e){return e==`char`?`uint8`:e.toLowerCase()}function bt(e){return(typeof e==`object`||typeof e==`function`)&&e!==null&&`toInit`in e&&typeof e.toInit==`function`}function xt(e){return bt(e)?e.toInit():ot(e)?{type:e}:e}function St(e,t,n={}){if(!e)throw M(`EINVAL`,`Invalid name for struct field`);typeof e==`symbol`&&console.warn(`Symbol used for struct field name will be coerced to string: `+e.toString());let r=e.toString(),i=Object.assign(xt(t),n);if(!ot(i.type))throw M(`EINVAL`,`Invalid type for struct field "${r}"`);let a=i.countedBy?` counted_by(${typeof i.countedBy==`string`?i.countedBy:`<function>`})`:``;return{name:r,offset:0,type:i.type,countedBy:i.countedBy,alignment:i.align??i.type.size,decl:i.type instanceof Rt?`${i.typeName??i.type.type.name} ${r}[${i.type.length}]${a}`:`${i.typeName??i.type.name} ${r}`,littleEndian:!i.bigEndian}}function Ct(e,t){if(!(e instanceof Error)||e.message.toLowerCase()!==`offset is outside the bounds of the dataview`)throw e;let n=M(`EFAULT`,`Segmentation fault (at 0x${t.toString(16)})`);throw Error.captureStackTrace(n,Ct),n}function wt(e,t){return t.type instanceof Rt&&t.type.length==0&&!!t.countedBy?.length&&!!e.constructor.isDynamic}function Tt(e,t){let n=typeof t.countedBy==`function`?t.countedBy(e):e[t.countedBy];if(typeof n==`bigint`){if(n>BigInt(2**53-1))throw M(`EOVERFLOW`,`countedBy field value exceeds max safe integer`);n=Number(n)}if(typeof n!=`number`)throw M(`EINVAL`,`countedBy field value is not a number`);return n}function Et(e,t){let n=t.type.type.size*Tt(e,t);if(Mt(t.type.type)&&t.type.type.isDynamic)for(let r of e[t.name])n+=Nt(r);return n}var Dt=Symbol(`kOffsets`);function Ot(e,t,n){let{offset:r,name:i}=t;e[Dt]||=Object.create(null);let a=e[Dt];if(a[i]!==void 0){if(n)return a[i];delete a[i]}let{fields:o}=e.constructor,s=o.indexOf(t);for(let t of o.slice(0,s)){wt(e,t)&&(r+=Et(e,t));let n=e[t.name];jt(n)&&n.constructor.isDynamic&&(r+=Nt(n))}if(n)a[i]=r;else for(let e of o.slice(s))a[e.name]!==void 0&&delete a[e.name];return r}function kt(e,t,n,r){typeof n==`string`&&(n=n.charCodeAt(0));let i=e.byteOffset+Ot(e,t,!1)+(r??0)*t.type.size;try{t.type.set(e.buffer,i,n);return}catch(e){Ct(e,i)}}function At(e,t){let n=t.type;if(wt(e,t)){let r=t.type.type;n=new Rt(r,Tt(e,t))}let r=e.byteOffset+Ot(e,t,!0);try{return n.get(e.buffer,r)}catch(e){Ct(e,r)}}function jt(e){return typeof e==`object`&&!!e&&`constructor`in e&&Mt(e.constructor)}function Mt(e){return typeof e==`function`&&`prototype`in e&&`fields`in e&&typeof e.fields==`object`&&ot(e)}function Nt(e){let t=0;for(let n of e.constructor.fields){let r=e[n.name];wt(e,n)&&(t+=Et(e,n)),jt(r)&&r.constructor.isDynamic&&(t+=Nt(r))}return t}function Pt(e){if(ot(e))return e.size;if(e==null)return 0;if(typeof e==`object`&&ot(e.constructor))return e.constructor.size;if(Array.isArray(e)){let t=0;for(let n=0;n<e.length;n++)t+=Pt(e[n]);return t}if(typeof e==`string`)return vt(e),pt[yt(e)].size;throw TypeError(`Unable to resolve size of \`${e.toString()}\``)}function B(e){let t=Pt(e);return jt(e)&&e.constructor.isDynamic?t+Nt(e):t}function Ft(e,t){let n;if(Mt(e)){if(e.isDynamic)throw M(`EINVAL`,`Cannot get offset of field in dynamic struct from the constructor`);n=e}else if(jt(e))n=e.constructor;else throw M(`EINVAL`,`Type is not a struct or struct constructor`);let{fields:r}=n,i=r.find(e=>e.name===t);if(!i)throw M(`EINVAL`,`Struct does not have field: `+t);return Mt(e)?i.offset:Ot(e,i,!0)}function It(e,t){class n extends DataView{length;type=e;*[Symbol.iterator](){for(let e=0;e<this.length;e++)yield this[e]}_offsets=[0];offsetOf(t){if(!e.isDynamic)return t*e.size;if(t<this._offsets.length)return this._offsets[t];for(let n=this._offsets.length;n<=t;n++)this._offsets[n]=this._offsets[n-1]+B(e.get(this.buffer,this.byteOffset+this._offsets[n-1]));return this._offsets[t]}constructor(n,r,i){let a=typeof n==`object`?n:new ArrayBuffer((n??0)*e.size);super(a,r,i),this.length=typeof n==`number`?n:e.isDynamic?t??_(`Unknown length of StructArray<${e.name}>`):Math.floor(this.byteLength/e.size);let o=e=>this.byteOffset+this.offsetOf(e);return new Proxy(this,{get(t,n){if(n in t)return t[n];let r=parseInt(n.toString());if(Number.isSafeInteger(r))return e.get(t.buffer,o(r))},set(t,n,r){let i=parseInt(n.toString());return Number.isSafeInteger(i)?(e.set(t.buffer,o(i),r),!0):!1}})}}for(let e of Object.getOwnPropertyNames(DataView.prototype))!e.startsWith(`get`)&&!e.startsWith(`set`)||Object.defineProperty(n.prototype,e,{enumerable:!1,configurable:!1,writable:!1,value:void 0});return n}function Lt(e){return typeof e==`function`&&`prototype`in e&&`fields`in e&&typeof e.fields==`object`&&ot(e)}var Rt=class{type;length;name;size;__structArray;__arrayType;__isArrayType=!0;constructor(e,t){this.type=e,this.length=t,this.name=`${e.name}[${t}]`,this.size=e.size*t,this.array=It(this),this.__structArray=It(e,t),this.__arrayType=e.array?e.array:this.__structArray}get=(e,t)=>_t(this.type.name)&&t%this.type.size!==0?new this.__structArray(e,t,this.size):new this.__arrayType(e,t,this.size);set=(e,t,n)=>{if(this.length)for(let r=0;r<this.length;r++)this.type.set(e,t+r*this.type.size,n[r]);else{let r=t;for(let t=0;t<n.length;t++)this.type.set(e,r,n[t]),r+=Lt(this.type)&&this.type.isDynamic?B(n[t]):this.type.size}};array};Symbol.metadata??=Symbol.for(`Symbol.metadata`);function zt(e){e.metadata??={};let t=e.metadata.structInit??{};return e.metadata.structInit={fields:[...t.fields??[]]},e.metadata.structInit}function Bt(...e){let t=e.reduce((e,t)=>({...e,...t}),{});return typeof this==`object`&&Object.assign(t,this),function(e,n){let r=zt(n),i=1,a=[],o=0,s=e=>{o=Math.ceil(o/e)*e};for(let e of r.fields)t.isPacked||s(e.alignment),t.isUnion?o=Math.max(o,e.type.size):(e.offset=o,o+=e.type.size),a.push(e),i=Math.max(i,e.alignment);t.alignment??=i,t.isPacked||s(t.alignment);class c extends e{static name=e.name;static size=o;static alignment=t.alignment;static isUnion=!!t.isUnion;static isDynamic=!!t.isDynamic;static fields=a;static get(e,t){return new this(e,t)}static set(e,t,n){let r=new Uint8Array(n.buffer,n.byteOffset,this.size),i=new Uint8Array(e,t,this.size);if(n.buffer!==e||n.byteOffset!==t)for(let e=0;e<this.size;e++)i[e]=r[e]}static[Symbol.toStringTag]=`[struct ${e.name}]`;constructor(...e){e.length||(e=[new ArrayBuffer(o),0,o]),super(...e);for(let e of Object.values(a))Object.defineProperty(this,e.name,{enumerable:!0,configurable:!0,get(){return At(this,e)},set(t){kt(this,e,t)}})}}return n.addInitializer(function(){Object.defineProperty(c,"name",{value:e.name}),ct(c)}),c}}Bt.packed=Bt.bind({isPacked:!0}),Bt.align=function(e){return Bt.bind({alignment:e})};function Vt(e,t={}){return function(n,r){if(r.kind!=`accessor`)throw M(`EINVAL`,`Field must be an accessor`);let i=zt(r),a=St(r.name,e,t);return i.fields.push(a),{get(){return At(this,a)},set(e){kt(this,a,e)}}}}function Ht(e){let t=pt[yt(e)];function n(n,r){return typeof n==`number`?Vt(new Rt(t,n),{typeName:e,...r}):Vt(t,{typeName:e})(n,r&&`name`in r?r:_(M(`EINVAL`,`Invalid decorator context object`)))}return n}var V=Object.fromEntries(gt.map(e=>[e,Ht(e)]));function Ut(e){return e}Ut.typed=function(e){return e};var Wt=class e{type;init;constructor(t,n){this.type=t,this.init=n;let r=(r=>new e(new Rt(t,r),n));return Object.setPrototypeOf(r,new.target.prototype),Object.assign(r,{type:t,init:n}),r}align(t){return new e(this.type,{...this.init,align:t})}countedBy(t){return new e(this.type,{...this.init,countedBy:t})}bigEndian(){return new e(this.type,{...this.init,bigEndian:!0})}toInit(){return{type:this.type,...this.init}}$type(){return new e(this.type,this.init)}};function Gt(e,t=0){return new Wt(new Rt(e,t),{})}function Kt(e,t,...n){let r=n.reduce((e,t)=>({...e,...t}),{});typeof this==`object`&&Object.assign(r,this);let i=1,a=0,o=e=>{a=Math.ceil(a/e)*e},s=[];for(let[e,n]of Object.entries(t)){if(typeof e==`number`)throw TypeError(`Field names can not be numbers`);let t=St(e,n);r.isPacked||o(t.alignment),r.isUnion?a=Math.max(a,t.type.size):(t.offset=a,a+=t.type.size),s.push(t),i=Math.max(i,t.alignment)}r.alignment??=i,r.isPacked||o(r.alignment);class c extends DataView{static name=e;static size=a;static alignment=r.alignment;static isUnion=!!r.isUnion;static isDynamic=!!r.isDynamic;static fields=s;static get(e,t){return new this(e,t)}static set(e,t,n){let r=new Uint8Array(n.buffer,n.byteOffset,this.size),i=new Uint8Array(e,t,this.size);if(n.buffer!==e||n.byteOffset!==t)for(let e=0;e<this.size;e++)i[e]=r[e]}static[Symbol.toStringTag]=`[struct ${e}]`;constructor(e=new ArrayBuffer(a),t,n){super(e,t,n??e.byteLength-(t??0));for(let e of Object.values(this.constructor.fields??s))Object.defineProperty(this,e.name,{enumerable:!0,configurable:!0,get(){return At(this,e)},set(t){kt(this,e,t)}})}}for(let e of Object.getOwnPropertyNames(DataView.prototype))!e.startsWith(`get`)&&!e.startsWith(`set`)||Object.defineProperty(c.prototype,e,{enumerable:!1,configurable:!1,writable:!1,value:void 0});return ct(c),c}Kt.extend=function(e,t,n,...r){let i=r.reduce((e,t)=>({...e,...t}),{});typeof this==`object`&&Object.assign(i,this);let a=1,o=e.size,s=e=>{o=Math.ceil(o/e)*e},c=e.fields;for(let[e,t]of Object.entries(n)){if(typeof e==`number`)throw TypeError(`Field names can not be numbers`);let n=St(e,t);i.isPacked||s(n.alignment),i.isUnion?o=Math.max(o,n.type.size):(n.offset=o,o+=n.type.size),c.push(n),a=Math.max(a,n.alignment)}i.alignment??=a,i.isPacked||s(i.alignment);class l extends e{static name=t;static size=o;static alignment=i.alignment;static isUnion=!!i.isUnion;static isDynamic=!!i.isDynamic;static fields=c;static[Symbol.toStringTag]=`[struct ${t}]`}return ct(l),l},Kt.packed=Kt.bind({isPacked:!0}),Kt.align=function(e){return Kt.bind({alignment:e})},Kt.dynamic=Kt.bind({isDynamic:!0}),Object.fromEntries(Object.entries(ht).map(([e,t])=>[e,new Wt(t,{typeName:e})]));function qt(e){return JSON.parse(T(e),(e,t)=>e==``?t:typeof t==`string`?BigInt(t).toString(16).slice(0,Math.min(t.length,8)):t)}function Jt(e){return C(JSON.stringify(e))}function Yt(e,t){if(typeof e==`number`)return e;if(typeof e==`string`){let t=parseInt(e,8);if(!isNaN(t))return t}if(typeof t==`number`)return t;throw M(`EINVAL`,`Invalid mode: `+e?.toString())}var Xt=2147483647;function Zt(e){if(!(Number.isInteger(e)&&e>=0&&e<=Xt))throw Object.assign(RangeError(`The value of "fd" is out of range. It must be >= 0 && <= ${Xt}. Received ${e}`),{code:`ERR_OUT_OF_RANGE`})}function Qt(e){if(e instanceof Date)return e.getTime();let t=Number(e);if(!Number.isFinite(t))throw M(`EINVAL`,`Invalid time.`);return t<0?Date.now():t*1e3}function H(e,t=!1){if(e instanceof URL){if(e.protocol!=`file:`)throw M(`EINVAL`,`URLs must use the file: protocol`);e=e.pathname}if(e=e.toString(),e.startsWith(`file://`)&&(e=e.slice(7)),e.includes(`\0`))throw M(`EINVAL`,`Path can not contain null character`);if(e.length==0)throw M(`EINVAL`,`Path can not be empty`);return e=e.replaceAll(/[/\\]+/g,`/`),t?e:cn.call(this,e)}function $t(e,t=`utf8`,n,r=0){return typeof e!=`object`||!e?{encoding:typeof e==`string`?e:t??null,flag:n,mode:r}:{encoding:typeof e?.encoding==`string`?e.encoding:t??null,flag:typeof e?.flag==`string`?e.flag:n,mode:Yt(`mode`in e?e?.mode:null,r)}}function en(e){let t=`\0GS\0`;return e=e.replace(/\*\*/g,t).replace(/\*/g,`\0S\0`).replace(/[.+^$(){}|[\]\\]/g,`\\$&`).replace(/\?/g,`.`).replaceAll(`/\0GS\0/`,`(?:/.*)?/`).replaceAll(t,`.*`).replaceAll(`\0S\0`,`[^/]*`),RegExp(`^${e}$`)}async function tn(e){let t=Promise.withResolvers();setTimeout(()=>t.reject(M(`ETIMEDOUT`)),500),e.on(`online`,t.resolve),await t.promise}function nn(e){return`${H(e,!0)}${Date.now()}-${Math.random().toString(36).slice(2)}`}var rn=t({basename:()=>fn,dirname:()=>W,extname:()=>pn,format:()=>mn,formatExt:()=>sn,isAbsolute:()=>un,join:()=>U,matchesGlob:()=>gn,normalize:()=>ln,normalizeString:()=>on,parse:()=>hn,relative:()=>dn,resolve:()=>cn,sep:()=>`/`});function an(e,t){if(typeof e!=`object`)throw TypeError(`"${t}" is not an object`)}function on(e,t){let n=``,r=0,i=-1,a=0,o=`\0`;for(let s=0;s<=e.length;++s){if(s<e.length)o=e[s];else if(o==`/`)break;else o=`/`;if(o==`/`){if(i!==s-1&&a!==1)if(a===2){if(n.length<2||r!==2||n.at(-1)!==`.`||n.at(-2)!==`.`){if(n.length>2){let e=n.lastIndexOf(`/`);e===-1?(n=``,r=0):(n=n.slice(0,e),r=n.length-1-n.lastIndexOf(`/`)),i=s,a=0;continue}if(n.length!==0){n=``,r=0,i=s,a=0;continue}}t&&(n+=n.length>0?`/..`:`..`,r=2)}else n.length>0?n+=`/`+e.slice(i+1,s):n=e.slice(i+1,s),r=s-i-1;i=s,a=0}else o===`.`&&a!==-1?++a:a=-1}return n}function sn(e){return e?`${e[0]===`.`?``:`.`}${e}`:``}function cn(...e){let t=``;for(let n of[...e.reverse(),Fe(this).pwd])if(n?.length&&(t=`${n}/${t}`,n.startsWith(`/`)))break;let n=t.startsWith(`/`);return t=on(t,!n),n?`/${t}`:t.length?t:`/`}function ln(e){if(!e.length)return`.`;let t=e[0]===`/`,n=e.at(-1)===`/`;return e=on(e,!t),e.length?(n&&(e+=`/`),t?`/${e}`:e):t?`/`:n?`./`:`.`}function un(e){return e.startsWith(`/`)}function U(...e){if(!e.length)return`.`;let t=e.filter(e=>e).join(`/`);return t?.length?ln(t):`.`}function dn(e,t){if(e===t||(e=cn.call(this,e),t=cn.call(this,t),e===t))return``;let n=e.length,r=n-1,i=t.length-1,a=r<i?r:i,o=-1,s=0;for(;s<a;s++){let n=e[1+s];if(n!==t[1+s])break;n===`/`&&(o=s)}if(s===a)if(i>a){if(t[1+s]===`/`)return t.slice(1+s+1);if(s===0)return t.slice(1+s)}else r>a&&(e[1+s]===`/`?o=s:s===0&&(o=0));let c=``;for(s=1+o+1;s<=n;++s)(s===n||e[s]===`/`)&&(c+=c.length===0?`..`:`/..`);return`${c}${t.slice(1+o)}`}function W(e){if(e.length===0)return`.`;let t=e[0]===`/`,n=-1,r=!0;for(let t=e.length-1;t>=1;--t)if(e[t]===`/`){if(!r){n=t;break}}else r=!1;return n===-1?t?`/`:`.`:t&&n===1?`//`:e.slice(0,n)}function fn(e,t){let n=0,r=-1,i=!0;if(t!==void 0&&t.length>0&&t.length<=e.length){if(t===e)return``;let a=t.length-1,o=-1;for(let s=e.length-1;s>=0;--s)if(e[s]===`/`){if(!i){n=s+1;break}}else o===-1&&(i=!1,o=s+1),a>=0&&(e[s]===t[a]?--a===-1&&(r=s):(a=-1,r=o));return n===r?r=o:r===-1&&(r=e.length),e.slice(n,r)}for(let t=e.length-1;t>=0;--t)if(e[t]===`/`){if(!i){n=t+1;break}}else r===-1&&(i=!1,r=t+1);return r===-1?``:e.slice(n,r)}function pn(e){let t=-1,n=0,r=-1,i=!0,a=0;for(let o=e.length-1;o>=0;--o){if(e[o]===`/`){if(!i){n=o+1;break}continue}r===-1&&(i=!1,r=o+1),e[o]===`.`?t===-1?t=o:a!==1&&(a=1):t!==-1&&(a=-1)}return t===-1||r===-1||a===0||a===1&&t===r-1&&t===n+1?``:e.slice(t,r)}function mn(e){an(e,`pathObject`);let t=e.dir||e.root,n=e.base||`${e.name||``}${sn(e.ext)}`;return t?t===e.root?`${t}${n}`:`${t}/${n}`:n}function hn(e){let t=e[0]===`/`,n={root:t?`/`:``,dir:``,base:``,ext:``,name:``};if(e.length===0)return n;let r=+!!t,i=-1,a=0,o=-1,s=!0,c=e.length-1,l=0;for(;c>=r;--c){if(e[c]===`/`){if(!s){a=c+1;break}continue}o===-1&&(s=!1,o=c+1),e[c]===`.`?i===-1?i=c:l!==1&&(l=1):i!==-1&&(l=-1)}if(o!==-1){let r=a===0&&t?1:a;i===-1||l===0||l===1&&i===o-1&&i===a+1?n.base=n.name=e.slice(r,o):(n.name=e.slice(r,i),n.base=e.slice(r,o),n.ext=e.slice(i,o))}return a>0?n.dir=e.slice(0,a-1):t&&(n.dir=`/`),n}function gn(e,t){return en(e).test(t)}var _n=BigInt(1e3),vn=class{_convert(e){return this._isBigint?BigInt(e):Number(e)}get blocks(){return this._convert(Math.ceil(Number(this.size)/512))}set blocks(e){}mode;dev=this._convert(0);ino=this._convert(0);rdev=this._convert(0);nlink=this._convert(1);blksize=this._convert(4096);uid=this._convert(0);gid=this._convert(0);atimeMs;get atime(){return new Date(Number(this.atimeMs))}set atime(e){this.atimeMs=this._convert(e.getTime())}mtimeMs;get mtime(){return new Date(Number(this.mtimeMs))}set mtime(e){this.mtimeMs=this._convert(e.getTime())}ctimeMs;get ctime(){return new Date(Number(this.ctimeMs))}set ctime(e){this.ctimeMs=this._convert(e.getTime())}birthtimeMs;get birthtime(){return new Date(Number(this.birthtimeMs))}set birthtime(e){this.birthtimeMs=this._convert(e.getTime())}size;data;flags;version;constructor({atimeMs:e,mtimeMs:t,ctimeMs:n,birthtimeMs:r,uid:i,gid:a,size:o,mode:s,ino:c,...l}={}){let u=Date.now();this.atimeMs=this._convert(e??u),this.mtimeMs=this._convert(t??u),this.ctimeMs=this._convert(n??u),this.birthtimeMs=this._convert(r??u),this.uid=this._convert(i??0),this.gid=this._convert(a??0),this.size=this._convert(o??0),this.ino=this._convert(c??0),this.mode=this._convert(s??0),this.mode&61440||(this.mode|=this._convert(Ze)),Object.assign(this,l)}isFile(){return(this.mode&Je)===Ze}isDirectory(){return(this.mode&Je)===$e}isSymbolicLink(){return(this.mode&Je)===Xe}isSocket(){return(this.mode&Je)===Ye}isBlockDevice(){return(this.mode&Je)===Qe}isCharacterDevice(){return(this.mode&Je)===et}isFIFO(){return(this.mode&Je)===tt}toJSON(){return d(this,On)}hasAccess(e,t){return J(t,this._isBigint?new yn(this):this,e)}get atimeNs(){return BigInt(this.atimeMs)*_n}get mtimeNs(){return BigInt(this.mtimeMs)*_n}get ctimeNs(){return BigInt(this.ctimeMs)*_n}get birthtimeNs(){return BigInt(this.birthtimeMs)*_n}},yn=class extends vn{_isBigint=!1},bn=class extends vn{_isBigint=!0};function xn(e,t){return e.size==t.size&&+e.atime==+t.atime&&+e.mtime==+t.mtime&&+e.ctime==+t.ctime&&e.mode==t.mode}var Sn=class{type=525687744115;bsize=4096;blocks=0;bfree=0;bavail=0;files=it;ffree=it},Cn=class{type=BigInt(`0x7a656e6673`);bsize=BigInt(4096);blocks=BigInt(0);bfree=BigInt(0);bavail=BigInt(0);files=BigInt(it);ffree=BigInt(it)},wn=function(e,t,n,r,i,a){function o(e){if(e!==void 0&&typeof e!=`function`)throw TypeError(`Function expected`);return e}for(var s=r.kind,c=s===`getter`?`get`:s===`setter`?`set`:`value`,l=!t&&e?r.static?e:e.prototype:null,u=t||(l?Object.getOwnPropertyDescriptor(l,r.name):{}),d,f=!1,p=n.length-1;p>=0;p--){var m={};for(var h in r)m[h]=h===`access`?{}:r[h];for(var h in r.access)m.access[h]=r.access[h];m.addInitializer=function(e){if(f)throw TypeError(`Cannot add initializers after decoration has completed`);a.push(o(e||null))};var g=(0,n[p])(s===`accessor`?{get:u.get,set:u.set}:u[c],m);if(s===`accessor`){if(g===void 0)continue;if(typeof g!=`object`||!g)throw TypeError(`Object expected`);(d=o(g.get))&&(u.get=d),(d=o(g.set))&&(u.set=d),(d=o(g.init))&&i.unshift(d)}else(d=o(g))&&(s===`field`?i.unshift(d):u[c]=d)}l&&Object.defineProperty(l,r.name,u),f=!0},G=function(e,t,n){for(var r=arguments.length>2,i=0;i<t.length;i++)n=r?t[i].call(e,n):t[i].call(e);return r?n:void 0},Tn=3968,En=(()=>{var e,t;let n=[Bt.packed()],r,i=[],a,o=Ut.typed(Uint8Array),s,c=[],l=[],u,d=[],f=[];var p=class extends o{static{a=this}static{let m=typeof Symbol==`function`&&Symbol.metadata?Object.create(o[Symbol.metadata]??null):void 0;s=[(e=V).uint32.bind(e)],u=[(t=V).uint32.bind(t)],wn(this,null,s,{kind:`accessor`,name:`keySize`,static:!1,private:!1,access:{has:e=>`keySize`in e,get:e=>e.keySize,set:(e,t)=>{e.keySize=t}},metadata:m},c,l),wn(this,null,u,{kind:`accessor`,name:`valueSize`,static:!1,private:!1,access:{has:e=>`valueSize`in e,get:e=>e.valueSize,set:(e,t)=>{e.valueSize=t}},metadata:m},d,f),wn(null,r={value:a},n,{kind:`class`,name:a.name,metadata:m},null,i),p=a=r.value,m&&Object.defineProperty(a,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:m})}static name=`Attribute`;#e=G(this,c,void 0);get keySize(){return this.#e}set keySize(e){this.#e=e}#t=(G(this,l),G(this,d,void 0));get valueSize(){return this.#t}set valueSize(e){this.#t=e}get name(){return T(this.subarray(8,8+this.keySize))}set name(e){let t=C(e);if(8+t.length+this.valueSize>Tn)throw M(`EOVERFLOW`);this.set(t,8),this.keySize=t.length}get value(){return this.subarray(8+this.keySize,this.size)}set value(e){if(8+this.keySize+e.length>Tn)throw M(`EOVERFLOW`);this.valueSize=e.length,this.set(e,8+this.keySize)}get size(){return 8+this.keySize+this.valueSize}constructor(){super(...arguments),G(this,f)}static{G(a,i)}};return a})(),Dn=(()=>{var e;let t=[Bt.packed()],n,r=[],a,o=Ut(i),s,c=[],l=[];var u=class extends o{static{a=this}static{let i=typeof Symbol==`function`&&Symbol.metadata?Object.create(o[Symbol.metadata]??null):void 0;s=[(e=V).uint32.bind(e)],wn(this,null,s,{kind:`accessor`,name:`size`,static:!1,private:!1,access:{has:e=>`size`in e,get:e=>e.size,set:(e,t)=>{e.size=t}},metadata:i},c,l),wn(null,n={value:a},t,{kind:`class`,name:a.name,metadata:i},null,r),u=a=n.value,i&&Object.defineProperty(a,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:i})}static name=`Attributes`;#e=G(this,c,void 0);get size(){return this.#e}set size(e){this.#e=e}get byteSize(){let e=this.byteOffset+B(this);for(let t=0;t<this.size;t++){let t=new En(this.buffer,e);e+=t.size}return e}has(e){let t=this.byteOffset+B(this);for(let n=0;n<this.size;n++){let n=new En(this.buffer,t);if(n.name==e)return!0;t+=n.size}return!1}get(e){let t=this.byteOffset+B(this);for(let n=0;n<this.size;n++){let n=new En(this.buffer,t);if(n.name==e)return n.value;t+=n.size}}set(e,t){let n=this.byteOffset+B(this),r;for(let t=0;t<this.size;t++){let t=new En(this.buffer,n);t.name==e&&(r=[n,t.size]),n+=t.size}let i=new Uint8Array(this.buffer);if(r){let[e,t]=r;n-=t,i.copyWithin(e,e+t,n+t),i.fill(0,n,n+t),this.size--}let a=new En(this.buffer,n);a.name=e,a.value=t,this.size++}remove(e){let t=this.byteOffset+B(this),n;for(let r=0;r<this.size;r++){let r=new En(this.buffer,t);r.name==e&&(n=[t,r.size]),t+=r.size}if(!n)return!1;let[r,i]=n,a=new Uint8Array(this.buffer);return a.copyWithin(r,r+i,t),a.fill(0,t-i,t),this.size--,!0}copyFrom(e){let{byteSize:t}=e;new Uint8Array(this.buffer,this.byteOffset,t).set(new Uint8Array(e.buffer,e.byteOffset,t))}*keys(){let e=this.byteOffset+B(this);for(let t=0;t<this.size;t++){let t=new En(this.buffer,e);yield t.name,e+=t.size}}*values(){let e=this.byteOffset+B(this);for(let t=0;t<this.size;t++){let t=new En(this.buffer,e);yield t.value,e+=t.size}}*entries(){let e=this.byteOffset+B(this);for(let t=0;t<this.size;t++){let t=new En(this.buffer,e);yield[t.name,t.value],e+=t.size}}constructor(){super(...arguments),G(this,l)}static{G(a,r)}};return a})(),On=[`ino`,`data`,`size`,`mode`,`flags`,`nlink`,`uid`,`gid`,`atimeMs`,`birthtimeMs`,`mtimeMs`,`ctimeMs`,`version`],kn;(function(e){e[e.Sync=1]=`Sync`,e[e.NoAtime=2]=`NoAtime`,e[e.Append=4]=`Append`,e[e.Immutable=8]=`Immutable`,e[e.Dead=16]=`Dead`,e[e.NoQuota=32]=`NoQuota`,e[e.Dirsync=64]=`Dirsync`,e[e.NoCMtime=128]=`NoCMtime`,e[e.SwapFile=256]=`SwapFile`,e[e.Private=512]=`Private`,e[e.IMA=1024]=`IMA`,e[e.AutoMount=2048]=`AutoMount`,e[e.NoSec=4096]=`NoSec`,e[e.DAX=8192]=`DAX`,e[e.Encrypted=16384]=`Encrypted`,e[e.CaseFold=32768]=`CaseFold`,e[e.Verity=65536]=`Verity`,e[e.KernelFile=131072]=`KernelFile`})(kn||={});var An=253951,jn=229631,K=(()=>{var e,t,n,r,a,o,s,c,l,u,f,p,m,h,g,_;let v=[Bt.packed()],y,b=[],x,S=Ut(i),C,w=[],T=[],ee,E=[],te=[],D,O=[],ne=[],k,A=[],j=[],N,P=[],F=[],re,ie=[],ae=[],oe,se=[],ce=[],le,I=[],de=[],fe,pe=[],me=[],he,ge=[],_e=[],ve,ye=[],R=[],be,z=[],xe=[],Se,Ce=[],we=[],Te,Ee=[],De=[],Oe,ke=[],Ae=[],je,Me=[],Ne=[],Pe,Fe=[],Ie=[],Le,Re=[],ze=[],Be,Ve=[],He=[];var Ue=class extends S{static{x=this}static{let i=typeof Symbol==`function`&&Symbol.metadata?Object.create(S[Symbol.metadata]??null):void 0;C=[(e=V).uint32.bind(e)],ee=[(t=V).uint32.bind(t)],D=[(n=V).uint32.bind(n)],k=[(r=V).uint16.bind(r)],N=[(a=V).uint32.bind(a)],re=[(o=V).uint32.bind(o)],oe=[(s=V).uint32.bind(s)],le=[(c=V).float64.bind(c)],fe=[(l=V).float64.bind(l)],he=[(u=V).float64.bind(u)],ve=[(f=V).float64.bind(f)],be=[(p=V).uint32.bind(p)],Se=[(m=V).uint32.bind(m)],Te=[(h=V).uint32.bind(h)],Oe=[(g=V).uint16.bind(g)],je=[(_=V).uint32.bind(_)],Pe=[V.uint8(48)],Le=[Vt(Dn)],Be=[V.uint8(Tn)],wn(this,null,C,{kind:`accessor`,name:`data`,static:!1,private:!1,access:{has:e=>`data`in e,get:e=>e.data,set:(e,t)=>{e.data=t}},metadata:i},w,T),wn(this,null,ee,{kind:`accessor`,name:`__data_old`,static:!1,private:!1,access:{has:e=>`__data_old`in e,get:e=>e.__data_old,set:(e,t)=>{e.__data_old=t}},metadata:i},E,te),wn(this,null,D,{kind:`accessor`,name:`size`,static:!1,private:!1,access:{has:e=>`size`in e,get:e=>e.size,set:(e,t)=>{e.size=t}},metadata:i},O,ne),wn(this,null,k,{kind:`accessor`,name:`mode`,static:!1,private:!1,access:{has:e=>`mode`in e,get:e=>e.mode,set:(e,t)=>{e.mode=t}},metadata:i},A,j),wn(this,null,N,{kind:`accessor`,name:`nlink`,static:!1,private:!1,access:{has:e=>`nlink`in e,get:e=>e.nlink,set:(e,t)=>{e.nlink=t}},metadata:i},P,F),wn(this,null,re,{kind:`accessor`,name:`uid`,static:!1,private:!1,access:{has:e=>`uid`in e,get:e=>e.uid,set:(e,t)=>{e.uid=t}},metadata:i},ie,ae),wn(this,null,oe,{kind:`accessor`,name:`gid`,static:!1,private:!1,access:{has:e=>`gid`in e,get:e=>e.gid,set:(e,t)=>{e.gid=t}},metadata:i},se,ce),wn(this,null,le,{kind:`accessor`,name:`atimeMs`,static:!1,private:!1,access:{has:e=>`atimeMs`in e,get:e=>e.atimeMs,set:(e,t)=>{e.atimeMs=t}},metadata:i},I,de),wn(this,null,fe,{kind:`accessor`,name:`birthtimeMs`,static:!1,private:!1,access:{has:e=>`birthtimeMs`in e,get:e=>e.birthtimeMs,set:(e,t)=>{e.birthtimeMs=t}},metadata:i},pe,me),wn(this,null,he,{kind:`accessor`,name:`mtimeMs`,static:!1,private:!1,access:{has:e=>`mtimeMs`in e,get:e=>e.mtimeMs,set:(e,t)=>{e.mtimeMs=t}},metadata:i},ge,_e),wn(this,null,ve,{kind:`accessor`,name:`ctimeMs`,static:!1,private:!1,access:{has:e=>`ctimeMs`in e,get:e=>e.ctimeMs,set:(e,t)=>{e.ctimeMs=t}},metadata:i},ye,R),wn(this,null,be,{kind:`accessor`,name:`ino`,static:!1,private:!1,access:{has:e=>`ino`in e,get:e=>e.ino,set:(e,t)=>{e.ino=t}},metadata:i},z,xe),wn(this,null,Se,{kind:`accessor`,name:`__ino_old`,static:!1,private:!1,access:{has:e=>`__ino_old`in e,get:e=>e.__ino_old,set:(e,t)=>{e.__ino_old=t}},metadata:i},Ce,we),wn(this,null,Te,{kind:`accessor`,name:`flags`,static:!1,private:!1,access:{has:e=>`flags`in e,get:e=>e.flags,set:(e,t)=>{e.flags=t}},metadata:i},Ee,De),wn(this,null,Oe,{kind:`accessor`,name:`__after_flags`,static:!1,private:!1,access:{has:e=>`__after_flags`in e,get:e=>e.__after_flags,set:(e,t)=>{e.__after_flags=t}},metadata:i},ke,Ae),wn(this,null,je,{kind:`accessor`,name:`version`,static:!1,private:!1,access:{has:e=>`version`in e,get:e=>e.version,set:(e,t)=>{e.version=t}},metadata:i},Me,Ne),wn(this,null,Pe,{kind:`accessor`,name:`__padding`,static:!1,private:!1,access:{has:e=>`__padding`in e,get:e=>e.__padding,set:(e,t)=>{e.__padding=t}},metadata:i},Fe,Ie),wn(this,null,Le,{kind:`accessor`,name:`attributes`,static:!1,private:!1,access:{has:e=>`attributes`in e,get:e=>e.attributes,set:(e,t)=>{e.attributes=t}},metadata:i},Re,ze),wn(this,null,Be,{kind:`accessor`,name:`__data`,static:!1,private:!1,access:{has:e=>`__data`in e,get:e=>e.__data,set:(e,t)=>{e.__data=t}},metadata:i},Ve,He),wn(null,y={value:x},v,{kind:`class`,name:x.name,metadata:i},null,b),Ue=x=y.value,i&&Object.defineProperty(x,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:i})}static name=`Inode`;constructor(...e){let t={};if(typeof e[0]==`object`&&e[0]!==null&&!ArrayBuffer.isView(e[0])&&(t=e[0],e=[B(Ue)]),e[0]instanceof Ue&&(e=[new Uint8Array(e[0].buffer,e[0].byteOffset,e[0].byteLength)]),super(...e),G(this,He),this.byteLength<B(Ue))throw ue(M(`EIO`,`Buffer is too small to create an inode (${this.byteLength} bytes)`));Object.assign(this,t),this.atimeMs||=Date.now(),this.mtimeMs||=Date.now(),this.ctimeMs||=Date.now(),this.birthtimeMs||=Date.now(),this.ino&&!this.nlink&&L(`Inode ${this.ino} has an nlink of 0`)}#e=G(this,w,void 0);get data(){return this.#e}set data(e){this.#e=e}#t=(G(this,T),G(this,E,void 0));get __data_old(){return this.#t}set __data_old(e){this.#t=e}#n=(G(this,te),G(this,O,void 0));get size(){return this.#n}set size(e){this.#n=e}#r=(G(this,ne),G(this,A,void 0));get mode(){return this.#r}set mode(e){this.#r=e}#i=(G(this,j),G(this,P,void 0));get nlink(){return this.#i}set nlink(e){this.#i=e}#a=(G(this,F),G(this,ie,void 0));get uid(){return this.#a}set uid(e){this.#a=e}#o=(G(this,ae),G(this,se,void 0));get gid(){return this.#o}set gid(e){this.#o=e}#s=(G(this,ce),G(this,I,void 0));get atimeMs(){return this.#s}set atimeMs(e){this.#s=e}#c=(G(this,de),G(this,pe,void 0));get birthtimeMs(){return this.#c}set birthtimeMs(e){this.#c=e}#l=(G(this,me),G(this,ge,void 0));get mtimeMs(){return this.#l}set mtimeMs(e){this.#l=e}#u=(G(this,_e),G(this,ye,void 0));get ctimeMs(){return this.#u}set ctimeMs(e){this.#u=e}#d=(G(this,R),G(this,z,void 0));get ino(){return this.#d}set ino(e){this.#d=e}#f=(G(this,xe),G(this,Ce,void 0));get __ino_old(){return this.#f}set __ino_old(e){this.#f=e}#p=(G(this,we),G(this,Ee,void 0));get flags(){return this.#p}set flags(e){this.#p=e}#m=(G(this,De),G(this,ke,void 0));get __after_flags(){return this.#m}set __after_flags(e){this.#m=e}#h=(G(this,Ae),G(this,Me,void 0));get version(){return this.#h}set version(e){this.#h=e}#g=(G(this,Ne),G(this,Fe,void 0));get __padding(){return this.#g}set __padding(e){this.#g=e}#_=(G(this,Ie),G(this,Re,void 0));get attributes(){return this.#_}set attributes(e){this.#_=e}#v=(G(this,ze),G(this,Ve,void 0));get __data(){return this.#v}set __data(e){this.#v=e}toString(){return`<Inode ${this.ino}>`}toJSON(){return{...d(this,On),attributes:this.attributes}}toStats(){return new yn(this)}update(e){if(!e)return!1;let t=!1;for(let n of On)e[n]!==void 0&&n!=`ino`&&n!=`data`&&this[n]!==e[n]&&(n==`atimeMs`&&this.flags&kn.NoAtime||(this[n]=e[n],t=!0));return e.attributes&&(this.attributes.copyFrom(e.attributes),t=!0),t&&(this.ctimeMs=Date.now()),t}static{G(x,b)}};return Ue=x})();function Mn(e){return(e.mode&Je)===Ze}function q(e){return(e.mode&Je)===$e}function Nn(e){return(e.mode&Je)===Xe}function Pn(e){return(e.mode&Je)===Ye}function Fn(e){return(e.mode&Je)===Qe}function In(e){return(e.mode&Je)===et}function Ln(e){return(e.mode&Je)===tt}function J(e,t,n){let{credentials:r}=Fe(e);if(Nn(t)||r.euid===0||r.egid===0)return!0;let i=0;return r.uid===t.uid&&(t.mode&256&&(i|=4),t.mode&128&&(i|=2),t.mode&64&&(i|=1)),(r.gid===t.gid||r.groups.includes(Number(t.gid)))&&(t.mode&32&&(i|=4),t.mode&16&&(i|=2),t.mode&8&&(i|=1)),t.mode&4&&(i|=4),t.mode&2&&(i|=2),t.mode&1&&(i|=1),(i&n)===n}function Rn(e,t,n){let r=!0;return!isNaN(t)&&t>=0&&t<4294967295?e.uid=t:r=!1,!isNaN(n)&&n>=0&&n<4294967295?e.gid=n:r=!1,r}var zn=class e extends Map{maxSize=it;toJSON(){return{version:1,maxSize:this.maxSize,entries:Object.fromEntries([...this].map(([e,t])=>[e,t.toJSON()]))}}toString(){return JSON.stringify(this.toJSON())}get byteSize(){let e=this.size*B(K);for(let t of this.values())e+=t.size;return e}usage(){return{totalSpace:this.maxSize,freeSpace:this.maxSize-this.byteSize}}pathOf(e){for(let[t,n]of this)if(n.ino==e||n.data==e)return t}getByID(e){return this.entryByID(e)?.inode}entryByID(e){for(let[t,n]of this)if(n.ino==e||n.data==e)return{path:t,inode:n}}directoryEntries(e){let t=this.get(e);if(!t)throw M(`ENOENT`);if((t.mode&61440)!=16384)throw M(`ENOTDIR`);let n={};for(let t of this.keys())W(t)==e&&t!=e&&(n[fn(t)]=this.get(t).ino);return n}_alloc(){return Math.max(...[...this.values()].flatMap(e=>[e.ino,e.data]))+1}directories(){let e=new Map;for(let[t,n]of this){if((n.mode&61440)!=16384)continue;let r={};for(let e of this.keys())W(e)==t&&e!=t&&(r[fn(e)]=this.get(e).ino);e.set(t,r)}return e}fromJSON(e){if(e.version!=1)throw M(`EINVAL`,`Index version mismatch`);this.clear();for(let[t,n]of Object.entries(e.entries))n.data??=b(1,it),t==`/`&&(n.ino=0),this.set(t,new K(n));return this}static parse(t){if(!p(t))throw M(`EINVAL`,`Invalid JSON`);let n=JSON.parse(t),r=new e;return r.fromJSON(n),r}},Bn=4096,Vn=class e{type;name;label;_mountPoint;_uuid=crypto.randomUUID();get uuid(){return this._uuid}attributes=new Map;constructor(t,n){this.type=t,this.name=n,this.streamRead===e.prototype.streamRead&&this.attributes.set(`default_stream_read`),this.streamWrite===e.prototype.streamWrite&&this.attributes.set(`default_stream_write`)}toString(){return`${this.name} ${this.label?JSON.stringify(this.label):``} (${this._mountPoint?`mounted on `+this._mountPoint:`unmounted`})`}usage(){return{totalSpace:0,freeSpace:0}}async ready(){}readySync(){if(this.ready!==e.prototype.ready)throw M(`EAGAIN`)}async exists(e){try{return await this.stat(e),!0}catch(e){return e.code!=`ENOENT`}}existsSync(e){try{return this.statSync(e),!0}catch(e){return e.code!=`ENOENT`}}streamRead(e,t){return new ReadableStream({start:async n=>{let{size:r}=await this.stat(e),{start:i=0,end:a=r}=t;for(let t=i;t<a;t+=Bn){let r=t+Bn>a?a-t:Bn,i=new Uint8Array(r);await this.read(e,i,t,t+r).catch(n.error.bind(n)),n.enqueue(i)}n.close()},type:`bytes`})}streamWrite(e,t){let n=t.start??0;return new WritableStream({write:async(t,r)=>{let i=!1,a=e=>{i=!0,r.error(e)},{size:o}=await this.stat(e);await this.write(e,t,n).catch(a),!i&&(n+=t.byteLength,await this.touch(e,{mtimeMs:Date.now(),size:Math.max(o,n)}).catch(a))}})}};Promise.withResolvers??=(L(`Using a polyfill of Promise.withResolvers`),function(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}),Symbol.dispose??=(L(`Using a polyfill of Symbol.dispose`),Symbol(`Symbol.dispose`)),Symbol.asyncDispose??=(L(`Using a polyfill of Symbol.asyncDispose`),Symbol(`Symbol.asyncDispose`)),globalThis.crypto.randomUUID??=(L(`Using a polyfill of crypto.randomUUID`),function(){let e=crypto.getRandomValues(new Uint8Array(16));e[6]=e[6]&15|64,e[8]=e[8]&63|128;let t=[...e].map(e=>e.toString(16).padStart(2,`0`)).join(``);return`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16,20)}-${t.slice(20)}`}),Uint8Array.prototype.toBase64??=(L(`Using a polyfill of Uint8Array.prototype.toBase64`),function(){return btoa(String.fromCharCode(...this))}),Uint8Array.fromBase64??=(L(`Using a polyfill of Uint8Array.fromBase64`),function(e){let t=atob(e),n=new Uint8Array(t.length);for(let e=0;e<t.length;e++)n[e]=t.charCodeAt(e);return n}),Uint8Array.prototype.toHex??=(L(`Using a polyfill of Uint8Array.prototype.toHex`),function(){return[...this].map(e=>e.toString(16).padStart(2,`0`)).join(``)}),Uint8Array.fromHex??=(L(`Using a polyfill of Uint8Array.fromHex`),function(e){let t=new Uint8Array(e.length/2);for(let n=0;n<e.length;n+=2)t[n/2]=parseInt(e.slice(n,n+2),16);return t});var Hn=class{store;constructor(e){this.store=e}},Un=class extends Hn{async get(e,t,n){return this.getSync(e,t,n)}async set(e,t,n){return this.setSync(e,t,n)}async remove(e){return this.removeSync(e)}},Wn=class extends Hn{asyncDone=Promise.resolve();async(e){this.asyncDone=this.asyncDone.then(()=>e)}_cached(e,t){this.store.cache??=new Map;let n=this.store.cache.get(e);return n?(t&&(n.size=t.size),n):t?new a(e,t.size,{},this.store.cache):void 0}getSync(e,t,n){let r=this._cached(e);if(!r)return;n??=r.size;let i=r.missing(t,n);for(let{start:t,end:n}of i)this.async(this.get(e,t,n));if(i.length)throw M(`EAGAIN`);let a=r.regionAt(t);if(!a){L(`Missing cache region for `+e);return}return a.data.subarray(t-a.offset,n-a.offset)}setSync(e,t,n){this.async(this.set(e,t,n))}removeSync(e){this.async(this.remove(e)),this.store.cache?.delete(e)}},Gn=class{raw;fs;done=!1;flag(e){return this.raw.store.flags?.includes(e)??!1}constructor(e,t){this.raw=e,this.fs=t}originalData=new Map;modifiedKeys=new Set;keys(){return this.raw.keys()}async get(e,t=0,n){let r=await this.raw.get(e,t,n);return this.stash(e),r}getSync(e,t=0,n){let r=this.raw.getSync(e,t,n);return this.stash(e),r}async set(e,t,n=0){await this.markModified(e,n,t.byteLength);let r=t instanceof Uint8Array?t:new Uint8Array(t.buffer,t.byteOffset,t.byteLength);await this.raw.set(e,r,n)}setSync(e,t,n=0){this.markModifiedSync(e,n,t.byteLength);let r=t instanceof Uint8Array?t:new Uint8Array(t.buffer,t.byteOffset,t.byteLength);this.raw.setSync(e,r,n)}async remove(e){await this.markModified(e,0,void 0),await this.raw.remove(e)}removeSync(e){this.markModifiedSync(e,0,void 0),this.raw.removeSync(e)}commit(){return this.done=!0,Promise.resolve()}commitSync(){this.done=!0}async abort(){if(!this.done){for(let[e,t]of this.originalData)if(this.modifiedKeys.has(e)){if(t.some(e=>!e.data)){await this.raw.remove(e),this.fs._remove(e);continue}for(let n of t.reverse())await this.raw.set(e,n.data,n.offset)}this.done=!0}}abortSync(){if(!this.done){for(let[e,t]of this.originalData)if(this.modifiedKeys.has(e)){if(t.some(e=>!e.data)){this.raw.removeSync(e),this.fs._remove(e);continue}for(let n of t.reverse())this.raw.setSync(e,n.data,n.offset)}this.done=!0}}async[Symbol.asyncDispose](){this.done||await this.abort()}[Symbol.dispose](){this.done||this.abortSync()}stash(e,t,n=0){this.originalData.has(e)||this.originalData.set(e,[]),this.originalData.get(e).push({data:t,offset:n})}async markModified(e,t,n){this.modifiedKeys.add(e);let r=n?t+n:void 0;try{this.stash(e,await this.raw.get(e,t,r),t)}catch(n){if(!(this.raw instanceof Wn))throw n;let i=this.raw._cached(e);if(!i)throw n;for(let n of i.cached(t,r??t))this.stash(e,await this.raw.get(e,n.start,n.end),n.start)}}markModifiedSync(e,t,n){this.modifiedKeys.add(e);let r=n?t+n:void 0;try{this.stash(e,this.raw.getSync(e,t,r),t)}catch(n){if(!(this.raw instanceof Wn))throw n;let i=this.raw._cached(e);if(!i)throw n;for(let n of i.cached(t,r??t))this.stash(e,this.raw.getSync(e,n.start,n.end),n.start)}}},Kn=function(e,t,n){if(t!=null){if(typeof t!=`object`&&typeof t!=`function`)throw TypeError(`Object expected.`);var r,i;if(n){if(!Symbol.asyncDispose)throw TypeError(`Symbol.asyncDispose is not defined.`);r=t[Symbol.asyncDispose]}if(r===void 0){if(!Symbol.dispose)throw TypeError(`Symbol.dispose is not defined.`);r=t[Symbol.dispose],n&&(i=r)}if(typeof r!=`function`)throw TypeError(`Object not disposable.`);i&&(r=function(){try{i.call(this)}catch(e){return Promise.reject(e)}}),e.stack.push({value:t,dispose:r,async:n})}else n&&e.stack.push({async:!0});return t},qn=(function(e){return function(t){function n(n){t.error=t.hasError?new e(n,t.error,`An error was suppressed during disposal.`):n,t.hasError=!0}var r,i=0;function a(){for(;r=t.stack.pop();)try{if(!r.async&&i===1)return i=0,t.stack.push(r),Promise.resolve().then(a);if(r.dispose){var e=r.dispose.call(r.value);if(r.async)return i|=2,Promise.resolve(e).then(a,function(e){return n(e),a()})}else i|=1}catch(e){n(e)}if(i===1)return t.hasError?Promise.reject(t.error):Promise.resolve();if(t.hasError)throw t.error}return a()}})(typeof SuppressedError==`function`?SuppressedError:function(e,t,n){var r=Error(n);return r.name=`SuppressedError`,r.error=e,r.suppressed=t,r}),Jn=class extends Vn{store;_ids=new Map([[`/`,0]]);_paths=new Map([[0,new Set(`/`)]]);_path(e){let[t]=this._paths.get(e)??[];return t}_add(e,t){this._paths.has(e)||this._paths.set(e,new Set),this._paths.get(e).add(t),this._ids.set(t,e)}_remove(e){for(let t of this._paths.get(e)??[])this._ids.delete(t);this._paths.delete(e)}_move(e,t){let n=[];for(let[r,i]of this._ids){let a=dn(e,r);if(a.startsWith(`..`))continue;let o=U(t,a);o.endsWith(`/`)&&(o=o.slice(0,-1)),n.push({oldKey:r,newKey:o,ino:i})}for(let{oldKey:e,newKey:t,ino:r}of n){this._ids.delete(e),this._ids.set(t,r);let n=this._paths.get(r);if(!n){L(`Missing paths in table for ino `+r);continue}n.delete(e),n.add(t)}}_initialized=!1;async ready(){this._initialized||=(this.attributes.has(`no_async_preload`)||this.checkRootSync(),await this.checkRoot(),await this._populate(),!0)}readySync(){this._initialized||=(this.attributes.has(`no_async_preload`)||this.checkRootSync(),this.checkRootSync(),this._populateSync(),!0)}constructor(e){super(e.type??1802921587,e.name),this.store=e,e.fs=this,this._uuid=e.uuid??this.uuid,this.label=e.label,pe(this.name+`: supports features: `+this.store.flags?.join(`, `))}usage(){return this.store.usage?.()||{totalSpace:0,freeSpace:0}}async loadIndex(e){let t={stack:[],error:void 0,hasError:!1};try{let n=Kn(t,this.transaction(),!0),r=e.directories();for(let[t,i]of e)this._add(i.ino,t),await n.set(i.ino,i),r.has(t)&&await n.set(i.data,Jt(r.get(t)));await n.commit()}catch(e){t.error=e,t.hasError=!0}finally{let e=qn(t);e&&await e}}loadIndexSync(e){let t={stack:[],error:void 0,hasError:!1};try{let n=Kn(t,this.transaction(),!1),r=e.directories();for(let[t,i]of e)this._add(i.ino,t),n.setSync(i.ino,i),r.has(t)&&n.setSync(i.data,Jt(r.get(t)));n.commitSync()}catch(e){t.error=e,t.hasError=!0}finally{qn(t)}}async createIndex(){let e={stack:[],error:void 0,hasError:!1};try{let t=new zn,n=Kn(e,this.transaction(),!0),r=[[`/`,0]],i=g(M(`EDEADLK`));for(;r.length;){let[e,i]=r.shift(),a=new K(await n.get(i));if(t.set(e,a),a.mode&16384){let t=qt(await n.get(a.data)??_(M(`ENODATA`)));for(let[n,i]of Object.entries(t))r.push([U(e,n),i])}}return i(),t}catch(t){e.error=t,e.hasError=!0}finally{let t=qn(e);t&&await t}}createIndexSync(){let e={stack:[],error:void 0,hasError:!1};try{let t=new zn,n=Kn(e,this.transaction(),!1),r=[[`/`,0]],i=g(M(`EDEADLK`));for(;r.length;){let[e,i]=r.shift(),a=new K(n.getSync(i));if(t.set(e,a),a.mode&16384){let t=qt(n.getSync(a.data)??_(M(`ENODATA`)));for(let[n,i]of Object.entries(t))r.push([U(e,n),i])}}return i(),t}catch(t){e.error=t,e.hasError=!0}finally{qn(e)}}async rename(e,t){let n={stack:[],error:void 0,hasError:!1};try{let r=Kn(n,this.transaction(),!0),i=hn(e),a=hn(t),o=await this.findInode(r,i.dir),s=qt(await r.get(o.data)??_(M(`ENODATA`)));if(!s[i.base])throw M(`ENOENT`);let c=s[i.base];if(c!=this._ids.get(e)&&I(`Ino mismatch while renaming ${e} to ${t}`),delete s[i.base],(a.dir+`/`).startsWith(e+`/`))throw M(`EBUSY`);let l=a.dir==i.dir,u=l?o:await this.findInode(r,a.dir),d=l?s:qt(await r.get(u.data)??_(M(`ENODATA`)));if(d[a.base]){let e=new K(await r.get(d[a.base])??_(M(`ENOENT`)));if(!Mn(e))throw M(`EISDIR`);await r.remove(e.data),await r.remove(d[a.base])}d[a.base]=c,await r.set(o.data,Jt(s)),await r.set(u.data,Jt(d)),await r.commit(),this._move(e,t)}catch(e){n.error=e,n.hasError=!0}finally{let e=qn(n);e&&await e}}renameSync(e,t){let n={stack:[],error:void 0,hasError:!1};try{let r=Kn(n,this.transaction(),!1),i=hn(e),a=hn(t),o=this.findInodeSync(r,i.dir),s=qt(r.getSync(o.data)??_(M(`ENODATA`)));if(!s[i.base])throw M(`ENOENT`);let c=s[i.base];if(c!=this._ids.get(e)&&I(`Ino mismatch while renaming ${e} to ${t}`),delete s[i.base],(a.dir+`/`).startsWith(e+`/`))throw M(`EBUSY`);let l=a.dir===i.dir,u=l?o:this.findInodeSync(r,a.dir),d=l?s:qt(r.getSync(u.data)??_(M(`ENODATA`)));if(d[a.base]){let e=new K(r.getSync(d[a.base])??_(M(`ENOENT`)));if(!Mn(e))throw M(`EISDIR`);r.removeSync(e.data),r.removeSync(d[a.base])}d[a.base]=c,r.setSync(o.data,Jt(s)),r.setSync(u.data,Jt(d)),r.commitSync(),this._move(e,t)}catch(e){n.error=e,n.hasError=!0}finally{qn(n)}}async stat(e){let t={stack:[],error:void 0,hasError:!1};try{let n=Kn(t,this.transaction(),!0);return await this.findInode(n,e)}catch(e){t.error=e,t.hasError=!0}finally{let e=qn(t);e&&await e}}statSync(e){let t={stack:[],error:void 0,hasError:!1};try{let n=Kn(t,this.transaction(),!1);return this.findInodeSync(n,e)}catch(e){t.error=e,t.hasError=!0}finally{qn(t)}}async touch(e,t){let n={stack:[],error:void 0,hasError:!1};try{let r=Kn(n,this.transaction(),!0),i=await this.findInode(r,e);i.update(t)&&(this._add(i.ino,e),r.setSync(i.ino,i)),await r.commit()}catch(e){n.error=e,n.hasError=!0}finally{let e=qn(n);e&&await e}}touchSync(e,t){let n={stack:[],error:void 0,hasError:!1};try{let r=Kn(n,this.transaction(),!1),i=this.findInodeSync(r,e);i.update(t)&&(this._add(i.ino,e),r.setSync(i.ino,i)),r.commitSync()}catch(e){n.error=e,n.hasError=!0}finally{qn(n)}}async createFile(e,t){return await this.commitNew(e,{...t,mode:t.mode|Ze},new Uint8Array)}createFileSync(e,t){return this.commitNewSync(e,{...t,mode:t.mode|Ze},new Uint8Array)}async unlink(e){return this.remove(e,!1)}unlinkSync(e){this.removeSync(e,!1)}async rmdir(e){if((await this.readdir(e)).length)throw M(`ENOTEMPTY`);await this.remove(e,!0)}rmdirSync(e){if(this.readdirSync(e).length)throw M(`ENOTEMPTY`);this.removeSync(e,!0)}async mkdir(e,t){return await this.commitNew(e,{...t,mode:t.mode|$e},C(`{}`))}mkdirSync(e,t){return this.commitNewSync(e,{...t,mode:t.mode|$e},C(`{}`))}async readdir(e){let t={stack:[],error:void 0,hasError:!1};try{let n=Kn(t,this.transaction(),!0),r=await this.findInode(n,e);return Object.keys(qt(await n.get(r.data)??_(M(`ENOENT`))))}catch(e){t.error=e,t.hasError=!0}finally{let e=qn(t);e&&await e}}readdirSync(e){let t={stack:[],error:void 0,hasError:!1};try{let n=Kn(t,this.transaction(),!1),r=this.findInodeSync(n,e);return Object.keys(qt(n.getSync(r.data)??_(M(`ENOENT`))))}catch(e){t.error=e,t.hasError=!0}finally{qn(t)}}async sync(){}syncSync(){}async link(e,t){let n={stack:[],error:void 0,hasError:!1};try{let r=Kn(n,this.transaction(),!0),i=W(t),a=await this.findInode(r,i),o=qt(await r.get(a.data)??_(M(`ENOENT`))),s=await this.findInode(r,e);s.nlink++,o[fn(t)]=s.ino,this._add(s.ino,t),await r.set(s.ino,s),await r.set(a.data,Jt(o)),await r.commit()}catch(e){n.error=e,n.hasError=!0}finally{let e=qn(n);e&&await e}}linkSync(e,t){let n={stack:[],error:void 0,hasError:!1};try{let r=Kn(n,this.transaction(),!1),i=W(t),a=this.findInodeSync(r,i),o=qt(r.getSync(a.data)??_(M(`ENOENT`))),s=this.findInodeSync(r,e);s.nlink++,o[fn(t)]=s.ino,this._add(s.ino,t),r.setSync(s.ino,s),r.setSync(a.data,Jt(o)),r.commitSync()}catch(e){n.error=e,n.hasError=!0}finally{qn(n)}}async read(e,t,n,r){let i={stack:[],error:void 0,hasError:!1};try{let a=Kn(i,this.transaction(),!0),o=await this.findInode(a,e);if(o.size==0)return;let s=await a.get(o.data,n,r)??_(M(`ENODATA`)),c=a.flag(`partial`)?s:s.subarray(n,r);c.byteLength>t.byteLength&&I(`Trying to place ${c.byteLength} bytes into a ${t.byteLength} byte buffer on read`),t.set(c)}catch(e){i.error=e,i.hasError=!0}finally{let e=qn(i);e&&await e}}readSync(e,t,n,r){let i={stack:[],error:void 0,hasError:!1};try{let a=Kn(i,this.transaction(),!1),o=this.findInodeSync(a,e);if(o.size==0)return;let s=a.getSync(o.data,n,r)??_(M(`ENODATA`)),c=a.flag(`partial`)?s:s.subarray(n,r);c.byteLength>t.byteLength&&I(`Trying to place ${c.byteLength} bytes into a ${t.byteLength} byte buffer on read`),t.set(c)}catch(e){i.error=e,i.hasError=!0}finally{qn(i)}}async write(e,t,n){let i={stack:[],error:void 0,hasError:!1};try{let a=Kn(i,this.transaction(),!0),o=await this.findInode(a,e),s=n+t.byteLength,c=t;a.flag(`partial`)||(c=r(await a.get(o.data)??new Uint8Array,s),c.set(t,n),n=0),await a.set(o.data,c,n),o.update({size:Math.max(o.size,s),mtimeMs:Date.now()}),await a.set(o.ino,o),this._add(o.ino,e),await a.commit()}catch(e){i.error=e,i.hasError=!0}finally{let e=qn(i);e&&await e}}writeSync(e,t,n){let i={stack:[],error:void 0,hasError:!1};try{let a=Kn(i,this.transaction(),!1),o=this.findInodeSync(a,e),s=n+t.byteLength,c=t;a.flag(`partial`)||(c=r(a.getSync(o.data)??new Uint8Array,s),c.set(t,n),n=0),a.setSync(o.data,c,n),o.update({size:Math.max(o.size,s),mtimeMs:Date.now()}),a.setSync(o.ino,o),this._add(o.ino,e),a.commitSync()}catch(e){i.error=e,i.hasError=!0}finally{qn(i)}}transaction(){return new Gn(this.store.transaction(),this)}async checkRoot(){let e={stack:[],error:void 0,hasError:!1};try{let t=Kn(e,this.transaction(),!0);if(await t.get(0))return;let n=new K({ino:0,data:1,mode:511|$e});await t.set(n.data,C(`{}`)),this._add(0,`/`),await t.set(0,n),await t.commit()}catch(t){e.error=t,e.hasError=!0}finally{let t=qn(e);t&&await t}}checkRootSync(){let e={stack:[],error:void 0,hasError:!1};try{let t=Kn(e,this.transaction(),!1);if(t.getSync(0))return;let n=new K({ino:0,data:1,mode:511|$e});t.setSync(n.data,C(`{}`)),this._add(0,`/`),t.setSync(0,n),t.commitSync()}catch(t){e.error=t,e.hasError=!0}finally{qn(e)}}async _populate(){let e={stack:[],error:void 0,hasError:!1};try{if(this._initialized){L(`Attempted to populate tables after initialization`);return}pe(`Populating tables with existing store metadata`);let t=Kn(e,this.transaction(),!0),n=await t.get(0);if(!n){de(`Store does not have a root inode`);let e=new K({ino:0,data:1,mode:511|$e});await t.set(e.data,C(`{}`)),this._add(0,`/`),await t.set(0,e),await t.commit();return}if(n.length<B(K)){ue(`Store contains an invalid root inode. Refusing to populate tables`);return}let r=new Set,i=0,a=[[`/`,0]];for(;a.length>0;){i++;let[e,n]=a.shift();this._add(n,e);let o=await t.get(n);if(!o){L(`Store is missing data for inode: `+n);continue}if(o.length<B(K)){L(`Invalid inode size for ino ${n}: ${o.length}`);continue}let s=new K(o);if((s.mode&16384)!=16384||r.has(n))continue;r.add(n);let c=await t.get(s.data);if(!c){L(`Store is missing directory data: `+s.data);continue}let l=qt(c);for(let[t,n]of Object.entries(l))a.push([U(e,t),n])}pe(`Added ${i} existing inode(s) from store`)}catch(t){e.error=t,e.hasError=!0}finally{let t=qn(e);t&&await t}}_populateSync(){let e={stack:[],error:void 0,hasError:!1};try{if(this._initialized){L(`Attempted to populate tables after initialization`);return}pe(`Populating tables with existing store metadata`);let t=Kn(e,this.transaction(),!1),n=t.getSync(0);if(!n){de(`Store does not have a root inode`);let e=new K({ino:0,data:1,mode:511|$e});t.setSync(e.data,C(`{}`)),this._add(0,`/`),t.setSync(0,e),t.commitSync();return}if(n.length<B(K)){ue(`Store contains an invalid root inode. Refusing to populate tables`);return}let r=new Set,i=0,a=[[`/`,0]];for(;a.length>0;){i++;let[e,n]=a.shift();this._add(n,e);let o=t.getSync(n);if(!o){L(`Store is missing data for inode: `+n);continue}if(o.length<B(K)){L(`Invalid inode size for ino ${n}: ${o.length}`);continue}let s=new K(o);if((s.mode&16384)!=16384||r.has(n))continue;r.add(n);let c=t.getSync(s.data);if(!c){L(`Store is missing directory data: `+s.data);continue}let l=qt(c);for(let[t,n]of Object.entries(l))a.push([U(e,t),n])}pe(`Added ${i} existing inode(s) from store`)}catch(t){e.error=t,e.hasError=!0}finally{qn(e)}}async _findInode(e,t,n=new Set){if(n.has(t))throw ue(M(`EIO`,`Infinite loop detected while finding inode`));if(n.add(t),t==`/`)return new K(await e.get(0)??_(M(`ENODATA`)));let{dir:r,base:i}=hn(t),a=await this._findInode(e,r,n),o=qt(await e.get(a.data)??_(M(`ENODATA`)));if(!(i in o))throw M(`ENOENT`);return new K(await e.get(o[i])??_(M(`ENODATA`)))}_findInodeSync(e,t,n=new Set){if(n.has(t))throw ue(M(`EIO`,`Infinite loop detected while finding inode`));if(n.add(t),t==`/`)return new K(e.getSync(0)??_(M(`ENOENT`)));let{dir:r,base:i}=hn(t),a=this._findInodeSync(e,r,n),o=qt(e.getSync(a.data)??_(M(`ENODATA`)));if(!(i in o))throw M(`ENOENT`);return new K(e.getSync(o[i])??_(M(`ENODATA`)))}async findInode(e,t){if(this.attributes.has(`no_id_tables`))return await this._findInode(e,t);let n=this._ids.get(t);if(n===void 0)throw M(`ENOENT`);return new K(await e.get(n)??_(M(`ENOENT`)))}findInodeSync(e,t){if(this.attributes.has(`no_id_tables`))return this._findInodeSync(e,t);let n=this._ids.get(t);if(n===void 0)throw M(`ENOENT`);return new K(e.getSync(n)??_(M(`ENOENT`)))}_lastID;allocNew(e){this._lastID??=Math.max(...this._paths.keys()),this._lastID+=2;let t=this._lastID;if(t>4294967295)throw I(M(`ENOSPC`,`No IDs available`));return this._add(t,e),t}async commitNew(e,t,n){let r={stack:[],error:void 0,hasError:!1};try{if(e==`/`)throw M(`EEXIST`);let i=Kn(r,this.transaction(),!0),{dir:a,base:o}=hn(e),s=await this.findInode(i,a),c=qt(await i.get(s.data)??_(M(`ENOENT`)));if(c[o])throw M(`EEXIST`);let l=this.allocNew(e),u=new K({...t,ino:l,data:l+1,size:n.byteLength,nlink:1});return await i.set(u.ino,u),await i.set(u.data,n),c[o]=u.ino,await i.set(s.data,Jt(c)),await i.commit(),u}catch(e){r.error=e,r.hasError=!0}finally{let e=qn(r);e&&await e}}commitNewSync(e,t,n){let r={stack:[],error:void 0,hasError:!1};try{if(e==`/`)throw M(`EEXIST`);let i=Kn(r,this.transaction(),!1),{dir:a,base:o}=hn(e),s=this.findInodeSync(i,a),c=qt(i.getSync(s.data)??_(M(`ENOENT`)));if(c[o])throw M(`EEXIST`);let l=this.allocNew(e),u=new K({...t,ino:l,data:l+1,size:n.byteLength,nlink:1});return i.setSync(u.ino,u),i.setSync(u.data,n),c[o]=u.ino,i.setSync(s.data,Jt(c)),i.commitSync(),u}catch(e){r.error=e,r.hasError=!0}finally{qn(r)}}async remove(e,t){let n={stack:[],error:void 0,hasError:!1};try{let r=Kn(n,this.transaction(),!0),{dir:i,base:a}=hn(e),o=await this.findInode(r,i),s=qt(await r.get(o.data)??_(M(`ENOENT`)));if(!s[a])throw M(`ENOENT`);let c=s[a],l=new K(await r.get(c)??_(M(`ENOENT`)));if(delete s[a],!t&&q(l))throw M(`EISDIR`);await r.set(o.data,Jt(s)),l.nlink>1?(l.update({nlink:l.nlink-1}),await r.set(l.ino,l)):(await r.remove(l.data),await r.remove(c),this._remove(c)),await r.commit()}catch(e){n.error=e,n.hasError=!0}finally{let e=qn(n);e&&await e}}removeSync(e,t){let n={stack:[],error:void 0,hasError:!1};try{let r=Kn(n,this.transaction(),!1),{dir:i,base:a}=hn(e),o=this.findInodeSync(r,i),s=qt(r.getSync(o.data)??_(M(`ENOENT`))),c=s[a];if(!c)throw M(`ENOENT`);let l=new K(r.getSync(c)??_(M(`ENOENT`)));if(delete s[a],!t&&q(l))throw M(`EISDIR`);r.setSync(o.data,Jt(s)),l.nlink>1?(l.update({nlink:l.nlink-1}),r.setSync(l.ino,l)):(r.removeSync(l.data),r.removeSync(c),this._remove(c)),r.commitSync()}catch(e){n.error=e,n.hasError=!0}finally{qn(n)}}},Yn=class extends Un{async keys(){return this.store.keys()}async get(e){return await(this.store.getAsync?.(e)??this.store.get(e))}getSync(e){return this.store.get(e)}setSync(e,t){this.store.set(e,t)}removeSync(e){this.store.delete(e)}},Xn=class extends Wn{async keys(){return await this.asyncDone,this.store.keys()}async get(e,t,n){return await this.asyncDone,await this.store.get(e,t,n)}getSync(e,t,n){return this.store.cached(e,t,n)}async set(e,t,n=0){await this.asyncDone,await this.store.set(e,t,n)}async remove(e){await this.asyncDone,await this.store.delete(e)}},Zn=class extends Map{maxSize;label;flags=[];name=`tmpfs`;constructor(e=it,t){super(),this.maxSize=e,this.label=t}async sync(){}transaction(){return new Yn(this)}get bytes(){let e=this.size*4;for(let t of this.values())e+=t.byteLength;return e}usage(){return{totalSpace:this.maxSize,freeSpace:this.maxSize-this.bytes}}},Qn={name:`InMemory`,options:{maxSize:{type:`number`,required:!1},label:{type:`string`,required:!1}},create({maxSize:e,label:t}){let n=new Jn(new Zn(e,t));return n.checkRootSync(),n}},$n=class extends Jn{devices=new Map;devicesWithDriver(e,t){if(t&&typeof e==`string`)throw I(M(`EINVAL`,`Can not fetch devices using only a driver name`));let n=[];for(let r of this.devices.values())t&&r.driver!=e||(typeof e==`string`?e:e.name)==r.driver.name&&n.push(r);return n}_createDevice(e,t={}){let n=1,r=Array.from(this.devices.values()).at(-1);for(;this.store.has(n)||r?.inode.ino==n;)n++;let i=e.init?.(n,t),a={data:{},minor:0,major:0,...f(i??{},`metadata`),driver:e,inode:new K({mode:et|438,...i?.metadata})},o=`/`+(a.name||e.name)+(e.singleton?``:this.devicesWithDriver(e).length);if(this.existsSync(o))throw M(`EEXIST`);return this.devices.set(o,a),fe(`Initialized device: `+this._mountPoint+o),a}addDefaults(){this._createDevice(tr),this._createDevice(nr),this._createDevice(rr),this._createDevice(ir),this._createDevice(ar),pe(`Added default devices`)}constructor(){super(new Zn(16777216,`devfs`))}async rename(e,t){if(this.devices.has(e))throw M(`EPERM`);if(this.devices.has(t))throw M(`EEXIST`);return super.rename(e,t)}renameSync(e,t){if(this.devices.has(e))throw M(`EPERM`);if(this.devices.has(t))throw M(`EEXIST`);return super.renameSync(e,t)}async stat(e){let t=this.devices.get(e);return t?t.inode:super.stat(e)}statSync(e){let t=this.devices.get(e);return t?t.inode:super.statSync(e)}async touch(e,t){let n=this.devices.get(e);n?n.inode.update(t):await super.touch(e,t)}touchSync(e,t){let n=this.devices.get(e);n?n.inode.update(t):super.touchSync(e,t)}async createFile(e,t){if(this.devices.has(e))throw M(`EEXIST`);return super.createFile(e,t)}createFileSync(e,t){if(this.devices.has(e))throw M(`EEXIST`);return super.createFileSync(e,t)}async unlink(e){if(this.devices.has(e))throw M(`EPERM`);return super.unlink(e)}unlinkSync(e){if(this.devices.has(e))throw M(`EPERM`);return super.unlinkSync(e)}async rmdir(e){return super.rmdir(e)}rmdirSync(e){return super.rmdirSync(e)}async mkdir(e,t){if(this.devices.has(e))throw M(`EEXIST`);return super.mkdir(e,t)}mkdirSync(e,t){if(this.devices.has(e))throw M(`EEXIST`);return super.mkdirSync(e,t)}async readdir(e){let t=await super.readdir(e);for(let n of this.devices.keys())W(n)==e&&t.push(fn(n));return t}readdirSync(e){let t=super.readdirSync(e);for(let n of this.devices.keys())W(n)==e&&t.push(fn(n));return t}async link(e,t){if(this.devices.has(e))throw M(`EPERM`);if(this.devices.has(t))throw M(`EEXIST`);return super.link(e,t)}linkSync(e,t){if(this.devices.has(e))throw M(`EPERM`);if(this.devices.has(t))throw M(`EEXIST`);return super.linkSync(e,t)}async sync(){for(let e of this.devices.values())e.driver.sync?.(e);return super.sync()}syncSync(){for(let e of this.devices.values())e.driver.sync?.(e);return super.syncSync()}async read(e,t,n,r){let i=this.devices.get(e);if(!i){await super.read(e,t,n,r);return}i.driver.read(i,t,n,r)}readSync(e,t,n,r){let i=this.devices.get(e);if(!i){super.readSync(e,t,n,r);return}i.driver.read(i,t,n,r)}async write(e,t,n){let r=this.devices.get(e);if(!r)return await super.write(e,t,n);r.driver.write(r,t,n)}writeSync(e,t,n){let r=this.devices.get(e);if(!r)return super.writeSync(e,t,n);r.driver.write(r,t,n)}},er=new Uint8Array,tr={name:`null`,singleton:!0,init(){return{major:1,minor:3}},read(){return er},write(){}},nr={name:`zero`,singleton:!0,init(){return{major:1,minor:5}},read(e,t,n,r){t.fill(0,n,r)},write(){}},rr={name:`full`,singleton:!0,init(){return{major:1,minor:7}},read(e,t,n,r){t.fill(0,n,r)},write(){throw M(`ENOSPC`)}},ir={name:`random`,singleton:!0,init(){return{major:1,minor:8}},read(e,t){for(let e=0;e<t.length;e++)t[e]=Math.floor(Math.random()*256)},write(){}},ar={name:`console`,singleton:!0,init(e,{output:t=e=>console.log(e)}={}){return{major:5,minor:1,data:{output:t}}},read(){return er},write(e,t,n){let r=T(t);e.data.output(r,n)}},or={null:tr,zero:nr,full:rr,random:ir,console:ar},sr=n((e=>{e.byteLength=c,e.toByteArray=u,e.fromByteArray=p;for(var t=[],n=[],r=typeof Uint8Array<`u`?Uint8Array:Array,i=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,a=0,o=i.length;a<o;++a)t[a]=i[a],n[i.charCodeAt(a)]=a;n[45]=62,n[95]=63;function s(e){var t=e.length;if(t%4>0)throw Error(`Invalid string. Length must be a multiple of 4`);var n=e.indexOf(`=`);n===-1&&(n=t);var r=n===t?0:4-n%4;return[n,r]}function c(e){var t=s(e),n=t[0],r=t[1];return(n+r)*3/4-r}function l(e,t,n){return(t+n)*3/4-n}function u(e){var t,i=s(e),a=i[0],o=i[1],c=new r(l(e,a,o)),u=0,d=o>0?a-4:a,f;for(f=0;f<d;f+=4)t=n[e.charCodeAt(f)]<<18|n[e.charCodeAt(f+1)]<<12|n[e.charCodeAt(f+2)]<<6|n[e.charCodeAt(f+3)],c[u++]=t>>16&255,c[u++]=t>>8&255,c[u++]=t&255;return o===2&&(t=n[e.charCodeAt(f)]<<2|n[e.charCodeAt(f+1)]>>4,c[u++]=t&255),o===1&&(t=n[e.charCodeAt(f)]<<10|n[e.charCodeAt(f+1)]<<4|n[e.charCodeAt(f+2)]>>2,c[u++]=t>>8&255,c[u++]=t&255),c}function d(e){return t[e>>18&63]+t[e>>12&63]+t[e>>6&63]+t[e&63]}function f(e,t,n){for(var r,i=[],a=t;a<n;a+=3)r=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(e[a+2]&255),i.push(d(r));return i.join(``)}function p(e){for(var n,r=e.length,i=r%3,a=[],o=16383,s=0,c=r-i;s<c;s+=o)a.push(f(e,s,s+o>c?c:s+o));return i===1?(n=e[r-1],a.push(t[n>>2]+t[n<<4&63]+`==`)):i===2&&(n=(e[r-2]<<8)+e[r-1],a.push(t[n>>10]+t[n>>4&63]+t[n<<2&63]+`=`)),a.join(``)}})),cr=n((e=>{e.read=function(e,t,n,r,i){var a,o,s=i*8-r-1,c=(1<<s)-1,l=c>>1,u=-7,d=n?i-1:0,f=n?-1:1,p=e[t+d];for(d+=f,a=p&(1<<-u)-1,p>>=-u,u+=s;u>0;a=a*256+e[t+d],d+=f,u-=8);for(o=a&(1<<-u)-1,a>>=-u,u+=r;u>0;o=o*256+e[t+d],d+=f,u-=8);if(a===0)a=1-l;else if(a===c)return o?NaN:(p?-1:1)*(1/0);else o+=2**r,a-=l;return(p?-1:1)*o*2**(a-r)},e.write=function(e,t,n,r,i,a){var o,s,c,l=a*8-i-1,u=(1<<l)-1,d=u>>1,f=i===23?2**-24-2**-77:0,p=r?0:a-1,m=r?1:-1,h=+(t<0||t===0&&1/t<0);for(t=Math.abs(t),isNaN(t)||t===1/0?(s=+!!isNaN(t),o=u):(o=Math.floor(Math.log(t)/Math.LN2),t*(c=2**-o)<1&&(o--,c*=2),o+d>=1?t+=f/c:t+=f*2**(1-d),t*c>=2&&(o++,c/=2),o+d>=u?(s=0,o=u):o+d>=1?(s=(t*c-1)*2**i,o+=d):(s=t*2**(d-1)*2**i,o=0));i>=8;e[n+p]=s&255,p+=m,s/=256,i-=8);for(o=o<<i|s,l+=i;l>0;e[n+p]=o&255,p+=m,o/=256,l-=8);e[n+p-m]|=h*128}})),lr=n((e=>{var t=sr(),n=cr(),r=typeof Symbol==`function`&&typeof Symbol.for==`function`?Symbol.for(`nodejs.util.inspect.custom`):null;e.Buffer=s,e.SlowBuffer=v,e.INSPECT_MAX_BYTES=50;var i=2147483647;e.kMaxLength=i,s.TYPED_ARRAY_SUPPORT=a(),!s.TYPED_ARRAY_SUPPORT&&typeof console<`u`&&typeof console.error==`function`&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function a(){try{let e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),e.foo()===42}catch{return!1}}Object.defineProperty(s.prototype,"parent",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.buffer}}),Object.defineProperty(s.prototype,"offset",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.byteOffset}});function o(e){if(e>i)throw RangeError(`The value "`+e+`" is invalid for option "size"`);let t=new Uint8Array(e);return Object.setPrototypeOf(t,s.prototype),t}function s(e,t,n){if(typeof e==`number`){if(typeof t==`string`)throw TypeError(`The "string" argument must be of type string. Received type number`);return d(e)}return c(e,t,n)}s.poolSize=8192;function c(e,t,n){if(typeof e==`string`)return f(e,t);if(ArrayBuffer.isView(e))return m(e);if(e==null)throw TypeError(`The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type `+typeof e);if(R(e,ArrayBuffer)||e&&R(e.buffer,ArrayBuffer)||typeof SharedArrayBuffer<`u`&&(R(e,SharedArrayBuffer)||e&&R(e.buffer,SharedArrayBuffer)))return h(e,t,n);if(typeof e==`number`)throw TypeError(`The "value" argument must not be of type number. Received type number`);let r=e.valueOf&&e.valueOf();if(r!=null&&r!==e)return s.from(r,t,n);let i=g(e);if(i)return i;if(typeof Symbol<`u`&&Symbol.toPrimitive!=null&&typeof e[Symbol.toPrimitive]==`function`)return s.from(e[Symbol.toPrimitive](`string`),t,n);throw TypeError(`The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type `+typeof e)}s.from=function(e,t,n){return c(e,t,n)},Object.setPrototypeOf(s.prototype,Uint8Array.prototype),Object.setPrototypeOf(s,Uint8Array);function l(e){if(typeof e!=`number`)throw TypeError(`"size" argument must be of type number`);if(e<0)throw RangeError(`The value "`+e+`" is invalid for option "size"`)}function u(e,t,n){return l(e),e<=0||t===void 0?o(e):typeof n==`string`?o(e).fill(t,n):o(e).fill(t)}s.alloc=function(e,t,n){return u(e,t,n)};function d(e){return l(e),o(e<0?0:_(e)|0)}s.allocUnsafe=function(e){return d(e)},s.allocUnsafeSlow=function(e){return d(e)};function f(e,t){if((typeof t!=`string`||t===``)&&(t=`utf8`),!s.isEncoding(t))throw TypeError(`Unknown encoding: `+t);let n=y(e,t)|0,r=o(n),i=r.write(e,t);return i!==n&&(r=r.slice(0,i)),r}function p(e){let t=e.length<0?0:_(e.length)|0,n=o(t);for(let r=0;r<t;r+=1)n[r]=e[r]&255;return n}function m(e){if(R(e,Uint8Array)){let t=new Uint8Array(e);return h(t.buffer,t.byteOffset,t.byteLength)}return p(e)}function h(e,t,n){if(t<0||e.byteLength<t)throw RangeError(`"offset" is outside of buffer bounds`);if(e.byteLength<t+(n||0))throw RangeError(`"length" is outside of buffer bounds`);let r;return r=t===void 0&&n===void 0?new Uint8Array(e):n===void 0?new Uint8Array(e,t):new Uint8Array(e,t,n),Object.setPrototypeOf(r,s.prototype),r}function g(e){if(s.isBuffer(e)){let t=_(e.length)|0,n=o(t);return n.length===0||e.copy(n,0,0,t),n}if(e.length!==void 0)return typeof e.length!=`number`||be(e.length)?o(0):p(e);if(e.type===`Buffer`&&Array.isArray(e.data))return p(e.data)}function _(e){if(e>=i)throw RangeError(`Attempt to allocate Buffer larger than maximum size: 0x`+i.toString(16)+` bytes`);return e|0}function v(e){return+e!=e&&(e=0),s.alloc(+e)}s.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==s.prototype},s.compare=function(e,t){if(R(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),R(t,Uint8Array)&&(t=s.from(t,t.offset,t.byteLength)),!s.isBuffer(e)||!s.isBuffer(t))throw TypeError(`The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array`);if(e===t)return 0;let n=e.length,r=t.length;for(let i=0,a=Math.min(n,r);i<a;++i)if(e[i]!==t[i]){n=e[i],r=t[i];break}return n<r?-1:+(r<n)},s.isEncoding=function(e){switch(String(e).toLowerCase()){case`hex`:case`utf8`:case`utf-8`:case`ascii`:case`latin1`:case`binary`:case`base64`:case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return!0;default:return!1}},s.concat=function(e,t){if(!Array.isArray(e))throw TypeError(`"list" argument must be an Array of Buffers`);if(e.length===0)return s.alloc(0);let n;if(t===void 0)for(t=0,n=0;n<e.length;++n)t+=e[n].length;let r=s.allocUnsafe(t),i=0;for(n=0;n<e.length;++n){let t=e[n];if(R(t,Uint8Array))i+t.length>r.length?(s.isBuffer(t)||(t=s.from(t)),t.copy(r,i)):Uint8Array.prototype.set.call(r,t,i);else if(s.isBuffer(t))t.copy(r,i);else throw TypeError(`"list" argument must be an Array of Buffers`);i+=t.length}return r};function y(e,t){if(s.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||R(e,ArrayBuffer))return e.byteLength;if(typeof e!=`string`)throw TypeError(`The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type `+typeof e);let n=e.length,r=arguments.length>2&&arguments[2]===!0;if(!r&&n===0)return 0;let i=!1;for(;;)switch(t){case`ascii`:case`latin1`:case`binary`:return n;case`utf8`:case`utf-8`:return he(e).length;case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return n*2;case`hex`:return n>>>1;case`base64`:return ve(e).length;default:if(i)return r?-1:he(e).length;t=(``+t).toLowerCase(),i=!0}}s.byteLength=y;function b(e,t,n){let r=!1;if((t===void 0||t<0)&&(t=0),t>this.length||((n===void 0||n>this.length)&&(n=this.length),n<=0)||(n>>>=0,t>>>=0,n<=t))return``;for(e||=`utf8`;;)switch(e){case`hex`:return M(this,t,n);case`utf8`:case`utf-8`:return O(this,t,n);case`ascii`:return A(this,t,n);case`latin1`:case`binary`:return j(this,t,n);case`base64`:return D(this,t,n);case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return N(this,t,n);default:if(r)throw TypeError(`Unknown encoding: `+e);e=(e+``).toLowerCase(),r=!0}}s.prototype._isBuffer=!0;function x(e,t,n){let r=e[t];e[t]=e[n],e[n]=r}s.prototype.swap16=function(){let e=this.length;if(e%2!=0)throw RangeError(`Buffer size must be a multiple of 16-bits`);for(let t=0;t<e;t+=2)x(this,t,t+1);return this},s.prototype.swap32=function(){let e=this.length;if(e%4!=0)throw RangeError(`Buffer size must be a multiple of 32-bits`);for(let t=0;t<e;t+=4)x(this,t,t+3),x(this,t+1,t+2);return this},s.prototype.swap64=function(){let e=this.length;if(e%8!=0)throw RangeError(`Buffer size must be a multiple of 64-bits`);for(let t=0;t<e;t+=8)x(this,t,t+7),x(this,t+1,t+6),x(this,t+2,t+5),x(this,t+3,t+4);return this},s.prototype.toString=function(){let e=this.length;return e===0?``:arguments.length===0?O(this,0,e):b.apply(this,arguments)},s.prototype.toLocaleString=s.prototype.toString,s.prototype.equals=function(e){if(!s.isBuffer(e))throw TypeError(`Argument must be a Buffer`);return this===e||s.compare(this,e)===0},s.prototype.inspect=function(){let t=``,n=e.INSPECT_MAX_BYTES;return t=this.toString(`hex`,0,n).replace(/(.{2})/g,`$1 `).trim(),this.length>n&&(t+=` ... `),`<Buffer `+t+`>`},r&&(s.prototype[r]=s.prototype.inspect),s.prototype.compare=function(e,t,n,r,i){if(R(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),!s.isBuffer(e))throw TypeError(`The "target" argument must be one of type Buffer or Uint8Array. Received type `+typeof e);if(t===void 0&&(t=0),n===void 0&&(n=e?e.length:0),r===void 0&&(r=0),i===void 0&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw RangeError(`out of range index`);if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(t>>>=0,n>>>=0,r>>>=0,i>>>=0,this===e)return 0;let a=i-r,o=n-t,c=Math.min(a,o),l=this.slice(r,i),u=e.slice(t,n);for(let e=0;e<c;++e)if(l[e]!==u[e]){a=l[e],o=u[e];break}return a<o?-1:+(o<a)};function S(e,t,n,r,i){if(e.length===0)return-1;if(typeof n==`string`?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,be(n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0)if(i)n=0;else return-1;if(typeof t==`string`&&(t=s.from(t,r)),s.isBuffer(t))return t.length===0?-1:C(e,t,n,r,i);if(typeof t==`number`)return t&=255,typeof Uint8Array.prototype.indexOf==`function`?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):C(e,[t],n,r,i);throw TypeError(`val must be string, number or Buffer`)}function C(e,t,n,r,i){let a=1,o=e.length,s=t.length;if(r!==void 0&&(r=String(r).toLowerCase(),r===`ucs2`||r===`ucs-2`||r===`utf16le`||r===`utf-16le`)){if(e.length<2||t.length<2)return-1;a=2,o/=2,s/=2,n/=2}function c(e,t){return a===1?e[t]:e.readUInt16BE(t*a)}let l;if(i){let r=-1;for(l=n;l<o;l++)if(c(e,l)===c(t,r===-1?0:l-r)){if(r===-1&&(r=l),l-r+1===s)return r*a}else r!==-1&&(l-=l-r),r=-1}else for(n+s>o&&(n=o-s),l=n;l>=0;l--){let n=!0;for(let r=0;r<s;r++)if(c(e,l+r)!==c(t,r)){n=!1;break}if(n)return l}return-1}s.prototype.includes=function(e,t,n){return this.indexOf(e,t,n)!==-1},s.prototype.indexOf=function(e,t,n){return S(this,e,t,n,!0)},s.prototype.lastIndexOf=function(e,t,n){return S(this,e,t,n,!1)};function w(e,t,n,r){n=Number(n)||0;let i=e.length-n;r?(r=Number(r),r>i&&(r=i)):r=i;let a=t.length;r>a/2&&(r=a/2);let o;for(o=0;o<r;++o){let r=parseInt(t.substr(o*2,2),16);if(be(r))return o;e[n+o]=r}return o}function T(e,t,n,r){return ye(he(t,e.length-n),e,n,r)}function ee(e,t,n,r){return ye(ge(t),e,n,r)}function E(e,t,n,r){return ye(ve(t),e,n,r)}function te(e,t,n,r){return ye(_e(t,e.length-n),e,n,r)}s.prototype.write=function(e,t,n,r){if(t===void 0)r=`utf8`,n=this.length,t=0;else if(n===void 0&&typeof t==`string`)r=t,n=this.length,t=0;else if(isFinite(t))t>>>=0,isFinite(n)?(n>>>=0,r===void 0&&(r=`utf8`)):(r=n,n=void 0);else throw Error(`Buffer.write(string, encoding, offset[, length]) is no longer supported`);let i=this.length-t;if((n===void 0||n>i)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw RangeError(`Attempt to write outside buffer bounds`);r||=`utf8`;let a=!1;for(;;)switch(r){case`hex`:return w(this,e,t,n);case`utf8`:case`utf-8`:return T(this,e,t,n);case`ascii`:case`latin1`:case`binary`:return ee(this,e,t,n);case`base64`:return E(this,e,t,n);case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return te(this,e,t,n);default:if(a)throw TypeError(`Unknown encoding: `+r);r=(``+r).toLowerCase(),a=!0}},s.prototype.toJSON=function(){return{type:`Buffer`,data:Array.prototype.slice.call(this._arr||this,0)}};function D(e,n,r){return n===0&&r===e.length?t.fromByteArray(e):t.fromByteArray(e.slice(n,r))}function O(e,t,n){n=Math.min(e.length,n);let r=[],i=t;for(;i<n;){let t=e[i],a=null,o=t>239?4:t>223?3:t>191?2:1;if(i+o<=n){let n,r,s,c;switch(o){case 1:t<128&&(a=t);break;case 2:n=e[i+1],(n&192)==128&&(c=(t&31)<<6|n&63,c>127&&(a=c));break;case 3:n=e[i+1],r=e[i+2],(n&192)==128&&(r&192)==128&&(c=(t&15)<<12|(n&63)<<6|r&63,c>2047&&(c<55296||c>57343)&&(a=c));break;case 4:n=e[i+1],r=e[i+2],s=e[i+3],(n&192)==128&&(r&192)==128&&(s&192)==128&&(c=(t&15)<<18|(n&63)<<12|(r&63)<<6|s&63,c>65535&&c<1114112&&(a=c))}}a===null?(a=65533,o=1):a>65535&&(a-=65536,r.push(a>>>10&1023|55296),a=56320|a&1023),r.push(a),i+=o}return k(r)}var ne=4096;function k(e){let t=e.length;if(t<=ne)return String.fromCharCode.apply(String,e);let n=``,r=0;for(;r<t;)n+=String.fromCharCode.apply(String,e.slice(r,r+=ne));return n}function A(e,t,n){let r=``;n=Math.min(e.length,n);for(let i=t;i<n;++i)r+=String.fromCharCode(e[i]&127);return r}function j(e,t,n){let r=``;n=Math.min(e.length,n);for(let i=t;i<n;++i)r+=String.fromCharCode(e[i]);return r}function M(e,t,n){let r=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>r)&&(n=r);let i=``;for(let r=t;r<n;++r)i+=z[e[r]];return i}function N(e,t,n){let r=e.slice(t,n),i=``;for(let e=0;e<r.length-1;e+=2)i+=String.fromCharCode(r[e]+r[e+1]*256);return i}s.prototype.slice=function(e,t){let n=this.length;e=~~e,t=t===void 0?n:~~t,e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),t<0?(t+=n,t<0&&(t=0)):t>n&&(t=n),t<e&&(t=e);let r=this.subarray(e,t);return Object.setPrototypeOf(r,s.prototype),r};function P(e,t,n){if(e%1!=0||e<0)throw RangeError(`offset is not uint`);if(e+t>n)throw RangeError(`Trying to access beyond buffer length`)}s.prototype.readUintLE=s.prototype.readUIntLE=function(e,t,n){e>>>=0,t>>>=0,n||P(e,t,this.length);let r=this[e],i=1,a=0;for(;++a<t&&(i*=256);)r+=this[e+a]*i;return r},s.prototype.readUintBE=s.prototype.readUIntBE=function(e,t,n){e>>>=0,t>>>=0,n||P(e,t,this.length);let r=this[e+--t],i=1;for(;t>0&&(i*=256);)r+=this[e+--t]*i;return r},s.prototype.readUint8=s.prototype.readUInt8=function(e,t){return e>>>=0,t||P(e,1,this.length),this[e]},s.prototype.readUint16LE=s.prototype.readUInt16LE=function(e,t){return e>>>=0,t||P(e,2,this.length),this[e]|this[e+1]<<8},s.prototype.readUint16BE=s.prototype.readUInt16BE=function(e,t){return e>>>=0,t||P(e,2,this.length),this[e]<<8|this[e+1]},s.prototype.readUint32LE=s.prototype.readUInt32LE=function(e,t){return e>>>=0,t||P(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216},s.prototype.readUint32BE=s.prototype.readUInt32BE=function(e,t){return e>>>=0,t||P(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])},s.prototype.readBigUInt64LE=xe(function(e){e>>>=0,de(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&fe(e,this.length-8);let r=t+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24,i=this[++e]+this[++e]*2**8+this[++e]*2**16+n*2**24;return BigInt(r)+(BigInt(i)<<BigInt(32))}),s.prototype.readBigUInt64BE=xe(function(e){e>>>=0,de(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&fe(e,this.length-8);let r=t*2**24+this[++e]*2**16+this[++e]*2**8+this[++e],i=this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+n;return(BigInt(r)<<BigInt(32))+BigInt(i)}),s.prototype.readIntLE=function(e,t,n){e>>>=0,t>>>=0,n||P(e,t,this.length);let r=this[e],i=1,a=0;for(;++a<t&&(i*=256);)r+=this[e+a]*i;return i*=128,r>=i&&(r-=2**(8*t)),r},s.prototype.readIntBE=function(e,t,n){e>>>=0,t>>>=0,n||P(e,t,this.length);let r=t,i=1,a=this[e+--r];for(;r>0&&(i*=256);)a+=this[e+--r]*i;return i*=128,a>=i&&(a-=2**(8*t)),a},s.prototype.readInt8=function(e,t){return e>>>=0,t||P(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]},s.prototype.readInt16LE=function(e,t){e>>>=0,t||P(e,2,this.length);let n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n},s.prototype.readInt16BE=function(e,t){e>>>=0,t||P(e,2,this.length);let n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n},s.prototype.readInt32LE=function(e,t){return e>>>=0,t||P(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},s.prototype.readInt32BE=function(e,t){return e>>>=0,t||P(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},s.prototype.readBigInt64LE=xe(function(e){e>>>=0,de(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&fe(e,this.length-8);let r=this[e+4]+this[e+5]*2**8+this[e+6]*2**16+(n<<24);return(BigInt(r)<<BigInt(32))+BigInt(t+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24)}),s.prototype.readBigInt64BE=xe(function(e){e>>>=0,de(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&fe(e,this.length-8);let r=(t<<24)+this[++e]*2**16+this[++e]*2**8+this[++e];return(BigInt(r)<<BigInt(32))+BigInt(this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+n)}),s.prototype.readFloatLE=function(e,t){return e>>>=0,t||P(e,4,this.length),n.read(this,e,!0,23,4)},s.prototype.readFloatBE=function(e,t){return e>>>=0,t||P(e,4,this.length),n.read(this,e,!1,23,4)},s.prototype.readDoubleLE=function(e,t){return e>>>=0,t||P(e,8,this.length),n.read(this,e,!0,52,8)},s.prototype.readDoubleBE=function(e,t){return e>>>=0,t||P(e,8,this.length),n.read(this,e,!1,52,8)};function F(e,t,n,r,i,a){if(!s.isBuffer(e))throw TypeError(`"buffer" argument must be a Buffer instance`);if(t>i||t<a)throw RangeError(`"value" argument is out of bounds`);if(n+r>e.length)throw RangeError(`Index out of range`)}s.prototype.writeUintLE=s.prototype.writeUIntLE=function(e,t,n,r){if(e=+e,t>>>=0,n>>>=0,!r){let r=2**(8*n)-1;F(this,e,t,n,r,0)}let i=1,a=0;for(this[t]=e&255;++a<n&&(i*=256);)this[t+a]=e/i&255;return t+n},s.prototype.writeUintBE=s.prototype.writeUIntBE=function(e,t,n,r){if(e=+e,t>>>=0,n>>>=0,!r){let r=2**(8*n)-1;F(this,e,t,n,r,0)}let i=n-1,a=1;for(this[t+i]=e&255;--i>=0&&(a*=256);)this[t+i]=e/a&255;return t+n},s.prototype.writeUint8=s.prototype.writeUInt8=function(e,t,n){return e=+e,t>>>=0,n||F(this,e,t,1,255,0),this[t]=e&255,t+1},s.prototype.writeUint16LE=s.prototype.writeUInt16LE=function(e,t,n){return e=+e,t>>>=0,n||F(this,e,t,2,65535,0),this[t]=e&255,this[t+1]=e>>>8,t+2},s.prototype.writeUint16BE=s.prototype.writeUInt16BE=function(e,t,n){return e=+e,t>>>=0,n||F(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=e&255,t+2},s.prototype.writeUint32LE=s.prototype.writeUInt32LE=function(e,t,n){return e=+e,t>>>=0,n||F(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=e&255,t+4},s.prototype.writeUint32BE=s.prototype.writeUInt32BE=function(e,t,n){return e=+e,t>>>=0,n||F(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4};function re(e,t,n,r,i){L(t,r,i,e,n,7);let a=Number(t&BigInt(4294967295));e[n++]=a,a>>=8,e[n++]=a,a>>=8,e[n++]=a,a>>=8,e[n++]=a;let o=Number(t>>BigInt(32)&BigInt(4294967295));return e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o,n}function ie(e,t,n,r,i){L(t,r,i,e,n,7);let a=Number(t&BigInt(4294967295));e[n+7]=a,a>>=8,e[n+6]=a,a>>=8,e[n+5]=a,a>>=8,e[n+4]=a;let o=Number(t>>BigInt(32)&BigInt(4294967295));return e[n+3]=o,o>>=8,e[n+2]=o,o>>=8,e[n+1]=o,o>>=8,e[n]=o,n+8}s.prototype.writeBigUInt64LE=xe(function(e,t=0){return re(this,e,t,BigInt(0),BigInt(`0xffffffffffffffff`))}),s.prototype.writeBigUInt64BE=xe(function(e,t=0){return ie(this,e,t,BigInt(0),BigInt(`0xffffffffffffffff`))}),s.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t>>>=0,!r){let r=2**(8*n-1);F(this,e,t,n,r-1,-r)}let i=0,a=1,o=0;for(this[t]=e&255;++i<n&&(a*=256);)e<0&&o===0&&this[t+i-1]!==0&&(o=1),this[t+i]=(e/a>>0)-o&255;return t+n},s.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t>>>=0,!r){let r=2**(8*n-1);F(this,e,t,n,r-1,-r)}let i=n-1,a=1,o=0;for(this[t+i]=e&255;--i>=0&&(a*=256);)e<0&&o===0&&this[t+i+1]!==0&&(o=1),this[t+i]=(e/a>>0)-o&255;return t+n},s.prototype.writeInt8=function(e,t,n){return e=+e,t>>>=0,n||F(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=e&255,t+1},s.prototype.writeInt16LE=function(e,t,n){return e=+e,t>>>=0,n||F(this,e,t,2,32767,-32768),this[t]=e&255,this[t+1]=e>>>8,t+2},s.prototype.writeInt16BE=function(e,t,n){return e=+e,t>>>=0,n||F(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=e&255,t+2},s.prototype.writeInt32LE=function(e,t,n){return e=+e,t>>>=0,n||F(this,e,t,4,2147483647,-2147483648),this[t]=e&255,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},s.prototype.writeInt32BE=function(e,t,n){return e=+e,t>>>=0,n||F(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4},s.prototype.writeBigInt64LE=xe(function(e,t=0){return re(this,e,t,-BigInt(`0x8000000000000000`),BigInt(`0x7fffffffffffffff`))}),s.prototype.writeBigInt64BE=xe(function(e,t=0){return ie(this,e,t,-BigInt(`0x8000000000000000`),BigInt(`0x7fffffffffffffff`))});function ae(e,t,n,r,i,a){if(n+r>e.length||n<0)throw RangeError(`Index out of range`)}function oe(e,t,r,i,a){return t=+t,r>>>=0,a||ae(e,t,r,4,34028234663852886e22,-34028234663852886e22),n.write(e,t,r,i,23,4),r+4}s.prototype.writeFloatLE=function(e,t,n){return oe(this,e,t,!0,n)},s.prototype.writeFloatBE=function(e,t,n){return oe(this,e,t,!1,n)};function se(e,t,r,i,a){return t=+t,r>>>=0,a||ae(e,t,r,8,17976931348623157e292,-17976931348623157e292),n.write(e,t,r,i,52,8),r+8}s.prototype.writeDoubleLE=function(e,t,n){return se(this,e,t,!0,n)},s.prototype.writeDoubleBE=function(e,t,n){return se(this,e,t,!1,n)},s.prototype.copy=function(e,t,n,r){if(!s.isBuffer(e))throw TypeError(`argument should be a Buffer`);if(n||=0,!r&&r!==0&&(r=this.length),t>=e.length&&(t=e.length),t||=0,r>0&&r<n&&(r=n),r===n||e.length===0||this.length===0)return 0;if(t<0)throw RangeError(`targetStart out of bounds`);if(n<0||n>=this.length)throw RangeError(`Index out of range`);if(r<0)throw RangeError(`sourceEnd out of bounds`);r>this.length&&(r=this.length),e.length-t<r-n&&(r=e.length-t+n);let i=r-n;return this===e&&typeof Uint8Array.prototype.copyWithin==`function`?this.copyWithin(t,n,r):Uint8Array.prototype.set.call(e,this.subarray(n,r),t),i},s.prototype.fill=function(e,t,n,r){if(typeof e==`string`){if(typeof t==`string`?(r=t,t=0,n=this.length):typeof n==`string`&&(r=n,n=this.length),r!==void 0&&typeof r!=`string`)throw TypeError(`encoding must be a string`);if(typeof r==`string`&&!s.isEncoding(r))throw TypeError(`Unknown encoding: `+r);if(e.length===1){let t=e.charCodeAt(0);(r===`utf8`&&t<128||r===`latin1`)&&(e=t)}}else typeof e==`number`?e&=255:typeof e==`boolean`&&(e=Number(e));if(t<0||this.length<t||this.length<n)throw RangeError(`Out of range index`);if(n<=t)return this;t>>>=0,n=n===void 0?this.length:n>>>0,e||=0;let i;if(typeof e==`number`)for(i=t;i<n;++i)this[i]=e;else{let a=s.isBuffer(e)?e:s.from(e,r),o=a.length;if(o===0)throw TypeError(`The value "`+e+`" is invalid for argument "value"`);for(i=0;i<n-t;++i)this[i+t]=a[i%o]}return this};var ce={};function le(e,t,n){ce[e]=class extends n{constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name}get code(){return e}set code(e){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:e,writable:!0})}toString(){return`${this.name} [${e}]: ${this.message}`}}}le(`ERR_BUFFER_OUT_OF_BOUNDS`,function(e){return e?`${e} is outside of buffer bounds`:`Attempt to access memory outside buffer bounds`},RangeError),le(`ERR_INVALID_ARG_TYPE`,function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`},TypeError),le(`ERR_OUT_OF_RANGE`,function(e,t,n){let r=`The value of "${e}" is out of range.`,i=n;return Number.isInteger(n)&&Math.abs(n)>2**32?i=ue(String(n)):typeof n==`bigint`&&(i=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(i=ue(i)),i+=`n`),r+=` It must be ${t}. Received ${i}`,r},RangeError);function ue(e){let t=``,n=e.length,r=+(e[0]===`-`);for(;n>=r+4;n-=3)t=`_${e.slice(n-3,n)}${t}`;return`${e.slice(0,n)}${t}`}function I(e,t,n){de(t,`offset`),(e[t]===void 0||e[t+n]===void 0)&&fe(t,e.length-(n+1))}function L(e,t,n,r,i,a){if(e>n||e<t){let r=typeof t==`bigint`?`n`:``,i;throw i=a>3?t===0||t===BigInt(0)?`>= 0${r} and < 2${r} ** ${(a+1)*8}${r}`:`>= -(2${r} ** ${(a+1)*8-1}${r}) and < 2 ** ${(a+1)*8-1}${r}`:`>= ${t}${r} and <= ${n}${r}`,new ce.ERR_OUT_OF_RANGE(`value`,i,e)}I(r,i,a)}function de(e,t){if(typeof e!=`number`)throw new ce.ERR_INVALID_ARG_TYPE(t,`number`,e)}function fe(e,t,n){throw Math.floor(e)===e?t<0?new ce.ERR_BUFFER_OUT_OF_BOUNDS:new ce.ERR_OUT_OF_RANGE(n||`offset`,`>= ${+!!n} and <= ${t}`,e):(de(e,n),new ce.ERR_OUT_OF_RANGE(n||`offset`,`an integer`,e))}var pe=/[^+/0-9A-Za-z-_]/g;function me(e){if(e=e.split(`=`)[0],e=e.trim().replace(pe,``),e.length<2)return``;for(;e.length%4!=0;)e+=`=`;return e}function he(e,t){t||=1/0;let n,r=e.length,i=null,a=[];for(let o=0;o<r;++o){if(n=e.charCodeAt(o),n>55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&a.push(239,191,189);continue}if(o+1===r){(t-=3)>-1&&a.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&a.push(239,191,189),i=n;continue}n=(i-55296<<10|n-56320)+65536}else i&&(t-=3)>-1&&a.push(239,191,189);if(i=null,n<128){if(--t<0)break;a.push(n)}else if(n<2048){if((t-=2)<0)break;a.push(n>>6|192,n&63|128)}else if(n<65536){if((t-=3)<0)break;a.push(n>>12|224,n>>6&63|128,n&63|128)}else if(n<1114112){if((t-=4)<0)break;a.push(n>>18|240,n>>12&63|128,n>>6&63|128,n&63|128)}else throw Error(`Invalid code point`)}return a}function ge(e){let t=[];for(let n=0;n<e.length;++n)t.push(e.charCodeAt(n)&255);return t}function _e(e,t){let n,r,i,a=[];for(let o=0;o<e.length&&!((t-=2)<0);++o)n=e.charCodeAt(o),r=n>>8,i=n%256,a.push(i),a.push(r);return a}function ve(e){return t.toByteArray(me(e))}function ye(e,t,n,r){let i;for(i=0;i<r&&!(i+n>=t.length||i>=e.length);++i)t[i+n]=e[i];return i}function R(e,t){return e instanceof t||e!=null&&e.constructor!=null&&e.constructor.name!=null&&e.constructor.name===t.name}function be(e){return e!==e}var z=(function(){let e=`0123456789abcdef`,t=Array(256);for(let n=0;n<16;++n){let r=n*16;for(let i=0;i<16;++i)t[r+i]=e[n]+e[i]}return t})();function xe(e){return typeof BigInt>`u`?Se:e}function Se(){throw Error(`BigInt not supported`)}})),ur=lr(),Y=!0;function dr(e){Y=e}var fr;(function(e){e[e.UNKNOWN=0]=`UNKNOWN`,e[e.FIFO=1]=`FIFO`,e[e.CHR=2]=`CHR`,e[e.DIR=4]=`DIR`,e[e.BLK=6]=`BLK`,e[e.REG=8]=`REG`,e[e.LNK=10]=`LNK`,e[e.SOCK=12]=`SOCK`,e[e.WHT=14]=`WHT`})(fr||={});function pr(e){return(e&61440)>>12}function mr(e){return e<<12}var hr=class{ino;type;path;name},gr=function(e,t,n){for(var r=arguments.length>2,i=0;i<t.length;i++)n=r?t[i].call(e,n):t[i].call(e);return r?n:void 0},_r=function(e,t,n,r,i,a){function o(e){if(e!==void 0&&typeof e!=`function`)throw TypeError(`Function expected`);return e}for(var s=r.kind,c=s===`getter`?`get`:s===`setter`?`set`:`value`,l=!t&&e?r.static?e:e.prototype:null,u=t||(l?Object.getOwnPropertyDescriptor(l,r.name):{}),d,f=!1,p=n.length-1;p>=0;p--){var m={};for(var h in r)m[h]=h===`access`?{}:r[h];for(var h in r.access)m.access[h]=r.access[h];m.addInitializer=function(e){if(f)throw TypeError(`Cannot add initializers after decoration has completed`);a.push(o(e||null))};var g=(0,n[p])(s===`accessor`?{get:u.get,set:u.set}:u[c],m);if(s===`accessor`){if(g===void 0)continue;if(typeof g!=`object`||!g)throw TypeError(`Object expected`);(d=o(g.get))&&(u.get=d),(d=o(g.set))&&(u.set=d),(d=o(g.init))&&i.unshift(d)}else(d=o(g))&&(s===`field`?i.unshift(d):u[c]=d)}l&&Object.defineProperty(l,r.name,u),f=!0},vr=class{pending=new Set;lastWriter;writeState=0;readers=0;syncReaders=0;take(e,t,n){e==`rw`?this.writeState=t?2:1:(this.readers++,t&&this.syncReaders++);let r=!1,i=()=>{r||(r=!0,e==`rw`?this.writeState=0:(this.readers--,t&&this.syncReaders--),n())};return i[Symbol.dispose]=i,i}queue(e){let{promise:t,resolve:n}=Promise.withResolvers();return this.pending.add(t),e==`rw`&&(this.lastWriter=t),t.then(()=>{this.pending.delete(t),this.lastWriter==t&&delete this.lastWriter}),n}async acquire(e){let t=e==`ro`?this.lastWriter:Promise.all(this.pending),n=this.queue(e);return await t,this.take(e,!1,n)}acquireSync(e){if(this.writeState==2||e==`rw`&&this.syncReaders)throw M(`EDEADLK`);if(this.writeState||e==`rw`&&this.readers)throw M(`EAGAIN`);return this.take(e,!0,this.queue(e))}isAvailable(e){return(e!=`rw`||!this.readers)&&!this.writeState}get isFree(){return!this.writeState&&!this.readers}get mode(){return this.writeState?`rw`:this.readers?`ro`:null}},yr=(()=>{let e=[],t,n;return class{static{let r=typeof Symbol==`function`&&Symbol.metadata?Object.create(null):void 0;t=[v],n=[v],_r(this,null,t,{kind:`getter`,name:`lock`,static:!1,private:!1,access:{has:e=>`lock`in e,get:e=>e.lock},metadata:r},null,e),_r(this,null,n,{kind:`getter`,name:`lockSync`,static:!1,private:!1,access:{has:e=>`lockSync`in e,get:e=>e.lockSync},metadata:r},null,e),r&&Object.defineProperty(this,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:r})}_rwLock=(gr(this,e),new vr);get lock(){return this._rwLock.acquire.bind(this._rwLock)}get lockSync(){return this._rwLock.acquireSync.bind(this._rwLock)}get isLocked(){return!this._rwLock.isFree}get lockMode(){return this._rwLock.mode}}})(),br=class extends yr{fs;inode;data;dirtyRanges=[];truncatedTo;metadataDirty=!1;refs=0;paths=new Set;_lastPath;constructor(e,t,n){super(),this.fs=e,this.inode=n,this.paths.add(t),this._lastPath=t,this.data=new a(n.ino,n.size,{sparse:!0})}get ino(){return this.inode.ino}get path(){let[e]=this.paths;return e!==void 0&&(this._lastPath=e),e??this._lastPath}get dirty(){return this.metadataDirty||this.dirtyRanges.length>0}get bypassCache(){return In(this.inode)||Fn(this.inode)||!!(this.inode.flags&kn.DAX)}markDirty(e,t){this.dirtyRanges.push({start:e,end:t}),this.dirtyRanges.sort((e,t)=>e.start-t.start);let n=[];for(let e of this.dirtyRanges){let t=n.at(-1);t&&e.start<=t.end?t.end=Math.max(t.end,e.end):n.push(e)}this.dirtyRanges=n}copyFromCache(e,t,n){let r=t;for(let i of this.data.regions){let a=i.offset+i.data.byteLength;if(a<=r)continue;if(i.offset>=n)break;i.offset>r&&(e.fill(0,r-t,i.offset-t),r=i.offset);let o=Math.min(n,a);e.set(i.data.subarray(r-i.offset,o-i.offset),r-t),r=o}r<n&&e.fill(0,r-t,n-t)}async read(e,t,n){if(this.bypassCache)return await this.fs.read(this.path,e,t,n);for(let{start:e,end:r}of this.data.missing(t,n)){let t=new Uint8Array(r-e);await this.fs.read(this.path,t,e,r),this.data.add(t,e)}this.copyFromCache(e,t,n)}readSync(e,t,n){if(this.bypassCache)return this.fs.readSync(this.path,e,t,n);for(let{start:e,end:r}of this.data.missing(t,n)){let t=new Uint8Array(r-e);this.fs.readSync(this.path,t,e,r),this.data.add(t,e)}this.copyFromCache(e,t,n)}async write(e,t){this.bypassCache?await this.fs.write(this.path,e,t):this._writeCached(e,t),this._writeMetadata(t+e.byteLength)}writeSync(e,t){this.bypassCache?this.fs.writeSync(this.path,e,t):this._writeCached(e,t),this._writeMetadata(t+e.byteLength)}_writeCached(e,t){let n=t+e.byteLength;this.data.add(e.slice(),t),n>this.data.size&&(this.data.size=n),this.markDirty(t,n)}_writeMetadata(e){!this.bypassCache&&e>this.inode.size&&(this.inode.size=e),this.inode.mtimeMs=Date.now(),this.inode.ctimeMs=Date.now(),this.metadataDirty=!0}truncate(e){this.truncatedTo=Math.min(this.truncatedTo??e,e),this.data.size=e,this.dirtyRanges=this.dirtyRanges.filter(t=>t.start<e).map(t=>t.end>e?{start:t.start,end:e}:t),this.inode.size=e,this.inode.mtimeMs=Date.now(),this.inode.ctimeMs=Date.now(),this.metadataDirty=!0}get needsPreTruncate(){return!this.bypassCache&&this.truncatedTo!==void 0&&this.truncatedTo<this.inode.size&&!this.fs.attributes.has(`no_write`)}async sync(){this.needsPreTruncate&&await this.fs.touch(this.path,{size:this.truncatedTo}),this.truncatedTo=void 0;for(let e of this.dirtyRanges)for(let t=e.start;t<e.end;){let n=this.data.regionAt(t);if(!n)break;let r=Math.min(e.end,n.offset+n.data.byteLength);await this.fs.write(this.path,n.data.subarray(t-n.offset,r-n.offset),t),t=r}this.dirtyRanges=[],this.metadataDirty&&=(this.fs.attributes.has(`no_write`)||await this.fs.touch(this.path,this.inode),!1)}syncSync(){this.needsPreTruncate&&this.fs.touchSync(this.path,{size:this.truncatedTo}),this.truncatedTo=void 0;for(let e of this.dirtyRanges)for(let t=e.start;t<e.end;){let n=this.data.regionAt(t);if(!n)break;let r=Math.min(e.end,n.offset+n.data.byteLength);this.fs.writeSync(this.path,n.data.subarray(t-n.offset,r-n.offset),t),t=r}this.dirtyRanges=[],this.metadataDirty&&=(this.fs.attributes.has(`no_write`)||this.fs.touchSync(this.path,this.inode),!1)}},xr=function(e,t,n){if(t!=null){if(typeof t!=`object`&&typeof t!=`function`)throw TypeError(`Object expected.`);var r,i;if(n){if(!Symbol.asyncDispose)throw TypeError(`Symbol.asyncDispose is not defined.`);r=t[Symbol.asyncDispose]}if(r===void 0){if(!Symbol.dispose)throw TypeError(`Symbol.dispose is not defined.`);r=t[Symbol.dispose],n&&(i=r)}if(typeof r!=`function`)throw TypeError(`Object not disposable.`);i&&(r=function(){try{i.call(this)}catch(e){return Promise.reject(e)}}),e.stack.push({value:t,dispose:r,async:n})}else n&&e.stack.push({async:!0});return t},Sr=(function(e){return function(t){function n(n){t.error=t.hasError?new e(n,t.error,`An error was suppressed during disposal.`):n,t.hasError=!0}var r,i=0;function a(){for(;r=t.stack.pop();)try{if(!r.async&&i===1)return i=0,t.stack.push(r),Promise.resolve().then(a);if(r.dispose){var e=r.dispose.call(r.value);if(r.async)return i|=2,Promise.resolve(e).then(a,function(e){return n(e),a()})}else i|=1}catch(e){n(e)}if(i===1)return t.hasError?Promise.reject(t.error):Promise.resolve();if(t.hasError)throw t.error}return a()}})(typeof SuppressedError==`function`?SuppressedError:function(e,t,n){var r=Error(n);return r.name=`SuppressedError`,r.error=e,r.suppressed=t,r}),Cr=class{fs;byIno=new Map;byPath=new Map;constructor(e){this.fs=e}get(e){return this.byPath.get(e)}ref(e,t){let n=this.byIno.get(t.ino);return n?(n.paths.add(e),!n.dirty&&t!==n.inode&&Object.assign(n.inode,t)):(n=new br(this.fs,e,t),this.byIno.set(t.ino,n)),this.byPath.set(e,n),n.refs++,n}unref(e){e.refs--,!(e.refs>0||e.dirty)&&this.evict(e)}evict(e){this.byIno.delete(e.ino);for(let t of e.paths)this.byPath.delete(t)}rename(e,t){for(let[n,r]of this.byPath){if(n!=e&&!n.startsWith(e+`/`))continue;let i=t+n.slice(e.length);this.byPath.delete(n),this.byPath.set(i,r),r.paths.delete(n),r.paths.add(i)}}link(e,t){let n=this.byPath.get(e);n&&(n.paths.add(t),this.byPath.set(t,n))}remove(e){let t=this.byPath.get(e);t&&(this.byPath.delete(e),t.paths.delete(e),!t.paths.size&&!t.refs&&this.evict(t))}async sync(){for(let e of this.byIno.values()){let t={stack:[],error:void 0,hasError:!1};try{if(!e.dirty)continue;xr(t,await e.lock(`rw`),!1),await e.sync(),e.refs||this.evict(e)}catch(e){t.error=e,t.hasError=!0}finally{Sr(t)}}}syncSync(){for(let e of this.byIno.values()){let t={stack:[],error:void 0,hasError:!1};try{if(!e.dirty)continue;xr(t,e.lockSync(`rw`),!1),e.syncSync(),e.refs||this.evict(e)}catch(e){t.error=e,t.hasError=!0}finally{Sr(t)}}}},wr=new Map;function Tr(e){let t=wr.get(e.uuid);return t||(t=new Cr(e),wr.set(e.uuid,t)),t}async function Er(e,t,n,r){let i=Tr(e);r??=i.get(t)?.inode??await e.stat(t);let a=i.ref(t,r),o=await a.lock(n),s=!1,c=()=>{s||(s=!0,o(),i.unref(a))};return c[Symbol.dispose]=c,c}function Dr(e,t,n,r){let i=Tr(e);r??=i.get(t)?.inode??e.statSync(t);let a=i.ref(t,r),o;try{o=a.lockSync(n)}catch(e){throw i.unref(a),e}let s=!1,c=()=>{s||(s=!0,o(),i.unref(a))};return c[Symbol.dispose]=c,c}var Or=function(e,t,n){for(var r=arguments.length>2,i=0;i<t.length;i++)n=r?t[i].call(e,n):t[i].call(e);return r?n:void 0},kr=function(e,t,n,r,i,a){function o(e){if(e!==void 0&&typeof e!=`function`)throw TypeError(`Function expected`);return e}for(var s=r.kind,c=s===`getter`?`get`:s===`setter`?`set`:`value`,l=!t&&e?r.static?e:e.prototype:null,u=t||(l?Object.getOwnPropertyDescriptor(l,r.name):{}),d,f=!1,p=n.length-1;p>=0;p--){var m={};for(var h in r)m[h]=h===`access`?{}:r[h];for(var h in r.access)m.access[h]=r.access[h];m.addInitializer=function(e){if(f)throw TypeError(`Cannot add initializers after decoration has completed`);a.push(o(e||null))};var g=(0,n[p])(s===`accessor`?{get:u.get,set:u.set}:u[c],m);if(s===`accessor`){if(g===void 0)continue;if(typeof g!=`object`||!g)throw TypeError(`Object expected`);(d=o(g.get))&&(u.get=d),(d=o(g.set))&&(u.set=d),(d=o(g.init))&&i.unshift(d)}else(d=o(g))&&(s===`field`?i.unshift(d):u[c]=d)}l&&Object.defineProperty(l,r.name,u),f=!0},Ar=function(e,t,n){if(t!=null){if(typeof t!=`object`&&typeof t!=`function`)throw TypeError(`Object expected.`);var r,i;if(n){if(!Symbol.asyncDispose)throw TypeError(`Symbol.asyncDispose is not defined.`);r=t[Symbol.asyncDispose]}if(r===void 0){if(!Symbol.dispose)throw TypeError(`Symbol.dispose is not defined.`);r=t[Symbol.dispose],n&&(i=r)}if(typeof r!=`function`)throw TypeError(`Object not disposable.`);i&&(r=function(){try{i.call(this)}catch(e){return Promise.reject(e)}}),e.stack.push({value:t,dispose:r,async:n})}else n&&e.stack.push({async:!0});return t},jr=(function(e){return function(t){function n(n){t.error=t.hasError?new e(n,t.error,`An error was suppressed during disposal.`):n,t.hasError=!0}var r,i=0;function a(){for(;r=t.stack.pop();)try{if(!r.async&&i===1)return i=0,t.stack.push(r),Promise.resolve().then(a);if(r.dispose){var e=r.dispose.call(r.value);if(r.async)return i|=2,Promise.resolve(e).then(a,function(e){return n(e),a()})}else i|=1}catch(e){n(e)}if(i===1)return t.hasError?Promise.reject(t.error):Promise.resolve();if(t.hasError)throw t.error}return a()}})(typeof SuppressedError==`function`?SuppressedError:function(e,t,n){var r=Error(n);return r.name=`SuppressedError`,r.error=e,r.suppressed=t,r}),Mr=4096,Nr=(()=>{let e=[],t,n;return class{static{let r=typeof Symbol==`function`&&Symbol.metadata?Object.create(null):void 0;kr(this,null,t,{kind:`getter`,name:`inode`,static:!1,private:!1,access:{has:e=>`inode`in e,get:e=>e.inode},metadata:r},null,e),kr(this,null,n,{kind:`getter`,name:`fs`,static:!1,private:!1,access:{has:e=>`fs`in e,get:e=>e.fs},metadata:r},null,e),r&&Object.defineProperty(this,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:r})}context=Or(this,e);path;internalPath;flag;vnode;_position=0;get position(){return this.flag&1024?this.inode.size:this._position}set position(e){this._position=e}get inode(){return this.vnode.inode}get fs(){return this.vnode.fs}get dirty(){return this.vnode.dirty}closed=!1;get isClosed(){return this.closed}constructor(e,t,n,r,i){this.context=e,this.path=t,this.internalPath=n,this.flag=r,this.vnode=i}get _isSync(){return!!(this.flag&1052672||this.inode.flags&kn.Sync||this.fs.attributes.has(`sync`))}[(t=[v],n=[v],Symbol.dispose)](){this.closeSync()}syncSync(){let e={stack:[],error:void 0,hasError:!1};try{if(this.closed)throw j(`EBADF`,`sync`,this.path);if(!this.dirty)return;Ar(e,this.vnode.lockSync(`rw`),!1),this.vnode.syncSync()}catch(t){e.error=t,e.hasError=!0}finally{jr(e)}}datasyncSync(){return this.syncSync()}closeSync(){if(this.closed)throw j(`EBADF`,`close`,this.path);this.syncSync(),this.disposeSync(!0)}disposeSync(e){if(this.closed)throw j(`EBADF`,`close`,this.path);if(this.dirty&&!e)throw j(`EBUSY`,`close`,this.path);this.closed=!0,Tr(this.fs).unref(this.vnode)}truncateSync(e){let t={stack:[],error:void 0,hasError:!1};try{if(e<0)throw j(`EINVAL`,`truncate`,this.path);if(this.closed||!(this.flag&1||this.flag&2))throw j(`EBADF`,`truncate`,this.path);if(this.fs.attributes.has(`readonly`))throw j(`EROFS`,`truncate`,this.path);if(this.inode.flags&kn.Immutable)throw j(`EPERM`,`truncate`,this.path);Ar(t,this.vnode.lockSync(`rw`),!1),this.vnode.truncate(e),this._isSync&&this.vnode.syncSync()}catch(e){t.error=e,t.hasError=!0}finally{jr(t)}}writeSync(e,t=0,n=e.byteLength-t,r=this.position){let i={stack:[],error:void 0,hasError:!1};try{if(this.closed||!(this.flag&1||this.flag&2))throw j(`EBADF`,`write`,this.path);if(this.fs.attributes.has(`readonly`))throw j(`EROFS`,`write`,this.path);if(this.inode.flags&kn.Immutable)throw j(`EPERM`,`write`,this.path);Ar(i,this.vnode.lockSync(`rw`),!1);let a=e.subarray(t,t+n);return this.vnode.writeSync(a,r),this._position=r+a.byteLength,this._isSync&&this.vnode.syncSync(),a.byteLength}catch(e){i.error=e,i.hasError=!0}finally{jr(i)}}readSync(e,t=0,n=e.byteLength-t,r=this.position){let i={stack:[],error:void 0,hasError:!1};try{if(this.closed||this.flag&1)throw j(`EBADF`,`read`,this.path);Ar(i,this.vnode.lockSync(`ro`),!1),!(this.inode.flags&kn.NoAtime)&&!this.fs.attributes.has(`no_atime`)&&(this.vnode.metadataDirty=!0,this.inode.atimeMs=Date.now());let a=r+n;!In(this.inode)&&!Fn(this.inode)&&a>this.inode.size&&(a=r+Math.max(this.inode.size-r,0)),this._position=a;let o=new Uint8Array(e.buffer,e.byteOffset,e.byteLength);return this.vnode.readSync(o.subarray(t,t+n),r,a),this._isSync&&this.vnode.syncSync(),a-r}catch(e){i.error=e,i.hasError=!0}finally{jr(i)}}chmodSync(e){let t={stack:[],error:void 0,hasError:!1};try{if(this.closed)throw j(`EBADF`,`chmod`,this.path);Ar(t,this.vnode.lockSync(`rw`),!1),this.vnode.metadataDirty=!0,this.inode.mode=this.inode.mode&(e>61440?~Je:Je)|e,(this._isSync||e>61440)&&this.vnode.syncSync()}catch(e){t.error=e,t.hasError=!0}finally{jr(t)}}chownSync(e,t){let n={stack:[],error:void 0,hasError:!1};try{if(this.closed)throw j(`EBADF`,`chmod`,this.path);Ar(n,this.vnode.lockSync(`rw`),!1),this.vnode.metadataDirty=!0,Rn(this.inode,e,t),this._isSync&&this.vnode.syncSync()}catch(e){n.error=e,n.hasError=!0}finally{jr(n)}}utimesSync(e,t){let n={stack:[],error:void 0,hasError:!1};try{if(this.closed)throw j(`EBADF`,`utimes`,this.path);Ar(n,this.vnode.lockSync(`rw`),!1),this.vnode.metadataDirty=!0,this.inode.atimeMs=e,this.inode.mtimeMs=t,this._isSync&&this.vnode.syncSync()}catch(e){n.error=e,n.hasError=!0}finally{jr(n)}}async[Symbol.asyncDispose](){await this.close()}async sync(){let e={stack:[],error:void 0,hasError:!1};try{if(this.closed)throw j(`EBADF`,`sync`,this.path);if(!this.dirty)return;Ar(e,await this.vnode.lock(`rw`),!1),await this.vnode.sync()}catch(t){e.error=t,e.hasError=!0}finally{jr(e)}}datasync(){return this.sync()}async close(){if(this.closed)throw j(`EBADF`,`close`,this.path);await this.sync(),this.dispose(!0)}dispose(e){if(this.closed)throw j(`EBADF`,`close`,this.path);if(this.dirty&&!e)throw j(`EBUSY`,`close`,this.path);this.closed=!0,Tr(this.fs).unref(this.vnode)}stat(){if(this.closed)throw j(`EBADF`,`stat`,this.path);return this.inode}async truncate(e){let t={stack:[],error:void 0,hasError:!1};try{if(e<0)throw j(`EINVAL`,`truncate`,this.path);if(this.closed||!(this.flag&1||this.flag&2))throw j(`EBADF`,`truncate`,this.path);if(this.fs.attributes.has(`readonly`))throw j(`EROFS`,`truncate`,this.path);if(this.inode.flags&kn.Immutable)throw j(`EPERM`,`truncate`,this.path);Ar(t,await this.vnode.lock(`rw`),!1),this.vnode.truncate(e),this._isSync&&await this.vnode.sync()}catch(e){t.error=e,t.hasError=!0}finally{jr(t)}}async write(e,t=0,n=e.byteLength-t,r=this.position){let i={stack:[],error:void 0,hasError:!1};try{if(this.closed||!(this.flag&1||this.flag&2))throw j(`EBADF`,`write`,this.path);if(this.fs.attributes.has(`readonly`))throw j(`EROFS`,`write`,this.path);if(this.inode.flags&kn.Immutable)throw j(`EPERM`,`write`,this.path);Ar(i,await this.vnode.lock(`rw`),!1);let a=e.subarray(t,t+n);return await this.vnode.write(a,r),this._position=r+a.byteLength,this._isSync&&await this.vnode.sync(),a.byteLength}catch(e){i.error=e,i.hasError=!0}finally{jr(i)}}async read(e,t=0,n=e.byteLength-t,r=this.position){let i={stack:[],error:void 0,hasError:!1};try{if(this.closed||this.flag&1)throw j(`EBADF`,`read`,this.path);Ar(i,await this.vnode.lock(`ro`),!1),!(this.inode.flags&kn.NoAtime)&&!this.fs.attributes.has(`no_atime`)&&(this.vnode.metadataDirty=!0,this.inode.atimeMs=Date.now());let a=r+n;!In(this.inode)&&!Fn(this.inode)&&a>this.inode.size&&(a=r+Math.max(this.inode.size-r,0)),this._position=a;let o=new Uint8Array(e.buffer,e.byteOffset,e.byteLength);return await this.vnode.read(o.subarray(t,t+n),r,a),this._isSync&&await this.vnode.sync(),a-r}catch(e){i.error=e,i.hasError=!0}finally{jr(i)}}async chmod(e){let t={stack:[],error:void 0,hasError:!1};try{if(this.closed)throw j(`EBADF`,`chmod`,this.path);Ar(t,await this.vnode.lock(`rw`),!1),this.vnode.metadataDirty=!0,this.inode.mode=this.inode.mode&(e>61440?~Je:Je)|e,(this._isSync||e>61440)&&await this.vnode.sync()}catch(e){t.error=e,t.hasError=!0}finally{jr(t)}}async chown(e,t){let n={stack:[],error:void 0,hasError:!1};try{if(this.closed)throw j(`EBADF`,`chown`,this.path);Ar(n,await this.vnode.lock(`rw`),!1),this.vnode.metadataDirty=!0,Rn(this.inode,e,t),this._isSync&&await this.vnode.sync()}catch(e){n.error=e,n.hasError=!0}finally{jr(n)}}async utimes(e,t){let n={stack:[],error:void 0,hasError:!1};try{if(this.closed)throw j(`EBADF`,`utimes`,this.path);Ar(n,await this.vnode.lock(`rw`),!1),this.vnode.metadataDirty=!0,this.inode.atimeMs=e,this.inode.mtimeMs=t,this._isSync&&await this.vnode.sync()}catch(e){n.error=e,n.hasError=!0}finally{jr(n)}}streamRead(e){if(this.closed)throw j(`EBADF`,`streamRead`,this.path);let{vnode:t}=this;return new ReadableStream({async start(n){let r={stack:[],error:void 0,hasError:!1};try{Ar(r,await t.lock(`ro`),!1);let{start:i=0,end:a=t.inode.size}=e;for(let e=i;e<a;e+=Mr){let r=e+Mr>a?a-e:Mr,i=new Uint8Array(r);await t.read(i,e,e+r).catch(n.error.bind(n)),n.enqueue(i)}n.close()}catch(e){r.error=e,r.hasError=!0}finally{jr(r)}},type:`bytes`})}streamWrite(e){if(this.closed)throw j(`EBADF`,`write`,this.path);if(this.inode.flags&kn.Immutable)throw j(`EPERM`,`write`,this.path);if(this.fs.attributes.has(`readonly`))throw j(`EROFS`,`write`,this.path);let{vnode:t}=this,n=e.start??0;return new WritableStream({async write(e,r){let i={stack:[],error:void 0,hasError:!1};try{Ar(i,await t.lock(`rw`),!1),await t.write(e,n).catch(r.error.bind(r)),n+=e.byteLength}catch(e){i.error=e,i.hasError=!0}finally{jr(i)}},async close(){let e={stack:[],error:void 0,hasError:!1};try{Ar(e,await t.lock(`rw`),!1),await t.sync()}catch(t){e.error=t,e.hasError=!0}finally{jr(e)}}})}}})();function Pr(e){let t=Fe(e.context).descriptors,n=Math.max(t.size?Math.max(...t.keys())+1:0,4);return t.set(n,e),n}function Fr(e,t){Zt(t);let n=Fe(e).descriptors.get(t);if(!n)throw M(`EBADF`);return n}function Ir(e,t){return Fe(e).descriptors.delete(t)}var Lr=/[rwasx]{1,2}\+?/;function Rr(e){if(typeof e==`number`)return e;if(!Lr.test(e))throw M(`EINVAL`,`Invalid flag string: `+e);return zr(e)}function zr(e){if(!e.includes(`r`)&&!e.includes(`w`)&&!e.includes(`a`))throw M(`EINVAL`,`Invalid flag string: `+e);let t=e.includes(`r`)?0:64;return e.includes(`w`)&&(t|=512),e.includes(`a`)&&(t|=ze),e.includes(`+`)?t|=2:e.includes(`r`)||(t|=1),e.includes(`s`)&&(t|=Ue),e.includes(`x`)&&(t|=128),t}function Br(e){let t=0;return e&1||(t|=4),(e&1||e&2)&&(t|=2),t}var Vr=A;function Hr(e,t){return e.path=t,e}function Ur(e,t,n,r){let i=typeof n==`string`?{path:n,dest:r,syscall:t.endsWith(`Sync`)?t.slice(0,-4):t}:n,a=e[t];if(typeof a!=`function`)throw TypeError(`${t} is not a function`);return function(...t){try{return a.call(e,...t)}catch(e){throw k(Object.assign(e,i))}}}function Wr(e,t){return new Proxy(e,{get(e,n){let r=Reflect.get(e,n);return typeof r==`function`?function n(...i){try{let a=r.apply(e,i);return a instanceof Promise?a.catch(e=>{if(`code`in e)throw k(Object.assign(e,t));if(e in O){let r=j(e,t);Error.captureStackTrace(r,n)}throw e}):a}catch(e){throw k(Object.assign(e,t))}}:r}})}var Gr=new Map;Kr(`/`,Qn.create({label:`root`}));function Kr(e,t){if(e[0]!=`/`&&(e=`/`+e),e=cn.call(this,e),Gr.has(e))throw I(M(`EINVAL`,`Mount point is already in use: `+e));t._mountPoint=e,Gr.set(e,t),wr.has(t.uuid)||wr.set(t.uuid,new Cr(t)),fe(`Mounted ${t.name} on ${e}`),pe(`${t.name} attributes: ${[...t.attributes].map(([e,t])=>t==null?e:e+`=`+t).join(`, `)}`)}function qr(e){e[0]!=`/`&&(e=`/`+e),e=cn.call(this,e);let t=Gr.get(e);if(!t){L(e+` is already unmounted`);return}let n=()=>{wr.delete(t.uuid),fe(`Synced all changes to `+e)};try{wr.get(t.uuid)?.syncSync(),n()}catch{L(`Could not flush to ${e} synchronously.`),wr.get(t.uuid)?.sync().then(n)}Gr.delete(e),de(`Unmounted `+e)}function X(e,t,n){let{root:r}=Fe(t),i={path:e,...n};e=H(U(r,e),!0),e=cn.call(t,e);let a=[...Gr].sort((e,t)=>e[0].length>t[0].length?-1:1);for(let[t,n]of a){if(!Xr(t,e))continue;e=e.slice(t.length>1?t.length:0),e===``&&(e=`/`);let a=n.attributes.get(`case_fold`);return a===`lower`&&(e=e.toLowerCase()),a===`upper`&&(e=e.toUpperCase()),{fs:Wr(n,i),path:e,mountPoint:t,root:r}}throw le(new A(O.EIO,`No file system for `+e))}function Jr(e,t){let n=e.usage(),r=n.blockSize||4096;return{type:(t?BigInt:Number)(e.type),bsize:(t?BigInt:Number)(r),ffree:(t?BigInt:Number)(n.freeNodes||4294967295),files:(t?BigInt:Number)(n.totalNodes||4294967295),bavail:(t?BigInt:Number)(n.freeSpace/r),bfree:(t?BigInt:Number)(n.freeSpace/r),blocks:(t?BigInt:Number)(n.totalSpace/r)}}function Yr(e){let t=Fe(this);if(!Me(t.credentials))throw M(`EPERM`,`Can not chroot() as non-root user`);t.root??=`/`;let n=U(t.root,e);for(let e of t.descriptors?.values()??[]){if(!e.path.startsWith(t.root))throw j(`EBUSY`,`chroot`,e.path);e.path=e.path.slice(t.root.length)}if(n.length>t.root.length)throw M(`EPERM`,`Can not chroot() outside of current root`);t.root=n}function Xr(e,t){return e===`/`||e===t||(e.endsWith(`/`)||(e+=`/`),t.startsWith(e))}var Zr=t({link:()=>oi,mkdir:()=>ri,open:()=>ti,readdir:()=>ii,readlink:()=>ni,rename:()=>ai,resolve:()=>ei,stat:()=>si}),Qr=function(e,t,n){if(t!=null){if(typeof t!=`object`&&typeof t!=`function`)throw TypeError(`Object expected.`);var r,i;if(n){if(!Symbol.asyncDispose)throw TypeError(`Symbol.asyncDispose is not defined.`);r=t[Symbol.asyncDispose]}if(r===void 0){if(!Symbol.dispose)throw TypeError(`Symbol.dispose is not defined.`);r=t[Symbol.dispose],n&&(i=r)}if(typeof r!=`function`)throw TypeError(`Object not disposable.`);i&&(r=function(){try{i.call(this)}catch(e){return Promise.reject(e)}}),e.stack.push({value:t,dispose:r,async:n})}else n&&e.stack.push({async:!0});return t},$r=(function(e){return function(t){function n(n){t.error=t.hasError?new e(n,t.error,`An error was suppressed during disposal.`):n,t.hasError=!0}var r,i=0;function a(){for(;r=t.stack.pop();)try{if(!r.async&&i===1)return i=0,t.stack.push(r),Promise.resolve().then(a);if(r.dispose){var e=r.dispose.call(r.value);if(r.async)return i|=2,Promise.resolve(e).then(a,function(e){return n(e),a()})}else i|=1}catch(e){n(e)}if(i===1)return t.hasError?Promise.reject(t.error):Promise.resolve();if(t.hasError)throw t.error}return a()}})(typeof SuppressedError==`function`?SuppressedError:function(e,t,n){var r=Error(n);return r.name=`SuppressedError`,r.error=e,r.suppressed=t,r});function ei(e,t,n,r){t=cn.call(e,t);try{let i=X(t,e),a=Tr(i.fs).get(i.path)?.inode??i.fs.statSync(i.path);return!Nn(a)||n?{...i,fullPath:t,stats:a}:ei(e,cn.call(e,W(t),ni.call(e,t)),n,r)}catch(e){if(k(Object.assign(e,{syscall:`stat`,path:t,...r})),n)throw e}let{base:i,dir:a}=hn(t),o=a==`/`?`/`:ei(e,a,!1,r).fullPath,s=U(o,i),c=X(s,e),l;try{l=Tr(c.fs).get(c.path)?.inode??c.fs.statSync(c.path)}catch(e){if(e.code===`ENOENT`)return{...c,fullPath:s};throw k(Object.assign(e,{syscall:`stat`,path:s,...r}))}return Nn(l)?ei(e,cn.call(e,o,ni.call(e,s)),!1,r):{...c,fullPath:s,stats:l}}function ti(e,t){e=H(e);let n=Yt(t.mode,420),r=Rr(t.flag);e=t.preserveSymlinks?e:ei(this,e).fullPath;let{fs:i,path:a}=X(e,this),o;try{o=i.statSync(a)}catch{}if(!o){let o={stack:[],error:void 0,hasError:!1};try{if(!(r&64))throw j(`ENOENT`,`open`,e);let s=W(a),c=i.statSync(s);if(Y&&!J(this,c,2))throw j(`EACCES`,`open`,e);if(!q(c))throw j(`ENOTDIR`,`open`,e);if(!t.allowDirectory&&n&16384)throw j(`EISDIR`,`open`,e);Qr(o,Dr(i,s,`rw`,c),!1);let{euid:l,egid:u}=Fe(this).credentials,d=i.createFileSync(a,{mode:n,uid:c.mode&2048?c.uid:l,gid:c.mode&1024?c.gid:u});return da(this,`rename`,e),new Nr(this,e,a,r,Tr(i).ref(a,d))}catch(e){o.error=e,o.hasError=!0}finally{$r(o)}}if(Y&&(!J(this,o,n)||!J(this,o,Br(r))))throw j(`EACCES`,`open`,e);if(r&128)throw j(`EEXIST`,`open`,e);if(!t.allowDirectory&&o.mode&16384)throw j(`EISDIR`,`open`,e);let s=new Nr(this,e,a,r,Tr(i).ref(a,o));return r&512&&s.truncateSync(0),s}function ni(e){e=H(e);let{fs:t,stats:n,path:r}=ei(this,e,!0,{syscall:`readlink`});if(!n)throw j(`ENOENT`,`readlink`,e);if(Y&&!J(this,n,4))throw j(`EACCES`,`readlink`,e);if(!Nn(n))throw j(`EINVAL`,`readlink`,e);let i=n.size,a=new Uint8Array(i);return t.readSync(r,a,0,i),T(a)}function ri(e,t={}){let n=H(e),r={syscall:`mkdir`,path:n},{fullPath:i}=ei(this,W(n),!1,r),{fs:a,path:o}=X(U(i,fn(n)),this,r),s=i!=W(n),{euid:c,egid:l}=Fe(this).credentials,{mode:u=511,recursive:d}=t,f,p=(e,t)=>{let n={stack:[],error:void 0,hasError:!1};try{let i=W(t),m=d&&i!=`/`?p(W(e),i):a.statSync(i);if(d){let n;try{n=Tr(a).get(t)?.inode??a.statSync(t)}catch{}if(n){let i=Nn(n)?ei(this,e,!1,r).stats:n;if(!i)throw j(`ENOENT`,r);if(!q(i))throw j(t==o?`EEXIST`:`ENOTDIR`,r);return n}if(s&&a.existsSync(U(i,fn(e))))throw j(`ENOENT`,r)}if(Y&&!J(this,m,2))throw j(`EACCES`,`mkdir`,e);Qr(n,Dr(a,i,`rw`,m),!1);let h=Ur(a,`mkdirSync`,{path:e,syscall:`mkdir`})(t,{mode:u,uid:m.mode&2048?m.uid:c,gid:m.mode&1024?m.gid:l});return d&&(f??=e),da(this,`rename`,e),h}catch(e){n.error=e,n.hasError=!0}finally{$r(n)}};return p(n,o),f}function ii(e,t={}){e=H(e);let{fs:n,path:r}=ei(this,e),i=Tr(n).get(r)?.inode??Ur(n,`statSync`,{path:e,syscall:`scandir`})(r);if(Y&&!J(this,i,4))throw j(`EACCES`,`scandir`,e);if(!q(i))throw j(`ENOTDIR`,`scandir`,e);let a;{let e={stack:[],error:void 0,hasError:!1};try{Qr(e,Dr(n,r,`ro`,i),!1),a=n.readdirSync(r)}catch(t){e.error=t,e.hasError=!0}finally{$r(e)}}let o=[],s=e=>{let i;try{i=n.statSync(U(r,e))}catch(e){if(e.code==`ENOENT`)return;throw e}let a=new hr;if(a.ino=i.ino,a.type=pr(i.mode),a.path=e,a.name=fn(e),o.push(a),!q(i)||!t?.recursive)return;let c=n.readdirSync(U(r,e));for(let t of c)s(U(e,t))};for(let e of a)s(e);return o}function ai(e,t){let n={stack:[],error:void 0,hasError:!1};try{e=H(e),t=H(t);let r={syscall:`rename`,path:e,dest:t},i=ei(this,e,!0,r),a=X(t,this,r);if(i.fs.uuid!==a.fs.uuid)throw j(`EXDEV`,r);if(a.path.startsWith(i.path+`/`))throw j(`EINVAL`,r);if(!i.stats)throw j(`ENOENT`,r);let o=i.fs,s=o.statSync(W(i.path)),c=o.statSync(W(a.path)),l;try{l=o.statSync(a.path)}catch(e){if(e.code!=`ENOENT`)throw e}if(Y&&(!J(this,s,4)||!J(this,c,2)))throw j(`EACCES`,r);if(l&&!q(i.stats)&&q(l))throw j(`EISDIR`,r);if(l&&q(i.stats)&&!q(l))throw j(`ENOTDIR`,r);let u=W(i.path),d=W(a.path),f=[[u,s],[d,c]];s.ino>c.ino&&f.reverse(),Qr(n,Dr(o,f[0][0],`rw`,f[0][1]),!1),Qr(n,s.ino==c.ino?null:Dr(o,f[1][0],`rw`,f[1][1]),!1),i.fs.renameSync(i.path,a.path),Tr(o).rename(i.path,a.path),da(this,`rename`,e),da(this,`rename`,t)}catch(e){n.error=e,n.hasError=!0}finally{$r(n)}}function oi(e,t){let n={stack:[],error:void 0,hasError:!1};try{e=H(e),t=H(t);let r={syscall:`link`,path:e,dest:t},{fs:i,path:a}=X(e,this,r),o=X(t,this,r);if(i.uuid!==o.fs.uuid)throw j(`EXDEV`,r);let s=i.statSync(a);if(Y){if(!J(this,s,4))throw j(`EACCES`,r);let e=i.statSync(W(a));if(!J(this,e,4))throw j(`EACCES`,r);let t=i.statSync(W(o.path));if(!J(this,t,2))throw j(`EACCES`,r)}Qr(n,Dr(i,W(o.path),`rw`),!1),i.linkSync(a,o.path),Tr(i).link(a,o.path)}catch(e){n.error=e,n.hasError=!0}finally{$r(n)}}function si(e,t){e=H.call(this,e);let n={syscall:t?`lstat`:`stat`,path:e},r;if(!t)r=ei(this,e,!1,n).stats;else{let{base:t,dir:i}=hn(e),{fs:a,path:o}=ei(this,i,!1,n);try{let e=t?U(o,t):o;r=Tr(a).get(e)?.inode??a.statSync(e)}catch(e){throw k(Object.assign(e,n)),e}}if(!r)throw j(`ENOENT`,n);if(Y&&!J(this,r,4))throw j(`EACCES`,n);return r}var ci=class e{ino;type;_name;get name(){let e=ur.Buffer.from(this._name);return this._encoding==`buffer`?e:e.toString(this._encoding)}_encoding;_parentPath;get parentPath(){return this._parentPath}get path(){return L(`Dirent.path was removed in Node v24, use parentPath instead`),this._parentPath}static from(t,n,r=`.`){let i=new e,{base:a,dir:o}=hn(t.path);return i._parentPath=U(r,o),i._name=a,i.ino=t.ino,i.type=t.type,i._encoding=n,i}isFile(){return this.type===fr.REG}isDirectory(){return this.type===fr.DIR}isBlockDevice(){return this.type===fr.BLK}isCharacterDevice(){return this.type===fr.CHR}isSymbolicLink(){return this.type===fr.LNK}isFIFO(){return this.type===fr.FIFO}isSocket(){return this.type===fr.SOCK}};function li(){return Object.assign(Error(`Directory handle was closed`),{code:`ERR_DIR_CLOSED`})}var ui=class{path;context;closed=!1;checkClosed(){if(this.closed)throw li()}_entries;constructor(e,t){this.path=e,this.context=t}close(e){if(this.closed){let t=li();if(!e)return Promise.reject(t);e(t);return}if(this.closed=!0,!e)return Promise.resolve();e(null)}closeSync(){if(this.closed)throw li();this.closed=!0}async _read(){return this.checkClosed(),this._entries??=await Co.call(this.context,this.path,{withFileTypes:!0}),this._entries.length?this._entries.shift()??null:null}read(e){if(!e)return this._read();this._read().then(t=>e(null,t))}readSync(){return this.checkClosed(),this._entries??=Ii.call(this.context,this.path,{withFileTypes:!0}),this._entries.length?this._entries.shift()??null:null}async next(){let e=await this._read();return e?{done:!1,value:e}:(await this.close(),{done:!0,value:void 0})}[Symbol.asyncIterator](){return this}[Symbol.dispose](){this.closed||this.closeSync()}async[Symbol.asyncDispose](){this.closed||await this.close()}},di=function(e,t,n){if(t!=null){if(typeof t!=`object`&&typeof t!=`function`)throw TypeError(`Object expected.`);var r,i;if(n){if(!Symbol.asyncDispose)throw TypeError(`Symbol.asyncDispose is not defined.`);r=t[Symbol.asyncDispose]}if(r===void 0){if(!Symbol.dispose)throw TypeError(`Symbol.dispose is not defined.`);r=t[Symbol.dispose],n&&(i=r)}if(typeof r!=`function`)throw TypeError(`Object not disposable.`);i&&(r=function(){try{i.call(this)}catch(e){return Promise.reject(e)}}),e.stack.push({value:t,dispose:r,async:n})}else n&&e.stack.push({async:!0});return t},fi=(function(e){return function(t){function n(n){t.error=t.hasError?new e(n,t.error,`An error was suppressed during disposal.`):n,t.hasError=!0}var r,i=0;function a(){for(;r=t.stack.pop();)try{if(!r.async&&i===1)return i=0,t.stack.push(r),Promise.resolve().then(a);if(r.dispose){var e=r.dispose.call(r.value);if(r.async)return i|=2,Promise.resolve(e).then(a,function(e){return n(e),a()})}else i|=1}catch(e){n(e)}if(i===1)return t.hasError?Promise.reject(t.error):Promise.resolve();if(t.hasError)throw t.error}return a()}})(typeof SuppressedError==`function`?SuppressedError:function(e,t,n){var r=Error(n);return r.name=`SuppressedError`,r.error=e,r.suppressed=t,r});function pi(e,t){return ai.call(this,e,t)}function mi(e){e=H(e);try{let{fs:t,path:n}=ei(this,e);return t.existsSync(n)}catch(e){if(e.errno==O.ENOENT)return!1;throw e}}function hi(e,t){let n=si.call(this,e,!1);return t?.bigint?new bn(n):new yn(n)}function gi(e,t){let n=si.call(this,e,!0);return t?.bigint?new bn(n):new yn(n)}function _i(e,t=0){let n={stack:[],error:void 0,hasError:!1};try{let r=di(n,ti.call(this,e,{flag:`r+`}),!1);if(t||=0,t<0)throw j(`EINVAL`,`truncate`,e.toString());r.truncateSync(t)}catch(e){n.error=e,n.hasError=!0}finally{fi(n)}}function vi(e){e=H(e);let{fs:t,path:n}=X(e,this);try{let e={stack:[],error:void 0,hasError:!1};try{if(Y&&!J(this,t.statSync(n),2))throw j(`EACCES`,`unlink`);di(e,Dr(t,W(n),`rw`),!1),t.unlinkSync(n),Tr(t).remove(n)}catch(t){e.error=t,e.hasError=!0}finally{fi(e)}}catch(t){throw k(Object.assign(t,{syscall:`unlink`,path:e}))}da(this,`rename`,e.toString())}function yi(e,t,n=0){return Pr(ti.call(this,e,{flag:t,mode:n}))}function bi(e,t,n){return Pr(ti.call(this,e,{flag:t,mode:n,preserveSymlinks:!0}))}function xi(e,t={}){let n={stack:[],error:void 0,hasError:!1};try{let r=$t(t,null,`r`,420);if(Rr(r.flag)&1)throw j(`EBADF`,`read`,e.toString());let i=di(n,typeof e==`number`?Fr(this,e):ti.call(this,e.toString(),{flag:r.flag,mode:420,preserveSymlinks:!1}),!1),{size:a}=i.stat(),o=ur.Buffer.alloc(a);return i.readSync(o,0,a,0),r.encoding?o.toString(r.encoding):o}catch(e){n.error=e,n.hasError=!0}finally{fi(n)}}function Si(e,t,n={}){let r={stack:[],error:void 0,hasError:!1};try{let i=$t(n,`utf8`,`w+`,420),a=Rr(i.flag);if(!(a&1||a&2))throw new A(O.EINVAL,`Flag passed to writeFile must allow for writing`);if(typeof t!=`string`&&!i.encoding)throw new A(O.EINVAL,`Encoding not specified`);let o=typeof t==`string`?ur.Buffer.from(t,i.encoding):new Uint8Array(t.buffer,t.byteOffset,t.byteLength);if(!o)throw new A(O.EINVAL,`Data not specified`);di(r,typeof e==`number`?Fr(this,e):ti.call(this,e.toString(),{flag:a,mode:i.mode}),!1).writeSync(o,0,o.byteLength,0),da(this,`change`,e.toString())}catch(e){r.error=e,r.hasError=!0}finally{fi(r)}}function Ci(e,t,n={}){let r=$t(n,`utf8`,`a+`,420),i=Rr(r.flag);if(!(i&1024))throw new A(O.EINVAL,`Flag passed to appendFile must allow for appending`);if(typeof t!=`string`&&!r.encoding)throw new A(O.EINVAL,`Encoding not specified`);let a=typeof t==`string`?ur.Buffer.from(t,r.encoding):new Uint8Array(t.buffer,t.byteOffset,t.byteLength),o=typeof e==`number`?Fr(this,e):ti.call(this,H(e),{flag:i,mode:r.mode});o.writeSync(a,0,a.byteLength),typeof o!=`number`&&o.closeSync()}function wi(e,t){let n=Fr(this,e).stat();return t?.bigint?new bn(n):new yn(n)}function Ti(e){Fr(this,e).closeSync(),Ir(this,e)}function Ei(e,t=0){if(t||=0,t<0)throw new A(O.EINVAL);Fr(this,e).truncateSync(t)}function Di(e){Fr(this,e).syncSync()}function Oi(e){Fr(this,e).datasyncSync()}function ki(e,t,n,r,i){let a,o,s,c;if(typeof t==`string`){c=typeof n==`number`?n:null;let e=typeof r==`string`?r:`utf8`;o=0,a=ur.Buffer.from(t,e),s=a.byteLength}else a=new Uint8Array(t.buffer,t.byteOffset,t.byteLength),o=n,s=r,c=typeof i==`number`?i:null;let l=Fr(this,e);c??=l.position;let u=l.writeSync(a,o,s,c);return da(this,`change`,l.path),u}function Ai(e,t,n,r,i){let a=Fr(this,e),o=typeof n==`object`?n.offset:n;if(typeof n==`object`&&(r=n.length,i=n.position),i&&i>2**53-1)throw j(`EINVAL`);return typeof i==`bigint`&&(i=Number(i)),i=Number.isSafeInteger(i)?i:a.position,a.readSync(t,o,r,i)}function ji(e,t,n){Fr(this,e).chownSync(t,n)}function Mi(e,t){let n=Yt(t,-1);if(n<0)throw new A(O.EINVAL,`Invalid mode.`);Fr(this,e).chmodSync(n)}function Ni(e,t,n){Fr(this,e).utimesSync(Qt(t),Qt(n))}function Pi(e){let t={stack:[],error:void 0,hasError:!1};try{e=H(e);let{fs:n,path:r}=ei(this,e),i=Ur(n,`statSync`,{path:e,syscall:`rmdir`})(r);if(!q(i))throw j(`ENOTDIR`,`rmdir`,e);if(Y&&!J(this,i,2))throw j(`EACCES`,`rmdir`,e);di(t,Dr(n,W(r),`rw`),!1),Ur(n,`rmdirSync`,e)(r),Tr(n).remove(r),da(this,`rename`,e.toString())}catch(e){t.error=e,t.hasError=!0}finally{fi(t)}}function Fi(e,t){t=typeof t==`object`?t:{mode:t};let n=Yt(t?.mode,511);return ri.call(this,e,{...t,mode:n})}function Ii(e,t){t=typeof t==`object`?t:{encoding:t},e=H(e);let n=[],r=ii.call(this,e,t??void 0);for(let i of r)t?.withFileTypes?n.push(ci.from(i,t.encoding,e)):t?.encoding==`buffer`?n.push(ur.Buffer.from(i.path)):n.push(i.path);return n}function Li(e,t){return oi.call(this,e,t)}function Ri(e,t,n=`file`){let r={stack:[],error:void 0,hasError:!1};try{if(![`file`,`dir`,`junction`].includes(n))throw TypeError(`Invalid symlink type: `+n);t=H(t);let i=di(r,ti.call(this,t,{flag:`wx`,mode:420}),!1);i.writeSync(C(H(e,!0))),i.chmodSync(Xe)}catch(e){r.error=e,r.hasError=!0}finally{fi(r)}}function zi(e,t){let n=ur.Buffer.from(ni.call(this,e)),r=typeof t==`object`?t?.encoding:t;return r==`buffer`?n:n.toString(r??`utf-8`)}function Bi(e,t,n){let r={stack:[],error:void 0,hasError:!1};try{di(r,ti.call(this,e,{flag:`r+`,mode:0}),!1).chownSync(t,n)}catch(e){r.error=e,r.hasError=!0}finally{fi(r)}}function Vi(e,t,n){let r=bi.call(this,e,`r+`);ji.call(this,r,t,n),Ti.call(this,r)}function Hi(e,t){let n;try{n=yi.call(this,e,`r+`)}catch(t){throw k(Object.assign(t,{syscall:`chmod`,path:H(e)}))}Mi.call(this,n,t),Ti.call(this,n)}function Ui(e,t){let n=bi.call(this,e,`r+`);Mi.call(this,n,t),Ti.call(this,n)}function Wi(e,t,n){let r=yi.call(this,e,`r+`);Ni.call(this,r,t,n),Ti.call(this,r)}function Gi(e,t,n){let r=bi.call(this,e,`r+`);Ni.call(this,r,t,n),Ti.call(this,r)}function Ki(e,t){let n=typeof t==`string`?t:t?.encoding??`utf8`;e=H(e,!0);let{fullPath:r}=ei(this,e);if(n==`utf8`||n==`utf-8`)return r;let i=ur.Buffer.from(r,`utf-8`);return n==`buffer`?i:i.toString(n)}function qi(e,t=384){if(Y&&!J(this,hi.call(this,e),t))throw new A(O.EACCES)}function Ji(e,t){e=H(e);let n;try{n=gi.bind(this)(e)}catch(e){if(e.code!=`ENOENT`||!t?.force)throw e}if(n)switch(n.mode&Je){case $e:if(t?.recursive)for(let n of Ii.call(this,e))Ji.call(this,U(e,n),t);Pi.call(this,e);break;case Ze:case Xe:case Qe:case et:vi.call(this,e);break;case tt:case Ye:default:throw j(`ENOSYS`,`rm`,e)}}function Yi(e,t){let n=typeof t==`object`?t?.encoding:t||`utf8`,r=nn(e);return Fi.call(this,r),n==`buffer`?ur.Buffer.from(r):r}function Xi(e,t){let n=nn(e);Fi.call(this,n);let r=()=>Ji(n,{recursive:!0,force:!0});return{path:n,remove:r,[Symbol.dispose]:r}}function Zi(e,t,n){if(e=H(e),t=H(t),n&&n&1&&mi.call(this,t))throw j(`EEXIST`,`copyFile`,t);Si.call(this,t,xi.call(this,e)),da(this,`rename`,t.toString())}function Qi(e,t,n){let r=Fr(this,e),i=0;for(let e of t)i+=r.readSync(e,0,e.byteLength,n+i);return i}function $i(e,t,n){let r=Fr(this,e),i=0;for(let e of t)i+=r.writeSync(new Uint8Array(e.buffer),0,e.byteLength,n+i);return i}function ea(e,t){return e=H(e),new ui(e,this)}function ta(e,t,n){e=H(e),t=H(t);let r=gi.call(this,e);if(n?.errorOnExist&&mi.call(this,t))throw j(`EEXIST`,`cp`,t);switch(r.mode&Je){case $e:if(!n?.recursive)throw j(`EISDIR`,`cp`,e);Fi.call(this,t,{recursive:!0});for(let r of Ii.call(this,e,{withFileTypes:!0}))n.filter&&!n.filter(U(e,r.name),U(t,r.name))||ta.call(this,U(e,r.name),U(t,r.name),n);break;case Xe:if(n?.dereference)Zi.call(this,e,t);else{let r=zi.call(this,e,`utf8`);Ri.call(this,n?.verbatimSymlinks?r:cn.call(this,W(e),r),t)}break;case Ze:Zi.call(this,e,t);break;case Qe:case et:case tt:case Ye:default:throw j(`ENOSYS`,`cp`,e)}n?.preserveTimestamps&&Wi.call(this,t,r.atime,r.mtime)}function na(e,t){e=H(e);let{fs:n}=X(e,this);return Jr(n,t?.bigint)}function ra(e,t={}){e=Array.isArray(e)?e:[e];let{cwd:n=`/`,withFileTypes:r=!1,exclude:i=()=>!1}=t,a=e.map(e=>e.replace(/^\/+/g,``)),o=a.some(e=>e.includes(`**`)),s=a.map(e=>{let t=e.search(/[*?[\]{]/);if(t===-1)return e;let n=e.lastIndexOf(`/`,t);return n===-1?``:e.slice(0,n)}),c=a.map(en),l=[];function u(e){let t=Ii(e,{withFileTypes:r,encoding:`utf8`});for(let n of t){let t=U(e,r?n.name:n);if(typeof i==`function`?i(r?n:t):i.some(e=>gn(e,t)))continue;let a=t.replace(/^\/+/g,``);hi(t).isDirectory()&&(o||s.some(e=>a===e||e.startsWith(a+`/`)))&&u(t),c.some(e=>e.test(a))&&l.push(r?n:a)}}return u(n instanceof URL?n.pathname:n),l}var ia=hi,aa=class extends c.default{_context;path;off(e,t,n,r){return super.off(e,t,n,r)}removeListener(e,t,n,r){return super.removeListener(e,t,n,r)}constructor(e,t){super(),this._context=e,this.path=t}setMaxListeners(){throw j(`ENOSYS`,`Watcher.setMaxListeners`)}getMaxListeners(){throw j(`ENOSYS`,`Watcher.getMaxListeners`)}prependListener(){throw j(`ENOSYS`,`Watcher.prependListener`)}prependOnceListener(){throw j(`ENOSYS`,`Watcher.prependOnceListener`)}rawListeners(){throw j(`ENOSYS`,`Watcher.rawListeners`)}ref(){return this}unref(){return this}},oa=class extends aa{options;realpath;constructor(e,t,n){let r=Fe(e);super(r,t),this.options=n,this.realpath=U(r.root,t),la(this.realpath,this)}close(){super.emit(`close`),ua(this.realpath,this)}[Symbol.dispose](){this.close()}},sa=class extends aa{options;intervalId;previous;constructor(e,t,n){super(e,t),this.options=n,this.start()}onInterval(){try{let e=ia.call(this._context,this.path);xn(this.previous,e)||(this.emit(`change`,e,this.previous),this.previous=e)}catch(e){this.emit(`error`,e)}}start(){let e=this.options.interval||5e3;try{this.previous=ia.call(this._context,this.path)}catch(e){this.emit(`error`,e);return}this.intervalId=setInterval(this.onInterval.bind(this),e),!this.options.persistent&&typeof this.intervalId==`object`&&this.intervalId.unref()}stop(){this.intervalId&&=(clearInterval(this.intervalId),void 0),this.removeAllListeners()}},ca=new Map;function la(e,t){let n=H(e);ca.has(n)||ca.set(n,new Set),ca.get(n).add(t)}function ua(e,t){let n=H(e);ca.has(n)&&(ca.get(n).delete(t),ca.get(n).size===0&&ca.delete(n))}function da(e,t,n){let r=Fe(e);r&&(n=U(r.root??`/`,n)),n=H(n);for(let e=n;;e=W(e)){let r=ca.get(e);if(r)for(let i of r)i.emit(`change`,t,dn.call(i._context,e,n)||fn(n));if(e===`/`)break}}var fa=function(e,t,n){if(t!=null){if(typeof t!=`object`&&typeof t!=`function`)throw TypeError(`Object expected.`);var r,i;if(n){if(!Symbol.asyncDispose)throw TypeError(`Symbol.asyncDispose is not defined.`);r=t[Symbol.asyncDispose]}if(r===void 0){if(!Symbol.dispose)throw TypeError(`Symbol.dispose is not defined.`);r=t[Symbol.dispose],n&&(i=r)}if(typeof r!=`function`)throw TypeError(`Object not disposable.`);i&&(r=function(){try{i.call(this)}catch(e){return Promise.reject(e)}}),e.stack.push({value:t,dispose:r,async:n})}else n&&e.stack.push({async:!0});return t},pa=(function(e){return function(t){function n(n){t.error=t.hasError?new e(n,t.error,`An error was suppressed during disposal.`):n,t.hasError=!0}var r,i=0;function a(){for(;r=t.stack.pop();)try{if(!r.async&&i===1)return i=0,t.stack.push(r),Promise.resolve().then(a);if(r.dispose){var e=r.dispose.call(r.value);if(r.async)return i|=2,Promise.resolve(e).then(a,function(e){return n(e),a()})}else i|=1}catch(e){n(e)}if(i===1)return t.hasError?Promise.reject(t.error):Promise.resolve();if(t.hasError)throw t.error}return a()}})(typeof SuppressedError==`function`?SuppressedError:function(e,t,n){var r=Error(n);return r.name=`SuppressedError`,r.error=e,r.suppressed=t,r});async function ma(e,t,n,r){if(t=cn.call(e,t),n){let n=X(t,e,r),i=Tr(n.fs).get(n.path)?.inode??await n.fs.stat(n.path).catch(()=>void 0);return{...n,fullPath:t,stats:i}}try{let i=X(t,e),a=Tr(i.fs).get(i.path)?.inode??await i.fs.stat(i.path);return Nn(a)?await ma(e,cn.call(e,W(t),await ga.call(e,t)),n,r):{...i,fullPath:t,stats:a}}catch{}let{base:i,dir:a}=hn(t),o=a==`/`?`/`:(await ma(e,a,!1,r)).fullPath,s=U(o,i),c=X(s,e),l=Tr(c.fs).get(c.path)?.inode??await c.fs.stat(c.path).catch(e=>{if(e.code!=`ENOENT`)throw k(Object.assign(e,{syscall:`stat`,path:s,...r}))});return l?Nn(l)?await ma(e,cn.call(e,o,await ga.call(e,s)),!1,r):{...c,fullPath:s,stats:l}:{...c,fullPath:s}}async function ha(e,t,n){t=H(t);let r=Yt(n.mode,420),i=Rr(n.flag),a={syscall:`open`,path:t},{fs:o,path:s,stats:c}=await ma(e,t,n.preserveSymlinks,a);if(!c){let l={stack:[],error:void 0,hasError:!1};try{if(!(i&64))throw j(`ENOENT`,a);let u=W(s),d=await o.stat(u);if(Y&&!J(e,d,2))throw j(`EACCES`,`open`,W(t));if(!q(d))throw j(`ENOTDIR`,`open`,W(t));if(!n.allowDirectory&&r&16384)throw j(`EISDIR`,`open`,t);if(fa(l,await Er(o,u,`rw`,d),!1),c=Tr(o).get(s)?.inode??await o.stat(s).catch(()=>void 0),!c){let{euid:n,egid:a}=Fe(e).credentials,c=await o.createFile(s,{mode:r,uid:d.mode&2048?d.uid:n,gid:d.mode&1024?d.gid:a});return da(e,`rename`,t),new Nr(e,t,s,i,Tr(o).ref(s,c))}}catch(e){l.error=e,l.hasError=!0}finally{pa(l)}}if(Y&&!J(e,c,Br(i)))throw j(`EACCES`,a);if(i&128)throw j(`EEXIST`,a);if(!n.allowDirectory&&r&16384)throw j(`EISDIR`,`open`,t);let l=new Nr(e,t,s,i,Tr(o).ref(s,c));return i&512&&await l.truncate(0),l}async function ga(e){e=H(e);let t={syscall:`readlink`,path:e},{fs:n,stats:r,path:i}=await ma(this,e,!0,t);if(!r)throw j(`ENOENT`,t);if(Y&&!J(this,r,4))throw j(`EACCES`,t);if(!Nn(r))throw j(`EINVAL`,t);let a=r.size,o=new Uint8Array(a);return await n.read(i,o,0,a),T(o)}async function _a(e,t={}){let n=H(e),{euid:r,egid:i}=Fe(this).credentials,{mode:a=511,recursive:o}=t,s={syscall:`mkdir`,path:n},{fullPath:c}=await ma(this,W(n),!1,s),{fs:l,path:u}=X(U(c,fn(n)),this,s),d=c!=W(n),f,p=async(e,t)=>{let n={stack:[],error:void 0,hasError:!1};try{let c=W(t),m=o&&c!=`/`?await p(W(e),c):await l.stat(c);if(fa(n,await Er(l,c,`rw`,m),!1),o){let n=Tr(l).get(t)?.inode??await l.stat(t).catch(()=>null);if(n){let r=Nn(n)?(await ma(this,e,!1,s)).stats:n;if(!r)throw j(`ENOENT`,s);if(!q(r))throw j(t==u?`EEXIST`:`ENOTDIR`,s);return n}if(d&&await l.exists(U(c,fn(e))))throw j(`ENOTDIR`,`mkdir`,e)}if(Y&&!J(this,m,2))throw j(`EACCES`,`mkdir`,e);let h=await l.mkdir(t,{mode:a,uid:m.mode&2048?m.uid:r,gid:m.mode&1024?m.gid:i}).catch(N({syscall:`mkdir`,path:e}));return o&&(f??=e),da(this,`rename`,e),h}catch(e){n.error=e,n.hasError=!0}finally{pa(n)}};return await p(n,u),f}async function va(e,t={}){e=H(e);let n={syscall:`scandir`,path:e},{fs:r,path:i,stats:a}=await ma(this,e,!1,n);if(!a)throw j(`ENOENT`,n);if(Y&&!J(this,a,4))throw j(`EACCES`,n);if(!q(a))throw j(`ENOTDIR`,n);let o;{let e={stack:[],error:void 0,hasError:!1};try{fa(e,await Er(r,i,`ro`,a),!1),o=await r.readdir(i)}catch(t){e.error=t,e.hasError=!0}finally{pa(e)}}let s=[],c=async e=>{let n=await r.stat(U(i,e)).catch(e=>{if(e.code!=`ENOENT`)throw e});if(!n)return;let a=new hr;if(a.ino=n.ino,a.type=pr(n.mode),a.path=e,a.name=fn(e),s.push(a),!t.recursive||!q(n))return;let o=await r.readdir(U(i,e));for(let t of o)await c(U(e,t))};return await Promise.all(o.map(c)),s}async function ya(e,t){let n={stack:[],error:void 0,hasError:!1};try{e=H(e),t=H(t);let r={syscall:`rename`,path:e,dest:t},i=await ma(this,e,!0,r),a=X(t,this,r);if(i.fs.uuid!==a.fs.uuid)throw j(`EXDEV`,r);if(a.path.startsWith(i.path+`/`))throw j(`EINVAL`,r);if(!i.stats)throw j(`ENOENT`,r);let o=i.fs,s=await o.stat(W(i.path)),c=await o.stat(W(a.path)),l=await o.stat(a.path).catch(e=>{if(e.code==`ENOENT`)return null;throw e});if(Y&&(!J(this,s,4)||!J(this,c,2)))throw j(`EACCES`,r);if(l&&!q(i.stats)&&q(l))throw j(`EISDIR`,r);if(l&&q(i.stats)&&!q(l))throw j(`ENOTDIR`,r);let u=W(i.path),d=W(a.path),f=[[u,s],[d,c]];s.ino>c.ino&&f.reverse(),fa(n,await Er(o,f[0][0],`rw`,f[0][1]),!1),fa(n,s.ino==c.ino?null:await Er(o,f[1][0],`rw`,f[1][1]),!1),await i.fs.rename(i.path,a.path),Tr(o).rename(i.path,a.path),da(this,`rename`,e),da(this,`rename`,t)}catch(e){n.error=e,n.hasError=!0}finally{pa(n)}}async function ba(e,t){let n={stack:[],error:void 0,hasError:!1};try{e=H(e),t=H(t);let r={syscall:`link`,path:e,dest:t},{fs:i,path:a}=X(e,this,r),o=X(t,this,r);if(i.uuid!=o.fs.uuid)throw j(`EXDEV`,r);let s=await i.stat(a);if(Y){if(!J(this,s,4))throw j(`EACCES`,r);let e=await i.stat(W(a));if(!J(this,e,4))throw j(`EACCES`,r);let t=await i.stat(W(o.path));if(!J(this,t,2))throw j(`EACCES`,r)}fa(n,await Er(i,W(o.path),`rw`),!1),await i.link(a,o.path),Tr(i).link(a,o.path)}catch(e){n.error=e,n.hasError=!0}finally{pa(n)}}async function xa(e,t){e=H.call(this,e);let n={syscall:t?`lstat`:`stat`,path:e},r;if(!t)r=(await ma(this,e,!1,n)).stats;else{let{base:t,dir:i}=hn(e),{fs:a,path:o}=await ma(this,i,!1,n),s=t?U(o,t):o;r=Tr(a).get(s)?.inode??await a.stat(s).catch(N(n))}if(!r)throw j(`ENOENT`,n);if(Y&&!J(this,r,4))throw j(`EACCES`,n);return r}var Sa=class extends c.default{input;output;terminal;line=``;_cursor=0;get cursor(){return this._cursor}_buffer=``;_closed=!1;_paused=!1;_prompt=``;_history=[];_historyIndex=-1;_currentLine=``;constructor(e,t,n,r=!1){super(),this.input=e,this.output=t,this.terminal=r,this.input.on(`data`,this._onData),this.input.on(`end`,this.close.bind(this)),this.input.on(`close`,this.close.bind(this))}_onData=e=>{if(!(this._paused||this._closed)){this._buffer+=typeof e==`string`?e:e.toString(`utf8`);for(let e=this._buffer.indexOf(`
|
|
1
|
+
import{i as e,n as t,t as n}from"./rolldown-runtime-Dd_uD5pT.js";function r(e,t){if(e.byteLength>=t)return e;if(ArrayBuffer.isView(e)){let n=r(e.buffer,t);return new e.constructor(n,e.byteOffset,t)}let n=typeof SharedArrayBuffer<`u`&&e instanceof SharedArrayBuffer;if(e.maxByteLength>t)return n?e.grow(t):e.resize(t),e;if(n){let n=new SharedArrayBuffer(t);return new Uint8Array(n).set(new Uint8Array(e)),n}try{return e.transfer(t)}catch{let n=new ArrayBuffer(t);return new Uint8Array(n).set(new Uint8Array(e)),n}}var i=class extends DataView{constructor(e,t,n){let{buffer:r,byteOffset:i,byteLength:a}=new Uint8Array(e,t,n);super(r,i,a)}};for(let e of Object.getOwnPropertyNames(DataView.prototype))!e.startsWith(`get`)&&!e.startsWith(`set`)||Object.defineProperty(i.prototype,e,{value:()=>{throw ReferenceError(`Do not use DataView methods on a BufferView.`)},writable:!1,enumerable:!1,configurable:!1});var a=class{id;_size;options;regions=[];get size(){return this._size}set size(e){if(e>=this._size){this._size=e;return}this._size=e;for(let t=this.regions.length-1;t>=0;t--){let n=this.regions[t];if(n.offset>=e){this.regions.splice(t,1);continue}let r=e-n.offset;n.data.byteLength>r&&(n.data=n.data.subarray(0,r)),n.ranges=n.ranges.filter(t=>t.start<e).map(t=>t.end>e?{start:t.start,end:e}:t)}}constructor(e,t,n,r){this.id=e,this._size=t,this.options=n,n.sparse??=!0,n.sparse||this.regions.push({offset:0,data:new Uint8Array(t),ranges:[]}),r?.set(e,this)}collect(){if(!this.options.sparse)return;let{regionGapThreshold:e=4095}=this.options;for(let t=0;t<this.regions.length-1;){let n=this.regions[t],i=this.regions[t+1];if(i.offset-(n.offset+n.data.byteLength)>e){t++;continue}n.ranges.push(...i.ranges),n.ranges.sort((e,t)=>e.start-t.start),n.ranges=n.ranges.reduce((e,t)=>(!e.length||e.at(-1).end<t.start?e.push(t):e.at(-1).end=Math.max(e.at(-1).end,t.end),e),[]),n.data=r(n.data,i.offset+i.data.byteLength),n.data.set(i.data,i.offset-n.offset),this.regions.splice(t+1,1)}}missing(e,t){let n=[];for(let r of this.regions){if(r.offset>=t)break;for(let i of r.ranges)if(!(i.end<=e)&&(i.start>=t||(i.start>e&&n.push({start:e,end:Math.min(i.start,t)}),i.end>e&&(e=Math.max(e,i.end)),e>=t)))break;if(e>=t)break}return e<t&&n.push({start:e,end:t}),n}cached(e,t){let n=[];for(let r of this.regions){if(r.offset>=t)break;for(let i of r.ranges)if(!(i.end<=e)){if(i.start>=t)break;n.push({start:Math.max(e,i.start),end:Math.min(t,i.end)})}}n.sort((e,t)=>e.start-t.start);let r=[];for(let e of n){let t=r.at(-1);t&&e.start<=t.end?t.end=Math.max(t.end,e.end):r.push(e)}return r}regionAt(e){if(this.regions.length)for(let t of this.regions){if(t.offset>e)break;if(e>=t.offset&&e<t.offset+t.data.byteLength)return t}}add(e,t){let n=t+e.byteLength,i=this.regionAt(t);if(i)return i.data=r(i.data,n),i.data.set(e,t),i.ranges.push({start:t,end:n}),i.ranges.sort((e,t)=>e.start-t.start),this.collect(),this;let a={data:e,offset:t,ranges:[{start:t,end:n}]},o=this.regions.findIndex(e=>e.offset>t);return o==-1?this.regions.push(a):this.regions.splice(o,0,a),this.collect(),this}},o=new Uint32Array(256);for(let e=0;e<256;e++){let t=e;for(let e=0;e<8;e++)t=t&1?2197175160^t>>>1:t>>>1;o[e]=t}function s(e){let t=4294967295;for(let n=0;n<e.length;n++)t=t>>>8^o[(t^e[n])&255];return(t^4294967295)>>>0}var c=e(n(((e,t)=>{var n=Object.prototype.hasOwnProperty,r=`~`;function i(){}Object.create&&(i.prototype=Object.create(null),new i().__proto__||(r=!1));function a(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function o(e,t,n,i,o){if(typeof n!=`function`)throw TypeError(`The listener must be a function`);var s=new a(n,i||e,o),c=r?r+t:t;return e._events[c]?e._events[c].fn?e._events[c]=[e._events[c],s]:e._events[c].push(s):(e._events[c]=s,e._eventsCount++),e}function s(e,t){--e._eventsCount===0?e._events=new i:delete e._events[t]}function c(){this._events=new i,this._eventsCount=0}c.prototype.eventNames=function(){var e=[],t,i;if(this._eventsCount===0)return e;for(i in t=this._events)n.call(t,i)&&e.push(r?i.slice(1):i);return Object.getOwnPropertySymbols?e.concat(Object.getOwnPropertySymbols(t)):e},c.prototype.listeners=function(e){var t=r?r+e:e,n=this._events[t];if(!n)return[];if(n.fn)return[n.fn];for(var i=0,a=n.length,o=Array(a);i<a;i++)o[i]=n[i].fn;return o},c.prototype.listenerCount=function(e){var t=r?r+e:e,n=this._events[t];return n?n.fn?1:n.length:0},c.prototype.emit=function(e,t,n,i,a,o){var s=r?r+e:e;if(!this._events[s])return!1;var c=this._events[s],l=arguments.length,u,d;if(c.fn){switch(c.once&&this.removeListener(e,c.fn,void 0,!0),l){case 1:return c.fn.call(c.context),!0;case 2:return c.fn.call(c.context,t),!0;case 3:return c.fn.call(c.context,t,n),!0;case 4:return c.fn.call(c.context,t,n,i),!0;case 5:return c.fn.call(c.context,t,n,i,a),!0;case 6:return c.fn.call(c.context,t,n,i,a,o),!0}for(d=1,u=Array(l-1);d<l;d++)u[d-1]=arguments[d];c.fn.apply(c.context,u)}else{var f=c.length,p;for(d=0;d<f;d++)switch(c[d].once&&this.removeListener(e,c[d].fn,void 0,!0),l){case 1:c[d].fn.call(c[d].context);break;case 2:c[d].fn.call(c[d].context,t);break;case 3:c[d].fn.call(c[d].context,t,n);break;case 4:c[d].fn.call(c[d].context,t,n,i);break;default:if(!u)for(p=1,u=Array(l-1);p<l;p++)u[p-1]=arguments[p];c[d].fn.apply(c[d].context,u)}}return!0},c.prototype.on=function(e,t,n){return o(this,e,t,n,!1)},c.prototype.once=function(e,t,n){return o(this,e,t,n,!0)},c.prototype.removeListener=function(e,t,n,i){var a=r?r+e:e;if(!this._events[a])return this;if(!t)return s(this,a),this;var o=this._events[a];if(o.fn)o.fn===t&&(!i||o.once)&&(!n||o.context===n)&&s(this,a);else{for(var c=0,l=[],u=o.length;c<u;c++)(o[c].fn!==t||i&&!o[c].once||n&&o[c].context!==n)&&l.push(o[c]);l.length?this._events[a]=l.length===1?l[0]:l:s(this,a)}return this},c.prototype.removeAllListeners=function(e){var t;return e?(t=r?r+e:e,this._events[t]&&s(this,t)):(this._events=new i,this._eventsCount=0),this},c.prototype.off=c.prototype.removeListener,c.prototype.addListener=c.prototype.on,c.prefixed=r,c.EventEmitter=c,t!==void 0&&(t.exports=c)}))(),1),l=class extends c.default{[Symbol.toStringTag]=`List`;constructor(e){super(),e&&this.push(...e)}data=new Set;toSet(){return new Set(this.data)}toArray(){return Array.from(this.data)}toJSON(){return Array.from(this.data)}toString(){return this.join(`,`)}_set(e,t,n=!1){if(Math.abs(e)>this.data.size)throw ReferenceError(`Can not set an element outside the bounds of the list`);let r=Array.from(this.data);r.splice(e,+n,t),this.data=new Set(r),this.emit(`update`)}set(e,t){this._set(e,t,!0)}deleteAt(e){if(Math.abs(e)>this.data.size)throw ReferenceError(`Can not delete an element outside the bounds of the list`);this.delete(Array.from(this.data).at(e))}insert(e,t=this.data.size){this._set(t,e,!1)}at(e){if(Math.abs(e)>this.data.size)throw ReferenceError(`Can not access an element outside the bounds of the list`);return Array.from(this.data).at(e)}pop(){let e=Array.from(this.data).pop();return e!==void 0&&this.delete(e),e}push(...e){for(let t of e)this.add(t);return this.data.size}join(e){return Array.from(this.data).join(e)}splice(e,t,...n){if(Math.abs(e)>this.data.size)throw ReferenceError(`Can not splice elements outside the bounds of the list`);let r=Array.from(this.data),i=r.splice(e,t,...n);return this.data=new Set(r),this.emit(`update`),i}add(e){return this.data.add(e),this.emit(`update`),this.emit(`add`,e),this}clear(){this.data.clear(),this.emit(`update`)}delete(e){let t=this.data.delete(e);return this.emit(`update`),t}has(e){return this.data.has(e)}get size(){return this.data.size}entries(){return this.toArray().entries()}keys(){return this.toArray().keys()}values(){return this.data.values()}[Symbol.iterator](){return this.data[Symbol.iterator]()}};function u(e,t){let n=Object.entries(e);return Object.fromEntries(n.filter(([e,n])=>t(e,n)))}function d(e,...t){let n={};for(let r of t.flat())n[r]=e[r];return n}function f(e,...t){return u(e,e=>!t.flat().includes(e))}function p(e){try{return JSON.parse(e),!0}catch{return!1}}function m(e){let t=[];for(let n=e;n&&![`Function`,`Object`].includes(n.constructor.name);n=Object.getPrototypeOf(n))t.push(n.constructor.name);return t}function h(e,t){return Object.fromEntries(Object.entries(e).map(([e,n])=>[e,typeof n==`function`?n.bind(t):n]))}function g(e=Error()){let t=setTimeout(()=>{throw e},5e3);return()=>clearTimeout(t)}function _(e){throw e&&typeof e==`object`&&m(e).includes(`Error`)&&Error?.captureStackTrace(e,_),e}function v(e,t){if(![`getter`,`accessor`].includes(t.kind))throw Error(`@memoize can only be used on getters and auto-accessors`);let n=new WeakMap;function r(){if(n.has(this))return n.get(this);let t=typeof e==`function`?e.call(this):e.get.call(this);return n.set(this,t),t}switch(t.kind){case`getter`:return r;case`accessor`:return{...e,get:r}}}var y=Intl.NumberFormat(`en`,{notation:`compact`});y.format.bind(y);function b(e=0,t=1){return Math.round(Math.random()*(t-e)+e)}function x(e){return e.at(0).toUpperCase()+e.slice(1)}var S=new TextEncoder;function C(e){return S.encode(e)}var w=new TextDecoder;function T(e){if(!e)return``;if(e.buffer instanceof ArrayBuffer&&!e.buffer.resizable)return w.decode(e);let t=new Uint8Array(e.byteLength);return t.set(e),w.decode(t)}function ee(e){let t=new Uint8Array(e.length);for(let n=0;n<e.length;n++)t[n]=e.charCodeAt(n);return t}function E(e){let t=``;for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return t}function te(e){let t=Array.from(e).map(e=>e.toString(16).padStart(2,`0`)).join(``);return`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16,20)}-${t.slice(20)}`}function D(e){let t=e.replace(/-/g,``),n=new Uint8Array(16);for(let e=0;e<16;e++)n[e]=parseInt(t.slice(e*2,e*2+2),16);return n}var O;(function(e){e[e.EPERM=1]=`EPERM`,e[e.ENOENT=2]=`ENOENT`,e[e.ESRCH=3]=`ESRCH`,e[e.EINTR=4]=`EINTR`,e[e.EIO=5]=`EIO`,e[e.ENXIO=6]=`ENXIO`,e[e.E2BIG=7]=`E2BIG`,e[e.ENOEXEC=8]=`ENOEXEC`,e[e.EBADF=9]=`EBADF`,e[e.ECHILD=10]=`ECHILD`,e[e.EAGAIN=11]=`EAGAIN`,e[e.ENOMEM=12]=`ENOMEM`,e[e.EACCES=13]=`EACCES`,e[e.EFAULT=14]=`EFAULT`,e[e.ENOTBLK=15]=`ENOTBLK`,e[e.EBUSY=16]=`EBUSY`,e[e.EEXIST=17]=`EEXIST`,e[e.EXDEV=18]=`EXDEV`,e[e.ENODEV=19]=`ENODEV`,e[e.ENOTDIR=20]=`ENOTDIR`,e[e.EISDIR=21]=`EISDIR`,e[e.EINVAL=22]=`EINVAL`,e[e.ENFILE=23]=`ENFILE`,e[e.EMFILE=24]=`EMFILE`,e[e.ETXTBSY=26]=`ETXTBSY`,e[e.EFBIG=27]=`EFBIG`,e[e.ENOSPC=28]=`ENOSPC`,e[e.ESPIPE=29]=`ESPIPE`,e[e.EROFS=30]=`EROFS`,e[e.EMLINK=31]=`EMLINK`,e[e.EPIPE=32]=`EPIPE`,e[e.EDOM=33]=`EDOM`,e[e.ERANGE=34]=`ERANGE`,e[e.EDEADLK=35]=`EDEADLK`,e[e.ENAMETOOLONG=36]=`ENAMETOOLONG`,e[e.ENOLCK=37]=`ENOLCK`,e[e.ENOSYS=38]=`ENOSYS`,e[e.ENOTEMPTY=39]=`ENOTEMPTY`,e[e.ELOOP=40]=`ELOOP`,e[e.ENOMSG=42]=`ENOMSG`,e[e.EIDRM=43]=`EIDRM`,e[e.ECHRNG=44]=`ECHRNG`,e[e.EL2NSYNC=45]=`EL2NSYNC`,e[e.EL3HLT=46]=`EL3HLT`,e[e.EL3RST=47]=`EL3RST`,e[e.ENRNG=48]=`ENRNG`,e[e.EUNATCH=49]=`EUNATCH`,e[e.ECSI=50]=`ECSI`,e[e.EL2HLT=51]=`EL2HLT`,e[e.EBADE=52]=`EBADE`,e[e.EBADR=53]=`EBADR`,e[e.EXFULL=54]=`EXFULL`,e[e.ENOANO=55]=`ENOANO`,e[e.EBADRQC=56]=`EBADRQC`,e[e.EBADSLT=57]=`EBADSLT`,e[e.EBFONT=59]=`EBFONT`,e[e.ENOSTR=60]=`ENOSTR`,e[e.ENODATA=61]=`ENODATA`,e[e.ETIME=62]=`ETIME`,e[e.ENOSR=63]=`ENOSR`,e[e.ENONET=64]=`ENONET`,e[e.ENOPKG=65]=`ENOPKG`,e[e.EREMOTE=66]=`EREMOTE`,e[e.ENOLINK=67]=`ENOLINK`,e[e.EADV=68]=`EADV`,e[e.ESRMNT=69]=`ESRMNT`,e[e.ECOMM=70]=`ECOMM`,e[e.EPROTO=71]=`EPROTO`,e[e.EMULTIHOP=72]=`EMULTIHOP`,e[e.EDOTDOT=73]=`EDOTDOT`,e[e.EBADMSG=74]=`EBADMSG`,e[e.EOVERFLOW=75]=`EOVERFLOW`,e[e.ENOTUNIQ=76]=`ENOTUNIQ`,e[e.EBADFD=77]=`EBADFD`,e[e.EREMCHG=78]=`EREMCHG`,e[e.ELIBACC=79]=`ELIBACC`,e[e.ELIBBAD=80]=`ELIBBAD`,e[e.ELIBSCN=81]=`ELIBSCN`,e[e.ELIBMAX=82]=`ELIBMAX`,e[e.ELIBEXEC=83]=`ELIBEXEC`,e[e.EILSEQ=84]=`EILSEQ`,e[e.ERESTART=85]=`ERESTART`,e[e.ESTRPIPE=86]=`ESTRPIPE`,e[e.EUSERS=87]=`EUSERS`,e[e.ENOTSOCK=88]=`ENOTSOCK`,e[e.EDESTADDRREQ=89]=`EDESTADDRREQ`,e[e.EMSGSIZE=90]=`EMSGSIZE`,e[e.EPROTOTYPE=91]=`EPROTOTYPE`,e[e.ENOPROTOOPT=92]=`ENOPROTOOPT`,e[e.EPROTONOSUPPORT=93]=`EPROTONOSUPPORT`,e[e.ESOCKTNOSUPPORT=94]=`ESOCKTNOSUPPORT`,e[e.ENOTSUP=95]=`ENOTSUP`,e[e.EPFNOSUPPORT=96]=`EPFNOSUPPORT`,e[e.EAFNOSUPPORT=97]=`EAFNOSUPPORT`,e[e.EADDRINUSE=98]=`EADDRINUSE`,e[e.EADDRNOTAVAIL=99]=`EADDRNOTAVAIL`,e[e.ENETDOWN=100]=`ENETDOWN`,e[e.ENETUNREACH=101]=`ENETUNREACH`,e[e.ENETRESET=102]=`ENETRESET`,e[e.ECONNABORTED=103]=`ECONNABORTED`,e[e.ECONNRESET=104]=`ECONNRESET`,e[e.ENOBUFS=105]=`ENOBUFS`,e[e.EISCONN=106]=`EISCONN`,e[e.ENOTCONN=107]=`ENOTCONN`,e[e.ESHUTDOWN=108]=`ESHUTDOWN`,e[e.ETOOMANYREFS=109]=`ETOOMANYREFS`,e[e.ETIMEDOUT=110]=`ETIMEDOUT`,e[e.ECONNREFUSED=111]=`ECONNREFUSED`,e[e.EHOSTDOWN=112]=`EHOSTDOWN`,e[e.EHOSTUNREACH=113]=`EHOSTUNREACH`,e[e.EALREADY=114]=`EALREADY`,e[e.EINPROGRESS=115]=`EINPROGRESS`,e[e.ESTALE=116]=`ESTALE`,e[e.EEUCLEAN=117]=`EEUCLEAN`,e[e.ENOTNAM=118]=`ENOTNAM`,e[e.ENAVAIL=119]=`ENAVAIL`,e[e.EISNAM=120]=`EISNAM`,e[e.EREMOTEIO=121]=`EREMOTEIO`,e[e.EDQUOT=122]=`EDQUOT`,e[e.ENOMEDIUM=123]=`ENOMEDIUM`,e[e.EMEDIUMTYPE=124]=`EMEDIUMTYPE`,e[e.ECANCELED=125]=`ECANCELED`,e[e.ENOKEY=126]=`ENOKEY`,e[e.EKEYEXPIRED=127]=`EKEYEXPIRED`,e[e.EKEYREVOKED=128]=`EKEYREVOKED`,e[e.EKEYREJECTED=129]=`EKEYREJECTED`,e[e.EOWNERDEAD=130]=`EOWNERDEAD`,e[e.ENOTRECOVERABLE=131]=`ENOTRECOVERABLE`,e[e.ERFKILL=132]=`ERFKILL`,e[e.EHWPOISON=133]=`EHWPOISON`})(O||={});var ne={[O.EPERM]:`operation not permitted`,[O.ENOENT]:`no such file or directory`,[O.ESRCH]:`no such process`,[O.EINTR]:`interrupted system call`,[O.EIO]:`i/o error`,[O.ENXIO]:`no such device or address`,[O.E2BIG]:`argument list too long`,[O.ENOEXEC]:`exec format error`,[O.EBADF]:`bad file descriptor`,[O.ECHILD]:`no child processes`,[O.EAGAIN]:`resource temporarily unavailable`,[O.ENOMEM]:`not enough memory`,[O.EACCES]:`permission denied`,[O.EFAULT]:`bad address in system call argument`,[O.ENOTBLK]:`block device required`,[O.EBUSY]:`resource busy or locked`,[O.EEXIST]:`file already exists`,[O.EXDEV]:`cross-device link not permitted`,[O.ENODEV]:`no such device`,[O.ENOTDIR]:`not a directory`,[O.EISDIR]:`illegal operation on a directory`,[O.EINVAL]:`invalid argument`,[O.ENFILE]:`file table overflow`,[O.EMFILE]:`too many open files`,[O.ETXTBSY]:`text file is busy`,[O.EFBIG]:`file too large`,[O.ENOSPC]:`no space left on device`,[O.ESPIPE]:`invalid seek`,[O.EROFS]:`read-only file system`,[O.EMLINK]:`too many links`,[O.EPIPE]:`broken pipe`,[O.EDOM]:`numerical argument out of domain`,[O.ERANGE]:`result too large`,[O.EDEADLK]:`resource deadlock would occur`,[O.ENAMETOOLONG]:`name too long`,[O.ENOLCK]:`no locks available`,[O.ENOSYS]:`function not implemented`,[O.ENOTEMPTY]:`directory not empty`,[O.ELOOP]:`too many symbolic links encountered`,[O.ENOMSG]:`no message of desired type`,[O.EIDRM]:`identifier removed`,[O.ECHRNG]:`channel number out of range`,[O.EL2NSYNC]:`level 2 not synchronized`,[O.EL3HLT]:`level 3 halted`,[O.EL3RST]:`level 3 reset`,[O.ENRNG]:`link number out of range`,[O.EUNATCH]:`protocol driver not attached`,[O.ECSI]:`no CSI structure available`,[O.EL2HLT]:`level 2 halted`,[O.EBADE]:`invalid exchange`,[O.EBADR]:`invalid request descriptor`,[O.EXFULL]:`exchange full`,[O.ENOANO]:`no anode`,[O.EBADRQC]:`invalid request code`,[O.EBADSLT]:`invalid slot`,[O.EBFONT]:`bad font file format`,[O.ENOSTR]:`device not a stream`,[O.ENODATA]:`no data available`,[O.ETIME]:`timer expired`,[O.ENOSR]:`out of streams resources`,[O.ENONET]:`machine is not on the network`,[O.ENOPKG]:`package not installed`,[O.EREMOTE]:`object is remote`,[O.ENOLINK]:`link has been severed`,[O.EADV]:`advertise error`,[O.ESRMNT]:`srmount error`,[O.ECOMM]:`communication error on send`,[O.EPROTO]:`protocol error`,[O.EMULTIHOP]:`multihop attempted`,[O.EDOTDOT]:`rFS specific error`,[O.EBADMSG]:`bad message`,[O.EOVERFLOW]:`value too large for defined data type`,[O.ENOTUNIQ]:`name not unique on network`,[O.EBADFD]:`file descriptor in bad state`,[O.EREMCHG]:`remote address changed`,[O.ELIBACC]:`can not access a needed shared library`,[O.ELIBBAD]:`accessing a corrupted shared library`,[O.ELIBSCN]:`.lib section in a.out corrupted`,[O.ELIBMAX]:`attempting to link in too many shared libraries`,[O.ELIBEXEC]:`cannot exec a shared library directly`,[O.EILSEQ]:`illegal byte sequence`,[O.ERESTART]:`interrupted system call should be restarted`,[O.ESTRPIPE]:`streams pipe error`,[O.EUSERS]:`too many users`,[O.ENOTSOCK]:`socket operation on non-socket`,[O.EDESTADDRREQ]:`destination address required`,[O.EMSGSIZE]:`message too long`,[O.EPROTOTYPE]:`protocol wrong type for socket`,[O.ENOPROTOOPT]:`protocol not available`,[O.EPROTONOSUPPORT]:`protocol not supported`,[O.ESOCKTNOSUPPORT]:`socket type not supported`,[O.ENOTSUP]:`operation not supported on socket`,[O.EPFNOSUPPORT]:`protocol family not supported`,[O.EAFNOSUPPORT]:`address family not supported`,[O.EADDRINUSE]:`address already in use`,[O.EADDRNOTAVAIL]:`address not available`,[O.ENETDOWN]:`network is down`,[O.ENETUNREACH]:`network is unreachable`,[O.ENETRESET]:`network dropped connection on reset`,[O.ECONNABORTED]:`software caused connection abort`,[O.ECONNRESET]:`connection reset by peer`,[O.ENOBUFS]:`no buffer space available`,[O.EISCONN]:`socket is already connected`,[O.ENOTCONN]:`socket is not connected`,[O.ESHUTDOWN]:`cannot send after transport endpoint shutdown`,[O.ETOOMANYREFS]:`too many references: cannot splice`,[O.ETIMEDOUT]:`connection timed out`,[O.ECONNREFUSED]:`connection refused`,[O.EHOSTDOWN]:`host is down`,[O.EHOSTUNREACH]:`host is unreachable`,[O.EALREADY]:`connection already in progress`,[O.EINPROGRESS]:`operation now in progress`,[O.ESTALE]:`stale file handle`,[O.EEUCLEAN]:`structure needs cleaning`,[O.ENOTNAM]:`not a XENIX named type file`,[O.ENAVAIL]:`no XENIX semaphores available`,[O.EISNAM]:`is a named type file`,[O.EREMOTEIO]:`remote I/O error`,[O.EDQUOT]:`disk quota exceeded`,[O.ENOMEDIUM]:`no medium found`,[O.EMEDIUMTYPE]:`wrong medium type`,[O.ECANCELED]:`operation canceled`,[O.ENOKEY]:`required key not available`,[O.EKEYEXPIRED]:`key has expired`,[O.EKEYREVOKED]:`key has been revoked`,[O.EKEYREJECTED]:`key was rejected by service`,[O.EOWNERDEAD]:`owner died`,[O.ENOTRECOVERABLE]:`state not recoverable`,[O.ERFKILL]:`operation not possible due to RF-kill`,[O.EHWPOISON]:`memory page has hardware error`};function k(e){let t=`${e.code}: ${ne[e.errno]}, ${e.syscall}`;e.path&&(t+=` '${e.path}'`),e.dest&&(t+=` -> '${e.dest}'`);let n=e.message.startsWith(ne[e.errno])||/^E[A-Z0-9]+: /.test(e.message);return e.message&&!n&&(t+=` (${e.message})`),e.message=t,e}var A=class e extends Error{errno;code;path;dest;syscall;constructor(e,t,n={}){let r=O[e];super(t||``),this.errno=e,this.code=r,Object.assign(this,f(n,`message`)),t||k(this),Error.captureStackTrace?.(this,this.constructor)}toString(){return this.message}toJSON(){let e={errno:this.errno,code:this.code,stack:this.stack,message:this.message};return this.path&&(e.path=this.path),this.dest&&(e.dest=this.dest),this.syscall&&(e.syscall=this.syscall),e}static fromJSON(t){let n=t.syscall?new e(t.errno,!1,t):new e(t.errno,t.message);return n.stack=t.stack,n}};function j(e,t,n,r){typeof t==`string`&&(t={syscall:t,path:n,dest:r});let i=new A(O[e],!1,t??{});return Error.captureStackTrace?.(i,j),i}function M(e,t){let n=new A(O[e],t??ne[O[e]]);return Error.captureStackTrace?.(n,M),n}function N(e,t,n){let r=typeof e==`string`?{syscall:e}:e;return t&&(r.path=t),n&&(r.dest=n),function(e){throw Object.assign(e,r),k(e),e}}var P=t({Level:()=>F,alert:()=>le,configure:()=>Te,crit:()=>ue,debug:()=>pe,deprecated:()=>me,emerg:()=>ce,entries:()=>ae,err:()=>I,fancy:()=>ye,format:()=>be,info:()=>fe,isEnabled:()=>we,levelOf:()=>ie,levels:()=>re,log:()=>oe,notice:()=>de,warn:()=>L}),F;(function(e){e[e.EMERG=0]=`EMERG`,e[e.ALERT=1]=`ALERT`,e[e.CRIT=2]=`CRIT`,e[e.ERR=3]=`ERR`,e[e.WARN=4]=`WARN`,e[e.NOTICE=5]=`NOTICE`,e[e.INFO=6]=`INFO`,e[e.DEBUG=7]=`DEBUG`})(F||={});var re=[`emergency`,`alert`,`critical`,`error`,`warning`,`notice`,`info`,`debug`];function ie(e){return re.indexOf(e)}var ae=new l;function oe(e,t){if(!we)return;let n={level:e,message:t,timestamp:new Date,elapsedMs:performance.now()};ae.add(n),xe(n)}function se(e){return function(t){return oe(e,t.toString()),t}}var ce=se(F.EMERG),le=se(F.ALERT),ue=se(F.CRIT),I=se(F.ERR),L=se(F.WARN),de=se(F.NOTICE),fe=se(F.INFO),pe=se(F.DEBUG);function me(e){oe(F.WARN,e+` is deprecated and should not be used.`)}function he(e,t){return`\x1b[${t}m${e}\x1b[0m`}function ge(e){return`[`+(e.elapsedMs/1e3).toFixed(3).padStart(10)+`] `}var _e={ansi:{[F.EMERG]:`1;4;37;41`,[F.ALERT]:`1;37;41`,[F.CRIT]:`1;35`,[F.ERR]:`1;31`,[F.WARN]:`1;33`,[F.NOTICE]:`1;36`,[F.INFO]:`1;37`,[F.DEBUG]:`0;2;37`},css:{[F.EMERG]:`font-weight: bold; text-decoration: underline; color: white; background-color: red;`,[F.ALERT]:`font-weight: bold; color: white; background-color: red;`,[F.CRIT]:`font-weight: bold; color: magenta;`,[F.ERR]:`font-weight: bold; color: red;`,[F.WARN]:`font-weight: bold; color: yellow;`,[F.NOTICE]:`font-weight: bold; color: cyan;`,[F.INFO]:`font-weight: bold; color: white;`,[F.DEBUG]:`opacity: 0.8; color: white;`}},ve={ansi:{[F.EMERG]:`1;31`,[F.ALERT]:`1;31`,[F.CRIT]:`1;31`,[F.ERR]:`31`,[F.WARN]:`33`,[F.NOTICE]:`1;37`,[F.INFO]:`37`,[F.DEBUG]:`2;37`},css:{[F.EMERG]:`font-weight: bold; color: red;`,[F.ALERT]:`font-weight: bold; color: red;`,[F.CRIT]:`font-weight: bold; color: red;`,[F.ERR]:`color: red;`,[F.WARN]:`color: yellow;`,[F.NOTICE]:`font-weight: bold; color: white;`,[F.INFO]:`color: white;`,[F.DEBUG]:`opacity: 0.8; color: white;`}};function ye({style:e,colorize:t}){return function*(n){e==`css`&&(yield t==`level`?`%c%s %c%s`:`%c%s %c%s%s %c%s`),yield*e==`ansi`?[he(ge(n),`2;37`)]:[`opacity: 0.8; color: white;`,ge(n)];let r=e==`ansi`?[he(re[n.level].toUpperCase(),_e.ansi[n.level])]:[_e.css[n.level],re[n.level].toUpperCase()];if(t==`level`){yield*r,yield n.message;return}n.level<F.CRIT&&(yield*r),e==`ansi`?yield he(n.message,ve.ansi[n.level]):yield*[ve.css[n.level],n.message]}}var R=e=>[ge(e),e.message];function be(e){let t=R(e);return typeof t==`string`?[t]:Array.from(t)}var z=console.error;function xe(e){e.level>Se||z(...be(e))}var Se=F.ALERT,Ce=!1,we=!0;function Te(e){if(R=e.format??R,z=e.output??z,Se=typeof e.level==`string`?ie(e.level):e.level??Se,we=e.enabled??we,Ce=e.stack??Ce,e.dumpBacklog)for(let e of ae)xe(e)}function Ee(e){return typeof e==`object`&&!!e&&`create`in e&&typeof e.create==`function`}function De(e,t){return Object.defineProperty(t,"prototype",{value:void 0}),e&&Object.defineProperty(t,"name",{value:e}),t}function Oe(e){return!(e&&e.constructor===Function)||e.prototype===void 0?!1:Function.prototype!==Object.getPrototypeOf(e)||Object.getOwnPropertyNames(e.prototype).length>1}function ke(e,t){if(typeof t!=`object`||!t)throw I(M(`EINVAL`,`Invalid options`));for(let[n,r]of Object.entries(e.options)){let e=t?.[n];if(e==null){if(!r.required){pe(`Using default for option: `+n);continue}throw I(M(`EINVAL`,`Missing required option: `+n))}let i=(t,n=e)=>typeof t==`function`?Oe(t)?e instanceof t:t(e):typeof e===t||e?.constructor?.name===t;if(Array.isArray(r.type)?r.type.some(e=>i(e)):i(r.type))continue;let a=typeof e==`object`&&`constructor`in e?e.constructor.name:typeof e,o=e=>typeof e==`function`?e.name==`type`?e.toString():e.name:e;throw I(M(`EINVAL`,`Incorrect type for "${n}": ${a} (expected ${Array.isArray(r.type)?`one of ${r.type.map(o).join(`, `)}`:o(r.type)})`))}}function Ae(e){return typeof e==`object`&&!!e&&`backend`in e&&Ee(e.backend)}function je(e){return{suid:e.uid,sgid:e.gid,euid:e.uid,egid:e.gid,groups:[],...e}}function Me(e){return e?!e.uid||!e.gid||!e.euid||!e.egid||e.groups.some(e=>!e):!1}var Ne=Symbol(`ZenFSContext`),Pe={[Ne]:!0,id:0,root:`/`,pwd:`/`,credentials:je({uid:0,gid:0}),descriptors:new Map,parent:null,children:[]};function Fe(e){return typeof e==`object`&&e&&Ne in e?e:Pe}var Ie=1;function Le(e,t={}){let{root:n=e.root,pwd:r=e.pwd,credentials:i=structuredClone(e.credentials)}=t,a={[Ne]:!0,id:Ie++,root:n,pwd:r,credentials:je(i),descriptors:new Map,parent:e,children:[]};return Object.defineProperties(a,{id:{configurable:!1,writable:!1},credentials:{configurable:!1,writable:!1},descriptors:{configurable:!1,writable:!1},parent:{configurable:!1,writable:!1},children:{configurable:!1,writable:!1}}),a}var Re=t({COPYFILE_EXCL:()=>1,COPYFILE_FICLONE:()=>2,COPYFILE_FICLONE_FORCE:()=>4,F_OK:()=>0,O_APPEND:()=>ze,O_CREAT:()=>64,O_DIRECT:()=>Ke,O_DIRECTORY:()=>Be,O_DSYNC:()=>We,O_EXCL:()=>128,O_NOATIME:()=>Ve,O_NOCTTY:()=>256,O_NOFOLLOW:()=>He,O_NONBLOCK:()=>qe,O_RDONLY:()=>0,O_RDWR:()=>2,O_SYMLINK:()=>Ge,O_SYNC:()=>Ue,O_TRUNC:()=>512,O_WRONLY:()=>1,R_OK:()=>4,S_IFBLK:()=>Qe,S_IFCHR:()=>et,S_IFDIR:()=>$e,S_IFIFO:()=>tt,S_IFLNK:()=>Xe,S_IFMT:()=>Je,S_IFREG:()=>Ze,S_IFSOCK:()=>Ye,S_IRGRP:()=>32,S_IROTH:()=>4,S_IRUSR:()=>256,S_IRWXG:()=>56,S_IRWXO:()=>7,S_IRWXU:()=>448,S_ISGID:()=>rt,S_ISUID:()=>nt,S_ISVTX:()=>512,S_IWGRP:()=>16,S_IWOTH:()=>2,S_IWUSR:()=>128,S_IXGRP:()=>8,S_IXOTH:()=>1,S_IXUSR:()=>64,UV_FS_O_FILEMAP:()=>0,W_OK:()=>2,X_OK:()=>1,size_max:()=>it}),ze=1024,Be=65536,Ve=262144,He=131072,Ue=1052672,We=4096,Ge=32768,Ke=16384,qe=2048,Je=61440,Ye=49152,Xe=40960,Ze=32768,Qe=24576,$e=16384,et=8192,tt=4096,nt=2048,rt=1024,it=4294967295;function at(e){return`__isArrayType`in e&&e.__isArrayType===!0}function ot(e){return typeof e!=`object`&&typeof e!=`function`||e==null?!1:at(e)?ot(e.type):`name`in e&&`size`in e&&`get`in e&&`set`in e&&typeof e.name==`string`&&typeof e.size==`number`&&typeof e.get==`function`&&typeof e.set==`function`&&st.has(e.name)&&st.get(e.name)?.name===e.name}var st=new Map;function ct(e){if(st.has(e.name))throw ReferenceError(`Type is already registered: ${e.name}`);st.set(e.name,e)}var lt=Symbol(`DataView`);function ut(e){return e[lt]??=new DataView(e),e[lt]}var dt={name:`int8`,size:1,array:Int8Array,get:(e,t)=>ut(e).getInt8(t),set:(e,t,n)=>ut(e).setInt8(t,n)},ft={name:`uint8`,size:1,array:Uint8Array,get:(e,t)=>ut(e).getUint8(t),set:(e,t,n)=>ut(e).setUint8(t,n)},pt={int8:dt,uint8:ft,int16:{name:`int16`,size:2,array:Int16Array,get:(e,t)=>ut(e).getInt16(t,!0),set:(e,t,n)=>ut(e).setInt16(t,n,!0)},uint16:{name:`uint16`,size:2,array:Uint16Array,get:(e,t)=>ut(e).getUint16(t,!0),set:(e,t,n)=>ut(e).setUint16(t,n,!0)},int32:{name:`int32`,size:4,array:Int32Array,get:(e,t)=>ut(e).getInt32(t,!0),set:(e,t,n)=>ut(e).setInt32(t,n,!0)},uint32:{name:`uint32`,size:4,array:Uint32Array,get:(e,t)=>ut(e).getUint32(t,!0),set:(e,t,n)=>ut(e).setUint32(t,n,!0)},int64:{name:`int64`,size:8,array:BigInt64Array,get:(e,t)=>ut(e).getBigInt64(t,!0),set:(e,t,n)=>ut(e).setBigInt64(t,n,!0)},uint64:{name:`uint64`,size:8,array:BigUint64Array,get:(e,t)=>ut(e).getBigUint64(t,!0),set:(e,t,n)=>ut(e).setBigUint64(t,n,!0)},float32:{name:`float32`,size:4,array:Float32Array,get:(e,t)=>ut(e).getFloat32(t,!0),set:(e,t,n)=>ut(e).setFloat32(t,n,!0)},float64:{name:`float64`,size:8,array:Float64Array,get:(e,t)=>ut(e).getFloat64(t,!0),set:(e,t,n)=>ut(e).setFloat64(t,n,!0)}},mt=Object.keys(pt);for(let e of Object.values(pt))ct(e);var ht={...pt,...Object.fromEntries(mt.map(e=>[x(e),pt[e]])),char:ft},gt=Object.keys(ht);function _t(e){return gt.includes(e.toString())}function vt(e){if(!_t(e))throw M(`EINVAL`,`Not a valid primitive type: `+e)}function yt(e){return e==`char`?`uint8`:e.toLowerCase()}function bt(e){return(typeof e==`object`||typeof e==`function`)&&e!==null&&`toInit`in e&&typeof e.toInit==`function`}function xt(e){return bt(e)?e.toInit():ot(e)?{type:e}:e}function St(e,t,n={}){if(!e)throw M(`EINVAL`,`Invalid name for struct field`);typeof e==`symbol`&&console.warn(`Symbol used for struct field name will be coerced to string: `+e.toString());let r=e.toString(),i=Object.assign(xt(t),n);if(!ot(i.type))throw M(`EINVAL`,`Invalid type for struct field "${r}"`);let a=i.countedBy?` counted_by(${typeof i.countedBy==`string`?i.countedBy:`<function>`})`:``;return{name:r,offset:0,type:i.type,countedBy:i.countedBy,alignment:i.align??i.type.size,decl:i.type instanceof Rt?`${i.typeName??i.type.type.name} ${r}[${i.type.length}]${a}`:`${i.typeName??i.type.name} ${r}`,littleEndian:!i.bigEndian}}function Ct(e,t){if(!(e instanceof Error)||e.message.toLowerCase()!==`offset is outside the bounds of the dataview`)throw e;let n=M(`EFAULT`,`Segmentation fault (at 0x${t.toString(16)})`);throw Error.captureStackTrace(n,Ct),n}function wt(e,t){return t.type instanceof Rt&&t.type.length==0&&!!t.countedBy?.length&&!!e.constructor.isDynamic}function Tt(e,t){let n=typeof t.countedBy==`function`?t.countedBy(e):e[t.countedBy];if(typeof n==`bigint`){if(n>BigInt(2**53-1))throw M(`EOVERFLOW`,`countedBy field value exceeds max safe integer`);n=Number(n)}if(typeof n!=`number`)throw M(`EINVAL`,`countedBy field value is not a number`);return n}function Et(e,t){let n=t.type.type.size*Tt(e,t);if(Mt(t.type.type)&&t.type.type.isDynamic)for(let r of e[t.name])n+=Nt(r);return n}var Dt=Symbol(`kOffsets`);function Ot(e,t,n){let{offset:r,name:i}=t;e[Dt]||=Object.create(null);let a=e[Dt];if(a[i]!==void 0){if(n)return a[i];delete a[i]}let{fields:o}=e.constructor,s=o.indexOf(t);for(let t of o.slice(0,s)){wt(e,t)&&(r+=Et(e,t));let n=e[t.name];jt(n)&&n.constructor.isDynamic&&(r+=Nt(n))}if(n)a[i]=r;else for(let e of o.slice(s))a[e.name]!==void 0&&delete a[e.name];return r}function kt(e,t,n,r){typeof n==`string`&&(n=n.charCodeAt(0));let i=e.byteOffset+Ot(e,t,!1)+(r??0)*t.type.size;try{t.type.set(e.buffer,i,n);return}catch(e){Ct(e,i)}}function At(e,t){let n=t.type;if(wt(e,t)){let r=t.type.type;n=new Rt(r,Tt(e,t))}let r=e.byteOffset+Ot(e,t,!0);try{return n.get(e.buffer,r)}catch(e){Ct(e,r)}}function jt(e){return typeof e==`object`&&!!e&&`constructor`in e&&Mt(e.constructor)}function Mt(e){return typeof e==`function`&&`prototype`in e&&`fields`in e&&typeof e.fields==`object`&&ot(e)}function Nt(e){let t=0;for(let n of e.constructor.fields){let r=e[n.name];wt(e,n)&&(t+=Et(e,n)),jt(r)&&r.constructor.isDynamic&&(t+=Nt(r))}return t}function Pt(e){if(ot(e))return e.size;if(e==null)return 0;if(typeof e==`object`&&ot(e.constructor))return e.constructor.size;if(Array.isArray(e)){let t=0;for(let n=0;n<e.length;n++)t+=Pt(e[n]);return t}if(typeof e==`string`)return vt(e),pt[yt(e)].size;throw TypeError(`Unable to resolve size of \`${e.toString()}\``)}function B(e){let t=Pt(e);return jt(e)&&e.constructor.isDynamic?t+Nt(e):t}function Ft(e,t){let n;if(Mt(e)){if(e.isDynamic)throw M(`EINVAL`,`Cannot get offset of field in dynamic struct from the constructor`);n=e}else if(jt(e))n=e.constructor;else throw M(`EINVAL`,`Type is not a struct or struct constructor`);let{fields:r}=n,i=r.find(e=>e.name===t);if(!i)throw M(`EINVAL`,`Struct does not have field: `+t);return Mt(e)?i.offset:Ot(e,i,!0)}function It(e,t){class n extends DataView{length;type=e;*[Symbol.iterator](){for(let e=0;e<this.length;e++)yield this[e]}_offsets=[0];offsetOf(t){if(!e.isDynamic)return t*e.size;if(t<this._offsets.length)return this._offsets[t];for(let n=this._offsets.length;n<=t;n++)this._offsets[n]=this._offsets[n-1]+B(e.get(this.buffer,this.byteOffset+this._offsets[n-1]));return this._offsets[t]}constructor(n,r,i){let a=typeof n==`object`?n:new ArrayBuffer((n??0)*e.size);super(a,r,i),this.length=typeof n==`number`?n:e.isDynamic?t??_(`Unknown length of StructArray<${e.name}>`):Math.floor(this.byteLength/e.size);let o=e=>this.byteOffset+this.offsetOf(e);return new Proxy(this,{get(t,n){if(n in t)return t[n];let r=parseInt(n.toString());if(Number.isSafeInteger(r))return e.get(t.buffer,o(r))},set(t,n,r){let i=parseInt(n.toString());return Number.isSafeInteger(i)?(e.set(t.buffer,o(i),r),!0):!1}})}}for(let e of Object.getOwnPropertyNames(DataView.prototype))!e.startsWith(`get`)&&!e.startsWith(`set`)||Object.defineProperty(n.prototype,e,{enumerable:!1,configurable:!1,writable:!1,value:void 0});return n}function Lt(e){return typeof e==`function`&&`prototype`in e&&`fields`in e&&typeof e.fields==`object`&&ot(e)}var Rt=class{type;length;name;size;__structArray;__arrayType;__isArrayType=!0;constructor(e,t){this.type=e,this.length=t,this.name=`${e.name}[${t}]`,this.size=e.size*t,this.array=It(this),this.__structArray=It(e,t),this.__arrayType=e.array?e.array:this.__structArray}get=(e,t)=>_t(this.type.name)&&t%this.type.size!==0?new this.__structArray(e,t,this.size):new this.__arrayType(e,t,this.size);set=(e,t,n)=>{if(this.length)for(let r=0;r<this.length;r++)this.type.set(e,t+r*this.type.size,n[r]);else{let r=t;for(let t=0;t<n.length;t++)this.type.set(e,r,n[t]),r+=Lt(this.type)&&this.type.isDynamic?B(n[t]):this.type.size}};array};Symbol.metadata??=Symbol.for(`Symbol.metadata`);function zt(e){e.metadata??={};let t=e.metadata.structInit??{};return e.metadata.structInit={fields:[...t.fields??[]]},e.metadata.structInit}function Bt(...e){let t=e.reduce((e,t)=>({...e,...t}),{});return typeof this==`object`&&Object.assign(t,this),function(e,n){let r=zt(n),i=1,a=[],o=0,s=e=>{o=Math.ceil(o/e)*e};for(let e of r.fields)t.isPacked||s(e.alignment),t.isUnion?o=Math.max(o,e.type.size):(e.offset=o,o+=e.type.size),a.push(e),i=Math.max(i,e.alignment);t.alignment??=i,t.isPacked||s(t.alignment);class c extends e{static name=e.name;static size=o;static alignment=t.alignment;static isUnion=!!t.isUnion;static isDynamic=!!t.isDynamic;static fields=a;static get(e,t){return new this(e,t)}static set(e,t,n){let r=new Uint8Array(n.buffer,n.byteOffset,this.size),i=new Uint8Array(e,t,this.size);if(n.buffer!==e||n.byteOffset!==t)for(let e=0;e<this.size;e++)i[e]=r[e]}static[Symbol.toStringTag]=`[struct ${e.name}]`;constructor(...e){e.length||(e=[new ArrayBuffer(o),0,o]),super(...e);for(let e of Object.values(a))Object.defineProperty(this,e.name,{enumerable:!0,configurable:!0,get(){return At(this,e)},set(t){kt(this,e,t)}})}}return n.addInitializer(function(){Object.defineProperty(c,"name",{value:e.name}),ct(c)}),c}}Bt.packed=Bt.bind({isPacked:!0}),Bt.align=function(e){return Bt.bind({alignment:e})};function Vt(e,t={}){return function(n,r){if(r.kind!=`accessor`)throw M(`EINVAL`,`Field must be an accessor`);let i=zt(r),a=St(r.name,e,t);return i.fields.push(a),{get(){return At(this,a)},set(e){kt(this,a,e)}}}}function Ht(e){let t=pt[yt(e)];function n(n,r){return typeof n==`number`?Vt(new Rt(t,n),{typeName:e,...r}):Vt(t,{typeName:e})(n,r&&`name`in r?r:_(M(`EINVAL`,`Invalid decorator context object`)))}return n}var V=Object.fromEntries(gt.map(e=>[e,Ht(e)]));function Ut(e){return e}Ut.typed=function(e){return e};var Wt=class e{type;init;constructor(t,n){this.type=t,this.init=n;let r=(r=>new e(new Rt(t,r),n));return Object.setPrototypeOf(r,new.target.prototype),Object.assign(r,{type:t,init:n}),r}align(t){return new e(this.type,{...this.init,align:t})}countedBy(t){return new e(this.type,{...this.init,countedBy:t})}bigEndian(){return new e(this.type,{...this.init,bigEndian:!0})}toInit(){return{type:this.type,...this.init}}$type(){return new e(this.type,this.init)}};function Gt(e,t=0){return new Wt(new Rt(e,t),{})}function Kt(e,t,...n){let r=n.reduce((e,t)=>({...e,...t}),{});typeof this==`object`&&Object.assign(r,this);let i=1,a=0,o=e=>{a=Math.ceil(a/e)*e},s=[];for(let[e,n]of Object.entries(t)){if(typeof e==`number`)throw TypeError(`Field names can not be numbers`);let t=St(e,n);r.isPacked||o(t.alignment),r.isUnion?a=Math.max(a,t.type.size):(t.offset=a,a+=t.type.size),s.push(t),i=Math.max(i,t.alignment)}r.alignment??=i,r.isPacked||o(r.alignment);class c extends DataView{static name=e;static size=a;static alignment=r.alignment;static isUnion=!!r.isUnion;static isDynamic=!!r.isDynamic;static fields=s;static get(e,t){return new this(e,t)}static set(e,t,n){let r=new Uint8Array(n.buffer,n.byteOffset,this.size),i=new Uint8Array(e,t,this.size);if(n.buffer!==e||n.byteOffset!==t)for(let e=0;e<this.size;e++)i[e]=r[e]}static[Symbol.toStringTag]=`[struct ${e}]`;constructor(e=new ArrayBuffer(a),t,n){super(e,t,n??e.byteLength-(t??0));for(let e of Object.values(this.constructor.fields??s))Object.defineProperty(this,e.name,{enumerable:!0,configurable:!0,get(){return At(this,e)},set(t){kt(this,e,t)}})}}for(let e of Object.getOwnPropertyNames(DataView.prototype))!e.startsWith(`get`)&&!e.startsWith(`set`)||Object.defineProperty(c.prototype,e,{enumerable:!1,configurable:!1,writable:!1,value:void 0});return ct(c),c}Kt.extend=function(e,t,n,...r){let i=r.reduce((e,t)=>({...e,...t}),{});typeof this==`object`&&Object.assign(i,this);let a=1,o=e.size,s=e=>{o=Math.ceil(o/e)*e},c=e.fields;for(let[e,t]of Object.entries(n)){if(typeof e==`number`)throw TypeError(`Field names can not be numbers`);let n=St(e,t);i.isPacked||s(n.alignment),i.isUnion?o=Math.max(o,n.type.size):(n.offset=o,o+=n.type.size),c.push(n),a=Math.max(a,n.alignment)}i.alignment??=a,i.isPacked||s(i.alignment);class l extends e{static name=t;static size=o;static alignment=i.alignment;static isUnion=!!i.isUnion;static isDynamic=!!i.isDynamic;static fields=c;static[Symbol.toStringTag]=`[struct ${t}]`}return ct(l),l},Kt.packed=Kt.bind({isPacked:!0}),Kt.align=function(e){return Kt.bind({alignment:e})},Kt.dynamic=Kt.bind({isDynamic:!0}),Object.fromEntries(Object.entries(ht).map(([e,t])=>[e,new Wt(t,{typeName:e})]));function qt(e){return JSON.parse(T(e),(e,t)=>e==``?t:typeof t==`string`?BigInt(t).toString(16).slice(0,Math.min(t.length,8)):t)}function Jt(e){return C(JSON.stringify(e))}function Yt(e,t){if(typeof e==`number`)return e;if(typeof e==`string`){let t=parseInt(e,8);if(!isNaN(t))return t}if(typeof t==`number`)return t;throw M(`EINVAL`,`Invalid mode: `+e?.toString())}var Xt=2147483647;function Zt(e){if(!(Number.isInteger(e)&&e>=0&&e<=Xt))throw Object.assign(RangeError(`The value of "fd" is out of range. It must be >= 0 && <= ${Xt}. Received ${e}`),{code:`ERR_OUT_OF_RANGE`})}function Qt(e){if(e instanceof Date)return e.getTime();let t=Number(e);if(!Number.isFinite(t))throw M(`EINVAL`,`Invalid time.`);return t<0?Date.now():t*1e3}function H(e,t=!1){if(e instanceof URL){if(e.protocol!=`file:`)throw M(`EINVAL`,`URLs must use the file: protocol`);e=e.pathname}if(e=e.toString(),e.startsWith(`file://`)&&(e=e.slice(7)),e.includes(`\0`))throw M(`EINVAL`,`Path can not contain null character`);if(e.length==0)throw M(`EINVAL`,`Path can not be empty`);return e=e.replaceAll(/[/\\]+/g,`/`),t?e:cn.call(this,e)}function $t(e,t=`utf8`,n,r=0){return typeof e!=`object`||!e?{encoding:typeof e==`string`?e:t??null,flag:n,mode:r}:{encoding:typeof e?.encoding==`string`?e.encoding:t??null,flag:typeof e?.flag==`string`?e.flag:n,mode:Yt(`mode`in e?e?.mode:null,r)}}function en(e){let t=`\0GS\0`;return e=e.replace(/\*\*/g,t).replace(/\*/g,`\0S\0`).replace(/[.+^$(){}|[\]\\]/g,`\\$&`).replace(/\?/g,`.`).replaceAll(`/\0GS\0/`,`(?:/.*)?/`).replaceAll(t,`.*`).replaceAll(`\0S\0`,`[^/]*`),RegExp(`^${e}$`)}async function tn(e){let t=Promise.withResolvers();setTimeout(()=>t.reject(M(`ETIMEDOUT`)),500),e.on(`online`,t.resolve),await t.promise}function nn(e){return`${H(e,!0)}${Date.now()}-${Math.random().toString(36).slice(2)}`}var rn=t({basename:()=>fn,dirname:()=>W,extname:()=>pn,format:()=>mn,formatExt:()=>sn,isAbsolute:()=>un,join:()=>U,matchesGlob:()=>gn,normalize:()=>ln,normalizeString:()=>on,parse:()=>hn,relative:()=>dn,resolve:()=>cn,sep:()=>`/`});function an(e,t){if(typeof e!=`object`)throw TypeError(`"${t}" is not an object`)}function on(e,t){let n=``,r=0,i=-1,a=0,o=`\0`;for(let s=0;s<=e.length;++s){if(s<e.length)o=e[s];else if(o==`/`)break;else o=`/`;if(o==`/`){if(i!==s-1&&a!==1)if(a===2){if(n.length<2||r!==2||n.at(-1)!==`.`||n.at(-2)!==`.`){if(n.length>2){let e=n.lastIndexOf(`/`);e===-1?(n=``,r=0):(n=n.slice(0,e),r=n.length-1-n.lastIndexOf(`/`)),i=s,a=0;continue}if(n.length!==0){n=``,r=0,i=s,a=0;continue}}t&&(n+=n.length>0?`/..`:`..`,r=2)}else n.length>0?n+=`/`+e.slice(i+1,s):n=e.slice(i+1,s),r=s-i-1;i=s,a=0}else o===`.`&&a!==-1?++a:a=-1}return n}function sn(e){return e?`${e[0]===`.`?``:`.`}${e}`:``}function cn(...e){let t=``;for(let n of[...e.reverse(),Fe(this).pwd])if(n?.length&&(t=`${n}/${t}`,n.startsWith(`/`)))break;let n=t.startsWith(`/`);return t=on(t,!n),n?`/${t}`:t.length?t:`/`}function ln(e){if(!e.length)return`.`;let t=e[0]===`/`,n=e.at(-1)===`/`;return e=on(e,!t),e.length?(n&&(e+=`/`),t?`/${e}`:e):t?`/`:n?`./`:`.`}function un(e){return e.startsWith(`/`)}function U(...e){if(!e.length)return`.`;let t=e.filter(e=>e).join(`/`);return t?.length?ln(t):`.`}function dn(e,t){if(e===t||(e=cn.call(this,e),t=cn.call(this,t),e===t))return``;let n=e.length,r=n-1,i=t.length-1,a=r<i?r:i,o=-1,s=0;for(;s<a;s++){let n=e[1+s];if(n!==t[1+s])break;n===`/`&&(o=s)}if(s===a)if(i>a){if(t[1+s]===`/`)return t.slice(1+s+1);if(s===0)return t.slice(1+s)}else r>a&&(e[1+s]===`/`?o=s:s===0&&(o=0));let c=``;for(s=1+o+1;s<=n;++s)(s===n||e[s]===`/`)&&(c+=c.length===0?`..`:`/..`);return`${c}${t.slice(1+o)}`}function W(e){if(e.length===0)return`.`;let t=e[0]===`/`,n=-1,r=!0;for(let t=e.length-1;t>=1;--t)if(e[t]===`/`){if(!r){n=t;break}}else r=!1;return n===-1?t?`/`:`.`:t&&n===1?`//`:e.slice(0,n)}function fn(e,t){let n=0,r=-1,i=!0;if(t!==void 0&&t.length>0&&t.length<=e.length){if(t===e)return``;let a=t.length-1,o=-1;for(let s=e.length-1;s>=0;--s)if(e[s]===`/`){if(!i){n=s+1;break}}else o===-1&&(i=!1,o=s+1),a>=0&&(e[s]===t[a]?--a===-1&&(r=s):(a=-1,r=o));return n===r?r=o:r===-1&&(r=e.length),e.slice(n,r)}for(let t=e.length-1;t>=0;--t)if(e[t]===`/`){if(!i){n=t+1;break}}else r===-1&&(i=!1,r=t+1);return r===-1?``:e.slice(n,r)}function pn(e){let t=-1,n=0,r=-1,i=!0,a=0;for(let o=e.length-1;o>=0;--o){if(e[o]===`/`){if(!i){n=o+1;break}continue}r===-1&&(i=!1,r=o+1),e[o]===`.`?t===-1?t=o:a!==1&&(a=1):t!==-1&&(a=-1)}return t===-1||r===-1||a===0||a===1&&t===r-1&&t===n+1?``:e.slice(t,r)}function mn(e){an(e,`pathObject`);let t=e.dir||e.root,n=e.base||`${e.name||``}${sn(e.ext)}`;return t?t===e.root?`${t}${n}`:`${t}/${n}`:n}function hn(e){let t=e[0]===`/`,n={root:t?`/`:``,dir:``,base:``,ext:``,name:``};if(e.length===0)return n;let r=+!!t,i=-1,a=0,o=-1,s=!0,c=e.length-1,l=0;for(;c>=r;--c){if(e[c]===`/`){if(!s){a=c+1;break}continue}o===-1&&(s=!1,o=c+1),e[c]===`.`?i===-1?i=c:l!==1&&(l=1):i!==-1&&(l=-1)}if(o!==-1){let r=a===0&&t?1:a;i===-1||l===0||l===1&&i===o-1&&i===a+1?n.base=n.name=e.slice(r,o):(n.name=e.slice(r,i),n.base=e.slice(r,o),n.ext=e.slice(i,o))}return a>0?n.dir=e.slice(0,a-1):t&&(n.dir=`/`),n}function gn(e,t){return en(e).test(t)}var _n=BigInt(1e3),vn=class{_convert(e){return this._isBigint?BigInt(e):Number(e)}get blocks(){return this._convert(Math.ceil(Number(this.size)/512))}set blocks(e){}mode;dev=this._convert(0);ino=this._convert(0);rdev=this._convert(0);nlink=this._convert(1);blksize=this._convert(4096);uid=this._convert(0);gid=this._convert(0);atimeMs;get atime(){return new Date(Number(this.atimeMs))}set atime(e){this.atimeMs=this._convert(e.getTime())}mtimeMs;get mtime(){return new Date(Number(this.mtimeMs))}set mtime(e){this.mtimeMs=this._convert(e.getTime())}ctimeMs;get ctime(){return new Date(Number(this.ctimeMs))}set ctime(e){this.ctimeMs=this._convert(e.getTime())}birthtimeMs;get birthtime(){return new Date(Number(this.birthtimeMs))}set birthtime(e){this.birthtimeMs=this._convert(e.getTime())}size;data;flags;version;constructor({atimeMs:e,mtimeMs:t,ctimeMs:n,birthtimeMs:r,uid:i,gid:a,size:o,mode:s,ino:c,...l}={}){let u=Date.now();this.atimeMs=this._convert(e??u),this.mtimeMs=this._convert(t??u),this.ctimeMs=this._convert(n??u),this.birthtimeMs=this._convert(r??u),this.uid=this._convert(i??0),this.gid=this._convert(a??0),this.size=this._convert(o??0),this.ino=this._convert(c??0),this.mode=this._convert(s??0),this.mode&61440||(this.mode|=this._convert(Ze)),Object.assign(this,l)}isFile(){return(this.mode&Je)===Ze}isDirectory(){return(this.mode&Je)===$e}isSymbolicLink(){return(this.mode&Je)===Xe}isSocket(){return(this.mode&Je)===Ye}isBlockDevice(){return(this.mode&Je)===Qe}isCharacterDevice(){return(this.mode&Je)===et}isFIFO(){return(this.mode&Je)===tt}toJSON(){return d(this,On)}hasAccess(e,t){return J(t,this._isBigint?new yn(this):this,e)}get atimeNs(){return BigInt(this.atimeMs)*_n}get mtimeNs(){return BigInt(this.mtimeMs)*_n}get ctimeNs(){return BigInt(this.ctimeMs)*_n}get birthtimeNs(){return BigInt(this.birthtimeMs)*_n}},yn=class extends vn{_isBigint=!1},bn=class extends vn{_isBigint=!0};function xn(e,t){return e.size==t.size&&+e.atime==+t.atime&&+e.mtime==+t.mtime&&+e.ctime==+t.ctime&&e.mode==t.mode}var Sn=class{type=525687744115;bsize=4096;blocks=0;bfree=0;bavail=0;files=it;ffree=it},Cn=class{type=BigInt(`0x7a656e6673`);bsize=BigInt(4096);blocks=BigInt(0);bfree=BigInt(0);bavail=BigInt(0);files=BigInt(it);ffree=BigInt(it)},wn=function(e,t,n,r,i,a){function o(e){if(e!==void 0&&typeof e!=`function`)throw TypeError(`Function expected`);return e}for(var s=r.kind,c=s===`getter`?`get`:s===`setter`?`set`:`value`,l=!t&&e?r.static?e:e.prototype:null,u=t||(l?Object.getOwnPropertyDescriptor(l,r.name):{}),d,f=!1,p=n.length-1;p>=0;p--){var m={};for(var h in r)m[h]=h===`access`?{}:r[h];for(var h in r.access)m.access[h]=r.access[h];m.addInitializer=function(e){if(f)throw TypeError(`Cannot add initializers after decoration has completed`);a.push(o(e||null))};var g=(0,n[p])(s===`accessor`?{get:u.get,set:u.set}:u[c],m);if(s===`accessor`){if(g===void 0)continue;if(typeof g!=`object`||!g)throw TypeError(`Object expected`);(d=o(g.get))&&(u.get=d),(d=o(g.set))&&(u.set=d),(d=o(g.init))&&i.unshift(d)}else(d=o(g))&&(s===`field`?i.unshift(d):u[c]=d)}l&&Object.defineProperty(l,r.name,u),f=!0},G=function(e,t,n){for(var r=arguments.length>2,i=0;i<t.length;i++)n=r?t[i].call(e,n):t[i].call(e);return r?n:void 0},Tn=3968,En=(()=>{var e,t;let n=[Bt.packed()],r,i=[],a,o=Ut.typed(Uint8Array),s,c=[],l=[],u,d=[],f=[];var p=class extends o{static{a=this}static{let m=typeof Symbol==`function`&&Symbol.metadata?Object.create(o[Symbol.metadata]??null):void 0;s=[(e=V).uint32.bind(e)],u=[(t=V).uint32.bind(t)],wn(this,null,s,{kind:`accessor`,name:`keySize`,static:!1,private:!1,access:{has:e=>`keySize`in e,get:e=>e.keySize,set:(e,t)=>{e.keySize=t}},metadata:m},c,l),wn(this,null,u,{kind:`accessor`,name:`valueSize`,static:!1,private:!1,access:{has:e=>`valueSize`in e,get:e=>e.valueSize,set:(e,t)=>{e.valueSize=t}},metadata:m},d,f),wn(null,r={value:a},n,{kind:`class`,name:a.name,metadata:m},null,i),p=a=r.value,m&&Object.defineProperty(a,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:m})}static name=`Attribute`;#e=G(this,c,void 0);get keySize(){return this.#e}set keySize(e){this.#e=e}#t=(G(this,l),G(this,d,void 0));get valueSize(){return this.#t}set valueSize(e){this.#t=e}get name(){return T(this.subarray(8,8+this.keySize))}set name(e){let t=C(e);if(8+t.length+this.valueSize>Tn)throw M(`EOVERFLOW`);this.set(t,8),this.keySize=t.length}get value(){return this.subarray(8+this.keySize,this.size)}set value(e){if(8+this.keySize+e.length>Tn)throw M(`EOVERFLOW`);this.valueSize=e.length,this.set(e,8+this.keySize)}get size(){return 8+this.keySize+this.valueSize}constructor(){super(...arguments),G(this,f)}static{G(a,i)}};return a})(),Dn=(()=>{var e;let t=[Bt.packed()],n,r=[],a,o=Ut(i),s,c=[],l=[];var u=class extends o{static{a=this}static{let i=typeof Symbol==`function`&&Symbol.metadata?Object.create(o[Symbol.metadata]??null):void 0;s=[(e=V).uint32.bind(e)],wn(this,null,s,{kind:`accessor`,name:`size`,static:!1,private:!1,access:{has:e=>`size`in e,get:e=>e.size,set:(e,t)=>{e.size=t}},metadata:i},c,l),wn(null,n={value:a},t,{kind:`class`,name:a.name,metadata:i},null,r),u=a=n.value,i&&Object.defineProperty(a,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:i})}static name=`Attributes`;#e=G(this,c,void 0);get size(){return this.#e}set size(e){this.#e=e}get byteSize(){let e=this.byteOffset+B(this);for(let t=0;t<this.size;t++){let t=new En(this.buffer,e);e+=t.size}return e}has(e){let t=this.byteOffset+B(this);for(let n=0;n<this.size;n++){let n=new En(this.buffer,t);if(n.name==e)return!0;t+=n.size}return!1}get(e){let t=this.byteOffset+B(this);for(let n=0;n<this.size;n++){let n=new En(this.buffer,t);if(n.name==e)return n.value;t+=n.size}}set(e,t){let n=this.byteOffset+B(this),r;for(let t=0;t<this.size;t++){let t=new En(this.buffer,n);t.name==e&&(r=[n,t.size]),n+=t.size}let i=new Uint8Array(this.buffer);if(r){let[e,t]=r;n-=t,i.copyWithin(e,e+t,n+t),i.fill(0,n,n+t),this.size--}let a=new En(this.buffer,n);a.name=e,a.value=t,this.size++}remove(e){let t=this.byteOffset+B(this),n;for(let r=0;r<this.size;r++){let r=new En(this.buffer,t);r.name==e&&(n=[t,r.size]),t+=r.size}if(!n)return!1;let[r,i]=n,a=new Uint8Array(this.buffer);return a.copyWithin(r,r+i,t),a.fill(0,t-i,t),this.size--,!0}copyFrom(e){let{byteSize:t}=e;new Uint8Array(this.buffer,this.byteOffset,t).set(new Uint8Array(e.buffer,e.byteOffset,t))}*keys(){let e=this.byteOffset+B(this);for(let t=0;t<this.size;t++){let t=new En(this.buffer,e);yield t.name,e+=t.size}}*values(){let e=this.byteOffset+B(this);for(let t=0;t<this.size;t++){let t=new En(this.buffer,e);yield t.value,e+=t.size}}*entries(){let e=this.byteOffset+B(this);for(let t=0;t<this.size;t++){let t=new En(this.buffer,e);yield[t.name,t.value],e+=t.size}}constructor(){super(...arguments),G(this,l)}static{G(a,r)}};return a})(),On=[`ino`,`data`,`size`,`mode`,`flags`,`nlink`,`uid`,`gid`,`atimeMs`,`birthtimeMs`,`mtimeMs`,`ctimeMs`,`version`],kn;(function(e){e[e.Sync=1]=`Sync`,e[e.NoAtime=2]=`NoAtime`,e[e.Append=4]=`Append`,e[e.Immutable=8]=`Immutable`,e[e.Dead=16]=`Dead`,e[e.NoQuota=32]=`NoQuota`,e[e.Dirsync=64]=`Dirsync`,e[e.NoCMtime=128]=`NoCMtime`,e[e.SwapFile=256]=`SwapFile`,e[e.Private=512]=`Private`,e[e.IMA=1024]=`IMA`,e[e.AutoMount=2048]=`AutoMount`,e[e.NoSec=4096]=`NoSec`,e[e.DAX=8192]=`DAX`,e[e.Encrypted=16384]=`Encrypted`,e[e.CaseFold=32768]=`CaseFold`,e[e.Verity=65536]=`Verity`,e[e.KernelFile=131072]=`KernelFile`})(kn||={});var An=253951,jn=229631,K=(()=>{var e,t,n,r,a,o,s,c,l,u,f,p,m,h,g,_;let v=[Bt.packed()],y,b=[],x,S=Ut(i),C,w=[],T=[],ee,E=[],te=[],D,O=[],ne=[],k,A=[],j=[],N,P=[],F=[],re,ie=[],ae=[],oe,se=[],ce=[],le,I=[],de=[],fe,pe=[],me=[],he,ge=[],_e=[],ve,ye=[],R=[],be,z=[],xe=[],Se,Ce=[],we=[],Te,Ee=[],De=[],Oe,ke=[],Ae=[],je,Me=[],Ne=[],Pe,Fe=[],Ie=[],Le,Re=[],ze=[],Be,Ve=[],He=[];var Ue=class extends S{static{x=this}static{let i=typeof Symbol==`function`&&Symbol.metadata?Object.create(S[Symbol.metadata]??null):void 0;C=[(e=V).uint32.bind(e)],ee=[(t=V).uint32.bind(t)],D=[(n=V).uint32.bind(n)],k=[(r=V).uint16.bind(r)],N=[(a=V).uint32.bind(a)],re=[(o=V).uint32.bind(o)],oe=[(s=V).uint32.bind(s)],le=[(c=V).float64.bind(c)],fe=[(l=V).float64.bind(l)],he=[(u=V).float64.bind(u)],ve=[(f=V).float64.bind(f)],be=[(p=V).uint32.bind(p)],Se=[(m=V).uint32.bind(m)],Te=[(h=V).uint32.bind(h)],Oe=[(g=V).uint16.bind(g)],je=[(_=V).uint32.bind(_)],Pe=[V.uint8(48)],Le=[Vt(Dn)],Be=[V.uint8(Tn)],wn(this,null,C,{kind:`accessor`,name:`data`,static:!1,private:!1,access:{has:e=>`data`in e,get:e=>e.data,set:(e,t)=>{e.data=t}},metadata:i},w,T),wn(this,null,ee,{kind:`accessor`,name:`__data_old`,static:!1,private:!1,access:{has:e=>`__data_old`in e,get:e=>e.__data_old,set:(e,t)=>{e.__data_old=t}},metadata:i},E,te),wn(this,null,D,{kind:`accessor`,name:`size`,static:!1,private:!1,access:{has:e=>`size`in e,get:e=>e.size,set:(e,t)=>{e.size=t}},metadata:i},O,ne),wn(this,null,k,{kind:`accessor`,name:`mode`,static:!1,private:!1,access:{has:e=>`mode`in e,get:e=>e.mode,set:(e,t)=>{e.mode=t}},metadata:i},A,j),wn(this,null,N,{kind:`accessor`,name:`nlink`,static:!1,private:!1,access:{has:e=>`nlink`in e,get:e=>e.nlink,set:(e,t)=>{e.nlink=t}},metadata:i},P,F),wn(this,null,re,{kind:`accessor`,name:`uid`,static:!1,private:!1,access:{has:e=>`uid`in e,get:e=>e.uid,set:(e,t)=>{e.uid=t}},metadata:i},ie,ae),wn(this,null,oe,{kind:`accessor`,name:`gid`,static:!1,private:!1,access:{has:e=>`gid`in e,get:e=>e.gid,set:(e,t)=>{e.gid=t}},metadata:i},se,ce),wn(this,null,le,{kind:`accessor`,name:`atimeMs`,static:!1,private:!1,access:{has:e=>`atimeMs`in e,get:e=>e.atimeMs,set:(e,t)=>{e.atimeMs=t}},metadata:i},I,de),wn(this,null,fe,{kind:`accessor`,name:`birthtimeMs`,static:!1,private:!1,access:{has:e=>`birthtimeMs`in e,get:e=>e.birthtimeMs,set:(e,t)=>{e.birthtimeMs=t}},metadata:i},pe,me),wn(this,null,he,{kind:`accessor`,name:`mtimeMs`,static:!1,private:!1,access:{has:e=>`mtimeMs`in e,get:e=>e.mtimeMs,set:(e,t)=>{e.mtimeMs=t}},metadata:i},ge,_e),wn(this,null,ve,{kind:`accessor`,name:`ctimeMs`,static:!1,private:!1,access:{has:e=>`ctimeMs`in e,get:e=>e.ctimeMs,set:(e,t)=>{e.ctimeMs=t}},metadata:i},ye,R),wn(this,null,be,{kind:`accessor`,name:`ino`,static:!1,private:!1,access:{has:e=>`ino`in e,get:e=>e.ino,set:(e,t)=>{e.ino=t}},metadata:i},z,xe),wn(this,null,Se,{kind:`accessor`,name:`__ino_old`,static:!1,private:!1,access:{has:e=>`__ino_old`in e,get:e=>e.__ino_old,set:(e,t)=>{e.__ino_old=t}},metadata:i},Ce,we),wn(this,null,Te,{kind:`accessor`,name:`flags`,static:!1,private:!1,access:{has:e=>`flags`in e,get:e=>e.flags,set:(e,t)=>{e.flags=t}},metadata:i},Ee,De),wn(this,null,Oe,{kind:`accessor`,name:`__after_flags`,static:!1,private:!1,access:{has:e=>`__after_flags`in e,get:e=>e.__after_flags,set:(e,t)=>{e.__after_flags=t}},metadata:i},ke,Ae),wn(this,null,je,{kind:`accessor`,name:`version`,static:!1,private:!1,access:{has:e=>`version`in e,get:e=>e.version,set:(e,t)=>{e.version=t}},metadata:i},Me,Ne),wn(this,null,Pe,{kind:`accessor`,name:`__padding`,static:!1,private:!1,access:{has:e=>`__padding`in e,get:e=>e.__padding,set:(e,t)=>{e.__padding=t}},metadata:i},Fe,Ie),wn(this,null,Le,{kind:`accessor`,name:`attributes`,static:!1,private:!1,access:{has:e=>`attributes`in e,get:e=>e.attributes,set:(e,t)=>{e.attributes=t}},metadata:i},Re,ze),wn(this,null,Be,{kind:`accessor`,name:`__data`,static:!1,private:!1,access:{has:e=>`__data`in e,get:e=>e.__data,set:(e,t)=>{e.__data=t}},metadata:i},Ve,He),wn(null,y={value:x},v,{kind:`class`,name:x.name,metadata:i},null,b),Ue=x=y.value,i&&Object.defineProperty(x,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:i})}static name=`Inode`;constructor(...e){let t={};if(typeof e[0]==`object`&&e[0]!==null&&!ArrayBuffer.isView(e[0])&&(t=e[0],e=[B(Ue)]),e[0]instanceof Ue&&(e=[new Uint8Array(e[0].buffer,e[0].byteOffset,e[0].byteLength)]),super(...e),G(this,He),this.byteLength<B(Ue))throw ue(M(`EIO`,`Buffer is too small to create an inode (${this.byteLength} bytes)`));Object.assign(this,t),this.atimeMs||=Date.now(),this.mtimeMs||=Date.now(),this.ctimeMs||=Date.now(),this.birthtimeMs||=Date.now(),this.ino&&!this.nlink&&L(`Inode ${this.ino} has an nlink of 0`)}#e=G(this,w,void 0);get data(){return this.#e}set data(e){this.#e=e}#t=(G(this,T),G(this,E,void 0));get __data_old(){return this.#t}set __data_old(e){this.#t=e}#n=(G(this,te),G(this,O,void 0));get size(){return this.#n}set size(e){this.#n=e}#r=(G(this,ne),G(this,A,void 0));get mode(){return this.#r}set mode(e){this.#r=e}#i=(G(this,j),G(this,P,void 0));get nlink(){return this.#i}set nlink(e){this.#i=e}#a=(G(this,F),G(this,ie,void 0));get uid(){return this.#a}set uid(e){this.#a=e}#o=(G(this,ae),G(this,se,void 0));get gid(){return this.#o}set gid(e){this.#o=e}#s=(G(this,ce),G(this,I,void 0));get atimeMs(){return this.#s}set atimeMs(e){this.#s=e}#c=(G(this,de),G(this,pe,void 0));get birthtimeMs(){return this.#c}set birthtimeMs(e){this.#c=e}#l=(G(this,me),G(this,ge,void 0));get mtimeMs(){return this.#l}set mtimeMs(e){this.#l=e}#u=(G(this,_e),G(this,ye,void 0));get ctimeMs(){return this.#u}set ctimeMs(e){this.#u=e}#d=(G(this,R),G(this,z,void 0));get ino(){return this.#d}set ino(e){this.#d=e}#f=(G(this,xe),G(this,Ce,void 0));get __ino_old(){return this.#f}set __ino_old(e){this.#f=e}#p=(G(this,we),G(this,Ee,void 0));get flags(){return this.#p}set flags(e){this.#p=e}#m=(G(this,De),G(this,ke,void 0));get __after_flags(){return this.#m}set __after_flags(e){this.#m=e}#h=(G(this,Ae),G(this,Me,void 0));get version(){return this.#h}set version(e){this.#h=e}#g=(G(this,Ne),G(this,Fe,void 0));get __padding(){return this.#g}set __padding(e){this.#g=e}#_=(G(this,Ie),G(this,Re,void 0));get attributes(){return this.#_}set attributes(e){this.#_=e}#v=(G(this,ze),G(this,Ve,void 0));get __data(){return this.#v}set __data(e){this.#v=e}toString(){return`<Inode ${this.ino}>`}toJSON(){return{...d(this,On),attributes:this.attributes}}toStats(){return new yn(this)}update(e){if(!e)return!1;let t=!1;for(let n of On)e[n]!==void 0&&n!=`ino`&&n!=`data`&&this[n]!==e[n]&&(n==`atimeMs`&&this.flags&kn.NoAtime||(this[n]=e[n],t=!0));return e.attributes&&(this.attributes.copyFrom(e.attributes),t=!0),t&&(this.ctimeMs=Date.now()),t}static{G(x,b)}};return Ue=x})();function Mn(e){return(e.mode&Je)===Ze}function q(e){return(e.mode&Je)===$e}function Nn(e){return(e.mode&Je)===Xe}function Pn(e){return(e.mode&Je)===Ye}function Fn(e){return(e.mode&Je)===Qe}function In(e){return(e.mode&Je)===et}function Ln(e){return(e.mode&Je)===tt}function J(e,t,n){let{credentials:r}=Fe(e);if(Nn(t)||r.euid===0||r.egid===0)return!0;let i=0;return r.uid===t.uid&&(t.mode&256&&(i|=4),t.mode&128&&(i|=2),t.mode&64&&(i|=1)),(r.gid===t.gid||r.groups.includes(Number(t.gid)))&&(t.mode&32&&(i|=4),t.mode&16&&(i|=2),t.mode&8&&(i|=1)),t.mode&4&&(i|=4),t.mode&2&&(i|=2),t.mode&1&&(i|=1),(i&n)===n}function Rn(e,t,n){let r=!0;return!isNaN(t)&&t>=0&&t<4294967295?e.uid=t:r=!1,!isNaN(n)&&n>=0&&n<4294967295?e.gid=n:r=!1,r}var zn=class e extends Map{maxSize=it;toJSON(){return{version:1,maxSize:this.maxSize,entries:Object.fromEntries([...this].map(([e,t])=>[e,t.toJSON()]))}}toString(){return JSON.stringify(this.toJSON())}get byteSize(){let e=this.size*B(K);for(let t of this.values())e+=t.size;return e}usage(){return{totalSpace:this.maxSize,freeSpace:this.maxSize-this.byteSize}}pathOf(e){for(let[t,n]of this)if(n.ino==e||n.data==e)return t}getByID(e){return this.entryByID(e)?.inode}entryByID(e){for(let[t,n]of this)if(n.ino==e||n.data==e)return{path:t,inode:n}}directoryEntries(e){let t=this.get(e);if(!t)throw M(`ENOENT`);if((t.mode&61440)!=16384)throw M(`ENOTDIR`);let n={};for(let t of this.keys())W(t)==e&&t!=e&&(n[fn(t)]=this.get(t).ino);return n}_alloc(){return Math.max(...[...this.values()].flatMap(e=>[e.ino,e.data]))+1}directories(){let e=new Map;for(let[t,n]of this){if((n.mode&61440)!=16384)continue;let r={};for(let e of this.keys())W(e)==t&&e!=t&&(r[fn(e)]=this.get(e).ino);e.set(t,r)}return e}fromJSON(e){if(e.version!=1)throw M(`EINVAL`,`Index version mismatch`);this.clear();for(let[t,n]of Object.entries(e.entries))n.data??=b(1,it),t==`/`&&(n.ino=0),this.set(t,new K(n));return this}static parse(t){if(!p(t))throw M(`EINVAL`,`Invalid JSON`);let n=JSON.parse(t),r=new e;return r.fromJSON(n),r}},Bn=4096,Vn=class e{type;name;label;_mountPoint;_uuid=crypto.randomUUID();get uuid(){return this._uuid}attributes=new Map;constructor(t,n){this.type=t,this.name=n,this.streamRead===e.prototype.streamRead&&this.attributes.set(`default_stream_read`),this.streamWrite===e.prototype.streamWrite&&this.attributes.set(`default_stream_write`)}toString(){return`${this.name} ${this.label?JSON.stringify(this.label):``} (${this._mountPoint?`mounted on `+this._mountPoint:`unmounted`})`}usage(){return{totalSpace:0,freeSpace:0}}async ready(){}readySync(){if(this.ready!==e.prototype.ready)throw M(`EAGAIN`)}async exists(e){try{return await this.stat(e),!0}catch(e){return e.code!=`ENOENT`}}existsSync(e){try{return this.statSync(e),!0}catch(e){return e.code!=`ENOENT`}}streamRead(e,t){return new ReadableStream({start:async n=>{let{size:r}=await this.stat(e),{start:i=0,end:a=r}=t;for(let t=i;t<a;t+=Bn){let r=t+Bn>a?a-t:Bn,i=new Uint8Array(r);await this.read(e,i,t,t+r).catch(n.error.bind(n)),n.enqueue(i)}n.close()},type:`bytes`})}streamWrite(e,t){let n=t.start??0;return new WritableStream({write:async(t,r)=>{let i=!1,a=e=>{i=!0,r.error(e)},{size:o}=await this.stat(e);await this.write(e,t,n).catch(a),!i&&(n+=t.byteLength,await this.touch(e,{mtimeMs:Date.now(),size:Math.max(o,n)}).catch(a))}})}};Promise.withResolvers??=(L(`Using a polyfill of Promise.withResolvers`),function(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}),Symbol.dispose??=(L(`Using a polyfill of Symbol.dispose`),Symbol(`Symbol.dispose`)),Symbol.asyncDispose??=(L(`Using a polyfill of Symbol.asyncDispose`),Symbol(`Symbol.asyncDispose`)),globalThis.crypto.randomUUID??=(L(`Using a polyfill of crypto.randomUUID`),function(){let e=crypto.getRandomValues(new Uint8Array(16));e[6]=e[6]&15|64,e[8]=e[8]&63|128;let t=[...e].map(e=>e.toString(16).padStart(2,`0`)).join(``);return`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16,20)}-${t.slice(20)}`}),Uint8Array.prototype.toBase64??=(L(`Using a polyfill of Uint8Array.prototype.toBase64`),function(){return btoa(String.fromCharCode(...this))}),Uint8Array.fromBase64??=(L(`Using a polyfill of Uint8Array.fromBase64`),function(e){let t=atob(e),n=new Uint8Array(t.length);for(let e=0;e<t.length;e++)n[e]=t.charCodeAt(e);return n}),Uint8Array.prototype.toHex??=(L(`Using a polyfill of Uint8Array.prototype.toHex`),function(){return[...this].map(e=>e.toString(16).padStart(2,`0`)).join(``)}),Uint8Array.fromHex??=(L(`Using a polyfill of Uint8Array.fromHex`),function(e){let t=new Uint8Array(e.length/2);for(let n=0;n<e.length;n+=2)t[n/2]=parseInt(e.slice(n,n+2),16);return t});var Hn=class{store;constructor(e){this.store=e}},Un=class extends Hn{async get(e,t,n){return this.getSync(e,t,n)}async set(e,t,n){return this.setSync(e,t,n)}async remove(e){return this.removeSync(e)}},Wn=class extends Hn{asyncDone=Promise.resolve();async(e){this.asyncDone=this.asyncDone.then(()=>e)}_cached(e,t){this.store.cache??=new Map;let n=this.store.cache.get(e);return n?(t&&(n.size=t.size),n):t?new a(e,t.size,{},this.store.cache):void 0}getSync(e,t,n){let r=this._cached(e);if(!r)return;n??=r.size;let i=r.missing(t,n);for(let{start:t,end:n}of i)this.async(this.get(e,t,n));if(i.length)throw M(`EAGAIN`);let a=r.regionAt(t);if(!a){L(`Missing cache region for `+e);return}return a.data.subarray(t-a.offset,n-a.offset)}setSync(e,t,n){this.async(this.set(e,t,n))}removeSync(e){this.async(this.remove(e)),this.store.cache?.delete(e)}},Gn=class{raw;fs;done=!1;flag(e){return this.raw.store.flags?.includes(e)??!1}constructor(e,t){this.raw=e,this.fs=t}originalData=new Map;modifiedKeys=new Set;keys(){return this.raw.keys()}async get(e,t=0,n){let r=await this.raw.get(e,t,n);return this.stash(e),r}getSync(e,t=0,n){let r=this.raw.getSync(e,t,n);return this.stash(e),r}async set(e,t,n=0){await this.markModified(e,n,t.byteLength);let r=t instanceof Uint8Array?t:new Uint8Array(t.buffer,t.byteOffset,t.byteLength);await this.raw.set(e,r,n)}setSync(e,t,n=0){this.markModifiedSync(e,n,t.byteLength);let r=t instanceof Uint8Array?t:new Uint8Array(t.buffer,t.byteOffset,t.byteLength);this.raw.setSync(e,r,n)}async remove(e){await this.markModified(e,0,void 0),await this.raw.remove(e)}removeSync(e){this.markModifiedSync(e,0,void 0),this.raw.removeSync(e)}commit(){return this.done=!0,Promise.resolve()}commitSync(){this.done=!0}async abort(){if(!this.done){for(let[e,t]of this.originalData)if(this.modifiedKeys.has(e)){if(t.some(e=>!e.data)){await this.raw.remove(e),this.fs._remove(e);continue}for(let n of t.reverse())await this.raw.set(e,n.data,n.offset)}this.done=!0}}abortSync(){if(!this.done){for(let[e,t]of this.originalData)if(this.modifiedKeys.has(e)){if(t.some(e=>!e.data)){this.raw.removeSync(e),this.fs._remove(e);continue}for(let n of t.reverse())this.raw.setSync(e,n.data,n.offset)}this.done=!0}}async[Symbol.asyncDispose](){this.done||await this.abort()}[Symbol.dispose](){this.done||this.abortSync()}stash(e,t,n=0){this.originalData.has(e)||this.originalData.set(e,[]),this.originalData.get(e).push({data:t,offset:n})}async markModified(e,t,n){this.modifiedKeys.add(e);let r=n?t+n:void 0;try{this.stash(e,await this.raw.get(e,t,r),t)}catch(n){if(!(this.raw instanceof Wn))throw n;let i=this.raw._cached(e);if(!i)throw n;for(let n of i.cached(t,r??t))this.stash(e,await this.raw.get(e,n.start,n.end),n.start)}}markModifiedSync(e,t,n){this.modifiedKeys.add(e);let r=n?t+n:void 0;try{this.stash(e,this.raw.getSync(e,t,r),t)}catch(n){if(!(this.raw instanceof Wn))throw n;let i=this.raw._cached(e);if(!i)throw n;for(let n of i.cached(t,r??t))this.stash(e,this.raw.getSync(e,n.start,n.end),n.start)}}},Kn=function(e,t,n){if(t!=null){if(typeof t!=`object`&&typeof t!=`function`)throw TypeError(`Object expected.`);var r,i;if(n){if(!Symbol.asyncDispose)throw TypeError(`Symbol.asyncDispose is not defined.`);r=t[Symbol.asyncDispose]}if(r===void 0){if(!Symbol.dispose)throw TypeError(`Symbol.dispose is not defined.`);r=t[Symbol.dispose],n&&(i=r)}if(typeof r!=`function`)throw TypeError(`Object not disposable.`);i&&(r=function(){try{i.call(this)}catch(e){return Promise.reject(e)}}),e.stack.push({value:t,dispose:r,async:n})}else n&&e.stack.push({async:!0});return t},qn=(function(e){return function(t){function n(n){t.error=t.hasError?new e(n,t.error,`An error was suppressed during disposal.`):n,t.hasError=!0}var r,i=0;function a(){for(;r=t.stack.pop();)try{if(!r.async&&i===1)return i=0,t.stack.push(r),Promise.resolve().then(a);if(r.dispose){var e=r.dispose.call(r.value);if(r.async)return i|=2,Promise.resolve(e).then(a,function(e){return n(e),a()})}else i|=1}catch(e){n(e)}if(i===1)return t.hasError?Promise.reject(t.error):Promise.resolve();if(t.hasError)throw t.error}return a()}})(typeof SuppressedError==`function`?SuppressedError:function(e,t,n){var r=Error(n);return r.name=`SuppressedError`,r.error=e,r.suppressed=t,r}),Jn=class extends Vn{store;_ids=new Map([[`/`,0]]);_paths=new Map([[0,new Set(`/`)]]);_path(e){let[t]=this._paths.get(e)??[];return t}_add(e,t){this._paths.has(e)||this._paths.set(e,new Set),this._paths.get(e).add(t),this._ids.set(t,e)}_remove(e){for(let t of this._paths.get(e)??[])this._ids.delete(t);this._paths.delete(e)}_move(e,t){let n=[];for(let[r,i]of this._ids){let a=dn(e,r);if(a.startsWith(`..`))continue;let o=U(t,a);o.endsWith(`/`)&&(o=o.slice(0,-1)),n.push({oldKey:r,newKey:o,ino:i})}for(let{oldKey:e,newKey:t,ino:r}of n){this._ids.delete(e),this._ids.set(t,r);let n=this._paths.get(r);if(!n){L(`Missing paths in table for ino `+r);continue}n.delete(e),n.add(t)}}_initialized=!1;async ready(){this._initialized||=(this.attributes.has(`no_async_preload`)||this.checkRootSync(),await this.checkRoot(),await this._populate(),!0)}readySync(){this._initialized||=(this.attributes.has(`no_async_preload`)||this.checkRootSync(),this.checkRootSync(),this._populateSync(),!0)}constructor(e){super(e.type??1802921587,e.name),this.store=e,e.fs=this,this._uuid=e.uuid??this.uuid,this.label=e.label,pe(this.name+`: supports features: `+this.store.flags?.join(`, `))}usage(){return this.store.usage?.()||{totalSpace:0,freeSpace:0}}async loadIndex(e){let t={stack:[],error:void 0,hasError:!1};try{let n=Kn(t,this.transaction(),!0),r=e.directories();for(let[t,i]of e)this._add(i.ino,t),await n.set(i.ino,i),r.has(t)&&await n.set(i.data,Jt(r.get(t)));await n.commit()}catch(e){t.error=e,t.hasError=!0}finally{let e=qn(t);e&&await e}}loadIndexSync(e){let t={stack:[],error:void 0,hasError:!1};try{let n=Kn(t,this.transaction(),!1),r=e.directories();for(let[t,i]of e)this._add(i.ino,t),n.setSync(i.ino,i),r.has(t)&&n.setSync(i.data,Jt(r.get(t)));n.commitSync()}catch(e){t.error=e,t.hasError=!0}finally{qn(t)}}async createIndex(){let e={stack:[],error:void 0,hasError:!1};try{let t=new zn,n=Kn(e,this.transaction(),!0),r=[[`/`,0]],i=g(M(`EDEADLK`));for(;r.length;){let[e,i]=r.shift(),a=new K(await n.get(i));if(t.set(e,a),a.mode&16384){let t=qt(await n.get(a.data)??_(M(`ENODATA`)));for(let[n,i]of Object.entries(t))r.push([U(e,n),i])}}return i(),t}catch(t){e.error=t,e.hasError=!0}finally{let t=qn(e);t&&await t}}createIndexSync(){let e={stack:[],error:void 0,hasError:!1};try{let t=new zn,n=Kn(e,this.transaction(),!1),r=[[`/`,0]],i=g(M(`EDEADLK`));for(;r.length;){let[e,i]=r.shift(),a=new K(n.getSync(i));if(t.set(e,a),a.mode&16384){let t=qt(n.getSync(a.data)??_(M(`ENODATA`)));for(let[n,i]of Object.entries(t))r.push([U(e,n),i])}}return i(),t}catch(t){e.error=t,e.hasError=!0}finally{qn(e)}}async rename(e,t){let n={stack:[],error:void 0,hasError:!1};try{let r=Kn(n,this.transaction(),!0),i=hn(e),a=hn(t),o=await this.findInode(r,i.dir),s=qt(await r.get(o.data)??_(M(`ENODATA`)));if(!s[i.base])throw M(`ENOENT`);let c=s[i.base];if(c!=this._ids.get(e)&&I(`Ino mismatch while renaming ${e} to ${t}`),delete s[i.base],(a.dir+`/`).startsWith(e+`/`))throw M(`EBUSY`);let l=a.dir==i.dir,u=l?o:await this.findInode(r,a.dir),d=l?s:qt(await r.get(u.data)??_(M(`ENODATA`)));if(d[a.base]){let e=new K(await r.get(d[a.base])??_(M(`ENOENT`)));if(!Mn(e))throw M(`EISDIR`);await r.remove(e.data),await r.remove(d[a.base])}d[a.base]=c,await r.set(o.data,Jt(s)),await r.set(u.data,Jt(d)),await r.commit(),this._move(e,t)}catch(e){n.error=e,n.hasError=!0}finally{let e=qn(n);e&&await e}}renameSync(e,t){let n={stack:[],error:void 0,hasError:!1};try{let r=Kn(n,this.transaction(),!1),i=hn(e),a=hn(t),o=this.findInodeSync(r,i.dir),s=qt(r.getSync(o.data)??_(M(`ENODATA`)));if(!s[i.base])throw M(`ENOENT`);let c=s[i.base];if(c!=this._ids.get(e)&&I(`Ino mismatch while renaming ${e} to ${t}`),delete s[i.base],(a.dir+`/`).startsWith(e+`/`))throw M(`EBUSY`);let l=a.dir===i.dir,u=l?o:this.findInodeSync(r,a.dir),d=l?s:qt(r.getSync(u.data)??_(M(`ENODATA`)));if(d[a.base]){let e=new K(r.getSync(d[a.base])??_(M(`ENOENT`)));if(!Mn(e))throw M(`EISDIR`);r.removeSync(e.data),r.removeSync(d[a.base])}d[a.base]=c,r.setSync(o.data,Jt(s)),r.setSync(u.data,Jt(d)),r.commitSync(),this._move(e,t)}catch(e){n.error=e,n.hasError=!0}finally{qn(n)}}async stat(e){let t={stack:[],error:void 0,hasError:!1};try{let n=Kn(t,this.transaction(),!0);return await this.findInode(n,e)}catch(e){t.error=e,t.hasError=!0}finally{let e=qn(t);e&&await e}}statSync(e){let t={stack:[],error:void 0,hasError:!1};try{let n=Kn(t,this.transaction(),!1);return this.findInodeSync(n,e)}catch(e){t.error=e,t.hasError=!0}finally{qn(t)}}async touch(e,t){let n={stack:[],error:void 0,hasError:!1};try{let r=Kn(n,this.transaction(),!0),i=await this.findInode(r,e);i.update(t)&&(this._add(i.ino,e),r.setSync(i.ino,i)),await r.commit()}catch(e){n.error=e,n.hasError=!0}finally{let e=qn(n);e&&await e}}touchSync(e,t){let n={stack:[],error:void 0,hasError:!1};try{let r=Kn(n,this.transaction(),!1),i=this.findInodeSync(r,e);i.update(t)&&(this._add(i.ino,e),r.setSync(i.ino,i)),r.commitSync()}catch(e){n.error=e,n.hasError=!0}finally{qn(n)}}async createFile(e,t){return await this.commitNew(e,{...t,mode:t.mode|Ze},new Uint8Array)}createFileSync(e,t){return this.commitNewSync(e,{...t,mode:t.mode|Ze},new Uint8Array)}async unlink(e){return this.remove(e,!1)}unlinkSync(e){this.removeSync(e,!1)}async rmdir(e){if((await this.readdir(e)).length)throw M(`ENOTEMPTY`);await this.remove(e,!0)}rmdirSync(e){if(this.readdirSync(e).length)throw M(`ENOTEMPTY`);this.removeSync(e,!0)}async mkdir(e,t){return await this.commitNew(e,{...t,mode:t.mode|$e},C(`{}`))}mkdirSync(e,t){return this.commitNewSync(e,{...t,mode:t.mode|$e},C(`{}`))}async readdir(e){let t={stack:[],error:void 0,hasError:!1};try{let n=Kn(t,this.transaction(),!0),r=await this.findInode(n,e);return Object.keys(qt(await n.get(r.data)??_(M(`ENOENT`))))}catch(e){t.error=e,t.hasError=!0}finally{let e=qn(t);e&&await e}}readdirSync(e){let t={stack:[],error:void 0,hasError:!1};try{let n=Kn(t,this.transaction(),!1),r=this.findInodeSync(n,e);return Object.keys(qt(n.getSync(r.data)??_(M(`ENOENT`))))}catch(e){t.error=e,t.hasError=!0}finally{qn(t)}}async sync(){}syncSync(){}async link(e,t){let n={stack:[],error:void 0,hasError:!1};try{let r=Kn(n,this.transaction(),!0),i=W(t),a=await this.findInode(r,i),o=qt(await r.get(a.data)??_(M(`ENOENT`))),s=await this.findInode(r,e);s.nlink++,o[fn(t)]=s.ino,this._add(s.ino,t),await r.set(s.ino,s),await r.set(a.data,Jt(o)),await r.commit()}catch(e){n.error=e,n.hasError=!0}finally{let e=qn(n);e&&await e}}linkSync(e,t){let n={stack:[],error:void 0,hasError:!1};try{let r=Kn(n,this.transaction(),!1),i=W(t),a=this.findInodeSync(r,i),o=qt(r.getSync(a.data)??_(M(`ENOENT`))),s=this.findInodeSync(r,e);s.nlink++,o[fn(t)]=s.ino,this._add(s.ino,t),r.setSync(s.ino,s),r.setSync(a.data,Jt(o)),r.commitSync()}catch(e){n.error=e,n.hasError=!0}finally{qn(n)}}async read(e,t,n,r){let i={stack:[],error:void 0,hasError:!1};try{let a=Kn(i,this.transaction(),!0),o=await this.findInode(a,e);if(o.size==0)return;let s=await a.get(o.data,n,r)??_(M(`ENODATA`)),c=a.flag(`partial`)?s:s.subarray(n,r);c.byteLength>t.byteLength&&I(`Trying to place ${c.byteLength} bytes into a ${t.byteLength} byte buffer on read`),t.set(c)}catch(e){i.error=e,i.hasError=!0}finally{let e=qn(i);e&&await e}}readSync(e,t,n,r){let i={stack:[],error:void 0,hasError:!1};try{let a=Kn(i,this.transaction(),!1),o=this.findInodeSync(a,e);if(o.size==0)return;let s=a.getSync(o.data,n,r)??_(M(`ENODATA`)),c=a.flag(`partial`)?s:s.subarray(n,r);c.byteLength>t.byteLength&&I(`Trying to place ${c.byteLength} bytes into a ${t.byteLength} byte buffer on read`),t.set(c)}catch(e){i.error=e,i.hasError=!0}finally{qn(i)}}async write(e,t,n){let i={stack:[],error:void 0,hasError:!1};try{let a=Kn(i,this.transaction(),!0),o=await this.findInode(a,e),s=n+t.byteLength,c=t;a.flag(`partial`)||(c=r(await a.get(o.data)??new Uint8Array,s),c.set(t,n),n=0),await a.set(o.data,c,n),o.update({size:Math.max(o.size,s),mtimeMs:Date.now()}),await a.set(o.ino,o),this._add(o.ino,e),await a.commit()}catch(e){i.error=e,i.hasError=!0}finally{let e=qn(i);e&&await e}}writeSync(e,t,n){let i={stack:[],error:void 0,hasError:!1};try{let a=Kn(i,this.transaction(),!1),o=this.findInodeSync(a,e),s=n+t.byteLength,c=t;a.flag(`partial`)||(c=r(a.getSync(o.data)??new Uint8Array,s),c.set(t,n),n=0),a.setSync(o.data,c,n),o.update({size:Math.max(o.size,s),mtimeMs:Date.now()}),a.setSync(o.ino,o),this._add(o.ino,e),a.commitSync()}catch(e){i.error=e,i.hasError=!0}finally{qn(i)}}transaction(){return new Gn(this.store.transaction(),this)}async checkRoot(){let e={stack:[],error:void 0,hasError:!1};try{let t=Kn(e,this.transaction(),!0);if(await t.get(0))return;let n=new K({ino:0,data:1,mode:511|$e});await t.set(n.data,C(`{}`)),this._add(0,`/`),await t.set(0,n),await t.commit()}catch(t){e.error=t,e.hasError=!0}finally{let t=qn(e);t&&await t}}checkRootSync(){let e={stack:[],error:void 0,hasError:!1};try{let t=Kn(e,this.transaction(),!1);if(t.getSync(0))return;let n=new K({ino:0,data:1,mode:511|$e});t.setSync(n.data,C(`{}`)),this._add(0,`/`),t.setSync(0,n),t.commitSync()}catch(t){e.error=t,e.hasError=!0}finally{qn(e)}}async _populate(){let e={stack:[],error:void 0,hasError:!1};try{if(this._initialized){L(`Attempted to populate tables after initialization`);return}pe(`Populating tables with existing store metadata`);let t=Kn(e,this.transaction(),!0),n=await t.get(0);if(!n){de(`Store does not have a root inode`);let e=new K({ino:0,data:1,mode:511|$e});await t.set(e.data,C(`{}`)),this._add(0,`/`),await t.set(0,e),await t.commit();return}if(n.length<B(K)){ue(`Store contains an invalid root inode. Refusing to populate tables`);return}let r=new Set,i=0,a=[[`/`,0]];for(;a.length>0;){i++;let[e,n]=a.shift();this._add(n,e);let o=await t.get(n);if(!o){L(`Store is missing data for inode: `+n);continue}if(o.length<B(K)){L(`Invalid inode size for ino ${n}: ${o.length}`);continue}let s=new K(o);if((s.mode&16384)!=16384||r.has(n))continue;r.add(n);let c=await t.get(s.data);if(!c){L(`Store is missing directory data: `+s.data);continue}let l=qt(c);for(let[t,n]of Object.entries(l))a.push([U(e,t),n])}pe(`Added ${i} existing inode(s) from store`)}catch(t){e.error=t,e.hasError=!0}finally{let t=qn(e);t&&await t}}_populateSync(){let e={stack:[],error:void 0,hasError:!1};try{if(this._initialized){L(`Attempted to populate tables after initialization`);return}pe(`Populating tables with existing store metadata`);let t=Kn(e,this.transaction(),!1),n=t.getSync(0);if(!n){de(`Store does not have a root inode`);let e=new K({ino:0,data:1,mode:511|$e});t.setSync(e.data,C(`{}`)),this._add(0,`/`),t.setSync(0,e),t.commitSync();return}if(n.length<B(K)){ue(`Store contains an invalid root inode. Refusing to populate tables`);return}let r=new Set,i=0,a=[[`/`,0]];for(;a.length>0;){i++;let[e,n]=a.shift();this._add(n,e);let o=t.getSync(n);if(!o){L(`Store is missing data for inode: `+n);continue}if(o.length<B(K)){L(`Invalid inode size for ino ${n}: ${o.length}`);continue}let s=new K(o);if((s.mode&16384)!=16384||r.has(n))continue;r.add(n);let c=t.getSync(s.data);if(!c){L(`Store is missing directory data: `+s.data);continue}let l=qt(c);for(let[t,n]of Object.entries(l))a.push([U(e,t),n])}pe(`Added ${i} existing inode(s) from store`)}catch(t){e.error=t,e.hasError=!0}finally{qn(e)}}async _findInode(e,t,n=new Set){if(n.has(t))throw ue(M(`EIO`,`Infinite loop detected while finding inode`));if(n.add(t),t==`/`)return new K(await e.get(0)??_(M(`ENODATA`)));let{dir:r,base:i}=hn(t),a=await this._findInode(e,r,n),o=qt(await e.get(a.data)??_(M(`ENODATA`)));if(!(i in o))throw M(`ENOENT`);return new K(await e.get(o[i])??_(M(`ENODATA`)))}_findInodeSync(e,t,n=new Set){if(n.has(t))throw ue(M(`EIO`,`Infinite loop detected while finding inode`));if(n.add(t),t==`/`)return new K(e.getSync(0)??_(M(`ENOENT`)));let{dir:r,base:i}=hn(t),a=this._findInodeSync(e,r,n),o=qt(e.getSync(a.data)??_(M(`ENODATA`)));if(!(i in o))throw M(`ENOENT`);return new K(e.getSync(o[i])??_(M(`ENODATA`)))}async findInode(e,t){if(this.attributes.has(`no_id_tables`))return await this._findInode(e,t);let n=this._ids.get(t);if(n===void 0)throw M(`ENOENT`);return new K(await e.get(n)??_(M(`ENOENT`)))}findInodeSync(e,t){if(this.attributes.has(`no_id_tables`))return this._findInodeSync(e,t);let n=this._ids.get(t);if(n===void 0)throw M(`ENOENT`);return new K(e.getSync(n)??_(M(`ENOENT`)))}_lastID;allocNew(e){this._lastID??=Math.max(...this._paths.keys()),this._lastID+=2;let t=this._lastID;if(t>4294967295)throw I(M(`ENOSPC`,`No IDs available`));return this._add(t,e),t}async commitNew(e,t,n){let r={stack:[],error:void 0,hasError:!1};try{if(e==`/`)throw M(`EEXIST`);let i=Kn(r,this.transaction(),!0),{dir:a,base:o}=hn(e),s=await this.findInode(i,a),c=qt(await i.get(s.data)??_(M(`ENOENT`)));if(c[o])throw M(`EEXIST`);let l=this.allocNew(e),u=new K({...t,ino:l,data:l+1,size:n.byteLength,nlink:1});return await i.set(u.ino,u),await i.set(u.data,n),c[o]=u.ino,await i.set(s.data,Jt(c)),await i.commit(),u}catch(e){r.error=e,r.hasError=!0}finally{let e=qn(r);e&&await e}}commitNewSync(e,t,n){let r={stack:[],error:void 0,hasError:!1};try{if(e==`/`)throw M(`EEXIST`);let i=Kn(r,this.transaction(),!1),{dir:a,base:o}=hn(e),s=this.findInodeSync(i,a),c=qt(i.getSync(s.data)??_(M(`ENOENT`)));if(c[o])throw M(`EEXIST`);let l=this.allocNew(e),u=new K({...t,ino:l,data:l+1,size:n.byteLength,nlink:1});return i.setSync(u.ino,u),i.setSync(u.data,n),c[o]=u.ino,i.setSync(s.data,Jt(c)),i.commitSync(),u}catch(e){r.error=e,r.hasError=!0}finally{qn(r)}}async remove(e,t){let n={stack:[],error:void 0,hasError:!1};try{let r=Kn(n,this.transaction(),!0),{dir:i,base:a}=hn(e),o=await this.findInode(r,i),s=qt(await r.get(o.data)??_(M(`ENOENT`)));if(!s[a])throw M(`ENOENT`);let c=s[a],l=new K(await r.get(c)??_(M(`ENOENT`)));if(delete s[a],!t&&q(l))throw M(`EISDIR`);await r.set(o.data,Jt(s)),l.nlink>1?(l.update({nlink:l.nlink-1}),await r.set(l.ino,l)):(await r.remove(l.data),await r.remove(c),this._remove(c)),await r.commit()}catch(e){n.error=e,n.hasError=!0}finally{let e=qn(n);e&&await e}}removeSync(e,t){let n={stack:[],error:void 0,hasError:!1};try{let r=Kn(n,this.transaction(),!1),{dir:i,base:a}=hn(e),o=this.findInodeSync(r,i),s=qt(r.getSync(o.data)??_(M(`ENOENT`))),c=s[a];if(!c)throw M(`ENOENT`);let l=new K(r.getSync(c)??_(M(`ENOENT`)));if(delete s[a],!t&&q(l))throw M(`EISDIR`);r.setSync(o.data,Jt(s)),l.nlink>1?(l.update({nlink:l.nlink-1}),r.setSync(l.ino,l)):(r.removeSync(l.data),r.removeSync(c),this._remove(c)),r.commitSync()}catch(e){n.error=e,n.hasError=!0}finally{qn(n)}}},Yn=class extends Un{async keys(){return this.store.keys()}async get(e){return await(this.store.getAsync?.(e)??this.store.get(e))}getSync(e){return this.store.get(e)}setSync(e,t){this.store.set(e,t)}removeSync(e){this.store.delete(e)}},Xn=class extends Wn{async keys(){return await this.asyncDone,this.store.keys()}async get(e,t,n){return await this.asyncDone,await this.store.get(e,t,n)}getSync(e,t,n){return this.store.cached(e,t,n)}async set(e,t,n=0){await this.asyncDone,await this.store.set(e,t,n)}async remove(e){await this.asyncDone,await this.store.delete(e)}},Zn=class extends Map{maxSize;label;flags=[];name=`tmpfs`;constructor(e=it,t){super(),this.maxSize=e,this.label=t}async sync(){}transaction(){return new Yn(this)}get bytes(){let e=this.size*4;for(let t of this.values())e+=t.byteLength;return e}usage(){return{totalSpace:this.maxSize,freeSpace:this.maxSize-this.bytes}}},Qn={name:`InMemory`,options:{maxSize:{type:`number`,required:!1},label:{type:`string`,required:!1}},create({maxSize:e,label:t}){let n=new Jn(new Zn(e,t));return n.checkRootSync(),n}},$n=class extends Jn{devices=new Map;devicesWithDriver(e,t){if(t&&typeof e==`string`)throw I(M(`EINVAL`,`Can not fetch devices using only a driver name`));let n=[];for(let r of this.devices.values())t&&r.driver!=e||(typeof e==`string`?e:e.name)==r.driver.name&&n.push(r);return n}_createDevice(e,t={}){let n=1,r=Array.from(this.devices.values()).at(-1);for(;this.store.has(n)||r?.inode.ino==n;)n++;let i=e.init?.(n,t),a={data:{},minor:0,major:0,...f(i??{},`metadata`),driver:e,inode:new K({mode:et|438,...i?.metadata})},o=`/`+(a.name||e.name)+(e.singleton?``:this.devicesWithDriver(e).length);if(this.existsSync(o))throw M(`EEXIST`);return this.devices.set(o,a),fe(`Initialized device: `+this._mountPoint+o),a}addDefaults(){this._createDevice(tr),this._createDevice(nr),this._createDevice(rr),this._createDevice(ir),this._createDevice(ar),pe(`Added default devices`)}constructor(){super(new Zn(16777216,`devfs`))}async rename(e,t){if(this.devices.has(e))throw M(`EPERM`);if(this.devices.has(t))throw M(`EEXIST`);return super.rename(e,t)}renameSync(e,t){if(this.devices.has(e))throw M(`EPERM`);if(this.devices.has(t))throw M(`EEXIST`);return super.renameSync(e,t)}async stat(e){let t=this.devices.get(e);return t?t.inode:super.stat(e)}statSync(e){let t=this.devices.get(e);return t?t.inode:super.statSync(e)}async touch(e,t){let n=this.devices.get(e);n?n.inode.update(t):await super.touch(e,t)}touchSync(e,t){let n=this.devices.get(e);n?n.inode.update(t):super.touchSync(e,t)}async createFile(e,t){if(this.devices.has(e))throw M(`EEXIST`);return super.createFile(e,t)}createFileSync(e,t){if(this.devices.has(e))throw M(`EEXIST`);return super.createFileSync(e,t)}async unlink(e){if(this.devices.has(e))throw M(`EPERM`);return super.unlink(e)}unlinkSync(e){if(this.devices.has(e))throw M(`EPERM`);return super.unlinkSync(e)}async rmdir(e){return super.rmdir(e)}rmdirSync(e){return super.rmdirSync(e)}async mkdir(e,t){if(this.devices.has(e))throw M(`EEXIST`);return super.mkdir(e,t)}mkdirSync(e,t){if(this.devices.has(e))throw M(`EEXIST`);return super.mkdirSync(e,t)}async readdir(e){let t=await super.readdir(e);for(let n of this.devices.keys())W(n)==e&&t.push(fn(n));return t}readdirSync(e){let t=super.readdirSync(e);for(let n of this.devices.keys())W(n)==e&&t.push(fn(n));return t}async link(e,t){if(this.devices.has(e))throw M(`EPERM`);if(this.devices.has(t))throw M(`EEXIST`);return super.link(e,t)}linkSync(e,t){if(this.devices.has(e))throw M(`EPERM`);if(this.devices.has(t))throw M(`EEXIST`);return super.linkSync(e,t)}async sync(){for(let e of this.devices.values())e.driver.sync?.(e);return super.sync()}syncSync(){for(let e of this.devices.values())e.driver.sync?.(e);return super.syncSync()}async read(e,t,n,r){let i=this.devices.get(e);if(!i){await super.read(e,t,n,r);return}i.driver.read(i,t,n,r)}readSync(e,t,n,r){let i=this.devices.get(e);if(!i){super.readSync(e,t,n,r);return}i.driver.read(i,t,n,r)}async write(e,t,n){let r=this.devices.get(e);if(!r)return await super.write(e,t,n);r.driver.write(r,t,n)}writeSync(e,t,n){let r=this.devices.get(e);if(!r)return super.writeSync(e,t,n);r.driver.write(r,t,n)}},er=new Uint8Array,tr={name:`null`,singleton:!0,init(){return{major:1,minor:3}},read(){return er},write(){}},nr={name:`zero`,singleton:!0,init(){return{major:1,minor:5}},read(e,t,n,r){t.fill(0,n,r)},write(){}},rr={name:`full`,singleton:!0,init(){return{major:1,minor:7}},read(e,t,n,r){t.fill(0,n,r)},write(){throw M(`ENOSPC`)}},ir={name:`random`,singleton:!0,init(){return{major:1,minor:8}},read(e,t){for(let e=0;e<t.length;e++)t[e]=Math.floor(Math.random()*256)},write(){}},ar={name:`console`,singleton:!0,init(e,{output:t=e=>console.log(e)}={}){return{major:5,minor:1,data:{output:t}}},read(){return er},write(e,t,n){let r=T(t);e.data.output(r,n)}},or={null:tr,zero:nr,full:rr,random:ir,console:ar},sr=n((e=>{e.byteLength=c,e.toByteArray=u,e.fromByteArray=p;for(var t=[],n=[],r=typeof Uint8Array<`u`?Uint8Array:Array,i=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,a=0,o=i.length;a<o;++a)t[a]=i[a],n[i.charCodeAt(a)]=a;n[45]=62,n[95]=63;function s(e){var t=e.length;if(t%4>0)throw Error(`Invalid string. Length must be a multiple of 4`);var n=e.indexOf(`=`);n===-1&&(n=t);var r=n===t?0:4-n%4;return[n,r]}function c(e){var t=s(e),n=t[0],r=t[1];return(n+r)*3/4-r}function l(e,t,n){return(t+n)*3/4-n}function u(e){var t,i=s(e),a=i[0],o=i[1],c=new r(l(e,a,o)),u=0,d=o>0?a-4:a,f;for(f=0;f<d;f+=4)t=n[e.charCodeAt(f)]<<18|n[e.charCodeAt(f+1)]<<12|n[e.charCodeAt(f+2)]<<6|n[e.charCodeAt(f+3)],c[u++]=t>>16&255,c[u++]=t>>8&255,c[u++]=t&255;return o===2&&(t=n[e.charCodeAt(f)]<<2|n[e.charCodeAt(f+1)]>>4,c[u++]=t&255),o===1&&(t=n[e.charCodeAt(f)]<<10|n[e.charCodeAt(f+1)]<<4|n[e.charCodeAt(f+2)]>>2,c[u++]=t>>8&255,c[u++]=t&255),c}function d(e){return t[e>>18&63]+t[e>>12&63]+t[e>>6&63]+t[e&63]}function f(e,t,n){for(var r,i=[],a=t;a<n;a+=3)r=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(e[a+2]&255),i.push(d(r));return i.join(``)}function p(e){for(var n,r=e.length,i=r%3,a=[],o=16383,s=0,c=r-i;s<c;s+=o)a.push(f(e,s,s+o>c?c:s+o));return i===1?(n=e[r-1],a.push(t[n>>2]+t[n<<4&63]+`==`)):i===2&&(n=(e[r-2]<<8)+e[r-1],a.push(t[n>>10]+t[n>>4&63]+t[n<<2&63]+`=`)),a.join(``)}})),cr=n((e=>{e.read=function(e,t,n,r,i){var a,o,s=i*8-r-1,c=(1<<s)-1,l=c>>1,u=-7,d=n?i-1:0,f=n?-1:1,p=e[t+d];for(d+=f,a=p&(1<<-u)-1,p>>=-u,u+=s;u>0;a=a*256+e[t+d],d+=f,u-=8);for(o=a&(1<<-u)-1,a>>=-u,u+=r;u>0;o=o*256+e[t+d],d+=f,u-=8);if(a===0)a=1-l;else if(a===c)return o?NaN:(p?-1:1)*(1/0);else o+=2**r,a-=l;return(p?-1:1)*o*2**(a-r)},e.write=function(e,t,n,r,i,a){var o,s,c,l=a*8-i-1,u=(1<<l)-1,d=u>>1,f=i===23?2**-24-2**-77:0,p=r?0:a-1,m=r?1:-1,h=+(t<0||t===0&&1/t<0);for(t=Math.abs(t),isNaN(t)||t===1/0?(s=+!!isNaN(t),o=u):(o=Math.floor(Math.log(t)/Math.LN2),t*(c=2**-o)<1&&(o--,c*=2),o+d>=1?t+=f/c:t+=f*2**(1-d),t*c>=2&&(o++,c/=2),o+d>=u?(s=0,o=u):o+d>=1?(s=(t*c-1)*2**i,o+=d):(s=t*2**(d-1)*2**i,o=0));i>=8;e[n+p]=s&255,p+=m,s/=256,i-=8);for(o=o<<i|s,l+=i;l>0;e[n+p]=o&255,p+=m,o/=256,l-=8);e[n+p-m]|=h*128}})),lr=n((e=>{var t=sr(),n=cr(),r=typeof Symbol==`function`&&typeof Symbol.for==`function`?Symbol.for(`nodejs.util.inspect.custom`):null;e.Buffer=s,e.SlowBuffer=v,e.INSPECT_MAX_BYTES=50;var i=2147483647;e.kMaxLength=i,s.TYPED_ARRAY_SUPPORT=a(),!s.TYPED_ARRAY_SUPPORT&&typeof console<`u`&&typeof console.error==`function`&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function a(){try{let e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),e.foo()===42}catch{return!1}}Object.defineProperty(s.prototype,"parent",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.buffer}}),Object.defineProperty(s.prototype,"offset",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.byteOffset}});function o(e){if(e>i)throw RangeError(`The value "`+e+`" is invalid for option "size"`);let t=new Uint8Array(e);return Object.setPrototypeOf(t,s.prototype),t}function s(e,t,n){if(typeof e==`number`){if(typeof t==`string`)throw TypeError(`The "string" argument must be of type string. Received type number`);return d(e)}return c(e,t,n)}s.poolSize=8192;function c(e,t,n){if(typeof e==`string`)return f(e,t);if(ArrayBuffer.isView(e))return m(e);if(e==null)throw TypeError(`The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type `+typeof e);if(R(e,ArrayBuffer)||e&&R(e.buffer,ArrayBuffer)||typeof SharedArrayBuffer<`u`&&(R(e,SharedArrayBuffer)||e&&R(e.buffer,SharedArrayBuffer)))return h(e,t,n);if(typeof e==`number`)throw TypeError(`The "value" argument must not be of type number. Received type number`);let r=e.valueOf&&e.valueOf();if(r!=null&&r!==e)return s.from(r,t,n);let i=g(e);if(i)return i;if(typeof Symbol<`u`&&Symbol.toPrimitive!=null&&typeof e[Symbol.toPrimitive]==`function`)return s.from(e[Symbol.toPrimitive](`string`),t,n);throw TypeError(`The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type `+typeof e)}s.from=function(e,t,n){return c(e,t,n)},Object.setPrototypeOf(s.prototype,Uint8Array.prototype),Object.setPrototypeOf(s,Uint8Array);function l(e){if(typeof e!=`number`)throw TypeError(`"size" argument must be of type number`);if(e<0)throw RangeError(`The value "`+e+`" is invalid for option "size"`)}function u(e,t,n){return l(e),e<=0||t===void 0?o(e):typeof n==`string`?o(e).fill(t,n):o(e).fill(t)}s.alloc=function(e,t,n){return u(e,t,n)};function d(e){return l(e),o(e<0?0:_(e)|0)}s.allocUnsafe=function(e){return d(e)},s.allocUnsafeSlow=function(e){return d(e)};function f(e,t){if((typeof t!=`string`||t===``)&&(t=`utf8`),!s.isEncoding(t))throw TypeError(`Unknown encoding: `+t);let n=y(e,t)|0,r=o(n),i=r.write(e,t);return i!==n&&(r=r.slice(0,i)),r}function p(e){let t=e.length<0?0:_(e.length)|0,n=o(t);for(let r=0;r<t;r+=1)n[r]=e[r]&255;return n}function m(e){if(R(e,Uint8Array)){let t=new Uint8Array(e);return h(t.buffer,t.byteOffset,t.byteLength)}return p(e)}function h(e,t,n){if(t<0||e.byteLength<t)throw RangeError(`"offset" is outside of buffer bounds`);if(e.byteLength<t+(n||0))throw RangeError(`"length" is outside of buffer bounds`);let r;return r=t===void 0&&n===void 0?new Uint8Array(e):n===void 0?new Uint8Array(e,t):new Uint8Array(e,t,n),Object.setPrototypeOf(r,s.prototype),r}function g(e){if(s.isBuffer(e)){let t=_(e.length)|0,n=o(t);return n.length===0||e.copy(n,0,0,t),n}if(e.length!==void 0)return typeof e.length!=`number`||be(e.length)?o(0):p(e);if(e.type===`Buffer`&&Array.isArray(e.data))return p(e.data)}function _(e){if(e>=i)throw RangeError(`Attempt to allocate Buffer larger than maximum size: 0x`+i.toString(16)+` bytes`);return e|0}function v(e){return+e!=e&&(e=0),s.alloc(+e)}s.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==s.prototype},s.compare=function(e,t){if(R(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),R(t,Uint8Array)&&(t=s.from(t,t.offset,t.byteLength)),!s.isBuffer(e)||!s.isBuffer(t))throw TypeError(`The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array`);if(e===t)return 0;let n=e.length,r=t.length;for(let i=0,a=Math.min(n,r);i<a;++i)if(e[i]!==t[i]){n=e[i],r=t[i];break}return n<r?-1:+(r<n)},s.isEncoding=function(e){switch(String(e).toLowerCase()){case`hex`:case`utf8`:case`utf-8`:case`ascii`:case`latin1`:case`binary`:case`base64`:case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return!0;default:return!1}},s.concat=function(e,t){if(!Array.isArray(e))throw TypeError(`"list" argument must be an Array of Buffers`);if(e.length===0)return s.alloc(0);let n;if(t===void 0)for(t=0,n=0;n<e.length;++n)t+=e[n].length;let r=s.allocUnsafe(t),i=0;for(n=0;n<e.length;++n){let t=e[n];if(R(t,Uint8Array))i+t.length>r.length?(s.isBuffer(t)||(t=s.from(t)),t.copy(r,i)):Uint8Array.prototype.set.call(r,t,i);else if(s.isBuffer(t))t.copy(r,i);else throw TypeError(`"list" argument must be an Array of Buffers`);i+=t.length}return r};function y(e,t){if(s.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||R(e,ArrayBuffer))return e.byteLength;if(typeof e!=`string`)throw TypeError(`The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type `+typeof e);let n=e.length,r=arguments.length>2&&arguments[2]===!0;if(!r&&n===0)return 0;let i=!1;for(;;)switch(t){case`ascii`:case`latin1`:case`binary`:return n;case`utf8`:case`utf-8`:return he(e).length;case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return n*2;case`hex`:return n>>>1;case`base64`:return ve(e).length;default:if(i)return r?-1:he(e).length;t=(``+t).toLowerCase(),i=!0}}s.byteLength=y;function b(e,t,n){let r=!1;if((t===void 0||t<0)&&(t=0),t>this.length||((n===void 0||n>this.length)&&(n=this.length),n<=0)||(n>>>=0,t>>>=0,n<=t))return``;for(e||=`utf8`;;)switch(e){case`hex`:return M(this,t,n);case`utf8`:case`utf-8`:return O(this,t,n);case`ascii`:return A(this,t,n);case`latin1`:case`binary`:return j(this,t,n);case`base64`:return D(this,t,n);case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return N(this,t,n);default:if(r)throw TypeError(`Unknown encoding: `+e);e=(e+``).toLowerCase(),r=!0}}s.prototype._isBuffer=!0;function x(e,t,n){let r=e[t];e[t]=e[n],e[n]=r}s.prototype.swap16=function(){let e=this.length;if(e%2!=0)throw RangeError(`Buffer size must be a multiple of 16-bits`);for(let t=0;t<e;t+=2)x(this,t,t+1);return this},s.prototype.swap32=function(){let e=this.length;if(e%4!=0)throw RangeError(`Buffer size must be a multiple of 32-bits`);for(let t=0;t<e;t+=4)x(this,t,t+3),x(this,t+1,t+2);return this},s.prototype.swap64=function(){let e=this.length;if(e%8!=0)throw RangeError(`Buffer size must be a multiple of 64-bits`);for(let t=0;t<e;t+=8)x(this,t,t+7),x(this,t+1,t+6),x(this,t+2,t+5),x(this,t+3,t+4);return this},s.prototype.toString=function(){let e=this.length;return e===0?``:arguments.length===0?O(this,0,e):b.apply(this,arguments)},s.prototype.toLocaleString=s.prototype.toString,s.prototype.equals=function(e){if(!s.isBuffer(e))throw TypeError(`Argument must be a Buffer`);return this===e||s.compare(this,e)===0},s.prototype.inspect=function(){let t=``,n=e.INSPECT_MAX_BYTES;return t=this.toString(`hex`,0,n).replace(/(.{2})/g,`$1 `).trim(),this.length>n&&(t+=` ... `),`<Buffer `+t+`>`},r&&(s.prototype[r]=s.prototype.inspect),s.prototype.compare=function(e,t,n,r,i){if(R(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),!s.isBuffer(e))throw TypeError(`The "target" argument must be one of type Buffer or Uint8Array. Received type `+typeof e);if(t===void 0&&(t=0),n===void 0&&(n=e?e.length:0),r===void 0&&(r=0),i===void 0&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw RangeError(`out of range index`);if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(t>>>=0,n>>>=0,r>>>=0,i>>>=0,this===e)return 0;let a=i-r,o=n-t,c=Math.min(a,o),l=this.slice(r,i),u=e.slice(t,n);for(let e=0;e<c;++e)if(l[e]!==u[e]){a=l[e],o=u[e];break}return a<o?-1:+(o<a)};function S(e,t,n,r,i){if(e.length===0)return-1;if(typeof n==`string`?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,be(n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0)if(i)n=0;else return-1;if(typeof t==`string`&&(t=s.from(t,r)),s.isBuffer(t))return t.length===0?-1:C(e,t,n,r,i);if(typeof t==`number`)return t&=255,typeof Uint8Array.prototype.indexOf==`function`?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):C(e,[t],n,r,i);throw TypeError(`val must be string, number or Buffer`)}function C(e,t,n,r,i){let a=1,o=e.length,s=t.length;if(r!==void 0&&(r=String(r).toLowerCase(),r===`ucs2`||r===`ucs-2`||r===`utf16le`||r===`utf-16le`)){if(e.length<2||t.length<2)return-1;a=2,o/=2,s/=2,n/=2}function c(e,t){return a===1?e[t]:e.readUInt16BE(t*a)}let l;if(i){let r=-1;for(l=n;l<o;l++)if(c(e,l)===c(t,r===-1?0:l-r)){if(r===-1&&(r=l),l-r+1===s)return r*a}else r!==-1&&(l-=l-r),r=-1}else for(n+s>o&&(n=o-s),l=n;l>=0;l--){let n=!0;for(let r=0;r<s;r++)if(c(e,l+r)!==c(t,r)){n=!1;break}if(n)return l}return-1}s.prototype.includes=function(e,t,n){return this.indexOf(e,t,n)!==-1},s.prototype.indexOf=function(e,t,n){return S(this,e,t,n,!0)},s.prototype.lastIndexOf=function(e,t,n){return S(this,e,t,n,!1)};function w(e,t,n,r){n=Number(n)||0;let i=e.length-n;r?(r=Number(r),r>i&&(r=i)):r=i;let a=t.length;r>a/2&&(r=a/2);let o;for(o=0;o<r;++o){let r=parseInt(t.substr(o*2,2),16);if(be(r))return o;e[n+o]=r}return o}function T(e,t,n,r){return ye(he(t,e.length-n),e,n,r)}function ee(e,t,n,r){return ye(ge(t),e,n,r)}function E(e,t,n,r){return ye(ve(t),e,n,r)}function te(e,t,n,r){return ye(_e(t,e.length-n),e,n,r)}s.prototype.write=function(e,t,n,r){if(t===void 0)r=`utf8`,n=this.length,t=0;else if(n===void 0&&typeof t==`string`)r=t,n=this.length,t=0;else if(isFinite(t))t>>>=0,isFinite(n)?(n>>>=0,r===void 0&&(r=`utf8`)):(r=n,n=void 0);else throw Error(`Buffer.write(string, encoding, offset[, length]) is no longer supported`);let i=this.length-t;if((n===void 0||n>i)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw RangeError(`Attempt to write outside buffer bounds`);r||=`utf8`;let a=!1;for(;;)switch(r){case`hex`:return w(this,e,t,n);case`utf8`:case`utf-8`:return T(this,e,t,n);case`ascii`:case`latin1`:case`binary`:return ee(this,e,t,n);case`base64`:return E(this,e,t,n);case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return te(this,e,t,n);default:if(a)throw TypeError(`Unknown encoding: `+r);r=(``+r).toLowerCase(),a=!0}},s.prototype.toJSON=function(){return{type:`Buffer`,data:Array.prototype.slice.call(this._arr||this,0)}};function D(e,n,r){return n===0&&r===e.length?t.fromByteArray(e):t.fromByteArray(e.slice(n,r))}function O(e,t,n){n=Math.min(e.length,n);let r=[],i=t;for(;i<n;){let t=e[i],a=null,o=t>239?4:t>223?3:t>191?2:1;if(i+o<=n){let n,r,s,c;switch(o){case 1:t<128&&(a=t);break;case 2:n=e[i+1],(n&192)==128&&(c=(t&31)<<6|n&63,c>127&&(a=c));break;case 3:n=e[i+1],r=e[i+2],(n&192)==128&&(r&192)==128&&(c=(t&15)<<12|(n&63)<<6|r&63,c>2047&&(c<55296||c>57343)&&(a=c));break;case 4:n=e[i+1],r=e[i+2],s=e[i+3],(n&192)==128&&(r&192)==128&&(s&192)==128&&(c=(t&15)<<18|(n&63)<<12|(r&63)<<6|s&63,c>65535&&c<1114112&&(a=c))}}a===null?(a=65533,o=1):a>65535&&(a-=65536,r.push(a>>>10&1023|55296),a=56320|a&1023),r.push(a),i+=o}return k(r)}var ne=4096;function k(e){let t=e.length;if(t<=ne)return String.fromCharCode.apply(String,e);let n=``,r=0;for(;r<t;)n+=String.fromCharCode.apply(String,e.slice(r,r+=ne));return n}function A(e,t,n){let r=``;n=Math.min(e.length,n);for(let i=t;i<n;++i)r+=String.fromCharCode(e[i]&127);return r}function j(e,t,n){let r=``;n=Math.min(e.length,n);for(let i=t;i<n;++i)r+=String.fromCharCode(e[i]);return r}function M(e,t,n){let r=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>r)&&(n=r);let i=``;for(let r=t;r<n;++r)i+=z[e[r]];return i}function N(e,t,n){let r=e.slice(t,n),i=``;for(let e=0;e<r.length-1;e+=2)i+=String.fromCharCode(r[e]+r[e+1]*256);return i}s.prototype.slice=function(e,t){let n=this.length;e=~~e,t=t===void 0?n:~~t,e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),t<0?(t+=n,t<0&&(t=0)):t>n&&(t=n),t<e&&(t=e);let r=this.subarray(e,t);return Object.setPrototypeOf(r,s.prototype),r};function P(e,t,n){if(e%1!=0||e<0)throw RangeError(`offset is not uint`);if(e+t>n)throw RangeError(`Trying to access beyond buffer length`)}s.prototype.readUintLE=s.prototype.readUIntLE=function(e,t,n){e>>>=0,t>>>=0,n||P(e,t,this.length);let r=this[e],i=1,a=0;for(;++a<t&&(i*=256);)r+=this[e+a]*i;return r},s.prototype.readUintBE=s.prototype.readUIntBE=function(e,t,n){e>>>=0,t>>>=0,n||P(e,t,this.length);let r=this[e+--t],i=1;for(;t>0&&(i*=256);)r+=this[e+--t]*i;return r},s.prototype.readUint8=s.prototype.readUInt8=function(e,t){return e>>>=0,t||P(e,1,this.length),this[e]},s.prototype.readUint16LE=s.prototype.readUInt16LE=function(e,t){return e>>>=0,t||P(e,2,this.length),this[e]|this[e+1]<<8},s.prototype.readUint16BE=s.prototype.readUInt16BE=function(e,t){return e>>>=0,t||P(e,2,this.length),this[e]<<8|this[e+1]},s.prototype.readUint32LE=s.prototype.readUInt32LE=function(e,t){return e>>>=0,t||P(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216},s.prototype.readUint32BE=s.prototype.readUInt32BE=function(e,t){return e>>>=0,t||P(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])},s.prototype.readBigUInt64LE=xe(function(e){e>>>=0,de(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&fe(e,this.length-8);let r=t+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24,i=this[++e]+this[++e]*2**8+this[++e]*2**16+n*2**24;return BigInt(r)+(BigInt(i)<<BigInt(32))}),s.prototype.readBigUInt64BE=xe(function(e){e>>>=0,de(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&fe(e,this.length-8);let r=t*2**24+this[++e]*2**16+this[++e]*2**8+this[++e],i=this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+n;return(BigInt(r)<<BigInt(32))+BigInt(i)}),s.prototype.readIntLE=function(e,t,n){e>>>=0,t>>>=0,n||P(e,t,this.length);let r=this[e],i=1,a=0;for(;++a<t&&(i*=256);)r+=this[e+a]*i;return i*=128,r>=i&&(r-=2**(8*t)),r},s.prototype.readIntBE=function(e,t,n){e>>>=0,t>>>=0,n||P(e,t,this.length);let r=t,i=1,a=this[e+--r];for(;r>0&&(i*=256);)a+=this[e+--r]*i;return i*=128,a>=i&&(a-=2**(8*t)),a},s.prototype.readInt8=function(e,t){return e>>>=0,t||P(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]},s.prototype.readInt16LE=function(e,t){e>>>=0,t||P(e,2,this.length);let n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n},s.prototype.readInt16BE=function(e,t){e>>>=0,t||P(e,2,this.length);let n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n},s.prototype.readInt32LE=function(e,t){return e>>>=0,t||P(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},s.prototype.readInt32BE=function(e,t){return e>>>=0,t||P(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},s.prototype.readBigInt64LE=xe(function(e){e>>>=0,de(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&fe(e,this.length-8);let r=this[e+4]+this[e+5]*2**8+this[e+6]*2**16+(n<<24);return(BigInt(r)<<BigInt(32))+BigInt(t+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24)}),s.prototype.readBigInt64BE=xe(function(e){e>>>=0,de(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&fe(e,this.length-8);let r=(t<<24)+this[++e]*2**16+this[++e]*2**8+this[++e];return(BigInt(r)<<BigInt(32))+BigInt(this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+n)}),s.prototype.readFloatLE=function(e,t){return e>>>=0,t||P(e,4,this.length),n.read(this,e,!0,23,4)},s.prototype.readFloatBE=function(e,t){return e>>>=0,t||P(e,4,this.length),n.read(this,e,!1,23,4)},s.prototype.readDoubleLE=function(e,t){return e>>>=0,t||P(e,8,this.length),n.read(this,e,!0,52,8)},s.prototype.readDoubleBE=function(e,t){return e>>>=0,t||P(e,8,this.length),n.read(this,e,!1,52,8)};function F(e,t,n,r,i,a){if(!s.isBuffer(e))throw TypeError(`"buffer" argument must be a Buffer instance`);if(t>i||t<a)throw RangeError(`"value" argument is out of bounds`);if(n+r>e.length)throw RangeError(`Index out of range`)}s.prototype.writeUintLE=s.prototype.writeUIntLE=function(e,t,n,r){if(e=+e,t>>>=0,n>>>=0,!r){let r=2**(8*n)-1;F(this,e,t,n,r,0)}let i=1,a=0;for(this[t]=e&255;++a<n&&(i*=256);)this[t+a]=e/i&255;return t+n},s.prototype.writeUintBE=s.prototype.writeUIntBE=function(e,t,n,r){if(e=+e,t>>>=0,n>>>=0,!r){let r=2**(8*n)-1;F(this,e,t,n,r,0)}let i=n-1,a=1;for(this[t+i]=e&255;--i>=0&&(a*=256);)this[t+i]=e/a&255;return t+n},s.prototype.writeUint8=s.prototype.writeUInt8=function(e,t,n){return e=+e,t>>>=0,n||F(this,e,t,1,255,0),this[t]=e&255,t+1},s.prototype.writeUint16LE=s.prototype.writeUInt16LE=function(e,t,n){return e=+e,t>>>=0,n||F(this,e,t,2,65535,0),this[t]=e&255,this[t+1]=e>>>8,t+2},s.prototype.writeUint16BE=s.prototype.writeUInt16BE=function(e,t,n){return e=+e,t>>>=0,n||F(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=e&255,t+2},s.prototype.writeUint32LE=s.prototype.writeUInt32LE=function(e,t,n){return e=+e,t>>>=0,n||F(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=e&255,t+4},s.prototype.writeUint32BE=s.prototype.writeUInt32BE=function(e,t,n){return e=+e,t>>>=0,n||F(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4};function re(e,t,n,r,i){L(t,r,i,e,n,7);let a=Number(t&BigInt(4294967295));e[n++]=a,a>>=8,e[n++]=a,a>>=8,e[n++]=a,a>>=8,e[n++]=a;let o=Number(t>>BigInt(32)&BigInt(4294967295));return e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o,n}function ie(e,t,n,r,i){L(t,r,i,e,n,7);let a=Number(t&BigInt(4294967295));e[n+7]=a,a>>=8,e[n+6]=a,a>>=8,e[n+5]=a,a>>=8,e[n+4]=a;let o=Number(t>>BigInt(32)&BigInt(4294967295));return e[n+3]=o,o>>=8,e[n+2]=o,o>>=8,e[n+1]=o,o>>=8,e[n]=o,n+8}s.prototype.writeBigUInt64LE=xe(function(e,t=0){return re(this,e,t,BigInt(0),BigInt(`0xffffffffffffffff`))}),s.prototype.writeBigUInt64BE=xe(function(e,t=0){return ie(this,e,t,BigInt(0),BigInt(`0xffffffffffffffff`))}),s.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t>>>=0,!r){let r=2**(8*n-1);F(this,e,t,n,r-1,-r)}let i=0,a=1,o=0;for(this[t]=e&255;++i<n&&(a*=256);)e<0&&o===0&&this[t+i-1]!==0&&(o=1),this[t+i]=(e/a>>0)-o&255;return t+n},s.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t>>>=0,!r){let r=2**(8*n-1);F(this,e,t,n,r-1,-r)}let i=n-1,a=1,o=0;for(this[t+i]=e&255;--i>=0&&(a*=256);)e<0&&o===0&&this[t+i+1]!==0&&(o=1),this[t+i]=(e/a>>0)-o&255;return t+n},s.prototype.writeInt8=function(e,t,n){return e=+e,t>>>=0,n||F(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=e&255,t+1},s.prototype.writeInt16LE=function(e,t,n){return e=+e,t>>>=0,n||F(this,e,t,2,32767,-32768),this[t]=e&255,this[t+1]=e>>>8,t+2},s.prototype.writeInt16BE=function(e,t,n){return e=+e,t>>>=0,n||F(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=e&255,t+2},s.prototype.writeInt32LE=function(e,t,n){return e=+e,t>>>=0,n||F(this,e,t,4,2147483647,-2147483648),this[t]=e&255,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},s.prototype.writeInt32BE=function(e,t,n){return e=+e,t>>>=0,n||F(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4},s.prototype.writeBigInt64LE=xe(function(e,t=0){return re(this,e,t,-BigInt(`0x8000000000000000`),BigInt(`0x7fffffffffffffff`))}),s.prototype.writeBigInt64BE=xe(function(e,t=0){return ie(this,e,t,-BigInt(`0x8000000000000000`),BigInt(`0x7fffffffffffffff`))});function ae(e,t,n,r,i,a){if(n+r>e.length||n<0)throw RangeError(`Index out of range`)}function oe(e,t,r,i,a){return t=+t,r>>>=0,a||ae(e,t,r,4,34028234663852886e22,-34028234663852886e22),n.write(e,t,r,i,23,4),r+4}s.prototype.writeFloatLE=function(e,t,n){return oe(this,e,t,!0,n)},s.prototype.writeFloatBE=function(e,t,n){return oe(this,e,t,!1,n)};function se(e,t,r,i,a){return t=+t,r>>>=0,a||ae(e,t,r,8,17976931348623157e292,-17976931348623157e292),n.write(e,t,r,i,52,8),r+8}s.prototype.writeDoubleLE=function(e,t,n){return se(this,e,t,!0,n)},s.prototype.writeDoubleBE=function(e,t,n){return se(this,e,t,!1,n)},s.prototype.copy=function(e,t,n,r){if(!s.isBuffer(e))throw TypeError(`argument should be a Buffer`);if(n||=0,!r&&r!==0&&(r=this.length),t>=e.length&&(t=e.length),t||=0,r>0&&r<n&&(r=n),r===n||e.length===0||this.length===0)return 0;if(t<0)throw RangeError(`targetStart out of bounds`);if(n<0||n>=this.length)throw RangeError(`Index out of range`);if(r<0)throw RangeError(`sourceEnd out of bounds`);r>this.length&&(r=this.length),e.length-t<r-n&&(r=e.length-t+n);let i=r-n;return this===e&&typeof Uint8Array.prototype.copyWithin==`function`?this.copyWithin(t,n,r):Uint8Array.prototype.set.call(e,this.subarray(n,r),t),i},s.prototype.fill=function(e,t,n,r){if(typeof e==`string`){if(typeof t==`string`?(r=t,t=0,n=this.length):typeof n==`string`&&(r=n,n=this.length),r!==void 0&&typeof r!=`string`)throw TypeError(`encoding must be a string`);if(typeof r==`string`&&!s.isEncoding(r))throw TypeError(`Unknown encoding: `+r);if(e.length===1){let t=e.charCodeAt(0);(r===`utf8`&&t<128||r===`latin1`)&&(e=t)}}else typeof e==`number`?e&=255:typeof e==`boolean`&&(e=Number(e));if(t<0||this.length<t||this.length<n)throw RangeError(`Out of range index`);if(n<=t)return this;t>>>=0,n=n===void 0?this.length:n>>>0,e||=0;let i;if(typeof e==`number`)for(i=t;i<n;++i)this[i]=e;else{let a=s.isBuffer(e)?e:s.from(e,r),o=a.length;if(o===0)throw TypeError(`The value "`+e+`" is invalid for argument "value"`);for(i=0;i<n-t;++i)this[i+t]=a[i%o]}return this};var ce={};function le(e,t,n){ce[e]=class extends n{constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name}get code(){return e}set code(e){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:e,writable:!0})}toString(){return`${this.name} [${e}]: ${this.message}`}}}le(`ERR_BUFFER_OUT_OF_BOUNDS`,function(e){return e?`${e} is outside of buffer bounds`:`Attempt to access memory outside buffer bounds`},RangeError),le(`ERR_INVALID_ARG_TYPE`,function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`},TypeError),le(`ERR_OUT_OF_RANGE`,function(e,t,n){let r=`The value of "${e}" is out of range.`,i=n;return Number.isInteger(n)&&Math.abs(n)>2**32?i=ue(String(n)):typeof n==`bigint`&&(i=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(i=ue(i)),i+=`n`),r+=` It must be ${t}. Received ${i}`,r},RangeError);function ue(e){let t=``,n=e.length,r=+(e[0]===`-`);for(;n>=r+4;n-=3)t=`_${e.slice(n-3,n)}${t}`;return`${e.slice(0,n)}${t}`}function I(e,t,n){de(t,`offset`),(e[t]===void 0||e[t+n]===void 0)&&fe(t,e.length-(n+1))}function L(e,t,n,r,i,a){if(e>n||e<t){let r=typeof t==`bigint`?`n`:``,i;throw i=a>3?t===0||t===BigInt(0)?`>= 0${r} and < 2${r} ** ${(a+1)*8}${r}`:`>= -(2${r} ** ${(a+1)*8-1}${r}) and < 2 ** ${(a+1)*8-1}${r}`:`>= ${t}${r} and <= ${n}${r}`,new ce.ERR_OUT_OF_RANGE(`value`,i,e)}I(r,i,a)}function de(e,t){if(typeof e!=`number`)throw new ce.ERR_INVALID_ARG_TYPE(t,`number`,e)}function fe(e,t,n){throw Math.floor(e)===e?t<0?new ce.ERR_BUFFER_OUT_OF_BOUNDS:new ce.ERR_OUT_OF_RANGE(n||`offset`,`>= ${+!!n} and <= ${t}`,e):(de(e,n),new ce.ERR_OUT_OF_RANGE(n||`offset`,`an integer`,e))}var pe=/[^+/0-9A-Za-z-_]/g;function me(e){if(e=e.split(`=`)[0],e=e.trim().replace(pe,``),e.length<2)return``;for(;e.length%4!=0;)e+=`=`;return e}function he(e,t){t||=1/0;let n,r=e.length,i=null,a=[];for(let o=0;o<r;++o){if(n=e.charCodeAt(o),n>55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&a.push(239,191,189);continue}if(o+1===r){(t-=3)>-1&&a.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&a.push(239,191,189),i=n;continue}n=(i-55296<<10|n-56320)+65536}else i&&(t-=3)>-1&&a.push(239,191,189);if(i=null,n<128){if(--t<0)break;a.push(n)}else if(n<2048){if((t-=2)<0)break;a.push(n>>6|192,n&63|128)}else if(n<65536){if((t-=3)<0)break;a.push(n>>12|224,n>>6&63|128,n&63|128)}else if(n<1114112){if((t-=4)<0)break;a.push(n>>18|240,n>>12&63|128,n>>6&63|128,n&63|128)}else throw Error(`Invalid code point`)}return a}function ge(e){let t=[];for(let n=0;n<e.length;++n)t.push(e.charCodeAt(n)&255);return t}function _e(e,t){let n,r,i,a=[];for(let o=0;o<e.length&&!((t-=2)<0);++o)n=e.charCodeAt(o),r=n>>8,i=n%256,a.push(i),a.push(r);return a}function ve(e){return t.toByteArray(me(e))}function ye(e,t,n,r){let i;for(i=0;i<r&&!(i+n>=t.length||i>=e.length);++i)t[i+n]=e[i];return i}function R(e,t){return e instanceof t||e!=null&&e.constructor!=null&&e.constructor.name!=null&&e.constructor.name===t.name}function be(e){return e!==e}var z=(function(){let e=`0123456789abcdef`,t=Array(256);for(let n=0;n<16;++n){let r=n*16;for(let i=0;i<16;++i)t[r+i]=e[n]+e[i]}return t})();function xe(e){return typeof BigInt>`u`?Se:e}function Se(){throw Error(`BigInt not supported`)}})),ur=lr(),Y=!0;function dr(e){Y=e}var fr;(function(e){e[e.UNKNOWN=0]=`UNKNOWN`,e[e.FIFO=1]=`FIFO`,e[e.CHR=2]=`CHR`,e[e.DIR=4]=`DIR`,e[e.BLK=6]=`BLK`,e[e.REG=8]=`REG`,e[e.LNK=10]=`LNK`,e[e.SOCK=12]=`SOCK`,e[e.WHT=14]=`WHT`})(fr||={});function pr(e){return(e&61440)>>12}function mr(e){return e<<12}var hr=class{ino;type;path;name},gr=function(e,t,n){for(var r=arguments.length>2,i=0;i<t.length;i++)n=r?t[i].call(e,n):t[i].call(e);return r?n:void 0},_r=function(e,t,n,r,i,a){function o(e){if(e!==void 0&&typeof e!=`function`)throw TypeError(`Function expected`);return e}for(var s=r.kind,c=s===`getter`?`get`:s===`setter`?`set`:`value`,l=!t&&e?r.static?e:e.prototype:null,u=t||(l?Object.getOwnPropertyDescriptor(l,r.name):{}),d,f=!1,p=n.length-1;p>=0;p--){var m={};for(var h in r)m[h]=h===`access`?{}:r[h];for(var h in r.access)m.access[h]=r.access[h];m.addInitializer=function(e){if(f)throw TypeError(`Cannot add initializers after decoration has completed`);a.push(o(e||null))};var g=(0,n[p])(s===`accessor`?{get:u.get,set:u.set}:u[c],m);if(s===`accessor`){if(g===void 0)continue;if(typeof g!=`object`||!g)throw TypeError(`Object expected`);(d=o(g.get))&&(u.get=d),(d=o(g.set))&&(u.set=d),(d=o(g.init))&&i.unshift(d)}else(d=o(g))&&(s===`field`?i.unshift(d):u[c]=d)}l&&Object.defineProperty(l,r.name,u),f=!0},vr=class{pending=new Set;lastWriter;writeState=0;readers=0;syncReaders=0;take(e,t,n){e==`rw`?this.writeState=t?2:1:(this.readers++,t&&this.syncReaders++);let r=!1,i=()=>{r||(r=!0,e==`rw`?this.writeState=0:(this.readers--,t&&this.syncReaders--),n())};return i[Symbol.dispose]=i,i}queue(e){let{promise:t,resolve:n}=Promise.withResolvers();return this.pending.add(t),e==`rw`&&(this.lastWriter=t),t.then(()=>{this.pending.delete(t),this.lastWriter==t&&delete this.lastWriter}),n}async acquire(e){let t=e==`ro`?this.lastWriter:Promise.all(this.pending),n=this.queue(e);return await t,this.take(e,!1,n)}acquireSync(e){if(this.writeState==2||e==`rw`&&this.syncReaders)throw M(`EDEADLK`);if(this.writeState||e==`rw`&&this.readers)throw M(`EAGAIN`);return this.take(e,!0,this.queue(e))}isAvailable(e){return(e!=`rw`||!this.readers)&&!this.writeState}get isFree(){return!this.writeState&&!this.readers}get mode(){return this.writeState?`rw`:this.readers?`ro`:null}},yr=(()=>{let e=[],t,n;return class{static{let r=typeof Symbol==`function`&&Symbol.metadata?Object.create(null):void 0;t=[v],n=[v],_r(this,null,t,{kind:`getter`,name:`lock`,static:!1,private:!1,access:{has:e=>`lock`in e,get:e=>e.lock},metadata:r},null,e),_r(this,null,n,{kind:`getter`,name:`lockSync`,static:!1,private:!1,access:{has:e=>`lockSync`in e,get:e=>e.lockSync},metadata:r},null,e),r&&Object.defineProperty(this,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:r})}_rwLock=(gr(this,e),new vr);get lock(){return this._rwLock.acquire.bind(this._rwLock)}get lockSync(){return this._rwLock.acquireSync.bind(this._rwLock)}get isLocked(){return!this._rwLock.isFree}get lockMode(){return this._rwLock.mode}}})(),br=class extends yr{fs;inode;data;dirtyRanges=[];truncatedTo;metadataDirty=!1;refs=0;paths=new Set;_lastPath;constructor(e,t,n){super(),this.fs=e,this.inode=n,this.paths.add(t),this._lastPath=t,this.data=new a(n.ino,n.size,{sparse:!0})}get ino(){return this.inode.ino}get path(){let[e]=this.paths;return e!==void 0&&(this._lastPath=e),e??this._lastPath}get dirty(){return this.metadataDirty||this.dirtyRanges.length>0}get bypassCache(){return In(this.inode)||Fn(this.inode)||!!(this.inode.flags&kn.DAX)}markDirty(e,t){this.dirtyRanges.push({start:e,end:t}),this.dirtyRanges.sort((e,t)=>e.start-t.start);let n=[];for(let e of this.dirtyRanges){let t=n.at(-1);t&&e.start<=t.end?t.end=Math.max(t.end,e.end):n.push(e)}this.dirtyRanges=n}copyFromCache(e,t,n){let r=t;for(let i of this.data.regions){let a=i.offset+i.data.byteLength;if(a<=r)continue;if(i.offset>=n)break;i.offset>r&&(e.fill(0,r-t,i.offset-t),r=i.offset);let o=Math.min(n,a);e.set(i.data.subarray(r-i.offset,o-i.offset),r-t),r=o}r<n&&e.fill(0,r-t,n-t)}async read(e,t,n){if(this.bypassCache)return await this.fs.read(this.path,e,t,n);for(let{start:e,end:r}of this.data.missing(t,n)){let t=new Uint8Array(r-e);await this.fs.read(this.path,t,e,r),this.data.add(t,e)}this.copyFromCache(e,t,n)}readSync(e,t,n){if(this.bypassCache)return this.fs.readSync(this.path,e,t,n);for(let{start:e,end:r}of this.data.missing(t,n)){let t=new Uint8Array(r-e);this.fs.readSync(this.path,t,e,r),this.data.add(t,e)}this.copyFromCache(e,t,n)}async write(e,t){this.bypassCache?await this.fs.write(this.path,e,t):this._writeCached(e,t),this._writeMetadata(t+e.byteLength)}writeSync(e,t){this.bypassCache?this.fs.writeSync(this.path,e,t):this._writeCached(e,t),this._writeMetadata(t+e.byteLength)}_writeCached(e,t){let n=t+e.byteLength;this.data.add(e.slice(),t),n>this.data.size&&(this.data.size=n),this.markDirty(t,n)}_writeMetadata(e){!this.bypassCache&&e>this.inode.size&&(this.inode.size=e),this.inode.mtimeMs=Date.now(),this.inode.ctimeMs=Date.now(),this.metadataDirty=!0}truncate(e){this.truncatedTo=Math.min(this.truncatedTo??e,e),this.data.size=e,this.dirtyRanges=this.dirtyRanges.filter(t=>t.start<e).map(t=>t.end>e?{start:t.start,end:e}:t),this.inode.size=e,this.inode.mtimeMs=Date.now(),this.inode.ctimeMs=Date.now(),this.metadataDirty=!0}get needsPreTruncate(){return!this.bypassCache&&this.truncatedTo!==void 0&&this.truncatedTo<this.inode.size&&!this.fs.attributes.has(`no_write`)}async sync(){this.needsPreTruncate&&await this.fs.touch(this.path,{size:this.truncatedTo}),this.truncatedTo=void 0;for(let e of this.dirtyRanges)for(let t=e.start;t<e.end;){let n=this.data.regionAt(t);if(!n)break;let r=Math.min(e.end,n.offset+n.data.byteLength);await this.fs.write(this.path,n.data.subarray(t-n.offset,r-n.offset),t),t=r}this.dirtyRanges=[],this.metadataDirty&&=(this.fs.attributes.has(`no_write`)||await this.fs.touch(this.path,this.inode),!1)}syncSync(){this.needsPreTruncate&&this.fs.touchSync(this.path,{size:this.truncatedTo}),this.truncatedTo=void 0;for(let e of this.dirtyRanges)for(let t=e.start;t<e.end;){let n=this.data.regionAt(t);if(!n)break;let r=Math.min(e.end,n.offset+n.data.byteLength);this.fs.writeSync(this.path,n.data.subarray(t-n.offset,r-n.offset),t),t=r}this.dirtyRanges=[],this.metadataDirty&&=(this.fs.attributes.has(`no_write`)||this.fs.touchSync(this.path,this.inode),!1)}},xr=function(e,t,n){if(t!=null){if(typeof t!=`object`&&typeof t!=`function`)throw TypeError(`Object expected.`);var r,i;if(n){if(!Symbol.asyncDispose)throw TypeError(`Symbol.asyncDispose is not defined.`);r=t[Symbol.asyncDispose]}if(r===void 0){if(!Symbol.dispose)throw TypeError(`Symbol.dispose is not defined.`);r=t[Symbol.dispose],n&&(i=r)}if(typeof r!=`function`)throw TypeError(`Object not disposable.`);i&&(r=function(){try{i.call(this)}catch(e){return Promise.reject(e)}}),e.stack.push({value:t,dispose:r,async:n})}else n&&e.stack.push({async:!0});return t},Sr=(function(e){return function(t){function n(n){t.error=t.hasError?new e(n,t.error,`An error was suppressed during disposal.`):n,t.hasError=!0}var r,i=0;function a(){for(;r=t.stack.pop();)try{if(!r.async&&i===1)return i=0,t.stack.push(r),Promise.resolve().then(a);if(r.dispose){var e=r.dispose.call(r.value);if(r.async)return i|=2,Promise.resolve(e).then(a,function(e){return n(e),a()})}else i|=1}catch(e){n(e)}if(i===1)return t.hasError?Promise.reject(t.error):Promise.resolve();if(t.hasError)throw t.error}return a()}})(typeof SuppressedError==`function`?SuppressedError:function(e,t,n){var r=Error(n);return r.name=`SuppressedError`,r.error=e,r.suppressed=t,r}),Cr=class{fs;byIno=new Map;byPath=new Map;constructor(e){this.fs=e}get(e){return this.byPath.get(e)}ref(e,t){let n=this.byIno.get(t.ino);return n&&!n.paths.has(e)&&(t.ino===0||(n.inode.mode^t.mode)&61440)&&(n=this.byPath.get(e),n&&(n.inode.mode^t.mode)&61440&&(n=void 0)),n?(n.paths.add(e),!n.dirty&&t!==n.inode&&Object.assign(n.inode,t)):(n=new br(this.fs,e,t),this.byIno.set(t.ino,n)),this.byPath.set(e,n),n.refs++,n}unref(e){e.refs--,!(e.refs>0||e.dirty)&&this.evict(e)}evict(e){this.byIno.delete(e.ino);for(let t of e.paths)this.byPath.delete(t)}rename(e,t){for(let[n,r]of this.byPath){if(n!=e&&!n.startsWith(e+`/`))continue;let i=t+n.slice(e.length);this.byPath.delete(n),this.byPath.set(i,r),r.paths.delete(n),r.paths.add(i)}}link(e,t){let n=this.byPath.get(e);n&&(n.paths.add(t),this.byPath.set(t,n))}remove(e){let t=this.byPath.get(e);t&&(this.byPath.delete(e),t.paths.delete(e),!t.paths.size&&!t.refs&&this.evict(t))}async sync(){for(let e of this.byIno.values()){let t={stack:[],error:void 0,hasError:!1};try{if(!e.dirty)continue;xr(t,await e.lock(`rw`),!1),await e.sync(),e.refs||this.evict(e)}catch(e){t.error=e,t.hasError=!0}finally{Sr(t)}}}syncSync(){for(let e of this.byIno.values()){let t={stack:[],error:void 0,hasError:!1};try{if(!e.dirty)continue;xr(t,e.lockSync(`rw`),!1),e.syncSync(),e.refs||this.evict(e)}catch(e){t.error=e,t.hasError=!0}finally{Sr(t)}}}},wr=new Map;function Tr(e){let t=wr.get(e.uuid);return t||(t=new Cr(e),wr.set(e.uuid,t)),t}async function Er(e,t,n,r){let i=Tr(e);r??=i.get(t)?.inode??await e.stat(t);let a=i.ref(t,r),o=await a.lock(n),s=!1,c=()=>{s||(s=!0,o(),i.unref(a))};return c[Symbol.dispose]=c,c}function Dr(e,t,n,r){let i=Tr(e);r??=i.get(t)?.inode??e.statSync(t);let a=i.ref(t,r),o;try{o=a.lockSync(n)}catch(e){throw i.unref(a),e}let s=!1,c=()=>{s||(s=!0,o(),i.unref(a))};return c[Symbol.dispose]=c,c}var Or=function(e,t,n){for(var r=arguments.length>2,i=0;i<t.length;i++)n=r?t[i].call(e,n):t[i].call(e);return r?n:void 0},kr=function(e,t,n,r,i,a){function o(e){if(e!==void 0&&typeof e!=`function`)throw TypeError(`Function expected`);return e}for(var s=r.kind,c=s===`getter`?`get`:s===`setter`?`set`:`value`,l=!t&&e?r.static?e:e.prototype:null,u=t||(l?Object.getOwnPropertyDescriptor(l,r.name):{}),d,f=!1,p=n.length-1;p>=0;p--){var m={};for(var h in r)m[h]=h===`access`?{}:r[h];for(var h in r.access)m.access[h]=r.access[h];m.addInitializer=function(e){if(f)throw TypeError(`Cannot add initializers after decoration has completed`);a.push(o(e||null))};var g=(0,n[p])(s===`accessor`?{get:u.get,set:u.set}:u[c],m);if(s===`accessor`){if(g===void 0)continue;if(typeof g!=`object`||!g)throw TypeError(`Object expected`);(d=o(g.get))&&(u.get=d),(d=o(g.set))&&(u.set=d),(d=o(g.init))&&i.unshift(d)}else(d=o(g))&&(s===`field`?i.unshift(d):u[c]=d)}l&&Object.defineProperty(l,r.name,u),f=!0},Ar=function(e,t,n){if(t!=null){if(typeof t!=`object`&&typeof t!=`function`)throw TypeError(`Object expected.`);var r,i;if(n){if(!Symbol.asyncDispose)throw TypeError(`Symbol.asyncDispose is not defined.`);r=t[Symbol.asyncDispose]}if(r===void 0){if(!Symbol.dispose)throw TypeError(`Symbol.dispose is not defined.`);r=t[Symbol.dispose],n&&(i=r)}if(typeof r!=`function`)throw TypeError(`Object not disposable.`);i&&(r=function(){try{i.call(this)}catch(e){return Promise.reject(e)}}),e.stack.push({value:t,dispose:r,async:n})}else n&&e.stack.push({async:!0});return t},jr=(function(e){return function(t){function n(n){t.error=t.hasError?new e(n,t.error,`An error was suppressed during disposal.`):n,t.hasError=!0}var r,i=0;function a(){for(;r=t.stack.pop();)try{if(!r.async&&i===1)return i=0,t.stack.push(r),Promise.resolve().then(a);if(r.dispose){var e=r.dispose.call(r.value);if(r.async)return i|=2,Promise.resolve(e).then(a,function(e){return n(e),a()})}else i|=1}catch(e){n(e)}if(i===1)return t.hasError?Promise.reject(t.error):Promise.resolve();if(t.hasError)throw t.error}return a()}})(typeof SuppressedError==`function`?SuppressedError:function(e,t,n){var r=Error(n);return r.name=`SuppressedError`,r.error=e,r.suppressed=t,r}),Mr=4096,Nr=(()=>{let e=[],t,n;return class{static{let r=typeof Symbol==`function`&&Symbol.metadata?Object.create(null):void 0;kr(this,null,t,{kind:`getter`,name:`inode`,static:!1,private:!1,access:{has:e=>`inode`in e,get:e=>e.inode},metadata:r},null,e),kr(this,null,n,{kind:`getter`,name:`fs`,static:!1,private:!1,access:{has:e=>`fs`in e,get:e=>e.fs},metadata:r},null,e),r&&Object.defineProperty(this,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:r})}context=Or(this,e);path;internalPath;flag;vnode;_position=0;get position(){return this.flag&1024?this.inode.size:this._position}set position(e){this._position=e}get inode(){return this.vnode.inode}get fs(){return this.vnode.fs}get dirty(){return this.vnode.dirty}closed=!1;get isClosed(){return this.closed}constructor(e,t,n,r,i){this.context=e,this.path=t,this.internalPath=n,this.flag=r,this.vnode=i}get _isSync(){return!!(this.flag&1052672||this.inode.flags&kn.Sync||this.fs.attributes.has(`sync`))}[(t=[v],n=[v],Symbol.dispose)](){this.closeSync()}syncSync(){let e={stack:[],error:void 0,hasError:!1};try{if(this.closed)throw j(`EBADF`,`sync`,this.path);if(!this.dirty)return;Ar(e,this.vnode.lockSync(`rw`),!1),this.vnode.syncSync()}catch(t){e.error=t,e.hasError=!0}finally{jr(e)}}datasyncSync(){return this.syncSync()}closeSync(){if(this.closed)throw j(`EBADF`,`close`,this.path);this.syncSync(),this.disposeSync(!0)}disposeSync(e){if(this.closed)throw j(`EBADF`,`close`,this.path);if(this.dirty&&!e)throw j(`EBUSY`,`close`,this.path);this.closed=!0,Tr(this.fs).unref(this.vnode)}truncateSync(e){let t={stack:[],error:void 0,hasError:!1};try{if(e<0)throw j(`EINVAL`,`truncate`,this.path);if(this.closed||!(this.flag&1||this.flag&2))throw j(`EBADF`,`truncate`,this.path);if(this.fs.attributes.has(`readonly`))throw j(`EROFS`,`truncate`,this.path);if(this.inode.flags&kn.Immutable)throw j(`EPERM`,`truncate`,this.path);Ar(t,this.vnode.lockSync(`rw`),!1),this.vnode.truncate(e),this._isSync&&this.vnode.syncSync()}catch(e){t.error=e,t.hasError=!0}finally{jr(t)}}writeSync(e,t=0,n=e.byteLength-t,r=this.position){let i={stack:[],error:void 0,hasError:!1};try{if(this.closed||!(this.flag&1||this.flag&2))throw j(`EBADF`,`write`,this.path);if(this.fs.attributes.has(`readonly`))throw j(`EROFS`,`write`,this.path);if(this.inode.flags&kn.Immutable)throw j(`EPERM`,`write`,this.path);Ar(i,this.vnode.lockSync(`rw`),!1);let a=e.subarray(t,t+n);return this.vnode.writeSync(a,r),this._position=r+a.byteLength,this._isSync&&this.vnode.syncSync(),a.byteLength}catch(e){i.error=e,i.hasError=!0}finally{jr(i)}}readSync(e,t=0,n=e.byteLength-t,r=this.position){let i={stack:[],error:void 0,hasError:!1};try{if(this.closed||this.flag&1)throw j(`EBADF`,`read`,this.path);Ar(i,this.vnode.lockSync(`ro`),!1),!(this.inode.flags&kn.NoAtime)&&!this.fs.attributes.has(`no_atime`)&&(this.vnode.metadataDirty=!0,this.inode.atimeMs=Date.now());let a=r+n;!In(this.inode)&&!Fn(this.inode)&&a>this.inode.size&&(a=r+Math.max(this.inode.size-r,0)),this._position=a;let o=new Uint8Array(e.buffer,e.byteOffset,e.byteLength);return this.vnode.readSync(o.subarray(t,t+n),r,a),this._isSync&&this.vnode.syncSync(),a-r}catch(e){i.error=e,i.hasError=!0}finally{jr(i)}}chmodSync(e){let t={stack:[],error:void 0,hasError:!1};try{if(this.closed)throw j(`EBADF`,`chmod`,this.path);Ar(t,this.vnode.lockSync(`rw`),!1),this.vnode.metadataDirty=!0,this.inode.mode=this.inode.mode&(e>61440?~Je:Je)|e,(this._isSync||e>61440)&&this.vnode.syncSync()}catch(e){t.error=e,t.hasError=!0}finally{jr(t)}}chownSync(e,t){let n={stack:[],error:void 0,hasError:!1};try{if(this.closed)throw j(`EBADF`,`chmod`,this.path);Ar(n,this.vnode.lockSync(`rw`),!1),this.vnode.metadataDirty=!0,Rn(this.inode,e,t),this._isSync&&this.vnode.syncSync()}catch(e){n.error=e,n.hasError=!0}finally{jr(n)}}utimesSync(e,t){let n={stack:[],error:void 0,hasError:!1};try{if(this.closed)throw j(`EBADF`,`utimes`,this.path);Ar(n,this.vnode.lockSync(`rw`),!1),this.vnode.metadataDirty=!0,this.inode.atimeMs=e,this.inode.mtimeMs=t,this._isSync&&this.vnode.syncSync()}catch(e){n.error=e,n.hasError=!0}finally{jr(n)}}async[Symbol.asyncDispose](){await this.close()}async sync(){let e={stack:[],error:void 0,hasError:!1};try{if(this.closed)throw j(`EBADF`,`sync`,this.path);if(!this.dirty)return;Ar(e,await this.vnode.lock(`rw`),!1),await this.vnode.sync()}catch(t){e.error=t,e.hasError=!0}finally{jr(e)}}datasync(){return this.sync()}async close(){if(this.closed)throw j(`EBADF`,`close`,this.path);await this.sync(),this.dispose(!0)}dispose(e){if(this.closed)throw j(`EBADF`,`close`,this.path);if(this.dirty&&!e)throw j(`EBUSY`,`close`,this.path);this.closed=!0,Tr(this.fs).unref(this.vnode)}stat(){if(this.closed)throw j(`EBADF`,`stat`,this.path);return this.inode}async truncate(e){let t={stack:[],error:void 0,hasError:!1};try{if(e<0)throw j(`EINVAL`,`truncate`,this.path);if(this.closed||!(this.flag&1||this.flag&2))throw j(`EBADF`,`truncate`,this.path);if(this.fs.attributes.has(`readonly`))throw j(`EROFS`,`truncate`,this.path);if(this.inode.flags&kn.Immutable)throw j(`EPERM`,`truncate`,this.path);Ar(t,await this.vnode.lock(`rw`),!1),this.vnode.truncate(e),this._isSync&&await this.vnode.sync()}catch(e){t.error=e,t.hasError=!0}finally{jr(t)}}async write(e,t=0,n=e.byteLength-t,r=this.position){let i={stack:[],error:void 0,hasError:!1};try{if(this.closed||!(this.flag&1||this.flag&2))throw j(`EBADF`,`write`,this.path);if(this.fs.attributes.has(`readonly`))throw j(`EROFS`,`write`,this.path);if(this.inode.flags&kn.Immutable)throw j(`EPERM`,`write`,this.path);Ar(i,await this.vnode.lock(`rw`),!1);let a=e.subarray(t,t+n);return await this.vnode.write(a,r),this._position=r+a.byteLength,this._isSync&&await this.vnode.sync(),a.byteLength}catch(e){i.error=e,i.hasError=!0}finally{jr(i)}}async read(e,t=0,n=e.byteLength-t,r=this.position){let i={stack:[],error:void 0,hasError:!1};try{if(this.closed||this.flag&1)throw j(`EBADF`,`read`,this.path);Ar(i,await this.vnode.lock(`ro`),!1),!(this.inode.flags&kn.NoAtime)&&!this.fs.attributes.has(`no_atime`)&&(this.vnode.metadataDirty=!0,this.inode.atimeMs=Date.now());let a=r+n;!In(this.inode)&&!Fn(this.inode)&&a>this.inode.size&&(a=r+Math.max(this.inode.size-r,0)),this._position=a;let o=new Uint8Array(e.buffer,e.byteOffset,e.byteLength);return await this.vnode.read(o.subarray(t,t+n),r,a),this._isSync&&await this.vnode.sync(),a-r}catch(e){i.error=e,i.hasError=!0}finally{jr(i)}}async chmod(e){let t={stack:[],error:void 0,hasError:!1};try{if(this.closed)throw j(`EBADF`,`chmod`,this.path);Ar(t,await this.vnode.lock(`rw`),!1),this.vnode.metadataDirty=!0,this.inode.mode=this.inode.mode&(e>61440?~Je:Je)|e,(this._isSync||e>61440)&&await this.vnode.sync()}catch(e){t.error=e,t.hasError=!0}finally{jr(t)}}async chown(e,t){let n={stack:[],error:void 0,hasError:!1};try{if(this.closed)throw j(`EBADF`,`chown`,this.path);Ar(n,await this.vnode.lock(`rw`),!1),this.vnode.metadataDirty=!0,Rn(this.inode,e,t),this._isSync&&await this.vnode.sync()}catch(e){n.error=e,n.hasError=!0}finally{jr(n)}}async utimes(e,t){let n={stack:[],error:void 0,hasError:!1};try{if(this.closed)throw j(`EBADF`,`utimes`,this.path);Ar(n,await this.vnode.lock(`rw`),!1),this.vnode.metadataDirty=!0,this.inode.atimeMs=e,this.inode.mtimeMs=t,this._isSync&&await this.vnode.sync()}catch(e){n.error=e,n.hasError=!0}finally{jr(n)}}streamRead(e){if(this.closed)throw j(`EBADF`,`streamRead`,this.path);let{vnode:t}=this;return new ReadableStream({async start(n){let r={stack:[],error:void 0,hasError:!1};try{Ar(r,await t.lock(`ro`),!1);let{start:i=0,end:a=t.inode.size}=e;for(let e=i;e<a;e+=Mr){let r=e+Mr>a?a-e:Mr,i=new Uint8Array(r);await t.read(i,e,e+r).catch(n.error.bind(n)),n.enqueue(i)}n.close()}catch(e){r.error=e,r.hasError=!0}finally{jr(r)}},type:`bytes`})}streamWrite(e){if(this.closed)throw j(`EBADF`,`write`,this.path);if(this.inode.flags&kn.Immutable)throw j(`EPERM`,`write`,this.path);if(this.fs.attributes.has(`readonly`))throw j(`EROFS`,`write`,this.path);let{vnode:t}=this,n=e.start??0;return new WritableStream({async write(e,r){let i={stack:[],error:void 0,hasError:!1};try{Ar(i,await t.lock(`rw`),!1),await t.write(e,n).catch(r.error.bind(r)),n+=e.byteLength}catch(e){i.error=e,i.hasError=!0}finally{jr(i)}},async close(){let e={stack:[],error:void 0,hasError:!1};try{Ar(e,await t.lock(`rw`),!1),await t.sync()}catch(t){e.error=t,e.hasError=!0}finally{jr(e)}}})}}})();function Pr(e){let t=Fe(e.context).descriptors,n=Math.max(t.size?Math.max(...t.keys())+1:0,4);return t.set(n,e),n}function Fr(e,t){Zt(t);let n=Fe(e).descriptors.get(t);if(!n)throw M(`EBADF`);return n}function Ir(e,t){return Fe(e).descriptors.delete(t)}var Lr=/[rwasx]{1,2}\+?/;function Rr(e){if(typeof e==`number`)return e;if(!Lr.test(e))throw M(`EINVAL`,`Invalid flag string: `+e);return zr(e)}function zr(e){if(!e.includes(`r`)&&!e.includes(`w`)&&!e.includes(`a`))throw M(`EINVAL`,`Invalid flag string: `+e);let t=e.includes(`r`)?0:64;return e.includes(`w`)&&(t|=512),e.includes(`a`)&&(t|=ze),e.includes(`+`)?t|=2:e.includes(`r`)||(t|=1),e.includes(`s`)&&(t|=Ue),e.includes(`x`)&&(t|=128),t}function Br(e){let t=0;return e&1||(t|=4),(e&1||e&2)&&(t|=2),t}var Vr=A;function Hr(e,t){return e.path=t,e}function Ur(e,t,n,r){let i=typeof n==`string`?{path:n,dest:r,syscall:t.endsWith(`Sync`)?t.slice(0,-4):t}:n,a=e[t];if(typeof a!=`function`)throw TypeError(`${t} is not a function`);return function(...t){try{return a.call(e,...t)}catch(e){throw k(Object.assign(e,i))}}}function Wr(e,t){return new Proxy(e,{get(e,n){let r=Reflect.get(e,n);return typeof r==`function`?function n(...i){try{let a=r.apply(e,i);return a instanceof Promise?a.catch(e=>{if(`code`in e)throw k(Object.assign(e,t));if(e in O){let r=j(e,t);Error.captureStackTrace(r,n)}throw e}):a}catch(e){throw k(Object.assign(e,t))}}:r}})}var Gr=new Map;Kr(`/`,Qn.create({label:`root`}));function Kr(e,t){if(e[0]!=`/`&&(e=`/`+e),e=cn.call(this,e),Gr.has(e))throw I(M(`EINVAL`,`Mount point is already in use: `+e));t._mountPoint=e,Gr.set(e,t),wr.has(t.uuid)||wr.set(t.uuid,new Cr(t)),fe(`Mounted ${t.name} on ${e}`),pe(`${t.name} attributes: ${[...t.attributes].map(([e,t])=>t==null?e:e+`=`+t).join(`, `)}`)}function qr(e){e[0]!=`/`&&(e=`/`+e),e=cn.call(this,e);let t=Gr.get(e);if(!t){L(e+` is already unmounted`);return}let n=()=>{wr.delete(t.uuid),fe(`Synced all changes to `+e)};try{wr.get(t.uuid)?.syncSync(),n()}catch{L(`Could not flush to ${e} synchronously.`),wr.get(t.uuid)?.sync().then(n)}Gr.delete(e),de(`Unmounted `+e)}function X(e,t,n){let{root:r}=Fe(t),i={path:e,...n};e=H(U(r,e),!0),e=cn.call(t,e);let a=[...Gr].sort((e,t)=>e[0].length>t[0].length?-1:1);for(let[t,n]of a){if(!Xr(t,e))continue;e=e.slice(t.length>1?t.length:0),e===``&&(e=`/`);let a=n.attributes.get(`case_fold`);return a===`lower`&&(e=e.toLowerCase()),a===`upper`&&(e=e.toUpperCase()),{fs:Wr(n,i),path:e,mountPoint:t,root:r}}throw le(new A(O.EIO,`No file system for `+e))}function Jr(e,t){let n=e.usage(),r=n.blockSize||4096;return{type:(t?BigInt:Number)(e.type),bsize:(t?BigInt:Number)(r),ffree:(t?BigInt:Number)(n.freeNodes||4294967295),files:(t?BigInt:Number)(n.totalNodes||4294967295),bavail:(t?BigInt:Number)(n.freeSpace/r),bfree:(t?BigInt:Number)(n.freeSpace/r),blocks:(t?BigInt:Number)(n.totalSpace/r)}}function Yr(e){let t=Fe(this);if(!Me(t.credentials))throw M(`EPERM`,`Can not chroot() as non-root user`);t.root??=`/`;let n=U(t.root,e);for(let e of t.descriptors?.values()??[]){if(!e.path.startsWith(t.root))throw j(`EBUSY`,`chroot`,e.path);e.path=e.path.slice(t.root.length)}if(n.length>t.root.length)throw M(`EPERM`,`Can not chroot() outside of current root`);t.root=n}function Xr(e,t){return e===`/`||e===t||(e.endsWith(`/`)||(e+=`/`),t.startsWith(e))}var Zr=t({link:()=>oi,mkdir:()=>ri,open:()=>ti,readdir:()=>ii,readlink:()=>ni,rename:()=>ai,resolve:()=>ei,stat:()=>si}),Qr=function(e,t,n){if(t!=null){if(typeof t!=`object`&&typeof t!=`function`)throw TypeError(`Object expected.`);var r,i;if(n){if(!Symbol.asyncDispose)throw TypeError(`Symbol.asyncDispose is not defined.`);r=t[Symbol.asyncDispose]}if(r===void 0){if(!Symbol.dispose)throw TypeError(`Symbol.dispose is not defined.`);r=t[Symbol.dispose],n&&(i=r)}if(typeof r!=`function`)throw TypeError(`Object not disposable.`);i&&(r=function(){try{i.call(this)}catch(e){return Promise.reject(e)}}),e.stack.push({value:t,dispose:r,async:n})}else n&&e.stack.push({async:!0});return t},$r=(function(e){return function(t){function n(n){t.error=t.hasError?new e(n,t.error,`An error was suppressed during disposal.`):n,t.hasError=!0}var r,i=0;function a(){for(;r=t.stack.pop();)try{if(!r.async&&i===1)return i=0,t.stack.push(r),Promise.resolve().then(a);if(r.dispose){var e=r.dispose.call(r.value);if(r.async)return i|=2,Promise.resolve(e).then(a,function(e){return n(e),a()})}else i|=1}catch(e){n(e)}if(i===1)return t.hasError?Promise.reject(t.error):Promise.resolve();if(t.hasError)throw t.error}return a()}})(typeof SuppressedError==`function`?SuppressedError:function(e,t,n){var r=Error(n);return r.name=`SuppressedError`,r.error=e,r.suppressed=t,r});function ei(e,t,n,r){t=cn.call(e,t);try{let i=X(t,e),a=Tr(i.fs).get(i.path)?.inode??i.fs.statSync(i.path);return!Nn(a)||n?{...i,fullPath:t,stats:a}:ei(e,cn.call(e,W(t),ni.call(e,t)),n,r)}catch(e){if(k(Object.assign(e,{syscall:`stat`,path:t,...r})),n)throw e}let{base:i,dir:a}=hn(t),o=a==`/`?`/`:ei(e,a,!1,r).fullPath,s=U(o,i),c=X(s,e),l;try{l=Tr(c.fs).get(c.path)?.inode??c.fs.statSync(c.path)}catch(e){if(e.code===`ENOENT`)return{...c,fullPath:s};throw k(Object.assign(e,{syscall:`stat`,path:s,...r}))}return Nn(l)?ei(e,cn.call(e,o,ni.call(e,s)),!1,r):{...c,fullPath:s,stats:l}}function ti(e,t){e=H(e);let n=Yt(t.mode,420),r=Rr(t.flag);e=t.preserveSymlinks?e:ei(this,e).fullPath;let{fs:i,path:a}=X(e,this),o;try{o=i.statSync(a)}catch{}if(!o){let o={stack:[],error:void 0,hasError:!1};try{if(!(r&64))throw j(`ENOENT`,`open`,e);let s=W(a),c=i.statSync(s);if(Y&&!J(this,c,2))throw j(`EACCES`,`open`,e);if(!q(c))throw j(`ENOTDIR`,`open`,e);if(!t.allowDirectory&&n&16384)throw j(`EISDIR`,`open`,e);Qr(o,Dr(i,s,`rw`,c),!1);let{euid:l,egid:u}=Fe(this).credentials,d=i.createFileSync(a,{mode:n,uid:c.mode&2048?c.uid:l,gid:c.mode&1024?c.gid:u});return da(this,`rename`,e),new Nr(this,e,a,r,Tr(i).ref(a,d))}catch(e){o.error=e,o.hasError=!0}finally{$r(o)}}if(Y&&(!J(this,o,n)||!J(this,o,Br(r))))throw j(`EACCES`,`open`,e);if(r&128)throw j(`EEXIST`,`open`,e);if(!t.allowDirectory&&o.mode&16384)throw j(`EISDIR`,`open`,e);let s=new Nr(this,e,a,r,Tr(i).ref(a,o));return r&512&&s.truncateSync(0),s}function ni(e){e=H(e);let{fs:t,stats:n,path:r}=ei(this,e,!0,{syscall:`readlink`});if(!n)throw j(`ENOENT`,`readlink`,e);if(Y&&!J(this,n,4))throw j(`EACCES`,`readlink`,e);if(!Nn(n))throw j(`EINVAL`,`readlink`,e);let i=n.size,a=new Uint8Array(i);return t.readSync(r,a,0,i),T(a)}function ri(e,t={}){let n=H(e),r={syscall:`mkdir`,path:n},{fullPath:i}=ei(this,W(n),!1,r),{fs:a,path:o}=X(U(i,fn(n)),this,r),s=i!=W(n),{euid:c,egid:l}=Fe(this).credentials,{mode:u=511,recursive:d}=t,f,p=(e,t)=>{let n={stack:[],error:void 0,hasError:!1};try{let i=W(t),m=d&&i!=`/`?p(W(e),i):a.statSync(i);if(d){let n;try{n=Tr(a).get(t)?.inode??a.statSync(t)}catch{}if(n){let i=Nn(n)?ei(this,e,!1,r).stats:n;if(!i)throw j(`ENOENT`,r);if(!q(i))throw j(t==o?`EEXIST`:`ENOTDIR`,r);return n}if(s&&a.existsSync(U(i,fn(e))))throw j(`ENOENT`,r)}if(Y&&!J(this,m,2))throw j(`EACCES`,`mkdir`,e);Qr(n,Dr(a,i,`rw`,m),!1);let h=Ur(a,`mkdirSync`,{path:e,syscall:`mkdir`})(t,{mode:u,uid:m.mode&2048?m.uid:c,gid:m.mode&1024?m.gid:l});return d&&(f??=e),da(this,`rename`,e),h}catch(e){n.error=e,n.hasError=!0}finally{$r(n)}};return p(n,o),f}function ii(e,t={}){e=H(e);let{fs:n,path:r}=ei(this,e),i=Tr(n).get(r)?.inode??Ur(n,`statSync`,{path:e,syscall:`scandir`})(r);if(Y&&!J(this,i,4))throw j(`EACCES`,`scandir`,e);if(!q(i))throw j(`ENOTDIR`,`scandir`,e);let a;{let e={stack:[],error:void 0,hasError:!1};try{Qr(e,Dr(n,r,`ro`,i),!1),a=n.readdirSync(r)}catch(t){e.error=t,e.hasError=!0}finally{$r(e)}}let o=[],s=e=>{let i;try{i=n.statSync(U(r,e))}catch(e){if(e.code==`ENOENT`)return;throw e}let a=new hr;if(a.ino=i.ino,a.type=pr(i.mode),a.path=e,a.name=fn(e),o.push(a),!q(i)||!t?.recursive)return;let c=n.readdirSync(U(r,e));for(let t of c)s(U(e,t))};for(let e of a)s(e);return o}function ai(e,t){let n={stack:[],error:void 0,hasError:!1};try{e=H(e),t=H(t);let r={syscall:`rename`,path:e,dest:t},i=ei(this,e,!0,r),a=X(t,this,r);if(i.fs.uuid!==a.fs.uuid)throw j(`EXDEV`,r);if(a.path.startsWith(i.path+`/`))throw j(`EINVAL`,r);if(!i.stats)throw j(`ENOENT`,r);let o=i.fs,s=o.statSync(W(i.path)),c=o.statSync(W(a.path)),l;try{l=o.statSync(a.path)}catch(e){if(e.code!=`ENOENT`)throw e}if(Y&&(!J(this,s,4)||!J(this,c,2)))throw j(`EACCES`,r);if(l&&!q(i.stats)&&q(l))throw j(`EISDIR`,r);if(l&&q(i.stats)&&!q(l))throw j(`ENOTDIR`,r);let u=W(i.path),d=W(a.path),f=[[u,s],[d,c]];s.ino>c.ino&&f.reverse(),Qr(n,Dr(o,f[0][0],`rw`,f[0][1]),!1),Qr(n,s.ino==c.ino?null:Dr(o,f[1][0],`rw`,f[1][1]),!1),i.fs.renameSync(i.path,a.path),Tr(o).rename(i.path,a.path),da(this,`rename`,e),da(this,`rename`,t)}catch(e){n.error=e,n.hasError=!0}finally{$r(n)}}function oi(e,t){let n={stack:[],error:void 0,hasError:!1};try{e=H(e),t=H(t);let r={syscall:`link`,path:e,dest:t},{fs:i,path:a}=X(e,this,r),o=X(t,this,r);if(i.uuid!==o.fs.uuid)throw j(`EXDEV`,r);let s=i.statSync(a);if(Y){if(!J(this,s,4))throw j(`EACCES`,r);let e=i.statSync(W(a));if(!J(this,e,4))throw j(`EACCES`,r);let t=i.statSync(W(o.path));if(!J(this,t,2))throw j(`EACCES`,r)}Qr(n,Dr(i,W(o.path),`rw`),!1),i.linkSync(a,o.path),Tr(i).link(a,o.path)}catch(e){n.error=e,n.hasError=!0}finally{$r(n)}}function si(e,t){e=H.call(this,e);let n={syscall:t?`lstat`:`stat`,path:e},r;if(!t)r=ei(this,e,!1,n).stats;else{let{base:t,dir:i}=hn(e),{fs:a,path:o}=ei(this,i,!1,n);try{let e=t?U(o,t):o;r=Tr(a).get(e)?.inode??a.statSync(e)}catch(e){throw k(Object.assign(e,n)),e}}if(!r)throw j(`ENOENT`,n);if(Y&&!J(this,r,4))throw j(`EACCES`,n);return r}var ci=class e{ino;type;_name;get name(){let e=ur.Buffer.from(this._name);return this._encoding==`buffer`?e:e.toString(this._encoding)}_encoding;_parentPath;get parentPath(){return this._parentPath}get path(){return L(`Dirent.path was removed in Node v24, use parentPath instead`),this._parentPath}static from(t,n,r=`.`){let i=new e,{base:a,dir:o}=hn(t.path);return i._parentPath=U(r,o),i._name=a,i.ino=t.ino,i.type=t.type,i._encoding=n,i}isFile(){return this.type===fr.REG}isDirectory(){return this.type===fr.DIR}isBlockDevice(){return this.type===fr.BLK}isCharacterDevice(){return this.type===fr.CHR}isSymbolicLink(){return this.type===fr.LNK}isFIFO(){return this.type===fr.FIFO}isSocket(){return this.type===fr.SOCK}};function li(){return Object.assign(Error(`Directory handle was closed`),{code:`ERR_DIR_CLOSED`})}var ui=class{path;context;closed=!1;checkClosed(){if(this.closed)throw li()}_entries;constructor(e,t){this.path=e,this.context=t}close(e){if(this.closed){let t=li();if(!e)return Promise.reject(t);e(t);return}if(this.closed=!0,!e)return Promise.resolve();e(null)}closeSync(){if(this.closed)throw li();this.closed=!0}async _read(){return this.checkClosed(),this._entries??=await Co.call(this.context,this.path,{withFileTypes:!0}),this._entries.length?this._entries.shift()??null:null}read(e){if(!e)return this._read();this._read().then(t=>e(null,t))}readSync(){return this.checkClosed(),this._entries??=Ii.call(this.context,this.path,{withFileTypes:!0}),this._entries.length?this._entries.shift()??null:null}async next(){let e=await this._read();return e?{done:!1,value:e}:(await this.close(),{done:!0,value:void 0})}[Symbol.asyncIterator](){return this}[Symbol.dispose](){this.closed||this.closeSync()}async[Symbol.asyncDispose](){this.closed||await this.close()}},di=function(e,t,n){if(t!=null){if(typeof t!=`object`&&typeof t!=`function`)throw TypeError(`Object expected.`);var r,i;if(n){if(!Symbol.asyncDispose)throw TypeError(`Symbol.asyncDispose is not defined.`);r=t[Symbol.asyncDispose]}if(r===void 0){if(!Symbol.dispose)throw TypeError(`Symbol.dispose is not defined.`);r=t[Symbol.dispose],n&&(i=r)}if(typeof r!=`function`)throw TypeError(`Object not disposable.`);i&&(r=function(){try{i.call(this)}catch(e){return Promise.reject(e)}}),e.stack.push({value:t,dispose:r,async:n})}else n&&e.stack.push({async:!0});return t},fi=(function(e){return function(t){function n(n){t.error=t.hasError?new e(n,t.error,`An error was suppressed during disposal.`):n,t.hasError=!0}var r,i=0;function a(){for(;r=t.stack.pop();)try{if(!r.async&&i===1)return i=0,t.stack.push(r),Promise.resolve().then(a);if(r.dispose){var e=r.dispose.call(r.value);if(r.async)return i|=2,Promise.resolve(e).then(a,function(e){return n(e),a()})}else i|=1}catch(e){n(e)}if(i===1)return t.hasError?Promise.reject(t.error):Promise.resolve();if(t.hasError)throw t.error}return a()}})(typeof SuppressedError==`function`?SuppressedError:function(e,t,n){var r=Error(n);return r.name=`SuppressedError`,r.error=e,r.suppressed=t,r});function pi(e,t){return ai.call(this,e,t)}function mi(e){e=H(e);try{let{fs:t,path:n}=ei(this,e);return t.existsSync(n)}catch(e){if(e.errno==O.ENOENT)return!1;throw e}}function hi(e,t){let n=si.call(this,e,!1);return t?.bigint?new bn(n):new yn(n)}function gi(e,t){let n=si.call(this,e,!0);return t?.bigint?new bn(n):new yn(n)}function _i(e,t=0){let n={stack:[],error:void 0,hasError:!1};try{let r=di(n,ti.call(this,e,{flag:`r+`}),!1);if(t||=0,t<0)throw j(`EINVAL`,`truncate`,e.toString());r.truncateSync(t)}catch(e){n.error=e,n.hasError=!0}finally{fi(n)}}function vi(e){e=H(e);let{fs:t,path:n}=X(e,this);try{let e={stack:[],error:void 0,hasError:!1};try{if(Y&&!J(this,t.statSync(n),2))throw j(`EACCES`,`unlink`);di(e,Dr(t,W(n),`rw`),!1),t.unlinkSync(n),Tr(t).remove(n)}catch(t){e.error=t,e.hasError=!0}finally{fi(e)}}catch(t){throw k(Object.assign(t,{syscall:`unlink`,path:e}))}da(this,`rename`,e.toString())}function yi(e,t,n=0){return Pr(ti.call(this,e,{flag:t,mode:n}))}function bi(e,t,n){return Pr(ti.call(this,e,{flag:t,mode:n,preserveSymlinks:!0}))}function xi(e,t={}){let n={stack:[],error:void 0,hasError:!1};try{let r=$t(t,null,`r`,420);if(Rr(r.flag)&1)throw j(`EBADF`,`read`,e.toString());let i=di(n,typeof e==`number`?Fr(this,e):ti.call(this,e.toString(),{flag:r.flag,mode:420,preserveSymlinks:!1}),!1),{size:a}=i.stat(),o=ur.Buffer.alloc(a);return i.readSync(o,0,a,0),r.encoding?o.toString(r.encoding):o}catch(e){n.error=e,n.hasError=!0}finally{fi(n)}}function Si(e,t,n={}){let r={stack:[],error:void 0,hasError:!1};try{let i=$t(n,`utf8`,`w+`,420),a=Rr(i.flag);if(!(a&1||a&2))throw new A(O.EINVAL,`Flag passed to writeFile must allow for writing`);if(typeof t!=`string`&&!i.encoding)throw new A(O.EINVAL,`Encoding not specified`);let o=typeof t==`string`?ur.Buffer.from(t,i.encoding):new Uint8Array(t.buffer,t.byteOffset,t.byteLength);if(!o)throw new A(O.EINVAL,`Data not specified`);di(r,typeof e==`number`?Fr(this,e):ti.call(this,e.toString(),{flag:a,mode:i.mode}),!1).writeSync(o,0,o.byteLength,0),da(this,`change`,e.toString())}catch(e){r.error=e,r.hasError=!0}finally{fi(r)}}function Ci(e,t,n={}){let r=$t(n,`utf8`,`a+`,420),i=Rr(r.flag);if(!(i&1024))throw new A(O.EINVAL,`Flag passed to appendFile must allow for appending`);if(typeof t!=`string`&&!r.encoding)throw new A(O.EINVAL,`Encoding not specified`);let a=typeof t==`string`?ur.Buffer.from(t,r.encoding):new Uint8Array(t.buffer,t.byteOffset,t.byteLength),o=typeof e==`number`?Fr(this,e):ti.call(this,H(e),{flag:i,mode:r.mode});o.writeSync(a,0,a.byteLength),typeof o!=`number`&&o.closeSync()}function wi(e,t){let n=Fr(this,e).stat();return t?.bigint?new bn(n):new yn(n)}function Ti(e){Fr(this,e).closeSync(),Ir(this,e)}function Ei(e,t=0){if(t||=0,t<0)throw new A(O.EINVAL);Fr(this,e).truncateSync(t)}function Di(e){Fr(this,e).syncSync()}function Oi(e){Fr(this,e).datasyncSync()}function ki(e,t,n,r,i){let a,o,s,c;if(typeof t==`string`){c=typeof n==`number`?n:null;let e=typeof r==`string`?r:`utf8`;o=0,a=ur.Buffer.from(t,e),s=a.byteLength}else a=new Uint8Array(t.buffer,t.byteOffset,t.byteLength),o=n,s=r,c=typeof i==`number`?i:null;let l=Fr(this,e);c??=l.position;let u=l.writeSync(a,o,s,c);return da(this,`change`,l.path),u}function Ai(e,t,n,r,i){let a=Fr(this,e),o=typeof n==`object`?n.offset:n;if(typeof n==`object`&&(r=n.length,i=n.position),i&&i>2**53-1)throw j(`EINVAL`);return typeof i==`bigint`&&(i=Number(i)),i=Number.isSafeInteger(i)?i:a.position,a.readSync(t,o,r,i)}function ji(e,t,n){Fr(this,e).chownSync(t,n)}function Mi(e,t){let n=Yt(t,-1);if(n<0)throw new A(O.EINVAL,`Invalid mode.`);Fr(this,e).chmodSync(n)}function Ni(e,t,n){Fr(this,e).utimesSync(Qt(t),Qt(n))}function Pi(e){let t={stack:[],error:void 0,hasError:!1};try{e=H(e);let{fs:n,path:r}=ei(this,e),i=Ur(n,`statSync`,{path:e,syscall:`rmdir`})(r);if(!q(i))throw j(`ENOTDIR`,`rmdir`,e);if(Y&&!J(this,i,2))throw j(`EACCES`,`rmdir`,e);di(t,Dr(n,W(r),`rw`),!1),Ur(n,`rmdirSync`,e)(r),Tr(n).remove(r),da(this,`rename`,e.toString())}catch(e){t.error=e,t.hasError=!0}finally{fi(t)}}function Fi(e,t){t=typeof t==`object`?t:{mode:t};let n=Yt(t?.mode,511);return ri.call(this,e,{...t,mode:n})}function Ii(e,t){t=typeof t==`object`?t:{encoding:t},e=H(e);let n=[],r=ii.call(this,e,t??void 0);for(let i of r)t?.withFileTypes?n.push(ci.from(i,t.encoding,e)):t?.encoding==`buffer`?n.push(ur.Buffer.from(i.path)):n.push(i.path);return n}function Li(e,t){return oi.call(this,e,t)}function Ri(e,t,n=`file`){let r={stack:[],error:void 0,hasError:!1};try{if(![`file`,`dir`,`junction`].includes(n))throw TypeError(`Invalid symlink type: `+n);t=H(t);let i=di(r,ti.call(this,t,{flag:`wx`,mode:420}),!1);i.writeSync(C(H(e,!0))),i.chmodSync(Xe)}catch(e){r.error=e,r.hasError=!0}finally{fi(r)}}function zi(e,t){let n=ur.Buffer.from(ni.call(this,e)),r=typeof t==`object`?t?.encoding:t;return r==`buffer`?n:n.toString(r??`utf-8`)}function Bi(e,t,n){let r={stack:[],error:void 0,hasError:!1};try{di(r,ti.call(this,e,{flag:`r+`,mode:0}),!1).chownSync(t,n)}catch(e){r.error=e,r.hasError=!0}finally{fi(r)}}function Vi(e,t,n){let r=bi.call(this,e,`r+`);ji.call(this,r,t,n),Ti.call(this,r)}function Hi(e,t){let n;try{n=yi.call(this,e,`r+`)}catch(t){throw k(Object.assign(t,{syscall:`chmod`,path:H(e)}))}Mi.call(this,n,t),Ti.call(this,n)}function Ui(e,t){let n=bi.call(this,e,`r+`);Mi.call(this,n,t),Ti.call(this,n)}function Wi(e,t,n){let r=yi.call(this,e,`r+`);Ni.call(this,r,t,n),Ti.call(this,r)}function Gi(e,t,n){let r=bi.call(this,e,`r+`);Ni.call(this,r,t,n),Ti.call(this,r)}function Ki(e,t){let n=typeof t==`string`?t:t?.encoding??`utf8`;e=H(e,!0);let{fullPath:r}=ei(this,e);if(n==`utf8`||n==`utf-8`)return r;let i=ur.Buffer.from(r,`utf-8`);return n==`buffer`?i:i.toString(n)}function qi(e,t=384){if(Y&&!J(this,hi.call(this,e),t))throw new A(O.EACCES)}function Ji(e,t){e=H(e);let n;try{n=gi.bind(this)(e)}catch(e){if(e.code!=`ENOENT`||!t?.force)throw e}if(n)switch(n.mode&Je){case $e:if(t?.recursive)for(let n of Ii.call(this,e))Ji.call(this,U(e,n),t);Pi.call(this,e);break;case Ze:case Xe:case Qe:case et:vi.call(this,e);break;case tt:case Ye:default:throw j(`ENOSYS`,`rm`,e)}}function Yi(e,t){let n=typeof t==`object`?t?.encoding:t||`utf8`,r=nn(e);return Fi.call(this,r),n==`buffer`?ur.Buffer.from(r):r}function Xi(e,t){let n=nn(e);Fi.call(this,n);let r=()=>Ji(n,{recursive:!0,force:!0});return{path:n,remove:r,[Symbol.dispose]:r}}function Zi(e,t,n){if(e=H(e),t=H(t),n&&n&1&&mi.call(this,t))throw j(`EEXIST`,`copyFile`,t);Si.call(this,t,xi.call(this,e)),da(this,`rename`,t.toString())}function Qi(e,t,n){let r=Fr(this,e),i=0;for(let e of t)i+=r.readSync(e,0,e.byteLength,n+i);return i}function $i(e,t,n){let r=Fr(this,e),i=0;for(let e of t)i+=r.writeSync(new Uint8Array(e.buffer),0,e.byteLength,n+i);return i}function ea(e,t){return e=H(e),new ui(e,this)}function ta(e,t,n){e=H(e),t=H(t);let r=gi.call(this,e);if(n?.errorOnExist&&mi.call(this,t))throw j(`EEXIST`,`cp`,t);switch(r.mode&Je){case $e:if(!n?.recursive)throw j(`EISDIR`,`cp`,e);Fi.call(this,t,{recursive:!0});for(let r of Ii.call(this,e,{withFileTypes:!0}))n.filter&&!n.filter(U(e,r.name),U(t,r.name))||ta.call(this,U(e,r.name),U(t,r.name),n);break;case Xe:if(n?.dereference)Zi.call(this,e,t);else{let r=zi.call(this,e,`utf8`);Ri.call(this,n?.verbatimSymlinks?r:cn.call(this,W(e),r),t)}break;case Ze:Zi.call(this,e,t);break;case Qe:case et:case tt:case Ye:default:throw j(`ENOSYS`,`cp`,e)}n?.preserveTimestamps&&Wi.call(this,t,r.atime,r.mtime)}function na(e,t){e=H(e);let{fs:n}=X(e,this);return Jr(n,t?.bigint)}function ra(e,t={}){e=Array.isArray(e)?e:[e];let{cwd:n=`/`,withFileTypes:r=!1,exclude:i=()=>!1}=t,a=e.map(e=>e.replace(/^\/+/g,``)),o=a.some(e=>e.includes(`**`)),s=a.map(e=>{let t=e.search(/[*?[\]{]/);if(t===-1)return e;let n=e.lastIndexOf(`/`,t);return n===-1?``:e.slice(0,n)}),c=a.map(en),l=[];function u(e){let t=Ii(e,{withFileTypes:r,encoding:`utf8`});for(let n of t){let t=U(e,r?n.name:n);if(typeof i==`function`?i(r?n:t):i.some(e=>gn(e,t)))continue;let a=t.replace(/^\/+/g,``);hi(t).isDirectory()&&(o||s.some(e=>a===e||e.startsWith(a+`/`)))&&u(t),c.some(e=>e.test(a))&&l.push(r?n:a)}}return u(n instanceof URL?n.pathname:n),l}var ia=hi,aa=class extends c.default{_context;path;off(e,t,n,r){return super.off(e,t,n,r)}removeListener(e,t,n,r){return super.removeListener(e,t,n,r)}constructor(e,t){super(),this._context=e,this.path=t}setMaxListeners(){throw j(`ENOSYS`,`Watcher.setMaxListeners`)}getMaxListeners(){throw j(`ENOSYS`,`Watcher.getMaxListeners`)}prependListener(){throw j(`ENOSYS`,`Watcher.prependListener`)}prependOnceListener(){throw j(`ENOSYS`,`Watcher.prependOnceListener`)}rawListeners(){throw j(`ENOSYS`,`Watcher.rawListeners`)}ref(){return this}unref(){return this}},oa=class extends aa{options;realpath;constructor(e,t,n){let r=Fe(e);super(r,t),this.options=n,this.realpath=U(r.root,t),la(this.realpath,this)}close(){super.emit(`close`),ua(this.realpath,this)}[Symbol.dispose](){this.close()}},sa=class extends aa{options;intervalId;previous;constructor(e,t,n){super(e,t),this.options=n,this.start()}onInterval(){try{let e=ia.call(this._context,this.path);xn(this.previous,e)||(this.emit(`change`,e,this.previous),this.previous=e)}catch(e){this.emit(`error`,e)}}start(){let e=this.options.interval||5e3;try{this.previous=ia.call(this._context,this.path)}catch(e){this.emit(`error`,e);return}this.intervalId=setInterval(this.onInterval.bind(this),e),!this.options.persistent&&typeof this.intervalId==`object`&&this.intervalId.unref()}stop(){this.intervalId&&=(clearInterval(this.intervalId),void 0),this.removeAllListeners()}},ca=new Map;function la(e,t){let n=H(e);ca.has(n)||ca.set(n,new Set),ca.get(n).add(t)}function ua(e,t){let n=H(e);ca.has(n)&&(ca.get(n).delete(t),ca.get(n).size===0&&ca.delete(n))}function da(e,t,n){let r=Fe(e);r&&(n=U(r.root??`/`,n)),n=H(n);for(let e=n;;e=W(e)){let r=ca.get(e);if(r)for(let i of r)i.emit(`change`,t,dn.call(i._context,e,n)||fn(n));if(e===`/`)break}}var fa=function(e,t,n){if(t!=null){if(typeof t!=`object`&&typeof t!=`function`)throw TypeError(`Object expected.`);var r,i;if(n){if(!Symbol.asyncDispose)throw TypeError(`Symbol.asyncDispose is not defined.`);r=t[Symbol.asyncDispose]}if(r===void 0){if(!Symbol.dispose)throw TypeError(`Symbol.dispose is not defined.`);r=t[Symbol.dispose],n&&(i=r)}if(typeof r!=`function`)throw TypeError(`Object not disposable.`);i&&(r=function(){try{i.call(this)}catch(e){return Promise.reject(e)}}),e.stack.push({value:t,dispose:r,async:n})}else n&&e.stack.push({async:!0});return t},pa=(function(e){return function(t){function n(n){t.error=t.hasError?new e(n,t.error,`An error was suppressed during disposal.`):n,t.hasError=!0}var r,i=0;function a(){for(;r=t.stack.pop();)try{if(!r.async&&i===1)return i=0,t.stack.push(r),Promise.resolve().then(a);if(r.dispose){var e=r.dispose.call(r.value);if(r.async)return i|=2,Promise.resolve(e).then(a,function(e){return n(e),a()})}else i|=1}catch(e){n(e)}if(i===1)return t.hasError?Promise.reject(t.error):Promise.resolve();if(t.hasError)throw t.error}return a()}})(typeof SuppressedError==`function`?SuppressedError:function(e,t,n){var r=Error(n);return r.name=`SuppressedError`,r.error=e,r.suppressed=t,r});async function ma(e,t,n,r){if(t=cn.call(e,t),n){let n=X(t,e,r),i=Tr(n.fs).get(n.path)?.inode??await n.fs.stat(n.path).catch(()=>void 0);return{...n,fullPath:t,stats:i}}try{let i=X(t,e),a=Tr(i.fs).get(i.path)?.inode??await i.fs.stat(i.path);return Nn(a)?await ma(e,cn.call(e,W(t),await ga.call(e,t)),n,r):{...i,fullPath:t,stats:a}}catch{}let{base:i,dir:a}=hn(t),o=a==`/`?`/`:(await ma(e,a,!1,r)).fullPath,s=U(o,i),c=X(s,e),l=Tr(c.fs).get(c.path)?.inode??await c.fs.stat(c.path).catch(e=>{if(e.code!=`ENOENT`)throw k(Object.assign(e,{syscall:`stat`,path:s,...r}))});return l?Nn(l)?await ma(e,cn.call(e,o,await ga.call(e,s)),!1,r):{...c,fullPath:s,stats:l}:{...c,fullPath:s}}async function ha(e,t,n){t=H(t);let r=Yt(n.mode,420),i=Rr(n.flag),a={syscall:`open`,path:t},{fs:o,path:s,stats:c}=await ma(e,t,n.preserveSymlinks,a);if(!c){let l={stack:[],error:void 0,hasError:!1};try{if(!(i&64))throw j(`ENOENT`,a);let u=W(s),d=await o.stat(u);if(Y&&!J(e,d,2))throw j(`EACCES`,`open`,W(t));if(!q(d))throw j(`ENOTDIR`,`open`,W(t));if(!n.allowDirectory&&r&16384)throw j(`EISDIR`,`open`,t);if(fa(l,await Er(o,u,`rw`,d),!1),c=Tr(o).get(s)?.inode??await o.stat(s).catch(()=>void 0),!c){let{euid:n,egid:a}=Fe(e).credentials,c=await o.createFile(s,{mode:r,uid:d.mode&2048?d.uid:n,gid:d.mode&1024?d.gid:a});return da(e,`rename`,t),new Nr(e,t,s,i,Tr(o).ref(s,c))}}catch(e){l.error=e,l.hasError=!0}finally{pa(l)}}if(Y&&!J(e,c,Br(i)))throw j(`EACCES`,a);if(i&128)throw j(`EEXIST`,a);if(!n.allowDirectory&&r&16384)throw j(`EISDIR`,`open`,t);let l=new Nr(e,t,s,i,Tr(o).ref(s,c));return i&512&&await l.truncate(0),l}async function ga(e){e=H(e);let t={syscall:`readlink`,path:e},{fs:n,stats:r,path:i}=await ma(this,e,!0,t);if(!r)throw j(`ENOENT`,t);if(Y&&!J(this,r,4))throw j(`EACCES`,t);if(!Nn(r))throw j(`EINVAL`,t);let a=r.size,o=new Uint8Array(a);return await n.read(i,o,0,a),T(o)}async function _a(e,t={}){let n=H(e),{euid:r,egid:i}=Fe(this).credentials,{mode:a=511,recursive:o}=t,s={syscall:`mkdir`,path:n},{fullPath:c}=await ma(this,W(n),!1,s),{fs:l,path:u}=X(U(c,fn(n)),this,s),d=c!=W(n),f,p=async(e,t)=>{let n={stack:[],error:void 0,hasError:!1};try{let c=W(t),m=o&&c!=`/`?await p(W(e),c):await l.stat(c);if(fa(n,await Er(l,c,`rw`,m),!1),o){let n=Tr(l).get(t)?.inode??await l.stat(t).catch(()=>null);if(n){let r=Nn(n)?(await ma(this,e,!1,s)).stats:n;if(!r)throw j(`ENOENT`,s);if(!q(r))throw j(t==u?`EEXIST`:`ENOTDIR`,s);return n}if(d&&await l.exists(U(c,fn(e))))throw j(`ENOTDIR`,`mkdir`,e)}if(Y&&!J(this,m,2))throw j(`EACCES`,`mkdir`,e);let h=await l.mkdir(t,{mode:a,uid:m.mode&2048?m.uid:r,gid:m.mode&1024?m.gid:i}).catch(N({syscall:`mkdir`,path:e}));return o&&(f??=e),da(this,`rename`,e),h}catch(e){n.error=e,n.hasError=!0}finally{pa(n)}};return await p(n,u),f}async function va(e,t={}){e=H(e);let n={syscall:`scandir`,path:e},{fs:r,path:i,stats:a}=await ma(this,e,!1,n);if(!a)throw j(`ENOENT`,n);if(Y&&!J(this,a,4))throw j(`EACCES`,n);if(!q(a))throw j(`ENOTDIR`,n);let o;{let e={stack:[],error:void 0,hasError:!1};try{fa(e,await Er(r,i,`ro`,a),!1),o=await r.readdir(i)}catch(t){e.error=t,e.hasError=!0}finally{pa(e)}}let s=[],c=async e=>{let n=await r.stat(U(i,e)).catch(e=>{if(e.code!=`ENOENT`)throw e});if(!n)return;let a=new hr;if(a.ino=n.ino,a.type=pr(n.mode),a.path=e,a.name=fn(e),s.push(a),!t.recursive||!q(n))return;let o=await r.readdir(U(i,e));for(let t of o)await c(U(e,t))};return await Promise.all(o.map(c)),s}async function ya(e,t){let n={stack:[],error:void 0,hasError:!1};try{e=H(e),t=H(t);let r={syscall:`rename`,path:e,dest:t},i=await ma(this,e,!0,r),a=X(t,this,r);if(i.fs.uuid!==a.fs.uuid)throw j(`EXDEV`,r);if(a.path.startsWith(i.path+`/`))throw j(`EINVAL`,r);if(!i.stats)throw j(`ENOENT`,r);let o=i.fs,s=await o.stat(W(i.path)),c=await o.stat(W(a.path)),l=await o.stat(a.path).catch(e=>{if(e.code==`ENOENT`)return null;throw e});if(Y&&(!J(this,s,4)||!J(this,c,2)))throw j(`EACCES`,r);if(l&&!q(i.stats)&&q(l))throw j(`EISDIR`,r);if(l&&q(i.stats)&&!q(l))throw j(`ENOTDIR`,r);let u=W(i.path),d=W(a.path),f=[[u,s],[d,c]];s.ino>c.ino&&f.reverse(),fa(n,await Er(o,f[0][0],`rw`,f[0][1]),!1),fa(n,s.ino==c.ino?null:await Er(o,f[1][0],`rw`,f[1][1]),!1),await i.fs.rename(i.path,a.path),Tr(o).rename(i.path,a.path),da(this,`rename`,e),da(this,`rename`,t)}catch(e){n.error=e,n.hasError=!0}finally{pa(n)}}async function ba(e,t){let n={stack:[],error:void 0,hasError:!1};try{e=H(e),t=H(t);let r={syscall:`link`,path:e,dest:t},{fs:i,path:a}=X(e,this,r),o=X(t,this,r);if(i.uuid!=o.fs.uuid)throw j(`EXDEV`,r);let s=await i.stat(a);if(Y){if(!J(this,s,4))throw j(`EACCES`,r);let e=await i.stat(W(a));if(!J(this,e,4))throw j(`EACCES`,r);let t=await i.stat(W(o.path));if(!J(this,t,2))throw j(`EACCES`,r)}fa(n,await Er(i,W(o.path),`rw`),!1),await i.link(a,o.path),Tr(i).link(a,o.path)}catch(e){n.error=e,n.hasError=!0}finally{pa(n)}}async function xa(e,t){e=H.call(this,e);let n={syscall:t?`lstat`:`stat`,path:e},r;if(!t)r=(await ma(this,e,!1,n)).stats;else{let{base:t,dir:i}=hn(e),{fs:a,path:o}=await ma(this,i,!1,n),s=t?U(o,t):o;r=Tr(a).get(s)?.inode??await a.stat(s).catch(N(n))}if(!r)throw j(`ENOENT`,n);if(Y&&!J(this,r,4))throw j(`EACCES`,n);return r}var Sa=class extends c.default{input;output;terminal;line=``;_cursor=0;get cursor(){return this._cursor}_buffer=``;_closed=!1;_paused=!1;_prompt=``;_history=[];_historyIndex=-1;_currentLine=``;constructor(e,t,n,r=!1){super(),this.input=e,this.output=t,this.terminal=r,this.input.on(`data`,this._onData),this.input.on(`end`,this.close.bind(this)),this.input.on(`close`,this.close.bind(this))}_onData=e=>{if(!(this._paused||this._closed)){this._buffer+=typeof e==`string`?e:e.toString(`utf8`);for(let e=this._buffer.indexOf(`
|
|
2
2
|
`);e>=0;e=this._buffer.indexOf(`
|
|
3
3
|
`)){let t=this._buffer.substring(0,e);t.endsWith(`\r`)&&(t=t.substring(0,t.length-1)),this._buffer=this._buffer.substring(e+1),this.line=t,t.trim()&&!t.trim().match(/^\s*$/)&&this._history.at(-1)!=t&&(this._history.push(t),this._historyIndex=this._history.length,this.emit(`history`,this._history)),this.emit(`line`,t)}}};close(){if(!this._closed){if(this._closed=!0,this.input?.removeAllListeners?.(),this._buffer.length){let e=this._buffer;this._buffer=``,this.line=e,this.emit(`line`,e)}this.emit(`history`,this._history),this.emit(`close`),this.removeAllListeners()}}pause(){return this._paused?this:(this._paused=!0,`pause`in this.input&&this.input.pause(),this.emit(`pause`),this)}resume(){return this._paused?(this._paused=!1,`resume`in this.input&&this.input.resume(),this.emit(`resume`),this):this}setPrompt(e){this._prompt=e}getPrompt(){return this._prompt}prompt(e){if(!this.output)return;if(!e){this.output.write(this._prompt);return}let{cols:t}=this.getCursorPos();this.output.write(this._prompt),this._cursor=t}write(e,t){if(!this._closed){if(e){let t=typeof e==`string`?e:e.toString(`utf8`);this._onData(t)}if(!(!t||!this.terminal))switch((t.ctrl?`^`:``)+t.name){case`^c`:this.emit(`SIGINT`);break;case`^z`:this.emit(`SIGTSTP`);break;case`^q`:this.emit(`SIGCONT`);break;case`home`:case`^a`:if(!this.output)return;Ta(this.output,-this._cursor,0),this._cursor=0,this._cursor=0;break;case`^e`:case`end`:{if(!this.output)return;let e=this.line.length-this._cursor;if(!e)return;Ta(this.output,e,0),this._cursor=this.line.length,this._cursor=this.line.length;break}case`^k`:{if(!this.output||this._cursor>=this.line.length)return;let e=this.line.slice(0,this._cursor);wa(this.output,1),this.line=e;break}case`^u`:{if(!this.output||!this._cursor)return;let e=this.line.slice(this._cursor);wa(this.output,0),Ta(this.output,0,0),this.output.write(this._prompt+e),this.line=e,this._cursor=0,this._cursor=0;break}case`^w`:{if(!this.output||!this._cursor)return;let e=this._cursor-1;for(;e>=0&&this.line[e]===` `;)e--;for(;e>=0&&this.line[e]!==` `;)e--;let t=this.line.slice(0,e+1)+this.line.slice(this._cursor),n=e+1;this._renderLine(t),this._cursor=n,this._cursor=n,Ta(this.output,-t.length,0),Ta(this.output,n,0);break}case`^return`:case`^enter`:this._onData(`
|
|
4
4
|
`);break;case`return`:case`enter`:this._onData((e?typeof e==`string`?e:e.toString(`utf8`):``)+`
|