sliccy 4.0.2 → 4.1.0
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/{adobe-CXtz_LR-.js → adobe-BwRrpnWQ.js} +2 -2
- package/dist/ui/assets/{adobe-B4ZijlN3.js → adobe-YCqMd4M8.js} +1 -1
- package/dist/ui/assets/{agent-message-to-chat-2oatz-4r.js → agent-message-to-chat-ChcTjd5F.js} +1 -1
- package/dist/ui/assets/{anthropic-DdhoKMtR.js → anthropic-CltEkzGo.js} +1 -1
- package/dist/ui/assets/{apps-BkzP1PLW.js → apps-vzxUl8nN.js} +1 -1
- package/dist/ui/assets/{azure-openai-DTW6COMC.js → azure-openai-5Rfc0X5i.js} +1 -1
- package/dist/ui/assets/{azure-openai-C-3E46Ld.js → azure-openai-aAwJc4Fa.js} +1 -1
- package/dist/ui/assets/{azure-openai-responses-CdvI3ZMk.js → azure-openai-responses-DESC-gcX.js} +1 -1
- package/dist/ui/assets/{bsh-watchdog-BFmmHSkm.js → bsh-watchdog-B1TPqoBQ.js} +1 -1
- package/dist/ui/assets/cdn-url-builder-Cq7LLgru.js +1 -0
- package/dist/ui/assets/{cdp-Bx-nkPzL.js → cdp-CujGeIJU.js} +3 -3
- package/dist/ui/assets/composer-speech-DfnD3xcC.js +1 -0
- package/dist/ui/assets/{connect-surface-Dwz7gSuy.js → connect-surface-jUsi5PyQ.js} +1 -1
- package/dist/ui/assets/dip-Dggx_orS.js +1 -0
- package/dist/ui/assets/{dist-DU9Hdb6p.js → dist-CBvnVOEd.js} +2 -2
- package/dist/ui/assets/{dist-DBjE4kB5.js → dist-dBl5PjGe.js} +1 -1
- package/dist/ui/assets/{es-CxV76drH.js → es-CnYi0fp5.js} +1 -1
- package/dist/ui/assets/esp8266-CMGB5YBw.js +1 -0
- package/dist/ui/assets/{esptool-operations-CXqSawtf.js → esptool-operations-CfNLR8qu.js} +2 -2
- package/dist/ui/assets/{fs-C3bDUkXJ.js → fs-CYeTnPI-.js} +2 -2
- package/dist/ui/assets/{fs-Dg90t6PY.js → fs-DXM6_XIF.js} +1 -1
- package/dist/ui/assets/{github-CPCc-EUr.js → github-BSPJYOw7.js} +1 -1
- package/dist/ui/assets/{github-DxSzH6PI.js → github-DU8PC7nW.js} +2 -2
- package/dist/ui/assets/{github-copilot-C0PA1-T1.js → github-copilot-BFJtAP76.js} +2 -2
- package/dist/ui/assets/{github-copilot-BSdH-X0I.js → github-copilot-DRgOjqUh.js} +1 -1
- package/dist/ui/assets/{google-Cp_gRCg5.js → google-SsK6qdQk.js} +1 -1
- package/dist/ui/assets/{google-shared-BoLRjUxb.js → google-shared-CZRDSncd.js} +1 -1
- package/dist/ui/assets/{google-vertex-IdSaJxmx.js → google-vertex-Cmb8gKhI.js} +1 -1
- package/dist/ui/assets/hear-CCWbFt5_.js +1 -0
- package/dist/ui/assets/hear-D7LjCnnn.js +1 -0
- package/dist/ui/assets/{hosted-config-apply-CizDb9Vw.js → hosted-config-apply-DsUClJCf.js} +1 -1
- package/dist/ui/assets/{kernel-worker-DpRMAeb1.js → kernel-worker-B2ABxAEr.js} +1057 -1034
- package/dist/ui/assets/kokoro-ZxnO-aOl.js +4 -0
- package/dist/ui/assets/kokoro-engine-DyvWt6FN.js +2 -0
- package/dist/ui/assets/kokoro-engine-yfBASo8d.js +1 -0
- package/dist/ui/assets/kokoro-pZaPWf_-.js +4 -0
- package/dist/ui/assets/{legacy-styles-Bt2Mk3g2.js → legacy-styles-BgH6AX8T.js} +1 -1
- package/dist/ui/assets/{lick-ws-bridge-CIdCZl2q.js → lick-ws-bridge-Ct6u2TbW.js} +1 -1
- package/dist/ui/assets/{local-llm-DgWHei2e.js → local-llm-Dq1pfvQ-.js} +1 -1
- package/dist/ui/assets/magick-wasm-C5I4sRv-.js +1 -0
- package/dist/ui/assets/{main-D7K1MTaQ.js → main-VDVlW6vJ.js} +4 -4
- package/dist/ui/assets/{main-cherry-CXrrVAC-.js → main-cherry-DoViGBUI.js} +1 -1
- package/dist/ui/assets/mime-types-BqLkKWa7.js +1 -0
- package/dist/ui/assets/{mistral-C8Uiexjg.js → mistral-DVlL8TT7.js} +1 -1
- package/dist/ui/assets/{mount-CYuBE82h.js → mount-B0bCtsNy.js} +1 -1
- package/dist/ui/assets/{mount-BYWcec4u.js → mount-CqEOKmto.js} +2 -2
- package/dist/ui/assets/{mount-id-Cy4nG68v.js → mount-id-BL7k4LOS.js} +1 -1
- package/dist/ui/assets/{mount-picker-popup-B4U0fkZK.js → mount-picker-popup-L-IvOEYc.js} +1 -1
- package/dist/ui/assets/{new-session-C8X_CG95.js → new-session-BCfdkRT4.js} +1 -1
- package/dist/ui/assets/oauth-bootstrap-05gVzJH7.js +2 -0
- package/dist/ui/assets/{oauth-service-CmHwn7zK.js → oauth-service-CPXp6Df0.js} +1 -1
- package/dist/ui/assets/{oauth-service-CSJo71ct.js → oauth-service-DQVciyk_.js} +1 -1
- package/dist/ui/assets/{onboarding-orchestrator-DSR8Msku.js → onboarding-orchestrator-D86cOg_Y.js} +1 -1
- package/dist/ui/assets/{openai-codex-Bnd4L2L7.js → openai-codex-Ce9D8qSi.js} +1 -1
- package/dist/ui/assets/{openai-codex-DkqkFtKq.js → openai-codex-WUlFTC7l.js} +1 -1
- package/dist/ui/assets/{openai-codex-responses-iASEGX_4.js → openai-codex-responses-Cw7sZSKi.js} +1 -1
- package/dist/ui/assets/{openai-completions-CnLJNyQk.js → openai-completions-BANj7Zwf.js} +1 -1
- package/dist/ui/assets/{openai-responses-TN943MT8.js → openai-responses-Bdz_r-35.js} +1 -1
- package/dist/ui/assets/{openai-responses-shared-B1lth5mr.js → openai-responses-shared-Bf0GVnxb.js} +1 -1
- package/dist/ui/assets/panel-rpc-Ck8CVyMh.js +1 -0
- package/dist/ui/assets/panel-rpc-handlers-D9E1NuOF.js +2 -0
- package/dist/ui/assets/{picker-approval-EweLNWgE.js → picker-approval-ZlSNf9XH.js} +1 -1
- package/dist/ui/assets/{provider-DQ7BvBZw.js → provider-BD44wd5M.js} +2 -2
- package/dist/ui/assets/{provider-tWBv0sFX.js → provider-DchdZ_iY.js} +1 -1
- package/dist/ui/assets/{provider-settings-VV6aNiP5.js → provider-settings-Bpero1dy.js} +2 -2
- package/dist/ui/assets/provider-store-access-BRsxr8aG.js +1 -0
- package/dist/ui/assets/provider-store-access-CXH2pv7H.js +1 -0
- package/dist/ui/assets/{providers-BmSZZhhm.js → providers-BkYhxKu6.js} +1 -1
- package/dist/ui/assets/{quick-llm-DdZDN1QH.js → quick-llm-C7qsNQ23.js} +1 -1
- package/dist/ui/assets/{remote-cdp-transport-B3-CFmk-.js → remote-cdp-transport-CY4HCHMt.js} +1 -1
- package/dist/ui/assets/{remote-terminal-view-Hlq3HwiU.js → remote-terminal-view-CAspkbd0.js} +1 -1
- package/dist/ui/assets/{secret-env-CkbRu-AG.js → secret-env-ClpNQz5E.js} +1 -1
- package/dist/ui/assets/session-freezer-CDJ0LMDM.js +1 -0
- package/dist/ui/assets/{setup-sprinkle-exec-ByJwHfyz.js → setup-sprinkle-exec-3Ce8eZIO.js} +1 -1
- package/dist/ui/assets/setup-sudo-DvCouRbU.js +1 -0
- package/dist/ui/assets/{slicc-editor-BxRqmU98.js → slicc-editor-3x24ubXG.js} +1 -1
- package/dist/ui/assets/speak-BP4kRSob.js +1 -0
- package/dist/ui/assets/speak-ClR2IFMA.js +1 -0
- package/dist/ui/assets/speech-GZe1rUoJ.js +1 -0
- package/dist/ui/assets/{sprinkle-manager-CqLTFoc9.js → sprinkle-manager-CnY6ywkn.js} +1 -1
- package/dist/ui/assets/{sprinkle-renderer-5HX0pMZZ.js → sprinkle-renderer-VEg0Lrdb.js} +3 -3
- package/dist/ui/assets/{store-CQo5JYZe.js → store-CwrBveMa.js} +1 -1
- package/dist/ui/assets/{sudo-fe6QprlZ.js → sudo-zQotxIxd.js} +1 -1
- package/dist/ui/assets/{sync-dialog-C1-e9vyv.js → sync-dialog-Du9ou3tH.js} +1 -1
- package/dist/ui/assets/transformers-env-6vj5CcH9.js +1 -0
- package/dist/ui/assets/transformers-env-BpvHTeJT.js +1 -0
- package/dist/ui/assets/transformers.web-CZmmPdTH.js +37 -0
- package/dist/ui/assets/transformers.web-DJfCkvxA.js +43 -0
- package/dist/ui/assets/{tray-leave-runtime--Ue08Cke.js → tray-leave-runtime-LeLWNjL3.js} +1 -1
- package/dist/ui/assets/upgrade-detection-CG244vbe.js +1 -0
- package/dist/ui/assets/voice-reply-DKjUm-gK.js +1 -0
- package/dist/ui/assets/{wc-attach-xs9Fh-R8.js → wc-attach-BhTWbr7A.js} +3 -3
- package/dist/ui/assets/{wc-detached-ux_E6SNJ.js → wc-detached-CaTkd06a.js} +1 -1
- package/dist/ui/assets/wc-extension-CBhrd25w.js +2 -0
- package/dist/ui/assets/{wc-live-DHS3FYU1.js → wc-live-D-74QVkK.js} +6 -6
- package/dist/ui/assets/{wc-nav-BZZe3rw8.js → wc-nav-sEwx5MmG.js} +2 -2
- package/dist/ui/assets/{wc-onboarding-Cz9h4OE8.js → wc-onboarding-B8ix1fhH.js} +2 -2
- package/dist/ui/assets/{wc-placeholder-CO111fjo.js → wc-placeholder-CxOC717D.js} +3 -3
- package/dist/ui/assets/{wc-settings-DiYFz75I.js → wc-settings-FThSal5a.js} +3 -3
- package/dist/ui/assets/{wc-shell-9F74yNEh.js → wc-shell-DZWnmdP6.js} +233 -110
- package/dist/ui/assets/{wc-sprinkles-CUllz5Rn.js → wc-sprinkles-DBsp5Mxm.js} +2 -2
- package/dist/ui/assets/{wc-tray-DnIxlO0o.js → wc-tray-6hyXFRhO.js} +3 -3
- package/dist/ui/assets/{wc-voice-DyAmRENA.js → wc-voice-DWqHH3C5.js} +1 -1
- package/dist/ui/assets/{welcome-detection-D-eB9s6-.js → welcome-detection-DDhgn9wj.js} +1 -1
- package/dist/ui/assets/whisper-session-D6m7AmYy.js +2 -0
- package/dist/ui/assets/{xai-grok-BNfjuAeJ.js → xai-grok-BmiypN03.js} +1 -1
- package/dist/ui/assets/{xai-grok-D8Dda6Qy.js → xai-grok-sUSfoNvO.js} +1 -1
- package/dist/ui/index.html +1 -1
- package/dist/ui/packages/webapp/index.html +1 -1
- package/package.json +1 -1
- package/dist/ui/assets/dip-_QvZN8wj.js +0 -1
- package/dist/ui/assets/esp8266-91jA_HHD.js +0 -1
- package/dist/ui/assets/magick-wasm-BCSDiya9.js +0 -1
- package/dist/ui/assets/mime-types-BG9Gw1bq.js +0 -1
- package/dist/ui/assets/oauth-bootstrap-DIqfOl-7.js +0 -2
- package/dist/ui/assets/panel-rpc-Bcvr75SR.js +0 -1
- package/dist/ui/assets/panel-rpc-handlers-BgzkmaOE.js +0 -2
- package/dist/ui/assets/provider-store-access-BGKXkdbd.js +0 -1
- package/dist/ui/assets/provider-store-access-Vtg1yxDc.js +0 -1
- package/dist/ui/assets/session-freezer-JMR8P1Lt.js +0 -1
- package/dist/ui/assets/setup-sudo-DPXnK0Zw.js +0 -1
- package/dist/ui/assets/upgrade-detection-CHRBJqBB.js +0 -1
- package/dist/ui/assets/wc-extension-BLxY1h5k.js +0 -2
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import{o as e,r as t,t as n}from"./chunk-CMxvf4Kt.js";import{d as r,u as i}from"./kernel-worker-DpRMAeb1.js";function a(e,t){if(e.byteLength>=t)return e;if(ArrayBuffer.isView(e)){let n=a(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 o=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(o.prototype,e,{value:()=>{throw ReferenceError(`Do not use DataView methods on a BufferView.`)},writable:!1,enumerable:!1,configurable:!1});var s=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],r=this.regions[t+1];if(r.offset-(n.offset+n.data.byteLength)>e){t++;continue}n.ranges.push(...r.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=a(n.data,r.offset+r.data.byteLength),n.data.set(r.data,r.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,r=this.regionAt(t);if(r)return r.data=a(r.data,n),r.data.set(e,t),r.ranges.push({start:t,end:n}),r.ranges.sort((e,t)=>e.start-t.start),this.collect(),this;let i={data:e,offset:t,ranges:[{start:t,end:n}]},o=this.regions.findIndex(e=>e.offset>t);return o==-1?this.regions.push(i):this.regions.splice(o,0,i),this.collect(),this}};const c=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;c[e]=t}function l(e){let t=4294967295;for(let n=0;n<e.length;n++)t=t>>>8^c[(t^e[n])&255];return(t^4294967295)>>>0}var u=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),d=class extends u.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 f(e,t){let n=Object.entries(e);return Object.fromEntries(n.filter(([e,n])=>t(e,n)))}function p(e,...t){let n={};for(let r of t.flat())n[r]=e[r];return n}function m(e,...t){return f(e,e=>!t.flat().includes(e))}function h(e){try{return JSON.parse(e),!0}catch{return!1}}function g(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 _(e,t){return Object.fromEntries(Object.entries(e).map(([e,n])=>[e,typeof n==`function`?n.bind(t):n]))}function v(e=Error()){let t=setTimeout(()=>{throw e},5e3);return()=>clearTimeout(t)}function y(e){throw e&&typeof e==`object`&&g(e).includes(`Error`)&&Error?.captureStackTrace(e,y),e}const b=Intl.NumberFormat(`en`,{notation:`compact`});b.format.bind(b);function x(e=0,t=1){return Math.round(Math.random()*(t-e)+e)}function S(e){return e.at(0).toUpperCase()+e.slice(1)}const C=new TextEncoder;function w(e){return C.encode(e)}const T=new TextDecoder;function ee(e){if(!e)return``;if(e.buffer instanceof ArrayBuffer&&!e.buffer.resizable)return T.decode(e);let t=new Uint8Array(e.byteLength);return t.set(e),T.decode(t)}function te(e){let t=new Uint8Array(e.length);for(let n=0;n<e.length;n++)t[n]=e.charCodeAt(n);return t}function ne(e){let t=``;for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return t}function E(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||={});const re={[O.EPERM]:`Operation not permitted`,[O.ENOENT]:`No such file or directory`,[O.ESRCH]:`No such process`,[O.EINTR]:`Interrupted system call`,[O.EIO]:`Input/output 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]:`Out of memory`,[O.EACCES]:`Permission denied`,[O.EFAULT]:`Bad address`,[O.ENOTBLK]:`Block device required`,[O.EBUSY]:`Resource busy or locked`,[O.EEXIST]:`File exists`,[O.EXDEV]:`Invalid cross-device link`,[O.ENODEV]:`No such device`,[O.ENOTDIR]:`File is not a directory`,[O.EISDIR]:`File is a directory`,[O.EINVAL]:`Invalid argument`,[O.ENFILE]:`Too many open files in system`,[O.EMFILE]:`Too many open files`,[O.ETXTBSY]:`Text file busy`,[O.EFBIG]:`File is too big`,[O.ENOSPC]:`No space left on disk`,[O.ESPIPE]:`Illegal seek`,[O.EROFS]:`Cannot modify a read-only file system`,[O.EMLINK]:`Too many links`,[O.EPIPE]:`Broken pipe`,[O.EDOM]:`Numerical argument out of domain`,[O.ERANGE]:`Numerical result out of range`,[O.EDEADLK]:`Resource deadlock would occur`,[O.ENAMETOOLONG]:`File name too long`,[O.ENOLCK]:`No locks available`,[O.ENOSYS]:`Function not implemented`,[O.ENOTEMPTY]:`Directory is not empty`,[O.ELOOP]:`Too many levels of symbolic links`,[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]:`Invalid or incomplete multibyte or wide character`,[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 is not supported`,[O.EPFNOSUPPORT]:`Protocol family not supported`,[O.EAFNOSUPPORT]:`Address family not supported by protocol`,[O.EADDRINUSE]:`Address already in use`,[O.EADDRNOTAVAIL]:`Cannot assign requested address`,[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]:`Transport endpoint is already connected`,[O.ENOTCONN]:`Transport endpoint 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]:`No route to host`,[O.EALREADY]:`Operation 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}: ${re[e.errno]}, ${e.syscall}`;return e.path&&(t+=` '${e.path}'`),e.dest&&(t+=` -> '${e.dest}'`),e.message&&!e.message.startsWith(re[e.errno])&&(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,m(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??re[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:()=>ce,configure:()=>Ee,crit:()=>le,debug:()=>fe,deprecated:()=>pe,emerg:()=>se,entries:()=>ae,err:()=>R,fancy:()=>ve,format:()=>be,info:()=>de,isEnabled:()=>Te,levelOf:()=>I,levels:()=>ie,log:()=>L,notice:()=>ue,warn:()=>z}),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||={});const ie=[`emergency`,`alert`,`critical`,`error`,`warning`,`notice`,`info`,`debug`];function I(e){return ie.indexOf(e)}const ae=new d;function L(e,t){if(!Te)return;let n={level:e,message:t,timestamp:new Date,elapsedMs:performance.now()};ae.add(n),Se(n)}function oe(e){return function(t){return L(e,t.toString()),t}}const se=oe(F.EMERG),ce=oe(F.ALERT),le=oe(F.CRIT),R=oe(F.ERR),z=oe(F.WARN),ue=oe(F.NOTICE),de=oe(F.INFO),fe=oe(F.DEBUG);function pe(e){L(F.WARN,e+` is deprecated and should not be used.`)}function me(e,t){return`\x1b[${t}m${e}\x1b[0m`}function he(e){return`[`+(e.elapsedMs/1e3).toFixed(3).padStart(10)+`] `}const ge={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;`}},_e={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 ve({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`?[me(he(n),`2;37`)]:[`opacity: 0.8; color: white;`,he(n)];let r=e==`ansi`?[me(ie[n.level].toUpperCase(),ge.ansi[n.level])]:[ge.css[n.level],ie[n.level].toUpperCase()];if(t==`level`){yield*r,yield n.message;return}n.level<F.CRIT&&(yield*r),e==`ansi`?yield me(n.message,_e.ansi[n.level]):yield*[_e.css[n.level],n.message]}}let ye=e=>[he(e),e.message];function be(e){let t=ye(e);return typeof t==`string`?[t]:Array.from(t)}let xe=console.error;function Se(e){e.level>Ce||xe(...be(e))}let Ce=F.ALERT,we=!1,Te=!0;function Ee(e){if(ye=e.format??ye,xe=e.output??xe,Ce=typeof e.level==`string`?I(e.level):e.level??Ce,Te=e.enabled??Te,we=e.stack??we,e.dumpBacklog)for(let e of ae)Se(e)}function De(e){return typeof e==`object`&&!!e&&`create`in e&&typeof e.create==`function`}function Oe(e,t){return Object.defineProperty(t,"prototype",{value:void 0}),e&&Object.defineProperty(t,"name",{value:e}),t}function ke(e){return!(e&&e.constructor===Function)||e.prototype===void 0?!1:Function.prototype===Object.getPrototypeOf(e)?Object.getOwnPropertyNames(e.prototype).length>1:!0}function Ae(e,t){if(typeof t!=`object`||!t)throw R(M(`EINVAL`,`Invalid options`));for(let[n,r]of Object.entries(e.options)){let e=t?.[n];if(e==null){if(!r.required){fe(`Using default for option: `+n);continue}throw R(M(`EINVAL`,`Missing required option: `+n))}let i=(t,n=e)=>typeof t==`function`?ke(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 R(M(`EINVAL`,`Incorrect type for "${n}": ${a} (expected ${Array.isArray(r.type)?`one of ${r.type.map(o).join(`, `)}`:o(r.type)})`))}}function je(e){return typeof e==`object`&&!!e&&`backend`in e&&De(e.backend)}function Me(e){return{suid:e.uid,sgid:e.gid,euid:e.uid,egid:e.gid,groups:[],...e}}function Ne(e){return e?!e.uid||!e.gid||!e.euid||!e.egid||e.groups.some(e=>!e):!1}const Pe=Symbol(`ZenFSContext`),Fe={[Pe]:!0,id:0,root:`/`,pwd:`/`,credentials:Me({uid:0,gid:0}),descriptors:new Map,parent:null,children:[]};function Ie(e){return typeof e==`object`&&e&&Pe in e?e:Fe}let Le=1;function Re(e,t={}){let{root:n=e.root,pwd:r=e.pwd,credentials:i=structuredClone(e.credentials)}=t,a={[Pe]:!0,id:Le++,root:n,pwd:r,credentials:Me(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 ze=t({COPYFILE_EXCL:()=>1,COPYFILE_FICLONE:()=>2,COPYFILE_FICLONE_FORCE:()=>4,F_OK:()=>0,O_APPEND:()=>Be,O_CREAT:()=>64,O_DIRECT:()=>qe,O_DIRECTORY:()=>Ve,O_DSYNC:()=>Ge,O_EXCL:()=>128,O_NOATIME:()=>He,O_NOCTTY:()=>256,O_NOFOLLOW:()=>Ue,O_NONBLOCK:()=>Je,O_RDONLY:()=>0,O_RDWR:()=>2,O_SYMLINK:()=>Ke,O_SYNC:()=>We,O_TRUNC:()=>512,O_WRONLY:()=>1,R_OK:()=>4,S_IFBLK:()=>$e,S_IFCHR:()=>tt,S_IFDIR:()=>et,S_IFIFO:()=>nt,S_IFLNK:()=>Ze,S_IFMT:()=>Ye,S_IFREG:()=>Qe,S_IFSOCK:()=>Xe,S_IRGRP:()=>32,S_IROTH:()=>4,S_IRUSR:()=>256,S_IRWXG:()=>56,S_IRWXO:()=>7,S_IRWXU:()=>448,S_ISGID:()=>it,S_ISUID:()=>rt,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:()=>at});const Be=1024,Ve=65536,He=262144,Ue=131072,We=1052672,Ge=4096,Ke=32768,qe=16384,Je=2048,Ye=61440,Xe=49152,Ze=40960,Qe=32768,$e=24576,et=16384,tt=8192,nt=4096,rt=2048,it=1024,at=4294967295;function ot(e){return`__isArrayType`in e&&e.__isArrayType===!0}function st(e){return typeof e!=`object`&&typeof e!=`function`||e==null?!1:ot(e)?st(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`&&ct.has(e.name)&&ct.get(e.name)?.name===e.name}const ct=new Map;function lt(e){if(ct.has(e.name))throw ReferenceError(`Type is already registered: ${e.name}`);ct.set(e.name,e)}const ut=Symbol(`DataView`);function dt(e){return e[ut]??=new DataView(e),e[ut]}const ft={name:`int8`,size:1,array:Int8Array,get:(e,t)=>dt(e).getInt8(t),set:(e,t,n)=>dt(e).setInt8(t,n)},pt={name:`uint8`,size:1,array:Uint8Array,get:(e,t)=>dt(e).getUint8(t),set:(e,t,n)=>dt(e).setUint8(t,n)},mt={int8:ft,uint8:pt,int16:{name:`int16`,size:2,array:Int16Array,get:(e,t)=>dt(e).getInt16(t,!0),set:(e,t,n)=>dt(e).setInt16(t,n,!0)},uint16:{name:`uint16`,size:2,array:Uint16Array,get:(e,t)=>dt(e).getUint16(t,!0),set:(e,t,n)=>dt(e).setUint16(t,n,!0)},int32:{name:`int32`,size:4,array:Int32Array,get:(e,t)=>dt(e).getInt32(t,!0),set:(e,t,n)=>dt(e).setInt32(t,n,!0)},uint32:{name:`uint32`,size:4,array:Uint32Array,get:(e,t)=>dt(e).getUint32(t,!0),set:(e,t,n)=>dt(e).setUint32(t,n,!0)},int64:{name:`int64`,size:8,array:BigInt64Array,get:(e,t)=>dt(e).getBigInt64(t,!0),set:(e,t,n)=>dt(e).setBigInt64(t,n,!0)},uint64:{name:`uint64`,size:8,array:BigUint64Array,get:(e,t)=>dt(e).getBigUint64(t,!0),set:(e,t,n)=>dt(e).setBigUint64(t,n,!0)},float32:{name:`float32`,size:4,array:Float32Array,get:(e,t)=>dt(e).getFloat32(t,!0),set:(e,t,n)=>dt(e).setFloat32(t,n,!0)},float64:{name:`float64`,size:8,array:Float64Array,get:(e,t)=>dt(e).getFloat64(t,!0),set:(e,t,n)=>dt(e).setFloat64(t,n,!0)}},ht=Object.keys(mt);for(let e of Object.values(mt))lt(e);const gt={...mt,...Object.fromEntries(ht.map(e=>[S(e),mt[e]])),char:pt},_t=Object.keys(gt);function vt(e){return _t.includes(e.toString())}function yt(e){if(!vt(e))throw M(`EINVAL`,`Not a valid primitive type: `+e)}function bt(e){return e==`char`?`uint8`:e.toLowerCase()}function xt(e){return(typeof e==`object`||typeof e==`function`)&&e!==null&&`toInit`in e&&typeof e.toInit==`function`}function St(e){return xt(e)?e.toInit():st(e)?{type:e}:e}function Ct(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(St(t),n);if(!st(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 zt?`${i.typeName??i.type.type.name} ${r}[${i.type.length}]${a}`:`${i.typeName??i.type.name} ${r}`,littleEndian:!i.bigEndian}}function wt(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,wt),n}function Tt(e,t){return t.type instanceof zt&&t.type.length==0&&!!t.countedBy?.length&&!!e.constructor.isDynamic}function Et(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 Dt(e,t){let n=t.type.type.size*Et(e,t);if(Nt(t.type.type)&&t.type.type.isDynamic)for(let r of e[t.name])n+=Pt(r);return n}const Ot=Symbol(`kOffsets`);function kt(e,t,n){let{offset:r,name:i}=t;e[Ot]||=Object.create(null);let a=e[Ot];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)){Tt(e,t)&&(r+=Dt(e,t));let n=e[t.name];Mt(n)&&n.constructor.isDynamic&&(r+=Pt(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 At(e,t,n,r){typeof n==`string`&&(n=n.charCodeAt(0));let i=e.byteOffset+kt(e,t,!1)+(r??0)*t.type.size;try{t.type.set(e.buffer,i,n);return}catch(e){wt(e,i)}}function jt(e,t){let n=t.type;if(Tt(e,t)){let r=t.type.type;n=new zt(r,Et(e,t))}let r=e.byteOffset+kt(e,t,!0);try{return n.get(e.buffer,r)}catch(e){wt(e,r)}}function Mt(e){return typeof e==`object`&&!!e&&`constructor`in e&&Nt(e.constructor)}function Nt(e){return typeof e==`function`&&`prototype`in e&&`fields`in e&&typeof e.fields==`object`&&st(e)}function Pt(e){let t=0;for(let n of e.constructor.fields){let r=e[n.name];Tt(e,n)&&(t+=Dt(e,n)),Mt(r)&&r.constructor.isDynamic&&(t+=Pt(r))}return t}function Ft(e){if(st(e))return e.size;if(e==null)return 0;if(typeof e==`object`&&st(e.constructor))return e.constructor.size;if(Array.isArray(e)){let t=0;for(let n=0;n<e.length;n++)t+=Ft(e[n]);return t}if(typeof e==`string`)return yt(e),mt[bt(e)].size;throw TypeError(`Unable to resolve size of \`${e.toString()}\``)}function B(e){let t=Ft(e);return Mt(e)&&e.constructor.isDynamic?t+Pt(e):t}function It(e,t){let n;if(Nt(e)){if(e.isDynamic)throw M(`EINVAL`,`Cannot get offset of field in dynamic struct from the constructor`);n=e}else if(Mt(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 Nt(e)?i.offset:kt(e,i,!0)}function Lt(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??y(`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 Rt(e){return typeof e==`function`&&`prototype`in e&&`fields`in e&&typeof e.fields==`object`&&st(e)}var zt=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=Lt(this),this.__structArray=Lt(e,t),this.__arrayType=e.array?e.array:this.__structArray}get=(e,t)=>vt(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+=Rt(this.type)&&this.type.isDynamic?B(n[t]):this.type.size}};array};Symbol.metadata??=Symbol.for(`Symbol.metadata`);function Bt(e){e.metadata??={};let t=e.metadata.structInit??{};return e.metadata.structInit={fields:[...t.fields??[]]},e.metadata.structInit}function Vt(...e){let t=e.reduce((e,t)=>({...e,...t}),{});return typeof this==`object`&&Object.assign(t,this),function(e,n){let r=Bt(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 jt(this,e)},set(t){At(this,e,t)}})}}return n.addInitializer(function(){Object.defineProperty(c,"name",{value:e.name}),lt(c)}),c}}Vt.packed=Vt.bind({isPacked:!0}),Vt.align=function(e){return Vt.bind({alignment:e})};function Ht(e,t={}){return function(n,r){if(r.kind!=`accessor`)throw M(`EINVAL`,`Field must be an accessor`);let i=Bt(r),a=Ct(r.name,e,t);return i.fields.push(a),{get(){return jt(this,a)},set(e){At(this,a,e)}}}}function Ut(e){let t=mt[bt(e)];function n(n,r){return typeof n==`number`?Ht(new zt(t,n),{typeName:e,...r}):Ht(t,{typeName:e})(n,r&&`name`in r?r:y(M(`EINVAL`,`Invalid decorator context object`)))}return n}const V=Object.fromEntries(_t.map(e=>[e,Ut(e)]));function Wt(e){return e}Wt.typed=function(e){return e};var Gt=class e{type;init;constructor(t,n){this.type=t,this.init=n;let r=(r=>new e(new zt(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 Kt(e,t=0){return new Gt(new zt(e,t),{})}function qt(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=Ct(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 jt(this,e)},set(t){At(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 lt(c),c}qt.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=Ct(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 lt(l),l},qt.packed=qt.bind({isPacked:!0}),qt.align=function(e){return qt.bind({alignment:e})},qt.dynamic=qt.bind({isDynamic:!0}),Object.fromEntries(Object.entries(gt).map(([e,t])=>[e,new Gt(t,{typeName:e})]));function Jt(e){return JSON.parse(ee(e),(e,t)=>e==``?t:typeof t==`string`?BigInt(t).toString(16).slice(0,Math.min(t.length,8)):t)}function Yt(e){return w(JSON.stringify(e))}function Xt(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())}function Zt(e){if(e instanceof Date)return e.getTime();try{return Number(e)}catch{throw M(`EINVAL`,`Invalid time.`)}}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:sn.call(this,e)}function Qt(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:Xt(`mode`in e?e?.mode:null,r)}}function $t(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 en(e){let t=Promise.withResolvers();setTimeout(()=>t.reject(M(`ETIMEDOUT`)),500),e.on(`online`,t.resolve),await t.promise}function tn(e){return`/tmp/${H(e,!0)}${Date.now()}-${Math.random().toString(36).slice(2)}`}var nn=t({basename:()=>dn,dirname:()=>W,extname:()=>fn,format:()=>pn,formatExt:()=>on,isAbsolute:()=>ln,join:()=>U,matchesGlob:()=>hn,normalize:()=>cn,normalizeString:()=>an,parse:()=>mn,relative:()=>un,resolve:()=>sn,sep:()=>`/`});function rn(e,t){if(typeof e!=`object`)throw TypeError(`"${t}" is not an object`)}function an(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}else 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 on(e){return e?`${e[0]===`.`?``:`.`}${e}`:``}function sn(...e){let t=``;for(let n of[...e.reverse(),Ie(this).pwd])if(n?.length&&(t=`${n}/${t}`,n.startsWith(`/`)))break;let n=t.startsWith(`/`);return t=an(t,!n),n?`/${t}`:t.length?t:`/`}function cn(e){if(!e.length)return`.`;let t=e[0]===`/`,n=e.at(-1)===`/`;return e=an(e,!t),e.length?(n&&(e+=`/`),t?`/${e}`:e):t?`/`:n?`./`:`.`}function ln(e){return e.startsWith(`/`)}function U(...e){if(!e.length)return`.`;let t=e.filter(e=>e).join(`/`);return t?.length?cn(t):`.`}function un(e,t){if(e===t||(e=sn.call(this,e),t=sn.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 dn(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 fn(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 pn(e){rn(e,`pathObject`);let t=e.dir||e.root,n=e.base||`${e.name||``}${on(e.ext)}`;return t?t===e.root?`${t}${n}`:`${t}/${n}`:n}function mn(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 hn(e,t){return $t(e).test(t)}const gn=BigInt(1e3);var _n=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(Qe)),Object.assign(this,l)}isFile(){return(this.mode&Ye)==Qe}isDirectory(){return(this.mode&Ye)==et}isSymbolicLink(){return(this.mode&Ye)==Ze}isSocket(){return(this.mode&Ye)==Xe}isBlockDevice(){return(this.mode&Ye)==$e}isCharacterDevice(){return(this.mode&Ye)==tt}isFIFO(){return(this.mode&Ye)==nt}toJSON(){return p(this,Dn)}hasAccess(e,t){return q(t,this._isBigint?new vn(this):this,e)}get atimeNs(){return BigInt(this.atimeMs)*gn}get mtimeNs(){return BigInt(this.mtimeMs)*gn}get ctimeNs(){return BigInt(this.ctimeMs)*gn}get birthtimeNs(){return BigInt(this.birthtimeMs)*gn}},vn=class extends _n{_isBigint=!1},yn=class extends _n{_isBigint=!0};function bn(e,t){return e.size==t.size&&+e.atime==+t.atime&&+e.mtime==+t.mtime&&+e.ctime==+t.ctime&&e.mode==t.mode}var xn=class{type=525687744115;bsize=4096;blocks=0;bfree=0;bavail=0;files=at;ffree=at},Sn=class{type=BigInt(`0x7a656e6673`);bsize=BigInt(4096);blocks=BigInt(0);bfree=BigInt(0);bavail=BigInt(0);files=BigInt(at);ffree=BigInt(at)},Cn=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};const wn=3968;let Tn=(()=>{var e,t;let n=[Vt.packed()],r,i=[],a,o=Wt.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)],Cn(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),Cn(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),Cn(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 ee(this.subarray(8,8+this.keySize))}set name(e){let t=w(e);if(8+t.length+this.valueSize>wn)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>wn)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})(),En=(()=>{var e;let t=[Vt.packed()],n,r=[],i,a=Wt(o),s,c=[],l=[];var u=class extends a{static{i=this}static{let o=typeof Symbol==`function`&&Symbol.metadata?Object.create(a[Symbol.metadata]??null):void 0;s=[(e=V).uint32.bind(e)],Cn(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:o},c,l),Cn(null,n={value:i},t,{kind:`class`,name:i.name,metadata:o},null,r),u=i=n.value,o&&Object.defineProperty(i,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:o})}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 Tn(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 Tn(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 Tn(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 Tn(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 Tn(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 Tn(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 Tn(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 Tn(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 Tn(this.buffer,e);yield[t.name,t.value],e+=t.size}}constructor(){super(...arguments),G(this,l)}static{G(i,r)}};return i})();const Dn=[`ino`,`data`,`size`,`mode`,`flags`,`nlink`,`uid`,`gid`,`atimeMs`,`birthtimeMs`,`mtimeMs`,`ctimeMs`,`version`];var On;(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`})(On||={});let K=(()=>{var e,t,n,r,i,a,s,c,l,u,d,f,m,h,g,_;let v=[Vt.packed()],y,b=[],x,S=Wt(o),C,w=[],T=[],ee,te=[],ne=[],E,D=[],O=[],re,k=[],A=[],j,N=[],P=[],F,ie=[],I=[],ae,L=[],oe=[],se,ce=[],R=[],ue,de=[],fe=[],pe,me=[],he=[],ge,_e=[],ve=[],ye,be=[],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 o=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)],E=[(n=V).uint32.bind(n)],re=[(r=V).uint16.bind(r)],j=[(i=V).uint32.bind(i)],F=[(a=V).uint32.bind(a)],ae=[(s=V).uint32.bind(s)],se=[(c=V).float64.bind(c)],ue=[(l=V).float64.bind(l)],pe=[(u=V).float64.bind(u)],ge=[(d=V).float64.bind(d)],ye=[(f=V).uint32.bind(f)],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=[Ht(En)],Be=[V.uint8(wn)],Cn(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:o},w,T),Cn(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:o},te,ne),Cn(this,null,E,{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:o},D,O),Cn(this,null,re,{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:o},k,A),Cn(this,null,j,{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:o},N,P),Cn(this,null,F,{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:o},ie,I),Cn(this,null,ae,{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:o},L,oe),Cn(this,null,se,{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:o},ce,R),Cn(this,null,ue,{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:o},de,fe),Cn(this,null,pe,{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:o},me,he),Cn(this,null,ge,{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:o},_e,ve),Cn(this,null,ye,{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:o},be,xe),Cn(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:o},Ce,we),Cn(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:o},Ee,De),Cn(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:o},ke,Ae),Cn(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:o},Me,Ne),Cn(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:o},Fe,Ie),Cn(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:o},Re,ze),Cn(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:o},Ve,He),Cn(null,y={value:x},v,{kind:`class`,name:x.name,metadata:o},null,b),Ue=x=y.value,o&&Object.defineProperty(x,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:o})}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)]),super(...e),G(this,He),this.byteLength<B(Ue))throw le(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&&z(`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,te,void 0));get __data_old(){return this.#t}set __data_old(e){this.#t=e}#n=(G(this,ne),G(this,D,void 0));get size(){return this.#n}set size(e){this.#n=e}#r=(G(this,O),G(this,k,void 0));get mode(){return this.#r}set mode(e){this.#r=e}#i=(G(this,A),G(this,N,void 0));get nlink(){return this.#i}set nlink(e){this.#i=e}#a=(G(this,P),G(this,ie,void 0));get uid(){return this.#a}set uid(e){this.#a=e}#o=(G(this,I),G(this,L,void 0));get gid(){return this.#o}set gid(e){this.#o=e}#s=(G(this,oe),G(this,ce,void 0));get atimeMs(){return this.#s}set atimeMs(e){this.#s=e}#c=(G(this,R),G(this,de,void 0));get birthtimeMs(){return this.#c}set birthtimeMs(e){this.#c=e}#l=(G(this,fe),G(this,me,void 0));get mtimeMs(){return this.#l}set mtimeMs(e){this.#l=e}#u=(G(this,he),G(this,_e,void 0));get ctimeMs(){return this.#u}set ctimeMs(e){this.#u=e}#d=(G(this,ve),G(this,be,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{...p(this,Dn),attributes:this.attributes}}toStats(){return new vn(this)}update(e){if(!e)return!1;let t=!1;for(let n of Dn)e[n]!==void 0&&(n==`ino`||n==`data`||this[n]!==e[n]&&(n==`atimeMs`&&this.flags&On.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 kn(e){return(e.mode&Ye)==Qe}function An(e){return(e.mode&Ye)==et}function jn(e){return(e.mode&Ye)==Ze}function Mn(e){return(e.mode&Ye)==Xe}function Nn(e){return(e.mode&Ye)==$e}function Pn(e){return(e.mode&Ye)==tt}function Fn(e){return(e.mode&Ye)==nt}function q(e,t,n){let{credentials:r}=Ie(e);if(jn(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 In(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 Ln=class e extends Map{maxSize=at;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[dn(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[dn(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??=x(1,at),t==`/`&&(n.ino=0),this.set(t,new K(n));return this}static parse(t){if(!h(t))throw M(`EINVAL`,`Invalid JSON`);let n=JSON.parse(t),r=new e;return r.fromJSON(n),r}};const Rn=4096;var zn=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+=Rn){let r=t+Rn>a?a-t:Rn,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??=(z(`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??=(z(`Using a polyfill of Symbol.dispose`),Symbol(`Symbol.dispose`)),Symbol.asyncDispose??=(z(`Using a polyfill of Symbol.asyncDispose`),Symbol(`Symbol.asyncDispose`)),globalThis.crypto.randomUUID??=(z(`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??=(z(`Using a polyfill of Uint8Array.prototype.toBase64`),function(){return btoa(String.fromCharCode(...this))}),Uint8Array.fromBase64??=(z(`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??=(z(`Using a polyfill of Uint8Array.prototype.toHex`),function(){return[...this].map(e=>e.toString(16).padStart(2,`0`)).join(``)}),Uint8Array.fromHex??=(z(`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 Bn=class{store;constructor(e){this.store=e}},Vn=class extends Bn{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)}},Hn=class extends Bn{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 s(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){z(`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)}},Un=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 Hn))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 Hn))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)}}},Wn=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},Gn=(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}),Kn=class extends zn{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=un(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){z(`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,fe(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=Wn(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,Yt(r.get(t)));await n.commit()}catch(e){t.error=e,t.hasError=!0}finally{let e=Gn(t);e&&await e}}loadIndexSync(e){let t={stack:[],error:void 0,hasError:!1};try{let n=Wn(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,Yt(r.get(t)));n.commitSync()}catch(e){t.error=e,t.hasError=!0}finally{Gn(t)}}async createIndex(){let e={stack:[],error:void 0,hasError:!1};try{let t=new Ln,n=Wn(e,this.transaction(),!0),r=[[`/`,0]],i=v(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=Jt(await n.get(a.data)??y(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=Gn(e);t&&await t}}createIndexSync(){let e={stack:[],error:void 0,hasError:!1};try{let t=new Ln,n=Wn(e,this.transaction(),!1),r=[[`/`,0]],i=v(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=Jt(n.getSync(a.data)??y(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{Gn(e)}}async rename(e,t){let n={stack:[],error:void 0,hasError:!1};try{let r=Wn(n,this.transaction(),!0),i=mn(e),a=mn(t),o=await this.findInode(r,i.dir),s=Jt(await r.get(o.data)??y(M(`ENODATA`)));if(!s[i.base])throw M(`ENOENT`);let c=s[i.base];if(c!=this._ids.get(e)&&R(`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:Jt(await r.get(u.data)??y(M(`ENODATA`)));if(d[a.base]){let e=new K(await r.get(d[a.base])??y(M(`ENOENT`)));if(!kn(e))throw M(`EISDIR`);await r.remove(e.data),await r.remove(d[a.base])}d[a.base]=c,await r.set(o.data,Yt(s)),await r.set(u.data,Yt(d)),await r.commit(),this._move(e,t)}catch(e){n.error=e,n.hasError=!0}finally{let e=Gn(n);e&&await e}}renameSync(e,t){let n={stack:[],error:void 0,hasError:!1};try{let r=Wn(n,this.transaction(),!1),i=mn(e),a=mn(t),o=this.findInodeSync(r,i.dir),s=Jt(r.getSync(o.data)??y(M(`ENODATA`)));if(!s[i.base])throw M(`ENOENT`);let c=s[i.base];if(c!=this._ids.get(e)&&R(`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:Jt(r.getSync(u.data)??y(M(`ENODATA`)));if(d[a.base]){let e=new K(r.getSync(d[a.base])??y(M(`ENOENT`)));if(!kn(e))throw M(`EISDIR`);r.removeSync(e.data),r.removeSync(d[a.base])}d[a.base]=c,r.setSync(o.data,Yt(s)),r.setSync(u.data,Yt(d)),r.commitSync(),this._move(e,t)}catch(e){n.error=e,n.hasError=!0}finally{Gn(n)}}async stat(e){let t={stack:[],error:void 0,hasError:!1};try{let n=Wn(t,this.transaction(),!0);return await this.findInode(n,e)}catch(e){t.error=e,t.hasError=!0}finally{let e=Gn(t);e&&await e}}statSync(e){let t={stack:[],error:void 0,hasError:!1};try{let n=Wn(t,this.transaction(),!1);return this.findInodeSync(n,e)}catch(e){t.error=e,t.hasError=!0}finally{Gn(t)}}async touch(e,t){let n={stack:[],error:void 0,hasError:!1};try{let r=Wn(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=Gn(n);e&&await e}}touchSync(e,t){let n={stack:[],error:void 0,hasError:!1};try{let r=Wn(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{Gn(n)}}async createFile(e,t){return t.mode|=Qe,await this.commitNew(e,t,new Uint8Array)}createFileSync(e,t){return t.mode|=Qe,this.commitNewSync(e,t,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 t.mode|=et,await this.commitNew(e,t,w(`{}`))}mkdirSync(e,t){return t.mode|=et,this.commitNewSync(e,t,w(`{}`))}async readdir(e){let t={stack:[],error:void 0,hasError:!1};try{let n=Wn(t,this.transaction(),!0),r=await this.findInode(n,e);return Object.keys(Jt(await n.get(r.data)??y(M(`ENOENT`))))}catch(e){t.error=e,t.hasError=!0}finally{let e=Gn(t);e&&await e}}readdirSync(e){let t={stack:[],error:void 0,hasError:!1};try{let n=Wn(t,this.transaction(),!1),r=this.findInodeSync(n,e);return Object.keys(Jt(n.getSync(r.data)??y(M(`ENOENT`))))}catch(e){t.error=e,t.hasError=!0}finally{Gn(t)}}async sync(){}syncSync(){}async link(e,t){let n={stack:[],error:void 0,hasError:!1};try{let r=Wn(n,this.transaction(),!0),i=W(t),a=await this.findInode(r,i),o=Jt(await r.get(a.data)??y(M(`ENOENT`))),s=await this.findInode(r,e);s.nlink++,o[dn(t)]=s.ino,this._add(s.ino,t),await r.set(s.ino,s),await r.set(a.data,Yt(o)),await r.commit()}catch(e){n.error=e,n.hasError=!0}finally{let e=Gn(n);e&&await e}}linkSync(e,t){let n={stack:[],error:void 0,hasError:!1};try{let r=Wn(n,this.transaction(),!1),i=W(t),a=this.findInodeSync(r,i),o=Jt(r.getSync(a.data)??y(M(`ENOENT`))),s=this.findInodeSync(r,e);s.nlink++,o[dn(t)]=s.ino,this._add(s.ino,t),r.setSync(s.ino,s),r.setSync(a.data,Yt(o)),r.commitSync()}catch(e){n.error=e,n.hasError=!0}finally{Gn(n)}}async read(e,t,n,r){let i={stack:[],error:void 0,hasError:!1};try{let a=Wn(i,this.transaction(),!0),o=await this.findInode(a,e);if(o.size==0)return;let s=await a.get(o.data,n,r)??y(M(`ENODATA`)),c=a.flag(`partial`)?s:s.subarray(n,r);c.byteLength>t.byteLength&&R(`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=Gn(i);e&&await e}}readSync(e,t,n,r){let i={stack:[],error:void 0,hasError:!1};try{let a=Wn(i,this.transaction(),!1),o=this.findInodeSync(a,e);if(o.size==0)return;let s=a.getSync(o.data,n,r)??y(M(`ENODATA`)),c=a.flag(`partial`)?s:s.subarray(n,r);c.byteLength>t.byteLength&&R(`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{Gn(i)}}async write(e,t,n){let r={stack:[],error:void 0,hasError:!1};try{let i=Wn(r,this.transaction(),!0),o=await this.findInode(i,e),s=t;i.flag(`partial`)||(s=a(await i.get(o.data)??new Uint8Array,n+t.byteLength),s.set(t,n),n=0),await i.set(o.data,s,n),this._add(o.ino,e),await i.commit()}catch(e){r.error=e,r.hasError=!0}finally{let e=Gn(r);e&&await e}}writeSync(e,t,n){let r={stack:[],error:void 0,hasError:!1};try{let i=Wn(r,this.transaction(),!1),o=this.findInodeSync(i,e),s=t;i.flag(`partial`)||(s=a(i.getSync(o.data)??new Uint8Array,n+t.byteLength),s.set(t,n),n=0),i.setSync(o.data,s,n),this._add(o.ino,e),i.commitSync()}catch(e){r.error=e,r.hasError=!0}finally{Gn(r)}}transaction(){return new Un(this.store.transaction(),this)}async checkRoot(){let e={stack:[],error:void 0,hasError:!1};try{let t=Wn(e,this.transaction(),!0);if(await t.get(0))return;let n=new K({ino:0,data:1,mode:16895});await t.set(n.data,w(`{}`)),this._add(0,`/`),await t.set(0,n),await t.commit()}catch(t){e.error=t,e.hasError=!0}finally{let t=Gn(e);t&&await t}}checkRootSync(){let e={stack:[],error:void 0,hasError:!1};try{let t=Wn(e,this.transaction(),!1);if(t.getSync(0))return;let n=new K({ino:0,data:1,mode:16895});t.setSync(n.data,w(`{}`)),this._add(0,`/`),t.setSync(0,n),t.commitSync()}catch(t){e.error=t,e.hasError=!0}finally{Gn(e)}}async _populate(){let e={stack:[],error:void 0,hasError:!1};try{if(this._initialized){z(`Attempted to populate tables after initialization`);return}fe(`Populating tables with existing store metadata`);let t=Wn(e,this.transaction(),!0),n=await t.get(0);if(!n){ue(`Store does not have a root inode`);let e=new K({ino:0,data:1,mode:16895});await t.set(e.data,w(`{}`)),this._add(0,`/`),await t.set(0,e),await t.commit();return}if(n.length<B(K)){le(`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){z(`Store is missing data for inode: `+n);continue}if(o.length<B(K)){z(`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){z(`Store is missing directory data: `+s.data);continue}let l=Jt(c);for(let[t,n]of Object.entries(l))a.push([U(e,t),n])}fe(`Added ${i} existing inode(s) from store`)}catch(t){e.error=t,e.hasError=!0}finally{let t=Gn(e);t&&await t}}_populateSync(){let e={stack:[],error:void 0,hasError:!1};try{if(this._initialized){z(`Attempted to populate tables after initialization`);return}fe(`Populating tables with existing store metadata`);let t=Wn(e,this.transaction(),!1),n=t.getSync(0);if(!n){ue(`Store does not have a root inode`);let e=new K({ino:0,data:1,mode:16895});t.setSync(e.data,w(`{}`)),this._add(0,`/`),t.setSync(0,e),t.commitSync();return}if(n.length<B(K)){le(`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){z(`Store is missing data for inode: `+n);continue}if(o.length<B(K)){z(`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){z(`Store is missing directory data: `+s.data);continue}let l=Jt(c);for(let[t,n]of Object.entries(l))a.push([U(e,t),n])}fe(`Added ${i} existing inode(s) from store`)}catch(t){e.error=t,e.hasError=!0}finally{Gn(e)}}async _findInode(e,t,n=new Set){if(n.has(t))throw le(M(`EIO`,`Infinite loop detected while finding inode`));if(n.add(t),t==`/`)return new K(await e.get(0)??y(M(`ENODATA`)));let{dir:r,base:i}=mn(t),a=await this._findInode(e,r,n),o=Jt(await e.get(a.data)??y(M(`ENODATA`)));if(!(i in o))throw M(`ENOENT`);return new K(await e.get(o[i])??y(M(`ENODATA`)))}_findInodeSync(e,t,n=new Set){if(n.has(t))throw le(M(`EIO`,`Infinite loop detected while finding inode`));if(n.add(t),t==`/`)return new K(e.getSync(0)??y(M(`ENOENT`)));let{dir:r,base:i}=mn(t),a=this._findInodeSync(e,r,n),o=Jt(e.getSync(a.data)??y(M(`ENODATA`)));if(!(i in o))throw M(`ENOENT`);return new K(e.getSync(o[i])??y(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)??y(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)??y(M(`ENOENT`)))}_lastID;allocNew(e){this._lastID??=Math.max(...this._paths.keys()),this._lastID+=2;let t=this._lastID;if(t>4294967295)throw R(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=Wn(r,this.transaction(),!0),{dir:a,base:o}=mn(e),s=await this.findInode(i,a),c=Jt(await i.get(s.data)??y(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,Yt(c)),await i.commit(),u}catch(e){r.error=e,r.hasError=!0}finally{let e=Gn(r);e&&await e}}commitNewSync(e,t,n){let r={stack:[],error:void 0,hasError:!1};try{if(e==`/`)throw M(`EEXIST`);let i=Wn(r,this.transaction(),!1),{dir:a,base:o}=mn(e),s=this.findInodeSync(i,a),c=Jt(i.getSync(s.data)??y(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,Yt(c)),i.commitSync(),u}catch(e){r.error=e,r.hasError=!0}finally{Gn(r)}}async remove(e,t){let n={stack:[],error:void 0,hasError:!1};try{let r=Wn(n,this.transaction(),!0),{dir:i,base:a}=mn(e),o=await this.findInode(r,i),s=Jt(await r.get(o.data)??y(M(`ENOENT`)));if(!s[a])throw M(`ENOENT`);let c=s[a],l=new K(await r.get(c)??y(M(`ENOENT`)));if(delete s[a],!t&&An(l))throw M(`EISDIR`);await r.set(o.data,Yt(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=Gn(n);e&&await e}}removeSync(e,t){let n={stack:[],error:void 0,hasError:!1};try{let r=Wn(n,this.transaction(),!1),{dir:i,base:a}=mn(e),o=this.findInodeSync(r,i),s=Jt(r.getSync(o.data)??y(M(`ENOENT`))),c=s[a];if(!c)throw M(`ENOENT`);let l=new K(r.getSync(c)??y(M(`ENOENT`)));if(delete s[a],!t&&An(l))throw M(`EISDIR`);r.setSync(o.data,Yt(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{Gn(n)}}},qn=class extends Vn{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)}},Jn=class extends Hn{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)}},Yn=class extends Map{maxSize;label;flags=[];name=`tmpfs`;constructor(e=at,t){super(),this.maxSize=e,this.label=t}async sync(){}transaction(){return new qn(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}}};const Xn={name:`InMemory`,options:{maxSize:{type:`number`,required:!1},label:{type:`string`,required:!1}},create({maxSize:e,label:t}){let n=new Kn(new Yn(e,t));return n.checkRootSync(),n}};var Zn=class extends Kn{devices=new Map;devicesWithDriver(e,t){if(t&&typeof e==`string`)throw R(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,...m(i??{},`metadata`),driver:e,inode:new K({mode:8630,...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),de(`Initialized device: `+this._mountPoint+o),a}addDefaults(){this._createDevice($n),this._createDevice(er),this._createDevice(tr),this._createDevice(nr),this._createDevice(rr),fe(`Added default devices`)}constructor(){super(new Yn(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(dn(n));return t}readdirSync(e){let t=super.readdirSync(e);for(let n of this.devices.keys())W(n)==e&&t.push(dn(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)}};const Qn=new Uint8Array,$n={name:`null`,singleton:!0,init(){return{major:1,minor:3}},read(){return Qn},write(){}},er={name:`zero`,singleton:!0,init(){return{major:1,minor:5}},read(e,t,n,r){t.fill(0,n,r)},write(){}},tr={name:`full`,singleton:!0,init(){return{major:1,minor:7}},read(e,t,n,r){t.fill(0,n,r)},write(){throw M(`ENOSPC`)}},nr={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(){}},rr={name:`console`,singleton:!0,init(e,{output:t=e=>console.log(e)}={}){return{major:5,minor:1,data:{output:t}}},read(){return Qn},write(e,t,n){let r=ee(t);e.data.output(r,n)}},ir={null:$n,zero:er,full:tr,random:nr,console:rr};var ar=r();let J=!0;function or(e){J=e}var sr;(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`})(sr||={});function cr(e){return(e&61440)>>12}function lr(e){return e<<12}var ur=class{ino;type;path;name},dr=class{context;path;fs;internalPath;flag;inode;_buffer;_position=0;get position(){return this.flag&1024?this.inode.size:this._position}set position(e){this._position=e}dirty=!1;closed=!1;get isClosed(){return this.closed}constructor(e,t,n,r,i,a){this.context=e,this.path=t,this.fs=n,this.internalPath=r,this.flag=i,this.inode=a}get _isSync(){return!!(this.flag&1052672||this.inode.flags&On.Sync||this.fs.attributes.has(`sync`))}[Symbol.dispose](){this.closeSync()}syncSync(){if(this.closed)throw j(`EBADF`,`sync`,this.path);this.dirty&&=(this.fs.attributes.has(`no_write`)||this.fs.touchSync(this.internalPath,this.inode),!1)}datasyncSync(){return this.syncSync()}closeSync(){if(this.closed)throw j(`EBADF`,`close`,this.path);this.syncSync(),this.disposeSync()}disposeSync(e){if(this.closed)throw j(`EBADF`,`close`,this.path);if(this.dirty&&!e)throw j(`EBUSY`,`close`,this.path);this.closed=!0}truncateSync(e){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&On.Immutable)throw j(`EPERM`,`truncate`,this.path);this.dirty=!0,this.inode.mtimeMs=Date.now(),this.inode.size=e,this.inode.ctimeMs=Date.now(),this._isSync&&this.syncSync()}writeSync(e,t=0,n=e.byteLength-t,r=this.position){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&On.Immutable)throw j(`EPERM`,`write`,this.path);this.dirty=!0;let i=r+n,a=e.subarray(t,t+n);return!Pn(this.inode)&&!Nn(this.inode)&&i>this.inode.size&&(this.inode.size=i),this.inode.mtimeMs=Date.now(),this.inode.ctimeMs=Date.now(),this._position=r+a.byteLength,this.fs.writeSync(this.internalPath,a,r),this._isSync&&this.syncSync(),a.byteLength}readSync(e,t=0,n=e.byteLength-t,r=this.position){if(this.closed||this.flag&1)throw j(`EBADF`,`read`,this.path);!(this.inode.flags&On.NoAtime)&&!this.fs.attributes.has(`no_atime`)&&(this.dirty=!0,this.inode.atimeMs=Date.now());let i=r+n;!Pn(this.inode)&&!Nn(this.inode)&&i>this.inode.size&&(i=r+Math.max(this.inode.size-r,0)),this._position=i;let a=new Uint8Array(e.buffer,e.byteOffset,e.byteLength);return this.fs.readSync(this.internalPath,a.subarray(t,t+n),r,i),this._isSync&&this.syncSync(),i-r}chmodSync(e){if(this.closed)throw j(`EBADF`,`chmod`,this.path);this.dirty=!0,this.inode.mode=this.inode.mode&(e>61440?-61441:Ye)|e,(this._isSync||e>61440)&&this.syncSync()}chownSync(e,t){if(this.closed)throw j(`EBADF`,`chmod`,this.path);this.dirty=!0,In(this.inode,e,t),this._isSync&&this.syncSync()}utimesSync(e,t){if(this.closed)throw j(`EBADF`,`utimes`,this.path);this.dirty=!0,this.inode.atimeMs=e,this.inode.mtimeMs=t,this._isSync&&this.syncSync()}async[Symbol.asyncDispose](){await this.close()}async sync(){if(this.closed)throw j(`EBADF`,`sync`,this.path);this.dirty&&=(this.fs.attributes.has(`no_write`)||await this.fs.touch(this.internalPath,this.inode),!1)}datasync(){return this.sync()}async close(){if(this.closed)throw j(`EBADF`,`close`,this.path);await this.sync(),this.dispose()}dispose(e){if(this.closed)throw j(`EBADF`,`close`,this.path);if(this.dirty&&!e)throw j(`EBUSY`,`close`,this.path);this.closed=!0}stat(){if(this.closed)throw j(`EBADF`,`stat`,this.path);return this.inode}async truncate(e){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&On.Immutable)throw j(`EPERM`,`truncate`,this.path);this.dirty=!0,this.inode.mtimeMs=Date.now(),this.inode.size=e,this.inode.ctimeMs=Date.now(),this._isSync&&await this.sync()}async write(e,t=0,n=e.byteLength-t,r=this.position){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&On.Immutable)throw j(`EPERM`,`write`,this.path);this.dirty=!0;let i=r+n,a=e.subarray(t,t+n);return!Pn(this.inode)&&!Nn(this.inode)&&i>this.inode.size&&(this.inode.size=i),this.inode.mtimeMs=Date.now(),this.inode.ctimeMs=Date.now(),this._position=r+a.byteLength,await this.fs.write(this.internalPath,a,r),this._isSync&&await this.sync(),a.byteLength}async read(e,t=0,n=e.byteLength-t,r=this.position){if(this.closed||this.flag&1)throw j(`EBADF`,`read`,this.path);!(this.inode.flags&On.NoAtime)&&!this.fs.attributes.has(`no_atime`)&&(this.dirty=!0,this.inode.atimeMs=Date.now());let i=r+n;!Pn(this.inode)&&!Nn(this.inode)&&i>this.inode.size&&(i=r+Math.max(this.inode.size-r,0)),this._position=i;let a=new Uint8Array(e.buffer,e.byteOffset,e.byteLength);return await this.fs.read(this.internalPath,a.subarray(t,t+n),r,i),this._isSync&&await this.sync(),i-r}async chmod(e){if(this.closed)throw j(`EBADF`,`chmod`,this.path);this.dirty=!0,this.inode.mode=this.inode.mode&(e>61440?-61441:Ye)|e,(this._isSync||e>61440)&&await this.sync()}async chown(e,t){if(this.closed)throw j(`EBADF`,`chown`,this.path);this.dirty=!0,In(this.inode,e,t),this._isSync&&await this.sync()}async utimes(e,t){if(this.closed)throw j(`EBADF`,`utimes`,this.path);this.dirty=!0,this.inode.atimeMs=e,this.inode.mtimeMs=t,this._isSync&&await this.sync()}streamRead(e){if(this.closed)throw j(`EBADF`,`streamRead`,this.path);return this.fs.streamRead(this.internalPath,e)}streamWrite(e){if(this.closed)throw j(`EBADF`,`write`,this.path);if(this.inode.flags&On.Immutable)throw j(`EPERM`,`write`,this.path);if(this.fs.attributes.has(`readonly`))throw j(`EROFS`,`write`,this.path);return this.fs.streamWrite(this.internalPath,e)}};function fr(e){let t=Ie(e.context).descriptors,n=Math.max(t.size?Math.max(...t.keys())+1:0,4);return t.set(n,e),n}function pr(e,t){let n=Ie(e).descriptors.get(t);if(!n)throw M(`EBADF`);return n}function mr(e,t){return Ie(e).descriptors.delete(t)}const hr=/[rwasx]{1,2}\+?/;function gr(e){if(typeof e==`number`)return e;if(!hr.test(e))throw M(`EINVAL`,`Invalid flag string: `+e);return _r(e)}function _r(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|=Be),e.includes(`+`)?t|=2:e.includes(`r`)||(t|=1),e.includes(`s`)&&(t|=We),e.includes(`x`)&&(t|=128),t}function vr(e){let t=0;return e&1||(t|=4),(e&1||e&2)&&(t|=2),t}const yr=A;function br(e,t){return e.path=t,e}function xr(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 Sr(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}})}const Cr=new Map;wr(`/`,Xn.create({label:`root`}));function wr(e,t){if(e[0]!=`/`&&(e=`/`+e),e=sn.call(this,e),Cr.has(e))throw R(M(`EINVAL`,`Mount point is already in use: `+e));t._mountPoint=e,Cr.set(e,t),de(`Mounted ${t.name} on ${e}`),fe(`${t.name} attributes: ${[...t.attributes].map(([e,t])=>t==null?e:e+`=`+t).join(`, `)}`)}function Tr(e){if(e[0]!=`/`&&(e=`/`+e),e=sn.call(this,e),!Cr.has(e)){z(e+` is already unmounted`);return}Cr.delete(e),ue(`Unmounted `+e)}function Y(e,t,n){let{root:r}=Ie(t),i={path:e,...n};e=H(U(r,e),!0),e=sn.call(t,e);let a=[...Cr].sort((e,t)=>e[0].length>t[0].length?-1:1);for(let[t,n]of a){if(!Or(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:Sr(n,i),path:e,mountPoint:t,root:r}}throw ce(new A(O.EIO,`No file system for `+e))}function Er(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 Dr(e){let t=Ie(this);if(!Ne(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 Or(e,t){return e===`/`||e===t?!0:(e.endsWith(`/`)||(e+=`/`),t.startsWith(e))}var kr=t({link:()=>Ir,mkdir:()=>Nr,open:()=>jr,readdir:()=>Pr,readlink:()=>Mr,rename:()=>Fr,resolve:()=>Ar,stat:()=>Lr});function Ar(e,t,n,r){t=sn.call(e,t);try{let i=Y(t,e),a=i.fs.statSync(i.path);return!jn(a)||n?{...i,fullPath:t,stats:a}:Ar(e,sn.call(e,W(t),Mr.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}=mn(t),o=a==`/`?`/`:Ar(e,a,!1,r).fullPath,s=U(o,i),c=Y(s,e),l;try{l=c.fs.statSync(c.path)}catch(e){if(e.code===`ENOENT`)return{...c,fullPath:t};throw k(Object.assign(e,{syscall:`stat`,path:s,...r}))}return jn(l)?Ar(e,sn.call(e,o,Mr.call(e,s)),!1,r):{...c,fullPath:s,stats:l}}function jr(e,t){e=H(e);let n=Xt(t.mode,420),r=gr(t.flag);e=t.preserveSymlinks?e:Ar(this,e).fullPath;let{fs:i,path:a}=Y(e,this),o;try{o=i.statSync(a)}catch{}if(!o){if(!(r&64))throw j(`ENOENT`,`open`,e);let o=i.statSync(W(a));if(J&&!q(this,o,2))throw j(`EACCES`,`open`,e);if(!An(o))throw j(`ENOTDIR`,`open`,e);if(!t.allowDirectory&&n&16384)throw j(`EISDIR`,`open`,e);if(J&&!q(this,o,2))throw j(`EACCES`,`open`,e);let{euid:s,egid:c}=Ie(this).credentials,l=i.createFileSync(a,{mode:n,uid:o.mode&2048?o.uid:s,gid:o.mode&1024?o.gid:c});return new dr(this,e,i,a,r,l)}if(J&&(!q(this,o,n)||!q(this,o,vr(r))))throw j(`EACCES`,`open`,e);if(r&128)throw j(`EEXIST`,`open`,e);let s=new dr(this,e,i,a,r,o);if(!t.allowDirectory&&o.mode&16384)throw j(`EISDIR`,`open`,e);return r&512&&s.truncateSync(0),s}function Mr(e){e=H(e);let{fs:t,stats:n,path:r}=Ar(this,e,!0);if(!n)throw j(`ENOENT`,`readlink`,e);if(J&&!q(this,n,4))throw j(`EACCES`,`readlink`,e);if(!jn(n))throw j(`EINVAL`,`readlink`,e);let i=n.size,a=new Uint8Array(i);return t.readSync(r,a,0,i),ee(a)}function Nr(e,t={}){e=H(e);let{fs:n,path:r}=Ar(this,e),{euid:i,egid:a}=Ie(this).credentials,{mode:o=511,recursive:s}=t,c=(e,t,r)=>{if(J&&!q(this,r,2))throw j(`EACCES`,`mkdir`,W(e));let s=n.mkdirSync(t,{mode:o,uid:r.mode&2048?r.uid:i,gid:r.mode&1024?r.gid:a});return zi(this,`rename`,e),s};if(!s){c(e,r,n.statSync(W(r)));return}let l=[];for(let t=r,i=e;!n.existsSync(t);t=W(t),i=W(i))l.unshift({resolved:t,original:i});if(!l.length)return;let u=[n.statSync(W(l[0].resolved))];for(let[e,t]of l.entries())u.push(c(t.original,t.resolved,u[e]));return l[0].original}function Pr(e,t={}){e=H(e);let{fs:n,path:r}=Ar(this,e),i=n.statSync(r);if(J&&!q(this,i,4))throw j(`EACCES`,`readdir`,e);if(!An(i))throw j(`ENOTDIR`,`readdir`,e);let a=n.readdirSync(r),o=[],s=e=>{let i;try{i=n.statSync(U(r,e))}catch(e){if(e.code==`ENOENT`)return;throw e}let a=new ur;if(a.ino=i.ino,a.type=cr(i.mode),a.path=e,a.name=dn(e),o.push(a),!An(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 Fr(e,t){e=H(e),t=H(t);let n={syscall:`rename`,path:e,dest:t},r=Ar(this,e,!0,n),i=Y(t,this,n);if(r.fs.uuid!==i.fs.uuid)throw j(`EXDEV`,n);if(i.path.startsWith(r.path+`/`))throw j(`EBUSY`,n);if(!r.stats)throw j(`ENOENT`,n);let a=r.fs,o=a.statSync(W(r.path)),s=a.statSync(W(i.path)),c;try{c=a.statSync(i.path)}catch(e){if(e.code!=`ENOENT`)throw e}if(J&&(!q(this,o,4)||!q(this,s,2)))throw j(`EACCES`,n);if(c&&!An(r.stats)&&An(c))throw j(`EISDIR`,n);if(c&&An(r.stats)&&!An(c))throw j(`ENOTDIR`,n);r.fs.renameSync(r.path,i.path),zi(this,`rename`,e),zi(this,`change`,t)}function Ir(e,t){e=H(e),t=H(t);let n={syscall:`link`,path:t,dest:e},{fs:r,path:i}=Y(e,this,n),a=Y(t,this,n);if(r.uuid!==a.fs.uuid)throw j(`EXDEV`,n);let o=r.statSync(i);if(J){if(!q(this,o,4))throw j(`EACCES`,n);let e=r.statSync(W(i));if(!q(this,e,4))throw j(`EACCES`,n);let t=r.statSync(W(a.path));if(!q(this,t,2))throw j(`EACCES`,n)}return r.linkSync(i,a.path)}function Lr(e,t){e=H.call(this,e);let n={syscall:t?`lstat`:`stat`,path:e},r;if(!t)r=Ar(this,e,!1,n).stats;else{let{base:t,dir:i}=mn(e),{fs:a,path:o}=Ar(this,i,!1,n);try{r=a.statSync(t?U(o,t):o)}catch(e){throw k(Object.assign(e,n)),e}}if(!r)throw j(`ENOENT`,n);if(J&&!q(this,r,4))throw j(`EACCES`,n);return r}var Rr=class e{ino;type;_name;get name(){let e=ar.Buffer.from(this._name);return this._encoding==`buffer`?e:e.toString(this._encoding)}_encoding;_parentPath;get parentPath(){return this._parentPath}get path(){return z(`Dirent.path was removed in Node v24, use parentPath instead`),this._parentPath}static from(t,n){let r=new e,{base:i,dir:a}=mn(t.path);return r._parentPath=a||`.`,r._name=i,r.ino=t.ino,r.type=t.type,r._encoding=n,r}isFile(){return this.type===sr.REG}isDirectory(){return this.type===sr.DIR}isBlockDevice(){return this.type===sr.BLK}isCharacterDevice(){return this.type===sr.CHR}isSymbolicLink(){return this.type===sr.LNK}isFIFO(){return this.type===sr.FIFO}isSocket(){return this.type===sr.SOCK}},zr=class{path;context;closed=!1;checkClosed(){if(this.closed)throw M(`EBADF`,`Can not use closed Dir`)}_entries;constructor(e,t){this.path=e,this.context=t}close(e){if(this.closed=!0,!e)return Promise.resolve();e(null)}closeSync(){this.closed=!0}async _read(){return this.checkClosed(),this._entries??=await Ga.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??=di.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()}},Br=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},Vr=(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 Hr(e,t){return Fr.call(this,e,t)}function Ur(e){e=H(e);try{let{fs:t,path:n}=Ar(this,e);return t.existsSync(n)}catch(e){if(e.errno==O.ENOENT)return!1;throw e}}function Wr(e,t){let n=Lr.call(this,e,!1);return t?.bigint?new yn(n):new vn(n)}function Gr(e,t){let n=Lr.call(this,e,!0);return t?.bigint?new yn(n):new vn(n)}function Kr(e,t=0){let n={stack:[],error:void 0,hasError:!1};try{let r=Br(n,jr.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{Vr(n)}}function qr(e){e=H(e);let{fs:t,path:n}=Y(e,this);try{if(J&&!q(this,t.statSync(n),2))throw j(`EACCES`,`unlink`);t.unlinkSync(n)}catch(t){throw k(Object.assign(t,{path:e}))}zi(this,`rename`,e.toString())}function Jr(e,t,n=0){return fr(jr.call(this,e,{flag:t,mode:n}))}function Yr(e,t,n){return fr(jr.call(this,e,{flag:t,mode:n,preserveSymlinks:!0}))}function Xr(e,t={}){let n={stack:[],error:void 0,hasError:!1};try{let r=Qt(t,null,`r`,420);if(gr(r.flag)&1)throw j(`EBADF`,`read`,e.toString());let i=Br(n,typeof e==`number`?pr(this,e):jr.call(this,e.toString(),{flag:r.flag,mode:420,preserveSymlinks:!1}),!1),{size:a}=i.stat(),o=ar.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{Vr(n)}}function Zr(e,t,n={}){let r={stack:[],error:void 0,hasError:!1};try{let i=Qt(n,`utf8`,`w+`,420),a=gr(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`?ar.Buffer.from(t,i.encoding):new Uint8Array(t.buffer,t.byteOffset,t.byteLength);if(!o)throw new A(O.EINVAL,`Data not specified`);Br(r,typeof e==`number`?pr(this,e):jr.call(this,e.toString(),{flag:a,mode:i.mode,preserveSymlinks:!0}),!1).writeSync(o,0,o.byteLength,0),zi(this,`change`,e.toString())}catch(e){r.error=e,r.hasError=!0}finally{Vr(r)}}function Qr(e,t,n={}){let r=Qt(n,`utf8`,`a+`,420),i=gr(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`?ar.Buffer.from(t,r.encoding):new Uint8Array(t.buffer,t.byteOffset,t.byteLength),o=typeof e==`number`?pr(this,e):jr.call(this,H(e),{flag:i,mode:r.mode,preserveSymlinks:!0});o.writeSync(a,0,a.byteLength),typeof o!=`number`&&o.closeSync()}function $r(e,t){let n=pr(this,e).stat();return t?.bigint?new yn(n):new vn(n)}function ei(e){pr(this,e).closeSync(),mr(this,e)}function ti(e,t=0){if(t||=0,t<0)throw new A(O.EINVAL);pr(this,e).truncateSync(t)}function ni(e){pr(this,e).syncSync()}function ri(e){pr(this,e).datasyncSync()}function ii(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=ar.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=pr(this,e);c??=l.position;let u=l.writeSync(a,o,s,c);return zi(this,`change`,l.path),u}function ai(e,t,n,r,i){let a=pr(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 oi(e,t,n){pr(this,e).chownSync(t,n)}function si(e,t){let n=Xt(t,-1);if(n<0)throw new A(O.EINVAL,`Invalid mode.`);pr(this,e).chmodSync(n)}function ci(e,t,n){pr(this,e).utimesSync(Zt(t),Zt(n))}function li(e){e=H(e);let{fs:t,path:n}=Ar(this,e),r=xr(t,`statSync`,e)(n);if(!An(r))throw j(`ENOTDIR`,`rmdir`,e);if(J&&!q(this,r,2))throw j(`EACCES`,`rmdir`,e);xr(t,`rmdirSync`,e)(n),zi(this,`rename`,e.toString())}function ui(e,t){t=typeof t==`object`?t:{mode:t};let n=Xt(t?.mode,511);return Nr.call(this,e,{...t,mode:n})}function di(e,t){t=typeof t==`object`?t:{encoding:t},e=H(e);let n=[],r=Pr.call(this,e,t??void 0);for(let e of r)t?.withFileTypes?n.push(Rr.from(e,t.encoding)):t?.encoding==`buffer`?n.push(ar.Buffer.from(e.path)):n.push(e.path);return n}function fi(e,t){return Ir.call(this,e,t)}function pi(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=Br(r,jr.call(this,t,{flag:`wx`,mode:420}),!1);i.writeSync(w(H(e,!0))),i.chmodSync(Ze)}catch(e){r.error=e,r.hasError=!0}finally{Vr(r)}}function mi(e,t){let n=ar.Buffer.from(Mr.call(this,e)),r=typeof t==`object`?t?.encoding:t;return r==`buffer`?n:n.toString(r??`utf-8`)}function hi(e,t,n){let r={stack:[],error:void 0,hasError:!1};try{Br(r,jr.call(this,e,{flag:`r+`,mode:0}),!1).chownSync(t,n)}catch(e){r.error=e,r.hasError=!0}finally{Vr(r)}}function gi(e,t,n){let r=Yr.call(this,e,`r+`);oi.call(this,r,t,n),ei.call(this,r)}function _i(e,t){let n=Jr.call(this,e,`r+`);si.call(this,n,t),ei.call(this,n)}function vi(e,t){let n=Yr.call(this,e,`r+`);si.call(this,n,t),ei.call(this,n)}function yi(e,t,n){let r=Jr.call(this,e,`r+`);ci.call(this,r,t,n),ei.call(this,r)}function bi(e,t,n){let r=Yr.call(this,e,`r+`);ci.call(this,r,t,n),ei.call(this,r)}function xi(e,t){let n=typeof t==`string`?t:t?.encoding??`utf8`;e=H(e,!0);let{fullPath:r}=Ar(this,e);if(n==`utf8`||n==`utf-8`)return r;let i=ar.Buffer.from(r,`utf-8`);return n==`buffer`?i:i.toString(n)}function Si(e,t=384){if(J&&!q(this,Wr.call(this,e),t))throw new A(O.EACCES)}function Ci(e,t){e=H(e);let n;try{n=Gr.bind(this)(e)}catch(e){if(e.code!=`ENOENT`||!t?.force)throw e}if(n)switch(n.mode&Ye){case et:if(t?.recursive)for(let n of di.call(this,e))Ci.call(this,U(e,n),t);li.call(this,e);break;case Qe:case Ze:case $e:case tt:qr.call(this,e);break;case nt:case Xe:default:throw j(`ENOSYS`,`rm`,e)}}function wi(e,t){let n=typeof t==`object`?t?.encoding:t||`utf8`,r=tn(e);return ui.call(this,r),n==`buffer`?ar.Buffer.from(r):r}function Ti(e,t){let n=tn(e);ui.call(this,n);let r=()=>Ci(n,{recursive:!0,force:!0});return{path:n,remove:r,[Symbol.dispose]:r}}function Ei(e,t,n){if(e=H(e),t=H(t),n&&n&1&&Ur(t))throw j(`EEXIST`,`copyFile`,t);Zr.call(this,t,Xr(e)),zi(this,`rename`,t.toString())}function Di(e,t,n){let r=pr(this,e),i=0;for(let e of t)i+=r.readSync(e,0,e.byteLength,n+i);return i}function Oi(e,t,n){let r=pr(this,e),i=0;for(let e of t)i+=r.writeSync(new Uint8Array(e.buffer),0,e.byteLength,n+i);return i}function ki(e,t){return e=H(e),new zr(e,this)}function Ai(e,t,n){e=H(e),t=H(t);let r=Gr.call(this,e);if(n?.errorOnExist&&Ur.call(this,t))throw j(`EEXIST`,`cp`,t);switch(r.mode&Ye){case et:if(!n?.recursive)throw j(`EISDIR`,`cp`,e);ui.call(this,t,{recursive:!0});for(let r of di.call(this,e,{withFileTypes:!0}))n.filter&&!n.filter(U(e,r.name),U(t,r.name))||Ai.call(this,U(e,r.name),U(t,r.name),n);break;case Qe:case Ze:Ei.call(this,e,t);break;case $e:case tt:case nt:case Xe:default:throw j(`ENOSYS`,`cp`,e)}n?.preserveTimestamps&&yi.call(this,t,r.atime,r.mtime)}function ji(e,t){e=H(e);let{fs:n}=Y(e,this);return Er(n,t?.bigint)}function Mi(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($t),l=[];function u(e){let t=di(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=>hn(e,t)))continue;let a=t.replace(/^\/+/g,``);Wr(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 Ni=class extends u.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}},Pi=class extends Ni{options;realpath;constructor(e,t,n){let r=Ie(e);super(r,t),this.options=n,this.realpath=U(r.root,t),Li(this.realpath,this)}close(){super.emit(`close`),Ri(this.realpath,this)}[Symbol.dispose](){this.close()}},Fi=class extends Ni{options;intervalId;previous;constructor(e,t,n){super(e,t),this.options=n,this.start()}onInterval(){try{let e=Wr(this.path);bn(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=Wr(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()}};const Ii=new Map;function Li(e,t){let n=H(e);Ii.has(n)||Ii.set(n,new Set),Ii.get(n).add(t)}function Ri(e,t){let n=H(e);Ii.has(n)&&(Ii.get(n).delete(t),Ii.get(n).size===0&&Ii.delete(n))}function zi(e,t,n){let r=Ie(e);r&&(n=U(r.root??`/`,n)),n=H(n);for(let e=n;e!=`/`;e=W(e)){let r=Ii.get(e);if(r)for(let i of r)i.emit(`change`,t,un.call(i._context,e,n)||dn(n))}}async function Bi(e,t,n,r){if(t=sn.call(e,t),n){let n=Y(t,e,r),i=await n.fs.stat(n.path).catch(()=>void 0);return{...n,fullPath:t,stats:i}}try{let i=Y(t,e),a=await i.fs.stat(i.path);return jn(a)?await Bi(e,sn.call(e,W(t),await Hi.call(e,t)),n,r):{...i,fullPath:t,stats:a}}catch{}let{base:i,dir:a}=mn(t),o=a==`/`?`/`:(await Bi(e,a,!1,r)).fullPath,s=U(o,i),c=Y(s,e),l=await c.fs.stat(c.path).catch(e=>{if(e.code!=`ENOENT`)throw k(Object.assign(e,{syscall:`stat`,path:s,...r}))});return l?jn(l)?await Bi(e,sn.call(e,o,await Hi.call(e,s)),!1,r):{...c,fullPath:s,stats:l}:{...c,fullPath:t}}async function Vi(e,t,n){t=H(t);let r=Xt(n.mode,420),i=gr(n.flag),a={syscall:`open`,path:t},{fs:o,path:s,stats:c}=await Bi(e,t,n.preserveSymlinks,a);if(!c){if(!(i&64))throw j(`ENOENT`,a);let c=await o.stat(W(s));if(J&&!q(e,c,2))throw j(`EACCES`,`open`,W(t));if(!An(c))throw j(`ENOTDIR`,`open`,W(t));if(!n.allowDirectory&&r&16384)throw j(`EISDIR`,`open`,t);let{euid:l,egid:u}=Ie(e).credentials,d=await o.createFile(s,{mode:r,uid:c.mode&2048?c.uid:l,gid:c.mode&1024?c.gid:u});return new dr(e,t,o,s,i,d)}if(J&&!q(e,c,vr(i)))throw j(`EACCES`,a);if(i&128)throw j(`EEXIST`,a);let l=new dr(e,t,o,s,i,c);if(!n.allowDirectory&&r&16384)throw j(`EISDIR`,`open`,t);return i&512&&await l.truncate(0),l}async function Hi(e){e=H(e);let t={syscall:`readlink`,path:e},{fs:n,stats:r,path:i}=await Bi(this,e,!0,t);if(!r)throw j(`ENOENT`,t);if(J&&!q(this,r,4))throw j(`EACCES`,t);if(!jn(r))throw j(`EINVAL`,t);let a=r.size,o=new Uint8Array(a);return await n.read(i,o,0,a),ee(o)}async function Ui(e,t={}){e=H(e);let{euid:n,egid:r}=Ie(this).credentials,{mode:i=511,recursive:a}=t,{fs:o,path:s}=Y(e,this,{syscall:`mkdir`}),c=async(e,t,a)=>{if(J&&!q(this,a,2))throw j(`EACCES`,`mkdir`,e);let s=await o.mkdir(t,{mode:i,uid:a.mode&2048?a.uid:n,gid:a.mode&1024?a.gid:r});return zi(this,`rename`,e),s};if(!a){await c(e,s,await o.stat(W(s)));return}let l=[],u=e;for(let e=s;!await o.exists(e);e=W(e),u=W(u))l.unshift([u,e]);if(!l.length)return;let d=[await o.stat(W(l[0][1]))];for(let[e,[t,n]]of l.entries())d.push(await c(t,n,d[e]));return l[0][0]}async function Wi(e,t={}){e=H(e);let n={syscall:`readdir`,path:e},{fs:r,path:i,stats:a}=await Bi(this,e,!1,n);if(!a)throw j(`ENOENT`,n);if(J&&!q(this,a,4))throw j(`EACCES`,n);if(!An(a))throw j(`ENOTDIR`,n);let o=await r.readdir(i),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 ur;if(a.ino=n.ino,a.type=cr(n.mode),a.path=e,a.name=dn(e),s.push(a),!t.recursive||!An(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 Gi(e,t){e=H(e),t=H(t);let n={syscall:`rename`,path:e,dest:t},r=await Bi(this,e,!0,n),i=Y(t,this,n);if(r.fs.uuid!==i.fs.uuid)throw j(`EXDEV`,n);if(i.path.startsWith(r.path+`/`))throw j(`EBUSY`,n);if(!r.stats)throw j(`ENOENT`,n);let a=r.fs,o=await a.stat(W(r.path)),s=await a.stat(W(i.path)),c=await a.stat(i.path).catch(e=>{if(e.code==`ENOENT`)return null;throw e});if(J&&(!q(this,o,4)||!q(this,s,2)))throw j(`EACCES`,n);if(c&&!An(r.stats)&&An(c))throw j(`EISDIR`,n);if(c&&An(r.stats)&&!An(c))throw j(`ENOTDIR`,n);await r.fs.rename(r.path,i.path),zi(this,`rename`,e),zi(this,`change`,t)}async function Ki(e,t){e=H(e),t=H(t);let n={syscall:`link`,path:t,dest:e},{fs:r,path:i}=Y(e,this,n),a=Y(t,this,n);if(r.uuid!=a.fs.uuid)throw j(`EXDEV`,n);let o=await r.stat(i);if(J){if(!q(this,o,4))throw j(`EACCES`,n);let e=await r.stat(W(i));if(!q(this,e,4))throw j(`EACCES`,n);let t=await r.stat(W(a.path));if(!q(this,t,2))throw j(`EACCES`,n)}return await r.link(i,a.path)}async function qi(e,t){e=H.call(this,e);let n={syscall:t?`lstat`:`stat`,path:e},r;if(!t)r=(await Bi(this,e,!1,n)).stats;else{let{base:t,dir:i}=mn(e),{fs:a,path:o}=await Bi(this,i,!1,n);r=await a.stat(t?U(o,t):o).catch(N(n))}if(!r)throw j(`ENOENT`,n);if(J&&!q(this,r,4))throw j(`EACCES`,n);return r}var Ji=class extends u.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{o as e,r as t,t as n}from"./chunk-CMxvf4Kt.js";import{d as r,f as i}from"./kernel-worker-B2ABxAEr.js";function a(e,t){if(e.byteLength>=t)return e;if(ArrayBuffer.isView(e)){let n=a(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 o=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(o.prototype,e,{value:()=>{throw ReferenceError(`Do not use DataView methods on a BufferView.`)},writable:!1,enumerable:!1,configurable:!1});var s=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],r=this.regions[t+1];if(r.offset-(n.offset+n.data.byteLength)>e){t++;continue}n.ranges.push(...r.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=a(n.data,r.offset+r.data.byteLength),n.data.set(r.data,r.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,r=this.regionAt(t);if(r)return r.data=a(r.data,n),r.data.set(e,t),r.ranges.push({start:t,end:n}),r.ranges.sort((e,t)=>e.start-t.start),this.collect(),this;let i={data:e,offset:t,ranges:[{start:t,end:n}]},o=this.regions.findIndex(e=>e.offset>t);return o==-1?this.regions.push(i):this.regions.splice(o,0,i),this.collect(),this}};const c=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;c[e]=t}function l(e){let t=4294967295;for(let n=0;n<e.length;n++)t=t>>>8^c[(t^e[n])&255];return(t^4294967295)>>>0}var u=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),d=class extends u.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 f(e,t){let n=Object.entries(e);return Object.fromEntries(n.filter(([e,n])=>t(e,n)))}function p(e,...t){let n={};for(let r of t.flat())n[r]=e[r];return n}function m(e,...t){return f(e,e=>!t.flat().includes(e))}function h(e){try{return JSON.parse(e),!0}catch{return!1}}function g(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 _(e,t){return Object.fromEntries(Object.entries(e).map(([e,n])=>[e,typeof n==`function`?n.bind(t):n]))}function v(e=Error()){let t=setTimeout(()=>{throw e},5e3);return()=>clearTimeout(t)}function y(e){throw e&&typeof e==`object`&&g(e).includes(`Error`)&&Error?.captureStackTrace(e,y),e}const b=Intl.NumberFormat(`en`,{notation:`compact`});b.format.bind(b);function x(e=0,t=1){return Math.round(Math.random()*(t-e)+e)}function S(e){return e.at(0).toUpperCase()+e.slice(1)}const C=new TextEncoder;function w(e){return C.encode(e)}const T=new TextDecoder;function ee(e){if(!e)return``;if(e.buffer instanceof ArrayBuffer&&!e.buffer.resizable)return T.decode(e);let t=new Uint8Array(e.byteLength);return t.set(e),T.decode(t)}function te(e){let t=new Uint8Array(e.length);for(let n=0;n<e.length;n++)t[n]=e.charCodeAt(n);return t}function ne(e){let t=``;for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return t}function E(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||={});const re={[O.EPERM]:`Operation not permitted`,[O.ENOENT]:`No such file or directory`,[O.ESRCH]:`No such process`,[O.EINTR]:`Interrupted system call`,[O.EIO]:`Input/output 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]:`Out of memory`,[O.EACCES]:`Permission denied`,[O.EFAULT]:`Bad address`,[O.ENOTBLK]:`Block device required`,[O.EBUSY]:`Resource busy or locked`,[O.EEXIST]:`File exists`,[O.EXDEV]:`Invalid cross-device link`,[O.ENODEV]:`No such device`,[O.ENOTDIR]:`File is not a directory`,[O.EISDIR]:`File is a directory`,[O.EINVAL]:`Invalid argument`,[O.ENFILE]:`Too many open files in system`,[O.EMFILE]:`Too many open files`,[O.ETXTBSY]:`Text file busy`,[O.EFBIG]:`File is too big`,[O.ENOSPC]:`No space left on disk`,[O.ESPIPE]:`Illegal seek`,[O.EROFS]:`Cannot modify a read-only file system`,[O.EMLINK]:`Too many links`,[O.EPIPE]:`Broken pipe`,[O.EDOM]:`Numerical argument out of domain`,[O.ERANGE]:`Numerical result out of range`,[O.EDEADLK]:`Resource deadlock would occur`,[O.ENAMETOOLONG]:`File name too long`,[O.ENOLCK]:`No locks available`,[O.ENOSYS]:`Function not implemented`,[O.ENOTEMPTY]:`Directory is not empty`,[O.ELOOP]:`Too many levels of symbolic links`,[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]:`Invalid or incomplete multibyte or wide character`,[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 is not supported`,[O.EPFNOSUPPORT]:`Protocol family not supported`,[O.EAFNOSUPPORT]:`Address family not supported by protocol`,[O.EADDRINUSE]:`Address already in use`,[O.EADDRNOTAVAIL]:`Cannot assign requested address`,[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]:`Transport endpoint is already connected`,[O.ENOTCONN]:`Transport endpoint 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]:`No route to host`,[O.EALREADY]:`Operation 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}: ${re[e.errno]}, ${e.syscall}`;return e.path&&(t+=` '${e.path}'`),e.dest&&(t+=` -> '${e.dest}'`),e.message&&!e.message.startsWith(re[e.errno])&&(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,m(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??re[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:()=>ce,configure:()=>Ee,crit:()=>le,debug:()=>fe,deprecated:()=>pe,emerg:()=>se,entries:()=>ae,err:()=>R,fancy:()=>ve,format:()=>be,info:()=>de,isEnabled:()=>Te,levelOf:()=>I,levels:()=>ie,log:()=>L,notice:()=>ue,warn:()=>z}),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||={});const ie=[`emergency`,`alert`,`critical`,`error`,`warning`,`notice`,`info`,`debug`];function I(e){return ie.indexOf(e)}const ae=new d;function L(e,t){if(!Te)return;let n={level:e,message:t,timestamp:new Date,elapsedMs:performance.now()};ae.add(n),Se(n)}function oe(e){return function(t){return L(e,t.toString()),t}}const se=oe(F.EMERG),ce=oe(F.ALERT),le=oe(F.CRIT),R=oe(F.ERR),z=oe(F.WARN),ue=oe(F.NOTICE),de=oe(F.INFO),fe=oe(F.DEBUG);function pe(e){L(F.WARN,e+` is deprecated and should not be used.`)}function me(e,t){return`\x1b[${t}m${e}\x1b[0m`}function he(e){return`[`+(e.elapsedMs/1e3).toFixed(3).padStart(10)+`] `}const ge={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;`}},_e={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 ve({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`?[me(he(n),`2;37`)]:[`opacity: 0.8; color: white;`,he(n)];let r=e==`ansi`?[me(ie[n.level].toUpperCase(),ge.ansi[n.level])]:[ge.css[n.level],ie[n.level].toUpperCase()];if(t==`level`){yield*r,yield n.message;return}n.level<F.CRIT&&(yield*r),e==`ansi`?yield me(n.message,_e.ansi[n.level]):yield*[_e.css[n.level],n.message]}}let ye=e=>[he(e),e.message];function be(e){let t=ye(e);return typeof t==`string`?[t]:Array.from(t)}let xe=console.error;function Se(e){e.level>Ce||xe(...be(e))}let Ce=F.ALERT,we=!1,Te=!0;function Ee(e){if(ye=e.format??ye,xe=e.output??xe,Ce=typeof e.level==`string`?I(e.level):e.level??Ce,Te=e.enabled??Te,we=e.stack??we,e.dumpBacklog)for(let e of ae)Se(e)}function De(e){return typeof e==`object`&&!!e&&`create`in e&&typeof e.create==`function`}function Oe(e,t){return Object.defineProperty(t,"prototype",{value:void 0}),e&&Object.defineProperty(t,"name",{value:e}),t}function ke(e){return!(e&&e.constructor===Function)||e.prototype===void 0?!1:Function.prototype===Object.getPrototypeOf(e)?Object.getOwnPropertyNames(e.prototype).length>1:!0}function Ae(e,t){if(typeof t!=`object`||!t)throw R(M(`EINVAL`,`Invalid options`));for(let[n,r]of Object.entries(e.options)){let e=t?.[n];if(e==null){if(!r.required){fe(`Using default for option: `+n);continue}throw R(M(`EINVAL`,`Missing required option: `+n))}let i=(t,n=e)=>typeof t==`function`?ke(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 R(M(`EINVAL`,`Incorrect type for "${n}": ${a} (expected ${Array.isArray(r.type)?`one of ${r.type.map(o).join(`, `)}`:o(r.type)})`))}}function je(e){return typeof e==`object`&&!!e&&`backend`in e&&De(e.backend)}function Me(e){return{suid:e.uid,sgid:e.gid,euid:e.uid,egid:e.gid,groups:[],...e}}function Ne(e){return e?!e.uid||!e.gid||!e.euid||!e.egid||e.groups.some(e=>!e):!1}const Pe=Symbol(`ZenFSContext`),Fe={[Pe]:!0,id:0,root:`/`,pwd:`/`,credentials:Me({uid:0,gid:0}),descriptors:new Map,parent:null,children:[]};function Ie(e){return typeof e==`object`&&e&&Pe in e?e:Fe}let Le=1;function Re(e,t={}){let{root:n=e.root,pwd:r=e.pwd,credentials:i=structuredClone(e.credentials)}=t,a={[Pe]:!0,id:Le++,root:n,pwd:r,credentials:Me(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 ze=t({COPYFILE_EXCL:()=>1,COPYFILE_FICLONE:()=>2,COPYFILE_FICLONE_FORCE:()=>4,F_OK:()=>0,O_APPEND:()=>Be,O_CREAT:()=>64,O_DIRECT:()=>qe,O_DIRECTORY:()=>Ve,O_DSYNC:()=>Ge,O_EXCL:()=>128,O_NOATIME:()=>He,O_NOCTTY:()=>256,O_NOFOLLOW:()=>Ue,O_NONBLOCK:()=>Je,O_RDONLY:()=>0,O_RDWR:()=>2,O_SYMLINK:()=>Ke,O_SYNC:()=>We,O_TRUNC:()=>512,O_WRONLY:()=>1,R_OK:()=>4,S_IFBLK:()=>$e,S_IFCHR:()=>tt,S_IFDIR:()=>et,S_IFIFO:()=>nt,S_IFLNK:()=>Ze,S_IFMT:()=>Ye,S_IFREG:()=>Qe,S_IFSOCK:()=>Xe,S_IRGRP:()=>32,S_IROTH:()=>4,S_IRUSR:()=>256,S_IRWXG:()=>56,S_IRWXO:()=>7,S_IRWXU:()=>448,S_ISGID:()=>it,S_ISUID:()=>rt,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:()=>at});const Be=1024,Ve=65536,He=262144,Ue=131072,We=1052672,Ge=4096,Ke=32768,qe=16384,Je=2048,Ye=61440,Xe=49152,Ze=40960,Qe=32768,$e=24576,et=16384,tt=8192,nt=4096,rt=2048,it=1024,at=4294967295;function ot(e){return`__isArrayType`in e&&e.__isArrayType===!0}function st(e){return typeof e!=`object`&&typeof e!=`function`||e==null?!1:ot(e)?st(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`&&ct.has(e.name)&&ct.get(e.name)?.name===e.name}const ct=new Map;function lt(e){if(ct.has(e.name))throw ReferenceError(`Type is already registered: ${e.name}`);ct.set(e.name,e)}const ut=Symbol(`DataView`);function dt(e){return e[ut]??=new DataView(e),e[ut]}const ft={name:`int8`,size:1,array:Int8Array,get:(e,t)=>dt(e).getInt8(t),set:(e,t,n)=>dt(e).setInt8(t,n)},pt={name:`uint8`,size:1,array:Uint8Array,get:(e,t)=>dt(e).getUint8(t),set:(e,t,n)=>dt(e).setUint8(t,n)},mt={int8:ft,uint8:pt,int16:{name:`int16`,size:2,array:Int16Array,get:(e,t)=>dt(e).getInt16(t,!0),set:(e,t,n)=>dt(e).setInt16(t,n,!0)},uint16:{name:`uint16`,size:2,array:Uint16Array,get:(e,t)=>dt(e).getUint16(t,!0),set:(e,t,n)=>dt(e).setUint16(t,n,!0)},int32:{name:`int32`,size:4,array:Int32Array,get:(e,t)=>dt(e).getInt32(t,!0),set:(e,t,n)=>dt(e).setInt32(t,n,!0)},uint32:{name:`uint32`,size:4,array:Uint32Array,get:(e,t)=>dt(e).getUint32(t,!0),set:(e,t,n)=>dt(e).setUint32(t,n,!0)},int64:{name:`int64`,size:8,array:BigInt64Array,get:(e,t)=>dt(e).getBigInt64(t,!0),set:(e,t,n)=>dt(e).setBigInt64(t,n,!0)},uint64:{name:`uint64`,size:8,array:BigUint64Array,get:(e,t)=>dt(e).getBigUint64(t,!0),set:(e,t,n)=>dt(e).setBigUint64(t,n,!0)},float32:{name:`float32`,size:4,array:Float32Array,get:(e,t)=>dt(e).getFloat32(t,!0),set:(e,t,n)=>dt(e).setFloat32(t,n,!0)},float64:{name:`float64`,size:8,array:Float64Array,get:(e,t)=>dt(e).getFloat64(t,!0),set:(e,t,n)=>dt(e).setFloat64(t,n,!0)}},ht=Object.keys(mt);for(let e of Object.values(mt))lt(e);const gt={...mt,...Object.fromEntries(ht.map(e=>[S(e),mt[e]])),char:pt},_t=Object.keys(gt);function vt(e){return _t.includes(e.toString())}function yt(e){if(!vt(e))throw M(`EINVAL`,`Not a valid primitive type: `+e)}function bt(e){return e==`char`?`uint8`:e.toLowerCase()}function xt(e){return(typeof e==`object`||typeof e==`function`)&&e!==null&&`toInit`in e&&typeof e.toInit==`function`}function St(e){return xt(e)?e.toInit():st(e)?{type:e}:e}function Ct(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(St(t),n);if(!st(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 zt?`${i.typeName??i.type.type.name} ${r}[${i.type.length}]${a}`:`${i.typeName??i.type.name} ${r}`,littleEndian:!i.bigEndian}}function wt(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,wt),n}function Tt(e,t){return t.type instanceof zt&&t.type.length==0&&!!t.countedBy?.length&&!!e.constructor.isDynamic}function Et(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 Dt(e,t){let n=t.type.type.size*Et(e,t);if(Nt(t.type.type)&&t.type.type.isDynamic)for(let r of e[t.name])n+=Pt(r);return n}const Ot=Symbol(`kOffsets`);function kt(e,t,n){let{offset:r,name:i}=t;e[Ot]||=Object.create(null);let a=e[Ot];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)){Tt(e,t)&&(r+=Dt(e,t));let n=e[t.name];Mt(n)&&n.constructor.isDynamic&&(r+=Pt(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 At(e,t,n,r){typeof n==`string`&&(n=n.charCodeAt(0));let i=e.byteOffset+kt(e,t,!1)+(r??0)*t.type.size;try{t.type.set(e.buffer,i,n);return}catch(e){wt(e,i)}}function jt(e,t){let n=t.type;if(Tt(e,t)){let r=t.type.type;n=new zt(r,Et(e,t))}let r=e.byteOffset+kt(e,t,!0);try{return n.get(e.buffer,r)}catch(e){wt(e,r)}}function Mt(e){return typeof e==`object`&&!!e&&`constructor`in e&&Nt(e.constructor)}function Nt(e){return typeof e==`function`&&`prototype`in e&&`fields`in e&&typeof e.fields==`object`&&st(e)}function Pt(e){let t=0;for(let n of e.constructor.fields){let r=e[n.name];Tt(e,n)&&(t+=Dt(e,n)),Mt(r)&&r.constructor.isDynamic&&(t+=Pt(r))}return t}function Ft(e){if(st(e))return e.size;if(e==null)return 0;if(typeof e==`object`&&st(e.constructor))return e.constructor.size;if(Array.isArray(e)){let t=0;for(let n=0;n<e.length;n++)t+=Ft(e[n]);return t}if(typeof e==`string`)return yt(e),mt[bt(e)].size;throw TypeError(`Unable to resolve size of \`${e.toString()}\``)}function B(e){let t=Ft(e);return Mt(e)&&e.constructor.isDynamic?t+Pt(e):t}function It(e,t){let n;if(Nt(e)){if(e.isDynamic)throw M(`EINVAL`,`Cannot get offset of field in dynamic struct from the constructor`);n=e}else if(Mt(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 Nt(e)?i.offset:kt(e,i,!0)}function Lt(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??y(`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 Rt(e){return typeof e==`function`&&`prototype`in e&&`fields`in e&&typeof e.fields==`object`&&st(e)}var zt=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=Lt(this),this.__structArray=Lt(e,t),this.__arrayType=e.array?e.array:this.__structArray}get=(e,t)=>vt(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+=Rt(this.type)&&this.type.isDynamic?B(n[t]):this.type.size}};array};Symbol.metadata??=Symbol.for(`Symbol.metadata`);function Bt(e){e.metadata??={};let t=e.metadata.structInit??{};return e.metadata.structInit={fields:[...t.fields??[]]},e.metadata.structInit}function Vt(...e){let t=e.reduce((e,t)=>({...e,...t}),{});return typeof this==`object`&&Object.assign(t,this),function(e,n){let r=Bt(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 jt(this,e)},set(t){At(this,e,t)}})}}return n.addInitializer(function(){Object.defineProperty(c,"name",{value:e.name}),lt(c)}),c}}Vt.packed=Vt.bind({isPacked:!0}),Vt.align=function(e){return Vt.bind({alignment:e})};function Ht(e,t={}){return function(n,r){if(r.kind!=`accessor`)throw M(`EINVAL`,`Field must be an accessor`);let i=Bt(r),a=Ct(r.name,e,t);return i.fields.push(a),{get(){return jt(this,a)},set(e){At(this,a,e)}}}}function Ut(e){let t=mt[bt(e)];function n(n,r){return typeof n==`number`?Ht(new zt(t,n),{typeName:e,...r}):Ht(t,{typeName:e})(n,r&&`name`in r?r:y(M(`EINVAL`,`Invalid decorator context object`)))}return n}const V=Object.fromEntries(_t.map(e=>[e,Ut(e)]));function Wt(e){return e}Wt.typed=function(e){return e};var Gt=class e{type;init;constructor(t,n){this.type=t,this.init=n;let r=(r=>new e(new zt(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 Kt(e,t=0){return new Gt(new zt(e,t),{})}function qt(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=Ct(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 jt(this,e)},set(t){At(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 lt(c),c}qt.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=Ct(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 lt(l),l},qt.packed=qt.bind({isPacked:!0}),qt.align=function(e){return qt.bind({alignment:e})},qt.dynamic=qt.bind({isDynamic:!0}),Object.fromEntries(Object.entries(gt).map(([e,t])=>[e,new Gt(t,{typeName:e})]));function Jt(e){return JSON.parse(ee(e),(e,t)=>e==``?t:typeof t==`string`?BigInt(t).toString(16).slice(0,Math.min(t.length,8)):t)}function Yt(e){return w(JSON.stringify(e))}function Xt(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())}function Zt(e){if(e instanceof Date)return e.getTime();try{return Number(e)}catch{throw M(`EINVAL`,`Invalid time.`)}}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:sn.call(this,e)}function Qt(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:Xt(`mode`in e?e?.mode:null,r)}}function $t(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 en(e){let t=Promise.withResolvers();setTimeout(()=>t.reject(M(`ETIMEDOUT`)),500),e.on(`online`,t.resolve),await t.promise}function tn(e){return`/tmp/${H(e,!0)}${Date.now()}-${Math.random().toString(36).slice(2)}`}var nn=t({basename:()=>dn,dirname:()=>W,extname:()=>fn,format:()=>pn,formatExt:()=>on,isAbsolute:()=>ln,join:()=>U,matchesGlob:()=>hn,normalize:()=>cn,normalizeString:()=>an,parse:()=>mn,relative:()=>un,resolve:()=>sn,sep:()=>`/`});function rn(e,t){if(typeof e!=`object`)throw TypeError(`"${t}" is not an object`)}function an(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}else 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 on(e){return e?`${e[0]===`.`?``:`.`}${e}`:``}function sn(...e){let t=``;for(let n of[...e.reverse(),Ie(this).pwd])if(n?.length&&(t=`${n}/${t}`,n.startsWith(`/`)))break;let n=t.startsWith(`/`);return t=an(t,!n),n?`/${t}`:t.length?t:`/`}function cn(e){if(!e.length)return`.`;let t=e[0]===`/`,n=e.at(-1)===`/`;return e=an(e,!t),e.length?(n&&(e+=`/`),t?`/${e}`:e):t?`/`:n?`./`:`.`}function ln(e){return e.startsWith(`/`)}function U(...e){if(!e.length)return`.`;let t=e.filter(e=>e).join(`/`);return t?.length?cn(t):`.`}function un(e,t){if(e===t||(e=sn.call(this,e),t=sn.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 dn(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 fn(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 pn(e){rn(e,`pathObject`);let t=e.dir||e.root,n=e.base||`${e.name||``}${on(e.ext)}`;return t?t===e.root?`${t}${n}`:`${t}/${n}`:n}function mn(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 hn(e,t){return $t(e).test(t)}const gn=BigInt(1e3);var _n=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(Qe)),Object.assign(this,l)}isFile(){return(this.mode&Ye)==Qe}isDirectory(){return(this.mode&Ye)==et}isSymbolicLink(){return(this.mode&Ye)==Ze}isSocket(){return(this.mode&Ye)==Xe}isBlockDevice(){return(this.mode&Ye)==$e}isCharacterDevice(){return(this.mode&Ye)==tt}isFIFO(){return(this.mode&Ye)==nt}toJSON(){return p(this,Dn)}hasAccess(e,t){return q(t,this._isBigint?new vn(this):this,e)}get atimeNs(){return BigInt(this.atimeMs)*gn}get mtimeNs(){return BigInt(this.mtimeMs)*gn}get ctimeNs(){return BigInt(this.ctimeMs)*gn}get birthtimeNs(){return BigInt(this.birthtimeMs)*gn}},vn=class extends _n{_isBigint=!1},yn=class extends _n{_isBigint=!0};function bn(e,t){return e.size==t.size&&+e.atime==+t.atime&&+e.mtime==+t.mtime&&+e.ctime==+t.ctime&&e.mode==t.mode}var xn=class{type=525687744115;bsize=4096;blocks=0;bfree=0;bavail=0;files=at;ffree=at},Sn=class{type=BigInt(`0x7a656e6673`);bsize=BigInt(4096);blocks=BigInt(0);bfree=BigInt(0);bavail=BigInt(0);files=BigInt(at);ffree=BigInt(at)},Cn=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};const wn=3968;let Tn=(()=>{var e,t;let n=[Vt.packed()],r,i=[],a,o=Wt.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)],Cn(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),Cn(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),Cn(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 ee(this.subarray(8,8+this.keySize))}set name(e){let t=w(e);if(8+t.length+this.valueSize>wn)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>wn)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})(),En=(()=>{var e;let t=[Vt.packed()],n,r=[],i,a=Wt(o),s,c=[],l=[];var u=class extends a{static{i=this}static{let o=typeof Symbol==`function`&&Symbol.metadata?Object.create(a[Symbol.metadata]??null):void 0;s=[(e=V).uint32.bind(e)],Cn(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:o},c,l),Cn(null,n={value:i},t,{kind:`class`,name:i.name,metadata:o},null,r),u=i=n.value,o&&Object.defineProperty(i,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:o})}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 Tn(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 Tn(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 Tn(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 Tn(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 Tn(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 Tn(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 Tn(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 Tn(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 Tn(this.buffer,e);yield[t.name,t.value],e+=t.size}}constructor(){super(...arguments),G(this,l)}static{G(i,r)}};return i})();const Dn=[`ino`,`data`,`size`,`mode`,`flags`,`nlink`,`uid`,`gid`,`atimeMs`,`birthtimeMs`,`mtimeMs`,`ctimeMs`,`version`];var On;(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`})(On||={});let K=(()=>{var e,t,n,r,i,a,s,c,l,u,d,f,m,h,g,_;let v=[Vt.packed()],y,b=[],x,S=Wt(o),C,w=[],T=[],ee,te=[],ne=[],E,D=[],O=[],re,k=[],A=[],j,N=[],P=[],F,ie=[],I=[],ae,L=[],oe=[],se,ce=[],R=[],ue,de=[],fe=[],pe,me=[],he=[],ge,_e=[],ve=[],ye,be=[],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 o=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)],E=[(n=V).uint32.bind(n)],re=[(r=V).uint16.bind(r)],j=[(i=V).uint32.bind(i)],F=[(a=V).uint32.bind(a)],ae=[(s=V).uint32.bind(s)],se=[(c=V).float64.bind(c)],ue=[(l=V).float64.bind(l)],pe=[(u=V).float64.bind(u)],ge=[(d=V).float64.bind(d)],ye=[(f=V).uint32.bind(f)],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=[Ht(En)],Be=[V.uint8(wn)],Cn(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:o},w,T),Cn(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:o},te,ne),Cn(this,null,E,{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:o},D,O),Cn(this,null,re,{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:o},k,A),Cn(this,null,j,{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:o},N,P),Cn(this,null,F,{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:o},ie,I),Cn(this,null,ae,{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:o},L,oe),Cn(this,null,se,{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:o},ce,R),Cn(this,null,ue,{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:o},de,fe),Cn(this,null,pe,{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:o},me,he),Cn(this,null,ge,{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:o},_e,ve),Cn(this,null,ye,{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:o},be,xe),Cn(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:o},Ce,we),Cn(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:o},Ee,De),Cn(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:o},ke,Ae),Cn(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:o},Me,Ne),Cn(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:o},Fe,Ie),Cn(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:o},Re,ze),Cn(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:o},Ve,He),Cn(null,y={value:x},v,{kind:`class`,name:x.name,metadata:o},null,b),Ue=x=y.value,o&&Object.defineProperty(x,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:o})}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)]),super(...e),G(this,He),this.byteLength<B(Ue))throw le(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&&z(`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,te,void 0));get __data_old(){return this.#t}set __data_old(e){this.#t=e}#n=(G(this,ne),G(this,D,void 0));get size(){return this.#n}set size(e){this.#n=e}#r=(G(this,O),G(this,k,void 0));get mode(){return this.#r}set mode(e){this.#r=e}#i=(G(this,A),G(this,N,void 0));get nlink(){return this.#i}set nlink(e){this.#i=e}#a=(G(this,P),G(this,ie,void 0));get uid(){return this.#a}set uid(e){this.#a=e}#o=(G(this,I),G(this,L,void 0));get gid(){return this.#o}set gid(e){this.#o=e}#s=(G(this,oe),G(this,ce,void 0));get atimeMs(){return this.#s}set atimeMs(e){this.#s=e}#c=(G(this,R),G(this,de,void 0));get birthtimeMs(){return this.#c}set birthtimeMs(e){this.#c=e}#l=(G(this,fe),G(this,me,void 0));get mtimeMs(){return this.#l}set mtimeMs(e){this.#l=e}#u=(G(this,he),G(this,_e,void 0));get ctimeMs(){return this.#u}set ctimeMs(e){this.#u=e}#d=(G(this,ve),G(this,be,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{...p(this,Dn),attributes:this.attributes}}toStats(){return new vn(this)}update(e){if(!e)return!1;let t=!1;for(let n of Dn)e[n]!==void 0&&(n==`ino`||n==`data`||this[n]!==e[n]&&(n==`atimeMs`&&this.flags&On.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 kn(e){return(e.mode&Ye)==Qe}function An(e){return(e.mode&Ye)==et}function jn(e){return(e.mode&Ye)==Ze}function Mn(e){return(e.mode&Ye)==Xe}function Nn(e){return(e.mode&Ye)==$e}function Pn(e){return(e.mode&Ye)==tt}function Fn(e){return(e.mode&Ye)==nt}function q(e,t,n){let{credentials:r}=Ie(e);if(jn(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 In(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 Ln=class e extends Map{maxSize=at;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[dn(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[dn(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??=x(1,at),t==`/`&&(n.ino=0),this.set(t,new K(n));return this}static parse(t){if(!h(t))throw M(`EINVAL`,`Invalid JSON`);let n=JSON.parse(t),r=new e;return r.fromJSON(n),r}};const Rn=4096;var zn=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+=Rn){let r=t+Rn>a?a-t:Rn,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??=(z(`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??=(z(`Using a polyfill of Symbol.dispose`),Symbol(`Symbol.dispose`)),Symbol.asyncDispose??=(z(`Using a polyfill of Symbol.asyncDispose`),Symbol(`Symbol.asyncDispose`)),globalThis.crypto.randomUUID??=(z(`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??=(z(`Using a polyfill of Uint8Array.prototype.toBase64`),function(){return btoa(String.fromCharCode(...this))}),Uint8Array.fromBase64??=(z(`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??=(z(`Using a polyfill of Uint8Array.prototype.toHex`),function(){return[...this].map(e=>e.toString(16).padStart(2,`0`)).join(``)}),Uint8Array.fromHex??=(z(`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 Bn=class{store;constructor(e){this.store=e}},Vn=class extends Bn{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)}},Hn=class extends Bn{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 s(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){z(`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)}},Un=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 Hn))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 Hn))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)}}},Wn=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},Gn=(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}),Kn=class extends zn{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=un(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){z(`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,fe(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=Wn(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,Yt(r.get(t)));await n.commit()}catch(e){t.error=e,t.hasError=!0}finally{let e=Gn(t);e&&await e}}loadIndexSync(e){let t={stack:[],error:void 0,hasError:!1};try{let n=Wn(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,Yt(r.get(t)));n.commitSync()}catch(e){t.error=e,t.hasError=!0}finally{Gn(t)}}async createIndex(){let e={stack:[],error:void 0,hasError:!1};try{let t=new Ln,n=Wn(e,this.transaction(),!0),r=[[`/`,0]],i=v(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=Jt(await n.get(a.data)??y(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=Gn(e);t&&await t}}createIndexSync(){let e={stack:[],error:void 0,hasError:!1};try{let t=new Ln,n=Wn(e,this.transaction(),!1),r=[[`/`,0]],i=v(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=Jt(n.getSync(a.data)??y(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{Gn(e)}}async rename(e,t){let n={stack:[],error:void 0,hasError:!1};try{let r=Wn(n,this.transaction(),!0),i=mn(e),a=mn(t),o=await this.findInode(r,i.dir),s=Jt(await r.get(o.data)??y(M(`ENODATA`)));if(!s[i.base])throw M(`ENOENT`);let c=s[i.base];if(c!=this._ids.get(e)&&R(`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:Jt(await r.get(u.data)??y(M(`ENODATA`)));if(d[a.base]){let e=new K(await r.get(d[a.base])??y(M(`ENOENT`)));if(!kn(e))throw M(`EISDIR`);await r.remove(e.data),await r.remove(d[a.base])}d[a.base]=c,await r.set(o.data,Yt(s)),await r.set(u.data,Yt(d)),await r.commit(),this._move(e,t)}catch(e){n.error=e,n.hasError=!0}finally{let e=Gn(n);e&&await e}}renameSync(e,t){let n={stack:[],error:void 0,hasError:!1};try{let r=Wn(n,this.transaction(),!1),i=mn(e),a=mn(t),o=this.findInodeSync(r,i.dir),s=Jt(r.getSync(o.data)??y(M(`ENODATA`)));if(!s[i.base])throw M(`ENOENT`);let c=s[i.base];if(c!=this._ids.get(e)&&R(`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:Jt(r.getSync(u.data)??y(M(`ENODATA`)));if(d[a.base]){let e=new K(r.getSync(d[a.base])??y(M(`ENOENT`)));if(!kn(e))throw M(`EISDIR`);r.removeSync(e.data),r.removeSync(d[a.base])}d[a.base]=c,r.setSync(o.data,Yt(s)),r.setSync(u.data,Yt(d)),r.commitSync(),this._move(e,t)}catch(e){n.error=e,n.hasError=!0}finally{Gn(n)}}async stat(e){let t={stack:[],error:void 0,hasError:!1};try{let n=Wn(t,this.transaction(),!0);return await this.findInode(n,e)}catch(e){t.error=e,t.hasError=!0}finally{let e=Gn(t);e&&await e}}statSync(e){let t={stack:[],error:void 0,hasError:!1};try{let n=Wn(t,this.transaction(),!1);return this.findInodeSync(n,e)}catch(e){t.error=e,t.hasError=!0}finally{Gn(t)}}async touch(e,t){let n={stack:[],error:void 0,hasError:!1};try{let r=Wn(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=Gn(n);e&&await e}}touchSync(e,t){let n={stack:[],error:void 0,hasError:!1};try{let r=Wn(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{Gn(n)}}async createFile(e,t){return t.mode|=Qe,await this.commitNew(e,t,new Uint8Array)}createFileSync(e,t){return t.mode|=Qe,this.commitNewSync(e,t,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 t.mode|=et,await this.commitNew(e,t,w(`{}`))}mkdirSync(e,t){return t.mode|=et,this.commitNewSync(e,t,w(`{}`))}async readdir(e){let t={stack:[],error:void 0,hasError:!1};try{let n=Wn(t,this.transaction(),!0),r=await this.findInode(n,e);return Object.keys(Jt(await n.get(r.data)??y(M(`ENOENT`))))}catch(e){t.error=e,t.hasError=!0}finally{let e=Gn(t);e&&await e}}readdirSync(e){let t={stack:[],error:void 0,hasError:!1};try{let n=Wn(t,this.transaction(),!1),r=this.findInodeSync(n,e);return Object.keys(Jt(n.getSync(r.data)??y(M(`ENOENT`))))}catch(e){t.error=e,t.hasError=!0}finally{Gn(t)}}async sync(){}syncSync(){}async link(e,t){let n={stack:[],error:void 0,hasError:!1};try{let r=Wn(n,this.transaction(),!0),i=W(t),a=await this.findInode(r,i),o=Jt(await r.get(a.data)??y(M(`ENOENT`))),s=await this.findInode(r,e);s.nlink++,o[dn(t)]=s.ino,this._add(s.ino,t),await r.set(s.ino,s),await r.set(a.data,Yt(o)),await r.commit()}catch(e){n.error=e,n.hasError=!0}finally{let e=Gn(n);e&&await e}}linkSync(e,t){let n={stack:[],error:void 0,hasError:!1};try{let r=Wn(n,this.transaction(),!1),i=W(t),a=this.findInodeSync(r,i),o=Jt(r.getSync(a.data)??y(M(`ENOENT`))),s=this.findInodeSync(r,e);s.nlink++,o[dn(t)]=s.ino,this._add(s.ino,t),r.setSync(s.ino,s),r.setSync(a.data,Yt(o)),r.commitSync()}catch(e){n.error=e,n.hasError=!0}finally{Gn(n)}}async read(e,t,n,r){let i={stack:[],error:void 0,hasError:!1};try{let a=Wn(i,this.transaction(),!0),o=await this.findInode(a,e);if(o.size==0)return;let s=await a.get(o.data,n,r)??y(M(`ENODATA`)),c=a.flag(`partial`)?s:s.subarray(n,r);c.byteLength>t.byteLength&&R(`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=Gn(i);e&&await e}}readSync(e,t,n,r){let i={stack:[],error:void 0,hasError:!1};try{let a=Wn(i,this.transaction(),!1),o=this.findInodeSync(a,e);if(o.size==0)return;let s=a.getSync(o.data,n,r)??y(M(`ENODATA`)),c=a.flag(`partial`)?s:s.subarray(n,r);c.byteLength>t.byteLength&&R(`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{Gn(i)}}async write(e,t,n){let r={stack:[],error:void 0,hasError:!1};try{let i=Wn(r,this.transaction(),!0),o=await this.findInode(i,e),s=t;i.flag(`partial`)||(s=a(await i.get(o.data)??new Uint8Array,n+t.byteLength),s.set(t,n),n=0),await i.set(o.data,s,n),this._add(o.ino,e),await i.commit()}catch(e){r.error=e,r.hasError=!0}finally{let e=Gn(r);e&&await e}}writeSync(e,t,n){let r={stack:[],error:void 0,hasError:!1};try{let i=Wn(r,this.transaction(),!1),o=this.findInodeSync(i,e),s=t;i.flag(`partial`)||(s=a(i.getSync(o.data)??new Uint8Array,n+t.byteLength),s.set(t,n),n=0),i.setSync(o.data,s,n),this._add(o.ino,e),i.commitSync()}catch(e){r.error=e,r.hasError=!0}finally{Gn(r)}}transaction(){return new Un(this.store.transaction(),this)}async checkRoot(){let e={stack:[],error:void 0,hasError:!1};try{let t=Wn(e,this.transaction(),!0);if(await t.get(0))return;let n=new K({ino:0,data:1,mode:16895});await t.set(n.data,w(`{}`)),this._add(0,`/`),await t.set(0,n),await t.commit()}catch(t){e.error=t,e.hasError=!0}finally{let t=Gn(e);t&&await t}}checkRootSync(){let e={stack:[],error:void 0,hasError:!1};try{let t=Wn(e,this.transaction(),!1);if(t.getSync(0))return;let n=new K({ino:0,data:1,mode:16895});t.setSync(n.data,w(`{}`)),this._add(0,`/`),t.setSync(0,n),t.commitSync()}catch(t){e.error=t,e.hasError=!0}finally{Gn(e)}}async _populate(){let e={stack:[],error:void 0,hasError:!1};try{if(this._initialized){z(`Attempted to populate tables after initialization`);return}fe(`Populating tables with existing store metadata`);let t=Wn(e,this.transaction(),!0),n=await t.get(0);if(!n){ue(`Store does not have a root inode`);let e=new K({ino:0,data:1,mode:16895});await t.set(e.data,w(`{}`)),this._add(0,`/`),await t.set(0,e),await t.commit();return}if(n.length<B(K)){le(`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){z(`Store is missing data for inode: `+n);continue}if(o.length<B(K)){z(`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){z(`Store is missing directory data: `+s.data);continue}let l=Jt(c);for(let[t,n]of Object.entries(l))a.push([U(e,t),n])}fe(`Added ${i} existing inode(s) from store`)}catch(t){e.error=t,e.hasError=!0}finally{let t=Gn(e);t&&await t}}_populateSync(){let e={stack:[],error:void 0,hasError:!1};try{if(this._initialized){z(`Attempted to populate tables after initialization`);return}fe(`Populating tables with existing store metadata`);let t=Wn(e,this.transaction(),!1),n=t.getSync(0);if(!n){ue(`Store does not have a root inode`);let e=new K({ino:0,data:1,mode:16895});t.setSync(e.data,w(`{}`)),this._add(0,`/`),t.setSync(0,e),t.commitSync();return}if(n.length<B(K)){le(`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){z(`Store is missing data for inode: `+n);continue}if(o.length<B(K)){z(`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){z(`Store is missing directory data: `+s.data);continue}let l=Jt(c);for(let[t,n]of Object.entries(l))a.push([U(e,t),n])}fe(`Added ${i} existing inode(s) from store`)}catch(t){e.error=t,e.hasError=!0}finally{Gn(e)}}async _findInode(e,t,n=new Set){if(n.has(t))throw le(M(`EIO`,`Infinite loop detected while finding inode`));if(n.add(t),t==`/`)return new K(await e.get(0)??y(M(`ENODATA`)));let{dir:r,base:i}=mn(t),a=await this._findInode(e,r,n),o=Jt(await e.get(a.data)??y(M(`ENODATA`)));if(!(i in o))throw M(`ENOENT`);return new K(await e.get(o[i])??y(M(`ENODATA`)))}_findInodeSync(e,t,n=new Set){if(n.has(t))throw le(M(`EIO`,`Infinite loop detected while finding inode`));if(n.add(t),t==`/`)return new K(e.getSync(0)??y(M(`ENOENT`)));let{dir:r,base:i}=mn(t),a=this._findInodeSync(e,r,n),o=Jt(e.getSync(a.data)??y(M(`ENODATA`)));if(!(i in o))throw M(`ENOENT`);return new K(e.getSync(o[i])??y(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)??y(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)??y(M(`ENOENT`)))}_lastID;allocNew(e){this._lastID??=Math.max(...this._paths.keys()),this._lastID+=2;let t=this._lastID;if(t>4294967295)throw R(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=Wn(r,this.transaction(),!0),{dir:a,base:o}=mn(e),s=await this.findInode(i,a),c=Jt(await i.get(s.data)??y(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,Yt(c)),await i.commit(),u}catch(e){r.error=e,r.hasError=!0}finally{let e=Gn(r);e&&await e}}commitNewSync(e,t,n){let r={stack:[],error:void 0,hasError:!1};try{if(e==`/`)throw M(`EEXIST`);let i=Wn(r,this.transaction(),!1),{dir:a,base:o}=mn(e),s=this.findInodeSync(i,a),c=Jt(i.getSync(s.data)??y(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,Yt(c)),i.commitSync(),u}catch(e){r.error=e,r.hasError=!0}finally{Gn(r)}}async remove(e,t){let n={stack:[],error:void 0,hasError:!1};try{let r=Wn(n,this.transaction(),!0),{dir:i,base:a}=mn(e),o=await this.findInode(r,i),s=Jt(await r.get(o.data)??y(M(`ENOENT`)));if(!s[a])throw M(`ENOENT`);let c=s[a],l=new K(await r.get(c)??y(M(`ENOENT`)));if(delete s[a],!t&&An(l))throw M(`EISDIR`);await r.set(o.data,Yt(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=Gn(n);e&&await e}}removeSync(e,t){let n={stack:[],error:void 0,hasError:!1};try{let r=Wn(n,this.transaction(),!1),{dir:i,base:a}=mn(e),o=this.findInodeSync(r,i),s=Jt(r.getSync(o.data)??y(M(`ENOENT`))),c=s[a];if(!c)throw M(`ENOENT`);let l=new K(r.getSync(c)??y(M(`ENOENT`)));if(delete s[a],!t&&An(l))throw M(`EISDIR`);r.setSync(o.data,Yt(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{Gn(n)}}},qn=class extends Vn{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)}},Jn=class extends Hn{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)}},Yn=class extends Map{maxSize;label;flags=[];name=`tmpfs`;constructor(e=at,t){super(),this.maxSize=e,this.label=t}async sync(){}transaction(){return new qn(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}}};const Xn={name:`InMemory`,options:{maxSize:{type:`number`,required:!1},label:{type:`string`,required:!1}},create({maxSize:e,label:t}){let n=new Kn(new Yn(e,t));return n.checkRootSync(),n}};var Zn=class extends Kn{devices=new Map;devicesWithDriver(e,t){if(t&&typeof e==`string`)throw R(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,...m(i??{},`metadata`),driver:e,inode:new K({mode:8630,...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),de(`Initialized device: `+this._mountPoint+o),a}addDefaults(){this._createDevice($n),this._createDevice(er),this._createDevice(tr),this._createDevice(nr),this._createDevice(rr),fe(`Added default devices`)}constructor(){super(new Yn(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(dn(n));return t}readdirSync(e){let t=super.readdirSync(e);for(let n of this.devices.keys())W(n)==e&&t.push(dn(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)}};const Qn=new Uint8Array,$n={name:`null`,singleton:!0,init(){return{major:1,minor:3}},read(){return Qn},write(){}},er={name:`zero`,singleton:!0,init(){return{major:1,minor:5}},read(e,t,n,r){t.fill(0,n,r)},write(){}},tr={name:`full`,singleton:!0,init(){return{major:1,minor:7}},read(e,t,n,r){t.fill(0,n,r)},write(){throw M(`ENOSPC`)}},nr={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(){}},rr={name:`console`,singleton:!0,init(e,{output:t=e=>console.log(e)}={}){return{major:5,minor:1,data:{output:t}}},read(){return Qn},write(e,t,n){let r=ee(t);e.data.output(r,n)}},ir={null:$n,zero:er,full:tr,random:nr,console:rr};var ar=i();let J=!0;function or(e){J=e}var sr;(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`})(sr||={});function cr(e){return(e&61440)>>12}function lr(e){return e<<12}var ur=class{ino;type;path;name},dr=class{context;path;fs;internalPath;flag;inode;_buffer;_position=0;get position(){return this.flag&1024?this.inode.size:this._position}set position(e){this._position=e}dirty=!1;closed=!1;get isClosed(){return this.closed}constructor(e,t,n,r,i,a){this.context=e,this.path=t,this.fs=n,this.internalPath=r,this.flag=i,this.inode=a}get _isSync(){return!!(this.flag&1052672||this.inode.flags&On.Sync||this.fs.attributes.has(`sync`))}[Symbol.dispose](){this.closeSync()}syncSync(){if(this.closed)throw j(`EBADF`,`sync`,this.path);this.dirty&&=(this.fs.attributes.has(`no_write`)||this.fs.touchSync(this.internalPath,this.inode),!1)}datasyncSync(){return this.syncSync()}closeSync(){if(this.closed)throw j(`EBADF`,`close`,this.path);this.syncSync(),this.disposeSync()}disposeSync(e){if(this.closed)throw j(`EBADF`,`close`,this.path);if(this.dirty&&!e)throw j(`EBUSY`,`close`,this.path);this.closed=!0}truncateSync(e){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&On.Immutable)throw j(`EPERM`,`truncate`,this.path);this.dirty=!0,this.inode.mtimeMs=Date.now(),this.inode.size=e,this.inode.ctimeMs=Date.now(),this._isSync&&this.syncSync()}writeSync(e,t=0,n=e.byteLength-t,r=this.position){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&On.Immutable)throw j(`EPERM`,`write`,this.path);this.dirty=!0;let i=r+n,a=e.subarray(t,t+n);return!Pn(this.inode)&&!Nn(this.inode)&&i>this.inode.size&&(this.inode.size=i),this.inode.mtimeMs=Date.now(),this.inode.ctimeMs=Date.now(),this._position=r+a.byteLength,this.fs.writeSync(this.internalPath,a,r),this._isSync&&this.syncSync(),a.byteLength}readSync(e,t=0,n=e.byteLength-t,r=this.position){if(this.closed||this.flag&1)throw j(`EBADF`,`read`,this.path);!(this.inode.flags&On.NoAtime)&&!this.fs.attributes.has(`no_atime`)&&(this.dirty=!0,this.inode.atimeMs=Date.now());let i=r+n;!Pn(this.inode)&&!Nn(this.inode)&&i>this.inode.size&&(i=r+Math.max(this.inode.size-r,0)),this._position=i;let a=new Uint8Array(e.buffer,e.byteOffset,e.byteLength);return this.fs.readSync(this.internalPath,a.subarray(t,t+n),r,i),this._isSync&&this.syncSync(),i-r}chmodSync(e){if(this.closed)throw j(`EBADF`,`chmod`,this.path);this.dirty=!0,this.inode.mode=this.inode.mode&(e>61440?-61441:Ye)|e,(this._isSync||e>61440)&&this.syncSync()}chownSync(e,t){if(this.closed)throw j(`EBADF`,`chmod`,this.path);this.dirty=!0,In(this.inode,e,t),this._isSync&&this.syncSync()}utimesSync(e,t){if(this.closed)throw j(`EBADF`,`utimes`,this.path);this.dirty=!0,this.inode.atimeMs=e,this.inode.mtimeMs=t,this._isSync&&this.syncSync()}async[Symbol.asyncDispose](){await this.close()}async sync(){if(this.closed)throw j(`EBADF`,`sync`,this.path);this.dirty&&=(this.fs.attributes.has(`no_write`)||await this.fs.touch(this.internalPath,this.inode),!1)}datasync(){return this.sync()}async close(){if(this.closed)throw j(`EBADF`,`close`,this.path);await this.sync(),this.dispose()}dispose(e){if(this.closed)throw j(`EBADF`,`close`,this.path);if(this.dirty&&!e)throw j(`EBUSY`,`close`,this.path);this.closed=!0}stat(){if(this.closed)throw j(`EBADF`,`stat`,this.path);return this.inode}async truncate(e){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&On.Immutable)throw j(`EPERM`,`truncate`,this.path);this.dirty=!0,this.inode.mtimeMs=Date.now(),this.inode.size=e,this.inode.ctimeMs=Date.now(),this._isSync&&await this.sync()}async write(e,t=0,n=e.byteLength-t,r=this.position){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&On.Immutable)throw j(`EPERM`,`write`,this.path);this.dirty=!0;let i=r+n,a=e.subarray(t,t+n);return!Pn(this.inode)&&!Nn(this.inode)&&i>this.inode.size&&(this.inode.size=i),this.inode.mtimeMs=Date.now(),this.inode.ctimeMs=Date.now(),this._position=r+a.byteLength,await this.fs.write(this.internalPath,a,r),this._isSync&&await this.sync(),a.byteLength}async read(e,t=0,n=e.byteLength-t,r=this.position){if(this.closed||this.flag&1)throw j(`EBADF`,`read`,this.path);!(this.inode.flags&On.NoAtime)&&!this.fs.attributes.has(`no_atime`)&&(this.dirty=!0,this.inode.atimeMs=Date.now());let i=r+n;!Pn(this.inode)&&!Nn(this.inode)&&i>this.inode.size&&(i=r+Math.max(this.inode.size-r,0)),this._position=i;let a=new Uint8Array(e.buffer,e.byteOffset,e.byteLength);return await this.fs.read(this.internalPath,a.subarray(t,t+n),r,i),this._isSync&&await this.sync(),i-r}async chmod(e){if(this.closed)throw j(`EBADF`,`chmod`,this.path);this.dirty=!0,this.inode.mode=this.inode.mode&(e>61440?-61441:Ye)|e,(this._isSync||e>61440)&&await this.sync()}async chown(e,t){if(this.closed)throw j(`EBADF`,`chown`,this.path);this.dirty=!0,In(this.inode,e,t),this._isSync&&await this.sync()}async utimes(e,t){if(this.closed)throw j(`EBADF`,`utimes`,this.path);this.dirty=!0,this.inode.atimeMs=e,this.inode.mtimeMs=t,this._isSync&&await this.sync()}streamRead(e){if(this.closed)throw j(`EBADF`,`streamRead`,this.path);return this.fs.streamRead(this.internalPath,e)}streamWrite(e){if(this.closed)throw j(`EBADF`,`write`,this.path);if(this.inode.flags&On.Immutable)throw j(`EPERM`,`write`,this.path);if(this.fs.attributes.has(`readonly`))throw j(`EROFS`,`write`,this.path);return this.fs.streamWrite(this.internalPath,e)}};function fr(e){let t=Ie(e.context).descriptors,n=Math.max(t.size?Math.max(...t.keys())+1:0,4);return t.set(n,e),n}function pr(e,t){let n=Ie(e).descriptors.get(t);if(!n)throw M(`EBADF`);return n}function mr(e,t){return Ie(e).descriptors.delete(t)}const hr=/[rwasx]{1,2}\+?/;function gr(e){if(typeof e==`number`)return e;if(!hr.test(e))throw M(`EINVAL`,`Invalid flag string: `+e);return _r(e)}function _r(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|=Be),e.includes(`+`)?t|=2:e.includes(`r`)||(t|=1),e.includes(`s`)&&(t|=We),e.includes(`x`)&&(t|=128),t}function vr(e){let t=0;return e&1||(t|=4),(e&1||e&2)&&(t|=2),t}const yr=A;function br(e,t){return e.path=t,e}function xr(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 Sr(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}})}const Cr=new Map;wr(`/`,Xn.create({label:`root`}));function wr(e,t){if(e[0]!=`/`&&(e=`/`+e),e=sn.call(this,e),Cr.has(e))throw R(M(`EINVAL`,`Mount point is already in use: `+e));t._mountPoint=e,Cr.set(e,t),de(`Mounted ${t.name} on ${e}`),fe(`${t.name} attributes: ${[...t.attributes].map(([e,t])=>t==null?e:e+`=`+t).join(`, `)}`)}function Tr(e){if(e[0]!=`/`&&(e=`/`+e),e=sn.call(this,e),!Cr.has(e)){z(e+` is already unmounted`);return}Cr.delete(e),ue(`Unmounted `+e)}function Y(e,t,n){let{root:r}=Ie(t),i={path:e,...n};e=H(U(r,e),!0),e=sn.call(t,e);let a=[...Cr].sort((e,t)=>e[0].length>t[0].length?-1:1);for(let[t,n]of a){if(!Or(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:Sr(n,i),path:e,mountPoint:t,root:r}}throw ce(new A(O.EIO,`No file system for `+e))}function Er(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 Dr(e){let t=Ie(this);if(!Ne(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 Or(e,t){return e===`/`||e===t?!0:(e.endsWith(`/`)||(e+=`/`),t.startsWith(e))}var kr=t({link:()=>Ir,mkdir:()=>Nr,open:()=>jr,readdir:()=>Pr,readlink:()=>Mr,rename:()=>Fr,resolve:()=>Ar,stat:()=>Lr});function Ar(e,t,n,r){t=sn.call(e,t);try{let i=Y(t,e),a=i.fs.statSync(i.path);return!jn(a)||n?{...i,fullPath:t,stats:a}:Ar(e,sn.call(e,W(t),Mr.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}=mn(t),o=a==`/`?`/`:Ar(e,a,!1,r).fullPath,s=U(o,i),c=Y(s,e),l;try{l=c.fs.statSync(c.path)}catch(e){if(e.code===`ENOENT`)return{...c,fullPath:t};throw k(Object.assign(e,{syscall:`stat`,path:s,...r}))}return jn(l)?Ar(e,sn.call(e,o,Mr.call(e,s)),!1,r):{...c,fullPath:s,stats:l}}function jr(e,t){e=H(e);let n=Xt(t.mode,420),r=gr(t.flag);e=t.preserveSymlinks?e:Ar(this,e).fullPath;let{fs:i,path:a}=Y(e,this),o;try{o=i.statSync(a)}catch{}if(!o){if(!(r&64))throw j(`ENOENT`,`open`,e);let o=i.statSync(W(a));if(J&&!q(this,o,2))throw j(`EACCES`,`open`,e);if(!An(o))throw j(`ENOTDIR`,`open`,e);if(!t.allowDirectory&&n&16384)throw j(`EISDIR`,`open`,e);if(J&&!q(this,o,2))throw j(`EACCES`,`open`,e);let{euid:s,egid:c}=Ie(this).credentials,l=i.createFileSync(a,{mode:n,uid:o.mode&2048?o.uid:s,gid:o.mode&1024?o.gid:c});return new dr(this,e,i,a,r,l)}if(J&&(!q(this,o,n)||!q(this,o,vr(r))))throw j(`EACCES`,`open`,e);if(r&128)throw j(`EEXIST`,`open`,e);let s=new dr(this,e,i,a,r,o);if(!t.allowDirectory&&o.mode&16384)throw j(`EISDIR`,`open`,e);return r&512&&s.truncateSync(0),s}function Mr(e){e=H(e);let{fs:t,stats:n,path:r}=Ar(this,e,!0);if(!n)throw j(`ENOENT`,`readlink`,e);if(J&&!q(this,n,4))throw j(`EACCES`,`readlink`,e);if(!jn(n))throw j(`EINVAL`,`readlink`,e);let i=n.size,a=new Uint8Array(i);return t.readSync(r,a,0,i),ee(a)}function Nr(e,t={}){e=H(e);let{fs:n,path:r}=Ar(this,e),{euid:i,egid:a}=Ie(this).credentials,{mode:o=511,recursive:s}=t,c=(e,t,r)=>{if(J&&!q(this,r,2))throw j(`EACCES`,`mkdir`,W(e));let s=n.mkdirSync(t,{mode:o,uid:r.mode&2048?r.uid:i,gid:r.mode&1024?r.gid:a});return zi(this,`rename`,e),s};if(!s){c(e,r,n.statSync(W(r)));return}let l=[];for(let t=r,i=e;!n.existsSync(t);t=W(t),i=W(i))l.unshift({resolved:t,original:i});if(!l.length)return;let u=[n.statSync(W(l[0].resolved))];for(let[e,t]of l.entries())u.push(c(t.original,t.resolved,u[e]));return l[0].original}function Pr(e,t={}){e=H(e);let{fs:n,path:r}=Ar(this,e),i=n.statSync(r);if(J&&!q(this,i,4))throw j(`EACCES`,`readdir`,e);if(!An(i))throw j(`ENOTDIR`,`readdir`,e);let a=n.readdirSync(r),o=[],s=e=>{let i;try{i=n.statSync(U(r,e))}catch(e){if(e.code==`ENOENT`)return;throw e}let a=new ur;if(a.ino=i.ino,a.type=cr(i.mode),a.path=e,a.name=dn(e),o.push(a),!An(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 Fr(e,t){e=H(e),t=H(t);let n={syscall:`rename`,path:e,dest:t},r=Ar(this,e,!0,n),i=Y(t,this,n);if(r.fs.uuid!==i.fs.uuid)throw j(`EXDEV`,n);if(i.path.startsWith(r.path+`/`))throw j(`EBUSY`,n);if(!r.stats)throw j(`ENOENT`,n);let a=r.fs,o=a.statSync(W(r.path)),s=a.statSync(W(i.path)),c;try{c=a.statSync(i.path)}catch(e){if(e.code!=`ENOENT`)throw e}if(J&&(!q(this,o,4)||!q(this,s,2)))throw j(`EACCES`,n);if(c&&!An(r.stats)&&An(c))throw j(`EISDIR`,n);if(c&&An(r.stats)&&!An(c))throw j(`ENOTDIR`,n);r.fs.renameSync(r.path,i.path),zi(this,`rename`,e),zi(this,`change`,t)}function Ir(e,t){e=H(e),t=H(t);let n={syscall:`link`,path:t,dest:e},{fs:r,path:i}=Y(e,this,n),a=Y(t,this,n);if(r.uuid!==a.fs.uuid)throw j(`EXDEV`,n);let o=r.statSync(i);if(J){if(!q(this,o,4))throw j(`EACCES`,n);let e=r.statSync(W(i));if(!q(this,e,4))throw j(`EACCES`,n);let t=r.statSync(W(a.path));if(!q(this,t,2))throw j(`EACCES`,n)}return r.linkSync(i,a.path)}function Lr(e,t){e=H.call(this,e);let n={syscall:t?`lstat`:`stat`,path:e},r;if(!t)r=Ar(this,e,!1,n).stats;else{let{base:t,dir:i}=mn(e),{fs:a,path:o}=Ar(this,i,!1,n);try{r=a.statSync(t?U(o,t):o)}catch(e){throw k(Object.assign(e,n)),e}}if(!r)throw j(`ENOENT`,n);if(J&&!q(this,r,4))throw j(`EACCES`,n);return r}var Rr=class e{ino;type;_name;get name(){let e=ar.Buffer.from(this._name);return this._encoding==`buffer`?e:e.toString(this._encoding)}_encoding;_parentPath;get parentPath(){return this._parentPath}get path(){return z(`Dirent.path was removed in Node v24, use parentPath instead`),this._parentPath}static from(t,n){let r=new e,{base:i,dir:a}=mn(t.path);return r._parentPath=a||`.`,r._name=i,r.ino=t.ino,r.type=t.type,r._encoding=n,r}isFile(){return this.type===sr.REG}isDirectory(){return this.type===sr.DIR}isBlockDevice(){return this.type===sr.BLK}isCharacterDevice(){return this.type===sr.CHR}isSymbolicLink(){return this.type===sr.LNK}isFIFO(){return this.type===sr.FIFO}isSocket(){return this.type===sr.SOCK}},zr=class{path;context;closed=!1;checkClosed(){if(this.closed)throw M(`EBADF`,`Can not use closed Dir`)}_entries;constructor(e,t){this.path=e,this.context=t}close(e){if(this.closed=!0,!e)return Promise.resolve();e(null)}closeSync(){this.closed=!0}async _read(){return this.checkClosed(),this._entries??=await Ga.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??=di.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()}},Br=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},Vr=(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 Hr(e,t){return Fr.call(this,e,t)}function Ur(e){e=H(e);try{let{fs:t,path:n}=Ar(this,e);return t.existsSync(n)}catch(e){if(e.errno==O.ENOENT)return!1;throw e}}function Wr(e,t){let n=Lr.call(this,e,!1);return t?.bigint?new yn(n):new vn(n)}function Gr(e,t){let n=Lr.call(this,e,!0);return t?.bigint?new yn(n):new vn(n)}function Kr(e,t=0){let n={stack:[],error:void 0,hasError:!1};try{let r=Br(n,jr.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{Vr(n)}}function qr(e){e=H(e);let{fs:t,path:n}=Y(e,this);try{if(J&&!q(this,t.statSync(n),2))throw j(`EACCES`,`unlink`);t.unlinkSync(n)}catch(t){throw k(Object.assign(t,{path:e}))}zi(this,`rename`,e.toString())}function Jr(e,t,n=0){return fr(jr.call(this,e,{flag:t,mode:n}))}function Yr(e,t,n){return fr(jr.call(this,e,{flag:t,mode:n,preserveSymlinks:!0}))}function Xr(e,t={}){let n={stack:[],error:void 0,hasError:!1};try{let r=Qt(t,null,`r`,420);if(gr(r.flag)&1)throw j(`EBADF`,`read`,e.toString());let i=Br(n,typeof e==`number`?pr(this,e):jr.call(this,e.toString(),{flag:r.flag,mode:420,preserveSymlinks:!1}),!1),{size:a}=i.stat(),o=ar.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{Vr(n)}}function Zr(e,t,n={}){let r={stack:[],error:void 0,hasError:!1};try{let i=Qt(n,`utf8`,`w+`,420),a=gr(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`?ar.Buffer.from(t,i.encoding):new Uint8Array(t.buffer,t.byteOffset,t.byteLength);if(!o)throw new A(O.EINVAL,`Data not specified`);Br(r,typeof e==`number`?pr(this,e):jr.call(this,e.toString(),{flag:a,mode:i.mode,preserveSymlinks:!0}),!1).writeSync(o,0,o.byteLength,0),zi(this,`change`,e.toString())}catch(e){r.error=e,r.hasError=!0}finally{Vr(r)}}function Qr(e,t,n={}){let r=Qt(n,`utf8`,`a+`,420),i=gr(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`?ar.Buffer.from(t,r.encoding):new Uint8Array(t.buffer,t.byteOffset,t.byteLength),o=typeof e==`number`?pr(this,e):jr.call(this,H(e),{flag:i,mode:r.mode,preserveSymlinks:!0});o.writeSync(a,0,a.byteLength),typeof o!=`number`&&o.closeSync()}function $r(e,t){let n=pr(this,e).stat();return t?.bigint?new yn(n):new vn(n)}function ei(e){pr(this,e).closeSync(),mr(this,e)}function ti(e,t=0){if(t||=0,t<0)throw new A(O.EINVAL);pr(this,e).truncateSync(t)}function ni(e){pr(this,e).syncSync()}function ri(e){pr(this,e).datasyncSync()}function ii(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=ar.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=pr(this,e);c??=l.position;let u=l.writeSync(a,o,s,c);return zi(this,`change`,l.path),u}function ai(e,t,n,r,i){let a=pr(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 oi(e,t,n){pr(this,e).chownSync(t,n)}function si(e,t){let n=Xt(t,-1);if(n<0)throw new A(O.EINVAL,`Invalid mode.`);pr(this,e).chmodSync(n)}function ci(e,t,n){pr(this,e).utimesSync(Zt(t),Zt(n))}function li(e){e=H(e);let{fs:t,path:n}=Ar(this,e),r=xr(t,`statSync`,e)(n);if(!An(r))throw j(`ENOTDIR`,`rmdir`,e);if(J&&!q(this,r,2))throw j(`EACCES`,`rmdir`,e);xr(t,`rmdirSync`,e)(n),zi(this,`rename`,e.toString())}function ui(e,t){t=typeof t==`object`?t:{mode:t};let n=Xt(t?.mode,511);return Nr.call(this,e,{...t,mode:n})}function di(e,t){t=typeof t==`object`?t:{encoding:t},e=H(e);let n=[],r=Pr.call(this,e,t??void 0);for(let e of r)t?.withFileTypes?n.push(Rr.from(e,t.encoding)):t?.encoding==`buffer`?n.push(ar.Buffer.from(e.path)):n.push(e.path);return n}function fi(e,t){return Ir.call(this,e,t)}function pi(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=Br(r,jr.call(this,t,{flag:`wx`,mode:420}),!1);i.writeSync(w(H(e,!0))),i.chmodSync(Ze)}catch(e){r.error=e,r.hasError=!0}finally{Vr(r)}}function mi(e,t){let n=ar.Buffer.from(Mr.call(this,e)),r=typeof t==`object`?t?.encoding:t;return r==`buffer`?n:n.toString(r??`utf-8`)}function hi(e,t,n){let r={stack:[],error:void 0,hasError:!1};try{Br(r,jr.call(this,e,{flag:`r+`,mode:0}),!1).chownSync(t,n)}catch(e){r.error=e,r.hasError=!0}finally{Vr(r)}}function gi(e,t,n){let r=Yr.call(this,e,`r+`);oi.call(this,r,t,n),ei.call(this,r)}function _i(e,t){let n=Jr.call(this,e,`r+`);si.call(this,n,t),ei.call(this,n)}function vi(e,t){let n=Yr.call(this,e,`r+`);si.call(this,n,t),ei.call(this,n)}function yi(e,t,n){let r=Jr.call(this,e,`r+`);ci.call(this,r,t,n),ei.call(this,r)}function bi(e,t,n){let r=Yr.call(this,e,`r+`);ci.call(this,r,t,n),ei.call(this,r)}function xi(e,t){let n=typeof t==`string`?t:t?.encoding??`utf8`;e=H(e,!0);let{fullPath:r}=Ar(this,e);if(n==`utf8`||n==`utf-8`)return r;let i=ar.Buffer.from(r,`utf-8`);return n==`buffer`?i:i.toString(n)}function Si(e,t=384){if(J&&!q(this,Wr.call(this,e),t))throw new A(O.EACCES)}function Ci(e,t){e=H(e);let n;try{n=Gr.bind(this)(e)}catch(e){if(e.code!=`ENOENT`||!t?.force)throw e}if(n)switch(n.mode&Ye){case et:if(t?.recursive)for(let n of di.call(this,e))Ci.call(this,U(e,n),t);li.call(this,e);break;case Qe:case Ze:case $e:case tt:qr.call(this,e);break;case nt:case Xe:default:throw j(`ENOSYS`,`rm`,e)}}function wi(e,t){let n=typeof t==`object`?t?.encoding:t||`utf8`,r=tn(e);return ui.call(this,r),n==`buffer`?ar.Buffer.from(r):r}function Ti(e,t){let n=tn(e);ui.call(this,n);let r=()=>Ci(n,{recursive:!0,force:!0});return{path:n,remove:r,[Symbol.dispose]:r}}function Ei(e,t,n){if(e=H(e),t=H(t),n&&n&1&&Ur(t))throw j(`EEXIST`,`copyFile`,t);Zr.call(this,t,Xr(e)),zi(this,`rename`,t.toString())}function Di(e,t,n){let r=pr(this,e),i=0;for(let e of t)i+=r.readSync(e,0,e.byteLength,n+i);return i}function Oi(e,t,n){let r=pr(this,e),i=0;for(let e of t)i+=r.writeSync(new Uint8Array(e.buffer),0,e.byteLength,n+i);return i}function ki(e,t){return e=H(e),new zr(e,this)}function Ai(e,t,n){e=H(e),t=H(t);let r=Gr.call(this,e);if(n?.errorOnExist&&Ur.call(this,t))throw j(`EEXIST`,`cp`,t);switch(r.mode&Ye){case et:if(!n?.recursive)throw j(`EISDIR`,`cp`,e);ui.call(this,t,{recursive:!0});for(let r of di.call(this,e,{withFileTypes:!0}))n.filter&&!n.filter(U(e,r.name),U(t,r.name))||Ai.call(this,U(e,r.name),U(t,r.name),n);break;case Qe:case Ze:Ei.call(this,e,t);break;case $e:case tt:case nt:case Xe:default:throw j(`ENOSYS`,`cp`,e)}n?.preserveTimestamps&&yi.call(this,t,r.atime,r.mtime)}function ji(e,t){e=H(e);let{fs:n}=Y(e,this);return Er(n,t?.bigint)}function Mi(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($t),l=[];function u(e){let t=di(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=>hn(e,t)))continue;let a=t.replace(/^\/+/g,``);Wr(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 Ni=class extends u.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}},Pi=class extends Ni{options;realpath;constructor(e,t,n){let r=Ie(e);super(r,t),this.options=n,this.realpath=U(r.root,t),Li(this.realpath,this)}close(){super.emit(`close`),Ri(this.realpath,this)}[Symbol.dispose](){this.close()}},Fi=class extends Ni{options;intervalId;previous;constructor(e,t,n){super(e,t),this.options=n,this.start()}onInterval(){try{let e=Wr(this.path);bn(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=Wr(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()}};const Ii=new Map;function Li(e,t){let n=H(e);Ii.has(n)||Ii.set(n,new Set),Ii.get(n).add(t)}function Ri(e,t){let n=H(e);Ii.has(n)&&(Ii.get(n).delete(t),Ii.get(n).size===0&&Ii.delete(n))}function zi(e,t,n){let r=Ie(e);r&&(n=U(r.root??`/`,n)),n=H(n);for(let e=n;e!=`/`;e=W(e)){let r=Ii.get(e);if(r)for(let i of r)i.emit(`change`,t,un.call(i._context,e,n)||dn(n))}}async function Bi(e,t,n,r){if(t=sn.call(e,t),n){let n=Y(t,e,r),i=await n.fs.stat(n.path).catch(()=>void 0);return{...n,fullPath:t,stats:i}}try{let i=Y(t,e),a=await i.fs.stat(i.path);return jn(a)?await Bi(e,sn.call(e,W(t),await Hi.call(e,t)),n,r):{...i,fullPath:t,stats:a}}catch{}let{base:i,dir:a}=mn(t),o=a==`/`?`/`:(await Bi(e,a,!1,r)).fullPath,s=U(o,i),c=Y(s,e),l=await c.fs.stat(c.path).catch(e=>{if(e.code!=`ENOENT`)throw k(Object.assign(e,{syscall:`stat`,path:s,...r}))});return l?jn(l)?await Bi(e,sn.call(e,o,await Hi.call(e,s)),!1,r):{...c,fullPath:s,stats:l}:{...c,fullPath:t}}async function Vi(e,t,n){t=H(t);let r=Xt(n.mode,420),i=gr(n.flag),a={syscall:`open`,path:t},{fs:o,path:s,stats:c}=await Bi(e,t,n.preserveSymlinks,a);if(!c){if(!(i&64))throw j(`ENOENT`,a);let c=await o.stat(W(s));if(J&&!q(e,c,2))throw j(`EACCES`,`open`,W(t));if(!An(c))throw j(`ENOTDIR`,`open`,W(t));if(!n.allowDirectory&&r&16384)throw j(`EISDIR`,`open`,t);let{euid:l,egid:u}=Ie(e).credentials,d=await o.createFile(s,{mode:r,uid:c.mode&2048?c.uid:l,gid:c.mode&1024?c.gid:u});return new dr(e,t,o,s,i,d)}if(J&&!q(e,c,vr(i)))throw j(`EACCES`,a);if(i&128)throw j(`EEXIST`,a);let l=new dr(e,t,o,s,i,c);if(!n.allowDirectory&&r&16384)throw j(`EISDIR`,`open`,t);return i&512&&await l.truncate(0),l}async function Hi(e){e=H(e);let t={syscall:`readlink`,path:e},{fs:n,stats:r,path:i}=await Bi(this,e,!0,t);if(!r)throw j(`ENOENT`,t);if(J&&!q(this,r,4))throw j(`EACCES`,t);if(!jn(r))throw j(`EINVAL`,t);let a=r.size,o=new Uint8Array(a);return await n.read(i,o,0,a),ee(o)}async function Ui(e,t={}){e=H(e);let{euid:n,egid:r}=Ie(this).credentials,{mode:i=511,recursive:a}=t,{fs:o,path:s}=Y(e,this,{syscall:`mkdir`}),c=async(e,t,a)=>{if(J&&!q(this,a,2))throw j(`EACCES`,`mkdir`,e);let s=await o.mkdir(t,{mode:i,uid:a.mode&2048?a.uid:n,gid:a.mode&1024?a.gid:r});return zi(this,`rename`,e),s};if(!a){await c(e,s,await o.stat(W(s)));return}let l=[],u=e;for(let e=s;!await o.exists(e);e=W(e),u=W(u))l.unshift([u,e]);if(!l.length)return;let d=[await o.stat(W(l[0][1]))];for(let[e,[t,n]]of l.entries())d.push(await c(t,n,d[e]));return l[0][0]}async function Wi(e,t={}){e=H(e);let n={syscall:`readdir`,path:e},{fs:r,path:i,stats:a}=await Bi(this,e,!1,n);if(!a)throw j(`ENOENT`,n);if(J&&!q(this,a,4))throw j(`EACCES`,n);if(!An(a))throw j(`ENOTDIR`,n);let o=await r.readdir(i),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 ur;if(a.ino=n.ino,a.type=cr(n.mode),a.path=e,a.name=dn(e),s.push(a),!t.recursive||!An(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 Gi(e,t){e=H(e),t=H(t);let n={syscall:`rename`,path:e,dest:t},r=await Bi(this,e,!0,n),i=Y(t,this,n);if(r.fs.uuid!==i.fs.uuid)throw j(`EXDEV`,n);if(i.path.startsWith(r.path+`/`))throw j(`EBUSY`,n);if(!r.stats)throw j(`ENOENT`,n);let a=r.fs,o=await a.stat(W(r.path)),s=await a.stat(W(i.path)),c=await a.stat(i.path).catch(e=>{if(e.code==`ENOENT`)return null;throw e});if(J&&(!q(this,o,4)||!q(this,s,2)))throw j(`EACCES`,n);if(c&&!An(r.stats)&&An(c))throw j(`EISDIR`,n);if(c&&An(r.stats)&&!An(c))throw j(`ENOTDIR`,n);await r.fs.rename(r.path,i.path),zi(this,`rename`,e),zi(this,`change`,t)}async function Ki(e,t){e=H(e),t=H(t);let n={syscall:`link`,path:t,dest:e},{fs:r,path:i}=Y(e,this,n),a=Y(t,this,n);if(r.uuid!=a.fs.uuid)throw j(`EXDEV`,n);let o=await r.stat(i);if(J){if(!q(this,o,4))throw j(`EACCES`,n);let e=await r.stat(W(i));if(!q(this,e,4))throw j(`EACCES`,n);let t=await r.stat(W(a.path));if(!q(this,t,2))throw j(`EACCES`,n)}return await r.link(i,a.path)}async function qi(e,t){e=H.call(this,e);let n={syscall:t?`lstat`:`stat`,path:e},r;if(!t)r=(await Bi(this,e,!1,n)).stats;else{let{base:t,dir:i}=mn(e),{fs:a,path:o}=await Bi(this,i,!1,n);r=await a.stat(t?U(o,t):o).catch(N(n))}if(!r)throw j(`ENOENT`,n);if(J&&!q(this,r,4))throw j(`EACCES`,n);return r}var Ji=class extends u.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;Zi(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;Zi(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);Xi(this.output,1),this.line=e;break}case`^u`:{if(!this.output||!this._cursor)return;let e=this.line.slice(this._cursor);Xi(this.output,0),Zi(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,Zi(this.output,-t.length,0),Zi(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`):``)+`
|
|
5
|
-
`);break;case`up`:case`down`:{if(!this.output||!this._history.length)return;if(this._historyIndex===this._history.length&&(this._currentLine=this.line||``),t.name==`up`&&this._historyIndex>0)this._historyIndex--;else if(t.name==`down`&&this._historyIndex<this._history.length-1)this._historyIndex++;else if(t.name==`down`&&this._historyIndex==this._history.length-1){this._historyIndex=this._history.length,this._renderLine(this._currentLine);return}else return;let e=this._history[this._historyIndex];this._renderLine(e);break}case`left`:case`right`:{let e=t.name==`left`?-1:1;if(!this.output)return;let n=Math.max(0,Math.min(this.line.length,this._cursor+e));if(n==this._cursor)return;Zi(this.output,e,0),this._cursor=n,this._cursor=n;break}case`backspace`:{if(!this.output||!this._cursor)return;let e=this.line.slice(0,this._cursor-1)+this.line.slice(this._cursor);this._renderLine(e),this._cursor=--this._cursor,this._cursor>0&&(Zi(this.output,-this._cursor,0),Zi(this.output,this._cursor,0));break}case`delete`:{if(!this.output||this._cursor>=this.line.length)return;let e=this.line.slice(0,this._cursor)+this.line.slice(this._cursor+1);Xi(this.output,0),Zi(this.output,0,0),this.output.write(this._prompt+e),this.line=e,Zi(this.output,-e.length,0),Zi(this.output,this._cursor,0);break}}}}_renderLine(e){this.output&&(Xi(this.output,0),Zi(this.output,0,0),this.output.write(this._prompt+e),this.line=e,this._cursor=e.length,this._cursor=e.length)}question(e,t,n){let r=typeof t==`function`?t:n;if(this._closed||!this.output){r(``);return}this.output.write(e),this.once(`line`,r)}getCursorPos(){return{rows:0,cols:this.cursor}}prependListener(e,t){let n=this.listeners(e);return this.removeAllListeners(e),this.on(e,t),n.forEach(this.on.bind(this,e)),this}prependOnceListener(e,t){let n=this.listeners(e);return this.removeAllListeners(e),this.once(e,t),n.forEach(this.on.bind(this,e)),this}setMaxListeners(){return z(`Interface.prototype.setMaxListeners is not supported`),this}getMaxListeners(){return z(`Interface.prototype.getMaxListeners is not supported`),10}[Symbol.asyncIterator](){let e=!1;return{next:async()=>{if(e)return{done:e,value:void 0};let{resolve:t,promise:n}=Promise.withResolvers();return this.once(`line`,e=>t({value:e,done:!1})),this.once(`close`,()=>{e=!0,t({value:void 0,done:e})}),n},return:async t=>e?{done:e,value:t}:(e=!0,this.close(),{done:e,value:t}),throw:async t=>{throw e||(e=!0,this.close()),t},[Symbol.asyncIterator](){return this},[Symbol.asyncDispose]:async()=>{e||(e=!0,this.close())}}}[Symbol.dispose](){this.close()}async[Symbol.asyncDispose](){if(this._closed)return;let{resolve:e,promise:t}=Promise.withResolvers();this.once(`close`,()=>e()),this.close(),await t}rawListeners(e){return this.listeners(e)}};function Yi(e,t,n,r){return`input`in e?new Ji(e.input,e.output,e.completer,e.terminal):new Ji(e,t,n,r)}function Xi(e,t){return e.write(t>=0?`\r\x1B[K`:`\x1B[K`),!0}function Zi(e,t,n){if(!e.write)return!1;let r=``;return t<0?r+=`\x1b[${-t}D`:t>0&&(r+=`\x1b[${t}C`),n<0?r+=`\x1b[${-n}A`:n>0&&(r+=`\x1b[${n}B`),r&&e.write(r),!0}var Qi=n(((e,t)=>{t.exports={AggregateError:class extends Error{constructor(e){if(!Array.isArray(e))throw TypeError(`Expected input to be an Array, got ${typeof e}`);let t=``;for(let n=0;n<e.length;n++)t+=` ${e[n].stack}\n`;super(t),this.name=`AggregateError`,this.errors=e}},ArrayIsArray(e){return Array.isArray(e)},ArrayPrototypeIncludes(e,t){return e.includes(t)},ArrayPrototypeIndexOf(e,t){return e.indexOf(t)},ArrayPrototypeJoin(e,t){return e.join(t)},ArrayPrototypeMap(e,t){return e.map(t)},ArrayPrototypePop(e,t){return e.pop(t)},ArrayPrototypePush(e,t){return e.push(t)},ArrayPrototypeSlice(e,t,n){return e.slice(t,n)},Error,FunctionPrototypeCall(e,t,...n){return e.call(t,...n)},FunctionPrototypeSymbolHasInstance(e,t){return Function.prototype[Symbol.hasInstance].call(e,t)},MathFloor:Math.floor,Number,NumberIsInteger:Number.isInteger,NumberIsNaN:Number.isNaN,NumberMAX_SAFE_INTEGER:2**53-1,NumberMIN_SAFE_INTEGER:-(2**53-1),NumberParseInt:Number.parseInt,ObjectDefineProperties(e,t){return Object.defineProperties(e,t)},ObjectDefineProperty(e,t,n){return Object.defineProperty(e,t,n)},ObjectGetOwnPropertyDescriptor(e,t){return Object.getOwnPropertyDescriptor(e,t)},ObjectKeys(e){return Object.keys(e)},ObjectSetPrototypeOf(e,t){return Object.setPrototypeOf(e,t)},Promise,PromisePrototypeCatch(e,t){return e.catch(t)},PromisePrototypeThen(e,t,n){return e.then(t,n)},PromiseReject(e){return Promise.reject(e)},PromiseResolve(e){return Promise.resolve(e)},ReflectApply:Reflect.apply,RegExpPrototypeTest(e,t){return e.test(t)},SafeSet:Set,String,StringPrototypeSlice(e,t,n){return e.slice(t,n)},StringPrototypeToLowerCase(e){return e.toLowerCase()},StringPrototypeToUpperCase(e){return e.toUpperCase()},StringPrototypeTrim(e){return e.trim()},Symbol,SymbolFor:Symbol.for,SymbolAsyncIterator:Symbol.asyncIterator,SymbolHasInstance:Symbol.hasInstance,SymbolIterator:Symbol.iterator,SymbolDispose:Symbol.dispose||Symbol(`Symbol.dispose`),SymbolAsyncDispose:Symbol.asyncDispose||Symbol(`Symbol.asyncDispose`),TypedArrayPrototypeSet(e,t,n){return e.set(t,n)},Boolean,Uint8Array}})),$i=n(((e,t)=>{t.exports={format(e,...t){return e.replace(/%([sdifj])/g,function(...[e,n]){let r=t.shift();return n===`f`?r.toFixed(6):n===`j`?JSON.stringify(r):n===`s`&&typeof r==`object`?`${r.constructor===Object?``:r.constructor.name} {}`.trim():r.toString()})},inspect(e){switch(typeof e){case`string`:if(e.includes(`'`)){if(!e.includes(`"`))return`"${e}"`;if(!e.includes("`")&&!e.includes("${"))return`\`${e}\``}return`'${e}'`;case`number`:return isNaN(e)?`NaN`:Object.is(e,-0)?String(e):e;case`bigint`:return`${String(e)}n`;case`boolean`:case`undefined`:return String(e);case`object`:return`{}`}}}})),ea=n(((e,t)=>{let{format:n,inspect:r}=$i(),{AggregateError:i}=Qi(),a=globalThis.AggregateError||i,o=Symbol(`kIsNodeError`),s=[`string`,`function`,`number`,`object`,`Function`,`Object`,`boolean`,`bigint`,`symbol`],c=/^([A-Z][a-z0-9]*)+$/,l={};function u(e,t){if(!e)throw new l.ERR_INTERNAL_ASSERTION(t)}function d(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 f(e,t,r){if(typeof t==`function`)return u(t.length<=r.length,`Code: ${e}; The provided arguments length (${r.length}) does not match the required ones (${t.length}).`),t(...r);let i=(t.match(/%[dfijoOs]/g)||[]).length;return u(i===r.length,`Code: ${e}; The provided arguments length (${r.length}) does not match the required ones (${i}).`),r.length===0?t:n(t,...r)}function p(e,t,n){n||=Error;class r extends n{constructor(...n){super(f(e,t,n))}toString(){return`${this.name} [${e}]: ${this.message}`}}Object.defineProperties(r.prototype,{name:{value:n.name,writable:!0,enumerable:!1,configurable:!0},toString:{value(){return`${this.name} [${e}]: ${this.message}`},writable:!0,enumerable:!1,configurable:!0}}),r.prototype.code=e,r.prototype[o]=!0,l[e]=r}function m(e){let t=`__node_internal_`+e.name;return Object.defineProperty(e,"name",{value:t}),e}function h(e,t){if(e&&t&&e!==t){if(Array.isArray(t.errors))return t.errors.push(e),t;let n=new a([t,e],t.message);return n.code=t.code,n}return e||t}var g=class extends Error{constructor(e=`The operation was aborted`,t=void 0){if(t!==void 0&&typeof t!=`object`)throw new l.ERR_INVALID_ARG_TYPE(`options`,`Object`,t);super(e,t),this.code=`ABORT_ERR`,this.name=`AbortError`}};p(`ERR_ASSERTION`,`%s`,Error),p(`ERR_INVALID_ARG_TYPE`,(e,t,n)=>{u(typeof e==`string`,`'name' must be a string`),Array.isArray(t)||(t=[t]);let i=`The `;e.endsWith(` argument`)?i+=`${e} `:i+=`"${e}" ${e.includes(`.`)?`property`:`argument`} `,i+=`must be `;let a=[],o=[],l=[];for(let e of t)u(typeof e==`string`,`All expected entries have to be of type string`),s.includes(e)?a.push(e.toLowerCase()):c.test(e)?o.push(e):(u(e!==`object`,`The value "object" should be written as "Object"`),l.push(e));if(o.length>0){let e=a.indexOf(`object`);e!==-1&&(a.splice(a,e,1),o.push(`Object`))}if(a.length>0){switch(a.length){case 1:i+=`of type ${a[0]}`;break;case 2:i+=`one of type ${a[0]} or ${a[1]}`;break;default:{let e=a.pop();i+=`one of type ${a.join(`, `)}, or ${e}`}}(o.length>0||l.length>0)&&(i+=` or `)}if(o.length>0){switch(o.length){case 1:i+=`an instance of ${o[0]}`;break;case 2:i+=`an instance of ${o[0]} or ${o[1]}`;break;default:{let e=o.pop();i+=`an instance of ${o.join(`, `)}, or ${e}`}}l.length>0&&(i+=` or `)}switch(l.length){case 0:break;case 1:l[0].toLowerCase()!==l[0]&&(i+=`an `),i+=`${l[0]}`;break;case 2:i+=`one of ${l[0]} or ${l[1]}`;break;default:{let e=l.pop();i+=`one of ${l.join(`, `)}, or ${e}`}}if(n==null)i+=`. Received ${n}`;else if(typeof n==`function`&&n.name)i+=`. Received function ${n.name}`;else if(typeof n==`object`){var d;if((d=n.constructor)!=null&&d.name)i+=`. Received an instance of ${n.constructor.name}`;else{let e=r(n,{depth:-1});i+=`. Received ${e}`}}else{let e=r(n,{colors:!1});e.length>25&&(e=`${e.slice(0,25)}...`),i+=`. Received type ${typeof n} (${e})`}return i},TypeError),p(`ERR_INVALID_ARG_VALUE`,(e,t,n=`is invalid`)=>{let i=r(t);return i.length>128&&(i=i.slice(0,128)+`...`),`The ${e.includes(`.`)?`property`:`argument`} '${e}' ${n}. Received ${i}`},TypeError),p(`ERR_INVALID_RETURN_VALUE`,(e,t,n)=>{var r;return`Expected ${e} to be returned from the "${t}" function but got ${n!=null&&(r=n.constructor)!=null&&r.name?`instance of ${n.constructor.name}`:`type ${typeof n}`}.`},TypeError),p(`ERR_MISSING_ARGS`,(...e)=>{u(e.length>0,`At least one arg needs to be specified`);let t,n=e.length;switch(e=(Array.isArray(e)?e:[e]).map(e=>`"${e}"`).join(` or `),n){case 1:t+=`The ${e[0]} argument`;break;case 2:t+=`The ${e[0]} and ${e[1]} arguments`;break;default:{let n=e.pop();t+=`The ${e.join(`, `)}, and ${n} arguments`}break}return`${t} must be specified`},TypeError),p(`ERR_OUT_OF_RANGE`,(e,t,n)=>{u(t,`Missing "range" argument`);let i;if(Number.isInteger(n)&&Math.abs(n)>2**32)i=d(String(n));else if(typeof n==`bigint`){i=String(n);let e=BigInt(2)**BigInt(32);(n>e||n<-e)&&(i=d(i)),i+=`n`}else i=r(n);return`The value of "${e}" is out of range. It must be ${t}. Received ${i}`},RangeError),p(`ERR_MULTIPLE_CALLBACK`,`Callback called multiple times`,Error),p(`ERR_METHOD_NOT_IMPLEMENTED`,`The %s method is not implemented`,Error),p(`ERR_STREAM_ALREADY_FINISHED`,`Cannot call %s after a stream was finished`,Error),p(`ERR_STREAM_CANNOT_PIPE`,`Cannot pipe, not readable`,Error),p(`ERR_STREAM_DESTROYED`,`Cannot call %s after a stream was destroyed`,Error),p(`ERR_STREAM_NULL_VALUES`,`May not write null values to stream`,TypeError),p(`ERR_STREAM_PREMATURE_CLOSE`,`Premature close`,Error),p(`ERR_STREAM_PUSH_AFTER_EOF`,`stream.push() after EOF`,Error),p(`ERR_STREAM_UNSHIFT_AFTER_END_EVENT`,`stream.unshift() after end event`,Error),p(`ERR_STREAM_WRITE_AFTER_END`,`write after end`,Error),p(`ERR_UNKNOWN_ENCODING`,`Unknown encoding: %s`,TypeError),t.exports={AbortError:g,aggregateTwoErrors:m(h),hideStackFrames:m,codes:l}})),ta=n(((e,t)=>{let{AbortController:n,AbortSignal:r}=typeof self<`u`?self:typeof window<`u`?window:void 0;t.exports=n,t.exports.AbortSignal=r,t.exports.default=n})),na=n(((e,t)=>{var n=typeof Reflect==`object`?Reflect:null,r=n&&typeof n.apply==`function`?n.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)},i=n&&typeof n.ownKeys==`function`?n.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};function a(e){console&&console.warn&&console.warn(e)}var o=Number.isNaN||function(e){return e!==e};function s(){s.init.call(this)}t.exports=s,t.exports.once=y,s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var c=10;function l(e){if(typeof e!=`function`)throw TypeError(`The "listener" argument must be of type Function. Received type `+typeof e)}Object.defineProperty(s,"defaultMaxListeners",{enumerable:!0,get:function(){return c},set:function(e){if(typeof e!=`number`||e<0||o(e))throw RangeError(`The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received `+e+`.`);c=e}}),s.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},s.prototype.setMaxListeners=function(e){if(typeof e!=`number`||e<0||o(e))throw RangeError(`The value of "n" is out of range. It must be a non-negative number. Received `+e+`.`);return this._maxListeners=e,this};function u(e){return e._maxListeners===void 0?s.defaultMaxListeners:e._maxListeners}s.prototype.getMaxListeners=function(){return u(this)},s.prototype.emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t.push(arguments[n]);var i=e===`error`,a=this._events;if(a!==void 0)i&&=a.error===void 0;else if(!i)return!1;if(i){var o;if(t.length>0&&(o=t[0]),o instanceof Error)throw o;var s=Error(`Unhandled error.`+(o?` (`+o.message+`)`:``));throw s.context=o,s}var c=a[e];if(c===void 0)return!1;if(typeof c==`function`)r(c,this,t);else for(var l=c.length,u=g(c,l),n=0;n<l;++n)r(u[n],this,t);return!0};function d(e,t,n,r){var i,o,s;if(l(n),o=e._events,o===void 0?(o=e._events=Object.create(null),e._eventsCount=0):(o.newListener!==void 0&&(e.emit(`newListener`,t,n.listener?n.listener:n),o=e._events),s=o[t]),s===void 0)s=o[t]=n,++e._eventsCount;else if(typeof s==`function`?s=o[t]=r?[n,s]:[s,n]:r?s.unshift(n):s.push(n),i=u(e),i>0&&s.length>i&&!s.warned){s.warned=!0;var c=Error(`Possible EventEmitter memory leak detected. `+s.length+` `+String(t)+` listeners added. Use emitter.setMaxListeners() to increase limit`);c.name=`MaxListenersExceededWarning`,c.emitter=e,c.type=t,c.count=s.length,a(c)}return e}s.prototype.addListener=function(e,t){return d(this,e,t,!1)},s.prototype.on=s.prototype.addListener,s.prototype.prependListener=function(e,t){return d(this,e,t,!0)};function f(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function p(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},i=f.bind(r);return i.listener=n,r.wrapFn=i,i}s.prototype.once=function(e,t){return l(t),this.on(e,p(this,e,t)),this},s.prototype.prependOnceListener=function(e,t){return l(t),this.prependListener(e,p(this,e,t)),this},s.prototype.removeListener=function(e,t){var n,r,i,a,o;if(l(t),r=this._events,r===void 0||(n=r[e],n===void 0))return this;if(n===t||n.listener===t)--this._eventsCount===0?this._events=Object.create(null):(delete r[e],r.removeListener&&this.emit(`removeListener`,e,n.listener||t));else if(typeof n!=`function`){for(i=-1,a=n.length-1;a>=0;a--)if(n[a]===t||n[a].listener===t){o=n[a].listener,i=a;break}if(i<0)return this;i===0?n.shift():_(n,i),n.length===1&&(r[e]=n[0]),r.removeListener!==void 0&&this.emit(`removeListener`,e,o||t)}return this},s.prototype.off=s.prototype.removeListener,s.prototype.removeAllListeners=function(e){var t,n=this._events,r;if(n===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[e]),this;if(arguments.length===0){var i=Object.keys(n),a;for(r=0;r<i.length;++r)a=i[r],a!==`removeListener`&&this.removeAllListeners(a);return this.removeAllListeners(`removeListener`),this._events=Object.create(null),this._eventsCount=0,this}if(t=n[e],typeof t==`function`)this.removeListener(e,t);else if(t!==void 0)for(r=t.length-1;r>=0;r--)this.removeListener(e,t[r]);return this};function m(e,t,n){var r=e._events;if(r===void 0)return[];var i=r[t];return i===void 0?[]:typeof i==`function`?n?[i.listener||i]:[i]:n?v(i):g(i,i.length)}s.prototype.listeners=function(e){return m(this,e,!0)},s.prototype.rawListeners=function(e){return m(this,e,!1)},s.listenerCount=function(e,t){return typeof e.listenerCount==`function`?e.listenerCount(t):h.call(e,t)},s.prototype.listenerCount=h;function h(e){var t=this._events;if(t!==void 0){var n=t[e];if(typeof n==`function`)return 1;if(n!==void 0)return n.length}return 0}s.prototype.eventNames=function(){return this._eventsCount>0?i(this._events):[]};function g(e,t){for(var n=Array(t),r=0;r<t;++r)n[r]=e[r];return n}function _(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}function v(e){for(var t=Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}function y(e,t){return new Promise(function(n,r){function i(n){e.removeListener(t,a),r(n)}function a(){typeof e.removeListener==`function`&&e.removeListener(`error`,i),n([].slice.call(arguments))}x(e,t,a,{once:!0}),t!==`error`&&b(e,i,{once:!0})})}function b(e,t,n){typeof e.on==`function`&&x(e,`error`,t,n)}function x(e,t,n,r){if(typeof e.on==`function`)r.once?e.once(t,n):e.on(t,n);else if(typeof e.addEventListener==`function`)e.addEventListener(t,function i(a){r.once&&e.removeEventListener(t,i),n(a)});else throw TypeError(`The "emitter" argument must be of type EventEmitter. Received type `+typeof e)}})),ra=n(((e,t)=>{let n=r(),{format:i,inspect:a}=$i(),{codes:{ERR_INVALID_ARG_TYPE:o}}=ea(),{kResistStopPropagation:s,AggregateError:c,SymbolDispose:l}=Qi(),u=globalThis.AbortSignal||ta().AbortSignal,d=globalThis.AbortController||ta().AbortController,f=Object.getPrototypeOf(async function(){}).constructor,p=globalThis.Blob||n.Blob,m=p===void 0?function(e){return!1}:function(e){return e instanceof p},h=(e,t)=>{if(e!==void 0&&(typeof e!=`object`||!e||!(`aborted`in e)))throw new o(t,`AbortSignal`,e)},g=(e,t)=>{if(typeof e!=`function`)throw new o(t,`Function`,e)};t.exports={AggregateError:c,kEmptyObject:Object.freeze({}),once(e){let t=!1;return function(...n){t||(t=!0,e.apply(this,n))}},createDeferredPromise:function(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}},promisify(e){return new Promise((t,n)=>{e((e,...r)=>e?n(e):t(...r))})},debuglog(){return function(){}},format:i,inspect:a,types:{isAsyncFunction(e){return e instanceof f},isArrayBufferView(e){return ArrayBuffer.isView(e)}},isBlob:m,deprecate(e,t){return e},addAbortListener:na().addAbortListener||function(e,t){if(e===void 0)throw new o(`signal`,`AbortSignal`,e);h(e,`signal`),g(t,`listener`);let n;return e.aborted?queueMicrotask(()=>t()):(e.addEventListener(`abort`,t,{__proto__:null,once:!0,[s]:!0}),n=()=>{e.removeEventListener(`abort`,t)}),{__proto__:null,[l](){var e;(e=n)==null||e()}}},AbortSignalAny:u.any||function(e){if(e.length===1)return e[0];let t=new d,n=()=>t.abort();return e.forEach(e=>{h(e,`signals`),e.addEventListener(`abort`,n,{once:!0})}),t.signal.addEventListener(`abort`,()=>{e.forEach(e=>e.removeEventListener(`abort`,n))},{once:!0}),t.signal}},t.exports.promisify.custom=Symbol.for(`nodejs.util.promisify.custom`)})),ia=n(((e,t)=>{let{ArrayIsArray:n,ArrayPrototypeIncludes:r,ArrayPrototypeJoin:i,ArrayPrototypeMap:a,NumberIsInteger:o,NumberIsNaN:s,NumberMAX_SAFE_INTEGER:c,NumberMIN_SAFE_INTEGER:l,NumberParseInt:u,ObjectPrototypeHasOwnProperty:d,RegExpPrototypeExec:f,String:p,StringPrototypeToUpperCase:m,StringPrototypeTrim:h}=Qi(),{hideStackFrames:g,codes:{ERR_SOCKET_BAD_PORT:_,ERR_INVALID_ARG_TYPE:v,ERR_INVALID_ARG_VALUE:y,ERR_OUT_OF_RANGE:b,ERR_UNKNOWN_SIGNAL:x}}=ea(),{normalizeEncoding:S}=ra(),{isAsyncFunction:C,isArrayBufferView:w}=ra().types,T={};function ee(e){return e===(e|0)}function te(e){return e===e>>>0}let ne=/^[0-7]+$/;function E(e,t,n){if(e===void 0&&(e=n),typeof e==`string`){if(f(ne,e)===null)throw new y(t,e,`must be a 32-bit unsigned integer or an octal string`);e=u(e,8)}return re(e,t),e}let D=g((e,t,n=l,r=c)=>{if(typeof e!=`number`)throw new v(t,`number`,e);if(!o(e))throw new b(t,`an integer`,e);if(e<n||e>r)throw new b(t,`>= ${n} && <= ${r}`,e)}),O=g((e,t,n=-2147483648,r=2147483647)=>{if(typeof e!=`number`)throw new v(t,`number`,e);if(!o(e))throw new b(t,`an integer`,e);if(e<n||e>r)throw new b(t,`>= ${n} && <= ${r}`,e)}),re=g((e,t,n=!1)=>{if(typeof e!=`number`)throw new v(t,`number`,e);if(!o(e))throw new b(t,`an integer`,e);let r=+!!n,i=4294967295;if(e<r||e>i)throw new b(t,`>= ${r} && <= ${i}`,e)});function k(e,t){if(typeof e!=`string`)throw new v(t,`string`,e)}function A(e,t,n=void 0,r){if(typeof e!=`number`)throw new v(t,`number`,e);if(n!=null&&e<n||r!=null&&e>r||(n!=null||r!=null)&&s(e))throw new b(t,`${n==null?``:`>= ${n}`}${n!=null&&r!=null?` && `:``}${r==null?``:`<= ${r}`}`,e)}let j=g((e,t,n)=>{if(!r(n,e))throw new y(t,e,`must be one of: `+i(a(n,e=>typeof e==`string`?`'${e}'`:p(e)),`, `))});function M(e,t){if(typeof e!=`boolean`)throw new v(t,`boolean`,e)}function N(e,t,n){return e==null||!d(e,t)?n:e[t]}let P=g((e,t,r=null)=>{let i=N(r,`allowArray`,!1),a=N(r,`allowFunction`,!1);if(!N(r,`nullable`,!1)&&e===null||!i&&n(e)||typeof e!=`object`&&(!a||typeof e!=`function`))throw new v(t,`Object`,e)}),F=g((e,t)=>{if(e!=null&&typeof e!=`object`&&typeof e!=`function`)throw new v(t,`a dictionary`,e)}),ie=g((e,t,r=0)=>{if(!n(e))throw new v(t,`Array`,e);if(e.length<r)throw new y(t,e,`must be longer than ${r}`)});function I(e,t){ie(e,t);for(let n=0;n<e.length;n++)k(e[n],`${t}[${n}]`)}function ae(e,t){ie(e,t);for(let n=0;n<e.length;n++)M(e[n],`${t}[${n}]`)}function L(e,t){ie(e,t);for(let n=0;n<e.length;n++){let r=e[n],i=`${t}[${n}]`;if(r==null)throw new v(i,`AbortSignal`,r);R(r,i)}}function oe(e,t=`signal`){if(k(e,t),T[e]===void 0)throw T[m(e)]===void 0?new x(e):new x(e+` (signals must use all capital letters)`)}let se=g((e,t=`buffer`)=>{if(!w(e))throw new v(t,[`Buffer`,`TypedArray`,`DataView`],e)});function ce(e,t){let n=S(t),r=e.length;if(n===`hex`&&r%2!=0)throw new y(`encoding`,t,`is invalid for data of length ${r}`)}function le(e,t=`Port`,n=!0){if(typeof e!=`number`&&typeof e!=`string`||typeof e==`string`&&h(e).length===0||+e!=e>>>0||e>65535||e===0&&!n)throw new _(t,e,n);return e|0}let R=g((e,t)=>{if(e!==void 0&&(typeof e!=`object`||!e||!(`aborted`in e)))throw new v(t,`AbortSignal`,e)}),z=g((e,t)=>{if(typeof e!=`function`)throw new v(t,`Function`,e)}),ue=g((e,t)=>{if(typeof e!=`function`||C(e))throw new v(t,`Function`,e)}),de=g((e,t)=>{if(e!==void 0)throw new v(t,`undefined`,e)});function fe(e,t,n){if(!r(n,e))throw new v(t,`('${i(n,`|`)}')`,e)}let pe=/^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/;function me(e,t){if(e===void 0||!f(pe,e))throw new y(t,e,`must be an array or string of format "</styles.css>; rel=preload; as=style"`)}function he(e){if(typeof e==`string`)return me(e,`hints`),e;if(n(e)){let t=e.length,n=``;if(t===0)return n;for(let r=0;r<t;r++){let i=e[r];me(i,`hints`),n+=i,r!==t-1&&(n+=`, `)}return n}throw new y(`hints`,e,`must be an array or string of format "</styles.css>; rel=preload; as=style"`)}t.exports={isInt32:ee,isUint32:te,parseFileMode:E,validateArray:ie,validateStringArray:I,validateBooleanArray:ae,validateAbortSignalArray:L,validateBoolean:M,validateBuffer:se,validateDictionary:F,validateEncoding:ce,validateFunction:z,validateInt32:O,validateInteger:D,validateNumber:A,validateObject:P,validateOneOf:j,validatePlainFunction:ue,validatePort:le,validateSignalName:oe,validateString:k,validateUint32:re,validateUndefined:de,validateUnion:fe,validateAbortSignal:R,validateLinkHeaderValue:he}})),aa=n(((e,t)=>{var n=t.exports={},r,i;function a(){throw Error(`setTimeout has not been defined`)}function o(){throw Error(`clearTimeout has not been defined`)}(function(){try{r=typeof setTimeout==`function`?setTimeout:a}catch{r=a}try{i=typeof clearTimeout==`function`?clearTimeout:o}catch{i=o}})();function s(e){if(r===setTimeout)return setTimeout(e,0);if((r===a||!r)&&setTimeout)return r=setTimeout,setTimeout(e,0);try{return r(e,0)}catch{try{return r.call(null,e,0)}catch{return r.call(this,e,0)}}}function c(e){if(i===clearTimeout)return clearTimeout(e);if((i===o||!i)&&clearTimeout)return i=clearTimeout,clearTimeout(e);try{return i(e)}catch{try{return i.call(null,e)}catch{return i.call(this,e)}}}var l=[],u=!1,d,f=-1;function p(){!u||!d||(u=!1,d.length?l=d.concat(l):f=-1,l.length&&m())}function m(){if(!u){var e=s(p);u=!0;for(var t=l.length;t;){for(d=l,l=[];++f<t;)d&&d[f].run();f=-1,t=l.length}d=null,u=!1,c(e)}}n.nextTick=function(e){var t=Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];l.push(new h(e,t)),l.length===1&&!u&&s(m)};function h(e,t){this.fun=e,this.array=t}h.prototype.run=function(){this.fun.apply(null,this.array)},n.title=`browser`,n.browser=!0,n.env={},n.argv=[],n.version=``,n.versions={};function g(){}n.on=g,n.addListener=g,n.once=g,n.off=g,n.removeListener=g,n.removeAllListeners=g,n.emit=g,n.prependListener=g,n.prependOnceListener=g,n.listeners=function(e){return[]},n.binding=function(e){throw Error(`process.binding is not supported`)},n.cwd=function(){return`/`},n.chdir=function(e){throw Error(`process.chdir is not supported`)},n.umask=function(){return 0}})),oa=n(((e,t)=>{let{SymbolAsyncIterator:n,SymbolIterator:r,SymbolFor:i}=Qi(),a=i(`nodejs.stream.destroyed`),o=i(`nodejs.stream.errored`),s=i(`nodejs.stream.readable`),c=i(`nodejs.stream.writable`),l=i(`nodejs.stream.disturbed`),u=i(`nodejs.webstream.isClosedPromise`),d=i(`nodejs.webstream.controllerErrorFunction`);function f(e,t=!1){return!!(e&&typeof e.pipe==`function`&&typeof e.on==`function`&&(!t||typeof e.pause==`function`&&typeof e.resume==`function`)&&(!e._writableState||e._readableState?.readable!==!1)&&(!e._writableState||e._readableState))}function p(e){return!!(e&&typeof e.write==`function`&&typeof e.on==`function`&&(!e._readableState||e._writableState?.writable!==!1))}function m(e){return!!(e&&typeof e.pipe==`function`&&e._readableState&&typeof e.on==`function`&&typeof e.write==`function`)}function h(e){return e&&(e._readableState||e._writableState||typeof e.write==`function`&&typeof e.on==`function`||typeof e.pipe==`function`&&typeof e.on==`function`)}function g(e){return!!(e&&!h(e)&&typeof e.pipeThrough==`function`&&typeof e.getReader==`function`&&typeof e.cancel==`function`)}function _(e){return!!(e&&!h(e)&&typeof e.getWriter==`function`&&typeof e.abort==`function`)}function v(e){return!!(e&&!h(e)&&typeof e.readable==`object`&&typeof e.writable==`object`)}function y(e){return g(e)||_(e)||v(e)}function b(e,t){return e==null?!1:t===!0?typeof e[n]==`function`:t===!1?typeof e[r]==`function`:typeof e[n]==`function`||typeof e[r]==`function`}function x(e){if(!h(e))return null;let t=e._writableState,n=e._readableState,r=t||n;return!!(e.destroyed||e[a]||r!=null&&r.destroyed)}function S(e){if(!p(e))return null;if(e.writableEnded===!0)return!0;let t=e._writableState;return t!=null&&t.errored?!1:typeof t?.ended==`boolean`?t.ended:null}function C(e,t){if(!p(e))return null;if(e.writableFinished===!0)return!0;let n=e._writableState;return n!=null&&n.errored?!1:typeof n?.finished==`boolean`?!!(n.finished||t===!1&&n.ended===!0&&n.length===0):null}function w(e){if(!f(e))return null;if(e.readableEnded===!0)return!0;let t=e._readableState;return!t||t.errored?!1:typeof t?.ended==`boolean`?t.ended:null}function T(e,t){if(!f(e))return null;let n=e._readableState;return n!=null&&n.errored?!1:typeof n?.endEmitted==`boolean`?!!(n.endEmitted||t===!1&&n.ended===!0&&n.length===0):null}function ee(e){return e&&e[s]!=null?e[s]:typeof e?.readable==`boolean`?x(e)?!1:f(e)&&e.readable&&!T(e):null}function te(e){return e&&e[c]!=null?e[c]:typeof e?.writable==`boolean`?x(e)?!1:p(e)&&e.writable&&!S(e):null}function ne(e,t){return h(e)?x(e)?!0:!(t?.readable!==!1&&ee(e)||t?.writable!==!1&&te(e)):null}function E(e){return h(e)?e.writableErrored?e.writableErrored:e._writableState?.errored??null:null}function D(e){return h(e)?e.readableErrored?e.readableErrored:e._readableState?.errored??null:null}function O(e){if(!h(e))return null;if(typeof e.closed==`boolean`)return e.closed;let t=e._writableState,n=e._readableState;return typeof t?.closed==`boolean`||typeof n?.closed==`boolean`?t?.closed||n?.closed:typeof e._closed==`boolean`&&re(e)?e._closed:null}function re(e){return typeof e._closed==`boolean`&&typeof e._defaultKeepAlive==`boolean`&&typeof e._removedConnection==`boolean`&&typeof e._removedContLen==`boolean`}function k(e){return typeof e._sent100==`boolean`&&re(e)}function A(e){return typeof e._consuming==`boolean`&&typeof e._dumped==`boolean`&&e.req?.upgradeOrConnect===void 0}function j(e){if(!h(e))return null;let t=e._writableState,n=e._readableState,r=t||n;return!r&&k(e)||!!(r&&r.autoDestroy&&r.emitClose&&r.closed===!1)}function M(e){return!!(e&&(e[l]??(e.readableDidRead||e.readableAborted)))}function N(e){return!!(e&&(e[o]??e.readableErrored??e.writableErrored??e._readableState?.errorEmitted??e._writableState?.errorEmitted??e._readableState?.errored??e._writableState?.errored))}t.exports={isDestroyed:x,kIsDestroyed:a,isDisturbed:M,kIsDisturbed:l,isErrored:N,kIsErrored:o,isReadable:ee,kIsReadable:s,kIsClosedPromise:u,kControllerErrorFunction:d,kIsWritable:c,isClosed:O,isDuplexNodeStream:m,isFinished:ne,isIterable:b,isReadableNodeStream:f,isReadableStream:g,isReadableEnded:w,isReadableFinished:T,isReadableErrored:D,isNodeStream:h,isWebStream:y,isWritable:te,isWritableNodeStream:p,isWritableStream:_,isWritableEnded:S,isWritableFinished:C,isWritableErrored:E,isServerRequest:A,isServerResponse:k,willEmitClose:j,isTransformStream:v}})),sa=n(((e,t)=>{let n=aa(),{AbortError:r,codes:i}=ea(),{ERR_INVALID_ARG_TYPE:a,ERR_STREAM_PREMATURE_CLOSE:o}=i,{kEmptyObject:s,once:c}=ra(),{validateAbortSignal:l,validateFunction:u,validateObject:d,validateBoolean:f}=ia(),{Promise:p,PromisePrototypeThen:m,SymbolDispose:h}=Qi(),{isClosed:g,isReadable:_,isReadableNodeStream:v,isReadableStream:y,isReadableFinished:b,isReadableErrored:x,isWritable:S,isWritableNodeStream:C,isWritableStream:w,isWritableFinished:T,isWritableErrored:ee,isNodeStream:te,willEmitClose:ne,kIsClosedPromise:E}=oa(),D;function O(e){return e.setHeader&&typeof e.abort==`function`}let re=()=>{};function k(e,t,i){if(arguments.length===2?(i=t,t=s):t==null?t=s:d(t,`options`),u(i,`callback`),l(t.signal,`options.signal`),i=c(i),y(e)||w(e))return A(e,t,i);if(!te(e))throw new a(`stream`,[`ReadableStream`,`WritableStream`,`Stream`],e);let f=t.readable??v(e),p=t.writable??C(e),m=e._writableState,E=e._readableState,k=()=>{e.writable||N()},j=ne(e)&&v(e)===f&&C(e)===p,M=T(e,!1),N=()=>{M=!0,e.destroyed&&(j=!1),!(j&&(!e.readable||f))&&(!f||P)&&i.call(e)},P=b(e,!1),F=()=>{P=!0,e.destroyed&&(j=!1),!(j&&(!e.writable||p))&&(!p||M)&&i.call(e)},ie=t=>{i.call(e,t)},I=g(e),ae=()=>{I=!0;let t=ee(e)||x(e);if(t&&typeof t!=`boolean`)return i.call(e,t);if(f&&!P&&v(e,!0)&&!b(e,!1)||p&&!M&&!T(e,!1))return i.call(e,new o);i.call(e)},L=()=>{I=!0;let t=ee(e)||x(e);if(t&&typeof t!=`boolean`)return i.call(e,t);i.call(e)},oe=()=>{e.req.on(`finish`,N)};O(e)?(e.on(`complete`,N),j||e.on(`abort`,ae),e.req?oe():e.on(`request`,oe)):p&&!m&&(e.on(`end`,k),e.on(`close`,k)),!j&&typeof e.aborted==`boolean`&&e.on(`aborted`,ae),e.on(`end`,F),e.on(`finish`,N),t.error!==!1&&e.on(`error`,ie),e.on(`close`,ae),I?n.nextTick(ae):m!=null&&m.errorEmitted||E!=null&&E.errorEmitted?j||n.nextTick(L):(!f&&(!j||_(e))&&(M||S(e)===!1)||!p&&(!j||S(e))&&(P||_(e)===!1)||E&&e.req&&e.aborted)&&n.nextTick(L);let se=()=>{i=re,e.removeListener(`aborted`,ae),e.removeListener(`complete`,N),e.removeListener(`abort`,ae),e.removeListener(`request`,oe),e.req&&e.req.removeListener(`finish`,N),e.removeListener(`end`,k),e.removeListener(`close`,k),e.removeListener(`finish`,N),e.removeListener(`end`,F),e.removeListener(`error`,ie),e.removeListener(`close`,ae)};if(t.signal&&!I){let a=()=>{let n=i;se(),n.call(e,new r(void 0,{cause:t.signal.reason}))};if(t.signal.aborted)n.nextTick(a);else{D||=ra().addAbortListener;let n=D(t.signal,a),r=i;i=c((...t)=>{n[h](),r.apply(e,t)})}}return se}function A(e,t,i){let a=!1,o=re;if(t.signal)if(o=()=>{a=!0,i.call(e,new r(void 0,{cause:t.signal.reason}))},t.signal.aborted)n.nextTick(o);else{D||=ra().addAbortListener;let n=D(t.signal,o),r=i;i=c((...t)=>{n[h](),r.apply(e,t)})}let s=(...t)=>{a||n.nextTick(()=>i.apply(e,t))};return m(e[E].promise,s,s),re}function j(e,t){var n;let r=!1;return t===null&&(t=s),(n=t)!=null&&n.cleanup&&(f(t.cleanup,`cleanup`),r=t.cleanup),new p((n,i)=>{let a=k(e,t,e=>{r&&a(),e?i(e):n()})})}t.exports=k,t.exports.finished=j})),ca=n(((e,t)=>{let n=aa(),{aggregateTwoErrors:r,codes:{ERR_MULTIPLE_CALLBACK:i},AbortError:a}=ea(),{Symbol:o}=Qi(),{kIsDestroyed:s,isDestroyed:c,isFinished:l,isServerRequest:u}=oa(),d=o(`kDestroy`),f=o(`kConstruct`);function p(e,t,n){e&&(e.stack,t&&!t.errored&&(t.errored=e),n&&!n.errored&&(n.errored=e))}function m(e,t){let n=this._readableState,i=this._writableState,a=i||n;return i!=null&&i.destroyed||n!=null&&n.destroyed?(typeof t==`function`&&t(),this):(p(e,i,n),i&&(i.destroyed=!0),n&&(n.destroyed=!0),a.constructed?h(this,e,t):this.once(d,function(n){h(this,r(n,e),t)}),this)}function h(e,t,r){let i=!1;function a(t){if(i)return;i=!0;let a=e._readableState,o=e._writableState;p(t,o,a),o&&(o.closed=!0),a&&(a.closed=!0),typeof r==`function`&&r(t),t?n.nextTick(g,e,t):n.nextTick(_,e)}try{e._destroy(t||null,a)}catch(e){a(e)}}function g(e,t){v(e,t),_(e)}function _(e){let t=e._readableState,n=e._writableState;n&&(n.closeEmitted=!0),t&&(t.closeEmitted=!0),(n!=null&&n.emitClose||t!=null&&t.emitClose)&&e.emit(`close`)}function v(e,t){let n=e._readableState,r=e._writableState;r!=null&&r.errorEmitted||n!=null&&n.errorEmitted||(r&&(r.errorEmitted=!0),n&&(n.errorEmitted=!0),e.emit(`error`,t))}function y(){let e=this._readableState,t=this._writableState;e&&(e.constructed=!0,e.closed=!1,e.closeEmitted=!1,e.destroyed=!1,e.errored=null,e.errorEmitted=!1,e.reading=!1,e.ended=e.readable===!1,e.endEmitted=e.readable===!1),t&&(t.constructed=!0,t.destroyed=!1,t.closed=!1,t.closeEmitted=!1,t.errored=null,t.errorEmitted=!1,t.finalCalled=!1,t.prefinished=!1,t.ended=t.writable===!1,t.ending=t.writable===!1,t.finished=t.writable===!1)}function b(e,t,r){let i=e._readableState,a=e._writableState;if(a!=null&&a.destroyed||i!=null&&i.destroyed)return this;i!=null&&i.autoDestroy||a!=null&&a.autoDestroy?e.destroy(t):t&&(t.stack,a&&!a.errored&&(a.errored=t),i&&!i.errored&&(i.errored=t),r?n.nextTick(v,e,t):v(e,t))}function x(e,t){if(typeof e._construct!=`function`)return;let r=e._readableState,i=e._writableState;r&&(r.constructed=!1),i&&(i.constructed=!1),e.once(f,t),!(e.listenerCount(f)>1)&&n.nextTick(S,e)}function S(e){let t=!1;function r(r){if(t){b(e,r??new i);return}t=!0;let a=e._readableState,o=e._writableState,s=o||a;a&&(a.constructed=!0),o&&(o.constructed=!0),s.destroyed?e.emit(d,r):r?b(e,r,!0):n.nextTick(C,e)}try{e._construct(e=>{n.nextTick(r,e)})}catch(e){n.nextTick(r,e)}}function C(e){e.emit(f)}function w(e){return e?.setHeader&&typeof e.abort==`function`}function T(e){e.emit(`close`)}function ee(e,t){e.emit(`error`,t),n.nextTick(T,e)}function te(e,t){!e||c(e)||(!t&&!l(e)&&(t=new a),u(e)?(e.socket=null,e.destroy(t)):w(e)?e.abort():w(e.req)?e.req.abort():typeof e.destroy==`function`?e.destroy(t):typeof e.close==`function`?e.close():t?n.nextTick(ee,e,t):n.nextTick(T,e),e.destroyed||(e[s]=!0))}t.exports={construct:x,destroyer:te,destroy:m,undestroy:y,errorOrDestroy:b}})),la=n(((e,t)=>{let{ArrayIsArray:n,ObjectSetPrototypeOf:r}=Qi(),{EventEmitter:i}=na();function a(e){i.call(this,e)}r(a.prototype,i.prototype),r(a,i),a.prototype.pipe=function(e,t){let n=this;function r(t){e.writable&&e.write(t)===!1&&n.pause&&n.pause()}n.on(`data`,r);function a(){n.readable&&n.resume&&n.resume()}e.on(`drain`,a),!e._isStdio&&(!t||t.end!==!1)&&(n.on(`end`,c),n.on(`close`,l));let s=!1;function c(){s||(s=!0,e.end())}function l(){s||(s=!0,typeof e.destroy==`function`&&e.destroy())}function u(e){d(),i.listenerCount(this,`error`)===0&&this.emit(`error`,e)}o(n,`error`,u),o(e,`error`,u);function d(){n.removeListener(`data`,r),e.removeListener(`drain`,a),n.removeListener(`end`,c),n.removeListener(`close`,l),n.removeListener(`error`,u),e.removeListener(`error`,u),n.removeListener(`end`,d),n.removeListener(`close`,d),e.removeListener(`close`,d)}return n.on(`end`,d),n.on(`close`,d),e.on(`close`,d),e.emit(`pipe`,n),e};function o(e,t,r){if(typeof e.prependListener==`function`)return e.prependListener(t,r);!e._events||!e._events[t]?e.on(t,r):n(e._events[t])?e._events[t].unshift(r):e._events[t]=[r,e._events[t]]}t.exports={Stream:a,prependListener:o}})),ua=n(((e,t)=>{let{SymbolDispose:n}=Qi(),{AbortError:r,codes:i}=ea(),{isNodeStream:a,isWebStream:o,kControllerErrorFunction:s}=oa(),c=sa(),{ERR_INVALID_ARG_TYPE:l}=i,u,d=(e,t)=>{if(typeof e!=`object`||!(`aborted`in e))throw new l(t,`AbortSignal`,e)};t.exports.addAbortSignal=function(e,n){if(d(e,`signal`),!a(n)&&!o(n))throw new l(`stream`,[`ReadableStream`,`WritableStream`,`Stream`],n);return t.exports.addAbortSignalNoValidate(e,n)},t.exports.addAbortSignalNoValidate=function(e,t){if(typeof e!=`object`||!(`aborted`in e))return t;let i=a(t)?()=>{t.destroy(new r(void 0,{cause:e.reason}))}:()=>{t[s](new r(void 0,{cause:e.reason}))};return e.aborted?i():(u||=ra().addAbortListener,c(t,u(e,i)[n])),t}})),da=n(((e,t)=>{let{StringPrototypeSlice:n,SymbolIterator:i,TypedArrayPrototypeSet:a,Uint8Array:o}=Qi(),{Buffer:s}=r(),{inspect:c}=ra();t.exports=class{constructor(){this.head=null,this.tail=null,this.length=0}push(e){let t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length}unshift(e){let t={data:e,next:this.head};this.length===0&&(this.tail=t),this.head=t,++this.length}shift(){if(this.length===0)return;let e=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,e}clear(){this.head=this.tail=null,this.length=0}join(e){if(this.length===0)return``;let t=this.head,n=``+t.data;for(;(t=t.next)!==null;)n+=e+t.data;return n}concat(e){if(this.length===0)return s.alloc(0);let t=s.allocUnsafe(e>>>0),n=this.head,r=0;for(;n;)a(t,n.data,r),r+=n.data.length,n=n.next;return t}consume(e,t){let n=this.head.data;if(e<n.length){let t=n.slice(0,e);return this.head.data=n.slice(e),t}return e===n.length?this.shift():t?this._getString(e):this._getBuffer(e)}first(){return this.head.data}*[i](){for(let e=this.head;e;e=e.next)yield e.data}_getString(e){let t=``,r=this.head,i=0;do{let a=r.data;if(e>a.length)t+=a,e-=a.length;else{e===a.length?(t+=a,++i,r.next?this.head=r.next:this.head=this.tail=null):(t+=n(a,0,e),this.head=r,r.data=n(a,e));break}++i}while((r=r.next)!==null);return this.length-=i,t}_getBuffer(e){let t=s.allocUnsafe(e),n=e,r=this.head,i=0;do{let s=r.data;if(e>s.length)a(t,s,n-e),e-=s.length;else{e===s.length?(a(t,s,n-e),++i,r.next?this.head=r.next:this.head=this.tail=null):(a(t,new o(s.buffer,s.byteOffset,e),n-e),this.head=r,r.data=s.slice(e));break}++i}while((r=r.next)!==null);return this.length-=i,t}[Symbol.for(`nodejs.util.inspect.custom`)](e,t){return c(this,{...t,depth:0,customInspect:!1})}}})),fa=n(((e,t)=>{let{MathFloor:n,NumberIsInteger:r}=Qi(),{validateInteger:i}=ia(),{ERR_INVALID_ARG_VALUE:a}=ea().codes,o=16*1024,s=16;function c(e,t,n){return e.highWaterMark==null?t?e[n]:null:e.highWaterMark}function l(e){return e?s:o}function u(e,t){i(t,`value`,0),e?s=t:o=t}function d(e,t,i,o){let s=c(t,o,i);if(s!=null){if(!r(s)||s<0)throw new a(o?`options.${i}`:`options.highWaterMark`,s);return n(s)}return l(e.objectMode)}t.exports={getHighWaterMark:d,getDefaultHighWaterMark:l,setDefaultHighWaterMark:u}})),pa=n((e=>{var t=i().Buffer,n=t.isEncoding||function(e){switch(e=``+e,e&&e.toLowerCase()){case`hex`:case`utf8`:case`utf-8`:case`ascii`:case`binary`:case`base64`:case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:case`raw`:return!0;default:return!1}};function r(e){if(!e)return`utf8`;for(var t;;)switch(e){case`utf8`:case`utf-8`:return`utf8`;case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return`utf16le`;case`latin1`:case`binary`:return`latin1`;case`base64`:case`ascii`:case`hex`:return e;default:if(t)return;e=(``+e).toLowerCase(),t=!0}}function a(e){var i=r(e);if(typeof i!=`string`&&(t.isEncoding===n||!n(e)))throw Error(`Unknown encoding: `+e);return i||e}e.StringDecoder=o;function o(e){this.encoding=a(e);var n;switch(this.encoding){case`utf16le`:this.text=p,this.end=m,n=4;break;case`utf8`:this.fillLast=u,n=4;break;case`base64`:this.text=h,this.end=g,n=3;break;default:this.write=_,this.end=v;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=t.allocUnsafe(n)}o.prototype.write=function(e){if(e.length===0)return``;var t,n;if(this.lastNeed){if(t=this.fillLast(e),t===void 0)return``;n=this.lastNeed,this.lastNeed=0}else n=0;return n<e.length?t?t+this.text(e,n):this.text(e,n):t||``},o.prototype.end=f,o.prototype.text=d,o.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length};function s(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function c(e,t,n){var r=t.length-1;if(r<n)return 0;var i=s(t[r]);return i>=0?(i>0&&(e.lastNeed=i-1),i):--r<n||i===-2?0:(i=s(t[r]),i>=0?(i>0&&(e.lastNeed=i-2),i):--r<n||i===-2?0:(i=s(t[r]),i>=0?(i>0&&(i===2?i=0:e.lastNeed=i-3),i):0))}function l(e,t,n){if((t[0]&192)!=128)return e.lastNeed=0,`�`;if(e.lastNeed>1&&t.length>1){if((t[1]&192)!=128)return e.lastNeed=1,`�`;if(e.lastNeed>2&&t.length>2&&(t[2]&192)!=128)return e.lastNeed=2,`�`}}function u(e){var t=this.lastTotal-this.lastNeed,n=l(this,e,t);if(n!==void 0)return n;if(this.lastNeed<=e.length)return e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,t,0,e.length),this.lastNeed-=e.length}function d(e,t){var n=c(this,e,t);if(!this.lastNeed)return e.toString(`utf8`,t);this.lastTotal=n;var r=e.length-(n-this.lastNeed);return e.copy(this.lastChar,0,r),e.toString(`utf8`,t,r)}function f(e){var t=e&&e.length?this.write(e):``;return this.lastNeed?t+`�`:t}function p(e,t){if((e.length-t)%2==0){var n=e.toString(`utf16le`,t);if(n){var r=n.charCodeAt(n.length-1);if(r>=55296&&r<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],n.slice(0,-1)}return n}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString(`utf16le`,t,e.length-1)}function m(e){var t=e&&e.length?this.write(e):``;if(this.lastNeed){var n=this.lastTotal-this.lastNeed;return t+this.lastChar.toString(`utf16le`,0,n)}return t}function h(e,t){var n=(e.length-t)%3;return n===0?e.toString(`base64`,t):(this.lastNeed=3-n,this.lastTotal=3,n===1?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString(`base64`,t,e.length-n))}function g(e){var t=e&&e.length?this.write(e):``;return this.lastNeed?t+this.lastChar.toString(`base64`,0,3-this.lastNeed):t}function _(e){return e.toString(this.encoding)}function v(e){return e&&e.length?this.write(e):``}})),ma=n(((e,t)=>{let n=aa(),{PromisePrototypeThen:i,SymbolAsyncIterator:a,SymbolIterator:o}=Qi(),{Buffer:s}=r(),{ERR_INVALID_ARG_TYPE:c,ERR_STREAM_NULL_VALUES:l}=ea().codes;function u(e,t,r){let u;if(typeof t==`string`||t instanceof s)return new e({objectMode:!0,...r,read(){this.push(t),this.push(null)}});let d;if(t&&t[a])d=!0,u=t[a]();else if(t&&t[o])d=!1,u=t[o]();else throw new c(`iterable`,[`Iterable`],t);let f=new e({objectMode:!0,highWaterMark:1,...r}),p=!1;f._read=function(){p||(p=!0,h())},f._destroy=function(e,t){i(m(e),()=>n.nextTick(t,e),r=>n.nextTick(t,r||e))};async function m(e){let t=e!=null,n=typeof u.throw==`function`;if(t&&n){let{value:t,done:n}=await u.throw(e);if(await t,n)return}if(typeof u.return==`function`){let{value:e}=await u.return();await e}}async function h(){for(;;){try{let{value:e,done:t}=d?await u.next():u.next();if(t)f.push(null);else{let t=e&&typeof e.then==`function`?await e:e;if(t===null)throw p=!1,new l;if(f.push(t))continue;p=!1}}catch(e){f.destroy(e)}break}}return f}t.exports=u})),ha=n(((e,t)=>{let n=aa(),{ArrayPrototypeIndexOf:i,NumberIsInteger:a,NumberIsNaN:o,NumberParseInt:s,ObjectDefineProperties:c,ObjectKeys:l,ObjectSetPrototypeOf:u,Promise:d,SafeSet:f,SymbolAsyncDispose:p,SymbolAsyncIterator:m,Symbol:h}=Qi();t.exports=L,L.ReadableState=ae;let{EventEmitter:g}=na(),{Stream:_,prependListener:v}=la(),{Buffer:y}=r(),{addAbortSignal:b}=ua(),x=sa(),S=ra().debuglog(`stream`,e=>{S=e}),C=da(),w=ca(),{getHighWaterMark:T,getDefaultHighWaterMark:ee}=fa(),{aggregateTwoErrors:te,codes:{ERR_INVALID_ARG_TYPE:ne,ERR_METHOD_NOT_IMPLEMENTED:E,ERR_OUT_OF_RANGE:D,ERR_STREAM_PUSH_AFTER_EOF:O,ERR_STREAM_UNSHIFT_AFTER_END_EVENT:re},AbortError:k}=ea(),{validateObject:A}=ia(),j=h(`kPaused`),{StringDecoder:M}=pa(),N=ma();u(L.prototype,_.prototype),u(L,_);let P=()=>{},{errorOrDestroy:F}=w,ie=65536;function I(e){return{enumerable:!1,get(){return(this.state&e)!==0},set(t){t?this.state|=e:this.state&=~e}}}c(ae.prototype,{objectMode:I(1),ended:I(2),endEmitted:I(4),reading:I(8),constructed:I(16),sync:I(32),needReadable:I(64),emittedReadable:I(128),readableListening:I(256),resumeScheduled:I(512),errorEmitted:I(1024),emitClose:I(2048),autoDestroy:I(4096),destroyed:I(8192),closed:I(16384),closeEmitted:I(32768),multiAwaitDrain:I(ie),readingMore:I(131072),dataEmitted:I(262144)});function ae(e,t,n){typeof n!=`boolean`&&(n=t instanceof va()),this.state=6192,e&&e.objectMode&&(this.state|=1),n&&e&&e.readableObjectMode&&(this.state|=1),this.highWaterMark=e?T(this,e,`readableHighWaterMark`,n):ee(!1),this.buffer=new C,this.length=0,this.pipes=[],this.flowing=null,this[j]=null,e&&e.emitClose===!1&&(this.state&=-2049),e&&e.autoDestroy===!1&&(this.state&=-4097),this.errored=null,this.defaultEncoding=e&&e.defaultEncoding||`utf8`,this.awaitDrainWriters=null,this.decoder=null,this.encoding=null,e&&e.encoding&&(this.decoder=new M(e.encoding),this.encoding=e.encoding)}function L(e){if(!(this instanceof L))return new L(e);let t=this instanceof va();this._readableState=new ae(e,this,t),e&&(typeof e.read==`function`&&(this._read=e.read),typeof e.destroy==`function`&&(this._destroy=e.destroy),typeof e.construct==`function`&&(this._construct=e.construct),e.signal&&!t&&b(e.signal,this)),_.call(this,e),w.construct(this,()=>{this._readableState.needReadable&&de(this,this._readableState)})}L.prototype.destroy=w.destroy,L.prototype._undestroy=w.undestroy,L.prototype._destroy=function(e,t){t(e)},L.prototype[g.captureRejectionSymbol]=function(e){this.destroy(e)},L.prototype[p]=function(){let e;return this.destroyed||(e=this.readableEnded?null:new k,this.destroy(e)),new d((t,n)=>x(this,r=>r&&r!==e?n(r):t(null)))},L.prototype.push=function(e,t){return oe(this,e,t,!1)},L.prototype.unshift=function(e,t){return oe(this,e,t,!0)};function oe(e,t,n,r){S(`readableAddChunk`,t);let i=e._readableState,a;if(i.state&1||(typeof t==`string`?(n||=i.defaultEncoding,i.encoding!==n&&(r&&i.encoding?t=y.from(t,n).toString(i.encoding):(t=y.from(t,n),n=``))):t instanceof y?n=``:_._isUint8Array(t)?(t=_._uint8ArrayToBuffer(t),n=``):t!=null&&(a=new ne(`chunk`,[`string`,`Buffer`,`Uint8Array`],t))),a)F(e,a);else if(t===null)i.state&=-9,R(e,i);else if(i.state&1||t&&t.length>0)if(r)if(i.state&4)F(e,new re);else if(i.destroyed||i.errored)return!1;else se(e,i,t,!0);else if(i.ended)F(e,new O);else if(i.destroyed||i.errored)return!1;else i.state&=-9,i.decoder&&!n?(t=i.decoder.write(t),i.objectMode||t.length!==0?se(e,i,t,!1):de(e,i)):se(e,i,t,!1);else r||(i.state&=-9,de(e,i));return!i.ended&&(i.length<i.highWaterMark||i.length===0)}function se(e,t,n,r){t.flowing&&t.length===0&&!t.sync&&e.listenerCount(`data`)>0?(t.state&ie?t.awaitDrainWriters.clear():t.awaitDrainWriters=null,t.dataEmitted=!0,e.emit(`data`,n)):(t.length+=t.objectMode?1:n.length,r?t.buffer.unshift(n):t.buffer.push(n),t.state&64&&z(e)),de(e,t)}L.prototype.isPaused=function(){let e=this._readableState;return e[j]===!0||e.flowing===!1},L.prototype.setEncoding=function(e){let t=new M(e);this._readableState.decoder=t,this._readableState.encoding=this._readableState.decoder.encoding;let n=this._readableState.buffer,r=``;for(let e of n)r+=t.write(e);return n.clear(),r!==``&&n.push(r),this._readableState.length=r.length,this};function ce(e){if(e>1073741824)throw new D(`size`,`<= 1GiB`,e);return e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++,e}function le(e,t){return e<=0||t.length===0&&t.ended?0:t.state&1?1:o(e)?t.flowing&&t.length?t.buffer.first().length:t.length:e<=t.length?e:t.ended?t.length:0}L.prototype.read=function(e){S(`read`,e),e===void 0?e=NaN:a(e)||(e=s(e,10));let t=this._readableState,n=e;if(e>t.highWaterMark&&(t.highWaterMark=ce(e)),e!==0&&(t.state&=-129),e===0&&t.needReadable&&((t.highWaterMark===0?t.length>0:t.length>=t.highWaterMark)||t.ended))return S(`read: emitReadable`,t.length,t.ended),t.length===0&&t.ended?Se(this):z(this),null;if(e=le(e,t),e===0&&t.ended)return t.length===0&&Se(this),null;let r=(t.state&64)!=0;if(S(`need readable`,r),(t.length===0||t.length-e<t.highWaterMark)&&(r=!0,S(`length less than watermark`,r)),t.ended||t.reading||t.destroyed||t.errored||!t.constructed)r=!1,S(`reading, ended or constructing`,r);else if(r){S(`do read`),t.state|=40,t.length===0&&(t.state|=64);try{this._read(t.highWaterMark)}catch(e){F(this,e)}t.state&=-33,t.reading||(e=le(n,t))}let i;return i=e>0?xe(e,t):null,i===null?(t.needReadable=t.length<=t.highWaterMark,e=0):(t.length-=e,t.multiAwaitDrain?t.awaitDrainWriters.clear():t.awaitDrainWriters=null),t.length===0&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&Se(this)),i!==null&&!t.errorEmitted&&!t.closeEmitted&&(t.dataEmitted=!0,this.emit(`data`,i)),i};function R(e,t){if(S(`onEofChunk`),!t.ended){if(t.decoder){let e=t.decoder.end();e&&e.length&&(t.buffer.push(e),t.length+=t.objectMode?1:e.length)}t.ended=!0,t.sync?z(e):(t.needReadable=!1,t.emittedReadable=!0,ue(e))}}function z(e){let t=e._readableState;S(`emitReadable`,t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(S(`emitReadable`,t.flowing),t.emittedReadable=!0,n.nextTick(ue,e))}function ue(e){let t=e._readableState;S(`emitReadable_`,t.destroyed,t.length,t.ended),!t.destroyed&&!t.errored&&(t.length||t.ended)&&(e.emit(`readable`),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,ve(e)}function de(e,t){!t.readingMore&&t.constructed&&(t.readingMore=!0,n.nextTick(fe,e,t))}function fe(e,t){for(;!t.reading&&!t.ended&&(t.length<t.highWaterMark||t.flowing&&t.length===0);){let n=t.length;if(S(`maybeReadMore read 0`),e.read(0),n===t.length)break}t.readingMore=!1}L.prototype._read=function(e){throw new E(`_read()`)},L.prototype.pipe=function(e,t){let r=this,i=this._readableState;i.pipes.length===1&&(i.multiAwaitDrain||(i.multiAwaitDrain=!0,i.awaitDrainWriters=new f(i.awaitDrainWriters?[i.awaitDrainWriters]:[]))),i.pipes.push(e),S(`pipe count=%d opts=%j`,i.pipes.length,t);let a=(!t||t.end!==!1)&&e!==n.stdout&&e!==n.stderr?s:_;i.endEmitted?n.nextTick(a):r.once(`end`,a),e.on(`unpipe`,o);function o(e,t){S(`onunpipe`),e===r&&t&&t.hasUnpiped===!1&&(t.hasUnpiped=!0,u())}function s(){S(`onend`),e.end()}let c,l=!1;function u(){S(`cleanup`),e.removeListener(`close`,h),e.removeListener(`finish`,g),c&&e.removeListener(`drain`,c),e.removeListener(`error`,m),e.removeListener(`unpipe`,o),r.removeListener(`end`,s),r.removeListener(`end`,_),r.removeListener(`data`,p),l=!0,c&&i.awaitDrainWriters&&(!e._writableState||e._writableState.needDrain)&&c()}function d(){l||(i.pipes.length===1&&i.pipes[0]===e?(S(`false write response, pause`,0),i.awaitDrainWriters=e,i.multiAwaitDrain=!1):i.pipes.length>1&&i.pipes.includes(e)&&(S(`false write response, pause`,i.awaitDrainWriters.size),i.awaitDrainWriters.add(e)),r.pause()),c||(c=pe(r,e),e.on(`drain`,c))}r.on(`data`,p);function p(t){S(`ondata`);let n=e.write(t);S(`dest.write`,n),n===!1&&d()}function m(t){if(S(`onerror`,t),_(),e.removeListener(`error`,m),e.listenerCount(`error`)===0){let n=e._writableState||e._readableState;n&&!n.errorEmitted?F(e,t):e.emit(`error`,t)}}v(e,`error`,m);function h(){e.removeListener(`finish`,g),_()}e.once(`close`,h);function g(){S(`onfinish`),e.removeListener(`close`,h),_()}e.once(`finish`,g);function _(){S(`unpipe`),r.unpipe(e)}return e.emit(`pipe`,r),e.writableNeedDrain===!0?d():i.flowing||(S(`pipe resume`),r.resume()),e};function pe(e,t){return function(){let n=e._readableState;n.awaitDrainWriters===t?(S(`pipeOnDrain`,1),n.awaitDrainWriters=null):n.multiAwaitDrain&&(S(`pipeOnDrain`,n.awaitDrainWriters.size),n.awaitDrainWriters.delete(t)),(!n.awaitDrainWriters||n.awaitDrainWriters.size===0)&&e.listenerCount(`data`)&&e.resume()}}L.prototype.unpipe=function(e){let t=this._readableState,n={hasUnpiped:!1};if(t.pipes.length===0)return this;if(!e){let e=t.pipes;t.pipes=[],this.pause();for(let t=0;t<e.length;t++)e[t].emit(`unpipe`,this,{hasUnpiped:!1});return this}let r=i(t.pipes,e);return r===-1?this:(t.pipes.splice(r,1),t.pipes.length===0&&this.pause(),e.emit(`unpipe`,this,n),this)},L.prototype.on=function(e,t){let r=_.prototype.on.call(this,e,t),i=this._readableState;return e===`data`?(i.readableListening=this.listenerCount(`readable`)>0,i.flowing!==!1&&this.resume()):e===`readable`&&!i.endEmitted&&!i.readableListening&&(i.readableListening=i.needReadable=!0,i.flowing=!1,i.emittedReadable=!1,S(`on readable`,i.length,i.reading),i.length?z(this):i.reading||n.nextTick(he,this)),r},L.prototype.addListener=L.prototype.on,L.prototype.removeListener=function(e,t){let r=_.prototype.removeListener.call(this,e,t);return e===`readable`&&n.nextTick(me,this),r},L.prototype.off=L.prototype.removeListener,L.prototype.removeAllListeners=function(e){let t=_.prototype.removeAllListeners.apply(this,arguments);return(e===`readable`||e===void 0)&&n.nextTick(me,this),t};function me(e){let t=e._readableState;t.readableListening=e.listenerCount(`readable`)>0,t.resumeScheduled&&t[j]===!1?t.flowing=!0:e.listenerCount(`data`)>0?e.resume():t.readableListening||(t.flowing=null)}function he(e){S(`readable nexttick read 0`),e.read(0)}L.prototype.resume=function(){let e=this._readableState;return e.flowing||(S(`resume`),e.flowing=!e.readableListening,ge(this,e)),e[j]=!1,this};function ge(e,t){t.resumeScheduled||(t.resumeScheduled=!0,n.nextTick(_e,e,t))}function _e(e,t){S(`resume`,t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit(`resume`),ve(e),t.flowing&&!t.reading&&e.read(0)}L.prototype.pause=function(){return S(`call pause flowing=%j`,this._readableState.flowing),this._readableState.flowing!==!1&&(S(`pause`),this._readableState.flowing=!1,this.emit(`pause`)),this._readableState[j]=!0,this};function ve(e){let t=e._readableState;for(S(`flow`,t.flowing);t.flowing&&e.read()!==null;);}L.prototype.wrap=function(e){let t=!1;e.on(`data`,n=>{!this.push(n)&&e.pause&&(t=!0,e.pause())}),e.on(`end`,()=>{this.push(null)}),e.on(`error`,e=>{F(this,e)}),e.on(`close`,()=>{this.destroy()}),e.on(`destroy`,()=>{this.destroy()}),this._read=()=>{t&&e.resume&&(t=!1,e.resume())};let n=l(e);for(let t=1;t<n.length;t++){let r=n[t];this[r]===void 0&&typeof e[r]==`function`&&(this[r]=e[r].bind(e))}return this},L.prototype[m]=function(){return ye(this)},L.prototype.iterator=function(e){return e!==void 0&&A(e,`options`),ye(this,e)};function ye(e,t){typeof e.read!=`function`&&(e=L.wrap(e,{objectMode:!0}));let n=be(e,t);return n.stream=e,n}async function*be(e,t){let n=P;function r(t){this===e?(n(),n=P):n=t}e.on(`readable`,r);let i,a=x(e,{writable:!1},e=>{i=e?te(i,e):null,n(),n=P});try{for(;;){let t=e.destroyed?null:e.read();if(t!==null)yield t;else if(i)throw i;else if(i===null)return;else await new d(r)}}catch(e){throw i=te(i,e),i}finally{(i||t?.destroyOnReturn!==!1)&&(i===void 0||e._readableState.autoDestroy)?w.destroyer(e,null):(e.off(`readable`,r),a())}}c(L.prototype,{readable:{__proto__:null,get(){let e=this._readableState;return!!e&&e.readable!==!1&&!e.destroyed&&!e.errorEmitted&&!e.endEmitted},set(e){this._readableState&&(this._readableState.readable=!!e)}},readableDidRead:{__proto__:null,enumerable:!1,get:function(){return this._readableState.dataEmitted}},readableAborted:{__proto__:null,enumerable:!1,get:function(){return!!(this._readableState.readable!==!1&&(this._readableState.destroyed||this._readableState.errored)&&!this._readableState.endEmitted)}},readableHighWaterMark:{__proto__:null,enumerable:!1,get:function(){return this._readableState.highWaterMark}},readableBuffer:{__proto__:null,enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}},readableFlowing:{__proto__:null,enumerable:!1,get:function(){return this._readableState.flowing},set:function(e){this._readableState&&(this._readableState.flowing=e)}},readableLength:{__proto__:null,enumerable:!1,get(){return this._readableState.length}},readableObjectMode:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.objectMode:!1}},readableEncoding:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.encoding:null}},errored:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.errored:null}},closed:{__proto__:null,get(){return this._readableState?this._readableState.closed:!1}},destroyed:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.destroyed:!1},set(e){this._readableState&&(this._readableState.destroyed=e)}},readableEnded:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.endEmitted:!1}}}),c(ae.prototype,{pipesCount:{__proto__:null,get(){return this.pipes.length}},paused:{__proto__:null,get(){return this[j]!==!1},set(e){this[j]=!!e}}}),L._fromList=xe;function xe(e,t){if(t.length===0)return null;let n;return t.objectMode?n=t.buffer.shift():!e||e>=t.length?(n=t.decoder?t.buffer.join(``):t.buffer.length===1?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):n=t.buffer.consume(e,t.decoder),n}function Se(e){let t=e._readableState;S(`endReadable`,t.endEmitted),t.endEmitted||(t.ended=!0,n.nextTick(Ce,t,e))}function Ce(e,t){if(S(`endReadableNT`,e.endEmitted,e.length),!e.errored&&!e.closeEmitted&&!e.endEmitted&&e.length===0){if(e.endEmitted=!0,t.emit(`end`),t.writable&&t.allowHalfOpen===!1)n.nextTick(we,t);else if(e.autoDestroy){let e=t._writableState;(!e||e.autoDestroy&&(e.finished||e.writable===!1))&&t.destroy()}}}function we(e){e.writable&&!e.writableEnded&&!e.destroyed&&e.end()}L.from=function(e,t){return N(L,e,t)};let Te;function Ee(){return Te===void 0&&(Te={}),Te}L.fromWeb=function(e,t){return Ee().newStreamReadableFromReadableStream(e,t)},L.toWeb=function(e,t){return Ee().newReadableStreamFromStreamReadable(e,t)},L.wrap=function(e,t){return new L({objectMode:e.readableObjectMode??e.objectMode??!0,...t,destroy(t,n){w.destroyer(e,t),n(t)}}).wrap(e)}})),ga=n(((e,t)=>{let n=aa(),{ArrayPrototypeSlice:i,Error:a,FunctionPrototypeSymbolHasInstance:o,ObjectDefineProperty:s,ObjectDefineProperties:c,ObjectSetPrototypeOf:l,StringPrototypeToLowerCase:u,Symbol:d,SymbolHasInstance:f}=Qi();t.exports=A,A.WritableState=re;let{EventEmitter:p}=na(),m=la().Stream,{Buffer:h}=r(),g=ca(),{addAbortSignal:_}=ua(),{getHighWaterMark:v,getDefaultHighWaterMark:y}=fa(),{ERR_INVALID_ARG_TYPE:b,ERR_METHOD_NOT_IMPLEMENTED:x,ERR_MULTIPLE_CALLBACK:S,ERR_STREAM_CANNOT_PIPE:C,ERR_STREAM_DESTROYED:w,ERR_STREAM_ALREADY_FINISHED:T,ERR_STREAM_NULL_VALUES:ee,ERR_STREAM_WRITE_AFTER_END:te,ERR_UNKNOWN_ENCODING:ne}=ea().codes,{errorOrDestroy:E}=g;l(A.prototype,m.prototype),l(A,m);function D(){}let O=d(`kOnFinished`);function re(e,t,n){typeof n!=`boolean`&&(n=t instanceof va()),this.objectMode=!!(e&&e.objectMode),n&&(this.objectMode=this.objectMode||!!(e&&e.writableObjectMode)),this.highWaterMark=e?v(this,e,`writableHighWaterMark`,n):y(!1),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;let r=!!(e&&e.decodeStrings===!1);this.decodeStrings=!r,this.defaultEncoding=e&&e.defaultEncoding||`utf8`,this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=F.bind(void 0,t),this.writecb=null,this.writelen=0,this.afterWriteTickInfo=null,k(this),this.pendingcb=0,this.constructed=!0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!e||e.emitClose!==!1,this.autoDestroy=!e||e.autoDestroy!==!1,this.errored=null,this.closed=!1,this.closeEmitted=!1,this[O]=[]}function k(e){e.buffered=[],e.bufferedIndex=0,e.allBuffers=!0,e.allNoop=!0}re.prototype.getBuffer=function(){return i(this.buffered,this.bufferedIndex)},s(re.prototype,`bufferedRequestCount`,{__proto__:null,get(){return this.buffered.length-this.bufferedIndex}});function A(e){let t=this instanceof va();if(!t&&!o(A,this))return new A(e);this._writableState=new re(e,this,t),e&&(typeof e.write==`function`&&(this._write=e.write),typeof e.writev==`function`&&(this._writev=e.writev),typeof e.destroy==`function`&&(this._destroy=e.destroy),typeof e.final==`function`&&(this._final=e.final),typeof e.construct==`function`&&(this._construct=e.construct),e.signal&&_(e.signal,this)),m.call(this,e),g.construct(this,()=>{let e=this._writableState;e.writing||L(this,e),le(this,e)})}s(A,f,{__proto__:null,value:function(e){return o(this,e)?!0:this===A?e&&e._writableState instanceof re:!1}}),A.prototype.pipe=function(){E(this,new C)};function j(e,t,r,i){let a=e._writableState;if(typeof r==`function`)i=r,r=a.defaultEncoding;else{if(!r)r=a.defaultEncoding;else if(r!==`buffer`&&!h.isEncoding(r))throw new ne(r);typeof i!=`function`&&(i=D)}if(t===null)throw new ee;if(!a.objectMode)if(typeof t==`string`)a.decodeStrings!==!1&&(t=h.from(t,r),r=`buffer`);else if(t instanceof h)r=`buffer`;else if(m._isUint8Array(t))t=m._uint8ArrayToBuffer(t),r=`buffer`;else throw new b(`chunk`,[`string`,`Buffer`,`Uint8Array`],t);let o;return a.ending?o=new te:a.destroyed&&(o=new w(`write`)),o?(n.nextTick(i,o),E(e,o,!0),o):(a.pendingcb++,M(e,a,t,r,i))}A.prototype.write=function(e,t,n){return j(this,e,t,n)===!0},A.prototype.cork=function(){this._writableState.corked++},A.prototype.uncork=function(){let e=this._writableState;e.corked&&(e.corked--,e.writing||L(this,e))},A.prototype.setDefaultEncoding=function(e){if(typeof e==`string`&&(e=u(e)),!h.isEncoding(e))throw new ne(e);return this._writableState.defaultEncoding=e,this};function M(e,t,n,r,i){let a=t.objectMode?1:n.length;t.length+=a;let o=t.length<t.highWaterMark;return o||(t.needDrain=!0),t.writing||t.corked||t.errored||!t.constructed?(t.buffered.push({chunk:n,encoding:r,callback:i}),t.allBuffers&&r!==`buffer`&&(t.allBuffers=!1),t.allNoop&&i!==D&&(t.allNoop=!1)):(t.writelen=a,t.writecb=i,t.writing=!0,t.sync=!0,e._write(n,r,t.onwrite),t.sync=!1),o&&!t.errored&&!t.destroyed}function N(e,t,n,r,i,a,o){t.writelen=r,t.writecb=o,t.writing=!0,t.sync=!0,t.destroyed?t.onwrite(new w(`write`)):n?e._writev(i,t.onwrite):e._write(i,a,t.onwrite),t.sync=!1}function P(e,t,n,r){--t.pendingcb,r(n),ae(t),E(e,n)}function F(e,t){let r=e._writableState,i=r.sync,a=r.writecb;if(typeof a!=`function`){E(e,new S);return}r.writing=!1,r.writecb=null,r.length-=r.writelen,r.writelen=0,t?(t.stack,r.errored||=t,e._readableState&&!e._readableState.errored&&(e._readableState.errored=t),i?n.nextTick(P,e,r,t,a):P(e,r,t,a)):(r.buffered.length>r.bufferedIndex&&L(e,r),i?r.afterWriteTickInfo!==null&&r.afterWriteTickInfo.cb===a?r.afterWriteTickInfo.count++:(r.afterWriteTickInfo={count:1,cb:a,stream:e,state:r},n.nextTick(ie,r.afterWriteTickInfo)):I(e,r,1,a))}function ie({stream:e,state:t,count:n,cb:r}){return t.afterWriteTickInfo=null,I(e,t,n,r)}function I(e,t,n,r){for(!t.ending&&!e.destroyed&&t.length===0&&t.needDrain&&(t.needDrain=!1,e.emit(`drain`));n-- >0;)t.pendingcb--,r();t.destroyed&&ae(t),le(e,t)}function ae(e){if(e.writing)return;for(let t=e.bufferedIndex;t<e.buffered.length;++t){let{chunk:n,callback:r}=e.buffered[t],i=e.objectMode?1:n.length;e.length-=i,r(e.errored??new w(`write`))}let t=e[O].splice(0);for(let n=0;n<t.length;n++)t[n](e.errored??new w(`end`));k(e)}function L(e,t){if(t.corked||t.bufferProcessing||t.destroyed||!t.constructed)return;let{buffered:n,bufferedIndex:r,objectMode:a}=t,o=n.length-r;if(!o)return;let s=r;if(t.bufferProcessing=!0,o>1&&e._writev){t.pendingcb-=o-1;let r=t.allNoop?D:e=>{for(let t=s;t<n.length;++t)n[t].callback(e)},a=t.allNoop&&s===0?n:i(n,s);a.allBuffers=t.allBuffers,N(e,t,!0,t.length,a,``,r),k(t)}else{do{let{chunk:r,encoding:i,callback:o}=n[s];n[s++]=null,N(e,t,!1,a?1:r.length,r,i,o)}while(s<n.length&&!t.writing);s===n.length?k(t):s>256?(n.splice(0,s),t.bufferedIndex=0):t.bufferedIndex=s}t.bufferProcessing=!1}A.prototype._write=function(e,t,n){if(this._writev)this._writev([{chunk:e,encoding:t}],n);else throw new x(`_write()`)},A.prototype._writev=null,A.prototype.end=function(e,t,r){let i=this._writableState;typeof e==`function`?(r=e,e=null,t=null):typeof t==`function`&&(r=t,t=null);let o;if(e!=null){let n=j(this,e,t);n instanceof a&&(o=n)}return i.corked&&(i.corked=1,this.uncork()),o||(!i.errored&&!i.ending?(i.ending=!0,le(this,i,!0),i.ended=!0):i.finished?o=new T(`end`):i.destroyed&&(o=new w(`end`))),typeof r==`function`&&(o||i.finished?n.nextTick(r,o):i[O].push(r)),this};function oe(e){return e.ending&&!e.destroyed&&e.constructed&&e.length===0&&!e.errored&&e.buffered.length===0&&!e.finished&&!e.writing&&!e.errorEmitted&&!e.closeEmitted}function se(e,t){let r=!1;function i(i){if(r){E(e,i??S());return}if(r=!0,t.pendingcb--,i){let n=t[O].splice(0);for(let e=0;e<n.length;e++)n[e](i);E(e,i,t.sync)}else oe(t)&&(t.prefinished=!0,e.emit(`prefinish`),t.pendingcb++,n.nextTick(R,e,t))}t.sync=!0,t.pendingcb++;try{e._final(i)}catch(e){i(e)}t.sync=!1}function ce(e,t){!t.prefinished&&!t.finalCalled&&(typeof e._final==`function`&&!t.destroyed?(t.finalCalled=!0,se(e,t)):(t.prefinished=!0,e.emit(`prefinish`)))}function le(e,t,r){oe(t)&&(ce(e,t),t.pendingcb===0&&(r?(t.pendingcb++,n.nextTick((e,t)=>{oe(t)?R(e,t):t.pendingcb--},e,t)):oe(t)&&(t.pendingcb++,R(e,t))))}function R(e,t){t.pendingcb--,t.finished=!0;let n=t[O].splice(0);for(let e=0;e<n.length;e++)n[e]();if(e.emit(`finish`),t.autoDestroy){let t=e._readableState;(!t||t.autoDestroy&&(t.endEmitted||t.readable===!1))&&e.destroy()}}c(A.prototype,{closed:{__proto__:null,get(){return this._writableState?this._writableState.closed:!1}},destroyed:{__proto__:null,get(){return this._writableState?this._writableState.destroyed:!1},set(e){this._writableState&&(this._writableState.destroyed=e)}},writable:{__proto__:null,get(){let e=this._writableState;return!!e&&e.writable!==!1&&!e.destroyed&&!e.errored&&!e.ending&&!e.ended},set(e){this._writableState&&(this._writableState.writable=!!e)}},writableFinished:{__proto__:null,get(){return this._writableState?this._writableState.finished:!1}},writableObjectMode:{__proto__:null,get(){return this._writableState?this._writableState.objectMode:!1}},writableBuffer:{__proto__:null,get(){return this._writableState&&this._writableState.getBuffer()}},writableEnded:{__proto__:null,get(){return this._writableState?this._writableState.ending:!1}},writableNeedDrain:{__proto__:null,get(){let e=this._writableState;return e?!e.destroyed&&!e.ending&&e.needDrain:!1}},writableHighWaterMark:{__proto__:null,get(){return this._writableState&&this._writableState.highWaterMark}},writableCorked:{__proto__:null,get(){return this._writableState?this._writableState.corked:0}},writableLength:{__proto__:null,get(){return this._writableState&&this._writableState.length}},errored:{__proto__:null,enumerable:!1,get(){return this._writableState?this._writableState.errored:null}},writableAborted:{__proto__:null,enumerable:!1,get:function(){return!!(this._writableState.writable!==!1&&(this._writableState.destroyed||this._writableState.errored)&&!this._writableState.finished)}}});let z=g.destroy;A.prototype.destroy=function(e,t){let r=this._writableState;return!r.destroyed&&(r.bufferedIndex<r.buffered.length||r[O].length)&&n.nextTick(ae,r),z.call(this,e,t),this},A.prototype._undestroy=g.undestroy,A.prototype._destroy=function(e,t){t(e)},A.prototype[p.captureRejectionSymbol]=function(e){this.destroy(e)};let ue;function de(){return ue===void 0&&(ue={}),ue}A.fromWeb=function(e,t){return de().newStreamWritableFromWritableStream(e,t)},A.toWeb=function(e){return de().newWritableStreamFromStreamWritable(e)}})),_a=n(((e,t)=>{let n=aa(),i=r(),{isReadable:a,isWritable:o,isIterable:s,isNodeStream:c,isReadableNodeStream:l,isWritableNodeStream:u,isDuplexNodeStream:d,isReadableStream:f,isWritableStream:p}=oa(),m=sa(),{AbortError:h,codes:{ERR_INVALID_ARG_TYPE:g,ERR_INVALID_RETURN_VALUE:_}}=ea(),{destroyer:v}=ca(),y=va(),b=ha(),x=ga(),{createDeferredPromise:S}=ra(),C=ma(),w=globalThis.Blob||i.Blob,T=w===void 0?function(e){return!1}:function(e){return e instanceof w},ee=globalThis.AbortController||ta().AbortController,{FunctionPrototypeCall:te}=Qi();var ne=class extends y{constructor(e){super(e),e?.readable===!1&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),e?.writable===!1&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)}};t.exports=function e(t,r){if(d(t))return t;if(l(t))return D({readable:t});if(u(t))return D({writable:t});if(c(t))return D({writable:!1,readable:!1});if(f(t))return D({readable:b.fromWeb(t)});if(p(t))return D({writable:x.fromWeb(t)});if(typeof t==`function`){let{value:e,write:i,final:a,destroy:o}=E(t);if(s(e))return C(ne,e,{objectMode:!0,write:i,final:a,destroy:o});let c=e?.then;if(typeof c==`function`){let t,r=te(c,e,e=>{if(e!=null)throw new _(`nully`,`body`,e)},e=>{v(t,e)});return t=new ne({objectMode:!0,readable:!1,write:i,final(e){a(async()=>{try{await r,n.nextTick(e,null)}catch(t){n.nextTick(e,t)}})},destroy:o})}throw new _(`Iterable, AsyncIterable or AsyncFunction`,r,e)}if(T(t))return e(t.arrayBuffer());if(s(t))return C(ne,t,{objectMode:!0,writable:!1});if(f(t?.readable)&&p(t?.writable))return ne.fromWeb(t);if(typeof t?.writable==`object`||typeof t?.readable==`object`)return D({readable:t!=null&&t.readable?l(t?.readable)?t?.readable:e(t.readable):void 0,writable:t!=null&&t.writable?u(t?.writable)?t?.writable:e(t.writable):void 0});let i=t?.then;if(typeof i==`function`){let e;return te(i,t,t=>{t!=null&&e.push(t),e.push(null)},t=>{v(e,t)}),e=new ne({objectMode:!0,writable:!1,read(){}})}throw new g(r,[`Blob`,`ReadableStream`,`WritableStream`,`Stream`,`Iterable`,`AsyncIterable`,`Function`,`{ readable, writable } pair`,`Promise`],t)};function E(e){let{promise:t,resolve:r}=S(),i=new ee,a=i.signal;return{value:e((async function*(){for(;;){let e=t;t=null;let{chunk:i,done:o,cb:s}=await e;if(n.nextTick(s),o)return;if(a.aborted)throw new h(void 0,{cause:a.reason});({promise:t,resolve:r}=S()),yield i}})(),{signal:a}),write(e,t,n){let i=r;r=null,i({chunk:e,done:!1,cb:n})},final(e){let t=r;r=null,t({done:!0,cb:e})},destroy(e,t){i.abort(),t(e)}}}function D(e){let t=e.readable&&typeof e.readable.read!=`function`?b.wrap(e.readable):e.readable,n=e.writable,r=!!a(t),i=!!o(n),s,c,l,u,d;function f(e){let t=u;u=null,t?t(e):e&&d.destroy(e)}return d=new ne({readableObjectMode:!!(t!=null&&t.readableObjectMode),writableObjectMode:!!(n!=null&&n.writableObjectMode),readable:r,writable:i}),i&&(m(n,e=>{i=!1,e&&v(t,e),f(e)}),d._write=function(e,t,r){n.write(e,t)?r():s=r},d._final=function(e){n.end(),c=e},n.on(`drain`,function(){if(s){let e=s;s=null,e()}}),n.on(`finish`,function(){if(c){let e=c;c=null,e()}})),r&&(m(t,e=>{r=!1,e&&v(t,e),f(e)}),t.on(`readable`,function(){if(l){let e=l;l=null,e()}}),t.on(`end`,function(){d.push(null)}),d._read=function(){for(;;){let e=t.read();if(e===null){l=d._read;return}if(!d.push(e))return}}),d._destroy=function(e,r){!e&&u!==null&&(e=new h),l=null,s=null,c=null,u===null?r(e):(u=r,v(n,e),v(t,e))},d}})),va=n(((e,t)=>{let{ObjectDefineProperties:n,ObjectGetOwnPropertyDescriptor:r,ObjectKeys:i,ObjectSetPrototypeOf:a}=Qi();t.exports=c;let o=ha(),s=ga();a(c.prototype,o.prototype),a(c,o);{let e=i(s.prototype);for(let t=0;t<e.length;t++){let n=e[t];c.prototype[n]||(c.prototype[n]=s.prototype[n])}}function c(e){if(!(this instanceof c))return new c(e);o.call(this,e),s.call(this,e),e?(this.allowHalfOpen=e.allowHalfOpen!==!1,e.readable===!1&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),e.writable===!1&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)):this.allowHalfOpen=!0}n(c.prototype,{writable:{__proto__:null,...r(s.prototype,`writable`)},writableHighWaterMark:{__proto__:null,...r(s.prototype,`writableHighWaterMark`)},writableObjectMode:{__proto__:null,...r(s.prototype,`writableObjectMode`)},writableBuffer:{__proto__:null,...r(s.prototype,`writableBuffer`)},writableLength:{__proto__:null,...r(s.prototype,`writableLength`)},writableFinished:{__proto__:null,...r(s.prototype,`writableFinished`)},writableCorked:{__proto__:null,...r(s.prototype,`writableCorked`)},writableEnded:{__proto__:null,...r(s.prototype,`writableEnded`)},writableNeedDrain:{__proto__:null,...r(s.prototype,`writableNeedDrain`)},destroyed:{__proto__:null,get(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set(e){this._readableState&&this._writableState&&(this._readableState.destroyed=e,this._writableState.destroyed=e)}}});let l;function u(){return l===void 0&&(l={}),l}c.fromWeb=function(e,t){return u().newStreamDuplexFromReadableWritablePair(e,t)},c.toWeb=function(e){return u().newReadableWritablePairFromDuplex(e)};let d;c.from=function(e){return d||=_a(),d(e,`body`)}})),ya=n(((e,t)=>{let{ObjectSetPrototypeOf:n,Symbol:r}=Qi();t.exports=c;let{ERR_METHOD_NOT_IMPLEMENTED:i}=ea().codes,a=va(),{getHighWaterMark:o}=fa();n(c.prototype,a.prototype),n(c,a);let s=r(`kCallback`);function c(e){if(!(this instanceof c))return new c(e);let t=e?o(this,e,`readableHighWaterMark`,!0):null;t===0&&(e={...e,highWaterMark:null,readableHighWaterMark:t,writableHighWaterMark:e.writableHighWaterMark||0}),a.call(this,e),this._readableState.sync=!1,this[s]=null,e&&(typeof e.transform==`function`&&(this._transform=e.transform),typeof e.flush==`function`&&(this._flush=e.flush)),this.on(`prefinish`,u)}function l(e){typeof this._flush==`function`&&!this.destroyed?this._flush((t,n)=>{if(t){e?e(t):this.destroy(t);return}n!=null&&this.push(n),this.push(null),e&&e()}):(this.push(null),e&&e())}function u(){this._final!==l&&l.call(this)}c.prototype._final=l,c.prototype._transform=function(e,t,n){throw new i(`_transform()`)},c.prototype._write=function(e,t,n){let r=this._readableState,i=this._writableState,a=r.length;this._transform(e,t,(e,t)=>{if(e){n(e);return}t!=null&&this.push(t),i.ended||a===r.length||r.length<r.highWaterMark?n():this[s]=n})},c.prototype._read=function(){if(this[s]){let e=this[s];this[s]=null,e()}}})),ba=n(((e,t)=>{let{ObjectSetPrototypeOf:n}=Qi();t.exports=i;let r=ya();n(i.prototype,r.prototype),n(i,r);function i(e){if(!(this instanceof i))return new i(e);r.call(this,e)}i.prototype._transform=function(e,t,n){n(null,e)}})),xa=n(((e,t)=>{let n=aa(),{ArrayIsArray:r,Promise:i,SymbolAsyncIterator:a,SymbolDispose:o}=Qi(),s=sa(),{once:c}=ra(),l=ca(),u=va(),{aggregateTwoErrors:d,codes:{ERR_INVALID_ARG_TYPE:f,ERR_INVALID_RETURN_VALUE:p,ERR_MISSING_ARGS:m,ERR_STREAM_DESTROYED:h,ERR_STREAM_PREMATURE_CLOSE:g},AbortError:_}=ea(),{validateFunction:v,validateAbortSignal:y}=ia(),{isIterable:b,isReadable:x,isReadableNodeStream:S,isNodeStream:C,isTransformStream:w,isWebStream:T,isReadableStream:ee,isReadableFinished:te}=oa(),ne=globalThis.AbortController||ta().AbortController,E,D,O;function re(e,t,n){let r=!1;return e.on(`close`,()=>{r=!0}),{destroy:t=>{r||(r=!0,l.destroyer(e,t||new h(`pipe`)))},cleanup:s(e,{readable:t,writable:n},e=>{r=!e})}}function k(e){return v(e[e.length-1],`streams[stream.length - 1]`),e.pop()}function A(e){if(b(e))return e;if(S(e))return j(e);throw new f(`val`,[`Readable`,`Iterable`,`AsyncIterable`],e)}async function*j(e){D||=ha(),yield*D.prototype[a].call(e)}async function M(e,t,n,{end:r}){let a,o=null,c=e=>{if(e&&(a=e),o){let e=o;o=null,e()}},l=()=>new i((e,t)=>{a?t(a):o=()=>{a?t(a):e()}});t.on(`drain`,c);let u=s(t,{readable:!1},c);try{t.writableNeedDrain&&await l();for await(let n of e)t.write(n)||await l();r&&(t.end(),await l()),n()}catch(e){n(a===e?e:d(a,e))}finally{u(),t.off(`drain`,c)}}async function N(e,t,n,{end:r}){w(t)&&(t=t.writable);let i=t.getWriter();try{for await(let t of e)await i.ready,i.write(t).catch(()=>{});await i.ready,r&&await i.close(),n()}catch(e){try{await i.abort(e),n(e)}catch(e){n(e)}}}function P(...e){return F(e,c(k(e)))}function F(e,t,i){if(e.length===1&&r(e[0])&&(e=e[0]),e.length<2)throw new m(`streams`);let a=new ne,s=a.signal,c=i?.signal,l=[];y(c,`options.signal`);function d(){j(new _)}O||=ra().addAbortListener;let h;c&&(h=O(c,d));let g,v,te=[],D=0;function k(e){j(e,--D===0)}function j(e,r){var i;if(e&&(!g||g.code===`ERR_STREAM_PREMATURE_CLOSE`)&&(g=e),!(!g&&!r)){for(;te.length;)te.shift()(g);(i=h)==null||i[o](),a.abort(),r&&(g||l.forEach(e=>e()),n.nextTick(t,g,v))}}let P;for(let t=0;t<e.length;t++){let r=e[t],a=t<e.length-1,o=t>0,c=a||i?.end!==!1,d=t===e.length-1;if(C(r)){if(c){let{destroy:e,cleanup:t}=re(r,a,o);te.push(e),x(r)&&d&&l.push(t)}function e(e){e&&e.name!==`AbortError`&&e.code!==`ERR_STREAM_PREMATURE_CLOSE`&&k(e)}r.on(`error`,e),x(r)&&d&&l.push(()=>{r.removeListener(`error`,e)})}if(t===0)if(typeof r==`function`){if(P=r({signal:s}),!b(P))throw new p(`Iterable, AsyncIterable or Stream`,`source`,P)}else P=b(r)||S(r)||w(r)?r:u.from(r);else if(typeof r==`function`)if(P=w(P)?A(P?.readable):A(P),P=r(P,{signal:s}),a){if(!b(P,!0))throw new p(`AsyncIterable`,`transform[${t-1}]`,P)}else{E||=ba();let e=new E({objectMode:!0}),t=P?.then;if(typeof t==`function`)D++,t.call(P,t=>{v=t,t!=null&&e.write(t),c&&e.end(),n.nextTick(k)},t=>{e.destroy(t),n.nextTick(k,t)});else if(b(P,!0))D++,M(P,e,k,{end:c});else if(ee(P)||w(P)){let t=P.readable||P;D++,M(t,e,k,{end:c})}else throw new p(`AsyncIterable or Promise`,`destination`,P);P=e;let{destroy:r,cleanup:i}=re(P,!1,!0);te.push(r),d&&l.push(i)}else if(C(r)){if(S(P)){D+=2;let e=ie(P,r,k,{end:c});x(r)&&d&&l.push(e)}else if(w(P)||ee(P)){let e=P.readable||P;D++,M(e,r,k,{end:c})}else if(b(P))D++,M(P,r,k,{end:c});else throw new f(`val`,[`Readable`,`Iterable`,`AsyncIterable`,`ReadableStream`,`TransformStream`],P);P=r}else if(T(r)){if(S(P))D++,N(A(P),r,k,{end:c});else if(ee(P)||b(P))D++,N(P,r,k,{end:c});else if(w(P))D++,N(P.readable,r,k,{end:c});else throw new f(`val`,[`Readable`,`Iterable`,`AsyncIterable`,`ReadableStream`,`TransformStream`],P);P=r}else P=u.from(r)}return(s!=null&&s.aborted||c!=null&&c.aborted)&&n.nextTick(d),P}function ie(e,t,r,{end:i}){let a=!1;if(t.on(`close`,()=>{a||r(new g)}),e.pipe(t,{end:!1}),i){function r(){a=!0,t.end()}te(e)?n.nextTick(r):e.once(`end`,r)}else r();return s(e,{readable:!0,writable:!1},t=>{let n=e._readableState;t&&t.code===`ERR_STREAM_PREMATURE_CLOSE`&&n&&n.ended&&!n.errored&&!n.errorEmitted?e.once(`end`,r).once(`error`,r):r(t)}),s(t,{readable:!1,writable:!0},r)}t.exports={pipelineImpl:F,pipeline:P}})),Sa=n(((e,t)=>{let{pipeline:n}=xa(),r=va(),{destroyer:i}=ca(),{isNodeStream:a,isReadable:o,isWritable:s,isWebStream:c,isTransformStream:l,isWritableStream:u,isReadableStream:d}=oa(),{AbortError:f,codes:{ERR_INVALID_ARG_VALUE:p,ERR_MISSING_ARGS:m}}=ea(),h=sa();t.exports=function(...e){if(e.length===0)throw new m(`streams`);if(e.length===1)return r.from(e[0]);let t=[...e];if(typeof e[0]==`function`&&(e[0]=r.from(e[0])),typeof e[e.length-1]==`function`){let t=e.length-1;e[t]=r.from(e[t])}for(let n=0;n<e.length;++n)if(!(!a(e[n])&&!c(e[n]))){if(n<e.length-1&&!(o(e[n])||d(e[n])||l(e[n])))throw new p(`streams[${n}]`,t[n],`must be readable`);if(n>0&&!(s(e[n])||u(e[n])||l(e[n])))throw new p(`streams[${n}]`,t[n],`must be writable`)}let g,_,v,y,b;function x(e){let t=y;y=null,t?t(e):e?b.destroy(e):!T&&!w&&b.destroy()}let S=e[0],C=n(e,x),w=!!(s(S)||u(S)||l(S)),T=!!(o(C)||d(C)||l(C));if(b=new r({writableObjectMode:!!(S!=null&&S.writableObjectMode),readableObjectMode:!!(C!=null&&C.readableObjectMode),writable:w,readable:T}),w){if(a(S))b._write=function(e,t,n){S.write(e,t)?n():g=n},b._final=function(e){S.end(),_=e},S.on(`drain`,function(){if(g){let e=g;g=null,e()}});else if(c(S)){let e=(l(S)?S.writable:S).getWriter();b._write=async function(t,n,r){try{await e.ready,e.write(t).catch(()=>{}),r()}catch(e){r(e)}},b._final=async function(t){try{await e.ready,e.close().catch(()=>{}),_=t}catch(e){t(e)}}}h(l(C)?C.readable:C,()=>{if(_){let e=_;_=null,e()}})}if(T){if(a(C))C.on(`readable`,function(){if(v){let e=v;v=null,e()}}),C.on(`end`,function(){b.push(null)}),b._read=function(){for(;;){let e=C.read();if(e===null){v=b._read;return}if(!b.push(e))return}};else if(c(C)){let e=(l(C)?C.readable:C).getReader();b._read=async function(){for(;;)try{let{value:t,done:n}=await e.read();if(!b.push(t))return;if(n){b.push(null);return}}catch{return}}}}return b._destroy=function(e,t){!e&&y!==null&&(e=new f),v=null,g=null,_=null,y===null?t(e):(y=t,a(C)&&i(C,e))},b}})),Ca=n(((e,t)=>{let n=globalThis.AbortController||ta().AbortController,{codes:{ERR_INVALID_ARG_VALUE:r,ERR_INVALID_ARG_TYPE:i,ERR_MISSING_ARGS:a,ERR_OUT_OF_RANGE:o},AbortError:s}=ea(),{validateAbortSignal:c,validateInteger:l,validateObject:u}=ia(),d=Qi().Symbol(`kWeak`),f=Qi().Symbol(`kResistStopPropagation`),{finished:p}=sa(),m=Sa(),{addAbortSignalNoValidate:h}=ua(),{isWritable:g,isNodeStream:_}=oa(),{deprecate:v}=ra(),{ArrayPrototypePush:y,Boolean:b,MathFloor:x,Number:S,NumberIsNaN:C,Promise:w,PromiseReject:T,PromiseResolve:ee,PromisePrototypeThen:te,Symbol:ne}=Qi(),E=ne(`kEmpty`),D=ne(`kEof`);function O(e,t){if(t!=null&&u(t,`options`),t?.signal!=null&&c(t.signal,`options.signal`),_(e)&&!g(e))throw new r(`stream`,e,`must be writable`);let n=m(this,e);return t!=null&&t.signal&&h(t.signal,n),n}function re(e,t){if(typeof e!=`function`)throw new i(`fn`,[`Function`,`AsyncFunction`],e);t!=null&&u(t,`options`),t?.signal!=null&&c(t.signal,`options.signal`);let n=1;t?.concurrency!=null&&(n=x(t.concurrency));let r=n-1;return t?.highWaterMark!=null&&(r=x(t.highWaterMark)),l(n,`options.concurrency`,1),l(r,`options.highWaterMark`,0),r+=n,async function*(){let i=ra().AbortSignalAny([t?.signal].filter(b)),a=this,o=[],c={signal:i},l,u,d=!1,f=0;function p(){d=!0,m()}function m(){--f,h()}function h(){u&&!d&&f<n&&o.length<r&&(u(),u=null)}async function g(){try{for await(let t of a){if(d)return;if(i.aborted)throw new s;try{if(t=e(t,c),t===E)continue;t=ee(t)}catch(e){t=T(e)}f+=1,te(t,m,p),o.push(t),l&&=(l(),null),!d&&(o.length>=r||f>=n)&&await new w(e=>{u=e})}o.push(D)}catch(e){let t=T(e);te(t,m,p),o.push(t)}finally{d=!0,l&&=(l(),null)}}g();try{for(;;){for(;o.length>0;){let e=await o[0];if(e===D)return;if(i.aborted)throw new s;e!==E&&(yield e),o.shift(),h()}await new w(e=>{l=e})}}finally{d=!0,u&&=(u(),null)}}.call(this)}function k(e=void 0){return e!=null&&u(e,`options`),e?.signal!=null&&c(e.signal,`options.signal`),async function*(){let t=0;for await(let r of this){var n;if(e!=null&&(n=e.signal)!=null&&n.aborted)throw new s({cause:e.signal.reason});yield[t++,r]}}.call(this)}async function A(e,t=void 0){for await(let n of P.call(this,e,t))return!0;return!1}async function j(e,t=void 0){if(typeof e!=`function`)throw new i(`fn`,[`Function`,`AsyncFunction`],e);return!await A.call(this,async(...t)=>!await e(...t),t)}async function M(e,t){for await(let n of P.call(this,e,t))return n}async function N(e,t){if(typeof e!=`function`)throw new i(`fn`,[`Function`,`AsyncFunction`],e);async function n(t,n){return await e(t,n),E}for await(let e of re.call(this,n,t));}function P(e,t){if(typeof e!=`function`)throw new i(`fn`,[`Function`,`AsyncFunction`],e);async function n(t,n){return await e(t,n)?t:E}return re.call(this,n,t)}var F=class extends a{constructor(){super(`reduce`),this.message=`Reduce of an empty stream requires an initial value`}};async function ie(e,t,r){var a;if(typeof e!=`function`)throw new i(`reducer`,[`Function`,`AsyncFunction`],e);r!=null&&u(r,`options`),r?.signal!=null&&c(r.signal,`options.signal`);let o=arguments.length>1;if(r!=null&&(a=r.signal)!=null&&a.aborted){let e=new s(void 0,{cause:r.signal.reason});throw this.once(`error`,()=>{}),await p(this.destroy(e)),e}let l=new n,m=l.signal;if(r!=null&&r.signal){let e={once:!0,[d]:this,[f]:!0};r.signal.addEventListener(`abort`,()=>l.abort(),e)}let h=!1;try{for await(let n of this){var g;if(h=!0,r!=null&&(g=r.signal)!=null&&g.aborted)throw new s;o?t=await e(t,n,{signal:m}):(t=n,o=!0)}if(!h&&!o)throw new F}finally{l.abort()}return t}async function I(e){e!=null&&u(e,`options`),e?.signal!=null&&c(e.signal,`options.signal`);let t=[];for await(let r of this){var n;if(e!=null&&(n=e.signal)!=null&&n.aborted)throw new s(void 0,{cause:e.signal.reason});y(t,r)}return t}function ae(e,t){let n=re.call(this,e,t);return async function*(){for await(let e of n)yield*e}.call(this)}function L(e){if(e=S(e),C(e))return 0;if(e<0)throw new o(`number`,`>= 0`,e);return e}function oe(e,t=void 0){return t!=null&&u(t,`options`),t?.signal!=null&&c(t.signal,`options.signal`),e=L(e),async function*(){var n;if(t!=null&&(n=t.signal)!=null&&n.aborted)throw new s;for await(let n of this){var r;if(t!=null&&(r=t.signal)!=null&&r.aborted)throw new s;e--<=0&&(yield n)}}.call(this)}function se(e,t=void 0){return t!=null&&u(t,`options`),t?.signal!=null&&c(t.signal,`options.signal`),e=L(e),async function*(){var n;if(t!=null&&(n=t.signal)!=null&&n.aborted)throw new s;for await(let n of this){var r;if(t!=null&&(r=t.signal)!=null&&r.aborted)throw new s;if(e-- >0&&(yield n),e<=0)return}}.call(this)}t.exports.streamReturningOperators={asIndexedPairs:v(k,`readable.asIndexedPairs will be removed in a future version.`),drop:oe,filter:P,flatMap:ae,map:re,take:se,compose:O},t.exports.promiseReturningOperators={every:j,forEach:N,reduce:ie,toArray:I,some:A,find:M}})),wa=n(((e,t)=>{let{ArrayPrototypePop:n,Promise:r}=Qi(),{isIterable:i,isNodeStream:a,isWebStream:o}=oa(),{pipelineImpl:s}=xa(),{finished:c}=sa();Ta();function l(...e){return new r((t,r)=>{let c,l,u=e[e.length-1];if(u&&typeof u==`object`&&!a(u)&&!i(u)&&!o(u)){let t=n(e);c=t.signal,l=t.end}s(e,(e,n)=>{e?r(e):t(n)},{signal:c,end:l})})}t.exports={finished:c,pipeline:l}})),Ta=n(((e,t)=>{let{Buffer:n}=r(),{ObjectDefineProperty:i,ObjectKeys:a,ReflectApply:o}=Qi(),{promisify:{custom:s}}=ra(),{streamReturningOperators:c,promiseReturningOperators:l}=Ca(),{codes:{ERR_ILLEGAL_CONSTRUCTOR:u}}=ea(),d=Sa(),{setDefaultHighWaterMark:f,getDefaultHighWaterMark:p}=fa(),{pipeline:m}=xa(),{destroyer:h}=ca(),g=sa(),_=wa(),v=oa(),y=t.exports=la().Stream;y.isDestroyed=v.isDestroyed,y.isDisturbed=v.isDisturbed,y.isErrored=v.isErrored,y.isReadable=v.isReadable,y.isWritable=v.isWritable,y.Readable=ha();for(let e of a(c)){let t=c[e];function n(...e){if(new.target)throw u();return y.Readable.from(o(t,this,e))}i(n,`name`,{__proto__:null,value:t.name}),i(n,`length`,{__proto__:null,value:t.length}),i(y.Readable.prototype,e,{__proto__:null,value:n,enumerable:!1,configurable:!0,writable:!0})}for(let e of a(l)){let t=l[e];function n(...e){if(new.target)throw u();return o(t,this,e)}i(n,`name`,{__proto__:null,value:t.name}),i(n,`length`,{__proto__:null,value:t.length}),i(y.Readable.prototype,e,{__proto__:null,value:n,enumerable:!1,configurable:!0,writable:!0})}y.Writable=ga(),y.Duplex=va(),y.Transform=ya(),y.PassThrough=ba(),y.pipeline=m;let{addAbortSignal:b}=ua();y.addAbortSignal=b,y.finished=g,y.destroy=h,y.compose=d,y.setDefaultHighWaterMark=f,y.getDefaultHighWaterMark=p,i(y,`promises`,{__proto__:null,configurable:!0,enumerable:!0,get(){return _}}),i(m,s,{__proto__:null,enumerable:!0,get(){return _.pipeline}}),i(g,s,{__proto__:null,enumerable:!0,get(){return _.finished}}),y.Stream=y,y._isUint8Array=function(e){return e instanceof Uint8Array},y._uint8ArrayToBuffer=function(e){return n.from(e.buffer,e.byteOffset,e.byteLength)}})),Ea=n(((e,t)=>{let n=Ta(),r=wa(),i=n.Readable.destroy;t.exports=n.Readable,t.exports._uint8ArrayToBuffer=n._uint8ArrayToBuffer,t.exports._isUint8Array=n._isUint8Array,t.exports.isDisturbed=n.isDisturbed,t.exports.isErrored=n.isErrored,t.exports.isReadable=n.isReadable,t.exports.Readable=n.Readable,t.exports.Writable=n.Writable,t.exports.Duplex=n.Duplex,t.exports.Transform=n.Transform,t.exports.PassThrough=n.PassThrough,t.exports.addAbortSignal=n.addAbortSignal,t.exports.finished=n.finished,t.exports.destroy=n.destroy,t.exports.destroy=i,t.exports.pipeline=n.pipeline,t.exports.compose=n.compose,Object.defineProperty(n,"promises",{configurable:!0,enumerable:!0,get(){return r}}),t.exports.Stream=n.Stream,t.exports.default=t.exports}))(),Da=class extends Ea.Readable{pending=!0;_path=`<unknown>`;_bytesRead=0;reader;ready;constructor(e={},t){super({...e,encoding:e.encoding??void 0}),this.ready=Promise.resolve(t).then(t=>{this._path=t.vfs.path;let n=t.readableWebStream({start:e.start,end:e.end});this.reader=n.getReader(),this.pending=!1}).catch(e=>{this.destroy(e)})}async _read(){try{if(await this.ready,!this.reader)return;let{done:e,value:t}=await this.reader.read();if(e){this.push(null);return}this._bytesRead+=t.byteLength,this.push(t)}catch(e){this.destroy(new A(O.EIO,e.toString()))}}close(e=()=>null){try{this.destroy(),this.emit(`close`),e(null)}catch(t){e(new A(O.EIO,t.toString()))}}get path(){return this._path}get bytesRead(){return this._bytesRead}wrap(e){return super.wrap(e),this}},Oa=class extends Ea.Writable{pending=!0;_path=`<unknown>`;_bytesWritten=0;writer;ready;constructor(e={},t){super(e),this.ready=Promise.resolve(t).then(t=>{this._path=t.vfs.path;let n=t.writableWebStream({start:e.start});this.writer=n.getWriter(),this.pending=!1}).catch(e=>this.destroy(e))}async _write(e,t,n){if(await this.ready,!this.writer)return n(z(j(`EAGAIN`,`write`,this._path)));if(t!=`buffer`)return n(z(j(`ENOTSUP`,`write`,this._path)));let r=new Uint8Array(e.buffer,e.byteOffset,e.byteLength);try{await this.writer.write(r),this._bytesWritten+=e.byteLength,n()}catch(e){n(new A(O.EIO,e.toString()))}}async _final(e){if(await this.ready,!this.writer)return e();try{await this.writer.close(),e()}catch(t){e(new A(O.EIO,t.toString()))}}close(e=()=>null){try{this.destroy(),this.emit(`close`),e(null)}catch(t){e(new A(O.EIO,t.toString()))}}get path(){return this._path}get bytesWritten(){return this._bytesWritten}},ka=t({FileHandle:()=>Ma,access:()=>ro,appendFile:()=>Ha,chmod:()=>Za,chown:()=>Ya,constants:()=>ze,copyFile:()=>so,cp:()=>lo,exists:()=>Pa,glob:()=>fo,lchmod:()=>Qa,lchown:()=>Xa,link:()=>Ka,lstat:()=>Ia,lutimes:()=>eo,mkdir:()=>Wa,mkdtemp:()=>ao,mkdtempDisposable:()=>oo,open:()=>za,opendir:()=>co,readFile:()=>Ba,readdir:()=>Ga,readlink:()=>Ja,realpath:()=>to,rename:()=>Na,rm:()=>io,rmdir:()=>Ua,stat:()=>Fa,statfs:()=>uo,symlink:()=>qa,truncate:()=>La,unlink:()=>Ra,utimes:()=>$a,watch:()=>no,writeFile:()=>Va}),Aa=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},ja=(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}),Ma=class{context;fd;vfs;constructor(e,t){this.context=e,this.fd=t,this.vfs=pr(e,t)}_emitChange(){zi(this.context,`change`,this.vfs.path)}async chown(e,t){await this.vfs.chown(e,t),this._emitChange()}async chmod(e){let t=Xt(e,-1);if(t<0)throw j(`EINVAL`,`chmod`,this.vfs.path);await this.vfs.chmod(t),this._emitChange()}datasync(){return this.sync()}async sync(){await this.vfs.sync()}async truncate(e=0){await this.vfs.truncate(e),this._emitChange()}async utimes(e,t){e=Zt(e),t=Zt(t),await this.vfs.utimes(e,t),this._emitChange()}async appendFile(e,t={}){let n=Qt(t,`utf8`,`a`,420);if(!(gr(n.flag)&1024))throw j(`EBADF`,`write`,this.vfs.path);let r=typeof e==`string`?ar.Buffer.from(e,n.encoding):e;await this.vfs.write(r,0,r.length),this._emitChange()}async read(e,t,n,r){if(typeof t==`object`&&t&&(r=t.position,n=t.length,t=t.offset),!ArrayBuffer.isView(e)&&typeof e==`object`&&(r=e.position,n=e.length,t=e.offset,e=e.buffer),r&&r>2**53-1)throw j(`EINVAL`);return typeof r==`bigint`&&(r=Number(r)),r=Number.isSafeInteger(r)?r:this.vfs.position,e||=new Uint8Array(this.vfs.inode.size),t??=0,{bytesRead:await this.vfs.read(e,t,n??e.byteLength-t,r),buffer:e}}async readFile(e){let t=Qt(e,null,`r`,292);if(gr(t.flag)&1)throw j(`EBADF`,`read`,this.vfs.path);let{size:n}=await this.stat(),r=new Uint8Array(n);await this.vfs.read(r,0,n,0);let i=ar.Buffer.from(r);return t.encoding?i.toString(t.encoding):i}readableWebStream(e={}){if(this.vfs.isClosed)throw j(`EBADF`,`readableWebStream`,this.vfs.path);return this.vfs.fs.streamRead(this.vfs.internalPath,e)}writableWebStream(e={}){if(this.vfs.isClosed)throw j(`EBADF`,`writableWebStream`,this.vfs.path);if(this.vfs.inode.flags&On.Immutable)throw j(`EPERM`,`writableWebStream`,this.vfs.path);return this.vfs.fs.streamWrite(this.vfs.internalPath,e)}readLines(e){if(this.vfs.isClosed||this.vfs.flag&1)throw j(`EBADF`,`read`,this.vfs.path);return Yi({input:this.createReadStream(e),crlfDelay:1/0})}[Symbol.asyncDispose](){return this.close()}async stat(e){if(this.vfs.isClosed)throw j(`EBADF`,`stat`,this.vfs.path);if(J&&!q(this.context,this.vfs.inode,4))throw j(`EACCES`,`stat`,this.vfs.path);return e?.bigint?new yn(this.vfs.inode):new vn(this.vfs.inode)}async write(e,t,n,r){let i,a,o;typeof t==`object`&&t&&(n=t.length,r=t.position,t=t.offset),typeof e==`string`?(r=typeof t==`number`?t:null,a=0,i=ar.Buffer.from(e,typeof n==`string`?n:`utf8`),o=i.length):(i=new Uint8Array(e.buffer,e.byteOffset,e.byteLength),a=t??0,o=typeof n==`number`?n:i.byteLength,r=typeof r==`number`?r:null),r??=this.vfs.position;let s=await this.vfs.write(i,a,o,r);return this._emitChange(),{buffer:e,bytesWritten:s}}async writeFile(e,t={}){let n=Qt(t,`utf8`,`w`,420),r=gr(n.flag);if(!(r&1||r&2))throw j(`EBADF`,`writeFile`,this.vfs.path);let i=typeof e==`string`?ar.Buffer.from(e,n.encoding):e;await this.vfs.write(i,0,i.length,0),this._emitChange()}async close(){await this.vfs.close(),mr(this.context,this.fd)}async writev(e,t){typeof t==`number`&&(this.vfs.position=t);let n=0;for(let t of e)n+=(await this.write(t)).bytesWritten;return{bytesWritten:n,buffers:e}}async readv(e,t){typeof t==`number`&&(this.vfs.position=t);let n=0;for(let t of e)n+=(await this.read(t)).bytesRead;return{bytesRead:n,buffers:e}}createReadStream(e={}){if(this.vfs.isClosed||this.vfs.flag&1)throw j(`EBADF`,`createReadStream`,this.vfs.path);return new Da(e,this)}createWriteStream(e={}){if(this.vfs.isClosed)throw j(`EBADF`,`createWriteStream`,this.vfs.path);if(this.vfs.inode.flags&On.Immutable)throw j(`EPERM`,`createWriteStream`,this.vfs.path);if(this.vfs.fs.attributes.has(`readonly`))throw j(`EROFS`,`createWriteStream`,this.vfs.path);return new Oa(e,this)}};async function Na(e,t){await Gi.call(this,e,t)}async function Pa(e){e=H(e);try{let{fs:t,path:n}=await Bi(this,e);return await t.exists(n)}catch(e){if(e instanceof A&&e.code==`ENOENT`)return!1;throw e}}async function Fa(e,t){let n=await qi.call(this,e,!1);return t?.bigint?new yn(n):new vn(n)}async function Ia(e,t){let n=await qi.call(this,e,!0);return t?.bigint?new yn(n):new vn(n)}async function La(e,t=0){let n={stack:[],error:void 0,hasError:!1};try{await Aa(n,await za.call(this,e,`r+`),!0).truncate(t)}catch(e){n.error=e,n.hasError=!0}finally{let e=ja(n);e&&await e}}async function Ra(e){e=H(e);let{fs:t,path:n}=Y(e,this),r={syscall:`unlink`,path:e},i=await t.stat(n).catch(N(r));if(J&&!q(this,i,2))throw j(`EACCES`,r);await t.unlink(n).catch(N(r)),zi(this,`rename`,e.toString())}async function za(e,t=`r`,n=420){let r=await Vi(this,e,{flag:t,mode:n});return new Ma(this,fr(r))}async function Ba(e,t){let n={stack:[],error:void 0,hasError:!1};try{let r=Qt(t,null,`r`,292);return await Aa(n,typeof e==`object`&&`fd`in e?e:await za.call(this,e,r.flag,r.mode),!0).readFile(r)}catch(e){n.error=e,n.hasError=!0}finally{let e=ja(n);e&&await e}}async function Va(e,t,n){let r={stack:[],error:void 0,hasError:!1};try{let i=Qt(n,`utf8`,`w+`,420),a=Aa(r,e instanceof Ma?e:await za.call(this,e.toString(),i.flag,i.mode),!0),o=typeof t==`string`?t:t instanceof DataView?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):t;if(typeof o!=`string`&&!(o instanceof Uint8Array))throw TypeError(`The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView. Received `+typeof t);await a.writeFile(o,i)}catch(e){r.error=e,r.hasError=!0}finally{let e=ja(r);e&&await e}}async function Ha(e,t,n){let r={stack:[],error:void 0,hasError:!1};try{let i=Qt(n,`utf8`,`a`,420),a=gr(i.flag),o={syscall:`write`,path:e instanceof Ma?e.vfs.path:e.toString()};if(!(a&1024))throw j(`EBADF`,o);let s=typeof t==`string`?ar.Buffer.from(t,i.encoding):new Uint8Array(t.buffer,t.byteOffset,t.byteLength);await Aa(r,typeof e==`object`&&`fd`in e?e:await za.call(this,e,i.flag,i.mode),!0).appendFile(s,i)}catch(e){r.error=e,r.hasError=!0}finally{let e=ja(r);e&&await e}}async function Ua(e){e=H(e);let{fs:t,path:n}=await Bi(this,e),r={syscall:`rmdir`,path:e},i=await t.stat(n).catch(N(r));if(!i)throw j(`ENOENT`,r);if(!An(i))throw j(`ENOTDIR`,r);if(J&&!q(this,i,2))throw j(`EACCES`,r);await t.rmdir(n).catch(N(r)),zi(this,`rename`,e.toString())}async function Wa(e,t){t=typeof t==`object`?t:{mode:t};let n=Xt(t?.mode,511);return await Ui.call(this,e,{...t,mode:n})}async function Ga(e,t){e=H(e);let n=typeof t==`object`&&t?t:{encoding:t,withFileTypes:!1,recursive:!1},r=await Wi.call(this,e,n),i=[];for(let e of r)n.withFileTypes?i.push(Rr.from(e,n.encoding)):n.encoding==`buffer`?i.push(ar.Buffer.from(e.path)):i.push(e.path);return i}async function Ka(e,t){return await Ki.call(this,e,t)}async function qa(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);if(t=H(t),await Pa.call(this,t))throw j(`EEXIST`,`symlink`,t);let i=Aa(r,await Vi(this,t,{flag:`w+`,mode:420,preserveSymlinks:!0}),!0),a=w(H(e,!0));await i.write(a,0,a.length,0),await i.chmod(Ze)}catch(e){r.error=e,r.hasError=!0}finally{let e=ja(r);e&&await e}}async function Ja(e,t){e=H(e);let n=ar.Buffer.from(await Hi.call(this,e),`utf-8`),r=typeof t==`object`?t?.encoding:t;return r==`buffer`?n:n.toString(r??`utf-8`)}async function Ya(e,t,n){let r={stack:[],error:void 0,hasError:!1};try{await Aa(r,await za.call(this,e,`r+`),!0).chown(t,n)}catch(e){r.error=e,r.hasError=!0}finally{let e=ja(r);e&&await e}}async function Xa(e,t,n){let r={stack:[],error:void 0,hasError:!1};try{await Aa(r,await Vi(this,e,{flag:`r+`,mode:420,preserveSymlinks:!0,allowDirectory:!0}),!0).chown(t,n)}catch(e){r.error=e,r.hasError=!0}finally{let e=ja(r);e&&await e}}async function Za(e,t){let n={stack:[],error:void 0,hasError:!1};try{await Aa(n,await za.call(this,e,`r+`),!0).chmod(t)}catch(e){n.error=e,n.hasError=!0}finally{let e=ja(n);e&&await e}}async function Qa(e,t){let n={stack:[],error:void 0,hasError:!1};try{t=Xt(t),await Aa(n,await Vi(this,e,{flag:`r+`,mode:420,preserveSymlinks:!0,allowDirectory:!0}),!0).chmod(t)}catch(e){n.error=e,n.hasError=!0}finally{let e=ja(n);e&&await e}}async function $a(e,t,n){let r={stack:[],error:void 0,hasError:!1};try{await Aa(r,await Vi(this,e,{flag:`r+`,allowDirectory:!0}),!0).utimes(Zt(t),Zt(n))}catch(e){r.error=e,r.hasError=!0}finally{let e=ja(r);e&&await e}}async function eo(e,t,n){let r={stack:[],error:void 0,hasError:!1};try{await Aa(r,await Vi(this,e,{flag:`r+`,mode:420,preserveSymlinks:!0,allowDirectory:!0}),!0).utimes(Zt(t),Zt(n))}catch(e){r.error=e,r.hasError=!0}finally{let e=ja(r);e&&await e}}async function to(e,t){let n=typeof t==`string`?t:t?.encoding??`utf8`;e=H(e);let{fullPath:r}=await Bi(this,e);if(n==`utf8`||n==`utf-8`)return r;let i=ar.Buffer.from(r,`utf-8`);return n==`buffer`?i:i.toString(n)}function no(e,t={}){let n=new Pi(this,e.toString(),typeof t==`string`?{encoding:t}:t),r=[],i=!1;n.on(`change`,(e,t)=>{r.shift()?.({value:{eventType:e,filename:t},done:!1})});function a(){i=!0,n.close();for(let e of r)e({value:null,done:i});return r.length=0,Promise.resolve({value:void 0,done:!0})}return{async next(){if(i)return Promise.resolve({value:void 0,done:i});let{promise:e,resolve:t}=Promise.withResolvers();return r.push(t),e},return:a,throw:a,async[Symbol.asyncDispose](){await a()},[Symbol.asyncIterator](){return this}}}async function ro(e,t=0){if(J&&!(await Fa.call(this,e)).hasAccess(t,this))throw j(`EACCES`,`access`,e.toString())}async function io(e,t){e=H(e);let n=await Ia.call(this,e).catch(e=>{if(!(e.code==`ENOENT`&&t?.force))throw e});if(n)switch(n.mode&Ye){case et:if(t?.recursive)for(let n of await Ga.call(this,e))await io.call(this,U(e,n),t);await Ua.call(this,e);break;case Qe:case Ze:case $e:case tt:await Ra.call(this,e);break;case nt:case Xe:default:throw j(`ENOSYS`,`rm`,e)}}async function ao(e,t){let n=typeof t==`object`?t?.encoding:t||`utf8`,r=tn(e);return await Wa.call(this,r),n==`buffer`?ar.Buffer.from(r):r}async function oo(e,t){let n=tn(e);await Wa.call(this,n);let r=()=>io(n,{recursive:!0,force:!0});return{path:n,remove:r,[Symbol.asyncDispose]:r}}async function so(e,t,n){if(e=H(e),t=H(t),n&&n&1&&await Pa.call(this,t))throw j(`EEXIST`,`copyFile`,t);await Va.call(this,t,await Ba.call(this,e)),zi(this,`rename`,t.toString())}function co(e,t){return e=H(e),Promise.resolve(new zr(e,this))}async function lo(e,t,n){e=H(e),t=H(t);let r=await Ia.call(this,e);if(n?.errorOnExist&&await Pa.call(this,t))throw j(`EEXIST`,`cp`,t);switch(r.mode&Ye){case et:{if(!n?.recursive)throw j(`EISDIR`,`cp`,e);let[r]=await Promise.all([Ga.call(this,e,{withFileTypes:!0}),Wa.call(this,t,{recursive:!0})]);await Promise.all(r.map(async r=>{n.filter&&!n.filter(U(e,r.name),U(t,r.name))||await lo.call(this,U(e,r.name),U(t,r.name),n)}));break}case Qe:case Ze:await so.call(this,e,t);break;case $e:case tt:case nt:case Xe:default:throw j(`ENOSYS`,`cp`,e)}n?.preserveTimestamps&&await $a.call(this,t,r.atime,r.mtime)}async function uo(e,t){e=H(e);let{fs:n}=Y(e,this);return Promise.resolve(Er(n,t?.bigint))}function fo(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($t);async function*l(e){let t=await Ga(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=>hn(e,t)))continue;let a=t.replace(/^\/+/g,``);(await Fa(t)).isDirectory()&&(o||s.some(e=>a===e||e.startsWith(a+`/`)))&&(yield*l(t)),c.some(e=>e.test(a))&&(yield r?n:a)}}return l(n instanceof URL?n.pathname:n)}function po(e,t){t.disableAsyncCache&&e.attributes.set(`no_async_preload`),t.caseFold&&e.attributes.set(`case_fold`,t.caseFold)}function mo(e){return je(e)||De(e)||e instanceof zn}function ho(e){return typeof e?.then==`function`}async function go(e,t=0){if(typeof e!=`object`||!e)throw R(M(`EINVAL`,`Invalid options on mount configuration`));if(!mo(e))throw R(M(`EINVAL`,`Invalid mount configuration`));if(e instanceof zn)return await e.ready(),e;De(e)&&(e={backend:e});for(let[n,r]of Object.entries(e))if(n!=`backend`&&mo(r)){if(de(`Resolving nested mount configuration: `+n),t>10)throw R(M(`EINVAL`,`Invalid configuration, too deep and possibly infinite`));e[n]=await go(r,++t)}let{backend:n}=e;if(typeof n.isAvailable==`function`&&!await n.isAvailable(e))throw R(M(`EPERM`,`Backend not available: `+n.name));Ae(n,e);let r=await n.create(e);return po(r,e),await r.ready(),r}function _o(e,t=0){if(typeof e!=`object`||!e)throw R(M(`EINVAL`,`Invalid options on mount configuration`));if(!mo(e))throw R(M(`EINVAL`,`Invalid mount configuration`));if(e instanceof zn)return e.readySync(),e;De(e)&&(e={backend:e});for(let[n,r]of Object.entries(e))if(n!=`backend`&&mo(r)){if(de(`Resolving nested mount configuration: `+n),t>10)throw R(M(`EINVAL`,`Invalid configuration, too deep and possibly infinite`));e[n]=_o(r,++t)}let{backend:n}=e;if(typeof n.isAvailable==`function`){let t=n.isAvailable(e);if(ho(t))throw R(M(`EAGAIN`,`Backend availability check would block: `+n.name));if(!t)throw R(M(`EPERM`,`Backend not available: `+n.name))}Ae(n,e);let r=n.create(e);if(ho(r))throw R(M(`EAGAIN`,`Backend initialization would block: `+n.name));let i=r;return po(i,e),i.readySync(),i}async function vo(e){if(!mo(e))throw TypeError(`Invalid single mount point configuration`);let t=await go(e);Tr(`/`),wr(`/`,t)}function yo(e){if(!mo(e))throw TypeError(`Invalid single mount point configuration`);let t=_o(e);Tr(`/`),wr(`/`,t)}async function bo(e,t){if(e==`/`){wr(e,t);return}let n=await Fa(e).catch(()=>null);if(!n)await Wa(e,{recursive:!0});else if(!n.isDirectory())throw M(`ENOTDIR`,`Missing directory at mount point: `+e);wr(e,t)}function xo(e,t){if(e==`/`){wr(e,t);return}let n=null;try{n=Wr(e)}catch(e){if(e?.code!=`ENOENT`)throw e}if(!n)ui(e,{recursive:!0});else if(!n.isDirectory())throw M(`ENOTDIR`,`Missing directory at mount point: `+e);wr(e,t)}function So(e,t){let n=Cr.get(`/dev`);if(!(n instanceof Zn))throw le(M(`ENOTSUP`,`/dev does not exist or is not a device file system`));return n._createDevice(e,t)}const Co=[`/tmp`,`/var`,`/etc`];async function wo(e){if(Object.assign(Fe.credentials,Me({uid:e.uid||0,gid:e.gid||0})),or(!e.disableAccessChecks),e.log&&Ee(e.log),e.mounts)for(let[t,n]of Object.entries(e.mounts).sort(([e],[t])=>e.length>t.length?1:-1)){let r=t.startsWith(`/`)?t:`/`+t;je(n)&&(n.disableAsyncCache??=e.disableAsyncCache||!1,n.caseFold??=e.caseFold),r==`/`&&Tr(`/`),await bo(r,await go(n))}for(let t of Cr.values())po(t,e);if(e.addDevices&&!Cr.has(`/dev`)){let e=new Zn;e.addDefaults(),await e.ready(),await bo(`/dev`,e)}if(e.defaultDirectories)for(let e of Co)await Pa(e)?(await Fa(e)).isDirectory()||z(`Default directory exists but is not a directory: `+e):await Wa(e)}function To(e){if(Object.assign(Fe.credentials,Me({uid:e.uid||0,gid:e.gid||0})),or(!e.disableAccessChecks),e.log&&Ee(e.log),e.mounts)for(let[t,n]of Object.entries(e.mounts).sort(([e],[t])=>e.length>t.length?1:-1)){let r=t.startsWith(`/`)?t:`/`+t;je(n)&&(n.disableAsyncCache??=e.disableAsyncCache||!1,n.caseFold??=e.caseFold),r==`/`&&Tr(`/`),xo(r,_o(n))}for(let t of Cr.values())po(t,e);if(e.addDevices&&!Cr.has(`/dev`)){let e=new Zn;e.addDefaults(),e.readySync(),xo(`/dev`,e)}if(e.defaultDirectories)for(let e of Co){if(Ur(e)){Wr(e).isDirectory()||z(`Default directory exists but is not a directory: `+e);continue}ui(e)}}async function Eo(){for(let e of Cr.values())await e.sync()}const Do=new Set([`delete`]);function Oo(e){return Do.has(e)}const ko=Math.max(...Do.values().map(e=>e.length)),Ao=`#journal@v0
|
|
5
|
+
`);break;case`up`:case`down`:{if(!this.output||!this._history.length)return;if(this._historyIndex===this._history.length&&(this._currentLine=this.line||``),t.name==`up`&&this._historyIndex>0)this._historyIndex--;else if(t.name==`down`&&this._historyIndex<this._history.length-1)this._historyIndex++;else if(t.name==`down`&&this._historyIndex==this._history.length-1){this._historyIndex=this._history.length,this._renderLine(this._currentLine);return}else return;let e=this._history[this._historyIndex];this._renderLine(e);break}case`left`:case`right`:{let e=t.name==`left`?-1:1;if(!this.output)return;let n=Math.max(0,Math.min(this.line.length,this._cursor+e));if(n==this._cursor)return;Zi(this.output,e,0),this._cursor=n,this._cursor=n;break}case`backspace`:{if(!this.output||!this._cursor)return;let e=this.line.slice(0,this._cursor-1)+this.line.slice(this._cursor);this._renderLine(e),this._cursor=--this._cursor,this._cursor>0&&(Zi(this.output,-this._cursor,0),Zi(this.output,this._cursor,0));break}case`delete`:{if(!this.output||this._cursor>=this.line.length)return;let e=this.line.slice(0,this._cursor)+this.line.slice(this._cursor+1);Xi(this.output,0),Zi(this.output,0,0),this.output.write(this._prompt+e),this.line=e,Zi(this.output,-e.length,0),Zi(this.output,this._cursor,0);break}}}}_renderLine(e){this.output&&(Xi(this.output,0),Zi(this.output,0,0),this.output.write(this._prompt+e),this.line=e,this._cursor=e.length,this._cursor=e.length)}question(e,t,n){let r=typeof t==`function`?t:n;if(this._closed||!this.output){r(``);return}this.output.write(e),this.once(`line`,r)}getCursorPos(){return{rows:0,cols:this.cursor}}prependListener(e,t){let n=this.listeners(e);return this.removeAllListeners(e),this.on(e,t),n.forEach(this.on.bind(this,e)),this}prependOnceListener(e,t){let n=this.listeners(e);return this.removeAllListeners(e),this.once(e,t),n.forEach(this.on.bind(this,e)),this}setMaxListeners(){return z(`Interface.prototype.setMaxListeners is not supported`),this}getMaxListeners(){return z(`Interface.prototype.getMaxListeners is not supported`),10}[Symbol.asyncIterator](){let e=!1;return{next:async()=>{if(e)return{done:e,value:void 0};let{resolve:t,promise:n}=Promise.withResolvers();return this.once(`line`,e=>t({value:e,done:!1})),this.once(`close`,()=>{e=!0,t({value:void 0,done:e})}),n},return:async t=>e?{done:e,value:t}:(e=!0,this.close(),{done:e,value:t}),throw:async t=>{throw e||(e=!0,this.close()),t},[Symbol.asyncIterator](){return this},[Symbol.asyncDispose]:async()=>{e||(e=!0,this.close())}}}[Symbol.dispose](){this.close()}async[Symbol.asyncDispose](){if(this._closed)return;let{resolve:e,promise:t}=Promise.withResolvers();this.once(`close`,()=>e()),this.close(),await t}rawListeners(e){return this.listeners(e)}};function Yi(e,t,n,r){return`input`in e?new Ji(e.input,e.output,e.completer,e.terminal):new Ji(e,t,n,r)}function Xi(e,t){return e.write(t>=0?`\r\x1B[K`:`\x1B[K`),!0}function Zi(e,t,n){if(!e.write)return!1;let r=``;return t<0?r+=`\x1b[${-t}D`:t>0&&(r+=`\x1b[${t}C`),n<0?r+=`\x1b[${-n}A`:n>0&&(r+=`\x1b[${n}B`),r&&e.write(r),!0}var Qi=n(((e,t)=>{t.exports={AggregateError:class extends Error{constructor(e){if(!Array.isArray(e))throw TypeError(`Expected input to be an Array, got ${typeof e}`);let t=``;for(let n=0;n<e.length;n++)t+=` ${e[n].stack}\n`;super(t),this.name=`AggregateError`,this.errors=e}},ArrayIsArray(e){return Array.isArray(e)},ArrayPrototypeIncludes(e,t){return e.includes(t)},ArrayPrototypeIndexOf(e,t){return e.indexOf(t)},ArrayPrototypeJoin(e,t){return e.join(t)},ArrayPrototypeMap(e,t){return e.map(t)},ArrayPrototypePop(e,t){return e.pop(t)},ArrayPrototypePush(e,t){return e.push(t)},ArrayPrototypeSlice(e,t,n){return e.slice(t,n)},Error,FunctionPrototypeCall(e,t,...n){return e.call(t,...n)},FunctionPrototypeSymbolHasInstance(e,t){return Function.prototype[Symbol.hasInstance].call(e,t)},MathFloor:Math.floor,Number,NumberIsInteger:Number.isInteger,NumberIsNaN:Number.isNaN,NumberMAX_SAFE_INTEGER:2**53-1,NumberMIN_SAFE_INTEGER:-(2**53-1),NumberParseInt:Number.parseInt,ObjectDefineProperties(e,t){return Object.defineProperties(e,t)},ObjectDefineProperty(e,t,n){return Object.defineProperty(e,t,n)},ObjectGetOwnPropertyDescriptor(e,t){return Object.getOwnPropertyDescriptor(e,t)},ObjectKeys(e){return Object.keys(e)},ObjectSetPrototypeOf(e,t){return Object.setPrototypeOf(e,t)},Promise,PromisePrototypeCatch(e,t){return e.catch(t)},PromisePrototypeThen(e,t,n){return e.then(t,n)},PromiseReject(e){return Promise.reject(e)},PromiseResolve(e){return Promise.resolve(e)},ReflectApply:Reflect.apply,RegExpPrototypeTest(e,t){return e.test(t)},SafeSet:Set,String,StringPrototypeSlice(e,t,n){return e.slice(t,n)},StringPrototypeToLowerCase(e){return e.toLowerCase()},StringPrototypeToUpperCase(e){return e.toUpperCase()},StringPrototypeTrim(e){return e.trim()},Symbol,SymbolFor:Symbol.for,SymbolAsyncIterator:Symbol.asyncIterator,SymbolHasInstance:Symbol.hasInstance,SymbolIterator:Symbol.iterator,SymbolDispose:Symbol.dispose||Symbol(`Symbol.dispose`),SymbolAsyncDispose:Symbol.asyncDispose||Symbol(`Symbol.asyncDispose`),TypedArrayPrototypeSet(e,t,n){return e.set(t,n)},Boolean,Uint8Array}})),$i=n(((e,t)=>{t.exports={format(e,...t){return e.replace(/%([sdifj])/g,function(...[e,n]){let r=t.shift();return n===`f`?r.toFixed(6):n===`j`?JSON.stringify(r):n===`s`&&typeof r==`object`?`${r.constructor===Object?``:r.constructor.name} {}`.trim():r.toString()})},inspect(e){switch(typeof e){case`string`:if(e.includes(`'`)){if(!e.includes(`"`))return`"${e}"`;if(!e.includes("`")&&!e.includes("${"))return`\`${e}\``}return`'${e}'`;case`number`:return isNaN(e)?`NaN`:Object.is(e,-0)?String(e):e;case`bigint`:return`${String(e)}n`;case`boolean`:case`undefined`:return String(e);case`object`:return`{}`}}}})),ea=n(((e,t)=>{let{format:n,inspect:r}=$i(),{AggregateError:i}=Qi(),a=globalThis.AggregateError||i,o=Symbol(`kIsNodeError`),s=[`string`,`function`,`number`,`object`,`Function`,`Object`,`boolean`,`bigint`,`symbol`],c=/^([A-Z][a-z0-9]*)+$/,l={};function u(e,t){if(!e)throw new l.ERR_INTERNAL_ASSERTION(t)}function d(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 f(e,t,r){if(typeof t==`function`)return u(t.length<=r.length,`Code: ${e}; The provided arguments length (${r.length}) does not match the required ones (${t.length}).`),t(...r);let i=(t.match(/%[dfijoOs]/g)||[]).length;return u(i===r.length,`Code: ${e}; The provided arguments length (${r.length}) does not match the required ones (${i}).`),r.length===0?t:n(t,...r)}function p(e,t,n){n||=Error;class r extends n{constructor(...n){super(f(e,t,n))}toString(){return`${this.name} [${e}]: ${this.message}`}}Object.defineProperties(r.prototype,{name:{value:n.name,writable:!0,enumerable:!1,configurable:!0},toString:{value(){return`${this.name} [${e}]: ${this.message}`},writable:!0,enumerable:!1,configurable:!0}}),r.prototype.code=e,r.prototype[o]=!0,l[e]=r}function m(e){let t=`__node_internal_`+e.name;return Object.defineProperty(e,"name",{value:t}),e}function h(e,t){if(e&&t&&e!==t){if(Array.isArray(t.errors))return t.errors.push(e),t;let n=new a([t,e],t.message);return n.code=t.code,n}return e||t}var g=class extends Error{constructor(e=`The operation was aborted`,t=void 0){if(t!==void 0&&typeof t!=`object`)throw new l.ERR_INVALID_ARG_TYPE(`options`,`Object`,t);super(e,t),this.code=`ABORT_ERR`,this.name=`AbortError`}};p(`ERR_ASSERTION`,`%s`,Error),p(`ERR_INVALID_ARG_TYPE`,(e,t,n)=>{u(typeof e==`string`,`'name' must be a string`),Array.isArray(t)||(t=[t]);let i=`The `;e.endsWith(` argument`)?i+=`${e} `:i+=`"${e}" ${e.includes(`.`)?`property`:`argument`} `,i+=`must be `;let a=[],o=[],l=[];for(let e of t)u(typeof e==`string`,`All expected entries have to be of type string`),s.includes(e)?a.push(e.toLowerCase()):c.test(e)?o.push(e):(u(e!==`object`,`The value "object" should be written as "Object"`),l.push(e));if(o.length>0){let e=a.indexOf(`object`);e!==-1&&(a.splice(a,e,1),o.push(`Object`))}if(a.length>0){switch(a.length){case 1:i+=`of type ${a[0]}`;break;case 2:i+=`one of type ${a[0]} or ${a[1]}`;break;default:{let e=a.pop();i+=`one of type ${a.join(`, `)}, or ${e}`}}(o.length>0||l.length>0)&&(i+=` or `)}if(o.length>0){switch(o.length){case 1:i+=`an instance of ${o[0]}`;break;case 2:i+=`an instance of ${o[0]} or ${o[1]}`;break;default:{let e=o.pop();i+=`an instance of ${o.join(`, `)}, or ${e}`}}l.length>0&&(i+=` or `)}switch(l.length){case 0:break;case 1:l[0].toLowerCase()!==l[0]&&(i+=`an `),i+=`${l[0]}`;break;case 2:i+=`one of ${l[0]} or ${l[1]}`;break;default:{let e=l.pop();i+=`one of ${l.join(`, `)}, or ${e}`}}if(n==null)i+=`. Received ${n}`;else if(typeof n==`function`&&n.name)i+=`. Received function ${n.name}`;else if(typeof n==`object`){var d;if((d=n.constructor)!=null&&d.name)i+=`. Received an instance of ${n.constructor.name}`;else{let e=r(n,{depth:-1});i+=`. Received ${e}`}}else{let e=r(n,{colors:!1});e.length>25&&(e=`${e.slice(0,25)}...`),i+=`. Received type ${typeof n} (${e})`}return i},TypeError),p(`ERR_INVALID_ARG_VALUE`,(e,t,n=`is invalid`)=>{let i=r(t);return i.length>128&&(i=i.slice(0,128)+`...`),`The ${e.includes(`.`)?`property`:`argument`} '${e}' ${n}. Received ${i}`},TypeError),p(`ERR_INVALID_RETURN_VALUE`,(e,t,n)=>{var r;return`Expected ${e} to be returned from the "${t}" function but got ${n!=null&&(r=n.constructor)!=null&&r.name?`instance of ${n.constructor.name}`:`type ${typeof n}`}.`},TypeError),p(`ERR_MISSING_ARGS`,(...e)=>{u(e.length>0,`At least one arg needs to be specified`);let t,n=e.length;switch(e=(Array.isArray(e)?e:[e]).map(e=>`"${e}"`).join(` or `),n){case 1:t+=`The ${e[0]} argument`;break;case 2:t+=`The ${e[0]} and ${e[1]} arguments`;break;default:{let n=e.pop();t+=`The ${e.join(`, `)}, and ${n} arguments`}break}return`${t} must be specified`},TypeError),p(`ERR_OUT_OF_RANGE`,(e,t,n)=>{u(t,`Missing "range" argument`);let i;if(Number.isInteger(n)&&Math.abs(n)>2**32)i=d(String(n));else if(typeof n==`bigint`){i=String(n);let e=BigInt(2)**BigInt(32);(n>e||n<-e)&&(i=d(i)),i+=`n`}else i=r(n);return`The value of "${e}" is out of range. It must be ${t}. Received ${i}`},RangeError),p(`ERR_MULTIPLE_CALLBACK`,`Callback called multiple times`,Error),p(`ERR_METHOD_NOT_IMPLEMENTED`,`The %s method is not implemented`,Error),p(`ERR_STREAM_ALREADY_FINISHED`,`Cannot call %s after a stream was finished`,Error),p(`ERR_STREAM_CANNOT_PIPE`,`Cannot pipe, not readable`,Error),p(`ERR_STREAM_DESTROYED`,`Cannot call %s after a stream was destroyed`,Error),p(`ERR_STREAM_NULL_VALUES`,`May not write null values to stream`,TypeError),p(`ERR_STREAM_PREMATURE_CLOSE`,`Premature close`,Error),p(`ERR_STREAM_PUSH_AFTER_EOF`,`stream.push() after EOF`,Error),p(`ERR_STREAM_UNSHIFT_AFTER_END_EVENT`,`stream.unshift() after end event`,Error),p(`ERR_STREAM_WRITE_AFTER_END`,`write after end`,Error),p(`ERR_UNKNOWN_ENCODING`,`Unknown encoding: %s`,TypeError),t.exports={AbortError:g,aggregateTwoErrors:m(h),hideStackFrames:m,codes:l}})),ta=n(((e,t)=>{let{AbortController:n,AbortSignal:r}=typeof self<`u`?self:typeof window<`u`?window:void 0;t.exports=n,t.exports.AbortSignal=r,t.exports.default=n})),na=n(((e,t)=>{var n=typeof Reflect==`object`?Reflect:null,r=n&&typeof n.apply==`function`?n.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)},i=n&&typeof n.ownKeys==`function`?n.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};function a(e){console&&console.warn&&console.warn(e)}var o=Number.isNaN||function(e){return e!==e};function s(){s.init.call(this)}t.exports=s,t.exports.once=y,s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var c=10;function l(e){if(typeof e!=`function`)throw TypeError(`The "listener" argument must be of type Function. Received type `+typeof e)}Object.defineProperty(s,"defaultMaxListeners",{enumerable:!0,get:function(){return c},set:function(e){if(typeof e!=`number`||e<0||o(e))throw RangeError(`The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received `+e+`.`);c=e}}),s.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},s.prototype.setMaxListeners=function(e){if(typeof e!=`number`||e<0||o(e))throw RangeError(`The value of "n" is out of range. It must be a non-negative number. Received `+e+`.`);return this._maxListeners=e,this};function u(e){return e._maxListeners===void 0?s.defaultMaxListeners:e._maxListeners}s.prototype.getMaxListeners=function(){return u(this)},s.prototype.emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t.push(arguments[n]);var i=e===`error`,a=this._events;if(a!==void 0)i&&=a.error===void 0;else if(!i)return!1;if(i){var o;if(t.length>0&&(o=t[0]),o instanceof Error)throw o;var s=Error(`Unhandled error.`+(o?` (`+o.message+`)`:``));throw s.context=o,s}var c=a[e];if(c===void 0)return!1;if(typeof c==`function`)r(c,this,t);else for(var l=c.length,u=g(c,l),n=0;n<l;++n)r(u[n],this,t);return!0};function d(e,t,n,r){var i,o,s;if(l(n),o=e._events,o===void 0?(o=e._events=Object.create(null),e._eventsCount=0):(o.newListener!==void 0&&(e.emit(`newListener`,t,n.listener?n.listener:n),o=e._events),s=o[t]),s===void 0)s=o[t]=n,++e._eventsCount;else if(typeof s==`function`?s=o[t]=r?[n,s]:[s,n]:r?s.unshift(n):s.push(n),i=u(e),i>0&&s.length>i&&!s.warned){s.warned=!0;var c=Error(`Possible EventEmitter memory leak detected. `+s.length+` `+String(t)+` listeners added. Use emitter.setMaxListeners() to increase limit`);c.name=`MaxListenersExceededWarning`,c.emitter=e,c.type=t,c.count=s.length,a(c)}return e}s.prototype.addListener=function(e,t){return d(this,e,t,!1)},s.prototype.on=s.prototype.addListener,s.prototype.prependListener=function(e,t){return d(this,e,t,!0)};function f(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function p(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},i=f.bind(r);return i.listener=n,r.wrapFn=i,i}s.prototype.once=function(e,t){return l(t),this.on(e,p(this,e,t)),this},s.prototype.prependOnceListener=function(e,t){return l(t),this.prependListener(e,p(this,e,t)),this},s.prototype.removeListener=function(e,t){var n,r,i,a,o;if(l(t),r=this._events,r===void 0||(n=r[e],n===void 0))return this;if(n===t||n.listener===t)--this._eventsCount===0?this._events=Object.create(null):(delete r[e],r.removeListener&&this.emit(`removeListener`,e,n.listener||t));else if(typeof n!=`function`){for(i=-1,a=n.length-1;a>=0;a--)if(n[a]===t||n[a].listener===t){o=n[a].listener,i=a;break}if(i<0)return this;i===0?n.shift():_(n,i),n.length===1&&(r[e]=n[0]),r.removeListener!==void 0&&this.emit(`removeListener`,e,o||t)}return this},s.prototype.off=s.prototype.removeListener,s.prototype.removeAllListeners=function(e){var t,n=this._events,r;if(n===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[e]),this;if(arguments.length===0){var i=Object.keys(n),a;for(r=0;r<i.length;++r)a=i[r],a!==`removeListener`&&this.removeAllListeners(a);return this.removeAllListeners(`removeListener`),this._events=Object.create(null),this._eventsCount=0,this}if(t=n[e],typeof t==`function`)this.removeListener(e,t);else if(t!==void 0)for(r=t.length-1;r>=0;r--)this.removeListener(e,t[r]);return this};function m(e,t,n){var r=e._events;if(r===void 0)return[];var i=r[t];return i===void 0?[]:typeof i==`function`?n?[i.listener||i]:[i]:n?v(i):g(i,i.length)}s.prototype.listeners=function(e){return m(this,e,!0)},s.prototype.rawListeners=function(e){return m(this,e,!1)},s.listenerCount=function(e,t){return typeof e.listenerCount==`function`?e.listenerCount(t):h.call(e,t)},s.prototype.listenerCount=h;function h(e){var t=this._events;if(t!==void 0){var n=t[e];if(typeof n==`function`)return 1;if(n!==void 0)return n.length}return 0}s.prototype.eventNames=function(){return this._eventsCount>0?i(this._events):[]};function g(e,t){for(var n=Array(t),r=0;r<t;++r)n[r]=e[r];return n}function _(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}function v(e){for(var t=Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}function y(e,t){return new Promise(function(n,r){function i(n){e.removeListener(t,a),r(n)}function a(){typeof e.removeListener==`function`&&e.removeListener(`error`,i),n([].slice.call(arguments))}x(e,t,a,{once:!0}),t!==`error`&&b(e,i,{once:!0})})}function b(e,t,n){typeof e.on==`function`&&x(e,`error`,t,n)}function x(e,t,n,r){if(typeof e.on==`function`)r.once?e.once(t,n):e.on(t,n);else if(typeof e.addEventListener==`function`)e.addEventListener(t,function i(a){r.once&&e.removeEventListener(t,i),n(a)});else throw TypeError(`The "emitter" argument must be of type EventEmitter. Received type `+typeof e)}})),ra=n(((e,t)=>{let n=i(),{format:r,inspect:a}=$i(),{codes:{ERR_INVALID_ARG_TYPE:o}}=ea(),{kResistStopPropagation:s,AggregateError:c,SymbolDispose:l}=Qi(),u=globalThis.AbortSignal||ta().AbortSignal,d=globalThis.AbortController||ta().AbortController,f=Object.getPrototypeOf(async function(){}).constructor,p=globalThis.Blob||n.Blob,m=p===void 0?function(e){return!1}:function(e){return e instanceof p},h=(e,t)=>{if(e!==void 0&&(typeof e!=`object`||!e||!(`aborted`in e)))throw new o(t,`AbortSignal`,e)},g=(e,t)=>{if(typeof e!=`function`)throw new o(t,`Function`,e)};t.exports={AggregateError:c,kEmptyObject:Object.freeze({}),once(e){let t=!1;return function(...n){t||(t=!0,e.apply(this,n))}},createDeferredPromise:function(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}},promisify(e){return new Promise((t,n)=>{e((e,...r)=>e?n(e):t(...r))})},debuglog(){return function(){}},format:r,inspect:a,types:{isAsyncFunction(e){return e instanceof f},isArrayBufferView(e){return ArrayBuffer.isView(e)}},isBlob:m,deprecate(e,t){return e},addAbortListener:na().addAbortListener||function(e,t){if(e===void 0)throw new o(`signal`,`AbortSignal`,e);h(e,`signal`),g(t,`listener`);let n;return e.aborted?queueMicrotask(()=>t()):(e.addEventListener(`abort`,t,{__proto__:null,once:!0,[s]:!0}),n=()=>{e.removeEventListener(`abort`,t)}),{__proto__:null,[l](){var e;(e=n)==null||e()}}},AbortSignalAny:u.any||function(e){if(e.length===1)return e[0];let t=new d,n=()=>t.abort();return e.forEach(e=>{h(e,`signals`),e.addEventListener(`abort`,n,{once:!0})}),t.signal.addEventListener(`abort`,()=>{e.forEach(e=>e.removeEventListener(`abort`,n))},{once:!0}),t.signal}},t.exports.promisify.custom=Symbol.for(`nodejs.util.promisify.custom`)})),ia=n(((e,t)=>{let{ArrayIsArray:n,ArrayPrototypeIncludes:r,ArrayPrototypeJoin:i,ArrayPrototypeMap:a,NumberIsInteger:o,NumberIsNaN:s,NumberMAX_SAFE_INTEGER:c,NumberMIN_SAFE_INTEGER:l,NumberParseInt:u,ObjectPrototypeHasOwnProperty:d,RegExpPrototypeExec:f,String:p,StringPrototypeToUpperCase:m,StringPrototypeTrim:h}=Qi(),{hideStackFrames:g,codes:{ERR_SOCKET_BAD_PORT:_,ERR_INVALID_ARG_TYPE:v,ERR_INVALID_ARG_VALUE:y,ERR_OUT_OF_RANGE:b,ERR_UNKNOWN_SIGNAL:x}}=ea(),{normalizeEncoding:S}=ra(),{isAsyncFunction:C,isArrayBufferView:w}=ra().types,T={};function ee(e){return e===(e|0)}function te(e){return e===e>>>0}let ne=/^[0-7]+$/;function E(e,t,n){if(e===void 0&&(e=n),typeof e==`string`){if(f(ne,e)===null)throw new y(t,e,`must be a 32-bit unsigned integer or an octal string`);e=u(e,8)}return re(e,t),e}let D=g((e,t,n=l,r=c)=>{if(typeof e!=`number`)throw new v(t,`number`,e);if(!o(e))throw new b(t,`an integer`,e);if(e<n||e>r)throw new b(t,`>= ${n} && <= ${r}`,e)}),O=g((e,t,n=-2147483648,r=2147483647)=>{if(typeof e!=`number`)throw new v(t,`number`,e);if(!o(e))throw new b(t,`an integer`,e);if(e<n||e>r)throw new b(t,`>= ${n} && <= ${r}`,e)}),re=g((e,t,n=!1)=>{if(typeof e!=`number`)throw new v(t,`number`,e);if(!o(e))throw new b(t,`an integer`,e);let r=+!!n,i=4294967295;if(e<r||e>i)throw new b(t,`>= ${r} && <= ${i}`,e)});function k(e,t){if(typeof e!=`string`)throw new v(t,`string`,e)}function A(e,t,n=void 0,r){if(typeof e!=`number`)throw new v(t,`number`,e);if(n!=null&&e<n||r!=null&&e>r||(n!=null||r!=null)&&s(e))throw new b(t,`${n==null?``:`>= ${n}`}${n!=null&&r!=null?` && `:``}${r==null?``:`<= ${r}`}`,e)}let j=g((e,t,n)=>{if(!r(n,e))throw new y(t,e,`must be one of: `+i(a(n,e=>typeof e==`string`?`'${e}'`:p(e)),`, `))});function M(e,t){if(typeof e!=`boolean`)throw new v(t,`boolean`,e)}function N(e,t,n){return e==null||!d(e,t)?n:e[t]}let P=g((e,t,r=null)=>{let i=N(r,`allowArray`,!1),a=N(r,`allowFunction`,!1);if(!N(r,`nullable`,!1)&&e===null||!i&&n(e)||typeof e!=`object`&&(!a||typeof e!=`function`))throw new v(t,`Object`,e)}),F=g((e,t)=>{if(e!=null&&typeof e!=`object`&&typeof e!=`function`)throw new v(t,`a dictionary`,e)}),ie=g((e,t,r=0)=>{if(!n(e))throw new v(t,`Array`,e);if(e.length<r)throw new y(t,e,`must be longer than ${r}`)});function I(e,t){ie(e,t);for(let n=0;n<e.length;n++)k(e[n],`${t}[${n}]`)}function ae(e,t){ie(e,t);for(let n=0;n<e.length;n++)M(e[n],`${t}[${n}]`)}function L(e,t){ie(e,t);for(let n=0;n<e.length;n++){let r=e[n],i=`${t}[${n}]`;if(r==null)throw new v(i,`AbortSignal`,r);R(r,i)}}function oe(e,t=`signal`){if(k(e,t),T[e]===void 0)throw T[m(e)]===void 0?new x(e):new x(e+` (signals must use all capital letters)`)}let se=g((e,t=`buffer`)=>{if(!w(e))throw new v(t,[`Buffer`,`TypedArray`,`DataView`],e)});function ce(e,t){let n=S(t),r=e.length;if(n===`hex`&&r%2!=0)throw new y(`encoding`,t,`is invalid for data of length ${r}`)}function le(e,t=`Port`,n=!0){if(typeof e!=`number`&&typeof e!=`string`||typeof e==`string`&&h(e).length===0||+e!=e>>>0||e>65535||e===0&&!n)throw new _(t,e,n);return e|0}let R=g((e,t)=>{if(e!==void 0&&(typeof e!=`object`||!e||!(`aborted`in e)))throw new v(t,`AbortSignal`,e)}),z=g((e,t)=>{if(typeof e!=`function`)throw new v(t,`Function`,e)}),ue=g((e,t)=>{if(typeof e!=`function`||C(e))throw new v(t,`Function`,e)}),de=g((e,t)=>{if(e!==void 0)throw new v(t,`undefined`,e)});function fe(e,t,n){if(!r(n,e))throw new v(t,`('${i(n,`|`)}')`,e)}let pe=/^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/;function me(e,t){if(e===void 0||!f(pe,e))throw new y(t,e,`must be an array or string of format "</styles.css>; rel=preload; as=style"`)}function he(e){if(typeof e==`string`)return me(e,`hints`),e;if(n(e)){let t=e.length,n=``;if(t===0)return n;for(let r=0;r<t;r++){let i=e[r];me(i,`hints`),n+=i,r!==t-1&&(n+=`, `)}return n}throw new y(`hints`,e,`must be an array or string of format "</styles.css>; rel=preload; as=style"`)}t.exports={isInt32:ee,isUint32:te,parseFileMode:E,validateArray:ie,validateStringArray:I,validateBooleanArray:ae,validateAbortSignalArray:L,validateBoolean:M,validateBuffer:se,validateDictionary:F,validateEncoding:ce,validateFunction:z,validateInt32:O,validateInteger:D,validateNumber:A,validateObject:P,validateOneOf:j,validatePlainFunction:ue,validatePort:le,validateSignalName:oe,validateString:k,validateUint32:re,validateUndefined:de,validateUnion:fe,validateAbortSignal:R,validateLinkHeaderValue:he}})),aa=n(((e,t)=>{var n=t.exports={},r,i;function a(){throw Error(`setTimeout has not been defined`)}function o(){throw Error(`clearTimeout has not been defined`)}(function(){try{r=typeof setTimeout==`function`?setTimeout:a}catch{r=a}try{i=typeof clearTimeout==`function`?clearTimeout:o}catch{i=o}})();function s(e){if(r===setTimeout)return setTimeout(e,0);if((r===a||!r)&&setTimeout)return r=setTimeout,setTimeout(e,0);try{return r(e,0)}catch{try{return r.call(null,e,0)}catch{return r.call(this,e,0)}}}function c(e){if(i===clearTimeout)return clearTimeout(e);if((i===o||!i)&&clearTimeout)return i=clearTimeout,clearTimeout(e);try{return i(e)}catch{try{return i.call(null,e)}catch{return i.call(this,e)}}}var l=[],u=!1,d,f=-1;function p(){!u||!d||(u=!1,d.length?l=d.concat(l):f=-1,l.length&&m())}function m(){if(!u){var e=s(p);u=!0;for(var t=l.length;t;){for(d=l,l=[];++f<t;)d&&d[f].run();f=-1,t=l.length}d=null,u=!1,c(e)}}n.nextTick=function(e){var t=Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];l.push(new h(e,t)),l.length===1&&!u&&s(m)};function h(e,t){this.fun=e,this.array=t}h.prototype.run=function(){this.fun.apply(null,this.array)},n.title=`browser`,n.browser=!0,n.env={},n.argv=[],n.version=``,n.versions={};function g(){}n.on=g,n.addListener=g,n.once=g,n.off=g,n.removeListener=g,n.removeAllListeners=g,n.emit=g,n.prependListener=g,n.prependOnceListener=g,n.listeners=function(e){return[]},n.binding=function(e){throw Error(`process.binding is not supported`)},n.cwd=function(){return`/`},n.chdir=function(e){throw Error(`process.chdir is not supported`)},n.umask=function(){return 0}})),oa=n(((e,t)=>{let{SymbolAsyncIterator:n,SymbolIterator:r,SymbolFor:i}=Qi(),a=i(`nodejs.stream.destroyed`),o=i(`nodejs.stream.errored`),s=i(`nodejs.stream.readable`),c=i(`nodejs.stream.writable`),l=i(`nodejs.stream.disturbed`),u=i(`nodejs.webstream.isClosedPromise`),d=i(`nodejs.webstream.controllerErrorFunction`);function f(e,t=!1){return!!(e&&typeof e.pipe==`function`&&typeof e.on==`function`&&(!t||typeof e.pause==`function`&&typeof e.resume==`function`)&&(!e._writableState||e._readableState?.readable!==!1)&&(!e._writableState||e._readableState))}function p(e){return!!(e&&typeof e.write==`function`&&typeof e.on==`function`&&(!e._readableState||e._writableState?.writable!==!1))}function m(e){return!!(e&&typeof e.pipe==`function`&&e._readableState&&typeof e.on==`function`&&typeof e.write==`function`)}function h(e){return e&&(e._readableState||e._writableState||typeof e.write==`function`&&typeof e.on==`function`||typeof e.pipe==`function`&&typeof e.on==`function`)}function g(e){return!!(e&&!h(e)&&typeof e.pipeThrough==`function`&&typeof e.getReader==`function`&&typeof e.cancel==`function`)}function _(e){return!!(e&&!h(e)&&typeof e.getWriter==`function`&&typeof e.abort==`function`)}function v(e){return!!(e&&!h(e)&&typeof e.readable==`object`&&typeof e.writable==`object`)}function y(e){return g(e)||_(e)||v(e)}function b(e,t){return e==null?!1:t===!0?typeof e[n]==`function`:t===!1?typeof e[r]==`function`:typeof e[n]==`function`||typeof e[r]==`function`}function x(e){if(!h(e))return null;let t=e._writableState,n=e._readableState,r=t||n;return!!(e.destroyed||e[a]||r!=null&&r.destroyed)}function S(e){if(!p(e))return null;if(e.writableEnded===!0)return!0;let t=e._writableState;return t!=null&&t.errored?!1:typeof t?.ended==`boolean`?t.ended:null}function C(e,t){if(!p(e))return null;if(e.writableFinished===!0)return!0;let n=e._writableState;return n!=null&&n.errored?!1:typeof n?.finished==`boolean`?!!(n.finished||t===!1&&n.ended===!0&&n.length===0):null}function w(e){if(!f(e))return null;if(e.readableEnded===!0)return!0;let t=e._readableState;return!t||t.errored?!1:typeof t?.ended==`boolean`?t.ended:null}function T(e,t){if(!f(e))return null;let n=e._readableState;return n!=null&&n.errored?!1:typeof n?.endEmitted==`boolean`?!!(n.endEmitted||t===!1&&n.ended===!0&&n.length===0):null}function ee(e){return e&&e[s]!=null?e[s]:typeof e?.readable==`boolean`?x(e)?!1:f(e)&&e.readable&&!T(e):null}function te(e){return e&&e[c]!=null?e[c]:typeof e?.writable==`boolean`?x(e)?!1:p(e)&&e.writable&&!S(e):null}function ne(e,t){return h(e)?x(e)?!0:!(t?.readable!==!1&&ee(e)||t?.writable!==!1&&te(e)):null}function E(e){return h(e)?e.writableErrored?e.writableErrored:e._writableState?.errored??null:null}function D(e){return h(e)?e.readableErrored?e.readableErrored:e._readableState?.errored??null:null}function O(e){if(!h(e))return null;if(typeof e.closed==`boolean`)return e.closed;let t=e._writableState,n=e._readableState;return typeof t?.closed==`boolean`||typeof n?.closed==`boolean`?t?.closed||n?.closed:typeof e._closed==`boolean`&&re(e)?e._closed:null}function re(e){return typeof e._closed==`boolean`&&typeof e._defaultKeepAlive==`boolean`&&typeof e._removedConnection==`boolean`&&typeof e._removedContLen==`boolean`}function k(e){return typeof e._sent100==`boolean`&&re(e)}function A(e){return typeof e._consuming==`boolean`&&typeof e._dumped==`boolean`&&e.req?.upgradeOrConnect===void 0}function j(e){if(!h(e))return null;let t=e._writableState,n=e._readableState,r=t||n;return!r&&k(e)||!!(r&&r.autoDestroy&&r.emitClose&&r.closed===!1)}function M(e){return!!(e&&(e[l]??(e.readableDidRead||e.readableAborted)))}function N(e){return!!(e&&(e[o]??e.readableErrored??e.writableErrored??e._readableState?.errorEmitted??e._writableState?.errorEmitted??e._readableState?.errored??e._writableState?.errored))}t.exports={isDestroyed:x,kIsDestroyed:a,isDisturbed:M,kIsDisturbed:l,isErrored:N,kIsErrored:o,isReadable:ee,kIsReadable:s,kIsClosedPromise:u,kControllerErrorFunction:d,kIsWritable:c,isClosed:O,isDuplexNodeStream:m,isFinished:ne,isIterable:b,isReadableNodeStream:f,isReadableStream:g,isReadableEnded:w,isReadableFinished:T,isReadableErrored:D,isNodeStream:h,isWebStream:y,isWritable:te,isWritableNodeStream:p,isWritableStream:_,isWritableEnded:S,isWritableFinished:C,isWritableErrored:E,isServerRequest:A,isServerResponse:k,willEmitClose:j,isTransformStream:v}})),sa=n(((e,t)=>{let n=aa(),{AbortError:r,codes:i}=ea(),{ERR_INVALID_ARG_TYPE:a,ERR_STREAM_PREMATURE_CLOSE:o}=i,{kEmptyObject:s,once:c}=ra(),{validateAbortSignal:l,validateFunction:u,validateObject:d,validateBoolean:f}=ia(),{Promise:p,PromisePrototypeThen:m,SymbolDispose:h}=Qi(),{isClosed:g,isReadable:_,isReadableNodeStream:v,isReadableStream:y,isReadableFinished:b,isReadableErrored:x,isWritable:S,isWritableNodeStream:C,isWritableStream:w,isWritableFinished:T,isWritableErrored:ee,isNodeStream:te,willEmitClose:ne,kIsClosedPromise:E}=oa(),D;function O(e){return e.setHeader&&typeof e.abort==`function`}let re=()=>{};function k(e,t,i){if(arguments.length===2?(i=t,t=s):t==null?t=s:d(t,`options`),u(i,`callback`),l(t.signal,`options.signal`),i=c(i),y(e)||w(e))return A(e,t,i);if(!te(e))throw new a(`stream`,[`ReadableStream`,`WritableStream`,`Stream`],e);let f=t.readable??v(e),p=t.writable??C(e),m=e._writableState,E=e._readableState,k=()=>{e.writable||N()},j=ne(e)&&v(e)===f&&C(e)===p,M=T(e,!1),N=()=>{M=!0,e.destroyed&&(j=!1),!(j&&(!e.readable||f))&&(!f||P)&&i.call(e)},P=b(e,!1),F=()=>{P=!0,e.destroyed&&(j=!1),!(j&&(!e.writable||p))&&(!p||M)&&i.call(e)},ie=t=>{i.call(e,t)},I=g(e),ae=()=>{I=!0;let t=ee(e)||x(e);if(t&&typeof t!=`boolean`)return i.call(e,t);if(f&&!P&&v(e,!0)&&!b(e,!1)||p&&!M&&!T(e,!1))return i.call(e,new o);i.call(e)},L=()=>{I=!0;let t=ee(e)||x(e);if(t&&typeof t!=`boolean`)return i.call(e,t);i.call(e)},oe=()=>{e.req.on(`finish`,N)};O(e)?(e.on(`complete`,N),j||e.on(`abort`,ae),e.req?oe():e.on(`request`,oe)):p&&!m&&(e.on(`end`,k),e.on(`close`,k)),!j&&typeof e.aborted==`boolean`&&e.on(`aborted`,ae),e.on(`end`,F),e.on(`finish`,N),t.error!==!1&&e.on(`error`,ie),e.on(`close`,ae),I?n.nextTick(ae):m!=null&&m.errorEmitted||E!=null&&E.errorEmitted?j||n.nextTick(L):(!f&&(!j||_(e))&&(M||S(e)===!1)||!p&&(!j||S(e))&&(P||_(e)===!1)||E&&e.req&&e.aborted)&&n.nextTick(L);let se=()=>{i=re,e.removeListener(`aborted`,ae),e.removeListener(`complete`,N),e.removeListener(`abort`,ae),e.removeListener(`request`,oe),e.req&&e.req.removeListener(`finish`,N),e.removeListener(`end`,k),e.removeListener(`close`,k),e.removeListener(`finish`,N),e.removeListener(`end`,F),e.removeListener(`error`,ie),e.removeListener(`close`,ae)};if(t.signal&&!I){let a=()=>{let n=i;se(),n.call(e,new r(void 0,{cause:t.signal.reason}))};if(t.signal.aborted)n.nextTick(a);else{D||=ra().addAbortListener;let n=D(t.signal,a),r=i;i=c((...t)=>{n[h](),r.apply(e,t)})}}return se}function A(e,t,i){let a=!1,o=re;if(t.signal)if(o=()=>{a=!0,i.call(e,new r(void 0,{cause:t.signal.reason}))},t.signal.aborted)n.nextTick(o);else{D||=ra().addAbortListener;let n=D(t.signal,o),r=i;i=c((...t)=>{n[h](),r.apply(e,t)})}let s=(...t)=>{a||n.nextTick(()=>i.apply(e,t))};return m(e[E].promise,s,s),re}function j(e,t){var n;let r=!1;return t===null&&(t=s),(n=t)!=null&&n.cleanup&&(f(t.cleanup,`cleanup`),r=t.cleanup),new p((n,i)=>{let a=k(e,t,e=>{r&&a(),e?i(e):n()})})}t.exports=k,t.exports.finished=j})),ca=n(((e,t)=>{let n=aa(),{aggregateTwoErrors:r,codes:{ERR_MULTIPLE_CALLBACK:i},AbortError:a}=ea(),{Symbol:o}=Qi(),{kIsDestroyed:s,isDestroyed:c,isFinished:l,isServerRequest:u}=oa(),d=o(`kDestroy`),f=o(`kConstruct`);function p(e,t,n){e&&(e.stack,t&&!t.errored&&(t.errored=e),n&&!n.errored&&(n.errored=e))}function m(e,t){let n=this._readableState,i=this._writableState,a=i||n;return i!=null&&i.destroyed||n!=null&&n.destroyed?(typeof t==`function`&&t(),this):(p(e,i,n),i&&(i.destroyed=!0),n&&(n.destroyed=!0),a.constructed?h(this,e,t):this.once(d,function(n){h(this,r(n,e),t)}),this)}function h(e,t,r){let i=!1;function a(t){if(i)return;i=!0;let a=e._readableState,o=e._writableState;p(t,o,a),o&&(o.closed=!0),a&&(a.closed=!0),typeof r==`function`&&r(t),t?n.nextTick(g,e,t):n.nextTick(_,e)}try{e._destroy(t||null,a)}catch(e){a(e)}}function g(e,t){v(e,t),_(e)}function _(e){let t=e._readableState,n=e._writableState;n&&(n.closeEmitted=!0),t&&(t.closeEmitted=!0),(n!=null&&n.emitClose||t!=null&&t.emitClose)&&e.emit(`close`)}function v(e,t){let n=e._readableState,r=e._writableState;r!=null&&r.errorEmitted||n!=null&&n.errorEmitted||(r&&(r.errorEmitted=!0),n&&(n.errorEmitted=!0),e.emit(`error`,t))}function y(){let e=this._readableState,t=this._writableState;e&&(e.constructed=!0,e.closed=!1,e.closeEmitted=!1,e.destroyed=!1,e.errored=null,e.errorEmitted=!1,e.reading=!1,e.ended=e.readable===!1,e.endEmitted=e.readable===!1),t&&(t.constructed=!0,t.destroyed=!1,t.closed=!1,t.closeEmitted=!1,t.errored=null,t.errorEmitted=!1,t.finalCalled=!1,t.prefinished=!1,t.ended=t.writable===!1,t.ending=t.writable===!1,t.finished=t.writable===!1)}function b(e,t,r){let i=e._readableState,a=e._writableState;if(a!=null&&a.destroyed||i!=null&&i.destroyed)return this;i!=null&&i.autoDestroy||a!=null&&a.autoDestroy?e.destroy(t):t&&(t.stack,a&&!a.errored&&(a.errored=t),i&&!i.errored&&(i.errored=t),r?n.nextTick(v,e,t):v(e,t))}function x(e,t){if(typeof e._construct!=`function`)return;let r=e._readableState,i=e._writableState;r&&(r.constructed=!1),i&&(i.constructed=!1),e.once(f,t),!(e.listenerCount(f)>1)&&n.nextTick(S,e)}function S(e){let t=!1;function r(r){if(t){b(e,r??new i);return}t=!0;let a=e._readableState,o=e._writableState,s=o||a;a&&(a.constructed=!0),o&&(o.constructed=!0),s.destroyed?e.emit(d,r):r?b(e,r,!0):n.nextTick(C,e)}try{e._construct(e=>{n.nextTick(r,e)})}catch(e){n.nextTick(r,e)}}function C(e){e.emit(f)}function w(e){return e?.setHeader&&typeof e.abort==`function`}function T(e){e.emit(`close`)}function ee(e,t){e.emit(`error`,t),n.nextTick(T,e)}function te(e,t){!e||c(e)||(!t&&!l(e)&&(t=new a),u(e)?(e.socket=null,e.destroy(t)):w(e)?e.abort():w(e.req)?e.req.abort():typeof e.destroy==`function`?e.destroy(t):typeof e.close==`function`?e.close():t?n.nextTick(ee,e,t):n.nextTick(T,e),e.destroyed||(e[s]=!0))}t.exports={construct:x,destroyer:te,destroy:m,undestroy:y,errorOrDestroy:b}})),la=n(((e,t)=>{let{ArrayIsArray:n,ObjectSetPrototypeOf:r}=Qi(),{EventEmitter:i}=na();function a(e){i.call(this,e)}r(a.prototype,i.prototype),r(a,i),a.prototype.pipe=function(e,t){let n=this;function r(t){e.writable&&e.write(t)===!1&&n.pause&&n.pause()}n.on(`data`,r);function a(){n.readable&&n.resume&&n.resume()}e.on(`drain`,a),!e._isStdio&&(!t||t.end!==!1)&&(n.on(`end`,c),n.on(`close`,l));let s=!1;function c(){s||(s=!0,e.end())}function l(){s||(s=!0,typeof e.destroy==`function`&&e.destroy())}function u(e){d(),i.listenerCount(this,`error`)===0&&this.emit(`error`,e)}o(n,`error`,u),o(e,`error`,u);function d(){n.removeListener(`data`,r),e.removeListener(`drain`,a),n.removeListener(`end`,c),n.removeListener(`close`,l),n.removeListener(`error`,u),e.removeListener(`error`,u),n.removeListener(`end`,d),n.removeListener(`close`,d),e.removeListener(`close`,d)}return n.on(`end`,d),n.on(`close`,d),e.on(`close`,d),e.emit(`pipe`,n),e};function o(e,t,r){if(typeof e.prependListener==`function`)return e.prependListener(t,r);!e._events||!e._events[t]?e.on(t,r):n(e._events[t])?e._events[t].unshift(r):e._events[t]=[r,e._events[t]]}t.exports={Stream:a,prependListener:o}})),ua=n(((e,t)=>{let{SymbolDispose:n}=Qi(),{AbortError:r,codes:i}=ea(),{isNodeStream:a,isWebStream:o,kControllerErrorFunction:s}=oa(),c=sa(),{ERR_INVALID_ARG_TYPE:l}=i,u,d=(e,t)=>{if(typeof e!=`object`||!(`aborted`in e))throw new l(t,`AbortSignal`,e)};t.exports.addAbortSignal=function(e,n){if(d(e,`signal`),!a(n)&&!o(n))throw new l(`stream`,[`ReadableStream`,`WritableStream`,`Stream`],n);return t.exports.addAbortSignalNoValidate(e,n)},t.exports.addAbortSignalNoValidate=function(e,t){if(typeof e!=`object`||!(`aborted`in e))return t;let i=a(t)?()=>{t.destroy(new r(void 0,{cause:e.reason}))}:()=>{t[s](new r(void 0,{cause:e.reason}))};return e.aborted?i():(u||=ra().addAbortListener,c(t,u(e,i)[n])),t}})),da=n(((e,t)=>{let{StringPrototypeSlice:n,SymbolIterator:r,TypedArrayPrototypeSet:a,Uint8Array:o}=Qi(),{Buffer:s}=i(),{inspect:c}=ra();t.exports=class{constructor(){this.head=null,this.tail=null,this.length=0}push(e){let t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length}unshift(e){let t={data:e,next:this.head};this.length===0&&(this.tail=t),this.head=t,++this.length}shift(){if(this.length===0)return;let e=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,e}clear(){this.head=this.tail=null,this.length=0}join(e){if(this.length===0)return``;let t=this.head,n=``+t.data;for(;(t=t.next)!==null;)n+=e+t.data;return n}concat(e){if(this.length===0)return s.alloc(0);let t=s.allocUnsafe(e>>>0),n=this.head,r=0;for(;n;)a(t,n.data,r),r+=n.data.length,n=n.next;return t}consume(e,t){let n=this.head.data;if(e<n.length){let t=n.slice(0,e);return this.head.data=n.slice(e),t}return e===n.length?this.shift():t?this._getString(e):this._getBuffer(e)}first(){return this.head.data}*[r](){for(let e=this.head;e;e=e.next)yield e.data}_getString(e){let t=``,r=this.head,i=0;do{let a=r.data;if(e>a.length)t+=a,e-=a.length;else{e===a.length?(t+=a,++i,r.next?this.head=r.next:this.head=this.tail=null):(t+=n(a,0,e),this.head=r,r.data=n(a,e));break}++i}while((r=r.next)!==null);return this.length-=i,t}_getBuffer(e){let t=s.allocUnsafe(e),n=e,r=this.head,i=0;do{let s=r.data;if(e>s.length)a(t,s,n-e),e-=s.length;else{e===s.length?(a(t,s,n-e),++i,r.next?this.head=r.next:this.head=this.tail=null):(a(t,new o(s.buffer,s.byteOffset,e),n-e),this.head=r,r.data=s.slice(e));break}++i}while((r=r.next)!==null);return this.length-=i,t}[Symbol.for(`nodejs.util.inspect.custom`)](e,t){return c(this,{...t,depth:0,customInspect:!1})}}})),fa=n(((e,t)=>{let{MathFloor:n,NumberIsInteger:r}=Qi(),{validateInteger:i}=ia(),{ERR_INVALID_ARG_VALUE:a}=ea().codes,o=16*1024,s=16;function c(e,t,n){return e.highWaterMark==null?t?e[n]:null:e.highWaterMark}function l(e){return e?s:o}function u(e,t){i(t,`value`,0),e?s=t:o=t}function d(e,t,i,o){let s=c(t,o,i);if(s!=null){if(!r(s)||s<0)throw new a(o?`options.${i}`:`options.highWaterMark`,s);return n(s)}return l(e.objectMode)}t.exports={getHighWaterMark:d,getDefaultHighWaterMark:l,setDefaultHighWaterMark:u}})),pa=n((e=>{var t=r().Buffer,n=t.isEncoding||function(e){switch(e=``+e,e&&e.toLowerCase()){case`hex`:case`utf8`:case`utf-8`:case`ascii`:case`binary`:case`base64`:case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:case`raw`:return!0;default:return!1}};function i(e){if(!e)return`utf8`;for(var t;;)switch(e){case`utf8`:case`utf-8`:return`utf8`;case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return`utf16le`;case`latin1`:case`binary`:return`latin1`;case`base64`:case`ascii`:case`hex`:return e;default:if(t)return;e=(``+e).toLowerCase(),t=!0}}function a(e){var r=i(e);if(typeof r!=`string`&&(t.isEncoding===n||!n(e)))throw Error(`Unknown encoding: `+e);return r||e}e.StringDecoder=o;function o(e){this.encoding=a(e);var n;switch(this.encoding){case`utf16le`:this.text=p,this.end=m,n=4;break;case`utf8`:this.fillLast=u,n=4;break;case`base64`:this.text=h,this.end=g,n=3;break;default:this.write=_,this.end=v;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=t.allocUnsafe(n)}o.prototype.write=function(e){if(e.length===0)return``;var t,n;if(this.lastNeed){if(t=this.fillLast(e),t===void 0)return``;n=this.lastNeed,this.lastNeed=0}else n=0;return n<e.length?t?t+this.text(e,n):this.text(e,n):t||``},o.prototype.end=f,o.prototype.text=d,o.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length};function s(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function c(e,t,n){var r=t.length-1;if(r<n)return 0;var i=s(t[r]);return i>=0?(i>0&&(e.lastNeed=i-1),i):--r<n||i===-2?0:(i=s(t[r]),i>=0?(i>0&&(e.lastNeed=i-2),i):--r<n||i===-2?0:(i=s(t[r]),i>=0?(i>0&&(i===2?i=0:e.lastNeed=i-3),i):0))}function l(e,t,n){if((t[0]&192)!=128)return e.lastNeed=0,`�`;if(e.lastNeed>1&&t.length>1){if((t[1]&192)!=128)return e.lastNeed=1,`�`;if(e.lastNeed>2&&t.length>2&&(t[2]&192)!=128)return e.lastNeed=2,`�`}}function u(e){var t=this.lastTotal-this.lastNeed,n=l(this,e,t);if(n!==void 0)return n;if(this.lastNeed<=e.length)return e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,t,0,e.length),this.lastNeed-=e.length}function d(e,t){var n=c(this,e,t);if(!this.lastNeed)return e.toString(`utf8`,t);this.lastTotal=n;var r=e.length-(n-this.lastNeed);return e.copy(this.lastChar,0,r),e.toString(`utf8`,t,r)}function f(e){var t=e&&e.length?this.write(e):``;return this.lastNeed?t+`�`:t}function p(e,t){if((e.length-t)%2==0){var n=e.toString(`utf16le`,t);if(n){var r=n.charCodeAt(n.length-1);if(r>=55296&&r<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],n.slice(0,-1)}return n}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString(`utf16le`,t,e.length-1)}function m(e){var t=e&&e.length?this.write(e):``;if(this.lastNeed){var n=this.lastTotal-this.lastNeed;return t+this.lastChar.toString(`utf16le`,0,n)}return t}function h(e,t){var n=(e.length-t)%3;return n===0?e.toString(`base64`,t):(this.lastNeed=3-n,this.lastTotal=3,n===1?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString(`base64`,t,e.length-n))}function g(e){var t=e&&e.length?this.write(e):``;return this.lastNeed?t+this.lastChar.toString(`base64`,0,3-this.lastNeed):t}function _(e){return e.toString(this.encoding)}function v(e){return e&&e.length?this.write(e):``}})),ma=n(((e,t)=>{let n=aa(),{PromisePrototypeThen:r,SymbolAsyncIterator:a,SymbolIterator:o}=Qi(),{Buffer:s}=i(),{ERR_INVALID_ARG_TYPE:c,ERR_STREAM_NULL_VALUES:l}=ea().codes;function u(e,t,i){let u;if(typeof t==`string`||t instanceof s)return new e({objectMode:!0,...i,read(){this.push(t),this.push(null)}});let d;if(t&&t[a])d=!0,u=t[a]();else if(t&&t[o])d=!1,u=t[o]();else throw new c(`iterable`,[`Iterable`],t);let f=new e({objectMode:!0,highWaterMark:1,...i}),p=!1;f._read=function(){p||(p=!0,h())},f._destroy=function(e,t){r(m(e),()=>n.nextTick(t,e),r=>n.nextTick(t,r||e))};async function m(e){let t=e!=null,n=typeof u.throw==`function`;if(t&&n){let{value:t,done:n}=await u.throw(e);if(await t,n)return}if(typeof u.return==`function`){let{value:e}=await u.return();await e}}async function h(){for(;;){try{let{value:e,done:t}=d?await u.next():u.next();if(t)f.push(null);else{let t=e&&typeof e.then==`function`?await e:e;if(t===null)throw p=!1,new l;if(f.push(t))continue;p=!1}}catch(e){f.destroy(e)}break}}return f}t.exports=u})),ha=n(((e,t)=>{let n=aa(),{ArrayPrototypeIndexOf:r,NumberIsInteger:a,NumberIsNaN:o,NumberParseInt:s,ObjectDefineProperties:c,ObjectKeys:l,ObjectSetPrototypeOf:u,Promise:d,SafeSet:f,SymbolAsyncDispose:p,SymbolAsyncIterator:m,Symbol:h}=Qi();t.exports=L,L.ReadableState=ae;let{EventEmitter:g}=na(),{Stream:_,prependListener:v}=la(),{Buffer:y}=i(),{addAbortSignal:b}=ua(),x=sa(),S=ra().debuglog(`stream`,e=>{S=e}),C=da(),w=ca(),{getHighWaterMark:T,getDefaultHighWaterMark:ee}=fa(),{aggregateTwoErrors:te,codes:{ERR_INVALID_ARG_TYPE:ne,ERR_METHOD_NOT_IMPLEMENTED:E,ERR_OUT_OF_RANGE:D,ERR_STREAM_PUSH_AFTER_EOF:O,ERR_STREAM_UNSHIFT_AFTER_END_EVENT:re},AbortError:k}=ea(),{validateObject:A}=ia(),j=h(`kPaused`),{StringDecoder:M}=pa(),N=ma();u(L.prototype,_.prototype),u(L,_);let P=()=>{},{errorOrDestroy:F}=w,ie=65536;function I(e){return{enumerable:!1,get(){return(this.state&e)!==0},set(t){t?this.state|=e:this.state&=~e}}}c(ae.prototype,{objectMode:I(1),ended:I(2),endEmitted:I(4),reading:I(8),constructed:I(16),sync:I(32),needReadable:I(64),emittedReadable:I(128),readableListening:I(256),resumeScheduled:I(512),errorEmitted:I(1024),emitClose:I(2048),autoDestroy:I(4096),destroyed:I(8192),closed:I(16384),closeEmitted:I(32768),multiAwaitDrain:I(ie),readingMore:I(131072),dataEmitted:I(262144)});function ae(e,t,n){typeof n!=`boolean`&&(n=t instanceof va()),this.state=6192,e&&e.objectMode&&(this.state|=1),n&&e&&e.readableObjectMode&&(this.state|=1),this.highWaterMark=e?T(this,e,`readableHighWaterMark`,n):ee(!1),this.buffer=new C,this.length=0,this.pipes=[],this.flowing=null,this[j]=null,e&&e.emitClose===!1&&(this.state&=-2049),e&&e.autoDestroy===!1&&(this.state&=-4097),this.errored=null,this.defaultEncoding=e&&e.defaultEncoding||`utf8`,this.awaitDrainWriters=null,this.decoder=null,this.encoding=null,e&&e.encoding&&(this.decoder=new M(e.encoding),this.encoding=e.encoding)}function L(e){if(!(this instanceof L))return new L(e);let t=this instanceof va();this._readableState=new ae(e,this,t),e&&(typeof e.read==`function`&&(this._read=e.read),typeof e.destroy==`function`&&(this._destroy=e.destroy),typeof e.construct==`function`&&(this._construct=e.construct),e.signal&&!t&&b(e.signal,this)),_.call(this,e),w.construct(this,()=>{this._readableState.needReadable&&de(this,this._readableState)})}L.prototype.destroy=w.destroy,L.prototype._undestroy=w.undestroy,L.prototype._destroy=function(e,t){t(e)},L.prototype[g.captureRejectionSymbol]=function(e){this.destroy(e)},L.prototype[p]=function(){let e;return this.destroyed||(e=this.readableEnded?null:new k,this.destroy(e)),new d((t,n)=>x(this,r=>r&&r!==e?n(r):t(null)))},L.prototype.push=function(e,t){return oe(this,e,t,!1)},L.prototype.unshift=function(e,t){return oe(this,e,t,!0)};function oe(e,t,n,r){S(`readableAddChunk`,t);let i=e._readableState,a;if(i.state&1||(typeof t==`string`?(n||=i.defaultEncoding,i.encoding!==n&&(r&&i.encoding?t=y.from(t,n).toString(i.encoding):(t=y.from(t,n),n=``))):t instanceof y?n=``:_._isUint8Array(t)?(t=_._uint8ArrayToBuffer(t),n=``):t!=null&&(a=new ne(`chunk`,[`string`,`Buffer`,`Uint8Array`],t))),a)F(e,a);else if(t===null)i.state&=-9,R(e,i);else if(i.state&1||t&&t.length>0)if(r)if(i.state&4)F(e,new re);else if(i.destroyed||i.errored)return!1;else se(e,i,t,!0);else if(i.ended)F(e,new O);else if(i.destroyed||i.errored)return!1;else i.state&=-9,i.decoder&&!n?(t=i.decoder.write(t),i.objectMode||t.length!==0?se(e,i,t,!1):de(e,i)):se(e,i,t,!1);else r||(i.state&=-9,de(e,i));return!i.ended&&(i.length<i.highWaterMark||i.length===0)}function se(e,t,n,r){t.flowing&&t.length===0&&!t.sync&&e.listenerCount(`data`)>0?(t.state&ie?t.awaitDrainWriters.clear():t.awaitDrainWriters=null,t.dataEmitted=!0,e.emit(`data`,n)):(t.length+=t.objectMode?1:n.length,r?t.buffer.unshift(n):t.buffer.push(n),t.state&64&&z(e)),de(e,t)}L.prototype.isPaused=function(){let e=this._readableState;return e[j]===!0||e.flowing===!1},L.prototype.setEncoding=function(e){let t=new M(e);this._readableState.decoder=t,this._readableState.encoding=this._readableState.decoder.encoding;let n=this._readableState.buffer,r=``;for(let e of n)r+=t.write(e);return n.clear(),r!==``&&n.push(r),this._readableState.length=r.length,this};function ce(e){if(e>1073741824)throw new D(`size`,`<= 1GiB`,e);return e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++,e}function le(e,t){return e<=0||t.length===0&&t.ended?0:t.state&1?1:o(e)?t.flowing&&t.length?t.buffer.first().length:t.length:e<=t.length?e:t.ended?t.length:0}L.prototype.read=function(e){S(`read`,e),e===void 0?e=NaN:a(e)||(e=s(e,10));let t=this._readableState,n=e;if(e>t.highWaterMark&&(t.highWaterMark=ce(e)),e!==0&&(t.state&=-129),e===0&&t.needReadable&&((t.highWaterMark===0?t.length>0:t.length>=t.highWaterMark)||t.ended))return S(`read: emitReadable`,t.length,t.ended),t.length===0&&t.ended?Se(this):z(this),null;if(e=le(e,t),e===0&&t.ended)return t.length===0&&Se(this),null;let r=(t.state&64)!=0;if(S(`need readable`,r),(t.length===0||t.length-e<t.highWaterMark)&&(r=!0,S(`length less than watermark`,r)),t.ended||t.reading||t.destroyed||t.errored||!t.constructed)r=!1,S(`reading, ended or constructing`,r);else if(r){S(`do read`),t.state|=40,t.length===0&&(t.state|=64);try{this._read(t.highWaterMark)}catch(e){F(this,e)}t.state&=-33,t.reading||(e=le(n,t))}let i;return i=e>0?xe(e,t):null,i===null?(t.needReadable=t.length<=t.highWaterMark,e=0):(t.length-=e,t.multiAwaitDrain?t.awaitDrainWriters.clear():t.awaitDrainWriters=null),t.length===0&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&Se(this)),i!==null&&!t.errorEmitted&&!t.closeEmitted&&(t.dataEmitted=!0,this.emit(`data`,i)),i};function R(e,t){if(S(`onEofChunk`),!t.ended){if(t.decoder){let e=t.decoder.end();e&&e.length&&(t.buffer.push(e),t.length+=t.objectMode?1:e.length)}t.ended=!0,t.sync?z(e):(t.needReadable=!1,t.emittedReadable=!0,ue(e))}}function z(e){let t=e._readableState;S(`emitReadable`,t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(S(`emitReadable`,t.flowing),t.emittedReadable=!0,n.nextTick(ue,e))}function ue(e){let t=e._readableState;S(`emitReadable_`,t.destroyed,t.length,t.ended),!t.destroyed&&!t.errored&&(t.length||t.ended)&&(e.emit(`readable`),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,ve(e)}function de(e,t){!t.readingMore&&t.constructed&&(t.readingMore=!0,n.nextTick(fe,e,t))}function fe(e,t){for(;!t.reading&&!t.ended&&(t.length<t.highWaterMark||t.flowing&&t.length===0);){let n=t.length;if(S(`maybeReadMore read 0`),e.read(0),n===t.length)break}t.readingMore=!1}L.prototype._read=function(e){throw new E(`_read()`)},L.prototype.pipe=function(e,t){let r=this,i=this._readableState;i.pipes.length===1&&(i.multiAwaitDrain||(i.multiAwaitDrain=!0,i.awaitDrainWriters=new f(i.awaitDrainWriters?[i.awaitDrainWriters]:[]))),i.pipes.push(e),S(`pipe count=%d opts=%j`,i.pipes.length,t);let a=(!t||t.end!==!1)&&e!==n.stdout&&e!==n.stderr?s:_;i.endEmitted?n.nextTick(a):r.once(`end`,a),e.on(`unpipe`,o);function o(e,t){S(`onunpipe`),e===r&&t&&t.hasUnpiped===!1&&(t.hasUnpiped=!0,u())}function s(){S(`onend`),e.end()}let c,l=!1;function u(){S(`cleanup`),e.removeListener(`close`,h),e.removeListener(`finish`,g),c&&e.removeListener(`drain`,c),e.removeListener(`error`,m),e.removeListener(`unpipe`,o),r.removeListener(`end`,s),r.removeListener(`end`,_),r.removeListener(`data`,p),l=!0,c&&i.awaitDrainWriters&&(!e._writableState||e._writableState.needDrain)&&c()}function d(){l||(i.pipes.length===1&&i.pipes[0]===e?(S(`false write response, pause`,0),i.awaitDrainWriters=e,i.multiAwaitDrain=!1):i.pipes.length>1&&i.pipes.includes(e)&&(S(`false write response, pause`,i.awaitDrainWriters.size),i.awaitDrainWriters.add(e)),r.pause()),c||(c=pe(r,e),e.on(`drain`,c))}r.on(`data`,p);function p(t){S(`ondata`);let n=e.write(t);S(`dest.write`,n),n===!1&&d()}function m(t){if(S(`onerror`,t),_(),e.removeListener(`error`,m),e.listenerCount(`error`)===0){let n=e._writableState||e._readableState;n&&!n.errorEmitted?F(e,t):e.emit(`error`,t)}}v(e,`error`,m);function h(){e.removeListener(`finish`,g),_()}e.once(`close`,h);function g(){S(`onfinish`),e.removeListener(`close`,h),_()}e.once(`finish`,g);function _(){S(`unpipe`),r.unpipe(e)}return e.emit(`pipe`,r),e.writableNeedDrain===!0?d():i.flowing||(S(`pipe resume`),r.resume()),e};function pe(e,t){return function(){let n=e._readableState;n.awaitDrainWriters===t?(S(`pipeOnDrain`,1),n.awaitDrainWriters=null):n.multiAwaitDrain&&(S(`pipeOnDrain`,n.awaitDrainWriters.size),n.awaitDrainWriters.delete(t)),(!n.awaitDrainWriters||n.awaitDrainWriters.size===0)&&e.listenerCount(`data`)&&e.resume()}}L.prototype.unpipe=function(e){let t=this._readableState,n={hasUnpiped:!1};if(t.pipes.length===0)return this;if(!e){let e=t.pipes;t.pipes=[],this.pause();for(let t=0;t<e.length;t++)e[t].emit(`unpipe`,this,{hasUnpiped:!1});return this}let i=r(t.pipes,e);return i===-1?this:(t.pipes.splice(i,1),t.pipes.length===0&&this.pause(),e.emit(`unpipe`,this,n),this)},L.prototype.on=function(e,t){let r=_.prototype.on.call(this,e,t),i=this._readableState;return e===`data`?(i.readableListening=this.listenerCount(`readable`)>0,i.flowing!==!1&&this.resume()):e===`readable`&&!i.endEmitted&&!i.readableListening&&(i.readableListening=i.needReadable=!0,i.flowing=!1,i.emittedReadable=!1,S(`on readable`,i.length,i.reading),i.length?z(this):i.reading||n.nextTick(he,this)),r},L.prototype.addListener=L.prototype.on,L.prototype.removeListener=function(e,t){let r=_.prototype.removeListener.call(this,e,t);return e===`readable`&&n.nextTick(me,this),r},L.prototype.off=L.prototype.removeListener,L.prototype.removeAllListeners=function(e){let t=_.prototype.removeAllListeners.apply(this,arguments);return(e===`readable`||e===void 0)&&n.nextTick(me,this),t};function me(e){let t=e._readableState;t.readableListening=e.listenerCount(`readable`)>0,t.resumeScheduled&&t[j]===!1?t.flowing=!0:e.listenerCount(`data`)>0?e.resume():t.readableListening||(t.flowing=null)}function he(e){S(`readable nexttick read 0`),e.read(0)}L.prototype.resume=function(){let e=this._readableState;return e.flowing||(S(`resume`),e.flowing=!e.readableListening,ge(this,e)),e[j]=!1,this};function ge(e,t){t.resumeScheduled||(t.resumeScheduled=!0,n.nextTick(_e,e,t))}function _e(e,t){S(`resume`,t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit(`resume`),ve(e),t.flowing&&!t.reading&&e.read(0)}L.prototype.pause=function(){return S(`call pause flowing=%j`,this._readableState.flowing),this._readableState.flowing!==!1&&(S(`pause`),this._readableState.flowing=!1,this.emit(`pause`)),this._readableState[j]=!0,this};function ve(e){let t=e._readableState;for(S(`flow`,t.flowing);t.flowing&&e.read()!==null;);}L.prototype.wrap=function(e){let t=!1;e.on(`data`,n=>{!this.push(n)&&e.pause&&(t=!0,e.pause())}),e.on(`end`,()=>{this.push(null)}),e.on(`error`,e=>{F(this,e)}),e.on(`close`,()=>{this.destroy()}),e.on(`destroy`,()=>{this.destroy()}),this._read=()=>{t&&e.resume&&(t=!1,e.resume())};let n=l(e);for(let t=1;t<n.length;t++){let r=n[t];this[r]===void 0&&typeof e[r]==`function`&&(this[r]=e[r].bind(e))}return this},L.prototype[m]=function(){return ye(this)},L.prototype.iterator=function(e){return e!==void 0&&A(e,`options`),ye(this,e)};function ye(e,t){typeof e.read!=`function`&&(e=L.wrap(e,{objectMode:!0}));let n=be(e,t);return n.stream=e,n}async function*be(e,t){let n=P;function r(t){this===e?(n(),n=P):n=t}e.on(`readable`,r);let i,a=x(e,{writable:!1},e=>{i=e?te(i,e):null,n(),n=P});try{for(;;){let t=e.destroyed?null:e.read();if(t!==null)yield t;else if(i)throw i;else if(i===null)return;else await new d(r)}}catch(e){throw i=te(i,e),i}finally{(i||t?.destroyOnReturn!==!1)&&(i===void 0||e._readableState.autoDestroy)?w.destroyer(e,null):(e.off(`readable`,r),a())}}c(L.prototype,{readable:{__proto__:null,get(){let e=this._readableState;return!!e&&e.readable!==!1&&!e.destroyed&&!e.errorEmitted&&!e.endEmitted},set(e){this._readableState&&(this._readableState.readable=!!e)}},readableDidRead:{__proto__:null,enumerable:!1,get:function(){return this._readableState.dataEmitted}},readableAborted:{__proto__:null,enumerable:!1,get:function(){return!!(this._readableState.readable!==!1&&(this._readableState.destroyed||this._readableState.errored)&&!this._readableState.endEmitted)}},readableHighWaterMark:{__proto__:null,enumerable:!1,get:function(){return this._readableState.highWaterMark}},readableBuffer:{__proto__:null,enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}},readableFlowing:{__proto__:null,enumerable:!1,get:function(){return this._readableState.flowing},set:function(e){this._readableState&&(this._readableState.flowing=e)}},readableLength:{__proto__:null,enumerable:!1,get(){return this._readableState.length}},readableObjectMode:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.objectMode:!1}},readableEncoding:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.encoding:null}},errored:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.errored:null}},closed:{__proto__:null,get(){return this._readableState?this._readableState.closed:!1}},destroyed:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.destroyed:!1},set(e){this._readableState&&(this._readableState.destroyed=e)}},readableEnded:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.endEmitted:!1}}}),c(ae.prototype,{pipesCount:{__proto__:null,get(){return this.pipes.length}},paused:{__proto__:null,get(){return this[j]!==!1},set(e){this[j]=!!e}}}),L._fromList=xe;function xe(e,t){if(t.length===0)return null;let n;return t.objectMode?n=t.buffer.shift():!e||e>=t.length?(n=t.decoder?t.buffer.join(``):t.buffer.length===1?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):n=t.buffer.consume(e,t.decoder),n}function Se(e){let t=e._readableState;S(`endReadable`,t.endEmitted),t.endEmitted||(t.ended=!0,n.nextTick(Ce,t,e))}function Ce(e,t){if(S(`endReadableNT`,e.endEmitted,e.length),!e.errored&&!e.closeEmitted&&!e.endEmitted&&e.length===0){if(e.endEmitted=!0,t.emit(`end`),t.writable&&t.allowHalfOpen===!1)n.nextTick(we,t);else if(e.autoDestroy){let e=t._writableState;(!e||e.autoDestroy&&(e.finished||e.writable===!1))&&t.destroy()}}}function we(e){e.writable&&!e.writableEnded&&!e.destroyed&&e.end()}L.from=function(e,t){return N(L,e,t)};let Te;function Ee(){return Te===void 0&&(Te={}),Te}L.fromWeb=function(e,t){return Ee().newStreamReadableFromReadableStream(e,t)},L.toWeb=function(e,t){return Ee().newReadableStreamFromStreamReadable(e,t)},L.wrap=function(e,t){return new L({objectMode:e.readableObjectMode??e.objectMode??!0,...t,destroy(t,n){w.destroyer(e,t),n(t)}}).wrap(e)}})),ga=n(((e,t)=>{let n=aa(),{ArrayPrototypeSlice:r,Error:a,FunctionPrototypeSymbolHasInstance:o,ObjectDefineProperty:s,ObjectDefineProperties:c,ObjectSetPrototypeOf:l,StringPrototypeToLowerCase:u,Symbol:d,SymbolHasInstance:f}=Qi();t.exports=A,A.WritableState=re;let{EventEmitter:p}=na(),m=la().Stream,{Buffer:h}=i(),g=ca(),{addAbortSignal:_}=ua(),{getHighWaterMark:v,getDefaultHighWaterMark:y}=fa(),{ERR_INVALID_ARG_TYPE:b,ERR_METHOD_NOT_IMPLEMENTED:x,ERR_MULTIPLE_CALLBACK:S,ERR_STREAM_CANNOT_PIPE:C,ERR_STREAM_DESTROYED:w,ERR_STREAM_ALREADY_FINISHED:T,ERR_STREAM_NULL_VALUES:ee,ERR_STREAM_WRITE_AFTER_END:te,ERR_UNKNOWN_ENCODING:ne}=ea().codes,{errorOrDestroy:E}=g;l(A.prototype,m.prototype),l(A,m);function D(){}let O=d(`kOnFinished`);function re(e,t,n){typeof n!=`boolean`&&(n=t instanceof va()),this.objectMode=!!(e&&e.objectMode),n&&(this.objectMode=this.objectMode||!!(e&&e.writableObjectMode)),this.highWaterMark=e?v(this,e,`writableHighWaterMark`,n):y(!1),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;let r=!!(e&&e.decodeStrings===!1);this.decodeStrings=!r,this.defaultEncoding=e&&e.defaultEncoding||`utf8`,this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=F.bind(void 0,t),this.writecb=null,this.writelen=0,this.afterWriteTickInfo=null,k(this),this.pendingcb=0,this.constructed=!0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!e||e.emitClose!==!1,this.autoDestroy=!e||e.autoDestroy!==!1,this.errored=null,this.closed=!1,this.closeEmitted=!1,this[O]=[]}function k(e){e.buffered=[],e.bufferedIndex=0,e.allBuffers=!0,e.allNoop=!0}re.prototype.getBuffer=function(){return r(this.buffered,this.bufferedIndex)},s(re.prototype,`bufferedRequestCount`,{__proto__:null,get(){return this.buffered.length-this.bufferedIndex}});function A(e){let t=this instanceof va();if(!t&&!o(A,this))return new A(e);this._writableState=new re(e,this,t),e&&(typeof e.write==`function`&&(this._write=e.write),typeof e.writev==`function`&&(this._writev=e.writev),typeof e.destroy==`function`&&(this._destroy=e.destroy),typeof e.final==`function`&&(this._final=e.final),typeof e.construct==`function`&&(this._construct=e.construct),e.signal&&_(e.signal,this)),m.call(this,e),g.construct(this,()=>{let e=this._writableState;e.writing||L(this,e),le(this,e)})}s(A,f,{__proto__:null,value:function(e){return o(this,e)?!0:this===A?e&&e._writableState instanceof re:!1}}),A.prototype.pipe=function(){E(this,new C)};function j(e,t,r,i){let a=e._writableState;if(typeof r==`function`)i=r,r=a.defaultEncoding;else{if(!r)r=a.defaultEncoding;else if(r!==`buffer`&&!h.isEncoding(r))throw new ne(r);typeof i!=`function`&&(i=D)}if(t===null)throw new ee;if(!a.objectMode)if(typeof t==`string`)a.decodeStrings!==!1&&(t=h.from(t,r),r=`buffer`);else if(t instanceof h)r=`buffer`;else if(m._isUint8Array(t))t=m._uint8ArrayToBuffer(t),r=`buffer`;else throw new b(`chunk`,[`string`,`Buffer`,`Uint8Array`],t);let o;return a.ending?o=new te:a.destroyed&&(o=new w(`write`)),o?(n.nextTick(i,o),E(e,o,!0),o):(a.pendingcb++,M(e,a,t,r,i))}A.prototype.write=function(e,t,n){return j(this,e,t,n)===!0},A.prototype.cork=function(){this._writableState.corked++},A.prototype.uncork=function(){let e=this._writableState;e.corked&&(e.corked--,e.writing||L(this,e))},A.prototype.setDefaultEncoding=function(e){if(typeof e==`string`&&(e=u(e)),!h.isEncoding(e))throw new ne(e);return this._writableState.defaultEncoding=e,this};function M(e,t,n,r,i){let a=t.objectMode?1:n.length;t.length+=a;let o=t.length<t.highWaterMark;return o||(t.needDrain=!0),t.writing||t.corked||t.errored||!t.constructed?(t.buffered.push({chunk:n,encoding:r,callback:i}),t.allBuffers&&r!==`buffer`&&(t.allBuffers=!1),t.allNoop&&i!==D&&(t.allNoop=!1)):(t.writelen=a,t.writecb=i,t.writing=!0,t.sync=!0,e._write(n,r,t.onwrite),t.sync=!1),o&&!t.errored&&!t.destroyed}function N(e,t,n,r,i,a,o){t.writelen=r,t.writecb=o,t.writing=!0,t.sync=!0,t.destroyed?t.onwrite(new w(`write`)):n?e._writev(i,t.onwrite):e._write(i,a,t.onwrite),t.sync=!1}function P(e,t,n,r){--t.pendingcb,r(n),ae(t),E(e,n)}function F(e,t){let r=e._writableState,i=r.sync,a=r.writecb;if(typeof a!=`function`){E(e,new S);return}r.writing=!1,r.writecb=null,r.length-=r.writelen,r.writelen=0,t?(t.stack,r.errored||=t,e._readableState&&!e._readableState.errored&&(e._readableState.errored=t),i?n.nextTick(P,e,r,t,a):P(e,r,t,a)):(r.buffered.length>r.bufferedIndex&&L(e,r),i?r.afterWriteTickInfo!==null&&r.afterWriteTickInfo.cb===a?r.afterWriteTickInfo.count++:(r.afterWriteTickInfo={count:1,cb:a,stream:e,state:r},n.nextTick(ie,r.afterWriteTickInfo)):I(e,r,1,a))}function ie({stream:e,state:t,count:n,cb:r}){return t.afterWriteTickInfo=null,I(e,t,n,r)}function I(e,t,n,r){for(!t.ending&&!e.destroyed&&t.length===0&&t.needDrain&&(t.needDrain=!1,e.emit(`drain`));n-- >0;)t.pendingcb--,r();t.destroyed&&ae(t),le(e,t)}function ae(e){if(e.writing)return;for(let t=e.bufferedIndex;t<e.buffered.length;++t){let{chunk:n,callback:r}=e.buffered[t],i=e.objectMode?1:n.length;e.length-=i,r(e.errored??new w(`write`))}let t=e[O].splice(0);for(let n=0;n<t.length;n++)t[n](e.errored??new w(`end`));k(e)}function L(e,t){if(t.corked||t.bufferProcessing||t.destroyed||!t.constructed)return;let{buffered:n,bufferedIndex:i,objectMode:a}=t,o=n.length-i;if(!o)return;let s=i;if(t.bufferProcessing=!0,o>1&&e._writev){t.pendingcb-=o-1;let i=t.allNoop?D:e=>{for(let t=s;t<n.length;++t)n[t].callback(e)},a=t.allNoop&&s===0?n:r(n,s);a.allBuffers=t.allBuffers,N(e,t,!0,t.length,a,``,i),k(t)}else{do{let{chunk:r,encoding:i,callback:o}=n[s];n[s++]=null,N(e,t,!1,a?1:r.length,r,i,o)}while(s<n.length&&!t.writing);s===n.length?k(t):s>256?(n.splice(0,s),t.bufferedIndex=0):t.bufferedIndex=s}t.bufferProcessing=!1}A.prototype._write=function(e,t,n){if(this._writev)this._writev([{chunk:e,encoding:t}],n);else throw new x(`_write()`)},A.prototype._writev=null,A.prototype.end=function(e,t,r){let i=this._writableState;typeof e==`function`?(r=e,e=null,t=null):typeof t==`function`&&(r=t,t=null);let o;if(e!=null){let n=j(this,e,t);n instanceof a&&(o=n)}return i.corked&&(i.corked=1,this.uncork()),o||(!i.errored&&!i.ending?(i.ending=!0,le(this,i,!0),i.ended=!0):i.finished?o=new T(`end`):i.destroyed&&(o=new w(`end`))),typeof r==`function`&&(o||i.finished?n.nextTick(r,o):i[O].push(r)),this};function oe(e){return e.ending&&!e.destroyed&&e.constructed&&e.length===0&&!e.errored&&e.buffered.length===0&&!e.finished&&!e.writing&&!e.errorEmitted&&!e.closeEmitted}function se(e,t){let r=!1;function i(i){if(r){E(e,i??S());return}if(r=!0,t.pendingcb--,i){let n=t[O].splice(0);for(let e=0;e<n.length;e++)n[e](i);E(e,i,t.sync)}else oe(t)&&(t.prefinished=!0,e.emit(`prefinish`),t.pendingcb++,n.nextTick(R,e,t))}t.sync=!0,t.pendingcb++;try{e._final(i)}catch(e){i(e)}t.sync=!1}function ce(e,t){!t.prefinished&&!t.finalCalled&&(typeof e._final==`function`&&!t.destroyed?(t.finalCalled=!0,se(e,t)):(t.prefinished=!0,e.emit(`prefinish`)))}function le(e,t,r){oe(t)&&(ce(e,t),t.pendingcb===0&&(r?(t.pendingcb++,n.nextTick((e,t)=>{oe(t)?R(e,t):t.pendingcb--},e,t)):oe(t)&&(t.pendingcb++,R(e,t))))}function R(e,t){t.pendingcb--,t.finished=!0;let n=t[O].splice(0);for(let e=0;e<n.length;e++)n[e]();if(e.emit(`finish`),t.autoDestroy){let t=e._readableState;(!t||t.autoDestroy&&(t.endEmitted||t.readable===!1))&&e.destroy()}}c(A.prototype,{closed:{__proto__:null,get(){return this._writableState?this._writableState.closed:!1}},destroyed:{__proto__:null,get(){return this._writableState?this._writableState.destroyed:!1},set(e){this._writableState&&(this._writableState.destroyed=e)}},writable:{__proto__:null,get(){let e=this._writableState;return!!e&&e.writable!==!1&&!e.destroyed&&!e.errored&&!e.ending&&!e.ended},set(e){this._writableState&&(this._writableState.writable=!!e)}},writableFinished:{__proto__:null,get(){return this._writableState?this._writableState.finished:!1}},writableObjectMode:{__proto__:null,get(){return this._writableState?this._writableState.objectMode:!1}},writableBuffer:{__proto__:null,get(){return this._writableState&&this._writableState.getBuffer()}},writableEnded:{__proto__:null,get(){return this._writableState?this._writableState.ending:!1}},writableNeedDrain:{__proto__:null,get(){let e=this._writableState;return e?!e.destroyed&&!e.ending&&e.needDrain:!1}},writableHighWaterMark:{__proto__:null,get(){return this._writableState&&this._writableState.highWaterMark}},writableCorked:{__proto__:null,get(){return this._writableState?this._writableState.corked:0}},writableLength:{__proto__:null,get(){return this._writableState&&this._writableState.length}},errored:{__proto__:null,enumerable:!1,get(){return this._writableState?this._writableState.errored:null}},writableAborted:{__proto__:null,enumerable:!1,get:function(){return!!(this._writableState.writable!==!1&&(this._writableState.destroyed||this._writableState.errored)&&!this._writableState.finished)}}});let z=g.destroy;A.prototype.destroy=function(e,t){let r=this._writableState;return!r.destroyed&&(r.bufferedIndex<r.buffered.length||r[O].length)&&n.nextTick(ae,r),z.call(this,e,t),this},A.prototype._undestroy=g.undestroy,A.prototype._destroy=function(e,t){t(e)},A.prototype[p.captureRejectionSymbol]=function(e){this.destroy(e)};let ue;function de(){return ue===void 0&&(ue={}),ue}A.fromWeb=function(e,t){return de().newStreamWritableFromWritableStream(e,t)},A.toWeb=function(e){return de().newWritableStreamFromStreamWritable(e)}})),_a=n(((e,t)=>{let n=aa(),r=i(),{isReadable:a,isWritable:o,isIterable:s,isNodeStream:c,isReadableNodeStream:l,isWritableNodeStream:u,isDuplexNodeStream:d,isReadableStream:f,isWritableStream:p}=oa(),m=sa(),{AbortError:h,codes:{ERR_INVALID_ARG_TYPE:g,ERR_INVALID_RETURN_VALUE:_}}=ea(),{destroyer:v}=ca(),y=va(),b=ha(),x=ga(),{createDeferredPromise:S}=ra(),C=ma(),w=globalThis.Blob||r.Blob,T=w===void 0?function(e){return!1}:function(e){return e instanceof w},ee=globalThis.AbortController||ta().AbortController,{FunctionPrototypeCall:te}=Qi();var ne=class extends y{constructor(e){super(e),e?.readable===!1&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),e?.writable===!1&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)}};t.exports=function e(t,r){if(d(t))return t;if(l(t))return D({readable:t});if(u(t))return D({writable:t});if(c(t))return D({writable:!1,readable:!1});if(f(t))return D({readable:b.fromWeb(t)});if(p(t))return D({writable:x.fromWeb(t)});if(typeof t==`function`){let{value:e,write:i,final:a,destroy:o}=E(t);if(s(e))return C(ne,e,{objectMode:!0,write:i,final:a,destroy:o});let c=e?.then;if(typeof c==`function`){let t,r=te(c,e,e=>{if(e!=null)throw new _(`nully`,`body`,e)},e=>{v(t,e)});return t=new ne({objectMode:!0,readable:!1,write:i,final(e){a(async()=>{try{await r,n.nextTick(e,null)}catch(t){n.nextTick(e,t)}})},destroy:o})}throw new _(`Iterable, AsyncIterable or AsyncFunction`,r,e)}if(T(t))return e(t.arrayBuffer());if(s(t))return C(ne,t,{objectMode:!0,writable:!1});if(f(t?.readable)&&p(t?.writable))return ne.fromWeb(t);if(typeof t?.writable==`object`||typeof t?.readable==`object`)return D({readable:t!=null&&t.readable?l(t?.readable)?t?.readable:e(t.readable):void 0,writable:t!=null&&t.writable?u(t?.writable)?t?.writable:e(t.writable):void 0});let i=t?.then;if(typeof i==`function`){let e;return te(i,t,t=>{t!=null&&e.push(t),e.push(null)},t=>{v(e,t)}),e=new ne({objectMode:!0,writable:!1,read(){}})}throw new g(r,[`Blob`,`ReadableStream`,`WritableStream`,`Stream`,`Iterable`,`AsyncIterable`,`Function`,`{ readable, writable } pair`,`Promise`],t)};function E(e){let{promise:t,resolve:r}=S(),i=new ee,a=i.signal;return{value:e((async function*(){for(;;){let e=t;t=null;let{chunk:i,done:o,cb:s}=await e;if(n.nextTick(s),o)return;if(a.aborted)throw new h(void 0,{cause:a.reason});({promise:t,resolve:r}=S()),yield i}})(),{signal:a}),write(e,t,n){let i=r;r=null,i({chunk:e,done:!1,cb:n})},final(e){let t=r;r=null,t({done:!0,cb:e})},destroy(e,t){i.abort(),t(e)}}}function D(e){let t=e.readable&&typeof e.readable.read!=`function`?b.wrap(e.readable):e.readable,n=e.writable,r=!!a(t),i=!!o(n),s,c,l,u,d;function f(e){let t=u;u=null,t?t(e):e&&d.destroy(e)}return d=new ne({readableObjectMode:!!(t!=null&&t.readableObjectMode),writableObjectMode:!!(n!=null&&n.writableObjectMode),readable:r,writable:i}),i&&(m(n,e=>{i=!1,e&&v(t,e),f(e)}),d._write=function(e,t,r){n.write(e,t)?r():s=r},d._final=function(e){n.end(),c=e},n.on(`drain`,function(){if(s){let e=s;s=null,e()}}),n.on(`finish`,function(){if(c){let e=c;c=null,e()}})),r&&(m(t,e=>{r=!1,e&&v(t,e),f(e)}),t.on(`readable`,function(){if(l){let e=l;l=null,e()}}),t.on(`end`,function(){d.push(null)}),d._read=function(){for(;;){let e=t.read();if(e===null){l=d._read;return}if(!d.push(e))return}}),d._destroy=function(e,r){!e&&u!==null&&(e=new h),l=null,s=null,c=null,u===null?r(e):(u=r,v(n,e),v(t,e))},d}})),va=n(((e,t)=>{let{ObjectDefineProperties:n,ObjectGetOwnPropertyDescriptor:r,ObjectKeys:i,ObjectSetPrototypeOf:a}=Qi();t.exports=c;let o=ha(),s=ga();a(c.prototype,o.prototype),a(c,o);{let e=i(s.prototype);for(let t=0;t<e.length;t++){let n=e[t];c.prototype[n]||(c.prototype[n]=s.prototype[n])}}function c(e){if(!(this instanceof c))return new c(e);o.call(this,e),s.call(this,e),e?(this.allowHalfOpen=e.allowHalfOpen!==!1,e.readable===!1&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),e.writable===!1&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)):this.allowHalfOpen=!0}n(c.prototype,{writable:{__proto__:null,...r(s.prototype,`writable`)},writableHighWaterMark:{__proto__:null,...r(s.prototype,`writableHighWaterMark`)},writableObjectMode:{__proto__:null,...r(s.prototype,`writableObjectMode`)},writableBuffer:{__proto__:null,...r(s.prototype,`writableBuffer`)},writableLength:{__proto__:null,...r(s.prototype,`writableLength`)},writableFinished:{__proto__:null,...r(s.prototype,`writableFinished`)},writableCorked:{__proto__:null,...r(s.prototype,`writableCorked`)},writableEnded:{__proto__:null,...r(s.prototype,`writableEnded`)},writableNeedDrain:{__proto__:null,...r(s.prototype,`writableNeedDrain`)},destroyed:{__proto__:null,get(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set(e){this._readableState&&this._writableState&&(this._readableState.destroyed=e,this._writableState.destroyed=e)}}});let l;function u(){return l===void 0&&(l={}),l}c.fromWeb=function(e,t){return u().newStreamDuplexFromReadableWritablePair(e,t)},c.toWeb=function(e){return u().newReadableWritablePairFromDuplex(e)};let d;c.from=function(e){return d||=_a(),d(e,`body`)}})),ya=n(((e,t)=>{let{ObjectSetPrototypeOf:n,Symbol:r}=Qi();t.exports=c;let{ERR_METHOD_NOT_IMPLEMENTED:i}=ea().codes,a=va(),{getHighWaterMark:o}=fa();n(c.prototype,a.prototype),n(c,a);let s=r(`kCallback`);function c(e){if(!(this instanceof c))return new c(e);let t=e?o(this,e,`readableHighWaterMark`,!0):null;t===0&&(e={...e,highWaterMark:null,readableHighWaterMark:t,writableHighWaterMark:e.writableHighWaterMark||0}),a.call(this,e),this._readableState.sync=!1,this[s]=null,e&&(typeof e.transform==`function`&&(this._transform=e.transform),typeof e.flush==`function`&&(this._flush=e.flush)),this.on(`prefinish`,u)}function l(e){typeof this._flush==`function`&&!this.destroyed?this._flush((t,n)=>{if(t){e?e(t):this.destroy(t);return}n!=null&&this.push(n),this.push(null),e&&e()}):(this.push(null),e&&e())}function u(){this._final!==l&&l.call(this)}c.prototype._final=l,c.prototype._transform=function(e,t,n){throw new i(`_transform()`)},c.prototype._write=function(e,t,n){let r=this._readableState,i=this._writableState,a=r.length;this._transform(e,t,(e,t)=>{if(e){n(e);return}t!=null&&this.push(t),i.ended||a===r.length||r.length<r.highWaterMark?n():this[s]=n})},c.prototype._read=function(){if(this[s]){let e=this[s];this[s]=null,e()}}})),ba=n(((e,t)=>{let{ObjectSetPrototypeOf:n}=Qi();t.exports=i;let r=ya();n(i.prototype,r.prototype),n(i,r);function i(e){if(!(this instanceof i))return new i(e);r.call(this,e)}i.prototype._transform=function(e,t,n){n(null,e)}})),xa=n(((e,t)=>{let n=aa(),{ArrayIsArray:r,Promise:i,SymbolAsyncIterator:a,SymbolDispose:o}=Qi(),s=sa(),{once:c}=ra(),l=ca(),u=va(),{aggregateTwoErrors:d,codes:{ERR_INVALID_ARG_TYPE:f,ERR_INVALID_RETURN_VALUE:p,ERR_MISSING_ARGS:m,ERR_STREAM_DESTROYED:h,ERR_STREAM_PREMATURE_CLOSE:g},AbortError:_}=ea(),{validateFunction:v,validateAbortSignal:y}=ia(),{isIterable:b,isReadable:x,isReadableNodeStream:S,isNodeStream:C,isTransformStream:w,isWebStream:T,isReadableStream:ee,isReadableFinished:te}=oa(),ne=globalThis.AbortController||ta().AbortController,E,D,O;function re(e,t,n){let r=!1;return e.on(`close`,()=>{r=!0}),{destroy:t=>{r||(r=!0,l.destroyer(e,t||new h(`pipe`)))},cleanup:s(e,{readable:t,writable:n},e=>{r=!e})}}function k(e){return v(e[e.length-1],`streams[stream.length - 1]`),e.pop()}function A(e){if(b(e))return e;if(S(e))return j(e);throw new f(`val`,[`Readable`,`Iterable`,`AsyncIterable`],e)}async function*j(e){D||=ha(),yield*D.prototype[a].call(e)}async function M(e,t,n,{end:r}){let a,o=null,c=e=>{if(e&&(a=e),o){let e=o;o=null,e()}},l=()=>new i((e,t)=>{a?t(a):o=()=>{a?t(a):e()}});t.on(`drain`,c);let u=s(t,{readable:!1},c);try{t.writableNeedDrain&&await l();for await(let n of e)t.write(n)||await l();r&&(t.end(),await l()),n()}catch(e){n(a===e?e:d(a,e))}finally{u(),t.off(`drain`,c)}}async function N(e,t,n,{end:r}){w(t)&&(t=t.writable);let i=t.getWriter();try{for await(let t of e)await i.ready,i.write(t).catch(()=>{});await i.ready,r&&await i.close(),n()}catch(e){try{await i.abort(e),n(e)}catch(e){n(e)}}}function P(...e){return F(e,c(k(e)))}function F(e,t,i){if(e.length===1&&r(e[0])&&(e=e[0]),e.length<2)throw new m(`streams`);let a=new ne,s=a.signal,c=i?.signal,l=[];y(c,`options.signal`);function d(){j(new _)}O||=ra().addAbortListener;let h;c&&(h=O(c,d));let g,v,te=[],D=0;function k(e){j(e,--D===0)}function j(e,r){var i;if(e&&(!g||g.code===`ERR_STREAM_PREMATURE_CLOSE`)&&(g=e),!(!g&&!r)){for(;te.length;)te.shift()(g);(i=h)==null||i[o](),a.abort(),r&&(g||l.forEach(e=>e()),n.nextTick(t,g,v))}}let P;for(let t=0;t<e.length;t++){let r=e[t],a=t<e.length-1,o=t>0,c=a||i?.end!==!1,d=t===e.length-1;if(C(r)){if(c){let{destroy:e,cleanup:t}=re(r,a,o);te.push(e),x(r)&&d&&l.push(t)}function e(e){e&&e.name!==`AbortError`&&e.code!==`ERR_STREAM_PREMATURE_CLOSE`&&k(e)}r.on(`error`,e),x(r)&&d&&l.push(()=>{r.removeListener(`error`,e)})}if(t===0)if(typeof r==`function`){if(P=r({signal:s}),!b(P))throw new p(`Iterable, AsyncIterable or Stream`,`source`,P)}else P=b(r)||S(r)||w(r)?r:u.from(r);else if(typeof r==`function`)if(P=w(P)?A(P?.readable):A(P),P=r(P,{signal:s}),a){if(!b(P,!0))throw new p(`AsyncIterable`,`transform[${t-1}]`,P)}else{E||=ba();let e=new E({objectMode:!0}),t=P?.then;if(typeof t==`function`)D++,t.call(P,t=>{v=t,t!=null&&e.write(t),c&&e.end(),n.nextTick(k)},t=>{e.destroy(t),n.nextTick(k,t)});else if(b(P,!0))D++,M(P,e,k,{end:c});else if(ee(P)||w(P)){let t=P.readable||P;D++,M(t,e,k,{end:c})}else throw new p(`AsyncIterable or Promise`,`destination`,P);P=e;let{destroy:r,cleanup:i}=re(P,!1,!0);te.push(r),d&&l.push(i)}else if(C(r)){if(S(P)){D+=2;let e=ie(P,r,k,{end:c});x(r)&&d&&l.push(e)}else if(w(P)||ee(P)){let e=P.readable||P;D++,M(e,r,k,{end:c})}else if(b(P))D++,M(P,r,k,{end:c});else throw new f(`val`,[`Readable`,`Iterable`,`AsyncIterable`,`ReadableStream`,`TransformStream`],P);P=r}else if(T(r)){if(S(P))D++,N(A(P),r,k,{end:c});else if(ee(P)||b(P))D++,N(P,r,k,{end:c});else if(w(P))D++,N(P.readable,r,k,{end:c});else throw new f(`val`,[`Readable`,`Iterable`,`AsyncIterable`,`ReadableStream`,`TransformStream`],P);P=r}else P=u.from(r)}return(s!=null&&s.aborted||c!=null&&c.aborted)&&n.nextTick(d),P}function ie(e,t,r,{end:i}){let a=!1;if(t.on(`close`,()=>{a||r(new g)}),e.pipe(t,{end:!1}),i){function r(){a=!0,t.end()}te(e)?n.nextTick(r):e.once(`end`,r)}else r();return s(e,{readable:!0,writable:!1},t=>{let n=e._readableState;t&&t.code===`ERR_STREAM_PREMATURE_CLOSE`&&n&&n.ended&&!n.errored&&!n.errorEmitted?e.once(`end`,r).once(`error`,r):r(t)}),s(t,{readable:!1,writable:!0},r)}t.exports={pipelineImpl:F,pipeline:P}})),Sa=n(((e,t)=>{let{pipeline:n}=xa(),r=va(),{destroyer:i}=ca(),{isNodeStream:a,isReadable:o,isWritable:s,isWebStream:c,isTransformStream:l,isWritableStream:u,isReadableStream:d}=oa(),{AbortError:f,codes:{ERR_INVALID_ARG_VALUE:p,ERR_MISSING_ARGS:m}}=ea(),h=sa();t.exports=function(...e){if(e.length===0)throw new m(`streams`);if(e.length===1)return r.from(e[0]);let t=[...e];if(typeof e[0]==`function`&&(e[0]=r.from(e[0])),typeof e[e.length-1]==`function`){let t=e.length-1;e[t]=r.from(e[t])}for(let n=0;n<e.length;++n)if(!(!a(e[n])&&!c(e[n]))){if(n<e.length-1&&!(o(e[n])||d(e[n])||l(e[n])))throw new p(`streams[${n}]`,t[n],`must be readable`);if(n>0&&!(s(e[n])||u(e[n])||l(e[n])))throw new p(`streams[${n}]`,t[n],`must be writable`)}let g,_,v,y,b;function x(e){let t=y;y=null,t?t(e):e?b.destroy(e):!T&&!w&&b.destroy()}let S=e[0],C=n(e,x),w=!!(s(S)||u(S)||l(S)),T=!!(o(C)||d(C)||l(C));if(b=new r({writableObjectMode:!!(S!=null&&S.writableObjectMode),readableObjectMode:!!(C!=null&&C.readableObjectMode),writable:w,readable:T}),w){if(a(S))b._write=function(e,t,n){S.write(e,t)?n():g=n},b._final=function(e){S.end(),_=e},S.on(`drain`,function(){if(g){let e=g;g=null,e()}});else if(c(S)){let e=(l(S)?S.writable:S).getWriter();b._write=async function(t,n,r){try{await e.ready,e.write(t).catch(()=>{}),r()}catch(e){r(e)}},b._final=async function(t){try{await e.ready,e.close().catch(()=>{}),_=t}catch(e){t(e)}}}h(l(C)?C.readable:C,()=>{if(_){let e=_;_=null,e()}})}if(T){if(a(C))C.on(`readable`,function(){if(v){let e=v;v=null,e()}}),C.on(`end`,function(){b.push(null)}),b._read=function(){for(;;){let e=C.read();if(e===null){v=b._read;return}if(!b.push(e))return}};else if(c(C)){let e=(l(C)?C.readable:C).getReader();b._read=async function(){for(;;)try{let{value:t,done:n}=await e.read();if(!b.push(t))return;if(n){b.push(null);return}}catch{return}}}}return b._destroy=function(e,t){!e&&y!==null&&(e=new f),v=null,g=null,_=null,y===null?t(e):(y=t,a(C)&&i(C,e))},b}})),Ca=n(((e,t)=>{let n=globalThis.AbortController||ta().AbortController,{codes:{ERR_INVALID_ARG_VALUE:r,ERR_INVALID_ARG_TYPE:i,ERR_MISSING_ARGS:a,ERR_OUT_OF_RANGE:o},AbortError:s}=ea(),{validateAbortSignal:c,validateInteger:l,validateObject:u}=ia(),d=Qi().Symbol(`kWeak`),f=Qi().Symbol(`kResistStopPropagation`),{finished:p}=sa(),m=Sa(),{addAbortSignalNoValidate:h}=ua(),{isWritable:g,isNodeStream:_}=oa(),{deprecate:v}=ra(),{ArrayPrototypePush:y,Boolean:b,MathFloor:x,Number:S,NumberIsNaN:C,Promise:w,PromiseReject:T,PromiseResolve:ee,PromisePrototypeThen:te,Symbol:ne}=Qi(),E=ne(`kEmpty`),D=ne(`kEof`);function O(e,t){if(t!=null&&u(t,`options`),t?.signal!=null&&c(t.signal,`options.signal`),_(e)&&!g(e))throw new r(`stream`,e,`must be writable`);let n=m(this,e);return t!=null&&t.signal&&h(t.signal,n),n}function re(e,t){if(typeof e!=`function`)throw new i(`fn`,[`Function`,`AsyncFunction`],e);t!=null&&u(t,`options`),t?.signal!=null&&c(t.signal,`options.signal`);let n=1;t?.concurrency!=null&&(n=x(t.concurrency));let r=n-1;return t?.highWaterMark!=null&&(r=x(t.highWaterMark)),l(n,`options.concurrency`,1),l(r,`options.highWaterMark`,0),r+=n,async function*(){let i=ra().AbortSignalAny([t?.signal].filter(b)),a=this,o=[],c={signal:i},l,u,d=!1,f=0;function p(){d=!0,m()}function m(){--f,h()}function h(){u&&!d&&f<n&&o.length<r&&(u(),u=null)}async function g(){try{for await(let t of a){if(d)return;if(i.aborted)throw new s;try{if(t=e(t,c),t===E)continue;t=ee(t)}catch(e){t=T(e)}f+=1,te(t,m,p),o.push(t),l&&=(l(),null),!d&&(o.length>=r||f>=n)&&await new w(e=>{u=e})}o.push(D)}catch(e){let t=T(e);te(t,m,p),o.push(t)}finally{d=!0,l&&=(l(),null)}}g();try{for(;;){for(;o.length>0;){let e=await o[0];if(e===D)return;if(i.aborted)throw new s;e!==E&&(yield e),o.shift(),h()}await new w(e=>{l=e})}}finally{d=!0,u&&=(u(),null)}}.call(this)}function k(e=void 0){return e!=null&&u(e,`options`),e?.signal!=null&&c(e.signal,`options.signal`),async function*(){let t=0;for await(let r of this){var n;if(e!=null&&(n=e.signal)!=null&&n.aborted)throw new s({cause:e.signal.reason});yield[t++,r]}}.call(this)}async function A(e,t=void 0){for await(let n of P.call(this,e,t))return!0;return!1}async function j(e,t=void 0){if(typeof e!=`function`)throw new i(`fn`,[`Function`,`AsyncFunction`],e);return!await A.call(this,async(...t)=>!await e(...t),t)}async function M(e,t){for await(let n of P.call(this,e,t))return n}async function N(e,t){if(typeof e!=`function`)throw new i(`fn`,[`Function`,`AsyncFunction`],e);async function n(t,n){return await e(t,n),E}for await(let e of re.call(this,n,t));}function P(e,t){if(typeof e!=`function`)throw new i(`fn`,[`Function`,`AsyncFunction`],e);async function n(t,n){return await e(t,n)?t:E}return re.call(this,n,t)}var F=class extends a{constructor(){super(`reduce`),this.message=`Reduce of an empty stream requires an initial value`}};async function ie(e,t,r){var a;if(typeof e!=`function`)throw new i(`reducer`,[`Function`,`AsyncFunction`],e);r!=null&&u(r,`options`),r?.signal!=null&&c(r.signal,`options.signal`);let o=arguments.length>1;if(r!=null&&(a=r.signal)!=null&&a.aborted){let e=new s(void 0,{cause:r.signal.reason});throw this.once(`error`,()=>{}),await p(this.destroy(e)),e}let l=new n,m=l.signal;if(r!=null&&r.signal){let e={once:!0,[d]:this,[f]:!0};r.signal.addEventListener(`abort`,()=>l.abort(),e)}let h=!1;try{for await(let n of this){var g;if(h=!0,r!=null&&(g=r.signal)!=null&&g.aborted)throw new s;o?t=await e(t,n,{signal:m}):(t=n,o=!0)}if(!h&&!o)throw new F}finally{l.abort()}return t}async function I(e){e!=null&&u(e,`options`),e?.signal!=null&&c(e.signal,`options.signal`);let t=[];for await(let r of this){var n;if(e!=null&&(n=e.signal)!=null&&n.aborted)throw new s(void 0,{cause:e.signal.reason});y(t,r)}return t}function ae(e,t){let n=re.call(this,e,t);return async function*(){for await(let e of n)yield*e}.call(this)}function L(e){if(e=S(e),C(e))return 0;if(e<0)throw new o(`number`,`>= 0`,e);return e}function oe(e,t=void 0){return t!=null&&u(t,`options`),t?.signal!=null&&c(t.signal,`options.signal`),e=L(e),async function*(){var n;if(t!=null&&(n=t.signal)!=null&&n.aborted)throw new s;for await(let n of this){var r;if(t!=null&&(r=t.signal)!=null&&r.aborted)throw new s;e--<=0&&(yield n)}}.call(this)}function se(e,t=void 0){return t!=null&&u(t,`options`),t?.signal!=null&&c(t.signal,`options.signal`),e=L(e),async function*(){var n;if(t!=null&&(n=t.signal)!=null&&n.aborted)throw new s;for await(let n of this){var r;if(t!=null&&(r=t.signal)!=null&&r.aborted)throw new s;if(e-- >0&&(yield n),e<=0)return}}.call(this)}t.exports.streamReturningOperators={asIndexedPairs:v(k,`readable.asIndexedPairs will be removed in a future version.`),drop:oe,filter:P,flatMap:ae,map:re,take:se,compose:O},t.exports.promiseReturningOperators={every:j,forEach:N,reduce:ie,toArray:I,some:A,find:M}})),wa=n(((e,t)=>{let{ArrayPrototypePop:n,Promise:r}=Qi(),{isIterable:i,isNodeStream:a,isWebStream:o}=oa(),{pipelineImpl:s}=xa(),{finished:c}=sa();Ta();function l(...e){return new r((t,r)=>{let c,l,u=e[e.length-1];if(u&&typeof u==`object`&&!a(u)&&!i(u)&&!o(u)){let t=n(e);c=t.signal,l=t.end}s(e,(e,n)=>{e?r(e):t(n)},{signal:c,end:l})})}t.exports={finished:c,pipeline:l}})),Ta=n(((e,t)=>{let{Buffer:n}=i(),{ObjectDefineProperty:r,ObjectKeys:a,ReflectApply:o}=Qi(),{promisify:{custom:s}}=ra(),{streamReturningOperators:c,promiseReturningOperators:l}=Ca(),{codes:{ERR_ILLEGAL_CONSTRUCTOR:u}}=ea(),d=Sa(),{setDefaultHighWaterMark:f,getDefaultHighWaterMark:p}=fa(),{pipeline:m}=xa(),{destroyer:h}=ca(),g=sa(),_=wa(),v=oa(),y=t.exports=la().Stream;y.isDestroyed=v.isDestroyed,y.isDisturbed=v.isDisturbed,y.isErrored=v.isErrored,y.isReadable=v.isReadable,y.isWritable=v.isWritable,y.Readable=ha();for(let e of a(c)){let t=c[e];function n(...e){if(new.target)throw u();return y.Readable.from(o(t,this,e))}r(n,`name`,{__proto__:null,value:t.name}),r(n,`length`,{__proto__:null,value:t.length}),r(y.Readable.prototype,e,{__proto__:null,value:n,enumerable:!1,configurable:!0,writable:!0})}for(let e of a(l)){let t=l[e];function n(...e){if(new.target)throw u();return o(t,this,e)}r(n,`name`,{__proto__:null,value:t.name}),r(n,`length`,{__proto__:null,value:t.length}),r(y.Readable.prototype,e,{__proto__:null,value:n,enumerable:!1,configurable:!0,writable:!0})}y.Writable=ga(),y.Duplex=va(),y.Transform=ya(),y.PassThrough=ba(),y.pipeline=m;let{addAbortSignal:b}=ua();y.addAbortSignal=b,y.finished=g,y.destroy=h,y.compose=d,y.setDefaultHighWaterMark=f,y.getDefaultHighWaterMark=p,r(y,`promises`,{__proto__:null,configurable:!0,enumerable:!0,get(){return _}}),r(m,s,{__proto__:null,enumerable:!0,get(){return _.pipeline}}),r(g,s,{__proto__:null,enumerable:!0,get(){return _.finished}}),y.Stream=y,y._isUint8Array=function(e){return e instanceof Uint8Array},y._uint8ArrayToBuffer=function(e){return n.from(e.buffer,e.byteOffset,e.byteLength)}})),Ea=n(((e,t)=>{let n=Ta(),r=wa(),i=n.Readable.destroy;t.exports=n.Readable,t.exports._uint8ArrayToBuffer=n._uint8ArrayToBuffer,t.exports._isUint8Array=n._isUint8Array,t.exports.isDisturbed=n.isDisturbed,t.exports.isErrored=n.isErrored,t.exports.isReadable=n.isReadable,t.exports.Readable=n.Readable,t.exports.Writable=n.Writable,t.exports.Duplex=n.Duplex,t.exports.Transform=n.Transform,t.exports.PassThrough=n.PassThrough,t.exports.addAbortSignal=n.addAbortSignal,t.exports.finished=n.finished,t.exports.destroy=n.destroy,t.exports.destroy=i,t.exports.pipeline=n.pipeline,t.exports.compose=n.compose,Object.defineProperty(n,"promises",{configurable:!0,enumerable:!0,get(){return r}}),t.exports.Stream=n.Stream,t.exports.default=t.exports}))(),Da=class extends Ea.Readable{pending=!0;_path=`<unknown>`;_bytesRead=0;reader;ready;constructor(e={},t){super({...e,encoding:e.encoding??void 0}),this.ready=Promise.resolve(t).then(t=>{this._path=t.vfs.path;let n=t.readableWebStream({start:e.start,end:e.end});this.reader=n.getReader(),this.pending=!1}).catch(e=>{this.destroy(e)})}async _read(){try{if(await this.ready,!this.reader)return;let{done:e,value:t}=await this.reader.read();if(e){this.push(null);return}this._bytesRead+=t.byteLength,this.push(t)}catch(e){this.destroy(new A(O.EIO,e.toString()))}}close(e=()=>null){try{this.destroy(),this.emit(`close`),e(null)}catch(t){e(new A(O.EIO,t.toString()))}}get path(){return this._path}get bytesRead(){return this._bytesRead}wrap(e){return super.wrap(e),this}},Oa=class extends Ea.Writable{pending=!0;_path=`<unknown>`;_bytesWritten=0;writer;ready;constructor(e={},t){super(e),this.ready=Promise.resolve(t).then(t=>{this._path=t.vfs.path;let n=t.writableWebStream({start:e.start});this.writer=n.getWriter(),this.pending=!1}).catch(e=>this.destroy(e))}async _write(e,t,n){if(await this.ready,!this.writer)return n(z(j(`EAGAIN`,`write`,this._path)));if(t!=`buffer`)return n(z(j(`ENOTSUP`,`write`,this._path)));let r=new Uint8Array(e.buffer,e.byteOffset,e.byteLength);try{await this.writer.write(r),this._bytesWritten+=e.byteLength,n()}catch(e){n(new A(O.EIO,e.toString()))}}async _final(e){if(await this.ready,!this.writer)return e();try{await this.writer.close(),e()}catch(t){e(new A(O.EIO,t.toString()))}}close(e=()=>null){try{this.destroy(),this.emit(`close`),e(null)}catch(t){e(new A(O.EIO,t.toString()))}}get path(){return this._path}get bytesWritten(){return this._bytesWritten}},ka=t({FileHandle:()=>Ma,access:()=>ro,appendFile:()=>Ha,chmod:()=>Za,chown:()=>Ya,constants:()=>ze,copyFile:()=>so,cp:()=>lo,exists:()=>Pa,glob:()=>fo,lchmod:()=>Qa,lchown:()=>Xa,link:()=>Ka,lstat:()=>Ia,lutimes:()=>eo,mkdir:()=>Wa,mkdtemp:()=>ao,mkdtempDisposable:()=>oo,open:()=>za,opendir:()=>co,readFile:()=>Ba,readdir:()=>Ga,readlink:()=>Ja,realpath:()=>to,rename:()=>Na,rm:()=>io,rmdir:()=>Ua,stat:()=>Fa,statfs:()=>uo,symlink:()=>qa,truncate:()=>La,unlink:()=>Ra,utimes:()=>$a,watch:()=>no,writeFile:()=>Va}),Aa=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},ja=(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}),Ma=class{context;fd;vfs;constructor(e,t){this.context=e,this.fd=t,this.vfs=pr(e,t)}_emitChange(){zi(this.context,`change`,this.vfs.path)}async chown(e,t){await this.vfs.chown(e,t),this._emitChange()}async chmod(e){let t=Xt(e,-1);if(t<0)throw j(`EINVAL`,`chmod`,this.vfs.path);await this.vfs.chmod(t),this._emitChange()}datasync(){return this.sync()}async sync(){await this.vfs.sync()}async truncate(e=0){await this.vfs.truncate(e),this._emitChange()}async utimes(e,t){e=Zt(e),t=Zt(t),await this.vfs.utimes(e,t),this._emitChange()}async appendFile(e,t={}){let n=Qt(t,`utf8`,`a`,420);if(!(gr(n.flag)&1024))throw j(`EBADF`,`write`,this.vfs.path);let r=typeof e==`string`?ar.Buffer.from(e,n.encoding):e;await this.vfs.write(r,0,r.length),this._emitChange()}async read(e,t,n,r){if(typeof t==`object`&&t&&(r=t.position,n=t.length,t=t.offset),!ArrayBuffer.isView(e)&&typeof e==`object`&&(r=e.position,n=e.length,t=e.offset,e=e.buffer),r&&r>2**53-1)throw j(`EINVAL`);return typeof r==`bigint`&&(r=Number(r)),r=Number.isSafeInteger(r)?r:this.vfs.position,e||=new Uint8Array(this.vfs.inode.size),t??=0,{bytesRead:await this.vfs.read(e,t,n??e.byteLength-t,r),buffer:e}}async readFile(e){let t=Qt(e,null,`r`,292);if(gr(t.flag)&1)throw j(`EBADF`,`read`,this.vfs.path);let{size:n}=await this.stat(),r=new Uint8Array(n);await this.vfs.read(r,0,n,0);let i=ar.Buffer.from(r);return t.encoding?i.toString(t.encoding):i}readableWebStream(e={}){if(this.vfs.isClosed)throw j(`EBADF`,`readableWebStream`,this.vfs.path);return this.vfs.fs.streamRead(this.vfs.internalPath,e)}writableWebStream(e={}){if(this.vfs.isClosed)throw j(`EBADF`,`writableWebStream`,this.vfs.path);if(this.vfs.inode.flags&On.Immutable)throw j(`EPERM`,`writableWebStream`,this.vfs.path);return this.vfs.fs.streamWrite(this.vfs.internalPath,e)}readLines(e){if(this.vfs.isClosed||this.vfs.flag&1)throw j(`EBADF`,`read`,this.vfs.path);return Yi({input:this.createReadStream(e),crlfDelay:1/0})}[Symbol.asyncDispose](){return this.close()}async stat(e){if(this.vfs.isClosed)throw j(`EBADF`,`stat`,this.vfs.path);if(J&&!q(this.context,this.vfs.inode,4))throw j(`EACCES`,`stat`,this.vfs.path);return e?.bigint?new yn(this.vfs.inode):new vn(this.vfs.inode)}async write(e,t,n,r){let i,a,o;typeof t==`object`&&t&&(n=t.length,r=t.position,t=t.offset),typeof e==`string`?(r=typeof t==`number`?t:null,a=0,i=ar.Buffer.from(e,typeof n==`string`?n:`utf8`),o=i.length):(i=new Uint8Array(e.buffer,e.byteOffset,e.byteLength),a=t??0,o=typeof n==`number`?n:i.byteLength,r=typeof r==`number`?r:null),r??=this.vfs.position;let s=await this.vfs.write(i,a,o,r);return this._emitChange(),{buffer:e,bytesWritten:s}}async writeFile(e,t={}){let n=Qt(t,`utf8`,`w`,420),r=gr(n.flag);if(!(r&1||r&2))throw j(`EBADF`,`writeFile`,this.vfs.path);let i=typeof e==`string`?ar.Buffer.from(e,n.encoding):e;await this.vfs.write(i,0,i.length,0),this._emitChange()}async close(){await this.vfs.close(),mr(this.context,this.fd)}async writev(e,t){typeof t==`number`&&(this.vfs.position=t);let n=0;for(let t of e)n+=(await this.write(t)).bytesWritten;return{bytesWritten:n,buffers:e}}async readv(e,t){typeof t==`number`&&(this.vfs.position=t);let n=0;for(let t of e)n+=(await this.read(t)).bytesRead;return{bytesRead:n,buffers:e}}createReadStream(e={}){if(this.vfs.isClosed||this.vfs.flag&1)throw j(`EBADF`,`createReadStream`,this.vfs.path);return new Da(e,this)}createWriteStream(e={}){if(this.vfs.isClosed)throw j(`EBADF`,`createWriteStream`,this.vfs.path);if(this.vfs.inode.flags&On.Immutable)throw j(`EPERM`,`createWriteStream`,this.vfs.path);if(this.vfs.fs.attributes.has(`readonly`))throw j(`EROFS`,`createWriteStream`,this.vfs.path);return new Oa(e,this)}};async function Na(e,t){await Gi.call(this,e,t)}async function Pa(e){e=H(e);try{let{fs:t,path:n}=await Bi(this,e);return await t.exists(n)}catch(e){if(e instanceof A&&e.code==`ENOENT`)return!1;throw e}}async function Fa(e,t){let n=await qi.call(this,e,!1);return t?.bigint?new yn(n):new vn(n)}async function Ia(e,t){let n=await qi.call(this,e,!0);return t?.bigint?new yn(n):new vn(n)}async function La(e,t=0){let n={stack:[],error:void 0,hasError:!1};try{await Aa(n,await za.call(this,e,`r+`),!0).truncate(t)}catch(e){n.error=e,n.hasError=!0}finally{let e=ja(n);e&&await e}}async function Ra(e){e=H(e);let{fs:t,path:n}=Y(e,this),r={syscall:`unlink`,path:e},i=await t.stat(n).catch(N(r));if(J&&!q(this,i,2))throw j(`EACCES`,r);await t.unlink(n).catch(N(r)),zi(this,`rename`,e.toString())}async function za(e,t=`r`,n=420){let r=await Vi(this,e,{flag:t,mode:n});return new Ma(this,fr(r))}async function Ba(e,t){let n={stack:[],error:void 0,hasError:!1};try{let r=Qt(t,null,`r`,292);return await Aa(n,typeof e==`object`&&`fd`in e?e:await za.call(this,e,r.flag,r.mode),!0).readFile(r)}catch(e){n.error=e,n.hasError=!0}finally{let e=ja(n);e&&await e}}async function Va(e,t,n){let r={stack:[],error:void 0,hasError:!1};try{let i=Qt(n,`utf8`,`w+`,420),a=Aa(r,e instanceof Ma?e:await za.call(this,e.toString(),i.flag,i.mode),!0),o=typeof t==`string`?t:t instanceof DataView?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):t;if(typeof o!=`string`&&!(o instanceof Uint8Array))throw TypeError(`The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView. Received `+typeof t);await a.writeFile(o,i)}catch(e){r.error=e,r.hasError=!0}finally{let e=ja(r);e&&await e}}async function Ha(e,t,n){let r={stack:[],error:void 0,hasError:!1};try{let i=Qt(n,`utf8`,`a`,420),a=gr(i.flag),o={syscall:`write`,path:e instanceof Ma?e.vfs.path:e.toString()};if(!(a&1024))throw j(`EBADF`,o);let s=typeof t==`string`?ar.Buffer.from(t,i.encoding):new Uint8Array(t.buffer,t.byteOffset,t.byteLength);await Aa(r,typeof e==`object`&&`fd`in e?e:await za.call(this,e,i.flag,i.mode),!0).appendFile(s,i)}catch(e){r.error=e,r.hasError=!0}finally{let e=ja(r);e&&await e}}async function Ua(e){e=H(e);let{fs:t,path:n}=await Bi(this,e),r={syscall:`rmdir`,path:e},i=await t.stat(n).catch(N(r));if(!i)throw j(`ENOENT`,r);if(!An(i))throw j(`ENOTDIR`,r);if(J&&!q(this,i,2))throw j(`EACCES`,r);await t.rmdir(n).catch(N(r)),zi(this,`rename`,e.toString())}async function Wa(e,t){t=typeof t==`object`?t:{mode:t};let n=Xt(t?.mode,511);return await Ui.call(this,e,{...t,mode:n})}async function Ga(e,t){e=H(e);let n=typeof t==`object`&&t?t:{encoding:t,withFileTypes:!1,recursive:!1},r=await Wi.call(this,e,n),i=[];for(let e of r)n.withFileTypes?i.push(Rr.from(e,n.encoding)):n.encoding==`buffer`?i.push(ar.Buffer.from(e.path)):i.push(e.path);return i}async function Ka(e,t){return await Ki.call(this,e,t)}async function qa(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);if(t=H(t),await Pa.call(this,t))throw j(`EEXIST`,`symlink`,t);let i=Aa(r,await Vi(this,t,{flag:`w+`,mode:420,preserveSymlinks:!0}),!0),a=w(H(e,!0));await i.write(a,0,a.length,0),await i.chmod(Ze)}catch(e){r.error=e,r.hasError=!0}finally{let e=ja(r);e&&await e}}async function Ja(e,t){e=H(e);let n=ar.Buffer.from(await Hi.call(this,e),`utf-8`),r=typeof t==`object`?t?.encoding:t;return r==`buffer`?n:n.toString(r??`utf-8`)}async function Ya(e,t,n){let r={stack:[],error:void 0,hasError:!1};try{await Aa(r,await za.call(this,e,`r+`),!0).chown(t,n)}catch(e){r.error=e,r.hasError=!0}finally{let e=ja(r);e&&await e}}async function Xa(e,t,n){let r={stack:[],error:void 0,hasError:!1};try{await Aa(r,await Vi(this,e,{flag:`r+`,mode:420,preserveSymlinks:!0,allowDirectory:!0}),!0).chown(t,n)}catch(e){r.error=e,r.hasError=!0}finally{let e=ja(r);e&&await e}}async function Za(e,t){let n={stack:[],error:void 0,hasError:!1};try{await Aa(n,await za.call(this,e,`r+`),!0).chmod(t)}catch(e){n.error=e,n.hasError=!0}finally{let e=ja(n);e&&await e}}async function Qa(e,t){let n={stack:[],error:void 0,hasError:!1};try{t=Xt(t),await Aa(n,await Vi(this,e,{flag:`r+`,mode:420,preserveSymlinks:!0,allowDirectory:!0}),!0).chmod(t)}catch(e){n.error=e,n.hasError=!0}finally{let e=ja(n);e&&await e}}async function $a(e,t,n){let r={stack:[],error:void 0,hasError:!1};try{await Aa(r,await Vi(this,e,{flag:`r+`,allowDirectory:!0}),!0).utimes(Zt(t),Zt(n))}catch(e){r.error=e,r.hasError=!0}finally{let e=ja(r);e&&await e}}async function eo(e,t,n){let r={stack:[],error:void 0,hasError:!1};try{await Aa(r,await Vi(this,e,{flag:`r+`,mode:420,preserveSymlinks:!0,allowDirectory:!0}),!0).utimes(Zt(t),Zt(n))}catch(e){r.error=e,r.hasError=!0}finally{let e=ja(r);e&&await e}}async function to(e,t){let n=typeof t==`string`?t:t?.encoding??`utf8`;e=H(e);let{fullPath:r}=await Bi(this,e);if(n==`utf8`||n==`utf-8`)return r;let i=ar.Buffer.from(r,`utf-8`);return n==`buffer`?i:i.toString(n)}function no(e,t={}){let n=new Pi(this,e.toString(),typeof t==`string`?{encoding:t}:t),r=[],i=!1;n.on(`change`,(e,t)=>{r.shift()?.({value:{eventType:e,filename:t},done:!1})});function a(){i=!0,n.close();for(let e of r)e({value:null,done:i});return r.length=0,Promise.resolve({value:void 0,done:!0})}return{async next(){if(i)return Promise.resolve({value:void 0,done:i});let{promise:e,resolve:t}=Promise.withResolvers();return r.push(t),e},return:a,throw:a,async[Symbol.asyncDispose](){await a()},[Symbol.asyncIterator](){return this}}}async function ro(e,t=0){if(J&&!(await Fa.call(this,e)).hasAccess(t,this))throw j(`EACCES`,`access`,e.toString())}async function io(e,t){e=H(e);let n=await Ia.call(this,e).catch(e=>{if(!(e.code==`ENOENT`&&t?.force))throw e});if(n)switch(n.mode&Ye){case et:if(t?.recursive)for(let n of await Ga.call(this,e))await io.call(this,U(e,n),t);await Ua.call(this,e);break;case Qe:case Ze:case $e:case tt:await Ra.call(this,e);break;case nt:case Xe:default:throw j(`ENOSYS`,`rm`,e)}}async function ao(e,t){let n=typeof t==`object`?t?.encoding:t||`utf8`,r=tn(e);return await Wa.call(this,r),n==`buffer`?ar.Buffer.from(r):r}async function oo(e,t){let n=tn(e);await Wa.call(this,n);let r=()=>io(n,{recursive:!0,force:!0});return{path:n,remove:r,[Symbol.asyncDispose]:r}}async function so(e,t,n){if(e=H(e),t=H(t),n&&n&1&&await Pa.call(this,t))throw j(`EEXIST`,`copyFile`,t);await Va.call(this,t,await Ba.call(this,e)),zi(this,`rename`,t.toString())}function co(e,t){return e=H(e),Promise.resolve(new zr(e,this))}async function lo(e,t,n){e=H(e),t=H(t);let r=await Ia.call(this,e);if(n?.errorOnExist&&await Pa.call(this,t))throw j(`EEXIST`,`cp`,t);switch(r.mode&Ye){case et:{if(!n?.recursive)throw j(`EISDIR`,`cp`,e);let[r]=await Promise.all([Ga.call(this,e,{withFileTypes:!0}),Wa.call(this,t,{recursive:!0})]);await Promise.all(r.map(async r=>{n.filter&&!n.filter(U(e,r.name),U(t,r.name))||await lo.call(this,U(e,r.name),U(t,r.name),n)}));break}case Qe:case Ze:await so.call(this,e,t);break;case $e:case tt:case nt:case Xe:default:throw j(`ENOSYS`,`cp`,e)}n?.preserveTimestamps&&await $a.call(this,t,r.atime,r.mtime)}async function uo(e,t){e=H(e);let{fs:n}=Y(e,this);return Promise.resolve(Er(n,t?.bigint))}function fo(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($t);async function*l(e){let t=await Ga(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=>hn(e,t)))continue;let a=t.replace(/^\/+/g,``);(await Fa(t)).isDirectory()&&(o||s.some(e=>a===e||e.startsWith(a+`/`)))&&(yield*l(t)),c.some(e=>e.test(a))&&(yield r?n:a)}}return l(n instanceof URL?n.pathname:n)}function po(e,t){t.disableAsyncCache&&e.attributes.set(`no_async_preload`),t.caseFold&&e.attributes.set(`case_fold`,t.caseFold)}function mo(e){return je(e)||De(e)||e instanceof zn}function ho(e){return typeof e?.then==`function`}async function go(e,t=0){if(typeof e!=`object`||!e)throw R(M(`EINVAL`,`Invalid options on mount configuration`));if(!mo(e))throw R(M(`EINVAL`,`Invalid mount configuration`));if(e instanceof zn)return await e.ready(),e;De(e)&&(e={backend:e});for(let[n,r]of Object.entries(e))if(n!=`backend`&&mo(r)){if(de(`Resolving nested mount configuration: `+n),t>10)throw R(M(`EINVAL`,`Invalid configuration, too deep and possibly infinite`));e[n]=await go(r,++t)}let{backend:n}=e;if(typeof n.isAvailable==`function`&&!await n.isAvailable(e))throw R(M(`EPERM`,`Backend not available: `+n.name));Ae(n,e);let r=await n.create(e);return po(r,e),await r.ready(),r}function _o(e,t=0){if(typeof e!=`object`||!e)throw R(M(`EINVAL`,`Invalid options on mount configuration`));if(!mo(e))throw R(M(`EINVAL`,`Invalid mount configuration`));if(e instanceof zn)return e.readySync(),e;De(e)&&(e={backend:e});for(let[n,r]of Object.entries(e))if(n!=`backend`&&mo(r)){if(de(`Resolving nested mount configuration: `+n),t>10)throw R(M(`EINVAL`,`Invalid configuration, too deep and possibly infinite`));e[n]=_o(r,++t)}let{backend:n}=e;if(typeof n.isAvailable==`function`){let t=n.isAvailable(e);if(ho(t))throw R(M(`EAGAIN`,`Backend availability check would block: `+n.name));if(!t)throw R(M(`EPERM`,`Backend not available: `+n.name))}Ae(n,e);let r=n.create(e);if(ho(r))throw R(M(`EAGAIN`,`Backend initialization would block: `+n.name));let i=r;return po(i,e),i.readySync(),i}async function vo(e){if(!mo(e))throw TypeError(`Invalid single mount point configuration`);let t=await go(e);Tr(`/`),wr(`/`,t)}function yo(e){if(!mo(e))throw TypeError(`Invalid single mount point configuration`);let t=_o(e);Tr(`/`),wr(`/`,t)}async function bo(e,t){if(e==`/`){wr(e,t);return}let n=await Fa(e).catch(()=>null);if(!n)await Wa(e,{recursive:!0});else if(!n.isDirectory())throw M(`ENOTDIR`,`Missing directory at mount point: `+e);wr(e,t)}function xo(e,t){if(e==`/`){wr(e,t);return}let n=null;try{n=Wr(e)}catch(e){if(e?.code!=`ENOENT`)throw e}if(!n)ui(e,{recursive:!0});else if(!n.isDirectory())throw M(`ENOTDIR`,`Missing directory at mount point: `+e);wr(e,t)}function So(e,t){let n=Cr.get(`/dev`);if(!(n instanceof Zn))throw le(M(`ENOTSUP`,`/dev does not exist or is not a device file system`));return n._createDevice(e,t)}const Co=[`/tmp`,`/var`,`/etc`];async function wo(e){if(Object.assign(Fe.credentials,Me({uid:e.uid||0,gid:e.gid||0})),or(!e.disableAccessChecks),e.log&&Ee(e.log),e.mounts)for(let[t,n]of Object.entries(e.mounts).sort(([e],[t])=>e.length>t.length?1:-1)){let r=t.startsWith(`/`)?t:`/`+t;je(n)&&(n.disableAsyncCache??=e.disableAsyncCache||!1,n.caseFold??=e.caseFold),r==`/`&&Tr(`/`),await bo(r,await go(n))}for(let t of Cr.values())po(t,e);if(e.addDevices&&!Cr.has(`/dev`)){let e=new Zn;e.addDefaults(),await e.ready(),await bo(`/dev`,e)}if(e.defaultDirectories)for(let e of Co)await Pa(e)?(await Fa(e)).isDirectory()||z(`Default directory exists but is not a directory: `+e):await Wa(e)}function To(e){if(Object.assign(Fe.credentials,Me({uid:e.uid||0,gid:e.gid||0})),or(!e.disableAccessChecks),e.log&&Ee(e.log),e.mounts)for(let[t,n]of Object.entries(e.mounts).sort(([e],[t])=>e.length>t.length?1:-1)){let r=t.startsWith(`/`)?t:`/`+t;je(n)&&(n.disableAsyncCache??=e.disableAsyncCache||!1,n.caseFold??=e.caseFold),r==`/`&&Tr(`/`),xo(r,_o(n))}for(let t of Cr.values())po(t,e);if(e.addDevices&&!Cr.has(`/dev`)){let e=new Zn;e.addDefaults(),e.readySync(),xo(`/dev`,e)}if(e.defaultDirectories)for(let e of Co){if(Ur(e)){Wr(e).isDirectory()||z(`Default directory exists but is not a directory: `+e);continue}ui(e)}}async function Eo(){for(let e of Cr.values())await e.sync()}const Do=new Set([`delete`]);function Oo(e){return Do.has(e)}const ko=Math.max(...Do.values().map(e=>e.length)),Ao=`#journal@v0
|
|
6
6
|
`;var jo=class extends u.default{entries=[];toString(){return Ao+this.entries.map(e=>`${e.op.padEnd(ko)} ${e.path}`).join(`
|
|
7
7
|
`)}fromString(e){if(!e.startsWith(Ao))throw R(M(`EINVAL`,`Invalid journal contents, refusing to parse`));for(let t of e.split(`
|
|
8
8
|
`)){if(t.startsWith(`#`))continue;let[e,n]=t.split(/\s+/);if(!Oo(e)){z(`Unknown operation in journal (skipping): `+e);continue}this.entries.push({op:e,path:n})}return this}add(e,t){this.entries.push({op:e,path:t}),this.emit(`update`,e,t),this.emit(e,t)}has(e,t){let n=JSON.stringify({op:e,path:t});for(let e of this.entries)if(JSON.stringify(e)===n)return!0;return!1}isDeleted(e){let t=!1;for(let n of this.entries)if(n.path==e)switch(n.op){case`delete`:t=!0}return t}},Mo=class extends zn{readable;writable;journal;async ready(){await this.readable.ready(),await this.writable.ready()}readySync(){this.readable.readySync(),this.writable.readySync()}constructor(e,t,n=new jo){if(super(1651862636,e.name),this.readable=e,this.writable=t,this.journal=n,t.attributes.has(`no_write`))throw R(M(`EINVAL`,`Writable file system can not be written to`));e.attributes.set(`no_write`)}isDeleted(e){return this.journal.isDeleted(e)}usage(){return this.readable.usage()}async sync(){await this.writable.sync()}syncSync(){this.writable.syncSync()}async read(e,t,n,r){return await this.writable.exists(e)?await this.writable.read(e,t,n,r):await this.readable.read(e,t,n,r)}readSync(e,t,n,r){return this.writable.existsSync(e)?this.writable.readSync(e,t,n,r):this.readable.readSync(e,t,n,r)}async write(e,t,n){return await this.copyForWrite(e),await this.writable.write(e,t,n)}writeSync(e,t,n){return this.copyForWriteSync(e),this.writable.writeSync(e,t,n)}async rename(e,t){await this.copyForWrite(e);try{await this.writable.rename(e,t)}catch{if(this.isDeleted(e))throw M(`ENOENT`)}}renameSync(e,t){this.copyForWriteSync(e);try{this.writable.renameSync(e,t)}catch{if(this.isDeleted(e))throw M(`ENOENT`)}}async stat(e){try{return await this.writable.stat(e)}catch{if(this.isDeleted(e))throw M(`ENOENT`);return await this.readable.stat(e)}}statSync(e){try{return this.writable.statSync(e)}catch{if(this.isDeleted(e))throw M(`ENOENT`);return this.readable.statSync(e)}}async touch(e,t){await this.copyForWrite(e),await this.writable.touch(e,t)}touchSync(e,t){this.copyForWriteSync(e),this.writable.touchSync(e,t)}async createFile(e,t){return await this.createParentDirectories(e),await this.writable.createFile(e,t)}createFileSync(e,t){return this.createParentDirectoriesSync(e),this.writable.createFileSync(e,t)}async link(e,t){await this.copyForWrite(e),await this.writable.link(e,t)}linkSync(e,t){this.copyForWriteSync(e),this.writable.linkSync(e,t)}async unlink(e){if(!await this.exists(e))throw M(`ENOENT`);await this.writable.exists(e)&&await this.writable.unlink(e),await this.exists(e)&&this.journal.add(`delete`,e)}unlinkSync(e){if(!this.existsSync(e))throw M(`ENOENT`);this.writable.existsSync(e)&&this.writable.unlinkSync(e),this.existsSync(e)&&this.journal.add(`delete`,e)}async rmdir(e){if(!await this.exists(e))throw M(`ENOENT`);if(await this.writable.exists(e)&&await this.writable.rmdir(e),await this.exists(e)){if((await this.readdir(e)).length)throw M(`ENOTEMPTY`);this.journal.add(`delete`,e)}}rmdirSync(e){if(!this.existsSync(e))throw M(`ENOENT`);if(this.writable.existsSync(e)&&this.writable.rmdirSync(e),this.existsSync(e)){if(this.readdirSync(e).length)throw M(`ENOTEMPTY`);this.journal.add(`delete`,e)}}async mkdir(e,t){if(await this.exists(e))throw M(`EEXIST`);return await this.createParentDirectories(e),await this.writable.mkdir(e,t)}mkdirSync(e,t){if(this.existsSync(e))throw M(`EEXIST`);return this.createParentDirectoriesSync(e),this.writable.mkdirSync(e,t)}async readdir(e){if(this.isDeleted(e)||!await this.exists(e))throw M(`ENOENT`);let t=await this.readable.exists(e)?await this.readable.readdir(e):[];if(await this.writable.exists(e))for(let n of await this.writable.readdir(e))t.includes(n)||t.push(n);return t.filter(t=>!this.isDeleted(U(e,t)))}readdirSync(e){if(this.isDeleted(e)||!this.existsSync(e))throw M(`ENOENT`);let t=this.readable.existsSync(e)?this.readable.readdirSync(e):[];if(this.writable.existsSync(e))for(let n of this.writable.readdirSync(e))t.includes(n)||t.push(n);return t.filter(t=>!this.isDeleted(U(e,t)))}streamRead(e,t){return this.writable.existsSync(e)?this.writable.streamRead(e,t):this.readable.streamRead(e,t)}streamWrite(e,t){return this.copyForWriteSync(e),this.writable.streamWrite(e,t)}createParentDirectoriesSync(e){let t=[],n=v(M(`EDEADLK`));for(let n=W(e);!this.writable.existsSync(n);n=W(n))t.push(n);n(),t.length&&fe(`COW: Creating parent directories: `+t.join(`, `));for(let e of t.reverse())this.writable.mkdirSync(e,this.statSync(e))}async createParentDirectories(e){let t=[],n=v(M(`EDEADLK`,e));for(let n=W(e);!await this.writable.exists(n);n=W(n))t.push(n);n(),t.length&&fe(`COW: Creating parent directories: `+t.join(`, `));for(let e of t.reverse())await this.writable.mkdir(e,await this.stat(e))}copyForWriteSync(e){if(!this.existsSync(e))throw M(`ENOENT`);this.writable.existsSync(W(e))||this.createParentDirectoriesSync(e),this.writable.existsSync(e)||this.copyToWritableSync(e)}async copyForWrite(e){if(!await this.exists(e))throw M(`ENOENT`);if(await this.writable.exists(W(e))||await this.createParentDirectories(e),!await this.writable.exists(e))return this.copyToWritable(e)}copyToWritableSync(e){let t=this.readable.statSync(e);if(An(t)){this.writable.mkdirSync(e,t);for(let t of this.readable.readdirSync(e))this.copyToWritableSync(U(e,t));return}let n=new Uint8Array(t.size);this.readable.readSync(e,n,0,n.byteLength),this.writable.createFileSync(e,t),this.writable.touchSync(e,t),this.writable.writeSync(e,n,0)}async copyToWritable(e){let t=await this.readable.stat(e);if(An(t)){await this.writable.mkdir(e,t);for(let t of await this.readable.readdir(e))await this.copyToWritable(U(e,t));return}let n=new Uint8Array(t.size);await this.readable.read(e,n,0,t.size),await this.writable.createFile(e,t),await this.writable.touch(e,t),await this.writable.write(e,n,0)}};const No={name:`CopyOnWrite`,options:{writable:{type:`object`,required:!0},readable:{type:`object`,required:!0},journal:{type:`object`,required:!1}},async create(e){return new Mo(await go(e.readable),await go(e.writable),e.journal)}},Po=new Map;async function Fo(e,t={},n=!1){let r=await fetch(e,t).catch(e=>{throw{tag:`fetch`,message:e.message}});if(!r.ok)throw{tag:`status`,response:r};let i=await r.arrayBuffer().catch(e=>{if(!n)throw{tag:`buffer`,response:r,message:e.message}});return{response:r,data:i?new Uint8Array(i):void 0}}async function Io(e,t,n={}){let r=new Request(e,n);if(typeof t.start!=`number`||typeof t.end!=`number`){let{data:r}=await Fo(e,n);return new s(e,r.byteLength,t,Po).add(r,0),r}if(typeof t.size!=`number`){t.warn?.(e+`: Size not provided, an additional HEAD request is being made`);let{headers:n}=await fetch(r,{method:`HEAD`}),i=parseInt(n.get(`Content-Length`)??``);if(typeof i!=`number`)throw{tag:`size`,message:`Response is missing content-length header and no size was provided`};t.size=i}let{size:i,start:a,end:o}=t,c=Po.get(e)??new s(e,i,t,Po);r.headers.set(`If-Range`,new Date().toUTCString());for(let{start:n,end:l}of c.missing(a,o)){let{data:u,response:d}=await Fo(r,{headers:{Range:`bytes=${n}-${l}`}});if(d.status==206){c.add(u,n);continue}return t.warn?.(e+`: Remote does not support range requests with bytes. Falling back to full data.`),new s(e,i,t,Po).add(u,0),u.subarray(a,o)}c.collect();let l=c.regionAt(a);return l.data.subarray(a-l.offset,o-l.offset)}function Lo(e,t){let n=Po.get(e);if(!n)return t.size?{data:new Uint8Array,missing:[{start:0,end:t.size??0}]}:(t.warn?.(e+`: Size not provided and cache is empty, can not determine missing range`),{data:void 0,missing:[]});let{start:r=0,end:i=n.size}=t,a=new Uint8Array(i-r);for(let e of n.regions)if(!(e.offset+e.data.byteLength<=r)){if(e.offset>=i)break;for(let t of e.ranges){if(t.end<=r)continue;if(t.start>=i)break;let n=Math.max(t.start,r),o=Math.min(t.end,i);n>=o||a.set(e.data.subarray(n-e.offset,o-e.offset),n-r)}}return{data:a,missing:n.missing(r,i)}}async function Ro(e,t,n,r={}){Po.has(e)||new s(e,n.size??t.byteLength,n,Po);let i=Po.get(e),{offset:a=0,method:o=`POST`}=n;if(!n.cacheOnly){let n=new Headers(r.headers||{});if(n.get(`Content-Type`)||n.set(`Content-Type`,`application/octet-stream`),!n.get(`Content-Range`)&&(a!==0||t.byteLength!==i.size)){let e=a,r=a+t.byteLength-1,o=Math.max(i.size,r+1);n.set(`Content-Range`,`bytes ${e}-${r}/${o}`)}await Fo(new Request(e,{...r,method:o,headers:n,body:t.buffer instanceof ArrayBuffer?t:Uint8Array.from(t)}),{},!0)}i.add(t,a)}async function zo(e,t={},n={}){t.cacheOnly||await Fo(new Request(e,n),{method:`DELETE`},!0),Po.delete(e)}var Bo=class extends zn{index;constructor(e,t,n=new Ln){super(e,t),this.index=n}usage(){return this.index.usage()}pathsForRename(e,t){if(!this.index.has(e))throw M(`ENOENT`);if((W(t)+`/`).startsWith(e+`/`))throw M(`EBUSY`);let n=[];for(let[r,i]of this.index.entries()){let a=un(e,r);if(a.startsWith(`..`))continue;let o=U(t,a);o.endsWith(`/`)&&(o=o.slice(0,-1)),n.push({from:r,to:o,inode:i})}return n.sort((e,t)=>t.from.length-e.from.length),n}async rename(e,t){if(e==t)return;let n=this.pathsForRename(e,t),r=new Map;for(let{from:e,to:t,inode:i}of n){let n=new Uint8Array(i.size);await this.read(e,n,0,i.size),r.set(t,n),this.index.delete(e),await this.remove(e),this.index.has(t)&&await this.remove(t)}n.reverse();for(let{to:e,inode:t}of n){let n=r.get(e);this.index.set(e,t),(t.mode&61440)==16384?await this._mkdir?.(e,t):await this.write(e,n,0)}}renameSync(e,t){if(e==t)return;let n=this.pathsForRename(e,t),r=new Map;for(let{from:e,to:t,inode:i}of n){let n=new Uint8Array(i.size);this.readSync(e,n,0,i.size),r.set(t,n),this.index.delete(e),this.removeSync(e),this.index.has(t)&&this.removeSync(t)}n.reverse();for(let{to:e,inode:t}of n){let n=r.get(e);this.index.set(e,t),(t.mode&61440)==16384?this._mkdirSync?.(e,t):this.writeSync(e,n,0)}}async stat(e){let t=this.index.get(e);if(!t)throw M(`ENOENT`);return t}statSync(e){let t=this.index.get(e);if(!t)throw M(`ENOENT`);return t}async touch(e,t){(this.index.get(e)??y(M(`ENOENT`))).update(t)}touchSync(e,t){(this.index.get(e)??y(M(`ENOENT`))).update(t)}_remove(e,t){let n=this.index.get(e);if(!n)throw M(`ENOENT`);let r=(n.mode&Ye)==et;if(!r&&!t)throw M(`ENOTDIR`);if(r&&t)throw M(`EISDIR`);r||this.index.delete(e)}async unlink(e){this._remove(e,!0),await this.remove(e)}unlinkSync(e){this._remove(e,!0),this.removeSync(e)}async rmdir(e){if(this._remove(e,!1),(await this.readdir(e)).length)throw M(`ENOTEMPTY`);this.index.delete(e),await this.remove(e)}rmdirSync(e){if(this._remove(e,!1),this.readdirSync(e).length)throw M(`ENOTEMPTY`);this.index.delete(e),this.removeSync(e)}create(e,t){if(this.index.has(e))throw M(`EEXIST`);let n=this.index.get(W(e));if(!n)throw M(`ENOENT`);let r=this.index._alloc(),i=new K({ino:r,data:r+1,mode:t.mode,size:0,uid:n.mode&2048?n.uid:t.uid,gid:n.mode&1024?n.gid:t.gid,nlink:1});return this.index.set(e,i),i}async createFile(e,t){return t.mode|=Qe,this.create(e,t)}createFileSync(e,t){return t.mode|=Qe,this.create(e,t)}async mkdir(e,t){t.mode|=et;let n=this.create(e,t);return await this._mkdir?.(e,t),n}mkdirSync(e,t){t.mode|=et;let n=this.create(e,t);return this._mkdirSync?.(e,t),n}link(e,t){throw M(`ENOSYS`)}linkSync(e,t){throw M(`ENOSYS`)}async readdir(e){return Object.keys(this.index.directoryEntries(e))}readdirSync(e){return Object.keys(this.index.directoryEntries(e))}async sync(){}syncSync(){}};function Vo(e){if(!(`tag`in e))throw R(M(`EIO`,e.stack));switch(e.tag){case`fetch`:throw R(M(`EREMOTEIO`,e.message));case`status`:throw R(M(e.response.status>500?`EREMOTEIO`:`EIO`,`Response status code is `+e.response.status));case`size`:throw R(M(`EBADE`,e.message));case`buffer`:throw R(M(`EIO`,`Failed to decode buffer`))}}var Ho=class extends Bo{baseUrl;requestInit;remoteWrite;_asyncDone=Promise.resolve();_async(e){this._asyncDone=this._asyncDone.then(()=>e)}constructor(e,t,n={},r){super(544106099,`nfs`,e),this.baseUrl=t,this.requestInit=n,this.remoteWrite=r}async remove(e){await zo(this.baseUrl+e,{warn:z,cacheOnly:!this.remoteWrite},this.requestInit)}removeSync(e){this._async(zo(this.baseUrl+e,{warn:z,cacheOnly:!this.remoteWrite},this.requestInit))}async read(e,t,n=0,r){let i=this.index.get(e);if(!i)throw M(`ENOENT`);if(r-n==0)return;let a=await Io(this.baseUrl+e,{start:n,end:r,size:i.size,warn:z},this.requestInit).catch(Vo).catch(()=>void 0);if(!a)throw M(`ENODATA`);t.set(a)}readSync(e,t,n=0,r){let i=this.index.get(e);if(!i)throw M(`ENOENT`);if(r-n==0)return;let{data:a,missing:o}=Lo(this.baseUrl+e,{start:n,end:r,size:i.size,warn:z});if(!a)throw M(`ENODATA`);if(o.length)throw this._async(Io(this.baseUrl+e,{start:n,end:r,size:i.size,warn:z})),M(`EAGAIN`);t.set(a)}async write(e,t,n){let r=this.index.get(e);if(!r)throw M(`ENOENT`);r.update({mtimeMs:Date.now(),size:Math.max(r.size,t.byteLength+n)}),await Ro(this.baseUrl+e,t,{offset:n,warn:z,cacheOnly:!this.remoteWrite},this.requestInit).catch(Vo)}writeSync(e,t,n){let r=this.index.get(e);if(!r)throw M(`ENOENT`);r.update({mtimeMs:Date.now(),size:Math.max(r.size,t.byteLength+n)}),this._async(Ro(this.baseUrl+e,t,{offset:n,warn:z,cacheOnly:!this.remoteWrite},this.requestInit).catch(Vo))}};const Uo={name:`Fetch`,options:{index:{type:[`string`,`object`],required:!1},baseUrl:{type:`string`,required:!0},requestInit:{type:`object`,required:!1},remoteWrite:{type:`boolean`,required:!1}},isAvailable(){return typeof globalThis.fetch==`function`},async create(e){let t=new URL(e.baseUrl);t.pathname=H(t.pathname);let n=t.toString();n.at(-1)==`/`&&(n=n.slice(0,-1)),e.index??=`index.json`;let r=new Ln;if(typeof e.index!=`string`)r.fromJSON(e.index);else{let t=await Io(e.index,{warn:z},e.requestInit).catch(Vo);r.fromJSON(JSON.parse(ee(t)))}let i=new Ho(r,n,e.requestInit,e.remoteWrite);if(e.disableAsyncCache)return i;for(let[t,i]of r)i.mode&32768&&await Io(n+t,{warn:z},e.requestInit).catch(Vo);return i}};var Wo=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},Go=(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}),Ko=class extends zn{nodeFS;prefix;constructor(e,t){super(1852793957,`nodefs`),this.nodeFS=e,this.prefix=t}usage(){let e=this.nodeFS.statfsSync(this.prefix);return{totalSpace:e.bsize*e.blocks,freeSpace:e.bsize*e.bfree}}path(e){return this.prefix+e}async rename(e,t){await this.nodeFS.promises.rename(this.path(e),this.path(t))}renameSync(e,t){this.nodeFS.renameSync(this.path(e),this.path(t))}async stat(e){return await this.nodeFS.promises.stat(this.path(e))}statSync(e){return this.nodeFS.statSync(this.path(e))}async touch(e,t){let n={stack:[],error:void 0,hasError:!1};try{let r=Wo(n,await this.nodeFS.promises.open(this.path(e),`r`),!0);await r.chmod(t.mode);try{await r.chown(t.uid,t.gid)}catch(e){R(`Failed to chown passthrough file: `+e.message)}}catch(e){n.error=e,n.hasError=!0}finally{let e=Go(n);e&&await e}}touchSync(e,t){this.nodeFS.chmodSync(this.path(e),t.mode);try{this.nodeFS.chownSync(this.path(e),t.uid,t.gid)}catch(e){R(`Failed to chown passthrough file: `+e.message)}}async unlink(e){await this.nodeFS.promises.unlink(this.path(e))}unlinkSync(e){this.nodeFS.unlinkSync(this.path(e))}async mkdir(e,t){return await this.nodeFS.promises.mkdir(this.path(e),t),await this.nodeFS.promises.stat(this.path(e))}mkdirSync(e,t){return this.nodeFS.mkdirSync(this.path(e),t),this.nodeFS.statSync(this.path(e))}async readdir(e){return await this.nodeFS.promises.readdir(this.path(e))}readdirSync(e){return this.nodeFS.readdirSync(this.path(e))}async createFile(e,t){if(An(t))await this.nodeFS.promises.mkdir(this.path(e),{mode:t.mode});else{let t={stack:[],error:void 0,hasError:!1};try{await Wo(t,await this.nodeFS.promises.open(this.path(e),`wx`),!0).close()}catch(e){t.error=e,t.hasError=!0}finally{let e=Go(t);e&&await e}}return await this.nodeFS.promises.stat(this.path(e))}createFileSync(e,t){if(An(t))this.nodeFS.mkdirSync(this.path(e),{mode:t.mode});else{let t=this.nodeFS.openSync(this.path(e),`wx`);this.nodeFS.closeSync(t)}return this.nodeFS.statSync(this.path(e))}async rmdir(e){await this.nodeFS.promises.rmdir(this.path(e))}rmdirSync(e){this.nodeFS.rmdirSync(this.path(e))}async sync(){z(`Sync on passthrough is unnecessary`)}syncSync(){z(`Sync on passthrough is unnecessary`)}async link(e,t){await this.nodeFS.promises.link(this.path(e),this.path(t))}linkSync(e,t){this.nodeFS.linkSync(this.path(e),this.path(t))}async read(e,t,n,r){let i={stack:[],error:void 0,hasError:!1};try{await Wo(i,await this.nodeFS.promises.open(this.path(e),`r`),!0).read({buffer:t,offset:n,length:r-n})}catch(e){i.error=e,i.hasError=!0}finally{let e=Go(i);e&&await e}}readSync(e,t,n,r){let i=this.nodeFS.openSync(this.path(e),`r`);try{this.nodeFS.readSync(i,t,{offset:n,length:r-n})}finally{this.nodeFS.closeSync(i)}}async write(e,t,n){let r={stack:[],error:void 0,hasError:!1};try{await Wo(r,await this.nodeFS.promises.open(this.path(e),`w`),!0).write(t,n)}catch(e){r.error=e,r.hasError=!0}finally{let e=Go(r);e&&await e}}writeSync(e,t,n){let r=this.nodeFS.openSync(this.path(e),`w`);try{this.nodeFS.writeSync(r,t,n)}finally{this.nodeFS.closeSync(r)}}};const qo={name:`Passthrough`,options:{fs:{type:`object`,required:!0},prefix:{type:`string`,required:!0}},create({fs:e,prefix:t}){return new Ko(e,t)}};var Jo=t({attach:()=>cs,catchMessages:()=>us,decodeMessage:()=>ts,detach:()=>ls,encodeMessage:()=>es,from:()=>$o,fromNode:()=>Zo,fromWeb:()=>Xo,fromWebSocket:()=>Qo,handleRequest:()=>ds,handleResponse:()=>ss,isMessage:()=>ns,isPort:()=>Yo,request:()=>as});function Yo(e){return typeof e==`object`&&!!e&&`channel`in e&&`send`in e&&`addHandler`in e&&`removeHandler`in e}function Xo(e){let t=new Map;return{channel:e,send:e.postMessage.bind(e),addHandler(n){let r=e=>n(e.data);t.set(n,r),e.addEventListener(`message`,r)},removeHandler(n){e.removeEventListener(`message`,t.get(n))}}}function Zo(e){return{channel:e,send:e.postMessage.bind(e),addHandler:e.on.bind(e,`message`),removeHandler:e.off.bind(e,`message`)}}function Qo(e){return{channel:e,send(t){e.send(es(t))},addHandler(t){e.addEventListener(`message`,e=>{t(ts(e.data))})},removeHandler(t){e.removeEventListener(`message`,e=>{t(ts(e.data))})}}}function $o(e){if(Yo(e))return e;if(e instanceof WebSocket)return Qo(e);if(`on`in e)return Zo(e);if(`addEventListener`in e)return Xo(e);throw R(M(`EINVAL`,`Invalid port type`))}function es(e){return`Z1${JSON.stringify(e,(e,t)=>{if(e!=`_zenfs`)return t instanceof Uint8Array?`$`+t.toBase64():t})}`}function ts(e){if(!e.startsWith(`Z`))return{};e=e.slice(1);let t=parseInt(e);if(isNaN(t))return z(`Ignoring encoded message with missing version`),{};if(e=e.slice(t.toString().length),!h(e))return z(`Ignoring encoded message with invalid JSON`),{};if(t!=1)throw R(M(`EPROTONOSUPPORT`,`Version mismatch in RPC message encoding (got ${t}, expected 1)`));return{...JSON.parse(e,(e,t)=>typeof t==`string`&&t.startsWith(`$`)?Uint8Array.fromBase64(t.slice(1)):t),_zenfs:!0}}function ns(e){return typeof e==`object`&&!!e&&`_zenfs`in e&&!!e._zenfs}function rs(e){let t=is.get(e);t&&(t.timeout&&(clearTimeout(t.timeout),typeof t.timeout==`object`&&t.timeout.unref()),is.delete(e))}const is=new Map;function as(e,{port:t,timeout:n=1e3,fs:r}){let i=`
|