sliccy 3.35.1 → 3.37.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.
Files changed (94) hide show
  1. package/dist/ui/assets/{adobe-dF90Inf7.js → adobe-D0eU7otw.js} +1 -1
  2. package/dist/ui/assets/{adobe-aXLIvH9D.js → adobe-DzguSJcB.js} +2 -2
  3. package/dist/ui/assets/{agent-bridge-HevsOQu4.js → agent-bridge-BV8pPxQ4.js} +1 -1
  4. package/dist/ui/assets/{agent-message-to-chat-LKi9XTTG.js → agent-message-to-chat-CcIv-92Q.js} +1 -1
  5. package/dist/ui/assets/{anthropic-BPquRfES.js → anthropic-BOCAZdKT.js} +1 -1
  6. package/dist/ui/assets/{anthropic-j72gYC37.js → anthropic-C-nJktDH.js} +1 -1
  7. package/dist/ui/assets/{apps-CUZ0j46Q.js → apps-CazRdlWW.js} +1 -1
  8. package/dist/ui/assets/{azure-openai-DL9rlaYT.js → azure-openai-DtL1o6ZD.js} +1 -1
  9. package/dist/ui/assets/{azure-openai-NIHEjuZY.js → azure-openai-_invOtXk.js} +1 -1
  10. package/dist/ui/assets/{azure-openai-responses-BjWD4_Qc.js → azure-openai-responses-CX0jRX76.js} +1 -1
  11. package/dist/ui/assets/{azure-openai-responses-BkJiczft.js → azure-openai-responses-GhzNMInJ.js} +1 -1
  12. package/dist/ui/assets/{biome_wasm-CTHS5Ntm.js → biome_wasm-D8VQSIIi.js} +1 -1
  13. package/dist/ui/assets/{bsh-watchdog-DAwJmFZl.js → bsh-watchdog-s4NmjDWR.js} +1 -1
  14. package/dist/ui/assets/{cdp-CaT5TlrI.js → cdp-BgM18pVP.js} +3 -3
  15. package/dist/ui/assets/{cdp-ws-page-bridge-_x_UcZJn.js → cdp-ws-page-bridge-B5tXWGhg.js} +1 -1
  16. package/dist/ui/assets/{common-DRAV2dJd.js → common-D2i3_-oc.js} +1 -1
  17. package/dist/ui/assets/{connect-surface-CCfSI5-c.js → connect-surface-DHkIIf2i.js} +1 -1
  18. package/dist/ui/assets/cost-command-DFzH4zjf.js +1 -0
  19. package/dist/ui/assets/{dist-BvP45YUI.js → dist-BA9OCLxC.js} +1 -1
  20. package/dist/ui/assets/{dist-Bsh8aEYP.js → dist-BNts4F1N.js} +1 -1
  21. package/dist/ui/assets/{dist-DVEQZAIT.js → dist-C5jJDZZZ.js} +1 -1
  22. package/dist/ui/assets/{dist-D3vqQ2Yo.js → dist-CVBUjlj6.js} +1 -1
  23. package/dist/ui/assets/{es-CKSMqgEY.js → es-BRyNbfCL.js} +1 -1
  24. package/dist/ui/assets/{follower-sprinkle-bridge-s_KYng2H.js → follower-sprinkle-bridge-Dm4wCz3a.js} +1 -1
  25. package/dist/ui/assets/{github-copilot-B6MHst0D.js → github-copilot-CI7Dyzof.js} +2 -2
  26. package/dist/ui/assets/{github-copilot-DInoIk7O.js → github-copilot-CNCUEMSl.js} +1 -1
  27. package/dist/ui/assets/{github-YDAnlxEm.js → github-d7YH3T2H.js} +1 -1
  28. package/dist/ui/assets/{github-DlJxVVkf.js → github-mHAjC7ey.js} +2 -2
  29. package/dist/ui/assets/{google-BV3wSZBi.js → google-DKNB41Ym.js} +1 -1
  30. package/dist/ui/assets/{google-LnWE4Aht.js → google-HRDDLoHP.js} +1 -1
  31. package/dist/ui/assets/{google-shared-D3Z1fbp0.js → google-shared-CYn7X0jS.js} +1 -1
  32. package/dist/ui/assets/{google-shared-BFb9WNQf.js → google-shared-DZAlfPPe.js} +1 -1
  33. package/dist/ui/assets/{google-vertex-iVFABtTb.js → google-vertex-5PWnpQrl.js} +1 -1
  34. package/dist/ui/assets/{google-vertex-No9Wv9Rg.js → google-vertex-DlucBiuL.js} +1 -1
  35. package/dist/ui/assets/{hosted-config-apply-D5JlRSaz.js → hosted-config-apply-Drta_smD.js} +1 -1
  36. package/dist/ui/assets/{intercepted-oauth-Dn9rIi-C.js → intercepted-oauth-CdfSST0X.js} +1 -1
  37. package/dist/ui/assets/{kernel-worker-D1ZZbDk7.js → kernel-worker-Bogg0FsV.js} +22 -22
  38. package/dist/ui/assets/{lick-ws-bridge-FzW4E5Cd.js → lick-ws-bridge-DnC03d37.js} +1 -1
  39. package/dist/ui/assets/{local-llm-YQDW7uF7.js → local-llm-BBDP3qXX.js} +1 -1
  40. package/dist/ui/assets/{magick-wasm-BeuHUgL1.js → magick-wasm-DP5JW3P7.js} +1 -1
  41. package/dist/ui/assets/{main-CilZwNiT.js → main-D7RTZNPJ.js} +228 -156
  42. package/dist/ui/assets/{main-cherry-DnPYeUe8.js → main-cherry-CZuEEqNJ.js} +1 -1
  43. package/dist/ui/assets/{migration-run-p0lR8xxV.js → migration-run-kj6K_pt4.js} +1 -1
  44. package/dist/ui/assets/{mistral-Dfoj9fXB.js → mistral-Bq4YKpQf.js} +1 -1
  45. package/dist/ui/assets/{mistral-BkCTqf1V.js → mistral-s6fpd_QE.js} +1 -1
  46. package/dist/ui/assets/{nodejs-CHtcrjWl.js → nodejs--9YdGywN.js} +1 -1
  47. package/dist/ui/assets/{nuke-command-DThbTH3f.js → nuke-command-H4BPXVny.js} +1 -1
  48. package/dist/ui/assets/{oauth-7_PcMC9m.js → oauth-CYnFQHGN.js} +1 -1
  49. package/dist/ui/assets/{oauth-bootstrap-sDEhfqCF.js → oauth-bootstrap-Cm6Ey9BE.js} +2 -2
  50. package/dist/ui/assets/{oauth-service-BbWxnAZu.js → oauth-service-DeRu3_2b.js} +1 -1
  51. package/dist/ui/assets/{oauth-service-C_oui06z.js → oauth-service-HJoLhTok.js} +1 -1
  52. package/dist/ui/assets/{offscreen-client-CPehYlEH.js → offscreen-client-BWBoGGE9.js} +1 -1
  53. package/dist/ui/assets/{onboarding-orchestrator-Bhtg8moO.js → onboarding-orchestrator-BgoWOzZj.js} +1 -1
  54. package/dist/ui/assets/{openai-codex-Cv3-dlgY.js → openai-codex-DQRUGzWy.js} +1 -1
  55. package/dist/ui/assets/{openai-codex-DYEVNxR_.js → openai-codex-LN-usMsc.js} +1 -1
  56. package/dist/ui/assets/{openai-codex-responses-PCFMqZ2-.js → openai-codex-responses-Cfc781NG.js} +1 -1
  57. package/dist/ui/assets/{openai-codex-responses-Dv-xW9xl.js → openai-codex-responses-CxdnjTbB.js} +1 -1
  58. package/dist/ui/assets/{openai-completions-Ct4ErjP6.js → openai-completions-C3xol3b4.js} +1 -1
  59. package/dist/ui/assets/{openai-responses-Bcj6Mw9f.js → openai-responses--a_zzMOQ.js} +1 -1
  60. package/dist/ui/assets/{openai-responses-BXTgPJAX.js → openai-responses-CztB_6j4.js} +1 -1
  61. package/dist/ui/assets/{openai-responses-shared-BRpjzDt_.js → openai-responses-shared-DiFBBpqL.js} +1 -1
  62. package/dist/ui/assets/{openai-responses-shared-CZjoigsd.js → openai-responses-shared-DzF78DKp.js} +1 -1
  63. package/dist/ui/assets/{openrouter-PAULL0z5.js → openrouter-BMdnzqF3.js} +1 -1
  64. package/dist/ui/assets/{openrouter-DzmGsDzq.js → openrouter-aEehoTsE.js} +1 -1
  65. package/dist/ui/assets/{panel-rpc-handlers-B4grCAzw.js → panel-rpc-handlers-DdqJW3No.js} +1 -1
  66. package/dist/ui/assets/{provider-SQ-dF0OV.js → provider-Bgu2Uv_T.js} +2 -2
  67. package/dist/ui/assets/{provider-DQmaFemI.js → provider-D4K2_mH-.js} +1 -1
  68. package/dist/ui/assets/provider-store-access-BFHCJwAC.js +1 -0
  69. package/dist/ui/assets/provider-store-access-DC3w8ZIP.js +1 -0
  70. package/dist/ui/assets/{proxied-fetch-Bznr24aY.js → proxied-fetch-C52RkD9o.js} +1 -1
  71. package/dist/ui/assets/{pyodide-B5LJuYH1.js → pyodide-DuRrrZJD.js} +2 -2
  72. package/dist/ui/assets/{remote-terminal-view-ZxR5LM7B.js → remote-terminal-view-Cudp1ErF.js} +1 -1
  73. package/dist/ui/assets/{remote-vfs-client-BWeQEOy_.js → remote-vfs-client-Cu-MFwK4.js} +1 -1
  74. package/dist/ui/assets/{secret-env-udqdNnx_.js → secret-env-DEspXTwg.js} +1 -1
  75. package/dist/ui/assets/{slicc-editor-CQAmYyAf.js → slicc-editor-CwFr1Fs1.js} +1 -1
  76. package/dist/ui/assets/{spawn-CvrZvu3h.js → spawn-BycKAdgK.js} +1 -1
  77. package/dist/ui/assets/{sql-wasm-sWUWlvZh.js → sql-wasm-DCJNFY_I.js} +1 -1
  78. package/dist/ui/assets/{src-BcMuhnBe.js → src-DiQH2ndF.js} +1 -1
  79. package/dist/ui/assets/{store-BOB-n5TL.js → store-h-tP5jnf.js} +1 -1
  80. package/dist/ui/assets/terminal-session-client-C_tYJ1IB.js +1 -0
  81. package/dist/ui/assets/{tray-leave-runtime-DxkPV4F3.js → tray-leave-runtime-CjxaeMI3.js} +1 -1
  82. package/dist/ui/assets/{typescript-BREqP46V.js → typescript-1JVPsu0C.js} +1 -1
  83. package/dist/ui/assets/{upgrade-detection-DlwpHU2v.js → upgrade-detection-C2ZLSwM0.js} +1 -1
  84. package/dist/ui/assets/{web-BzK79jFy.js → web-BqSerjuj.js} +1 -1
  85. package/dist/ui/assets/{writable-vfs-client-COZzXV3K.js → writable-vfs-client-DzaIeN3A.js} +1 -1
  86. package/dist/ui/assets/{ws-subscribers-C8__TxzG.js → ws-subscribers-keoikw2x.js} +1 -1
  87. package/dist/ui/assets/{xai-grok-DWmdgPYg.js → xai-grok--KXEnye4.js} +1 -1
  88. package/dist/ui/assets/{xai-grok-woATmag9.js → xai-grok-u9YAsnWn.js} +1 -1
  89. package/dist/ui/index.html +1 -1
  90. package/dist/ui/packages/webapp/index.html +1 -1
  91. package/package.json +1 -1
  92. package/dist/ui/assets/cost-command-CW43ld_y.js +0 -1
  93. package/dist/ui/assets/provider-store-access-BijO1ndd.js +0 -1
  94. package/dist/ui/assets/provider-store-access-COEfTeXB.js +0 -1
@@ -1,4 +1,4 @@
1
- import{ct as e,lt as t,st as n}from"./main-CilZwNiT.js";function r(e,t){if(e.byteLength>=t)return e;if(ArrayBuffer.isView(e)){let n=r(e.buffer,t);return new e.constructor(n,e.byteOffset,t)}let n=typeof SharedArrayBuffer<`u`&&e instanceof SharedArrayBuffer;if(e.maxByteLength>t)return n?e.grow(t):e.resize(t),e;if(n){let n=new SharedArrayBuffer(t);return new Uint8Array(n).set(new Uint8Array(e)),n}try{return e.transfer(t)}catch{let n=new ArrayBuffer(t);return new Uint8Array(n).set(new Uint8Array(e)),n}}var i=class extends DataView{constructor(e,t,n){let{buffer:r,byteOffset:i,byteLength:a}=new Uint8Array(e,t,n);super(r,i,a)}};for(let e of Object.getOwnPropertyNames(DataView.prototype))!e.startsWith(`get`)&&!e.startsWith(`set`)||Object.defineProperty(i.prototype,e,{value:()=>{throw ReferenceError(`Do not use DataView methods on a BufferView.`)},writable:!1,enumerable:!1,configurable:!1});var a=class{id;_size;options;regions=[];get size(){return this._size}set size(e){if(e>=this._size){this._size=e;return}this._size=e;for(let t=this.regions.length-1;t>=0;t--){let n=this.regions[t];if(n.offset>=e){this.regions.splice(t,1);continue}let r=e-n.offset;n.data.byteLength>r&&(n.data=n.data.subarray(0,r)),n.ranges=n.ranges.filter(t=>t.start<e).map(t=>t.end>e?{start:t.start,end:e}:t)}}constructor(e,t,n,r){this.id=e,this._size=t,this.options=n,n.sparse??=!0,n.sparse||this.regions.push({offset:0,data:new Uint8Array(t),ranges:[]}),r?.set(e,this)}collect(){if(!this.options.sparse)return;let{regionGapThreshold:e=4095}=this.options;for(let t=0;t<this.regions.length-1;){let n=this.regions[t],i=this.regions[t+1];if(i.offset-(n.offset+n.data.byteLength)>e){t++;continue}n.ranges.push(...i.ranges),n.ranges.sort((e,t)=>e.start-t.start),n.ranges=n.ranges.reduce((e,t)=>(!e.length||e.at(-1).end<t.start?e.push(t):e.at(-1).end=Math.max(e.at(-1).end,t.end),e),[]),n.data=r(n.data,i.offset+i.data.byteLength),n.data.set(i.data,i.offset-n.offset),this.regions.splice(t+1,1)}}missing(e,t){let n=[];for(let r of this.regions){if(r.offset>=t)break;for(let i of r.ranges)if(!(i.end<=e)&&(i.start>=t||(i.start>e&&n.push({start:e,end:Math.min(i.start,t)}),i.end>e&&(e=Math.max(e,i.end)),e>=t)))break;if(e>=t)break}return e<t&&n.push({start:e,end:t}),n}cached(e,t){let n=[];for(let r of this.regions){if(r.offset>=t)break;for(let i of r.ranges)if(!(i.end<=e)){if(i.start>=t)break;n.push({start:Math.max(e,i.start),end:Math.min(t,i.end)})}}n.sort((e,t)=>e.start-t.start);let r=[];for(let e of n){let t=r.at(-1);t&&e.start<=t.end?t.end=Math.max(t.end,e.end):r.push(e)}return r}regionAt(e){if(this.regions.length)for(let t of this.regions){if(t.offset>e)break;if(e>=t.offset&&e<t.offset+t.data.byteLength)return t}}add(e,t){let n=t+e.byteLength,i=this.regionAt(t);if(i)return i.data=r(i.data,n),i.data.set(e,t),i.ranges.push({start:t,end:n}),i.ranges.sort((e,t)=>e.start-t.start),this.collect(),this;let a={data:e,offset:t,ranges:[{start:t,end:n}]},o=this.regions.findIndex(e=>e.offset>t);return o==-1?this.regions.push(a):this.regions.splice(o,0,a),this.collect(),this}},o=new Uint32Array(256);for(let e=0;e<256;e++){let t=e;for(let e=0;e<8;e++)t=t&1?2197175160^t>>>1:t>>>1;o[e]=t}function s(e){let t=4294967295;for(let n=0;n<e.length;n++)t=t>>>8^o[(t^e[n])&255];return(t^4294967295)>>>0}var c=t(n(((e,t)=>{var n=Object.prototype.hasOwnProperty,r=`~`;function i(){}Object.create&&(i.prototype=Object.create(null),new i().__proto__||(r=!1));function a(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function o(e,t,n,i,o){if(typeof n!=`function`)throw TypeError(`The listener must be a function`);var s=new a(n,i||e,o),c=r?r+t:t;return e._events[c]?e._events[c].fn?e._events[c]=[e._events[c],s]:e._events[c].push(s):(e._events[c]=s,e._eventsCount++),e}function s(e,t){--e._eventsCount===0?e._events=new i:delete e._events[t]}function c(){this._events=new i,this._eventsCount=0}c.prototype.eventNames=function(){var e=[],t,i;if(this._eventsCount===0)return e;for(i in t=this._events)n.call(t,i)&&e.push(r?i.slice(1):i);return Object.getOwnPropertySymbols?e.concat(Object.getOwnPropertySymbols(t)):e},c.prototype.listeners=function(e){var t=r?r+e:e,n=this._events[t];if(!n)return[];if(n.fn)return[n.fn];for(var i=0,a=n.length,o=Array(a);i<a;i++)o[i]=n[i].fn;return o},c.prototype.listenerCount=function(e){var t=r?r+e:e,n=this._events[t];return n?n.fn?1:n.length:0},c.prototype.emit=function(e,t,n,i,a,o){var s=r?r+e:e;if(!this._events[s])return!1;var c=this._events[s],l=arguments.length,u,d;if(c.fn){switch(c.once&&this.removeListener(e,c.fn,void 0,!0),l){case 1:return c.fn.call(c.context),!0;case 2:return c.fn.call(c.context,t),!0;case 3:return c.fn.call(c.context,t,n),!0;case 4:return c.fn.call(c.context,t,n,i),!0;case 5:return c.fn.call(c.context,t,n,i,a),!0;case 6:return c.fn.call(c.context,t,n,i,a,o),!0}for(d=1,u=Array(l-1);d<l;d++)u[d-1]=arguments[d];c.fn.apply(c.context,u)}else{var f=c.length,p;for(d=0;d<f;d++)switch(c[d].once&&this.removeListener(e,c[d].fn,void 0,!0),l){case 1:c[d].fn.call(c[d].context);break;case 2:c[d].fn.call(c[d].context,t);break;case 3:c[d].fn.call(c[d].context,t,n);break;case 4:c[d].fn.call(c[d].context,t,n,i);break;default:if(!u)for(p=1,u=Array(l-1);p<l;p++)u[p-1]=arguments[p];c[d].fn.apply(c[d].context,u)}}return!0},c.prototype.on=function(e,t,n){return o(this,e,t,n,!1)},c.prototype.once=function(e,t,n){return o(this,e,t,n,!0)},c.prototype.removeListener=function(e,t,n,i){var a=r?r+e:e;if(!this._events[a])return this;if(!t)return s(this,a),this;var o=this._events[a];if(o.fn)o.fn===t&&(!i||o.once)&&(!n||o.context===n)&&s(this,a);else{for(var c=0,l=[],u=o.length;c<u;c++)(o[c].fn!==t||i&&!o[c].once||n&&o[c].context!==n)&&l.push(o[c]);l.length?this._events[a]=l.length===1?l[0]:l:s(this,a)}return this},c.prototype.removeAllListeners=function(e){var t;return e?(t=r?r+e:e,this._events[t]&&s(this,t)):(this._events=new i,this._eventsCount=0),this},c.prototype.off=c.prototype.removeListener,c.prototype.addListener=c.prototype.on,c.prefixed=r,c.EventEmitter=c,t!==void 0&&(t.exports=c)}))(),1),l=class extends c.default{[Symbol.toStringTag]=`List`;constructor(e){super(),e&&this.push(...e)}data=new Set;toSet(){return new Set(this.data)}toArray(){return Array.from(this.data)}toJSON(){return Array.from(this.data)}toString(){return this.join(`,`)}_set(e,t,n=!1){if(Math.abs(e)>this.data.size)throw ReferenceError(`Can not set an element outside the bounds of the list`);let r=Array.from(this.data);r.splice(e,+n,t),this.data=new Set(r),this.emit(`update`)}set(e,t){this._set(e,t,!0)}deleteAt(e){if(Math.abs(e)>this.data.size)throw ReferenceError(`Can not delete an element outside the bounds of the list`);this.delete(Array.from(this.data).at(e))}insert(e,t=this.data.size){this._set(t,e,!1)}at(e){if(Math.abs(e)>this.data.size)throw ReferenceError(`Can not access an element outside the bounds of the list`);return Array.from(this.data).at(e)}pop(){let e=Array.from(this.data).pop();return e!==void 0&&this.delete(e),e}push(...e){for(let t of e)this.add(t);return this.data.size}join(e){return Array.from(this.data).join(e)}splice(e,t,...n){if(Math.abs(e)>this.data.size)throw ReferenceError(`Can not splice elements outside the bounds of the list`);let r=Array.from(this.data),i=r.splice(e,t,...n);return this.data=new Set(r),this.emit(`update`),i}add(e){return this.data.add(e),this.emit(`update`),this.emit(`add`,e),this}clear(){this.data.clear(),this.emit(`update`)}delete(e){let t=this.data.delete(e);return this.emit(`update`),t}has(e){return this.data.has(e)}get size(){return this.data.size}entries(){return this.toArray().entries()}keys(){return this.toArray().keys()}values(){return this.data.values()}[Symbol.iterator](){return this.data[Symbol.iterator]()}};function u(e,t){let n=Object.entries(e);return Object.fromEntries(n.filter(([e,n])=>t(e,n)))}function d(e,...t){let n={};for(let r of t.flat())n[r]=e[r];return n}function f(e,...t){return u(e,e=>!t.flat().includes(e))}function p(e){try{return JSON.parse(e),!0}catch{return!1}}function m(e){let t=[];for(let n=e;n&&![`Function`,`Object`].includes(n.constructor.name);n=Object.getPrototypeOf(n))t.push(n.constructor.name);return t}function h(e,t){return Object.fromEntries(Object.entries(e).map(([e,n])=>[e,typeof n==`function`?n.bind(t):n]))}function g(e=Error()){let t=setTimeout(()=>{throw e},5e3);return()=>clearTimeout(t)}function _(e){throw e&&typeof e==`object`&&m(e).includes(`Error`)&&Error?.captureStackTrace(e,_),e}var v=Intl.NumberFormat(`en`,{notation:`compact`});v.format.bind(v);function y(e=0,t=1){return Math.round(Math.random()*(t-e)+e)}function b(e){return e.at(0).toUpperCase()+e.slice(1)}var x=new TextEncoder;function S(e){return x.encode(e)}var C=new TextDecoder;function w(e){if(!e)return``;if(e.buffer instanceof ArrayBuffer&&!e.buffer.resizable)return C.decode(e);let t=new Uint8Array(e.byteLength);return t.set(e),C.decode(t)}function T(e){let t=new Uint8Array(e.length);for(let n=0;n<e.length;n++)t[n]=e.charCodeAt(n);return t}function ee(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||={});var k={[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 A(e){let t=`${e.code}: ${k[e.errno]}, ${e.syscall}`;return e.path&&(t+=` '${e.path}'`),e.dest&&(t+=` -> '${e.dest}'`),e.message&&!e.message.startsWith(k[e.errno])&&(t+=` (${e.message})`),e.message=t,e}var j=class e extends Error{errno;code;path;dest;syscall;constructor(e,t,n={}){let r=O[e];super(t||``),this.errno=e,this.code=r,Object.assign(this,f(n,`message`)),t||A(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 M(e,t,n,r){typeof t==`string`&&(t={syscall:t,path:n,dest:r});let i=new j(O[e],!1,t??{});return Error.captureStackTrace?.(i,M),i}function N(e,t){let n=new j(O[e],t??k[O[e]]);return Error.captureStackTrace?.(n,N),n}function P(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),A(e),e}}var te=e({Level:()=>F,alert:()=>se,configure:()=>Se,crit:()=>L,debug:()=>ue,deprecated:()=>de,emerg:()=>oe,entries:()=>re,err:()=>R,fancy:()=>ge,format:()=>B,info:()=>le,isEnabled:()=>xe,levelOf:()=>ne,levels:()=>I,log:()=>ie,notice:()=>ce,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||={});var I=[`emergency`,`alert`,`critical`,`error`,`warning`,`notice`,`info`,`debug`];function ne(e){return I.indexOf(e)}var re=new l;function ie(e,t){if(!xe)return;let n={level:e,message:t,timestamp:new Date,elapsedMs:performance.now()};re.add(n),V(n)}function ae(e){return function(t){return ie(e,t.toString()),t}}var oe=ae(F.EMERG),se=ae(F.ALERT),L=ae(F.CRIT),R=ae(F.ERR),z=ae(F.WARN),ce=ae(F.NOTICE),le=ae(F.INFO),ue=ae(F.DEBUG);function de(e){ie(F.WARN,e+` is deprecated and should not be used.`)}function fe(e,t){return`\x1b[${t}m${e}\x1b[0m`}function pe(e){return`[`+(e.elapsedMs/1e3).toFixed(3).padStart(10)+`] `}var me={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;`}},he={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 ge({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`?[fe(pe(n),`2;37`)]:[`opacity: 0.8; color: white;`,pe(n)];let r=e==`ansi`?[fe(I[n.level].toUpperCase(),me.ansi[n.level])]:[me.css[n.level],I[n.level].toUpperCase()];if(t==`level`){yield*r,yield n.message;return}n.level<F.CRIT&&(yield*r),e==`ansi`?yield fe(n.message,he.ansi[n.level]):yield*[he.css[n.level],n.message]}}var _e=e=>[pe(e),e.message];function B(e){let t=_e(e);return typeof t==`string`?[t]:Array.from(t)}var ve=console.error;function V(e){e.level>ye||ve(...B(e))}var ye=F.ALERT,be=!1,xe=!0;function Se(e){if(_e=e.format??_e,ve=e.output??ve,ye=typeof e.level==`string`?ne(e.level):e.level??ye,xe=e.enabled??xe,be=e.stack??be,e.dumpBacklog)for(let e of re)V(e)}function Ce(e){return typeof e==`object`&&!!e&&`create`in e&&typeof e.create==`function`}function we(e,t){return Object.defineProperty(t,"prototype",{value:void 0}),e&&Object.defineProperty(t,"name",{value:e}),t}function Te(e){return!(e&&e.constructor===Function)||e.prototype===void 0?!1:Function.prototype===Object.getPrototypeOf(e)?Object.getOwnPropertyNames(e.prototype).length>1:!0}function Ee(e,t){if(typeof t!=`object`||!t)throw R(N(`EINVAL`,`Invalid options`));for(let[n,r]of Object.entries(e.options)){let e=t?.[n];if(e==null){if(!r.required){ue(`Using default for option: `+n);continue}throw R(N(`EINVAL`,`Missing required option: `+n))}let i=(t,n=e)=>typeof t==`function`?Te(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(N(`EINVAL`,`Incorrect type for "${n}": ${a} (expected ${Array.isArray(r.type)?`one of ${r.type.map(o).join(`, `)}`:o(r.type)})`))}}function De(e){return typeof e==`object`&&!!e&&`backend`in e&&Ce(e.backend)}function Oe(e){return{suid:e.uid,sgid:e.gid,euid:e.uid,egid:e.gid,groups:[],...e}}function ke(e){return e?!e.uid||!e.gid||!e.euid||!e.egid||e.groups.some(e=>!e):!1}var Ae=Symbol(`ZenFSContext`),je={[Ae]:!0,id:0,root:`/`,pwd:`/`,credentials:Oe({uid:0,gid:0}),descriptors:new Map,parent:null,children:[]};function Me(e){return typeof e==`object`&&e&&Ae in e?e:je}var Ne=1;function Pe(e,t={}){let{root:n=e.root,pwd:r=e.pwd,credentials:i=structuredClone(e.credentials)}=t,a={[Ae]:!0,id:Ne++,root:n,pwd:r,credentials:Oe(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 Fe=e({COPYFILE_EXCL:()=>1,COPYFILE_FICLONE:()=>2,COPYFILE_FICLONE_FORCE:()=>4,F_OK:()=>0,O_APPEND:()=>Ie,O_CREAT:()=>64,O_DIRECT:()=>Ue,O_DIRECTORY:()=>Le,O_DSYNC:()=>Ve,O_EXCL:()=>128,O_NOATIME:()=>Re,O_NOCTTY:()=>256,O_NOFOLLOW:()=>ze,O_NONBLOCK:()=>We,O_RDONLY:()=>0,O_RDWR:()=>2,O_SYMLINK:()=>He,O_SYNC:()=>Be,O_TRUNC:()=>512,O_WRONLY:()=>1,R_OK:()=>4,S_IFBLK:()=>Ye,S_IFCHR:()=>Ze,S_IFDIR:()=>Xe,S_IFIFO:()=>Qe,S_IFLNK:()=>qe,S_IFMT:()=>Ge,S_IFREG:()=>Je,S_IFSOCK:()=>Ke,S_IRGRP:()=>32,S_IROTH:()=>4,S_IRUSR:()=>256,S_IRWXG:()=>56,S_IRWXO:()=>7,S_IRWXU:()=>448,S_ISGID:()=>et,S_ISUID:()=>$e,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:()=>tt}),Ie=1024,Le=65536,Re=262144,ze=131072,Be=1052672,Ve=4096,He=32768,Ue=16384,We=2048,Ge=61440,Ke=49152,qe=40960,Je=32768,Ye=24576,Xe=16384,Ze=8192,Qe=4096,$e=2048,et=1024,tt=4294967295;function nt(e){return`__isArrayType`in e&&e.__isArrayType===!0}function rt(e){return typeof e!=`object`&&typeof e!=`function`||e==null?!1:nt(e)?rt(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`&&it.has(e.name)&&it.get(e.name)?.name===e.name}var it=new Map;function at(e){if(it.has(e.name))throw ReferenceError(`Type is already registered: ${e.name}`);it.set(e.name,e)}var ot=Symbol(`DataView`);function st(e){return e[ot]??=new DataView(e),e[ot]}var ct={name:`int8`,size:1,array:Int8Array,get:(e,t)=>st(e).getInt8(t),set:(e,t,n)=>st(e).setInt8(t,n)},lt={name:`uint8`,size:1,array:Uint8Array,get:(e,t)=>st(e).getUint8(t),set:(e,t,n)=>st(e).setUint8(t,n)},ut={int8:ct,uint8:lt,int16:{name:`int16`,size:2,array:Int16Array,get:(e,t)=>st(e).getInt16(t,!0),set:(e,t,n)=>st(e).setInt16(t,n,!0)},uint16:{name:`uint16`,size:2,array:Uint16Array,get:(e,t)=>st(e).getUint16(t,!0),set:(e,t,n)=>st(e).setUint16(t,n,!0)},int32:{name:`int32`,size:4,array:Int32Array,get:(e,t)=>st(e).getInt32(t,!0),set:(e,t,n)=>st(e).setInt32(t,n,!0)},uint32:{name:`uint32`,size:4,array:Uint32Array,get:(e,t)=>st(e).getUint32(t,!0),set:(e,t,n)=>st(e).setUint32(t,n,!0)},int64:{name:`int64`,size:8,array:BigInt64Array,get:(e,t)=>st(e).getBigInt64(t,!0),set:(e,t,n)=>st(e).setBigInt64(t,n,!0)},uint64:{name:`uint64`,size:8,array:BigUint64Array,get:(e,t)=>st(e).getBigUint64(t,!0),set:(e,t,n)=>st(e).setBigUint64(t,n,!0)},float32:{name:`float32`,size:4,array:Float32Array,get:(e,t)=>st(e).getFloat32(t,!0),set:(e,t,n)=>st(e).setFloat32(t,n,!0)},float64:{name:`float64`,size:8,array:Float64Array,get:(e,t)=>st(e).getFloat64(t,!0),set:(e,t,n)=>st(e).setFloat64(t,n,!0)}},dt=Object.keys(ut);for(let e of Object.values(ut))at(e);var ft={...ut,...Object.fromEntries(dt.map(e=>[b(e),ut[e]])),char:lt},pt=Object.keys(ft);function mt(e){return pt.includes(e.toString())}function ht(e){if(!mt(e))throw N(`EINVAL`,`Not a valid primitive type: `+e)}function gt(e){return e==`char`?`uint8`:e.toLowerCase()}function _t(e){return(typeof e==`object`||typeof e==`function`)&&e!==null&&`toInit`in e&&typeof e.toInit==`function`}function vt(e){return _t(e)?e.toInit():rt(e)?{type:e}:e}function yt(e,t,n={}){if(!e)throw N(`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(vt(t),n);if(!rt(i.type))throw N(`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 It?`${i.typeName??i.type.type.name} ${r}[${i.type.length}]${a}`:`${i.typeName??i.type.name} ${r}`,littleEndian:!i.bigEndian}}function bt(e,t){if(!(e instanceof Error)||e.message.toLowerCase()!==`offset is outside the bounds of the dataview`)throw e;let n=N(`EFAULT`,`Segmentation fault (at 0x${t.toString(16)})`);throw Error.captureStackTrace(n,bt),n}function xt(e,t){return t.type instanceof It&&t.type.length==0&&!!t.countedBy?.length&&!!e.constructor.isDynamic}function St(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 N(`EOVERFLOW`,`countedBy field value exceeds max safe integer`);n=Number(n)}if(typeof n!=`number`)throw N(`EINVAL`,`countedBy field value is not a number`);return n}function Ct(e,t){let n=t.type.type.size*St(e,t);if(kt(t.type.type)&&t.type.type.isDynamic)for(let r of e[t.name])n+=At(r);return n}var wt=Symbol(`kOffsets`);function Tt(e,t,n){let{offset:r,name:i}=t;e[wt]||=Object.create(null);let a=e[wt];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)){xt(e,t)&&(r+=Ct(e,t));let n=e[t.name];Ot(n)&&n.constructor.isDynamic&&(r+=At(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 Et(e,t,n,r){typeof n==`string`&&(n=n.charCodeAt(0));let i=e.byteOffset+Tt(e,t,!1)+(r??0)*t.type.size;try{t.type.set(e.buffer,i,n);return}catch(e){bt(e,i)}}function Dt(e,t){let n=t.type;if(xt(e,t)){let r=t.type.type;n=new It(r,St(e,t))}let r=e.byteOffset+Tt(e,t,!0);try{return n.get(e.buffer,r)}catch(e){bt(e,r)}}function Ot(e){return typeof e==`object`&&!!e&&`constructor`in e&&kt(e.constructor)}function kt(e){return typeof e==`function`&&`prototype`in e&&`fields`in e&&typeof e.fields==`object`&&rt(e)}function At(e){let t=0;for(let n of e.constructor.fields){let r=e[n.name];xt(e,n)&&(t+=Ct(e,n)),Ot(r)&&r.constructor.isDynamic&&(t+=At(r))}return t}function jt(e){if(rt(e))return e.size;if(e==null)return 0;if(typeof e==`object`&&rt(e.constructor))return e.constructor.size;if(Array.isArray(e)){let t=0;for(let n=0;n<e.length;n++)t+=jt(e[n]);return t}if(typeof e==`string`)return ht(e),ut[gt(e)].size;throw TypeError(`Unable to resolve size of \`${e.toString()}\``)}function H(e){let t=jt(e);return Ot(e)&&e.constructor.isDynamic?t+At(e):t}function Mt(e,t){let n;if(kt(e)){if(e.isDynamic)throw N(`EINVAL`,`Cannot get offset of field in dynamic struct from the constructor`);n=e}else if(Ot(e))n=e.constructor;else throw N(`EINVAL`,`Type is not a struct or struct constructor`);let{fields:r}=n,i=r.find(e=>e.name===t);if(!i)throw N(`EINVAL`,`Struct does not have field: `+t);return kt(e)?i.offset:Tt(e,i,!0)}var Nt=!1;function Pt(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]+H(e.get(this.buffer,this.byteOffset+this._offsets[n-1]));return this._offsets[t]}constructor(n,r,i){let a=typeof n==`object`?n:new ArrayBuffer((n??0)*e.size);super(a,r,i),this.length=typeof n==`number`?n:e.isDynamic?t??_(`Unknown length of StructArray<${e.name}>`):Math.floor(this.byteLength/e.size);let o=e=>this.byteOffset+this.offsetOf(e);return new Proxy(this,{get(t,n){if(n in t)return t[n];let r=parseInt(n.toString());if(!Number.isSafeInteger(r)){if(Nt)throw N(`EINVAL`,`Invalid index: `+n.toString());return}return e.get(t.buffer,o(r))},set(t,n,r){let i=parseInt(n.toString());if(!Number.isSafeInteger(i)){if(Nt)throw N(`EINVAL`,`Invalid index: `+n.toString());return!1}return e.set(t.buffer,o(i),r),!0}})}}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 Ft(e){return typeof e==`function`&&`prototype`in e&&`fields`in e&&typeof e.fields==`object`&&rt(e)}var It=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=Pt(this),this.__structArray=Pt(e,t),this.__arrayType=e.array?e.array:this.__structArray}get=(e,t)=>mt(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+=Ft(this.type)&&this.type.isDynamic?H(n[t]):this.type.size}};array};Symbol.metadata??=Symbol.for(`Symbol.metadata`);function Lt(e){e.metadata??={};let t=e.metadata.structInit??{};return e.metadata.structInit={fields:[...t.fields??[]]},e.metadata.structInit}function Rt(...e){let t=e.reduce((e,t)=>({...e,...t}),{});return typeof this==`object`&&Object.assign(t,this),function(e,n){let r=Lt(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 Dt(this,e)},set(t){Et(this,e,t)}})}}return n.addInitializer(function(){Object.defineProperty(c,"name",{value:e.name}),at(c)}),c}}Rt.packed=Rt.bind({isPacked:!0}),Rt.align=function(e){return Rt.bind({alignment:e})};function zt(e,t={}){return function(n,r){if(r.kind!=`accessor`)throw N(`EINVAL`,`Field must be an accessor`);let i=Lt(r),a=yt(r.name,e,t);return i.fields.push(a),{get(){return Dt(this,a)},set(e){Et(this,a,e)}}}}function Bt(e){let t=ut[gt(e)];function n(n,r){return typeof n==`number`?zt(new It(t,n),{typeName:e,...r}):zt(t,{typeName:e})(n,r&&`name`in r?r:_(N(`EINVAL`,`Invalid decorator context object`)))}return n}var U=Object.fromEntries(pt.map(e=>[e,Bt(e)]));function Vt(e){return e}Vt.typed=function(e){return e};var Ht=class e{type;init;constructor(t,n){this.type=t,this.init=n;let r=(r=>new e(new It(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 Ut(e,t=0){return new Ht(new It(e,t),{})}function Wt(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=yt(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 Dt(this,e)},set(t){Et(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 at(c),c}Wt.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=yt(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 at(l),l},Wt.packed=Wt.bind({isPacked:!0}),Wt.align=function(e){return Wt.bind({alignment:e})},Wt.dynamic=Wt.bind({isDynamic:!0}),Object.fromEntries(Object.entries(ft).map(([e,t])=>[e,new Ht(t,{typeName:e})]));function Gt(e){return JSON.parse(w(e),(e,t)=>e==``?t:typeof t==`string`?BigInt(t).toString(16).slice(0,Math.min(t.length,8)):t)}function Kt(e){return S(JSON.stringify(e))}function qt(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 N(`EINVAL`,`Invalid mode: `+e?.toString())}function Jt(e){if(e instanceof Date)return e.getTime();try{return Number(e)}catch{throw N(`EINVAL`,`Invalid time.`)}}function W(e,t=!1){if(e instanceof URL){if(e.protocol!=`file:`)throw N(`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 N(`EINVAL`,`Path can not contain null character`);if(e.length==0)throw N(`EINVAL`,`Path can not be empty`);return e=e.replaceAll(/[/\\]+/g,`/`),t?e:rn.call(this,e)}function Yt(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:qt(`mode`in e?e?.mode:null,r)}}function Xt(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 Zt(e){let t=Promise.withResolvers();setTimeout(()=>t.reject(N(`ETIMEDOUT`)),500),e.on(`online`,t.resolve),await t.promise}function Qt(e){return`/tmp/${W(e,!0)}${Date.now()}-${Math.random().toString(36).slice(2)}`}var $t=e({basename:()=>cn,dirname:()=>K,extname:()=>ln,format:()=>un,formatExt:()=>nn,isAbsolute:()=>on,join:()=>G,matchesGlob:()=>fn,normalize:()=>an,normalizeString:()=>tn,parse:()=>dn,relative:()=>sn,resolve:()=>rn,sep:()=>`/`});function en(e,t){if(typeof e!=`object`)throw TypeError(`"${t}" is not an object`)}function tn(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 nn(e){return e?`${e[0]===`.`?``:`.`}${e}`:``}function rn(...e){let t=``;for(let n of[...e.reverse(),Me(this).pwd])if(n?.length&&(t=`${n}/${t}`,n.startsWith(`/`)))break;let n=t.startsWith(`/`);return t=tn(t,!n),n?`/${t}`:t.length?t:`/`}function an(e){if(!e.length)return`.`;let t=e[0]===`/`,n=e.at(-1)===`/`;return e=tn(e,!t),e.length?(n&&(e+=`/`),t?`/${e}`:e):t?`/`:n?`./`:`.`}function on(e){return e.startsWith(`/`)}function G(...e){if(!e.length)return`.`;let t=e.filter(e=>e).join(`/`);return t?.length?an(t):`.`}function sn(e,t){if(e===t||(e=rn.call(this,e),t=rn.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 K(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 cn(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 ln(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 un(e){en(e,`pathObject`);let t=e.dir||e.root,n=e.base||`${e.name||``}${nn(e.ext)}`;return t?t===e.root?`${t}${n}`:`${t}/${n}`:n}function dn(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 fn(e,t){return Xt(e).test(t)}var pn=BigInt(1e3),mn=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(Je)),Object.assign(this,l)}isFile(){return(this.mode&Ge)===Je}isDirectory(){return(this.mode&Ge)===Xe}isSymbolicLink(){return(this.mode&Ge)===qe}isSocket(){return(this.mode&Ge)===Ke}isBlockDevice(){return(this.mode&Ge)===Ye}isCharacterDevice(){return(this.mode&Ge)===Ze}isFIFO(){return(this.mode&Ge)===Qe}toJSON(){return d(this,wn)}hasAccess(e,t){return Y(t,this._isBigint?new hn(this):this,e)}get atimeNs(){return BigInt(this.atimeMs)*pn}get mtimeNs(){return BigInt(this.mtimeMs)*pn}get ctimeNs(){return BigInt(this.ctimeMs)*pn}get birthtimeNs(){return BigInt(this.birthtimeMs)*pn}},hn=class extends mn{_isBigint=!1},gn=class extends mn{_isBigint=!0};function _n(e,t){return e.size==t.size&&+e.atime==+t.atime&&+e.mtime==+t.mtime&&+e.ctime==+t.ctime&&e.mode==t.mode}var vn=class{type=525687744115;bsize=4096;blocks=0;bfree=0;bavail=0;files=tt;ffree=tt},yn=class{type=BigInt(`0x7a656e6673`);bsize=BigInt(4096);blocks=BigInt(0);bfree=BigInt(0);bavail=BigInt(0);files=BigInt(tt);ffree=BigInt(tt)},bn=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},q=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},xn=3968,Sn=(()=>{var e,t;let n=[Rt.packed()],r,i=[],a,o=Vt.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=U).uint32.bind(e)],u=[(t=U).uint32.bind(t)],bn(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),bn(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),bn(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=q(this,c,void 0);get keySize(){return this.#e}set keySize(e){this.#e=e}#t=(q(this,l),q(this,d,void 0));get valueSize(){return this.#t}set valueSize(e){this.#t=e}get name(){return w(this.subarray(8,8+this.keySize))}set name(e){let t=S(e);if(8+t.length+this.valueSize>xn)throw N(`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>xn)throw N(`EOVERFLOW`);this.valueSize=e.length,this.set(e,8+this.keySize)}get size(){return 8+this.keySize+this.valueSize}constructor(){super(...arguments),q(this,f)}static{q(a,i)}};return a})(),Cn=(()=>{var e;let t=[Rt.packed()],n,r=[],a,o=Vt(i),s,c=[],l=[];var u=class extends o{static{a=this}static{let i=typeof Symbol==`function`&&Symbol.metadata?Object.create(o[Symbol.metadata]??null):void 0;s=[(e=U).uint32.bind(e)],bn(this,null,s,{kind:`accessor`,name:`size`,static:!1,private:!1,access:{has:e=>`size`in e,get:e=>e.size,set:(e,t)=>{e.size=t}},metadata:i},c,l),bn(null,n={value:a},t,{kind:`class`,name:a.name,metadata:i},null,r),u=a=n.value,i&&Object.defineProperty(a,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:i})}static name=`Attributes`;#e=q(this,c,void 0);get size(){return this.#e}set size(e){this.#e=e}get byteSize(){let e=this.byteOffset+H(this);for(let t=0;t<this.size;t++){let t=new Sn(this.buffer,e);e+=t.size}return e}has(e){let t=this.byteOffset+H(this);for(let n=0;n<this.size;n++){let n=new Sn(this.buffer,t);if(n.name==e)return!0;t+=n.size}return!1}get(e){let t=this.byteOffset+H(this);for(let n=0;n<this.size;n++){let n=new Sn(this.buffer,t);if(n.name==e)return n.value;t+=n.size}}set(e,t){let n=this.byteOffset+H(this),r;for(let t=0;t<this.size;t++){let t=new Sn(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 Sn(this.buffer,n);a.name=e,a.value=t,this.size++}remove(e){let t=this.byteOffset+H(this),n;for(let r=0;r<this.size;r++){let r=new Sn(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+H(this);for(let t=0;t<this.size;t++){let t=new Sn(this.buffer,e);yield t.name,e+=t.size}}*values(){let e=this.byteOffset+H(this);for(let t=0;t<this.size;t++){let t=new Sn(this.buffer,e);yield t.value,e+=t.size}}*entries(){let e=this.byteOffset+H(this);for(let t=0;t<this.size;t++){let t=new Sn(this.buffer,e);yield[t.name,t.value],e+=t.size}}constructor(){super(...arguments),q(this,l)}static{q(a,r)}};return a})(),wn=[`ino`,`data`,`size`,`mode`,`flags`,`nlink`,`uid`,`gid`,`atimeMs`,`birthtimeMs`,`mtimeMs`,`ctimeMs`,`version`],Tn;(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`})(Tn||={});var En=253951,Dn=229631,J=(()=>{var e,t,n,r,a,o,s,c,l,u,f,p,m,h,g,_;let v=[Rt.packed()],y,b=[],x,S=Vt(i),C,w=[],T=[],ee,E=[],D=[],O,k=[],A=[],j,M=[],P=[],te,F=[],I=[],ne,re=[],ie=[],ae,oe=[],se=[],R,ce=[],le=[],ue,de=[],fe=[],pe,me=[],he=[],ge,_e=[],B=[],ve,V=[],ye=[],be,xe=[],Se=[],Ce,we=[],Te=[],Ee,De=[],Oe=[],ke,Ae=[],je=[],Me,Ne=[],Pe=[],Fe,Ie=[],Le=[],Re,ze=[],Be=[];var Ve=class extends S{static{x=this}static{let i=typeof Symbol==`function`&&Symbol.metadata?Object.create(S[Symbol.metadata]??null):void 0;C=[(e=U).uint32.bind(e)],ee=[(t=U).uint32.bind(t)],O=[(n=U).uint32.bind(n)],j=[(r=U).uint16.bind(r)],te=[(a=U).uint32.bind(a)],ne=[(o=U).uint32.bind(o)],ae=[(s=U).uint32.bind(s)],R=[(c=U).float64.bind(c)],ue=[(l=U).float64.bind(l)],pe=[(u=U).float64.bind(u)],ge=[(f=U).float64.bind(f)],ve=[(p=U).uint32.bind(p)],be=[(m=U).uint32.bind(m)],Ce=[(h=U).uint32.bind(h)],Ee=[(g=U).uint16.bind(g)],ke=[(_=U).uint32.bind(_)],Me=[U.uint8(48)],Fe=[zt(Cn)],Re=[U.uint8(xn)],bn(this,null,C,{kind:`accessor`,name:`data`,static:!1,private:!1,access:{has:e=>`data`in e,get:e=>e.data,set:(e,t)=>{e.data=t}},metadata:i},w,T),bn(this,null,ee,{kind:`accessor`,name:`__data_old`,static:!1,private:!1,access:{has:e=>`__data_old`in e,get:e=>e.__data_old,set:(e,t)=>{e.__data_old=t}},metadata:i},E,D),bn(this,null,O,{kind:`accessor`,name:`size`,static:!1,private:!1,access:{has:e=>`size`in e,get:e=>e.size,set:(e,t)=>{e.size=t}},metadata:i},k,A),bn(this,null,j,{kind:`accessor`,name:`mode`,static:!1,private:!1,access:{has:e=>`mode`in e,get:e=>e.mode,set:(e,t)=>{e.mode=t}},metadata:i},M,P),bn(this,null,te,{kind:`accessor`,name:`nlink`,static:!1,private:!1,access:{has:e=>`nlink`in e,get:e=>e.nlink,set:(e,t)=>{e.nlink=t}},metadata:i},F,I),bn(this,null,ne,{kind:`accessor`,name:`uid`,static:!1,private:!1,access:{has:e=>`uid`in e,get:e=>e.uid,set:(e,t)=>{e.uid=t}},metadata:i},re,ie),bn(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:i},oe,se),bn(this,null,R,{kind:`accessor`,name:`atimeMs`,static:!1,private:!1,access:{has:e=>`atimeMs`in e,get:e=>e.atimeMs,set:(e,t)=>{e.atimeMs=t}},metadata:i},ce,le),bn(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:i},de,fe),bn(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:i},me,he),bn(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:i},_e,B),bn(this,null,ve,{kind:`accessor`,name:`ino`,static:!1,private:!1,access:{has:e=>`ino`in e,get:e=>e.ino,set:(e,t)=>{e.ino=t}},metadata:i},V,ye),bn(this,null,be,{kind:`accessor`,name:`__ino_old`,static:!1,private:!1,access:{has:e=>`__ino_old`in e,get:e=>e.__ino_old,set:(e,t)=>{e.__ino_old=t}},metadata:i},xe,Se),bn(this,null,Ce,{kind:`accessor`,name:`flags`,static:!1,private:!1,access:{has:e=>`flags`in e,get:e=>e.flags,set:(e,t)=>{e.flags=t}},metadata:i},we,Te),bn(this,null,Ee,{kind:`accessor`,name:`__after_flags`,static:!1,private:!1,access:{has:e=>`__after_flags`in e,get:e=>e.__after_flags,set:(e,t)=>{e.__after_flags=t}},metadata:i},De,Oe),bn(this,null,ke,{kind:`accessor`,name:`version`,static:!1,private:!1,access:{has:e=>`version`in e,get:e=>e.version,set:(e,t)=>{e.version=t}},metadata:i},Ae,je),bn(this,null,Me,{kind:`accessor`,name:`__padding`,static:!1,private:!1,access:{has:e=>`__padding`in e,get:e=>e.__padding,set:(e,t)=>{e.__padding=t}},metadata:i},Ne,Pe),bn(this,null,Fe,{kind:`accessor`,name:`attributes`,static:!1,private:!1,access:{has:e=>`attributes`in e,get:e=>e.attributes,set:(e,t)=>{e.attributes=t}},metadata:i},Ie,Le),bn(this,null,Re,{kind:`accessor`,name:`__data`,static:!1,private:!1,access:{has:e=>`__data`in e,get:e=>e.__data,set:(e,t)=>{e.__data=t}},metadata:i},ze,Be),bn(null,y={value:x},v,{kind:`class`,name:x.name,metadata:i},null,b),Ve=x=y.value,i&&Object.defineProperty(x,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:i})}static name=`Inode`;constructor(...e){let t={};if(typeof e[0]==`object`&&e[0]!==null&&!ArrayBuffer.isView(e[0])&&(t=e[0],e=[H(Ve)]),super(...e),q(this,Be),this.byteLength<H(Ve))throw L(N(`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=q(this,w,void 0);get data(){return this.#e}set data(e){this.#e=e}#t=(q(this,T),q(this,E,void 0));get __data_old(){return this.#t}set __data_old(e){this.#t=e}#n=(q(this,D),q(this,k,void 0));get size(){return this.#n}set size(e){this.#n=e}#r=(q(this,A),q(this,M,void 0));get mode(){return this.#r}set mode(e){this.#r=e}#i=(q(this,P),q(this,F,void 0));get nlink(){return this.#i}set nlink(e){this.#i=e}#a=(q(this,I),q(this,re,void 0));get uid(){return this.#a}set uid(e){this.#a=e}#o=(q(this,ie),q(this,oe,void 0));get gid(){return this.#o}set gid(e){this.#o=e}#s=(q(this,se),q(this,ce,void 0));get atimeMs(){return this.#s}set atimeMs(e){this.#s=e}#c=(q(this,le),q(this,de,void 0));get birthtimeMs(){return this.#c}set birthtimeMs(e){this.#c=e}#l=(q(this,fe),q(this,me,void 0));get mtimeMs(){return this.#l}set mtimeMs(e){this.#l=e}#u=(q(this,he),q(this,_e,void 0));get ctimeMs(){return this.#u}set ctimeMs(e){this.#u=e}#d=(q(this,B),q(this,V,void 0));get ino(){return this.#d}set ino(e){this.#d=e}#f=(q(this,ye),q(this,xe,void 0));get __ino_old(){return this.#f}set __ino_old(e){this.#f=e}#p=(q(this,Se),q(this,we,void 0));get flags(){return this.#p}set flags(e){this.#p=e}#m=(q(this,Te),q(this,De,void 0));get __after_flags(){return this.#m}set __after_flags(e){this.#m=e}#h=(q(this,Oe),q(this,Ae,void 0));get version(){return this.#h}set version(e){this.#h=e}#g=(q(this,je),q(this,Ne,void 0));get __padding(){return this.#g}set __padding(e){this.#g=e}#_=(q(this,Pe),q(this,Ie,void 0));get attributes(){return this.#_}set attributes(e){this.#_=e}#v=(q(this,Le),q(this,ze,void 0));get __data(){return this.#v}set __data(e){this.#v=e}toString(){return`<Inode ${this.ino}>`}toJSON(){return{...d(this,wn),attributes:this.attributes}}toStats(){return new hn(this)}update(e){if(!e)return!1;let t=!1;for(let n of wn)e[n]!==void 0&&(n==`ino`||n==`data`||this[n]!==e[n]&&(n==`atimeMs`&&this.flags&Tn.NoAtime||(this[n]=e[n],t=!0)));return e.attributes&&(this.attributes.copyFrom(e.attributes),t=!0),t&&(this.ctimeMs=Date.now()),t}static{q(x,b)}};return Ve=x})();function On(e){return(e.mode&Ge)===Je}function kn(e){return(e.mode&Ge)===Xe}function An(e){return(e.mode&Ge)===qe}function jn(e){return(e.mode&Ge)===Ke}function Mn(e){return(e.mode&Ge)===Ye}function Nn(e){return(e.mode&Ge)===Ze}function Pn(e){return(e.mode&Ge)===Qe}function Y(e,t,n){let{credentials:r}=Me(e);if(An(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 Fn(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 In=class e extends Map{maxSize=tt;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*H(J);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 N(`ENOENT`);if((t.mode&61440)!=16384)throw N(`ENOTDIR`);let n={};for(let t of this.keys())K(t)==e&&t!=e&&(n[cn(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())K(e)==t&&e!=t&&(r[cn(e)]=this.get(e).ino);e.set(t,r)}return e}fromJSON(e){if(e.version!=1)throw N(`EINVAL`,`Index version mismatch`);this.clear();for(let[t,n]of Object.entries(e.entries))n.data??=y(1,tt),t==`/`&&(n.ino=0),this.set(t,new J(n));return this}static parse(t){if(!p(t))throw N(`EINVAL`,`Invalid JSON`);let n=JSON.parse(t),r=new e;return r.fromJSON(n),r}},Ln=4096,Rn=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 N(`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+=Ln){let r=t+Ln>a?a-t:Ln,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 zn=class{store;constructor(e){this.store=e}},Bn=class extends zn{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)}},Vn=class extends zn{asyncDone=Promise.resolve();async(e){this.asyncDone=this.asyncDone.then(()=>e)}_cached(e,t){this.store.cache??=new Map;let n=this.store.cache.get(e);return n?(t&&(n.size=t.size),n):t?new a(e,t.size,{},this.store.cache):void 0}getSync(e,t,n){let r=this._cached(e);if(!r)return;n??=r.size;let i=r.missing(t,n);for(let{start:t,end:n}of i)this.async(this.get(e,t,n));if(i.length)throw N(`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)}},Hn=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 Vn))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 Vn))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)}}},Un=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},Wn=(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}),Gn=class extends Rn{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=sn(e,r);if(a.startsWith(`..`))continue;let o=G(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,ue(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=Un(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,Kt(r.get(t)));await n.commit()}catch(e){t.error=e,t.hasError=!0}finally{let e=Wn(t);e&&await e}}loadIndexSync(e){let t={stack:[],error:void 0,hasError:!1};try{let n=Un(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,Kt(r.get(t)));n.commitSync()}catch(e){t.error=e,t.hasError=!0}finally{Wn(t)}}async createIndex(){let e={stack:[],error:void 0,hasError:!1};try{let t=new In,n=Un(e,this.transaction(),!0),r=[[`/`,0]],i=g(N(`EDEADLK`));for(;r.length;){let[e,i]=r.shift(),a=new J(await n.get(i));if(t.set(e,a),a.mode&16384){let t=Gt(await n.get(a.data)??_(N(`ENODATA`)));for(let[n,i]of Object.entries(t))r.push([G(e,n),i])}}return i(),t}catch(t){e.error=t,e.hasError=!0}finally{let t=Wn(e);t&&await t}}createIndexSync(){let e={stack:[],error:void 0,hasError:!1};try{let t=new In,n=Un(e,this.transaction(),!1),r=[[`/`,0]],i=g(N(`EDEADLK`));for(;r.length;){let[e,i]=r.shift(),a=new J(n.getSync(i));if(t.set(e,a),a.mode&16384){let t=Gt(n.getSync(a.data)??_(N(`ENODATA`)));for(let[n,i]of Object.entries(t))r.push([G(e,n),i])}}return i(),t}catch(t){e.error=t,e.hasError=!0}finally{Wn(e)}}async rename(e,t){let n={stack:[],error:void 0,hasError:!1};try{let r=Un(n,this.transaction(),!0),i=dn(e),a=dn(t),o=await this.findInode(r,i.dir),s=Gt(await r.get(o.data)??_(N(`ENODATA`)));if(!s[i.base])throw N(`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 N(`EBUSY`);let l=a.dir==i.dir,u=l?o:await this.findInode(r,a.dir),d=l?s:Gt(await r.get(u.data)??_(N(`ENODATA`)));if(d[a.base]){let e=new J(await r.get(d[a.base])??_(N(`ENOENT`)));if(!On(e))throw N(`EISDIR`);await r.remove(e.data),await r.remove(d[a.base])}d[a.base]=c,await r.set(o.data,Kt(s)),await r.set(u.data,Kt(d)),await r.commit(),this._move(e,t)}catch(e){n.error=e,n.hasError=!0}finally{let e=Wn(n);e&&await e}}renameSync(e,t){let n={stack:[],error:void 0,hasError:!1};try{let r=Un(n,this.transaction(),!1),i=dn(e),a=dn(t),o=this.findInodeSync(r,i.dir),s=Gt(r.getSync(o.data)??_(N(`ENODATA`)));if(!s[i.base])throw N(`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 N(`EBUSY`);let l=a.dir===i.dir,u=l?o:this.findInodeSync(r,a.dir),d=l?s:Gt(r.getSync(u.data)??_(N(`ENODATA`)));if(d[a.base]){let e=new J(r.getSync(d[a.base])??_(N(`ENOENT`)));if(!On(e))throw N(`EISDIR`);r.removeSync(e.data),r.removeSync(d[a.base])}d[a.base]=c,r.setSync(o.data,Kt(s)),r.setSync(u.data,Kt(d)),r.commitSync(),this._move(e,t)}catch(e){n.error=e,n.hasError=!0}finally{Wn(n)}}async stat(e){let t={stack:[],error:void 0,hasError:!1};try{let n=Un(t,this.transaction(),!0);return await this.findInode(n,e)}catch(e){t.error=e,t.hasError=!0}finally{let e=Wn(t);e&&await e}}statSync(e){let t={stack:[],error:void 0,hasError:!1};try{let n=Un(t,this.transaction(),!1);return this.findInodeSync(n,e)}catch(e){t.error=e,t.hasError=!0}finally{Wn(t)}}async touch(e,t){let n={stack:[],error:void 0,hasError:!1};try{let r=Un(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=Wn(n);e&&await e}}touchSync(e,t){let n={stack:[],error:void 0,hasError:!1};try{let r=Un(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{Wn(n)}}async createFile(e,t){return t.mode|=Je,await this.commitNew(e,t,new Uint8Array)}createFileSync(e,t){return t.mode|=Je,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 N(`ENOTEMPTY`);await this.remove(e,!0)}rmdirSync(e){if(this.readdirSync(e).length)throw N(`ENOTEMPTY`);this.removeSync(e,!0)}async mkdir(e,t){return t.mode|=Xe,await this.commitNew(e,t,S(`{}`))}mkdirSync(e,t){return t.mode|=Xe,this.commitNewSync(e,t,S(`{}`))}async readdir(e){let t={stack:[],error:void 0,hasError:!1};try{let n=Un(t,this.transaction(),!0),r=await this.findInode(n,e);return Object.keys(Gt(await n.get(r.data)??_(N(`ENOENT`))))}catch(e){t.error=e,t.hasError=!0}finally{let e=Wn(t);e&&await e}}readdirSync(e){let t={stack:[],error:void 0,hasError:!1};try{let n=Un(t,this.transaction(),!1),r=this.findInodeSync(n,e);return Object.keys(Gt(n.getSync(r.data)??_(N(`ENOENT`))))}catch(e){t.error=e,t.hasError=!0}finally{Wn(t)}}async sync(){}syncSync(){}async link(e,t){let n={stack:[],error:void 0,hasError:!1};try{let r=Un(n,this.transaction(),!0),i=K(t),a=await this.findInode(r,i),o=Gt(await r.get(a.data)??_(N(`ENOENT`))),s=await this.findInode(r,e);s.nlink++,o[cn(t)]=s.ino,this._add(s.ino,t),await r.set(s.ino,s),await r.set(a.data,Kt(o)),await r.commit()}catch(e){n.error=e,n.hasError=!0}finally{let e=Wn(n);e&&await e}}linkSync(e,t){let n={stack:[],error:void 0,hasError:!1};try{let r=Un(n,this.transaction(),!1),i=K(t),a=this.findInodeSync(r,i),o=Gt(r.getSync(a.data)??_(N(`ENOENT`))),s=this.findInodeSync(r,e);s.nlink++,o[cn(t)]=s.ino,this._add(s.ino,t),r.setSync(s.ino,s),r.setSync(a.data,Kt(o)),r.commitSync()}catch(e){n.error=e,n.hasError=!0}finally{Wn(n)}}async read(e,t,n,r){let i={stack:[],error:void 0,hasError:!1};try{let a=Un(i,this.transaction(),!0),o=await this.findInode(a,e);if(o.size==0)return;let s=await a.get(o.data,n,r)??_(N(`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=Wn(i);e&&await e}}readSync(e,t,n,r){let i={stack:[],error:void 0,hasError:!1};try{let a=Un(i,this.transaction(),!1),o=this.findInodeSync(a,e);if(o.size==0)return;let s=a.getSync(o.data,n,r)??_(N(`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{Wn(i)}}async write(e,t,n){let i={stack:[],error:void 0,hasError:!1};try{let a=Un(i,this.transaction(),!0),o=await this.findInode(a,e),s=t;a.flag(`partial`)||(s=r(await a.get(o.data)??new Uint8Array,n+t.byteLength),s.set(t,n),n=0),await a.set(o.data,s,n),this._add(o.ino,e),await a.commit()}catch(e){i.error=e,i.hasError=!0}finally{let e=Wn(i);e&&await e}}writeSync(e,t,n){let i={stack:[],error:void 0,hasError:!1};try{let a=Un(i,this.transaction(),!1),o=this.findInodeSync(a,e),s=t;a.flag(`partial`)||(s=r(a.getSync(o.data)??new Uint8Array,n+t.byteLength),s.set(t,n),n=0),a.setSync(o.data,s,n),this._add(o.ino,e),a.commitSync()}catch(e){i.error=e,i.hasError=!0}finally{Wn(i)}}transaction(){return new Hn(this.store.transaction(),this)}async checkRoot(){let e={stack:[],error:void 0,hasError:!1};try{let t=Un(e,this.transaction(),!0);if(await t.get(0))return;let n=new J({ino:0,data:1,mode:511|Xe});await t.set(n.data,S(`{}`)),this._add(0,`/`),await t.set(0,n),await t.commit()}catch(t){e.error=t,e.hasError=!0}finally{let t=Wn(e);t&&await t}}checkRootSync(){let e={stack:[],error:void 0,hasError:!1};try{let t=Un(e,this.transaction(),!1);if(t.getSync(0))return;let n=new J({ino:0,data:1,mode:511|Xe});t.setSync(n.data,S(`{}`)),this._add(0,`/`),t.setSync(0,n),t.commitSync()}catch(t){e.error=t,e.hasError=!0}finally{Wn(e)}}async _populate(){let e={stack:[],error:void 0,hasError:!1};try{if(this._initialized){z(`Attempted to populate tables after initialization`);return}ue(`Populating tables with existing store metadata`);let t=Un(e,this.transaction(),!0),n=await t.get(0);if(!n){ce(`Store does not have a root inode`);let e=new J({ino:0,data:1,mode:511|Xe});await t.set(e.data,S(`{}`)),this._add(0,`/`),await t.set(0,e),await t.commit();return}if(n.length<H(J)){L(`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<H(J)){z(`Invalid inode size for ino ${n}: ${o.length}`);continue}let s=new J(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=Gt(c);for(let[t,n]of Object.entries(l))a.push([G(e,t),n])}ue(`Added ${i} existing inode(s) from store`)}catch(t){e.error=t,e.hasError=!0}finally{let t=Wn(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}ue(`Populating tables with existing store metadata`);let t=Un(e,this.transaction(),!1),n=t.getSync(0);if(!n){ce(`Store does not have a root inode`);let e=new J({ino:0,data:1,mode:511|Xe});t.setSync(e.data,S(`{}`)),this._add(0,`/`),t.setSync(0,e),t.commitSync();return}if(n.length<H(J)){L(`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<H(J)){z(`Invalid inode size for ino ${n}: ${o.length}`);continue}let s=new J(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=Gt(c);for(let[t,n]of Object.entries(l))a.push([G(e,t),n])}ue(`Added ${i} existing inode(s) from store`)}catch(t){e.error=t,e.hasError=!0}finally{Wn(e)}}async _findInode(e,t,n=new Set){if(n.has(t))throw L(N(`EIO`,`Infinite loop detected while finding inode`));if(n.add(t),t==`/`)return new J(await e.get(0)??_(N(`ENODATA`)));let{dir:r,base:i}=dn(t),a=await this._findInode(e,r,n),o=Gt(await e.get(a.data)??_(N(`ENODATA`)));if(!(i in o))throw N(`ENOENT`);return new J(await e.get(o[i])??_(N(`ENODATA`)))}_findInodeSync(e,t,n=new Set){if(n.has(t))throw L(N(`EIO`,`Infinite loop detected while finding inode`));if(n.add(t),t==`/`)return new J(e.getSync(0)??_(N(`ENOENT`)));let{dir:r,base:i}=dn(t),a=this._findInodeSync(e,r,n),o=Gt(e.getSync(a.data)??_(N(`ENODATA`)));if(!(i in o))throw N(`ENOENT`);return new J(e.getSync(o[i])??_(N(`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 N(`ENOENT`);return new J(await e.get(n)??_(N(`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 N(`ENOENT`);return new J(e.getSync(n)??_(N(`ENOENT`)))}_lastID;allocNew(e){this._lastID??=Math.max(...this._paths.keys()),this._lastID+=2;let t=this._lastID;if(t>4294967295)throw R(N(`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 N(`EEXIST`);let i=Un(r,this.transaction(),!0),{dir:a,base:o}=dn(e),s=await this.findInode(i,a),c=Gt(await i.get(s.data)??_(N(`ENOENT`)));if(c[o])throw N(`EEXIST`);let l=this.allocNew(e),u=new J({...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,Kt(c)),await i.commit(),u}catch(e){r.error=e,r.hasError=!0}finally{let e=Wn(r);e&&await e}}commitNewSync(e,t,n){let r={stack:[],error:void 0,hasError:!1};try{if(e==`/`)throw N(`EEXIST`);let i=Un(r,this.transaction(),!1),{dir:a,base:o}=dn(e),s=this.findInodeSync(i,a),c=Gt(i.getSync(s.data)??_(N(`ENOENT`)));if(c[o])throw N(`EEXIST`);let l=this.allocNew(e),u=new J({...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,Kt(c)),i.commitSync(),u}catch(e){r.error=e,r.hasError=!0}finally{Wn(r)}}async remove(e,t){let n={stack:[],error:void 0,hasError:!1};try{let r=Un(n,this.transaction(),!0),{dir:i,base:a}=dn(e),o=await this.findInode(r,i),s=Gt(await r.get(o.data)??_(N(`ENOENT`)));if(!s[a])throw N(`ENOENT`);let c=s[a],l=new J(await r.get(c)??_(N(`ENOENT`)));if(delete s[a],!t&&kn(l))throw N(`EISDIR`);await r.set(o.data,Kt(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=Wn(n);e&&await e}}removeSync(e,t){let n={stack:[],error:void 0,hasError:!1};try{let r=Un(n,this.transaction(),!1),{dir:i,base:a}=dn(e),o=this.findInodeSync(r,i),s=Gt(r.getSync(o.data)??_(N(`ENOENT`))),c=s[a];if(!c)throw N(`ENOENT`);let l=new J(r.getSync(c)??_(N(`ENOENT`)));if(delete s[a],!t&&kn(l))throw N(`EISDIR`);r.setSync(o.data,Kt(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{Wn(n)}}},Kn=class extends Bn{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)}},qn=class extends Vn{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)}},Jn=class extends Map{maxSize;label;flags=[];name=`tmpfs`;constructor(e=tt,t){super(),this.maxSize=e,this.label=t}async sync(){}transaction(){return new Kn(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}}},Yn={name:`InMemory`,options:{maxSize:{type:`number`,required:!1},label:{type:`string`,required:!1}},create({maxSize:e,label:t}){let n=new Gn(new Jn(e,t));return n.checkRootSync(),n}},Xn=class extends Gn{devices=new Map;devicesWithDriver(e,t){if(t&&typeof e==`string`)throw R(N(`EINVAL`,`Can not fetch devices using only a driver name`));let n=[];for(let r of this.devices.values())t&&r.driver!=e||(typeof e==`string`?e:e.name)==r.driver.name&&n.push(r);return n}_createDevice(e,t={}){let n=1,r=Array.from(this.devices.values()).at(-1);for(;this.store.has(n)||r?.inode.ino==n;)n++;let i=e.init?.(n,t),a={data:{},minor:0,major:0,...f(i??{},`metadata`),driver:e,inode:new J({mode:Ze|438,...i?.metadata})},o=`/`+(a.name||e.name)+(e.singleton?``:this.devicesWithDriver(e).length);if(this.existsSync(o))throw N(`EEXIST`);return this.devices.set(o,a),le(`Initialized device: `+this._mountPoint+o),a}addDefaults(){this._createDevice(Qn),this._createDevice($n),this._createDevice(er),this._createDevice(tr),this._createDevice(nr),ue(`Added default devices`)}constructor(){super(new Jn(16777216,`devfs`))}async rename(e,t){if(this.devices.has(e))throw N(`EPERM`);if(this.devices.has(t))throw N(`EEXIST`);return super.rename(e,t)}renameSync(e,t){if(this.devices.has(e))throw N(`EPERM`);if(this.devices.has(t))throw N(`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 N(`EEXIST`);return super.createFile(e,t)}createFileSync(e,t){if(this.devices.has(e))throw N(`EEXIST`);return super.createFileSync(e,t)}async unlink(e){if(this.devices.has(e))throw N(`EPERM`);return super.unlink(e)}unlinkSync(e){if(this.devices.has(e))throw N(`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 N(`EEXIST`);return super.mkdir(e,t)}mkdirSync(e,t){if(this.devices.has(e))throw N(`EEXIST`);return super.mkdirSync(e,t)}async readdir(e){let t=await super.readdir(e);for(let n of this.devices.keys())K(n)==e&&t.push(cn(n));return t}readdirSync(e){let t=super.readdirSync(e);for(let n of this.devices.keys())K(n)==e&&t.push(cn(n));return t}async link(e,t){if(this.devices.has(e))throw N(`EPERM`);if(this.devices.has(t))throw N(`EEXIST`);return super.link(e,t)}linkSync(e,t){if(this.devices.has(e))throw N(`EPERM`);if(this.devices.has(t))throw N(`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)}},Zn=new Uint8Array,Qn={name:`null`,singleton:!0,init(){return{major:1,minor:3}},read(){return Zn},write(){}},$n={name:`zero`,singleton:!0,init(){return{major:1,minor:5}},read(e,t,n,r){t.fill(0,n,r)},write(){}},er={name:`full`,singleton:!0,init(){return{major:1,minor:7}},read(e,t,n,r){t.fill(0,n,r)},write(){throw N(`ENOSPC`)}},tr={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(){}},nr={name:`console`,singleton:!0,init(e,{output:t=e=>console.log(e)}={}){return{major:5,minor:1,data:{output:t}}},read(){return Zn},write(e,t,n){let r=w(t);e.data.output(r,n)}},rr={null:Qn,zero:$n,full:er,random:tr,console:nr},ir=n((e=>{e.byteLength=c,e.toByteArray=u,e.fromByteArray=p;for(var t=[],n=[],r=typeof Uint8Array<`u`?Uint8Array:Array,i=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,a=0,o=i.length;a<o;++a)t[a]=i[a],n[i.charCodeAt(a)]=a;n[45]=62,n[95]=63;function s(e){var t=e.length;if(t%4>0)throw Error(`Invalid string. Length must be a multiple of 4`);var n=e.indexOf(`=`);n===-1&&(n=t);var r=n===t?0:4-n%4;return[n,r]}function c(e){var t=s(e),n=t[0],r=t[1];return(n+r)*3/4-r}function l(e,t,n){return(t+n)*3/4-n}function u(e){var t,i=s(e),a=i[0],o=i[1],c=new r(l(e,a,o)),u=0,d=o>0?a-4:a,f;for(f=0;f<d;f+=4)t=n[e.charCodeAt(f)]<<18|n[e.charCodeAt(f+1)]<<12|n[e.charCodeAt(f+2)]<<6|n[e.charCodeAt(f+3)],c[u++]=t>>16&255,c[u++]=t>>8&255,c[u++]=t&255;return o===2&&(t=n[e.charCodeAt(f)]<<2|n[e.charCodeAt(f+1)]>>4,c[u++]=t&255),o===1&&(t=n[e.charCodeAt(f)]<<10|n[e.charCodeAt(f+1)]<<4|n[e.charCodeAt(f+2)]>>2,c[u++]=t>>8&255,c[u++]=t&255),c}function d(e){return t[e>>18&63]+t[e>>12&63]+t[e>>6&63]+t[e&63]}function f(e,t,n){for(var r,i=[],a=t;a<n;a+=3)r=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(e[a+2]&255),i.push(d(r));return i.join(``)}function p(e){for(var n,r=e.length,i=r%3,a=[],o=16383,s=0,c=r-i;s<c;s+=o)a.push(f(e,s,s+o>c?c:s+o));return i===1?(n=e[r-1],a.push(t[n>>2]+t[n<<4&63]+`==`)):i===2&&(n=(e[r-2]<<8)+e[r-1],a.push(t[n>>10]+t[n>>4&63]+t[n<<2&63]+`=`)),a.join(``)}})),ar=n((e=>{e.read=function(e,t,n,r,i){var a,o,s=i*8-r-1,c=(1<<s)-1,l=c>>1,u=-7,d=n?i-1:0,f=n?-1:1,p=e[t+d];for(d+=f,a=p&(1<<-u)-1,p>>=-u,u+=s;u>0;a=a*256+e[t+d],d+=f,u-=8);for(o=a&(1<<-u)-1,a>>=-u,u+=r;u>0;o=o*256+e[t+d],d+=f,u-=8);if(a===0)a=1-l;else if(a===c)return o?NaN:(p?-1:1)*(1/0);else o+=2**r,a-=l;return(p?-1:1)*o*2**(a-r)},e.write=function(e,t,n,r,i,a){var o,s,c,l=a*8-i-1,u=(1<<l)-1,d=u>>1,f=i===23?2**-24-2**-77:0,p=r?0:a-1,m=r?1:-1,h=+(t<0||t===0&&1/t<0);for(t=Math.abs(t),isNaN(t)||t===1/0?(s=+!!isNaN(t),o=u):(o=Math.floor(Math.log(t)/Math.LN2),t*(c=2**-o)<1&&(o--,c*=2),o+d>=1?t+=f/c:t+=f*2**(1-d),t*c>=2&&(o++,c/=2),o+d>=u?(s=0,o=u):o+d>=1?(s=(t*c-1)*2**i,o+=d):(s=t*2**(d-1)*2**i,o=0));i>=8;e[n+p]=s&255,p+=m,s/=256,i-=8);for(o=o<<i|s,l+=i;l>0;e[n+p]=o&255,p+=m,o/=256,l-=8);e[n+p-m]|=h*128}})),or=n((e=>{var t=ir(),n=ar(),r=typeof Symbol==`function`&&typeof Symbol.for==`function`?Symbol.for(`nodejs.util.inspect.custom`):null;e.Buffer=s,e.SlowBuffer=v,e.INSPECT_MAX_BYTES=50;var i=2147483647;e.kMaxLength=i,s.TYPED_ARRAY_SUPPORT=a(),!s.TYPED_ARRAY_SUPPORT&&typeof console<`u`&&typeof console.error==`function`&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function a(){try{let e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),e.foo()===42}catch{return!1}}Object.defineProperty(s.prototype,"parent",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.buffer}}),Object.defineProperty(s.prototype,"offset",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.byteOffset}});function o(e){if(e>i)throw RangeError(`The value "`+e+`" is invalid for option "size"`);let t=new Uint8Array(e);return Object.setPrototypeOf(t,s.prototype),t}function s(e,t,n){if(typeof e==`number`){if(typeof t==`string`)throw TypeError(`The "string" argument must be of type string. Received type number`);return d(e)}return c(e,t,n)}s.poolSize=8192;function c(e,t,n){if(typeof e==`string`)return f(e,t);if(ArrayBuffer.isView(e))return m(e);if(e==null)throw TypeError(`The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type `+typeof e);if(B(e,ArrayBuffer)||e&&B(e.buffer,ArrayBuffer)||typeof SharedArrayBuffer<`u`&&(B(e,SharedArrayBuffer)||e&&B(e.buffer,SharedArrayBuffer)))return h(e,t,n);if(typeof e==`number`)throw TypeError(`The "value" argument must not be of type number. Received type number`);let r=e.valueOf&&e.valueOf();if(r!=null&&r!==e)return s.from(r,t,n);let i=g(e);if(i)return i;if(typeof Symbol<`u`&&Symbol.toPrimitive!=null&&typeof e[Symbol.toPrimitive]==`function`)return s.from(e[Symbol.toPrimitive](`string`),t,n);throw TypeError(`The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type `+typeof e)}s.from=function(e,t,n){return c(e,t,n)},Object.setPrototypeOf(s.prototype,Uint8Array.prototype),Object.setPrototypeOf(s,Uint8Array);function l(e){if(typeof e!=`number`)throw TypeError(`"size" argument must be of type number`);if(e<0)throw RangeError(`The value "`+e+`" is invalid for option "size"`)}function u(e,t,n){return l(e),e<=0||t===void 0?o(e):typeof n==`string`?o(e).fill(t,n):o(e).fill(t)}s.alloc=function(e,t,n){return u(e,t,n)};function d(e){return l(e),o(e<0?0:_(e)|0)}s.allocUnsafe=function(e){return d(e)},s.allocUnsafeSlow=function(e){return d(e)};function f(e,t){if((typeof t!=`string`||t===``)&&(t=`utf8`),!s.isEncoding(t))throw TypeError(`Unknown encoding: `+t);let n=y(e,t)|0,r=o(n),i=r.write(e,t);return i!==n&&(r=r.slice(0,i)),r}function p(e){let t=e.length<0?0:_(e.length)|0,n=o(t);for(let r=0;r<t;r+=1)n[r]=e[r]&255;return n}function m(e){if(B(e,Uint8Array)){let t=new Uint8Array(e);return h(t.buffer,t.byteOffset,t.byteLength)}return p(e)}function h(e,t,n){if(t<0||e.byteLength<t)throw RangeError(`"offset" is outside of buffer bounds`);if(e.byteLength<t+(n||0))throw RangeError(`"length" is outside of buffer bounds`);let r;return r=t===void 0&&n===void 0?new Uint8Array(e):n===void 0?new Uint8Array(e,t):new Uint8Array(e,t,n),Object.setPrototypeOf(r,s.prototype),r}function g(e){if(s.isBuffer(e)){let t=_(e.length)|0,n=o(t);return n.length===0||e.copy(n,0,0,t),n}if(e.length!==void 0)return typeof e.length!=`number`||ve(e.length)?o(0):p(e);if(e.type===`Buffer`&&Array.isArray(e.data))return p(e.data)}function _(e){if(e>=i)throw RangeError(`Attempt to allocate Buffer larger than maximum size: 0x`+i.toString(16)+` bytes`);return e|0}function v(e){return+e!=e&&(e=0),s.alloc(+e)}s.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==s.prototype},s.compare=function(e,t){if(B(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),B(t,Uint8Array)&&(t=s.from(t,t.offset,t.byteLength)),!s.isBuffer(e)||!s.isBuffer(t))throw TypeError(`The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array`);if(e===t)return 0;let n=e.length,r=t.length;for(let i=0,a=Math.min(n,r);i<a;++i)if(e[i]!==t[i]){n=e[i],r=t[i];break}return n<r?-1:+(r<n)},s.isEncoding=function(e){switch(String(e).toLowerCase()){case`hex`:case`utf8`:case`utf-8`:case`ascii`:case`latin1`:case`binary`:case`base64`:case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return!0;default:return!1}},s.concat=function(e,t){if(!Array.isArray(e))throw TypeError(`"list" argument must be an Array of Buffers`);if(e.length===0)return s.alloc(0);let n;if(t===void 0)for(t=0,n=0;n<e.length;++n)t+=e[n].length;let r=s.allocUnsafe(t),i=0;for(n=0;n<e.length;++n){let t=e[n];if(B(t,Uint8Array))i+t.length>r.length?(s.isBuffer(t)||(t=s.from(t)),t.copy(r,i)):Uint8Array.prototype.set.call(r,t,i);else if(s.isBuffer(t))t.copy(r,i);else throw TypeError(`"list" argument must be an Array of Buffers`);i+=t.length}return r};function y(e,t){if(s.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||B(e,ArrayBuffer))return e.byteLength;if(typeof e!=`string`)throw TypeError(`The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type `+typeof e);let n=e.length,r=arguments.length>2&&arguments[2]===!0;if(!r&&n===0)return 0;let i=!1;for(;;)switch(t){case`ascii`:case`latin1`:case`binary`:return n;case`utf8`:case`utf-8`:return pe(e).length;case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return n*2;case`hex`:return n>>>1;case`base64`:return ge(e).length;default:if(i)return r?-1:pe(e).length;t=(``+t).toLowerCase(),i=!0}}s.byteLength=y;function b(e,t,n){let r=!1;if((t===void 0||t<0)&&(t=0),t>this.length||((n===void 0||n>this.length)&&(n=this.length),n<=0)||(n>>>=0,t>>>=0,n<=t))return``;for(e||=`utf8`;;)switch(e){case`hex`:return P(this,t,n);case`utf8`:case`utf-8`:return k(this,t,n);case`ascii`:return M(this,t,n);case`latin1`:case`binary`:return N(this,t,n);case`base64`:return O(this,t,n);case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return te(this,t,n);default:if(r)throw TypeError(`Unknown encoding: `+e);e=(e+``).toLowerCase(),r=!0}}s.prototype._isBuffer=!0;function x(e,t,n){let r=e[t];e[t]=e[n],e[n]=r}s.prototype.swap16=function(){let e=this.length;if(e%2!=0)throw RangeError(`Buffer size must be a multiple of 16-bits`);for(let t=0;t<e;t+=2)x(this,t,t+1);return this},s.prototype.swap32=function(){let e=this.length;if(e%4!=0)throw RangeError(`Buffer size must be a multiple of 32-bits`);for(let t=0;t<e;t+=4)x(this,t,t+3),x(this,t+1,t+2);return this},s.prototype.swap64=function(){let e=this.length;if(e%8!=0)throw RangeError(`Buffer size must be a multiple of 64-bits`);for(let t=0;t<e;t+=8)x(this,t,t+7),x(this,t+1,t+6),x(this,t+2,t+5),x(this,t+3,t+4);return this},s.prototype.toString=function(){let e=this.length;return e===0?``:arguments.length===0?k(this,0,e):b.apply(this,arguments)},s.prototype.toLocaleString=s.prototype.toString,s.prototype.equals=function(e){if(!s.isBuffer(e))throw TypeError(`Argument must be a Buffer`);return this===e?!0:s.compare(this,e)===0},s.prototype.inspect=function(){let t=``,n=e.INSPECT_MAX_BYTES;return t=this.toString(`hex`,0,n).replace(/(.{2})/g,`$1 `).trim(),this.length>n&&(t+=` ... `),`<Buffer `+t+`>`},r&&(s.prototype[r]=s.prototype.inspect),s.prototype.compare=function(e,t,n,r,i){if(B(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),!s.isBuffer(e))throw TypeError(`The "target" argument must be one of type Buffer or Uint8Array. Received type `+typeof e);if(t===void 0&&(t=0),n===void 0&&(n=e?e.length:0),r===void 0&&(r=0),i===void 0&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw RangeError(`out of range index`);if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(t>>>=0,n>>>=0,r>>>=0,i>>>=0,this===e)return 0;let a=i-r,o=n-t,c=Math.min(a,o),l=this.slice(r,i),u=e.slice(t,n);for(let e=0;e<c;++e)if(l[e]!==u[e]){a=l[e],o=u[e];break}return a<o?-1:+(o<a)};function S(e,t,n,r,i){if(e.length===0)return-1;if(typeof n==`string`?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,ve(n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0)if(i)n=0;else return-1;if(typeof t==`string`&&(t=s.from(t,r)),s.isBuffer(t))return t.length===0?-1:C(e,t,n,r,i);if(typeof t==`number`)return t&=255,typeof Uint8Array.prototype.indexOf==`function`?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):C(e,[t],n,r,i);throw TypeError(`val must be string, number or Buffer`)}function C(e,t,n,r,i){let a=1,o=e.length,s=t.length;if(r!==void 0&&(r=String(r).toLowerCase(),r===`ucs2`||r===`ucs-2`||r===`utf16le`||r===`utf-16le`)){if(e.length<2||t.length<2)return-1;a=2,o/=2,s/=2,n/=2}function c(e,t){return a===1?e[t]:e.readUInt16BE(t*a)}let l;if(i){let r=-1;for(l=n;l<o;l++)if(c(e,l)===c(t,r===-1?0:l-r)){if(r===-1&&(r=l),l-r+1===s)return r*a}else r!==-1&&(l-=l-r),r=-1}else for(n+s>o&&(n=o-s),l=n;l>=0;l--){let n=!0;for(let r=0;r<s;r++)if(c(e,l+r)!==c(t,r)){n=!1;break}if(n)return l}return-1}s.prototype.includes=function(e,t,n){return this.indexOf(e,t,n)!==-1},s.prototype.indexOf=function(e,t,n){return S(this,e,t,n,!0)},s.prototype.lastIndexOf=function(e,t,n){return S(this,e,t,n,!1)};function w(e,t,n,r){n=Number(n)||0;let i=e.length-n;r?(r=Number(r),r>i&&(r=i)):r=i;let a=t.length;r>a/2&&(r=a/2);let o;for(o=0;o<r;++o){let r=parseInt(t.substr(o*2,2),16);if(ve(r))return o;e[n+o]=r}return o}function T(e,t,n,r){return _e(pe(t,e.length-n),e,n,r)}function ee(e,t,n,r){return _e(me(t),e,n,r)}function E(e,t,n,r){return _e(ge(t),e,n,r)}function D(e,t,n,r){return _e(he(t,e.length-n),e,n,r)}s.prototype.write=function(e,t,n,r){if(t===void 0)r=`utf8`,n=this.length,t=0;else if(n===void 0&&typeof t==`string`)r=t,n=this.length,t=0;else if(isFinite(t))t>>>=0,isFinite(n)?(n>>>=0,r===void 0&&(r=`utf8`)):(r=n,n=void 0);else throw Error(`Buffer.write(string, encoding, offset[, length]) is no longer supported`);let i=this.length-t;if((n===void 0||n>i)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw RangeError(`Attempt to write outside buffer bounds`);r||=`utf8`;let a=!1;for(;;)switch(r){case`hex`:return w(this,e,t,n);case`utf8`:case`utf-8`:return T(this,e,t,n);case`ascii`:case`latin1`:case`binary`:return ee(this,e,t,n);case`base64`:return E(this,e,t,n);case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return D(this,e,t,n);default:if(a)throw TypeError(`Unknown encoding: `+r);r=(``+r).toLowerCase(),a=!0}},s.prototype.toJSON=function(){return{type:`Buffer`,data:Array.prototype.slice.call(this._arr||this,0)}};function O(e,n,r){return n===0&&r===e.length?t.fromByteArray(e):t.fromByteArray(e.slice(n,r))}function k(e,t,n){n=Math.min(e.length,n);let r=[],i=t;for(;i<n;){let t=e[i],a=null,o=t>239?4:t>223?3:t>191?2:1;if(i+o<=n){let n,r,s,c;switch(o){case 1:t<128&&(a=t);break;case 2:n=e[i+1],(n&192)==128&&(c=(t&31)<<6|n&63,c>127&&(a=c));break;case 3:n=e[i+1],r=e[i+2],(n&192)==128&&(r&192)==128&&(c=(t&15)<<12|(n&63)<<6|r&63,c>2047&&(c<55296||c>57343)&&(a=c));break;case 4:n=e[i+1],r=e[i+2],s=e[i+3],(n&192)==128&&(r&192)==128&&(s&192)==128&&(c=(t&15)<<18|(n&63)<<12|(r&63)<<6|s&63,c>65535&&c<1114112&&(a=c))}}a===null?(a=65533,o=1):a>65535&&(a-=65536,r.push(a>>>10&1023|55296),a=56320|a&1023),r.push(a),i+=o}return j(r)}var A=4096;function j(e){let t=e.length;if(t<=A)return String.fromCharCode.apply(String,e);let n=``,r=0;for(;r<t;)n+=String.fromCharCode.apply(String,e.slice(r,r+=A));return n}function M(e,t,n){let r=``;n=Math.min(e.length,n);for(let i=t;i<n;++i)r+=String.fromCharCode(e[i]&127);return r}function N(e,t,n){let r=``;n=Math.min(e.length,n);for(let i=t;i<n;++i)r+=String.fromCharCode(e[i]);return r}function P(e,t,n){let r=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>r)&&(n=r);let i=``;for(let r=t;r<n;++r)i+=V[e[r]];return i}function te(e,t,n){let r=e.slice(t,n),i=``;for(let e=0;e<r.length-1;e+=2)i+=String.fromCharCode(r[e]+r[e+1]*256);return i}s.prototype.slice=function(e,t){let n=this.length;e=~~e,t=t===void 0?n:~~t,e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),t<0?(t+=n,t<0&&(t=0)):t>n&&(t=n),t<e&&(t=e);let r=this.subarray(e,t);return Object.setPrototypeOf(r,s.prototype),r};function F(e,t,n){if(e%1!=0||e<0)throw RangeError(`offset is not uint`);if(e+t>n)throw RangeError(`Trying to access beyond buffer length`)}s.prototype.readUintLE=s.prototype.readUIntLE=function(e,t,n){e>>>=0,t>>>=0,n||F(e,t,this.length);let r=this[e],i=1,a=0;for(;++a<t&&(i*=256);)r+=this[e+a]*i;return r},s.prototype.readUintBE=s.prototype.readUIntBE=function(e,t,n){e>>>=0,t>>>=0,n||F(e,t,this.length);let r=this[e+--t],i=1;for(;t>0&&(i*=256);)r+=this[e+--t]*i;return r},s.prototype.readUint8=s.prototype.readUInt8=function(e,t){return e>>>=0,t||F(e,1,this.length),this[e]},s.prototype.readUint16LE=s.prototype.readUInt16LE=function(e,t){return e>>>=0,t||F(e,2,this.length),this[e]|this[e+1]<<8},s.prototype.readUint16BE=s.prototype.readUInt16BE=function(e,t){return e>>>=0,t||F(e,2,this.length),this[e]<<8|this[e+1]},s.prototype.readUint32LE=s.prototype.readUInt32LE=function(e,t){return e>>>=0,t||F(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216},s.prototype.readUint32BE=s.prototype.readUInt32BE=function(e,t){return e>>>=0,t||F(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])},s.prototype.readBigUInt64LE=ye(function(e){e>>>=0,le(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&ue(e,this.length-8);let r=t+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24,i=this[++e]+this[++e]*2**8+this[++e]*2**16+n*2**24;return BigInt(r)+(BigInt(i)<<BigInt(32))}),s.prototype.readBigUInt64BE=ye(function(e){e>>>=0,le(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&ue(e,this.length-8);let r=t*2**24+this[++e]*2**16+this[++e]*2**8+this[++e],i=this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+n;return(BigInt(r)<<BigInt(32))+BigInt(i)}),s.prototype.readIntLE=function(e,t,n){e>>>=0,t>>>=0,n||F(e,t,this.length);let r=this[e],i=1,a=0;for(;++a<t&&(i*=256);)r+=this[e+a]*i;return i*=128,r>=i&&(r-=2**(8*t)),r},s.prototype.readIntBE=function(e,t,n){e>>>=0,t>>>=0,n||F(e,t,this.length);let r=t,i=1,a=this[e+--r];for(;r>0&&(i*=256);)a+=this[e+--r]*i;return i*=128,a>=i&&(a-=2**(8*t)),a},s.prototype.readInt8=function(e,t){return e>>>=0,t||F(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]},s.prototype.readInt16LE=function(e,t){e>>>=0,t||F(e,2,this.length);let n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n},s.prototype.readInt16BE=function(e,t){e>>>=0,t||F(e,2,this.length);let n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n},s.prototype.readInt32LE=function(e,t){return e>>>=0,t||F(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},s.prototype.readInt32BE=function(e,t){return e>>>=0,t||F(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},s.prototype.readBigInt64LE=ye(function(e){e>>>=0,le(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&ue(e,this.length-8);let r=this[e+4]+this[e+5]*2**8+this[e+6]*2**16+(n<<24);return(BigInt(r)<<BigInt(32))+BigInt(t+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24)}),s.prototype.readBigInt64BE=ye(function(e){e>>>=0,le(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&ue(e,this.length-8);let r=(t<<24)+this[++e]*2**16+this[++e]*2**8+this[++e];return(BigInt(r)<<BigInt(32))+BigInt(this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+n)}),s.prototype.readFloatLE=function(e,t){return e>>>=0,t||F(e,4,this.length),n.read(this,e,!0,23,4)},s.prototype.readFloatBE=function(e,t){return e>>>=0,t||F(e,4,this.length),n.read(this,e,!1,23,4)},s.prototype.readDoubleLE=function(e,t){return e>>>=0,t||F(e,8,this.length),n.read(this,e,!0,52,8)},s.prototype.readDoubleBE=function(e,t){return e>>>=0,t||F(e,8,this.length),n.read(this,e,!1,52,8)};function I(e,t,n,r,i,a){if(!s.isBuffer(e))throw TypeError(`"buffer" argument must be a Buffer instance`);if(t>i||t<a)throw RangeError(`"value" argument is out of bounds`);if(n+r>e.length)throw RangeError(`Index out of range`)}s.prototype.writeUintLE=s.prototype.writeUIntLE=function(e,t,n,r){if(e=+e,t>>>=0,n>>>=0,!r){let r=2**(8*n)-1;I(this,e,t,n,r,0)}let i=1,a=0;for(this[t]=e&255;++a<n&&(i*=256);)this[t+a]=e/i&255;return t+n},s.prototype.writeUintBE=s.prototype.writeUIntBE=function(e,t,n,r){if(e=+e,t>>>=0,n>>>=0,!r){let r=2**(8*n)-1;I(this,e,t,n,r,0)}let i=n-1,a=1;for(this[t+i]=e&255;--i>=0&&(a*=256);)this[t+i]=e/a&255;return t+n},s.prototype.writeUint8=s.prototype.writeUInt8=function(e,t,n){return e=+e,t>>>=0,n||I(this,e,t,1,255,0),this[t]=e&255,t+1},s.prototype.writeUint16LE=s.prototype.writeUInt16LE=function(e,t,n){return e=+e,t>>>=0,n||I(this,e,t,2,65535,0),this[t]=e&255,this[t+1]=e>>>8,t+2},s.prototype.writeUint16BE=s.prototype.writeUInt16BE=function(e,t,n){return e=+e,t>>>=0,n||I(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=e&255,t+2},s.prototype.writeUint32LE=s.prototype.writeUInt32LE=function(e,t,n){return e=+e,t>>>=0,n||I(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=e&255,t+4},s.prototype.writeUint32BE=s.prototype.writeUInt32BE=function(e,t,n){return e=+e,t>>>=0,n||I(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4};function ne(e,t,n,r,i){ce(t,r,i,e,n,7);let a=Number(t&BigInt(4294967295));e[n++]=a,a>>=8,e[n++]=a,a>>=8,e[n++]=a,a>>=8,e[n++]=a;let o=Number(t>>BigInt(32)&BigInt(4294967295));return e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o,n}function re(e,t,n,r,i){ce(t,r,i,e,n,7);let a=Number(t&BigInt(4294967295));e[n+7]=a,a>>=8,e[n+6]=a,a>>=8,e[n+5]=a,a>>=8,e[n+4]=a;let o=Number(t>>BigInt(32)&BigInt(4294967295));return e[n+3]=o,o>>=8,e[n+2]=o,o>>=8,e[n+1]=o,o>>=8,e[n]=o,n+8}s.prototype.writeBigUInt64LE=ye(function(e,t=0){return ne(this,e,t,BigInt(0),BigInt(`0xffffffffffffffff`))}),s.prototype.writeBigUInt64BE=ye(function(e,t=0){return re(this,e,t,BigInt(0),BigInt(`0xffffffffffffffff`))}),s.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t>>>=0,!r){let r=2**(8*n-1);I(this,e,t,n,r-1,-r)}let i=0,a=1,o=0;for(this[t]=e&255;++i<n&&(a*=256);)e<0&&o===0&&this[t+i-1]!==0&&(o=1),this[t+i]=(e/a>>0)-o&255;return t+n},s.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t>>>=0,!r){let r=2**(8*n-1);I(this,e,t,n,r-1,-r)}let i=n-1,a=1,o=0;for(this[t+i]=e&255;--i>=0&&(a*=256);)e<0&&o===0&&this[t+i+1]!==0&&(o=1),this[t+i]=(e/a>>0)-o&255;return t+n},s.prototype.writeInt8=function(e,t,n){return e=+e,t>>>=0,n||I(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=e&255,t+1},s.prototype.writeInt16LE=function(e,t,n){return e=+e,t>>>=0,n||I(this,e,t,2,32767,-32768),this[t]=e&255,this[t+1]=e>>>8,t+2},s.prototype.writeInt16BE=function(e,t,n){return e=+e,t>>>=0,n||I(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=e&255,t+2},s.prototype.writeInt32LE=function(e,t,n){return e=+e,t>>>=0,n||I(this,e,t,4,2147483647,-2147483648),this[t]=e&255,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},s.prototype.writeInt32BE=function(e,t,n){return e=+e,t>>>=0,n||I(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4},s.prototype.writeBigInt64LE=ye(function(e,t=0){return ne(this,e,t,-BigInt(`0x8000000000000000`),BigInt(`0x7fffffffffffffff`))}),s.prototype.writeBigInt64BE=ye(function(e,t=0){return re(this,e,t,-BigInt(`0x8000000000000000`),BigInt(`0x7fffffffffffffff`))});function ie(e,t,n,r,i,a){if(n+r>e.length||n<0)throw RangeError(`Index out of range`)}function ae(e,t,r,i,a){return t=+t,r>>>=0,a||ie(e,t,r,4,34028234663852886e22,-34028234663852886e22),n.write(e,t,r,i,23,4),r+4}s.prototype.writeFloatLE=function(e,t,n){return ae(this,e,t,!0,n)},s.prototype.writeFloatBE=function(e,t,n){return ae(this,e,t,!1,n)};function oe(e,t,r,i,a){return t=+t,r>>>=0,a||ie(e,t,r,8,17976931348623157e292,-17976931348623157e292),n.write(e,t,r,i,52,8),r+8}s.prototype.writeDoubleLE=function(e,t,n){return oe(this,e,t,!0,n)},s.prototype.writeDoubleBE=function(e,t,n){return oe(this,e,t,!1,n)},s.prototype.copy=function(e,t,n,r){if(!s.isBuffer(e))throw TypeError(`argument should be a Buffer`);if(n||=0,!r&&r!==0&&(r=this.length),t>=e.length&&(t=e.length),t||=0,r>0&&r<n&&(r=n),r===n||e.length===0||this.length===0)return 0;if(t<0)throw RangeError(`targetStart out of bounds`);if(n<0||n>=this.length)throw RangeError(`Index out of range`);if(r<0)throw RangeError(`sourceEnd out of bounds`);r>this.length&&(r=this.length),e.length-t<r-n&&(r=e.length-t+n);let i=r-n;return this===e&&typeof Uint8Array.prototype.copyWithin==`function`?this.copyWithin(t,n,r):Uint8Array.prototype.set.call(e,this.subarray(n,r),t),i},s.prototype.fill=function(e,t,n,r){if(typeof e==`string`){if(typeof t==`string`?(r=t,t=0,n=this.length):typeof n==`string`&&(r=n,n=this.length),r!==void 0&&typeof r!=`string`)throw TypeError(`encoding must be a string`);if(typeof r==`string`&&!s.isEncoding(r))throw TypeError(`Unknown encoding: `+r);if(e.length===1){let t=e.charCodeAt(0);(r===`utf8`&&t<128||r===`latin1`)&&(e=t)}}else typeof e==`number`?e&=255:typeof e==`boolean`&&(e=Number(e));if(t<0||this.length<t||this.length<n)throw RangeError(`Out of range index`);if(n<=t)return this;t>>>=0,n=n===void 0?this.length:n>>>0,e||=0;let i;if(typeof e==`number`)for(i=t;i<n;++i)this[i]=e;else{let a=s.isBuffer(e)?e:s.from(e,r),o=a.length;if(o===0)throw TypeError(`The value "`+e+`" is invalid for argument "value"`);for(i=0;i<n-t;++i)this[i+t]=a[i%o]}return this};var se={};function L(e,t,n){se[e]=class extends n{constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name}get code(){return e}set code(e){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:e,writable:!0})}toString(){return`${this.name} [${e}]: ${this.message}`}}}L(`ERR_BUFFER_OUT_OF_BOUNDS`,function(e){return e?`${e} is outside of buffer bounds`:`Attempt to access memory outside buffer bounds`},RangeError),L(`ERR_INVALID_ARG_TYPE`,function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`},TypeError),L(`ERR_OUT_OF_RANGE`,function(e,t,n){let r=`The value of "${e}" is out of range.`,i=n;return Number.isInteger(n)&&Math.abs(n)>2**32?i=R(String(n)):typeof n==`bigint`&&(i=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(i=R(i)),i+=`n`),r+=` It must be ${t}. Received ${i}`,r},RangeError);function R(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 z(e,t,n){le(t,`offset`),(e[t]===void 0||e[t+n]===void 0)&&ue(t,e.length-(n+1))}function ce(e,t,n,r,i,a){if(e>n||e<t){let r=typeof t==`bigint`?`n`:``,i;throw i=a>3?t===0||t===BigInt(0)?`>= 0${r} and < 2${r} ** ${(a+1)*8}${r}`:`>= -(2${r} ** ${(a+1)*8-1}${r}) and < 2 ** ${(a+1)*8-1}${r}`:`>= ${t}${r} and <= ${n}${r}`,new se.ERR_OUT_OF_RANGE(`value`,i,e)}z(r,i,a)}function le(e,t){if(typeof e!=`number`)throw new se.ERR_INVALID_ARG_TYPE(t,`number`,e)}function ue(e,t,n){throw Math.floor(e)===e?t<0?new se.ERR_BUFFER_OUT_OF_BOUNDS:new se.ERR_OUT_OF_RANGE(n||`offset`,`>= ${+!!n} and <= ${t}`,e):(le(e,n),new se.ERR_OUT_OF_RANGE(n||`offset`,`an integer`,e))}var de=/[^+/0-9A-Za-z-_]/g;function fe(e){if(e=e.split(`=`)[0],e=e.trim().replace(de,``),e.length<2)return``;for(;e.length%4!=0;)e+=`=`;return e}function pe(e,t){t||=1/0;let n,r=e.length,i=null,a=[];for(let o=0;o<r;++o){if(n=e.charCodeAt(o),n>55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&a.push(239,191,189);continue}else if(o+1===r){(t-=3)>-1&&a.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&a.push(239,191,189),i=n;continue}n=(i-55296<<10|n-56320)+65536}else i&&(t-=3)>-1&&a.push(239,191,189);if(i=null,n<128){if(--t<0)break;a.push(n)}else if(n<2048){if((t-=2)<0)break;a.push(n>>6|192,n&63|128)}else if(n<65536){if((t-=3)<0)break;a.push(n>>12|224,n>>6&63|128,n&63|128)}else if(n<1114112){if((t-=4)<0)break;a.push(n>>18|240,n>>12&63|128,n>>6&63|128,n&63|128)}else throw Error(`Invalid code point`)}return a}function me(e){let t=[];for(let n=0;n<e.length;++n)t.push(e.charCodeAt(n)&255);return t}function he(e,t){let n,r,i,a=[];for(let o=0;o<e.length&&!((t-=2)<0);++o)n=e.charCodeAt(o),r=n>>8,i=n%256,a.push(i),a.push(r);return a}function ge(e){return t.toByteArray(fe(e))}function _e(e,t,n,r){let i;for(i=0;i<r&&!(i+n>=t.length||i>=e.length);++i)t[i+n]=e[i];return i}function B(e,t){return e instanceof t||e!=null&&e.constructor!=null&&e.constructor.name!=null&&e.constructor.name===t.name}function ve(e){return e!==e}var V=(function(){let e=`0123456789abcdef`,t=Array(256);for(let n=0;n<16;++n){let r=n*16;for(let i=0;i<16;++i)t[r+i]=e[n]+e[i]}return t})();function ye(e){return typeof BigInt>`u`?be:e}function be(){throw Error(`BigInt not supported`)}})),sr=or(),X=!0;function cr(e){X=e}var lr;(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`})(lr||={});function ur(e){return(e&61440)>>12}function dr(e){return e<<12}var fr=class{ino;type;path;name},pr=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&Tn.Sync||this.fs.attributes.has(`sync`))}[Symbol.dispose](){this.closeSync()}syncSync(){if(this.closed)throw M(`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 M(`EBADF`,`close`,this.path);this.syncSync(),this.disposeSync()}disposeSync(e){if(this.closed)throw M(`EBADF`,`close`,this.path);if(this.dirty&&!e)throw M(`EBUSY`,`close`,this.path);this.closed=!0}truncateSync(e){if(e<0)throw M(`EINVAL`,`truncate`,this.path);if(this.closed||!(this.flag&1||this.flag&2))throw M(`EBADF`,`truncate`,this.path);if(this.fs.attributes.has(`readonly`))throw M(`EROFS`,`truncate`,this.path);if(this.inode.flags&Tn.Immutable)throw M(`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 M(`EBADF`,`write`,this.path);if(this.fs.attributes.has(`readonly`))throw M(`EROFS`,`write`,this.path);if(this.inode.flags&Tn.Immutable)throw M(`EPERM`,`write`,this.path);this.dirty=!0;let i=r+n,a=e.subarray(t,t+n);return!Nn(this.inode)&&!Mn(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 M(`EBADF`,`read`,this.path);!(this.inode.flags&Tn.NoAtime)&&!this.fs.attributes.has(`no_atime`)&&(this.dirty=!0,this.inode.atimeMs=Date.now());let i=r+n;!Nn(this.inode)&&!Mn(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 M(`EBADF`,`chmod`,this.path);this.dirty=!0,this.inode.mode=this.inode.mode&(e>61440?~Ge:Ge)|e,(this._isSync||e>61440)&&this.syncSync()}chownSync(e,t){if(this.closed)throw M(`EBADF`,`chmod`,this.path);this.dirty=!0,Fn(this.inode,e,t),this._isSync&&this.syncSync()}utimesSync(e,t){if(this.closed)throw M(`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 M(`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 M(`EBADF`,`close`,this.path);await this.sync(),this.dispose()}dispose(e){if(this.closed)throw M(`EBADF`,`close`,this.path);if(this.dirty&&!e)throw M(`EBUSY`,`close`,this.path);this.closed=!0}stat(){if(this.closed)throw M(`EBADF`,`stat`,this.path);return this.inode}async truncate(e){if(e<0)throw M(`EINVAL`,`truncate`,this.path);if(this.closed||!(this.flag&1||this.flag&2))throw M(`EBADF`,`truncate`,this.path);if(this.fs.attributes.has(`readonly`))throw M(`EROFS`,`truncate`,this.path);if(this.inode.flags&Tn.Immutable)throw M(`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 M(`EBADF`,`write`,this.path);if(this.fs.attributes.has(`readonly`))throw M(`EROFS`,`write`,this.path);if(this.inode.flags&Tn.Immutable)throw M(`EPERM`,`write`,this.path);this.dirty=!0;let i=r+n,a=e.subarray(t,t+n);return!Nn(this.inode)&&!Mn(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 M(`EBADF`,`read`,this.path);!(this.inode.flags&Tn.NoAtime)&&!this.fs.attributes.has(`no_atime`)&&(this.dirty=!0,this.inode.atimeMs=Date.now());let i=r+n;!Nn(this.inode)&&!Mn(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 M(`EBADF`,`chmod`,this.path);this.dirty=!0,this.inode.mode=this.inode.mode&(e>61440?~Ge:Ge)|e,(this._isSync||e>61440)&&await this.sync()}async chown(e,t){if(this.closed)throw M(`EBADF`,`chown`,this.path);this.dirty=!0,Fn(this.inode,e,t),this._isSync&&await this.sync()}async utimes(e,t){if(this.closed)throw M(`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 M(`EBADF`,`streamRead`,this.path);return this.fs.streamRead(this.internalPath,e)}streamWrite(e){if(this.closed)throw M(`EBADF`,`write`,this.path);if(this.inode.flags&Tn.Immutable)throw M(`EPERM`,`write`,this.path);if(this.fs.attributes.has(`readonly`))throw M(`EROFS`,`write`,this.path);return this.fs.streamWrite(this.internalPath,e)}};function mr(e){let t=Me(e.context).descriptors,n=Math.max(t.size?Math.max(...t.keys())+1:0,4);return t.set(n,e),n}function hr(e,t){let n=Me(e).descriptors.get(t);if(!n)throw N(`EBADF`);return n}function gr(e,t){return Me(e).descriptors.delete(t)}var _r=/[rwasx]{1,2}\+?/;function vr(e){if(typeof e==`number`)return e;if(!_r.test(e))throw N(`EINVAL`,`Invalid flag string: `+e);return yr(e)}function yr(e){if(!e.includes(`r`)&&!e.includes(`w`)&&!e.includes(`a`))throw N(`EINVAL`,`Invalid flag string: `+e);let t=e.includes(`r`)?0:64;return e.includes(`w`)&&(t|=512),e.includes(`a`)&&(t|=Ie),e.includes(`+`)?t|=2:e.includes(`r`)||(t|=1),e.includes(`s`)&&(t|=Be),e.includes(`x`)&&(t|=128),t}function br(e){let t=0;return e&1||(t|=4),(e&1||e&2)&&(t|=2),t}var xr=j;function Sr(e,t){return e.path=t,e}function Cr(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 A(Object.assign(e,i))}}}function wr(e,t){return new Proxy(e,{get(e,n){let r=Reflect.get(e,n);return typeof r==`function`?function n(...i){try{let a=r.apply(e,i);return a instanceof Promise?a.catch(e=>{if(`code`in e)throw A(Object.assign(e,t));if(e in O){let r=M(e,t);Error.captureStackTrace(r,n)}throw e}):a}catch(e){throw A(Object.assign(e,t))}}:r}})}var Tr=new Map;Er(`/`,Yn.create({label:`root`}));function Er(e,t){if(e[0]!=`/`&&(e=`/`+e),e=rn.call(this,e),Tr.has(e))throw R(N(`EINVAL`,`Mount point is already in use: `+e));t._mountPoint=e,Tr.set(e,t),le(`Mounted ${t.name} on ${e}`),ue(`${t.name} attributes: ${[...t.attributes].map(([e,t])=>t==null?e:e+`=`+t).join(`, `)}`)}function Dr(e){if(e[0]!=`/`&&(e=`/`+e),e=rn.call(this,e),!Tr.has(e)){z(e+` is already unmounted`);return}Tr.delete(e),ce(`Unmounted `+e)}function Or(e,t,n){let{root:r}=Me(t),i={path:e,...n};e=W(G(r,e),!0),e=rn.call(t,e);let a=[...Tr].sort((e,t)=>e[0].length>t[0].length?-1:1);for(let[t,n]of a){if(!jr(t,e))continue;e=e.slice(t.length>1?t.length:0),e===``&&(e=`/`);let a=n.attributes.get(`case_fold`);return a===`lower`&&(e=e.toLowerCase()),a===`upper`&&(e=e.toUpperCase()),{fs:wr(n,i),path:e,mountPoint:t,root:r}}throw se(new j(O.EIO,`No file system for `+e))}function kr(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 Ar(e){let t=Me(this);if(!ke(t.credentials))throw N(`EPERM`,`Can not chroot() as non-root user`);t.root??=`/`;let n=G(t.root,e);for(let e of t.descriptors?.values()??[]){if(!e.path.startsWith(t.root))throw M(`EBUSY`,`chroot`,e.path);e.path=e.path.slice(t.root.length)}if(n.length>t.root.length)throw N(`EPERM`,`Can not chroot() outside of current root`);t.root=n}function jr(e,t){return e===`/`||e===t?!0:(e.endsWith(`/`)||(e+=`/`),t.startsWith(e))}var Mr=e({link:()=>zr,mkdir:()=>Ir,open:()=>Pr,readdir:()=>Lr,readlink:()=>Fr,rename:()=>Rr,resolve:()=>Nr,stat:()=>Br});function Nr(e,t,n,r){t=rn.call(e,t);try{let i=Or(t,e),a=i.fs.statSync(i.path);return!An(a)||n?{...i,fullPath:t,stats:a}:Nr(e,rn.call(e,K(t),Fr.call(e,t)),n,r)}catch(e){if(A(Object.assign(e,{syscall:`stat`,path:t,...r})),n)throw e}let{base:i,dir:a}=dn(t),o=a==`/`?`/`:Nr(e,a,!1,r).fullPath,s=G(o,i),c=Or(s,e),l;try{l=c.fs.statSync(c.path)}catch(e){if(e.code===`ENOENT`)return{...c,fullPath:t};throw A(Object.assign(e,{syscall:`stat`,path:s,...r}))}return An(l)?Nr(e,rn.call(e,o,Fr.call(e,s)),!1,r):{...c,fullPath:s,stats:l}}function Pr(e,t){e=W(e);let n=qt(t.mode,420),r=vr(t.flag);e=t.preserveSymlinks?e:Nr(this,e).fullPath;let{fs:i,path:a}=Or(e,this),o;try{o=i.statSync(a)}catch{}if(!o){if(!(r&64))throw M(`ENOENT`,`open`,e);let o=i.statSync(K(a));if(X&&!Y(this,o,2))throw M(`EACCES`,`open`,e);if(!kn(o))throw M(`ENOTDIR`,`open`,e);if(!t.allowDirectory&&n&16384)throw M(`EISDIR`,`open`,e);if(X&&!Y(this,o,2))throw M(`EACCES`,`open`,e);let{euid:s,egid:c}=Me(this).credentials,l=i.createFileSync(a,{mode:n,uid:o.mode&2048?o.uid:s,gid:o.mode&1024?o.gid:c});return new pr(this,e,i,a,r,l)}if(X&&(!Y(this,o,n)||!Y(this,o,br(r))))throw M(`EACCES`,`open`,e);if(r&128)throw M(`EEXIST`,`open`,e);let s=new pr(this,e,i,a,r,o);if(!t.allowDirectory&&o.mode&16384)throw M(`EISDIR`,`open`,e);return r&512&&s.truncateSync(0),s}function Fr(e){e=W(e);let{fs:t,stats:n,path:r}=Nr(this,e,!0);if(!n)throw M(`ENOENT`,`readlink`,e);if(X&&!Y(this,n,4))throw M(`EACCES`,`readlink`,e);if(!An(n))throw M(`EINVAL`,`readlink`,e);let i=n.size,a=new Uint8Array(i);return t.readSync(r,a,0,i),w(a)}function Ir(e,t={}){e=W(e);let{fs:n,path:r}=Nr(this,e),{euid:i,egid:a}=Me(this).credentials,{mode:o=511,recursive:s}=t,c=(e,t,r)=>{if(X&&!Y(this,r,2))throw M(`EACCES`,`mkdir`,K(e));let s=n.mkdirSync(t,{mode:o,uid:r.mode&2048?r.uid:i,gid:r.mode&1024?r.gid:a});return Hi(this,`rename`,e),s};if(!s){c(e,r,n.statSync(K(r)));return}let l=[];for(let t=r,i=e;!n.existsSync(t);t=K(t),i=K(i))l.unshift({resolved:t,original:i});if(!l.length)return;let u=[n.statSync(K(l[0].resolved))];for(let[e,t]of l.entries())u.push(c(t.original,t.resolved,u[e]));return l[0].original}function Lr(e,t={}){e=W(e);let{fs:n,path:r}=Nr(this,e),i=n.statSync(r);if(X&&!Y(this,i,4))throw M(`EACCES`,`readdir`,e);if(!kn(i))throw M(`ENOTDIR`,`readdir`,e);let a=n.readdirSync(r),o=[],s=e=>{let i;try{i=n.statSync(G(r,e))}catch(e){if(e.code==`ENOENT`)return;throw e}let a=new fr;if(a.ino=i.ino,a.type=ur(i.mode),a.path=e,a.name=cn(e),o.push(a),!kn(i)||!t?.recursive)return;let c=n.readdirSync(G(r,e));for(let t of c)s(G(e,t))};for(let e of a)s(e);return o}function Rr(e,t){e=W(e),t=W(t);let n={syscall:`rename`,path:e,dest:t},r=Nr(this,e,!0,n),i=Or(t,this,n);if(r.fs.uuid!==i.fs.uuid)throw M(`EXDEV`,n);if(i.path.startsWith(r.path+`/`))throw M(`EBUSY`,n);if(!r.stats)throw M(`ENOENT`,n);let a=r.fs,o=a.statSync(K(r.path)),s=a.statSync(K(i.path)),c;try{c=a.statSync(i.path)}catch(e){if(e.code!=`ENOENT`)throw e}if(X&&(!Y(this,o,4)||!Y(this,s,2)))throw M(`EACCES`,n);if(c&&!kn(r.stats)&&kn(c))throw M(`EISDIR`,n);if(c&&kn(r.stats)&&!kn(c))throw M(`ENOTDIR`,n);r.fs.renameSync(r.path,i.path),Hi(this,`rename`,e),Hi(this,`change`,t)}function zr(e,t){e=W(e),t=W(t);let n={syscall:`link`,path:t,dest:e},{fs:r,path:i}=Or(e,this,n),a=Or(t,this,n);if(r.uuid!==a.fs.uuid)throw M(`EXDEV`,n);let o=r.statSync(i);if(X){if(!Y(this,o,4))throw M(`EACCES`,n);let e=r.statSync(K(i));if(!Y(this,e,4))throw M(`EACCES`,n);let t=r.statSync(K(a.path));if(!Y(this,t,2))throw M(`EACCES`,n)}return r.linkSync(i,a.path)}function Br(e,t){e=W.call(this,e);let n={syscall:t?`lstat`:`stat`,path:e},r;if(!t)r=Nr(this,e,!1,n).stats;else{let{base:t,dir:i}=dn(e),{fs:a,path:o}=Nr(this,i,!1,n);try{r=a.statSync(t?G(o,t):o)}catch(e){throw A(Object.assign(e,n)),e}}if(!r)throw M(`ENOENT`,n);if(X&&!Y(this,r,4))throw M(`EACCES`,n);return r}var Vr=class e{ino;type;_name;get name(){let e=sr.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}=dn(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===lr.REG}isDirectory(){return this.type===lr.DIR}isBlockDevice(){return this.type===lr.BLK}isCharacterDevice(){return this.type===lr.CHR}isSymbolicLink(){return this.type===lr.LNK}isFIFO(){return this.type===lr.FIFO}isSocket(){return this.type===lr.SOCK}},Hr=class{path;context;closed=!1;checkClosed(){if(this.closed)throw N(`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 Ya.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??=mi.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()}},Ur=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},Wr=(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 Gr(e,t){return Rr.call(this,e,t)}function Kr(e){e=W(e);try{let{fs:t,path:n}=Nr(this,e);return t.existsSync(n)}catch(e){if(e.errno==O.ENOENT)return!1;throw e}}function qr(e,t){let n=Br.call(this,e,!1);return t?.bigint?new gn(n):new hn(n)}function Jr(e,t){let n=Br.call(this,e,!0);return t?.bigint?new gn(n):new hn(n)}function Yr(e,t=0){let n={stack:[],error:void 0,hasError:!1};try{let r=Ur(n,Pr.call(this,e,{flag:`r+`}),!1);if(t||=0,t<0)throw M(`EINVAL`,`truncate`,e.toString());r.truncateSync(t)}catch(e){n.error=e,n.hasError=!0}finally{Wr(n)}}function Xr(e){e=W(e);let{fs:t,path:n}=Or(e,this);try{if(X&&!Y(this,t.statSync(n),2))throw M(`EACCES`,`unlink`);t.unlinkSync(n)}catch(t){throw A(Object.assign(t,{path:e}))}Hi(this,`rename`,e.toString())}function Zr(e,t,n=0){return mr(Pr.call(this,e,{flag:t,mode:n}))}function Qr(e,t,n){return mr(Pr.call(this,e,{flag:t,mode:n,preserveSymlinks:!0}))}function $r(e,t={}){let n={stack:[],error:void 0,hasError:!1};try{let r=Yt(t,null,`r`,420);if(vr(r.flag)&1)throw M(`EBADF`,`read`,e.toString());let i=Ur(n,typeof e==`number`?hr(this,e):Pr.call(this,e.toString(),{flag:r.flag,mode:420,preserveSymlinks:!1}),!1),{size:a}=i.stat(),o=sr.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{Wr(n)}}function ei(e,t,n={}){let r={stack:[],error:void 0,hasError:!1};try{let i=Yt(n,`utf8`,`w+`,420),a=vr(i.flag);if(!(a&1||a&2))throw new j(O.EINVAL,`Flag passed to writeFile must allow for writing`);if(typeof t!=`string`&&!i.encoding)throw new j(O.EINVAL,`Encoding not specified`);let o=typeof t==`string`?sr.Buffer.from(t,i.encoding):new Uint8Array(t.buffer,t.byteOffset,t.byteLength);if(!o)throw new j(O.EINVAL,`Data not specified`);Ur(r,typeof e==`number`?hr(this,e):Pr.call(this,e.toString(),{flag:a,mode:i.mode,preserveSymlinks:!0}),!1).writeSync(o,0,o.byteLength,0),Hi(this,`change`,e.toString())}catch(e){r.error=e,r.hasError=!0}finally{Wr(r)}}function ti(e,t,n={}){let r=Yt(n,`utf8`,`a+`,420),i=vr(r.flag);if(!(i&1024))throw new j(O.EINVAL,`Flag passed to appendFile must allow for appending`);if(typeof t!=`string`&&!r.encoding)throw new j(O.EINVAL,`Encoding not specified`);let a=typeof t==`string`?sr.Buffer.from(t,r.encoding):new Uint8Array(t.buffer,t.byteOffset,t.byteLength),o=typeof e==`number`?hr(this,e):Pr.call(this,W(e),{flag:i,mode:r.mode,preserveSymlinks:!0});o.writeSync(a,0,a.byteLength),typeof o!=`number`&&o.closeSync()}function ni(e,t){let n=hr(this,e).stat();return t?.bigint?new gn(n):new hn(n)}function ri(e){hr(this,e).closeSync(),gr(this,e)}function ii(e,t=0){if(t||=0,t<0)throw new j(O.EINVAL);hr(this,e).truncateSync(t)}function ai(e){hr(this,e).syncSync()}function oi(e){hr(this,e).datasyncSync()}function si(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=sr.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=hr(this,e);c??=l.position;let u=l.writeSync(a,o,s,c);return Hi(this,`change`,l.path),u}function ci(e,t,n,r,i){let a=hr(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 M(`EINVAL`);return typeof i==`bigint`&&(i=Number(i)),i=Number.isSafeInteger(i)?i:a.position,a.readSync(t,o,r,i)}function li(e,t,n){hr(this,e).chownSync(t,n)}function ui(e,t){let n=qt(t,-1);if(n<0)throw new j(O.EINVAL,`Invalid mode.`);hr(this,e).chmodSync(n)}function di(e,t,n){hr(this,e).utimesSync(Jt(t),Jt(n))}function fi(e){e=W(e);let{fs:t,path:n}=Nr(this,e),r=Cr(t,`statSync`,e)(n);if(!kn(r))throw M(`ENOTDIR`,`rmdir`,e);if(X&&!Y(this,r,2))throw M(`EACCES`,`rmdir`,e);Cr(t,`rmdirSync`,e)(n),Hi(this,`rename`,e.toString())}function pi(e,t){t=typeof t==`object`?t:{mode:t};let n=qt(t?.mode,511);return Ir.call(this,e,{...t,mode:n})}function mi(e,t){t=typeof t==`object`?t:{encoding:t},e=W(e);let n=[],r=Lr.call(this,e,t??void 0);for(let e of r)t?.withFileTypes?n.push(Vr.from(e,t.encoding)):t?.encoding==`buffer`?n.push(sr.Buffer.from(e.path)):n.push(e.path);return n}function hi(e,t){return zr.call(this,e,t)}function gi(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=W(t);let i=Ur(r,Pr.call(this,t,{flag:`wx`,mode:420}),!1);i.writeSync(S(W(e,!0))),i.chmodSync(qe)}catch(e){r.error=e,r.hasError=!0}finally{Wr(r)}}function _i(e,t){let n=sr.Buffer.from(Fr.call(this,e)),r=typeof t==`object`?t?.encoding:t;return r==`buffer`?n:n.toString(r??`utf-8`)}function vi(e,t,n){let r={stack:[],error:void 0,hasError:!1};try{Ur(r,Pr.call(this,e,{flag:`r+`,mode:0}),!1).chownSync(t,n)}catch(e){r.error=e,r.hasError=!0}finally{Wr(r)}}function yi(e,t,n){let r=Qr.call(this,e,`r+`);li.call(this,r,t,n),ri.call(this,r)}function bi(e,t){let n=Zr.call(this,e,`r+`);ui.call(this,n,t),ri.call(this,n)}function xi(e,t){let n=Qr.call(this,e,`r+`);ui.call(this,n,t),ri.call(this,n)}function Si(e,t,n){let r=Zr.call(this,e,`r+`);di.call(this,r,t,n),ri.call(this,r)}function Ci(e,t,n){let r=Qr.call(this,e,`r+`);di.call(this,r,t,n),ri.call(this,r)}function wi(e,t){let n=typeof t==`string`?t:t?.encoding??`utf8`;e=W(e,!0);let{fullPath:r}=Nr(this,e);if(n==`utf8`||n==`utf-8`)return r;let i=sr.Buffer.from(r,`utf-8`);return n==`buffer`?i:i.toString(n)}function Ti(e,t=384){if(X&&!Y(this,qr.call(this,e),t))throw new j(O.EACCES)}function Ei(e,t){e=W(e);let n;try{n=Jr.bind(this)(e)}catch(e){if(e.code!=`ENOENT`||!t?.force)throw e}if(n)switch(n.mode&Ge){case Xe:if(t?.recursive)for(let n of mi.call(this,e))Ei.call(this,G(e,n),t);fi.call(this,e);break;case Je:case qe:case Ye:case Ze:Xr.call(this,e);break;case Qe:case Ke:default:throw M(`ENOSYS`,`rm`,e)}}function Di(e,t){let n=typeof t==`object`?t?.encoding:t||`utf8`,r=Qt(e);return pi.call(this,r),n==`buffer`?sr.Buffer.from(r):r}function Oi(e,t){let n=Qt(e);pi.call(this,n);let r=()=>Ei(n,{recursive:!0,force:!0});return{path:n,remove:r,[Symbol.dispose]:r}}function ki(e,t,n){if(e=W(e),t=W(t),n&&n&1&&Kr(t))throw M(`EEXIST`,`copyFile`,t);ei.call(this,t,$r(e)),Hi(this,`rename`,t.toString())}function Ai(e,t,n){let r=hr(this,e),i=0;for(let e of t)i+=r.readSync(e,0,e.byteLength,n+i);return i}function ji(e,t,n){let r=hr(this,e),i=0;for(let e of t)i+=r.writeSync(new Uint8Array(e.buffer),0,e.byteLength,n+i);return i}function Mi(e,t){return e=W(e),new Hr(e,this)}function Ni(e,t,n){e=W(e),t=W(t);let r=Jr.call(this,e);if(n?.errorOnExist&&Kr.call(this,t))throw M(`EEXIST`,`cp`,t);switch(r.mode&Ge){case Xe:if(!n?.recursive)throw M(`EISDIR`,`cp`,e);pi.call(this,t,{recursive:!0});for(let r of mi.call(this,e,{withFileTypes:!0}))n.filter&&!n.filter(G(e,r.name),G(t,r.name))||Ni.call(this,G(e,r.name),G(t,r.name),n);break;case Je:case qe:ki.call(this,e,t);break;case Ye:case Ze:case Qe:case Ke:default:throw M(`ENOSYS`,`cp`,e)}n?.preserveTimestamps&&Si.call(this,t,r.atime,r.mtime)}function Pi(e,t){e=W(e);let{fs:n}=Or(e,this);return kr(n,t?.bigint)}function Fi(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(Xt),l=[];function u(e){let t=mi(e,{withFileTypes:r,encoding:`utf8`});for(let n of t){let t=G(e,r?n.name:n);if(typeof i==`function`?i(r?n:t):i.some(e=>fn(e,t)))continue;let a=t.replace(/^\/+/g,``);qr(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 Ii=class extends c.default{_context;path;off(e,t,n,r){return super.off(e,t,n,r)}removeListener(e,t,n,r){return super.removeListener(e,t,n,r)}constructor(e,t){super(),this._context=e,this.path=t}setMaxListeners(){throw M(`ENOSYS`,`Watcher.setMaxListeners`)}getMaxListeners(){throw M(`ENOSYS`,`Watcher.getMaxListeners`)}prependListener(){throw M(`ENOSYS`,`Watcher.prependListener`)}prependOnceListener(){throw M(`ENOSYS`,`Watcher.prependOnceListener`)}rawListeners(){throw M(`ENOSYS`,`Watcher.rawListeners`)}ref(){return this}unref(){return this}},Li=class extends Ii{options;realpath;constructor(e,t,n){let r=Me(e);super(r,t),this.options=n,this.realpath=G(r.root,t),Bi(this.realpath,this)}close(){super.emit(`close`),Vi(this.realpath,this)}[Symbol.dispose](){this.close()}},Ri=class extends Ii{options;intervalId;previous;constructor(e,t,n){super(e,t),this.options=n,this.start()}onInterval(){try{let e=qr(this.path);_n(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=qr(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()}},zi=new Map;function Bi(e,t){let n=W(e);zi.has(n)||zi.set(n,new Set),zi.get(n).add(t)}function Vi(e,t){let n=W(e);zi.has(n)&&(zi.get(n).delete(t),zi.get(n).size===0&&zi.delete(n))}function Hi(e,t,n){let r=Me(e);r&&(n=G(r.root??`/`,n)),n=W(n);for(let e=n;e!=`/`;e=K(e)){let r=zi.get(e);if(r)for(let i of r)i.emit(`change`,t,sn.call(i._context,e,n)||cn(n))}}async function Ui(e,t,n,r){if(t=rn.call(e,t),n){let n=Or(t,e,r),i=await n.fs.stat(n.path).catch(()=>void 0);return{...n,fullPath:t,stats:i}}try{let i=Or(t,e),a=await i.fs.stat(i.path);return An(a)?await Ui(e,rn.call(e,K(t),await Gi.call(e,t)),n,r):{...i,fullPath:t,stats:a}}catch{}let{base:i,dir:a}=dn(t),o=a==`/`?`/`:(await Ui(e,a,!1,r)).fullPath,s=G(o,i),c=Or(s,e),l=await c.fs.stat(c.path).catch(e=>{if(e.code!=`ENOENT`)throw A(Object.assign(e,{syscall:`stat`,path:s,...r}))});return l?An(l)?await Ui(e,rn.call(e,o,await Gi.call(e,s)),!1,r):{...c,fullPath:s,stats:l}:{...c,fullPath:t}}async function Wi(e,t,n){t=W(t);let r=qt(n.mode,420),i=vr(n.flag),a={syscall:`open`,path:t},{fs:o,path:s,stats:c}=await Ui(e,t,n.preserveSymlinks,a);if(!c){if(!(i&64))throw M(`ENOENT`,a);let c=await o.stat(K(s));if(X&&!Y(e,c,2))throw M(`EACCES`,`open`,K(t));if(!kn(c))throw M(`ENOTDIR`,`open`,K(t));if(!n.allowDirectory&&r&16384)throw M(`EISDIR`,`open`,t);let{euid:l,egid:u}=Me(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 pr(e,t,o,s,i,d)}if(X&&!Y(e,c,br(i)))throw M(`EACCES`,a);if(i&128)throw M(`EEXIST`,a);let l=new pr(e,t,o,s,i,c);if(!n.allowDirectory&&r&16384)throw M(`EISDIR`,`open`,t);return i&512&&await l.truncate(0),l}async function Gi(e){e=W(e);let t={syscall:`readlink`,path:e},{fs:n,stats:r,path:i}=await Ui(this,e,!0,t);if(!r)throw M(`ENOENT`,t);if(X&&!Y(this,r,4))throw M(`EACCES`,t);if(!An(r))throw M(`EINVAL`,t);let a=r.size,o=new Uint8Array(a);return await n.read(i,o,0,a),w(o)}async function Ki(e,t={}){e=W(e);let{euid:n,egid:r}=Me(this).credentials,{mode:i=511,recursive:a}=t,{fs:o,path:s}=Or(e,this,{syscall:`mkdir`}),c=async(e,t,a)=>{if(X&&!Y(this,a,2))throw M(`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 Hi(this,`rename`,e),s};if(!a){await c(e,s,await o.stat(K(s)));return}let l=[],u=e;for(let e=s;!await o.exists(e);e=K(e),u=K(u))l.unshift([u,e]);if(!l.length)return;let d=[await o.stat(K(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 qi(e,t={}){e=W(e);let n={syscall:`readdir`,path:e},{fs:r,path:i,stats:a}=await Ui(this,e,!1,n);if(!a)throw M(`ENOENT`,n);if(X&&!Y(this,a,4))throw M(`EACCES`,n);if(!kn(a))throw M(`ENOTDIR`,n);let o=await r.readdir(i),s=[],c=async e=>{let n=await r.stat(G(i,e)).catch(e=>{if(e.code!=`ENOENT`)throw e});if(!n)return;let a=new fr;if(a.ino=n.ino,a.type=ur(n.mode),a.path=e,a.name=cn(e),s.push(a),!t.recursive||!kn(n))return;let o=await r.readdir(G(i,e));for(let t of o)await c(G(e,t))};return await Promise.all(o.map(c)),s}async function Ji(e,t){e=W(e),t=W(t);let n={syscall:`rename`,path:e,dest:t},r=await Ui(this,e,!0,n),i=Or(t,this,n);if(r.fs.uuid!==i.fs.uuid)throw M(`EXDEV`,n);if(i.path.startsWith(r.path+`/`))throw M(`EBUSY`,n);if(!r.stats)throw M(`ENOENT`,n);let a=r.fs,o=await a.stat(K(r.path)),s=await a.stat(K(i.path)),c=await a.stat(i.path).catch(e=>{if(e.code==`ENOENT`)return null;throw e});if(X&&(!Y(this,o,4)||!Y(this,s,2)))throw M(`EACCES`,n);if(c&&!kn(r.stats)&&kn(c))throw M(`EISDIR`,n);if(c&&kn(r.stats)&&!kn(c))throw M(`ENOTDIR`,n);await r.fs.rename(r.path,i.path),Hi(this,`rename`,e),Hi(this,`change`,t)}async function Yi(e,t){e=W(e),t=W(t);let n={syscall:`link`,path:t,dest:e},{fs:r,path:i}=Or(e,this,n),a=Or(t,this,n);if(r.uuid!=a.fs.uuid)throw M(`EXDEV`,n);let o=await r.stat(i);if(X){if(!Y(this,o,4))throw M(`EACCES`,n);let e=await r.stat(K(i));if(!Y(this,e,4))throw M(`EACCES`,n);let t=await r.stat(K(a.path));if(!Y(this,t,2))throw M(`EACCES`,n)}return await r.link(i,a.path)}async function Xi(e,t){e=W.call(this,e);let n={syscall:t?`lstat`:`stat`,path:e},r;if(!t)r=(await Ui(this,e,!1,n)).stats;else{let{base:t,dir:i}=dn(e),{fs:a,path:o}=await Ui(this,i,!1,n);r=await a.stat(t?G(o,t):o).catch(P(n))}if(!r)throw M(`ENOENT`,n);if(X&&!Y(this,r,4))throw M(`EACCES`,n);return r}var Zi=class extends c.default{input;output;terminal;line=``;_cursor=0;get cursor(){return this._cursor}_buffer=``;_closed=!1;_paused=!1;_prompt=``;_history=[];_historyIndex=-1;_currentLine=``;constructor(e,t,n,r=!1){super(),this.input=e,this.output=t,this.terminal=r,this.input.on(`data`,this._onData),this.input.on(`end`,this.close.bind(this)),this.input.on(`close`,this.close.bind(this))}_onData=e=>{if(!(this._paused||this._closed)){this._buffer+=typeof e==`string`?e:e.toString(`utf8`);for(let e=this._buffer.indexOf(`
1
+ import{ct as e,lt as t,st as n}from"./main-D7RTZNPJ.js";function r(e,t){if(e.byteLength>=t)return e;if(ArrayBuffer.isView(e)){let n=r(e.buffer,t);return new e.constructor(n,e.byteOffset,t)}let n=typeof SharedArrayBuffer<`u`&&e instanceof SharedArrayBuffer;if(e.maxByteLength>t)return n?e.grow(t):e.resize(t),e;if(n){let n=new SharedArrayBuffer(t);return new Uint8Array(n).set(new Uint8Array(e)),n}try{return e.transfer(t)}catch{let n=new ArrayBuffer(t);return new Uint8Array(n).set(new Uint8Array(e)),n}}var i=class extends DataView{constructor(e,t,n){let{buffer:r,byteOffset:i,byteLength:a}=new Uint8Array(e,t,n);super(r,i,a)}};for(let e of Object.getOwnPropertyNames(DataView.prototype))!e.startsWith(`get`)&&!e.startsWith(`set`)||Object.defineProperty(i.prototype,e,{value:()=>{throw ReferenceError(`Do not use DataView methods on a BufferView.`)},writable:!1,enumerable:!1,configurable:!1});var a=class{id;_size;options;regions=[];get size(){return this._size}set size(e){if(e>=this._size){this._size=e;return}this._size=e;for(let t=this.regions.length-1;t>=0;t--){let n=this.regions[t];if(n.offset>=e){this.regions.splice(t,1);continue}let r=e-n.offset;n.data.byteLength>r&&(n.data=n.data.subarray(0,r)),n.ranges=n.ranges.filter(t=>t.start<e).map(t=>t.end>e?{start:t.start,end:e}:t)}}constructor(e,t,n,r){this.id=e,this._size=t,this.options=n,n.sparse??=!0,n.sparse||this.regions.push({offset:0,data:new Uint8Array(t),ranges:[]}),r?.set(e,this)}collect(){if(!this.options.sparse)return;let{regionGapThreshold:e=4095}=this.options;for(let t=0;t<this.regions.length-1;){let n=this.regions[t],i=this.regions[t+1];if(i.offset-(n.offset+n.data.byteLength)>e){t++;continue}n.ranges.push(...i.ranges),n.ranges.sort((e,t)=>e.start-t.start),n.ranges=n.ranges.reduce((e,t)=>(!e.length||e.at(-1).end<t.start?e.push(t):e.at(-1).end=Math.max(e.at(-1).end,t.end),e),[]),n.data=r(n.data,i.offset+i.data.byteLength),n.data.set(i.data,i.offset-n.offset),this.regions.splice(t+1,1)}}missing(e,t){let n=[];for(let r of this.regions){if(r.offset>=t)break;for(let i of r.ranges)if(!(i.end<=e)&&(i.start>=t||(i.start>e&&n.push({start:e,end:Math.min(i.start,t)}),i.end>e&&(e=Math.max(e,i.end)),e>=t)))break;if(e>=t)break}return e<t&&n.push({start:e,end:t}),n}cached(e,t){let n=[];for(let r of this.regions){if(r.offset>=t)break;for(let i of r.ranges)if(!(i.end<=e)){if(i.start>=t)break;n.push({start:Math.max(e,i.start),end:Math.min(t,i.end)})}}n.sort((e,t)=>e.start-t.start);let r=[];for(let e of n){let t=r.at(-1);t&&e.start<=t.end?t.end=Math.max(t.end,e.end):r.push(e)}return r}regionAt(e){if(this.regions.length)for(let t of this.regions){if(t.offset>e)break;if(e>=t.offset&&e<t.offset+t.data.byteLength)return t}}add(e,t){let n=t+e.byteLength,i=this.regionAt(t);if(i)return i.data=r(i.data,n),i.data.set(e,t),i.ranges.push({start:t,end:n}),i.ranges.sort((e,t)=>e.start-t.start),this.collect(),this;let a={data:e,offset:t,ranges:[{start:t,end:n}]},o=this.regions.findIndex(e=>e.offset>t);return o==-1?this.regions.push(a):this.regions.splice(o,0,a),this.collect(),this}},o=new Uint32Array(256);for(let e=0;e<256;e++){let t=e;for(let e=0;e<8;e++)t=t&1?2197175160^t>>>1:t>>>1;o[e]=t}function s(e){let t=4294967295;for(let n=0;n<e.length;n++)t=t>>>8^o[(t^e[n])&255];return(t^4294967295)>>>0}var c=t(n(((e,t)=>{var n=Object.prototype.hasOwnProperty,r=`~`;function i(){}Object.create&&(i.prototype=Object.create(null),new i().__proto__||(r=!1));function a(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function o(e,t,n,i,o){if(typeof n!=`function`)throw TypeError(`The listener must be a function`);var s=new a(n,i||e,o),c=r?r+t:t;return e._events[c]?e._events[c].fn?e._events[c]=[e._events[c],s]:e._events[c].push(s):(e._events[c]=s,e._eventsCount++),e}function s(e,t){--e._eventsCount===0?e._events=new i:delete e._events[t]}function c(){this._events=new i,this._eventsCount=0}c.prototype.eventNames=function(){var e=[],t,i;if(this._eventsCount===0)return e;for(i in t=this._events)n.call(t,i)&&e.push(r?i.slice(1):i);return Object.getOwnPropertySymbols?e.concat(Object.getOwnPropertySymbols(t)):e},c.prototype.listeners=function(e){var t=r?r+e:e,n=this._events[t];if(!n)return[];if(n.fn)return[n.fn];for(var i=0,a=n.length,o=Array(a);i<a;i++)o[i]=n[i].fn;return o},c.prototype.listenerCount=function(e){var t=r?r+e:e,n=this._events[t];return n?n.fn?1:n.length:0},c.prototype.emit=function(e,t,n,i,a,o){var s=r?r+e:e;if(!this._events[s])return!1;var c=this._events[s],l=arguments.length,u,d;if(c.fn){switch(c.once&&this.removeListener(e,c.fn,void 0,!0),l){case 1:return c.fn.call(c.context),!0;case 2:return c.fn.call(c.context,t),!0;case 3:return c.fn.call(c.context,t,n),!0;case 4:return c.fn.call(c.context,t,n,i),!0;case 5:return c.fn.call(c.context,t,n,i,a),!0;case 6:return c.fn.call(c.context,t,n,i,a,o),!0}for(d=1,u=Array(l-1);d<l;d++)u[d-1]=arguments[d];c.fn.apply(c.context,u)}else{var f=c.length,p;for(d=0;d<f;d++)switch(c[d].once&&this.removeListener(e,c[d].fn,void 0,!0),l){case 1:c[d].fn.call(c[d].context);break;case 2:c[d].fn.call(c[d].context,t);break;case 3:c[d].fn.call(c[d].context,t,n);break;case 4:c[d].fn.call(c[d].context,t,n,i);break;default:if(!u)for(p=1,u=Array(l-1);p<l;p++)u[p-1]=arguments[p];c[d].fn.apply(c[d].context,u)}}return!0},c.prototype.on=function(e,t,n){return o(this,e,t,n,!1)},c.prototype.once=function(e,t,n){return o(this,e,t,n,!0)},c.prototype.removeListener=function(e,t,n,i){var a=r?r+e:e;if(!this._events[a])return this;if(!t)return s(this,a),this;var o=this._events[a];if(o.fn)o.fn===t&&(!i||o.once)&&(!n||o.context===n)&&s(this,a);else{for(var c=0,l=[],u=o.length;c<u;c++)(o[c].fn!==t||i&&!o[c].once||n&&o[c].context!==n)&&l.push(o[c]);l.length?this._events[a]=l.length===1?l[0]:l:s(this,a)}return this},c.prototype.removeAllListeners=function(e){var t;return e?(t=r?r+e:e,this._events[t]&&s(this,t)):(this._events=new i,this._eventsCount=0),this},c.prototype.off=c.prototype.removeListener,c.prototype.addListener=c.prototype.on,c.prefixed=r,c.EventEmitter=c,t!==void 0&&(t.exports=c)}))(),1),l=class extends c.default{[Symbol.toStringTag]=`List`;constructor(e){super(),e&&this.push(...e)}data=new Set;toSet(){return new Set(this.data)}toArray(){return Array.from(this.data)}toJSON(){return Array.from(this.data)}toString(){return this.join(`,`)}_set(e,t,n=!1){if(Math.abs(e)>this.data.size)throw ReferenceError(`Can not set an element outside the bounds of the list`);let r=Array.from(this.data);r.splice(e,+n,t),this.data=new Set(r),this.emit(`update`)}set(e,t){this._set(e,t,!0)}deleteAt(e){if(Math.abs(e)>this.data.size)throw ReferenceError(`Can not delete an element outside the bounds of the list`);this.delete(Array.from(this.data).at(e))}insert(e,t=this.data.size){this._set(t,e,!1)}at(e){if(Math.abs(e)>this.data.size)throw ReferenceError(`Can not access an element outside the bounds of the list`);return Array.from(this.data).at(e)}pop(){let e=Array.from(this.data).pop();return e!==void 0&&this.delete(e),e}push(...e){for(let t of e)this.add(t);return this.data.size}join(e){return Array.from(this.data).join(e)}splice(e,t,...n){if(Math.abs(e)>this.data.size)throw ReferenceError(`Can not splice elements outside the bounds of the list`);let r=Array.from(this.data),i=r.splice(e,t,...n);return this.data=new Set(r),this.emit(`update`),i}add(e){return this.data.add(e),this.emit(`update`),this.emit(`add`,e),this}clear(){this.data.clear(),this.emit(`update`)}delete(e){let t=this.data.delete(e);return this.emit(`update`),t}has(e){return this.data.has(e)}get size(){return this.data.size}entries(){return this.toArray().entries()}keys(){return this.toArray().keys()}values(){return this.data.values()}[Symbol.iterator](){return this.data[Symbol.iterator]()}};function u(e,t){let n=Object.entries(e);return Object.fromEntries(n.filter(([e,n])=>t(e,n)))}function d(e,...t){let n={};for(let r of t.flat())n[r]=e[r];return n}function f(e,...t){return u(e,e=>!t.flat().includes(e))}function p(e){try{return JSON.parse(e),!0}catch{return!1}}function m(e){let t=[];for(let n=e;n&&![`Function`,`Object`].includes(n.constructor.name);n=Object.getPrototypeOf(n))t.push(n.constructor.name);return t}function h(e,t){return Object.fromEntries(Object.entries(e).map(([e,n])=>[e,typeof n==`function`?n.bind(t):n]))}function g(e=Error()){let t=setTimeout(()=>{throw e},5e3);return()=>clearTimeout(t)}function _(e){throw e&&typeof e==`object`&&m(e).includes(`Error`)&&Error?.captureStackTrace(e,_),e}var v=Intl.NumberFormat(`en`,{notation:`compact`});v.format.bind(v);function y(e=0,t=1){return Math.round(Math.random()*(t-e)+e)}function b(e){return e.at(0).toUpperCase()+e.slice(1)}var x=new TextEncoder;function S(e){return x.encode(e)}var C=new TextDecoder;function w(e){if(!e)return``;if(e.buffer instanceof ArrayBuffer&&!e.buffer.resizable)return C.decode(e);let t=new Uint8Array(e.byteLength);return t.set(e),C.decode(t)}function T(e){let t=new Uint8Array(e.length);for(let n=0;n<e.length;n++)t[n]=e.charCodeAt(n);return t}function ee(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||={});var k={[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 A(e){let t=`${e.code}: ${k[e.errno]}, ${e.syscall}`;return e.path&&(t+=` '${e.path}'`),e.dest&&(t+=` -> '${e.dest}'`),e.message&&!e.message.startsWith(k[e.errno])&&(t+=` (${e.message})`),e.message=t,e}var j=class e extends Error{errno;code;path;dest;syscall;constructor(e,t,n={}){let r=O[e];super(t||``),this.errno=e,this.code=r,Object.assign(this,f(n,`message`)),t||A(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 M(e,t,n,r){typeof t==`string`&&(t={syscall:t,path:n,dest:r});let i=new j(O[e],!1,t??{});return Error.captureStackTrace?.(i,M),i}function N(e,t){let n=new j(O[e],t??k[O[e]]);return Error.captureStackTrace?.(n,N),n}function P(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),A(e),e}}var te=e({Level:()=>F,alert:()=>se,configure:()=>Se,crit:()=>L,debug:()=>ue,deprecated:()=>de,emerg:()=>oe,entries:()=>re,err:()=>R,fancy:()=>ge,format:()=>B,info:()=>le,isEnabled:()=>xe,levelOf:()=>ne,levels:()=>I,log:()=>ie,notice:()=>ce,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||={});var I=[`emergency`,`alert`,`critical`,`error`,`warning`,`notice`,`info`,`debug`];function ne(e){return I.indexOf(e)}var re=new l;function ie(e,t){if(!xe)return;let n={level:e,message:t,timestamp:new Date,elapsedMs:performance.now()};re.add(n),V(n)}function ae(e){return function(t){return ie(e,t.toString()),t}}var oe=ae(F.EMERG),se=ae(F.ALERT),L=ae(F.CRIT),R=ae(F.ERR),z=ae(F.WARN),ce=ae(F.NOTICE),le=ae(F.INFO),ue=ae(F.DEBUG);function de(e){ie(F.WARN,e+` is deprecated and should not be used.`)}function fe(e,t){return`\x1b[${t}m${e}\x1b[0m`}function pe(e){return`[`+(e.elapsedMs/1e3).toFixed(3).padStart(10)+`] `}var me={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;`}},he={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 ge({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`?[fe(pe(n),`2;37`)]:[`opacity: 0.8; color: white;`,pe(n)];let r=e==`ansi`?[fe(I[n.level].toUpperCase(),me.ansi[n.level])]:[me.css[n.level],I[n.level].toUpperCase()];if(t==`level`){yield*r,yield n.message;return}n.level<F.CRIT&&(yield*r),e==`ansi`?yield fe(n.message,he.ansi[n.level]):yield*[he.css[n.level],n.message]}}var _e=e=>[pe(e),e.message];function B(e){let t=_e(e);return typeof t==`string`?[t]:Array.from(t)}var ve=console.error;function V(e){e.level>ye||ve(...B(e))}var ye=F.ALERT,be=!1,xe=!0;function Se(e){if(_e=e.format??_e,ve=e.output??ve,ye=typeof e.level==`string`?ne(e.level):e.level??ye,xe=e.enabled??xe,be=e.stack??be,e.dumpBacklog)for(let e of re)V(e)}function Ce(e){return typeof e==`object`&&!!e&&`create`in e&&typeof e.create==`function`}function we(e,t){return Object.defineProperty(t,"prototype",{value:void 0}),e&&Object.defineProperty(t,"name",{value:e}),t}function Te(e){return!(e&&e.constructor===Function)||e.prototype===void 0?!1:Function.prototype===Object.getPrototypeOf(e)?Object.getOwnPropertyNames(e.prototype).length>1:!0}function Ee(e,t){if(typeof t!=`object`||!t)throw R(N(`EINVAL`,`Invalid options`));for(let[n,r]of Object.entries(e.options)){let e=t?.[n];if(e==null){if(!r.required){ue(`Using default for option: `+n);continue}throw R(N(`EINVAL`,`Missing required option: `+n))}let i=(t,n=e)=>typeof t==`function`?Te(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(N(`EINVAL`,`Incorrect type for "${n}": ${a} (expected ${Array.isArray(r.type)?`one of ${r.type.map(o).join(`, `)}`:o(r.type)})`))}}function De(e){return typeof e==`object`&&!!e&&`backend`in e&&Ce(e.backend)}function Oe(e){return{suid:e.uid,sgid:e.gid,euid:e.uid,egid:e.gid,groups:[],...e}}function ke(e){return e?!e.uid||!e.gid||!e.euid||!e.egid||e.groups.some(e=>!e):!1}var Ae=Symbol(`ZenFSContext`),je={[Ae]:!0,id:0,root:`/`,pwd:`/`,credentials:Oe({uid:0,gid:0}),descriptors:new Map,parent:null,children:[]};function Me(e){return typeof e==`object`&&e&&Ae in e?e:je}var Ne=1;function Pe(e,t={}){let{root:n=e.root,pwd:r=e.pwd,credentials:i=structuredClone(e.credentials)}=t,a={[Ae]:!0,id:Ne++,root:n,pwd:r,credentials:Oe(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 Fe=e({COPYFILE_EXCL:()=>1,COPYFILE_FICLONE:()=>2,COPYFILE_FICLONE_FORCE:()=>4,F_OK:()=>0,O_APPEND:()=>Ie,O_CREAT:()=>64,O_DIRECT:()=>Ue,O_DIRECTORY:()=>Le,O_DSYNC:()=>Ve,O_EXCL:()=>128,O_NOATIME:()=>Re,O_NOCTTY:()=>256,O_NOFOLLOW:()=>ze,O_NONBLOCK:()=>We,O_RDONLY:()=>0,O_RDWR:()=>2,O_SYMLINK:()=>He,O_SYNC:()=>Be,O_TRUNC:()=>512,O_WRONLY:()=>1,R_OK:()=>4,S_IFBLK:()=>Ye,S_IFCHR:()=>Ze,S_IFDIR:()=>Xe,S_IFIFO:()=>Qe,S_IFLNK:()=>qe,S_IFMT:()=>Ge,S_IFREG:()=>Je,S_IFSOCK:()=>Ke,S_IRGRP:()=>32,S_IROTH:()=>4,S_IRUSR:()=>256,S_IRWXG:()=>56,S_IRWXO:()=>7,S_IRWXU:()=>448,S_ISGID:()=>et,S_ISUID:()=>$e,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:()=>tt}),Ie=1024,Le=65536,Re=262144,ze=131072,Be=1052672,Ve=4096,He=32768,Ue=16384,We=2048,Ge=61440,Ke=49152,qe=40960,Je=32768,Ye=24576,Xe=16384,Ze=8192,Qe=4096,$e=2048,et=1024,tt=4294967295;function nt(e){return`__isArrayType`in e&&e.__isArrayType===!0}function rt(e){return typeof e!=`object`&&typeof e!=`function`||e==null?!1:nt(e)?rt(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`&&it.has(e.name)&&it.get(e.name)?.name===e.name}var it=new Map;function at(e){if(it.has(e.name))throw ReferenceError(`Type is already registered: ${e.name}`);it.set(e.name,e)}var ot=Symbol(`DataView`);function st(e){return e[ot]??=new DataView(e),e[ot]}var ct={name:`int8`,size:1,array:Int8Array,get:(e,t)=>st(e).getInt8(t),set:(e,t,n)=>st(e).setInt8(t,n)},lt={name:`uint8`,size:1,array:Uint8Array,get:(e,t)=>st(e).getUint8(t),set:(e,t,n)=>st(e).setUint8(t,n)},ut={int8:ct,uint8:lt,int16:{name:`int16`,size:2,array:Int16Array,get:(e,t)=>st(e).getInt16(t,!0),set:(e,t,n)=>st(e).setInt16(t,n,!0)},uint16:{name:`uint16`,size:2,array:Uint16Array,get:(e,t)=>st(e).getUint16(t,!0),set:(e,t,n)=>st(e).setUint16(t,n,!0)},int32:{name:`int32`,size:4,array:Int32Array,get:(e,t)=>st(e).getInt32(t,!0),set:(e,t,n)=>st(e).setInt32(t,n,!0)},uint32:{name:`uint32`,size:4,array:Uint32Array,get:(e,t)=>st(e).getUint32(t,!0),set:(e,t,n)=>st(e).setUint32(t,n,!0)},int64:{name:`int64`,size:8,array:BigInt64Array,get:(e,t)=>st(e).getBigInt64(t,!0),set:(e,t,n)=>st(e).setBigInt64(t,n,!0)},uint64:{name:`uint64`,size:8,array:BigUint64Array,get:(e,t)=>st(e).getBigUint64(t,!0),set:(e,t,n)=>st(e).setBigUint64(t,n,!0)},float32:{name:`float32`,size:4,array:Float32Array,get:(e,t)=>st(e).getFloat32(t,!0),set:(e,t,n)=>st(e).setFloat32(t,n,!0)},float64:{name:`float64`,size:8,array:Float64Array,get:(e,t)=>st(e).getFloat64(t,!0),set:(e,t,n)=>st(e).setFloat64(t,n,!0)}},dt=Object.keys(ut);for(let e of Object.values(ut))at(e);var ft={...ut,...Object.fromEntries(dt.map(e=>[b(e),ut[e]])),char:lt},pt=Object.keys(ft);function mt(e){return pt.includes(e.toString())}function ht(e){if(!mt(e))throw N(`EINVAL`,`Not a valid primitive type: `+e)}function gt(e){return e==`char`?`uint8`:e.toLowerCase()}function _t(e){return(typeof e==`object`||typeof e==`function`)&&e!==null&&`toInit`in e&&typeof e.toInit==`function`}function vt(e){return _t(e)?e.toInit():rt(e)?{type:e}:e}function yt(e,t,n={}){if(!e)throw N(`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(vt(t),n);if(!rt(i.type))throw N(`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 It?`${i.typeName??i.type.type.name} ${r}[${i.type.length}]${a}`:`${i.typeName??i.type.name} ${r}`,littleEndian:!i.bigEndian}}function bt(e,t){if(!(e instanceof Error)||e.message.toLowerCase()!==`offset is outside the bounds of the dataview`)throw e;let n=N(`EFAULT`,`Segmentation fault (at 0x${t.toString(16)})`);throw Error.captureStackTrace(n,bt),n}function xt(e,t){return t.type instanceof It&&t.type.length==0&&!!t.countedBy?.length&&!!e.constructor.isDynamic}function St(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 N(`EOVERFLOW`,`countedBy field value exceeds max safe integer`);n=Number(n)}if(typeof n!=`number`)throw N(`EINVAL`,`countedBy field value is not a number`);return n}function Ct(e,t){let n=t.type.type.size*St(e,t);if(kt(t.type.type)&&t.type.type.isDynamic)for(let r of e[t.name])n+=At(r);return n}var wt=Symbol(`kOffsets`);function Tt(e,t,n){let{offset:r,name:i}=t;e[wt]||=Object.create(null);let a=e[wt];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)){xt(e,t)&&(r+=Ct(e,t));let n=e[t.name];Ot(n)&&n.constructor.isDynamic&&(r+=At(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 Et(e,t,n,r){typeof n==`string`&&(n=n.charCodeAt(0));let i=e.byteOffset+Tt(e,t,!1)+(r??0)*t.type.size;try{t.type.set(e.buffer,i,n);return}catch(e){bt(e,i)}}function Dt(e,t){let n=t.type;if(xt(e,t)){let r=t.type.type;n=new It(r,St(e,t))}let r=e.byteOffset+Tt(e,t,!0);try{return n.get(e.buffer,r)}catch(e){bt(e,r)}}function Ot(e){return typeof e==`object`&&!!e&&`constructor`in e&&kt(e.constructor)}function kt(e){return typeof e==`function`&&`prototype`in e&&`fields`in e&&typeof e.fields==`object`&&rt(e)}function At(e){let t=0;for(let n of e.constructor.fields){let r=e[n.name];xt(e,n)&&(t+=Ct(e,n)),Ot(r)&&r.constructor.isDynamic&&(t+=At(r))}return t}function jt(e){if(rt(e))return e.size;if(e==null)return 0;if(typeof e==`object`&&rt(e.constructor))return e.constructor.size;if(Array.isArray(e)){let t=0;for(let n=0;n<e.length;n++)t+=jt(e[n]);return t}if(typeof e==`string`)return ht(e),ut[gt(e)].size;throw TypeError(`Unable to resolve size of \`${e.toString()}\``)}function H(e){let t=jt(e);return Ot(e)&&e.constructor.isDynamic?t+At(e):t}function Mt(e,t){let n;if(kt(e)){if(e.isDynamic)throw N(`EINVAL`,`Cannot get offset of field in dynamic struct from the constructor`);n=e}else if(Ot(e))n=e.constructor;else throw N(`EINVAL`,`Type is not a struct or struct constructor`);let{fields:r}=n,i=r.find(e=>e.name===t);if(!i)throw N(`EINVAL`,`Struct does not have field: `+t);return kt(e)?i.offset:Tt(e,i,!0)}var Nt=!1;function Pt(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]+H(e.get(this.buffer,this.byteOffset+this._offsets[n-1]));return this._offsets[t]}constructor(n,r,i){let a=typeof n==`object`?n:new ArrayBuffer((n??0)*e.size);super(a,r,i),this.length=typeof n==`number`?n:e.isDynamic?t??_(`Unknown length of StructArray<${e.name}>`):Math.floor(this.byteLength/e.size);let o=e=>this.byteOffset+this.offsetOf(e);return new Proxy(this,{get(t,n){if(n in t)return t[n];let r=parseInt(n.toString());if(!Number.isSafeInteger(r)){if(Nt)throw N(`EINVAL`,`Invalid index: `+n.toString());return}return e.get(t.buffer,o(r))},set(t,n,r){let i=parseInt(n.toString());if(!Number.isSafeInteger(i)){if(Nt)throw N(`EINVAL`,`Invalid index: `+n.toString());return!1}return e.set(t.buffer,o(i),r),!0}})}}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 Ft(e){return typeof e==`function`&&`prototype`in e&&`fields`in e&&typeof e.fields==`object`&&rt(e)}var It=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=Pt(this),this.__structArray=Pt(e,t),this.__arrayType=e.array?e.array:this.__structArray}get=(e,t)=>mt(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+=Ft(this.type)&&this.type.isDynamic?H(n[t]):this.type.size}};array};Symbol.metadata??=Symbol.for(`Symbol.metadata`);function Lt(e){e.metadata??={};let t=e.metadata.structInit??{};return e.metadata.structInit={fields:[...t.fields??[]]},e.metadata.structInit}function Rt(...e){let t=e.reduce((e,t)=>({...e,...t}),{});return typeof this==`object`&&Object.assign(t,this),function(e,n){let r=Lt(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 Dt(this,e)},set(t){Et(this,e,t)}})}}return n.addInitializer(function(){Object.defineProperty(c,"name",{value:e.name}),at(c)}),c}}Rt.packed=Rt.bind({isPacked:!0}),Rt.align=function(e){return Rt.bind({alignment:e})};function zt(e,t={}){return function(n,r){if(r.kind!=`accessor`)throw N(`EINVAL`,`Field must be an accessor`);let i=Lt(r),a=yt(r.name,e,t);return i.fields.push(a),{get(){return Dt(this,a)},set(e){Et(this,a,e)}}}}function Bt(e){let t=ut[gt(e)];function n(n,r){return typeof n==`number`?zt(new It(t,n),{typeName:e,...r}):zt(t,{typeName:e})(n,r&&`name`in r?r:_(N(`EINVAL`,`Invalid decorator context object`)))}return n}var U=Object.fromEntries(pt.map(e=>[e,Bt(e)]));function Vt(e){return e}Vt.typed=function(e){return e};var Ht=class e{type;init;constructor(t,n){this.type=t,this.init=n;let r=(r=>new e(new It(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 Ut(e,t=0){return new Ht(new It(e,t),{})}function Wt(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=yt(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 Dt(this,e)},set(t){Et(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 at(c),c}Wt.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=yt(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 at(l),l},Wt.packed=Wt.bind({isPacked:!0}),Wt.align=function(e){return Wt.bind({alignment:e})},Wt.dynamic=Wt.bind({isDynamic:!0}),Object.fromEntries(Object.entries(ft).map(([e,t])=>[e,new Ht(t,{typeName:e})]));function Gt(e){return JSON.parse(w(e),(e,t)=>e==``?t:typeof t==`string`?BigInt(t).toString(16).slice(0,Math.min(t.length,8)):t)}function Kt(e){return S(JSON.stringify(e))}function qt(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 N(`EINVAL`,`Invalid mode: `+e?.toString())}function Jt(e){if(e instanceof Date)return e.getTime();try{return Number(e)}catch{throw N(`EINVAL`,`Invalid time.`)}}function W(e,t=!1){if(e instanceof URL){if(e.protocol!=`file:`)throw N(`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 N(`EINVAL`,`Path can not contain null character`);if(e.length==0)throw N(`EINVAL`,`Path can not be empty`);return e=e.replaceAll(/[/\\]+/g,`/`),t?e:rn.call(this,e)}function Yt(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:qt(`mode`in e?e?.mode:null,r)}}function Xt(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 Zt(e){let t=Promise.withResolvers();setTimeout(()=>t.reject(N(`ETIMEDOUT`)),500),e.on(`online`,t.resolve),await t.promise}function Qt(e){return`/tmp/${W(e,!0)}${Date.now()}-${Math.random().toString(36).slice(2)}`}var $t=e({basename:()=>cn,dirname:()=>K,extname:()=>ln,format:()=>un,formatExt:()=>nn,isAbsolute:()=>on,join:()=>G,matchesGlob:()=>fn,normalize:()=>an,normalizeString:()=>tn,parse:()=>dn,relative:()=>sn,resolve:()=>rn,sep:()=>`/`});function en(e,t){if(typeof e!=`object`)throw TypeError(`"${t}" is not an object`)}function tn(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 nn(e){return e?`${e[0]===`.`?``:`.`}${e}`:``}function rn(...e){let t=``;for(let n of[...e.reverse(),Me(this).pwd])if(n?.length&&(t=`${n}/${t}`,n.startsWith(`/`)))break;let n=t.startsWith(`/`);return t=tn(t,!n),n?`/${t}`:t.length?t:`/`}function an(e){if(!e.length)return`.`;let t=e[0]===`/`,n=e.at(-1)===`/`;return e=tn(e,!t),e.length?(n&&(e+=`/`),t?`/${e}`:e):t?`/`:n?`./`:`.`}function on(e){return e.startsWith(`/`)}function G(...e){if(!e.length)return`.`;let t=e.filter(e=>e).join(`/`);return t?.length?an(t):`.`}function sn(e,t){if(e===t||(e=rn.call(this,e),t=rn.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 K(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 cn(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 ln(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 un(e){en(e,`pathObject`);let t=e.dir||e.root,n=e.base||`${e.name||``}${nn(e.ext)}`;return t?t===e.root?`${t}${n}`:`${t}/${n}`:n}function dn(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 fn(e,t){return Xt(e).test(t)}var pn=BigInt(1e3),mn=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(Je)),Object.assign(this,l)}isFile(){return(this.mode&Ge)===Je}isDirectory(){return(this.mode&Ge)===Xe}isSymbolicLink(){return(this.mode&Ge)===qe}isSocket(){return(this.mode&Ge)===Ke}isBlockDevice(){return(this.mode&Ge)===Ye}isCharacterDevice(){return(this.mode&Ge)===Ze}isFIFO(){return(this.mode&Ge)===Qe}toJSON(){return d(this,wn)}hasAccess(e,t){return Y(t,this._isBigint?new hn(this):this,e)}get atimeNs(){return BigInt(this.atimeMs)*pn}get mtimeNs(){return BigInt(this.mtimeMs)*pn}get ctimeNs(){return BigInt(this.ctimeMs)*pn}get birthtimeNs(){return BigInt(this.birthtimeMs)*pn}},hn=class extends mn{_isBigint=!1},gn=class extends mn{_isBigint=!0};function _n(e,t){return e.size==t.size&&+e.atime==+t.atime&&+e.mtime==+t.mtime&&+e.ctime==+t.ctime&&e.mode==t.mode}var vn=class{type=525687744115;bsize=4096;blocks=0;bfree=0;bavail=0;files=tt;ffree=tt},yn=class{type=BigInt(`0x7a656e6673`);bsize=BigInt(4096);blocks=BigInt(0);bfree=BigInt(0);bavail=BigInt(0);files=BigInt(tt);ffree=BigInt(tt)},bn=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},q=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},xn=3968,Sn=(()=>{var e,t;let n=[Rt.packed()],r,i=[],a,o=Vt.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=U).uint32.bind(e)],u=[(t=U).uint32.bind(t)],bn(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),bn(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),bn(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=q(this,c,void 0);get keySize(){return this.#e}set keySize(e){this.#e=e}#t=(q(this,l),q(this,d,void 0));get valueSize(){return this.#t}set valueSize(e){this.#t=e}get name(){return w(this.subarray(8,8+this.keySize))}set name(e){let t=S(e);if(8+t.length+this.valueSize>xn)throw N(`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>xn)throw N(`EOVERFLOW`);this.valueSize=e.length,this.set(e,8+this.keySize)}get size(){return 8+this.keySize+this.valueSize}constructor(){super(...arguments),q(this,f)}static{q(a,i)}};return a})(),Cn=(()=>{var e;let t=[Rt.packed()],n,r=[],a,o=Vt(i),s,c=[],l=[];var u=class extends o{static{a=this}static{let i=typeof Symbol==`function`&&Symbol.metadata?Object.create(o[Symbol.metadata]??null):void 0;s=[(e=U).uint32.bind(e)],bn(this,null,s,{kind:`accessor`,name:`size`,static:!1,private:!1,access:{has:e=>`size`in e,get:e=>e.size,set:(e,t)=>{e.size=t}},metadata:i},c,l),bn(null,n={value:a},t,{kind:`class`,name:a.name,metadata:i},null,r),u=a=n.value,i&&Object.defineProperty(a,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:i})}static name=`Attributes`;#e=q(this,c,void 0);get size(){return this.#e}set size(e){this.#e=e}get byteSize(){let e=this.byteOffset+H(this);for(let t=0;t<this.size;t++){let t=new Sn(this.buffer,e);e+=t.size}return e}has(e){let t=this.byteOffset+H(this);for(let n=0;n<this.size;n++){let n=new Sn(this.buffer,t);if(n.name==e)return!0;t+=n.size}return!1}get(e){let t=this.byteOffset+H(this);for(let n=0;n<this.size;n++){let n=new Sn(this.buffer,t);if(n.name==e)return n.value;t+=n.size}}set(e,t){let n=this.byteOffset+H(this),r;for(let t=0;t<this.size;t++){let t=new Sn(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 Sn(this.buffer,n);a.name=e,a.value=t,this.size++}remove(e){let t=this.byteOffset+H(this),n;for(let r=0;r<this.size;r++){let r=new Sn(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+H(this);for(let t=0;t<this.size;t++){let t=new Sn(this.buffer,e);yield t.name,e+=t.size}}*values(){let e=this.byteOffset+H(this);for(let t=0;t<this.size;t++){let t=new Sn(this.buffer,e);yield t.value,e+=t.size}}*entries(){let e=this.byteOffset+H(this);for(let t=0;t<this.size;t++){let t=new Sn(this.buffer,e);yield[t.name,t.value],e+=t.size}}constructor(){super(...arguments),q(this,l)}static{q(a,r)}};return a})(),wn=[`ino`,`data`,`size`,`mode`,`flags`,`nlink`,`uid`,`gid`,`atimeMs`,`birthtimeMs`,`mtimeMs`,`ctimeMs`,`version`],Tn;(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`})(Tn||={});var En=253951,Dn=229631,J=(()=>{var e,t,n,r,a,o,s,c,l,u,f,p,m,h,g,_;let v=[Rt.packed()],y,b=[],x,S=Vt(i),C,w=[],T=[],ee,E=[],D=[],O,k=[],A=[],j,M=[],P=[],te,F=[],I=[],ne,re=[],ie=[],ae,oe=[],se=[],R,ce=[],le=[],ue,de=[],fe=[],pe,me=[],he=[],ge,_e=[],B=[],ve,V=[],ye=[],be,xe=[],Se=[],Ce,we=[],Te=[],Ee,De=[],Oe=[],ke,Ae=[],je=[],Me,Ne=[],Pe=[],Fe,Ie=[],Le=[],Re,ze=[],Be=[];var Ve=class extends S{static{x=this}static{let i=typeof Symbol==`function`&&Symbol.metadata?Object.create(S[Symbol.metadata]??null):void 0;C=[(e=U).uint32.bind(e)],ee=[(t=U).uint32.bind(t)],O=[(n=U).uint32.bind(n)],j=[(r=U).uint16.bind(r)],te=[(a=U).uint32.bind(a)],ne=[(o=U).uint32.bind(o)],ae=[(s=U).uint32.bind(s)],R=[(c=U).float64.bind(c)],ue=[(l=U).float64.bind(l)],pe=[(u=U).float64.bind(u)],ge=[(f=U).float64.bind(f)],ve=[(p=U).uint32.bind(p)],be=[(m=U).uint32.bind(m)],Ce=[(h=U).uint32.bind(h)],Ee=[(g=U).uint16.bind(g)],ke=[(_=U).uint32.bind(_)],Me=[U.uint8(48)],Fe=[zt(Cn)],Re=[U.uint8(xn)],bn(this,null,C,{kind:`accessor`,name:`data`,static:!1,private:!1,access:{has:e=>`data`in e,get:e=>e.data,set:(e,t)=>{e.data=t}},metadata:i},w,T),bn(this,null,ee,{kind:`accessor`,name:`__data_old`,static:!1,private:!1,access:{has:e=>`__data_old`in e,get:e=>e.__data_old,set:(e,t)=>{e.__data_old=t}},metadata:i},E,D),bn(this,null,O,{kind:`accessor`,name:`size`,static:!1,private:!1,access:{has:e=>`size`in e,get:e=>e.size,set:(e,t)=>{e.size=t}},metadata:i},k,A),bn(this,null,j,{kind:`accessor`,name:`mode`,static:!1,private:!1,access:{has:e=>`mode`in e,get:e=>e.mode,set:(e,t)=>{e.mode=t}},metadata:i},M,P),bn(this,null,te,{kind:`accessor`,name:`nlink`,static:!1,private:!1,access:{has:e=>`nlink`in e,get:e=>e.nlink,set:(e,t)=>{e.nlink=t}},metadata:i},F,I),bn(this,null,ne,{kind:`accessor`,name:`uid`,static:!1,private:!1,access:{has:e=>`uid`in e,get:e=>e.uid,set:(e,t)=>{e.uid=t}},metadata:i},re,ie),bn(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:i},oe,se),bn(this,null,R,{kind:`accessor`,name:`atimeMs`,static:!1,private:!1,access:{has:e=>`atimeMs`in e,get:e=>e.atimeMs,set:(e,t)=>{e.atimeMs=t}},metadata:i},ce,le),bn(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:i},de,fe),bn(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:i},me,he),bn(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:i},_e,B),bn(this,null,ve,{kind:`accessor`,name:`ino`,static:!1,private:!1,access:{has:e=>`ino`in e,get:e=>e.ino,set:(e,t)=>{e.ino=t}},metadata:i},V,ye),bn(this,null,be,{kind:`accessor`,name:`__ino_old`,static:!1,private:!1,access:{has:e=>`__ino_old`in e,get:e=>e.__ino_old,set:(e,t)=>{e.__ino_old=t}},metadata:i},xe,Se),bn(this,null,Ce,{kind:`accessor`,name:`flags`,static:!1,private:!1,access:{has:e=>`flags`in e,get:e=>e.flags,set:(e,t)=>{e.flags=t}},metadata:i},we,Te),bn(this,null,Ee,{kind:`accessor`,name:`__after_flags`,static:!1,private:!1,access:{has:e=>`__after_flags`in e,get:e=>e.__after_flags,set:(e,t)=>{e.__after_flags=t}},metadata:i},De,Oe),bn(this,null,ke,{kind:`accessor`,name:`version`,static:!1,private:!1,access:{has:e=>`version`in e,get:e=>e.version,set:(e,t)=>{e.version=t}},metadata:i},Ae,je),bn(this,null,Me,{kind:`accessor`,name:`__padding`,static:!1,private:!1,access:{has:e=>`__padding`in e,get:e=>e.__padding,set:(e,t)=>{e.__padding=t}},metadata:i},Ne,Pe),bn(this,null,Fe,{kind:`accessor`,name:`attributes`,static:!1,private:!1,access:{has:e=>`attributes`in e,get:e=>e.attributes,set:(e,t)=>{e.attributes=t}},metadata:i},Ie,Le),bn(this,null,Re,{kind:`accessor`,name:`__data`,static:!1,private:!1,access:{has:e=>`__data`in e,get:e=>e.__data,set:(e,t)=>{e.__data=t}},metadata:i},ze,Be),bn(null,y={value:x},v,{kind:`class`,name:x.name,metadata:i},null,b),Ve=x=y.value,i&&Object.defineProperty(x,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:i})}static name=`Inode`;constructor(...e){let t={};if(typeof e[0]==`object`&&e[0]!==null&&!ArrayBuffer.isView(e[0])&&(t=e[0],e=[H(Ve)]),super(...e),q(this,Be),this.byteLength<H(Ve))throw L(N(`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=q(this,w,void 0);get data(){return this.#e}set data(e){this.#e=e}#t=(q(this,T),q(this,E,void 0));get __data_old(){return this.#t}set __data_old(e){this.#t=e}#n=(q(this,D),q(this,k,void 0));get size(){return this.#n}set size(e){this.#n=e}#r=(q(this,A),q(this,M,void 0));get mode(){return this.#r}set mode(e){this.#r=e}#i=(q(this,P),q(this,F,void 0));get nlink(){return this.#i}set nlink(e){this.#i=e}#a=(q(this,I),q(this,re,void 0));get uid(){return this.#a}set uid(e){this.#a=e}#o=(q(this,ie),q(this,oe,void 0));get gid(){return this.#o}set gid(e){this.#o=e}#s=(q(this,se),q(this,ce,void 0));get atimeMs(){return this.#s}set atimeMs(e){this.#s=e}#c=(q(this,le),q(this,de,void 0));get birthtimeMs(){return this.#c}set birthtimeMs(e){this.#c=e}#l=(q(this,fe),q(this,me,void 0));get mtimeMs(){return this.#l}set mtimeMs(e){this.#l=e}#u=(q(this,he),q(this,_e,void 0));get ctimeMs(){return this.#u}set ctimeMs(e){this.#u=e}#d=(q(this,B),q(this,V,void 0));get ino(){return this.#d}set ino(e){this.#d=e}#f=(q(this,ye),q(this,xe,void 0));get __ino_old(){return this.#f}set __ino_old(e){this.#f=e}#p=(q(this,Se),q(this,we,void 0));get flags(){return this.#p}set flags(e){this.#p=e}#m=(q(this,Te),q(this,De,void 0));get __after_flags(){return this.#m}set __after_flags(e){this.#m=e}#h=(q(this,Oe),q(this,Ae,void 0));get version(){return this.#h}set version(e){this.#h=e}#g=(q(this,je),q(this,Ne,void 0));get __padding(){return this.#g}set __padding(e){this.#g=e}#_=(q(this,Pe),q(this,Ie,void 0));get attributes(){return this.#_}set attributes(e){this.#_=e}#v=(q(this,Le),q(this,ze,void 0));get __data(){return this.#v}set __data(e){this.#v=e}toString(){return`<Inode ${this.ino}>`}toJSON(){return{...d(this,wn),attributes:this.attributes}}toStats(){return new hn(this)}update(e){if(!e)return!1;let t=!1;for(let n of wn)e[n]!==void 0&&(n==`ino`||n==`data`||this[n]!==e[n]&&(n==`atimeMs`&&this.flags&Tn.NoAtime||(this[n]=e[n],t=!0)));return e.attributes&&(this.attributes.copyFrom(e.attributes),t=!0),t&&(this.ctimeMs=Date.now()),t}static{q(x,b)}};return Ve=x})();function On(e){return(e.mode&Ge)===Je}function kn(e){return(e.mode&Ge)===Xe}function An(e){return(e.mode&Ge)===qe}function jn(e){return(e.mode&Ge)===Ke}function Mn(e){return(e.mode&Ge)===Ye}function Nn(e){return(e.mode&Ge)===Ze}function Pn(e){return(e.mode&Ge)===Qe}function Y(e,t,n){let{credentials:r}=Me(e);if(An(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 Fn(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 In=class e extends Map{maxSize=tt;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*H(J);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 N(`ENOENT`);if((t.mode&61440)!=16384)throw N(`ENOTDIR`);let n={};for(let t of this.keys())K(t)==e&&t!=e&&(n[cn(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())K(e)==t&&e!=t&&(r[cn(e)]=this.get(e).ino);e.set(t,r)}return e}fromJSON(e){if(e.version!=1)throw N(`EINVAL`,`Index version mismatch`);this.clear();for(let[t,n]of Object.entries(e.entries))n.data??=y(1,tt),t==`/`&&(n.ino=0),this.set(t,new J(n));return this}static parse(t){if(!p(t))throw N(`EINVAL`,`Invalid JSON`);let n=JSON.parse(t),r=new e;return r.fromJSON(n),r}},Ln=4096,Rn=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 N(`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+=Ln){let r=t+Ln>a?a-t:Ln,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 zn=class{store;constructor(e){this.store=e}},Bn=class extends zn{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)}},Vn=class extends zn{asyncDone=Promise.resolve();async(e){this.asyncDone=this.asyncDone.then(()=>e)}_cached(e,t){this.store.cache??=new Map;let n=this.store.cache.get(e);return n?(t&&(n.size=t.size),n):t?new a(e,t.size,{},this.store.cache):void 0}getSync(e,t,n){let r=this._cached(e);if(!r)return;n??=r.size;let i=r.missing(t,n);for(let{start:t,end:n}of i)this.async(this.get(e,t,n));if(i.length)throw N(`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)}},Hn=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 Vn))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 Vn))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)}}},Un=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},Wn=(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}),Gn=class extends Rn{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=sn(e,r);if(a.startsWith(`..`))continue;let o=G(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,ue(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=Un(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,Kt(r.get(t)));await n.commit()}catch(e){t.error=e,t.hasError=!0}finally{let e=Wn(t);e&&await e}}loadIndexSync(e){let t={stack:[],error:void 0,hasError:!1};try{let n=Un(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,Kt(r.get(t)));n.commitSync()}catch(e){t.error=e,t.hasError=!0}finally{Wn(t)}}async createIndex(){let e={stack:[],error:void 0,hasError:!1};try{let t=new In,n=Un(e,this.transaction(),!0),r=[[`/`,0]],i=g(N(`EDEADLK`));for(;r.length;){let[e,i]=r.shift(),a=new J(await n.get(i));if(t.set(e,a),a.mode&16384){let t=Gt(await n.get(a.data)??_(N(`ENODATA`)));for(let[n,i]of Object.entries(t))r.push([G(e,n),i])}}return i(),t}catch(t){e.error=t,e.hasError=!0}finally{let t=Wn(e);t&&await t}}createIndexSync(){let e={stack:[],error:void 0,hasError:!1};try{let t=new In,n=Un(e,this.transaction(),!1),r=[[`/`,0]],i=g(N(`EDEADLK`));for(;r.length;){let[e,i]=r.shift(),a=new J(n.getSync(i));if(t.set(e,a),a.mode&16384){let t=Gt(n.getSync(a.data)??_(N(`ENODATA`)));for(let[n,i]of Object.entries(t))r.push([G(e,n),i])}}return i(),t}catch(t){e.error=t,e.hasError=!0}finally{Wn(e)}}async rename(e,t){let n={stack:[],error:void 0,hasError:!1};try{let r=Un(n,this.transaction(),!0),i=dn(e),a=dn(t),o=await this.findInode(r,i.dir),s=Gt(await r.get(o.data)??_(N(`ENODATA`)));if(!s[i.base])throw N(`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 N(`EBUSY`);let l=a.dir==i.dir,u=l?o:await this.findInode(r,a.dir),d=l?s:Gt(await r.get(u.data)??_(N(`ENODATA`)));if(d[a.base]){let e=new J(await r.get(d[a.base])??_(N(`ENOENT`)));if(!On(e))throw N(`EISDIR`);await r.remove(e.data),await r.remove(d[a.base])}d[a.base]=c,await r.set(o.data,Kt(s)),await r.set(u.data,Kt(d)),await r.commit(),this._move(e,t)}catch(e){n.error=e,n.hasError=!0}finally{let e=Wn(n);e&&await e}}renameSync(e,t){let n={stack:[],error:void 0,hasError:!1};try{let r=Un(n,this.transaction(),!1),i=dn(e),a=dn(t),o=this.findInodeSync(r,i.dir),s=Gt(r.getSync(o.data)??_(N(`ENODATA`)));if(!s[i.base])throw N(`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 N(`EBUSY`);let l=a.dir===i.dir,u=l?o:this.findInodeSync(r,a.dir),d=l?s:Gt(r.getSync(u.data)??_(N(`ENODATA`)));if(d[a.base]){let e=new J(r.getSync(d[a.base])??_(N(`ENOENT`)));if(!On(e))throw N(`EISDIR`);r.removeSync(e.data),r.removeSync(d[a.base])}d[a.base]=c,r.setSync(o.data,Kt(s)),r.setSync(u.data,Kt(d)),r.commitSync(),this._move(e,t)}catch(e){n.error=e,n.hasError=!0}finally{Wn(n)}}async stat(e){let t={stack:[],error:void 0,hasError:!1};try{let n=Un(t,this.transaction(),!0);return await this.findInode(n,e)}catch(e){t.error=e,t.hasError=!0}finally{let e=Wn(t);e&&await e}}statSync(e){let t={stack:[],error:void 0,hasError:!1};try{let n=Un(t,this.transaction(),!1);return this.findInodeSync(n,e)}catch(e){t.error=e,t.hasError=!0}finally{Wn(t)}}async touch(e,t){let n={stack:[],error:void 0,hasError:!1};try{let r=Un(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=Wn(n);e&&await e}}touchSync(e,t){let n={stack:[],error:void 0,hasError:!1};try{let r=Un(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{Wn(n)}}async createFile(e,t){return t.mode|=Je,await this.commitNew(e,t,new Uint8Array)}createFileSync(e,t){return t.mode|=Je,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 N(`ENOTEMPTY`);await this.remove(e,!0)}rmdirSync(e){if(this.readdirSync(e).length)throw N(`ENOTEMPTY`);this.removeSync(e,!0)}async mkdir(e,t){return t.mode|=Xe,await this.commitNew(e,t,S(`{}`))}mkdirSync(e,t){return t.mode|=Xe,this.commitNewSync(e,t,S(`{}`))}async readdir(e){let t={stack:[],error:void 0,hasError:!1};try{let n=Un(t,this.transaction(),!0),r=await this.findInode(n,e);return Object.keys(Gt(await n.get(r.data)??_(N(`ENOENT`))))}catch(e){t.error=e,t.hasError=!0}finally{let e=Wn(t);e&&await e}}readdirSync(e){let t={stack:[],error:void 0,hasError:!1};try{let n=Un(t,this.transaction(),!1),r=this.findInodeSync(n,e);return Object.keys(Gt(n.getSync(r.data)??_(N(`ENOENT`))))}catch(e){t.error=e,t.hasError=!0}finally{Wn(t)}}async sync(){}syncSync(){}async link(e,t){let n={stack:[],error:void 0,hasError:!1};try{let r=Un(n,this.transaction(),!0),i=K(t),a=await this.findInode(r,i),o=Gt(await r.get(a.data)??_(N(`ENOENT`))),s=await this.findInode(r,e);s.nlink++,o[cn(t)]=s.ino,this._add(s.ino,t),await r.set(s.ino,s),await r.set(a.data,Kt(o)),await r.commit()}catch(e){n.error=e,n.hasError=!0}finally{let e=Wn(n);e&&await e}}linkSync(e,t){let n={stack:[],error:void 0,hasError:!1};try{let r=Un(n,this.transaction(),!1),i=K(t),a=this.findInodeSync(r,i),o=Gt(r.getSync(a.data)??_(N(`ENOENT`))),s=this.findInodeSync(r,e);s.nlink++,o[cn(t)]=s.ino,this._add(s.ino,t),r.setSync(s.ino,s),r.setSync(a.data,Kt(o)),r.commitSync()}catch(e){n.error=e,n.hasError=!0}finally{Wn(n)}}async read(e,t,n,r){let i={stack:[],error:void 0,hasError:!1};try{let a=Un(i,this.transaction(),!0),o=await this.findInode(a,e);if(o.size==0)return;let s=await a.get(o.data,n,r)??_(N(`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=Wn(i);e&&await e}}readSync(e,t,n,r){let i={stack:[],error:void 0,hasError:!1};try{let a=Un(i,this.transaction(),!1),o=this.findInodeSync(a,e);if(o.size==0)return;let s=a.getSync(o.data,n,r)??_(N(`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{Wn(i)}}async write(e,t,n){let i={stack:[],error:void 0,hasError:!1};try{let a=Un(i,this.transaction(),!0),o=await this.findInode(a,e),s=t;a.flag(`partial`)||(s=r(await a.get(o.data)??new Uint8Array,n+t.byteLength),s.set(t,n),n=0),await a.set(o.data,s,n),this._add(o.ino,e),await a.commit()}catch(e){i.error=e,i.hasError=!0}finally{let e=Wn(i);e&&await e}}writeSync(e,t,n){let i={stack:[],error:void 0,hasError:!1};try{let a=Un(i,this.transaction(),!1),o=this.findInodeSync(a,e),s=t;a.flag(`partial`)||(s=r(a.getSync(o.data)??new Uint8Array,n+t.byteLength),s.set(t,n),n=0),a.setSync(o.data,s,n),this._add(o.ino,e),a.commitSync()}catch(e){i.error=e,i.hasError=!0}finally{Wn(i)}}transaction(){return new Hn(this.store.transaction(),this)}async checkRoot(){let e={stack:[],error:void 0,hasError:!1};try{let t=Un(e,this.transaction(),!0);if(await t.get(0))return;let n=new J({ino:0,data:1,mode:511|Xe});await t.set(n.data,S(`{}`)),this._add(0,`/`),await t.set(0,n),await t.commit()}catch(t){e.error=t,e.hasError=!0}finally{let t=Wn(e);t&&await t}}checkRootSync(){let e={stack:[],error:void 0,hasError:!1};try{let t=Un(e,this.transaction(),!1);if(t.getSync(0))return;let n=new J({ino:0,data:1,mode:511|Xe});t.setSync(n.data,S(`{}`)),this._add(0,`/`),t.setSync(0,n),t.commitSync()}catch(t){e.error=t,e.hasError=!0}finally{Wn(e)}}async _populate(){let e={stack:[],error:void 0,hasError:!1};try{if(this._initialized){z(`Attempted to populate tables after initialization`);return}ue(`Populating tables with existing store metadata`);let t=Un(e,this.transaction(),!0),n=await t.get(0);if(!n){ce(`Store does not have a root inode`);let e=new J({ino:0,data:1,mode:511|Xe});await t.set(e.data,S(`{}`)),this._add(0,`/`),await t.set(0,e),await t.commit();return}if(n.length<H(J)){L(`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<H(J)){z(`Invalid inode size for ino ${n}: ${o.length}`);continue}let s=new J(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=Gt(c);for(let[t,n]of Object.entries(l))a.push([G(e,t),n])}ue(`Added ${i} existing inode(s) from store`)}catch(t){e.error=t,e.hasError=!0}finally{let t=Wn(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}ue(`Populating tables with existing store metadata`);let t=Un(e,this.transaction(),!1),n=t.getSync(0);if(!n){ce(`Store does not have a root inode`);let e=new J({ino:0,data:1,mode:511|Xe});t.setSync(e.data,S(`{}`)),this._add(0,`/`),t.setSync(0,e),t.commitSync();return}if(n.length<H(J)){L(`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<H(J)){z(`Invalid inode size for ino ${n}: ${o.length}`);continue}let s=new J(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=Gt(c);for(let[t,n]of Object.entries(l))a.push([G(e,t),n])}ue(`Added ${i} existing inode(s) from store`)}catch(t){e.error=t,e.hasError=!0}finally{Wn(e)}}async _findInode(e,t,n=new Set){if(n.has(t))throw L(N(`EIO`,`Infinite loop detected while finding inode`));if(n.add(t),t==`/`)return new J(await e.get(0)??_(N(`ENODATA`)));let{dir:r,base:i}=dn(t),a=await this._findInode(e,r,n),o=Gt(await e.get(a.data)??_(N(`ENODATA`)));if(!(i in o))throw N(`ENOENT`);return new J(await e.get(o[i])??_(N(`ENODATA`)))}_findInodeSync(e,t,n=new Set){if(n.has(t))throw L(N(`EIO`,`Infinite loop detected while finding inode`));if(n.add(t),t==`/`)return new J(e.getSync(0)??_(N(`ENOENT`)));let{dir:r,base:i}=dn(t),a=this._findInodeSync(e,r,n),o=Gt(e.getSync(a.data)??_(N(`ENODATA`)));if(!(i in o))throw N(`ENOENT`);return new J(e.getSync(o[i])??_(N(`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 N(`ENOENT`);return new J(await e.get(n)??_(N(`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 N(`ENOENT`);return new J(e.getSync(n)??_(N(`ENOENT`)))}_lastID;allocNew(e){this._lastID??=Math.max(...this._paths.keys()),this._lastID+=2;let t=this._lastID;if(t>4294967295)throw R(N(`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 N(`EEXIST`);let i=Un(r,this.transaction(),!0),{dir:a,base:o}=dn(e),s=await this.findInode(i,a),c=Gt(await i.get(s.data)??_(N(`ENOENT`)));if(c[o])throw N(`EEXIST`);let l=this.allocNew(e),u=new J({...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,Kt(c)),await i.commit(),u}catch(e){r.error=e,r.hasError=!0}finally{let e=Wn(r);e&&await e}}commitNewSync(e,t,n){let r={stack:[],error:void 0,hasError:!1};try{if(e==`/`)throw N(`EEXIST`);let i=Un(r,this.transaction(),!1),{dir:a,base:o}=dn(e),s=this.findInodeSync(i,a),c=Gt(i.getSync(s.data)??_(N(`ENOENT`)));if(c[o])throw N(`EEXIST`);let l=this.allocNew(e),u=new J({...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,Kt(c)),i.commitSync(),u}catch(e){r.error=e,r.hasError=!0}finally{Wn(r)}}async remove(e,t){let n={stack:[],error:void 0,hasError:!1};try{let r=Un(n,this.transaction(),!0),{dir:i,base:a}=dn(e),o=await this.findInode(r,i),s=Gt(await r.get(o.data)??_(N(`ENOENT`)));if(!s[a])throw N(`ENOENT`);let c=s[a],l=new J(await r.get(c)??_(N(`ENOENT`)));if(delete s[a],!t&&kn(l))throw N(`EISDIR`);await r.set(o.data,Kt(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=Wn(n);e&&await e}}removeSync(e,t){let n={stack:[],error:void 0,hasError:!1};try{let r=Un(n,this.transaction(),!1),{dir:i,base:a}=dn(e),o=this.findInodeSync(r,i),s=Gt(r.getSync(o.data)??_(N(`ENOENT`))),c=s[a];if(!c)throw N(`ENOENT`);let l=new J(r.getSync(c)??_(N(`ENOENT`)));if(delete s[a],!t&&kn(l))throw N(`EISDIR`);r.setSync(o.data,Kt(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{Wn(n)}}},Kn=class extends Bn{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)}},qn=class extends Vn{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)}},Jn=class extends Map{maxSize;label;flags=[];name=`tmpfs`;constructor(e=tt,t){super(),this.maxSize=e,this.label=t}async sync(){}transaction(){return new Kn(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}}},Yn={name:`InMemory`,options:{maxSize:{type:`number`,required:!1},label:{type:`string`,required:!1}},create({maxSize:e,label:t}){let n=new Gn(new Jn(e,t));return n.checkRootSync(),n}},Xn=class extends Gn{devices=new Map;devicesWithDriver(e,t){if(t&&typeof e==`string`)throw R(N(`EINVAL`,`Can not fetch devices using only a driver name`));let n=[];for(let r of this.devices.values())t&&r.driver!=e||(typeof e==`string`?e:e.name)==r.driver.name&&n.push(r);return n}_createDevice(e,t={}){let n=1,r=Array.from(this.devices.values()).at(-1);for(;this.store.has(n)||r?.inode.ino==n;)n++;let i=e.init?.(n,t),a={data:{},minor:0,major:0,...f(i??{},`metadata`),driver:e,inode:new J({mode:Ze|438,...i?.metadata})},o=`/`+(a.name||e.name)+(e.singleton?``:this.devicesWithDriver(e).length);if(this.existsSync(o))throw N(`EEXIST`);return this.devices.set(o,a),le(`Initialized device: `+this._mountPoint+o),a}addDefaults(){this._createDevice(Qn),this._createDevice($n),this._createDevice(er),this._createDevice(tr),this._createDevice(nr),ue(`Added default devices`)}constructor(){super(new Jn(16777216,`devfs`))}async rename(e,t){if(this.devices.has(e))throw N(`EPERM`);if(this.devices.has(t))throw N(`EEXIST`);return super.rename(e,t)}renameSync(e,t){if(this.devices.has(e))throw N(`EPERM`);if(this.devices.has(t))throw N(`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 N(`EEXIST`);return super.createFile(e,t)}createFileSync(e,t){if(this.devices.has(e))throw N(`EEXIST`);return super.createFileSync(e,t)}async unlink(e){if(this.devices.has(e))throw N(`EPERM`);return super.unlink(e)}unlinkSync(e){if(this.devices.has(e))throw N(`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 N(`EEXIST`);return super.mkdir(e,t)}mkdirSync(e,t){if(this.devices.has(e))throw N(`EEXIST`);return super.mkdirSync(e,t)}async readdir(e){let t=await super.readdir(e);for(let n of this.devices.keys())K(n)==e&&t.push(cn(n));return t}readdirSync(e){let t=super.readdirSync(e);for(let n of this.devices.keys())K(n)==e&&t.push(cn(n));return t}async link(e,t){if(this.devices.has(e))throw N(`EPERM`);if(this.devices.has(t))throw N(`EEXIST`);return super.link(e,t)}linkSync(e,t){if(this.devices.has(e))throw N(`EPERM`);if(this.devices.has(t))throw N(`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)}},Zn=new Uint8Array,Qn={name:`null`,singleton:!0,init(){return{major:1,minor:3}},read(){return Zn},write(){}},$n={name:`zero`,singleton:!0,init(){return{major:1,minor:5}},read(e,t,n,r){t.fill(0,n,r)},write(){}},er={name:`full`,singleton:!0,init(){return{major:1,minor:7}},read(e,t,n,r){t.fill(0,n,r)},write(){throw N(`ENOSPC`)}},tr={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(){}},nr={name:`console`,singleton:!0,init(e,{output:t=e=>console.log(e)}={}){return{major:5,minor:1,data:{output:t}}},read(){return Zn},write(e,t,n){let r=w(t);e.data.output(r,n)}},rr={null:Qn,zero:$n,full:er,random:tr,console:nr},ir=n((e=>{e.byteLength=c,e.toByteArray=u,e.fromByteArray=p;for(var t=[],n=[],r=typeof Uint8Array<`u`?Uint8Array:Array,i=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,a=0,o=i.length;a<o;++a)t[a]=i[a],n[i.charCodeAt(a)]=a;n[45]=62,n[95]=63;function s(e){var t=e.length;if(t%4>0)throw Error(`Invalid string. Length must be a multiple of 4`);var n=e.indexOf(`=`);n===-1&&(n=t);var r=n===t?0:4-n%4;return[n,r]}function c(e){var t=s(e),n=t[0],r=t[1];return(n+r)*3/4-r}function l(e,t,n){return(t+n)*3/4-n}function u(e){var t,i=s(e),a=i[0],o=i[1],c=new r(l(e,a,o)),u=0,d=o>0?a-4:a,f;for(f=0;f<d;f+=4)t=n[e.charCodeAt(f)]<<18|n[e.charCodeAt(f+1)]<<12|n[e.charCodeAt(f+2)]<<6|n[e.charCodeAt(f+3)],c[u++]=t>>16&255,c[u++]=t>>8&255,c[u++]=t&255;return o===2&&(t=n[e.charCodeAt(f)]<<2|n[e.charCodeAt(f+1)]>>4,c[u++]=t&255),o===1&&(t=n[e.charCodeAt(f)]<<10|n[e.charCodeAt(f+1)]<<4|n[e.charCodeAt(f+2)]>>2,c[u++]=t>>8&255,c[u++]=t&255),c}function d(e){return t[e>>18&63]+t[e>>12&63]+t[e>>6&63]+t[e&63]}function f(e,t,n){for(var r,i=[],a=t;a<n;a+=3)r=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(e[a+2]&255),i.push(d(r));return i.join(``)}function p(e){for(var n,r=e.length,i=r%3,a=[],o=16383,s=0,c=r-i;s<c;s+=o)a.push(f(e,s,s+o>c?c:s+o));return i===1?(n=e[r-1],a.push(t[n>>2]+t[n<<4&63]+`==`)):i===2&&(n=(e[r-2]<<8)+e[r-1],a.push(t[n>>10]+t[n>>4&63]+t[n<<2&63]+`=`)),a.join(``)}})),ar=n((e=>{e.read=function(e,t,n,r,i){var a,o,s=i*8-r-1,c=(1<<s)-1,l=c>>1,u=-7,d=n?i-1:0,f=n?-1:1,p=e[t+d];for(d+=f,a=p&(1<<-u)-1,p>>=-u,u+=s;u>0;a=a*256+e[t+d],d+=f,u-=8);for(o=a&(1<<-u)-1,a>>=-u,u+=r;u>0;o=o*256+e[t+d],d+=f,u-=8);if(a===0)a=1-l;else if(a===c)return o?NaN:(p?-1:1)*(1/0);else o+=2**r,a-=l;return(p?-1:1)*o*2**(a-r)},e.write=function(e,t,n,r,i,a){var o,s,c,l=a*8-i-1,u=(1<<l)-1,d=u>>1,f=i===23?2**-24-2**-77:0,p=r?0:a-1,m=r?1:-1,h=+(t<0||t===0&&1/t<0);for(t=Math.abs(t),isNaN(t)||t===1/0?(s=+!!isNaN(t),o=u):(o=Math.floor(Math.log(t)/Math.LN2),t*(c=2**-o)<1&&(o--,c*=2),o+d>=1?t+=f/c:t+=f*2**(1-d),t*c>=2&&(o++,c/=2),o+d>=u?(s=0,o=u):o+d>=1?(s=(t*c-1)*2**i,o+=d):(s=t*2**(d-1)*2**i,o=0));i>=8;e[n+p]=s&255,p+=m,s/=256,i-=8);for(o=o<<i|s,l+=i;l>0;e[n+p]=o&255,p+=m,o/=256,l-=8);e[n+p-m]|=h*128}})),or=n((e=>{var t=ir(),n=ar(),r=typeof Symbol==`function`&&typeof Symbol.for==`function`?Symbol.for(`nodejs.util.inspect.custom`):null;e.Buffer=s,e.SlowBuffer=v,e.INSPECT_MAX_BYTES=50;var i=2147483647;e.kMaxLength=i,s.TYPED_ARRAY_SUPPORT=a(),!s.TYPED_ARRAY_SUPPORT&&typeof console<`u`&&typeof console.error==`function`&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function a(){try{let e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),e.foo()===42}catch{return!1}}Object.defineProperty(s.prototype,"parent",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.buffer}}),Object.defineProperty(s.prototype,"offset",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.byteOffset}});function o(e){if(e>i)throw RangeError(`The value "`+e+`" is invalid for option "size"`);let t=new Uint8Array(e);return Object.setPrototypeOf(t,s.prototype),t}function s(e,t,n){if(typeof e==`number`){if(typeof t==`string`)throw TypeError(`The "string" argument must be of type string. Received type number`);return d(e)}return c(e,t,n)}s.poolSize=8192;function c(e,t,n){if(typeof e==`string`)return f(e,t);if(ArrayBuffer.isView(e))return m(e);if(e==null)throw TypeError(`The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type `+typeof e);if(B(e,ArrayBuffer)||e&&B(e.buffer,ArrayBuffer)||typeof SharedArrayBuffer<`u`&&(B(e,SharedArrayBuffer)||e&&B(e.buffer,SharedArrayBuffer)))return h(e,t,n);if(typeof e==`number`)throw TypeError(`The "value" argument must not be of type number. Received type number`);let r=e.valueOf&&e.valueOf();if(r!=null&&r!==e)return s.from(r,t,n);let i=g(e);if(i)return i;if(typeof Symbol<`u`&&Symbol.toPrimitive!=null&&typeof e[Symbol.toPrimitive]==`function`)return s.from(e[Symbol.toPrimitive](`string`),t,n);throw TypeError(`The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type `+typeof e)}s.from=function(e,t,n){return c(e,t,n)},Object.setPrototypeOf(s.prototype,Uint8Array.prototype),Object.setPrototypeOf(s,Uint8Array);function l(e){if(typeof e!=`number`)throw TypeError(`"size" argument must be of type number`);if(e<0)throw RangeError(`The value "`+e+`" is invalid for option "size"`)}function u(e,t,n){return l(e),e<=0||t===void 0?o(e):typeof n==`string`?o(e).fill(t,n):o(e).fill(t)}s.alloc=function(e,t,n){return u(e,t,n)};function d(e){return l(e),o(e<0?0:_(e)|0)}s.allocUnsafe=function(e){return d(e)},s.allocUnsafeSlow=function(e){return d(e)};function f(e,t){if((typeof t!=`string`||t===``)&&(t=`utf8`),!s.isEncoding(t))throw TypeError(`Unknown encoding: `+t);let n=y(e,t)|0,r=o(n),i=r.write(e,t);return i!==n&&(r=r.slice(0,i)),r}function p(e){let t=e.length<0?0:_(e.length)|0,n=o(t);for(let r=0;r<t;r+=1)n[r]=e[r]&255;return n}function m(e){if(B(e,Uint8Array)){let t=new Uint8Array(e);return h(t.buffer,t.byteOffset,t.byteLength)}return p(e)}function h(e,t,n){if(t<0||e.byteLength<t)throw RangeError(`"offset" is outside of buffer bounds`);if(e.byteLength<t+(n||0))throw RangeError(`"length" is outside of buffer bounds`);let r;return r=t===void 0&&n===void 0?new Uint8Array(e):n===void 0?new Uint8Array(e,t):new Uint8Array(e,t,n),Object.setPrototypeOf(r,s.prototype),r}function g(e){if(s.isBuffer(e)){let t=_(e.length)|0,n=o(t);return n.length===0||e.copy(n,0,0,t),n}if(e.length!==void 0)return typeof e.length!=`number`||ve(e.length)?o(0):p(e);if(e.type===`Buffer`&&Array.isArray(e.data))return p(e.data)}function _(e){if(e>=i)throw RangeError(`Attempt to allocate Buffer larger than maximum size: 0x`+i.toString(16)+` bytes`);return e|0}function v(e){return+e!=e&&(e=0),s.alloc(+e)}s.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==s.prototype},s.compare=function(e,t){if(B(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),B(t,Uint8Array)&&(t=s.from(t,t.offset,t.byteLength)),!s.isBuffer(e)||!s.isBuffer(t))throw TypeError(`The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array`);if(e===t)return 0;let n=e.length,r=t.length;for(let i=0,a=Math.min(n,r);i<a;++i)if(e[i]!==t[i]){n=e[i],r=t[i];break}return n<r?-1:+(r<n)},s.isEncoding=function(e){switch(String(e).toLowerCase()){case`hex`:case`utf8`:case`utf-8`:case`ascii`:case`latin1`:case`binary`:case`base64`:case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return!0;default:return!1}},s.concat=function(e,t){if(!Array.isArray(e))throw TypeError(`"list" argument must be an Array of Buffers`);if(e.length===0)return s.alloc(0);let n;if(t===void 0)for(t=0,n=0;n<e.length;++n)t+=e[n].length;let r=s.allocUnsafe(t),i=0;for(n=0;n<e.length;++n){let t=e[n];if(B(t,Uint8Array))i+t.length>r.length?(s.isBuffer(t)||(t=s.from(t)),t.copy(r,i)):Uint8Array.prototype.set.call(r,t,i);else if(s.isBuffer(t))t.copy(r,i);else throw TypeError(`"list" argument must be an Array of Buffers`);i+=t.length}return r};function y(e,t){if(s.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||B(e,ArrayBuffer))return e.byteLength;if(typeof e!=`string`)throw TypeError(`The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type `+typeof e);let n=e.length,r=arguments.length>2&&arguments[2]===!0;if(!r&&n===0)return 0;let i=!1;for(;;)switch(t){case`ascii`:case`latin1`:case`binary`:return n;case`utf8`:case`utf-8`:return pe(e).length;case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return n*2;case`hex`:return n>>>1;case`base64`:return ge(e).length;default:if(i)return r?-1:pe(e).length;t=(``+t).toLowerCase(),i=!0}}s.byteLength=y;function b(e,t,n){let r=!1;if((t===void 0||t<0)&&(t=0),t>this.length||((n===void 0||n>this.length)&&(n=this.length),n<=0)||(n>>>=0,t>>>=0,n<=t))return``;for(e||=`utf8`;;)switch(e){case`hex`:return P(this,t,n);case`utf8`:case`utf-8`:return k(this,t,n);case`ascii`:return M(this,t,n);case`latin1`:case`binary`:return N(this,t,n);case`base64`:return O(this,t,n);case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return te(this,t,n);default:if(r)throw TypeError(`Unknown encoding: `+e);e=(e+``).toLowerCase(),r=!0}}s.prototype._isBuffer=!0;function x(e,t,n){let r=e[t];e[t]=e[n],e[n]=r}s.prototype.swap16=function(){let e=this.length;if(e%2!=0)throw RangeError(`Buffer size must be a multiple of 16-bits`);for(let t=0;t<e;t+=2)x(this,t,t+1);return this},s.prototype.swap32=function(){let e=this.length;if(e%4!=0)throw RangeError(`Buffer size must be a multiple of 32-bits`);for(let t=0;t<e;t+=4)x(this,t,t+3),x(this,t+1,t+2);return this},s.prototype.swap64=function(){let e=this.length;if(e%8!=0)throw RangeError(`Buffer size must be a multiple of 64-bits`);for(let t=0;t<e;t+=8)x(this,t,t+7),x(this,t+1,t+6),x(this,t+2,t+5),x(this,t+3,t+4);return this},s.prototype.toString=function(){let e=this.length;return e===0?``:arguments.length===0?k(this,0,e):b.apply(this,arguments)},s.prototype.toLocaleString=s.prototype.toString,s.prototype.equals=function(e){if(!s.isBuffer(e))throw TypeError(`Argument must be a Buffer`);return this===e?!0:s.compare(this,e)===0},s.prototype.inspect=function(){let t=``,n=e.INSPECT_MAX_BYTES;return t=this.toString(`hex`,0,n).replace(/(.{2})/g,`$1 `).trim(),this.length>n&&(t+=` ... `),`<Buffer `+t+`>`},r&&(s.prototype[r]=s.prototype.inspect),s.prototype.compare=function(e,t,n,r,i){if(B(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),!s.isBuffer(e))throw TypeError(`The "target" argument must be one of type Buffer or Uint8Array. Received type `+typeof e);if(t===void 0&&(t=0),n===void 0&&(n=e?e.length:0),r===void 0&&(r=0),i===void 0&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw RangeError(`out of range index`);if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(t>>>=0,n>>>=0,r>>>=0,i>>>=0,this===e)return 0;let a=i-r,o=n-t,c=Math.min(a,o),l=this.slice(r,i),u=e.slice(t,n);for(let e=0;e<c;++e)if(l[e]!==u[e]){a=l[e],o=u[e];break}return a<o?-1:+(o<a)};function S(e,t,n,r,i){if(e.length===0)return-1;if(typeof n==`string`?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,ve(n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0)if(i)n=0;else return-1;if(typeof t==`string`&&(t=s.from(t,r)),s.isBuffer(t))return t.length===0?-1:C(e,t,n,r,i);if(typeof t==`number`)return t&=255,typeof Uint8Array.prototype.indexOf==`function`?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):C(e,[t],n,r,i);throw TypeError(`val must be string, number or Buffer`)}function C(e,t,n,r,i){let a=1,o=e.length,s=t.length;if(r!==void 0&&(r=String(r).toLowerCase(),r===`ucs2`||r===`ucs-2`||r===`utf16le`||r===`utf-16le`)){if(e.length<2||t.length<2)return-1;a=2,o/=2,s/=2,n/=2}function c(e,t){return a===1?e[t]:e.readUInt16BE(t*a)}let l;if(i){let r=-1;for(l=n;l<o;l++)if(c(e,l)===c(t,r===-1?0:l-r)){if(r===-1&&(r=l),l-r+1===s)return r*a}else r!==-1&&(l-=l-r),r=-1}else for(n+s>o&&(n=o-s),l=n;l>=0;l--){let n=!0;for(let r=0;r<s;r++)if(c(e,l+r)!==c(t,r)){n=!1;break}if(n)return l}return-1}s.prototype.includes=function(e,t,n){return this.indexOf(e,t,n)!==-1},s.prototype.indexOf=function(e,t,n){return S(this,e,t,n,!0)},s.prototype.lastIndexOf=function(e,t,n){return S(this,e,t,n,!1)};function w(e,t,n,r){n=Number(n)||0;let i=e.length-n;r?(r=Number(r),r>i&&(r=i)):r=i;let a=t.length;r>a/2&&(r=a/2);let o;for(o=0;o<r;++o){let r=parseInt(t.substr(o*2,2),16);if(ve(r))return o;e[n+o]=r}return o}function T(e,t,n,r){return _e(pe(t,e.length-n),e,n,r)}function ee(e,t,n,r){return _e(me(t),e,n,r)}function E(e,t,n,r){return _e(ge(t),e,n,r)}function D(e,t,n,r){return _e(he(t,e.length-n),e,n,r)}s.prototype.write=function(e,t,n,r){if(t===void 0)r=`utf8`,n=this.length,t=0;else if(n===void 0&&typeof t==`string`)r=t,n=this.length,t=0;else if(isFinite(t))t>>>=0,isFinite(n)?(n>>>=0,r===void 0&&(r=`utf8`)):(r=n,n=void 0);else throw Error(`Buffer.write(string, encoding, offset[, length]) is no longer supported`);let i=this.length-t;if((n===void 0||n>i)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw RangeError(`Attempt to write outside buffer bounds`);r||=`utf8`;let a=!1;for(;;)switch(r){case`hex`:return w(this,e,t,n);case`utf8`:case`utf-8`:return T(this,e,t,n);case`ascii`:case`latin1`:case`binary`:return ee(this,e,t,n);case`base64`:return E(this,e,t,n);case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return D(this,e,t,n);default:if(a)throw TypeError(`Unknown encoding: `+r);r=(``+r).toLowerCase(),a=!0}},s.prototype.toJSON=function(){return{type:`Buffer`,data:Array.prototype.slice.call(this._arr||this,0)}};function O(e,n,r){return n===0&&r===e.length?t.fromByteArray(e):t.fromByteArray(e.slice(n,r))}function k(e,t,n){n=Math.min(e.length,n);let r=[],i=t;for(;i<n;){let t=e[i],a=null,o=t>239?4:t>223?3:t>191?2:1;if(i+o<=n){let n,r,s,c;switch(o){case 1:t<128&&(a=t);break;case 2:n=e[i+1],(n&192)==128&&(c=(t&31)<<6|n&63,c>127&&(a=c));break;case 3:n=e[i+1],r=e[i+2],(n&192)==128&&(r&192)==128&&(c=(t&15)<<12|(n&63)<<6|r&63,c>2047&&(c<55296||c>57343)&&(a=c));break;case 4:n=e[i+1],r=e[i+2],s=e[i+3],(n&192)==128&&(r&192)==128&&(s&192)==128&&(c=(t&15)<<18|(n&63)<<12|(r&63)<<6|s&63,c>65535&&c<1114112&&(a=c))}}a===null?(a=65533,o=1):a>65535&&(a-=65536,r.push(a>>>10&1023|55296),a=56320|a&1023),r.push(a),i+=o}return j(r)}var A=4096;function j(e){let t=e.length;if(t<=A)return String.fromCharCode.apply(String,e);let n=``,r=0;for(;r<t;)n+=String.fromCharCode.apply(String,e.slice(r,r+=A));return n}function M(e,t,n){let r=``;n=Math.min(e.length,n);for(let i=t;i<n;++i)r+=String.fromCharCode(e[i]&127);return r}function N(e,t,n){let r=``;n=Math.min(e.length,n);for(let i=t;i<n;++i)r+=String.fromCharCode(e[i]);return r}function P(e,t,n){let r=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>r)&&(n=r);let i=``;for(let r=t;r<n;++r)i+=V[e[r]];return i}function te(e,t,n){let r=e.slice(t,n),i=``;for(let e=0;e<r.length-1;e+=2)i+=String.fromCharCode(r[e]+r[e+1]*256);return i}s.prototype.slice=function(e,t){let n=this.length;e=~~e,t=t===void 0?n:~~t,e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),t<0?(t+=n,t<0&&(t=0)):t>n&&(t=n),t<e&&(t=e);let r=this.subarray(e,t);return Object.setPrototypeOf(r,s.prototype),r};function F(e,t,n){if(e%1!=0||e<0)throw RangeError(`offset is not uint`);if(e+t>n)throw RangeError(`Trying to access beyond buffer length`)}s.prototype.readUintLE=s.prototype.readUIntLE=function(e,t,n){e>>>=0,t>>>=0,n||F(e,t,this.length);let r=this[e],i=1,a=0;for(;++a<t&&(i*=256);)r+=this[e+a]*i;return r},s.prototype.readUintBE=s.prototype.readUIntBE=function(e,t,n){e>>>=0,t>>>=0,n||F(e,t,this.length);let r=this[e+--t],i=1;for(;t>0&&(i*=256);)r+=this[e+--t]*i;return r},s.prototype.readUint8=s.prototype.readUInt8=function(e,t){return e>>>=0,t||F(e,1,this.length),this[e]},s.prototype.readUint16LE=s.prototype.readUInt16LE=function(e,t){return e>>>=0,t||F(e,2,this.length),this[e]|this[e+1]<<8},s.prototype.readUint16BE=s.prototype.readUInt16BE=function(e,t){return e>>>=0,t||F(e,2,this.length),this[e]<<8|this[e+1]},s.prototype.readUint32LE=s.prototype.readUInt32LE=function(e,t){return e>>>=0,t||F(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216},s.prototype.readUint32BE=s.prototype.readUInt32BE=function(e,t){return e>>>=0,t||F(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])},s.prototype.readBigUInt64LE=ye(function(e){e>>>=0,le(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&ue(e,this.length-8);let r=t+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24,i=this[++e]+this[++e]*2**8+this[++e]*2**16+n*2**24;return BigInt(r)+(BigInt(i)<<BigInt(32))}),s.prototype.readBigUInt64BE=ye(function(e){e>>>=0,le(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&ue(e,this.length-8);let r=t*2**24+this[++e]*2**16+this[++e]*2**8+this[++e],i=this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+n;return(BigInt(r)<<BigInt(32))+BigInt(i)}),s.prototype.readIntLE=function(e,t,n){e>>>=0,t>>>=0,n||F(e,t,this.length);let r=this[e],i=1,a=0;for(;++a<t&&(i*=256);)r+=this[e+a]*i;return i*=128,r>=i&&(r-=2**(8*t)),r},s.prototype.readIntBE=function(e,t,n){e>>>=0,t>>>=0,n||F(e,t,this.length);let r=t,i=1,a=this[e+--r];for(;r>0&&(i*=256);)a+=this[e+--r]*i;return i*=128,a>=i&&(a-=2**(8*t)),a},s.prototype.readInt8=function(e,t){return e>>>=0,t||F(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]},s.prototype.readInt16LE=function(e,t){e>>>=0,t||F(e,2,this.length);let n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n},s.prototype.readInt16BE=function(e,t){e>>>=0,t||F(e,2,this.length);let n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n},s.prototype.readInt32LE=function(e,t){return e>>>=0,t||F(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},s.prototype.readInt32BE=function(e,t){return e>>>=0,t||F(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},s.prototype.readBigInt64LE=ye(function(e){e>>>=0,le(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&ue(e,this.length-8);let r=this[e+4]+this[e+5]*2**8+this[e+6]*2**16+(n<<24);return(BigInt(r)<<BigInt(32))+BigInt(t+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24)}),s.prototype.readBigInt64BE=ye(function(e){e>>>=0,le(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&ue(e,this.length-8);let r=(t<<24)+this[++e]*2**16+this[++e]*2**8+this[++e];return(BigInt(r)<<BigInt(32))+BigInt(this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+n)}),s.prototype.readFloatLE=function(e,t){return e>>>=0,t||F(e,4,this.length),n.read(this,e,!0,23,4)},s.prototype.readFloatBE=function(e,t){return e>>>=0,t||F(e,4,this.length),n.read(this,e,!1,23,4)},s.prototype.readDoubleLE=function(e,t){return e>>>=0,t||F(e,8,this.length),n.read(this,e,!0,52,8)},s.prototype.readDoubleBE=function(e,t){return e>>>=0,t||F(e,8,this.length),n.read(this,e,!1,52,8)};function I(e,t,n,r,i,a){if(!s.isBuffer(e))throw TypeError(`"buffer" argument must be a Buffer instance`);if(t>i||t<a)throw RangeError(`"value" argument is out of bounds`);if(n+r>e.length)throw RangeError(`Index out of range`)}s.prototype.writeUintLE=s.prototype.writeUIntLE=function(e,t,n,r){if(e=+e,t>>>=0,n>>>=0,!r){let r=2**(8*n)-1;I(this,e,t,n,r,0)}let i=1,a=0;for(this[t]=e&255;++a<n&&(i*=256);)this[t+a]=e/i&255;return t+n},s.prototype.writeUintBE=s.prototype.writeUIntBE=function(e,t,n,r){if(e=+e,t>>>=0,n>>>=0,!r){let r=2**(8*n)-1;I(this,e,t,n,r,0)}let i=n-1,a=1;for(this[t+i]=e&255;--i>=0&&(a*=256);)this[t+i]=e/a&255;return t+n},s.prototype.writeUint8=s.prototype.writeUInt8=function(e,t,n){return e=+e,t>>>=0,n||I(this,e,t,1,255,0),this[t]=e&255,t+1},s.prototype.writeUint16LE=s.prototype.writeUInt16LE=function(e,t,n){return e=+e,t>>>=0,n||I(this,e,t,2,65535,0),this[t]=e&255,this[t+1]=e>>>8,t+2},s.prototype.writeUint16BE=s.prototype.writeUInt16BE=function(e,t,n){return e=+e,t>>>=0,n||I(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=e&255,t+2},s.prototype.writeUint32LE=s.prototype.writeUInt32LE=function(e,t,n){return e=+e,t>>>=0,n||I(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=e&255,t+4},s.prototype.writeUint32BE=s.prototype.writeUInt32BE=function(e,t,n){return e=+e,t>>>=0,n||I(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4};function ne(e,t,n,r,i){ce(t,r,i,e,n,7);let a=Number(t&BigInt(4294967295));e[n++]=a,a>>=8,e[n++]=a,a>>=8,e[n++]=a,a>>=8,e[n++]=a;let o=Number(t>>BigInt(32)&BigInt(4294967295));return e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o,n}function re(e,t,n,r,i){ce(t,r,i,e,n,7);let a=Number(t&BigInt(4294967295));e[n+7]=a,a>>=8,e[n+6]=a,a>>=8,e[n+5]=a,a>>=8,e[n+4]=a;let o=Number(t>>BigInt(32)&BigInt(4294967295));return e[n+3]=o,o>>=8,e[n+2]=o,o>>=8,e[n+1]=o,o>>=8,e[n]=o,n+8}s.prototype.writeBigUInt64LE=ye(function(e,t=0){return ne(this,e,t,BigInt(0),BigInt(`0xffffffffffffffff`))}),s.prototype.writeBigUInt64BE=ye(function(e,t=0){return re(this,e,t,BigInt(0),BigInt(`0xffffffffffffffff`))}),s.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t>>>=0,!r){let r=2**(8*n-1);I(this,e,t,n,r-1,-r)}let i=0,a=1,o=0;for(this[t]=e&255;++i<n&&(a*=256);)e<0&&o===0&&this[t+i-1]!==0&&(o=1),this[t+i]=(e/a>>0)-o&255;return t+n},s.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t>>>=0,!r){let r=2**(8*n-1);I(this,e,t,n,r-1,-r)}let i=n-1,a=1,o=0;for(this[t+i]=e&255;--i>=0&&(a*=256);)e<0&&o===0&&this[t+i+1]!==0&&(o=1),this[t+i]=(e/a>>0)-o&255;return t+n},s.prototype.writeInt8=function(e,t,n){return e=+e,t>>>=0,n||I(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=e&255,t+1},s.prototype.writeInt16LE=function(e,t,n){return e=+e,t>>>=0,n||I(this,e,t,2,32767,-32768),this[t]=e&255,this[t+1]=e>>>8,t+2},s.prototype.writeInt16BE=function(e,t,n){return e=+e,t>>>=0,n||I(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=e&255,t+2},s.prototype.writeInt32LE=function(e,t,n){return e=+e,t>>>=0,n||I(this,e,t,4,2147483647,-2147483648),this[t]=e&255,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},s.prototype.writeInt32BE=function(e,t,n){return e=+e,t>>>=0,n||I(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4},s.prototype.writeBigInt64LE=ye(function(e,t=0){return ne(this,e,t,-BigInt(`0x8000000000000000`),BigInt(`0x7fffffffffffffff`))}),s.prototype.writeBigInt64BE=ye(function(e,t=0){return re(this,e,t,-BigInt(`0x8000000000000000`),BigInt(`0x7fffffffffffffff`))});function ie(e,t,n,r,i,a){if(n+r>e.length||n<0)throw RangeError(`Index out of range`)}function ae(e,t,r,i,a){return t=+t,r>>>=0,a||ie(e,t,r,4,34028234663852886e22,-34028234663852886e22),n.write(e,t,r,i,23,4),r+4}s.prototype.writeFloatLE=function(e,t,n){return ae(this,e,t,!0,n)},s.prototype.writeFloatBE=function(e,t,n){return ae(this,e,t,!1,n)};function oe(e,t,r,i,a){return t=+t,r>>>=0,a||ie(e,t,r,8,17976931348623157e292,-17976931348623157e292),n.write(e,t,r,i,52,8),r+8}s.prototype.writeDoubleLE=function(e,t,n){return oe(this,e,t,!0,n)},s.prototype.writeDoubleBE=function(e,t,n){return oe(this,e,t,!1,n)},s.prototype.copy=function(e,t,n,r){if(!s.isBuffer(e))throw TypeError(`argument should be a Buffer`);if(n||=0,!r&&r!==0&&(r=this.length),t>=e.length&&(t=e.length),t||=0,r>0&&r<n&&(r=n),r===n||e.length===0||this.length===0)return 0;if(t<0)throw RangeError(`targetStart out of bounds`);if(n<0||n>=this.length)throw RangeError(`Index out of range`);if(r<0)throw RangeError(`sourceEnd out of bounds`);r>this.length&&(r=this.length),e.length-t<r-n&&(r=e.length-t+n);let i=r-n;return this===e&&typeof Uint8Array.prototype.copyWithin==`function`?this.copyWithin(t,n,r):Uint8Array.prototype.set.call(e,this.subarray(n,r),t),i},s.prototype.fill=function(e,t,n,r){if(typeof e==`string`){if(typeof t==`string`?(r=t,t=0,n=this.length):typeof n==`string`&&(r=n,n=this.length),r!==void 0&&typeof r!=`string`)throw TypeError(`encoding must be a string`);if(typeof r==`string`&&!s.isEncoding(r))throw TypeError(`Unknown encoding: `+r);if(e.length===1){let t=e.charCodeAt(0);(r===`utf8`&&t<128||r===`latin1`)&&(e=t)}}else typeof e==`number`?e&=255:typeof e==`boolean`&&(e=Number(e));if(t<0||this.length<t||this.length<n)throw RangeError(`Out of range index`);if(n<=t)return this;t>>>=0,n=n===void 0?this.length:n>>>0,e||=0;let i;if(typeof e==`number`)for(i=t;i<n;++i)this[i]=e;else{let a=s.isBuffer(e)?e:s.from(e,r),o=a.length;if(o===0)throw TypeError(`The value "`+e+`" is invalid for argument "value"`);for(i=0;i<n-t;++i)this[i+t]=a[i%o]}return this};var se={};function L(e,t,n){se[e]=class extends n{constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name}get code(){return e}set code(e){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:e,writable:!0})}toString(){return`${this.name} [${e}]: ${this.message}`}}}L(`ERR_BUFFER_OUT_OF_BOUNDS`,function(e){return e?`${e} is outside of buffer bounds`:`Attempt to access memory outside buffer bounds`},RangeError),L(`ERR_INVALID_ARG_TYPE`,function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`},TypeError),L(`ERR_OUT_OF_RANGE`,function(e,t,n){let r=`The value of "${e}" is out of range.`,i=n;return Number.isInteger(n)&&Math.abs(n)>2**32?i=R(String(n)):typeof n==`bigint`&&(i=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(i=R(i)),i+=`n`),r+=` It must be ${t}. Received ${i}`,r},RangeError);function R(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 z(e,t,n){le(t,`offset`),(e[t]===void 0||e[t+n]===void 0)&&ue(t,e.length-(n+1))}function ce(e,t,n,r,i,a){if(e>n||e<t){let r=typeof t==`bigint`?`n`:``,i;throw i=a>3?t===0||t===BigInt(0)?`>= 0${r} and < 2${r} ** ${(a+1)*8}${r}`:`>= -(2${r} ** ${(a+1)*8-1}${r}) and < 2 ** ${(a+1)*8-1}${r}`:`>= ${t}${r} and <= ${n}${r}`,new se.ERR_OUT_OF_RANGE(`value`,i,e)}z(r,i,a)}function le(e,t){if(typeof e!=`number`)throw new se.ERR_INVALID_ARG_TYPE(t,`number`,e)}function ue(e,t,n){throw Math.floor(e)===e?t<0?new se.ERR_BUFFER_OUT_OF_BOUNDS:new se.ERR_OUT_OF_RANGE(n||`offset`,`>= ${+!!n} and <= ${t}`,e):(le(e,n),new se.ERR_OUT_OF_RANGE(n||`offset`,`an integer`,e))}var de=/[^+/0-9A-Za-z-_]/g;function fe(e){if(e=e.split(`=`)[0],e=e.trim().replace(de,``),e.length<2)return``;for(;e.length%4!=0;)e+=`=`;return e}function pe(e,t){t||=1/0;let n,r=e.length,i=null,a=[];for(let o=0;o<r;++o){if(n=e.charCodeAt(o),n>55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&a.push(239,191,189);continue}else if(o+1===r){(t-=3)>-1&&a.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&a.push(239,191,189),i=n;continue}n=(i-55296<<10|n-56320)+65536}else i&&(t-=3)>-1&&a.push(239,191,189);if(i=null,n<128){if(--t<0)break;a.push(n)}else if(n<2048){if((t-=2)<0)break;a.push(n>>6|192,n&63|128)}else if(n<65536){if((t-=3)<0)break;a.push(n>>12|224,n>>6&63|128,n&63|128)}else if(n<1114112){if((t-=4)<0)break;a.push(n>>18|240,n>>12&63|128,n>>6&63|128,n&63|128)}else throw Error(`Invalid code point`)}return a}function me(e){let t=[];for(let n=0;n<e.length;++n)t.push(e.charCodeAt(n)&255);return t}function he(e,t){let n,r,i,a=[];for(let o=0;o<e.length&&!((t-=2)<0);++o)n=e.charCodeAt(o),r=n>>8,i=n%256,a.push(i),a.push(r);return a}function ge(e){return t.toByteArray(fe(e))}function _e(e,t,n,r){let i;for(i=0;i<r&&!(i+n>=t.length||i>=e.length);++i)t[i+n]=e[i];return i}function B(e,t){return e instanceof t||e!=null&&e.constructor!=null&&e.constructor.name!=null&&e.constructor.name===t.name}function ve(e){return e!==e}var V=(function(){let e=`0123456789abcdef`,t=Array(256);for(let n=0;n<16;++n){let r=n*16;for(let i=0;i<16;++i)t[r+i]=e[n]+e[i]}return t})();function ye(e){return typeof BigInt>`u`?be:e}function be(){throw Error(`BigInt not supported`)}})),sr=or(),X=!0;function cr(e){X=e}var lr;(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`})(lr||={});function ur(e){return(e&61440)>>12}function dr(e){return e<<12}var fr=class{ino;type;path;name},pr=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&Tn.Sync||this.fs.attributes.has(`sync`))}[Symbol.dispose](){this.closeSync()}syncSync(){if(this.closed)throw M(`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 M(`EBADF`,`close`,this.path);this.syncSync(),this.disposeSync()}disposeSync(e){if(this.closed)throw M(`EBADF`,`close`,this.path);if(this.dirty&&!e)throw M(`EBUSY`,`close`,this.path);this.closed=!0}truncateSync(e){if(e<0)throw M(`EINVAL`,`truncate`,this.path);if(this.closed||!(this.flag&1||this.flag&2))throw M(`EBADF`,`truncate`,this.path);if(this.fs.attributes.has(`readonly`))throw M(`EROFS`,`truncate`,this.path);if(this.inode.flags&Tn.Immutable)throw M(`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 M(`EBADF`,`write`,this.path);if(this.fs.attributes.has(`readonly`))throw M(`EROFS`,`write`,this.path);if(this.inode.flags&Tn.Immutable)throw M(`EPERM`,`write`,this.path);this.dirty=!0;let i=r+n,a=e.subarray(t,t+n);return!Nn(this.inode)&&!Mn(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 M(`EBADF`,`read`,this.path);!(this.inode.flags&Tn.NoAtime)&&!this.fs.attributes.has(`no_atime`)&&(this.dirty=!0,this.inode.atimeMs=Date.now());let i=r+n;!Nn(this.inode)&&!Mn(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 M(`EBADF`,`chmod`,this.path);this.dirty=!0,this.inode.mode=this.inode.mode&(e>61440?~Ge:Ge)|e,(this._isSync||e>61440)&&this.syncSync()}chownSync(e,t){if(this.closed)throw M(`EBADF`,`chmod`,this.path);this.dirty=!0,Fn(this.inode,e,t),this._isSync&&this.syncSync()}utimesSync(e,t){if(this.closed)throw M(`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 M(`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 M(`EBADF`,`close`,this.path);await this.sync(),this.dispose()}dispose(e){if(this.closed)throw M(`EBADF`,`close`,this.path);if(this.dirty&&!e)throw M(`EBUSY`,`close`,this.path);this.closed=!0}stat(){if(this.closed)throw M(`EBADF`,`stat`,this.path);return this.inode}async truncate(e){if(e<0)throw M(`EINVAL`,`truncate`,this.path);if(this.closed||!(this.flag&1||this.flag&2))throw M(`EBADF`,`truncate`,this.path);if(this.fs.attributes.has(`readonly`))throw M(`EROFS`,`truncate`,this.path);if(this.inode.flags&Tn.Immutable)throw M(`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 M(`EBADF`,`write`,this.path);if(this.fs.attributes.has(`readonly`))throw M(`EROFS`,`write`,this.path);if(this.inode.flags&Tn.Immutable)throw M(`EPERM`,`write`,this.path);this.dirty=!0;let i=r+n,a=e.subarray(t,t+n);return!Nn(this.inode)&&!Mn(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 M(`EBADF`,`read`,this.path);!(this.inode.flags&Tn.NoAtime)&&!this.fs.attributes.has(`no_atime`)&&(this.dirty=!0,this.inode.atimeMs=Date.now());let i=r+n;!Nn(this.inode)&&!Mn(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 M(`EBADF`,`chmod`,this.path);this.dirty=!0,this.inode.mode=this.inode.mode&(e>61440?~Ge:Ge)|e,(this._isSync||e>61440)&&await this.sync()}async chown(e,t){if(this.closed)throw M(`EBADF`,`chown`,this.path);this.dirty=!0,Fn(this.inode,e,t),this._isSync&&await this.sync()}async utimes(e,t){if(this.closed)throw M(`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 M(`EBADF`,`streamRead`,this.path);return this.fs.streamRead(this.internalPath,e)}streamWrite(e){if(this.closed)throw M(`EBADF`,`write`,this.path);if(this.inode.flags&Tn.Immutable)throw M(`EPERM`,`write`,this.path);if(this.fs.attributes.has(`readonly`))throw M(`EROFS`,`write`,this.path);return this.fs.streamWrite(this.internalPath,e)}};function mr(e){let t=Me(e.context).descriptors,n=Math.max(t.size?Math.max(...t.keys())+1:0,4);return t.set(n,e),n}function hr(e,t){let n=Me(e).descriptors.get(t);if(!n)throw N(`EBADF`);return n}function gr(e,t){return Me(e).descriptors.delete(t)}var _r=/[rwasx]{1,2}\+?/;function vr(e){if(typeof e==`number`)return e;if(!_r.test(e))throw N(`EINVAL`,`Invalid flag string: `+e);return yr(e)}function yr(e){if(!e.includes(`r`)&&!e.includes(`w`)&&!e.includes(`a`))throw N(`EINVAL`,`Invalid flag string: `+e);let t=e.includes(`r`)?0:64;return e.includes(`w`)&&(t|=512),e.includes(`a`)&&(t|=Ie),e.includes(`+`)?t|=2:e.includes(`r`)||(t|=1),e.includes(`s`)&&(t|=Be),e.includes(`x`)&&(t|=128),t}function br(e){let t=0;return e&1||(t|=4),(e&1||e&2)&&(t|=2),t}var xr=j;function Sr(e,t){return e.path=t,e}function Cr(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 A(Object.assign(e,i))}}}function wr(e,t){return new Proxy(e,{get(e,n){let r=Reflect.get(e,n);return typeof r==`function`?function n(...i){try{let a=r.apply(e,i);return a instanceof Promise?a.catch(e=>{if(`code`in e)throw A(Object.assign(e,t));if(e in O){let r=M(e,t);Error.captureStackTrace(r,n)}throw e}):a}catch(e){throw A(Object.assign(e,t))}}:r}})}var Tr=new Map;Er(`/`,Yn.create({label:`root`}));function Er(e,t){if(e[0]!=`/`&&(e=`/`+e),e=rn.call(this,e),Tr.has(e))throw R(N(`EINVAL`,`Mount point is already in use: `+e));t._mountPoint=e,Tr.set(e,t),le(`Mounted ${t.name} on ${e}`),ue(`${t.name} attributes: ${[...t.attributes].map(([e,t])=>t==null?e:e+`=`+t).join(`, `)}`)}function Dr(e){if(e[0]!=`/`&&(e=`/`+e),e=rn.call(this,e),!Tr.has(e)){z(e+` is already unmounted`);return}Tr.delete(e),ce(`Unmounted `+e)}function Or(e,t,n){let{root:r}=Me(t),i={path:e,...n};e=W(G(r,e),!0),e=rn.call(t,e);let a=[...Tr].sort((e,t)=>e[0].length>t[0].length?-1:1);for(let[t,n]of a){if(!jr(t,e))continue;e=e.slice(t.length>1?t.length:0),e===``&&(e=`/`);let a=n.attributes.get(`case_fold`);return a===`lower`&&(e=e.toLowerCase()),a===`upper`&&(e=e.toUpperCase()),{fs:wr(n,i),path:e,mountPoint:t,root:r}}throw se(new j(O.EIO,`No file system for `+e))}function kr(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 Ar(e){let t=Me(this);if(!ke(t.credentials))throw N(`EPERM`,`Can not chroot() as non-root user`);t.root??=`/`;let n=G(t.root,e);for(let e of t.descriptors?.values()??[]){if(!e.path.startsWith(t.root))throw M(`EBUSY`,`chroot`,e.path);e.path=e.path.slice(t.root.length)}if(n.length>t.root.length)throw N(`EPERM`,`Can not chroot() outside of current root`);t.root=n}function jr(e,t){return e===`/`||e===t?!0:(e.endsWith(`/`)||(e+=`/`),t.startsWith(e))}var Mr=e({link:()=>zr,mkdir:()=>Ir,open:()=>Pr,readdir:()=>Lr,readlink:()=>Fr,rename:()=>Rr,resolve:()=>Nr,stat:()=>Br});function Nr(e,t,n,r){t=rn.call(e,t);try{let i=Or(t,e),a=i.fs.statSync(i.path);return!An(a)||n?{...i,fullPath:t,stats:a}:Nr(e,rn.call(e,K(t),Fr.call(e,t)),n,r)}catch(e){if(A(Object.assign(e,{syscall:`stat`,path:t,...r})),n)throw e}let{base:i,dir:a}=dn(t),o=a==`/`?`/`:Nr(e,a,!1,r).fullPath,s=G(o,i),c=Or(s,e),l;try{l=c.fs.statSync(c.path)}catch(e){if(e.code===`ENOENT`)return{...c,fullPath:t};throw A(Object.assign(e,{syscall:`stat`,path:s,...r}))}return An(l)?Nr(e,rn.call(e,o,Fr.call(e,s)),!1,r):{...c,fullPath:s,stats:l}}function Pr(e,t){e=W(e);let n=qt(t.mode,420),r=vr(t.flag);e=t.preserveSymlinks?e:Nr(this,e).fullPath;let{fs:i,path:a}=Or(e,this),o;try{o=i.statSync(a)}catch{}if(!o){if(!(r&64))throw M(`ENOENT`,`open`,e);let o=i.statSync(K(a));if(X&&!Y(this,o,2))throw M(`EACCES`,`open`,e);if(!kn(o))throw M(`ENOTDIR`,`open`,e);if(!t.allowDirectory&&n&16384)throw M(`EISDIR`,`open`,e);if(X&&!Y(this,o,2))throw M(`EACCES`,`open`,e);let{euid:s,egid:c}=Me(this).credentials,l=i.createFileSync(a,{mode:n,uid:o.mode&2048?o.uid:s,gid:o.mode&1024?o.gid:c});return new pr(this,e,i,a,r,l)}if(X&&(!Y(this,o,n)||!Y(this,o,br(r))))throw M(`EACCES`,`open`,e);if(r&128)throw M(`EEXIST`,`open`,e);let s=new pr(this,e,i,a,r,o);if(!t.allowDirectory&&o.mode&16384)throw M(`EISDIR`,`open`,e);return r&512&&s.truncateSync(0),s}function Fr(e){e=W(e);let{fs:t,stats:n,path:r}=Nr(this,e,!0);if(!n)throw M(`ENOENT`,`readlink`,e);if(X&&!Y(this,n,4))throw M(`EACCES`,`readlink`,e);if(!An(n))throw M(`EINVAL`,`readlink`,e);let i=n.size,a=new Uint8Array(i);return t.readSync(r,a,0,i),w(a)}function Ir(e,t={}){e=W(e);let{fs:n,path:r}=Nr(this,e),{euid:i,egid:a}=Me(this).credentials,{mode:o=511,recursive:s}=t,c=(e,t,r)=>{if(X&&!Y(this,r,2))throw M(`EACCES`,`mkdir`,K(e));let s=n.mkdirSync(t,{mode:o,uid:r.mode&2048?r.uid:i,gid:r.mode&1024?r.gid:a});return Hi(this,`rename`,e),s};if(!s){c(e,r,n.statSync(K(r)));return}let l=[];for(let t=r,i=e;!n.existsSync(t);t=K(t),i=K(i))l.unshift({resolved:t,original:i});if(!l.length)return;let u=[n.statSync(K(l[0].resolved))];for(let[e,t]of l.entries())u.push(c(t.original,t.resolved,u[e]));return l[0].original}function Lr(e,t={}){e=W(e);let{fs:n,path:r}=Nr(this,e),i=n.statSync(r);if(X&&!Y(this,i,4))throw M(`EACCES`,`readdir`,e);if(!kn(i))throw M(`ENOTDIR`,`readdir`,e);let a=n.readdirSync(r),o=[],s=e=>{let i;try{i=n.statSync(G(r,e))}catch(e){if(e.code==`ENOENT`)return;throw e}let a=new fr;if(a.ino=i.ino,a.type=ur(i.mode),a.path=e,a.name=cn(e),o.push(a),!kn(i)||!t?.recursive)return;let c=n.readdirSync(G(r,e));for(let t of c)s(G(e,t))};for(let e of a)s(e);return o}function Rr(e,t){e=W(e),t=W(t);let n={syscall:`rename`,path:e,dest:t},r=Nr(this,e,!0,n),i=Or(t,this,n);if(r.fs.uuid!==i.fs.uuid)throw M(`EXDEV`,n);if(i.path.startsWith(r.path+`/`))throw M(`EBUSY`,n);if(!r.stats)throw M(`ENOENT`,n);let a=r.fs,o=a.statSync(K(r.path)),s=a.statSync(K(i.path)),c;try{c=a.statSync(i.path)}catch(e){if(e.code!=`ENOENT`)throw e}if(X&&(!Y(this,o,4)||!Y(this,s,2)))throw M(`EACCES`,n);if(c&&!kn(r.stats)&&kn(c))throw M(`EISDIR`,n);if(c&&kn(r.stats)&&!kn(c))throw M(`ENOTDIR`,n);r.fs.renameSync(r.path,i.path),Hi(this,`rename`,e),Hi(this,`change`,t)}function zr(e,t){e=W(e),t=W(t);let n={syscall:`link`,path:t,dest:e},{fs:r,path:i}=Or(e,this,n),a=Or(t,this,n);if(r.uuid!==a.fs.uuid)throw M(`EXDEV`,n);let o=r.statSync(i);if(X){if(!Y(this,o,4))throw M(`EACCES`,n);let e=r.statSync(K(i));if(!Y(this,e,4))throw M(`EACCES`,n);let t=r.statSync(K(a.path));if(!Y(this,t,2))throw M(`EACCES`,n)}return r.linkSync(i,a.path)}function Br(e,t){e=W.call(this,e);let n={syscall:t?`lstat`:`stat`,path:e},r;if(!t)r=Nr(this,e,!1,n).stats;else{let{base:t,dir:i}=dn(e),{fs:a,path:o}=Nr(this,i,!1,n);try{r=a.statSync(t?G(o,t):o)}catch(e){throw A(Object.assign(e,n)),e}}if(!r)throw M(`ENOENT`,n);if(X&&!Y(this,r,4))throw M(`EACCES`,n);return r}var Vr=class e{ino;type;_name;get name(){let e=sr.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}=dn(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===lr.REG}isDirectory(){return this.type===lr.DIR}isBlockDevice(){return this.type===lr.BLK}isCharacterDevice(){return this.type===lr.CHR}isSymbolicLink(){return this.type===lr.LNK}isFIFO(){return this.type===lr.FIFO}isSocket(){return this.type===lr.SOCK}},Hr=class{path;context;closed=!1;checkClosed(){if(this.closed)throw N(`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 Ya.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??=mi.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()}},Ur=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},Wr=(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 Gr(e,t){return Rr.call(this,e,t)}function Kr(e){e=W(e);try{let{fs:t,path:n}=Nr(this,e);return t.existsSync(n)}catch(e){if(e.errno==O.ENOENT)return!1;throw e}}function qr(e,t){let n=Br.call(this,e,!1);return t?.bigint?new gn(n):new hn(n)}function Jr(e,t){let n=Br.call(this,e,!0);return t?.bigint?new gn(n):new hn(n)}function Yr(e,t=0){let n={stack:[],error:void 0,hasError:!1};try{let r=Ur(n,Pr.call(this,e,{flag:`r+`}),!1);if(t||=0,t<0)throw M(`EINVAL`,`truncate`,e.toString());r.truncateSync(t)}catch(e){n.error=e,n.hasError=!0}finally{Wr(n)}}function Xr(e){e=W(e);let{fs:t,path:n}=Or(e,this);try{if(X&&!Y(this,t.statSync(n),2))throw M(`EACCES`,`unlink`);t.unlinkSync(n)}catch(t){throw A(Object.assign(t,{path:e}))}Hi(this,`rename`,e.toString())}function Zr(e,t,n=0){return mr(Pr.call(this,e,{flag:t,mode:n}))}function Qr(e,t,n){return mr(Pr.call(this,e,{flag:t,mode:n,preserveSymlinks:!0}))}function $r(e,t={}){let n={stack:[],error:void 0,hasError:!1};try{let r=Yt(t,null,`r`,420);if(vr(r.flag)&1)throw M(`EBADF`,`read`,e.toString());let i=Ur(n,typeof e==`number`?hr(this,e):Pr.call(this,e.toString(),{flag:r.flag,mode:420,preserveSymlinks:!1}),!1),{size:a}=i.stat(),o=sr.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{Wr(n)}}function ei(e,t,n={}){let r={stack:[],error:void 0,hasError:!1};try{let i=Yt(n,`utf8`,`w+`,420),a=vr(i.flag);if(!(a&1||a&2))throw new j(O.EINVAL,`Flag passed to writeFile must allow for writing`);if(typeof t!=`string`&&!i.encoding)throw new j(O.EINVAL,`Encoding not specified`);let o=typeof t==`string`?sr.Buffer.from(t,i.encoding):new Uint8Array(t.buffer,t.byteOffset,t.byteLength);if(!o)throw new j(O.EINVAL,`Data not specified`);Ur(r,typeof e==`number`?hr(this,e):Pr.call(this,e.toString(),{flag:a,mode:i.mode,preserveSymlinks:!0}),!1).writeSync(o,0,o.byteLength,0),Hi(this,`change`,e.toString())}catch(e){r.error=e,r.hasError=!0}finally{Wr(r)}}function ti(e,t,n={}){let r=Yt(n,`utf8`,`a+`,420),i=vr(r.flag);if(!(i&1024))throw new j(O.EINVAL,`Flag passed to appendFile must allow for appending`);if(typeof t!=`string`&&!r.encoding)throw new j(O.EINVAL,`Encoding not specified`);let a=typeof t==`string`?sr.Buffer.from(t,r.encoding):new Uint8Array(t.buffer,t.byteOffset,t.byteLength),o=typeof e==`number`?hr(this,e):Pr.call(this,W(e),{flag:i,mode:r.mode,preserveSymlinks:!0});o.writeSync(a,0,a.byteLength),typeof o!=`number`&&o.closeSync()}function ni(e,t){let n=hr(this,e).stat();return t?.bigint?new gn(n):new hn(n)}function ri(e){hr(this,e).closeSync(),gr(this,e)}function ii(e,t=0){if(t||=0,t<0)throw new j(O.EINVAL);hr(this,e).truncateSync(t)}function ai(e){hr(this,e).syncSync()}function oi(e){hr(this,e).datasyncSync()}function si(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=sr.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=hr(this,e);c??=l.position;let u=l.writeSync(a,o,s,c);return Hi(this,`change`,l.path),u}function ci(e,t,n,r,i){let a=hr(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 M(`EINVAL`);return typeof i==`bigint`&&(i=Number(i)),i=Number.isSafeInteger(i)?i:a.position,a.readSync(t,o,r,i)}function li(e,t,n){hr(this,e).chownSync(t,n)}function ui(e,t){let n=qt(t,-1);if(n<0)throw new j(O.EINVAL,`Invalid mode.`);hr(this,e).chmodSync(n)}function di(e,t,n){hr(this,e).utimesSync(Jt(t),Jt(n))}function fi(e){e=W(e);let{fs:t,path:n}=Nr(this,e),r=Cr(t,`statSync`,e)(n);if(!kn(r))throw M(`ENOTDIR`,`rmdir`,e);if(X&&!Y(this,r,2))throw M(`EACCES`,`rmdir`,e);Cr(t,`rmdirSync`,e)(n),Hi(this,`rename`,e.toString())}function pi(e,t){t=typeof t==`object`?t:{mode:t};let n=qt(t?.mode,511);return Ir.call(this,e,{...t,mode:n})}function mi(e,t){t=typeof t==`object`?t:{encoding:t},e=W(e);let n=[],r=Lr.call(this,e,t??void 0);for(let e of r)t?.withFileTypes?n.push(Vr.from(e,t.encoding)):t?.encoding==`buffer`?n.push(sr.Buffer.from(e.path)):n.push(e.path);return n}function hi(e,t){return zr.call(this,e,t)}function gi(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=W(t);let i=Ur(r,Pr.call(this,t,{flag:`wx`,mode:420}),!1);i.writeSync(S(W(e,!0))),i.chmodSync(qe)}catch(e){r.error=e,r.hasError=!0}finally{Wr(r)}}function _i(e,t){let n=sr.Buffer.from(Fr.call(this,e)),r=typeof t==`object`?t?.encoding:t;return r==`buffer`?n:n.toString(r??`utf-8`)}function vi(e,t,n){let r={stack:[],error:void 0,hasError:!1};try{Ur(r,Pr.call(this,e,{flag:`r+`,mode:0}),!1).chownSync(t,n)}catch(e){r.error=e,r.hasError=!0}finally{Wr(r)}}function yi(e,t,n){let r=Qr.call(this,e,`r+`);li.call(this,r,t,n),ri.call(this,r)}function bi(e,t){let n=Zr.call(this,e,`r+`);ui.call(this,n,t),ri.call(this,n)}function xi(e,t){let n=Qr.call(this,e,`r+`);ui.call(this,n,t),ri.call(this,n)}function Si(e,t,n){let r=Zr.call(this,e,`r+`);di.call(this,r,t,n),ri.call(this,r)}function Ci(e,t,n){let r=Qr.call(this,e,`r+`);di.call(this,r,t,n),ri.call(this,r)}function wi(e,t){let n=typeof t==`string`?t:t?.encoding??`utf8`;e=W(e,!0);let{fullPath:r}=Nr(this,e);if(n==`utf8`||n==`utf-8`)return r;let i=sr.Buffer.from(r,`utf-8`);return n==`buffer`?i:i.toString(n)}function Ti(e,t=384){if(X&&!Y(this,qr.call(this,e),t))throw new j(O.EACCES)}function Ei(e,t){e=W(e);let n;try{n=Jr.bind(this)(e)}catch(e){if(e.code!=`ENOENT`||!t?.force)throw e}if(n)switch(n.mode&Ge){case Xe:if(t?.recursive)for(let n of mi.call(this,e))Ei.call(this,G(e,n),t);fi.call(this,e);break;case Je:case qe:case Ye:case Ze:Xr.call(this,e);break;case Qe:case Ke:default:throw M(`ENOSYS`,`rm`,e)}}function Di(e,t){let n=typeof t==`object`?t?.encoding:t||`utf8`,r=Qt(e);return pi.call(this,r),n==`buffer`?sr.Buffer.from(r):r}function Oi(e,t){let n=Qt(e);pi.call(this,n);let r=()=>Ei(n,{recursive:!0,force:!0});return{path:n,remove:r,[Symbol.dispose]:r}}function ki(e,t,n){if(e=W(e),t=W(t),n&&n&1&&Kr(t))throw M(`EEXIST`,`copyFile`,t);ei.call(this,t,$r(e)),Hi(this,`rename`,t.toString())}function Ai(e,t,n){let r=hr(this,e),i=0;for(let e of t)i+=r.readSync(e,0,e.byteLength,n+i);return i}function ji(e,t,n){let r=hr(this,e),i=0;for(let e of t)i+=r.writeSync(new Uint8Array(e.buffer),0,e.byteLength,n+i);return i}function Mi(e,t){return e=W(e),new Hr(e,this)}function Ni(e,t,n){e=W(e),t=W(t);let r=Jr.call(this,e);if(n?.errorOnExist&&Kr.call(this,t))throw M(`EEXIST`,`cp`,t);switch(r.mode&Ge){case Xe:if(!n?.recursive)throw M(`EISDIR`,`cp`,e);pi.call(this,t,{recursive:!0});for(let r of mi.call(this,e,{withFileTypes:!0}))n.filter&&!n.filter(G(e,r.name),G(t,r.name))||Ni.call(this,G(e,r.name),G(t,r.name),n);break;case Je:case qe:ki.call(this,e,t);break;case Ye:case Ze:case Qe:case Ke:default:throw M(`ENOSYS`,`cp`,e)}n?.preserveTimestamps&&Si.call(this,t,r.atime,r.mtime)}function Pi(e,t){e=W(e);let{fs:n}=Or(e,this);return kr(n,t?.bigint)}function Fi(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(Xt),l=[];function u(e){let t=mi(e,{withFileTypes:r,encoding:`utf8`});for(let n of t){let t=G(e,r?n.name:n);if(typeof i==`function`?i(r?n:t):i.some(e=>fn(e,t)))continue;let a=t.replace(/^\/+/g,``);qr(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 Ii=class extends c.default{_context;path;off(e,t,n,r){return super.off(e,t,n,r)}removeListener(e,t,n,r){return super.removeListener(e,t,n,r)}constructor(e,t){super(),this._context=e,this.path=t}setMaxListeners(){throw M(`ENOSYS`,`Watcher.setMaxListeners`)}getMaxListeners(){throw M(`ENOSYS`,`Watcher.getMaxListeners`)}prependListener(){throw M(`ENOSYS`,`Watcher.prependListener`)}prependOnceListener(){throw M(`ENOSYS`,`Watcher.prependOnceListener`)}rawListeners(){throw M(`ENOSYS`,`Watcher.rawListeners`)}ref(){return this}unref(){return this}},Li=class extends Ii{options;realpath;constructor(e,t,n){let r=Me(e);super(r,t),this.options=n,this.realpath=G(r.root,t),Bi(this.realpath,this)}close(){super.emit(`close`),Vi(this.realpath,this)}[Symbol.dispose](){this.close()}},Ri=class extends Ii{options;intervalId;previous;constructor(e,t,n){super(e,t),this.options=n,this.start()}onInterval(){try{let e=qr(this.path);_n(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=qr(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()}},zi=new Map;function Bi(e,t){let n=W(e);zi.has(n)||zi.set(n,new Set),zi.get(n).add(t)}function Vi(e,t){let n=W(e);zi.has(n)&&(zi.get(n).delete(t),zi.get(n).size===0&&zi.delete(n))}function Hi(e,t,n){let r=Me(e);r&&(n=G(r.root??`/`,n)),n=W(n);for(let e=n;e!=`/`;e=K(e)){let r=zi.get(e);if(r)for(let i of r)i.emit(`change`,t,sn.call(i._context,e,n)||cn(n))}}async function Ui(e,t,n,r){if(t=rn.call(e,t),n){let n=Or(t,e,r),i=await n.fs.stat(n.path).catch(()=>void 0);return{...n,fullPath:t,stats:i}}try{let i=Or(t,e),a=await i.fs.stat(i.path);return An(a)?await Ui(e,rn.call(e,K(t),await Gi.call(e,t)),n,r):{...i,fullPath:t,stats:a}}catch{}let{base:i,dir:a}=dn(t),o=a==`/`?`/`:(await Ui(e,a,!1,r)).fullPath,s=G(o,i),c=Or(s,e),l=await c.fs.stat(c.path).catch(e=>{if(e.code!=`ENOENT`)throw A(Object.assign(e,{syscall:`stat`,path:s,...r}))});return l?An(l)?await Ui(e,rn.call(e,o,await Gi.call(e,s)),!1,r):{...c,fullPath:s,stats:l}:{...c,fullPath:t}}async function Wi(e,t,n){t=W(t);let r=qt(n.mode,420),i=vr(n.flag),a={syscall:`open`,path:t},{fs:o,path:s,stats:c}=await Ui(e,t,n.preserveSymlinks,a);if(!c){if(!(i&64))throw M(`ENOENT`,a);let c=await o.stat(K(s));if(X&&!Y(e,c,2))throw M(`EACCES`,`open`,K(t));if(!kn(c))throw M(`ENOTDIR`,`open`,K(t));if(!n.allowDirectory&&r&16384)throw M(`EISDIR`,`open`,t);let{euid:l,egid:u}=Me(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 pr(e,t,o,s,i,d)}if(X&&!Y(e,c,br(i)))throw M(`EACCES`,a);if(i&128)throw M(`EEXIST`,a);let l=new pr(e,t,o,s,i,c);if(!n.allowDirectory&&r&16384)throw M(`EISDIR`,`open`,t);return i&512&&await l.truncate(0),l}async function Gi(e){e=W(e);let t={syscall:`readlink`,path:e},{fs:n,stats:r,path:i}=await Ui(this,e,!0,t);if(!r)throw M(`ENOENT`,t);if(X&&!Y(this,r,4))throw M(`EACCES`,t);if(!An(r))throw M(`EINVAL`,t);let a=r.size,o=new Uint8Array(a);return await n.read(i,o,0,a),w(o)}async function Ki(e,t={}){e=W(e);let{euid:n,egid:r}=Me(this).credentials,{mode:i=511,recursive:a}=t,{fs:o,path:s}=Or(e,this,{syscall:`mkdir`}),c=async(e,t,a)=>{if(X&&!Y(this,a,2))throw M(`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 Hi(this,`rename`,e),s};if(!a){await c(e,s,await o.stat(K(s)));return}let l=[],u=e;for(let e=s;!await o.exists(e);e=K(e),u=K(u))l.unshift([u,e]);if(!l.length)return;let d=[await o.stat(K(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 qi(e,t={}){e=W(e);let n={syscall:`readdir`,path:e},{fs:r,path:i,stats:a}=await Ui(this,e,!1,n);if(!a)throw M(`ENOENT`,n);if(X&&!Y(this,a,4))throw M(`EACCES`,n);if(!kn(a))throw M(`ENOTDIR`,n);let o=await r.readdir(i),s=[],c=async e=>{let n=await r.stat(G(i,e)).catch(e=>{if(e.code!=`ENOENT`)throw e});if(!n)return;let a=new fr;if(a.ino=n.ino,a.type=ur(n.mode),a.path=e,a.name=cn(e),s.push(a),!t.recursive||!kn(n))return;let o=await r.readdir(G(i,e));for(let t of o)await c(G(e,t))};return await Promise.all(o.map(c)),s}async function Ji(e,t){e=W(e),t=W(t);let n={syscall:`rename`,path:e,dest:t},r=await Ui(this,e,!0,n),i=Or(t,this,n);if(r.fs.uuid!==i.fs.uuid)throw M(`EXDEV`,n);if(i.path.startsWith(r.path+`/`))throw M(`EBUSY`,n);if(!r.stats)throw M(`ENOENT`,n);let a=r.fs,o=await a.stat(K(r.path)),s=await a.stat(K(i.path)),c=await a.stat(i.path).catch(e=>{if(e.code==`ENOENT`)return null;throw e});if(X&&(!Y(this,o,4)||!Y(this,s,2)))throw M(`EACCES`,n);if(c&&!kn(r.stats)&&kn(c))throw M(`EISDIR`,n);if(c&&kn(r.stats)&&!kn(c))throw M(`ENOTDIR`,n);await r.fs.rename(r.path,i.path),Hi(this,`rename`,e),Hi(this,`change`,t)}async function Yi(e,t){e=W(e),t=W(t);let n={syscall:`link`,path:t,dest:e},{fs:r,path:i}=Or(e,this,n),a=Or(t,this,n);if(r.uuid!=a.fs.uuid)throw M(`EXDEV`,n);let o=await r.stat(i);if(X){if(!Y(this,o,4))throw M(`EACCES`,n);let e=await r.stat(K(i));if(!Y(this,e,4))throw M(`EACCES`,n);let t=await r.stat(K(a.path));if(!Y(this,t,2))throw M(`EACCES`,n)}return await r.link(i,a.path)}async function Xi(e,t){e=W.call(this,e);let n={syscall:t?`lstat`:`stat`,path:e},r;if(!t)r=(await Ui(this,e,!1,n)).stats;else{let{base:t,dir:i}=dn(e),{fs:a,path:o}=await Ui(this,i,!1,n);r=await a.stat(t?G(o,t):o).catch(P(n))}if(!r)throw M(`ENOENT`,n);if(X&&!Y(this,r,4))throw M(`EACCES`,n);return r}var Zi=class extends c.default{input;output;terminal;line=``;_cursor=0;get cursor(){return this._cursor}_buffer=``;_closed=!1;_paused=!1;_prompt=``;_history=[];_historyIndex=-1;_currentLine=``;constructor(e,t,n,r=!1){super(),this.input=e,this.output=t,this.terminal=r,this.input.on(`data`,this._onData),this.input.on(`end`,this.close.bind(this)),this.input.on(`close`,this.close.bind(this))}_onData=e=>{if(!(this._paused||this._closed)){this._buffer+=typeof e==`string`?e:e.toString(`utf8`);for(let e=this._buffer.indexOf(`
2
2
  `);e>=0;e=this._buffer.indexOf(`
3
3
  `)){let t=this._buffer.substring(0,e);t.endsWith(`\r`)&&(t=t.substring(0,t.length-1)),this._buffer=this._buffer.substring(e+1),this.line=t,t.trim()&&!t.trim().match(/^\s*$/)&&this._history.at(-1)!=t&&(this._history.push(t),this._historyIndex=this._history.length,this.emit(`history`,this._history)),this.emit(`line`,t)}}};close(){if(!this._closed){if(this._closed=!0,this.input?.removeAllListeners?.(),this._buffer.length){let e=this._buffer;this._buffer=``,this.line=e,this.emit(`line`,e)}this.emit(`history`,this._history),this.emit(`close`),this.removeAllListeners()}}pause(){return this._paused?this:(this._paused=!0,`pause`in this.input&&this.input.pause(),this.emit(`pause`),this)}resume(){return this._paused?(this._paused=!1,`resume`in this.input&&this.input.resume(),this.emit(`resume`),this):this}setPrompt(e){this._prompt=e}getPrompt(){return this._prompt}prompt(e){if(!this.output)return;if(!e){this.output.write(this._prompt);return}let{cols:t}=this.getCursorPos();this.output.write(this._prompt),this._cursor=t}write(e,t){if(!this._closed){if(e){let t=typeof e==`string`?e:e.toString(`utf8`);this._onData(t)}if(!(!t||!this.terminal))switch((t.ctrl?`^`:``)+t.name){case`^c`:this.emit(`SIGINT`);break;case`^z`:this.emit(`SIGTSTP`);break;case`^q`:this.emit(`SIGCONT`);break;case`home`:case`^a`:if(!this.output)return;ea(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;ea(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);$i(this.output,1),this.line=e;break}case`^u`:{if(!this.output||!this._cursor)return;let e=this.line.slice(this._cursor);$i(this.output,0),ea(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,ea(this.output,-t.length,0),ea(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`):``)+`