import{k as t,S as e,d as r,D as i,p as n,t as s,K as a}from"./worker.js";class o{name;mxPathname=64;_module;constructor(t,e){this.name=t,this._module=e}close(){}isReady(){return!0}hasAsyncMethod(t){return!1}xOpen(e,r,i,n,s){return t}xDelete(t,r,i){return e}xAccess(t,r,i,n){return e}xFullPathname(t,r,i,n){return e}xGetLastError(t,r,i){return e}xClose(t){return e}xRead(t,r,i,n,s){return e}xWrite(t,r,i,n,s){return e}xTruncate(t,r,i){return e}xSync(t,r){return e}xFileSize(t,r){return e}xLock(t,r){return e}xUnlock(t,r){return e}xCheckReservedLock(t,r){return e}xFileControl(t,e,i){return r}xSectorSize(t){return 512}xDeviceCharacteristics(t){return 0}}const h=Object.getPrototypeOf(async function(){}).constructor;class u extends o{constructor(t,e){super(t,e)}hasAsyncMethod(t){return this[`j${t.slice(1)}`]instanceof h}getFilename(t){throw new Error("unimplemented")}jOpen(e,r,i,n){return t}jDelete(t,r){return e}jAccess(t,r,i){return e}jFullPathname(t,r){const{read:n,written:s}=(new TextEncoder).encodeInto(t,r);return n=r.length?i:(r[s]=0,e)}jGetLastError(t){return e}jClose(t){return e}jRead(t,e,r){return e.fill(0),n}jWrite(t,e,r){return s}jTruncate(t,r){return e}jSync(t,r){return e}jFileSize(t,r){return e}jLock(t,r){return e}jUnlock(t,r){return e}jCheckReservedLock(t,r){return r.setInt32(0,0,!0),e}jFileControl(t,e,i){return r}jSectorSize(t){return super.xSectorSize(t)}jDeviceCharacteristics(t){return 0}xOpen(t,e,r,i,n){const s=this.#t(e,i),a=this.#e("Int32",n);return this.log?.("jOpen",s,r,"0x"+i.toString(16)),this.jOpen(s,r,i,a)}xRandomness(t,e,r){const i=new Uint8Array(e);crypto.getRandomValues(i);const n=r;return this._module.HEAPU8.set(i,n),e}xCurrentTimeInt64(t,r){const i=this.#e("BigInt64",r),n=210866760000000n+BigInt(Date.now());return i.setBigInt64(0,n,!0),e}xDelete(t,e,r){const i=this._module.UTF8ToString(e);return this.log?.("jDelete",i,r),this.jDelete(i,r)}xAccess(t,e,r,i){const n=this._module.UTF8ToString(e),s=this.#e("Int32",i);return this.log?.("jAccess",n,r),this.jAccess(n,r,s)}xFullPathname(t,e,r,i){const n=this._module.UTF8ToString(e),s=this._module.HEAPU8.subarray(i,i+r);return this.log?.("jFullPathname",n,r),this.jFullPathname(n,s)}xGetLastError(t,e,r){const i=this._module.HEAPU8.subarray(r,r+e);return this.log?.("jGetLastError",e),this.jGetLastError(i)}xClose(t){return this.log?.("jClose",t),this.jClose(t)}xRead(t,e,r,i,n){const s=this.#r(e,r),a=l(i,n);return this.log?.("jRead",t,r,a),this.jRead(t,s,a)}xWrite(t,e,r,i,n){const s=this.#r(e,r),a=l(i,n);return this.log?.("jWrite",t,s,a),this.jWrite(t,s,a)}xTruncate(t,e,r){const i=l(e,r);return this.log?.("jTruncate",t,i),this.jTruncate(t,i)}xSync(t,e){return this.log?.("jSync",t,e),this.jSync(t,e)}xFileSize(t,e){const r=this.#e("BigInt64",e);return this.log?.("jFileSize",t),this.jFileSize(t,r)}xLock(t,e){return this.log?.("jLock",t,e),this.jLock(t,e)}xUnlock(t,e){return this.log?.("jUnlock",t,e),this.jUnlock(t,e)}xCheckReservedLock(t,e){const r=this.#e("Int32",e);return this.log?.("jCheckReservedLock",t),this.jCheckReservedLock(t,r)}xFileControl(t,e,r){const i=new DataView(this._module.HEAPU8.buffer,this._module.HEAPU8.byteOffset+r);return this.log?.("jFileControl",t,e,i),this.jFileControl(t,e,i)}xSectorSize(t){return this.log?.("jSectorSize",t),this.jSectorSize(t)}xDeviceCharacteristics(t){return this.log?.("jDeviceCharacteristics",t),this.jDeviceCharacteristics(t)}#e(t,e){return new y(this._module,e,t)}#r(t,e){return new c(this._module,t,e)}#t(t,e){if(e&a){let e=t,r=1;const i=[];for(;r;){const t=this._module.HEAPU8[e++];if(t)i.push(t);else switch(this._module.HEAPU8[e]||(r=null),r){case 1:i.push("?".charCodeAt(0)),r=2;break;case 2:i.push("=".charCodeAt(0)),r=3;break;case 3:i.push("&".charCodeAt(0)),r=2}}return(new TextDecoder).decode(new Uint8Array(i))}return t?this._module.UTF8ToString(t):null}}function l(t,e){return 4294967296*e+t+(t<0?2**32:0)}class c{#i;#n=new Uint8Array;get#s(){return 0===this.#n.buffer.byteLength&&(this.#n=this.#i.HEAPU8.subarray(this.byteOffset,this.byteOffset+this.byteLength)),this.#n}constructor(t,e,r){this.#i=t,this.byteOffset=e,this.length=this.byteLength=r}get buffer(){return this.#s.buffer}at(t){return this.#s.at(t)}copyWithin(t,e,r){this.#s.copyWithin(t,e,r)}entries(){return this.#s.entries()}every(t){return this.#s.every(t)}fill(t,e,r){this.#s.fill(t,e,r)}filter(t){return this.#s.filter(t)}find(t){return this.#s.find(t)}findIndex(t){return this.#s.findIndex(t)}findLast(t){return this.#s.findLast(t)}findLastIndex(t){return this.#s.findLastIndex(t)}forEach(t){this.#s.forEach(t)}includes(t,e){return this.#s.includes(t,e)}indexOf(t,e){return this.#s.indexOf(t,e)}join(t){return this.#s.join(t)}keys(){return this.#s.keys()}lastIndexOf(t,e){return this.#s.lastIndexOf(t,e)}map(t){return this.#s.map(t)}reduce(t,e){return this.#s.reduce(t,e)}reduceRight(t,e){return this.#s.reduceRight(t,e)}reverse(){this.#s.reverse()}set(t,e){this.#s.set(t,e)}slice(t,e){return this.#s.slice(t,e)}some(t){return this.#s.some(t)}sort(t){this.#s.sort(t)}subarray(t,e){return this.#s.subarray(t,e)}toLocaleString(t,e){return this.#s.toLocaleString(t,e)}toReversed(){return this.#s.toReversed()}toSorted(t){return this.#s.toSorted(t)}toString(){return this.#s.toString()}values(){return this.#s.values()}with(t,e){return this.#s.with(t,e)}[Symbol.iterator](){return this.#s[Symbol.iterator]()}}class y{#i;#a;#o=new DataView(new ArrayBuffer(0));get#h(){return 0===this.#o.buffer.byteLength&&(this.#o=new DataView(this.#i.HEAPU8.buffer,this.#i.HEAPU8.byteOffset+this.byteOffset)),this.#o}constructor(t,e,r){this.#i=t,this.byteOffset=e,this.#a=r}get buffer(){return this.#h.buffer}get byteLength(){return"Int32"===this.#a?4:8}getInt32(t,e){if("Int32"!==this.#a)throw new Error("invalid type");if(!e)throw new Error("must be little endian");return this.#h.getInt32(t,e)}setInt32(t,e,r){if("Int32"!==this.#a)throw new Error("invalid type");if(!r)throw new Error("must be little endian");this.#h.setInt32(t,e,r)}getBigInt64(t,e){if("BigInt64"!==this.#a)throw new Error("invalid type");if(!e)throw new Error("must be little endian");return this.#h.getBigInt64(t,e)}setBigInt64(t,e,r){if("BigInt64"!==this.#a)throw new Error("invalid type");if(!r)throw new Error("must be little endian");this.#h.setBigInt64(t,e,r)}}export{u as F}; //# sourceMappingURL=FacadeVFS-d1ZDvud7.js.map