sliccy 6.55.0 → 6.55.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (114) hide show
  1. package/dist/ui/assets/__vite-browser-external-Ttiv38KD.js +1 -0
  2. package/dist/ui/assets/{account-store-CwFk0vrn.js → account-store-B0inTvu6.js} +1 -1
  3. package/dist/ui/assets/{account-store-OPlVgm9n.js → account-store-m7EtgLrd.js} +1 -1
  4. package/dist/ui/assets/{adobe-CV9MxauL.js → adobe-Cf0pn2tU.js} +1 -1
  5. package/dist/ui/assets/{adobe-C4-28UHy.js → adobe-Cj5x46ow.js} +1 -1
  6. package/dist/ui/assets/{agent-message-to-chat-BBrEon-e.js → agent-message-to-chat-BpgSdE7h.js} +1 -1
  7. package/dist/ui/assets/{apply-layout-CU6uv2SV.js → apply-layout-bru2BWxc.js} +1 -1
  8. package/dist/ui/assets/{apps-nVwOwYNZ.js → apps-DJCljXQk.js} +1 -1
  9. package/dist/ui/assets/{azure-openai-DE7XJJ_W.js → azure-openai-B15CN8ee.js} +1 -1
  10. package/dist/ui/assets/{azure-openai-CoNdWu6S.js → azure-openai-DThYpCXW.js} +1 -1
  11. package/dist/ui/assets/{bsh-watchdog-xGxjlLsx.js → bsh-watchdog-CsAAYkov.js} +1 -1
  12. package/dist/ui/assets/{cerebras-Da0ljDfP.js → cerebras-B5waaxE6.js} +1 -1
  13. package/dist/ui/assets/{cerebras-Cb6alYLA.js → cerebras-d0srV-i_.js} +1 -1
  14. package/dist/ui/assets/{composer-speech-DD_sMRrg.js → composer-speech-Dy0ydNto.js} +1 -1
  15. package/dist/ui/assets/{connect-surface-C4wPsDoy.js → connect-surface-B6NQaXSg.js} +1 -1
  16. package/dist/ui/assets/{dip-CJxGQsfn.js → dip-DKzLsmex.js} +1 -1
  17. package/dist/ui/assets/{dist-4adALD4z.js → dist-BaUI1Dp5.js} +1 -1
  18. package/dist/ui/assets/{dist-sUBuiXIF.js → dist-C8yMY-ER.js} +1 -1
  19. package/dist/ui/assets/{dist-CoWnU-QN.js → dist-CrQKODgO.js} +1 -1
  20. package/dist/ui/assets/{dist-Ca06zVsb.js → dist-DBATBmPe.js} +1 -1
  21. package/dist/ui/assets/{ensure-speech-assets-DvQPR6oB.js → ensure-speech-assets-DuQaHF0c.js} +1 -1
  22. package/dist/ui/assets/{esbuild-wasm-DENS1RLU.js → esbuild-wasm-DsMq-s8o.js} +1 -1
  23. package/dist/ui/assets/fs-BrZitfrE.js +1 -0
  24. package/dist/ui/assets/fs-CSJFeAoX.js +2 -0
  25. package/dist/ui/assets/{github-B51gbFRM.js → github-DIpJ-yA9.js} +1 -1
  26. package/dist/ui/assets/{github-DHy_XZw0.js → github-DiQOI0Pd.js} +2 -2
  27. package/dist/ui/assets/{github-copilot-CFAaxZPF.js → github-copilot-DJjGcP35.js} +1 -1
  28. package/dist/ui/assets/{github-copilot-CrE6ukCz.js → github-copilot-DMqtYs8B.js} +1 -1
  29. package/dist/ui/assets/{github-install-5tP5z8Sp.js → github-install-Ccrjhg5T.js} +1 -1
  30. package/dist/ui/assets/{github-zip-CXQB6COR.js → github-zip-YBTmfoPU.js} +1 -1
  31. package/dist/ui/assets/{hear-BzuMQPG-.js → hear-DvNnxDnX.js} +1 -1
  32. package/dist/ui/assets/{hear-F25gzW4x.js → hear-XJQxHLP8.js} +1 -1
  33. package/dist/ui/assets/{installer-7ARtKGfs.js → installer-DDJZNOgZ.js} +1 -1
  34. package/dist/ui/assets/js-realm-worker-BthjWKVF.js +40 -0
  35. package/dist/ui/assets/{kernel-worker-wEr6Yo6G.js → kernel-worker-DPGAky3U.js} +622 -621
  36. package/dist/ui/assets/{kokoro-engine-CeOQaPF5.js → kokoro-engine-2bQR6a7X.js} +1 -1
  37. package/dist/ui/assets/{local-llm-Bj89Xaik.js → local-llm-DVbqW5tQ.js} +1 -1
  38. package/dist/ui/assets/{local-llm-o-9HoXMQ.js → local-llm-nU3dLruP.js} +1 -1
  39. package/dist/ui/assets/{magick-wasm-D-VdfkJ_.js → magick-wasm-BYrT_yC4.js} +1 -1
  40. package/dist/ui/assets/{main-55zLxBLF.js → main-GTxjUHRy.js} +3 -3
  41. package/dist/ui/assets/{mount-Bbl8m0YN.js → mount-BDdh4EsD.js} +2 -2
  42. package/dist/ui/assets/{mount-BAQtIqJM.js → mount-Ddl9KcNn.js} +1 -1
  43. package/dist/ui/assets/{mount-recovery-Dh_lrATP.js → mount-recovery-BvUCHm7S.js} +1 -1
  44. package/dist/ui/assets/{new-session-DzxiQ6Fo.js → new-session-D8XLocZ8.js} +2 -2
  45. package/dist/ui/assets/{oauth-bootstrap-D6sh22mp.js → oauth-bootstrap-kZvuJqUX.js} +2 -2
  46. package/dist/ui/assets/{openai-codex-C2YERBkE.js → openai-codex-BcTtS45y.js} +1 -1
  47. package/dist/ui/assets/{openai-codex-B6vWughU.js → openai-codex-DzM2nZs7.js} +1 -1
  48. package/dist/ui/assets/{openrouter-DRSWugHj.js → openrouter-BZEGuNBF.js} +1 -1
  49. package/dist/ui/assets/{openrouter-D7rca13W.js → openrouter-DiPv3qg9.js} +1 -1
  50. package/dist/ui/assets/{openrouter-oauth-Ccm-7hP1.js → openrouter-oauth-CbMY1jzk.js} +1 -1
  51. package/dist/ui/assets/{openrouter-oauth-CM283kz1.js → openrouter-oauth-xSIr9rPt.js} +1 -1
  52. package/dist/ui/assets/{panel-rpc-handlers-CPDysGzr.js → panel-rpc-handlers-C-a__Bi-.js} +2 -2
  53. package/dist/ui/assets/{provider-D4_spYyQ.js → provider-B-uE3ZCz.js} +1 -1
  54. package/dist/ui/assets/{provider-D95ajDI-.js → provider-Be0E_IMW.js} +2 -2
  55. package/dist/ui/assets/{provider-settings-CZPFzFww.js → provider-settings-Cla-Ao_F.js} +1 -1
  56. package/dist/ui/assets/{provider-settings-DHCjadXO.js → provider-settings-StjddRwF.js} +1 -1
  57. package/dist/ui/assets/{provider-store-access-ZzG9_DW9.js → provider-store-access-CkLew2RG.js} +2 -2
  58. package/dist/ui/assets/provider-store-access-aeWPaRJw.js +1 -0
  59. package/dist/ui/assets/{providers-Bz8hOO4e.js → providers-Brpn-3iE.js} +1 -1
  60. package/dist/ui/assets/{providers-CMbA_5pP.js → providers-DR6MxN4s.js} +2 -2
  61. package/dist/ui/assets/py-realm-worker-B9ZFZSht.js +244 -0
  62. package/dist/ui/assets/{pyodide-DvV71W1m.js → pyodide-C8BMevjP.js} +2 -2
  63. package/dist/ui/assets/{quick-llm-r-RNLFOD.js → quick-llm-DX70ALhs.js} +1 -1
  64. package/dist/ui/assets/{recovery-screen-k0KG52c_.js → recovery-screen-DB1To5sJ.js} +1 -1
  65. package/dist/ui/assets/{redirect-uri-Dlgdgq9c.js → redirect-uri-BrFcQUXI.js} +1 -1
  66. package/dist/ui/assets/{session-freezer-BdNDYJka.js → session-freezer-Cq9qF8FZ.js} +3 -3
  67. package/dist/ui/assets/{setup-feature-flags-remote-Cni0vF5s.js → setup-feature-flags-remote-DE6MSHD9.js} +1 -1
  68. package/dist/ui/assets/{setup-standalone-prelude-Aaw6ZTqE.js → setup-standalone-prelude-D05fd3f-.js} +1 -1
  69. package/dist/ui/assets/{setup-sudo-DE101L1A.js → setup-sudo-CmLT9Etp.js} +2 -2
  70. package/dist/ui/assets/shared-BGkb0Szh.js +1 -0
  71. package/dist/ui/assets/shared-CvRDmxWf.js +4 -0
  72. package/dist/ui/assets/sidecar-repair-DSCESX6n.js +1 -0
  73. package/dist/ui/assets/sidecar-repair-DoQ5IdBR.js +1 -0
  74. package/dist/ui/assets/{skills-CD6n7K64.js → skills-7beI-IKL.js} +1 -1
  75. package/dist/ui/assets/{speak-CMtHf-87.js → speak-CAvJu50L.js} +1 -1
  76. package/dist/ui/assets/{speak-DB1MBC8u.js → speak-pezNrAJe.js} +1 -1
  77. package/dist/ui/assets/{sprinkle-bridge-CvxVWzkw.js → sprinkle-bridge-CDUlpA1k.js} +1 -1
  78. package/dist/ui/assets/{sprinkle-manager-BuGjZ5Cc.js → sprinkle-manager-CrFYYcYo.js} +1 -1
  79. package/dist/ui/assets/{store-PS_6K9ig.js → store-CSk8LOYP.js} +1 -1
  80. package/dist/ui/assets/{store-B-j0AMTP.js → store-Cxd6lAkh.js} +1 -1
  81. package/dist/ui/assets/{sudo-C0Frl1uv.js → sudo-C_oJCkxM.js} +1 -1
  82. package/dist/ui/assets/{tool-result-images-D76DDM2v.js → tool-result-images-Dm6tlkfz.js} +1 -1
  83. package/dist/ui/assets/{transformers-env-B-CKGy98.js → transformers-env-sSyvbYdA.js} +1 -1
  84. package/dist/ui/assets/{transformers-env-q0cI8Ngw.js → transformers-env-wpY2kxZs.js} +1 -1
  85. package/dist/ui/assets/{upgrade-detection-C6lKX0sw.js → upgrade-detection-qNoriX8R.js} +1 -1
  86. package/dist/ui/assets/{voice-reply-BVyL3pvl.js → voice-reply-C6Q5UBvr.js} +1 -1
  87. package/dist/ui/assets/{wc-extension-DiMYH909.js → wc-extension-xGmsids-.js} +2 -2
  88. package/dist/ui/assets/{wc-follower-XRDd6kcV.js → wc-follower-CS5nhoDP.js} +3 -3
  89. package/dist/ui/assets/{wc-live-CeUom_i0.js → wc-live-BOWfCqId.js} +4 -4
  90. package/dist/ui/assets/{wc-nav-oFUaoh0U.js → wc-nav-DYVpfhGQ.js} +2 -2
  91. package/dist/ui/assets/{wc-onboarding-CTPJpqjh.js → wc-onboarding-CUVC-Tlh.js} +2 -2
  92. package/dist/ui/assets/{wc-placeholder-CbIosT0I.js → wc-placeholder-BRdrJsyS.js} +2 -2
  93. package/dist/ui/assets/{wc-settings-DMFk0-ha.js → wc-settings-BrLzoBWh.js} +2 -2
  94. package/dist/ui/assets/{wc-shell-CsrNIkU0.js → wc-shell-DvAzKQ8n.js} +2 -2
  95. package/dist/ui/assets/{wc-sprinkles-CQZ3LlUK.js → wc-sprinkles-BJ52zD0V.js} +2 -2
  96. package/dist/ui/assets/{wc-tray-DckHZGXQ.js → wc-tray-D4CqyT3U.js} +2 -2
  97. package/dist/ui/assets/{wc-tray-scoops-MLGLg0xV.js → wc-tray-scoops-DFuuk86P.js} +1 -1
  98. package/dist/ui/assets/{whisper-engine-tXDxhSyA.js → whisper-engine-Cy4tNnVy.js} +1 -1
  99. package/dist/ui/assets/{whisper-session-BQThVgKW.js → whisper-session-BXqEuFVV.js} +2 -2
  100. package/dist/ui/assets/{xai-grok-BOQIeqyM.js → xai-grok-BEU-yDtv.js} +1 -1
  101. package/dist/ui/assets/{xai-grok-DtwSyWqH.js → xai-grok-DPl1-t2U.js} +1 -1
  102. package/dist/ui/index.html +6 -6
  103. package/dist/ui/packages/webapp/index.html +6 -6
  104. package/package.json +1 -1
  105. package/dist/ui/assets/__vite-browser-external-Cyo-aQrT.js +0 -1
  106. package/dist/ui/assets/fs-B-xI_nsy.js +0 -1
  107. package/dist/ui/assets/fs-DwsOvha-.js +0 -2
  108. package/dist/ui/assets/js-realm-worker-BI6pkh3X.js +0 -39
  109. package/dist/ui/assets/provider-store-access-nDgnx6NL.js +0 -1
  110. package/dist/ui/assets/py-realm-worker-C2q3f011.js +0 -244
  111. package/dist/ui/assets/shared-BD0eHnW8.js +0 -1
  112. package/dist/ui/assets/shared-C34Ci5nb.js +0 -4
  113. package/dist/ui/assets/sidecar-repair-BXwSWMQD.js +0 -1
  114. package/dist/ui/assets/sidecar-repair-qfX5Cm1p.js +0 -1
@@ -1,4 +1,4 @@
1
- import{i as e,n as t,t as n}from"./rolldown-runtime-Dd_uD5pT.js";import{n as r,t as i}from"./safe-buffer-B2wnAhUx.js";function a(e,t){if(e.byteLength>=t)return e;if(ArrayBuffer.isView(e)){let n=a(e.buffer,t);return new e.constructor(n,e.byteOffset,t)}let n=typeof SharedArrayBuffer<`u`&&e instanceof SharedArrayBuffer;if(e.maxByteLength>t)return n?e.grow(t):e.resize(t),e;if(n){let n=new SharedArrayBuffer(t);return new Uint8Array(n).set(new Uint8Array(e)),n}try{return e.transfer(t)}catch{let n=new ArrayBuffer(t);return new Uint8Array(n).set(new Uint8Array(e)),n}}var o=class extends DataView{constructor(e,t,n){let{buffer:r,byteOffset:i,byteLength:a}=new Uint8Array(e,t,n);super(r,i,a)}};for(let e of Object.getOwnPropertyNames(DataView.prototype))!e.startsWith(`get`)&&!e.startsWith(`set`)||Object.defineProperty(o.prototype,e,{value:()=>{throw ReferenceError(`Do not use DataView methods on a BufferView.`)},writable:!1,enumerable:!1,configurable:!1});var s=class{id;_size;options;regions=[];get size(){return this._size}set size(e){if(e>=this._size){this._size=e;return}this._size=e;for(let t=this.regions.length-1;t>=0;t--){let n=this.regions[t];if(n.offset>=e){this.regions.splice(t,1);continue}let r=e-n.offset;n.data.byteLength>r&&(n.data=n.data.subarray(0,r)),n.ranges=n.ranges.filter(t=>t.start<e).map(t=>t.end>e?{start:t.start,end:e}:t)}}constructor(e,t,n,r){this.id=e,this._size=t,this.options=n,n.sparse??=!0,n.sparse||this.regions.push({offset:0,data:new Uint8Array(t),ranges:[]}),r?.set(e,this)}collect(){if(!this.options.sparse)return;let{regionGapThreshold:e=4095}=this.options;for(let t=0;t<this.regions.length-1;){let n=this.regions[t],r=this.regions[t+1];if(r.offset-(n.offset+n.data.byteLength)>e){t++;continue}n.ranges.push(...r.ranges),n.ranges.sort((e,t)=>e.start-t.start),n.ranges=n.ranges.reduce((e,t)=>(!e.length||e.at(-1).end<t.start?e.push(t):e.at(-1).end=Math.max(e.at(-1).end,t.end),e),[]),n.data=a(n.data,r.offset+r.data.byteLength),n.data.set(r.data,r.offset-n.offset),this.regions.splice(t+1,1)}}missing(e,t){let n=[];for(let r of this.regions){if(r.offset>=t)break;for(let i of r.ranges)if(!(i.end<=e)&&(i.start>=t||(i.start>e&&n.push({start:e,end:Math.min(i.start,t)}),i.end>e&&(e=Math.max(e,i.end)),e>=t)))break;if(e>=t)break}return e<t&&n.push({start:e,end:t}),n}cached(e,t){let n=[];for(let r of this.regions){if(r.offset>=t)break;for(let i of r.ranges)if(!(i.end<=e)){if(i.start>=t)break;n.push({start:Math.max(e,i.start),end:Math.min(t,i.end)})}}n.sort((e,t)=>e.start-t.start);let r=[];for(let e of n){let t=r.at(-1);t&&e.start<=t.end?t.end=Math.max(t.end,e.end):r.push(e)}return r}regionAt(e){if(this.regions.length)for(let t of this.regions){if(t.offset>e)break;if(e>=t.offset&&e<t.offset+t.data.byteLength)return t}}add(e,t){let n=t+e.byteLength,r=this.regionAt(t);if(r)return r.data=a(r.data,n),r.data.set(e,t),r.ranges.push({start:t,end:n}),r.ranges.sort((e,t)=>e.start-t.start),this.collect(),this;let i={data:e,offset:t,ranges:[{start:t,end:n}]},o=this.regions.findIndex(e=>e.offset>t);return o==-1?this.regions.push(i):this.regions.splice(o,0,i),this.collect(),this}};const c=new Uint32Array(256);for(let e=0;e<256;e++){let t=e;for(let e=0;e<8;e++)t=t&1?2197175160^t>>>1:t>>>1;c[e]=t}function l(e){let t=4294967295;for(let n=0;n<e.length;n++)t=t>>>8^c[(t^e[n])&255];return(t^4294967295)>>>0}var u=e(n(((e,t)=>{var n=Object.prototype.hasOwnProperty,r=`~`;function i(){}Object.create&&(i.prototype=Object.create(null),new i().__proto__||(r=!1));function a(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function o(e,t,n,i,o){if(typeof n!=`function`)throw TypeError(`The listener must be a function`);var s=new a(n,i||e,o),c=r?r+t:t;return e._events[c]?e._events[c].fn?e._events[c]=[e._events[c],s]:e._events[c].push(s):(e._events[c]=s,e._eventsCount++),e}function s(e,t){--e._eventsCount===0?e._events=new i:delete e._events[t]}function c(){this._events=new i,this._eventsCount=0}c.prototype.eventNames=function(){var e=[],t,i;if(this._eventsCount===0)return e;for(i in t=this._events)n.call(t,i)&&e.push(r?i.slice(1):i);return Object.getOwnPropertySymbols?e.concat(Object.getOwnPropertySymbols(t)):e},c.prototype.listeners=function(e){var t=r?r+e:e,n=this._events[t];if(!n)return[];if(n.fn)return[n.fn];for(var i=0,a=n.length,o=Array(a);i<a;i++)o[i]=n[i].fn;return o},c.prototype.listenerCount=function(e){var t=r?r+e:e,n=this._events[t];return n?n.fn?1:n.length:0},c.prototype.emit=function(e,t,n,i,a,o){var s=r?r+e:e;if(!this._events[s])return!1;var c=this._events[s],l=arguments.length,u,d;if(c.fn){switch(c.once&&this.removeListener(e,c.fn,void 0,!0),l){case 1:return c.fn.call(c.context),!0;case 2:return c.fn.call(c.context,t),!0;case 3:return c.fn.call(c.context,t,n),!0;case 4:return c.fn.call(c.context,t,n,i),!0;case 5:return c.fn.call(c.context,t,n,i,a),!0;case 6:return c.fn.call(c.context,t,n,i,a,o),!0}for(d=1,u=Array(l-1);d<l;d++)u[d-1]=arguments[d];c.fn.apply(c.context,u)}else{var f=c.length,p;for(d=0;d<f;d++)switch(c[d].once&&this.removeListener(e,c[d].fn,void 0,!0),l){case 1:c[d].fn.call(c[d].context);break;case 2:c[d].fn.call(c[d].context,t);break;case 3:c[d].fn.call(c[d].context,t,n);break;case 4:c[d].fn.call(c[d].context,t,n,i);break;default:if(!u)for(p=1,u=Array(l-1);p<l;p++)u[p-1]=arguments[p];c[d].fn.apply(c[d].context,u)}}return!0},c.prototype.on=function(e,t,n){return o(this,e,t,n,!1)},c.prototype.once=function(e,t,n){return o(this,e,t,n,!0)},c.prototype.removeListener=function(e,t,n,i){var a=r?r+e:e;if(!this._events[a])return this;if(!t)return s(this,a),this;var o=this._events[a];if(o.fn)o.fn===t&&(!i||o.once)&&(!n||o.context===n)&&s(this,a);else{for(var c=0,l=[],u=o.length;c<u;c++)(o[c].fn!==t||i&&!o[c].once||n&&o[c].context!==n)&&l.push(o[c]);l.length?this._events[a]=l.length===1?l[0]:l:s(this,a)}return this},c.prototype.removeAllListeners=function(e){var t;return e?(t=r?r+e:e,this._events[t]&&s(this,t)):(this._events=new i,this._eventsCount=0),this},c.prototype.off=c.prototype.removeListener,c.prototype.addListener=c.prototype.on,c.prefixed=r,c.EventEmitter=c,t!==void 0&&(t.exports=c)}))(),1),d=class extends u.default{[Symbol.toStringTag]=`List`;constructor(e){super(),e&&this.push(...e)}data=new Set;toSet(){return new Set(this.data)}toArray(){return Array.from(this.data)}toJSON(){return Array.from(this.data)}toString(){return this.join(`,`)}_set(e,t,n=!1){if(Math.abs(e)>this.data.size)throw ReferenceError(`Can not set an element outside the bounds of the list`);let r=Array.from(this.data);r.splice(e,+n,t),this.data=new Set(r),this.emit(`update`)}set(e,t){this._set(e,t,!0)}deleteAt(e){if(Math.abs(e)>this.data.size)throw ReferenceError(`Can not delete an element outside the bounds of the list`);this.delete(Array.from(this.data).at(e))}insert(e,t=this.data.size){this._set(t,e,!1)}at(e){if(Math.abs(e)>this.data.size)throw ReferenceError(`Can not access an element outside the bounds of the list`);return Array.from(this.data).at(e)}pop(){let e=Array.from(this.data).pop();return e!==void 0&&this.delete(e),e}push(...e){for(let t of e)this.add(t);return this.data.size}join(e){return Array.from(this.data).join(e)}splice(e,t,...n){if(Math.abs(e)>this.data.size)throw ReferenceError(`Can not splice elements outside the bounds of the list`);let r=Array.from(this.data),i=r.splice(e,t,...n);return this.data=new Set(r),this.emit(`update`),i}add(e){return this.data.add(e),this.emit(`update`),this.emit(`add`,e),this}clear(){this.data.clear(),this.emit(`update`)}delete(e){let t=this.data.delete(e);return this.emit(`update`),t}has(e){return this.data.has(e)}get size(){return this.data.size}entries(){return this.toArray().entries()}keys(){return this.toArray().keys()}values(){return this.data.values()}[Symbol.iterator](){return this.data[Symbol.iterator]()}};function f(e,t){let n=Object.entries(e);return Object.fromEntries(n.filter(([e,n])=>t(e,n)))}function p(e,...t){let n={};for(let r of t.flat())n[r]=e[r];return n}function m(e,...t){return f(e,e=>!t.flat().includes(e))}function h(e){try{return JSON.parse(e),!0}catch{return!1}}function g(e){let t=[];for(let n=e;n&&![`Function`,`Object`].includes(n.constructor.name);n=Object.getPrototypeOf(n))t.push(n.constructor.name);return t}function _(e,t){return Object.fromEntries(Object.entries(e).map(([e,n])=>[e,typeof n==`function`?n.bind(t):n]))}function v(e=Error()){let t=setTimeout(()=>{throw e},5e3);return()=>clearTimeout(t)}function y(e){throw e&&typeof e==`object`&&g(e).includes(`Error`)&&Error?.captureStackTrace(e,y),e}function b(e,t){if(![`getter`,`accessor`].includes(t.kind))throw Error(`@memoize can only be used on getters and auto-accessors`);let n=new WeakMap;function r(){if(n.has(this))return n.get(this);let t=typeof e==`function`?e.call(this):e.get.call(this);return n.set(this,t),t}switch(t.kind){case`getter`:return r;case`accessor`:return{...e,get:r}}}const x=Intl.NumberFormat(`en`,{notation:`compact`});x.format.bind(x);function S(e=0,t=1){return Math.round(Math.random()*(t-e)+e)}function C(e){return e.at(0).toUpperCase()+e.slice(1)}const w=new TextEncoder;function T(e){return w.encode(e)}const ee=new TextDecoder;function E(e){if(!e)return``;if(e.buffer instanceof ArrayBuffer&&!e.buffer.resizable)return ee.decode(e);let t=new Uint8Array(e.byteLength);return t.set(e),ee.decode(t)}function te(e){let t=new Uint8Array(e.length);for(let n=0;n<e.length;n++)t[n]=e.charCodeAt(n);return t}function ne(e){let t=``;for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return t}function D(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 O(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 k;(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`})(k||={});const A={[k.EPERM]:`operation not permitted`,[k.ENOENT]:`no such file or directory`,[k.ESRCH]:`no such process`,[k.EINTR]:`interrupted system call`,[k.EIO]:`i/o error`,[k.ENXIO]:`no such device or address`,[k.E2BIG]:`argument list too long`,[k.ENOEXEC]:`exec format error`,[k.EBADF]:`bad file descriptor`,[k.ECHILD]:`no child processes`,[k.EAGAIN]:`resource temporarily unavailable`,[k.ENOMEM]:`not enough memory`,[k.EACCES]:`permission denied`,[k.EFAULT]:`bad address in system call argument`,[k.ENOTBLK]:`block device required`,[k.EBUSY]:`resource busy or locked`,[k.EEXIST]:`file already exists`,[k.EXDEV]:`cross-device link not permitted`,[k.ENODEV]:`no such device`,[k.ENOTDIR]:`not a directory`,[k.EISDIR]:`illegal operation on a directory`,[k.EINVAL]:`invalid argument`,[k.ENFILE]:`file table overflow`,[k.EMFILE]:`too many open files`,[k.ETXTBSY]:`text file is busy`,[k.EFBIG]:`file too large`,[k.ENOSPC]:`no space left on device`,[k.ESPIPE]:`invalid seek`,[k.EROFS]:`read-only file system`,[k.EMLINK]:`too many links`,[k.EPIPE]:`broken pipe`,[k.EDOM]:`numerical argument out of domain`,[k.ERANGE]:`result too large`,[k.EDEADLK]:`resource deadlock would occur`,[k.ENAMETOOLONG]:`name too long`,[k.ENOLCK]:`no locks available`,[k.ENOSYS]:`function not implemented`,[k.ENOTEMPTY]:`directory not empty`,[k.ELOOP]:`too many symbolic links encountered`,[k.ENOMSG]:`no message of desired type`,[k.EIDRM]:`identifier removed`,[k.ECHRNG]:`channel number out of range`,[k.EL2NSYNC]:`level 2 not synchronized`,[k.EL3HLT]:`level 3 halted`,[k.EL3RST]:`level 3 reset`,[k.ENRNG]:`link number out of range`,[k.EUNATCH]:`protocol driver not attached`,[k.ECSI]:`no CSI structure available`,[k.EL2HLT]:`level 2 halted`,[k.EBADE]:`invalid exchange`,[k.EBADR]:`invalid request descriptor`,[k.EXFULL]:`exchange full`,[k.ENOANO]:`no anode`,[k.EBADRQC]:`invalid request code`,[k.EBADSLT]:`invalid slot`,[k.EBFONT]:`bad font file format`,[k.ENOSTR]:`device not a stream`,[k.ENODATA]:`no data available`,[k.ETIME]:`timer expired`,[k.ENOSR]:`out of streams resources`,[k.ENONET]:`machine is not on the network`,[k.ENOPKG]:`package not installed`,[k.EREMOTE]:`object is remote`,[k.ENOLINK]:`link has been severed`,[k.EADV]:`advertise error`,[k.ESRMNT]:`srmount error`,[k.ECOMM]:`communication error on send`,[k.EPROTO]:`protocol error`,[k.EMULTIHOP]:`multihop attempted`,[k.EDOTDOT]:`rFS specific error`,[k.EBADMSG]:`bad message`,[k.EOVERFLOW]:`value too large for defined data type`,[k.ENOTUNIQ]:`name not unique on network`,[k.EBADFD]:`file descriptor in bad state`,[k.EREMCHG]:`remote address changed`,[k.ELIBACC]:`can not access a needed shared library`,[k.ELIBBAD]:`accessing a corrupted shared library`,[k.ELIBSCN]:`.lib section in a.out corrupted`,[k.ELIBMAX]:`attempting to link in too many shared libraries`,[k.ELIBEXEC]:`cannot exec a shared library directly`,[k.EILSEQ]:`illegal byte sequence`,[k.ERESTART]:`interrupted system call should be restarted`,[k.ESTRPIPE]:`streams pipe error`,[k.EUSERS]:`too many users`,[k.ENOTSOCK]:`socket operation on non-socket`,[k.EDESTADDRREQ]:`destination address required`,[k.EMSGSIZE]:`message too long`,[k.EPROTOTYPE]:`protocol wrong type for socket`,[k.ENOPROTOOPT]:`protocol not available`,[k.EPROTONOSUPPORT]:`protocol not supported`,[k.ESOCKTNOSUPPORT]:`socket type not supported`,[k.ENOTSUP]:`operation not supported on socket`,[k.EPFNOSUPPORT]:`protocol family not supported`,[k.EAFNOSUPPORT]:`address family not supported`,[k.EADDRINUSE]:`address already in use`,[k.EADDRNOTAVAIL]:`address not available`,[k.ENETDOWN]:`network is down`,[k.ENETUNREACH]:`network is unreachable`,[k.ENETRESET]:`network dropped connection on reset`,[k.ECONNABORTED]:`software caused connection abort`,[k.ECONNRESET]:`connection reset by peer`,[k.ENOBUFS]:`no buffer space available`,[k.EISCONN]:`socket is already connected`,[k.ENOTCONN]:`socket is not connected`,[k.ESHUTDOWN]:`cannot send after transport endpoint shutdown`,[k.ETOOMANYREFS]:`too many references: cannot splice`,[k.ETIMEDOUT]:`connection timed out`,[k.ECONNREFUSED]:`connection refused`,[k.EHOSTDOWN]:`host is down`,[k.EHOSTUNREACH]:`host is unreachable`,[k.EALREADY]:`connection already in progress`,[k.EINPROGRESS]:`operation now in progress`,[k.ESTALE]:`stale file handle`,[k.EEUCLEAN]:`structure needs cleaning`,[k.ENOTNAM]:`not a XENIX named type file`,[k.ENAVAIL]:`no XENIX semaphores available`,[k.EISNAM]:`is a named type file`,[k.EREMOTEIO]:`remote I/O error`,[k.EDQUOT]:`disk quota exceeded`,[k.ENOMEDIUM]:`no medium found`,[k.EMEDIUMTYPE]:`wrong medium type`,[k.ECANCELED]:`operation canceled`,[k.ENOKEY]:`required key not available`,[k.EKEYEXPIRED]:`key has expired`,[k.EKEYREVOKED]:`key has been revoked`,[k.EKEYREJECTED]:`key was rejected by service`,[k.EOWNERDEAD]:`owner died`,[k.ENOTRECOVERABLE]:`state not recoverable`,[k.ERFKILL]:`operation not possible due to RF-kill`,[k.EHWPOISON]:`memory page has hardware error`};function j(e){let t=`${e.code}: ${A[e.errno]}, ${e.syscall}`;e.path&&(t+=` '${e.path}'`),e.dest&&(t+=` -> '${e.dest}'`);let n=e.message.startsWith(A[e.errno])||/^E[A-Z0-9]+: /.test(e.message);return e.message&&!n&&(t+=` (${e.message})`),e.message=t,e}var M=class e extends Error{errno;code;path;dest;syscall;constructor(e,t,n={}){let r=k[e];super(t||``),this.errno=e,this.code=r,Object.assign(this,m(n,`message`)),t||j(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 N(e,t,n,r){typeof t==`string`&&(t={syscall:t,path:n,dest:r});let i=new M(k[e],!1,t??{});return Error.captureStackTrace?.(i,N),i}function P(e,t){let n=new M(k[e],t??A[k[e]]);return Error.captureStackTrace?.(n,P),n}function F(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),j(e),e}}var re=t({Level:()=>I,alert:()=>ce,configure:()=>Ee,crit:()=>le,debug:()=>fe,deprecated:()=>pe,emerg:()=>se,entries:()=>R,err:()=>z,fancy:()=>ve,format:()=>be,info:()=>de,isEnabled:()=>Te,levelOf:()=>ie,levels:()=>L,log:()=>ae,notice:()=>ue,warn:()=>B}),I;(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`})(I||={});const L=[`emergency`,`alert`,`critical`,`error`,`warning`,`notice`,`info`,`debug`];function ie(e){return L.indexOf(e)}const R=new d;function ae(e,t){if(!Te)return;let n={level:e,message:t,timestamp:new Date,elapsedMs:performance.now()};R.add(n),Se(n)}function oe(e){return function(t){return ae(e,t.toString()),t}}const se=oe(I.EMERG),ce=oe(I.ALERT),le=oe(I.CRIT),z=oe(I.ERR),B=oe(I.WARN),ue=oe(I.NOTICE),de=oe(I.INFO),fe=oe(I.DEBUG);function pe(e){ae(I.WARN,e+` is deprecated and should not be used.`)}function me(e,t){return`\x1b[${t}m${e}\x1b[0m`}function he(e){return`[`+(e.elapsedMs/1e3).toFixed(3).padStart(10)+`] `}const ge={ansi:{[I.EMERG]:`1;4;37;41`,[I.ALERT]:`1;37;41`,[I.CRIT]:`1;35`,[I.ERR]:`1;31`,[I.WARN]:`1;33`,[I.NOTICE]:`1;36`,[I.INFO]:`1;37`,[I.DEBUG]:`0;2;37`},css:{[I.EMERG]:`font-weight: bold; text-decoration: underline; color: white; background-color: red;`,[I.ALERT]:`font-weight: bold; color: white; background-color: red;`,[I.CRIT]:`font-weight: bold; color: magenta;`,[I.ERR]:`font-weight: bold; color: red;`,[I.WARN]:`font-weight: bold; color: yellow;`,[I.NOTICE]:`font-weight: bold; color: cyan;`,[I.INFO]:`font-weight: bold; color: white;`,[I.DEBUG]:`opacity: 0.8; color: white;`}},_e={ansi:{[I.EMERG]:`1;31`,[I.ALERT]:`1;31`,[I.CRIT]:`1;31`,[I.ERR]:`31`,[I.WARN]:`33`,[I.NOTICE]:`1;37`,[I.INFO]:`37`,[I.DEBUG]:`2;37`},css:{[I.EMERG]:`font-weight: bold; color: red;`,[I.ALERT]:`font-weight: bold; color: red;`,[I.CRIT]:`font-weight: bold; color: red;`,[I.ERR]:`color: red;`,[I.WARN]:`color: yellow;`,[I.NOTICE]:`font-weight: bold; color: white;`,[I.INFO]:`color: white;`,[I.DEBUG]:`opacity: 0.8; color: white;`}};function ve({style:e,colorize:t}){return function*(n){e==`css`&&(yield t==`level`?`%c%s %c%s`:`%c%s %c%s%s %c%s`),yield*e==`ansi`?[me(he(n),`2;37`)]:[`opacity: 0.8; color: white;`,he(n)];let r=e==`ansi`?[me(L[n.level].toUpperCase(),ge.ansi[n.level])]:[ge.css[n.level],L[n.level].toUpperCase()];if(t==`level`){yield*r,yield n.message;return}n.level<I.CRIT&&(yield*r),e==`ansi`?yield me(n.message,_e.ansi[n.level]):yield*[_e.css[n.level],n.message]}}let ye=e=>[he(e),e.message];function be(e){let t=ye(e);return typeof t==`string`?[t]:Array.from(t)}let xe=console.error;function Se(e){e.level>Ce||xe(...be(e))}let Ce=I.ALERT,we=!1,Te=!0;function Ee(e){if(ye=e.format??ye,xe=e.output??xe,Ce=typeof e.level==`string`?ie(e.level):e.level??Ce,Te=e.enabled??Te,we=e.stack??we,e.dumpBacklog)for(let e of R)Se(e)}function De(e){return typeof e==`object`&&!!e&&`create`in e&&typeof e.create==`function`}function Oe(e,t){return Object.defineProperty(t,"prototype",{value:void 0}),e&&Object.defineProperty(t,"name",{value:e}),t}function ke(e){return!(e&&e.constructor===Function)||e.prototype===void 0?!1:Function.prototype!==Object.getPrototypeOf(e)||Object.getOwnPropertyNames(e.prototype).length>1}function Ae(e,t){if(typeof t!=`object`||!t)throw z(P(`EINVAL`,`Invalid options`));for(let[n,r]of Object.entries(e.options)){let e=t?.[n];if(e==null){if(!r.required){fe(`Using default for option: `+n);continue}throw z(P(`EINVAL`,`Missing required option: `+n))}let i=(t,n=e)=>typeof t==`function`?ke(t)?e instanceof t:t(e):typeof e===t||e?.constructor?.name===t;if(Array.isArray(r.type)?r.type.some(e=>i(e)):i(r.type))continue;let a=typeof e==`object`&&`constructor`in e?e.constructor.name:typeof e,o=e=>typeof e==`function`?e.name==`type`?e.toString():e.name:e,s=Array.isArray(r.type)?`one of ${r.type.map(o).join(`, `)}`:o(r.type);throw z(P(`EINVAL`,`Incorrect type for "${n}": ${a} (expected ${s})`))}}function je(e){return typeof e==`object`&&!!e&&`backend`in e&&De(e.backend)}function Me(e){return{suid:e.uid,sgid:e.gid,euid:e.uid,egid:e.gid,groups:[],...e}}function Ne(e){return e?!e.uid||!e.gid||!e.euid||!e.egid||e.groups.some(e=>!e):!1}const Pe=Symbol(`ZenFSContext`),Fe={[Pe]:!0,id:0,root:`/`,pwd:`/`,credentials:Me({uid:0,gid:0}),descriptors:new Map,parent:null,children:[]};function Ie(e){return typeof e==`object`&&e&&Pe in e?e:Fe}let Le=1;function Re(e,t={}){let{root:n=e.root,pwd:r=e.pwd,credentials:i=structuredClone(e.credentials)}=t,a={[Pe]:!0,id:Le++,root:n,pwd:r,credentials:Me(i),descriptors:new Map,parent:e,children:[]};return Object.defineProperties(a,{id:{configurable:!1,writable:!1},credentials:{configurable:!1,writable:!1},descriptors:{configurable:!1,writable:!1},parent:{configurable:!1,writable:!1},children:{configurable:!1,writable:!1}}),a}var ze=t({COPYFILE_EXCL:()=>1,COPYFILE_FICLONE:()=>2,COPYFILE_FICLONE_FORCE:()=>4,F_OK:()=>0,O_APPEND:()=>Be,O_CREAT:()=>64,O_DIRECT:()=>qe,O_DIRECTORY:()=>Ve,O_DSYNC:()=>Ge,O_EXCL:()=>128,O_NOATIME:()=>He,O_NOCTTY:()=>256,O_NOFOLLOW:()=>Ue,O_NONBLOCK:()=>Je,O_RDONLY:()=>0,O_RDWR:()=>2,O_SYMLINK:()=>Ke,O_SYNC:()=>We,O_TRUNC:()=>512,O_WRONLY:()=>1,R_OK:()=>4,S_IFBLK:()=>$e,S_IFCHR:()=>tt,S_IFDIR:()=>et,S_IFIFO:()=>nt,S_IFLNK:()=>Ze,S_IFMT:()=>Ye,S_IFREG:()=>Qe,S_IFSOCK:()=>Xe,S_IRGRP:()=>32,S_IROTH:()=>4,S_IRUSR:()=>256,S_IRWXG:()=>56,S_IRWXO:()=>7,S_IRWXU:()=>448,S_ISGID:()=>it,S_ISUID:()=>rt,S_ISVTX:()=>512,S_IWGRP:()=>16,S_IWOTH:()=>2,S_IWUSR:()=>128,S_IXGRP:()=>8,S_IXOTH:()=>1,S_IXUSR:()=>64,UV_FS_O_FILEMAP:()=>0,W_OK:()=>2,X_OK:()=>1,size_max:()=>at});const Be=1024,Ve=65536,He=262144,Ue=131072,We=1052672,Ge=4096,Ke=32768,qe=16384,Je=2048,Ye=61440,Xe=49152,Ze=40960,Qe=32768,$e=24576,et=16384,tt=8192,nt=4096,rt=2048,it=1024,at=4294967295;function ot(e){return`__isArrayType`in e&&e.__isArrayType===!0}function st(e){return typeof e!=`object`&&typeof e!=`function`||e==null?!1:ot(e)?st(e.type):`name`in e&&`size`in e&&`get`in e&&`set`in e&&typeof e.name==`string`&&typeof e.size==`number`&&typeof e.get==`function`&&typeof e.set==`function`&&ct.has(e.name)&&ct.get(e.name)?.name===e.name}const ct=new Map;function lt(e){if(ct.has(e.name))throw ReferenceError(`Type is already registered: ${e.name}`);ct.set(e.name,e)}const ut=Symbol(`DataView`);function dt(e){return e[ut]??=new DataView(e),e[ut]}const ft={name:`int8`,size:1,array:Int8Array,get:(e,t)=>dt(e).getInt8(t),set:(e,t,n)=>dt(e).setInt8(t,n)},pt={name:`uint8`,size:1,array:Uint8Array,get:(e,t)=>dt(e).getUint8(t),set:(e,t,n)=>dt(e).setUint8(t,n)},mt={int8:ft,uint8:pt,int16:{name:`int16`,size:2,array:Int16Array,get:(e,t)=>dt(e).getInt16(t,!0),set:(e,t,n)=>dt(e).setInt16(t,n,!0)},uint16:{name:`uint16`,size:2,array:Uint16Array,get:(e,t)=>dt(e).getUint16(t,!0),set:(e,t,n)=>dt(e).setUint16(t,n,!0)},int32:{name:`int32`,size:4,array:Int32Array,get:(e,t)=>dt(e).getInt32(t,!0),set:(e,t,n)=>dt(e).setInt32(t,n,!0)},uint32:{name:`uint32`,size:4,array:Uint32Array,get:(e,t)=>dt(e).getUint32(t,!0),set:(e,t,n)=>dt(e).setUint32(t,n,!0)},int64:{name:`int64`,size:8,array:BigInt64Array,get:(e,t)=>dt(e).getBigInt64(t,!0),set:(e,t,n)=>dt(e).setBigInt64(t,n,!0)},uint64:{name:`uint64`,size:8,array:BigUint64Array,get:(e,t)=>dt(e).getBigUint64(t,!0),set:(e,t,n)=>dt(e).setBigUint64(t,n,!0)},float32:{name:`float32`,size:4,array:Float32Array,get:(e,t)=>dt(e).getFloat32(t,!0),set:(e,t,n)=>dt(e).setFloat32(t,n,!0)},float64:{name:`float64`,size:8,array:Float64Array,get:(e,t)=>dt(e).getFloat64(t,!0),set:(e,t,n)=>dt(e).setFloat64(t,n,!0)}},ht=Object.keys(mt);for(let e of Object.values(mt))lt(e);const gt={...mt,...Object.fromEntries(ht.map(e=>[C(e),mt[e]])),char:pt},_t=Object.keys(gt);function vt(e){return _t.includes(e.toString())}function yt(e){if(!vt(e))throw P(`EINVAL`,`Not a valid primitive type: `+e)}function bt(e){return e==`char`?`uint8`:e.toLowerCase()}function xt(e){return(typeof e==`object`||typeof e==`function`)&&e!==null&&`toInit`in e&&typeof e.toInit==`function`}function St(e){return xt(e)?e.toInit():st(e)?{type:e}:e}function Ct(e,t,n={}){if(!e)throw P(`EINVAL`,`Invalid name for struct field`);typeof e==`symbol`&&console.warn(`Symbol used for struct field name will be coerced to string: `+e.toString());let r=e.toString(),i=Object.assign(St(t),n);if(!st(i.type))throw P(`EINVAL`,`Invalid type for struct field "${r}"`);let a=i.countedBy?` counted_by(${typeof i.countedBy==`string`?i.countedBy:`<function>`})`:``;return{name:r,offset:0,type:i.type,countedBy:i.countedBy,alignment:i.align??i.type.size,decl:i.type instanceof zt?`${i.typeName??i.type.type.name} ${r}[${i.type.length}]${a}`:`${i.typeName??i.type.name} ${r}`,littleEndian:!i.bigEndian}}function wt(e,t){if(!(e instanceof Error)||e.message.toLowerCase()!==`offset is outside the bounds of the dataview`)throw e;let n=P(`EFAULT`,`Segmentation fault (at 0x${t.toString(16)})`);throw Error.captureStackTrace(n,wt),n}function Tt(e,t){return t.type instanceof zt&&t.type.length==0&&!!t.countedBy?.length&&!!e.constructor.isDynamic}function Et(e,t){let n=typeof t.countedBy==`function`?t.countedBy(e):e[t.countedBy];if(typeof n==`bigint`){if(n>BigInt(2**53-1))throw P(`EOVERFLOW`,`countedBy field value exceeds max safe integer`);n=Number(n)}if(typeof n!=`number`)throw P(`EINVAL`,`countedBy field value is not a number`);return n}function Dt(e,t){let n=t.type.type.size*Et(e,t);if(Nt(t.type.type)&&t.type.type.isDynamic)for(let r of e[t.name])n+=Pt(r);return n}const Ot=Symbol(`kOffsets`);function kt(e,t,n){let{offset:r,name:i}=t;e[Ot]||=Object.create(null);let a=e[Ot];if(a[i]!==void 0){if(n)return a[i];delete a[i]}let{fields:o}=e.constructor,s=o.indexOf(t);for(let t of o.slice(0,s)){Tt(e,t)&&(r+=Dt(e,t));let n=e[t.name];Mt(n)&&n.constructor.isDynamic&&(r+=Pt(n))}if(n)a[i]=r;else for(let e of o.slice(s))a[e.name]!==void 0&&delete a[e.name];return r}function At(e,t,n,r){typeof n==`string`&&(n=n.charCodeAt(0));let i=e.byteOffset+kt(e,t,!1)+(r??0)*t.type.size;try{t.type.set(e.buffer,i,n);return}catch(e){wt(e,i)}}function jt(e,t){let n=t.type;if(Tt(e,t)){let r=t.type.type;n=new zt(r,Et(e,t))}let r=e.byteOffset+kt(e,t,!0);try{return n.get(e.buffer,r)}catch(e){wt(e,r)}}function Mt(e){return typeof e==`object`&&!!e&&`constructor`in e&&Nt(e.constructor)}function Nt(e){return typeof e==`function`&&`prototype`in e&&`fields`in e&&typeof e.fields==`object`&&st(e)}function Pt(e){let t=0;for(let n of e.constructor.fields){let r=e[n.name];Tt(e,n)&&(t+=Dt(e,n)),Mt(r)&&r.constructor.isDynamic&&(t+=Pt(r))}return t}function Ft(e){if(st(e))return e.size;if(e==null)return 0;if(typeof e==`object`&&st(e.constructor))return e.constructor.size;if(Array.isArray(e)){let t=0;for(let n=0;n<e.length;n++)t+=Ft(e[n]);return t}if(typeof e==`string`)return yt(e),mt[bt(e)].size;throw TypeError(`Unable to resolve size of \`${e.toString()}\``)}function V(e){let t=Ft(e);return Mt(e)&&e.constructor.isDynamic?t+Pt(e):t}function It(e,t){let n;if(Nt(e)){if(e.isDynamic)throw P(`EINVAL`,`Cannot get offset of field in dynamic struct from the constructor`);n=e}else if(Mt(e))n=e.constructor;else throw P(`EINVAL`,`Type is not a struct or struct constructor`);let{fields:r}=n,i=r.find(e=>e.name===t);if(!i)throw P(`EINVAL`,`Struct does not have field: `+t);return Nt(e)?i.offset:kt(e,i,!0)}function Lt(e,t){class n extends DataView{length;type=e;*[Symbol.iterator](){for(let e=0;e<this.length;e++)yield this[e]}_offsets=[0];offsetOf(t){if(!e.isDynamic)return t*e.size;if(t<this._offsets.length)return this._offsets[t];for(let n=this._offsets.length;n<=t;n++)this._offsets[n]=this._offsets[n-1]+V(e.get(this.buffer,this.byteOffset+this._offsets[n-1]));return this._offsets[t]}constructor(n,r,i){let a=typeof n==`object`?n:new ArrayBuffer((n??0)*e.size);super(a,r,i),this.length=typeof n==`number`?n:e.isDynamic?t??y(`Unknown length of StructArray<${e.name}>`):Math.floor(this.byteLength/e.size);let o=e=>this.byteOffset+this.offsetOf(e);return new Proxy(this,{get(t,n){if(n in t)return t[n];let r=parseInt(n.toString());if(Number.isSafeInteger(r))return e.get(t.buffer,o(r))},set(t,n,r){let i=parseInt(n.toString());return Number.isSafeInteger(i)?(e.set(t.buffer,o(i),r),!0):!1}})}}for(let e of Object.getOwnPropertyNames(DataView.prototype))!e.startsWith(`get`)&&!e.startsWith(`set`)||Object.defineProperty(n.prototype,e,{enumerable:!1,configurable:!1,writable:!1,value:void 0});return n}function Rt(e){return typeof e==`function`&&`prototype`in e&&`fields`in e&&typeof e.fields==`object`&&st(e)}var zt=class{type;length;name;size;__structArray;__arrayType;__isArrayType=!0;constructor(e,t){this.type=e,this.length=t,this.name=`${e.name}[${t}]`,this.size=e.size*t,this.array=Lt(this),this.__structArray=Lt(e,t),this.__arrayType=e.array?e.array:this.__structArray}get=(e,t)=>vt(this.type.name)&&t%this.type.size!==0?new this.__structArray(e,t,this.size):new this.__arrayType(e,t,this.size);set=(e,t,n)=>{if(this.length)for(let r=0;r<this.length;r++)this.type.set(e,t+r*this.type.size,n[r]);else{let r=t;for(let t=0;t<n.length;t++)this.type.set(e,r,n[t]),r+=Rt(this.type)&&this.type.isDynamic?V(n[t]):this.type.size}};array};Symbol.metadata??=Symbol.for(`Symbol.metadata`);function Bt(e){e.metadata??={};let t=e.metadata.structInit??{};return e.metadata.structInit={fields:[...t.fields??[]]},e.metadata.structInit}function Vt(...e){let t=e.reduce((e,t)=>({...e,...t}),{});return typeof this==`object`&&Object.assign(t,this),function(e,n){let r=Bt(n),i=1,a=[],o=0,s=e=>{o=Math.ceil(o/e)*e};for(let e of r.fields)t.isPacked||s(e.alignment),t.isUnion?o=Math.max(o,e.type.size):(e.offset=o,o+=e.type.size),a.push(e),i=Math.max(i,e.alignment);t.alignment??=i,t.isPacked||s(t.alignment);class c extends e{static name=e.name;static size=o;static alignment=t.alignment;static isUnion=!!t.isUnion;static isDynamic=!!t.isDynamic;static fields=a;static get(e,t){return new this(e,t)}static set(e,t,n){let r=new Uint8Array(n.buffer,n.byteOffset,this.size),i=new Uint8Array(e,t,this.size);if(n.buffer!==e||n.byteOffset!==t)for(let e=0;e<this.size;e++)i[e]=r[e]}static[Symbol.toStringTag]=`[struct ${e.name}]`;constructor(...e){e.length||(e=[new ArrayBuffer(o),0,o]),super(...e);for(let e of Object.values(a))Object.defineProperty(this,e.name,{enumerable:!0,configurable:!0,get(){return jt(this,e)},set(t){At(this,e,t)}})}}return n.addInitializer(function(){Object.defineProperty(c,"name",{value:e.name}),lt(c)}),c}}Vt.packed=Vt.bind({isPacked:!0}),Vt.align=function(e){return Vt.bind({alignment:e})};function Ht(e,t={}){return function(n,r){if(r.kind!=`accessor`)throw P(`EINVAL`,`Field must be an accessor`);let i=Bt(r),a=Ct(r.name,e,t);return i.fields.push(a),{get(){return jt(this,a)},set(e){At(this,a,e)}}}}function Ut(e){let t=mt[bt(e)];function n(n,r){return typeof n==`number`?Ht(new zt(t,n),{typeName:e,...r}):Ht(t,{typeName:e})(n,r&&`name`in r?r:y(P(`EINVAL`,`Invalid decorator context object`)))}return n}const H=Object.fromEntries(_t.map(e=>[e,Ut(e)]));function Wt(e){return e}Wt.typed=function(e){return e};var Gt=class e{type;init;constructor(t,n){this.type=t,this.init=n;let r=(r=>new e(new zt(t,r),n));return Object.setPrototypeOf(r,new.target.prototype),Object.assign(r,{type:t,init:n}),r}align(t){return new e(this.type,{...this.init,align:t})}countedBy(t){return new e(this.type,{...this.init,countedBy:t})}bigEndian(){return new e(this.type,{...this.init,bigEndian:!0})}toInit(){return{type:this.type,...this.init}}$type(){return new e(this.type,this.init)}};function Kt(e,t=0){return new Gt(new zt(e,t),{})}function qt(e,t,...n){let r=n.reduce((e,t)=>({...e,...t}),{});typeof this==`object`&&Object.assign(r,this);let i=1,a=0,o=e=>{a=Math.ceil(a/e)*e},s=[];for(let[e,n]of Object.entries(t)){if(typeof e==`number`)throw TypeError(`Field names can not be numbers`);let t=Ct(e,n);r.isPacked||o(t.alignment),r.isUnion?a=Math.max(a,t.type.size):(t.offset=a,a+=t.type.size),s.push(t),i=Math.max(i,t.alignment)}r.alignment??=i,r.isPacked||o(r.alignment);class c extends DataView{static name=e;static size=a;static alignment=r.alignment;static isUnion=!!r.isUnion;static isDynamic=!!r.isDynamic;static fields=s;static get(e,t){return new this(e,t)}static set(e,t,n){let r=new Uint8Array(n.buffer,n.byteOffset,this.size),i=new Uint8Array(e,t,this.size);if(n.buffer!==e||n.byteOffset!==t)for(let e=0;e<this.size;e++)i[e]=r[e]}static[Symbol.toStringTag]=`[struct ${e}]`;constructor(e=new ArrayBuffer(a),t,n){super(e,t,n??e.byteLength-(t??0));for(let e of Object.values(this.constructor.fields??s))Object.defineProperty(this,e.name,{enumerable:!0,configurable:!0,get(){return jt(this,e)},set(t){At(this,e,t)}})}}for(let e of Object.getOwnPropertyNames(DataView.prototype))!e.startsWith(`get`)&&!e.startsWith(`set`)||Object.defineProperty(c.prototype,e,{enumerable:!1,configurable:!1,writable:!1,value:void 0});return lt(c),c}qt.extend=function(e,t,n,...r){let i=r.reduce((e,t)=>({...e,...t}),{});typeof this==`object`&&Object.assign(i,this);let a=1,o=e.size,s=e=>{o=Math.ceil(o/e)*e},c=e.fields;for(let[e,t]of Object.entries(n)){if(typeof e==`number`)throw TypeError(`Field names can not be numbers`);let n=Ct(e,t);i.isPacked||s(n.alignment),i.isUnion?o=Math.max(o,n.type.size):(n.offset=o,o+=n.type.size),c.push(n),a=Math.max(a,n.alignment)}i.alignment??=a,i.isPacked||s(i.alignment);class l extends e{static name=t;static size=o;static alignment=i.alignment;static isUnion=!!i.isUnion;static isDynamic=!!i.isDynamic;static fields=c;static[Symbol.toStringTag]=`[struct ${t}]`}return lt(l),l},qt.packed=qt.bind({isPacked:!0}),qt.align=function(e){return qt.bind({alignment:e})},qt.dynamic=qt.bind({isDynamic:!0}),Object.fromEntries(Object.entries(gt).map(([e,t])=>[e,new Gt(t,{typeName:e})]));function Jt(e){return JSON.parse(E(e),(e,t)=>e==``?t:typeof t==`string`?BigInt(t).toString(16).slice(0,Math.min(t.length,8)):t)}function Yt(e){return T(JSON.stringify(e))}function Xt(e,t){if(typeof e==`number`)return e;if(typeof e==`string`){let t=parseInt(e,8);if(!isNaN(t))return t}if(typeof t==`number`)return t;throw P(`EINVAL`,`Invalid mode: `+e?.toString())}const Zt=2147483647;function Qt(e){if(!(Number.isInteger(e)&&e>=0&&e<=Zt))throw Object.assign(RangeError(`The value of "fd" is out of range. It must be >= 0 && <= ${Zt}. Received ${e}`),{code:`ERR_OUT_OF_RANGE`})}function $t(e){if(e instanceof Date)return e.getTime();let t=Number(e);if(!Number.isFinite(t))throw P(`EINVAL`,`Invalid time.`);return t<0?Date.now():t*1e3}function U(e,t=!1){if(e instanceof URL){if(e.protocol!=`file:`)throw P(`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 P(`EINVAL`,`Path can not contain null character`);if(e.length==0)throw P(`EINVAL`,`Path can not be empty`);return e=e.replaceAll(/[/\\]+/g,`/`),t?e:ln.call(this,e)}function en(e,t=`utf8`,n,r=0){return typeof e!=`object`||!e?{encoding:typeof e==`string`?e:t??null,flag:n,mode:r}:{encoding:typeof e?.encoding==`string`?e.encoding:t??null,flag:typeof e?.flag==`string`?e.flag:n,mode:Xt(`mode`in e?e?.mode:null,r)}}function tn(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 nn(e){let t=Promise.withResolvers();setTimeout(()=>t.reject(P(`ETIMEDOUT`)),500),e.on(`online`,t.resolve),await t.promise}function rn(e){return`${U(e,!0)}${Date.now()}-${Math.random().toString(36).slice(2)}`}var an=t({basename:()=>pn,dirname:()=>G,extname:()=>mn,format:()=>hn,formatExt:()=>cn,isAbsolute:()=>dn,join:()=>W,matchesGlob:()=>_n,normalize:()=>un,normalizeString:()=>sn,parse:()=>gn,relative:()=>fn,resolve:()=>ln,sep:()=>`/`});function on(e,t){if(typeof e!=`object`)throw TypeError(`"${t}" is not an object`)}function sn(e,t){let n=``,r=0,i=-1,a=0,o=`\0`;for(let s=0;s<=e.length;++s){if(s<e.length)o=e[s];else if(o==`/`)break;else o=`/`;if(o==`/`){if(i!==s-1&&a!==1)if(a===2){if(n.length<2||r!==2||n.at(-1)!==`.`||n.at(-2)!==`.`){if(n.length>2){let e=n.lastIndexOf(`/`);e===-1?(n=``,r=0):(n=n.slice(0,e),r=n.length-1-n.lastIndexOf(`/`)),i=s,a=0;continue}if(n.length!==0){n=``,r=0,i=s,a=0;continue}}t&&(n+=n.length>0?`/..`:`..`,r=2)}else n.length>0?n+=`/`+e.slice(i+1,s):n=e.slice(i+1,s),r=s-i-1;i=s,a=0}else o===`.`&&a!==-1?++a:a=-1}return n}function cn(e){return e?`${e[0]===`.`?``:`.`}${e}`:``}function ln(...e){let t=``;for(let n of[...e.reverse(),Ie(this).pwd])if(n?.length&&(t=`${n}/${t}`,n.startsWith(`/`)))break;let n=t.startsWith(`/`);return t=sn(t,!n),n?`/${t}`:t.length?t:`/`}function un(e){if(!e.length)return`.`;let t=e[0]===`/`,n=e.at(-1)===`/`;return e=sn(e,!t),e.length?(n&&(e+=`/`),t?`/${e}`:e):t?`/`:n?`./`:`.`}function dn(e){return e.startsWith(`/`)}function W(...e){if(!e.length)return`.`;let t=e.filter(e=>e).join(`/`);return t?.length?un(t):`.`}function fn(e,t){if(e===t||(e=ln.call(this,e),t=ln.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 G(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 pn(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 mn(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 hn(e){on(e,`pathObject`);let t=e.dir||e.root,n=e.base||`${e.name||``}${cn(e.ext)}`;return t?t===e.root?`${t}${n}`:`${t}/${n}`:n}function gn(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 _n(e,t){return tn(e).test(t)}const vn=BigInt(1e3);var yn=class{_convert(e){return this._isBigint?BigInt(e):Number(e)}get blocks(){return this._convert(Math.ceil(Number(this.size)/512))}set blocks(e){}mode;dev=this._convert(0);ino=this._convert(0);rdev=this._convert(0);nlink=this._convert(1);blksize=this._convert(4096);uid=this._convert(0);gid=this._convert(0);atimeMs;get atime(){return new Date(Number(this.atimeMs))}set atime(e){this.atimeMs=this._convert(e.getTime())}mtimeMs;get mtime(){return new Date(Number(this.mtimeMs))}set mtime(e){this.mtimeMs=this._convert(e.getTime())}ctimeMs;get ctime(){return new Date(Number(this.ctimeMs))}set ctime(e){this.ctimeMs=this._convert(e.getTime())}birthtimeMs;get birthtime(){return new Date(Number(this.birthtimeMs))}set birthtime(e){this.birthtimeMs=this._convert(e.getTime())}size;data;flags;version;constructor({atimeMs:e,mtimeMs:t,ctimeMs:n,birthtimeMs:r,uid:i,gid:a,size:o,mode:s,ino:c,...l}={}){let u=Date.now();this.atimeMs=this._convert(e??u),this.mtimeMs=this._convert(t??u),this.ctimeMs=this._convert(n??u),this.birthtimeMs=this._convert(r??u),this.uid=this._convert(i??0),this.gid=this._convert(a??0),this.size=this._convert(o??0),this.ino=this._convert(c??0),this.mode=this._convert(s??0),this.mode&61440||(this.mode|=this._convert(Qe)),Object.assign(this,l)}isFile(){return(this.mode&Ye)==Qe}isDirectory(){return(this.mode&Ye)==et}isSymbolicLink(){return(this.mode&Ye)==Ze}isSocket(){return(this.mode&Ye)==Xe}isBlockDevice(){return(this.mode&Ye)==$e}isCharacterDevice(){return(this.mode&Ye)==tt}isFIFO(){return(this.mode&Ye)==nt}toJSON(){return p(this,kn)}hasAccess(e,t){return Y(t,this._isBigint?new bn(this):this,e)}get atimeNs(){return BigInt(this.atimeMs)*vn}get mtimeNs(){return BigInt(this.mtimeMs)*vn}get ctimeNs(){return BigInt(this.ctimeMs)*vn}get birthtimeNs(){return BigInt(this.birthtimeMs)*vn}},bn=class extends yn{_isBigint=!1},xn=class extends yn{_isBigint=!0};function Sn(e,t){return e.size==t.size&&+e.atime==+t.atime&&+e.mtime==+t.mtime&&+e.ctime==+t.ctime&&e.mode==t.mode}var Cn=class{type=525687744115;bsize=4096;blocks=0;bfree=0;bavail=0;files=at;ffree=at},wn=class{type=BigInt(`0x7a656e6673`);bsize=BigInt(4096);blocks=BigInt(0);bfree=BigInt(0);bavail=BigInt(0);files=BigInt(at);ffree=BigInt(at)},Tn=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},K=function(e,t,n){for(var r=arguments.length>2,i=0;i<t.length;i++)n=r?t[i].call(e,n):t[i].call(e);return r?n:void 0};const En=3968;let Dn=(()=>{var e,t;let n=[Vt.packed()],r,i=[],a,o=Wt.typed(Uint8Array),s,c=[],l=[],u,d=[],f=[];var p=class extends o{static{a=this}static{let m=typeof Symbol==`function`&&Symbol.metadata?Object.create(o[Symbol.metadata]??null):void 0;s=[(e=H).uint32.bind(e)],u=[(t=H).uint32.bind(t)],Tn(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),Tn(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),Tn(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=K(this,c,void 0);get keySize(){return this.#e}set keySize(e){this.#e=e}#t=(K(this,l),K(this,d,void 0));get valueSize(){return this.#t}set valueSize(e){this.#t=e}get name(){return E(this.subarray(8,8+this.keySize))}set name(e){let t=T(e);if(8+t.length+this.valueSize>En)throw P(`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>En)throw P(`EOVERFLOW`);this.valueSize=e.length,this.set(e,8+this.keySize)}get size(){return 8+this.keySize+this.valueSize}constructor(){super(...arguments),K(this,f)}static{K(a,i)}};return a})(),On=(()=>{var e;let t=[Vt.packed()],n,r=[],i,a=Wt(o),s,c=[],l=[];var u=class extends a{static{i=this}static{let o=typeof Symbol==`function`&&Symbol.metadata?Object.create(a[Symbol.metadata]??null):void 0;s=[(e=H).uint32.bind(e)],Tn(this,null,s,{kind:`accessor`,name:`size`,static:!1,private:!1,access:{has:e=>`size`in e,get:e=>e.size,set:(e,t)=>{e.size=t}},metadata:o},c,l),Tn(null,n={value:i},t,{kind:`class`,name:i.name,metadata:o},null,r),u=i=n.value,o&&Object.defineProperty(i,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:o})}static name=`Attributes`;#e=K(this,c,void 0);get size(){return this.#e}set size(e){this.#e=e}get byteSize(){let e=this.byteOffset+V(this);for(let t=0;t<this.size;t++){let t=new Dn(this.buffer,e);e+=t.size}return e}has(e){let t=this.byteOffset+V(this);for(let n=0;n<this.size;n++){let n=new Dn(this.buffer,t);if(n.name==e)return!0;t+=n.size}return!1}get(e){let t=this.byteOffset+V(this);for(let n=0;n<this.size;n++){let n=new Dn(this.buffer,t);if(n.name==e)return n.value;t+=n.size}}set(e,t){let n=this.byteOffset+V(this),r;for(let t=0;t<this.size;t++){let t=new Dn(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 Dn(this.buffer,n);a.name=e,a.value=t,this.size++}remove(e){let t=this.byteOffset+V(this),n;for(let r=0;r<this.size;r++){let r=new Dn(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+V(this);for(let t=0;t<this.size;t++){let t=new Dn(this.buffer,e);yield t.name,e+=t.size}}*values(){let e=this.byteOffset+V(this);for(let t=0;t<this.size;t++){let t=new Dn(this.buffer,e);yield t.value,e+=t.size}}*entries(){let e=this.byteOffset+V(this);for(let t=0;t<this.size;t++){let t=new Dn(this.buffer,e);yield[t.name,t.value],e+=t.size}}constructor(){super(...arguments),K(this,l)}static{K(i,r)}};return i})();const kn=[`ino`,`data`,`size`,`mode`,`flags`,`nlink`,`uid`,`gid`,`atimeMs`,`birthtimeMs`,`mtimeMs`,`ctimeMs`,`version`];var An;(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`})(An||={});let q=(()=>{var e,t,n,r,i,a,s,c,l,u,d,f,m,h,g,_;let v=[Vt.packed()],y,b=[],x,S=Wt(o),C,w=[],T=[],ee,E=[],te=[],ne,D=[],O=[],k,A=[],j=[],M,N=[],F=[],re,I=[],L=[],ie,R=[],ae=[],oe,se=[],ce=[],z,ue=[],de=[],fe,pe=[],me=[],he,ge=[],_e=[],ve,ye=[],be=[],xe,Se=[],Ce=[],we,Te=[],Ee=[],De,Oe=[],ke=[],Ae,je=[],Me=[],Ne,Pe=[],Fe=[],Ie,Le=[],Re=[],ze,Be=[],Ve=[];var He=class extends S{static{x=this}static{let o=typeof Symbol==`function`&&Symbol.metadata?Object.create(S[Symbol.metadata]??null):void 0;C=[(e=H).uint32.bind(e)],ee=[(t=H).uint32.bind(t)],ne=[(n=H).uint32.bind(n)],k=[(r=H).uint16.bind(r)],M=[(i=H).uint32.bind(i)],re=[(a=H).uint32.bind(a)],ie=[(s=H).uint32.bind(s)],oe=[(c=H).float64.bind(c)],z=[(l=H).float64.bind(l)],fe=[(u=H).float64.bind(u)],he=[(d=H).float64.bind(d)],ve=[(f=H).uint32.bind(f)],xe=[(m=H).uint32.bind(m)],we=[(h=H).uint32.bind(h)],De=[(g=H).uint16.bind(g)],Ae=[(_=H).uint32.bind(_)],Ne=[H.uint8(48)],Ie=[Ht(On)],ze=[H.uint8(En)],Tn(this,null,C,{kind:`accessor`,name:`data`,static:!1,private:!1,access:{has:e=>`data`in e,get:e=>e.data,set:(e,t)=>{e.data=t}},metadata:o},w,T),Tn(this,null,ee,{kind:`accessor`,name:`__data_old`,static:!1,private:!1,access:{has:e=>`__data_old`in e,get:e=>e.__data_old,set:(e,t)=>{e.__data_old=t}},metadata:o},E,te),Tn(this,null,ne,{kind:`accessor`,name:`size`,static:!1,private:!1,access:{has:e=>`size`in e,get:e=>e.size,set:(e,t)=>{e.size=t}},metadata:o},D,O),Tn(this,null,k,{kind:`accessor`,name:`mode`,static:!1,private:!1,access:{has:e=>`mode`in e,get:e=>e.mode,set:(e,t)=>{e.mode=t}},metadata:o},A,j),Tn(this,null,M,{kind:`accessor`,name:`nlink`,static:!1,private:!1,access:{has:e=>`nlink`in e,get:e=>e.nlink,set:(e,t)=>{e.nlink=t}},metadata:o},N,F),Tn(this,null,re,{kind:`accessor`,name:`uid`,static:!1,private:!1,access:{has:e=>`uid`in e,get:e=>e.uid,set:(e,t)=>{e.uid=t}},metadata:o},I,L),Tn(this,null,ie,{kind:`accessor`,name:`gid`,static:!1,private:!1,access:{has:e=>`gid`in e,get:e=>e.gid,set:(e,t)=>{e.gid=t}},metadata:o},R,ae),Tn(this,null,oe,{kind:`accessor`,name:`atimeMs`,static:!1,private:!1,access:{has:e=>`atimeMs`in e,get:e=>e.atimeMs,set:(e,t)=>{e.atimeMs=t}},metadata:o},se,ce),Tn(this,null,z,{kind:`accessor`,name:`birthtimeMs`,static:!1,private:!1,access:{has:e=>`birthtimeMs`in e,get:e=>e.birthtimeMs,set:(e,t)=>{e.birthtimeMs=t}},metadata:o},ue,de),Tn(this,null,fe,{kind:`accessor`,name:`mtimeMs`,static:!1,private:!1,access:{has:e=>`mtimeMs`in e,get:e=>e.mtimeMs,set:(e,t)=>{e.mtimeMs=t}},metadata:o},pe,me),Tn(this,null,he,{kind:`accessor`,name:`ctimeMs`,static:!1,private:!1,access:{has:e=>`ctimeMs`in e,get:e=>e.ctimeMs,set:(e,t)=>{e.ctimeMs=t}},metadata:o},ge,_e),Tn(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:o},ye,be),Tn(this,null,xe,{kind:`accessor`,name:`__ino_old`,static:!1,private:!1,access:{has:e=>`__ino_old`in e,get:e=>e.__ino_old,set:(e,t)=>{e.__ino_old=t}},metadata:o},Se,Ce),Tn(this,null,we,{kind:`accessor`,name:`flags`,static:!1,private:!1,access:{has:e=>`flags`in e,get:e=>e.flags,set:(e,t)=>{e.flags=t}},metadata:o},Te,Ee),Tn(this,null,De,{kind:`accessor`,name:`__after_flags`,static:!1,private:!1,access:{has:e=>`__after_flags`in e,get:e=>e.__after_flags,set:(e,t)=>{e.__after_flags=t}},metadata:o},Oe,ke),Tn(this,null,Ae,{kind:`accessor`,name:`version`,static:!1,private:!1,access:{has:e=>`version`in e,get:e=>e.version,set:(e,t)=>{e.version=t}},metadata:o},je,Me),Tn(this,null,Ne,{kind:`accessor`,name:`__padding`,static:!1,private:!1,access:{has:e=>`__padding`in e,get:e=>e.__padding,set:(e,t)=>{e.__padding=t}},metadata:o},Pe,Fe),Tn(this,null,Ie,{kind:`accessor`,name:`attributes`,static:!1,private:!1,access:{has:e=>`attributes`in e,get:e=>e.attributes,set:(e,t)=>{e.attributes=t}},metadata:o},Le,Re),Tn(this,null,ze,{kind:`accessor`,name:`__data`,static:!1,private:!1,access:{has:e=>`__data`in e,get:e=>e.__data,set:(e,t)=>{e.__data=t}},metadata:o},Be,Ve),Tn(null,y={value:x},v,{kind:`class`,name:x.name,metadata:o},null,b),He=x=y.value,o&&Object.defineProperty(x,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:o})}static name=`Inode`;constructor(...e){let t={};if(typeof e[0]==`object`&&e[0]!==null&&!ArrayBuffer.isView(e[0])&&(t=e[0],e=[V(He)]),e[0]instanceof He&&(e=[new Uint8Array(e[0].buffer,e[0].byteOffset,e[0].byteLength)]),super(...e),K(this,Ve),this.byteLength<V(He))throw le(P(`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&&B(`Inode ${this.ino} has an nlink of 0`)}#e=K(this,w,void 0);get data(){return this.#e}set data(e){this.#e=e}#t=(K(this,T),K(this,E,void 0));get __data_old(){return this.#t}set __data_old(e){this.#t=e}#n=(K(this,te),K(this,D,void 0));get size(){return this.#n}set size(e){this.#n=e}#r=(K(this,O),K(this,A,void 0));get mode(){return this.#r}set mode(e){this.#r=e}#i=(K(this,j),K(this,N,void 0));get nlink(){return this.#i}set nlink(e){this.#i=e}#a=(K(this,F),K(this,I,void 0));get uid(){return this.#a}set uid(e){this.#a=e}#o=(K(this,L),K(this,R,void 0));get gid(){return this.#o}set gid(e){this.#o=e}#s=(K(this,ae),K(this,se,void 0));get atimeMs(){return this.#s}set atimeMs(e){this.#s=e}#c=(K(this,ce),K(this,ue,void 0));get birthtimeMs(){return this.#c}set birthtimeMs(e){this.#c=e}#l=(K(this,de),K(this,pe,void 0));get mtimeMs(){return this.#l}set mtimeMs(e){this.#l=e}#u=(K(this,me),K(this,ge,void 0));get ctimeMs(){return this.#u}set ctimeMs(e){this.#u=e}#d=(K(this,_e),K(this,ye,void 0));get ino(){return this.#d}set ino(e){this.#d=e}#f=(K(this,be),K(this,Se,void 0));get __ino_old(){return this.#f}set __ino_old(e){this.#f=e}#p=(K(this,Ce),K(this,Te,void 0));get flags(){return this.#p}set flags(e){this.#p=e}#m=(K(this,Ee),K(this,Oe,void 0));get __after_flags(){return this.#m}set __after_flags(e){this.#m=e}#h=(K(this,ke),K(this,je,void 0));get version(){return this.#h}set version(e){this.#h=e}#g=(K(this,Me),K(this,Pe,void 0));get __padding(){return this.#g}set __padding(e){this.#g=e}#_=(K(this,Fe),K(this,Le,void 0));get attributes(){return this.#_}set attributes(e){this.#_=e}#v=(K(this,Re),K(this,Be,void 0));get __data(){return this.#v}set __data(e){this.#v=e}toString(){return`<Inode ${this.ino}>`}toJSON(){return{...p(this,kn),attributes:this.attributes}}toStats(){return new bn(this)}update(e){if(!e)return!1;let t=!1;for(let n of kn)e[n]!==void 0&&n!=`ino`&&n!=`data`&&this[n]!==e[n]&&(n==`atimeMs`&&this.flags&An.NoAtime||(this[n]=e[n],t=!0));return e.attributes&&(this.attributes.copyFrom(e.attributes),t=!0),t&&(this.ctimeMs=Date.now()),t}static{K(x,b)}};return He=x})();function jn(e){return(e.mode&Ye)==Qe}function J(e){return(e.mode&Ye)==et}function Mn(e){return(e.mode&Ye)==Ze}function Nn(e){return(e.mode&Ye)==Xe}function Pn(e){return(e.mode&Ye)==$e}function Fn(e){return(e.mode&Ye)==tt}function In(e){return(e.mode&Ye)==nt}function Y(e,t,n){let{credentials:r}=Ie(e);if(Mn(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 Ln(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 Rn=class e extends Map{maxSize=at;toJSON(){return{version:1,maxSize:this.maxSize,entries:Object.fromEntries([...this].map(([e,t])=>[e,t.toJSON()]))}}toString(){return JSON.stringify(this.toJSON())}get byteSize(){let e=this.size*V(q);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 P(`ENOENT`);if((t.mode&61440)!=16384)throw P(`ENOTDIR`);let n={};for(let t of this.keys())G(t)==e&&t!=e&&(n[pn(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())G(e)==t&&e!=t&&(r[pn(e)]=this.get(e).ino);e.set(t,r)}return e}fromJSON(e){if(e.version!=1)throw P(`EINVAL`,`Index version mismatch`);this.clear();for(let[t,n]of Object.entries(e.entries))n.data??=S(1,at),t==`/`&&(n.ino=0),this.set(t,new q(n));return this}static parse(t){if(!h(t))throw P(`EINVAL`,`Invalid JSON`);let n=JSON.parse(t),r=new e;return r.fromJSON(n),r}};const zn=4096;var Bn=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 P(`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+=zn){let r=t+zn>a?a-t:zn,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??=(B(`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??=(B(`Using a polyfill of Symbol.dispose`),Symbol(`Symbol.dispose`)),Symbol.asyncDispose??=(B(`Using a polyfill of Symbol.asyncDispose`),Symbol(`Symbol.asyncDispose`)),globalThis.crypto.randomUUID??=(B(`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??=(B(`Using a polyfill of Uint8Array.prototype.toBase64`),function(){return btoa(String.fromCharCode(...this))}),Uint8Array.fromBase64??=(B(`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??=(B(`Using a polyfill of Uint8Array.prototype.toHex`),function(){return[...this].map(e=>e.toString(16).padStart(2,`0`)).join(``)}),Uint8Array.fromHex??=(B(`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 Vn=class{store;constructor(e){this.store=e}},Hn=class extends Vn{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)}},Un=class extends Vn{asyncDone=Promise.resolve();async(e){this.asyncDone=this.asyncDone.then(()=>e)}_cached(e,t){this.store.cache??=new Map;let n=this.store.cache.get(e);return n?(t&&(n.size=t.size),n):t?new s(e,t.size,{},this.store.cache):void 0}getSync(e,t,n){let r=this._cached(e);if(!r)return;n??=r.size;let i=r.missing(t,n);for(let{start:t,end:n}of i)this.async(this.get(e,t,n));if(i.length)throw P(`EAGAIN`);let a=r.regionAt(t);if(!a){B(`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)}},Wn=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 Un))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 Un))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)}}},Gn=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},Kn=(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}),qn=class extends Bn{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=fn(e,r);if(a.startsWith(`..`))continue;let o=W(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){B(`Missing paths in table for ino `+r);continue}n.delete(e),n.add(t)}}_initialized=!1;async ready(){this._initialized||=(this.attributes.has(`no_async_preload`)||this.checkRootSync(),await this.checkRoot(),await this._populate(),!0)}readySync(){this._initialized||=(this.attributes.has(`no_async_preload`)||this.checkRootSync(),this.checkRootSync(),this._populateSync(),!0)}constructor(e){super(e.type??1802921587,e.name),this.store=e,e.fs=this,this._uuid=e.uuid??this.uuid,this.label=e.label,fe(this.name+`: supports features: `+this.store.flags?.join(`, `))}usage(){return this.store.usage?.()||{totalSpace:0,freeSpace:0}}async loadIndex(e){let t={stack:[],error:void 0,hasError:!1};try{let n=Gn(t,this.transaction(),!0),r=e.directories();for(let[t,i]of e)this._add(i.ino,t),await n.set(i.ino,i),r.has(t)&&await n.set(i.data,Yt(r.get(t)));await n.commit()}catch(e){t.error=e,t.hasError=!0}finally{let e=Kn(t);e&&await e}}loadIndexSync(e){let t={stack:[],error:void 0,hasError:!1};try{let n=Gn(t,this.transaction(),!1),r=e.directories();for(let[t,i]of e)this._add(i.ino,t),n.setSync(i.ino,i),r.has(t)&&n.setSync(i.data,Yt(r.get(t)));n.commitSync()}catch(e){t.error=e,t.hasError=!0}finally{Kn(t)}}async createIndex(){let e={stack:[],error:void 0,hasError:!1};try{let t=new Rn,n=Gn(e,this.transaction(),!0),r=[[`/`,0]],i=v(P(`EDEADLK`));for(;r.length;){let[e,i]=r.shift(),a=new q(await n.get(i));if(t.set(e,a),a.mode&16384){let t=Jt(await n.get(a.data)??y(P(`ENODATA`)));for(let[n,i]of Object.entries(t))r.push([W(e,n),i])}}return i(),t}catch(t){e.error=t,e.hasError=!0}finally{let t=Kn(e);t&&await t}}createIndexSync(){let e={stack:[],error:void 0,hasError:!1};try{let t=new Rn,n=Gn(e,this.transaction(),!1),r=[[`/`,0]],i=v(P(`EDEADLK`));for(;r.length;){let[e,i]=r.shift(),a=new q(n.getSync(i));if(t.set(e,a),a.mode&16384){let t=Jt(n.getSync(a.data)??y(P(`ENODATA`)));for(let[n,i]of Object.entries(t))r.push([W(e,n),i])}}return i(),t}catch(t){e.error=t,e.hasError=!0}finally{Kn(e)}}async rename(e,t){let n={stack:[],error:void 0,hasError:!1};try{let r=Gn(n,this.transaction(),!0),i=gn(e),a=gn(t),o=await this.findInode(r,i.dir),s=Jt(await r.get(o.data)??y(P(`ENODATA`)));if(!s[i.base])throw P(`ENOENT`);let c=s[i.base];if(c!=this._ids.get(e)&&z(`Ino mismatch while renaming ${e} to ${t}`),delete s[i.base],(a.dir+`/`).startsWith(e+`/`))throw P(`EBUSY`);let l=a.dir==i.dir,u=l?o:await this.findInode(r,a.dir),d=l?s:Jt(await r.get(u.data)??y(P(`ENODATA`)));if(d[a.base]){let e=new q(await r.get(d[a.base])??y(P(`ENOENT`)));if(!jn(e))throw P(`EISDIR`);await r.remove(e.data),await r.remove(d[a.base])}d[a.base]=c,await r.set(o.data,Yt(s)),await r.set(u.data,Yt(d)),await r.commit(),this._move(e,t)}catch(e){n.error=e,n.hasError=!0}finally{let e=Kn(n);e&&await e}}renameSync(e,t){let n={stack:[],error:void 0,hasError:!1};try{let r=Gn(n,this.transaction(),!1),i=gn(e),a=gn(t),o=this.findInodeSync(r,i.dir),s=Jt(r.getSync(o.data)??y(P(`ENODATA`)));if(!s[i.base])throw P(`ENOENT`);let c=s[i.base];if(c!=this._ids.get(e)&&z(`Ino mismatch while renaming ${e} to ${t}`),delete s[i.base],(a.dir+`/`).startsWith(e+`/`))throw P(`EBUSY`);let l=a.dir===i.dir,u=l?o:this.findInodeSync(r,a.dir),d=l?s:Jt(r.getSync(u.data)??y(P(`ENODATA`)));if(d[a.base]){let e=new q(r.getSync(d[a.base])??y(P(`ENOENT`)));if(!jn(e))throw P(`EISDIR`);r.removeSync(e.data),r.removeSync(d[a.base])}d[a.base]=c,r.setSync(o.data,Yt(s)),r.setSync(u.data,Yt(d)),r.commitSync(),this._move(e,t)}catch(e){n.error=e,n.hasError=!0}finally{Kn(n)}}async stat(e){let t={stack:[],error:void 0,hasError:!1};try{let n=Gn(t,this.transaction(),!0);return await this.findInode(n,e)}catch(e){t.error=e,t.hasError=!0}finally{let e=Kn(t);e&&await e}}statSync(e){let t={stack:[],error:void 0,hasError:!1};try{let n=Gn(t,this.transaction(),!1);return this.findInodeSync(n,e)}catch(e){t.error=e,t.hasError=!0}finally{Kn(t)}}async touch(e,t){let n={stack:[],error:void 0,hasError:!1};try{let r=Gn(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=Kn(n);e&&await e}}touchSync(e,t){let n={stack:[],error:void 0,hasError:!1};try{let r=Gn(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{Kn(n)}}async createFile(e,t){return await this.commitNew(e,{...t,mode:t.mode|Qe},new Uint8Array)}createFileSync(e,t){return this.commitNewSync(e,{...t,mode:t.mode|Qe},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 P(`ENOTEMPTY`);await this.remove(e,!0)}rmdirSync(e){if(this.readdirSync(e).length)throw P(`ENOTEMPTY`);this.removeSync(e,!0)}async mkdir(e,t){return await this.commitNew(e,{...t,mode:t.mode|et},T(`{}`))}mkdirSync(e,t){return this.commitNewSync(e,{...t,mode:t.mode|et},T(`{}`))}async readdir(e){let t={stack:[],error:void 0,hasError:!1};try{let n=Gn(t,this.transaction(),!0),r=await this.findInode(n,e);return Object.keys(Jt(await n.get(r.data)??y(P(`ENOENT`))))}catch(e){t.error=e,t.hasError=!0}finally{let e=Kn(t);e&&await e}}readdirSync(e){let t={stack:[],error:void 0,hasError:!1};try{let n=Gn(t,this.transaction(),!1),r=this.findInodeSync(n,e);return Object.keys(Jt(n.getSync(r.data)??y(P(`ENOENT`))))}catch(e){t.error=e,t.hasError=!0}finally{Kn(t)}}async sync(){}syncSync(){}async link(e,t){let n={stack:[],error:void 0,hasError:!1};try{let r=Gn(n,this.transaction(),!0),i=G(t),a=await this.findInode(r,i),o=Jt(await r.get(a.data)??y(P(`ENOENT`))),s=await this.findInode(r,e);s.nlink++,o[pn(t)]=s.ino,this._add(s.ino,t),await r.set(s.ino,s),await r.set(a.data,Yt(o)),await r.commit()}catch(e){n.error=e,n.hasError=!0}finally{let e=Kn(n);e&&await e}}linkSync(e,t){let n={stack:[],error:void 0,hasError:!1};try{let r=Gn(n,this.transaction(),!1),i=G(t),a=this.findInodeSync(r,i),o=Jt(r.getSync(a.data)??y(P(`ENOENT`))),s=this.findInodeSync(r,e);s.nlink++,o[pn(t)]=s.ino,this._add(s.ino,t),r.setSync(s.ino,s),r.setSync(a.data,Yt(o)),r.commitSync()}catch(e){n.error=e,n.hasError=!0}finally{Kn(n)}}async read(e,t,n,r){let i={stack:[],error:void 0,hasError:!1};try{let a=Gn(i,this.transaction(),!0),o=await this.findInode(a,e);if(o.size==0)return;let s=await a.get(o.data,n,r)??y(P(`ENODATA`)),c=a.flag(`partial`)?s:s.subarray(n,r);c.byteLength>t.byteLength&&z(`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=Kn(i);e&&await e}}readSync(e,t,n,r){let i={stack:[],error:void 0,hasError:!1};try{let a=Gn(i,this.transaction(),!1),o=this.findInodeSync(a,e);if(o.size==0)return;let s=a.getSync(o.data,n,r)??y(P(`ENODATA`)),c=a.flag(`partial`)?s:s.subarray(n,r);c.byteLength>t.byteLength&&z(`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{Kn(i)}}async write(e,t,n){let r={stack:[],error:void 0,hasError:!1};try{let i=Gn(r,this.transaction(),!0),o=await this.findInode(i,e),s=n+t.byteLength,c=t;i.flag(`partial`)||(c=a(await i.get(o.data)??new Uint8Array,s),c.set(t,n),n=0),await i.set(o.data,c,n),o.update({size:Math.max(o.size,s),mtimeMs:Date.now()}),await i.set(o.ino,o),this._add(o.ino,e),await i.commit()}catch(e){r.error=e,r.hasError=!0}finally{let e=Kn(r);e&&await e}}writeSync(e,t,n){let r={stack:[],error:void 0,hasError:!1};try{let i=Gn(r,this.transaction(),!1),o=this.findInodeSync(i,e),s=n+t.byteLength,c=t;i.flag(`partial`)||(c=a(i.getSync(o.data)??new Uint8Array,s),c.set(t,n),n=0),i.setSync(o.data,c,n),o.update({size:Math.max(o.size,s),mtimeMs:Date.now()}),i.setSync(o.ino,o),this._add(o.ino,e),i.commitSync()}catch(e){r.error=e,r.hasError=!0}finally{Kn(r)}}transaction(){return new Wn(this.store.transaction(),this)}async checkRoot(){let e={stack:[],error:void 0,hasError:!1};try{let t=Gn(e,this.transaction(),!0);if(await t.get(0))return;let n=new q({ino:0,data:1,mode:16895});await t.set(n.data,T(`{}`)),this._add(0,`/`),await t.set(0,n),await t.commit()}catch(t){e.error=t,e.hasError=!0}finally{let t=Kn(e);t&&await t}}checkRootSync(){let e={stack:[],error:void 0,hasError:!1};try{let t=Gn(e,this.transaction(),!1);if(t.getSync(0))return;let n=new q({ino:0,data:1,mode:16895});t.setSync(n.data,T(`{}`)),this._add(0,`/`),t.setSync(0,n),t.commitSync()}catch(t){e.error=t,e.hasError=!0}finally{Kn(e)}}async _populate(){let e={stack:[],error:void 0,hasError:!1};try{if(this._initialized){B(`Attempted to populate tables after initialization`);return}fe(`Populating tables with existing store metadata`);let t=Gn(e,this.transaction(),!0),n=await t.get(0);if(!n){ue(`Store does not have a root inode`);let e=new q({ino:0,data:1,mode:16895});await t.set(e.data,T(`{}`)),this._add(0,`/`),await t.set(0,e),await t.commit();return}if(n.length<V(q)){le(`Store contains an invalid root inode. Refusing to populate tables`);return}let r=new Set,i=0,a=[[`/`,0]];for(;a.length>0;){i++;let[e,n]=a.shift();this._add(n,e);let o=await t.get(n);if(!o){B(`Store is missing data for inode: `+n);continue}if(o.length<V(q)){B(`Invalid inode size for ino ${n}: ${o.length}`);continue}let s=new q(o);if((s.mode&16384)!=16384||r.has(n))continue;r.add(n);let c=await t.get(s.data);if(!c){B(`Store is missing directory data: `+s.data);continue}let l=Jt(c);for(let[t,n]of Object.entries(l))a.push([W(e,t),n])}fe(`Added ${i} existing inode(s) from store`)}catch(t){e.error=t,e.hasError=!0}finally{let t=Kn(e);t&&await t}}_populateSync(){let e={stack:[],error:void 0,hasError:!1};try{if(this._initialized){B(`Attempted to populate tables after initialization`);return}fe(`Populating tables with existing store metadata`);let t=Gn(e,this.transaction(),!1),n=t.getSync(0);if(!n){ue(`Store does not have a root inode`);let e=new q({ino:0,data:1,mode:16895});t.setSync(e.data,T(`{}`)),this._add(0,`/`),t.setSync(0,e),t.commitSync();return}if(n.length<V(q)){le(`Store contains an invalid root inode. Refusing to populate tables`);return}let r=new Set,i=0,a=[[`/`,0]];for(;a.length>0;){i++;let[e,n]=a.shift();this._add(n,e);let o=t.getSync(n);if(!o){B(`Store is missing data for inode: `+n);continue}if(o.length<V(q)){B(`Invalid inode size for ino ${n}: ${o.length}`);continue}let s=new q(o);if((s.mode&16384)!=16384||r.has(n))continue;r.add(n);let c=t.getSync(s.data);if(!c){B(`Store is missing directory data: `+s.data);continue}let l=Jt(c);for(let[t,n]of Object.entries(l))a.push([W(e,t),n])}fe(`Added ${i} existing inode(s) from store`)}catch(t){e.error=t,e.hasError=!0}finally{Kn(e)}}async _findInode(e,t,n=new Set){if(n.has(t))throw le(P(`EIO`,`Infinite loop detected while finding inode`));if(n.add(t),t==`/`)return new q(await e.get(0)??y(P(`ENODATA`)));let{dir:r,base:i}=gn(t),a=await this._findInode(e,r,n),o=Jt(await e.get(a.data)??y(P(`ENODATA`)));if(!(i in o))throw P(`ENOENT`);return new q(await e.get(o[i])??y(P(`ENODATA`)))}_findInodeSync(e,t,n=new Set){if(n.has(t))throw le(P(`EIO`,`Infinite loop detected while finding inode`));if(n.add(t),t==`/`)return new q(e.getSync(0)??y(P(`ENOENT`)));let{dir:r,base:i}=gn(t),a=this._findInodeSync(e,r,n),o=Jt(e.getSync(a.data)??y(P(`ENODATA`)));if(!(i in o))throw P(`ENOENT`);return new q(e.getSync(o[i])??y(P(`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 P(`ENOENT`);return new q(await e.get(n)??y(P(`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 P(`ENOENT`);return new q(e.getSync(n)??y(P(`ENOENT`)))}_lastID;allocNew(e){this._lastID??=Math.max(...this._paths.keys()),this._lastID+=2;let t=this._lastID;if(t>4294967295)throw z(P(`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 P(`EEXIST`);let i=Gn(r,this.transaction(),!0),{dir:a,base:o}=gn(e),s=await this.findInode(i,a),c=Jt(await i.get(s.data)??y(P(`ENOENT`)));if(c[o])throw P(`EEXIST`);let l=this.allocNew(e),u=new q({...t,ino:l,data:l+1,size:n.byteLength,nlink:1});return await i.set(u.ino,u),await i.set(u.data,n),c[o]=u.ino,await i.set(s.data,Yt(c)),await i.commit(),u}catch(e){r.error=e,r.hasError=!0}finally{let e=Kn(r);e&&await e}}commitNewSync(e,t,n){let r={stack:[],error:void 0,hasError:!1};try{if(e==`/`)throw P(`EEXIST`);let i=Gn(r,this.transaction(),!1),{dir:a,base:o}=gn(e),s=this.findInodeSync(i,a),c=Jt(i.getSync(s.data)??y(P(`ENOENT`)));if(c[o])throw P(`EEXIST`);let l=this.allocNew(e),u=new q({...t,ino:l,data:l+1,size:n.byteLength,nlink:1});return i.setSync(u.ino,u),i.setSync(u.data,n),c[o]=u.ino,i.setSync(s.data,Yt(c)),i.commitSync(),u}catch(e){r.error=e,r.hasError=!0}finally{Kn(r)}}async remove(e,t){let n={stack:[],error:void 0,hasError:!1};try{let r=Gn(n,this.transaction(),!0),{dir:i,base:a}=gn(e),o=await this.findInode(r,i),s=Jt(await r.get(o.data)??y(P(`ENOENT`)));if(!s[a])throw P(`ENOENT`);let c=s[a],l=new q(await r.get(c)??y(P(`ENOENT`)));if(delete s[a],!t&&J(l))throw P(`EISDIR`);await r.set(o.data,Yt(s)),l.nlink>1?(l.update({nlink:l.nlink-1}),await r.set(l.ino,l)):(await r.remove(l.data),await r.remove(c),this._remove(c)),await r.commit()}catch(e){n.error=e,n.hasError=!0}finally{let e=Kn(n);e&&await e}}removeSync(e,t){let n={stack:[],error:void 0,hasError:!1};try{let r=Gn(n,this.transaction(),!1),{dir:i,base:a}=gn(e),o=this.findInodeSync(r,i),s=Jt(r.getSync(o.data)??y(P(`ENOENT`))),c=s[a];if(!c)throw P(`ENOENT`);let l=new q(r.getSync(c)??y(P(`ENOENT`)));if(delete s[a],!t&&J(l))throw P(`EISDIR`);r.setSync(o.data,Yt(s)),l.nlink>1?(l.update({nlink:l.nlink-1}),r.setSync(l.ino,l)):(r.removeSync(l.data),r.removeSync(c),this._remove(c)),r.commitSync()}catch(e){n.error=e,n.hasError=!0}finally{Kn(n)}}},Jn=class extends Hn{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)}},Yn=class extends Un{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)}},Xn=class extends Map{maxSize;label;flags=[];name=`tmpfs`;constructor(e=at,t){super(),this.maxSize=e,this.label=t}async sync(){}transaction(){return new Jn(this)}get bytes(){let e=this.size*4;for(let t of this.values())e+=t.byteLength;return e}usage(){return{totalSpace:this.maxSize,freeSpace:this.maxSize-this.bytes}}};const Zn={name:`InMemory`,options:{maxSize:{type:`number`,required:!1},label:{type:`string`,required:!1}},create({maxSize:e,label:t}){let n=new qn(new Xn(e,t));return n.checkRootSync(),n}};var Qn=class extends qn{devices=new Map;devicesWithDriver(e,t){if(t&&typeof e==`string`)throw z(P(`EINVAL`,`Can not fetch devices using only a driver name`));let n=[];for(let r of this.devices.values())t&&r.driver!=e||(typeof e==`string`?e:e.name)==r.driver.name&&n.push(r);return n}_createDevice(e,t={}){let n=1,r=Array.from(this.devices.values()).at(-1);for(;this.store.has(n)||r?.inode.ino==n;)n++;let i=e.init?.(n,t),a={data:{},minor:0,major:0,...m(i??{},`metadata`),driver:e,inode:new q({mode:8630,...i?.metadata})},o=`/`+(a.name||e.name)+(e.singleton?``:this.devicesWithDriver(e).length);if(this.existsSync(o))throw P(`EEXIST`);return this.devices.set(o,a),de(`Initialized device: `+this._mountPoint+o),a}addDefaults(){this._createDevice(er),this._createDevice(tr),this._createDevice(nr),this._createDevice(rr),this._createDevice(ir),fe(`Added default devices`)}constructor(){super(new Xn(16777216,`devfs`))}async rename(e,t){if(this.devices.has(e))throw P(`EPERM`);if(this.devices.has(t))throw P(`EEXIST`);return super.rename(e,t)}renameSync(e,t){if(this.devices.has(e))throw P(`EPERM`);if(this.devices.has(t))throw P(`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 P(`EEXIST`);return super.createFile(e,t)}createFileSync(e,t){if(this.devices.has(e))throw P(`EEXIST`);return super.createFileSync(e,t)}async unlink(e){if(this.devices.has(e))throw P(`EPERM`);return super.unlink(e)}unlinkSync(e){if(this.devices.has(e))throw P(`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 P(`EEXIST`);return super.mkdir(e,t)}mkdirSync(e,t){if(this.devices.has(e))throw P(`EEXIST`);return super.mkdirSync(e,t)}async readdir(e){let t=await super.readdir(e);for(let n of this.devices.keys())G(n)==e&&t.push(pn(n));return t}readdirSync(e){let t=super.readdirSync(e);for(let n of this.devices.keys())G(n)==e&&t.push(pn(n));return t}async link(e,t){if(this.devices.has(e))throw P(`EPERM`);if(this.devices.has(t))throw P(`EEXIST`);return super.link(e,t)}linkSync(e,t){if(this.devices.has(e))throw P(`EPERM`);if(this.devices.has(t))throw P(`EEXIST`);return super.linkSync(e,t)}async sync(){for(let e of this.devices.values())e.driver.sync?.(e);return super.sync()}syncSync(){for(let e of this.devices.values())e.driver.sync?.(e);return super.syncSync()}async read(e,t,n,r){let i=this.devices.get(e);if(!i){await super.read(e,t,n,r);return}i.driver.read(i,t,n,r)}readSync(e,t,n,r){let i=this.devices.get(e);if(!i){super.readSync(e,t,n,r);return}i.driver.read(i,t,n,r)}async write(e,t,n){let r=this.devices.get(e);if(!r)return await super.write(e,t,n);r.driver.write(r,t,n)}writeSync(e,t,n){let r=this.devices.get(e);if(!r)return super.writeSync(e,t,n);r.driver.write(r,t,n)}};const $n=new Uint8Array,er={name:`null`,singleton:!0,init(){return{major:1,minor:3}},read(){return $n},write(){}},tr={name:`zero`,singleton:!0,init(){return{major:1,minor:5}},read(e,t,n,r){t.fill(0,n,r)},write(){}},nr={name:`full`,singleton:!0,init(){return{major:1,minor:7}},read(e,t,n,r){t.fill(0,n,r)},write(){throw P(`ENOSPC`)}},rr={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(){}},ir={name:`console`,singleton:!0,init(e,{output:t=e=>console.log(e)}={}){return{major:5,minor:1,data:{output:t}}},read(){return $n},write(e,t,n){let r=E(t);e.data.output(r,n)}},ar={null:er,zero:tr,full:nr,random:rr,console:ir};var or=r();let X=!0;function sr(e){X=e}var cr;(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`})(cr||={});function lr(e){return(e&61440)>>12}function ur(e){return e<<12}var dr=class{ino;type;path;name},fr=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},pr=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},mr=class{pending=new Set;lastWriter;writeState=0;readers=0;syncReaders=0;take(e,t,n){e==`rw`?this.writeState=t?2:1:(this.readers++,t&&this.syncReaders++);let r=!1,i=()=>{r||(r=!0,e==`rw`?this.writeState=0:(this.readers--,t&&this.syncReaders--),n())};return i[Symbol.dispose]=i,i}queue(e){let{promise:t,resolve:n}=Promise.withResolvers();return this.pending.add(t),e==`rw`&&(this.lastWriter=t),t.then(()=>{this.pending.delete(t),this.lastWriter==t&&delete this.lastWriter}),n}async acquire(e){let t=e==`ro`?this.lastWriter:Promise.all(this.pending),n=this.queue(e);return await t,this.take(e,!1,n)}acquireSync(e){if(this.writeState==2||e==`rw`&&this.syncReaders)throw P(`EDEADLK`);if(this.writeState||e==`rw`&&this.readers)throw P(`EAGAIN`);return this.take(e,!0,this.queue(e))}isAvailable(e){return(e!=`rw`||!this.readers)&&!this.writeState}get isFree(){return!this.writeState&&!this.readers}get mode(){return this.writeState?`rw`:this.readers?`ro`:null}};let hr=(()=>{let e=[],t,n;return class{static{let r=typeof Symbol==`function`&&Symbol.metadata?Object.create(null):void 0;t=[b],n=[b],pr(this,null,t,{kind:`getter`,name:`lock`,static:!1,private:!1,access:{has:e=>`lock`in e,get:e=>e.lock},metadata:r},null,e),pr(this,null,n,{kind:`getter`,name:`lockSync`,static:!1,private:!1,access:{has:e=>`lockSync`in e,get:e=>e.lockSync},metadata:r},null,e),r&&Object.defineProperty(this,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:r})}_rwLock=(fr(this,e),new mr);get lock(){return this._rwLock.acquire.bind(this._rwLock)}get lockSync(){return this._rwLock.acquireSync.bind(this._rwLock)}get isLocked(){return!this._rwLock.isFree}get lockMode(){return this._rwLock.mode}}})();var gr=class extends hr{fs;inode;data;dirtyRanges=[];truncatedTo;metadataDirty=!1;refs=0;paths=new Set;_lastPath;constructor(e,t,n){super(),this.fs=e,this.inode=n,this.paths.add(t),this._lastPath=t,this.data=new s(n.ino,n.size,{sparse:!0})}get ino(){return this.inode.ino}get path(){let[e]=this.paths;return e!==void 0&&(this._lastPath=e),e??this._lastPath}get dirty(){return this.metadataDirty||this.dirtyRanges.length>0}get bypassCache(){return Fn(this.inode)||Pn(this.inode)||!!(this.inode.flags&An.DAX)}markDirty(e,t){this.dirtyRanges.push({start:e,end:t}),this.dirtyRanges.sort((e,t)=>e.start-t.start);let n=[];for(let e of this.dirtyRanges){let t=n.at(-1);t&&e.start<=t.end?t.end=Math.max(t.end,e.end):n.push(e)}this.dirtyRanges=n}copyFromCache(e,t,n){let r=t;for(let i of this.data.regions){let a=i.offset+i.data.byteLength;if(a<=r)continue;if(i.offset>=n)break;i.offset>r&&(e.fill(0,r-t,i.offset-t),r=i.offset);let o=Math.min(n,a);e.set(i.data.subarray(r-i.offset,o-i.offset),r-t),r=o}r<n&&e.fill(0,r-t,n-t)}async read(e,t,n){if(this.bypassCache)return await this.fs.read(this.path,e,t,n);for(let{start:e,end:r}of this.data.missing(t,n)){let t=new Uint8Array(r-e);await this.fs.read(this.path,t,e,r),this.data.add(t,e)}this.copyFromCache(e,t,n)}readSync(e,t,n){if(this.bypassCache)return this.fs.readSync(this.path,e,t,n);for(let{start:e,end:r}of this.data.missing(t,n)){let t=new Uint8Array(r-e);this.fs.readSync(this.path,t,e,r),this.data.add(t,e)}this.copyFromCache(e,t,n)}async write(e,t){this.bypassCache?await this.fs.write(this.path,e,t):this._writeCached(e,t),this._writeMetadata(t+e.byteLength)}writeSync(e,t){this.bypassCache?this.fs.writeSync(this.path,e,t):this._writeCached(e,t),this._writeMetadata(t+e.byteLength)}_writeCached(e,t){let n=t+e.byteLength;this.data.add(e.slice(),t),n>this.data.size&&(this.data.size=n),this.markDirty(t,n)}_writeMetadata(e){!this.bypassCache&&e>this.inode.size&&(this.inode.size=e),this.inode.mtimeMs=Date.now(),this.inode.ctimeMs=Date.now(),this.metadataDirty=!0}truncate(e){this.truncatedTo=Math.min(this.truncatedTo??e,e),this.data.size=e,this.dirtyRanges=this.dirtyRanges.filter(t=>t.start<e).map(t=>t.end>e?{start:t.start,end:e}:t),this.inode.size=e,this.inode.mtimeMs=Date.now(),this.inode.ctimeMs=Date.now(),this.metadataDirty=!0}get needsPreTruncate(){return!this.bypassCache&&this.truncatedTo!==void 0&&this.truncatedTo<this.inode.size&&!this.fs.attributes.has(`no_write`)}async sync(){this.needsPreTruncate&&await this.fs.touch(this.path,{size:this.truncatedTo}),this.truncatedTo=void 0;for(let e of this.dirtyRanges)for(let t=e.start;t<e.end;){let n=this.data.regionAt(t);if(!n)break;let r=Math.min(e.end,n.offset+n.data.byteLength);await this.fs.write(this.path,n.data.subarray(t-n.offset,r-n.offset),t),t=r}this.dirtyRanges=[],this.metadataDirty&&=(this.fs.attributes.has(`no_write`)||await this.fs.touch(this.path,this.inode),!1)}syncSync(){this.needsPreTruncate&&this.fs.touchSync(this.path,{size:this.truncatedTo}),this.truncatedTo=void 0;for(let e of this.dirtyRanges)for(let t=e.start;t<e.end;){let n=this.data.regionAt(t);if(!n)break;let r=Math.min(e.end,n.offset+n.data.byteLength);this.fs.writeSync(this.path,n.data.subarray(t-n.offset,r-n.offset),t),t=r}this.dirtyRanges=[],this.metadataDirty&&=(this.fs.attributes.has(`no_write`)||this.fs.touchSync(this.path,this.inode),!1)}},_r=function(e,t,n){if(t!=null){if(typeof t!=`object`&&typeof t!=`function`)throw TypeError(`Object expected.`);var r,i;if(n){if(!Symbol.asyncDispose)throw TypeError(`Symbol.asyncDispose is not defined.`);r=t[Symbol.asyncDispose]}if(r===void 0){if(!Symbol.dispose)throw TypeError(`Symbol.dispose is not defined.`);r=t[Symbol.dispose],n&&(i=r)}if(typeof r!=`function`)throw TypeError(`Object not disposable.`);i&&(r=function(){try{i.call(this)}catch(e){return Promise.reject(e)}}),e.stack.push({value:t,dispose:r,async:n})}else n&&e.stack.push({async:!0});return t},vr=(function(e){return function(t){function n(n){t.error=t.hasError?new e(n,t.error,`An error was suppressed during disposal.`):n,t.hasError=!0}var r,i=0;function a(){for(;r=t.stack.pop();)try{if(!r.async&&i===1)return i=0,t.stack.push(r),Promise.resolve().then(a);if(r.dispose){var e=r.dispose.call(r.value);if(r.async)return i|=2,Promise.resolve(e).then(a,function(e){return n(e),a()})}else i|=1}catch(e){n(e)}if(i===1)return t.hasError?Promise.reject(t.error):Promise.resolve();if(t.hasError)throw t.error}return a()}})(typeof SuppressedError==`function`?SuppressedError:function(e,t,n){var r=Error(n);return r.name=`SuppressedError`,r.error=e,r.suppressed=t,r}),yr=class{fs;byIno=new Map;byPath=new Map;constructor(e){this.fs=e}get(e){return this.byPath.get(e)}ref(e,t){let n=this.byIno.get(t.ino);return n?(n.paths.add(e),!n.dirty&&t!==n.inode&&Object.assign(n.inode,t)):(n=new gr(this.fs,e,t),this.byIno.set(t.ino,n)),this.byPath.set(e,n),n.refs++,n}unref(e){e.refs--,!(e.refs>0||e.dirty)&&this.evict(e)}evict(e){this.byIno.delete(e.ino);for(let t of e.paths)this.byPath.delete(t)}rename(e,t){for(let[n,r]of this.byPath){if(n!=e&&!n.startsWith(e+`/`))continue;let i=t+n.slice(e.length);this.byPath.delete(n),this.byPath.set(i,r),r.paths.delete(n),r.paths.add(i)}}link(e,t){let n=this.byPath.get(e);n&&(n.paths.add(t),this.byPath.set(t,n))}remove(e){let t=this.byPath.get(e);t&&(this.byPath.delete(e),t.paths.delete(e),!t.paths.size&&!t.refs&&this.evict(t))}async sync(){for(let e of this.byIno.values()){let t={stack:[],error:void 0,hasError:!1};try{if(!e.dirty)continue;_r(t,await e.lock(`rw`),!1),await e.sync(),e.refs||this.evict(e)}catch(e){t.error=e,t.hasError=!0}finally{vr(t)}}}syncSync(){for(let e of this.byIno.values()){let t={stack:[],error:void 0,hasError:!1};try{if(!e.dirty)continue;_r(t,e.lockSync(`rw`),!1),e.syncSync(),e.refs||this.evict(e)}catch(e){t.error=e,t.hasError=!0}finally{vr(t)}}}};const br=new Map;function xr(e){let t=br.get(e.uuid);return t||(t=new yr(e),br.set(e.uuid,t)),t}async function Sr(e,t,n,r){let i=xr(e);r??=i.get(t)?.inode??await e.stat(t);let a=i.ref(t,r),o=await a.lock(n),s=!1,c=()=>{s||(s=!0,o(),i.unref(a))};return c[Symbol.dispose]=c,c}function Cr(e,t,n,r){let i=xr(e);r??=i.get(t)?.inode??e.statSync(t);let a=i.ref(t,r),o;try{o=a.lockSync(n)}catch(e){throw i.unref(a),e}let s=!1,c=()=>{s||(s=!0,o(),i.unref(a))};return c[Symbol.dispose]=c,c}var wr=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},Tr=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},Er=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},Dr=(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});const Or=4096;let kr=(()=>{let e=[],t,n;return class{static{let r=typeof Symbol==`function`&&Symbol.metadata?Object.create(null):void 0;Tr(this,null,t,{kind:`getter`,name:`inode`,static:!1,private:!1,access:{has:e=>`inode`in e,get:e=>e.inode},metadata:r},null,e),Tr(this,null,n,{kind:`getter`,name:`fs`,static:!1,private:!1,access:{has:e=>`fs`in e,get:e=>e.fs},metadata:r},null,e),r&&Object.defineProperty(this,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:r})}context=wr(this,e);path;internalPath;flag;vnode;_position=0;get position(){return this.flag&1024?this.inode.size:this._position}set position(e){this._position=e}get inode(){return this.vnode.inode}get fs(){return this.vnode.fs}get dirty(){return this.vnode.dirty}closed=!1;get isClosed(){return this.closed}constructor(e,t,n,r,i){this.context=e,this.path=t,this.internalPath=n,this.flag=r,this.vnode=i}get _isSync(){return!!(this.flag&1052672||this.inode.flags&An.Sync||this.fs.attributes.has(`sync`))}[(t=[b],n=[b],Symbol.dispose)](){this.closeSync()}syncSync(){let e={stack:[],error:void 0,hasError:!1};try{if(this.closed)throw N(`EBADF`,`sync`,this.path);if(!this.dirty)return;Er(e,this.vnode.lockSync(`rw`),!1),this.vnode.syncSync()}catch(t){e.error=t,e.hasError=!0}finally{Dr(e)}}datasyncSync(){return this.syncSync()}closeSync(){if(this.closed)throw N(`EBADF`,`close`,this.path);this.syncSync(),this.disposeSync(!0)}disposeSync(e){if(this.closed)throw N(`EBADF`,`close`,this.path);if(this.dirty&&!e)throw N(`EBUSY`,`close`,this.path);this.closed=!0,xr(this.fs).unref(this.vnode)}truncateSync(e){let t={stack:[],error:void 0,hasError:!1};try{if(e<0)throw N(`EINVAL`,`truncate`,this.path);if(this.closed||!(this.flag&1||this.flag&2))throw N(`EBADF`,`truncate`,this.path);if(this.fs.attributes.has(`readonly`))throw N(`EROFS`,`truncate`,this.path);if(this.inode.flags&An.Immutable)throw N(`EPERM`,`truncate`,this.path);Er(t,this.vnode.lockSync(`rw`),!1),this.vnode.truncate(e),this._isSync&&this.vnode.syncSync()}catch(e){t.error=e,t.hasError=!0}finally{Dr(t)}}writeSync(e,t=0,n=e.byteLength-t,r=this.position){let i={stack:[],error:void 0,hasError:!1};try{if(this.closed||!(this.flag&1||this.flag&2))throw N(`EBADF`,`write`,this.path);if(this.fs.attributes.has(`readonly`))throw N(`EROFS`,`write`,this.path);if(this.inode.flags&An.Immutable)throw N(`EPERM`,`write`,this.path);Er(i,this.vnode.lockSync(`rw`),!1);let a=e.subarray(t,t+n);return this.vnode.writeSync(a,r),this._position=r+a.byteLength,this._isSync&&this.vnode.syncSync(),a.byteLength}catch(e){i.error=e,i.hasError=!0}finally{Dr(i)}}readSync(e,t=0,n=e.byteLength-t,r=this.position){let i={stack:[],error:void 0,hasError:!1};try{if(this.closed||this.flag&1)throw N(`EBADF`,`read`,this.path);Er(i,this.vnode.lockSync(`ro`),!1),!(this.inode.flags&An.NoAtime)&&!this.fs.attributes.has(`no_atime`)&&(this.vnode.metadataDirty=!0,this.inode.atimeMs=Date.now());let a=r+n;!Fn(this.inode)&&!Pn(this.inode)&&a>this.inode.size&&(a=r+Math.max(this.inode.size-r,0)),this._position=a;let o=new Uint8Array(e.buffer,e.byteOffset,e.byteLength);return this.vnode.readSync(o.subarray(t,t+n),r,a),this._isSync&&this.vnode.syncSync(),a-r}catch(e){i.error=e,i.hasError=!0}finally{Dr(i)}}chmodSync(e){let t={stack:[],error:void 0,hasError:!1};try{if(this.closed)throw N(`EBADF`,`chmod`,this.path);Er(t,this.vnode.lockSync(`rw`),!1),this.vnode.metadataDirty=!0,this.inode.mode=this.inode.mode&(e>61440?-61441:Ye)|e,(this._isSync||e>61440)&&this.vnode.syncSync()}catch(e){t.error=e,t.hasError=!0}finally{Dr(t)}}chownSync(e,t){let n={stack:[],error:void 0,hasError:!1};try{if(this.closed)throw N(`EBADF`,`chmod`,this.path);Er(n,this.vnode.lockSync(`rw`),!1),this.vnode.metadataDirty=!0,Ln(this.inode,e,t),this._isSync&&this.vnode.syncSync()}catch(e){n.error=e,n.hasError=!0}finally{Dr(n)}}utimesSync(e,t){let n={stack:[],error:void 0,hasError:!1};try{if(this.closed)throw N(`EBADF`,`utimes`,this.path);Er(n,this.vnode.lockSync(`rw`),!1),this.vnode.metadataDirty=!0,this.inode.atimeMs=e,this.inode.mtimeMs=t,this._isSync&&this.vnode.syncSync()}catch(e){n.error=e,n.hasError=!0}finally{Dr(n)}}async[Symbol.asyncDispose](){await this.close()}async sync(){let e={stack:[],error:void 0,hasError:!1};try{if(this.closed)throw N(`EBADF`,`sync`,this.path);if(!this.dirty)return;Er(e,await this.vnode.lock(`rw`),!1),await this.vnode.sync()}catch(t){e.error=t,e.hasError=!0}finally{Dr(e)}}datasync(){return this.sync()}async close(){if(this.closed)throw N(`EBADF`,`close`,this.path);await this.sync(),this.dispose(!0)}dispose(e){if(this.closed)throw N(`EBADF`,`close`,this.path);if(this.dirty&&!e)throw N(`EBUSY`,`close`,this.path);this.closed=!0,xr(this.fs).unref(this.vnode)}stat(){if(this.closed)throw N(`EBADF`,`stat`,this.path);return this.inode}async truncate(e){let t={stack:[],error:void 0,hasError:!1};try{if(e<0)throw N(`EINVAL`,`truncate`,this.path);if(this.closed||!(this.flag&1||this.flag&2))throw N(`EBADF`,`truncate`,this.path);if(this.fs.attributes.has(`readonly`))throw N(`EROFS`,`truncate`,this.path);if(this.inode.flags&An.Immutable)throw N(`EPERM`,`truncate`,this.path);Er(t,await this.vnode.lock(`rw`),!1),this.vnode.truncate(e),this._isSync&&await this.vnode.sync()}catch(e){t.error=e,t.hasError=!0}finally{Dr(t)}}async write(e,t=0,n=e.byteLength-t,r=this.position){let i={stack:[],error:void 0,hasError:!1};try{if(this.closed||!(this.flag&1||this.flag&2))throw N(`EBADF`,`write`,this.path);if(this.fs.attributes.has(`readonly`))throw N(`EROFS`,`write`,this.path);if(this.inode.flags&An.Immutable)throw N(`EPERM`,`write`,this.path);Er(i,await this.vnode.lock(`rw`),!1);let a=e.subarray(t,t+n);return await this.vnode.write(a,r),this._position=r+a.byteLength,this._isSync&&await this.vnode.sync(),a.byteLength}catch(e){i.error=e,i.hasError=!0}finally{Dr(i)}}async read(e,t=0,n=e.byteLength-t,r=this.position){let i={stack:[],error:void 0,hasError:!1};try{if(this.closed||this.flag&1)throw N(`EBADF`,`read`,this.path);Er(i,await this.vnode.lock(`ro`),!1),!(this.inode.flags&An.NoAtime)&&!this.fs.attributes.has(`no_atime`)&&(this.vnode.metadataDirty=!0,this.inode.atimeMs=Date.now());let a=r+n;!Fn(this.inode)&&!Pn(this.inode)&&a>this.inode.size&&(a=r+Math.max(this.inode.size-r,0)),this._position=a;let o=new Uint8Array(e.buffer,e.byteOffset,e.byteLength);return await this.vnode.read(o.subarray(t,t+n),r,a),this._isSync&&await this.vnode.sync(),a-r}catch(e){i.error=e,i.hasError=!0}finally{Dr(i)}}async chmod(e){let t={stack:[],error:void 0,hasError:!1};try{if(this.closed)throw N(`EBADF`,`chmod`,this.path);Er(t,await this.vnode.lock(`rw`),!1),this.vnode.metadataDirty=!0,this.inode.mode=this.inode.mode&(e>61440?-61441:Ye)|e,(this._isSync||e>61440)&&await this.vnode.sync()}catch(e){t.error=e,t.hasError=!0}finally{Dr(t)}}async chown(e,t){let n={stack:[],error:void 0,hasError:!1};try{if(this.closed)throw N(`EBADF`,`chown`,this.path);Er(n,await this.vnode.lock(`rw`),!1),this.vnode.metadataDirty=!0,Ln(this.inode,e,t),this._isSync&&await this.vnode.sync()}catch(e){n.error=e,n.hasError=!0}finally{Dr(n)}}async utimes(e,t){let n={stack:[],error:void 0,hasError:!1};try{if(this.closed)throw N(`EBADF`,`utimes`,this.path);Er(n,await this.vnode.lock(`rw`),!1),this.vnode.metadataDirty=!0,this.inode.atimeMs=e,this.inode.mtimeMs=t,this._isSync&&await this.vnode.sync()}catch(e){n.error=e,n.hasError=!0}finally{Dr(n)}}streamRead(e){if(this.closed)throw N(`EBADF`,`streamRead`,this.path);let{vnode:t}=this;return new ReadableStream({async start(n){let r={stack:[],error:void 0,hasError:!1};try{Er(r,await t.lock(`ro`),!1);let{start:i=0,end:a=t.inode.size}=e;for(let e=i;e<a;e+=Or){let r=e+Or>a?a-e:Or,i=new Uint8Array(r);await t.read(i,e,e+r).catch(n.error.bind(n)),n.enqueue(i)}n.close()}catch(e){r.error=e,r.hasError=!0}finally{Dr(r)}},type:`bytes`})}streamWrite(e){if(this.closed)throw N(`EBADF`,`write`,this.path);if(this.inode.flags&An.Immutable)throw N(`EPERM`,`write`,this.path);if(this.fs.attributes.has(`readonly`))throw N(`EROFS`,`write`,this.path);let{vnode:t}=this,n=e.start??0;return new WritableStream({async write(e,r){let i={stack:[],error:void 0,hasError:!1};try{Er(i,await t.lock(`rw`),!1),await t.write(e,n).catch(r.error.bind(r)),n+=e.byteLength}catch(e){i.error=e,i.hasError=!0}finally{Dr(i)}},async close(){let e={stack:[],error:void 0,hasError:!1};try{Er(e,await t.lock(`rw`),!1),await t.sync()}catch(t){e.error=t,e.hasError=!0}finally{Dr(e)}}})}}})();function Ar(e){let t=Ie(e.context).descriptors,n=Math.max(t.size?Math.max(...t.keys())+1:0,4);return t.set(n,e),n}function jr(e,t){Qt(t);let n=Ie(e).descriptors.get(t);if(!n)throw P(`EBADF`);return n}function Mr(e,t){return Ie(e).descriptors.delete(t)}const Nr=/[rwasx]{1,2}\+?/;function Pr(e){if(typeof e==`number`)return e;if(!Nr.test(e))throw P(`EINVAL`,`Invalid flag string: `+e);return Fr(e)}function Fr(e){if(!e.includes(`r`)&&!e.includes(`w`)&&!e.includes(`a`))throw P(`EINVAL`,`Invalid flag string: `+e);let t=e.includes(`r`)?0:64;return e.includes(`w`)&&(t|=512),e.includes(`a`)&&(t|=Be),e.includes(`+`)?t|=2:e.includes(`r`)||(t|=1),e.includes(`s`)&&(t|=We),e.includes(`x`)&&(t|=128),t}function Ir(e){let t=0;return e&1||(t|=4),(e&1||e&2)&&(t|=2),t}const Lr=M;function Rr(e,t){return e.path=t,e}function zr(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 j(Object.assign(e,i))}}}function Br(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 j(Object.assign(e,t));if(e in k){let r=N(e,t);Error.captureStackTrace(r,n)}throw e}):a}catch(e){throw j(Object.assign(e,t))}}:r}})}const Vr=new Map;Hr(`/`,Zn.create({label:`root`}));function Hr(e,t){if(e[0]!=`/`&&(e=`/`+e),e=ln.call(this,e),Vr.has(e))throw z(P(`EINVAL`,`Mount point is already in use: `+e));t._mountPoint=e,Vr.set(e,t),br.has(t.uuid)||br.set(t.uuid,new yr(t)),de(`Mounted ${t.name} on ${e}`),fe(`${t.name} attributes: ${[...t.attributes].map(([e,t])=>t==null?e:e+`=`+t).join(`, `)}`)}function Ur(e){e[0]!=`/`&&(e=`/`+e),e=ln.call(this,e);let t=Vr.get(e);if(!t){B(e+` is already unmounted`);return}let n=()=>{br.delete(t.uuid),de(`Synced all changes to `+e)};try{br.get(t.uuid)?.syncSync(),n()}catch{B(`Could not flush to ${e} synchronously.`),br.get(t.uuid)?.sync().then(n)}Vr.delete(e),ue(`Unmounted `+e)}function Z(e,t,n){let{root:r}=Ie(t),i={path:e,...n};e=U(W(r,e),!0),e=ln.call(t,e);let a=[...Vr].sort((e,t)=>e[0].length>t[0].length?-1:1);for(let[t,n]of a){if(!Kr(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:Br(n,i),path:e,mountPoint:t,root:r}}throw ce(new M(k.EIO,`No file system for `+e))}function Wr(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 Gr(e){let t=Ie(this);if(!Ne(t.credentials))throw P(`EPERM`,`Can not chroot() as non-root user`);t.root??=`/`;let n=W(t.root,e);for(let e of t.descriptors?.values()??[]){if(!e.path.startsWith(t.root))throw N(`EBUSY`,`chroot`,e.path);e.path=e.path.slice(t.root.length)}if(n.length>t.root.length)throw P(`EPERM`,`Can not chroot() outside of current root`);t.root=n}function Kr(e,t){return e===`/`||e===t||(e.endsWith(`/`)||(e+=`/`),t.startsWith(e))}var qr=t({link:()=>ni,mkdir:()=>$r,open:()=>Zr,readdir:()=>ei,readlink:()=>Qr,rename:()=>ti,resolve:()=>Xr,stat:()=>ri}),Jr=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},Yr=(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 Xr(e,t,n,r){t=ln.call(e,t);try{let i=Z(t,e),a=xr(i.fs).get(i.path)?.inode??i.fs.statSync(i.path);return!Mn(a)||n?{...i,fullPath:t,stats:a}:Xr(e,ln.call(e,G(t),Qr.call(e,t)),n,r)}catch(e){if(j(Object.assign(e,{syscall:`stat`,path:t,...r})),n)throw e}let{base:i,dir:a}=gn(t),o=a==`/`?`/`:Xr(e,a,!1,r).fullPath,s=W(o,i),c=Z(s,e),l;try{l=xr(c.fs).get(c.path)?.inode??c.fs.statSync(c.path)}catch(e){if(e.code===`ENOENT`)return{...c,fullPath:s};throw j(Object.assign(e,{syscall:`stat`,path:s,...r}))}return Mn(l)?Xr(e,ln.call(e,o,Qr.call(e,s)),!1,r):{...c,fullPath:s,stats:l}}function Zr(e,t){e=U(e);let n=Xt(t.mode,420),r=Pr(t.flag);e=t.preserveSymlinks?e:Xr(this,e).fullPath;let{fs:i,path:a}=Z(e,this),o;try{o=i.statSync(a)}catch{}if(!o){let o={stack:[],error:void 0,hasError:!1};try{if(!(r&64))throw N(`ENOENT`,`open`,e);let s=G(a),c=i.statSync(s);if(X&&!Y(this,c,2))throw N(`EACCES`,`open`,e);if(!J(c))throw N(`ENOTDIR`,`open`,e);if(!t.allowDirectory&&n&16384)throw N(`EISDIR`,`open`,e);Jr(o,Cr(i,s,`rw`,c),!1);let{euid:l,egid:u}=Ie(this).credentials,d=i.createFileSync(a,{mode:n,uid:c.mode&2048?c.uid:l,gid:c.mode&1024?c.gid:u});return sa(this,`rename`,e),new kr(this,e,a,r,xr(i).ref(a,d))}catch(e){o.error=e,o.hasError=!0}finally{Yr(o)}}if(X&&(!Y(this,o,n)||!Y(this,o,Ir(r))))throw N(`EACCES`,`open`,e);if(r&128)throw N(`EEXIST`,`open`,e);if(!t.allowDirectory&&o.mode&16384)throw N(`EISDIR`,`open`,e);let s=new kr(this,e,a,r,xr(i).ref(a,o));return r&512&&s.truncateSync(0),s}function Qr(e){e=U(e);let{fs:t,stats:n,path:r}=Xr(this,e,!0,{syscall:`readlink`});if(!n)throw N(`ENOENT`,`readlink`,e);if(X&&!Y(this,n,4))throw N(`EACCES`,`readlink`,e);if(!Mn(n))throw N(`EINVAL`,`readlink`,e);let i=n.size,a=new Uint8Array(i);return t.readSync(r,a,0,i),E(a)}function $r(e,t={}){let n=U(e),r={syscall:`mkdir`,path:n},{fullPath:i}=Xr(this,G(n),!1,r),{fs:a,path:o}=Z(W(i,pn(n)),this,r),s=i!=G(n),{euid:c,egid:l}=Ie(this).credentials,{mode:u=511,recursive:d}=t,f,p=(e,t)=>{let n={stack:[],error:void 0,hasError:!1};try{let i=G(t),m=d&&i!=`/`?p(G(e),i):a.statSync(i);if(d){let n;try{n=xr(a).get(t)?.inode??a.statSync(t)}catch{}if(n){let i=Mn(n)?Xr(this,e,!1,r).stats:n;if(!i)throw N(`ENOENT`,r);if(!J(i))throw N(t==o?`EEXIST`:`ENOTDIR`,r);return n}if(s&&a.existsSync(W(i,pn(e))))throw N(`ENOENT`,r)}if(X&&!Y(this,m,2))throw N(`EACCES`,`mkdir`,e);Jr(n,Cr(a,i,`rw`,m),!1);let h=zr(a,`mkdirSync`,{path:e,syscall:`mkdir`})(t,{mode:u,uid:m.mode&2048?m.uid:c,gid:m.mode&1024?m.gid:l});return d&&(f??=e),sa(this,`rename`,e),h}catch(e){n.error=e,n.hasError=!0}finally{Yr(n)}};return p(n,o),f}function ei(e,t={}){e=U(e);let{fs:n,path:r}=Xr(this,e),i=xr(n).get(r)?.inode??zr(n,`statSync`,{path:e,syscall:`scandir`})(r);if(X&&!Y(this,i,4))throw N(`EACCES`,`scandir`,e);if(!J(i))throw N(`ENOTDIR`,`scandir`,e);let a;{let e={stack:[],error:void 0,hasError:!1};try{Jr(e,Cr(n,r,`ro`,i),!1),a=n.readdirSync(r)}catch(t){e.error=t,e.hasError=!0}finally{Yr(e)}}let o=[],s=e=>{let i;try{i=n.statSync(W(r,e))}catch(e){if(e.code==`ENOENT`)return;throw e}let a=new dr;if(a.ino=i.ino,a.type=lr(i.mode),a.path=e,a.name=pn(e),o.push(a),!J(i)||!t?.recursive)return;let c=n.readdirSync(W(r,e));for(let t of c)s(W(e,t))};for(let e of a)s(e);return o}function ti(e,t){let n={stack:[],error:void 0,hasError:!1};try{e=U(e),t=U(t);let r={syscall:`rename`,path:e,dest:t},i=Xr(this,e,!0,r),a=Z(t,this,r);if(i.fs.uuid!==a.fs.uuid)throw N(`EXDEV`,r);if(a.path.startsWith(i.path+`/`))throw N(`EINVAL`,r);if(!i.stats)throw N(`ENOENT`,r);let o=i.fs,s=o.statSync(G(i.path)),c=o.statSync(G(a.path)),l;try{l=o.statSync(a.path)}catch(e){if(e.code!=`ENOENT`)throw e}if(X&&(!Y(this,s,4)||!Y(this,c,2)))throw N(`EACCES`,r);if(l&&!J(i.stats)&&J(l))throw N(`EISDIR`,r);if(l&&J(i.stats)&&!J(l))throw N(`ENOTDIR`,r);let u=G(i.path),d=G(a.path),f=[[u,s],[d,c]];s.ino>c.ino&&f.reverse(),Jr(n,Cr(o,f[0][0],`rw`,f[0][1]),!1),Jr(n,s.ino==c.ino?null:Cr(o,f[1][0],`rw`,f[1][1]),!1),i.fs.renameSync(i.path,a.path),xr(o).rename(i.path,a.path),sa(this,`rename`,e),sa(this,`rename`,t)}catch(e){n.error=e,n.hasError=!0}finally{Yr(n)}}function ni(e,t){let n={stack:[],error:void 0,hasError:!1};try{e=U(e),t=U(t);let r={syscall:`link`,path:e,dest:t},{fs:i,path:a}=Z(e,this,r),o=Z(t,this,r);if(i.uuid!==o.fs.uuid)throw N(`EXDEV`,r);let s=i.statSync(a);if(X){if(!Y(this,s,4))throw N(`EACCES`,r);let e=i.statSync(G(a));if(!Y(this,e,4))throw N(`EACCES`,r);let t=i.statSync(G(o.path));if(!Y(this,t,2))throw N(`EACCES`,r)}Jr(n,Cr(i,G(o.path),`rw`),!1),i.linkSync(a,o.path),xr(i).link(a,o.path)}catch(e){n.error=e,n.hasError=!0}finally{Yr(n)}}function ri(e,t){e=U.call(this,e);let n={syscall:t?`lstat`:`stat`,path:e},r;if(!t)r=Xr(this,e,!1,n).stats;else{let{base:t,dir:i}=gn(e),{fs:a,path:o}=Xr(this,i,!1,n);try{let e=t?W(o,t):o;r=xr(a).get(e)?.inode??a.statSync(e)}catch(e){throw j(Object.assign(e,n)),e}}if(!r)throw N(`ENOENT`,n);if(X&&!Y(this,r,4))throw N(`EACCES`,n);return r}var ii=class e{ino;type;_name;get name(){let e=or.Buffer.from(this._name);return this._encoding==`buffer`?e:e.toString(this._encoding)}_encoding;_parentPath;get parentPath(){return this._parentPath}get path(){return B(`Dirent.path was removed in Node v24, use parentPath instead`),this._parentPath}static from(t,n,r=`.`){let i=new e,{base:a,dir:o}=gn(t.path);return i._parentPath=W(r,o),i._name=a,i.ino=t.ino,i.type=t.type,i._encoding=n,i}isFile(){return this.type===cr.REG}isDirectory(){return this.type===cr.DIR}isBlockDevice(){return this.type===cr.BLK}isCharacterDevice(){return this.type===cr.CHR}isSymbolicLink(){return this.type===cr.LNK}isFIFO(){return this.type===cr.FIFO}isSocket(){return this.type===cr.SOCK}};function ai(){return Object.assign(Error(`Directory handle was closed`),{code:`ERR_DIR_CLOSED`})}var oi=class{path;context;closed=!1;checkClosed(){if(this.closed)throw ai()}_entries;constructor(e,t){this.path=e,this.context=t}close(e){if(this.closed){let t=ai();if(!e)return Promise.reject(t);e(t);return}if(this.closed=!0,!e)return Promise.resolve();e(null)}closeSync(){if(this.closed)throw ai();this.closed=!0}async _read(){return this.checkClosed(),this._entries??=await vo.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()}},si=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},ci=(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 li(e,t){return ti.call(this,e,t)}function ui(e){e=U(e);try{let{fs:t,path:n}=Xr(this,e);return t.existsSync(n)}catch(e){if(e.errno==k.ENOENT)return!1;throw e}}function di(e,t){let n=ri.call(this,e,!1);return t?.bigint?new xn(n):new bn(n)}function fi(e,t){let n=ri.call(this,e,!0);return t?.bigint?new xn(n):new bn(n)}function pi(e,t=0){let n={stack:[],error:void 0,hasError:!1};try{let r=si(n,Zr.call(this,e,{flag:`r+`}),!1);if(t||=0,t<0)throw N(`EINVAL`,`truncate`,e.toString());r.truncateSync(t)}catch(e){n.error=e,n.hasError=!0}finally{ci(n)}}function mi(e){e=U(e);let{fs:t,path:n}=Z(e,this);try{let e={stack:[],error:void 0,hasError:!1};try{if(X&&!Y(this,t.statSync(n),2))throw N(`EACCES`,`unlink`);si(e,Cr(t,G(n),`rw`),!1),t.unlinkSync(n),xr(t).remove(n)}catch(t){e.error=t,e.hasError=!0}finally{ci(e)}}catch(t){throw j(Object.assign(t,{syscall:`unlink`,path:e}))}sa(this,`rename`,e.toString())}function hi(e,t,n=0){return Ar(Zr.call(this,e,{flag:t,mode:n}))}function gi(e,t,n){return Ar(Zr.call(this,e,{flag:t,mode:n,preserveSymlinks:!0}))}function _i(e,t={}){let n={stack:[],error:void 0,hasError:!1};try{let r=en(t,null,`r`,420);if(Pr(r.flag)&1)throw N(`EBADF`,`read`,e.toString());let i=si(n,typeof e==`number`?jr(this,e):Zr.call(this,e.toString(),{flag:r.flag,mode:420,preserveSymlinks:!1}),!1),{size:a}=i.stat(),o=or.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{ci(n)}}function vi(e,t,n={}){let r={stack:[],error:void 0,hasError:!1};try{let i=en(n,`utf8`,`w+`,420),a=Pr(i.flag);if(!(a&1||a&2))throw new M(k.EINVAL,`Flag passed to writeFile must allow for writing`);if(typeof t!=`string`&&!i.encoding)throw new M(k.EINVAL,`Encoding not specified`);let o=typeof t==`string`?or.Buffer.from(t,i.encoding):new Uint8Array(t.buffer,t.byteOffset,t.byteLength);if(!o)throw new M(k.EINVAL,`Data not specified`);si(r,typeof e==`number`?jr(this,e):Zr.call(this,e.toString(),{flag:a,mode:i.mode}),!1).writeSync(o,0,o.byteLength,0),sa(this,`change`,e.toString())}catch(e){r.error=e,r.hasError=!0}finally{ci(r)}}function yi(e,t,n={}){let r=en(n,`utf8`,`a+`,420),i=Pr(r.flag);if(!(i&1024))throw new M(k.EINVAL,`Flag passed to appendFile must allow for appending`);if(typeof t!=`string`&&!r.encoding)throw new M(k.EINVAL,`Encoding not specified`);let a=typeof t==`string`?or.Buffer.from(t,r.encoding):new Uint8Array(t.buffer,t.byteOffset,t.byteLength),o=typeof e==`number`?jr(this,e):Zr.call(this,U(e),{flag:i,mode:r.mode});o.writeSync(a,0,a.byteLength),typeof o!=`number`&&o.closeSync()}function bi(e,t){let n=jr(this,e).stat();return t?.bigint?new xn(n):new bn(n)}function xi(e){jr(this,e).closeSync(),Mr(this,e)}function Si(e,t=0){if(t||=0,t<0)throw new M(k.EINVAL);jr(this,e).truncateSync(t)}function Ci(e){jr(this,e).syncSync()}function wi(e){jr(this,e).datasyncSync()}function Ti(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=or.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=jr(this,e);c??=l.position;let u=l.writeSync(a,o,s,c);return sa(this,`change`,l.path),u}function Ei(e,t,n,r,i){let a=jr(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 N(`EINVAL`);return typeof i==`bigint`&&(i=Number(i)),i=Number.isSafeInteger(i)?i:a.position,a.readSync(t,o,r,i)}function Di(e,t,n){jr(this,e).chownSync(t,n)}function Oi(e,t){let n=Xt(t,-1);if(n<0)throw new M(k.EINVAL,`Invalid mode.`);jr(this,e).chmodSync(n)}function ki(e,t,n){jr(this,e).utimesSync($t(t),$t(n))}function Ai(e){let t={stack:[],error:void 0,hasError:!1};try{e=U(e);let{fs:n,path:r}=Xr(this,e),i=zr(n,`statSync`,{path:e,syscall:`rmdir`})(r);if(!J(i))throw N(`ENOTDIR`,`rmdir`,e);if(X&&!Y(this,i,2))throw N(`EACCES`,`rmdir`,e);si(t,Cr(n,G(r),`rw`),!1),zr(n,`rmdirSync`,e)(r),xr(n).remove(r),sa(this,`rename`,e.toString())}catch(e){t.error=e,t.hasError=!0}finally{ci(t)}}function ji(e,t){t=typeof t==`object`?t:{mode:t};let n=Xt(t?.mode,511);return $r.call(this,e,{...t,mode:n})}function Mi(e,t){t=typeof t==`object`?t:{encoding:t},e=U(e);let n=[],r=ei.call(this,e,t??void 0);for(let i of r)t?.withFileTypes?n.push(ii.from(i,t.encoding,e)):t?.encoding==`buffer`?n.push(or.Buffer.from(i.path)):n.push(i.path);return n}function Ni(e,t){return ni.call(this,e,t)}function Pi(e,t,n=`file`){let r={stack:[],error:void 0,hasError:!1};try{if(![`file`,`dir`,`junction`].includes(n))throw TypeError(`Invalid symlink type: `+n);t=U(t);let i=si(r,Zr.call(this,t,{flag:`wx`,mode:420}),!1);i.writeSync(T(U(e,!0))),i.chmodSync(Ze)}catch(e){r.error=e,r.hasError=!0}finally{ci(r)}}function Fi(e,t){let n=or.Buffer.from(Qr.call(this,e)),r=typeof t==`object`?t?.encoding:t;return r==`buffer`?n:n.toString(r??`utf-8`)}function Ii(e,t,n){let r={stack:[],error:void 0,hasError:!1};try{si(r,Zr.call(this,e,{flag:`r+`,mode:0}),!1).chownSync(t,n)}catch(e){r.error=e,r.hasError=!0}finally{ci(r)}}function Li(e,t,n){let r=gi.call(this,e,`r+`);Di.call(this,r,t,n),xi.call(this,r)}function Ri(e,t){let n;try{n=hi.call(this,e,`r+`)}catch(t){throw j(Object.assign(t,{syscall:`chmod`,path:U(e)}))}Oi.call(this,n,t),xi.call(this,n)}function zi(e,t){let n=gi.call(this,e,`r+`);Oi.call(this,n,t),xi.call(this,n)}function Bi(e,t,n){let r=hi.call(this,e,`r+`);ki.call(this,r,t,n),xi.call(this,r)}function Vi(e,t,n){let r=gi.call(this,e,`r+`);ki.call(this,r,t,n),xi.call(this,r)}function Hi(e,t){let n=typeof t==`string`?t:t?.encoding??`utf8`;e=U(e,!0);let{fullPath:r}=Xr(this,e);if(n==`utf8`||n==`utf-8`)return r;let i=or.Buffer.from(r,`utf-8`);return n==`buffer`?i:i.toString(n)}function Ui(e,t=384){if(X&&!Y(this,di.call(this,e),t))throw new M(k.EACCES)}function Wi(e,t){e=U(e);let n;try{n=fi.bind(this)(e)}catch(e){if(e.code!=`ENOENT`||!t?.force)throw e}if(n)switch(n.mode&Ye){case et:if(t?.recursive)for(let n of Mi.call(this,e))Wi.call(this,W(e,n),t);Ai.call(this,e);break;case Qe:case Ze:case $e:case tt:mi.call(this,e);break;case nt:case Xe:default:throw N(`ENOSYS`,`rm`,e)}}function Gi(e,t){let n=typeof t==`object`?t?.encoding:t||`utf8`,r=rn(e);return ji.call(this,r),n==`buffer`?or.Buffer.from(r):r}function Ki(e,t){let n=rn(e);ji.call(this,n);let r=()=>Wi(n,{recursive:!0,force:!0});return{path:n,remove:r,[Symbol.dispose]:r}}function qi(e,t,n){if(e=U(e),t=U(t),n&&n&1&&ui.call(this,t))throw N(`EEXIST`,`copyFile`,t);vi.call(this,t,_i.call(this,e)),sa(this,`rename`,t.toString())}function Ji(e,t,n){let r=jr(this,e),i=0;for(let e of t)i+=r.readSync(e,0,e.byteLength,n+i);return i}function Yi(e,t,n){let r=jr(this,e),i=0;for(let e of t)i+=r.writeSync(new Uint8Array(e.buffer),0,e.byteLength,n+i);return i}function Xi(e,t){return e=U(e),new oi(e,this)}function Zi(e,t,n){e=U(e),t=U(t);let r=fi.call(this,e);if(n?.errorOnExist&&ui.call(this,t))throw N(`EEXIST`,`cp`,t);switch(r.mode&Ye){case et:if(!n?.recursive)throw N(`EISDIR`,`cp`,e);ji.call(this,t,{recursive:!0});for(let r of Mi.call(this,e,{withFileTypes:!0}))n.filter&&!n.filter(W(e,r.name),W(t,r.name))||Zi.call(this,W(e,r.name),W(t,r.name),n);break;case Ze:if(n?.dereference)qi.call(this,e,t);else{let r=Fi.call(this,e,`utf8`);Pi.call(this,n?.verbatimSymlinks?r:ln.call(this,G(e),r),t)}break;case Qe:qi.call(this,e,t);break;case $e:case tt:case nt:case Xe:default:throw N(`ENOSYS`,`cp`,e)}n?.preserveTimestamps&&Bi.call(this,t,r.atime,r.mtime)}function Qi(e,t){e=U(e);let{fs:n}=Z(e,this);return Wr(n,t?.bigint)}function $i(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(tn),l=[];function u(e){let t=Mi(e,{withFileTypes:r,encoding:`utf8`});for(let n of t){let t=W(e,r?n.name:n);if(typeof i==`function`?i(r?n:t):i.some(e=>_n(e,t)))continue;let a=t.replace(/^\/+/g,``);di(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}const ea=di;var ta=class extends u.default{_context;path;off(e,t,n,r){return super.off(e,t,n,r)}removeListener(e,t,n,r){return super.removeListener(e,t,n,r)}constructor(e,t){super(),this._context=e,this.path=t}setMaxListeners(){throw N(`ENOSYS`,`Watcher.setMaxListeners`)}getMaxListeners(){throw N(`ENOSYS`,`Watcher.getMaxListeners`)}prependListener(){throw N(`ENOSYS`,`Watcher.prependListener`)}prependOnceListener(){throw N(`ENOSYS`,`Watcher.prependOnceListener`)}rawListeners(){throw N(`ENOSYS`,`Watcher.rawListeners`)}ref(){return this}unref(){return this}},na=class extends ta{options;realpath;constructor(e,t,n){let r=Ie(e);super(r,t),this.options=n,this.realpath=W(r.root,t),aa(this.realpath,this)}close(){super.emit(`close`),oa(this.realpath,this)}[Symbol.dispose](){this.close()}},ra=class extends ta{options;intervalId;previous;constructor(e,t,n){super(e,t),this.options=n,this.start()}onInterval(){try{let e=ea.call(this._context,this.path);Sn(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=ea.call(this._context,this.path)}catch(e){this.emit(`error`,e);return}this.intervalId=setInterval(this.onInterval.bind(this),e),!this.options.persistent&&typeof this.intervalId==`object`&&this.intervalId.unref()}stop(){this.intervalId&&=(clearInterval(this.intervalId),void 0),this.removeAllListeners()}};const ia=new Map;function aa(e,t){let n=U(e);ia.has(n)||ia.set(n,new Set),ia.get(n).add(t)}function oa(e,t){let n=U(e);ia.has(n)&&(ia.get(n).delete(t),ia.get(n).size===0&&ia.delete(n))}function sa(e,t,n){let r=Ie(e);r&&(n=W(r.root??`/`,n)),n=U(n);for(let e=n;;e=G(e)){let r=ia.get(e);if(r)for(let i of r)i.emit(`change`,t,fn.call(i._context,e,n)||pn(n));if(e===`/`)break}}var ca=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},la=(function(e){return function(t){function n(n){t.error=t.hasError?new e(n,t.error,`An error was suppressed during disposal.`):n,t.hasError=!0}var r,i=0;function a(){for(;r=t.stack.pop();)try{if(!r.async&&i===1)return i=0,t.stack.push(r),Promise.resolve().then(a);if(r.dispose){var e=r.dispose.call(r.value);if(r.async)return i|=2,Promise.resolve(e).then(a,function(e){return n(e),a()})}else i|=1}catch(e){n(e)}if(i===1)return t.hasError?Promise.reject(t.error):Promise.resolve();if(t.hasError)throw t.error}return a()}})(typeof SuppressedError==`function`?SuppressedError:function(e,t,n){var r=Error(n);return r.name=`SuppressedError`,r.error=e,r.suppressed=t,r});async function ua(e,t,n,r){if(t=ln.call(e,t),n){let n=Z(t,e,r),i=xr(n.fs).get(n.path)?.inode??await n.fs.stat(n.path).catch(()=>void 0);return{...n,fullPath:t,stats:i}}try{let i=Z(t,e),a=xr(i.fs).get(i.path)?.inode??await i.fs.stat(i.path);return Mn(a)?await ua(e,ln.call(e,G(t),await fa.call(e,t)),n,r):{...i,fullPath:t,stats:a}}catch{}let{base:i,dir:a}=gn(t),o=a==`/`?`/`:(await ua(e,a,!1,r)).fullPath,s=W(o,i),c=Z(s,e),l=xr(c.fs).get(c.path)?.inode??await c.fs.stat(c.path).catch(e=>{if(e.code!=`ENOENT`)throw j(Object.assign(e,{syscall:`stat`,path:s,...r}))});return l?Mn(l)?await ua(e,ln.call(e,o,await fa.call(e,s)),!1,r):{...c,fullPath:s,stats:l}:{...c,fullPath:s}}async function da(e,t,n){t=U(t);let r=Xt(n.mode,420),i=Pr(n.flag),a={syscall:`open`,path:t},{fs:o,path:s,stats:c}=await ua(e,t,n.preserveSymlinks,a);if(!c){let l={stack:[],error:void 0,hasError:!1};try{if(!(i&64))throw N(`ENOENT`,a);let u=G(s),d=await o.stat(u);if(X&&!Y(e,d,2))throw N(`EACCES`,`open`,G(t));if(!J(d))throw N(`ENOTDIR`,`open`,G(t));if(!n.allowDirectory&&r&16384)throw N(`EISDIR`,`open`,t);if(ca(l,await Sr(o,u,`rw`,d),!1),c=xr(o).get(s)?.inode??await o.stat(s).catch(()=>void 0),!c){let{euid:n,egid:a}=Ie(e).credentials,c=await o.createFile(s,{mode:r,uid:d.mode&2048?d.uid:n,gid:d.mode&1024?d.gid:a});return sa(e,`rename`,t),new kr(e,t,s,i,xr(o).ref(s,c))}}catch(e){l.error=e,l.hasError=!0}finally{la(l)}}if(X&&!Y(e,c,Ir(i)))throw N(`EACCES`,a);if(i&128)throw N(`EEXIST`,a);if(!n.allowDirectory&&r&16384)throw N(`EISDIR`,`open`,t);let l=new kr(e,t,s,i,xr(o).ref(s,c));return i&512&&await l.truncate(0),l}async function fa(e){e=U(e);let t={syscall:`readlink`,path:e},{fs:n,stats:r,path:i}=await ua(this,e,!0,t);if(!r)throw N(`ENOENT`,t);if(X&&!Y(this,r,4))throw N(`EACCES`,t);if(!Mn(r))throw N(`EINVAL`,t);let a=r.size,o=new Uint8Array(a);return await n.read(i,o,0,a),E(o)}async function pa(e,t={}){let n=U(e),{euid:r,egid:i}=Ie(this).credentials,{mode:a=511,recursive:o}=t,s={syscall:`mkdir`,path:n},{fullPath:c}=await ua(this,G(n),!1,s),{fs:l,path:u}=Z(W(c,pn(n)),this,s),d=c!=G(n),f,p=async(e,t)=>{let n={stack:[],error:void 0,hasError:!1};try{let c=G(t),m=o&&c!=`/`?await p(G(e),c):await l.stat(c);if(ca(n,await Sr(l,c,`rw`,m),!1),o){let n=xr(l).get(t)?.inode??await l.stat(t).catch(()=>null);if(n){let r=Mn(n)?(await ua(this,e,!1,s)).stats:n;if(!r)throw N(`ENOENT`,s);if(!J(r))throw N(t==u?`EEXIST`:`ENOTDIR`,s);return n}if(d&&await l.exists(W(c,pn(e))))throw N(`ENOTDIR`,`mkdir`,e)}if(X&&!Y(this,m,2))throw N(`EACCES`,`mkdir`,e);let h=await l.mkdir(t,{mode:a,uid:m.mode&2048?m.uid:r,gid:m.mode&1024?m.gid:i}).catch(F({syscall:`mkdir`,path:e}));return o&&(f??=e),sa(this,`rename`,e),h}catch(e){n.error=e,n.hasError=!0}finally{la(n)}};return await p(n,u),f}async function ma(e,t={}){e=U(e);let n={syscall:`scandir`,path:e},{fs:r,path:i,stats:a}=await ua(this,e,!1,n);if(!a)throw N(`ENOENT`,n);if(X&&!Y(this,a,4))throw N(`EACCES`,n);if(!J(a))throw N(`ENOTDIR`,n);let o;{let e={stack:[],error:void 0,hasError:!1};try{ca(e,await Sr(r,i,`ro`,a),!1),o=await r.readdir(i)}catch(t){e.error=t,e.hasError=!0}finally{la(e)}}let s=[],c=async e=>{let n=await r.stat(W(i,e)).catch(e=>{if(e.code!=`ENOENT`)throw e});if(!n)return;let a=new dr;if(a.ino=n.ino,a.type=lr(n.mode),a.path=e,a.name=pn(e),s.push(a),!t.recursive||!J(n))return;let o=await r.readdir(W(i,e));for(let t of o)await c(W(e,t))};return await Promise.all(o.map(c)),s}async function ha(e,t){let n={stack:[],error:void 0,hasError:!1};try{e=U(e),t=U(t);let r={syscall:`rename`,path:e,dest:t},i=await ua(this,e,!0,r),a=Z(t,this,r);if(i.fs.uuid!==a.fs.uuid)throw N(`EXDEV`,r);if(a.path.startsWith(i.path+`/`))throw N(`EINVAL`,r);if(!i.stats)throw N(`ENOENT`,r);let o=i.fs,s=await o.stat(G(i.path)),c=await o.stat(G(a.path)),l=await o.stat(a.path).catch(e=>{if(e.code==`ENOENT`)return null;throw e});if(X&&(!Y(this,s,4)||!Y(this,c,2)))throw N(`EACCES`,r);if(l&&!J(i.stats)&&J(l))throw N(`EISDIR`,r);if(l&&J(i.stats)&&!J(l))throw N(`ENOTDIR`,r);let u=G(i.path),d=G(a.path),f=[[u,s],[d,c]];s.ino>c.ino&&f.reverse(),ca(n,await Sr(o,f[0][0],`rw`,f[0][1]),!1),ca(n,s.ino==c.ino?null:await Sr(o,f[1][0],`rw`,f[1][1]),!1),await i.fs.rename(i.path,a.path),xr(o).rename(i.path,a.path),sa(this,`rename`,e),sa(this,`rename`,t)}catch(e){n.error=e,n.hasError=!0}finally{la(n)}}async function ga(e,t){let n={stack:[],error:void 0,hasError:!1};try{e=U(e),t=U(t);let r={syscall:`link`,path:e,dest:t},{fs:i,path:a}=Z(e,this,r),o=Z(t,this,r);if(i.uuid!=o.fs.uuid)throw N(`EXDEV`,r);let s=await i.stat(a);if(X){if(!Y(this,s,4))throw N(`EACCES`,r);let e=await i.stat(G(a));if(!Y(this,e,4))throw N(`EACCES`,r);let t=await i.stat(G(o.path));if(!Y(this,t,2))throw N(`EACCES`,r)}ca(n,await Sr(i,G(o.path),`rw`),!1),await i.link(a,o.path),xr(i).link(a,o.path)}catch(e){n.error=e,n.hasError=!0}finally{la(n)}}async function _a(e,t){e=U.call(this,e);let n={syscall:t?`lstat`:`stat`,path:e},r;if(!t)r=(await ua(this,e,!1,n)).stats;else{let{base:t,dir:i}=gn(e),{fs:a,path:o}=await ua(this,i,!1,n),s=t?W(o,t):o;r=xr(a).get(s)?.inode??await a.stat(s).catch(F(n))}if(!r)throw N(`ENOENT`,n);if(X&&!Y(this,r,4))throw N(`EACCES`,n);return r}var va=class extends u.default{input;output;terminal;line=``;_cursor=0;get cursor(){return this._cursor}_buffer=``;_closed=!1;_paused=!1;_prompt=``;_history=[];_historyIndex=-1;_currentLine=``;constructor(e,t,n,r=!1){super(),this.input=e,this.output=t,this.terminal=r,this.input.on(`data`,this._onData),this.input.on(`end`,this.close.bind(this)),this.input.on(`close`,this.close.bind(this))}_onData=e=>{if(!(this._paused||this._closed)){this._buffer+=typeof e==`string`?e:e.toString(`utf8`);for(let e=this._buffer.indexOf(`
1
+ import{i as e,n as t,t as n}from"./rolldown-runtime-Dd_uD5pT.js";import{n as r,t as i}from"./safe-buffer-B2wnAhUx.js";function a(e,t){if(e.byteLength>=t)return e;if(ArrayBuffer.isView(e)){let n=a(e.buffer,t);return new e.constructor(n,e.byteOffset,t)}let n=typeof SharedArrayBuffer<`u`&&e instanceof SharedArrayBuffer;if(e.maxByteLength>t)return n?e.grow(t):e.resize(t),e;if(n){let n=new SharedArrayBuffer(t);return new Uint8Array(n).set(new Uint8Array(e)),n}try{return e.transfer(t)}catch{let n=new ArrayBuffer(t);return new Uint8Array(n).set(new Uint8Array(e)),n}}var o=class extends DataView{constructor(e,t,n){let{buffer:r,byteOffset:i,byteLength:a}=new Uint8Array(e,t,n);super(r,i,a)}};for(let e of Object.getOwnPropertyNames(DataView.prototype))!e.startsWith(`get`)&&!e.startsWith(`set`)||Object.defineProperty(o.prototype,e,{value:()=>{throw ReferenceError(`Do not use DataView methods on a BufferView.`)},writable:!1,enumerable:!1,configurable:!1});var s=class{id;_size;options;regions=[];get size(){return this._size}set size(e){if(e>=this._size){this._size=e;return}this._size=e;for(let t=this.regions.length-1;t>=0;t--){let n=this.regions[t];if(n.offset>=e){this.regions.splice(t,1);continue}let r=e-n.offset;n.data.byteLength>r&&(n.data=n.data.subarray(0,r)),n.ranges=n.ranges.filter(t=>t.start<e).map(t=>t.end>e?{start:t.start,end:e}:t)}}constructor(e,t,n,r){this.id=e,this._size=t,this.options=n,n.sparse??=!0,n.sparse||this.regions.push({offset:0,data:new Uint8Array(t),ranges:[]}),r?.set(e,this)}collect(){if(!this.options.sparse)return;let{regionGapThreshold:e=4095}=this.options;for(let t=0;t<this.regions.length-1;){let n=this.regions[t],r=this.regions[t+1];if(r.offset-(n.offset+n.data.byteLength)>e){t++;continue}n.ranges.push(...r.ranges),n.ranges.sort((e,t)=>e.start-t.start),n.ranges=n.ranges.reduce((e,t)=>(!e.length||e.at(-1).end<t.start?e.push(t):e.at(-1).end=Math.max(e.at(-1).end,t.end),e),[]),n.data=a(n.data,r.offset+r.data.byteLength),n.data.set(r.data,r.offset-n.offset),this.regions.splice(t+1,1)}}missing(e,t){let n=[];for(let r of this.regions){if(r.offset>=t)break;for(let i of r.ranges)if(!(i.end<=e)&&(i.start>=t||(i.start>e&&n.push({start:e,end:Math.min(i.start,t)}),i.end>e&&(e=Math.max(e,i.end)),e>=t)))break;if(e>=t)break}return e<t&&n.push({start:e,end:t}),n}cached(e,t){let n=[];for(let r of this.regions){if(r.offset>=t)break;for(let i of r.ranges)if(!(i.end<=e)){if(i.start>=t)break;n.push({start:Math.max(e,i.start),end:Math.min(t,i.end)})}}n.sort((e,t)=>e.start-t.start);let r=[];for(let e of n){let t=r.at(-1);t&&e.start<=t.end?t.end=Math.max(t.end,e.end):r.push(e)}return r}regionAt(e){if(this.regions.length)for(let t of this.regions){if(t.offset>e)break;if(e>=t.offset&&e<t.offset+t.data.byteLength)return t}}add(e,t){let n=t+e.byteLength,r=this.regionAt(t);if(r)return r.data=a(r.data,n),r.data.set(e,t),r.ranges.push({start:t,end:n}),r.ranges.sort((e,t)=>e.start-t.start),this.collect(),this;let i={data:e,offset:t,ranges:[{start:t,end:n}]},o=this.regions.findIndex(e=>e.offset>t);return o==-1?this.regions.push(i):this.regions.splice(o,0,i),this.collect(),this}};const c=new Uint32Array(256);for(let e=0;e<256;e++){let t=e;for(let e=0;e<8;e++)t=t&1?2197175160^t>>>1:t>>>1;c[e]=t}function l(e){let t=4294967295;for(let n=0;n<e.length;n++)t=t>>>8^c[(t^e[n])&255];return(t^4294967295)>>>0}var u=e(n(((e,t)=>{var n=Object.prototype.hasOwnProperty,r=`~`;function i(){}Object.create&&(i.prototype=Object.create(null),new i().__proto__||(r=!1));function a(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function o(e,t,n,i,o){if(typeof n!=`function`)throw TypeError(`The listener must be a function`);var s=new a(n,i||e,o),c=r?r+t:t;return e._events[c]?e._events[c].fn?e._events[c]=[e._events[c],s]:e._events[c].push(s):(e._events[c]=s,e._eventsCount++),e}function s(e,t){--e._eventsCount===0?e._events=new i:delete e._events[t]}function c(){this._events=new i,this._eventsCount=0}c.prototype.eventNames=function(){var e=[],t,i;if(this._eventsCount===0)return e;for(i in t=this._events)n.call(t,i)&&e.push(r?i.slice(1):i);return Object.getOwnPropertySymbols?e.concat(Object.getOwnPropertySymbols(t)):e},c.prototype.listeners=function(e){var t=r?r+e:e,n=this._events[t];if(!n)return[];if(n.fn)return[n.fn];for(var i=0,a=n.length,o=Array(a);i<a;i++)o[i]=n[i].fn;return o},c.prototype.listenerCount=function(e){var t=r?r+e:e,n=this._events[t];return n?n.fn?1:n.length:0},c.prototype.emit=function(e,t,n,i,a,o){var s=r?r+e:e;if(!this._events[s])return!1;var c=this._events[s],l=arguments.length,u,d;if(c.fn){switch(c.once&&this.removeListener(e,c.fn,void 0,!0),l){case 1:return c.fn.call(c.context),!0;case 2:return c.fn.call(c.context,t),!0;case 3:return c.fn.call(c.context,t,n),!0;case 4:return c.fn.call(c.context,t,n,i),!0;case 5:return c.fn.call(c.context,t,n,i,a),!0;case 6:return c.fn.call(c.context,t,n,i,a,o),!0}for(d=1,u=Array(l-1);d<l;d++)u[d-1]=arguments[d];c.fn.apply(c.context,u)}else{var f=c.length,p;for(d=0;d<f;d++)switch(c[d].once&&this.removeListener(e,c[d].fn,void 0,!0),l){case 1:c[d].fn.call(c[d].context);break;case 2:c[d].fn.call(c[d].context,t);break;case 3:c[d].fn.call(c[d].context,t,n);break;case 4:c[d].fn.call(c[d].context,t,n,i);break;default:if(!u)for(p=1,u=Array(l-1);p<l;p++)u[p-1]=arguments[p];c[d].fn.apply(c[d].context,u)}}return!0},c.prototype.on=function(e,t,n){return o(this,e,t,n,!1)},c.prototype.once=function(e,t,n){return o(this,e,t,n,!0)},c.prototype.removeListener=function(e,t,n,i){var a=r?r+e:e;if(!this._events[a])return this;if(!t)return s(this,a),this;var o=this._events[a];if(o.fn)o.fn===t&&(!i||o.once)&&(!n||o.context===n)&&s(this,a);else{for(var c=0,l=[],u=o.length;c<u;c++)(o[c].fn!==t||i&&!o[c].once||n&&o[c].context!==n)&&l.push(o[c]);l.length?this._events[a]=l.length===1?l[0]:l:s(this,a)}return this},c.prototype.removeAllListeners=function(e){var t;return e?(t=r?r+e:e,this._events[t]&&s(this,t)):(this._events=new i,this._eventsCount=0),this},c.prototype.off=c.prototype.removeListener,c.prototype.addListener=c.prototype.on,c.prefixed=r,c.EventEmitter=c,t!==void 0&&(t.exports=c)}))(),1),d=class extends u.default{[Symbol.toStringTag]=`List`;constructor(e){super(),e&&this.push(...e)}data=new Set;toSet(){return new Set(this.data)}toArray(){return Array.from(this.data)}toJSON(){return Array.from(this.data)}toString(){return this.join(`,`)}_set(e,t,n=!1){if(Math.abs(e)>this.data.size)throw ReferenceError(`Can not set an element outside the bounds of the list`);let r=Array.from(this.data);r.splice(e,+n,t),this.data=new Set(r),this.emit(`update`)}set(e,t){this._set(e,t,!0)}deleteAt(e){if(Math.abs(e)>this.data.size)throw ReferenceError(`Can not delete an element outside the bounds of the list`);this.delete(Array.from(this.data).at(e))}insert(e,t=this.data.size){this._set(t,e,!1)}at(e){if(Math.abs(e)>this.data.size)throw ReferenceError(`Can not access an element outside the bounds of the list`);return Array.from(this.data).at(e)}pop(){let e=Array.from(this.data).pop();return e!==void 0&&this.delete(e),e}push(...e){for(let t of e)this.add(t);return this.data.size}join(e){return Array.from(this.data).join(e)}splice(e,t,...n){if(Math.abs(e)>this.data.size)throw ReferenceError(`Can not splice elements outside the bounds of the list`);let r=Array.from(this.data),i=r.splice(e,t,...n);return this.data=new Set(r),this.emit(`update`),i}add(e){return this.data.add(e),this.emit(`update`),this.emit(`add`,e),this}clear(){this.data.clear(),this.emit(`update`)}delete(e){let t=this.data.delete(e);return this.emit(`update`),t}has(e){return this.data.has(e)}get size(){return this.data.size}entries(){return this.toArray().entries()}keys(){return this.toArray().keys()}values(){return this.data.values()}[Symbol.iterator](){return this.data[Symbol.iterator]()}};function f(e,t){let n=Object.entries(e);return Object.fromEntries(n.filter(([e,n])=>t(e,n)))}function p(e,...t){let n={};for(let r of t.flat())n[r]=e[r];return n}function m(e,...t){return f(e,e=>!t.flat().includes(e))}function h(e){try{return JSON.parse(e),!0}catch{return!1}}function g(e){let t=[];for(let n=e;n&&![`Function`,`Object`].includes(n.constructor.name);n=Object.getPrototypeOf(n))t.push(n.constructor.name);return t}function _(e,t){return Object.fromEntries(Object.entries(e).map(([e,n])=>[e,typeof n==`function`?n.bind(t):n]))}function v(e=Error()){let t=setTimeout(()=>{throw e},5e3);return()=>clearTimeout(t)}function y(e){throw e&&typeof e==`object`&&g(e).includes(`Error`)&&Error?.captureStackTrace(e,y),e}function b(e,t){if(![`getter`,`accessor`].includes(t.kind))throw Error(`@memoize can only be used on getters and auto-accessors`);let n=new WeakMap;function r(){if(n.has(this))return n.get(this);let t=typeof e==`function`?e.call(this):e.get.call(this);return n.set(this,t),t}switch(t.kind){case`getter`:return r;case`accessor`:return{...e,get:r}}}const x=Intl.NumberFormat(`en`,{notation:`compact`});x.format.bind(x);function S(e=0,t=1){return Math.round(Math.random()*(t-e)+e)}function C(e){return e.at(0).toUpperCase()+e.slice(1)}const w=new TextEncoder;function T(e){return w.encode(e)}const ee=new TextDecoder;function E(e){if(!e)return``;if(e.buffer instanceof ArrayBuffer&&!e.buffer.resizable)return ee.decode(e);let t=new Uint8Array(e.byteLength);return t.set(e),ee.decode(t)}function te(e){let t=new Uint8Array(e.length);for(let n=0;n<e.length;n++)t[n]=e.charCodeAt(n);return t}function ne(e){let t=``;for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return t}function D(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 O(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 k;(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`})(k||={});const A={[k.EPERM]:`operation not permitted`,[k.ENOENT]:`no such file or directory`,[k.ESRCH]:`no such process`,[k.EINTR]:`interrupted system call`,[k.EIO]:`i/o error`,[k.ENXIO]:`no such device or address`,[k.E2BIG]:`argument list too long`,[k.ENOEXEC]:`exec format error`,[k.EBADF]:`bad file descriptor`,[k.ECHILD]:`no child processes`,[k.EAGAIN]:`resource temporarily unavailable`,[k.ENOMEM]:`not enough memory`,[k.EACCES]:`permission denied`,[k.EFAULT]:`bad address in system call argument`,[k.ENOTBLK]:`block device required`,[k.EBUSY]:`resource busy or locked`,[k.EEXIST]:`file already exists`,[k.EXDEV]:`cross-device link not permitted`,[k.ENODEV]:`no such device`,[k.ENOTDIR]:`not a directory`,[k.EISDIR]:`illegal operation on a directory`,[k.EINVAL]:`invalid argument`,[k.ENFILE]:`file table overflow`,[k.EMFILE]:`too many open files`,[k.ETXTBSY]:`text file is busy`,[k.EFBIG]:`file too large`,[k.ENOSPC]:`no space left on device`,[k.ESPIPE]:`invalid seek`,[k.EROFS]:`read-only file system`,[k.EMLINK]:`too many links`,[k.EPIPE]:`broken pipe`,[k.EDOM]:`numerical argument out of domain`,[k.ERANGE]:`result too large`,[k.EDEADLK]:`resource deadlock would occur`,[k.ENAMETOOLONG]:`name too long`,[k.ENOLCK]:`no locks available`,[k.ENOSYS]:`function not implemented`,[k.ENOTEMPTY]:`directory not empty`,[k.ELOOP]:`too many symbolic links encountered`,[k.ENOMSG]:`no message of desired type`,[k.EIDRM]:`identifier removed`,[k.ECHRNG]:`channel number out of range`,[k.EL2NSYNC]:`level 2 not synchronized`,[k.EL3HLT]:`level 3 halted`,[k.EL3RST]:`level 3 reset`,[k.ENRNG]:`link number out of range`,[k.EUNATCH]:`protocol driver not attached`,[k.ECSI]:`no CSI structure available`,[k.EL2HLT]:`level 2 halted`,[k.EBADE]:`invalid exchange`,[k.EBADR]:`invalid request descriptor`,[k.EXFULL]:`exchange full`,[k.ENOANO]:`no anode`,[k.EBADRQC]:`invalid request code`,[k.EBADSLT]:`invalid slot`,[k.EBFONT]:`bad font file format`,[k.ENOSTR]:`device not a stream`,[k.ENODATA]:`no data available`,[k.ETIME]:`timer expired`,[k.ENOSR]:`out of streams resources`,[k.ENONET]:`machine is not on the network`,[k.ENOPKG]:`package not installed`,[k.EREMOTE]:`object is remote`,[k.ENOLINK]:`link has been severed`,[k.EADV]:`advertise error`,[k.ESRMNT]:`srmount error`,[k.ECOMM]:`communication error on send`,[k.EPROTO]:`protocol error`,[k.EMULTIHOP]:`multihop attempted`,[k.EDOTDOT]:`rFS specific error`,[k.EBADMSG]:`bad message`,[k.EOVERFLOW]:`value too large for defined data type`,[k.ENOTUNIQ]:`name not unique on network`,[k.EBADFD]:`file descriptor in bad state`,[k.EREMCHG]:`remote address changed`,[k.ELIBACC]:`can not access a needed shared library`,[k.ELIBBAD]:`accessing a corrupted shared library`,[k.ELIBSCN]:`.lib section in a.out corrupted`,[k.ELIBMAX]:`attempting to link in too many shared libraries`,[k.ELIBEXEC]:`cannot exec a shared library directly`,[k.EILSEQ]:`illegal byte sequence`,[k.ERESTART]:`interrupted system call should be restarted`,[k.ESTRPIPE]:`streams pipe error`,[k.EUSERS]:`too many users`,[k.ENOTSOCK]:`socket operation on non-socket`,[k.EDESTADDRREQ]:`destination address required`,[k.EMSGSIZE]:`message too long`,[k.EPROTOTYPE]:`protocol wrong type for socket`,[k.ENOPROTOOPT]:`protocol not available`,[k.EPROTONOSUPPORT]:`protocol not supported`,[k.ESOCKTNOSUPPORT]:`socket type not supported`,[k.ENOTSUP]:`operation not supported on socket`,[k.EPFNOSUPPORT]:`protocol family not supported`,[k.EAFNOSUPPORT]:`address family not supported`,[k.EADDRINUSE]:`address already in use`,[k.EADDRNOTAVAIL]:`address not available`,[k.ENETDOWN]:`network is down`,[k.ENETUNREACH]:`network is unreachable`,[k.ENETRESET]:`network dropped connection on reset`,[k.ECONNABORTED]:`software caused connection abort`,[k.ECONNRESET]:`connection reset by peer`,[k.ENOBUFS]:`no buffer space available`,[k.EISCONN]:`socket is already connected`,[k.ENOTCONN]:`socket is not connected`,[k.ESHUTDOWN]:`cannot send after transport endpoint shutdown`,[k.ETOOMANYREFS]:`too many references: cannot splice`,[k.ETIMEDOUT]:`connection timed out`,[k.ECONNREFUSED]:`connection refused`,[k.EHOSTDOWN]:`host is down`,[k.EHOSTUNREACH]:`host is unreachable`,[k.EALREADY]:`connection already in progress`,[k.EINPROGRESS]:`operation now in progress`,[k.ESTALE]:`stale file handle`,[k.EEUCLEAN]:`structure needs cleaning`,[k.ENOTNAM]:`not a XENIX named type file`,[k.ENAVAIL]:`no XENIX semaphores available`,[k.EISNAM]:`is a named type file`,[k.EREMOTEIO]:`remote I/O error`,[k.EDQUOT]:`disk quota exceeded`,[k.ENOMEDIUM]:`no medium found`,[k.EMEDIUMTYPE]:`wrong medium type`,[k.ECANCELED]:`operation canceled`,[k.ENOKEY]:`required key not available`,[k.EKEYEXPIRED]:`key has expired`,[k.EKEYREVOKED]:`key has been revoked`,[k.EKEYREJECTED]:`key was rejected by service`,[k.EOWNERDEAD]:`owner died`,[k.ENOTRECOVERABLE]:`state not recoverable`,[k.ERFKILL]:`operation not possible due to RF-kill`,[k.EHWPOISON]:`memory page has hardware error`};function j(e){let t=`${e.code}: ${A[e.errno]}, ${e.syscall}`;e.path&&(t+=` '${e.path}'`),e.dest&&(t+=` -> '${e.dest}'`);let n=e.message.startsWith(A[e.errno])||/^E[A-Z0-9]+: /.test(e.message);return e.message&&!n&&(t+=` (${e.message})`),e.message=t,e}var M=class e extends Error{errno;code;path;dest;syscall;constructor(e,t,n={}){let r=k[e];super(t||``),this.errno=e,this.code=r,Object.assign(this,m(n,`message`)),t||j(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 N(e,t,n,r){typeof t==`string`&&(t={syscall:t,path:n,dest:r});let i=new M(k[e],!1,t??{});return Error.captureStackTrace?.(i,N),i}function P(e,t){let n=new M(k[e],t??A[k[e]]);return Error.captureStackTrace?.(n,P),n}function F(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),j(e),e}}var re=t({Level:()=>I,alert:()=>ce,configure:()=>Ee,crit:()=>le,debug:()=>fe,deprecated:()=>pe,emerg:()=>se,entries:()=>R,err:()=>z,fancy:()=>ve,format:()=>be,info:()=>de,isEnabled:()=>Te,levelOf:()=>ie,levels:()=>L,log:()=>ae,notice:()=>ue,warn:()=>B}),I;(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`})(I||={});const L=[`emergency`,`alert`,`critical`,`error`,`warning`,`notice`,`info`,`debug`];function ie(e){return L.indexOf(e)}const R=new d;function ae(e,t){if(!Te)return;let n={level:e,message:t,timestamp:new Date,elapsedMs:performance.now()};R.add(n),Se(n)}function oe(e){return function(t){return ae(e,t.toString()),t}}const se=oe(I.EMERG),ce=oe(I.ALERT),le=oe(I.CRIT),z=oe(I.ERR),B=oe(I.WARN),ue=oe(I.NOTICE),de=oe(I.INFO),fe=oe(I.DEBUG);function pe(e){ae(I.WARN,e+` is deprecated and should not be used.`)}function me(e,t){return`\x1b[${t}m${e}\x1b[0m`}function he(e){return`[`+(e.elapsedMs/1e3).toFixed(3).padStart(10)+`] `}const ge={ansi:{[I.EMERG]:`1;4;37;41`,[I.ALERT]:`1;37;41`,[I.CRIT]:`1;35`,[I.ERR]:`1;31`,[I.WARN]:`1;33`,[I.NOTICE]:`1;36`,[I.INFO]:`1;37`,[I.DEBUG]:`0;2;37`},css:{[I.EMERG]:`font-weight: bold; text-decoration: underline; color: white; background-color: red;`,[I.ALERT]:`font-weight: bold; color: white; background-color: red;`,[I.CRIT]:`font-weight: bold; color: magenta;`,[I.ERR]:`font-weight: bold; color: red;`,[I.WARN]:`font-weight: bold; color: yellow;`,[I.NOTICE]:`font-weight: bold; color: cyan;`,[I.INFO]:`font-weight: bold; color: white;`,[I.DEBUG]:`opacity: 0.8; color: white;`}},_e={ansi:{[I.EMERG]:`1;31`,[I.ALERT]:`1;31`,[I.CRIT]:`1;31`,[I.ERR]:`31`,[I.WARN]:`33`,[I.NOTICE]:`1;37`,[I.INFO]:`37`,[I.DEBUG]:`2;37`},css:{[I.EMERG]:`font-weight: bold; color: red;`,[I.ALERT]:`font-weight: bold; color: red;`,[I.CRIT]:`font-weight: bold; color: red;`,[I.ERR]:`color: red;`,[I.WARN]:`color: yellow;`,[I.NOTICE]:`font-weight: bold; color: white;`,[I.INFO]:`color: white;`,[I.DEBUG]:`opacity: 0.8; color: white;`}};function ve({style:e,colorize:t}){return function*(n){e==`css`&&(yield t==`level`?`%c%s %c%s`:`%c%s %c%s%s %c%s`),yield*e==`ansi`?[me(he(n),`2;37`)]:[`opacity: 0.8; color: white;`,he(n)];let r=e==`ansi`?[me(L[n.level].toUpperCase(),ge.ansi[n.level])]:[ge.css[n.level],L[n.level].toUpperCase()];if(t==`level`){yield*r,yield n.message;return}n.level<I.CRIT&&(yield*r),e==`ansi`?yield me(n.message,_e.ansi[n.level]):yield*[_e.css[n.level],n.message]}}let ye=e=>[he(e),e.message];function be(e){let t=ye(e);return typeof t==`string`?[t]:Array.from(t)}let xe=console.error;function Se(e){e.level>Ce||xe(...be(e))}let Ce=I.ALERT,we=!1,Te=!0;function Ee(e){if(ye=e.format??ye,xe=e.output??xe,Ce=typeof e.level==`string`?ie(e.level):e.level??Ce,Te=e.enabled??Te,we=e.stack??we,e.dumpBacklog)for(let e of R)Se(e)}function De(e){return typeof e==`object`&&!!e&&`create`in e&&typeof e.create==`function`}function Oe(e,t){return Object.defineProperty(t,"prototype",{value:void 0}),e&&Object.defineProperty(t,"name",{value:e}),t}function ke(e){return!(e&&e.constructor===Function)||e.prototype===void 0?!1:Function.prototype!==Object.getPrototypeOf(e)||Object.getOwnPropertyNames(e.prototype).length>1}function Ae(e,t){if(typeof t!=`object`||!t)throw z(P(`EINVAL`,`Invalid options`));for(let[n,r]of Object.entries(e.options)){let e=t?.[n];if(e==null){if(!r.required){fe(`Using default for option: `+n);continue}throw z(P(`EINVAL`,`Missing required option: `+n))}let i=(t,n=e)=>typeof t==`function`?ke(t)?e instanceof t:t(e):typeof e===t||e?.constructor?.name===t;if(Array.isArray(r.type)?r.type.some(e=>i(e)):i(r.type))continue;let a=typeof e==`object`&&`constructor`in e?e.constructor.name:typeof e,o=e=>typeof e==`function`?e.name==`type`?e.toString():e.name:e,s=Array.isArray(r.type)?`one of ${r.type.map(o).join(`, `)}`:o(r.type);throw z(P(`EINVAL`,`Incorrect type for "${n}": ${a} (expected ${s})`))}}function je(e){return typeof e==`object`&&!!e&&`backend`in e&&De(e.backend)}function Me(e){return{suid:e.uid,sgid:e.gid,euid:e.uid,egid:e.gid,groups:[],...e}}function Ne(e){return e?!e.uid||!e.gid||!e.euid||!e.egid||e.groups.some(e=>!e):!1}const Pe=Symbol(`ZenFSContext`),Fe={[Pe]:!0,id:0,root:`/`,pwd:`/`,credentials:Me({uid:0,gid:0}),descriptors:new Map,parent:null,children:[]};function Ie(e){return typeof e==`object`&&e&&Pe in e?e:Fe}let Le=1;function Re(e,t={}){let{root:n=e.root,pwd:r=e.pwd,credentials:i=structuredClone(e.credentials)}=t,a={[Pe]:!0,id:Le++,root:n,pwd:r,credentials:Me(i),descriptors:new Map,parent:e,children:[]};return Object.defineProperties(a,{id:{configurable:!1,writable:!1},credentials:{configurable:!1,writable:!1},descriptors:{configurable:!1,writable:!1},parent:{configurable:!1,writable:!1},children:{configurable:!1,writable:!1}}),a}var ze=t({COPYFILE_EXCL:()=>1,COPYFILE_FICLONE:()=>2,COPYFILE_FICLONE_FORCE:()=>4,F_OK:()=>0,O_APPEND:()=>Be,O_CREAT:()=>64,O_DIRECT:()=>qe,O_DIRECTORY:()=>Ve,O_DSYNC:()=>Ge,O_EXCL:()=>128,O_NOATIME:()=>He,O_NOCTTY:()=>256,O_NOFOLLOW:()=>Ue,O_NONBLOCK:()=>Je,O_RDONLY:()=>0,O_RDWR:()=>2,O_SYMLINK:()=>Ke,O_SYNC:()=>We,O_TRUNC:()=>512,O_WRONLY:()=>1,R_OK:()=>4,S_IFBLK:()=>$e,S_IFCHR:()=>tt,S_IFDIR:()=>et,S_IFIFO:()=>nt,S_IFLNK:()=>Ze,S_IFMT:()=>Ye,S_IFREG:()=>Qe,S_IFSOCK:()=>Xe,S_IRGRP:()=>32,S_IROTH:()=>4,S_IRUSR:()=>256,S_IRWXG:()=>56,S_IRWXO:()=>7,S_IRWXU:()=>448,S_ISGID:()=>it,S_ISUID:()=>rt,S_ISVTX:()=>512,S_IWGRP:()=>16,S_IWOTH:()=>2,S_IWUSR:()=>128,S_IXGRP:()=>8,S_IXOTH:()=>1,S_IXUSR:()=>64,UV_FS_O_FILEMAP:()=>0,W_OK:()=>2,X_OK:()=>1,size_max:()=>at});const Be=1024,Ve=65536,He=262144,Ue=131072,We=1052672,Ge=4096,Ke=32768,qe=16384,Je=2048,Ye=61440,Xe=49152,Ze=40960,Qe=32768,$e=24576,et=16384,tt=8192,nt=4096,rt=2048,it=1024,at=4294967295;function ot(e){return`__isArrayType`in e&&e.__isArrayType===!0}function st(e){return typeof e!=`object`&&typeof e!=`function`||e==null?!1:ot(e)?st(e.type):`name`in e&&`size`in e&&`get`in e&&`set`in e&&typeof e.name==`string`&&typeof e.size==`number`&&typeof e.get==`function`&&typeof e.set==`function`&&ct.has(e.name)&&ct.get(e.name)?.name===e.name}const ct=new Map;function lt(e){if(ct.has(e.name))throw ReferenceError(`Type is already registered: ${e.name}`);ct.set(e.name,e)}const ut=Symbol(`DataView`);function dt(e){return e[ut]??=new DataView(e),e[ut]}const ft={name:`int8`,size:1,array:Int8Array,get:(e,t)=>dt(e).getInt8(t),set:(e,t,n)=>dt(e).setInt8(t,n)},pt={name:`uint8`,size:1,array:Uint8Array,get:(e,t)=>dt(e).getUint8(t),set:(e,t,n)=>dt(e).setUint8(t,n)},mt={int8:ft,uint8:pt,int16:{name:`int16`,size:2,array:Int16Array,get:(e,t)=>dt(e).getInt16(t,!0),set:(e,t,n)=>dt(e).setInt16(t,n,!0)},uint16:{name:`uint16`,size:2,array:Uint16Array,get:(e,t)=>dt(e).getUint16(t,!0),set:(e,t,n)=>dt(e).setUint16(t,n,!0)},int32:{name:`int32`,size:4,array:Int32Array,get:(e,t)=>dt(e).getInt32(t,!0),set:(e,t,n)=>dt(e).setInt32(t,n,!0)},uint32:{name:`uint32`,size:4,array:Uint32Array,get:(e,t)=>dt(e).getUint32(t,!0),set:(e,t,n)=>dt(e).setUint32(t,n,!0)},int64:{name:`int64`,size:8,array:BigInt64Array,get:(e,t)=>dt(e).getBigInt64(t,!0),set:(e,t,n)=>dt(e).setBigInt64(t,n,!0)},uint64:{name:`uint64`,size:8,array:BigUint64Array,get:(e,t)=>dt(e).getBigUint64(t,!0),set:(e,t,n)=>dt(e).setBigUint64(t,n,!0)},float32:{name:`float32`,size:4,array:Float32Array,get:(e,t)=>dt(e).getFloat32(t,!0),set:(e,t,n)=>dt(e).setFloat32(t,n,!0)},float64:{name:`float64`,size:8,array:Float64Array,get:(e,t)=>dt(e).getFloat64(t,!0),set:(e,t,n)=>dt(e).setFloat64(t,n,!0)}},ht=Object.keys(mt);for(let e of Object.values(mt))lt(e);const gt={...mt,...Object.fromEntries(ht.map(e=>[C(e),mt[e]])),char:pt},_t=Object.keys(gt);function vt(e){return _t.includes(e.toString())}function yt(e){if(!vt(e))throw P(`EINVAL`,`Not a valid primitive type: `+e)}function bt(e){return e==`char`?`uint8`:e.toLowerCase()}function xt(e){return(typeof e==`object`||typeof e==`function`)&&e!==null&&`toInit`in e&&typeof e.toInit==`function`}function St(e){return xt(e)?e.toInit():st(e)?{type:e}:e}function Ct(e,t,n={}){if(!e)throw P(`EINVAL`,`Invalid name for struct field`);typeof e==`symbol`&&console.warn(`Symbol used for struct field name will be coerced to string: `+e.toString());let r=e.toString(),i=Object.assign(St(t),n);if(!st(i.type))throw P(`EINVAL`,`Invalid type for struct field "${r}"`);let a=i.countedBy?` counted_by(${typeof i.countedBy==`string`?i.countedBy:`<function>`})`:``;return{name:r,offset:0,type:i.type,countedBy:i.countedBy,alignment:i.align??i.type.size,decl:i.type instanceof zt?`${i.typeName??i.type.type.name} ${r}[${i.type.length}]${a}`:`${i.typeName??i.type.name} ${r}`,littleEndian:!i.bigEndian}}function wt(e,t){if(!(e instanceof Error)||e.message.toLowerCase()!==`offset is outside the bounds of the dataview`)throw e;let n=P(`EFAULT`,`Segmentation fault (at 0x${t.toString(16)})`);throw Error.captureStackTrace(n,wt),n}function Tt(e,t){return t.type instanceof zt&&t.type.length==0&&!!t.countedBy?.length&&!!e.constructor.isDynamic}function Et(e,t){let n=typeof t.countedBy==`function`?t.countedBy(e):e[t.countedBy];if(typeof n==`bigint`){if(n>BigInt(2**53-1))throw P(`EOVERFLOW`,`countedBy field value exceeds max safe integer`);n=Number(n)}if(typeof n!=`number`)throw P(`EINVAL`,`countedBy field value is not a number`);return n}function Dt(e,t){let n=t.type.type.size*Et(e,t);if(Nt(t.type.type)&&t.type.type.isDynamic)for(let r of e[t.name])n+=Pt(r);return n}const Ot=Symbol(`kOffsets`);function kt(e,t,n){let{offset:r,name:i}=t;e[Ot]||=Object.create(null);let a=e[Ot];if(a[i]!==void 0){if(n)return a[i];delete a[i]}let{fields:o}=e.constructor,s=o.indexOf(t);for(let t of o.slice(0,s)){Tt(e,t)&&(r+=Dt(e,t));let n=e[t.name];Mt(n)&&n.constructor.isDynamic&&(r+=Pt(n))}if(n)a[i]=r;else for(let e of o.slice(s))a[e.name]!==void 0&&delete a[e.name];return r}function At(e,t,n,r){typeof n==`string`&&(n=n.charCodeAt(0));let i=e.byteOffset+kt(e,t,!1)+(r??0)*t.type.size;try{t.type.set(e.buffer,i,n);return}catch(e){wt(e,i)}}function jt(e,t){let n=t.type;if(Tt(e,t)){let r=t.type.type;n=new zt(r,Et(e,t))}let r=e.byteOffset+kt(e,t,!0);try{return n.get(e.buffer,r)}catch(e){wt(e,r)}}function Mt(e){return typeof e==`object`&&!!e&&`constructor`in e&&Nt(e.constructor)}function Nt(e){return typeof e==`function`&&`prototype`in e&&`fields`in e&&typeof e.fields==`object`&&st(e)}function Pt(e){let t=0;for(let n of e.constructor.fields){let r=e[n.name];Tt(e,n)&&(t+=Dt(e,n)),Mt(r)&&r.constructor.isDynamic&&(t+=Pt(r))}return t}function Ft(e){if(st(e))return e.size;if(e==null)return 0;if(typeof e==`object`&&st(e.constructor))return e.constructor.size;if(Array.isArray(e)){let t=0;for(let n=0;n<e.length;n++)t+=Ft(e[n]);return t}if(typeof e==`string`)return yt(e),mt[bt(e)].size;throw TypeError(`Unable to resolve size of \`${e.toString()}\``)}function V(e){let t=Ft(e);return Mt(e)&&e.constructor.isDynamic?t+Pt(e):t}function It(e,t){let n;if(Nt(e)){if(e.isDynamic)throw P(`EINVAL`,`Cannot get offset of field in dynamic struct from the constructor`);n=e}else if(Mt(e))n=e.constructor;else throw P(`EINVAL`,`Type is not a struct or struct constructor`);let{fields:r}=n,i=r.find(e=>e.name===t);if(!i)throw P(`EINVAL`,`Struct does not have field: `+t);return Nt(e)?i.offset:kt(e,i,!0)}function Lt(e,t){class n extends DataView{length;type=e;*[Symbol.iterator](){for(let e=0;e<this.length;e++)yield this[e]}_offsets=[0];offsetOf(t){if(!e.isDynamic)return t*e.size;if(t<this._offsets.length)return this._offsets[t];for(let n=this._offsets.length;n<=t;n++)this._offsets[n]=this._offsets[n-1]+V(e.get(this.buffer,this.byteOffset+this._offsets[n-1]));return this._offsets[t]}constructor(n,r,i){let a=typeof n==`object`?n:new ArrayBuffer((n??0)*e.size);super(a,r,i),this.length=typeof n==`number`?n:e.isDynamic?t??y(`Unknown length of StructArray<${e.name}>`):Math.floor(this.byteLength/e.size);let o=e=>this.byteOffset+this.offsetOf(e);return new Proxy(this,{get(t,n){if(n in t)return t[n];let r=parseInt(n.toString());if(Number.isSafeInteger(r))return e.get(t.buffer,o(r))},set(t,n,r){let i=parseInt(n.toString());return Number.isSafeInteger(i)?(e.set(t.buffer,o(i),r),!0):!1}})}}for(let e of Object.getOwnPropertyNames(DataView.prototype))!e.startsWith(`get`)&&!e.startsWith(`set`)||Object.defineProperty(n.prototype,e,{enumerable:!1,configurable:!1,writable:!1,value:void 0});return n}function Rt(e){return typeof e==`function`&&`prototype`in e&&`fields`in e&&typeof e.fields==`object`&&st(e)}var zt=class{type;length;name;size;__structArray;__arrayType;__isArrayType=!0;constructor(e,t){this.type=e,this.length=t,this.name=`${e.name}[${t}]`,this.size=e.size*t,this.array=Lt(this),this.__structArray=Lt(e,t),this.__arrayType=e.array?e.array:this.__structArray}get=(e,t)=>vt(this.type.name)&&t%this.type.size!==0?new this.__structArray(e,t,this.size):new this.__arrayType(e,t,this.size);set=(e,t,n)=>{if(this.length)for(let r=0;r<this.length;r++)this.type.set(e,t+r*this.type.size,n[r]);else{let r=t;for(let t=0;t<n.length;t++)this.type.set(e,r,n[t]),r+=Rt(this.type)&&this.type.isDynamic?V(n[t]):this.type.size}};array};Symbol.metadata??=Symbol.for(`Symbol.metadata`);function Bt(e){e.metadata??={};let t=e.metadata.structInit??{};return e.metadata.structInit={fields:[...t.fields??[]]},e.metadata.structInit}function Vt(...e){let t=e.reduce((e,t)=>({...e,...t}),{});return typeof this==`object`&&Object.assign(t,this),function(e,n){let r=Bt(n),i=1,a=[],o=0,s=e=>{o=Math.ceil(o/e)*e};for(let e of r.fields)t.isPacked||s(e.alignment),t.isUnion?o=Math.max(o,e.type.size):(e.offset=o,o+=e.type.size),a.push(e),i=Math.max(i,e.alignment);t.alignment??=i,t.isPacked||s(t.alignment);class c extends e{static name=e.name;static size=o;static alignment=t.alignment;static isUnion=!!t.isUnion;static isDynamic=!!t.isDynamic;static fields=a;static get(e,t){return new this(e,t)}static set(e,t,n){let r=new Uint8Array(n.buffer,n.byteOffset,this.size),i=new Uint8Array(e,t,this.size);if(n.buffer!==e||n.byteOffset!==t)for(let e=0;e<this.size;e++)i[e]=r[e]}static[Symbol.toStringTag]=`[struct ${e.name}]`;constructor(...e){e.length||(e=[new ArrayBuffer(o),0,o]),super(...e);for(let e of Object.values(a))Object.defineProperty(this,e.name,{enumerable:!0,configurable:!0,get(){return jt(this,e)},set(t){At(this,e,t)}})}}return n.addInitializer(function(){Object.defineProperty(c,"name",{value:e.name}),lt(c)}),c}}Vt.packed=Vt.bind({isPacked:!0}),Vt.align=function(e){return Vt.bind({alignment:e})};function Ht(e,t={}){return function(n,r){if(r.kind!=`accessor`)throw P(`EINVAL`,`Field must be an accessor`);let i=Bt(r),a=Ct(r.name,e,t);return i.fields.push(a),{get(){return jt(this,a)},set(e){At(this,a,e)}}}}function Ut(e){let t=mt[bt(e)];function n(n,r){return typeof n==`number`?Ht(new zt(t,n),{typeName:e,...r}):Ht(t,{typeName:e})(n,r&&`name`in r?r:y(P(`EINVAL`,`Invalid decorator context object`)))}return n}const H=Object.fromEntries(_t.map(e=>[e,Ut(e)]));function Wt(e){return e}Wt.typed=function(e){return e};var Gt=class e{type;init;constructor(t,n){this.type=t,this.init=n;let r=(r=>new e(new zt(t,r),n));return Object.setPrototypeOf(r,new.target.prototype),Object.assign(r,{type:t,init:n}),r}align(t){return new e(this.type,{...this.init,align:t})}countedBy(t){return new e(this.type,{...this.init,countedBy:t})}bigEndian(){return new e(this.type,{...this.init,bigEndian:!0})}toInit(){return{type:this.type,...this.init}}$type(){return new e(this.type,this.init)}};function Kt(e,t=0){return new Gt(new zt(e,t),{})}function qt(e,t,...n){let r=n.reduce((e,t)=>({...e,...t}),{});typeof this==`object`&&Object.assign(r,this);let i=1,a=0,o=e=>{a=Math.ceil(a/e)*e},s=[];for(let[e,n]of Object.entries(t)){if(typeof e==`number`)throw TypeError(`Field names can not be numbers`);let t=Ct(e,n);r.isPacked||o(t.alignment),r.isUnion?a=Math.max(a,t.type.size):(t.offset=a,a+=t.type.size),s.push(t),i=Math.max(i,t.alignment)}r.alignment??=i,r.isPacked||o(r.alignment);class c extends DataView{static name=e;static size=a;static alignment=r.alignment;static isUnion=!!r.isUnion;static isDynamic=!!r.isDynamic;static fields=s;static get(e,t){return new this(e,t)}static set(e,t,n){let r=new Uint8Array(n.buffer,n.byteOffset,this.size),i=new Uint8Array(e,t,this.size);if(n.buffer!==e||n.byteOffset!==t)for(let e=0;e<this.size;e++)i[e]=r[e]}static[Symbol.toStringTag]=`[struct ${e}]`;constructor(e=new ArrayBuffer(a),t,n){super(e,t,n??e.byteLength-(t??0));for(let e of Object.values(this.constructor.fields??s))Object.defineProperty(this,e.name,{enumerable:!0,configurable:!0,get(){return jt(this,e)},set(t){At(this,e,t)}})}}for(let e of Object.getOwnPropertyNames(DataView.prototype))!e.startsWith(`get`)&&!e.startsWith(`set`)||Object.defineProperty(c.prototype,e,{enumerable:!1,configurable:!1,writable:!1,value:void 0});return lt(c),c}qt.extend=function(e,t,n,...r){let i=r.reduce((e,t)=>({...e,...t}),{});typeof this==`object`&&Object.assign(i,this);let a=1,o=e.size,s=e=>{o=Math.ceil(o/e)*e},c=e.fields;for(let[e,t]of Object.entries(n)){if(typeof e==`number`)throw TypeError(`Field names can not be numbers`);let n=Ct(e,t);i.isPacked||s(n.alignment),i.isUnion?o=Math.max(o,n.type.size):(n.offset=o,o+=n.type.size),c.push(n),a=Math.max(a,n.alignment)}i.alignment??=a,i.isPacked||s(i.alignment);class l extends e{static name=t;static size=o;static alignment=i.alignment;static isUnion=!!i.isUnion;static isDynamic=!!i.isDynamic;static fields=c;static[Symbol.toStringTag]=`[struct ${t}]`}return lt(l),l},qt.packed=qt.bind({isPacked:!0}),qt.align=function(e){return qt.bind({alignment:e})},qt.dynamic=qt.bind({isDynamic:!0}),Object.fromEntries(Object.entries(gt).map(([e,t])=>[e,new Gt(t,{typeName:e})]));function Jt(e){return JSON.parse(E(e),(e,t)=>e==``?t:typeof t==`string`?BigInt(t).toString(16).slice(0,Math.min(t.length,8)):t)}function Yt(e){return T(JSON.stringify(e))}function Xt(e,t){if(typeof e==`number`)return e;if(typeof e==`string`){let t=parseInt(e,8);if(!isNaN(t))return t}if(typeof t==`number`)return t;throw P(`EINVAL`,`Invalid mode: `+e?.toString())}const Zt=2147483647;function Qt(e){if(!(Number.isInteger(e)&&e>=0&&e<=Zt))throw Object.assign(RangeError(`The value of "fd" is out of range. It must be >= 0 && <= ${Zt}. Received ${e}`),{code:`ERR_OUT_OF_RANGE`})}function $t(e){if(e instanceof Date)return e.getTime();let t=Number(e);if(!Number.isFinite(t))throw P(`EINVAL`,`Invalid time.`);return t<0?Date.now():t*1e3}function U(e,t=!1){if(e instanceof URL){if(e.protocol!=`file:`)throw P(`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 P(`EINVAL`,`Path can not contain null character`);if(e.length==0)throw P(`EINVAL`,`Path can not be empty`);return e=e.replaceAll(/[/\\]+/g,`/`),t?e:ln.call(this,e)}function en(e,t=`utf8`,n,r=0){return typeof e!=`object`||!e?{encoding:typeof e==`string`?e:t??null,flag:n,mode:r}:{encoding:typeof e?.encoding==`string`?e.encoding:t??null,flag:typeof e?.flag==`string`?e.flag:n,mode:Xt(`mode`in e?e?.mode:null,r)}}function tn(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 nn(e){let t=Promise.withResolvers();setTimeout(()=>t.reject(P(`ETIMEDOUT`)),500),e.on(`online`,t.resolve),await t.promise}function rn(e){return`${U(e,!0)}${Date.now()}-${Math.random().toString(36).slice(2)}`}var an=t({basename:()=>pn,dirname:()=>G,extname:()=>mn,format:()=>hn,formatExt:()=>cn,isAbsolute:()=>dn,join:()=>W,matchesGlob:()=>_n,normalize:()=>un,normalizeString:()=>sn,parse:()=>gn,relative:()=>fn,resolve:()=>ln,sep:()=>`/`});function on(e,t){if(typeof e!=`object`)throw TypeError(`"${t}" is not an object`)}function sn(e,t){let n=``,r=0,i=-1,a=0,o=`\0`;for(let s=0;s<=e.length;++s){if(s<e.length)o=e[s];else if(o==`/`)break;else o=`/`;if(o==`/`){if(i!==s-1&&a!==1)if(a===2){if(n.length<2||r!==2||n.at(-1)!==`.`||n.at(-2)!==`.`){if(n.length>2){let e=n.lastIndexOf(`/`);e===-1?(n=``,r=0):(n=n.slice(0,e),r=n.length-1-n.lastIndexOf(`/`)),i=s,a=0;continue}if(n.length!==0){n=``,r=0,i=s,a=0;continue}}t&&(n+=n.length>0?`/..`:`..`,r=2)}else n.length>0?n+=`/`+e.slice(i+1,s):n=e.slice(i+1,s),r=s-i-1;i=s,a=0}else o===`.`&&a!==-1?++a:a=-1}return n}function cn(e){return e?`${e[0]===`.`?``:`.`}${e}`:``}function ln(...e){let t=``;for(let n of[...e.reverse(),Ie(this).pwd])if(n?.length&&(t=`${n}/${t}`,n.startsWith(`/`)))break;let n=t.startsWith(`/`);return t=sn(t,!n),n?`/${t}`:t.length?t:`/`}function un(e){if(!e.length)return`.`;let t=e[0]===`/`,n=e.at(-1)===`/`;return e=sn(e,!t),e.length?(n&&(e+=`/`),t?`/${e}`:e):t?`/`:n?`./`:`.`}function dn(e){return e.startsWith(`/`)}function W(...e){if(!e.length)return`.`;let t=e.filter(e=>e).join(`/`);return t?.length?un(t):`.`}function fn(e,t){if(e===t||(e=ln.call(this,e),t=ln.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 G(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 pn(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 mn(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 hn(e){on(e,`pathObject`);let t=e.dir||e.root,n=e.base||`${e.name||``}${cn(e.ext)}`;return t?t===e.root?`${t}${n}`:`${t}/${n}`:n}function gn(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 _n(e,t){return tn(e).test(t)}const vn=BigInt(1e3);var yn=class{_convert(e){return this._isBigint?BigInt(e):Number(e)}get blocks(){return this._convert(Math.ceil(Number(this.size)/512))}set blocks(e){}mode;dev=this._convert(0);ino=this._convert(0);rdev=this._convert(0);nlink=this._convert(1);blksize=this._convert(4096);uid=this._convert(0);gid=this._convert(0);atimeMs;get atime(){return new Date(Number(this.atimeMs))}set atime(e){this.atimeMs=this._convert(e.getTime())}mtimeMs;get mtime(){return new Date(Number(this.mtimeMs))}set mtime(e){this.mtimeMs=this._convert(e.getTime())}ctimeMs;get ctime(){return new Date(Number(this.ctimeMs))}set ctime(e){this.ctimeMs=this._convert(e.getTime())}birthtimeMs;get birthtime(){return new Date(Number(this.birthtimeMs))}set birthtime(e){this.birthtimeMs=this._convert(e.getTime())}size;data;flags;version;constructor({atimeMs:e,mtimeMs:t,ctimeMs:n,birthtimeMs:r,uid:i,gid:a,size:o,mode:s,ino:c,...l}={}){let u=Date.now();this.atimeMs=this._convert(e??u),this.mtimeMs=this._convert(t??u),this.ctimeMs=this._convert(n??u),this.birthtimeMs=this._convert(r??u),this.uid=this._convert(i??0),this.gid=this._convert(a??0),this.size=this._convert(o??0),this.ino=this._convert(c??0),this.mode=this._convert(s??0),this.mode&61440||(this.mode|=this._convert(Qe)),Object.assign(this,l)}isFile(){return(this.mode&Ye)==Qe}isDirectory(){return(this.mode&Ye)==et}isSymbolicLink(){return(this.mode&Ye)==Ze}isSocket(){return(this.mode&Ye)==Xe}isBlockDevice(){return(this.mode&Ye)==$e}isCharacterDevice(){return(this.mode&Ye)==tt}isFIFO(){return(this.mode&Ye)==nt}toJSON(){return p(this,kn)}hasAccess(e,t){return Y(t,this._isBigint?new bn(this):this,e)}get atimeNs(){return BigInt(this.atimeMs)*vn}get mtimeNs(){return BigInt(this.mtimeMs)*vn}get ctimeNs(){return BigInt(this.ctimeMs)*vn}get birthtimeNs(){return BigInt(this.birthtimeMs)*vn}},bn=class extends yn{_isBigint=!1},xn=class extends yn{_isBigint=!0};function Sn(e,t){return e.size==t.size&&+e.atime==+t.atime&&+e.mtime==+t.mtime&&+e.ctime==+t.ctime&&e.mode==t.mode}var Cn=class{type=525687744115;bsize=4096;blocks=0;bfree=0;bavail=0;files=at;ffree=at},wn=class{type=BigInt(`0x7a656e6673`);bsize=BigInt(4096);blocks=BigInt(0);bfree=BigInt(0);bavail=BigInt(0);files=BigInt(at);ffree=BigInt(at)},Tn=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},K=function(e,t,n){for(var r=arguments.length>2,i=0;i<t.length;i++)n=r?t[i].call(e,n):t[i].call(e);return r?n:void 0};const En=3968;let Dn=(()=>{var e,t;let n=[Vt.packed()],r,i=[],a,o=Wt.typed(Uint8Array),s,c=[],l=[],u,d=[],f=[];var p=class extends o{static{a=this}static{let m=typeof Symbol==`function`&&Symbol.metadata?Object.create(o[Symbol.metadata]??null):void 0;s=[(e=H).uint32.bind(e)],u=[(t=H).uint32.bind(t)],Tn(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),Tn(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),Tn(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=K(this,c,void 0);get keySize(){return this.#e}set keySize(e){this.#e=e}#t=(K(this,l),K(this,d,void 0));get valueSize(){return this.#t}set valueSize(e){this.#t=e}get name(){return E(this.subarray(8,8+this.keySize))}set name(e){let t=T(e);if(8+t.length+this.valueSize>En)throw P(`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>En)throw P(`EOVERFLOW`);this.valueSize=e.length,this.set(e,8+this.keySize)}get size(){return 8+this.keySize+this.valueSize}constructor(){super(...arguments),K(this,f)}static{K(a,i)}};return a})(),On=(()=>{var e;let t=[Vt.packed()],n,r=[],i,a=Wt(o),s,c=[],l=[];var u=class extends a{static{i=this}static{let o=typeof Symbol==`function`&&Symbol.metadata?Object.create(a[Symbol.metadata]??null):void 0;s=[(e=H).uint32.bind(e)],Tn(this,null,s,{kind:`accessor`,name:`size`,static:!1,private:!1,access:{has:e=>`size`in e,get:e=>e.size,set:(e,t)=>{e.size=t}},metadata:o},c,l),Tn(null,n={value:i},t,{kind:`class`,name:i.name,metadata:o},null,r),u=i=n.value,o&&Object.defineProperty(i,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:o})}static name=`Attributes`;#e=K(this,c,void 0);get size(){return this.#e}set size(e){this.#e=e}get byteSize(){let e=this.byteOffset+V(this);for(let t=0;t<this.size;t++){let t=new Dn(this.buffer,e);e+=t.size}return e}has(e){let t=this.byteOffset+V(this);for(let n=0;n<this.size;n++){let n=new Dn(this.buffer,t);if(n.name==e)return!0;t+=n.size}return!1}get(e){let t=this.byteOffset+V(this);for(let n=0;n<this.size;n++){let n=new Dn(this.buffer,t);if(n.name==e)return n.value;t+=n.size}}set(e,t){let n=this.byteOffset+V(this),r;for(let t=0;t<this.size;t++){let t=new Dn(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 Dn(this.buffer,n);a.name=e,a.value=t,this.size++}remove(e){let t=this.byteOffset+V(this),n;for(let r=0;r<this.size;r++){let r=new Dn(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+V(this);for(let t=0;t<this.size;t++){let t=new Dn(this.buffer,e);yield t.name,e+=t.size}}*values(){let e=this.byteOffset+V(this);for(let t=0;t<this.size;t++){let t=new Dn(this.buffer,e);yield t.value,e+=t.size}}*entries(){let e=this.byteOffset+V(this);for(let t=0;t<this.size;t++){let t=new Dn(this.buffer,e);yield[t.name,t.value],e+=t.size}}constructor(){super(...arguments),K(this,l)}static{K(i,r)}};return i})();const kn=[`ino`,`data`,`size`,`mode`,`flags`,`nlink`,`uid`,`gid`,`atimeMs`,`birthtimeMs`,`mtimeMs`,`ctimeMs`,`version`];var An;(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`})(An||={});let q=(()=>{var e,t,n,r,i,a,s,c,l,u,d,f,m,h,g,_;let v=[Vt.packed()],y,b=[],x,S=Wt(o),C,w=[],T=[],ee,E=[],te=[],ne,D=[],O=[],k,A=[],j=[],M,N=[],F=[],re,I=[],L=[],ie,R=[],ae=[],oe,se=[],ce=[],z,ue=[],de=[],fe,pe=[],me=[],he,ge=[],_e=[],ve,ye=[],be=[],xe,Se=[],Ce=[],we,Te=[],Ee=[],De,Oe=[],ke=[],Ae,je=[],Me=[],Ne,Pe=[],Fe=[],Ie,Le=[],Re=[],ze,Be=[],Ve=[];var He=class extends S{static{x=this}static{let o=typeof Symbol==`function`&&Symbol.metadata?Object.create(S[Symbol.metadata]??null):void 0;C=[(e=H).uint32.bind(e)],ee=[(t=H).uint32.bind(t)],ne=[(n=H).uint32.bind(n)],k=[(r=H).uint16.bind(r)],M=[(i=H).uint32.bind(i)],re=[(a=H).uint32.bind(a)],ie=[(s=H).uint32.bind(s)],oe=[(c=H).float64.bind(c)],z=[(l=H).float64.bind(l)],fe=[(u=H).float64.bind(u)],he=[(d=H).float64.bind(d)],ve=[(f=H).uint32.bind(f)],xe=[(m=H).uint32.bind(m)],we=[(h=H).uint32.bind(h)],De=[(g=H).uint16.bind(g)],Ae=[(_=H).uint32.bind(_)],Ne=[H.uint8(48)],Ie=[Ht(On)],ze=[H.uint8(En)],Tn(this,null,C,{kind:`accessor`,name:`data`,static:!1,private:!1,access:{has:e=>`data`in e,get:e=>e.data,set:(e,t)=>{e.data=t}},metadata:o},w,T),Tn(this,null,ee,{kind:`accessor`,name:`__data_old`,static:!1,private:!1,access:{has:e=>`__data_old`in e,get:e=>e.__data_old,set:(e,t)=>{e.__data_old=t}},metadata:o},E,te),Tn(this,null,ne,{kind:`accessor`,name:`size`,static:!1,private:!1,access:{has:e=>`size`in e,get:e=>e.size,set:(e,t)=>{e.size=t}},metadata:o},D,O),Tn(this,null,k,{kind:`accessor`,name:`mode`,static:!1,private:!1,access:{has:e=>`mode`in e,get:e=>e.mode,set:(e,t)=>{e.mode=t}},metadata:o},A,j),Tn(this,null,M,{kind:`accessor`,name:`nlink`,static:!1,private:!1,access:{has:e=>`nlink`in e,get:e=>e.nlink,set:(e,t)=>{e.nlink=t}},metadata:o},N,F),Tn(this,null,re,{kind:`accessor`,name:`uid`,static:!1,private:!1,access:{has:e=>`uid`in e,get:e=>e.uid,set:(e,t)=>{e.uid=t}},metadata:o},I,L),Tn(this,null,ie,{kind:`accessor`,name:`gid`,static:!1,private:!1,access:{has:e=>`gid`in e,get:e=>e.gid,set:(e,t)=>{e.gid=t}},metadata:o},R,ae),Tn(this,null,oe,{kind:`accessor`,name:`atimeMs`,static:!1,private:!1,access:{has:e=>`atimeMs`in e,get:e=>e.atimeMs,set:(e,t)=>{e.atimeMs=t}},metadata:o},se,ce),Tn(this,null,z,{kind:`accessor`,name:`birthtimeMs`,static:!1,private:!1,access:{has:e=>`birthtimeMs`in e,get:e=>e.birthtimeMs,set:(e,t)=>{e.birthtimeMs=t}},metadata:o},ue,de),Tn(this,null,fe,{kind:`accessor`,name:`mtimeMs`,static:!1,private:!1,access:{has:e=>`mtimeMs`in e,get:e=>e.mtimeMs,set:(e,t)=>{e.mtimeMs=t}},metadata:o},pe,me),Tn(this,null,he,{kind:`accessor`,name:`ctimeMs`,static:!1,private:!1,access:{has:e=>`ctimeMs`in e,get:e=>e.ctimeMs,set:(e,t)=>{e.ctimeMs=t}},metadata:o},ge,_e),Tn(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:o},ye,be),Tn(this,null,xe,{kind:`accessor`,name:`__ino_old`,static:!1,private:!1,access:{has:e=>`__ino_old`in e,get:e=>e.__ino_old,set:(e,t)=>{e.__ino_old=t}},metadata:o},Se,Ce),Tn(this,null,we,{kind:`accessor`,name:`flags`,static:!1,private:!1,access:{has:e=>`flags`in e,get:e=>e.flags,set:(e,t)=>{e.flags=t}},metadata:o},Te,Ee),Tn(this,null,De,{kind:`accessor`,name:`__after_flags`,static:!1,private:!1,access:{has:e=>`__after_flags`in e,get:e=>e.__after_flags,set:(e,t)=>{e.__after_flags=t}},metadata:o},Oe,ke),Tn(this,null,Ae,{kind:`accessor`,name:`version`,static:!1,private:!1,access:{has:e=>`version`in e,get:e=>e.version,set:(e,t)=>{e.version=t}},metadata:o},je,Me),Tn(this,null,Ne,{kind:`accessor`,name:`__padding`,static:!1,private:!1,access:{has:e=>`__padding`in e,get:e=>e.__padding,set:(e,t)=>{e.__padding=t}},metadata:o},Pe,Fe),Tn(this,null,Ie,{kind:`accessor`,name:`attributes`,static:!1,private:!1,access:{has:e=>`attributes`in e,get:e=>e.attributes,set:(e,t)=>{e.attributes=t}},metadata:o},Le,Re),Tn(this,null,ze,{kind:`accessor`,name:`__data`,static:!1,private:!1,access:{has:e=>`__data`in e,get:e=>e.__data,set:(e,t)=>{e.__data=t}},metadata:o},Be,Ve),Tn(null,y={value:x},v,{kind:`class`,name:x.name,metadata:o},null,b),He=x=y.value,o&&Object.defineProperty(x,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:o})}static name=`Inode`;constructor(...e){let t={};if(typeof e[0]==`object`&&e[0]!==null&&!ArrayBuffer.isView(e[0])&&(t=e[0],e=[V(He)]),e[0]instanceof He&&(e=[new Uint8Array(e[0].buffer,e[0].byteOffset,e[0].byteLength)]),super(...e),K(this,Ve),this.byteLength<V(He))throw le(P(`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&&B(`Inode ${this.ino} has an nlink of 0`)}#e=K(this,w,void 0);get data(){return this.#e}set data(e){this.#e=e}#t=(K(this,T),K(this,E,void 0));get __data_old(){return this.#t}set __data_old(e){this.#t=e}#n=(K(this,te),K(this,D,void 0));get size(){return this.#n}set size(e){this.#n=e}#r=(K(this,O),K(this,A,void 0));get mode(){return this.#r}set mode(e){this.#r=e}#i=(K(this,j),K(this,N,void 0));get nlink(){return this.#i}set nlink(e){this.#i=e}#a=(K(this,F),K(this,I,void 0));get uid(){return this.#a}set uid(e){this.#a=e}#o=(K(this,L),K(this,R,void 0));get gid(){return this.#o}set gid(e){this.#o=e}#s=(K(this,ae),K(this,se,void 0));get atimeMs(){return this.#s}set atimeMs(e){this.#s=e}#c=(K(this,ce),K(this,ue,void 0));get birthtimeMs(){return this.#c}set birthtimeMs(e){this.#c=e}#l=(K(this,de),K(this,pe,void 0));get mtimeMs(){return this.#l}set mtimeMs(e){this.#l=e}#u=(K(this,me),K(this,ge,void 0));get ctimeMs(){return this.#u}set ctimeMs(e){this.#u=e}#d=(K(this,_e),K(this,ye,void 0));get ino(){return this.#d}set ino(e){this.#d=e}#f=(K(this,be),K(this,Se,void 0));get __ino_old(){return this.#f}set __ino_old(e){this.#f=e}#p=(K(this,Ce),K(this,Te,void 0));get flags(){return this.#p}set flags(e){this.#p=e}#m=(K(this,Ee),K(this,Oe,void 0));get __after_flags(){return this.#m}set __after_flags(e){this.#m=e}#h=(K(this,ke),K(this,je,void 0));get version(){return this.#h}set version(e){this.#h=e}#g=(K(this,Me),K(this,Pe,void 0));get __padding(){return this.#g}set __padding(e){this.#g=e}#_=(K(this,Fe),K(this,Le,void 0));get attributes(){return this.#_}set attributes(e){this.#_=e}#v=(K(this,Re),K(this,Be,void 0));get __data(){return this.#v}set __data(e){this.#v=e}toString(){return`<Inode ${this.ino}>`}toJSON(){return{...p(this,kn),attributes:this.attributes}}toStats(){return new bn(this)}update(e){if(!e)return!1;let t=!1;for(let n of kn)e[n]!==void 0&&n!=`ino`&&n!=`data`&&this[n]!==e[n]&&(n==`atimeMs`&&this.flags&An.NoAtime||(this[n]=e[n],t=!0));return e.attributes&&(this.attributes.copyFrom(e.attributes),t=!0),t&&(this.ctimeMs=Date.now()),t}static{K(x,b)}};return He=x})();function jn(e){return(e.mode&Ye)==Qe}function J(e){return(e.mode&Ye)==et}function Mn(e){return(e.mode&Ye)==Ze}function Nn(e){return(e.mode&Ye)==Xe}function Pn(e){return(e.mode&Ye)==$e}function Fn(e){return(e.mode&Ye)==tt}function In(e){return(e.mode&Ye)==nt}function Y(e,t,n){let{credentials:r}=Ie(e);if(Mn(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 Ln(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 Rn=class e extends Map{maxSize=at;toJSON(){return{version:1,maxSize:this.maxSize,entries:Object.fromEntries([...this].map(([e,t])=>[e,t.toJSON()]))}}toString(){return JSON.stringify(this.toJSON())}get byteSize(){let e=this.size*V(q);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 P(`ENOENT`);if((t.mode&61440)!=16384)throw P(`ENOTDIR`);let n={};for(let t of this.keys())G(t)==e&&t!=e&&(n[pn(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())G(e)==t&&e!=t&&(r[pn(e)]=this.get(e).ino);e.set(t,r)}return e}fromJSON(e){if(e.version!=1)throw P(`EINVAL`,`Index version mismatch`);this.clear();for(let[t,n]of Object.entries(e.entries))n.data??=S(1,at),t==`/`&&(n.ino=0),this.set(t,new q(n));return this}static parse(t){if(!h(t))throw P(`EINVAL`,`Invalid JSON`);let n=JSON.parse(t),r=new e;return r.fromJSON(n),r}};const zn=4096;var Bn=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 P(`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+=zn){let r=t+zn>a?a-t:zn,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??=(B(`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??=(B(`Using a polyfill of Symbol.dispose`),Symbol(`Symbol.dispose`)),Symbol.asyncDispose??=(B(`Using a polyfill of Symbol.asyncDispose`),Symbol(`Symbol.asyncDispose`)),globalThis.crypto.randomUUID??=(B(`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??=(B(`Using a polyfill of Uint8Array.prototype.toBase64`),function(){return btoa(String.fromCharCode(...this))}),Uint8Array.fromBase64??=(B(`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??=(B(`Using a polyfill of Uint8Array.prototype.toHex`),function(){return[...this].map(e=>e.toString(16).padStart(2,`0`)).join(``)}),Uint8Array.fromHex??=(B(`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 Vn=class{store;constructor(e){this.store=e}},Hn=class extends Vn{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)}},Un=class extends Vn{asyncDone=Promise.resolve();async(e){this.asyncDone=this.asyncDone.then(()=>e)}_cached(e,t){this.store.cache??=new Map;let n=this.store.cache.get(e);return n?(t&&(n.size=t.size),n):t?new s(e,t.size,{},this.store.cache):void 0}getSync(e,t,n){let r=this._cached(e);if(!r)return;n??=r.size;let i=r.missing(t,n);for(let{start:t,end:n}of i)this.async(this.get(e,t,n));if(i.length)throw P(`EAGAIN`);let a=r.regionAt(t);if(!a){B(`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)}},Wn=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 Un))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 Un))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)}}},Gn=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},Kn=(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}),qn=class extends Bn{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=fn(e,r);if(a.startsWith(`..`))continue;let o=W(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){B(`Missing paths in table for ino `+r);continue}n.delete(e),n.add(t)}}_initialized=!1;async ready(){this._initialized||=(this.attributes.has(`no_async_preload`)||this.checkRootSync(),await this.checkRoot(),await this._populate(),!0)}readySync(){this._initialized||=(this.attributes.has(`no_async_preload`)||this.checkRootSync(),this.checkRootSync(),this._populateSync(),!0)}constructor(e){super(e.type??1802921587,e.name),this.store=e,e.fs=this,this._uuid=e.uuid??this.uuid,this.label=e.label,fe(this.name+`: supports features: `+this.store.flags?.join(`, `))}usage(){return this.store.usage?.()||{totalSpace:0,freeSpace:0}}async loadIndex(e){let t={stack:[],error:void 0,hasError:!1};try{let n=Gn(t,this.transaction(),!0),r=e.directories();for(let[t,i]of e)this._add(i.ino,t),await n.set(i.ino,i),r.has(t)&&await n.set(i.data,Yt(r.get(t)));await n.commit()}catch(e){t.error=e,t.hasError=!0}finally{let e=Kn(t);e&&await e}}loadIndexSync(e){let t={stack:[],error:void 0,hasError:!1};try{let n=Gn(t,this.transaction(),!1),r=e.directories();for(let[t,i]of e)this._add(i.ino,t),n.setSync(i.ino,i),r.has(t)&&n.setSync(i.data,Yt(r.get(t)));n.commitSync()}catch(e){t.error=e,t.hasError=!0}finally{Kn(t)}}async createIndex(){let e={stack:[],error:void 0,hasError:!1};try{let t=new Rn,n=Gn(e,this.transaction(),!0),r=[[`/`,0]],i=v(P(`EDEADLK`));for(;r.length;){let[e,i]=r.shift(),a=new q(await n.get(i));if(t.set(e,a),a.mode&16384){let t=Jt(await n.get(a.data)??y(P(`ENODATA`)));for(let[n,i]of Object.entries(t))r.push([W(e,n),i])}}return i(),t}catch(t){e.error=t,e.hasError=!0}finally{let t=Kn(e);t&&await t}}createIndexSync(){let e={stack:[],error:void 0,hasError:!1};try{let t=new Rn,n=Gn(e,this.transaction(),!1),r=[[`/`,0]],i=v(P(`EDEADLK`));for(;r.length;){let[e,i]=r.shift(),a=new q(n.getSync(i));if(t.set(e,a),a.mode&16384){let t=Jt(n.getSync(a.data)??y(P(`ENODATA`)));for(let[n,i]of Object.entries(t))r.push([W(e,n),i])}}return i(),t}catch(t){e.error=t,e.hasError=!0}finally{Kn(e)}}async rename(e,t){let n={stack:[],error:void 0,hasError:!1};try{let r=Gn(n,this.transaction(),!0),i=gn(e),a=gn(t),o=await this.findInode(r,i.dir),s=Jt(await r.get(o.data)??y(P(`ENODATA`)));if(!s[i.base])throw P(`ENOENT`);let c=s[i.base];if(c!=this._ids.get(e)&&z(`Ino mismatch while renaming ${e} to ${t}`),delete s[i.base],(a.dir+`/`).startsWith(e+`/`))throw P(`EBUSY`);let l=a.dir==i.dir,u=l?o:await this.findInode(r,a.dir),d=l?s:Jt(await r.get(u.data)??y(P(`ENODATA`)));if(d[a.base]){let e=new q(await r.get(d[a.base])??y(P(`ENOENT`)));if(!jn(e))throw P(`EISDIR`);await r.remove(e.data),await r.remove(d[a.base])}d[a.base]=c,await r.set(o.data,Yt(s)),await r.set(u.data,Yt(d)),await r.commit(),this._move(e,t)}catch(e){n.error=e,n.hasError=!0}finally{let e=Kn(n);e&&await e}}renameSync(e,t){let n={stack:[],error:void 0,hasError:!1};try{let r=Gn(n,this.transaction(),!1),i=gn(e),a=gn(t),o=this.findInodeSync(r,i.dir),s=Jt(r.getSync(o.data)??y(P(`ENODATA`)));if(!s[i.base])throw P(`ENOENT`);let c=s[i.base];if(c!=this._ids.get(e)&&z(`Ino mismatch while renaming ${e} to ${t}`),delete s[i.base],(a.dir+`/`).startsWith(e+`/`))throw P(`EBUSY`);let l=a.dir===i.dir,u=l?o:this.findInodeSync(r,a.dir),d=l?s:Jt(r.getSync(u.data)??y(P(`ENODATA`)));if(d[a.base]){let e=new q(r.getSync(d[a.base])??y(P(`ENOENT`)));if(!jn(e))throw P(`EISDIR`);r.removeSync(e.data),r.removeSync(d[a.base])}d[a.base]=c,r.setSync(o.data,Yt(s)),r.setSync(u.data,Yt(d)),r.commitSync(),this._move(e,t)}catch(e){n.error=e,n.hasError=!0}finally{Kn(n)}}async stat(e){let t={stack:[],error:void 0,hasError:!1};try{let n=Gn(t,this.transaction(),!0);return await this.findInode(n,e)}catch(e){t.error=e,t.hasError=!0}finally{let e=Kn(t);e&&await e}}statSync(e){let t={stack:[],error:void 0,hasError:!1};try{let n=Gn(t,this.transaction(),!1);return this.findInodeSync(n,e)}catch(e){t.error=e,t.hasError=!0}finally{Kn(t)}}async touch(e,t){let n={stack:[],error:void 0,hasError:!1};try{let r=Gn(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=Kn(n);e&&await e}}touchSync(e,t){let n={stack:[],error:void 0,hasError:!1};try{let r=Gn(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{Kn(n)}}async createFile(e,t){return await this.commitNew(e,{...t,mode:t.mode|Qe},new Uint8Array)}createFileSync(e,t){return this.commitNewSync(e,{...t,mode:t.mode|Qe},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 P(`ENOTEMPTY`);await this.remove(e,!0)}rmdirSync(e){if(this.readdirSync(e).length)throw P(`ENOTEMPTY`);this.removeSync(e,!0)}async mkdir(e,t){return await this.commitNew(e,{...t,mode:t.mode|et},T(`{}`))}mkdirSync(e,t){return this.commitNewSync(e,{...t,mode:t.mode|et},T(`{}`))}async readdir(e){let t={stack:[],error:void 0,hasError:!1};try{let n=Gn(t,this.transaction(),!0),r=await this.findInode(n,e);return Object.keys(Jt(await n.get(r.data)??y(P(`ENOENT`))))}catch(e){t.error=e,t.hasError=!0}finally{let e=Kn(t);e&&await e}}readdirSync(e){let t={stack:[],error:void 0,hasError:!1};try{let n=Gn(t,this.transaction(),!1),r=this.findInodeSync(n,e);return Object.keys(Jt(n.getSync(r.data)??y(P(`ENOENT`))))}catch(e){t.error=e,t.hasError=!0}finally{Kn(t)}}async sync(){}syncSync(){}async link(e,t){let n={stack:[],error:void 0,hasError:!1};try{let r=Gn(n,this.transaction(),!0),i=G(t),a=await this.findInode(r,i),o=Jt(await r.get(a.data)??y(P(`ENOENT`))),s=await this.findInode(r,e);s.nlink++,o[pn(t)]=s.ino,this._add(s.ino,t),await r.set(s.ino,s),await r.set(a.data,Yt(o)),await r.commit()}catch(e){n.error=e,n.hasError=!0}finally{let e=Kn(n);e&&await e}}linkSync(e,t){let n={stack:[],error:void 0,hasError:!1};try{let r=Gn(n,this.transaction(),!1),i=G(t),a=this.findInodeSync(r,i),o=Jt(r.getSync(a.data)??y(P(`ENOENT`))),s=this.findInodeSync(r,e);s.nlink++,o[pn(t)]=s.ino,this._add(s.ino,t),r.setSync(s.ino,s),r.setSync(a.data,Yt(o)),r.commitSync()}catch(e){n.error=e,n.hasError=!0}finally{Kn(n)}}async read(e,t,n,r){let i={stack:[],error:void 0,hasError:!1};try{let a=Gn(i,this.transaction(),!0),o=await this.findInode(a,e);if(o.size==0)return;let s=await a.get(o.data,n,r)??y(P(`ENODATA`)),c=a.flag(`partial`)?s:s.subarray(n,r);c.byteLength>t.byteLength&&z(`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=Kn(i);e&&await e}}readSync(e,t,n,r){let i={stack:[],error:void 0,hasError:!1};try{let a=Gn(i,this.transaction(),!1),o=this.findInodeSync(a,e);if(o.size==0)return;let s=a.getSync(o.data,n,r)??y(P(`ENODATA`)),c=a.flag(`partial`)?s:s.subarray(n,r);c.byteLength>t.byteLength&&z(`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{Kn(i)}}async write(e,t,n){let r={stack:[],error:void 0,hasError:!1};try{let i=Gn(r,this.transaction(),!0),o=await this.findInode(i,e),s=n+t.byteLength,c=t;i.flag(`partial`)||(c=a(await i.get(o.data)??new Uint8Array,s),c.set(t,n),n=0),await i.set(o.data,c,n),o.update({size:Math.max(o.size,s),mtimeMs:Date.now()}),await i.set(o.ino,o),this._add(o.ino,e),await i.commit()}catch(e){r.error=e,r.hasError=!0}finally{let e=Kn(r);e&&await e}}writeSync(e,t,n){let r={stack:[],error:void 0,hasError:!1};try{let i=Gn(r,this.transaction(),!1),o=this.findInodeSync(i,e),s=n+t.byteLength,c=t;i.flag(`partial`)||(c=a(i.getSync(o.data)??new Uint8Array,s),c.set(t,n),n=0),i.setSync(o.data,c,n),o.update({size:Math.max(o.size,s),mtimeMs:Date.now()}),i.setSync(o.ino,o),this._add(o.ino,e),i.commitSync()}catch(e){r.error=e,r.hasError=!0}finally{Kn(r)}}transaction(){return new Wn(this.store.transaction(),this)}async checkRoot(){let e={stack:[],error:void 0,hasError:!1};try{let t=Gn(e,this.transaction(),!0);if(await t.get(0))return;let n=new q({ino:0,data:1,mode:16895});await t.set(n.data,T(`{}`)),this._add(0,`/`),await t.set(0,n),await t.commit()}catch(t){e.error=t,e.hasError=!0}finally{let t=Kn(e);t&&await t}}checkRootSync(){let e={stack:[],error:void 0,hasError:!1};try{let t=Gn(e,this.transaction(),!1);if(t.getSync(0))return;let n=new q({ino:0,data:1,mode:16895});t.setSync(n.data,T(`{}`)),this._add(0,`/`),t.setSync(0,n),t.commitSync()}catch(t){e.error=t,e.hasError=!0}finally{Kn(e)}}async _populate(){let e={stack:[],error:void 0,hasError:!1};try{if(this._initialized){B(`Attempted to populate tables after initialization`);return}fe(`Populating tables with existing store metadata`);let t=Gn(e,this.transaction(),!0),n=await t.get(0);if(!n){ue(`Store does not have a root inode`);let e=new q({ino:0,data:1,mode:16895});await t.set(e.data,T(`{}`)),this._add(0,`/`),await t.set(0,e),await t.commit();return}if(n.length<V(q)){le(`Store contains an invalid root inode. Refusing to populate tables`);return}let r=new Set,i=0,a=[[`/`,0]];for(;a.length>0;){i++;let[e,n]=a.shift();this._add(n,e);let o=await t.get(n);if(!o){B(`Store is missing data for inode: `+n);continue}if(o.length<V(q)){B(`Invalid inode size for ino ${n}: ${o.length}`);continue}let s=new q(o);if((s.mode&16384)!=16384||r.has(n))continue;r.add(n);let c=await t.get(s.data);if(!c){B(`Store is missing directory data: `+s.data);continue}let l=Jt(c);for(let[t,n]of Object.entries(l))a.push([W(e,t),n])}fe(`Added ${i} existing inode(s) from store`)}catch(t){e.error=t,e.hasError=!0}finally{let t=Kn(e);t&&await t}}_populateSync(){let e={stack:[],error:void 0,hasError:!1};try{if(this._initialized){B(`Attempted to populate tables after initialization`);return}fe(`Populating tables with existing store metadata`);let t=Gn(e,this.transaction(),!1),n=t.getSync(0);if(!n){ue(`Store does not have a root inode`);let e=new q({ino:0,data:1,mode:16895});t.setSync(e.data,T(`{}`)),this._add(0,`/`),t.setSync(0,e),t.commitSync();return}if(n.length<V(q)){le(`Store contains an invalid root inode. Refusing to populate tables`);return}let r=new Set,i=0,a=[[`/`,0]];for(;a.length>0;){i++;let[e,n]=a.shift();this._add(n,e);let o=t.getSync(n);if(!o){B(`Store is missing data for inode: `+n);continue}if(o.length<V(q)){B(`Invalid inode size for ino ${n}: ${o.length}`);continue}let s=new q(o);if((s.mode&16384)!=16384||r.has(n))continue;r.add(n);let c=t.getSync(s.data);if(!c){B(`Store is missing directory data: `+s.data);continue}let l=Jt(c);for(let[t,n]of Object.entries(l))a.push([W(e,t),n])}fe(`Added ${i} existing inode(s) from store`)}catch(t){e.error=t,e.hasError=!0}finally{Kn(e)}}async _findInode(e,t,n=new Set){if(n.has(t))throw le(P(`EIO`,`Infinite loop detected while finding inode`));if(n.add(t),t==`/`)return new q(await e.get(0)??y(P(`ENODATA`)));let{dir:r,base:i}=gn(t),a=await this._findInode(e,r,n),o=Jt(await e.get(a.data)??y(P(`ENODATA`)));if(!(i in o))throw P(`ENOENT`);return new q(await e.get(o[i])??y(P(`ENODATA`)))}_findInodeSync(e,t,n=new Set){if(n.has(t))throw le(P(`EIO`,`Infinite loop detected while finding inode`));if(n.add(t),t==`/`)return new q(e.getSync(0)??y(P(`ENOENT`)));let{dir:r,base:i}=gn(t),a=this._findInodeSync(e,r,n),o=Jt(e.getSync(a.data)??y(P(`ENODATA`)));if(!(i in o))throw P(`ENOENT`);return new q(e.getSync(o[i])??y(P(`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 P(`ENOENT`);return new q(await e.get(n)??y(P(`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 P(`ENOENT`);return new q(e.getSync(n)??y(P(`ENOENT`)))}_lastID;allocNew(e){this._lastID??=Math.max(...this._paths.keys()),this._lastID+=2;let t=this._lastID;if(t>4294967295)throw z(P(`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 P(`EEXIST`);let i=Gn(r,this.transaction(),!0),{dir:a,base:o}=gn(e),s=await this.findInode(i,a),c=Jt(await i.get(s.data)??y(P(`ENOENT`)));if(c[o])throw P(`EEXIST`);let l=this.allocNew(e),u=new q({...t,ino:l,data:l+1,size:n.byteLength,nlink:1});return await i.set(u.ino,u),await i.set(u.data,n),c[o]=u.ino,await i.set(s.data,Yt(c)),await i.commit(),u}catch(e){r.error=e,r.hasError=!0}finally{let e=Kn(r);e&&await e}}commitNewSync(e,t,n){let r={stack:[],error:void 0,hasError:!1};try{if(e==`/`)throw P(`EEXIST`);let i=Gn(r,this.transaction(),!1),{dir:a,base:o}=gn(e),s=this.findInodeSync(i,a),c=Jt(i.getSync(s.data)??y(P(`ENOENT`)));if(c[o])throw P(`EEXIST`);let l=this.allocNew(e),u=new q({...t,ino:l,data:l+1,size:n.byteLength,nlink:1});return i.setSync(u.ino,u),i.setSync(u.data,n),c[o]=u.ino,i.setSync(s.data,Yt(c)),i.commitSync(),u}catch(e){r.error=e,r.hasError=!0}finally{Kn(r)}}async remove(e,t){let n={stack:[],error:void 0,hasError:!1};try{let r=Gn(n,this.transaction(),!0),{dir:i,base:a}=gn(e),o=await this.findInode(r,i),s=Jt(await r.get(o.data)??y(P(`ENOENT`)));if(!s[a])throw P(`ENOENT`);let c=s[a],l=new q(await r.get(c)??y(P(`ENOENT`)));if(delete s[a],!t&&J(l))throw P(`EISDIR`);await r.set(o.data,Yt(s)),l.nlink>1?(l.update({nlink:l.nlink-1}),await r.set(l.ino,l)):(await r.remove(l.data),await r.remove(c),this._remove(c)),await r.commit()}catch(e){n.error=e,n.hasError=!0}finally{let e=Kn(n);e&&await e}}removeSync(e,t){let n={stack:[],error:void 0,hasError:!1};try{let r=Gn(n,this.transaction(),!1),{dir:i,base:a}=gn(e),o=this.findInodeSync(r,i),s=Jt(r.getSync(o.data)??y(P(`ENOENT`))),c=s[a];if(!c)throw P(`ENOENT`);let l=new q(r.getSync(c)??y(P(`ENOENT`)));if(delete s[a],!t&&J(l))throw P(`EISDIR`);r.setSync(o.data,Yt(s)),l.nlink>1?(l.update({nlink:l.nlink-1}),r.setSync(l.ino,l)):(r.removeSync(l.data),r.removeSync(c),this._remove(c)),r.commitSync()}catch(e){n.error=e,n.hasError=!0}finally{Kn(n)}}},Jn=class extends Hn{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)}},Yn=class extends Un{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)}},Xn=class extends Map{maxSize;label;flags=[];name=`tmpfs`;constructor(e=at,t){super(),this.maxSize=e,this.label=t}async sync(){}transaction(){return new Jn(this)}get bytes(){let e=this.size*4;for(let t of this.values())e+=t.byteLength;return e}usage(){return{totalSpace:this.maxSize,freeSpace:this.maxSize-this.bytes}}};const Zn={name:`InMemory`,options:{maxSize:{type:`number`,required:!1},label:{type:`string`,required:!1}},create({maxSize:e,label:t}){let n=new qn(new Xn(e,t));return n.checkRootSync(),n}};var Qn=class extends qn{devices=new Map;devicesWithDriver(e,t){if(t&&typeof e==`string`)throw z(P(`EINVAL`,`Can not fetch devices using only a driver name`));let n=[];for(let r of this.devices.values())t&&r.driver!=e||(typeof e==`string`?e:e.name)==r.driver.name&&n.push(r);return n}_createDevice(e,t={}){let n=1,r=Array.from(this.devices.values()).at(-1);for(;this.store.has(n)||r?.inode.ino==n;)n++;let i=e.init?.(n,t),a={data:{},minor:0,major:0,...m(i??{},`metadata`),driver:e,inode:new q({mode:8630,...i?.metadata})},o=`/`+(a.name||e.name)+(e.singleton?``:this.devicesWithDriver(e).length);if(this.existsSync(o))throw P(`EEXIST`);return this.devices.set(o,a),de(`Initialized device: `+this._mountPoint+o),a}addDefaults(){this._createDevice(er),this._createDevice(tr),this._createDevice(nr),this._createDevice(rr),this._createDevice(ir),fe(`Added default devices`)}constructor(){super(new Xn(16777216,`devfs`))}async rename(e,t){if(this.devices.has(e))throw P(`EPERM`);if(this.devices.has(t))throw P(`EEXIST`);return super.rename(e,t)}renameSync(e,t){if(this.devices.has(e))throw P(`EPERM`);if(this.devices.has(t))throw P(`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 P(`EEXIST`);return super.createFile(e,t)}createFileSync(e,t){if(this.devices.has(e))throw P(`EEXIST`);return super.createFileSync(e,t)}async unlink(e){if(this.devices.has(e))throw P(`EPERM`);return super.unlink(e)}unlinkSync(e){if(this.devices.has(e))throw P(`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 P(`EEXIST`);return super.mkdir(e,t)}mkdirSync(e,t){if(this.devices.has(e))throw P(`EEXIST`);return super.mkdirSync(e,t)}async readdir(e){let t=await super.readdir(e);for(let n of this.devices.keys())G(n)==e&&t.push(pn(n));return t}readdirSync(e){let t=super.readdirSync(e);for(let n of this.devices.keys())G(n)==e&&t.push(pn(n));return t}async link(e,t){if(this.devices.has(e))throw P(`EPERM`);if(this.devices.has(t))throw P(`EEXIST`);return super.link(e,t)}linkSync(e,t){if(this.devices.has(e))throw P(`EPERM`);if(this.devices.has(t))throw P(`EEXIST`);return super.linkSync(e,t)}async sync(){for(let e of this.devices.values())e.driver.sync?.(e);return super.sync()}syncSync(){for(let e of this.devices.values())e.driver.sync?.(e);return super.syncSync()}async read(e,t,n,r){let i=this.devices.get(e);if(!i){await super.read(e,t,n,r);return}i.driver.read(i,t,n,r)}readSync(e,t,n,r){let i=this.devices.get(e);if(!i){super.readSync(e,t,n,r);return}i.driver.read(i,t,n,r)}async write(e,t,n){let r=this.devices.get(e);if(!r)return await super.write(e,t,n);r.driver.write(r,t,n)}writeSync(e,t,n){let r=this.devices.get(e);if(!r)return super.writeSync(e,t,n);r.driver.write(r,t,n)}};const $n=new Uint8Array,er={name:`null`,singleton:!0,init(){return{major:1,minor:3}},read(){return $n},write(){}},tr={name:`zero`,singleton:!0,init(){return{major:1,minor:5}},read(e,t,n,r){t.fill(0,n,r)},write(){}},nr={name:`full`,singleton:!0,init(){return{major:1,minor:7}},read(e,t,n,r){t.fill(0,n,r)},write(){throw P(`ENOSPC`)}},rr={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(){}},ir={name:`console`,singleton:!0,init(e,{output:t=e=>console.log(e)}={}){return{major:5,minor:1,data:{output:t}}},read(){return $n},write(e,t,n){let r=E(t);e.data.output(r,n)}},ar={null:er,zero:tr,full:nr,random:rr,console:ir};var or=r();let X=!0;function sr(e){X=e}var cr;(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`})(cr||={});function lr(e){return(e&61440)>>12}function ur(e){return e<<12}var dr=class{ino;type;path;name},fr=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},pr=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},mr=class{pending=new Set;lastWriter;writeState=0;readers=0;syncReaders=0;take(e,t,n){e==`rw`?this.writeState=t?2:1:(this.readers++,t&&this.syncReaders++);let r=!1,i=()=>{r||(r=!0,e==`rw`?this.writeState=0:(this.readers--,t&&this.syncReaders--),n())};return i[Symbol.dispose]=i,i}queue(e){let{promise:t,resolve:n}=Promise.withResolvers();return this.pending.add(t),e==`rw`&&(this.lastWriter=t),t.then(()=>{this.pending.delete(t),this.lastWriter==t&&delete this.lastWriter}),n}async acquire(e){let t=e==`ro`?this.lastWriter:Promise.all(this.pending),n=this.queue(e);return await t,this.take(e,!1,n)}acquireSync(e){if(this.writeState==2||e==`rw`&&this.syncReaders)throw P(`EDEADLK`);if(this.writeState||e==`rw`&&this.readers)throw P(`EAGAIN`);return this.take(e,!0,this.queue(e))}isAvailable(e){return(e!=`rw`||!this.readers)&&!this.writeState}get isFree(){return!this.writeState&&!this.readers}get mode(){return this.writeState?`rw`:this.readers?`ro`:null}};let hr=(()=>{let e=[],t,n;return class{static{let r=typeof Symbol==`function`&&Symbol.metadata?Object.create(null):void 0;t=[b],n=[b],pr(this,null,t,{kind:`getter`,name:`lock`,static:!1,private:!1,access:{has:e=>`lock`in e,get:e=>e.lock},metadata:r},null,e),pr(this,null,n,{kind:`getter`,name:`lockSync`,static:!1,private:!1,access:{has:e=>`lockSync`in e,get:e=>e.lockSync},metadata:r},null,e),r&&Object.defineProperty(this,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:r})}_rwLock=(fr(this,e),new mr);get lock(){return this._rwLock.acquire.bind(this._rwLock)}get lockSync(){return this._rwLock.acquireSync.bind(this._rwLock)}get isLocked(){return!this._rwLock.isFree}get lockMode(){return this._rwLock.mode}}})();var gr=class extends hr{fs;inode;data;dirtyRanges=[];truncatedTo;metadataDirty=!1;refs=0;paths=new Set;_lastPath;constructor(e,t,n){super(),this.fs=e,this.inode=n,this.paths.add(t),this._lastPath=t,this.data=new s(n.ino,n.size,{sparse:!0})}get ino(){return this.inode.ino}get path(){let[e]=this.paths;return e!==void 0&&(this._lastPath=e),e??this._lastPath}get dirty(){return this.metadataDirty||this.dirtyRanges.length>0}get bypassCache(){return Fn(this.inode)||Pn(this.inode)||!!(this.inode.flags&An.DAX)}markDirty(e,t){this.dirtyRanges.push({start:e,end:t}),this.dirtyRanges.sort((e,t)=>e.start-t.start);let n=[];for(let e of this.dirtyRanges){let t=n.at(-1);t&&e.start<=t.end?t.end=Math.max(t.end,e.end):n.push(e)}this.dirtyRanges=n}copyFromCache(e,t,n){let r=t;for(let i of this.data.regions){let a=i.offset+i.data.byteLength;if(a<=r)continue;if(i.offset>=n)break;i.offset>r&&(e.fill(0,r-t,i.offset-t),r=i.offset);let o=Math.min(n,a);e.set(i.data.subarray(r-i.offset,o-i.offset),r-t),r=o}r<n&&e.fill(0,r-t,n-t)}async read(e,t,n){if(this.bypassCache)return await this.fs.read(this.path,e,t,n);for(let{start:e,end:r}of this.data.missing(t,n)){let t=new Uint8Array(r-e);await this.fs.read(this.path,t,e,r),this.data.add(t,e)}this.copyFromCache(e,t,n)}readSync(e,t,n){if(this.bypassCache)return this.fs.readSync(this.path,e,t,n);for(let{start:e,end:r}of this.data.missing(t,n)){let t=new Uint8Array(r-e);this.fs.readSync(this.path,t,e,r),this.data.add(t,e)}this.copyFromCache(e,t,n)}async write(e,t){this.bypassCache?await this.fs.write(this.path,e,t):this._writeCached(e,t),this._writeMetadata(t+e.byteLength)}writeSync(e,t){this.bypassCache?this.fs.writeSync(this.path,e,t):this._writeCached(e,t),this._writeMetadata(t+e.byteLength)}_writeCached(e,t){let n=t+e.byteLength;this.data.add(e.slice(),t),n>this.data.size&&(this.data.size=n),this.markDirty(t,n)}_writeMetadata(e){!this.bypassCache&&e>this.inode.size&&(this.inode.size=e),this.inode.mtimeMs=Date.now(),this.inode.ctimeMs=Date.now(),this.metadataDirty=!0}truncate(e){this.truncatedTo=Math.min(this.truncatedTo??e,e),this.data.size=e,this.dirtyRanges=this.dirtyRanges.filter(t=>t.start<e).map(t=>t.end>e?{start:t.start,end:e}:t),this.inode.size=e,this.inode.mtimeMs=Date.now(),this.inode.ctimeMs=Date.now(),this.metadataDirty=!0}get needsPreTruncate(){return!this.bypassCache&&this.truncatedTo!==void 0&&this.truncatedTo<this.inode.size&&!this.fs.attributes.has(`no_write`)}async sync(){this.needsPreTruncate&&await this.fs.touch(this.path,{size:this.truncatedTo}),this.truncatedTo=void 0;for(let e of this.dirtyRanges)for(let t=e.start;t<e.end;){let n=this.data.regionAt(t);if(!n)break;let r=Math.min(e.end,n.offset+n.data.byteLength);await this.fs.write(this.path,n.data.subarray(t-n.offset,r-n.offset),t),t=r}this.dirtyRanges=[],this.metadataDirty&&=(this.fs.attributes.has(`no_write`)||await this.fs.touch(this.path,this.inode),!1)}syncSync(){this.needsPreTruncate&&this.fs.touchSync(this.path,{size:this.truncatedTo}),this.truncatedTo=void 0;for(let e of this.dirtyRanges)for(let t=e.start;t<e.end;){let n=this.data.regionAt(t);if(!n)break;let r=Math.min(e.end,n.offset+n.data.byteLength);this.fs.writeSync(this.path,n.data.subarray(t-n.offset,r-n.offset),t),t=r}this.dirtyRanges=[],this.metadataDirty&&=(this.fs.attributes.has(`no_write`)||this.fs.touchSync(this.path,this.inode),!1)}},_r=function(e,t,n){if(t!=null){if(typeof t!=`object`&&typeof t!=`function`)throw TypeError(`Object expected.`);var r,i;if(n){if(!Symbol.asyncDispose)throw TypeError(`Symbol.asyncDispose is not defined.`);r=t[Symbol.asyncDispose]}if(r===void 0){if(!Symbol.dispose)throw TypeError(`Symbol.dispose is not defined.`);r=t[Symbol.dispose],n&&(i=r)}if(typeof r!=`function`)throw TypeError(`Object not disposable.`);i&&(r=function(){try{i.call(this)}catch(e){return Promise.reject(e)}}),e.stack.push({value:t,dispose:r,async:n})}else n&&e.stack.push({async:!0});return t},vr=(function(e){return function(t){function n(n){t.error=t.hasError?new e(n,t.error,`An error was suppressed during disposal.`):n,t.hasError=!0}var r,i=0;function a(){for(;r=t.stack.pop();)try{if(!r.async&&i===1)return i=0,t.stack.push(r),Promise.resolve().then(a);if(r.dispose){var e=r.dispose.call(r.value);if(r.async)return i|=2,Promise.resolve(e).then(a,function(e){return n(e),a()})}else i|=1}catch(e){n(e)}if(i===1)return t.hasError?Promise.reject(t.error):Promise.resolve();if(t.hasError)throw t.error}return a()}})(typeof SuppressedError==`function`?SuppressedError:function(e,t,n){var r=Error(n);return r.name=`SuppressedError`,r.error=e,r.suppressed=t,r}),yr=class{fs;byIno=new Map;byPath=new Map;constructor(e){this.fs=e}get(e){return this.byPath.get(e)}ref(e,t){let n=this.byIno.get(t.ino);return n&&!n.paths.has(e)&&(t.ino===0||(n.inode.mode^t.mode)&61440)&&(n=this.byPath.get(e),n&&(n.inode.mode^t.mode)&61440&&(n=void 0)),n?(n.paths.add(e),!n.dirty&&t!==n.inode&&Object.assign(n.inode,t)):(n=new gr(this.fs,e,t),this.byIno.set(t.ino,n)),this.byPath.set(e,n),n.refs++,n}unref(e){e.refs--,!(e.refs>0||e.dirty)&&this.evict(e)}evict(e){this.byIno.delete(e.ino);for(let t of e.paths)this.byPath.delete(t)}rename(e,t){for(let[n,r]of this.byPath){if(n!=e&&!n.startsWith(e+`/`))continue;let i=t+n.slice(e.length);this.byPath.delete(n),this.byPath.set(i,r),r.paths.delete(n),r.paths.add(i)}}link(e,t){let n=this.byPath.get(e);n&&(n.paths.add(t),this.byPath.set(t,n))}remove(e){let t=this.byPath.get(e);t&&(this.byPath.delete(e),t.paths.delete(e),!t.paths.size&&!t.refs&&this.evict(t))}async sync(){for(let e of this.byIno.values()){let t={stack:[],error:void 0,hasError:!1};try{if(!e.dirty)continue;_r(t,await e.lock(`rw`),!1),await e.sync(),e.refs||this.evict(e)}catch(e){t.error=e,t.hasError=!0}finally{vr(t)}}}syncSync(){for(let e of this.byIno.values()){let t={stack:[],error:void 0,hasError:!1};try{if(!e.dirty)continue;_r(t,e.lockSync(`rw`),!1),e.syncSync(),e.refs||this.evict(e)}catch(e){t.error=e,t.hasError=!0}finally{vr(t)}}}};const br=new Map;function xr(e){let t=br.get(e.uuid);return t||(t=new yr(e),br.set(e.uuid,t)),t}async function Sr(e,t,n,r){let i=xr(e);r??=i.get(t)?.inode??await e.stat(t);let a=i.ref(t,r),o=await a.lock(n),s=!1,c=()=>{s||(s=!0,o(),i.unref(a))};return c[Symbol.dispose]=c,c}function Cr(e,t,n,r){let i=xr(e);r??=i.get(t)?.inode??e.statSync(t);let a=i.ref(t,r),o;try{o=a.lockSync(n)}catch(e){throw i.unref(a),e}let s=!1,c=()=>{s||(s=!0,o(),i.unref(a))};return c[Symbol.dispose]=c,c}var wr=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},Tr=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},Er=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},Dr=(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});const Or=4096;let kr=(()=>{let e=[],t,n;return class{static{let r=typeof Symbol==`function`&&Symbol.metadata?Object.create(null):void 0;Tr(this,null,t,{kind:`getter`,name:`inode`,static:!1,private:!1,access:{has:e=>`inode`in e,get:e=>e.inode},metadata:r},null,e),Tr(this,null,n,{kind:`getter`,name:`fs`,static:!1,private:!1,access:{has:e=>`fs`in e,get:e=>e.fs},metadata:r},null,e),r&&Object.defineProperty(this,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:r})}context=wr(this,e);path;internalPath;flag;vnode;_position=0;get position(){return this.flag&1024?this.inode.size:this._position}set position(e){this._position=e}get inode(){return this.vnode.inode}get fs(){return this.vnode.fs}get dirty(){return this.vnode.dirty}closed=!1;get isClosed(){return this.closed}constructor(e,t,n,r,i){this.context=e,this.path=t,this.internalPath=n,this.flag=r,this.vnode=i}get _isSync(){return!!(this.flag&1052672||this.inode.flags&An.Sync||this.fs.attributes.has(`sync`))}[(t=[b],n=[b],Symbol.dispose)](){this.closeSync()}syncSync(){let e={stack:[],error:void 0,hasError:!1};try{if(this.closed)throw N(`EBADF`,`sync`,this.path);if(!this.dirty)return;Er(e,this.vnode.lockSync(`rw`),!1),this.vnode.syncSync()}catch(t){e.error=t,e.hasError=!0}finally{Dr(e)}}datasyncSync(){return this.syncSync()}closeSync(){if(this.closed)throw N(`EBADF`,`close`,this.path);this.syncSync(),this.disposeSync(!0)}disposeSync(e){if(this.closed)throw N(`EBADF`,`close`,this.path);if(this.dirty&&!e)throw N(`EBUSY`,`close`,this.path);this.closed=!0,xr(this.fs).unref(this.vnode)}truncateSync(e){let t={stack:[],error:void 0,hasError:!1};try{if(e<0)throw N(`EINVAL`,`truncate`,this.path);if(this.closed||!(this.flag&1||this.flag&2))throw N(`EBADF`,`truncate`,this.path);if(this.fs.attributes.has(`readonly`))throw N(`EROFS`,`truncate`,this.path);if(this.inode.flags&An.Immutable)throw N(`EPERM`,`truncate`,this.path);Er(t,this.vnode.lockSync(`rw`),!1),this.vnode.truncate(e),this._isSync&&this.vnode.syncSync()}catch(e){t.error=e,t.hasError=!0}finally{Dr(t)}}writeSync(e,t=0,n=e.byteLength-t,r=this.position){let i={stack:[],error:void 0,hasError:!1};try{if(this.closed||!(this.flag&1||this.flag&2))throw N(`EBADF`,`write`,this.path);if(this.fs.attributes.has(`readonly`))throw N(`EROFS`,`write`,this.path);if(this.inode.flags&An.Immutable)throw N(`EPERM`,`write`,this.path);Er(i,this.vnode.lockSync(`rw`),!1);let a=e.subarray(t,t+n);return this.vnode.writeSync(a,r),this._position=r+a.byteLength,this._isSync&&this.vnode.syncSync(),a.byteLength}catch(e){i.error=e,i.hasError=!0}finally{Dr(i)}}readSync(e,t=0,n=e.byteLength-t,r=this.position){let i={stack:[],error:void 0,hasError:!1};try{if(this.closed||this.flag&1)throw N(`EBADF`,`read`,this.path);Er(i,this.vnode.lockSync(`ro`),!1),!(this.inode.flags&An.NoAtime)&&!this.fs.attributes.has(`no_atime`)&&(this.vnode.metadataDirty=!0,this.inode.atimeMs=Date.now());let a=r+n;!Fn(this.inode)&&!Pn(this.inode)&&a>this.inode.size&&(a=r+Math.max(this.inode.size-r,0)),this._position=a;let o=new Uint8Array(e.buffer,e.byteOffset,e.byteLength);return this.vnode.readSync(o.subarray(t,t+n),r,a),this._isSync&&this.vnode.syncSync(),a-r}catch(e){i.error=e,i.hasError=!0}finally{Dr(i)}}chmodSync(e){let t={stack:[],error:void 0,hasError:!1};try{if(this.closed)throw N(`EBADF`,`chmod`,this.path);Er(t,this.vnode.lockSync(`rw`),!1),this.vnode.metadataDirty=!0,this.inode.mode=this.inode.mode&(e>61440?-61441:Ye)|e,(this._isSync||e>61440)&&this.vnode.syncSync()}catch(e){t.error=e,t.hasError=!0}finally{Dr(t)}}chownSync(e,t){let n={stack:[],error:void 0,hasError:!1};try{if(this.closed)throw N(`EBADF`,`chmod`,this.path);Er(n,this.vnode.lockSync(`rw`),!1),this.vnode.metadataDirty=!0,Ln(this.inode,e,t),this._isSync&&this.vnode.syncSync()}catch(e){n.error=e,n.hasError=!0}finally{Dr(n)}}utimesSync(e,t){let n={stack:[],error:void 0,hasError:!1};try{if(this.closed)throw N(`EBADF`,`utimes`,this.path);Er(n,this.vnode.lockSync(`rw`),!1),this.vnode.metadataDirty=!0,this.inode.atimeMs=e,this.inode.mtimeMs=t,this._isSync&&this.vnode.syncSync()}catch(e){n.error=e,n.hasError=!0}finally{Dr(n)}}async[Symbol.asyncDispose](){await this.close()}async sync(){let e={stack:[],error:void 0,hasError:!1};try{if(this.closed)throw N(`EBADF`,`sync`,this.path);if(!this.dirty)return;Er(e,await this.vnode.lock(`rw`),!1),await this.vnode.sync()}catch(t){e.error=t,e.hasError=!0}finally{Dr(e)}}datasync(){return this.sync()}async close(){if(this.closed)throw N(`EBADF`,`close`,this.path);await this.sync(),this.dispose(!0)}dispose(e){if(this.closed)throw N(`EBADF`,`close`,this.path);if(this.dirty&&!e)throw N(`EBUSY`,`close`,this.path);this.closed=!0,xr(this.fs).unref(this.vnode)}stat(){if(this.closed)throw N(`EBADF`,`stat`,this.path);return this.inode}async truncate(e){let t={stack:[],error:void 0,hasError:!1};try{if(e<0)throw N(`EINVAL`,`truncate`,this.path);if(this.closed||!(this.flag&1||this.flag&2))throw N(`EBADF`,`truncate`,this.path);if(this.fs.attributes.has(`readonly`))throw N(`EROFS`,`truncate`,this.path);if(this.inode.flags&An.Immutable)throw N(`EPERM`,`truncate`,this.path);Er(t,await this.vnode.lock(`rw`),!1),this.vnode.truncate(e),this._isSync&&await this.vnode.sync()}catch(e){t.error=e,t.hasError=!0}finally{Dr(t)}}async write(e,t=0,n=e.byteLength-t,r=this.position){let i={stack:[],error:void 0,hasError:!1};try{if(this.closed||!(this.flag&1||this.flag&2))throw N(`EBADF`,`write`,this.path);if(this.fs.attributes.has(`readonly`))throw N(`EROFS`,`write`,this.path);if(this.inode.flags&An.Immutable)throw N(`EPERM`,`write`,this.path);Er(i,await this.vnode.lock(`rw`),!1);let a=e.subarray(t,t+n);return await this.vnode.write(a,r),this._position=r+a.byteLength,this._isSync&&await this.vnode.sync(),a.byteLength}catch(e){i.error=e,i.hasError=!0}finally{Dr(i)}}async read(e,t=0,n=e.byteLength-t,r=this.position){let i={stack:[],error:void 0,hasError:!1};try{if(this.closed||this.flag&1)throw N(`EBADF`,`read`,this.path);Er(i,await this.vnode.lock(`ro`),!1),!(this.inode.flags&An.NoAtime)&&!this.fs.attributes.has(`no_atime`)&&(this.vnode.metadataDirty=!0,this.inode.atimeMs=Date.now());let a=r+n;!Fn(this.inode)&&!Pn(this.inode)&&a>this.inode.size&&(a=r+Math.max(this.inode.size-r,0)),this._position=a;let o=new Uint8Array(e.buffer,e.byteOffset,e.byteLength);return await this.vnode.read(o.subarray(t,t+n),r,a),this._isSync&&await this.vnode.sync(),a-r}catch(e){i.error=e,i.hasError=!0}finally{Dr(i)}}async chmod(e){let t={stack:[],error:void 0,hasError:!1};try{if(this.closed)throw N(`EBADF`,`chmod`,this.path);Er(t,await this.vnode.lock(`rw`),!1),this.vnode.metadataDirty=!0,this.inode.mode=this.inode.mode&(e>61440?-61441:Ye)|e,(this._isSync||e>61440)&&await this.vnode.sync()}catch(e){t.error=e,t.hasError=!0}finally{Dr(t)}}async chown(e,t){let n={stack:[],error:void 0,hasError:!1};try{if(this.closed)throw N(`EBADF`,`chown`,this.path);Er(n,await this.vnode.lock(`rw`),!1),this.vnode.metadataDirty=!0,Ln(this.inode,e,t),this._isSync&&await this.vnode.sync()}catch(e){n.error=e,n.hasError=!0}finally{Dr(n)}}async utimes(e,t){let n={stack:[],error:void 0,hasError:!1};try{if(this.closed)throw N(`EBADF`,`utimes`,this.path);Er(n,await this.vnode.lock(`rw`),!1),this.vnode.metadataDirty=!0,this.inode.atimeMs=e,this.inode.mtimeMs=t,this._isSync&&await this.vnode.sync()}catch(e){n.error=e,n.hasError=!0}finally{Dr(n)}}streamRead(e){if(this.closed)throw N(`EBADF`,`streamRead`,this.path);let{vnode:t}=this;return new ReadableStream({async start(n){let r={stack:[],error:void 0,hasError:!1};try{Er(r,await t.lock(`ro`),!1);let{start:i=0,end:a=t.inode.size}=e;for(let e=i;e<a;e+=Or){let r=e+Or>a?a-e:Or,i=new Uint8Array(r);await t.read(i,e,e+r).catch(n.error.bind(n)),n.enqueue(i)}n.close()}catch(e){r.error=e,r.hasError=!0}finally{Dr(r)}},type:`bytes`})}streamWrite(e){if(this.closed)throw N(`EBADF`,`write`,this.path);if(this.inode.flags&An.Immutable)throw N(`EPERM`,`write`,this.path);if(this.fs.attributes.has(`readonly`))throw N(`EROFS`,`write`,this.path);let{vnode:t}=this,n=e.start??0;return new WritableStream({async write(e,r){let i={stack:[],error:void 0,hasError:!1};try{Er(i,await t.lock(`rw`),!1),await t.write(e,n).catch(r.error.bind(r)),n+=e.byteLength}catch(e){i.error=e,i.hasError=!0}finally{Dr(i)}},async close(){let e={stack:[],error:void 0,hasError:!1};try{Er(e,await t.lock(`rw`),!1),await t.sync()}catch(t){e.error=t,e.hasError=!0}finally{Dr(e)}}})}}})();function Ar(e){let t=Ie(e.context).descriptors,n=Math.max(t.size?Math.max(...t.keys())+1:0,4);return t.set(n,e),n}function jr(e,t){Qt(t);let n=Ie(e).descriptors.get(t);if(!n)throw P(`EBADF`);return n}function Mr(e,t){return Ie(e).descriptors.delete(t)}const Nr=/[rwasx]{1,2}\+?/;function Pr(e){if(typeof e==`number`)return e;if(!Nr.test(e))throw P(`EINVAL`,`Invalid flag string: `+e);return Fr(e)}function Fr(e){if(!e.includes(`r`)&&!e.includes(`w`)&&!e.includes(`a`))throw P(`EINVAL`,`Invalid flag string: `+e);let t=e.includes(`r`)?0:64;return e.includes(`w`)&&(t|=512),e.includes(`a`)&&(t|=Be),e.includes(`+`)?t|=2:e.includes(`r`)||(t|=1),e.includes(`s`)&&(t|=We),e.includes(`x`)&&(t|=128),t}function Ir(e){let t=0;return e&1||(t|=4),(e&1||e&2)&&(t|=2),t}const Lr=M;function Rr(e,t){return e.path=t,e}function zr(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 j(Object.assign(e,i))}}}function Br(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 j(Object.assign(e,t));if(e in k){let r=N(e,t);Error.captureStackTrace(r,n)}throw e}):a}catch(e){throw j(Object.assign(e,t))}}:r}})}const Vr=new Map;Hr(`/`,Zn.create({label:`root`}));function Hr(e,t){if(e[0]!=`/`&&(e=`/`+e),e=ln.call(this,e),Vr.has(e))throw z(P(`EINVAL`,`Mount point is already in use: `+e));t._mountPoint=e,Vr.set(e,t),br.has(t.uuid)||br.set(t.uuid,new yr(t)),de(`Mounted ${t.name} on ${e}`),fe(`${t.name} attributes: ${[...t.attributes].map(([e,t])=>t==null?e:e+`=`+t).join(`, `)}`)}function Ur(e){e[0]!=`/`&&(e=`/`+e),e=ln.call(this,e);let t=Vr.get(e);if(!t){B(e+` is already unmounted`);return}let n=()=>{br.delete(t.uuid),de(`Synced all changes to `+e)};try{br.get(t.uuid)?.syncSync(),n()}catch{B(`Could not flush to ${e} synchronously.`),br.get(t.uuid)?.sync().then(n)}Vr.delete(e),ue(`Unmounted `+e)}function Z(e,t,n){let{root:r}=Ie(t),i={path:e,...n};e=U(W(r,e),!0),e=ln.call(t,e);let a=[...Vr].sort((e,t)=>e[0].length>t[0].length?-1:1);for(let[t,n]of a){if(!Kr(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:Br(n,i),path:e,mountPoint:t,root:r}}throw ce(new M(k.EIO,`No file system for `+e))}function Wr(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 Gr(e){let t=Ie(this);if(!Ne(t.credentials))throw P(`EPERM`,`Can not chroot() as non-root user`);t.root??=`/`;let n=W(t.root,e);for(let e of t.descriptors?.values()??[]){if(!e.path.startsWith(t.root))throw N(`EBUSY`,`chroot`,e.path);e.path=e.path.slice(t.root.length)}if(n.length>t.root.length)throw P(`EPERM`,`Can not chroot() outside of current root`);t.root=n}function Kr(e,t){return e===`/`||e===t||(e.endsWith(`/`)||(e+=`/`),t.startsWith(e))}var qr=t({link:()=>ni,mkdir:()=>$r,open:()=>Zr,readdir:()=>ei,readlink:()=>Qr,rename:()=>ti,resolve:()=>Xr,stat:()=>ri}),Jr=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},Yr=(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 Xr(e,t,n,r){t=ln.call(e,t);try{let i=Z(t,e),a=xr(i.fs).get(i.path)?.inode??i.fs.statSync(i.path);return!Mn(a)||n?{...i,fullPath:t,stats:a}:Xr(e,ln.call(e,G(t),Qr.call(e,t)),n,r)}catch(e){if(j(Object.assign(e,{syscall:`stat`,path:t,...r})),n)throw e}let{base:i,dir:a}=gn(t),o=a==`/`?`/`:Xr(e,a,!1,r).fullPath,s=W(o,i),c=Z(s,e),l;try{l=xr(c.fs).get(c.path)?.inode??c.fs.statSync(c.path)}catch(e){if(e.code===`ENOENT`)return{...c,fullPath:s};throw j(Object.assign(e,{syscall:`stat`,path:s,...r}))}return Mn(l)?Xr(e,ln.call(e,o,Qr.call(e,s)),!1,r):{...c,fullPath:s,stats:l}}function Zr(e,t){e=U(e);let n=Xt(t.mode,420),r=Pr(t.flag);e=t.preserveSymlinks?e:Xr(this,e).fullPath;let{fs:i,path:a}=Z(e,this),o;try{o=i.statSync(a)}catch{}if(!o){let o={stack:[],error:void 0,hasError:!1};try{if(!(r&64))throw N(`ENOENT`,`open`,e);let s=G(a),c=i.statSync(s);if(X&&!Y(this,c,2))throw N(`EACCES`,`open`,e);if(!J(c))throw N(`ENOTDIR`,`open`,e);if(!t.allowDirectory&&n&16384)throw N(`EISDIR`,`open`,e);Jr(o,Cr(i,s,`rw`,c),!1);let{euid:l,egid:u}=Ie(this).credentials,d=i.createFileSync(a,{mode:n,uid:c.mode&2048?c.uid:l,gid:c.mode&1024?c.gid:u});return sa(this,`rename`,e),new kr(this,e,a,r,xr(i).ref(a,d))}catch(e){o.error=e,o.hasError=!0}finally{Yr(o)}}if(X&&(!Y(this,o,n)||!Y(this,o,Ir(r))))throw N(`EACCES`,`open`,e);if(r&128)throw N(`EEXIST`,`open`,e);if(!t.allowDirectory&&o.mode&16384)throw N(`EISDIR`,`open`,e);let s=new kr(this,e,a,r,xr(i).ref(a,o));return r&512&&s.truncateSync(0),s}function Qr(e){e=U(e);let{fs:t,stats:n,path:r}=Xr(this,e,!0,{syscall:`readlink`});if(!n)throw N(`ENOENT`,`readlink`,e);if(X&&!Y(this,n,4))throw N(`EACCES`,`readlink`,e);if(!Mn(n))throw N(`EINVAL`,`readlink`,e);let i=n.size,a=new Uint8Array(i);return t.readSync(r,a,0,i),E(a)}function $r(e,t={}){let n=U(e),r={syscall:`mkdir`,path:n},{fullPath:i}=Xr(this,G(n),!1,r),{fs:a,path:o}=Z(W(i,pn(n)),this,r),s=i!=G(n),{euid:c,egid:l}=Ie(this).credentials,{mode:u=511,recursive:d}=t,f,p=(e,t)=>{let n={stack:[],error:void 0,hasError:!1};try{let i=G(t),m=d&&i!=`/`?p(G(e),i):a.statSync(i);if(d){let n;try{n=xr(a).get(t)?.inode??a.statSync(t)}catch{}if(n){let i=Mn(n)?Xr(this,e,!1,r).stats:n;if(!i)throw N(`ENOENT`,r);if(!J(i))throw N(t==o?`EEXIST`:`ENOTDIR`,r);return n}if(s&&a.existsSync(W(i,pn(e))))throw N(`ENOENT`,r)}if(X&&!Y(this,m,2))throw N(`EACCES`,`mkdir`,e);Jr(n,Cr(a,i,`rw`,m),!1);let h=zr(a,`mkdirSync`,{path:e,syscall:`mkdir`})(t,{mode:u,uid:m.mode&2048?m.uid:c,gid:m.mode&1024?m.gid:l});return d&&(f??=e),sa(this,`rename`,e),h}catch(e){n.error=e,n.hasError=!0}finally{Yr(n)}};return p(n,o),f}function ei(e,t={}){e=U(e);let{fs:n,path:r}=Xr(this,e),i=xr(n).get(r)?.inode??zr(n,`statSync`,{path:e,syscall:`scandir`})(r);if(X&&!Y(this,i,4))throw N(`EACCES`,`scandir`,e);if(!J(i))throw N(`ENOTDIR`,`scandir`,e);let a;{let e={stack:[],error:void 0,hasError:!1};try{Jr(e,Cr(n,r,`ro`,i),!1),a=n.readdirSync(r)}catch(t){e.error=t,e.hasError=!0}finally{Yr(e)}}let o=[],s=e=>{let i;try{i=n.statSync(W(r,e))}catch(e){if(e.code==`ENOENT`)return;throw e}let a=new dr;if(a.ino=i.ino,a.type=lr(i.mode),a.path=e,a.name=pn(e),o.push(a),!J(i)||!t?.recursive)return;let c=n.readdirSync(W(r,e));for(let t of c)s(W(e,t))};for(let e of a)s(e);return o}function ti(e,t){let n={stack:[],error:void 0,hasError:!1};try{e=U(e),t=U(t);let r={syscall:`rename`,path:e,dest:t},i=Xr(this,e,!0,r),a=Z(t,this,r);if(i.fs.uuid!==a.fs.uuid)throw N(`EXDEV`,r);if(a.path.startsWith(i.path+`/`))throw N(`EINVAL`,r);if(!i.stats)throw N(`ENOENT`,r);let o=i.fs,s=o.statSync(G(i.path)),c=o.statSync(G(a.path)),l;try{l=o.statSync(a.path)}catch(e){if(e.code!=`ENOENT`)throw e}if(X&&(!Y(this,s,4)||!Y(this,c,2)))throw N(`EACCES`,r);if(l&&!J(i.stats)&&J(l))throw N(`EISDIR`,r);if(l&&J(i.stats)&&!J(l))throw N(`ENOTDIR`,r);let u=G(i.path),d=G(a.path),f=[[u,s],[d,c]];s.ino>c.ino&&f.reverse(),Jr(n,Cr(o,f[0][0],`rw`,f[0][1]),!1),Jr(n,s.ino==c.ino?null:Cr(o,f[1][0],`rw`,f[1][1]),!1),i.fs.renameSync(i.path,a.path),xr(o).rename(i.path,a.path),sa(this,`rename`,e),sa(this,`rename`,t)}catch(e){n.error=e,n.hasError=!0}finally{Yr(n)}}function ni(e,t){let n={stack:[],error:void 0,hasError:!1};try{e=U(e),t=U(t);let r={syscall:`link`,path:e,dest:t},{fs:i,path:a}=Z(e,this,r),o=Z(t,this,r);if(i.uuid!==o.fs.uuid)throw N(`EXDEV`,r);let s=i.statSync(a);if(X){if(!Y(this,s,4))throw N(`EACCES`,r);let e=i.statSync(G(a));if(!Y(this,e,4))throw N(`EACCES`,r);let t=i.statSync(G(o.path));if(!Y(this,t,2))throw N(`EACCES`,r)}Jr(n,Cr(i,G(o.path),`rw`),!1),i.linkSync(a,o.path),xr(i).link(a,o.path)}catch(e){n.error=e,n.hasError=!0}finally{Yr(n)}}function ri(e,t){e=U.call(this,e);let n={syscall:t?`lstat`:`stat`,path:e},r;if(!t)r=Xr(this,e,!1,n).stats;else{let{base:t,dir:i}=gn(e),{fs:a,path:o}=Xr(this,i,!1,n);try{let e=t?W(o,t):o;r=xr(a).get(e)?.inode??a.statSync(e)}catch(e){throw j(Object.assign(e,n)),e}}if(!r)throw N(`ENOENT`,n);if(X&&!Y(this,r,4))throw N(`EACCES`,n);return r}var ii=class e{ino;type;_name;get name(){let e=or.Buffer.from(this._name);return this._encoding==`buffer`?e:e.toString(this._encoding)}_encoding;_parentPath;get parentPath(){return this._parentPath}get path(){return B(`Dirent.path was removed in Node v24, use parentPath instead`),this._parentPath}static from(t,n,r=`.`){let i=new e,{base:a,dir:o}=gn(t.path);return i._parentPath=W(r,o),i._name=a,i.ino=t.ino,i.type=t.type,i._encoding=n,i}isFile(){return this.type===cr.REG}isDirectory(){return this.type===cr.DIR}isBlockDevice(){return this.type===cr.BLK}isCharacterDevice(){return this.type===cr.CHR}isSymbolicLink(){return this.type===cr.LNK}isFIFO(){return this.type===cr.FIFO}isSocket(){return this.type===cr.SOCK}};function ai(){return Object.assign(Error(`Directory handle was closed`),{code:`ERR_DIR_CLOSED`})}var oi=class{path;context;closed=!1;checkClosed(){if(this.closed)throw ai()}_entries;constructor(e,t){this.path=e,this.context=t}close(e){if(this.closed){let t=ai();if(!e)return Promise.reject(t);e(t);return}if(this.closed=!0,!e)return Promise.resolve();e(null)}closeSync(){if(this.closed)throw ai();this.closed=!0}async _read(){return this.checkClosed(),this._entries??=await vo.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()}},si=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},ci=(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 li(e,t){return ti.call(this,e,t)}function ui(e){e=U(e);try{let{fs:t,path:n}=Xr(this,e);return t.existsSync(n)}catch(e){if(e.errno==k.ENOENT)return!1;throw e}}function di(e,t){let n=ri.call(this,e,!1);return t?.bigint?new xn(n):new bn(n)}function fi(e,t){let n=ri.call(this,e,!0);return t?.bigint?new xn(n):new bn(n)}function pi(e,t=0){let n={stack:[],error:void 0,hasError:!1};try{let r=si(n,Zr.call(this,e,{flag:`r+`}),!1);if(t||=0,t<0)throw N(`EINVAL`,`truncate`,e.toString());r.truncateSync(t)}catch(e){n.error=e,n.hasError=!0}finally{ci(n)}}function mi(e){e=U(e);let{fs:t,path:n}=Z(e,this);try{let e={stack:[],error:void 0,hasError:!1};try{if(X&&!Y(this,t.statSync(n),2))throw N(`EACCES`,`unlink`);si(e,Cr(t,G(n),`rw`),!1),t.unlinkSync(n),xr(t).remove(n)}catch(t){e.error=t,e.hasError=!0}finally{ci(e)}}catch(t){throw j(Object.assign(t,{syscall:`unlink`,path:e}))}sa(this,`rename`,e.toString())}function hi(e,t,n=0){return Ar(Zr.call(this,e,{flag:t,mode:n}))}function gi(e,t,n){return Ar(Zr.call(this,e,{flag:t,mode:n,preserveSymlinks:!0}))}function _i(e,t={}){let n={stack:[],error:void 0,hasError:!1};try{let r=en(t,null,`r`,420);if(Pr(r.flag)&1)throw N(`EBADF`,`read`,e.toString());let i=si(n,typeof e==`number`?jr(this,e):Zr.call(this,e.toString(),{flag:r.flag,mode:420,preserveSymlinks:!1}),!1),{size:a}=i.stat(),o=or.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{ci(n)}}function vi(e,t,n={}){let r={stack:[],error:void 0,hasError:!1};try{let i=en(n,`utf8`,`w+`,420),a=Pr(i.flag);if(!(a&1||a&2))throw new M(k.EINVAL,`Flag passed to writeFile must allow for writing`);if(typeof t!=`string`&&!i.encoding)throw new M(k.EINVAL,`Encoding not specified`);let o=typeof t==`string`?or.Buffer.from(t,i.encoding):new Uint8Array(t.buffer,t.byteOffset,t.byteLength);if(!o)throw new M(k.EINVAL,`Data not specified`);si(r,typeof e==`number`?jr(this,e):Zr.call(this,e.toString(),{flag:a,mode:i.mode}),!1).writeSync(o,0,o.byteLength,0),sa(this,`change`,e.toString())}catch(e){r.error=e,r.hasError=!0}finally{ci(r)}}function yi(e,t,n={}){let r=en(n,`utf8`,`a+`,420),i=Pr(r.flag);if(!(i&1024))throw new M(k.EINVAL,`Flag passed to appendFile must allow for appending`);if(typeof t!=`string`&&!r.encoding)throw new M(k.EINVAL,`Encoding not specified`);let a=typeof t==`string`?or.Buffer.from(t,r.encoding):new Uint8Array(t.buffer,t.byteOffset,t.byteLength),o=typeof e==`number`?jr(this,e):Zr.call(this,U(e),{flag:i,mode:r.mode});o.writeSync(a,0,a.byteLength),typeof o!=`number`&&o.closeSync()}function bi(e,t){let n=jr(this,e).stat();return t?.bigint?new xn(n):new bn(n)}function xi(e){jr(this,e).closeSync(),Mr(this,e)}function Si(e,t=0){if(t||=0,t<0)throw new M(k.EINVAL);jr(this,e).truncateSync(t)}function Ci(e){jr(this,e).syncSync()}function wi(e){jr(this,e).datasyncSync()}function Ti(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=or.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=jr(this,e);c??=l.position;let u=l.writeSync(a,o,s,c);return sa(this,`change`,l.path),u}function Ei(e,t,n,r,i){let a=jr(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 N(`EINVAL`);return typeof i==`bigint`&&(i=Number(i)),i=Number.isSafeInteger(i)?i:a.position,a.readSync(t,o,r,i)}function Di(e,t,n){jr(this,e).chownSync(t,n)}function Oi(e,t){let n=Xt(t,-1);if(n<0)throw new M(k.EINVAL,`Invalid mode.`);jr(this,e).chmodSync(n)}function ki(e,t,n){jr(this,e).utimesSync($t(t),$t(n))}function Ai(e){let t={stack:[],error:void 0,hasError:!1};try{e=U(e);let{fs:n,path:r}=Xr(this,e),i=zr(n,`statSync`,{path:e,syscall:`rmdir`})(r);if(!J(i))throw N(`ENOTDIR`,`rmdir`,e);if(X&&!Y(this,i,2))throw N(`EACCES`,`rmdir`,e);si(t,Cr(n,G(r),`rw`),!1),zr(n,`rmdirSync`,e)(r),xr(n).remove(r),sa(this,`rename`,e.toString())}catch(e){t.error=e,t.hasError=!0}finally{ci(t)}}function ji(e,t){t=typeof t==`object`?t:{mode:t};let n=Xt(t?.mode,511);return $r.call(this,e,{...t,mode:n})}function Mi(e,t){t=typeof t==`object`?t:{encoding:t},e=U(e);let n=[],r=ei.call(this,e,t??void 0);for(let i of r)t?.withFileTypes?n.push(ii.from(i,t.encoding,e)):t?.encoding==`buffer`?n.push(or.Buffer.from(i.path)):n.push(i.path);return n}function Ni(e,t){return ni.call(this,e,t)}function Pi(e,t,n=`file`){let r={stack:[],error:void 0,hasError:!1};try{if(![`file`,`dir`,`junction`].includes(n))throw TypeError(`Invalid symlink type: `+n);t=U(t);let i=si(r,Zr.call(this,t,{flag:`wx`,mode:420}),!1);i.writeSync(T(U(e,!0))),i.chmodSync(Ze)}catch(e){r.error=e,r.hasError=!0}finally{ci(r)}}function Fi(e,t){let n=or.Buffer.from(Qr.call(this,e)),r=typeof t==`object`?t?.encoding:t;return r==`buffer`?n:n.toString(r??`utf-8`)}function Ii(e,t,n){let r={stack:[],error:void 0,hasError:!1};try{si(r,Zr.call(this,e,{flag:`r+`,mode:0}),!1).chownSync(t,n)}catch(e){r.error=e,r.hasError=!0}finally{ci(r)}}function Li(e,t,n){let r=gi.call(this,e,`r+`);Di.call(this,r,t,n),xi.call(this,r)}function Ri(e,t){let n;try{n=hi.call(this,e,`r+`)}catch(t){throw j(Object.assign(t,{syscall:`chmod`,path:U(e)}))}Oi.call(this,n,t),xi.call(this,n)}function zi(e,t){let n=gi.call(this,e,`r+`);Oi.call(this,n,t),xi.call(this,n)}function Bi(e,t,n){let r=hi.call(this,e,`r+`);ki.call(this,r,t,n),xi.call(this,r)}function Vi(e,t,n){let r=gi.call(this,e,`r+`);ki.call(this,r,t,n),xi.call(this,r)}function Hi(e,t){let n=typeof t==`string`?t:t?.encoding??`utf8`;e=U(e,!0);let{fullPath:r}=Xr(this,e);if(n==`utf8`||n==`utf-8`)return r;let i=or.Buffer.from(r,`utf-8`);return n==`buffer`?i:i.toString(n)}function Ui(e,t=384){if(X&&!Y(this,di.call(this,e),t))throw new M(k.EACCES)}function Wi(e,t){e=U(e);let n;try{n=fi.bind(this)(e)}catch(e){if(e.code!=`ENOENT`||!t?.force)throw e}if(n)switch(n.mode&Ye){case et:if(t?.recursive)for(let n of Mi.call(this,e))Wi.call(this,W(e,n),t);Ai.call(this,e);break;case Qe:case Ze:case $e:case tt:mi.call(this,e);break;case nt:case Xe:default:throw N(`ENOSYS`,`rm`,e)}}function Gi(e,t){let n=typeof t==`object`?t?.encoding:t||`utf8`,r=rn(e);return ji.call(this,r),n==`buffer`?or.Buffer.from(r):r}function Ki(e,t){let n=rn(e);ji.call(this,n);let r=()=>Wi(n,{recursive:!0,force:!0});return{path:n,remove:r,[Symbol.dispose]:r}}function qi(e,t,n){if(e=U(e),t=U(t),n&&n&1&&ui.call(this,t))throw N(`EEXIST`,`copyFile`,t);vi.call(this,t,_i.call(this,e)),sa(this,`rename`,t.toString())}function Ji(e,t,n){let r=jr(this,e),i=0;for(let e of t)i+=r.readSync(e,0,e.byteLength,n+i);return i}function Yi(e,t,n){let r=jr(this,e),i=0;for(let e of t)i+=r.writeSync(new Uint8Array(e.buffer),0,e.byteLength,n+i);return i}function Xi(e,t){return e=U(e),new oi(e,this)}function Zi(e,t,n){e=U(e),t=U(t);let r=fi.call(this,e);if(n?.errorOnExist&&ui.call(this,t))throw N(`EEXIST`,`cp`,t);switch(r.mode&Ye){case et:if(!n?.recursive)throw N(`EISDIR`,`cp`,e);ji.call(this,t,{recursive:!0});for(let r of Mi.call(this,e,{withFileTypes:!0}))n.filter&&!n.filter(W(e,r.name),W(t,r.name))||Zi.call(this,W(e,r.name),W(t,r.name),n);break;case Ze:if(n?.dereference)qi.call(this,e,t);else{let r=Fi.call(this,e,`utf8`);Pi.call(this,n?.verbatimSymlinks?r:ln.call(this,G(e),r),t)}break;case Qe:qi.call(this,e,t);break;case $e:case tt:case nt:case Xe:default:throw N(`ENOSYS`,`cp`,e)}n?.preserveTimestamps&&Bi.call(this,t,r.atime,r.mtime)}function Qi(e,t){e=U(e);let{fs:n}=Z(e,this);return Wr(n,t?.bigint)}function $i(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(tn),l=[];function u(e){let t=Mi(e,{withFileTypes:r,encoding:`utf8`});for(let n of t){let t=W(e,r?n.name:n);if(typeof i==`function`?i(r?n:t):i.some(e=>_n(e,t)))continue;let a=t.replace(/^\/+/g,``);di(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}const ea=di;var ta=class extends u.default{_context;path;off(e,t,n,r){return super.off(e,t,n,r)}removeListener(e,t,n,r){return super.removeListener(e,t,n,r)}constructor(e,t){super(),this._context=e,this.path=t}setMaxListeners(){throw N(`ENOSYS`,`Watcher.setMaxListeners`)}getMaxListeners(){throw N(`ENOSYS`,`Watcher.getMaxListeners`)}prependListener(){throw N(`ENOSYS`,`Watcher.prependListener`)}prependOnceListener(){throw N(`ENOSYS`,`Watcher.prependOnceListener`)}rawListeners(){throw N(`ENOSYS`,`Watcher.rawListeners`)}ref(){return this}unref(){return this}},na=class extends ta{options;realpath;constructor(e,t,n){let r=Ie(e);super(r,t),this.options=n,this.realpath=W(r.root,t),aa(this.realpath,this)}close(){super.emit(`close`),oa(this.realpath,this)}[Symbol.dispose](){this.close()}},ra=class extends ta{options;intervalId;previous;constructor(e,t,n){super(e,t),this.options=n,this.start()}onInterval(){try{let e=ea.call(this._context,this.path);Sn(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=ea.call(this._context,this.path)}catch(e){this.emit(`error`,e);return}this.intervalId=setInterval(this.onInterval.bind(this),e),!this.options.persistent&&typeof this.intervalId==`object`&&this.intervalId.unref()}stop(){this.intervalId&&=(clearInterval(this.intervalId),void 0),this.removeAllListeners()}};const ia=new Map;function aa(e,t){let n=U(e);ia.has(n)||ia.set(n,new Set),ia.get(n).add(t)}function oa(e,t){let n=U(e);ia.has(n)&&(ia.get(n).delete(t),ia.get(n).size===0&&ia.delete(n))}function sa(e,t,n){let r=Ie(e);r&&(n=W(r.root??`/`,n)),n=U(n);for(let e=n;;e=G(e)){let r=ia.get(e);if(r)for(let i of r)i.emit(`change`,t,fn.call(i._context,e,n)||pn(n));if(e===`/`)break}}var ca=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},la=(function(e){return function(t){function n(n){t.error=t.hasError?new e(n,t.error,`An error was suppressed during disposal.`):n,t.hasError=!0}var r,i=0;function a(){for(;r=t.stack.pop();)try{if(!r.async&&i===1)return i=0,t.stack.push(r),Promise.resolve().then(a);if(r.dispose){var e=r.dispose.call(r.value);if(r.async)return i|=2,Promise.resolve(e).then(a,function(e){return n(e),a()})}else i|=1}catch(e){n(e)}if(i===1)return t.hasError?Promise.reject(t.error):Promise.resolve();if(t.hasError)throw t.error}return a()}})(typeof SuppressedError==`function`?SuppressedError:function(e,t,n){var r=Error(n);return r.name=`SuppressedError`,r.error=e,r.suppressed=t,r});async function ua(e,t,n,r){if(t=ln.call(e,t),n){let n=Z(t,e,r),i=xr(n.fs).get(n.path)?.inode??await n.fs.stat(n.path).catch(()=>void 0);return{...n,fullPath:t,stats:i}}try{let i=Z(t,e),a=xr(i.fs).get(i.path)?.inode??await i.fs.stat(i.path);return Mn(a)?await ua(e,ln.call(e,G(t),await fa.call(e,t)),n,r):{...i,fullPath:t,stats:a}}catch{}let{base:i,dir:a}=gn(t),o=a==`/`?`/`:(await ua(e,a,!1,r)).fullPath,s=W(o,i),c=Z(s,e),l=xr(c.fs).get(c.path)?.inode??await c.fs.stat(c.path).catch(e=>{if(e.code!=`ENOENT`)throw j(Object.assign(e,{syscall:`stat`,path:s,...r}))});return l?Mn(l)?await ua(e,ln.call(e,o,await fa.call(e,s)),!1,r):{...c,fullPath:s,stats:l}:{...c,fullPath:s}}async function da(e,t,n){t=U(t);let r=Xt(n.mode,420),i=Pr(n.flag),a={syscall:`open`,path:t},{fs:o,path:s,stats:c}=await ua(e,t,n.preserveSymlinks,a);if(!c){let l={stack:[],error:void 0,hasError:!1};try{if(!(i&64))throw N(`ENOENT`,a);let u=G(s),d=await o.stat(u);if(X&&!Y(e,d,2))throw N(`EACCES`,`open`,G(t));if(!J(d))throw N(`ENOTDIR`,`open`,G(t));if(!n.allowDirectory&&r&16384)throw N(`EISDIR`,`open`,t);if(ca(l,await Sr(o,u,`rw`,d),!1),c=xr(o).get(s)?.inode??await o.stat(s).catch(()=>void 0),!c){let{euid:n,egid:a}=Ie(e).credentials,c=await o.createFile(s,{mode:r,uid:d.mode&2048?d.uid:n,gid:d.mode&1024?d.gid:a});return sa(e,`rename`,t),new kr(e,t,s,i,xr(o).ref(s,c))}}catch(e){l.error=e,l.hasError=!0}finally{la(l)}}if(X&&!Y(e,c,Ir(i)))throw N(`EACCES`,a);if(i&128)throw N(`EEXIST`,a);if(!n.allowDirectory&&r&16384)throw N(`EISDIR`,`open`,t);let l=new kr(e,t,s,i,xr(o).ref(s,c));return i&512&&await l.truncate(0),l}async function fa(e){e=U(e);let t={syscall:`readlink`,path:e},{fs:n,stats:r,path:i}=await ua(this,e,!0,t);if(!r)throw N(`ENOENT`,t);if(X&&!Y(this,r,4))throw N(`EACCES`,t);if(!Mn(r))throw N(`EINVAL`,t);let a=r.size,o=new Uint8Array(a);return await n.read(i,o,0,a),E(o)}async function pa(e,t={}){let n=U(e),{euid:r,egid:i}=Ie(this).credentials,{mode:a=511,recursive:o}=t,s={syscall:`mkdir`,path:n},{fullPath:c}=await ua(this,G(n),!1,s),{fs:l,path:u}=Z(W(c,pn(n)),this,s),d=c!=G(n),f,p=async(e,t)=>{let n={stack:[],error:void 0,hasError:!1};try{let c=G(t),m=o&&c!=`/`?await p(G(e),c):await l.stat(c);if(ca(n,await Sr(l,c,`rw`,m),!1),o){let n=xr(l).get(t)?.inode??await l.stat(t).catch(()=>null);if(n){let r=Mn(n)?(await ua(this,e,!1,s)).stats:n;if(!r)throw N(`ENOENT`,s);if(!J(r))throw N(t==u?`EEXIST`:`ENOTDIR`,s);return n}if(d&&await l.exists(W(c,pn(e))))throw N(`ENOTDIR`,`mkdir`,e)}if(X&&!Y(this,m,2))throw N(`EACCES`,`mkdir`,e);let h=await l.mkdir(t,{mode:a,uid:m.mode&2048?m.uid:r,gid:m.mode&1024?m.gid:i}).catch(F({syscall:`mkdir`,path:e}));return o&&(f??=e),sa(this,`rename`,e),h}catch(e){n.error=e,n.hasError=!0}finally{la(n)}};return await p(n,u),f}async function ma(e,t={}){e=U(e);let n={syscall:`scandir`,path:e},{fs:r,path:i,stats:a}=await ua(this,e,!1,n);if(!a)throw N(`ENOENT`,n);if(X&&!Y(this,a,4))throw N(`EACCES`,n);if(!J(a))throw N(`ENOTDIR`,n);let o;{let e={stack:[],error:void 0,hasError:!1};try{ca(e,await Sr(r,i,`ro`,a),!1),o=await r.readdir(i)}catch(t){e.error=t,e.hasError=!0}finally{la(e)}}let s=[],c=async e=>{let n=await r.stat(W(i,e)).catch(e=>{if(e.code!=`ENOENT`)throw e});if(!n)return;let a=new dr;if(a.ino=n.ino,a.type=lr(n.mode),a.path=e,a.name=pn(e),s.push(a),!t.recursive||!J(n))return;let o=await r.readdir(W(i,e));for(let t of o)await c(W(e,t))};return await Promise.all(o.map(c)),s}async function ha(e,t){let n={stack:[],error:void 0,hasError:!1};try{e=U(e),t=U(t);let r={syscall:`rename`,path:e,dest:t},i=await ua(this,e,!0,r),a=Z(t,this,r);if(i.fs.uuid!==a.fs.uuid)throw N(`EXDEV`,r);if(a.path.startsWith(i.path+`/`))throw N(`EINVAL`,r);if(!i.stats)throw N(`ENOENT`,r);let o=i.fs,s=await o.stat(G(i.path)),c=await o.stat(G(a.path)),l=await o.stat(a.path).catch(e=>{if(e.code==`ENOENT`)return null;throw e});if(X&&(!Y(this,s,4)||!Y(this,c,2)))throw N(`EACCES`,r);if(l&&!J(i.stats)&&J(l))throw N(`EISDIR`,r);if(l&&J(i.stats)&&!J(l))throw N(`ENOTDIR`,r);let u=G(i.path),d=G(a.path),f=[[u,s],[d,c]];s.ino>c.ino&&f.reverse(),ca(n,await Sr(o,f[0][0],`rw`,f[0][1]),!1),ca(n,s.ino==c.ino?null:await Sr(o,f[1][0],`rw`,f[1][1]),!1),await i.fs.rename(i.path,a.path),xr(o).rename(i.path,a.path),sa(this,`rename`,e),sa(this,`rename`,t)}catch(e){n.error=e,n.hasError=!0}finally{la(n)}}async function ga(e,t){let n={stack:[],error:void 0,hasError:!1};try{e=U(e),t=U(t);let r={syscall:`link`,path:e,dest:t},{fs:i,path:a}=Z(e,this,r),o=Z(t,this,r);if(i.uuid!=o.fs.uuid)throw N(`EXDEV`,r);let s=await i.stat(a);if(X){if(!Y(this,s,4))throw N(`EACCES`,r);let e=await i.stat(G(a));if(!Y(this,e,4))throw N(`EACCES`,r);let t=await i.stat(G(o.path));if(!Y(this,t,2))throw N(`EACCES`,r)}ca(n,await Sr(i,G(o.path),`rw`),!1),await i.link(a,o.path),xr(i).link(a,o.path)}catch(e){n.error=e,n.hasError=!0}finally{la(n)}}async function _a(e,t){e=U.call(this,e);let n={syscall:t?`lstat`:`stat`,path:e},r;if(!t)r=(await ua(this,e,!1,n)).stats;else{let{base:t,dir:i}=gn(e),{fs:a,path:o}=await ua(this,i,!1,n),s=t?W(o,t):o;r=xr(a).get(s)?.inode??await a.stat(s).catch(F(n))}if(!r)throw N(`ENOENT`,n);if(X&&!Y(this,r,4))throw N(`EACCES`,n);return r}var va=class extends u.default{input;output;terminal;line=``;_cursor=0;get cursor(){return this._cursor}_buffer=``;_closed=!1;_paused=!1;_prompt=``;_history=[];_historyIndex=-1;_currentLine=``;constructor(e,t,n,r=!1){super(),this.input=e,this.output=t,this.terminal=r,this.input.on(`data`,this._onData),this.input.on(`end`,this.close.bind(this)),this.input.on(`close`,this.close.bind(this))}_onData=e=>{if(!(this._paused||this._closed)){this._buffer+=typeof e==`string`?e:e.toString(`utf8`);for(let e=this._buffer.indexOf(`
2
2
  `);e>=0;e=this._buffer.indexOf(`
3
3
  `)){let t=this._buffer.substring(0,e);t.endsWith(`\r`)&&(t=t.substring(0,t.length-1)),this._buffer=this._buffer.substring(e+1),this.line=t,t.trim()&&!t.trim().match(/^\s*$/)&&this._history.at(-1)!=t&&(this._history.push(t),this._historyIndex=this._history.length,this.emit(`history`,this._history)),this.emit(`line`,t)}}};close(){if(!this._closed){if(this._closed=!0,this.input?.removeAllListeners?.(),this._buffer.length){let e=this._buffer;this._buffer=``,this.line=e,this.emit(`line`,e)}this.emit(`history`,this._history),this.emit(`close`),this.removeAllListeners()}}pause(){return this._paused?this:(this._paused=!0,`pause`in this.input&&this.input.pause(),this.emit(`pause`),this)}resume(){return this._paused?(this._paused=!1,`resume`in this.input&&this.input.resume(),this.emit(`resume`),this):this}setPrompt(e){this._prompt=e}getPrompt(){return this._prompt}prompt(e){if(!this.output)return;if(!e){this.output.write(this._prompt);return}let{cols:t}=this.getCursorPos();this.output.write(this._prompt),this._cursor=t}write(e,t){if(!this._closed){if(e){let t=typeof e==`string`?e:e.toString(`utf8`);this._onData(t)}if(!(!t||!this.terminal))switch((t.ctrl?`^`:``)+t.name){case`^c`:this.emit(`SIGINT`);break;case`^z`:this.emit(`SIGTSTP`);break;case`^q`:this.emit(`SIGCONT`);break;case`home`:case`^a`:if(!this.output)return;xa(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;xa(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);ba(this.output,1),this.line=e;break}case`^u`:{if(!this.output||!this._cursor)return;let e=this.line.slice(this._cursor);ba(this.output,0),xa(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,xa(this.output,-t.length,0),xa(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`):``)+`