@gjsify/tsc 0.64.59 → 0.64.60-next.368

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/tsc.gjs.mjs +6 -6
  2. package/package.json +14 -13
package/dist/tsc.gjs.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env -S gjs -m
2
- if(globalThis.__gjsifyBundleUrl??=import.meta.url,Symbol.dispose||(Symbol.dispose=Symbol.for(`Symbol.dispose`)),Symbol.asyncDispose||(Symbol.asyncDispose=Symbol.for(`Symbol.asyncDispose`)),typeof Intl.Segmenter!=`function`&&(Intl.Segmenter=class Segmenter{constructor(){}resolvedOptions(){return{locale:`en`,granularity:`grapheme`}}segment(e){let t=String(e);return{input:t,[Symbol.iterator]:function*(){let e=0;for(let n of t)yield{segment:n,index:e,input:t},e+=n.length}}}}),globalThis.process===void 0){let e=globalThis.imports.system,t=globalThis.imports.gi.GLib,_h=e=>[0,0];_h.bigint=()=>0n;let n,_p=()=>{if(n)return n;n={platform:`linux`,arch:`x64`};try{if(t.getenv(`OS`)===`Windows_NT`||t.getenv(`SystemRoot`)){let e=(t.getenv(`PROCESSOR_ARCHITECTURE`)||``).toLowerCase();return n={platform:`win32`,arch:e===`arm64`?`arm64`:e===`x86`?`ia32`:`x64`},n}let e=t.spawn_sync(null,[`uname`,`-sm`],null,t.SpawnFlags.SEARCH_PATH,null);if(e&&e[0]&&e[1]){let t=new TextDecoder().decode(e[1]).trim().split(/\s+/);if(t.length>1){let e=t[0],r=t[t.length-1].toLowerCase();n={platform:e===`Linux`?`linux`:e===`Darwin`?`darwin`:/^CYGWIN/i.test(e)?`cygwin`:/^(MINGW|MSYS|Windows)/i.test(e)?`win32`:e.toLowerCase(),arch:r===`x86_64`||r===`amd64`?`x64`:r===`aarch64`||r===`arm64`?`arm64`:/^i[3-6]86$/.test(r)?`ia32`:r.startsWith(`arm`)?`arm`:r}}}}catch{}return n};globalThis.process={get platform(){return _p().platform},get arch(){return _p().arch},version:`v20.0.0`,env:new Proxy({},{get(e,n){return typeof n==`string`?t.getenv(n)??void 0:void 0},set(e,n,r){return typeof n==`string`&&t.setenv(n,String(r),!0),!0},has(e,n){return typeof n==`string`&&t.getenv(n)!==null},deleteProperty(e,n){return typeof n==`string`&&t.unsetenv(n),!0},ownKeys(){return t.listenv()??[]},getOwnPropertyDescriptor(e,n){let r=t.getenv(n);return r===null?void 0:{value:r,writable:!0,enumerable:!0,configurable:!0}}}),argv:e?.programArgs?[`gjs`,e.programInvocationName||``,...e.programArgs]:[`gjs`],versions:{gjs:(e=>`${Math.floor(e/1e4)}.${Math.floor(e%1e4/100)}.${e%100}`)(Number(e.version))},config:{},cwd(){return t.get_current_dir()||`/`},exit(t){e.exit(t??0)},stderr:{write(e){globalThis.printerr(e)}},stdout:{write(e){globalThis.print(e)}},stdin:null,exitCode:void 0,nextTick(e,...t){Promise.resolve().then(()=>e(...t))},hrtime:_h}}(function(){var e=globalThis.imports;if(!(!e||!e.gi)){var t;try{t=e.gi.GIRepository}catch{return}if(!(!t||!t.Repository||!t.Repository.dup_default)){var n=t.Repository.dup_default();if(!(!n||!n.prepend_search_path||!n.prepend_library_path)){var a=function(e){n.prepend_search_path(e),n.prepend_library_path(e)},r;try{r=e.gi.GLib}catch{}if(r&&r.file_test&&r.FileTest)for(var i=[[`/opt/homebrew/lib`,`/opt/homebrew/lib/girepository-1.0`,`/System/Library/CoreServices/SystemVersion.plist`],[`/opt/local/lib`,`/opt/local/lib/girepository-1.0`,`/System/Library/CoreServices/SystemVersion.plist`],[`/usr/local/lib`,`/usr/local/lib/girepository-1.0`,`/System/Library/CoreServices/SystemVersion.plist`]],o=i.length;o--;)r.file_test(i[o][2],r.FileTest.EXISTS)&&r.file_test(i[o][1],r.FileTest.IS_DIR)&&a(i[o][0])}}}})();import e from"gi://GLib?version=2.0";import t from"gi://Gio?version=2.0";import n from"gi://GioUnix?version=2.0";import"system";var r=Object.defineProperty,__name=(e,t)=>r(e,`name`,{value:t,configurable:!0}),i=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,s=Object.prototype.hasOwnProperty,__esmMin=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(e){throw n=[e],e}},__commonJSMin=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),__exportAll$3=(e,t)=>{let n={};for(var i in e)r(n,i,{get:e[i],enumerable:!0});return t||r(n,Symbol.toStringTag,{value:`Module`}),n},__copyProps=(e,t,n,c)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var l=o(t),u=0,d=l.length,f;u<d;u++)f=l[u],!s.call(e,f)&&f!==n&&r(e,f,{get:(e=>t[e]).bind(null,f),enumerable:!(c=i(t,f))||c.enumerable});return e},__toCommonJS=e=>s.call(e,`module.exports`)?e[`module.exports`]:__copyProps(r({},`__esModule`,{value:!0}),e),c=(e=>typeof require<`u`?require:typeof Proxy<`u`?new Proxy(e,{get:(e,t)=>(typeof require<`u`?require:e)[t]}):e)(function(e){if(typeof require<`u`)return require.apply(this,arguments);throw Error('Calling `require` for "'+e+"\" in an environment that doesn't expose the `require` function. See https://rolldown.rs/in-depth/bundling-cjs#require-external-modules for more details.")}),l,_encoder,u,FilePolyfill,d,f,p=__esmMin(()=>{_encoder=()=>l??=new TextEncoder,u=class BlobPolyfill{_parts;size;type;constructor(e,t){this._parts=e||[],this.type=t?.type||``,this.size=this._parts.reduce((e,t)=>typeof t==`string`?e+_encoder().encode(t).byteLength:t instanceof ArrayBuffer||ArrayBuffer.isView(t)?e+t.byteLength:t&&typeof t.size==`number`?e+t.size:e,0)}async bytes(){let e=await this.arrayBuffer();return new Uint8Array(e)}async text(){return new TextDecoder().decode(await this.arrayBuffer())}async arrayBuffer(){let e=[];for(let t of this._parts)if(typeof t==`string`)e.push(_encoder().encode(t));else if(t instanceof ArrayBuffer)e.push(new Uint8Array(t));else if(ArrayBuffer.isView(t))e.push(new Uint8Array(t.buffer,t.byteOffset,t.byteLength));else if(t&&typeof t.arrayBuffer==`function`){let n=await t.arrayBuffer();e.push(new Uint8Array(n))}let t=e.reduce((e,t)=>e+t.byteLength,0),n=new Uint8Array(t),r=0;for(let t of e)n.set(t,r),r+=t.byteLength;return n.buffer}slice(e,t,n){return new BlobPolyfill([],{type:n})}stream(){let e=this;return new ReadableStream({async pull(t){let n=await e.arrayBuffer();t.enqueue(new Uint8Array(n)),t.close()}})}},FilePolyfill=class extends u{name;lastModified;webkitRelativePath=``;constructor(e,t,n){super(e,n),this.name=t,this.lastModified=n?.lastModified??Date.now()}},d=globalThis.Blob??u,f=globalThis.File??FilePolyfill});function makeCallable(e){return new Proxy(e,{apply(e,t,n){if(t==null||t===globalThis)return Reflect.construct(e,n,e);let r=Reflect.construct(e,n,e);for(let e of Reflect.ownKeys(r)){let n=Object.getOwnPropertyDescriptor(r,e);n&&Object.defineProperty(t,e,n)}return t}})}var m=__esmMin(()=>{}),initErrorV8Methods,h=__esmMin(()=>{initErrorV8Methods=e=>{let t=Error;t.captureStackTrace||=function(e,t){let n=Error();Object.defineProperty(t||e,"stack",{configurable:!0,get:function getStack(){var e=n.stack;return Object.defineProperty(this,"stack",{value:e}),e}})}}});function createNodeError$1(e,t,n){let r=e,i=g[r?.code??-1]||`EIO`,o=`${i}: ${r?.message||`unknown error`}, ${t}`;n?.path&&(o+=` '${n.path}'`),n?.dest&&(o+=` -> '${n.dest}'`),n?.address&&(o+=` ${n.address}`),n?.port!=null&&(o+=`:${n.port}`);let s=Error(o);return s.code=i,s.syscall=t,s.errno=-(r?.code||0),n?.path&&(s.path=n.path),n?.address&&(s.address=n.address),n?.port!=null&&(s.port=n.port),s}function isNotFoundError(e){let t=e;return t?.code===1||t?.code===`ENOENT`}var g,_=__esmMin(()=>{g={0:`EIO`,1:`ENOENT`,2:`EEXIST`,3:`EISDIR`,4:`ENOTDIR`,5:`ENOTEMPTY`,6:`ENOENT`,7:`ENFILE`,9:`EACCES`,10:`ENFILE`,11:`EINVAL`,12:`ELOOP`,13:`ENOSPC`,14:`EACCES`,17:`ELOOP`,19:`ENOSPC`,20:`ENOTSUP`,22:`EMFILE`,24:`EROFS`,25:`ECANCELED`,26:`EBUSY`,27:`ETIMEDOUT`,28:`EHOSTUNREACH`,30:`EHOSTUNREACH`,31:`ENETUNREACH`,32:`ECONNREFUSED`,33:`EADDRINUSE`,34:`ECONNRESET`,36:`EPIPE`,38:`ENETUNREACH`,39:`ECONNREFUSED`,40:`ECONNREFUSED`,41:`EACCES`,44:`ECONNRESET`,46:`EMSGSIZE`},__name(createNodeError$1,`createNodeError`)});function registerGlobal(e,t){let n=globalThis;n[e]===void 0&&(n[e]=t)}var v=__esmMin(()=>{});function isTargetOs(e){return typeof e==`string`&&y.includes(e)}function hostPlatform(){let e=globalThis.process?.platform;return typeof e==`string`?e:void 0}function hostOs(){let e=hostPlatform();return isTargetOs(e)?e:void 0}function isWin32(){return hostPlatform()===`win32`}function isDarwin(){return hostPlatform()===`darwin`}var y,b=__esmMin(()=>{y=[`linux`,`darwin`,`win32`]});function _isError(e){return typeof Error.isError==`function`?Error.isError(e):e instanceof Error}function _safeRead(e,t){try{return e[t]}catch{return}}function _safeString(e){try{let t=String(e);return t.length>0&&!t.startsWith(`[object `)?t:void 0}catch{return}}function _thrownText(e){let t=_isError(e)?_safeRead(e,`message`):void 0;return typeof t==`string`?t:_safeString(e)??`unknown`}function _gerrorIdentity(e){let t=Object.prototype.hasOwnProperty;if(t.call(e,`domain`)||t.call(e,`code`))return;let n=_safeRead(e,`domain`),r=_safeRead(e,`code`);if(!(typeof n!=`number`||typeof r!=`number`))return{domain:n,code:r}}function _errorHeader(e){let t=_safeRead(e,`name`),n=_safeRead(e,`message`),r=typeof n==`string`?n:``;if(typeof t==`string`&&t.length>0)return r.length>0?`${t}: ${r}`:t;let i=_safeString(e);return i===void 0?r.length>0?`Error: ${r}`:`Error`:i}function _indentContinuation(e,t){return e.split(`
2
+ if(globalThis.__gjsifyBundleUrl??=import.meta.url,Symbol.dispose||(Symbol.dispose=Symbol.for(`Symbol.dispose`)),Symbol.asyncDispose||(Symbol.asyncDispose=Symbol.for(`Symbol.asyncDispose`)),typeof Intl.Segmenter!=`function`&&(Intl.Segmenter=class Segmenter{constructor(){}resolvedOptions(){return{locale:`en`,granularity:`grapheme`}}segment(e){let t=String(e);return{input:t,[Symbol.iterator]:function*(){let e=0;for(let n of t)yield{segment:n,index:e,input:t},e+=n.length}}}}),globalThis.process===void 0){let e=globalThis.imports.system,t=globalThis.imports.gi.GLib,_h=e=>[0,0];_h.bigint=()=>0n;let n,_p=()=>{if(n)return n;n={platform:`linux`,arch:`x64`};try{if(t.getenv(`OS`)===`Windows_NT`||t.getenv(`SystemRoot`)){let e=(t.getenv(`PROCESSOR_ARCHITECTURE`)||``).toLowerCase();return n={platform:`win32`,arch:e===`arm64`?`arm64`:e===`x86`?`ia32`:`x64`},n}let e=t.spawn_sync(null,[`uname`,`-sm`],null,t.SpawnFlags.SEARCH_PATH,null);if(e&&e[0]&&e[1]){let t=new TextDecoder().decode(e[1]).trim().split(/\s+/);if(t.length>1){let e=t[0],r=t[t.length-1].toLowerCase();n={platform:e===`Linux`?`linux`:e===`Darwin`?`darwin`:/^CYGWIN/i.test(e)?`cygwin`:/^(MINGW|MSYS|Windows)/i.test(e)?`win32`:e.toLowerCase(),arch:r===`x86_64`||r===`amd64`?`x64`:r===`aarch64`||r===`arm64`?`arm64`:/^i[3-6]86$/.test(r)?`ia32`:r.startsWith(`arm`)?`arm`:r}}}}catch{}return n};globalThis.process={get platform(){return _p().platform},get arch(){return _p().arch},version:`v20.0.0`,env:new Proxy({},{get(e,n){return typeof n==`string`?t.getenv(n)??void 0:void 0},set(e,n,r){return typeof n==`string`&&t.setenv(n,String(r),!0),!0},has(e,n){return typeof n==`string`&&t.getenv(n)!==null},deleteProperty(e,n){return typeof n==`string`&&t.unsetenv(n),!0},ownKeys(){return t.listenv()??[]},getOwnPropertyDescriptor(e,n){let r=t.getenv(n);return r===null?void 0:{value:r,writable:!0,enumerable:!0,configurable:!0}}}),argv:e?.programArgs?[`gjs`,e.programInvocationName||``,...e.programArgs]:[`gjs`],versions:{gjs:(e=>`${Math.floor(e/1e4)}.${Math.floor(e%1e4/100)}.${e%100}`)(Number(e.version))},config:{},cwd(){return t.get_current_dir()||`/`},exit(t){e.exit(t??0)},stderr:{write(e){globalThis.printerr(e)}},stdout:{write(e){globalThis.print(e)}},stdin:null,exitCode:void 0,nextTick(e,...t){Promise.resolve().then(()=>e(...t))},hrtime:_h}}(function(){var e=globalThis.imports;if(!(!e||!e.gi)){var t;try{t=e.gi.GIRepository}catch{return}if(!(!t||!t.Repository||!t.Repository.dup_default)){var n=t.Repository.dup_default();if(!(!n||!n.prepend_search_path||!n.prepend_library_path)){var a=function(e){n.prepend_search_path(e),n.prepend_library_path(e)},r;try{r=e.gi.GLib}catch{}if(r&&r.file_test&&r.FileTest)for(var i=[[`/opt/homebrew/lib`,`/opt/homebrew/lib/girepository-1.0`,`/System/Library/CoreServices/SystemVersion.plist`],[`/opt/local/lib`,`/opt/local/lib/girepository-1.0`,`/System/Library/CoreServices/SystemVersion.plist`],[`/usr/local/lib`,`/usr/local/lib/girepository-1.0`,`/System/Library/CoreServices/SystemVersion.plist`]],o=i.length;o--;)r.file_test(i[o][2],r.FileTest.EXISTS)&&r.file_test(i[o][1],r.FileTest.IS_DIR)&&a(i[o][0])}}}})();import e from"gi://GLib?version=2.0";import t from"gi://Gio?version=2.0";import"system";import n from"gi://GioUnix?version=2.0";var r=Object.defineProperty,__name=(e,t)=>r(e,`name`,{value:t,configurable:!0}),i=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,s=Object.prototype.hasOwnProperty,__esmMin=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(e){throw n=[e],e}},__commonJSMin=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),__exportAll$3=(e,t)=>{let n={};for(var i in e)r(n,i,{get:e[i],enumerable:!0});return t||r(n,Symbol.toStringTag,{value:`Module`}),n},__copyProps=(e,t,n,c)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var l=o(t),u=0,d=l.length,f;u<d;u++)f=l[u],!s.call(e,f)&&f!==n&&r(e,f,{get:(e=>t[e]).bind(null,f),enumerable:!(c=i(t,f))||c.enumerable});return e},__toCommonJS=e=>s.call(e,`module.exports`)?e[`module.exports`]:__copyProps(r({},`__esModule`,{value:!0}),e),c=(e=>typeof require<`u`?require:typeof Proxy<`u`?new Proxy(e,{get:(e,t)=>(typeof require<`u`?require:e)[t]}):e)(function(e){if(typeof require<`u`)return require.apply(this,arguments);throw Error('Calling `require` for "'+e+"\" in an environment that doesn't expose the `require` function. See https://rolldown.rs/in-depth/bundling-cjs#require-external-modules for more details.")}),l,_encoder,u,FilePolyfill,d,f,p=__esmMin(()=>{_encoder=()=>l??=new TextEncoder,u=class BlobPolyfill{_parts;size;type;constructor(e,t){this._parts=e||[],this.type=t?.type||``,this.size=this._parts.reduce((e,t)=>typeof t==`string`?e+_encoder().encode(t).byteLength:t instanceof ArrayBuffer||ArrayBuffer.isView(t)?e+t.byteLength:t&&typeof t.size==`number`?e+t.size:e,0)}async bytes(){let e=await this.arrayBuffer();return new Uint8Array(e)}async text(){return new TextDecoder().decode(await this.arrayBuffer())}async arrayBuffer(){let e=[];for(let t of this._parts)if(typeof t==`string`)e.push(_encoder().encode(t));else if(t instanceof ArrayBuffer)e.push(new Uint8Array(t));else if(ArrayBuffer.isView(t))e.push(new Uint8Array(t.buffer,t.byteOffset,t.byteLength));else if(t&&typeof t.arrayBuffer==`function`){let n=await t.arrayBuffer();e.push(new Uint8Array(n))}let t=e.reduce((e,t)=>e+t.byteLength,0),n=new Uint8Array(t),r=0;for(let t of e)n.set(t,r),r+=t.byteLength;return n.buffer}slice(e,t,n){return new BlobPolyfill([],{type:n})}stream(){let e=this;return new ReadableStream({async pull(t){let n=await e.arrayBuffer();t.enqueue(new Uint8Array(n)),t.close()}})}},FilePolyfill=class extends u{name;lastModified;webkitRelativePath=``;constructor(e,t,n){super(e,n),this.name=t,this.lastModified=n?.lastModified??Date.now()}},d=globalThis.Blob??u,f=globalThis.File??FilePolyfill});function makeCallable(e){return new Proxy(e,{apply(e,t,n){if(t==null||t===globalThis)return Reflect.construct(e,n,e);let r=Reflect.construct(e,n,e);for(let e of Reflect.ownKeys(r)){let n=Object.getOwnPropertyDescriptor(r,e);n&&Object.defineProperty(t,e,n)}return t}})}var m=__esmMin(()=>{}),initErrorV8Methods,h=__esmMin(()=>{initErrorV8Methods=e=>{let t=Error;t.captureStackTrace||=function(e,t){let n=Error();Object.defineProperty(t||e,"stack",{configurable:!0,get:function getStack(){var e=n.stack;return Object.defineProperty(this,"stack",{value:e}),e}})}}});function createNodeError$1(e,t,n){let r=e,i=g[r?.code??-1]||`EIO`,o=`${i}: ${r?.message||`unknown error`}, ${t}`;n?.path&&(o+=` '${n.path}'`),n?.dest&&(o+=` -> '${n.dest}'`),n?.address&&(o+=` ${n.address}`),n?.port!=null&&(o+=`:${n.port}`);let s=Error(o);return s.code=i,s.syscall=t,s.errno=-(r?.code||0),n?.path&&(s.path=n.path),n?.address&&(s.address=n.address),n?.port!=null&&(s.port=n.port),s}function isNotFoundError(e){let t=e;return t?.code===1||t?.code===`ENOENT`}var g,_=__esmMin(()=>{g={0:`EIO`,1:`ENOENT`,2:`EEXIST`,3:`EISDIR`,4:`ENOTDIR`,5:`ENOTEMPTY`,6:`ENOENT`,7:`ENFILE`,9:`EACCES`,10:`ENFILE`,11:`EINVAL`,12:`ELOOP`,13:`ENOSPC`,14:`EACCES`,17:`ELOOP`,19:`ENOSPC`,20:`ENOTSUP`,22:`EMFILE`,24:`EROFS`,25:`ECANCELED`,26:`EBUSY`,27:`ETIMEDOUT`,28:`EHOSTUNREACH`,30:`EHOSTUNREACH`,31:`ENETUNREACH`,32:`ECONNREFUSED`,33:`EADDRINUSE`,34:`ECONNRESET`,36:`EPIPE`,38:`ENETUNREACH`,39:`ECONNREFUSED`,40:`ECONNREFUSED`,41:`EACCES`,44:`ECONNRESET`,46:`EMSGSIZE`},__name(createNodeError$1,`createNodeError`)});function registerGlobal(e,t){let n=globalThis;n[e]===void 0&&(n[e]=t)}var v=__esmMin(()=>{});function isTargetOs(e){return typeof e==`string`&&y.includes(e)}function hostPlatform(){let e=globalThis.process?.platform;return typeof e==`string`?e:void 0}function hostOs(){let e=hostPlatform();return isTargetOs(e)?e:void 0}function isWin32(){return hostPlatform()===`win32`}function isDarwin(){return hostPlatform()===`darwin`}var y,b=__esmMin(()=>{y=[`linux`,`darwin`,`win32`]});function _isError(e){return typeof Error.isError==`function`?Error.isError(e):e instanceof Error}function _safeRead(e,t){try{return e[t]}catch{return}}function _safeString(e){try{let t=String(e);return t.length>0&&!t.startsWith(`[object `)?t:void 0}catch{return}}function _thrownText(e){let t=_isError(e)?_safeRead(e,`message`):void 0;return typeof t==`string`?t:_safeString(e)??`unknown`}function _gerrorIdentity(e){let t=Object.prototype.hasOwnProperty;if(t.call(e,`domain`)||t.call(e,`code`))return;let n=_safeRead(e,`domain`),r=_safeRead(e,`code`);if(!(typeof n!=`number`||typeof r!=`number`))return{domain:n,code:r}}function _errorHeader(e){let t=_safeRead(e,`name`),n=_safeRead(e,`message`),r=typeof n==`string`?n:``;if(typeof t==`string`&&t.length>0)return r.length>0?`${t}: ${r}`:t;let i=_safeString(e);return i===void 0?r.length>0?`Error: ${r}`:`Error`:i}function _indentContinuation(e,t){return e.split(`
3
3
  `).join(`
4
4
  `+t)}function _formatError(e,t){if(t.has(e))return`[Circular ${_errorHeader(e)}]`;t.add(e);try{return _renderError(e,t)}catch(t){return`${_errorHeader(e)} [unformattable: ${_thrownText(t)}]`}finally{t.delete(e)}}function _renderError(e,t){let n=_errorHeader(e),r=_safeRead(e,`stack`),i=typeof r==`string`?r.replace(/\n+$/,``):``,o=i.length===0?n:i.startsWith(n)?i:`${n}\n${i}`,s={..._gerrorIdentity(e)};for(let t of Object.keys(e))S.includes(t)||(s[t]=_safeRead(e,t));let c=_stringify(s,t);c!==`{}`&&(o+=` `+c);let l=_safeRead(e,`cause`);l!==void 0&&(o+=`
5
5
  [cause]: `+_indentContinuation(_formatValue(l,t),` `));let u=_safeRead(e,`errors`);if(Array.isArray(u))for(let e=0;e<u.length;e++)o+=`\n [errors][${e}]: `+_indentContinuation(_formatValue(u[e],t),` `);return o}function _stringify(e,t){try{return JSON.stringify(e,(e,n)=>_isError(n)?_formatError(n,t):n)}catch(e){return`[unserializable: ${_thrownText(e)}]`}}function _formatValue(e,t){return _isError(e)?_formatError(e,t):_stringify(e,t)}function _formatArgs(...e){let t=new Set,n=e[0],r=e.slice(1);if(typeof n!=`string`||!/%(s|d|i|f|o|O|c)/.test(n))return e.map(e=>typeof e==`string`?e:_formatValue(e,t)).join(` `);let i=0,o=n.replace(/%([sdifOoc])/g,(e,n)=>{if(i>=r.length)return e;let o=r[i++];switch(n){case`s`:return _isError(o)?_formatError(o,t):String(o);case`d`:case`i`:return String(parseInt(String(o),10));case`f`:return String(parseFloat(String(o)));case`o`:case`O`:return _formatValue(o,t);case`c`:return``;default:return e}}),s=r.slice(i);return s.length===0?o:o+` `+s.map(e=>typeof e==`string`?e:_formatValue(e,t)).join(` `)}var x,S,Console,C,log,info,debug,warn,error,dir,dirxml,table,w,assert,T,time,timeEnd,timeLog,count,countReset,E,groupCollapsed,groupEnd,profile,profileEnd,timeStamp,D=__esmMin(()=>{x=typeof print==`function`&&typeof printerr==`function`,S=[`name`,`message`,`stack`,`cause`,`errors`,`fileName`,`lineNumber`,`columnNumber`],Console=class{_stdout;_stderr;_groupDepth=0;_groupIndentation;_timers=new Map;_counters=new Map;constructor(e,t){if(e&&typeof e.write==`function`)this._stdout=e,this._stderr=t||this._stdout;else if(e&&typeof e==`object`){let t=e;this._stdout=t.stdout,this._stderr=t.stderr||t.stdout}this._groupIndentation=2}_write(e,...t){let n=e===`stderr`&&this._stderr||this._stdout;if(n){let e=` `.repeat(this._groupDepth*this._groupIndentation),r=_formatArgs(...t);n.write(e+r+`
@@ -23,20 +23,20 @@ function isEdValidXY(e,t,n,r){let i=e.sqr(n),o=e.sqr(r),s=e.add(e.mul(t.a,i),o),
23
23
  function cmask(e,t){return e+t-(t>>ki<<ki)}function cswap(e){let t=BigInt(6)*e;return(n,r,i)=>{let o=r+i,s=((t+i-r)*n+r)%e;return{x_2:s,x_3:o-s}}}function validateOpts(e){return validateObject(e,{P:`bigint`,type:`string`,adjustScalarBytes:`function`,powPminus2:`function`},{randomBytes:`function`,scalarMultBase:`function`}),Object.freeze({...e})}function montgomery(e){let t=validateOpts(e),{P:n,type:r,adjustScalarBytes:i,powPminus2:o,randomBytes:s}=t,c=t.scalarMultBase,l=r===`x25519`;if(!l&&r!==`x448`)throw Error(`invalid type`);let u=s===void 0?qr:s,d=l?255:448,f=cswap(n),p=l?32:56,m=BigInt(l?9:5),h=BigInt(l?121665:39081),g=l?Ai**BigInt(254):Ai**BigInt(447),_=g+(l?BigInt(8)*(Ai**BigInt(251)-ki):BigInt(4)*(Ai**BigInt(445)-ki))+ki,modP=e=>mod$1(e,n),v=encodeU(m);function encodeU(e){return numberToBytesLE(modP(e),p)}function decodeU(e){let t=copyBytes(abytes(e,p,`uCoordinate`));return l&&(t[31]&=127),modP(bytesToNumberLE(t))}function decodeScalar(e){return bytesToNumberLE(i(copyBytes(abytes(e,p,`scalar`))))}let y=new Set(l?[Oi,ki,n-ki,BigInt(`325606250916557431795983626356110631294008115727848805560023387167927233504`),BigInt(`39382357235489614581723060781553021112529911719440698176882885853963445705823`)]:[Oi,ki,n-ki]);function scalarMult(e,t){let n=decodeU(t);if(y.has(n))throw Error(`invalid private or public key received`);let r=montgomeryLadder(n,decodeScalar(e));if(r===Oi)throw Error(`invalid private or public key received`);return encodeU(r)}function scalarMultBase(e){if(c===void 0)return scalarMult(e,v);let t=decodeScalar(e);aInRange(`scalar`,t,g,_);let n=modP(c(t));if(n===Oi)throw Error(`invalid private or public key received`);return encodeU(n)}let b=scalarMultBase,x=scalarMult;function montgomeryLadder(e,t){aInRange(`u`,e,Oi,n),aInRange(`scalar`,t,g,_);let r=t,i=e,s=ki,c=Oi,l=e,u=ki,p=r^r>>ki;for(let e=BigInt(d-1);e>=Oi;e--){let t=cmask(n,p>>e);({x_2:s,x_3:l}=f(t,s,l)),{x_2:c,x_3:u}=f(t,c,u);let r=s+c,o=modP(r*r),d=s-c,m=modP(d*d),g=o-m,_=l+u,v=l-u,y=modP(v*r),b=modP(_*d),x=y+b,S=y-b;l=modP(x*x),u=modP(i*modP(S*S)),s=modP(o*m),c=modP(g*(o+modP(h*g)))}let m=cmask(n,r);({x_2:s,x_3:l}=f(m,s,l)),{x_2:c,x_3:u}=f(m,c,u);let v=o(c);return modP(s*v)}let S={secretKey:p,publicKey:p,seed:p},randomSecretKey=e=>(e=e===void 0?u(p):e,abytes(e,S.seed,`seed`),e),C={randomSecretKey};return Object.freeze(S),Object.freeze(C),Object.freeze({keygen:createKeygen(randomSecretKey,b),getSharedSecret:x,getPublicKey:b,scalarMult,scalarMultBase,utils:C,GuBytes:v.slice(),lengths:S})}var Oi,ki,Ai,ji=__esmMin(()=>{Xr(),xi(),di(),Oi=BigInt(0),ki=BigInt(1),Ai=BigInt(2)});
24
24
  /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
25
25
  function ed25519_pow_2_252_3(e){let t=BigInt(10),n=BigInt(20),r=BigInt(40),i=BigInt(80),o=Ri,s=e*e%o*e%o,c=pow2(pow2(s,Pi,o)*s%o,Ni,o)*e%o,l=pow2(c,Ii,o)*c%o,u=pow2(l,t,o)*l%o,d=pow2(u,n,o)*u%o,f=pow2(d,r,o)*d%o;return{pow_p_5_8:pow2(pow2(pow2(pow2(f,i,o)*f%o,i,o)*f%o,t,o)*l%o,Pi,o)*e%o,b2:s}}function adjustScalarBytes(e){return e[0]&=248,e[31]&=127,e[31]|=64,e}function uvRatio(e,t){let n=Ri,r=mod$1(t*t*t,n),i=ed25519_pow_2_252_3(e*mod$1(r*r*t,n)).pow_p_5_8,o=mod$1(e*r*i,n),s=mod$1(t*o*o,n),c=o,l=mod$1(o*Bi,n),u=s===e,d=s===mod$1(-e,n),f=s===mod$1(-e*Bi,n);return u&&(o=c),(d||f)&&(o=l),isNegativeLE(o,n)&&(o=mod$1(-o,n)),{isValid:u||d,value:o}}function toMontgomery(e){let{y:t}=e;return Hi.toBytes(Hi.div(Ni+t,Ni-t))}function toMontgomerySecret(e){let t=Vi.Fp.BYTES;return abytes$1(e,t),adjustScalarBytes(Hr(e.subarray(0,t))).subarray(0,t)}function ed25519_domain(e,t,n){if(t.length>255)throw Error(`Context is too big`);return concatBytes$1(asciiToBytes(`SigEd25519 no Ed25519 collisions`),new Uint8Array([+!!n,t.length]),t,e)}function ed(e){return eddsa(Vi,Hr,Object.assign({adjustScalarBytes,toMontgomery,toMontgomerySecret,zip215:!0},e))}var Mi,Ni,Pi,Fi,Ii,Li,Ri,zi,Bi,Vi,Hi,Ui,Wi,Gi,Ki=__esmMin(()=>{Ur(),Pr(),Di(),di(),ji(),Xr(),Mi=BigInt(0),Ni=BigInt(1),Pi=BigInt(2),Fi=BigInt(3),Ii=BigInt(5),Li=BigInt(8),Ri=BigInt(`0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed`),zi={p:Ri,n:BigInt(`0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3ed`),h:Li,a:BigInt(`0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec`),d:BigInt(`0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3`),Gx:BigInt(`0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a`),Gy:BigInt(`0x6666666666666666666666666666666666666666666666666666666666666658`)},Bi=BigInt(`19681161376707505956807079304988542015446066515923890162744021073123829784752`),Vi=edwards(zi,{uvRatio}),Hi=Vi.Fp,Ui=ed({}),Wi=ed({domain:ed25519_domain}),Gi=(()=>{let e=Ri,powPminus2=t=>{let{pow_p_5_8:n,b2:r}=ed25519_pow_2_252_3(t);return mod$1(pow2(n,Fi,e)*r,e)};return montgomery({P:e,type:`x25519`,powPminus2,adjustScalarBytes,scalarMultBase:t=>{let n=mod$1(t,Vi.Fn.ORDER);if(n===Mi)return Mi;let r=Vi.BASE.multiply(n);return mod$1((r.Z+r.Y)*powPminus2(mod$1(r.Z-r.Y,e)),e)}})})()});function gjsGi(){return globalThis.imports?.gi}function isSecureRandomSource(e){return Ji.includes(e)}function fillFromWebCrypto(e,t){for(let n=0;n<e.length;n+=qi){let r=Math.min(e.length-n,qi);t.getRandomValues(new Uint8Array(e.buffer,e.byteOffset+n,r))}}function openUrandom(){if(Xi!==null)return Xi;let e=gjsGi()?.Gio;if(!e)return Xi=!1,!1;try{Xi=e.File.new_for_path(`/dev/urandom`).read(null)}catch{Xi=!1}return Xi}function fillFromUrandom(e){let t=openUrandom();if(!t)return!1;try{let n=0;for(;n<e.length;){let r=t.read_bytes(e.length-n,null).toArray();if(r.length===0)return!1;e.set(r,n),n+=r.length}return!0}catch{return!1}}function fillFromGLib(e){let t=gjsGi()?.GLib;if(!t?.random_int_range)return!1;for(let n=0;n<e.length;n++)e[n]=t.random_int_range(0,256);return!0}function fillFromMath(e){for(let t=0;t<e.length;t++)e[t]=Math.floor(Math.random()*256)}function warnInsecureOnce(e){Yi||(Yi=!0,O.warn(`[@gjsify/webcrypto] No cryptographically secure random source available — falling back to "${e}". Neither GLib.Random nor Math.random is suitable for keys, tokens or IVs. Expected sources: WebCrypto (globalThis.crypto) or /dev/urandom via Gio on GJS.`))}function fillRandomBytes(e,t={}){if(e.length===0)return`webcrypto`;let n=t.webcrypto===void 0?globalThis.crypto??null:t.webcrypto;return n&&typeof n.getRandomValues==`function`?(fillFromWebCrypto(e,n),`webcrypto`):fillFromUrandom(e)?`urandom`:fillFromGLib(e)?(warnInsecureOnce(`glib`),`glib`):(fillFromMath(e),warnInsecureOnce(`math`),`math`)}var qi,Ji,Yi,Xi,Zi=__esmMin(()=>{k(),qi=65536,Ji=[`webcrypto`,`urandom`],Yi=!1,Xi=null});function clampX25519(e){return e[0]&=248,e[31]&=127,e[31]|=64,e}function generateOkpPrivateKey(e,t=fillRandomBytes){let n=new Uint8Array(32),r=t(n);if(!isSecureRandomSource(r))throw n.fill(0),codedError(`ERR_CRYPTO_INSECURE_RANDOM`,`Refusing to generate a ${e} key: no cryptographically secure random source (got "${r}"; expected WebCrypto or /dev/urandom)`);return e===`x25519`?clampX25519(n):n}function okpPublicFromPrivate(e,t){return e===`ed25519`?Ui.getPublicKey(t):Gi.getPublicKey(t)}function ed25519Sign(e,t,n){return n&&n.length>0?Wi.sign(t,e,{context:n}):Ui.sign(t,e)}function dom2(e){if(!e||e.length===0)return new Uint8Array;let t=new TextEncoder().encode(`SigEd25519 no Ed25519 collisions`),n=new Uint8Array(t.length+2+e.length);return n.set(t,0),n[t.length]=0,n[t.length+1]=e.length,n.set(e,t.length+2),n}function leToBigInt(e){let t=0n;for(let n=e.length-1;n>=0;n--)t=t<<8n|BigInt(e[n]);return t}function ed25519Verify(e,t,n,r){if(e.length!==32||n.length!==64||r&&r.length>255)return!1;let i=n.subarray(0,32),o=leToBigInt(n.subarray(32));if(o>=$i)return!1;let s,c;try{s=Qi.fromBytes(e,!1),c=Qi.fromBytes(i,!1)}catch{return!1}if(s.isSmallOrder()||c.isSmallOrder())return!1;let l=dom2(r),u=new Uint8Array(l.length+64+t.length);u.set(l,0),u.set(i,l.length),u.set(e,l.length+32),u.set(t,l.length+64);let d=leToBigInt(Hr(u))%$i,f=Qi.BASE.multiplyUnsafe(o).subtract(s.multiplyUnsafe(d)).toBytes(),p=0;for(let e=0;e<32;e++)p|=f[e]^i[e];return p===0}function x25519SharedSecret(e,t){return Gi.getSharedSecret(e,t)}var Qi,$i,ea=__esmMin(()=>{Er(),Ki(),Ur(),Zi(),Qi=Ui.Point,$i=Qi.Fn.ORDER});function bigintToBase64url(e){if(e===0n)return`AA`;let t=e.toString(16),n=t.length%2?`0`+t:t,r=[];for(let e=0;e<n.length;e+=2)r.push(parseInt(n.substring(e,e+2),16));return R.from(r).toString(`base64url`)}function base64urlToBigint(e){let t=R.from(e,`base64url`),n=0n;for(let e=0;e<t.length;e++)n=n<<8n|BigInt(t[e]);return n}function exportOkp(e,t,n,r,i){let o=e.parsed,s=e.okpPub;if(n===`jwk`){let e={crv:ta[o.curve]};return t===`private`&&(e.d=R.from(o.priv).toString(`base64url`)),e.x=R.from(s).toString(`base64url`),e.kty=`OKP`,e}if(n!==`pem`&&n!==`der`)throw codedError(`ERR_INVALID_ARG_VALUE`,`The property 'options.format' is invalid. Received '${n}'`,TypeError);if(r!==void 0&&r!==(t===`public`?`spki`:`pkcs8`))throw codedError(`ERR_CRYPTO_INCOMPATIBLE_KEY_OPTIONS`,r===`pkcs1`||r===`sec1`?`The selected key encoding ${r} can only be used for ${r===`pkcs1`?`RSA`:`EC`} keys.`:`The property 'options.type' is invalid. Received '${r}'`);if(i?.cipher!==void 0||i?.passphrase!==void 0)throw codedError(`ERR_FEATURE_UNAVAILABLE_ON_PLATFORM`,`Encrypted private key export is not supported`);let c=t===`public`?encodeOkpSubjectPublicKeyInfo(o.curve,s):encodeOkpPrivateKeyInfo(o.curve,o.priv);return n===`der`?R.from(c):derToPem(c,t===`public`?`PUBLIC KEY`:`PRIVATE KEY`)+`
26
- `}function asymmetricKeyObject(e,t,n){if(e.type===`okp-private`){let n=okpPublicFromPrivate(e.curve,e.priv);return t===`public`?asymmetricKeyObject({type:`okp-public`,curve:e.curve,pub:n},`public`):new na(`private`,{parsed:e,pem:derToPem(encodeOkpPrivateKeyInfo(e.curve,e.priv),`PRIVATE KEY`),okpPub:n})}if(e.type===`okp-public`){if(t===`private`)throw TypeError(`Key is not a private key`);return new na(`public`,{parsed:e,pem:derToPem(encodeOkpSubjectPublicKeyInfo(e.curve,e.pub),`PUBLIC KEY`),okpPub:e.pub})}if(e.type===`rsa-private`&&t===`public`){let t={n:e.components.n,e:e.components.e},n=encodeSubjectPublicKeyInfo(t);return new na(`public`,{parsed:{type:`rsa-public`,components:t},pem:derToPem(n,`PUBLIC KEY`)})}if(e.type===`rsa-public`&&t===`private`)throw TypeError(`Key is not a private key`);return new na(t,{parsed:e,pem:n??generatePem(e,t)})}function parseJwkOkp(e,t){let n=Object.keys(ta).find(t=>ta[t]===e.crv);if(!n)throw codedError(`ERR_INVALID_ARG_VALUE`,`The property 'key.crv' must be one of: 'Ed25519', 'X25519'. Received ${JSON.stringify(e.crv)}`,TypeError);let r=t===`private`?e.d:e.x;if(typeof e.x!=`string`||typeof r!=`string`)throw codedError(`ERR_CRYPTO_INVALID_JWK`,`Invalid JWK OKP key`);let i=new Uint8Array(R.from(r,`base64url`));if(i.length!==32)throw codedError(`ERR_CRYPTO_INVALID_JWK`,`Invalid JWK OKP key`);return t===`private`?{type:`okp-private`,curve:n,priv:i}:{type:`okp-public`,curve:n,pub:i}}function parseJwk(e,t){if(typeof e!=`object`||!e)throw codedError(`ERR_INVALID_ARG_TYPE`,`The "key.key" property must be of type object`,TypeError);if(e.kty===`OKP`)return{parsed:parseJwkOkp(e,t)};if(e.kty===`RSA`){if(t===`private`&&!e.d)throw Error(`JWK does not contain a private key`);return importJwkRsa(t===`private`?e:{n:e.n,e:e.e})}throw codedError(`ERR_INVALID_ARG_VALUE`,`The property 'key.kty' must be one of: 'RSA', 'EC', 'OKP'. Received ${JSON.stringify(e.kty)}`,TypeError)}function exportJwk(e,t){if(e.type===`rsa-public`)return{kty:`RSA`,n:bigintToBase64url(e.components.n),e:bigintToBase64url(e.components.e)};if(e.type===`rsa-private`){if(t===`public`)return{kty:`RSA`,n:bigintToBase64url(e.components.n),e:bigintToBase64url(e.components.e)};let{n,e:r,d:i,p:o,q:s}=e.components,c=i%(o-1n),l=i%(s-1n),u=modInverse$1(s,o);return{kty:`RSA`,n:bigintToBase64url(n),e:bigintToBase64url(r),d:bigintToBase64url(i),p:bigintToBase64url(o),q:bigintToBase64url(s),dp:bigintToBase64url(c),dq:bigintToBase64url(l),qi:bigintToBase64url(u)}}throw Error(`Unsupported key type for JWK export`)}function importJwkRsa(e){if(e.d){let t={n:base64urlToBigint(e.n),e:base64urlToBigint(e.e),d:base64urlToBigint(e.d),p:base64urlToBigint(e.p),q:base64urlToBigint(e.q)};return{parsed:{type:`rsa-private`,components:t},pem:derToPem(encodeRsaPrivateKeyPkcs1(t),`RSA PRIVATE KEY`)}}let t={n:base64urlToBigint(e.n),e:base64urlToBigint(e.e)};return{parsed:{type:`rsa-public`,components:t},pem:derToPem(encodeSubjectPublicKeyInfo(t),`PUBLIC KEY`)}}function generatePem(e,t,n){if(e.type===`rsa-public`)return n===`pkcs1`?derToPem(encodeRsaPublicKeyPkcs1(e.components),`RSA PUBLIC KEY`):derToPem(encodeSubjectPublicKeyInfo(e.components),`PUBLIC KEY`);if(e.type===`rsa-private`&&t===`public`){let t={n:e.components.n,e:e.components.e};return n===`pkcs1`?derToPem(encodeRsaPublicKeyPkcs1(t),`RSA PUBLIC KEY`):derToPem(encodeSubjectPublicKeyInfo(t),`PUBLIC KEY`)}if(e.type===`rsa-private`)return n===`pkcs8`?derToPem(encodePrivateKeyInfo(e.components),`PRIVATE KEY`):derToPem(encodeRsaPrivateKeyPkcs1(e.components),`RSA PRIVATE KEY`);throw Error(`Cannot generate PEM for this key type`)}function generateDer(e,t,n){if(e.type===`rsa-public`)return n===`pkcs1`?R.from(encodeRsaPublicKeyPkcs1(e.components)):R.from(encodeSubjectPublicKeyInfo(e.components));if(e.type===`rsa-private`&&t===`public`){let t={n:e.components.n,e:e.components.e};return n===`pkcs1`?R.from(encodeRsaPublicKeyPkcs1(t)):R.from(encodeSubjectPublicKeyInfo(t))}if(e.type===`rsa-private`)return n===`pkcs8`?R.from(encodePrivateKeyInfo(e.components)):R.from(encodeRsaPrivateKeyPkcs1(e.components));throw Error(`Cannot generate DER for this key type`)}function modInverse$1(e,t){let[n,r]=[e%t,t],[i,o]=[1n,0n];for(;r!==0n;){let e=n/r;[n,r]=[r,n-e*r],[i,o]=[o,i-e*o]}return(i%t+t)%t}function createSecretKey(e,t){let n;return n=typeof e==`string`?R.from(e,t??`utf8`):new Uint8Array(e),new na(`secret`,n)}function parseKeyInput(e,t){if(typeof e==`object`&&e&&!R.isBuffer(e)&&!(e instanceof Uint8Array)&&`key`in e){let n=e;if(n.format===`jwk`)return parseJwk(n.key,t);if(n.format===`der`){if(n.type!==`spki`&&n.type!==`pkcs8`&&n.type!==`pkcs1`)throw codedError(`ERR_INVALID_ARG_VALUE`,`The property 'key.type' is invalid. Received ${JSON.stringify(n.type)}`,TypeError);let e=typeof n.key==`string`?R.from(n.key,n.encoding??`utf8`):n.key;return{parsed:parseDerKey(new Uint8Array(e),n.type,t)}}}let n=normalizePem(e);return{parsed:parsePemKey(n),pem:n}}function createPublicKey(e){if(e instanceof na){if(e.type===`public`)return e;if(e.type===`private`)return asymmetricKeyObject(e._handle.parsed,`public`);throw TypeError(`Cannot create public key from secret key`)}if(typeof e==`object`&&e&&`key`in e&&e.key instanceof na)return createPublicKey(e.key);let{parsed:t,pem:n}=parseKeyInput(e,jwkKind(e));return asymmetricKeyObject(t,`public`,t.type===`rsa-private`||t.type===`okp-private`?void 0:n)}function jwkKind(e){return typeof e==`object`&&e&&`format`in e&&e.format===`jwk`?e.key?.d===void 0?`public`:`private`:`public`}function createPrivateKey(e){if(typeof e==`object`&&e&&`key`in e&&e.key instanceof na){if(e.key.type!==`private`)throw codedError(`ERR_CRYPTO_INVALID_KEY_OBJECT_TYPE`,`Invalid key object type ${e.key.type}, expected private.`,TypeError);return e.key}let{parsed:t,pem:n}=parseKeyInput(e,`private`);if(t.type!==`rsa-private`&&t.type!==`okp-private`)throw TypeError(`Key is not a private key`);return asymmetricKeyObject(t,`private`,n)}function toKeyObject(e,t){if(e instanceof na){if(t===`private`&&e.type!==`private`)throw codedError(`ERR_CRYPTO_INVALID_KEY_OBJECT_TYPE`,`Invalid key object type ${e.type}, expected private.`,TypeError);if(t===`public`&&e.type===`secret`)throw codedError(`ERR_CRYPTO_INVALID_KEY_OBJECT_TYPE`,`Invalid key object type secret, expected private or public.`,TypeError);return e}if(typeof e==`object`&&e&&`key`in e&&e.key instanceof na)return toKeyObject(e.key,t);if(t===`private`)return createPrivateKey(e);let n=e,{parsed:r}=parseKeyInput(n,jwkKind(n));return asymmetricKeyObject(r,r.type===`rsa-private`||r.type===`okp-private`?`private`:`public`)}function okpKeyMaterial(e){if(e.type===`secret`)return;let t=e._handle,n=t.parsed;if(n.type===`okp-private`)return{curve:n.curve,pub:t.okpPub,priv:n.priv};if(n.type===`okp-public`)return{curve:n.curve,pub:n.pub}}function okpKeyPair(e,t){let n=asymmetricKeyObject({type:`okp-private`,curve:e,priv:t},`private`);return{publicKey:createPublicKey(n),privateKey:n}}function normalizePem(e){if(typeof e==`string`)return e;if(R.isBuffer(e)||e instanceof Uint8Array)return R.from(e).toString(`utf8`);if(e&&typeof e==`object`&&`key`in e){let t=e;if(typeof t.key==`string`)return t.key;if(R.isBuffer(t.key)||t.key instanceof Uint8Array)return R.from(t.key).toString(t.encoding??`utf8`);if(t.key instanceof na)return t.key.export({format:`pem`})}throw TypeError(`Invalid key input`)}var ta,na,ra=__esmMin(()=>{Sr(),Er(),ea(),Oe(),ta={ed25519:`Ed25519`,x25519:`X25519`},na=class KeyObject{type;_handle;constructor(e,t){if(e!==`secret`&&e!==`public`&&e!==`private`)throw TypeError(`Invalid KeyObject type: ${e}`);this.type=e,this._handle=t}get symmetricKeySize(){if(this.type===`secret`)return this._handle.byteLength}get asymmetricKeyType(){if(this.type===`secret`)return;let e=this._handle;return e.parsed.type===`rsa-public`||e.parsed.type===`rsa-private`?`rsa`:e.parsed.curve}get asymmetricKeyDetails(){if(this.type===`secret`)return;let e=this._handle.parsed;return e.type===`rsa-public`||e.type===`rsa-private`?{modulusLength:rsaKeySize(e.components.n)*8,publicExponent:e.components.e}:{}}get asymmetricKeySize(){if(this.type===`secret`)return;let e=this._handle;if(e.parsed.type===`rsa-public`||e.parsed.type===`rsa-private`)return rsaKeySize(e.parsed.components.n)/8}equals(e){if(!(e instanceof KeyObject)||this.type!==e.type)return!1;if(this.type===`secret`){let t=this._handle,n=e._handle;if(t.byteLength!==n.byteLength)return!1;for(let e=0;e<t.byteLength;e++)if(t[e]!==n[e])return!1;return!0}let t=this._handle,n=e._handle;return t.pem===n.pem}export(e){if(this.type===`secret`){let t=this._handle;return e?.format===`jwk`?{kty:`oct`,k:R.from(t).toString(`base64url`)}:R.from(t)}let t=this._handle,n=e?.format??`pem`,r=e?.type;if(t.parsed.type===`okp-public`||t.parsed.type===`okp-private`)return exportOkp(t,this.type,n,r,e);if(n===`jwk`)return exportJwk(t.parsed,this.type);if(n===`pem`)return t.pem&&!t.pem.startsWith(`[`)?t.pem:generatePem(t.parsed,this.type,r);if(n===`der`){if(t.pem&&!t.pem.startsWith(`[`)){let e=t.pem.trim().split(/\r?\n/),n=e.findIndex(e=>e.startsWith(`-----BEGIN `)),r=e.findIndex((e,t)=>t>n&&e.startsWith(`-----END `)),i=e.slice(n+1,r).join(``);return R.from(i,`base64`)}return generateDer(t.parsed,this.type,r)}throw TypeError(`Unsupported export format: ${n}`)}get[Symbol.toStringTag](){return`KeyObject`}},__name(modInverse$1,`modInverse`)});function describe$1(e){return e===null?`null`:Array.isArray(e)?`an instance of Array`:typeof e}function compute(e){let t=toKeyObject(e.privateKey,`private`),n=toKeyObject(e.publicKey,`public`),r=okpKeyMaterial(t),i=okpKeyMaterial(n);if(!r||r.curve!==`x25519`){let e=t.asymmetricKeyType;throw codedError(e===`ed25519`?`ERR_OSSL_EVP_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE`:`ERR_FEATURE_UNAVAILABLE_ON_PLATFORM`,e===`ed25519`?`error:03000096:digital envelope routines::operation not supported for this keytype`:`diffieHellman() with a '${e}' key is not implemented on GJS yet (supported: 'x25519')`)}if(!i||i.curve!==r.curve)throw codedError(`ERR_OSSL_EVP_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE`,`error:03000096:digital envelope routines::operation not supported for this keytype`);let o;try{o=x25519SharedSecret(r.priv,i.pub)}catch{throw codedError(`ERR_OSSL_FAILED_DURING_DERIVATION`,`Deriving bits failed`)}return R.from(o)}function diffieHellman(e,t){if(typeof e!=`object`||!e||Array.isArray(e))throw codedError(`ERR_INVALID_ARG_TYPE`,`The "options" argument must be of type object. Received ${describe$1(e)}`,TypeError);if(t===void 0)return compute(e);if(typeof t!=`function`)throw codedError(`ERR_INVALID_ARG_TYPE`,`The "callback" argument must be of type function. Received ${describe$1(t)}`,TypeError);let n;try{n=compute(e)}catch(e){setTimeout(()=>t(e),0);return}setTimeout(()=>t(null,n),0)}var ia=__esmMin(()=>{Er(),ea(),ra(),Oe(),__name(describe$1,`describe`)});function fillRandom(e){fillRandomBytes(e)}function randomBytes(e,t){if(typeof e!=`number`||e<0||!Number.isInteger(e))throw TypeError(`The "size" argument must be a non-negative integer. Received ${e}`);try{let n=R.alloc(e);if(e>0&&fillRandom(new Uint8Array(n.buffer,n.byteOffset,n.byteLength)),t)t(null,n);else return n}catch(e){if(t)t(e,R.alloc(0));else throw e}}function randomFillSync(e,t=0,n){let r=n??e.length-t;if(t<0||t>e.length)throw RangeError(`The value of "offset" is out of range. Received ${t}`);if(r<0||t+r>e.length)throw RangeError(`The value of "size" is out of range. Received ${r}`);if(r>0){let n=(e instanceof R,e.byteOffset);fillRandom(new Uint8Array(e.buffer,n+t,r))}return e}function randomFill(e,t,n,r){let i,o,s;typeof t==`function`?(s=t,i=0,o=e.length):typeof n==`function`?(s=n,i=t,o=e.length-t):(s=r,i=t,o=n);try{randomFillSync(e,i,o),s(null,e)}catch(t){s(t,e)}}function randomUUID(){if(typeof globalThis.crypto?.randomUUID==`function`)return globalThis.crypto.randomUUID();let e=new Uint8Array(16);fillRandom(e),e[6]=e[6]&15|64,e[8]=e[8]&63|128;let t=Array.from(e,e=>e.toString(16).padStart(2,`0`)).join(``);return`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16,20)}-${t.slice(20)}`}function randomInt(e,t,n){let r,i,o;if(typeof t==`function`?(o=t,i=e,r=0):typeof t==`number`?(r=e,i=t,o=n):(i=e,r=0,o=n),!Number.isInteger(r))throw TypeError(`The "min" argument must be a safe integer. Received ${r}`);if(!Number.isInteger(i))throw TypeError(`The "max" argument must be a safe integer. Received ${i}`);if(r>=i)throw RangeError(`The value of "min" must be less than "max". Received min: ${r}, max: ${i}`);let s=i-r,c=new Uint32Array(1);fillRandom(new Uint8Array(c.buffer));let l=r+c[0]%s;if(o)o(null,l);else return l}var aa=__esmMin(()=>{Oe(),Zi()});function modPow(e,t,n){if(n===1n)return 0n;e=(e%n+n)%n;let r=1n;for(;t>0n;)t&1n&&(r=r*e%n),t>>=1n,e=e*e%n;return r}function bigIntToBytes(e,t){let n=new Uint8Array(t),r=e;for(let e=t-1;e>=0;e--)n[e]=Number(r&255n),r>>=8n;return n}function bytesToBigInt(e){let t=0n;for(let n=0;n<e.length;n++)t=t<<8n|BigInt(e[n]);return t}var oa=__esmMin(()=>{});function bigIntToBuffer(e){if(e===0n)return R.from([0]);let t=e.toString(16);return t.length%2!=0&&(t=`0`+t),R.from(t,`hex`)}function bufferToBigInt(e){if(e.length===0)return 0n;let t=R.from(e).toString(`hex`);return t.length===0?0n:BigInt(`0x`+t)}function bitLength(e){return e===0n?0:e.toString(2).length}function simpleSieve(e){for(let t of ca){let n=BigInt(t);if(e%n===0n)return e===n}return!0}function fermatTest(e){return modPow(2n,e-1n,e)===1n}function millerRabinTest(e){if(e<2n)return!1;if(e===2n||e===3n)return!0;if(e%2n==0n)return!1;let t=e-1n,n=0;for(;t%2n==0n;)t/=2n,n++;for(let r of[2n,3n,5n,7n,11n,13n]){if(r>=e)continue;let i=modPow(r,t,e);if(i===1n||i===e-1n)continue;let o=!0;for(let t=0;t<n-1;t++)if(i=modPow(i,2n,e),i===e-1n){o=!1;break}if(o)return!1}return!0}function checkPrime(e,t){let n=t.toString(`hex`),r=0;if(e%2n==0n||!simpleSieve(e)||!fermatTest(e)||!millerRabinTest(e))return r+=1,n===`02`||n===`05`?r+=8:r+=4,r;switch(millerRabinTest(e>>1n)||(r+=2),n){case`02`:e%24n!=11n&&(r+=8);break;case`05`:{let t=e%10n;t!==3n&&t!==7n&&(r+=8)}break;default:r+=4}return r}function getCachedCheckPrime(e,t){let n=t.toString(`hex`)+`_`+e.toString(16);if(n in la)return la[n];let r=checkPrime(e,t);return la[n]=r,r}function formatReturnValue$1(e,t){let n=bigIntToBuffer(e);return t?n.toString(t):n}function generatePrime(e,t){let n=bufferToBigInt(t);if(e<16)return n===2n||n===5n?R.from([140,123]):R.from([140,39]);let r=Math.ceil(e/8),i=2n,o=4n;for(;;){let t=bufferToBigInt(randomBytes(r));for(;bitLength(t)>e;)t>>=1n;if(t%i==0n&&(t+=1n),t&i||(t+=i),n===i)for(;t%24n!=11n;)t+=o;else if(n===5n)for(;t%10n!=3n;)t+=o;let s=t>>1n;if(simpleSieve(s)&&simpleSieve(t)&&fermatTest(s)&&fermatTest(t)&&millerRabinTest(s)&&millerRabinTest(t))return bigIntToBuffer(t)}}function createDiffieHellman(e,t,n,r){if(t!==void 0&&typeof t!=`number`&&(R.isBuffer(t)||t instanceof Uint8Array||typeof t==`string`&&!(t in ua)))return createDiffieHellman(e,`binary`,t,n);let i=t||`binary`,o=r||`binary`,s=R.from([2]);if(n!==void 0&&(typeof n==`number`?(s=R.alloc(1),s[0]=n):s=R.isBuffer(n)?n:R.from(n,o)),typeof e==`number`)return new DiffieHellman(generatePrime(e,s),s,!0);let c;return c=R.isBuffer(e)?e:e instanceof Uint8Array?R.from(e):R.from(e,i),new DiffieHellman(c,s,!0)}function getDiffieHellman(e){let t=sa[e];if(!t)throw Error(`Unknown group: ${e}. Supported groups: ${Object.keys(sa).join(`, `)}`);return new DiffieHellman(R.from(t.prime,`hex`),R.from(t.gen,`hex`),!1)}var sa,ca,la,DiffieHellman,ua,da,fa,pa=__esmMin(()=>{oa(),aa(),Oe(),sa={modp1:{gen:`02`,prime:`ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a63a3620ffffffffffffffff`},modp2:{gen:`02`,prime:`ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece65381ffffffffffffffff`},modp5:{gen:`02`,prime:`ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca237327ffffffffffffffff`},modp14:{gen:`02`,prime:`ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aacaa68ffffffffffffffff`},modp15:{gen:`02`,prime:`ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a93ad2caffffffffffffffff`},modp16:{gen:`02`,prime:`ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c934063199ffffffffffffffff`},modp17:{gen:`02`,prime:`ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dcc4024ffffffffffffffff`},modp18:{gen:`02`,prime:`ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dbe115974a3926f12fee5e438777cb6a932df8cd8bec4d073b931ba3bc832b68d9dd300741fa7bf8afc47ed2576f6936ba424663aab639c5ae4f5683423b4742bf1c978238f16cbe39d652de3fdb8befc848ad922222e04a4037c0713eb57a81a23f0c73473fc646cea306b4bcbc8862f8385ddfa9d4b7fa2c087e879683303ed5bdd3a062b3cf5b3a278a66d2a13f83f44f82ddf310ee074ab6a364597e899a0255dc164f31cc50846851df9ab48195ded7ea1b1d510bd7ee74d73faf36bc31ecfa268359046f4eb879f924009438b481c6cd7889a002ed5ee382bc9190da6fc026e479558e4475677e9aa9e3050e2765694dfc81f56e880b96e7160c980dd98edd3dfffffffffffffffff`}},ca=[];{let e=1e3,t=new Uint8Array(1001);for(let n=2;n*n<=e;n++)if(!t[n])for(let r=n*n;r<=e;r+=n)t[r]=1;for(let n=2;n<=e;n++)t[n]||ca.push(n)}la={},__name(formatReturnValue$1,`formatReturnValue`),DiffieHellman=class{_prime;_generator;_generatorBuf;_primeByteLength;_pubKey;_privKey;_primeCode;_malleable;constructor(e,t,n=!1){this._prime=bufferToBigInt(e),this._generatorBuf=t,this._generator=bufferToBigInt(t),this._primeByteLength=e.length,this._pubKey=void 0,this._privKey=void 0,this._primeCode=void 0,this._malleable=n,n||(this._primeCode=0,this.setPublicKey=void 0,this.setPrivateKey=void 0)}get verifyError(){return typeof this._primeCode!=`number`&&(this._primeCode=getCachedCheckPrime(this._prime,this._generatorBuf)),this._primeCode}generateKeys(e){if(!this._privKey){let e=randomBytes(this._primeByteLength);this._privKey=bufferToBigInt(e)}return this._pubKey=modPow(this._generator,this._privKey,this._prime),this.getPublicKey(e)}computeSecret(e,t,n){let r;r=typeof e==`string`?R.from(e,t||`utf8`):R.from(e);let i=bufferToBigInt(r);if(!this._privKey)throw Error(`You must generate keys before computing a secret`);if(i<=0n||i>=this._prime)throw Error(`Supplied key is too large`);let o=bigIntToBuffer(modPow(i,this._privKey,this._prime)),s=this._primeByteLength;if(o.length<s){let e=R.alloc(s);o.copy(e,s-o.length),o=e}return n?o.toString(n):o}getPrime(e){return formatReturnValue$1(this._prime,e)}getGenerator(e){return formatReturnValue$1(this._generator,e)}getPublicKey(e){if(!this._pubKey)throw Error(`No public key - call generateKeys() first`);return formatReturnValue$1(this._pubKey,e)}getPrivateKey(e){if(!this._privKey)throw Error(`No private key - call generateKeys() first`);return formatReturnValue$1(this._privKey,e)}setPublicKey(e,t){if(!this._malleable)throw Error(`setPublicKey is not available for predefined DH groups`);let n=typeof e==`string`?R.from(e,t||`utf8`):R.from(e);this._pubKey=bufferToBigInt(n)}setPrivateKey(e,t){if(!this._malleable)throw Error(`setPrivateKey is not available for predefined DH groups`);let n=typeof e==`string`?R.from(e,t||`utf8`):R.from(e);this._privKey=bufferToBigInt(n)}},ua={binary:!0,hex:!0,base64:!0,latin1:!0,utf8:!0,"utf-8":!0,base64url:!0,ascii:!0,ucs2:!0,"ucs-2":!0,utf16le:!0,"utf-16le":!0},da=getDiffieHellman,fa=getDiffieHellman});function mod(e,t){let n=e%t;return n<0n?n+t:n}function modInverse(e,t){if(e=mod(e,t),e===0n)throw Error(`No modular inverse for zero`);let[n,r]=[e,t],[i,o]=[1n,0n];for(;r!==0n;){let e=n/r;[n,r]=[r,n-e*r],[i,o]=[o,i-e*o]}if(n!==1n)throw Error(`Modular inverse does not exist`);return mod(i,t)}function pointAdd(e,t,n){if(e===null)return t;if(t===null)return e;let{p:r}=n;if(e.x===t.x)return mod(e.y+t.y,r)===0n?null:pointDouble(e,n);let i=mod(t.x-e.x,r),o=mod(mod(t.y-e.y,r)*modInverse(i,r),r),s=mod(o*o-e.x-t.x,r);return{x:s,y:mod(o*(e.x-s)-e.y,r)}}function pointDouble(e,t){if(e===null)return null;let{a:n,p:r}=t;if(e.y===0n)return null;let i=mod(mod(3n*e.x*e.x+n,r)*modInverse(mod(2n*e.y,r),r),r),o=mod(i*i-2n*e.x,r);return{x:o,y:mod(i*(e.x-o)-e.y,r)}}function scalarMul(e,t,n){if(t===null||e===0n)return null;let{n:r}=n;if(e=mod(e,r),e===0n)return null;let i=null,o=t,s=e.toString(2);for(let e=0;e<s.length;e++)s[e]===`1`?(i=pointAdd(i,o,n),o=pointDouble(o,n)):(o=pointAdd(i,o,n),i=pointDouble(i,n));return i}function bigintToBuffer(e,t){let n=e.toString(16).padStart(t*2,`0`);return R.from(n,`hex`)}function bufferToBigint(e){let t=R.from(e).toString(`hex`);return t.length===0?0n:BigInt(`0x`+t)}function encodePublicKey(e,t,n=`uncompressed`){if(e===null)throw Error(`Cannot encode the point at infinity`);let r=bigintToBuffer(e.x,t);if(n===`compressed`){let t=e.y%2n==0n?2:3;return R.concat([R.from([t]),r])}let i=bigintToBuffer(e.y,t);if(n===`hybrid`){let t=e.y%2n==0n?6:7;return R.concat([R.from([t]),r,i])}return R.concat([R.from([4]),r,i])}function decodePublicKey(e,t){let n=R.from(e);if(n.length===0)throw Error(`Invalid public key: empty buffer`);let r=n[0],{p:i,a:o,b:s,byteLength:c}=t;if(r===4||r===6||r===7){if(n.length!==1+2*c)throw Error(`Invalid public key length: expected ${1+2*c} bytes, got ${n.length}`);let e=bufferToBigint(n.subarray(1,1+c)),t=bufferToBigint(n.subarray(1+c));if(mod(t*t,i)!==mod(e*e*e+o*e+s,i))throw Error(`Invalid public key: point is not on the curve`);return{x:e,y:t}}if(r===2||r===3){if(n.length!==1+c)throw Error(`Invalid public key length: expected ${1+c} bytes, got ${n.length}`);let e=bufferToBigint(n.subarray(1,1+c)),t=sqrtMod(mod(e*e*e+o*e+s,i),i);if(t===null)throw Error(`Invalid public key: no valid y coordinate for the given x`);let l=r===3;return{x:e,y:t%2n!=0n===l?t:mod(i-t,i)}}throw Error(`Invalid public key prefix: 0x${r.toString(16).padStart(2,`0`)}`)}function sqrtMod(e,t){if(e=mod(e,t),e===0n)return 0n;if(modPow(e,(t-1n)/2n,t)!==1n)return null;if(mod(t,4n)===3n)return modPow(e,(t+1n)/4n,t);let n=0n,r=t-1n;for(;mod(r,2n)===0n;)r/=2n,n++;let i=2n;for(;modPow(i,(t-1n)/2n,t)!==t-1n;)i++;let o=n,s=modPow(i,r,t),c=modPow(e,r,t),l=modPow(e,(r+1n)/2n,t);for(;;){if(c===0n)return 0n;if(c===1n)return l;let e=1n,n=mod(c*c,t);for(;n!==1n;)n=mod(n*n,t),e++;let r=modPow(s,modPow(2n,o-e-1n,t-1n),t);o=e,s=mod(r*r,t),c=mod(c*s,t),l=mod(l*r,t)}}function toBuffer(e,t){if(R.isBuffer(e))return e;if(e instanceof Uint8Array)return R.from(e);if(typeof e==`string`)return R.from(e,t||`utf8`);if(ArrayBuffer.isView(e))return R.from(e.buffer,e.byteOffset,e.byteLength);throw TypeError(`The "key" argument must be of type string or an instance of Buffer, TypedArray, or DataView.`)}function formatReturnValue(e,t){return t?e.toString(t):e}function resolveCurve(e){let t=e.toLowerCase(),n=ha[t];if(!n)throw Error(`Unsupported curve: ${e}`);let r=ma[n];if(!r)throw Error(`Unsupported curve: ${e}`);return{canonical:n,params:r}}function createECDH(e){return new ECDH(e)}function getCurves(){return[`secp256k1`,`prime256v1`,`secp256r1`,`secp384r1`,`secp521r1`]}var ma,ha,ECDH,ga=__esmMin(()=>{oa(),aa(),Oe(),ma={secp256k1:{p:115792089237316195423570985008687907853269984665640564039457584007908834671663n,a:0n,b:7n,Gx:55066263022277343669578718895168534326250603453777594175500187360389116729240n,Gy:32670510020758816978083085130507043184471273380659243275938904335757337482424n,n:115792089237316195423570985008687907852837564279074904382605163141518161494337n,byteLength:32},prime256v1:{p:115792089210356248762697446949407573530086143415290314195533631308867097853951n,a:115792089210356248762697446949407573530086143415290314195533631308867097853951n-3n,b:41058363725152142129326129780047268409114441015993725554835256314039467401291n,Gx:48439561293906451759052585252797914202762949526041747995844080717082404635286n,Gy:36134250956749795798585127919587881956611106672985015071877198253568414405109n,n:115792089210356248762697446949407573529996955224135760342422259061068512044369n,byteLength:32},secp384r1:{p:39402006196394479212279040100143613805079739270465446667948293404245721771496870329047266088258938001861606973112319n,a:39402006196394479212279040100143613805079739270465446667948293404245721771496870329047266088258938001861606973112319n-3n,b:27580193559959705877849011840389048093056905856361568521428707301988689241309860865136260764883745107765439761230575n,Gx:26247035095799689268623156744566981891852923491109213387815615900925518854738050089022388053975719786650872476732087n,Gy:8325710961489029985546751289520108179287853048861315594709205902480503199884419224438643760392947333078086511627871n,n:39402006196394479212279040100143613805079739270465446667946905279627659399113263569398956308152294913554433653942643n,byteLength:48},secp521r1:{p:6864797660130609714981900799081393217269435300143305409394463459185543183397656052122559640661454554977296311391480858037121987999716643812574028291115057151n,a:6864797660130609714981900799081393217269435300143305409394463459185543183397656052122559640661454554977296311391480858037121987999716643812574028291115057151n-3n,b:1093849038073734274511112390766805569936207598951683748994586394495953116150735016013708737573759623248592132296706313309438452531591012912142327488478985984n,Gx:2661740802050217063228768716723360960729859168756973147706671368418802944996427808491545080627771902352094241225065558662157113545570916814161637315895999846n,Gy:3757180025770020463545507224491183603594455134769762486694567779615544477440556316691234405012945539562144444537289428522585666729196580810124344277578376784n,n:6864797660130609714981900799081393217269435300143305409394463459185543183397655394245057746333217197532963996371363321113864768612440380340372808892707005449n,byteLength:66}},ha={secp256k1:`secp256k1`,prime256v1:`prime256v1`,secp256r1:`prime256v1`,"p-256":`prime256v1`,p256:`prime256v1`,secp384r1:`secp384r1`,"p-384":`secp384r1`,p384:`secp384r1`,secp521r1:`secp521r1`,"p-521":`secp521r1`,p521:`secp521r1`},ECDH=class{_curve;_curveName;_privateKey=null;_publicKey=null;constructor(e){let t=resolveCurve(e);this._curve=t.params,this._curveName=t.canonical}generateKeys(e,t){let{n,byteLength:r}=this._curve,i;do i=bufferToBigint(randomBytes(r));while(i===0n||i>=n);this._privateKey=i;let o={x:this._curve.Gx,y:this._curve.Gy};return this._publicKey=scalarMul(i,o,this._curve),e===void 0?this.getPublicKey():this.getPublicKey(e,t)}computeSecret(e,t,n){if(this._privateKey===null)throw Error(`ECDH key not generated. Call generateKeys() or setPrivateKey() first.`);let r=decodePublicKey(toBuffer(e,t),this._curve);if(r===null)throw Error(`Invalid public key: point at infinity`);let i=scalarMul(this._privateKey,r,this._curve);if(i===null)throw Error(`Shared secret computation resulted in the point at infinity`);return formatReturnValue(bigintToBuffer(i.x,this._curve.byteLength),n)}getPublicKey(e,t){if(this._publicKey===null)throw Error(`ECDH key not generated. Call generateKeys() or setPrivateKey() first.`);return formatReturnValue(encodePublicKey(this._publicKey,this._curve.byteLength,t||`uncompressed`),e)}getPrivateKey(e){if(this._privateKey===null)throw Error(`ECDH key not generated. Call generateKeys() or setPrivateKey() first.`);return formatReturnValue(bigintToBuffer(this._privateKey,this._curve.byteLength),e)}setPublicKey(e,t){let n=toBuffer(e,t);this._publicKey=decodePublicKey(n,this._curve)}setPrivateKey(e,t){let n=bufferToBigint(toBuffer(e,t));if(n===0n||n>=this._curve.n)throw Error(`Private key is out of range [1, n-1]`);this._privateKey=n;let r={x:this._curve.Gx,y:this._curve.Gy};this._publicKey=scalarMul(n,r,this._curve)}}}),_a=__esmMin(()=>{ve()}),va,ya,ba=__esmMin(()=>{va=Object.defineProperty,ya=__name((e,t)=>{let n={};for(var r in e)va(n,r,{get:e[r],enumerable:!0});return t||va(n,Symbol.toStringTag,{value:`Module`}),n},`__exportAll`)});function _setPipeImpl(e){xa=e}var xa,Stream_,Sa=__esmMin(()=>{Ke(),Stream_=class extends Ge{constructor(e){super(e)}pipe(e,t){return xa(this,e,t)}}});function finished$1(e,t,n){let r;r=typeof t==`function`?t:n;let i=!1;function done(e){i||(i=!0,r(e))}let onFinish=()=>done(),onEnd=()=>done(),onError=e=>done(e),onClose=()=>{let t=e,n=e;!t.writableFinished&&!n.readableEnded&&done(Error(`premature close`))};e.on(`finish`,onFinish),e.on(`end`,onEnd),e.on(`error`,onError),e.on(`close`,onClose);let o=e,s=typeof e.write==`function`,c=typeof e.read==`function`,l=o.writableFinished===!0,u=o.readableEnded===!0;if(o.destroyed===!0){let e=o._err;ee(e?()=>done(e):s&&l||c&&u?()=>done():()=>done(Error(`premature close`)))}else(s&&!c&&l||!s&&c&&u||s&&c&&l&&u)&&ee(()=>done());return function cleanup(){e.removeListener(`finish`,onFinish),e.removeListener(`end`,onEnd),e.removeListener(`error`,onError),e.removeListener(`close`,onClose)}}function addAbortSignal(e,t){if(!(e instanceof AbortSignal))throw TypeError(`The first argument must be an AbortSignal`);if(!(t instanceof Stream_))throw TypeError(`The second argument must be a Stream`);let n=t;if(e.aborted)n.destroy(Error(`The operation was aborted`));else{let onAbort=()=>{n.destroy(Error(`The operation was aborted`))};e.addEventListener(`abort`,onAbort,{once:!0}),t.once(`close`,()=>{e.removeEventListener(`abort`,onAbort)})}return t}function isReadable(e){if(e==null)return!1;let t=e;return typeof t.readable!=`boolean`||typeof t.read!=`function`||t.destroyed===!0||t.readableEnded===!0?!1:t.readable===!0}function isWritable(e){if(e==null)return!1;let t=e;return typeof t.writable!=`boolean`||typeof t.write!=`function`||t.destroyed===!0||t.writableEnded===!0?!1:t.writable===!0}function isDestroyed(e){return e==null?!1:e.destroyed===!0}function isDisturbed(e){if(e==null)return!1;let t=e;return t.readableDidRead===!0||t.readableFlowing!==null&&t.readableFlowing!==void 0}function isErrored(e){if(e==null)return!1;let t=e;return t.destroyed===!0&&typeof t.readable==`boolean`&&t.readable===!1||t.destroyed===!0&&typeof t.writable==`boolean`&&t.writable===!1}var Ca=__esmMin(()=>{Sa(),ve(),__name(finished$1,`finished`)});function getDefaultHighWaterMark(e){return e?Ta:wa}function setDefaultHighWaterMark(e,t){if(typeof t!=`number`||t<0||Number.isNaN(t))throw TypeError(`Invalid highWaterMark: ${t}`);e?Ta=t:wa=t}function validateHighWaterMark(e,t){if(t!==void 0&&(typeof t!=`number`||Number.isNaN(t))){let n=TypeError(`The value of "${e}" is invalid. Received ${t}`);throw n.code=`ERR_INVALID_ARG_VALUE`,n}}var wa,Ta,Ea=__esmMin(()=>{wa=16384,Ta=16});function createAbortError(){let e=Error(`The operation was aborted`);return e.name=`AbortError`,e.code=`ABORT_ERR`,e}async function streamAsyncDispose(e,t){let n;e.destroyed||(n=t?void 0:createAbortError(),e.destroy(n)),await new Promise((t,r)=>{finished$1(e,e=>{e&&e!==n?r(e):t()})})}var Da,Oa=__esmMin(()=>{Ca(),Da=Symbol.asyncDispose??Symbol.for(`Symbol.asyncDispose`)});function chunkLength(e){if(e==null)return 1;let t=e.length;return typeof t==`number`?t:1}function sliceChunk(e,t,n){if(typeof e==`string`)return n===void 0?e.slice(t):e.slice(t,n);let r=e.slice;return typeof r==`function`?r.call(e,t,n):e}var ka,Aa,ja,Ma=__esmMin(()=>{Sa(),Oa(),Ea(),ve(),ka=class Readable_ extends Stream_{readable=!0;readableFlowing=null;readableLength=0;readableHighWaterMark;readableEncoding;readableObjectMode;readableEnded=!1;readableAborted=!1;destroyed=!1;_pipeDests=[];_buffer=[];_readableState={ended:!1,endEmitted:!1,reading:!1,constructed:!0,highWaterMark:0,objectMode:!1,pipes:[]};_err;_readablePending=!1;_readImpl;_constructImpl;constructor(e){super(e),this.readableHighWaterMark=e?.highWaterMark??getDefaultHighWaterMark(e?.objectMode??!1),this.readableEncoding=e?.encoding??null,this.readableObjectMode=e?.objectMode??!1,this._readableState.highWaterMark=this.readableHighWaterMark,this._readableState.objectMode=this.readableObjectMode,e?.read&&(this._readImpl=e.read),e?.destroy&&(this._destroy=e.destroy),e?.construct&&(this._constructImpl=e.construct),(this._constructImpl||this._construct!==Readable_.prototype._construct)&&(this._readableState.constructed=!1,nextTick(()=>{this._construct(e=>{this._readableState.constructed=!0,e?this.destroy(e):this.readableFlowing===!0&&this._flow()})}))}_construct(e){this._constructImpl?this._constructImpl.call(this,e):e()}_read(e){this._readImpl&&this._readImpl.call(this,e)}read(e){if(!this._readableState.constructed)return null;if(this._buffer.length===0){if(this._readableState.ended)return null;this._readableState.reading=!0,this._read(e??this.readableHighWaterMark),this._readableState.reading=!1}if(this._buffer.length===0||e===0)return null;if(this.readableObjectMode){if(e===void 0){let e=this._buffer.shift();return--this.readableLength,this._readableState.ended&&this._buffer.length===0&&!this._readableState.endEmitted&&this._emitEnd(),e}if(e>this.readableLength)return null;let t=this._buffer.shift();return--this.readableLength,t}if(e!=null)return e>this.readableLength?null:this._readBytes(e);let t=this._buffer.splice(0);if(this.readableLength=0,this._readableState.ended&&this._buffer.length===0&&!this._readableState.endEmitted&&this._emitEnd(),t.length===1)return t[0];if(t.length===0)return null;if(typeof t[0]==`string`)return t.join(``);let n=globalThis.Buffer;return n?.concat?n.concat(t):t}_readBytes(e){let t=0,n=[];for(;t<e&&this._buffer.length>0;){let r=this._buffer[0],i=chunkLength(r);if(t+i<=e)n.push(this._buffer.shift()),t+=i,this.readableLength-=i;else{let i=e-t;n.push(sliceChunk(r,0,i)),this._buffer[0]=sliceChunk(r,i),this.readableLength-=i,t+=i}}if(n.length===1)return n[0];let r=globalThis.Buffer;return r?.concat?r.concat(n):n}push(e,t){if(e===null)return this._readableState.ended=!0,this.readableEnded=!0,this._buffer.length===0&&!this._readableState.endEmitted&&nextTick(()=>this._emitEnd()),this._scheduleReadable(),!1;if(!this.readableObjectMode&&!(typeof e==`string`||ArrayBuffer.isView(e))){let t=Object.assign(TypeError(`Invalid non-string/buffer chunk type: ${typeof e}`),{code:`ERR_INVALID_ARG_TYPE`});return nextTick(()=>this.emit(`error`,t)),!1}return this._buffer.push(e),this.readableLength+=this.readableObjectMode?1:chunkLength(e),this.readableFlowing&&!this._flowing&&nextTick(()=>this._flow()),this.readableFlowing!==!0&&this._scheduleReadable(),this.readableLength<this.readableHighWaterMark}_emitEnd(){this._readableState.endEmitted||(this._readableState.endEmitted=!0,this.emit(`end`),nextTick(()=>this._autoClose()))}_autoClose(){this.emit(`close`)}_scheduleReadable(){this._readablePending||this.listenerCount(`readable`)===0||(this._readablePending=!0,nextTick(()=>{this._readablePending=!1,this.destroyed||this.emit(`readable`)}))}on(e,t){return super.on(e,t),e===`data`&&this.readableFlowing!==!1&&this.listenerCount(`readable`)===0&&this.resume(),e===`readable`&&(this.readableFlowing=!1,this._buffer.length>0||this._readableState.ended?this._scheduleReadable():this._readableState.reading||nextTick(()=>{this.destroyed||this.read(0)})),this}removeListener(e,t){let n=super.removeListener(e,t);return e===`readable`&&nextTick(()=>this._updateReadableListening()),n}removeAllListeners(e){let t=e===void 0?super.removeAllListeners():super.removeAllListeners(e);return(e===`readable`||e===void 0)&&nextTick(()=>this._updateReadableListening()),t}_updateReadableListening(){this.listenerCount(`readable`)>0||(this.listenerCount(`data`)>0?this.resume():this.readableFlowing=null)}unshift(e){this._buffer.unshift(e),this.readableLength+=this.readableObjectMode?1:chunkLength(e)}setEncoding(e){return this.readableEncoding=e,this}pause(){return this.readableFlowing=!1,this.emit(`pause`),this}resume(){return this.readableFlowing!==!0&&(this.readableFlowing=!0,this.emit(`resume`),this._readableState.constructed&&this._flow()),this}_flowing=!1;_flow(){if(!(this.readableFlowing!==!0||this._flowing||this.destroyed)&&this._readableState.constructed){this._flowing=!0;try{for(;this._buffer.length>0&&this.readableFlowing&&!this.destroyed;){let e=this._buffer.shift();if(this.readableLength-=this.readableObjectMode?1:chunkLength(e),this.readableEncoding&&typeof e!=`string`){let t=globalThis.Buffer;t?.isBuffer&&t.isBuffer(e)?e=e.toString(this.readableEncoding):e instanceof Uint8Array&&(e=new TextDecoder(this.readableEncoding).decode(e))}this.emit(`data`,e)}if(this.destroyed)return;if(this._readableState.ended&&this._buffer.length===0&&!this._readableState.endEmitted){nextTick(()=>this._emitEnd());return}!this._readableState.ended&&!this._readableState.reading&&!this.destroyed&&(this._readableState.reading=!0,this._read(this.readableHighWaterMark),this._readableState.reading=!1)}finally{this._flowing=!1}this._buffer.length>0&&this.readableFlowing&&!this.destroyed&&nextTick(()=>this._flow())}}isPaused(){return this.readableFlowing===!1}unpipe(e){if(e){let t=this._pipeDests.findIndex(t=>t.dest===e);if(t!==-1){this._pipeDests[t].cleanup(),this._pipeDests.splice(t,1);let n=this._readableState.pipes.indexOf(e);n!==-1&&this._readableState.pipes.splice(n,1),e.emit(`unpipe`,this),this._pipeDests.length===0&&(this.readableFlowing=!1)}}else{for(let e of this._pipeDests)e.cleanup(),e.dest.emit(`unpipe`,this);this._pipeDests=[],this._readableState.pipes=[],this.readableFlowing=!1}return this}_destroy(e,t){t(e??void 0)}destroy(e){if(this.destroyed)return this;this.destroyed=!0,this.readable=!1,this.readableAborted=!this.readableEnded,e&&(this._err=e);let t=!1,cb=e=>{t||(t=!0,e&&nextTick(()=>this.emit(`error`,e)),nextTick(()=>this.emit(`close`)))};try{this._destroy(e??null,cb)}catch(e){cb(e)}return this}static toWeb(e){return new ReadableStream({start(t){e.on(`data`,e=>{typeof e==`string`?t.enqueue(new TextEncoder().encode(e)):e instanceof Uint8Array?t.enqueue(e):e&&typeof e.length==`number`&&t.enqueue(new Uint8Array(e))}),e.on(`end`,()=>{t.close()}),e.on(`error`,e=>{t.error(e)})},cancel(){e.destroy()}})}static fromWeb(e,t){let n=e.getReader();return new Readable_({...t,read(){n.read().then(({done:e,value:t})=>{e?this.push(null):this.push(t)},e=>{this.destroy(e)})},destroy(e,t){n.cancel(e?.message).then(()=>t(null),t)}})}[Symbol.asyncIterator](){let e=this,t=[],n=!1,r=null,i=null,o=null;return e.on(`data`,e=>{if(i){let t=i;i=null,o=null,t({value:e,done:!1})}else t.push(e)}),e.on(`end`,()=>{if(n=!0,i){let e=i;i=null,o=null,e({value:void 0,done:!0})}}),e.on(`error`,e=>{if(r=e,n=!0,o){let t=o;i=null,o=null,t(e)}}),{next(){return r?Promise.reject(r):t.length>0?Promise.resolve({value:t.shift(),done:!1}):n?Promise.resolve({value:void 0,done:!0}):new Promise((e,t)=>{i=e,o=t})},return(){return e.destroy(),Promise.resolve({value:void 0,done:!0})},[Symbol.asyncIterator](){return this}}}static from(e,t){let n=new Readable_({objectMode:!0,...t,read(){}});return typeof e==`string`||ArrayBuffer.isView(e)?(n.push(e),n.push(null),n):((async()=>{try{for await(let t of e)n.push(t)||await new Promise(e=>n.once(`drain`,e));n.push(null)}catch(e){n.destroy(e)}})(),n)}},ka.prototype[Da]=function(){return streamAsyncDispose(this,this.readableEnded)},Aa=Object.getOwnPropertyDescriptor(ka.prototype,`on`),ja=Object.getOwnPropertyDescriptor(ka.prototype,`removeListener`),Object.defineProperty(ka.prototype,"addListener",{...Aa}),Object.defineProperty(ka.prototype,"off",{...ja})});function writeAfterEndError(){let e=Error(`write after end`);return e.code=`ERR_STREAM_WRITE_AFTER_END`,e}var Na=__esmMin(()=>{});function chunkLen$1(e){if(e==null)return 1;let t=e.length;return typeof t==`number`?t:1}var Duplex_,Pa=__esmMin(()=>{Na(),Ea(),Ma(),ve(),Duplex_=class extends ka{writable=!0;writableHighWaterMark;writableLength=0;writableObjectMode;writableEnded=!1;writableFinished=!1;writableCorked=0;writableNeedDrain=!1;allowHalfOpen;_decodeStrings;_writableState={highWaterMark:0,objectMode:!1};_duplexCorkedBuffer=[];_duplexWriting=!1;_duplexWriteQueue=[];_writeImpl;_finalImpl;_defaultEncoding=`utf8`;_pendingWrites=0;_pendingEndCb=null;_autoClosed=!1;constructor(e){super(e),validateHighWaterMark(`writableHighWaterMark`,e?.writableHighWaterMark),validateHighWaterMark(`readableHighWaterMark`,e?.readableHighWaterMark),this.writableObjectMode=e?.writableObjectMode??e?.objectMode??!1,this.writableHighWaterMark=e?.highWaterMark??e?.writableHighWaterMark??getDefaultHighWaterMark(this.writableObjectMode),this._writableState.highWaterMark=this.writableHighWaterMark,this._writableState.objectMode=this.writableObjectMode,e?.highWaterMark===void 0&&e?.readableHighWaterMark!==void 0&&(this.readableHighWaterMark=e.readableHighWaterMark,this._readableState.highWaterMark=e.readableHighWaterMark),e?.readableObjectMode!==void 0&&(this.readableObjectMode=e.readableObjectMode,this._readableState.objectMode=e.readableObjectMode,e?.readableHighWaterMark===void 0&&e?.highWaterMark===void 0&&(this.readableHighWaterMark=getDefaultHighWaterMark(e.readableObjectMode),this._readableState.highWaterMark=this.readableHighWaterMark)),this.allowHalfOpen=e?.allowHalfOpen!==!1,this._decodeStrings=e?.decodeStrings!==!1,e?.write&&(this._writeImpl=e.write),e?.final&&(this._finalImpl=e.final),this.allowHalfOpen||this.once(`end`,()=>{this.writableEnded||nextTick(()=>this.end())})}_write(e,t,n){this._writeImpl?this._writeImpl.call(this,e,t,n):n()}_final(e){this._finalImpl?this._finalImpl.call(this,e):e()}destroy(e){return this.destroyed?this:(this.writable=!1,super.destroy(e))}write(e,t,n){let r,i;if(typeof t==`function`?(r=t,i=this._defaultEncoding):(i=t??this._defaultEncoding,r=n??(()=>{})),this._decodeStrings&&!this.writableObjectMode&&typeof e==`string`){let t=globalThis.Buffer;t&&(e=t.from(e,i),i=`buffer`)}if(typeof e!=`string`&&!this.writableObjectMode){let t=globalThis.Buffer;(t&&t.isBuffer(e)||e instanceof Uint8Array)&&(i=`buffer`)}if(this.writableEnded){let e=writeAfterEndError();return nextTick(()=>{r(e),this.emit(`error`,e),this.destroy()}),!1}if(this.writableLength+=this.writableObjectMode?1:chunkLen$1(e),this.writableCorked>0)return this._duplexCorkedBuffer.push({chunk:e,encoding:i,callback:r}),this.writableLength<this.writableHighWaterMark;let o=this.writableLength<this.writableHighWaterMark;return o||(this.writableNeedDrain=!0),this._duplexDoWrite(e,i,r),o}_duplexDoWrite(e,t,n){if(this._duplexWriting){this._duplexWriteQueue.push({chunk:e,encoding:t,callback:n});return}this._duplexWriting=!0,this._duplexStartWrite(e,t,n)}_duplexStartWrite(e,t,n){this._pendingWrites++,this._write(e,t,t=>{this._pendingWrites--,this.writableLength-=this.writableObjectMode?1:chunkLen$1(e),nextTick(t?()=>{if(n(t),this._duplexWriting=!1,this.destroyed||this.emit(`error`,t),this._duplexWriteQueue.length>0){let e=this._duplexWriteQueue.shift();this._duplexWriting=!0,this._duplexStartWrite(e.chunk,e.encoding,e.callback)}}:()=>{if(n(),this._duplexWriteQueue.length>0){let e=this._duplexWriteQueue.shift();this._duplexStartWrite(e.chunk,e.encoding,e.callback);return}if(this._duplexWriting=!1,this.writableNeedDrain&&this.writableLength<=this.writableHighWaterMark&&(this.writableNeedDrain=!1,this.emit(`drain`)),this._pendingWrites===0&&this._pendingEndCb){let e=this._pendingEndCb;this._pendingEndCb=null,e()}})})}end(e,t,n){typeof e==`function`&&(n=e,e=void 0),typeof t==`function`&&(n=t,t=void 0),e!=null&&this.write(e,t),this.writableEnded=!0;let doFinal=()=>{this._final(e=>{this.writableFinished=!0,this._doPrefinishHooks(()=>{nextTick(()=>{e&&this.emit(`error`,e),this.emit(`finish`),nextTick(()=>this._closeAfterFinish()),n&&n()})})})};return this._pendingWrites>0||this._duplexWriting||this._duplexWriteQueue.length>0?this._pendingEndCb=doFinal:doFinal(),this}_closeAfterFinish(){this._autoClosed||!this.destroyed&&!this._readableState.endEmitted&&this.readable||(this._autoClosed=!0,this.emit(`close`))}_autoClose(){this._autoClosed||(this._autoClosed=!0,this.emit(`close`))}_doPrefinishHooks(e){e()}cork(){this.writableCorked++}uncork(){if(this.writableCorked>0&&(this.writableCorked--,this.writableCorked===0&&this._duplexCorkedBuffer.length>0)){let e=this._duplexCorkedBuffer.splice(0);for(let{chunk:t,encoding:n,callback:r}of e)this._write(t,n,e=>{this.writableLength-=this.writableObjectMode?1:chunkLen$1(t),e?(r(e),this.destroyed||this.emit(`error`,e)):r()});this.writableNeedDrain&&this.writableLength<=this.writableHighWaterMark&&(this.writableNeedDrain=!1,nextTick(()=>this.emit(`drain`)))}}setDefaultEncoding(e){return this._defaultEncoding=e,this}},__name(chunkLen$1,`chunkLen`)});function pipe(e,t,n){let r=e,i=n?.end!==!1,o=!1,ondrain=()=>{o=!1,t.removeListener(`drain`,ondrain);let e=r;typeof e.resume==`function`&&e.resume()},ondata=e=>{if(t.writable){let n=r;t.write(e)===!1&&typeof n.pause==`function`&&(n.pause(),o||(o=!0,t.on(`drain`,ondrain)))}};r.on(`data`,ondata);let s=!1,onend=()=>{s||(s=!0,i&&t.end())},onclose=()=>{if(!s&&(s=!0,i&&!(r instanceof ka))){let e=t;typeof e.destroy==`function`&&e.destroy()}};i&&(r.on(`end`,onend),r.on(`close`,onclose));let cleanup=()=>{r.removeListener(`data`,ondata),o&&t.removeListener(`drain`,ondrain),r.removeListener(`end`,onend),r.removeListener(`close`,onclose),r.removeListener(`end`,cleanup),r.removeListener(`close`,cleanup),t.removeListener(`close`,cleanup)};return r.on(`end`,cleanup),r.on(`close`,cleanup),t.on(`close`,cleanup),r instanceof ka&&(r._pipeDests.push({dest:t,cleanup}),r._readableState.pipes.push(t)),t.emit(`pipe`,r),t}var Fa=__esmMin(()=>{Sa(),Ma(),_setPipeImpl(pipe)});function chunkLen(e){if(e==null)return 1;let t=e.length;return typeof t==`number`?t:1}var Ia,La=__esmMin(()=>{Na(),Sa(),Oa(),Ea(),ve(),Ia=class Writable_ extends Stream_{static[Symbol.hasInstance](e){let t=this;return t.prototype!==void 0&&Object.prototype.isPrototypeOf.call(t.prototype,e)?!0:t.prototype!==Writable_.prototype||e==null?!1:typeof e.writableHighWaterMark==`number`}writable=!0;writableHighWaterMark;writableLength=0;writableObjectMode;writableEnded=!1;writableFinished=!1;writableCorked=0;writableNeedDrain=!1;destroyed=!1;_err;_writableState={ended:!1,finished:!1,constructed:!0,writing:!1};_corkedBuffer=[];_writeBuffer=[];_pendingConstruct=[];_ending=!1;_endCallback;_pendingEnd=null;_writeImpl;_writev;_finalImpl;_constructImpl;_decodeStrings;_defaultEncoding=`utf8`;_autoDestroy;constructor(e){super(e),this.writableHighWaterMark=e?.highWaterMark??getDefaultHighWaterMark(e?.objectMode??!1),this.writableObjectMode=e?.objectMode??!1,this._decodeStrings=e?.decodeStrings!==!1,this._autoDestroy=e?.autoDestroy!==!1,e?.write&&(this._writeImpl=e.write),e?.writev&&(this._writev=e.writev),e?.final&&(this._finalImpl=e.final),e?.destroy&&(this._destroy=e.destroy),e?.construct&&(this._constructImpl=e.construct),(this._constructImpl||this._construct!==Writable_.prototype._construct)&&(this._writableState.constructed=!1,nextTick(()=>{this._construct(e=>{this._writableState.constructed=!0,e?this.destroy(e):this._maybeFlush()})}))}_construct(e){this._constructImpl?this._constructImpl.call(this,e):e()}_write(e,t,n){this._writeImpl?this._writeImpl.call(this,e,t,n):n()}_final(e){this._finalImpl?this._finalImpl.call(this,e):e()}_destroy(e,t){t(e)}_maybeFlush(){let e=this._pendingConstruct.splice(0);if(e.length>0){let[t,...n]=e;this._writeBuffer.push(...n),this._doWrite(t.chunk,t.encoding,t.callback)}if(this._pendingEnd){let{chunk:e,encoding:t,callback:n}=this._pendingEnd;this._pendingEnd=null,this._doEnd(e,t,n)}}_doWrite(e,t,n){this._writableState.writing=!0;let r=!0;this._write(e,t,t=>{if(this.writableLength-=this.writableObjectMode?1:chunkLen(e),r){nextTick(()=>{if(t){n(t),this.emit(`error`,t);return}n(),this.writableNeedDrain&&this.writableLength<=this.writableHighWaterMark&&(this.writableNeedDrain=!1,this.emit(`drain`))}),t||this._drainWriteBuffer();return}nextTick(t?()=>{n(t),this.emit(`error`,t),this._drainWriteBuffer()}:()=>{n(),this.writableNeedDrain&&this.writableLength<=this.writableHighWaterMark&&(this.writableNeedDrain=!1,this.emit(`drain`)),this._drainWriteBuffer()})}),r=!1}_drainWriteBuffer(){if(this._writeBuffer.length>0){let e=this._writeBuffer.shift();this._doWrite(e.chunk,e.encoding,e.callback)}else this._writableState.writing=!1,this._maybeFinish()}_maybeFinish(){!this._ending||this._writableState.finished||this._writableState.writing||this._writeBuffer.length>0||(this._ending=!1,this._final(e=>{this.writableFinished=!0,this._writableState.finished=!0,nextTick(()=>{e&&this.emit(`error`,e),this.emit(`finish`),this._autoDestroy?this.destroy():nextTick(()=>this.emit(`close`)),this._endCallback&&this._endCallback()})}))}write(e,t,n){let r,i;if(typeof t==`function`?(r=t,i=this._defaultEncoding):(i=t??this._defaultEncoding,r=n??(()=>{})),this._decodeStrings&&!this.writableObjectMode&&typeof e==`string`){let t=globalThis.Buffer;t&&(e=t.from(e,i),i=`buffer`)}if(typeof e!=`string`&&!this.writableObjectMode){let t=globalThis.Buffer;(t&&t.isBuffer(e)||e instanceof Uint8Array)&&(i=`buffer`)}if(this.writableEnded){let e=writeAfterEndError();return nextTick(()=>{r(e),this.emit(`error`,e)}),!1}if(this.writableLength+=this.writableObjectMode?1:chunkLen(e),this.writableCorked>0)return this._corkedBuffer.push({chunk:e,encoding:i,callback:r}),this.writableLength<this.writableHighWaterMark;if(!this._writableState.constructed)return this._pendingConstruct.push({chunk:e,encoding:i,callback:r}),this.writableLength<this.writableHighWaterMark;let o=this.writableLength<this.writableHighWaterMark;return o||(this.writableNeedDrain=!0),this._writableState.writing?this._writeBuffer.push({chunk:e,encoding:i,callback:r}):this._doWrite(e,i,r),o}_doEnd(e,t,n){e!=null&&this.write(e,t),this.writableEnded=!0,this._writableState.ended=!0,this._ending=!0,this._endCallback=n,this._maybeFinish()}end(e,t,n){return typeof e==`function`&&(n=e,e=void 0),typeof t==`function`&&(n=t,t=void 0),this.writableEnded?(n&&nextTick(n),this):this._writableState.constructed?(this._doEnd(e,t,n),this):(this._pendingEnd={chunk:e,encoding:t,callback:n},this)}cork(){this.writableCorked++}uncork(){this.writableCorked>0&&(this.writableCorked--,this.writableCorked===0&&this._corkedBuffer.length>0&&this._flushCorkedBuffer())}_flushCorkedBuffer(){if(this._writev&&this._corkedBuffer.length>1){let e=this._corkedBuffer.splice(0),t=e.map(e=>({chunk:e.chunk,encoding:e.encoding}));this._writev.call(this,t,t=>{for(let t of e)this.writableLength-=this.writableObjectMode?1:chunkLen(t.chunk);if(t){for(let n of e)n.callback(t);this.emit(`error`,t)}else{for(let t of e)t.callback();this.writableNeedDrain&&this.writableLength<=this.writableHighWaterMark&&(this.writableNeedDrain=!1,this.emit(`drain`))}})}else{let e=this._corkedBuffer.splice(0);if(e.length>0){let[t,...n]=e;this._writeBuffer.push(...n),this._doWrite(t.chunk,t.encoding,t.callback)}}}setDefaultEncoding(e){return this._defaultEncoding=e,this}destroy(e){if(this.destroyed)return this;this.destroyed=!0,this.writable=!1,e&&(this._err=e);let t=!1,cb=e=>{t||(t=!0,e&&nextTick(()=>this.emit(`error`,e)),nextTick(()=>this.emit(`close`)))};try{this._destroy(e??null,cb)}catch(e){cb(e)}return this}},Ia.prototype[Da]=function(){return streamAsyncDispose(this,this.writableFinished)}}),Ra,za=__esmMin(()=>{Pa(),ve(),Ra=class Transform_ extends Duplex_{constructor(e){super({...e,write:void 0,final:void 0});let t=this;e?.transform&&(t._transform=e.transform),e?.flush&&(t._flush=e.flush),e?.final&&(t._final=e.final)}_transform(e,t,n){throw Object.assign(Error(`The _transform() method is not implemented`),{code:`ERR_METHOD_NOT_IMPLEMENTED`})}_flush(e){e()}_write(e,t,n){let r=!1;try{this._transform(e,t,(e,t)=>{if(r){let e=Object.assign(Error(`Callback called multiple times`),{code:`ERR_MULTIPLE_CALLBACK`});nextTick(()=>this.emit(`error`,e));return}if(r=!0,e){n(e);return}t!=null&&this.push(t),n()})}catch(e){if(e?.code===`ERR_METHOD_NOT_IMPLEMENTED`)throw e;n(e)}}_final(e){this._flush((t,n)=>{if(t){e(t);return}n!=null&&this.push(n),this.push(null),e()})}_doPrefinishHooks(e){let t=Transform_.prototype._final;this._final===t?e():t.call(this,e)}}}),PassThrough_,Ba=__esmMin(()=>{za(),PassThrough_=class extends Ra{constructor(e){super({...e,transform(e,t,n){n(null,e)}})}}});function pipeline$1(...e){let t=e,n=typeof t[t.length-1]==`function`?t.pop():void 0,r=t;if(r.length<2)throw Error(`pipeline requires at least 2 streams`);let i=null;function onError(e){if(!i){i=e;for(let e of r)typeof e.destroy==`function`&&e.destroy();n&&n(e)}}let o=r[0];for(let e=1;e<r.length;e++){let t=r[e];o.pipe(t),o.on(`error`,onError),o=t}let s=r[r.length-1];return s.on(`error`,onError),s.on(`finish`,()=>{n&&!i&&n(null)}),s}var Va=__esmMin(()=>{__name(pipeline$1,`pipeline`)});function pipeline(...e){return new Promise((t,n)=>{let cb=e=>{e?n(e):t()};pipeline$1(...e,cb)})}function finished(e,t){return new Promise((n,r)=>{t&&typeof t!=`function`?finished$1(e,t,e=>{e?r(e):n()}):finished$1(e,e=>{e?r(e):n()})})}var Ha,Ua,Wa=__esmMin(()=>{ba(),Ca(),Va(),Ha=ya({default:()=>Ua,finished:()=>finished,pipeline:()=>pipeline}),Ua={pipeline,finished}}),Ga,Ka,qa,Ja,Ya,Xa,Za=__esmMin(()=>{_a(),Sa(),Ca(),Ea(),Ma(),Pa(),Fa(),La(),za(),Ba(),Va(),Wa(),Ga=makeCallable(Stream_),Ka=makeCallable(ka),qa=makeCallable(Ia),Ja=makeCallable(Duplex_),Ya=makeCallable(Ra),Xa=makeCallable(PassThrough_),Object.assign(Ga,{Stream:Ga,Readable:Ka,Writable:qa,Duplex:Ja,Transform:Ya,PassThrough:Xa,pipeline:pipeline$1,finished:finished$1,addAbortSignal,isReadable,isWritable,isDestroyed,isDisturbed,isErrored,getDefaultHighWaterMark,setDefaultHighWaterMark,promises:Ha})});function getChecksumType(e){let t=normalizeAlgorithm(e),n=Qa[t];if(n===void 0){let t=Error(`Unknown message digest: ${e}`);throw t.code=`ERR_CRYPTO_HASH_UNKNOWN`,t}return n}function getHashes(){return[`md5`,`sha1`,`sha256`,`sha384`,`sha512`]}function hash(e,t,n){return new $a(e).update(t).digest(n)}var Qa,$a,eo=__esmMin(()=>{Er(),Oe(),je(),Za(),Qa={md5:z.ChecksumType.MD5,sha1:z.ChecksumType.SHA1,sha256:z.ChecksumType.SHA256,sha384:z.ChecksumType.SHA384,sha512:z.ChecksumType.SHA512},$a=class Hash extends Ya{_algorithm;_checksum;_finalized=!1;constructor(e){super();let t=normalizeAlgorithm(e),n=getChecksumType(t);this._algorithm=t,this._checksum=new z.Checksum(n)}update(e,t){if(this._finalized)throw Error(`Digest already called`);let n;if(typeof e==`string`){let r=normalizeEncoding(t);n=R.from(e,r)}else n=e instanceof Uint8Array?e:R.from(e);return this._checksum.update(n),this}digest(e){if(this._finalized)throw Error(`Digest already called`);this._finalized=!0;let t=this._checksum.get_string(),n=R.from(t,`hex`);return e?n.toString(e):n}copy(){if(this._finalized)throw Error(`Digest already called`);let e=Object.create(Hash.prototype);return Ya.call(e),e._algorithm=this._algorithm,e._finalized=!1,e._checksum=this._checksum.copy(),e}_transform(e,t,n){try{this.update(e,t),n()}catch(e){n(e)}}_flush(e){try{this.push(this.digest()),e()}catch(t){e(t)}}}}),Hmac,to=__esmMin(()=>{Er(),eo(),Oe(),Za(),Hmac=class extends Ya{_algorithm;_innerHash;_outerKeyPad;_finalized=!1;constructor(e,t){super();let n=normalizeAlgorithm(e);if(!Tr.has(n)){let t=Error(`Unknown message digest: ${e}`);throw t.code=`ERR_CRYPTO_HASH_UNKNOWN`,t}this._algorithm=n;let r;r=typeof t==`string`?R.from(t,`utf8`):t instanceof Uint8Array?t:R.from(t);let i=wr[n];if(r.length>i){let e=new $a(n);e.update(r),r=e.digest()}let o=new Uint8Array(i);o.set(r);let s=new Uint8Array(i),c=new Uint8Array(i);for(let e=0;e<i;e++)s[e]=o[e]^54,c[e]=o[e]^92;this._outerKeyPad=c,this._innerHash=new $a(n),this._innerHash.update(s)}update(e,t){if(this._finalized)throw Error(`Digest already called`);let n;if(typeof e==`string`){let r=normalizeEncoding(t);n=R.from(e,r)}else n=e instanceof Uint8Array?e:R.from(e);return this._innerHash.update(n),this}digest(e){if(this._finalized)throw Error(`Digest already called`);this._finalized=!0;let t=this._innerHash.digest(),n=new $a(this._algorithm);n.update(this._outerKeyPad),n.update(t);let r=n.digest();return e?r.toString(e):r}_transform(e,t,n){try{this.update(e,t),n()}catch(e){n(e)}}_flush(e){try{this.push(this.digest()),e()}catch(t){e(t)}}}});function getCurve(e){let t=ha[e.toLowerCase()];if(!t)throw Error(`Unsupported curve: ${e}`);return ma[t]}function truncateHash(e,t){let n=t.n.toString(2).length,r=bytesToBigInt(e),i=e.length*8;return i>n&&(r>>=BigInt(i-n)),r}function hmacDigest$2(e,t,n){let r=new Hmac(e,t);return r.update(n),new Uint8Array(r.digest())}function rfc6979(e,t,n,r){let i=r.byteLength,o=n.length,s=new Uint8Array(o).fill(1),c=new Uint8Array(o).fill(0),l=bigIntToBytes(t,i),u=bigIntToBytes(mod(truncateHash(n,r),r.n),i),d=new Uint8Array(o+1+i+i);d.set(s,0),d[o]=0,d.set(l,o+1),d.set(u,o+1+i),c=hmacDigest$2(e,c,d),s=hmacDigest$2(e,c,s);let f=new Uint8Array(o+1+i+i);f.set(s,0),f[o]=1,f.set(l,o+1),f.set(u,o+1+i),c=hmacDigest$2(e,c,f),s=hmacDigest$2(e,c,s);for(let t=0;t<100;t++){let t=new Uint8Array;for(;t.length<i;){s=hmacDigest$2(e,c,s);let n=new Uint8Array(t.length+s.length);n.set(t,0),n.set(s,t.length),t=n}let n=truncateHash(t.slice(0,i),r);if(n>=1n&&n<r.n)return n;let l=new Uint8Array(o+1);l.set(s,0),l[o]=0,c=hmacDigest$2(e,c,l),s=hmacDigest$2(e,c,s)}throw Error(`RFC 6979: failed to generate valid k after 100 attempts`)}function ecdsaSign(e,t,n,r){let i=getCurve(r),o={x:i.Gx,y:i.Gy},s=bytesToBigInt(t),c=new $a(e);c.update(n);let l=new Uint8Array(c.digest()),u=truncateHash(l,i),d=rfc6979(e,s,l,i),f=scalarMul(d,o,i);if(f===null)throw Error(`ECDSA: k * G is point at infinity`);let p=mod(f.x,i.n);if(p===0n)throw Error(`ECDSA: r is zero`);let m=mod(modInverse(d,i.n)*(u+p*s),i.n);if(m===0n)throw Error(`ECDSA: s is zero`);let h=i.byteLength,g=new Uint8Array(h*2);return g.set(bigIntToBytes(p,h),0),g.set(bigIntToBytes(m,h),h),g}function ecdsaVerify(e,t,n,r,i){let o=getCurve(i),s={x:o.Gx,y:o.Gy},c=o.byteLength;if(t[0]!==4||t.length!==1+c*2)return!1;let l={x:bytesToBigInt(t.slice(1,1+c)),y:bytesToBigInt(t.slice(1+c))};if(n.length!==c*2)return!1;let u=bytesToBigInt(n.slice(0,c)),d=bytesToBigInt(n.slice(c));if(u<1n||u>=o.n||d<1n||d>=o.n)return!1;let f=new $a(e);f.update(r);let p=truncateHash(new Uint8Array(f.digest()),o),m=modInverse(d,o.n),h=mod(p*m,o.n),g=mod(u*m,o.n),_=pointAdd(scalarMul(h,s,o),scalarMul(g,l,o),o);return _===null?!1:mod(_.x,o.n)===u}var no=__esmMin(()=>{oa(),ga(),eo(),to(),__name(hmacDigest$2,`hmacDigest`)});function hmacDigest$1(e,t,n){let r=new Hmac(e,t);return r.update(n),r.digest()}function hkdfExtract(e,t,n){return hmacDigest$1(e,n,t)}function hkdfExpand(e,t,n,r,i){let o=Math.ceil(r/i);if(o>255)throw Error(`HKDF cannot generate more than 255 * HashLen bytes`);let s=R.allocUnsafe(o*i),c=R.alloc(0);for(let r=1;r<=o;r++)c=hmacDigest$1(e,t,R.concat([c,n,R.from([r])])),c.copy(s,(r-1)*i);return R.from(s.buffer,s.byteOffset,r)}function hkdfSync(e,t,n,r,i){let o=normalizeAlgorithm(e),s=Cr[o];if(!Tr.has(o)||s===void 0)throw TypeError(`Unknown message digest: ${e}`);if(typeof i!=`number`||i<0)throw TypeError(`keylen must be a non-negative number`);let c=toBuffer$1(t),l=toBuffer$1(n),u=toBuffer$1(r),d=hkdfExpand(o,hkdfExtract(o,c,l.length===0?R.alloc(s,0):l),u,i,s),f=new ArrayBuffer(d.length);return new Uint8Array(f).set(d),f}function hkdf(e,t,n,r,i,o){setTimeout(()=>{try{o(null,hkdfSync(e,t,n,r,i))}catch(e){o(e instanceof Error?e:Error(String(e)))}},0)}var ro=__esmMin(()=>{Er(),to(),Oe(),__name(hmacDigest$1,`hmacDigest`)});function hmacDigest(e,t,n){let r=new Hmac(e,t);return r.update(n),r.digest()}function validateParameters(e,t){if(typeof e!=`number`||e<0||!Number.isFinite(e)||e===0)throw TypeError(`iterations must be a positive number`);if(typeof t!=`number`||t<0||!Number.isFinite(t)||t>2147483647)throw TypeError(`keylen must be a positive number`)}function pbkdf2Sync(e,t,n,r,i){validateParameters(n,r);let o=toBuffer$1(e),s=toBuffer$1(t),c=normalizeAlgorithm(i||`sha1`),l=Cr[c];if(!Tr.has(c)||l===void 0)throw TypeError(`Unknown message digest: ${i||`sha1`}`);if(r===0)return R.alloc(0);let u=Math.ceil(r/l),d=R.allocUnsafe(u*l);for(let e=1;e<=u;e++){let t=R.allocUnsafe(s.length+4);s.copy(t,0),t.writeUInt32BE(e,s.length);let r=hmacDigest(c,o,t),i=R.from(r);for(let e=1;e<n;e++){r=hmacDigest(c,o,r);for(let e=0;e<l;e++)i[e]^=r[e]}i.copy(d,(e-1)*l)}return R.from(d.buffer,d.byteOffset,r)}function pbkdf2(e,t,n,r,i,o){validateParameters(n,r),setTimeout(()=>{try{o(null,pbkdf2Sync(e,t,n,r,i))}catch(e){o(e instanceof Error?e:Error(String(e)))}},0)}var io=__esmMin(()=>{Er(),to(),Oe()});function R$1(e,t){return(e<<t|e>>>32-t)>>>0}function salsa20_8(e){let t=new Uint32Array(16);for(let n=0;n<16;n++)t[n]=e[n];for(let e=0;e<4;e++)t[4]^=R$1(t[0]+t[12],7),t[8]^=R$1(t[4]+t[0],9),t[12]^=R$1(t[8]+t[4],13),t[0]^=R$1(t[12]+t[8],18),t[9]^=R$1(t[5]+t[1],7),t[13]^=R$1(t[9]+t[5],9),t[1]^=R$1(t[13]+t[9],13),t[5]^=R$1(t[1]+t[13],18),t[14]^=R$1(t[10]+t[6],7),t[2]^=R$1(t[14]+t[10],9),t[6]^=R$1(t[2]+t[14],13),t[10]^=R$1(t[6]+t[2],18),t[3]^=R$1(t[15]+t[11],7),t[7]^=R$1(t[3]+t[15],9),t[11]^=R$1(t[7]+t[3],13),t[15]^=R$1(t[11]+t[7],18),t[1]^=R$1(t[0]+t[3],7),t[2]^=R$1(t[1]+t[0],9),t[3]^=R$1(t[2]+t[1],13),t[0]^=R$1(t[3]+t[2],18),t[6]^=R$1(t[5]+t[4],7),t[7]^=R$1(t[6]+t[5],9),t[4]^=R$1(t[7]+t[6],13),t[5]^=R$1(t[4]+t[7],18),t[11]^=R$1(t[10]+t[9],7),t[8]^=R$1(t[11]+t[10],9),t[9]^=R$1(t[8]+t[11],13),t[10]^=R$1(t[9]+t[8],18),t[12]^=R$1(t[15]+t[14],7),t[13]^=R$1(t[12]+t[15],9),t[14]^=R$1(t[13]+t[12],13),t[15]^=R$1(t[14]+t[13],18);for(let n=0;n<16;n++)e[n]=e[n]+t[n]>>>0}function blockMix(e,t){let n=2*t*16,r=new Uint32Array(16);for(let t=0;t<16;t++)r[t]=e[n-16+t];let i=new Uint32Array(n);for(let n=0;n<2*t;n++){for(let t=0;t<16;t++)r[t]^=e[n*16+t];salsa20_8(r);for(let e=0;e<16;e++)i[n*16+e]=r[e]}for(let n=0;n<t;n++)for(let t=0;t<16;t++)e[n*16+t]=i[2*n*16+t];for(let n=0;n<t;n++)for(let r=0;r<16;r++)e[(t+n)*16+r]=i[(2*n+1)*16+r]}function roMix(e,t,n){let r=2*n*16,i=Array.from({length:t});for(let r=0;r<t;r++)i[r]=new Uint32Array(e),blockMix(e,n);for(let o=0;o<t;o++){let o=e[r-16]&t-1;for(let t=0;t<r;t++)e[t]^=i[o][t];blockMix(e,n)}}function bytesToWords(e){let t=new Uint32Array(e.length/4);for(let n=0;n<t.length;n++)t[n]=e[n*4]|e[n*4+1]<<8|e[n*4+2]<<16|e[n*4+3]<<24;return t}function wordsToBytes(e){let t=new Uint8Array(e.length*4);for(let n=0;n<e.length;n++)t[n*4]=e[n]&255,t[n*4+1]=e[n]>>8&255,t[n*4+2]=e[n]>>16&255,t[n*4+3]=e[n]>>24&255;return t}function scryptCore(e,t,n,r,i,o){let s=128*r,c=pbkdf2Sync(e,t,1,i*s,`sha256`);for(let e=0;e<i;e++){let t=new Uint8Array(c.buffer,c.byteOffset+e*s,s),i=bytesToWords(t);roMix(i,n,r);let o=wordsToBytes(i);t.set(o)}return pbkdf2Sync(e,c,1,o,`sha256`)}function scryptSync(e,t,n,r){let i=R.from(e),o=R.from(t),s=r?.N??16384,c=r?.r??8,l=r?.p??1;if(s<=0||s&s-1)throw Error(`N must be a positive power of 2`);return scryptCore(i,o,s,c,l,n)}function scrypt(e,t,n,r,i){let o={},s;typeof r==`function`?s=r:(o=r,s=i);try{let r=scryptSync(e,t,n,o);setTimeout(()=>s(null,r),0)}catch(e){setTimeout(()=>s(e instanceof Error?e:Error(String(e)),R.alloc(0)),0)}}var ao=__esmMin(()=>{io(),Oe(),__name(R$1,`R`)});function rejectOkpKey(e){if(!(e.type!==`okp-public`&&e.type!==`okp-private`))throw e.curve===`ed25519`?codedError(`ERR_CRYPTO_UNSUPPORTED_OPERATION`,`Unsupported crypto operation`):codedError(`ERR_OSSL_EVP_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE`,`error:03000096:digital envelope routines::operation not supported for this keytype`)}function normalizeSignAlgorithm(e){let t=e.toLowerCase().replace(/-/g,``);if(t.startsWith(`rsa`)&&(t=t.slice(3)),!oo[t])throw Error(`Unsupported algorithm: ${e}. Supported: RSA-SHA1, RSA-SHA256, RSA-SHA512`);return t}function extractPem$1(e){if(typeof e==`string`)return e;if(R.isBuffer(e)||e instanceof Uint8Array)return R.from(e).toString(`utf8`);if(e&&typeof e==`object`&&`key`in e){let t=e.key;if(typeof t==`string`)return t;if(R.isBuffer(t)||t instanceof Uint8Array)return R.from(t).toString(`utf8`)}throw TypeError(`Invalid key argument`)}function createSign(e){return new Sign(e)}function createVerify(e){return new Verify(e)}function contextOf(e){if(typeof e!=`object`||!e||e instanceof na||R.isBuffer(e))return;let t=e.context;return t===void 0?void 0:new Uint8Array(t)}function toBytes(e,t){if(typeof e==`string`)return R.from(e,`utf8`);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw codedError(`ERR_INVALID_ARG_TYPE`,`The "${t}" argument must be an instance of Buffer, TypedArray, or DataView.`,TypeError)}function rsaPem(e){return e.export({format:`pem`,type:e.type===`private`?`pkcs1`:`spki`})}function rejectDigestForEdDSA(e){if(e!=null)throw codedError(`ERR_OSSL_INVALID_DIGEST`,`error:1C80007A:Provider routines::invalid digest`)}function oneShotSign(e,t,n){let r=toKeyObject(n,`private`),i=okpKeyMaterial(r);if(i)return i.curve!==`ed25519`&&rejectOkpKey({type:`okp-private`,curve:i.curve,priv:i.priv}),rejectDigestForEdDSA(e),R.from(ed25519Sign(i.priv,t,contextOf(n)));let o=new Sign(e??`sha256`);return o.update(R.from(t)),o.sign(rsaPem(r))}function oneShotVerify(e,t,n,r){let i=toKeyObject(n,`public`),o=okpKeyMaterial(i);if(o)return o.curve!==`ed25519`&&rejectOkpKey({type:`okp-public`,curve:o.curve,pub:o.pub}),rejectDigestForEdDSA(e),ed25519Verify(o.pub,t,r,contextOf(n));let s=new Verify(e??`sha256`);return s.update(R.from(t)),s.verify(rsaPem(i),r)}function sign(e,t,n,r){let i=toBytes(t,`data`);if(r===void 0)return oneShotSign(e,i,n);let o;try{o=oneShotSign(e,i,n)}catch(e){setTimeout(()=>r(e),0);return}setTimeout(()=>r(null,o),0)}function verify(e,t,n,r,i){let o=toBytes(t,`data`),s=toBytes(r,`signature`);if(i===void 0)return oneShotVerify(e,o,n,s);let c;try{c=oneShotVerify(e,o,n,s)}catch(e){setTimeout(()=>i(e),0);return}setTimeout(()=>i(null,c),0)}var oo,Sign,Verify,so=__esmMin(()=>{Sr(),oa(),Er(),ea(),ra(),eo(),Oe(),oo={sha1:new Uint8Array([48,33,48,9,6,5,43,14,3,2,26,5,0,4,20]),sha256:new Uint8Array([48,49,48,13,6,9,96,134,72,1,101,3,4,2,1,5,0,4,32]),sha512:new Uint8Array([48,81,48,13,6,9,96,134,72,1,101,3,4,2,3,5,0,4,64])},__name(extractPem$1,`extractPem`),Sign=class{_algorithm;_hash;_finalized=!1;constructor(e){this._algorithm=normalizeSignAlgorithm(e),this._hash=new $a(this._algorithm)}update(e,t){if(this._finalized)throw Error(`Sign was already finalized`);return this._hash.update(e,t),this}sign(e,t){if(this._finalized)throw Error(`Sign was already finalized`);this._finalized=!0;let n=this._hash.digest(),r=parsePemKey(extractPem$1(e));if(rejectOkpKey(r),r.type!==`rsa-private`)throw Error(`privateKey must be an RSA private key`);let{n:i,d:o}=r.components,s=rsaKeySize(i),c=oo[this._algorithm],l=new Uint8Array(c.length+n.length);l.set(c,0),l.set(n,c.length);let u=s-l.length-3;if(u<8)throw Error(`Key is too short for the specified hash algorithm`);let d=new Uint8Array(s);d[0]=0,d[1]=1;for(let e=2;e<2+u;e++)d[e]=255;d[2+u]=0,d.set(l,3+u);let f=bigIntToBytes(modPow(bytesToBigInt(d),o,i),s),p=R.from(f);return t?p.toString(t):p}},Verify=class{_algorithm;_hash;_finalized=!1;constructor(e){this._algorithm=normalizeSignAlgorithm(e),this._hash=new $a(this._algorithm)}update(e,t){if(this._finalized)throw Error(`Verify was already finalized`);return this._hash.update(e,t),this}verify(e,t,n){if(this._finalized)throw Error(`Verify was already finalized`);this._finalized=!0;let r=this._hash.digest(),i=parsePemKey(extractPem$1(e));rejectOkpKey(i);let o,s;if(i.type===`rsa-public`)o=i.components.n,s=i.components.e;else if(i.type===`rsa-private`)o=i.components.n,s=i.components.e;else throw Error(`publicKey must be an RSA public or private key`);let c=rsaKeySize(o),l;if(l=typeof t==`string`?R.from(t,n||`base64`):t instanceof Uint8Array?t:R.from(t),l.length!==c)return!1;let u=bytesToBigInt(l);if(u>=o)return!1;let d=bigIntToBytes(modPow(u,s,o),c);if(d[0]!==0||d[1]!==1)return!1;let f=2;for(;f<d.length&&d[f]===255;)f++;if(f>=d.length||d[f]!==0||f-2<8)return!1;f++;let p=d.slice(f),m=oo[this._algorithm],h=new Uint8Array(m.length+r.length);if(h.set(m,0),h.set(r,m.length),p.length!==h.length)return!1;let g=0;for(let e=0;e<p.length;e++)g|=p[e]^h[e];return g===0}}});function encode(e,t){return t===void 0?e:e.export(t)}function generateKeyPairSync(e,t){if(typeof e!=`string`)throw codedError(`ERR_INVALID_ARG_TYPE`,`The "type" argument must be of type string. Received ${typeof e}`,TypeError);if(e!==`ed25519`&&e!==`x25519`)throw co.includes(e)?codedError(`ERR_FEATURE_UNAVAILABLE_ON_PLATFORM`,`generateKeyPair('${e}') is not implemented on GJS yet (supported: 'ed25519', 'x25519')`):codedError(`ERR_INVALID_ARG_VALUE`,`The argument 'type' must be a supported key type. Received '${e}'`,TypeError);let{publicKey:n,privateKey:r}=okpKeyPair(e,generateOkpPrivateKey(e));return{publicKey:encode(n,t?.publicKeyEncoding),privateKey:encode(r,t?.privateKeyEncoding)}}function generateKeyPair(e,t,n){let r=typeof t==`function`?t:n,i=typeof t==`function`?void 0:t;if(typeof r!=`function`)throw codedError(`ERR_INVALID_ARG_TYPE`,`The "callback" argument must be of type function`,TypeError);let o=generateKeyPairSync(e,i);setTimeout(()=>r(null,o.publicKey,o.privateKey),0)}var co,lo=__esmMin(()=>{Er(),ea(),ra(),co=[`rsa`,`rsa-pss`,`dsa`,`ec`,`ed25519`,`ed448`,`x25519`,`x448`,`dh`],Object.defineProperty(generateKeyPair,Symbol.for(`nodejs.util.promisify.custom`),{value:(e,t)=>new Promise(n=>n(generateKeyPairSync(e,t)))})});function extractPem(e){if(typeof e==`string`)return e;if(R.isBuffer(e)||e instanceof Uint8Array)return R.from(e).toString(`utf8`);if(e&&typeof e==`object`&&`key`in e){let t=e.key;if(typeof t==`string`)return t;if(R.isBuffer(t)||t instanceof Uint8Array)return R.from(t).toString(`utf8`)}throw TypeError(`Invalid key argument`)}function pkcs1v15Type2Pad(e,t){let n=t-11;if(e.length>n)throw Error(`Data too long for key size. Max ${n} bytes, got ${e.length}`);let r=t-e.length-3,i=new Uint8Array(t);i[0]=0,i[1]=2;let o=randomBytes(r);for(let e=0;e<r;e++){for(;o[e]===0;)o[e]=randomBytes(1)[0];i[2+e]=o[e]}return i[2+r]=0,i.set(e,3+r),i}function pkcs1v15Type1Pad(e,t){let n=t-11;if(e.length>n)throw Error(`Data too long for key size. Max ${n} bytes, got ${e.length}`);let r=t-e.length-3,i=new Uint8Array(t);i[0]=0,i[1]=1;for(let e=2;e<2+r;e++)i[e]=255;return i[2+r]=0,i.set(e,3+r),i}function pkcs1v15Type2Unpad(e){if(e.length<11)throw Error(`Decryption error: message too short`);if(e[0]!==0||e[1]!==2)throw Error(`Decryption error: invalid padding`);let t=2;for(;t<e.length&&e[t]!==0;)t++;if(t>=e.length||t<10)throw Error(`Decryption error: invalid padding`);return e.slice(t+1)}function pkcs1v15Type1Unpad(e){if(e.length<11)throw Error(`Decryption error: message too short`);if(e[0]!==0||e[1]!==1)throw Error(`Decryption error: invalid padding`);let t=2;for(;t<e.length&&e[t]===255;)t++;if(t>=e.length||e[t]!==0||t<10)throw Error(`Decryption error: invalid padding`);return e.slice(t+1)}function publicEncrypt(e,t){let n=parsePemKey(extractPem(e)),r,i;if(n.type===`rsa-public`)r=n.components.n,i=n.components.e;else if(n.type===`rsa-private`)r=n.components.n,i=n.components.e;else throw Error(`Key must be an RSA public or private key`);let o=rsaKeySize(r),s=modPow(bytesToBigInt(pkcs1v15Type2Pad(t instanceof Uint8Array?t:R.from(t),o)),i,r);return R.from(bigIntToBytes(s,o))}function privateDecrypt(e,t){let n=parsePemKey(extractPem(e));if(n.type!==`rsa-private`)throw Error(`Key must be an RSA private key`);let{n:r,d:i}=n.components,o=rsaKeySize(r),s=t instanceof Uint8Array?t:R.from(t);if(s.length!==o)throw Error(`Data length (${s.length}) does not match key length (${o})`);let c=bytesToBigInt(s);if(c>=r)throw Error(`Decryption error: cipher value out of range`);let l=bigIntToBytes(modPow(c,i,r),o);return R.from(pkcs1v15Type2Unpad(l))}function privateEncrypt(e,t){let n=parsePemKey(extractPem(e));if(n.type!==`rsa-private`)throw Error(`Key must be an RSA private key`);let{n:r,d:i}=n.components,o=rsaKeySize(r),s=modPow(bytesToBigInt(pkcs1v15Type1Pad(t instanceof Uint8Array?t:R.from(t),o)),i,r);return R.from(bigIntToBytes(s,o))}function publicDecrypt(e,t){let n=parsePemKey(extractPem(e)),r,i;if(n.type===`rsa-public`)r=n.components.n,i=n.components.e;else if(n.type===`rsa-private`)r=n.components.n,i=n.components.e;else throw Error(`Key must be an RSA public or private key`);let o=rsaKeySize(r),s=t instanceof Uint8Array?t:R.from(t);if(s.length!==o)throw Error(`Data length (${s.length}) does not match key length (${o})`);let c=bytesToBigInt(s);if(c>=r)throw Error(`Decryption error: cipher value out of range`);let l=bigIntToBytes(modPow(c,i,r),o);return R.from(pkcs1v15Type1Unpad(l))}var uo=__esmMin(()=>{Sr(),oa(),aa(),Oe()});function mgf1(e,t,n){let r=new Uint8Array(n),i=0,o=0;for(;i<n;){let s=new Uint8Array(4);s[0]=o>>>24&255,s[1]=o>>>16&255,s[2]=o>>>8&255,s[3]=o&255;let c=new $a(e);c.update(t),c.update(s);let l=new Uint8Array(c.digest()),u=Math.min(l.length,n-i);r.set(l.slice(0,u),i),i+=u,o++}return r}var fo=__esmMin(()=>{eo()});function hashDigest$1(e,t){let n=new $a(e);return n.update(t),new Uint8Array(n.digest())}function emsaPssEncode(e,t,n,r){let i=hashSize(n),o=Math.ceil(t/8);if(o<i+r+2)throw Error(`RSA-PSS: encoding error — key too short`);let s=r>0?new Uint8Array(randomBytes(r)):new Uint8Array,c=new Uint8Array(8+i+r);c.set(e,8),c.set(s,8+i);let l=hashDigest$1(n,c),u=o-i-1,d=new Uint8Array(u);d[u-r-1]=1,d.set(s,u-r);let f=mgf1(n,l,u),p=new Uint8Array(u);for(let e=0;e<u;e++)p[e]=d[e]^f[e];let m=8*o-t;m>0&&(p[0]&=255>>>m);let h=new Uint8Array(o);return h.set(p,0),h.set(l,u),h[o-1]=188,h}function emsaPssVerify(e,t,n,r,i){let o=hashSize(r),s=Math.ceil(n/8);if(s<o+i+2||t[s-1]!==188)return!1;let c=s-o-1,l=t.slice(0,c),u=t.slice(c,c+o),d=8*s-n;if(d>0&&l[0]&255<<8-d)return!1;let f=mgf1(r,u,c),p=new Uint8Array(c);for(let e=0;e<c;e++)p[e]=l[e]^f[e];d>0&&(p[0]&=255>>>d);for(let e=0;e<c-i-1;e++)if(p[e]!==0)return!1;if(p[c-i-1]!==1)return!1;let m=p.slice(c-i),h=new Uint8Array(8+o+i);h.set(e,8),h.set(m,8+o);let g=hashDigest$1(r,h);if(u.length!==g.length)return!1;let _=0;for(let e=0;e<u.length;e++)_|=u[e]^g[e];return _===0}function rsaPssSign(e,t,n,r){let i=parsePemKey(t);if(i.type!==`rsa-private`)throw Error(`RSA-PSS: expected RSA private key`);let{n:o,d:s}=i.components,c=rsaKeySize(o),l=Math.ceil(c/8);return bigIntToBytes(modPow(bytesToBigInt(emsaPssEncode(hashDigest$1(e,n),c-1,e,r)),s,o),l)}function rsaPssVerify(e,t,n,r,i){let o=parsePemKey(t),s,c;if(o.type===`rsa-public`)({n:s,e:c}=o.components);else if(o.type===`rsa-private`)({n:s,e:c}=o.components);else throw Error(`RSA-PSS: expected RSA key`);let l=rsaKeySize(s),u=Math.ceil(l/8);if(n.length!==u)return!1;let d=bigIntToBytes(modPow(bytesToBigInt(n),c,s),Math.ceil((l-1)/8));return emsaPssVerify(hashDigest$1(e,r),d,l-1,e,i)}var po=__esmMin(()=>{Sr(),oa(),Er(),aa(),eo(),fo(),__name(hashDigest$1,`hashDigest`)});function hashDigest(e,t){let n=new $a(e);return n.update(t),new Uint8Array(n.digest())}function rsaOaepEncrypt(e,t,n,r){let i=parsePemKey(t),o,s;if(i.type===`rsa-public`)({n:o,e:s}=i.components);else if(i.type===`rsa-private`)({n:o,e:s}=i.components);else throw Error(`RSA-OAEP: expected RSA key`);let c=Math.ceil(rsaKeySize(o)/8),l=hashSize(e);if(n.length>c-2*l-2)throw Error(`RSA-OAEP: message too long`);let u=hashDigest(e,r||new Uint8Array),d=c-l-1,f=new Uint8Array(d);f.set(u,0),f[d-n.length-1]=1,f.set(n,d-n.length);let p=new Uint8Array(randomBytes(l)),m=mgf1(e,p,d),h=new Uint8Array(d);for(let e=0;e<d;e++)h[e]=f[e]^m[e];let g=mgf1(e,h,l),_=new Uint8Array(l);for(let e=0;e<l;e++)_[e]=p[e]^g[e];let v=new Uint8Array(c);return v[0]=0,v.set(_,1),v.set(h,1+l),bigIntToBytes(modPow(bytesToBigInt(v),s,o),c)}function rsaOaepDecrypt(e,t,n,r){let i=parsePemKey(t);if(i.type!==`rsa-private`)throw Error(`RSA-OAEP: expected RSA private key`);let{n:o,d:s}=i.components,c=Math.ceil(rsaKeySize(o)/8),l=hashSize(e);if(n.length!==c||c<2*l+2)throw Error(`RSA-OAEP: decryption error`);let u=bigIntToBytes(modPow(bytesToBigInt(n),s,o),c),d=u[0],f=u.slice(1,1+l),p=u.slice(1+l),m=c-l-1,h=mgf1(e,p,l),g=new Uint8Array(l);for(let e=0;e<l;e++)g[e]=f[e]^h[e];let _=mgf1(e,g,m),v=new Uint8Array(m);for(let e=0;e<m;e++)v[e]=p[e]^_[e];let y=hashDigest(e,r||new Uint8Array),b=v.slice(0,l),x=+(d===0);for(let e=0;e<l;e++)x&=+(y[e]===b[e]);let S=-1;for(let e=l;e<m;e++)if(v[e]===1){S=e;break}else if(v[e]!==0){x=0;break}if(S===-1&&(x=0),!x)throw Error(`RSA-OAEP: decryption error`);return v.slice(S+1)}var mo=__esmMin(()=>{Sr(),oa(),Er(),aa(),eo(),fo()});function formatFingerprint(e){let t=e.toString(`hex`).toUpperCase(),n=[];for(let e=0;e<t.length;e+=2)n.push(t.substring(e,e+2));return n.join(`:`)}function matchHostname(e,t){let n=e.toLowerCase(),r=t.toLowerCase();if(n===r)return!0;if(n.startsWith(`*.`)){let e=n.substring(2),t=r.split(`.`);if(t.length>=2)return t.slice(1).join(`.`)===e}return!1}function parseDNToObject(e){let t={},n=e.split(`, `);for(let e of n){let n=e.indexOf(`=`);n>0&&(t[e.substring(0,n)]=e.substring(n+1))}return t}var X509Certificate,ho=__esmMin(()=>{Sr(),ra(),vo(),Oe(),X509Certificate=class{_components;_pem;constructor(e){if(typeof e==`string`)this._pem=e,this._components=parseX509(e);else{let t=R.isBuffer(e)?e:R.from(e),n=t.toString(`utf8`);n.includes(`-----BEGIN CERTIFICATE-----`)?(this._pem=n,this._components=parseX509(n)):(this._components=parseX509Der(new Uint8Array(t.buffer,t.byteOffset,t.byteLength)),this._pem=derToPem(this._components.raw,`CERTIFICATE`))}}get raw(){return R.from(this._components.raw)}get serialNumber(){return this._components.serialNumber.toString(16).toUpperCase()}get subject(){return this._components.subject}get issuer(){return this._components.issuer}get validFrom(){return this._components.validFrom.toUTCString()}get validTo(){return this._components.validTo.toUTCString()}get fingerprint(){return formatFingerprint(createHash(`sha1`).update(this._components.raw).digest())}get fingerprint256(){return formatFingerprint(createHash(`sha256`).update(this._components.raw).digest())}get fingerprint512(){return formatFingerprint(createHash(`sha512`).update(this._components.raw).digest())}get publicKey(){if(!this._components.publicKey)throw Error(`Certificate does not contain a supported public key type`);let e=derToPem(encodeSubjectPublicKeyInfo(this._components.publicKey),`PUBLIC KEY`);return new na(`public`,{parsed:{type:`rsa-public`,components:this._components.publicKey},pem:e})}get subjectAltName(){if(!(!this._components.subjectAltName||this._components.subjectAltName.length===0))return this._components.subjectAltName.join(`, `)}get keyUsage(){}get infoAccess(){}get ca(){return!1}checkHost(e){let t=this._components.subject.match(/CN=([^,]+)/);if(t){let n=t[1].trim();if(matchHostname(n,e))return n}if(this._components.subjectAltName){for(let t of this._components.subjectAltName)if(t.startsWith(`DNS:`)){let n=t.substring(4);if(matchHostname(n,e))return n}}}checkEmail(e){let t=e.toLowerCase(),n=this._components.subject.match(/emailAddress=([^,]+)/);if(n&&n[1].toLowerCase()===t)return n[1]}checkIP(e){if(this._components.subjectAltName){for(let t of this._components.subjectAltName)if(t.startsWith(`IP Address:`)&&t.substring(11)===e)return e}}verify(e){return!0}checkIssued(e){return this.issuer===e.subject}toLegacyObject(){return{subject:parseDNToObject(this._components.subject),issuer:parseDNToObject(this._components.issuer),valid_from:this.validFrom,valid_to:this.validTo,serialNumber:this.serialNumber,fingerprint:this.fingerprint,fingerprint256:this.fingerprint256}}toString(){return this._pem}toJSON(){return this._pem}get[Symbol.toStringTag](){return`X509Certificate`}}}),go=__exportAll$3({DiffieHellman:()=>DiffieHellman,DiffieHellmanGroup:()=>fa,Hash:()=>$a,Hmac:()=>Hmac,KeyObject:()=>na,Sign:()=>Sign,Verify:()=>Verify,X509Certificate:()=>X509Certificate,constants:()=>cr,createCipher:()=>createCipher,createCipheriv:()=>createCipheriv,createDecipher:()=>createDecipher,createDecipheriv:()=>createDecipheriv,createDiffieHellman:()=>createDiffieHellman,createDiffieHellmanGroup:()=>da,createECDH:()=>createECDH,createHash:()=>createHash,createHmac:()=>createHmac,createPrivateKey:()=>createPrivateKey,createPublicKey:()=>createPublicKey,createSecretKey:()=>createSecretKey,createSign:()=>createSign,createVerify:()=>createVerify,default:()=>_o,diffieHellman:()=>diffieHellman,ecdsaSign:()=>ecdsaSign,ecdsaVerify:()=>ecdsaVerify,generateKeyPair:()=>generateKeyPair,generateKeyPairSync:()=>generateKeyPairSync,getCiphers:()=>getCiphers,getCurves:()=>getCurves,getDiffieHellman:()=>getDiffieHellman,getHashes:()=>getHashes,hash:()=>hash,hkdf:()=>hkdf,hkdfSync:()=>hkdfSync,mgf1:()=>mgf1,pbkdf2:()=>pbkdf2,pbkdf2Sync:()=>pbkdf2Sync,privateDecrypt:()=>privateDecrypt,privateEncrypt:()=>privateEncrypt,publicDecrypt:()=>publicDecrypt,publicEncrypt:()=>publicEncrypt,randomBytes:()=>randomBytes,randomFill:()=>randomFill,randomFillSync:()=>randomFillSync,randomInt:()=>randomInt,randomUUID:()=>randomUUID,rsaOaepDecrypt:()=>rsaOaepDecrypt,rsaOaepEncrypt:()=>rsaOaepEncrypt,rsaPssSign:()=>rsaPssSign,rsaPssVerify:()=>rsaPssVerify,scrypt:()=>scrypt,scryptSync:()=>scryptSync,sign:()=>sign,timingSafeEqual:()=>timingSafeEqual,verify:()=>verify});function createHash(e){return new $a(e)}function createHmac(e,t){return new Hmac(e,t)}var _o,vo=__esmMin(()=>{lr(),ur(),gr(),ra(),ia(),aa(),pa(),ga(),eo(),to(),no(),ro(),io(),ao(),so(),lo(),uo(),fo(),po(),mo(),ho(),_o={Hash:$a,getHashes,hash,Hmac,randomBytes,randomFill,randomFillSync,randomUUID,randomInt,timingSafeEqual,constants:cr,pbkdf2,pbkdf2Sync,hkdf,hkdfSync,scrypt,scryptSync,createHash,createHmac,createCipher,createCipheriv,createDecipher,createDecipheriv,getCiphers,Sign,Verify,createSign,createVerify,sign,verify,generateKeyPair,generateKeyPairSync,diffieHellman,createDiffieHellman,getDiffieHellman,DiffieHellman,DiffieHellmanGroup:fa,createDiffieHellmanGroup:da,createECDH,getCurves,ecdsaSign,ecdsaVerify,publicEncrypt,privateDecrypt,privateEncrypt,publicDecrypt,rsaPssSign,rsaPssVerify,rsaOaepEncrypt,rsaOaepDecrypt,mgf1,KeyObject:na,createSecretKey,createPublicKey,createPrivateKey,X509Certificate}});let yo=!1,bo,xo,So,Co,wo,To,Eo,Do,Oo,ko,Ao,jo,Mo,No,Po,Fo,Io;async function loadCrypto(){if(yo)return;let e=await Promise.resolve().then(()=>(vo(),go));bo=e.createHash,xo=e.createHmac,So=e.createCipheriv,Co=e.createDecipheriv,wo=e.createSign,To=e.createVerify,Eo=e.pbkdf2Sync,Do=e.hkdfSync,Oo=e.createECDH,ko=e.randomBytes,e.publicEncrypt,e.privateDecrypt,e.createPublicKey,e.createPrivateKey,Ao=e.ecdsaSign,jo=e.ecdsaVerify,Mo=e.rsaPssSign,No=e.rsaPssVerify,Po=e.rsaOaepEncrypt,Fo=e.rsaOaepDecrypt,Io={generateKeyPairSync:e.generateKeyPairSync,sign:e.sign,verify:e.verify,diffieHellman:e.diffieHellman,createPrivateKey:e.createPrivateKey,createPublicKey:e.createPublicKey},yo=!0}const Lo=loadCrypto();var SubtleCrypto=class{async digest(e,t){await Lo;let n=toNodeHashName(normalizeAlgorithm$1(e).name),r=toUint8Array(t),i=bo(n);i.update(r);let o=i.digest();return o.buffer.slice(o.byteOffset,o.byteOffset+o.byteLength)}async generateKey(e,t,n){await Lo;let r=normalizeAlgorithm$1(e),i=r.name.toUpperCase(),o=cfrgName(r.name);if(o)return cfrgGenerateKey(Io,o,t,n);switch(i){case`AES-CBC`:case`AES-CTR`:case`AES-GCM`:{let i=e.length;if(![128,192,256].includes(i))throw new DOMException(`Invalid AES key length: ${i}`,`OperationError`);validateUsages(n,[`encrypt`,`decrypt`,`wrapKey`,`unwrapKey`]);let o=ko(i/8);return new CryptoKey(`secret`,t,{name:r.name,length:i},n,new Uint8Array(o))}case`AES-KW`:{let r=e.length;if(![128,192,256].includes(r))throw new DOMException(`Invalid AES key length: ${r}`,`OperationError`);validateUsages(n,[`wrapKey`,`unwrapKey`]);let i=ko(r/8);return new CryptoKey(`secret`,t,{name:`AES-KW`,length:r},n,new Uint8Array(i))}case`HMAC`:{let r=e,i=normalizeAlgorithm$1(r.hash),o=r.length||hashSize$1(i.name)*8;validateUsages(n,[`sign`,`verify`]);let s=ko(Math.ceil(o/8));return new CryptoKey(`secret`,t,{name:`HMAC`,hash:{name:i.name},length:o},n,new Uint8Array(s))}case`ECDH`:{let r=e.namedCurve,i=toNodeCurveName(r);validateUsages(n,[`deriveKey`,`deriveBits`]);let o=Oo(i);o.generateKeys();let s=new Uint8Array(o.getPublicKey()),c=new Uint8Array(o.getPrivateKey());return{publicKey:new CryptoKey(`public`,!0,{name:`ECDH`,namedCurve:r},[],s),privateKey:new CryptoKey(`private`,t,{name:`ECDH`,namedCurve:r},n,{pub:s,priv:c})}}case`ECDSA`:{let r=e.namedCurve,i=toNodeCurveName(r);validateUsages(n,[`sign`,`verify`]);let o=Oo(i);o.generateKeys();let s=new Uint8Array(o.getPublicKey()),c=new Uint8Array(o.getPrivateKey());return{publicKey:new CryptoKey(`public`,!0,{name:`ECDSA`,namedCurve:r},[`verify`],s),privateKey:new CryptoKey(`private`,t,{name:`ECDSA`,namedCurve:r},[`sign`],{pub:s,priv:c})}}default:throw new DOMException(`Unsupported algorithm: ${r.name}`,`NotSupportedError`)}}async importKey(e,t,n,r,i){await Lo;let o=normalizeAlgorithm$1(n),s=o.name.toUpperCase(),c=cfrgName(o.name);if(c)return cfrgImportKey(Io,e,t,c,r,i);switch(s){case`AES-CBC`:case`AES-CTR`:case`AES-GCM`:if(e===`raw`){let e=toUint8Array(t);if(![16,24,32].includes(e.length))throw new DOMException(`Invalid AES key length: ${e.length*8}`,`DataError`);return validateUsages(i,[`encrypt`,`decrypt`,`wrapKey`,`unwrapKey`]),new CryptoKey(`secret`,r,{name:o.name,length:e.length*8},i,new Uint8Array(e))}if(e===`jwk`){let e=t;if(e.kty!==`oct`)throw new DOMException(`JWK kty must be "oct"`,`DataError`);let n=base64urlDecode(e.k);if(![16,24,32].includes(n.length))throw new DOMException(`Invalid AES key length: ${n.length*8}`,`DataError`);return validateUsages(i,[`encrypt`,`decrypt`,`wrapKey`,`unwrapKey`]),new CryptoKey(`secret`,r,{name:o.name,length:n.length*8},i,n)}throw new DOMException(`Unsupported format: ${e}`,`NotSupportedError`);case`AES-KW`:{let n;if(e===`raw`)n=toUint8Array(t);else if(e===`jwk`){let e=t;if(e.kty!==`oct`)throw new DOMException(`JWK kty must be "oct"`,`DataError`);n=base64urlDecode(e.k)}else throw new DOMException(`Unsupported format: ${e}`,`NotSupportedError`);if(![16,24,32].includes(n.length))throw new DOMException(`Invalid AES key length: ${n.length*8}`,`DataError`);return validateUsages(i,[`wrapKey`,`unwrapKey`]),new CryptoKey(`secret`,r,{name:`AES-KW`,length:n.length*8},i,new Uint8Array(n))}case`HMAC`:{let o=normalizeAlgorithm$1(n.hash);if(e===`raw`){let e=toUint8Array(t);return validateUsages(i,[`sign`,`verify`]),new CryptoKey(`secret`,r,{name:`HMAC`,hash:{name:o.name},length:e.length*8},i,new Uint8Array(e))}if(e===`jwk`){let e=t;if(e.kty!==`oct`)throw new DOMException(`JWK kty must be "oct"`,`DataError`);let n=base64urlDecode(e.k);return validateUsages(i,[`sign`,`verify`]),new CryptoKey(`secret`,r,{name:`HMAC`,hash:{name:o.name},length:n.length*8},i,n)}throw new DOMException(`Unsupported format: ${e}`,`NotSupportedError`)}case`PBKDF2`:if(e===`raw`){let e=toUint8Array(t);return validateUsages(i,[`deriveKey`,`deriveBits`]),new CryptoKey(`secret`,!1,{name:`PBKDF2`},i,new Uint8Array(e))}throw new DOMException(`Unsupported format: ${e}`,`NotSupportedError`);case`HKDF`:if(e===`raw`){let e=toUint8Array(t);return validateUsages(i,[`deriveKey`,`deriveBits`]),new CryptoKey(`secret`,!1,{name:`HKDF`},i,new Uint8Array(e))}throw new DOMException(`Unsupported format: ${e}`,`NotSupportedError`);case`ECDH`:case`ECDSA`:{let c=n.namedCurve;if(e===`raw`){let e=toUint8Array(t);return s===`ECDH`?i.length>0&&validateUsages(i,[`deriveKey`,`deriveBits`]):validateUsages(i,[`verify`]),new CryptoKey(`public`,r,{name:o.name,namedCurve:c},i,new Uint8Array(e))}if(e===`jwk`){let e=t;if(e.kty!==`EC`)throw new DOMException(`JWK kty must be "EC"`,`DataError`);if(e.d){let t=base64urlDecode(e.d),n=base64urlDecode(e.x),l=base64urlDecode(e.y),u=new Uint8Array(1+n.length+l.length);return u[0]=4,u.set(n,1),u.set(l,1+n.length),validateUsages(i,s===`ECDH`?[`deriveKey`,`deriveBits`]:[`sign`]),new CryptoKey(`private`,r,{name:o.name,namedCurve:c},i,{pub:u,priv:t})}else{let t=base64urlDecode(e.x),n=base64urlDecode(e.y),l=new Uint8Array(1+t.length+n.length);return l[0]=4,l.set(t,1),l.set(n,1+t.length),s===`ECDH`?i.length>0&&validateUsages(i,[`deriveKey`,`deriveBits`]):validateUsages(i,[`verify`]),new CryptoKey(`public`,r,{name:o.name,namedCurve:c},i,l)}}throw new DOMException(`Unsupported format: ${e}`,`NotSupportedError`)}default:throw new DOMException(`Unsupported algorithm: ${o.name}`,`NotSupportedError`)}}async exportKey(e,t){if(!t.extractable)throw new DOMException(`Key is not extractable`,`InvalidAccessError`);if(cfrgName(t.algorithm.name))return cfrgExportKey(e,t);let n=t.algorithm.name.toUpperCase();if(e===`raw`){if(t.type===`secret`){let e=t._handle;return e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength)}if(t.type===`public`&&(n===`ECDH`||n===`ECDSA`)){let e=t._handle;return e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength)}throw new DOMException(`Cannot export in raw format`,`InvalidAccessError`)}if(e===`jwk`){if(t.type===`secret`){let e=t._handle,r={kty:`oct`,k:base64urlEncode(e),ext:t.extractable,key_ops:[...t.usages]};return n.startsWith(`AES-`)?r.alg=`A${t.algorithm.length}${n.replace(`AES-`,``)}`:n===`HMAC`&&(r.alg=`HS${t.algorithm.hash.name.replace(`SHA-`,``)}`),r}if((n===`ECDH`||n===`ECDSA`)&&(t.type===`public`||t.type===`private`)){let e=t.algorithm.namedCurve,n;n=t.type===`public`?t._handle:t._handle.pub;let r=(n.length-1)/2,i=n.slice(1,1+r),o=n.slice(1+r),s={kty:`EC`,crv:e,x:base64urlEncode(i),y:base64urlEncode(o),ext:t.extractable,key_ops:[...t.usages]};return t.type===`private`&&(s.d=base64urlEncode(t._handle.priv)),s}throw new DOMException(`JWK export not supported for ${n} ${t.type}`,`NotSupportedError`)}throw new DOMException(`Unsupported export format: ${e}`,`NotSupportedError`)}async encrypt(e,t,n){return await Lo,checkUsage(t,`encrypt`),this._encryptImpl(e,t,n)}async _encryptImpl(e,t,n){let r=normalizeAlgorithm$1(e),i=r.name.toUpperCase(),o=toUint8Array(n);switch(i){case`AES-CBC`:{let n=toUint8Array(e.iv),r=t._handle,i=r.length*8,s=So(`aes-${i}-cbc`,r,n),c=s.update(o),l=s.final(),u=new Uint8Array(c.length+l.length);return u.set(new Uint8Array(c),0),u.set(new Uint8Array(l),c.length),u.buffer}case`AES-CTR`:{let n=toUint8Array(e.counter),r=t._handle,i=r.length*8,s=So(`aes-${i}-ctr`,r,n),c=s.update(o),l=s.final(),u=new Uint8Array(c.length+l.length);return u.set(new Uint8Array(c),0),u.set(new Uint8Array(l),c.length),u.buffer}case`AES-GCM`:{let n=e,r=toUint8Array(n.iv),i=n.additionalData?toUint8Array(n.additionalData):void 0,s=t._handle,c=s.length*8,l=So(`aes-${c}-gcm`,s,r);i&&l.setAAD(i);let u=l.update(o),d=l.final(),f=l.getAuthTag(),p=new Uint8Array(u.length+d.length+f.length);return p.set(new Uint8Array(u),0),p.set(new Uint8Array(d),u.length),p.set(new Uint8Array(f),u.length+d.length),p.buffer}case`RSA-OAEP`:{let n=t.algorithm.hash.name,r=toNodeHashName(n),i=t._handle,s=e,c=s.label?toUint8Array(s.label):void 0,l=Po(r,i.pem,o,c);return l.buffer.slice(l.byteOffset,l.byteOffset+l.byteLength)}case`AES-KW`:{let e=t._handle;return aesKeyWrap(o,t=>this._aesEcbBlock(e,t,!0)).buffer}default:throw new DOMException(`Unsupported algorithm: ${r.name}`,`NotSupportedError`)}}async decrypt(e,t,n){return await Lo,checkUsage(t,`decrypt`),this._decryptImpl(e,t,n)}async _decryptImpl(e,t,n){let r=normalizeAlgorithm$1(e),i=r.name.toUpperCase(),o=toUint8Array(n);switch(i){case`AES-CBC`:{let n=toUint8Array(e.iv),r=t._handle,i=r.length*8,s=Co(`aes-${i}-cbc`,r,n),c=s.update(o),l=s.final(),u=new Uint8Array(c.length+l.length);return u.set(new Uint8Array(c),0),u.set(new Uint8Array(l),c.length),u.buffer}case`AES-CTR`:{let n=toUint8Array(e.counter),r=t._handle,i=r.length*8,s=Co(`aes-${i}-ctr`,r,n),c=s.update(o),l=s.final(),u=new Uint8Array(c.length+l.length);return u.set(new Uint8Array(c),0),u.set(new Uint8Array(l),c.length),u.buffer}case`AES-GCM`:{let n=e,r=toUint8Array(n.iv),i=(n.tagLength||128)/8,s=n.additionalData?toUint8Array(n.additionalData):void 0,c=t._handle,l=c.length*8,u=o.slice(0,o.length-i),d=o.slice(o.length-i),f=Co(`aes-${l}-gcm`,c,r);f.setAuthTag(d),s&&f.setAAD(s);let p=f.update(u),m=f.final(),h=new Uint8Array(p.length+m.length);return h.set(new Uint8Array(p),0),h.set(new Uint8Array(m),p.length),h.buffer}case`RSA-OAEP`:{let n=t.algorithm.hash.name,r=toNodeHashName(n),i=t._handle,s=e,c=s.label?toUint8Array(s.label):void 0,l=Fo(r,i.pem,o,c);return l.buffer.slice(l.byteOffset,l.byteOffset+l.byteLength)}case`AES-KW`:{let e=t._handle;return aesKeyUnwrap(o,t=>this._aesEcbBlock(e,t,!1)).buffer}default:throw new DOMException(`Unsupported algorithm: ${r.name}`,`NotSupportedError`)}}_aesEcbBlock(e,t,n){let r=`aes-${e.length*8}-ecb`,i=new Uint8Array,o=n?So(r,e,i):Co(r,e,i);o.setAutoPadding?.(!1);let s=o.update(t),c=o.final();if(c.length===0)return s;let l=new Uint8Array(s.length+c.length);return l.set(s,0),l.set(c,s.length),l}async sign(e,t,n){await Lo;let r=normalizeAlgorithm$1(e);checkAlgorithmMatch(t,r.name),checkUsage(t,`sign`);let i=r.name.toUpperCase(),o=toUint8Array(n);switch(i){case`HMAC`:{let e=t.algorithm.hash.name,n=toNodeHashName(e),r=t._handle,i=xo(n,r);i.update(o);let s=i.digest();return s.buffer.slice(s.byteOffset,s.byteOffset+s.byteLength)}case`RSASSA-PKCS1-V1_5`:{let e=t.algorithm.hash.name,n=toNodeHashName(e),r=t._handle,i=wo(n);i.update(o);let s=i.sign(r.pem);return s.buffer.slice(s.byteOffset,s.byteOffset+s.byteLength)}case`ECDSA`:{let n=e,r=toNodeHashName(typeof n.hash==`string`?n.hash:n.hash.name),i=t.algorithm.namedCurve,s=t._handle,c=Ao(r,s.priv,o,i);return c.buffer.slice(c.byteOffset,c.byteOffset+c.byteLength)}case`RSA-PSS`:{let n=t.algorithm.hash.name,r=toNodeHashName(n),i=t._handle,s=e.saltLength??hashSize$1(n),c=Mo(r,i.pem,o,s);return c.buffer.slice(c.byteOffset,c.byteOffset+c.byteLength)}case`ED25519`:return ed25519Sign$1(Io,t,o);default:throw new DOMException(`Unsupported algorithm: ${r.name}`,`NotSupportedError`)}}async verify(e,t,n,r){await Lo;let i=normalizeAlgorithm$1(e);checkAlgorithmMatch(t,i.name),checkUsage(t,`verify`);let o=i.name.toUpperCase(),s=toUint8Array(r),c=toUint8Array(n);switch(o){case`HMAC`:{let e=t.algorithm.hash.name,n=toNodeHashName(e),r=t._handle,i=xo(n,r);i.update(s);let o=new Uint8Array(i.digest());if(o.length!==c.length)return!1;let l=0;for(let e=0;e<o.length;e++)l|=o[e]^c[e];return l===0}case`RSASSA-PKCS1-V1_5`:{let e=t.algorithm.hash.name,n=toNodeHashName(e),r=t._handle,i=To(n);return i.update(s),i.verify(r.pem,c)}case`ECDSA`:{let n=e,r=toNodeHashName(typeof n.hash==`string`?n.hash:n.hash.name),i=t.algorithm.namedCurve,o=t._handle;return jo(r,o,c,s,i)}case`RSA-PSS`:{let n=t.algorithm.hash.name,r=toNodeHashName(n),i=t._handle,o=e.saltLength??hashSize$1(n);return No(r,i.pem,c,s,o)}case`ED25519`:return ed25519Verify$1(Io,t,c,s);default:throw new DOMException(`Unsupported algorithm: ${i.name}`,`NotSupportedError`)}}async _deriveBitsInternal(e,t,n){await Lo;let r=normalizeAlgorithm$1(e);switch(checkAlgorithmMatch(t,r.name),r.name.toUpperCase()){case`PBKDF2`:{let r=e,i=toNodeHashName(normalizeAlgorithm$1(r.hash).name),o=toUint8Array(r.salt),s=r.iterations,c=t._handle,l=Eo(c,o,s,n/8,i);return l.buffer.slice(l.byteOffset,l.byteOffset+l.byteLength)}case`HKDF`:{let r=e,i=toNodeHashName(normalizeAlgorithm$1(r.hash).name),o=toUint8Array(r.salt),s=toUint8Array(r.info),c=t._handle;return Do(i,c,o,s,n/8)}case`ECDH`:{let r=e.public,i=t.algorithm.namedCurve,o=toNodeCurveName(i),s=Oo(o),c=t._handle;s.setPrivateKey(c.priv);let l=r._handle instanceof Uint8Array?r._handle:r._handle.pub,u=s.computeSecret(l),d=new Uint8Array(u);return n?d.buffer.slice(0,n/8):d.buffer.slice(d.byteOffset,d.byteOffset+d.byteLength)}case`X25519`:return x25519DeriveBits(Io,t,e.public,n);default:throw new DOMException(`Unsupported algorithm: ${r.name}`,`NotSupportedError`)}}async deriveBits(e,t,n=null){return checkUsage(t,`deriveBits`),this._deriveBitsInternal(e,t,n)}async deriveKey(e,t,n,r,i){checkUsage(t,`deriveKey`);let o=normalizeAlgorithm$1(n),s,c=o.name.toUpperCase();if(c===`AES-CBC`||c===`AES-CTR`||c===`AES-GCM`)s=n.length;else if(c===`HMAC`){let e=n,t=normalizeAlgorithm$1(e.hash);s=e.length||hashSize$1(t.name)*8}else throw new DOMException(`Unsupported derived key algorithm: ${o.name}`,`NotSupportedError`);let l=await this._deriveBitsInternal(e,t,s);return this.importKey(`raw`,l,n,r,i)}async wrapKey(e,t,n,r){await Lo,checkUsage(n,`wrapKey`);let i=await this.exportKey(e,t),o=e===`jwk`?new TextEncoder().encode(JSON.stringify(i)):i;return this._encryptImpl(r,n,o)}async unwrapKey(e,t,n,r,i,o,s){await Lo,checkUsage(n,`unwrapKey`);let c=await this._decryptImpl(r,n,t),l=e===`jwk`?JSON.parse(new TextDecoder().decode(new Uint8Array(c))):c;return this.importKey(e,l,i,o,s)}};Zi();const Ro=globalThis.crypto===void 0?null:globalThis.crypto;var CryptoPolyfill=class{subtle=new SubtleCrypto;getRandomValues(e){if(!(e instanceof Int8Array||e instanceof Uint8Array||e instanceof Int16Array||e instanceof Uint16Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Uint8ClampedArray||e instanceof BigInt64Array||e instanceof BigUint64Array))throw new DOMException(`The provided value is not of type '(Int8Array or Int16Array or Int32Array or Uint8Array or Uint8ClampedArray or Uint16Array or Uint32Array or BigInt64Array or BigUint64Array)'`,`TypeMismatchError`);if(e.byteLength>65536)throw new DOMException(`The ArrayBufferView's byte length exceeds the number of bytes of entropy available via this API (65536)`,`QuotaExceededError`);return fillRandomBytes(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),{webcrypto:Ro?.getRandomValues?Ro:null}),e}randomUUID(){if(Ro&&typeof Ro.randomUUID==`function`)return Ro.randomUUID();let e=new Uint8Array(16);this.getRandomValues(e),e[6]=e[6]&15|64,e[8]=e[8]&63|128;let t=Array.from(e,e=>e.toString(16).padStart(2,`0`)).join(``);return`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16,20)}-${t.slice(20)}`}};const zo=Ro!==null&&Ro.subtle!==void 0&&typeof Ro.subtle.digest==`function`,Bo=zo?Ro:new CryptoPolyfill;zo?Ro.subtle:new SubtleCrypto;const Vo=globalThis;(globalThis.crypto===void 0||globalThis.crypto.subtle===void 0)&&(Vo.crypto=Bo);var Ho,Uo=__esmMin(()=>{Ho=t}),J,Wo=__esmMin(()=>{Uo(),J=Ho});function findPnpManifest(e){let t=J.File.new_for_path(e);for(;t.has_parent(null);){let e=t.resolve_relative_path(`.pnp.cjs`);if(e.query_exists(null))return e.get_path();t=t.get_parent()}return null}function loadPnpManifest(e){let t=Go.get(e);if(t!==void 0)return t;let n=J.File.new_for_path(e),r;try{let[t,i]=n.load_contents(null);if(!t)return Go.set(e,null),null;r=new TextDecoder().decode(i)}catch{return Go.set(e,null),null}let i=extractRawRuntimeState(r);if(!i)return Go.set(e,null),null;let o=z.path_get_dirname(e),s=new Map,c=new Map;for(let[e,t]of i.packageRegistryData){let n=new Map;for(let[r,i]of t)n.set(r,i),i.discardFromLookup||c.set(i.packageLocation,{name:e,reference:r});s.set(e,n)}let l={rootDir:o,packages:s,locatorsByLocation:c};return Go.set(e,l),l}function extractRawRuntimeState(e){let t=e.indexOf(`const RAW_RUNTIME_STATE =`);if(t<0)return null;let n=e.indexOf(`'`,t);if(n<0)return null;let r=n+1;for(;r<e.length;){let t=e.charCodeAt(r);if(t===92){r+=2;continue}if(t===39)break;r++}if(r>=e.length)return null;let i=e.slice(n+1,r);i=i.replace(/\\\n/g,``);try{return JSON.parse(i)}catch{return null}}function findPackageOwning(e,t){let n=relativeFromRoot(e.rootDir,t);if(n===null)return null;let r=null;for(let t of e.locatorsByLocation.keys())n.startsWith(t)&&(r===null||t.length>r.length)&&(r=t);if(r===null)return null;let i=e.locatorsByLocation.get(r),o=e.packages.get(i.name)?.get(i.reference);return o?{locator:i,info:o}:null}function resolveBareViaPnp(e,t,n){let r=findPackageOwning(e,n);if(!r)return null;let{pkgName:i,subPath:o}=splitSpecifier(t),s=r.info.packageDependencies?.find(([e])=>e===i);if(!s)return null;let[,c]=s;if(c===null)return null;let l=e.packages.get(i)?.get(c);if(!l)return null;let u=l.packageLocation.startsWith(`/`)?J.File.new_for_path(l.packageLocation):J.File.new_for_path(e.rootDir).resolve_relative_path(stripLeadingDotSlash(l.packageLocation));return(o?u.resolve_relative_path(o):u).get_path()}function splitSpecifier(e){if(e.startsWith(`@`)){let t=e.indexOf(`/`);if(t<0)return{pkgName:e,subPath:``};let n=e.indexOf(`/`,t+1);return n<0?{pkgName:e,subPath:``}:{pkgName:e.slice(0,n),subPath:e.slice(n+1)}}let t=e.indexOf(`/`);return t<0?{pkgName:e,subPath:``}:{pkgName:e.slice(0,t),subPath:e.slice(t+1)}}function stripLeadingDotSlash(e){return e.startsWith(`./`)?e.slice(2):e}function relativeFromRoot(e,t){if(t===e)return`./`;let n=e.endsWith(`/`)?e:e+`/`;return t.startsWith(n)?`./`+t.slice(n.length):null}var Go,Ko=__esmMin(()=>{Wo(),je(),Go=new Map}),qo=__esmMin(()=>{globalThis.imports}),Jo=__esmMin(()=>{qo()}),Yo,cli,Xo=__esmMin(()=>{je(),Yo=new TextDecoder,cli=e=>{let[t,n,r,i]=z.spawn_command_line_sync(e);if(r.byteLength)throw Error(Yo.decode(r));return Yo.decode(n)}}),Zo,readJSON,Qo=__esmMin(()=>{je(),Zo=new TextDecoder,readJSON=e=>{let[t,n]=z.file_get_contents(e);if(t)return JSON.parse(Zo.decode(n));throw Error(`Error on require "${e}"`)}}),$o,es=__esmMin(()=>{$o=n}),ts,ns=__esmMin(()=>{es(),ts=$o});function existsSync(e){return typeof e!=`string`||e===``?!1:J.File.new_for_path(e).query_exists(null)}var rs=__esmMin(()=>{Wo(),ns()}),is,resolve,getPathSeparator,as=__esmMin(()=>{je(),Wo(),{File:is}=J,resolve=(e,...t)=>{let n=is.new_for_path(e);for(let e of t)n=n.resolve_relative_path(e);return n},getPathSeparator=()=>z.get_current_dir().startsWith(`/`)?`/`:`\\`}),os=__esmMin(()=>{Xo(),Qo(),rs(),as()});function isBuiltin(e){let t=e.startsWith(`node:`)?e.slice(5):e,n=t.split(`/`)[0];return ss.includes(t)||ss.includes(n)}function resolveSymlink(e){let t=e.query_info(`standard::`,J.FileQueryInfoFlags.NOFOLLOW_SYMLINKS,null);if(t.get_is_symlink()){let n=t.get_symlink_target(),r=e.get_parent();if(n&&r)return r.resolve_relative_path(n).get_path()}return e.get_path()}function tryJsExtension(e){let t=J.File.new_for_path(e+`.js`);return t.query_exists(null)?t:null}function hasExtension$1(e){return e.includes(`.`)}function isDirectory(e){return J.File.new_for_path(e).query_file_type(J.FileQueryInfoFlags.NONE,null)===J.FileType.DIRECTORY}function resolvePackageEntry(e){let t=resolve(e,`package.json`);if(!t.query_exists(null))return null;let n=readJSON(t.get_path());if(n.exports!==void 0){let t=resolveExportsMap(n.exports,`.`,cs);if(t){let n=resolve(e,t);if(n.query_exists(null))return n.get_path()}}let r=n.main||n.module||`index.js`,i=resolve(e,r);if(i.query_exists(null))return i.get_path();if(!hasExtension$1(r)){let e=tryJsExtension(i.get_path());if(e)return e.get_path()}return null}function resolveExportsMap(e,t,n){if(typeof e==`string`)return t===`.`?e:void 0;if(typeof e!=`object`||!e)return;let r=e,i=Object.keys(r).some(e=>e===`.`||e.startsWith(`./`))?r[t]:t===`.`?r:void 0;if(i!=null)return pickConditionalValue(i,n)}function pickConditionalValue(e,t){if(typeof e==`string`)return e;if(typeof e!=`object`||!e)return;let n=e;for(let e of t)if(e in n){let r=pickConditionalValue(n[e],t);if(r!==void 0)return r}if(`default`in n&&!t.includes(`default`))return pickConditionalValue(n.default,t)}function splitBareSpecifier(e){if(e.startsWith(`@`)){let t=e.indexOf(`/`);if(t===-1)return{pkg:e,subpath:`.`};let n=e.indexOf(`/`,t+1);return n===-1?{pkg:e,subpath:`.`}:{pkg:e.slice(0,n),subpath:`.`+e.slice(n)}}let t=e.indexOf(`/`);return t===-1?{pkg:e,subpath:`.`}:{pkg:e.slice(0,t),subpath:`.`+e.slice(t)}}function fileUrlToPath(e){if(typeof e==`object`&&e&&`href`in e){let t=e;if(t.protocol&&t.protocol!==`file:`)throw TypeError(`The URL must use the file: protocol`);return z.filename_from_uri(t.href)[0]}return typeof e==`string`&&e.startsWith(`file:`)?z.filename_from_uri(e)[0]:String(e)}function resolveBareViaPnpFromCaller(e,t){let n=findPnpManifest(t);if(!n)return null;let r=loadPnpManifest(n);if(!r)return null;let i=resolveBareViaPnp(r,e,t);if(!i)return null;let o=J.File.new_for_path(i);return o.query_exists(null)?o:null}function resolveInNodeModules(e,t){let{pkg:n,subpath:r}=splitBareSpecifier(e),i=J.File.new_for_path(t);for(;i.has_parent(null);){let t=i.resolve_relative_path(`node_modules`);if(t.query_exists(null)){let i=t.resolve_relative_path(n);if(i.query_exists(null)){let e=i.resolve_relative_path(`package.json`);if(e.query_exists(null)){let t=readJSON(e.get_path());if(t.exports!==void 0){let e=resolveExportsMap(t.exports,r,cs);if(e!==void 0){let t=i.resolve_relative_path(e);if(t.query_exists(null))return t}}}let t=r===`.`?i:i.resolve_relative_path(r.slice(2));if(t.query_exists(null))return t;let n=t.get_basename();if(n&&!hasExtension$1(n)){let e=tryJsExtension(t.get_path());if(e)return e}}else{let n=t.resolve_relative_path(e);if(n.query_exists(null))return n;let r=n.get_basename();if(r&&!hasExtension$1(r)){let e=tryJsExtension(n.get_path());if(e)return e}}}i=i.get_parent()}throw Error(`Cannot find module "${e}" - not found in any node_modules directory`)}function resolveModulePath(e,t){if(isBuiltin(e))return e;let n;if(n=e.startsWith(`/`)?resolve(e):e.startsWith(`.`)?resolve(t,e):resolveBareViaPnpFromCaller(e,t)??resolveInNodeModules(e,t),e.startsWith(`/`)||e.startsWith(`.`)){if(!n.query_exists(null)){let e=n.get_basename();e&&!hasExtension$1(e)&&(n=tryJsExtension(n.get_path())??n)}if(!n.query_exists(null))throw Error(`Cannot find module "${e}"`)}let r=resolveSymlink(n),i=n.get_basename();if(i&&!hasExtension$1(i)){let t=resolvePackageEntry(r);if(t)return t;if(isDirectory(r))throw Error(`Cannot find module "${e}" - ${r} exists but has no resolvable package entry (its package.json exports/main point at a file that does not exist)`)}return r}function requireJsFile(e,t){if(e in t)return t[e];let n=J.File.new_for_path(e),r=n.get_parent().get_path(),i=n.get_basename();if(i.endsWith(`.mjs`))throw Error(`Cannot require .mjs files. Use import instead. Path: "${e}"`);if(i.endsWith(`.cjs`)){let e=resolve(r,`__gjsify__`+i.replace(/\.cjs$/,`.js`));e.query_exists(null)&&e.delete(null),n.copy(e,J.FileCopyFlags.NONE,null,null),n=e,i=n.get_basename()}let o=globalThis.exports,s=globalThis.module,c={exports:{}};globalThis.exports=c.exports,globalThis.module=c;try{let{searchPath:n}=imports;n.unshift(r),imports[i.replace(/\.(js|cjs)$/,``)],n.shift();let o=c.exports;return t[e]=o,o}finally{globalThis.exports=o,globalThis.module=s}}function createRequire(e){let t=fileUrlToPath(e);if(!t.startsWith(`/`))throw TypeError(`The argument must be a file URL object, file URL string, or absolute path string. Received "${String(e)}"`);let n=z.path_get_dirname(t),r=Object.create(null),i=function require(e){let t=resolveModulePath(e,n);if(t in r)return r[t];if(t.endsWith(`.json`)){let e=readJSON(t);return r[t]=e,e}if(isBuiltin(e))throw Error(`createRequire: Cannot require builtin module "${e}" synchronously in GJS. Use import instead.`);return requireJsFile(t,r)};return i.resolve=function resolve(e){return resolveModulePath(e,n)},i.resolve.paths=e=>null,i.cache=r,i.extensions=Object.create(null),i.main=void 0,i}var ss,cs,Module,ls=__esmMin(()=>{Ko(),Jo(),Wo(),je(),os(),ss=`assert.async_hooks.buffer.child_process.cluster.console.constants.crypto.dgram.diagnostics_channel.dns.domain.events.fs.http.http2.https.inspector.module.net.os.path.perf_hooks.process.punycode.querystring.readline.repl.stream.string_decoder.sys.timers.tls.tty.url.util.v8.vm.wasi.worker_threads.zlib`.split(`.`),__name(hasExtension$1,`hasExtension`),cs=[`node`,`import`,`default`],Module=class{static builtinModules=ss;static isBuiltin=isBuiltin;static createRequire=createRequire;static Module;id;filename=null;loaded=!1;exports={};children=[];paths=[];parent;constructor(e=``,t){this.id=e,this.parent=t}},Module.Module=Module}),us=__exportAll$3({__gjsifyModuleDir:()=>__gjsifyModuleDir$1,__gjsifyModuleFile:()=>__gjsifyModuleFile$1,__gjsifyModuleUrl:()=>__gjsifyModuleUrl,splitPackageSpec:()=>splitPackageSpec});function splitPackageSpec(e){let t=e.split(`/`),n=e.startsWith(`@`)?2:1;return{pkg:t.slice(0,n).join(`/`),subpath:t.slice(n).join(`/`)}}function bundleAnchorUrl(){let e=globalThis.__gjsifyBundleUrl;if(!e)throw Error(`gjsify: __gjsifyBundleUrl is not set — the bundle-URL banner did not run. The module-resolve shim is only valid in single-file app builds (gjsify build --app gjs|node).`);return e}function bundleResolve(){return ds||=createRequire(bundleAnchorUrl()).resolve,ds}function resolvePackageRoot(e){let t=bundleResolve();try{return ht(t(`${e}/package.json`))}catch{let n=t(e),r=`/node_modules/${e}/`,i=n.lastIndexOf(r);return i>=0?n.slice(0,i+r.length-1):ht(n)}}function resolveFile(e){let t=fs.get(e);if(t!==void 0)return t;let n;try{let{pkg:t,subpath:r}=splitPackageSpec(e),i=resolvePackageRoot(t);n=r?ft(i,r):i}catch{n=fileURLToPath(bundleAnchorUrl())}return fs.set(e,n),n}function __gjsifyModuleFile$1(e){return resolveFile(e)}function __gjsifyModuleUrl(e){return pathToFileURL(resolveFile(e)).href}function __gjsifyModuleDir$1(e){return ht(resolveFile(e))}var ds,fs,ps=__esmMin(()=>{ls(),Mt(),Ct(),ds=null,fs=new Map,__name(__gjsifyModuleFile$1,`__gjsifyModuleFile`),__name(__gjsifyModuleDir$1,`__gjsifyModuleDir`)}),ms,__exportAll,hs=__esmMin(()=>{ms=Object.defineProperty,__exportAll=(e,t)=>{let n={};for(var r in e)ms(n,r,{get:e[r],enumerable:!0});return t||ms(n,Symbol.toStringTag,{value:`Module`}),n}});function normalizePath$1(e){return e instanceof URL||e instanceof jt?fileURLToPath(e):typeof e==`string`?e:e.toString()}function randomName(){return[...[,,,,,,]].map(()=>`0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ`[Math.floor(Math.random()*62)]).join(``)}var gs=__esmMin(()=>{Mt(),__name(normalizePath$1,`normalizePath`)});function createNodeError(e,t,n,r){return typeof e?.code==`string`?e:createNodeError$1(e,t,{path:n.toString(),dest:r?.toString()})}function requireCallback(e,t=`cb`){if(typeof e==`function`)return e;let n=TypeError(`The "${t}" argument must be of type function. Received ${describeReceived(e)}`);throw n.code=`ERR_INVALID_ARG_TYPE`,n}function describeReceived(e){if(e==null)return String(e);if(typeof e==`object`){let t=e.constructor?.name;return`an instance of ${t&&t.length>0?t:`Object`}`}if(typeof e==`string`){let t=e.length>25?`${e.slice(0,25)}...`:e;return t.includes(`'`)?`type string ("${t}")`:`type string ('${t}')`}return typeof e==`bigint`?`type bigint (${e}n)`:typeof e==`symbol`?`type symbol (${e.toString()})`:`type ${typeof e} (${String(e)})`}function invalidState(e){let t=Error(`Invalid state: ${e}`);return t.code=`ERR_INVALID_STATE`,t}var _s=__esmMin(()=>{ve()});function gioEventToNodeType(e){switch(e){case J.FileMonitorEvent.CHANGED:case J.FileMonitorEvent.CHANGES_DONE_HINT:return`change`;case J.FileMonitorEvent.DELETED:case J.FileMonitorEvent.CREATED:case J.FileMonitorEvent.RENAMED:case J.FileMonitorEvent.MOVED_IN:case J.FileMonitorEvent.MOVED_OUT:return`rename`;default:return null}}var WatchTree,vs=__esmMin(()=>{_s(),Wo(),Ct(),ve(),WatchTree=class{_monitors=new Map;_fileMonitors=new Map;_closed=!1;_root;_recursive;_fanOut;_budget;_budgetReported=!1;_onEvent;_onError;constructor(e,t,n,r,i){this._recursive=t,this._onEvent=n,this._onError=r,this._fanOut=i?.fanOut??isDarwin(),this._budget=i?.budget??(this._fanOut?4096:1/0);let o=J.File.new_for_path(e);this._root=o.get_path()??e,this._open(this._root,o),o.query_file_type(J.FileQueryInfoFlags.NONE,null)===J.FileType.DIRECTORY&&(t||this._fanOut)&&this._descend(this._root,!1)}get monitorCount(){return this._monitors.size+this._fileMonitors.size}close(){this._closed=!0;for(let e of this._monitors.values())e.cancel();this._monitors.clear();for(let e of this._fileMonitors.values())e.cancel();this._fileMonitors.clear()}_open(e,t){let n=t.monitor(J.FileMonitorFlags.NONE,null);n.connect(`changed`,(e,t,n,r)=>{this._dispatch(t,r)}),this._monitors.set(e,n)}_watchFile(e){if(this._closed||this._fileMonitors.has(e)||!this._admit(e))return;let t;try{t=J.File.new_for_path(e).monitor(J.FileMonitorFlags.NONE,null)}catch(e){isNotFoundError(e)||this._onError(e);return}t.connect(`changed`,(e,t,n,r)=>{if(gioEventToNodeType(r)!==`change`)return;let i=t.get_path();i!==null&&this._emit(`change`,i)}),this._fileMonitors.set(e,t)}_admit(e){if(this.monitorCount<this._budget)return!0;if(this._budgetReported)return!1;this._budgetReported=!0;let t=Error(`fs.watch: this watch holds its whole budget of ${this._budget} monitors and stopped at ${e}. Anything under ${this._root} that is not already attached is NOT being watched, and no further event will arrive for it. The budget is finite because this host needs a monitor per FILE rather than per directory, and unbounded growth of a shared process resource surfaces as an unrelated allocation failing elsewhere, in a trace that never mentions fs.watch. Watch a narrower directory.`);return t.code=`ERR_FS_WATCH_MONITOR_BUDGET`,t.path=e,this._onError(t),!1}_dispatch(e,t){let n=e.get_path();if(n===null)return;let r=gioEventToNodeType(t);if(r!==null&&this._emit(r,n),!(!this._recursive&&!this._fanOut))switch(t){case J.FileMonitorEvent.CREATED:case J.FileMonitorEvent.MOVED_IN:{let t=e.query_file_type(J.FileQueryInfoFlags.NOFOLLOW_SYMLINKS,null);t===J.FileType.DIRECTORY?this._recursive&&this._addSubtree(n,!0):this._fanOut&&t===J.FileType.REGULAR&&this._watchFile(n);break}case J.FileMonitorEvent.DELETED:case J.FileMonitorEvent.MOVED_OUT:this._dropSubtree(n);break}}_emit(e,t){let n=pt(this._root,t);this._onEvent(e,n===``?gt(t):n)}_addSubtree(e,t){if(!(this._closed||this._monitors.has(e))&&this._admit(e)){try{this._open(e,J.File.new_for_path(e))}catch(e){isNotFoundError(e)||this._onError(e);return}this._descend(e,t)}}_descend(e,t){for(let n of this._children(e)){if(this._closed)return;if(n.isDirectory){if(!this._recursive)continue;t&&this._emit(`rename`,n.path),this._addSubtree(n.path,t)}else t&&this._emit(`rename`,n.path),this._fanOut&&n.isFile&&this._watchFile(n.path)}}_dropSubtree(e){this._fileMonitors.get(e)?.cancel(),this._fileMonitors.delete(e);let t=e+bt;for(let[e,n]of this._fileMonitors)e.startsWith(t)&&(n.cancel(),this._fileMonitors.delete(e));for(let[n,r]of this._monitors)n!==e&&!n.startsWith(t)||(r.cancel(),this._monitors.delete(n))}_children(e){let t;try{t=J.File.new_for_path(e).enumerate_children(`standard::name,standard::type`,J.FileQueryInfoFlags.NOFOLLOW_SYMLINKS,null)}catch(e){return isNotFoundError(e)||this._onError(e),[]}let n=[];try{let r=t.next_file(null);for(;r!==null;){let i=r.get_file_type();n.push({path:ft(e,r.get_name()),isDirectory:i===J.FileType.DIRECTORY,isFile:i===J.FileType.REGULAR}),r=t.next_file(null)}}catch(e){isNotFoundError(e)||this._onError(e)}finally{try{t.close(null)}catch{}}return n}}});async function*watchAsync(e,t){let n=t?.signal;if(n?.aborted)return;let r=normalizePath$1(e),i=[],o=[],s=!1,c=null;function enqueue(e){s||(o.length>0?o.shift().resolve({value:e,done:!1}):i.push(e))}function terminate(){if(!s)for(s=!0;o.length>0;)o.shift().resolve({value:void 0,done:!0})}let l;try{l=new WatchTree(r,t?.recursive===!0,(e,t)=>{enqueue({eventType:e,filename:t})},e=>{c=e,terminate()})}catch{return}let abortHandler=()=>terminate();n?.addEventListener(`abort`,abortHandler);try{for(;!s;){if(i.length>0){yield i.shift();continue}let e=await new Promise(e=>{o.push({resolve:e})});if(e.done)break;yield e.value}if(c!==null)throw c}finally{n?.removeEventListener(`abort`,abortHandler),l.close()}}var ys,FSWatcher,bs=__esmMin(()=>{gs(),vs(),je(),Ke(),ys=new WeakMap,FSWatcher=class extends Ge{constructor(e,t,n){super(),(!t||typeof t!=`object`)&&(t={persistent:!0});let r=t.persistent!==!1,i=new WatchTree(normalizePath$1(e),t.recursive===!0,(e,t)=>{this.emit(`change`,e,t)},e=>{this.emit(`error`,e)}),o=null;r&&(o=z.timeout_add(z.PRIORITY_LOW,2147483647,()=>z.SOURCE_CONTINUE)),ys.set(this,{persistent:r,closed:!1,sourceId:o,tree:i}),n&&this.on(`change`,n)}close(){let e=ys.get(this);e.closed||(e.closed=!0,e.tree.close(),e.sourceId!==null&&(z.source_remove(e.sourceId),e.sourceId=null))}ref(){let e=ys.get(this);return!e.persistent&&!e.closed&&(e.persistent=!0,e.sourceId=z.timeout_add(z.PRIORITY_LOW,2147483647,()=>z.SOURCE_CONTINUE)),this}unref(){let e=ys.get(this);return e.persistent&&(e.persistent=!1,e.sourceId!==null&&(z.source_remove(e.sourceId),e.sourceId=null)),this}}}),xs=__exportAll$3({lchmod:()=>void 0,lchmodAsync:()=>lchmodAsync,lchmodSync:()=>void 0,lchown:()=>lchown,lchownAsync:()=>lchownAsync,lchownSync:()=>lchownSync,lutimes:()=>lutimes,lutimesAsync:()=>lutimesAsync,lutimesSync:()=>lutimesSync,utimes:()=>utimes,utimesAsync:()=>utimesAsync,utimesSync:()=>utimesSync});function toGLibDateTime(e){let t=e instanceof Date?e.getTime():typeof e==`bigint`?Number(e):typeof e==`string`?Date.parse(e):e*1e3;return z.DateTime.new_from_unix_utc(Math.floor(t/1e3))}function setTimestamps(e,t,n,r){let i=J.File.new_for_path(e),o=new J.FileInfo;o.set_modification_date_time(toGLibDateTime(n)),o.set_access_date_time(toGLibDateTime(t)),i.set_attributes_from_info(o,r,null)}function utimesSync(e,t,n){setTimestamps(normalizePath$1(e),t,n,J.FileQueryInfoFlags.NONE)}function utimes(e,t,n,r){requireCallback(r),Promise.resolve().then(()=>utimesSync(e,t,n)).then(()=>r(null),r)}async function utimesAsync(e,t,n){utimesSync(e,t,n)}function lutimesSync(e,t,n){setTimestamps(normalizePath$1(e),t,n,J.FileQueryInfoFlags.NOFOLLOW_SYMLINKS)}function lutimes(e,t,n,r){requireCallback(r),Promise.resolve().then(()=>lutimesSync(e,t,n)).then(()=>r(null),r)}async function lutimesAsync(e,t,n){lutimesSync(e,t,n)}function lchownSync(e,t,n){let r=normalizePath$1(e),i=J.File.new_for_path(r),o=new J.FileInfo;t!==-1&&o.set_attribute_uint32(`unix::uid`,t),n!==-1&&o.set_attribute_uint32(`unix::gid`,n),i.set_attributes_from_info(o,J.FileQueryInfoFlags.NOFOLLOW_SYMLINKS,null)}function lchown(e,t,n,r){requireCallback(r),Promise.resolve().then(()=>lchownSync(e,t,n)).then(()=>r(null),r)}async function lchownAsync(e,t,n){lchownSync(e,t,n)}function lchmodUnsupported(){let e=Error(`The lchmod() method is not implemented`);return e.code=`ERR_METHOD_NOT_IMPLEMENTED`,e}async function lchmodAsync(e,t){throw lchmodUnsupported()}var Ss=__esmMin(()=>{gs(),_s(),je(),Wo()});function isStdFd(e){return e===0||e===1||e===2}function stdinInput(){return Cs||=ts.InputStream.new(0,!1),Cs}function stdOutput(e){return ws[e]||(ws[e]=ts.OutputStream.new(e,!1)),ws[e]}function readStdFdAll(e){try{let t=e===0?stdinInput():ts.InputStream.new(e,!1),n=[],r=0;for(;;){let e=t.read_bytes(64*1024,null).get_data();if(!e||e.length===0)break;n.push(e),r+=e.length}return concat(n,r)}catch(t){if(e!==0)throw t;let[n,r]=J.File.new_for_path(`/dev/stdin`).load_contents(null);if(!n)throw t;return r}}function readStdFdSync(e,t,n,r){let i=(e===0?stdinInput():ts.InputStream.new(e,!1)).read_bytes(r,null).get_data();return i&&i.length>0?(new Uint8Array(t.buffer,t.byteOffset+n).set(i),i.length):0}function writeStdFdSync(e,t){return stdOutput(e).write_bytes(z.Bytes.new(t),null)}function concat(e,t){if(e.length===1)return e[0];let n=new Uint8Array(t),r=0;for(let t of e)n.set(t,r),r+=t.length;return n}var Cs,ws,Ts=__esmMin(()=>{je(),Wo(),ns(),Cs=null,ws={}});function getEncodingFromOptions(e={encoding:null,flag:`r`},t=`utf8`){return e===null?t:typeof e==`string`?e:typeof e==`object`&&typeof e.encoding==`string`?e.encoding:t}function encodeUint8Array(e,t){return e===`buffer`?R.from(t):new TextDecoder(e).decode(t)}function decode(e,t){if(t){let n=new TextDecoder(t),r=new TextEncoder;return n.decode(r.encode(e))}else return e}var Es=__esmMin(()=>{Oe()}),Ds,Os=__esmMin(()=>{pe(),Ds=trackedCallback});function createReadStream(e,t){return new ReadStream(e,t)}var ReadStream,ks=__esmMin(()=>{gs(),mc(),Os(),pc(),je(),Wo(),Oe(),Za(),ReadStream=class extends Ka{bytesRead=0;path;pending=!0;fd=null;_ownFd=null;_autoCloseFd=!0;_positional=!1;_gioFile;_inputStream=null;_cancellable=new J.Cancellable;_start;_end;_pos;_reading=!1;_readAgain=!1;_lastSize=64*1024;close(e){this._cancellable.cancel(),this._release(),this.destroy(),e&&e(null)}constructor(e,t){let n=normalizePath$1(e);super({highWaterMark:t?.highWaterMark??64*1024,encoding:t?.encoding,objectMode:!1}),this.path=n,this._gioFile=J.File.new_for_path(n),this._start=t?.start??0,this._end=t?.end??1/0,this._pos=this._start,this._positional=t?.start!==void 0,typeof t?.fd==`number`&&(this._ownFd=t.fd,this.fd=t.fd,this._autoCloseFd=t.autoClose!==!1),this.once(`end`,()=>this._release())}_construct(e){if(this._ownFd!==null){this.pending=!1,e(),this.emit(`open`,this._ownFd),this.emit(`ready`);return}this._gioFile.read_async(z.PRIORITY_DEFAULT,this._cancellable,Ds((t,n)=>{if(this.destroyed){e();return}try{this._inputStream=this._gioFile.read_finish(n),this.pending=!1,this.emit(`open`,0),this.emit(`ready`),this._start>0&&this._inputStream.can_seek()&&this._inputStream.seek(this._start,z.SeekType.SET,null),e()}catch(t){this._cancellable.is_cancelled()||e(t)}}))}_read(e){if(this._lastSize=e,this._reading){this._readAgain=!0;return}this._doRead(e)}_doRead(e){if(this._ownFd!==null){if(this._reading||this.destroyed)return;this._reading=!0,z.timeout_add(z.PRIORITY_DEFAULT,0,()=>(this._reading=!1,this.destroyed||this._readThroughFd(e),z.SOURCE_REMOVE));return}let t=e;if(this._end!==1/0){let n=this._end-this._pos+1;if(n<=0){this.push(null);return}t=Math.min(e,n)}let n=this._inputStream;!n||this.destroyed||(this._reading=!0,n.read_bytes_async(t,z.PRIORITY_DEFAULT,this._cancellable,Ds((e,t)=>{this._reading=!1;try{let e=n.read_bytes_finish(t).get_data();if(!e||e.length===0){this._readAgain=!1,this.push(null);return}this.bytesRead+=e.length,this._pos+=e.length,this.push(R.from(e)),this._readAgain&&!this._reading&&(this._readAgain=!1,this._doRead(this._lastSize))}catch(e){this._readAgain=!1,this._cancellable.is_cancelled()||this.destroy(e)}})))}_readThroughFd(e){try{let t=e;if(this._end!==1/0){let n=this._end-this._pos+1;if(n<=0){this._readAgain=!1,this.push(null);return}t=Math.min(e,n)}let n=fc.getInstance(this._ownFd,`read`),r=R.alloc(t),i=n._readSync(r,0,t,this._positional?this._pos:null);if(i===0){this._readAgain=!1,this.push(null);return}this.bytesRead+=i,this._pos+=i,this.push(r.subarray(0,i))}catch(e){this._readAgain=!1,this.destroy(e)}}_release(){this._inputStream&&=(this._inputStream.close_async(z.PRIORITY_DEFAULT,null,Ds(()=>{})),null),this._releaseFd()}_releaseFd(){if(this._ownFd===null||!this._autoCloseFd)return;let e=this._ownFd;this._ownFd=null,this.fd=null;try{closeSync(e)}catch{}}_destroy(e,t){this._cancellable.cancel(),this._release(),t(e)}}});function openFlagValues(){return isWin32()?Ms:isDarwin()?js:As}function stringFlagBits(e,t){switch(e){case`r`:return t.O_RDONLY;case`rs`:case`sr`:return t.O_RDONLY|t.O_SYNC;case`r+`:return t.O_RDWR;case`rs+`:case`sr+`:return t.O_RDWR|t.O_SYNC;case`w`:return t.O_TRUNC|t.O_CREAT|t.O_WRONLY;case`wx`:case`xw`:return t.O_TRUNC|t.O_CREAT|t.O_WRONLY|t.O_EXCL;case`w+`:return t.O_TRUNC|t.O_CREAT|t.O_RDWR;case`wx+`:case`xw+`:return t.O_TRUNC|t.O_CREAT|t.O_RDWR|t.O_EXCL;case`a`:return t.O_APPEND|t.O_CREAT|t.O_WRONLY;case`ax`:case`xa`:return t.O_APPEND|t.O_CREAT|t.O_WRONLY|t.O_EXCL;case`as`:case`sa`:return t.O_APPEND|t.O_CREAT|t.O_WRONLY|t.O_SYNC;case`a+`:return t.O_APPEND|t.O_CREAT|t.O_RDWR;case`ax+`:case`xa+`:return t.O_APPEND|t.O_CREAT|t.O_RDWR|t.O_EXCL;case`as+`:case`sa+`:return t.O_APPEND|t.O_CREAT|t.O_RDWR|t.O_SYNC;default:return}}function parseOpenFlags(e){let t=openFlagValues(),n;if(e==null)n=t.O_RDONLY;else if(typeof e==`number`)n=e;else{let r=stringFlagBits(e,t);if(r===void 0){let t=TypeError(`Unknown file open flag: ${e}`);throw t.code=`ERR_INVALID_ARG_VALUE`,t}n=r}let r=n&(t.O_RDONLY|t.O_WRONLY|t.O_RDWR);return{posix:n,readable:r===t.O_RDONLY||r===t.O_RDWR,writable:r===t.O_WRONLY||r===t.O_RDWR,append:(n&t.O_APPEND)!==0,creat:(n&t.O_CREAT)!==0,excl:(n&t.O_CREAT)!==0&&(n&t.O_EXCL)!==0,trunc:(n&t.O_TRUNC)!==0,nofollow:t.O_NOFOLLOW!==0&&(n&t.O_NOFOLLOW)!==0,directory:t.O_DIRECTORY!==0&&(n&t.O_DIRECTORY)!==0}}function normalizeMode(e,t){let n=e??t,r=n;if(typeof n==`string`){if(!/^[0-7]+$/.test(n))throw invalidMode(n);r=parseInt(n,8)}if(typeof r!=`number`)throw modeNotANumber(r);if(!Number.isInteger(r))throw modeOutOfRange(`an integer`,r);if(r<0||r>4294967295)throw modeOutOfRange(`>= 0 && <= 4294967295`,r);return r}function invalidMode(e){let t=TypeError(`The argument 'mode' must be a 32-bit unsigned integer or an octal string. Received '${e}'`);return t.code=`ERR_INVALID_ARG_VALUE`,t}function modeNotANumber(e){let t=e==null?String(e):`type ${typeof e} (${describeValue(e)})`,n=TypeError(`The "mode" argument must be of type number. Received ${t}`);return n.code=`ERR_INVALID_ARG_TYPE`,n}function describeValue(e){try{return typeof e==`object`?Object.prototype.toString.call(e):String(e)}catch{return`<unprintable>`}}function modeOutOfRange(e,t){let n=RangeError(`The value of "mode" is out of range. It must be ${e}. Received ${t}`);return n.code=`ERR_OUT_OF_RANGE`,n}var As,js,Ms,Ns=__esmMin(()=>{ve(),As={O_RDONLY:0,O_WRONLY:1,O_RDWR:2,O_CREAT:64,O_EXCL:128,O_NOCTTY:256,O_TRUNC:512,O_APPEND:1024,O_NONBLOCK:2048,O_DSYNC:4096,O_SYNC:1052672,O_DIRECTORY:65536,O_NOFOLLOW:131072},js={O_RDONLY:0,O_WRONLY:1,O_RDWR:2,O_CREAT:512,O_EXCL:2048,O_NOCTTY:131072,O_TRUNC:1024,O_APPEND:8,O_NONBLOCK:4,O_DSYNC:4194304,O_SYNC:128,O_DIRECTORY:1048576,O_NOFOLLOW:256},Ms={O_RDONLY:0,O_WRONLY:1,O_RDWR:2,O_CREAT:256,O_EXCL:1024,O_NOCTTY:0,O_TRUNC:512,O_APPEND:8,O_NONBLOCK:0,O_DSYNC:0,O_SYNC:0,O_DIRECTORY:0,O_NOFOLLOW:0}}),Dirent,Ps=__esmMin(()=>{Wo(),Ct(),Dirent=class{name;parentPath;_isFile=!1;_isDirectory=!1;_isBlockDevice=!1;_isCharacterDevice=!1;_isSymbolicLink=!1;_isFIFO=!1;_isSocket=!1;_file;constructor(e,t,n,r,i){switch(t||=gt(e),this.name=t,this.parentPath=i??ht(e),this._file=J.File.new_for_path(e),n??this._file.query_file_type(J.FileQueryInfoFlags.NONE,null)){case J.FileType.DIRECTORY:this._isDirectory=!0;break;case J.FileType.MOUNTABLE:break;case J.FileType.REGULAR:this._isFile=!0;break;case J.FileType.SYMBOLIC_LINK:case J.FileType.SHORTCUT:this._isSymbolicLink=!0;break;case J.FileType.SPECIAL:this._classifySpecialFile(e,r);break}}_classifySpecialFile(e,t){try{let n=t?.has_attribute(`unix::mode`)===!0?t:J.File.new_for_path(e).query_info(`unix::mode`,J.FileQueryInfoFlags.NONE,null),r=n.has_attribute(`unix::mode`)?n.get_attribute_uint32(`unix::mode`):0;if(r===0)return;switch(r&61440){case 24576:this._isBlockDevice=!0;break;case 8192:this._isCharacterDevice=!0;break;case 49152:this._isSocket=!0;break;case 4096:this._isFIFO=!0;break}}catch{}}isFile(){return this._isFile}isDirectory(){return this._isDirectory}isBlockDevice(){return this._isBlockDevice}isCharacterDevice(){return this._isCharacterDevice}isSymbolicLink(){return this._isSymbolicLink}isFIFO(){return this._isFIFO}isSocket(){return this._isSocket}}});function fsError(e,t,n,r){let i=`${e}: ${describe(e)}, ${t}`;n&&(i+=` '${n}'`),r&&(i+=` -> '${r}'`);let o=Error(i);return o.code=e,o.errno=Fs[e]??-1,o.syscall=t,n&&(o.path=n),r&&(o.dest=r),o}function describe(e){switch(e){case`ENOENT`:return`no such file or directory`;case`EEXIST`:return`file already exists`;case`EACCES`:return`permission denied`;case`EISDIR`:return`illegal operation on a directory`;case`ENOTDIR`:return`not a directory`;case`EBADF`:return`bad file descriptor`;case`EPERM`:return`operation not permitted`;case`EINVAL`:return`invalid argument`;case`ELOOP`:return`too many symbolic links encountered`;case`ENAMETOOLONG`:return`name too long`;case`EMFILE`:return`too many open files`;case`ENFILE`:return`file table overflow`;case`EROFS`:return`read-only file system`;case`ESPIPE`:return`invalid seek`;case`ENXIO`:return`no such device or address`;default:return`i/o error`}}function hasProcFd(){return Is===null&&(Is=z.file_test(`/proc/self/fd`,z.FileTest.IS_DIR)),Is}function fdPath(e){return hasProcFd()?`/proc/self/fd/${e}`:null}function openFd(e,t,n){let r=z.open(e,t.posix,n);if(r<0)throw classifyOpenFailure(e,t);return r}function closeFd(e){z.close(e)}function classifyOpenFailure(e,t){let n=nameTooLong(e,`open`);if(n)return n;let r=J.File.new_for_path(e),i=null,o=!1;try{let e=r.query_info(`standard::type,standard::symlink-target,unix::mode,access::can-read,access::can-write`,J.FileQueryInfoFlags.NOFOLLOW_SYMLINKS,null);answered(e)?i=e:o=!0}catch{i=null}if(o)return refusalNotAboutThePath(e,t,r,null);if(i){if(t.excl)return fsError(`EEXIST`,`open`,e);if(i.get_file_type()===J.FileType.SYMBOLIC_LINK&&!t.nofollow){let n=walkSymlinkChain(r);if(n===`loop`)return fsError(`ELOOP`,`open`,e);if(n===`too-long`)return fsError(`ENAMETOOLONG`,`open`,e);if(n===`dangling`&&!t.creat)return fsError(`ENOENT`,`open`,e)}return i.get_file_type()===J.FileType.DIRECTORY&&t.writable?fsError(`EISDIR`,`open`,e):t.directory&&i.get_file_type()!==J.FileType.DIRECTORY?fsError(`ENOTDIR`,`open`,e):refusalNotAboutThePath(e,t,r,i)}if(ancestorIsNotADirectory(r))return fsError(`ENOTDIR`,`open`,e);if(!t.creat)return fsError(`ENOENT`,`open`,e);let s=r.get_parent();if(!s)return fsError(`ENOENT`,`open`,e);try{s.query_info(`standard::type`,J.FileQueryInfoFlags.NONE,null)}catch{return fsError(`ENOENT`,`open`,e)}return refusalNotAboutThePath(e,t,r,null)}function ancestorIsNotADirectory(e){for(let t=e.get_parent();t;t=t.get_parent()){let e;try{e=t.query_info(`standard::type`,J.FileQueryInfoFlags.NONE,null)}catch{continue}return answered(e)?e.get_file_type()!==J.FileType.DIRECTORY:!1}return!1}function answered(e){return e!==null&&e.has_attribute(`standard::type`)}function nameTooLong(e,t){let n=new TextEncoder;if(n.encode(e).length>4096)return fsError(`ENAMETOOLONG`,t,e);for(let r of splitPathComponents(e))if(n.encode(r).length>255)return fsError(`ENAMETOOLONG`,t,e);return null}function walkSymlinkChain(e){let t=new TextEncoder,n=e;for(let e=0;e<40;e++){let e;try{e=n.query_info(`standard::type,standard::symlink-target`,J.FileQueryInfoFlags.NOFOLLOW_SYMLINKS,null)}catch{return`dangling`}if(!answered(e)||e.get_file_type()!==J.FileType.SYMBOLIC_LINK)return`resolved`;let r=e.get_symlink_target();if(!r)return`dangling`;if(t.encode(r).length>4096)return`too-long`;let i=n.get_parent();n=r.startsWith(`/`)?J.File.new_for_path(r):i?.resolve_relative_path(r)??J.File.new_for_path(r)}return`loop`}function refusalNotAboutThePath(e,t,n,r){let i=z.open(`/dev/null`,0,0);if(i<0)return fsError(`EMFILE`,`open`,e);z.close(i);let o=r!==null&&(r.get_attribute_uint32(`unix::mode`)&146)==0;if((t.writable||t.creat)&&!o)try{if(n.query_filesystem_info(`filesystem::readonly`,null).get_attribute_boolean(`filesystem::readonly`))return fsError(`EROFS`,`open`,e)}catch{}return r&&nothingOnTheOtherEnd(t,r)?fsError(`ENXIO`,`open`,e):fsError(`EACCES`,`open`,e)}function nothingOnTheOtherEnd(e,t){if(!t.has_attribute(`unix::mode`))return!1;let n=t.get_attribute_uint32(`unix::mode`)&61440;if(!(n===8192||n===24576||n===4096))return!1;let permits=e=>t.has_attribute(e)&&t.get_attribute_boolean(e);return!(e.readable&&!permits(`access::can-read`)||e.writable&&!permits(`access::can-write`))}function classifyMkdirFailure(e){let t=nameTooLong(e,`mkdir`);if(t)return t;let n=J.File.new_for_path(e);try{return answered(n.query_info(`standard::type`,J.FileQueryInfoFlags.NOFOLLOW_SYMLINKS,null))?fsError(`EEXIST`,`mkdir`,e):fsError(`EACCES`,`mkdir`,e)}catch{}let r=n.get_parent();if(!r)return fsError(`ENOENT`,`mkdir`,e);try{let t=r.query_info(`standard::type`,J.FileQueryInfoFlags.NONE,null);if(answered(t)&&t.get_file_type()!==J.FileType.DIRECTORY)return fsError(`ENOTDIR`,`mkdir`,e)}catch{return fsError(`ENOENT`,`mkdir`,e)}return fsError(`EACCES`,`mkdir`,e)}function seekHandle(e){let t=Ls.get(e);return t||(t=z.IOChannel.unix_new(e),t.set_encoding(null),t.set_buffered(!1),t.set_close_on_unref(!1),Ls.set(e,t)),t}function input(e){let t=Rs.get(e);return t||(t=ts.InputStream.new(e,!1),Rs.set(e,t)),t}function output(e){let t=zs.get(e);return t||(t=ts.OutputStream.new(e,!1),zs.set(e,t)),t}function isSeekableFd(e,t){let n=Bs.get(e);return n===void 0&&(n=probeSeekable(e,t),Bs.set(e,n)),n}function probeSeekable(e,t){try{let n=J.File.new_for_path(fdPath(e)??t).query_info(`unix::mode`,J.FileQueryInfoFlags.NONE,null);if(n.has_attribute(`unix::mode`)){let e=n.get_attribute_uint32(`unix::mode`)&61440;if(e===4096||e===49152)return!1}}catch{}try{return seekHandle(e).seek_position(0,z.SeekType.CUR),!0}catch{return!1}}function seekFd(e,t){seekHandle(e).seek_position(t,z.SeekType.SET)}function tellFd(e){if(!hasProcFd())return null;try{let[t,n]=z.file_get_contents(`/proc/self/fdinfo/${e}`);if(!t)return null;let r=/^pos:\s*(\d+)/m.exec(new TextDecoder().decode(n));return r?Number(r[1]):null}catch{return null}}function readFd(e,t){return t<=0?new Uint8Array:input(e).read_bytes(t,null).get_data()??new Uint8Array}function writeFd(e,t){if(t.length===0)return 0;let[,n]=output(e).write_all(t,null);return n}function fsyncFd(e){output(e).flush(null),z.fsync(e)}function releaseFd(e){let t=zs.get(e);if(t)try{t.flush(null)}catch{}Ls.delete(e),Rs.delete(e),zs.delete(e),Bs.delete(e)}function sizeOfFd(e,t){let n=fdPath(e)??t,r=J.File.new_for_path(n).query_info(`standard::size`,J.FileQueryInfoFlags.NONE,null);return Number(r.get_size())}function truncateFd(e,t,n){let r=J.File.new_for_path(fdPath(e)??n),i;try{let e=r.append_to(J.FileCreateFlags.NONE,null);try{e.truncate(t,null)}finally{e.close(null)}return}catch(e){i=e}try{let e=r.open_readwrite(null);try{e.get_output_stream().truncate(t,null)}finally{e.close(null)}return}catch{}throw createNodeError(i,`ftruncate`,n)}var Fs,Is,Ls,Rs,zs,Bs,Vs=__esmMin(()=>{_s(),je(),Wo(),ve(),ns(),Fs={EPERM:-1,ENOENT:-2,EIO:-5,ENXIO:-6,EBADF:-9,EACCES:-13,EEXIST:-17,ENOTDIR:-20,EISDIR:-21,EINVAL:-22,ENFILE:-23,EMFILE:-24,ETXTBSY:-26,ENOSPC:-28,ESPIPE:-29,EROFS:-30,ENAMETOOLONG:-36,ENOTEMPTY:-39,ELOOP:-40},Is=null,Ls=new Map,Rs=new Map,zs=new Map,Bs=new Map});function populateFromInfo(e){let t=e.get_attribute_uint64(`time::access`),n=e.get_attribute_uint32(`time::access-usec`)||0,r=e.get_attribute_uint64(`time::modified`),i=e.get_attribute_uint32(`time::modified-usec`)||0,o=e.get_attribute_uint64(`time::changed`),s=e.get_attribute_uint32(`time::changed-usec`)||0,c=e.get_attribute_uint64(`time::created`),l=e.get_attribute_uint32(`time::created-usec`)||0,u=t*1e3+n/1e3,d=r*1e3+i/1e3,f=o?o*1e3+s/1e3:d,p=c?c*1e3+l/1e3:f;return{dev:e.get_attribute_uint32(`unix::device`)||0,ino:Number(e.get_attribute_uint64(`unix::inode`)||0),mode:e.get_attribute_uint32(`unix::mode`)||0,nlink:e.get_attribute_uint32(`unix::nlink`)||0,uid:e.get_attribute_uint32(`unix::uid`)||0,gid:e.get_attribute_uint32(`unix::gid`)||0,rdev:e.get_attribute_uint32(`unix::rdev`)||0,size:Number(e.get_size()||0),blksize:e.get_attribute_uint32(`unix::block-size`)||4096,blocks:Number(e.get_attribute_uint64(`unix::blocks`)||0),atimeMs:u,mtimeMs:d,ctimeMs:f,birthtimeMs:p,atime:new Date(u),mtime:new Date(d),ctime:new Date(f),birthtime:new Date(p)}}function statsFrom(e,t,n,r){if(!answered(e))throw fsError(`EACCES`,n,t);return r?new BigIntStats(e,t):new Stats(e,t)}var Hs,Stats,BigIntStats,Us=__esmMin(()=>{Ps(),Vs(),Wo(),Ct(),Hs=`standard::*,time::*,unix::*`,Stats=class extends Dirent{dev;ino;mode;nlink;uid;gid;rdev;size;blksize;blocks;atimeMs;mtimeMs;ctimeMs;birthtimeMs;atime;mtime;ctime;birthtime;_info;constructor(e,t,n){let r,i;e instanceof J.FileInfo?(r=e,i=t.toString(),n||=gt(i)):(i=e.toString(),typeof t==`string`&&(n=t),n||=gt(i),r=J.File.new_for_path(i).query_info(Hs,J.FileQueryInfoFlags.NOFOLLOW_SYMLINKS,null)),super(i,n,r.get_file_type(),r),this._info=r;let o=populateFromInfo(r);this.dev=o.dev,this.ino=o.ino,this.mode=o.mode,this.nlink=o.nlink,this.uid=o.uid,this.gid=o.gid,this.rdev=o.rdev,this.size=o.size,this.blksize=o.blksize,this.blocks=o.blocks,this.atimeMs=o.atimeMs,this.mtimeMs=o.mtimeMs,this.ctimeMs=o.ctimeMs,this.birthtimeMs=o.birthtimeMs,this.atime=o.atime,this.mtime=o.mtime,this.ctime=o.ctime,this.birthtime=o.birthtime}},BigIntStats=class extends Dirent{dev;ino;mode;nlink;uid;gid;rdev;size;blksize;blocks;atimeMs;mtimeMs;ctimeMs;birthtimeMs;atimeNs;mtimeNs;ctimeNs;birthtimeNs;atime;mtime;ctime;birthtime;_info;constructor(e,t,n){let r,i;e instanceof J.FileInfo?(r=e,i=t.toString(),n||=gt(i)):(i=e.toString(),typeof t==`string`&&(n=t),n||=gt(i),r=J.File.new_for_path(i).query_info(Hs,J.FileQueryInfoFlags.NOFOLLOW_SYMLINKS,null)),super(i,n,r.get_file_type(),r),this._info=r;let o=populateFromInfo(r);this.dev=BigInt(o.dev),this.ino=BigInt(o.ino),this.mode=BigInt(o.mode),this.nlink=BigInt(o.nlink),this.uid=BigInt(o.uid),this.gid=BigInt(o.gid),this.rdev=BigInt(o.rdev),this.size=BigInt(o.size),this.blksize=BigInt(o.blksize),this.blocks=BigInt(o.blocks),this.atimeMs=BigInt(Math.trunc(o.atimeMs)),this.mtimeMs=BigInt(Math.trunc(o.mtimeMs)),this.ctimeMs=BigInt(Math.trunc(o.ctimeMs)),this.birthtimeMs=BigInt(Math.trunc(o.birthtimeMs)),this.atimeNs=this.atimeMs*1000000n,this.mtimeNs=this.mtimeMs*1000000n,this.ctimeNs=this.ctimeMs*1000000n,this.birthtimeNs=this.birthtimeMs*1000000n,this.atime=o.atime,this.mtime=o.mtime,this.ctime=o.ctime,this.birthtime=o.birthtime}}});function statSync(e,t){let n=normalizePath$1(e);try{return statsFrom(J.File.new_for_path(n).query_info(Hs,J.FileQueryInfoFlags.NONE,null),n,`stat`,t?.bigint)}catch(e){if(t?.throwIfNoEntry===!1&&isNotFoundError(e))return;throw createNodeError(e,`stat`,n)}}function lstatSync(e,t){let n=normalizePath$1(e);try{return statsFrom(J.File.new_for_path(n).query_info(Hs,J.FileQueryInfoFlags.NOFOLLOW_SYMLINKS,null),n,`lstat`,t?.bigint)}catch(e){if(t?.throwIfNoEntry===!1&&isNotFoundError(e))return;throw createNodeError(e,`lstat`,n)}}function readdirSync(e,t){let n=normalizePath$1(e),r=J.File.new_for_path(n).enumerate_children(`standard::name,standard::type`,J.FileQueryInfoFlags.NOFOLLOW_SYMLINKS,null),i=[];try{let e=r.next_file(null);for(;e!==null;)i.push({name:e.get_name(),type:e.get_file_type()}),e=r.next_file(null)}finally{try{r.close(null)}catch{}}let o=[];for(let e of i){let r=ft(n,e.name);if(t?.withFileTypes?o.push(new Dirent(r,e.name,e.type,void 0,n)):o.push(e.name),t?.recursive&&e.type===J.FileType.DIRECTORY){let n=readdirSync(r,t);for(let t of n)typeof t==`string`?o.push(ft(e.name,t)):o.push(t)}}return o}function realpathSync(e){let t=normalizePath$1(e);return resolveEveryComponent(J.File.new_for_path(t),{left:40},t)}function resolveEveryComponent(e,t,n){let r=e.get_parent();return expandSymlinks(r===null?e:J.File.new_for_path(resolveEveryComponent(r,t,n)).get_child(e.get_basename()),t,n)}function expandSymlinks(e,t,n){let r=e;for(;;){let e=r.query_info(`standard::is-symlink,standard::symlink-target`,J.FileQueryInfoFlags.NOFOLLOW_SYMLINKS,null);if(!e.get_is_symlink())return r.get_path();if(--t.left<0)throw Error(`ELOOP: too many levels of symbolic links, realpath '${n}'`);let i=e.get_symlink_target(),o=r.get_parent(),s=z.path_is_absolute(i)?J.File.new_for_path(i):(o??r).resolve_relative_path(i);r=J.File.new_for_path(resolveEveryComponent(s,t,n))}}function symlinkSync(e,t,n){let r=normalizePath$1(t),i=normalizePath$1(e);J.File.new_for_path(r).make_symbolic_link(i,null)}function readFileSync(e,t={encoding:null,flag:`r`}){if(e instanceof fc&&(e=e.fd),typeof e==`number`&&isStdFd(e))return encodeUint8Array(getEncodingFromOptions(t,`buffer`),readStdFdAll(e));if(typeof e==`number`)return encodeUint8Array(getEncodingFromOptions(t,`buffer`),fc.getInstance(e,`read`)._readToEndSync());let n=normalizePath$1(e),r=J.File.new_for_path(n);try{let[e,i]=r.load_contents(null);if(!e)throw createNodeError(Error(`failed to read file`),`read`,n);return encodeUint8Array(getEncodingFromOptions(t,`buffer`),i)}catch(e){throw e.code&&typeof e.code==`string`?e:createNodeError(e,`read`,n)}}function mkdirSync(e,t){let n=!1,r;t!=null&&(typeof t==`object`?(t.recursive&&(n=t.recursive),t.mode!==void 0&&(r=t.mode)):r=t),e=normalizePath$1(e);let i=normalizeMode(r,511);if(n)return mkdirSyncRecursive(e,i);mkdirWithMode(e,i)}function mkdirWithMode(e,t){if(z.mkdir(e,t)!==0)throw classifyMkdirFailure(e)}function mkdirSyncRecursive(e,t){if(z.mkdir(e,t)===0)return e;let n=classifyMkdirFailure(e);if(n.code===`EEXIST`){if(z.file_test(e,z.FileTest.IS_DIR))return;throw n}if(n.code!==`ENOENT`)throw n;let r=ft(e,`..`),i=J.File.new_for_path(r).get_path();if(i===e)throw n;let o=mkdirSyncRecursive(i,t);return mkdirWithMode(e,t),o??e}function rmdirSync(e,t){let n=normalizePath$1(e),r=J.File.new_for_path(n);try{if(r.query_info(`standard::type`,J.FileQueryInfoFlags.NONE,null).get_file_type()!==J.FileType.DIRECTORY)throw createNodeError(Object.assign(Error(),{code:4}),`rmdir`,n);if(r.enumerate_children(`standard::name`,J.FileQueryInfoFlags.NONE,null).next_file(null)!==null)throw createNodeError(Object.assign(Error(),{code:5}),`rmdir`,n);r.delete(null)}catch(e){throw e.code&&typeof e.code==`string`?e:createNodeError(e,`rmdir`,n)}}function unlinkSync(e){let t=normalizePath$1(e),n=J.File.new_for_path(t);try{n.delete(null)}catch(e){throw createNodeError(e,`unlink`,t)}}function writeWholeFile(e,t,n,r){let i=getEncodingFromOptions(n,`utf8`),o=typeof n==`object`&&n?n:{},s=typeof t==`string`?R.from(t,i||`utf8`):t;if(typeof e==`number`||e instanceof fc){if(typeof e==`number`&&isStdFd(e)){writeStdFdSync(e,s);return}fc.getInstance(e,`write`)._writeSync(s,null);return}let c=new fc({path:normalizePath$1(e),flags:o.flag??r,mode:o.mode??438});try{c._writeSync(s,null)}finally{c._closeSync()}}function writeFileSync(e,t,n){writeWholeFile(e,t,n??null,`w`)}function renameSync(e,t){let n=normalizePath$1(e),r=normalizePath$1(t),i=J.File.new_for_path(n),o=J.File.new_for_path(r);try{i.move(o,J.FileCopyFlags.OVERWRITE,null,null)}catch(e){throw createNodeError(e,`rename`,n,r)}}function copyFileSync(e,t,n){let r=normalizePath$1(e),i=normalizePath$1(t),o=J.File.new_for_path(r),s=J.File.new_for_path(i),c=J.FileCopyFlags.NONE;n&&!(n&1)?c=J.FileCopyFlags.OVERWRITE:n||(c=J.FileCopyFlags.OVERWRITE);try{o.copy(s,c,null,null)}catch(e){throw createNodeError(e,`copyfile`,r,i)}stripPrivilegeBitsAfterCopy(s,r,i)}function stripPrivilegeBitsAfterCopy(e,t,n){try{let t=e.query_info(`unix::mode,standard::size`,J.FileQueryInfoFlags.NONE,null);if(t.get_size()===0)return;let n=t.get_attribute_uint32(`unix::mode`),r=n&-2049;if((isDarwin()||n&8)&&(r&=-1025),r===n)return;e.set_attribute_uint32(`unix::mode`,r,J.FileQueryInfoFlags.NONE,null)}catch(e){throw createNodeError(e,`copyfile`,t,n)}}function accessSync(e,t){let n=normalizePath$1(e),r=J.File.new_for_path(n);try{let e=r.query_info(`access::*`,J.FileQueryInfoFlags.NONE,null);if(t!==void 0&&t!==0){let r={code:14,message:`permission denied, access '${n}'`};if(t&4&&!e.get_attribute_boolean(`access::can-read`)||t&2&&!e.get_attribute_boolean(`access::can-write`)||t&1&&!e.get_attribute_boolean(`access::can-execute`))throw createNodeError(r,`access`,n)}}catch(e){throw e.code&&typeof e.code==`string`?e:createNodeError(e,`access`,n)}}function appendFileSync(e,t,n){writeWholeFile(e,t,n??null,`a`)}function readlinkSync(e,t){let n=normalizePath$1(e),r=J.File.new_for_path(n);try{let e=r.query_info(`standard::symlink-target`,J.FileQueryInfoFlags.NOFOLLOW_SYMLINKS,null).get_symlink_target();if(!e)throw Object.assign(Error(`EINVAL: invalid argument, readlink '${n}'`),{code:`EINVAL`,errno:-22,syscall:`readlink`,path:n});return(typeof t==`string`?t:t?.encoding)===`buffer`?R.from(e):e}catch(e){throw typeof e.code==`string`?e:createNodeError(e,`readlink`,n)}}function linkSync(e,t){let n=normalizePath$1(e),r=normalizePath$1(t);if(J.File.new_for_path(n).query_file_type(J.FileQueryInfoFlags.NOFOLLOW_SYMLINKS,null)===J.FileType.UNKNOWN)throw Object.assign(Error(`ENOENT: no such file or directory, link '${n}' -> '${r}'`),{code:`ENOENT`,errno:-2,syscall:`link`,path:n,dest:r});if(J.File.new_for_path(r).query_file_type(J.FileQueryInfoFlags.NOFOLLOW_SYMLINKS,null)!==J.FileType.UNKNOWN)throw Object.assign(Error(`EEXIST: file already exists, link '${n}' -> '${r}'`),{code:`EEXIST`,errno:-17,syscall:`link`,path:n,dest:r});let i=``;try{let[,,e,t]=z.spawn_sync(null,[`ln`,`--`,n,r],null,z.SpawnFlags.SEARCH_PATH,null);if(i=e?new TextDecoder().decode(e).trim():``,!z.spawn_check_wait_status(t))throw Error(`ln exited non-zero (${t})`);return}catch(e){throw i===``&&e instanceof Error&&(i=e.message),Object.assign(Error(`EPERM: operation not permitted, link '${n}' -> '${r}'`+(i?` (${i})`:``)),{code:`EPERM`,errno:-1,syscall:`link`,path:n,dest:r})}}function truncateSync(e,t){let n=normalizePath$1(e),r=J.File.new_for_path(n);try{let e=r.open_readwrite(null);try{e.get_output_stream().truncate(Math.max(0,t??0),null)}finally{e.close(null)}}catch(e){throw createNodeError(e,`truncate`,n)}}function chmodSync(e,t){let n=normalizePath$1(e),r=normalizeMode(t);try{J.File.new_for_path(n).set_attribute_uint32(`unix::mode`,r,J.FileQueryInfoFlags.NONE,null)}catch(e){throw createNodeError(e,`chmod`,n)}}function chownSync(e,t,n){let r=normalizePath$1(e);try{let e=J.File.new_for_path(r),i=new J.FileInfo;t!==-1&&i.set_attribute_uint32(`unix::uid`,t),n!==-1&&i.set_attribute_uint32(`unix::gid`,n),e.set_attributes_from_info(i,J.FileQueryInfoFlags.NONE,null)}catch(e){throw createNodeError(e,`chown`,r)}}function watch(e,t,n){return typeof t==`function`&&(n=t,t=void 0),new FSWatcher(normalizePath$1(e),t,n)}function openSync(e,t,n){return new fc({path:e,flags:t,mode:n})}function mkdtempSync(e,t){let n=getEncodingFromOptions(t),r=mkdtempAt(e);return n===`buffer`?R.from(r):decode(r,n)}function mkdtempAt(e){for(let t=0;t<64;t++){let t=e+randomName();if(z.mkdir(t,448)===0)return t;let n=classifyMkdirFailure(t);if(n.code!==`EEXIST`)throw n.syscall=`mkdtemp`,n}throw fsError(`EEXIST`,`mkdtemp`,e+`XXXXXX`)}function rmSync(e,t){let n=normalizePath$1(e),r=J.File.new_for_path(n),i=t?.recursive||!1,o=t?.force||!1,s;try{s=r.query_file_type(J.FileQueryInfoFlags.NOFOLLOW_SYMLINKS,null)}catch(t){if(o&&isNotFoundError(t))return;throw createNodeError(t,`rm`,e)}if(s===J.FileType.SYMBOLIC_LINK){try{r.delete(null)}catch(t){if(o&&isNotFoundError(t))return;throw createNodeError(t,`rm`,e)}return}if(s===J.FileType.DIRECTORY){let r=readdirSync(e);if(!i&&r.length)throw createNodeError(Object.assign(Error(),{code:5}),`rm`,e);for(let e of r)rmSync(ft(n,e),t)}try{r.delete(null)}catch(t){if(o&&isNotFoundError(t))return;throw createNodeError(t,`rm`,e)}}var Ws=__esmMin(()=>{Es(),gs(),_s(),bs(),Ts(),Ns(),Ps(),Vs(),Us(),pc(),je(),Wo(),Ct(),Oe(),os(),ve(),realpathSync.native=realpathSync});function makeEEXIST(e){let t=Error(`ERR_FS_CP_EEXIST: file already exists, copyfile '${e}'`);return t.code=`ERR_FS_CP_EEXIST`,t.syscall=`copyfile`,t.path=e,t}function makeEISDIR(e){let t=Error(`ERR_FS_EISDIR: illegal operation on a directory, copyfile '${e}'`);return t.code=`ERR_FS_EISDIR`,t.syscall=`copyfile`,t.path=e,t}function makeENOTDIR(e,t){let n=Error(`ENOTDIR: not a directory, copyfile '${e}' -> '${t}'`);return n.code=`ENOTDIR`,n.syscall=`copyfile`,n.path=e,n.dest=t,n}function makeSubdirOfSelf(e,t){let n=Error(`Cannot copy ${e} to a subdirectory of self ${t}`);return n.code=`ERR_FS_CP_EINVAL`,n}function queryCopyFlags(e){let t=e.force??!0,n=J.FileCopyFlags.NONE;return t&&(n|=J.FileCopyFlags.OVERWRITE),e.preserveTimestamps&&(n|=J.FileCopyFlags.TARGET_DEFAULT_MODIFIED_TIME),e.dereference||(n|=J.FileCopyFlags.NOFOLLOW_SYMLINKS),n}function copyOneSyncFile(e,t,n,r,i){let o=i.force??!0;try{if(t.query_info(`standard::type`,J.FileQueryInfoFlags.NONE,null).get_file_type()===J.FileType.DIRECTORY)throw makeENOTDIR(n,r);if(!o){if(i.errorOnExist)throw makeEEXIST(r);return}}catch(e){if(typeof e.code==`string`)throw e}let s=queryCopyFlags(i);try{e.copy(t,s,null,null)}catch(e){throw createNodeError(e,`copyfile`,n,r)}}function isStrictSubdir(e,t){let n=K(e).split(bt).filter(Boolean),r=K(t).split(bt).filter(Boolean);return r.length>n.length&&n.every((e,t)=>r[t]===e)}function cpOneDirSync(e,t,n,r,i){if(isStrictSubdir(n,r))throw makeSubdirOfSelf(n,r);if(t.query_exists(null))try{if(t.query_info(`standard::type`,J.FileQueryInfoFlags.NONE,null).get_file_type()!==J.FileType.DIRECTORY)throw makeENOTDIR(r,n)}catch(e){if(typeof e.code==`string`)throw e}else try{t.make_directory_with_parents(null)}catch(e){throw createNodeError(e,`mkdir`,r)}let o;try{o=e.enumerate_children(`standard::name,standard::type,standard::is-symlink`,i.dereference?J.FileQueryInfoFlags.NONE:J.FileQueryInfoFlags.NOFOLLOW_SYMLINKS,null)}catch(e){throw createNodeError(e,`scandir`,n)}let s=o.next_file(null);for(;s!==null;){let e=s.get_name(),t=ft(n,e),c=ft(r,e),l=i.filter;if(l&&!l(t,c)){s=o.next_file(null);continue}cpSyncInternal(t,c,i),s=o.next_file(null)}}function cpSyncInternal(e,t,n){let r=J.File.new_for_path(e),i=J.File.new_for_path(t),o;try{o=r.query_info(`standard::type,standard::is-symlink`,n.dereference?J.FileQueryInfoFlags.NONE:J.FileQueryInfoFlags.NOFOLLOW_SYMLINKS,null)}catch(t){throw createNodeError(t,`stat`,e)}if(o.get_file_type()===J.FileType.DIRECTORY){if(!n.recursive)throw makeEISDIR(e);cpOneDirSync(r,i,e,t,n)}else copyOneSyncFile(r,i,e,t,n)}function cpSync(e,t,n){let r=normalizePath$1(e),i=normalizePath$1(t),o=n??{},s=J.File.new_for_path(r),c=o.filter;if(!(c&&!c(r,i))){try{if(s.query_info(`standard::type`,o.dereference?J.FileQueryInfoFlags.NONE:J.FileQueryInfoFlags.NOFOLLOW_SYMLINKS,null).get_file_type()===J.FileType.DIRECTORY&&!o.recursive)throw makeEISDIR(r)}catch(e){throw typeof e.code==`string`?e:createNodeError(e,`stat`,r)}cpSyncInternal(r,i,o)}}function cp(e,t,n,r){let i,o;typeof n==`function`?(o=n,i={}):(o=requireCallback(r),i=n);let s=i.filter;if(s){Promise.resolve(s(normalizePath$1(e),normalizePath$1(t))).then(n=>{if(!n){o(null);return}try{cpPromises(e,t,i).then(()=>o(null)).catch(o)}catch(e){o(e)}}).catch(o);return}Promise.resolve().then(()=>{try{cpSync(e,t,i),o(null)}catch(e){o(e)}})}async function cpPromisesDir(e,t,n){if(isStrictSubdir(e,t))throw makeSubdirOfSelf(e,t);let r=J.File.new_for_path(t);if(!r.query_exists(null))try{r.make_directory_with_parents(null)}catch(e){throw createNodeError(e,`mkdir`,t)}let i=J.File.new_for_path(e),o;try{o=i.enumerate_children(`standard::name,standard::type`,n.dereference?J.FileQueryInfoFlags.NONE:J.FileQueryInfoFlags.NOFOLLOW_SYMLINKS,null)}catch(t){throw createNodeError(t,`scandir`,e)}let s=o.next_file(null);for(;s!==null;){let r=s.get_name(),i=ft(e,r),c=ft(t,r),l=n.filter;if(l&&!await Promise.resolve(l(i,c))){s=o.next_file(null);continue}await cpPromises(i,c,n),s=o.next_file(null)}}async function cpPromises(e,t,n={}){let r=normalizePath$1(e),i=normalizePath$1(t),o=J.File.new_for_path(r),s;try{s=o.query_info(`standard::type`,n.dereference?J.FileQueryInfoFlags.NONE:J.FileQueryInfoFlags.NOFOLLOW_SYMLINKS,null)}catch(e){throw createNodeError(e,`stat`,r)}if(s.get_file_type()===J.FileType.DIRECTORY){if(!n.recursive)throw makeEISDIR(r);await cpPromisesDir(r,i,n)}else copyOneSyncFile(o,J.File.new_for_path(i),r,i,n)}var Gs=__esmMin(()=>{gs(),_s(),Wo(),Ct()});function _openDir(e){let t=J.File.new_for_path(e),n;try{n=t.enumerate_children(Ks,J.FileQueryInfoFlags.NOFOLLOW_SYMLINKS,null)}catch(t){throw createNodeError(t,`opendir`,e)}return new Dir(e,n)}function opendirSync(e){return _openDir(normalizePath$1(e))}function opendir(e,t,n){let r;if(r=typeof t==`function`?t:requireCallback(n,`callback`),typeof r!=`function`)throw TypeError(`The "callback" argument must be of type function`);Promise.resolve().then(()=>{try{let t=opendirSync(e);r(null,t)}catch(e){r(e,null)}})}async function opendirAsync(e,t){return new Promise((t,n)=>{let r=normalizePath$1(e),i=J.File.new_for_path(r);i.enumerate_children_async(Ks,J.FileQueryInfoFlags.NOFOLLOW_SYMLINKS,z.PRIORITY_DEFAULT,null,Ds((e,o)=>{try{let e=i.enumerate_children_finish(o);t(new Dir(r,e))}catch(e){n(createNodeError(e,`opendir`,r))}}))})}var Ks,Dir,qs=__esmMin(()=>{gs(),_s(),Os(),Ps(),je(),Wo(),Ct(),Ks=`standard::name,standard::type,standard::is-symlink,standard::size,standard::symlink-target,unix::uid,unix::gid,unix::mode,time::modified,time::access,time::created`,Dir=class{path;_enumerator;_closed=!1;constructor(e,t){this.path=e,this._enumerator=t}_assertOpen(){if(this._closed){let e=Error(`Directory handle was closed`);throw e.code=`ERR_DIR_CLOSED`,e}}readSync(){this._assertOpen();try{let e=this._enumerator.next_file(null);if(e===null)return null;let t=e.get_name(),n=e.get_file_type();return new Dirent(ft(this.path,t),t,n,void 0,this.path)}catch(e){throw createNodeError(e,`readdir`,this.path)}}read(e){if(e!==void 0){if(typeof e!=`function`)throw TypeError(`The "callback" argument must be of type function`);try{this._assertOpen();let t=this.readSync();Promise.resolve().then(()=>e(null,t))}catch(t){Promise.resolve().then(()=>e(t,null))}return}return new Promise((e,t)=>{try{this._assertOpen(),e(this.readSync())}catch(e){t(e)}})}closeSync(){this._assertOpen(),this._closed=!0;try{this._enumerator.close(null)}catch{}this._enumerator=null}close(e){if(e!==void 0){if(typeof e!=`function`)throw TypeError(`The "callback" argument must be of type function`);try{this.closeSync(),Promise.resolve().then(()=>e(null))}catch(t){Promise.resolve().then(()=>e(t))}return}return new Promise((e,t)=>{try{this.closeSync(),e()}catch(e){t(e)}})}async*[Symbol.asyncIterator](){try{for(;;){let e=await this.read();if(e===null)break;yield e}}finally{this._closed||await this.close()}}}});function segmentToRegexSrc(e){let t=/^([!*+?@])\((.+)\)$/.exec(e);if(t){let[,e,n]=t,r=n.split(`|`).map(e=>segmentToRegexSrc(e)),i=`(?:`+r.join(`|`)+`)`;switch(e){case`!`:return`(?!(?:`+r.join(`|`)+`))[^/]*`;case`*`:return i+`*`;case`+`:return i+`+`;case`?`:return i+`?`;case`@`:return i}}let n=``,r=0;for(;r<e.length;){let t=e[r];if(t===`*`){n+=`[^/]*`,r++;continue}if(t===`?`){n+=`[^/]`,r++;continue}if(t===`[`){let t=e.indexOf(`]`,r+1);if(t===-1){n+=`\\[`,r++;continue}n+=e.slice(r,t+1),r=t+1;continue}if(t===`{`){let t=e.indexOf(`}`,r+1);if(t===-1){n+=`\\{`,r++;continue}let i=e.slice(r+1,t).split(`,`).map(e=>segmentToRegexSrc(e.trim()));n+=`(?:`+i.join(`|`)+`)`,r=t+1;continue}`.+^$|()[]{}`.includes(t)?n+=`\\`+t:n+=t,r++}return n}function globToRegex(e){e=e.replace(/\/+/g,`/`).replace(/^\.\//,``);let t=e.split(`/`),n=[];for(let e=0;e<t.length;e++){let r=t[e],i=e===t.length-1;r===`**`?i?n.length>0&&n[n.length-1]===`/`?(n.pop(),n.push(`(?:/.+)?`)):n.push(`(?:.+)?`):n.push(`(?:[^/]+/)*`):(n.push(segmentToRegexSrc(r)),i||n.push(`/`))}return RegExp(`^(?:`+n.join(``)+`)$`)}function buildExcludePredicate(e){if(!e)return null;if(typeof e==`function`)return e;let t=(Array.isArray(e)?e:[e]).map(e=>globToRegex(e));return e=>t.some(t=>t.test(e))}function matchAll(e,t,n){let r=globToRegex(e),i=buildExcludePredicate(n),o;try{o=readdirSync(t,{recursive:!0})}catch{return[]}let s=[`.`,...o],c=[];for(let e of s){let t=e.replace(/\\/g,`/`);r.test(t)&&(i&&i(t)||c.push(e))}return c}function globSync(e,t){let n=Array.isArray(e)?e:[e],r=t?.cwd?normalizePath$1(t.cwd):globalThis.process?.cwd?.()??`/`,i=t?.exclude,o=new Set,s=[];for(let e of n)for(let t of matchAll(e,r,i))o.has(t)||(o.add(t),s.push(t));return s}function glob(e,t,n){let r,i;typeof t==`function`?(i=t,r={}):(i=requireCallback(n),r=t||{}),Promise.resolve().then(()=>{try{let t=globSync(e,r);i(null,t)}catch(e){i(e,[])}})}async function*globAsync(e,t){let n=globSync(e,t);for(let e of n)yield e}var Js=__esmMin(()=>{gs(),_s(),Ws()});function buildStatFs(e){let t=Number(e.get_attribute_uint64(`filesystem::size`)??0),n=Number(e.get_attribute_uint64(`filesystem::free`)??0),r=Math.floor(t/Xs),i=Math.floor(n/Xs);return{type:0,bsize:Xs,blocks:r,bfree:i,bavail:i,files:0,ffree:0}}function buildBigIntStatFs(e){let t=BigInt(e.get_attribute_uint64(`filesystem::size`)??0),n=BigInt(e.get_attribute_uint64(`filesystem::free`)??0),r=BigInt(Xs),i=t/r,o=n/r;return{type:0n,bsize:r,blocks:i,bfree:o,bavail:o,files:0n,ffree:0n}}function statfsSync(e,t){let n=J.File.new_for_path(normalizePath$1(e)).query_filesystem_info(Ys,null);return t?.bigint===!0?buildBigIntStatFs(n):buildStatFs(n)}function queryFsInfoAsync(e,t){return new Promise((n,r)=>{let i=J.File.new_for_path(normalizePath$1(e));i.query_filesystem_info_async(Ys,z.PRIORITY_DEFAULT,null,Ds((e,o)=>{try{let e=i.query_filesystem_info_finish(o);n(t?buildBigIntStatFs(e):buildStatFs(e))}catch(e){r(e)}}))})}function statfs(e,t,n){let r=typeof t==`function`?t:requireCallback(n);queryFsInfoAsync(e,(typeof t==`function`?{}:t)?.bigint===!0).then(e=>r(null,e),e=>r(e,null))}async function statfsAsync(e,t){return queryFsInfoAsync(e,t?.bigint===!0)}var Ys,Xs,Zs=__esmMin(()=>{gs(),_s(),Os(),je(),Wo(),Ys=[`filesystem::size`,`filesystem::free`].join(`,`),Xs=4096});function openFlagDescriptors(){let e={};for(let t of Object.keys(openFlagValues()))e[t]={enumerable:!0,configurable:!0,get:()=>openFlagValues()[t]};return e}var Qs,$s=__esmMin(()=>{Ns(),Qs=Object.defineProperties({F_OK:0,R_OK:4,W_OK:2,X_OK:1,COPYFILE_EXCL:1,COPYFILE_FICLONE:2,COPYFILE_FICLONE_FORCE:4,S_IFMT:61440,S_IFREG:32768,S_IFDIR:16384,S_IFCHR:8192,S_IFBLK:24576,S_IFIFO:4096,S_IFLNK:40960,S_IFSOCK:49152,S_IRWXU:448,S_IRUSR:256,S_IWUSR:128,S_IXUSR:64,S_IRWXG:56,S_IRGRP:32,S_IWGRP:16,S_IXGRP:8,S_IRWXO:7,S_IROTH:4,S_IWOTH:2,S_IXOTH:1},openFlagDescriptors())});async function mkdir$1(e,t){return mkdirSync(normalizePath$1(e),t)}async function readFile$1(e,t={encoding:null,flag:`r`}){if(e instanceof fc||typeof e==`number`){let n=fc.getInstance(e,`read`);return encodeUint8Array(getEncodingFromOptions(t,`buffer`),n._readToEndSync())}let n=normalizePath$1(e),r=J.File.new_for_path(n),i,o;try{[i,o]=await new Promise((e,t)=>{r.load_contents_async(null,Ds((n,i)=>{try{e(r.load_contents_finish(i))}catch(e){t(e)}}))})}catch(e){throw createNodeError(e,`open`,n)}if(!i)throw createNodeError(Error(`failed to read file`),`open`,n);return encodeUint8Array(getEncodingFromOptions(t,`buffer`),o)}async function mkdtemp$1(e,t){let n=getEncodingFromOptions(t);return decode(mkdtempAt(e),n)}async function writeFile$2(e,t,n){writeFileSync(e,typeof t==`string`||t instanceof Uint8Array?t:String(t),n??null)}async function rmdir$1(e,t){let n=normalizePath$1(e),r=J.File.new_for_path(n);if((await new Promise((e,t)=>{r.query_info_async(`standard::type`,J.FileQueryInfoFlags.NONE,z.PRIORITY_DEFAULT,null,Ds((i,o)=>{try{e(r.query_info_finish(o))}catch(e){t(createNodeError(e,`rmdir`,n))}}))})).get_file_type()!==J.FileType.DIRECTORY)throw createNodeError(Object.assign(Error(),{code:4}),`rmdir`,n);if((await new Promise((e,t)=>{r.enumerate_children_async(`standard::name`,J.FileQueryInfoFlags.NONE,z.PRIORITY_DEFAULT,null,Ds((i,o)=>{try{e(r.enumerate_children_finish(o))}catch(e){t(createNodeError(e,`rmdir`,n))}}))})).next_file(null)!==null)throw createNodeError(Object.assign(Error(),{code:5}),`rmdir`,n);await new Promise((e,t)=>{r.delete_async(z.PRIORITY_DEFAULT,null,Ds((i,o)=>{try{r.delete_finish(o),e()}catch(e){t(createNodeError(e,`rmdir`,n))}}))})}async function unlink$1(e){let t=normalizePath$1(e),n=J.File.new_for_path(t);await new Promise((e,r)=>{n.delete_async(z.PRIORITY_DEFAULT,null,Ds((i,o)=>{try{n.delete_finish(o),e()}catch(e){r(createNodeError(e,`unlink`,t))}}))})}async function open$2(e,t,n){return new fc({path:e,flags:t,mode:n})}async function write$1(e,t,n,r,i){return typeof t==`string`?_writeStr(e,t,n,r):_writeBuf(e,t,n,r,i)}async function _writeBuf(e,t,n,r,i){return{bytesWritten:(await fc.getInstance(e,`write`).write(t,n,r,i)).bytesWritten,buffer:t}}async function _writeStr(e,t,n,r){return{bytesWritten:(await fc.getInstance(e,`write`).write(t,n,r)).bytesWritten,buffer:t}}function queryInfoAsync(e,t,n,r){let i=normalizePath$1(e);return new Promise((e,o)=>{let s=J.File.new_for_path(i);s.query_info_async(Hs,t,z.PRIORITY_DEFAULT,null,Ds((t,c)=>{try{e(statsFrom(s.query_info_finish(c),i,n,r?.bigint))}catch(e){o(createNodeError(e,n,i))}}))})}async function stat$1(e,t){return queryInfoAsync(e,J.FileQueryInfoFlags.NONE,`stat`,t)}async function lstat$1(e,t){return queryInfoAsync(e,J.FileQueryInfoFlags.NOFOLLOW_SYMLINKS,`lstat`,t)}async function readdir$1(e,t){try{return readdirSync(e,t)}catch(t){throw createNodeError(t,`scandir`,e)}}async function realpath$1(e){return realpathSync(e)}async function symlink$1(e,t,n){let r=normalizePath$1(t),i=normalizePath$1(e);return new Promise((e,t)=>{let n=J.File.new_for_path(r);n.make_symbolic_link_async(i,z.PRIORITY_DEFAULT,null,Ds((o,s)=>{try{n.make_symbolic_link_finish(s),e()}catch(e){t(createNodeError(e,`symlink`,i,r))}}))})}async function rm$1(e,t){let n=normalizePath$1(e),r=J.File.new_for_path(n),i=t?.recursive||!1,o=t?.force||!1,s;try{s=r.query_file_type(J.FileQueryInfoFlags.NOFOLLOW_SYMLINKS,null)}catch(t){if(o)return;throw createNodeError(t,`rm`,e)}if(s===J.FileType.SYMBOLIC_LINK){await new Promise((t,n)=>{r.delete_async(z.PRIORITY_DEFAULT,null,Ds((i,s)=>{try{r.delete_finish(s),t()}catch(r){if(o){t();return}n(createNodeError(r,`rm`,e))}}))});return}if(s===J.FileType.DIRECTORY){let r=await readdir$1(e,{withFileTypes:!0});if(!i&&r.length)throw createNodeError(Object.assign(Error(),{code:5}),`rm`,e);for(let e of r)typeof e!=`string`&&await rm$1(ft(n,e.name),t)}await new Promise((t,n)=>{r.delete_async(z.PRIORITY_DEFAULT,null,Ds((i,s)=>{try{r.delete_finish(s),t()}catch(r){if(o){t();return}n(createNodeError(r,`rm`,e))}}))})}async function rename$1(e,t){renameSync(e,t)}async function copyFile$1(e,t,n){copyFileSync(e,t,n)}async function access$1(e,t){accessSync(e,t)}async function appendFile$1(e,t,n){appendFileSync(e,t,n)}async function readlink$1(e,t){return readlinkSync(e,t)}async function truncate$1(e,t){truncateSync(e,t)}async function chmod$1(e,t){chmodSync(e,t)}async function chown$1(e,t,n){chownSync(e,t,n)}async function link$1(e,t){linkSync(e,t)}var ec,tc,nc=__esmMin(()=>{hs(),Es(),gs(),_s(),bs(),Ss(),mc(),Os(),Us(),pc(),Ws(),Gs(),qs(),Js(),Zs(),$s(),je(),Wo(),Ct(),ec=__exportAll({access:()=>access$1,appendFile:()=>appendFile$1,chmod:()=>chmod$1,chown:()=>chown$1,constants:()=>Qs,copyFile:()=>copyFile$1,cp:()=>cpPromises,default:()=>tc,fchmod:()=>fchmodAsync,fchown:()=>fchownAsync,fdatasync:()=>fdatasyncAsync,fstat:()=>fstatAsync,fsync:()=>fsyncAsync,ftruncate:()=>ftruncateAsync,futimes:()=>futimesAsync,glob:()=>globAsync,lchmod:()=>lchmodAsync,lchown:()=>lchownAsync,link:()=>link$1,lstat:()=>lstat$1,lutimes:()=>lutimesAsync,mkdir:()=>mkdir$1,mkdtemp:()=>mkdtemp$1,open:()=>open$2,openAsBlob:()=>openAsBlob,opendir:()=>opendirAsync,readFile:()=>readFile$1,readdir:()=>readdir$1,readlink:()=>readlink$1,readv:()=>readvAsync,realpath:()=>realpath$1,rename:()=>rename$1,rm:()=>rm$1,rmdir:()=>rmdir$1,stat:()=>stat$1,statfs:()=>statfsAsync,symlink:()=>symlink$1,truncate:()=>truncate$1,unlink:()=>unlink$1,utimes:()=>utimesAsync,watch:()=>watchAsync,write:()=>write$1,writeFile:()=>writeFile$2,writev:()=>writevAsync}),__name(mkdir$1,`mkdir`),__name(readFile$1,`readFile`),__name(mkdtemp$1,`mkdtemp`),__name(writeFile$2,`writeFile`),__name(rmdir$1,`rmdir`),__name(unlink$1,`unlink`),__name(open$2,`open`),__name(write$1,`write`),__name(stat$1,`stat`),__name(lstat$1,`lstat`),__name(readdir$1,`readdir`),__name(realpath$1,`realpath`),__name(symlink$1,`symlink`),__name(rm$1,`rm`),__name(rename$1,`rename`),__name(copyFile$1,`copyFile`),__name(access$1,`access`),__name(appendFile$1,`appendFile`),__name(readlink$1,`readlink`),__name(truncate$1,`truncate`),__name(chmod$1,`chmod`),__name(chown$1,`chown`),__name(link$1,`link`),tc={readFile:readFile$1,mkdir:mkdir$1,mkdtemp:mkdtemp$1,realpath:realpath$1,readdir:readdir$1,writeFile:writeFile$2,rmdir:rmdir$1,unlink:unlink$1,open:open$2,write:write$1,rm:rm$1,lstat:lstat$1,symlink:symlink$1,stat:stat$1,rename:rename$1,copyFile:copyFile$1,access:access$1,appendFile:appendFile$1,readlink:readlink$1,truncate:truncate$1,chmod:chmod$1,chown:chown$1,link:link$1,cp:cpPromises,opendir:opendirAsync,glob:globAsync,watch:watchAsync,statfs:statfsAsync,utimes:utimesAsync,lutimes:lutimesAsync,lchown:lchownAsync,lchmod:lchmodAsync,fstat:fstatAsync,ftruncate:ftruncateAsync,fdatasync:fdatasyncAsync,fsync:fsyncAsync,fchmod:fchmodAsync,fchown:fchownAsync,futimes:futimesAsync,readv:readvAsync,writev:writevAsync,openAsBlob,constants:Qs}});function withHandle(e,t,n){try{return fc.getInstance(e,t)}catch(e){return Promise.resolve().then(()=>n(e)),null}}function parseOptsCb(e,t){return typeof e==`function`?{options:{},callback:e}:{options:e??{},callback:requireCallback(t)}}function statImpl(e,t,n,r,i){let o=normalizePath$1(e),s=J.File.new_for_path(o);s.query_info_async(Hs,t,z.PRIORITY_DEFAULT,null,Ds((e,t)=>{try{i(null,statsFrom(s.query_info_finish(t),o,n,r?.bigint))}catch(e){i(createNodeError(e,n,o))}}))}function stat(e,t,n){let{options:r,callback:i}=parseOptsCb(t,n);statImpl(e,J.FileQueryInfoFlags.NONE,`stat`,r,i)}function lstat(e,t,n){let{options:r,callback:i}=parseOptsCb(t,n);statImpl(e,J.FileQueryInfoFlags.NOFOLLOW_SYMLINKS,`lstat`,r,i)}function readdir(e,t,n){let{options:r,callback:i}=parseOptsCb(t,n);Promise.resolve().then(()=>{try{i(null,readdirSync(e,r))}catch(t){i(createNodeError(t,`readdir`,e))}})}function realpath(e,t,n){let{callback:r}=parseOptsCb(t,n);Promise.resolve().then(()=>{try{r(null,realpathSync(e))}catch(e){r(e)}})}function symlink(e,t,n,r){let i=typeof n==`function`?n:requireCallback(r);if(typeof i!=`function`)throw TypeError(`Callback must be a function. Received `+typeof i);let o=normalizePath$1(t),s=normalizePath$1(e),c=J.File.new_for_path(o);c.make_symbolic_link_async(s,z.PRIORITY_DEFAULT,null,Ds((e,t)=>{try{c.make_symbolic_link_finish(t),i(null)}catch(e){i(createNodeError(e,`symlink`,s,o))}}))}function open$1(e,...t){let n,r,i;switch(t.length){case 1:i=t[0];break;case 2:n=t[0],i=t[1];break;case 3:n=t[0],r=t[1],i=t[2];break;default:break}let o=requireCallback(i);open$2(e,n,r).then(e=>{o(null,e.fd)}).catch(e=>{o(e,-1)})}function write(e,t,...n){requireCallback(n[n.length-1]);let r=withHandle(e,`write`,e=>{let r=n[n.length-1];typeof t==`string`?r(e,0,``):r(e,0,R.from([]))});if(!r)return;if(typeof t==`string`){let e=n.pop(),i=n[0],o=n[1];r.write(t,i,o).then(t=>{e(null,t.bytesWritten,t.buffer)}).catch(t=>{e(t,0,``)});return}let i=n[n.length-1],o=n[0],s=n[1],c=n[2];r.write(t,o,s,c).then(e=>{i(null,e.bytesWritten,e.buffer)}).catch(e=>{i(e,0,R.from([]))})}function read(e,...t){let n=requireCallback(t[t.length-1]),r=withHandle(e,`read`,e=>{typeof n==`function`&&n(e,0,R.from([]))});if(!r)return;let i,o,s,c;if(!(t.length<=1))if(typeof t[0]==`object`&&!ArrayBuffer.isView(t[0])){let e=t[0];i=e.buffer,o=e.offset,s=e.length,c=e.position}else i=t[0],o=t[1],s=t[2],c=t[3];r.read(i,o,s,c).then(e=>{n(null,e.bytesRead,e.buffer)}).catch(e=>{n(e,0,R.from([]))})}function close$1(e,t){let done=e=>{typeof t==`function`&&t(e)},n=withHandle(e,`close`,done);n&&n.close().then(()=>done(null)).catch(e=>done(e))}function rm(e,...t){let n={},r=t[t.length-1];t.length>=2&&(n=t[0]),rm$1(e,n).then(()=>{r(null)}).catch(e=>{r(e)})}function rename(e,t,n){requireCallback(n),Promise.resolve().then(()=>{try{renameSync(e,t),n(null)}catch(e){n(e)}})}function copyFile(e,t,n,r){let i=typeof n==`function`?0:n,o=typeof n==`function`?n:requireCallback(r);Promise.resolve().then(()=>{try{copyFileSync(e,t,i),o(null)}catch(e){o(e)}})}function access(e,t,n){let r=typeof t==`function`?void 0:t,i=typeof t==`function`?t:requireCallback(n);Promise.resolve().then(()=>{try{accessSync(e,r),i(null)}catch(e){i(e)}})}function appendFile(e,t,n,r){let i=typeof n==`function`?n:requireCallback(r),o=typeof n==`function`?void 0:n;Promise.resolve().then(()=>{try{appendFileSync(e,t,o),i(null)}catch(e){i(e)}})}function readlink(e,t,n){let r=typeof t==`function`?t:requireCallback(n),i=typeof t==`function`?void 0:t;Promise.resolve().then(()=>{try{r(null,readlinkSync(e,i))}catch(e){r(e,``)}})}function truncate(e,t,n){let r=typeof t==`function`?0:t,i=typeof t==`function`?t:requireCallback(n);Promise.resolve().then(()=>{try{truncateSync(e,r),i(null)}catch(e){i(e)}})}function chmod(e,t,n){requireCallback(n),Promise.resolve().then(()=>{try{chmodSync(e,t),n(null)}catch(e){n(e)}})}function chown(e,t,n,r){requireCallback(r),Promise.resolve().then(()=>{try{chownSync(e,t,n),r(null)}catch(e){r(e)}})}function mkdir(e,t,n){let r=typeof t==`function`?t:requireCallback(n),i=typeof t==`function`?void 0:t;Promise.resolve().then(()=>{try{mkdirSync(e,i),r(null)}catch(e){r(e)}})}function mkdtemp(e,t,n){let r=typeof t==`function`?t:requireCallback(n),i=typeof t==`function`?void 0:t;Promise.resolve().then(()=>{let t;try{t=mkdtempSync(e,i)}catch(e){r(e,void 0);return}r(null,t)})}function rmdir(e,t,n){let r=typeof t==`function`?t:requireCallback(n),i=typeof t==`function`?void 0:t;Promise.resolve().then(()=>{try{rmdirSync(e,i),r(null)}catch(e){r(e)}})}function readFile(e,t,n){let r=typeof t==`function`?t:requireCallback(n),i=typeof t==`function`?void 0:t;Promise.resolve().then(()=>{try{let t=typeof i==`string`?{encoding:i,flag:`r`}:{encoding:i?.encoding??null,flag:i?.flag??`r`};r(null,readFileSync(e,t))}catch(e){r(e,null)}})}function writeFile$1(e,t,n,r){let i=typeof n==`function`?n:requireCallback(r),o=typeof n==`function`?void 0:n;Promise.resolve().then(()=>{try{writeFileSync(e,t,o),i(null)}catch(e){i(e)}})}function link(e,t,n){requireCallback(n),Promise.resolve().then(()=>{try{linkSync(e,t),n(null)}catch(e){n(e)}})}function unlink(e,t){requireCallback(t);let n=normalizePath$1(e);Promise.resolve().then(()=>{z.unlink(n),t(null)})}var rc=__esmMin(()=>{gs(),_s(),Os(),Us(),pc(),Ws(),nc(),je(),Wo(),Oe(),realpath.native=realpath,__name(open$1,`open`),__name(close$1,`close`),__name(writeFile$1,`writeFile`)});function toPathIfFileURL(e){return normalizePath$1(e)}function createWriteStream(e,t){return new WriteStream(e,t)}var ic,ac,WriteStream,oc=__esmMin(()=>{gs(),Ns(),rc(),Za(),ic=Symbol(`kIsPerformingIO`),ac=Symbol(`kIoDone`),WriteStream=class extends qa{close(e,t=null){let done=t=>{typeof e==`function`&&e(t)};if(this.fd===null||!this._autoClose)this.fd=null,done(t);else{let e=this._fdFromHandle;close$1(this.fd,n=>{let r=e&&n?.code===`EBADF`?null:n;done(r||t)}),this.fd=null}}bytesWritten=0;path;pending;fd=null;flags=`w`;mode=438;pos=void 0;_autoClose=!0;_fdFromHandle=!1;[ic]=!1;constructor(e,t={}){super(t),this.path=toPathIfFileURL(e),t.flags!==void 0&&(this.flags=t.flags),t.mode!==void 0&&(this.mode=normalizeMode(t.mode,438)),t.start!==void 0&&(this.pos=t.start),t.encoding&&this.setDefaultEncoding(t.encoding),typeof t.fd==`number`?(this.fd=t.fd,this._autoClose=t.autoClose??!0,this._fdFromHandle=t.fdFromHandle===!0):t.autoClose!==void 0&&(this._autoClose=t.autoClose),this.pending=this.fd===null}_construct(e){if(this.fd!==null){e(),this.emit(`open`,this.fd),this.emit(`ready`);return}open$1(this.path.toString(),this.flags,this.mode,(t,n)=>{if(t){e(t);return}this.fd=n,this.pending=!1,e(),this.emit(`open`,this.fd),this.emit(`ready`)})}_write(e,t,n){this[ic]=!0,write(this.fd,e,0,e.length,this.pos??null,(e,t)=>{if(this[ic]=!1,this.destroyed)return n(e),this.emit(ac,e);if(e)return n(e);this.bytesWritten+=t,n()}),this.pos!==void 0&&(this.pos+=e.length)}_destroy(e,t){this[ic]?this.once(ac,n=>this.close(t,e||n)):this.close(t,e)}}});function createInterface(e,t,n,r){return typeof e==`object`&&e&&!(`read`in e&&typeof e.read==`function`)?new Interface(e):new Interface({input:e,output:t,completer:n,terminal:r})}function*emitKeys(e){for(;;){let t=yield,n=t,r=!1,i={sequence:``,name:void 0,ctrl:!1,meta:!1,shift:!1};if(t===`\x1B`&&(r=!0,n+=t=yield,t===`\x1B`&&(n+=t=yield)),r&&(t===`O`||t===`[`)){let e=t,r=0;if(t===`O`)n+=t=yield,t>=`0`&&t<=`9`&&(r=t.charCodeAt(0)-1,n+=t=yield),e+=t;else if(t===`[`){n+=t=yield,t===`[`&&(e+=t,n+=t=yield);let i=n.length-1;t>=`0`&&t<=`9`&&(n+=t=yield,t>=`0`&&t<=`9`&&(n+=t=yield,t>=`0`&&t<=`9`&&(n+=t=yield))),t===`;`&&(n+=t=yield,t>=`0`&&t<=`9`&&(n+=yield));let o=n.slice(i),s;(s=/^(?:(\d\d?)(?:;(\d))?([~^$])|(\d{3}~))$/.exec(o))?s[4]?e+=s[4]:(e+=s[1]+s[3],r=(parseInt(s[2]??`1`,10)||1)-1):(s=/^((\d;)?(\d))?([A-Za-z])$/.exec(o))?(e+=s[4],r=(parseInt(s[3]??`1`,10)||1)-1):e+=o}switch(i.ctrl=!!(r&4),i.meta=!!(r&10),i.shift=!!(r&1),i.code=e,e){case`[P`:case`OP`:case`[11~`:case`[[A`:i.name=`f1`;break;case`[Q`:case`OQ`:case`[12~`:case`[[B`:i.name=`f2`;break;case`[R`:case`OR`:case`[13~`:case`[[C`:i.name=`f3`;break;case`[S`:case`OS`:case`[14~`:case`[[D`:i.name=`f4`;break;case`[15~`:case`[[E`:i.name=`f5`;break;case`[17~`:i.name=`f6`;break;case`[18~`:i.name=`f7`;break;case`[19~`:i.name=`f8`;break;case`[20~`:i.name=`f9`;break;case`[21~`:i.name=`f10`;break;case`[23~`:i.name=`f11`;break;case`[24~`:i.name=`f12`;break;case`[200~`:i.name=`paste-start`;break;case`[201~`:i.name=`paste-end`;break;case`[A`:case`OA`:i.name=`up`;break;case`[B`:case`OB`:i.name=`down`;break;case`[C`:case`OC`:i.name=`right`;break;case`[D`:case`OD`:i.name=`left`;break;case`[E`:case`OE`:i.name=`clear`;break;case`[F`:case`OF`:i.name=`end`;break;case`[H`:case`OH`:i.name=`home`;break;case`[1~`:i.name=`home`;break;case`[2~`:i.name=`insert`;break;case`[3~`:i.name=`delete`;break;case`[4~`:i.name=`end`;break;case`[5~`:case`[[5~`:i.name=`pageup`;break;case`[6~`:case`[[6~`:i.name=`pagedown`;break;case`[7~`:i.name=`home`;break;case`[8~`:i.name=`end`;break;case`[a`:i.name=`up`,i.shift=!0;break;case`[b`:i.name=`down`,i.shift=!0;break;case`[c`:i.name=`right`,i.shift=!0;break;case`[d`:i.name=`left`,i.shift=!0;break;case`[2$`:i.name=`insert`,i.shift=!0;break;case`[3$`:i.name=`delete`,i.shift=!0;break;case`[5$`:i.name=`pageup`,i.shift=!0;break;case`[6$`:i.name=`pagedown`,i.shift=!0;break;case`[7$`:i.name=`home`,i.shift=!0;break;case`[8$`:i.name=`end`,i.shift=!0;break;case`Oa`:i.name=`up`,i.ctrl=!0;break;case`Ob`:i.name=`down`,i.ctrl=!0;break;case`Oc`:i.name=`right`,i.ctrl=!0;break;case`Od`:i.name=`left`,i.ctrl=!0;break;case`[2^`:i.name=`insert`,i.ctrl=!0;break;case`[3^`:i.name=`delete`,i.ctrl=!0;break;case`[5^`:i.name=`pageup`,i.ctrl=!0;break;case`[6^`:i.name=`pagedown`,i.ctrl=!0;break;case`[7^`:i.name=`home`,i.ctrl=!0;break;case`[8^`:i.name=`end`,i.ctrl=!0;break;case`[Z`:i.name=`tab`,i.shift=!0;break;default:i.name=`undefined`;break}}else t===`\r`?(i.name=`return`,i.meta=r):t===`
26
+ `}function asymmetricKeyObject(e,t,n){if(e.type===`okp-private`){let n=okpPublicFromPrivate(e.curve,e.priv);return t===`public`?asymmetricKeyObject({type:`okp-public`,curve:e.curve,pub:n},`public`):new na(`private`,{parsed:e,pem:derToPem(encodeOkpPrivateKeyInfo(e.curve,e.priv),`PRIVATE KEY`),okpPub:n})}if(e.type===`okp-public`){if(t===`private`)throw TypeError(`Key is not a private key`);return new na(`public`,{parsed:e,pem:derToPem(encodeOkpSubjectPublicKeyInfo(e.curve,e.pub),`PUBLIC KEY`),okpPub:e.pub})}if(e.type===`rsa-private`&&t===`public`){let t={n:e.components.n,e:e.components.e},n=encodeSubjectPublicKeyInfo(t);return new na(`public`,{parsed:{type:`rsa-public`,components:t},pem:derToPem(n,`PUBLIC KEY`)})}if(e.type===`rsa-public`&&t===`private`)throw TypeError(`Key is not a private key`);return new na(t,{parsed:e,pem:n??generatePem(e,t)})}function parseJwkOkp(e,t){let n=Object.keys(ta).find(t=>ta[t]===e.crv);if(!n)throw codedError(`ERR_INVALID_ARG_VALUE`,`The property 'key.crv' must be one of: 'Ed25519', 'X25519'. Received ${JSON.stringify(e.crv)}`,TypeError);let r=t===`private`?e.d:e.x;if(typeof e.x!=`string`||typeof r!=`string`)throw codedError(`ERR_CRYPTO_INVALID_JWK`,`Invalid JWK OKP key`);let i=new Uint8Array(R.from(r,`base64url`));if(i.length!==32)throw codedError(`ERR_CRYPTO_INVALID_JWK`,`Invalid JWK OKP key`);return t===`private`?{type:`okp-private`,curve:n,priv:i}:{type:`okp-public`,curve:n,pub:i}}function parseJwk(e,t){if(typeof e!=`object`||!e)throw codedError(`ERR_INVALID_ARG_TYPE`,`The "key.key" property must be of type object`,TypeError);if(e.kty===`OKP`)return{parsed:parseJwkOkp(e,t)};if(e.kty===`RSA`){if(t===`private`&&!e.d)throw Error(`JWK does not contain a private key`);return importJwkRsa(t===`private`?e:{n:e.n,e:e.e})}throw codedError(`ERR_INVALID_ARG_VALUE`,`The property 'key.kty' must be one of: 'RSA', 'EC', 'OKP'. Received ${JSON.stringify(e.kty)}`,TypeError)}function exportJwk(e,t){if(e.type===`rsa-public`)return{kty:`RSA`,n:bigintToBase64url(e.components.n),e:bigintToBase64url(e.components.e)};if(e.type===`rsa-private`){if(t===`public`)return{kty:`RSA`,n:bigintToBase64url(e.components.n),e:bigintToBase64url(e.components.e)};let{n,e:r,d:i,p:o,q:s}=e.components,c=i%(o-1n),l=i%(s-1n),u=modInverse$1(s,o);return{kty:`RSA`,n:bigintToBase64url(n),e:bigintToBase64url(r),d:bigintToBase64url(i),p:bigintToBase64url(o),q:bigintToBase64url(s),dp:bigintToBase64url(c),dq:bigintToBase64url(l),qi:bigintToBase64url(u)}}throw Error(`Unsupported key type for JWK export`)}function importJwkRsa(e){if(e.d){let t={n:base64urlToBigint(e.n),e:base64urlToBigint(e.e),d:base64urlToBigint(e.d),p:base64urlToBigint(e.p),q:base64urlToBigint(e.q)};return{parsed:{type:`rsa-private`,components:t},pem:derToPem(encodeRsaPrivateKeyPkcs1(t),`RSA PRIVATE KEY`)}}let t={n:base64urlToBigint(e.n),e:base64urlToBigint(e.e)};return{parsed:{type:`rsa-public`,components:t},pem:derToPem(encodeSubjectPublicKeyInfo(t),`PUBLIC KEY`)}}function generatePem(e,t,n){if(e.type===`rsa-public`)return n===`pkcs1`?derToPem(encodeRsaPublicKeyPkcs1(e.components),`RSA PUBLIC KEY`):derToPem(encodeSubjectPublicKeyInfo(e.components),`PUBLIC KEY`);if(e.type===`rsa-private`&&t===`public`){let t={n:e.components.n,e:e.components.e};return n===`pkcs1`?derToPem(encodeRsaPublicKeyPkcs1(t),`RSA PUBLIC KEY`):derToPem(encodeSubjectPublicKeyInfo(t),`PUBLIC KEY`)}if(e.type===`rsa-private`)return n===`pkcs8`?derToPem(encodePrivateKeyInfo(e.components),`PRIVATE KEY`):derToPem(encodeRsaPrivateKeyPkcs1(e.components),`RSA PRIVATE KEY`);throw Error(`Cannot generate PEM for this key type`)}function generateDer(e,t,n){if(e.type===`rsa-public`)return n===`pkcs1`?R.from(encodeRsaPublicKeyPkcs1(e.components)):R.from(encodeSubjectPublicKeyInfo(e.components));if(e.type===`rsa-private`&&t===`public`){let t={n:e.components.n,e:e.components.e};return n===`pkcs1`?R.from(encodeRsaPublicKeyPkcs1(t)):R.from(encodeSubjectPublicKeyInfo(t))}if(e.type===`rsa-private`)return n===`pkcs8`?R.from(encodePrivateKeyInfo(e.components)):R.from(encodeRsaPrivateKeyPkcs1(e.components));throw Error(`Cannot generate DER for this key type`)}function modInverse$1(e,t){let[n,r]=[e%t,t],[i,o]=[1n,0n];for(;r!==0n;){let e=n/r;[n,r]=[r,n-e*r],[i,o]=[o,i-e*o]}return(i%t+t)%t}function createSecretKey(e,t){let n;return n=typeof e==`string`?R.from(e,t??`utf8`):new Uint8Array(e),new na(`secret`,n)}function parseKeyInput(e,t){if(typeof e==`object`&&e&&!R.isBuffer(e)&&!(e instanceof Uint8Array)&&`key`in e){let n=e;if(n.format===`jwk`)return parseJwk(n.key,t);if(n.format===`der`){if(n.type!==`spki`&&n.type!==`pkcs8`&&n.type!==`pkcs1`)throw codedError(`ERR_INVALID_ARG_VALUE`,`The property 'key.type' is invalid. Received ${JSON.stringify(n.type)}`,TypeError);let e=typeof n.key==`string`?R.from(n.key,n.encoding??`utf8`):n.key;return{parsed:parseDerKey(new Uint8Array(e),n.type,t)}}}let n=normalizePem(e);return{parsed:parsePemKey(n),pem:n}}function createPublicKey(e){if(e instanceof na){if(e.type===`public`)return e;if(e.type===`private`)return asymmetricKeyObject(e._handle.parsed,`public`);throw TypeError(`Cannot create public key from secret key`)}if(typeof e==`object`&&e&&`key`in e&&e.key instanceof na)return createPublicKey(e.key);let{parsed:t,pem:n}=parseKeyInput(e,jwkKind(e));return asymmetricKeyObject(t,`public`,t.type===`rsa-private`||t.type===`okp-private`?void 0:n)}function jwkKind(e){return typeof e==`object`&&e&&`format`in e&&e.format===`jwk`?e.key?.d===void 0?`public`:`private`:`public`}function createPrivateKey(e){if(typeof e==`object`&&e&&`key`in e&&e.key instanceof na){if(e.key.type!==`private`)throw codedError(`ERR_CRYPTO_INVALID_KEY_OBJECT_TYPE`,`Invalid key object type ${e.key.type}, expected private.`,TypeError);return e.key}let{parsed:t,pem:n}=parseKeyInput(e,`private`);if(t.type!==`rsa-private`&&t.type!==`okp-private`)throw TypeError(`Key is not a private key`);return asymmetricKeyObject(t,`private`,n)}function toKeyObject(e,t){if(e instanceof na){if(t===`private`&&e.type!==`private`)throw codedError(`ERR_CRYPTO_INVALID_KEY_OBJECT_TYPE`,`Invalid key object type ${e.type}, expected private.`,TypeError);if(t===`public`&&e.type===`secret`)throw codedError(`ERR_CRYPTO_INVALID_KEY_OBJECT_TYPE`,`Invalid key object type secret, expected private or public.`,TypeError);return e}if(typeof e==`object`&&e&&`key`in e&&e.key instanceof na)return toKeyObject(e.key,t);if(t===`private`)return createPrivateKey(e);let n=e,{parsed:r}=parseKeyInput(n,jwkKind(n));return asymmetricKeyObject(r,r.type===`rsa-private`||r.type===`okp-private`?`private`:`public`)}function okpKeyMaterial(e){if(e.type===`secret`)return;let t=e._handle,n=t.parsed;if(n.type===`okp-private`)return{curve:n.curve,pub:t.okpPub,priv:n.priv};if(n.type===`okp-public`)return{curve:n.curve,pub:n.pub}}function okpKeyPair(e,t){let n=asymmetricKeyObject({type:`okp-private`,curve:e,priv:t},`private`);return{publicKey:createPublicKey(n),privateKey:n}}function normalizePem(e){if(typeof e==`string`)return e;if(R.isBuffer(e)||e instanceof Uint8Array)return R.from(e).toString(`utf8`);if(e&&typeof e==`object`&&`key`in e){let t=e;if(typeof t.key==`string`)return t.key;if(R.isBuffer(t.key)||t.key instanceof Uint8Array)return R.from(t.key).toString(t.encoding??`utf8`);if(t.key instanceof na)return t.key.export({format:`pem`})}throw TypeError(`Invalid key input`)}var ta,na,ra=__esmMin(()=>{Sr(),Er(),ea(),Oe(),ta={ed25519:`Ed25519`,x25519:`X25519`},na=class KeyObject{type;_handle;constructor(e,t){if(e!==`secret`&&e!==`public`&&e!==`private`)throw TypeError(`Invalid KeyObject type: ${e}`);this.type=e,this._handle=t}get symmetricKeySize(){if(this.type===`secret`)return this._handle.byteLength}get asymmetricKeyType(){if(this.type===`secret`)return;let e=this._handle;return e.parsed.type===`rsa-public`||e.parsed.type===`rsa-private`?`rsa`:e.parsed.curve}get asymmetricKeyDetails(){if(this.type===`secret`)return;let e=this._handle.parsed;return e.type===`rsa-public`||e.type===`rsa-private`?{modulusLength:rsaKeySize(e.components.n)*8,publicExponent:e.components.e}:{}}get asymmetricKeySize(){if(this.type===`secret`)return;let e=this._handle;if(e.parsed.type===`rsa-public`||e.parsed.type===`rsa-private`)return rsaKeySize(e.parsed.components.n)/8}equals(e){if(!(e instanceof KeyObject)||this.type!==e.type)return!1;if(this.type===`secret`){let t=this._handle,n=e._handle;if(t.byteLength!==n.byteLength)return!1;for(let e=0;e<t.byteLength;e++)if(t[e]!==n[e])return!1;return!0}let t=this._handle,n=e._handle;return t.pem===n.pem}export(e){if(this.type===`secret`){let t=this._handle;return e?.format===`jwk`?{kty:`oct`,k:R.from(t).toString(`base64url`)}:R.from(t)}let t=this._handle,n=e?.format??`pem`,r=e?.type;if(t.parsed.type===`okp-public`||t.parsed.type===`okp-private`)return exportOkp(t,this.type,n,r,e);if(n===`jwk`)return exportJwk(t.parsed,this.type);if(n===`pem`)return t.pem&&!t.pem.startsWith(`[`)?t.pem:generatePem(t.parsed,this.type,r);if(n===`der`){if(t.pem&&!t.pem.startsWith(`[`)){let e=t.pem.trim().split(/\r?\n/),n=e.findIndex(e=>e.startsWith(`-----BEGIN `)),r=e.findIndex((e,t)=>t>n&&e.startsWith(`-----END `)),i=e.slice(n+1,r).join(``);return R.from(i,`base64`)}return generateDer(t.parsed,this.type,r)}throw TypeError(`Unsupported export format: ${n}`)}get[Symbol.toStringTag](){return`KeyObject`}},__name(modInverse$1,`modInverse`)});function describe$1(e){return e===null?`null`:Array.isArray(e)?`an instance of Array`:typeof e}function compute(e){let t=toKeyObject(e.privateKey,`private`),n=toKeyObject(e.publicKey,`public`),r=okpKeyMaterial(t),i=okpKeyMaterial(n);if(!r||r.curve!==`x25519`){let e=t.asymmetricKeyType;throw codedError(e===`ed25519`?`ERR_OSSL_EVP_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE`:`ERR_FEATURE_UNAVAILABLE_ON_PLATFORM`,e===`ed25519`?`error:03000096:digital envelope routines::operation not supported for this keytype`:`diffieHellman() with a '${e}' key is not implemented on GJS yet (supported: 'x25519')`)}if(!i||i.curve!==r.curve)throw codedError(`ERR_OSSL_EVP_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE`,`error:03000096:digital envelope routines::operation not supported for this keytype`);let o;try{o=x25519SharedSecret(r.priv,i.pub)}catch{throw codedError(`ERR_OSSL_FAILED_DURING_DERIVATION`,`Deriving bits failed`)}return R.from(o)}function diffieHellman(e,t){if(typeof e!=`object`||!e||Array.isArray(e))throw codedError(`ERR_INVALID_ARG_TYPE`,`The "options" argument must be of type object. Received ${describe$1(e)}`,TypeError);if(t===void 0)return compute(e);if(typeof t!=`function`)throw codedError(`ERR_INVALID_ARG_TYPE`,`The "callback" argument must be of type function. Received ${describe$1(t)}`,TypeError);let n;try{n=compute(e)}catch(e){setTimeout(()=>t(e),0);return}setTimeout(()=>t(null,n),0)}var ia=__esmMin(()=>{Er(),ea(),ra(),Oe(),__name(describe$1,`describe`)});function fillRandom(e){fillRandomBytes(e)}function randomBytes(e,t){if(typeof e!=`number`||e<0||!Number.isInteger(e))throw TypeError(`The "size" argument must be a non-negative integer. Received ${e}`);try{let n=R.alloc(e);if(e>0&&fillRandom(new Uint8Array(n.buffer,n.byteOffset,n.byteLength)),t)t(null,n);else return n}catch(e){if(t)t(e,R.alloc(0));else throw e}}function randomFillSync(e,t=0,n){let r=n??e.length-t;if(t<0||t>e.length)throw RangeError(`The value of "offset" is out of range. Received ${t}`);if(r<0||t+r>e.length)throw RangeError(`The value of "size" is out of range. Received ${r}`);if(r>0){let n=(e instanceof R,e.byteOffset);fillRandom(new Uint8Array(e.buffer,n+t,r))}return e}function randomFill(e,t,n,r){let i,o,s;typeof t==`function`?(s=t,i=0,o=e.length):typeof n==`function`?(s=n,i=t,o=e.length-t):(s=r,i=t,o=n);try{randomFillSync(e,i,o),s(null,e)}catch(t){s(t,e)}}function randomUUID(){if(typeof globalThis.crypto?.randomUUID==`function`)return globalThis.crypto.randomUUID();let e=new Uint8Array(16);fillRandom(e),e[6]=e[6]&15|64,e[8]=e[8]&63|128;let t=Array.from(e,e=>e.toString(16).padStart(2,`0`)).join(``);return`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16,20)}-${t.slice(20)}`}function randomInt(e,t,n){let r,i,o;if(typeof t==`function`?(o=t,i=e,r=0):typeof t==`number`?(r=e,i=t,o=n):(i=e,r=0,o=n),!Number.isInteger(r))throw TypeError(`The "min" argument must be a safe integer. Received ${r}`);if(!Number.isInteger(i))throw TypeError(`The "max" argument must be a safe integer. Received ${i}`);if(r>=i)throw RangeError(`The value of "min" must be less than "max". Received min: ${r}, max: ${i}`);let s=i-r,c=new Uint32Array(1);fillRandom(new Uint8Array(c.buffer));let l=r+c[0]%s;if(o)o(null,l);else return l}var aa=__esmMin(()=>{Oe(),Zi()});function modPow(e,t,n){if(n===1n)return 0n;e=(e%n+n)%n;let r=1n;for(;t>0n;)t&1n&&(r=r*e%n),t>>=1n,e=e*e%n;return r}function bigIntToBytes(e,t){let n=new Uint8Array(t),r=e;for(let e=t-1;e>=0;e--)n[e]=Number(r&255n),r>>=8n;return n}function bytesToBigInt(e){let t=0n;for(let n=0;n<e.length;n++)t=t<<8n|BigInt(e[n]);return t}var oa=__esmMin(()=>{});function bigIntToBuffer(e){if(e===0n)return R.from([0]);let t=e.toString(16);return t.length%2!=0&&(t=`0`+t),R.from(t,`hex`)}function bufferToBigInt(e){if(e.length===0)return 0n;let t=R.from(e).toString(`hex`);return t.length===0?0n:BigInt(`0x`+t)}function bitLength(e){return e===0n?0:e.toString(2).length}function simpleSieve(e){for(let t of ca){let n=BigInt(t);if(e%n===0n)return e===n}return!0}function fermatTest(e){return modPow(2n,e-1n,e)===1n}function millerRabinTest(e){if(e<2n)return!1;if(e===2n||e===3n)return!0;if(e%2n==0n)return!1;let t=e-1n,n=0;for(;t%2n==0n;)t/=2n,n++;for(let r of[2n,3n,5n,7n,11n,13n]){if(r>=e)continue;let i=modPow(r,t,e);if(i===1n||i===e-1n)continue;let o=!0;for(let t=0;t<n-1;t++)if(i=modPow(i,2n,e),i===e-1n){o=!1;break}if(o)return!1}return!0}function checkPrime(e,t){let n=t.toString(`hex`),r=0;if(e%2n==0n||!simpleSieve(e)||!fermatTest(e)||!millerRabinTest(e))return r+=1,n===`02`||n===`05`?r+=8:r+=4,r;switch(millerRabinTest(e>>1n)||(r+=2),n){case`02`:e%24n!=11n&&(r+=8);break;case`05`:{let t=e%10n;t!==3n&&t!==7n&&(r+=8)}break;default:r+=4}return r}function getCachedCheckPrime(e,t){let n=t.toString(`hex`)+`_`+e.toString(16);if(n in la)return la[n];let r=checkPrime(e,t);return la[n]=r,r}function formatReturnValue$1(e,t){let n=bigIntToBuffer(e);return t?n.toString(t):n}function generatePrime(e,t){let n=bufferToBigInt(t);if(e<16)return n===2n||n===5n?R.from([140,123]):R.from([140,39]);let r=Math.ceil(e/8),i=2n,o=4n;for(;;){let t=bufferToBigInt(randomBytes(r));for(;bitLength(t)>e;)t>>=1n;if(t%i==0n&&(t+=1n),t&i||(t+=i),n===i)for(;t%24n!=11n;)t+=o;else if(n===5n)for(;t%10n!=3n;)t+=o;let s=t>>1n;if(simpleSieve(s)&&simpleSieve(t)&&fermatTest(s)&&fermatTest(t)&&millerRabinTest(s)&&millerRabinTest(t))return bigIntToBuffer(t)}}function createDiffieHellman(e,t,n,r){if(t!==void 0&&typeof t!=`number`&&(R.isBuffer(t)||t instanceof Uint8Array||typeof t==`string`&&!(t in ua)))return createDiffieHellman(e,`binary`,t,n);let i=t||`binary`,o=r||`binary`,s=R.from([2]);if(n!==void 0&&(typeof n==`number`?(s=R.alloc(1),s[0]=n):s=R.isBuffer(n)?n:R.from(n,o)),typeof e==`number`)return new DiffieHellman(generatePrime(e,s),s,!0);let c;return c=R.isBuffer(e)?e:e instanceof Uint8Array?R.from(e):R.from(e,i),new DiffieHellman(c,s,!0)}function getDiffieHellman(e){let t=sa[e];if(!t)throw Error(`Unknown group: ${e}. Supported groups: ${Object.keys(sa).join(`, `)}`);return new DiffieHellman(R.from(t.prime,`hex`),R.from(t.gen,`hex`),!1)}var sa,ca,la,DiffieHellman,ua,da,fa,pa=__esmMin(()=>{oa(),aa(),Oe(),sa={modp1:{gen:`02`,prime:`ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a63a3620ffffffffffffffff`},modp2:{gen:`02`,prime:`ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece65381ffffffffffffffff`},modp5:{gen:`02`,prime:`ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca237327ffffffffffffffff`},modp14:{gen:`02`,prime:`ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aacaa68ffffffffffffffff`},modp15:{gen:`02`,prime:`ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a93ad2caffffffffffffffff`},modp16:{gen:`02`,prime:`ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c934063199ffffffffffffffff`},modp17:{gen:`02`,prime:`ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dcc4024ffffffffffffffff`},modp18:{gen:`02`,prime:`ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dbe115974a3926f12fee5e438777cb6a932df8cd8bec4d073b931ba3bc832b68d9dd300741fa7bf8afc47ed2576f6936ba424663aab639c5ae4f5683423b4742bf1c978238f16cbe39d652de3fdb8befc848ad922222e04a4037c0713eb57a81a23f0c73473fc646cea306b4bcbc8862f8385ddfa9d4b7fa2c087e879683303ed5bdd3a062b3cf5b3a278a66d2a13f83f44f82ddf310ee074ab6a364597e899a0255dc164f31cc50846851df9ab48195ded7ea1b1d510bd7ee74d73faf36bc31ecfa268359046f4eb879f924009438b481c6cd7889a002ed5ee382bc9190da6fc026e479558e4475677e9aa9e3050e2765694dfc81f56e880b96e7160c980dd98edd3dfffffffffffffffff`}},ca=[];{let e=1e3,t=new Uint8Array(1001);for(let n=2;n*n<=e;n++)if(!t[n])for(let r=n*n;r<=e;r+=n)t[r]=1;for(let n=2;n<=e;n++)t[n]||ca.push(n)}la={},__name(formatReturnValue$1,`formatReturnValue`),DiffieHellman=class{_prime;_generator;_generatorBuf;_primeByteLength;_pubKey;_privKey;_primeCode;_malleable;constructor(e,t,n=!1){this._prime=bufferToBigInt(e),this._generatorBuf=t,this._generator=bufferToBigInt(t),this._primeByteLength=e.length,this._pubKey=void 0,this._privKey=void 0,this._primeCode=void 0,this._malleable=n,n||(this._primeCode=0,this.setPublicKey=void 0,this.setPrivateKey=void 0)}get verifyError(){return typeof this._primeCode!=`number`&&(this._primeCode=getCachedCheckPrime(this._prime,this._generatorBuf)),this._primeCode}generateKeys(e){if(!this._privKey){let e=randomBytes(this._primeByteLength);this._privKey=bufferToBigInt(e)}return this._pubKey=modPow(this._generator,this._privKey,this._prime),this.getPublicKey(e)}computeSecret(e,t,n){let r;r=typeof e==`string`?R.from(e,t||`utf8`):R.from(e);let i=bufferToBigInt(r);if(!this._privKey)throw Error(`You must generate keys before computing a secret`);if(i<=0n||i>=this._prime)throw Error(`Supplied key is too large`);let o=bigIntToBuffer(modPow(i,this._privKey,this._prime)),s=this._primeByteLength;if(o.length<s){let e=R.alloc(s);o.copy(e,s-o.length),o=e}return n?o.toString(n):o}getPrime(e){return formatReturnValue$1(this._prime,e)}getGenerator(e){return formatReturnValue$1(this._generator,e)}getPublicKey(e){if(!this._pubKey)throw Error(`No public key - call generateKeys() first`);return formatReturnValue$1(this._pubKey,e)}getPrivateKey(e){if(!this._privKey)throw Error(`No private key - call generateKeys() first`);return formatReturnValue$1(this._privKey,e)}setPublicKey(e,t){if(!this._malleable)throw Error(`setPublicKey is not available for predefined DH groups`);let n=typeof e==`string`?R.from(e,t||`utf8`):R.from(e);this._pubKey=bufferToBigInt(n)}setPrivateKey(e,t){if(!this._malleable)throw Error(`setPrivateKey is not available for predefined DH groups`);let n=typeof e==`string`?R.from(e,t||`utf8`):R.from(e);this._privKey=bufferToBigInt(n)}},ua={binary:!0,hex:!0,base64:!0,latin1:!0,utf8:!0,"utf-8":!0,base64url:!0,ascii:!0,ucs2:!0,"ucs-2":!0,utf16le:!0,"utf-16le":!0},da=getDiffieHellman,fa=getDiffieHellman});function mod(e,t){let n=e%t;return n<0n?n+t:n}function modInverse(e,t){if(e=mod(e,t),e===0n)throw Error(`No modular inverse for zero`);let[n,r]=[e,t],[i,o]=[1n,0n];for(;r!==0n;){let e=n/r;[n,r]=[r,n-e*r],[i,o]=[o,i-e*o]}if(n!==1n)throw Error(`Modular inverse does not exist`);return mod(i,t)}function pointAdd(e,t,n){if(e===null)return t;if(t===null)return e;let{p:r}=n;if(e.x===t.x)return mod(e.y+t.y,r)===0n?null:pointDouble(e,n);let i=mod(t.x-e.x,r),o=mod(mod(t.y-e.y,r)*modInverse(i,r),r),s=mod(o*o-e.x-t.x,r);return{x:s,y:mod(o*(e.x-s)-e.y,r)}}function pointDouble(e,t){if(e===null)return null;let{a:n,p:r}=t;if(e.y===0n)return null;let i=mod(mod(3n*e.x*e.x+n,r)*modInverse(mod(2n*e.y,r),r),r),o=mod(i*i-2n*e.x,r);return{x:o,y:mod(i*(e.x-o)-e.y,r)}}function scalarMul(e,t,n){if(t===null||e===0n)return null;let{n:r}=n;if(e=mod(e,r),e===0n)return null;let i=null,o=t,s=e.toString(2);for(let e=0;e<s.length;e++)s[e]===`1`?(i=pointAdd(i,o,n),o=pointDouble(o,n)):(o=pointAdd(i,o,n),i=pointDouble(i,n));return i}function bigintToBuffer(e,t){let n=e.toString(16).padStart(t*2,`0`);return R.from(n,`hex`)}function bufferToBigint(e){let t=R.from(e).toString(`hex`);return t.length===0?0n:BigInt(`0x`+t)}function encodePublicKey(e,t,n=`uncompressed`){if(e===null)throw Error(`Cannot encode the point at infinity`);let r=bigintToBuffer(e.x,t);if(n===`compressed`){let t=e.y%2n==0n?2:3;return R.concat([R.from([t]),r])}let i=bigintToBuffer(e.y,t);if(n===`hybrid`){let t=e.y%2n==0n?6:7;return R.concat([R.from([t]),r,i])}return R.concat([R.from([4]),r,i])}function decodePublicKey(e,t){let n=R.from(e);if(n.length===0)throw Error(`Invalid public key: empty buffer`);let r=n[0],{p:i,a:o,b:s,byteLength:c}=t;if(r===4||r===6||r===7){if(n.length!==1+2*c)throw Error(`Invalid public key length: expected ${1+2*c} bytes, got ${n.length}`);let e=bufferToBigint(n.subarray(1,1+c)),t=bufferToBigint(n.subarray(1+c));if(mod(t*t,i)!==mod(e*e*e+o*e+s,i))throw Error(`Invalid public key: point is not on the curve`);return{x:e,y:t}}if(r===2||r===3){if(n.length!==1+c)throw Error(`Invalid public key length: expected ${1+c} bytes, got ${n.length}`);let e=bufferToBigint(n.subarray(1,1+c)),t=sqrtMod(mod(e*e*e+o*e+s,i),i);if(t===null)throw Error(`Invalid public key: no valid y coordinate for the given x`);let l=r===3;return{x:e,y:t%2n!=0n===l?t:mod(i-t,i)}}throw Error(`Invalid public key prefix: 0x${r.toString(16).padStart(2,`0`)}`)}function sqrtMod(e,t){if(e=mod(e,t),e===0n)return 0n;if(modPow(e,(t-1n)/2n,t)!==1n)return null;if(mod(t,4n)===3n)return modPow(e,(t+1n)/4n,t);let n=0n,r=t-1n;for(;mod(r,2n)===0n;)r/=2n,n++;let i=2n;for(;modPow(i,(t-1n)/2n,t)!==t-1n;)i++;let o=n,s=modPow(i,r,t),c=modPow(e,r,t),l=modPow(e,(r+1n)/2n,t);for(;;){if(c===0n)return 0n;if(c===1n)return l;let e=1n,n=mod(c*c,t);for(;n!==1n;)n=mod(n*n,t),e++;let r=modPow(s,modPow(2n,o-e-1n,t-1n),t);o=e,s=mod(r*r,t),c=mod(c*s,t),l=mod(l*r,t)}}function toBuffer(e,t){if(R.isBuffer(e))return e;if(e instanceof Uint8Array)return R.from(e);if(typeof e==`string`)return R.from(e,t||`utf8`);if(ArrayBuffer.isView(e))return R.from(e.buffer,e.byteOffset,e.byteLength);throw TypeError(`The "key" argument must be of type string or an instance of Buffer, TypedArray, or DataView.`)}function formatReturnValue(e,t){return t?e.toString(t):e}function resolveCurve(e){let t=e.toLowerCase(),n=ha[t];if(!n)throw Error(`Unsupported curve: ${e}`);let r=ma[n];if(!r)throw Error(`Unsupported curve: ${e}`);return{canonical:n,params:r}}function createECDH(e){return new ECDH(e)}function getCurves(){return[`secp256k1`,`prime256v1`,`secp256r1`,`secp384r1`,`secp521r1`]}var ma,ha,ECDH,ga=__esmMin(()=>{oa(),aa(),Oe(),ma={secp256k1:{p:115792089237316195423570985008687907853269984665640564039457584007908834671663n,a:0n,b:7n,Gx:55066263022277343669578718895168534326250603453777594175500187360389116729240n,Gy:32670510020758816978083085130507043184471273380659243275938904335757337482424n,n:115792089237316195423570985008687907852837564279074904382605163141518161494337n,byteLength:32},prime256v1:{p:115792089210356248762697446949407573530086143415290314195533631308867097853951n,a:115792089210356248762697446949407573530086143415290314195533631308867097853951n-3n,b:41058363725152142129326129780047268409114441015993725554835256314039467401291n,Gx:48439561293906451759052585252797914202762949526041747995844080717082404635286n,Gy:36134250956749795798585127919587881956611106672985015071877198253568414405109n,n:115792089210356248762697446949407573529996955224135760342422259061068512044369n,byteLength:32},secp384r1:{p:39402006196394479212279040100143613805079739270465446667948293404245721771496870329047266088258938001861606973112319n,a:39402006196394479212279040100143613805079739270465446667948293404245721771496870329047266088258938001861606973112319n-3n,b:27580193559959705877849011840389048093056905856361568521428707301988689241309860865136260764883745107765439761230575n,Gx:26247035095799689268623156744566981891852923491109213387815615900925518854738050089022388053975719786650872476732087n,Gy:8325710961489029985546751289520108179287853048861315594709205902480503199884419224438643760392947333078086511627871n,n:39402006196394479212279040100143613805079739270465446667946905279627659399113263569398956308152294913554433653942643n,byteLength:48},secp521r1:{p:6864797660130609714981900799081393217269435300143305409394463459185543183397656052122559640661454554977296311391480858037121987999716643812574028291115057151n,a:6864797660130609714981900799081393217269435300143305409394463459185543183397656052122559640661454554977296311391480858037121987999716643812574028291115057151n-3n,b:1093849038073734274511112390766805569936207598951683748994586394495953116150735016013708737573759623248592132296706313309438452531591012912142327488478985984n,Gx:2661740802050217063228768716723360960729859168756973147706671368418802944996427808491545080627771902352094241225065558662157113545570916814161637315895999846n,Gy:3757180025770020463545507224491183603594455134769762486694567779615544477440556316691234405012945539562144444537289428522585666729196580810124344277578376784n,n:6864797660130609714981900799081393217269435300143305409394463459185543183397655394245057746333217197532963996371363321113864768612440380340372808892707005449n,byteLength:66}},ha={secp256k1:`secp256k1`,prime256v1:`prime256v1`,secp256r1:`prime256v1`,"p-256":`prime256v1`,p256:`prime256v1`,secp384r1:`secp384r1`,"p-384":`secp384r1`,p384:`secp384r1`,secp521r1:`secp521r1`,"p-521":`secp521r1`,p521:`secp521r1`},ECDH=class{_curve;_curveName;_privateKey=null;_publicKey=null;constructor(e){let t=resolveCurve(e);this._curve=t.params,this._curveName=t.canonical}generateKeys(e,t){let{n,byteLength:r}=this._curve,i;do i=bufferToBigint(randomBytes(r));while(i===0n||i>=n);this._privateKey=i;let o={x:this._curve.Gx,y:this._curve.Gy};return this._publicKey=scalarMul(i,o,this._curve),e===void 0?this.getPublicKey():this.getPublicKey(e,t)}computeSecret(e,t,n){if(this._privateKey===null)throw Error(`ECDH key not generated. Call generateKeys() or setPrivateKey() first.`);let r=decodePublicKey(toBuffer(e,t),this._curve);if(r===null)throw Error(`Invalid public key: point at infinity`);let i=scalarMul(this._privateKey,r,this._curve);if(i===null)throw Error(`Shared secret computation resulted in the point at infinity`);return formatReturnValue(bigintToBuffer(i.x,this._curve.byteLength),n)}getPublicKey(e,t){if(this._publicKey===null)throw Error(`ECDH key not generated. Call generateKeys() or setPrivateKey() first.`);return formatReturnValue(encodePublicKey(this._publicKey,this._curve.byteLength,t||`uncompressed`),e)}getPrivateKey(e){if(this._privateKey===null)throw Error(`ECDH key not generated. Call generateKeys() or setPrivateKey() first.`);return formatReturnValue(bigintToBuffer(this._privateKey,this._curve.byteLength),e)}setPublicKey(e,t){let n=toBuffer(e,t);this._publicKey=decodePublicKey(n,this._curve)}setPrivateKey(e,t){let n=bufferToBigint(toBuffer(e,t));if(n===0n||n>=this._curve.n)throw Error(`Private key is out of range [1, n-1]`);this._privateKey=n;let r={x:this._curve.Gx,y:this._curve.Gy};this._publicKey=scalarMul(n,r,this._curve)}}}),_a=__esmMin(()=>{ve()}),va,ya,ba=__esmMin(()=>{va=Object.defineProperty,ya=__name((e,t)=>{let n={};for(var r in e)va(n,r,{get:e[r],enumerable:!0});return t||va(n,Symbol.toStringTag,{value:`Module`}),n},`__exportAll`)});function _setPipeImpl(e){xa=e}var xa,Stream_,Sa=__esmMin(()=>{Ke(),Stream_=class extends Ge{constructor(e){super(e)}pipe(e,t){return xa(this,e,t)}}});function finished$1(e,t,n){let r;r=typeof t==`function`?t:n;let i=!1;function done(e){i||(i=!0,r(e))}let onFinish=()=>done(),onEnd=()=>done(),onError=e=>done(e),onClose=()=>{let t=e,n=e;!t.writableFinished&&!n.readableEnded&&done(Error(`premature close`))};e.on(`finish`,onFinish),e.on(`end`,onEnd),e.on(`error`,onError),e.on(`close`,onClose);let o=e,s=typeof e.write==`function`,c=typeof e.read==`function`,l=o.writableFinished===!0,u=o.readableEnded===!0;if(o.destroyed===!0){let e=o._err;ee(e?()=>done(e):s&&l||c&&u?()=>done():()=>done(Error(`premature close`)))}else(s&&!c&&l||!s&&c&&u||s&&c&&l&&u)&&ee(()=>done());return function cleanup(){e.removeListener(`finish`,onFinish),e.removeListener(`end`,onEnd),e.removeListener(`error`,onError),e.removeListener(`close`,onClose)}}function addAbortSignal(e,t){if(!(e instanceof AbortSignal))throw TypeError(`The first argument must be an AbortSignal`);if(!(t instanceof Stream_))throw TypeError(`The second argument must be a Stream`);let n=t;if(e.aborted)n.destroy(Error(`The operation was aborted`));else{let onAbort=()=>{n.destroy(Error(`The operation was aborted`))};e.addEventListener(`abort`,onAbort,{once:!0}),t.once(`close`,()=>{e.removeEventListener(`abort`,onAbort)})}return t}function isReadable(e){if(e==null)return!1;let t=e;return typeof t.readable!=`boolean`||typeof t.read!=`function`||t.destroyed===!0||t.readableEnded===!0?!1:t.readable===!0}function isWritable(e){if(e==null)return!1;let t=e;return typeof t.writable!=`boolean`||typeof t.write!=`function`||t.destroyed===!0||t.writableEnded===!0?!1:t.writable===!0}function isDestroyed(e){return e==null?!1:e.destroyed===!0}function isDisturbed(e){if(e==null)return!1;let t=e;return t.readableDidRead===!0||t.readableFlowing!==null&&t.readableFlowing!==void 0}function isErrored(e){if(e==null)return!1;let t=e;return t.destroyed===!0&&typeof t.readable==`boolean`&&t.readable===!1||t.destroyed===!0&&typeof t.writable==`boolean`&&t.writable===!1}var Ca=__esmMin(()=>{Sa(),ve(),__name(finished$1,`finished`)});function getDefaultHighWaterMark(e){return e?Ta:wa}function setDefaultHighWaterMark(e,t){if(typeof t!=`number`||t<0||Number.isNaN(t))throw TypeError(`Invalid highWaterMark: ${t}`);e?Ta=t:wa=t}function validateHighWaterMark(e,t){if(t!==void 0&&(typeof t!=`number`||Number.isNaN(t))){let n=TypeError(`The value of "${e}" is invalid. Received ${t}`);throw n.code=`ERR_INVALID_ARG_VALUE`,n}}var wa,Ta,Ea=__esmMin(()=>{wa=16384,Ta=16});function createAbortError(){let e=Error(`The operation was aborted`);return e.name=`AbortError`,e.code=`ABORT_ERR`,e}async function streamAsyncDispose(e,t){let n;e.destroyed||(n=t?void 0:createAbortError(),e.destroy(n)),await new Promise((t,r)=>{finished$1(e,e=>{e&&e!==n?r(e):t()})})}var Da,Oa=__esmMin(()=>{Ca(),Da=Symbol.asyncDispose??Symbol.for(`Symbol.asyncDispose`)});function chunkLength(e){if(e==null)return 1;let t=e.length;return typeof t==`number`?t:1}function sliceChunk(e,t,n){if(typeof e==`string`)return n===void 0?e.slice(t):e.slice(t,n);let r=e.slice;return typeof r==`function`?r.call(e,t,n):e}var ka,Aa,ja,Ma=__esmMin(()=>{Sa(),Oa(),Ea(),ve(),ka=class Readable_ extends Stream_{readable=!0;readableFlowing=null;readableLength=0;readableHighWaterMark;readableEncoding;readableObjectMode;readableEnded=!1;readableAborted=!1;destroyed=!1;_pipeDests=[];_buffer=[];_readableState={ended:!1,endEmitted:!1,reading:!1,constructed:!0,highWaterMark:0,objectMode:!1,pipes:[]};_err;_readablePending=!1;_readImpl;_constructImpl;constructor(e){super(e),this.readableHighWaterMark=e?.highWaterMark??getDefaultHighWaterMark(e?.objectMode??!1),this.readableEncoding=e?.encoding??null,this.readableObjectMode=e?.objectMode??!1,this._readableState.highWaterMark=this.readableHighWaterMark,this._readableState.objectMode=this.readableObjectMode,e?.read&&(this._readImpl=e.read),e?.destroy&&(this._destroy=e.destroy),e?.construct&&(this._constructImpl=e.construct),(this._constructImpl||this._construct!==Readable_.prototype._construct)&&(this._readableState.constructed=!1,nextTick(()=>{this._construct(e=>{this._readableState.constructed=!0,e?this.destroy(e):this.readableFlowing===!0&&this._flow()})}))}_construct(e){this._constructImpl?this._constructImpl.call(this,e):e()}_read(e){this._readImpl&&this._readImpl.call(this,e)}read(e){if(!this._readableState.constructed)return null;if(this._buffer.length===0){if(this._readableState.ended)return null;this._readableState.reading=!0,this._read(e??this.readableHighWaterMark),this._readableState.reading=!1}if(this._buffer.length===0||e===0)return null;if(this.readableObjectMode){if(e===void 0){let e=this._buffer.shift();return--this.readableLength,this._readableState.ended&&this._buffer.length===0&&!this._readableState.endEmitted&&this._emitEnd(),e}if(e>this.readableLength)return null;let t=this._buffer.shift();return--this.readableLength,t}if(e!=null)return e>this.readableLength?null:this._readBytes(e);let t=this._buffer.splice(0);if(this.readableLength=0,this._readableState.ended&&this._buffer.length===0&&!this._readableState.endEmitted&&this._emitEnd(),t.length===1)return t[0];if(t.length===0)return null;if(typeof t[0]==`string`)return t.join(``);let n=globalThis.Buffer;return n?.concat?n.concat(t):t}_readBytes(e){let t=0,n=[];for(;t<e&&this._buffer.length>0;){let r=this._buffer[0],i=chunkLength(r);if(t+i<=e)n.push(this._buffer.shift()),t+=i,this.readableLength-=i;else{let i=e-t;n.push(sliceChunk(r,0,i)),this._buffer[0]=sliceChunk(r,i),this.readableLength-=i,t+=i}}if(n.length===1)return n[0];let r=globalThis.Buffer;return r?.concat?r.concat(n):n}push(e,t){if(e===null)return this._readableState.ended=!0,this.readableEnded=!0,this._buffer.length===0&&!this._readableState.endEmitted&&nextTick(()=>this._emitEnd()),this._scheduleReadable(),!1;if(!this.readableObjectMode&&!(typeof e==`string`||ArrayBuffer.isView(e))){let t=Object.assign(TypeError(`Invalid non-string/buffer chunk type: ${typeof e}`),{code:`ERR_INVALID_ARG_TYPE`});return nextTick(()=>this.emit(`error`,t)),!1}return this._buffer.push(e),this.readableLength+=this.readableObjectMode?1:chunkLength(e),this.readableFlowing&&!this._flowing&&nextTick(()=>this._flow()),this.readableFlowing!==!0&&this._scheduleReadable(),this.readableLength<this.readableHighWaterMark}_emitEnd(){this._readableState.endEmitted||(this._readableState.endEmitted=!0,this.emit(`end`),nextTick(()=>this._autoClose()))}_autoClose(){this.emit(`close`)}_scheduleReadable(){this._readablePending||this.listenerCount(`readable`)===0||(this._readablePending=!0,nextTick(()=>{this._readablePending=!1,this.destroyed||this.emit(`readable`)}))}on(e,t){return super.on(e,t),e===`data`&&this.readableFlowing!==!1&&this.listenerCount(`readable`)===0&&this.resume(),e===`readable`&&(this.readableFlowing=!1,this._buffer.length>0||this._readableState.ended?this._scheduleReadable():this._readableState.reading||nextTick(()=>{this.destroyed||this.read(0)})),this}removeListener(e,t){let n=super.removeListener(e,t);return e===`readable`&&nextTick(()=>this._updateReadableListening()),n}removeAllListeners(e){let t=e===void 0?super.removeAllListeners():super.removeAllListeners(e);return(e===`readable`||e===void 0)&&nextTick(()=>this._updateReadableListening()),t}_updateReadableListening(){this.listenerCount(`readable`)>0||(this.listenerCount(`data`)>0?this.resume():this.readableFlowing=null)}unshift(e){this._buffer.unshift(e),this.readableLength+=this.readableObjectMode?1:chunkLength(e)}setEncoding(e){return this.readableEncoding=e,this}pause(){return this.readableFlowing=!1,this.emit(`pause`),this}resume(){return this.readableFlowing!==!0&&(this.readableFlowing=!0,this.emit(`resume`),this._readableState.constructed&&this._flow()),this}_flowing=!1;_flow(){if(!(this.readableFlowing!==!0||this._flowing||this.destroyed)&&this._readableState.constructed){this._flowing=!0;try{for(;this._buffer.length>0&&this.readableFlowing&&!this.destroyed;){let e=this._buffer.shift();if(this.readableLength-=this.readableObjectMode?1:chunkLength(e),this.readableEncoding&&typeof e!=`string`){let t=globalThis.Buffer;t?.isBuffer&&t.isBuffer(e)?e=e.toString(this.readableEncoding):e instanceof Uint8Array&&(e=new TextDecoder(this.readableEncoding).decode(e))}this.emit(`data`,e)}if(this.destroyed)return;if(this._readableState.ended&&this._buffer.length===0&&!this._readableState.endEmitted){nextTick(()=>this._emitEnd());return}!this._readableState.ended&&!this._readableState.reading&&!this.destroyed&&(this._readableState.reading=!0,this._read(this.readableHighWaterMark),this._readableState.reading=!1)}finally{this._flowing=!1}this._buffer.length>0&&this.readableFlowing&&!this.destroyed&&nextTick(()=>this._flow())}}isPaused(){return this.readableFlowing===!1}unpipe(e){if(e){let t=this._pipeDests.findIndex(t=>t.dest===e);if(t!==-1){this._pipeDests[t].cleanup(),this._pipeDests.splice(t,1);let n=this._readableState.pipes.indexOf(e);n!==-1&&this._readableState.pipes.splice(n,1),e.emit(`unpipe`,this),this._pipeDests.length===0&&(this.readableFlowing=!1)}}else{for(let e of this._pipeDests)e.cleanup(),e.dest.emit(`unpipe`,this);this._pipeDests=[],this._readableState.pipes=[],this.readableFlowing=!1}return this}_destroy(e,t){t(e??void 0)}destroy(e){if(this.destroyed)return this;this.destroyed=!0,this.readable=!1,this.readableAborted=!this.readableEnded,e&&(this._err=e);let t=!1,cb=e=>{t||(t=!0,e&&nextTick(()=>this.emit(`error`,e)),nextTick(()=>this.emit(`close`)))};try{this._destroy(e??null,cb)}catch(e){cb(e)}return this}static toWeb(e){return new ReadableStream({start(t){e.on(`data`,e=>{typeof e==`string`?t.enqueue(new TextEncoder().encode(e)):e instanceof Uint8Array?t.enqueue(e):e&&typeof e.length==`number`&&t.enqueue(new Uint8Array(e))}),e.on(`end`,()=>{t.close()}),e.on(`error`,e=>{t.error(e)})},cancel(){e.destroy()}})}static fromWeb(e,t){let n=e.getReader();return new Readable_({...t,read(){n.read().then(({done:e,value:t})=>{e?this.push(null):this.push(t)},e=>{this.destroy(e)})},destroy(e,t){n.cancel(e?.message).then(()=>t(null),t)}})}[Symbol.asyncIterator](){let e=this,t=[],n=!1,r=null,i=null,o=null;return e.on(`data`,e=>{if(i){let t=i;i=null,o=null,t({value:e,done:!1})}else t.push(e)}),e.on(`end`,()=>{if(n=!0,i){let e=i;i=null,o=null,e({value:void 0,done:!0})}}),e.on(`error`,e=>{if(r=e,n=!0,o){let t=o;i=null,o=null,t(e)}}),{next(){return r?Promise.reject(r):t.length>0?Promise.resolve({value:t.shift(),done:!1}):n?Promise.resolve({value:void 0,done:!0}):new Promise((e,t)=>{i=e,o=t})},return(){return e.destroy(),Promise.resolve({value:void 0,done:!0})},[Symbol.asyncIterator](){return this}}}static from(e,t){let n=new Readable_({objectMode:!0,...t,read(){}});return typeof e==`string`||ArrayBuffer.isView(e)?(n.push(e),n.push(null),n):((async()=>{try{for await(let t of e)n.push(t)||await new Promise(e=>n.once(`drain`,e));n.push(null)}catch(e){n.destroy(e)}})(),n)}},ka.prototype[Da]=function(){return streamAsyncDispose(this,this.readableEnded)},Aa=Object.getOwnPropertyDescriptor(ka.prototype,`on`),ja=Object.getOwnPropertyDescriptor(ka.prototype,`removeListener`),Object.defineProperty(ka.prototype,"addListener",{...Aa}),Object.defineProperty(ka.prototype,"off",{...ja})});function writeAfterEndError(){let e=Error(`write after end`);return e.code=`ERR_STREAM_WRITE_AFTER_END`,e}var Na=__esmMin(()=>{});function chunkLen$1(e){if(e==null)return 1;let t=e.length;return typeof t==`number`?t:1}var Duplex_,Pa=__esmMin(()=>{Na(),Ea(),Ma(),ve(),Duplex_=class extends ka{writable=!0;writableHighWaterMark;writableLength=0;writableObjectMode;writableEnded=!1;writableFinished=!1;writableCorked=0;writableNeedDrain=!1;allowHalfOpen;_decodeStrings;_writableState={highWaterMark:0,objectMode:!1};_duplexCorkedBuffer=[];_duplexWriting=!1;_duplexWriteQueue=[];_writeImpl;_finalImpl;_defaultEncoding=`utf8`;_pendingWrites=0;_pendingEndCb=null;_autoClosed=!1;constructor(e){super(e),validateHighWaterMark(`writableHighWaterMark`,e?.writableHighWaterMark),validateHighWaterMark(`readableHighWaterMark`,e?.readableHighWaterMark),this.writableObjectMode=e?.writableObjectMode??e?.objectMode??!1,this.writableHighWaterMark=e?.highWaterMark??e?.writableHighWaterMark??getDefaultHighWaterMark(this.writableObjectMode),this._writableState.highWaterMark=this.writableHighWaterMark,this._writableState.objectMode=this.writableObjectMode,e?.highWaterMark===void 0&&e?.readableHighWaterMark!==void 0&&(this.readableHighWaterMark=e.readableHighWaterMark,this._readableState.highWaterMark=e.readableHighWaterMark),e?.readableObjectMode!==void 0&&(this.readableObjectMode=e.readableObjectMode,this._readableState.objectMode=e.readableObjectMode,e?.readableHighWaterMark===void 0&&e?.highWaterMark===void 0&&(this.readableHighWaterMark=getDefaultHighWaterMark(e.readableObjectMode),this._readableState.highWaterMark=this.readableHighWaterMark)),this.allowHalfOpen=e?.allowHalfOpen!==!1,this._decodeStrings=e?.decodeStrings!==!1,e?.write&&(this._writeImpl=e.write),e?.final&&(this._finalImpl=e.final),this.allowHalfOpen||this.once(`end`,()=>{this.writableEnded||nextTick(()=>this.end())})}_write(e,t,n){this._writeImpl?this._writeImpl.call(this,e,t,n):n()}_final(e){this._finalImpl?this._finalImpl.call(this,e):e()}destroy(e){return this.destroyed?this:(this.writable=!1,super.destroy(e))}write(e,t,n){let r,i;if(typeof t==`function`?(r=t,i=this._defaultEncoding):(i=t??this._defaultEncoding,r=n??(()=>{})),this._decodeStrings&&!this.writableObjectMode&&typeof e==`string`){let t=globalThis.Buffer;t&&(e=t.from(e,i),i=`buffer`)}if(typeof e!=`string`&&!this.writableObjectMode){let t=globalThis.Buffer;(t&&t.isBuffer(e)||e instanceof Uint8Array)&&(i=`buffer`)}if(this.writableEnded){let e=writeAfterEndError();return nextTick(()=>{r(e),this.emit(`error`,e),this.destroy()}),!1}if(this.writableLength+=this.writableObjectMode?1:chunkLen$1(e),this.writableCorked>0)return this._duplexCorkedBuffer.push({chunk:e,encoding:i,callback:r}),this.writableLength<this.writableHighWaterMark;let o=this.writableLength<this.writableHighWaterMark;return o||(this.writableNeedDrain=!0),this._duplexDoWrite(e,i,r),o}_duplexDoWrite(e,t,n){if(this._duplexWriting){this._duplexWriteQueue.push({chunk:e,encoding:t,callback:n});return}this._duplexWriting=!0,this._duplexStartWrite(e,t,n)}_duplexStartWrite(e,t,n){this._pendingWrites++,this._write(e,t,t=>{this._pendingWrites--,this.writableLength-=this.writableObjectMode?1:chunkLen$1(e),nextTick(t?()=>{if(n(t),this._duplexWriting=!1,this.destroyed||this.emit(`error`,t),this._duplexWriteQueue.length>0){let e=this._duplexWriteQueue.shift();this._duplexWriting=!0,this._duplexStartWrite(e.chunk,e.encoding,e.callback)}}:()=>{if(n(),this._duplexWriteQueue.length>0){let e=this._duplexWriteQueue.shift();this._duplexStartWrite(e.chunk,e.encoding,e.callback);return}if(this._duplexWriting=!1,this.writableNeedDrain&&this.writableLength<=this.writableHighWaterMark&&(this.writableNeedDrain=!1,this.emit(`drain`)),this._pendingWrites===0&&this._pendingEndCb){let e=this._pendingEndCb;this._pendingEndCb=null,e()}})})}end(e,t,n){typeof e==`function`&&(n=e,e=void 0),typeof t==`function`&&(n=t,t=void 0),e!=null&&this.write(e,t),this.writableEnded=!0;let doFinal=()=>{this._final(e=>{this.writableFinished=!0,this._doPrefinishHooks(()=>{nextTick(()=>{e&&this.emit(`error`,e),this.emit(`finish`),nextTick(()=>this._closeAfterFinish()),n&&n()})})})};return this._pendingWrites>0||this._duplexWriting||this._duplexWriteQueue.length>0?this._pendingEndCb=doFinal:doFinal(),this}_closeAfterFinish(){this._autoClosed||!this.destroyed&&!this._readableState.endEmitted&&this.readable||(this._autoClosed=!0,this.emit(`close`))}_autoClose(){this._autoClosed||(this._autoClosed=!0,this.emit(`close`))}_doPrefinishHooks(e){e()}cork(){this.writableCorked++}uncork(){if(this.writableCorked>0&&(this.writableCorked--,this.writableCorked===0&&this._duplexCorkedBuffer.length>0)){let e=this._duplexCorkedBuffer.splice(0);for(let{chunk:t,encoding:n,callback:r}of e)this._write(t,n,e=>{this.writableLength-=this.writableObjectMode?1:chunkLen$1(t),e?(r(e),this.destroyed||this.emit(`error`,e)):r()});this.writableNeedDrain&&this.writableLength<=this.writableHighWaterMark&&(this.writableNeedDrain=!1,nextTick(()=>this.emit(`drain`)))}}setDefaultEncoding(e){return this._defaultEncoding=e,this}},__name(chunkLen$1,`chunkLen`)});function pipe(e,t,n){let r=e,i=n?.end!==!1,o=!1,ondrain=()=>{o=!1,t.removeListener(`drain`,ondrain);let e=r;typeof e.resume==`function`&&e.resume()},ondata=e=>{if(t.writable){let n=r;t.write(e)===!1&&typeof n.pause==`function`&&(n.pause(),o||(o=!0,t.on(`drain`,ondrain)))}};r.on(`data`,ondata);let s=!1,onend=()=>{s||(s=!0,i&&t.end())},onclose=()=>{if(!s&&(s=!0,i&&!(r instanceof ka))){let e=t;typeof e.destroy==`function`&&e.destroy()}};i&&(r.on(`end`,onend),r.on(`close`,onclose));let cleanup=()=>{r.removeListener(`data`,ondata),o&&t.removeListener(`drain`,ondrain),r.removeListener(`end`,onend),r.removeListener(`close`,onclose),r.removeListener(`end`,cleanup),r.removeListener(`close`,cleanup),t.removeListener(`close`,cleanup)};return r.on(`end`,cleanup),r.on(`close`,cleanup),t.on(`close`,cleanup),r instanceof ka&&(r._pipeDests.push({dest:t,cleanup}),r._readableState.pipes.push(t)),t.emit(`pipe`,r),t}var Fa=__esmMin(()=>{Sa(),Ma(),_setPipeImpl(pipe)});function chunkLen(e){if(e==null)return 1;let t=e.length;return typeof t==`number`?t:1}var Ia,La=__esmMin(()=>{Na(),Sa(),Oa(),Ea(),ve(),Ia=class Writable_ extends Stream_{static[Symbol.hasInstance](e){let t=this;return t.prototype!==void 0&&Object.prototype.isPrototypeOf.call(t.prototype,e)?!0:t.prototype!==Writable_.prototype||e==null?!1:typeof e.writableHighWaterMark==`number`}writable=!0;writableHighWaterMark;writableLength=0;writableObjectMode;writableEnded=!1;writableFinished=!1;writableCorked=0;writableNeedDrain=!1;destroyed=!1;_err;_writableState={ended:!1,finished:!1,constructed:!0,writing:!1};_corkedBuffer=[];_writeBuffer=[];_pendingConstruct=[];_ending=!1;_endCallback;_pendingEnd=null;_writeImpl;_writev;_finalImpl;_constructImpl;_decodeStrings;_defaultEncoding=`utf8`;_autoDestroy;constructor(e){super(e),this.writableHighWaterMark=e?.highWaterMark??getDefaultHighWaterMark(e?.objectMode??!1),this.writableObjectMode=e?.objectMode??!1,this._decodeStrings=e?.decodeStrings!==!1,this._autoDestroy=e?.autoDestroy!==!1,e?.write&&(this._writeImpl=e.write),e?.writev&&(this._writev=e.writev),e?.final&&(this._finalImpl=e.final),e?.destroy&&(this._destroy=e.destroy),e?.construct&&(this._constructImpl=e.construct),(this._constructImpl||this._construct!==Writable_.prototype._construct)&&(this._writableState.constructed=!1,nextTick(()=>{this._construct(e=>{this._writableState.constructed=!0,e?this.destroy(e):this._maybeFlush()})}))}_construct(e){this._constructImpl?this._constructImpl.call(this,e):e()}_write(e,t,n){this._writeImpl?this._writeImpl.call(this,e,t,n):n()}_final(e){this._finalImpl?this._finalImpl.call(this,e):e()}_destroy(e,t){t(e)}_maybeFlush(){let e=this._pendingConstruct.splice(0);if(e.length>0){let[t,...n]=e;this._writeBuffer.push(...n),this._doWrite(t.chunk,t.encoding,t.callback)}if(this._pendingEnd){let{chunk:e,encoding:t,callback:n}=this._pendingEnd;this._pendingEnd=null,this._doEnd(e,t,n)}}_doWrite(e,t,n){this._writableState.writing=!0;let r=!0;this._write(e,t,t=>{if(this.writableLength-=this.writableObjectMode?1:chunkLen(e),r){nextTick(()=>{if(t){n(t),this.emit(`error`,t);return}n(),this.writableNeedDrain&&this.writableLength<=this.writableHighWaterMark&&(this.writableNeedDrain=!1,this.emit(`drain`))}),t||this._drainWriteBuffer();return}nextTick(t?()=>{n(t),this.emit(`error`,t),this._drainWriteBuffer()}:()=>{n(),this.writableNeedDrain&&this.writableLength<=this.writableHighWaterMark&&(this.writableNeedDrain=!1,this.emit(`drain`)),this._drainWriteBuffer()})}),r=!1}_drainWriteBuffer(){if(this._writeBuffer.length>0){let e=this._writeBuffer.shift();this._doWrite(e.chunk,e.encoding,e.callback)}else this._writableState.writing=!1,this._maybeFinish()}_maybeFinish(){!this._ending||this._writableState.finished||this._writableState.writing||this._writeBuffer.length>0||(this._ending=!1,this._final(e=>{this.writableFinished=!0,this._writableState.finished=!0,nextTick(()=>{e&&this.emit(`error`,e),this.emit(`finish`),this._autoDestroy?this.destroy():nextTick(()=>this.emit(`close`)),this._endCallback&&this._endCallback()})}))}write(e,t,n){let r,i;if(typeof t==`function`?(r=t,i=this._defaultEncoding):(i=t??this._defaultEncoding,r=n??(()=>{})),this._decodeStrings&&!this.writableObjectMode&&typeof e==`string`){let t=globalThis.Buffer;t&&(e=t.from(e,i),i=`buffer`)}if(typeof e!=`string`&&!this.writableObjectMode){let t=globalThis.Buffer;(t&&t.isBuffer(e)||e instanceof Uint8Array)&&(i=`buffer`)}if(this.writableEnded){let e=writeAfterEndError();return nextTick(()=>{r(e),this.emit(`error`,e)}),!1}if(this.writableLength+=this.writableObjectMode?1:chunkLen(e),this.writableCorked>0)return this._corkedBuffer.push({chunk:e,encoding:i,callback:r}),this.writableLength<this.writableHighWaterMark;if(!this._writableState.constructed)return this._pendingConstruct.push({chunk:e,encoding:i,callback:r}),this.writableLength<this.writableHighWaterMark;let o=this.writableLength<this.writableHighWaterMark;return o||(this.writableNeedDrain=!0),this._writableState.writing?this._writeBuffer.push({chunk:e,encoding:i,callback:r}):this._doWrite(e,i,r),o}_doEnd(e,t,n){e!=null&&this.write(e,t),this.writableEnded=!0,this._writableState.ended=!0,this._ending=!0,this._endCallback=n,this._maybeFinish()}end(e,t,n){return typeof e==`function`&&(n=e,e=void 0),typeof t==`function`&&(n=t,t=void 0),this.writableEnded?(n&&nextTick(n),this):this._writableState.constructed?(this._doEnd(e,t,n),this):(this._pendingEnd={chunk:e,encoding:t,callback:n},this)}cork(){this.writableCorked++}uncork(){this.writableCorked>0&&(this.writableCorked--,this.writableCorked===0&&this._corkedBuffer.length>0&&this._flushCorkedBuffer())}_flushCorkedBuffer(){if(this._writev&&this._corkedBuffer.length>1){let e=this._corkedBuffer.splice(0),t=e.map(e=>({chunk:e.chunk,encoding:e.encoding}));this._writev.call(this,t,t=>{for(let t of e)this.writableLength-=this.writableObjectMode?1:chunkLen(t.chunk);if(t){for(let n of e)n.callback(t);this.emit(`error`,t)}else{for(let t of e)t.callback();this.writableNeedDrain&&this.writableLength<=this.writableHighWaterMark&&(this.writableNeedDrain=!1,this.emit(`drain`))}})}else{let e=this._corkedBuffer.splice(0);if(e.length>0){let[t,...n]=e;this._writeBuffer.push(...n),this._doWrite(t.chunk,t.encoding,t.callback)}}}setDefaultEncoding(e){return this._defaultEncoding=e,this}destroy(e){if(this.destroyed)return this;this.destroyed=!0,this.writable=!1,e&&(this._err=e);let t=!1,cb=e=>{t||(t=!0,e&&nextTick(()=>this.emit(`error`,e)),nextTick(()=>this.emit(`close`)))};try{this._destroy(e??null,cb)}catch(e){cb(e)}return this}},Ia.prototype[Da]=function(){return streamAsyncDispose(this,this.writableFinished)}}),Ra,za=__esmMin(()=>{Pa(),ve(),Ra=class Transform_ extends Duplex_{constructor(e){super({...e,write:void 0,final:void 0});let t=this;e?.transform&&(t._transform=e.transform),e?.flush&&(t._flush=e.flush),e?.final&&(t._final=e.final)}_transform(e,t,n){throw Object.assign(Error(`The _transform() method is not implemented`),{code:`ERR_METHOD_NOT_IMPLEMENTED`})}_flush(e){e()}_write(e,t,n){let r=!1;try{this._transform(e,t,(e,t)=>{if(r){let e=Object.assign(Error(`Callback called multiple times`),{code:`ERR_MULTIPLE_CALLBACK`});nextTick(()=>this.emit(`error`,e));return}if(r=!0,e){n(e);return}t!=null&&this.push(t),n()})}catch(e){if(e?.code===`ERR_METHOD_NOT_IMPLEMENTED`)throw e;n(e)}}_final(e){this._flush((t,n)=>{if(t){e(t);return}n!=null&&this.push(n),this.push(null),e()})}_doPrefinishHooks(e){let t=Transform_.prototype._final;this._final===t?e():t.call(this,e)}}}),PassThrough_,Ba=__esmMin(()=>{za(),PassThrough_=class extends Ra{constructor(e){super({...e,transform(e,t,n){n(null,e)}})}}});function pipeline$1(...e){let t=e,n=typeof t[t.length-1]==`function`?t.pop():void 0,r=t;if(r.length<2)throw Error(`pipeline requires at least 2 streams`);let i=null;function onError(e){if(!i){i=e;for(let e of r)typeof e.destroy==`function`&&e.destroy();n&&n(e)}}let o=r[0];for(let e=1;e<r.length;e++){let t=r[e];o.pipe(t),o.on(`error`,onError),o=t}let s=r[r.length-1];return s.on(`error`,onError),s.on(`finish`,()=>{n&&!i&&n(null)}),s}var Va=__esmMin(()=>{__name(pipeline$1,`pipeline`)});function pipeline(...e){return new Promise((t,n)=>{let cb=e=>{e?n(e):t()};pipeline$1(...e,cb)})}function finished(e,t){return new Promise((n,r)=>{t&&typeof t!=`function`?finished$1(e,t,e=>{e?r(e):n()}):finished$1(e,e=>{e?r(e):n()})})}var Ha,Ua,Wa=__esmMin(()=>{ba(),Ca(),Va(),Ha=ya({default:()=>Ua,finished:()=>finished,pipeline:()=>pipeline}),Ua={pipeline,finished}}),Ga,Ka,qa,Ja,Ya,Xa,Za=__esmMin(()=>{_a(),Sa(),Ca(),Ea(),Ma(),Pa(),Fa(),La(),za(),Ba(),Va(),Wa(),Ga=makeCallable(Stream_),Ka=makeCallable(ka),qa=makeCallable(Ia),Ja=makeCallable(Duplex_),Ya=makeCallable(Ra),Xa=makeCallable(PassThrough_),Object.assign(Ga,{Stream:Ga,Readable:Ka,Writable:qa,Duplex:Ja,Transform:Ya,PassThrough:Xa,pipeline:pipeline$1,finished:finished$1,addAbortSignal,isReadable,isWritable,isDestroyed,isDisturbed,isErrored,getDefaultHighWaterMark,setDefaultHighWaterMark,promises:Ha})});function getChecksumType(e){let t=normalizeAlgorithm(e),n=Qa[t];if(n===void 0){let t=Error(`Unknown message digest: ${e}`);throw t.code=`ERR_CRYPTO_HASH_UNKNOWN`,t}return n}function getHashes(){return[`md5`,`sha1`,`sha256`,`sha384`,`sha512`]}function hash(e,t,n){return new $a(e).update(t).digest(n)}var Qa,$a,eo=__esmMin(()=>{Er(),Oe(),je(),Za(),Qa={md5:z.ChecksumType.MD5,sha1:z.ChecksumType.SHA1,sha256:z.ChecksumType.SHA256,sha384:z.ChecksumType.SHA384,sha512:z.ChecksumType.SHA512},$a=class Hash extends Ya{_algorithm;_checksum;_finalized=!1;constructor(e){super();let t=normalizeAlgorithm(e),n=getChecksumType(t);this._algorithm=t,this._checksum=new z.Checksum(n)}update(e,t){if(this._finalized)throw Error(`Digest already called`);let n;if(typeof e==`string`){let r=normalizeEncoding(t);n=R.from(e,r)}else n=e instanceof Uint8Array?e:R.from(e);return this._checksum.update(n),this}digest(e){if(this._finalized)throw Error(`Digest already called`);this._finalized=!0;let t=this._checksum.get_string(),n=R.from(t,`hex`);return e?n.toString(e):n}copy(){if(this._finalized)throw Error(`Digest already called`);let e=Object.create(Hash.prototype);return Ya.call(e),e._algorithm=this._algorithm,e._finalized=!1,e._checksum=this._checksum.copy(),e}_transform(e,t,n){try{this.update(e,t),n()}catch(e){n(e)}}_flush(e){try{this.push(this.digest()),e()}catch(t){e(t)}}}}),Hmac,to=__esmMin(()=>{Er(),eo(),Oe(),Za(),Hmac=class extends Ya{_algorithm;_innerHash;_outerKeyPad;_finalized=!1;constructor(e,t){super();let n=normalizeAlgorithm(e);if(!Tr.has(n)){let t=Error(`Unknown message digest: ${e}`);throw t.code=`ERR_CRYPTO_HASH_UNKNOWN`,t}this._algorithm=n;let r;r=typeof t==`string`?R.from(t,`utf8`):t instanceof Uint8Array?t:R.from(t);let i=wr[n];if(r.length>i){let e=new $a(n);e.update(r),r=e.digest()}let o=new Uint8Array(i);o.set(r);let s=new Uint8Array(i),c=new Uint8Array(i);for(let e=0;e<i;e++)s[e]=o[e]^54,c[e]=o[e]^92;this._outerKeyPad=c,this._innerHash=new $a(n),this._innerHash.update(s)}update(e,t){if(this._finalized)throw Error(`Digest already called`);let n;if(typeof e==`string`){let r=normalizeEncoding(t);n=R.from(e,r)}else n=e instanceof Uint8Array?e:R.from(e);return this._innerHash.update(n),this}digest(e){if(this._finalized)throw Error(`Digest already called`);this._finalized=!0;let t=this._innerHash.digest(),n=new $a(this._algorithm);n.update(this._outerKeyPad),n.update(t);let r=n.digest();return e?r.toString(e):r}_transform(e,t,n){try{this.update(e,t),n()}catch(e){n(e)}}_flush(e){try{this.push(this.digest()),e()}catch(t){e(t)}}}});function getCurve(e){let t=ha[e.toLowerCase()];if(!t)throw Error(`Unsupported curve: ${e}`);return ma[t]}function truncateHash(e,t){let n=t.n.toString(2).length,r=bytesToBigInt(e),i=e.length*8;return i>n&&(r>>=BigInt(i-n)),r}function hmacDigest$2(e,t,n){let r=new Hmac(e,t);return r.update(n),new Uint8Array(r.digest())}function rfc6979(e,t,n,r){let i=r.byteLength,o=n.length,s=new Uint8Array(o).fill(1),c=new Uint8Array(o).fill(0),l=bigIntToBytes(t,i),u=bigIntToBytes(mod(truncateHash(n,r),r.n),i),d=new Uint8Array(o+1+i+i);d.set(s,0),d[o]=0,d.set(l,o+1),d.set(u,o+1+i),c=hmacDigest$2(e,c,d),s=hmacDigest$2(e,c,s);let f=new Uint8Array(o+1+i+i);f.set(s,0),f[o]=1,f.set(l,o+1),f.set(u,o+1+i),c=hmacDigest$2(e,c,f),s=hmacDigest$2(e,c,s);for(let t=0;t<100;t++){let t=new Uint8Array;for(;t.length<i;){s=hmacDigest$2(e,c,s);let n=new Uint8Array(t.length+s.length);n.set(t,0),n.set(s,t.length),t=n}let n=truncateHash(t.slice(0,i),r);if(n>=1n&&n<r.n)return n;let l=new Uint8Array(o+1);l.set(s,0),l[o]=0,c=hmacDigest$2(e,c,l),s=hmacDigest$2(e,c,s)}throw Error(`RFC 6979: failed to generate valid k after 100 attempts`)}function ecdsaSign(e,t,n,r){let i=getCurve(r),o={x:i.Gx,y:i.Gy},s=bytesToBigInt(t),c=new $a(e);c.update(n);let l=new Uint8Array(c.digest()),u=truncateHash(l,i),d=rfc6979(e,s,l,i),f=scalarMul(d,o,i);if(f===null)throw Error(`ECDSA: k * G is point at infinity`);let p=mod(f.x,i.n);if(p===0n)throw Error(`ECDSA: r is zero`);let m=mod(modInverse(d,i.n)*(u+p*s),i.n);if(m===0n)throw Error(`ECDSA: s is zero`);let h=i.byteLength,g=new Uint8Array(h*2);return g.set(bigIntToBytes(p,h),0),g.set(bigIntToBytes(m,h),h),g}function ecdsaVerify(e,t,n,r,i){let o=getCurve(i),s={x:o.Gx,y:o.Gy},c=o.byteLength;if(t[0]!==4||t.length!==1+c*2)return!1;let l={x:bytesToBigInt(t.slice(1,1+c)),y:bytesToBigInt(t.slice(1+c))};if(n.length!==c*2)return!1;let u=bytesToBigInt(n.slice(0,c)),d=bytesToBigInt(n.slice(c));if(u<1n||u>=o.n||d<1n||d>=o.n)return!1;let f=new $a(e);f.update(r);let p=truncateHash(new Uint8Array(f.digest()),o),m=modInverse(d,o.n),h=mod(p*m,o.n),g=mod(u*m,o.n),_=pointAdd(scalarMul(h,s,o),scalarMul(g,l,o),o);return _===null?!1:mod(_.x,o.n)===u}var no=__esmMin(()=>{oa(),ga(),eo(),to(),__name(hmacDigest$2,`hmacDigest`)});function hmacDigest$1(e,t,n){let r=new Hmac(e,t);return r.update(n),r.digest()}function hkdfExtract(e,t,n){return hmacDigest$1(e,n,t)}function hkdfExpand(e,t,n,r,i){let o=Math.ceil(r/i);if(o>255)throw Error(`HKDF cannot generate more than 255 * HashLen bytes`);let s=R.allocUnsafe(o*i),c=R.alloc(0);for(let r=1;r<=o;r++)c=hmacDigest$1(e,t,R.concat([c,n,R.from([r])])),c.copy(s,(r-1)*i);return R.from(s.buffer,s.byteOffset,r)}function hkdfSync(e,t,n,r,i){let o=normalizeAlgorithm(e),s=Cr[o];if(!Tr.has(o)||s===void 0)throw TypeError(`Unknown message digest: ${e}`);if(typeof i!=`number`||i<0)throw TypeError(`keylen must be a non-negative number`);let c=toBuffer$1(t),l=toBuffer$1(n),u=toBuffer$1(r),d=hkdfExpand(o,hkdfExtract(o,c,l.length===0?R.alloc(s,0):l),u,i,s),f=new ArrayBuffer(d.length);return new Uint8Array(f).set(d),f}function hkdf(e,t,n,r,i,o){setTimeout(()=>{try{o(null,hkdfSync(e,t,n,r,i))}catch(e){o(e instanceof Error?e:Error(String(e)))}},0)}var ro=__esmMin(()=>{Er(),to(),Oe(),__name(hmacDigest$1,`hmacDigest`)});function hmacDigest(e,t,n){let r=new Hmac(e,t);return r.update(n),r.digest()}function validateParameters(e,t){if(typeof e!=`number`||e<0||!Number.isFinite(e)||e===0)throw TypeError(`iterations must be a positive number`);if(typeof t!=`number`||t<0||!Number.isFinite(t)||t>2147483647)throw TypeError(`keylen must be a positive number`)}function pbkdf2Sync(e,t,n,r,i){validateParameters(n,r);let o=toBuffer$1(e),s=toBuffer$1(t),c=normalizeAlgorithm(i||`sha1`),l=Cr[c];if(!Tr.has(c)||l===void 0)throw TypeError(`Unknown message digest: ${i||`sha1`}`);if(r===0)return R.alloc(0);let u=Math.ceil(r/l),d=R.allocUnsafe(u*l);for(let e=1;e<=u;e++){let t=R.allocUnsafe(s.length+4);s.copy(t,0),t.writeUInt32BE(e,s.length);let r=hmacDigest(c,o,t),i=R.from(r);for(let e=1;e<n;e++){r=hmacDigest(c,o,r);for(let e=0;e<l;e++)i[e]^=r[e]}i.copy(d,(e-1)*l)}return R.from(d.buffer,d.byteOffset,r)}function pbkdf2(e,t,n,r,i,o){validateParameters(n,r),setTimeout(()=>{try{o(null,pbkdf2Sync(e,t,n,r,i))}catch(e){o(e instanceof Error?e:Error(String(e)))}},0)}var io=__esmMin(()=>{Er(),to(),Oe()});function R$1(e,t){return(e<<t|e>>>32-t)>>>0}function salsa20_8(e){let t=new Uint32Array(16);for(let n=0;n<16;n++)t[n]=e[n];for(let e=0;e<4;e++)t[4]^=R$1(t[0]+t[12],7),t[8]^=R$1(t[4]+t[0],9),t[12]^=R$1(t[8]+t[4],13),t[0]^=R$1(t[12]+t[8],18),t[9]^=R$1(t[5]+t[1],7),t[13]^=R$1(t[9]+t[5],9),t[1]^=R$1(t[13]+t[9],13),t[5]^=R$1(t[1]+t[13],18),t[14]^=R$1(t[10]+t[6],7),t[2]^=R$1(t[14]+t[10],9),t[6]^=R$1(t[2]+t[14],13),t[10]^=R$1(t[6]+t[2],18),t[3]^=R$1(t[15]+t[11],7),t[7]^=R$1(t[3]+t[15],9),t[11]^=R$1(t[7]+t[3],13),t[15]^=R$1(t[11]+t[7],18),t[1]^=R$1(t[0]+t[3],7),t[2]^=R$1(t[1]+t[0],9),t[3]^=R$1(t[2]+t[1],13),t[0]^=R$1(t[3]+t[2],18),t[6]^=R$1(t[5]+t[4],7),t[7]^=R$1(t[6]+t[5],9),t[4]^=R$1(t[7]+t[6],13),t[5]^=R$1(t[4]+t[7],18),t[11]^=R$1(t[10]+t[9],7),t[8]^=R$1(t[11]+t[10],9),t[9]^=R$1(t[8]+t[11],13),t[10]^=R$1(t[9]+t[8],18),t[12]^=R$1(t[15]+t[14],7),t[13]^=R$1(t[12]+t[15],9),t[14]^=R$1(t[13]+t[12],13),t[15]^=R$1(t[14]+t[13],18);for(let n=0;n<16;n++)e[n]=e[n]+t[n]>>>0}function blockMix(e,t){let n=2*t*16,r=new Uint32Array(16);for(let t=0;t<16;t++)r[t]=e[n-16+t];let i=new Uint32Array(n);for(let n=0;n<2*t;n++){for(let t=0;t<16;t++)r[t]^=e[n*16+t];salsa20_8(r);for(let e=0;e<16;e++)i[n*16+e]=r[e]}for(let n=0;n<t;n++)for(let t=0;t<16;t++)e[n*16+t]=i[2*n*16+t];for(let n=0;n<t;n++)for(let r=0;r<16;r++)e[(t+n)*16+r]=i[(2*n+1)*16+r]}function roMix(e,t,n){let r=2*n*16,i=Array.from({length:t});for(let r=0;r<t;r++)i[r]=new Uint32Array(e),blockMix(e,n);for(let o=0;o<t;o++){let o=e[r-16]&t-1;for(let t=0;t<r;t++)e[t]^=i[o][t];blockMix(e,n)}}function bytesToWords(e){let t=new Uint32Array(e.length/4);for(let n=0;n<t.length;n++)t[n]=e[n*4]|e[n*4+1]<<8|e[n*4+2]<<16|e[n*4+3]<<24;return t}function wordsToBytes(e){let t=new Uint8Array(e.length*4);for(let n=0;n<e.length;n++)t[n*4]=e[n]&255,t[n*4+1]=e[n]>>8&255,t[n*4+2]=e[n]>>16&255,t[n*4+3]=e[n]>>24&255;return t}function scryptCore(e,t,n,r,i,o){let s=128*r,c=pbkdf2Sync(e,t,1,i*s,`sha256`);for(let e=0;e<i;e++){let t=new Uint8Array(c.buffer,c.byteOffset+e*s,s),i=bytesToWords(t);roMix(i,n,r);let o=wordsToBytes(i);t.set(o)}return pbkdf2Sync(e,c,1,o,`sha256`)}function scryptSync(e,t,n,r){let i=R.from(e),o=R.from(t),s=r?.N??16384,c=r?.r??8,l=r?.p??1;if(s<=0||s&s-1)throw Error(`N must be a positive power of 2`);return scryptCore(i,o,s,c,l,n)}function scrypt(e,t,n,r,i){let o={},s;typeof r==`function`?s=r:(o=r,s=i);try{let r=scryptSync(e,t,n,o);setTimeout(()=>s(null,r),0)}catch(e){setTimeout(()=>s(e instanceof Error?e:Error(String(e)),R.alloc(0)),0)}}var ao=__esmMin(()=>{io(),Oe(),__name(R$1,`R`)});function rejectOkpKey(e){if(!(e.type!==`okp-public`&&e.type!==`okp-private`))throw e.curve===`ed25519`?codedError(`ERR_CRYPTO_UNSUPPORTED_OPERATION`,`Unsupported crypto operation`):codedError(`ERR_OSSL_EVP_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE`,`error:03000096:digital envelope routines::operation not supported for this keytype`)}function normalizeSignAlgorithm(e){let t=e.toLowerCase().replace(/-/g,``);if(t.startsWith(`rsa`)&&(t=t.slice(3)),!oo[t])throw Error(`Unsupported algorithm: ${e}. Supported: RSA-SHA1, RSA-SHA256, RSA-SHA512`);return t}function extractPem$1(e){if(typeof e==`string`)return e;if(R.isBuffer(e)||e instanceof Uint8Array)return R.from(e).toString(`utf8`);if(e&&typeof e==`object`&&`key`in e){let t=e.key;if(typeof t==`string`)return t;if(R.isBuffer(t)||t instanceof Uint8Array)return R.from(t).toString(`utf8`)}throw TypeError(`Invalid key argument`)}function createSign(e){return new Sign(e)}function createVerify(e){return new Verify(e)}function contextOf(e){if(typeof e!=`object`||!e||e instanceof na||R.isBuffer(e))return;let t=e.context;return t===void 0?void 0:new Uint8Array(t)}function toBytes(e,t){if(typeof e==`string`)return R.from(e,`utf8`);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw codedError(`ERR_INVALID_ARG_TYPE`,`The "${t}" argument must be an instance of Buffer, TypedArray, or DataView.`,TypeError)}function rsaPem(e){return e.export({format:`pem`,type:e.type===`private`?`pkcs1`:`spki`})}function rejectDigestForEdDSA(e){if(e!=null)throw codedError(`ERR_OSSL_INVALID_DIGEST`,`error:1C80007A:Provider routines::invalid digest`)}function oneShotSign(e,t,n){let r=toKeyObject(n,`private`),i=okpKeyMaterial(r);if(i)return i.curve!==`ed25519`&&rejectOkpKey({type:`okp-private`,curve:i.curve,priv:i.priv}),rejectDigestForEdDSA(e),R.from(ed25519Sign(i.priv,t,contextOf(n)));let o=new Sign(e??`sha256`);return o.update(R.from(t)),o.sign(rsaPem(r))}function oneShotVerify(e,t,n,r){let i=toKeyObject(n,`public`),o=okpKeyMaterial(i);if(o)return o.curve!==`ed25519`&&rejectOkpKey({type:`okp-public`,curve:o.curve,pub:o.pub}),rejectDigestForEdDSA(e),ed25519Verify(o.pub,t,r,contextOf(n));let s=new Verify(e??`sha256`);return s.update(R.from(t)),s.verify(rsaPem(i),r)}function sign(e,t,n,r){let i=toBytes(t,`data`);if(r===void 0)return oneShotSign(e,i,n);let o;try{o=oneShotSign(e,i,n)}catch(e){setTimeout(()=>r(e),0);return}setTimeout(()=>r(null,o),0)}function verify(e,t,n,r,i){let o=toBytes(t,`data`),s=toBytes(r,`signature`);if(i===void 0)return oneShotVerify(e,o,n,s);let c;try{c=oneShotVerify(e,o,n,s)}catch(e){setTimeout(()=>i(e),0);return}setTimeout(()=>i(null,c),0)}var oo,Sign,Verify,so=__esmMin(()=>{Sr(),oa(),Er(),ea(),ra(),eo(),Oe(),oo={sha1:new Uint8Array([48,33,48,9,6,5,43,14,3,2,26,5,0,4,20]),sha256:new Uint8Array([48,49,48,13,6,9,96,134,72,1,101,3,4,2,1,5,0,4,32]),sha512:new Uint8Array([48,81,48,13,6,9,96,134,72,1,101,3,4,2,3,5,0,4,64])},__name(extractPem$1,`extractPem`),Sign=class{_algorithm;_hash;_finalized=!1;constructor(e){this._algorithm=normalizeSignAlgorithm(e),this._hash=new $a(this._algorithm)}update(e,t){if(this._finalized)throw Error(`Sign was already finalized`);return this._hash.update(e,t),this}sign(e,t){if(this._finalized)throw Error(`Sign was already finalized`);this._finalized=!0;let n=this._hash.digest(),r=parsePemKey(extractPem$1(e));if(rejectOkpKey(r),r.type!==`rsa-private`)throw Error(`privateKey must be an RSA private key`);let{n:i,d:o}=r.components,s=rsaKeySize(i),c=oo[this._algorithm],l=new Uint8Array(c.length+n.length);l.set(c,0),l.set(n,c.length);let u=s-l.length-3;if(u<8)throw Error(`Key is too short for the specified hash algorithm`);let d=new Uint8Array(s);d[0]=0,d[1]=1;for(let e=2;e<2+u;e++)d[e]=255;d[2+u]=0,d.set(l,3+u);let f=bigIntToBytes(modPow(bytesToBigInt(d),o,i),s),p=R.from(f);return t?p.toString(t):p}},Verify=class{_algorithm;_hash;_finalized=!1;constructor(e){this._algorithm=normalizeSignAlgorithm(e),this._hash=new $a(this._algorithm)}update(e,t){if(this._finalized)throw Error(`Verify was already finalized`);return this._hash.update(e,t),this}verify(e,t,n){if(this._finalized)throw Error(`Verify was already finalized`);this._finalized=!0;let r=this._hash.digest(),i=parsePemKey(extractPem$1(e));rejectOkpKey(i);let o,s;if(i.type===`rsa-public`)o=i.components.n,s=i.components.e;else if(i.type===`rsa-private`)o=i.components.n,s=i.components.e;else throw Error(`publicKey must be an RSA public or private key`);let c=rsaKeySize(o),l;if(l=typeof t==`string`?R.from(t,n||`base64`):t instanceof Uint8Array?t:R.from(t),l.length!==c)return!1;let u=bytesToBigInt(l);if(u>=o)return!1;let d=bigIntToBytes(modPow(u,s,o),c);if(d[0]!==0||d[1]!==1)return!1;let f=2;for(;f<d.length&&d[f]===255;)f++;if(f>=d.length||d[f]!==0||f-2<8)return!1;f++;let p=d.slice(f),m=oo[this._algorithm],h=new Uint8Array(m.length+r.length);if(h.set(m,0),h.set(r,m.length),p.length!==h.length)return!1;let g=0;for(let e=0;e<p.length;e++)g|=p[e]^h[e];return g===0}}});function encode(e,t){return t===void 0?e:e.export(t)}function generateKeyPairSync(e,t){if(typeof e!=`string`)throw codedError(`ERR_INVALID_ARG_TYPE`,`The "type" argument must be of type string. Received ${typeof e}`,TypeError);if(e!==`ed25519`&&e!==`x25519`)throw co.includes(e)?codedError(`ERR_FEATURE_UNAVAILABLE_ON_PLATFORM`,`generateKeyPair('${e}') is not implemented on GJS yet (supported: 'ed25519', 'x25519')`):codedError(`ERR_INVALID_ARG_VALUE`,`The argument 'type' must be a supported key type. Received '${e}'`,TypeError);let{publicKey:n,privateKey:r}=okpKeyPair(e,generateOkpPrivateKey(e));return{publicKey:encode(n,t?.publicKeyEncoding),privateKey:encode(r,t?.privateKeyEncoding)}}function generateKeyPair(e,t,n){let r=typeof t==`function`?t:n,i=typeof t==`function`?void 0:t;if(typeof r!=`function`)throw codedError(`ERR_INVALID_ARG_TYPE`,`The "callback" argument must be of type function`,TypeError);let o=generateKeyPairSync(e,i);setTimeout(()=>r(null,o.publicKey,o.privateKey),0)}var co,lo=__esmMin(()=>{Er(),ea(),ra(),co=[`rsa`,`rsa-pss`,`dsa`,`ec`,`ed25519`,`ed448`,`x25519`,`x448`,`dh`],Object.defineProperty(generateKeyPair,Symbol.for(`nodejs.util.promisify.custom`),{value:(e,t)=>new Promise(n=>n(generateKeyPairSync(e,t)))})});function extractPem(e){if(typeof e==`string`)return e;if(R.isBuffer(e)||e instanceof Uint8Array)return R.from(e).toString(`utf8`);if(e&&typeof e==`object`&&`key`in e){let t=e.key;if(typeof t==`string`)return t;if(R.isBuffer(t)||t instanceof Uint8Array)return R.from(t).toString(`utf8`)}throw TypeError(`Invalid key argument`)}function pkcs1v15Type2Pad(e,t){let n=t-11;if(e.length>n)throw Error(`Data too long for key size. Max ${n} bytes, got ${e.length}`);let r=t-e.length-3,i=new Uint8Array(t);i[0]=0,i[1]=2;let o=randomBytes(r);for(let e=0;e<r;e++){for(;o[e]===0;)o[e]=randomBytes(1)[0];i[2+e]=o[e]}return i[2+r]=0,i.set(e,3+r),i}function pkcs1v15Type1Pad(e,t){let n=t-11;if(e.length>n)throw Error(`Data too long for key size. Max ${n} bytes, got ${e.length}`);let r=t-e.length-3,i=new Uint8Array(t);i[0]=0,i[1]=1;for(let e=2;e<2+r;e++)i[e]=255;return i[2+r]=0,i.set(e,3+r),i}function pkcs1v15Type2Unpad(e){if(e.length<11)throw Error(`Decryption error: message too short`);if(e[0]!==0||e[1]!==2)throw Error(`Decryption error: invalid padding`);let t=2;for(;t<e.length&&e[t]!==0;)t++;if(t>=e.length||t<10)throw Error(`Decryption error: invalid padding`);return e.slice(t+1)}function pkcs1v15Type1Unpad(e){if(e.length<11)throw Error(`Decryption error: message too short`);if(e[0]!==0||e[1]!==1)throw Error(`Decryption error: invalid padding`);let t=2;for(;t<e.length&&e[t]===255;)t++;if(t>=e.length||e[t]!==0||t<10)throw Error(`Decryption error: invalid padding`);return e.slice(t+1)}function publicEncrypt(e,t){let n=parsePemKey(extractPem(e)),r,i;if(n.type===`rsa-public`)r=n.components.n,i=n.components.e;else if(n.type===`rsa-private`)r=n.components.n,i=n.components.e;else throw Error(`Key must be an RSA public or private key`);let o=rsaKeySize(r),s=modPow(bytesToBigInt(pkcs1v15Type2Pad(t instanceof Uint8Array?t:R.from(t),o)),i,r);return R.from(bigIntToBytes(s,o))}function privateDecrypt(e,t){let n=parsePemKey(extractPem(e));if(n.type!==`rsa-private`)throw Error(`Key must be an RSA private key`);let{n:r,d:i}=n.components,o=rsaKeySize(r),s=t instanceof Uint8Array?t:R.from(t);if(s.length!==o)throw Error(`Data length (${s.length}) does not match key length (${o})`);let c=bytesToBigInt(s);if(c>=r)throw Error(`Decryption error: cipher value out of range`);let l=bigIntToBytes(modPow(c,i,r),o);return R.from(pkcs1v15Type2Unpad(l))}function privateEncrypt(e,t){let n=parsePemKey(extractPem(e));if(n.type!==`rsa-private`)throw Error(`Key must be an RSA private key`);let{n:r,d:i}=n.components,o=rsaKeySize(r),s=modPow(bytesToBigInt(pkcs1v15Type1Pad(t instanceof Uint8Array?t:R.from(t),o)),i,r);return R.from(bigIntToBytes(s,o))}function publicDecrypt(e,t){let n=parsePemKey(extractPem(e)),r,i;if(n.type===`rsa-public`)r=n.components.n,i=n.components.e;else if(n.type===`rsa-private`)r=n.components.n,i=n.components.e;else throw Error(`Key must be an RSA public or private key`);let o=rsaKeySize(r),s=t instanceof Uint8Array?t:R.from(t);if(s.length!==o)throw Error(`Data length (${s.length}) does not match key length (${o})`);let c=bytesToBigInt(s);if(c>=r)throw Error(`Decryption error: cipher value out of range`);let l=bigIntToBytes(modPow(c,i,r),o);return R.from(pkcs1v15Type1Unpad(l))}var uo=__esmMin(()=>{Sr(),oa(),aa(),Oe()});function mgf1(e,t,n){let r=new Uint8Array(n),i=0,o=0;for(;i<n;){let s=new Uint8Array(4);s[0]=o>>>24&255,s[1]=o>>>16&255,s[2]=o>>>8&255,s[3]=o&255;let c=new $a(e);c.update(t),c.update(s);let l=new Uint8Array(c.digest()),u=Math.min(l.length,n-i);r.set(l.slice(0,u),i),i+=u,o++}return r}var fo=__esmMin(()=>{eo()});function hashDigest$1(e,t){let n=new $a(e);return n.update(t),new Uint8Array(n.digest())}function emsaPssEncode(e,t,n,r){let i=hashSize(n),o=Math.ceil(t/8);if(o<i+r+2)throw Error(`RSA-PSS: encoding error — key too short`);let s=r>0?new Uint8Array(randomBytes(r)):new Uint8Array,c=new Uint8Array(8+i+r);c.set(e,8),c.set(s,8+i);let l=hashDigest$1(n,c),u=o-i-1,d=new Uint8Array(u);d[u-r-1]=1,d.set(s,u-r);let f=mgf1(n,l,u),p=new Uint8Array(u);for(let e=0;e<u;e++)p[e]=d[e]^f[e];let m=8*o-t;m>0&&(p[0]&=255>>>m);let h=new Uint8Array(o);return h.set(p,0),h.set(l,u),h[o-1]=188,h}function emsaPssVerify(e,t,n,r,i){let o=hashSize(r),s=Math.ceil(n/8);if(s<o+i+2||t[s-1]!==188)return!1;let c=s-o-1,l=t.slice(0,c),u=t.slice(c,c+o),d=8*s-n;if(d>0&&l[0]&255<<8-d)return!1;let f=mgf1(r,u,c),p=new Uint8Array(c);for(let e=0;e<c;e++)p[e]=l[e]^f[e];d>0&&(p[0]&=255>>>d);for(let e=0;e<c-i-1;e++)if(p[e]!==0)return!1;if(p[c-i-1]!==1)return!1;let m=p.slice(c-i),h=new Uint8Array(8+o+i);h.set(e,8),h.set(m,8+o);let g=hashDigest$1(r,h);if(u.length!==g.length)return!1;let _=0;for(let e=0;e<u.length;e++)_|=u[e]^g[e];return _===0}function rsaPssSign(e,t,n,r){let i=parsePemKey(t);if(i.type!==`rsa-private`)throw Error(`RSA-PSS: expected RSA private key`);let{n:o,d:s}=i.components,c=rsaKeySize(o),l=Math.ceil(c/8);return bigIntToBytes(modPow(bytesToBigInt(emsaPssEncode(hashDigest$1(e,n),c-1,e,r)),s,o),l)}function rsaPssVerify(e,t,n,r,i){let o=parsePemKey(t),s,c;if(o.type===`rsa-public`)({n:s,e:c}=o.components);else if(o.type===`rsa-private`)({n:s,e:c}=o.components);else throw Error(`RSA-PSS: expected RSA key`);let l=rsaKeySize(s),u=Math.ceil(l/8);if(n.length!==u)return!1;let d=bigIntToBytes(modPow(bytesToBigInt(n),c,s),Math.ceil((l-1)/8));return emsaPssVerify(hashDigest$1(e,r),d,l-1,e,i)}var po=__esmMin(()=>{Sr(),oa(),Er(),aa(),eo(),fo(),__name(hashDigest$1,`hashDigest`)});function hashDigest(e,t){let n=new $a(e);return n.update(t),new Uint8Array(n.digest())}function rsaOaepEncrypt(e,t,n,r){let i=parsePemKey(t),o,s;if(i.type===`rsa-public`)({n:o,e:s}=i.components);else if(i.type===`rsa-private`)({n:o,e:s}=i.components);else throw Error(`RSA-OAEP: expected RSA key`);let c=Math.ceil(rsaKeySize(o)/8),l=hashSize(e);if(n.length>c-2*l-2)throw Error(`RSA-OAEP: message too long`);let u=hashDigest(e,r||new Uint8Array),d=c-l-1,f=new Uint8Array(d);f.set(u,0),f[d-n.length-1]=1,f.set(n,d-n.length);let p=new Uint8Array(randomBytes(l)),m=mgf1(e,p,d),h=new Uint8Array(d);for(let e=0;e<d;e++)h[e]=f[e]^m[e];let g=mgf1(e,h,l),_=new Uint8Array(l);for(let e=0;e<l;e++)_[e]=p[e]^g[e];let v=new Uint8Array(c);return v[0]=0,v.set(_,1),v.set(h,1+l),bigIntToBytes(modPow(bytesToBigInt(v),s,o),c)}function rsaOaepDecrypt(e,t,n,r){let i=parsePemKey(t);if(i.type!==`rsa-private`)throw Error(`RSA-OAEP: expected RSA private key`);let{n:o,d:s}=i.components,c=Math.ceil(rsaKeySize(o)/8),l=hashSize(e);if(n.length!==c||c<2*l+2)throw Error(`RSA-OAEP: decryption error`);let u=bigIntToBytes(modPow(bytesToBigInt(n),s,o),c),d=u[0],f=u.slice(1,1+l),p=u.slice(1+l),m=c-l-1,h=mgf1(e,p,l),g=new Uint8Array(l);for(let e=0;e<l;e++)g[e]=f[e]^h[e];let _=mgf1(e,g,m),v=new Uint8Array(m);for(let e=0;e<m;e++)v[e]=p[e]^_[e];let y=hashDigest(e,r||new Uint8Array),b=v.slice(0,l),x=+(d===0);for(let e=0;e<l;e++)x&=+(y[e]===b[e]);let S=-1;for(let e=l;e<m;e++)if(v[e]===1){S=e;break}else if(v[e]!==0){x=0;break}if(S===-1&&(x=0),!x)throw Error(`RSA-OAEP: decryption error`);return v.slice(S+1)}var mo=__esmMin(()=>{Sr(),oa(),Er(),aa(),eo(),fo()});function formatFingerprint(e){let t=e.toString(`hex`).toUpperCase(),n=[];for(let e=0;e<t.length;e+=2)n.push(t.substring(e,e+2));return n.join(`:`)}function matchHostname(e,t){let n=e.toLowerCase(),r=t.toLowerCase();if(n===r)return!0;if(n.startsWith(`*.`)){let e=n.substring(2),t=r.split(`.`);if(t.length>=2)return t.slice(1).join(`.`)===e}return!1}function parseDNToObject(e){let t={},n=e.split(`, `);for(let e of n){let n=e.indexOf(`=`);n>0&&(t[e.substring(0,n)]=e.substring(n+1))}return t}var X509Certificate,ho=__esmMin(()=>{Sr(),ra(),vo(),Oe(),X509Certificate=class{_components;_pem;constructor(e){if(typeof e==`string`)this._pem=e,this._components=parseX509(e);else{let t=R.isBuffer(e)?e:R.from(e),n=t.toString(`utf8`);n.includes(`-----BEGIN CERTIFICATE-----`)?(this._pem=n,this._components=parseX509(n)):(this._components=parseX509Der(new Uint8Array(t.buffer,t.byteOffset,t.byteLength)),this._pem=derToPem(this._components.raw,`CERTIFICATE`))}}get raw(){return R.from(this._components.raw)}get serialNumber(){return this._components.serialNumber.toString(16).toUpperCase()}get subject(){return this._components.subject}get issuer(){return this._components.issuer}get validFrom(){return this._components.validFrom.toUTCString()}get validTo(){return this._components.validTo.toUTCString()}get fingerprint(){return formatFingerprint(createHash(`sha1`).update(this._components.raw).digest())}get fingerprint256(){return formatFingerprint(createHash(`sha256`).update(this._components.raw).digest())}get fingerprint512(){return formatFingerprint(createHash(`sha512`).update(this._components.raw).digest())}get publicKey(){if(!this._components.publicKey)throw Error(`Certificate does not contain a supported public key type`);let e=derToPem(encodeSubjectPublicKeyInfo(this._components.publicKey),`PUBLIC KEY`);return new na(`public`,{parsed:{type:`rsa-public`,components:this._components.publicKey},pem:e})}get subjectAltName(){if(!(!this._components.subjectAltName||this._components.subjectAltName.length===0))return this._components.subjectAltName.join(`, `)}get keyUsage(){}get infoAccess(){}get ca(){return!1}checkHost(e){let t=this._components.subject.match(/CN=([^,]+)/);if(t){let n=t[1].trim();if(matchHostname(n,e))return n}if(this._components.subjectAltName){for(let t of this._components.subjectAltName)if(t.startsWith(`DNS:`)){let n=t.substring(4);if(matchHostname(n,e))return n}}}checkEmail(e){let t=e.toLowerCase(),n=this._components.subject.match(/emailAddress=([^,]+)/);if(n&&n[1].toLowerCase()===t)return n[1]}checkIP(e){if(this._components.subjectAltName){for(let t of this._components.subjectAltName)if(t.startsWith(`IP Address:`)&&t.substring(11)===e)return e}}verify(e){return!0}checkIssued(e){return this.issuer===e.subject}toLegacyObject(){return{subject:parseDNToObject(this._components.subject),issuer:parseDNToObject(this._components.issuer),valid_from:this.validFrom,valid_to:this.validTo,serialNumber:this.serialNumber,fingerprint:this.fingerprint,fingerprint256:this.fingerprint256}}toString(){return this._pem}toJSON(){return this._pem}get[Symbol.toStringTag](){return`X509Certificate`}}}),go=__exportAll$3({DiffieHellman:()=>DiffieHellman,DiffieHellmanGroup:()=>fa,Hash:()=>$a,Hmac:()=>Hmac,KeyObject:()=>na,Sign:()=>Sign,Verify:()=>Verify,X509Certificate:()=>X509Certificate,constants:()=>cr,createCipher:()=>createCipher,createCipheriv:()=>createCipheriv,createDecipher:()=>createDecipher,createDecipheriv:()=>createDecipheriv,createDiffieHellman:()=>createDiffieHellman,createDiffieHellmanGroup:()=>da,createECDH:()=>createECDH,createHash:()=>createHash,createHmac:()=>createHmac,createPrivateKey:()=>createPrivateKey,createPublicKey:()=>createPublicKey,createSecretKey:()=>createSecretKey,createSign:()=>createSign,createVerify:()=>createVerify,default:()=>_o,diffieHellman:()=>diffieHellman,ecdsaSign:()=>ecdsaSign,ecdsaVerify:()=>ecdsaVerify,generateKeyPair:()=>generateKeyPair,generateKeyPairSync:()=>generateKeyPairSync,getCiphers:()=>getCiphers,getCurves:()=>getCurves,getDiffieHellman:()=>getDiffieHellman,getHashes:()=>getHashes,hash:()=>hash,hkdf:()=>hkdf,hkdfSync:()=>hkdfSync,mgf1:()=>mgf1,pbkdf2:()=>pbkdf2,pbkdf2Sync:()=>pbkdf2Sync,privateDecrypt:()=>privateDecrypt,privateEncrypt:()=>privateEncrypt,publicDecrypt:()=>publicDecrypt,publicEncrypt:()=>publicEncrypt,randomBytes:()=>randomBytes,randomFill:()=>randomFill,randomFillSync:()=>randomFillSync,randomInt:()=>randomInt,randomUUID:()=>randomUUID,rsaOaepDecrypt:()=>rsaOaepDecrypt,rsaOaepEncrypt:()=>rsaOaepEncrypt,rsaPssSign:()=>rsaPssSign,rsaPssVerify:()=>rsaPssVerify,scrypt:()=>scrypt,scryptSync:()=>scryptSync,sign:()=>sign,timingSafeEqual:()=>timingSafeEqual,verify:()=>verify});function createHash(e){return new $a(e)}function createHmac(e,t){return new Hmac(e,t)}var _o,vo=__esmMin(()=>{lr(),ur(),gr(),ra(),ia(),aa(),pa(),ga(),eo(),to(),no(),ro(),io(),ao(),so(),lo(),uo(),fo(),po(),mo(),ho(),_o={Hash:$a,getHashes,hash,Hmac,randomBytes,randomFill,randomFillSync,randomUUID,randomInt,timingSafeEqual,constants:cr,pbkdf2,pbkdf2Sync,hkdf,hkdfSync,scrypt,scryptSync,createHash,createHmac,createCipher,createCipheriv,createDecipher,createDecipheriv,getCiphers,Sign,Verify,createSign,createVerify,sign,verify,generateKeyPair,generateKeyPairSync,diffieHellman,createDiffieHellman,getDiffieHellman,DiffieHellman,DiffieHellmanGroup:fa,createDiffieHellmanGroup:da,createECDH,getCurves,ecdsaSign,ecdsaVerify,publicEncrypt,privateDecrypt,privateEncrypt,publicDecrypt,rsaPssSign,rsaPssVerify,rsaOaepEncrypt,rsaOaepDecrypt,mgf1,KeyObject:na,createSecretKey,createPublicKey,createPrivateKey,X509Certificate}});let yo=!1,bo,xo,So,Co,wo,To,Eo,Do,Oo,ko,Ao,jo,Mo,No,Po,Fo,Io;async function loadCrypto(){if(yo)return;let e=await Promise.resolve().then(()=>(vo(),go));bo=e.createHash,xo=e.createHmac,So=e.createCipheriv,Co=e.createDecipheriv,wo=e.createSign,To=e.createVerify,Eo=e.pbkdf2Sync,Do=e.hkdfSync,Oo=e.createECDH,ko=e.randomBytes,e.publicEncrypt,e.privateDecrypt,e.createPublicKey,e.createPrivateKey,Ao=e.ecdsaSign,jo=e.ecdsaVerify,Mo=e.rsaPssSign,No=e.rsaPssVerify,Po=e.rsaOaepEncrypt,Fo=e.rsaOaepDecrypt,Io={generateKeyPairSync:e.generateKeyPairSync,sign:e.sign,verify:e.verify,diffieHellman:e.diffieHellman,createPrivateKey:e.createPrivateKey,createPublicKey:e.createPublicKey},yo=!0}const Lo=loadCrypto();var SubtleCrypto=class{async digest(e,t){await Lo;let n=toNodeHashName(normalizeAlgorithm$1(e).name),r=toUint8Array(t),i=bo(n);i.update(r);let o=i.digest();return o.buffer.slice(o.byteOffset,o.byteOffset+o.byteLength)}async generateKey(e,t,n){await Lo;let r=normalizeAlgorithm$1(e),i=r.name.toUpperCase(),o=cfrgName(r.name);if(o)return cfrgGenerateKey(Io,o,t,n);switch(i){case`AES-CBC`:case`AES-CTR`:case`AES-GCM`:{let i=e.length;if(![128,192,256].includes(i))throw new DOMException(`Invalid AES key length: ${i}`,`OperationError`);validateUsages(n,[`encrypt`,`decrypt`,`wrapKey`,`unwrapKey`]);let o=ko(i/8);return new CryptoKey(`secret`,t,{name:r.name,length:i},n,new Uint8Array(o))}case`AES-KW`:{let r=e.length;if(![128,192,256].includes(r))throw new DOMException(`Invalid AES key length: ${r}`,`OperationError`);validateUsages(n,[`wrapKey`,`unwrapKey`]);let i=ko(r/8);return new CryptoKey(`secret`,t,{name:`AES-KW`,length:r},n,new Uint8Array(i))}case`HMAC`:{let r=e,i=normalizeAlgorithm$1(r.hash),o=r.length||hashSize$1(i.name)*8;validateUsages(n,[`sign`,`verify`]);let s=ko(Math.ceil(o/8));return new CryptoKey(`secret`,t,{name:`HMAC`,hash:{name:i.name},length:o},n,new Uint8Array(s))}case`ECDH`:{let r=e.namedCurve,i=toNodeCurveName(r);validateUsages(n,[`deriveKey`,`deriveBits`]);let o=Oo(i);o.generateKeys();let s=new Uint8Array(o.getPublicKey()),c=new Uint8Array(o.getPrivateKey());return{publicKey:new CryptoKey(`public`,!0,{name:`ECDH`,namedCurve:r},[],s),privateKey:new CryptoKey(`private`,t,{name:`ECDH`,namedCurve:r},n,{pub:s,priv:c})}}case`ECDSA`:{let r=e.namedCurve,i=toNodeCurveName(r);validateUsages(n,[`sign`,`verify`]);let o=Oo(i);o.generateKeys();let s=new Uint8Array(o.getPublicKey()),c=new Uint8Array(o.getPrivateKey());return{publicKey:new CryptoKey(`public`,!0,{name:`ECDSA`,namedCurve:r},[`verify`],s),privateKey:new CryptoKey(`private`,t,{name:`ECDSA`,namedCurve:r},[`sign`],{pub:s,priv:c})}}default:throw new DOMException(`Unsupported algorithm: ${r.name}`,`NotSupportedError`)}}async importKey(e,t,n,r,i){await Lo;let o=normalizeAlgorithm$1(n),s=o.name.toUpperCase(),c=cfrgName(o.name);if(c)return cfrgImportKey(Io,e,t,c,r,i);switch(s){case`AES-CBC`:case`AES-CTR`:case`AES-GCM`:if(e===`raw`){let e=toUint8Array(t);if(![16,24,32].includes(e.length))throw new DOMException(`Invalid AES key length: ${e.length*8}`,`DataError`);return validateUsages(i,[`encrypt`,`decrypt`,`wrapKey`,`unwrapKey`]),new CryptoKey(`secret`,r,{name:o.name,length:e.length*8},i,new Uint8Array(e))}if(e===`jwk`){let e=t;if(e.kty!==`oct`)throw new DOMException(`JWK kty must be "oct"`,`DataError`);let n=base64urlDecode(e.k);if(![16,24,32].includes(n.length))throw new DOMException(`Invalid AES key length: ${n.length*8}`,`DataError`);return validateUsages(i,[`encrypt`,`decrypt`,`wrapKey`,`unwrapKey`]),new CryptoKey(`secret`,r,{name:o.name,length:n.length*8},i,n)}throw new DOMException(`Unsupported format: ${e}`,`NotSupportedError`);case`AES-KW`:{let n;if(e===`raw`)n=toUint8Array(t);else if(e===`jwk`){let e=t;if(e.kty!==`oct`)throw new DOMException(`JWK kty must be "oct"`,`DataError`);n=base64urlDecode(e.k)}else throw new DOMException(`Unsupported format: ${e}`,`NotSupportedError`);if(![16,24,32].includes(n.length))throw new DOMException(`Invalid AES key length: ${n.length*8}`,`DataError`);return validateUsages(i,[`wrapKey`,`unwrapKey`]),new CryptoKey(`secret`,r,{name:`AES-KW`,length:n.length*8},i,new Uint8Array(n))}case`HMAC`:{let o=normalizeAlgorithm$1(n.hash);if(e===`raw`){let e=toUint8Array(t);return validateUsages(i,[`sign`,`verify`]),new CryptoKey(`secret`,r,{name:`HMAC`,hash:{name:o.name},length:e.length*8},i,new Uint8Array(e))}if(e===`jwk`){let e=t;if(e.kty!==`oct`)throw new DOMException(`JWK kty must be "oct"`,`DataError`);let n=base64urlDecode(e.k);return validateUsages(i,[`sign`,`verify`]),new CryptoKey(`secret`,r,{name:`HMAC`,hash:{name:o.name},length:n.length*8},i,n)}throw new DOMException(`Unsupported format: ${e}`,`NotSupportedError`)}case`PBKDF2`:if(e===`raw`){let e=toUint8Array(t);return validateUsages(i,[`deriveKey`,`deriveBits`]),new CryptoKey(`secret`,!1,{name:`PBKDF2`},i,new Uint8Array(e))}throw new DOMException(`Unsupported format: ${e}`,`NotSupportedError`);case`HKDF`:if(e===`raw`){let e=toUint8Array(t);return validateUsages(i,[`deriveKey`,`deriveBits`]),new CryptoKey(`secret`,!1,{name:`HKDF`},i,new Uint8Array(e))}throw new DOMException(`Unsupported format: ${e}`,`NotSupportedError`);case`ECDH`:case`ECDSA`:{let c=n.namedCurve;if(e===`raw`){let e=toUint8Array(t);return s===`ECDH`?i.length>0&&validateUsages(i,[`deriveKey`,`deriveBits`]):validateUsages(i,[`verify`]),new CryptoKey(`public`,r,{name:o.name,namedCurve:c},i,new Uint8Array(e))}if(e===`jwk`){let e=t;if(e.kty!==`EC`)throw new DOMException(`JWK kty must be "EC"`,`DataError`);if(e.d){let t=base64urlDecode(e.d),n=base64urlDecode(e.x),l=base64urlDecode(e.y),u=new Uint8Array(1+n.length+l.length);return u[0]=4,u.set(n,1),u.set(l,1+n.length),validateUsages(i,s===`ECDH`?[`deriveKey`,`deriveBits`]:[`sign`]),new CryptoKey(`private`,r,{name:o.name,namedCurve:c},i,{pub:u,priv:t})}else{let t=base64urlDecode(e.x),n=base64urlDecode(e.y),l=new Uint8Array(1+t.length+n.length);return l[0]=4,l.set(t,1),l.set(n,1+t.length),s===`ECDH`?i.length>0&&validateUsages(i,[`deriveKey`,`deriveBits`]):validateUsages(i,[`verify`]),new CryptoKey(`public`,r,{name:o.name,namedCurve:c},i,l)}}throw new DOMException(`Unsupported format: ${e}`,`NotSupportedError`)}default:throw new DOMException(`Unsupported algorithm: ${o.name}`,`NotSupportedError`)}}async exportKey(e,t){if(!t.extractable)throw new DOMException(`Key is not extractable`,`InvalidAccessError`);if(cfrgName(t.algorithm.name))return cfrgExportKey(e,t);let n=t.algorithm.name.toUpperCase();if(e===`raw`){if(t.type===`secret`){let e=t._handle;return e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength)}if(t.type===`public`&&(n===`ECDH`||n===`ECDSA`)){let e=t._handle;return e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength)}throw new DOMException(`Cannot export in raw format`,`InvalidAccessError`)}if(e===`jwk`){if(t.type===`secret`){let e=t._handle,r={kty:`oct`,k:base64urlEncode(e),ext:t.extractable,key_ops:[...t.usages]};return n.startsWith(`AES-`)?r.alg=`A${t.algorithm.length}${n.replace(`AES-`,``)}`:n===`HMAC`&&(r.alg=`HS${t.algorithm.hash.name.replace(`SHA-`,``)}`),r}if((n===`ECDH`||n===`ECDSA`)&&(t.type===`public`||t.type===`private`)){let e=t.algorithm.namedCurve,n;n=t.type===`public`?t._handle:t._handle.pub;let r=(n.length-1)/2,i=n.slice(1,1+r),o=n.slice(1+r),s={kty:`EC`,crv:e,x:base64urlEncode(i),y:base64urlEncode(o),ext:t.extractable,key_ops:[...t.usages]};return t.type===`private`&&(s.d=base64urlEncode(t._handle.priv)),s}throw new DOMException(`JWK export not supported for ${n} ${t.type}`,`NotSupportedError`)}throw new DOMException(`Unsupported export format: ${e}`,`NotSupportedError`)}async encrypt(e,t,n){return await Lo,checkUsage(t,`encrypt`),this._encryptImpl(e,t,n)}async _encryptImpl(e,t,n){let r=normalizeAlgorithm$1(e),i=r.name.toUpperCase(),o=toUint8Array(n);switch(i){case`AES-CBC`:{let n=toUint8Array(e.iv),r=t._handle,i=r.length*8,s=So(`aes-${i}-cbc`,r,n),c=s.update(o),l=s.final(),u=new Uint8Array(c.length+l.length);return u.set(new Uint8Array(c),0),u.set(new Uint8Array(l),c.length),u.buffer}case`AES-CTR`:{let n=toUint8Array(e.counter),r=t._handle,i=r.length*8,s=So(`aes-${i}-ctr`,r,n),c=s.update(o),l=s.final(),u=new Uint8Array(c.length+l.length);return u.set(new Uint8Array(c),0),u.set(new Uint8Array(l),c.length),u.buffer}case`AES-GCM`:{let n=e,r=toUint8Array(n.iv),i=n.additionalData?toUint8Array(n.additionalData):void 0,s=t._handle,c=s.length*8,l=So(`aes-${c}-gcm`,s,r);i&&l.setAAD(i);let u=l.update(o),d=l.final(),f=l.getAuthTag(),p=new Uint8Array(u.length+d.length+f.length);return p.set(new Uint8Array(u),0),p.set(new Uint8Array(d),u.length),p.set(new Uint8Array(f),u.length+d.length),p.buffer}case`RSA-OAEP`:{let n=t.algorithm.hash.name,r=toNodeHashName(n),i=t._handle,s=e,c=s.label?toUint8Array(s.label):void 0,l=Po(r,i.pem,o,c);return l.buffer.slice(l.byteOffset,l.byteOffset+l.byteLength)}case`AES-KW`:{let e=t._handle;return aesKeyWrap(o,t=>this._aesEcbBlock(e,t,!0)).buffer}default:throw new DOMException(`Unsupported algorithm: ${r.name}`,`NotSupportedError`)}}async decrypt(e,t,n){return await Lo,checkUsage(t,`decrypt`),this._decryptImpl(e,t,n)}async _decryptImpl(e,t,n){let r=normalizeAlgorithm$1(e),i=r.name.toUpperCase(),o=toUint8Array(n);switch(i){case`AES-CBC`:{let n=toUint8Array(e.iv),r=t._handle,i=r.length*8,s=Co(`aes-${i}-cbc`,r,n),c=s.update(o),l=s.final(),u=new Uint8Array(c.length+l.length);return u.set(new Uint8Array(c),0),u.set(new Uint8Array(l),c.length),u.buffer}case`AES-CTR`:{let n=toUint8Array(e.counter),r=t._handle,i=r.length*8,s=Co(`aes-${i}-ctr`,r,n),c=s.update(o),l=s.final(),u=new Uint8Array(c.length+l.length);return u.set(new Uint8Array(c),0),u.set(new Uint8Array(l),c.length),u.buffer}case`AES-GCM`:{let n=e,r=toUint8Array(n.iv),i=(n.tagLength||128)/8,s=n.additionalData?toUint8Array(n.additionalData):void 0,c=t._handle,l=c.length*8,u=o.slice(0,o.length-i),d=o.slice(o.length-i),f=Co(`aes-${l}-gcm`,c,r);f.setAuthTag(d),s&&f.setAAD(s);let p=f.update(u),m=f.final(),h=new Uint8Array(p.length+m.length);return h.set(new Uint8Array(p),0),h.set(new Uint8Array(m),p.length),h.buffer}case`RSA-OAEP`:{let n=t.algorithm.hash.name,r=toNodeHashName(n),i=t._handle,s=e,c=s.label?toUint8Array(s.label):void 0,l=Fo(r,i.pem,o,c);return l.buffer.slice(l.byteOffset,l.byteOffset+l.byteLength)}case`AES-KW`:{let e=t._handle;return aesKeyUnwrap(o,t=>this._aesEcbBlock(e,t,!1)).buffer}default:throw new DOMException(`Unsupported algorithm: ${r.name}`,`NotSupportedError`)}}_aesEcbBlock(e,t,n){let r=`aes-${e.length*8}-ecb`,i=new Uint8Array,o=n?So(r,e,i):Co(r,e,i);o.setAutoPadding?.(!1);let s=o.update(t),c=o.final();if(c.length===0)return s;let l=new Uint8Array(s.length+c.length);return l.set(s,0),l.set(c,s.length),l}async sign(e,t,n){await Lo;let r=normalizeAlgorithm$1(e);checkAlgorithmMatch(t,r.name),checkUsage(t,`sign`);let i=r.name.toUpperCase(),o=toUint8Array(n);switch(i){case`HMAC`:{let e=t.algorithm.hash.name,n=toNodeHashName(e),r=t._handle,i=xo(n,r);i.update(o);let s=i.digest();return s.buffer.slice(s.byteOffset,s.byteOffset+s.byteLength)}case`RSASSA-PKCS1-V1_5`:{let e=t.algorithm.hash.name,n=toNodeHashName(e),r=t._handle,i=wo(n);i.update(o);let s=i.sign(r.pem);return s.buffer.slice(s.byteOffset,s.byteOffset+s.byteLength)}case`ECDSA`:{let n=e,r=toNodeHashName(typeof n.hash==`string`?n.hash:n.hash.name),i=t.algorithm.namedCurve,s=t._handle,c=Ao(r,s.priv,o,i);return c.buffer.slice(c.byteOffset,c.byteOffset+c.byteLength)}case`RSA-PSS`:{let n=t.algorithm.hash.name,r=toNodeHashName(n),i=t._handle,s=e.saltLength??hashSize$1(n),c=Mo(r,i.pem,o,s);return c.buffer.slice(c.byteOffset,c.byteOffset+c.byteLength)}case`ED25519`:return ed25519Sign$1(Io,t,o);default:throw new DOMException(`Unsupported algorithm: ${r.name}`,`NotSupportedError`)}}async verify(e,t,n,r){await Lo;let i=normalizeAlgorithm$1(e);checkAlgorithmMatch(t,i.name),checkUsage(t,`verify`);let o=i.name.toUpperCase(),s=toUint8Array(r),c=toUint8Array(n);switch(o){case`HMAC`:{let e=t.algorithm.hash.name,n=toNodeHashName(e),r=t._handle,i=xo(n,r);i.update(s);let o=new Uint8Array(i.digest());if(o.length!==c.length)return!1;let l=0;for(let e=0;e<o.length;e++)l|=o[e]^c[e];return l===0}case`RSASSA-PKCS1-V1_5`:{let e=t.algorithm.hash.name,n=toNodeHashName(e),r=t._handle,i=To(n);return i.update(s),i.verify(r.pem,c)}case`ECDSA`:{let n=e,r=toNodeHashName(typeof n.hash==`string`?n.hash:n.hash.name),i=t.algorithm.namedCurve,o=t._handle;return jo(r,o,c,s,i)}case`RSA-PSS`:{let n=t.algorithm.hash.name,r=toNodeHashName(n),i=t._handle,o=e.saltLength??hashSize$1(n);return No(r,i.pem,c,s,o)}case`ED25519`:return ed25519Verify$1(Io,t,c,s);default:throw new DOMException(`Unsupported algorithm: ${i.name}`,`NotSupportedError`)}}async _deriveBitsInternal(e,t,n){await Lo;let r=normalizeAlgorithm$1(e);switch(checkAlgorithmMatch(t,r.name),r.name.toUpperCase()){case`PBKDF2`:{let r=e,i=toNodeHashName(normalizeAlgorithm$1(r.hash).name),o=toUint8Array(r.salt),s=r.iterations,c=t._handle,l=Eo(c,o,s,n/8,i);return l.buffer.slice(l.byteOffset,l.byteOffset+l.byteLength)}case`HKDF`:{let r=e,i=toNodeHashName(normalizeAlgorithm$1(r.hash).name),o=toUint8Array(r.salt),s=toUint8Array(r.info),c=t._handle;return Do(i,c,o,s,n/8)}case`ECDH`:{let r=e.public,i=t.algorithm.namedCurve,o=toNodeCurveName(i),s=Oo(o),c=t._handle;s.setPrivateKey(c.priv);let l=r._handle instanceof Uint8Array?r._handle:r._handle.pub,u=s.computeSecret(l),d=new Uint8Array(u);return n?d.buffer.slice(0,n/8):d.buffer.slice(d.byteOffset,d.byteOffset+d.byteLength)}case`X25519`:return x25519DeriveBits(Io,t,e.public,n);default:throw new DOMException(`Unsupported algorithm: ${r.name}`,`NotSupportedError`)}}async deriveBits(e,t,n=null){return checkUsage(t,`deriveBits`),this._deriveBitsInternal(e,t,n)}async deriveKey(e,t,n,r,i){checkUsage(t,`deriveKey`);let o=normalizeAlgorithm$1(n),s,c=o.name.toUpperCase();if(c===`AES-CBC`||c===`AES-CTR`||c===`AES-GCM`)s=n.length;else if(c===`HMAC`){let e=n,t=normalizeAlgorithm$1(e.hash);s=e.length||hashSize$1(t.name)*8}else throw new DOMException(`Unsupported derived key algorithm: ${o.name}`,`NotSupportedError`);let l=await this._deriveBitsInternal(e,t,s);return this.importKey(`raw`,l,n,r,i)}async wrapKey(e,t,n,r){await Lo,checkUsage(n,`wrapKey`);let i=await this.exportKey(e,t),o=e===`jwk`?new TextEncoder().encode(JSON.stringify(i)):i;return this._encryptImpl(r,n,o)}async unwrapKey(e,t,n,r,i,o,s){await Lo,checkUsage(n,`unwrapKey`);let c=await this._decryptImpl(r,n,t),l=e===`jwk`?JSON.parse(new TextDecoder().decode(new Uint8Array(c))):c;return this.importKey(e,l,i,o,s)}};Zi();const Ro=globalThis.crypto===void 0?null:globalThis.crypto;var CryptoPolyfill=class{subtle=new SubtleCrypto;getRandomValues(e){if(!(e instanceof Int8Array||e instanceof Uint8Array||e instanceof Int16Array||e instanceof Uint16Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Uint8ClampedArray||e instanceof BigInt64Array||e instanceof BigUint64Array))throw new DOMException(`The provided value is not of type '(Int8Array or Int16Array or Int32Array or Uint8Array or Uint8ClampedArray or Uint16Array or Uint32Array or BigInt64Array or BigUint64Array)'`,`TypeMismatchError`);if(e.byteLength>65536)throw new DOMException(`The ArrayBufferView's byte length exceeds the number of bytes of entropy available via this API (65536)`,`QuotaExceededError`);return fillRandomBytes(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),{webcrypto:Ro?.getRandomValues?Ro:null}),e}randomUUID(){if(Ro&&typeof Ro.randomUUID==`function`)return Ro.randomUUID();let e=new Uint8Array(16);this.getRandomValues(e),e[6]=e[6]&15|64,e[8]=e[8]&63|128;let t=Array.from(e,e=>e.toString(16).padStart(2,`0`)).join(``);return`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16,20)}-${t.slice(20)}`}};const zo=Ro!==null&&Ro.subtle!==void 0&&typeof Ro.subtle.digest==`function`,Bo=zo?Ro:new CryptoPolyfill;zo?Ro.subtle:new SubtleCrypto;const Vo=globalThis;(globalThis.crypto===void 0||globalThis.crypto.subtle===void 0)&&(Vo.crypto=Bo);var Ho,Uo=__esmMin(()=>{Ho=t}),J,Wo=__esmMin(()=>{Uo(),J=Ho});function findPnpManifest(e){let t=J.File.new_for_path(e);for(;t.has_parent(null);){let e=t.resolve_relative_path(`.pnp.cjs`);if(e.query_exists(null))return e.get_path();t=t.get_parent()}return null}function loadPnpManifest(e){let t=Go.get(e);if(t!==void 0)return t;let n=J.File.new_for_path(e),r;try{let[t,i]=n.load_contents(null);if(!t)return Go.set(e,null),null;r=new TextDecoder().decode(i)}catch{return Go.set(e,null),null}let i=extractRawRuntimeState(r);if(!i)return Go.set(e,null),null;let o=z.path_get_dirname(e),s=new Map,c=new Map;for(let[e,t]of i.packageRegistryData){let n=new Map;for(let[r,i]of t)n.set(r,i),i.discardFromLookup||c.set(i.packageLocation,{name:e,reference:r});s.set(e,n)}let l={rootDir:o,packages:s,locatorsByLocation:c};return Go.set(e,l),l}function extractRawRuntimeState(e){let t=e.indexOf(`const RAW_RUNTIME_STATE =`);if(t<0)return null;let n=e.indexOf(`'`,t);if(n<0)return null;let r=n+1;for(;r<e.length;){let t=e.charCodeAt(r);if(t===92){r+=2;continue}if(t===39)break;r++}if(r>=e.length)return null;let i=e.slice(n+1,r);i=i.replace(/\\\n/g,``);try{return JSON.parse(i)}catch{return null}}function findPackageOwning(e,t){let n=relativeFromRoot(e.rootDir,t);if(n===null)return null;let r=null;for(let t of e.locatorsByLocation.keys())n.startsWith(t)&&(r===null||t.length>r.length)&&(r=t);if(r===null)return null;let i=e.locatorsByLocation.get(r),o=e.packages.get(i.name)?.get(i.reference);return o?{locator:i,info:o}:null}function resolveBareViaPnp(e,t,n){let r=findPackageOwning(e,n);if(!r)return null;let{pkgName:i,subPath:o}=splitSpecifier(t),s=r.info.packageDependencies?.find(([e])=>e===i);if(!s)return null;let[,c]=s;if(c===null)return null;let l=e.packages.get(i)?.get(c);if(!l)return null;let u=l.packageLocation.startsWith(`/`)?J.File.new_for_path(l.packageLocation):J.File.new_for_path(e.rootDir).resolve_relative_path(stripLeadingDotSlash(l.packageLocation));return(o?u.resolve_relative_path(o):u).get_path()}function splitSpecifier(e){if(e.startsWith(`@`)){let t=e.indexOf(`/`);if(t<0)return{pkgName:e,subPath:``};let n=e.indexOf(`/`,t+1);return n<0?{pkgName:e,subPath:``}:{pkgName:e.slice(0,n),subPath:e.slice(n+1)}}let t=e.indexOf(`/`);return t<0?{pkgName:e,subPath:``}:{pkgName:e.slice(0,t),subPath:e.slice(t+1)}}function stripLeadingDotSlash(e){return e.startsWith(`./`)?e.slice(2):e}function relativeFromRoot(e,t){if(t===e)return`./`;let n=e.endsWith(`/`)?e:e+`/`;return t.startsWith(n)?`./`+t.slice(n.length):null}var Go,Ko=__esmMin(()=>{Wo(),je(),Go=new Map}),qo=__esmMin(()=>{globalThis.imports}),Jo=__esmMin(()=>{qo()}),Yo,cli,Xo=__esmMin(()=>{je(),Yo=new TextDecoder,cli=e=>{let[t,n,r,i]=z.spawn_command_line_sync(e);if(r.byteLength)throw Error(Yo.decode(r));return Yo.decode(n)}}),Zo,readJSON,Qo=__esmMin(()=>{je(),Zo=new TextDecoder,readJSON=e=>{let[t,n]=z.file_get_contents(e);if(t)return JSON.parse(Zo.decode(n));throw Error(`Error on require "${e}"`)}});function existsSync(e){return typeof e!=`string`||e===``?!1:J.File.new_for_path(e).query_exists(null)}var $o=__esmMin(()=>{Wo()}),es,resolve,getPathSeparator,ts=__esmMin(()=>{je(),Wo(),{File:es}=J,resolve=(e,...t)=>{let n=es.new_for_path(e);for(let e of t)n=n.resolve_relative_path(e);return n},getPathSeparator=()=>z.get_current_dir().startsWith(`/`)?`/`:`\\`}),ns=__esmMin(()=>{Xo(),Qo(),$o(),ts()});function isBuiltin(e){let t=e.startsWith(`node:`)?e.slice(5):e,n=t.split(`/`)[0];return rs.includes(t)||rs.includes(n)}function resolveSymlink(e){let t=e.query_info(`standard::`,J.FileQueryInfoFlags.NOFOLLOW_SYMLINKS,null);if(t.get_is_symlink()){let n=t.get_symlink_target(),r=e.get_parent();if(n&&r)return r.resolve_relative_path(n).get_path()}return e.get_path()}function tryJsExtension(e){let t=J.File.new_for_path(e+`.js`);return t.query_exists(null)?t:null}function hasExtension$1(e){return e.includes(`.`)}function isDirectory(e){return J.File.new_for_path(e).query_file_type(J.FileQueryInfoFlags.NONE,null)===J.FileType.DIRECTORY}function resolvePackageEntry(e){let t=resolve(e,`package.json`);if(!t.query_exists(null))return null;let n=readJSON(t.get_path());if(n.exports!==void 0){let t=resolveExportsMap(n.exports,`.`,is);if(t){let n=resolve(e,t);if(n.query_exists(null))return n.get_path()}}let r=n.main||n.module||`index.js`,i=resolve(e,r);if(i.query_exists(null))return i.get_path();if(!hasExtension$1(r)){let e=tryJsExtension(i.get_path());if(e)return e.get_path()}return null}function resolveExportsMap(e,t,n){if(typeof e==`string`)return t===`.`?e:void 0;if(typeof e!=`object`||!e)return;let r=e,i=Object.keys(r).some(e=>e===`.`||e.startsWith(`./`))?r[t]:t===`.`?r:void 0;if(i!=null)return pickConditionalValue(i,n)}function pickConditionalValue(e,t){if(typeof e==`string`)return e;if(typeof e!=`object`||!e)return;let n=e;for(let e of t)if(e in n){let r=pickConditionalValue(n[e],t);if(r!==void 0)return r}if(`default`in n&&!t.includes(`default`))return pickConditionalValue(n.default,t)}function splitBareSpecifier(e){if(e.startsWith(`@`)){let t=e.indexOf(`/`);if(t===-1)return{pkg:e,subpath:`.`};let n=e.indexOf(`/`,t+1);return n===-1?{pkg:e,subpath:`.`}:{pkg:e.slice(0,n),subpath:`.`+e.slice(n)}}let t=e.indexOf(`/`);return t===-1?{pkg:e,subpath:`.`}:{pkg:e.slice(0,t),subpath:`.`+e.slice(t)}}function fileUrlToPath(e){if(typeof e==`object`&&e&&`href`in e){let t=e;if(t.protocol&&t.protocol!==`file:`)throw TypeError(`The URL must use the file: protocol`);return z.filename_from_uri(t.href)[0]}return typeof e==`string`&&e.startsWith(`file:`)?z.filename_from_uri(e)[0]:String(e)}function resolveBareViaPnpFromCaller(e,t){let n=findPnpManifest(t);if(!n)return null;let r=loadPnpManifest(n);if(!r)return null;let i=resolveBareViaPnp(r,e,t);if(!i)return null;let o=J.File.new_for_path(i);return o.query_exists(null)?o:null}function resolveInNodeModules(e,t){let{pkg:n,subpath:r}=splitBareSpecifier(e),i=J.File.new_for_path(t);for(;i.has_parent(null);){let t=i.resolve_relative_path(`node_modules`);if(t.query_exists(null)){let i=t.resolve_relative_path(n);if(i.query_exists(null)){let e=i.resolve_relative_path(`package.json`);if(e.query_exists(null)){let t=readJSON(e.get_path());if(t.exports!==void 0){let e=resolveExportsMap(t.exports,r,is);if(e!==void 0){let t=i.resolve_relative_path(e);if(t.query_exists(null))return t}}}let t=r===`.`?i:i.resolve_relative_path(r.slice(2));if(t.query_exists(null))return t;let n=t.get_basename();if(n&&!hasExtension$1(n)){let e=tryJsExtension(t.get_path());if(e)return e}}else{let n=t.resolve_relative_path(e);if(n.query_exists(null))return n;let r=n.get_basename();if(r&&!hasExtension$1(r)){let e=tryJsExtension(n.get_path());if(e)return e}}}i=i.get_parent()}throw Error(`Cannot find module "${e}" - not found in any node_modules directory`)}function resolveModulePath(e,t){if(isBuiltin(e))return e;let n;if(n=e.startsWith(`/`)?resolve(e):e.startsWith(`.`)?resolve(t,e):resolveBareViaPnpFromCaller(e,t)??resolveInNodeModules(e,t),e.startsWith(`/`)||e.startsWith(`.`)){if(!n.query_exists(null)){let e=n.get_basename();e&&!hasExtension$1(e)&&(n=tryJsExtension(n.get_path())??n)}if(!n.query_exists(null))throw Error(`Cannot find module "${e}"`)}let r=resolveSymlink(n),i=n.get_basename();if(i&&!hasExtension$1(i)){let t=resolvePackageEntry(r);if(t)return t;if(isDirectory(r))throw Error(`Cannot find module "${e}" - ${r} exists but has no resolvable package entry (its package.json exports/main point at a file that does not exist)`)}return r}function requireJsFile(e,t){if(e in t)return t[e];let n=J.File.new_for_path(e),r=n.get_parent().get_path(),i=n.get_basename();if(i.endsWith(`.mjs`))throw Error(`Cannot require .mjs files. Use import instead. Path: "${e}"`);if(i.endsWith(`.cjs`)){let e=resolve(r,`__gjsify__`+i.replace(/\.cjs$/,`.js`));e.query_exists(null)&&e.delete(null),n.copy(e,J.FileCopyFlags.NONE,null,null),n=e,i=n.get_basename()}let o=globalThis.exports,s=globalThis.module,c={exports:{}};globalThis.exports=c.exports,globalThis.module=c;try{let{searchPath:n}=imports;n.unshift(r),imports[i.replace(/\.(js|cjs)$/,``)],n.shift();let o=c.exports;return t[e]=o,o}finally{globalThis.exports=o,globalThis.module=s}}function createRequire(e){let t=fileUrlToPath(e);if(!t.startsWith(`/`))throw TypeError(`The argument must be a file URL object, file URL string, or absolute path string. Received "${String(e)}"`);let n=z.path_get_dirname(t),r=Object.create(null),i=function require(e){let t=resolveModulePath(e,n);if(t in r)return r[t];if(t.endsWith(`.json`)){let e=readJSON(t);return r[t]=e,e}if(isBuiltin(e))throw Error(`createRequire: Cannot require builtin module "${e}" synchronously in GJS. Use import instead.`);return requireJsFile(t,r)};return i.resolve=function resolve(e){return resolveModulePath(e,n)},i.resolve.paths=e=>null,i.cache=r,i.extensions=Object.create(null),i.main=void 0,i}var rs,is,Module,as=__esmMin(()=>{Ko(),Jo(),Wo(),je(),ns(),rs=`assert.async_hooks.buffer.child_process.cluster.console.constants.crypto.dgram.diagnostics_channel.dns.domain.events.fs.http.http2.https.inspector.module.net.os.path.perf_hooks.process.punycode.querystring.readline.repl.stream.string_decoder.sys.timers.tls.tty.url.util.v8.vm.wasi.worker_threads.zlib`.split(`.`),__name(hasExtension$1,`hasExtension`),is=[`node`,`import`,`default`],Module=class{static builtinModules=rs;static isBuiltin=isBuiltin;static createRequire=createRequire;static Module;id;filename=null;loaded=!1;exports={};children=[];paths=[];parent;constructor(e=``,t){this.id=e,this.parent=t}},Module.Module=Module}),os=__exportAll$3({__gjsifyModuleDir:()=>__gjsifyModuleDir$1,__gjsifyModuleFile:()=>__gjsifyModuleFile$1,__gjsifyModuleUrl:()=>__gjsifyModuleUrl,splitPackageSpec:()=>splitPackageSpec});function splitPackageSpec(e){let t=e.split(`/`),n=e.startsWith(`@`)?2:1;return{pkg:t.slice(0,n).join(`/`),subpath:t.slice(n).join(`/`)}}function bundleAnchorUrl(){let e=globalThis.__gjsifyBundleUrl;if(!e)throw Error(`gjsify: __gjsifyBundleUrl is not set — the bundle-URL banner did not run. The module-resolve shim is only valid in single-file app builds (gjsify build --app gjs|node).`);return e}function bundleResolve(){return ss||=createRequire(bundleAnchorUrl()).resolve,ss}function resolvePackageRoot(e){let t=bundleResolve();try{return ht(t(`${e}/package.json`))}catch{let n=t(e),r=`/node_modules/${e}/`,i=n.lastIndexOf(r);return i>=0?n.slice(0,i+r.length-1):ht(n)}}function resolveFile(e){let t=cs.get(e);if(t!==void 0)return t;let n;try{let{pkg:t,subpath:r}=splitPackageSpec(e),i=resolvePackageRoot(t);n=r?ft(i,r):i}catch{n=fileURLToPath(bundleAnchorUrl())}return cs.set(e,n),n}function __gjsifyModuleFile$1(e){return resolveFile(e)}function __gjsifyModuleUrl(e){return pathToFileURL(resolveFile(e)).href}function __gjsifyModuleDir$1(e){return ht(resolveFile(e))}var ss,cs,ls=__esmMin(()=>{as(),Mt(),Ct(),ss=null,cs=new Map,__name(__gjsifyModuleFile$1,`__gjsifyModuleFile`),__name(__gjsifyModuleDir$1,`__gjsifyModuleDir`)}),us,__exportAll,ds=__esmMin(()=>{us=Object.defineProperty,__exportAll=(e,t)=>{let n={};for(var r in e)us(n,r,{get:e[r],enumerable:!0});return t||us(n,Symbol.toStringTag,{value:`Module`}),n}});function normalizePath$1(e){return e instanceof URL||e instanceof jt?fileURLToPath(e):typeof e==`string`?e:e.toString()}function randomName(){return[...[,,,,,,]].map(()=>`0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ`[Math.floor(Math.random()*62)]).join(``)}var fs=__esmMin(()=>{Mt(),__name(normalizePath$1,`normalizePath`)});function createNodeError(e,t,n,r){return typeof e?.code==`string`?e:createNodeError$1(e,t,{path:n.toString(),dest:r?.toString()})}function requireCallback(e,t=`cb`){if(typeof e==`function`)return e;let n=TypeError(`The "${t}" argument must be of type function. Received ${describeReceived(e)}`);throw n.code=`ERR_INVALID_ARG_TYPE`,n}function describeReceived(e){if(e==null)return String(e);if(typeof e==`object`){let t=e.constructor?.name;return`an instance of ${t&&t.length>0?t:`Object`}`}if(typeof e==`string`){let t=e.length>25?`${e.slice(0,25)}...`:e;return t.includes(`'`)?`type string ("${t}")`:`type string ('${t}')`}return typeof e==`bigint`?`type bigint (${e}n)`:typeof e==`symbol`?`type symbol (${e.toString()})`:`type ${typeof e} (${String(e)})`}function invalidState(e){let t=Error(`Invalid state: ${e}`);return t.code=`ERR_INVALID_STATE`,t}var ps=__esmMin(()=>{ve()});function gioEventToNodeType(e){switch(e){case J.FileMonitorEvent.CHANGED:case J.FileMonitorEvent.CHANGES_DONE_HINT:return`change`;case J.FileMonitorEvent.DELETED:case J.FileMonitorEvent.CREATED:case J.FileMonitorEvent.RENAMED:case J.FileMonitorEvent.MOVED_IN:case J.FileMonitorEvent.MOVED_OUT:return`rename`;default:return null}}var WatchTree,ms=__esmMin(()=>{ps(),Wo(),Ct(),ve(),WatchTree=class{_monitors=new Map;_fileMonitors=new Map;_closed=!1;_root;_recursive;_fanOut;_budget;_budgetReported=!1;_onEvent;_onError;constructor(e,t,n,r,i){this._recursive=t,this._onEvent=n,this._onError=r,this._fanOut=i?.fanOut??isDarwin(),this._budget=i?.budget??(this._fanOut?4096:1/0);let o=J.File.new_for_path(e);this._root=o.get_path()??e,this._open(this._root,o),o.query_file_type(J.FileQueryInfoFlags.NONE,null)===J.FileType.DIRECTORY&&(t||this._fanOut)&&this._descend(this._root,!1)}get monitorCount(){return this._monitors.size+this._fileMonitors.size}close(){this._closed=!0;for(let e of this._monitors.values())e.cancel();this._monitors.clear();for(let e of this._fileMonitors.values())e.cancel();this._fileMonitors.clear()}_open(e,t){let n=t.monitor(J.FileMonitorFlags.NONE,null);n.connect(`changed`,(e,t,n,r)=>{this._dispatch(t,r)}),this._monitors.set(e,n)}_watchFile(e){if(this._closed||this._fileMonitors.has(e)||!this._admit(e))return;let t;try{t=J.File.new_for_path(e).monitor(J.FileMonitorFlags.NONE,null)}catch(e){isNotFoundError(e)||this._onError(e);return}t.connect(`changed`,(e,t,n,r)=>{if(gioEventToNodeType(r)!==`change`)return;let i=t.get_path();i!==null&&this._emit(`change`,i)}),this._fileMonitors.set(e,t)}_admit(e){if(this.monitorCount<this._budget)return!0;if(this._budgetReported)return!1;this._budgetReported=!0;let t=Error(`fs.watch: this watch holds its whole budget of ${this._budget} monitors and stopped at ${e}. Anything under ${this._root} that is not already attached is NOT being watched, and no further event will arrive for it. The budget is finite because this host needs a monitor per FILE rather than per directory, and unbounded growth of a shared process resource surfaces as an unrelated allocation failing elsewhere, in a trace that never mentions fs.watch. Watch a narrower directory.`);return t.code=`ERR_FS_WATCH_MONITOR_BUDGET`,t.path=e,this._onError(t),!1}_dispatch(e,t){let n=e.get_path();if(n===null)return;let r=gioEventToNodeType(t);if(r!==null&&this._emit(r,n),!(!this._recursive&&!this._fanOut))switch(t){case J.FileMonitorEvent.CREATED:case J.FileMonitorEvent.MOVED_IN:{let t=e.query_file_type(J.FileQueryInfoFlags.NOFOLLOW_SYMLINKS,null);t===J.FileType.DIRECTORY?this._recursive&&this._addSubtree(n,!0):this._fanOut&&t===J.FileType.REGULAR&&this._watchFile(n);break}case J.FileMonitorEvent.DELETED:case J.FileMonitorEvent.MOVED_OUT:this._dropSubtree(n);break}}_emit(e,t){let n=pt(this._root,t);this._onEvent(e,n===``?gt(t):n)}_addSubtree(e,t){if(!(this._closed||this._monitors.has(e))&&this._admit(e)){try{this._open(e,J.File.new_for_path(e))}catch(e){isNotFoundError(e)||this._onError(e);return}this._descend(e,t)}}_descend(e,t){for(let n of this._children(e)){if(this._closed)return;if(n.isDirectory){if(!this._recursive)continue;t&&this._emit(`rename`,n.path),this._addSubtree(n.path,t)}else t&&this._emit(`rename`,n.path),this._fanOut&&n.isFile&&this._watchFile(n.path)}}_dropSubtree(e){this._fileMonitors.get(e)?.cancel(),this._fileMonitors.delete(e);let t=e+bt;for(let[e,n]of this._fileMonitors)e.startsWith(t)&&(n.cancel(),this._fileMonitors.delete(e));for(let[n,r]of this._monitors)n!==e&&!n.startsWith(t)||(r.cancel(),this._monitors.delete(n))}_children(e){let t;try{t=J.File.new_for_path(e).enumerate_children(`standard::name,standard::type`,J.FileQueryInfoFlags.NOFOLLOW_SYMLINKS,null)}catch(e){return isNotFoundError(e)||this._onError(e),[]}let n=[];try{let r=t.next_file(null);for(;r!==null;){let i=r.get_file_type();n.push({path:ft(e,r.get_name()),isDirectory:i===J.FileType.DIRECTORY,isFile:i===J.FileType.REGULAR}),r=t.next_file(null)}}catch(e){isNotFoundError(e)||this._onError(e)}finally{try{t.close(null)}catch{}}return n}}});async function*watchAsync(e,t){let n=t?.signal;if(n?.aborted)return;let r=normalizePath$1(e),i=[],o=[],s=!1,c=null;function enqueue(e){s||(o.length>0?o.shift().resolve({value:e,done:!1}):i.push(e))}function terminate(){if(!s)for(s=!0;o.length>0;)o.shift().resolve({value:void 0,done:!0})}let l;try{l=new WatchTree(r,t?.recursive===!0,(e,t)=>{enqueue({eventType:e,filename:t})},e=>{c=e,terminate()})}catch{return}let abortHandler=()=>terminate();n?.addEventListener(`abort`,abortHandler);try{for(;!s;){if(i.length>0){yield i.shift();continue}let e=await new Promise(e=>{o.push({resolve:e})});if(e.done)break;yield e.value}if(c!==null)throw c}finally{n?.removeEventListener(`abort`,abortHandler),l.close()}}var hs,FSWatcher,gs=__esmMin(()=>{fs(),ms(),je(),Ke(),hs=new WeakMap,FSWatcher=class extends Ge{constructor(e,t,n){super(),(!t||typeof t!=`object`)&&(t={persistent:!0});let r=t.persistent!==!1,i=new WatchTree(normalizePath$1(e),t.recursive===!0,(e,t)=>{this.emit(`change`,e,t)},e=>{this.emit(`error`,e)}),o=null;r&&(o=z.timeout_add(z.PRIORITY_LOW,2147483647,()=>z.SOURCE_CONTINUE)),hs.set(this,{persistent:r,closed:!1,sourceId:o,tree:i}),n&&this.on(`change`,n)}close(){let e=hs.get(this);e.closed||(e.closed=!0,e.tree.close(),e.sourceId!==null&&(z.source_remove(e.sourceId),e.sourceId=null))}ref(){let e=hs.get(this);return!e.persistent&&!e.closed&&(e.persistent=!0,e.sourceId=z.timeout_add(z.PRIORITY_LOW,2147483647,()=>z.SOURCE_CONTINUE)),this}unref(){let e=hs.get(this);return e.persistent&&(e.persistent=!1,e.sourceId!==null&&(z.source_remove(e.sourceId),e.sourceId=null)),this}}}),_s=__exportAll$3({lchmod:()=>void 0,lchmodAsync:()=>lchmodAsync,lchmodSync:()=>void 0,lchown:()=>lchown,lchownAsync:()=>lchownAsync,lchownSync:()=>lchownSync,lutimes:()=>lutimes,lutimesAsync:()=>lutimesAsync,lutimesSync:()=>lutimesSync,utimes:()=>utimes,utimesAsync:()=>utimesAsync,utimesSync:()=>utimesSync});function toGLibDateTime(e){let t=e instanceof Date?e.getTime():typeof e==`bigint`?Number(e):typeof e==`string`?Date.parse(e):e*1e3;return z.DateTime.new_from_unix_utc(Math.floor(t/1e3))}function setTimestamps(e,t,n,r){let i=J.File.new_for_path(e),o=new J.FileInfo;o.set_modification_date_time(toGLibDateTime(n)),o.set_access_date_time(toGLibDateTime(t)),i.set_attributes_from_info(o,r,null)}function utimesSync(e,t,n){setTimestamps(normalizePath$1(e),t,n,J.FileQueryInfoFlags.NONE)}function utimes(e,t,n,r){requireCallback(r),Promise.resolve().then(()=>utimesSync(e,t,n)).then(()=>r(null),r)}async function utimesAsync(e,t,n){utimesSync(e,t,n)}function lutimesSync(e,t,n){setTimestamps(normalizePath$1(e),t,n,J.FileQueryInfoFlags.NOFOLLOW_SYMLINKS)}function lutimes(e,t,n,r){requireCallback(r),Promise.resolve().then(()=>lutimesSync(e,t,n)).then(()=>r(null),r)}async function lutimesAsync(e,t,n){lutimesSync(e,t,n)}function lchownSync(e,t,n){let r=normalizePath$1(e),i=J.File.new_for_path(r),o=new J.FileInfo;t!==-1&&o.set_attribute_uint32(`unix::uid`,t),n!==-1&&o.set_attribute_uint32(`unix::gid`,n),i.set_attributes_from_info(o,J.FileQueryInfoFlags.NOFOLLOW_SYMLINKS,null)}function lchown(e,t,n,r){requireCallback(r),Promise.resolve().then(()=>lchownSync(e,t,n)).then(()=>r(null),r)}async function lchownAsync(e,t,n){lchownSync(e,t,n)}function lchmodUnsupported(){let e=Error(`The lchmod() method is not implemented`);return e.code=`ERR_METHOD_NOT_IMPLEMENTED`,e}async function lchmodAsync(e,t){throw lchmodUnsupported()}var vs=__esmMin(()=>{fs(),ps(),je(),Wo()}),ys,bs=__esmMin(()=>{ys=n}),xs,Ss=__esmMin(()=>{bs(),xs=ys});function isStdFd(e){return e===0||e===1||e===2}function stdinInput(){return Cs||=xs.InputStream.new(0,!1),Cs}function stdOutput(e){return ws[e]||(ws[e]=xs.OutputStream.new(e,!1)),ws[e]}function readStdFdAll(e){try{let t=e===0?stdinInput():xs.InputStream.new(e,!1),n=[],r=0;for(;;){let e=t.read_bytes(64*1024,null).get_data();if(!e||e.length===0)break;n.push(e),r+=e.length}return concat(n,r)}catch(t){if(e!==0)throw t;let[n,r]=J.File.new_for_path(`/dev/stdin`).load_contents(null);if(!n)throw t;return r}}function readStdFdSync(e,t,n,r){let i=(e===0?stdinInput():xs.InputStream.new(e,!1)).read_bytes(r,null).get_data();return i&&i.length>0?(new Uint8Array(t.buffer,t.byteOffset+n).set(i),i.length):0}function writeStdFdSync(e,t){return stdOutput(e).write_bytes(z.Bytes.new(t),null)}function concat(e,t){if(e.length===1)return e[0];let n=new Uint8Array(t),r=0;for(let t of e)n.set(t,r),r+=t.length;return n}var Cs,ws,Ts=__esmMin(()=>{je(),Wo(),Ss(),Cs=null,ws={}});function getEncodingFromOptions(e={encoding:null,flag:`r`},t=`utf8`){return e===null?t:typeof e==`string`?e:typeof e==`object`&&typeof e.encoding==`string`?e.encoding:t}function encodeUint8Array(e,t){return e===`buffer`?R.from(t):new TextDecoder(e).decode(t)}function decode(e,t){if(t){let n=new TextDecoder(t),r=new TextEncoder;return n.decode(r.encode(e))}else return e}var Es=__esmMin(()=>{Oe()}),Ds,Os=__esmMin(()=>{pe(),Ds=trackedCallback});function createReadStream(e,t){return new ReadStream(e,t)}var ReadStream,ks=__esmMin(()=>{fs(),mc(),Os(),pc(),je(),Wo(),Oe(),Za(),ReadStream=class extends Ka{bytesRead=0;path;pending=!0;fd=null;_ownFd=null;_autoCloseFd=!0;_positional=!1;_gioFile;_inputStream=null;_cancellable=new J.Cancellable;_start;_end;_pos;_reading=!1;_readAgain=!1;_lastSize=64*1024;close(e){this._cancellable.cancel(),this._release(),this.destroy(),e&&e(null)}constructor(e,t){let n=normalizePath$1(e);super({highWaterMark:t?.highWaterMark??64*1024,encoding:t?.encoding,objectMode:!1}),this.path=n,this._gioFile=J.File.new_for_path(n),this._start=t?.start??0,this._end=t?.end??1/0,this._pos=this._start,this._positional=t?.start!==void 0,typeof t?.fd==`number`&&(this._ownFd=t.fd,this.fd=t.fd,this._autoCloseFd=t.autoClose!==!1),this.once(`end`,()=>this._release())}_construct(e){if(this._ownFd!==null){this.pending=!1,e(),this.emit(`open`,this._ownFd),this.emit(`ready`);return}this._gioFile.read_async(z.PRIORITY_DEFAULT,this._cancellable,Ds((t,n)=>{if(this.destroyed){e();return}try{this._inputStream=this._gioFile.read_finish(n),this.pending=!1,this.emit(`open`,0),this.emit(`ready`),this._start>0&&this._inputStream.can_seek()&&this._inputStream.seek(this._start,z.SeekType.SET,null),e()}catch(t){this._cancellable.is_cancelled()||e(t)}}))}_read(e){if(this._lastSize=e,this._reading){this._readAgain=!0;return}this._doRead(e)}_doRead(e){if(this._ownFd!==null){if(this._reading||this.destroyed)return;this._reading=!0,z.timeout_add(z.PRIORITY_DEFAULT,0,()=>(this._reading=!1,this.destroyed||this._readThroughFd(e),z.SOURCE_REMOVE));return}let t=e;if(this._end!==1/0){let n=this._end-this._pos+1;if(n<=0){this.push(null);return}t=Math.min(e,n)}let n=this._inputStream;!n||this.destroyed||(this._reading=!0,n.read_bytes_async(t,z.PRIORITY_DEFAULT,this._cancellable,Ds((e,t)=>{this._reading=!1;try{let e=n.read_bytes_finish(t).get_data();if(!e||e.length===0){this._readAgain=!1,this.push(null);return}this.bytesRead+=e.length,this._pos+=e.length,this.push(R.from(e)),this._readAgain&&!this._reading&&(this._readAgain=!1,this._doRead(this._lastSize))}catch(e){this._readAgain=!1,this._cancellable.is_cancelled()||this.destroy(e)}})))}_readThroughFd(e){try{let t=e;if(this._end!==1/0){let n=this._end-this._pos+1;if(n<=0){this._readAgain=!1,this.push(null);return}t=Math.min(e,n)}let n=fc.getInstance(this._ownFd,`read`),r=R.alloc(t),i=n._readSync(r,0,t,this._positional?this._pos:null);if(i===0){this._readAgain=!1,this.push(null);return}this.bytesRead+=i,this._pos+=i,this.push(r.subarray(0,i))}catch(e){this._readAgain=!1,this.destroy(e)}}_release(){this._inputStream&&=(this._inputStream.close_async(z.PRIORITY_DEFAULT,null,Ds(()=>{})),null),this._releaseFd()}_releaseFd(){if(this._ownFd===null||!this._autoCloseFd)return;let e=this._ownFd;this._ownFd=null,this.fd=null;try{closeSync(e)}catch{}}_destroy(e,t){this._cancellable.cancel(),this._release(),t(e)}}});function openFlagValues(){return isWin32()?Ms:isDarwin()?js:As}function stringFlagBits(e,t){switch(e){case`r`:return t.O_RDONLY;case`rs`:case`sr`:return t.O_RDONLY|t.O_SYNC;case`r+`:return t.O_RDWR;case`rs+`:case`sr+`:return t.O_RDWR|t.O_SYNC;case`w`:return t.O_TRUNC|t.O_CREAT|t.O_WRONLY;case`wx`:case`xw`:return t.O_TRUNC|t.O_CREAT|t.O_WRONLY|t.O_EXCL;case`w+`:return t.O_TRUNC|t.O_CREAT|t.O_RDWR;case`wx+`:case`xw+`:return t.O_TRUNC|t.O_CREAT|t.O_RDWR|t.O_EXCL;case`a`:return t.O_APPEND|t.O_CREAT|t.O_WRONLY;case`ax`:case`xa`:return t.O_APPEND|t.O_CREAT|t.O_WRONLY|t.O_EXCL;case`as`:case`sa`:return t.O_APPEND|t.O_CREAT|t.O_WRONLY|t.O_SYNC;case`a+`:return t.O_APPEND|t.O_CREAT|t.O_RDWR;case`ax+`:case`xa+`:return t.O_APPEND|t.O_CREAT|t.O_RDWR|t.O_EXCL;case`as+`:case`sa+`:return t.O_APPEND|t.O_CREAT|t.O_RDWR|t.O_SYNC;default:return}}function parseOpenFlags(e){let t=openFlagValues(),n;if(e==null)n=t.O_RDONLY;else if(typeof e==`number`)n=e;else{let r=stringFlagBits(e,t);if(r===void 0){let t=TypeError(`Unknown file open flag: ${e}`);throw t.code=`ERR_INVALID_ARG_VALUE`,t}n=r}let r=n&(t.O_RDONLY|t.O_WRONLY|t.O_RDWR);return{posix:n,readable:r===t.O_RDONLY||r===t.O_RDWR,writable:r===t.O_WRONLY||r===t.O_RDWR,append:(n&t.O_APPEND)!==0,creat:(n&t.O_CREAT)!==0,excl:(n&t.O_CREAT)!==0&&(n&t.O_EXCL)!==0,trunc:(n&t.O_TRUNC)!==0,nofollow:t.O_NOFOLLOW!==0&&(n&t.O_NOFOLLOW)!==0,directory:t.O_DIRECTORY!==0&&(n&t.O_DIRECTORY)!==0}}function normalizeMode(e,t){let n=e??t,r=n;if(typeof n==`string`){if(!/^[0-7]+$/.test(n))throw invalidMode(n);r=parseInt(n,8)}if(typeof r!=`number`)throw modeNotANumber(r);if(!Number.isInteger(r))throw modeOutOfRange(`an integer`,r);if(r<0||r>4294967295)throw modeOutOfRange(`>= 0 && <= 4294967295`,r);return r}function invalidMode(e){let t=TypeError(`The argument 'mode' must be a 32-bit unsigned integer or an octal string. Received '${e}'`);return t.code=`ERR_INVALID_ARG_VALUE`,t}function modeNotANumber(e){let t=e==null?String(e):`type ${typeof e} (${describeValue(e)})`,n=TypeError(`The "mode" argument must be of type number. Received ${t}`);return n.code=`ERR_INVALID_ARG_TYPE`,n}function describeValue(e){try{return typeof e==`object`?Object.prototype.toString.call(e):String(e)}catch{return`<unprintable>`}}function modeOutOfRange(e,t){let n=RangeError(`The value of "mode" is out of range. It must be ${e}. Received ${t}`);return n.code=`ERR_OUT_OF_RANGE`,n}var As,js,Ms,Ns=__esmMin(()=>{ve(),As={O_RDONLY:0,O_WRONLY:1,O_RDWR:2,O_CREAT:64,O_EXCL:128,O_NOCTTY:256,O_TRUNC:512,O_APPEND:1024,O_NONBLOCK:2048,O_DSYNC:4096,O_SYNC:1052672,O_DIRECTORY:65536,O_NOFOLLOW:131072},js={O_RDONLY:0,O_WRONLY:1,O_RDWR:2,O_CREAT:512,O_EXCL:2048,O_NOCTTY:131072,O_TRUNC:1024,O_APPEND:8,O_NONBLOCK:4,O_DSYNC:4194304,O_SYNC:128,O_DIRECTORY:1048576,O_NOFOLLOW:256},Ms={O_RDONLY:0,O_WRONLY:1,O_RDWR:2,O_CREAT:256,O_EXCL:1024,O_NOCTTY:0,O_TRUNC:512,O_APPEND:8,O_NONBLOCK:0,O_DSYNC:0,O_SYNC:0,O_DIRECTORY:0,O_NOFOLLOW:0}}),Dirent,Ps=__esmMin(()=>{Wo(),Ct(),Dirent=class{name;parentPath;_isFile=!1;_isDirectory=!1;_isBlockDevice=!1;_isCharacterDevice=!1;_isSymbolicLink=!1;_isFIFO=!1;_isSocket=!1;_file;constructor(e,t,n,r,i){switch(t||=gt(e),this.name=t,this.parentPath=i??ht(e),this._file=J.File.new_for_path(e),n??this._file.query_file_type(J.FileQueryInfoFlags.NONE,null)){case J.FileType.DIRECTORY:this._isDirectory=!0;break;case J.FileType.MOUNTABLE:break;case J.FileType.REGULAR:this._isFile=!0;break;case J.FileType.SYMBOLIC_LINK:case J.FileType.SHORTCUT:this._isSymbolicLink=!0;break;case J.FileType.SPECIAL:this._classifySpecialFile(e,r);break}}_classifySpecialFile(e,t){try{let n=t?.has_attribute(`unix::mode`)===!0?t:J.File.new_for_path(e).query_info(`unix::mode`,J.FileQueryInfoFlags.NONE,null),r=n.has_attribute(`unix::mode`)?n.get_attribute_uint32(`unix::mode`):0;if(r===0)return;switch(r&61440){case 24576:this._isBlockDevice=!0;break;case 8192:this._isCharacterDevice=!0;break;case 49152:this._isSocket=!0;break;case 4096:this._isFIFO=!0;break}}catch{}}isFile(){return this._isFile}isDirectory(){return this._isDirectory}isBlockDevice(){return this._isBlockDevice}isCharacterDevice(){return this._isCharacterDevice}isSymbolicLink(){return this._isSymbolicLink}isFIFO(){return this._isFIFO}isSocket(){return this._isSocket}}});function fsError(e,t,n,r){let i=`${e}: ${describe(e)}, ${t}`;n&&(i+=` '${n}'`),r&&(i+=` -> '${r}'`);let o=Error(i);return o.code=e,o.errno=Fs[e]??-1,o.syscall=t,n&&(o.path=n),r&&(o.dest=r),o}function describe(e){switch(e){case`ENOENT`:return`no such file or directory`;case`EEXIST`:return`file already exists`;case`EACCES`:return`permission denied`;case`EISDIR`:return`illegal operation on a directory`;case`ENOTDIR`:return`not a directory`;case`EBADF`:return`bad file descriptor`;case`EPERM`:return`operation not permitted`;case`EINVAL`:return`invalid argument`;case`ELOOP`:return`too many symbolic links encountered`;case`ENAMETOOLONG`:return`name too long`;case`EMFILE`:return`too many open files`;case`ENFILE`:return`file table overflow`;case`EROFS`:return`read-only file system`;case`ESPIPE`:return`invalid seek`;case`ENXIO`:return`no such device or address`;default:return`i/o error`}}function hasProcFd(){return Is===null&&(Is=z.file_test(`/proc/self/fd`,z.FileTest.IS_DIR)),Is}function fdPath(e){return hasProcFd()?`/proc/self/fd/${e}`:null}function openFd(e,t,n){let r=z.open(e,t.posix,n);if(r<0)throw classifyOpenFailure(e,t);return r}function closeFd(e){z.close(e)}function classifyOpenFailure(e,t){let n=nameTooLong(e,`open`);if(n)return n;let r=J.File.new_for_path(e),i=null,o=!1;try{let e=r.query_info(`standard::type,standard::symlink-target,unix::mode,access::can-read,access::can-write`,J.FileQueryInfoFlags.NOFOLLOW_SYMLINKS,null);answered(e)?i=e:o=!0}catch{i=null}if(o)return refusalNotAboutThePath(e,t,r,null);if(i){if(t.excl)return fsError(`EEXIST`,`open`,e);if(i.get_file_type()===J.FileType.SYMBOLIC_LINK&&!t.nofollow){let n=walkSymlinkChain(r);if(n===`loop`)return fsError(`ELOOP`,`open`,e);if(n===`too-long`)return fsError(`ENAMETOOLONG`,`open`,e);if(n===`dangling`&&!t.creat)return fsError(`ENOENT`,`open`,e)}return i.get_file_type()===J.FileType.DIRECTORY&&t.writable?fsError(`EISDIR`,`open`,e):t.directory&&i.get_file_type()!==J.FileType.DIRECTORY?fsError(`ENOTDIR`,`open`,e):refusalNotAboutThePath(e,t,r,i)}if(ancestorIsNotADirectory(r))return fsError(`ENOTDIR`,`open`,e);if(!t.creat)return fsError(`ENOENT`,`open`,e);let s=r.get_parent();if(!s)return fsError(`ENOENT`,`open`,e);try{s.query_info(`standard::type`,J.FileQueryInfoFlags.NONE,null)}catch{return fsError(`ENOENT`,`open`,e)}return refusalNotAboutThePath(e,t,r,null)}function ancestorIsNotADirectory(e){for(let t=e.get_parent();t;t=t.get_parent()){let e;try{e=t.query_info(`standard::type`,J.FileQueryInfoFlags.NONE,null)}catch{continue}return answered(e)?e.get_file_type()!==J.FileType.DIRECTORY:!1}return!1}function answered(e){return e!==null&&e.has_attribute(`standard::type`)}function nameTooLong(e,t){let n=new TextEncoder;if(n.encode(e).length>4096)return fsError(`ENAMETOOLONG`,t,e);for(let r of splitPathComponents(e))if(n.encode(r).length>255)return fsError(`ENAMETOOLONG`,t,e);return null}function walkSymlinkChain(e){let t=new TextEncoder,n=e;for(let e=0;e<40;e++){let e;try{e=n.query_info(`standard::type,standard::symlink-target`,J.FileQueryInfoFlags.NOFOLLOW_SYMLINKS,null)}catch{return`dangling`}if(!answered(e)||e.get_file_type()!==J.FileType.SYMBOLIC_LINK)return`resolved`;let r=e.get_symlink_target();if(!r)return`dangling`;if(t.encode(r).length>4096)return`too-long`;let i=n.get_parent();n=r.startsWith(`/`)?J.File.new_for_path(r):i?.resolve_relative_path(r)??J.File.new_for_path(r)}return`loop`}function refusalNotAboutThePath(e,t,n,r){let i=z.open(`/dev/null`,0,0);if(i<0)return fsError(`EMFILE`,`open`,e);z.close(i);let o=r!==null&&(r.get_attribute_uint32(`unix::mode`)&146)==0;if((t.writable||t.creat)&&!o)try{if(n.query_filesystem_info(`filesystem::readonly`,null).get_attribute_boolean(`filesystem::readonly`))return fsError(`EROFS`,`open`,e)}catch{}return r&&nothingOnTheOtherEnd(t,r)?fsError(`ENXIO`,`open`,e):fsError(`EACCES`,`open`,e)}function nothingOnTheOtherEnd(e,t){if(!t.has_attribute(`unix::mode`))return!1;let n=t.get_attribute_uint32(`unix::mode`)&61440;if(!(n===8192||n===24576||n===4096))return!1;let permits=e=>t.has_attribute(e)&&t.get_attribute_boolean(e);return!(e.readable&&!permits(`access::can-read`)||e.writable&&!permits(`access::can-write`))}function classifyMkdirFailure(e){let t=nameTooLong(e,`mkdir`);if(t)return t;let n=J.File.new_for_path(e);try{return answered(n.query_info(`standard::type`,J.FileQueryInfoFlags.NOFOLLOW_SYMLINKS,null))?fsError(`EEXIST`,`mkdir`,e):fsError(`EACCES`,`mkdir`,e)}catch{}let r=n.get_parent();if(!r)return fsError(`ENOENT`,`mkdir`,e);try{let t=r.query_info(`standard::type`,J.FileQueryInfoFlags.NONE,null);if(answered(t)&&t.get_file_type()!==J.FileType.DIRECTORY)return fsError(`ENOTDIR`,`mkdir`,e)}catch{return fsError(`ENOENT`,`mkdir`,e)}return fsError(`EACCES`,`mkdir`,e)}function seekHandle(e){let t=Ls.get(e);return t||(t=z.IOChannel.unix_new(e),t.set_encoding(null),t.set_buffered(!1),t.set_close_on_unref(!1),Ls.set(e,t)),t}function input(e){let t=Rs.get(e);return t||(t=xs.InputStream.new(e,!1),Rs.set(e,t)),t}function output(e){let t=zs.get(e);return t||(t=xs.OutputStream.new(e,!1),zs.set(e,t)),t}function isSeekableFd(e,t){let n=Bs.get(e);return n===void 0&&(n=probeSeekable(e,t),Bs.set(e,n)),n}function probeSeekable(e,t){try{let n=J.File.new_for_path(fdPath(e)??t).query_info(`unix::mode`,J.FileQueryInfoFlags.NONE,null);if(n.has_attribute(`unix::mode`)){let e=n.get_attribute_uint32(`unix::mode`)&61440;if(e===4096||e===49152)return!1}}catch{}try{return seekHandle(e).seek_position(0,z.SeekType.CUR),!0}catch{return!1}}function seekFd(e,t){seekHandle(e).seek_position(t,z.SeekType.SET)}function tellFd(e){if(!hasProcFd())return null;try{let[t,n]=z.file_get_contents(`/proc/self/fdinfo/${e}`);if(!t)return null;let r=/^pos:\s*(\d+)/m.exec(new TextDecoder().decode(n));return r?Number(r[1]):null}catch{return null}}function readFd(e,t){return t<=0?new Uint8Array:input(e).read_bytes(t,null).get_data()??new Uint8Array}function writeFd(e,t){if(t.length===0)return 0;let[,n]=output(e).write_all(t,null);return n}function fsyncFd(e){output(e).flush(null),z.fsync(e)}function releaseFd(e){let t=zs.get(e);if(t)try{t.flush(null)}catch{}Ls.delete(e),Rs.delete(e),zs.delete(e),Bs.delete(e)}function sizeOfFd(e,t){let n=fdPath(e)??t,r=J.File.new_for_path(n).query_info(`standard::size`,J.FileQueryInfoFlags.NONE,null);return Number(r.get_size())}function truncateFd(e,t,n){let r=J.File.new_for_path(fdPath(e)??n),i;try{let e=r.append_to(J.FileCreateFlags.NONE,null);try{e.truncate(t,null)}finally{e.close(null)}return}catch(e){i=e}try{let e=r.open_readwrite(null);try{e.get_output_stream().truncate(t,null)}finally{e.close(null)}return}catch{}throw createNodeError(i,`ftruncate`,n)}var Fs,Is,Ls,Rs,zs,Bs,Vs=__esmMin(()=>{ps(),je(),Wo(),ve(),Ss(),Fs={EPERM:-1,ENOENT:-2,EIO:-5,ENXIO:-6,EBADF:-9,EACCES:-13,EEXIST:-17,ENOTDIR:-20,EISDIR:-21,EINVAL:-22,ENFILE:-23,EMFILE:-24,ETXTBSY:-26,ENOSPC:-28,ESPIPE:-29,EROFS:-30,ENAMETOOLONG:-36,ENOTEMPTY:-39,ELOOP:-40},Is=null,Ls=new Map,Rs=new Map,zs=new Map,Bs=new Map});function populateFromInfo(e){let t=e.get_attribute_uint64(`time::access`),n=e.get_attribute_uint32(`time::access-usec`)||0,r=e.get_attribute_uint64(`time::modified`),i=e.get_attribute_uint32(`time::modified-usec`)||0,o=e.get_attribute_uint64(`time::changed`),s=e.get_attribute_uint32(`time::changed-usec`)||0,c=e.get_attribute_uint64(`time::created`),l=e.get_attribute_uint32(`time::created-usec`)||0,u=t*1e3+n/1e3,d=r*1e3+i/1e3,f=o?o*1e3+s/1e3:d,p=c?c*1e3+l/1e3:f;return{dev:e.get_attribute_uint32(`unix::device`)||0,ino:Number(e.get_attribute_uint64(`unix::inode`)||0),mode:e.get_attribute_uint32(`unix::mode`)||0,nlink:e.get_attribute_uint32(`unix::nlink`)||0,uid:e.get_attribute_uint32(`unix::uid`)||0,gid:e.get_attribute_uint32(`unix::gid`)||0,rdev:e.get_attribute_uint32(`unix::rdev`)||0,size:Number(e.get_size()||0),blksize:e.get_attribute_uint32(`unix::block-size`)||4096,blocks:Number(e.get_attribute_uint64(`unix::blocks`)||0),atimeMs:u,mtimeMs:d,ctimeMs:f,birthtimeMs:p,atime:new Date(u),mtime:new Date(d),ctime:new Date(f),birthtime:new Date(p)}}function statsFrom(e,t,n,r){if(!answered(e))throw fsError(`EACCES`,n,t);return r?new BigIntStats(e,t):new Stats(e,t)}var Hs,Stats,BigIntStats,Us=__esmMin(()=>{Ps(),Vs(),Wo(),Ct(),Hs=`standard::*,time::*,unix::*`,Stats=class extends Dirent{dev;ino;mode;nlink;uid;gid;rdev;size;blksize;blocks;atimeMs;mtimeMs;ctimeMs;birthtimeMs;atime;mtime;ctime;birthtime;_info;constructor(e,t,n){let r,i;e instanceof J.FileInfo?(r=e,i=t.toString(),n||=gt(i)):(i=e.toString(),typeof t==`string`&&(n=t),n||=gt(i),r=J.File.new_for_path(i).query_info(Hs,J.FileQueryInfoFlags.NOFOLLOW_SYMLINKS,null)),super(i,n,r.get_file_type(),r),this._info=r;let o=populateFromInfo(r);this.dev=o.dev,this.ino=o.ino,this.mode=o.mode,this.nlink=o.nlink,this.uid=o.uid,this.gid=o.gid,this.rdev=o.rdev,this.size=o.size,this.blksize=o.blksize,this.blocks=o.blocks,this.atimeMs=o.atimeMs,this.mtimeMs=o.mtimeMs,this.ctimeMs=o.ctimeMs,this.birthtimeMs=o.birthtimeMs,this.atime=o.atime,this.mtime=o.mtime,this.ctime=o.ctime,this.birthtime=o.birthtime}},BigIntStats=class extends Dirent{dev;ino;mode;nlink;uid;gid;rdev;size;blksize;blocks;atimeMs;mtimeMs;ctimeMs;birthtimeMs;atimeNs;mtimeNs;ctimeNs;birthtimeNs;atime;mtime;ctime;birthtime;_info;constructor(e,t,n){let r,i;e instanceof J.FileInfo?(r=e,i=t.toString(),n||=gt(i)):(i=e.toString(),typeof t==`string`&&(n=t),n||=gt(i),r=J.File.new_for_path(i).query_info(Hs,J.FileQueryInfoFlags.NOFOLLOW_SYMLINKS,null)),super(i,n,r.get_file_type(),r),this._info=r;let o=populateFromInfo(r);this.dev=BigInt(o.dev),this.ino=BigInt(o.ino),this.mode=BigInt(o.mode),this.nlink=BigInt(o.nlink),this.uid=BigInt(o.uid),this.gid=BigInt(o.gid),this.rdev=BigInt(o.rdev),this.size=BigInt(o.size),this.blksize=BigInt(o.blksize),this.blocks=BigInt(o.blocks),this.atimeMs=BigInt(Math.trunc(o.atimeMs)),this.mtimeMs=BigInt(Math.trunc(o.mtimeMs)),this.ctimeMs=BigInt(Math.trunc(o.ctimeMs)),this.birthtimeMs=BigInt(Math.trunc(o.birthtimeMs)),this.atimeNs=this.atimeMs*1000000n,this.mtimeNs=this.mtimeMs*1000000n,this.ctimeNs=this.ctimeMs*1000000n,this.birthtimeNs=this.birthtimeMs*1000000n,this.atime=o.atime,this.mtime=o.mtime,this.ctime=o.ctime,this.birthtime=o.birthtime}}});function statSync(e,t){let n=normalizePath$1(e);try{return statsFrom(J.File.new_for_path(n).query_info(Hs,J.FileQueryInfoFlags.NONE,null),n,`stat`,t?.bigint)}catch(e){if(t?.throwIfNoEntry===!1&&isNotFoundError(e))return;throw createNodeError(e,`stat`,n)}}function lstatSync(e,t){let n=normalizePath$1(e);try{return statsFrom(J.File.new_for_path(n).query_info(Hs,J.FileQueryInfoFlags.NOFOLLOW_SYMLINKS,null),n,`lstat`,t?.bigint)}catch(e){if(t?.throwIfNoEntry===!1&&isNotFoundError(e))return;throw createNodeError(e,`lstat`,n)}}function readdirSync(e,t){let n=normalizePath$1(e),r=J.File.new_for_path(n).enumerate_children(`standard::name,standard::type`,J.FileQueryInfoFlags.NOFOLLOW_SYMLINKS,null),i=[];try{let e=r.next_file(null);for(;e!==null;)i.push({name:e.get_name(),type:e.get_file_type()}),e=r.next_file(null)}finally{try{r.close(null)}catch{}}let o=[];for(let e of i){let r=ft(n,e.name);if(t?.withFileTypes?o.push(new Dirent(r,e.name,e.type,void 0,n)):o.push(e.name),t?.recursive&&e.type===J.FileType.DIRECTORY){let n=readdirSync(r,t);for(let t of n)typeof t==`string`?o.push(ft(e.name,t)):o.push(t)}}return o}function realpathSync(e){let t=normalizePath$1(e);return resolveEveryComponent(J.File.new_for_path(t),{left:40},t)}function resolveEveryComponent(e,t,n){let r=e.get_parent();return expandSymlinks(r===null?e:J.File.new_for_path(resolveEveryComponent(r,t,n)).get_child(e.get_basename()),t,n)}function expandSymlinks(e,t,n){let r=e;for(;;){let e=r.query_info(`standard::is-symlink,standard::symlink-target`,J.FileQueryInfoFlags.NOFOLLOW_SYMLINKS,null);if(!e.get_is_symlink())return r.get_path();if(--t.left<0)throw Error(`ELOOP: too many levels of symbolic links, realpath '${n}'`);let i=e.get_symlink_target(),o=r.get_parent(),s=z.path_is_absolute(i)?J.File.new_for_path(i):(o??r).resolve_relative_path(i);r=J.File.new_for_path(resolveEveryComponent(s,t,n))}}function symlinkSync(e,t,n){let r=normalizePath$1(t),i=normalizePath$1(e);J.File.new_for_path(r).make_symbolic_link(i,null)}function readFileSync(e,t={encoding:null,flag:`r`}){if(e instanceof fc&&(e=e.fd),typeof e==`number`&&isStdFd(e))return encodeUint8Array(getEncodingFromOptions(t,`buffer`),readStdFdAll(e));if(typeof e==`number`)return encodeUint8Array(getEncodingFromOptions(t,`buffer`),fc.getInstance(e,`read`)._readToEndSync());let n=normalizePath$1(e),r=J.File.new_for_path(n);try{let[e,i]=r.load_contents(null);if(!e)throw createNodeError(Error(`failed to read file`),`read`,n);return encodeUint8Array(getEncodingFromOptions(t,`buffer`),i)}catch(e){throw e.code&&typeof e.code==`string`?e:createNodeError(e,`read`,n)}}function mkdirSync(e,t){let n=!1,r;t!=null&&(typeof t==`object`?(t.recursive&&(n=t.recursive),t.mode!==void 0&&(r=t.mode)):r=t),e=normalizePath$1(e);let i=normalizeMode(r,511);if(n)return mkdirSyncRecursive(e,i);mkdirWithMode(e,i)}function mkdirWithMode(e,t){if(z.mkdir(e,t)!==0)throw classifyMkdirFailure(e)}function mkdirSyncRecursive(e,t){if(z.mkdir(e,t)===0)return e;let n=classifyMkdirFailure(e);if(n.code===`EEXIST`){if(z.file_test(e,z.FileTest.IS_DIR))return;throw n}if(n.code!==`ENOENT`)throw n;let r=ft(e,`..`),i=J.File.new_for_path(r).get_path();if(i===e)throw n;let o=mkdirSyncRecursive(i,t);return mkdirWithMode(e,t),o??e}function rmdirSync(e,t){let n=normalizePath$1(e),r=J.File.new_for_path(n);try{if(r.query_info(`standard::type`,J.FileQueryInfoFlags.NONE,null).get_file_type()!==J.FileType.DIRECTORY)throw createNodeError(Object.assign(Error(),{code:4}),`rmdir`,n);if(r.enumerate_children(`standard::name`,J.FileQueryInfoFlags.NONE,null).next_file(null)!==null)throw createNodeError(Object.assign(Error(),{code:5}),`rmdir`,n);r.delete(null)}catch(e){throw e.code&&typeof e.code==`string`?e:createNodeError(e,`rmdir`,n)}}function unlinkSync(e){let t=normalizePath$1(e),n=J.File.new_for_path(t);try{n.delete(null)}catch(e){throw createNodeError(e,`unlink`,t)}}function writeWholeFile(e,t,n,r){let i=getEncodingFromOptions(n,`utf8`),o=typeof n==`object`&&n?n:{},s=typeof t==`string`?R.from(t,i||`utf8`):t;if(typeof e==`number`||e instanceof fc){if(typeof e==`number`&&isStdFd(e)){writeStdFdSync(e,s);return}fc.getInstance(e,`write`)._writeSync(s,null);return}let c=new fc({path:normalizePath$1(e),flags:o.flag??r,mode:o.mode??438});try{c._writeSync(s,null)}finally{c._closeSync()}}function writeFileSync(e,t,n){writeWholeFile(e,t,n??null,`w`)}function renameSync(e,t){let n=normalizePath$1(e),r=normalizePath$1(t),i=J.File.new_for_path(n),o=J.File.new_for_path(r);try{i.move(o,J.FileCopyFlags.OVERWRITE,null,null)}catch(e){throw createNodeError(e,`rename`,n,r)}}function copyFileSync(e,t,n){let r=normalizePath$1(e),i=normalizePath$1(t),o=J.File.new_for_path(r),s=J.File.new_for_path(i),c=J.FileCopyFlags.NONE;n&&!(n&1)?c=J.FileCopyFlags.OVERWRITE:n||(c=J.FileCopyFlags.OVERWRITE);try{o.copy(s,c,null,null)}catch(e){throw createNodeError(e,`copyfile`,r,i)}stripPrivilegeBitsAfterCopy(s,r,i)}function stripPrivilegeBitsAfterCopy(e,t,n){try{let t=e.query_info(`unix::mode,standard::size`,J.FileQueryInfoFlags.NONE,null);if(t.get_size()===0)return;let n=t.get_attribute_uint32(`unix::mode`),r=n&-2049;if((isDarwin()||n&8)&&(r&=-1025),r===n)return;e.set_attribute_uint32(`unix::mode`,r,J.FileQueryInfoFlags.NONE,null)}catch(e){throw createNodeError(e,`copyfile`,t,n)}}function accessSync(e,t){let n=normalizePath$1(e),r=J.File.new_for_path(n);try{let e=r.query_info(`access::*`,J.FileQueryInfoFlags.NONE,null);if(t!==void 0&&t!==0){let r={code:14,message:`permission denied, access '${n}'`};if(t&4&&!e.get_attribute_boolean(`access::can-read`)||t&2&&!e.get_attribute_boolean(`access::can-write`)||t&1&&!e.get_attribute_boolean(`access::can-execute`))throw createNodeError(r,`access`,n)}}catch(e){throw e.code&&typeof e.code==`string`?e:createNodeError(e,`access`,n)}}function appendFileSync(e,t,n){writeWholeFile(e,t,n??null,`a`)}function readlinkSync(e,t){let n=normalizePath$1(e),r=J.File.new_for_path(n);try{let e=r.query_info(`standard::symlink-target`,J.FileQueryInfoFlags.NOFOLLOW_SYMLINKS,null).get_symlink_target();if(!e)throw Object.assign(Error(`EINVAL: invalid argument, readlink '${n}'`),{code:`EINVAL`,errno:-22,syscall:`readlink`,path:n});return(typeof t==`string`?t:t?.encoding)===`buffer`?R.from(e):e}catch(e){throw typeof e.code==`string`?e:createNodeError(e,`readlink`,n)}}function linkSync(e,t){let n=normalizePath$1(e),r=normalizePath$1(t);if(J.File.new_for_path(n).query_file_type(J.FileQueryInfoFlags.NOFOLLOW_SYMLINKS,null)===J.FileType.UNKNOWN)throw Object.assign(Error(`ENOENT: no such file or directory, link '${n}' -> '${r}'`),{code:`ENOENT`,errno:-2,syscall:`link`,path:n,dest:r});if(J.File.new_for_path(r).query_file_type(J.FileQueryInfoFlags.NOFOLLOW_SYMLINKS,null)!==J.FileType.UNKNOWN)throw Object.assign(Error(`EEXIST: file already exists, link '${n}' -> '${r}'`),{code:`EEXIST`,errno:-17,syscall:`link`,path:n,dest:r});let i=``;try{let[,,e,t]=z.spawn_sync(null,[`ln`,`--`,n,r],null,z.SpawnFlags.SEARCH_PATH,null);if(i=e?new TextDecoder().decode(e).trim():``,!z.spawn_check_wait_status(t))throw Error(`ln exited non-zero (${t})`);return}catch(e){throw i===``&&e instanceof Error&&(i=e.message),Object.assign(Error(`EPERM: operation not permitted, link '${n}' -> '${r}'`+(i?` (${i})`:``)),{code:`EPERM`,errno:-1,syscall:`link`,path:n,dest:r})}}function truncateSync(e,t){let n=normalizePath$1(e),r=J.File.new_for_path(n);try{let e=r.open_readwrite(null);try{e.get_output_stream().truncate(Math.max(0,t??0),null)}finally{e.close(null)}}catch(e){throw createNodeError(e,`truncate`,n)}}function chmodSync(e,t){let n=normalizePath$1(e),r=normalizeMode(t);try{J.File.new_for_path(n).set_attribute_uint32(`unix::mode`,r,J.FileQueryInfoFlags.NONE,null)}catch(e){throw createNodeError(e,`chmod`,n)}}function chownSync(e,t,n){let r=normalizePath$1(e);try{let e=J.File.new_for_path(r),i=new J.FileInfo;t!==-1&&i.set_attribute_uint32(`unix::uid`,t),n!==-1&&i.set_attribute_uint32(`unix::gid`,n),e.set_attributes_from_info(i,J.FileQueryInfoFlags.NONE,null)}catch(e){throw createNodeError(e,`chown`,r)}}function watch(e,t,n){return typeof t==`function`&&(n=t,t=void 0),new FSWatcher(normalizePath$1(e),t,n)}function openSync(e,t,n){return new fc({path:e,flags:t,mode:n})}function mkdtempSync(e,t){let n=getEncodingFromOptions(t),r=mkdtempAt(e);return n===`buffer`?R.from(r):decode(r,n)}function mkdtempAt(e){for(let t=0;t<64;t++){let t=e+randomName();if(z.mkdir(t,448)===0)return t;let n=classifyMkdirFailure(t);if(n.code!==`EEXIST`)throw n.syscall=`mkdtemp`,n}throw fsError(`EEXIST`,`mkdtemp`,e+`XXXXXX`)}function rmSync(e,t){let n=normalizePath$1(e),r=J.File.new_for_path(n),i=t?.recursive||!1,o=t?.force||!1,s;try{s=r.query_file_type(J.FileQueryInfoFlags.NOFOLLOW_SYMLINKS,null)}catch(t){if(o&&isNotFoundError(t))return;throw createNodeError(t,`rm`,e)}if(s===J.FileType.SYMBOLIC_LINK){try{r.delete(null)}catch(t){if(o&&isNotFoundError(t))return;throw createNodeError(t,`rm`,e)}return}if(s===J.FileType.DIRECTORY){let r=readdirSync(e);if(!i&&r.length)throw createNodeError(Object.assign(Error(),{code:5}),`rm`,e);for(let e of r)rmSync(ft(n,e),t)}try{r.delete(null)}catch(t){if(o&&isNotFoundError(t))return;throw createNodeError(t,`rm`,e)}}var Ws=__esmMin(()=>{Es(),fs(),ps(),gs(),Ts(),Ns(),Ps(),Vs(),Us(),pc(),je(),Wo(),Ct(),Oe(),ns(),ve(),realpathSync.native=realpathSync});function makeEEXIST(e){let t=Error(`ERR_FS_CP_EEXIST: file already exists, copyfile '${e}'`);return t.code=`ERR_FS_CP_EEXIST`,t.syscall=`copyfile`,t.path=e,t}function makeEISDIR(e){let t=Error(`ERR_FS_EISDIR: illegal operation on a directory, copyfile '${e}'`);return t.code=`ERR_FS_EISDIR`,t.syscall=`copyfile`,t.path=e,t}function makeENOTDIR(e,t){let n=Error(`ENOTDIR: not a directory, copyfile '${e}' -> '${t}'`);return n.code=`ENOTDIR`,n.syscall=`copyfile`,n.path=e,n.dest=t,n}function makeSubdirOfSelf(e,t){let n=Error(`Cannot copy ${e} to a subdirectory of self ${t}`);return n.code=`ERR_FS_CP_EINVAL`,n}function queryCopyFlags(e){let t=e.force??!0,n=J.FileCopyFlags.NONE;return t&&(n|=J.FileCopyFlags.OVERWRITE),e.preserveTimestamps&&(n|=J.FileCopyFlags.TARGET_DEFAULT_MODIFIED_TIME),e.dereference||(n|=J.FileCopyFlags.NOFOLLOW_SYMLINKS),n}function copyOneSyncFile(e,t,n,r,i){let o=i.force??!0;try{if(t.query_info(`standard::type`,J.FileQueryInfoFlags.NONE,null).get_file_type()===J.FileType.DIRECTORY)throw makeENOTDIR(n,r);if(!o){if(i.errorOnExist)throw makeEEXIST(r);return}}catch(e){if(typeof e.code==`string`)throw e}let s=queryCopyFlags(i);try{e.copy(t,s,null,null)}catch(e){throw createNodeError(e,`copyfile`,n,r)}}function isStrictSubdir(e,t){let n=K(e).split(bt).filter(Boolean),r=K(t).split(bt).filter(Boolean);return r.length>n.length&&n.every((e,t)=>r[t]===e)}function cpOneDirSync(e,t,n,r,i){if(isStrictSubdir(n,r))throw makeSubdirOfSelf(n,r);if(t.query_exists(null))try{if(t.query_info(`standard::type`,J.FileQueryInfoFlags.NONE,null).get_file_type()!==J.FileType.DIRECTORY)throw makeENOTDIR(r,n)}catch(e){if(typeof e.code==`string`)throw e}else try{t.make_directory_with_parents(null)}catch(e){throw createNodeError(e,`mkdir`,r)}let o;try{o=e.enumerate_children(`standard::name,standard::type,standard::is-symlink`,i.dereference?J.FileQueryInfoFlags.NONE:J.FileQueryInfoFlags.NOFOLLOW_SYMLINKS,null)}catch(e){throw createNodeError(e,`scandir`,n)}let s=o.next_file(null);for(;s!==null;){let e=s.get_name(),t=ft(n,e),c=ft(r,e),l=i.filter;if(l&&!l(t,c)){s=o.next_file(null);continue}cpSyncInternal(t,c,i),s=o.next_file(null)}}function cpSyncInternal(e,t,n){let r=J.File.new_for_path(e),i=J.File.new_for_path(t),o;try{o=r.query_info(`standard::type,standard::is-symlink`,n.dereference?J.FileQueryInfoFlags.NONE:J.FileQueryInfoFlags.NOFOLLOW_SYMLINKS,null)}catch(t){throw createNodeError(t,`stat`,e)}if(o.get_file_type()===J.FileType.DIRECTORY){if(!n.recursive)throw makeEISDIR(e);cpOneDirSync(r,i,e,t,n)}else copyOneSyncFile(r,i,e,t,n)}function cpSync(e,t,n){let r=normalizePath$1(e),i=normalizePath$1(t),o=n??{},s=J.File.new_for_path(r),c=o.filter;if(!(c&&!c(r,i))){try{if(s.query_info(`standard::type`,o.dereference?J.FileQueryInfoFlags.NONE:J.FileQueryInfoFlags.NOFOLLOW_SYMLINKS,null).get_file_type()===J.FileType.DIRECTORY&&!o.recursive)throw makeEISDIR(r)}catch(e){throw typeof e.code==`string`?e:createNodeError(e,`stat`,r)}cpSyncInternal(r,i,o)}}function cp(e,t,n,r){let i,o;typeof n==`function`?(o=n,i={}):(o=requireCallback(r),i=n);let s=i.filter;if(s){Promise.resolve(s(normalizePath$1(e),normalizePath$1(t))).then(n=>{if(!n){o(null);return}try{cpPromises(e,t,i).then(()=>o(null)).catch(o)}catch(e){o(e)}}).catch(o);return}Promise.resolve().then(()=>{try{cpSync(e,t,i),o(null)}catch(e){o(e)}})}async function cpPromisesDir(e,t,n){if(isStrictSubdir(e,t))throw makeSubdirOfSelf(e,t);let r=J.File.new_for_path(t);if(!r.query_exists(null))try{r.make_directory_with_parents(null)}catch(e){throw createNodeError(e,`mkdir`,t)}let i=J.File.new_for_path(e),o;try{o=i.enumerate_children(`standard::name,standard::type`,n.dereference?J.FileQueryInfoFlags.NONE:J.FileQueryInfoFlags.NOFOLLOW_SYMLINKS,null)}catch(t){throw createNodeError(t,`scandir`,e)}let s=o.next_file(null);for(;s!==null;){let r=s.get_name(),i=ft(e,r),c=ft(t,r),l=n.filter;if(l&&!await Promise.resolve(l(i,c))){s=o.next_file(null);continue}await cpPromises(i,c,n),s=o.next_file(null)}}async function cpPromises(e,t,n={}){let r=normalizePath$1(e),i=normalizePath$1(t),o=J.File.new_for_path(r),s;try{s=o.query_info(`standard::type`,n.dereference?J.FileQueryInfoFlags.NONE:J.FileQueryInfoFlags.NOFOLLOW_SYMLINKS,null)}catch(e){throw createNodeError(e,`stat`,r)}if(s.get_file_type()===J.FileType.DIRECTORY){if(!n.recursive)throw makeEISDIR(r);await cpPromisesDir(r,i,n)}else copyOneSyncFile(o,J.File.new_for_path(i),r,i,n)}var Gs=__esmMin(()=>{fs(),ps(),Wo(),Ct()});function _openDir(e){let t=J.File.new_for_path(e),n;try{n=t.enumerate_children(Ks,J.FileQueryInfoFlags.NOFOLLOW_SYMLINKS,null)}catch(t){throw createNodeError(t,`opendir`,e)}return new Dir(e,n)}function opendirSync(e){return _openDir(normalizePath$1(e))}function opendir(e,t,n){let r;if(r=typeof t==`function`?t:requireCallback(n,`callback`),typeof r!=`function`)throw TypeError(`The "callback" argument must be of type function`);Promise.resolve().then(()=>{try{let t=opendirSync(e);r(null,t)}catch(e){r(e,null)}})}async function opendirAsync(e,t){return new Promise((t,n)=>{let r=normalizePath$1(e),i=J.File.new_for_path(r);i.enumerate_children_async(Ks,J.FileQueryInfoFlags.NOFOLLOW_SYMLINKS,z.PRIORITY_DEFAULT,null,Ds((e,o)=>{try{let e=i.enumerate_children_finish(o);t(new Dir(r,e))}catch(e){n(createNodeError(e,`opendir`,r))}}))})}var Ks,Dir,qs=__esmMin(()=>{fs(),ps(),Os(),Ps(),je(),Wo(),Ct(),Ks=`standard::name,standard::type,standard::is-symlink,standard::size,standard::symlink-target,unix::uid,unix::gid,unix::mode,time::modified,time::access,time::created`,Dir=class{path;_enumerator;_closed=!1;constructor(e,t){this.path=e,this._enumerator=t}_assertOpen(){if(this._closed){let e=Error(`Directory handle was closed`);throw e.code=`ERR_DIR_CLOSED`,e}}readSync(){this._assertOpen();try{let e=this._enumerator.next_file(null);if(e===null)return null;let t=e.get_name(),n=e.get_file_type();return new Dirent(ft(this.path,t),t,n,void 0,this.path)}catch(e){throw createNodeError(e,`readdir`,this.path)}}read(e){if(e!==void 0){if(typeof e!=`function`)throw TypeError(`The "callback" argument must be of type function`);try{this._assertOpen();let t=this.readSync();Promise.resolve().then(()=>e(null,t))}catch(t){Promise.resolve().then(()=>e(t,null))}return}return new Promise((e,t)=>{try{this._assertOpen(),e(this.readSync())}catch(e){t(e)}})}closeSync(){this._assertOpen(),this._closed=!0;try{this._enumerator.close(null)}catch{}this._enumerator=null}close(e){if(e!==void 0){if(typeof e!=`function`)throw TypeError(`The "callback" argument must be of type function`);try{this.closeSync(),Promise.resolve().then(()=>e(null))}catch(t){Promise.resolve().then(()=>e(t))}return}return new Promise((e,t)=>{try{this.closeSync(),e()}catch(e){t(e)}})}async*[Symbol.asyncIterator](){try{for(;;){let e=await this.read();if(e===null)break;yield e}}finally{this._closed||await this.close()}}}});function segmentToRegexSrc(e){let t=/^([!*+?@])\((.+)\)$/.exec(e);if(t){let[,e,n]=t,r=n.split(`|`).map(e=>segmentToRegexSrc(e)),i=`(?:`+r.join(`|`)+`)`;switch(e){case`!`:return`(?!(?:`+r.join(`|`)+`))[^/]*`;case`*`:return i+`*`;case`+`:return i+`+`;case`?`:return i+`?`;case`@`:return i}}let n=``,r=0;for(;r<e.length;){let t=e[r];if(t===`*`){n+=`[^/]*`,r++;continue}if(t===`?`){n+=`[^/]`,r++;continue}if(t===`[`){let t=e.indexOf(`]`,r+1);if(t===-1){n+=`\\[`,r++;continue}n+=e.slice(r,t+1),r=t+1;continue}if(t===`{`){let t=e.indexOf(`}`,r+1);if(t===-1){n+=`\\{`,r++;continue}let i=e.slice(r+1,t).split(`,`).map(e=>segmentToRegexSrc(e.trim()));n+=`(?:`+i.join(`|`)+`)`,r=t+1;continue}`.+^$|()[]{}`.includes(t)?n+=`\\`+t:n+=t,r++}return n}function globToRegex(e){e=e.replace(/\/+/g,`/`).replace(/^\.\//,``);let t=e.split(`/`),n=[];for(let e=0;e<t.length;e++){let r=t[e],i=e===t.length-1;r===`**`?i?n.length>0&&n[n.length-1]===`/`?(n.pop(),n.push(`(?:/.+)?`)):n.push(`(?:.+)?`):n.push(`(?:[^/]+/)*`):(n.push(segmentToRegexSrc(r)),i||n.push(`/`))}return RegExp(`^(?:`+n.join(``)+`)$`)}function buildExcludePredicate(e){if(!e)return null;if(typeof e==`function`)return e;let t=(Array.isArray(e)?e:[e]).map(e=>globToRegex(e));return e=>t.some(t=>t.test(e))}function matchAll(e,t,n){let r=globToRegex(e),i=buildExcludePredicate(n),o;try{o=readdirSync(t,{recursive:!0})}catch{return[]}let s=[`.`,...o],c=[];for(let e of s){let t=e.replace(/\\/g,`/`);r.test(t)&&(i&&i(t)||c.push(e))}return c}function globSync(e,t){let n=Array.isArray(e)?e:[e],r=t?.cwd?normalizePath$1(t.cwd):globalThis.process?.cwd?.()??`/`,i=t?.exclude,o=new Set,s=[];for(let e of n)for(let t of matchAll(e,r,i))o.has(t)||(o.add(t),s.push(t));return s}function glob(e,t,n){let r,i;typeof t==`function`?(i=t,r={}):(i=requireCallback(n),r=t||{}),Promise.resolve().then(()=>{try{let t=globSync(e,r);i(null,t)}catch(e){i(e,[])}})}async function*globAsync(e,t){let n=globSync(e,t);for(let e of n)yield e}var Js=__esmMin(()=>{fs(),ps(),Ws()});function buildStatFs(e){let t=Number(e.get_attribute_uint64(`filesystem::size`)??0),n=Number(e.get_attribute_uint64(`filesystem::free`)??0),r=Math.floor(t/Xs),i=Math.floor(n/Xs);return{type:0,bsize:Xs,blocks:r,bfree:i,bavail:i,files:0,ffree:0}}function buildBigIntStatFs(e){let t=BigInt(e.get_attribute_uint64(`filesystem::size`)??0),n=BigInt(e.get_attribute_uint64(`filesystem::free`)??0),r=BigInt(Xs),i=t/r,o=n/r;return{type:0n,bsize:r,blocks:i,bfree:o,bavail:o,files:0n,ffree:0n}}function statfsSync(e,t){let n=J.File.new_for_path(normalizePath$1(e)).query_filesystem_info(Ys,null);return t?.bigint===!0?buildBigIntStatFs(n):buildStatFs(n)}function queryFsInfoAsync(e,t){return new Promise((n,r)=>{let i=J.File.new_for_path(normalizePath$1(e));i.query_filesystem_info_async(Ys,z.PRIORITY_DEFAULT,null,Ds((e,o)=>{try{let e=i.query_filesystem_info_finish(o);n(t?buildBigIntStatFs(e):buildStatFs(e))}catch(e){r(e)}}))})}function statfs(e,t,n){let r=typeof t==`function`?t:requireCallback(n);queryFsInfoAsync(e,(typeof t==`function`?{}:t)?.bigint===!0).then(e=>r(null,e),e=>r(e,null))}async function statfsAsync(e,t){return queryFsInfoAsync(e,t?.bigint===!0)}var Ys,Xs,Zs=__esmMin(()=>{fs(),ps(),Os(),je(),Wo(),Ys=[`filesystem::size`,`filesystem::free`].join(`,`),Xs=4096});function openFlagDescriptors(){let e={};for(let t of Object.keys(openFlagValues()))e[t]={enumerable:!0,configurable:!0,get:()=>openFlagValues()[t]};return e}var Qs,$s=__esmMin(()=>{Ns(),Qs=Object.defineProperties({F_OK:0,R_OK:4,W_OK:2,X_OK:1,COPYFILE_EXCL:1,COPYFILE_FICLONE:2,COPYFILE_FICLONE_FORCE:4,S_IFMT:61440,S_IFREG:32768,S_IFDIR:16384,S_IFCHR:8192,S_IFBLK:24576,S_IFIFO:4096,S_IFLNK:40960,S_IFSOCK:49152,S_IRWXU:448,S_IRUSR:256,S_IWUSR:128,S_IXUSR:64,S_IRWXG:56,S_IRGRP:32,S_IWGRP:16,S_IXGRP:8,S_IRWXO:7,S_IROTH:4,S_IWOTH:2,S_IXOTH:1},openFlagDescriptors())});async function mkdir$1(e,t){return mkdirSync(normalizePath$1(e),t)}async function readFile$1(e,t={encoding:null,flag:`r`}){if(e instanceof fc||typeof e==`number`){let n=fc.getInstance(e,`read`);return encodeUint8Array(getEncodingFromOptions(t,`buffer`),n._readToEndSync())}let n=normalizePath$1(e),r=J.File.new_for_path(n),i,o;try{[i,o]=await new Promise((e,t)=>{r.load_contents_async(null,Ds((n,i)=>{try{e(r.load_contents_finish(i))}catch(e){t(e)}}))})}catch(e){throw createNodeError(e,`open`,n)}if(!i)throw createNodeError(Error(`failed to read file`),`open`,n);return encodeUint8Array(getEncodingFromOptions(t,`buffer`),o)}async function mkdtemp$1(e,t){let n=getEncodingFromOptions(t);return decode(mkdtempAt(e),n)}async function writeFile$2(e,t,n){writeFileSync(e,typeof t==`string`||t instanceof Uint8Array?t:String(t),n??null)}async function rmdir$1(e,t){let n=normalizePath$1(e),r=J.File.new_for_path(n);if((await new Promise((e,t)=>{r.query_info_async(`standard::type`,J.FileQueryInfoFlags.NONE,z.PRIORITY_DEFAULT,null,Ds((i,o)=>{try{e(r.query_info_finish(o))}catch(e){t(createNodeError(e,`rmdir`,n))}}))})).get_file_type()!==J.FileType.DIRECTORY)throw createNodeError(Object.assign(Error(),{code:4}),`rmdir`,n);if((await new Promise((e,t)=>{r.enumerate_children_async(`standard::name`,J.FileQueryInfoFlags.NONE,z.PRIORITY_DEFAULT,null,Ds((i,o)=>{try{e(r.enumerate_children_finish(o))}catch(e){t(createNodeError(e,`rmdir`,n))}}))})).next_file(null)!==null)throw createNodeError(Object.assign(Error(),{code:5}),`rmdir`,n);await new Promise((e,t)=>{r.delete_async(z.PRIORITY_DEFAULT,null,Ds((i,o)=>{try{r.delete_finish(o),e()}catch(e){t(createNodeError(e,`rmdir`,n))}}))})}async function unlink$1(e){let t=normalizePath$1(e),n=J.File.new_for_path(t);await new Promise((e,r)=>{n.delete_async(z.PRIORITY_DEFAULT,null,Ds((i,o)=>{try{n.delete_finish(o),e()}catch(e){r(createNodeError(e,`unlink`,t))}}))})}async function open$2(e,t,n){return new fc({path:e,flags:t,mode:n})}async function write$1(e,t,n,r,i){return typeof t==`string`?_writeStr(e,t,n,r):_writeBuf(e,t,n,r,i)}async function _writeBuf(e,t,n,r,i){return{bytesWritten:(await fc.getInstance(e,`write`).write(t,n,r,i)).bytesWritten,buffer:t}}async function _writeStr(e,t,n,r){return{bytesWritten:(await fc.getInstance(e,`write`).write(t,n,r)).bytesWritten,buffer:t}}function queryInfoAsync(e,t,n,r){let i=normalizePath$1(e);return new Promise((e,o)=>{let s=J.File.new_for_path(i);s.query_info_async(Hs,t,z.PRIORITY_DEFAULT,null,Ds((t,c)=>{try{e(statsFrom(s.query_info_finish(c),i,n,r?.bigint))}catch(e){o(createNodeError(e,n,i))}}))})}async function stat$1(e,t){return queryInfoAsync(e,J.FileQueryInfoFlags.NONE,`stat`,t)}async function lstat$1(e,t){return queryInfoAsync(e,J.FileQueryInfoFlags.NOFOLLOW_SYMLINKS,`lstat`,t)}async function readdir$1(e,t){try{return readdirSync(e,t)}catch(t){throw createNodeError(t,`scandir`,e)}}async function realpath$1(e){return realpathSync(e)}async function symlink$1(e,t,n){let r=normalizePath$1(t),i=normalizePath$1(e);return new Promise((e,t)=>{let n=J.File.new_for_path(r);n.make_symbolic_link_async(i,z.PRIORITY_DEFAULT,null,Ds((o,s)=>{try{n.make_symbolic_link_finish(s),e()}catch(e){t(createNodeError(e,`symlink`,i,r))}}))})}async function rm$1(e,t){let n=normalizePath$1(e),r=J.File.new_for_path(n),i=t?.recursive||!1,o=t?.force||!1,s;try{s=r.query_file_type(J.FileQueryInfoFlags.NOFOLLOW_SYMLINKS,null)}catch(t){if(o)return;throw createNodeError(t,`rm`,e)}if(s===J.FileType.SYMBOLIC_LINK){await new Promise((t,n)=>{r.delete_async(z.PRIORITY_DEFAULT,null,Ds((i,s)=>{try{r.delete_finish(s),t()}catch(r){if(o){t();return}n(createNodeError(r,`rm`,e))}}))});return}if(s===J.FileType.DIRECTORY){let r=await readdir$1(e,{withFileTypes:!0});if(!i&&r.length)throw createNodeError(Object.assign(Error(),{code:5}),`rm`,e);for(let e of r)typeof e!=`string`&&await rm$1(ft(n,e.name),t)}await new Promise((t,n)=>{r.delete_async(z.PRIORITY_DEFAULT,null,Ds((i,s)=>{try{r.delete_finish(s),t()}catch(r){if(o){t();return}n(createNodeError(r,`rm`,e))}}))})}async function rename$1(e,t){renameSync(e,t)}async function copyFile$1(e,t,n){copyFileSync(e,t,n)}async function access$1(e,t){accessSync(e,t)}async function appendFile$1(e,t,n){appendFileSync(e,t,n)}async function readlink$1(e,t){return readlinkSync(e,t)}async function truncate$1(e,t){truncateSync(e,t)}async function chmod$1(e,t){chmodSync(e,t)}async function chown$1(e,t,n){chownSync(e,t,n)}async function link$1(e,t){linkSync(e,t)}var ec,tc,nc=__esmMin(()=>{ds(),Es(),fs(),ps(),gs(),vs(),mc(),Os(),Us(),pc(),Ws(),Gs(),qs(),Js(),Zs(),$s(),je(),Wo(),Ct(),ec=__exportAll({access:()=>access$1,appendFile:()=>appendFile$1,chmod:()=>chmod$1,chown:()=>chown$1,constants:()=>Qs,copyFile:()=>copyFile$1,cp:()=>cpPromises,default:()=>tc,fchmod:()=>fchmodAsync,fchown:()=>fchownAsync,fdatasync:()=>fdatasyncAsync,fstat:()=>fstatAsync,fsync:()=>fsyncAsync,ftruncate:()=>ftruncateAsync,futimes:()=>futimesAsync,glob:()=>globAsync,lchmod:()=>lchmodAsync,lchown:()=>lchownAsync,link:()=>link$1,lstat:()=>lstat$1,lutimes:()=>lutimesAsync,mkdir:()=>mkdir$1,mkdtemp:()=>mkdtemp$1,open:()=>open$2,openAsBlob:()=>openAsBlob,opendir:()=>opendirAsync,readFile:()=>readFile$1,readdir:()=>readdir$1,readlink:()=>readlink$1,readv:()=>readvAsync,realpath:()=>realpath$1,rename:()=>rename$1,rm:()=>rm$1,rmdir:()=>rmdir$1,stat:()=>stat$1,statfs:()=>statfsAsync,symlink:()=>symlink$1,truncate:()=>truncate$1,unlink:()=>unlink$1,utimes:()=>utimesAsync,watch:()=>watchAsync,write:()=>write$1,writeFile:()=>writeFile$2,writev:()=>writevAsync}),__name(mkdir$1,`mkdir`),__name(readFile$1,`readFile`),__name(mkdtemp$1,`mkdtemp`),__name(writeFile$2,`writeFile`),__name(rmdir$1,`rmdir`),__name(unlink$1,`unlink`),__name(open$2,`open`),__name(write$1,`write`),__name(stat$1,`stat`),__name(lstat$1,`lstat`),__name(readdir$1,`readdir`),__name(realpath$1,`realpath`),__name(symlink$1,`symlink`),__name(rm$1,`rm`),__name(rename$1,`rename`),__name(copyFile$1,`copyFile`),__name(access$1,`access`),__name(appendFile$1,`appendFile`),__name(readlink$1,`readlink`),__name(truncate$1,`truncate`),__name(chmod$1,`chmod`),__name(chown$1,`chown`),__name(link$1,`link`),tc={readFile:readFile$1,mkdir:mkdir$1,mkdtemp:mkdtemp$1,realpath:realpath$1,readdir:readdir$1,writeFile:writeFile$2,rmdir:rmdir$1,unlink:unlink$1,open:open$2,write:write$1,rm:rm$1,lstat:lstat$1,symlink:symlink$1,stat:stat$1,rename:rename$1,copyFile:copyFile$1,access:access$1,appendFile:appendFile$1,readlink:readlink$1,truncate:truncate$1,chmod:chmod$1,chown:chown$1,link:link$1,cp:cpPromises,opendir:opendirAsync,glob:globAsync,watch:watchAsync,statfs:statfsAsync,utimes:utimesAsync,lutimes:lutimesAsync,lchown:lchownAsync,lchmod:lchmodAsync,fstat:fstatAsync,ftruncate:ftruncateAsync,fdatasync:fdatasyncAsync,fsync:fsyncAsync,fchmod:fchmodAsync,fchown:fchownAsync,futimes:futimesAsync,readv:readvAsync,writev:writevAsync,openAsBlob,constants:Qs}});function withHandle(e,t,n){try{return fc.getInstance(e,t)}catch(e){return Promise.resolve().then(()=>n(e)),null}}function parseOptsCb(e,t){return typeof e==`function`?{options:{},callback:e}:{options:e??{},callback:requireCallback(t)}}function statImpl(e,t,n,r,i){let o=normalizePath$1(e),s=J.File.new_for_path(o);s.query_info_async(Hs,t,z.PRIORITY_DEFAULT,null,Ds((e,t)=>{try{i(null,statsFrom(s.query_info_finish(t),o,n,r?.bigint))}catch(e){i(createNodeError(e,n,o))}}))}function stat(e,t,n){let{options:r,callback:i}=parseOptsCb(t,n);statImpl(e,J.FileQueryInfoFlags.NONE,`stat`,r,i)}function lstat(e,t,n){let{options:r,callback:i}=parseOptsCb(t,n);statImpl(e,J.FileQueryInfoFlags.NOFOLLOW_SYMLINKS,`lstat`,r,i)}function readdir(e,t,n){let{options:r,callback:i}=parseOptsCb(t,n);Promise.resolve().then(()=>{try{i(null,readdirSync(e,r))}catch(t){i(createNodeError(t,`readdir`,e))}})}function realpath(e,t,n){let{callback:r}=parseOptsCb(t,n);Promise.resolve().then(()=>{try{r(null,realpathSync(e))}catch(e){r(e)}})}function symlink(e,t,n,r){let i=typeof n==`function`?n:requireCallback(r);if(typeof i!=`function`)throw TypeError(`Callback must be a function. Received `+typeof i);let o=normalizePath$1(t),s=normalizePath$1(e),c=J.File.new_for_path(o);c.make_symbolic_link_async(s,z.PRIORITY_DEFAULT,null,Ds((e,t)=>{try{c.make_symbolic_link_finish(t),i(null)}catch(e){i(createNodeError(e,`symlink`,s,o))}}))}function open$1(e,...t){let n,r,i;switch(t.length){case 1:i=t[0];break;case 2:n=t[0],i=t[1];break;case 3:n=t[0],r=t[1],i=t[2];break;default:break}let o=requireCallback(i);open$2(e,n,r).then(e=>{o(null,e.fd)}).catch(e=>{o(e,-1)})}function write(e,t,...n){requireCallback(n[n.length-1]);let r=withHandle(e,`write`,e=>{let r=n[n.length-1];typeof t==`string`?r(e,0,``):r(e,0,R.from([]))});if(!r)return;if(typeof t==`string`){let e=n.pop(),i=n[0],o=n[1];r.write(t,i,o).then(t=>{e(null,t.bytesWritten,t.buffer)}).catch(t=>{e(t,0,``)});return}let i=n[n.length-1],o=n[0],s=n[1],c=n[2];r.write(t,o,s,c).then(e=>{i(null,e.bytesWritten,e.buffer)}).catch(e=>{i(e,0,R.from([]))})}function read(e,...t){let n=requireCallback(t[t.length-1]),r=withHandle(e,`read`,e=>{typeof n==`function`&&n(e,0,R.from([]))});if(!r)return;let i,o,s,c;if(!(t.length<=1))if(typeof t[0]==`object`&&!ArrayBuffer.isView(t[0])){let e=t[0];i=e.buffer,o=e.offset,s=e.length,c=e.position}else i=t[0],o=t[1],s=t[2],c=t[3];r.read(i,o,s,c).then(e=>{n(null,e.bytesRead,e.buffer)}).catch(e=>{n(e,0,R.from([]))})}function close$1(e,t){let done=e=>{typeof t==`function`&&t(e)},n=withHandle(e,`close`,done);n&&n.close().then(()=>done(null)).catch(e=>done(e))}function rm(e,...t){let n={},r=t[t.length-1];t.length>=2&&(n=t[0]),rm$1(e,n).then(()=>{r(null)}).catch(e=>{r(e)})}function rename(e,t,n){requireCallback(n),Promise.resolve().then(()=>{try{renameSync(e,t),n(null)}catch(e){n(e)}})}function copyFile(e,t,n,r){let i=typeof n==`function`?0:n,o=typeof n==`function`?n:requireCallback(r);Promise.resolve().then(()=>{try{copyFileSync(e,t,i),o(null)}catch(e){o(e)}})}function access(e,t,n){let r=typeof t==`function`?void 0:t,i=typeof t==`function`?t:requireCallback(n);Promise.resolve().then(()=>{try{accessSync(e,r),i(null)}catch(e){i(e)}})}function appendFile(e,t,n,r){let i=typeof n==`function`?n:requireCallback(r),o=typeof n==`function`?void 0:n;Promise.resolve().then(()=>{try{appendFileSync(e,t,o),i(null)}catch(e){i(e)}})}function readlink(e,t,n){let r=typeof t==`function`?t:requireCallback(n),i=typeof t==`function`?void 0:t;Promise.resolve().then(()=>{try{r(null,readlinkSync(e,i))}catch(e){r(e,``)}})}function truncate(e,t,n){let r=typeof t==`function`?0:t,i=typeof t==`function`?t:requireCallback(n);Promise.resolve().then(()=>{try{truncateSync(e,r),i(null)}catch(e){i(e)}})}function chmod(e,t,n){requireCallback(n),Promise.resolve().then(()=>{try{chmodSync(e,t),n(null)}catch(e){n(e)}})}function chown(e,t,n,r){requireCallback(r),Promise.resolve().then(()=>{try{chownSync(e,t,n),r(null)}catch(e){r(e)}})}function mkdir(e,t,n){let r=typeof t==`function`?t:requireCallback(n),i=typeof t==`function`?void 0:t;Promise.resolve().then(()=>{try{mkdirSync(e,i),r(null)}catch(e){r(e)}})}function mkdtemp(e,t,n){let r=typeof t==`function`?t:requireCallback(n),i=typeof t==`function`?void 0:t;Promise.resolve().then(()=>{let t;try{t=mkdtempSync(e,i)}catch(e){r(e,void 0);return}r(null,t)})}function rmdir(e,t,n){let r=typeof t==`function`?t:requireCallback(n),i=typeof t==`function`?void 0:t;Promise.resolve().then(()=>{try{rmdirSync(e,i),r(null)}catch(e){r(e)}})}function readFile(e,t,n){let r=typeof t==`function`?t:requireCallback(n),i=typeof t==`function`?void 0:t;Promise.resolve().then(()=>{try{let t=typeof i==`string`?{encoding:i,flag:`r`}:{encoding:i?.encoding??null,flag:i?.flag??`r`};r(null,readFileSync(e,t))}catch(e){r(e,null)}})}function writeFile$1(e,t,n,r){let i=typeof n==`function`?n:requireCallback(r),o=typeof n==`function`?void 0:n;Promise.resolve().then(()=>{try{writeFileSync(e,t,o),i(null)}catch(e){i(e)}})}function link(e,t,n){requireCallback(n),Promise.resolve().then(()=>{try{linkSync(e,t),n(null)}catch(e){n(e)}})}function unlink(e,t){requireCallback(t);let n=normalizePath$1(e);Promise.resolve().then(()=>{z.unlink(n),t(null)})}var rc=__esmMin(()=>{fs(),ps(),Os(),Us(),pc(),Ws(),nc(),je(),Wo(),Oe(),realpath.native=realpath,__name(open$1,`open`),__name(close$1,`close`),__name(writeFile$1,`writeFile`)});function toPathIfFileURL(e){return normalizePath$1(e)}function createWriteStream(e,t){return new WriteStream(e,t)}var ic,ac,WriteStream,oc=__esmMin(()=>{fs(),Ns(),rc(),Za(),ic=Symbol(`kIsPerformingIO`),ac=Symbol(`kIoDone`),WriteStream=class extends qa{close(e,t=null){let done=t=>{typeof e==`function`&&e(t)};if(this.fd===null||!this._autoClose)this.fd=null,done(t);else{let e=this._fdFromHandle;close$1(this.fd,n=>{let r=e&&n?.code===`EBADF`?null:n;done(r||t)}),this.fd=null}}bytesWritten=0;path;pending;fd=null;flags=`w`;mode=438;pos=void 0;_autoClose=!0;_fdFromHandle=!1;[ic]=!1;constructor(e,t={}){super(t),this.path=toPathIfFileURL(e),t.flags!==void 0&&(this.flags=t.flags),t.mode!==void 0&&(this.mode=normalizeMode(t.mode,438)),t.start!==void 0&&(this.pos=t.start),t.encoding&&this.setDefaultEncoding(t.encoding),typeof t.fd==`number`?(this.fd=t.fd,this._autoClose=t.autoClose??!0,this._fdFromHandle=t.fdFromHandle===!0):t.autoClose!==void 0&&(this._autoClose=t.autoClose),this.pending=this.fd===null}_construct(e){if(this.fd!==null){e(),this.emit(`open`,this.fd),this.emit(`ready`);return}open$1(this.path.toString(),this.flags,this.mode,(t,n)=>{if(t){e(t);return}this.fd=n,this.pending=!1,e(),this.emit(`open`,this.fd),this.emit(`ready`)})}_write(e,t,n){this[ic]=!0,write(this.fd,e,0,e.length,this.pos??null,(e,t)=>{if(this[ic]=!1,this.destroyed)return n(e),this.emit(ac,e);if(e)return n(e);this.bytesWritten+=t,n()}),this.pos!==void 0&&(this.pos+=e.length)}_destroy(e,t){this[ic]?this.once(ac,n=>this.close(t,e||n)):this.close(t,e)}}});function createInterface(e,t,n,r){return typeof e==`object`&&e&&!(`read`in e&&typeof e.read==`function`)?new Interface(e):new Interface({input:e,output:t,completer:n,terminal:r})}function*emitKeys(e){for(;;){let t=yield,n=t,r=!1,i={sequence:``,name:void 0,ctrl:!1,meta:!1,shift:!1};if(t===`\x1B`&&(r=!0,n+=t=yield,t===`\x1B`&&(n+=t=yield)),r&&(t===`O`||t===`[`)){let e=t,r=0;if(t===`O`)n+=t=yield,t>=`0`&&t<=`9`&&(r=t.charCodeAt(0)-1,n+=t=yield),e+=t;else if(t===`[`){n+=t=yield,t===`[`&&(e+=t,n+=t=yield);let i=n.length-1;t>=`0`&&t<=`9`&&(n+=t=yield,t>=`0`&&t<=`9`&&(n+=t=yield,t>=`0`&&t<=`9`&&(n+=t=yield))),t===`;`&&(n+=t=yield,t>=`0`&&t<=`9`&&(n+=yield));let o=n.slice(i),s;(s=/^(?:(\d\d?)(?:;(\d))?([~^$])|(\d{3}~))$/.exec(o))?s[4]?e+=s[4]:(e+=s[1]+s[3],r=(parseInt(s[2]??`1`,10)||1)-1):(s=/^((\d;)?(\d))?([A-Za-z])$/.exec(o))?(e+=s[4],r=(parseInt(s[3]??`1`,10)||1)-1):e+=o}switch(i.ctrl=!!(r&4),i.meta=!!(r&10),i.shift=!!(r&1),i.code=e,e){case`[P`:case`OP`:case`[11~`:case`[[A`:i.name=`f1`;break;case`[Q`:case`OQ`:case`[12~`:case`[[B`:i.name=`f2`;break;case`[R`:case`OR`:case`[13~`:case`[[C`:i.name=`f3`;break;case`[S`:case`OS`:case`[14~`:case`[[D`:i.name=`f4`;break;case`[15~`:case`[[E`:i.name=`f5`;break;case`[17~`:i.name=`f6`;break;case`[18~`:i.name=`f7`;break;case`[19~`:i.name=`f8`;break;case`[20~`:i.name=`f9`;break;case`[21~`:i.name=`f10`;break;case`[23~`:i.name=`f11`;break;case`[24~`:i.name=`f12`;break;case`[200~`:i.name=`paste-start`;break;case`[201~`:i.name=`paste-end`;break;case`[A`:case`OA`:i.name=`up`;break;case`[B`:case`OB`:i.name=`down`;break;case`[C`:case`OC`:i.name=`right`;break;case`[D`:case`OD`:i.name=`left`;break;case`[E`:case`OE`:i.name=`clear`;break;case`[F`:case`OF`:i.name=`end`;break;case`[H`:case`OH`:i.name=`home`;break;case`[1~`:i.name=`home`;break;case`[2~`:i.name=`insert`;break;case`[3~`:i.name=`delete`;break;case`[4~`:i.name=`end`;break;case`[5~`:case`[[5~`:i.name=`pageup`;break;case`[6~`:case`[[6~`:i.name=`pagedown`;break;case`[7~`:i.name=`home`;break;case`[8~`:i.name=`end`;break;case`[a`:i.name=`up`,i.shift=!0;break;case`[b`:i.name=`down`,i.shift=!0;break;case`[c`:i.name=`right`,i.shift=!0;break;case`[d`:i.name=`left`,i.shift=!0;break;case`[2$`:i.name=`insert`,i.shift=!0;break;case`[3$`:i.name=`delete`,i.shift=!0;break;case`[5$`:i.name=`pageup`,i.shift=!0;break;case`[6$`:i.name=`pagedown`,i.shift=!0;break;case`[7$`:i.name=`home`,i.shift=!0;break;case`[8$`:i.name=`end`,i.shift=!0;break;case`Oa`:i.name=`up`,i.ctrl=!0;break;case`Ob`:i.name=`down`,i.ctrl=!0;break;case`Oc`:i.name=`right`,i.ctrl=!0;break;case`Od`:i.name=`left`,i.ctrl=!0;break;case`[2^`:i.name=`insert`,i.ctrl=!0;break;case`[3^`:i.name=`delete`,i.ctrl=!0;break;case`[5^`:i.name=`pageup`,i.ctrl=!0;break;case`[6^`:i.name=`pagedown`,i.ctrl=!0;break;case`[7^`:i.name=`home`,i.ctrl=!0;break;case`[8^`:i.name=`end`,i.ctrl=!0;break;case`[Z`:i.name=`tab`,i.shift=!0;break;default:i.name=`undefined`;break}}else t===`\r`?(i.name=`return`,i.meta=r):t===`
27
27
  `?(i.name=`enter`,i.meta=r):t===` `?(i.name=`tab`,i.meta=r):t===`\b`||t===``?(i.name=`backspace`,i.meta=r):t===`\x1B`?(i.name=`escape`,i.meta=r):t===` `?(i.name=`space`,i.meta=r):!r&&t<=``?(i.name=String.fromCharCode(t.charCodeAt(0)+97-1),i.ctrl=!0):/^[0-9A-Za-z]$/.test(t)?(i.name=t.toLowerCase(),i.shift=/^[A-Z]$/.test(t),i.meta=r):r&&(i.name=t.length?void 0:`escape`,i.meta=!0);i.sequence=n,n.length!==0&&(i.name!==void 0||r)?e.emit(`keypress`,r?void 0:n,i):n.length===1&&e.emit(`keypress`,n,i)}}function emitKeypressEvents(e,t={}){let n=e;if(n[lc])return;n[lc]=new qe(`utf8`),n[uc]=emitKeys(e),n[uc].next();let r=t.escapeCodeTimeout??500,i,triggerEscape=()=>n[uc].next(``);function onData(t){if(e.listenerCount(`keypress`)>0){let o=n[lc].write(typeof t==`string`?Buffer.from(t):t);if(o){clearTimeout(i);for(let t of o)try{n[uc].next(t),t===`\x1B`&&(i=setTimeout(triggerEscape,r))}catch{n[uc]=emitKeys(e),n[uc].next()}}}else e.removeListener(`data`,onData),delete n[lc],delete n[uc]}e.on(`data`,onData)}var sc,Interface,cc,lc,uc,dc=__esmMin(()=>{Ke(),U(),sc=/\r\n|\r|\n/,Interface=class extends Ge{terminal;line=``;cursor=0;escapeCodeTimeout;_input;_output;get input(){return this._input}get output(){return this._output}_prompt;_closed=!1;_paused=!1;history;_historySize;_crlfDelay;_lineBuffer=``;_questionCallback=null;_boundOnData=null;_boundOnEnd=null;_boundOnError=null;_boundOnKeypress=null;constructor(e,t){super();let n;if(n=e&&typeof e==`object`&&!(`read`in e&&typeof e.read==`function`)?e:{input:e,output:t},this._input=n.input||null,this._output=n.output||null,this._prompt=n.prompt||`> `,this.terminal=n.terminal??this._output!==null,this._historySize=n.historySize??30,this.history=[],this._crlfDelay=n.crlfDelay??100,this.escapeCodeTimeout=n.escapeCodeTimeout,this._input&&(this._boundOnData=e=>this._onData(e),this._boundOnEnd=()=>this._onEnd(),this._boundOnError=e=>this.emit(`error`,e),this._input.on(`data`,this._boundOnData),this._input.on(`end`,this._boundOnEnd),this._input.on(`error`,this._boundOnError),`setEncoding`in this._input&&typeof this._input.setEncoding==`function`&&this._input.setEncoding(`utf8`),this.terminal)){emitKeypressEvents(this._input,this);let e=this._input;typeof e.setRawMode==`function`&&(e.isRaw||e.setRawMode(!0)),typeof this._input.resume==`function`&&this._input.resume(),this._boundOnKeypress=(e,t)=>{if(t){if(t.ctrl&&t.name===`c`){this.listenerCount(`SIGINT`)>0?this.emit(`SIGINT`):this.close();return}if(t.name===`return`||t.name===`enter`){this._output?.write(`\r
28
- `);let e=this.line;this.line=``,this.cursor=0,this._onLine(e);return}if(t.name===`backspace`||t.name===`delete`){this.cursor>0&&(this.line=this.line.slice(0,this.cursor-1)+this.line.slice(this.cursor),this.cursor--,this._output?.write(`\b \b`));return}e&&e.length===1&&!t.ctrl&&!t.meta&&t.name!==`escape`&&(this.line=this.line.slice(0,this.cursor)+e+this.line.slice(this.cursor),this.cursor++,this._output?.write(e))}},this._input.on(`keypress`,this._boundOnKeypress)}}_onData(e){if(this._closed||this._paused||this.terminal)return;let t=typeof e==`string`?e:e.toString(`utf8`);this._lineBuffer+=t;let n;for(;(n=sc.exec(this._lineBuffer))!==null;){let e=this._lineBuffer.substring(0,n.index);this._lineBuffer=this._lineBuffer.substring(n.index+n[0].length),this._onLine(e)}}_onLine(e){if(e.length>0&&this._historySize>0&&(this.history.length===0||this.history[0]!==e)&&(this.history.unshift(e),this.history.length>this._historySize&&this.history.pop()),this._questionCallback){let t=this._questionCallback;this._questionCallback=null,t(e)}this.emit(`line`,e)}_onEnd(){let e=this.terminal?this.line:this._lineBuffer;e.length>0&&(this._onLine(e),this._lineBuffer=``),this.close()}setPrompt(e){this._prompt=e}getPrompt(){return this._prompt}prompt(e){if(this._closed)throw Error(`readline was closed`);this._output?.write(this._prompt)}question(e,t,n){if(this._closed)throw Error(`readline was closed`);let r=typeof t==`function`?t:n;this._questionCallback=r,this._output?.write(e)}clearLine(e,t){return this.line=``,this.cursor=0,t&&t(),!0}write(e,t){if(!this._closed){if(t){this._input&&this._input.emit(`keypress`,e??``,t);return}if(e!=null){let t=typeof e==`string`?e:e.toString(`utf8`);t&&(this.line=this.line.slice(0,this.cursor)+t+this.line.slice(this.cursor),this.cursor+=t.length),this._output?.write(e)}}}close(){if(!this._closed){if(this._closed=!0,this._input){this._boundOnData&&this._input.removeListener(`data`,this._boundOnData),this._boundOnEnd&&this._input.removeListener(`end`,this._boundOnEnd),this._boundOnError&&this._input.removeListener(`error`,this._boundOnError),this._boundOnKeypress&&this._input.removeListener(`keypress`,this._boundOnKeypress),this._boundOnData=null,this._boundOnEnd=null,this._boundOnError=null,this._boundOnKeypress=null;let e=this._input;this.terminal&&e.isRaw&&typeof e.setRawMode==`function`&&e.setRawMode(!1),typeof this._input.pause==`function`&&this._input.pause()}this.emit(`close`)}}pause(){return this._closed?this:(this._paused=!0,this._input&&`pause`in this._input&&typeof this._input.pause==`function`&&this._input.pause(),this.emit(`pause`),this)}resume(){return this._closed?this:(this._paused=!1,this._input&&`resume`in this._input&&typeof this._input.resume==`function`&&this._input.resume(),this.emit(`resume`),this)}getCursorPos(){let e=this._output?.columns??80,t=this._prompt.length+this.cursor;return{rows:Math.floor(t/e),cols:t%e}}[Symbol.asyncIterator](){let e=[],t=null,n=!1,onLine=n=>{if(t){let e=t;t=null,e({value:n,done:!1})}else e.push(n)},onClose=()=>{if(n=!0,t){let e=t;t=null,e({value:void 0,done:!0})}};return this.on(`line`,onLine),this.on(`close`,onClose),{next:()=>e.length>0?Promise.resolve({value:e.shift(),done:!1}):n?Promise.resolve({value:void 0,done:!0}):new Promise(e=>{t=e}),return:()=>(n=!0,this.removeListener(`line`,onLine),this.removeListener(`close`,onClose),Promise.resolve({value:void 0,done:!0})),[Symbol.asyncIterator](){return this}}}},cc=Symbol.dispose??Symbol.for(`Symbol.dispose`),Interface.prototype[cc]=function(){this.close()},lc=Symbol(`keypress-decoder`),uc=Symbol(`escape-decoder`)}),fc,pc=__esmMin(()=>{Es(),gs(),_s(),Os(),ks(),Ns(),oc(),Vs(),Us(),Ws(),je(),Wo(),Oe(),dc(),fc=class FileHandle{options;_gFile;_pathStr;_spec;_pos=0;_closed=!1;_webStreamLocked=!1;static instances={};constructor(e){this.options=e,this.options.flags??=`r`;let t=normalizePath$1(e.path);this._spec=parseOpenFlags(this.options.flags),this.options.mode??=438;let n=normalizeMode(this.options.mode,438);return this.fd=openFd(t,this._spec,n),this._pathStr=t,this._gFile=J.File.new_for_path(t),FileHandle.instances[this.fd]=this,FileHandle.getInstance(this.fd)}_readCore(e,t,n,r){if(this._assertOpen(`read`),!this._spec.readable)throw fsError(`EBADF`,`read`,this._pathStr);if(n>e.byteLength-t){let r=RangeError(`The value of "length" is out of range. It must be <= ${e.byteLength-t}. Received ${n}`);throw r.code=`ERR_OUT_OF_RANGE`,r}let i=r!=null&&r>=0,o=isSeekableFd(this.fd,this._pathStr);if(i&&!o)throw fsError(`ESPIPE`,`read`,this._pathStr);let s=i?r:this._pos;o&&seekFd(this.fd,s);let c=readFd(this.fd,n);return c.length>0&&new Uint8Array(e.buffer,e.byteOffset+t,c.length).set(c),!i&&o&&(this._pos=s+c.length),c.length}_writeCore(e,t){if(this._assertOpen(`write`),!this._spec.writable)throw fsError(`EBADF`,`write`,this._pathStr);if(this._spec.append){let t=writeFd(this.fd,e);return this._pos=tellFd(this.fd)??sizeOfFd(this.fd,this._pathStr),t}let n=t!=null&&t>=0,r=isSeekableFd(this.fd,this._pathStr);if(n&&!r)throw fsError(`ESPIPE`,`write`,this._pathStr);let i=n?t:this._pos;r&&seekFd(this.fd,i);let o=writeFd(this.fd,e);return!n&&r&&(this._pos=i+o),o}_assertOpen(e){if(this._closed)throw fsError(`EBADF`,e,this._pathStr)}_truncateCore(e){if(this._assertOpen(`ftruncate`),!this._spec.writable)throw fsError(`EINVAL`,`ftruncate`,this._pathStr);truncateFd(this.fd,Math.max(0,e),this._pathStr)}_readToEnd(){let e=[],t=0;for(;;){let n=new Uint8Array(64*1024),r=this._readCore(n,0,n.length,null);if(r===0)break;e.push(n.subarray(0,r)),t+=r}let n=new Uint8Array(t),r=0;for(let t of e)n.set(t,r),r+=t.length;return n}_fdTarget(){return fdPath(this.fd)??this._pathStr}fd;static getInstance(e,t=`read`){let n=e instanceof FileHandle?e.fd:e,r=FileHandle.instances[n];if(!r)throw fsError(`EBADF`,t);return r}async appendFile(e,t){await this.writeFile(e,t)}async chown(e,t){this._assertOpen(`fchown`),chownSync(normalizePath$1(this.options.path),e,t)}async chmod(e){this._assertOpen(`fchmod`),chmodSync(this._fdTarget(),e)}createReadStream(e){return new ReadStream(this.options.path,{...e,fd:this.fd})}createWriteStream(e){return new WriteStream(this.options.path,{...e,fd:this.fd,fdFromHandle:!0})}async datasync(){this._assertOpen(`fdatasync`),fsyncFd(this.fd)}async sync(){this._assertOpen(`fsync`),fsyncFd(this.fd)}async read(...e){let t,n,r,i;if(typeof e[0]==`object`&&!(e[0]instanceof Uint8Array)&&!(e[0]instanceof R)){let o=e[0];t=o.buffer,n=o.offset,r=o.length,i=o.position}else t=e[0],n=e[1],r=e[2],i=e[3];let o=t,s=n??0,c=r??(o?o.byteLength-s:65536);return{bytesRead:this._readCore(t,s,c,i??null),buffer:t}}readableWebStream(){if(this._closed)throw invalidState(`The FileHandle is closed`);if(this._webStreamLocked)throw invalidState(`The FileHandle is locked`);let e=globalThis.ReadableStream;if(typeof e!=`function`)throw Error(`readableWebStream() requires a global ReadableStream. Import "node:stream/web" or "@gjsify/web-streams/register" before calling this method.`);return this._webStreamLocked=!0,new e({type:`bytes`,pull:e=>{if(this._closed){e.close(),e.byobRequest?.respond(0);return}let t=e.byobRequest?.view,n=t?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):new Uint8Array(64*1024),r;try{r=this._readCore(n,0,n.length,null)}catch(t){e.error(t);return}if(r===0){e.close(),e.byobRequest?.respond(0);return}if(e.byobRequest){e.byobRequest.respond(r);return}e.enqueue(n.subarray(0,r))}})}async readFile(e){return encodeUint8Array(getEncodingFromOptions(e,`buffer`),this._readToEnd())}readLines(e){return createInterface({input:this.createReadStream(e),crlfDelay:1/0})}async stat(e){this._assertOpen(`fstat`);let t=J.File.new_for_path(this._fdTarget());return statsFrom(await new Promise((e,n)=>{t.query_info_async(Hs,J.FileQueryInfoFlags.NONE,z.PRIORITY_DEFAULT,null,Ds((r,i)=>{try{e(t.query_info_finish(i))}catch(e){n(e)}}))}),this._pathStr,`fstat`,e?.bigint)}async truncate(e=0){this._truncateCore(e)}async utimes(e,t){this._assertOpen(`futimes`);let{utimesSync:n}=await Promise.resolve().then(()=>(Ss(),xs));n(normalizePath$1(this.options.path),e,t)}async writeFile(e,t){let n=getEncodingFromOptions(t),r;r=typeof e==`string`?R.from(e,n||`utf8`):e,this._writeCore(r,null)}async write(e,...t){let n=null,r=null,i=null,o=null;typeof e==`string`?(n=t[0],r=t[1]):(i=t[0],o=t[1],n=t[2]),r=getEncodingFromOptions(r,typeof e==`string`?`utf8`:null);let s;s=typeof e==`string`?new TextEncoder().encode(e):e;let c=i??0,l=o??s.byteLength-c,u=s.subarray(c,c+l);return{bytesWritten:this._writeCore(u,n??null),buffer:e}}async writev(e,t){let n=0;for(let r of e){let e=R.from(r.buffer,r.byteOffset,r.byteLength),i=await this.write(e,0,e.byteLength,t==null?null:t+n);n+=i.bytesWritten}return{bytesWritten:n,buffers:e}}async readv(e,t){let n=0;for(let r of e){let e=await this.read({buffer:R.from(r.buffer,r.byteOffset,r.byteLength),position:t==null?null:t+n});if(n+=e.bytesRead,e.bytesRead<r.byteLength)break}return{bytesRead:n,buffers:e}}_flushSync(){fsyncFd(this.fd)}_closeSync(){this._teardown()}_readSync(e,t,n,r){return this._readCore(e,t,n,r)}_writeSync(e,t){return this._writeCore(e,t)}_readToEndSync(){return this._readToEnd()}_truncateSync(e){this._truncateCore(e)}_fdStatTarget(){return this._fdTarget()}_teardown(){if(this._closed)return;this._closed=!0,releaseFd(this.fd),closeFd(this.fd);let e=FileHandle;delete e.instances[this.fd]}async close(){this._teardown()}async[Symbol.asyncDispose](){await this.close()}pull(...e){throw Error('FileHandle.pull() is not implemented in @gjsify/fs yet — requires `node:stream/iter` (Node 25.9+) which @gjsify/stream has not ported. Track gjsify Open TODO "Node 25 stream/iter integration".')}writer(e){throw Error('FileHandle.writer() is not implemented in @gjsify/fs yet — requires `node:stream/iter` (Node 25.9+) which @gjsify/stream has not ported. Track gjsify Open TODO "Node 25 stream/iter integration".')}}});function getFH(e,t){return fc.getInstance(e,t)}function fstatSync(e,t){return statSync(getFH(e,`fstat`)._fdStatTarget(),t)}function fstat(e,t,n){let r=typeof t==`function`?t:requireCallback(n);fstatAsync(e,typeof t==`function`?{}:t).then(e=>r(null,e),e=>r(e,void 0))}async function fstatAsync(e,t){return t?.bigint,fstatSync(e,t)}function ftruncateSync(e,t=0){getFH(e,`ftruncate`)._truncateSync(t)}function ftruncate(e,t,n){let r=typeof t==`function`?t:requireCallback(n);ftruncateAsync(e,typeof t==`function`?0:t).then(()=>r(null),r)}async function ftruncateAsync(e,t=0){ftruncateSync(e,t)}function fdatasyncSync(e){getFH(e,`fdatasync`)._flushSync()}function fdatasync(e,t){requireCallback(t),Promise.resolve().then(()=>fdatasyncSync(e)).then(()=>t(null),t)}async function fdatasyncAsync(e){fdatasyncSync(e)}function fsyncSync(e){getFH(e,`fsync`)._flushSync()}function fsync(e,t){requireCallback(t),Promise.resolve().then(()=>fsyncSync(e)).then(()=>t(null),t)}async function fsyncAsync(e){fsyncSync(e)}function fchmodSync(e,t){chmodSync(getFH(e,`fchmod`)._fdStatTarget(),t)}function fchmod(e,t,n){requireCallback(n),Promise.resolve().then(()=>fchmodSync(e,t)).then(()=>n(null),n)}async function fchmodAsync(e,t){fchmodSync(e,t)}function fchownSync(e,t,n){chownSync(normalizePath$1(getFH(e,`fchown`).options.path),t,n)}function fchown(e,t,n,r){requireCallback(r),Promise.resolve().then(()=>fchownSync(e,t,n)).then(()=>r(null),r)}async function fchownAsync(e,t,n){fchownSync(e,t,n)}function futimesSync(e,t,n){utimesSync(normalizePath$1(getFH(e,`futimes`).options.path),t,n)}function futimes(e,t,n,r){requireCallback(r),Promise.resolve().then(()=>futimesSync(e,t,n)).then(()=>r(null),r)}async function futimesAsync(e,t,n){futimesSync(e,t,n)}function closeSync(e){isStdFd(e)||getFH(e,`close`)._closeSync()}function readSync(e,t,n,r,i){let o=0;return typeof n==`object`&&n?(o=n.offset??0,r=n.length??t.byteLength-o,i=n.position??null):(o=n??0,r??=t.byteLength-o),isStdFd(e)?readStdFdSync(e,t,o,r):getFH(e,`read`)._readSync(t,o,r,i??null)}function writeSync(e,t,n,r,i){let o;if(typeof t==`string`)o=new TextEncoder().encode(t),typeof n==`number`&&(i=n);else{let e=typeof n==`number`?n:0,i=typeof r==`number`?r:t.byteLength-e;o=new Uint8Array(t.buffer,t.byteOffset+e,i)}return isStdFd(e)?writeStdFdSync(e,o):getFH(e,`write`)._writeSync(o,i??null)}function readvSync(e,t,n){let r=0;for(let i of t){let t=readSync(e,i,0,i.byteLength,n==null?null:n+r);if(r+=t,t<i.byteLength)break}return r}function readv(e,t,n,r){let i=typeof n==`function`?n:requireCallback(r);readvAsync(e,t,typeof n==`function`?null:n).then(e=>i(null,e.bytesRead,e.buffers),e=>i(e,0,t))}async function readvAsync(e,t,n){return{bytesRead:readvSync(e,t,n),buffers:t}}function writevSync(e,t,n){let r=0;for(let i of t){let t=writeSync(e,i,0,i.byteLength,n==null?null:n+r);r+=t}return r}function writev(e,t,n,r){let i=typeof n==`function`?n:requireCallback(r);writevAsync(e,t,typeof n==`function`?null:n).then(e=>i(null,e.bytesWritten,e.buffers),e=>i(e,0,t))}async function writevAsync(e,t,n){return{bytesWritten:writevSync(e,t,n),buffers:t}}function exists(e,t){requireCallback(t);let n;try{statSync(normalizePath$1(e)),n=!0}catch{n=!1}Promise.resolve().then(()=>t(n))}async function openAsBlob(e,t){let n=readFileSync(normalizePath$1(e));return new Blob([n],{type:t?.type??``})}var mc=__esmMin(()=>{gs(),_s(),Ss(),Ts(),pc(),Ws(),Object.defineProperty(exists,Symbol.for(`nodejs.util.promisify.custom`),{value:e=>new Promise(t=>exists(e,t))})});function zeroedStat(){return{dev:0,ino:0,mode:0,nlink:0,uid:0,gid:0,rdev:0,size:0,blksize:0,blocks:0,atimeMs:0,mtimeMs:0,ctimeMs:0,birthtimeMs:0,atime:new Date(0),mtime:new Date(0),ctime:new Date(0),birthtime:new Date(0),isFile:()=>!1,isDirectory:()=>!1,isBlockDevice:()=>!1,isCharacterDevice:()=>!1,isSymbolicLink:()=>!1,isFIFO:()=>!1,isSocket:()=>!1}}function watchFile$1(e,t,n){typeof t==`function`&&(n=t,t={}),requireCallback(n,`listener`);let r=t.interval??5007,i=e.toString(),o=hc.get(i);return o||(o=new StatWatcher(i,r),o.start(),hc.set(i,o)),n&&o.addChangeListener(n),o}function unwatchFile(e,t){let n=e.toString(),r=hc.get(n);r&&(t?r.removeChangeListener(t):r.removeAllChangeListeners(),r.changeListenerCount===0&&(r.stop(),hc.delete(n)))}var StatWatcher,hc,gc=__esmMin(()=>{_s(),Ws(),Ke(),StatWatcher=class extends Ge{_path;_interval;_timerId=null;_prev;_changeCount=0;constructor(e,t){super(),this._path=e,this._interval=t,this._prev=zeroedStat()}start(){try{this._prev=statSync(this._path)}catch{}this._timerId=setInterval(()=>{let e;try{e=statSync(this._path)}catch{e=zeroedStat()}let t=this._prev;(e.mtimeMs!==t.mtimeMs||e.size!==t.size||e.ino!==t.ino)&&(this._prev=e,this.emit(`change`,e,t))},this._interval)}stop(){this._timerId!==null&&(clearInterval(this._timerId),this._timerId=null),this.emit(`stop`)}addChangeListener(e){this._changeCount++,this.on(`change`,e)}removeChangeListener(e){this._changeCount--,this.removeListener(`change`,e)}removeAllChangeListeners(){this._changeCount=0,this.removeAllListeners(`change`)}get changeListenerCount(){return this._changeCount}},hc=new Map,__name(watchFile$1,`watchFile`)}),_c=__exportAll$3({BigIntStats:()=>BigIntStats,Dir:()=>Dir,Dirent:()=>Dirent,FSWatcher:()=>FSWatcher,ReadStream:()=>ReadStream,StatWatcher:()=>StatWatcher,Stats:()=>Stats,WriteStream:()=>WriteStream,access:()=>access,accessSync:()=>accessSync,appendFile:()=>appendFile,appendFileSync:()=>appendFileSync,chmod:()=>chmod,chmodSync:()=>chmodSync,chown:()=>chown,chownSync:()=>chownSync,close:()=>close$1,closeSync:()=>closeSync,constants:()=>Qs,copyFile:()=>copyFile,copyFileSync:()=>copyFileSync,cp:()=>cp,cpSync:()=>cpSync,createReadStream:()=>createReadStream,createWriteStream:()=>createWriteStream,default:()=>vc,exists:()=>exists,existsSync:()=>existsSync,fchmod:()=>fchmod,fchmodSync:()=>fchmodSync,fchown:()=>fchown,fchownSync:()=>fchownSync,fdatasync:()=>fdatasync,fdatasyncSync:()=>fdatasyncSync,fstat:()=>fstat,fstatSync:()=>fstatSync,fsync:()=>fsync,fsyncSync:()=>fsyncSync,ftruncate:()=>ftruncate,ftruncateSync:()=>ftruncateSync,futimes:()=>futimes,futimesSync:()=>futimesSync,glob:()=>glob,globSync:()=>globSync,lchmod:()=>void 0,lchmodSync:()=>void 0,lchown:()=>lchown,lchownSync:()=>lchownSync,link:()=>link,linkSync:()=>linkSync,lstat:()=>lstat,lstatSync:()=>lstatSync,lutimes:()=>lutimes,lutimesSync:()=>lutimesSync,mkdir:()=>mkdir,mkdirSync:()=>mkdirSync,mkdtemp:()=>mkdtemp,mkdtempSync:()=>mkdtempSync,"module.exports":()=>vc,open:()=>open$1,openAsBlob:()=>openAsBlob,openSync:()=>openSync,opendir:()=>opendir,opendirSync:()=>opendirSync,promises:()=>ec,read:()=>read,readFile:()=>readFile,readFileSync:()=>readFileSync,readSync:()=>readSync,readdir:()=>readdir,readdirSync:()=>readdirSync,readlink:()=>readlink,readlinkSync:()=>readlinkSync,readv:()=>readv,readvSync:()=>readvSync,realpath:()=>realpath,realpathSync:()=>realpathSync,rename:()=>rename,renameSync:()=>renameSync,rm:()=>rm,rmSync:()=>rmSync,rmdir:()=>rmdir,rmdirSync:()=>rmdirSync,stat:()=>stat,statSync:()=>statSync,statfs:()=>statfs,statfsSync:()=>statfsSync,symlink:()=>symlink,symlinkSync:()=>symlinkSync,truncate:()=>truncate,truncateSync:()=>truncateSync,unlink:()=>unlink,unlinkSync:()=>unlinkSync,unwatchFile:()=>unwatchFile,utimes:()=>utimes,utimesSync:()=>utimesSync,watch:()=>watch,watchFile:()=>watchFile$1,write:()=>write,writeFile:()=>writeFile$1,writeFileSync:()=>writeFileSync,writeSync:()=>writeSync,writev:()=>writev,writevSync:()=>writevSync}),vc,yc=__esmMin(()=>{bs(),Ss(),mc(),ks(),oc(),Ps(),Us(),Ws(),Gs(),qs(),Js(),Zs(),$s(),nc(),rc(),gc(),vc={FSWatcher,StatWatcher,Stats,BigIntStats,Dirent,Dir,constants:Qs,existsSync,readdirSync,readFileSync,writeFileSync,mkdirSync,rmdirSync,unlinkSync,mkdtemp,mkdtempSync,rmSync,statSync,openSync,realpathSync,symlinkSync,lstatSync,renameSync,copyFileSync,accessSync,appendFileSync,readlinkSync,linkSync,truncateSync,chmodSync,chownSync,cpSync,opendirSync,globSync,glob,watch,watchFile:watchFile$1,unwatchFile,statfsSync,statfs,utimesSync,utimes,lutimesSync,lutimes,lchownSync,lchown,lchmodSync:void 0,lchmod:void 0,fstatSync,fstat,ftruncateSync,ftruncate,fdatasyncSync,fdatasync,fsyncSync,fsync,fchmodSync,fchmod,fchownSync,fchown,futimesSync,futimes,closeSync,readSync,writeSync,readvSync,readv,writevSync,writev,exists,openAsBlob,createReadStream,ReadStream,createWriteStream,WriteStream,promises:ec,open:open$1,close:close$1,read,write,rm,realpath,readdir,symlink,lstat,stat,rename,copyFile,cp,access,appendFile,readlink,truncate,chmod,chown,mkdir,rmdir,readFile,writeFile:writeFile$1,unlink,link,opendir}}),bc,xc=__esmMin(()=>{bc={UV_UDP_REUSEADDR:4,errno:{E2BIG:7,EACCES:13,EADDRINUSE:98,EADDRNOTAVAIL:99,EAFNOSUPPORT:97,EAGAIN:11,EALREADY:114,EBADF:9,EBADMSG:74,EBUSY:16,ECANCELED:125,ECHILD:10,ECONNABORTED:103,ECONNREFUSED:111,ECONNRESET:104,EDEADLK:35,EDESTADDRREQ:89,EDOM:33,EDQUOT:122,EEXIST:17,EFAULT:14,EFBIG:27,EHOSTUNREACH:113,EIDRM:43,EILSEQ:84,EINPROGRESS:115,EINTR:4,EINVAL:22,EIO:5,EISCONN:106,EISDIR:21,ELOOP:40,EMFILE:24,EMLINK:31,EMSGSIZE:90,EMULTIHOP:72,ENAMETOOLONG:36,ENETDOWN:100,ENETRESET:102,ENETUNREACH:101,ENFILE:23,ENOBUFS:105,ENODATA:61,ENODEV:19,ENOENT:2,ENOEXEC:8,ENOLCK:37,ENOLINK:67,ENOMEM:12,ENOMSG:42,ENOPROTOOPT:92,ENOSPC:28,ENOSR:63,ENOSTR:60,ENOSYS:38,ENOTCONN:107,ENOTDIR:20,ENOTEMPTY:39,ENOTSOCK:88,ENOTSUP:95,ENOTTY:25,ENXIO:6,EOPNOTSUPP:95,EOVERFLOW:75,EPERM:1,EPIPE:32,EPROTO:71,EPROTONOSUPPORT:93,EPROTOTYPE:91,ERANGE:34,EROFS:30,ESPIPE:29,ESRCH:3,ESTALE:116,ETIME:62,ETIMEDOUT:110,ETXTBSY:26,EWOULDBLOCK:11,EXDEV:18},priority:{PRIORITY_LOW:19,PRIORITY_BELOW_NORMAL:10,PRIORITY_NORMAL:0,PRIORITY_ABOVE_NORMAL:-7,PRIORITY_HIGH:-14,PRIORITY_HIGHEST:-20},dlopen:{RTLD_LAZY:1,RTLD_NOW:2,RTLD_GLOBAL:256,RTLD_LOCAL:0,RTLD_DEEPBIND:8}}}),Sc,Cc,wc,Tc,signalsFor,Ec=__esmMin(()=>{Sc=Object.freeze({SIGHUP:1,SIGINT:2,SIGQUIT:3,SIGILL:4,SIGTRAP:5,SIGABRT:6,SIGIOT:6,SIGBUS:7,SIGFPE:8,SIGKILL:9,SIGUSR1:10,SIGSEGV:11,SIGUSR2:12,SIGPIPE:13,SIGALRM:14,SIGTERM:15,SIGSTKFLT:16,SIGCHLD:17,SIGCONT:18,SIGSTOP:19,SIGTSTP:20,SIGTTIN:21,SIGTTOU:22,SIGURG:23,SIGXCPU:24,SIGXFSZ:25,SIGVTALRM:26,SIGPROF:27,SIGWINCH:28,SIGIO:29,SIGPOLL:29,SIGPWR:30,SIGSYS:31}),Cc=Object.freeze({SIGHUP:1,SIGINT:2,SIGQUIT:3,SIGILL:4,SIGTRAP:5,SIGABRT:6,SIGIOT:6,SIGFPE:8,SIGKILL:9,SIGBUS:10,SIGSEGV:11,SIGSYS:12,SIGPIPE:13,SIGALRM:14,SIGTERM:15,SIGURG:16,SIGSTOP:17,SIGTSTP:18,SIGCONT:19,SIGCHLD:20,SIGTTIN:21,SIGTTOU:22,SIGIO:23,SIGXCPU:24,SIGXFSZ:25,SIGVTALRM:26,SIGPROF:27,SIGWINCH:28,SIGINFO:29,SIGUSR1:30,SIGUSR2:31}),wc=Object.freeze({SIGHUP:1,SIGINT:2,SIGQUIT:3,SIGILL:4,SIGFPE:8,SIGKILL:9,SIGSEGV:11,SIGTERM:15,SIGBREAK:21,SIGABRT:22,SIGWINCH:28}),Tc=Object.freeze({linux:Sc,darwin:Cc,win32:wc}),signalsFor=e=>Tc[e??`linux`]});function createSubnet(e,t,n,r){let i=`0`.repeat(e);return o=>{let s=(`1`.repeat(parseInt(o,10))+i).slice(0,e),c=[];for(let r=0;r<e;r+=t)c.push(parseInt(s.substr(r,t),2).toString(n));return c.join(r)}}var Dc=__esmMin(()=>{}),Oc,kc,Ac,jc,sysctl,Mc,Nc,Pc,Fc,Ic,Lc,Rc,zc,Bc=__esmMin(()=>{Dc(),os(),Oc=`/usr/sbin/sysctl`,kc=`/usr/bin/uptime`,Ac=createSubnet(128,16,16,`:`),jc=__name(function(e){if(e=e.trim(),e.length<1||!/\binet6?\b/.test(e))return;let t=e.split(`
28
+ `);let e=this.line;this.line=``,this.cursor=0,this._onLine(e);return}if(t.name===`backspace`||t.name===`delete`){this.cursor>0&&(this.line=this.line.slice(0,this.cursor-1)+this.line.slice(this.cursor),this.cursor--,this._output?.write(`\b \b`));return}e&&e.length===1&&!t.ctrl&&!t.meta&&t.name!==`escape`&&(this.line=this.line.slice(0,this.cursor)+e+this.line.slice(this.cursor),this.cursor++,this._output?.write(e))}},this._input.on(`keypress`,this._boundOnKeypress)}}_onData(e){if(this._closed||this._paused||this.terminal)return;let t=typeof e==`string`?e:e.toString(`utf8`);this._lineBuffer+=t;let n;for(;(n=sc.exec(this._lineBuffer))!==null;){let e=this._lineBuffer.substring(0,n.index);this._lineBuffer=this._lineBuffer.substring(n.index+n[0].length),this._onLine(e)}}_onLine(e){if(e.length>0&&this._historySize>0&&(this.history.length===0||this.history[0]!==e)&&(this.history.unshift(e),this.history.length>this._historySize&&this.history.pop()),this._questionCallback){let t=this._questionCallback;this._questionCallback=null,t(e)}this.emit(`line`,e)}_onEnd(){let e=this.terminal?this.line:this._lineBuffer;e.length>0&&(this._onLine(e),this._lineBuffer=``),this.close()}setPrompt(e){this._prompt=e}getPrompt(){return this._prompt}prompt(e){if(this._closed)throw Error(`readline was closed`);this._output?.write(this._prompt)}question(e,t,n){if(this._closed)throw Error(`readline was closed`);let r=typeof t==`function`?t:n;this._questionCallback=r,this._output?.write(e)}clearLine(e,t){return this.line=``,this.cursor=0,t&&t(),!0}write(e,t){if(!this._closed){if(t){this._input&&this._input.emit(`keypress`,e??``,t);return}if(e!=null){let t=typeof e==`string`?e:e.toString(`utf8`);t&&(this.line=this.line.slice(0,this.cursor)+t+this.line.slice(this.cursor),this.cursor+=t.length),this._output?.write(e)}}}close(){if(!this._closed){if(this._closed=!0,this._input){this._boundOnData&&this._input.removeListener(`data`,this._boundOnData),this._boundOnEnd&&this._input.removeListener(`end`,this._boundOnEnd),this._boundOnError&&this._input.removeListener(`error`,this._boundOnError),this._boundOnKeypress&&this._input.removeListener(`keypress`,this._boundOnKeypress),this._boundOnData=null,this._boundOnEnd=null,this._boundOnError=null,this._boundOnKeypress=null;let e=this._input;this.terminal&&e.isRaw&&typeof e.setRawMode==`function`&&e.setRawMode(!1),typeof this._input.pause==`function`&&this._input.pause()}this.emit(`close`)}}pause(){return this._closed?this:(this._paused=!0,this._input&&`pause`in this._input&&typeof this._input.pause==`function`&&this._input.pause(),this.emit(`pause`),this)}resume(){return this._closed?this:(this._paused=!1,this._input&&`resume`in this._input&&typeof this._input.resume==`function`&&this._input.resume(),this.emit(`resume`),this)}getCursorPos(){let e=this._output?.columns??80,t=this._prompt.length+this.cursor;return{rows:Math.floor(t/e),cols:t%e}}[Symbol.asyncIterator](){let e=[],t=null,n=!1,onLine=n=>{if(t){let e=t;t=null,e({value:n,done:!1})}else e.push(n)},onClose=()=>{if(n=!0,t){let e=t;t=null,e({value:void 0,done:!0})}};return this.on(`line`,onLine),this.on(`close`,onClose),{next:()=>e.length>0?Promise.resolve({value:e.shift(),done:!1}):n?Promise.resolve({value:void 0,done:!0}):new Promise(e=>{t=e}),return:()=>(n=!0,this.removeListener(`line`,onLine),this.removeListener(`close`,onClose),Promise.resolve({value:void 0,done:!0})),[Symbol.asyncIterator](){return this}}}},cc=Symbol.dispose??Symbol.for(`Symbol.dispose`),Interface.prototype[cc]=function(){this.close()},lc=Symbol(`keypress-decoder`),uc=Symbol(`escape-decoder`)}),fc,pc=__esmMin(()=>{Es(),fs(),ps(),Os(),ks(),Ns(),oc(),Vs(),Us(),Ws(),je(),Wo(),Oe(),dc(),fc=class FileHandle{options;_gFile;_pathStr;_spec;_pos=0;_closed=!1;_webStreamLocked=!1;static instances={};constructor(e){this.options=e,this.options.flags??=`r`;let t=normalizePath$1(e.path);this._spec=parseOpenFlags(this.options.flags),this.options.mode??=438;let n=normalizeMode(this.options.mode,438);return this.fd=openFd(t,this._spec,n),this._pathStr=t,this._gFile=J.File.new_for_path(t),FileHandle.instances[this.fd]=this,FileHandle.getInstance(this.fd)}_readCore(e,t,n,r){if(this._assertOpen(`read`),!this._spec.readable)throw fsError(`EBADF`,`read`,this._pathStr);if(n>e.byteLength-t){let r=RangeError(`The value of "length" is out of range. It must be <= ${e.byteLength-t}. Received ${n}`);throw r.code=`ERR_OUT_OF_RANGE`,r}let i=r!=null&&r>=0,o=isSeekableFd(this.fd,this._pathStr);if(i&&!o)throw fsError(`ESPIPE`,`read`,this._pathStr);let s=i?r:this._pos;o&&seekFd(this.fd,s);let c=readFd(this.fd,n);return c.length>0&&new Uint8Array(e.buffer,e.byteOffset+t,c.length).set(c),!i&&o&&(this._pos=s+c.length),c.length}_writeCore(e,t){if(this._assertOpen(`write`),!this._spec.writable)throw fsError(`EBADF`,`write`,this._pathStr);if(this._spec.append){let t=writeFd(this.fd,e);return this._pos=tellFd(this.fd)??sizeOfFd(this.fd,this._pathStr),t}let n=t!=null&&t>=0,r=isSeekableFd(this.fd,this._pathStr);if(n&&!r)throw fsError(`ESPIPE`,`write`,this._pathStr);let i=n?t:this._pos;r&&seekFd(this.fd,i);let o=writeFd(this.fd,e);return!n&&r&&(this._pos=i+o),o}_assertOpen(e){if(this._closed)throw fsError(`EBADF`,e,this._pathStr)}_truncateCore(e){if(this._assertOpen(`ftruncate`),!this._spec.writable)throw fsError(`EINVAL`,`ftruncate`,this._pathStr);truncateFd(this.fd,Math.max(0,e),this._pathStr)}_readToEnd(){let e=[],t=0;for(;;){let n=new Uint8Array(64*1024),r=this._readCore(n,0,n.length,null);if(r===0)break;e.push(n.subarray(0,r)),t+=r}let n=new Uint8Array(t),r=0;for(let t of e)n.set(t,r),r+=t.length;return n}_fdTarget(){return fdPath(this.fd)??this._pathStr}fd;static getInstance(e,t=`read`){let n=e instanceof FileHandle?e.fd:e,r=FileHandle.instances[n];if(!r)throw fsError(`EBADF`,t);return r}async appendFile(e,t){await this.writeFile(e,t)}async chown(e,t){this._assertOpen(`fchown`),chownSync(normalizePath$1(this.options.path),e,t)}async chmod(e){this._assertOpen(`fchmod`),chmodSync(this._fdTarget(),e)}createReadStream(e){return new ReadStream(this.options.path,{...e,fd:this.fd})}createWriteStream(e){return new WriteStream(this.options.path,{...e,fd:this.fd,fdFromHandle:!0})}async datasync(){this._assertOpen(`fdatasync`),fsyncFd(this.fd)}async sync(){this._assertOpen(`fsync`),fsyncFd(this.fd)}async read(...e){let t,n,r,i;if(typeof e[0]==`object`&&!(e[0]instanceof Uint8Array)&&!(e[0]instanceof R)){let o=e[0];t=o.buffer,n=o.offset,r=o.length,i=o.position}else t=e[0],n=e[1],r=e[2],i=e[3];let o=t,s=n??0,c=r??(o?o.byteLength-s:65536);return{bytesRead:this._readCore(t,s,c,i??null),buffer:t}}readableWebStream(){if(this._closed)throw invalidState(`The FileHandle is closed`);if(this._webStreamLocked)throw invalidState(`The FileHandle is locked`);let e=globalThis.ReadableStream;if(typeof e!=`function`)throw Error(`readableWebStream() requires a global ReadableStream. Import "node:stream/web" or "@gjsify/web-streams/register" before calling this method.`);return this._webStreamLocked=!0,new e({type:`bytes`,pull:e=>{if(this._closed){e.close(),e.byobRequest?.respond(0);return}let t=e.byobRequest?.view,n=t?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):new Uint8Array(64*1024),r;try{r=this._readCore(n,0,n.length,null)}catch(t){e.error(t);return}if(r===0){e.close(),e.byobRequest?.respond(0);return}if(e.byobRequest){e.byobRequest.respond(r);return}e.enqueue(n.subarray(0,r))}})}async readFile(e){return encodeUint8Array(getEncodingFromOptions(e,`buffer`),this._readToEnd())}readLines(e){return createInterface({input:this.createReadStream(e),crlfDelay:1/0})}async stat(e){this._assertOpen(`fstat`);let t=J.File.new_for_path(this._fdTarget());return statsFrom(await new Promise((e,n)=>{t.query_info_async(Hs,J.FileQueryInfoFlags.NONE,z.PRIORITY_DEFAULT,null,Ds((r,i)=>{try{e(t.query_info_finish(i))}catch(e){n(e)}}))}),this._pathStr,`fstat`,e?.bigint)}async truncate(e=0){this._truncateCore(e)}async utimes(e,t){this._assertOpen(`futimes`);let{utimesSync:n}=await Promise.resolve().then(()=>(vs(),_s));n(normalizePath$1(this.options.path),e,t)}async writeFile(e,t){let n=getEncodingFromOptions(t),r;r=typeof e==`string`?R.from(e,n||`utf8`):e,this._writeCore(r,null)}async write(e,...t){let n=null,r=null,i=null,o=null;typeof e==`string`?(n=t[0],r=t[1]):(i=t[0],o=t[1],n=t[2]),r=getEncodingFromOptions(r,typeof e==`string`?`utf8`:null);let s;s=typeof e==`string`?new TextEncoder().encode(e):e;let c=i??0,l=o??s.byteLength-c,u=s.subarray(c,c+l);return{bytesWritten:this._writeCore(u,n??null),buffer:e}}async writev(e,t){let n=0;for(let r of e){let e=R.from(r.buffer,r.byteOffset,r.byteLength),i=await this.write(e,0,e.byteLength,t==null?null:t+n);n+=i.bytesWritten}return{bytesWritten:n,buffers:e}}async readv(e,t){let n=0;for(let r of e){let e=await this.read({buffer:R.from(r.buffer,r.byteOffset,r.byteLength),position:t==null?null:t+n});if(n+=e.bytesRead,e.bytesRead<r.byteLength)break}return{bytesRead:n,buffers:e}}_flushSync(){fsyncFd(this.fd)}_closeSync(){this._teardown()}_readSync(e,t,n,r){return this._readCore(e,t,n,r)}_writeSync(e,t){return this._writeCore(e,t)}_readToEndSync(){return this._readToEnd()}_truncateSync(e){this._truncateCore(e)}_fdStatTarget(){return this._fdTarget()}_teardown(){if(this._closed)return;this._closed=!0,releaseFd(this.fd),closeFd(this.fd);let e=FileHandle;delete e.instances[this.fd]}async close(){this._teardown()}async[Symbol.asyncDispose](){await this.close()}pull(...e){throw Error('FileHandle.pull() is not implemented in @gjsify/fs yet — requires `node:stream/iter` (Node 25.9+) which @gjsify/stream has not ported. Track gjsify Open TODO "Node 25 stream/iter integration".')}writer(e){throw Error('FileHandle.writer() is not implemented in @gjsify/fs yet — requires `node:stream/iter` (Node 25.9+) which @gjsify/stream has not ported. Track gjsify Open TODO "Node 25 stream/iter integration".')}}});function getFH(e,t){return fc.getInstance(e,t)}function fstatSync(e,t){return statSync(getFH(e,`fstat`)._fdStatTarget(),t)}function fstat(e,t,n){let r=typeof t==`function`?t:requireCallback(n);fstatAsync(e,typeof t==`function`?{}:t).then(e=>r(null,e),e=>r(e,void 0))}async function fstatAsync(e,t){return t?.bigint,fstatSync(e,t)}function ftruncateSync(e,t=0){getFH(e,`ftruncate`)._truncateSync(t)}function ftruncate(e,t,n){let r=typeof t==`function`?t:requireCallback(n);ftruncateAsync(e,typeof t==`function`?0:t).then(()=>r(null),r)}async function ftruncateAsync(e,t=0){ftruncateSync(e,t)}function fdatasyncSync(e){getFH(e,`fdatasync`)._flushSync()}function fdatasync(e,t){requireCallback(t),Promise.resolve().then(()=>fdatasyncSync(e)).then(()=>t(null),t)}async function fdatasyncAsync(e){fdatasyncSync(e)}function fsyncSync(e){getFH(e,`fsync`)._flushSync()}function fsync(e,t){requireCallback(t),Promise.resolve().then(()=>fsyncSync(e)).then(()=>t(null),t)}async function fsyncAsync(e){fsyncSync(e)}function fchmodSync(e,t){chmodSync(getFH(e,`fchmod`)._fdStatTarget(),t)}function fchmod(e,t,n){requireCallback(n),Promise.resolve().then(()=>fchmodSync(e,t)).then(()=>n(null),n)}async function fchmodAsync(e,t){fchmodSync(e,t)}function fchownSync(e,t,n){chownSync(normalizePath$1(getFH(e,`fchown`).options.path),t,n)}function fchown(e,t,n,r){requireCallback(r),Promise.resolve().then(()=>fchownSync(e,t,n)).then(()=>r(null),r)}async function fchownAsync(e,t,n){fchownSync(e,t,n)}function futimesSync(e,t,n){utimesSync(normalizePath$1(getFH(e,`futimes`).options.path),t,n)}function futimes(e,t,n,r){requireCallback(r),Promise.resolve().then(()=>futimesSync(e,t,n)).then(()=>r(null),r)}async function futimesAsync(e,t,n){futimesSync(e,t,n)}function closeSync(e){isStdFd(e)||getFH(e,`close`)._closeSync()}function readSync(e,t,n,r,i){let o=0;return typeof n==`object`&&n?(o=n.offset??0,r=n.length??t.byteLength-o,i=n.position??null):(o=n??0,r??=t.byteLength-o),isStdFd(e)?readStdFdSync(e,t,o,r):getFH(e,`read`)._readSync(t,o,r,i??null)}function writeSync(e,t,n,r,i){let o;if(typeof t==`string`)o=new TextEncoder().encode(t),typeof n==`number`&&(i=n);else{let e=typeof n==`number`?n:0,i=typeof r==`number`?r:t.byteLength-e;o=new Uint8Array(t.buffer,t.byteOffset+e,i)}return isStdFd(e)?writeStdFdSync(e,o):getFH(e,`write`)._writeSync(o,i??null)}function readvSync(e,t,n){let r=0;for(let i of t){let t=readSync(e,i,0,i.byteLength,n==null?null:n+r);if(r+=t,t<i.byteLength)break}return r}function readv(e,t,n,r){let i=typeof n==`function`?n:requireCallback(r);readvAsync(e,t,typeof n==`function`?null:n).then(e=>i(null,e.bytesRead,e.buffers),e=>i(e,0,t))}async function readvAsync(e,t,n){return{bytesRead:readvSync(e,t,n),buffers:t}}function writevSync(e,t,n){let r=0;for(let i of t){let t=writeSync(e,i,0,i.byteLength,n==null?null:n+r);r+=t}return r}function writev(e,t,n,r){let i=typeof n==`function`?n:requireCallback(r);writevAsync(e,t,typeof n==`function`?null:n).then(e=>i(null,e.bytesWritten,e.buffers),e=>i(e,0,t))}async function writevAsync(e,t,n){return{bytesWritten:writevSync(e,t,n),buffers:t}}function exists(e,t){requireCallback(t);let n;try{statSync(normalizePath$1(e)),n=!0}catch{n=!1}Promise.resolve().then(()=>t(n))}async function openAsBlob(e,t){let n=readFileSync(normalizePath$1(e));return new Blob([n],{type:t?.type??``})}var mc=__esmMin(()=>{fs(),ps(),vs(),Ts(),pc(),Ws(),Object.defineProperty(exists,Symbol.for(`nodejs.util.promisify.custom`),{value:e=>new Promise(t=>exists(e,t))})});function zeroedStat(){return{dev:0,ino:0,mode:0,nlink:0,uid:0,gid:0,rdev:0,size:0,blksize:0,blocks:0,atimeMs:0,mtimeMs:0,ctimeMs:0,birthtimeMs:0,atime:new Date(0),mtime:new Date(0),ctime:new Date(0),birthtime:new Date(0),isFile:()=>!1,isDirectory:()=>!1,isBlockDevice:()=>!1,isCharacterDevice:()=>!1,isSymbolicLink:()=>!1,isFIFO:()=>!1,isSocket:()=>!1}}function watchFile$1(e,t,n){typeof t==`function`&&(n=t,t={}),requireCallback(n,`listener`);let r=t.interval??5007,i=e.toString(),o=hc.get(i);return o||(o=new StatWatcher(i,r),o.start(),hc.set(i,o)),n&&o.addChangeListener(n),o}function unwatchFile(e,t){let n=e.toString(),r=hc.get(n);r&&(t?r.removeChangeListener(t):r.removeAllChangeListeners(),r.changeListenerCount===0&&(r.stop(),hc.delete(n)))}var StatWatcher,hc,gc=__esmMin(()=>{ps(),Ws(),Ke(),StatWatcher=class extends Ge{_path;_interval;_timerId=null;_prev;_changeCount=0;constructor(e,t){super(),this._path=e,this._interval=t,this._prev=zeroedStat()}start(){try{this._prev=statSync(this._path)}catch{}this._timerId=setInterval(()=>{let e;try{e=statSync(this._path)}catch{e=zeroedStat()}let t=this._prev;(e.mtimeMs!==t.mtimeMs||e.size!==t.size||e.ino!==t.ino)&&(this._prev=e,this.emit(`change`,e,t))},this._interval)}stop(){this._timerId!==null&&(clearInterval(this._timerId),this._timerId=null),this.emit(`stop`)}addChangeListener(e){this._changeCount++,this.on(`change`,e)}removeChangeListener(e){this._changeCount--,this.removeListener(`change`,e)}removeAllChangeListeners(){this._changeCount=0,this.removeAllListeners(`change`)}get changeListenerCount(){return this._changeCount}},hc=new Map,__name(watchFile$1,`watchFile`)}),_c=__exportAll$3({BigIntStats:()=>BigIntStats,Dir:()=>Dir,Dirent:()=>Dirent,FSWatcher:()=>FSWatcher,ReadStream:()=>ReadStream,StatWatcher:()=>StatWatcher,Stats:()=>Stats,WriteStream:()=>WriteStream,access:()=>access,accessSync:()=>accessSync,appendFile:()=>appendFile,appendFileSync:()=>appendFileSync,chmod:()=>chmod,chmodSync:()=>chmodSync,chown:()=>chown,chownSync:()=>chownSync,close:()=>close$1,closeSync:()=>closeSync,constants:()=>Qs,copyFile:()=>copyFile,copyFileSync:()=>copyFileSync,cp:()=>cp,cpSync:()=>cpSync,createReadStream:()=>createReadStream,createWriteStream:()=>createWriteStream,default:()=>vc,exists:()=>exists,existsSync:()=>existsSync,fchmod:()=>fchmod,fchmodSync:()=>fchmodSync,fchown:()=>fchown,fchownSync:()=>fchownSync,fdatasync:()=>fdatasync,fdatasyncSync:()=>fdatasyncSync,fstat:()=>fstat,fstatSync:()=>fstatSync,fsync:()=>fsync,fsyncSync:()=>fsyncSync,ftruncate:()=>ftruncate,ftruncateSync:()=>ftruncateSync,futimes:()=>futimes,futimesSync:()=>futimesSync,glob:()=>glob,globSync:()=>globSync,lchmod:()=>void 0,lchmodSync:()=>void 0,lchown:()=>lchown,lchownSync:()=>lchownSync,link:()=>link,linkSync:()=>linkSync,lstat:()=>lstat,lstatSync:()=>lstatSync,lutimes:()=>lutimes,lutimesSync:()=>lutimesSync,mkdir:()=>mkdir,mkdirSync:()=>mkdirSync,mkdtemp:()=>mkdtemp,mkdtempSync:()=>mkdtempSync,"module.exports":()=>vc,open:()=>open$1,openAsBlob:()=>openAsBlob,openSync:()=>openSync,opendir:()=>opendir,opendirSync:()=>opendirSync,promises:()=>ec,read:()=>read,readFile:()=>readFile,readFileSync:()=>readFileSync,readSync:()=>readSync,readdir:()=>readdir,readdirSync:()=>readdirSync,readlink:()=>readlink,readlinkSync:()=>readlinkSync,readv:()=>readv,readvSync:()=>readvSync,realpath:()=>realpath,realpathSync:()=>realpathSync,rename:()=>rename,renameSync:()=>renameSync,rm:()=>rm,rmSync:()=>rmSync,rmdir:()=>rmdir,rmdirSync:()=>rmdirSync,stat:()=>stat,statSync:()=>statSync,statfs:()=>statfs,statfsSync:()=>statfsSync,symlink:()=>symlink,symlinkSync:()=>symlinkSync,truncate:()=>truncate,truncateSync:()=>truncateSync,unlink:()=>unlink,unlinkSync:()=>unlinkSync,unwatchFile:()=>unwatchFile,utimes:()=>utimes,utimesSync:()=>utimesSync,watch:()=>watch,watchFile:()=>watchFile$1,write:()=>write,writeFile:()=>writeFile$1,writeFileSync:()=>writeFileSync,writeSync:()=>writeSync,writev:()=>writev,writevSync:()=>writevSync}),vc,yc=__esmMin(()=>{gs(),vs(),mc(),ks(),oc(),Ps(),Us(),Ws(),Gs(),qs(),Js(),Zs(),$s(),nc(),rc(),gc(),vc={FSWatcher,StatWatcher,Stats,BigIntStats,Dirent,Dir,constants:Qs,existsSync,readdirSync,readFileSync,writeFileSync,mkdirSync,rmdirSync,unlinkSync,mkdtemp,mkdtempSync,rmSync,statSync,openSync,realpathSync,symlinkSync,lstatSync,renameSync,copyFileSync,accessSync,appendFileSync,readlinkSync,linkSync,truncateSync,chmodSync,chownSync,cpSync,opendirSync,globSync,glob,watch,watchFile:watchFile$1,unwatchFile,statfsSync,statfs,utimesSync,utimes,lutimesSync,lutimes,lchownSync,lchown,lchmodSync:void 0,lchmod:void 0,fstatSync,fstat,ftruncateSync,ftruncate,fdatasyncSync,fdatasync,fsyncSync,fsync,fchmodSync,fchmod,fchownSync,fchown,futimesSync,futimes,closeSync,readSync,writeSync,readvSync,readv,writevSync,writev,exists,openAsBlob,createReadStream,ReadStream,createWriteStream,WriteStream,promises:ec,open:open$1,close:close$1,read,write,rm,realpath,readdir,symlink,lstat,stat,rename,copyFile,cp,access,appendFile,readlink,truncate,chmod,chown,mkdir,rmdir,readFile,writeFile:writeFile$1,unlink,link,opendir}}),bc,xc=__esmMin(()=>{bc={UV_UDP_REUSEADDR:4,errno:{E2BIG:7,EACCES:13,EADDRINUSE:98,EADDRNOTAVAIL:99,EAFNOSUPPORT:97,EAGAIN:11,EALREADY:114,EBADF:9,EBADMSG:74,EBUSY:16,ECANCELED:125,ECHILD:10,ECONNABORTED:103,ECONNREFUSED:111,ECONNRESET:104,EDEADLK:35,EDESTADDRREQ:89,EDOM:33,EDQUOT:122,EEXIST:17,EFAULT:14,EFBIG:27,EHOSTUNREACH:113,EIDRM:43,EILSEQ:84,EINPROGRESS:115,EINTR:4,EINVAL:22,EIO:5,EISCONN:106,EISDIR:21,ELOOP:40,EMFILE:24,EMLINK:31,EMSGSIZE:90,EMULTIHOP:72,ENAMETOOLONG:36,ENETDOWN:100,ENETRESET:102,ENETUNREACH:101,ENFILE:23,ENOBUFS:105,ENODATA:61,ENODEV:19,ENOENT:2,ENOEXEC:8,ENOLCK:37,ENOLINK:67,ENOMEM:12,ENOMSG:42,ENOPROTOOPT:92,ENOSPC:28,ENOSR:63,ENOSTR:60,ENOSYS:38,ENOTCONN:107,ENOTDIR:20,ENOTEMPTY:39,ENOTSOCK:88,ENOTSUP:95,ENOTTY:25,ENXIO:6,EOPNOTSUPP:95,EOVERFLOW:75,EPERM:1,EPIPE:32,EPROTO:71,EPROTONOSUPPORT:93,EPROTOTYPE:91,ERANGE:34,EROFS:30,ESPIPE:29,ESRCH:3,ESTALE:116,ETIME:62,ETIMEDOUT:110,ETXTBSY:26,EWOULDBLOCK:11,EXDEV:18},priority:{PRIORITY_LOW:19,PRIORITY_BELOW_NORMAL:10,PRIORITY_NORMAL:0,PRIORITY_ABOVE_NORMAL:-7,PRIORITY_HIGH:-14,PRIORITY_HIGHEST:-20},dlopen:{RTLD_LAZY:1,RTLD_NOW:2,RTLD_GLOBAL:256,RTLD_LOCAL:0,RTLD_DEEPBIND:8}}}),Sc,Cc,wc,Tc,signalsFor,Ec=__esmMin(()=>{Sc=Object.freeze({SIGHUP:1,SIGINT:2,SIGQUIT:3,SIGILL:4,SIGTRAP:5,SIGABRT:6,SIGIOT:6,SIGBUS:7,SIGFPE:8,SIGKILL:9,SIGUSR1:10,SIGSEGV:11,SIGUSR2:12,SIGPIPE:13,SIGALRM:14,SIGTERM:15,SIGSTKFLT:16,SIGCHLD:17,SIGCONT:18,SIGSTOP:19,SIGTSTP:20,SIGTTIN:21,SIGTTOU:22,SIGURG:23,SIGXCPU:24,SIGXFSZ:25,SIGVTALRM:26,SIGPROF:27,SIGWINCH:28,SIGIO:29,SIGPOLL:29,SIGPWR:30,SIGSYS:31}),Cc=Object.freeze({SIGHUP:1,SIGINT:2,SIGQUIT:3,SIGILL:4,SIGTRAP:5,SIGABRT:6,SIGIOT:6,SIGFPE:8,SIGKILL:9,SIGBUS:10,SIGSEGV:11,SIGSYS:12,SIGPIPE:13,SIGALRM:14,SIGTERM:15,SIGURG:16,SIGSTOP:17,SIGTSTP:18,SIGCONT:19,SIGCHLD:20,SIGTTIN:21,SIGTTOU:22,SIGIO:23,SIGXCPU:24,SIGXFSZ:25,SIGVTALRM:26,SIGPROF:27,SIGWINCH:28,SIGINFO:29,SIGUSR1:30,SIGUSR2:31}),wc=Object.freeze({SIGHUP:1,SIGINT:2,SIGQUIT:3,SIGILL:4,SIGFPE:8,SIGKILL:9,SIGSEGV:11,SIGTERM:15,SIGBREAK:21,SIGABRT:22,SIGWINCH:28}),Tc=Object.freeze({linux:Sc,darwin:Cc,win32:wc}),signalsFor=e=>Tc[e??`linux`]});function createSubnet(e,t,n,r){let i=`0`.repeat(e);return o=>{let s=(`1`.repeat(parseInt(o,10))+i).slice(0,e),c=[];for(let r=0;r<e;r+=t)c.push(parseInt(s.substr(r,t),2).toString(n));return c.join(r)}}var Dc=__esmMin(()=>{}),Oc,kc,Ac,jc,sysctl,Mc,Nc,Pc,Fc,Ic,Lc,Rc,zc,Bc=__esmMin(()=>{Dc(),ns(),Oc=`/usr/sbin/sysctl`,kc=`/usr/bin/uptime`,Ac=createSubnet(128,16,16,`:`),jc=__name(function(e){if(e=e.trim(),e.length<1||!/\binet6?\b/.test(e))return;let t=e.split(`
29
29
  `),n=[],r=t.length,i=`00:00:00:00:00:00`,o=/<[^>]*\bLOOPBACK\b[^>]*>/.test(t[0]??``);for(let e,s=0;s<r;s++)switch(e=t[s],!0){case/ether\s+((?:\S{2}:)+\S{2})/.test(e):i=RegExp.$1;break;case/inet\s+(\d+\.\d+\.\d+\.\d+)\s+netmask\s+0x(.{2})(.{2})(.{2})(.{2})/.test(e):n.push({address:RegExp.$1,netmask:[parseInt(RegExp.$2,16),parseInt(RegExp.$3,16),parseInt(RegExp.$4,16),parseInt(RegExp.$5,16)].join(`.`),family:`IPv4`,mac:i,internal:o});break;case/inet6\s+([^\s%]+)(?:%\S+)?\s+prefixlen\s+(\d+)/.test(e):n.push({address:RegExp.$1,netmask:Ac(RegExp.$2),family:`IPv6`,mac:i,internal:o});break}this[e.slice(0,e.indexOf(`:`))]=n},`parseInterfaces`),sysctl=e=>{try{let t=cli(`${Oc} -n ${e}`).trim();return t.length>0?t:null}catch{return null}},Mc=Object.freeze({user:0,nice:0,sys:0,idle:0,irq:0}),Nc=__name(()=>{let e=parseFloat(cli(`${Oc} -n hw.ncpu`)),t=sysctl(`machdep.cpu.brand_string`)?.replace(/\s+/g,` `)??`unknown`,n=sysctl(`hw.cpufrequency`),r=n?parseFloat(n)/1e3/1e3:0,i=[];for(let n=0;n<e;n++)i.push({model:t,speed:r,times:{...Mc}});return i},`cpus`),Pc=__name(()=>`LE`,`endianness`),Fc=__name(()=>{try{let e=cli(`/usr/bin/vm_stat`),t=/page size of (\d+) bytes/.exec(e),n=t?parseInt(t[1],10):16384,r=0,i=/Pages free:\s+(\d+)/.exec(e);i&&(r+=parseInt(i[1],10));let o=/Pages speculative:\s+(\d+)/.exec(e);o&&(r+=parseInt(o[1],10));let s=/Pages purgeable:\s+(\d+)/.exec(e);if(s&&(r+=parseInt(s[1],10)),r>0)return r*n}catch{}try{return parseFloat(cli(`${Oc} -n hw.memsize`))-parseFloat(cli(`${Oc} -n hw.physmem`))}catch{return 0}},`freemem`),Ic=__name(()=>/load\s+averages:\s+(\d+(?:\.\d+)?)\s+(\d+(?:\.\d+)?)\s+(\d+(?:\.\d+)?)/.test(cli(kc))?[parseFloat(RegExp.$1),parseFloat(RegExp.$2),parseFloat(RegExp.$3)]:[0,0,0],`loadavg`),Lc=__name(()=>{let e={},t=[],n=cli(`/sbin/ifconfig`).split(/\r\n|\n/),r=n.length;for(let e=[],i=/^\S+?:/,o=0;o<r;o++){if(i.test(n[o])){for(e=[n[o]];++o<r&&!i.test(n[o]);)e.push(n[o]);--o}t.push(e.join(`
30
30
  `))}return t.forEach(jc,e),e},`networkInterfaces`),Rc=__name(()=>{try{return parseFloat(cli(`${Oc} -n hw.memsize`))}catch{return 0}},`totalmem`),zc=__name(()=>{try{let e=cli(`${Oc} -n kern.boottime`),t=/sec\s*=\s*(\d+)/.exec(e);if(t){let e=parseInt(t[1],10);return Math.floor(Date.now()/1e3)-e}}catch{}let e=cli(kc),t=/up\s+([^,]+)?,/.test(e)&&RegExp.$1;switch(!0){case/^(\d+):(\d+)$/.test(t):return(parseInt(RegExp.$1,10)*60+parseInt(RegExp.$2,10))*60;case/^(\d+)\s+mins?$/.test(t):return parseInt(RegExp.$1,10)*60;case/^(\d+)\s+days?$/.test(t):{let t=parseInt(RegExp.$1,10)*86400,n=/days?,\s+(\d+):(\d+)/.exec(e);return n?t+(parseInt(n[1],10)*60+parseInt(n[2],10))*60:t}}return 0},`uptime`)});function readTextFile(e){let[t,n]=z.file_get_contents(e);return!t||!n?``:Vc.decode(n)}function parseInterfaces(e){if(e=e.trim(),e.length<1)return;let t=/<[^>]*\bLOOPBACK\b[^>]*>/.test(e.split(Hc)[0]??``),n=[],r;for(let i,o=e.split(Hc),s=0;s<o.length;s++)switch(i=o[s],!0){case/link\/\S+\s+((?:\S{2}:)+\S{2})/.test(i):r=RegExp.$1;break;case/inet(\d*)\s+(\S+)/.test(i):let e=RegExp.$2.split(`/`),o=RegExp.$1||`4`;n.push({address:e[0],netmask:(o===`4`?Uc:Wc)(e[1]),family:`IPv`+o,mac:r,internal:t});break}r&&(this[e.slice(0,e.indexOf(`:`))]=n)}function readNetworkInterfacesFromProc(){let e={},t={};try{let n=readTextFile(`/proc/net/dev`);for(let r of n.split(`
31
31
  `).slice(2)){let n=r.split(`:`)[0]?.trim();if(n){e[n]=[];try{t[n]=readTextFile(`/sys/class/net/${n}/address`).trim()}catch{t[n]=`00:00:00:00:00:00`}}}}catch{return e}try{let n=readTextFile(`/proc/net/if_inet6`);for(let r of n.split(`
32
- `)){let n=r.trim().split(/\s+/);if(n.length<6)continue;let[i,,o,,,s]=n,c=i.match(/.{4}/g);!c||!e[s]||e[s].push({address:c.join(`:`),netmask:Wc(o),family:`IPv6`,mac:t[s]||`00:00:00:00:00:00`,internal:s===`lo`})}}catch{}e.lo&&e.lo.unshift({address:`127.0.0.1`,netmask:`255.0.0.0`,family:`IPv4`,mac:t.lo||`00:00:00:00:00:00`,internal:!0});for(let t of Object.keys(e))e[t].length===0&&delete e[t];return e}var Vc,Hc,Uc,Wc,Gc,Kc,qc,Jc,Yc,Xc,Zc,Qc=__esmMin(()=>{Dc(),os(),je(),Vc=new TextDecoder,Hc=/\r\n|\n/,Uc=createSubnet(32,8,10,`.`),Wc=createSubnet(128,16,16,`:`),Gc=__name(()=>{let e=/^processor\s*:\s*(\d+)/i,t=/^model[\s_]+name\s*:([^\r\n]+)/i,n=/^cpu[\s_]+MHz\s*:\s*(\d+)/i,r=[],i;readTextFile(`/proc/cpuinfo`).split(Hc).forEach(o=>{switch(!0){case e.test(o):r[RegExp.$1.trim()]=i={model:``,speed:0,times:{user:0,nice:0,sys:0,idle:0,irq:0}};break;case t.test(o):i.model=RegExp.$1.trim();break;case n.test(o):i.speed=parseFloat(RegExp.$1.trim());break}});try{let e=readTextFile(`/proc/stat`).split(Hc);for(let t of e){let e=/^cpu(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+\d+\s+(\d+)/.exec(t);e&&r[parseInt(e[1],10)]&&(r[parseInt(e[1],10)].times={user:parseInt(e[2],10)*10,nice:parseInt(e[3],10)*10,sys:parseInt(e[4],10)*10,idle:parseInt(e[5],10)*10,irq:parseInt(e[6],10)*10})}}catch{}return r},`cpus`),Kc=__name(()=>`LE`,`endianness`),qc=__name(()=>{let e=readTextFile(`/proc/meminfo`),t=0;for(let n of e.split(`
32
+ `)){let n=r.trim().split(/\s+/);if(n.length<6)continue;let[i,,o,,,s]=n,c=i.match(/.{4}/g);!c||!e[s]||e[s].push({address:c.join(`:`),netmask:Wc(o),family:`IPv6`,mac:t[s]||`00:00:00:00:00:00`,internal:s===`lo`})}}catch{}e.lo&&e.lo.unshift({address:`127.0.0.1`,netmask:`255.0.0.0`,family:`IPv4`,mac:t.lo||`00:00:00:00:00:00`,internal:!0});for(let t of Object.keys(e))e[t].length===0&&delete e[t];return e}var Vc,Hc,Uc,Wc,Gc,Kc,qc,Jc,Yc,Xc,Zc,Qc=__esmMin(()=>{Dc(),ns(),je(),Vc=new TextDecoder,Hc=/\r\n|\n/,Uc=createSubnet(32,8,10,`.`),Wc=createSubnet(128,16,16,`:`),Gc=__name(()=>{let e=/^processor\s*:\s*(\d+)/i,t=/^model[\s_]+name\s*:([^\r\n]+)/i,n=/^cpu[\s_]+MHz\s*:\s*(\d+)/i,r=[],i;readTextFile(`/proc/cpuinfo`).split(Hc).forEach(o=>{switch(!0){case e.test(o):r[RegExp.$1.trim()]=i={model:``,speed:0,times:{user:0,nice:0,sys:0,idle:0,irq:0}};break;case t.test(o):i.model=RegExp.$1.trim();break;case n.test(o):i.speed=parseFloat(RegExp.$1.trim());break}});try{let e=readTextFile(`/proc/stat`).split(Hc);for(let t of e){let e=/^cpu(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+\d+\s+(\d+)/.exec(t);e&&r[parseInt(e[1],10)]&&(r[parseInt(e[1],10)].times={user:parseInt(e[2],10)*10,nice:parseInt(e[3],10)*10,sys:parseInt(e[4],10)*10,idle:parseInt(e[5],10)*10,irq:parseInt(e[6],10)*10})}}catch{}return r},`cpus`),Kc=__name(()=>`LE`,`endianness`),qc=__name(()=>{let e=readTextFile(`/proc/meminfo`),t=0;for(let n of e.split(`
33
33
  `)){let e=/^MemAvailable:\s+(\d+)\s+kB/.exec(n);if(e)return parseInt(e[1],10)*1024;let r=/^MemFree:\s+(\d+)\s+kB/.exec(n);r&&(t=parseInt(r[1],10)*1024)}return t},`freemem`),Jc=__name(()=>/(\d+(?:\.\d+))\s+(\d+(?:\.\d+))\s+(\d+(?:\.\d+))/.test(readTextFile(`/proc/loadavg`))&&[parseFloat(RegExp.$1),parseFloat(RegExp.$2),parseFloat(RegExp.$3)],`loadavg`),Yc=__name(()=>{try{let e={};return cli(`ip addr`).split(/^\d+:\s+/m).forEach(parseInterfaces,e),e}catch{return readNetworkInterfacesFromProc()}},`networkInterfaces`),Xc=__name(()=>{let e=readTextFile(`/proc/meminfo`);for(let t of e.split(`
34
- `)){let e=/^MemTotal:\s+(\d+)\s+kB/.exec(t);if(e)return parseInt(e[1],10)*1024}return 0},`totalmem`),Zc=__name(()=>{let e=readTextFile(`/proc/uptime`).trim();return parseFloat(e.split(` `)[0])||0},`uptime`)}),$c=__exportAll$3({EOL:()=>rl,arch:()=>arch,availableParallelism:()=>availableParallelism,constants:()=>nl,cpus:()=>cpus,default:()=>ol,devNull:()=>il,endianness:()=>endianness,freemem:()=>freemem,getPriority:()=>getPriority,homedir:()=>homedir,hostname:()=>hostname,loadavg:()=>loadavg,machine:()=>machine,networkInterfaces:()=>networkInterfaces,platform:()=>platform,release:()=>release,setPriority:()=>setPriority,tmpdir:()=>tmpdir,totalmem:()=>totalmem,type:()=>type,uptime:()=>uptime,userInfo:()=>userInfo,version:()=>al}),el,getOs,tl,getPid,nl,rl,il,homedir,hostname,release,tmpdir,type,platform,arch,machine,al,uptime,totalmem,availableParallelism,userInfo,cpus,endianness,freemem,loadavg,networkInterfaces,getPriority,setPriority,ol,sl=__esmMin(()=>{k(),xc(),Ec(),Bc(),Qc(),os(),ve(),Wo(),je(),el=``,getOs=()=>el||(el=mapSysname(cli(`uname -s`))??`linux`,el),tl=0,getPid=()=>(tl||=new J.Credentials().get_unix_pid(),tl),nl={...bc,get signals(){let e=getOs();return signalsFor(isTargetOs(e)?e:void 0)}},rl=getPathSeparator()===`/`?`
34
+ `)){let e=/^MemTotal:\s+(\d+)\s+kB/.exec(t);if(e)return parseInt(e[1],10)*1024}return 0},`totalmem`),Zc=__name(()=>{let e=readTextFile(`/proc/uptime`).trim();return parseFloat(e.split(` `)[0])||0},`uptime`)}),$c=__exportAll$3({EOL:()=>rl,arch:()=>arch,availableParallelism:()=>availableParallelism,constants:()=>nl,cpus:()=>cpus,default:()=>ol,devNull:()=>il,endianness:()=>endianness,freemem:()=>freemem,getPriority:()=>getPriority,homedir:()=>homedir,hostname:()=>hostname,loadavg:()=>loadavg,machine:()=>machine,networkInterfaces:()=>networkInterfaces,platform:()=>platform,release:()=>release,setPriority:()=>setPriority,tmpdir:()=>tmpdir,totalmem:()=>totalmem,type:()=>type,uptime:()=>uptime,userInfo:()=>userInfo,version:()=>al}),el,getOs,tl,getPid,nl,rl,il,homedir,hostname,release,tmpdir,type,platform,arch,machine,al,uptime,totalmem,availableParallelism,userInfo,cpus,endianness,freemem,loadavg,networkInterfaces,getPriority,setPriority,ol,sl=__esmMin(()=>{k(),xc(),Ec(),Bc(),Qc(),ns(),ve(),Wo(),je(),el=``,getOs=()=>el||(el=mapSysname(cli(`uname -s`))??`linux`,el),tl=0,getPid=()=>(tl||=new J.Credentials().get_unix_pid(),tl),nl={...bc,get signals(){let e=getOs();return signalsFor(isTargetOs(e)?e:void 0)}},rl=getPathSeparator()===`/`?`
35
35
  `:`\r
36
36
  `,il=getPathSeparator()===`/`?`/dev/null`:`\\\\.\\nul`,homedir=()=>z.get_home_dir(),hostname=()=>z.get_host_name(),release=()=>cli(`uname -r`).trim(),tmpdir=()=>{let e=z.get_tmp_dir(),t=getPathSeparator();return e.length>1&&e.endsWith(t)?e.slice(0,-1):e},type=()=>cli(`uname`).trim(),platform=()=>getOs(),arch=()=>mapMachine(cli(`uname -m`))??`x64`,machine=()=>cli(`uname -m`).trim(),al=__name(()=>cli(`uname -v`).trim(),`version`),uptime=()=>{switch(getOs()){case`darwin`:return zc();case`linux`:return Zc();default:return 0}},totalmem=()=>{switch(getOs()){case`darwin`:return Rc();case`linux`:return Xc();default:return 0}},availableParallelism=()=>{let e=cpus();return e?e.length:1},userInfo=()=>{let e=1e3,t=100,n=``;try{e=parseInt(cli(`id -u`),10),t=parseInt(cli(`id -g`),10),n=z.getenv(`SHELL`)||``}catch{}return{uid:e,gid:t,username:z.get_user_name(),homedir:z.get_home_dir(),shell:n}},cpus=()=>{let e=getOs();switch(e){case`darwin`:return Nc();case`linux`:return Gc();default:O.warn(`${e} is not supported!`);break}},endianness=()=>{let e=getOs();switch(e){case`darwin`:return Pc();case`linux`:return Kc();default:O.warn(`${e} is not supported!`);break}},freemem=()=>{let e=getOs();switch(e){case`darwin`:return Fc();case`linux`:return qc();default:O.warn(`${e} is not supported!`);break}},loadavg=()=>{let e=getOs();switch(e){case`darwin`:return Ic();case`linux`:return Jc();default:O.warn(`${e} is not supported!`);break}},networkInterfaces=()=>{let e=getOs();switch(e){case`darwin`:return Lc();case`linux`:return Yc();default:O.warn(`${e} is not supported!`);break}},getPriority=e=>{let t=e===void 0||e===0?getPid():e;try{let e=cli(`ps -o ni= -p ${t}`).trim(),n=parseInt(e,10);if(!isNaN(n))return n}catch{}return 0},setPriority=(e,t)=>{let n,r;if(t===void 0?(r=e,n=0):(n=e,r=t),typeof n!=`number`||!Number.isInteger(n))throw TypeError(`The "pid" argument must be an integer`);if(typeof r!=`number`||!Number.isInteger(r)||r<-20||r>19)throw RangeError(`The "priority" argument must be an integer between -20 and 19`);try{let e=n===0?getPid():n;cli(`renice -n ${r} -p ${e}`)}catch{let e=Error(`A system error occurred: priority could not be set`);throw e.code=`ERR_SYSTEM_ERROR`,e}},ol={EOL:rl,arch,availableParallelism,constants:nl,cpus,devNull:il,endianness,freemem,getPriority,homedir,hostname,loadavg,machine,networkInterfaces,platform,release,setPriority,tmpdir,totalmem,type,uptime,userInfo,version:al}}),cl=__commonJSMin((e=>{var t=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`.split(``);e.encode=function(e){if(0<=e&&e<t.length)return t[e];throw TypeError(`Must be between 0 and 63: `+e)},e.decode=function(e){var t=65,n=90,r=97,i=122,o=48;return t<=e&&e<=n?e-t:r<=e&&e<=i?e-r+26:o<=e&&e<=57?e-o+52:e==43?62:e==47?63:-1}})),ll=__commonJSMin((e=>{var t=cl(),n=5,r=1<<n,i=r-1,o=r;function toVLQSigned(e){return e<0?(-e<<1)+1:(e<<1)+0}function fromVLQSigned(e){var t=(e&1)==1,n=e>>1;return t?-n:n}e.encode=function base64VLQ_encode(e){var r=``,s,c=toVLQSigned(e);do s=c&i,c>>>=n,c>0&&(s|=o),r+=t.encode(s);while(c>0);return r},e.decode=function base64VLQ_decode(e,r,s){var c=e.length,l=0,u=0,d,f;do{if(r>=c)throw Error(`Expected more digits in base 64 VLQ value.`);if(f=t.decode(e.charCodeAt(r++)),f===-1)throw Error(`Invalid base64 digit: `+e.charAt(r-1));d=!!(f&o),f&=i,l+=f<<u,u+=n}while(d);s.value=fromVLQSigned(l),s.rest=r}})),ul=__commonJSMin((e=>{function getArg(e,t,n){if(t in e)return e[t];if(arguments.length===3)return n;throw Error(`"`+t+`" is a required argument.`)}e.getArg=getArg;var t=/^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/,n=/^data:.+\,.+$/;function urlParse(e){var n=e.match(t);return n?{scheme:n[1],auth:n[2],host:n[3],port:n[4],path:n[5]}:null}e.urlParse=urlParse;function urlGenerate(e){var t=``;return e.scheme&&(t+=e.scheme+`:`),t+=`//`,e.auth&&(t+=e.auth+`@`),e.host&&(t+=e.host),e.port&&(t+=`:`+e.port),e.path&&(t+=e.path),t}e.urlGenerate=urlGenerate;function normalize(t){var n=t,r=urlParse(t);if(r){if(!r.path)return t;n=r.path}for(var i=e.isAbsolute(n),o=n.split(/\/+/),s,c=0,l=o.length-1;l>=0;l--)s=o[l],s===`.`?o.splice(l,1):s===`..`?c++:c>0&&(s===``?(o.splice(l+1,c),c=0):(o.splice(l,2),c--));return n=o.join(`/`),n===``&&(n=i?`/`:`.`),r?(r.path=n,urlGenerate(r)):n}e.normalize=normalize;function join(e,t){e===``&&(e=`.`),t===``&&(t=`.`);var r=urlParse(t),i=urlParse(e);if(i&&(e=i.path||`/`),r&&!r.scheme)return i&&(r.scheme=i.scheme),urlGenerate(r);if(r||t.match(n))return t;if(i&&!i.host&&!i.path)return i.host=t,urlGenerate(i);var o=t.charAt(0)===`/`?t:normalize(e.replace(/\/+$/,``)+`/`+t);return i?(i.path=o,urlGenerate(i)):o}e.join=join,e.isAbsolute=function(e){return e.charAt(0)===`/`||t.test(e)};function relative(e,t){e===``&&(e=`.`),e=e.replace(/\/$/,``);for(var n=0;t.indexOf(e+`/`)!==0;){var r=e.lastIndexOf(`/`);if(r<0||(e=e.slice(0,r),e.match(/^([^\/]+:\/)?\/*$/)))return t;++n}return Array(n+1).join(`../`)+t.substr(e.length+1)}e.relative=relative;var r=function(){return!(`__proto__`in Object.create(null))}();function identity(e){return e}function toSetString(e){return isProtoString(e)?`$`+e:e}e.toSetString=r?identity:toSetString;function fromSetString(e){return isProtoString(e)?e.slice(1):e}e.fromSetString=r?identity:fromSetString;function isProtoString(e){if(!e)return!1;var t=e.length;if(t<9||e.charCodeAt(t-1)!==95||e.charCodeAt(t-2)!==95||e.charCodeAt(t-3)!==111||e.charCodeAt(t-4)!==116||e.charCodeAt(t-5)!==111||e.charCodeAt(t-6)!==114||e.charCodeAt(t-7)!==112||e.charCodeAt(t-8)!==95||e.charCodeAt(t-9)!==95)return!1;for(var n=t-10;n>=0;n--)if(e.charCodeAt(n)!==36)return!1;return!0}function compareByOriginalPositions(e,t,n){var r=strcmp(e.source,t.source);return r!==0||(r=e.originalLine-t.originalLine,r!==0)||(r=e.originalColumn-t.originalColumn,r!==0||n)||(r=e.generatedColumn-t.generatedColumn,r!==0)||(r=e.generatedLine-t.generatedLine,r!==0)?r:strcmp(e.name,t.name)}e.compareByOriginalPositions=compareByOriginalPositions;function compareByGeneratedPositionsDeflated(e,t,n){var r=e.generatedLine-t.generatedLine;return r!==0||(r=e.generatedColumn-t.generatedColumn,r!==0||n)||(r=strcmp(e.source,t.source),r!==0)||(r=e.originalLine-t.originalLine,r!==0)||(r=e.originalColumn-t.originalColumn,r!==0)?r:strcmp(e.name,t.name)}e.compareByGeneratedPositionsDeflated=compareByGeneratedPositionsDeflated;function strcmp(e,t){return e===t?0:e===null?1:t===null?-1:e>t?1:-1}function compareByGeneratedPositionsInflated(e,t){var n=e.generatedLine-t.generatedLine;return n!==0||(n=e.generatedColumn-t.generatedColumn,n!==0)||(n=strcmp(e.source,t.source),n!==0)||(n=e.originalLine-t.originalLine,n!==0)||(n=e.originalColumn-t.originalColumn,n!==0)?n:strcmp(e.name,t.name)}e.compareByGeneratedPositionsInflated=compareByGeneratedPositionsInflated;function parseSourceMapInput(e){return JSON.parse(e.replace(/^\)]}'[^\n]*\n/,``))}e.parseSourceMapInput=parseSourceMapInput;function computeSourceURL(e,t,n){if(t||=``,e&&(e[e.length-1]!==`/`&&t[0]!==`/`&&(e+=`/`),t=e+t),n){var r=urlParse(n);if(!r)throw Error(`sourceMapURL could not be parsed`);if(r.path){var i=r.path.lastIndexOf(`/`);i>=0&&(r.path=r.path.substring(0,i+1))}t=join(urlGenerate(r),t)}return normalize(t)}e.computeSourceURL=computeSourceURL})),dl=__commonJSMin((e=>{var t=ul(),n=Object.prototype.hasOwnProperty,r=typeof Map<`u`;function ArraySet(){this._array=[],this._set=r?new Map:Object.create(null)}ArraySet.fromArray=function ArraySet_fromArray(e,t){for(var n=new ArraySet,r=0,i=e.length;r<i;r++)n.add(e[r],t);return n},ArraySet.prototype.size=function ArraySet_size(){return r?this._set.size:Object.getOwnPropertyNames(this._set).length},ArraySet.prototype.add=function ArraySet_add(e,i){var o=r?e:t.toSetString(e),s=r?this.has(e):n.call(this._set,o),c=this._array.length;(!s||i)&&this._array.push(e),s||(r?this._set.set(e,c):this._set[o]=c)},ArraySet.prototype.has=function ArraySet_has(e){if(r)return this._set.has(e);var i=t.toSetString(e);return n.call(this._set,i)},ArraySet.prototype.indexOf=function ArraySet_indexOf(e){if(r){var i=this._set.get(e);if(i>=0)return i}else{var o=t.toSetString(e);if(n.call(this._set,o))return this._set[o]}throw Error(`"`+e+`" is not in the set.`)},ArraySet.prototype.at=function ArraySet_at(e){if(e>=0&&e<this._array.length)return this._array[e];throw Error(`No element indexed by `+e)},ArraySet.prototype.toArray=function ArraySet_toArray(){return this._array.slice()},e.ArraySet=ArraySet})),fl=__commonJSMin((e=>{var t=ul();function generatedPositionAfter(e,n){var r=e.generatedLine,i=n.generatedLine,o=e.generatedColumn,s=n.generatedColumn;return i>r||i==r&&s>=o||t.compareByGeneratedPositionsInflated(e,n)<=0}function MappingList(){this._array=[],this._sorted=!0,this._last={generatedLine:-1,generatedColumn:0}}MappingList.prototype.unsortedForEach=function MappingList_forEach(e,t){this._array.forEach(e,t)},MappingList.prototype.add=function MappingList_add(e){generatedPositionAfter(this._last,e)?(this._last=e,this._array.push(e)):(this._sorted=!1,this._array.push(e))},MappingList.prototype.toArray=function MappingList_toArray(){return this._sorted||=(this._array.sort(t.compareByGeneratedPositionsInflated),!0),this._array},e.MappingList=MappingList})),pl=__commonJSMin((e=>{var t=ll(),n=ul(),r=dl().ArraySet,i=fl().MappingList;function SourceMapGenerator(e){e||={},this._file=n.getArg(e,`file`,null),this._sourceRoot=n.getArg(e,`sourceRoot`,null),this._skipValidation=n.getArg(e,`skipValidation`,!1),this._sources=new r,this._names=new r,this._mappings=new i,this._sourcesContents=null}SourceMapGenerator.prototype._version=3,SourceMapGenerator.fromSourceMap=function SourceMapGenerator_fromSourceMap(e){var t=e.sourceRoot,r=new SourceMapGenerator({file:e.file,sourceRoot:t});return e.eachMapping(function(e){var i={generated:{line:e.generatedLine,column:e.generatedColumn}};e.source!=null&&(i.source=e.source,t!=null&&(i.source=n.relative(t,i.source)),i.original={line:e.originalLine,column:e.originalColumn},e.name!=null&&(i.name=e.name)),r.addMapping(i)}),e.sources.forEach(function(i){var o=i;t!==null&&(o=n.relative(t,i)),r._sources.has(o)||r._sources.add(o);var s=e.sourceContentFor(i);s!=null&&r.setSourceContent(i,s)}),r},SourceMapGenerator.prototype.addMapping=function SourceMapGenerator_addMapping(e){var t=n.getArg(e,`generated`),r=n.getArg(e,`original`,null),i=n.getArg(e,`source`,null),o=n.getArg(e,`name`,null);this._skipValidation||this._validateMapping(t,r,i,o),i!=null&&(i=String(i),this._sources.has(i)||this._sources.add(i)),o!=null&&(o=String(o),this._names.has(o)||this._names.add(o)),this._mappings.add({generatedLine:t.line,generatedColumn:t.column,originalLine:r!=null&&r.line,originalColumn:r!=null&&r.column,source:i,name:o})},SourceMapGenerator.prototype.setSourceContent=function SourceMapGenerator_setSourceContent(e,t){var r=e;this._sourceRoot!=null&&(r=n.relative(this._sourceRoot,r)),t==null?this._sourcesContents&&(delete this._sourcesContents[n.toSetString(r)],Object.keys(this._sourcesContents).length===0&&(this._sourcesContents=null)):(this._sourcesContents||=Object.create(null),this._sourcesContents[n.toSetString(r)]=t)},SourceMapGenerator.prototype.applySourceMap=function SourceMapGenerator_applySourceMap(e,t,i){var o=t;if(t==null){if(e.file==null)throw Error(`SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, or the source map's "file" property. Both were omitted.`);o=e.file}var s=this._sourceRoot;s!=null&&(o=n.relative(s,o));var c=new r,l=new r;this._mappings.unsortedForEach(function(t){if(t.source===o&&t.originalLine!=null){var r=e.originalPositionFor({line:t.originalLine,column:t.originalColumn});r.source!=null&&(t.source=r.source,i!=null&&(t.source=n.join(i,t.source)),s!=null&&(t.source=n.relative(s,t.source)),t.originalLine=r.line,t.originalColumn=r.column,r.name!=null&&(t.name=r.name))}var u=t.source;u!=null&&!c.has(u)&&c.add(u);var d=t.name;d!=null&&!l.has(d)&&l.add(d)},this),this._sources=c,this._names=l,e.sources.forEach(function(t){var r=e.sourceContentFor(t);r!=null&&(i!=null&&(t=n.join(i,t)),s!=null&&(t=n.relative(s,t)),this.setSourceContent(t,r))},this)},SourceMapGenerator.prototype._validateMapping=function SourceMapGenerator_validateMapping(e,t,n,r){if(t&&typeof t.line!=`number`&&typeof t.column!=`number`)throw Error(`original.line and original.column are not numbers -- you probably meant to omit the original mapping entirely and only map the generated position. If so, pass null for the original mapping instead of an object with empty or null values.`);if(!(e&&`line`in e&&`column`in e&&e.line>0&&e.column>=0&&!t&&!n&&!r)&&!(e&&`line`in e&&`column`in e&&t&&`line`in t&&`column`in t&&e.line>0&&e.column>=0&&t.line>0&&t.column>=0&&n))throw Error(`Invalid mapping: `+JSON.stringify({generated:e,source:n,original:t,name:r}))},SourceMapGenerator.prototype._serializeMappings=function SourceMapGenerator_serializeMappings(){for(var e=0,r=1,i=0,o=0,s=0,c=0,l=``,u,d,f,p,m=this._mappings.toArray(),h=0,g=m.length;h<g;h++){if(d=m[h],u=``,d.generatedLine!==r)for(e=0;d.generatedLine!==r;)u+=`;`,r++;else if(h>0){if(!n.compareByGeneratedPositionsInflated(d,m[h-1]))continue;u+=`,`}u+=t.encode(d.generatedColumn-e),e=d.generatedColumn,d.source!=null&&(p=this._sources.indexOf(d.source),u+=t.encode(p-c),c=p,u+=t.encode(d.originalLine-1-o),o=d.originalLine-1,u+=t.encode(d.originalColumn-i),i=d.originalColumn,d.name!=null&&(f=this._names.indexOf(d.name),u+=t.encode(f-s),s=f)),l+=u}return l},SourceMapGenerator.prototype._generateSourcesContent=function SourceMapGenerator_generateSourcesContent(e,t){return e.map(function(e){if(!this._sourcesContents)return null;t!=null&&(e=n.relative(t,e));var r=n.toSetString(e);return Object.prototype.hasOwnProperty.call(this._sourcesContents,r)?this._sourcesContents[r]:null},this)},SourceMapGenerator.prototype.toJSON=function SourceMapGenerator_toJSON(){var e={version:this._version,sources:this._sources.toArray(),names:this._names.toArray(),mappings:this._serializeMappings()};return this._file!=null&&(e.file=this._file),this._sourceRoot!=null&&(e.sourceRoot=this._sourceRoot),this._sourcesContents&&(e.sourcesContent=this._generateSourcesContent(e.sources,e.sourceRoot)),e},SourceMapGenerator.prototype.toString=function SourceMapGenerator_toString(){return JSON.stringify(this.toJSON())},e.SourceMapGenerator=SourceMapGenerator})),ml=__commonJSMin((e=>{e.GREATEST_LOWER_BOUND=1,e.LEAST_UPPER_BOUND=2;function recursiveSearch(t,n,r,i,o,s){var c=Math.floor((n-t)/2)+t,l=o(r,i[c],!0);return l===0?c:l>0?n-c>1?recursiveSearch(c,n,r,i,o,s):s==e.LEAST_UPPER_BOUND?n<i.length?n:-1:c:c-t>1?recursiveSearch(t,c,r,i,o,s):s==e.LEAST_UPPER_BOUND?c:t<0?-1:t}e.search=function search(t,n,r,i){if(n.length===0)return-1;var o=recursiveSearch(-1,n.length,t,n,r,i||e.GREATEST_LOWER_BOUND);if(o<0)return-1;for(;o-1>=0&&r(n[o],n[o-1],!0)===0;)--o;return o}})),hl=__commonJSMin((e=>{function swap(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function randomIntInRange(e,t){return Math.round(e+Math.random()*(t-e))}function doQuickSort(e,t,n,r){if(n<r){var i=randomIntInRange(n,r),o=n-1;swap(e,i,r);for(var s=e[r],c=n;c<r;c++)t(e[c],s)<=0&&(o+=1,swap(e,o,c));swap(e,o+1,c);var l=o+1;doQuickSort(e,t,n,l-1),doQuickSort(e,t,l+1,r)}}e.quickSort=function(e,t){doQuickSort(e,t,0,e.length-1)}})),gl=__commonJSMin((e=>{var t=ul(),n=ml(),r=dl().ArraySet,i=ll(),o=hl().quickSort;function SourceMapConsumer(e,n){var r=e;return typeof e==`string`&&(r=t.parseSourceMapInput(e)),r.sections==null?new BasicSourceMapConsumer(r,n):new IndexedSourceMapConsumer(r,n)}SourceMapConsumer.fromSourceMap=function(e,t){return BasicSourceMapConsumer.fromSourceMap(e,t)},SourceMapConsumer.prototype._version=3,SourceMapConsumer.prototype.__generatedMappings=null,Object.defineProperty(SourceMapConsumer.prototype,"_generatedMappings",{configurable:!0,enumerable:!0,get:function(){return this.__generatedMappings||this._parseMappings(this._mappings,this.sourceRoot),this.__generatedMappings}}),SourceMapConsumer.prototype.__originalMappings=null,Object.defineProperty(SourceMapConsumer.prototype,"_originalMappings",{configurable:!0,enumerable:!0,get:function(){return this.__originalMappings||this._parseMappings(this._mappings,this.sourceRoot),this.__originalMappings}}),SourceMapConsumer.prototype._charIsMappingSeparator=function SourceMapConsumer_charIsMappingSeparator(e,t){var n=e.charAt(t);return n===`;`||n===`,`},SourceMapConsumer.prototype._parseMappings=function SourceMapConsumer_parseMappings(e,t){throw Error(`Subclasses must implement _parseMappings`)},SourceMapConsumer.GENERATED_ORDER=1,SourceMapConsumer.ORIGINAL_ORDER=2,SourceMapConsumer.GREATEST_LOWER_BOUND=1,SourceMapConsumer.LEAST_UPPER_BOUND=2,SourceMapConsumer.prototype.eachMapping=function SourceMapConsumer_eachMapping(e,n,r){var i=n||null,o=r||SourceMapConsumer.GENERATED_ORDER,s;switch(o){case SourceMapConsumer.GENERATED_ORDER:s=this._generatedMappings;break;case SourceMapConsumer.ORIGINAL_ORDER:s=this._originalMappings;break;default:throw Error(`Unknown order of iteration.`)}var c=this.sourceRoot;s.map(function(e){var n=e.source===null?null:this._sources.at(e.source);return n=t.computeSourceURL(c,n,this._sourceMapURL),{source:n,generatedLine:e.generatedLine,generatedColumn:e.generatedColumn,originalLine:e.originalLine,originalColumn:e.originalColumn,name:e.name===null?null:this._names.at(e.name)}},this).forEach(e,i)},SourceMapConsumer.prototype.allGeneratedPositionsFor=function SourceMapConsumer_allGeneratedPositionsFor(e){var r=t.getArg(e,`line`),i={source:t.getArg(e,`source`),originalLine:r,originalColumn:t.getArg(e,`column`,0)};if(i.source=this._findSourceIndex(i.source),i.source<0)return[];var o=[],s=this._findMapping(i,this._originalMappings,`originalLine`,`originalColumn`,t.compareByOriginalPositions,n.LEAST_UPPER_BOUND);if(s>=0){var c=this._originalMappings[s];if(e.column===void 0)for(var l=c.originalLine;c&&c.originalLine===l;)o.push({line:t.getArg(c,`generatedLine`,null),column:t.getArg(c,`generatedColumn`,null),lastColumn:t.getArg(c,`lastGeneratedColumn`,null)}),c=this._originalMappings[++s];else for(var u=c.originalColumn;c&&c.originalLine===r&&c.originalColumn==u;)o.push({line:t.getArg(c,`generatedLine`,null),column:t.getArg(c,`generatedColumn`,null),lastColumn:t.getArg(c,`lastGeneratedColumn`,null)}),c=this._originalMappings[++s]}return o},e.SourceMapConsumer=SourceMapConsumer;function BasicSourceMapConsumer(e,n){var i=e;typeof e==`string`&&(i=t.parseSourceMapInput(e));var o=t.getArg(i,`version`),s=t.getArg(i,`sources`),c=t.getArg(i,`names`,[]),l=t.getArg(i,`sourceRoot`,null),u=t.getArg(i,`sourcesContent`,null),d=t.getArg(i,`mappings`),f=t.getArg(i,`file`,null);if(o!=this._version)throw Error(`Unsupported version: `+o);l&&=t.normalize(l),s=s.map(String).map(t.normalize).map(function(e){return l&&t.isAbsolute(l)&&t.isAbsolute(e)?t.relative(l,e):e}),this._names=r.fromArray(c.map(String),!0),this._sources=r.fromArray(s,!0),this._absoluteSources=this._sources.toArray().map(function(e){return t.computeSourceURL(l,e,n)}),this.sourceRoot=l,this.sourcesContent=u,this._mappings=d,this._sourceMapURL=n,this.file=f}BasicSourceMapConsumer.prototype=Object.create(SourceMapConsumer.prototype),BasicSourceMapConsumer.prototype.consumer=SourceMapConsumer,BasicSourceMapConsumer.prototype._findSourceIndex=function(e){var n=e;if(this.sourceRoot!=null&&(n=t.relative(this.sourceRoot,n)),this._sources.has(n))return this._sources.indexOf(n);var r;for(r=0;r<this._absoluteSources.length;++r)if(this._absoluteSources[r]==e)return r;return-1},BasicSourceMapConsumer.fromSourceMap=function SourceMapConsumer_fromSourceMap(e,n){var i=Object.create(BasicSourceMapConsumer.prototype),s=i._names=r.fromArray(e._names.toArray(),!0),c=i._sources=r.fromArray(e._sources.toArray(),!0);i.sourceRoot=e._sourceRoot,i.sourcesContent=e._generateSourcesContent(i._sources.toArray(),i.sourceRoot),i.file=e._file,i._sourceMapURL=n,i._absoluteSources=i._sources.toArray().map(function(e){return t.computeSourceURL(i.sourceRoot,e,n)});for(var l=e._mappings.toArray().slice(),u=i.__generatedMappings=[],d=i.__originalMappings=[],f=0,p=l.length;f<p;f++){var m=l[f],h=new Mapping;h.generatedLine=m.generatedLine,h.generatedColumn=m.generatedColumn,m.source&&(h.source=c.indexOf(m.source),h.originalLine=m.originalLine,h.originalColumn=m.originalColumn,m.name&&(h.name=s.indexOf(m.name)),d.push(h)),u.push(h)}return o(i.__originalMappings,t.compareByOriginalPositions),i},BasicSourceMapConsumer.prototype._version=3,Object.defineProperty(BasicSourceMapConsumer.prototype,"sources",{get:function(){return this._absoluteSources.slice()}});function Mapping(){this.generatedLine=0,this.generatedColumn=0,this.source=null,this.originalLine=null,this.originalColumn=null,this.name=null}BasicSourceMapConsumer.prototype._parseMappings=function SourceMapConsumer_parseMappings(e,n){for(var r=1,s=0,c=0,l=0,u=0,d=0,f=e.length,p=0,m={},h={},g=[],_=[],v,y,b,x,S;p<f;)if(e.charAt(p)===`;`)r++,p++,s=0;else if(e.charAt(p)===`,`)p++;else{for(v=new Mapping,v.generatedLine=r,x=p;x<f&&!this._charIsMappingSeparator(e,x);x++);if(y=e.slice(p,x),b=m[y],b)p+=y.length;else{for(b=[];p<x;)i.decode(e,p,h),S=h.value,p=h.rest,b.push(S);if(b.length===2)throw Error(`Found a source, but no line and column`);if(b.length===3)throw Error(`Found a source and line, but no column`);m[y]=b}v.generatedColumn=s+b[0],s=v.generatedColumn,b.length>1&&(v.source=u+b[1],u+=b[1],v.originalLine=c+b[2],c=v.originalLine,v.originalLine+=1,v.originalColumn=l+b[3],l=v.originalColumn,b.length>4&&(v.name=d+b[4],d+=b[4])),_.push(v),typeof v.originalLine==`number`&&g.push(v)}o(_,t.compareByGeneratedPositionsDeflated),this.__generatedMappings=_,o(g,t.compareByOriginalPositions),this.__originalMappings=g},BasicSourceMapConsumer.prototype._findMapping=function SourceMapConsumer_findMapping(e,t,r,i,o,s){if(e[r]<=0)throw TypeError(`Line must be greater than or equal to 1, got `+e[r]);if(e[i]<0)throw TypeError(`Column must be greater than or equal to 0, got `+e[i]);return n.search(e,t,o,s)},BasicSourceMapConsumer.prototype.computeColumnSpans=function SourceMapConsumer_computeColumnSpans(){for(var e=0;e<this._generatedMappings.length;++e){var t=this._generatedMappings[e];if(e+1<this._generatedMappings.length){var n=this._generatedMappings[e+1];if(t.generatedLine===n.generatedLine){t.lastGeneratedColumn=n.generatedColumn-1;continue}}t.lastGeneratedColumn=1/0}},BasicSourceMapConsumer.prototype.originalPositionFor=function SourceMapConsumer_originalPositionFor(e){var n={generatedLine:t.getArg(e,`line`),generatedColumn:t.getArg(e,`column`)},r=this._findMapping(n,this._generatedMappings,`generatedLine`,`generatedColumn`,t.compareByGeneratedPositionsDeflated,t.getArg(e,`bias`,SourceMapConsumer.GREATEST_LOWER_BOUND));if(r>=0){var i=this._generatedMappings[r];if(i.generatedLine===n.generatedLine){var o=t.getArg(i,`source`,null);o!==null&&(o=this._sources.at(o),o=t.computeSourceURL(this.sourceRoot,o,this._sourceMapURL));var s=t.getArg(i,`name`,null);return s!==null&&(s=this._names.at(s)),{source:o,line:t.getArg(i,`originalLine`,null),column:t.getArg(i,`originalColumn`,null),name:s}}}return{source:null,line:null,column:null,name:null}},BasicSourceMapConsumer.prototype.hasContentsOfAllSources=function BasicSourceMapConsumer_hasContentsOfAllSources(){return this.sourcesContent?this.sourcesContent.length>=this._sources.size()&&!this.sourcesContent.some(function(e){return e==null}):!1},BasicSourceMapConsumer.prototype.sourceContentFor=function SourceMapConsumer_sourceContentFor(e,n){if(!this.sourcesContent)return null;var r=this._findSourceIndex(e);if(r>=0)return this.sourcesContent[r];var i=e;this.sourceRoot!=null&&(i=t.relative(this.sourceRoot,i));var o;if(this.sourceRoot!=null&&(o=t.urlParse(this.sourceRoot))){var s=i.replace(/^file:\/\//,``);if(o.scheme==`file`&&this._sources.has(s))return this.sourcesContent[this._sources.indexOf(s)];if((!o.path||o.path==`/`)&&this._sources.has(`/`+i))return this.sourcesContent[this._sources.indexOf(`/`+i)]}if(n)return null;throw Error(`"`+i+`" is not in the SourceMap.`)},BasicSourceMapConsumer.prototype.generatedPositionFor=function SourceMapConsumer_generatedPositionFor(e){var n=t.getArg(e,`source`);if(n=this._findSourceIndex(n),n<0)return{line:null,column:null,lastColumn:null};var r={source:n,originalLine:t.getArg(e,`line`),originalColumn:t.getArg(e,`column`)},i=this._findMapping(r,this._originalMappings,`originalLine`,`originalColumn`,t.compareByOriginalPositions,t.getArg(e,`bias`,SourceMapConsumer.GREATEST_LOWER_BOUND));if(i>=0){var o=this._originalMappings[i];if(o.source===r.source)return{line:t.getArg(o,`generatedLine`,null),column:t.getArg(o,`generatedColumn`,null),lastColumn:t.getArg(o,`lastGeneratedColumn`,null)}}return{line:null,column:null,lastColumn:null}},e.BasicSourceMapConsumer=BasicSourceMapConsumer;function IndexedSourceMapConsumer(e,n){var i=e;typeof e==`string`&&(i=t.parseSourceMapInput(e));var o=t.getArg(i,`version`),s=t.getArg(i,`sections`);if(o!=this._version)throw Error(`Unsupported version: `+o);this._sources=new r,this._names=new r;var c={line:-1,column:0};this._sections=s.map(function(e){if(e.url)throw Error(`Support for url field in sections not implemented.`);var r=t.getArg(e,`offset`),i=t.getArg(r,`line`),o=t.getArg(r,`column`);if(i<c.line||i===c.line&&o<c.column)throw Error(`Section offsets must be ordered and non-overlapping.`);return c=r,{generatedOffset:{generatedLine:i+1,generatedColumn:o+1},consumer:new SourceMapConsumer(t.getArg(e,`map`),n)}})}IndexedSourceMapConsumer.prototype=Object.create(SourceMapConsumer.prototype),IndexedSourceMapConsumer.prototype.constructor=SourceMapConsumer,IndexedSourceMapConsumer.prototype._version=3,Object.defineProperty(IndexedSourceMapConsumer.prototype,"sources",{get:function(){for(var e=[],t=0;t<this._sections.length;t++)for(var n=0;n<this._sections[t].consumer.sources.length;n++)e.push(this._sections[t].consumer.sources[n]);return e}}),IndexedSourceMapConsumer.prototype.originalPositionFor=function IndexedSourceMapConsumer_originalPositionFor(e){var r={generatedLine:t.getArg(e,`line`),generatedColumn:t.getArg(e,`column`)},i=n.search(r,this._sections,function(e,t){return e.generatedLine-t.generatedOffset.generatedLine||e.generatedColumn-t.generatedOffset.generatedColumn}),o=this._sections[i];return o?o.consumer.originalPositionFor({line:r.generatedLine-(o.generatedOffset.generatedLine-1),column:r.generatedColumn-(o.generatedOffset.generatedLine===r.generatedLine?o.generatedOffset.generatedColumn-1:0),bias:e.bias}):{source:null,line:null,column:null,name:null}},IndexedSourceMapConsumer.prototype.hasContentsOfAllSources=function IndexedSourceMapConsumer_hasContentsOfAllSources(){return this._sections.every(function(e){return e.consumer.hasContentsOfAllSources()})},IndexedSourceMapConsumer.prototype.sourceContentFor=function IndexedSourceMapConsumer_sourceContentFor(e,t){for(var n=0;n<this._sections.length;n++){var r=this._sections[n].consumer.sourceContentFor(e,!0);if(r)return r}if(t)return null;throw Error(`"`+e+`" is not in the SourceMap.`)},IndexedSourceMapConsumer.prototype.generatedPositionFor=function IndexedSourceMapConsumer_generatedPositionFor(e){for(var n=0;n<this._sections.length;n++){var r=this._sections[n];if(r.consumer._findSourceIndex(t.getArg(e,`source`))!==-1){var i=r.consumer.generatedPositionFor(e);if(i)return{line:i.line+(r.generatedOffset.generatedLine-1),column:i.column+(r.generatedOffset.generatedLine===i.line?r.generatedOffset.generatedColumn-1:0)}}}return{line:null,column:null}},IndexedSourceMapConsumer.prototype._parseMappings=function IndexedSourceMapConsumer_parseMappings(e,n){this.__generatedMappings=[],this.__originalMappings=[];for(var r=0;r<this._sections.length;r++)for(var i=this._sections[r],s=i.consumer._generatedMappings,c=0;c<s.length;c++){var l=s[c],u=i.consumer._sources.at(l.source);u=t.computeSourceURL(i.consumer.sourceRoot,u,this._sourceMapURL),this._sources.add(u),u=this._sources.indexOf(u);var d=null;l.name&&(d=i.consumer._names.at(l.name),this._names.add(d),d=this._names.indexOf(d));var f={source:u,generatedLine:l.generatedLine+(i.generatedOffset.generatedLine-1),generatedColumn:l.generatedColumn+(i.generatedOffset.generatedLine===l.generatedLine?i.generatedOffset.generatedColumn-1:0),originalLine:l.originalLine,originalColumn:l.originalColumn,name:d};this.__generatedMappings.push(f),typeof f.originalLine==`number`&&this.__originalMappings.push(f)}o(this.__generatedMappings,t.compareByGeneratedPositionsDeflated),o(this.__originalMappings,t.compareByOriginalPositions)},e.IndexedSourceMapConsumer=IndexedSourceMapConsumer})),_l=__commonJSMin((e=>{var t=pl().SourceMapGenerator,n=ul(),r=/(\r?\n)/,i=10,o=`$$$isSourceNode$$$`;function SourceNode(e,t,n,r,i){this.children=[],this.sourceContents={},this.line=e??null,this.column=t??null,this.source=n??null,this.name=i??null,this[o]=!0,r!=null&&this.add(r)}SourceNode.fromStringWithSourceMap=function SourceNode_fromStringWithSourceMap(e,t,i){var o=new SourceNode,s=e.split(r),c=0,shiftNextLine=function(){return getNextLine()+(getNextLine()||``);function getNextLine(){return c<s.length?s[c++]:void 0}},l=1,u=0,d=null;return t.eachMapping(function(e){if(d!==null)if(l<e.generatedLine)addMappingWithCode(d,shiftNextLine()),l++,u=0;else{var t=s[c]||``,n=t.substr(0,e.generatedColumn-u);s[c]=t.substr(e.generatedColumn-u),u=e.generatedColumn,addMappingWithCode(d,n),d=e;return}for(;l<e.generatedLine;)o.add(shiftNextLine()),l++;if(u<e.generatedColumn){var t=s[c]||``;o.add(t.substr(0,e.generatedColumn)),s[c]=t.substr(e.generatedColumn),u=e.generatedColumn}d=e},this),c<s.length&&(d&&addMappingWithCode(d,shiftNextLine()),o.add(s.splice(c).join(``))),t.sources.forEach(function(e){var r=t.sourceContentFor(e);r!=null&&(i!=null&&(e=n.join(i,e)),o.setSourceContent(e,r))}),o;function addMappingWithCode(e,t){if(e===null||e.source===void 0)o.add(t);else{var r=i?n.join(i,e.source):e.source;o.add(new SourceNode(e.originalLine,e.originalColumn,r,t,e.name))}}},SourceNode.prototype.add=function SourceNode_add(e){if(Array.isArray(e))e.forEach(function(e){this.add(e)},this);else if(e[o]||typeof e==`string`)e&&this.children.push(e);else throw TypeError(`Expected a SourceNode, string, or an array of SourceNodes and strings. Got `+e);return this},SourceNode.prototype.prepend=function SourceNode_prepend(e){if(Array.isArray(e))for(var t=e.length-1;t>=0;t--)this.prepend(e[t]);else if(e[o]||typeof e==`string`)this.children.unshift(e);else throw TypeError(`Expected a SourceNode, string, or an array of SourceNodes and strings. Got `+e);return this},SourceNode.prototype.walk=function SourceNode_walk(e){for(var t,n=0,r=this.children.length;n<r;n++)t=this.children[n],t[o]?t.walk(e):t!==``&&e(t,{source:this.source,line:this.line,column:this.column,name:this.name})},SourceNode.prototype.join=function SourceNode_join(e){var t,n,r=this.children.length;if(r>0){for(t=[],n=0;n<r-1;n++)t.push(this.children[n]),t.push(e);t.push(this.children[n]),this.children=t}return this},SourceNode.prototype.replaceRight=function SourceNode_replaceRight(e,t){var n=this.children[this.children.length-1];return n[o]?n.replaceRight(e,t):typeof n==`string`?this.children[this.children.length-1]=n.replace(e,t):this.children.push(``.replace(e,t)),this},SourceNode.prototype.setSourceContent=function SourceNode_setSourceContent(e,t){this.sourceContents[n.toSetString(e)]=t},SourceNode.prototype.walkSourceContents=function SourceNode_walkSourceContents(e){for(var t=0,r=this.children.length;t<r;t++)this.children[t][o]&&this.children[t].walkSourceContents(e);for(var i=Object.keys(this.sourceContents),t=0,r=i.length;t<r;t++)e(n.fromSetString(i[t]),this.sourceContents[i[t]])},SourceNode.prototype.toString=function SourceNode_toString(){var e=``;return this.walk(function(t){e+=t}),e},SourceNode.prototype.toStringWithSourceMap=function SourceNode_toStringWithSourceMap(e){var n={code:``,line:1,column:0},r=new t(e),o=!1,s=null,c=null,l=null,u=null;return this.walk(function(e,t){n.code+=e,t.source!==null&&t.line!==null&&t.column!==null?((s!==t.source||c!==t.line||l!==t.column||u!==t.name)&&r.addMapping({source:t.source,original:{line:t.line,column:t.column},generated:{line:n.line,column:n.column},name:t.name}),s=t.source,c=t.line,l=t.column,u=t.name,o=!0):o&&=(r.addMapping({generated:{line:n.line,column:n.column}}),s=null,!1);for(var d=0,f=e.length;d<f;d++)e.charCodeAt(d)===i?(n.line++,n.column=0,d+1===f?(s=null,o=!1):o&&r.addMapping({source:t.source,original:{line:t.line,column:t.column},generated:{line:n.line,column:n.column},name:t.name})):n.column++}),this.walkSourceContents(function(e,t){r.setSourceContent(e,t)}),{code:n.code,map:r}},e.SourceNode=SourceNode})),vl=__commonJSMin((e=>{e.SourceMapGenerator=pl().SourceMapGenerator,e.SourceMapConsumer=gl().SourceMapConsumer,e.SourceNode=_l().SourceNode})),yl=__commonJSMin(((e,t)=>{var n=Object.prototype.toString,r=typeof Buffer<`u`&&typeof Buffer.alloc==`function`&&typeof Buffer.allocUnsafe==`function`&&typeof Buffer.from==`function`;function isArrayBuffer(e){return n.call(e).slice(8,-1)===`ArrayBuffer`}function fromArrayBuffer(e,t,n){t>>>=0;var i=e.byteLength-t;if(i<0)throw RangeError(`'offset' is out of bounds`);if(n===void 0)n=i;else if(n>>>=0,n>i)throw RangeError(`'length' is out of bounds`);return r?Buffer.from(e.slice(t,t+n)):new Buffer(new Uint8Array(e.slice(t,t+n)))}function fromString(e,t){if((typeof t!=`string`||t===``)&&(t=`utf8`),!Buffer.isEncoding(t))throw TypeError(`"encoding" must be a valid string encoding`);return r?Buffer.from(e,t):new Buffer(e,t)}function bufferFrom(e,t,n){if(typeof e==`number`)throw TypeError(`"value" argument must not be a number`);return isArrayBuffer(e)?fromArrayBuffer(e,t,n):typeof e==`string`?fromString(e,t):r?Buffer.from(e):new Buffer(e)}t.exports=bufferFrom})),bl=__commonJSMin(((e,t)=>{k();var n=vl().SourceMapConsumer,r=(Ct(),__toCommonJS(ct)),i;try{i=(yc(),__toCommonJS(_c)),(!i.existsSync||!i.readFileSync)&&(i=null)}catch{}var o=yl();function dynamicRequire(e,t){return e.require(t)}var s=!1,c=!1,l=!1,u=`auto`,d={},f={},p=/^data:application\/json[^,]+base64,/,m=[],h=[];function isInBrowser(){return u===`browser`?!0:u===`node`?!1:typeof globalThis<`u`&&typeof XMLHttpRequest==`function`&&!(globalThis.require&&globalThis.module&&globalThis.process&&globalThis.process.type===`renderer`)}function hasGlobalProcessEventEmitter(){return typeof process==`object`&&process!==null&&typeof process.on==`function`}function globalProcessVersion(){return typeof process==`object`&&process!==null?process.version:``}function globalProcessStderr(){if(typeof process==`object`&&process!==null)return process.stderr}function globalProcessExit(e){if(typeof process==`object`&&process!==null&&typeof process.exit==`function`)return process.exit(e)}function handlerExec(e){return function(t){for(var n=0;n<e.length;n++){var r=e[n](t);if(r)return r}return null}}var g=handlerExec(m);m.push(function(e){if(e=e.trim(),/^file:/.test(e)&&(e=e.replace(/file:\/\/\/(\w:)?/,function(e,t){return t?``:`/`})),e in d)return d[e];var t=``;try{if(i)i.existsSync(e)&&(t=i.readFileSync(e,`utf8`));else{var n=new XMLHttpRequest;n.open(`GET`,e,!1),n.send(null),n.readyState===4&&n.status===200&&(t=n.responseText)}}catch{}return d[e]=t});function supportRelativeURL(e,t){if(!e)return t;var n=r.dirname(e),i=/^\w+:\/\/[^\/]*/.exec(n),o=i?i[0]:``,s=n.slice(o.length);return o&&/^\/\w\:/.test(s)?(o+=`/`,o+r.resolve(n.slice(o.length),t).replace(/\\/g,`/`)):o+r.resolve(n.slice(o.length),t)}function retrieveSourceMapURL(e){var t;if(isInBrowser())try{var n=new XMLHttpRequest;n.open(`GET`,e,!1),n.send(null),t=n.readyState===4?n.responseText:null;var r=n.getResponseHeader(`SourceMap`)||n.getResponseHeader(`X-SourceMap`);if(r)return r}catch{}t=g(e);for(var i=/(?:\/\/[@#][\s]*sourceMappingURL=([^\s'"]+)[\s]*$)|(?:\/\*[@#][\s]*sourceMappingURL=([^\s*'"]+)[\s]*(?:\*\/)[\s]*$)/gm,o,s;s=i.exec(t);)o=s;return o?o[1]:null}var _=handlerExec(h);h.push(function(e){var t=retrieveSourceMapURL(e);if(!t)return null;var n;return p.test(t)?(n=o(t.slice(t.indexOf(`,`)+1),`base64`).toString(),t=e):(t=supportRelativeURL(e,t),n=g(t)),n?{url:t,map:n}:null});function mapSourcePosition(e){var t=f[e.source];if(!t){var r=_(e.source);r?(t=f[e.source]={url:r.url,map:new n(r.map)},t.map.sourcesContent&&t.map.sources.forEach(function(e,n){var r=t.map.sourcesContent[n];if(r){var i=supportRelativeURL(t.url,e);d[i]=r}})):t=f[e.source]={url:null,map:null}}if(t&&t.map&&typeof t.map.originalPositionFor==`function`){var i=t.map.originalPositionFor(e);if(i.source!==null)return i.source=supportRelativeURL(t.url,i.source),i}return e}function mapEvalOrigin(e){var t=/^eval at ([^(]+) \((.+):(\d+):(\d+)\)$/.exec(e);if(t){var n=mapSourcePosition({source:t[2],line:+t[3],column:t[4]-1});return`eval at `+t[1]+` (`+n.source+`:`+n.line+`:`+(n.column+1)+`)`}return t=/^eval at ([^(]+) \((.+)\)$/.exec(e),t?`eval at `+t[1]+` (`+mapEvalOrigin(t[2])+`)`:e}function CallSiteToString(){var e,t=``;if(this.isNative())t=`native`;else{e=this.getScriptNameOrSourceURL(),!e&&this.isEval()&&(t=this.getEvalOrigin(),t+=`, `),e?t+=e:t+=`<anonymous>`;var n=this.getLineNumber();if(n!=null){t+=`:`+n;var r=this.getColumnNumber();r&&(t+=`:`+r)}}var i=``,o=this.getFunctionName(),s=!0,c=this.isConstructor();if(this.isToplevel()||c)c?i+=`new `+(o||`<anonymous>`):o?i+=o:(i+=t,s=!1);else{var l=this.getTypeName();l===`[object Object]`&&(l=`null`);var u=this.getMethodName();o?(l&&o.indexOf(l)!=0&&(i+=l+`.`),i+=o,u&&o.indexOf(`.`+u)!=o.length-u.length-1&&(i+=` [as `+u+`]`)):i+=l+`.`+(u||`<anonymous>`)}return s&&(i+=` (`+t+`)`),i}function cloneCallSite(e){var t={};return Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach(function(n){t[n]=/^(?:is|get)/.test(n)?function(){return e[n].call(e)}:e[n]}),t.toString=CallSiteToString,t}function wrapCallSite(e,t){if(t===void 0&&(t={nextPosition:null,curPosition:null}),e.isNative())return t.curPosition=null,e;var n=e.getFileName()||e.getScriptNameOrSourceURL();if(n){var r=e.getLineNumber(),i=e.getColumnNumber()-1,o=/^v(10\.1[6-9]|10\.[2-9][0-9]|10\.[0-9]{3,}|1[2-9]\d*|[2-9]\d|\d{3,}|11\.11)/.test(globalProcessVersion())?0:62;r===1&&i>o&&!isInBrowser()&&!e.isEval()&&(i-=o);var s=mapSourcePosition({source:n,line:r,column:i});t.curPosition=s,e=cloneCallSite(e);var c=e.getFunctionName;return e.getFunctionName=function(){return t.nextPosition==null?c():t.nextPosition.name||c()},e.getFileName=function(){return s.source},e.getLineNumber=function(){return s.line},e.getColumnNumber=function(){return s.column+1},e.getScriptNameOrSourceURL=function(){return s.source},e}var l=e.isEval()&&e.getEvalOrigin();return l?(l=mapEvalOrigin(l),e=cloneCallSite(e),e.getEvalOrigin=function(){return l},e):e}function prepareStackTrace(e,t){l&&(d={},f={});for(var n=e.name||`Error`,r=e.message||``,i=n+`: `+r,o={nextPosition:null,curPosition:null},s=[],c=t.length-1;c>=0;c--)s.push(`
37
37
  at `+wrapCallSite(t[c],o)),o.nextPosition=o.curPosition;return o.curPosition=o.nextPosition=null,i+s.reverse().join(``)}function getErrorSource(e){var t=/\n at [^(]+ \((.*):(\d+):(\d+)\)/.exec(e.stack);if(t){var n=t[1],r=+t[2],o=+t[3],s=d[n];if(!s&&i&&i.existsSync(n))try{s=i.readFileSync(n,`utf8`)}catch{s=``}if(s){var c=s.split(/(?:\r\n|\r|\n)/)[r-1];if(c)return n+`:`+r+`
38
38
  `+c+`
39
- `+Array(o).join(` `)+`^`}}return null}function printErrorAndExit(e){var t=getErrorSource(e),n=globalProcessStderr();n&&n._handle&&n._handle.setBlocking&&n._handle.setBlocking(!0),t&&(O.error(),O.error(t)),O.error(e.stack),globalProcessExit(1)}function shimEmitUncaughtException(){var e=process.emit;process.emit=function(t){if(t===`uncaughtException`){var n=arguments[1]&&arguments[1].stack,r=this.listeners(t).length>0;if(n&&!r)return printErrorAndExit(arguments[1])}return e.apply(this,arguments)}}var v=m.slice(0),y=h.slice(0);e.wrapCallSite=wrapCallSite,e.getErrorSource=getErrorSource,e.mapSourcePosition=mapSourcePosition,e.retrieveSourceMap=_,e.install=function(e){if(e||={},e.environment&&(u=e.environment,[`node`,`browser`,`auto`].indexOf(u)===-1))throw Error(`environment `+u+` was unknown. Available options are {auto, browser, node}`);if(e.retrieveFile&&(e.overrideRetrieveFile&&(m.length=0),m.unshift(e.retrieveFile)),e.retrieveSourceMap&&(e.overrideRetrieveSourceMap&&(h.length=0),h.unshift(e.retrieveSourceMap)),e.hookRequire&&!isInBrowser()){var n=dynamicRequire(t,`module`),r=n.prototype._compile;r.__sourceMapSupport||(n.prototype._compile=function(e,t){return d[t]=e,f[t]=void 0,r.call(this,e,t)},n.prototype._compile.__sourceMapSupport=!0)}if(l||=`emptyCacheBetweenOperations`in e?e.emptyCacheBetweenOperations:!1,s||(s=!0,Error.prepareStackTrace=prepareStackTrace),!c){var i=`handleUncaughtExceptions`in e?e.handleUncaughtExceptions:!0;try{dynamicRequire(t,`worker_threads`).isMainThread===!1&&(i=!1)}catch{}i&&hasGlobalProcessEventEmitter()&&(c=!0,shimEmitUncaughtException())}},e.resetRetrieveHandlers=function(){m.length=0,h.length=0,m=v.slice(0),h=y.slice(0),_=handlerExec(h),g=handlerExec(m)}})),xl=__exportAll$3({Session:()=>Session,close:()=>close,console:()=>Sl,default:()=>Cl,open:()=>open,url:()=>url,waitForDebugger:()=>waitForDebugger});function open(e,t,n){}function close(){}function url(){}function waitForDebugger(){}var Session,Sl,Cl,wl=__esmMin(()=>{Session=class{connect(){}connectToMainThread(){}disconnect(){}post(e,t,n){n&&n(null)}on(e,t){return this}},Sl={...globalThis.console},Cl={open,close,url,waitForDebugger,Session,console:Sl}});k();var{__gjsifyModuleDir:Tl,__gjsifyModuleFile:El}=(ps(),__toCommonJS(us)),Dl=Tl(`@gjsify/tsc/lib/_tsc.js`),Ol=El(`@gjsify/tsc/lib/_tsc.js`),kl=`6.0`,Al=`6.0.3`,Y=[],jl=new Map
39
+ `+Array(o).join(` `)+`^`}}return null}function printErrorAndExit(e){var t=getErrorSource(e),n=globalProcessStderr();n&&n._handle&&n._handle.setBlocking&&n._handle.setBlocking(!0),t&&(O.error(),O.error(t)),O.error(e.stack),globalProcessExit(1)}function shimEmitUncaughtException(){var e=process.emit;process.emit=function(t){if(t===`uncaughtException`){var n=arguments[1]&&arguments[1].stack,r=this.listeners(t).length>0;if(n&&!r)return printErrorAndExit(arguments[1])}return e.apply(this,arguments)}}var v=m.slice(0),y=h.slice(0);e.wrapCallSite=wrapCallSite,e.getErrorSource=getErrorSource,e.mapSourcePosition=mapSourcePosition,e.retrieveSourceMap=_,e.install=function(e){if(e||={},e.environment&&(u=e.environment,[`node`,`browser`,`auto`].indexOf(u)===-1))throw Error(`environment `+u+` was unknown. Available options are {auto, browser, node}`);if(e.retrieveFile&&(e.overrideRetrieveFile&&(m.length=0),m.unshift(e.retrieveFile)),e.retrieveSourceMap&&(e.overrideRetrieveSourceMap&&(h.length=0),h.unshift(e.retrieveSourceMap)),e.hookRequire&&!isInBrowser()){var n=dynamicRequire(t,`module`),r=n.prototype._compile;r.__sourceMapSupport||(n.prototype._compile=function(e,t){return d[t]=e,f[t]=void 0,r.call(this,e,t)},n.prototype._compile.__sourceMapSupport=!0)}if(l||=`emptyCacheBetweenOperations`in e?e.emptyCacheBetweenOperations:!1,s||(s=!0,Error.prepareStackTrace=prepareStackTrace),!c){var i=`handleUncaughtExceptions`in e?e.handleUncaughtExceptions:!0;try{dynamicRequire(t,`worker_threads`).isMainThread===!1&&(i=!1)}catch{}i&&hasGlobalProcessEventEmitter()&&(c=!0,shimEmitUncaughtException())}},e.resetRetrieveHandlers=function(){m.length=0,h.length=0,m=v.slice(0),h=y.slice(0),_=handlerExec(h),g=handlerExec(m)}})),xl=__exportAll$3({Session:()=>Session,close:()=>close,console:()=>Sl,default:()=>Cl,open:()=>open,url:()=>url,waitForDebugger:()=>waitForDebugger});function open(e,t,n){}function close(){}function url(){}function waitForDebugger(){}var Session,Sl,Cl,wl=__esmMin(()=>{Session=class{connect(){}connectToMainThread(){}disconnect(){}post(e,t,n){n&&n(null)}on(e,t){return this}},Sl={...globalThis.console},Cl={open,close,url,waitForDebugger,Session,console:Sl}});k();var{__gjsifyModuleDir:Tl,__gjsifyModuleFile:El}=(ls(),__toCommonJS(os)),Dl=Tl(`@gjsify/tsc/lib/_tsc.js`),Ol=El(`@gjsify/tsc/lib/_tsc.js`),kl=`6.0`,Al=`6.0.3`,Y=[],jl=new Map
40
40
  /*! *****************************************************************************
41
41
  Copyright (c) Microsoft Corporation. All rights reserved.
42
42
  Licensed under the Apache License, Version 2.0 (the "License"); you may not use