sliccy 3.42.0 → 3.43.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ui/assets/{adobe-bIneadbm.js → adobe-BI2uhnZD.js} +1 -1
- package/dist/ui/assets/adobe-D4iM7Aw8.js +2 -0
- package/dist/ui/assets/{agent-bridge-DXnWPXM_.js → agent-bridge-Dd35hIPg.js} +1 -1
- package/dist/ui/assets/{agent-message-to-chat-C9iFUc2K.js → agent-message-to-chat-CGvMvbsx.js} +1 -1
- package/dist/ui/assets/{apps-CGvz_eSs.js → apps-CoufI6eq.js} +1 -1
- package/dist/ui/assets/{azure-openai-BkhFFq9O.js → azure-openai-BRqLYWJW.js} +1 -1
- package/dist/ui/assets/{azure-openai-DZYNE8jA.js → azure-openai-Bm7ozlSw.js} +1 -1
- package/dist/ui/assets/{bsh-watchdog-E_2OMqEd.js → bsh-watchdog-CpraCmMu.js} +1 -1
- package/dist/ui/assets/{cdp-cl-6LRS-.js → cdp-C3KWUTPR.js} +3 -3
- package/dist/ui/assets/{connect-surface-CcPRZEFU.js → connect-surface-J-fSGdR1.js} +1 -1
- package/dist/ui/assets/cost-command-BgI4Vpod.js +1 -0
- package/dist/ui/assets/{dist-BbjElUYU.js → dist-B9EVsbsZ.js} +1 -1
- package/dist/ui/assets/{dist-DbTbRU9p2.js → dist-C6lFkA1A2.js} +1 -1
- package/dist/ui/assets/{dist-Cu5Yqq5d2.js → dist-CvzfEfDj2.js} +1 -1
- package/dist/ui/assets/{dist-jGdNVYhi.js → dist-_zbq8hcL.js} +2 -2
- package/dist/ui/assets/{es-BtY_DX7h.js → es-T65byM7G.js} +1 -1
- package/dist/ui/assets/{follower-sprinkle-bridge-B8BD5dCJ.js → follower-sprinkle-bridge-fXFMQvbu.js} +1 -1
- package/dist/ui/assets/{fs-Ce5nCWjM.js → fs-CVaO9nmT.js} +1 -1
- package/dist/ui/assets/{github-URfxjCX9.js → github-5Avk8m6S.js} +1 -1
- package/dist/ui/assets/github-aQjNbW79.js +2 -0
- package/dist/ui/assets/{github-copilot-6ssJWycU.js → github-copilot-DQmwWqa0.js} +1 -1
- package/dist/ui/assets/{github-copilot-0iNSBtTR.js → github-copilot-DaqobM8h.js} +1 -1
- package/dist/ui/assets/{kernel-worker-DffnLr7Z.js → kernel-worker-Db4cVMp1.js} +1119 -900
- package/dist/ui/assets/{lick-ws-bridge-i6HVxxXm.js → lick-ws-bridge-ulNyrPpu.js} +1 -1
- package/dist/ui/assets/{local-llm-Bgs5kJ_t.js → local-llm-DwN2IGO6.js} +1 -1
- package/dist/ui/assets/{magick-wasm-B_cGQpkr.js → magick-wasm-BvCVfok4.js} +1 -1
- package/dist/ui/assets/main-NTOoEKjL.js +1813 -0
- package/dist/ui/assets/{main-cherry-D2EeyQiT.js → main-cherry-B6JzfsA7.js} +1 -1
- package/dist/ui/assets/{migration-run-B9tVVu2A.js → migration-run-BgWD9oib.js} +1 -1
- package/dist/ui/assets/{mount-Czuj2WJd.js → mount-yzoftHrR.js} +1 -1
- package/dist/ui/assets/{nuke-command-Cr6JkTOs.js → nuke-command-D9-dbCYJ.js} +1 -1
- package/dist/ui/assets/{oauth-bootstrap-CaXkbIdk.js → oauth-bootstrap-CNdKZr46.js} +2 -2
- package/dist/ui/assets/{oauth-service-5c8VBACb.js → oauth-service-CziAqQV_.js} +1 -1
- package/dist/ui/assets/onboarding-orchestrator-B-FnIFwe.js +1 -0
- package/dist/ui/assets/openai-codex-ARoxTqWI.js +1 -0
- package/dist/ui/assets/{openai-codex-C9IKfdo5.js → openai-codex-B2PPPq0K.js} +1 -1
- package/dist/ui/assets/{panel-rpc-handlers-Dk_VNrC8.js → panel-rpc-handlers-LgGlb81w.js} +1 -1
- package/dist/ui/assets/provider-BZaypnYm.js +2 -0
- package/dist/ui/assets/{provider-D-UqE2HK.js → provider-DqeIN53r.js} +1 -1
- package/dist/ui/assets/{provider-settings-Dv6vKl47.js → provider-settings-CSKMTOfj.js} +2 -2
- package/dist/ui/assets/provider-store-access-BdiDIUwb.js +1 -0
- package/dist/ui/assets/provider-store-access-CFbgFYCq.js +1 -0
- package/dist/ui/assets/{providers-DmlUhX-j.js → providers-DJ6UMUQK.js} +1 -1
- package/dist/ui/assets/{proxied-fetch-_czX6FMK.js → proxied-fetch-D0DbPyX7.js} +1 -1
- package/dist/ui/assets/py-realm-worker-C75JGmXR.js +242 -0
- package/dist/ui/assets/{remote-terminal-view-BUSzLqkw.js → remote-terminal-view-BD8JYN10.js} +3 -3
- package/dist/ui/assets/{store-BoygF8u6.js → store-BG1A0wUL.js} +1 -1
- package/dist/ui/assets/{sudo-DgcUZnhq.js → sudo-DoBsq3Yd.js} +1 -1
- package/dist/ui/assets/{tray-leave-runtime-DX5ZtY_e.js → tray-leave-runtime-DgIZ0HrD.js} +1 -1
- package/dist/ui/assets/{upgrade-detection-BgWGkQ-H.js → upgrade-detection-BCqBtcxT.js} +1 -1
- package/dist/ui/assets/xai-grok-C1pU_6Zh.js +1 -0
- package/dist/ui/assets/{xai-grok-BdT1YNtR.js → xai-grok-CHCF8XFi.js} +1 -1
- package/dist/ui/index.html +1 -1
- package/dist/ui/packages/webapp/index.html +1 -1
- package/package.json +3 -2
- package/dist/ui/assets/adobe-DyYfoGbB.js +0 -2
- package/dist/ui/assets/cost-command-Cg4O5jCH.js +0 -1
- package/dist/ui/assets/github-Q2m9FVfW.js +0 -2
- package/dist/ui/assets/main-CcitfZkp.js +0 -1813
- package/dist/ui/assets/migration-splash-D-cAt2r9.js +0 -1
- package/dist/ui/assets/offscreen-client-DHmb7D-_.js +0 -1
- package/dist/ui/assets/onboarding-orchestrator-D05dB_am.js +0 -1
- package/dist/ui/assets/openai-codex-BfeVvrJz.js +0 -1
- package/dist/ui/assets/page-storage-sync-BMnuL0eG.js +0 -1
- package/dist/ui/assets/provider-DH5jETfR.js +0 -2
- package/dist/ui/assets/provider-store-access-DBImU7-3.js +0 -1
- package/dist/ui/assets/provider-store-access-rIKVrQwg.js +0 -1
- package/dist/ui/assets/py-realm-worker-DvbMqvZQ.js +0 -23
- package/dist/ui/assets/spawn-CPNBUG5S.js +0 -1
- package/dist/ui/assets/xai-grok-CgcNrsh0.js +0 -1
|
@@ -9,4 +9,4 @@ import{i as e,n as t,t as n}from"./chunk-aKtaBQYM.js";function r(e,t){if(e.byteL
|
|
|
9
9
|
`+Error().stack.slice(6);if(!t)throw R(N(`EINVAL`,`Can not make an RPC request without a port`));let{resolve:a,reject:o,promise:s}=Promise.withResolvers(),c=Math.random().toString(16).slice(5),l={resolve:a,reject:o,promise:s,fs:r,timeout:setTimeout(()=>{let e=R(N(`ETIMEDOUT`,`RPC request timed out`));e.stack+=i,cs(c),o(e)},n)};return ls.set(c,l),t.send({...e,_zenfs:!0,id:c,stack:i}),s}function ds(e,...t){return t.includes(e.method)}function fs(e){if(!ss(e))return;if(!ls.has(e.id)){let t=R(N(`EIO`,`Invalid RPC id: `+e.id));throw t.stack+=e.stack,t}let{resolve:t,reject:n}=ls.get(e.id);if(e.error){let t=j.fromJSON({code:`EIO`,errno:O.EIO,...e.error});t.stack+=e.stack,cs(e.id),n(t);return}cs(e.id),t(ds(e,`stat`,`createFile`,`mkdir`)?new J(e.value):e.value)}function ps(e,t){if(!e)throw R(N(`EINVAL`,`Cannot attach to non-existent port`));le(`Attached handler to port: `+t.name),e.addHandler(t)}function ms(e,t){if(!e)throw R(N(`EINVAL`,`Cannot detach from non-existent port`));le(`Detached handler from port: `+t.name),e.removeHandler(t)}function hs(e){let t=[],n=t.push.bind(t);return ps(e,n),async function(r){ms(e,n);for(let n of t)await gs(e,r,`data`in n?n.data:n)}}async function gs(e,t,n){if(!ss(n))return;let r,i,a=[];try{switch(n.method){case`read`:{let[e,i,a,o]=n.args;await t.read(e,i,a,o),r=i;break}case`stat`:case`createFile`:case`mkdir`:{let e=await t[n.method](...n.args),i=e instanceof J?e:new J(e);r=new Uint8Array(i.buffer,i.byteOffset,i.byteLength);break}case`touch`:{let[e,i]=n.args;await t.touch(e,new J(i)),r=void 0;break}default:r=await t[n.method](...n.args)}}catch(e){i=e instanceof j?e.toJSON():d(e,`message`,`stack`)}e.send({_zenfs:!0,...d(n,`id`,`method`,`stack`),error:i,value:r},a)}var _s=[`rename`,`stat`,`touch`,`createFile`,`unlink`,`rmdir`,`mkdir`,`readdir`,`exists`,`link`,`sync`,`read`,`write`];function vs(e){class t extends e{async done(){return this.sync()}queueDone(){return this.sync()}_promise=Promise.resolve();_async(e){this._promise=this._promise.finally(()=>e())}_isInitialized=!1;_skippedCacheUpdates=0;constructor(...e){super(...e),this._patchAsync()}async ready(){if(await super.ready(),!(this._isInitialized||this.attributes.has(`no_async_preload`))){if(await this._promise,this.checkSync(),await this._sync.ready(),this._sync instanceof Gn&&this instanceof Gn){let e=this._sync.transaction(),t=this.transaction(),n=[];for(let r of await t.keys())n.push(t.get(r).then(t=>e.setSync(r,t)));await Promise.all(n),this._isInitialized=!0;return}try{await this.crossCopy(`/`),ue(`Skipped ${this._skippedCacheUpdates} updates to the sync cache during initialization`),this._isInitialized=!0}catch(e){throw this._isInitialized=!1,L(e)}}}checkSync(){if(this.attributes.has(`no_async_preload`))throw N(`ENOTSUP`,`Sync preloading has been disabled for this async file system`);if(!this._sync)throw L(N(`ENOTSUP`,`No sync cache is attached to this async file system`))}renameSync(e,t){this.checkSync(),this._sync.renameSync(e,t),this._async(()=>this.rename(e,t))}statSync(e){return this.checkSync(),this._sync.statSync(e)}touchSync(e,t){this.checkSync(),this._sync.touchSync(e,t),this._async(()=>this.touch(e,t))}createFileSync(e,t){this.checkSync();let n=this._sync.createFileSync(e,t);return this._async(()=>this.createFile(e,t)),n}unlinkSync(e){this.checkSync(),this._sync.unlinkSync(e),this._async(()=>this.unlink(e))}rmdirSync(e){this.checkSync(),this._sync.rmdirSync(e),this._async(()=>this.rmdir(e))}mkdirSync(e,t){this.checkSync();let n=this._sync.mkdirSync(e,t);return this._async(()=>this.mkdir(e,t)),n}readdirSync(e){return this.checkSync(),this._sync.readdirSync(e)}linkSync(e,t){this.checkSync(),this._sync.linkSync(e,t),this._async(()=>this.link(e,t))}async sync(){!this.attributes.has(`no_async_preload`)&&this._sync&&this._sync.syncSync(),await this._promise.catch(()=>{})}syncSync(){this.checkSync(),this._sync.syncSync()}existsSync(e){return this.checkSync(),this._sync.existsSync(e)}readSync(e,t,n,r){this.checkSync(),this._sync.readSync(e,t,n,r)}writeSync(e,t,n){this.checkSync(),this._sync.writeSync(e,t,n),this._async(()=>this.write(e,t,n))}streamWrite(e,t){this.checkSync();let n=this._sync.streamWrite(e,t).getWriter(),r=super.streamWrite(e,t).getWriter();return new WritableStream({async write(e,t){await Promise.all([n.write(e),r.write(e)]).catch(t.error.bind(t))},async close(){await Promise.all([n.close(),r.close()])},async abort(e){await Promise.all([n.abort(e),r.abort(e)])}})}async crossCopy(e){this.checkSync();let t=await this.stat(e);if(!kn(t)){this._sync.createFileSync(e,t);let n=new Uint8Array(t.size);await this.read(e,n,0,t.size),this._sync.writeSync(e,n,0),this._sync.touchSync(e,t);return}e!==`/`&&(this._sync.mkdirSync(e,t),this._sync.touchSync(e,t));let n=[];for(let t of await this.readdir(e))n.push(this.crossCopy(G(e,t)));await Promise.all(n)}_patchAsync(){let e=[`read`,`readdir`,`stat`,`exists`],t=_s.filter(t=>!e.includes(t));for(let e of t){let t=this[e].bind(this);function n(t,r){if(r||(r=Error(),Error.captureStackTrace(r,n)),!r.stack)return!1;let i=r.stack.split(`
|
|
10
10
|
`).slice(t).join(`
|
|
11
11
|
`);return i.includes(`at <computed> [as ${e}]`)||i.includes(`at async <computed> [as ${e}]`)||i.includes(`${e}Sync `)}this[e]=async(...r)=>{let i=await t(...r);if(n(2))return i;if(!this._isInitialized)return this._skippedCacheUpdates++,i;try{this._sync?.[`${e}Sync`]?.(...r)}catch(e){if(n(3,e))return i;throw e.message+=` (Out of sync!)`,R(e)}return i}}ue(`Async: patched ${t.length} methods`)}}return t}var ys=class extends vs(Rn){channel;timeout;port;_sync=Yn.create({label:`tmpfs:port`});constructor(e,t=250){super(1886351988,`portfs`),this.channel=e,this.timeout=t,this.port=rs(e),ps(this.port,fs)}rpc(e,...t){return us({method:e,args:t},{port:this.port,timeout:this.timeout,fs:this})}async ready(){await this.rpc(`ready`),await super.ready()}rename(e,t){return this.rpc(`rename`,e,t)}async stat(e){let t=await this.rpc(`stat`,e);return t instanceof J?t:new J(t)}async touch(e,t){let n=t instanceof J?t:new J(t);await this.rpc(`touch`,e,new Uint8Array(n.buffer,n.byteOffset,n.byteLength))}async sync(){await super.sync(),await this.rpc(`sync`)}async createFile(e,t){t instanceof J&&(t=t.toJSON());let n=await this.rpc(`createFile`,e,t);return n instanceof J?n:new J(n)}unlink(e){return this.rpc(`unlink`,e)}rmdir(e){return this.rpc(`rmdir`,e)}async mkdir(e,t){t instanceof J&&(t=t.toJSON());let n=await this.rpc(`mkdir`,e,t);return n instanceof J?n:new J(n)}readdir(e){return this.rpc(`readdir`,e)}exists(e){return this.rpc(`exists`,e)}link(e,t){return this.rpc(`link`,e,t)}async read(e,t,n,r){t.set(await this.rpc(`read`,e,t,n,r))}write(e,t,n){return this.rpc(`write`,e,t,n)}};function bs(e,t){let n=rs(e);ps(n,e=>gs(n,t,e))}function xs(e,t){let n=rs(e);ms(n,e=>gs(n,t,e))}var Ss={name:`Port`,options:{port:{type:[EventTarget,function(e){return typeof e==`object`&&`on`in e}],required:!0},timeout:{type:`number`,required:!1}},create(e){return new ys(e.port,e.timeout)}};async function Cs(e,t,n=0){let r=rs(e),i=hs(r),a=await bo(t,n);return bs(r,a),await i(a),le(`Resolved remote mount: `+a.toString()),a}var ws=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},Z=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},Ts=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},Es=(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}),Ds=e=>`0x`+e.toString(16).padStart(8,`0`),{format:Os}=new Intl.NumberFormat(`en-US`,{notation:`compact`,maximumFractionDigits:2,unit:`byte`,unitDisplay:`narrow`}),ks=(()=>{var e,t,n,r;let a=[Rt.packed()],o,s=[],c,l=Vt(i),u,d=[],f=[],p,m=[],h=[],g,_=[],v=[],y,b=[],x=[];var S=class extends l{static{c=this}static{let i=typeof Symbol==`function`&&Symbol.metadata?Object.create(l[Symbol.metadata]??null):void 0;u=[(e=U).uint32.bind(e)],p=[(t=U).uint32.bind(t)],g=[(n=U).uint32.bind(n)],y=[(r=U).uint32.bind(r)],ws(this,null,u,{kind:`accessor`,name:`id`,static:!1,private:!1,access:{has:e=>`id`in e,get:e=>e.id,set:(e,t)=>{e.id=t}},metadata:i},d,f),ws(this,null,p,{kind:`accessor`,name:`offset_`,static:!1,private:!1,access:{has:e=>`offset_`in e,get:e=>e.offset_,set:(e,t)=>{e.offset_=t}},metadata:i},m,h),ws(this,null,g,{kind:`accessor`,name:`offset`,static:!1,private:!1,access:{has:e=>`offset`in e,get:e=>e.offset,set:(e,t)=>{e.offset=t}},metadata:i},_,v),ws(this,null,y,{kind:`accessor`,name:`size`,static:!1,private:!1,access:{has:e=>`size`in e,get:e=>e.size,set:(e,t)=>{e.size=t}},metadata:i},b,x),ws(null,o={value:c},a,{kind:`class`,name:c.name,metadata:i},null,s),S=c=o.value,i&&Object.defineProperty(c,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:i})}static name=`MetadataEntry`;#e=Z(this,d,void 0);get id(){return this.#e}set id(e){this.#e=e}#t=(Z(this,f),Z(this,m,void 0));get offset_(){return this.#t}set offset_(e){this.#t=e}#n=(Z(this,h),Z(this,_,void 0));get offset(){return this.#n}set offset(e){this.#n=e}#r=(Z(this,v),Z(this,b,void 0));get size(){return this.#r}set size(e){this.#r=e}toString(){return`<MetadataEntry @ ${Ds(this.byteOffset)}>`}constructor(){super(...arguments),Z(this,x)}static{Z(c,s)}};return c})(),As=255,js=5,Ms=(()=>{var e,t,n,r;let i=[Rt.packed()],a,o=[],s,c=Vt.typed(Int32Array),l,u=[],d=[],f,p=[],m=[],h,g=[],_=[],v,y=[],b=[],x,S=[],C=[];var w=class extends c{static{s=this}static{let T=typeof Symbol==`function`&&Symbol.metadata?Object.create(c[Symbol.metadata]??null):void 0;l=[(e=U).uint32.bind(e)],f=[(t=U).uint64.bind(t)],h=[(n=U).uint32.bind(n)],v=[zt(Ut(ks,As))],x=[(r=U).int32.bind(r)],ws(this,null,l,{kind:`accessor`,name:`checksum`,static:!1,private:!1,access:{has:e=>`checksum`in e,get:e=>e.checksum,set:(e,t)=>{e.checksum=t}},metadata:T},u,d),ws(this,null,f,{kind:`accessor`,name:`timestamp`,static:!1,private:!1,access:{has:e=>`timestamp`in e,get:e=>e.timestamp,set:(e,t)=>{e.timestamp=t}},metadata:T},p,m),ws(this,null,h,{kind:`accessor`,name:`previous_offset`,static:!1,private:!1,access:{has:e=>`previous_offset`in e,get:e=>e.previous_offset,set:(e,t)=>{e.previous_offset=t}},metadata:T},g,_),ws(this,null,v,{kind:`accessor`,name:`items`,static:!1,private:!1,access:{has:e=>`items`in e,get:e=>e.items,set:(e,t)=>{e.items=t}},metadata:T},y,b),ws(this,null,x,{kind:`accessor`,name:`locked`,static:!1,private:!1,access:{has:e=>`locked`in e,get:e=>e.locked,set:(e,t)=>{e.locked=t}},metadata:T},S,C),ws(null,a={value:s},i,{kind:`class`,name:s.name,metadata:T},null,o),w=s=a.value,T&&Object.defineProperty(s,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:T})}static name=`MetadataBlock`;static lockIndex;#e=Z(this,u,void 0);get checksum(){return this.#e}set checksum(e){this.#e=e}#t=(Z(this,d),Z(this,p,BigInt(Date.now())));get timestamp(){return this.#t}set timestamp(e){this.#t=e}#n=(Z(this,m),Z(this,g,void 0));get previous_offset(){return this.#n}set previous_offset(e){this.#n=e}_previous=Z(this,_);get previous(){if(this.previous_offset)return this._previous??=new w(this.buffer,this.previous_offset),this._previous}#r=Z(this,y,void 0);get items(){return this.#r}set items(e){this.#r=e}toString(e=!1){if(!e)return`<MetadataBlock @ ${Ds(this.byteOffset)}>`;let t=[`---- Metadata block at ${Ds(this.byteOffset)} ----`,`Checksum: ${Ds(this.checksum)}`,`Last updated: ${new Date(Number(this.timestamp)).toLocaleString()}`,`Previous block: ${Ds(this.previous_offset)}`,`Entries:`].join(`
|
|
12
|
-
`);for(let e of this.items)e.offset&&(t+=`\n\t${Ds(e.id)}: ${Os(e.size).padStart(5)} at ${Ds(e.offset)}`);return t}#i=(Z(this,b),Z(this,S,void 0));get locked(){return this.#i}set locked(e){this.#i=e}waitUnlocked(e=0){if(e>js)throw L(N(`EBUSY`,`sbfs: exceeded max attempts waiting for metadata block at ${Ds(this.byteOffset)} to be unlocked`));if(Atomics.load(this,w.lockIndex))switch(Atomics.wait(this,w.lockIndex,1)){case`ok`:break;case`not-equal`:return e++,R(`sbfs: waiting for metadata block at ${Ds(this.byteOffset)} to be unlocked (${e}/${js})`),this.waitUnlocked(e);case`timed-out`:throw L(N(`EBUSY`,`sbfs: timed out waiting for metadata block at ${Ds(this.byteOffset)} to be unlocked`))}}lock(){this.waitUnlocked(),Atomics.store(this,w.lockIndex,1);let e=()=>{Atomics.store(this,w.lockIndex,0),Atomics.notify(this,w.lockIndex,1)};return e[Symbol.dispose]=e,e}constructor(){super(...arguments),Z(this,C)}static{Z(s,o)}};return w=s})();Object.assign(Ms,{lockIndex:Mt(Ms,`locked`)/Int32Array.BYTES_PER_ELEMENT});var Ns=1651715706,Ps=2,Fs=(()=>{var e,t,n,r,i,a,o,s,c,l;let u=[Rt.packed()],d,f=[],p,m=Vt.typed(BigUint64Array),h,g=[],_=[],v,y=[],b=[],x,S=[],C=[],w,T=[],ee=[],E,O=[],k=[],A,j=[],M=[],P,te=[],F=[],I,ne=[],re=[],ie,ae=[],oe=[],se,R=[],ce=[],le,de=[],fe=[],pe,me=[],he=[],ge,_e=[],B=[];var ve=class extends m{static{p=this}static{let D=typeof Symbol==`function`&&Symbol.metadata?Object.create(m[Symbol.metadata]??null):void 0;h=[(e=U).uint32.bind(e)],v=[(t=U).uint32.bind(t)],x=[(n=U).uint16.bind(n)],w=[(r=U).uint16.bind(r)],E=[(i=U).uint32.bind(i)],A=[(a=U).uint64.bind(a)],P=[(o=U).uint64.bind(o)],I=[U.uint8(16)],ie=[(s=U).uint32.bind(s)],se=[(c=U).uint32.bind(c)],le=[(l=U).uint32.bind(l)],pe=[U.char(64)],ge=[U.char(132)],ws(this,null,h,{kind:`accessor`,name:`checksum`,static:!1,private:!1,access:{has:e=>`checksum`in e,get:e=>e.checksum,set:(e,t)=>{e.checksum=t}},metadata:D},g,_),ws(this,null,v,{kind:`accessor`,name:`magic`,static:!1,private:!1,access:{has:e=>`magic`in e,get:e=>e.magic,set:(e,t)=>{e.magic=t}},metadata:D},y,b),ws(this,null,x,{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:D},S,C),ws(this,null,w,{kind:`accessor`,name:`inode_format`,static:!1,private:!1,access:{has:e=>`inode_format`in e,get:e=>e.inode_format,set:(e,t)=>{e.inode_format=t}},metadata:D},T,ee),ws(this,null,E,{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:D},O,k),ws(this,null,A,{kind:`accessor`,name:`used_bytes`,static:!1,private:!1,access:{has:e=>`used_bytes`in e,get:e=>e.used_bytes,set:(e,t)=>{e.used_bytes=t}},metadata:D},j,M),ws(this,null,P,{kind:`accessor`,name:`total_bytes`,static:!1,private:!1,access:{has:e=>`total_bytes`in e,get:e=>e.total_bytes,set:(e,t)=>{e.total_bytes=t}},metadata:D},te,F),ws(this,null,I,{kind:`accessor`,name:`uuid`,static:!1,private:!1,access:{has:e=>`uuid`in e,get:e=>e.uuid,set:(e,t)=>{e.uuid=t}},metadata:D},ne,re),ws(this,null,ie,{kind:`accessor`,name:`metadata_block_size`,static:!1,private:!1,access:{has:e=>`metadata_block_size`in e,get:e=>e.metadata_block_size,set:(e,t)=>{e.metadata_block_size=t}},metadata:D},ae,oe),ws(this,null,se,{kind:`accessor`,name:`metadata_offset_`,static:!1,private:!1,access:{has:e=>`metadata_offset_`in e,get:e=>e.metadata_offset_,set:(e,t)=>{e.metadata_offset_=t}},metadata:D},R,ce),ws(this,null,le,{kind:`accessor`,name:`metadata_offset`,static:!1,private:!1,access:{has:e=>`metadata_offset`in e,get:e=>e.metadata_offset,set:(e,t)=>{e.metadata_offset=t}},metadata:D},de,fe),ws(this,null,pe,{kind:`accessor`,name:`label`,static:!1,private:!1,access:{has:e=>`label`in e,get:e=>e.label,set:(e,t)=>{e.label=t}},metadata:D},me,he),ws(this,null,ge,{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:D},_e,B),ws(null,d={value:p},u,{kind:`class`,name:p.name,metadata:D},null,f),ve=p=d.value,D&&Object.defineProperty(p,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:D})}static name=`SuperBlock`;constructor(...e){if(super(...e),Z(this,B),this.magic!=Ns){z(`sbfs: Invalid magic value, assuming this is a fresh super block`);let e=new Ms(this.buffer,H(ve));Object.assign(this,{metadata:e,metadata_offset:e.byteOffset,used_bytes:BigInt(H(ve)+H(Ms)),total_bytes:BigInt(this.buffer.byteLength),magic:Ns,version:1,inode_format:5,metadata_block_size:H(Ms),uuid:D(crypto.randomUUID())}),Ls(this),Ls(e);return}if(this.checksum!==Is(this))throw L(N(`EIO`,`sbfs: checksum mismatch for super block`));if(this.metadata=new Ms(this.buffer,this.metadata_offset),this.metadata.checksum!==Is(this.metadata))throw L(N(`EIO`,`sbfs: checksum mismatch for metadata block (saved ${Ds(this.metadata.checksum)}, computed ${Ds(Is(this.metadata))})`));if(this.inode_format!=5)throw L(N(`EIO`,`sbfs: inode format mismatch`));if(this.metadata_block_size!=H(Ms))throw L(N(`EIO`,`sbfs: metadata block size mismatch`))}#e=Z(this,g,void 0);get checksum(){return this.#e}set checksum(e){this.#e=e}#t=(Z(this,_),Z(this,y,void 0));get magic(){return this.#t}set magic(e){this.#t=e}#n=(Z(this,b),Z(this,S,void 0));get version(){return this.#n}set version(e){this.#n=e}#r=(Z(this,C),Z(this,T,void 0));get inode_format(){return this.#r}set inode_format(e){this.#r=e}#i=(Z(this,ee),Z(this,O,void 0));get flags(){return this.#i}set flags(e){this.#i=e}#a=(Z(this,k),Z(this,j,void 0));get used_bytes(){return this.#a}set used_bytes(e){this.#a=e}#o=(Z(this,M),Z(this,te,void 0));get total_bytes(){return this.#o}set total_bytes(e){this.#o=e}#s=(Z(this,F),Z(this,ne,void 0));get uuid(){return this.#s}set uuid(e){this.#s=e}#c=(Z(this,re),Z(this,ae,void 0));get metadata_block_size(){return this.#c}set metadata_block_size(e){this.#c=e}#l=(Z(this,oe),Z(this,R,void 0));get metadata_offset_(){return this.#l}set metadata_offset_(e){this.#l=e}#u=(Z(this,ce),Z(this,de,void 0));get metadata_offset(){return this.#u}set metadata_offset(e){this.#u=e}metadata=Z(this,fe);#d=Z(this,me,void 0);get label(){return this.#d}set label(e){this.#d=e}#f=(Z(this,he),Z(this,_e,void 0));get _padding(){return this.#f}set _padding(e){this.#f=e}rotateMetadata(){let e=this.used_bytes%BigInt(4);Atomics.add(this,Ps,e);let t=Number(Atomics.add(this,Ps,BigInt(H(Ms)))),n=new Ms(this.buffer,t);return n.previous_offset=this.metadata_offset,this.metadata=n,this.metadata_offset=n.byteOffset,Ls(n),Ls(this),ue(`sbfs: rotated metadata block at ${Ds(n.previous_offset)} with new block at ${Ds(t)}`),n}isUnused(e,t){if(!t)return!0;if(e+t>this.total_bytes||e<H(ve))return!1;for(let n=this.metadata;n;n=n.previous){if(e<n.byteOffset+H(Ms)&&e+t>n.byteOffset)return!1;for(let r of n.items)if(r.offset&&(e>=r.offset&&e<r.offset+r.size||e+t>r.offset&&e+t<=r.offset+r.size||e<=r.offset&&e+t>=r.offset+r.size))return!1}return!0}static{Z(p,f)}};return ve=p})();function Is(e){let t=H(e)-4;return e instanceof Ms&&(t-=Int32Array.BYTES_PER_ELEMENT),s(new Uint8Array(e.buffer,e.byteOffset+4,t))}function Ls(e){e instanceof Ms&&(e.timestamp=BigInt(Date.now())),e.checksum=Is(e)}var Rs=class extends i{flags=[];name=`sbfs`;type=1935828595;get uuid(){return E(this.superblock.uuid)}superblock;_view;_u8;constructor(...e){if(super(...e),this.byteLength<H(Fs)+H(Ms))throw L(N(`EINVAL`,`sbfs: Buffer is too small for a file system`));this._view=new DataView(this.buffer,this.byteOffset,this.byteLength),this._u8=new Uint8Array(this.buffer,this.byteOffset,this.byteLength),this.superblock=new Fs(this.buffer,this.byteOffset)}*keys(){let e=new Set;for(let t=this.superblock.metadata;t;t=t.previous){t.waitUnlocked();for(let n of t.items)!n.offset||e.has(n.id)||(e.add(n.id),yield n.id)}}get(e){for(let t=this.superblock.metadata;t;t=t.previous){t.waitUnlocked();for(let n of t.items){if(!n.offset||n.id!=e)continue;let t=this.byteOffset+n.offset;return new Uint8Array(this.buffer.slice(t,t+n.size))}}}set(e,t){let n={stack:[],error:void 0,hasError:!1};try{if(e===0&&t.length<H(J))throw se(N(`EIO`,`sbfs: tried to set ${t.length} bytes for id 0!`));for(let n=this.superblock.metadata;n;n=n.previous){n.waitUnlocked();for(let r of n.items){let i={stack:[],error:void 0,hasError:!1};try{if(!r.offset||r.id!=e)continue;if(Ts(i,n.lock(),!1),t.length==r.size){this._u8.set(t,r.offset);return}if(t.length<r.size||this.superblock.isUnused(r.offset,t.length)){this._u8.set(t,r.offset),r.size=t.length,Ls(n);return}r.offset=Number(Atomics.add(this.superblock,Ps,BigInt(t.length))),r.size=t.length,this._u8.set(t,r.offset),Ls(n),Ls(this.superblock);return}catch(e){i.error=e,i.hasError=!0}finally{Es(i)}}}let r=Array.from(this.superblock.metadata.items).find(e=>!e.offset);r||=(this.superblock.rotateMetadata(),this.superblock.metadata.items[0]),Ts(n,this.superblock.metadata.lock(),!1);let i=Number(Atomics.add(this.superblock,Ps,BigInt(t.length)));r.id=e,r.offset=i,r.size=t.length,this._u8.set(t,i),Ls(this.superblock.metadata),Ls(this.superblock)}catch(e){n.error=e,n.hasError=!0}finally{Es(n)}}delete(e){for(let t=this.superblock.metadata;t;t=t.previous){t.waitUnlocked();for(let n of t.items)if(n.id==e){n.offset=0,n.size=0,n.id=0,Ls(t);return}}}_fs;get fs(){return this._fs}set fs(e){this.buffer.constructor.name===`SharedArrayBuffer`&&e?.attributes.set(`no_id_tables`,!0),this._fs=e}sync(){return Promise.resolve()}usage(){return{totalSpace:Number(this.superblock.total_bytes),freeSpace:Number(this.superblock.total_bytes-this.superblock.used_bytes)}}transaction(){return new Kn(this)}},zs={name:`SingleBuffer`,options:{buffer:{type:`object`,required:!0}},create(e){let t=new Gn(ArrayBuffer.isView(e.buffer)?new Rs(e.buffer.buffer,e.buffer.byteOffset,e.buffer.byteLength):new Rs(e.buffer));return t.checkRootSync(),t}},Q=()=>{};async function Bs(e){let t=[];for await(let n of e)t.push(n);return t}function Vs(e,t,n=Q){La.call(this,e,t).then(()=>n(null)).catch(n)}function Hs(e,t=Q){Ra.call(this,e).then(t).catch(()=>t(!1))}function Us(e,t,n=Q){n=typeof t==`function`?t:n,za.call(this,e,typeof t==`function`?{}:t).then(e=>n(null,e)).catch(n)}function Ws(e,t,n=Q){n=typeof t==`function`?t:n,Ba.call(this,e,typeof t==`function`?{}:t).then(e=>n(null,e)).catch(n)}function Gs(e,t=0,n=Q){n=typeof t==`function`?t:n;let r=typeof t==`number`?t:0;Va.call(this,e,r).then(()=>n(null)).catch(n)}function Ks(e,t=Q){Ha.call(this,e).then(()=>t(null)).catch(t)}function qs(e,t,n,r=Q){let i=qt(n,420);r=typeof n==`function`?n:r,Ua.call(this,e,t,i).then(e=>r(null,e.fd)).catch(r)}function Js(e,t,n=Q){n=typeof t==`function`?t:n,Wa.call(this,e,typeof t==`function`?null:t).then(e=>n(null,e)).catch(n)}function Ys(e,t,n,r=Q){r=typeof n==`function`?n:r,Ga.call(this,e,t,typeof n==`function`?null:n).then(()=>r(null)).catch(r)}function Xs(e,t,n,r=Q){let i=typeof n==`function`?void 0:n;r=typeof n==`function`?n:r,Ka.call(this,e,t,i).then(()=>r(null)).catch(r)}function Zs(e,t,n=Q){n=typeof t==`function`?t:n,new Ia(this,e).stat().then(e=>n(null,typeof t==`object`&&t?.bigint?new gn(e):e)).catch(n)}function Qs(e,t=Q){new Ia(this,e).close().then(()=>t(null)).catch(t)}function $s(e,t,n=Q){let r=typeof t==`number`?t:0;n=typeof t==`function`?t:n;let i=new Ia(this,e);if(r<0)throw N(`EINVAL`);i.truncate(r).then(()=>n(null)).catch(n)}function ec(e,t=Q){new Ia(this,e).sync().then(()=>t(null)).catch(t)}function tc(e,t=Q){new Ia(this,e).datasync().then(()=>t(null)).catch(t)}function nc(e,t,n,r,i,a=Q){let o,s,c,l,u,d=new Ia(this,e);if(typeof t==`string`){switch(u=`utf8`,typeof n){case`function`:a=n;break;case`number`:l=n,u=typeof r==`string`?r:`utf8`,a=typeof i==`function`?i:a;break;default:a=typeof r==`function`?r:typeof i==`function`?i:a,a(N(`EINVAL`));return}o=sr.Buffer.from(t),s=0,c=o.length;let e=a;d.write(o,s,c,l).then(({bytesWritten:t})=>e(null,t,o.toString(u))).catch(e)}else{o=sr.Buffer.from(t.buffer),s=n,c=r,l=typeof i==`number`?i:null;let e=typeof i==`function`?i:a;d.write(o,s,c,l).then(({bytesWritten:t})=>e(null,t,o)).catch(e)}}function rc(e,t,n,r,i,a=Q){new Ia(this,e).read(t,n,r,i).then(({bytesRead:e,buffer:t})=>a(null,e,t)).catch(a)}function ic(e,t,n,r=Q){new Ia(this,e).chown(t,n).then(()=>r(null)).catch(r)}function ac(e,t,n){new Ia(this,e).chmod(t).then(()=>n(null)).catch(n)}function oc(e,t,n,r=Q){new Ia(this,e).utimes(t,n).then(()=>r(null)).catch(r)}function sc(e,t=Q){qa.call(this,e).then(()=>t(null)).catch(t)}function cc(e,t,n=Q){Ja.call(this,e,t).then(()=>n(null)).catch(n)}function lc(e,t,n=Q){n=typeof t==`function`?t:n;let r=typeof t==`function`?{}:t;Ya.call(this,e,r).then(e=>n(null,e)).catch(n)}function uc(e,t,n=Q){Xa.call(this,e,t).then(()=>n(null)).catch(n)}function dc(e,t,n,r=Q){let i=typeof n==`string`?n:`file`;r=typeof n==`function`?n:r,Za.call(this,e,t,i).then(()=>r(null)).catch(r)}function fc(e,t,n=Q){n=typeof t==`function`?t:n,Qa.call(this,e).then(e=>n(null,e)).catch(n)}function pc(e,t,n,r=Q){$a.call(this,e,t,n).then(()=>r(null)).catch(r)}function mc(e,t,n,r=Q){eo.call(this,e,t,n).then(()=>r(null)).catch(r)}function hc(e,t,n=Q){to.call(this,e,t).then(()=>n(null)).catch(n)}function gc(e,t,n=Q){no.call(this,e,t).then(()=>n(null)).catch(n)}function _c(e,t,n,r=Q){ro.call(this,e,t,n).then(()=>r(null)).catch(r)}function vc(e,t,n,r=Q){io.call(this,e,t,n).then(()=>r(null)).catch(r)}function yc(e,t,n=Q){n=typeof t==`function`?t:n,ao.call(this,e,typeof t==`function`?null:t).then(e=>n(null,e)).catch(n)}function bc(e,t,n=Q){let r=typeof t==`number`?t:4;n=typeof t==`function`?t:n,so.call(this,e,r).then(()=>n(null)).catch(n)}var xc=new Map;function Sc(e,t,n){let r=W(e),i=typeof t==`function`?{}:t;if(typeof t==`function`&&(n=t),!n)throw M(`EINVAL`,`watch`,e.toString());if(xc.has(r)){let e=xc.get(r);e&&e.listeners.add(n);return}let a=new Ri(this,r,i);a.on(`change`,(e,t)=>{let n=xc.get(r);if(n)for(let r of n.listeners)r(e,t)}),xc.set(r,{watcher:a,listeners:new Set})}function Cc(e,t=Q){let n=W(e),r=xc.get(n);r&&(t&&t!==Q?r.listeners.delete(t):r.listeners.clear(),r.listeners.size===0&&(r.watcher.stop(),xc.delete(n)))}function wc(e,t,n){let r=new Li(this,W(e),typeof t==`object`?t:{});return n=typeof t==`function`?t:n,r.on(`change`,n||Q),r}function Tc(e,t){t=typeof t==`object`?t:{encoding:t};let n=Ua.call(this,e,`r`,t?.mode);return new ja({...t,autoClose:!0},n)}function Ec(e,t){t=typeof t==`object`?t:{encoding:t};let n=Ua.call(this,e,`w`,t?.mode);return new Ma(t,n)}function Dc(e,t,n=Q){n=typeof t==`function`?t:n,co.call(this,e,typeof t==`function`?void 0:t).then(()=>n(null)).catch(n)}function Oc(e,t,n=Q){n=typeof t==`function`?t:n,lo.call(this,e,typeof t==`function`?null:t).then(e=>n(null,e)).catch(n)}function kc(e,t,n,r=Q){r=typeof n==`function`?n:r,fo.call(this,e,t,typeof n==`function`?void 0:n).then(()=>r(null)).catch(r)}function Ac(e,t,n,r=Q){r=typeof n==`function`?n:r,new Ia(this,e).readv(t,typeof n==`function`?void 0:n).then(({buffers:e,bytesRead:t})=>r(null,t,e)).catch(r)}function jc(e,t,n,r=Q){r=typeof n==`function`?n:r,new Ia(this,e).writev(t,typeof n==`function`?void 0:n).then(({buffers:e,bytesWritten:t})=>r(null,t,e)).catch(r)}function Mc(e,t,n=Q){n=typeof t==`function`?t:n,po.call(this,e,typeof t==`function`?void 0:t).then(e=>n(null,e)).catch(n)}function Nc(e,t,n,r=Q){r=typeof n==`function`?n:r,mo.call(this,e,t,typeof n==`function`?void 0:n).then(()=>r(null)).catch(r)}function Pc(e,t,n=Q){n=typeof t==`function`?t:n,ho.call(this,e,typeof t==`function`?void 0:t).then(e=>n(null,e)).catch(n)}async function Fc(e,t){let n=await Ua.call(this,e.toString(),`r`),r=await n.readFile();return await n.close(),new Blob([r],t)}function Ic(e,t,n=Q){n=typeof t==`function`?t:n,Bs(go.call(this,e,typeof t==`function`?void 0:t)).then(e=>n(null,e??[])).catch(e=>n(e))}var Lc=t({BigIntStatsFs:()=>yn,Dir:()=>Hr,Dirent:()=>Vr,ReadStream:()=>ja,Stats:()=>hn,StatsFs:()=>vn,WriteStream:()=>Ma,access:()=>bc,accessSync:()=>Ti,appendFile:()=>Xs,appendFileSync:()=>ti,chmod:()=>hc,chmodSync:()=>bi,chown:()=>pc,chownSync:()=>vi,close:()=>Qs,closeSync:()=>ri,constants:()=>Fe,copyFile:()=>kc,copyFileSync:()=>ki,cp:()=>Nc,cpSync:()=>Ni,createReadStream:()=>Tc,createWriteStream:()=>Ec,exists:()=>Hs,existsSync:()=>Kr,fchmod:()=>ac,fchmodSync:()=>ui,fchown:()=>ic,fchownSync:()=>li,fdatasync:()=>tc,fdatasyncSync:()=>oi,fstat:()=>Zs,fstatSync:()=>ni,fsync:()=>ec,fsyncSync:()=>ai,ftruncate:()=>$s,ftruncateSync:()=>ii,futimes:()=>oc,futimesSync:()=>di,glob:()=>Ic,globSync:()=>Fi,lchmod:()=>gc,lchmodSync:()=>xi,lchown:()=>mc,lchownSync:()=>yi,link:()=>uc,linkSync:()=>hi,lopenSync:()=>Qr,lstat:()=>Ws,lstatSync:()=>Jr,lutimes:()=>vc,lutimesSync:()=>Ci,mkdir:()=>cc,mkdirSync:()=>pi,mkdtemp:()=>Oc,mkdtempDisposableSync:()=>Oi,mkdtempSync:()=>Di,open:()=>qs,openAsBlob:()=>Fc,openSync:()=>Zr,opendir:()=>Mc,opendirSync:()=>Mi,promises:()=>Na,read:()=>rc,readFile:()=>Js,readFileSync:()=>$r,readSync:()=>ci,readdir:()=>lc,readdirSync:()=>mi,readlink:()=>fc,readlinkSync:()=>_i,readv:()=>Ac,readvSync:()=>Ai,realpath:()=>yc,realpathSync:()=>wi,rename:()=>Vs,renameSync:()=>Gr,rm:()=>Dc,rmSync:()=>Ei,rmdir:()=>sc,rmdirSync:()=>fi,stat:()=>Us,statSync:()=>qr,statfs:()=>Pc,statfsSync:()=>Pi,symlink:()=>dc,symlinkSync:()=>gi,truncate:()=>Gs,truncateSync:()=>Yr,unlink:()=>Ks,unlinkSync:()=>Xr,unwatchFile:()=>Cc,utimes:()=>_c,utimesSync:()=>Si,watch:()=>wc,watchFile:()=>Sc,write:()=>nc,writeFile:()=>Ys,writeFileSync:()=>ei,writeSync:()=>si,writev:()=>jc,writevSync:()=>ji}),Rc=t({get:()=>Vc,getSync:()=>Hc,list:()=>qc,listSync:()=>Jc,remove:()=>Gc,removeSync:()=>Kc,set:()=>Uc,setSync:()=>Wc}),zc=[];function Bc(e,t,n,r){if(!t.startsWith(`user.`)&&!zc.includes(t))throw M(`ENOTSUP`,r,n)}async function Vc(e,t,n={}){e=W(e);let{fs:r,path:i}=Or(e,this);Bc(this,t,e,`xattr.get`);let a=await r.stat(i).catch(P(`xattr.get`,e));if(X&&!Y(this,a,4))throw M(`EACCES`,`xattr.get`,e);a.attributes??=new Cn;let o=a.attributes.get(t);if(!o)throw M(`ENODATA`,`xattr.get`,e);let s=sr.Buffer.from(o);return n.encoding==`buffer`||!n.encoding?s:s.toString(n.encoding)}function Hc(e,t,n={}){e=W(e),Bc(this,t,e,`xattr.get`);let{fs:r,path:i}=Or(e,this),a;try{a=r.statSync(i)}catch(t){throw A(Object.assign(t,{path:e}))}if(X&&!Y(this,a,4))throw M(`EACCES`,`xattr.get`,e);a.attributes??=new Cn;let o=a.attributes.get(t);if(!o)throw M(`ENODATA`,`xattr.get`,e);let s=sr.Buffer.from(o);return n.encoding==`buffer`||!n.encoding?s:s.toString(n.encoding)}async function Uc(e,t,n,r={}){e=W(e);let{fs:i,path:a}=Or(e,this);Bc(this,t,e,`xattr.set`);let o=await i.stat(a).catch(P(`xattr.set`,e));if(X&&!Y(this,o,2))throw M(`EACCES`,`xattr.set`,e);o.attributes??=new Cn;let s=o.attributes.get(t);if(r.create&&s)throw M(`EEXIST`,`xattr.set`,e);if(r.replace&&!s)throw M(`ENODATA`,`xattr.set`,e);o.attributes.set(t,sr.Buffer.from(n)),await i.touch(a,o).catch(P(`xattr.set`,e))}function Wc(e,t,n,r={}){e=W(e);let{fs:i,path:a}=Or(e,this);Bc(this,t,e,`xattr.set`);let o;try{o=i.statSync(a)}catch(t){throw A(Object.assign(t,{path:e}))}if(X&&!Y(this,o,2))throw M(`EACCES`,`xattr.set`,e);o.attributes??=new Cn;let s=o.attributes.get(t);if(r.create&&s)throw M(`EEXIST`,`xattr.set`,e);if(r.replace&&!s)throw M(`ENODATA`,`xattr.set`,e);o.attributes.set(t,sr.Buffer.from(n));try{i.touchSync(a,o)}catch(t){throw A(Object.assign(t,{path:e}))}}async function Gc(e,t){e=W(e);let{fs:n,path:r}=Or(e,this);Bc(this,t,e,`xattr.remove`);let i=await n.stat(r).catch(P(`xattr.remove`,e));if(X&&!Y(this,i,2))throw M(`EACCES`,`xattr.remove`,e);if(i.attributes??=new Cn,!i.attributes.get(t))throw M(`ENODATA`,`xattr.remove`,e);i.attributes.remove(t),await n.touch(r,i)}function Kc(e,t){e=W(e);let{fs:n,path:r}=Or(e,this);Bc(this,t,e,`xattr.remove`);let i;try{i=n.statSync(r)}catch(t){throw A(Object.assign(t,{path:e}))}if(X&&!Y(this,i,2))throw M(`EACCES`,`xattr.remove`,e);if(i.attributes??=new Cn,!i.attributes.get(t))throw M(`ENODATA`,`xattr.remove`,e);i.attributes.remove(t);try{n.touchSync(r,i)}catch(t){throw A(Object.assign(t,{path:e}))}}async function qc(e){e=W(e);let{fs:t,path:n}=Or(e,this),r=await t.stat(n).catch(P(`xattr.list`,e));return r.attributes?r.attributes.keys().toArray():[]}function Jc(e){e=W(e);let{fs:t,path:n}=Or(e,this),r;try{r=t.statSync(n)}catch(t){throw A(Object.assign(t,{path:e}))}return r.attributes?r.attributes.keys().toArray():[]}var Yc=new Map;function Xc(e={}){let t=Me(this);if(!qr.call(this,t.root).isDirectory())throw M(`ENOTDIR`,{syscall:`chroot`,path:t.root});let n=Pe(t,e),r=Object.assign(n,{fs:{...h(Lc,n),promises:h(Na,n),xattr:h(Rc,n)},path:h($t,n),bind:e=>{let t=Xc.call(n,e);return n.children.push(t),t}});return Yc.set(n.id,r),r}var $=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},Zc=(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}),Qc=class{previous;current=Promise.withResolvers();_isLocked=!0;get isLocked(){return this._isLocked}constructor(e){this.previous=e}async done(){await this.previous?.done(),await this.current.promise}unlock(){this.current.resolve(),this._isLocked=!1}[Symbol.dispose](){this.unlock()}},$c=class{_fs;get type(){return this._fs.type}get name(){return this._fs.name}get label(){return this._fs.label}set label(e){this._fs.label=e}get attributes(){return this._fs.attributes}get _uuid(){return this._fs._uuid}set _uuid(e){this._fs._uuid=e}get uuid(){return this._fs.uuid}async ready(){return await this._fs.ready()}readySync(){return this._fs.readySync()}usage(){return this._fs.usage()}currentLock;addLock(){let e=new Qc(this.currentLock);return this.currentLock=e,e}async lock(e=5e3){let t=this.currentLock,n=this.addLock(),r=Error().stack;return setTimeout(()=>{if(n.isLocked){let e=N(`EDEADLK`);throw e.stack+=r?.slice(5),R(e)}},e),await t?.done(),n}lockSync(){if(this.currentLock?.isLocked)throw R(N(`EBUSY`));return this.addLock()}get isLocked(){return!!this.currentLock?.isLocked}async rename(e,t){let n={stack:[],error:void 0,hasError:!1};try{$(n,await this.lock(),!1),await this._fs.rename(e,t)}catch(e){n.error=e,n.hasError=!0}finally{Zc(n)}}renameSync(e,t){let n={stack:[],error:void 0,hasError:!1};try{return $(n,this.lockSync(),!1),this._fs.renameSync(e,t)}catch(e){n.error=e,n.hasError=!0}finally{Zc(n)}}async stat(e){let t={stack:[],error:void 0,hasError:!1};try{return $(t,await this.lock(),!1),await this._fs.stat(e)}catch(e){t.error=e,t.hasError=!0}finally{Zc(t)}}statSync(e){let t={stack:[],error:void 0,hasError:!1};try{return $(t,this.lockSync(),!1),this._fs.statSync(e)}catch(e){t.error=e,t.hasError=!0}finally{Zc(t)}}async touch(e,t){let n={stack:[],error:void 0,hasError:!1};try{$(n,await this.lock(),!1),await this._fs.touch(e,t)}catch(e){n.error=e,n.hasError=!0}finally{Zc(n)}}touchSync(e,t){let n={stack:[],error:void 0,hasError:!1};try{$(n,this.lockSync(),!1),this._fs.touchSync(e,t)}catch(e){n.error=e,n.hasError=!0}finally{Zc(n)}}async createFile(e,t){let n={stack:[],error:void 0,hasError:!1};try{return $(n,await this.lock(),!1),await this._fs.createFile(e,t)}catch(e){n.error=e,n.hasError=!0}finally{Zc(n)}}createFileSync(e,t){let n={stack:[],error:void 0,hasError:!1};try{return $(n,this.lockSync(),!1),this._fs.createFileSync(e,t)}catch(e){n.error=e,n.hasError=!0}finally{Zc(n)}}async unlink(e){let t={stack:[],error:void 0,hasError:!1};try{$(t,await this.lock(),!1),await this._fs.unlink(e)}catch(e){t.error=e,t.hasError=!0}finally{Zc(t)}}unlinkSync(e){let t={stack:[],error:void 0,hasError:!1};try{return $(t,this.lockSync(),!1),this._fs.unlinkSync(e)}catch(e){t.error=e,t.hasError=!0}finally{Zc(t)}}async rmdir(e){let t={stack:[],error:void 0,hasError:!1};try{$(t,await this.lock(),!1),await this._fs.rmdir(e)}catch(e){t.error=e,t.hasError=!0}finally{Zc(t)}}rmdirSync(e){let t={stack:[],error:void 0,hasError:!1};try{return $(t,this.lockSync(),!1),this._fs.rmdirSync(e)}catch(e){t.error=e,t.hasError=!0}finally{Zc(t)}}async mkdir(e,t){let n={stack:[],error:void 0,hasError:!1};try{return $(n,await this.lock(),!1),await this._fs.mkdir(e,t)}catch(e){n.error=e,n.hasError=!0}finally{Zc(n)}}mkdirSync(e,t){let n={stack:[],error:void 0,hasError:!1};try{return $(n,this.lockSync(),!1),this._fs.mkdirSync(e,t)}catch(e){n.error=e,n.hasError=!0}finally{Zc(n)}}async readdir(e){let t={stack:[],error:void 0,hasError:!1};try{return $(t,await this.lock(),!1),await this._fs.readdir(e)}catch(e){t.error=e,t.hasError=!0}finally{Zc(t)}}readdirSync(e){let t={stack:[],error:void 0,hasError:!1};try{return $(t,this.lockSync(),!1),this._fs.readdirSync(e)}catch(e){t.error=e,t.hasError=!0}finally{Zc(t)}}async exists(e){let t={stack:[],error:void 0,hasError:!1};try{return $(t,await this.lock(),!1),await this._fs.exists(e)}catch(e){t.error=e,t.hasError=!0}finally{Zc(t)}}existsSync(e){let t={stack:[],error:void 0,hasError:!1};try{return $(t,this.lockSync(),!1),this._fs.existsSync(e)}catch(e){t.error=e,t.hasError=!0}finally{Zc(t)}}async link(e,t){let n={stack:[],error:void 0,hasError:!1};try{$(n,await this.lock(),!1),await this._fs.link(e,t)}catch(e){n.error=e,n.hasError=!0}finally{Zc(n)}}linkSync(e,t){let n={stack:[],error:void 0,hasError:!1};try{return $(n,this.lockSync(),!1),this._fs.linkSync(e,t)}catch(e){n.error=e,n.hasError=!0}finally{Zc(n)}}async sync(){let e={stack:[],error:void 0,hasError:!1};try{$(e,await this.lock(),!1),await this._fs.sync()}catch(t){e.error=t,e.hasError=!0}finally{Zc(e)}}syncSync(){let e={stack:[],error:void 0,hasError:!1};try{return $(e,this.lockSync(),!1),this._fs.syncSync()}catch(t){e.error=t,e.hasError=!0}finally{Zc(e)}}async read(e,t,n,r){let i={stack:[],error:void 0,hasError:!1};try{return $(i,await this.lock(),!1),await this._fs.read(e,t,n,r)}catch(e){i.error=e,i.hasError=!0}finally{Zc(i)}}readSync(e,t,n,r){let i={stack:[],error:void 0,hasError:!1};try{return $(i,this.lockSync(),!1),this._fs.readSync(e,t,n,r)}catch(e){i.error=e,i.hasError=!0}finally{Zc(i)}}async write(e,t,n){let r={stack:[],error:void 0,hasError:!1};try{return $(r,await this.lock(),!1),await this._fs.write(e,t,n)}catch(e){r.error=e,r.hasError=!0}finally{Zc(r)}}writeSync(e,t,n){let r={stack:[],error:void 0,hasError:!1};try{return $(r,this.lockSync(),!1),this._fs.writeSync(e,t,n)}catch(e){r.error=e,r.hasError=!0}finally{Zc(r)}}streamRead(e,t){let n={stack:[],error:void 0,hasError:!1};try{return $(n,this.lockSync(),!1),this._fs.streamRead(e,t)}catch(e){n.error=e,n.hasError=!0}finally{Zc(n)}}streamWrite(e,t){let n={stack:[],error:void 0,hasError:!1};try{return $(n,this.lockSync(),!1),this._fs.streamWrite(e,t)}catch(e){n.error=e,n.hasError=!0}finally{Zc(n)}}};function el(e){class t extends $c{constructor(...t){super(),this._fs=new e(...t)}}return t}function tl(e){class t extends e{constructor(...e){super(...e),this.attributes.set(`no_write`)}async rename(){throw N(`EROFS`)}renameSync(){throw N(`EROFS`)}async createFile(){throw N(`EROFS`)}createFileSync(){throw N(`EROFS`)}async unlink(){throw N(`EROFS`)}unlinkSync(){throw N(`EROFS`)}async rmdir(){throw N(`EROFS`)}rmdirSync(){throw N(`EROFS`)}async mkdir(){throw N(`EROFS`)}mkdirSync(){throw N(`EROFS`)}async link(){throw N(`EROFS`)}linkSync(){throw N(`EROFS`)}async touch(){throw N(`EROFS`)}touchSync(){throw N(`EROFS`)}async sync(){throw N(`EROFS`)}syncSync(){throw N(`EROFS`)}async write(){throw N(`EROFS`)}writeSync(){throw N(`EROFS`)}streamWrite(){throw N(`EROFS`)}}return t}function nl(e){class t extends e{async exists(e){return this.existsSync(e)}async rename(e,t){return this.renameSync(e,t)}async stat(e){return this.statSync(e)}async touch(e,t){return this.touchSync(e,t)}async createFile(e,t){return this.createFileSync(e,t)}async unlink(e){return this.unlinkSync(e)}async rmdir(e){return this.rmdirSync(e)}async mkdir(e,t){return this.mkdirSync(e,t)}async readdir(e){return this.readdirSync(e)}async link(e,t){return this.linkSync(e,t)}async sync(){return this.syncSync()}async read(e,t,n,r){return this.readSync(e,t,n,r)}async write(e,t,n){return this.writeSync(e,t,n)}}return t}var rl=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},il=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},al;(function(e){e[e.RealTime=1]=`RealTime`,e[e.PreAlloc=2]=`PreAlloc`,e[e.Immutable=8]=`Immutable`,e[e.Append=16]=`Append`,e[e.Sync=32]=`Sync`,e[e.NoAtime=64]=`NoAtime`,e[e.NoDump=128]=`NoDump`,e[e.RtInherit=256]=`RtInherit`,e[e.ProjInherit=512]=`ProjInherit`,e[e.NoSymlinks=1024]=`NoSymlinks`,e[e.ExtSize=2048]=`ExtSize`,e[e.ExtSzInherit=4096]=`ExtSzInherit`,e[e.NoDefrag=8192]=`NoDefrag`,e[e.FileStream=16384]=`FileStream`,e[e.Dax=32768]=`Dax`,e[e.CowExtSize=65536]=`CowExtSize`,e[e.HasAttr=2147483648]=`HasAttr`})(al||={});var ol=(()=>{var e,t,n,r,a;let o=[Rt()],s,c=[],l,u=Vt(i),d,f=[],p=[],m,h=[],g=[],v,y=[],b=[],x,S=[],C=[],w,T=[],ee=[],E,D=[],k=[];var A=class extends u{static{l=this}static{let i=typeof Symbol==`function`&&Symbol.metadata?Object.create(u[Symbol.metadata]??null):void 0;d=[(e=U).uint32.bind(e)],m=[(t=U).uint32.bind(t)],v=[(n=U).uint32.bind(n)],x=[(r=U).uint32.bind(r)],w=[(a=U).uint32.bind(a)],E=[U.char(8)],rl(this,null,d,{kind:`accessor`,name:`xflags`,static:!1,private:!1,access:{has:e=>`xflags`in e,get:e=>e.xflags,set:(e,t)=>{e.xflags=t}},metadata:i},f,p),rl(this,null,m,{kind:`accessor`,name:`extsize`,static:!1,private:!1,access:{has:e=>`extsize`in e,get:e=>e.extsize,set:(e,t)=>{e.extsize=t}},metadata:i},h,g),rl(this,null,v,{kind:`accessor`,name:`nextents`,static:!1,private:!1,access:{has:e=>`nextents`in e,get:e=>e.nextents,set:(e,t)=>{e.nextents=t}},metadata:i},y,b),rl(this,null,x,{kind:`accessor`,name:`projid`,static:!1,private:!1,access:{has:e=>`projid`in e,get:e=>e.projid,set:(e,t)=>{e.projid=t}},metadata:i},S,C),rl(this,null,w,{kind:`accessor`,name:`cowextsize`,static:!1,private:!1,access:{has:e=>`cowextsize`in e,get:e=>e.cowextsize,set:(e,t)=>{e.cowextsize=t}},metadata:i},T,ee),rl(this,null,E,{kind:`accessor`,name:`pad`,static:!1,private:!1,access:{has:e=>`pad`in e,get:e=>e.pad,set:(e,t)=>{e.pad=t}},metadata:i},D,k),rl(null,s={value:l},o,{kind:`class`,name:l.name,metadata:i},null,c),A=l=s.value,i&&Object.defineProperty(l,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:i})}static name=`fsxattr`;#e=il(this,f,void 0);get xflags(){return this.#e}set xflags(e){this.#e=e}#t=(il(this,p),il(this,h,void 0));get extsize(){return this.#t}set extsize(e){this.#t=e}#n=(il(this,g),il(this,y,void 0));get nextents(){return this.#n}set nextents(e){this.#n=e}#r=(il(this,b),il(this,S,void 0));get projid(){return this.#r}set projid(e){this.#r=e}#i=(il(this,C),il(this,T,void 0));get cowextsize(){return this.#i}set cowextsize(e){this.#i=e}#a=(il(this,ee),il(this,D,[]));get pad(){return this.#a}set pad(e){this.#a=e}constructor(e=_(new j(O.EINVAL,`fsxattr must be initialized with an inode`))){super(new ArrayBuffer(H(A))),il(this,k),this.extsize=e.size,this.nextents=1,this.projid=e.uid,this.cowextsize=e.size;for(let t of Object.keys(Tn))e.flags&Tn[t]&&t in al&&(this.xflags|=al[t])}static{il(l,c)}};return A=l})(),sl;(function(e){e[e.SecureRm=1]=`SecureRm`,e[e.Undelete=2]=`Undelete`,e[e.Compress=4]=`Compress`,e[e.Sync=8]=`Sync`,e[e.Immutable=16]=`Immutable`,e[e.Append=32]=`Append`,e[e.NoDump=64]=`NoDump`,e[e.NoAtime=128]=`NoAtime`,e[e.Dirty=256]=`Dirty`,e[e.CompressBlk=512]=`CompressBlk`,e[e.NoCompress=1024]=`NoCompress`,e[e.Encrypt=2048]=`Encrypt`,e[e.Btree=4096]=`Btree`,e[e.Index=4096]=`Index`,e[e.IMagic=8192]=`IMagic`,e[e.JournalData=16384]=`JournalData`,e[e.NoTail=32768]=`NoTail`,e[e.DirSync=65536]=`DirSync`,e[e.TopDir=131072]=`TopDir`,e[e.HugeFile=262144]=`HugeFile`,e[e.Extent=524288]=`Extent`,e[e.Verity=1048576]=`Verity`,e[e.EaInode=2097152]=`EaInode`,e[e.EofBlocks=4194304]=`EofBlocks`,e[e.NoCow=8388608]=`NoCow`,e[e.Dax=33554432]=`Dax`,e[e.InlineData=268435456]=`InlineData`,e[e.ProjInherit=536870912]=`ProjInherit`,e[e.CaseFold=1073741824]=`CaseFold`,e[e.Reserved=2147483648]=`Reserved`})(sl||={});var cl;(function(e){e[e.GetFlags=2148034049]=`GetFlags`,e[e.SetFlags=1074292226]=`SetFlags`,e[e.GetVersion=2148038145]=`GetVersion`,e[e.SetVersion=1074296322]=`SetVersion`,e[e.Fiemap=3223348747]=`Fiemap`,e[e.GetXattr=2149341215]=`GetXattr`,e[e.SetXattr=1075599392]=`SetXattr`,e[e.GetLabel=2164298801]=`GetLabel`,e[e.SetLabel=1090556978]=`SetLabel`,e[e.GetUUID=2148603136]=`GetUUID`,e[e.GetSysfsPath=2155943169]=`GetSysfsPath`})(cl||={});var ll;(function(e){e[e.GetFlags=2147771905]=`GetFlags`,e[e.SetFlags=1074030082]=`SetFlags`,e[e.GetVersion=2147776001]=`GetVersion`,e[e.SetVersion=1074034178]=`SetVersion`})(ll||={});async function ul(e,t,...n){e=W(e);let{fs:r,path:i}=Or(e,this);try{let e=new J(await r.stat(i));switch(t){case cl.GetFlags:case ll.GetFlags:return e.flags;case cl.SetFlags:case ll.SetFlags:e.flags=n[0],await r.touch(i,e);return;case cl.GetVersion:case ll.GetVersion:return e.version;case cl.SetVersion:case ll.SetVersion:e.version=n[0],await r.touch(i,e);return;case cl.Fiemap:break;case cl.GetXattr:return new ol(e);case cl.SetXattr:break;case cl.GetLabel:return r.label;case cl.SetLabel:r.label=n[0];return;case cl.GetUUID:return r.uuid;case cl.GetSysfsPath:return`/sys/fs/${r.name}/${r.uuid}`}}catch(t){throw A(Object.assign(t,{syscall:`ioctl`,path:e}))}throw M(`ENOTSUP`,`ioctl`,e)}function dl(e,t,...n){e=W(e);let{fs:r,path:i}=Or(e,this);try{let e=new J(r.statSync(i));switch(t){case cl.GetFlags:case ll.GetFlags:return e.flags;case cl.SetFlags:case ll.SetFlags:e.flags=n[0],r.touchSync(i,e);return;case cl.GetVersion:case ll.GetVersion:return e.version;case cl.SetVersion:case ll.SetVersion:e.version=n[0],r.touchSync(i,e);return;case cl.Fiemap:break;case cl.GetXattr:return new ol(e);case cl.SetXattr:break;case cl.GetLabel:return r.label;case cl.SetLabel:r.label=n[0];return;case cl.GetUUID:return r.uuid;case cl.GetSysfsPath:return`/sys/fs/${r.name}/${r.uuid}`}}catch(t){throw A(Object.assign(t,{syscall:`ioctl`,path:e}))}throw M(`ENOTSUP`,`ioctl`,e)}var fl=t({BigIntStatsFs:()=>yn,Dir:()=>Hr,Dirent:()=>Vr,IOC:()=>cl,IOC32:()=>ll,ReadStream:()=>ja,Stats:()=>hn,StatsFs:()=>vn,WriteStream:()=>Ma,access:()=>bc,accessSync:()=>Ti,appendFile:()=>Xs,appendFileSync:()=>ti,chmod:()=>hc,chmodSync:()=>bi,chown:()=>pc,chownSync:()=>vi,chroot:()=>Ar,close:()=>Qs,closeSync:()=>ri,constants:()=>Fe,copyFile:()=>kc,copyFileSync:()=>ki,cp:()=>Nc,cpSync:()=>Ni,createReadStream:()=>Tc,createWriteStream:()=>Ec,exists:()=>Hs,existsSync:()=>Kr,fchmod:()=>ac,fchmodSync:()=>ui,fchown:()=>ic,fchownSync:()=>li,fdatasync:()=>tc,fdatasyncSync:()=>oi,fstat:()=>Zs,fstatSync:()=>ni,fsync:()=>ec,fsyncSync:()=>ai,ftruncate:()=>$s,ftruncateSync:()=>ii,futimes:()=>oc,futimesSync:()=>di,glob:()=>Ic,globSync:()=>Fi,ioctl:()=>ul,ioctlSync:()=>dl,lchmod:()=>gc,lchmodSync:()=>xi,lchown:()=>mc,lchownSync:()=>yi,link:()=>uc,linkSync:()=>hi,lopenSync:()=>Qr,lstat:()=>Ws,lstatSync:()=>Jr,lutimes:()=>vc,lutimesSync:()=>Ci,mkdir:()=>cc,mkdirSync:()=>pi,mkdtemp:()=>Oc,mkdtempDisposableSync:()=>Oi,mkdtempSync:()=>Di,mount:()=>Er,open:()=>qs,openAsBlob:()=>Fc,openSync:()=>Zr,opendir:()=>Mc,opendirSync:()=>Mi,promises:()=>Na,read:()=>rc,readFile:()=>Js,readFileSync:()=>$r,readSync:()=>ci,readdir:()=>lc,readdirSync:()=>mi,readlink:()=>fc,readlinkSync:()=>_i,readv:()=>Ac,readvSync:()=>Ai,realpath:()=>yc,realpathSync:()=>wi,rename:()=>Vs,renameSync:()=>Gr,rm:()=>Dc,rmSync:()=>Ei,rmdir:()=>sc,rmdirSync:()=>fi,stat:()=>Us,statSync:()=>qr,statfs:()=>Pc,statfsSync:()=>Pi,symlink:()=>dc,symlinkSync:()=>gi,truncate:()=>Gs,truncateSync:()=>Yr,umount:()=>Dr,unlink:()=>Ks,unlinkSync:()=>Xr,unwatchFile:()=>Cc,utimes:()=>_c,utimesSync:()=>Si,watch:()=>wc,watchFile:()=>Sc,write:()=>nc,writeFile:()=>Ys,writeFileSync:()=>ei,writeSync:()=>si,writev:()=>jc,writevSync:()=>ji,xattr:()=>Rc}),pl=t({DirType:()=>lr,Dirent:()=>fr,Handle:()=>pr,IOC:()=>cl,IOC32:()=>ll,chroot:()=>Ar,deleteFD:()=>gr,dtToIf:()=>dr,fromFD:()=>hr,ifToDt:()=>ur,ioctl:()=>ul,ioctlSync:()=>dl,link:()=>Yi,mkdir:()=>Ki,mount:()=>Er,open:()=>Wi,readdir:()=>qi,readlink:()=>Gi,rename:()=>Ji,resolve:()=>Ui,stat:()=>Xi,sync:()=>Mr,toFD:()=>mr,umount:()=>Dr,xattr:()=>Rc}),ml={name:`@zenfs/core`,version:`2.5.6`,description:`A filesystem, anywhere`,funding:{type:`individual`,url:`https://github.com/sponsors/james-pre`},main:`dist/index.js`,types:`dist/index.d.ts`,keywords:[`filesystem`,`node`,`storage`],bin:{"make-index":`scripts/make-index.js`,"zenfs-test":`scripts/test.js`,zci:`scripts/ci-cli.js`},files:[`dist`,`tests`,`types`,`license.md`,`eslint.shared.js`],type:`module`,homepage:`https://zenfs.dev/core`,author:`James Prevett <jp@jamespre.dev> (https://jamespre.dev)`,contributors:[`John Vilk <jvilk@cs.umass.edu>`],license:`LGPL-3.0-or-later`,repository:{type:`git`,url:`git+https://github.com/zen-fs/core.git`},bugs:{url:`https://github.com/zen-fs/core/issues`},engines:{node:`>= 18`},exports:{".":`./dist/index.js`,"./*":`./dist/*`,"./emulation/*":`./dist/node/*`,"./promises":`./dist/node/promises.js`,"./readline":`./dist/node/readline.js`,"./constants":`./dist/constants.js`,"./path":`./dist/path.js`,"./eslint":`./eslint.shared.js`,"./tests/*":`./tests/*`,"./types/*":`./types/*`},publishConfig:{access:`public`,provenance:!0},scripts:{format:`prettier --write .`,"format:check":`prettier --check .`,"spdx:check":`npx lice -a src tests/*.ts tests/**/*.test.ts`,"spdx:fix":`npx lice -aw src tests/*.ts tests/**/*.test.ts`,lint:`eslint src tests`,test:`npx zenfs-test --clean; npx zenfs-test -abcp; tests/fetch/run.sh; npx zenfs-test --report`,build:`tsc -p tsconfig.json`,"build:docs":`typedoc`,dev:`tsc -p tsconfig.json --watch`,prepublishOnly:`npm run build`},dependencies:{"@types/node":`^25.2.0`,buffer:`^6.0.3`,eventemitter3:`^5.0.1`,kerium:`^1.3.4`,memium:`^0.4.0`,"readable-stream":`^4.5.2`,utilium:`^3.0.0`},devDependencies:{"@octokit/action":`^8.0.4`,c8:`^10.1.3`,eslint:`^9.15.0`,globals:`^17.3.0`,prettier:`^3.2.5`,tsx:`^4.19.1`,typedoc:`^0.28.18`,typescript:`^6.0.0`,"typescript-eslint":`^8.58.0`}},hl=t({Async:()=>vs,AsyncMapTransaction:()=>qn,AsyncTransaction:()=>Vn,Attributes:()=>Cn,BigIntStatsFs:()=>yn,CopyOnWrite:()=>Lo,CopyOnWriteFS:()=>Io,DeviceFS:()=>Xn,Dir:()=>Hr,Dirent:()=>Vr,ErrnoError:()=>xr,Fetch:()=>qo,FetchFS:()=>Ko,FileSystem:()=>Rn,IOC:()=>cl,IOC32:()=>ll,InMemory:()=>Yn,InMemoryStore:()=>Jn,Index:()=>In,IndexFS:()=>Wo,Inode:()=>J,InodeFlags:()=>Tn,Journal:()=>Fo,MetadataBlock:()=>Ms,MutexLock:()=>Qc,Mutexed:()=>el,Passthrough:()=>Zo,PassthroughFS:()=>Xo,Port:()=>Ss,PortFS:()=>ys,RPC:()=>Qo,ReadStream:()=>ja,Readonly:()=>tl,SingleBuffer:()=>zs,SingleBufferStore:()=>Rs,Stats:()=>hn,StatsFs:()=>vn,StoreFS:()=>Gn,SuperBlock:()=>Fs,Sync:()=>nl,SyncMapTransaction:()=>Kn,SyncTransaction:()=>Bn,Transaction:()=>zn,WrappedTransaction:()=>Hn,WriteStream:()=>Ma,_MutexedFS:()=>$c,_asyncFSKeys:()=>_s,_chown:()=>Fn,_fnOpt:()=>we,_inode_fields:()=>wn,_inode_version:()=>5,_tempDirName:()=>Qt,access:()=>bc,accessSync:()=>Ti,addDevice:()=>Eo,appendFile:()=>Xs,appendFileSync:()=>ti,attachFS:()=>bs,bindContext:()=>Xc,boundContexts:()=>Yc,checkOptions:()=>Ee,chmod:()=>hc,chmodSync:()=>bi,chown:()=>pc,chownSync:()=>vi,chroot:()=>Ar,close:()=>Qs,closeSync:()=>ri,configure:()=>Oo,configureFileSystem:()=>_o,configureSingle:()=>So,configureSingleSync:()=>Co,configureSync:()=>ko,constants:()=>Fe,contextOf:()=>Me,copyFile:()=>kc,copyFileSync:()=>ki,cp:()=>Nc,cpSync:()=>Ni,createChildContext:()=>Pe,createCredentials:()=>Oe,createReadStream:()=>Tc,createWriteStream:()=>Ec,credentialsAllowRoot:()=>ke,decodeDirListing:()=>Gt,default:()=>gl,defaultContext:()=>je,detachFS:()=>xs,devices:()=>rr,encodeDirListing:()=>Kt,exists:()=>Hs,existsSync:()=>Kr,fchmod:()=>ac,fchmodSync:()=>ui,fchown:()=>ic,fchownSync:()=>li,fdatasync:()=>tc,fdatasyncSync:()=>oi,fs:()=>fl,fstat:()=>Zs,fstatSync:()=>ni,fsync:()=>ec,fsyncSync:()=>ai,ftruncate:()=>$s,ftruncateSync:()=>ii,fullDevice:()=>er,futimes:()=>oc,futimesSync:()=>di,glob:()=>Ic,globSync:()=>Fi,globToRegex:()=>Xt,hasAccess:()=>Y,ioctl:()=>ul,ioctlSync:()=>dl,isBackend:()=>Ce,isBackendConfig:()=>De,isBlockDevice:()=>Mn,isCharacterDevice:()=>Nn,isDirectory:()=>kn,isFIFO:()=>Pn,isFile:()=>On,isSocket:()=>jn,isSymbolicLink:()=>An,lchmod:()=>gc,lchmodSync:()=>xi,lchown:()=>mc,lchownSync:()=>yi,link:()=>uc,linkSync:()=>hi,log:()=>te,lopenSync:()=>Qr,lstat:()=>Ws,lstatSync:()=>Jr,lutimes:()=>vc,lutimesSync:()=>Ci,mkdir:()=>cc,mkdirSync:()=>pi,mkdtemp:()=>Oc,mkdtempDisposableSync:()=>Oi,mkdtempSync:()=>Di,mount:()=>Er,mounts:()=>Tr,normalizeMode:()=>qt,normalizeOptions:()=>Yt,normalizePath:()=>W,normalizeTime:()=>Jt,nullDevice:()=>Qn,open:()=>qs,openAsBlob:()=>Fc,openSync:()=>Zr,opendir:()=>Mc,opendirSync:()=>Mi,promises:()=>Na,randomDevice:()=>tr,read:()=>rc,readFile:()=>Js,readFileSync:()=>$r,readSync:()=>ci,readdir:()=>lc,readdirSync:()=>mi,readlink:()=>fc,readlinkSync:()=>_i,readv:()=>Ac,readvSync:()=>Ai,realpath:()=>yc,realpathSync:()=>wi,rename:()=>Vs,renameSync:()=>Gr,resolveMountConfig:()=>bo,resolveMountConfigSync:()=>xo,resolveRemoteMount:()=>Cs,rm:()=>Dc,rmSync:()=>Ei,rmdir:()=>sc,rmdirSync:()=>fi,rootIno:()=>0,stat:()=>Us,statSync:()=>qr,statfs:()=>Pc,statfsSync:()=>Pi,symlink:()=>dc,symlinkSync:()=>gi,sync:()=>Ao,truncate:()=>Gs,truncateSync:()=>Yr,umount:()=>Dr,unlink:()=>Ks,unlinkSync:()=>Xr,unwatchFile:()=>Cc,userModifiableFlags:()=>Dn,userVisibleFlags:()=>En,utimes:()=>_c,utimesSync:()=>Si,version:()=>1,vfs:()=>pl,waitOnline:()=>Zt,watch:()=>wc,watchFile:()=>Sc,withExceptionContext:()=>wr,withPath:()=>Sr,wrap:()=>Cr,write:()=>nc,writeFile:()=>Ys,writeFileSync:()=>ei,writeSync:()=>si,writev:()=>jc,writevSync:()=>ji,xattr:()=>Rc,zeroDevice:()=>$n}),gl=fl;globalThis.__zenfs__=Object.assign(Object.create(fl),{_version:ml.version});export{z as C,ee as D,N as E,T as O,ce as S,j as T,Je as _,Yn as a,se as b,zn as c,wn as d,cn as f,Ge as g,Xe as h,Wo as i,_ as k,Rn as l,G as m,nl as n,Kn as o,K as p,vs as r,Gn as s,hl as t,J as u,et as v,O as w,L as x,$e as y};
|
|
12
|
+
`);for(let e of this.items)e.offset&&(t+=`\n\t${Ds(e.id)}: ${Os(e.size).padStart(5)} at ${Ds(e.offset)}`);return t}#i=(Z(this,b),Z(this,S,void 0));get locked(){return this.#i}set locked(e){this.#i=e}waitUnlocked(e=0){if(e>js)throw L(N(`EBUSY`,`sbfs: exceeded max attempts waiting for metadata block at ${Ds(this.byteOffset)} to be unlocked`));if(Atomics.load(this,w.lockIndex))switch(Atomics.wait(this,w.lockIndex,1)){case`ok`:break;case`not-equal`:return e++,R(`sbfs: waiting for metadata block at ${Ds(this.byteOffset)} to be unlocked (${e}/${js})`),this.waitUnlocked(e);case`timed-out`:throw L(N(`EBUSY`,`sbfs: timed out waiting for metadata block at ${Ds(this.byteOffset)} to be unlocked`))}}lock(){this.waitUnlocked(),Atomics.store(this,w.lockIndex,1);let e=()=>{Atomics.store(this,w.lockIndex,0),Atomics.notify(this,w.lockIndex,1)};return e[Symbol.dispose]=e,e}constructor(){super(...arguments),Z(this,C)}static{Z(s,o)}};return w=s})();Object.assign(Ms,{lockIndex:Mt(Ms,`locked`)/Int32Array.BYTES_PER_ELEMENT});var Ns=1651715706,Ps=2,Fs=(()=>{var e,t,n,r,i,a,o,s,c,l;let u=[Rt.packed()],d,f=[],p,m=Vt.typed(BigUint64Array),h,g=[],_=[],v,y=[],b=[],x,S=[],C=[],w,T=[],ee=[],E,O=[],k=[],A,j=[],M=[],P,te=[],F=[],I,ne=[],re=[],ie,ae=[],oe=[],se,R=[],ce=[],le,de=[],fe=[],pe,me=[],he=[],ge,_e=[],B=[];var ve=class extends m{static{p=this}static{let D=typeof Symbol==`function`&&Symbol.metadata?Object.create(m[Symbol.metadata]??null):void 0;h=[(e=U).uint32.bind(e)],v=[(t=U).uint32.bind(t)],x=[(n=U).uint16.bind(n)],w=[(r=U).uint16.bind(r)],E=[(i=U).uint32.bind(i)],A=[(a=U).uint64.bind(a)],P=[(o=U).uint64.bind(o)],I=[U.uint8(16)],ie=[(s=U).uint32.bind(s)],se=[(c=U).uint32.bind(c)],le=[(l=U).uint32.bind(l)],pe=[U.char(64)],ge=[U.char(132)],ws(this,null,h,{kind:`accessor`,name:`checksum`,static:!1,private:!1,access:{has:e=>`checksum`in e,get:e=>e.checksum,set:(e,t)=>{e.checksum=t}},metadata:D},g,_),ws(this,null,v,{kind:`accessor`,name:`magic`,static:!1,private:!1,access:{has:e=>`magic`in e,get:e=>e.magic,set:(e,t)=>{e.magic=t}},metadata:D},y,b),ws(this,null,x,{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:D},S,C),ws(this,null,w,{kind:`accessor`,name:`inode_format`,static:!1,private:!1,access:{has:e=>`inode_format`in e,get:e=>e.inode_format,set:(e,t)=>{e.inode_format=t}},metadata:D},T,ee),ws(this,null,E,{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:D},O,k),ws(this,null,A,{kind:`accessor`,name:`used_bytes`,static:!1,private:!1,access:{has:e=>`used_bytes`in e,get:e=>e.used_bytes,set:(e,t)=>{e.used_bytes=t}},metadata:D},j,M),ws(this,null,P,{kind:`accessor`,name:`total_bytes`,static:!1,private:!1,access:{has:e=>`total_bytes`in e,get:e=>e.total_bytes,set:(e,t)=>{e.total_bytes=t}},metadata:D},te,F),ws(this,null,I,{kind:`accessor`,name:`uuid`,static:!1,private:!1,access:{has:e=>`uuid`in e,get:e=>e.uuid,set:(e,t)=>{e.uuid=t}},metadata:D},ne,re),ws(this,null,ie,{kind:`accessor`,name:`metadata_block_size`,static:!1,private:!1,access:{has:e=>`metadata_block_size`in e,get:e=>e.metadata_block_size,set:(e,t)=>{e.metadata_block_size=t}},metadata:D},ae,oe),ws(this,null,se,{kind:`accessor`,name:`metadata_offset_`,static:!1,private:!1,access:{has:e=>`metadata_offset_`in e,get:e=>e.metadata_offset_,set:(e,t)=>{e.metadata_offset_=t}},metadata:D},R,ce),ws(this,null,le,{kind:`accessor`,name:`metadata_offset`,static:!1,private:!1,access:{has:e=>`metadata_offset`in e,get:e=>e.metadata_offset,set:(e,t)=>{e.metadata_offset=t}},metadata:D},de,fe),ws(this,null,pe,{kind:`accessor`,name:`label`,static:!1,private:!1,access:{has:e=>`label`in e,get:e=>e.label,set:(e,t)=>{e.label=t}},metadata:D},me,he),ws(this,null,ge,{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:D},_e,B),ws(null,d={value:p},u,{kind:`class`,name:p.name,metadata:D},null,f),ve=p=d.value,D&&Object.defineProperty(p,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:D})}static name=`SuperBlock`;constructor(...e){if(super(...e),Z(this,B),this.magic!=Ns){z(`sbfs: Invalid magic value, assuming this is a fresh super block`);let e=new Ms(this.buffer,H(ve));Object.assign(this,{metadata:e,metadata_offset:e.byteOffset,used_bytes:BigInt(H(ve)+H(Ms)),total_bytes:BigInt(this.buffer.byteLength),magic:Ns,version:1,inode_format:5,metadata_block_size:H(Ms),uuid:D(crypto.randomUUID())}),Ls(this),Ls(e);return}if(this.checksum!==Is(this))throw L(N(`EIO`,`sbfs: checksum mismatch for super block`));if(this.metadata=new Ms(this.buffer,this.metadata_offset),this.metadata.checksum!==Is(this.metadata))throw L(N(`EIO`,`sbfs: checksum mismatch for metadata block (saved ${Ds(this.metadata.checksum)}, computed ${Ds(Is(this.metadata))})`));if(this.inode_format!=5)throw L(N(`EIO`,`sbfs: inode format mismatch`));if(this.metadata_block_size!=H(Ms))throw L(N(`EIO`,`sbfs: metadata block size mismatch`))}#e=Z(this,g,void 0);get checksum(){return this.#e}set checksum(e){this.#e=e}#t=(Z(this,_),Z(this,y,void 0));get magic(){return this.#t}set magic(e){this.#t=e}#n=(Z(this,b),Z(this,S,void 0));get version(){return this.#n}set version(e){this.#n=e}#r=(Z(this,C),Z(this,T,void 0));get inode_format(){return this.#r}set inode_format(e){this.#r=e}#i=(Z(this,ee),Z(this,O,void 0));get flags(){return this.#i}set flags(e){this.#i=e}#a=(Z(this,k),Z(this,j,void 0));get used_bytes(){return this.#a}set used_bytes(e){this.#a=e}#o=(Z(this,M),Z(this,te,void 0));get total_bytes(){return this.#o}set total_bytes(e){this.#o=e}#s=(Z(this,F),Z(this,ne,void 0));get uuid(){return this.#s}set uuid(e){this.#s=e}#c=(Z(this,re),Z(this,ae,void 0));get metadata_block_size(){return this.#c}set metadata_block_size(e){this.#c=e}#l=(Z(this,oe),Z(this,R,void 0));get metadata_offset_(){return this.#l}set metadata_offset_(e){this.#l=e}#u=(Z(this,ce),Z(this,de,void 0));get metadata_offset(){return this.#u}set metadata_offset(e){this.#u=e}metadata=Z(this,fe);#d=Z(this,me,void 0);get label(){return this.#d}set label(e){this.#d=e}#f=(Z(this,he),Z(this,_e,void 0));get _padding(){return this.#f}set _padding(e){this.#f=e}rotateMetadata(){let e=this.used_bytes%BigInt(4);Atomics.add(this,Ps,e);let t=Number(Atomics.add(this,Ps,BigInt(H(Ms)))),n=new Ms(this.buffer,t);return n.previous_offset=this.metadata_offset,this.metadata=n,this.metadata_offset=n.byteOffset,Ls(n),Ls(this),ue(`sbfs: rotated metadata block at ${Ds(n.previous_offset)} with new block at ${Ds(t)}`),n}isUnused(e,t){if(!t)return!0;if(e+t>this.total_bytes||e<H(ve))return!1;for(let n=this.metadata;n;n=n.previous){if(e<n.byteOffset+H(Ms)&&e+t>n.byteOffset)return!1;for(let r of n.items)if(r.offset&&(e>=r.offset&&e<r.offset+r.size||e+t>r.offset&&e+t<=r.offset+r.size||e<=r.offset&&e+t>=r.offset+r.size))return!1}return!0}static{Z(p,f)}};return ve=p})();function Is(e){let t=H(e)-4;return e instanceof Ms&&(t-=Int32Array.BYTES_PER_ELEMENT),s(new Uint8Array(e.buffer,e.byteOffset+4,t))}function Ls(e){e instanceof Ms&&(e.timestamp=BigInt(Date.now())),e.checksum=Is(e)}var Rs=class extends i{flags=[];name=`sbfs`;type=1935828595;get uuid(){return E(this.superblock.uuid)}superblock;_view;_u8;constructor(...e){if(super(...e),this.byteLength<H(Fs)+H(Ms))throw L(N(`EINVAL`,`sbfs: Buffer is too small for a file system`));this._view=new DataView(this.buffer,this.byteOffset,this.byteLength),this._u8=new Uint8Array(this.buffer,this.byteOffset,this.byteLength),this.superblock=new Fs(this.buffer,this.byteOffset)}*keys(){let e=new Set;for(let t=this.superblock.metadata;t;t=t.previous){t.waitUnlocked();for(let n of t.items)!n.offset||e.has(n.id)||(e.add(n.id),yield n.id)}}get(e){for(let t=this.superblock.metadata;t;t=t.previous){t.waitUnlocked();for(let n of t.items){if(!n.offset||n.id!=e)continue;let t=this.byteOffset+n.offset;return new Uint8Array(this.buffer.slice(t,t+n.size))}}}set(e,t){let n={stack:[],error:void 0,hasError:!1};try{if(e===0&&t.length<H(J))throw se(N(`EIO`,`sbfs: tried to set ${t.length} bytes for id 0!`));for(let n=this.superblock.metadata;n;n=n.previous){n.waitUnlocked();for(let r of n.items){let i={stack:[],error:void 0,hasError:!1};try{if(!r.offset||r.id!=e)continue;if(Ts(i,n.lock(),!1),t.length==r.size){this._u8.set(t,r.offset);return}if(t.length<r.size||this.superblock.isUnused(r.offset,t.length)){this._u8.set(t,r.offset),r.size=t.length,Ls(n);return}r.offset=Number(Atomics.add(this.superblock,Ps,BigInt(t.length))),r.size=t.length,this._u8.set(t,r.offset),Ls(n),Ls(this.superblock);return}catch(e){i.error=e,i.hasError=!0}finally{Es(i)}}}let r=Array.from(this.superblock.metadata.items).find(e=>!e.offset);r||=(this.superblock.rotateMetadata(),this.superblock.metadata.items[0]),Ts(n,this.superblock.metadata.lock(),!1);let i=Number(Atomics.add(this.superblock,Ps,BigInt(t.length)));r.id=e,r.offset=i,r.size=t.length,this._u8.set(t,i),Ls(this.superblock.metadata),Ls(this.superblock)}catch(e){n.error=e,n.hasError=!0}finally{Es(n)}}delete(e){for(let t=this.superblock.metadata;t;t=t.previous){t.waitUnlocked();for(let n of t.items)if(n.id==e){n.offset=0,n.size=0,n.id=0,Ls(t);return}}}_fs;get fs(){return this._fs}set fs(e){this.buffer.constructor.name===`SharedArrayBuffer`&&e?.attributes.set(`no_id_tables`,!0),this._fs=e}sync(){return Promise.resolve()}usage(){return{totalSpace:Number(this.superblock.total_bytes),freeSpace:Number(this.superblock.total_bytes-this.superblock.used_bytes)}}transaction(){return new Kn(this)}},zs={name:`SingleBuffer`,options:{buffer:{type:`object`,required:!0}},create(e){let t=new Gn(ArrayBuffer.isView(e.buffer)?new Rs(e.buffer.buffer,e.buffer.byteOffset,e.buffer.byteLength):new Rs(e.buffer));return t.checkRootSync(),t}},Q=()=>{};async function Bs(e){let t=[];for await(let n of e)t.push(n);return t}function Vs(e,t,n=Q){La.call(this,e,t).then(()=>n(null)).catch(n)}function Hs(e,t=Q){Ra.call(this,e).then(t).catch(()=>t(!1))}function Us(e,t,n=Q){n=typeof t==`function`?t:n,za.call(this,e,typeof t==`function`?{}:t).then(e=>n(null,e)).catch(n)}function Ws(e,t,n=Q){n=typeof t==`function`?t:n,Ba.call(this,e,typeof t==`function`?{}:t).then(e=>n(null,e)).catch(n)}function Gs(e,t=0,n=Q){n=typeof t==`function`?t:n;let r=typeof t==`number`?t:0;Va.call(this,e,r).then(()=>n(null)).catch(n)}function Ks(e,t=Q){Ha.call(this,e).then(()=>t(null)).catch(t)}function qs(e,t,n,r=Q){let i=qt(n,420);r=typeof n==`function`?n:r,Ua.call(this,e,t,i).then(e=>r(null,e.fd)).catch(r)}function Js(e,t,n=Q){n=typeof t==`function`?t:n,Wa.call(this,e,typeof t==`function`?null:t).then(e=>n(null,e)).catch(n)}function Ys(e,t,n,r=Q){r=typeof n==`function`?n:r,Ga.call(this,e,t,typeof n==`function`?null:n).then(()=>r(null)).catch(r)}function Xs(e,t,n,r=Q){let i=typeof n==`function`?void 0:n;r=typeof n==`function`?n:r,Ka.call(this,e,t,i).then(()=>r(null)).catch(r)}function Zs(e,t,n=Q){n=typeof t==`function`?t:n,new Ia(this,e).stat().then(e=>n(null,typeof t==`object`&&t?.bigint?new gn(e):e)).catch(n)}function Qs(e,t=Q){new Ia(this,e).close().then(()=>t(null)).catch(t)}function $s(e,t,n=Q){let r=typeof t==`number`?t:0;n=typeof t==`function`?t:n;let i=new Ia(this,e);if(r<0)throw N(`EINVAL`);i.truncate(r).then(()=>n(null)).catch(n)}function ec(e,t=Q){new Ia(this,e).sync().then(()=>t(null)).catch(t)}function tc(e,t=Q){new Ia(this,e).datasync().then(()=>t(null)).catch(t)}function nc(e,t,n,r,i,a=Q){let o,s,c,l,u,d=new Ia(this,e);if(typeof t==`string`){switch(u=`utf8`,typeof n){case`function`:a=n;break;case`number`:l=n,u=typeof r==`string`?r:`utf8`,a=typeof i==`function`?i:a;break;default:a=typeof r==`function`?r:typeof i==`function`?i:a,a(N(`EINVAL`));return}o=sr.Buffer.from(t),s=0,c=o.length;let e=a;d.write(o,s,c,l).then(({bytesWritten:t})=>e(null,t,o.toString(u))).catch(e)}else{o=sr.Buffer.from(t.buffer),s=n,c=r,l=typeof i==`number`?i:null;let e=typeof i==`function`?i:a;d.write(o,s,c,l).then(({bytesWritten:t})=>e(null,t,o)).catch(e)}}function rc(e,t,n,r,i,a=Q){new Ia(this,e).read(t,n,r,i).then(({bytesRead:e,buffer:t})=>a(null,e,t)).catch(a)}function ic(e,t,n,r=Q){new Ia(this,e).chown(t,n).then(()=>r(null)).catch(r)}function ac(e,t,n){new Ia(this,e).chmod(t).then(()=>n(null)).catch(n)}function oc(e,t,n,r=Q){new Ia(this,e).utimes(t,n).then(()=>r(null)).catch(r)}function sc(e,t=Q){qa.call(this,e).then(()=>t(null)).catch(t)}function cc(e,t,n=Q){Ja.call(this,e,t).then(()=>n(null)).catch(n)}function lc(e,t,n=Q){n=typeof t==`function`?t:n;let r=typeof t==`function`?{}:t;Ya.call(this,e,r).then(e=>n(null,e)).catch(n)}function uc(e,t,n=Q){Xa.call(this,e,t).then(()=>n(null)).catch(n)}function dc(e,t,n,r=Q){let i=typeof n==`string`?n:`file`;r=typeof n==`function`?n:r,Za.call(this,e,t,i).then(()=>r(null)).catch(r)}function fc(e,t,n=Q){n=typeof t==`function`?t:n,Qa.call(this,e).then(e=>n(null,e)).catch(n)}function pc(e,t,n,r=Q){$a.call(this,e,t,n).then(()=>r(null)).catch(r)}function mc(e,t,n,r=Q){eo.call(this,e,t,n).then(()=>r(null)).catch(r)}function hc(e,t,n=Q){to.call(this,e,t).then(()=>n(null)).catch(n)}function gc(e,t,n=Q){no.call(this,e,t).then(()=>n(null)).catch(n)}function _c(e,t,n,r=Q){ro.call(this,e,t,n).then(()=>r(null)).catch(r)}function vc(e,t,n,r=Q){io.call(this,e,t,n).then(()=>r(null)).catch(r)}function yc(e,t,n=Q){n=typeof t==`function`?t:n,ao.call(this,e,typeof t==`function`?null:t).then(e=>n(null,e)).catch(n)}function bc(e,t,n=Q){let r=typeof t==`number`?t:4;n=typeof t==`function`?t:n,so.call(this,e,r).then(()=>n(null)).catch(n)}var xc=new Map;function Sc(e,t,n){let r=W(e),i=typeof t==`function`?{}:t;if(typeof t==`function`&&(n=t),!n)throw M(`EINVAL`,`watch`,e.toString());if(xc.has(r)){let e=xc.get(r);e&&e.listeners.add(n);return}let a=new Ri(this,r,i);a.on(`change`,(e,t)=>{let n=xc.get(r);if(n)for(let r of n.listeners)r(e,t)}),xc.set(r,{watcher:a,listeners:new Set})}function Cc(e,t=Q){let n=W(e),r=xc.get(n);r&&(t&&t!==Q?r.listeners.delete(t):r.listeners.clear(),r.listeners.size===0&&(r.watcher.stop(),xc.delete(n)))}function wc(e,t,n){let r=new Li(this,W(e),typeof t==`object`?t:{});return n=typeof t==`function`?t:n,r.on(`change`,n||Q),r}function Tc(e,t){t=typeof t==`object`?t:{encoding:t};let n=Ua.call(this,e,`r`,t?.mode);return new ja({...t,autoClose:!0},n)}function Ec(e,t){t=typeof t==`object`?t:{encoding:t};let n=Ua.call(this,e,`w`,t?.mode);return new Ma(t,n)}function Dc(e,t,n=Q){n=typeof t==`function`?t:n,co.call(this,e,typeof t==`function`?void 0:t).then(()=>n(null)).catch(n)}function Oc(e,t,n=Q){n=typeof t==`function`?t:n,lo.call(this,e,typeof t==`function`?null:t).then(e=>n(null,e)).catch(n)}function kc(e,t,n,r=Q){r=typeof n==`function`?n:r,fo.call(this,e,t,typeof n==`function`?void 0:n).then(()=>r(null)).catch(r)}function Ac(e,t,n,r=Q){r=typeof n==`function`?n:r,new Ia(this,e).readv(t,typeof n==`function`?void 0:n).then(({buffers:e,bytesRead:t})=>r(null,t,e)).catch(r)}function jc(e,t,n,r=Q){r=typeof n==`function`?n:r,new Ia(this,e).writev(t,typeof n==`function`?void 0:n).then(({buffers:e,bytesWritten:t})=>r(null,t,e)).catch(r)}function Mc(e,t,n=Q){n=typeof t==`function`?t:n,po.call(this,e,typeof t==`function`?void 0:t).then(e=>n(null,e)).catch(n)}function Nc(e,t,n,r=Q){r=typeof n==`function`?n:r,mo.call(this,e,t,typeof n==`function`?void 0:n).then(()=>r(null)).catch(r)}function Pc(e,t,n=Q){n=typeof t==`function`?t:n,ho.call(this,e,typeof t==`function`?void 0:t).then(e=>n(null,e)).catch(n)}async function Fc(e,t){let n=await Ua.call(this,e.toString(),`r`),r=await n.readFile();return await n.close(),new Blob([r],t)}function Ic(e,t,n=Q){n=typeof t==`function`?t:n,Bs(go.call(this,e,typeof t==`function`?void 0:t)).then(e=>n(null,e??[])).catch(e=>n(e))}var Lc=t({BigIntStatsFs:()=>yn,Dir:()=>Hr,Dirent:()=>Vr,ReadStream:()=>ja,Stats:()=>hn,StatsFs:()=>vn,WriteStream:()=>Ma,access:()=>bc,accessSync:()=>Ti,appendFile:()=>Xs,appendFileSync:()=>ti,chmod:()=>hc,chmodSync:()=>bi,chown:()=>pc,chownSync:()=>vi,close:()=>Qs,closeSync:()=>ri,constants:()=>Fe,copyFile:()=>kc,copyFileSync:()=>ki,cp:()=>Nc,cpSync:()=>Ni,createReadStream:()=>Tc,createWriteStream:()=>Ec,exists:()=>Hs,existsSync:()=>Kr,fchmod:()=>ac,fchmodSync:()=>ui,fchown:()=>ic,fchownSync:()=>li,fdatasync:()=>tc,fdatasyncSync:()=>oi,fstat:()=>Zs,fstatSync:()=>ni,fsync:()=>ec,fsyncSync:()=>ai,ftruncate:()=>$s,ftruncateSync:()=>ii,futimes:()=>oc,futimesSync:()=>di,glob:()=>Ic,globSync:()=>Fi,lchmod:()=>gc,lchmodSync:()=>xi,lchown:()=>mc,lchownSync:()=>yi,link:()=>uc,linkSync:()=>hi,lopenSync:()=>Qr,lstat:()=>Ws,lstatSync:()=>Jr,lutimes:()=>vc,lutimesSync:()=>Ci,mkdir:()=>cc,mkdirSync:()=>pi,mkdtemp:()=>Oc,mkdtempDisposableSync:()=>Oi,mkdtempSync:()=>Di,open:()=>qs,openAsBlob:()=>Fc,openSync:()=>Zr,opendir:()=>Mc,opendirSync:()=>Mi,promises:()=>Na,read:()=>rc,readFile:()=>Js,readFileSync:()=>$r,readSync:()=>ci,readdir:()=>lc,readdirSync:()=>mi,readlink:()=>fc,readlinkSync:()=>_i,readv:()=>Ac,readvSync:()=>Ai,realpath:()=>yc,realpathSync:()=>wi,rename:()=>Vs,renameSync:()=>Gr,rm:()=>Dc,rmSync:()=>Ei,rmdir:()=>sc,rmdirSync:()=>fi,stat:()=>Us,statSync:()=>qr,statfs:()=>Pc,statfsSync:()=>Pi,symlink:()=>dc,symlinkSync:()=>gi,truncate:()=>Gs,truncateSync:()=>Yr,unlink:()=>Ks,unlinkSync:()=>Xr,unwatchFile:()=>Cc,utimes:()=>_c,utimesSync:()=>Si,watch:()=>wc,watchFile:()=>Sc,write:()=>nc,writeFile:()=>Ys,writeFileSync:()=>ei,writeSync:()=>si,writev:()=>jc,writevSync:()=>ji}),Rc=t({get:()=>Vc,getSync:()=>Hc,list:()=>qc,listSync:()=>Jc,remove:()=>Gc,removeSync:()=>Kc,set:()=>Uc,setSync:()=>Wc}),zc=[];function Bc(e,t,n,r){if(!t.startsWith(`user.`)&&!zc.includes(t))throw M(`ENOTSUP`,r,n)}async function Vc(e,t,n={}){e=W(e);let{fs:r,path:i}=Or(e,this);Bc(this,t,e,`xattr.get`);let a=await r.stat(i).catch(P(`xattr.get`,e));if(X&&!Y(this,a,4))throw M(`EACCES`,`xattr.get`,e);a.attributes??=new Cn;let o=a.attributes.get(t);if(!o)throw M(`ENODATA`,`xattr.get`,e);let s=sr.Buffer.from(o);return n.encoding==`buffer`||!n.encoding?s:s.toString(n.encoding)}function Hc(e,t,n={}){e=W(e),Bc(this,t,e,`xattr.get`);let{fs:r,path:i}=Or(e,this),a;try{a=r.statSync(i)}catch(t){throw A(Object.assign(t,{path:e}))}if(X&&!Y(this,a,4))throw M(`EACCES`,`xattr.get`,e);a.attributes??=new Cn;let o=a.attributes.get(t);if(!o)throw M(`ENODATA`,`xattr.get`,e);let s=sr.Buffer.from(o);return n.encoding==`buffer`||!n.encoding?s:s.toString(n.encoding)}async function Uc(e,t,n,r={}){e=W(e);let{fs:i,path:a}=Or(e,this);Bc(this,t,e,`xattr.set`);let o=await i.stat(a).catch(P(`xattr.set`,e));if(X&&!Y(this,o,2))throw M(`EACCES`,`xattr.set`,e);o.attributes??=new Cn;let s=o.attributes.get(t);if(r.create&&s)throw M(`EEXIST`,`xattr.set`,e);if(r.replace&&!s)throw M(`ENODATA`,`xattr.set`,e);o.attributes.set(t,sr.Buffer.from(n)),await i.touch(a,o).catch(P(`xattr.set`,e))}function Wc(e,t,n,r={}){e=W(e);let{fs:i,path:a}=Or(e,this);Bc(this,t,e,`xattr.set`);let o;try{o=i.statSync(a)}catch(t){throw A(Object.assign(t,{path:e}))}if(X&&!Y(this,o,2))throw M(`EACCES`,`xattr.set`,e);o.attributes??=new Cn;let s=o.attributes.get(t);if(r.create&&s)throw M(`EEXIST`,`xattr.set`,e);if(r.replace&&!s)throw M(`ENODATA`,`xattr.set`,e);o.attributes.set(t,sr.Buffer.from(n));try{i.touchSync(a,o)}catch(t){throw A(Object.assign(t,{path:e}))}}async function Gc(e,t){e=W(e);let{fs:n,path:r}=Or(e,this);Bc(this,t,e,`xattr.remove`);let i=await n.stat(r).catch(P(`xattr.remove`,e));if(X&&!Y(this,i,2))throw M(`EACCES`,`xattr.remove`,e);if(i.attributes??=new Cn,!i.attributes.get(t))throw M(`ENODATA`,`xattr.remove`,e);i.attributes.remove(t),await n.touch(r,i)}function Kc(e,t){e=W(e);let{fs:n,path:r}=Or(e,this);Bc(this,t,e,`xattr.remove`);let i;try{i=n.statSync(r)}catch(t){throw A(Object.assign(t,{path:e}))}if(X&&!Y(this,i,2))throw M(`EACCES`,`xattr.remove`,e);if(i.attributes??=new Cn,!i.attributes.get(t))throw M(`ENODATA`,`xattr.remove`,e);i.attributes.remove(t);try{n.touchSync(r,i)}catch(t){throw A(Object.assign(t,{path:e}))}}async function qc(e){e=W(e);let{fs:t,path:n}=Or(e,this),r=await t.stat(n).catch(P(`xattr.list`,e));return r.attributes?r.attributes.keys().toArray():[]}function Jc(e){e=W(e);let{fs:t,path:n}=Or(e,this),r;try{r=t.statSync(n)}catch(t){throw A(Object.assign(t,{path:e}))}return r.attributes?r.attributes.keys().toArray():[]}var Yc=new Map;function Xc(e={}){let t=Me(this);if(!qr.call(this,t.root).isDirectory())throw M(`ENOTDIR`,{syscall:`chroot`,path:t.root});let n=Pe(t,e),r=Object.assign(n,{fs:{...h(Lc,n),promises:h(Na,n),xattr:h(Rc,n)},path:h($t,n),bind:e=>{let t=Xc.call(n,e);return n.children.push(t),t}});return Yc.set(n.id,r),r}var $=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},Zc=(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}),Qc=class{previous;current=Promise.withResolvers();_isLocked=!0;get isLocked(){return this._isLocked}constructor(e){this.previous=e}async done(){await this.previous?.done(),await this.current.promise}unlock(){this.current.resolve(),this._isLocked=!1}[Symbol.dispose](){this.unlock()}},$c=class{_fs;get type(){return this._fs.type}get name(){return this._fs.name}get label(){return this._fs.label}set label(e){this._fs.label=e}get attributes(){return this._fs.attributes}get _uuid(){return this._fs._uuid}set _uuid(e){this._fs._uuid=e}get uuid(){return this._fs.uuid}async ready(){return await this._fs.ready()}readySync(){return this._fs.readySync()}usage(){return this._fs.usage()}currentLock;addLock(){let e=new Qc(this.currentLock);return this.currentLock=e,e}async lock(e=5e3){let t=this.currentLock,n=this.addLock(),r=Error().stack;return setTimeout(()=>{if(n.isLocked){let e=N(`EDEADLK`);throw e.stack+=r?.slice(5),R(e)}},e),await t?.done(),n}lockSync(){if(this.currentLock?.isLocked)throw R(N(`EBUSY`));return this.addLock()}get isLocked(){return!!this.currentLock?.isLocked}async rename(e,t){let n={stack:[],error:void 0,hasError:!1};try{$(n,await this.lock(),!1),await this._fs.rename(e,t)}catch(e){n.error=e,n.hasError=!0}finally{Zc(n)}}renameSync(e,t){let n={stack:[],error:void 0,hasError:!1};try{return $(n,this.lockSync(),!1),this._fs.renameSync(e,t)}catch(e){n.error=e,n.hasError=!0}finally{Zc(n)}}async stat(e){let t={stack:[],error:void 0,hasError:!1};try{return $(t,await this.lock(),!1),await this._fs.stat(e)}catch(e){t.error=e,t.hasError=!0}finally{Zc(t)}}statSync(e){let t={stack:[],error:void 0,hasError:!1};try{return $(t,this.lockSync(),!1),this._fs.statSync(e)}catch(e){t.error=e,t.hasError=!0}finally{Zc(t)}}async touch(e,t){let n={stack:[],error:void 0,hasError:!1};try{$(n,await this.lock(),!1),await this._fs.touch(e,t)}catch(e){n.error=e,n.hasError=!0}finally{Zc(n)}}touchSync(e,t){let n={stack:[],error:void 0,hasError:!1};try{$(n,this.lockSync(),!1),this._fs.touchSync(e,t)}catch(e){n.error=e,n.hasError=!0}finally{Zc(n)}}async createFile(e,t){let n={stack:[],error:void 0,hasError:!1};try{return $(n,await this.lock(),!1),await this._fs.createFile(e,t)}catch(e){n.error=e,n.hasError=!0}finally{Zc(n)}}createFileSync(e,t){let n={stack:[],error:void 0,hasError:!1};try{return $(n,this.lockSync(),!1),this._fs.createFileSync(e,t)}catch(e){n.error=e,n.hasError=!0}finally{Zc(n)}}async unlink(e){let t={stack:[],error:void 0,hasError:!1};try{$(t,await this.lock(),!1),await this._fs.unlink(e)}catch(e){t.error=e,t.hasError=!0}finally{Zc(t)}}unlinkSync(e){let t={stack:[],error:void 0,hasError:!1};try{return $(t,this.lockSync(),!1),this._fs.unlinkSync(e)}catch(e){t.error=e,t.hasError=!0}finally{Zc(t)}}async rmdir(e){let t={stack:[],error:void 0,hasError:!1};try{$(t,await this.lock(),!1),await this._fs.rmdir(e)}catch(e){t.error=e,t.hasError=!0}finally{Zc(t)}}rmdirSync(e){let t={stack:[],error:void 0,hasError:!1};try{return $(t,this.lockSync(),!1),this._fs.rmdirSync(e)}catch(e){t.error=e,t.hasError=!0}finally{Zc(t)}}async mkdir(e,t){let n={stack:[],error:void 0,hasError:!1};try{return $(n,await this.lock(),!1),await this._fs.mkdir(e,t)}catch(e){n.error=e,n.hasError=!0}finally{Zc(n)}}mkdirSync(e,t){let n={stack:[],error:void 0,hasError:!1};try{return $(n,this.lockSync(),!1),this._fs.mkdirSync(e,t)}catch(e){n.error=e,n.hasError=!0}finally{Zc(n)}}async readdir(e){let t={stack:[],error:void 0,hasError:!1};try{return $(t,await this.lock(),!1),await this._fs.readdir(e)}catch(e){t.error=e,t.hasError=!0}finally{Zc(t)}}readdirSync(e){let t={stack:[],error:void 0,hasError:!1};try{return $(t,this.lockSync(),!1),this._fs.readdirSync(e)}catch(e){t.error=e,t.hasError=!0}finally{Zc(t)}}async exists(e){let t={stack:[],error:void 0,hasError:!1};try{return $(t,await this.lock(),!1),await this._fs.exists(e)}catch(e){t.error=e,t.hasError=!0}finally{Zc(t)}}existsSync(e){let t={stack:[],error:void 0,hasError:!1};try{return $(t,this.lockSync(),!1),this._fs.existsSync(e)}catch(e){t.error=e,t.hasError=!0}finally{Zc(t)}}async link(e,t){let n={stack:[],error:void 0,hasError:!1};try{$(n,await this.lock(),!1),await this._fs.link(e,t)}catch(e){n.error=e,n.hasError=!0}finally{Zc(n)}}linkSync(e,t){let n={stack:[],error:void 0,hasError:!1};try{return $(n,this.lockSync(),!1),this._fs.linkSync(e,t)}catch(e){n.error=e,n.hasError=!0}finally{Zc(n)}}async sync(){let e={stack:[],error:void 0,hasError:!1};try{$(e,await this.lock(),!1),await this._fs.sync()}catch(t){e.error=t,e.hasError=!0}finally{Zc(e)}}syncSync(){let e={stack:[],error:void 0,hasError:!1};try{return $(e,this.lockSync(),!1),this._fs.syncSync()}catch(t){e.error=t,e.hasError=!0}finally{Zc(e)}}async read(e,t,n,r){let i={stack:[],error:void 0,hasError:!1};try{return $(i,await this.lock(),!1),await this._fs.read(e,t,n,r)}catch(e){i.error=e,i.hasError=!0}finally{Zc(i)}}readSync(e,t,n,r){let i={stack:[],error:void 0,hasError:!1};try{return $(i,this.lockSync(),!1),this._fs.readSync(e,t,n,r)}catch(e){i.error=e,i.hasError=!0}finally{Zc(i)}}async write(e,t,n){let r={stack:[],error:void 0,hasError:!1};try{return $(r,await this.lock(),!1),await this._fs.write(e,t,n)}catch(e){r.error=e,r.hasError=!0}finally{Zc(r)}}writeSync(e,t,n){let r={stack:[],error:void 0,hasError:!1};try{return $(r,this.lockSync(),!1),this._fs.writeSync(e,t,n)}catch(e){r.error=e,r.hasError=!0}finally{Zc(r)}}streamRead(e,t){let n={stack:[],error:void 0,hasError:!1};try{return $(n,this.lockSync(),!1),this._fs.streamRead(e,t)}catch(e){n.error=e,n.hasError=!0}finally{Zc(n)}}streamWrite(e,t){let n={stack:[],error:void 0,hasError:!1};try{return $(n,this.lockSync(),!1),this._fs.streamWrite(e,t)}catch(e){n.error=e,n.hasError=!0}finally{Zc(n)}}};function el(e){class t extends $c{constructor(...t){super(),this._fs=new e(...t)}}return t}function tl(e){class t extends e{constructor(...e){super(...e),this.attributes.set(`no_write`)}async rename(){throw N(`EROFS`)}renameSync(){throw N(`EROFS`)}async createFile(){throw N(`EROFS`)}createFileSync(){throw N(`EROFS`)}async unlink(){throw N(`EROFS`)}unlinkSync(){throw N(`EROFS`)}async rmdir(){throw N(`EROFS`)}rmdirSync(){throw N(`EROFS`)}async mkdir(){throw N(`EROFS`)}mkdirSync(){throw N(`EROFS`)}async link(){throw N(`EROFS`)}linkSync(){throw N(`EROFS`)}async touch(){throw N(`EROFS`)}touchSync(){throw N(`EROFS`)}async sync(){throw N(`EROFS`)}syncSync(){throw N(`EROFS`)}async write(){throw N(`EROFS`)}writeSync(){throw N(`EROFS`)}streamWrite(){throw N(`EROFS`)}}return t}function nl(e){class t extends e{async exists(e){return this.existsSync(e)}async rename(e,t){return this.renameSync(e,t)}async stat(e){return this.statSync(e)}async touch(e,t){return this.touchSync(e,t)}async createFile(e,t){return this.createFileSync(e,t)}async unlink(e){return this.unlinkSync(e)}async rmdir(e){return this.rmdirSync(e)}async mkdir(e,t){return this.mkdirSync(e,t)}async readdir(e){return this.readdirSync(e)}async link(e,t){return this.linkSync(e,t)}async sync(){return this.syncSync()}async read(e,t,n,r){return this.readSync(e,t,n,r)}async write(e,t,n){return this.writeSync(e,t,n)}}return t}var rl=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},il=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},al;(function(e){e[e.RealTime=1]=`RealTime`,e[e.PreAlloc=2]=`PreAlloc`,e[e.Immutable=8]=`Immutable`,e[e.Append=16]=`Append`,e[e.Sync=32]=`Sync`,e[e.NoAtime=64]=`NoAtime`,e[e.NoDump=128]=`NoDump`,e[e.RtInherit=256]=`RtInherit`,e[e.ProjInherit=512]=`ProjInherit`,e[e.NoSymlinks=1024]=`NoSymlinks`,e[e.ExtSize=2048]=`ExtSize`,e[e.ExtSzInherit=4096]=`ExtSzInherit`,e[e.NoDefrag=8192]=`NoDefrag`,e[e.FileStream=16384]=`FileStream`,e[e.Dax=32768]=`Dax`,e[e.CowExtSize=65536]=`CowExtSize`,e[e.HasAttr=2147483648]=`HasAttr`})(al||={});var ol=(()=>{var e,t,n,r,a;let o=[Rt()],s,c=[],l,u=Vt(i),d,f=[],p=[],m,h=[],g=[],v,y=[],b=[],x,S=[],C=[],w,T=[],ee=[],E,D=[],k=[];var A=class extends u{static{l=this}static{let i=typeof Symbol==`function`&&Symbol.metadata?Object.create(u[Symbol.metadata]??null):void 0;d=[(e=U).uint32.bind(e)],m=[(t=U).uint32.bind(t)],v=[(n=U).uint32.bind(n)],x=[(r=U).uint32.bind(r)],w=[(a=U).uint32.bind(a)],E=[U.char(8)],rl(this,null,d,{kind:`accessor`,name:`xflags`,static:!1,private:!1,access:{has:e=>`xflags`in e,get:e=>e.xflags,set:(e,t)=>{e.xflags=t}},metadata:i},f,p),rl(this,null,m,{kind:`accessor`,name:`extsize`,static:!1,private:!1,access:{has:e=>`extsize`in e,get:e=>e.extsize,set:(e,t)=>{e.extsize=t}},metadata:i},h,g),rl(this,null,v,{kind:`accessor`,name:`nextents`,static:!1,private:!1,access:{has:e=>`nextents`in e,get:e=>e.nextents,set:(e,t)=>{e.nextents=t}},metadata:i},y,b),rl(this,null,x,{kind:`accessor`,name:`projid`,static:!1,private:!1,access:{has:e=>`projid`in e,get:e=>e.projid,set:(e,t)=>{e.projid=t}},metadata:i},S,C),rl(this,null,w,{kind:`accessor`,name:`cowextsize`,static:!1,private:!1,access:{has:e=>`cowextsize`in e,get:e=>e.cowextsize,set:(e,t)=>{e.cowextsize=t}},metadata:i},T,ee),rl(this,null,E,{kind:`accessor`,name:`pad`,static:!1,private:!1,access:{has:e=>`pad`in e,get:e=>e.pad,set:(e,t)=>{e.pad=t}},metadata:i},D,k),rl(null,s={value:l},o,{kind:`class`,name:l.name,metadata:i},null,c),A=l=s.value,i&&Object.defineProperty(l,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:i})}static name=`fsxattr`;#e=il(this,f,void 0);get xflags(){return this.#e}set xflags(e){this.#e=e}#t=(il(this,p),il(this,h,void 0));get extsize(){return this.#t}set extsize(e){this.#t=e}#n=(il(this,g),il(this,y,void 0));get nextents(){return this.#n}set nextents(e){this.#n=e}#r=(il(this,b),il(this,S,void 0));get projid(){return this.#r}set projid(e){this.#r=e}#i=(il(this,C),il(this,T,void 0));get cowextsize(){return this.#i}set cowextsize(e){this.#i=e}#a=(il(this,ee),il(this,D,[]));get pad(){return this.#a}set pad(e){this.#a=e}constructor(e=_(new j(O.EINVAL,`fsxattr must be initialized with an inode`))){super(new ArrayBuffer(H(A))),il(this,k),this.extsize=e.size,this.nextents=1,this.projid=e.uid,this.cowextsize=e.size;for(let t of Object.keys(Tn))e.flags&Tn[t]&&t in al&&(this.xflags|=al[t])}static{il(l,c)}};return A=l})(),sl;(function(e){e[e.SecureRm=1]=`SecureRm`,e[e.Undelete=2]=`Undelete`,e[e.Compress=4]=`Compress`,e[e.Sync=8]=`Sync`,e[e.Immutable=16]=`Immutable`,e[e.Append=32]=`Append`,e[e.NoDump=64]=`NoDump`,e[e.NoAtime=128]=`NoAtime`,e[e.Dirty=256]=`Dirty`,e[e.CompressBlk=512]=`CompressBlk`,e[e.NoCompress=1024]=`NoCompress`,e[e.Encrypt=2048]=`Encrypt`,e[e.Btree=4096]=`Btree`,e[e.Index=4096]=`Index`,e[e.IMagic=8192]=`IMagic`,e[e.JournalData=16384]=`JournalData`,e[e.NoTail=32768]=`NoTail`,e[e.DirSync=65536]=`DirSync`,e[e.TopDir=131072]=`TopDir`,e[e.HugeFile=262144]=`HugeFile`,e[e.Extent=524288]=`Extent`,e[e.Verity=1048576]=`Verity`,e[e.EaInode=2097152]=`EaInode`,e[e.EofBlocks=4194304]=`EofBlocks`,e[e.NoCow=8388608]=`NoCow`,e[e.Dax=33554432]=`Dax`,e[e.InlineData=268435456]=`InlineData`,e[e.ProjInherit=536870912]=`ProjInherit`,e[e.CaseFold=1073741824]=`CaseFold`,e[e.Reserved=2147483648]=`Reserved`})(sl||={});var cl;(function(e){e[e.GetFlags=2148034049]=`GetFlags`,e[e.SetFlags=1074292226]=`SetFlags`,e[e.GetVersion=2148038145]=`GetVersion`,e[e.SetVersion=1074296322]=`SetVersion`,e[e.Fiemap=3223348747]=`Fiemap`,e[e.GetXattr=2149341215]=`GetXattr`,e[e.SetXattr=1075599392]=`SetXattr`,e[e.GetLabel=2164298801]=`GetLabel`,e[e.SetLabel=1090556978]=`SetLabel`,e[e.GetUUID=2148603136]=`GetUUID`,e[e.GetSysfsPath=2155943169]=`GetSysfsPath`})(cl||={});var ll;(function(e){e[e.GetFlags=2147771905]=`GetFlags`,e[e.SetFlags=1074030082]=`SetFlags`,e[e.GetVersion=2147776001]=`GetVersion`,e[e.SetVersion=1074034178]=`SetVersion`})(ll||={});async function ul(e,t,...n){e=W(e);let{fs:r,path:i}=Or(e,this);try{let e=new J(await r.stat(i));switch(t){case cl.GetFlags:case ll.GetFlags:return e.flags;case cl.SetFlags:case ll.SetFlags:e.flags=n[0],await r.touch(i,e);return;case cl.GetVersion:case ll.GetVersion:return e.version;case cl.SetVersion:case ll.SetVersion:e.version=n[0],await r.touch(i,e);return;case cl.Fiemap:break;case cl.GetXattr:return new ol(e);case cl.SetXattr:break;case cl.GetLabel:return r.label;case cl.SetLabel:r.label=n[0];return;case cl.GetUUID:return r.uuid;case cl.GetSysfsPath:return`/sys/fs/${r.name}/${r.uuid}`}}catch(t){throw A(Object.assign(t,{syscall:`ioctl`,path:e}))}throw M(`ENOTSUP`,`ioctl`,e)}function dl(e,t,...n){e=W(e);let{fs:r,path:i}=Or(e,this);try{let e=new J(r.statSync(i));switch(t){case cl.GetFlags:case ll.GetFlags:return e.flags;case cl.SetFlags:case ll.SetFlags:e.flags=n[0],r.touchSync(i,e);return;case cl.GetVersion:case ll.GetVersion:return e.version;case cl.SetVersion:case ll.SetVersion:e.version=n[0],r.touchSync(i,e);return;case cl.Fiemap:break;case cl.GetXattr:return new ol(e);case cl.SetXattr:break;case cl.GetLabel:return r.label;case cl.SetLabel:r.label=n[0];return;case cl.GetUUID:return r.uuid;case cl.GetSysfsPath:return`/sys/fs/${r.name}/${r.uuid}`}}catch(t){throw A(Object.assign(t,{syscall:`ioctl`,path:e}))}throw M(`ENOTSUP`,`ioctl`,e)}var fl=t({BigIntStatsFs:()=>yn,Dir:()=>Hr,Dirent:()=>Vr,IOC:()=>cl,IOC32:()=>ll,ReadStream:()=>ja,Stats:()=>hn,StatsFs:()=>vn,WriteStream:()=>Ma,access:()=>bc,accessSync:()=>Ti,appendFile:()=>Xs,appendFileSync:()=>ti,chmod:()=>hc,chmodSync:()=>bi,chown:()=>pc,chownSync:()=>vi,chroot:()=>Ar,close:()=>Qs,closeSync:()=>ri,constants:()=>Fe,copyFile:()=>kc,copyFileSync:()=>ki,cp:()=>Nc,cpSync:()=>Ni,createReadStream:()=>Tc,createWriteStream:()=>Ec,exists:()=>Hs,existsSync:()=>Kr,fchmod:()=>ac,fchmodSync:()=>ui,fchown:()=>ic,fchownSync:()=>li,fdatasync:()=>tc,fdatasyncSync:()=>oi,fstat:()=>Zs,fstatSync:()=>ni,fsync:()=>ec,fsyncSync:()=>ai,ftruncate:()=>$s,ftruncateSync:()=>ii,futimes:()=>oc,futimesSync:()=>di,glob:()=>Ic,globSync:()=>Fi,ioctl:()=>ul,ioctlSync:()=>dl,lchmod:()=>gc,lchmodSync:()=>xi,lchown:()=>mc,lchownSync:()=>yi,link:()=>uc,linkSync:()=>hi,lopenSync:()=>Qr,lstat:()=>Ws,lstatSync:()=>Jr,lutimes:()=>vc,lutimesSync:()=>Ci,mkdir:()=>cc,mkdirSync:()=>pi,mkdtemp:()=>Oc,mkdtempDisposableSync:()=>Oi,mkdtempSync:()=>Di,mount:()=>Er,open:()=>qs,openAsBlob:()=>Fc,openSync:()=>Zr,opendir:()=>Mc,opendirSync:()=>Mi,promises:()=>Na,read:()=>rc,readFile:()=>Js,readFileSync:()=>$r,readSync:()=>ci,readdir:()=>lc,readdirSync:()=>mi,readlink:()=>fc,readlinkSync:()=>_i,readv:()=>Ac,readvSync:()=>Ai,realpath:()=>yc,realpathSync:()=>wi,rename:()=>Vs,renameSync:()=>Gr,rm:()=>Dc,rmSync:()=>Ei,rmdir:()=>sc,rmdirSync:()=>fi,stat:()=>Us,statSync:()=>qr,statfs:()=>Pc,statfsSync:()=>Pi,symlink:()=>dc,symlinkSync:()=>gi,truncate:()=>Gs,truncateSync:()=>Yr,umount:()=>Dr,unlink:()=>Ks,unlinkSync:()=>Xr,unwatchFile:()=>Cc,utimes:()=>_c,utimesSync:()=>Si,watch:()=>wc,watchFile:()=>Sc,write:()=>nc,writeFile:()=>Ys,writeFileSync:()=>ei,writeSync:()=>si,writev:()=>jc,writevSync:()=>ji,xattr:()=>Rc}),pl=t({DirType:()=>lr,Dirent:()=>fr,Handle:()=>pr,IOC:()=>cl,IOC32:()=>ll,chroot:()=>Ar,deleteFD:()=>gr,dtToIf:()=>dr,fromFD:()=>hr,ifToDt:()=>ur,ioctl:()=>ul,ioctlSync:()=>dl,link:()=>Yi,mkdir:()=>Ki,mount:()=>Er,open:()=>Wi,readdir:()=>qi,readlink:()=>Gi,rename:()=>Ji,resolve:()=>Ui,stat:()=>Xi,sync:()=>Mr,toFD:()=>mr,umount:()=>Dr,xattr:()=>Rc}),ml={name:`@zenfs/core`,version:`2.5.6`,description:`A filesystem, anywhere`,funding:{type:`individual`,url:`https://github.com/sponsors/james-pre`},main:`dist/index.js`,types:`dist/index.d.ts`,keywords:[`filesystem`,`node`,`storage`],bin:{"make-index":`scripts/make-index.js`,"zenfs-test":`scripts/test.js`,zci:`scripts/ci-cli.js`},files:[`dist`,`tests`,`types`,`license.md`,`eslint.shared.js`],type:`module`,homepage:`https://zenfs.dev/core`,author:`James Prevett <jp@jamespre.dev> (https://jamespre.dev)`,contributors:[`John Vilk <jvilk@cs.umass.edu>`],license:`LGPL-3.0-or-later`,repository:{type:`git`,url:`git+https://github.com/zen-fs/core.git`},bugs:{url:`https://github.com/zen-fs/core/issues`},engines:{node:`>= 18`},exports:{".":`./dist/index.js`,"./*":`./dist/*`,"./emulation/*":`./dist/node/*`,"./promises":`./dist/node/promises.js`,"./readline":`./dist/node/readline.js`,"./constants":`./dist/constants.js`,"./path":`./dist/path.js`,"./eslint":`./eslint.shared.js`,"./tests/*":`./tests/*`,"./types/*":`./types/*`},publishConfig:{access:`public`,provenance:!0},scripts:{format:`prettier --write .`,"format:check":`prettier --check .`,"spdx:check":`npx lice -a src tests/*.ts tests/**/*.test.ts`,"spdx:fix":`npx lice -aw src tests/*.ts tests/**/*.test.ts`,lint:`eslint src tests`,test:`npx zenfs-test --clean; npx zenfs-test -abcp; tests/fetch/run.sh; npx zenfs-test --report`,build:`tsc -p tsconfig.json`,"build:docs":`typedoc`,dev:`tsc -p tsconfig.json --watch`,prepublishOnly:`npm run build`},dependencies:{"@types/node":`^25.2.0`,buffer:`^6.0.3`,eventemitter3:`^5.0.1`,kerium:`^1.3.4`,memium:`^0.4.0`,"readable-stream":`^4.5.2`,utilium:`^3.0.0`},devDependencies:{"@octokit/action":`^8.0.4`,c8:`^10.1.3`,eslint:`^9.15.0`,globals:`^17.3.0`,prettier:`^3.2.5`,tsx:`^4.19.1`,typedoc:`^0.28.18`,typescript:`^6.0.0`,"typescript-eslint":`^8.58.0`}},hl=t({Async:()=>vs,AsyncMapTransaction:()=>qn,AsyncTransaction:()=>Vn,Attributes:()=>Cn,BigIntStatsFs:()=>yn,CopyOnWrite:()=>Lo,CopyOnWriteFS:()=>Io,DeviceFS:()=>Xn,Dir:()=>Hr,Dirent:()=>Vr,ErrnoError:()=>xr,Fetch:()=>qo,FetchFS:()=>Ko,FileSystem:()=>Rn,IOC:()=>cl,IOC32:()=>ll,InMemory:()=>Yn,InMemoryStore:()=>Jn,Index:()=>In,IndexFS:()=>Wo,Inode:()=>J,InodeFlags:()=>Tn,Journal:()=>Fo,MetadataBlock:()=>Ms,MutexLock:()=>Qc,Mutexed:()=>el,Passthrough:()=>Zo,PassthroughFS:()=>Xo,Port:()=>Ss,PortFS:()=>ys,RPC:()=>Qo,ReadStream:()=>ja,Readonly:()=>tl,SingleBuffer:()=>zs,SingleBufferStore:()=>Rs,Stats:()=>hn,StatsFs:()=>vn,StoreFS:()=>Gn,SuperBlock:()=>Fs,Sync:()=>nl,SyncMapTransaction:()=>Kn,SyncTransaction:()=>Bn,Transaction:()=>zn,WrappedTransaction:()=>Hn,WriteStream:()=>Ma,_MutexedFS:()=>$c,_asyncFSKeys:()=>_s,_chown:()=>Fn,_fnOpt:()=>we,_inode_fields:()=>wn,_inode_version:()=>5,_tempDirName:()=>Qt,access:()=>bc,accessSync:()=>Ti,addDevice:()=>Eo,appendFile:()=>Xs,appendFileSync:()=>ti,attachFS:()=>bs,bindContext:()=>Xc,boundContexts:()=>Yc,checkOptions:()=>Ee,chmod:()=>hc,chmodSync:()=>bi,chown:()=>pc,chownSync:()=>vi,chroot:()=>Ar,close:()=>Qs,closeSync:()=>ri,configure:()=>Oo,configureFileSystem:()=>_o,configureSingle:()=>So,configureSingleSync:()=>Co,configureSync:()=>ko,constants:()=>Fe,contextOf:()=>Me,copyFile:()=>kc,copyFileSync:()=>ki,cp:()=>Nc,cpSync:()=>Ni,createChildContext:()=>Pe,createCredentials:()=>Oe,createReadStream:()=>Tc,createWriteStream:()=>Ec,credentialsAllowRoot:()=>ke,decodeDirListing:()=>Gt,default:()=>gl,defaultContext:()=>je,detachFS:()=>xs,devices:()=>rr,encodeDirListing:()=>Kt,exists:()=>Hs,existsSync:()=>Kr,fchmod:()=>ac,fchmodSync:()=>ui,fchown:()=>ic,fchownSync:()=>li,fdatasync:()=>tc,fdatasyncSync:()=>oi,fs:()=>fl,fstat:()=>Zs,fstatSync:()=>ni,fsync:()=>ec,fsyncSync:()=>ai,ftruncate:()=>$s,ftruncateSync:()=>ii,fullDevice:()=>er,futimes:()=>oc,futimesSync:()=>di,glob:()=>Ic,globSync:()=>Fi,globToRegex:()=>Xt,hasAccess:()=>Y,ioctl:()=>ul,ioctlSync:()=>dl,isBackend:()=>Ce,isBackendConfig:()=>De,isBlockDevice:()=>Mn,isCharacterDevice:()=>Nn,isDirectory:()=>kn,isFIFO:()=>Pn,isFile:()=>On,isSocket:()=>jn,isSymbolicLink:()=>An,lchmod:()=>gc,lchmodSync:()=>xi,lchown:()=>mc,lchownSync:()=>yi,link:()=>uc,linkSync:()=>hi,log:()=>te,lopenSync:()=>Qr,lstat:()=>Ws,lstatSync:()=>Jr,lutimes:()=>vc,lutimesSync:()=>Ci,mkdir:()=>cc,mkdirSync:()=>pi,mkdtemp:()=>Oc,mkdtempDisposableSync:()=>Oi,mkdtempSync:()=>Di,mount:()=>Er,mounts:()=>Tr,normalizeMode:()=>qt,normalizeOptions:()=>Yt,normalizePath:()=>W,normalizeTime:()=>Jt,nullDevice:()=>Qn,open:()=>qs,openAsBlob:()=>Fc,openSync:()=>Zr,opendir:()=>Mc,opendirSync:()=>Mi,promises:()=>Na,randomDevice:()=>tr,read:()=>rc,readFile:()=>Js,readFileSync:()=>$r,readSync:()=>ci,readdir:()=>lc,readdirSync:()=>mi,readlink:()=>fc,readlinkSync:()=>_i,readv:()=>Ac,readvSync:()=>Ai,realpath:()=>yc,realpathSync:()=>wi,rename:()=>Vs,renameSync:()=>Gr,resolveMountConfig:()=>bo,resolveMountConfigSync:()=>xo,resolveRemoteMount:()=>Cs,rm:()=>Dc,rmSync:()=>Ei,rmdir:()=>sc,rmdirSync:()=>fi,rootIno:()=>0,stat:()=>Us,statSync:()=>qr,statfs:()=>Pc,statfsSync:()=>Pi,symlink:()=>dc,symlinkSync:()=>gi,sync:()=>Ao,truncate:()=>Gs,truncateSync:()=>Yr,umount:()=>Dr,unlink:()=>Ks,unlinkSync:()=>Xr,unwatchFile:()=>Cc,userModifiableFlags:()=>Dn,userVisibleFlags:()=>En,utimes:()=>_c,utimesSync:()=>Si,version:()=>1,vfs:()=>pl,waitOnline:()=>Zt,watch:()=>wc,watchFile:()=>Sc,withExceptionContext:()=>wr,withPath:()=>Sr,wrap:()=>Cr,write:()=>nc,writeFile:()=>Ys,writeFileSync:()=>ei,writeSync:()=>si,writev:()=>jc,writevSync:()=>ji,xattr:()=>Rc,zeroDevice:()=>$n}),gl=fl;globalThis.__zenfs__=Object.assign(Object.create(null),fl,{_version:ml.version});export{z as C,ee as D,N as E,T as O,ce as S,j as T,Je as _,Yn as a,se as b,zn as c,wn as d,cn as f,Ge as g,Xe as h,Wo as i,_ as k,Rn as l,G as m,nl as n,Kn as o,K as p,vs as r,Gn as s,hl as t,J as u,et as v,O as w,L as x,$e as y};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{C as e,D as t,E as n,O as r,S as i,T as a,_ as o,a as s,b as c,c as l,d as u,f as d,g as f,h as p,i as m,k as h,l as g,m as _,n as v,o as y,p as b,r as x,s as S,u as C,w,x as T}from"./dist-
|
|
1
|
+
import{C as e,D as t,E as n,O as r,S as i,T as a,_ as o,a as s,b as c,c as l,d as u,f as d,g as f,h as p,i as m,k as h,l as g,m as _,n as v,o as y,p as b,r as x,s as S,u as C,w,x as T}from"./dist-C6lFkA1A2.js";function E(e){switch(e.name){case`TypeMismatchError`:return`EPERM`;case`IndexSizeError`:case`HierarchyRequestError`:case`InvalidCharacterError`:case`InvalidStateError`:case`SyntaxError`:case`NamespaceError`:case`ConstraintError`:case`VersionError`:case`URLMismatchError`:case`InvalidNodeTypeError`:return`EINVAL`;case`WrongDocumentError`:return`EXDEV`;case`NoModificationAllowedError`:case`InvalidModificationError`:case`InvalidAccessError`:case`SecurityError`:case`NotAllowedError`:return`EACCES`;case`NotFoundError`:return`ENOENT`;case`NotSupportedError`:return`ENOTSUP`;case`InUseAttributeError`:return`EBUSY`;case`NetworkError`:return`ENETDOWN`;case`AbortError`:return`EINTR`;case`QuotaExceededError`:return`ENOSPC`;case`TimeoutError`:return`ETIMEDOUT`;case`ReadOnlyError`:return`EROFS`;default:return`EIO`}}function D(e,t){if(e instanceof a)return e;let n=new a(e instanceof DOMException?w[E(e)]:w.EIO,e.message);return n.stack=e.stack,Error.captureStackTrace?.(n,D),n.cause=e.cause,n}function O(e){return typeof e==`object`&&!!e&&e.constructor.name==`SharedArrayBuffer`}function k(e){return e instanceof ArrayBuffer?e.resizable:O(e)?e.growable:!1}function A(e,t){return e.kind==t}var j=class extends x(m){async _loadHandles(e,t){for await(let[n,r]of t.entries()){let t=_(e,n);this._handles.set(t,r),A(r,`directory`)&&await this._loadHandles(t,r)}}async _loadMetadata(e){if(this._handles.set(`/`,this.root),await this._loadHandles(`/`,this.root),e){let t=await(await(await this.get(`file`,e)).getFile()).text(),n=JSON.parse(t);this.index.fromJSON(n);return}for(let[e,t]of this._handles){if(A(t,`file`)){let{lastModified:n,size:r}=await t.getFile();this.index.set(e,new C({mode:420|o,size:r,mtimeMs:n}));continue}if(!A(t,`directory`))throw n(`EIO`,`Invalid handle`);this.index.set(e,new C({mode:511|p,size:0}))}}constructor(e,t=!1){super(2003133025,`webaccessfs`),this.root=e,this.disableHandleCache=t,this._handles=new Map,this._sync=s.create({label:`accessfs-cache`}),this.attributes.set(`no_buffer_resize`,!0),t&&this.attributes.set(`no_handle_cache`,!0)}async stat(e){try{return await super.stat(e)}catch(t){if(t.code!=`ENOENT`)throw t;let n=await this.get(null,e),r=new C;if(A(n,`file`)){let e=await n.getFile();r.update({mode:420|o,size:e.size,mtimeMs:e.lastModified})}else r.update({mode:p|511,size:0});return this.index.set(e,r),r}}async readdir(e){let t=await this.get(`directory`,e);return await Array.fromAsync(t.keys())}async remove(e){let t=await this.get(`directory`,b(e));for(let t of this._handles.keys())b(t)==e&&this._handles.delete(t);this._handles.delete(e),await t.removeEntry(d(e),{recursive:!0}).catch(t=>h(D(t,e)))}removeSync(){throw T(n(`ENOSYS`))}async read(e,t,r,i){if(i<=r)return;let a=await(await(await this.get(`file`,e)).getFile()).arrayBuffer();if(a.byteLength<i-r)throw c(n(`EIO`,[`Unexpected mismatch in file data size. This should not happen.`,`tried to read ${i-r} bytes but the file is ${a.byteLength} bytes.`,`path: ${e}`].join(`
|
|
2
2
|
`+` `.repeat(24))));t.set(new Uint8Array(a,r,i-r))}async write(e,t,r){if(k(t.buffer)||O(t.buffer)){let e=new Uint8Array(new ArrayBuffer(t.byteLength),t.byteOffset,t.byteLength);e.set(t),t=e}let i=this.index.get(e);if(!i)throw n(`ENOENT`);let a=(i.mode&f)==p,o;try{o=await this.get(a?`directory`:`file`,e)}catch{o=await(await this.get(`directory`,b(e)))[a?`getDirectoryHandle`:`getFileHandle`](d(e),{create:!0}).catch(t=>h(D(t,e))),this.disableHandleCache||this._handles.set(e,o)}if(a)return;if(A(o,`directory`)){T(n(`EIO`,`Mismatch in entry kind on write`));return}let s=await o.createWritable({keepExistingData:!0});try{r<i.size&&await s.seek(r)}catch{await s.write({type:`seek`,position:r})}await s.write(t),await s.close();let{size:c,lastModified:l}=await o.getFile();i.update({size:c,mtimeMs:l}),this.index.set(e,i)}async writeFile(e,t){return this.write(e,t,0)}async _mkdir(e){let t=await(await this.get(`directory`,b(e))).getDirectoryHandle(d(e),{create:!0}).catch(t=>h(D(t,e)));this.disableHandleCache||this._handles.set(e,t)}async get(e=null,t){let r=this._handles.get(t);if(!this.disableHandleCache&&r){if(e&&!A(r,e))throw n(e==`directory`?`ENOTDIR`:`EISDIR`);return r}if(t==`/`)return this.root;let i=t.slice(1).split(`/`),a=this.root;for(let e=0;e<i.length-1;++e)a=await a.getDirectoryHandle(i[e]).catch(e=>h(D(e,t)));try{let n=await a[e==`file`?`getFileHandle`:`getDirectoryHandle`](i.at(-1));return this.disableHandleCache||this._handles.set(t,n),n}catch(r){if(r.name!=`TypeMismatchError`)throw D(r,t);if(e===null){let e=await a.getFileHandle(i.at(-1)).catch(e=>h(D(e,t)));return this.disableHandleCache||this._handles.set(t,e),e}else throw n(e==`file`?`EISDIR`:`ENOTDIR`)}}},M={name:`WebAccess`,options:{handle:{type:`object`,required:!0},metadata:{type:`string`,required:!1},disableHandleCache:{type:`boolean`,required:!1}},async create(e){let t=new j(e.handle,e.disableHandleCache);return await t._loadMetadata(e.metadata),t}};function N(e){return new Promise((t,n)=>{e.onsuccess=()=>t(e.result),e.onerror=t=>{t.preventDefault(),n(D(e.error))}})}var P=class extends l{async(e){this.asyncDone=this.asyncDone.then(()=>e)}constructor(e,t){super(t),this.tx=e,this.store=t,this.asyncDone=Promise.resolve(),this._idb=e.objectStore(t.name)}async keys(){return(await N(this._idb.getAllKeys())).map(Number)}async get(e){let t=await N(this._idb.get(e));return t&&this.store.cache.set(e,new Uint8Array(t)),t}getSync(e,t,n){if(!this.store.cache.has(e))return;let r=new Uint8Array(this.store.cache.get(e));return n??=r.byteLength,r.subarray(t,n)}async set(e,t){this.store.cache.set(e,new Uint8Array(t)),await N(this._idb.put(t,e))}setSync(e,t){this.async(this.set(e,t))}remove(e){return this.store.cache.delete(e),N(this._idb.delete(e))}removeSync(e){this.store.cache.delete(e),this.async(this.remove(e))}async commit(){await this.asyncDone;let{promise:e,resolve:t,reject:n}=Promise.withResolvers();return this.tx.oncomplete=()=>t(),this.tx.onerror=()=>n(D(this.tx.error)),this.tx.commit(),e}async abort(){await this.asyncDone;let{promise:e,resolve:t,reject:n}=Promise.withResolvers();return this.tx.onabort=()=>t(),this.tx.onerror=()=>n(D(this.tx.error)),this.tx.abort(),e}};async function F(t,n=globalThis.indexedDB){let r=n.open(t);return r.onupgradeneeded=()=>{let n=r.result;n.objectStoreNames.contains(t)&&(e(`Found unexpected object store: `+t),n.deleteObjectStore(t)),n.createObjectStore(t)},await N(r)}var I=class{constructor(e){this.db=e,this.cache=new Map}sync(){return Promise.resolve()}get name(){return this.db.name}transaction(){return new P(this.db.transaction(this.name,`readwrite`),this)}},L=new WeakMap;async function R(e){if(!(e instanceof IDBFactory))return!1;try{return(await N(e.open(`__zenfs_test`))).close(),!0}catch{return!1}finally{e?.deleteDatabase(`__zenfs_test`)}}var z={name:`IndexedDB`,options:{storeName:{type:`string`,required:!1},idbFactory:{type:`object`,required:!1}},async isAvailable({idbFactory:e=globalThis.indexedDB}){if(L.has(e))return L.get(e);let t=R(e);return L.set(e,t),t},async create(e){let t=new I(await F(e.storeName||`zenfs`,e.idbFactory)),n=new S(t);if(e?.disableAsyncCache)return i(`Async preloading disabled for IndexedDB`),n;let r=t.transaction();for(let e of await r.keys())await r.get(e);return n}},B=class{get name(){return V.name}constructor(e){this.storage=e}clear(){this.storage.clear()}clearSync(){this.storage.clear()}async sync(){}transaction(){return new y(this)}keys(){return Object.keys(this.storage).map(e=>Number(e))}get(e){let t=this.storage.getItem(e.toString());if(typeof t==`string`)return r(t)}set(e,r){try{this.storage.setItem(e.toString(),t(r))}catch{throw n(`ENOSPC`)}}delete(e){try{this.storage.removeItem(e.toString())}catch(t){throw n(`EIO`,`Unable to delete '${e}': ${t}`)}}},V={name:`WebStorage`,options:{storage:{type:`object`,required:!1}},isAvailable(e){return(e?.storage??globalThis.localStorage)instanceof globalThis.Storage},create({storage:e=globalThis.localStorage}){return new S(new B(e))}};function H(e){let t={};for(let n of u){let r=e.getAttribute(n);r!=null&&(t[n]=parseInt(r,16))}return new C(t)}function U(e,t){for(let n of Object.keys(t))!(n in u)||t[n]===void 0||e.setAttribute(n,t[n].toString(16))}function W(e,t=!1){let n;try{let r=t?e.textContent:e.getAttribute(`paths`);n=JSON.parse(r||`[]`)}catch{n=[]}return n}var G=class extends v(g){constructor(e=new DOMParser().parseFromString(`<fs></fs>`,`application/xml`).documentElement){super(544763244,`xmltmpfs`),this.root=e;try{this.mkdirSync(`/`,{uid:0,gid:0,mode:511})}catch(e){let t=e;if(t.code!=`EEXIST`)throw t}}renameSync(e,t){let n=this.get(`rename`,e);this.remove(`rename`,n,e),this.add(`rename`,n,t)}statSync(e){return H(this.get(`stat`,e))}createFileSync(e,t){let n=this.statSync(b(e)),r=new C({mode:t.mode|o,uid:n.mode&2048?n.uid:t.uid,gid:n.mode&1024?n.gid:t.gid});return this.create(`createFile`,e,r),r}unlinkSync(e){let t=this.get(`unlink`,e);if(H(t).mode&16384)throw n(`EISDIR`);this.remove(`unlink`,t,e)}rmdirSync(e){let t=this.get(`rmdir`,e);if(t.textContent?.length)throw n(`ENOTEMPTY`);if(!(H(t).mode&16384))throw n(`ENOTDIR`);this.remove(`rmdir`,t,e)}mkdirSync(e,t){let n=this.statSync(b(e)),r=new C({mode:t.mode|p,uid:n.mode&2048?n.uid:t.uid,gid:n.mode&1024?n.gid:t.gid});return this.create(`mkdir`,e,r).textContent=`[]`,r}readdirSync(e){let t=this.get(`readdir`,e);if(!(H(t).mode&16384))throw n(`ENOTDIR`);try{return JSON.parse(t.textContent)}catch(e){throw n(`EIO`,`Invalid directory listing: `+e)}}linkSync(e,t){let n=this.get(`link`,e);this.add(`link`,n,t)}touchSync(e,t){U(this.get(`touch`,e),t)}syncSync(){}readSync(e,t,n,i){let a=r(this.get(`read`,e).textContent.slice(n,i));t.set(a)}writeSync(e,n,r){let i=this.get(`write`,e),a=t(n),o=i.textContent.slice(r+a.length);i.textContent=i.textContent.slice(0,r)+a+o}toString(){return new XMLSerializer().serializeToString(this.root)}get(e,t){let r=this.root.children;if(!r)throw n(`EIO`);for(let e=0;e<r.length;e++)if(W(r[e]).includes(t))return r[e];throw n(`ENOENT`)}create(e,t,r){if(this.existsSync(t))throw n(`EEXIST`);let i=document.createElement(`file`);return this.add(e,i,t),U(i,new C({...r,uid:r.mode})),this.root.append(i),i}add(e,t,n,r=!1){let i=W(t,r);if(i.push(n),r){t.textContent=JSON.stringify(i);return}if(t.setAttribute(`paths`,JSON.stringify(i)),t.setAttribute(`nlink`,i.length.toString(16)),n!=`/`){let t=this.get(e,b(n));this.add(e,t,d(n),!0)}}remove(e,t,n,r=!1){let i=W(t,r),a=i.indexOf(n);if(a!=-1){if(i.splice(a,1),r){t.textContent=JSON.stringify(i);return}if(i.length?(t.setAttribute(`paths`,JSON.stringify(i)),t.setAttribute(`nlink`,i.length.toString(16))):t.remove(),n!=`/`){let t=this.get(e,b(n));this.remove(e,t,d(n),!0)}}}},K={name:`XML`,options:{root:{type:`object`,required:!1}},isAvailable(){return!0},create(e){return new G(e.root)}};export{z as IndexedDB,I as IndexedDBStore,P as IndexedDBTransaction,M as WebAccess,j as WebAccessFS,V as WebStorage,B as WebStorageStore,K as XML,G as XMLFS};
|