@gjsify/example-node-express-webserver 0.4.34 → 0.4.36

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/index.gjs.js +26 -26
  2. package/package.json +16 -7
package/dist/index.gjs.js CHANGED
@@ -2,8 +2,8 @@ if(globalThis.__gjsifyBundleUrl??=import.meta.url,globalThis.process===void 0){l
2
2
  `)}else if(fe){let n=` `.repeat(this._groupDepth*this._groupIndentation)+_formatArgs(...t);e===`stderr`?printerr(n):print(n)}else{let n=globalThis.console;e===`stderr`?n.error(...t):n.log(...t)}}log(...e){this._write(`stdout`,...e)}info(...e){this._write(`stdout`,...e)}debug(...e){this._write(`stdout`,...e)}warn(...e){this._write(`stderr`,...e)}error(...e){this._write(`stderr`,...e)}dir(e,t){this._write(`stdout`,e)}dirxml(...e){this.log(...e)}assert(e,...t){e||this.error(`Assertion failed:`,...t)}clear(){this._stdout?this._stdout.write(`\x1Bc`):fe?print(`\x1Bc`):globalThis.console.clear()}count(e=`default`){let t=(this._counters.get(e)||0)+1;this._counters.set(e,t),this.log(`${e}: ${t}`)}countReset(e=`default`){this._counters.delete(e)}group(...e){e.length>0&&this.log(...e),this._groupDepth++}groupCollapsed(...e){this.group(...e)}groupEnd(){this._groupDepth>0&&this._groupDepth--}table(e,t){this._stdout?this._write(`stdout`,e):fe?print(JSON.stringify(e,null,2)):globalThis.console.table(e,t)}time(e=`default`){this._timers.set(e,Date.now())}timeEnd(e=`default`){let t=this._timers.get(e);t===void 0?this.warn(`Warning: No such label '${e}' for console.timeEnd()`):(this.log(`${e}: ${Date.now()-t}ms`),this._timers.delete(e))}timeLog(e=`default`,...t){let n=this._timers.get(e);n===void 0?this.warn(`Warning: No such label '${e}' for console.timeLog()`):this.log(`${e}: ${Date.now()-n}ms`,...t)}trace(...e){let t=Error().stack?.split(`
3
3
  `).slice(1).join(`
4
4
  `)||``;this._write(`stderr`,`Trace:`,...e,`
5
- `+t)}profile(e){}profileEnd(e){}timeStamp(e){}},F=new Console,log=(...e)=>F.log(...e),info=(...e)=>F.info(...e),debug=(...e)=>F.debug(...e),warn=(...e)=>F.warn(...e),error=(...e)=>F.error(...e),dir=(e,t)=>F.dir(e,t),dirxml=(...e)=>F.dirxml(...e),table=(e,t)=>F.table(e,t),clear=()=>F.clear(),assert=(e,...t)=>F.assert(e,...t),trace=(...e)=>F.trace(...e),time=e=>F.time(e),timeEnd=e=>F.timeEnd(e),timeLog=(e,...t)=>F.timeLog(e,...t),count=e=>F.count(e),countReset=e=>F.countReset(e),group=(...e)=>F.group(...e),groupCollapsed=(...e)=>F.groupCollapsed(...e),groupEnd=()=>F.groupEnd(),profile=e=>{},profileEnd=e=>{},timeStamp=e=>{}}),I,me=__esmMin(()=>{pe(),I={log,info,debug,warn,error,dir,dirxml,table,time,timeEnd,timeLog,trace,assert,clear,count,countReset,group,groupCollapsed,groupEnd,profile,profileEnd,timeStamp}}),he=__esmMin(()=>{me()}),ge,_e=__esmMin(()=>{ge=__name(e=>{Promise.resolve().then(e)},`queueMicrotask`)});function drainOnce(e){let t=Math.min(64,ve.length);for(let n=0;n<t;n++){let t=ve.shift();try{t()}catch(t){try{e.log_default_handler(`gjsify-nextTick`,e.LogLevelFlags.LEVEL_WARNING,String(t?.stack||t),null)}catch{}}}ve.length>0?e.timeout_add(e.PRIORITY_DEFAULT,1,()=>(drainOnce(e),!1)):ye=!1}function tryGLibTimeout(e){let t=globalThis.imports?.gi?.GLib;return t?.timeout_add?(ve.push(e),ye||(ye=!0,t.timeout_add(t.PRIORITY_DEFAULT,0,()=>(drainOnce(t),!1))),!0):!1}var ve,ye,nextTick,be=__esmMin(()=>{ve=[],ye=!1,nextTick=(e,...t)=>{let n=t.length>0?()=>e(...t):e;if(!tryGLibTimeout(n)){if(typeof globalThis.process?.nextTick==`function`){globalThis.process.nextTick(e,...t);return}if(typeof queueMicrotask==`function`){queueMicrotask(n);return}Promise.resolve().then(n)}}}),xe,Se=__esmMin(()=>{A(),P(),{File:xe}=N});function classOf(e){return Ce.call(e).slice(8,-1)}function throwDataCloneError(e){let t=globalThis.DOMException;if(typeof t==`function`)throw new t(e,`DataCloneError`);let n=Error(e);throw n.name=`DataCloneError`,n}function internalClone(e,t,n){if(e==null)return e;let r=typeof e;if(r===`boolean`||r===`number`||r===`string`||r===`bigint`)return e;r===`symbol`&&throwDataCloneError(`Symbol cannot be cloned`),r===`function`&&throwDataCloneError(`Function cannot be cloned`);let i=e;if(t.has(i))return t.get(i);let a=classOf(i);if(a===`Date`)return new Date(i.getTime());if(a===`RegExp`)return new RegExp(i.source,i.flags);if(a===`Boolean`||a===`Number`||a===`String`)return Object(i.valueOf());if(a===`BigInt`)return Object(BigInt.prototype.valueOf.call(i));if(i instanceof Error){let e=i,r=e.constructor?.name,a=new(r&&we[r]||we[e.name]||Error)(e.message);return a.name=e.name,`cause`in e&&Object.defineProperty(a,"cause",{value:internalClone(e.cause,t,n),writable:!0,enumerable:!1,configurable:!0}),a}if(a===`DOMException`){let e=globalThis.DOMException;if(typeof e==`function`){let t=i;return new e(t.message,t.name)}}if(a===`ArrayBuffer`){let e=i;if(n&&n.transferred.has(e)){let r=n.transferred.get(e);return t.set(i,r),r}(e.detached===!0||e.byteLength===0&&e.detached)&&throwDataCloneError(`ArrayBuffer is detached and cannot be cloned`);let r=e.slice(0);return t.set(i,r),r}if(a===`SharedArrayBuffer`||i&&typeof i==`object`&&i.constructor?.name===`SharedBuffer`)return i;if(a===`DataView`){let e=i,r=n?.viewSnapshots.get(i),a=internalClone(e.buffer,t,n),o=r?r.byteOffset:e.byteOffset,s=r?r.byteLength:e.byteLength,c=new DataView(a,o,s);return t.set(i,c),c}if(Te.has(a)){let e=i,r=n?.viewSnapshots.get(i),a=internalClone(e.buffer,t,n),o=e.constructor,s=new o(a,r?r.byteOffset:e.byteOffset,r?r.length:e.length);return t.set(i,s),s}if(a===`Map`){let e=new Map;t.set(i,e);for(let[r,a]of i)e.set(internalClone(r,t,n),internalClone(a,t,n));return e}if(a===`Set`){let e=new Set;t.set(i,e);for(let r of i)e.add(internalClone(r,t,n));return e}{let e=globalThis,t=e.Blob,n=e.File;if(typeof n==`function`&&i instanceof n){let e=i;return new n([i],e.name,{type:e.type,lastModified:e.lastModified})}if(typeof t==`function`&&i instanceof t)return new t([i],{type:i.type})}if(i instanceof WeakMap&&throwDataCloneError(`WeakMap cannot be cloned`),i instanceof WeakSet&&throwDataCloneError(`WeakSet cannot be cloned`),i instanceof WeakRef&&throwDataCloneError(`WeakRef cannot be cloned`),typeof globalThis.Promise==`function`&&i instanceof Promise&&throwDataCloneError(`Promise cannot be cloned`),a===`Array`){let e=i,r=[];t.set(i,r);for(let i=0;i<e.length;i++)i in e&&(r[i]=internalClone(e[i],t,n));return r}if(a===`Object`||typeof i==`object`){let e={};t.set(i,e);for(let r of Object.keys(i))e[r]=internalClone(i[r],t,n);return e}throwDataCloneError(`${a} cannot be cloned`)}function structuredClone$1(e,t){let n=t?.transfer;if(!n||n.length===0)return internalClone(e,new Map);let r=new Set;for(let e of n)if(classOf(e)===`ArrayBuffer`){let t=e;t.detached===!0&&throwDataCloneError(`ArrayBuffer in transfer list is detached`),r.add(t)}let i=new Map;r.size>0&&snapshotViewsBackedByTransferredBuffers(e,r,i,new Set);let a=new Map;for(let e of r){let t=e;typeof t.transfer!=`function`&&throwDataCloneError(`ArrayBuffer.prototype.transfer() not available — runtime is not SM140+`),a.set(e,t.transfer())}return internalClone(e,new Map,{transferred:a,viewSnapshots:i})}function snapshotViewsBackedByTransferredBuffers(e,t,n,r){if(typeof e!=`object`||!e)return;let i=e;if(r.has(i))return;r.add(i);let a=classOf(i);if(a===`DataView`){let e=i;t.has(e.buffer)&&n.set(i,{byteOffset:e.byteOffset,length:0,byteLength:e.byteLength});return}if(Te.has(a)){let e=i;t.has(e.buffer)&&n.set(i,{byteOffset:e.byteOffset,length:e.length,byteLength:e.byteLength});return}if(Array.isArray(i)){for(let e=0;e<i.length;e++)e in i&&snapshotViewsBackedByTransferredBuffers(i[e],t,n,r);return}if(a===`Map`){for(let[e,a]of i)snapshotViewsBackedByTransferredBuffers(e,t,n,r),snapshotViewsBackedByTransferredBuffers(a,t,n,r);return}if(a===`Set`){for(let e of i)snapshotViewsBackedByTransferredBuffers(e,t,n,r);return}if(a===`Object`)for(let e of Object.keys(i))snapshotViewsBackedByTransferredBuffers(i[e],t,n,r)}var Ce,we,Te,Ee=__esmMin(()=>{({toString:Ce}=Object.prototype),we={Error,EvalError,RangeError,ReferenceError,SyntaxError,TypeError,URIError},Te=new Set([`Int8Array`,`Uint8Array`,`Uint8ClampedArray`,`Int16Array`,`Uint16Array`,`Int32Array`,`Uint32Array`,`Float32Array`,`Float64Array`,`BigInt64Array`,`BigUint64Array`]),__name(structuredClone$1,`structuredClone`)});function ensureMainLoop(){let e=globalThis.imports;if(!e)return;if(De)return Oe;let t=e.gi?.GLib;if(t){if(Oe=new t.MainLoop(null,!1),De=!0,t.main_depth()===0)try{Oe.runAsync()}catch{}return Oe}}function quitMainLoop(){Oe&&=(Oe.quit(),De=!1,null)}var De,Oe,ke=__esmMin(()=>{De=!1,Oe=null}),L=__esmMin(()=>{T(),E(),j(),M(),ee(),te(),oe(),le(),ue(),de(),he(),_e(),be(),Se(),Ee(),ke()});w(),L(),registerGlobal(`Blob`,x),registerGlobal(`File`,S);var Ae=Object.defineProperty;__name((e,t)=>{let n={};for(var r in e)Ae(n,r,{get:e[r],enumerable:!0});return t||Ae(n,Symbol.toStringTag,{value:`Module`}),n},`__exportAll`)({attributes:()=>U,childNodesList:()=>V,elementChildren:()=>H,isConnected:()=>je,localName:()=>Ne,name:()=>Ie,namespaceURI:()=>Pe,nodeType:()=>z,ownerElement:()=>Re,parentNode:()=>B,prefix:()=>Fe,propertyEventListeners:()=>W,tagName:()=>Me,value:()=>Le});const z=Symbol(`nodeType`),B=Symbol(`parentNode`),V=Symbol(`childNodesList`),H=Symbol(`elementChildren`),je=Symbol(`isConnected`),Me=Symbol(`tagName`),Ne=Symbol(`localName`),Pe=Symbol(`namespaceURI`),Fe=Symbol(`prefix`),U=Symbol(`attributes`),W=Symbol(`propertyEventListeners`),Ie=Symbol(`name`),Le=Symbol(`value`),Re=Symbol(`ownerElement`),G={ELEMENT_NODE:1,ATTRIBUTE_NODE:2,TEXT_NODE:3,CDATA_SECTION_NODE:4,PROCESSING_INSTRUCTION_NODE:7,COMMENT_NODE:8,DOCUMENT_NODE:9,DOCUMENT_TYPE_NODE:10,DOCUMENT_FRAGMENT_NODE:11};var NodeList=class{constructor(e){this._items=e}get length(){return this._items.length}item(e){return this._items[e]??null}forEach(e,t){for(let n=0;n<this._items.length;n++)e.call(t,this._items[n],n,this)}entries(){return this._items.entries()}keys(){return this._items.keys()}values(){return this._items.values()}[Symbol.iterator](){return this._items[Symbol.iterator]()}get[Symbol.toStringTag](){return`NodeList`}};const ze={IndexSizeError:1,HierarchyRequestError:3,WrongDocumentError:4,InvalidCharacterError:5,NoModificationAllowedError:7,NotFoundError:8,NotSupportedError:9,InUseAttributeError:10,InvalidStateError:11,SyntaxError:12,InvalidModificationError:13,NamespaceError:14,InvalidAccessError:15,TypeMismatchError:17,SecurityError:18,NetworkError:19,AbortError:20,URLMismatchError:21,QuotaExceededError:22,TimeoutError:23,InvalidNodeTypeError:24,DataCloneError:25};var _DOMExceptionPolyfill=class extends Error{code;constructor(e,t){super(e),this.name=t||`Error`,this.code=Object.hasOwn(ze,this.name)?ze[this.name]:0}};const Be=globalThis.DOMException===void 0?_DOMExceptionPolyfill:globalThis.DOMException;me();const Ve=Symbol(`type`),He=Symbol(`bubbles`),Ue=Symbol(`cancelable`),We=Symbol(`composed`),Ge=Symbol(`target`),Ke=Symbol(`currentTarget`),qe=Symbol(`eventPhase`),Je=Symbol(`defaultPrevented`),Ye=Symbol(`isTrusted`),Xe=Symbol(`timeStamp`),Ze=Symbol(`stop`),Qe=Symbol(`immediateStop`),$e=Symbol(`dispatching`),et=Symbol(`inPassiveListener`);var Event=class{[Ve];[He];[Ue];[We];[Ge]=null;[Ke]=null;[qe]=0;[Je]=!1;[Ye]=!1;[Xe];[Ze]=!1;[Qe]=!1;[$e]=!1;[et]=!1;get type(){return this[Ve]}get bubbles(){return this[He]}get cancelable(){return this[Ue]}get composed(){return this[We]}get target(){return this[Ge]}get currentTarget(){return this[Ke]}get eventPhase(){return this[qe]}get defaultPrevented(){return this[Je]}get timeStamp(){return this[Xe]}get cancelBubble(){return this[Ze]}set cancelBubble(e){e&&this.stopPropagation()}get returnValue(){return!this[Je]}set returnValue(e){e||this.preventDefault()}get srcElement(){return this[Ge]}static NONE=0;static CAPTURING_PHASE=1;static AT_TARGET=2;static BUBBLING_PHASE=3;get[Symbol.toStringTag](){return`Event`}constructor(e,t){this[Ve]=e,this[He]=t?.bubbles??!1,this[Ue]=t?.cancelable??!1,this[We]=t?.composed??!1,this[Xe]=Date.now(),Object.defineProperty(this,"isTrusted",{get:()=>this[Ye],enumerable:!0,configurable:!1})}composedPath(){return this[Ke]?[this[Ke]]:[]}preventDefault(){this[Ue]&&!this[et]&&(this[Je]=!0)}stopPropagation(){this[Ze]=!0}stopImmediatePropagation(){this[Ze]=!0,this[Qe]=!0}},EventTarget=class{_listeners=new Map;get[Symbol.toStringTag](){return`EventTarget`}addEventListener(e,t,n){if(t===null)return;let r=typeof n==`boolean`?n:n?.capture??!1,i=typeof n==`object`?n?.once??!1:!1,a=typeof n==`object`?n?.passive??!1:!1,o=this._listeners.get(e);o||(o=[],this._listeners.set(e,o));for(let e of o)if(e.listener===t&&e.capture===r)return;let s={listener:t,capture:r,once:i,passive:a,removed:!1};o.push(s),typeof n==`object`&&n?.signal&&n.signal.addEventListener(`abort`,()=>{this.removeEventListener(e,t,{capture:r})},{once:!0})}removeEventListener(e,t,n){if(t===null)return;let r=typeof n==`boolean`?n:n?.capture??!1,i=this._listeners.get(e);if(!i)return;let a=i.findIndex(e=>e.listener===t&&e.capture===r);a!==-1&&(i[a].removed=!0,i.splice(a,1),i.length===0&&this._listeners.delete(e))}dispatchEvent(e){let t=e;if(t[$e])throw new Be(`The event is already being dispatched.`,`InvalidStateError`);t[$e]=!0,t[Ge]=this,t[Ke]=this,t[qe]=Event.AT_TARGET;let n=this._listeners.get(e.type);if(n){let r=[...n];for(let n of r)if(!n.removed){if(t[Qe]||t[Ze])break;n.once&&this.removeEventListener(e.type,n.listener,{capture:n.capture});try{n.passive&&(t[et]=!0),typeof n.listener==`function`?n.listener.call(this,e):typeof n.listener.handleEvent==`function`&&n.listener.handleEvent.call(n.listener,e)}catch(e){I.error(e)}finally{t[et]=!1}}}return t[qe]=Event.NONE,t[Ke]=null,t[$e]=!1,!e.defaultPrevented}};for(let[e,t]of[[`NONE`,0],[`CAPTURING_PHASE`,1],[`AT_TARGET`,2],[`BUBBLING_PHASE`,3]])Object.defineProperty(Event.prototype,e,{value:t,writable:!1,enumerable:!0,configurable:!1}),Object.defineProperty(Event,e,{value:t,writable:!1,enumerable:!0,configurable:!1});let tt,nt,rt,it,at;var ot=class Node extends EventTarget{constructor(...e){super(...e),this.ELEMENT_NODE=G.ELEMENT_NODE,this.ATTRIBUTE_NODE=G.ATTRIBUTE_NODE,this.TEXT_NODE=G.TEXT_NODE,this.CDATA_SECTION_NODE=G.CDATA_SECTION_NODE,this.PROCESSING_INSTRUCTION_NODE=G.PROCESSING_INSTRUCTION_NODE,this.COMMENT_NODE=G.COMMENT_NODE,this.DOCUMENT_NODE=G.DOCUMENT_NODE,this.DOCUMENT_TYPE_NODE=G.DOCUMENT_TYPE_NODE,this.DOCUMENT_FRAGMENT_NODE=G.DOCUMENT_FRAGMENT_NODE,this[tt]=G.ELEMENT_NODE,this[nt]=null,this[rt]=[],this[it]=[],this[at]=!1}static{this.ELEMENT_NODE=G.ELEMENT_NODE}static{this.ATTRIBUTE_NODE=G.ATTRIBUTE_NODE}static{this.TEXT_NODE=G.TEXT_NODE}static{this.CDATA_SECTION_NODE=G.CDATA_SECTION_NODE}static{this.PROCESSING_INSTRUCTION_NODE=G.PROCESSING_INSTRUCTION_NODE}static{this.COMMENT_NODE=G.COMMENT_NODE}static{this.DOCUMENT_NODE=G.DOCUMENT_NODE}static{this.DOCUMENT_TYPE_NODE=G.DOCUMENT_TYPE_NODE}static{this.DOCUMENT_FRAGMENT_NODE=G.DOCUMENT_FRAGMENT_NODE}static{this.DOCUMENT_POSITION_DISCONNECTED=1}static{this.DOCUMENT_POSITION_PRECEDING=2}static{this.DOCUMENT_POSITION_FOLLOWING=4}static{this.DOCUMENT_POSITION_CONTAINS=8}static{this.DOCUMENT_POSITION_CONTAINED_BY=16}static{this.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC=32}get nodeType(){return this[z]}get nodeName(){return``}get parentNode(){return this[B]}get parentElement(){let e=this[B];return e&&e[z]===G.ELEMENT_NODE?e:null}get childNodes(){return new NodeList(this[V])}get firstChild(){return this[V][0]??null}get lastChild(){let e=this[V];return e[e.length-1]??null}get previousSibling(){let e=this[B];if(!e)return null;let t=e[V],n=t.indexOf(this);return n>0?t[n-1]:null}get nextSibling(){let e=this[B];if(!e)return null;let t=e[V],n=t.indexOf(this);return n!==-1&&n<t.length-1?t[n+1]:null}get textContent(){return null}set textContent(e){}get nodeValue(){return null}set nodeValue(e){}get ownerDocument(){let e=this;for(;e[B];)e=e[B];let t=globalThis.document;return e===t?t:null}get isConnected(){return this[je]}hasChildNodes(){return this[V].length>0}contains(e){if(e===null)return!1;if(e===this)return!0;let t=e;for(;t;){if(t===this)return!0;t=t[B]}return!1}getRootNode(){let e=this;for(;e[B];)e=e[B];return e}appendChild(e){return e[B]&&e[B].removeChild(e),e[B]=this,this[V].push(e),e[z]===G.ELEMENT_NODE&&this[H].push(e),e}removeChild(e){let t=this[V],n=t.indexOf(e);if(n===-1)throw new DOMException(`Failed to execute 'removeChild' on 'Node': The node to be removed is not a child of this node.`,`NotFoundError`);if(t.splice(n,1),e[B]=null,e[z]===G.ELEMENT_NODE){let t=this[H].indexOf(e);t!==-1&&this[H].splice(t,1)}return e}insertBefore(e,t){if(t===null)return this.appendChild(e);let n=this[V],r=n.indexOf(t);if(r===-1)throw new DOMException(`Failed to execute 'insertBefore' on 'Node': The node before which the new node is to be inserted is not a child of this node.`,`NotFoundError`);if(e[B]&&e[B].removeChild(e),e[B]=this,n.splice(r,0,e),e[z]===G.ELEMENT_NODE){let t=this[H],i=t.length;for(let a=r;a<n.length;a++)if(n[a][z]===G.ELEMENT_NODE&&n[a]!==e){i=t.indexOf(n[a]);break}t.splice(i,0,e)}return e}replaceChild(e,t){return this.insertBefore(e,t),this.removeChild(t),t}cloneNode(e=!1){let t=new this.constructor;if(t[z]=this[z],e)for(let e of this[V])t.appendChild(e.cloneNode(!0));return t}dispatchEvent(e){let t=super.dispatchEvent(e);if(e.bubbles&&!e.cancelBubble){let t=this[B];for(;t&&(Object.getPrototypeOf(Node.prototype).dispatchEvent.call(t,e),!e.cancelBubble);)t=t[B]}return t}get[(tt=z,nt=B,rt=V,it=H,at=je,Symbol.toStringTag)](){return`Node`}};const st={html:`http://www.w3.org/1999/xhtml`,svg:`http://www.w3.org/2000/svg`,mathML:`http://www.w3.org/1998/Math/MathML`,xml:`http://www.w3.org/XML/1998/namespace`,xmlns:`http://www.w3.org/2000/xmlns/`};var Attr=class{constructor(e,t,n=null,r=null,i=null){this.specified=!0,this[Ie]=e,this[Le]=t,this[Re]=i,this.namespaceURI=n,this.prefix=r;let a=e.indexOf(`:`);this.localName=a===-1?e:e.slice(a+1)}get name(){return this[Ie]}get value(){return this[Le]}set value(e){this[Le]=e}get ownerElement(){return this[Re]}get[Symbol.toStringTag](){return`Attr`}},NamedNodeMap=class{constructor(e){this._items=[],this._ownerElement=e}get length(){return this._items.length}item(e){return this._items[e]??null}getNamedItem(e){return this._findByName(e)}getNamedItemNS(e,t){let n=e===``?null:e;for(let e of this._items)if(e.namespaceURI===n&&e.localName===t)return e;return null}setNamedItem(e){return this._setAttr(e)}setNamedItemNS(e){return this._setAttr(e)}removeNamedItem(e){let t=this._findByName(e);if(!t)throw new DOMException(`Failed to execute 'removeNamedItem' on 'NamedNodeMap': No item with name '${e}' was found.`,`NotFoundError`);return this._removeAttr(t),t}removeNamedItemNS(e,t){let n=this.getNamedItemNS(e,t);if(!n)throw new DOMException(`Failed to execute 'removeNamedItemNS' on 'NamedNodeMap': No item with namespace '${e}' and localName '${t}' was found.`,`NotFoundError`);return this._removeAttr(n),n}[Symbol.iterator](){return this._items[Symbol.iterator]()}get[Symbol.toStringTag](){return`NamedNodeMap`}_setNamedItem(e,t,n=null,r=null){let i=n===null?this._findByName(e):this.getNamedItemNS(n,e.includes(`:`)?e.split(`:`)[1]:e);if(i)i.value=t;else{let i=new Attr(e,t,n,r,this._ownerElement);this._items.push(i)}}_removeNamedItem(e){let t=this._findByName(e);return t?(this._removeAttr(t),!0):!1}_removeNamedItemNS(e,t){let n=this.getNamedItemNS(e,t);return n?(this._removeAttr(n),!0):!1}_findByName(e){let t=this._ownerElement.namespaceURI===st.html,n=t?e.toLowerCase():e;for(let e of this._items)if((t?e.name.toLowerCase():e.name)===n)return e;return null}_setAttr(e){let t=null;if(t=e.namespaceURI===null?this._findByName(e.name):this.getNamedItemNS(e.namespaceURI,e.localName),t){let n=new Attr(t.name,t.value,t.namespaceURI,t.prefix,t.ownerElement);return t.value=e.value,n}return this._items.push(e),null}_removeAttr(e){let t=this._items.indexOf(e);t!==-1&&this._items.splice(t,1)}};me();let ct,lt,ut,dt,ft,pt;var Element=class extends ot{constructor(){super(),this[ct]=``,this[lt]=``,this[ut]=st.html,this[dt]=null,this[ft]=new NamedNodeMap(this),this[pt]=new Map,this._resizeSubscribers=null,this._allocatedClientWidth=0,this._allocatedClientHeight=0,this._pointerCaptures=new Set,this[z]=G.ELEMENT_NODE}get tagName(){return this[Me]}get localName(){return this[Ne]}get namespaceURI(){return this[Pe]}get prefix(){return this[Fe]}get nodeName(){return this[Me]}get attributes(){return this[U]}get id(){return this.getAttribute(`id`)??``}set id(e){this.setAttribute(`id`,e)}get className(){return this.getAttribute(`class`)??``}set className(e){this.setAttribute(`class`,e)}get children(){return this[H]}get childElementCount(){return this[H].length}get firstElementChild(){return this[H][0]??null}get lastElementChild(){let e=this[H];return e[e.length-1]??null}get previousElementSibling(){let e=this[B];if(!e)return null;let t=e[H],n=t.indexOf(this);return n>0?t[n-1]:null}get nextElementSibling(){let e=this[B];if(!e)return null;let t=e[H],n=t.indexOf(this);return n!==-1&&n<t.length-1?t[n+1]:null}get textContent(){let e=``;for(let t of this[V])t.textContent!==null&&(e+=t.textContent);return e}set textContent(e){let t=this[V];for(;t.length>0;)this.removeChild(t[0])}getAttribute(e){let t=this[U].getNamedItem(e);return t?t.value:null}getAttributeNS(e,t){let n=this[U].getNamedItemNS(e,t);return n?n.value:null}setAttribute(e,t){this[U]._setNamedItem(e,String(t))}setAttributeNS(e,t,n){let r=e===``?null:e,i=t.split(`:`),a=i.length>1?i[0]:null;this[U]._setNamedItem(t,String(n),r,a)}removeAttribute(e){this[U]._removeNamedItem(e)}removeAttributeNS(e,t){let n=e===``?null:e;this[U]._removeNamedItemNS(n,t)}hasAttribute(e){return this[U].getNamedItem(e)!==null}hasAttributeNS(e,t){return this[U].getNamedItemNS(e,t)!==null}getAttributeNode(e){return this[U].getNamedItem(e)}setAttributeNode(e){return this[U].setNamedItem(e)}removeAttributeNode(e){let t=this[U].getNamedItem(e.name);if(!t)throw new DOMException(`Failed to execute 'removeAttributeNode' on 'Element': The attribute is not owned by this element.`,`NotFoundError`);return this[U].removeNamedItem(t.name),t}toggleAttribute(e,t){return t===void 0?this.hasAttribute(e)?(this.removeAttribute(e),!1):(this.setAttribute(e,``),!0):t?(this.setAttribute(e,``),!0):(this.removeAttribute(e),!1)}hasAttributes(){return this[U].length>0}dispatchEvent(e){let t=super.dispatchEvent(e),n=this[W].get(`on`+e.type);return typeof n==`function`&&n.call(this,e),t}querySelector(e){return null}querySelectorAll(e){return[]}matches(e){return!1}closest(e){return null}getElementsByTagName(e){let t=[],n=e.toUpperCase(),walk=r=>{for(let i of r[V])if(i[z]===G.ELEMENT_NODE){let r=i;(e===`*`||r[Me]===n)&&t.push(r),walk(r)}};return walk(this),t}getElementsByClassName(e){let t=[],n=e.split(/\s+/).filter(Boolean),walk=e=>{for(let r of e[V])if(r[z]===G.ELEMENT_NODE){let e=r,i=e.className.split(/\s+/);n.every(e=>i.includes(e))&&t.push(e),walk(e)}};return walk(this),t}cloneNode(e=!1){let t=super.cloneNode(!1);t[Me]=this[Me],t[Ne]=this[Ne],t[Pe]=this[Pe],t[Fe]=this[Fe];for(let e of this[U])t.setAttributeNS(e.namespaceURI,e.name,e.value);if(e)for(let e of this[V])t.appendChild(e.cloneNode(!0));return t}_onResize(e){let t=this._resizeSubscribers??=new Set;return t.add(e),()=>{t.delete(e),t.size===0&&(this._resizeSubscribers=null)}}_fireResizeSubscribers(e,t){let n=this._resizeSubscribers;if(!(!n||n.size===0))for(let r of[...n])try{r(e,t)}catch(e){I.error(`ResizeObserver subscriber threw:`,e)}}setPointerCapture(e){this._pointerCaptures.add(e)}releasePointerCapture(e){this._pointerCaptures.delete(e)}hasPointerCapture(e){return this._pointerCaptures.has(e)}get[(ct=Me,lt=Ne,ut=Pe,dt=Fe,ft=U,pt=W,Symbol.toStringTag)](){return`Element`}},CSSStyleDeclaration=class{constructor(){this._cssText=``}get cssText(){return this._cssText}set cssText(e){this._cssText=e;for(let t of e.split(`;`)){let e=t.indexOf(`:`);if(e===-1)continue;let n=t.slice(0,e).trim(),r=t.slice(e+1).trim();if(!n)continue;let i=n.replace(/-([a-z])/g,(e,t)=>t.toUpperCase());this[i]=r}}setProperty(e,t,n){this[e]=t}getPropertyValue(e){let t=this[e];return typeof t==`string`?t:``}removeProperty(e){let t=this[e];return delete this[e],typeof t==`string`?t:``}getPropertyPriority(e){return``}},HTMLElement$1=class extends Element{static{__name(this,`HTMLElement`)}constructor(...e){super(...e),this.style=new CSSStyleDeclaration}get dataset(){let e=this;return new Proxy({},{get(t,n){if(typeof n!=`string`)return;let r=`data-`+n.replace(/[A-Z]/g,e=>`-`+e.toLowerCase());return e.getAttribute(r)??void 0},set(t,n,r){if(typeof n!=`string`)return!1;let i=`data-`+n.replace(/[A-Z]/g,e=>`-`+e.toLowerCase());return e.setAttribute(i,String(r)),!0},deleteProperty(t,n){if(typeof n!=`string`)return!1;let r=`data-`+n.replace(/[A-Z]/g,e=>`-`+e.toLowerCase());return e.removeAttribute(r),!0},has(t,n){if(typeof n!=`string`)return!1;let r=`data-`+n.replace(/[A-Z]/g,e=>`-`+e.toLowerCase());return e.hasAttribute(r)}})}get title(){return this.getAttribute(`title`)??``}set title(e){this.setAttribute(`title`,e)}get lang(){return this.getAttribute(`lang`)??``}set lang(e){this.setAttribute(`lang`,e)}get dir(){return this.getAttribute(`dir`)??``}set dir(e){this.setAttribute(`dir`,e)}get accessKey(){return this.getAttribute(`accesskey`)??``}set accessKey(e){this.setAttribute(`accesskey`,e)}get accessKeyLabel(){return this.getAttribute(`accesskey`)??``}get hidden(){return this.hasAttribute(`hidden`)}set hidden(e){e?this.setAttribute(`hidden`,``):this.removeAttribute(`hidden`)}get draggable(){return this.getAttribute(`draggable`)===`true`}set draggable(e){this.setAttribute(`draggable`,String(e))}get spellcheck(){let e=this.getAttribute(`spellcheck`);return e===`false`?!1:e!==null}set spellcheck(e){this.setAttribute(`spellcheck`,String(e))}get translate(){return this.getAttribute(`translate`)!==`no`}set translate(e){this.setAttribute(`translate`,e?`yes`:`no`)}get tabIndex(){let e=this.getAttribute(`tabindex`);return e===null?-1:Number(e)}set tabIndex(e){this.setAttribute(`tabindex`,String(e))}get contentEditable(){let e=this.getAttribute(`contenteditable`);return e===``||e===`true`?`true`:e===`false`?`false`:`inherit`}set contentEditable(e){e===`inherit`?this.removeAttribute(`contenteditable`):this.setAttribute(`contenteditable`,e)}get isContentEditable(){return this.contentEditable===`true`}get offsetHeight(){return this._allocatedClientHeight}get offsetWidth(){return this._allocatedClientWidth}get offsetLeft(){return 0}get offsetTop(){return 0}get offsetParent(){return null}get clientHeight(){return this._allocatedClientHeight}get clientWidth(){return this._allocatedClientWidth}get clientLeft(){return 0}get clientTop(){return 0}get scrollHeight(){return this._allocatedClientHeight}get scrollWidth(){return this._allocatedClientWidth}get scrollTop(){return 0}set scrollTop(e){}get scrollLeft(){return 0}set scrollLeft(e){}getBoundingClientRect(){let e=this.clientWidth,t=this.clientHeight;return{x:0,y:0,top:0,left:0,right:e,bottom:t,width:e,height:t,toJSON(){return this}}}click(){this.dispatchEvent(new Event(`click`,{bubbles:!0,cancelable:!0}))}blur(){this.dispatchEvent(new Event(`blur`))}focus(){this.dispatchEvent(new Event(`focus`))}get onclick(){return this[W].get(`onclick`)??null}set onclick(e){this[W].set(`onclick`,e)}get ondblclick(){return this[W].get(`ondblclick`)??null}set ondblclick(e){this[W].set(`ondblclick`,e)}get onload(){return this[W].get(`onload`)??null}set onload(e){this[W].set(`onload`,e)}get onerror(){return this[W].get(`onerror`)??null}set onerror(e){this[W].set(`onerror`,e)}get onabort(){return this[W].get(`onabort`)??null}set onabort(e){this[W].set(`onabort`,e)}get onfocus(){return this[W].get(`onfocus`)??null}set onfocus(e){this[W].set(`onfocus`,e)}get onblur(){return this[W].get(`onblur`)??null}set onblur(e){this[W].set(`onblur`,e)}get onchange(){return this[W].get(`onchange`)??null}set onchange(e){this[W].set(`onchange`,e)}get oninput(){return this[W].get(`oninput`)??null}set oninput(e){this[W].set(`oninput`,e)}get onsubmit(){return this[W].get(`onsubmit`)??null}get onreset(){return this[W].get(`onreset`)??null}set onreset(e){this[W].set(`onreset`,e)}get onscroll(){return this[W].get(`onscroll`)??null}set onscroll(e){this[W].set(`onscroll`,e)}get onresize(){return this[W].get(`onresize`)??null}set onresize(e){this[W].set(`onresize`,e)}get onmousedown(){return this[W].get(`onmousedown`)??null}set onmousedown(e){this[W].set(`onmousedown`,e)}get onmouseup(){return this[W].get(`onmouseup`)??null}set onmouseup(e){this[W].set(`onmouseup`,e)}get onmousemove(){return this[W].get(`onmousemove`)??null}set onmousemove(e){this[W].set(`onmousemove`,e)}get onmouseover(){return this[W].get(`onmouseover`)??null}set onmouseover(e){this[W].set(`onmouseover`,e)}get onmouseout(){return this[W].get(`onmouseout`)??null}set onmouseout(e){this[W].set(`onmouseout`,e)}get onmouseenter(){return this[W].get(`onmouseenter`)??null}set onmouseenter(e){this[W].set(`onmouseenter`,e)}get onmouseleave(){return this[W].get(`onmouseleave`)??null}set onmouseleave(e){this[W].set(`onmouseleave`,e)}get oncontextmenu(){return this[W].get(`oncontextmenu`)??null}set oncontextmenu(e){this[W].set(`oncontextmenu`,e)}get onwheel(){return this[W].get(`onwheel`)??null}set onwheel(e){this[W].set(`onwheel`,e)}get onkeydown(){return this[W].get(`onkeydown`)??null}set onkeydown(e){this[W].set(`onkeydown`,e)}get onkeyup(){return this[W].get(`onkeyup`)??null}set onkeyup(e){this[W].set(`onkeyup`,e)}get ontouchstart(){return this[W].get(`ontouchstart`)??null}set ontouchstart(e){this[W].set(`ontouchstart`,e)}get ontouchend(){return this[W].get(`ontouchend`)??null}set ontouchend(e){this[W].set(`ontouchend`,e)}get ontouchmove(){return this[W].get(`ontouchmove`)??null}set ontouchmove(e){this[W].set(`ontouchmove`,e)}get onpointerdown(){return this[W].get(`onpointerdown`)??null}set onpointerdown(e){this[W].set(`onpointerdown`,e)}get onpointerup(){return this[W].get(`onpointerup`)??null}set onpointerup(e){this[W].set(`onpointerup`,e)}get onpointermove(){return this[W].get(`onpointermove`)??null}set onpointermove(e){this[W].set(`onpointermove`,e)}cloneNode(e=!1){return super.cloneNode(e)}get[Symbol.toStringTag](){return`HTMLElement`}},mt=class HTMLCanvasElement extends HTMLElement$1{constructor(...e){super(...e),this.oncontextlost=null,this.oncontextrestored=null,this.onwebglcontextcreationerror=null,this.onwebglcontextlost=null,this.onwebglcontextrestored=null}static{this._contextFactories=new Map}static registerContextFactory(e,t){HTMLCanvasElement._contextFactories.set(e,t)}get width(){let e=this.getAttribute(`width`);return e===null?300:Number(e)}set width(e){this.setAttribute(`width`,String(e))}get height(){let e=this.getAttribute(`height`);return e===null?150:Number(e)}set height(e){this.setAttribute(`height`,String(e))}getContext(e,t){let n=HTMLCanvasElement._contextFactories.get(e);return n?n(this,t):null}toDataURL(e,t){let n=this.getContext(`2d`);return n&&typeof n._toDataURL==`function`?n._toDataURL(e,t):``}toBlob(e,t,n){let r=this.toDataURL(t,n);if(!r){e(null);return}let[i,a]=r.split(`,`),o=i.split(`:`)[1].split(`;`)[0],s=atob(a),c=new Uint8Array(s.length);for(let e=0;e<s.length;e++)c[e]=s.charCodeAt(e);e(new Blob([c],{type:o}))}captureStream(e){return{}}},ht=class DOMMatrix{constructor(e){this.a=1,this.b=0,this.c=0,this.d=1,this.e=0,this.f=0,this.m11=1,this.m12=0,this.m13=0,this.m14=0,this.m21=0,this.m22=1,this.m23=0,this.m24=0,this.m31=0,this.m32=0,this.m33=1,this.m34=0,this.m41=0,this.m42=0,this.m43=0,this.m44=1,this.is2D=!0,this.isIdentity=!0,Array.isArray(e)&&(e.length===6?(this.a=this.m11=e[0],this.b=this.m12=e[1],this.c=this.m21=e[2],this.d=this.m22=e[3],this.e=this.m41=e[4],this.f=this.m42=e[5],this.is2D=!0):e.length===16&&(this.m11=e[0],this.m12=e[1],this.m13=e[2],this.m14=e[3],this.m21=e[4],this.m22=e[5],this.m23=e[6],this.m24=e[7],this.m31=e[8],this.m32=e[9],this.m33=e[10],this.m34=e[11],this.m41=e[12],this.m42=e[13],this.m43=e[14],this.m44=e[15],this.a=this.m11,this.b=this.m12,this.c=this.m21,this.d=this.m22,this.e=this.m41,this.f=this.m42,this.is2D=!1),this.isIdentity=this.a===1&&this.b===0&&this.c===0&&this.d===1&&this.e===0&&this.f===0)}multiply(e){return new DOMMatrix([this.a*e.a+this.c*e.b,this.b*e.a+this.d*e.b,this.a*e.c+this.c*e.d,this.b*e.c+this.d*e.d,this.a*e.e+this.c*e.f+this.e,this.b*e.e+this.d*e.f+this.f])}multiplySelf(e){let t=this.multiply(e);return this.a=t.a,this.b=t.b,this.c=t.c,this.d=t.d,this.e=t.e,this.f=t.f,this.m11=this.a,this.m12=this.b,this.m21=this.c,this.m22=this.d,this.m41=this.e,this.m42=this.f,this.isIdentity=!1,this}inverse(){let e=this.a*this.d-this.b*this.c;if(e===0)return new DOMMatrix([1,0,0,1,0,0]);let t=1/e;return new DOMMatrix([this.d*t,-this.b*t,-this.c*t,this.a*t,(this.c*this.f-this.d*this.e)*t,(this.b*this.e-this.a*this.f)*t])}translate(e=0,t=0){return this.multiply({a:1,b:0,c:0,d:1,e,f:t})}scale(e=1,t=e){return this.multiply({a:e,b:0,c:0,d:t,e:0,f:0})}};const gt=ht;function defineGlobal(e,t){Object.defineProperty(globalThis,e,{value:t,writable:!0,configurable:!0})}function defineGlobalIfMissing(e,t){globalThis[e]===void 0&&defineGlobal(e,t)}const _t={aliceblue:`#f0f8ff`,antiquewhite:`#faebd7`,aqua:`#00ffff`,aquamarine:`#7fffd4`,azure:`#f0ffff`,beige:`#f5f5dc`,bisque:`#ffe4c4`,black:`#000000`,blanchedalmond:`#ffebcd`,blue:`#0000ff`,blueviolet:`#8a2be2`,brown:`#a52a2a`,burlywood:`#deb887`,cadetblue:`#5f9ea0`,chartreuse:`#7fff00`,chocolate:`#d2691e`,coral:`#ff7f50`,cornflowerblue:`#6495ed`,cornsilk:`#fff8dc`,crimson:`#dc143c`,cyan:`#00ffff`,darkblue:`#00008b`,darkcyan:`#008b8b`,darkgoldenrod:`#b8860b`,darkgray:`#a9a9a9`,darkgreen:`#006400`,darkgrey:`#a9a9a9`,darkkhaki:`#bdb76b`,darkmagenta:`#8b008b`,darkolivegreen:`#556b2f`,darkorange:`#ff8c00`,darkorchid:`#9932cc`,darkred:`#8b0000`,darksalmon:`#e9967a`,darkseagreen:`#8fbc8f`,darkslateblue:`#483d8b`,darkslategray:`#2f4f4f`,darkslategrey:`#2f4f4f`,darkturquoise:`#00ced1`,darkviolet:`#9400d3`,deeppink:`#ff1493`,deepskyblue:`#00bfff`,dimgray:`#696969`,dimgrey:`#696969`,dodgerblue:`#1e90ff`,firebrick:`#b22222`,floralwhite:`#fffaf0`,forestgreen:`#228b22`,fuchsia:`#ff00ff`,gainsboro:`#dcdcdc`,ghostwhite:`#f8f8ff`,gold:`#ffd700`,goldenrod:`#daa520`,gray:`#808080`,green:`#008000`,greenyellow:`#adff2f`,grey:`#808080`,honeydew:`#f0fff0`,hotpink:`#ff69b4`,indianred:`#cd5c5c`,indigo:`#4b0082`,ivory:`#fffff0`,khaki:`#f0e68c`,lavender:`#e6e6fa`,lavenderblush:`#fff0f5`,lawngreen:`#7cfc00`,lemonchiffon:`#fffacd`,lightblue:`#add8e6`,lightcoral:`#f08080`,lightcyan:`#e0ffff`,lightgoldenrodyellow:`#fafad2`,lightgray:`#d3d3d3`,lightgreen:`#90ee90`,lightgrey:`#d3d3d3`,lightpink:`#ffb6c1`,lightsalmon:`#ffa07a`,lightseagreen:`#20b2aa`,lightskyblue:`#87cefa`,lightslategray:`#778899`,lightslategrey:`#778899`,lightsteelblue:`#b0c4de`,lightyellow:`#ffffe0`,lime:`#00ff00`,limegreen:`#32cd32`,linen:`#faf0e6`,magenta:`#ff00ff`,maroon:`#800000`,mediumaquamarine:`#66cdaa`,mediumblue:`#0000cd`,mediumorchid:`#ba55d3`,mediumpurple:`#9370db`,mediumseagreen:`#3cb371`,mediumslateblue:`#7b68ee`,mediumspringgreen:`#00fa9a`,mediumturquoise:`#48d1cc`,mediumvioletred:`#c71585`,midnightblue:`#191970`,mintcream:`#f5fffa`,mistyrose:`#ffe4e1`,moccasin:`#ffe4b5`,navajowhite:`#ffdead`,navy:`#000080`,oldlace:`#fdf5e6`,olive:`#808000`,olivedrab:`#6b8e23`,orange:`#ffa500`,orangered:`#ff4500`,orchid:`#da70d6`,palegoldenrod:`#eee8aa`,palegreen:`#98fb98`,paleturquoise:`#afeeee`,palevioletred:`#db7093`,papayawhip:`#ffefd5`,peachpuff:`#ffdab9`,peru:`#cd853f`,pink:`#ffc0cb`,plum:`#dda0dd`,powderblue:`#b0e0e6`,purple:`#800080`,rebeccapurple:`#663399`,red:`#ff0000`,rosybrown:`#bc8f8f`,royalblue:`#4169e1`,saddlebrown:`#8b4513`,salmon:`#fa8072`,sandybrown:`#f4a460`,seagreen:`#2e8b57`,seashell:`#fff5ee`,sienna:`#a0522d`,silver:`#c0c0c0`,skyblue:`#87ceeb`,slateblue:`#6a5acd`,slategray:`#708090`,slategrey:`#708090`,snow:`#fffafa`,springgreen:`#00ff7f`,steelblue:`#4682b4`,tan:`#d2b48c`,teal:`#008080`,thistle:`#d8bfd8`,tomato:`#ff6347`,turquoise:`#40e0d0`,violet:`#ee82ee`,wheat:`#f5deb3`,white:`#ffffff`,whitesmoke:`#f5f5f5`,yellow:`#ffff00`,yellowgreen:`#9acd32`,transparent:`#00000000`};function parseColor(e){if(!e||typeof e!=`string`)return null;let t=e.trim().toLowerCase(),n=_t[t];if(n)return parseHex(n);if(t.startsWith(`#`))return parseHex(t);let r=t.match(/^rgba?\(\s*(\d+(?:\.\d+)?%?)\s*[,\s]\s*(\d+(?:\.\d+)?%?)\s*[,\s]\s*(\d+(?:\.\d+)?%?)\s*(?:[,/]\s*(\d+(?:\.\d+)?%?))?\s*\)$/);if(r)return{r:parseComponent(r[1],255)/255,g:parseComponent(r[2],255)/255,b:parseComponent(r[3],255)/255,a:r[4]===void 0?1:parseComponent(r[4],1)};let i=t.match(/^hsla?\(\s*(\d+(?:\.\d+)?)\s*[,\s]\s*(\d+(?:\.\d+)?)(%)?\s*[,\s]\s*(\d+(?:\.\d+)?)(%)?\s*(?:[,/]\s*(\d+(?:\.\d+)?%?))?\s*\)$/);if(i){let e=parseFloat(i[1]),t=parseFloat(i[2]),n=i[3]===`%`,r=parseFloat(i[4]),a=i[5]===`%`,o=i[6]===void 0?1:parseComponent(i[6],1);return e>1&&(e/=360),(n||t>1)&&(t/=100),(a||r>1)&&(r/=100),hslToRGBA(e,t,r,Math.max(0,Math.min(1,o)))}return null}function parseHex(e){let t=e.slice(1),n,r,i,a=1;if(t.length===3)n=parseInt(t[0]+t[0],16)/255,r=parseInt(t[1]+t[1],16)/255,i=parseInt(t[2]+t[2],16)/255;else if(t.length===4)n=parseInt(t[0]+t[0],16)/255,r=parseInt(t[1]+t[1],16)/255,i=parseInt(t[2]+t[2],16)/255,a=parseInt(t[3]+t[3],16)/255;else if(t.length===6)n=parseInt(t.slice(0,2),16)/255,r=parseInt(t.slice(2,4),16)/255,i=parseInt(t.slice(4,6),16)/255;else if(t.length===8)n=parseInt(t.slice(0,2),16)/255,r=parseInt(t.slice(2,4),16)/255,i=parseInt(t.slice(4,6),16)/255,a=parseInt(t.slice(6,8),16)/255;else return null;return{r:n,g:r,b:i,a}}function parseComponent(e,t){return e.endsWith(`%`)?parseFloat(e)/100*t:parseFloat(e)}function hue2rgb(e,t,n){return n<0&&(n+=1),n>1&&--n,n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function hslToRGBA(e,t,n,r){let i,a,o;if(t===0)i=a=o=n;else{let r=n<.5?n*(1+t):n+t-n*t,s=2*n-r;i=hue2rgb(s,r,e+1/3),a=hue2rgb(s,r,e),o=hue2rgb(s,r,e-1/3)}return{r:i,g:a,b:o,a:r}}const vt={r:0,g:0,b:0,a:1};var CanvasGradient=class{constructor(e,t,r,i,a,o,s){e===`radial`?this._pattern=new n.RadialGradient(t,r,o,i,a,s):this._pattern=new n.LinearGradient(t,r,i,a)}addColorStop(e,t){let n=parseColor(t);n&&this._pattern.addColorStopRGBA(e,n.r,n.g,n.b,n.a)}_getCairoPattern(){return this._pattern}};function quadraticToCubic(e,t,n,r,i,a){return{cp1x:e+2/3*(n-e),cp1y:t+2/3*(r-t),cp2x:i+2/3*(n-i),cp2y:a+2/3*(r-a)}}function computeArcTo(e,t,n,r,i,a,o){let s=e-n,c=t-r,l=i-n,u=a-r,d=Math.sqrt(s*s+c*c),p=Math.sqrt(l*l+u*u);if(d===0||p===0)return null;let m=s/d,h=c/d,g=l/p,_=u/p,v=m*_-h*g;if(Math.abs(v)<1e-10)return null;let y=m*g+h*_,b=Math.acos(Math.max(-1,Math.min(1,y)))/2,x=o/Math.tan(b),S=n+m*x,w=r+h*x,T=n+g*x,E=r+_*x,D=o/Math.sin(b),O=(m+g)/2,k=(h+_)/2,A=Math.sqrt(O*O+k*k),j=n+O/A*D,M=r+k/A*D;return{tx0:S,ty0:w,tx1:T,ty1:E,cx:j,cy:M,startAngle:Math.atan2(w-M,S-j),endAngle:Math.atan2(E-M,T-j),counterclockwise:v>0}}function cairoArcTo(e,t,n,r,i,a,o,s){let c=computeArcTo(t,n,r,i,a,o,s);if(!c){e.lineTo(r,i);return}let{tx0:l,ty0:u,cx:d,cy:p,startAngle:m,endAngle:h,counterclockwise:g}=c;e.lineTo(l,u),g?e.arcNegative(d,p,s,m,h):e.arc(d,p,s,m,h)}function cairoEllipse(e,t,n,r,i,a,o,s,c){e.save(),e.translate(t,n),e.rotate(a),e.scale(r,i),c?e.arcNegative(0,0,1,o,s):e.arc(0,0,1,o,s),e.restore()}function cairoRoundRect(e,t,n,r,i,a){let o,s,c,l;typeof a==`number`?o=s=c=l=a:a.length===1?o=s=c=l=a[0]:a.length===2?(o=c=a[0],s=l=a[1]):a.length===3?(o=a[0],s=l=a[1],c=a[2]):(o=a[0],s=a[1],c=a[2],l=a[3]);let u=Math.min(r/2,i/2);o=Math.min(o,u),s=Math.min(s,u),c=Math.min(c,u),l=Math.min(l,u);let d=Math.PI/2;e.newSubPath(),e.arc(t+o,n+o,o,Math.PI,Math.PI+d),e.arc(t+r-s,n+s,s,-d,0),e.arc(t+r-c,n+i-c,c,0,d),e.arc(t+l,n+i-l,l,d,Math.PI),e.closePath()}const yt={"source-over":2,"source-in":3,"source-out":4,"source-atop":5,"destination-over":7,"destination-in":8,"destination-out":9,"destination-atop":10,lighter:12,copy:1,xor:11,multiply:14,screen:15,overlay:16,darken:17,lighten:18,"color-dodge":19,"color-burn":20,"hard-light":21,"soft-light":22,difference:23,exclusion:24,hue:25,saturation:26,color:27,luminosity:28},bt={butt:0,round:1,square:2},xt={miter:0,round:1,bevel:2};var St=class Path2D{constructor(e){this._ops=[],e instanceof Path2D&&(this._ops=[...e._ops])}addPath(e){this._ops.push(...e._ops)}moveTo(e,t){this._ops.push({type:`moveTo`,x:e,y:t})}lineTo(e,t){this._ops.push({type:`lineTo`,x:e,y:t})}closePath(){this._ops.push({type:`closePath`})}bezierCurveTo(e,t,n,r,i,a){this._ops.push({type:`bezierCurveTo`,cp1x:e,cp1y:t,cp2x:n,cp2y:r,x:i,y:a})}quadraticCurveTo(e,t,n,r){this._ops.push({type:`quadraticCurveTo`,cpx:e,cpy:t,x:n,y:r})}arc(e,t,n,r,i,a=!1){this._ops.push({type:`arc`,x:e,y:t,radius:n,startAngle:r,endAngle:i,ccw:a})}ellipse(e,t,n,r,i,a,o,s=!1){if(n<0||r<0)throw RangeError(`The radii provided are negative`);this._ops.push({type:`ellipse`,x:e,y:t,rx:n,ry:r,rotation:i,startAngle:a,endAngle:o,ccw:s})}rect(e,t,n,r){this._ops.push({type:`rect`,x:e,y:t,w:n,h:r})}roundRect(e,t,n,r,i=0){this._ops.push({type:`roundRect`,x:e,y:t,w:n,h:r,radii:i})}_replayOnCairo(e){let t=0,n=0;for(let r of this._ops)switch(r.type){case`moveTo`:e.moveTo(r.x,r.y),t=r.x,n=r.y;break;case`lineTo`:e.lineTo(r.x,r.y),t=r.x,n=r.y;break;case`closePath`:e.closePath();break;case`bezierCurveTo`:e.curveTo(r.cp1x,r.cp1y,r.cp2x,r.cp2y,r.x,r.y),t=r.x,n=r.y;break;case`quadraticCurveTo`:{let{cp1x:i,cp1y:a,cp2x:o,cp2y:s}=quadraticToCubic(t,n,r.cpx,r.cpy,r.x,r.y);e.curveTo(i,a,o,s,r.x,r.y),t=r.x,n=r.y;break}case`arc`:r.ccw?e.arcNegative(r.x,r.y,r.radius,r.startAngle,r.endAngle):e.arc(r.x,r.y,r.radius,r.startAngle,r.endAngle);break;case`ellipse`:e.save(),e.translate(r.x,r.y),e.rotate(r.rotation),e.scale(r.rx,r.ry),r.ccw?e.arcNegative(0,0,1,r.startAngle,r.endAngle):e.arc(0,0,1,r.startAngle,r.endAngle),e.restore();break;case`rect`:e.rectangle(r.x,r.y,r.w,r.h);break;case`roundRect`:cairoRoundRect(e,r.x,r.y,r.w,r.h,r.radii);break}}};function asCairoPattern(e){if(!e)return null;let t=e;return typeof t.setFilter!=`function`||typeof t.setExtend!=`function`?null:t}function isPixbufImageSource(e){return typeof e!=`object`||!e?!1:typeof e.isPixbuf==`function`&&e.isPixbuf()}function isCanvasImageSource(e){return typeof e!=`object`||!e?!1:typeof e.getContext==`function`}var Ct=class CanvasPattern{constructor(e,t){let r=asCairoPattern(new n.SurfacePattern(e));if(!r)throw TypeError(`CanvasPattern: cairo SurfacePattern is missing setExtend at runtime — incompatible Cairo binding`);switch(this._pattern=r,t){case`repeat`:case``:case null:r.setExtend(n.Extend.REPEAT);break;case`repeat-x`:case`repeat-y`:r.setExtend(n.Extend.REPEAT);break;case`no-repeat`:r.setExtend(n.Extend.NONE);break}}static create(e,t){if(isPixbufImageSource(e)){let i=e._pixbuf,a=i.get_width(),o=i.get_height(),s=new n.ImageSurface(n.Format.ARGB32,a,o),c=new n.Context(s);return r.cairo_set_source_pixbuf(c,i,0,0),c.paint(),c.$dispose(),new CanvasPattern(s,t)}if(isCanvasImageSource(e)){let r=e.getContext(`2d`);if(r&&typeof r._getSurface==`function`){let e=r._getSurface(),i=e.getWidth(),a=e.getHeight(),o=new n.ImageSurface(n.Format.ARGB32,i,a),s=new n.Context(o);return s.setSourceSurface(e,0,0),s.paint(),s.$dispose(),new CanvasPattern(o,t)}}return null}_getCairoPattern(){return this._pattern}},OurImageData=class{constructor(e,t,n){if(this.colorSpace=`srgb`,typeof e==`number`)this.width=e,this.height=t,this.data=new Uint8ClampedArray(this.width*this.height*4);else if(this.data=e,this.width=t,this.height=n??this.data.length/(4*this.width),this.data.length!==this.width*this.height*4)throw RangeError(`Source data length ${this.data.length} is not a multiple of (4 * width=${this.width})`)}};const wt={translate(e,t){this._ensureSurface(),this._ctx.translate(e,t)},rotate(e){this._ensureSurface(),this._ctx.rotate(e)},scale(e,t){this._ensureSurface(),this._ctx.scale(e,t)},transform(e,t,n,r,i,a){if(this._ensureSurface(),!Number.isFinite(e)||!Number.isFinite(t)||!Number.isFinite(n)||!Number.isFinite(r)||!Number.isFinite(i)||!Number.isFinite(a))return;let o=i,s=a,c=Math.hypot(e,t),l=Math.hypot(n,r),u=Math.atan2(t,e);this._ctx.translate(o,s),u!==0&&this._ctx.rotate(u),(c!==1||l!==1)&&this._ctx.scale(c,l)},setTransform(e,t,n,r,i,a){if(this._ensureSurface(),typeof e==`object`&&e){let t=e;this._ctx.identityMatrix(),this.transform(t.a??t.m11??1,t.b??t.m12??0,t.c??t.m21??0,t.d??t.m22??1,t.e??t.m41??0,t.f??t.m42??0)}else typeof e==`number`?(this._ctx.identityMatrix(),this.transform(e,t,n,r,i,a)):this._ctx.identityMatrix()},getTransform(){let e=this._ctx.userToDevice(0,0),t=this._ctx.userToDevice(1,0),n=this._ctx.userToDevice(0,1),r=e[0]??0,i=e[1]??0,a=(t[0]??0)-r,o=(t[1]??0)-i,s=(n[0]??0)-r,c=(n[1]??0)-i,l=globalThis.DOMMatrix;return typeof l==`function`?new l([a,o,s,c,r,i]):{a,b:o,c:s,d:c,e:r,f:i,m11:a,m12:o,m13:0,m14:0,m21:s,m22:c,m23:0,m24:0,m31:0,m32:0,m33:1,m34:0,m41:r,m42:i,m43:0,m44:1,is2D:!0,isIdentity:a===1&&o===0&&s===0&&c===1&&r===0&&i===0}},resetTransform(){this._ensureSurface(),this._ctx.identityMatrix()}};function installTransformMethods(e){Object.assign(e,wt)}const Tt={beginPath(){this._ensureSurface(),this._ctx.newPath()},moveTo(e,t){this._ensureSurface(),this._ctx.moveTo(e,t)},lineTo(e,t){this._ensureSurface(),this._ctx.lineTo(e,t)},closePath(){this._ensureSurface(),this._ctx.closePath()},bezierCurveTo(e,t,n,r,i,a){this._ensureSurface(),this._ctx.curveTo(e,t,n,r,i,a)},quadraticCurveTo(e,t,n,r){this._ensureSurface();let i,a;this._ctx.hasCurrentPoint()?[i,a]=this._ctx.getCurrentPoint():(i=e,a=t);let{cp1x:o,cp1y:s,cp2x:c,cp2y:l}=quadraticToCubic(i,a,e,t,n,r);this._ctx.curveTo(o,s,c,l,n,r)},arc(e,t,n,r,i,a=!1){if(this._ensureSurface(),Math.abs(i-r)>=2*Math.PI){this._ctx.arc(e,t,n,0,2*Math.PI);return}a?this._ctx.arcNegative(e,t,n,r,i):this._ctx.arc(e,t,n,r,i)},arcTo(e,t,n,r,i){this._ensureSurface();let a,o;this._ctx.hasCurrentPoint()?[a,o]=this._ctx.getCurrentPoint():(a=e,o=t,this._ctx.moveTo(e,t)),cairoArcTo(this._ctx,a,o,e,t,n,r,i)},ellipse(e,t,n,r,i,a,o,s=!1){if(this._ensureSurface(),n<0||r<0)throw RangeError(`The radii provided are negative`);cairoEllipse(this._ctx,e,t,n,r,i,a,o,s)},rect(e,t,n,r){this._ensureSurface(),this._ctx.rectangle(e,t,n,r)},roundRect(e,t,n,r,i=0){this._ensureSurface(),cairoRoundRect(this._ctx,e,t,n,r,i)}};function installPathMethods(e){Object.assign(e,Tt)}function getDrawImageSource(e){if(isPixbufImageSource(e)){let t=e._pixbuf;return{pixbuf:t,imgWidth:t.get_width(),imgHeight:t.get_height()}}if(isCanvasImageSource(e)){let t=e.width??0,n=e.height??0;if(!Number.isFinite(t)||!Number.isFinite(n)||t<=0||n<=0)return null;let i=e.getContext(`2d`);if(i&&typeof i._getSurface==`function`){let e=i._getSurface();e.flush();let a=r.pixbuf_get_from_surface(e,0,0,t,n);if(a)return{pixbuf:a,imgWidth:t,imgHeight:n}}}return null}const Et={fill(e,t){this._ensureSurface(),this._applyCompositing(),this._applyFillStyle();let r;e instanceof St?(this._ctx.newPath(),e._replayOnCairo(this._ctx),r=t):r=e,this._ctx.setFillRule(r===`evenodd`?n.FillRule.EVEN_ODD:n.FillRule.WINDING),this._ctx.fillPreserve()},stroke(e){this._ensureSurface(),this._applyCompositing(),this._applyStrokeStyle(),this._applyLineStyle(),e instanceof St&&(this._ctx.newPath(),e._replayOnCairo(this._ctx)),this._ctx.strokePreserve()},fillRect(e,t,n,r){this._ensureSurface(),this._applyCompositing();let i=this._ctx.copyPath();this._hasShadow()&&this._renderShadow(()=>{this._ctx.newPath(),this._ctx.rectangle(e,t,n,r),this._ctx.fill()}),this._applyFillStyle(),this._ctx.newPath(),this._ctx.rectangle(e,t,n,r),this._ctx.fill(),this._ctx.newPath(),this._ctx.appendPath(i)},strokeRect(e,t,n,r){this._ensureSurface(),this._applyCompositing();let i=this._ctx.copyPath();this._hasShadow()&&this._renderShadow(()=>{this._ctx.newPath(),this._ctx.rectangle(e,t,n,r),this._ctx.stroke()}),this._applyStrokeStyle(),this._applyLineStyle(),this._ctx.newPath(),this._ctx.rectangle(e,t,n,r),this._ctx.stroke(),this._ctx.newPath(),this._ctx.appendPath(i)},clearRect(e,t,r,i){this._ensureSurface();let a=this._ctx.copyPath();this._ctx.save(),this._ctx.setOperator(n.Operator.CLEAR),this._ctx.newPath(),this._ctx.rectangle(e,t,r,i),this._ctx.fill(),this._ctx.restore(),this._ctx.newPath(),this._ctx.appendPath(a)},clip(e,t){this._ensureSurface();let r;e instanceof St?(this._ctx.newPath(),e._replayOnCairo(this._ctx),r=t):r=e,this._ctx.setFillRule(r===`evenodd`?n.FillRule.EVEN_ODD:n.FillRule.WINDING),this._ctx.clip()},isPointInPath(e,t,r,i){this._ensureSurface();let a,o,s;return e instanceof St?(this._ctx.newPath(),e._replayOnCairo(this._ctx),a=t,o=r,s=i):(a=e,o=t,s=r),this._ctx.setFillRule(s===`evenodd`?n.FillRule.EVEN_ODD:n.FillRule.WINDING),this._ctx.inFill(a,o)},isPointInStroke(e,t,n){return this._ensureSurface(),this._applyLineStyle(),e instanceof St?(this._ctx.newPath(),e._replayOnCairo(this._ctx),this._ctx.inStroke(t,n)):this._ctx.inStroke(e,t)},drawImage(e,t,i,a,o,s,c,l,u){this._ensureSurface(),this._applyCompositing();let d,p,m,h,g,_,v,y,b=getDrawImageSource(e);if(!b)return;let{pixbuf:x,imgWidth:S,imgHeight:w}=b;if(a===void 0?(d=0,p=0,m=S,h=w,g=t,_=i,v=S,y=w):s===void 0?(d=0,p=0,m=S,h=w,g=t,_=i,v=a,y=o):(d=t,p=i,m=a,h=o,g=s,_=c,v=l,y=u),!Number.isFinite(d)||!Number.isFinite(p)||!Number.isFinite(m)||!Number.isFinite(h)||!Number.isFinite(g)||!Number.isFinite(_)||!Number.isFinite(v)||!Number.isFinite(y)||m===0||h===0||v===0||y===0)return;this._ctx.save(),this._ctx.rectangle(g,_,v,y),this._ctx.clip(),this._ctx.translate(g,_),this._ctx.scale(v/m,y/h),this._ctx.translate(-d,-p),r.cairo_set_source_pixbuf(this._ctx,x,0,0);let T=asCairoPattern(this._ctx.getSource?.());if(T){let e;e=this._state.imageSmoothingEnabled?this._state.imageSmoothingQuality===`high`?n.Filter.BEST:n.Filter.BILINEAR:n.Filter.NEAREST,T.setFilter(e)}this._state.globalAlpha<1?this._ctx.paintWithAlpha(this._state.globalAlpha):this._ctx.paint(),this._ctx.restore()}};function installDrawingMethods(e){Object.assign(e,Et)}const Dt={createImageData(e,t){return typeof e==`number`?new OurImageData(Math.abs(e),Math.abs(t)):new OurImageData(e.width,e.height)},getImageData(e,t,n,i){this._ensureSurface(),this._surface.flush();let a=r.pixbuf_get_from_surface(this._surface,e,t,n,i);if(!a)return new OurImageData(n,i);let o=a.get_pixels(),s=a.get_has_alpha(),c=a.get_rowstride(),l=a.get_n_channels(),u=new Uint8ClampedArray(n*i*4);for(let e=0;e<i;e++)for(let t=0;t<n;t++){let r=e*c+t*l,i=(e*n+t)*4;u[i]=o[r],u[i+1]=o[r+1],u[i+2]=o[r+2],u[i+3]=s?o[r+3]:255}return new OurImageData(u,n,i)},putImageData(e,t,a,o,s,c,l){this._ensureSurface();let u=o??0,d=s??0,p=c??e.width,m=l??e.height,h=e.data,g=e.width,_=new Uint8Array(p*m*4);for(let e=0;e<m;e++)for(let t=0;t<p;t++){let n=((d+e)*g+(u+t))*4,r=(e*p+t)*4;_[r]=h[n],_[r+1]=h[n+1],_[r+2]=h[n+2],_[r+3]=h[n+3]}let v=i.Pixbuf.new_from_bytes(_,i.Colorspace.RGB,!0,8,p,m,p*4);this._ctx.save(),this._ctx.setOperator(n.Operator.SOURCE),r.cairo_set_source_pixbuf(this._ctx,v,t+u,a+d),this._ctx.rectangle(t+u,a+d,p,m),this._ctx.fill(),this._ctx.restore()}};function installPixelMethods(e){Object.assign(e,Dt)}function parseFontToDescription(e){let t=e.match(/^\s*(italic|oblique|normal)?\s*(small-caps|normal)?\s*(bold|bolder|lighter|[1-9]00|normal)?\s*(\d+(?:\.\d+)?)(px|pt|em|rem|%)?\s*(?:\/\S+)?\s*(.+)?$/i);if(!t)return a.font_description_from_string(e);let n=t[1]||``,r=t[3]||``,i=parseFloat(t[4])||10,o=(t[5]||`px`).toLowerCase(),s=(t[6]||`sans-serif`).replace(/['"]/g,``).trim();o===`pt`?i=i*96/72:o===`em`||o===`rem`?i*=16:o===`%`&&(i=i/100*16);let c=s;n===`italic`?c+=` Italic`:n===`oblique`&&(c+=` Oblique`),r===`bold`||r===`bolder`||parseInt(r)>=600?c+=` Bold`:(r===`lighter`||parseInt(r)>0&&parseInt(r)<=300)&&(c+=` Light`);let l=a.font_description_from_string(c);return l.set_absolute_size(i*a.SCALE),l}function createTextLayout(e,t){let n=o.create_layout(e._ctx);n.set_text(t,-1),n.get_context().set_base_dir(a.Direction.LTR),n.context_changed();let r=parseFontToDescription(e._state.font);return n.set_font_description(r),n}function getTextAlignOffset(e,t){let[,n]=t.get_pixel_extents(),r=n.width;switch(e._state.textAlign){case`center`:return-r/2;case`right`:case`end`:return-r;default:return 0}}function getTextBaselineOffset(e,t){let n=t.get_font_description()||parseFontToDescription(e._state.font),r=t.get_context().get_metrics(n,null),i=r.get_ascent()/a.SCALE,o=r.get_descent()/a.SCALE,s=i+o;switch(e._state.textBaseline){case`top`:return 0;case`hanging`:return-(i*.2);case`middle`:return-(s/2);case`alphabetic`:return-i;case`ideographic`:return-(i+o*.5);case`bottom`:return-s;default:return-i}}const Ot={fillText(e,t,r,i){this._ensureSurface(),this._applyCompositing();let a=createTextLayout(this,e),s=getTextAlignOffset(this,a),c=getTextBaselineOffset(this,a);if(this._hasShadow()){let e=parseColor(this._state.shadowColor);if(e){let[i,l]=this._deviceToUserDistance(this._state.shadowOffsetX,this._state.shadowOffsetY),u=this._state.shadowBlur,d;if(u>0){let[t]=this._deviceToUserDistance(u,0),[,n]=this._deviceToUserDistance(0,u);d=[[i,l,e.a],[i+t,l,e.a*.5],[i-t,l,e.a*.5],[i,l+n,e.a*.5],[i,l-n,e.a*.5]]}else d=[[i,l,e.a]];let p=this._state.imageSmoothingEnabled?n.Antialias.DEFAULT:n.Antialias.NONE;for(let[n,i,l]of d)this._ctx.save(),this._ctx.setAntialias(p),this._ctx.setSourceRGBA(e.r,e.g,e.b,l),this._ctx.moveTo(t+s+n,r+c+i),o.show_layout(this._ctx,a),this._ctx.restore()}}this._applyFillStyle(),this._ctx.save(),this._ctx.setAntialias(this._state.imageSmoothingEnabled?n.Antialias.DEFAULT:n.Antialias.NONE),this._ctx.moveTo(t+s,r+c),o.show_layout(this._ctx,a),this._ctx.restore()},strokeText(e,t,r,i){this._ensureSurface(),this._applyCompositing(),this._applyStrokeStyle(),this._applyLineStyle();let a=createTextLayout(this,e),s=getTextAlignOffset(this,a),c=getTextBaselineOffset(this,a);this._ctx.save(),this._ctx.setAntialias(this._state.imageSmoothingEnabled?n.Antialias.DEFAULT:n.Antialias.NONE),this._ctx.moveTo(t+s,r+c),o.layout_path(this._ctx,a),this._ctx.stroke(),this._ctx.restore()},measureText(e){this._ensureSurface();let t=createTextLayout(this,e),[n,r]=t.get_pixel_extents(),i=t.get_baseline()/a.SCALE,o=Math.max(0,i-n.y),s=Math.max(0,n.y+n.height-i),c=t.get_font_description()||parseFontToDescription(this._state.font),l=t.get_context().get_metrics(c,null),u=l.get_ascent()/a.SCALE,d=l.get_descent()/a.SCALE;return{width:r.width,actualBoundingBoxAscent:o,actualBoundingBoxDescent:s,actualBoundingBoxLeft:Math.max(0,-n.x),actualBoundingBoxRight:n.x+n.width,fontBoundingBoxAscent:u,fontBoundingBoxDescent:d,alphabeticBaseline:0,emHeightAscent:u,emHeightDescent:d,hangingBaseline:u*.8,ideographicBaseline:-d}}};function installTextMethods(e){Object.assign(e,Ot)}const kt={createLinearGradient(e,t,n,r){return new CanvasGradient(`linear`,e,t,n,r)},createRadialGradient(e,t,n,r,i,a){return new CanvasGradient(`radial`,e,t,r,i,n,a)},createPattern(e,t){return Ct.create(e,t)}};function installFactoryMethods(e){Object.assign(e,kt)}function installAllContextMethods(e){installTransformMethods(e),installPathMethods(e),installDrawingMethods(e),installPixelMethods(e),installTextMethods(e),installFactoryMethods(e)}function createDefaultState(){return{fillStyle:`#000000`,fillColor:{...vt},strokeStyle:`#000000`,strokeColor:{...vt},lineWidth:1,lineCap:`butt`,lineJoin:`miter`,miterLimit:10,lineDash:[],lineDashOffset:0,globalAlpha:1,globalCompositeOperation:`source-over`,shadowColor:`rgba(0, 0, 0, 0)`,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,font:`10px sans-serif`,textAlign:`start`,textBaseline:`alphabetic`,direction:`ltr`,imageSmoothingEnabled:!0,imageSmoothingQuality:`low`}}function cloneState(e){return{...e,fillColor:{...e.fillColor},strokeColor:{...e.strokeColor},lineDash:[...e.lineDash]}}var CanvasRenderingContext2D=class{constructor(e,t){this._stateStack=[],this.canvas=e,this._surfaceWidth=e.width||300,this._surfaceHeight=e.height||150,this._surface=new n.ImageSurface(n.Format.ARGB32,this._surfaceWidth,this._surfaceHeight),this._ctx=new n.Context(this._surface),this._state=createDefaultState()}_ensureSurface(){let e=this.canvas.width||300,t=this.canvas.height||150;(e!==this._surfaceWidth||t!==this._surfaceHeight)&&(this._ctx.$dispose(),this._surface.finish(),this._surfaceWidth=e,this._surfaceHeight=t,this._surface=new n.ImageSurface(n.Format.ARGB32,e,t),this._ctx=new n.Context(this._surface),this._stateStack=[])}_resetState(){this._state=createDefaultState(),this._stateStack=[]}_applyFillStyle(){let e=this._state.fillStyle;if(typeof e==`string`){let e=this._state.fillColor,t=e.a*this._state.globalAlpha;this._ctx.setSourceRGBA(e.r,e.g,e.b,t)}else e instanceof CanvasGradient?this._ctx.setSource(e._getCairoPattern()):e instanceof Ct&&(this._ctx.setSource(e._getCairoPattern()),this._applyPatternFilter())}_applyStrokeStyle(){let e=this._state.strokeStyle;if(typeof e==`string`){let e=this._state.strokeColor,t=e.a*this._state.globalAlpha;this._ctx.setSourceRGBA(e.r,e.g,e.b,t)}else e instanceof CanvasGradient?this._ctx.setSource(e._getCairoPattern()):e instanceof Ct&&(this._ctx.setSource(e._getCairoPattern()),this._applyPatternFilter())}_applyPatternFilter(){let e=asCairoPattern(this._ctx.getSource?.());if(!e)return;let t;t=this._state.imageSmoothingEnabled?this._state.imageSmoothingQuality===`high`?n.Filter.BEST:n.Filter.BILINEAR:n.Filter.NEAREST,e.setFilter(t)}_applyLineStyle(){this._ctx.setLineWidth(this._state.lineWidth),this._ctx.setLineCap(bt[this._state.lineCap]),this._ctx.setLineJoin(xt[this._state.lineJoin]),this._ctx.setMiterLimit(this._state.miterLimit),this._ctx.setDash(this._state.lineDash,this._state.lineDashOffset)}_applyCompositing(){let e=yt[this._state.globalCompositeOperation];e!==void 0&&this._ctx.setOperator(e)}_getSurface(){return this._surface}_hasShadow(){if(this._state.shadowBlur===0&&this._state.shadowOffsetX===0&&this._state.shadowOffsetY===0)return!1;let e=parseColor(this._state.shadowColor);return e!==null&&e.a>0}_deviceToUserDistance(e,t){let n=this._ctx.userToDevice(0,0),r=this._ctx.userToDevice(1,0),i=this._ctx.userToDevice(0,1),a=(r[0]??0)-(n[0]??0),o=(r[1]??0)-(n[1]??0),s=(i[0]??0)-(n[0]??0),c=(i[1]??0)-(n[1]??0),l=a*c-o*s;return Math.abs(l)<1e-10?[e,t]:[(c*e-s*t)/l,(-o*e+a*t)/l]}_renderShadow(e){}save(){this._ensureSurface(),this._stateStack.push(cloneState(this._state)),this._ctx.save()}restore(){this._ensureSurface();let e=this._stateStack.pop();e&&(this._state=e,this._ctx.restore())}get fillStyle(){return this._state.fillStyle}set fillStyle(e){if(typeof e==`string`){let t=parseColor(e);t&&(this._state.fillStyle=e,this._state.fillColor=t)}else this._state.fillStyle=e}get strokeStyle(){return this._state.strokeStyle}set strokeStyle(e){if(typeof e==`string`){let t=parseColor(e);t&&(this._state.strokeStyle=e,this._state.strokeColor=t)}else this._state.strokeStyle=e}get lineWidth(){return this._state.lineWidth}set lineWidth(e){e>0&&isFinite(e)&&(this._state.lineWidth=e)}get lineCap(){return this._state.lineCap}set lineCap(e){(e===`butt`||e===`round`||e===`square`)&&(this._state.lineCap=e)}get lineJoin(){return this._state.lineJoin}set lineJoin(e){(e===`miter`||e===`round`||e===`bevel`)&&(this._state.lineJoin=e)}get miterLimit(){return this._state.miterLimit}set miterLimit(e){e>0&&isFinite(e)&&(this._state.miterLimit=e)}get globalAlpha(){return this._state.globalAlpha}set globalAlpha(e){e>=0&&e<=1&&isFinite(e)&&(this._state.globalAlpha=e)}get globalCompositeOperation(){return this._state.globalCompositeOperation}set globalCompositeOperation(e){yt[e]!==void 0&&(this._state.globalCompositeOperation=e)}get imageSmoothingEnabled(){return this._state.imageSmoothingEnabled}set imageSmoothingEnabled(e){this._state.imageSmoothingEnabled=!!e}get imageSmoothingQuality(){return this._state.imageSmoothingQuality}set imageSmoothingQuality(e){(e===`low`||e===`medium`||e===`high`)&&(this._state.imageSmoothingQuality=e)}setLineDash(e){e.some(e=>e<0||!isFinite(e))||(this._state.lineDash=[...e])}getLineDash(){return[...this._state.lineDash]}get lineDashOffset(){return this._state.lineDashOffset}set lineDashOffset(e){isFinite(e)&&(this._state.lineDashOffset=e)}get shadowColor(){return this._state.shadowColor}set shadowColor(e){this._state.shadowColor=e}get shadowBlur(){return this._state.shadowBlur}set shadowBlur(e){e>=0&&isFinite(e)&&(this._state.shadowBlur=e)}get shadowOffsetX(){return this._state.shadowOffsetX}set shadowOffsetX(e){isFinite(e)&&(this._state.shadowOffsetX=e)}get shadowOffsetY(){return this._state.shadowOffsetY}set shadowOffsetY(e){isFinite(e)&&(this._state.shadowOffsetY=e)}get font(){return this._state.font}set font(e){this._state.font=e}get textAlign(){return this._state.textAlign}set textAlign(e){this._state.textAlign=e}get textBaseline(){return this._state.textBaseline}set textBaseline(e){this._state.textBaseline=e}get direction(){return this._state.direction}set direction(e){this._state.direction=e}_toDataURL(e,t){this._surface.flush();let n=imports.gi.Gio,r=imports.gi.GLib,[,i]=r.file_open_tmp(`canvas-XXXXXX.png`);try{this._surface.writeToPNG(i);let[,e]=n.File.new_for_path(i).load_contents(null);return`data:image/png;base64,${r.base64_encode(e)}`}finally{try{r.unlink(i)}catch{}}}_dispose(){this._ctx.$dispose(),this._surface.finish()}};installAllContextMethods(CanvasRenderingContext2D.prototype),defineGlobal(`HTMLCanvasElement`,mt),defineGlobal(`CanvasRenderingContext2D`,CanvasRenderingContext2D),defineGlobal(`DOMMatrix`,ht),defineGlobal(`DOMMatrixReadOnly`,gt);const At=Symbol.for(`gjsify_canvas2d_context`);mt.registerContextFactory(`2d`,(e,t)=>{let n=e,r=n[At];if(r)return r;let i=new CanvasRenderingContext2D(e,t);return n[At]=i,i});var CharacterData=class extends ot{constructor(e=``){super(),this[z]=G.TEXT_NODE,this._data=e}get data(){return this._data}set data(e){this._data=e}get textContent(){return this._data}set textContent(e){this._data=e}get nodeValue(){return this._data}set nodeValue(e){this._data=e}get length(){return this._data.length}appendData(e){this._data+=e}deleteData(e,t){this._data=this._data.substring(0,e)+this._data.substring(e+t)}insertData(e,t){this._data=this._data.substring(0,e)+t+this._data.substring(e)}replaceData(e,t,n){this._data=this._data.substring(0,e)+n+this._data.substring(e+t)}substringData(e,t){return this._data.substring(e,e+t)}cloneNode(e=!1){return new this.constructor(this._data)}get[Symbol.toStringTag](){return`CharacterData`}},jt=class Comment extends CharacterData{constructor(e=``){super(e),this[z]=G.COMMENT_NODE}get nodeName(){return`#comment`}cloneNode(e=!1){return new Comment(this.data)}get[Symbol.toStringTag](){return`Comment`}},Mt=class Text extends CharacterData{constructor(e=``){super(e),this[z]=G.TEXT_NODE}get nodeName(){return`#text`}get wholeText(){let e=this.data,t=this.previousSibling;for(;t&&t instanceof Text;)e=t.data+e,t=t.previousSibling;let n=this.nextSibling;for(;n&&n instanceof Text;)e+=n.data,n=n.nextSibling;return e}splitText(e){let t=this.data.substring(e);this.data=this.data.substring(0,e);let n=new Text(t);return this.parentNode&&this.parentNode.insertBefore(n,this.nextSibling),n}cloneNode(e=!1){return new Text(this.data)}get[Symbol.toStringTag](){return`Text`}},Nt=class DocumentFragment extends ot{constructor(){super(),this[z]=G.DOCUMENT_FRAGMENT_NODE}get nodeName(){return`#document-fragment`}get children(){return this[H]}get childElementCount(){return this[H].length}get firstElementChild(){return this[H][0]??null}get lastElementChild(){let e=this[H];return e[e.length-1]??null}get textContent(){let e=``;for(let t of this.childNodes)t.textContent!==null&&(e+=t.textContent);return e}set textContent(e){for(;this.firstChild;)this.removeChild(this.firstChild);e&&this.appendChild(new Mt(e))}append(...e){for(let t of e)typeof t==`string`?this.appendChild(new Mt(t)):this.appendChild(t)}prepend(...e){let t=this.firstChild;for(let n of e)typeof n==`string`?this.insertBefore(new Mt(n),t):this.insertBefore(n,t)}replaceChildren(...e){for(;this.firstChild;)this.removeChild(this.firstChild);this.append(...e)}getElementById(e){for(let t of this.children){if(t.id===e)return t;let n=this._findById(t,e);if(n)return n}return null}_findById(e,t){for(let n of e.children){if(n.id===t)return n;let e=this._findById(n,t);if(e)return e}return null}cloneNode(e=!1){let t=new DocumentFragment;if(e)for(let e of this.childNodes)t.appendChild(e.cloneNode(!0));return t}get[Symbol.toStringTag](){return`DocumentFragment`}},Pt=s;me(),A(),P();var HTMLImageElement=class extends HTMLElement$1{constructor(){super(),this._complete=!1,this._naturalHeight=0,this._naturalWidth=0,this[Me]=`IMG`,this[Ne]=`img`,this[Pe]=st.html}get complete(){return this._complete}get naturalHeight(){return this._naturalHeight}get naturalWidth(){return this._naturalWidth}get currentSrc(){return this.src}get x(){return 0}get y(){return 0}get alt(){return this.getAttribute(`alt`)??``}set alt(e){this.setAttribute(`alt`,e)}get crossOrigin(){return this.getAttribute(`crossorigin`)}set crossOrigin(e){e===null?this.removeAttribute(`crossorigin`):this.setAttribute(`crossorigin`,e)}get decoding(){return this.getAttribute(`decoding`)??`auto`}set decoding(e){this.setAttribute(`decoding`,e)}get loading(){let e=this.getAttribute(`loading`);return e===`lazy`||e===`eager`?e:`auto`}set loading(e){this.setAttribute(`loading`,e)}get referrerPolicy(){return this.getAttribute(`referrerpolicy`)??``}set referrerPolicy(e){this.setAttribute(`referrerpolicy`,e)}get sizes(){return this.getAttribute(`sizes`)??``}set sizes(e){this.setAttribute(`sizes`,e)}get src(){return this.getAttribute(`src`)??``}set src(e){this.setAttribute(`src`,e);let t=globalThis.__GJSIFY_DEBUG_IMG===!0;if(e.startsWith(`data:`)){let n=e.indexOf(`,`);if(n===-1){this._complete=!0,this.dispatchEvent(new Event(`error`));return}let r=e.slice(5,n),i=e.slice(n+1),a=r.includes(`;base64`);try{let e;e=a?k.base64_decode(i):new TextEncoder().encode(decodeURIComponent(i));let n=k.Bytes.new(e),r=N.MemoryInputStream.new_from_bytes(n);this._pixbuf=Pt.Pixbuf.new_from_stream(r,null),this._naturalWidth=this._pixbuf.get_width(),this._naturalHeight=this._pixbuf.get_height(),this._complete=!0,t&&I.log(`[img] ok data: (${this._naturalWidth}x${this._naturalHeight})`),this.dispatchEvent(new Event(`load`))}catch(e){t&&I.warn(`[img] error data:: ${e instanceof Error?e.message:String(e)}`),this._complete=!0,this.dispatchEvent(new Event(`error`))}return}let n;if(e.startsWith(`file://`))n=k.filename_from_uri(e)[0];else if(e.startsWith(`http://`)||e.startsWith(`https://`)){this._complete=!0,this.dispatchEvent(new Event(`error`));return}else{let t=k.path_get_dirname(c.programInvocationName);n=k.build_filenamev([t,e])}try{t&&I.log(`[img] load ${n}`),this._pixbuf=Pt.Pixbuf.new_from_file(n),this._naturalWidth=this._pixbuf.get_width(),this._naturalHeight=this._pixbuf.get_height(),this._complete=!0,t&&I.log(`[img] ok ${n} (${this._naturalWidth}x${this._naturalHeight})`),this.dispatchEvent(new Event(`load`))}catch(e){t&&I.warn(`[img] error ${n}: ${e instanceof Error?e.message:String(e)}`),this._complete=!0,this.dispatchEvent(new Event(`error`))}}get srcset(){return this.getAttribute(`srcset`)??``}set srcset(e){this.setAttribute(`srcset`,e)}get useMap(){return this.getAttribute(`usemap`)??``}set useMap(e){this.setAttribute(`usemap`,e)}get height(){if(this._pixbuf)return this._pixbuf.get_height();let e=this.getAttribute(`height`);return e===null?0:Number(e)}set height(e){this.setAttribute(`height`,String(e))}get width(){if(this._pixbuf)return this._pixbuf.get_width();let e=this.getAttribute(`width`);return e===null?0:Number(e)}set width(e){this.setAttribute(`width`,String(e))}get isMap(){return this.hasAttribute(`ismap`)}set isMap(e){e?this.setAttribute(`ismap`,``):this.removeAttribute(`ismap`)}decode(){return Promise.resolve()}cloneNode(e=!1){return super.cloneNode(e)}getImageData(){if(!this._pixbuf)return null;let e=this._pixbuf.get_has_alpha()?this._pixbuf:this._pixbuf.add_alpha(!1,0,0,0)??this._pixbuf;return{colorSpace:`srgb`,data:new Uint8ClampedArray(e.get_pixels()),height:e.get_height(),width:e.get_width()}}isPixbuf(){return!!this._pixbuf}get[Symbol.toStringTag](){return`HTMLImageElement`}},HTMLMediaElement=class extends HTMLElement$1{constructor(...e){super(...e),this._src=``,this._srcObject=null,this.currentTime=0,this.duration=NaN,this.paused=!0,this.ended=!1,this.volume=1,this.muted=!1,this.defaultMuted=!1,this.loop=!1,this.autoplay=!1,this.preload=``,this.playbackRate=1,this.defaultPlaybackRate=1,this.readyState=0,this.networkState=0}get buffered(){return{length:0,start:()=>0,end:()=>0}}get seekable(){return{length:0,start:()=>0,end:()=>0}}get played(){return{length:0,start:()=>0,end:()=>0}}get src(){return this._src}set src(e){this._src=e,this._srcObject=null,this.dispatchEvent(new Event(`srcchange`))}get srcObject(){return this._srcObject}set srcObject(e){this._srcObject=e,this._src=``,this.dispatchEvent(new Event(`srcobjectchange`))}play(){return this.paused=!1,this.ended=!1,this.dispatchEvent(new Event(`play`)),Promise.resolve()}pause(){this.paused=!0,this.dispatchEvent(new Event(`pause`))}load(){this.readyState=0,this.networkState=2,this.dispatchEvent(new Event(`loadstart`))}canPlayType(e){return``}static{this.HAVE_NOTHING=0}static{this.HAVE_METADATA=1}static{this.HAVE_CURRENT_DATA=2}static{this.HAVE_FUTURE_DATA=3}static{this.HAVE_ENOUGH_DATA=4}static{this.NETWORK_EMPTY=0}static{this.NETWORK_IDLE=1}static{this.NETWORK_LOADING=2}static{this.NETWORK_NO_SOURCE=3}get[Symbol.toStringTag](){return`HTMLMediaElement`}};const Ft=1e9;function secondsToGstTime(e){return BigInt(Math.round(e*Ft))}function gstTimeToSeconds(e){return Number(e)/Ft}var HTMLVideoElement=class extends HTMLMediaElement{constructor(){super(),this._pipeline=null,this._videoWidth=0,this._videoHeight=0,this.poster=``,this[Me]=`VIDEO`,this[Ne]=`video`,this[Pe]=st.html;let e=this;Object.defineProperty(this,"paused",{get(){if(!e._pipeline)return!0;let[,t]=e._pipeline.get_state(0n);return t!==4},configurable:!0,enumerable:!0}),Object.defineProperty(this,"currentTime",{get(){if(!e._pipeline)return 0;let[t,n]=e._pipeline.query_position(3);return t?gstTimeToSeconds(n):0},set(t){e._pipeline?.seek(1,3,5,1,secondsToGstTime(t),0,-1n)},configurable:!0,enumerable:!0}),Object.defineProperty(this,"duration",{get(){if(!e._pipeline)return NaN;let[t,n]=e._pipeline.query_duration(3);return t&&Number(n)>0?gstTimeToSeconds(n):NaN},configurable:!0,enumerable:!0}),Object.defineProperty(this,"volume",{get(){return e._playbin()?.volume??1},set(t){let n=e._playbin();n&&(n.volume=Math.max(0,Math.min(1,t)))},configurable:!0,enumerable:!0}),Object.defineProperty(this,"muted",{get(){return e._playbin()?.mute??!1},set(t){let n=e._playbin();n&&(n.mute=t)},configurable:!0,enumerable:!0})}async play(){this._pipeline?.set_state(4),this.dispatchEvent(new Event(`play`)),this.dispatchEvent(new Event(`playing`))}pause(){this._pipeline?.set_state(3),this.dispatchEvent(new Event(`pause`))}get videoWidth(){return this._videoWidth}set videoWidth(e){this._videoWidth=e}get videoHeight(){return this._videoHeight}set videoHeight(e){this._videoHeight=e}get[Symbol.toStringTag](){return`HTMLVideoElement`}_playbin(){return this._pipeline?.get_by_name(`playbin`)??null}};const It=new class Document extends ot{static{this._elementFactories=new Map}constructor(){super(),this.body=new HTMLElement$1,this.head=new HTMLElement$1,this.documentElement=new HTMLElement$1,this.appendChild(this.documentElement),this.documentElement.appendChild(this.body)}static registerElementFactory(e,t){Document._elementFactories.set(e.toLowerCase(),t)}createElementNS(e,t){let n=t.toLowerCase();switch(n){case`img`:return new HTMLImageElement;case`video`:return new HTMLVideoElement;case`canvas`:return new mt;default:{let e=Document._elementFactories.get(n);return e?e():new HTMLElement$1}}}createElement(e){return this.createElementNS(`http://www.w3.org/1999/xhtml`,e)}createTextNode(e){return new Mt(e)}createComment(e){return new jt(e)}createDocumentFragment(){return new Nt}createEvent(e){return new Event(e)}getElementById(e){return this._findById(this.body,e)}_findById(e,t){if(e.id===t)return e;for(let n of e.children){let e=this._findById(n,t);if(e)return e}return null}get[Symbol.toStringTag](){return`Document`}};var DOMTokenList=class{constructor(e,t){this._ownerElement=e,this._attributeName=t}_getTokens(){let e=this._ownerElement.getAttribute(this._attributeName);return e?e.split(/\s+/).filter(e=>e.length>0):[]}_setTokens(e){let t=e.join(` `);t?this._ownerElement.setAttribute(this._attributeName,t):this._ownerElement.removeAttribute(this._attributeName)}get length(){return this._getTokens().length}get value(){return this._ownerElement.getAttribute(this._attributeName)??``}set value(e){e?this._ownerElement.setAttribute(this._attributeName,e):this._ownerElement.removeAttribute(this._attributeName)}item(e){let t=this._getTokens();return e>=0&&e<t.length?t[e]:null}contains(e){return this._getTokens().includes(e)}add(...e){let t=this._getTokens();for(let n of e)n&&!t.includes(n)&&t.push(n);this._setTokens(t)}remove(...e){let t=this._getTokens().filter(t=>!e.includes(t));this._setTokens(t)}toggle(e,t){let n=this.contains(e);return t===void 0?n?(this.remove(e),!1):(this.add(e),!0):t?(this.add(e),!0):(this.remove(e),!1)}replace(e,t){let n=this._getTokens(),r=n.indexOf(e);return r===-1?!1:(n[r]=t,this._setTokens(n),!0)}supports(e){return!0}forEach(e){let t=this._getTokens();for(let n=0;n<t.length;n++)e(t[n],n,this)}keys(){return this._getTokens().keys()}values(){return this._getTokens().values()}entries(){return this._getTokens().entries()}[Symbol.iterator](){return this._getTokens().values()}toString(){return this.value}get[Symbol.toStringTag](){return`DOMTokenList`}};me(),defineGlobal(`Text`,Mt),defineGlobal(`Comment`,jt),defineGlobal(`DocumentFragment`,Nt),defineGlobal(`DOMTokenList`,DOMTokenList),defineGlobal(`document`,It),defineGlobalIfMissing(`self`,globalThis);var Window=class{};defineGlobalIfMissing(`Window`,Window),defineGlobalIfMissing(`window`,globalThis),defineGlobalIfMissing(`focus`,()=>{}),defineGlobalIfMissing(`blur`,()=>{});{let e=globalThis;if(typeof e.addEventListener!=`function`){let t=new EventTarget;e.__gjsify_globalEventTarget=t,e.addEventListener=(e,n,r)=>t.addEventListener(e,n,r),e.removeEventListener=(e,n,r)=>t.removeEventListener(e,n,r),e.dispatchEvent=e=>t.dispatchEvent(e)}}defineGlobalIfMissing(`devicePixelRatio`,1),defineGlobalIfMissing(`scrollX`,0),defineGlobalIfMissing(`scrollY`,0),defineGlobalIfMissing(`pageXOffset`,0),defineGlobalIfMissing(`pageYOffset`,0),defineGlobalIfMissing(`alert`,(...e)=>I.error(`alert:`,...e)),globalThis.top===void 0&&Object.defineProperty(globalThis,"top",{get:()=>globalThis,configurable:!0}),globalThis.navigator===void 0&&(globalThis.navigator={});function atobPolyfill(e){if(typeof globalThis.atob==`function`)return globalThis.atob(e);let t=e.replace(/[=\s]/g,``),n=``,r=0,i=0;for(let e=0;e<t.length;e++)r=r<<6|Lt[t.charCodeAt(e)],i+=6,i>=8&&(i-=8,n+=String.fromCharCode(r>>i&255));return n}function btoaPolyfill(e){if(typeof globalThis.btoa==`function`)return globalThis.btoa(e);let t=``,n=0;for(;n+2<e.length;n+=3){let r=e.charCodeAt(n)<<16|e.charCodeAt(n+1)<<8|e.charCodeAt(n+2);t+=K[r>>18&63]+K[r>>12&63]+K[r>>6&63]+K[r&63]}if(n+1===e.length){let r=e.charCodeAt(n)<<16;t+=K[r>>18&63]+K[r>>12&63]+`==`}else if(n+2===e.length){let r=e.charCodeAt(n)<<16|e.charCodeAt(n+1)<<8;t+=K[r>>18&63]+K[r>>12&63]+K[r>>6&63]+`=`}return t}function base64Decode(e){let t=e.replace(/[=\s]/g,``),n=new Uint8Array(t.length*3>>2),r=0,i=0,a=0;for(let e=0;e<t.length;e++)r=r<<6|Lt[t.charCodeAt(e)],i+=6,i>=8&&(i-=8,n[a++]=r>>i&255);return n.subarray(0,a)}function base64Encode(e){let t=``,n=e.length;for(let r=0;r<n;r+=3){let i=e[r],a=r+1<n?e[r+1]:0,o=r+2<n?e[r+2]:0;t+=K[i>>2],t+=K[(i&3)<<4|a>>4],t+=r+1<n?K[(a&15)<<2|o>>6]:`=`,t+=r+2<n?K[o&63]:`=`}return t}var K,Lt,Rt=__esmMin(()=>{K=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,Lt=new Uint8Array(256);for(let e=0;e<64;e++)Lt[K.charCodeAt(e)]=e});function normalizeEncoding(e){if(!e||e===`utf8`||e===`utf-8`)return`utf8`;switch((``+e).toLowerCase().replace(/-/g,``)){case`utf8`:return`utf8`;case`ascii`:return`ascii`;case`latin1`:case`binary`:return`latin1`;case`base64`:return`base64`;case`base64url`:return`base64url`;case`hex`:return`hex`;case`ucs2`:case`utf16le`:return`utf16le`;default:return`utf8`}}function checkEncoding(e){let t=(``+e).toLowerCase().replace(/-/g,``);if(!zt.includes(t))throw TypeError(`Unknown encoding: ${e}`)}var zt,Bt=__esmMin(()=>{zt=[`utf8`,`ascii`,`latin1`,`binary`,`base64`,`base64url`,`hex`,`ucs2`,`utf16le`]});function encodeString(e,t){switch(t){case`utf8`:return Vt.encode(e);case`ascii`:{let t=new Uint8Array(e.length);for(let n=0;n<e.length;n++)t[n]=e.charCodeAt(n)&127;return t}case`latin1`:{let t=new Uint8Array(e.length);for(let n=0;n<e.length;n++)t[n]=e.charCodeAt(n)&255;return t}case`base64`:return base64Decode(e.replace(/-/g,`+`).replace(/_/g,`/`));case`base64url`:return encodeString(e.replace(/-/g,`+`).replace(/_/g,`/`),`base64`);case`hex`:{let t=e.length>>>1,n=new Uint8Array(t);for(let r=0;r<t;r++){let t=parseInt(e[r*2],16),i=parseInt(e[r*2+1],16);if(Number.isNaN(t)||Number.isNaN(i))break;n[r]=t<<4|i}return n}case`utf16le`:{let t=new Uint8Array(e.length*2);for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);t[n*2]=r&255,t[n*2+1]=r>>8&255}return t}default:return Vt.encode(e)}}function decodeString(e,t,n,r){let i=n!==void 0||r!==void 0?e.subarray(n??0,r??e.length):e;switch(t){case`utf8`:return Ht.decode(i);case`ascii`:{let e=``;for(let t=0;t<i.length;t++)e+=String.fromCharCode(i[t]&127);return e}case`latin1`:{let e=``;for(let t=0;t<i.length;t++)e+=String.fromCharCode(i[t]);return e}case`base64`:{let e=``;for(let t=0;t<i.length;t++)e+=String.fromCharCode(i[t]);return btoaPolyfill(e)}case`base64url`:return decodeString(i,`base64`).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/,``);case`hex`:{let e=``;for(let t=0;t<i.length;t++)e+=i[t].toString(16).padStart(2,`0`);return e}case`utf16le`:{let e=``;for(let t=0;t+1<i.length;t+=2)e+=String.fromCharCode(i[t]|i[t+1]<<8);return e}default:return Ht.decode(i)}}function checkOffset(e,t,n){if(e+t>n)throw RangeError(`Attempt to access memory outside buffer bounds`)}var Vt,Ht,Ut=__esmMin(()=>{Rt(),Vt=new TextEncoder,Ht=new TextDecoder}),Wt,q,Gt,Kt,qt,SlowBuffer,Jt=__esmMin(()=>{Ut(),Bt(),Wt=typeof SharedArrayBuffer<`u`,q=class Buffer extends Uint8Array{static _isBuffer=!0;static alloc(e,t,n){if(typeof e!=`number`)throw TypeError(`The "size" argument must be of type number. Received type ${typeof e}`);if(e<0)throw RangeError(`The value "${e}" is invalid for option "size"`);let r=new Buffer(e);return t!==void 0&&t!==0&&r.fill(t,0,e,n),r}static allocUnsafe(e){if(typeof e!=`number`)throw TypeError(`The "size" argument must be of type number. Received type ${typeof e}`);return new Buffer(e)}static allocUnsafeSlow(e){return Buffer.allocUnsafe(e)}static from(e,t,n){if(typeof e==`string`){let n=normalizeEncoding(t);if(t&&typeof t==`string`){let e=(``+t).toLowerCase().replace(/-/g,``);[`utf8`,`ascii`,`latin1`,`binary`,`base64`,`base64url`,`hex`,`ucs2`,`utf16le`,``].includes(e)||checkEncoding(t)}let r=encodeString(e,n);return new Buffer(r.buffer,r.byteOffset,r.byteLength)}if(ArrayBuffer.isView(e)){let t=new Buffer(e.buffer,e.byteOffset,e.byteLength),n=new Buffer(t.length);return n.set(t),n}if(e instanceof ArrayBuffer){let r=t||0;return new Buffer(e,r,n===void 0?e.byteLength-r:n)}if(Wt&&e instanceof SharedArrayBuffer){let r=t||0,i=n===void 0?e.byteLength-r:n;return new Buffer(new Uint8Array(e,r,i))}if(typeof e==`object`&&e&&typeof e.viewBytes==`function`&&typeof e.byteLength==`number`&&e.constructor?.name===`SharedBuffer`){let r=e,i=t||0,a=n===void 0?r.byteLength-i:n,o=r.viewBytes(i,a);return new Buffer(o.buffer,o.byteOffset,o.byteLength)}if(Array.isArray(e)){let t=new Buffer(e.length);for(let n=0;n<e.length;n++)t[n]=e[n]&255;return t}throw TypeError(`The first argument must be of type string or an instance of Buffer, ArrayBuffer, or Array`)}static isBuffer(e){return e instanceof Buffer}static isEncoding(e){if(typeof e!=`string`)return!1;let t=e.toLowerCase().replace(/-/g,``);return[`utf8`,`ascii`,`latin1`,`binary`,`base64`,`base64url`,`hex`,`ucs2`,`utf16le`].includes(t)}static byteLength(e,t){if(typeof e!=`string`){if(ArrayBuffer.isView(e)||e instanceof ArrayBuffer||Wt&&e instanceof SharedArrayBuffer)return e.byteLength;throw TypeError(`The "string" argument must be one of type string, Buffer, or ArrayBuffer`)}switch(normalizeEncoding(t)){case`utf8`:return new TextEncoder().encode(e).byteLength;case`ascii`:case`latin1`:return e.length;case`base64`:case`base64url`:{let t=e.length;for(;t>0&&(e[t-1]===`=`||e[t-1]===` `);)t--;return t*3>>>2}case`hex`:return e.length>>>1;case`utf16le`:return e.length*2;default:return new TextEncoder().encode(e).byteLength}}static compare(e,t){if(!(e instanceof Uint8Array)||!(t instanceof Uint8Array))throw TypeError(`Arguments must be Buffers or Uint8Arrays`);let n=Math.min(e.length,t.length);for(let r=0;r<n;r++){if(e[r]<t[r])return-1;if(e[r]>t[r])return 1}return e.length<t.length?-1:+(e.length>t.length)}static concat(e,t){if(e.length===0)return Buffer.alloc(0);if(t===void 0){t=0;for(let n=0;n<e.length;n++)t+=e[n].length}let n=Buffer.alloc(t),r=0;for(let i=0;i<e.length;i++){let a=e[i],o=Math.min(a.length,t-r);o<=0||(n.set(a.subarray(0,o),r),r+=o)}return n}static poolSize=8192;toString(e,t,n){let r=normalizeEncoding(e);return decodeString(this,r,t,n)}toJSON(){return{type:`Buffer`,data:Array.from(this)}}equals(e){if(!(e instanceof Uint8Array))throw TypeError(`Argument must be a Buffer or Uint8Array`);if(this.length!==e.length)return!1;for(let t=0;t<this.length;t++)if(this[t]!==e[t])return!1;return!0}compare(e,t,n,r,i){if(!(e instanceof Uint8Array))throw TypeError(`Argument must be a Buffer or Uint8Array`);let a=r!==void 0||i!==void 0?this.subarray(r??0,i??this.length):this,o=t!==void 0||n!==void 0?e.subarray(t??0,n??e.length):e;return Buffer.compare(a,o)}copy(e,t=0,n=0,r){let i=r??this.length,a=Math.min(i-n,e.length-t);return a<=0?0:(e.set(this.subarray(n,n+a),t),a)}slice(e,t){let n=e??0,r=t??this.length,i=super.subarray(n,r);return new Buffer(i.buffer,i.byteOffset,i.byteLength)}subarray(e,t){let n=super.subarray(e,t);return new Buffer(n.buffer,n.byteOffset,n.byteLength)}write(e,t,n,r){t??=0;let i=encodeString(e,normalizeEncoding(r||(typeof n==`string`?n:void 0))),a=n!==void 0&&typeof n==`number`?Math.min(n,this.length-t):this.length-t,o=Math.min(i.length,a);return this.set(i.subarray(0,o),t),o}fill(e,t,n,r){let i=t??0,a=n??this.length;if(typeof e==`number`)super.fill(e&255,i,a);else if(typeof e==`string`){let t=encodeString(e,normalizeEncoding(r));if(t.length===0)super.fill(0,i,a);else if(t.length===1)super.fill(t[0],i,a);else for(let e=i;e<a;e++)this[e]=t[(e-i)%t.length]}else if(e instanceof Uint8Array)if(e.length===0)super.fill(0,i,a);else for(let t=i;t<a;t++)this[t]=e[(t-i)%e.length];return this}indexOf(e,t,n){if(typeof e==`number`)return super.indexOf(e&255,t);let r=typeof e==`string`?encodeString(e,normalizeEncoding(n)):e,i=t??0;outer:for(let e=i;e<=this.length-r.length;e++){for(let t=0;t<r.length;t++)if(this[e+t]!==r[t])continue outer;return e}return-1}lastIndexOf(e,t,n){if(typeof e==`number`)return t===void 0?super.lastIndexOf(e&255):super.lastIndexOf(e&255,t);let r=typeof e==`string`?encodeString(e,normalizeEncoding(n)):e,i=t===void 0?this.length-r.length:Math.min(t,this.length-r.length);outer:for(let e=i;e>=0;e--){for(let t=0;t<r.length;t++)if(this[e+t]!==r[t])continue outer;return e}return-1}includes(e,t,n){return this.indexOf(e,t,n)!==-1}readUInt8(e=0){return checkOffset(e,1,this.length),this[e]}readUInt16BE(e=0){return checkOffset(e,2,this.length),this[e]<<8|this[e+1]}readUInt16LE(e=0){return checkOffset(e,2,this.length),this[e]|this[e+1]<<8}readUInt32BE(e=0){return checkOffset(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])}readUInt32LE(e=0){return checkOffset(e,4,this.length),this[e+3]*16777216+(this[e+2]<<16|this[e+1]<<8|this[e])>>>0}readInt8(e=0){return checkOffset(e,1,this.length),this[e]|(this[e]&128?4294967040:0)}readInt16BE(e=0){checkOffset(e,2,this.length);let t=this[e]<<8|this[e+1];return t&32768?t|4294901760:t}readInt16LE(e=0){checkOffset(e,2,this.length);let t=this[e]|this[e+1]<<8;return t&32768?t|4294901760:t}readInt32BE(e=0){return checkOffset(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]}readInt32LE(e=0){return checkOffset(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24}readFloatBE(e=0){return checkOffset(e,4,this.length),new DataView(this.buffer,this.byteOffset+e,4).getFloat32(0,!1)}readFloatLE(e=0){return checkOffset(e,4,this.length),new DataView(this.buffer,this.byteOffset+e,4).getFloat32(0,!0)}readDoubleBE(e=0){return checkOffset(e,8,this.length),new DataView(this.buffer,this.byteOffset+e,8).getFloat64(0,!1)}readDoubleLE(e=0){return checkOffset(e,8,this.length),new DataView(this.buffer,this.byteOffset+e,8).getFloat64(0,!0)}readBigInt64BE(e=0){return checkOffset(e,8,this.length),new DataView(this.buffer,this.byteOffset+e,8).getBigInt64(0,!1)}readBigInt64LE(e=0){return checkOffset(e,8,this.length),new DataView(this.buffer,this.byteOffset+e,8).getBigInt64(0,!0)}readBigUInt64BE(e=0){return checkOffset(e,8,this.length),new DataView(this.buffer,this.byteOffset+e,8).getBigUint64(0,!1)}readBigUInt64LE(e=0){return checkOffset(e,8,this.length),new DataView(this.buffer,this.byteOffset+e,8).getBigUint64(0,!0)}readUIntBE(e,t){checkOffset(e,t,this.length);let n=0;for(let r=0;r<t;r++)n=n*256+this[e+r];return n}readUIntLE(e,t){checkOffset(e,t,this.length);let n=0,r=1;for(let i=0;i<t;i++)n+=this[e+i]*r,r*=256;return n}readIntBE(e,t){checkOffset(e,t,this.length);let n=0;for(let r=0;r<t;r++)n=n*256+this[e+r];return n>=2**(8*t-1)&&(n-=2**(8*t)),n}readIntLE(e,t){checkOffset(e,t,this.length);let n=0,r=1;for(let i=0;i<t;i++)n+=this[e+i]*r,r*=256;return n>=2**(8*t-1)&&(n-=2**(8*t)),n}writeUInt8(e,t=0){return checkOffset(t,1,this.length),this[t]=e&255,t+1}writeUInt16BE(e,t=0){return checkOffset(t,2,this.length),this[t]=e>>>8&255,this[t+1]=e&255,t+2}writeUInt16LE(e,t=0){return checkOffset(t,2,this.length),this[t]=e&255,this[t+1]=e>>>8&255,t+2}writeUInt32BE(e,t=0){return checkOffset(t,4,this.length),this[t]=e>>>24&255,this[t+1]=e>>>16&255,this[t+2]=e>>>8&255,this[t+3]=e&255,t+4}writeUInt32LE(e,t=0){return checkOffset(t,4,this.length),this[t]=e&255,this[t+1]=e>>>8&255,this[t+2]=e>>>16&255,this[t+3]=e>>>24&255,t+4}writeInt8(e,t=0){return checkOffset(t,1,this.length),e<0&&(e=255+e+1),this[t]=e&255,t+1}writeInt16BE(e,t=0){return checkOffset(t,2,this.length),this[t]=e>>>8&255,this[t+1]=e&255,t+2}writeInt16LE(e,t=0){return checkOffset(t,2,this.length),this[t]=e&255,this[t+1]=e>>>8&255,t+2}writeInt32BE(e,t=0){return checkOffset(t,4,this.length),this[t]=e>>>24&255,this[t+1]=e>>>16&255,this[t+2]=e>>>8&255,this[t+3]=e&255,t+4}writeInt32LE(e,t=0){return checkOffset(t,4,this.length),this[t]=e&255,this[t+1]=e>>>8&255,this[t+2]=e>>>16&255,this[t+3]=e>>>24&255,t+4}writeFloatBE(e,t=0){return checkOffset(t,4,this.length),new DataView(this.buffer,this.byteOffset+t,4).setFloat32(0,e,!1),t+4}writeFloatLE(e,t=0){return checkOffset(t,4,this.length),new DataView(this.buffer,this.byteOffset+t,4).setFloat32(0,e,!0),t+4}writeDoubleBE(e,t=0){return checkOffset(t,8,this.length),new DataView(this.buffer,this.byteOffset+t,8).setFloat64(0,e,!1),t+8}writeDoubleLE(e,t=0){return checkOffset(t,8,this.length),new DataView(this.buffer,this.byteOffset+t,8).setFloat64(0,e,!0),t+8}writeBigInt64BE(e,t=0){return checkOffset(t,8,this.length),new DataView(this.buffer,this.byteOffset+t,8).setBigInt64(0,e,!1),t+8}writeBigInt64LE(e,t=0){return checkOffset(t,8,this.length),new DataView(this.buffer,this.byteOffset+t,8).setBigInt64(0,e,!0),t+8}writeBigUInt64BE(e,t=0){return checkOffset(t,8,this.length),new DataView(this.buffer,this.byteOffset+t,8).setBigUint64(0,e,!1),t+8}writeBigUInt64LE(e,t=0){return checkOffset(t,8,this.length),new DataView(this.buffer,this.byteOffset+t,8).setBigUint64(0,e,!0),t+8}swap16(){let e=this.length;if(e%2!=0)throw RangeError(`Buffer size must be a multiple of 16-bits`);for(let t=0;t<e;t+=2){let e=this[t];this[t]=this[t+1],this[t+1]=e}return this}swap32(){let e=this.length;if(e%4!=0)throw RangeError(`Buffer size must be a multiple of 32-bits`);for(let t=0;t<e;t+=4){let e=this[t],n=this[t+1];this[t]=this[t+3],this[t+1]=this[t+2],this[t+2]=n,this[t+3]=e}return this}swap64(){let e=this.length;if(e%8!=0)throw RangeError(`Buffer size must be a multiple of 64-bits`);for(let t=0;t<e;t+=8){let e=this[t],n=this[t+1],r=this[t+2],i=this[t+3];this[t]=this[t+7],this[t+1]=this[t+6],this[t+2]=this[t+5],this[t+3]=this[t+4],this[t+4]=i,this[t+5]=r,this[t+6]=n,this[t+7]=e}return this}},Gt=2**31-1,Kt=2**28-16,qt={MAX_LENGTH:Gt,MAX_STRING_LENGTH:Kt},SlowBuffer=class extends q{constructor(e){super(e)}}}),Yt=__exportAll$4({Blob:()=>x,Buffer:()=>q,File:()=>S,INSPECT_MAX_BYTES:()=>50,SlowBuffer:()=>SlowBuffer,atob:()=>Xt,atobPolyfill:()=>atobPolyfill,base64Decode:()=>base64Decode,base64Encode:()=>base64Encode,btoa:()=>Zt,btoaPolyfill:()=>btoaPolyfill,checkEncoding:()=>checkEncoding,constants:()=>qt,default:()=>Qt,kMaxLength:()=>Gt,kStringMaxLength:()=>Kt,normalizeEncoding:()=>normalizeEncoding}),Xt,Zt,Qt,J=__esmMin(()=>{Rt(),w(),Bt(),Jt(),Xt=globalThis.atob,Zt=globalThis.btoa,Qt={Buffer:q,SlowBuffer,Blob:x,File:S,atob:Xt,btoa:Zt,kMaxLength:Gt,kStringMaxLength:Kt,constants:qt,INSPECT_MAX_BYTES:50}});J(),`Buffer`in globalThis||Object.defineProperty(globalThis,"Buffer",{value:q,enumerable:!1,writable:!0,configurable:!0}),A(),typeof globalThis.btoa!=`function`&&Object.defineProperty(globalThis,"btoa",{value:function btoa(e){let t=new Uint8Array(e.length);for(let n=0;n<e.length;n++)t[n]=e.charCodeAt(n)&255;return k.base64_encode(t)},enumerable:!0,writable:!0,configurable:!0}),typeof globalThis.atob!=`function`&&Object.defineProperty(globalThis,"atob",{value:function atob(e){let t=k.base64_decode(e),n=``;for(let e=0;e<t.length;e++)n+=String.fromCharCode(t[e]);return n},enumerable:!0,writable:!0,configurable:!0}),L(),typeof queueMicrotask!=`function`&&Object.defineProperty(globalThis,"queueMicrotask",{value:ge,enumerable:!0,writable:!0,configurable:!0});function getGjsGlobal(){return globalThis}function getGioNamespace(){let e=getGjsGlobal().imports?.gi;if(!e)return null;let t=null;try{t=e.GioUnix??null}catch{}if(!t)try{t=e.Gio??null}catch{}return t}function getMonotonicTime(){try{let e=getGjsGlobal().imports?.gi?.GLib;if(e?.get_monotonic_time)return BigInt(e.get_monotonic_time())*1000n}catch{}return typeof performance?.now==`function`?BigInt(Math.round(performance.now()*1e6)):BigInt(Date.now())*1000000n}const $t=getMonotonicTime();function hrtime(e){let t=getMonotonicTime()-$t,n=Number(t/1000000000n),r=Number(t%1000000000n);if(e){let t=n-e[0],i=r-e[1];return i<0&&(t--,i+=1e9),[t,i]}return[n,r]}function hrtimeBigint(){return getMonotonicTime()-$t}function detectGjsVersion(){try{let e=getGjsGlobal().imports?.system;if(e?.version!==void 0){let t=Number(e.version);return`${Math.floor(t/1e4)}.${Math.floor(t%1e4/100)}.${t%100}`}}catch{}}function detectNodeVersion(){if(typeof globalThis.process?.versions?.node==`string`)return globalThis.process.versions.node}function detectVersionInfo(){if(detectNodeVersion())return{version:globalThis.process.version,versions:{...globalThis.process.versions},title:globalThis.process?.title||`node`};let e=detectGjsVersion(),t={node:`20.0.0`};return e&&(t.gjs=e),{version:`v20.0.0`,versions:t,title:`gjs`}}function detectPpid(){if(typeof globalThis.process?.ppid==`number`)return globalThis.process.ppid;try{let e=getGjsGlobal().imports?.gi?.GLib;if(e){let[,t]=e.file_get_contents(`/proc/self/status`);if(t){let e=new TextDecoder().decode(t).match(/PPid:\s+(\d+)/);if(e)return parseInt(e[1],10)}}}catch{}return 0}function detectPlatform(){try{let e=getGjsGlobal().imports?.gi?.GLib;if(e&&e.get_os_info(`ID`))return`linux`}catch{}return getGjsGlobal().imports?.system===void 0&&typeof globalThis.process?.platform==`string`?globalThis.process.platform:`linux`}function detectArch(){return typeof globalThis.process?.arch==`string`?globalThis.process.arch:`x64`}function getPid(){if(typeof globalThis.process?.pid==`number`)return globalThis.process.pid;try{let e=getGjsGlobal().imports?.gi?.GLib;if(e){let[,t]=e.file_get_contents(`/proc/self/stat`);if(t){let e=new TextDecoder().decode(t),n=parseInt(e,10);if(!isNaN(n))return n}}}catch{}return 0}function getEnvProxy(){if(typeof globalThis.process?.env==`object`)return globalThis.process.env;try{let e=getGjsGlobal().imports?.gi?.GLib;if(e)return new Proxy({},{get(t,n){if(typeof n==`string`)return e.getenv(n)??void 0},set(t,n,r){return typeof n==`string`?(e.setenv(n,String(r),!0),!0):!1},deleteProperty(t,n){return typeof n==`string`?(e.unsetenv(n),!0):!1},has(t,n){return typeof n==`string`?e.getenv(n)!==null:!1},ownKeys(t){return e.listenv()},getOwnPropertyDescriptor(t,n){if(typeof n!=`string`)return;let r=e.getenv(n);if(r!==null)return{configurable:!0,enumerable:!0,writable:!0,value:r}}})}catch{}return{}}function getArgv(){if(globalThis.process?.argv!==void 0)return globalThis.process.argv;try{let e=getGjsGlobal().imports?.system;if(e?.programArgs)return[`gjs`,e.programInvocationName||``,...e.programArgs]}catch{}return[`gjs`]}function getExecPath(){if(typeof globalThis.process?.execPath==`string`)return globalThis.process.execPath;try{let e=getGjsGlobal().imports?.system;if(e?.programInvocationName)return e.programInvocationName}catch{}return`/usr/bin/gjs`}function getCwd(){try{let e=getGjsGlobal().imports?.gi?.GLib;if(e?.get_current_dir)return e.get_current_dir()}catch{}return`/`}function chdir(e){let t=getGjsGlobal().imports?.gi?.GLib;try{if(t?.chdir){if(!t.file_test(e,16)){let t=Error(`ENOENT: no such file or directory, chdir '${e}'`);throw t.code=`ENOENT`,t.syscall=`chdir`,t.path=e,t}t.chdir(e);return}}catch(e){if(e&&typeof e==`object`&&e.code===`ENOENT`)throw e}if(!t){let t=globalThis.process;if(t&&typeof t.chdir==`function`){t.chdir(e);return}}throw Error(`process.chdir() is not supported in this environment`)}L();function exitProcess(e){let t=getGjsGlobal().imports,n=t?.gi?.GLib,r=t?.system,i=n?.idle_add,a=n?.SOURCE_REMOVE,o=n?.PRIORITY_DEFAULT;if(r?.exit&&i&&typeof o==`number`&&typeof a==`boolean`)return ensureMainLoop(),i(o,()=>(quitMainLoop(),r.exit(e),a)),new Promise(()=>{});try{r?.exit&&r.exit(e)}catch{}let s=globalThis.process;throw s&&typeof s.exit==`function`&&s.exit(e),Error(`process.exit(${e})`)}function isGjs(){return getGjsGlobal().imports?.gi?.GLib!==void 0}function killPid(e,t){try{let n=getGjsGlobal().imports?.gi?.GLib;if(n){let r=typeof t==`number`?String(t):t||`SIGTERM`,i=r.startsWith(`SIG`)?`-${r.slice(3)}`:`-${r}`;return n.spawn_command_line_sync(`kill ${i} ${e}`),!0}}catch{}if(!isGjs()){let n=globalThis.process;if(n&&typeof n.kill==`function`)return n.kill(e,t)}throw Error(`process.kill() is not supported in this environment`)}function memoryUsage(){try{let e=getGjsGlobal().imports?.gi?.GLib;if(e){let[,t]=e.file_get_contents(`/proc/self/status`);if(t){let e=new TextDecoder().decode(t).match(/VmRSS:\s+(\d+)/),n=e?parseInt(e[1],10)*1024:0;return{rss:n,heapTotal:n,heapUsed:n,external:0,arrayBuffers:0}}}}catch{}if(!isGjs()){let e=globalThis.process;if(e&&typeof e.memoryUsage==`function`)return e.memoryUsage()}return{rss:0,heapTotal:0,heapUsed:0,external:0,arrayBuffers:0}}function cpuUsage(e){if(!isGjs()){let t=globalThis.process;if(t&&typeof t.cpuUsage==`function`)return t.cpuUsage(e)}return{user:0,system:0}}let en=null;const tn=globalThis.imports?.gi;if(tn)try{en=tn.GjsifyTerminal}catch{}const nn=en;function onceWrapper(){let{target:e,type:t,listener:n}=this;return this.wrapperFn&&e.removeListener(t,this.wrapperFn),n.apply(e,Array.from(arguments))}function _onceWrap(e,t,n){let r={target:e,type:t,listener:n,wrapperFn:void 0},i=onceWrapper.bind(r);return r.wrapperFn=i,i.listener=n,i}function arrayClone(e){switch(e.length){case 0:return[];case 1:return[e[0]];case 2:return[e[0],e[1]];case 3:return[e[0],e[1],e[2]];default:return e.slice()}}function checkListener(e){if(typeof e!=`function`)throw TypeError(`The "listener" argument must be of type Function. Received type `+typeof e)}function validateNumber(e,t){if(typeof e!=`number`||e!==e)throw TypeError(`The "${t}" argument must be of type number. Received type ${typeof e}`)}function spliceOne(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}function unwrapListeners(e){let t=Array.from({length:e.length});for(let n=0;n<t.length;++n)t[n]=e[n].listener??e[n];return t}function createAbortError$1(e){let t=Error(`The operation was aborted`);return t.name=`AbortError`,t.code=`ABORT_ERR`,e?.reason&&(t.cause=e.reason),t}var rn,an,on,sn=__esmMin(()=>{me(),rn=Symbol(`kCapture`),an=Symbol.for(`nodejs.rejection`),on=class EventEmitter{static defaultMaxListeners=10;static errorMonitor=Symbol(`events.errorMonitor`);static captureRejectionSymbol=an;static _captureRejections=!1;static get captureRejections(){return EventEmitter._captureRejections}static set captureRejections(e){if(typeof e!=`boolean`)throw TypeError(`The "captureRejections" argument must be of type boolean.`);EventEmitter._captureRejections=e}_events;_eventsCount;_maxListeners;[rn];constructor(e){this._events=Object.create(null),this._eventsCount=0,this._maxListeners=void 0,this[rn]=e?.captureRejections??EventEmitter._captureRejections}setMaxListeners(e){if(validateNumber(e,`n`),e<0)throw RangeError(`The value of "n" is out of range. It must be a non-negative number. Received `+e);return this._maxListeners=e,this}getMaxListeners(){return this._maxListeners??EventEmitter.defaultMaxListeners}emit(e,...t){let n=this._events,r=e===`error`;if(n!==void 0)r&&n[EventEmitter.errorMonitor]!==void 0&&this.emit(EventEmitter.errorMonitor,...t),r&&=n.error===void 0;else if(!r)return!1;if(r){let e;if(e=t.length>0?t[0]:Error(`Unhandled error.`),e instanceof Error)throw e;let n=Error(`Unhandled error. (`+e+`)`);throw n.context=e,n}let i=n[e];if(i===void 0)return!1;if(typeof i==`function`){let n=i.apply(this,t);n!=null&&this[rn]&&this._addCatch(n,e,t)}else{let n=arrayClone(i),r=n.length;for(let i=0;i<r;++i){let r=n[i].apply(this,t);r!=null&&this[rn]&&this._addCatch(r,e,t)}}return!0}_addCatch(e,t,n){typeof e?.then==`function`&&e.then(void 0,e=>{let r=this[an];if(typeof r==`function`)r.call(this,e,t,...n);else{let t=this[rn];try{this[rn]=!1,this.emit(`error`,e)}finally{this[rn]=t}}})}addListener(e,t){return this._addListener(e,t,!1)}on(e,t){return this._addListener(e,t,!1)}prependListener(e,t){return this._addListener(e,t,!0)}_addListener(e,t,n){checkListener(t);let r=this._events;r===void 0?(r=this._events=Object.create(null),this._eventsCount=0):r.newListener!==void 0&&(this.emit(`newListener`,e,t.listener??t),r=this._events);let i=r[e];i===void 0?(r[e]=t,++this._eventsCount):typeof i==`function`?r[e]=n?[t,i]:[i,t]:n?i.unshift(t):i.push(t);let a=this.getMaxListeners();if(a>0){let t=typeof r[e]==`function`?1:r[e].length;if(t>a&&!r[e].warned){typeof r[e]!=`function`&&(r[e].warned=!0);let n=Error(`Possible EventEmitter memory leak detected. ${t} ${String(e)} listeners added to [${this.constructor.name}]. Use emitter.setMaxListeners() to increase limit`);n.name=`MaxListenersExceededWarning`,I.warn(n.message)}}return this}once(e,t){return checkListener(t),this.on(e,_onceWrap(this,e,t)),this}prependOnceListener(e,t){return checkListener(t),this.prependListener(e,_onceWrap(this,e,t)),this}removeListener(e,t){checkListener(t);let n=this._events;if(n===void 0)return this;let r=n[e];if(r===void 0)return this;if(r===t||r.listener===t)--this._eventsCount===0?this._events=Object.create(null):(delete n[e],n.removeListener&&this.emit(`removeListener`,e,r.listener??t));else if(typeof r!=`function`){let i=-1;for(let e=r.length-1;e>=0;e--)if(r[e]===t||r[e].listener===t){i=e;break}if(i<0)return this;i===0?r.shift():spliceOne(r,i),r.length===1&&(n[e]=r[0]),n.removeListener!==void 0&&this.emit(`removeListener`,e,t.listener??t)}return this}off(e,t){return this.removeListener(e,t)}removeAllListeners(e){let t=this._events;if(t===void 0)return this;if(t.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):t[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete t[e]),this;if(arguments.length===0){let e=Object.keys(t);for(let t=0;t<e.length;++t){let n=e[t];n!==`removeListener`&&this.removeAllListeners(n)}return this.removeAllListeners(`removeListener`),this._events=Object.create(null),this._eventsCount=0,this}let n=t[e];if(typeof n==`function`)this.removeListener(e,n);else if(n!==void 0)for(let t=n.length-1;t>=0;t--)this.removeListener(e,n[t]);return this}listeners(e){let t=this._events;if(t===void 0)return[];let n=t[e];return n===void 0?[]:typeof n==`function`?[n.listener??n]:unwrapListeners(n)}rawListeners(e){let t=this._events;if(t===void 0)return[];let n=t[e];return n===void 0?[]:typeof n==`function`?[n]:arrayClone(n)}listenerCount(e){let t=this._events;if(t===void 0)return 0;let n=t[e];return n===void 0?0:typeof n==`function`?1:n.length}eventNames(){return(this._eventsCount??0)>0?Reflect.ownKeys(this._events):[]}static once(e,t,n){return new Promise((r,i)=>{let a=n?.signal;if(a?.aborted){i(createAbortError$1(a));return}if(typeof e.addEventListener==`function`){let n=e,handler=(...e)=>{a&&a.removeEventListener(`abort`,abortHandler),r(e)},errorHandler=e=>{a&&a.removeEventListener(`abort`,abortHandler),n.removeEventListener(`error`,errorHandler),i(e)},abortHandler=()=>{n.removeEventListener(t,handler),n.removeEventListener(`error`,errorHandler),i(createAbortError$1(a))};n.addEventListener(t,handler,{once:!0}),t!==`error`&&n.addEventListener(`error`,errorHandler,{once:!0}),a&&a.addEventListener(`abort`,abortHandler,{once:!0});return}let o=e,eventHandler=(...e)=>{a&&a.removeEventListener(`abort`,abortHandler),errorHandler!==void 0&&o.removeListener(`error`,errorHandler),r(e)},errorHandler;t!==`error`&&(errorHandler=e=>{o.removeListener(t,eventHandler),a&&a.removeEventListener(`abort`,abortHandler),i(e)},o.once(`error`,errorHandler)),o.once(t,eventHandler);let abortHandler=()=>{o.removeListener(t,eventHandler),errorHandler&&o.removeListener(`error`,errorHandler),i(createAbortError$1(a))};a&&a.addEventListener(`abort`,abortHandler,{once:!0})})}static on(e,t,n){let r=n?.signal;if(r?.aborted)throw createAbortError$1(r);let i=n?.highWaterMark??2**53-1,a=n?.lowWaterMark??1;validateNumber(i,`highWaterMark`),validateNumber(a,`lowWaterMark`);let o=[],s=[],c=null,l=!1,u=!1,eventHandler=(...t)=>{if(s.length>0){let{resolve:e}=s.shift();e({value:t,done:!1})}else o.push(t),o.length>=i&&!u&&(u=!0,typeof e.pause==`function`&&e.pause())},errorHandler=e=>{if(c=e,s.length>0){let{reject:t}=s.shift();t(e)}d.return()},abortHandler=()=>{errorHandler(createAbortError$1(r))};e.on(t,eventHandler),t!==`error`&&e.on(`error`,errorHandler),r&&r.addEventListener(`abort`,abortHandler,{once:!0});let cleanup=()=>{e.removeListener(t,eventHandler),e.removeListener(`error`,errorHandler),r&&r.removeEventListener(`abort`,abortHandler),l=!0;for(let{resolve:e}of s)e({value:void 0,done:!0});s.length=0,o.length=0},d={next(){if(o.length>0){let t=o.shift();return u&&o.length<a&&(u=!1,typeof e.resume==`function`&&e.resume()),Promise.resolve({value:t,done:!1})}if(c){let e=Promise.reject(c);return c=null,e}return l?Promise.resolve({value:void 0,done:!0}):new Promise((e,t)=>{s.push({resolve:e,reject:t})})},return(){return cleanup(),Promise.resolve({value:void 0,done:!0})},throw(e){return l||(c=e,cleanup()),Promise.reject(e)},[Symbol.asyncIterator](){return this}};return d}static listenerCount(e,t){return e.listenerCount(t)}static getEventListeners(e,t){return typeof e.listeners==`function`?e.listeners(t):[]}static setMaxListeners(e,...t){if(validateNumber(e,`n`),e<0)throw RangeError(`The value of "n" is out of range.`);if(t.length===0)EventEmitter.defaultMaxListeners=e;else for(let n of t)typeof n.setMaxListeners==`function`&&n.setMaxListeners(e)}static getMaxListeners(e){return typeof e.getMaxListeners==`function`?e.getMaxListeners():EventEmitter.defaultMaxListeners}static addAbortListener(e,t){e.aborted&&Promise.resolve().then(()=>t());let handler=()=>t();return e.addEventListener(`abort`,handler,{once:!0}),{[Symbol.dispose](){e.removeEventListener(`abort`,handler)}}}},on.EventEmitter=on;for(let e of[`setMaxListeners`,`getMaxListeners`,`emit`,`addListener`,`on`,`prependListener`,`once`,`prependOnceListener`,`removeListener`,`off`,`removeAllListeners`,`listeners`,`rawListeners`,`listenerCount`,`eventNames`]){let t=on.prototype[e];typeof t==`function`&&Object.defineProperty(on.prototype,e,{enumerable:!0,configurable:!0,writable:!0,value:t})}Object.defineProperty(on.prototype,"_events",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(on.prototype,"_eventsCount",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(on.prototype,"_maxListeners",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),__name(createAbortError$1,`createAbortError`)}),cn=__exportAll$4({EventEmitter:()=>Y,addAbortListener:()=>vn,captureRejectionSymbol:()=>ln,default:()=>Y,defaultMaxListeners:()=>dn,errorMonitor:()=>un,getEventListeners:()=>gn,getMaxListeners:()=>pn,listenerCount:()=>_n,on:()=>hn,once:()=>mn,setMaxListeners:()=>fn}),Y,ln,un,dn,fn,pn,mn,hn,gn,_n,vn,yn=__esmMin(()=>{sn(),L(),Y=makeCallable(on),Y.EventEmitter=Y,ln=Y.captureRejectionSymbol,un=Y.errorMonitor,dn=Y.defaultMaxListeners,fn=Y.setMaxListeners,pn=Y.getMaxListeners,mn=Y.once,hn=Y.on,gn=Y.getEventListeners,_n=Y.listenerCount,vn=Y.addAbortListener});me(),yn(),L();const bn=new TextEncoder;var ProcessWriteStream=class extends Y{fd;writable=!0;_outGio=null;constructor(e){super(),this.fd=e;let t=getGioNamespace();if(t){let e=t.UnixOutputStream??t.OutputStream;if(e)try{this._outGio=e.new(this.fd,!1)}catch{}}}write(e){if(this._outGio)try{let t=typeof e==`string`?bn.encode(e):e;return this._outGio.write_all(t,null),!0}catch{}return this.fd===2?I.error(e):I.log(e),!0}get isTTY(){if(nn)return nn.Terminal.is_tty(this.fd);try{let e=getGjsGlobal().imports?.gi?.GLib;if(e)return!!e.log_writer_supports_color(this.fd)}catch{}return!1}get columns(){if(nn){let[e,,t]=nn.Terminal.get_size(this.fd);if(e&&t>0)return t}try{let e=getGjsGlobal().imports?.gi?.GLib;if(e){let t=parseInt(e.getenv(`COLUMNS`)??`0`,10);if(t>0)return t}}catch{}return 80}end(){}destroy(){}get rows(){if(nn){let[e,t]=nn.Terminal.get_size(this.fd);if(e&&t>0)return t}try{let e=getGjsGlobal().imports?.gi?.GLib;if(e){let t=parseInt(e.getenv(`LINES`)??`0`,10);if(t>0)return t}}catch{}return 24}},ProcessReadStream=class extends Y{fd;isRaw=!1;_gio=null;_stdinGio=null;_reading=!1;_flowing=!1;_sttyCleanupRegistered=!1;_mainLoopHeld=!1;_pendingRead=!1;constructor(e){super(),this.fd=e,this._gio=getGioNamespace()}get isTTY(){return nn?nn.Terminal.is_tty(this.fd):!1}setRawMode(e){return nn&&nn.Terminal.set_raw_mode(this.fd,e)?(this.isRaw=e,this):(this._setRawModeViaStty(e),this.isRaw=e,this)}_setRawModeViaStty(e){try{let t=globalThis.imports?.gi,n=t?.Gio??t?.Gio;if(!n)return;let r=n.SubprocessFlags?.STDIN_INHERIT??2,i=e?[`stty`,`-icanon`,`-echo`,`-icrnl`,`min`,`1`,`time`,`0`]:[`stty`,`icanon`,`echo`,`icrnl`];if(new n.SubprocessLauncher({flags:r}).spawnv(i).wait(null),e&&!this._sttyCleanupRegistered){this._sttyCleanupRegistered=!0;let e=globalThis.process;e?.once&&typeof e.once==`function`&&e.once(`exit`,()=>this._setRawModeViaStty(!1))}}catch{}}setEncoding(e){return this}resume(){return this._flowing=!0,this._gio&&this.fd===0&&!this._reading&&this._startReading(),this}pause(){if(this._flowing=!1,this._reading=!1,this._mainLoopHeld){this._mainLoopHeld=!1;let e=globalThis.imports?.gi,t=e?.GLib??e?.GLib;t?.idle_add?t.idle_add(300,()=>(this._mainLoopHeld||quitMainLoop(),!1)):quitMainLoop()}return this}read(){return null}_startReading(){if(!this._gio||this._reading)return;if(this._pendingRead){this._reading=!0,this._mainLoopHeld||(this._mainLoopHeld=!0,ensureMainLoop());return}if(this._reading=!0,this._mainLoopHeld||(this._mainLoopHeld=!0,ensureMainLoop()),!this._stdinGio){let e=this._gio.UnixInputStream??this._gio.InputStream;if(!e){this._reading=!1;return}try{this._stdinGio=e.new(this.fd,!1)}catch{this._reading=!1;return}}let loop=()=>{if(!this._reading){this._pendingRead=!1;return}this._pendingRead=!0,this._stdinGio.read_bytes_async(4096,0,null,(e,t)=>{this._pendingRead=!1;try{let n=e.read_bytes_finish(t)?.get_data?.()??null;if(n&&n.byteLength>0)this.emit(`data`,Buffer.from(n));else if(n!==null&&n.byteLength===0){this._reading=!1,this.emit(`end`);return}}catch{this._reading=!1;return}this._reading&&loop()})};loop()}};me(),yn();const xn=Date.now();var Process=class extends Y{platform;arch;env;argv;argv0;execPath;pid;ppid;version;versions;title;execArgv;config;exitCode;constructor(){super(),this.platform=detectPlatform(),this.arch=detectArch(),this.env=getEnvProxy(),this.argv=getArgv(),this.argv0=this.argv[0]||`gjs`,this.execPath=getExecPath(),this.execArgv=globalThis.process?.execArgv??[],this.config=globalThis.process?.config??{target_defaults:{},variables:{}},this.pid=getPid(),this.ppid=detectPpid();let e=detectVersionInfo();this.version=e.version,this.versions=e.versions,this.title=e.title}cwd(){return getCwd()}chdir(e){chdir(e)}kill(e,t){return killPid(e,t)}exit(e){return this.exitCode=e??this.exitCode??0,this.emit(`exit`,this.exitCode),exitProcess(this.exitCode)}nextTick(e,...t){typeof queueMicrotask==`function`?queueMicrotask(()=>e(...t)):Promise.resolve().then(()=>e(...t))}hrtime(e){return hrtime(e)}uptime(){return(Date.now()-xn)/1e3}memoryUsage(){return memoryUsage()}cpuUsage(e){return cpuUsage(e)}stdout=new ProcessWriteStream(1);stderr=new ProcessWriteStream(2);stdin=new ProcessReadStream(0);abort(){this.exit(1)}umask(e){return 18}emitWarning(e,t){I.warn(typeof e==`string`?`(${t||`Warning`}): ${e}`:e.message)}};Process.prototype.hrtime.bigint=function(){return hrtimeBigint()};const X=new Process;if(nn)try{let e=new nn.ResizeWatcher;e.connect(`resized`,(e,t,n)=>{X.stdout.emit(`resize`),X.stderr.emit(`resize`)}),e.start()}catch{}X.platform,X.arch,X.env,X.argv,X.argv0,X.execPath,X.pid,X.ppid,X.version,X.versions,X.cwd.bind(X),X.chdir.bind(X),X.exit.bind(X),X.nextTick.bind(X),Object.assign(X.hrtime.bind(X),{bigint:hrtimeBigint}),X.uptime.bind(X),X.memoryUsage.bind(X),X.cpuUsage.bind(X),X.kill.bind(X),X.abort.bind(X),X.umask.bind(X),X.emitWarning.bind(X),X.execArgv,X.config,X.stdout,X.stderr,X.stdin,L(),typeof Promise.withResolvers!=`function`&&(Promise.withResolvers=function(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}),initErrorV8Methods(Error),`global`in globalThis||Object.defineProperty(globalThis,"global",{value:globalThis,writable:!1,enumerable:!1,configurable:!0}),Object.defineProperty(globalThis,"process",{value:X,enumerable:!1,writable:!0,configurable:!0}),L(),typeof globalThis.structuredClone!=`function`&&Object.defineProperty(globalThis,"structuredClone",{value:structuredClone$1,enumerable:!0,writable:!0,configurable:!0});function getGLib(){return globalThis.imports?.gi?.GLib}const Sn=getGLib()!==void 0;var GjsifyTimeout=class{_id=null;_refed=!0;_callback;_delay;_args;_repeat;constructor(e,t,n,r){this._callback=e,this._delay=t,this._args=n,this._repeat=r,this._schedule()}_schedule(){let e=getGLib();if(!e)return;let t=e.timeout_add.bind(e);this._id=t(e.PRIORITY_DEFAULT,this._delay,()=>{try{this._callback.apply(globalThis,this._args)}catch(e){setTimeout(()=>{throw e},0)}return this._repeat?e.SOURCE_CONTINUE:(this._id=null,e.SOURCE_REMOVE)})}ref(){return this._refed=!0,this}unref(){return this._refed=!1,this}hasRef(){return this._refed}refresh(){return this._cancel(),this._schedule(),this}_cancel(){if(this._id!==null){try{getGLib()?.Source.remove(this._id)}catch{}this._id=null}}[Symbol.toPrimitive](){return this._id}[Symbol.dispose](){this._cancel()}};function removeById(e){if(e instanceof GjsifyTimeout)e._cancel();else if(typeof e==`number`)try{getGLib()?.Source.remove(e)}catch{}}if(Sn){let setT=(e,t=0,...n)=>new GjsifyTimeout(e,Math.max(0,t|0),n,!1),setI=(e,t=0,...n)=>new GjsifyTimeout(e,Math.max(0,t|0),n,!0),e=globalThis;e.setTimeout=setT,e.clearTimeout=removeById,e.setInterval=setI,e.clearInterval=removeById}function setImmediate$1(e,...t){return setTimeout(e,0,...t)}__name(setImmediate$1,`setImmediate`);function clearImmediate(e){clearTimeout(e)}`setImmediate`in globalThis||Object.defineProperty(globalThis,"setImmediate",{value:setImmediate$1,enumerable:!0,writable:!0,configurable:!0}),`clearImmediate`in globalThis||Object.defineProperty(globalThis,"clearImmediate",{value:clearImmediate,enumerable:!0,writable:!0,configurable:!0});var Cn=__exportAll$4({URL:()=>Z,URLSearchParams:()=>Tn,default:()=>En,domainToASCII:()=>domainToASCII,domainToUnicode:()=>domainToUnicode,fileURLToPath:()=>fileURLToPath,format:()=>format$3,parse:()=>parse$3,pathToFileURL:()=>pathToFileURL,resolve:()=>resolve$2});function decodeComponent(e){try{return decodeURIComponent(e.replace(/\+/g,` `))}catch{return e}}function encodeComponent(e){return encodeURIComponent(e).replace(/%20/g,`+`)}function parse$3(e,t,n){if(typeof e!=`string`)throw TypeError(`The "url" argument must be of type string. Received type `+typeof e);let r={protocol:null,slashes:null,auth:null,host:null,port:null,hostname:null,hash:null,search:null,query:null,pathname:null,path:null,href:e},i=e.trim(),a=i.indexOf(`#`);a!==-1&&(r.hash=i.slice(a),i=i.slice(0,a));let o=i.indexOf(`?`);o!==-1&&(r.search=i.slice(o),r.query=t?Object.fromEntries(new Tn(i.slice(o+1))):i.slice(o+1),i=i.slice(0,o));let s=/^([a-z][a-z0-9.+-]*:)/i.exec(i);if(s&&(r.protocol=s[1].toLowerCase(),i=i.slice(r.protocol.length)),(n||r.protocol)&&i.startsWith(`//`)&&(r.slashes=!0,i=i.slice(2)),r.slashes||r.protocol&&![`javascript:`,`data:`,`mailto:`].includes(r.protocol)){let e=-1;for(let t=0;t<i.length;t++){let n=i[t];if(n===`/`||n===`\\`){e=t;break}}let t=e===-1?i:i.slice(0,e);i=e===-1?``:i.slice(e);let n=t.lastIndexOf(`@`);n===-1?parseHostPort(t,r):(r.auth=decodeURIComponent(t.slice(0,n)),parseHostPort(t.slice(n+1),r))}return r.pathname=i||(r.slashes?`/`:null),(r.pathname!==null||r.search!==null)&&(r.path=(r.pathname||``)+(r.search||``)),r.href=format$3(r),r}function parseHostPort(e,t){if(!e)return;let n=e.indexOf(`[`);if(n!==-1){let r=e.indexOf(`]`,n);if(r!==-1){let i=e.slice(r+1);i.startsWith(`:`)&&(t.port=i.slice(1)),t.hostname=e.slice(n,r+1),t.host=t.hostname+(t.port?`:`+t.port:``);return}}let r=e.lastIndexOf(`:`);if(r!==-1){let n=e.slice(r+1);/^\d*$/.test(n)?(t.port=n||null,t.hostname=e.slice(0,r).toLowerCase()):t.hostname=e.toLowerCase()}else t.hostname=e.toLowerCase();t.host=t.hostname+(t.port?`:`+t.port:``)}function format$3(e){if(typeof e==`string`)return e;if(e instanceof Z)return e.href;let t=e,n=``;if(t.protocol&&(n+=t.protocol),(t.slashes||t.protocol&&![`javascript:`,`data:`,`mailto:`].includes(t.protocol||``))&&(n+=`//`),t.auth&&(n+=encodeURIComponent(t.auth)+`@`),t.host?n+=t.host:(t.hostname&&(n+=t.hostname),t.port&&(n+=`:`+t.port)),t.pathname&&(n+=t.pathname),t.search)n+=t.search;else if(t.query&&typeof t.query==`object`){let e=new Tn(t.query).toString();e&&(n+=`?`+e)}return t.hash&&(n+=t.hash),n}function resolve$2(e,t){return new Z(t,new Z(e,`resolve://`)).href.replace(/^resolve:\/\//,``)}function fileURLToPath(e){if(typeof e==`string`&&(e=new Z(e)),!(e instanceof Z))throw TypeError(`The "url" argument must be of type string or URL. Received type `+typeof e);if(e.protocol!==`file:`)throw TypeError(`The URL must be of scheme file`);if(e.hostname!==``&&e.hostname!==`localhost`)throw TypeError(`File URL host must be "localhost" or empty on linux`);let t=e.pathname;for(let e=0;e<t.length;e++)if(t[e]===`%`){let n=t.codePointAt(e+2)|32;if(t[e+1]===`2`&&n===102)throw TypeError(`File URL path must not include encoded / characters`)}return decodeURIComponent(t)}function pathToFileURL(e){let t=e;if(e[0]!==`/`)if(typeof globalThis.process?.cwd==`function`)t=globalThis.process.cwd()+`/`+e;else try{k?.get_current_dir&&(t=k.get_current_dir()+`/`+e)}catch{}return new Z(`file://`+encodePathForURL(t))}function encodePathForURL(e){let t=``;for(let n=0;n<e.length;n++){let r=e[n];r>=`a`&&r<=`z`||r>=`A`&&r<=`Z`||r>=`0`&&r<=`9`||r===`/`||r===`-`||r===`_`||r===`.`||r===`~`||r===`:`||r===`@`||r===`!`?t+=r:t+=encodeURIComponent(r)}return t}function domainToASCII(e){try{return new Z(`http://${e}`).hostname}catch{return``}}function domainToUnicode(e){try{return new Z(`http://${e}`).hostname}catch{return``}}var wn,Tn,Z,En,Dn=__esmMin(()=>{A(),wn=k.UriFlags.HAS_PASSWORD|k.UriFlags.ENCODED|k.UriFlags.SCHEME_NORMALIZE,Tn=class URLSearchParams{_entries=[];constructor(e){if(e)if(typeof e==`string`){let t=e.startsWith(`?`)?e.slice(1):e;if(t)for(let e of t.split(`&`)){let t=e.indexOf(`=`);t===-1?this._entries.push([decodeComponent(e),``]):this._entries.push([decodeComponent(e.slice(0,t)),decodeComponent(e.slice(t+1))])}}else if(Array.isArray(e))for(let[t,n]of e)this._entries.push([String(t),String(n)]);else if(e instanceof URLSearchParams)this._entries=e._entries.map(([e,t])=>[e,t]);else for(let t of Object.keys(e))this._entries.push([t,String(e[t])])}get(e){for(let[t,n]of this._entries)if(t===e)return n;return null}getAll(e){return this._entries.filter(([t])=>t===e).map(([,e])=>e)}set(e,t){let n=!1;if(this._entries=this._entries.filter(([t])=>t===e?n?!1:(n=!0,!0):!0),n){for(let n=0;n<this._entries.length;n++)if(this._entries[n][0]===e){this._entries[n][1]=t;break}}else this._entries.push([e,t])}has(e){return this._entries.some(([t])=>t===e)}delete(e){this._entries=this._entries.filter(([t])=>t!==e)}append(e,t){this._entries.push([e,t])}sort(){this._entries.sort((e,t)=>e[0]<t[0]?-1:+(e[0]>t[0]))}toString(){return this._entries.map(([e,t])=>encodeComponent(e)+`=`+encodeComponent(t)).join(`&`)}forEach(e){for(let[t,n]of this._entries)e(n,t,this)}*entries(){yield*this._entries}*keys(){for(let[e]of this._entries)yield e}*values(){for(let[,e]of this._entries)yield e}[Symbol.iterator](){return this.entries()}get size(){return this._entries.length}},Z=class URL{#e;#t;constructor(e,t){let n=e instanceof URL?e.href:String(e);try{if(t!==void 0){let e=t instanceof URL?t.href:String(t),r=k.Uri.parse(e,wn);this.#e=r.parse_relative(n,wn)}else this.#e=k.Uri.parse(n,wn)}catch{throw TypeError(`Invalid URL: ${n}`)}if(!this.#e)throw TypeError(`Invalid URL: ${n}`);this.#t=new Tn(this.#e.get_query()||``)}get protocol(){return this.#e.get_scheme()+`:`}get hostname(){return(this.#e.get_host()||``).toLowerCase()}get port(){let e=this.#e.get_port();if(e===-1)return``;let t=this.#e.get_scheme();return(t===`http`||t===`ws`)&&e===80||(t===`https`||t===`wss`)&&e===443||t===`ftp`&&e===21?``:String(e)}get host(){let e=this.hostname,t=this.port;return t?`${e}:${t}`:e}get pathname(){return this.#e.get_path()||`/`}get search(){let e=this.#e.get_query();return e?`?`+e:``}get hash(){let e=this.#e.get_fragment();return e?`#`+e:``}get origin(){let e=this.protocol;return e===`http:`||e===`https:`||e===`ftp:`?`${e}//${this.host}`:`null`}get username(){return this.#e.get_user()||``}get password(){return this.#e.get_password()||``}get href(){let e=this.protocol,t=this.#e.get_scheme();(t===`http`||t===`https`||t===`ftp`||t===`file`||t===`ws`||t===`wss`||this.hostname)&&(e+=`//`);let n=this.username,r=this.password;n&&(e+=n,r&&(e+=`:`+r),e+=`@`),e+=this.hostname,this.port&&(e+=`:`+this.port);let i=this.pathname;return e+=i,e+=this.search,e+=this.hash,e}get searchParams(){return this.#t}toString(){return this.href}toJSON(){return this.href}static _objectURLPaths=new Map;static _objectURLCounter=0;static createObjectURL(e){let t=e?._tmpPath;if(typeof t==`string`&&t.length>0){let e=`file://${t}`;return URL._objectURLPaths.set(e,t),e}return`file:///dev/null`}static revokeObjectURL(e){let t=URL._objectURLPaths.get(e);if(t){try{k.unlink(t)}catch{}URL._objectURLPaths.delete(e)}}},__name(parse$3,`parse`),__name(format$3,`format`),__name(resolve$2,`resolve`),En={URL:Z,URLSearchParams:Tn,parse:parse$3,format:format$3,resolve:resolve$2,fileURLToPath,pathToFileURL,domainToASCII,domainToUnicode}});Dn(),typeof globalThis.URL!=`function`&&Object.defineProperty(globalThis,"URL",{value:Z,enumerable:!1,writable:!0,configurable:!0}),typeof globalThis.URLSearchParams!=`function`&&Object.defineProperty(globalThis,"URLSearchParams",{value:Tn,enumerable:!1,writable:!0,configurable:!0});let On;if(globalThis.performance)On=globalThis.performance;else{let e,_now;try{let t=globalThis.imports?.gi?.GLib;if(!t)throw Error(`GJS imports.gi.GLib not available`);e=t.get_monotonic_time(),_now=()=>(t.get_monotonic_time()-e)/1e3}catch{let t=Date.now();e=0,_now=()=>Date.now()-t}let t=[],n=Date.now()-_now();On={timeOrigin:n,now:_now,mark(e){let n={name:e,entryType:`mark`,startTime:_now(),duration:0};return t.push(n),n},measure(e,n,r){let i=0,a=_now();if(n){let e=t.find(e=>e.entryType===`mark`&&e.name===n);e&&(i=e.startTime)}if(r){let e=t.find(e=>e.entryType===`mark`&&e.name===r);e&&(a=e.startTime)}let o={name:e,entryType:`measure`,startTime:i,duration:a-i};return t.push(o),o},getEntries(){return[...t]},getEntriesByName(e){return t.filter(t=>t.name===e)},getEntriesByType(e){return t.filter(t=>t.entryType===e)},clearMarks(e){for(let n=t.length-1;n>=0;n--)t[n].entryType===`mark`&&(!e||t[n].name===e)&&t.splice(n,1)},clearMeasures(e){for(let n=t.length-1;n>=0;n--)t[n].entryType===`measure`&&(!e||t[n].name===e)&&t.splice(n,1)},clearResourceTimings(){},setResourceTimingBufferSize(){},toJSON(){return{timeOrigin:n}}}}var PerformanceObserverStub=class{_callback;constructor(e){this._callback=e}observe(e){}disconnect(){}takeRecords(){return[]}};const kn=globalThis,An=kn.PerformanceObserver||PerformanceObserverStub;kn.PerformanceEntry,kn.PerformanceObserverEntryList,kn.PerformanceMark,kn.PerformanceMeasure;const jn=globalThis;globalThis.performance===void 0&&(jn.performance=On),typeof jn.PerformanceObserver!=`function`&&(jn.PerformanceObserver=An);const Mn=Symbol(`abort`),Nn=Symbol(`internal`);var Pn=class AbortSignal extends EventTarget{#e=!1;reason=void 0;onabort=null;constructor(e){if(super(),e!==Nn)throw TypeError(`Illegal constructor.`)}get aborted(){if(!(this instanceof AbortSignal))throw TypeError(`'get aborted' called on an object that is not a valid instance of AbortSignal.`);return this.#e}get[Symbol.toStringTag](){return`AbortSignal`}throwIfAborted(){if(this.#e)throw this.reason}[Mn](e){if(this.#e)return;this.#e=!0,this.reason=e??new Be(`The operation was aborted.`,`AbortError`);let t=new Event(`abort`);typeof this.onabort==`function`&&this.onabort.call(this,t),this.dispatchEvent(t)}static abort(e){let t=new AbortSignal(Nn);return t[Mn](e),t}static timeout(e){let t=new AbortSignal(Nn);return setTimeout(()=>{t[Mn](new Be(`The operation timed out.`,`TimeoutError`))},e),t}static any(e){let t=new AbortSignal(Nn);for(let n of e)if(n.aborted)return t[Mn](n.reason),t;let onAbort=()=>{if(!t.aborted){let n=e.find(e=>e.aborted);t[Mn](n?.reason)}};for(let t of e)t.addEventListener(`abort`,onAbort,{once:!0});return t}},Fn=class AbortController{signal;constructor(){this.signal=new Pn(Nn)}abort(e){if(!(this instanceof AbortController))throw TypeError(`'abort' called on an object that is not a valid instance of AbortController.`);this.signal[Mn](e)}};const In=globalThis;globalThis.AbortController===void 0&&(In.AbortController=Fn),globalThis.AbortSignal===void 0&&(In.AbortSignal=Pn);const Q=Symbol(`kState`),$=Symbol(`kType`);function isBrandCheck(e){return t=>typeof t==`object`&&!!t&&t[Q]!==void 0&&t[$]===e}function dequeueValue(e){let t=e[Q].queue.shift();if(t===void 0)throw Error(`dequeueValue called on an empty queue`);let{value:n,size:r}=t;return e[Q].queueTotalSize=Math.max(0,e[Q].queueTotalSize-r),n}function resetQueue(e){e[Q].queue=[],e[Q].queueTotalSize=0}function peekQueueValue(e){return e[Q].queue[0].value}function enqueueValueWithSize(e,t,n){if(n=+n,typeof n!=`number`||n<0||Number.isNaN(n)||n===1/0)throw RangeError(`Invalid size: ${n}`);e[Q].queue.push({value:t,size:n}),e[Q].queueTotalSize+=n}function extractHighWaterMark(e,t){if(e===void 0)return t;if(e=+e,typeof e!=`number`||Number.isNaN(e)||e<0)throw RangeError(`Invalid highWaterMark: ${e}`);return e}function extractSizeAlgorithm(e){if(e===void 0)return()=>1;if(typeof e!=`function`)throw TypeError(`strategy.size must be a function`);return e}function transferArrayBuffer(e){return typeof ArrayBuffer.prototype.transfer==`function`?e.transfer():e.slice(0)}function isDetachedBuffer(e){if(typeof SharedArrayBuffer<`u`&&e instanceof SharedArrayBuffer||e.byteLength!==0)return!1;try{return e.slice(0,0),!1}catch{return!0}}function typedArrayConstructorByTag(e){switch(e){case`Int8Array`:return Int8Array;case`Uint8Array`:return Uint8Array;case`Uint8ClampedArray`:return Uint8ClampedArray;case`Int16Array`:return Int16Array;case`Uint16Array`:return Uint16Array;case`Int32Array`:return Int32Array;case`Uint32Array`:return Uint32Array;case`Float32Array`:return Float32Array;case`Float64Array`:return Float64Array;case`BigInt64Array`:return typeof BigInt64Array<`u`?BigInt64Array:void 0;case`BigUint64Array`:return typeof BigUint64Array<`u`?BigUint64Array:void 0;default:return}}function elementSizeByTag(e){switch(e){case`Int8Array`:case`Uint8Array`:case`Uint8ClampedArray`:return 1;case`Int16Array`:case`Uint16Array`:return 2;case`Int32Array`:case`Uint32Array`:case`Float32Array`:return 4;case`Float64Array`:case`BigInt64Array`:case`BigUint64Array`:return 8;default:return 1}}function setPromiseHandled(e){e.then(()=>{},()=>{})}function createPromiseCallback(e,t,n){if(typeof t!=`function`)throw TypeError(`${e} must be a function`);return async(...e)=>t.call(n,...e)}async function nonOpFlush(){}function nonOpStart(){}async function nonOpPull(){}async function nonOpCancel(){}async function nonOpWrite(){}const Ln={__proto__:Object.getPrototypeOf(Object.getPrototypeOf(async function*(){}).prototype),next:void 0,return:void 0};function createAsyncFromSyncIterator(e){let t={[Symbol.iterator]:()=>e.iterator},n=(async function*(){return yield*t})();return{iterator:n,nextMethod:n.next,done:!1}}function getIterator(e,t=`sync`,n){if(n===void 0)if(t===`async`){if(n=e[Symbol.asyncIterator],n==null){let t=e[Symbol.iterator];if(t===void 0)throw TypeError(`Object is not iterable`);return createAsyncFromSyncIterator(getIterator(e,`sync`,t))}}else n=e[Symbol.iterator];if(n===void 0)throw TypeError(`Object is not iterable`);let r=n.call(e);if(typeof r!=`object`||!r)throw TypeError(`The iterator method must return an object`);return{iterator:r,nextMethod:r.next,done:!1}}function iteratorNext(e,t){let n;if(n=t===void 0?e.nextMethod.call(e.iterator):e.nextMethod.call(e.iterator,t),typeof n!=`object`||!n)throw TypeError(`The iterator.next() method must return an object`);return n}const Rn=typeof globalThis.AbortController==`function`?globalThis.AbortController:class AbortControllerShim{signal={aborted:!1,reason:void 0,addEventListener(){},removeEventListener(){}};abort(e){this.signal.aborted=!0,this.signal.reason=e}},zn=Symbol(`kAbort`),Bn=Symbol(`kCloseSentinel`),Vn=Symbol(`kError`),Hn=Symbol(`kSkipThrow`);var WritableStream=class{[$]=`WritableStream`;[Q];constructor(e={},t={}){if(e!=null&&typeof e!=`object`)throw TypeError(`sink must be an object`);if(t!=null&&typeof t!=`object`)throw TypeError(`strategy must be an object`);let n=e?.type;if(n!==void 0)throw RangeError(`Invalid type: ${n}`);this[Q]=createWritableStreamState();let r=extractSizeAlgorithm(t?.size),i=extractHighWaterMark(t?.highWaterMark,1);setupWritableStreamDefaultControllerFromSink(this,e,i,r)}get locked(){if(!Un(this))throw TypeError(`Invalid this`);return isWritableStreamLocked(this)}abort(e){return Un(this)?isWritableStreamLocked(this)?Promise.reject(TypeError(`WritableStream is locked`)):writableStreamAbort(this,e):Promise.reject(TypeError(`Invalid this`))}close(){return Un(this)?isWritableStreamLocked(this)?Promise.reject(TypeError(`WritableStream is locked`)):writableStreamCloseQueuedOrInFlight(this)?Promise.reject(TypeError(`Failure closing WritableStream`)):writableStreamClose(this):Promise.reject(TypeError(`Invalid this`))}getWriter(){if(!Un(this))throw TypeError(`Invalid this`);return new WritableStreamDefaultWriter(this)}get[Symbol.toStringTag](){return`WritableStream`}},WritableStreamDefaultWriter=class{[$]=`WritableStreamDefaultWriter`;[Q];constructor(e){if(!Un(e))throw TypeError(`Expected a WritableStream`);this[Q]={stream:void 0,close:{promise:void 0,resolve:void 0,reject:void 0},ready:{promise:void 0,resolve:void 0,reject:void 0}},setupWritableStreamDefaultWriter(this,e)}get closed(){return Wn(this)?this[Q].close.promise:Promise.reject(TypeError(`Invalid this`))}get desiredSize(){if(!Wn(this))throw TypeError(`Invalid this`);if(this[Q].stream===void 0)throw TypeError(`Writer is not bound to a WritableStream`);return writableStreamDefaultWriterGetDesiredSize(this)}get ready(){return Wn(this)?this[Q].ready.promise:Promise.reject(TypeError(`Invalid this`))}abort(e){return Wn(this)?this[Q].stream===void 0?Promise.reject(TypeError(`Writer is not bound to a WritableStream`)):writableStreamDefaultWriterAbort(this,e):Promise.reject(TypeError(`Invalid this`))}close(){if(!Wn(this))return Promise.reject(TypeError(`Invalid this`));let{stream:e}=this[Q];return e===void 0?Promise.reject(TypeError(`Writer is not bound to a WritableStream`)):writableStreamCloseQueuedOrInFlight(e)?Promise.reject(TypeError(`Failure to close WritableStream`)):writableStreamDefaultWriterClose(this)}releaseLock(){if(!Wn(this))throw TypeError(`Invalid this`);let{stream:e}=this[Q];e!==void 0&&writableStreamDefaultWriterRelease(this)}write(e){return Wn(this)?this[Q].stream===void 0?Promise.reject(TypeError(`Writer is not bound to a WritableStream`)):writableStreamDefaultWriterWrite(this,e):Promise.reject(TypeError(`Invalid this`))}get[Symbol.toStringTag](){return`WritableStreamDefaultWriter`}},WritableStreamDefaultController=class{[$]=`WritableStreamDefaultController`;[Q];constructor(e){if(e!==Hn)throw TypeError(`Illegal constructor`)}[zn](e){let t=this[Q].abortAlgorithm(e);return writableStreamDefaultControllerClearAlgorithms(this),t}[Vn](){resetQueue(this)}get signal(){if(!Gn(this))throw TypeError(`Invalid this`);return this[Q].abortController.signal}error(e){if(!Gn(this))throw TypeError(`Invalid this`);this[Q].stream[Q].state===`writable`&&writableStreamDefaultControllerError(this,e)}get[Symbol.toStringTag](){return`WritableStreamDefaultController`}};const Un=isBrandCheck(`WritableStream`),Wn=isBrandCheck(`WritableStreamDefaultWriter`),Gn=isBrandCheck(`WritableStreamDefaultController`);function createEmptyPromiseRecord(){return{promise:void 0,resolve:void 0,reject:void 0}}function createWritableStreamState(){return{close:Promise.withResolvers(),closeRequest:createEmptyPromiseRecord(),inFlightWriteRequest:createEmptyPromiseRecord(),inFlightCloseRequest:createEmptyPromiseRecord(),pendingAbortRequest:{abort:createEmptyPromiseRecord(),reason:void 0,wasAlreadyErroring:!1},backpressure:!1,controller:void 0,state:`writable`,storedError:void 0,writeRequests:[],writer:void 0}}function isWritableStreamLocked(e){return e[Q].writer!==void 0}function setupWritableStreamDefaultWriter(e,t){if(isWritableStreamLocked(t))throw TypeError(`WritableStream is locked`);switch(e[Q].stream=t,t[Q].writer=e,t[Q].state){case`writable`:!writableStreamCloseQueuedOrInFlight(t)&&t[Q].backpressure?e[Q].ready=Promise.withResolvers():e[Q].ready={promise:Promise.resolve(),resolve:void 0,reject:void 0},e[Q].close=Promise.withResolvers();break;case`erroring`:e[Q].ready={promise:Promise.reject(t[Q].storedError),resolve:void 0,reject:void 0},setPromiseHandled(e[Q].ready.promise),e[Q].close=Promise.withResolvers();break;case`closed`:e[Q].ready={promise:Promise.resolve(),resolve:void 0,reject:void 0},e[Q].close={promise:Promise.resolve(),resolve:void 0,reject:void 0};break;default:e[Q].ready={promise:Promise.reject(t[Q].storedError),resolve:void 0,reject:void 0},e[Q].close={promise:Promise.reject(t[Q].storedError),resolve:void 0,reject:void 0},setPromiseHandled(e[Q].ready.promise),setPromiseHandled(e[Q].close.promise)}}function writableStreamAbort(e,t){let{state:n,controller:r}=e[Q];if(n===`closed`||n===`errored`)return Promise.resolve();if(r[Q].abortController.abort(t),e[Q].pendingAbortRequest.abort.promise!==void 0)return e[Q].pendingAbortRequest.abort.promise;let i=!1;n===`erroring`&&(i=!0,t=void 0);let a=Promise.withResolvers();return e[Q].pendingAbortRequest={abort:a,reason:t,wasAlreadyErroring:i},i||writableStreamStartErroring(e,t),a.promise}function writableStreamClose(e){let{state:t,writer:n,backpressure:r,controller:i}=e[Q];if(t===`closed`||t===`errored`)return Promise.reject(TypeError(`WritableStream is closed`));e[Q].closeRequest=Promise.withResolvers();let{promise:a}=e[Q].closeRequest;return n!==void 0&&r&&t===`writable`&&n[Q].ready.resolve?.(),writableStreamDefaultControllerClose(i),a}function writableStreamUpdateBackpressure(e,t){let{writer:n}=e[Q];n!==void 0&&e[Q].backpressure!==t&&(t?n[Q].ready=Promise.withResolvers():n[Q].ready.resolve?.()),e[Q].backpressure=t}function writableStreamStartErroring(e,t){let{controller:n,writer:r}=e[Q];e[Q].state=`erroring`,e[Q].storedError=t,r!==void 0&&writableStreamDefaultWriterEnsureReadyPromiseRejected(r,t),!writableStreamHasOperationMarkedInFlight(e)&&n[Q].started&&writableStreamFinishErroring(e)}function writableStreamRejectCloseAndClosedPromiseIfNeeded(e){e[Q].closeRequest.promise!==void 0&&(e[Q].closeRequest.reject?.(e[Q].storedError),e[Q].closeRequest={promise:void 0,resolve:void 0,reject:void 0}),setPromiseHandled(e[Q].close.promise),e[Q].close.reject?.(e[Q].storedError);let{writer:t}=e[Q];t!==void 0&&(setPromiseHandled(t[Q].close.promise),t[Q].close.reject?.(e[Q].storedError))}function writableStreamMarkFirstWriteRequestInFlight(e){let t=e[Q].writeRequests.shift();e[Q].inFlightWriteRequest=t}function writableStreamMarkCloseRequestInFlight(e){e[Q].inFlightCloseRequest=e[Q].closeRequest,e[Q].closeRequest={promise:void 0,resolve:void 0,reject:void 0}}function writableStreamHasOperationMarkedInFlight(e){return e[Q].inFlightWriteRequest.promise!==void 0||e[Q].inFlightCloseRequest.promise!==void 0}function writableStreamFinishInFlightWriteWithError(e,t){e[Q].inFlightWriteRequest.reject?.(t),e[Q].inFlightWriteRequest={promise:void 0,resolve:void 0,reject:void 0},writableStreamDealWithRejection(e,t)}function writableStreamFinishInFlightWrite(e){e[Q].inFlightWriteRequest.resolve?.(),e[Q].inFlightWriteRequest={promise:void 0,resolve:void 0,reject:void 0}}function writableStreamFinishInFlightCloseWithError(e,t){e[Q].inFlightCloseRequest.reject?.(t),e[Q].inFlightCloseRequest={promise:void 0,resolve:void 0,reject:void 0},e[Q].pendingAbortRequest.abort.promise!==void 0&&(e[Q].pendingAbortRequest.abort.reject?.(t),e[Q].pendingAbortRequest={abort:{promise:void 0,resolve:void 0,reject:void 0},reason:void 0,wasAlreadyErroring:!1}),writableStreamDealWithRejection(e,t)}function writableStreamFinishInFlightClose(e){e[Q].inFlightCloseRequest.resolve?.(),e[Q].inFlightCloseRequest={promise:void 0,resolve:void 0,reject:void 0},e[Q].state===`erroring`&&(e[Q].storedError=void 0,e[Q].pendingAbortRequest.abort.promise!==void 0&&(e[Q].pendingAbortRequest.abort.resolve?.(),e[Q].pendingAbortRequest={abort:{promise:void 0,resolve:void 0,reject:void 0},reason:void 0,wasAlreadyErroring:!1})),e[Q].state=`closed`,e[Q].writer!==void 0&&e[Q].writer[Q].close.resolve?.(),e[Q].close.resolve?.()}function writableStreamFinishErroring(e){e[Q].state=`errored`,e[Q].controller[Vn]();let t=e[Q].storedError;for(let n of e[Q].writeRequests)n.reject?.(t);if(e[Q].writeRequests=[],e[Q].pendingAbortRequest.abort.promise===void 0){writableStreamRejectCloseAndClosedPromiseIfNeeded(e);return}let n=e[Q].pendingAbortRequest;if(e[Q].pendingAbortRequest={abort:{promise:void 0,resolve:void 0,reject:void 0},reason:void 0,wasAlreadyErroring:!1},n.wasAlreadyErroring){n.abort.reject?.(t),writableStreamRejectCloseAndClosedPromiseIfNeeded(e);return}e[Q].controller[zn](n.reason).then(()=>{n.abort.resolve?.(),writableStreamRejectCloseAndClosedPromiseIfNeeded(e)},t=>{n.abort.reject?.(t),writableStreamRejectCloseAndClosedPromiseIfNeeded(e)})}function writableStreamDealWithRejection(e,t){if(e[Q].state===`writable`){writableStreamStartErroring(e,t);return}writableStreamFinishErroring(e)}function writableStreamCloseQueuedOrInFlight(e){return e[Q].closeRequest.promise!==void 0||e[Q].inFlightCloseRequest.promise!==void 0}function writableStreamAddWriteRequest(e){let{promise:t,resolve:n,reject:r}=Promise.withResolvers();return e[Q].writeRequests.push({promise:t,resolve:n,reject:r}),t}function writableStreamDefaultWriterWrite(e,t){let{stream:n}=e[Q],{controller:r}=n[Q],i=writableStreamDefaultControllerGetChunkSize(r,t);if(n!==e[Q].stream)return Promise.reject(TypeError(`Mismatched WritableStreams`));let{state:a}=n[Q];if(a===`errored`)return Promise.reject(n[Q].storedError);if(writableStreamCloseQueuedOrInFlight(n)||a===`closed`)return Promise.reject(TypeError(`WritableStream is closed`));if(a===`erroring`)return Promise.reject(n[Q].storedError);let o=writableStreamAddWriteRequest(n);return writableStreamDefaultControllerWrite(r,t,i),o}function writableStreamDefaultWriterRelease(e){let{stream:t}=e[Q],n=TypeError(`Writer has been released`);writableStreamDefaultWriterEnsureReadyPromiseRejected(e,n),writableStreamDefaultWriterEnsureClosedPromiseRejected(e,n),t[Q].writer=void 0,e[Q].stream=void 0}function writableStreamDefaultWriterGetDesiredSize(e){let{stream:t}=e[Q];switch(t[Q].state){case`errored`:case`erroring`:return null;case`closed`:return 0}return writableStreamDefaultControllerGetDesiredSize(t[Q].controller)}function writableStreamDefaultWriterEnsureReadyPromiseRejected(e,t){e[Q].ready.reject?(e[Q].ready.reject(t),e[Q].ready.resolve=void 0,e[Q].ready.reject=void 0):e[Q].ready={promise:Promise.reject(t),resolve:void 0,reject:void 0},setPromiseHandled(e[Q].ready.promise)}function writableStreamDefaultWriterEnsureClosedPromiseRejected(e,t){e[Q].close.reject?(e[Q].close.reject(t),e[Q].close.resolve=void 0,e[Q].close.reject=void 0):e[Q].close={promise:Promise.reject(t),resolve:void 0,reject:void 0},setPromiseHandled(e[Q].close.promise)}function writableStreamDefaultWriterCloseWithErrorPropagation(e){let{stream:t}=e[Q],{state:n}=t[Q];return writableStreamCloseQueuedOrInFlight(t)||n===`closed`?Promise.resolve():n===`errored`?Promise.reject(t[Q].storedError):writableStreamDefaultWriterClose(e)}function writableStreamDefaultWriterClose(e){return writableStreamClose(e[Q].stream)}function writableStreamDefaultWriterAbort(e,t){return writableStreamAbort(e[Q].stream,t)}function writableStreamDefaultControllerWrite(e,t,n){try{enqueueValueWithSize(e,t,n)}catch(t){writableStreamDefaultControllerErrorIfNeeded(e,t);return}let{stream:r}=e[Q];!writableStreamCloseQueuedOrInFlight(r)&&r[Q].state===`writable`&&writableStreamUpdateBackpressure(r,writableStreamDefaultControllerGetBackpressure(e)),writableStreamDefaultControllerAdvanceQueueIfNeeded(e)}function writableStreamDefaultControllerProcessWrite(e,t){let{stream:n,writeAlgorithm:r}=e[Q];writableStreamMarkFirstWriteRequestInFlight(n),r(t,e).then(()=>{writableStreamFinishInFlightWrite(n);let{state:t}=n[Q];dequeueValue(e),!writableStreamCloseQueuedOrInFlight(n)&&t===`writable`&&writableStreamUpdateBackpressure(n,writableStreamDefaultControllerGetBackpressure(e)),writableStreamDefaultControllerAdvanceQueueIfNeeded(e)},t=>{n[Q].state===`writable`&&writableStreamDefaultControllerClearAlgorithms(e),writableStreamFinishInFlightWriteWithError(n,t)})}function writableStreamDefaultControllerProcessClose(e){let{closeAlgorithm:t,stream:n}=e[Q];writableStreamMarkCloseRequestInFlight(n),dequeueValue(e);let r=t();writableStreamDefaultControllerClearAlgorithms(e),r.then(()=>writableStreamFinishInFlightClose(n),e=>writableStreamFinishInFlightCloseWithError(n,e))}function writableStreamDefaultControllerGetDesiredSize(e){return e[Q].highWaterMark-e[Q].queueTotalSize}function writableStreamDefaultControllerGetChunkSize(e,t){let{sizeAlgorithm:n}=e[Q];if(n===void 0)return 1;try{return n(t)}catch(t){return writableStreamDefaultControllerErrorIfNeeded(e,t),1}}function writableStreamDefaultControllerErrorIfNeeded(e,t){e[Q].stream[Q].state===`writable`&&writableStreamDefaultControllerError(e,t)}function writableStreamDefaultControllerError(e,t){writableStreamDefaultControllerClearAlgorithms(e),writableStreamStartErroring(e[Q].stream,t)}function writableStreamDefaultControllerClose(e){enqueueValueWithSize(e,Bn,0),writableStreamDefaultControllerAdvanceQueueIfNeeded(e)}function writableStreamDefaultControllerClearAlgorithms(e){e[Q].writeAlgorithm=void 0,e[Q].closeAlgorithm=void 0,e[Q].abortAlgorithm=void 0,e[Q].sizeAlgorithm=void 0}function writableStreamDefaultControllerGetBackpressure(e){return writableStreamDefaultControllerGetDesiredSize(e)<=0}function writableStreamDefaultControllerAdvanceQueueIfNeeded(e){let{queue:t,started:n,stream:r}=e[Q];if(!n||r[Q].inFlightWriteRequest.promise!==void 0)return;if(r[Q].state===`erroring`){writableStreamFinishErroring(r);return}if(!t.length)return;let i=peekQueueValue(e);i===Bn?writableStreamDefaultControllerProcessClose(e):writableStreamDefaultControllerProcessWrite(e,i)}function setupWritableStreamDefaultControllerFromSink(e,t,n,r){let i=new WritableStreamDefaultController(Hn),a=t?.start,o=t?.write,s=t?.close,c=t?.abort;setupWritableStreamDefaultController(e,i,a?a.bind(t,i):nonOpStart,o?createPromiseCallback(`sink.write`,o,t):nonOpWrite,s?createPromiseCallback(`sink.close`,s,t):nonOpCancel,c?createPromiseCallback(`sink.abort`,c,t):nonOpCancel,n,r)}function setupWritableStreamDefaultController(e,t,n,r,i,a,o,s){t[Q]={abortAlgorithm:a,closeAlgorithm:i,highWaterMark:o,queue:[],queueTotalSize:0,abortController:new Rn,sizeAlgorithm:s,started:!1,stream:e,writeAlgorithm:r},e[Q].controller=t,writableStreamUpdateBackpressure(e,writableStreamDefaultControllerGetBackpressure(t));let c=n();new Promise(e=>e(c)).then(()=>{t[Q].started=!0,writableStreamDefaultControllerAdvanceQueueIfNeeded(t)},n=>{t[Q].started=!0,writableStreamDealWithRejection(e,n)})}function createWritableStream(e,t,n,r,i=1,a=()=>1){let o=Object.create(WritableStream.prototype);return o[$]=`WritableStream`,o[Q]=createWritableStreamState(),setupWritableStreamDefaultController(o,new WritableStreamDefaultController(Hn),e,t,n,r,i,a),o}L();const Kn=Symbol(`kCancel`),qn=Symbol(`kClose`),Jn=Symbol(`kChunk`),Yn=Symbol(`kError`),Xn=Symbol(`kPull`),Zn=Symbol(`kRelease`),Qn=Symbol(`kSkipThrow`);let $n,er;function lazyReadableReleasedError(){return $n||($n=TypeError(`Reader released`),$n)}function lazyReadableReleasingError(){return er||(er=TypeError(`Releasing reader`),er)}function createAbortError(){if(typeof globalThis.DOMException==`function`)return new DOMException(`The operation was aborted`,`AbortError`);let e=Error(`The operation was aborted`);return e.name=`AbortError`,e}function createReadableStreamState(){return{disturbed:!1,reader:void 0,state:`readable`,storedError:void 0,controller:void 0,closedPromise:Promise.withResolvers()}}var ReadableStream$1=class{static{__name(this,`ReadableStream`)}[$]=`ReadableStream`;[Q];constructor(e={},t={}){if(e!=null&&typeof e!=`object`)throw TypeError(`source must be an object`);if(t!=null&&typeof t!=`object`)throw TypeError(`strategy must be an object`);this[Q]=createReadableStreamState();let n=t?.size,r=t?.highWaterMark,i=e?.type;if(i!==void 0){if(`${i}`==`bytes`){if(n!==void 0)throw RangeError(`strategy.size must not be set for a byte stream`);setupReadableByteStreamControllerFromSource(this,e,extractHighWaterMark(r,0));return}throw RangeError(`Invalid type: ${i}`)}setupReadableStreamDefaultControllerFromSource(this,e,extractHighWaterMark(r,1),extractSizeAlgorithm(n))}get locked(){if(!tr(this))throw TypeError(`Invalid this`);return isReadableStreamLocked(this)}static from(e){return readableStreamFromIterable(e)}cancel(e=void 0){return tr(this)?isReadableStreamLocked(this)?Promise.reject(TypeError(`ReadableStream is locked`)):readableStreamCancel(this,e):Promise.reject(TypeError(`Invalid this`))}getReader(e={}){if(!tr(this))throw TypeError(`Invalid this`);if(e!=null&&typeof e!=`object`)throw TypeError(`options must be an object`);let t=e?.mode;if(t===void 0)return new ReadableStreamDefaultReader(this);if(`${t}`==`byob`)return new ReadableStreamBYOBReader(this);throw RangeError(`Invalid mode: ${t}`)}pipeThrough(e,t={}){if(!tr(this))throw TypeError(`Invalid this`);let n=e?.readable;if(!tr(n))throw TypeError(`transform.readable must be a ReadableStream`);let r=e?.writable;if(!Un(r))throw TypeError(`transform.writable must be a WritableStream`);if(t!=null&&typeof t!=`object`)throw TypeError(`options must be an object`);let i=t?.preventAbort,a=t?.preventCancel,o=t?.preventClose,s=t?.signal;if(s!==void 0&&!(s instanceof Object&&`aborted`in s))throw TypeError(`options.signal must be an AbortSignal`);if(isReadableStreamLocked(this))throw TypeError(`The ReadableStream is locked`);if(isWritableStreamLocked(r))throw TypeError(`The WritableStream is locked`);return setPromiseHandled(readableStreamPipeTo(this,r,!!o,!!i,!!a,s)),n}pipeTo(e,t={}){try{if(!tr(this))throw TypeError(`Invalid this`);if(!Un(e))throw TypeError(`destination must be a WritableStream`);if(t!=null&&typeof t!=`object`)throw TypeError(`options must be an object`);let n=t?.preventAbort,r=t?.preventCancel,i=t?.preventClose,a=t?.signal;if(a!==void 0&&!(a instanceof Object&&`aborted`in a))throw TypeError(`options.signal must be an AbortSignal`);if(isReadableStreamLocked(this))throw TypeError(`The ReadableStream is locked`);if(isWritableStreamLocked(e))throw TypeError(`The WritableStream is locked`);return readableStreamPipeTo(this,e,!!i,!!n,!!r,a)}catch(e){return Promise.reject(e)}}tee(){if(!tr(this))throw TypeError(`Invalid this`);let e=this[Q].controller;return ir(e)?readableByteStreamTee(this):readableStreamDefaultTee(this,!1)}values(e={}){if(!tr(this))throw TypeError(`Invalid this`);if(e!=null&&typeof e!=`object`)throw TypeError(`options must be an object`);let t=!!e?.preventCancel,n=new ReadableStreamDefaultReader(this),r={done:!1,current:void 0},i=!1;function nextSteps(){if(r.done)return Promise.resolve({done:!0,value:void 0});if(n[Q].stream===void 0)return Promise.reject(TypeError(`The reader is not bound to a ReadableStream`));let{promise:e,resolve:t,reject:i}=Promise.withResolvers();return readableStreamDefaultReaderRead(n,{[Jn](e){r.current=void 0,t({value:e,done:!1})},[qn](){r.current=void 0,r.done=!0,readableStreamReaderGenericRelease(n),t({done:!0,value:void 0})},[Yn](e){r.current=void 0,r.done=!0,readableStreamReaderGenericRelease(n),i(e)}}),e}async function returnSteps(e){if(r.done)return{done:!0,value:e};if(r.done=!0,n[Q].stream===void 0)throw TypeError(`The reader is not bound to a ReadableStream`);if(!t){let t=readableStreamReaderGenericCancel(n,e);return readableStreamReaderGenericRelease(n),await t,{done:!0,value:e}}return readableStreamReaderGenericRelease(n),{done:!0,value:e}}return Object.setPrototypeOf({next(){return i||=(r.current=Promise.resolve(),!0),r.current=r.current===void 0?nextSteps():r.current.then(nextSteps,nextSteps),r.current},return(e){return i=!0,r.current=r.current===void 0?returnSteps(e):r.current.then(()=>returnSteps(e),()=>returnSteps(e)),r.current},[Symbol.asyncIterator](){return this}},Ln)}[Symbol.asyncIterator](){return this.values()}get[Symbol.toStringTag](){return`ReadableStream`}},DefaultReadRequest=class{[Q];constructor(){this[Q]=Promise.withResolvers()}[Jn](e){this[Q].resolve?.({value:e,done:!1})}[qn](){this[Q].resolve?.({value:void 0,done:!0})}[Yn](e){this[Q].reject?.(e)}get promise(){return this[Q].promise}},ReadableStreamDefaultReader=class{[$]=`ReadableStreamDefaultReader`;[Q];constructor(e){if(!tr(e))throw TypeError(`Expected a ReadableStream`);this[Q]={readRequests:[],readIntoRequests:[],stream:void 0,close:{promise:void 0,resolve:void 0,reject:void 0}},setupReadableStreamDefaultReader(this,e)}read(){if(!rr(this))return Promise.reject(TypeError(`Invalid this`));if(this[Q].stream===void 0)return Promise.reject(TypeError(`The reader is not attached to a stream`));let e=this[Q].stream,t=e[Q].controller;if(e[Q].state===`readable`&&nr(t)&&t[Q].queue.length>0){e[Q].disturbed=!0;let n=dequeueValue(t);return t[Q].closeRequested&&!t[Q].queue.length?(readableStreamDefaultControllerClearAlgorithms(t),readableStreamClose(e)):readableStreamDefaultControllerCallPullIfNeeded(t),Promise.resolve({value:n,done:!1})}let n=new DefaultReadRequest;return readableStreamDefaultReaderRead(this,n),n.promise}releaseLock(){if(!rr(this))throw TypeError(`Invalid this`);this[Q].stream!==void 0&&readableStreamDefaultReaderRelease(this)}get closed(){return rr(this)?this[Q].close.promise:Promise.reject(TypeError(`Invalid this`))}cancel(e=void 0){return rr(this)?this[Q].stream===void 0?Promise.reject(TypeError(`The reader is not attached to a stream`)):readableStreamReaderGenericCancel(this,e):Promise.reject(TypeError(`Invalid this`))}get[Symbol.toStringTag](){return`ReadableStreamDefaultReader`}},ReadableStreamDefaultController=class{[$]=`ReadableStreamDefaultController`;[Q];constructor(e){if(e!==Qn)throw TypeError(`Illegal constructor`)}get desiredSize(){return readableStreamDefaultControllerGetDesiredSize(this)}close(){if(!readableStreamDefaultControllerCanCloseOrEnqueue(this))throw TypeError(`Controller is already closed`);readableStreamDefaultControllerClose(this)}enqueue(e=void 0){if(!readableStreamDefaultControllerCanCloseOrEnqueue(this))throw TypeError(`Controller is already closed`);readableStreamDefaultControllerEnqueue(this,e)}error(e=void 0){readableStreamDefaultControllerError(this,e)}[Kn](e){return readableStreamDefaultControllerCancelSteps(this,e)}[Xn](e){readableStreamDefaultControllerPullSteps(this,e)}[Zn](){}get[Symbol.toStringTag](){return`ReadableStreamDefaultController`}};const tr=isBrandCheck(`ReadableStream`),nr=isBrandCheck(`ReadableStreamDefaultController`),rr=isBrandCheck(`ReadableStreamDefaultReader`);function isReadableStreamLocked(e){return e[Q].reader!==void 0}function readableStreamCancel(e,t){switch(e[Q].disturbed=!0,e[Q].state){case`closed`:return Promise.resolve();case`errored`:return Promise.reject(e[Q].storedError)}readableStreamClose(e);let n=e[Q].reader;if(n!==void 0&&readableStreamHasBYOBReader(e)){let e=n[Q].readIntoRequests;n[Q].readIntoRequests=[];for(let t=0;t<e.length;t++)e[t][qn](void 0)}return e[Q].controller[Kn](t).then(()=>{})}function readableStreamClose(e){e[Q].state=`closed`,e[Q].closedPromise.resolve();let{reader:t}=e[Q];if(t!==void 0&&(t[Q].close.resolve?.(),readableStreamHasDefaultReader(e))){for(let e=0;e<t[Q].readRequests.length;e++)t[Q].readRequests[e][qn]();t[Q].readRequests=[]}}function readableStreamError(e,t){e[Q].state=`errored`,e[Q].storedError=t,setPromiseHandled(e[Q].closedPromise.promise),e[Q].closedPromise.reject(t);let{reader:n}=e[Q];if(n!==void 0){if(setPromiseHandled(n[Q].close.promise),n[Q].close.reject?.(t),readableStreamHasDefaultReader(e)){for(let e=0;e<n[Q].readRequests.length;e++)n[Q].readRequests[e][Yn](t);n[Q].readRequests=[]}else if(readableStreamHasBYOBReader(e)){for(let e=0;e<n[Q].readIntoRequests.length;e++)n[Q].readIntoRequests[e][Yn](t);n[Q].readIntoRequests=[]}}}function readableStreamHasDefaultReader(e){let{reader:t}=e[Q];return t===void 0?!1:t[Q]!==void 0&&t[$]===`ReadableStreamDefaultReader`}function readableStreamGetNumReadRequests(e){return e[Q].reader[Q].readRequests.length}function readableStreamFulfillReadRequest(e,t,n){let{reader:r}=e[Q],i=r[Q].readRequests.shift();n?i[qn]():i[Jn](t)}function readableStreamAddReadRequest(e,t){e[Q].reader[Q].readRequests.push(t)}function readableStreamReaderGenericCancel(e,t){let{stream:n}=e[Q];return readableStreamCancel(n,t)}function readableStreamReaderGenericInitialize(e,t){switch(e[Q].stream=t,t[Q].reader=e,t[Q].state){case`readable`:e[Q].close=Promise.withResolvers();break;case`closed`:e[Q].close={promise:Promise.resolve(),resolve:void 0,reject:void 0};break;case`errored`:e[Q].close={promise:Promise.reject(t[Q].storedError),resolve:void 0,reject:void 0},setPromiseHandled(e[Q].close.promise);break}}function readableStreamReaderGenericRelease(e){let{stream:t}=e[Q],n=lazyReadableReleasedError();t[Q].state===`readable`?e[Q].close.reject?.(n):e[Q].close={promise:Promise.reject(n),resolve:void 0,reject:void 0},setPromiseHandled(e[Q].close.promise),t[Q].controller[Zn](),t[Q].reader=void 0,e[Q].stream=void 0}function readableStreamDefaultReaderRelease(e){readableStreamReaderGenericRelease(e),readableStreamDefaultReaderErrorReadRequests(e,lazyReadableReleasingError())}function readableStreamDefaultReaderErrorReadRequests(e,t){for(let n=0;n<e[Q].readRequests.length;++n)e[Q].readRequests[n][Yn](t);e[Q].readRequests=[]}function readableStreamDefaultReaderRead(e,t){let{stream:n}=e[Q];switch(n[Q].disturbed=!0,n[Q].state){case`closed`:t[qn]();break;case`errored`:t[Yn](n[Q].storedError);break;case`readable`:n[Q].controller[Xn](t);break}}function setupReadableStreamDefaultReader(e,t){if(isReadableStreamLocked(t))throw TypeError(`ReadableStream is locked`);readableStreamReaderGenericInitialize(e,t),e[Q].readRequests=[]}function readableStreamDefaultControllerClose(e){readableStreamDefaultControllerCanCloseOrEnqueue(e)&&(e[Q].closeRequested=!0,e[Q].queue.length||(readableStreamDefaultControllerClearAlgorithms(e),readableStreamClose(e[Q].stream)))}function readableStreamDefaultControllerEnqueue(e,t){if(!readableStreamDefaultControllerCanCloseOrEnqueue(e))return;let{stream:n}=e[Q];if(isReadableStreamLocked(n)&&readableStreamGetNumReadRequests(n))readableStreamFulfillReadRequest(n,t,!1);else try{enqueueValueWithSize(e,t,e[Q].sizeAlgorithm(t))}catch(t){throw readableStreamDefaultControllerError(e,t),t}readableStreamDefaultControllerCallPullIfNeeded(e)}function readableStreamDefaultControllerCanCloseOrEnqueue(e){let{stream:t}=e[Q];return!e[Q].closeRequested&&t[Q].state===`readable`}function readableStreamDefaultControllerGetDesiredSize(e){let{stream:t,highWaterMark:n,queueTotalSize:r}=e[Q];switch(t[Q].state){case`errored`:return null;case`closed`:return 0;default:return n-r}}function readableStreamDefaultControllerHasBackpressure(e){return!readableStreamDefaultControllerShouldCallPull(e)}function readableStreamDefaultControllerShouldCallPull(e){let{stream:t}=e[Q];if(!readableStreamDefaultControllerCanCloseOrEnqueue(e)||!e[Q].started)return!1;if(isReadableStreamLocked(t)&&readableStreamGetNumReadRequests(t))return!0;let n=readableStreamDefaultControllerGetDesiredSize(e);return n!==null&&n>0}function readableStreamDefaultControllerCallPullIfNeeded(e){if(readableStreamDefaultControllerShouldCallPull(e)){if(e[Q].pulling){e[Q].pullAgain=!0;return}e[Q].pulling=!0,e[Q].pullAlgorithm(e).then(()=>{e[Q].pulling=!1,e[Q].pullAgain&&(e[Q].pullAgain=!1,readableStreamDefaultControllerCallPullIfNeeded(e))},t=>readableStreamDefaultControllerError(e,t))}}function readableStreamDefaultControllerClearAlgorithms(e){e[Q].pullAlgorithm=void 0,e[Q].cancelAlgorithm=void 0,e[Q].sizeAlgorithm=void 0}function readableStreamDefaultControllerError(e,t){let{stream:n}=e[Q];n[Q].state===`readable`&&(resetQueue(e),readableStreamDefaultControllerClearAlgorithms(e),readableStreamError(n,t))}function readableStreamDefaultControllerCancelSteps(e,t){resetQueue(e);let n=e[Q].cancelAlgorithm?.(t)??Promise.resolve();return readableStreamDefaultControllerClearAlgorithms(e),n}function readableStreamDefaultControllerPullSteps(e,t){let{stream:n,queue:r}=e[Q];if(r.length){let i=dequeueValue(e);e[Q].closeRequested&&!r.length?(readableStreamDefaultControllerClearAlgorithms(e),readableStreamClose(n)):readableStreamDefaultControllerCallPullIfNeeded(e),t[Jn](i);return}readableStreamAddReadRequest(n,t),readableStreamDefaultControllerCallPullIfNeeded(e)}function setupReadableStreamDefaultController(e,t,n,r,i,a,o){t[Q]={cancelAlgorithm:i,closeRequested:!1,highWaterMark:a,pullAgain:!1,pullAlgorithm:r,pulling:!1,queue:[],queueTotalSize:0,started:!1,sizeAlgorithm:o,stream:e},e[Q].controller=t;let s=n();new Promise(e=>e(s)).then(()=>{t[Q].started=!0,readableStreamDefaultControllerCallPullIfNeeded(t)},e=>readableStreamDefaultControllerError(t,e))}function setupReadableStreamDefaultControllerFromSource(e,t,n,r){let i=new ReadableStreamDefaultController(Qn),a=t?.start,o=t?.pull,s=t?.cancel;setupReadableStreamDefaultController(e,i,a?a.bind(t,i):nonOpStart,o?createPromiseCallback(`source.pull`,o,t):nonOpPull,s?createPromiseCallback(`source.cancel`,s,t):nonOpCancel,n,r)}function createReadableStream(e,t,n,r=1,i=()=>1){let a=Object.create(ReadableStream$1.prototype);return a[$]=`ReadableStream`,a[Q]=createReadableStreamState(),setupReadableStreamDefaultController(a,new ReadableStreamDefaultController(Qn),e,t,n,r,i),a}function readableStreamFromIterable(e){let t,n=getIterator(e,`async`),r=nonOpStart;async function pullAlgorithm(){let e=iteratorNext(n);return Promise.resolve(e).then(e=>{if(typeof e!=`object`||!e)throw TypeError(`The promise returned by the iterator.next() method must fulfill with an object`);e.done?readableStreamDefaultControllerClose(t[Q].controller):readableStreamDefaultControllerEnqueue(t[Q].controller,e.value)})}async function cancelAlgorithm(e){let t=n.iterator,r=t.return;if(r===void 0)return Promise.resolve();let i=r.call(t,e);return Promise.resolve(i).then(e=>{if(typeof e!=`object`||!e)throw TypeError(`The promise returned by the iterator.return() method must fulfill with an object`)})}return t=createReadableStream(r,pullAlgorithm,cancelAlgorithm,0),t}function readableStreamPipeTo(e,t,n,r,i,a){let o,s;try{o=new ReadableStreamDefaultReader(e),s=new WritableStreamDefaultWriter(t)}catch(e){return Promise.reject(e)}e[Q].disturbed=!0;let c=!1,{promise:l,resolve:u,reject:d}=Promise.withResolvers(),p={currentWrite:Promise.resolve()},m;function finalize(e,t){writableStreamDefaultWriterRelease(s),readableStreamReaderGenericRelease(o),a!==void 0&&m&&(a.removeEventListener(`abort`,m),m=void 0),e?d(t):u()}async function waitForCurrentWrite(){let e=p.currentWrite;await e,e!==p.currentWrite&&await waitForCurrentWrite()}function shutdownWithAnAction(e,n,r){if(c)return;if(c=!0,t[Q].state===`writable`&&!writableStreamCloseQueuedOrInFlight(t)){waitForCurrentWrite().then(complete,e=>finalize(!0,e));return}complete();function complete(){e().then(()=>finalize(!!n,r),e=>finalize(!0,e))}}function shutdown(e,n){if(!c){if(c=!0,t[Q].state===`writable`&&!writableStreamCloseQueuedOrInFlight(t)){waitForCurrentWrite().then(()=>finalize(!!e,n),e=>finalize(!0,e));return}finalize(!!e,n)}}function abortAlgorithm(){let n;n=a.reason&&a.reason.name===`AbortError`?createAbortError():a.reason;let o=[];r||o.push(()=>t[Q].state===`writable`?writableStreamAbort(t,n):Promise.resolve()),i||o.push(()=>e[Q].state===`readable`?readableStreamCancel(e,n):Promise.resolve()),shutdownWithAnAction(()=>Promise.all(o.map(e=>e())).then(()=>void 0),!0,n)}function watchErrored(e,t,n){e[Q].state===`errored`?n(e[Q].storedError):t.then(void 0,n)}function watchClosed(e,t,n){e[Q].state===`closed`?n():t.then(n,()=>{})}class PipeToReadRequest{[Jn](e){ge(()=>{p.currentWrite=writableStreamDefaultWriterWrite(s,e),setPromiseHandled(p.currentWrite),h.resolve(!1)})}[qn](){h.resolve(!0)}[Yn](e){h.reject(e)}}let h={resolve:null,reject:null};async function step(){if(c||t[Q].backpressure&&(await s[Q].ready.promise,c))return!0;let n=e[Q].controller;if(e[Q].state===`readable`&&nr(n)&&n[Q].queue.length>0){for(;n[Q].queue.length>0;){if(c)return!0;let r=dequeueValue(n);if(n[Q].closeRequested&&!n[Q].queue.length&&(readableStreamDefaultControllerClearAlgorithms(n),readableStreamClose(e)),p.currentWrite=writableStreamDefaultWriterWrite(s,r),setPromiseHandled(p.currentWrite),t[Q].backpressure||t[Q].state!==`writable`||writableStreamCloseQueuedOrInFlight(t))break}return readableStreamDefaultControllerCallPullIfNeeded(n),e[Q].state===`closed`}let{promise:r,resolve:i,reject:a}=Promise.withResolvers();return h={resolve:i,reject:a},readableStreamDefaultReaderRead(o,new PipeToReadRequest),r}async function run(){for(;!await step(););}if(a!==void 0){if(a.aborted)return abortAlgorithm(),l;m=abortAlgorithm,a.addEventListener(`abort`,m,{once:!0})}if(setPromiseHandled(run()),watchErrored(e,o[Q].close.promise,e=>{if(!r)return shutdownWithAnAction(()=>writableStreamAbort(t,e),!0,e);shutdown(!0,e)}),watchErrored(t,s[Q].close.promise,t=>{if(!i)return shutdownWithAnAction(()=>readableStreamCancel(e,t),!0,t);shutdown(!0,t)}),watchClosed(e,o[Q].close.promise,()=>{if(!n)return shutdownWithAnAction(()=>writableStreamDefaultWriterCloseWithErrorPropagation(s));shutdown()}),writableStreamCloseQueuedOrInFlight(t)||t[Q].state===`closed`){let t=TypeError(`Destination WritableStream is closed`);i?shutdown(!0,t):shutdownWithAnAction(()=>readableStreamCancel(e,t),!0,t)}return l}function readableStreamDefaultTee(e,t){let n=new ReadableStreamDefaultReader(e),r=!1,i=!1,a=!1,o,s,c,l,u=Promise.withResolvers();async function pullAlgorithm(){r||(r=!0,readableStreamDefaultReaderRead(n,{[Jn](e){ge(()=>{r=!1;let n=e,o=e;if(!a&&t)try{o=structuredClone(o)}catch{}i||readableStreamDefaultControllerEnqueue(c[Q].controller,n),a||readableStreamDefaultControllerEnqueue(l[Q].controller,o)})},[qn](){ge(()=>{r=!1,i||readableStreamDefaultControllerClose(c[Q].controller),a||readableStreamDefaultControllerClose(l[Q].controller),(!i||!a)&&u.resolve(void 0)})},[Yn](){r=!1}}))}function cancel1Algorithm(t){if(i=!0,o=t,a){let t=[o,s];u.resolve(readableStreamCancel(e,t))}return u.promise}function cancel2Algorithm(t){if(a=!0,s=t,i){let t=[o,s];u.resolve(readableStreamCancel(e,t))}return u.promise}return c=createReadableStream(nonOpStart,pullAlgorithm,cancel1Algorithm),l=createReadableStream(nonOpStart,pullAlgorithm,cancel2Algorithm),n[Q].close.promise.then(void 0,e=>{readableStreamDefaultControllerError(c[Q].controller,e),readableStreamDefaultControllerError(l[Q].controller,e),(!i||!a)&&u.resolve(void 0)}),[c,l]}var BYOBReadIntoRequest=class{[Q];constructor(){this[Q]=Promise.withResolvers()}[Jn](e){this[Q].resolve?.({value:e,done:!1})}[qn](e){this[Q].resolve?.({value:e,done:!0})}[Yn](e){this[Q].reject?.(e)}get promise(){return this[Q].promise}},ReadableStreamBYOBReader=class{[$]=`ReadableStreamBYOBReader`;[Q];constructor(e){if(!tr(e))throw TypeError(`Expected a ReadableStream`);this[Q]={readRequests:[],readIntoRequests:[],stream:void 0,close:{promise:void 0,resolve:void 0,reject:void 0}},setupReadableStreamBYOBReader(this,e)}read(e,t={}){if(!ar(this))return Promise.reject(TypeError(`Invalid this`));if(typeof e!=`object`||!e||!ArrayBuffer.isView(e))return Promise.reject(TypeError(`view must be an ArrayBufferView`));let n=e.buffer,r=e.byteLength;if(r===0)return Promise.reject(TypeError(`view must have non-zero byteLength`));if(n.byteLength===0)return isDetachedBuffer(n)?Promise.reject(TypeError(`view's buffer has been detached`)):Promise.reject(TypeError(`view's buffer must have non-zero byteLength`));let i=t?.min??1;if(typeof i!=`number`||i<1||!Number.isInteger(i)||Number.isNaN(i))return Promise.reject(TypeError(`options.min must be a positive integer`));let a=e[Symbol.toStringTag];if(a!==void 0&&a!==`DataView`){if(i>e.length)return Promise.reject(RangeError(`options.min must be smaller or equal to view size`))}else if(i>r)return Promise.reject(RangeError(`options.min must be smaller or equal to view size`));if(this[Q].stream===void 0)return Promise.reject(TypeError(`Reader has no associated stream`));let o=new BYOBReadIntoRequest;return readableStreamBYOBReaderRead(this,e,i,o),o.promise}releaseLock(){if(!ar(this))throw TypeError(`Invalid this`);this[Q].stream!==void 0&&readableStreamBYOBReaderRelease(this)}get closed(){return ar(this)?this[Q].close.promise:Promise.reject(TypeError(`Invalid this`))}cancel(e=void 0){return ar(this)?this[Q].stream===void 0?Promise.reject(TypeError(`Reader has no associated stream`)):readableStreamReaderGenericCancel(this,e):Promise.reject(TypeError(`Invalid this`))}get[Symbol.toStringTag](){return`ReadableStreamBYOBReader`}},ReadableStreamBYOBRequest=class{[$]=`ReadableStreamBYOBRequest`;[Q];constructor(e){if(e!==Qn)throw TypeError(`Illegal constructor`)}get view(){if(!or(this))throw TypeError(`Invalid this`);return this[Q].view}respond(e){if(!or(this))throw TypeError(`Invalid this`);if(this[Q].controller===void 0)throw TypeError(`BYOB request has been invalidated`);if(e=+e,!Number.isInteger(e)||e<0||!Number.isFinite(e))throw RangeError(`bytesWritten must be a non-negative integer`);let t=this[Q].view;if(isDetachedBuffer(t.buffer))throw TypeError(`The BYOB request's buffer has been detached`);readableByteStreamControllerRespond(this[Q].controller,e)}respondWithNewView(e){if(!or(this))throw TypeError(`Invalid this`);if(this[Q].controller===void 0)throw TypeError(`BYOB request has been invalidated`);if(typeof e!=`object`||!e||!ArrayBuffer.isView(e))throw TypeError(`view must be an ArrayBufferView`);if(isDetachedBuffer(e.buffer))throw TypeError(`The given view's buffer has been detached`);readableByteStreamControllerRespondWithNewView(this[Q].controller,e)}get[Symbol.toStringTag](){return`ReadableStreamBYOBRequest`}},ReadableByteStreamController=class{[$]=`ReadableByteStreamController`;[Q];constructor(e){if(e!==Qn)throw TypeError(`Illegal constructor`)}get byobRequest(){if(!ir(this))throw TypeError(`Invalid this`);return readableByteStreamControllerGetBYOBRequest(this)}get desiredSize(){if(!ir(this))throw TypeError(`Invalid this`);return readableByteStreamControllerGetDesiredSize(this)}close(){if(!ir(this))throw TypeError(`Invalid this`);if(this[Q].closeRequested)throw TypeError(`Close already requested`);if(this[Q].stream[Q].state!==`readable`)throw TypeError(`Stream is not in a readable state`);readableByteStreamControllerClose(this)}enqueue(e){if(!ir(this))throw TypeError(`Invalid this`);if(typeof e!=`object`||!e||!ArrayBuffer.isView(e))throw TypeError(`chunk must be an ArrayBufferView`);if(e.byteLength===0)throw TypeError(`chunk length must be non-zero`);if(e.buffer.byteLength===0)throw TypeError(`chunk's buffer length must be non-zero`);if(this[Q].closeRequested)throw TypeError(`Cannot enqueue after close has been requested`);if(this[Q].stream[Q].state!==`readable`)throw TypeError(`Stream is not in a readable state`);readableByteStreamControllerEnqueue(this,e)}error(e=void 0){if(!ir(this))throw TypeError(`Invalid this`);readableByteStreamControllerError(this,e)}[Kn](e){return readableByteStreamControllerCancelSteps(this,e)}[Xn](e){readableByteStreamControllerPullSteps(this,e)}[Zn](){if(this[Q].pendingPullIntos.length>0){let e=this[Q].pendingPullIntos[0];e.readerType=`none`,this[Q].pendingPullIntos=[e]}}get[Symbol.toStringTag](){return`ReadableByteStreamController`}};const ir=isBrandCheck(`ReadableByteStreamController`),ar=isBrandCheck(`ReadableStreamBYOBReader`),or=isBrandCheck(`ReadableStreamBYOBRequest`);function readableStreamHasBYOBReader(e){let{reader:t}=e[Q];return t===void 0?!1:t[Q]!==void 0&&t[$]===`ReadableStreamBYOBReader`}function readableStreamGetNumReadIntoRequests(e){return e[Q].reader[Q].readIntoRequests.length}function readableStreamAddReadIntoRequest(e,t){e[Q].reader[Q].readIntoRequests.push(t)}function readableStreamFulfillReadIntoRequest(e,t,n){let{reader:r}=e[Q],i=r[Q].readIntoRequests.shift();n?i[qn](t):i[Jn](t)}function setupReadableStreamBYOBReader(e,t){if(isReadableStreamLocked(t))throw TypeError(`ReadableStream is locked`);if(!ir(t[Q].controller))throw TypeError(`Cannot use a BYOB reader with a non-byte stream`);readableStreamReaderGenericInitialize(e,t),e[Q].readIntoRequests=[]}function readableStreamBYOBReaderRead(e,t,n,r){let{stream:i}=e[Q];i[Q].disturbed=!0,i[Q].state===`errored`?r[Yn](i[Q].storedError):readableByteStreamControllerPullInto(i[Q].controller,t,n,r)}function readableStreamBYOBReaderRelease(e){readableStreamReaderGenericRelease(e);let t=TypeError(`Reader was released`);for(let n=0;n<e[Q].readIntoRequests.length;n++)e[Q].readIntoRequests[n][Yn](t);e[Q].readIntoRequests=[]}function readableByteStreamControllerClearAlgorithms(e){e[Q].pullAlgorithm=void 0,e[Q].cancelAlgorithm=void 0}function readableByteStreamControllerClearPendingPullIntos(e){readableByteStreamControllerInvalidateBYOBRequest(e),e[Q].pendingPullIntos=[]}function readableByteStreamControllerInvalidateBYOBRequest(e){let t=e[Q].byobRequest;t!=null&&(t[Q].controller=void 0,t[Q].view=null,e[Q].byobRequest=null)}function readableByteStreamControllerError(e,t){let{stream:n}=e[Q];n[Q].state===`readable`&&(readableByteStreamControllerClearPendingPullIntos(e),resetQueue(e),readableByteStreamControllerClearAlgorithms(e),readableStreamError(n,t))}function readableByteStreamControllerGetDesiredSize(e){let t=e[Q].stream[Q].state;return t===`errored`?null:t===`closed`?0:e[Q].highWaterMark-e[Q].queueTotalSize}function readableByteStreamControllerShouldCallPull(e){let{stream:t}=e[Q];if(t[Q].state!==`readable`||e[Q].closeRequested||!e[Q].started)return!1;if(readableStreamHasDefaultReader(t)&&readableStreamGetNumReadRequests(t)>0||readableStreamHasBYOBReader(t)&&readableStreamGetNumReadIntoRequests(t)>0)return!0;let n=readableByteStreamControllerGetDesiredSize(e);return n!==null&&n>0}function readableByteStreamControllerCallPullIfNeeded(e){if(readableByteStreamControllerShouldCallPull(e)){if(e[Q].pulling){e[Q].pullAgain=!0;return}e[Q].pulling=!0,e[Q].pullAlgorithm(e).then(()=>{e[Q].pulling=!1,e[Q].pullAgain&&(e[Q].pullAgain=!1,readableByteStreamControllerCallPullIfNeeded(e))},t=>readableByteStreamControllerError(e,t))}}function readableByteStreamControllerHandleQueueDrain(e){e[Q].queueTotalSize===0&&e[Q].closeRequested?(readableByteStreamControllerClearAlgorithms(e),readableStreamClose(e[Q].stream)):readableByteStreamControllerCallPullIfNeeded(e)}function readableByteStreamControllerEnqueueChunkToQueue(e,t,n,r){e[Q].queue.push({buffer:t,byteOffset:n,byteLength:r}),e[Q].queueTotalSize+=r}function readableByteStreamControllerEnqueueClonedChunkToQueue(e,t,n,r){let i;try{i=t.slice(n,n+r)}catch(t){readableByteStreamControllerError(e,t);return}readableByteStreamControllerEnqueueChunkToQueue(e,i,0,r)}function readableByteStreamControllerEnqueueDetachedPullIntoToQueue(e,t){t.bytesFilled>0&&readableByteStreamControllerEnqueueClonedChunkToQueue(e,t.buffer,t.byteOffset,t.bytesFilled),readableByteStreamControllerShiftPendingPullInto(e)}function readableByteStreamControllerShiftPendingPullInto(e){return e[Q].pendingPullIntos.shift()}function readableByteStreamControllerFillHeadPullIntoDescriptor(e,t,n){n.bytesFilled+=t}function readableByteStreamControllerConvertPullIntoDescriptor(e){let t=e.bytesFilled,n=e.elementSize,r=transferArrayBuffer(e.buffer);return e.buffer=r,new e.viewConstructor(r,e.byteOffset,t/n)}function readableByteStreamControllerCommitPullIntoDescriptor(e,t){let n=!1;e[Q].state===`closed`&&(n=!0);let r=readableByteStreamControllerConvertPullIntoDescriptor(t);t.readerType==="default"?readableStreamFulfillReadRequest(e,r,n):readableStreamFulfillReadIntoRequest(e,r,n)}function readableByteStreamControllerFillPullIntoDescriptorFromQueue(e,t){let n=Math.min(e[Q].queueTotalSize,t.byteLength-t.bytesFilled),r=t.bytesFilled+n,i=n,a=!1,o=r-r%t.elementSize;o>=t.minimumFill&&(i=o-t.bytesFilled,a=!0);let s=e[Q].queue;for(;i>0;){let n=s[0],r=Math.min(i,n.byteLength),a=t.byteOffset+t.bytesFilled,o=new Uint8Array(t.buffer,a,r),c=new Uint8Array(n.buffer,n.byteOffset,r);o.set(c),n.byteLength===r?s.shift():(n.byteOffset+=r,n.byteLength-=r),e[Q].queueTotalSize-=r,readableByteStreamControllerFillHeadPullIntoDescriptor(e,r,t),i-=r}return a}function readableByteStreamControllerFillReadRequestFromQueue(e,t){let n=e[Q].queue.shift();e[Q].queueTotalSize-=n.byteLength,readableByteStreamControllerHandleQueueDrain(e);let r=new Uint8Array(n.buffer,n.byteOffset,n.byteLength);t[Jn](r)}function readableByteStreamControllerProcessReadRequestsUsingQueue(e){let t=e[Q].stream[Q].reader;for(;t[Q].readRequests.length!==0;){if(e[Q].queueTotalSize===0)return;readableByteStreamControllerFillReadRequestFromQueue(e,t[Q].readRequests.shift())}}function readableByteStreamControllerProcessPullIntoDescriptorsUsingQueue(e){for(;e[Q].pendingPullIntos.length!==0;){if(e[Q].queueTotalSize===0)return;let t=e[Q].pendingPullIntos[0];readableByteStreamControllerFillPullIntoDescriptorFromQueue(e,t)&&(readableByteStreamControllerShiftPendingPullInto(e),readableByteStreamControllerCommitPullIntoDescriptor(e[Q].stream,t))}}function readableByteStreamControllerGetBYOBRequest(e){if(e[Q].byobRequest===null&&e[Q].pendingPullIntos.length!==0){let t=e[Q].pendingPullIntos[0],n=new Uint8Array(t.buffer,t.byteOffset+t.bytesFilled,t.byteLength-t.bytesFilled),r=new ReadableStreamBYOBRequest(Qn);r[Q]={controller:e,view:n},e[Q].byobRequest=r}return e[Q].byobRequest}function readableByteStreamControllerEnqueue(e,t){let{stream:n}=e[Q];if(e[Q].closeRequested||n[Q].state!==`readable`)return;let r=t.buffer,i=t.byteLength,a=t.byteOffset;if(isDetachedBuffer(r))throw TypeError(`chunk's buffer is detached`);let o=transferArrayBuffer(r);if(e[Q].pendingPullIntos.length!==0){let t=e[Q].pendingPullIntos[0];if(isDetachedBuffer(t.buffer))throw TypeError(`BYOB request's buffer has been detached`);readableByteStreamControllerInvalidateBYOBRequest(e),t.buffer=transferArrayBuffer(t.buffer),t.readerType===`none`&&readableByteStreamControllerEnqueueDetachedPullIntoToQueue(e,t)}readableStreamHasDefaultReader(n)?(readableByteStreamControllerProcessReadRequestsUsingQueue(e),readableStreamGetNumReadRequests(n)===0?readableByteStreamControllerEnqueueChunkToQueue(e,o,a,i):(e[Q].pendingPullIntos.length!==0&&readableByteStreamControllerShiftPendingPullInto(e),readableStreamFulfillReadRequest(n,new Uint8Array(o,a,i),!1))):readableStreamHasBYOBReader(n)?(readableByteStreamControllerEnqueueChunkToQueue(e,o,a,i),readableByteStreamControllerProcessPullIntoDescriptorsUsingQueue(e)):readableByteStreamControllerEnqueueChunkToQueue(e,o,a,i),readableByteStreamControllerCallPullIfNeeded(e)}function readableByteStreamControllerClose(e){let{stream:t}=e[Q];if(!(e[Q].closeRequested||t[Q].state!==`readable`)){if(e[Q].queueTotalSize>0){e[Q].closeRequested=!0;return}if(e[Q].pendingPullIntos.length!==0){let t=e[Q].pendingPullIntos[0];if(t.bytesFilled%t.elementSize!==0){let t=TypeError(`Insufficient bytes to fill elements in the given buffer`);throw readableByteStreamControllerError(e,t),t}}readableByteStreamControllerClearAlgorithms(e),readableStreamClose(t)}}function readableByteStreamControllerPullInto(e,t,n,r){let i=e[Q].stream,a=t[Symbol.toStringTag],o,s;if(a===void 0||a===`DataView`)o=DataView,s=1;else{let e=typedArrayConstructorByTag(a);if(!e){r[Yn](TypeError(`Unsupported typed array: ${a}`));return}o=e,s=elementSizeByTag(a)}let c=t.buffer,l=t.byteLength,u=t.byteOffset,d=n*s,p;try{p=transferArrayBuffer(c)}catch(e){r[Yn](e);return}let m={buffer:p,bufferByteLength:p.byteLength,byteOffset:u,byteLength:l,bytesFilled:0,minimumFill:d,elementSize:s,viewConstructor:o,readerType:`byob`};if(e[Q].pendingPullIntos.length!==0){e[Q].pendingPullIntos.push(m),readableStreamAddReadIntoRequest(i,r);return}if(i[Q].state===`closed`){let e=new o(m.buffer,m.byteOffset,0);r[qn](e);return}if(e[Q].queueTotalSize>0){if(readableByteStreamControllerFillPullIntoDescriptorFromQueue(e,m)){let t=readableByteStreamControllerConvertPullIntoDescriptor(m);readableByteStreamControllerHandleQueueDrain(e),r[Jn](t);return}if(e[Q].closeRequested){let t=TypeError(`Insufficient bytes to fill elements in the given buffer`);readableByteStreamControllerError(e,t),r[Yn](t);return}}e[Q].pendingPullIntos.push(m),readableStreamAddReadIntoRequest(i,r),readableByteStreamControllerCallPullIfNeeded(e)}function readableByteStreamControllerRespond(e,t){let n=e[Q].pendingPullIntos[0];if(e[Q].stream[Q].state===`closed`){if(t!==0)throw TypeError(`bytesWritten must be 0 when calling respond() on a closed stream`)}else{if(t===0)throw TypeError(`bytesWritten must be greater than 0 when calling respond() on a readable stream`);if(n.bytesFilled+t>n.byteLength)throw RangeError(`bytesWritten out of range`)}n.buffer=transferArrayBuffer(n.buffer),readableByteStreamControllerRespondInternal(e,t)}function readableByteStreamControllerRespondWithNewView(e,t){let n=e[Q].pendingPullIntos[0],r=e[Q].stream[Q].state,i=t.byteLength,a=t.byteOffset,o=t.buffer;if(r===`closed`){if(i!==0)throw TypeError(`view's length must be 0 when calling respondWithNewView() on a closed stream`)}else if(i===0)throw TypeError(`view's length must be greater than 0 when calling respondWithNewView() on a readable stream`);if(n.byteOffset+n.bytesFilled!==a)throw RangeError(`The region specified by view does not match byobRequest`);if(n.bufferByteLength!==o.byteLength)throw RangeError(`The buffer of view has different capacity than byobRequest`);if(n.bytesFilled+i>n.byteLength)throw RangeError(`The region specified by view is larger than byobRequest`);n.buffer=transferArrayBuffer(o),readableByteStreamControllerRespondInternal(e,i)}function readableByteStreamControllerRespondInternal(e,t){let n=e[Q].pendingPullIntos[0];readableByteStreamControllerInvalidateBYOBRequest(e),e[Q].stream[Q].state===`closed`?readableByteStreamControllerRespondInClosedState(e,n):readableByteStreamControllerRespondInReadableState(e,t,n),readableByteStreamControllerCallPullIfNeeded(e)}function readableByteStreamControllerRespondInClosedState(e,t){t.readerType===`none`&&readableByteStreamControllerShiftPendingPullInto(e);let n=e[Q].stream;if(readableStreamHasBYOBReader(n))for(;readableStreamGetNumReadIntoRequests(n)>0;)readableByteStreamControllerCommitPullIntoDescriptor(n,readableByteStreamControllerShiftPendingPullInto(e))}function readableByteStreamControllerRespondInReadableState(e,t,n){if(readableByteStreamControllerFillHeadPullIntoDescriptor(e,t,n),n.readerType===`none`){readableByteStreamControllerEnqueueDetachedPullIntoToQueue(e,n),readableByteStreamControllerProcessPullIntoDescriptorsUsingQueue(e);return}if(n.bytesFilled<n.minimumFill)return;readableByteStreamControllerShiftPendingPullInto(e);let r=n.bytesFilled%n.elementSize;if(r>0){let t=n.byteOffset+n.bytesFilled;readableByteStreamControllerEnqueueClonedChunkToQueue(e,n.buffer,t-r,r)}n.bytesFilled-=r,readableByteStreamControllerCommitPullIntoDescriptor(e[Q].stream,n),readableByteStreamControllerProcessPullIntoDescriptorsUsingQueue(e)}function readableByteStreamControllerCancelSteps(e,t){readableByteStreamControllerClearPendingPullIntos(e),resetQueue(e);let n=e[Q].cancelAlgorithm?.(t)??Promise.resolve();return readableByteStreamControllerClearAlgorithms(e),n}function readableByteStreamControllerPullSteps(e,t){let n=e[Q].stream;if(e[Q].queueTotalSize>0){readableByteStreamControllerFillReadRequestFromQueue(e,t);return}let r=e[Q].autoAllocateChunkSize;if(r!==void 0){let n;try{n=new ArrayBuffer(r)}catch(e){t[Yn](e);return}let i={buffer:n,bufferByteLength:r,byteOffset:0,byteLength:r,bytesFilled:0,minimumFill:1,elementSize:1,viewConstructor:Uint8Array,readerType:`default`};e[Q].pendingPullIntos.push(i)}readableStreamAddReadRequest(n,t),readableByteStreamControllerCallPullIfNeeded(e)}function setupReadableByteStreamController(e,t,n,r,i,a,o){t[Q]={cancelAlgorithm:i,closeRequested:!1,highWaterMark:a,pullAgain:!1,pullAlgorithm:r,pulling:!1,queue:[],queueTotalSize:0,started:!1,stream:e,byobRequest:null,pendingPullIntos:[],autoAllocateChunkSize:o},e[Q].controller=t;let s=n();new Promise(e=>e(s)).then(()=>{t[Q].started=!0,readableByteStreamControllerCallPullIfNeeded(t)},e=>readableByteStreamControllerError(t,e))}function setupReadableByteStreamControllerFromSource(e,t,n){let r=new ReadableByteStreamController(Qn),i=t?.start,a=t?.pull,o=t?.cancel,s=t?.autoAllocateChunkSize;if(s!==void 0&&(s===0||!Number.isInteger(s)||s<0))throw TypeError(`autoAllocateChunkSize must be a positive integer`);setupReadableByteStreamController(e,r,i?i.bind(t,r):nonOpStart,a?createPromiseCallback(`source.pull`,a,t):nonOpPull,o?createPromiseCallback(`source.cancel`,o,t):nonOpCancel,n,s)}function readableByteStreamTee(e){let t=new ReadableStreamDefaultReader(e),n=!1,r=!1,i=!1,a,o,s=Promise.withResolvers(),c,l,u,d;function pullAlgorithm(){return n?Promise.resolve():(n=!0,t.read().then(e=>{if(n=!1,e.done){r||u.close(),i||d.close();return}let t=e.value,a=new Uint8Array(t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength));r||u.enqueue(a),i||d.enqueue(new Uint8Array(a))},()=>{}),Promise.resolve())}return c=new ReadableStream$1({type:`bytes`,pull:pullAlgorithm,cancel(t){if(r=!0,a=t,i){let t=readableStreamCancel(e,[a,o]);return s.resolve(),t}return s.promise}}),l=new ReadableStream$1({type:`bytes`,pull:pullAlgorithm,cancel(t){if(i=!0,o=t,r){let t=readableStreamCancel(e,[a,o]);return s.resolve(),t}return s.promise}}),u=c[Q].controller,d=l[Q].controller,t.closed.catch(e=>{u.error(e),d.error(e),(!r||!i)&&s.resolve()}),[c,l]}const sr=Symbol(`kSkipThrow`);var TransformStream=class{[$]=`TransformStream`;[Q];constructor(e={},t={},n={}){if(e!=null&&typeof e!=`object`)throw TypeError(`transformer must be an object`);if(t!=null&&typeof t!=`object`)throw TypeError(`writableStrategy must be an object`);if(n!=null&&typeof n!=`object`)throw TypeError(`readableStrategy must be an object`);let r=e?.readableType,i=e?.writableType,a=e?.start;if(r!==void 0)throw RangeError(`Invalid readableType: ${r}`);if(i!==void 0)throw RangeError(`Invalid writableType: ${i}`);let o=extractHighWaterMark(n?.highWaterMark,0),s=extractSizeAlgorithm(n?.size),c=extractHighWaterMark(t?.highWaterMark,1),l=extractSizeAlgorithm(t?.size),u=Promise.withResolvers();initializeTransformStream(this,u,c,l,o,s),setupTransformStreamDefaultControllerFromTransformer(this,e),a===void 0?u.resolve():u.resolve(a.call(e,this[Q].controller))}get readable(){if(!cr(this))throw TypeError(`Invalid this`);return this[Q].readable}get writable(){if(!cr(this))throw TypeError(`Invalid this`);return this[Q].writable}get[Symbol.toStringTag](){return`TransformStream`}},TransformStreamDefaultController=class{[$]=`TransformStreamDefaultController`;[Q];constructor(e){if(e!==sr)throw TypeError(`Illegal constructor`)}get desiredSize(){if(!lr(this))throw TypeError(`Invalid this`);let{stream:e}=this[Q],{readable:t}=e[Q],n=t[Q].controller;return readableStreamDefaultControllerGetDesiredSize(n)}enqueue(e){if(!lr(this))throw TypeError(`Invalid this`);transformStreamDefaultControllerEnqueue(this,e)}error(e){if(!lr(this))throw TypeError(`Invalid this`);transformStreamDefaultControllerError(this,e)}terminate(){if(!lr(this))throw TypeError(`Invalid this`);transformStreamDefaultControllerTerminate(this)}get[Symbol.toStringTag](){return`TransformStreamDefaultController`}};const cr=isBrandCheck(`TransformStream`),lr=isBrandCheck(`TransformStreamDefaultController`);async function defaultTransformAlgorithm(e,t){transformStreamDefaultControllerEnqueue(t,e)}function initializeTransformStream(e,t,n,r,i,a){let startAlgorithm=()=>t.promise,o=createWritableStream(startAlgorithm,t=>transformStreamDefaultSinkWriteAlgorithm(e,t),()=>transformStreamDefaultSinkCloseAlgorithm(e),t=>transformStreamDefaultSinkAbortAlgorithm(e,t),n,r);e[Q]={readable:createReadableStream(startAlgorithm,()=>transformStreamDefaultSourcePullAlgorithm(e),t=>transformStreamDefaultSourceCancelAlgorithm(e,t),i,a),writable:o,controller:void 0,backpressure:void 0,backpressureChange:{promise:void 0,resolve:void 0,reject:void 0}},transformStreamSetBackpressure(e,!0)}function transformStreamError(e,t){let{readable:n}=e[Q];readableStreamDefaultControllerError(n[Q].controller,t),transformStreamErrorWritableAndUnblockWrite(e,t)}function transformStreamErrorWritableAndUnblockWrite(e,t){let{controller:n,writable:r}=e[Q];transformStreamDefaultControllerClearAlgorithms(n),writableStreamDefaultControllerErrorIfNeeded(r[Q].controller,t),transformStreamUnblockWrite(e)}function transformStreamUnblockWrite(e){e[Q].backpressure&&transformStreamSetBackpressure(e,!1)}function transformStreamSetBackpressure(e,t){e[Q].backpressureChange.promise!==void 0&&e[Q].backpressureChange.resolve?.(),e[Q].backpressureChange=Promise.withResolvers(),e[Q].backpressure=t}function setupTransformStreamDefaultController(e,t,n,r,i){t[Q]={stream:e,transformAlgorithm:n,flushAlgorithm:r,cancelAlgorithm:i,finishPromise:void 0},e[Q].controller=t}function setupTransformStreamDefaultControllerFromTransformer(e,t){let n=new TransformStreamDefaultController(sr),r=t?.transform,i=t?.flush,a=t?.cancel;setupTransformStreamDefaultController(e,n,r?createPromiseCallback(`transformer.transform`,r,t):defaultTransformAlgorithm,i?createPromiseCallback(`transformer.flush`,i,t):nonOpFlush,a?createPromiseCallback(`transformer.cancel`,a,t):nonOpCancel)}function transformStreamDefaultControllerClearAlgorithms(e){e[Q].transformAlgorithm=void 0,e[Q].flushAlgorithm=void 0,e[Q].cancelAlgorithm=void 0}function transformStreamDefaultControllerEnqueue(e,t){let{stream:n}=e[Q],{readable:r}=n[Q],i=r[Q].controller;if(!readableStreamDefaultControllerCanCloseOrEnqueue(i))throw TypeError(`Unable to enqueue`);try{readableStreamDefaultControllerEnqueue(i,t)}catch(e){throw transformStreamErrorWritableAndUnblockWrite(n,e),r[Q].storedError}readableStreamDefaultControllerHasBackpressure(i)!==n[Q].backpressure&&transformStreamSetBackpressure(n,!0)}function transformStreamDefaultControllerError(e,t){transformStreamError(e[Q].stream,t)}async function transformStreamDefaultControllerPerformTransform(e,t){try{let n=e[Q].transformAlgorithm;if(n===void 0)return;await n(t,e)}catch(t){throw transformStreamError(e[Q].stream,t),t}}function transformStreamDefaultControllerTerminate(e){let{stream:t}=e[Q],{readable:n}=t[Q];readableStreamDefaultControllerClose(n[Q].controller),transformStreamErrorWritableAndUnblockWrite(t,TypeError(`TransformStream has been terminated`))}function transformStreamDefaultSinkWriteAlgorithm(e,t){let{controller:n}=e[Q];return e[Q].backpressure?e[Q].backpressureChange.promise.then(()=>{let{writable:r}=e[Q];if(r[Q].state===`erroring`)throw r[Q].storedError;return transformStreamDefaultControllerPerformTransform(n,t)}):transformStreamDefaultControllerPerformTransform(n,t)}async function transformStreamDefaultSinkAbortAlgorithm(e,t){let{controller:n,readable:r}=e[Q];if(n[Q].finishPromise!==void 0)return n[Q].finishPromise;let{promise:i,resolve:a,reject:o}=Promise.withResolvers();n[Q].finishPromise=i;let s=n[Q].cancelAlgorithm(t);return transformStreamDefaultControllerClearAlgorithms(n),s.then(()=>{r[Q].state===`errored`?o(r[Q].storedError):(readableStreamDefaultControllerError(r[Q].controller,t),a())},e=>{readableStreamDefaultControllerError(r[Q].controller,e),o(e)}),n[Q].finishPromise}function transformStreamDefaultSinkCloseAlgorithm(e){let{readable:t,controller:n}=e[Q];if(n[Q].finishPromise!==void 0)return n[Q].finishPromise;let{promise:r,resolve:i,reject:a}=Promise.withResolvers();n[Q].finishPromise=r;let o=n[Q].flushAlgorithm(n);return transformStreamDefaultControllerClearAlgorithms(n),o.then(()=>{t[Q].state===`errored`?a(t[Q].storedError):(readableStreamDefaultControllerClose(t[Q].controller),i())},e=>{readableStreamDefaultControllerError(t[Q].controller,e),a(e)}),n[Q].finishPromise}function transformStreamDefaultSourcePullAlgorithm(e){return transformStreamSetBackpressure(e,!1),e[Q].backpressureChange.promise}function transformStreamDefaultSourceCancelAlgorithm(e,t){let{controller:n,writable:r}=e[Q];if(n[Q].finishPromise!==void 0)return n[Q].finishPromise;let{promise:i,resolve:a,reject:o}=Promise.withResolvers();n[Q].finishPromise=i;let s=n[Q].cancelAlgorithm(t);return transformStreamDefaultControllerClearAlgorithms(n),s.then(()=>{r[Q].state===`errored`?o(r[Q].storedError):(writableStreamDefaultControllerErrorIfNeeded(r[Q].controller,t),transformStreamUnblockWrite(e),a())},t=>{writableStreamDefaultControllerErrorIfNeeded(r[Q].controller,t),transformStreamUnblockWrite(e),o(t)}),n[Q].finishPromise}const ur=Object.defineProperty(e=>e.byteLength,"name",{value:`size`}),dr=Object.defineProperty(()=>1,"name",{value:`size`});var ByteLengthQueuingStrategy=class{#e;constructor(e){if(typeof e!=`object`||!e)throw TypeError(`init must be an object`);if(e.highWaterMark===void 0)throw TypeError(`init.highWaterMark is required`);this.#e=+e.highWaterMark}get highWaterMark(){return this.#e}get size(){return ur}get[Symbol.toStringTag](){return`ByteLengthQueuingStrategy`}},CountQueuingStrategy=class{#e;constructor(e){if(typeof e!=`object`||!e)throw TypeError(`init must be an object`);if(e.highWaterMark===void 0)throw TypeError(`init.highWaterMark is required`);this.#e=+e.highWaterMark}get highWaterMark(){return this.#e}get size(){return dr}get[Symbol.toStringTag](){return`CountQueuingStrategy`}},TextEncoderStream=class{#e=null;#t=new TextEncoder;#n;constructor(){this.#n=new TransformStream({transform:(e,t)=>{if(e=String(e),e===``)return;this.#e!==null&&(e=this.#e+e);let n=e.charCodeAt(e.length-1);55296<=n&&n<=56319?(this.#e=e.slice(-1),e=e.slice(0,-1)):this.#e=null,e&&t.enqueue(this.#t.encode(e))},flush:e=>{this.#e!==null&&e.enqueue(new Uint8Array([239,191,189]))}})}get encoding(){return`utf-8`}get readable(){return this.#n.readable}get writable(){return this.#n.writable}};function hasStreamingSupport(){try{return new TextDecoder().decode(new Uint8Array([195]),{stream:!0}),!0}catch{return!1}}const fr=hasStreamingSupport();function incompleteUtf8Tail$1(e){let t=e.length;if(t===0)return 0;for(let n=1;n<=Math.min(3,t);n++){let r=e[t-n];if(!(r&128))return 0;if((r&192)!=128){let e;if((r&224)==192)e=2;else if((r&240)==224)e=3;else if((r&248)==240)e=4;else return 0;return n<e?n:0}}return 0}__name(incompleteUtf8Tail$1,`incompleteUtf8Tail`);var TextDecoderStream=class{#e;#t;constructor(e,t){if(this.#e=new TextDecoder(e,t),fr)this.#t=new TransformStream({transform:(e,t)=>{let n=toUint8Array$3(e),r=this.#e.decode(n,{stream:!0});r&&t.enqueue(r)},flush:e=>{let t=this.#e.decode();t&&e.enqueue(t)},cancel:()=>{this.#e.decode()}});else{let e=new Uint8Array;this.#t=new TransformStream({transform:(t,n)=>{let r=toUint8Array$3(t),i;e.length>0?(i=new Uint8Array(e.length+r.length),i.set(e,0),i.set(r,e.length)):i=r;let a=incompleteUtf8Tail$1(i),o;if(a>0?(o=i.slice(0,i.length-a),e=i.slice(i.length-a)):(o=i,e=new Uint8Array),o.length>0){let e=this.#e.decode(o);e&&n.enqueue(e)}},flush:t=>{if(e.length>0){let n=this.#e.decode(e);n&&t.enqueue(n),e=new Uint8Array}},cancel:()=>{e=new Uint8Array}})}}get encoding(){return this.#e.encoding}get fatal(){return this.#e.fatal}get ignoreBOM(){return this.#e.ignoreBOM}get readable(){return this.#t.readable}get writable(){return this.#t.writable}};function toUint8Array$3(e){if(e instanceof Uint8Array)return e;if(e instanceof ArrayBuffer)return new Uint8Array(e);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw TypeError(`chunk must be a BufferSource`)}__name(toUint8Array$3,`toUint8Array`);function isNativeStreamUsable$3(e,t){try{return typeof e==`function`?typeof e.prototype?.[t]==`function`:!1}catch{return!1}}__name(isNativeStreamUsable$3,`isNativeStreamUsable`);const pr=isNativeStreamUsable$3(globalThis.ReadableStream,`getReader`)?globalThis.ReadableStream:ReadableStream$1,mr=isNativeStreamUsable$3(globalThis.WritableStream,`getWriter`)?globalThis.WritableStream:WritableStream,hr=isNativeStreamUsable$3(globalThis.TransformStream,`readable`)?globalThis.TransformStream:TransformStream,gr=typeof globalThis.ByteLengthQueuingStrategy==`function`?globalThis.ByteLengthQueuingStrategy:ByteLengthQueuingStrategy,_r=typeof globalThis.CountQueuingStrategy==`function`?globalThis.CountQueuingStrategy:CountQueuingStrategy,vr=typeof globalThis.TextEncoderStream==`function`?globalThis.TextEncoderStream:TextEncoderStream,yr=typeof globalThis.TextDecoderStream==`function`?globalThis.TextDecoderStream:TextDecoderStream;var br=__esmMin(()=>{L()});function _setPipeImpl(e){xr=e}var xr,Stream_,Sr=__esmMin(()=>{yn(),Stream_=class extends Y{constructor(e){super(e)}pipe(e,t){return xr(this,e,t)}}});function getDefaultHighWaterMark(e){return e?wr:Cr}function setDefaultHighWaterMark(e,t){if(typeof t!=`number`||t<0||Number.isNaN(t))throw TypeError(`Invalid highWaterMark: ${t}`);e?wr=t:Cr=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 Cr,wr,Tr=__esmMin(()=>{Cr=16384,wr=16});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 Er,Dr=__esmMin(()=>{Sr(),Tr(),L(),Er=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;_destroyImpl;_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._destroyImpl=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.resume(),e===`readable`&&(this._buffer.length>0||this._readableState.ended)&&this._scheduleReadable(),this}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){this._destroyImpl?this._destroyImpl.call(this,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 cb=e=>{e&&nextTick(()=>this.emit(`error`,e)),nextTick(()=>this.emit(`close`))};return Object.prototype.hasOwnProperty.call(this,`_destroy`)?this._destroy(e??null,cb):this._destroyImpl?this._destroyImpl.call(this,e??null,cb):cb(e),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,a=null;return e.on(`data`,e=>{if(i){let t=i;i=null,a=null,t({value:e,done:!1})}else t.push(e)}),e.on(`end`,()=>{if(n=!0,i){let e=i;i=null,a=null,e({value:void 0,done:!0})}}),e.on(`error`,e=>{if(r=e,n=!0,a){let t=a;i=null,a=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,a=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)}}});function chunkLen$1(e){if(e==null)return 1;let t=e.length;return typeof t==`number`?t:1}var Duplex_,Or=__esmMin(()=>{Tr(),Dr(),L(),Duplex_=class extends Er{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;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=Error(`write after end`);return nextTick(()=>{r(e),this.emit(`error`,e)}),!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 a=this.writableLength<this.writableHighWaterMark;return a||(this.writableNeedDrain=!0),this._duplexDoWrite(e,i,r),a}_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.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.emit(`close`)),n&&n()})})})};return this._pendingWrites>0||this._duplexWriting||this._duplexWriteQueue.length>0?this._pendingEndCb=doFinal:doFinal(),this}_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.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,a=!1,ondrain=()=>{a=!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(),a||(a=!0,t.on(`drain`,ondrain)))}};r.on(`data`,ondata);let o=!1,onend=()=>{o||(o=!0,i&&t.end())},onclose=()=>{if(!o&&(o=!0,i&&!(r instanceof Er))){let e=t;typeof e.destroy==`function`&&e.destroy()}};i&&(r.on(`end`,onend),r.on(`close`,onclose));let cleanup=()=>{r.removeListener(`data`,ondata),a&&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 Er&&(r._pipeDests.push({dest:t,cleanup}),r._readableState.pipes.push(t)),t.emit(`pipe`,r),t}var kr=__esmMin(()=>{Sr(),Dr(),_setPipeImpl(pipe)});function chunkLen(e){if(e==null)return 1;let t=e.length;return typeof t==`number`?t:1}var Ar,jr=__esmMin(()=>{Sr(),Tr(),L(),Ar=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;_destroyImpl;_constructImpl;_decodeStrings;_defaultEncoding=`utf8`;constructor(e){super(e),this.writableHighWaterMark=e?.highWaterMark??getDefaultHighWaterMark(e?.objectMode??!1),this.writableObjectMode=e?.objectMode??!1,this._decodeStrings=e?.decodeStrings!==!1,e?.write&&(this._writeImpl=e.write),e?.writev&&(this._writev=e.writev),e?.final&&(this._finalImpl=e.final),e?.destroy&&(this._destroyImpl=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){this._destroyImpl?this._destroyImpl.call(this,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`),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=Error(`write after end`);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 a=this.writableLength<this.writableHighWaterMark;return a||(this.writableNeedDrain=!0),this._writableState.writing?this._writeBuffer.push({chunk:e,encoding:i,callback:r}):this._doWrite(e,i,r),a}_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 cb=e=>{e&&nextTick(()=>this.emit(`error`,e)),nextTick(()=>this.emit(`close`))};return this._destroy(e??null,cb),this}}}),Mr,Nr=__esmMin(()=>{Or(),L(),Mr=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_,Pr=__esmMin(()=>{Nr(),PassThrough_=class extends Mr{constructor(e){super({...e,transform(e,t,n){n(null,e)}})}}});function pipeline(...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 a=r[0];for(let e=1;e<r.length;e++){let t=r[e];a.pipe(t),a.on(`error`,onError),a=t}let o=r[r.length-1];return o.on(`error`,onError),o.on(`finish`,()=>{n&&!i&&n(null)}),o}var Fr=__esmMin(()=>{});function finished(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 a=e,o=typeof e.write==`function`,s=typeof e.read==`function`,c=a.writableFinished===!0,l=a.readableEnded===!0;if(a.destroyed===!0){let e=a._err;ge(e?()=>done(e):o&&c||s&&l?()=>done():()=>done(Error(`premature close`)))}else (o&&!s&&c||!o&&s&&l||o&&s&&c&&l)&&ge(()=>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 Ir=__esmMin(()=>{Sr(),L()}),Lr=__exportAll$4({Duplex:()=>Vr,PassThrough:()=>Ur,Readable:()=>zr,Stream:()=>Rr,Transform:()=>Hr,Writable:()=>Br,addAbortSignal:()=>addAbortSignal,default:()=>Wr,finished:()=>finished,getDefaultHighWaterMark:()=>getDefaultHighWaterMark,isDestroyed:()=>isDestroyed,isDisturbed:()=>isDisturbed,isErrored:()=>isErrored,isReadable:()=>isReadable,isWritable:()=>isWritable,pipeline:()=>pipeline,setDefaultHighWaterMark:()=>setDefaultHighWaterMark}),Rr,zr,Br,Vr,Hr,Ur,Wr,Gr=__esmMin(()=>{br(),Sr(),Tr(),Dr(),Or(),kr(),jr(),Nr(),Pr(),Fr(),Ir(),Rr=makeCallable(Stream_),zr=makeCallable(Er),Br=makeCallable(Ar),Vr=makeCallable(Duplex_),Hr=makeCallable(Mr),Ur=makeCallable(PassThrough_),Wr=Object.assign(Rr,{Stream:Rr,Readable:zr,Writable:Br,Duplex:Vr,Transform:Hr,PassThrough:Ur,pipeline,finished,addAbortSignal,isReadable,isWritable,isDestroyed,isDisturbed,isErrored,getDefaultHighWaterMark,setDefaultHighWaterMark})});function getGioCompressorFormat(e){switch(e){case`gzip`:return N.ZlibCompressorFormat.GZIP;case`deflate`:return N.ZlibCompressorFormat.ZLIB;case`deflate-raw`:return N.ZlibCompressorFormat.RAW}}function toUint8Array$2(e){return typeof e==`string`?new TextEncoder().encode(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}function createGzip(e){return new ZlibTransform(`gzip`,`compress`,e)}function createGunzip(e){return new ZlibTransform(`gzip`,`decompress`,e)}function createDeflate(e){return new ZlibTransform(`deflate`,`compress`,e)}function createInflate(e){return new ZlibTransform(`deflate`,`decompress`,e)}function createDeflateRaw(e){return new ZlibTransform(`deflate-raw`,`compress`,e)}function createInflateRaw(e){return new ZlibTransform(`deflate-raw`,`decompress`,e)}function createUnzip(e){return new ZlibTransform(`gzip`,`decompress`,e)}function createBrotliCompress(e){throw Error(`createBrotliCompress is not supported on GJS (no Brotli in GLib)`)}function createBrotliDecompress(e){throw Error(`createBrotliDecompress is not supported on GJS (no Brotli in GLib)`)}var ZlibTransform,Kr=__esmMin(()=>{P(),A(),Gr(),__name(toUint8Array$2,`toUint8Array`),ZlibTransform=class extends Hr{_format;_mode;_chunks=[];constructor(e,t,n){super(n),this._format=e,this._mode=t}_transform(e,t,n){this._chunks.push(toUint8Array$2(e)),n()}_flush(e){let t=this._chunks.reduce((e,t)=>e+t.length,0),n=new Uint8Array(t),r=0;for(let e of this._chunks)n.set(e,r),r+=e.length;this._chunks=[];try{let t=this._mode===`compress`?this._compress(n):this._decompress(n);this.push(Buffer.from(t)),e()}catch(t){e(t instanceof Error?t:Error(String(t)))}}_compress(e){let t=new N.ZlibCompressor({format:getGioCompressorFormat(this._format)}),n=new N.ConverterOutputStream({base_stream:N.MemoryOutputStream.new_resizable(),converter:t});n.write_bytes(new k.Bytes(e),null),n.close(null);let r=n.get_base_stream().steal_as_bytes();return new Uint8Array(r.get_data()??[])}_decompress(e){let t=new N.ZlibDecompressor({format:getGioCompressorFormat(this._format)}),n=N.MemoryInputStream.new_from_bytes(new k.Bytes(e)),r=new N.ConverterInputStream({base_stream:n,converter:t}),i=[];for(;;){let e=r.read_bytes(4096,null);if(e.get_size()===0)break;i.push(new Uint8Array(e.get_data()))}r.close(null);let a=i.reduce((e,t)=>e+t.length,0),o=new Uint8Array(a),s=0;for(let e of i)o.set(e,s),s+=e.length;return o}}}),qr=__exportAll$4({ZlibTransform:()=>ZlibTransform,brotliCompress:()=>brotliCompress,brotliCompressSync:()=>brotliCompressSync,brotliDecompress:()=>brotliDecompress,brotliDecompressSync:()=>brotliDecompressSync,constants:()=>Xr,createBrotliCompress:()=>createBrotliCompress,createBrotliDecompress:()=>createBrotliDecompress,createDeflate:()=>createDeflate,createDeflateRaw:()=>createDeflateRaw,createGunzip:()=>createGunzip,createGzip:()=>createGzip,createInflate:()=>createInflate,createInflateRaw:()=>createInflateRaw,createUnzip:()=>createUnzip,default:()=>Zr,deflate:()=>deflate,deflateRaw:()=>deflateRaw,deflateRawSync:()=>deflateRawSync,deflateSync:()=>deflateSync,gunzip:()=>gunzip,gunzipSync:()=>gunzipSync,gzip:()=>gzip,gzipSync:()=>gzipSync,inflate:()=>inflate,inflateRaw:()=>inflateRaw,inflateRawSync:()=>inflateRawSync,inflateSync:()=>inflateSync});function getGioFormat(e){switch(e){case`gzip`:return N.ZlibCompressorFormat.GZIP;case`deflate`:return N.ZlibCompressorFormat.ZLIB;case`deflate-raw`:return N.ZlibCompressorFormat.RAW}}function compressWithGio(e,t){let n=new N.ZlibCompressor({format:getGioFormat(t)}),r=new N.ConverterOutputStream({base_stream:N.MemoryOutputStream.new_resizable(),converter:n});r.write_bytes(new k.Bytes(e),null),r.close(null);let i=r.get_base_stream().steal_as_bytes();return new Uint8Array(i.get_data()??[])}function decompressStreamWithGio(e,t){let n=new N.ZlibDecompressor({format:getGioFormat(t)}),r=N.MemoryInputStream.new_from_bytes(new k.Bytes(e)),i=new N.ConverterInputStream({base_stream:r,converter:n}),a=[];for(;;){let e=i.read_bytes(4096,null);if(e.get_size()===0)break;a.push(new Uint8Array(e.get_data()))}i.close(null);let o=a.reduce((e,t)=>e+t.length,0),s=new Uint8Array(o),c=0;for(let e of a)s.set(e,c),c+=e.length;return s}function findGzipMemberEnd(e){let t=new N.ZlibDecompressor({format:N.ZlibCompressorFormat.GZIP}),n=new Uint8Array(65536),r=0,i=!1;for(;!i;){let a=e.subarray(r);try{let[e,o]=t.convert(a,n,N.ConverterFlags.NONE);r+=o,e===N.ConverterResult.FINISHED&&(i=!0)}catch{i=!0}}return r}function decompressWithGio(e,t){if(t!==`gzip`)return decompressStreamWithGio(e,t);let n=[],r=0;for(;r<e.length&&!(e.length-r<2||e[r]!==31||e[r+1]!==139);){let t=e.subarray(r),i=findGzipMemberEnd(t);if(i<=0)break;let a=decompressStreamWithGio(t.subarray(0,i),`gzip`);n.push(a),r+=i}if(n.length===0)return decompressStreamWithGio(e,`gzip`);let i=n.reduce((e,t)=>e+t.length,0),a=new Uint8Array(i),o=0;for(let e of n)a.set(e,o),o+=e.length;return a}async function compressWithWeb(e,t){let n=new CompressionStream(t),r=n.writable.getWriter();r.write(new Uint8Array(e.buffer,e.byteOffset,e.byteLength)),r.close();let i=[],a=n.readable.getReader();for(;;){let{done:e,value:t}=await a.read();if(e)break;i.push(t)}let o=i.reduce((e,t)=>e+t.length,0),s=new Uint8Array(o),c=0;for(let e of i)s.set(e,c),c+=e.length;return s}async function decompressWithWeb(e,t){let n=new DecompressionStream(t),r=n.writable.getWriter();r.write(new Uint8Array(e.buffer,e.byteOffset,e.byteLength)),r.close();let i=[],a=n.readable.getReader();for(;;){let{done:e,value:t}=await a.read();if(e)break;i.push(t)}let o=i.reduce((e,t)=>e+t.length,0),s=new Uint8Array(o),c=0;for(let e of i)s.set(e,c),c+=e.length;return s}async function compress(e,t){return Jr?compressWithWeb(e,t):compressWithGio(e,t)}async function decompress(e,t){return Jr?decompressWithWeb(e,t):decompressWithGio(e,t)}function toUint8Array$1(e){return typeof e==`string`?new TextEncoder().encode(e):e instanceof ArrayBuffer?new Uint8Array(e):e}function gzip(e,t,n){let r=typeof t==`function`?t:n;compress(toUint8Array$1(e),`gzip`).then(e=>r(null,e),e=>r(e instanceof Error?e:Error(String(e)),new Uint8Array))}function gunzip(e,t,n){let r=typeof t==`function`?t:n;decompress(toUint8Array$1(e),`gzip`).then(e=>r(null,e),e=>r(e instanceof Error?e:Error(String(e)),new Uint8Array))}function deflate(e,t,n){let r=typeof t==`function`?t:n;compress(toUint8Array$1(e),`deflate`).then(e=>r(null,e),e=>r(e instanceof Error?e:Error(String(e)),new Uint8Array))}function inflate(e,t,n){let r=typeof t==`function`?t:n;decompress(toUint8Array$1(e),`deflate`).then(e=>r(null,e),e=>r(e instanceof Error?e:Error(String(e)),new Uint8Array))}function deflateRaw(e,t,n){let r=typeof t==`function`?t:n;compress(toUint8Array$1(e),`deflate-raw`).then(e=>r(null,e),e=>r(e instanceof Error?e:Error(String(e)),new Uint8Array))}function inflateRaw(e,t,n){let r=typeof t==`function`?t:n;decompress(toUint8Array$1(e),`deflate-raw`).then(e=>r(null,e),e=>r(e instanceof Error?e:Error(String(e)),new Uint8Array))}function gzipSync(e,t){return compressWithGio(toUint8Array$1(e),`gzip`)}function gunzipSync(e,t){return decompressWithGio(toUint8Array$1(e),`gzip`)}function deflateSync(e,t){return compressWithGio(toUint8Array$1(e),`deflate`)}function inflateSync(e,t){return decompressWithGio(toUint8Array$1(e),`deflate`)}function deflateRawSync(e,t){return compressWithGio(toUint8Array$1(e),`deflate-raw`)}function inflateRawSync(e,t){return decompressWithGio(toUint8Array$1(e),`deflate-raw`)}function brotliCompress(e,t,n){(typeof t==`function`?t:n)(Error(`brotliCompress: Brotli is not supported in this environment`),Yr)}function brotliDecompress(e,t,n){(typeof t==`function`?t:n)(Error(`brotliDecompress: Brotli is not supported in this environment`),Yr)}function brotliCompressSync(e,t){throw Error(`brotliCompressSync: Brotli is not supported in this environment`)}function brotliDecompressSync(e,t){throw Error(`brotliDecompressSync: Brotli is not supported in this environment`)}var Jr,Yr,Xr,Zr,Qr=__esmMin(()=>{Kr(),P(),A(),Jr=globalThis.CompressionStream!==void 0,__name(toUint8Array$1,`toUint8Array`),Yr=new Uint8Array,Xr={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_VERSION_ERROR:-6,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_DEFLATED:8},Zr={gzip,gunzip,deflate,inflate,deflateRaw,inflateRaw,gzipSync,gunzipSync,deflateSync,inflateSync,deflateRawSync,inflateRawSync,brotliCompress,brotliDecompress,brotliCompressSync,brotliDecompressSync,createGzip,createGunzip,createDeflate,createInflate,createDeflateRaw,createInflateRaw,createUnzip,createBrotliCompress,createBrotliDecompress,constants:Xr}});const $r=new Set([`gzip`,`deflate`,`deflate-raw`]);function validateFormat(e){if(!$r.has(e))throw TypeError(`Unsupported compression format: '${e}'. Supported formats: 'gzip', 'deflate', 'deflate-raw'.`);return e}const ei=typeof globalThis.CompressionStream==`function`&&typeof globalThis.DecompressionStream==`function`;let ti=!1,ni,ri,ii,ai,oi,si;async function loadZlib(){if(ti)return;let e=await Promise.resolve().then(()=>(Qr(),qr));ni=e.gzipSync,ri=e.gunzipSync,ii=e.deflateSync,ai=e.inflateSync,oi=e.deflateRawSync,si=e.inflateRawSync,ti=!0}function getCompressFn(e){switch(e){case`gzip`:return e=>ni(e);case`deflate`:return e=>ii(e);case`deflate-raw`:return e=>oi(e)}}function getDecompressFn(e){switch(e){case`gzip`:return e=>ri(e);case`deflate`:return e=>ai(e);case`deflate-raw`:return e=>si(e)}}let ci,li;if(ei)ci=globalThis.CompressionStream,li=globalThis.DecompressionStream;else{let e=loadZlib();ci=class CompressionStream{readable;writable;constructor(t){let n=validateFormat(t),r=new hr({async transform(t,r){try{await e,r.enqueue(getCompressFn(n)(t))}catch(e){r.error(e)}}});this.readable=r.readable,this.writable=r.writable}},li=class DecompressionStream{readable;writable;constructor(t){let n=validateFormat(t),r=new hr({async transform(t,r){try{await e,r.enqueue(getDecompressFn(n)(t))}catch(e){r.error(e)}}});this.readable=r.readable,this.writable=r.writable}}}const ui=globalThis;globalThis.CompressionStream===void 0&&(ui.CompressionStream=ci),globalThis.DecompressionStream===void 0&&(ui.DecompressionStream=li);const di=globalThis;globalThis.DOMException===void 0&&(di.DOMException=Be);const fi=globalThis;globalThis.ByteLengthQueuingStrategy===void 0&&(fi.ByteLengthQueuingStrategy=gr),globalThis.CountQueuingStrategy===void 0&&(fi.CountQueuingStrategy=_r);const pi=globalThis;function isNativeStreamUsable$2(e,t){try{return typeof e==`function`?typeof e.prototype?.[t]==`function`:!1}catch{return!1}}__name(isNativeStreamUsable$2,`isNativeStreamUsable`),isNativeStreamUsable$2(globalThis.ReadableStream,`getReader`)||(pi.ReadableStream=pr),pi.ReadableStreamBYOBReader===void 0&&(pi.ReadableStreamBYOBReader=ReadableStreamBYOBReader),pi.ReadableStreamBYOBRequest===void 0&&(pi.ReadableStreamBYOBRequest=ReadableStreamBYOBRequest),pi.ReadableByteStreamController===void 0&&(pi.ReadableByteStreamController=ReadableByteStreamController),pi.ReadableStreamDefaultController===void 0&&(pi.ReadableStreamDefaultController=ReadableStreamDefaultController),pi.ReadableStreamDefaultReader===void 0&&(pi.ReadableStreamDefaultReader=ReadableStreamDefaultReader);const mi=globalThis;globalThis.TextEncoderStream===void 0&&(mi.TextEncoderStream=vr),globalThis.TextDecoderStream===void 0&&(mi.TextDecoderStream=yr);function isNativeStreamUsable$1(e,t){try{return typeof e==`function`?typeof e.prototype?.[t]==`function`:!1}catch{return!1}}if(__name(isNativeStreamUsable$1,`isNativeStreamUsable`),!isNativeStreamUsable$1(globalThis.TransformStream,`readable`)){let e=globalThis;e.TransformStream=hr}function isNativeStreamUsable(e,t){try{return typeof e==`function`?typeof e.prototype?.[t]==`function`:!1}catch{return!1}}if(!isNativeStreamUsable(globalThis.WritableStream,`getWriter`)){let e=globalThis;e.WritableStream=mr}var CryptoKey=class{type;extractable;algorithm;usages;_handle;constructor(e,t,n,r,i){this.type=e,this.extractable=t,this.algorithm=Object.freeze({...n}),this.usages=Object.freeze([...r]),this._handle=i}get[Symbol.toStringTag](){return`CryptoKey`}};function normalizeAlgorithm$1(e){if(typeof e==`string`)return{name:e};if(!e||typeof e.name!=`string`)throw TypeError(`Algorithm must have a name property`);return e}__name(normalizeAlgorithm$1,`normalizeAlgorithm`);const hi={"SHA-1":`sha1`,"SHA-256":`sha256`,"SHA-384":`sha384`,"SHA-512":`sha512`};function toNodeHashName(e){let t=hi[e.toUpperCase()]||hi[e];if(!t)throw new Be(`Unrecognized hash name: ${e}`,`NotSupportedError`);return t}const gi={"P-256":`prime256v1`,"P-384":`secp384r1`,"P-521":`secp521r1`};function toNodeCurveName(e){let t=gi[e];if(!t)throw new Be(`Unrecognized curve name: ${e}`,`NotSupportedError`);return t}function hashSize$1(e){switch(toNodeHashName(e)){case`sha1`:return 20;case`sha256`:return 32;case`sha384`:return 48;case`sha512`:return 64;default:throw new Be(`Unsupported hash: ${e}`,`NotSupportedError`)}}__name(hashSize$1,`hashSize`);function validateUsages(e,t){for(let n of e)if(!t.includes(n))throw new Be(`Invalid key usage: ${n}`,`SyntaxError`);if(e.length===0)throw new Be(`Key usages must not be empty`,`SyntaxError`)}function checkUsage(e,t){if(!e.usages.includes(t))throw new Be(`Key does not support the '${t}' usage`,`InvalidAccessError`)}const _i=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,vi=new Uint8Array(128);for(let e=0;e<64;e++)vi[_i.charCodeAt(e)]=e;function bytesToBase64(e){let t=``,n=e.length;for(let r=0;r<n;r+=3){let i=e[r],a=r+1<n?e[r+1]:0,o=r+2<n?e[r+2]:0;t+=_i[i>>2&63],t+=_i[(i<<4|a>>4)&63],t+=r+1<n?_i[(a<<2|o>>6)&63]:`=`,t+=r+2<n?_i[o&63]:`=`}return t}function base64ToBytes(e){let t=e;for(;t.endsWith(`=`);)t=t.slice(0,-1);let n=[],r=0,i=0;for(let e=0;e<t.length;e++)i=i<<6|vi[t.charCodeAt(e)],r+=6,r>=8&&(r-=8,n.push(i>>r&255));return new Uint8Array(n)}function base64urlEncode(e){return bytesToBase64(e).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/,``)}function base64urlDecode(e){let t=e.replace(/-/g,`+`).replace(/_/g,`/`);for(;t.length%4;)t+=`=`;return base64ToBytes(t)}function toUint8Array(e){if(e instanceof Uint8Array)return e;if(e instanceof ArrayBuffer)return new Uint8Array(e);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw TypeError(`Expected BufferSource`)}function gmul(e,t){let n=0;for(let r=0;r<8;r++){t&1&&(n^=e);let r=e&128;e=e<<1&255,r&&(e^=27),t>>=1}return n}function keyExpansion(e){let t=e.length/4,n=t+6,r=4*(n+1),i=Array.from({length:r});for(let n=0;n<t;n++)i[n]=new Uint8Array([e[4*n],e[4*n+1],e[4*n+2],e[4*n+3]]);for(let e=t;e<r;e++){let n=new Uint8Array(i[e-1]);e%t===0?n=new Uint8Array([yi[n[1]]^xi[e/t-1],yi[n[2]],yi[n[3]],yi[n[0]]]):t>6&&e%t===4&&(n=new Uint8Array([yi[n[0]],yi[n[1]],yi[n[2]],yi[n[3]]])),i[e]=new Uint8Array(4);for(let r=0;r<4;r++)i[e][r]=i[e-t][r]^n[r]}let a=[];for(let e=0;e<=n;e++){let t=new Uint8Array(16);for(let n=0;n<4;n++)t[4*n]=i[4*e+n][0],t[4*n+1]=i[4*e+n][1],t[4*n+2]=i[4*e+n][2],t[4*n+3]=i[4*e+n][3];a.push(t)}return a}function aesEncryptBlock(e,t){let n=new Uint8Array(e),r=t.length-1;for(let e=0;e<16;e++)n[e]^=t[0][e];for(let e=1;e<r;e++){for(let e=0;e<16;e++)n[e]=yi[n[e]];let r=n[1];n[1]=n[5],n[5]=n[9],n[9]=n[13],n[13]=r;let i=n[2],a=n[6];n[2]=n[10],n[6]=n[14],n[10]=i,n[14]=a;let o=n[15];n[15]=n[11],n[11]=n[7],n[7]=n[3],n[3]=o;for(let e=0;e<4;e++){let t=e*4,r=n[t],i=n[t+1],a=n[t+2],o=n[t+3];n[t]=gmul(2,r)^gmul(3,i)^a^o,n[t+1]=r^gmul(2,i)^gmul(3,a)^o,n[t+2]=r^i^gmul(2,a)^gmul(3,o),n[t+3]=gmul(3,r)^i^a^gmul(2,o)}for(let r=0;r<16;r++)n[r]^=t[e][r]}for(let e=0;e<16;e++)n[e]=yi[n[e]];let i=n[1];n[1]=n[5],n[5]=n[9],n[9]=n[13],n[13]=i;let a=n[2],o=n[6];n[2]=n[10],n[6]=n[14],n[10]=a,n[14]=o;let s=n[15];n[15]=n[11],n[11]=n[7],n[7]=n[3],n[3]=s;for(let e=0;e<16;e++)n[e]^=t[r][e];return n}function aesDecryptBlock(e,t){let n=new Uint8Array(e),r=t.length-1;for(let e=0;e<16;e++)n[e]^=t[r][e];for(let e=r-1;e>0;e--){let r=n[13];n[13]=n[9],n[9]=n[5],n[5]=n[1],n[1]=r;let i=n[10],a=n[14];n[10]=n[2],n[14]=n[6],n[2]=i,n[6]=a;let o=n[3];n[3]=n[7],n[7]=n[11],n[11]=n[15],n[15]=o;for(let e=0;e<16;e++)n[e]=bi[n[e]];for(let r=0;r<16;r++)n[r]^=t[e][r];for(let e=0;e<4;e++){let t=e*4,r=n[t],i=n[t+1],a=n[t+2],o=n[t+3];n[t]=gmul(14,r)^gmul(11,i)^gmul(13,a)^gmul(9,o),n[t+1]=gmul(9,r)^gmul(14,i)^gmul(11,a)^gmul(13,o),n[t+2]=gmul(13,r)^gmul(9,i)^gmul(14,a)^gmul(11,o),n[t+3]=gmul(11,r)^gmul(13,i)^gmul(9,a)^gmul(14,o)}}let i=n[13];n[13]=n[9],n[9]=n[5],n[5]=n[1],n[1]=i;let a=n[10],o=n[14];n[10]=n[2],n[14]=n[6],n[2]=a,n[6]=o;let s=n[3];n[3]=n[7],n[7]=n[11],n[11]=n[15],n[15]=s;for(let e=0;e<16;e++)n[e]=bi[n[e]];for(let e=0;e<16;e++)n[e]^=t[0][e];return n}function incrementCounter(e){for(let t=15;t>=0&&++e[t]===0;t--);}function gcmIncrementCounter(e){for(let t=15;t>=12&&++e[t]===0;t--);}function gfMul(e,t){let n=new Uint8Array(16),r=new Uint8Array(e);for(let e=0;e<128;e++){if(t[e>>>3]&1<<7-(e&7))for(let e=0;e<16;e++)n[e]^=r[e];let i=r[15]&1;for(let e=15;e>0;e--)r[e]=r[e]>>>1|(r[e-1]&1)<<7;r[0]>>>=1,i&&(r[0]^=225)}return n}function ghash(e,t,n){let r=new Uint8Array(16),i=Math.ceil(t.length/16)||0;for(let n=0;n<i;n++){let i=n*16,a=Math.min(i+16,t.length);for(let e=0;e<16;e++){let n=i+e;n<a&&(r[e]^=t[n])}let o=gfMul(r,e);r.set(o)}let a=Math.ceil(n.length/16)||0;for(let t=0;t<a;t++){let i=t*16,a=Math.min(i+16,n.length);for(let e=0;e<16;e++){let t=i+e;t<a&&(r[e]^=n[t])}let o=gfMul(r,e);r.set(o)}let o=new Uint8Array(16),s=t.length*8,c=n.length*8,l=Math.floor(s/4294967296),u=s>>>0;o[0]=l>>>24&255,o[1]=l>>>16&255,o[2]=l>>>8&255,o[3]=l&255,o[4]=u>>>24&255,o[5]=u>>>16&255,o[6]=u>>>8&255,o[7]=u&255;let d=Math.floor(c/4294967296),p=c>>>0;o[8]=d>>>24&255,o[9]=d>>>16&255,o[10]=d>>>8&255,o[11]=d&255,o[12]=p>>>24&255,o[13]=p>>>16&255,o[14]=p>>>8&255,o[15]=p&255;for(let e=0;e<16;e++)r[e]^=o[e];let m=gfMul(r,e);return r.set(m),r}var yi,bi,xi,Si=__esmMin(()=>{yi=new Uint8Array([99,124,119,123,242,107,111,197,48,1,103,43,254,215,171,118,202,130,201,125,250,89,71,240,173,212,162,175,156,164,114,192,183,253,147,38,54,63,247,204,52,165,229,241,113,216,49,21,4,199,35,195,24,150,5,154,7,18,128,226,235,39,178,117,9,131,44,26,27,110,90,160,82,59,214,179,41,227,47,132,83,209,0,237,32,252,177,91,106,203,190,57,74,76,88,207,208,239,170,251,67,77,51,133,69,249,2,127,80,60,159,168,81,163,64,143,146,157,56,245,188,182,218,33,16,255,243,210,205,12,19,236,95,151,68,23,196,167,126,61,100,93,25,115,96,129,79,220,34,42,144,136,70,238,184,20,222,94,11,219,224,50,58,10,73,6,36,92,194,211,172,98,145,149,228,121,231,200,55,109,141,213,78,169,108,86,244,234,101,122,174,8,186,120,37,46,28,166,180,198,232,221,116,31,75,189,139,138,112,62,181,102,72,3,246,14,97,53,87,185,134,193,29,158,225,248,152,17,105,217,142,148,155,30,135,233,206,85,40,223,140,161,137,13,191,230,66,104,65,153,45,15,176,84,187,22]),bi=new Uint8Array([82,9,106,213,48,54,165,56,191,64,163,158,129,243,215,251,124,227,57,130,155,47,255,135,52,142,67,68,196,222,233,203,84,123,148,50,166,194,35,61,238,76,149,11,66,250,195,78,8,46,161,102,40,217,36,178,118,91,162,73,109,139,209,37,114,248,246,100,134,104,152,22,212,164,92,204,93,101,182,146,108,112,72,80,253,237,185,218,94,21,70,87,167,141,157,132,144,216,171,0,140,188,211,10,247,228,88,5,184,179,69,6,208,44,30,143,202,63,15,2,193,175,189,3,1,19,138,107,58,145,17,65,79,103,220,234,151,242,207,206,240,180,230,115,150,172,116,34,231,173,53,133,226,249,55,232,28,117,223,110,71,241,26,113,29,41,197,137,111,183,98,14,170,24,190,27,252,86,62,75,198,210,121,32,154,219,192,254,120,205,90,244,31,221,168,51,136,7,199,49,177,18,16,89,39,128,236,95,96,81,127,169,25,181,74,13,45,229,122,159,147,201,156,239,160,224,59,77,174,42,245,176,200,235,187,60,131,83,153,97,23,43,4,126,186,119,214,38,225,105,20,99,85,33,12,125]),xi=[1,2,4,8,16,32,64,128,27,54]});function parseAlgorithm(e){let t=e.toLowerCase().match(/^aes-(128|192|256)-(cbc|ctr|ecb|cfb|ofb|gcm)$/);if(!t)throw Error(`Unsupported cipher algorithm: ${e}`);let n=parseInt(t[1]),r=t[2];return{keySize:n/8,ivSize:r===`ecb`?0:r===`gcm`?12:16,mode:r}}function toBuffer$2(e,t){return typeof e==`string`?q.from(e,t||`utf8`):q.from(e)}function encodeOutput(e,t){return t?q.from(e).toString(t):q.from(e)}function incompleteUtf8Tail(e){if(e.length===0)return 0;let t=e.length;for(let n=1;n<=Math.min(4,t);n++){let r=e[t-n];if(!(r&128))return 0;if((r&192)==128)continue;let i;if((r&224)==192)i=2;else if((r&240)==224)i=3;else if((r&248)==240)i=4;else return 0;return n<i?n:0}return 0}function pkcs7Pad(e){let t=16-e.length%16,n=new Uint8Array(e.length+t);n.set(e);for(let r=e.length;r<n.length;r++)n[r]=t;return n}function pkcs7Unpad(e){if(e.length===0||e.length%16!=0)throw Error(`bad decrypt`);let t=e[e.length-1];if(t===0||t>16)throw Error(`bad decrypt`);for(let n=e.length-t;n<e.length;n++)if(e[n]!==t)throw Error(`bad decrypt`);return new Uint8Array(e.slice(0,e.length-t))}var Ci=__esmMin(()=>{J(),__name(toBuffer$2,`toBuffer`)});function createCipher(e,t){throw Error(`crypto.createCipher() is deprecated. Use createCipheriv() instead.`)}function createCipheriv(e,t,n){return new Cipher(e,typeof t==`string`?q.from(t):new Uint8Array(t),n==null?null:typeof n==`string`?q.from(n):new Uint8Array(n))}function createDecipher(e,t){throw Error(`crypto.createDecipher() is deprecated. Use createDecipheriv() instead.`)}function createDecipheriv(e,t,n){return new Decipher(e,typeof t==`string`?q.from(t):new Uint8Array(t),n==null?null:typeof n==`string`?q.from(n):new Uint8Array(n))}function getCiphers(){return[`aes-128-cbc`,`aes-128-ecb`,`aes-192-cbc`,`aes-192-ecb`,`aes-256-cbc`,`aes-256-ecb`,`aes-128-ctr`,`aes-192-ctr`,`aes-256-ctr`,`aes-128-cfb`,`aes-192-cfb`,`aes-256-cfb`,`aes-128-gcm`,`aes-192-gcm`,`aes-256-gcm`]}var CipherBase,Cipher,Decipher,wi=__esmMin(()=>{Si(),Ci(),J(),CipherBase=class{_roundKeys;_iv;_mode;_buffer=new Uint8Array;_autoPadding=!0;_finalized=!1;constructor(e,t,n){let r=parseAlgorithm(e);if(t.length!==r.keySize)throw Error(`Invalid key length ${t.length}, expected ${r.keySize} for ${e}`);if(r.ivSize>0&&(!n||n.length!==r.ivSize))throw Error(`Invalid IV length ${n?.length??0}, expected ${r.ivSize} for ${e}`);this._roundKeys=keyExpansion(t),this._iv=n?new Uint8Array(n):new Uint8Array(16),this._mode=r.mode}setAutoPadding(e){return this._autoPadding=e,this}},Cipher=class extends CipherBase{_prevBlock;_counter;_gcmH=null;_gcmJ0=null;_gcmAAD=new Uint8Array;_gcmCiphertext=[];_gcmCiphertextLen=0;_gcmAuthTag=null;_gcmAADSet=!1;constructor(e,t,n){super(e,t,n),this._prevBlock=new Uint8Array(this._iv),this._mode===`gcm`?(this._gcmH=aesEncryptBlock(new Uint8Array(16),this._roundKeys),this._gcmJ0=new Uint8Array(16),this._gcmJ0.set(this._iv.subarray(0,12)),this._gcmJ0[15]=1,this._counter=new Uint8Array(this._gcmJ0),gcmIncrementCounter(this._counter)):this._counter=new Uint8Array(this._iv)}setAAD(e){if(this._mode!==`gcm`)throw Error(`setAAD is only supported in GCM mode`);if(this._gcmCiphertextLen>0)throw Error(`setAAD must be called before update()`);return this._gcmAAD=new Uint8Array(e),this._gcmAADSet=!0,this}getAuthTag(){if(this._mode!==`gcm`)throw Error(`getAuthTag is only supported in GCM mode`);if(!this._gcmAuthTag)throw Error(`getAuthTag must be called after final()`);return q.from(this._gcmAuthTag)}update(e,t,n){let r=toBuffer$2(e,t),i=new Uint8Array(this._buffer.length+r.length);if(i.set(this._buffer),i.set(r,this._buffer.length),this._mode===`gcm`){let e=this._processGcmEncrypt(i);return this._buffer=new Uint8Array,encodeOutput(e,n)}if(this._mode===`ctr`||this._mode===`cfb`||this._mode===`ofb`){let e=this._processStream(i);return this._buffer=new Uint8Array,encodeOutput(e,n)}let a=Math.floor(i.length/16)*16,o=[];for(let e=0;e<a;e+=16){let t=i.slice(e,e+16);o.push(this._encryptBlock(t))}this._buffer=i.slice(a);let s=new Uint8Array(o.length*16);for(let e=0;e<o.length;e++)s.set(o[e],e*16);return encodeOutput(s,n)}final(e){if(this._finalized)throw Error(`Cipher already finalized`);if(this._finalized=!0,this._mode===`gcm`){let t=new Uint8Array;this._buffer.length>0&&(t=this._processGcmEncrypt(this._buffer),this._buffer=new Uint8Array);let n=new Uint8Array(this._gcmCiphertextLen),r=0;for(let e of this._gcmCiphertext)n.set(e,r),r+=e.length;let i=ghash(this._gcmH,this._gcmAAD,n),a=aesEncryptBlock(this._gcmJ0,this._roundKeys),o=new Uint8Array(16);for(let e=0;e<16;e++)o[e]=i[e]^a[e];return this._gcmAuthTag=q.from(o),encodeOutput(t,e)}if(this._mode===`ctr`||this._mode===`cfb`||this._mode===`ofb`){if(this._buffer.length>0){let t=this._processStream(this._buffer);return this._buffer=new Uint8Array,encodeOutput(t,e)}return encodeOutput(new Uint8Array,e)}let t=this._buffer;if(this._autoPadding)t=pkcs7Pad(t);else if(t.length%16!=0)throw Error(`data not multiple of block size`);let n=[];for(let e=0;e<t.length;e+=16)n.push(this._encryptBlock(t.slice(e,e+16)));if(this._buffer=new Uint8Array,n.length===0)return encodeOutput(new Uint8Array,e);let r=new Uint8Array(n.length*16);for(let e=0;e<n.length;e++)r.set(n[e],e*16);return encodeOutput(r,e)}_encryptBlock(e){if(this._mode===`cbc`){let t=new Uint8Array(16);for(let n=0;n<16;n++)t[n]=e[n]^this._prevBlock[n];let n=aesEncryptBlock(t,this._roundKeys);return this._prevBlock=n,n}else if(this._mode===`ecb`)return aesEncryptBlock(e,this._roundKeys);throw Error(`Block encryption not supported for mode: ${this._mode}`)}_processStream(e){let t=new Uint8Array(e.length);for(let n=0;n<e.length;n+=16){let r=aesEncryptBlock(this._counter,this._roundKeys),i=Math.min(16,e.length-n);for(let a=0;a<i;a++)t[n+a]=e[n+a]^r[a];incrementCounter(this._counter)}return t}_processGcmEncrypt(e){let t=new Uint8Array(e.length);for(let n=0;n<e.length;n+=16){let r=aesEncryptBlock(this._counter,this._roundKeys),i=Math.min(16,e.length-n);for(let a=0;a<i;a++)t[n+a]=e[n+a]^r[a];gcmIncrementCounter(this._counter)}return this._gcmCiphertext.push(new Uint8Array(t)),this._gcmCiphertextLen+=t.length,t}},Decipher=class extends CipherBase{_prevBlock;_counter;_pendingUtf8=new Uint8Array;_gcmH=null;_gcmJ0=null;_gcmAAD=new Uint8Array;_gcmCiphertext=[];_gcmCiphertextLen=0;_gcmExpectedTag=null;_gcmAADSet=!1;constructor(e,t,n){super(e,t,n),this._prevBlock=new Uint8Array(this._iv),this._mode===`gcm`?(this._gcmH=aesEncryptBlock(new Uint8Array(16),this._roundKeys),this._gcmJ0=new Uint8Array(16),this._gcmJ0.set(this._iv.subarray(0,12)),this._gcmJ0[15]=1,this._counter=new Uint8Array(this._gcmJ0),gcmIncrementCounter(this._counter)):this._counter=new Uint8Array(this._iv)}setAAD(e){if(this._mode!==`gcm`)throw Error(`setAAD is only supported in GCM mode`);if(this._gcmCiphertextLen>0)throw Error(`setAAD must be called before update()`);return this._gcmAAD=new Uint8Array(e),this._gcmAADSet=!0,this}setAuthTag(e){if(this._mode!==`gcm`)throw Error(`setAuthTag is only supported in GCM mode`);return this._gcmExpectedTag=q.from(e),this}_encodeWithUtf8Handling(e,t,n){if(!t||t!==`utf8`&&t!==`utf-8`)return encodeOutput(e,t);let r;if(this._pendingUtf8.length>0?(r=new Uint8Array(this._pendingUtf8.length+e.length),r.set(this._pendingUtf8),r.set(e,this._pendingUtf8.length),this._pendingUtf8=new Uint8Array):r=e,!n){let e=incompleteUtf8Tail(r);e>0&&(this._pendingUtf8=new Uint8Array(r.slice(r.length-e)),r=new Uint8Array(r.slice(0,r.length-e)))}return q.from(r).toString(`utf8`)}update(e,t,n){let r=toBuffer$2(e,t),i=new Uint8Array(this._buffer.length+r.length);if(i.set(this._buffer),i.set(r,this._buffer.length),this._mode===`gcm`){this._gcmCiphertext.push(new Uint8Array(i)),this._gcmCiphertextLen+=i.length;let e=this._processGcmDecrypt(i);return this._buffer=new Uint8Array,this._encodeWithUtf8Handling(e,n,!1)}if(this._mode===`ctr`||this._mode===`cfb`||this._mode===`ofb`){let e=this._processStream(i);return this._buffer=new Uint8Array,this._encodeWithUtf8Handling(e,n,!1)}let a=Math.floor(i.length/16);if(a===0)return this._buffer=i,this._encodeWithUtf8Handling(new Uint8Array,n,!1);let o=(this._autoPadding?a-1:a)*16,s=[];for(let e=0;e<o;e+=16){let t=i.slice(e,e+16);s.push(this._decryptBlock(t))}this._buffer=i.slice(o);let c=new Uint8Array(s.length*16);for(let e=0;e<s.length;e++)c.set(s[e],e*16);return this._encodeWithUtf8Handling(c,n,!1)}final(e){if(this._finalized)throw Error(`Decipher already finalized`);if(this._finalized=!0,this._mode===`gcm`){let t=new Uint8Array;if(this._buffer.length>0&&(this._gcmCiphertext.push(new Uint8Array(this._buffer)),this._gcmCiphertextLen+=this._buffer.length,t=this._processGcmDecrypt(this._buffer),this._buffer=new Uint8Array),!this._gcmExpectedTag)throw Error(`Unsupported state or unable to authenticate data`);let n=new Uint8Array(this._gcmCiphertextLen),r=0;for(let e of this._gcmCiphertext)n.set(e,r),r+=e.length;let i=ghash(this._gcmH,this._gcmAAD,n),a=aesEncryptBlock(this._gcmJ0,this._roundKeys),o=new Uint8Array(16);for(let e=0;e<16;e++)o[e]=i[e]^a[e];let s=this._gcmExpectedTag,c=Math.min(s.length,16),l=0;for(let e=0;e<c;e++)l|=o[e]^s[e];if(l!==0)throw Error(`Unsupported state or unable to authenticate data`);return this._encodeWithUtf8Handling(t,e,!0)}if(this._mode===`ctr`||this._mode===`cfb`||this._mode===`ofb`){if(this._buffer.length>0){let t=this._processStream(this._buffer);return this._buffer=new Uint8Array,this._encodeWithUtf8Handling(t,e,!0)}return this._encodeWithUtf8Handling(new Uint8Array,e,!0)}if(this._buffer.length===0)return this._encodeWithUtf8Handling(new Uint8Array,e,!0);if(this._buffer.length%16!=0)throw Error(`bad decrypt`);let t=[];for(let e=0;e<this._buffer.length;e+=16)t.push(this._decryptBlock(this._buffer.slice(e,e+16)));let n=new Uint8Array(t.length*16);for(let e=0;e<t.length;e++)n.set(t[e],e*16);let r=this._autoPadding?pkcs7Unpad(n):n;return this._buffer=new Uint8Array,this._encodeWithUtf8Handling(r,e,!0)}_decryptBlock(e){if(this._mode===`cbc`){let t=aesDecryptBlock(e,this._roundKeys),n=new Uint8Array(16);for(let e=0;e<16;e++)n[e]=t[e]^this._prevBlock[e];return this._prevBlock=new Uint8Array(e),n}else if(this._mode===`ecb`)return aesDecryptBlock(e,this._roundKeys);throw Error(`Block decryption not supported for mode: ${this._mode}`)}_processStream(e){let t=new Uint8Array(e.length);for(let n=0;n<e.length;n+=16){let r=aesEncryptBlock(this._counter,this._roundKeys),i=Math.min(16,e.length-n);for(let a=0;a<i;a++)t[n+a]=e[n+a]^r[a];incrementCounter(this._counter)}return t}_processGcmDecrypt(e){let t=new Uint8Array(e.length);for(let n=0;n<e.length;n+=16){let r=aesEncryptBlock(this._counter,this._roundKeys),i=Math.min(16,e.length-n);for(let a=0;a<i;a++)t[n+a]=e[n+a]^r[a];gcmIncrementCounter(this._counter)}return t}}}),Ti,Ei=__esmMin(()=>{Ti={RSA_PKCS1_PADDING:1,RSA_NO_PADDING:3,RSA_PKCS1_OAEP_PADDING:4,RSA_PKCS1_PSS_PADDING:6,DH_CHECK_P_NOT_SAFE_PRIME:2,DH_CHECK_P_NOT_PRIME:1,DH_UNABLE_TO_CHECK_GENERATOR:4,DH_NOT_SUITABLE_GENERATOR:8}});function fillRandom(e){if(Di)for(let t=0;t<e.length;t+=65536){let n=Math.min(e.length-t,65536),r=new Uint8Array(e.buffer,e.byteOffset+t,n);globalThis.crypto.getRandomValues(r)}else try{let t=imports.gi.GLib;for(let n=0;n<e.length;n++)e[n]=t.random_int_range(0,256)}catch{for(let t=0;t<e.length;t++)e[t]=Math.floor(Math.random()*256)}}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=q.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,q.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 q,e.byteOffset);fillRandom(new Uint8Array(e.buffer,n+t,r))}return e}function randomFill(e,t,n,r){let i,a,o;typeof t==`function`?(o=t,i=0,a=e.length):typeof n==`function`?(o=n,i=t,a=e.length-t):(o=r,i=t,a=n);try{randomFillSync(e,i,a),o(null,e)}catch(t){o(t,e)}}function randomUUID(){if(Di&&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,a;if(typeof t==`function`?(a=t,i=e,r=0):typeof t==`number`?(r=e,i=t,a=n):(i=e,r=0,a=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 o=i-r,s=new Uint32Array(1);fillRandom(new Uint8Array(s.buffer));let c=r+s[0]%o;if(a)a(null,c);else return c}var Di,Oi=__esmMin(()=>{J(),Di=globalThis.crypto!==void 0&&typeof globalThis.crypto.getRandomValues==`function`});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 ki=__esmMin(()=>{});function bigIntToBuffer(e){if(e===0n)return q.from([0]);let t=e.toString(16);return t.length%2!=0&&(t=`0`+t),q.from(t,`hex`)}function bufferToBigInt(e){if(e.length===0)return 0n;let t=q.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 ji){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 a=!0;for(let t=0;t<n-1;t++)if(i=modPow(i,2n,e),i===e-1n){a=!1;break}if(a)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 Mi)return Mi[n];let r=checkPrime(e,t);return Mi[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?q.from([140,123]):q.from([140,39]);let r=Math.ceil(e/8),i=2n,a=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+=a;else if(n===5n)for(;t%10n!=3n;)t+=a;let o=t>>1n;if(simpleSieve(o)&&simpleSieve(t)&&fermatTest(o)&&fermatTest(t)&&millerRabinTest(o)&&millerRabinTest(t))return bigIntToBuffer(t)}}function createDiffieHellman(e,t,n,r){if(t!==void 0&&typeof t!=`number`&&(q.isBuffer(t)||t instanceof Uint8Array||typeof t==`string`&&!(t in Ni)))return createDiffieHellman(e,`binary`,t,n);let i=t||`binary`,a=r||`binary`,o=q.from([2]);if(n!==void 0&&(typeof n==`number`?(o=q.alloc(1),o[0]=n):o=q.isBuffer(n)?n:q.from(n,a)),typeof e==`number`)return new DiffieHellman(generatePrime(e,o),o,!0);let s;return s=q.isBuffer(e)?e:e instanceof Uint8Array?q.from(e):q.from(e,i),new DiffieHellman(s,o,!0)}function getDiffieHellman(e){let t=Ai[e];if(!t)throw Error(`Unknown group: ${e}. Supported groups: ${Object.keys(Ai).join(`, `)}`);return new DiffieHellman(q.from(t.prime,`hex`),q.from(t.gen,`hex`),!1)}var Ai,ji,Mi,DiffieHellman,Ni,Pi,Fi,Ii=__esmMin(()=>{ki(),Oi(),J(),Ai={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`}},ji=[];{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]||ji.push(n)}Mi={},__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`?q.from(e,t||`utf8`):q.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 a=bigIntToBuffer(modPow(i,this._privKey,this._prime)),o=this._primeByteLength;if(a.length<o){let e=q.alloc(o);a.copy(e,o-a.length),a=e}return n?a.toString(n):a}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`?q.from(e,t||`utf8`):q.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`?q.from(e,t||`utf8`):q.from(e);this._privKey=bufferToBigInt(n)}},Ni={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},Pi=getDiffieHellman,Fi=getDiffieHellman});function mod(e,t){let n=e%t;return n<0n?n+t:n}function modInverse$2(e,t){if(e=mod(e,t),e===0n)throw Error(`No modular inverse for zero`);let[n,r]=[e,t],[i,a]=[1n,0n];for(;r!==0n;){let e=n/r;[n,r]=[r,n-e*r],[i,a]=[a,i-e*a]}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),a=mod(mod(t.y-e.y,r)*modInverse$2(i,r),r),o=mod(a*a-e.x-t.x,r);return{x:o,y:mod(a*(e.x-o)-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$2(mod(2n*e.y,r),r),r),a=mod(i*i-2n*e.x,r);return{x:a,y:mod(i*(e.x-a)-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,a=t,o=e.toString(2);for(let e=0;e<o.length;e++)o[e]===`1`?(i=pointAdd(i,a,n),a=pointDouble(a,n)):(a=pointAdd(i,a,n),i=pointDouble(i,n));return i}function bigintToBuffer(e,t){let n=e.toString(16).padStart(t*2,`0`);return q.from(n,`hex`)}function bufferToBigint(e){let t=q.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 q.concat([q.from([t]),r])}let i=bigintToBuffer(e.y,t);if(n===`hybrid`){let t=e.y%2n==0n?6:7;return q.concat([q.from([t]),r,i])}return q.concat([q.from([4]),r,i])}function decodePublicKey(e,t){let n=q.from(e);if(n.length===0)throw Error(`Invalid public key: empty buffer`);let r=n[0],{p:i,a,b:o,byteLength:s}=t;if(r===4||r===6||r===7){if(n.length!==1+2*s)throw Error(`Invalid public key length: expected ${1+2*s} bytes, got ${n.length}`);let e=bufferToBigint(n.subarray(1,1+s)),t=bufferToBigint(n.subarray(1+s));if(mod(t*t,i)!==mod(e*e*e+a*e+o,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+s)throw Error(`Invalid public key length: expected ${1+s} bytes, got ${n.length}`);let e=bufferToBigint(n.subarray(1,1+s)),t=sqrtMod(mod(e*e*e+a*e+o,i),i);if(t===null)throw Error(`Invalid public key: no valid y coordinate for the given x`);let c=r===3;return{x:e,y:t%2n!=0n===c?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 a=n,o=modPow(i,r,t),s=modPow(e,r,t),c=modPow(e,(r+1n)/2n,t);for(;;){if(s===0n)return 0n;if(s===1n)return c;let e=1n,n=mod(s*s,t);for(;n!==1n;)n=mod(n*n,t),e++;let r=modPow(o,modPow(2n,a-e-1n,t-1n),t);a=e,o=mod(r*r,t),s=mod(s*o,t),c=mod(c*r,t)}}function toBuffer$1(e,t){if(q.isBuffer(e))return e;if(e instanceof Uint8Array)return q.from(e);if(typeof e==`string`)return q.from(e,t||`utf8`);if(ArrayBuffer.isView(e))return q.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=Ri[e.toLowerCase()];if(!t)throw Error(`Unsupported curve: ${e}`);let n=Li[t];if(!n)throw Error(`Unsupported curve: ${e}`);return{canonical:t,params:n}}function createECDH(e){return new ECDH(e)}function getCurves(){return[`secp256k1`,`prime256v1`,`secp256r1`,`secp384r1`,`secp521r1`]}var Li,Ri,ECDH,zi=__esmMin(()=>{ki(),Oi(),J(),Li={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}},Ri={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`},__name(modInverse$2,`modInverse`),__name(toBuffer$1,`toBuffer`),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 a={x:this._curve.Gx,y:this._curve.Gy};return this._publicKey=scalarMul(i,a,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$1(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$1(e,t);this._publicKey=decodePublicKey(n,this._curve)}setPrivateKey(e,t){let n=bufferToBigint(toBuffer$1(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)}}});function normalizeAlgorithm(e){return e.toLowerCase().replace(/-/g,``)}function hashSize(e){let t=Bi[normalizeAlgorithm(e)];if(t===void 0)throw Error(`Unknown hash algorithm: ${e}`);return t}function toBuffer(e,t){return typeof e==`string`?q.from(e,t||`utf8`):e instanceof DataView?q.from(e.buffer,e.byteOffset,e.byteLength):(e instanceof ArrayBuffer,q.from(e))}var Bi,Vi,Hi,Ui=__esmMin(()=>{J(),Bi={md5:16,sha1:20,sha256:32,sha384:48,sha512:64},Vi={md5:64,sha1:64,sha256:64,sha384:128,sha512:128},Hi=new Set([`md5`,`sha1`,`sha256`,`sha384`,`sha512`])});function getChecksumType(e){let t=Wi[normalizeAlgorithm(e)];if(t===void 0){let t=Error(`Unknown message digest: ${e}`);throw t.code=`ERR_CRYPTO_HASH_UNKNOWN`,t}return t}function getHashes(){return[`md5`,`sha1`,`sha256`,`sha384`,`sha512`]}function hash(e,t,n){return new Gi(e).update(t).digest(n)}var Wi,Gi,Ki=__esmMin(()=>{Ui(),J(),A(),Gr(),Wi={md5:k.ChecksumType.MD5,sha1:k.ChecksumType.SHA1,sha256:k.ChecksumType.SHA256,sha384:k.ChecksumType.SHA384,sha512:k.ChecksumType.SHA512},Gi=class Hash extends Hr{_algorithm;_checksum;_finalized=!1;constructor(e){super();let t=normalizeAlgorithm(e),n=getChecksumType(t);this._algorithm=t,this._checksum=new k.Checksum(n)}update(e,t){if(this._finalized)throw Error(`Digest already called`);let n;if(typeof e==`string`){let r=normalizeEncoding(t);n=q.from(e,r)}else n=e instanceof Uint8Array?e:q.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=q.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 Hr.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,qi=__esmMin(()=>{Ui(),Ki(),J(),Gr(),Hmac=class extends Hr{_algorithm;_innerHash;_outerKeyPad;_finalized=!1;constructor(e,t){super();let n=normalizeAlgorithm(e);if(!Hi.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`?q.from(t,`utf8`):t instanceof Uint8Array?t:q.from(t);let i=Vi[n];if(r.length>i){let e=new Gi(n);e.update(r),r=e.digest()}let a=new Uint8Array(i);a.set(r);let o=new Uint8Array(i),s=new Uint8Array(i);for(let e=0;e<i;e++)o[e]=a[e]^54,s[e]=a[e]^92;this._outerKeyPad=s,this._innerHash=new Gi(n),this._innerHash.update(o)}update(e,t){if(this._finalized)throw Error(`Digest already called`);let n;if(typeof e==`string`){let r=normalizeEncoding(t);n=q.from(e,r)}else n=e instanceof Uint8Array?e:q.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 Gi(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=Ri[e.toLowerCase()];if(!t)throw Error(`Unsupported curve: ${e}`);return Li[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,a=n.length,o=new Uint8Array(a).fill(1),s=new Uint8Array(a).fill(0),c=bigIntToBytes(t,i),l=bigIntToBytes(mod(truncateHash(n,r),r.n),i),u=new Uint8Array(a+1+i+i);u.set(o,0),u[a]=0,u.set(c,a+1),u.set(l,a+1+i),s=hmacDigest$2(e,s,u),o=hmacDigest$2(e,s,o);let d=new Uint8Array(a+1+i+i);d.set(o,0),d[a]=1,d.set(c,a+1),d.set(l,a+1+i),s=hmacDigest$2(e,s,d),o=hmacDigest$2(e,s,o);for(let t=0;t<100;t++){let t=new Uint8Array;for(;t.length<i;){o=hmacDigest$2(e,s,o);let n=new Uint8Array(t.length+o.length);n.set(t,0),n.set(o,t.length),t=n}let n=truncateHash(t.slice(0,i),r);if(n>=1n&&n<r.n)return n;let c=new Uint8Array(a+1);c.set(o,0),c[a]=0,s=hmacDigest$2(e,s,c),o=hmacDigest$2(e,s,o)}throw Error(`RFC 6979: failed to generate valid k after 100 attempts`)}function ecdsaSign(e,t,n,r){let i=getCurve(r),a={x:i.Gx,y:i.Gy},o=bytesToBigInt(t),s=new Gi(e);s.update(n);let c=new Uint8Array(s.digest()),l=truncateHash(c,i),u=rfc6979(e,o,c,i),d=scalarMul(u,a,i);if(d===null)throw Error(`ECDSA: k * G is point at infinity`);let p=mod(d.x,i.n);if(p===0n)throw Error(`ECDSA: r is zero`);let m=mod(modInverse$2(u,i.n)*(l+p*o),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 a=getCurve(i),o={x:a.Gx,y:a.Gy},s=a.byteLength;if(t[0]!==4||t.length!==1+s*2)return!1;let c={x:bytesToBigInt(t.slice(1,1+s)),y:bytesToBigInt(t.slice(1+s))};if(n.length!==s*2)return!1;let l=bytesToBigInt(n.slice(0,s)),u=bytesToBigInt(n.slice(s));if(l<1n||l>=a.n||u<1n||u>=a.n)return!1;let d=new Gi(e);d.update(r);let p=truncateHash(new Uint8Array(d.digest()),a),m=modInverse$2(u,a.n),h=mod(p*m,a.n),g=mod(l*m,a.n),_=pointAdd(scalarMul(h,o,a),scalarMul(g,c,a),a);return _===null?!1:mod(_.x,a.n)===l}var Ji=__esmMin(()=>{ki(),zi(),Ki(),qi(),__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 a=Math.ceil(r/i);if(a>255)throw Error(`HKDF cannot generate more than 255 * HashLen bytes`);let o=q.allocUnsafe(a*i),s=q.alloc(0);for(let r=1;r<=a;r++)s=hmacDigest$1(e,t,q.concat([s,n,q.from([r])])),s.copy(o,(r-1)*i);return q.from(o.buffer,o.byteOffset,r)}function hkdfSync(e,t,n,r,i){let a=normalizeAlgorithm(e),o=Bi[a];if(!Hi.has(a)||o===void 0)throw TypeError(`Unknown message digest: ${e}`);if(typeof i!=`number`||i<0)throw TypeError(`keylen must be a non-negative number`);let s=toBuffer(t),c=toBuffer(n),l=toBuffer(r),u=hkdfExpand(a,hkdfExtract(a,s,c.length===0?q.alloc(o,0):c),l,i,o),d=new ArrayBuffer(u.length);return new Uint8Array(d).set(u),d}function hkdf(e,t,n,r,i,a){setTimeout(()=>{try{a(null,hkdfSync(e,t,n,r,i))}catch(e){a(e instanceof Error?e:Error(String(e)))}},0)}var Yi=__esmMin(()=>{Ui(),qi(),J(),__name(hmacDigest$1,`hmacDigest`)});function timingSafeEqual(e,t){if(e.length!==t.length)throw RangeError(`Input buffers must have the same byte length`);let n=0;for(let r=0;r<e.length;r++)n|=e[r]^t[r];return n===0}var Xi=__esmMin(()=>{});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 a=toBuffer(e),o=toBuffer(t),s=normalizeAlgorithm(i||`sha1`),c=Bi[s];if(!Hi.has(s)||c===void 0)throw TypeError(`Unknown message digest: ${i||`sha1`}`);if(r===0)return q.alloc(0);let l=Math.ceil(r/c),u=q.allocUnsafe(l*c);for(let e=1;e<=l;e++){let t=q.allocUnsafe(o.length+4);o.copy(t,0),t.writeUInt32BE(e,o.length);let r=hmacDigest(s,a,t),i=q.from(r);for(let e=1;e<n;e++){r=hmacDigest(s,a,r);for(let e=0;e<c;e++)i[e]^=r[e]}i.copy(u,(e-1)*c)}return q.from(u.buffer,u.byteOffset,r)}function pbkdf2(e,t,n,r,i,a){validateParameters(n,r),setTimeout(()=>{try{a(null,pbkdf2Sync(e,t,n,r,i))}catch(e){a(e instanceof Error?e:Error(String(e)))}},0)}var Zi=__esmMin(()=>{Ui(),qi(),J()});function R(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(t[0]+t[12],7),t[8]^=R(t[4]+t[0],9),t[12]^=R(t[8]+t[4],13),t[0]^=R(t[12]+t[8],18),t[9]^=R(t[5]+t[1],7),t[13]^=R(t[9]+t[5],9),t[1]^=R(t[13]+t[9],13),t[5]^=R(t[1]+t[13],18),t[14]^=R(t[10]+t[6],7),t[2]^=R(t[14]+t[10],9),t[6]^=R(t[2]+t[14],13),t[10]^=R(t[6]+t[2],18),t[3]^=R(t[15]+t[11],7),t[7]^=R(t[3]+t[15],9),t[11]^=R(t[7]+t[3],13),t[15]^=R(t[11]+t[7],18),t[1]^=R(t[0]+t[3],7),t[2]^=R(t[1]+t[0],9),t[3]^=R(t[2]+t[1],13),t[0]^=R(t[3]+t[2],18),t[6]^=R(t[5]+t[4],7),t[7]^=R(t[6]+t[5],9),t[4]^=R(t[7]+t[6],13),t[5]^=R(t[4]+t[7],18),t[11]^=R(t[10]+t[9],7),t[8]^=R(t[11]+t[10],9),t[9]^=R(t[8]+t[11],13),t[10]^=R(t[9]+t[8],18),t[12]^=R(t[15]+t[14],7),t[13]^=R(t[12]+t[15],9),t[14]^=R(t[13]+t[12],13),t[15]^=R(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 a=0;a<t;a++){let a=e[r-16]&t-1;for(let t=0;t<r;t++)e[t]^=i[a][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,a){let o=128*r,s=pbkdf2Sync(e,t,1,i*o,`sha256`);for(let e=0;e<i;e++){let t=new Uint8Array(s.buffer,s.byteOffset+e*o,o),i=bytesToWords(t);roMix(i,n,r);let a=wordsToBytes(i);t.set(a)}return pbkdf2Sync(e,s,1,a,`sha256`)}function scryptSync(e,t,n,r){let i=q.from(e),a=q.from(t),o=r?.N??16384,s=r?.r??8,c=r?.p??1;if(o<=0||o&o-1)throw Error(`N must be a positive power of 2`);return scryptCore(i,a,o,s,c,n)}function scrypt(e,t,n,r,i){let a={},o;typeof r==`function`?o=r:(a=r,o=i);try{let r=scryptSync(e,t,n,a);setTimeout(()=>o(null,r),0)}catch(e){setTimeout(()=>o(e instanceof Error?e:Error(String(e)),q.alloc(0)),0)}}var Qi=__esmMin(()=>{Zi(),J()});function pemToDer(e){let t=e.trim().split(/\r?\n/),n=t.findIndex(e=>e.startsWith(`-----BEGIN `));if(n===-1)throw Error(`Invalid PEM: no BEGIN line found`);let r=t[n].match(/^-----BEGIN (.+)-----$/);if(!r)throw Error(`Invalid PEM header format`);let i=r[1],a=t.findIndex((e,t)=>t>n&&e.startsWith(`-----END `));if(a===-1)throw Error(`Invalid PEM: no END line found`);let o=t.slice(n+1,a).join(``),s=q.from(o,`base64`);return{type:i,der:new Uint8Array(s.buffer,s.byteOffset,s.byteLength)}}function parseTlv(e,t){if(t>=e.length)throw Error(`ASN.1 parse error: unexpected end of data`);let n=e[t++],r,i=e[t++];if(i<128)r=i;else{let n=i&127;if(n===0)throw Error(`ASN.1 parse error: indefinite length not supported`);r=0;for(let i=0;i<n;i++)r=r<<8|e[t++]}let a=e.slice(t,t+r),o=t+r,s={tag:n,data:a};return n===48&&(s.children=parseSequenceChildren(a)),{value:s,next:o}}function parseSequenceChildren(e){let t=[],n=0;for(;n<e.length;){let{value:r,next:i}=parseTlv(e,n);t.push(r),n=i}return t}function parseDer(e){let{value:t}=parseTlv(e,0);return t}function integerToBigInt(e){let t=0;for(;t<e.length-1&&e[t]===0;)t++;let n=0n;for(let r=t;r<e.length;r++)n=n<<8n|BigInt(e[r]);return n}function oidsEqual(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function parseRsaPublicKeyPkcs1(e){let t=e.children;if(!t||t.length<2)throw Error(`Invalid PKCS#1 RSAPublicKey structure`);return{n:integerToBigInt(t[0].data),e:integerToBigInt(t[1].data)}}function parseRsaPrivateKeyPkcs1(e){let t=e.children;if(!t||t.length<6)throw Error(`Invalid PKCS#1 RSAPrivateKey structure`);return{n:integerToBigInt(t[1].data),e:integerToBigInt(t[2].data),d:integerToBigInt(t[3].data),p:integerToBigInt(t[4].data),q:integerToBigInt(t[5].data)}}function parseSubjectPublicKeyInfo(e){let t=e.children;if(!t||t.length<2)throw Error(`Invalid SubjectPublicKeyInfo structure`);let n=t[0];if(!n.children||n.children.length<1)throw Error(`Invalid AlgorithmIdentifier`);let r=n.children[0];if(r.tag!==6||!oidsEqual(r.data,$i))throw Error(`Unsupported algorithm: only RSA is supported`);let i=t[1];if(i.tag!==3)throw Error(`Expected BIT STRING for public key data`);return parseRsaPublicKeyPkcs1(parseDer(i.data.slice(1)))}function parsePrivateKeyInfo(e){let t=e.children;if(!t||t.length<3)throw Error(`Invalid PrivateKeyInfo structure`);let n=t[1];if(!n.children||n.children.length<1)throw Error(`Invalid AlgorithmIdentifier`);let r=n.children[0];if(r.tag!==6||!oidsEqual(r.data,$i))throw Error(`Unsupported algorithm: only RSA is supported`);let i=t[2];if(i.tag!==4)throw Error(`Expected OCTET STRING for private key data`);return parseRsaPrivateKeyPkcs1(parseDer(i.data))}function encodeLength(e){if(e<128)return new Uint8Array([e]);let t=[],n=e;for(;n>0;)t.unshift(n&255),n>>=8;return new Uint8Array([128|t.length,...t])}function encodeTlv(e,t){let n=encodeLength(t.length),r=new Uint8Array(1+n.length+t.length);return r[0]=e,r.set(n,1),r.set(t,1+n.length),r}function bigintToAsn1Integer(e){if(e===0n)return encodeTlv(2,new Uint8Array([0]));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[0]&128&&r.unshift(0),encodeTlv(2,new Uint8Array(r))}function encodeSequence(e){let t=0;for(let n of e)t+=n.length;let n=new Uint8Array(t),r=0;for(let t of e)n.set(t,r),r+=t.length;return encodeTlv(48,n)}function encodeBitString(e){let t=new Uint8Array(1+e.length);return t[0]=0,t.set(e,1),encodeTlv(3,t)}function encodeOctetString(e){return encodeTlv(4,e)}function encodeOid(e){return encodeTlv(6,e)}function encodeNull(){return new Uint8Array([5,0])}function encodeRsaPublicKeyPkcs1(e){return encodeSequence([bigintToAsn1Integer(e.n),bigintToAsn1Integer(e.e)])}function encodeSubjectPublicKeyInfo(e){return encodeSequence([encodeSequence([encodeOid($i),encodeNull()]),encodeBitString(encodeRsaPublicKeyPkcs1(e))])}function encodeRsaPrivateKeyPkcs1(e){let t=e.d%(e.p-1n),n=e.d%(e.q-1n),r=modInverse$1(e.q,e.p);return encodeSequence([bigintToAsn1Integer(0n),bigintToAsn1Integer(e.n),bigintToAsn1Integer(e.e),bigintToAsn1Integer(e.d),bigintToAsn1Integer(e.p),bigintToAsn1Integer(e.q),bigintToAsn1Integer(t),bigintToAsn1Integer(n),bigintToAsn1Integer(r)])}function encodePrivateKeyInfo(e){let t=encodeSequence([encodeOid($i),encodeNull()]),n=encodeOctetString(encodeRsaPrivateKeyPkcs1(e));return encodeSequence([bigintToAsn1Integer(0n),t,n])}function derToPem(e,t){let n=q.from(e).toString(`base64`),r=[`-----BEGIN ${t}-----`];for(let e=0;e<n.length;e+=64)r.push(n.substring(e,e+64));return r.push(`-----END ${t}-----`),r.join(`
6
- `)}function modInverse$1(e,t){let[n,r]=[e%t,t],[i,a]=[1n,0n];for(;r!==0n;){let e=n/r;[n,r]=[r,n-e*r],[i,a]=[a,i-e*a]}return(i%t+t)%t}function parseX509(e){let{der:t}=pemToDer(e);return parseX509Der(t)}function parseX509Der(e){let t=parseDer(e);if(t.tag!==48||!t.children||t.children.length<3)throw Error(`Invalid X.509 certificate structure`);let n=t.children[0],r=t.children[1],i=t.children[2];if(!n.children||n.children.length<6)throw Error(`Invalid TBSCertificate structure`);let a=0;n.children[0].tag===160&&a++;let o=integerToBigInt(n.children[a].data);a++,a++;let s=parseDN(n.children[a]);a++;let c=n.children[a],l=parseAsn1Time(c.children[0]),u=parseAsn1Time(c.children[1]);a++;let d=parseDN(n.children[a]);a++;let p=null,m=`unknown`;if(a<n.children.length){let e=n.children[a];try{if(e.children&&e.children.length>=2){let t=e.children[0];if(t.children&&t.children.length>=1){let n=t.children[0];n.tag===6&&oidsEqual(n.data,$i)&&(m=`rsa`,p=parseSubjectPublicKeyInfo(e))}}}catch{}a++}let h,g;for(let e=a;e<n.children.length;e++){let t=n.children[e];if(t.tag===163&&t.data.length>0){let e=parseDer(t.data);if(e.children){g=e.children;let t=new Uint8Array([85,29,17]);for(let n of e.children)if(n.children&&n.children.length>=2){let e=n.children[0];if(e.tag===6&&oidsEqual(e.data,t)){let e=n.children[n.children.length-1];h=parseSAN(e.data)}}}}}let _=`unknown`;r.children&&r.children.length>=1&&(_=oidToName(r.children[0].data));let v=i.tag===3?i.data.slice(1):i.data;return{raw:e,tbsCertificate:n.data,serialNumber:o,issuer:s,subject:d,validFrom:l,validTo:u,publicKey:p,publicKeyAlgorithm:m,signatureAlgorithm:_,signature:v,subjectAltName:h,extensions:g}}function decodeOidString(e){if(e.length===0)return``;let t=[];t.push(Math.floor(e[0]/40)),t.push(e[0]%40);let n=0;for(let r=1;r<e.length;r++)n=n<<7|e[r]&127,e[r]&128||(t.push(n),n=0);return t.join(`.`)}function oidToName(e){let t=decodeOidString(e);return ta[t]||t}function parseDN(e){if(!e.children)return``;let t=[];for(let n of e.children){let e=n.tag===49?parseSequenceChildren(n.data):n.children||[];for(let n of e)if(n.children&&n.children.length>=2){let e=n.children[0].data,r=decodeOidString(e),i=ea[r]||r,a=n.children[1].data,o=new TextDecoder().decode(a);t.push(`${i}=${o}`)}}return t.join(`, `)}function parseAsn1Time(e){let t=new TextDecoder().decode(e.data);if(e.tag===23){let e=parseInt(t.substring(0,2),10);e=e>=50?1900+e:2e3+e;let n=parseInt(t.substring(2,4),10)-1,r=parseInt(t.substring(4,6),10),i=parseInt(t.substring(6,8),10),a=parseInt(t.substring(8,10),10),o=parseInt(t.substring(10,12),10);return new Date(Date.UTC(e,n,r,i,a,o))}if(e.tag===24){let e=parseInt(t.substring(0,4),10),n=parseInt(t.substring(4,6),10)-1,r=parseInt(t.substring(6,8),10),i=parseInt(t.substring(8,10),10),a=parseInt(t.substring(10,12),10),o=parseInt(t.substring(12,14),10);return new Date(Date.UTC(e,n,r,i,a,o))}throw Error(`Unsupported time tag: 0x${e.tag.toString(16)}`)}function parseSAN(e){let t=[];try{let n=parseDer(e);if(n.tag===48&&n.children){for(let e of n.children)if(e.tag===130)t.push(`DNS:`+new TextDecoder().decode(e.data));else if(e.tag===135){if(e.data.length===4)t.push(`IP Address:`+e.data.join(`.`));else if(e.data.length===16){let n=[];for(let t=0;t<16;t+=2)n.push((e.data[t]<<8|e.data[t+1]).toString(16));t.push(`IP Address:`+n.join(`:`))}}}}catch{}return t}function parsePemKey(e){let{type:t,der:n}=pemToDer(e),r=parseDer(n);if(r.tag!==48)throw Error(`Invalid key format: expected top-level SEQUENCE`);switch(t){case`RSA PUBLIC KEY`:return{type:`rsa-public`,components:parseRsaPublicKeyPkcs1(r)};case`PUBLIC KEY`:return{type:`rsa-public`,components:parseSubjectPublicKeyInfo(r)};case`RSA PRIVATE KEY`:return{type:`rsa-private`,components:parseRsaPrivateKeyPkcs1(r)};case`PRIVATE KEY`:return{type:`rsa-private`,components:parsePrivateKeyInfo(r)};default:throw Error(`Unsupported PEM type: ${t}`)}}function rsaKeySize(e){let t=0,n=e;for(;n>0n;)t++,n>>=1n;return Math.ceil(t/8)}var $i,ea,ta,na=__esmMin(()=>{J(),$i=new Uint8Array([42,134,72,134,247,13,1,1,1]),__name(modInverse$1,`modInverse`),ea={"2.5.4.3":`CN`,"2.5.4.6":`C`,"2.5.4.7":`L`,"2.5.4.8":`ST`,"2.5.4.10":`O`,"2.5.4.11":`OU`,"1.2.840.113549.1.9.1":`emailAddress`},ta={"1.2.840.113549.1.1.1":`rsaEncryption`,"1.2.840.113549.1.1.5":`sha1WithRSAEncryption`,"1.2.840.113549.1.1.11":`sha256WithRSAEncryption`,"1.2.840.113549.1.1.12":`sha384WithRSAEncryption`,"1.2.840.113549.1.1.13":`sha512WithRSAEncryption`}});function normalizeSignAlgorithm(e){let t=e.toLowerCase().replace(/-/g,``);if(t.startsWith(`rsa`)&&(t=t.slice(3)),!ra[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(q.isBuffer(e)||e instanceof Uint8Array)return q.from(e).toString(`utf8`);if(e&&typeof e==`object`&&`key`in e){let t=e.key;if(typeof t==`string`)return t;if(q.isBuffer(t)||t instanceof Uint8Array)return q.from(t).toString(`utf8`)}throw TypeError(`Invalid key argument`)}function createSign(e){return new Sign(e)}function createVerify(e){return new Verify(e)}var ra,Sign,Verify,ia=__esmMin(()=>{na(),ki(),Ki(),J(),ra={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 Gi(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(r.type!==`rsa-private`)throw Error(`privateKey must be an RSA private key`);let{n:i,d:a}=r.components,o=rsaKeySize(i),s=ra[this._algorithm],c=new Uint8Array(s.length+n.length);c.set(s,0),c.set(n,s.length);let l=o-c.length-3;if(l<8)throw Error(`Key is too short for the specified hash algorithm`);let u=new Uint8Array(o);u[0]=0,u[1]=1;for(let e=2;e<2+l;e++)u[e]=255;u[2+l]=0,u.set(c,3+l);let d=bigIntToBytes(modPow(bytesToBigInt(u),a,i),o),p=q.from(d);return t?p.toString(t):p}},Verify=class{_algorithm;_hash;_finalized=!1;constructor(e){this._algorithm=normalizeSignAlgorithm(e),this._hash=new Gi(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)),a,o;if(i.type===`rsa-public`)a=i.components.n,o=i.components.e;else if(i.type===`rsa-private`)a=i.components.n,o=i.components.e;else throw Error(`publicKey must be an RSA public or private key`);let s=rsaKeySize(a),c;if(c=typeof t==`string`?q.from(t,n||`base64`):t instanceof Uint8Array?t:q.from(t),c.length!==s)return!1;let l=bytesToBigInt(c);if(l>=a)return!1;let u=bigIntToBytes(modPow(l,o,a),s);if(u[0]!==0||u[1]!==1)return!1;let d=2;for(;d<u.length&&u[d]===255;)d++;if(d>=u.length||u[d]!==0||d-2<8)return!1;d++;let p=u.slice(d),m=ra[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 extractPem(e){if(typeof e==`string`)return e;if(q.isBuffer(e)||e instanceof Uint8Array)return q.from(e).toString(`utf8`);if(e&&typeof e==`object`&&`key`in e){let t=e.key;if(typeof t==`string`)return t;if(q.isBuffer(t)||t instanceof Uint8Array)return q.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 a=randomBytes(r);for(let e=0;e<r;e++){for(;a[e]===0;)a[e]=randomBytes(1)[0];i[2+e]=a[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 a=rsaKeySize(r),o=modPow(bytesToBigInt(pkcs1v15Type2Pad(t instanceof Uint8Array?t:q.from(t),a)),i,r);return q.from(bigIntToBytes(o,a))}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,a=rsaKeySize(r),o=t instanceof Uint8Array?t:q.from(t);if(o.length!==a)throw Error(`Data length (${o.length}) does not match key length (${a})`);let s=bytesToBigInt(o);if(s>=r)throw Error(`Decryption error: cipher value out of range`);let c=bigIntToBytes(modPow(s,i,r),a);return q.from(pkcs1v15Type2Unpad(c))}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,a=rsaKeySize(r),o=modPow(bytesToBigInt(pkcs1v15Type1Pad(t instanceof Uint8Array?t:q.from(t),a)),i,r);return q.from(bigIntToBytes(o,a))}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 a=rsaKeySize(r),o=t instanceof Uint8Array?t:q.from(t);if(o.length!==a)throw Error(`Data length (${o.length}) does not match key length (${a})`);let s=bytesToBigInt(o);if(s>=r)throw Error(`Decryption error: cipher value out of range`);let c=bigIntToBytes(modPow(s,i,r),a);return q.from(pkcs1v15Type1Unpad(c))}var aa=__esmMin(()=>{na(),ki(),Oi(),J()});function mgf1(e,t,n){let r=new Uint8Array(n),i=0,a=0;for(;i<n;){let o=new Uint8Array(4);o[0]=a>>>24&255,o[1]=a>>>16&255,o[2]=a>>>8&255,o[3]=a&255;let s=new Gi(e);s.update(t),s.update(o);let c=new Uint8Array(s.digest()),l=Math.min(c.length,n-i);r.set(c.slice(0,l),i),i+=l,a++}return r}var oa=__esmMin(()=>{Ki()});function hashDigest$1(e,t){let n=new Gi(e);return n.update(t),new Uint8Array(n.digest())}function emsaPssEncode(e,t,n,r){let i=hashSize(n),a=Math.ceil(t/8);if(a<i+r+2)throw Error(`RSA-PSS: encoding error — key too short`);let o=r>0?new Uint8Array(randomBytes(r)):new Uint8Array,s=new Uint8Array(8+i+r);s.set(e,8),s.set(o,8+i);let c=hashDigest$1(n,s),l=a-i-1,u=new Uint8Array(l);u[l-r-1]=1,u.set(o,l-r);let d=mgf1(n,c,l),p=new Uint8Array(l);for(let e=0;e<l;e++)p[e]=u[e]^d[e];let m=8*a-t;m>0&&(p[0]&=255>>>m);let h=new Uint8Array(a);return h.set(p,0),h.set(c,l),h[a-1]=188,h}function emsaPssVerify(e,t,n,r,i){let a=hashSize(r),o=Math.ceil(n/8);if(o<a+i+2||t[o-1]!==188)return!1;let s=o-a-1,c=t.slice(0,s),l=t.slice(s,s+a),u=8*o-n;if(u>0&&c[0]&255<<8-u)return!1;let d=mgf1(r,l,s),p=new Uint8Array(s);for(let e=0;e<s;e++)p[e]=c[e]^d[e];u>0&&(p[0]&=255>>>u);for(let e=0;e<s-i-1;e++)if(p[e]!==0)return!1;if(p[s-i-1]!==1)return!1;let m=p.slice(s-i),h=new Uint8Array(8+a+i);h.set(e,8),h.set(m,8+a);let g=hashDigest$1(r,h);if(l.length!==g.length)return!1;let _=0;for(let e=0;e<l.length;e++)_|=l[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:a,d:o}=i.components,s=rsaKeySize(a),c=Math.ceil(s/8);return bigIntToBytes(modPow(bytesToBigInt(emsaPssEncode(hashDigest$1(e,n),s-1,e,r)),o,a),c)}function rsaPssVerify(e,t,n,r,i){let a=parsePemKey(t),o,s;if(a.type===`rsa-public`)({n:o,e:s}=a.components);else if(a.type===`rsa-private`)({n:o,e:s}=a.components);else throw Error(`RSA-PSS: expected RSA key`);let c=rsaKeySize(o),l=Math.ceil(c/8);if(n.length!==l)return!1;let u=bigIntToBytes(modPow(bytesToBigInt(n),s,o),Math.ceil((c-1)/8));return emsaPssVerify(hashDigest$1(e,r),u,c-1,e,i)}var sa=__esmMin(()=>{na(),ki(),Ui(),Oi(),Ki(),oa(),__name(hashDigest$1,`hashDigest`)});function hashDigest(e,t){let n=new Gi(e);return n.update(t),new Uint8Array(n.digest())}function rsaOaepEncrypt(e,t,n,r){let i=parsePemKey(t),a,o;if(i.type===`rsa-public`)({n:a,e:o}=i.components);else if(i.type===`rsa-private`)({n:a,e:o}=i.components);else throw Error(`RSA-OAEP: expected RSA key`);let s=Math.ceil(rsaKeySize(a)/8),c=hashSize(e);if(n.length>s-2*c-2)throw Error(`RSA-OAEP: message too long`);let l=hashDigest(e,r||new Uint8Array),u=s-c-1,d=new Uint8Array(u);d.set(l,0),d[u-n.length-1]=1,d.set(n,u-n.length);let p=new Uint8Array(randomBytes(c)),m=mgf1(e,p,u),h=new Uint8Array(u);for(let e=0;e<u;e++)h[e]=d[e]^m[e];let g=mgf1(e,h,c),_=new Uint8Array(c);for(let e=0;e<c;e++)_[e]=p[e]^g[e];let v=new Uint8Array(s);return v[0]=0,v.set(_,1),v.set(h,1+c),bigIntToBytes(modPow(bytesToBigInt(v),o,a),s)}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:a,d:o}=i.components,s=Math.ceil(rsaKeySize(a)/8),c=hashSize(e);if(n.length!==s||s<2*c+2)throw Error(`RSA-OAEP: decryption error`);let l=bigIntToBytes(modPow(bytesToBigInt(n),o,a),s),u=l[0],d=l.slice(1,1+c),p=l.slice(1+c),m=s-c-1,h=mgf1(e,p,c),g=new Uint8Array(c);for(let e=0;e<c;e++)g[e]=d[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,c),x=+(u===0);for(let e=0;e<c;e++)x&=+(y[e]===b[e]);let S=-1;for(let e=c;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 ca=__esmMin(()=>{na(),ki(),Ui(),Oi(),Ki(),oa()});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 q.from(r).toString(`base64url`)}function base64urlToBigint(e){let t=q.from(e,`base64url`),n=0n;for(let e=0;e<t.length;e++)n=n<<8n|BigInt(t[e]);return n}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:a,q:o}=e.components,s=i%(a-1n),c=i%(o-1n),l=modInverse(o,a);return{kty:`RSA`,n:bigintToBase64url(n),e:bigintToBase64url(r),d:bigintToBase64url(i),p:bigintToBase64url(a),q:bigintToBase64url(o),dp:bigintToBase64url(s),dq:bigintToBase64url(c),qi:bigintToBase64url(l)}}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`?q.from(encodeRsaPublicKeyPkcs1(e.components)):q.from(encodeSubjectPublicKeyInfo(e.components));if(e.type===`rsa-private`&&t===`public`){let t={n:e.components.n,e:e.components.e};return n===`pkcs1`?q.from(encodeRsaPublicKeyPkcs1(t)):q.from(encodeSubjectPublicKeyInfo(t))}if(e.type===`rsa-private`)return n===`pkcs8`?q.from(encodePrivateKeyInfo(e.components)):q.from(encodeRsaPrivateKeyPkcs1(e.components));throw Error(`Cannot generate DER for this key type`)}function modInverse(e,t){let[n,r]=[e%t,t],[i,a]=[1n,0n];for(;r!==0n;){let e=n/r;[n,r]=[r,n-e*r],[i,a]=[a,i-e*a]}return(i%t+t)%t}function createSecretKey(e,t){let n;return n=typeof e==`string`?q.from(e,t??`utf8`):new Uint8Array(e),new la(`secret`,n)}function createPublicKey(e){if(e instanceof la){if(e.type===`public`)return e;if(e.type===`private`){let t=e._handle;if(t.parsed.type===`rsa-private`){let e={n:t.parsed.components.n,e:t.parsed.components.e};return new la(`public`,{parsed:{type:`rsa-public`,components:e},pem:derToPem(encodeSubjectPublicKeyInfo(e),`PUBLIC KEY`)})}}throw TypeError(`Cannot create public key from secret key`)}if(typeof e==`object`&&!q.isBuffer(e)&&`key`in e){let t=e;if(t.format===`jwk`){let e=t.key;if(e.kty===`RSA`){let{parsed:t,pem:n}=importJwkRsa({n:e.n,e:e.e});return new la(`public`,{parsed:t,pem:n})}throw Error(`Unsupported JWK key type: ${e.kty}`)}}let t=normalizePem(e),n=parsePemKey(t);if(n.type===`rsa-private`){let e={n:n.components.n,e:n.components.e};return new la(`public`,{parsed:{type:`rsa-public`,components:e},pem:derToPem(encodeSubjectPublicKeyInfo(e),`PUBLIC KEY`)})}return new la(`public`,{parsed:n,pem:t})}function createPrivateKey(e){if(typeof e==`object`&&!q.isBuffer(e)&&`key`in e){let t=e;if(t.format===`jwk`){let e=t.key;if(e.kty===`RSA`&&e.d){let{parsed:t,pem:n}=importJwkRsa(e);return new la(`private`,{parsed:t,pem:n})}throw Error(`JWK does not contain a private key`)}}let t=normalizePem(e),n=parsePemKey(t);if(n.type!==`rsa-private`)throw TypeError(`Key is not a private key`);return new la(`private`,{parsed:n,pem:t})}function normalizePem(e){if(typeof e==`string`)return e;if(q.isBuffer(e))return e.toString(`utf8`);if(e&&typeof e==`object`&&`key`in e){let t=e;if(typeof t.key==`string`)return t.key;if(q.isBuffer(t.key))return t.key.toString(t.encoding??`utf8`);if(t.key instanceof la)return t.key.export({format:`pem`})}throw TypeError(`Invalid key input`)}var la,ua=__esmMin(()=>{na(),J(),la=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;if(e.parsed.type===`rsa-public`||e.parsed.type===`rsa-private`)return`rsa`}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:q.from(t).toString(`base64url`)}:q.from(t)}let t=this._handle,n=e?.format??`pem`,r=e?.type;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 q.from(i,`base64`)}return generateDer(t.parsed,this.type,r)}throw TypeError(`Unsupported export format: ${n}`)}get[Symbol.toStringTag](){return`KeyObject`}}});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,da=__esmMin(()=>{na(),ua(),ma(),J(),X509Certificate=class{_components;_pem;constructor(e){if(typeof e==`string`)this._pem=e,this._components=parseX509(e);else{let t=q.isBuffer(e)?e:q.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 q.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 la(`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`}}}),fa=__exportAll$4({DiffieHellman:()=>DiffieHellman,DiffieHellmanGroup:()=>Fi,Hash:()=>Gi,Hmac:()=>Hmac,KeyObject:()=>la,Sign:()=>Sign,Verify:()=>Verify,X509Certificate:()=>X509Certificate,constants:()=>Ti,createCipher:()=>createCipher,createCipheriv:()=>createCipheriv,createDecipher:()=>createDecipher,createDecipheriv:()=>createDecipheriv,createDiffieHellman:()=>createDiffieHellman,createDiffieHellmanGroup:()=>Pi,createECDH:()=>createECDH,createHash:()=>createHash,createHmac:()=>createHmac,createPrivateKey:()=>createPrivateKey,createPublicKey:()=>createPublicKey,createSecretKey:()=>createSecretKey,createSign:()=>createSign,createVerify:()=>createVerify,default:()=>pa,ecdsaSign:()=>ecdsaSign,ecdsaVerify:()=>ecdsaVerify,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,timingSafeEqual:()=>timingSafeEqual});function createHash(e){return new Gi(e)}function createHmac(e,t){return new Hmac(e,t)}var pa,ma=__esmMin(()=>{wi(),Ei(),Oi(),Ii(),zi(),Ki(),qi(),Ji(),Yi(),Xi(),Zi(),Qi(),ia(),aa(),oa(),sa(),ca(),ua(),da(),pa={Hash:Gi,getHashes,hash,Hmac,randomBytes,randomFill,randomFillSync,randomUUID,randomInt,timingSafeEqual,constants:Ti,pbkdf2,pbkdf2Sync,hkdf,hkdfSync,scrypt,scryptSync,createHash,createHmac,createCipher,createCipheriv,createDecipher,createDecipheriv,getCiphers,Sign,Verify,createSign,createVerify,createDiffieHellman,getDiffieHellman,DiffieHellman,DiffieHellmanGroup:Fi,createDiffieHellmanGroup:Pi,createECDH,getCurves,ecdsaSign,ecdsaVerify,publicEncrypt,privateDecrypt,privateEncrypt,publicDecrypt,rsaPssSign,rsaPssVerify,rsaOaepEncrypt,rsaOaepDecrypt,mgf1,KeyObject:la,createSecretKey,createPublicKey,createPrivateKey,X509Certificate}});let ha=!1,ga,_a,va,ya,ba,xa,Sa,Ca,wa,Ta,Ea,Da,Oa,ka,Aa,ja;async function loadCrypto(){if(ha)return;let e=await Promise.resolve().then(()=>(ma(),fa));ga=e.createHash,_a=e.createHmac,va=e.createCipheriv,ya=e.createDecipheriv,ba=e.createSign,xa=e.createVerify,Sa=e.pbkdf2Sync,Ca=e.hkdfSync,wa=e.createECDH,Ta=e.randomBytes,e.publicEncrypt,e.privateDecrypt,e.createPublicKey,e.createPrivateKey,Ea=e.ecdsaSign,Da=e.ecdsaVerify,Oa=e.rsaPssSign,ka=e.rsaPssVerify,Aa=e.rsaOaepEncrypt,ja=e.rsaOaepDecrypt,ha=!0}const Ma=loadCrypto();var SubtleCrypto=class{async digest(e,t){await Ma;let n=toNodeHashName(normalizeAlgorithm$1(e).name),r=toUint8Array(t),i=ga(n);i.update(r);let a=i.digest();return a.buffer.slice(a.byteOffset,a.byteOffset+a.byteLength)}async generateKey(e,t,n){await Ma;let r=normalizeAlgorithm$1(e);switch(r.name.toUpperCase()){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 a=Ta(i/8);return new CryptoKey(`secret`,t,{name:r.name,length:i},n,new Uint8Array(a))}case`HMAC`:{let r=e,i=normalizeAlgorithm$1(r.hash),a=r.length||hashSize$1(i.name)*8;validateUsages(n,[`sign`,`verify`]);let o=Ta(Math.ceil(a/8));return new CryptoKey(`secret`,t,{name:`HMAC`,hash:{name:i.name},length:a},n,new Uint8Array(o))}case`ECDH`:{let r=e.namedCurve,i=toNodeCurveName(r);validateUsages(n,[`deriveKey`,`deriveBits`]);let a=wa(i);a.generateKeys();let o=new Uint8Array(a.getPublicKey()),s=new Uint8Array(a.getPrivateKey());return{publicKey:new CryptoKey(`public`,!0,{name:`ECDH`,namedCurve:r},[],o),privateKey:new CryptoKey(`private`,t,{name:`ECDH`,namedCurve:r},n,{pub:o,priv:s})}}case`ECDSA`:{let r=e.namedCurve,i=toNodeCurveName(r);validateUsages(n,[`sign`,`verify`]);let a=wa(i);a.generateKeys();let o=new Uint8Array(a.getPublicKey()),s=new Uint8Array(a.getPrivateKey());return{publicKey:new CryptoKey(`public`,!0,{name:`ECDSA`,namedCurve:r},[`verify`],o),privateKey:new CryptoKey(`private`,t,{name:`ECDSA`,namedCurve:r},[`sign`],{pub:o,priv:s})}}default:throw new DOMException(`Unsupported algorithm: ${r.name}`,`NotSupportedError`)}}async importKey(e,t,n,r,i){await Ma;let a=normalizeAlgorithm$1(n),o=a.name.toUpperCase();switch(o){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:a.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:a.name,length:n.length*8},i,n)}throw new DOMException(`Unsupported format: ${e}`,`NotSupportedError`);case`HMAC`:{let a=normalizeAlgorithm$1(n.hash);if(e===`raw`){let e=toUint8Array(t);return validateUsages(i,[`sign`,`verify`]),new CryptoKey(`secret`,r,{name:`HMAC`,hash:{name:a.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:a.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 s=n.namedCurve;if(e===`raw`){let e=toUint8Array(t);return o===`ECDH`?i.length>0&&validateUsages(i,[`deriveKey`,`deriveBits`]):validateUsages(i,[`verify`]),new CryptoKey(`public`,r,{name:a.name,namedCurve:s},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),c=base64urlDecode(e.y),l=new Uint8Array(1+n.length+c.length);return l[0]=4,l.set(n,1),l.set(c,1+n.length),validateUsages(i,o===`ECDH`?[`deriveKey`,`deriveBits`]:[`sign`]),new CryptoKey(`private`,r,{name:a.name,namedCurve:s},i,{pub:l,priv:t})}else{let t=base64urlDecode(e.x),n=base64urlDecode(e.y),c=new Uint8Array(1+t.length+n.length);return c[0]=4,c.set(t,1),c.set(n,1+t.length),o===`ECDH`?i.length>0&&validateUsages(i,[`deriveKey`,`deriveBits`]):validateUsages(i,[`verify`]),new CryptoKey(`public`,r,{name:a.name,namedCurve:s},i,c)}}throw new DOMException(`Unsupported format: ${e}`,`NotSupportedError`)}default:throw new DOMException(`Unsupported algorithm: ${a.name}`,`NotSupportedError`)}}async exportKey(e,t){if(!t.extractable)throw new DOMException(`Key is not extractable`,`InvalidAccessError`);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),a=n.slice(1+r),o={kty:`EC`,crv:e,x:base64urlEncode(i),y:base64urlEncode(a),ext:t.extractable,key_ops:[...t.usages]};return t.type===`private`&&(o.d=base64urlEncode(t._handle.priv)),o}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){await Ma,checkUsage(t,`encrypt`);let r=normalizeAlgorithm$1(e),i=r.name.toUpperCase(),a=toUint8Array(n);switch(i){case`AES-CBC`:{let n=toUint8Array(e.iv),r=t._handle,i=r.length*8,o=va(`aes-${i}-cbc`,r,n),s=o.update(a),c=o.final(),l=new Uint8Array(s.length+c.length);return l.set(new Uint8Array(s),0),l.set(new Uint8Array(c),s.length),l.buffer}case`AES-CTR`:{let n=toUint8Array(e.counter),r=t._handle,i=r.length*8,o=va(`aes-${i}-ctr`,r,n),s=o.update(a),c=o.final(),l=new Uint8Array(s.length+c.length);return l.set(new Uint8Array(s),0),l.set(new Uint8Array(c),s.length),l.buffer}case`AES-GCM`:{let n=e,r=toUint8Array(n.iv),i=n.additionalData?toUint8Array(n.additionalData):void 0,o=t._handle,s=o.length*8,c=va(`aes-${s}-gcm`,o,r);i&&c.setAAD(i);let l=c.update(a),u=c.final(),d=c.getAuthTag(),p=new Uint8Array(l.length+u.length+d.length);return p.set(new Uint8Array(l),0),p.set(new Uint8Array(u),l.length),p.set(new Uint8Array(d),l.length+u.length),p.buffer}case`RSA-OAEP`:{let n=t.algorithm.hash.name,r=toNodeHashName(n),i=t._handle,o=e,s=o.label?toUint8Array(o.label):void 0,c=Aa(r,i.pem,a,s);return c.buffer.slice(c.byteOffset,c.byteOffset+c.byteLength)}default:throw new DOMException(`Unsupported algorithm: ${r.name}`,`NotSupportedError`)}}async decrypt(e,t,n){await Ma,checkUsage(t,`decrypt`);let r=normalizeAlgorithm$1(e),i=r.name.toUpperCase(),a=toUint8Array(n);switch(i){case`AES-CBC`:{let n=toUint8Array(e.iv),r=t._handle,i=r.length*8,o=ya(`aes-${i}-cbc`,r,n),s=o.update(a),c=o.final(),l=new Uint8Array(s.length+c.length);return l.set(new Uint8Array(s),0),l.set(new Uint8Array(c),s.length),l.buffer}case`AES-CTR`:{let n=toUint8Array(e.counter),r=t._handle,i=r.length*8,o=ya(`aes-${i}-ctr`,r,n),s=o.update(a),c=o.final(),l=new Uint8Array(s.length+c.length);return l.set(new Uint8Array(s),0),l.set(new Uint8Array(c),s.length),l.buffer}case`AES-GCM`:{let n=e,r=toUint8Array(n.iv),i=(n.tagLength||128)/8,o=n.additionalData?toUint8Array(n.additionalData):void 0,s=t._handle,c=s.length*8,l=a.slice(0,a.length-i),u=a.slice(a.length-i),d=ya(`aes-${c}-gcm`,s,r);d.setAuthTag(u),o&&d.setAAD(o);let p=d.update(l),m=d.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,o=e,s=o.label?toUint8Array(o.label):void 0,c=ja(r,i.pem,a,s);return c.buffer.slice(c.byteOffset,c.byteOffset+c.byteLength)}default:throw new DOMException(`Unsupported algorithm: ${r.name}`,`NotSupportedError`)}}async sign(e,t,n){await Ma,checkUsage(t,`sign`);let r=normalizeAlgorithm$1(e),i=r.name.toUpperCase(),a=toUint8Array(n);switch(i){case`HMAC`:{let e=t.algorithm.hash.name,n=toNodeHashName(e),r=t._handle,i=_a(n,r);i.update(a);let o=i.digest();return o.buffer.slice(o.byteOffset,o.byteOffset+o.byteLength)}case`RSASSA-PKCS1-V1_5`:{let e=t.algorithm.hash.name,n=toNodeHashName(e),r=t._handle,i=ba(n);i.update(a);let o=i.sign(r.pem);return o.buffer.slice(o.byteOffset,o.byteOffset+o.byteLength)}case`ECDSA`:{let n=e,r=toNodeHashName(typeof n.hash==`string`?n.hash:n.hash.name),i=t.algorithm.namedCurve,o=t._handle,s=Ea(r,o.priv,a,i);return s.buffer.slice(s.byteOffset,s.byteOffset+s.byteLength)}case`RSA-PSS`:{let n=t.algorithm.hash.name,r=toNodeHashName(n),i=t._handle,o=e.saltLength??hashSize$1(n),s=Oa(r,i.pem,a,o);return s.buffer.slice(s.byteOffset,s.byteOffset+s.byteLength)}default:throw new DOMException(`Unsupported algorithm: ${r.name}`,`NotSupportedError`)}}async verify(e,t,n,r){await Ma,checkUsage(t,`verify`);let i=normalizeAlgorithm$1(e),a=i.name.toUpperCase(),o=toUint8Array(r),s=toUint8Array(n);switch(a){case`HMAC`:{let e=t.algorithm.hash.name,n=toNodeHashName(e),r=t._handle,i=_a(n,r);i.update(o);let a=new Uint8Array(i.digest());if(a.length!==s.length)return!1;let c=0;for(let e=0;e<a.length;e++)c|=a[e]^s[e];return c===0}case`RSASSA-PKCS1-V1_5`:{let e=t.algorithm.hash.name,n=toNodeHashName(e),r=t._handle,i=xa(n);return i.update(o),i.verify(r.pem,s)}case`ECDSA`:{let n=e,r=toNodeHashName(typeof n.hash==`string`?n.hash:n.hash.name),i=t.algorithm.namedCurve,a=t._handle;return Da(r,a,s,o,i)}case`RSA-PSS`:{let n=t.algorithm.hash.name,r=toNodeHashName(n),i=t._handle,a=e.saltLength??hashSize$1(n);return ka(r,i.pem,s,o,a)}default:throw new DOMException(`Unsupported algorithm: ${i.name}`,`NotSupportedError`)}}async _deriveBitsInternal(e,t,n){await Ma;let r=normalizeAlgorithm$1(e);switch(r.name.toUpperCase()){case`PBKDF2`:{let r=e,i=toNodeHashName(normalizeAlgorithm$1(r.hash).name),a=toUint8Array(r.salt),o=r.iterations,s=t._handle,c=Sa(s,a,o,n/8,i);return c.buffer.slice(c.byteOffset,c.byteOffset+c.byteLength)}case`HKDF`:{let r=e,i=toNodeHashName(normalizeAlgorithm$1(r.hash).name),a=toUint8Array(r.salt),o=toUint8Array(r.info),s=t._handle;return Ca(i,s,a,o,n/8)}case`ECDH`:{let r=e.public,i=t.algorithm.namedCurve,a=toNodeCurveName(i),o=wa(a),s=t._handle;o.setPrivateKey(s.priv);let c=r._handle instanceof Uint8Array?r._handle:r._handle.pub,l=o.computeSecret(c),u=new Uint8Array(l);return n?u.buffer.slice(0,n/8):u.buffer.slice(u.byteOffset,u.byteOffset+u.byteLength)}default:throw new DOMException(`Unsupported algorithm: ${r.name}`,`NotSupportedError`)}}async deriveBits(e,t,n){return checkUsage(t,`deriveBits`),this._deriveBitsInternal(e,t,n)}async deriveKey(e,t,n,r,i){checkUsage(t,`deriveKey`);let a=normalizeAlgorithm$1(n),o,s=a.name.toUpperCase();if(s===`AES-CBC`||s===`AES-CTR`||s===`AES-GCM`)o=n.length;else if(s===`HMAC`){let e=n,t=normalizeAlgorithm$1(e.hash);o=e.length||hashSize$1(t.name)*8}else throw new DOMException(`Unsupported derived key algorithm: ${a.name}`,`NotSupportedError`);let c=await this._deriveBitsInternal(e,t,o);return this.importKey(`raw`,c,n,r,i)}async wrapKey(e,t,n,r){throw new DOMException(`wrapKey not yet implemented`,`NotSupportedError`)}async unwrapKey(e,t,n,r,i,a,o){throw new DOMException(`unwrapKey not yet implemented`,`NotSupportedError`)}};const Na=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`);let t=new Uint8Array(e.buffer,e.byteOffset,e.byteLength);if(Na&&typeof Na.getRandomValues==`function`)Na.getRandomValues(t);else for(let e=0;e<t.length;e++)t[e]=Math.floor(Math.random()*256);return e}randomUUID(){if(Na&&typeof Na.randomUUID==`function`)return Na.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 Pa=Na!==null&&Na.subtle!==void 0&&typeof Na.subtle.digest==`function`,Fa=Pa?Na:new CryptoPolyfill;Pa?Na.subtle:new SubtleCrypto;const Ia=globalThis;(globalThis.crypto===void 0||globalThis.crypto.subtle===void 0)&&(Ia.crypto=Fa);const La=typeof process<`u`&&typeof process.versions?.gjs==`string`,Ra=typeof process<`u`&&typeof process.versions?.node==`string`,za=La?`GJS`:Ra?`Node.js`:`Unknown`;La?process.versions.gjs:Ra&&process.versions.node;var Ba,Va,Ha=__esmMin(()=>{Ba=Object.defineProperty,Va=__name((e,t)=>{let n={};for(var r in e)Ba(n,r,{get:e[r],enumerable:!0});return t||Ba(n,Symbol.toStringTag,{value:`Module`}),n},`__exportAll`)});function assertPath(e){if(typeof e!=`string`)throw TypeError(`The "path" argument must be of type string. Received type `+typeof e)}function isPosixPathSeparator(e){return e===47}function isPathSeparator(e){return e===47||e===92}function isWindowsDeviceRoot(e){return e>=65&&e<=90||e>=97&&e<=122}function normalizeString(e,t,n,r){let i=``,a=0,o=-1,s=0,c;for(let l=0;l<=e.length;++l){if(l<e.length)c=e.charCodeAt(l);else if(r(c))break;else c=47;if(r(c)){if(!(o===l-1||s===1))if(o!==l-1&&s===2){if(i.length<2||a!==2||i.charCodeAt(i.length-1)!==46||i.charCodeAt(i.length-2)!==46){if(i.length>2){let e=i.lastIndexOf(n);e===-1?(i=``,a=0):(i=i.slice(0,e),a=i.length-1-i.lastIndexOf(n)),o=l,s=0;continue}else if(i.length===2||i.length===1){i=``,a=0,o=l,s=0;continue}}t&&(i.length>0?i+=`${n}..`:i=`..`,a=2)}else i.length>0?i+=n+e.slice(o+1,l):i=e.slice(o+1,l),a=l-o-1;o=l,s=0}else c===46&&s!==-1?++s:s=-1}return i}function _format(e,t){if(typeof t!=`object`||!t)throw TypeError(`The "pathObject" argument must be of type Object. Received type `+typeof t);let n=t,r=n.dir||n.root,i=n.base||(n.name||``)+formatExt(n.ext);return r?r===n.root?r+i:r+e+i:i}function formatExt(e){return e?`${e[0]===`.`?``:`.`}${e}`:``}var Ua=__esmMin(()=>{});function posixCwd(){if(typeof globalThis.process?.cwd==`function`)return globalThis.process.cwd();try{let e=globalThis.imports?.gi?.GLib;if(e?.get_current_dir)return e.get_current_dir()}catch{}return`/`}function resolve$1(...e){let t=``,n=!1;for(let r=e.length-1;r>=-1&&!n;r--){let i;if(r>=0){if(i=e[r],assertPath(i),i.length===0)continue}else i=posixCwd();t=`${i}/${t}`,n=i.charCodeAt(0)===47}return t=normalizeString(t,!n,`/`,isPosixPathSeparator),n?t.length>0?`/${t}`:`/`:t.length>0?t:`.`}function normalize$1(e){if(assertPath(e),e.length===0)return`.`;let t=e.charCodeAt(0)===47,n=e.charCodeAt(e.length-1)===47,r=normalizeString(e,!t,`/`,isPosixPathSeparator);return r.length===0&&!t&&(r=`.`),r.length>0&&n&&(r+=`/`),t?`/${r}`:r}function isAbsolute$1(e){return assertPath(e),e.length>0&&e.charCodeAt(0)===47}function join$1(...e){if(e.length===0)return`.`;let t;for(let n=0;n<e.length;++n){let r=e[n];assertPath(r),r.length>0&&(t===void 0?t=r:t+=`/${r}`)}return t===void 0?`.`:normalize$1(t)}function relative$1(e,t){if(assertPath(e),assertPath(t),e===t||(e=resolve$1(e),t=resolve$1(t),e===t))return``;let n=e.length,r=n-1,i=1,a=t.length-i,o=r<a?r:a,s=-1,c=0;for(;c<=o;++c){if(c===o){if(a>o){if(t.charCodeAt(i+c)===47)return t.slice(i+c+1);if(c===0)return t.slice(i+c)}else r>o&&(e.charCodeAt(1+c)===47?s=c:c===0&&(s=0));break}let n=e.charCodeAt(1+c);if(n!==t.charCodeAt(i+c))break;n===47&&(s=c)}let l=``;for(c=1+s+1;c<=n;++c)(c===n||e.charCodeAt(c)===47)&&(l.length===0?l+=`..`:l+=`/..`);return l.length>0?l+t.slice(i+s):(i+=s,t.charCodeAt(i)===47&&++i,t.slice(i))}function toNamespacedPath$1(e){return e}function dirname$1(e){if(assertPath(e),e.length===0)return`.`;let t=e.charCodeAt(0)===47,n=-1,r=!0;for(let t=e.length-1;t>=1;--t)if(e.charCodeAt(t)===47){if(!r){n=t;break}}else r=!1;return n===-1?t?`/`:`.`:t&&n===1?`//`:e.slice(0,n)}function basename$1(e,t){t!==void 0&&assertPath(t),assertPath(e);let n=0,r=-1,i=!0;if(t!==void 0&&t.length>0&&t.length<=e.length){if(t.length===e.length&&t===e)return``;let a=t.length-1,o=-1;for(let s=e.length-1;s>=0;--s){let c=e.charCodeAt(s);if(c===47){if(!i){n=s+1;break}}else o===-1&&(i=!1,o=s+1),a>=0&&(c===t.charCodeAt(a)?--a===-1&&(r=s):(a=-1,r=o))}return n===r?r=o:r===-1&&(r=e.length),e.slice(n,r)}else{for(let t=e.length-1;t>=0;--t)if(e.charCodeAt(t)===47){if(!i){n=t+1;break}}else r===-1&&(i=!1,r=t+1);return r===-1?``:e.slice(n,r)}}function extname$1(e){assertPath(e);let t=-1,n=0,r=-1,i=!0,a=0;for(let o=e.length-1;o>=0;--o){let s=e.charCodeAt(o);if(s===47){if(!i){n=o+1;break}continue}r===-1&&(i=!1,r=o+1),s===46?t===-1?t=o:a!==1&&(a=1):t!==-1&&(a=-1)}return t===-1||r===-1||a===0||a===1&&t===r-1&&t===n+1?``:e.slice(t,r)}function format$2(e){if(typeof e!=`object`||!e)throw TypeError(`The "pathObject" argument must be of type Object. Received type `+typeof e);return _format(`/`,e)}function parse$2(e){assertPath(e);let t={root:``,dir:``,base:``,ext:``,name:``};if(e.length===0)return t;let n=e.charCodeAt(0)===47,r;n?(t.root=`/`,r=1):r=0;let i=-1,a=0,o=-1,s=!0,c=e.length-1,l=0;for(;c>=r;--c){let t=e.charCodeAt(c);if(t===47){if(!s){a=c+1;break}continue}o===-1&&(s=!1,o=c+1),t===46?i===-1?i=c:l!==1&&(l=1):i!==-1&&(l=-1)}return i===-1||o===-1||l===0||l===1&&i===o-1&&i===a+1?o!==-1&&(a===0&&n?t.base=t.name=e.slice(1,o):t.base=t.name=e.slice(a,o)):(a===0&&n?(t.name=e.slice(1,i),t.base=e.slice(1,o)):(t.name=e.slice(a,i),t.base=e.slice(a,o)),t.ext=e.slice(i,o)),a>0?t.dir=e.slice(0,a-1):n&&(t.dir=`/`),t}var Wa,Ga=__esmMin(()=>{Ha(),Ua(),Wa=Va({basename:()=>basename$1,delimiter:()=>`:`,dirname:()=>dirname$1,extname:()=>extname$1,format:()=>format$2,isAbsolute:()=>isAbsolute$1,join:()=>join$1,normalize:()=>normalize$1,parse:()=>parse$2,relative:()=>relative$1,resolve:()=>resolve$1,sep:()=>`/`,toNamespacedPath:()=>toNamespacedPath$1}),__name(resolve$1,`resolve`),__name(normalize$1,`normalize`),__name(isAbsolute$1,`isAbsolute`),__name(join$1,`join`),__name(relative$1,`relative`),__name(toNamespacedPath$1,`toNamespacedPath`),__name(dirname$1,`dirname`),__name(basename$1,`basename`),__name(extname$1,`extname`),__name(format$2,`format`),__name(parse$2,`parse`)});function resolve(...e){let t=``,n=``,r=!1;for(let i=e.length-1;i>=-1;i--){let a;if(i>=0){if(a=e[i],assertPath(a),a.length===0)continue}else a=(t.length,typeof globalThis.process?.cwd==`function`?globalThis.process.cwd():`/`);let o=a.length,s=0,c=``,l=!1,u=a.charCodeAt(0);if(o>1)if(isPathSeparator(u))if(l=!0,isPathSeparator(a.charCodeAt(1))){let e=2,t=e;for(;e<o&&!isPathSeparator(a.charCodeAt(e));++e);if(e<o&&e!==t){let n=a.slice(t,e);for(t=e;e<o&&isPathSeparator(a.charCodeAt(e));++e);if(e<o&&e!==t){for(t=e;e<o&&!isPathSeparator(a.charCodeAt(e));++e);e===o?(c=`\\\\${n}\\${a.slice(t)}`,s=e):e!==t&&(c=`\\\\${n}\\${a.slice(t,e)}`,s=e)}}}else s=1;else isWindowsDeviceRoot(u)&&a.charCodeAt(1)===58&&(c=a.slice(0,2),s=2,o>2&&isPathSeparator(a.charCodeAt(2))&&(l=!0,s=3));else isPathSeparator(u)&&(s=1,l=!0);if(!(c.length>0&&t.length>0&&c.toLowerCase()!==t.toLowerCase())&&(t.length===0&&c.length>0&&(t=c),r||=(n=`${a.slice(s)}\\${n}`,l),t.length>0&&r))break}return n=normalizeString(n,!r,`\\`,isPathSeparator),t+(r?`\\`:``)+n||`.`}function normalize(e){assertPath(e);let t=e.length;if(t===0)return`.`;let n=0,r,i=!1,a=e.charCodeAt(0);if(t>1)if(isPathSeparator(a))if(i=!0,isPathSeparator(e.charCodeAt(1))){let i=2,a=i;for(;i<t&&!isPathSeparator(e.charCodeAt(i));++i);if(i<t&&i!==a){let o=e.slice(a,i);for(a=i;i<t&&isPathSeparator(e.charCodeAt(i));++i);if(i<t&&i!==a){for(a=i;i<t&&!isPathSeparator(e.charCodeAt(i));++i);if(i===t)return`\\\\${o}\\${e.slice(a)}\\`;i!==a&&(r=`\\\\${o}\\${e.slice(a,i)}`,n=i)}}}else n=1;else isWindowsDeviceRoot(a)&&e.charCodeAt(1)===58&&(r=e.slice(0,2),n=2,t>2&&isPathSeparator(e.charCodeAt(2))&&(i=!0,n=3));else if(isPathSeparator(a))return`\\`;let o;return o=n<t?normalizeString(e.slice(n),!i,`\\`,isPathSeparator):``,o.length===0&&!i&&(o=`.`),o.length>0&&isPathSeparator(e.charCodeAt(t-1))&&(o+=`\\`),r===void 0?i?o.length>0?`\\${o}`:`\\`:o.length>0?o:``:i?o.length>0?`${r}\\${o}`:`${r}\\`:o.length>0?r+o:r}function isAbsolute(e){assertPath(e);let t=e.length;if(t===0)return!1;let n=e.charCodeAt(0);return!!(isPathSeparator(n)||isWindowsDeviceRoot(n)&&t>2&&e.charCodeAt(1)===58&&isPathSeparator(e.charCodeAt(2)))}function join(...e){if(e.length===0)return`.`;let t,n;for(let r=0;r<e.length;++r){let i=e[r];assertPath(i),i.length>0&&(t===void 0?t=n=i:t+=`\\${i}`)}if(t===void 0)return`.`;let r=!0,i=0;if(isPathSeparator(n.charCodeAt(0))){++i;let e=n.length;e>1&&isPathSeparator(n.charCodeAt(1))&&(++i,e>2&&(isPathSeparator(n.charCodeAt(2))?++i:r=!1))}if(r){for(;i<t.length&&isPathSeparator(t.charCodeAt(i));++i);i>=2&&(t=`\\${t.slice(i)}`)}return normalize(t)}function relative(e,t){if(assertPath(e),assertPath(t),e===t)return``;let n=resolve(e),r=resolve(t);if(n===r||(e=n.toLowerCase(),t=r.toLowerCase(),e===t))return``;let i=0;for(;i<e.length&&e.charCodeAt(i)===92;++i);let a=e.length;for(;a-1>i&&e.charCodeAt(a-1)===92;--a);let o=a-i,s=0;for(;s<t.length&&t.charCodeAt(s)===92;++s);let c=t.length;for(;c-1>s&&t.charCodeAt(c-1)===92;--c);let l=c-s,u=o<l?o:l,d=-1,p=0;for(;p<=u;++p){if(p===u){if(l>u){if(t.charCodeAt(s+p)===92)return r.slice(s+p+1);if(p===2)return r.slice(s+p)}o>u&&(e.charCodeAt(i+p)===92?d=p:p===2&&(d=3));break}let n=e.charCodeAt(i+p);if(n!==t.charCodeAt(s+p))break;n===92&&(d=p)}if(p!==u&&d===-1)return r;let m=``;for(d===-1&&(d=0),p=i+d+1;p<=a;++p)(p===a||e.charCodeAt(p)===92)&&(m.length===0?m+=`..`:m+=`\\..`);return m.length>0?m+r.slice(s+d,c):(s+=d,r.charCodeAt(s)===92&&++s,r.slice(s,c))}function toNamespacedPath(e){if(typeof e!=`string`)return e;if(e.length===0)return``;let t=resolve(e);if(t.length>=3){if(t.charCodeAt(0)===92){if(t.charCodeAt(1)===92){let e=t.charCodeAt(2);if(e!==63&&e!==46)return`\\\\?\\UNC\\${t.slice(2)}`}}else if(isWindowsDeviceRoot(t.charCodeAt(0))&&t.charCodeAt(1)===58&&t.charCodeAt(2)===92)return`\\\\?\\${t}`}return e}function dirname(e){assertPath(e);let t=e.length;if(t===0)return`.`;let n=-1,r=-1,i=!0,a=0,o=e.charCodeAt(0);if(t>1)if(isPathSeparator(o)){if(n=a=1,isPathSeparator(e.charCodeAt(1))){let r=2,i=r;for(;r<t&&!isPathSeparator(e.charCodeAt(r));++r);if(r<t&&r!==i){for(i=r;r<t&&isPathSeparator(e.charCodeAt(r));++r);if(r<t&&r!==i){for(i=r;r<t&&!isPathSeparator(e.charCodeAt(r));++r);if(r===t)return e;r!==i&&(n=a=r+1)}}}}else isWindowsDeviceRoot(o)&&e.charCodeAt(1)===58&&(n=a=2,t>2&&isPathSeparator(e.charCodeAt(2))&&(n=a=3));else if(isPathSeparator(o))return e;for(let n=t-1;n>=a;--n)if(isPathSeparator(e.charCodeAt(n))){if(!i){r=n;break}}else i=!1;if(r===-1){if(n===-1)return`.`;r=n}return e.slice(0,r)}function basename(e,t){t!==void 0&&assertPath(t),assertPath(e);let n=0,r=-1,i=!0;if(e.length>=2&&isWindowsDeviceRoot(e.charCodeAt(0))&&e.charCodeAt(1)===58&&(n=2),t!==void 0&&t.length>0&&t.length<=e.length){if(t.length===e.length&&t===e)return``;let a=t.length-1,o=-1;for(let s=e.length-1;s>=n;--s){let c=e.charCodeAt(s);if(isPathSeparator(c)){if(!i){n=s+1;break}}else o===-1&&(i=!1,o=s+1),a>=0&&(c===t.charCodeAt(a)?--a===-1&&(r=s):(a=-1,r=o))}return n===r?r=o:r===-1&&(r=e.length),e.slice(n,r)}else{for(let t=e.length-1;t>=n;--t)if(isPathSeparator(e.charCodeAt(t))){if(!i){n=t+1;break}}else r===-1&&(i=!1,r=t+1);return r===-1?``:e.slice(n,r)}}function extname(e){assertPath(e);let t=0,n=-1,r=0,i=-1,a=!0,o=0;e.length>=2&&e.charCodeAt(1)===58&&isWindowsDeviceRoot(e.charCodeAt(0))&&(t=r=2);for(let s=e.length-1;s>=t;--s){let t=e.charCodeAt(s);if(isPathSeparator(t)){if(!a){r=s+1;break}continue}i===-1&&(a=!1,i=s+1),t===46?n===-1?n=s:o!==1&&(o=1):n!==-1&&(o=-1)}return n===-1||i===-1||o===0||o===1&&n===i-1&&n===r+1?``:e.slice(n,i)}function format$1(e){if(typeof e!=`object`||!e)throw TypeError(`The "pathObject" argument must be of type Object. Received type `+typeof e);return _format(`\\`,e)}function parse$1(e){assertPath(e);let t={root:``,dir:``,base:``,ext:``,name:``};if(e.length===0)return t;let n=e.length,r=0,i=e.charCodeAt(0);if(n>1)if(isPathSeparator(i)){if(r=1,isPathSeparator(e.charCodeAt(1))){let t=2,i=t;for(;t<n&&!isPathSeparator(e.charCodeAt(t));++t);if(t<n&&t!==i){for(i=t;t<n&&isPathSeparator(e.charCodeAt(t));++t);if(t<n&&t!==i){for(i=t;t<n&&!isPathSeparator(e.charCodeAt(t));++t);t===n?r=t:t!==i&&(r=t+1)}}}}else isWindowsDeviceRoot(i)&&e.charCodeAt(1)===58&&(r=2,n>2&&isPathSeparator(e.charCodeAt(2))&&(r=3));else if(isPathSeparator(i))return t.root=t.dir=e,t;r>0&&(t.root=e.slice(0,r));let a=-1,o=r,s=-1,c=!0,l=e.length-1,u=0;for(;l>=r;--l){if(i=e.charCodeAt(l),isPathSeparator(i)){if(!c){o=l+1;break}continue}s===-1&&(c=!1,s=l+1),i===46?a===-1?a=l:u!==1&&(u=1):a!==-1&&(u=-1)}return a===-1||s===-1||u===0||u===1&&a===s-1&&a===o+1?s!==-1&&(t.base=t.name=e.slice(o,s)):(t.name=e.slice(o,a),t.base=e.slice(o,s),t.ext=e.slice(a,s)),o>0&&o!==r?t.dir=e.slice(0,o-1):t.dir=t.root,t}var Ka,qa=__esmMin(()=>{Ha(),Ua(),Ka=Va({basename:()=>basename,delimiter:()=>`;`,dirname:()=>dirname,extname:()=>extname,format:()=>format$1,isAbsolute:()=>isAbsolute,join:()=>join,normalize:()=>normalize,parse:()=>parse$1,relative:()=>relative,resolve:()=>resolve,sep:()=>`\\`,toNamespacedPath:()=>toNamespacedPath}),__name(format$1,`format`),__name(parse$1,`parse`)}),Ja=__exportAll$4({basename:()=>no,default:()=>co,delimiter:()=>so,dirname:()=>to,extname:()=>ro,format:()=>io,isAbsolute:()=>Za,join:()=>Qa,normalize:()=>Xa,parse:()=>ao,posix:()=>Wa,relative:()=>$a,resolve:()=>Ya,sep:()=>oo,toNamespacedPath:()=>eo,win32:()=>Ka}),Ya,Xa,Za,Qa,$a,eo,to,no,ro,io,ao,oo,so,co,lo=__esmMin(()=>{Ga(),qa(),{resolve:Ya,normalize:Xa,isAbsolute:Za,join:Qa,relative:$a,toNamespacedPath:eo,dirname:to,basename:no,extname:ro,format:io,parse:ao,sep:oo,delimiter:so}=Wa,co={resolve:resolve$1,normalize:normalize$1,isAbsolute:isAbsolute$1,join:join$1,relative:relative$1,toNamespacedPath:toNamespacedPath$1,dirname:dirname$1,basename:basename$1,extname:extname$1,format:format$2,parse:parse$2,sep:`/`,delimiter:`:`,posix:Wa,win32:Ka}}),uo=__commonJSMin(((e,t)=>{var n=1e3,r=n*60,i=r*60,a=i*24,o=a*7,s=a*365.25;t.exports=function(e,t){t||={};var n=typeof e;if(n===`string`&&e.length>0)return parse(e);if(n===`number`&&isFinite(e))return t.long?fmtLong(e):fmtShort(e);throw Error(`val is not a non-empty string or a valid number. val=`+JSON.stringify(e))};function parse(e){if(e=String(e),!(e.length>100)){var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(t){var c=parseFloat(t[1]);switch((t[2]||`ms`).toLowerCase()){case`years`:case`year`:case`yrs`:case`yr`:case`y`:return c*s;case`weeks`:case`week`:case`w`:return c*o;case`days`:case`day`:case`d`:return c*a;case`hours`:case`hour`:case`hrs`:case`hr`:case`h`:return c*i;case`minutes`:case`minute`:case`mins`:case`min`:case`m`:return c*r;case`seconds`:case`second`:case`secs`:case`sec`:case`s`:return c*n;case`milliseconds`:case`millisecond`:case`msecs`:case`msec`:case`ms`:return c;default:return}}}}function fmtShort(e){var t=Math.abs(e);return t>=a?Math.round(e/a)+`d`:t>=i?Math.round(e/i)+`h`:t>=r?Math.round(e/r)+`m`:t>=n?Math.round(e/n)+`s`:e+`ms`}function fmtLong(e){var t=Math.abs(e);return t>=a?plural(e,t,a,`day`):t>=i?plural(e,t,i,`hour`):t>=r?plural(e,t,r,`minute`):t>=n?plural(e,t,n,`second`):e+` ms`}function plural(e,t,n,r){var i=t>=n*1.5;return Math.round(e/n)+` `+r+(i?`s`:``)}})),fo=__commonJSMin(((e,t)=>{me();function setup(e){createDebug.debug=createDebug,createDebug.default=createDebug,createDebug.coerce=coerce,createDebug.disable=disable,createDebug.enable=enable,createDebug.enabled=enabled,createDebug.humanize=uo(),createDebug.destroy=destroy,Object.keys(e).forEach(t=>{createDebug[t]=e[t]}),createDebug.names=[],createDebug.skips=[],createDebug.formatters={};function selectColor(e){let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n),t|=0;return createDebug.colors[Math.abs(t)%createDebug.colors.length]}createDebug.selectColor=selectColor;function createDebug(e){let t,n=null,r,i;function debug(...e){if(!debug.enabled)return;let n=debug,r=Number(new Date);n.diff=r-(t||r),n.prev=t,n.curr=r,t=r,e[0]=createDebug.coerce(e[0]),typeof e[0]!=`string`&&e.unshift(`%O`);let i=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,(t,r)=>{if(t===`%%`)return`%`;i++;let a=createDebug.formatters[r];if(typeof a==`function`){let r=e[i];t=a.call(n,r),e.splice(i,1),i--}return t}),createDebug.formatArgs.call(n,e),(n.log||createDebug.log).apply(n,e)}return debug.namespace=e,debug.useColors=createDebug.useColors(),debug.color=createDebug.selectColor(e),debug.extend=extend,debug.destroy=createDebug.destroy,Object.defineProperty(debug,"enabled",{enumerable:!0,configurable:!1,get:()=>n===null?(r!==createDebug.namespaces&&(r=createDebug.namespaces,i=createDebug.enabled(e)),i):n,set:e=>{n=e}}),typeof createDebug.init==`function`&&createDebug.init(debug),debug}function extend(e,t){let n=createDebug(this.namespace+(t===void 0?`:`:t)+e);return n.log=this.log,n}function enable(e){createDebug.save(e),createDebug.namespaces=e,createDebug.names=[],createDebug.skips=[];let t=(typeof e==`string`?e:``).trim().replace(/\s+/g,`,`).split(`,`).filter(Boolean);for(let e of t)e[0]===`-`?createDebug.skips.push(e.slice(1)):createDebug.names.push(e)}function matchesTemplate(e,t){let n=0,r=0,i=-1,a=0;for(;n<e.length;)if(r<t.length&&(t[r]===e[n]||t[r]===`*`))t[r]===`*`?(i=r,a=n,r++):(n++,r++);else if(i!==-1)r=i+1,a++,n=a;else return!1;for(;r<t.length&&t[r]===`*`;)r++;return r===t.length}function disable(){let e=[...createDebug.names,...createDebug.skips.map(e=>`-`+e)].join(`,`);return createDebug.enable(``),e}function enabled(e){for(let t of createDebug.skips)if(matchesTemplate(e,t))return!1;for(let t of createDebug.names)if(matchesTemplate(e,t))return!0;return!1}function coerce(e){return e instanceof Error?e.stack||e.message:e}function destroy(){I.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return createDebug.enable(createDebug.load()),createDebug}t.exports=setup})),po=__commonJSMin(((e,t)=>{me(),e.formatArgs=formatArgs,e.save=save,e.load=load,e.useColors=useColors,e.storage=localstorage(),e.destroy=(()=>{let e=!1;return()=>{e||(e=!0,I.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),e.colors=`#0000CC.#0000FF.#0033CC.#0033FF.#0066CC.#0066FF.#0099CC.#0099FF.#00CC00.#00CC33.#00CC66.#00CC99.#00CCCC.#00CCFF.#3300CC.#3300FF.#3333CC.#3333FF.#3366CC.#3366FF.#3399CC.#3399FF.#33CC00.#33CC33.#33CC66.#33CC99.#33CCCC.#33CCFF.#6600CC.#6600FF.#6633CC.#6633FF.#66CC00.#66CC33.#9900CC.#9900FF.#9933CC.#9933FF.#99CC00.#99CC33.#CC0000.#CC0033.#CC0066.#CC0099.#CC00CC.#CC00FF.#CC3300.#CC3333.#CC3366.#CC3399.#CC33CC.#CC33FF.#CC6600.#CC6633.#CC9900.#CC9933.#CCCC00.#CCCC33.#FF0000.#FF0033.#FF0066.#FF0099.#FF00CC.#FF00FF.#FF3300.#FF3333.#FF3366.#FF3399.#FF33CC.#FF33FF.#FF6600.#FF6633.#FF9900.#FF9933.#FFCC00.#FFCC33`.split(`.`);function useColors(){if(typeof globalThis<`u`&&globalThis.process&&(globalThis.process.type===`renderer`||globalThis.process.__nwjs))return!0;if(typeof navigator<`u`&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let e;return typeof document<`u`&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof globalThis<`u`&&globalThis.console&&(globalThis.console.firebug||globalThis.console.exception&&globalThis.console.table)||typeof navigator<`u`&&navigator.userAgent&&(e=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(e[1],10)>=31||typeof navigator<`u`&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function formatArgs(e){if(e[0]=(this.useColors?`%c`:``)+this.namespace+(this.useColors?` %c`:` `)+e[0]+(this.useColors?`%c `:` `)+`+`+t.exports.humanize(this.diff),!this.useColors)return;let n=`color: `+this.color;e.splice(1,0,n,`color: inherit`);let r=0,i=0;e[0].replace(/%[a-zA-Z%]/g,e=>{e!==`%%`&&(r++,e===`%c`&&(i=r))}),e.splice(i,0,n)}e.log=I.debug||I.log||(()=>{});function save(t){try{t?e.storage.setItem(`debug`,t):e.storage.removeItem(`debug`)}catch{}}function load(){let t;try{t=e.storage.getItem(`debug`)||e.storage.getItem(`DEBUG`)}catch{}return!t&&typeof process<`u`&&`env`in process&&(t=process.env.DEBUG),t}function localstorage(){try{return localStorage}catch{}}t.exports=fo()(e);let{formatters:n}=t.exports;n.j=function(e){try{return JSON.stringify(e)}catch(e){return`[UnexpectedJSONParseError]: `+e.message}}})),mo=__commonJSMin(((e,t)=>{
5
+ `+t)}profile(e){}profileEnd(e){}timeStamp(e){}},F=new Console,log=(...e)=>F.log(...e),info=(...e)=>F.info(...e),debug=(...e)=>F.debug(...e),warn=(...e)=>F.warn(...e),error=(...e)=>F.error(...e),dir=(e,t)=>F.dir(e,t),dirxml=(...e)=>F.dirxml(...e),table=(e,t)=>F.table(e,t),clear=()=>F.clear(),assert=(e,...t)=>F.assert(e,...t),trace=(...e)=>F.trace(...e),time=e=>F.time(e),timeEnd=e=>F.timeEnd(e),timeLog=(e,...t)=>F.timeLog(e,...t),count=e=>F.count(e),countReset=e=>F.countReset(e),group=(...e)=>F.group(...e),groupCollapsed=(...e)=>F.groupCollapsed(...e),groupEnd=()=>F.groupEnd(),profile=e=>{},profileEnd=e=>{},timeStamp=e=>{}}),I,me=__esmMin(()=>{pe(),I={log,info,debug,warn,error,dir,dirxml,table,time,timeEnd,timeLog,trace,assert,clear,count,countReset,group,groupCollapsed,groupEnd,profile,profileEnd,timeStamp}}),he=__esmMin(()=>{me()}),ge,_e=__esmMin(()=>{ge=__name(e=>{Promise.resolve().then(e)},`queueMicrotask`)});function drainOnce(e){let t=Math.min(64,ve.length);for(let n=0;n<t;n++){let t=ve.shift();try{t()}catch(t){try{e.log_default_handler(`gjsify-nextTick`,e.LogLevelFlags.LEVEL_WARNING,String(t?.stack||t),null)}catch{}}}ve.length>0?e.timeout_add(e.PRIORITY_DEFAULT,1,()=>(drainOnce(e),!1)):ye=!1}function tryGLibTimeout(e){let t=globalThis.imports?.gi?.GLib;return t?.timeout_add?(ve.push(e),ye||(ye=!0,t.timeout_add(t.PRIORITY_DEFAULT,0,()=>(drainOnce(t),!1))),!0):!1}var ve,ye,nextTick,be=__esmMin(()=>{ve=[],ye=!1,nextTick=(e,...t)=>{let n=t.length>0?()=>e(...t):e;if(!tryGLibTimeout(n)){if(typeof globalThis.process?.nextTick==`function`){globalThis.process.nextTick(e,...t);return}if(typeof queueMicrotask==`function`){queueMicrotask(n);return}Promise.resolve().then(n)}}}),xe,Se=__esmMin(()=>{A(),P(),{File:xe}=N});function classOf(e){return Ce.call(e).slice(8,-1)}function throwDataCloneError(e){let t=globalThis.DOMException;if(typeof t==`function`)throw new t(e,`DataCloneError`);let n=Error(e);throw n.name=`DataCloneError`,n}function internalClone(e,t,n){if(e==null)return e;let r=typeof e;if(r===`boolean`||r===`number`||r===`string`||r===`bigint`)return e;r===`symbol`&&throwDataCloneError(`Symbol cannot be cloned`),r===`function`&&throwDataCloneError(`Function cannot be cloned`);let i=e;if(t.has(i))return t.get(i);let a=classOf(i);if(a===`Date`)return new Date(i.getTime());if(a===`RegExp`)return new RegExp(i.source,i.flags);if(a===`Boolean`||a===`Number`||a===`String`)return Object(i.valueOf());if(a===`BigInt`)return Object(BigInt.prototype.valueOf.call(i));if(i instanceof Error){let e=i,r=e.constructor?.name,a=new(r&&we[r]||we[e.name]||Error)(e.message);return a.name=e.name,`cause`in e&&Object.defineProperty(a,"cause",{value:internalClone(e.cause,t,n),writable:!0,enumerable:!1,configurable:!0}),a}if(a===`DOMException`){let e=globalThis.DOMException;if(typeof e==`function`){let t=i;return new e(t.message,t.name)}}if(a===`ArrayBuffer`){let e=i;if(n&&n.transferred.has(e)){let r=n.transferred.get(e);return t.set(i,r),r}(e.detached===!0||e.byteLength===0&&e.detached)&&throwDataCloneError(`ArrayBuffer is detached and cannot be cloned`);let r=e.slice(0);return t.set(i,r),r}if(a===`SharedArrayBuffer`||i&&typeof i==`object`&&i.constructor?.name===`SharedBuffer`)return i;if(a===`DataView`){let e=i,r=n?.viewSnapshots.get(i),a=internalClone(e.buffer,t,n),o=r?r.byteOffset:e.byteOffset,s=r?r.byteLength:e.byteLength,c=new DataView(a,o,s);return t.set(i,c),c}if(Te.has(a)){let e=i,r=n?.viewSnapshots.get(i),a=internalClone(e.buffer,t,n),o=e.constructor,s=new o(a,r?r.byteOffset:e.byteOffset,r?r.length:e.length);return t.set(i,s),s}if(a===`Map`){let e=new Map;t.set(i,e);for(let[r,a]of i)e.set(internalClone(r,t,n),internalClone(a,t,n));return e}if(a===`Set`){let e=new Set;t.set(i,e);for(let r of i)e.add(internalClone(r,t,n));return e}{let e=globalThis,t=e.Blob,n=e.File;if(typeof n==`function`&&i instanceof n){let e=i;return new n([i],e.name,{type:e.type,lastModified:e.lastModified})}if(typeof t==`function`&&i instanceof t)return new t([i],{type:i.type})}if(i instanceof WeakMap&&throwDataCloneError(`WeakMap cannot be cloned`),i instanceof WeakSet&&throwDataCloneError(`WeakSet cannot be cloned`),i instanceof WeakRef&&throwDataCloneError(`WeakRef cannot be cloned`),typeof globalThis.Promise==`function`&&i instanceof Promise&&throwDataCloneError(`Promise cannot be cloned`),a===`Array`){let e=i,r=[];t.set(i,r);for(let i=0;i<e.length;i++)i in e&&(r[i]=internalClone(e[i],t,n));return r}if(a===`Object`||typeof i==`object`){let e={};t.set(i,e);for(let r of Object.keys(i))e[r]=internalClone(i[r],t,n);return e}throwDataCloneError(`${a} cannot be cloned`)}function structuredClone$1(e,t){let n=t?.transfer;if(!n||n.length===0)return internalClone(e,new Map);let r=new Set;for(let e of n)if(classOf(e)===`ArrayBuffer`){let t=e;t.detached===!0&&throwDataCloneError(`ArrayBuffer in transfer list is detached`),r.add(t)}let i=new Map;r.size>0&&snapshotViewsBackedByTransferredBuffers(e,r,i,new Set);let a=new Map;for(let e of r){let t=e;typeof t.transfer!=`function`&&throwDataCloneError(`ArrayBuffer.prototype.transfer() not available — runtime is not SM140+`),a.set(e,t.transfer())}return internalClone(e,new Map,{transferred:a,viewSnapshots:i})}function snapshotViewsBackedByTransferredBuffers(e,t,n,r){if(typeof e!=`object`||!e)return;let i=e;if(r.has(i))return;r.add(i);let a=classOf(i);if(a===`DataView`){let e=i;t.has(e.buffer)&&n.set(i,{byteOffset:e.byteOffset,length:0,byteLength:e.byteLength});return}if(Te.has(a)){let e=i;t.has(e.buffer)&&n.set(i,{byteOffset:e.byteOffset,length:e.length,byteLength:e.byteLength});return}if(Array.isArray(i)){for(let e=0;e<i.length;e++)e in i&&snapshotViewsBackedByTransferredBuffers(i[e],t,n,r);return}if(a===`Map`){for(let[e,a]of i)snapshotViewsBackedByTransferredBuffers(e,t,n,r),snapshotViewsBackedByTransferredBuffers(a,t,n,r);return}if(a===`Set`){for(let e of i)snapshotViewsBackedByTransferredBuffers(e,t,n,r);return}if(a===`Object`)for(let e of Object.keys(i))snapshotViewsBackedByTransferredBuffers(i[e],t,n,r)}var Ce,we,Te,Ee=__esmMin(()=>{({toString:Ce}=Object.prototype),we={Error,EvalError,RangeError,ReferenceError,SyntaxError,TypeError,URIError},Te=new Set([`Int8Array`,`Uint8Array`,`Uint8ClampedArray`,`Int16Array`,`Uint16Array`,`Int32Array`,`Uint32Array`,`Float32Array`,`Float64Array`,`BigInt64Array`,`BigUint64Array`]),__name(structuredClone$1,`structuredClone`)});function ensureMainLoop(){let e=globalThis.imports;if(!e)return;if(De)return Oe;let t=e.gi?.GLib;if(t){if(Oe=new t.MainLoop(null,!1),De=!0,t.main_depth()===0)try{Oe.runAsync()}catch{}return Oe}}function quitMainLoop(){Oe&&=(Oe.quit(),De=!1,null)}var De,Oe,ke=__esmMin(()=>{De=!1,Oe=null}),L=__esmMin(()=>{T(),E(),j(),M(),ee(),te(),oe(),le(),ue(),de(),he(),_e(),be(),Se(),Ee(),ke()});w(),L(),registerGlobal(`Blob`,x),registerGlobal(`File`,S);var Ae=Object.defineProperty;__name((e,t)=>{let n={};for(var r in e)Ae(n,r,{get:e[r],enumerable:!0});return t||Ae(n,Symbol.toStringTag,{value:`Module`}),n},`__exportAll`)({attributes:()=>U,childNodesList:()=>V,elementChildren:()=>H,isConnected:()=>je,localName:()=>Ne,name:()=>Ie,namespaceURI:()=>Pe,nodeType:()=>z,ownerElement:()=>Re,parentNode:()=>B,prefix:()=>Fe,propertyEventListeners:()=>W,tagName:()=>Me,value:()=>Le});const z=Symbol(`nodeType`),B=Symbol(`parentNode`),V=Symbol(`childNodesList`),H=Symbol(`elementChildren`),je=Symbol(`isConnected`),Me=Symbol(`tagName`),Ne=Symbol(`localName`),Pe=Symbol(`namespaceURI`),Fe=Symbol(`prefix`),U=Symbol(`attributes`),W=Symbol(`propertyEventListeners`),Ie=Symbol(`name`),Le=Symbol(`value`),Re=Symbol(`ownerElement`),G={ELEMENT_NODE:1,ATTRIBUTE_NODE:2,TEXT_NODE:3,CDATA_SECTION_NODE:4,PROCESSING_INSTRUCTION_NODE:7,COMMENT_NODE:8,DOCUMENT_NODE:9,DOCUMENT_TYPE_NODE:10,DOCUMENT_FRAGMENT_NODE:11};var NodeList=class{constructor(e){this._items=e}get length(){return this._items.length}item(e){return this._items[e]??null}forEach(e,t){for(let n=0;n<this._items.length;n++)e.call(t,this._items[n],n,this)}entries(){return this._items.entries()}keys(){return this._items.keys()}values(){return this._items.values()}[Symbol.iterator](){return this._items[Symbol.iterator]()}get[Symbol.toStringTag](){return`NodeList`}};const ze={IndexSizeError:1,HierarchyRequestError:3,WrongDocumentError:4,InvalidCharacterError:5,NoModificationAllowedError:7,NotFoundError:8,NotSupportedError:9,InUseAttributeError:10,InvalidStateError:11,SyntaxError:12,InvalidModificationError:13,NamespaceError:14,InvalidAccessError:15,TypeMismatchError:17,SecurityError:18,NetworkError:19,AbortError:20,URLMismatchError:21,QuotaExceededError:22,TimeoutError:23,InvalidNodeTypeError:24,DataCloneError:25};var _DOMExceptionPolyfill=class extends Error{code;constructor(e,t){super(e),this.name=t||`Error`,this.code=Object.hasOwn(ze,this.name)?ze[this.name]:0}};const Be=globalThis.DOMException===void 0?_DOMExceptionPolyfill:globalThis.DOMException;me();const Ve=Symbol(`type`),He=Symbol(`bubbles`),Ue=Symbol(`cancelable`),We=Symbol(`composed`),Ge=Symbol(`target`),Ke=Symbol(`currentTarget`),qe=Symbol(`eventPhase`),Je=Symbol(`defaultPrevented`),Ye=Symbol(`isTrusted`),Xe=Symbol(`timeStamp`),Ze=Symbol(`stop`),Qe=Symbol(`immediateStop`),$e=Symbol(`dispatching`),et=Symbol(`inPassiveListener`);var Event=class{[Ve];[He];[Ue];[We];[Ge]=null;[Ke]=null;[qe]=0;[Je]=!1;[Ye]=!1;[Xe];[Ze]=!1;[Qe]=!1;[$e]=!1;[et]=!1;get type(){return this[Ve]}get bubbles(){return this[He]}get cancelable(){return this[Ue]}get composed(){return this[We]}get target(){return this[Ge]}get currentTarget(){return this[Ke]}get eventPhase(){return this[qe]}get defaultPrevented(){return this[Je]}get timeStamp(){return this[Xe]}get cancelBubble(){return this[Ze]}set cancelBubble(e){e&&this.stopPropagation()}get returnValue(){return!this[Je]}set returnValue(e){e||this.preventDefault()}get srcElement(){return this[Ge]}static NONE=0;static CAPTURING_PHASE=1;static AT_TARGET=2;static BUBBLING_PHASE=3;get[Symbol.toStringTag](){return`Event`}constructor(e,t){this[Ve]=e,this[He]=t?.bubbles??!1,this[Ue]=t?.cancelable??!1,this[We]=t?.composed??!1,this[Xe]=Date.now(),Object.defineProperty(this,"isTrusted",{get:()=>this[Ye],enumerable:!0,configurable:!1})}composedPath(){return this[Ke]?[this[Ke]]:[]}preventDefault(){this[Ue]&&!this[et]&&(this[Je]=!0)}stopPropagation(){this[Ze]=!0}stopImmediatePropagation(){this[Ze]=!0,this[Qe]=!0}},EventTarget=class{_listeners=new Map;get[Symbol.toStringTag](){return`EventTarget`}addEventListener(e,t,n){if(t===null)return;let r=typeof n==`boolean`?n:n?.capture??!1,i=typeof n==`object`?n?.once??!1:!1,a=typeof n==`object`?n?.passive??!1:!1,o=this._listeners.get(e);o||(o=[],this._listeners.set(e,o));for(let e of o)if(e.listener===t&&e.capture===r)return;let s={listener:t,capture:r,once:i,passive:a,removed:!1};o.push(s),typeof n==`object`&&n?.signal&&n.signal.addEventListener(`abort`,()=>{this.removeEventListener(e,t,{capture:r})},{once:!0})}removeEventListener(e,t,n){if(t===null)return;let r=typeof n==`boolean`?n:n?.capture??!1,i=this._listeners.get(e);if(!i)return;let a=i.findIndex(e=>e.listener===t&&e.capture===r);a!==-1&&(i[a].removed=!0,i.splice(a,1),i.length===0&&this._listeners.delete(e))}dispatchEvent(e){let t=e;if(t[$e])throw new Be(`The event is already being dispatched.`,`InvalidStateError`);t[$e]=!0,t[Ge]=this,t[Ke]=this,t[qe]=Event.AT_TARGET;let n=this._listeners.get(e.type);if(n){let r=[...n];for(let n of r)if(!n.removed){if(t[Qe]||t[Ze])break;n.once&&this.removeEventListener(e.type,n.listener,{capture:n.capture});try{n.passive&&(t[et]=!0),typeof n.listener==`function`?n.listener.call(this,e):typeof n.listener.handleEvent==`function`&&n.listener.handleEvent.call(n.listener,e)}catch(e){let t=globalThis;if(typeof t.reportError==`function`)try{t.reportError(e)}catch{}else if(e instanceof Error){let t=`${e.name}: ${e.message}`;I.error(e.stack?`${t}\n${e.stack}`:t)}else I.error(String(e))}finally{t[et]=!1}}}return t[qe]=Event.NONE,t[Ke]=null,t[$e]=!1,!e.defaultPrevented}};for(let[e,t]of[[`NONE`,0],[`CAPTURING_PHASE`,1],[`AT_TARGET`,2],[`BUBBLING_PHASE`,3]])Object.defineProperty(Event.prototype,e,{value:t,writable:!1,enumerable:!0,configurable:!1}),Object.defineProperty(Event,e,{value:t,writable:!1,enumerable:!0,configurable:!1});let tt,nt,rt,it,at;var ot=class Node extends EventTarget{constructor(...e){super(...e),this.ELEMENT_NODE=G.ELEMENT_NODE,this.ATTRIBUTE_NODE=G.ATTRIBUTE_NODE,this.TEXT_NODE=G.TEXT_NODE,this.CDATA_SECTION_NODE=G.CDATA_SECTION_NODE,this.PROCESSING_INSTRUCTION_NODE=G.PROCESSING_INSTRUCTION_NODE,this.COMMENT_NODE=G.COMMENT_NODE,this.DOCUMENT_NODE=G.DOCUMENT_NODE,this.DOCUMENT_TYPE_NODE=G.DOCUMENT_TYPE_NODE,this.DOCUMENT_FRAGMENT_NODE=G.DOCUMENT_FRAGMENT_NODE,this[tt]=G.ELEMENT_NODE,this[nt]=null,this[rt]=[],this[it]=[],this[at]=!1}static{this.ELEMENT_NODE=G.ELEMENT_NODE}static{this.ATTRIBUTE_NODE=G.ATTRIBUTE_NODE}static{this.TEXT_NODE=G.TEXT_NODE}static{this.CDATA_SECTION_NODE=G.CDATA_SECTION_NODE}static{this.PROCESSING_INSTRUCTION_NODE=G.PROCESSING_INSTRUCTION_NODE}static{this.COMMENT_NODE=G.COMMENT_NODE}static{this.DOCUMENT_NODE=G.DOCUMENT_NODE}static{this.DOCUMENT_TYPE_NODE=G.DOCUMENT_TYPE_NODE}static{this.DOCUMENT_FRAGMENT_NODE=G.DOCUMENT_FRAGMENT_NODE}static{this.DOCUMENT_POSITION_DISCONNECTED=1}static{this.DOCUMENT_POSITION_PRECEDING=2}static{this.DOCUMENT_POSITION_FOLLOWING=4}static{this.DOCUMENT_POSITION_CONTAINS=8}static{this.DOCUMENT_POSITION_CONTAINED_BY=16}static{this.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC=32}get nodeType(){return this[z]}get nodeName(){return``}get parentNode(){return this[B]}get parentElement(){let e=this[B];return e&&e[z]===G.ELEMENT_NODE?e:null}get childNodes(){return new NodeList(this[V])}get firstChild(){return this[V][0]??null}get lastChild(){let e=this[V];return e[e.length-1]??null}get previousSibling(){let e=this[B];if(!e)return null;let t=e[V],n=t.indexOf(this);return n>0?t[n-1]:null}get nextSibling(){let e=this[B];if(!e)return null;let t=e[V],n=t.indexOf(this);return n!==-1&&n<t.length-1?t[n+1]:null}get textContent(){return null}set textContent(e){}get nodeValue(){return null}set nodeValue(e){}get ownerDocument(){let e=this;for(;e[B];)e=e[B];let t=globalThis.document;return e===t?t:null}get isConnected(){return this[je]}hasChildNodes(){return this[V].length>0}contains(e){if(e===null)return!1;if(e===this)return!0;let t=e;for(;t;){if(t===this)return!0;t=t[B]}return!1}getRootNode(){let e=this;for(;e[B];)e=e[B];return e}appendChild(e){return e[B]&&e[B].removeChild(e),e[B]=this,this[V].push(e),e[z]===G.ELEMENT_NODE&&this[H].push(e),e}removeChild(e){let t=this[V],n=t.indexOf(e);if(n===-1)throw new DOMException(`Failed to execute 'removeChild' on 'Node': The node to be removed is not a child of this node.`,`NotFoundError`);if(t.splice(n,1),e[B]=null,e[z]===G.ELEMENT_NODE){let t=this[H].indexOf(e);t!==-1&&this[H].splice(t,1)}return e}insertBefore(e,t){if(t===null)return this.appendChild(e);let n=this[V],r=n.indexOf(t);if(r===-1)throw new DOMException(`Failed to execute 'insertBefore' on 'Node': The node before which the new node is to be inserted is not a child of this node.`,`NotFoundError`);if(e[B]&&e[B].removeChild(e),e[B]=this,n.splice(r,0,e),e[z]===G.ELEMENT_NODE){let t=this[H],i=t.length;for(let a=r;a<n.length;a++)if(n[a][z]===G.ELEMENT_NODE&&n[a]!==e){i=t.indexOf(n[a]);break}t.splice(i,0,e)}return e}replaceChild(e,t){return this.insertBefore(e,t),this.removeChild(t),t}cloneNode(e=!1){let t=new this.constructor;if(t[z]=this[z],e)for(let e of this[V])t.appendChild(e.cloneNode(!0));return t}dispatchEvent(e){let t=super.dispatchEvent(e);if(e.bubbles&&!e.cancelBubble){let t=this[B];for(;t&&(Object.getPrototypeOf(Node.prototype).dispatchEvent.call(t,e),!e.cancelBubble);)t=t[B]}return t}get[(tt=z,nt=B,rt=V,it=H,at=je,Symbol.toStringTag)](){return`Node`}};const st={html:`http://www.w3.org/1999/xhtml`,svg:`http://www.w3.org/2000/svg`,mathML:`http://www.w3.org/1998/Math/MathML`,xml:`http://www.w3.org/XML/1998/namespace`,xmlns:`http://www.w3.org/2000/xmlns/`};var Attr=class{constructor(e,t,n=null,r=null,i=null){this.specified=!0,this[Ie]=e,this[Le]=t,this[Re]=i,this.namespaceURI=n,this.prefix=r;let a=e.indexOf(`:`);this.localName=a===-1?e:e.slice(a+1)}get name(){return this[Ie]}get value(){return this[Le]}set value(e){this[Le]=e}get ownerElement(){return this[Re]}get[Symbol.toStringTag](){return`Attr`}},NamedNodeMap=class{constructor(e){this._items=[],this._ownerElement=e}get length(){return this._items.length}item(e){return this._items[e]??null}getNamedItem(e){return this._findByName(e)}getNamedItemNS(e,t){let n=e===``?null:e;for(let e of this._items)if(e.namespaceURI===n&&e.localName===t)return e;return null}setNamedItem(e){return this._setAttr(e)}setNamedItemNS(e){return this._setAttr(e)}removeNamedItem(e){let t=this._findByName(e);if(!t)throw new DOMException(`Failed to execute 'removeNamedItem' on 'NamedNodeMap': No item with name '${e}' was found.`,`NotFoundError`);return this._removeAttr(t),t}removeNamedItemNS(e,t){let n=this.getNamedItemNS(e,t);if(!n)throw new DOMException(`Failed to execute 'removeNamedItemNS' on 'NamedNodeMap': No item with namespace '${e}' and localName '${t}' was found.`,`NotFoundError`);return this._removeAttr(n),n}[Symbol.iterator](){return this._items[Symbol.iterator]()}get[Symbol.toStringTag](){return`NamedNodeMap`}_setNamedItem(e,t,n=null,r=null){let i=n===null?this._findByName(e):this.getNamedItemNS(n,e.includes(`:`)?e.split(`:`)[1]:e);if(i)i.value=t;else{let i=new Attr(e,t,n,r,this._ownerElement);this._items.push(i)}}_removeNamedItem(e){let t=this._findByName(e);return t?(this._removeAttr(t),!0):!1}_removeNamedItemNS(e,t){let n=this.getNamedItemNS(e,t);return n?(this._removeAttr(n),!0):!1}_findByName(e){let t=this._ownerElement.namespaceURI===st.html,n=t?e.toLowerCase():e;for(let e of this._items)if((t?e.name.toLowerCase():e.name)===n)return e;return null}_setAttr(e){let t=null;if(t=e.namespaceURI===null?this._findByName(e.name):this.getNamedItemNS(e.namespaceURI,e.localName),t){let n=new Attr(t.name,t.value,t.namespaceURI,t.prefix,t.ownerElement);return t.value=e.value,n}return this._items.push(e),null}_removeAttr(e){let t=this._items.indexOf(e);t!==-1&&this._items.splice(t,1)}};me();let ct,lt,ut,dt,ft,pt;var Element=class extends ot{constructor(){super(),this[ct]=``,this[lt]=``,this[ut]=st.html,this[dt]=null,this[ft]=new NamedNodeMap(this),this[pt]=new Map,this._resizeSubscribers=null,this._allocatedClientWidth=0,this._allocatedClientHeight=0,this._pointerCaptures=new Set,this[z]=G.ELEMENT_NODE}get tagName(){return this[Me]}get localName(){return this[Ne]}get namespaceURI(){return this[Pe]}get prefix(){return this[Fe]}get nodeName(){return this[Me]}get attributes(){return this[U]}get id(){return this.getAttribute(`id`)??``}set id(e){this.setAttribute(`id`,e)}get className(){return this.getAttribute(`class`)??``}set className(e){this.setAttribute(`class`,e)}get children(){return this[H]}get childElementCount(){return this[H].length}get firstElementChild(){return this[H][0]??null}get lastElementChild(){let e=this[H];return e[e.length-1]??null}get previousElementSibling(){let e=this[B];if(!e)return null;let t=e[H],n=t.indexOf(this);return n>0?t[n-1]:null}get nextElementSibling(){let e=this[B];if(!e)return null;let t=e[H],n=t.indexOf(this);return n!==-1&&n<t.length-1?t[n+1]:null}get textContent(){let e=``;for(let t of this[V])t.textContent!==null&&(e+=t.textContent);return e}set textContent(e){let t=this[V];for(;t.length>0;)this.removeChild(t[0])}getAttribute(e){let t=this[U].getNamedItem(e);return t?t.value:null}getAttributeNS(e,t){let n=this[U].getNamedItemNS(e,t);return n?n.value:null}setAttribute(e,t){this[U]._setNamedItem(e,String(t))}setAttributeNS(e,t,n){let r=e===``?null:e,i=t.split(`:`),a=i.length>1?i[0]:null;this[U]._setNamedItem(t,String(n),r,a)}removeAttribute(e){this[U]._removeNamedItem(e)}removeAttributeNS(e,t){let n=e===``?null:e;this[U]._removeNamedItemNS(n,t)}hasAttribute(e){return this[U].getNamedItem(e)!==null}hasAttributeNS(e,t){return this[U].getNamedItemNS(e,t)!==null}getAttributeNode(e){return this[U].getNamedItem(e)}setAttributeNode(e){return this[U].setNamedItem(e)}removeAttributeNode(e){let t=this[U].getNamedItem(e.name);if(!t)throw new DOMException(`Failed to execute 'removeAttributeNode' on 'Element': The attribute is not owned by this element.`,`NotFoundError`);return this[U].removeNamedItem(t.name),t}toggleAttribute(e,t){return t===void 0?this.hasAttribute(e)?(this.removeAttribute(e),!1):(this.setAttribute(e,``),!0):t?(this.setAttribute(e,``),!0):(this.removeAttribute(e),!1)}hasAttributes(){return this[U].length>0}dispatchEvent(e){let t=super.dispatchEvent(e),n=this[W].get(`on`+e.type);return typeof n==`function`&&n.call(this,e),t}querySelector(e){return null}querySelectorAll(e){return[]}matches(e){return!1}closest(e){return null}getElementsByTagName(e){let t=[],n=e.toUpperCase(),walk=r=>{for(let i of r[V])if(i[z]===G.ELEMENT_NODE){let r=i;(e===`*`||r[Me]===n)&&t.push(r),walk(r)}};return walk(this),t}getElementsByClassName(e){let t=[],n=e.split(/\s+/).filter(Boolean),walk=e=>{for(let r of e[V])if(r[z]===G.ELEMENT_NODE){let e=r,i=e.className.split(/\s+/);n.every(e=>i.includes(e))&&t.push(e),walk(e)}};return walk(this),t}cloneNode(e=!1){let t=super.cloneNode(!1);t[Me]=this[Me],t[Ne]=this[Ne],t[Pe]=this[Pe],t[Fe]=this[Fe];for(let e of this[U])t.setAttributeNS(e.namespaceURI,e.name,e.value);if(e)for(let e of this[V])t.appendChild(e.cloneNode(!0));return t}_onResize(e){let t=this._resizeSubscribers??=new Set;return t.add(e),()=>{t.delete(e),t.size===0&&(this._resizeSubscribers=null)}}_fireResizeSubscribers(e,t){let n=this._resizeSubscribers;if(!(!n||n.size===0))for(let r of[...n])try{r(e,t)}catch(e){I.error(`ResizeObserver subscriber threw:`,e)}}setPointerCapture(e){this._pointerCaptures.add(e)}releasePointerCapture(e){this._pointerCaptures.delete(e)}hasPointerCapture(e){return this._pointerCaptures.has(e)}get[(ct=Me,lt=Ne,ut=Pe,dt=Fe,ft=U,pt=W,Symbol.toStringTag)](){return`Element`}},CSSStyleDeclaration=class{constructor(){this._cssText=``}get cssText(){return this._cssText}set cssText(e){this._cssText=e;for(let t of e.split(`;`)){let e=t.indexOf(`:`);if(e===-1)continue;let n=t.slice(0,e).trim(),r=t.slice(e+1).trim();if(!n)continue;let i=n.replace(/-([a-z])/g,(e,t)=>t.toUpperCase());this[i]=r}}setProperty(e,t,n){this[e]=t}getPropertyValue(e){let t=this[e];return typeof t==`string`?t:``}removeProperty(e){let t=this[e];return delete this[e],typeof t==`string`?t:``}getPropertyPriority(e){return``}},HTMLElement$1=class extends Element{static{__name(this,`HTMLElement`)}constructor(...e){super(...e),this.style=new CSSStyleDeclaration}get dataset(){let e=this;return new Proxy({},{get(t,n){if(typeof n!=`string`)return;let r=`data-`+n.replace(/[A-Z]/g,e=>`-`+e.toLowerCase());return e.getAttribute(r)??void 0},set(t,n,r){if(typeof n!=`string`)return!1;let i=`data-`+n.replace(/[A-Z]/g,e=>`-`+e.toLowerCase());return e.setAttribute(i,String(r)),!0},deleteProperty(t,n){if(typeof n!=`string`)return!1;let r=`data-`+n.replace(/[A-Z]/g,e=>`-`+e.toLowerCase());return e.removeAttribute(r),!0},has(t,n){if(typeof n!=`string`)return!1;let r=`data-`+n.replace(/[A-Z]/g,e=>`-`+e.toLowerCase());return e.hasAttribute(r)}})}get title(){return this.getAttribute(`title`)??``}set title(e){this.setAttribute(`title`,e)}get lang(){return this.getAttribute(`lang`)??``}set lang(e){this.setAttribute(`lang`,e)}get dir(){return this.getAttribute(`dir`)??``}set dir(e){this.setAttribute(`dir`,e)}get accessKey(){return this.getAttribute(`accesskey`)??``}set accessKey(e){this.setAttribute(`accesskey`,e)}get accessKeyLabel(){return this.getAttribute(`accesskey`)??``}get hidden(){return this.hasAttribute(`hidden`)}set hidden(e){e?this.setAttribute(`hidden`,``):this.removeAttribute(`hidden`)}get draggable(){return this.getAttribute(`draggable`)===`true`}set draggable(e){this.setAttribute(`draggable`,String(e))}get spellcheck(){let e=this.getAttribute(`spellcheck`);return e===`false`?!1:e!==null}set spellcheck(e){this.setAttribute(`spellcheck`,String(e))}get translate(){return this.getAttribute(`translate`)!==`no`}set translate(e){this.setAttribute(`translate`,e?`yes`:`no`)}get tabIndex(){let e=this.getAttribute(`tabindex`);return e===null?-1:Number(e)}set tabIndex(e){this.setAttribute(`tabindex`,String(e))}get contentEditable(){let e=this.getAttribute(`contenteditable`);return e===``||e===`true`?`true`:e===`false`?`false`:`inherit`}set contentEditable(e){e===`inherit`?this.removeAttribute(`contenteditable`):this.setAttribute(`contenteditable`,e)}get isContentEditable(){return this.contentEditable===`true`}get offsetHeight(){return this._allocatedClientHeight}get offsetWidth(){return this._allocatedClientWidth}get offsetLeft(){return 0}get offsetTop(){return 0}get offsetParent(){return null}get clientHeight(){return this._allocatedClientHeight}get clientWidth(){return this._allocatedClientWidth}get clientLeft(){return 0}get clientTop(){return 0}get scrollHeight(){return this._allocatedClientHeight}get scrollWidth(){return this._allocatedClientWidth}get scrollTop(){return 0}set scrollTop(e){}get scrollLeft(){return 0}set scrollLeft(e){}getBoundingClientRect(){let e=this.clientWidth,t=this.clientHeight;return{x:0,y:0,top:0,left:0,right:e,bottom:t,width:e,height:t,toJSON(){return this}}}click(){this.dispatchEvent(new Event(`click`,{bubbles:!0,cancelable:!0}))}blur(){this.dispatchEvent(new Event(`blur`))}focus(){this.dispatchEvent(new Event(`focus`))}get onclick(){return this[W].get(`onclick`)??null}set onclick(e){this[W].set(`onclick`,e)}get ondblclick(){return this[W].get(`ondblclick`)??null}set ondblclick(e){this[W].set(`ondblclick`,e)}get onload(){return this[W].get(`onload`)??null}set onload(e){this[W].set(`onload`,e)}get onerror(){return this[W].get(`onerror`)??null}set onerror(e){this[W].set(`onerror`,e)}get onabort(){return this[W].get(`onabort`)??null}set onabort(e){this[W].set(`onabort`,e)}get onfocus(){return this[W].get(`onfocus`)??null}set onfocus(e){this[W].set(`onfocus`,e)}get onblur(){return this[W].get(`onblur`)??null}set onblur(e){this[W].set(`onblur`,e)}get onchange(){return this[W].get(`onchange`)??null}set onchange(e){this[W].set(`onchange`,e)}get oninput(){return this[W].get(`oninput`)??null}set oninput(e){this[W].set(`oninput`,e)}get onsubmit(){return this[W].get(`onsubmit`)??null}get onreset(){return this[W].get(`onreset`)??null}set onreset(e){this[W].set(`onreset`,e)}get onscroll(){return this[W].get(`onscroll`)??null}set onscroll(e){this[W].set(`onscroll`,e)}get onresize(){return this[W].get(`onresize`)??null}set onresize(e){this[W].set(`onresize`,e)}get onmousedown(){return this[W].get(`onmousedown`)??null}set onmousedown(e){this[W].set(`onmousedown`,e)}get onmouseup(){return this[W].get(`onmouseup`)??null}set onmouseup(e){this[W].set(`onmouseup`,e)}get onmousemove(){return this[W].get(`onmousemove`)??null}set onmousemove(e){this[W].set(`onmousemove`,e)}get onmouseover(){return this[W].get(`onmouseover`)??null}set onmouseover(e){this[W].set(`onmouseover`,e)}get onmouseout(){return this[W].get(`onmouseout`)??null}set onmouseout(e){this[W].set(`onmouseout`,e)}get onmouseenter(){return this[W].get(`onmouseenter`)??null}set onmouseenter(e){this[W].set(`onmouseenter`,e)}get onmouseleave(){return this[W].get(`onmouseleave`)??null}set onmouseleave(e){this[W].set(`onmouseleave`,e)}get oncontextmenu(){return this[W].get(`oncontextmenu`)??null}set oncontextmenu(e){this[W].set(`oncontextmenu`,e)}get onwheel(){return this[W].get(`onwheel`)??null}set onwheel(e){this[W].set(`onwheel`,e)}get onkeydown(){return this[W].get(`onkeydown`)??null}set onkeydown(e){this[W].set(`onkeydown`,e)}get onkeyup(){return this[W].get(`onkeyup`)??null}set onkeyup(e){this[W].set(`onkeyup`,e)}get ontouchstart(){return this[W].get(`ontouchstart`)??null}set ontouchstart(e){this[W].set(`ontouchstart`,e)}get ontouchend(){return this[W].get(`ontouchend`)??null}set ontouchend(e){this[W].set(`ontouchend`,e)}get ontouchmove(){return this[W].get(`ontouchmove`)??null}set ontouchmove(e){this[W].set(`ontouchmove`,e)}get onpointerdown(){return this[W].get(`onpointerdown`)??null}set onpointerdown(e){this[W].set(`onpointerdown`,e)}get onpointerup(){return this[W].get(`onpointerup`)??null}set onpointerup(e){this[W].set(`onpointerup`,e)}get onpointermove(){return this[W].get(`onpointermove`)??null}set onpointermove(e){this[W].set(`onpointermove`,e)}cloneNode(e=!1){return super.cloneNode(e)}get[Symbol.toStringTag](){return`HTMLElement`}},mt=class HTMLCanvasElement extends HTMLElement$1{constructor(...e){super(...e),this.oncontextlost=null,this.oncontextrestored=null,this.onwebglcontextcreationerror=null,this.onwebglcontextlost=null,this.onwebglcontextrestored=null}static{this._contextFactories=new Map}static registerContextFactory(e,t){HTMLCanvasElement._contextFactories.set(e,t)}get width(){let e=this.getAttribute(`width`);return e===null?300:Number(e)}set width(e){this.setAttribute(`width`,String(e))}get height(){let e=this.getAttribute(`height`);return e===null?150:Number(e)}set height(e){this.setAttribute(`height`,String(e))}getContext(e,t){let n=HTMLCanvasElement._contextFactories.get(e);return n?n(this,t):null}toDataURL(e,t){let n=this.getContext(`2d`);return n&&typeof n._toDataURL==`function`?n._toDataURL(e,t):``}toBlob(e,t,n){let r=this.toDataURL(t,n);if(!r){e(null);return}let[i,a]=r.split(`,`),o=i.split(`:`)[1].split(`;`)[0],s=atob(a),c=new Uint8Array(s.length);for(let e=0;e<s.length;e++)c[e]=s.charCodeAt(e);e(new Blob([c],{type:o}))}captureStream(e){return{}}},ht=class DOMMatrix{constructor(e){this.a=1,this.b=0,this.c=0,this.d=1,this.e=0,this.f=0,this.m11=1,this.m12=0,this.m13=0,this.m14=0,this.m21=0,this.m22=1,this.m23=0,this.m24=0,this.m31=0,this.m32=0,this.m33=1,this.m34=0,this.m41=0,this.m42=0,this.m43=0,this.m44=1,this.is2D=!0,this.isIdentity=!0,Array.isArray(e)&&(e.length===6?(this.a=this.m11=e[0],this.b=this.m12=e[1],this.c=this.m21=e[2],this.d=this.m22=e[3],this.e=this.m41=e[4],this.f=this.m42=e[5],this.is2D=!0):e.length===16&&(this.m11=e[0],this.m12=e[1],this.m13=e[2],this.m14=e[3],this.m21=e[4],this.m22=e[5],this.m23=e[6],this.m24=e[7],this.m31=e[8],this.m32=e[9],this.m33=e[10],this.m34=e[11],this.m41=e[12],this.m42=e[13],this.m43=e[14],this.m44=e[15],this.a=this.m11,this.b=this.m12,this.c=this.m21,this.d=this.m22,this.e=this.m41,this.f=this.m42,this.is2D=!1),this.isIdentity=this.a===1&&this.b===0&&this.c===0&&this.d===1&&this.e===0&&this.f===0)}multiply(e){return new DOMMatrix([this.a*e.a+this.c*e.b,this.b*e.a+this.d*e.b,this.a*e.c+this.c*e.d,this.b*e.c+this.d*e.d,this.a*e.e+this.c*e.f+this.e,this.b*e.e+this.d*e.f+this.f])}multiplySelf(e){let t=this.multiply(e);return this.a=t.a,this.b=t.b,this.c=t.c,this.d=t.d,this.e=t.e,this.f=t.f,this.m11=this.a,this.m12=this.b,this.m21=this.c,this.m22=this.d,this.m41=this.e,this.m42=this.f,this.isIdentity=!1,this}inverse(){let e=this.a*this.d-this.b*this.c;if(e===0)return new DOMMatrix([1,0,0,1,0,0]);let t=1/e;return new DOMMatrix([this.d*t,-this.b*t,-this.c*t,this.a*t,(this.c*this.f-this.d*this.e)*t,(this.b*this.e-this.a*this.f)*t])}translate(e=0,t=0){return this.multiply({a:1,b:0,c:0,d:1,e,f:t})}scale(e=1,t=e){return this.multiply({a:e,b:0,c:0,d:t,e:0,f:0})}};const gt=ht;function defineGlobal(e,t){Object.defineProperty(globalThis,e,{value:t,writable:!0,configurable:!0})}function defineGlobalIfMissing(e,t){globalThis[e]===void 0&&defineGlobal(e,t)}const _t={aliceblue:`#f0f8ff`,antiquewhite:`#faebd7`,aqua:`#00ffff`,aquamarine:`#7fffd4`,azure:`#f0ffff`,beige:`#f5f5dc`,bisque:`#ffe4c4`,black:`#000000`,blanchedalmond:`#ffebcd`,blue:`#0000ff`,blueviolet:`#8a2be2`,brown:`#a52a2a`,burlywood:`#deb887`,cadetblue:`#5f9ea0`,chartreuse:`#7fff00`,chocolate:`#d2691e`,coral:`#ff7f50`,cornflowerblue:`#6495ed`,cornsilk:`#fff8dc`,crimson:`#dc143c`,cyan:`#00ffff`,darkblue:`#00008b`,darkcyan:`#008b8b`,darkgoldenrod:`#b8860b`,darkgray:`#a9a9a9`,darkgreen:`#006400`,darkgrey:`#a9a9a9`,darkkhaki:`#bdb76b`,darkmagenta:`#8b008b`,darkolivegreen:`#556b2f`,darkorange:`#ff8c00`,darkorchid:`#9932cc`,darkred:`#8b0000`,darksalmon:`#e9967a`,darkseagreen:`#8fbc8f`,darkslateblue:`#483d8b`,darkslategray:`#2f4f4f`,darkslategrey:`#2f4f4f`,darkturquoise:`#00ced1`,darkviolet:`#9400d3`,deeppink:`#ff1493`,deepskyblue:`#00bfff`,dimgray:`#696969`,dimgrey:`#696969`,dodgerblue:`#1e90ff`,firebrick:`#b22222`,floralwhite:`#fffaf0`,forestgreen:`#228b22`,fuchsia:`#ff00ff`,gainsboro:`#dcdcdc`,ghostwhite:`#f8f8ff`,gold:`#ffd700`,goldenrod:`#daa520`,gray:`#808080`,green:`#008000`,greenyellow:`#adff2f`,grey:`#808080`,honeydew:`#f0fff0`,hotpink:`#ff69b4`,indianred:`#cd5c5c`,indigo:`#4b0082`,ivory:`#fffff0`,khaki:`#f0e68c`,lavender:`#e6e6fa`,lavenderblush:`#fff0f5`,lawngreen:`#7cfc00`,lemonchiffon:`#fffacd`,lightblue:`#add8e6`,lightcoral:`#f08080`,lightcyan:`#e0ffff`,lightgoldenrodyellow:`#fafad2`,lightgray:`#d3d3d3`,lightgreen:`#90ee90`,lightgrey:`#d3d3d3`,lightpink:`#ffb6c1`,lightsalmon:`#ffa07a`,lightseagreen:`#20b2aa`,lightskyblue:`#87cefa`,lightslategray:`#778899`,lightslategrey:`#778899`,lightsteelblue:`#b0c4de`,lightyellow:`#ffffe0`,lime:`#00ff00`,limegreen:`#32cd32`,linen:`#faf0e6`,magenta:`#ff00ff`,maroon:`#800000`,mediumaquamarine:`#66cdaa`,mediumblue:`#0000cd`,mediumorchid:`#ba55d3`,mediumpurple:`#9370db`,mediumseagreen:`#3cb371`,mediumslateblue:`#7b68ee`,mediumspringgreen:`#00fa9a`,mediumturquoise:`#48d1cc`,mediumvioletred:`#c71585`,midnightblue:`#191970`,mintcream:`#f5fffa`,mistyrose:`#ffe4e1`,moccasin:`#ffe4b5`,navajowhite:`#ffdead`,navy:`#000080`,oldlace:`#fdf5e6`,olive:`#808000`,olivedrab:`#6b8e23`,orange:`#ffa500`,orangered:`#ff4500`,orchid:`#da70d6`,palegoldenrod:`#eee8aa`,palegreen:`#98fb98`,paleturquoise:`#afeeee`,palevioletred:`#db7093`,papayawhip:`#ffefd5`,peachpuff:`#ffdab9`,peru:`#cd853f`,pink:`#ffc0cb`,plum:`#dda0dd`,powderblue:`#b0e0e6`,purple:`#800080`,rebeccapurple:`#663399`,red:`#ff0000`,rosybrown:`#bc8f8f`,royalblue:`#4169e1`,saddlebrown:`#8b4513`,salmon:`#fa8072`,sandybrown:`#f4a460`,seagreen:`#2e8b57`,seashell:`#fff5ee`,sienna:`#a0522d`,silver:`#c0c0c0`,skyblue:`#87ceeb`,slateblue:`#6a5acd`,slategray:`#708090`,slategrey:`#708090`,snow:`#fffafa`,springgreen:`#00ff7f`,steelblue:`#4682b4`,tan:`#d2b48c`,teal:`#008080`,thistle:`#d8bfd8`,tomato:`#ff6347`,turquoise:`#40e0d0`,violet:`#ee82ee`,wheat:`#f5deb3`,white:`#ffffff`,whitesmoke:`#f5f5f5`,yellow:`#ffff00`,yellowgreen:`#9acd32`,transparent:`#00000000`};function parseColor(e){if(!e||typeof e!=`string`)return null;let t=e.trim().toLowerCase(),n=_t[t];if(n)return parseHex(n);if(t.startsWith(`#`))return parseHex(t);let r=t.match(/^rgba?\(\s*(\d+(?:\.\d+)?%?)\s*[,\s]\s*(\d+(?:\.\d+)?%?)\s*[,\s]\s*(\d+(?:\.\d+)?%?)\s*(?:[,/]\s*(\d+(?:\.\d+)?%?))?\s*\)$/);if(r)return{r:parseComponent(r[1],255)/255,g:parseComponent(r[2],255)/255,b:parseComponent(r[3],255)/255,a:r[4]===void 0?1:parseComponent(r[4],1)};let i=t.match(/^hsla?\(\s*(\d+(?:\.\d+)?)\s*[,\s]\s*(\d+(?:\.\d+)?)(%)?\s*[,\s]\s*(\d+(?:\.\d+)?)(%)?\s*(?:[,/]\s*(\d+(?:\.\d+)?%?))?\s*\)$/);if(i){let e=parseFloat(i[1]),t=parseFloat(i[2]),n=i[3]===`%`,r=parseFloat(i[4]),a=i[5]===`%`,o=i[6]===void 0?1:parseComponent(i[6],1);return e>1&&(e/=360),(n||t>1)&&(t/=100),(a||r>1)&&(r/=100),hslToRGBA(e,t,r,Math.max(0,Math.min(1,o)))}return null}function parseHex(e){let t=e.slice(1),n,r,i,a=1;if(t.length===3)n=parseInt(t[0]+t[0],16)/255,r=parseInt(t[1]+t[1],16)/255,i=parseInt(t[2]+t[2],16)/255;else if(t.length===4)n=parseInt(t[0]+t[0],16)/255,r=parseInt(t[1]+t[1],16)/255,i=parseInt(t[2]+t[2],16)/255,a=parseInt(t[3]+t[3],16)/255;else if(t.length===6)n=parseInt(t.slice(0,2),16)/255,r=parseInt(t.slice(2,4),16)/255,i=parseInt(t.slice(4,6),16)/255;else if(t.length===8)n=parseInt(t.slice(0,2),16)/255,r=parseInt(t.slice(2,4),16)/255,i=parseInt(t.slice(4,6),16)/255,a=parseInt(t.slice(6,8),16)/255;else return null;return{r:n,g:r,b:i,a}}function parseComponent(e,t){return e.endsWith(`%`)?parseFloat(e)/100*t:parseFloat(e)}function hue2rgb(e,t,n){return n<0&&(n+=1),n>1&&--n,n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function hslToRGBA(e,t,n,r){let i,a,o;if(t===0)i=a=o=n;else{let r=n<.5?n*(1+t):n+t-n*t,s=2*n-r;i=hue2rgb(s,r,e+1/3),a=hue2rgb(s,r,e),o=hue2rgb(s,r,e-1/3)}return{r:i,g:a,b:o,a:r}}const vt={r:0,g:0,b:0,a:1};var CanvasGradient=class{constructor(e,t,r,i,a,o,s){e===`radial`?this._pattern=new n.RadialGradient(t,r,o,i,a,s):this._pattern=new n.LinearGradient(t,r,i,a)}addColorStop(e,t){let n=parseColor(t);n&&this._pattern.addColorStopRGBA(e,n.r,n.g,n.b,n.a)}_getCairoPattern(){return this._pattern}};function quadraticToCubic(e,t,n,r,i,a){return{cp1x:e+2/3*(n-e),cp1y:t+2/3*(r-t),cp2x:i+2/3*(n-i),cp2y:a+2/3*(r-a)}}function computeArcTo(e,t,n,r,i,a,o){let s=e-n,c=t-r,l=i-n,u=a-r,d=Math.sqrt(s*s+c*c),p=Math.sqrt(l*l+u*u);if(d===0||p===0)return null;let m=s/d,h=c/d,g=l/p,_=u/p,v=m*_-h*g;if(Math.abs(v)<1e-10)return null;let y=m*g+h*_,b=Math.acos(Math.max(-1,Math.min(1,y)))/2,x=o/Math.tan(b),S=n+m*x,w=r+h*x,T=n+g*x,E=r+_*x,D=o/Math.sin(b),O=(m+g)/2,k=(h+_)/2,A=Math.sqrt(O*O+k*k),j=n+O/A*D,M=r+k/A*D;return{tx0:S,ty0:w,tx1:T,ty1:E,cx:j,cy:M,startAngle:Math.atan2(w-M,S-j),endAngle:Math.atan2(E-M,T-j),counterclockwise:v>0}}function cairoArcTo(e,t,n,r,i,a,o,s){let c=computeArcTo(t,n,r,i,a,o,s);if(!c){e.lineTo(r,i);return}let{tx0:l,ty0:u,cx:d,cy:p,startAngle:m,endAngle:h,counterclockwise:g}=c;e.lineTo(l,u),g?e.arcNegative(d,p,s,m,h):e.arc(d,p,s,m,h)}function cairoEllipse(e,t,n,r,i,a,o,s,c){e.save(),e.translate(t,n),e.rotate(a),e.scale(r,i),c?e.arcNegative(0,0,1,o,s):e.arc(0,0,1,o,s),e.restore()}function cairoRoundRect(e,t,n,r,i,a){let o,s,c,l;typeof a==`number`?o=s=c=l=a:a.length===1?o=s=c=l=a[0]:a.length===2?(o=c=a[0],s=l=a[1]):a.length===3?(o=a[0],s=l=a[1],c=a[2]):(o=a[0],s=a[1],c=a[2],l=a[3]);let u=Math.min(r/2,i/2);o=Math.min(o,u),s=Math.min(s,u),c=Math.min(c,u),l=Math.min(l,u);let d=Math.PI/2;e.newSubPath(),e.arc(t+o,n+o,o,Math.PI,Math.PI+d),e.arc(t+r-s,n+s,s,-d,0),e.arc(t+r-c,n+i-c,c,0,d),e.arc(t+l,n+i-l,l,d,Math.PI),e.closePath()}const yt={"source-over":2,"source-in":3,"source-out":4,"source-atop":5,"destination-over":7,"destination-in":8,"destination-out":9,"destination-atop":10,lighter:12,copy:1,xor:11,multiply:14,screen:15,overlay:16,darken:17,lighten:18,"color-dodge":19,"color-burn":20,"hard-light":21,"soft-light":22,difference:23,exclusion:24,hue:25,saturation:26,color:27,luminosity:28},bt={butt:0,round:1,square:2},xt={miter:0,round:1,bevel:2};var St=class Path2D{constructor(e){this._ops=[],e instanceof Path2D&&(this._ops=[...e._ops])}addPath(e){this._ops.push(...e._ops)}moveTo(e,t){this._ops.push({type:`moveTo`,x:e,y:t})}lineTo(e,t){this._ops.push({type:`lineTo`,x:e,y:t})}closePath(){this._ops.push({type:`closePath`})}bezierCurveTo(e,t,n,r,i,a){this._ops.push({type:`bezierCurveTo`,cp1x:e,cp1y:t,cp2x:n,cp2y:r,x:i,y:a})}quadraticCurveTo(e,t,n,r){this._ops.push({type:`quadraticCurveTo`,cpx:e,cpy:t,x:n,y:r})}arc(e,t,n,r,i,a=!1){this._ops.push({type:`arc`,x:e,y:t,radius:n,startAngle:r,endAngle:i,ccw:a})}ellipse(e,t,n,r,i,a,o,s=!1){if(n<0||r<0)throw RangeError(`The radii provided are negative`);this._ops.push({type:`ellipse`,x:e,y:t,rx:n,ry:r,rotation:i,startAngle:a,endAngle:o,ccw:s})}rect(e,t,n,r){this._ops.push({type:`rect`,x:e,y:t,w:n,h:r})}roundRect(e,t,n,r,i=0){this._ops.push({type:`roundRect`,x:e,y:t,w:n,h:r,radii:i})}_replayOnCairo(e){let t=0,n=0;for(let r of this._ops)switch(r.type){case`moveTo`:e.moveTo(r.x,r.y),t=r.x,n=r.y;break;case`lineTo`:e.lineTo(r.x,r.y),t=r.x,n=r.y;break;case`closePath`:e.closePath();break;case`bezierCurveTo`:e.curveTo(r.cp1x,r.cp1y,r.cp2x,r.cp2y,r.x,r.y),t=r.x,n=r.y;break;case`quadraticCurveTo`:{let{cp1x:i,cp1y:a,cp2x:o,cp2y:s}=quadraticToCubic(t,n,r.cpx,r.cpy,r.x,r.y);e.curveTo(i,a,o,s,r.x,r.y),t=r.x,n=r.y;break}case`arc`:r.ccw?e.arcNegative(r.x,r.y,r.radius,r.startAngle,r.endAngle):e.arc(r.x,r.y,r.radius,r.startAngle,r.endAngle);break;case`ellipse`:e.save(),e.translate(r.x,r.y),e.rotate(r.rotation),e.scale(r.rx,r.ry),r.ccw?e.arcNegative(0,0,1,r.startAngle,r.endAngle):e.arc(0,0,1,r.startAngle,r.endAngle),e.restore();break;case`rect`:e.rectangle(r.x,r.y,r.w,r.h);break;case`roundRect`:cairoRoundRect(e,r.x,r.y,r.w,r.h,r.radii);break}}};function asCairoPattern(e){if(!e)return null;let t=e;return typeof t.setFilter!=`function`||typeof t.setExtend!=`function`?null:t}function isPixbufImageSource(e){return typeof e!=`object`||!e?!1:typeof e.isPixbuf==`function`&&e.isPixbuf()}function isCanvasImageSource(e){return typeof e!=`object`||!e?!1:typeof e.getContext==`function`}var Ct=class CanvasPattern{constructor(e,t){let r=asCairoPattern(new n.SurfacePattern(e));if(!r)throw TypeError(`CanvasPattern: cairo SurfacePattern is missing setExtend at runtime — incompatible Cairo binding`);switch(this._pattern=r,t){case`repeat`:case``:case null:r.setExtend(n.Extend.REPEAT);break;case`repeat-x`:case`repeat-y`:r.setExtend(n.Extend.REPEAT);break;case`no-repeat`:r.setExtend(n.Extend.NONE);break}}static create(e,t){if(isPixbufImageSource(e)){let i=e._pixbuf,a=i.get_width(),o=i.get_height(),s=new n.ImageSurface(n.Format.ARGB32,a,o),c=new n.Context(s);return r.cairo_set_source_pixbuf(c,i,0,0),c.paint(),c.$dispose(),new CanvasPattern(s,t)}if(isCanvasImageSource(e)){let r=e.getContext(`2d`);if(r&&typeof r._getSurface==`function`){let e=r._getSurface(),i=e.getWidth(),a=e.getHeight(),o=new n.ImageSurface(n.Format.ARGB32,i,a),s=new n.Context(o);return s.setSourceSurface(e,0,0),s.paint(),s.$dispose(),new CanvasPattern(o,t)}}return null}_getCairoPattern(){return this._pattern}},OurImageData=class{constructor(e,t,n){if(this.colorSpace=`srgb`,typeof e==`number`)this.width=e,this.height=t,this.data=new Uint8ClampedArray(this.width*this.height*4);else if(this.data=e,this.width=t,this.height=n??this.data.length/(4*this.width),this.data.length!==this.width*this.height*4)throw RangeError(`Source data length ${this.data.length} is not a multiple of (4 * width=${this.width})`)}};const wt={translate(e,t){this._ensureSurface(),this._ctx.translate(e,t)},rotate(e){this._ensureSurface(),this._ctx.rotate(e)},scale(e,t){this._ensureSurface(),this._ctx.scale(e,t)},transform(e,t,n,r,i,a){if(this._ensureSurface(),!Number.isFinite(e)||!Number.isFinite(t)||!Number.isFinite(n)||!Number.isFinite(r)||!Number.isFinite(i)||!Number.isFinite(a))return;let o=i,s=a,c=Math.hypot(e,t),l=Math.hypot(n,r),u=Math.atan2(t,e);this._ctx.translate(o,s),u!==0&&this._ctx.rotate(u),(c!==1||l!==1)&&this._ctx.scale(c,l)},setTransform(e,t,n,r,i,a){if(this._ensureSurface(),typeof e==`object`&&e){let t=e;this._ctx.identityMatrix(),this.transform(t.a??t.m11??1,t.b??t.m12??0,t.c??t.m21??0,t.d??t.m22??1,t.e??t.m41??0,t.f??t.m42??0)}else typeof e==`number`?(this._ctx.identityMatrix(),this.transform(e,t,n,r,i,a)):this._ctx.identityMatrix()},getTransform(){let e=this._ctx.userToDevice(0,0),t=this._ctx.userToDevice(1,0),n=this._ctx.userToDevice(0,1),r=e[0]??0,i=e[1]??0,a=(t[0]??0)-r,o=(t[1]??0)-i,s=(n[0]??0)-r,c=(n[1]??0)-i,l=globalThis.DOMMatrix;return typeof l==`function`?new l([a,o,s,c,r,i]):{a,b:o,c:s,d:c,e:r,f:i,m11:a,m12:o,m13:0,m14:0,m21:s,m22:c,m23:0,m24:0,m31:0,m32:0,m33:1,m34:0,m41:r,m42:i,m43:0,m44:1,is2D:!0,isIdentity:a===1&&o===0&&s===0&&c===1&&r===0&&i===0}},resetTransform(){this._ensureSurface(),this._ctx.identityMatrix()}};function installTransformMethods(e){Object.assign(e,wt)}const Tt={beginPath(){this._ensureSurface(),this._ctx.newPath()},moveTo(e,t){this._ensureSurface(),this._ctx.moveTo(e,t)},lineTo(e,t){this._ensureSurface(),this._ctx.lineTo(e,t)},closePath(){this._ensureSurface(),this._ctx.closePath()},bezierCurveTo(e,t,n,r,i,a){this._ensureSurface(),this._ctx.curveTo(e,t,n,r,i,a)},quadraticCurveTo(e,t,n,r){this._ensureSurface();let i,a;this._ctx.hasCurrentPoint()?[i,a]=this._ctx.getCurrentPoint():(i=e,a=t);let{cp1x:o,cp1y:s,cp2x:c,cp2y:l}=quadraticToCubic(i,a,e,t,n,r);this._ctx.curveTo(o,s,c,l,n,r)},arc(e,t,n,r,i,a=!1){if(this._ensureSurface(),Math.abs(i-r)>=2*Math.PI){this._ctx.arc(e,t,n,0,2*Math.PI);return}a?this._ctx.arcNegative(e,t,n,r,i):this._ctx.arc(e,t,n,r,i)},arcTo(e,t,n,r,i){this._ensureSurface();let a,o;this._ctx.hasCurrentPoint()?[a,o]=this._ctx.getCurrentPoint():(a=e,o=t,this._ctx.moveTo(e,t)),cairoArcTo(this._ctx,a,o,e,t,n,r,i)},ellipse(e,t,n,r,i,a,o,s=!1){if(this._ensureSurface(),n<0||r<0)throw RangeError(`The radii provided are negative`);cairoEllipse(this._ctx,e,t,n,r,i,a,o,s)},rect(e,t,n,r){this._ensureSurface(),this._ctx.rectangle(e,t,n,r)},roundRect(e,t,n,r,i=0){this._ensureSurface(),cairoRoundRect(this._ctx,e,t,n,r,i)}};function installPathMethods(e){Object.assign(e,Tt)}function getDrawImageSource(e){if(isPixbufImageSource(e)){let t=e._pixbuf;return{pixbuf:t,imgWidth:t.get_width(),imgHeight:t.get_height()}}if(isCanvasImageSource(e)){let t=e.width??0,n=e.height??0;if(!Number.isFinite(t)||!Number.isFinite(n)||t<=0||n<=0)return null;let i=e.getContext(`2d`);if(i&&typeof i._getSurface==`function`){let e=i._getSurface();e.flush();let a=r.pixbuf_get_from_surface(e,0,0,t,n);if(a)return{pixbuf:a,imgWidth:t,imgHeight:n}}}return null}const Et={fill(e,t){this._ensureSurface(),this._applyCompositing(),this._applyFillStyle();let r;e instanceof St?(this._ctx.newPath(),e._replayOnCairo(this._ctx),r=t):r=e,this._ctx.setFillRule(r===`evenodd`?n.FillRule.EVEN_ODD:n.FillRule.WINDING),this._ctx.fillPreserve()},stroke(e){this._ensureSurface(),this._applyCompositing(),this._applyStrokeStyle(),this._applyLineStyle(),e instanceof St&&(this._ctx.newPath(),e._replayOnCairo(this._ctx)),this._ctx.strokePreserve()},fillRect(e,t,n,r){this._ensureSurface(),this._applyCompositing();let i=this._ctx.copyPath();this._hasShadow()&&this._renderShadow(()=>{this._ctx.newPath(),this._ctx.rectangle(e,t,n,r),this._ctx.fill()}),this._applyFillStyle(),this._ctx.newPath(),this._ctx.rectangle(e,t,n,r),this._ctx.fill(),this._ctx.newPath(),this._ctx.appendPath(i)},strokeRect(e,t,n,r){this._ensureSurface(),this._applyCompositing();let i=this._ctx.copyPath();this._hasShadow()&&this._renderShadow(()=>{this._ctx.newPath(),this._ctx.rectangle(e,t,n,r),this._ctx.stroke()}),this._applyStrokeStyle(),this._applyLineStyle(),this._ctx.newPath(),this._ctx.rectangle(e,t,n,r),this._ctx.stroke(),this._ctx.newPath(),this._ctx.appendPath(i)},clearRect(e,t,r,i){this._ensureSurface();let a=this._ctx.copyPath();this._ctx.save(),this._ctx.setOperator(n.Operator.CLEAR),this._ctx.newPath(),this._ctx.rectangle(e,t,r,i),this._ctx.fill(),this._ctx.restore(),this._ctx.newPath(),this._ctx.appendPath(a)},clip(e,t){this._ensureSurface();let r;e instanceof St?(this._ctx.newPath(),e._replayOnCairo(this._ctx),r=t):r=e,this._ctx.setFillRule(r===`evenodd`?n.FillRule.EVEN_ODD:n.FillRule.WINDING),this._ctx.clip()},isPointInPath(e,t,r,i){this._ensureSurface();let a,o,s;return e instanceof St?(this._ctx.newPath(),e._replayOnCairo(this._ctx),a=t,o=r,s=i):(a=e,o=t,s=r),this._ctx.setFillRule(s===`evenodd`?n.FillRule.EVEN_ODD:n.FillRule.WINDING),this._ctx.inFill(a,o)},isPointInStroke(e,t,n){return this._ensureSurface(),this._applyLineStyle(),e instanceof St?(this._ctx.newPath(),e._replayOnCairo(this._ctx),this._ctx.inStroke(t,n)):this._ctx.inStroke(e,t)},drawImage(e,t,i,a,o,s,c,l,u){this._ensureSurface(),this._applyCompositing();let d,p,m,h,g,_,v,y,b=getDrawImageSource(e);if(!b)return;let{pixbuf:x,imgWidth:S,imgHeight:w}=b;if(a===void 0?(d=0,p=0,m=S,h=w,g=t,_=i,v=S,y=w):s===void 0?(d=0,p=0,m=S,h=w,g=t,_=i,v=a,y=o):(d=t,p=i,m=a,h=o,g=s,_=c,v=l,y=u),!Number.isFinite(d)||!Number.isFinite(p)||!Number.isFinite(m)||!Number.isFinite(h)||!Number.isFinite(g)||!Number.isFinite(_)||!Number.isFinite(v)||!Number.isFinite(y)||m===0||h===0||v===0||y===0)return;this._ctx.save(),this._ctx.rectangle(g,_,v,y),this._ctx.clip(),this._ctx.translate(g,_),this._ctx.scale(v/m,y/h),this._ctx.translate(-d,-p),r.cairo_set_source_pixbuf(this._ctx,x,0,0);let T=asCairoPattern(this._ctx.getSource?.());if(T){let e;e=this._state.imageSmoothingEnabled?this._state.imageSmoothingQuality===`high`?n.Filter.BEST:n.Filter.BILINEAR:n.Filter.NEAREST,T.setFilter(e)}this._state.globalAlpha<1?this._ctx.paintWithAlpha(this._state.globalAlpha):this._ctx.paint(),this._ctx.restore()}};function installDrawingMethods(e){Object.assign(e,Et)}const Dt={createImageData(e,t){return typeof e==`number`?new OurImageData(Math.abs(e),Math.abs(t)):new OurImageData(e.width,e.height)},getImageData(e,t,n,i){this._ensureSurface(),this._surface.flush();let a=r.pixbuf_get_from_surface(this._surface,e,t,n,i);if(!a)return new OurImageData(n,i);let o=a.get_pixels(),s=a.get_has_alpha(),c=a.get_rowstride(),l=a.get_n_channels(),u=new Uint8ClampedArray(n*i*4);for(let e=0;e<i;e++)for(let t=0;t<n;t++){let r=e*c+t*l,i=(e*n+t)*4;u[i]=o[r],u[i+1]=o[r+1],u[i+2]=o[r+2],u[i+3]=s?o[r+3]:255}return new OurImageData(u,n,i)},putImageData(e,t,a,o,s,c,l){this._ensureSurface();let u=o??0,d=s??0,p=c??e.width,m=l??e.height,h=e.data,g=e.width,_=new Uint8Array(p*m*4);for(let e=0;e<m;e++)for(let t=0;t<p;t++){let n=((d+e)*g+(u+t))*4,r=(e*p+t)*4;_[r]=h[n],_[r+1]=h[n+1],_[r+2]=h[n+2],_[r+3]=h[n+3]}let v=i.Pixbuf.new_from_bytes(_,i.Colorspace.RGB,!0,8,p,m,p*4);this._ctx.save(),this._ctx.setOperator(n.Operator.SOURCE),r.cairo_set_source_pixbuf(this._ctx,v,t+u,a+d),this._ctx.rectangle(t+u,a+d,p,m),this._ctx.fill(),this._ctx.restore()}};function installPixelMethods(e){Object.assign(e,Dt)}function parseFontToDescription(e){let t=e.match(/^\s*(italic|oblique|normal)?\s*(small-caps|normal)?\s*(bold|bolder|lighter|[1-9]00|normal)?\s*(\d+(?:\.\d+)?)(px|pt|em|rem|%)?\s*(?:\/\S+)?\s*(.+)?$/i);if(!t)return a.font_description_from_string(e);let n=t[1]||``,r=t[3]||``,i=parseFloat(t[4])||10,o=(t[5]||`px`).toLowerCase(),s=(t[6]||`sans-serif`).replace(/['"]/g,``).trim();o===`pt`?i=i*96/72:o===`em`||o===`rem`?i*=16:o===`%`&&(i=i/100*16);let c=s;n===`italic`?c+=` Italic`:n===`oblique`&&(c+=` Oblique`),r===`bold`||r===`bolder`||parseInt(r)>=600?c+=` Bold`:(r===`lighter`||parseInt(r)>0&&parseInt(r)<=300)&&(c+=` Light`);let l=a.font_description_from_string(c);return l.set_absolute_size(i*a.SCALE),l}function createTextLayout(e,t){let n=o.create_layout(e._ctx);n.set_text(t,-1),n.get_context().set_base_dir(a.Direction.LTR),n.context_changed();let r=parseFontToDescription(e._state.font);return n.set_font_description(r),n}function getTextAlignOffset(e,t){let[,n]=t.get_pixel_extents(),r=n.width;switch(e._state.textAlign){case`center`:return-r/2;case`right`:case`end`:return-r;default:return 0}}function getTextBaselineOffset(e,t){let n=t.get_font_description()||parseFontToDescription(e._state.font),r=t.get_context().get_metrics(n,null),i=r.get_ascent()/a.SCALE,o=r.get_descent()/a.SCALE,s=i+o;switch(e._state.textBaseline){case`top`:return 0;case`hanging`:return-(i*.2);case`middle`:return-(s/2);case`alphabetic`:return-i;case`ideographic`:return-(i+o*.5);case`bottom`:return-s;default:return-i}}const Ot={fillText(e,t,r,i){this._ensureSurface(),this._applyCompositing();let a=createTextLayout(this,e),s=getTextAlignOffset(this,a),c=getTextBaselineOffset(this,a);if(this._hasShadow()){let e=parseColor(this._state.shadowColor);if(e){let[i,l]=this._deviceToUserDistance(this._state.shadowOffsetX,this._state.shadowOffsetY),u=this._state.shadowBlur,d;if(u>0){let[t]=this._deviceToUserDistance(u,0),[,n]=this._deviceToUserDistance(0,u);d=[[i,l,e.a],[i+t,l,e.a*.5],[i-t,l,e.a*.5],[i,l+n,e.a*.5],[i,l-n,e.a*.5]]}else d=[[i,l,e.a]];let p=this._state.imageSmoothingEnabled?n.Antialias.DEFAULT:n.Antialias.NONE;for(let[n,i,l]of d)this._ctx.save(),this._ctx.setAntialias(p),this._ctx.setSourceRGBA(e.r,e.g,e.b,l),this._ctx.moveTo(t+s+n,r+c+i),o.show_layout(this._ctx,a),this._ctx.restore()}}this._applyFillStyle(),this._ctx.save(),this._ctx.setAntialias(this._state.imageSmoothingEnabled?n.Antialias.DEFAULT:n.Antialias.NONE),this._ctx.moveTo(t+s,r+c),o.show_layout(this._ctx,a),this._ctx.restore()},strokeText(e,t,r,i){this._ensureSurface(),this._applyCompositing(),this._applyStrokeStyle(),this._applyLineStyle();let a=createTextLayout(this,e),s=getTextAlignOffset(this,a),c=getTextBaselineOffset(this,a);this._ctx.save(),this._ctx.setAntialias(this._state.imageSmoothingEnabled?n.Antialias.DEFAULT:n.Antialias.NONE),this._ctx.moveTo(t+s,r+c),o.layout_path(this._ctx,a),this._ctx.stroke(),this._ctx.restore()},measureText(e){this._ensureSurface();let t=createTextLayout(this,e),[n,r]=t.get_pixel_extents(),i=t.get_baseline()/a.SCALE,o=Math.max(0,i-n.y),s=Math.max(0,n.y+n.height-i),c=t.get_font_description()||parseFontToDescription(this._state.font),l=t.get_context().get_metrics(c,null),u=l.get_ascent()/a.SCALE,d=l.get_descent()/a.SCALE;return{width:r.width,actualBoundingBoxAscent:o,actualBoundingBoxDescent:s,actualBoundingBoxLeft:Math.max(0,-n.x),actualBoundingBoxRight:n.x+n.width,fontBoundingBoxAscent:u,fontBoundingBoxDescent:d,alphabeticBaseline:0,emHeightAscent:u,emHeightDescent:d,hangingBaseline:u*.8,ideographicBaseline:-d}}};function installTextMethods(e){Object.assign(e,Ot)}const kt={createLinearGradient(e,t,n,r){return new CanvasGradient(`linear`,e,t,n,r)},createRadialGradient(e,t,n,r,i,a){return new CanvasGradient(`radial`,e,t,r,i,n,a)},createPattern(e,t){return Ct.create(e,t)}};function installFactoryMethods(e){Object.assign(e,kt)}function installAllContextMethods(e){installTransformMethods(e),installPathMethods(e),installDrawingMethods(e),installPixelMethods(e),installTextMethods(e),installFactoryMethods(e)}function createDefaultState(){return{fillStyle:`#000000`,fillColor:{...vt},strokeStyle:`#000000`,strokeColor:{...vt},lineWidth:1,lineCap:`butt`,lineJoin:`miter`,miterLimit:10,lineDash:[],lineDashOffset:0,globalAlpha:1,globalCompositeOperation:`source-over`,shadowColor:`rgba(0, 0, 0, 0)`,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,font:`10px sans-serif`,textAlign:`start`,textBaseline:`alphabetic`,direction:`ltr`,imageSmoothingEnabled:!0,imageSmoothingQuality:`low`}}function cloneState(e){return{...e,fillColor:{...e.fillColor},strokeColor:{...e.strokeColor},lineDash:[...e.lineDash]}}var CanvasRenderingContext2D=class{constructor(e,t){this._stateStack=[],this.canvas=e,this._surfaceWidth=e.width||300,this._surfaceHeight=e.height||150,this._surface=new n.ImageSurface(n.Format.ARGB32,this._surfaceWidth,this._surfaceHeight),this._ctx=new n.Context(this._surface),this._state=createDefaultState()}_ensureSurface(){let e=this.canvas.width||300,t=this.canvas.height||150;(e!==this._surfaceWidth||t!==this._surfaceHeight)&&(this._ctx.$dispose(),this._surface.finish(),this._surfaceWidth=e,this._surfaceHeight=t,this._surface=new n.ImageSurface(n.Format.ARGB32,e,t),this._ctx=new n.Context(this._surface),this._stateStack=[])}_resetState(){this._state=createDefaultState(),this._stateStack=[]}_applyFillStyle(){let e=this._state.fillStyle;if(typeof e==`string`){let e=this._state.fillColor,t=e.a*this._state.globalAlpha;this._ctx.setSourceRGBA(e.r,e.g,e.b,t)}else e instanceof CanvasGradient?this._ctx.setSource(e._getCairoPattern()):e instanceof Ct&&(this._ctx.setSource(e._getCairoPattern()),this._applyPatternFilter())}_applyStrokeStyle(){let e=this._state.strokeStyle;if(typeof e==`string`){let e=this._state.strokeColor,t=e.a*this._state.globalAlpha;this._ctx.setSourceRGBA(e.r,e.g,e.b,t)}else e instanceof CanvasGradient?this._ctx.setSource(e._getCairoPattern()):e instanceof Ct&&(this._ctx.setSource(e._getCairoPattern()),this._applyPatternFilter())}_applyPatternFilter(){let e=asCairoPattern(this._ctx.getSource?.());if(!e)return;let t;t=this._state.imageSmoothingEnabled?this._state.imageSmoothingQuality===`high`?n.Filter.BEST:n.Filter.BILINEAR:n.Filter.NEAREST,e.setFilter(t)}_applyLineStyle(){this._ctx.setLineWidth(this._state.lineWidth),this._ctx.setLineCap(bt[this._state.lineCap]),this._ctx.setLineJoin(xt[this._state.lineJoin]),this._ctx.setMiterLimit(this._state.miterLimit),this._ctx.setDash(this._state.lineDash,this._state.lineDashOffset)}_applyCompositing(){let e=yt[this._state.globalCompositeOperation];e!==void 0&&this._ctx.setOperator(e)}_getSurface(){return this._surface}_hasShadow(){if(this._state.shadowBlur===0&&this._state.shadowOffsetX===0&&this._state.shadowOffsetY===0)return!1;let e=parseColor(this._state.shadowColor);return e!==null&&e.a>0}_deviceToUserDistance(e,t){let n=this._ctx.userToDevice(0,0),r=this._ctx.userToDevice(1,0),i=this._ctx.userToDevice(0,1),a=(r[0]??0)-(n[0]??0),o=(r[1]??0)-(n[1]??0),s=(i[0]??0)-(n[0]??0),c=(i[1]??0)-(n[1]??0),l=a*c-o*s;return Math.abs(l)<1e-10?[e,t]:[(c*e-s*t)/l,(-o*e+a*t)/l]}_renderShadow(e){}save(){this._ensureSurface(),this._stateStack.push(cloneState(this._state)),this._ctx.save()}restore(){this._ensureSurface();let e=this._stateStack.pop();e&&(this._state=e,this._ctx.restore())}get fillStyle(){return this._state.fillStyle}set fillStyle(e){if(typeof e==`string`){let t=parseColor(e);t&&(this._state.fillStyle=e,this._state.fillColor=t)}else this._state.fillStyle=e}get strokeStyle(){return this._state.strokeStyle}set strokeStyle(e){if(typeof e==`string`){let t=parseColor(e);t&&(this._state.strokeStyle=e,this._state.strokeColor=t)}else this._state.strokeStyle=e}get lineWidth(){return this._state.lineWidth}set lineWidth(e){e>0&&isFinite(e)&&(this._state.lineWidth=e)}get lineCap(){return this._state.lineCap}set lineCap(e){(e===`butt`||e===`round`||e===`square`)&&(this._state.lineCap=e)}get lineJoin(){return this._state.lineJoin}set lineJoin(e){(e===`miter`||e===`round`||e===`bevel`)&&(this._state.lineJoin=e)}get miterLimit(){return this._state.miterLimit}set miterLimit(e){e>0&&isFinite(e)&&(this._state.miterLimit=e)}get globalAlpha(){return this._state.globalAlpha}set globalAlpha(e){e>=0&&e<=1&&isFinite(e)&&(this._state.globalAlpha=e)}get globalCompositeOperation(){return this._state.globalCompositeOperation}set globalCompositeOperation(e){yt[e]!==void 0&&(this._state.globalCompositeOperation=e)}get imageSmoothingEnabled(){return this._state.imageSmoothingEnabled}set imageSmoothingEnabled(e){this._state.imageSmoothingEnabled=!!e}get imageSmoothingQuality(){return this._state.imageSmoothingQuality}set imageSmoothingQuality(e){(e===`low`||e===`medium`||e===`high`)&&(this._state.imageSmoothingQuality=e)}setLineDash(e){e.some(e=>e<0||!isFinite(e))||(this._state.lineDash=[...e])}getLineDash(){return[...this._state.lineDash]}get lineDashOffset(){return this._state.lineDashOffset}set lineDashOffset(e){isFinite(e)&&(this._state.lineDashOffset=e)}get shadowColor(){return this._state.shadowColor}set shadowColor(e){this._state.shadowColor=e}get shadowBlur(){return this._state.shadowBlur}set shadowBlur(e){e>=0&&isFinite(e)&&(this._state.shadowBlur=e)}get shadowOffsetX(){return this._state.shadowOffsetX}set shadowOffsetX(e){isFinite(e)&&(this._state.shadowOffsetX=e)}get shadowOffsetY(){return this._state.shadowOffsetY}set shadowOffsetY(e){isFinite(e)&&(this._state.shadowOffsetY=e)}get font(){return this._state.font}set font(e){this._state.font=e}get textAlign(){return this._state.textAlign}set textAlign(e){this._state.textAlign=e}get textBaseline(){return this._state.textBaseline}set textBaseline(e){this._state.textBaseline=e}get direction(){return this._state.direction}set direction(e){this._state.direction=e}_toDataURL(e,t){this._surface.flush();let n=imports.gi.Gio,r=imports.gi.GLib,[,i]=r.file_open_tmp(`canvas-XXXXXX.png`);try{this._surface.writeToPNG(i);let[,e]=n.File.new_for_path(i).load_contents(null);return`data:image/png;base64,${r.base64_encode(e)}`}finally{try{r.unlink(i)}catch{}}}_dispose(){this._ctx.$dispose(),this._surface.finish()}};installAllContextMethods(CanvasRenderingContext2D.prototype),defineGlobal(`HTMLCanvasElement`,mt),defineGlobal(`CanvasRenderingContext2D`,CanvasRenderingContext2D),defineGlobal(`DOMMatrix`,ht),defineGlobal(`DOMMatrixReadOnly`,gt);const At=Symbol.for(`gjsify_canvas2d_context`);mt.registerContextFactory(`2d`,(e,t)=>{let n=e,r=n[At];if(r)return r;let i=new CanvasRenderingContext2D(e,t);return n[At]=i,i});var CharacterData=class extends ot{constructor(e=``){super(),this[z]=G.TEXT_NODE,this._data=e}get data(){return this._data}set data(e){this._data=e}get textContent(){return this._data}set textContent(e){this._data=e}get nodeValue(){return this._data}set nodeValue(e){this._data=e}get length(){return this._data.length}appendData(e){this._data+=e}deleteData(e,t){this._data=this._data.substring(0,e)+this._data.substring(e+t)}insertData(e,t){this._data=this._data.substring(0,e)+t+this._data.substring(e)}replaceData(e,t,n){this._data=this._data.substring(0,e)+n+this._data.substring(e+t)}substringData(e,t){return this._data.substring(e,e+t)}cloneNode(e=!1){return new this.constructor(this._data)}get[Symbol.toStringTag](){return`CharacterData`}},jt=class Comment extends CharacterData{constructor(e=``){super(e),this[z]=G.COMMENT_NODE}get nodeName(){return`#comment`}cloneNode(e=!1){return new Comment(this.data)}get[Symbol.toStringTag](){return`Comment`}},Mt=class Text extends CharacterData{constructor(e=``){super(e),this[z]=G.TEXT_NODE}get nodeName(){return`#text`}get wholeText(){let e=this.data,t=this.previousSibling;for(;t&&t instanceof Text;)e=t.data+e,t=t.previousSibling;let n=this.nextSibling;for(;n&&n instanceof Text;)e+=n.data,n=n.nextSibling;return e}splitText(e){let t=this.data.substring(e);this.data=this.data.substring(0,e);let n=new Text(t);return this.parentNode&&this.parentNode.insertBefore(n,this.nextSibling),n}cloneNode(e=!1){return new Text(this.data)}get[Symbol.toStringTag](){return`Text`}},Nt=class DocumentFragment extends ot{constructor(){super(),this[z]=G.DOCUMENT_FRAGMENT_NODE}get nodeName(){return`#document-fragment`}get children(){return this[H]}get childElementCount(){return this[H].length}get firstElementChild(){return this[H][0]??null}get lastElementChild(){let e=this[H];return e[e.length-1]??null}get textContent(){let e=``;for(let t of this.childNodes)t.textContent!==null&&(e+=t.textContent);return e}set textContent(e){for(;this.firstChild;)this.removeChild(this.firstChild);e&&this.appendChild(new Mt(e))}append(...e){for(let t of e)typeof t==`string`?this.appendChild(new Mt(t)):this.appendChild(t)}prepend(...e){let t=this.firstChild;for(let n of e)typeof n==`string`?this.insertBefore(new Mt(n),t):this.insertBefore(n,t)}replaceChildren(...e){for(;this.firstChild;)this.removeChild(this.firstChild);this.append(...e)}getElementById(e){for(let t of this.children){if(t.id===e)return t;let n=this._findById(t,e);if(n)return n}return null}_findById(e,t){for(let n of e.children){if(n.id===t)return n;let e=this._findById(n,t);if(e)return e}return null}cloneNode(e=!1){let t=new DocumentFragment;if(e)for(let e of this.childNodes)t.appendChild(e.cloneNode(!0));return t}get[Symbol.toStringTag](){return`DocumentFragment`}},Pt=s;me(),A(),P();var HTMLImageElement=class extends HTMLElement$1{constructor(){super(),this._complete=!1,this._naturalHeight=0,this._naturalWidth=0,this[Me]=`IMG`,this[Ne]=`img`,this[Pe]=st.html}get complete(){return this._complete}get naturalHeight(){return this._naturalHeight}get naturalWidth(){return this._naturalWidth}get currentSrc(){return this.src}get x(){return 0}get y(){return 0}get alt(){return this.getAttribute(`alt`)??``}set alt(e){this.setAttribute(`alt`,e)}get crossOrigin(){return this.getAttribute(`crossorigin`)}set crossOrigin(e){e===null?this.removeAttribute(`crossorigin`):this.setAttribute(`crossorigin`,e)}get decoding(){return this.getAttribute(`decoding`)??`auto`}set decoding(e){this.setAttribute(`decoding`,e)}get loading(){let e=this.getAttribute(`loading`);return e===`lazy`||e===`eager`?e:`auto`}set loading(e){this.setAttribute(`loading`,e)}get referrerPolicy(){return this.getAttribute(`referrerpolicy`)??``}set referrerPolicy(e){this.setAttribute(`referrerpolicy`,e)}get sizes(){return this.getAttribute(`sizes`)??``}set sizes(e){this.setAttribute(`sizes`,e)}get src(){return this.getAttribute(`src`)??``}set src(e){this.setAttribute(`src`,e);let t=globalThis.__GJSIFY_DEBUG_IMG===!0;if(e.startsWith(`data:`)){let n=e.indexOf(`,`);if(n===-1){this._complete=!0,this.dispatchEvent(new Event(`error`));return}let r=e.slice(5,n),i=e.slice(n+1),a=r.includes(`;base64`);try{let e;e=a?k.base64_decode(i):new TextEncoder().encode(decodeURIComponent(i));let n=k.Bytes.new(e),r=N.MemoryInputStream.new_from_bytes(n);this._pixbuf=Pt.Pixbuf.new_from_stream(r,null),this._naturalWidth=this._pixbuf.get_width(),this._naturalHeight=this._pixbuf.get_height(),this._complete=!0,t&&I.log(`[img] ok data: (${this._naturalWidth}x${this._naturalHeight})`),this.dispatchEvent(new Event(`load`))}catch(e){t&&I.warn(`[img] error data:: ${e instanceof Error?e.message:String(e)}`),this._complete=!0,this.dispatchEvent(new Event(`error`))}return}let n;if(e.startsWith(`file://`))n=k.filename_from_uri(e)[0];else if(e.startsWith(`http://`)||e.startsWith(`https://`)){this._complete=!0,this.dispatchEvent(new Event(`error`));return}else{let t=k.path_get_dirname(c.programInvocationName);n=k.build_filenamev([t,e])}try{t&&I.log(`[img] load ${n}`),this._pixbuf=Pt.Pixbuf.new_from_file(n),this._naturalWidth=this._pixbuf.get_width(),this._naturalHeight=this._pixbuf.get_height(),this._complete=!0,t&&I.log(`[img] ok ${n} (${this._naturalWidth}x${this._naturalHeight})`),this.dispatchEvent(new Event(`load`))}catch(e){t&&I.warn(`[img] error ${n}: ${e instanceof Error?e.message:String(e)}`),this._complete=!0,this.dispatchEvent(new Event(`error`))}}get srcset(){return this.getAttribute(`srcset`)??``}set srcset(e){this.setAttribute(`srcset`,e)}get useMap(){return this.getAttribute(`usemap`)??``}set useMap(e){this.setAttribute(`usemap`,e)}get height(){if(this._pixbuf)return this._pixbuf.get_height();let e=this.getAttribute(`height`);return e===null?0:Number(e)}set height(e){this.setAttribute(`height`,String(e))}get width(){if(this._pixbuf)return this._pixbuf.get_width();let e=this.getAttribute(`width`);return e===null?0:Number(e)}set width(e){this.setAttribute(`width`,String(e))}get isMap(){return this.hasAttribute(`ismap`)}set isMap(e){e?this.setAttribute(`ismap`,``):this.removeAttribute(`ismap`)}decode(){return Promise.resolve()}cloneNode(e=!1){return super.cloneNode(e)}getImageData(){if(!this._pixbuf)return null;let e=this._pixbuf.get_has_alpha()?this._pixbuf:this._pixbuf.add_alpha(!1,0,0,0)??this._pixbuf;return{colorSpace:`srgb`,data:new Uint8ClampedArray(e.get_pixels()),height:e.get_height(),width:e.get_width()}}isPixbuf(){return!!this._pixbuf}get[Symbol.toStringTag](){return`HTMLImageElement`}},HTMLMediaElement=class extends HTMLElement$1{constructor(...e){super(...e),this._src=``,this._srcObject=null,this.currentTime=0,this.duration=NaN,this.paused=!0,this.ended=!1,this.volume=1,this.muted=!1,this.defaultMuted=!1,this.loop=!1,this.autoplay=!1,this.preload=``,this.playbackRate=1,this.defaultPlaybackRate=1,this.readyState=0,this.networkState=0}get buffered(){return{length:0,start:()=>0,end:()=>0}}get seekable(){return{length:0,start:()=>0,end:()=>0}}get played(){return{length:0,start:()=>0,end:()=>0}}get src(){return this._src}set src(e){this._src=e,this._srcObject=null,this.dispatchEvent(new Event(`srcchange`))}get srcObject(){return this._srcObject}set srcObject(e){this._srcObject=e,this._src=``,this.dispatchEvent(new Event(`srcobjectchange`))}play(){return this.paused=!1,this.ended=!1,this.dispatchEvent(new Event(`play`)),Promise.resolve()}pause(){this.paused=!0,this.dispatchEvent(new Event(`pause`))}load(){this.readyState=0,this.networkState=2,this.dispatchEvent(new Event(`loadstart`))}canPlayType(e){return``}static{this.HAVE_NOTHING=0}static{this.HAVE_METADATA=1}static{this.HAVE_CURRENT_DATA=2}static{this.HAVE_FUTURE_DATA=3}static{this.HAVE_ENOUGH_DATA=4}static{this.NETWORK_EMPTY=0}static{this.NETWORK_IDLE=1}static{this.NETWORK_LOADING=2}static{this.NETWORK_NO_SOURCE=3}get[Symbol.toStringTag](){return`HTMLMediaElement`}};const Ft=1e9;function secondsToGstTime(e){return BigInt(Math.round(e*Ft))}function gstTimeToSeconds(e){return Number(e)/Ft}var HTMLVideoElement=class extends HTMLMediaElement{constructor(){super(),this._pipeline=null,this._videoWidth=0,this._videoHeight=0,this.poster=``,this[Me]=`VIDEO`,this[Ne]=`video`,this[Pe]=st.html;let e=this;Object.defineProperty(this,"paused",{get(){if(!e._pipeline)return!0;let[,t]=e._pipeline.get_state(0n);return t!==4},configurable:!0,enumerable:!0}),Object.defineProperty(this,"currentTime",{get(){if(!e._pipeline)return 0;let[t,n]=e._pipeline.query_position(3);return t?gstTimeToSeconds(n):0},set(t){e._pipeline?.seek(1,3,5,1,secondsToGstTime(t),0,-1n)},configurable:!0,enumerable:!0}),Object.defineProperty(this,"duration",{get(){if(!e._pipeline)return NaN;let[t,n]=e._pipeline.query_duration(3);return t&&Number(n)>0?gstTimeToSeconds(n):NaN},configurable:!0,enumerable:!0}),Object.defineProperty(this,"volume",{get(){return e._playbin()?.volume??1},set(t){let n=e._playbin();n&&(n.volume=Math.max(0,Math.min(1,t)))},configurable:!0,enumerable:!0}),Object.defineProperty(this,"muted",{get(){return e._playbin()?.mute??!1},set(t){let n=e._playbin();n&&(n.mute=t)},configurable:!0,enumerable:!0})}async play(){this._pipeline?.set_state(4),this.dispatchEvent(new Event(`play`)),this.dispatchEvent(new Event(`playing`))}pause(){this._pipeline?.set_state(3),this.dispatchEvent(new Event(`pause`))}get videoWidth(){return this._videoWidth}set videoWidth(e){this._videoWidth=e}get videoHeight(){return this._videoHeight}set videoHeight(e){this._videoHeight=e}get[Symbol.toStringTag](){return`HTMLVideoElement`}_playbin(){return this._pipeline?.get_by_name(`playbin`)??null}};const It=new class Document extends ot{static{this._elementFactories=new Map}constructor(){super(),this.body=new HTMLElement$1,this.head=new HTMLElement$1,this.documentElement=new HTMLElement$1,this.appendChild(this.documentElement),this.documentElement.appendChild(this.body)}static registerElementFactory(e,t){Document._elementFactories.set(e.toLowerCase(),t)}createElementNS(e,t){let n=t.toLowerCase();switch(n){case`img`:return new HTMLImageElement;case`video`:return new HTMLVideoElement;case`canvas`:return new mt;default:{let e=Document._elementFactories.get(n);return e?e():new HTMLElement$1}}}createElement(e){return this.createElementNS(`http://www.w3.org/1999/xhtml`,e)}createTextNode(e){return new Mt(e)}createComment(e){return new jt(e)}createDocumentFragment(){return new Nt}createEvent(e){return new Event(e)}getElementById(e){return this._findById(this.body,e)}_findById(e,t){if(e.id===t)return e;for(let n of e.children){let e=this._findById(n,t);if(e)return e}return null}get[Symbol.toStringTag](){return`Document`}};var DOMTokenList=class{constructor(e,t){this._ownerElement=e,this._attributeName=t}_getTokens(){let e=this._ownerElement.getAttribute(this._attributeName);return e?e.split(/\s+/).filter(e=>e.length>0):[]}_setTokens(e){let t=e.join(` `);t?this._ownerElement.setAttribute(this._attributeName,t):this._ownerElement.removeAttribute(this._attributeName)}get length(){return this._getTokens().length}get value(){return this._ownerElement.getAttribute(this._attributeName)??``}set value(e){e?this._ownerElement.setAttribute(this._attributeName,e):this._ownerElement.removeAttribute(this._attributeName)}item(e){let t=this._getTokens();return e>=0&&e<t.length?t[e]:null}contains(e){return this._getTokens().includes(e)}add(...e){let t=this._getTokens();for(let n of e)n&&!t.includes(n)&&t.push(n);this._setTokens(t)}remove(...e){let t=this._getTokens().filter(t=>!e.includes(t));this._setTokens(t)}toggle(e,t){let n=this.contains(e);return t===void 0?n?(this.remove(e),!1):(this.add(e),!0):t?(this.add(e),!0):(this.remove(e),!1)}replace(e,t){let n=this._getTokens(),r=n.indexOf(e);return r===-1?!1:(n[r]=t,this._setTokens(n),!0)}supports(e){return!0}forEach(e){let t=this._getTokens();for(let n=0;n<t.length;n++)e(t[n],n,this)}keys(){return this._getTokens().keys()}values(){return this._getTokens().values()}entries(){return this._getTokens().entries()}[Symbol.iterator](){return this._getTokens().values()}toString(){return this.value}get[Symbol.toStringTag](){return`DOMTokenList`}};me(),defineGlobal(`Text`,Mt),defineGlobal(`Comment`,jt),defineGlobal(`DocumentFragment`,Nt),defineGlobal(`DOMTokenList`,DOMTokenList),defineGlobal(`document`,It),defineGlobalIfMissing(`self`,globalThis);var Window=class{};defineGlobalIfMissing(`Window`,Window),defineGlobalIfMissing(`window`,globalThis),defineGlobalIfMissing(`focus`,()=>{}),defineGlobalIfMissing(`blur`,()=>{});{let e=globalThis;if(typeof e.addEventListener!=`function`){let t=new EventTarget;e.__gjsify_globalEventTarget=t,e.addEventListener=(e,n,r)=>t.addEventListener(e,n,r),e.removeEventListener=(e,n,r)=>t.removeEventListener(e,n,r),e.dispatchEvent=e=>t.dispatchEvent(e)}}defineGlobalIfMissing(`devicePixelRatio`,1),defineGlobalIfMissing(`scrollX`,0),defineGlobalIfMissing(`scrollY`,0),defineGlobalIfMissing(`pageXOffset`,0),defineGlobalIfMissing(`pageYOffset`,0),defineGlobalIfMissing(`alert`,(...e)=>I.error(`alert:`,...e)),globalThis.top===void 0&&Object.defineProperty(globalThis,"top",{get:()=>globalThis,configurable:!0}),globalThis.navigator===void 0&&(globalThis.navigator={});function atobPolyfill(e){if(typeof globalThis.atob==`function`)return globalThis.atob(e);let t=e.replace(/[=\s]/g,``),n=``,r=0,i=0;for(let e=0;e<t.length;e++)r=r<<6|Lt[t.charCodeAt(e)],i+=6,i>=8&&(i-=8,n+=String.fromCharCode(r>>i&255));return n}function btoaPolyfill(e){if(typeof globalThis.btoa==`function`)return globalThis.btoa(e);let t=``,n=0;for(;n+2<e.length;n+=3){let r=e.charCodeAt(n)<<16|e.charCodeAt(n+1)<<8|e.charCodeAt(n+2);t+=K[r>>18&63]+K[r>>12&63]+K[r>>6&63]+K[r&63]}if(n+1===e.length){let r=e.charCodeAt(n)<<16;t+=K[r>>18&63]+K[r>>12&63]+`==`}else if(n+2===e.length){let r=e.charCodeAt(n)<<16|e.charCodeAt(n+1)<<8;t+=K[r>>18&63]+K[r>>12&63]+K[r>>6&63]+`=`}return t}function base64Decode(e){let t=e.replace(/[=\s]/g,``),n=new Uint8Array(t.length*3>>2),r=0,i=0,a=0;for(let e=0;e<t.length;e++)r=r<<6|Lt[t.charCodeAt(e)],i+=6,i>=8&&(i-=8,n[a++]=r>>i&255);return n.subarray(0,a)}function base64Encode(e){let t=``,n=e.length;for(let r=0;r<n;r+=3){let i=e[r],a=r+1<n?e[r+1]:0,o=r+2<n?e[r+2]:0;t+=K[i>>2],t+=K[(i&3)<<4|a>>4],t+=r+1<n?K[(a&15)<<2|o>>6]:`=`,t+=r+2<n?K[o&63]:`=`}return t}var K,Lt,Rt=__esmMin(()=>{K=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,Lt=new Uint8Array(256);for(let e=0;e<64;e++)Lt[K.charCodeAt(e)]=e});function normalizeEncoding(e){if(!e||e===`utf8`||e===`utf-8`)return`utf8`;switch((``+e).toLowerCase().replace(/-/g,``)){case`utf8`:return`utf8`;case`ascii`:return`ascii`;case`latin1`:case`binary`:return`latin1`;case`base64`:return`base64`;case`base64url`:return`base64url`;case`hex`:return`hex`;case`ucs2`:case`utf16le`:return`utf16le`;default:return`utf8`}}function checkEncoding(e){let t=(``+e).toLowerCase().replace(/-/g,``);if(!zt.includes(t))throw TypeError(`Unknown encoding: ${e}`)}var zt,Bt=__esmMin(()=>{zt=[`utf8`,`ascii`,`latin1`,`binary`,`base64`,`base64url`,`hex`,`ucs2`,`utf16le`]});function encodeString(e,t){switch(t){case`utf8`:return Vt.encode(e);case`ascii`:{let t=new Uint8Array(e.length);for(let n=0;n<e.length;n++)t[n]=e.charCodeAt(n)&127;return t}case`latin1`:{let t=new Uint8Array(e.length);for(let n=0;n<e.length;n++)t[n]=e.charCodeAt(n)&255;return t}case`base64`:return base64Decode(e.replace(/-/g,`+`).replace(/_/g,`/`));case`base64url`:return encodeString(e.replace(/-/g,`+`).replace(/_/g,`/`),`base64`);case`hex`:{let t=e.length>>>1,n=new Uint8Array(t);for(let r=0;r<t;r++){let t=parseInt(e[r*2],16),i=parseInt(e[r*2+1],16);if(Number.isNaN(t)||Number.isNaN(i))break;n[r]=t<<4|i}return n}case`utf16le`:{let t=new Uint8Array(e.length*2);for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);t[n*2]=r&255,t[n*2+1]=r>>8&255}return t}default:return Vt.encode(e)}}function decodeString(e,t,n,r){let i=n!==void 0||r!==void 0?e.subarray(n??0,r??e.length):e;switch(t){case`utf8`:return Ht.decode(i);case`ascii`:{let e=``;for(let t=0;t<i.length;t++)e+=String.fromCharCode(i[t]&127);return e}case`latin1`:{let e=``;for(let t=0;t<i.length;t++)e+=String.fromCharCode(i[t]);return e}case`base64`:{let e=``;for(let t=0;t<i.length;t++)e+=String.fromCharCode(i[t]);return btoaPolyfill(e)}case`base64url`:return decodeString(i,`base64`).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/,``);case`hex`:{let e=``;for(let t=0;t<i.length;t++)e+=i[t].toString(16).padStart(2,`0`);return e}case`utf16le`:{let e=``;for(let t=0;t+1<i.length;t+=2)e+=String.fromCharCode(i[t]|i[t+1]<<8);return e}default:return Ht.decode(i)}}function checkOffset(e,t,n){if(e+t>n)throw RangeError(`Attempt to access memory outside buffer bounds`)}var Vt,Ht,Ut=__esmMin(()=>{Rt(),Vt=new TextEncoder,Ht=new TextDecoder}),Wt,q,Gt,Kt,qt,SlowBuffer,Jt=__esmMin(()=>{Ut(),Bt(),Wt=typeof SharedArrayBuffer<`u`,q=class Buffer extends Uint8Array{static _isBuffer=!0;static alloc(e,t,n){if(typeof e!=`number`)throw TypeError(`The "size" argument must be of type number. Received type ${typeof e}`);if(e<0)throw RangeError(`The value "${e}" is invalid for option "size"`);let r=new Buffer(e);return t!==void 0&&t!==0&&r.fill(t,0,e,n),r}static allocUnsafe(e){if(typeof e!=`number`)throw TypeError(`The "size" argument must be of type number. Received type ${typeof e}`);return new Buffer(e)}static allocUnsafeSlow(e){return Buffer.allocUnsafe(e)}static from(e,t,n){if(typeof e==`string`){let n=normalizeEncoding(t);if(t&&typeof t==`string`){let e=(``+t).toLowerCase().replace(/-/g,``);[`utf8`,`ascii`,`latin1`,`binary`,`base64`,`base64url`,`hex`,`ucs2`,`utf16le`,``].includes(e)||checkEncoding(t)}let r=encodeString(e,n);return new Buffer(r.buffer,r.byteOffset,r.byteLength)}if(ArrayBuffer.isView(e)){let t=new Buffer(e.buffer,e.byteOffset,e.byteLength),n=new Buffer(t.length);return n.set(t),n}if(e instanceof ArrayBuffer){let r=t||0;return new Buffer(e,r,n===void 0?e.byteLength-r:n)}if(Wt&&e instanceof SharedArrayBuffer){let r=t||0,i=n===void 0?e.byteLength-r:n;return new Buffer(new Uint8Array(e,r,i))}if(typeof e==`object`&&e&&typeof e.viewBytes==`function`&&typeof e.byteLength==`number`&&e.constructor?.name===`SharedBuffer`){let r=e,i=t||0,a=n===void 0?r.byteLength-i:n,o=r.viewBytes(i,a);return new Buffer(o.buffer,o.byteOffset,o.byteLength)}if(Array.isArray(e)){let t=new Buffer(e.length);for(let n=0;n<e.length;n++)t[n]=e[n]&255;return t}throw TypeError(`The first argument must be of type string or an instance of Buffer, ArrayBuffer, or Array`)}static isBuffer(e){return e instanceof Buffer}static isEncoding(e){if(typeof e!=`string`)return!1;let t=e.toLowerCase().replace(/-/g,``);return[`utf8`,`ascii`,`latin1`,`binary`,`base64`,`base64url`,`hex`,`ucs2`,`utf16le`].includes(t)}static byteLength(e,t){if(typeof e!=`string`){if(ArrayBuffer.isView(e)||e instanceof ArrayBuffer||Wt&&e instanceof SharedArrayBuffer)return e.byteLength;throw TypeError(`The "string" argument must be one of type string, Buffer, or ArrayBuffer`)}switch(normalizeEncoding(t)){case`utf8`:return new TextEncoder().encode(e).byteLength;case`ascii`:case`latin1`:return e.length;case`base64`:case`base64url`:{let t=e.length;for(;t>0&&(e[t-1]===`=`||e[t-1]===` `);)t--;return t*3>>>2}case`hex`:return e.length>>>1;case`utf16le`:return e.length*2;default:return new TextEncoder().encode(e).byteLength}}static compare(e,t){if(!(e instanceof Uint8Array)||!(t instanceof Uint8Array))throw TypeError(`Arguments must be Buffers or Uint8Arrays`);let n=Math.min(e.length,t.length);for(let r=0;r<n;r++){if(e[r]<t[r])return-1;if(e[r]>t[r])return 1}return e.length<t.length?-1:+(e.length>t.length)}static concat(e,t){if(e.length===0)return Buffer.alloc(0);if(t===void 0){t=0;for(let n=0;n<e.length;n++)t+=e[n].length}let n=Buffer.alloc(t),r=0;for(let i=0;i<e.length;i++){let a=e[i],o=Math.min(a.length,t-r);o<=0||(n.set(a.subarray(0,o),r),r+=o)}return n}static poolSize=8192;toString(e,t,n){let r=normalizeEncoding(e);return decodeString(this,r,t,n)}toJSON(){return{type:`Buffer`,data:Array.from(this)}}equals(e){if(!(e instanceof Uint8Array))throw TypeError(`Argument must be a Buffer or Uint8Array`);if(this.length!==e.length)return!1;for(let t=0;t<this.length;t++)if(this[t]!==e[t])return!1;return!0}compare(e,t,n,r,i){if(!(e instanceof Uint8Array))throw TypeError(`Argument must be a Buffer or Uint8Array`);let a=r!==void 0||i!==void 0?this.subarray(r??0,i??this.length):this,o=t!==void 0||n!==void 0?e.subarray(t??0,n??e.length):e;return Buffer.compare(a,o)}copy(e,t=0,n=0,r){let i=r??this.length,a=Math.min(i-n,e.length-t);return a<=0?0:(e.set(this.subarray(n,n+a),t),a)}slice(e,t){let n=e??0,r=t??this.length,i=super.subarray(n,r);return new Buffer(i.buffer,i.byteOffset,i.byteLength)}subarray(e,t){let n=super.subarray(e,t);return new Buffer(n.buffer,n.byteOffset,n.byteLength)}write(e,t,n,r){t??=0;let i=encodeString(e,normalizeEncoding(r||(typeof n==`string`?n:void 0))),a=n!==void 0&&typeof n==`number`?Math.min(n,this.length-t):this.length-t,o=Math.min(i.length,a);return this.set(i.subarray(0,o),t),o}fill(e,t,n,r){let i=t??0,a=n??this.length;if(typeof e==`number`)super.fill(e&255,i,a);else if(typeof e==`string`){let t=encodeString(e,normalizeEncoding(r));if(t.length===0)super.fill(0,i,a);else if(t.length===1)super.fill(t[0],i,a);else for(let e=i;e<a;e++)this[e]=t[(e-i)%t.length]}else if(e instanceof Uint8Array)if(e.length===0)super.fill(0,i,a);else for(let t=i;t<a;t++)this[t]=e[(t-i)%e.length];return this}indexOf(e,t,n){if(typeof e==`number`)return super.indexOf(e&255,t);let r=typeof e==`string`?encodeString(e,normalizeEncoding(n)):e,i=t??0;outer:for(let e=i;e<=this.length-r.length;e++){for(let t=0;t<r.length;t++)if(this[e+t]!==r[t])continue outer;return e}return-1}lastIndexOf(e,t,n){if(typeof e==`number`)return t===void 0?super.lastIndexOf(e&255):super.lastIndexOf(e&255,t);let r=typeof e==`string`?encodeString(e,normalizeEncoding(n)):e,i=t===void 0?this.length-r.length:Math.min(t,this.length-r.length);outer:for(let e=i;e>=0;e--){for(let t=0;t<r.length;t++)if(this[e+t]!==r[t])continue outer;return e}return-1}includes(e,t,n){return this.indexOf(e,t,n)!==-1}readUInt8(e=0){return checkOffset(e,1,this.length),this[e]}readUInt16BE(e=0){return checkOffset(e,2,this.length),this[e]<<8|this[e+1]}readUInt16LE(e=0){return checkOffset(e,2,this.length),this[e]|this[e+1]<<8}readUInt32BE(e=0){return checkOffset(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])}readUInt32LE(e=0){return checkOffset(e,4,this.length),this[e+3]*16777216+(this[e+2]<<16|this[e+1]<<8|this[e])>>>0}readInt8(e=0){return checkOffset(e,1,this.length),this[e]|(this[e]&128?4294967040:0)}readInt16BE(e=0){checkOffset(e,2,this.length);let t=this[e]<<8|this[e+1];return t&32768?t|4294901760:t}readInt16LE(e=0){checkOffset(e,2,this.length);let t=this[e]|this[e+1]<<8;return t&32768?t|4294901760:t}readInt32BE(e=0){return checkOffset(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]}readInt32LE(e=0){return checkOffset(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24}readFloatBE(e=0){return checkOffset(e,4,this.length),new DataView(this.buffer,this.byteOffset+e,4).getFloat32(0,!1)}readFloatLE(e=0){return checkOffset(e,4,this.length),new DataView(this.buffer,this.byteOffset+e,4).getFloat32(0,!0)}readDoubleBE(e=0){return checkOffset(e,8,this.length),new DataView(this.buffer,this.byteOffset+e,8).getFloat64(0,!1)}readDoubleLE(e=0){return checkOffset(e,8,this.length),new DataView(this.buffer,this.byteOffset+e,8).getFloat64(0,!0)}readBigInt64BE(e=0){return checkOffset(e,8,this.length),new DataView(this.buffer,this.byteOffset+e,8).getBigInt64(0,!1)}readBigInt64LE(e=0){return checkOffset(e,8,this.length),new DataView(this.buffer,this.byteOffset+e,8).getBigInt64(0,!0)}readBigUInt64BE(e=0){return checkOffset(e,8,this.length),new DataView(this.buffer,this.byteOffset+e,8).getBigUint64(0,!1)}readBigUInt64LE(e=0){return checkOffset(e,8,this.length),new DataView(this.buffer,this.byteOffset+e,8).getBigUint64(0,!0)}readUIntBE(e,t){checkOffset(e,t,this.length);let n=0;for(let r=0;r<t;r++)n=n*256+this[e+r];return n}readUIntLE(e,t){checkOffset(e,t,this.length);let n=0,r=1;for(let i=0;i<t;i++)n+=this[e+i]*r,r*=256;return n}readIntBE(e,t){checkOffset(e,t,this.length);let n=0;for(let r=0;r<t;r++)n=n*256+this[e+r];return n>=2**(8*t-1)&&(n-=2**(8*t)),n}readIntLE(e,t){checkOffset(e,t,this.length);let n=0,r=1;for(let i=0;i<t;i++)n+=this[e+i]*r,r*=256;return n>=2**(8*t-1)&&(n-=2**(8*t)),n}writeUInt8(e,t=0){return checkOffset(t,1,this.length),this[t]=e&255,t+1}writeUInt16BE(e,t=0){return checkOffset(t,2,this.length),this[t]=e>>>8&255,this[t+1]=e&255,t+2}writeUInt16LE(e,t=0){return checkOffset(t,2,this.length),this[t]=e&255,this[t+1]=e>>>8&255,t+2}writeUInt32BE(e,t=0){return checkOffset(t,4,this.length),this[t]=e>>>24&255,this[t+1]=e>>>16&255,this[t+2]=e>>>8&255,this[t+3]=e&255,t+4}writeUInt32LE(e,t=0){return checkOffset(t,4,this.length),this[t]=e&255,this[t+1]=e>>>8&255,this[t+2]=e>>>16&255,this[t+3]=e>>>24&255,t+4}writeInt8(e,t=0){return checkOffset(t,1,this.length),e<0&&(e=255+e+1),this[t]=e&255,t+1}writeInt16BE(e,t=0){return checkOffset(t,2,this.length),this[t]=e>>>8&255,this[t+1]=e&255,t+2}writeInt16LE(e,t=0){return checkOffset(t,2,this.length),this[t]=e&255,this[t+1]=e>>>8&255,t+2}writeInt32BE(e,t=0){return checkOffset(t,4,this.length),this[t]=e>>>24&255,this[t+1]=e>>>16&255,this[t+2]=e>>>8&255,this[t+3]=e&255,t+4}writeInt32LE(e,t=0){return checkOffset(t,4,this.length),this[t]=e&255,this[t+1]=e>>>8&255,this[t+2]=e>>>16&255,this[t+3]=e>>>24&255,t+4}writeFloatBE(e,t=0){return checkOffset(t,4,this.length),new DataView(this.buffer,this.byteOffset+t,4).setFloat32(0,e,!1),t+4}writeFloatLE(e,t=0){return checkOffset(t,4,this.length),new DataView(this.buffer,this.byteOffset+t,4).setFloat32(0,e,!0),t+4}writeDoubleBE(e,t=0){return checkOffset(t,8,this.length),new DataView(this.buffer,this.byteOffset+t,8).setFloat64(0,e,!1),t+8}writeDoubleLE(e,t=0){return checkOffset(t,8,this.length),new DataView(this.buffer,this.byteOffset+t,8).setFloat64(0,e,!0),t+8}writeBigInt64BE(e,t=0){return checkOffset(t,8,this.length),new DataView(this.buffer,this.byteOffset+t,8).setBigInt64(0,e,!1),t+8}writeBigInt64LE(e,t=0){return checkOffset(t,8,this.length),new DataView(this.buffer,this.byteOffset+t,8).setBigInt64(0,e,!0),t+8}writeBigUInt64BE(e,t=0){return checkOffset(t,8,this.length),new DataView(this.buffer,this.byteOffset+t,8).setBigUint64(0,e,!1),t+8}writeBigUInt64LE(e,t=0){return checkOffset(t,8,this.length),new DataView(this.buffer,this.byteOffset+t,8).setBigUint64(0,e,!0),t+8}swap16(){let e=this.length;if(e%2!=0)throw RangeError(`Buffer size must be a multiple of 16-bits`);for(let t=0;t<e;t+=2){let e=this[t];this[t]=this[t+1],this[t+1]=e}return this}swap32(){let e=this.length;if(e%4!=0)throw RangeError(`Buffer size must be a multiple of 32-bits`);for(let t=0;t<e;t+=4){let e=this[t],n=this[t+1];this[t]=this[t+3],this[t+1]=this[t+2],this[t+2]=n,this[t+3]=e}return this}swap64(){let e=this.length;if(e%8!=0)throw RangeError(`Buffer size must be a multiple of 64-bits`);for(let t=0;t<e;t+=8){let e=this[t],n=this[t+1],r=this[t+2],i=this[t+3];this[t]=this[t+7],this[t+1]=this[t+6],this[t+2]=this[t+5],this[t+3]=this[t+4],this[t+4]=i,this[t+5]=r,this[t+6]=n,this[t+7]=e}return this}},Gt=2**31-1,Kt=2**28-16,qt={MAX_LENGTH:Gt,MAX_STRING_LENGTH:Kt},SlowBuffer=class extends q{constructor(e){super(e)}}}),Yt=__exportAll$4({Blob:()=>x,Buffer:()=>q,File:()=>S,INSPECT_MAX_BYTES:()=>50,SlowBuffer:()=>SlowBuffer,atob:()=>Xt,atobPolyfill:()=>atobPolyfill,base64Decode:()=>base64Decode,base64Encode:()=>base64Encode,btoa:()=>Zt,btoaPolyfill:()=>btoaPolyfill,checkEncoding:()=>checkEncoding,constants:()=>qt,default:()=>Qt,kMaxLength:()=>Gt,kStringMaxLength:()=>Kt,normalizeEncoding:()=>normalizeEncoding}),Xt,Zt,Qt,J=__esmMin(()=>{Rt(),w(),Bt(),Jt(),Xt=globalThis.atob,Zt=globalThis.btoa,Qt={Buffer:q,SlowBuffer,Blob:x,File:S,atob:Xt,btoa:Zt,kMaxLength:Gt,kStringMaxLength:Kt,constants:qt,INSPECT_MAX_BYTES:50}});J(),`Buffer`in globalThis||Object.defineProperty(globalThis,"Buffer",{value:q,enumerable:!1,writable:!0,configurable:!0}),A(),typeof globalThis.btoa!=`function`&&Object.defineProperty(globalThis,"btoa",{value:function btoa(e){let t=new Uint8Array(e.length);for(let n=0;n<e.length;n++)t[n]=e.charCodeAt(n)&255;return k.base64_encode(t)},enumerable:!0,writable:!0,configurable:!0}),typeof globalThis.atob!=`function`&&Object.defineProperty(globalThis,"atob",{value:function atob(e){let t=k.base64_decode(e),n=``;for(let e=0;e<t.length;e++)n+=String.fromCharCode(t[e]);return n},enumerable:!0,writable:!0,configurable:!0}),L(),typeof queueMicrotask!=`function`&&Object.defineProperty(globalThis,"queueMicrotask",{value:ge,enumerable:!0,writable:!0,configurable:!0});function getGjsGlobal(){return globalThis}function getGioNamespace(){let e=getGjsGlobal().imports?.gi;if(!e)return null;let t=null;try{t=e.GioUnix??null}catch{}if(!t)try{t=e.Gio??null}catch{}return t}function getMonotonicTime(){try{let e=getGjsGlobal().imports?.gi?.GLib;if(e?.get_monotonic_time)return BigInt(e.get_monotonic_time())*1000n}catch{}return typeof performance?.now==`function`?BigInt(Math.round(performance.now()*1e6)):BigInt(Date.now())*1000000n}const $t=getMonotonicTime();function hrtime(e){let t=getMonotonicTime()-$t,n=Number(t/1000000000n),r=Number(t%1000000000n);if(e){let t=n-e[0],i=r-e[1];return i<0&&(t--,i+=1e9),[t,i]}return[n,r]}function hrtimeBigint(){return getMonotonicTime()-$t}function detectGjsVersion(){try{let e=getGjsGlobal().imports?.system;if(e?.version!==void 0){let t=Number(e.version);return`${Math.floor(t/1e4)}.${Math.floor(t%1e4/100)}.${t%100}`}}catch{}}function detectNodeVersion(){if(typeof globalThis.process?.versions?.node==`string`)return globalThis.process.versions.node}function detectVersionInfo(){if(detectNodeVersion())return{version:globalThis.process.version,versions:{...globalThis.process.versions},title:globalThis.process?.title||`node`};let e=detectGjsVersion(),t={node:`20.0.0`};return e&&(t.gjs=e),{version:`v20.0.0`,versions:t,title:`gjs`}}function detectPpid(){if(typeof globalThis.process?.ppid==`number`)return globalThis.process.ppid;try{let e=getGjsGlobal().imports?.gi?.GLib;if(e){let[,t]=e.file_get_contents(`/proc/self/status`);if(t){let e=new TextDecoder().decode(t).match(/PPid:\s+(\d+)/);if(e)return parseInt(e[1],10)}}}catch{}return 0}function detectPlatform(){try{let e=getGjsGlobal().imports?.gi?.GLib;if(e&&e.get_os_info(`ID`))return`linux`}catch{}return getGjsGlobal().imports?.system===void 0&&typeof globalThis.process?.platform==`string`?globalThis.process.platform:`linux`}function detectArch(){return typeof globalThis.process?.arch==`string`?globalThis.process.arch:`x64`}function getPid(){if(typeof globalThis.process?.pid==`number`)return globalThis.process.pid;try{let e=getGjsGlobal().imports?.gi?.GLib;if(e){let[,t]=e.file_get_contents(`/proc/self/stat`);if(t){let e=new TextDecoder().decode(t),n=parseInt(e,10);if(!isNaN(n))return n}}}catch{}return 0}function getEnvProxy(){if(typeof globalThis.process?.env==`object`)return globalThis.process.env;try{let e=getGjsGlobal().imports?.gi?.GLib;if(e)return new Proxy({},{get(t,n){if(typeof n==`string`)return e.getenv(n)??void 0},set(t,n,r){return typeof n==`string`?(e.setenv(n,String(r),!0),!0):!1},deleteProperty(t,n){return typeof n==`string`?(e.unsetenv(n),!0):!1},has(t,n){return typeof n==`string`?e.getenv(n)!==null:!1},ownKeys(t){return e.listenv()},getOwnPropertyDescriptor(t,n){if(typeof n!=`string`)return;let r=e.getenv(n);if(r!==null)return{configurable:!0,enumerable:!0,writable:!0,value:r}}})}catch{}return{}}function getArgv(){if(globalThis.process?.argv!==void 0)return globalThis.process.argv;try{let e=getGjsGlobal().imports?.system;if(e?.programArgs)return[`gjs`,e.programInvocationName||``,...e.programArgs]}catch{}return[`gjs`]}function getExecPath(){if(typeof globalThis.process?.execPath==`string`)return globalThis.process.execPath;try{let e=getGjsGlobal().imports?.system;if(e?.programInvocationName)return e.programInvocationName}catch{}return`/usr/bin/gjs`}function getCwd(){try{let e=getGjsGlobal().imports?.gi?.GLib;if(e?.get_current_dir)return e.get_current_dir()}catch{}return`/`}function chdir(e){let t=getGjsGlobal().imports?.gi?.GLib;try{if(t?.chdir){if(!t.file_test(e,16)){let t=Error(`ENOENT: no such file or directory, chdir '${e}'`);throw t.code=`ENOENT`,t.syscall=`chdir`,t.path=e,t}t.chdir(e);return}}catch(e){if(e&&typeof e==`object`&&e.code===`ENOENT`)throw e}if(!t){let t=globalThis.process;if(t&&typeof t.chdir==`function`){t.chdir(e);return}}throw Error(`process.chdir() is not supported in this environment`)}L();function exitProcess(e){let t=getGjsGlobal().imports,n=t?.gi?.GLib,r=t?.system,i=n?.idle_add,a=n?.SOURCE_REMOVE,o=n?.PRIORITY_DEFAULT;if(r?.exit&&i&&typeof o==`number`&&typeof a==`boolean`)return ensureMainLoop(),i(o,()=>(quitMainLoop(),r.exit(e),a)),new Promise(()=>{});try{r?.exit&&r.exit(e)}catch{}let s=globalThis.process;throw s&&typeof s.exit==`function`&&s.exit(e),Error(`process.exit(${e})`)}function isGjs(){return getGjsGlobal().imports?.gi?.GLib!==void 0}function killPid(e,t){try{let n=getGjsGlobal().imports?.gi?.GLib;if(n){let r=typeof t==`number`?String(t):t||`SIGTERM`,i=r.startsWith(`SIG`)?`-${r.slice(3)}`:`-${r}`;return n.spawn_command_line_sync(`kill ${i} ${e}`),!0}}catch{}if(!isGjs()){let n=globalThis.process;if(n&&typeof n.kill==`function`)return n.kill(e,t)}throw Error(`process.kill() is not supported in this environment`)}function memoryUsage(){try{let e=getGjsGlobal().imports?.gi?.GLib;if(e){let[,t]=e.file_get_contents(`/proc/self/status`);if(t){let e=new TextDecoder().decode(t).match(/VmRSS:\s+(\d+)/),n=e?parseInt(e[1],10)*1024:0;return{rss:n,heapTotal:n,heapUsed:n,external:0,arrayBuffers:0}}}}catch{}if(!isGjs()){let e=globalThis.process;if(e&&typeof e.memoryUsage==`function`)return e.memoryUsage()}return{rss:0,heapTotal:0,heapUsed:0,external:0,arrayBuffers:0}}function cpuUsage(e){if(!isGjs()){let t=globalThis.process;if(t&&typeof t.cpuUsage==`function`)return t.cpuUsage(e)}return{user:0,system:0}}let en=null;const tn=globalThis.imports?.gi;if(tn)try{en=tn.GjsifyTerminal}catch{}const nn=en;function onceWrapper(){let{target:e,type:t,listener:n}=this;return this.wrapperFn&&e.removeListener(t,this.wrapperFn),n.apply(e,Array.from(arguments))}function _onceWrap(e,t,n){let r={target:e,type:t,listener:n,wrapperFn:void 0},i=onceWrapper.bind(r);return r.wrapperFn=i,i.listener=n,i}function arrayClone(e){switch(e.length){case 0:return[];case 1:return[e[0]];case 2:return[e[0],e[1]];case 3:return[e[0],e[1],e[2]];default:return e.slice()}}function checkListener(e){if(typeof e!=`function`)throw TypeError(`The "listener" argument must be of type Function. Received type `+typeof e)}function validateNumber(e,t){if(typeof e!=`number`||e!==e)throw TypeError(`The "${t}" argument must be of type number. Received type ${typeof e}`)}function spliceOne(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}function unwrapListeners(e){let t=Array.from({length:e.length});for(let n=0;n<t.length;++n)t[n]=e[n].listener??e[n];return t}function createAbortError$1(e){let t=Error(`The operation was aborted`);return t.name=`AbortError`,t.code=`ABORT_ERR`,e?.reason&&(t.cause=e.reason),t}var rn,an,on,sn=__esmMin(()=>{me(),rn=Symbol(`kCapture`),an=Symbol.for(`nodejs.rejection`),on=class EventEmitter{static defaultMaxListeners=10;static errorMonitor=Symbol(`events.errorMonitor`);static captureRejectionSymbol=an;static _captureRejections=!1;static get captureRejections(){return EventEmitter._captureRejections}static set captureRejections(e){if(typeof e!=`boolean`)throw TypeError(`The "captureRejections" argument must be of type boolean.`);EventEmitter._captureRejections=e}_events;_eventsCount;_maxListeners;[rn];constructor(e){this._events=Object.create(null),this._eventsCount=0,this._maxListeners=void 0,this[rn]=e?.captureRejections??EventEmitter._captureRejections}setMaxListeners(e){if(validateNumber(e,`n`),e<0)throw RangeError(`The value of "n" is out of range. It must be a non-negative number. Received `+e);return this._maxListeners=e,this}getMaxListeners(){return this._maxListeners??EventEmitter.defaultMaxListeners}emit(e,...t){let n=this._events,r=e===`error`;if(n!==void 0)r&&n[EventEmitter.errorMonitor]!==void 0&&this.emit(EventEmitter.errorMonitor,...t),r&&=n.error===void 0;else if(!r)return!1;if(r){let e;if(e=t.length>0?t[0]:Error(`Unhandled error.`),e instanceof Error)throw e;let n=Error(`Unhandled error. (`+e+`)`);throw n.context=e,n}let i=n[e];if(i===void 0)return!1;if(typeof i==`function`){let n=i.apply(this,t);n!=null&&this[rn]&&this._addCatch(n,e,t)}else{let n=arrayClone(i),r=n.length;for(let i=0;i<r;++i){let r=n[i].apply(this,t);r!=null&&this[rn]&&this._addCatch(r,e,t)}}return!0}_addCatch(e,t,n){typeof e?.then==`function`&&e.then(void 0,e=>{let r=this[an];if(typeof r==`function`)r.call(this,e,t,...n);else{let t=this[rn];try{this[rn]=!1,this.emit(`error`,e)}finally{this[rn]=t}}})}addListener(e,t){return this._addListener(e,t,!1)}on(e,t){return this._addListener(e,t,!1)}prependListener(e,t){return this._addListener(e,t,!0)}_addListener(e,t,n){checkListener(t);let r=this._events;r===void 0?(r=this._events=Object.create(null),this._eventsCount=0):r.newListener!==void 0&&(this.emit(`newListener`,e,t.listener??t),r=this._events);let i=r[e];i===void 0?(r[e]=t,++this._eventsCount):typeof i==`function`?r[e]=n?[t,i]:[i,t]:n?i.unshift(t):i.push(t);let a=this.getMaxListeners();if(a>0){let t=typeof r[e]==`function`?1:r[e].length;if(t>a&&!r[e].warned){typeof r[e]!=`function`&&(r[e].warned=!0);let n=Error(`Possible EventEmitter memory leak detected. ${t} ${String(e)} listeners added to [${this.constructor.name}]. Use emitter.setMaxListeners() to increase limit`);n.name=`MaxListenersExceededWarning`,I.warn(n.message)}}return this}once(e,t){return checkListener(t),this.on(e,_onceWrap(this,e,t)),this}prependOnceListener(e,t){return checkListener(t),this.prependListener(e,_onceWrap(this,e,t)),this}removeListener(e,t){checkListener(t);let n=this._events;if(n===void 0)return this;let r=n[e];if(r===void 0)return this;if(r===t||r.listener===t)--this._eventsCount===0?this._events=Object.create(null):(delete n[e],n.removeListener&&this.emit(`removeListener`,e,r.listener??t));else if(typeof r!=`function`){let i=-1;for(let e=r.length-1;e>=0;e--)if(r[e]===t||r[e].listener===t){i=e;break}if(i<0)return this;i===0?r.shift():spliceOne(r,i),r.length===1&&(n[e]=r[0]),n.removeListener!==void 0&&this.emit(`removeListener`,e,t.listener??t)}return this}off(e,t){return this.removeListener(e,t)}removeAllListeners(e){let t=this._events;if(t===void 0)return this;if(t.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):t[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete t[e]),this;if(arguments.length===0){let e=Object.keys(t);for(let t=0;t<e.length;++t){let n=e[t];n!==`removeListener`&&this.removeAllListeners(n)}return this.removeAllListeners(`removeListener`),this._events=Object.create(null),this._eventsCount=0,this}let n=t[e];if(typeof n==`function`)this.removeListener(e,n);else if(n!==void 0)for(let t=n.length-1;t>=0;t--)this.removeListener(e,n[t]);return this}listeners(e){let t=this._events;if(t===void 0)return[];let n=t[e];return n===void 0?[]:typeof n==`function`?[n.listener??n]:unwrapListeners(n)}rawListeners(e){let t=this._events;if(t===void 0)return[];let n=t[e];return n===void 0?[]:typeof n==`function`?[n]:arrayClone(n)}listenerCount(e){let t=this._events;if(t===void 0)return 0;let n=t[e];return n===void 0?0:typeof n==`function`?1:n.length}eventNames(){return(this._eventsCount??0)>0?Reflect.ownKeys(this._events):[]}static once(e,t,n){return new Promise((r,i)=>{let a=n?.signal;if(a?.aborted){i(createAbortError$1(a));return}if(typeof e.addEventListener==`function`){let n=e,handler=(...e)=>{a&&a.removeEventListener(`abort`,abortHandler),r(e)},errorHandler=e=>{a&&a.removeEventListener(`abort`,abortHandler),n.removeEventListener(`error`,errorHandler),i(e)},abortHandler=()=>{n.removeEventListener(t,handler),n.removeEventListener(`error`,errorHandler),i(createAbortError$1(a))};n.addEventListener(t,handler,{once:!0}),t!==`error`&&n.addEventListener(`error`,errorHandler,{once:!0}),a&&a.addEventListener(`abort`,abortHandler,{once:!0});return}let o=e,eventHandler=(...e)=>{a&&a.removeEventListener(`abort`,abortHandler),errorHandler!==void 0&&o.removeListener(`error`,errorHandler),r(e)},errorHandler;t!==`error`&&(errorHandler=e=>{o.removeListener(t,eventHandler),a&&a.removeEventListener(`abort`,abortHandler),i(e)},o.once(`error`,errorHandler)),o.once(t,eventHandler);let abortHandler=()=>{o.removeListener(t,eventHandler),errorHandler&&o.removeListener(`error`,errorHandler),i(createAbortError$1(a))};a&&a.addEventListener(`abort`,abortHandler,{once:!0})})}static on(e,t,n){let r=n?.signal;if(r?.aborted)throw createAbortError$1(r);let i=n?.highWaterMark??2**53-1,a=n?.lowWaterMark??1;validateNumber(i,`highWaterMark`),validateNumber(a,`lowWaterMark`);let o=[],s=[],c=null,l=!1,u=!1,eventHandler=(...t)=>{if(s.length>0){let{resolve:e}=s.shift();e({value:t,done:!1})}else o.push(t),o.length>=i&&!u&&(u=!0,typeof e.pause==`function`&&e.pause())},errorHandler=e=>{if(c=e,s.length>0){let{reject:t}=s.shift();t(e)}d.return()},abortHandler=()=>{errorHandler(createAbortError$1(r))};e.on(t,eventHandler),t!==`error`&&e.on(`error`,errorHandler),r&&r.addEventListener(`abort`,abortHandler,{once:!0});let cleanup=()=>{e.removeListener(t,eventHandler),e.removeListener(`error`,errorHandler),r&&r.removeEventListener(`abort`,abortHandler),l=!0;for(let{resolve:e}of s)e({value:void 0,done:!0});s.length=0,o.length=0},d={next(){if(o.length>0){let t=o.shift();return u&&o.length<a&&(u=!1,typeof e.resume==`function`&&e.resume()),Promise.resolve({value:t,done:!1})}if(c){let e=Promise.reject(c);return c=null,e}return l?Promise.resolve({value:void 0,done:!0}):new Promise((e,t)=>{s.push({resolve:e,reject:t})})},return(){return cleanup(),Promise.resolve({value:void 0,done:!0})},throw(e){return l||(c=e,cleanup()),Promise.reject(e)},[Symbol.asyncIterator](){return this}};return d}static listenerCount(e,t){return e.listenerCount(t)}static getEventListeners(e,t){return typeof e.listeners==`function`?e.listeners(t):[]}static setMaxListeners(e,...t){if(validateNumber(e,`n`),e<0)throw RangeError(`The value of "n" is out of range.`);if(t.length===0)EventEmitter.defaultMaxListeners=e;else for(let n of t)typeof n.setMaxListeners==`function`&&n.setMaxListeners(e)}static getMaxListeners(e){return typeof e.getMaxListeners==`function`?e.getMaxListeners():EventEmitter.defaultMaxListeners}static addAbortListener(e,t){e.aborted&&Promise.resolve().then(()=>t());let handler=()=>t();return e.addEventListener(`abort`,handler,{once:!0}),{[Symbol.dispose](){e.removeEventListener(`abort`,handler)}}}},on.EventEmitter=on;for(let e of[`setMaxListeners`,`getMaxListeners`,`emit`,`addListener`,`on`,`prependListener`,`once`,`prependOnceListener`,`removeListener`,`off`,`removeAllListeners`,`listeners`,`rawListeners`,`listenerCount`,`eventNames`]){let t=on.prototype[e];typeof t==`function`&&Object.defineProperty(on.prototype,e,{enumerable:!0,configurable:!0,writable:!0,value:t})}Object.defineProperty(on.prototype,"_events",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(on.prototype,"_eventsCount",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(on.prototype,"_maxListeners",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),__name(createAbortError$1,`createAbortError`)}),cn=__exportAll$4({EventEmitter:()=>Y,addAbortListener:()=>vn,captureRejectionSymbol:()=>ln,default:()=>Y,defaultMaxListeners:()=>dn,errorMonitor:()=>un,getEventListeners:()=>gn,getMaxListeners:()=>pn,listenerCount:()=>_n,on:()=>hn,once:()=>mn,setMaxListeners:()=>fn}),Y,ln,un,dn,fn,pn,mn,hn,gn,_n,vn,yn=__esmMin(()=>{sn(),L(),Y=makeCallable(on),Y.EventEmitter=Y,ln=Y.captureRejectionSymbol,un=Y.errorMonitor,dn=Y.defaultMaxListeners,fn=Y.setMaxListeners,pn=Y.getMaxListeners,mn=Y.once,hn=Y.on,gn=Y.getEventListeners,_n=Y.listenerCount,vn=Y.addAbortListener});me(),yn(),L();const bn=new TextEncoder;var ProcessWriteStream=class extends Y{fd;writable=!0;_outGio=null;constructor(e){super(),this.fd=e;let t=getGioNamespace();if(t){let e=t.UnixOutputStream??t.OutputStream;if(e)try{this._outGio=e.new(this.fd,!1)}catch{}}}write(e){if(this._outGio)try{let t=typeof e==`string`?bn.encode(e):e;return this._outGio.write_all(t,null),!0}catch{}return this.fd===2?I.error(e):I.log(e),!0}get isTTY(){if(nn)return nn.Terminal.is_tty(this.fd);try{let e=getGjsGlobal().imports?.gi?.GLib;if(e)return!!e.log_writer_supports_color(this.fd)}catch{}return!1}get columns(){if(nn){let[e,,t]=nn.Terminal.get_size(this.fd);if(e&&t>0)return t}try{let e=getGjsGlobal().imports?.gi?.GLib;if(e){let t=parseInt(e.getenv(`COLUMNS`)??`0`,10);if(t>0)return t}}catch{}return 80}end(){}destroy(){}get rows(){if(nn){let[e,t]=nn.Terminal.get_size(this.fd);if(e&&t>0)return t}try{let e=getGjsGlobal().imports?.gi?.GLib;if(e){let t=parseInt(e.getenv(`LINES`)??`0`,10);if(t>0)return t}}catch{}return 24}},ProcessReadStream=class extends Y{fd;isRaw=!1;_gio=null;_stdinGio=null;_reading=!1;_flowing=!1;_sttyCleanupRegistered=!1;_mainLoopHeld=!1;_pendingRead=!1;constructor(e){super(),this.fd=e,this._gio=getGioNamespace()}get isTTY(){return nn?nn.Terminal.is_tty(this.fd):!1}setRawMode(e){return nn&&nn.Terminal.set_raw_mode(this.fd,e)?(this.isRaw=e,this):(this._setRawModeViaStty(e),this.isRaw=e,this)}_setRawModeViaStty(e){try{let t=globalThis.imports?.gi,n=t?.Gio??t?.Gio;if(!n)return;let r=n.SubprocessFlags?.STDIN_INHERIT??2,i=e?[`stty`,`-icanon`,`-echo`,`-icrnl`,`min`,`1`,`time`,`0`]:[`stty`,`icanon`,`echo`,`icrnl`];if(new n.SubprocessLauncher({flags:r}).spawnv(i).wait(null),e&&!this._sttyCleanupRegistered){this._sttyCleanupRegistered=!0;let e=globalThis.process;e?.once&&typeof e.once==`function`&&e.once(`exit`,()=>this._setRawModeViaStty(!1))}}catch{}}setEncoding(e){return this}resume(){return this._flowing=!0,this._gio&&this.fd===0&&!this._reading&&this._startReading(),this}pause(){if(this._flowing=!1,this._reading=!1,this._mainLoopHeld){this._mainLoopHeld=!1;let e=globalThis.imports?.gi,t=e?.GLib??e?.GLib;t?.idle_add?t.idle_add(300,()=>(this._mainLoopHeld||quitMainLoop(),!1)):quitMainLoop()}return this}read(){return null}_startReading(){if(!this._gio||this._reading)return;if(this._pendingRead){this._reading=!0,this._mainLoopHeld||(this._mainLoopHeld=!0,ensureMainLoop());return}if(this._reading=!0,this._mainLoopHeld||(this._mainLoopHeld=!0,ensureMainLoop()),!this._stdinGio){let e=this._gio.UnixInputStream??this._gio.InputStream;if(!e){this._reading=!1;return}try{this._stdinGio=e.new(this.fd,!1)}catch{this._reading=!1;return}}let loop=()=>{if(!this._reading){this._pendingRead=!1;return}this._pendingRead=!0,this._stdinGio.read_bytes_async(4096,0,null,(e,t)=>{this._pendingRead=!1;try{let n=e.read_bytes_finish(t)?.get_data?.()??null;if(n&&n.byteLength>0)this.emit(`data`,Buffer.from(n));else if(n!==null&&n.byteLength===0){this._reading=!1,this.emit(`end`);return}}catch{this._reading=!1;return}this._reading&&loop()})};loop()}};me(),yn();const xn=Date.now();var Process=class extends Y{platform;arch;env;argv;argv0;execPath;pid;ppid;version;versions;title;execArgv;config;exitCode;constructor(){super(),this.platform=detectPlatform(),this.arch=detectArch(),this.env=getEnvProxy(),this.argv=getArgv(),this.argv0=this.argv[0]||`gjs`,this.execPath=getExecPath(),this.execArgv=globalThis.process?.execArgv??[],this.config=globalThis.process?.config??{target_defaults:{},variables:{}},this.pid=getPid(),this.ppid=detectPpid();let e=detectVersionInfo();this.version=e.version,this.versions=e.versions,this.title=e.title}cwd(){return getCwd()}chdir(e){chdir(e)}kill(e,t){return killPid(e,t)}exit(e){return this.exitCode=e??this.exitCode??0,this.emit(`exit`,this.exitCode),exitProcess(this.exitCode)}nextTick(e,...t){typeof queueMicrotask==`function`?queueMicrotask(()=>e(...t)):Promise.resolve().then(()=>e(...t))}hrtime(e){return hrtime(e)}uptime(){return(Date.now()-xn)/1e3}memoryUsage(){return memoryUsage()}cpuUsage(e){return cpuUsage(e)}stdout=new ProcessWriteStream(1);stderr=new ProcessWriteStream(2);stdin=new ProcessReadStream(0);abort(){this.exit(1)}umask(e){return 18}emitWarning(e,t){I.warn(typeof e==`string`?`(${t||`Warning`}): ${e}`:e.message)}};Process.prototype.hrtime.bigint=function(){return hrtimeBigint()};const X=new Process;if(nn)try{let e=new nn.ResizeWatcher;e.connect(`resized`,(e,t,n)=>{X.stdout.emit(`resize`),X.stderr.emit(`resize`)}),e.start()}catch{}X.platform,X.arch,X.env,X.argv,X.argv0,X.execPath,X.pid,X.ppid,X.version,X.versions,X.cwd.bind(X),X.chdir.bind(X),X.exit.bind(X),X.nextTick.bind(X),Object.assign(X.hrtime.bind(X),{bigint:hrtimeBigint}),X.uptime.bind(X),X.memoryUsage.bind(X),X.cpuUsage.bind(X),X.kill.bind(X),X.abort.bind(X),X.umask.bind(X),X.emitWarning.bind(X),X.execArgv,X.config,X.stdout,X.stderr,X.stdin,L(),typeof Promise.withResolvers!=`function`&&(Promise.withResolvers=function(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}),initErrorV8Methods(Error),`global`in globalThis||Object.defineProperty(globalThis,"global",{value:globalThis,writable:!1,enumerable:!1,configurable:!0}),Object.defineProperty(globalThis,"process",{value:X,enumerable:!1,writable:!0,configurable:!0}),L(),typeof globalThis.structuredClone!=`function`&&Object.defineProperty(globalThis,"structuredClone",{value:structuredClone$1,enumerable:!0,writable:!0,configurable:!0});function getGLib(){return globalThis.imports?.gi?.GLib}const Sn=getGLib()!==void 0;var GjsifyTimeout=class{_id=null;_refed=!0;_callback;_delay;_args;_repeat;constructor(e,t,n,r){this._callback=e,this._delay=t,this._args=n,this._repeat=r,this._schedule()}_schedule(){let e=getGLib();if(!e)return;let t=e.timeout_add.bind(e);this._id=t(e.PRIORITY_DEFAULT,this._delay,()=>{try{this._callback.apply(globalThis,this._args)}catch(e){setTimeout(()=>{throw e},0)}return this._repeat?e.SOURCE_CONTINUE:(this._id=null,e.SOURCE_REMOVE)})}ref(){return this._refed=!0,this}unref(){return this._refed=!1,this}hasRef(){return this._refed}refresh(){return this._cancel(),this._schedule(),this}_cancel(){if(this._id!==null){try{getGLib()?.Source.remove(this._id)}catch{}this._id=null}}[Symbol.toPrimitive](){return this._id}[Symbol.dispose](){this._cancel()}};function removeById(e){if(e instanceof GjsifyTimeout)e._cancel();else if(typeof e==`number`)try{getGLib()?.Source.remove(e)}catch{}}if(Sn){let setT=(e,t=0,...n)=>new GjsifyTimeout(e,Math.max(0,t|0),n,!1),setI=(e,t=0,...n)=>new GjsifyTimeout(e,Math.max(0,t|0),n,!0),e=globalThis;e.setTimeout=setT,e.clearTimeout=removeById,e.setInterval=setI,e.clearInterval=removeById}function setImmediate$1(e,...t){return setTimeout(e,0,...t)}__name(setImmediate$1,`setImmediate`);function clearImmediate(e){clearTimeout(e)}`setImmediate`in globalThis||Object.defineProperty(globalThis,"setImmediate",{value:setImmediate$1,enumerable:!0,writable:!0,configurable:!0}),`clearImmediate`in globalThis||Object.defineProperty(globalThis,"clearImmediate",{value:clearImmediate,enumerable:!0,writable:!0,configurable:!0});var Cn=__exportAll$4({URL:()=>Z,URLSearchParams:()=>Tn,default:()=>En,domainToASCII:()=>domainToASCII,domainToUnicode:()=>domainToUnicode,fileURLToPath:()=>fileURLToPath,format:()=>format$3,parse:()=>parse$3,pathToFileURL:()=>pathToFileURL,resolve:()=>resolve$2});function decodeComponent(e){try{return decodeURIComponent(e.replace(/\+/g,` `))}catch{return e}}function encodeComponent(e){return encodeURIComponent(e).replace(/%20/g,`+`)}function parse$3(e,t,n){if(typeof e!=`string`)throw TypeError(`The "url" argument must be of type string. Received type `+typeof e);let r={protocol:null,slashes:null,auth:null,host:null,port:null,hostname:null,hash:null,search:null,query:null,pathname:null,path:null,href:e},i=e.trim(),a=i.indexOf(`#`);a!==-1&&(r.hash=i.slice(a),i=i.slice(0,a));let o=i.indexOf(`?`);o!==-1&&(r.search=i.slice(o),r.query=t?Object.fromEntries(new Tn(i.slice(o+1))):i.slice(o+1),i=i.slice(0,o));let s=/^([a-z][a-z0-9.+-]*:)/i.exec(i);if(s&&(r.protocol=s[1].toLowerCase(),i=i.slice(r.protocol.length)),(n||r.protocol)&&i.startsWith(`//`)&&(r.slashes=!0,i=i.slice(2)),r.slashes||r.protocol&&![`javascript:`,`data:`,`mailto:`].includes(r.protocol)){let e=-1;for(let t=0;t<i.length;t++){let n=i[t];if(n===`/`||n===`\\`){e=t;break}}let t=e===-1?i:i.slice(0,e);i=e===-1?``:i.slice(e);let n=t.lastIndexOf(`@`);n===-1?parseHostPort(t,r):(r.auth=decodeURIComponent(t.slice(0,n)),parseHostPort(t.slice(n+1),r))}return r.pathname=i||(r.slashes?`/`:null),(r.pathname!==null||r.search!==null)&&(r.path=(r.pathname||``)+(r.search||``)),r.href=format$3(r),r}function parseHostPort(e,t){if(!e)return;let n=e.indexOf(`[`);if(n!==-1){let r=e.indexOf(`]`,n);if(r!==-1){let i=e.slice(r+1);i.startsWith(`:`)&&(t.port=i.slice(1)),t.hostname=e.slice(n,r+1),t.host=t.hostname+(t.port?`:`+t.port:``);return}}let r=e.lastIndexOf(`:`);if(r!==-1){let n=e.slice(r+1);/^\d*$/.test(n)?(t.port=n||null,t.hostname=e.slice(0,r).toLowerCase()):t.hostname=e.toLowerCase()}else t.hostname=e.toLowerCase();t.host=t.hostname+(t.port?`:`+t.port:``)}function format$3(e){if(typeof e==`string`)return e;if(e instanceof Z)return e.href;let t=e,n=``;if(t.protocol&&(n+=t.protocol),(t.slashes||t.protocol&&![`javascript:`,`data:`,`mailto:`].includes(t.protocol||``))&&(n+=`//`),t.auth&&(n+=encodeURIComponent(t.auth)+`@`),t.host?n+=t.host:(t.hostname&&(n+=t.hostname),t.port&&(n+=`:`+t.port)),t.pathname&&(n+=t.pathname),t.search)n+=t.search;else if(t.query&&typeof t.query==`object`){let e=new Tn(t.query).toString();e&&(n+=`?`+e)}return t.hash&&(n+=t.hash),n}function resolve$2(e,t){return new Z(t,new Z(e,`resolve://`)).href.replace(/^resolve:\/\//,``)}function fileURLToPath(e){if(typeof e==`string`&&(e=new Z(e)),!(e instanceof Z))throw TypeError(`The "url" argument must be of type string or URL. Received type `+typeof e);if(e.protocol!==`file:`)throw TypeError(`The URL must be of scheme file`);if(e.hostname!==``&&e.hostname!==`localhost`)throw TypeError(`File URL host must be "localhost" or empty on linux`);let t=e.pathname;for(let e=0;e<t.length;e++)if(t[e]===`%`){let n=t.codePointAt(e+2)|32;if(t[e+1]===`2`&&n===102)throw TypeError(`File URL path must not include encoded / characters`)}return decodeURIComponent(t)}function pathToFileURL(e){let t=e;if(e[0]!==`/`)if(typeof globalThis.process?.cwd==`function`)t=globalThis.process.cwd()+`/`+e;else try{k?.get_current_dir&&(t=k.get_current_dir()+`/`+e)}catch{}return new Z(`file://`+encodePathForURL(t))}function encodePathForURL(e){let t=``;for(let n=0;n<e.length;n++){let r=e[n];r>=`a`&&r<=`z`||r>=`A`&&r<=`Z`||r>=`0`&&r<=`9`||r===`/`||r===`-`||r===`_`||r===`.`||r===`~`||r===`:`||r===`@`||r===`!`?t+=r:t+=encodeURIComponent(r)}return t}function domainToASCII(e){try{return new Z(`http://${e}`).hostname}catch{return``}}function domainToUnicode(e){try{return new Z(`http://${e}`).hostname}catch{return``}}var wn,Tn,Z,En,Dn=__esmMin(()=>{A(),wn=k.UriFlags.HAS_PASSWORD|k.UriFlags.ENCODED|k.UriFlags.SCHEME_NORMALIZE,Tn=class URLSearchParams{_entries=[];constructor(e){if(e)if(typeof e==`string`){let t=e.startsWith(`?`)?e.slice(1):e;if(t)for(let e of t.split(`&`)){let t=e.indexOf(`=`);t===-1?this._entries.push([decodeComponent(e),``]):this._entries.push([decodeComponent(e.slice(0,t)),decodeComponent(e.slice(t+1))])}}else if(Array.isArray(e))for(let[t,n]of e)this._entries.push([String(t),String(n)]);else if(e instanceof URLSearchParams)this._entries=e._entries.map(([e,t])=>[e,t]);else for(let t of Object.keys(e))this._entries.push([t,String(e[t])])}get(e){for(let[t,n]of this._entries)if(t===e)return n;return null}getAll(e){return this._entries.filter(([t])=>t===e).map(([,e])=>e)}set(e,t){let n=!1;if(this._entries=this._entries.filter(([t])=>t===e?n?!1:(n=!0,!0):!0),n){for(let n=0;n<this._entries.length;n++)if(this._entries[n][0]===e){this._entries[n][1]=t;break}}else this._entries.push([e,t])}has(e){return this._entries.some(([t])=>t===e)}delete(e){this._entries=this._entries.filter(([t])=>t!==e)}append(e,t){this._entries.push([e,t])}sort(){this._entries.sort((e,t)=>e[0]<t[0]?-1:+(e[0]>t[0]))}toString(){return this._entries.map(([e,t])=>encodeComponent(e)+`=`+encodeComponent(t)).join(`&`)}forEach(e){for(let[t,n]of this._entries)e(n,t,this)}*entries(){yield*this._entries}*keys(){for(let[e]of this._entries)yield e}*values(){for(let[,e]of this._entries)yield e}[Symbol.iterator](){return this.entries()}get size(){return this._entries.length}},Z=class URL{#e;#t;constructor(e,t){let n=e instanceof URL?e.href:String(e);try{if(t!==void 0){let e=t instanceof URL?t.href:String(t),r=k.Uri.parse(e,wn);this.#e=r.parse_relative(n,wn)}else this.#e=k.Uri.parse(n,wn)}catch{throw TypeError(`Invalid URL: ${n}`)}if(!this.#e)throw TypeError(`Invalid URL: ${n}`);this.#t=new Tn(this.#e.get_query()||``)}get protocol(){return this.#e.get_scheme()+`:`}get hostname(){return(this.#e.get_host()||``).toLowerCase()}get port(){let e=this.#e.get_port();if(e===-1)return``;let t=this.#e.get_scheme();return(t===`http`||t===`ws`)&&e===80||(t===`https`||t===`wss`)&&e===443||t===`ftp`&&e===21?``:String(e)}get host(){let e=this.hostname,t=this.port;return t?`${e}:${t}`:e}get pathname(){return this.#e.get_path()||`/`}get search(){let e=this.#e.get_query();return e?`?`+e:``}get hash(){let e=this.#e.get_fragment();return e?`#`+e:``}get origin(){let e=this.protocol;return e===`http:`||e===`https:`||e===`ftp:`?`${e}//${this.host}`:`null`}get username(){return this.#e.get_user()||``}get password(){return this.#e.get_password()||``}get href(){let e=this.protocol,t=this.#e.get_scheme();(t===`http`||t===`https`||t===`ftp`||t===`file`||t===`ws`||t===`wss`||this.hostname)&&(e+=`//`);let n=this.username,r=this.password;n&&(e+=n,r&&(e+=`:`+r),e+=`@`),e+=this.hostname,this.port&&(e+=`:`+this.port);let i=this.pathname;return e+=i,e+=this.search,e+=this.hash,e}get searchParams(){return this.#t}toString(){return this.href}toJSON(){return this.href}static _objectURLPaths=new Map;static _objectURLCounter=0;static createObjectURL(e){let t=e?._tmpPath;if(typeof t==`string`&&t.length>0){let e=`file://${t}`;return URL._objectURLPaths.set(e,t),e}return`file:///dev/null`}static revokeObjectURL(e){let t=URL._objectURLPaths.get(e);if(t){try{k.unlink(t)}catch{}URL._objectURLPaths.delete(e)}}},__name(parse$3,`parse`),__name(format$3,`format`),__name(resolve$2,`resolve`),En={URL:Z,URLSearchParams:Tn,parse:parse$3,format:format$3,resolve:resolve$2,fileURLToPath,pathToFileURL,domainToASCII,domainToUnicode}});Dn(),typeof globalThis.URL!=`function`&&Object.defineProperty(globalThis,"URL",{value:Z,enumerable:!1,writable:!0,configurable:!0}),typeof globalThis.URLSearchParams!=`function`&&Object.defineProperty(globalThis,"URLSearchParams",{value:Tn,enumerable:!1,writable:!0,configurable:!0});let On;if(globalThis.performance)On=globalThis.performance;else{let e,_now;try{let t=globalThis.imports?.gi?.GLib;if(!t)throw Error(`GJS imports.gi.GLib not available`);e=t.get_monotonic_time(),_now=()=>(t.get_monotonic_time()-e)/1e3}catch{let t=Date.now();e=0,_now=()=>Date.now()-t}let t=[],n=Date.now()-_now();On={timeOrigin:n,now:_now,mark(e){let n={name:e,entryType:`mark`,startTime:_now(),duration:0};return t.push(n),n},measure(e,n,r){let i=0,a=_now();if(n){let e=t.find(e=>e.entryType===`mark`&&e.name===n);e&&(i=e.startTime)}if(r){let e=t.find(e=>e.entryType===`mark`&&e.name===r);e&&(a=e.startTime)}let o={name:e,entryType:`measure`,startTime:i,duration:a-i};return t.push(o),o},getEntries(){return[...t]},getEntriesByName(e){return t.filter(t=>t.name===e)},getEntriesByType(e){return t.filter(t=>t.entryType===e)},clearMarks(e){for(let n=t.length-1;n>=0;n--)t[n].entryType===`mark`&&(!e||t[n].name===e)&&t.splice(n,1)},clearMeasures(e){for(let n=t.length-1;n>=0;n--)t[n].entryType===`measure`&&(!e||t[n].name===e)&&t.splice(n,1)},clearResourceTimings(){},setResourceTimingBufferSize(){},toJSON(){return{timeOrigin:n}}}}var PerformanceObserverStub=class{_callback;constructor(e){this._callback=e}observe(e){}disconnect(){}takeRecords(){return[]}};const kn=globalThis,An=kn.PerformanceObserver||PerformanceObserverStub;kn.PerformanceEntry,kn.PerformanceObserverEntryList,kn.PerformanceMark,kn.PerformanceMeasure;const jn=globalThis;globalThis.performance===void 0&&(jn.performance=On),typeof jn.PerformanceObserver!=`function`&&(jn.PerformanceObserver=An);const Mn=Symbol(`abort`),Nn=Symbol(`internal`);var Pn=class AbortSignal extends EventTarget{#e=!1;reason=void 0;onabort=null;constructor(e){if(super(),e!==Nn)throw TypeError(`Illegal constructor.`)}get aborted(){if(!(this instanceof AbortSignal))throw TypeError(`'get aborted' called on an object that is not a valid instance of AbortSignal.`);return this.#e}get[Symbol.toStringTag](){return`AbortSignal`}throwIfAborted(){if(this.#e)throw this.reason}[Mn](e){if(this.#e)return;this.#e=!0,this.reason=e??new Be(`The operation was aborted.`,`AbortError`);let t=new Event(`abort`);typeof this.onabort==`function`&&this.onabort.call(this,t),this.dispatchEvent(t)}static abort(e){let t=new AbortSignal(Nn);return t[Mn](e),t}static timeout(e){let t=new AbortSignal(Nn);return setTimeout(()=>{t[Mn](new Be(`The operation timed out.`,`TimeoutError`))},e),t}static any(e){let t=new AbortSignal(Nn);for(let n of e)if(n.aborted)return t[Mn](n.reason),t;let onAbort=()=>{if(!t.aborted){let n=e.find(e=>e.aborted);t[Mn](n?.reason)}};for(let t of e)t.addEventListener(`abort`,onAbort,{once:!0});return t}},Fn=class AbortController{signal;constructor(){this.signal=new Pn(Nn)}abort(e){if(!(this instanceof AbortController))throw TypeError(`'abort' called on an object that is not a valid instance of AbortController.`);this.signal[Mn](e)}};const In=globalThis;globalThis.AbortController===void 0&&(In.AbortController=Fn),globalThis.AbortSignal===void 0&&(In.AbortSignal=Pn);const Q=Symbol(`kState`),$=Symbol(`kType`);function isBrandCheck(e){return t=>typeof t==`object`&&!!t&&t[Q]!==void 0&&t[$]===e}function dequeueValue(e){let t=e[Q].queue.shift();if(t===void 0)throw Error(`dequeueValue called on an empty queue`);let{value:n,size:r}=t;return e[Q].queueTotalSize=Math.max(0,e[Q].queueTotalSize-r),n}function resetQueue(e){e[Q].queue=[],e[Q].queueTotalSize=0}function peekQueueValue(e){return e[Q].queue[0].value}function enqueueValueWithSize(e,t,n){if(n=+n,typeof n!=`number`||n<0||Number.isNaN(n)||n===1/0)throw RangeError(`Invalid size: ${n}`);e[Q].queue.push({value:t,size:n}),e[Q].queueTotalSize+=n}function extractHighWaterMark(e,t){if(e===void 0)return t;if(e=+e,typeof e!=`number`||Number.isNaN(e)||e<0)throw RangeError(`Invalid highWaterMark: ${e}`);return e}function extractSizeAlgorithm(e){if(e===void 0)return()=>1;if(typeof e!=`function`)throw TypeError(`strategy.size must be a function`);return e}function transferArrayBuffer(e){return typeof ArrayBuffer.prototype.transfer==`function`?e.transfer():e.slice(0)}function isDetachedBuffer(e){if(typeof SharedArrayBuffer<`u`&&e instanceof SharedArrayBuffer||e.byteLength!==0)return!1;try{return e.slice(0,0),!1}catch{return!0}}function typedArrayConstructorByTag(e){switch(e){case`Int8Array`:return Int8Array;case`Uint8Array`:return Uint8Array;case`Uint8ClampedArray`:return Uint8ClampedArray;case`Int16Array`:return Int16Array;case`Uint16Array`:return Uint16Array;case`Int32Array`:return Int32Array;case`Uint32Array`:return Uint32Array;case`Float32Array`:return Float32Array;case`Float64Array`:return Float64Array;case`BigInt64Array`:return typeof BigInt64Array<`u`?BigInt64Array:void 0;case`BigUint64Array`:return typeof BigUint64Array<`u`?BigUint64Array:void 0;default:return}}function elementSizeByTag(e){switch(e){case`Int8Array`:case`Uint8Array`:case`Uint8ClampedArray`:return 1;case`Int16Array`:case`Uint16Array`:return 2;case`Int32Array`:case`Uint32Array`:case`Float32Array`:return 4;case`Float64Array`:case`BigInt64Array`:case`BigUint64Array`:return 8;default:return 1}}function setPromiseHandled(e){e.then(()=>{},()=>{})}function createPromiseCallback(e,t,n){if(typeof t!=`function`)throw TypeError(`${e} must be a function`);return async(...e)=>t.call(n,...e)}async function nonOpFlush(){}function nonOpStart(){}async function nonOpPull(){}async function nonOpCancel(){}async function nonOpWrite(){}const Ln={__proto__:Object.getPrototypeOf(Object.getPrototypeOf(async function*(){}).prototype),next:void 0,return:void 0};function createAsyncFromSyncIterator(e){let t={[Symbol.iterator]:()=>e.iterator},n=(async function*(){return yield*t})();return{iterator:n,nextMethod:n.next,done:!1}}function getIterator(e,t=`sync`,n){if(n===void 0)if(t===`async`){if(n=e[Symbol.asyncIterator],n==null){let t=e[Symbol.iterator];if(t===void 0)throw TypeError(`Object is not iterable`);return createAsyncFromSyncIterator(getIterator(e,`sync`,t))}}else n=e[Symbol.iterator];if(n===void 0)throw TypeError(`Object is not iterable`);let r=n.call(e);if(typeof r!=`object`||!r)throw TypeError(`The iterator method must return an object`);return{iterator:r,nextMethod:r.next,done:!1}}function iteratorNext(e,t){let n;if(n=t===void 0?e.nextMethod.call(e.iterator):e.nextMethod.call(e.iterator,t),typeof n!=`object`||!n)throw TypeError(`The iterator.next() method must return an object`);return n}const Rn=typeof globalThis.AbortController==`function`?globalThis.AbortController:class AbortControllerShim{signal={aborted:!1,reason:void 0,addEventListener(){},removeEventListener(){}};abort(e){this.signal.aborted=!0,this.signal.reason=e}},zn=Symbol(`kAbort`),Bn=Symbol(`kCloseSentinel`),Vn=Symbol(`kError`),Hn=Symbol(`kSkipThrow`);var WritableStream=class{[$]=`WritableStream`;[Q];constructor(e={},t={}){if(e!=null&&typeof e!=`object`)throw TypeError(`sink must be an object`);if(t!=null&&typeof t!=`object`)throw TypeError(`strategy must be an object`);let n=e?.type;if(n!==void 0)throw RangeError(`Invalid type: ${n}`);this[Q]=createWritableStreamState();let r=extractSizeAlgorithm(t?.size),i=extractHighWaterMark(t?.highWaterMark,1);setupWritableStreamDefaultControllerFromSink(this,e,i,r)}get locked(){if(!Un(this))throw TypeError(`Invalid this`);return isWritableStreamLocked(this)}abort(e){return Un(this)?isWritableStreamLocked(this)?Promise.reject(TypeError(`WritableStream is locked`)):writableStreamAbort(this,e):Promise.reject(TypeError(`Invalid this`))}close(){return Un(this)?isWritableStreamLocked(this)?Promise.reject(TypeError(`WritableStream is locked`)):writableStreamCloseQueuedOrInFlight(this)?Promise.reject(TypeError(`Failure closing WritableStream`)):writableStreamClose(this):Promise.reject(TypeError(`Invalid this`))}getWriter(){if(!Un(this))throw TypeError(`Invalid this`);return new WritableStreamDefaultWriter(this)}get[Symbol.toStringTag](){return`WritableStream`}},WritableStreamDefaultWriter=class{[$]=`WritableStreamDefaultWriter`;[Q];constructor(e){if(!Un(e))throw TypeError(`Expected a WritableStream`);this[Q]={stream:void 0,close:{promise:void 0,resolve:void 0,reject:void 0},ready:{promise:void 0,resolve:void 0,reject:void 0}},setupWritableStreamDefaultWriter(this,e)}get closed(){return Wn(this)?this[Q].close.promise:Promise.reject(TypeError(`Invalid this`))}get desiredSize(){if(!Wn(this))throw TypeError(`Invalid this`);if(this[Q].stream===void 0)throw TypeError(`Writer is not bound to a WritableStream`);return writableStreamDefaultWriterGetDesiredSize(this)}get ready(){return Wn(this)?this[Q].ready.promise:Promise.reject(TypeError(`Invalid this`))}abort(e){return Wn(this)?this[Q].stream===void 0?Promise.reject(TypeError(`Writer is not bound to a WritableStream`)):writableStreamDefaultWriterAbort(this,e):Promise.reject(TypeError(`Invalid this`))}close(){if(!Wn(this))return Promise.reject(TypeError(`Invalid this`));let{stream:e}=this[Q];return e===void 0?Promise.reject(TypeError(`Writer is not bound to a WritableStream`)):writableStreamCloseQueuedOrInFlight(e)?Promise.reject(TypeError(`Failure to close WritableStream`)):writableStreamDefaultWriterClose(this)}releaseLock(){if(!Wn(this))throw TypeError(`Invalid this`);let{stream:e}=this[Q];e!==void 0&&writableStreamDefaultWriterRelease(this)}write(e){return Wn(this)?this[Q].stream===void 0?Promise.reject(TypeError(`Writer is not bound to a WritableStream`)):writableStreamDefaultWriterWrite(this,e):Promise.reject(TypeError(`Invalid this`))}get[Symbol.toStringTag](){return`WritableStreamDefaultWriter`}},WritableStreamDefaultController=class{[$]=`WritableStreamDefaultController`;[Q];constructor(e){if(e!==Hn)throw TypeError(`Illegal constructor`)}[zn](e){let t=this[Q].abortAlgorithm(e);return writableStreamDefaultControllerClearAlgorithms(this),t}[Vn](){resetQueue(this)}get signal(){if(!Gn(this))throw TypeError(`Invalid this`);return this[Q].abortController.signal}error(e){if(!Gn(this))throw TypeError(`Invalid this`);this[Q].stream[Q].state===`writable`&&writableStreamDefaultControllerError(this,e)}get[Symbol.toStringTag](){return`WritableStreamDefaultController`}};const Un=isBrandCheck(`WritableStream`),Wn=isBrandCheck(`WritableStreamDefaultWriter`),Gn=isBrandCheck(`WritableStreamDefaultController`);function createEmptyPromiseRecord(){return{promise:void 0,resolve:void 0,reject:void 0}}function createWritableStreamState(){return{close:Promise.withResolvers(),closeRequest:createEmptyPromiseRecord(),inFlightWriteRequest:createEmptyPromiseRecord(),inFlightCloseRequest:createEmptyPromiseRecord(),pendingAbortRequest:{abort:createEmptyPromiseRecord(),reason:void 0,wasAlreadyErroring:!1},backpressure:!1,controller:void 0,state:`writable`,storedError:void 0,writeRequests:[],writer:void 0}}function isWritableStreamLocked(e){return e[Q].writer!==void 0}function setupWritableStreamDefaultWriter(e,t){if(isWritableStreamLocked(t))throw TypeError(`WritableStream is locked`);switch(e[Q].stream=t,t[Q].writer=e,t[Q].state){case`writable`:!writableStreamCloseQueuedOrInFlight(t)&&t[Q].backpressure?e[Q].ready=Promise.withResolvers():e[Q].ready={promise:Promise.resolve(),resolve:void 0,reject:void 0},e[Q].close=Promise.withResolvers();break;case`erroring`:e[Q].ready={promise:Promise.reject(t[Q].storedError),resolve:void 0,reject:void 0},setPromiseHandled(e[Q].ready.promise),e[Q].close=Promise.withResolvers();break;case`closed`:e[Q].ready={promise:Promise.resolve(),resolve:void 0,reject:void 0},e[Q].close={promise:Promise.resolve(),resolve:void 0,reject:void 0};break;default:e[Q].ready={promise:Promise.reject(t[Q].storedError),resolve:void 0,reject:void 0},e[Q].close={promise:Promise.reject(t[Q].storedError),resolve:void 0,reject:void 0},setPromiseHandled(e[Q].ready.promise),setPromiseHandled(e[Q].close.promise)}}function writableStreamAbort(e,t){let{state:n,controller:r}=e[Q];if(n===`closed`||n===`errored`)return Promise.resolve();if(r[Q].abortController.abort(t),e[Q].pendingAbortRequest.abort.promise!==void 0)return e[Q].pendingAbortRequest.abort.promise;let i=!1;n===`erroring`&&(i=!0,t=void 0);let a=Promise.withResolvers();return e[Q].pendingAbortRequest={abort:a,reason:t,wasAlreadyErroring:i},i||writableStreamStartErroring(e,t),a.promise}function writableStreamClose(e){let{state:t,writer:n,backpressure:r,controller:i}=e[Q];if(t===`closed`||t===`errored`)return Promise.reject(TypeError(`WritableStream is closed`));e[Q].closeRequest=Promise.withResolvers();let{promise:a}=e[Q].closeRequest;return n!==void 0&&r&&t===`writable`&&n[Q].ready.resolve?.(),writableStreamDefaultControllerClose(i),a}function writableStreamUpdateBackpressure(e,t){let{writer:n}=e[Q];n!==void 0&&e[Q].backpressure!==t&&(t?n[Q].ready=Promise.withResolvers():n[Q].ready.resolve?.()),e[Q].backpressure=t}function writableStreamStartErroring(e,t){let{controller:n,writer:r}=e[Q];e[Q].state=`erroring`,e[Q].storedError=t,r!==void 0&&writableStreamDefaultWriterEnsureReadyPromiseRejected(r,t),!writableStreamHasOperationMarkedInFlight(e)&&n[Q].started&&writableStreamFinishErroring(e)}function writableStreamRejectCloseAndClosedPromiseIfNeeded(e){e[Q].closeRequest.promise!==void 0&&(e[Q].closeRequest.reject?.(e[Q].storedError),e[Q].closeRequest={promise:void 0,resolve:void 0,reject:void 0}),setPromiseHandled(e[Q].close.promise),e[Q].close.reject?.(e[Q].storedError);let{writer:t}=e[Q];t!==void 0&&(setPromiseHandled(t[Q].close.promise),t[Q].close.reject?.(e[Q].storedError))}function writableStreamMarkFirstWriteRequestInFlight(e){let t=e[Q].writeRequests.shift();e[Q].inFlightWriteRequest=t}function writableStreamMarkCloseRequestInFlight(e){e[Q].inFlightCloseRequest=e[Q].closeRequest,e[Q].closeRequest={promise:void 0,resolve:void 0,reject:void 0}}function writableStreamHasOperationMarkedInFlight(e){return e[Q].inFlightWriteRequest.promise!==void 0||e[Q].inFlightCloseRequest.promise!==void 0}function writableStreamFinishInFlightWriteWithError(e,t){e[Q].inFlightWriteRequest.reject?.(t),e[Q].inFlightWriteRequest={promise:void 0,resolve:void 0,reject:void 0},writableStreamDealWithRejection(e,t)}function writableStreamFinishInFlightWrite(e){e[Q].inFlightWriteRequest.resolve?.(),e[Q].inFlightWriteRequest={promise:void 0,resolve:void 0,reject:void 0}}function writableStreamFinishInFlightCloseWithError(e,t){e[Q].inFlightCloseRequest.reject?.(t),e[Q].inFlightCloseRequest={promise:void 0,resolve:void 0,reject:void 0},e[Q].pendingAbortRequest.abort.promise!==void 0&&(e[Q].pendingAbortRequest.abort.reject?.(t),e[Q].pendingAbortRequest={abort:{promise:void 0,resolve:void 0,reject:void 0},reason:void 0,wasAlreadyErroring:!1}),writableStreamDealWithRejection(e,t)}function writableStreamFinishInFlightClose(e){e[Q].inFlightCloseRequest.resolve?.(),e[Q].inFlightCloseRequest={promise:void 0,resolve:void 0,reject:void 0},e[Q].state===`erroring`&&(e[Q].storedError=void 0,e[Q].pendingAbortRequest.abort.promise!==void 0&&(e[Q].pendingAbortRequest.abort.resolve?.(),e[Q].pendingAbortRequest={abort:{promise:void 0,resolve:void 0,reject:void 0},reason:void 0,wasAlreadyErroring:!1})),e[Q].state=`closed`,e[Q].writer!==void 0&&e[Q].writer[Q].close.resolve?.(),e[Q].close.resolve?.()}function writableStreamFinishErroring(e){e[Q].state=`errored`,e[Q].controller[Vn]();let t=e[Q].storedError;for(let n of e[Q].writeRequests)n.reject?.(t);if(e[Q].writeRequests=[],e[Q].pendingAbortRequest.abort.promise===void 0){writableStreamRejectCloseAndClosedPromiseIfNeeded(e);return}let n=e[Q].pendingAbortRequest;if(e[Q].pendingAbortRequest={abort:{promise:void 0,resolve:void 0,reject:void 0},reason:void 0,wasAlreadyErroring:!1},n.wasAlreadyErroring){n.abort.reject?.(t),writableStreamRejectCloseAndClosedPromiseIfNeeded(e);return}e[Q].controller[zn](n.reason).then(()=>{n.abort.resolve?.(),writableStreamRejectCloseAndClosedPromiseIfNeeded(e)},t=>{n.abort.reject?.(t),writableStreamRejectCloseAndClosedPromiseIfNeeded(e)})}function writableStreamDealWithRejection(e,t){if(e[Q].state===`writable`){writableStreamStartErroring(e,t);return}writableStreamFinishErroring(e)}function writableStreamCloseQueuedOrInFlight(e){return e[Q].closeRequest.promise!==void 0||e[Q].inFlightCloseRequest.promise!==void 0}function writableStreamAddWriteRequest(e){let{promise:t,resolve:n,reject:r}=Promise.withResolvers();return e[Q].writeRequests.push({promise:t,resolve:n,reject:r}),t}function writableStreamDefaultWriterWrite(e,t){let{stream:n}=e[Q],{controller:r}=n[Q],i=writableStreamDefaultControllerGetChunkSize(r,t);if(n!==e[Q].stream)return Promise.reject(TypeError(`Mismatched WritableStreams`));let{state:a}=n[Q];if(a===`errored`)return Promise.reject(n[Q].storedError);if(writableStreamCloseQueuedOrInFlight(n)||a===`closed`)return Promise.reject(TypeError(`WritableStream is closed`));if(a===`erroring`)return Promise.reject(n[Q].storedError);let o=writableStreamAddWriteRequest(n);return writableStreamDefaultControllerWrite(r,t,i),o}function writableStreamDefaultWriterRelease(e){let{stream:t}=e[Q],n=TypeError(`Writer has been released`);writableStreamDefaultWriterEnsureReadyPromiseRejected(e,n),writableStreamDefaultWriterEnsureClosedPromiseRejected(e,n),t[Q].writer=void 0,e[Q].stream=void 0}function writableStreamDefaultWriterGetDesiredSize(e){let{stream:t}=e[Q];switch(t[Q].state){case`errored`:case`erroring`:return null;case`closed`:return 0}return writableStreamDefaultControllerGetDesiredSize(t[Q].controller)}function writableStreamDefaultWriterEnsureReadyPromiseRejected(e,t){e[Q].ready.reject?(e[Q].ready.reject(t),e[Q].ready.resolve=void 0,e[Q].ready.reject=void 0):e[Q].ready={promise:Promise.reject(t),resolve:void 0,reject:void 0},setPromiseHandled(e[Q].ready.promise)}function writableStreamDefaultWriterEnsureClosedPromiseRejected(e,t){e[Q].close.reject?(e[Q].close.reject(t),e[Q].close.resolve=void 0,e[Q].close.reject=void 0):e[Q].close={promise:Promise.reject(t),resolve:void 0,reject:void 0},setPromiseHandled(e[Q].close.promise)}function writableStreamDefaultWriterCloseWithErrorPropagation(e){let{stream:t}=e[Q],{state:n}=t[Q];return writableStreamCloseQueuedOrInFlight(t)||n===`closed`?Promise.resolve():n===`errored`?Promise.reject(t[Q].storedError):writableStreamDefaultWriterClose(e)}function writableStreamDefaultWriterClose(e){return writableStreamClose(e[Q].stream)}function writableStreamDefaultWriterAbort(e,t){return writableStreamAbort(e[Q].stream,t)}function writableStreamDefaultControllerWrite(e,t,n){try{enqueueValueWithSize(e,t,n)}catch(t){writableStreamDefaultControllerErrorIfNeeded(e,t);return}let{stream:r}=e[Q];!writableStreamCloseQueuedOrInFlight(r)&&r[Q].state===`writable`&&writableStreamUpdateBackpressure(r,writableStreamDefaultControllerGetBackpressure(e)),writableStreamDefaultControllerAdvanceQueueIfNeeded(e)}function writableStreamDefaultControllerProcessWrite(e,t){let{stream:n,writeAlgorithm:r}=e[Q];writableStreamMarkFirstWriteRequestInFlight(n),r(t,e).then(()=>{writableStreamFinishInFlightWrite(n);let{state:t}=n[Q];dequeueValue(e),!writableStreamCloseQueuedOrInFlight(n)&&t===`writable`&&writableStreamUpdateBackpressure(n,writableStreamDefaultControllerGetBackpressure(e)),writableStreamDefaultControllerAdvanceQueueIfNeeded(e)},t=>{n[Q].state===`writable`&&writableStreamDefaultControllerClearAlgorithms(e),writableStreamFinishInFlightWriteWithError(n,t)})}function writableStreamDefaultControllerProcessClose(e){let{closeAlgorithm:t,stream:n}=e[Q];writableStreamMarkCloseRequestInFlight(n),dequeueValue(e);let r=t();writableStreamDefaultControllerClearAlgorithms(e),r.then(()=>writableStreamFinishInFlightClose(n),e=>writableStreamFinishInFlightCloseWithError(n,e))}function writableStreamDefaultControllerGetDesiredSize(e){return e[Q].highWaterMark-e[Q].queueTotalSize}function writableStreamDefaultControllerGetChunkSize(e,t){let{sizeAlgorithm:n}=e[Q];if(n===void 0)return 1;try{return n(t)}catch(t){return writableStreamDefaultControllerErrorIfNeeded(e,t),1}}function writableStreamDefaultControllerErrorIfNeeded(e,t){e[Q].stream[Q].state===`writable`&&writableStreamDefaultControllerError(e,t)}function writableStreamDefaultControllerError(e,t){writableStreamDefaultControllerClearAlgorithms(e),writableStreamStartErroring(e[Q].stream,t)}function writableStreamDefaultControllerClose(e){enqueueValueWithSize(e,Bn,0),writableStreamDefaultControllerAdvanceQueueIfNeeded(e)}function writableStreamDefaultControllerClearAlgorithms(e){e[Q].writeAlgorithm=void 0,e[Q].closeAlgorithm=void 0,e[Q].abortAlgorithm=void 0,e[Q].sizeAlgorithm=void 0}function writableStreamDefaultControllerGetBackpressure(e){return writableStreamDefaultControllerGetDesiredSize(e)<=0}function writableStreamDefaultControllerAdvanceQueueIfNeeded(e){let{queue:t,started:n,stream:r}=e[Q];if(!n||r[Q].inFlightWriteRequest.promise!==void 0)return;if(r[Q].state===`erroring`){writableStreamFinishErroring(r);return}if(!t.length)return;let i=peekQueueValue(e);i===Bn?writableStreamDefaultControllerProcessClose(e):writableStreamDefaultControllerProcessWrite(e,i)}function setupWritableStreamDefaultControllerFromSink(e,t,n,r){let i=new WritableStreamDefaultController(Hn),a=t?.start,o=t?.write,s=t?.close,c=t?.abort;setupWritableStreamDefaultController(e,i,a?a.bind(t,i):nonOpStart,o?createPromiseCallback(`sink.write`,o,t):nonOpWrite,s?createPromiseCallback(`sink.close`,s,t):nonOpCancel,c?createPromiseCallback(`sink.abort`,c,t):nonOpCancel,n,r)}function setupWritableStreamDefaultController(e,t,n,r,i,a,o,s){t[Q]={abortAlgorithm:a,closeAlgorithm:i,highWaterMark:o,queue:[],queueTotalSize:0,abortController:new Rn,sizeAlgorithm:s,started:!1,stream:e,writeAlgorithm:r},e[Q].controller=t,writableStreamUpdateBackpressure(e,writableStreamDefaultControllerGetBackpressure(t));let c=n();new Promise(e=>e(c)).then(()=>{t[Q].started=!0,writableStreamDefaultControllerAdvanceQueueIfNeeded(t)},n=>{t[Q].started=!0,writableStreamDealWithRejection(e,n)})}function createWritableStream(e,t,n,r,i=1,a=()=>1){let o=Object.create(WritableStream.prototype);return o[$]=`WritableStream`,o[Q]=createWritableStreamState(),setupWritableStreamDefaultController(o,new WritableStreamDefaultController(Hn),e,t,n,r,i,a),o}L();const Kn=Symbol(`kCancel`),qn=Symbol(`kClose`),Jn=Symbol(`kChunk`),Yn=Symbol(`kError`),Xn=Symbol(`kPull`),Zn=Symbol(`kRelease`),Qn=Symbol(`kSkipThrow`);let $n,er;function lazyReadableReleasedError(){return $n||($n=TypeError(`Reader released`),$n)}function lazyReadableReleasingError(){return er||(er=TypeError(`Releasing reader`),er)}function createAbortError(){if(typeof globalThis.DOMException==`function`)return new DOMException(`The operation was aborted`,`AbortError`);let e=Error(`The operation was aborted`);return e.name=`AbortError`,e}function createReadableStreamState(){return{disturbed:!1,reader:void 0,state:`readable`,storedError:void 0,controller:void 0,closedPromise:Promise.withResolvers()}}var ReadableStream$1=class{static{__name(this,`ReadableStream`)}[$]=`ReadableStream`;[Q];constructor(e={},t={}){if(e!=null&&typeof e!=`object`)throw TypeError(`source must be an object`);if(t!=null&&typeof t!=`object`)throw TypeError(`strategy must be an object`);this[Q]=createReadableStreamState();let n=t?.size,r=t?.highWaterMark,i=e?.type;if(i!==void 0){if(`${i}`==`bytes`){if(n!==void 0)throw RangeError(`strategy.size must not be set for a byte stream`);setupReadableByteStreamControllerFromSource(this,e,extractHighWaterMark(r,0));return}throw RangeError(`Invalid type: ${i}`)}setupReadableStreamDefaultControllerFromSource(this,e,extractHighWaterMark(r,1),extractSizeAlgorithm(n))}get locked(){if(!tr(this))throw TypeError(`Invalid this`);return isReadableStreamLocked(this)}static from(e){return readableStreamFromIterable(e)}cancel(e=void 0){return tr(this)?isReadableStreamLocked(this)?Promise.reject(TypeError(`ReadableStream is locked`)):readableStreamCancel(this,e):Promise.reject(TypeError(`Invalid this`))}getReader(e={}){if(!tr(this))throw TypeError(`Invalid this`);if(e!=null&&typeof e!=`object`)throw TypeError(`options must be an object`);let t=e?.mode;if(t===void 0)return new ReadableStreamDefaultReader(this);if(`${t}`==`byob`)return new ReadableStreamBYOBReader(this);throw RangeError(`Invalid mode: ${t}`)}pipeThrough(e,t={}){if(!tr(this))throw TypeError(`Invalid this`);let n=e?.readable;if(!tr(n))throw TypeError(`transform.readable must be a ReadableStream`);let r=e?.writable;if(!Un(r))throw TypeError(`transform.writable must be a WritableStream`);if(t!=null&&typeof t!=`object`)throw TypeError(`options must be an object`);let i=t?.preventAbort,a=t?.preventCancel,o=t?.preventClose,s=t?.signal;if(s!==void 0&&!(s instanceof Object&&`aborted`in s))throw TypeError(`options.signal must be an AbortSignal`);if(isReadableStreamLocked(this))throw TypeError(`The ReadableStream is locked`);if(isWritableStreamLocked(r))throw TypeError(`The WritableStream is locked`);return setPromiseHandled(readableStreamPipeTo(this,r,!!o,!!i,!!a,s)),n}pipeTo(e,t={}){try{if(!tr(this))throw TypeError(`Invalid this`);if(!Un(e))throw TypeError(`destination must be a WritableStream`);if(t!=null&&typeof t!=`object`)throw TypeError(`options must be an object`);let n=t?.preventAbort,r=t?.preventCancel,i=t?.preventClose,a=t?.signal;if(a!==void 0&&!(a instanceof Object&&`aborted`in a))throw TypeError(`options.signal must be an AbortSignal`);if(isReadableStreamLocked(this))throw TypeError(`The ReadableStream is locked`);if(isWritableStreamLocked(e))throw TypeError(`The WritableStream is locked`);return readableStreamPipeTo(this,e,!!i,!!n,!!r,a)}catch(e){return Promise.reject(e)}}tee(){if(!tr(this))throw TypeError(`Invalid this`);let e=this[Q].controller;return ir(e)?readableByteStreamTee(this):readableStreamDefaultTee(this,!1)}values(e={}){if(!tr(this))throw TypeError(`Invalid this`);if(e!=null&&typeof e!=`object`)throw TypeError(`options must be an object`);let t=!!e?.preventCancel,n=new ReadableStreamDefaultReader(this),r={done:!1,current:void 0},i=!1;function nextSteps(){if(r.done)return Promise.resolve({done:!0,value:void 0});if(n[Q].stream===void 0)return Promise.reject(TypeError(`The reader is not bound to a ReadableStream`));let{promise:e,resolve:t,reject:i}=Promise.withResolvers();return readableStreamDefaultReaderRead(n,{[Jn](e){r.current=void 0,t({value:e,done:!1})},[qn](){r.current=void 0,r.done=!0,readableStreamReaderGenericRelease(n),t({done:!0,value:void 0})},[Yn](e){r.current=void 0,r.done=!0,readableStreamReaderGenericRelease(n),i(e)}}),e}async function returnSteps(e){if(r.done)return{done:!0,value:e};if(r.done=!0,n[Q].stream===void 0)throw TypeError(`The reader is not bound to a ReadableStream`);if(!t){let t=readableStreamReaderGenericCancel(n,e);return readableStreamReaderGenericRelease(n),await t,{done:!0,value:e}}return readableStreamReaderGenericRelease(n),{done:!0,value:e}}return Object.setPrototypeOf({next(){return i||=(r.current=Promise.resolve(),!0),r.current=r.current===void 0?nextSteps():r.current.then(nextSteps,nextSteps),r.current},return(e){return i=!0,r.current=r.current===void 0?returnSteps(e):r.current.then(()=>returnSteps(e),()=>returnSteps(e)),r.current},[Symbol.asyncIterator](){return this}},Ln)}[Symbol.asyncIterator](){return this.values()}get[Symbol.toStringTag](){return`ReadableStream`}},DefaultReadRequest=class{[Q];constructor(){this[Q]=Promise.withResolvers()}[Jn](e){this[Q].resolve?.({value:e,done:!1})}[qn](){this[Q].resolve?.({value:void 0,done:!0})}[Yn](e){this[Q].reject?.(e)}get promise(){return this[Q].promise}},ReadableStreamDefaultReader=class{[$]=`ReadableStreamDefaultReader`;[Q];constructor(e){if(!tr(e))throw TypeError(`Expected a ReadableStream`);this[Q]={readRequests:[],readIntoRequests:[],stream:void 0,close:{promise:void 0,resolve:void 0,reject:void 0}},setupReadableStreamDefaultReader(this,e)}read(){if(!rr(this))return Promise.reject(TypeError(`Invalid this`));if(this[Q].stream===void 0)return Promise.reject(TypeError(`The reader is not attached to a stream`));let e=this[Q].stream,t=e[Q].controller;if(e[Q].state===`readable`&&nr(t)&&t[Q].queue.length>0){e[Q].disturbed=!0;let n=dequeueValue(t);return t[Q].closeRequested&&!t[Q].queue.length?(readableStreamDefaultControllerClearAlgorithms(t),readableStreamClose(e)):readableStreamDefaultControllerCallPullIfNeeded(t),Promise.resolve({value:n,done:!1})}let n=new DefaultReadRequest;return readableStreamDefaultReaderRead(this,n),n.promise}releaseLock(){if(!rr(this))throw TypeError(`Invalid this`);this[Q].stream!==void 0&&readableStreamDefaultReaderRelease(this)}get closed(){return rr(this)?this[Q].close.promise:Promise.reject(TypeError(`Invalid this`))}cancel(e=void 0){return rr(this)?this[Q].stream===void 0?Promise.reject(TypeError(`The reader is not attached to a stream`)):readableStreamReaderGenericCancel(this,e):Promise.reject(TypeError(`Invalid this`))}get[Symbol.toStringTag](){return`ReadableStreamDefaultReader`}},ReadableStreamDefaultController=class{[$]=`ReadableStreamDefaultController`;[Q];constructor(e){if(e!==Qn)throw TypeError(`Illegal constructor`)}get desiredSize(){return readableStreamDefaultControllerGetDesiredSize(this)}close(){if(!readableStreamDefaultControllerCanCloseOrEnqueue(this))throw TypeError(`Controller is already closed`);readableStreamDefaultControllerClose(this)}enqueue(e=void 0){if(!readableStreamDefaultControllerCanCloseOrEnqueue(this))throw TypeError(`Controller is already closed`);readableStreamDefaultControllerEnqueue(this,e)}error(e=void 0){readableStreamDefaultControllerError(this,e)}[Kn](e){return readableStreamDefaultControllerCancelSteps(this,e)}[Xn](e){readableStreamDefaultControllerPullSteps(this,e)}[Zn](){}get[Symbol.toStringTag](){return`ReadableStreamDefaultController`}};const tr=isBrandCheck(`ReadableStream`),nr=isBrandCheck(`ReadableStreamDefaultController`),rr=isBrandCheck(`ReadableStreamDefaultReader`);function isReadableStreamLocked(e){return e[Q].reader!==void 0}function readableStreamCancel(e,t){switch(e[Q].disturbed=!0,e[Q].state){case`closed`:return Promise.resolve();case`errored`:return Promise.reject(e[Q].storedError)}readableStreamClose(e);let n=e[Q].reader;if(n!==void 0&&readableStreamHasBYOBReader(e)){let e=n[Q].readIntoRequests;n[Q].readIntoRequests=[];for(let t=0;t<e.length;t++)e[t][qn](void 0)}return e[Q].controller[Kn](t).then(()=>{})}function readableStreamClose(e){e[Q].state=`closed`,e[Q].closedPromise.resolve();let{reader:t}=e[Q];if(t!==void 0&&(t[Q].close.resolve?.(),readableStreamHasDefaultReader(e))){for(let e=0;e<t[Q].readRequests.length;e++)t[Q].readRequests[e][qn]();t[Q].readRequests=[]}}function readableStreamError(e,t){e[Q].state=`errored`,e[Q].storedError=t,setPromiseHandled(e[Q].closedPromise.promise),e[Q].closedPromise.reject(t);let{reader:n}=e[Q];if(n!==void 0){if(setPromiseHandled(n[Q].close.promise),n[Q].close.reject?.(t),readableStreamHasDefaultReader(e)){for(let e=0;e<n[Q].readRequests.length;e++)n[Q].readRequests[e][Yn](t);n[Q].readRequests=[]}else if(readableStreamHasBYOBReader(e)){for(let e=0;e<n[Q].readIntoRequests.length;e++)n[Q].readIntoRequests[e][Yn](t);n[Q].readIntoRequests=[]}}}function readableStreamHasDefaultReader(e){let{reader:t}=e[Q];return t===void 0?!1:t[Q]!==void 0&&t[$]===`ReadableStreamDefaultReader`}function readableStreamGetNumReadRequests(e){return e[Q].reader[Q].readRequests.length}function readableStreamFulfillReadRequest(e,t,n){let{reader:r}=e[Q],i=r[Q].readRequests.shift();n?i[qn]():i[Jn](t)}function readableStreamAddReadRequest(e,t){e[Q].reader[Q].readRequests.push(t)}function readableStreamReaderGenericCancel(e,t){let{stream:n}=e[Q];return readableStreamCancel(n,t)}function readableStreamReaderGenericInitialize(e,t){switch(e[Q].stream=t,t[Q].reader=e,t[Q].state){case`readable`:e[Q].close=Promise.withResolvers();break;case`closed`:e[Q].close={promise:Promise.resolve(),resolve:void 0,reject:void 0};break;case`errored`:e[Q].close={promise:Promise.reject(t[Q].storedError),resolve:void 0,reject:void 0},setPromiseHandled(e[Q].close.promise);break}}function readableStreamReaderGenericRelease(e){let{stream:t}=e[Q],n=lazyReadableReleasedError();t[Q].state===`readable`?e[Q].close.reject?.(n):e[Q].close={promise:Promise.reject(n),resolve:void 0,reject:void 0},setPromiseHandled(e[Q].close.promise),t[Q].controller[Zn](),t[Q].reader=void 0,e[Q].stream=void 0}function readableStreamDefaultReaderRelease(e){readableStreamReaderGenericRelease(e),readableStreamDefaultReaderErrorReadRequests(e,lazyReadableReleasingError())}function readableStreamDefaultReaderErrorReadRequests(e,t){for(let n=0;n<e[Q].readRequests.length;++n)e[Q].readRequests[n][Yn](t);e[Q].readRequests=[]}function readableStreamDefaultReaderRead(e,t){let{stream:n}=e[Q];switch(n[Q].disturbed=!0,n[Q].state){case`closed`:t[qn]();break;case`errored`:t[Yn](n[Q].storedError);break;case`readable`:n[Q].controller[Xn](t);break}}function setupReadableStreamDefaultReader(e,t){if(isReadableStreamLocked(t))throw TypeError(`ReadableStream is locked`);readableStreamReaderGenericInitialize(e,t),e[Q].readRequests=[]}function readableStreamDefaultControllerClose(e){readableStreamDefaultControllerCanCloseOrEnqueue(e)&&(e[Q].closeRequested=!0,e[Q].queue.length||(readableStreamDefaultControllerClearAlgorithms(e),readableStreamClose(e[Q].stream)))}function readableStreamDefaultControllerEnqueue(e,t){if(!readableStreamDefaultControllerCanCloseOrEnqueue(e))return;let{stream:n}=e[Q];if(isReadableStreamLocked(n)&&readableStreamGetNumReadRequests(n))readableStreamFulfillReadRequest(n,t,!1);else try{enqueueValueWithSize(e,t,e[Q].sizeAlgorithm(t))}catch(t){throw readableStreamDefaultControllerError(e,t),t}readableStreamDefaultControllerCallPullIfNeeded(e)}function readableStreamDefaultControllerCanCloseOrEnqueue(e){let{stream:t}=e[Q];return!e[Q].closeRequested&&t[Q].state===`readable`}function readableStreamDefaultControllerGetDesiredSize(e){let{stream:t,highWaterMark:n,queueTotalSize:r}=e[Q];switch(t[Q].state){case`errored`:return null;case`closed`:return 0;default:return n-r}}function readableStreamDefaultControllerHasBackpressure(e){return!readableStreamDefaultControllerShouldCallPull(e)}function readableStreamDefaultControllerShouldCallPull(e){let{stream:t}=e[Q];if(!readableStreamDefaultControllerCanCloseOrEnqueue(e)||!e[Q].started)return!1;if(isReadableStreamLocked(t)&&readableStreamGetNumReadRequests(t))return!0;let n=readableStreamDefaultControllerGetDesiredSize(e);return n!==null&&n>0}function readableStreamDefaultControllerCallPullIfNeeded(e){if(readableStreamDefaultControllerShouldCallPull(e)){if(e[Q].pulling){e[Q].pullAgain=!0;return}e[Q].pulling=!0,e[Q].pullAlgorithm(e).then(()=>{e[Q].pulling=!1,e[Q].pullAgain&&(e[Q].pullAgain=!1,readableStreamDefaultControllerCallPullIfNeeded(e))},t=>readableStreamDefaultControllerError(e,t))}}function readableStreamDefaultControllerClearAlgorithms(e){e[Q].pullAlgorithm=void 0,e[Q].cancelAlgorithm=void 0,e[Q].sizeAlgorithm=void 0}function readableStreamDefaultControllerError(e,t){let{stream:n}=e[Q];n[Q].state===`readable`&&(resetQueue(e),readableStreamDefaultControllerClearAlgorithms(e),readableStreamError(n,t))}function readableStreamDefaultControllerCancelSteps(e,t){resetQueue(e);let n=e[Q].cancelAlgorithm?.(t)??Promise.resolve();return readableStreamDefaultControllerClearAlgorithms(e),n}function readableStreamDefaultControllerPullSteps(e,t){let{stream:n,queue:r}=e[Q];if(r.length){let i=dequeueValue(e);e[Q].closeRequested&&!r.length?(readableStreamDefaultControllerClearAlgorithms(e),readableStreamClose(n)):readableStreamDefaultControllerCallPullIfNeeded(e),t[Jn](i);return}readableStreamAddReadRequest(n,t),readableStreamDefaultControllerCallPullIfNeeded(e)}function setupReadableStreamDefaultController(e,t,n,r,i,a,o){t[Q]={cancelAlgorithm:i,closeRequested:!1,highWaterMark:a,pullAgain:!1,pullAlgorithm:r,pulling:!1,queue:[],queueTotalSize:0,started:!1,sizeAlgorithm:o,stream:e},e[Q].controller=t;let s=n();new Promise(e=>e(s)).then(()=>{t[Q].started=!0,readableStreamDefaultControllerCallPullIfNeeded(t)},e=>readableStreamDefaultControllerError(t,e))}function setupReadableStreamDefaultControllerFromSource(e,t,n,r){let i=new ReadableStreamDefaultController(Qn),a=t?.start,o=t?.pull,s=t?.cancel;setupReadableStreamDefaultController(e,i,a?a.bind(t,i):nonOpStart,o?createPromiseCallback(`source.pull`,o,t):nonOpPull,s?createPromiseCallback(`source.cancel`,s,t):nonOpCancel,n,r)}function createReadableStream(e,t,n,r=1,i=()=>1){let a=Object.create(ReadableStream$1.prototype);return a[$]=`ReadableStream`,a[Q]=createReadableStreamState(),setupReadableStreamDefaultController(a,new ReadableStreamDefaultController(Qn),e,t,n,r,i),a}function readableStreamFromIterable(e){let t,n=getIterator(e,`async`),r=nonOpStart;async function pullAlgorithm(){let e=iteratorNext(n);return Promise.resolve(e).then(e=>{if(typeof e!=`object`||!e)throw TypeError(`The promise returned by the iterator.next() method must fulfill with an object`);e.done?readableStreamDefaultControllerClose(t[Q].controller):readableStreamDefaultControllerEnqueue(t[Q].controller,e.value)})}async function cancelAlgorithm(e){let t=n.iterator,r=t.return;if(r===void 0)return Promise.resolve();let i=r.call(t,e);return Promise.resolve(i).then(e=>{if(typeof e!=`object`||!e)throw TypeError(`The promise returned by the iterator.return() method must fulfill with an object`)})}return t=createReadableStream(r,pullAlgorithm,cancelAlgorithm,0),t}function readableStreamPipeTo(e,t,n,r,i,a){let o,s;try{o=new ReadableStreamDefaultReader(e),s=new WritableStreamDefaultWriter(t)}catch(e){return Promise.reject(e)}e[Q].disturbed=!0;let c=!1,{promise:l,resolve:u,reject:d}=Promise.withResolvers(),p={currentWrite:Promise.resolve()},m;function finalize(e,t){writableStreamDefaultWriterRelease(s),readableStreamReaderGenericRelease(o),a!==void 0&&m&&(a.removeEventListener(`abort`,m),m=void 0),e?d(t):u()}async function waitForCurrentWrite(){let e=p.currentWrite;await e,e!==p.currentWrite&&await waitForCurrentWrite()}function shutdownWithAnAction(e,n,r){if(c)return;if(c=!0,t[Q].state===`writable`&&!writableStreamCloseQueuedOrInFlight(t)){waitForCurrentWrite().then(complete,e=>finalize(!0,e));return}complete();function complete(){e().then(()=>finalize(!!n,r),e=>finalize(!0,e))}}function shutdown(e,n){if(!c){if(c=!0,t[Q].state===`writable`&&!writableStreamCloseQueuedOrInFlight(t)){waitForCurrentWrite().then(()=>finalize(!!e,n),e=>finalize(!0,e));return}finalize(!!e,n)}}function abortAlgorithm(){let n;n=a.reason&&a.reason.name===`AbortError`?createAbortError():a.reason;let o=[];r||o.push(()=>t[Q].state===`writable`?writableStreamAbort(t,n):Promise.resolve()),i||o.push(()=>e[Q].state===`readable`?readableStreamCancel(e,n):Promise.resolve()),shutdownWithAnAction(()=>Promise.all(o.map(e=>e())).then(()=>void 0),!0,n)}function watchErrored(e,t,n){e[Q].state===`errored`?n(e[Q].storedError):t.then(void 0,n)}function watchClosed(e,t,n){e[Q].state===`closed`?n():t.then(n,()=>{})}class PipeToReadRequest{[Jn](e){ge(()=>{p.currentWrite=writableStreamDefaultWriterWrite(s,e),setPromiseHandled(p.currentWrite),h.resolve(!1)})}[qn](){h.resolve(!0)}[Yn](e){h.reject(e)}}let h={resolve:null,reject:null};async function step(){if(c||t[Q].backpressure&&(await s[Q].ready.promise,c))return!0;let n=e[Q].controller;if(e[Q].state===`readable`&&nr(n)&&n[Q].queue.length>0){for(;n[Q].queue.length>0;){if(c)return!0;let r=dequeueValue(n);if(n[Q].closeRequested&&!n[Q].queue.length&&(readableStreamDefaultControllerClearAlgorithms(n),readableStreamClose(e)),p.currentWrite=writableStreamDefaultWriterWrite(s,r),setPromiseHandled(p.currentWrite),t[Q].backpressure||t[Q].state!==`writable`||writableStreamCloseQueuedOrInFlight(t))break}return readableStreamDefaultControllerCallPullIfNeeded(n),e[Q].state===`closed`}let{promise:r,resolve:i,reject:a}=Promise.withResolvers();return h={resolve:i,reject:a},readableStreamDefaultReaderRead(o,new PipeToReadRequest),r}async function run(){for(;!await step(););}if(a!==void 0){if(a.aborted)return abortAlgorithm(),l;m=abortAlgorithm,a.addEventListener(`abort`,m,{once:!0})}if(setPromiseHandled(run()),watchErrored(e,o[Q].close.promise,e=>{if(!r)return shutdownWithAnAction(()=>writableStreamAbort(t,e),!0,e);shutdown(!0,e)}),watchErrored(t,s[Q].close.promise,t=>{if(!i)return shutdownWithAnAction(()=>readableStreamCancel(e,t),!0,t);shutdown(!0,t)}),watchClosed(e,o[Q].close.promise,()=>{if(!n)return shutdownWithAnAction(()=>writableStreamDefaultWriterCloseWithErrorPropagation(s));shutdown()}),writableStreamCloseQueuedOrInFlight(t)||t[Q].state===`closed`){let t=TypeError(`Destination WritableStream is closed`);i?shutdown(!0,t):shutdownWithAnAction(()=>readableStreamCancel(e,t),!0,t)}return l}function readableStreamDefaultTee(e,t){let n=new ReadableStreamDefaultReader(e),r=!1,i=!1,a=!1,o,s,c,l,u=Promise.withResolvers();async function pullAlgorithm(){r||(r=!0,readableStreamDefaultReaderRead(n,{[Jn](e){ge(()=>{r=!1;let n=e,o=e;if(!a&&t)try{o=structuredClone(o)}catch{}i||readableStreamDefaultControllerEnqueue(c[Q].controller,n),a||readableStreamDefaultControllerEnqueue(l[Q].controller,o)})},[qn](){ge(()=>{r=!1,i||readableStreamDefaultControllerClose(c[Q].controller),a||readableStreamDefaultControllerClose(l[Q].controller),(!i||!a)&&u.resolve(void 0)})},[Yn](){r=!1}}))}function cancel1Algorithm(t){if(i=!0,o=t,a){let t=[o,s];u.resolve(readableStreamCancel(e,t))}return u.promise}function cancel2Algorithm(t){if(a=!0,s=t,i){let t=[o,s];u.resolve(readableStreamCancel(e,t))}return u.promise}return c=createReadableStream(nonOpStart,pullAlgorithm,cancel1Algorithm),l=createReadableStream(nonOpStart,pullAlgorithm,cancel2Algorithm),n[Q].close.promise.then(void 0,e=>{readableStreamDefaultControllerError(c[Q].controller,e),readableStreamDefaultControllerError(l[Q].controller,e),(!i||!a)&&u.resolve(void 0)}),[c,l]}var BYOBReadIntoRequest=class{[Q];constructor(){this[Q]=Promise.withResolvers()}[Jn](e){this[Q].resolve?.({value:e,done:!1})}[qn](e){this[Q].resolve?.({value:e,done:!0})}[Yn](e){this[Q].reject?.(e)}get promise(){return this[Q].promise}},ReadableStreamBYOBReader=class{[$]=`ReadableStreamBYOBReader`;[Q];constructor(e){if(!tr(e))throw TypeError(`Expected a ReadableStream`);this[Q]={readRequests:[],readIntoRequests:[],stream:void 0,close:{promise:void 0,resolve:void 0,reject:void 0}},setupReadableStreamBYOBReader(this,e)}read(e,t={}){if(!ar(this))return Promise.reject(TypeError(`Invalid this`));if(typeof e!=`object`||!e||!ArrayBuffer.isView(e))return Promise.reject(TypeError(`view must be an ArrayBufferView`));let n=e.buffer,r=e.byteLength;if(r===0)return Promise.reject(TypeError(`view must have non-zero byteLength`));if(n.byteLength===0)return isDetachedBuffer(n)?Promise.reject(TypeError(`view's buffer has been detached`)):Promise.reject(TypeError(`view's buffer must have non-zero byteLength`));let i=t?.min??1;if(typeof i!=`number`||i<1||!Number.isInteger(i)||Number.isNaN(i))return Promise.reject(TypeError(`options.min must be a positive integer`));let a=e[Symbol.toStringTag];if(a!==void 0&&a!==`DataView`){if(i>e.length)return Promise.reject(RangeError(`options.min must be smaller or equal to view size`))}else if(i>r)return Promise.reject(RangeError(`options.min must be smaller or equal to view size`));if(this[Q].stream===void 0)return Promise.reject(TypeError(`Reader has no associated stream`));let o=new BYOBReadIntoRequest;return readableStreamBYOBReaderRead(this,e,i,o),o.promise}releaseLock(){if(!ar(this))throw TypeError(`Invalid this`);this[Q].stream!==void 0&&readableStreamBYOBReaderRelease(this)}get closed(){return ar(this)?this[Q].close.promise:Promise.reject(TypeError(`Invalid this`))}cancel(e=void 0){return ar(this)?this[Q].stream===void 0?Promise.reject(TypeError(`Reader has no associated stream`)):readableStreamReaderGenericCancel(this,e):Promise.reject(TypeError(`Invalid this`))}get[Symbol.toStringTag](){return`ReadableStreamBYOBReader`}},ReadableStreamBYOBRequest=class{[$]=`ReadableStreamBYOBRequest`;[Q];constructor(e){if(e!==Qn)throw TypeError(`Illegal constructor`)}get view(){if(!or(this))throw TypeError(`Invalid this`);return this[Q].view}respond(e){if(!or(this))throw TypeError(`Invalid this`);if(this[Q].controller===void 0)throw TypeError(`BYOB request has been invalidated`);if(e=+e,!Number.isInteger(e)||e<0||!Number.isFinite(e))throw RangeError(`bytesWritten must be a non-negative integer`);let t=this[Q].view;if(isDetachedBuffer(t.buffer))throw TypeError(`The BYOB request's buffer has been detached`);readableByteStreamControllerRespond(this[Q].controller,e)}respondWithNewView(e){if(!or(this))throw TypeError(`Invalid this`);if(this[Q].controller===void 0)throw TypeError(`BYOB request has been invalidated`);if(typeof e!=`object`||!e||!ArrayBuffer.isView(e))throw TypeError(`view must be an ArrayBufferView`);if(isDetachedBuffer(e.buffer))throw TypeError(`The given view's buffer has been detached`);readableByteStreamControllerRespondWithNewView(this[Q].controller,e)}get[Symbol.toStringTag](){return`ReadableStreamBYOBRequest`}},ReadableByteStreamController=class{[$]=`ReadableByteStreamController`;[Q];constructor(e){if(e!==Qn)throw TypeError(`Illegal constructor`)}get byobRequest(){if(!ir(this))throw TypeError(`Invalid this`);return readableByteStreamControllerGetBYOBRequest(this)}get desiredSize(){if(!ir(this))throw TypeError(`Invalid this`);return readableByteStreamControllerGetDesiredSize(this)}close(){if(!ir(this))throw TypeError(`Invalid this`);if(this[Q].closeRequested)throw TypeError(`Close already requested`);if(this[Q].stream[Q].state!==`readable`)throw TypeError(`Stream is not in a readable state`);readableByteStreamControllerClose(this)}enqueue(e){if(!ir(this))throw TypeError(`Invalid this`);if(typeof e!=`object`||!e||!ArrayBuffer.isView(e))throw TypeError(`chunk must be an ArrayBufferView`);if(e.byteLength===0)throw TypeError(`chunk length must be non-zero`);if(e.buffer.byteLength===0)throw TypeError(`chunk's buffer length must be non-zero`);if(this[Q].closeRequested)throw TypeError(`Cannot enqueue after close has been requested`);if(this[Q].stream[Q].state!==`readable`)throw TypeError(`Stream is not in a readable state`);readableByteStreamControllerEnqueue(this,e)}error(e=void 0){if(!ir(this))throw TypeError(`Invalid this`);readableByteStreamControllerError(this,e)}[Kn](e){return readableByteStreamControllerCancelSteps(this,e)}[Xn](e){readableByteStreamControllerPullSteps(this,e)}[Zn](){if(this[Q].pendingPullIntos.length>0){let e=this[Q].pendingPullIntos[0];e.readerType=`none`,this[Q].pendingPullIntos=[e]}}get[Symbol.toStringTag](){return`ReadableByteStreamController`}};const ir=isBrandCheck(`ReadableByteStreamController`),ar=isBrandCheck(`ReadableStreamBYOBReader`),or=isBrandCheck(`ReadableStreamBYOBRequest`);function readableStreamHasBYOBReader(e){let{reader:t}=e[Q];return t===void 0?!1:t[Q]!==void 0&&t[$]===`ReadableStreamBYOBReader`}function readableStreamGetNumReadIntoRequests(e){return e[Q].reader[Q].readIntoRequests.length}function readableStreamAddReadIntoRequest(e,t){e[Q].reader[Q].readIntoRequests.push(t)}function readableStreamFulfillReadIntoRequest(e,t,n){let{reader:r}=e[Q],i=r[Q].readIntoRequests.shift();n?i[qn](t):i[Jn](t)}function setupReadableStreamBYOBReader(e,t){if(isReadableStreamLocked(t))throw TypeError(`ReadableStream is locked`);if(!ir(t[Q].controller))throw TypeError(`Cannot use a BYOB reader with a non-byte stream`);readableStreamReaderGenericInitialize(e,t),e[Q].readIntoRequests=[]}function readableStreamBYOBReaderRead(e,t,n,r){let{stream:i}=e[Q];i[Q].disturbed=!0,i[Q].state===`errored`?r[Yn](i[Q].storedError):readableByteStreamControllerPullInto(i[Q].controller,t,n,r)}function readableStreamBYOBReaderRelease(e){readableStreamReaderGenericRelease(e);let t=TypeError(`Reader was released`);for(let n=0;n<e[Q].readIntoRequests.length;n++)e[Q].readIntoRequests[n][Yn](t);e[Q].readIntoRequests=[]}function readableByteStreamControllerClearAlgorithms(e){e[Q].pullAlgorithm=void 0,e[Q].cancelAlgorithm=void 0}function readableByteStreamControllerClearPendingPullIntos(e){readableByteStreamControllerInvalidateBYOBRequest(e),e[Q].pendingPullIntos=[]}function readableByteStreamControllerInvalidateBYOBRequest(e){let t=e[Q].byobRequest;t!=null&&(t[Q].controller=void 0,t[Q].view=null,e[Q].byobRequest=null)}function readableByteStreamControllerError(e,t){let{stream:n}=e[Q];n[Q].state===`readable`&&(readableByteStreamControllerClearPendingPullIntos(e),resetQueue(e),readableByteStreamControllerClearAlgorithms(e),readableStreamError(n,t))}function readableByteStreamControllerGetDesiredSize(e){let t=e[Q].stream[Q].state;return t===`errored`?null:t===`closed`?0:e[Q].highWaterMark-e[Q].queueTotalSize}function readableByteStreamControllerShouldCallPull(e){let{stream:t}=e[Q];if(t[Q].state!==`readable`||e[Q].closeRequested||!e[Q].started)return!1;if(readableStreamHasDefaultReader(t)&&readableStreamGetNumReadRequests(t)>0||readableStreamHasBYOBReader(t)&&readableStreamGetNumReadIntoRequests(t)>0)return!0;let n=readableByteStreamControllerGetDesiredSize(e);return n!==null&&n>0}function readableByteStreamControllerCallPullIfNeeded(e){if(readableByteStreamControllerShouldCallPull(e)){if(e[Q].pulling){e[Q].pullAgain=!0;return}e[Q].pulling=!0,e[Q].pullAlgorithm(e).then(()=>{e[Q].pulling=!1,e[Q].pullAgain&&(e[Q].pullAgain=!1,readableByteStreamControllerCallPullIfNeeded(e))},t=>readableByteStreamControllerError(e,t))}}function readableByteStreamControllerHandleQueueDrain(e){e[Q].queueTotalSize===0&&e[Q].closeRequested?(readableByteStreamControllerClearAlgorithms(e),readableStreamClose(e[Q].stream)):readableByteStreamControllerCallPullIfNeeded(e)}function readableByteStreamControllerEnqueueChunkToQueue(e,t,n,r){e[Q].queue.push({buffer:t,byteOffset:n,byteLength:r}),e[Q].queueTotalSize+=r}function readableByteStreamControllerEnqueueClonedChunkToQueue(e,t,n,r){let i;try{i=t.slice(n,n+r)}catch(t){readableByteStreamControllerError(e,t);return}readableByteStreamControllerEnqueueChunkToQueue(e,i,0,r)}function readableByteStreamControllerEnqueueDetachedPullIntoToQueue(e,t){t.bytesFilled>0&&readableByteStreamControllerEnqueueClonedChunkToQueue(e,t.buffer,t.byteOffset,t.bytesFilled),readableByteStreamControllerShiftPendingPullInto(e)}function readableByteStreamControllerShiftPendingPullInto(e){return e[Q].pendingPullIntos.shift()}function readableByteStreamControllerFillHeadPullIntoDescriptor(e,t,n){n.bytesFilled+=t}function readableByteStreamControllerConvertPullIntoDescriptor(e){let t=e.bytesFilled,n=e.elementSize,r=transferArrayBuffer(e.buffer);return e.buffer=r,new e.viewConstructor(r,e.byteOffset,t/n)}function readableByteStreamControllerCommitPullIntoDescriptor(e,t){let n=!1;e[Q].state===`closed`&&(n=!0);let r=readableByteStreamControllerConvertPullIntoDescriptor(t);t.readerType==="default"?readableStreamFulfillReadRequest(e,r,n):readableStreamFulfillReadIntoRequest(e,r,n)}function readableByteStreamControllerFillPullIntoDescriptorFromQueue(e,t){let n=Math.min(e[Q].queueTotalSize,t.byteLength-t.bytesFilled),r=t.bytesFilled+n,i=n,a=!1,o=r-r%t.elementSize;o>=t.minimumFill&&(i=o-t.bytesFilled,a=!0);let s=e[Q].queue;for(;i>0;){let n=s[0],r=Math.min(i,n.byteLength),a=t.byteOffset+t.bytesFilled,o=new Uint8Array(t.buffer,a,r),c=new Uint8Array(n.buffer,n.byteOffset,r);o.set(c),n.byteLength===r?s.shift():(n.byteOffset+=r,n.byteLength-=r),e[Q].queueTotalSize-=r,readableByteStreamControllerFillHeadPullIntoDescriptor(e,r,t),i-=r}return a}function readableByteStreamControllerFillReadRequestFromQueue(e,t){let n=e[Q].queue.shift();e[Q].queueTotalSize-=n.byteLength,readableByteStreamControllerHandleQueueDrain(e);let r=new Uint8Array(n.buffer,n.byteOffset,n.byteLength);t[Jn](r)}function readableByteStreamControllerProcessReadRequestsUsingQueue(e){let t=e[Q].stream[Q].reader;for(;t[Q].readRequests.length!==0;){if(e[Q].queueTotalSize===0)return;readableByteStreamControllerFillReadRequestFromQueue(e,t[Q].readRequests.shift())}}function readableByteStreamControllerProcessPullIntoDescriptorsUsingQueue(e){for(;e[Q].pendingPullIntos.length!==0;){if(e[Q].queueTotalSize===0)return;let t=e[Q].pendingPullIntos[0];readableByteStreamControllerFillPullIntoDescriptorFromQueue(e,t)&&(readableByteStreamControllerShiftPendingPullInto(e),readableByteStreamControllerCommitPullIntoDescriptor(e[Q].stream,t))}}function readableByteStreamControllerGetBYOBRequest(e){if(e[Q].byobRequest===null&&e[Q].pendingPullIntos.length!==0){let t=e[Q].pendingPullIntos[0],n=new Uint8Array(t.buffer,t.byteOffset+t.bytesFilled,t.byteLength-t.bytesFilled),r=new ReadableStreamBYOBRequest(Qn);r[Q]={controller:e,view:n},e[Q].byobRequest=r}return e[Q].byobRequest}function readableByteStreamControllerEnqueue(e,t){let{stream:n}=e[Q];if(e[Q].closeRequested||n[Q].state!==`readable`)return;let r=t.buffer,i=t.byteLength,a=t.byteOffset;if(isDetachedBuffer(r))throw TypeError(`chunk's buffer is detached`);let o=transferArrayBuffer(r);if(e[Q].pendingPullIntos.length!==0){let t=e[Q].pendingPullIntos[0];if(isDetachedBuffer(t.buffer))throw TypeError(`BYOB request's buffer has been detached`);readableByteStreamControllerInvalidateBYOBRequest(e),t.buffer=transferArrayBuffer(t.buffer),t.readerType===`none`&&readableByteStreamControllerEnqueueDetachedPullIntoToQueue(e,t)}readableStreamHasDefaultReader(n)?(readableByteStreamControllerProcessReadRequestsUsingQueue(e),readableStreamGetNumReadRequests(n)===0?readableByteStreamControllerEnqueueChunkToQueue(e,o,a,i):(e[Q].pendingPullIntos.length!==0&&readableByteStreamControllerShiftPendingPullInto(e),readableStreamFulfillReadRequest(n,new Uint8Array(o,a,i),!1))):readableStreamHasBYOBReader(n)?(readableByteStreamControllerEnqueueChunkToQueue(e,o,a,i),readableByteStreamControllerProcessPullIntoDescriptorsUsingQueue(e)):readableByteStreamControllerEnqueueChunkToQueue(e,o,a,i),readableByteStreamControllerCallPullIfNeeded(e)}function readableByteStreamControllerClose(e){let{stream:t}=e[Q];if(!(e[Q].closeRequested||t[Q].state!==`readable`)){if(e[Q].queueTotalSize>0){e[Q].closeRequested=!0;return}if(e[Q].pendingPullIntos.length!==0){let t=e[Q].pendingPullIntos[0];if(t.bytesFilled%t.elementSize!==0){let t=TypeError(`Insufficient bytes to fill elements in the given buffer`);throw readableByteStreamControllerError(e,t),t}}readableByteStreamControllerClearAlgorithms(e),readableStreamClose(t)}}function readableByteStreamControllerPullInto(e,t,n,r){let i=e[Q].stream,a=t[Symbol.toStringTag],o,s;if(a===void 0||a===`DataView`)o=DataView,s=1;else{let e=typedArrayConstructorByTag(a);if(!e){r[Yn](TypeError(`Unsupported typed array: ${a}`));return}o=e,s=elementSizeByTag(a)}let c=t.buffer,l=t.byteLength,u=t.byteOffset,d=n*s,p;try{p=transferArrayBuffer(c)}catch(e){r[Yn](e);return}let m={buffer:p,bufferByteLength:p.byteLength,byteOffset:u,byteLength:l,bytesFilled:0,minimumFill:d,elementSize:s,viewConstructor:o,readerType:`byob`};if(e[Q].pendingPullIntos.length!==0){e[Q].pendingPullIntos.push(m),readableStreamAddReadIntoRequest(i,r);return}if(i[Q].state===`closed`){let e=new o(m.buffer,m.byteOffset,0);r[qn](e);return}if(e[Q].queueTotalSize>0){if(readableByteStreamControllerFillPullIntoDescriptorFromQueue(e,m)){let t=readableByteStreamControllerConvertPullIntoDescriptor(m);readableByteStreamControllerHandleQueueDrain(e),r[Jn](t);return}if(e[Q].closeRequested){let t=TypeError(`Insufficient bytes to fill elements in the given buffer`);readableByteStreamControllerError(e,t),r[Yn](t);return}}e[Q].pendingPullIntos.push(m),readableStreamAddReadIntoRequest(i,r),readableByteStreamControllerCallPullIfNeeded(e)}function readableByteStreamControllerRespond(e,t){let n=e[Q].pendingPullIntos[0];if(e[Q].stream[Q].state===`closed`){if(t!==0)throw TypeError(`bytesWritten must be 0 when calling respond() on a closed stream`)}else{if(t===0)throw TypeError(`bytesWritten must be greater than 0 when calling respond() on a readable stream`);if(n.bytesFilled+t>n.byteLength)throw RangeError(`bytesWritten out of range`)}n.buffer=transferArrayBuffer(n.buffer),readableByteStreamControllerRespondInternal(e,t)}function readableByteStreamControllerRespondWithNewView(e,t){let n=e[Q].pendingPullIntos[0],r=e[Q].stream[Q].state,i=t.byteLength,a=t.byteOffset,o=t.buffer;if(r===`closed`){if(i!==0)throw TypeError(`view's length must be 0 when calling respondWithNewView() on a closed stream`)}else if(i===0)throw TypeError(`view's length must be greater than 0 when calling respondWithNewView() on a readable stream`);if(n.byteOffset+n.bytesFilled!==a)throw RangeError(`The region specified by view does not match byobRequest`);if(n.bufferByteLength!==o.byteLength)throw RangeError(`The buffer of view has different capacity than byobRequest`);if(n.bytesFilled+i>n.byteLength)throw RangeError(`The region specified by view is larger than byobRequest`);n.buffer=transferArrayBuffer(o),readableByteStreamControllerRespondInternal(e,i)}function readableByteStreamControllerRespondInternal(e,t){let n=e[Q].pendingPullIntos[0];readableByteStreamControllerInvalidateBYOBRequest(e),e[Q].stream[Q].state===`closed`?readableByteStreamControllerRespondInClosedState(e,n):readableByteStreamControllerRespondInReadableState(e,t,n),readableByteStreamControllerCallPullIfNeeded(e)}function readableByteStreamControllerRespondInClosedState(e,t){t.readerType===`none`&&readableByteStreamControllerShiftPendingPullInto(e);let n=e[Q].stream;if(readableStreamHasBYOBReader(n))for(;readableStreamGetNumReadIntoRequests(n)>0;)readableByteStreamControllerCommitPullIntoDescriptor(n,readableByteStreamControllerShiftPendingPullInto(e))}function readableByteStreamControllerRespondInReadableState(e,t,n){if(readableByteStreamControllerFillHeadPullIntoDescriptor(e,t,n),n.readerType===`none`){readableByteStreamControllerEnqueueDetachedPullIntoToQueue(e,n),readableByteStreamControllerProcessPullIntoDescriptorsUsingQueue(e);return}if(n.bytesFilled<n.minimumFill)return;readableByteStreamControllerShiftPendingPullInto(e);let r=n.bytesFilled%n.elementSize;if(r>0){let t=n.byteOffset+n.bytesFilled;readableByteStreamControllerEnqueueClonedChunkToQueue(e,n.buffer,t-r,r)}n.bytesFilled-=r,readableByteStreamControllerCommitPullIntoDescriptor(e[Q].stream,n),readableByteStreamControllerProcessPullIntoDescriptorsUsingQueue(e)}function readableByteStreamControllerCancelSteps(e,t){readableByteStreamControllerClearPendingPullIntos(e),resetQueue(e);let n=e[Q].cancelAlgorithm?.(t)??Promise.resolve();return readableByteStreamControllerClearAlgorithms(e),n}function readableByteStreamControllerPullSteps(e,t){let n=e[Q].stream;if(e[Q].queueTotalSize>0){readableByteStreamControllerFillReadRequestFromQueue(e,t);return}let r=e[Q].autoAllocateChunkSize;if(r!==void 0){let n;try{n=new ArrayBuffer(r)}catch(e){t[Yn](e);return}let i={buffer:n,bufferByteLength:r,byteOffset:0,byteLength:r,bytesFilled:0,minimumFill:1,elementSize:1,viewConstructor:Uint8Array,readerType:`default`};e[Q].pendingPullIntos.push(i)}readableStreamAddReadRequest(n,t),readableByteStreamControllerCallPullIfNeeded(e)}function setupReadableByteStreamController(e,t,n,r,i,a,o){t[Q]={cancelAlgorithm:i,closeRequested:!1,highWaterMark:a,pullAgain:!1,pullAlgorithm:r,pulling:!1,queue:[],queueTotalSize:0,started:!1,stream:e,byobRequest:null,pendingPullIntos:[],autoAllocateChunkSize:o},e[Q].controller=t;let s=n();new Promise(e=>e(s)).then(()=>{t[Q].started=!0,readableByteStreamControllerCallPullIfNeeded(t)},e=>readableByteStreamControllerError(t,e))}function setupReadableByteStreamControllerFromSource(e,t,n){let r=new ReadableByteStreamController(Qn),i=t?.start,a=t?.pull,o=t?.cancel,s=t?.autoAllocateChunkSize;if(s!==void 0&&(s===0||!Number.isInteger(s)||s<0))throw TypeError(`autoAllocateChunkSize must be a positive integer`);setupReadableByteStreamController(e,r,i?i.bind(t,r):nonOpStart,a?createPromiseCallback(`source.pull`,a,t):nonOpPull,o?createPromiseCallback(`source.cancel`,o,t):nonOpCancel,n,s)}function readableByteStreamTee(e){let t=new ReadableStreamDefaultReader(e),n=!1,r=!1,i=!1,a,o,s=Promise.withResolvers(),c,l,u,d;function pullAlgorithm(){return n?Promise.resolve():(n=!0,t.read().then(e=>{if(n=!1,e.done){r||u.close(),i||d.close();return}let t=e.value,a=new Uint8Array(t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength));r||u.enqueue(a),i||d.enqueue(new Uint8Array(a))},()=>{}),Promise.resolve())}return c=new ReadableStream$1({type:`bytes`,pull:pullAlgorithm,cancel(t){if(r=!0,a=t,i){let t=readableStreamCancel(e,[a,o]);return s.resolve(),t}return s.promise}}),l=new ReadableStream$1({type:`bytes`,pull:pullAlgorithm,cancel(t){if(i=!0,o=t,r){let t=readableStreamCancel(e,[a,o]);return s.resolve(),t}return s.promise}}),u=c[Q].controller,d=l[Q].controller,t.closed.catch(e=>{u.error(e),d.error(e),(!r||!i)&&s.resolve()}),[c,l]}const sr=Symbol(`kSkipThrow`);var TransformStream=class{[$]=`TransformStream`;[Q];constructor(e={},t={},n={}){if(e!=null&&typeof e!=`object`)throw TypeError(`transformer must be an object`);if(t!=null&&typeof t!=`object`)throw TypeError(`writableStrategy must be an object`);if(n!=null&&typeof n!=`object`)throw TypeError(`readableStrategy must be an object`);let r=e?.readableType,i=e?.writableType,a=e?.start;if(r!==void 0)throw RangeError(`Invalid readableType: ${r}`);if(i!==void 0)throw RangeError(`Invalid writableType: ${i}`);let o=extractHighWaterMark(n?.highWaterMark,0),s=extractSizeAlgorithm(n?.size),c=extractHighWaterMark(t?.highWaterMark,1),l=extractSizeAlgorithm(t?.size),u=Promise.withResolvers();initializeTransformStream(this,u,c,l,o,s),setupTransformStreamDefaultControllerFromTransformer(this,e),a===void 0?u.resolve():u.resolve(a.call(e,this[Q].controller))}get readable(){if(!cr(this))throw TypeError(`Invalid this`);return this[Q].readable}get writable(){if(!cr(this))throw TypeError(`Invalid this`);return this[Q].writable}get[Symbol.toStringTag](){return`TransformStream`}},TransformStreamDefaultController=class{[$]=`TransformStreamDefaultController`;[Q];constructor(e){if(e!==sr)throw TypeError(`Illegal constructor`)}get desiredSize(){if(!lr(this))throw TypeError(`Invalid this`);let{stream:e}=this[Q],{readable:t}=e[Q],n=t[Q].controller;return readableStreamDefaultControllerGetDesiredSize(n)}enqueue(e){if(!lr(this))throw TypeError(`Invalid this`);transformStreamDefaultControllerEnqueue(this,e)}error(e){if(!lr(this))throw TypeError(`Invalid this`);transformStreamDefaultControllerError(this,e)}terminate(){if(!lr(this))throw TypeError(`Invalid this`);transformStreamDefaultControllerTerminate(this)}get[Symbol.toStringTag](){return`TransformStreamDefaultController`}};const cr=isBrandCheck(`TransformStream`),lr=isBrandCheck(`TransformStreamDefaultController`);async function defaultTransformAlgorithm(e,t){transformStreamDefaultControllerEnqueue(t,e)}function initializeTransformStream(e,t,n,r,i,a){let startAlgorithm=()=>t.promise,o=createWritableStream(startAlgorithm,t=>transformStreamDefaultSinkWriteAlgorithm(e,t),()=>transformStreamDefaultSinkCloseAlgorithm(e),t=>transformStreamDefaultSinkAbortAlgorithm(e,t),n,r);e[Q]={readable:createReadableStream(startAlgorithm,()=>transformStreamDefaultSourcePullAlgorithm(e),t=>transformStreamDefaultSourceCancelAlgorithm(e,t),i,a),writable:o,controller:void 0,backpressure:void 0,backpressureChange:{promise:void 0,resolve:void 0,reject:void 0}},transformStreamSetBackpressure(e,!0)}function transformStreamError(e,t){let{readable:n}=e[Q];readableStreamDefaultControllerError(n[Q].controller,t),transformStreamErrorWritableAndUnblockWrite(e,t)}function transformStreamErrorWritableAndUnblockWrite(e,t){let{controller:n,writable:r}=e[Q];transformStreamDefaultControllerClearAlgorithms(n),writableStreamDefaultControllerErrorIfNeeded(r[Q].controller,t),transformStreamUnblockWrite(e)}function transformStreamUnblockWrite(e){e[Q].backpressure&&transformStreamSetBackpressure(e,!1)}function transformStreamSetBackpressure(e,t){e[Q].backpressureChange.promise!==void 0&&e[Q].backpressureChange.resolve?.(),e[Q].backpressureChange=Promise.withResolvers(),e[Q].backpressure=t}function setupTransformStreamDefaultController(e,t,n,r,i){t[Q]={stream:e,transformAlgorithm:n,flushAlgorithm:r,cancelAlgorithm:i,finishPromise:void 0},e[Q].controller=t}function setupTransformStreamDefaultControllerFromTransformer(e,t){let n=new TransformStreamDefaultController(sr),r=t?.transform,i=t?.flush,a=t?.cancel;setupTransformStreamDefaultController(e,n,r?createPromiseCallback(`transformer.transform`,r,t):defaultTransformAlgorithm,i?createPromiseCallback(`transformer.flush`,i,t):nonOpFlush,a?createPromiseCallback(`transformer.cancel`,a,t):nonOpCancel)}function transformStreamDefaultControllerClearAlgorithms(e){e[Q].transformAlgorithm=void 0,e[Q].flushAlgorithm=void 0,e[Q].cancelAlgorithm=void 0}function transformStreamDefaultControllerEnqueue(e,t){let{stream:n}=e[Q],{readable:r}=n[Q],i=r[Q].controller;if(!readableStreamDefaultControllerCanCloseOrEnqueue(i))throw TypeError(`Unable to enqueue`);try{readableStreamDefaultControllerEnqueue(i,t)}catch(e){throw transformStreamErrorWritableAndUnblockWrite(n,e),r[Q].storedError}readableStreamDefaultControllerHasBackpressure(i)!==n[Q].backpressure&&transformStreamSetBackpressure(n,!0)}function transformStreamDefaultControllerError(e,t){transformStreamError(e[Q].stream,t)}async function transformStreamDefaultControllerPerformTransform(e,t){try{let n=e[Q].transformAlgorithm;if(n===void 0)return;await n(t,e)}catch(t){throw transformStreamError(e[Q].stream,t),t}}function transformStreamDefaultControllerTerminate(e){let{stream:t}=e[Q],{readable:n}=t[Q];readableStreamDefaultControllerClose(n[Q].controller),transformStreamErrorWritableAndUnblockWrite(t,TypeError(`TransformStream has been terminated`))}function transformStreamDefaultSinkWriteAlgorithm(e,t){let{controller:n}=e[Q];return e[Q].backpressure?e[Q].backpressureChange.promise.then(()=>{let{writable:r}=e[Q];if(r[Q].state===`erroring`)throw r[Q].storedError;return transformStreamDefaultControllerPerformTransform(n,t)}):transformStreamDefaultControllerPerformTransform(n,t)}async function transformStreamDefaultSinkAbortAlgorithm(e,t){let{controller:n,readable:r}=e[Q];if(n[Q].finishPromise!==void 0)return n[Q].finishPromise;let{promise:i,resolve:a,reject:o}=Promise.withResolvers();n[Q].finishPromise=i;let s=n[Q].cancelAlgorithm(t);return transformStreamDefaultControllerClearAlgorithms(n),s.then(()=>{r[Q].state===`errored`?o(r[Q].storedError):(readableStreamDefaultControllerError(r[Q].controller,t),a())},e=>{readableStreamDefaultControllerError(r[Q].controller,e),o(e)}),n[Q].finishPromise}function transformStreamDefaultSinkCloseAlgorithm(e){let{readable:t,controller:n}=e[Q];if(n[Q].finishPromise!==void 0)return n[Q].finishPromise;let{promise:r,resolve:i,reject:a}=Promise.withResolvers();n[Q].finishPromise=r;let o=n[Q].flushAlgorithm(n);return transformStreamDefaultControllerClearAlgorithms(n),o.then(()=>{t[Q].state===`errored`?a(t[Q].storedError):(readableStreamDefaultControllerClose(t[Q].controller),i())},e=>{readableStreamDefaultControllerError(t[Q].controller,e),a(e)}),n[Q].finishPromise}function transformStreamDefaultSourcePullAlgorithm(e){return transformStreamSetBackpressure(e,!1),e[Q].backpressureChange.promise}function transformStreamDefaultSourceCancelAlgorithm(e,t){let{controller:n,writable:r}=e[Q];if(n[Q].finishPromise!==void 0)return n[Q].finishPromise;let{promise:i,resolve:a,reject:o}=Promise.withResolvers();n[Q].finishPromise=i;let s=n[Q].cancelAlgorithm(t);return transformStreamDefaultControllerClearAlgorithms(n),s.then(()=>{r[Q].state===`errored`?o(r[Q].storedError):(writableStreamDefaultControllerErrorIfNeeded(r[Q].controller,t),transformStreamUnblockWrite(e),a())},t=>{writableStreamDefaultControllerErrorIfNeeded(r[Q].controller,t),transformStreamUnblockWrite(e),o(t)}),n[Q].finishPromise}const ur=Object.defineProperty(e=>e.byteLength,"name",{value:`size`}),dr=Object.defineProperty(()=>1,"name",{value:`size`});var ByteLengthQueuingStrategy=class{#e;constructor(e){if(typeof e!=`object`||!e)throw TypeError(`init must be an object`);if(e.highWaterMark===void 0)throw TypeError(`init.highWaterMark is required`);this.#e=+e.highWaterMark}get highWaterMark(){return this.#e}get size(){return ur}get[Symbol.toStringTag](){return`ByteLengthQueuingStrategy`}},CountQueuingStrategy=class{#e;constructor(e){if(typeof e!=`object`||!e)throw TypeError(`init must be an object`);if(e.highWaterMark===void 0)throw TypeError(`init.highWaterMark is required`);this.#e=+e.highWaterMark}get highWaterMark(){return this.#e}get size(){return dr}get[Symbol.toStringTag](){return`CountQueuingStrategy`}},TextEncoderStream=class{#e=null;#t=new TextEncoder;#n;constructor(){this.#n=new TransformStream({transform:(e,t)=>{if(e=String(e),e===``)return;this.#e!==null&&(e=this.#e+e);let n=e.charCodeAt(e.length-1);55296<=n&&n<=56319?(this.#e=e.slice(-1),e=e.slice(0,-1)):this.#e=null,e&&t.enqueue(this.#t.encode(e))},flush:e=>{this.#e!==null&&e.enqueue(new Uint8Array([239,191,189]))}})}get encoding(){return`utf-8`}get readable(){return this.#n.readable}get writable(){return this.#n.writable}};function hasStreamingSupport(){try{return new TextDecoder().decode(new Uint8Array([195]),{stream:!0}),!0}catch{return!1}}const fr=hasStreamingSupport();function incompleteUtf8Tail$1(e){let t=e.length;if(t===0)return 0;for(let n=1;n<=Math.min(3,t);n++){let r=e[t-n];if(!(r&128))return 0;if((r&192)!=128){let e;if((r&224)==192)e=2;else if((r&240)==224)e=3;else if((r&248)==240)e=4;else return 0;return n<e?n:0}}return 0}__name(incompleteUtf8Tail$1,`incompleteUtf8Tail`);var TextDecoderStream=class{#e;#t;constructor(e,t){if(this.#e=new TextDecoder(e,t),fr)this.#t=new TransformStream({transform:(e,t)=>{let n=toUint8Array$3(e),r=this.#e.decode(n,{stream:!0});r&&t.enqueue(r)},flush:e=>{let t=this.#e.decode();t&&e.enqueue(t)},cancel:()=>{this.#e.decode()}});else{let e=new Uint8Array;this.#t=new TransformStream({transform:(t,n)=>{let r=toUint8Array$3(t),i;e.length>0?(i=new Uint8Array(e.length+r.length),i.set(e,0),i.set(r,e.length)):i=r;let a=incompleteUtf8Tail$1(i),o;if(a>0?(o=i.slice(0,i.length-a),e=i.slice(i.length-a)):(o=i,e=new Uint8Array),o.length>0){let e=this.#e.decode(o);e&&n.enqueue(e)}},flush:t=>{if(e.length>0){let n=this.#e.decode(e);n&&t.enqueue(n),e=new Uint8Array}},cancel:()=>{e=new Uint8Array}})}}get encoding(){return this.#e.encoding}get fatal(){return this.#e.fatal}get ignoreBOM(){return this.#e.ignoreBOM}get readable(){return this.#t.readable}get writable(){return this.#t.writable}};function toUint8Array$3(e){if(e instanceof Uint8Array)return e;if(e instanceof ArrayBuffer)return new Uint8Array(e);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw TypeError(`chunk must be a BufferSource`)}__name(toUint8Array$3,`toUint8Array`);function isNativeStreamUsable$3(e,t){try{return typeof e==`function`?typeof e.prototype?.[t]==`function`:!1}catch{return!1}}__name(isNativeStreamUsable$3,`isNativeStreamUsable`);const pr=isNativeStreamUsable$3(globalThis.ReadableStream,`getReader`)?globalThis.ReadableStream:ReadableStream$1,mr=isNativeStreamUsable$3(globalThis.WritableStream,`getWriter`)?globalThis.WritableStream:WritableStream,hr=isNativeStreamUsable$3(globalThis.TransformStream,`readable`)?globalThis.TransformStream:TransformStream,gr=typeof globalThis.ByteLengthQueuingStrategy==`function`?globalThis.ByteLengthQueuingStrategy:ByteLengthQueuingStrategy,_r=typeof globalThis.CountQueuingStrategy==`function`?globalThis.CountQueuingStrategy:CountQueuingStrategy,vr=typeof globalThis.TextEncoderStream==`function`?globalThis.TextEncoderStream:TextEncoderStream,yr=typeof globalThis.TextDecoderStream==`function`?globalThis.TextDecoderStream:TextDecoderStream;var br=__esmMin(()=>{L()});function _setPipeImpl(e){xr=e}var xr,Stream_,Sr=__esmMin(()=>{yn(),Stream_=class extends Y{constructor(e){super(e)}pipe(e,t){return xr(this,e,t)}}});function getDefaultHighWaterMark(e){return e?wr:Cr}function setDefaultHighWaterMark(e,t){if(typeof t!=`number`||t<0||Number.isNaN(t))throw TypeError(`Invalid highWaterMark: ${t}`);e?wr=t:Cr=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 Cr,wr,Tr=__esmMin(()=>{Cr=16384,wr=16});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 Er,Dr=__esmMin(()=>{Sr(),Tr(),L(),Er=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;_destroyImpl;_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._destroyImpl=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.resume(),e===`readable`&&(this._buffer.length>0||this._readableState.ended)&&this._scheduleReadable(),this}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){this._destroyImpl?this._destroyImpl.call(this,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 cb=e=>{e&&nextTick(()=>this.emit(`error`,e)),nextTick(()=>this.emit(`close`))};return Object.prototype.hasOwnProperty.call(this,`_destroy`)?this._destroy(e??null,cb):this._destroyImpl?this._destroyImpl.call(this,e??null,cb):cb(e),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,a=null;return e.on(`data`,e=>{if(i){let t=i;i=null,a=null,t({value:e,done:!1})}else t.push(e)}),e.on(`end`,()=>{if(n=!0,i){let e=i;i=null,a=null,e({value:void 0,done:!0})}}),e.on(`error`,e=>{if(r=e,n=!0,a){let t=a;i=null,a=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,a=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)}}});function chunkLen$1(e){if(e==null)return 1;let t=e.length;return typeof t==`number`?t:1}var Duplex_,Or=__esmMin(()=>{Tr(),Dr(),L(),Duplex_=class extends Er{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;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=Error(`write after end`);return nextTick(()=>{r(e),this.emit(`error`,e)}),!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 a=this.writableLength<this.writableHighWaterMark;return a||(this.writableNeedDrain=!0),this._duplexDoWrite(e,i,r),a}_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.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.emit(`close`)),n&&n()})})})};return this._pendingWrites>0||this._duplexWriting||this._duplexWriteQueue.length>0?this._pendingEndCb=doFinal:doFinal(),this}_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.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,a=!1,ondrain=()=>{a=!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(),a||(a=!0,t.on(`drain`,ondrain)))}};r.on(`data`,ondata);let o=!1,onend=()=>{o||(o=!0,i&&t.end())},onclose=()=>{if(!o&&(o=!0,i&&!(r instanceof Er))){let e=t;typeof e.destroy==`function`&&e.destroy()}};i&&(r.on(`end`,onend),r.on(`close`,onclose));let cleanup=()=>{r.removeListener(`data`,ondata),a&&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 Er&&(r._pipeDests.push({dest:t,cleanup}),r._readableState.pipes.push(t)),t.emit(`pipe`,r),t}var kr=__esmMin(()=>{Sr(),Dr(),_setPipeImpl(pipe)});function chunkLen(e){if(e==null)return 1;let t=e.length;return typeof t==`number`?t:1}var Ar,jr=__esmMin(()=>{Sr(),Tr(),L(),Ar=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;_destroyImpl;_constructImpl;_decodeStrings;_defaultEncoding=`utf8`;constructor(e){super(e),this.writableHighWaterMark=e?.highWaterMark??getDefaultHighWaterMark(e?.objectMode??!1),this.writableObjectMode=e?.objectMode??!1,this._decodeStrings=e?.decodeStrings!==!1,e?.write&&(this._writeImpl=e.write),e?.writev&&(this._writev=e.writev),e?.final&&(this._finalImpl=e.final),e?.destroy&&(this._destroyImpl=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){this._destroyImpl?this._destroyImpl.call(this,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`),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=Error(`write after end`);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 a=this.writableLength<this.writableHighWaterMark;return a||(this.writableNeedDrain=!0),this._writableState.writing?this._writeBuffer.push({chunk:e,encoding:i,callback:r}):this._doWrite(e,i,r),a}_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 cb=e=>{e&&nextTick(()=>this.emit(`error`,e)),nextTick(()=>this.emit(`close`))};return this._destroy(e??null,cb),this}}}),Mr,Nr=__esmMin(()=>{Or(),L(),Mr=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_,Pr=__esmMin(()=>{Nr(),PassThrough_=class extends Mr{constructor(e){super({...e,transform(e,t,n){n(null,e)}})}}});function pipeline(...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 a=r[0];for(let e=1;e<r.length;e++){let t=r[e];a.pipe(t),a.on(`error`,onError),a=t}let o=r[r.length-1];return o.on(`error`,onError),o.on(`finish`,()=>{n&&!i&&n(null)}),o}var Fr=__esmMin(()=>{});function finished(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 a=e,o=typeof e.write==`function`,s=typeof e.read==`function`,c=a.writableFinished===!0,l=a.readableEnded===!0;if(a.destroyed===!0){let e=a._err;ge(e?()=>done(e):o&&c||s&&l?()=>done():()=>done(Error(`premature close`)))}else (o&&!s&&c||!o&&s&&l||o&&s&&c&&l)&&ge(()=>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 Ir=__esmMin(()=>{Sr(),L()}),Lr=__exportAll$4({Duplex:()=>Vr,PassThrough:()=>Ur,Readable:()=>zr,Stream:()=>Rr,Transform:()=>Hr,Writable:()=>Br,addAbortSignal:()=>addAbortSignal,default:()=>Wr,finished:()=>finished,getDefaultHighWaterMark:()=>getDefaultHighWaterMark,isDestroyed:()=>isDestroyed,isDisturbed:()=>isDisturbed,isErrored:()=>isErrored,isReadable:()=>isReadable,isWritable:()=>isWritable,pipeline:()=>pipeline,setDefaultHighWaterMark:()=>setDefaultHighWaterMark}),Rr,zr,Br,Vr,Hr,Ur,Wr,Gr=__esmMin(()=>{br(),Sr(),Tr(),Dr(),Or(),kr(),jr(),Nr(),Pr(),Fr(),Ir(),Rr=makeCallable(Stream_),zr=makeCallable(Er),Br=makeCallable(Ar),Vr=makeCallable(Duplex_),Hr=makeCallable(Mr),Ur=makeCallable(PassThrough_),Wr=Object.assign(Rr,{Stream:Rr,Readable:zr,Writable:Br,Duplex:Vr,Transform:Hr,PassThrough:Ur,pipeline,finished,addAbortSignal,isReadable,isWritable,isDestroyed,isDisturbed,isErrored,getDefaultHighWaterMark,setDefaultHighWaterMark})});function getGioCompressorFormat(e){switch(e){case`gzip`:return N.ZlibCompressorFormat.GZIP;case`deflate`:return N.ZlibCompressorFormat.ZLIB;case`deflate-raw`:return N.ZlibCompressorFormat.RAW}}function toUint8Array$2(e){return typeof e==`string`?new TextEncoder().encode(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}function createGzip(e){return new ZlibTransform(`gzip`,`compress`,e)}function createGunzip(e){return new ZlibTransform(`gzip`,`decompress`,e)}function createDeflate(e){return new ZlibTransform(`deflate`,`compress`,e)}function createInflate(e){return new ZlibTransform(`deflate`,`decompress`,e)}function createDeflateRaw(e){return new ZlibTransform(`deflate-raw`,`compress`,e)}function createInflateRaw(e){return new ZlibTransform(`deflate-raw`,`decompress`,e)}function createUnzip(e){return new ZlibTransform(`gzip`,`decompress`,e)}function createBrotliCompress(e){throw Error(`createBrotliCompress is not supported on GJS (no Brotli in GLib)`)}function createBrotliDecompress(e){throw Error(`createBrotliDecompress is not supported on GJS (no Brotli in GLib)`)}function createZstdCompress(e){let t=Error(`createZstdCompress is not supported on GJS (no Zstd in GLib)`);throw t.code=`ERR_UNSUPPORTED_OPERATION`,t}function createZstdDecompress(e){let t=Error(`createZstdDecompress is not supported on GJS (no Zstd in GLib)`);throw t.code=`ERR_UNSUPPORTED_OPERATION`,t}var ZlibTransform,Kr=__esmMin(()=>{P(),A(),Gr(),__name(toUint8Array$2,`toUint8Array`),ZlibTransform=class extends Hr{_format;_mode;_chunks=[];constructor(e,t,n){super(n),this._format=e,this._mode=t}_transform(e,t,n){this._chunks.push(toUint8Array$2(e)),n()}_flush(e){let t=this._chunks.reduce((e,t)=>e+t.length,0),n=new Uint8Array(t),r=0;for(let e of this._chunks)n.set(e,r),r+=e.length;this._chunks=[];try{let t=this._mode===`compress`?this._compress(n):this._decompress(n);this.push(Buffer.from(t)),e()}catch(t){e(t instanceof Error?t:Error(String(t)))}}_compress(e){let t=new N.ZlibCompressor({format:getGioCompressorFormat(this._format)}),n=new N.ConverterOutputStream({base_stream:N.MemoryOutputStream.new_resizable(),converter:t});n.write_bytes(new k.Bytes(e),null),n.close(null);let r=n.get_base_stream().steal_as_bytes();return new Uint8Array(r.get_data()??[])}_decompress(e){let t=new N.ZlibDecompressor({format:getGioCompressorFormat(this._format)}),n=N.MemoryInputStream.new_from_bytes(new k.Bytes(e)),r=new N.ConverterInputStream({base_stream:n,converter:t}),i=[];for(;;){let e=r.read_bytes(4096,null);if(e.get_size()===0)break;i.push(new Uint8Array(e.get_data()))}r.close(null);let a=i.reduce((e,t)=>e+t.length,0),o=new Uint8Array(a),s=0;for(let e of i)o.set(e,s),s+=e.length;return o}}}),qr=__exportAll$4({ZlibTransform:()=>ZlibTransform,brotliCompress:()=>brotliCompress,brotliCompressSync:()=>brotliCompressSync,brotliDecompress:()=>brotliDecompress,brotliDecompressSync:()=>brotliDecompressSync,constants:()=>Xr,createBrotliCompress:()=>createBrotliCompress,createBrotliDecompress:()=>createBrotliDecompress,createDeflate:()=>createDeflate,createDeflateRaw:()=>createDeflateRaw,createGunzip:()=>createGunzip,createGzip:()=>createGzip,createInflate:()=>createInflate,createInflateRaw:()=>createInflateRaw,createUnzip:()=>createUnzip,createZstdCompress:()=>createZstdCompress,createZstdDecompress:()=>createZstdDecompress,default:()=>Zr,deflate:()=>deflate,deflateRaw:()=>deflateRaw,deflateRawSync:()=>deflateRawSync,deflateSync:()=>deflateSync,gunzip:()=>gunzip,gunzipSync:()=>gunzipSync,gzip:()=>gzip,gzipSync:()=>gzipSync,inflate:()=>inflate,inflateRaw:()=>inflateRaw,inflateRawSync:()=>inflateRawSync,inflateSync:()=>inflateSync,zstdCompress:()=>zstdCompress,zstdCompressSync:()=>zstdCompressSync,zstdDecompress:()=>zstdDecompress,zstdDecompressSync:()=>zstdDecompressSync});function getGioFormat(e){switch(e){case`gzip`:return N.ZlibCompressorFormat.GZIP;case`deflate`:return N.ZlibCompressorFormat.ZLIB;case`deflate-raw`:return N.ZlibCompressorFormat.RAW}}function compressWithGio(e,t){let n=new N.ZlibCompressor({format:getGioFormat(t)}),r=new N.ConverterOutputStream({base_stream:N.MemoryOutputStream.new_resizable(),converter:n});r.write_bytes(new k.Bytes(e),null),r.close(null);let i=r.get_base_stream().steal_as_bytes();return new Uint8Array(i.get_data()??[])}function decompressStreamWithGio(e,t){let n=new N.ZlibDecompressor({format:getGioFormat(t)}),r=N.MemoryInputStream.new_from_bytes(new k.Bytes(e)),i=new N.ConverterInputStream({base_stream:r,converter:n}),a=[];for(;;){let e=i.read_bytes(4096,null);if(e.get_size()===0)break;a.push(new Uint8Array(e.get_data()))}i.close(null);let o=a.reduce((e,t)=>e+t.length,0),s=new Uint8Array(o),c=0;for(let e of a)s.set(e,c),c+=e.length;return s}function findGzipMemberEnd(e){let t=new N.ZlibDecompressor({format:N.ZlibCompressorFormat.GZIP}),n=new Uint8Array(65536),r=0,i=!1;for(;!i;){let a=e.subarray(r);try{let[e,o]=t.convert(a,n,N.ConverterFlags.NONE);r+=o,e===N.ConverterResult.FINISHED&&(i=!0)}catch{i=!0}}return r}function decompressWithGio(e,t){if(t!==`gzip`)return decompressStreamWithGio(e,t);let n=[],r=0;for(;r<e.length&&!(e.length-r<2||e[r]!==31||e[r+1]!==139);){let t=e.subarray(r),i=findGzipMemberEnd(t);if(i<=0)break;let a=decompressStreamWithGio(t.subarray(0,i),`gzip`);n.push(a),r+=i}if(n.length===0)return decompressStreamWithGio(e,`gzip`);let i=n.reduce((e,t)=>e+t.length,0),a=new Uint8Array(i),o=0;for(let e of n)a.set(e,o),o+=e.length;return a}async function compressWithWeb(e,t){let n=new CompressionStream(t),r=n.writable.getWriter();r.write(new Uint8Array(e.buffer,e.byteOffset,e.byteLength)),r.close();let i=[],a=n.readable.getReader();for(;;){let{done:e,value:t}=await a.read();if(e)break;i.push(t)}let o=i.reduce((e,t)=>e+t.length,0),s=new Uint8Array(o),c=0;for(let e of i)s.set(e,c),c+=e.length;return s}async function decompressWithWeb(e,t){let n=new DecompressionStream(t),r=n.writable.getWriter();r.write(new Uint8Array(e.buffer,e.byteOffset,e.byteLength)),r.close();let i=[],a=n.readable.getReader();for(;;){let{done:e,value:t}=await a.read();if(e)break;i.push(t)}let o=i.reduce((e,t)=>e+t.length,0),s=new Uint8Array(o),c=0;for(let e of i)s.set(e,c),c+=e.length;return s}async function compress(e,t){return Jr?compressWithWeb(e,t):compressWithGio(e,t)}async function decompress(e,t){return Jr?decompressWithWeb(e,t):decompressWithGio(e,t)}function toUint8Array$1(e){return typeof e==`string`?new TextEncoder().encode(e):e instanceof ArrayBuffer?new Uint8Array(e):e}function gzip(e,t,n){let r=typeof t==`function`?t:n;compress(toUint8Array$1(e),`gzip`).then(e=>r(null,e),e=>r(e instanceof Error?e:Error(String(e)),new Uint8Array))}function gunzip(e,t,n){let r=typeof t==`function`?t:n;decompress(toUint8Array$1(e),`gzip`).then(e=>r(null,e),e=>r(e instanceof Error?e:Error(String(e)),new Uint8Array))}function deflate(e,t,n){let r=typeof t==`function`?t:n;compress(toUint8Array$1(e),`deflate`).then(e=>r(null,e),e=>r(e instanceof Error?e:Error(String(e)),new Uint8Array))}function inflate(e,t,n){let r=typeof t==`function`?t:n;decompress(toUint8Array$1(e),`deflate`).then(e=>r(null,e),e=>r(e instanceof Error?e:Error(String(e)),new Uint8Array))}function deflateRaw(e,t,n){let r=typeof t==`function`?t:n;compress(toUint8Array$1(e),`deflate-raw`).then(e=>r(null,e),e=>r(e instanceof Error?e:Error(String(e)),new Uint8Array))}function inflateRaw(e,t,n){let r=typeof t==`function`?t:n;decompress(toUint8Array$1(e),`deflate-raw`).then(e=>r(null,e),e=>r(e instanceof Error?e:Error(String(e)),new Uint8Array))}function gzipSync(e,t){return compressWithGio(toUint8Array$1(e),`gzip`)}function gunzipSync(e,t){return decompressWithGio(toUint8Array$1(e),`gzip`)}function deflateSync(e,t){return compressWithGio(toUint8Array$1(e),`deflate`)}function inflateSync(e,t){return decompressWithGio(toUint8Array$1(e),`deflate`)}function deflateRawSync(e,t){return compressWithGio(toUint8Array$1(e),`deflate-raw`)}function inflateRawSync(e,t){return decompressWithGio(toUint8Array$1(e),`deflate-raw`)}function brotliCompress(e,t,n){(typeof t==`function`?t:n)(Error(`brotliCompress: Brotli is not supported in this environment`),Yr)}function brotliDecompress(e,t,n){(typeof t==`function`?t:n)(Error(`brotliDecompress: Brotli is not supported in this environment`),Yr)}function brotliCompressSync(e,t){throw Error(`brotliCompressSync: Brotli is not supported in this environment`)}function brotliDecompressSync(e,t){throw Error(`brotliDecompressSync: Brotli is not supported in this environment`)}function zstdCompress(e,t,n){let r=typeof t==`function`?t:n,i=Error(`zstdCompress: Zstd is not supported in this environment`);i.code=`ERR_UNSUPPORTED_OPERATION`,r(i,Yr)}function zstdDecompress(e,t,n){let r=typeof t==`function`?t:n,i=Error(`zstdDecompress: Zstd is not supported in this environment`);i.code=`ERR_UNSUPPORTED_OPERATION`,r(i,Yr)}function zstdCompressSync(e,t){let n=Error(`zstdCompressSync: Zstd is not supported in this environment`);throw n.code=`ERR_UNSUPPORTED_OPERATION`,n}function zstdDecompressSync(e,t){let n=Error(`zstdDecompressSync: Zstd is not supported in this environment`);throw n.code=`ERR_UNSUPPORTED_OPERATION`,n}var Jr,Yr,Xr,Zr,Qr=__esmMin(()=>{Kr(),P(),A(),Jr=globalThis.CompressionStream!==void 0,__name(toUint8Array$1,`toUint8Array`),Yr=new Uint8Array,Xr={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_VERSION_ERROR:-6,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_DEFLATED:8},Zr={gzip,gunzip,deflate,inflate,deflateRaw,inflateRaw,gzipSync,gunzipSync,deflateSync,inflateSync,deflateRawSync,inflateRawSync,brotliCompress,brotliDecompress,brotliCompressSync,brotliDecompressSync,zstdCompress,zstdDecompress,zstdCompressSync,zstdDecompressSync,createGzip,createGunzip,createDeflate,createInflate,createDeflateRaw,createInflateRaw,createUnzip,createBrotliCompress,createBrotliDecompress,createZstdCompress,createZstdDecompress,constants:Xr}});const $r=new Set([`gzip`,`deflate`,`deflate-raw`]);function validateFormat(e){if(!$r.has(e))throw TypeError(`Unsupported compression format: '${e}'. Supported formats: 'gzip', 'deflate', 'deflate-raw'.`);return e}const ei=typeof globalThis.CompressionStream==`function`&&typeof globalThis.DecompressionStream==`function`;let ti=!1,ni,ri,ii,ai,oi,si;async function loadZlib(){if(ti)return;let e=await Promise.resolve().then(()=>(Qr(),qr));ni=e.gzipSync,ri=e.gunzipSync,ii=e.deflateSync,ai=e.inflateSync,oi=e.deflateRawSync,si=e.inflateRawSync,ti=!0}function getCompressFn(e){switch(e){case`gzip`:return e=>ni(e);case`deflate`:return e=>ii(e);case`deflate-raw`:return e=>oi(e)}}function getDecompressFn(e){switch(e){case`gzip`:return e=>ri(e);case`deflate`:return e=>ai(e);case`deflate-raw`:return e=>si(e)}}let ci,li;if(ei)ci=globalThis.CompressionStream,li=globalThis.DecompressionStream;else{let e=loadZlib();ci=class CompressionStream{readable;writable;constructor(t){let n=validateFormat(t),r=new hr({async transform(t,r){try{await e,r.enqueue(getCompressFn(n)(t))}catch(e){r.error(e)}}});this.readable=r.readable,this.writable=r.writable}},li=class DecompressionStream{readable;writable;constructor(t){let n=validateFormat(t),r=new hr({async transform(t,r){try{await e,r.enqueue(getDecompressFn(n)(t))}catch(e){r.error(e)}}});this.readable=r.readable,this.writable=r.writable}}}const ui=globalThis;globalThis.CompressionStream===void 0&&(ui.CompressionStream=ci),globalThis.DecompressionStream===void 0&&(ui.DecompressionStream=li);const di=globalThis;globalThis.DOMException===void 0&&(di.DOMException=Be);const fi=globalThis;globalThis.ByteLengthQueuingStrategy===void 0&&(fi.ByteLengthQueuingStrategy=gr),globalThis.CountQueuingStrategy===void 0&&(fi.CountQueuingStrategy=_r);const pi=globalThis;function isNativeStreamUsable$2(e,t){try{return typeof e==`function`?typeof e.prototype?.[t]==`function`:!1}catch{return!1}}__name(isNativeStreamUsable$2,`isNativeStreamUsable`),isNativeStreamUsable$2(globalThis.ReadableStream,`getReader`)||(pi.ReadableStream=pr),pi.ReadableStreamBYOBReader===void 0&&(pi.ReadableStreamBYOBReader=ReadableStreamBYOBReader),pi.ReadableStreamBYOBRequest===void 0&&(pi.ReadableStreamBYOBRequest=ReadableStreamBYOBRequest),pi.ReadableByteStreamController===void 0&&(pi.ReadableByteStreamController=ReadableByteStreamController),pi.ReadableStreamDefaultController===void 0&&(pi.ReadableStreamDefaultController=ReadableStreamDefaultController),pi.ReadableStreamDefaultReader===void 0&&(pi.ReadableStreamDefaultReader=ReadableStreamDefaultReader);const mi=globalThis;globalThis.TextEncoderStream===void 0&&(mi.TextEncoderStream=vr),globalThis.TextDecoderStream===void 0&&(mi.TextDecoderStream=yr);function isNativeStreamUsable$1(e,t){try{return typeof e==`function`?typeof e.prototype?.[t]==`function`:!1}catch{return!1}}if(__name(isNativeStreamUsable$1,`isNativeStreamUsable`),!isNativeStreamUsable$1(globalThis.TransformStream,`readable`)){let e=globalThis;e.TransformStream=hr}function isNativeStreamUsable(e,t){try{return typeof e==`function`?typeof e.prototype?.[t]==`function`:!1}catch{return!1}}if(!isNativeStreamUsable(globalThis.WritableStream,`getWriter`)){let e=globalThis;e.WritableStream=mr}var CryptoKey=class{type;extractable;algorithm;usages;_handle;constructor(e,t,n,r,i){this.type=e,this.extractable=t,this.algorithm=Object.freeze({...n}),this.usages=Object.freeze([...r]),this._handle=i}get[Symbol.toStringTag](){return`CryptoKey`}};function normalizeAlgorithm$1(e){if(typeof e==`string`)return{name:e};if(!e||typeof e.name!=`string`)throw TypeError(`Algorithm must have a name property`);return e}__name(normalizeAlgorithm$1,`normalizeAlgorithm`);const hi={"SHA-1":`sha1`,"SHA-256":`sha256`,"SHA-384":`sha384`,"SHA-512":`sha512`};function toNodeHashName(e){let t=hi[e.toUpperCase()]||hi[e];if(!t)throw new Be(`Unrecognized hash name: ${e}`,`NotSupportedError`);return t}const gi={"P-256":`prime256v1`,"P-384":`secp384r1`,"P-521":`secp521r1`};function toNodeCurveName(e){let t=gi[e];if(!t)throw new Be(`Unrecognized curve name: ${e}`,`NotSupportedError`);return t}function hashSize$1(e){switch(toNodeHashName(e)){case`sha1`:return 20;case`sha256`:return 32;case`sha384`:return 48;case`sha512`:return 64;default:throw new Be(`Unsupported hash: ${e}`,`NotSupportedError`)}}__name(hashSize$1,`hashSize`);function validateUsages(e,t){for(let n of e)if(!t.includes(n))throw new Be(`Invalid key usage: ${n}`,`SyntaxError`);if(e.length===0)throw new Be(`Key usages must not be empty`,`SyntaxError`)}function checkUsage(e,t){if(!e.usages.includes(t))throw new Be(`Key does not support the '${t}' usage`,`InvalidAccessError`)}const _i=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,vi=new Uint8Array(128);for(let e=0;e<64;e++)vi[_i.charCodeAt(e)]=e;function bytesToBase64(e){let t=``,n=e.length;for(let r=0;r<n;r+=3){let i=e[r],a=r+1<n?e[r+1]:0,o=r+2<n?e[r+2]:0;t+=_i[i>>2&63],t+=_i[(i<<4|a>>4)&63],t+=r+1<n?_i[(a<<2|o>>6)&63]:`=`,t+=r+2<n?_i[o&63]:`=`}return t}function base64ToBytes(e){let t=e;for(;t.endsWith(`=`);)t=t.slice(0,-1);let n=[],r=0,i=0;for(let e=0;e<t.length;e++)i=i<<6|vi[t.charCodeAt(e)],r+=6,r>=8&&(r-=8,n.push(i>>r&255));return new Uint8Array(n)}function base64urlEncode(e){return bytesToBase64(e).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/,``)}function base64urlDecode(e){let t=e.replace(/-/g,`+`).replace(/_/g,`/`);for(;t.length%4;)t+=`=`;return base64ToBytes(t)}function toUint8Array(e){if(e instanceof Uint8Array)return e;if(e instanceof ArrayBuffer)return new Uint8Array(e);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw TypeError(`Expected BufferSource`)}var yi,bi=__esmMin(()=>{yi={RSA_PKCS1_PADDING:1,RSA_NO_PADDING:3,RSA_PKCS1_OAEP_PADDING:4,RSA_PKCS1_PSS_PADDING:6,DH_CHECK_P_NOT_SAFE_PRIME:2,DH_CHECK_P_NOT_PRIME:1,DH_UNABLE_TO_CHECK_GENERATOR:4,DH_NOT_SUITABLE_GENERATOR:8}});function timingSafeEqual(e,t){if(e.length!==t.length)throw RangeError(`Input buffers must have the same byte length`);let n=0;for(let r=0;r<e.length;r++)n|=e[r]^t[r];return n===0}var xi=__esmMin(()=>{});function gmul(e,t){let n=0;for(let r=0;r<8;r++){t&1&&(n^=e);let r=e&128;e=e<<1&255,r&&(e^=27),t>>=1}return n}function keyExpansion(e){let t=e.length/4,n=t+6,r=4*(n+1),i=Array.from({length:r});for(let n=0;n<t;n++)i[n]=new Uint8Array([e[4*n],e[4*n+1],e[4*n+2],e[4*n+3]]);for(let e=t;e<r;e++){let n=new Uint8Array(i[e-1]);e%t===0?n=new Uint8Array([Si[n[1]]^wi[e/t-1],Si[n[2]],Si[n[3]],Si[n[0]]]):t>6&&e%t===4&&(n=new Uint8Array([Si[n[0]],Si[n[1]],Si[n[2]],Si[n[3]]])),i[e]=new Uint8Array(4);for(let r=0;r<4;r++)i[e][r]=i[e-t][r]^n[r]}let a=[];for(let e=0;e<=n;e++){let t=new Uint8Array(16);for(let n=0;n<4;n++)t[4*n]=i[4*e+n][0],t[4*n+1]=i[4*e+n][1],t[4*n+2]=i[4*e+n][2],t[4*n+3]=i[4*e+n][3];a.push(t)}return a}function aesEncryptBlock(e,t){let n=new Uint8Array(e),r=t.length-1;for(let e=0;e<16;e++)n[e]^=t[0][e];for(let e=1;e<r;e++){for(let e=0;e<16;e++)n[e]=Si[n[e]];let r=n[1];n[1]=n[5],n[5]=n[9],n[9]=n[13],n[13]=r;let i=n[2],a=n[6];n[2]=n[10],n[6]=n[14],n[10]=i,n[14]=a;let o=n[15];n[15]=n[11],n[11]=n[7],n[7]=n[3],n[3]=o;for(let e=0;e<4;e++){let t=e*4,r=n[t],i=n[t+1],a=n[t+2],o=n[t+3];n[t]=gmul(2,r)^gmul(3,i)^a^o,n[t+1]=r^gmul(2,i)^gmul(3,a)^o,n[t+2]=r^i^gmul(2,a)^gmul(3,o),n[t+3]=gmul(3,r)^i^a^gmul(2,o)}for(let r=0;r<16;r++)n[r]^=t[e][r]}for(let e=0;e<16;e++)n[e]=Si[n[e]];let i=n[1];n[1]=n[5],n[5]=n[9],n[9]=n[13],n[13]=i;let a=n[2],o=n[6];n[2]=n[10],n[6]=n[14],n[10]=a,n[14]=o;let s=n[15];n[15]=n[11],n[11]=n[7],n[7]=n[3],n[3]=s;for(let e=0;e<16;e++)n[e]^=t[r][e];return n}function aesDecryptBlock(e,t){let n=new Uint8Array(e),r=t.length-1;for(let e=0;e<16;e++)n[e]^=t[r][e];for(let e=r-1;e>0;e--){let r=n[13];n[13]=n[9],n[9]=n[5],n[5]=n[1],n[1]=r;let i=n[10],a=n[14];n[10]=n[2],n[14]=n[6],n[2]=i,n[6]=a;let o=n[3];n[3]=n[7],n[7]=n[11],n[11]=n[15],n[15]=o;for(let e=0;e<16;e++)n[e]=Ci[n[e]];for(let r=0;r<16;r++)n[r]^=t[e][r];for(let e=0;e<4;e++){let t=e*4,r=n[t],i=n[t+1],a=n[t+2],o=n[t+3];n[t]=gmul(14,r)^gmul(11,i)^gmul(13,a)^gmul(9,o),n[t+1]=gmul(9,r)^gmul(14,i)^gmul(11,a)^gmul(13,o),n[t+2]=gmul(13,r)^gmul(9,i)^gmul(14,a)^gmul(11,o),n[t+3]=gmul(11,r)^gmul(13,i)^gmul(9,a)^gmul(14,o)}}let i=n[13];n[13]=n[9],n[9]=n[5],n[5]=n[1],n[1]=i;let a=n[10],o=n[14];n[10]=n[2],n[14]=n[6],n[2]=a,n[6]=o;let s=n[3];n[3]=n[7],n[7]=n[11],n[11]=n[15],n[15]=s;for(let e=0;e<16;e++)n[e]=Ci[n[e]];for(let e=0;e<16;e++)n[e]^=t[0][e];return n}function incrementCounter(e){for(let t=15;t>=0&&++e[t]===0;t--);}function gcmIncrementCounter(e){for(let t=15;t>=12&&++e[t]===0;t--);}function gfMul(e,t){let n=new Uint8Array(16),r=new Uint8Array(e);for(let e=0;e<128;e++){if(t[e>>>3]&1<<7-(e&7))for(let e=0;e<16;e++)n[e]^=r[e];let i=r[15]&1;for(let e=15;e>0;e--)r[e]=r[e]>>>1|(r[e-1]&1)<<7;r[0]>>>=1,i&&(r[0]^=225)}return n}function ghash(e,t,n){let r=new Uint8Array(16),i=Math.ceil(t.length/16)||0;for(let n=0;n<i;n++){let i=n*16,a=Math.min(i+16,t.length);for(let e=0;e<16;e++){let n=i+e;n<a&&(r[e]^=t[n])}let o=gfMul(r,e);r.set(o)}let a=Math.ceil(n.length/16)||0;for(let t=0;t<a;t++){let i=t*16,a=Math.min(i+16,n.length);for(let e=0;e<16;e++){let t=i+e;t<a&&(r[e]^=n[t])}let o=gfMul(r,e);r.set(o)}let o=new Uint8Array(16),s=t.length*8,c=n.length*8,l=Math.floor(s/4294967296),u=s>>>0;o[0]=l>>>24&255,o[1]=l>>>16&255,o[2]=l>>>8&255,o[3]=l&255,o[4]=u>>>24&255,o[5]=u>>>16&255,o[6]=u>>>8&255,o[7]=u&255;let d=Math.floor(c/4294967296),p=c>>>0;o[8]=d>>>24&255,o[9]=d>>>16&255,o[10]=d>>>8&255,o[11]=d&255,o[12]=p>>>24&255,o[13]=p>>>16&255,o[14]=p>>>8&255,o[15]=p&255;for(let e=0;e<16;e++)r[e]^=o[e];let m=gfMul(r,e);return r.set(m),r}var Si,Ci,wi,Ti=__esmMin(()=>{Si=new Uint8Array([99,124,119,123,242,107,111,197,48,1,103,43,254,215,171,118,202,130,201,125,250,89,71,240,173,212,162,175,156,164,114,192,183,253,147,38,54,63,247,204,52,165,229,241,113,216,49,21,4,199,35,195,24,150,5,154,7,18,128,226,235,39,178,117,9,131,44,26,27,110,90,160,82,59,214,179,41,227,47,132,83,209,0,237,32,252,177,91,106,203,190,57,74,76,88,207,208,239,170,251,67,77,51,133,69,249,2,127,80,60,159,168,81,163,64,143,146,157,56,245,188,182,218,33,16,255,243,210,205,12,19,236,95,151,68,23,196,167,126,61,100,93,25,115,96,129,79,220,34,42,144,136,70,238,184,20,222,94,11,219,224,50,58,10,73,6,36,92,194,211,172,98,145,149,228,121,231,200,55,109,141,213,78,169,108,86,244,234,101,122,174,8,186,120,37,46,28,166,180,198,232,221,116,31,75,189,139,138,112,62,181,102,72,3,246,14,97,53,87,185,134,193,29,158,225,248,152,17,105,217,142,148,155,30,135,233,206,85,40,223,140,161,137,13,191,230,66,104,65,153,45,15,176,84,187,22]),Ci=new Uint8Array([82,9,106,213,48,54,165,56,191,64,163,158,129,243,215,251,124,227,57,130,155,47,255,135,52,142,67,68,196,222,233,203,84,123,148,50,166,194,35,61,238,76,149,11,66,250,195,78,8,46,161,102,40,217,36,178,118,91,162,73,109,139,209,37,114,248,246,100,134,104,152,22,212,164,92,204,93,101,182,146,108,112,72,80,253,237,185,218,94,21,70,87,167,141,157,132,144,216,171,0,140,188,211,10,247,228,88,5,184,179,69,6,208,44,30,143,202,63,15,2,193,175,189,3,1,19,138,107,58,145,17,65,79,103,220,234,151,242,207,206,240,180,230,115,150,172,116,34,231,173,53,133,226,249,55,232,28,117,223,110,71,241,26,113,29,41,197,137,111,183,98,14,170,24,190,27,252,86,62,75,198,210,121,32,154,219,192,254,120,205,90,244,31,221,168,51,136,7,199,49,177,18,16,89,39,128,236,95,96,81,127,169,25,181,74,13,45,229,122,159,147,201,156,239,160,224,59,77,174,42,245,176,200,235,187,60,131,83,153,97,23,43,4,126,186,119,214,38,225,105,20,99,85,33,12,125]),wi=[1,2,4,8,16,32,64,128,27,54]});function parseAlgorithm(e){let t=e.toLowerCase().match(/^aes-(128|192|256)-(cbc|ctr|ecb|cfb|ofb|gcm)$/);if(!t)throw Error(`Unsupported cipher algorithm: ${e}`);let n=parseInt(t[1]),r=t[2];return{keySize:n/8,ivSize:r===`ecb`?0:r===`gcm`?12:16,mode:r}}function toBuffer$2(e,t){return typeof e==`string`?q.from(e,t||`utf8`):q.from(e)}function encodeOutput(e,t){return t?q.from(e).toString(t):q.from(e)}function incompleteUtf8Tail(e){if(e.length===0)return 0;let t=e.length;for(let n=1;n<=Math.min(4,t);n++){let r=e[t-n];if(!(r&128))return 0;if((r&192)==128)continue;let i;if((r&224)==192)i=2;else if((r&240)==224)i=3;else if((r&248)==240)i=4;else return 0;return n<i?n:0}return 0}function pkcs7Pad(e){let t=16-e.length%16,n=new Uint8Array(e.length+t);n.set(e);for(let r=e.length;r<n.length;r++)n[r]=t;return n}function pkcs7Unpad(e){if(e.length===0||e.length%16!=0)throw Error(`bad decrypt`);let t=e[e.length-1];if(t===0||t>16)throw Error(`bad decrypt`);for(let n=e.length-t;n<e.length;n++)if(e[n]!==t)throw Error(`bad decrypt`);return new Uint8Array(e.slice(0,e.length-t))}var Ei=__esmMin(()=>{J(),__name(toBuffer$2,`toBuffer`)});function createCipher(e,t){throw Error(`crypto.createCipher() is deprecated. Use createCipheriv() instead.`)}function createCipheriv(e,t,n){return new Cipher(e,typeof t==`string`?q.from(t):new Uint8Array(t),n==null?null:typeof n==`string`?q.from(n):new Uint8Array(n))}function createDecipher(e,t){throw Error(`crypto.createDecipher() is deprecated. Use createDecipheriv() instead.`)}function createDecipheriv(e,t,n){return new Decipher(e,typeof t==`string`?q.from(t):new Uint8Array(t),n==null?null:typeof n==`string`?q.from(n):new Uint8Array(n))}function getCiphers(){return[`aes-128-cbc`,`aes-128-ecb`,`aes-192-cbc`,`aes-192-ecb`,`aes-256-cbc`,`aes-256-ecb`,`aes-128-ctr`,`aes-192-ctr`,`aes-256-ctr`,`aes-128-cfb`,`aes-192-cfb`,`aes-256-cfb`,`aes-128-gcm`,`aes-192-gcm`,`aes-256-gcm`]}var CipherBase,Cipher,Decipher,Di=__esmMin(()=>{Ti(),Ei(),J(),CipherBase=class{_roundKeys;_iv;_mode;_buffer=new Uint8Array;_autoPadding=!0;_finalized=!1;constructor(e,t,n){let r=parseAlgorithm(e);if(t.length!==r.keySize)throw Error(`Invalid key length ${t.length}, expected ${r.keySize} for ${e}`);if(r.ivSize>0&&(!n||n.length!==r.ivSize))throw Error(`Invalid IV length ${n?.length??0}, expected ${r.ivSize} for ${e}`);this._roundKeys=keyExpansion(t),this._iv=n?new Uint8Array(n):new Uint8Array(16),this._mode=r.mode}setAutoPadding(e){return this._autoPadding=e,this}},Cipher=class extends CipherBase{_prevBlock;_counter;_gcmH=null;_gcmJ0=null;_gcmAAD=new Uint8Array;_gcmCiphertext=[];_gcmCiphertextLen=0;_gcmAuthTag=null;_gcmAADSet=!1;constructor(e,t,n){super(e,t,n),this._prevBlock=new Uint8Array(this._iv),this._mode===`gcm`?(this._gcmH=aesEncryptBlock(new Uint8Array(16),this._roundKeys),this._gcmJ0=new Uint8Array(16),this._gcmJ0.set(this._iv.subarray(0,12)),this._gcmJ0[15]=1,this._counter=new Uint8Array(this._gcmJ0),gcmIncrementCounter(this._counter)):this._counter=new Uint8Array(this._iv)}setAAD(e){if(this._mode!==`gcm`)throw Error(`setAAD is only supported in GCM mode`);if(this._gcmCiphertextLen>0)throw Error(`setAAD must be called before update()`);return this._gcmAAD=new Uint8Array(e),this._gcmAADSet=!0,this}getAuthTag(){if(this._mode!==`gcm`)throw Error(`getAuthTag is only supported in GCM mode`);if(!this._gcmAuthTag)throw Error(`getAuthTag must be called after final()`);return q.from(this._gcmAuthTag)}update(e,t,n){let r=toBuffer$2(e,t),i=new Uint8Array(this._buffer.length+r.length);if(i.set(this._buffer),i.set(r,this._buffer.length),this._mode===`gcm`){let e=this._processGcmEncrypt(i);return this._buffer=new Uint8Array,encodeOutput(e,n)}if(this._mode===`ctr`||this._mode===`cfb`||this._mode===`ofb`){let e=this._processStream(i);return this._buffer=new Uint8Array,encodeOutput(e,n)}let a=Math.floor(i.length/16)*16,o=[];for(let e=0;e<a;e+=16){let t=i.slice(e,e+16);o.push(this._encryptBlock(t))}this._buffer=i.slice(a);let s=new Uint8Array(o.length*16);for(let e=0;e<o.length;e++)s.set(o[e],e*16);return encodeOutput(s,n)}final(e){if(this._finalized)throw Error(`Cipher already finalized`);if(this._finalized=!0,this._mode===`gcm`){let t=new Uint8Array;this._buffer.length>0&&(t=this._processGcmEncrypt(this._buffer),this._buffer=new Uint8Array);let n=new Uint8Array(this._gcmCiphertextLen),r=0;for(let e of this._gcmCiphertext)n.set(e,r),r+=e.length;let i=ghash(this._gcmH,this._gcmAAD,n),a=aesEncryptBlock(this._gcmJ0,this._roundKeys),o=new Uint8Array(16);for(let e=0;e<16;e++)o[e]=i[e]^a[e];return this._gcmAuthTag=q.from(o),encodeOutput(t,e)}if(this._mode===`ctr`||this._mode===`cfb`||this._mode===`ofb`){if(this._buffer.length>0){let t=this._processStream(this._buffer);return this._buffer=new Uint8Array,encodeOutput(t,e)}return encodeOutput(new Uint8Array,e)}let t=this._buffer;if(this._autoPadding)t=pkcs7Pad(t);else if(t.length%16!=0)throw Error(`data not multiple of block size`);let n=[];for(let e=0;e<t.length;e+=16)n.push(this._encryptBlock(t.slice(e,e+16)));if(this._buffer=new Uint8Array,n.length===0)return encodeOutput(new Uint8Array,e);let r=new Uint8Array(n.length*16);for(let e=0;e<n.length;e++)r.set(n[e],e*16);return encodeOutput(r,e)}_encryptBlock(e){if(this._mode===`cbc`){let t=new Uint8Array(16);for(let n=0;n<16;n++)t[n]=e[n]^this._prevBlock[n];let n=aesEncryptBlock(t,this._roundKeys);return this._prevBlock=n,n}else if(this._mode===`ecb`)return aesEncryptBlock(e,this._roundKeys);throw Error(`Block encryption not supported for mode: ${this._mode}`)}_processStream(e){let t=new Uint8Array(e.length);for(let n=0;n<e.length;n+=16){let r=aesEncryptBlock(this._counter,this._roundKeys),i=Math.min(16,e.length-n);for(let a=0;a<i;a++)t[n+a]=e[n+a]^r[a];incrementCounter(this._counter)}return t}_processGcmEncrypt(e){let t=new Uint8Array(e.length);for(let n=0;n<e.length;n+=16){let r=aesEncryptBlock(this._counter,this._roundKeys),i=Math.min(16,e.length-n);for(let a=0;a<i;a++)t[n+a]=e[n+a]^r[a];gcmIncrementCounter(this._counter)}return this._gcmCiphertext.push(new Uint8Array(t)),this._gcmCiphertextLen+=t.length,t}},Decipher=class extends CipherBase{_prevBlock;_counter;_pendingUtf8=new Uint8Array;_gcmH=null;_gcmJ0=null;_gcmAAD=new Uint8Array;_gcmCiphertext=[];_gcmCiphertextLen=0;_gcmExpectedTag=null;_gcmAADSet=!1;constructor(e,t,n){super(e,t,n),this._prevBlock=new Uint8Array(this._iv),this._mode===`gcm`?(this._gcmH=aesEncryptBlock(new Uint8Array(16),this._roundKeys),this._gcmJ0=new Uint8Array(16),this._gcmJ0.set(this._iv.subarray(0,12)),this._gcmJ0[15]=1,this._counter=new Uint8Array(this._gcmJ0),gcmIncrementCounter(this._counter)):this._counter=new Uint8Array(this._iv)}setAAD(e){if(this._mode!==`gcm`)throw Error(`setAAD is only supported in GCM mode`);if(this._gcmCiphertextLen>0)throw Error(`setAAD must be called before update()`);return this._gcmAAD=new Uint8Array(e),this._gcmAADSet=!0,this}setAuthTag(e){if(this._mode!==`gcm`)throw Error(`setAuthTag is only supported in GCM mode`);return this._gcmExpectedTag=q.from(e),this}_encodeWithUtf8Handling(e,t,n){if(!t||t!==`utf8`&&t!==`utf-8`)return encodeOutput(e,t);let r;if(this._pendingUtf8.length>0?(r=new Uint8Array(this._pendingUtf8.length+e.length),r.set(this._pendingUtf8),r.set(e,this._pendingUtf8.length),this._pendingUtf8=new Uint8Array):r=e,!n){let e=incompleteUtf8Tail(r);e>0&&(this._pendingUtf8=new Uint8Array(r.slice(r.length-e)),r=new Uint8Array(r.slice(0,r.length-e)))}return q.from(r).toString(`utf8`)}update(e,t,n){let r=toBuffer$2(e,t),i=new Uint8Array(this._buffer.length+r.length);if(i.set(this._buffer),i.set(r,this._buffer.length),this._mode===`gcm`){this._gcmCiphertext.push(new Uint8Array(i)),this._gcmCiphertextLen+=i.length;let e=this._processGcmDecrypt(i);return this._buffer=new Uint8Array,this._encodeWithUtf8Handling(e,n,!1)}if(this._mode===`ctr`||this._mode===`cfb`||this._mode===`ofb`){let e=this._processStream(i);return this._buffer=new Uint8Array,this._encodeWithUtf8Handling(e,n,!1)}let a=Math.floor(i.length/16);if(a===0)return this._buffer=i,this._encodeWithUtf8Handling(new Uint8Array,n,!1);let o=(this._autoPadding?a-1:a)*16,s=[];for(let e=0;e<o;e+=16){let t=i.slice(e,e+16);s.push(this._decryptBlock(t))}this._buffer=i.slice(o);let c=new Uint8Array(s.length*16);for(let e=0;e<s.length;e++)c.set(s[e],e*16);return this._encodeWithUtf8Handling(c,n,!1)}final(e){if(this._finalized)throw Error(`Decipher already finalized`);if(this._finalized=!0,this._mode===`gcm`){let t=new Uint8Array;if(this._buffer.length>0&&(this._gcmCiphertext.push(new Uint8Array(this._buffer)),this._gcmCiphertextLen+=this._buffer.length,t=this._processGcmDecrypt(this._buffer),this._buffer=new Uint8Array),!this._gcmExpectedTag)throw Error(`Unsupported state or unable to authenticate data`);let n=new Uint8Array(this._gcmCiphertextLen),r=0;for(let e of this._gcmCiphertext)n.set(e,r),r+=e.length;let i=ghash(this._gcmH,this._gcmAAD,n),a=aesEncryptBlock(this._gcmJ0,this._roundKeys),o=new Uint8Array(16);for(let e=0;e<16;e++)o[e]=i[e]^a[e];let s=this._gcmExpectedTag,c=Math.min(s.length,16),l=0;for(let e=0;e<c;e++)l|=o[e]^s[e];if(l!==0)throw Error(`Unsupported state or unable to authenticate data`);return this._encodeWithUtf8Handling(t,e,!0)}if(this._mode===`ctr`||this._mode===`cfb`||this._mode===`ofb`){if(this._buffer.length>0){let t=this._processStream(this._buffer);return this._buffer=new Uint8Array,this._encodeWithUtf8Handling(t,e,!0)}return this._encodeWithUtf8Handling(new Uint8Array,e,!0)}if(this._buffer.length===0)return this._encodeWithUtf8Handling(new Uint8Array,e,!0);if(this._buffer.length%16!=0)throw Error(`bad decrypt`);let t=[];for(let e=0;e<this._buffer.length;e+=16)t.push(this._decryptBlock(this._buffer.slice(e,e+16)));let n=new Uint8Array(t.length*16);for(let e=0;e<t.length;e++)n.set(t[e],e*16);let r=this._autoPadding?pkcs7Unpad(n):n;return this._buffer=new Uint8Array,this._encodeWithUtf8Handling(r,e,!0)}_decryptBlock(e){if(this._mode===`cbc`){let t=aesDecryptBlock(e,this._roundKeys),n=new Uint8Array(16);for(let e=0;e<16;e++)n[e]=t[e]^this._prevBlock[e];return this._prevBlock=new Uint8Array(e),n}else if(this._mode===`ecb`)return aesDecryptBlock(e,this._roundKeys);throw Error(`Block decryption not supported for mode: ${this._mode}`)}_processStream(e){let t=new Uint8Array(e.length);for(let n=0;n<e.length;n+=16){let r=aesEncryptBlock(this._counter,this._roundKeys),i=Math.min(16,e.length-n);for(let a=0;a<i;a++)t[n+a]=e[n+a]^r[a];incrementCounter(this._counter)}return t}_processGcmDecrypt(e){let t=new Uint8Array(e.length);for(let n=0;n<e.length;n+=16){let r=aesEncryptBlock(this._counter,this._roundKeys),i=Math.min(16,e.length-n);for(let a=0;a<i;a++)t[n+a]=e[n+a]^r[a];gcmIncrementCounter(this._counter)}return t}}});function fillRandom(e){if(Oi)for(let t=0;t<e.length;t+=65536){let n=Math.min(e.length-t,65536),r=new Uint8Array(e.buffer,e.byteOffset+t,n);globalThis.crypto.getRandomValues(r)}else try{let t=imports.gi.GLib;for(let n=0;n<e.length;n++)e[n]=t.random_int_range(0,256)}catch{for(let t=0;t<e.length;t++)e[t]=Math.floor(Math.random()*256)}}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=q.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,q.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 q,e.byteOffset);fillRandom(new Uint8Array(e.buffer,n+t,r))}return e}function randomFill(e,t,n,r){let i,a,o;typeof t==`function`?(o=t,i=0,a=e.length):typeof n==`function`?(o=n,i=t,a=e.length-t):(o=r,i=t,a=n);try{randomFillSync(e,i,a),o(null,e)}catch(t){o(t,e)}}function randomUUID(){if(Oi&&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,a;if(typeof t==`function`?(a=t,i=e,r=0):typeof t==`number`?(r=e,i=t,a=n):(i=e,r=0,a=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 o=i-r,s=new Uint32Array(1);fillRandom(new Uint8Array(s.buffer));let c=r+s[0]%o;if(a)a(null,c);else return c}var Oi,ki=__esmMin(()=>{J(),Oi=globalThis.crypto!==void 0&&typeof globalThis.crypto.getRandomValues==`function`});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 Ai=__esmMin(()=>{});function bigIntToBuffer(e){if(e===0n)return q.from([0]);let t=e.toString(16);return t.length%2!=0&&(t=`0`+t),q.from(t,`hex`)}function bufferToBigInt(e){if(e.length===0)return 0n;let t=q.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 Mi){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 a=!0;for(let t=0;t<n-1;t++)if(i=modPow(i,2n,e),i===e-1n){a=!1;break}if(a)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 Ni)return Ni[n];let r=checkPrime(e,t);return Ni[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?q.from([140,123]):q.from([140,39]);let r=Math.ceil(e/8),i=2n,a=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+=a;else if(n===5n)for(;t%10n!=3n;)t+=a;let o=t>>1n;if(simpleSieve(o)&&simpleSieve(t)&&fermatTest(o)&&fermatTest(t)&&millerRabinTest(o)&&millerRabinTest(t))return bigIntToBuffer(t)}}function createDiffieHellman(e,t,n,r){if(t!==void 0&&typeof t!=`number`&&(q.isBuffer(t)||t instanceof Uint8Array||typeof t==`string`&&!(t in Pi)))return createDiffieHellman(e,`binary`,t,n);let i=t||`binary`,a=r||`binary`,o=q.from([2]);if(n!==void 0&&(typeof n==`number`?(o=q.alloc(1),o[0]=n):o=q.isBuffer(n)?n:q.from(n,a)),typeof e==`number`)return new DiffieHellman(generatePrime(e,o),o,!0);let s;return s=q.isBuffer(e)?e:e instanceof Uint8Array?q.from(e):q.from(e,i),new DiffieHellman(s,o,!0)}function getDiffieHellman(e){let t=ji[e];if(!t)throw Error(`Unknown group: ${e}. Supported groups: ${Object.keys(ji).join(`, `)}`);return new DiffieHellman(q.from(t.prime,`hex`),q.from(t.gen,`hex`),!1)}var ji,Mi,Ni,DiffieHellman,Pi,Fi,Ii,Li=__esmMin(()=>{Ai(),ki(),J(),ji={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`}},Mi=[];{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]||Mi.push(n)}Ni={},__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`?q.from(e,t||`utf8`):q.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 a=bigIntToBuffer(modPow(i,this._privKey,this._prime)),o=this._primeByteLength;if(a.length<o){let e=q.alloc(o);a.copy(e,o-a.length),a=e}return n?a.toString(n):a}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`?q.from(e,t||`utf8`):q.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`?q.from(e,t||`utf8`):q.from(e);this._privKey=bufferToBigInt(n)}},Pi={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},Fi=getDiffieHellman,Ii=getDiffieHellman});function mod(e,t){let n=e%t;return n<0n?n+t:n}function modInverse$2(e,t){if(e=mod(e,t),e===0n)throw Error(`No modular inverse for zero`);let[n,r]=[e,t],[i,a]=[1n,0n];for(;r!==0n;){let e=n/r;[n,r]=[r,n-e*r],[i,a]=[a,i-e*a]}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),a=mod(mod(t.y-e.y,r)*modInverse$2(i,r),r),o=mod(a*a-e.x-t.x,r);return{x:o,y:mod(a*(e.x-o)-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$2(mod(2n*e.y,r),r),r),a=mod(i*i-2n*e.x,r);return{x:a,y:mod(i*(e.x-a)-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,a=t,o=e.toString(2);for(let e=0;e<o.length;e++)o[e]===`1`?(i=pointAdd(i,a,n),a=pointDouble(a,n)):(a=pointAdd(i,a,n),i=pointDouble(i,n));return i}function bigintToBuffer(e,t){let n=e.toString(16).padStart(t*2,`0`);return q.from(n,`hex`)}function bufferToBigint(e){let t=q.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 q.concat([q.from([t]),r])}let i=bigintToBuffer(e.y,t);if(n===`hybrid`){let t=e.y%2n==0n?6:7;return q.concat([q.from([t]),r,i])}return q.concat([q.from([4]),r,i])}function decodePublicKey(e,t){let n=q.from(e);if(n.length===0)throw Error(`Invalid public key: empty buffer`);let r=n[0],{p:i,a,b:o,byteLength:s}=t;if(r===4||r===6||r===7){if(n.length!==1+2*s)throw Error(`Invalid public key length: expected ${1+2*s} bytes, got ${n.length}`);let e=bufferToBigint(n.subarray(1,1+s)),t=bufferToBigint(n.subarray(1+s));if(mod(t*t,i)!==mod(e*e*e+a*e+o,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+s)throw Error(`Invalid public key length: expected ${1+s} bytes, got ${n.length}`);let e=bufferToBigint(n.subarray(1,1+s)),t=sqrtMod(mod(e*e*e+a*e+o,i),i);if(t===null)throw Error(`Invalid public key: no valid y coordinate for the given x`);let c=r===3;return{x:e,y:t%2n!=0n===c?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 a=n,o=modPow(i,r,t),s=modPow(e,r,t),c=modPow(e,(r+1n)/2n,t);for(;;){if(s===0n)return 0n;if(s===1n)return c;let e=1n,n=mod(s*s,t);for(;n!==1n;)n=mod(n*n,t),e++;let r=modPow(o,modPow(2n,a-e-1n,t-1n),t);a=e,o=mod(r*r,t),s=mod(s*o,t),c=mod(c*r,t)}}function toBuffer$1(e,t){if(q.isBuffer(e))return e;if(e instanceof Uint8Array)return q.from(e);if(typeof e==`string`)return q.from(e,t||`utf8`);if(ArrayBuffer.isView(e))return q.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=zi[e.toLowerCase()];if(!t)throw Error(`Unsupported curve: ${e}`);let n=Ri[t];if(!n)throw Error(`Unsupported curve: ${e}`);return{canonical:t,params:n}}function createECDH(e){return new ECDH(e)}function getCurves(){return[`secp256k1`,`prime256v1`,`secp256r1`,`secp384r1`,`secp521r1`]}var Ri,zi,ECDH,Bi=__esmMin(()=>{Ai(),ki(),J(),Ri={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}},zi={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`},__name(modInverse$2,`modInverse`),__name(toBuffer$1,`toBuffer`),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 a={x:this._curve.Gx,y:this._curve.Gy};return this._publicKey=scalarMul(i,a,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$1(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$1(e,t);this._publicKey=decodePublicKey(n,this._curve)}setPrivateKey(e,t){let n=bufferToBigint(toBuffer$1(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)}}});function normalizeAlgorithm(e){return e.toLowerCase().replace(/-/g,``)}function hashSize(e){let t=Vi[normalizeAlgorithm(e)];if(t===void 0)throw Error(`Unknown hash algorithm: ${e}`);return t}function toBuffer(e,t){return typeof e==`string`?q.from(e,t||`utf8`):e instanceof DataView?q.from(e.buffer,e.byteOffset,e.byteLength):(e instanceof ArrayBuffer,q.from(e))}var Vi,Hi,Ui,Wi=__esmMin(()=>{J(),Vi={md5:16,sha1:20,sha256:32,sha384:48,sha512:64},Hi={md5:64,sha1:64,sha256:64,sha384:128,sha512:128},Ui=new Set([`md5`,`sha1`,`sha256`,`sha384`,`sha512`])});function getChecksumType(e){let t=Gi[normalizeAlgorithm(e)];if(t===void 0){let t=Error(`Unknown message digest: ${e}`);throw t.code=`ERR_CRYPTO_HASH_UNKNOWN`,t}return t}function getHashes(){return[`md5`,`sha1`,`sha256`,`sha384`,`sha512`]}function hash(e,t,n){return new Ki(e).update(t).digest(n)}var Gi,Ki,qi=__esmMin(()=>{Wi(),J(),A(),Gr(),Gi={md5:k.ChecksumType.MD5,sha1:k.ChecksumType.SHA1,sha256:k.ChecksumType.SHA256,sha384:k.ChecksumType.SHA384,sha512:k.ChecksumType.SHA512},Ki=class Hash extends Hr{_algorithm;_checksum;_finalized=!1;constructor(e){super();let t=normalizeAlgorithm(e),n=getChecksumType(t);this._algorithm=t,this._checksum=new k.Checksum(n)}update(e,t){if(this._finalized)throw Error(`Digest already called`);let n;if(typeof e==`string`){let r=normalizeEncoding(t);n=q.from(e,r)}else n=e instanceof Uint8Array?e:q.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=q.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 Hr.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,Ji=__esmMin(()=>{Wi(),qi(),J(),Gr(),Hmac=class extends Hr{_algorithm;_innerHash;_outerKeyPad;_finalized=!1;constructor(e,t){super();let n=normalizeAlgorithm(e);if(!Ui.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`?q.from(t,`utf8`):t instanceof Uint8Array?t:q.from(t);let i=Hi[n];if(r.length>i){let e=new Ki(n);e.update(r),r=e.digest()}let a=new Uint8Array(i);a.set(r);let o=new Uint8Array(i),s=new Uint8Array(i);for(let e=0;e<i;e++)o[e]=a[e]^54,s[e]=a[e]^92;this._outerKeyPad=s,this._innerHash=new Ki(n),this._innerHash.update(o)}update(e,t){if(this._finalized)throw Error(`Digest already called`);let n;if(typeof e==`string`){let r=normalizeEncoding(t);n=q.from(e,r)}else n=e instanceof Uint8Array?e:q.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 Ki(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=zi[e.toLowerCase()];if(!t)throw Error(`Unsupported curve: ${e}`);return Ri[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,a=n.length,o=new Uint8Array(a).fill(1),s=new Uint8Array(a).fill(0),c=bigIntToBytes(t,i),l=bigIntToBytes(mod(truncateHash(n,r),r.n),i),u=new Uint8Array(a+1+i+i);u.set(o,0),u[a]=0,u.set(c,a+1),u.set(l,a+1+i),s=hmacDigest$2(e,s,u),o=hmacDigest$2(e,s,o);let d=new Uint8Array(a+1+i+i);d.set(o,0),d[a]=1,d.set(c,a+1),d.set(l,a+1+i),s=hmacDigest$2(e,s,d),o=hmacDigest$2(e,s,o);for(let t=0;t<100;t++){let t=new Uint8Array;for(;t.length<i;){o=hmacDigest$2(e,s,o);let n=new Uint8Array(t.length+o.length);n.set(t,0),n.set(o,t.length),t=n}let n=truncateHash(t.slice(0,i),r);if(n>=1n&&n<r.n)return n;let c=new Uint8Array(a+1);c.set(o,0),c[a]=0,s=hmacDigest$2(e,s,c),o=hmacDigest$2(e,s,o)}throw Error(`RFC 6979: failed to generate valid k after 100 attempts`)}function ecdsaSign(e,t,n,r){let i=getCurve(r),a={x:i.Gx,y:i.Gy},o=bytesToBigInt(t),s=new Ki(e);s.update(n);let c=new Uint8Array(s.digest()),l=truncateHash(c,i),u=rfc6979(e,o,c,i),d=scalarMul(u,a,i);if(d===null)throw Error(`ECDSA: k * G is point at infinity`);let p=mod(d.x,i.n);if(p===0n)throw Error(`ECDSA: r is zero`);let m=mod(modInverse$2(u,i.n)*(l+p*o),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 a=getCurve(i),o={x:a.Gx,y:a.Gy},s=a.byteLength;if(t[0]!==4||t.length!==1+s*2)return!1;let c={x:bytesToBigInt(t.slice(1,1+s)),y:bytesToBigInt(t.slice(1+s))};if(n.length!==s*2)return!1;let l=bytesToBigInt(n.slice(0,s)),u=bytesToBigInt(n.slice(s));if(l<1n||l>=a.n||u<1n||u>=a.n)return!1;let d=new Ki(e);d.update(r);let p=truncateHash(new Uint8Array(d.digest()),a),m=modInverse$2(u,a.n),h=mod(p*m,a.n),g=mod(l*m,a.n),_=pointAdd(scalarMul(h,o,a),scalarMul(g,c,a),a);return _===null?!1:mod(_.x,a.n)===l}var Yi=__esmMin(()=>{Ai(),Bi(),qi(),Ji(),__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 a=Math.ceil(r/i);if(a>255)throw Error(`HKDF cannot generate more than 255 * HashLen bytes`);let o=q.allocUnsafe(a*i),s=q.alloc(0);for(let r=1;r<=a;r++)s=hmacDigest$1(e,t,q.concat([s,n,q.from([r])])),s.copy(o,(r-1)*i);return q.from(o.buffer,o.byteOffset,r)}function hkdfSync(e,t,n,r,i){let a=normalizeAlgorithm(e),o=Vi[a];if(!Ui.has(a)||o===void 0)throw TypeError(`Unknown message digest: ${e}`);if(typeof i!=`number`||i<0)throw TypeError(`keylen must be a non-negative number`);let s=toBuffer(t),c=toBuffer(n),l=toBuffer(r),u=hkdfExpand(a,hkdfExtract(a,s,c.length===0?q.alloc(o,0):c),l,i,o),d=new ArrayBuffer(u.length);return new Uint8Array(d).set(u),d}function hkdf(e,t,n,r,i,a){setTimeout(()=>{try{a(null,hkdfSync(e,t,n,r,i))}catch(e){a(e instanceof Error?e:Error(String(e)))}},0)}var Xi=__esmMin(()=>{Wi(),Ji(),J(),__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 a=toBuffer(e),o=toBuffer(t),s=normalizeAlgorithm(i||`sha1`),c=Vi[s];if(!Ui.has(s)||c===void 0)throw TypeError(`Unknown message digest: ${i||`sha1`}`);if(r===0)return q.alloc(0);let l=Math.ceil(r/c),u=q.allocUnsafe(l*c);for(let e=1;e<=l;e++){let t=q.allocUnsafe(o.length+4);o.copy(t,0),t.writeUInt32BE(e,o.length);let r=hmacDigest(s,a,t),i=q.from(r);for(let e=1;e<n;e++){r=hmacDigest(s,a,r);for(let e=0;e<c;e++)i[e]^=r[e]}i.copy(u,(e-1)*c)}return q.from(u.buffer,u.byteOffset,r)}function pbkdf2(e,t,n,r,i,a){validateParameters(n,r),setTimeout(()=>{try{a(null,pbkdf2Sync(e,t,n,r,i))}catch(e){a(e instanceof Error?e:Error(String(e)))}},0)}var Zi=__esmMin(()=>{Wi(),Ji(),J()});function R(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(t[0]+t[12],7),t[8]^=R(t[4]+t[0],9),t[12]^=R(t[8]+t[4],13),t[0]^=R(t[12]+t[8],18),t[9]^=R(t[5]+t[1],7),t[13]^=R(t[9]+t[5],9),t[1]^=R(t[13]+t[9],13),t[5]^=R(t[1]+t[13],18),t[14]^=R(t[10]+t[6],7),t[2]^=R(t[14]+t[10],9),t[6]^=R(t[2]+t[14],13),t[10]^=R(t[6]+t[2],18),t[3]^=R(t[15]+t[11],7),t[7]^=R(t[3]+t[15],9),t[11]^=R(t[7]+t[3],13),t[15]^=R(t[11]+t[7],18),t[1]^=R(t[0]+t[3],7),t[2]^=R(t[1]+t[0],9),t[3]^=R(t[2]+t[1],13),t[0]^=R(t[3]+t[2],18),t[6]^=R(t[5]+t[4],7),t[7]^=R(t[6]+t[5],9),t[4]^=R(t[7]+t[6],13),t[5]^=R(t[4]+t[7],18),t[11]^=R(t[10]+t[9],7),t[8]^=R(t[11]+t[10],9),t[9]^=R(t[8]+t[11],13),t[10]^=R(t[9]+t[8],18),t[12]^=R(t[15]+t[14],7),t[13]^=R(t[12]+t[15],9),t[14]^=R(t[13]+t[12],13),t[15]^=R(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 a=0;a<t;a++){let a=e[r-16]&t-1;for(let t=0;t<r;t++)e[t]^=i[a][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,a){let o=128*r,s=pbkdf2Sync(e,t,1,i*o,`sha256`);for(let e=0;e<i;e++){let t=new Uint8Array(s.buffer,s.byteOffset+e*o,o),i=bytesToWords(t);roMix(i,n,r);let a=wordsToBytes(i);t.set(a)}return pbkdf2Sync(e,s,1,a,`sha256`)}function scryptSync(e,t,n,r){let i=q.from(e),a=q.from(t),o=r?.N??16384,s=r?.r??8,c=r?.p??1;if(o<=0||o&o-1)throw Error(`N must be a positive power of 2`);return scryptCore(i,a,o,s,c,n)}function scrypt(e,t,n,r,i){let a={},o;typeof r==`function`?o=r:(a=r,o=i);try{let r=scryptSync(e,t,n,a);setTimeout(()=>o(null,r),0)}catch(e){setTimeout(()=>o(e instanceof Error?e:Error(String(e)),q.alloc(0)),0)}}var Qi=__esmMin(()=>{Zi(),J()});function pemToDer(e){let t=e.trim().split(/\r?\n/),n=t.findIndex(e=>e.startsWith(`-----BEGIN `));if(n===-1)throw Error(`Invalid PEM: no BEGIN line found`);let r=t[n].match(/^-----BEGIN (.+)-----$/);if(!r)throw Error(`Invalid PEM header format`);let i=r[1],a=t.findIndex((e,t)=>t>n&&e.startsWith(`-----END `));if(a===-1)throw Error(`Invalid PEM: no END line found`);let o=t.slice(n+1,a).join(``),s=q.from(o,`base64`);return{type:i,der:new Uint8Array(s.buffer,s.byteOffset,s.byteLength)}}function parseTlv(e,t){if(t>=e.length)throw Error(`ASN.1 parse error: unexpected end of data`);let n=e[t++],r,i=e[t++];if(i<128)r=i;else{let n=i&127;if(n===0)throw Error(`ASN.1 parse error: indefinite length not supported`);r=0;for(let i=0;i<n;i++)r=r<<8|e[t++]}let a=e.slice(t,t+r),o=t+r,s={tag:n,data:a};return n===48&&(s.children=parseSequenceChildren(a)),{value:s,next:o}}function parseSequenceChildren(e){let t=[],n=0;for(;n<e.length;){let{value:r,next:i}=parseTlv(e,n);t.push(r),n=i}return t}function parseDer(e){let{value:t}=parseTlv(e,0);return t}function integerToBigInt(e){let t=0;for(;t<e.length-1&&e[t]===0;)t++;let n=0n;for(let r=t;r<e.length;r++)n=n<<8n|BigInt(e[r]);return n}function oidsEqual(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function parseRsaPublicKeyPkcs1(e){let t=e.children;if(!t||t.length<2)throw Error(`Invalid PKCS#1 RSAPublicKey structure`);return{n:integerToBigInt(t[0].data),e:integerToBigInt(t[1].data)}}function parseRsaPrivateKeyPkcs1(e){let t=e.children;if(!t||t.length<6)throw Error(`Invalid PKCS#1 RSAPrivateKey structure`);return{n:integerToBigInt(t[1].data),e:integerToBigInt(t[2].data),d:integerToBigInt(t[3].data),p:integerToBigInt(t[4].data),q:integerToBigInt(t[5].data)}}function parseSubjectPublicKeyInfo(e){let t=e.children;if(!t||t.length<2)throw Error(`Invalid SubjectPublicKeyInfo structure`);let n=t[0];if(!n.children||n.children.length<1)throw Error(`Invalid AlgorithmIdentifier`);let r=n.children[0];if(r.tag!==6||!oidsEqual(r.data,$i))throw Error(`Unsupported algorithm: only RSA is supported`);let i=t[1];if(i.tag!==3)throw Error(`Expected BIT STRING for public key data`);return parseRsaPublicKeyPkcs1(parseDer(i.data.slice(1)))}function parsePrivateKeyInfo(e){let t=e.children;if(!t||t.length<3)throw Error(`Invalid PrivateKeyInfo structure`);let n=t[1];if(!n.children||n.children.length<1)throw Error(`Invalid AlgorithmIdentifier`);let r=n.children[0];if(r.tag!==6||!oidsEqual(r.data,$i))throw Error(`Unsupported algorithm: only RSA is supported`);let i=t[2];if(i.tag!==4)throw Error(`Expected OCTET STRING for private key data`);return parseRsaPrivateKeyPkcs1(parseDer(i.data))}function encodeLength(e){if(e<128)return new Uint8Array([e]);let t=[],n=e;for(;n>0;)t.unshift(n&255),n>>=8;return new Uint8Array([128|t.length,...t])}function encodeTlv(e,t){let n=encodeLength(t.length),r=new Uint8Array(1+n.length+t.length);return r[0]=e,r.set(n,1),r.set(t,1+n.length),r}function bigintToAsn1Integer(e){if(e===0n)return encodeTlv(2,new Uint8Array([0]));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[0]&128&&r.unshift(0),encodeTlv(2,new Uint8Array(r))}function encodeSequence(e){let t=0;for(let n of e)t+=n.length;let n=new Uint8Array(t),r=0;for(let t of e)n.set(t,r),r+=t.length;return encodeTlv(48,n)}function encodeBitString(e){let t=new Uint8Array(1+e.length);return t[0]=0,t.set(e,1),encodeTlv(3,t)}function encodeOctetString(e){return encodeTlv(4,e)}function encodeOid(e){return encodeTlv(6,e)}function encodeNull(){return new Uint8Array([5,0])}function encodeRsaPublicKeyPkcs1(e){return encodeSequence([bigintToAsn1Integer(e.n),bigintToAsn1Integer(e.e)])}function encodeSubjectPublicKeyInfo(e){return encodeSequence([encodeSequence([encodeOid($i),encodeNull()]),encodeBitString(encodeRsaPublicKeyPkcs1(e))])}function encodeRsaPrivateKeyPkcs1(e){let t=e.d%(e.p-1n),n=e.d%(e.q-1n),r=modInverse$1(e.q,e.p);return encodeSequence([bigintToAsn1Integer(0n),bigintToAsn1Integer(e.n),bigintToAsn1Integer(e.e),bigintToAsn1Integer(e.d),bigintToAsn1Integer(e.p),bigintToAsn1Integer(e.q),bigintToAsn1Integer(t),bigintToAsn1Integer(n),bigintToAsn1Integer(r)])}function encodePrivateKeyInfo(e){let t=encodeSequence([encodeOid($i),encodeNull()]),n=encodeOctetString(encodeRsaPrivateKeyPkcs1(e));return encodeSequence([bigintToAsn1Integer(0n),t,n])}function derToPem(e,t){let n=q.from(e).toString(`base64`),r=[`-----BEGIN ${t}-----`];for(let e=0;e<n.length;e+=64)r.push(n.substring(e,e+64));return r.push(`-----END ${t}-----`),r.join(`
6
+ `)}function modInverse$1(e,t){let[n,r]=[e%t,t],[i,a]=[1n,0n];for(;r!==0n;){let e=n/r;[n,r]=[r,n-e*r],[i,a]=[a,i-e*a]}return(i%t+t)%t}function parseX509(e){let{der:t}=pemToDer(e);return parseX509Der(t)}function parseX509Der(e){let t=parseDer(e);if(t.tag!==48||!t.children||t.children.length<3)throw Error(`Invalid X.509 certificate structure`);let n=t.children[0],r=t.children[1],i=t.children[2];if(!n.children||n.children.length<6)throw Error(`Invalid TBSCertificate structure`);let a=0;n.children[0].tag===160&&a++;let o=integerToBigInt(n.children[a].data);a++,a++;let s=parseDN(n.children[a]);a++;let c=n.children[a],l=parseAsn1Time(c.children[0]),u=parseAsn1Time(c.children[1]);a++;let d=parseDN(n.children[a]);a++;let p=null,m=`unknown`;if(a<n.children.length){let e=n.children[a];try{if(e.children&&e.children.length>=2){let t=e.children[0];if(t.children&&t.children.length>=1){let n=t.children[0];n.tag===6&&oidsEqual(n.data,$i)&&(m=`rsa`,p=parseSubjectPublicKeyInfo(e))}}}catch{}a++}let h,g;for(let e=a;e<n.children.length;e++){let t=n.children[e];if(t.tag===163&&t.data.length>0){let e=parseDer(t.data);if(e.children){g=e.children;let t=new Uint8Array([85,29,17]);for(let n of e.children)if(n.children&&n.children.length>=2){let e=n.children[0];if(e.tag===6&&oidsEqual(e.data,t)){let e=n.children[n.children.length-1];h=parseSAN(e.data)}}}}}let _=`unknown`;r.children&&r.children.length>=1&&(_=oidToName(r.children[0].data));let v=i.tag===3?i.data.slice(1):i.data;return{raw:e,tbsCertificate:n.data,serialNumber:o,issuer:s,subject:d,validFrom:l,validTo:u,publicKey:p,publicKeyAlgorithm:m,signatureAlgorithm:_,signature:v,subjectAltName:h,extensions:g}}function decodeOidString(e){if(e.length===0)return``;let t=[];t.push(Math.floor(e[0]/40)),t.push(e[0]%40);let n=0;for(let r=1;r<e.length;r++)n=n<<7|e[r]&127,e[r]&128||(t.push(n),n=0);return t.join(`.`)}function oidToName(e){let t=decodeOidString(e);return ta[t]||t}function parseDN(e){if(!e.children)return``;let t=[];for(let n of e.children){let e=n.tag===49?parseSequenceChildren(n.data):n.children||[];for(let n of e)if(n.children&&n.children.length>=2){let e=n.children[0].data,r=decodeOidString(e),i=ea[r]||r,a=n.children[1].data,o=new TextDecoder().decode(a);t.push(`${i}=${o}`)}}return t.join(`, `)}function parseAsn1Time(e){let t=new TextDecoder().decode(e.data);if(e.tag===23){let e=parseInt(t.substring(0,2),10);e=e>=50?1900+e:2e3+e;let n=parseInt(t.substring(2,4),10)-1,r=parseInt(t.substring(4,6),10),i=parseInt(t.substring(6,8),10),a=parseInt(t.substring(8,10),10),o=parseInt(t.substring(10,12),10);return new Date(Date.UTC(e,n,r,i,a,o))}if(e.tag===24){let e=parseInt(t.substring(0,4),10),n=parseInt(t.substring(4,6),10)-1,r=parseInt(t.substring(6,8),10),i=parseInt(t.substring(8,10),10),a=parseInt(t.substring(10,12),10),o=parseInt(t.substring(12,14),10);return new Date(Date.UTC(e,n,r,i,a,o))}throw Error(`Unsupported time tag: 0x${e.tag.toString(16)}`)}function parseSAN(e){let t=[];try{let n=parseDer(e);if(n.tag===48&&n.children){for(let e of n.children)if(e.tag===130)t.push(`DNS:`+new TextDecoder().decode(e.data));else if(e.tag===135){if(e.data.length===4)t.push(`IP Address:`+e.data.join(`.`));else if(e.data.length===16){let n=[];for(let t=0;t<16;t+=2)n.push((e.data[t]<<8|e.data[t+1]).toString(16));t.push(`IP Address:`+n.join(`:`))}}}}catch{}return t}function parsePemKey(e){let{type:t,der:n}=pemToDer(e),r=parseDer(n);if(r.tag!==48)throw Error(`Invalid key format: expected top-level SEQUENCE`);switch(t){case`RSA PUBLIC KEY`:return{type:`rsa-public`,components:parseRsaPublicKeyPkcs1(r)};case`PUBLIC KEY`:return{type:`rsa-public`,components:parseSubjectPublicKeyInfo(r)};case`RSA PRIVATE KEY`:return{type:`rsa-private`,components:parseRsaPrivateKeyPkcs1(r)};case`PRIVATE KEY`:return{type:`rsa-private`,components:parsePrivateKeyInfo(r)};default:throw Error(`Unsupported PEM type: ${t}`)}}function rsaKeySize(e){let t=0,n=e;for(;n>0n;)t++,n>>=1n;return Math.ceil(t/8)}var $i,ea,ta,na=__esmMin(()=>{J(),$i=new Uint8Array([42,134,72,134,247,13,1,1,1]),__name(modInverse$1,`modInverse`),ea={"2.5.4.3":`CN`,"2.5.4.6":`C`,"2.5.4.7":`L`,"2.5.4.8":`ST`,"2.5.4.10":`O`,"2.5.4.11":`OU`,"1.2.840.113549.1.9.1":`emailAddress`},ta={"1.2.840.113549.1.1.1":`rsaEncryption`,"1.2.840.113549.1.1.5":`sha1WithRSAEncryption`,"1.2.840.113549.1.1.11":`sha256WithRSAEncryption`,"1.2.840.113549.1.1.12":`sha384WithRSAEncryption`,"1.2.840.113549.1.1.13":`sha512WithRSAEncryption`}});function normalizeSignAlgorithm(e){let t=e.toLowerCase().replace(/-/g,``);if(t.startsWith(`rsa`)&&(t=t.slice(3)),!ra[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(q.isBuffer(e)||e instanceof Uint8Array)return q.from(e).toString(`utf8`);if(e&&typeof e==`object`&&`key`in e){let t=e.key;if(typeof t==`string`)return t;if(q.isBuffer(t)||t instanceof Uint8Array)return q.from(t).toString(`utf8`)}throw TypeError(`Invalid key argument`)}function createSign(e){return new Sign(e)}function createVerify(e){return new Verify(e)}var ra,Sign,Verify,ia=__esmMin(()=>{na(),Ai(),qi(),J(),ra={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 Ki(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(r.type!==`rsa-private`)throw Error(`privateKey must be an RSA private key`);let{n:i,d:a}=r.components,o=rsaKeySize(i),s=ra[this._algorithm],c=new Uint8Array(s.length+n.length);c.set(s,0),c.set(n,s.length);let l=o-c.length-3;if(l<8)throw Error(`Key is too short for the specified hash algorithm`);let u=new Uint8Array(o);u[0]=0,u[1]=1;for(let e=2;e<2+l;e++)u[e]=255;u[2+l]=0,u.set(c,3+l);let d=bigIntToBytes(modPow(bytesToBigInt(u),a,i),o),p=q.from(d);return t?p.toString(t):p}},Verify=class{_algorithm;_hash;_finalized=!1;constructor(e){this._algorithm=normalizeSignAlgorithm(e),this._hash=new Ki(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)),a,o;if(i.type===`rsa-public`)a=i.components.n,o=i.components.e;else if(i.type===`rsa-private`)a=i.components.n,o=i.components.e;else throw Error(`publicKey must be an RSA public or private key`);let s=rsaKeySize(a),c;if(c=typeof t==`string`?q.from(t,n||`base64`):t instanceof Uint8Array?t:q.from(t),c.length!==s)return!1;let l=bytesToBigInt(c);if(l>=a)return!1;let u=bigIntToBytes(modPow(l,o,a),s);if(u[0]!==0||u[1]!==1)return!1;let d=2;for(;d<u.length&&u[d]===255;)d++;if(d>=u.length||u[d]!==0||d-2<8)return!1;d++;let p=u.slice(d),m=ra[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 extractPem(e){if(typeof e==`string`)return e;if(q.isBuffer(e)||e instanceof Uint8Array)return q.from(e).toString(`utf8`);if(e&&typeof e==`object`&&`key`in e){let t=e.key;if(typeof t==`string`)return t;if(q.isBuffer(t)||t instanceof Uint8Array)return q.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 a=randomBytes(r);for(let e=0;e<r;e++){for(;a[e]===0;)a[e]=randomBytes(1)[0];i[2+e]=a[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 a=rsaKeySize(r),o=modPow(bytesToBigInt(pkcs1v15Type2Pad(t instanceof Uint8Array?t:q.from(t),a)),i,r);return q.from(bigIntToBytes(o,a))}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,a=rsaKeySize(r),o=t instanceof Uint8Array?t:q.from(t);if(o.length!==a)throw Error(`Data length (${o.length}) does not match key length (${a})`);let s=bytesToBigInt(o);if(s>=r)throw Error(`Decryption error: cipher value out of range`);let c=bigIntToBytes(modPow(s,i,r),a);return q.from(pkcs1v15Type2Unpad(c))}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,a=rsaKeySize(r),o=modPow(bytesToBigInt(pkcs1v15Type1Pad(t instanceof Uint8Array?t:q.from(t),a)),i,r);return q.from(bigIntToBytes(o,a))}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 a=rsaKeySize(r),o=t instanceof Uint8Array?t:q.from(t);if(o.length!==a)throw Error(`Data length (${o.length}) does not match key length (${a})`);let s=bytesToBigInt(o);if(s>=r)throw Error(`Decryption error: cipher value out of range`);let c=bigIntToBytes(modPow(s,i,r),a);return q.from(pkcs1v15Type1Unpad(c))}var aa=__esmMin(()=>{na(),Ai(),ki(),J()});function mgf1(e,t,n){let r=new Uint8Array(n),i=0,a=0;for(;i<n;){let o=new Uint8Array(4);o[0]=a>>>24&255,o[1]=a>>>16&255,o[2]=a>>>8&255,o[3]=a&255;let s=new Ki(e);s.update(t),s.update(o);let c=new Uint8Array(s.digest()),l=Math.min(c.length,n-i);r.set(c.slice(0,l),i),i+=l,a++}return r}var oa=__esmMin(()=>{qi()});function hashDigest$1(e,t){let n=new Ki(e);return n.update(t),new Uint8Array(n.digest())}function emsaPssEncode(e,t,n,r){let i=hashSize(n),a=Math.ceil(t/8);if(a<i+r+2)throw Error(`RSA-PSS: encoding error — key too short`);let o=r>0?new Uint8Array(randomBytes(r)):new Uint8Array,s=new Uint8Array(8+i+r);s.set(e,8),s.set(o,8+i);let c=hashDigest$1(n,s),l=a-i-1,u=new Uint8Array(l);u[l-r-1]=1,u.set(o,l-r);let d=mgf1(n,c,l),p=new Uint8Array(l);for(let e=0;e<l;e++)p[e]=u[e]^d[e];let m=8*a-t;m>0&&(p[0]&=255>>>m);let h=new Uint8Array(a);return h.set(p,0),h.set(c,l),h[a-1]=188,h}function emsaPssVerify(e,t,n,r,i){let a=hashSize(r),o=Math.ceil(n/8);if(o<a+i+2||t[o-1]!==188)return!1;let s=o-a-1,c=t.slice(0,s),l=t.slice(s,s+a),u=8*o-n;if(u>0&&c[0]&255<<8-u)return!1;let d=mgf1(r,l,s),p=new Uint8Array(s);for(let e=0;e<s;e++)p[e]=c[e]^d[e];u>0&&(p[0]&=255>>>u);for(let e=0;e<s-i-1;e++)if(p[e]!==0)return!1;if(p[s-i-1]!==1)return!1;let m=p.slice(s-i),h=new Uint8Array(8+a+i);h.set(e,8),h.set(m,8+a);let g=hashDigest$1(r,h);if(l.length!==g.length)return!1;let _=0;for(let e=0;e<l.length;e++)_|=l[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:a,d:o}=i.components,s=rsaKeySize(a),c=Math.ceil(s/8);return bigIntToBytes(modPow(bytesToBigInt(emsaPssEncode(hashDigest$1(e,n),s-1,e,r)),o,a),c)}function rsaPssVerify(e,t,n,r,i){let a=parsePemKey(t),o,s;if(a.type===`rsa-public`)({n:o,e:s}=a.components);else if(a.type===`rsa-private`)({n:o,e:s}=a.components);else throw Error(`RSA-PSS: expected RSA key`);let c=rsaKeySize(o),l=Math.ceil(c/8);if(n.length!==l)return!1;let u=bigIntToBytes(modPow(bytesToBigInt(n),s,o),Math.ceil((c-1)/8));return emsaPssVerify(hashDigest$1(e,r),u,c-1,e,i)}var sa=__esmMin(()=>{na(),Ai(),Wi(),ki(),qi(),oa(),__name(hashDigest$1,`hashDigest`)});function hashDigest(e,t){let n=new Ki(e);return n.update(t),new Uint8Array(n.digest())}function rsaOaepEncrypt(e,t,n,r){let i=parsePemKey(t),a,o;if(i.type===`rsa-public`)({n:a,e:o}=i.components);else if(i.type===`rsa-private`)({n:a,e:o}=i.components);else throw Error(`RSA-OAEP: expected RSA key`);let s=Math.ceil(rsaKeySize(a)/8),c=hashSize(e);if(n.length>s-2*c-2)throw Error(`RSA-OAEP: message too long`);let l=hashDigest(e,r||new Uint8Array),u=s-c-1,d=new Uint8Array(u);d.set(l,0),d[u-n.length-1]=1,d.set(n,u-n.length);let p=new Uint8Array(randomBytes(c)),m=mgf1(e,p,u),h=new Uint8Array(u);for(let e=0;e<u;e++)h[e]=d[e]^m[e];let g=mgf1(e,h,c),_=new Uint8Array(c);for(let e=0;e<c;e++)_[e]=p[e]^g[e];let v=new Uint8Array(s);return v[0]=0,v.set(_,1),v.set(h,1+c),bigIntToBytes(modPow(bytesToBigInt(v),o,a),s)}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:a,d:o}=i.components,s=Math.ceil(rsaKeySize(a)/8),c=hashSize(e);if(n.length!==s||s<2*c+2)throw Error(`RSA-OAEP: decryption error`);let l=bigIntToBytes(modPow(bytesToBigInt(n),o,a),s),u=l[0],d=l.slice(1,1+c),p=l.slice(1+c),m=s-c-1,h=mgf1(e,p,c),g=new Uint8Array(c);for(let e=0;e<c;e++)g[e]=d[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,c),x=+(u===0);for(let e=0;e<c;e++)x&=+(y[e]===b[e]);let S=-1;for(let e=c;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 ca=__esmMin(()=>{na(),Ai(),Wi(),ki(),qi(),oa()});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 q.from(r).toString(`base64url`)}function base64urlToBigint(e){let t=q.from(e,`base64url`),n=0n;for(let e=0;e<t.length;e++)n=n<<8n|BigInt(t[e]);return n}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:a,q:o}=e.components,s=i%(a-1n),c=i%(o-1n),l=modInverse(o,a);return{kty:`RSA`,n:bigintToBase64url(n),e:bigintToBase64url(r),d:bigintToBase64url(i),p:bigintToBase64url(a),q:bigintToBase64url(o),dp:bigintToBase64url(s),dq:bigintToBase64url(c),qi:bigintToBase64url(l)}}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`?q.from(encodeRsaPublicKeyPkcs1(e.components)):q.from(encodeSubjectPublicKeyInfo(e.components));if(e.type===`rsa-private`&&t===`public`){let t={n:e.components.n,e:e.components.e};return n===`pkcs1`?q.from(encodeRsaPublicKeyPkcs1(t)):q.from(encodeSubjectPublicKeyInfo(t))}if(e.type===`rsa-private`)return n===`pkcs8`?q.from(encodePrivateKeyInfo(e.components)):q.from(encodeRsaPrivateKeyPkcs1(e.components));throw Error(`Cannot generate DER for this key type`)}function modInverse(e,t){let[n,r]=[e%t,t],[i,a]=[1n,0n];for(;r!==0n;){let e=n/r;[n,r]=[r,n-e*r],[i,a]=[a,i-e*a]}return(i%t+t)%t}function createSecretKey(e,t){let n;return n=typeof e==`string`?q.from(e,t??`utf8`):new Uint8Array(e),new la(`secret`,n)}function createPublicKey(e){if(e instanceof la){if(e.type===`public`)return e;if(e.type===`private`){let t=e._handle;if(t.parsed.type===`rsa-private`){let e={n:t.parsed.components.n,e:t.parsed.components.e};return new la(`public`,{parsed:{type:`rsa-public`,components:e},pem:derToPem(encodeSubjectPublicKeyInfo(e),`PUBLIC KEY`)})}}throw TypeError(`Cannot create public key from secret key`)}if(typeof e==`object`&&!q.isBuffer(e)&&`key`in e){let t=e;if(t.format===`jwk`){let e=t.key;if(e.kty===`RSA`){let{parsed:t,pem:n}=importJwkRsa({n:e.n,e:e.e});return new la(`public`,{parsed:t,pem:n})}throw Error(`Unsupported JWK key type: ${e.kty}`)}}let t=normalizePem(e),n=parsePemKey(t);if(n.type===`rsa-private`){let e={n:n.components.n,e:n.components.e};return new la(`public`,{parsed:{type:`rsa-public`,components:e},pem:derToPem(encodeSubjectPublicKeyInfo(e),`PUBLIC KEY`)})}return new la(`public`,{parsed:n,pem:t})}function createPrivateKey(e){if(typeof e==`object`&&!q.isBuffer(e)&&`key`in e){let t=e;if(t.format===`jwk`){let e=t.key;if(e.kty===`RSA`&&e.d){let{parsed:t,pem:n}=importJwkRsa(e);return new la(`private`,{parsed:t,pem:n})}throw Error(`JWK does not contain a private key`)}}let t=normalizePem(e),n=parsePemKey(t);if(n.type!==`rsa-private`)throw TypeError(`Key is not a private key`);return new la(`private`,{parsed:n,pem:t})}function normalizePem(e){if(typeof e==`string`)return e;if(q.isBuffer(e))return e.toString(`utf8`);if(e&&typeof e==`object`&&`key`in e){let t=e;if(typeof t.key==`string`)return t.key;if(q.isBuffer(t.key))return t.key.toString(t.encoding??`utf8`);if(t.key instanceof la)return t.key.export({format:`pem`})}throw TypeError(`Invalid key input`)}var la,ua=__esmMin(()=>{na(),J(),la=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;if(e.parsed.type===`rsa-public`||e.parsed.type===`rsa-private`)return`rsa`}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:q.from(t).toString(`base64url`)}:q.from(t)}let t=this._handle,n=e?.format??`pem`,r=e?.type;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 q.from(i,`base64`)}return generateDer(t.parsed,this.type,r)}throw TypeError(`Unsupported export format: ${n}`)}get[Symbol.toStringTag](){return`KeyObject`}}});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,da=__esmMin(()=>{na(),ua(),ma(),J(),X509Certificate=class{_components;_pem;constructor(e){if(typeof e==`string`)this._pem=e,this._components=parseX509(e);else{let t=q.isBuffer(e)?e:q.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 q.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 la(`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`}}}),fa=__exportAll$4({DiffieHellman:()=>DiffieHellman,DiffieHellmanGroup:()=>Ii,Hash:()=>Ki,Hmac:()=>Hmac,KeyObject:()=>la,Sign:()=>Sign,Verify:()=>Verify,X509Certificate:()=>X509Certificate,constants:()=>yi,createCipher:()=>createCipher,createCipheriv:()=>createCipheriv,createDecipher:()=>createDecipher,createDecipheriv:()=>createDecipheriv,createDiffieHellman:()=>createDiffieHellman,createDiffieHellmanGroup:()=>Fi,createECDH:()=>createECDH,createHash:()=>createHash,createHmac:()=>createHmac,createPrivateKey:()=>createPrivateKey,createPublicKey:()=>createPublicKey,createSecretKey:()=>createSecretKey,createSign:()=>createSign,createVerify:()=>createVerify,default:()=>pa,ecdsaSign:()=>ecdsaSign,ecdsaVerify:()=>ecdsaVerify,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,timingSafeEqual:()=>timingSafeEqual});function createHash(e){return new Ki(e)}function createHmac(e,t){return new Hmac(e,t)}var pa,ma=__esmMin(()=>{bi(),xi(),Di(),ki(),Li(),Bi(),qi(),Ji(),Yi(),Xi(),Zi(),Qi(),ia(),aa(),oa(),sa(),ca(),ua(),da(),pa={Hash:Ki,getHashes,hash,Hmac,randomBytes,randomFill,randomFillSync,randomUUID,randomInt,timingSafeEqual,constants:yi,pbkdf2,pbkdf2Sync,hkdf,hkdfSync,scrypt,scryptSync,createHash,createHmac,createCipher,createCipheriv,createDecipher,createDecipheriv,getCiphers,Sign,Verify,createSign,createVerify,createDiffieHellman,getDiffieHellman,DiffieHellman,DiffieHellmanGroup:Ii,createDiffieHellmanGroup:Fi,createECDH,getCurves,ecdsaSign,ecdsaVerify,publicEncrypt,privateDecrypt,privateEncrypt,publicDecrypt,rsaPssSign,rsaPssVerify,rsaOaepEncrypt,rsaOaepDecrypt,mgf1,KeyObject:la,createSecretKey,createPublicKey,createPrivateKey,X509Certificate}});let ha=!1,ga,_a,va,ya,ba,xa,Sa,Ca,wa,Ta,Ea,Da,Oa,ka,Aa,ja;async function loadCrypto(){if(ha)return;let e=await Promise.resolve().then(()=>(ma(),fa));ga=e.createHash,_a=e.createHmac,va=e.createCipheriv,ya=e.createDecipheriv,ba=e.createSign,xa=e.createVerify,Sa=e.pbkdf2Sync,Ca=e.hkdfSync,wa=e.createECDH,Ta=e.randomBytes,e.publicEncrypt,e.privateDecrypt,e.createPublicKey,e.createPrivateKey,Ea=e.ecdsaSign,Da=e.ecdsaVerify,Oa=e.rsaPssSign,ka=e.rsaPssVerify,Aa=e.rsaOaepEncrypt,ja=e.rsaOaepDecrypt,ha=!0}const Ma=loadCrypto();var SubtleCrypto=class{async digest(e,t){await Ma;let n=toNodeHashName(normalizeAlgorithm$1(e).name),r=toUint8Array(t),i=ga(n);i.update(r);let a=i.digest();return a.buffer.slice(a.byteOffset,a.byteOffset+a.byteLength)}async generateKey(e,t,n){await Ma;let r=normalizeAlgorithm$1(e);switch(r.name.toUpperCase()){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 a=Ta(i/8);return new CryptoKey(`secret`,t,{name:r.name,length:i},n,new Uint8Array(a))}case`HMAC`:{let r=e,i=normalizeAlgorithm$1(r.hash),a=r.length||hashSize$1(i.name)*8;validateUsages(n,[`sign`,`verify`]);let o=Ta(Math.ceil(a/8));return new CryptoKey(`secret`,t,{name:`HMAC`,hash:{name:i.name},length:a},n,new Uint8Array(o))}case`ECDH`:{let r=e.namedCurve,i=toNodeCurveName(r);validateUsages(n,[`deriveKey`,`deriveBits`]);let a=wa(i);a.generateKeys();let o=new Uint8Array(a.getPublicKey()),s=new Uint8Array(a.getPrivateKey());return{publicKey:new CryptoKey(`public`,!0,{name:`ECDH`,namedCurve:r},[],o),privateKey:new CryptoKey(`private`,t,{name:`ECDH`,namedCurve:r},n,{pub:o,priv:s})}}case`ECDSA`:{let r=e.namedCurve,i=toNodeCurveName(r);validateUsages(n,[`sign`,`verify`]);let a=wa(i);a.generateKeys();let o=new Uint8Array(a.getPublicKey()),s=new Uint8Array(a.getPrivateKey());return{publicKey:new CryptoKey(`public`,!0,{name:`ECDSA`,namedCurve:r},[`verify`],o),privateKey:new CryptoKey(`private`,t,{name:`ECDSA`,namedCurve:r},[`sign`],{pub:o,priv:s})}}default:throw new DOMException(`Unsupported algorithm: ${r.name}`,`NotSupportedError`)}}async importKey(e,t,n,r,i){await Ma;let a=normalizeAlgorithm$1(n),o=a.name.toUpperCase();switch(o){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:a.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:a.name,length:n.length*8},i,n)}throw new DOMException(`Unsupported format: ${e}`,`NotSupportedError`);case`HMAC`:{let a=normalizeAlgorithm$1(n.hash);if(e===`raw`){let e=toUint8Array(t);return validateUsages(i,[`sign`,`verify`]),new CryptoKey(`secret`,r,{name:`HMAC`,hash:{name:a.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:a.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 s=n.namedCurve;if(e===`raw`){let e=toUint8Array(t);return o===`ECDH`?i.length>0&&validateUsages(i,[`deriveKey`,`deriveBits`]):validateUsages(i,[`verify`]),new CryptoKey(`public`,r,{name:a.name,namedCurve:s},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),c=base64urlDecode(e.y),l=new Uint8Array(1+n.length+c.length);return l[0]=4,l.set(n,1),l.set(c,1+n.length),validateUsages(i,o===`ECDH`?[`deriveKey`,`deriveBits`]:[`sign`]),new CryptoKey(`private`,r,{name:a.name,namedCurve:s},i,{pub:l,priv:t})}else{let t=base64urlDecode(e.x),n=base64urlDecode(e.y),c=new Uint8Array(1+t.length+n.length);return c[0]=4,c.set(t,1),c.set(n,1+t.length),o===`ECDH`?i.length>0&&validateUsages(i,[`deriveKey`,`deriveBits`]):validateUsages(i,[`verify`]),new CryptoKey(`public`,r,{name:a.name,namedCurve:s},i,c)}}throw new DOMException(`Unsupported format: ${e}`,`NotSupportedError`)}default:throw new DOMException(`Unsupported algorithm: ${a.name}`,`NotSupportedError`)}}async exportKey(e,t){if(!t.extractable)throw new DOMException(`Key is not extractable`,`InvalidAccessError`);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),a=n.slice(1+r),o={kty:`EC`,crv:e,x:base64urlEncode(i),y:base64urlEncode(a),ext:t.extractable,key_ops:[...t.usages]};return t.type===`private`&&(o.d=base64urlEncode(t._handle.priv)),o}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){await Ma,checkUsage(t,`encrypt`);let r=normalizeAlgorithm$1(e),i=r.name.toUpperCase(),a=toUint8Array(n);switch(i){case`AES-CBC`:{let n=toUint8Array(e.iv),r=t._handle,i=r.length*8,o=va(`aes-${i}-cbc`,r,n),s=o.update(a),c=o.final(),l=new Uint8Array(s.length+c.length);return l.set(new Uint8Array(s),0),l.set(new Uint8Array(c),s.length),l.buffer}case`AES-CTR`:{let n=toUint8Array(e.counter),r=t._handle,i=r.length*8,o=va(`aes-${i}-ctr`,r,n),s=o.update(a),c=o.final(),l=new Uint8Array(s.length+c.length);return l.set(new Uint8Array(s),0),l.set(new Uint8Array(c),s.length),l.buffer}case`AES-GCM`:{let n=e,r=toUint8Array(n.iv),i=n.additionalData?toUint8Array(n.additionalData):void 0,o=t._handle,s=o.length*8,c=va(`aes-${s}-gcm`,o,r);i&&c.setAAD(i);let l=c.update(a),u=c.final(),d=c.getAuthTag(),p=new Uint8Array(l.length+u.length+d.length);return p.set(new Uint8Array(l),0),p.set(new Uint8Array(u),l.length),p.set(new Uint8Array(d),l.length+u.length),p.buffer}case`RSA-OAEP`:{let n=t.algorithm.hash.name,r=toNodeHashName(n),i=t._handle,o=e,s=o.label?toUint8Array(o.label):void 0,c=Aa(r,i.pem,a,s);return c.buffer.slice(c.byteOffset,c.byteOffset+c.byteLength)}default:throw new DOMException(`Unsupported algorithm: ${r.name}`,`NotSupportedError`)}}async decrypt(e,t,n){await Ma,checkUsage(t,`decrypt`);let r=normalizeAlgorithm$1(e),i=r.name.toUpperCase(),a=toUint8Array(n);switch(i){case`AES-CBC`:{let n=toUint8Array(e.iv),r=t._handle,i=r.length*8,o=ya(`aes-${i}-cbc`,r,n),s=o.update(a),c=o.final(),l=new Uint8Array(s.length+c.length);return l.set(new Uint8Array(s),0),l.set(new Uint8Array(c),s.length),l.buffer}case`AES-CTR`:{let n=toUint8Array(e.counter),r=t._handle,i=r.length*8,o=ya(`aes-${i}-ctr`,r,n),s=o.update(a),c=o.final(),l=new Uint8Array(s.length+c.length);return l.set(new Uint8Array(s),0),l.set(new Uint8Array(c),s.length),l.buffer}case`AES-GCM`:{let n=e,r=toUint8Array(n.iv),i=(n.tagLength||128)/8,o=n.additionalData?toUint8Array(n.additionalData):void 0,s=t._handle,c=s.length*8,l=a.slice(0,a.length-i),u=a.slice(a.length-i),d=ya(`aes-${c}-gcm`,s,r);d.setAuthTag(u),o&&d.setAAD(o);let p=d.update(l),m=d.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,o=e,s=o.label?toUint8Array(o.label):void 0,c=ja(r,i.pem,a,s);return c.buffer.slice(c.byteOffset,c.byteOffset+c.byteLength)}default:throw new DOMException(`Unsupported algorithm: ${r.name}`,`NotSupportedError`)}}async sign(e,t,n){await Ma,checkUsage(t,`sign`);let r=normalizeAlgorithm$1(e),i=r.name.toUpperCase(),a=toUint8Array(n);switch(i){case`HMAC`:{let e=t.algorithm.hash.name,n=toNodeHashName(e),r=t._handle,i=_a(n,r);i.update(a);let o=i.digest();return o.buffer.slice(o.byteOffset,o.byteOffset+o.byteLength)}case`RSASSA-PKCS1-V1_5`:{let e=t.algorithm.hash.name,n=toNodeHashName(e),r=t._handle,i=ba(n);i.update(a);let o=i.sign(r.pem);return o.buffer.slice(o.byteOffset,o.byteOffset+o.byteLength)}case`ECDSA`:{let n=e,r=toNodeHashName(typeof n.hash==`string`?n.hash:n.hash.name),i=t.algorithm.namedCurve,o=t._handle,s=Ea(r,o.priv,a,i);return s.buffer.slice(s.byteOffset,s.byteOffset+s.byteLength)}case`RSA-PSS`:{let n=t.algorithm.hash.name,r=toNodeHashName(n),i=t._handle,o=e.saltLength??hashSize$1(n),s=Oa(r,i.pem,a,o);return s.buffer.slice(s.byteOffset,s.byteOffset+s.byteLength)}default:throw new DOMException(`Unsupported algorithm: ${r.name}`,`NotSupportedError`)}}async verify(e,t,n,r){await Ma,checkUsage(t,`verify`);let i=normalizeAlgorithm$1(e),a=i.name.toUpperCase(),o=toUint8Array(r),s=toUint8Array(n);switch(a){case`HMAC`:{let e=t.algorithm.hash.name,n=toNodeHashName(e),r=t._handle,i=_a(n,r);i.update(o);let a=new Uint8Array(i.digest());if(a.length!==s.length)return!1;let c=0;for(let e=0;e<a.length;e++)c|=a[e]^s[e];return c===0}case`RSASSA-PKCS1-V1_5`:{let e=t.algorithm.hash.name,n=toNodeHashName(e),r=t._handle,i=xa(n);return i.update(o),i.verify(r.pem,s)}case`ECDSA`:{let n=e,r=toNodeHashName(typeof n.hash==`string`?n.hash:n.hash.name),i=t.algorithm.namedCurve,a=t._handle;return Da(r,a,s,o,i)}case`RSA-PSS`:{let n=t.algorithm.hash.name,r=toNodeHashName(n),i=t._handle,a=e.saltLength??hashSize$1(n);return ka(r,i.pem,s,o,a)}default:throw new DOMException(`Unsupported algorithm: ${i.name}`,`NotSupportedError`)}}async _deriveBitsInternal(e,t,n){await Ma;let r=normalizeAlgorithm$1(e);switch(r.name.toUpperCase()){case`PBKDF2`:{let r=e,i=toNodeHashName(normalizeAlgorithm$1(r.hash).name),a=toUint8Array(r.salt),o=r.iterations,s=t._handle,c=Sa(s,a,o,n/8,i);return c.buffer.slice(c.byteOffset,c.byteOffset+c.byteLength)}case`HKDF`:{let r=e,i=toNodeHashName(normalizeAlgorithm$1(r.hash).name),a=toUint8Array(r.salt),o=toUint8Array(r.info),s=t._handle;return Ca(i,s,a,o,n/8)}case`ECDH`:{let r=e.public,i=t.algorithm.namedCurve,a=toNodeCurveName(i),o=wa(a),s=t._handle;o.setPrivateKey(s.priv);let c=r._handle instanceof Uint8Array?r._handle:r._handle.pub,l=o.computeSecret(c),u=new Uint8Array(l);return n?u.buffer.slice(0,n/8):u.buffer.slice(u.byteOffset,u.byteOffset+u.byteLength)}default:throw new DOMException(`Unsupported algorithm: ${r.name}`,`NotSupportedError`)}}async deriveBits(e,t,n){return checkUsage(t,`deriveBits`),this._deriveBitsInternal(e,t,n)}async deriveKey(e,t,n,r,i){checkUsage(t,`deriveKey`);let a=normalizeAlgorithm$1(n),o,s=a.name.toUpperCase();if(s===`AES-CBC`||s===`AES-CTR`||s===`AES-GCM`)o=n.length;else if(s===`HMAC`){let e=n,t=normalizeAlgorithm$1(e.hash);o=e.length||hashSize$1(t.name)*8}else throw new DOMException(`Unsupported derived key algorithm: ${a.name}`,`NotSupportedError`);let c=await this._deriveBitsInternal(e,t,o);return this.importKey(`raw`,c,n,r,i)}async wrapKey(e,t,n,r){throw new DOMException(`wrapKey not yet implemented`,`NotSupportedError`)}async unwrapKey(e,t,n,r,i,a,o){throw new DOMException(`unwrapKey not yet implemented`,`NotSupportedError`)}};const Na=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`);let t=new Uint8Array(e.buffer,e.byteOffset,e.byteLength);if(Na&&typeof Na.getRandomValues==`function`)Na.getRandomValues(t);else for(let e=0;e<t.length;e++)t[e]=Math.floor(Math.random()*256);return e}randomUUID(){if(Na&&typeof Na.randomUUID==`function`)return Na.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 Pa=Na!==null&&Na.subtle!==void 0&&typeof Na.subtle.digest==`function`,Fa=Pa?Na:new CryptoPolyfill;Pa?Na.subtle:new SubtleCrypto;const Ia=globalThis;(globalThis.crypto===void 0||globalThis.crypto.subtle===void 0)&&(Ia.crypto=Fa);const La=typeof process<`u`&&typeof process.versions?.gjs==`string`,Ra=typeof process<`u`&&typeof process.versions?.node==`string`,za=La?`GJS`:Ra?`Node.js`:`Unknown`;La?process.versions.gjs:Ra&&process.versions.node;var Ba,Va,Ha=__esmMin(()=>{Ba=Object.defineProperty,Va=__name((e,t)=>{let n={};for(var r in e)Ba(n,r,{get:e[r],enumerable:!0});return t||Ba(n,Symbol.toStringTag,{value:`Module`}),n},`__exportAll`)});function assertPath(e){if(typeof e!=`string`)throw TypeError(`The "path" argument must be of type string. Received type `+typeof e)}function isPosixPathSeparator(e){return e===47}function isPathSeparator(e){return e===47||e===92}function isWindowsDeviceRoot(e){return e>=65&&e<=90||e>=97&&e<=122}function normalizeString(e,t,n,r){let i=``,a=0,o=-1,s=0,c;for(let l=0;l<=e.length;++l){if(l<e.length)c=e.charCodeAt(l);else if(r(c))break;else c=47;if(r(c)){if(!(o===l-1||s===1))if(o!==l-1&&s===2){if(i.length<2||a!==2||i.charCodeAt(i.length-1)!==46||i.charCodeAt(i.length-2)!==46){if(i.length>2){let e=i.lastIndexOf(n);e===-1?(i=``,a=0):(i=i.slice(0,e),a=i.length-1-i.lastIndexOf(n)),o=l,s=0;continue}else if(i.length===2||i.length===1){i=``,a=0,o=l,s=0;continue}}t&&(i.length>0?i+=`${n}..`:i=`..`,a=2)}else i.length>0?i+=n+e.slice(o+1,l):i=e.slice(o+1,l),a=l-o-1;o=l,s=0}else c===46&&s!==-1?++s:s=-1}return i}function _format(e,t){if(typeof t!=`object`||!t)throw TypeError(`The "pathObject" argument must be of type Object. Received type `+typeof t);let n=t,r=n.dir||n.root,i=n.base||(n.name||``)+formatExt(n.ext);return r?r===n.root?r+i:r+e+i:i}function formatExt(e){return e?`${e[0]===`.`?``:`.`}${e}`:``}var Ua=__esmMin(()=>{});function posixCwd(){if(typeof globalThis.process?.cwd==`function`)return globalThis.process.cwd();try{let e=globalThis.imports?.gi?.GLib;if(e?.get_current_dir)return e.get_current_dir()}catch{}return`/`}function resolve$1(...e){let t=``,n=!1;for(let r=e.length-1;r>=-1&&!n;r--){let i;if(r>=0){if(i=e[r],assertPath(i),i.length===0)continue}else i=posixCwd();t=`${i}/${t}`,n=i.charCodeAt(0)===47}return t=normalizeString(t,!n,`/`,isPosixPathSeparator),n?t.length>0?`/${t}`:`/`:t.length>0?t:`.`}function normalize$1(e){if(assertPath(e),e.length===0)return`.`;let t=e.charCodeAt(0)===47,n=e.charCodeAt(e.length-1)===47,r=normalizeString(e,!t,`/`,isPosixPathSeparator);return r.length===0&&!t&&(r=`.`),r.length>0&&n&&(r+=`/`),t?`/${r}`:r}function isAbsolute$1(e){return assertPath(e),e.length>0&&e.charCodeAt(0)===47}function join$1(...e){if(e.length===0)return`.`;let t;for(let n=0;n<e.length;++n){let r=e[n];assertPath(r),r.length>0&&(t===void 0?t=r:t+=`/${r}`)}return t===void 0?`.`:normalize$1(t)}function relative$1(e,t){if(assertPath(e),assertPath(t),e===t||(e=resolve$1(e),t=resolve$1(t),e===t))return``;let n=e.length,r=n-1,i=1,a=t.length-i,o=r<a?r:a,s=-1,c=0;for(;c<=o;++c){if(c===o){if(a>o){if(t.charCodeAt(i+c)===47)return t.slice(i+c+1);if(c===0)return t.slice(i+c)}else r>o&&(e.charCodeAt(1+c)===47?s=c:c===0&&(s=0));break}let n=e.charCodeAt(1+c);if(n!==t.charCodeAt(i+c))break;n===47&&(s=c)}let l=``;for(c=1+s+1;c<=n;++c)(c===n||e.charCodeAt(c)===47)&&(l.length===0?l+=`..`:l+=`/..`);return l.length>0?l+t.slice(i+s):(i+=s,t.charCodeAt(i)===47&&++i,t.slice(i))}function toNamespacedPath$1(e){return e}function dirname$1(e){if(assertPath(e),e.length===0)return`.`;let t=e.charCodeAt(0)===47,n=-1,r=!0;for(let t=e.length-1;t>=1;--t)if(e.charCodeAt(t)===47){if(!r){n=t;break}}else r=!1;return n===-1?t?`/`:`.`:t&&n===1?`//`:e.slice(0,n)}function basename$1(e,t){t!==void 0&&assertPath(t),assertPath(e);let n=0,r=-1,i=!0;if(t!==void 0&&t.length>0&&t.length<=e.length){if(t.length===e.length&&t===e)return``;let a=t.length-1,o=-1;for(let s=e.length-1;s>=0;--s){let c=e.charCodeAt(s);if(c===47){if(!i){n=s+1;break}}else o===-1&&(i=!1,o=s+1),a>=0&&(c===t.charCodeAt(a)?--a===-1&&(r=s):(a=-1,r=o))}return n===r?r=o:r===-1&&(r=e.length),e.slice(n,r)}else{for(let t=e.length-1;t>=0;--t)if(e.charCodeAt(t)===47){if(!i){n=t+1;break}}else r===-1&&(i=!1,r=t+1);return r===-1?``:e.slice(n,r)}}function extname$1(e){assertPath(e);let t=-1,n=0,r=-1,i=!0,a=0;for(let o=e.length-1;o>=0;--o){let s=e.charCodeAt(o);if(s===47){if(!i){n=o+1;break}continue}r===-1&&(i=!1,r=o+1),s===46?t===-1?t=o:a!==1&&(a=1):t!==-1&&(a=-1)}return t===-1||r===-1||a===0||a===1&&t===r-1&&t===n+1?``:e.slice(t,r)}function format$2(e){if(typeof e!=`object`||!e)throw TypeError(`The "pathObject" argument must be of type Object. Received type `+typeof e);return _format(`/`,e)}function parse$2(e){assertPath(e);let t={root:``,dir:``,base:``,ext:``,name:``};if(e.length===0)return t;let n=e.charCodeAt(0)===47,r;n?(t.root=`/`,r=1):r=0;let i=-1,a=0,o=-1,s=!0,c=e.length-1,l=0;for(;c>=r;--c){let t=e.charCodeAt(c);if(t===47){if(!s){a=c+1;break}continue}o===-1&&(s=!1,o=c+1),t===46?i===-1?i=c:l!==1&&(l=1):i!==-1&&(l=-1)}return i===-1||o===-1||l===0||l===1&&i===o-1&&i===a+1?o!==-1&&(a===0&&n?t.base=t.name=e.slice(1,o):t.base=t.name=e.slice(a,o)):(a===0&&n?(t.name=e.slice(1,i),t.base=e.slice(1,o)):(t.name=e.slice(a,i),t.base=e.slice(a,o)),t.ext=e.slice(i,o)),a>0?t.dir=e.slice(0,a-1):n&&(t.dir=`/`),t}var Wa,Ga=__esmMin(()=>{Ha(),Ua(),Wa=Va({basename:()=>basename$1,delimiter:()=>`:`,dirname:()=>dirname$1,extname:()=>extname$1,format:()=>format$2,isAbsolute:()=>isAbsolute$1,join:()=>join$1,normalize:()=>normalize$1,parse:()=>parse$2,relative:()=>relative$1,resolve:()=>resolve$1,sep:()=>`/`,toNamespacedPath:()=>toNamespacedPath$1}),__name(resolve$1,`resolve`),__name(normalize$1,`normalize`),__name(isAbsolute$1,`isAbsolute`),__name(join$1,`join`),__name(relative$1,`relative`),__name(toNamespacedPath$1,`toNamespacedPath`),__name(dirname$1,`dirname`),__name(basename$1,`basename`),__name(extname$1,`extname`),__name(format$2,`format`),__name(parse$2,`parse`)});function resolve(...e){let t=``,n=``,r=!1;for(let i=e.length-1;i>=-1;i--){let a;if(i>=0){if(a=e[i],assertPath(a),a.length===0)continue}else a=(t.length,typeof globalThis.process?.cwd==`function`?globalThis.process.cwd():`/`);let o=a.length,s=0,c=``,l=!1,u=a.charCodeAt(0);if(o>1)if(isPathSeparator(u))if(l=!0,isPathSeparator(a.charCodeAt(1))){let e=2,t=e;for(;e<o&&!isPathSeparator(a.charCodeAt(e));++e);if(e<o&&e!==t){let n=a.slice(t,e);for(t=e;e<o&&isPathSeparator(a.charCodeAt(e));++e);if(e<o&&e!==t){for(t=e;e<o&&!isPathSeparator(a.charCodeAt(e));++e);e===o?(c=`\\\\${n}\\${a.slice(t)}`,s=e):e!==t&&(c=`\\\\${n}\\${a.slice(t,e)}`,s=e)}}}else s=1;else isWindowsDeviceRoot(u)&&a.charCodeAt(1)===58&&(c=a.slice(0,2),s=2,o>2&&isPathSeparator(a.charCodeAt(2))&&(l=!0,s=3));else isPathSeparator(u)&&(s=1,l=!0);if(!(c.length>0&&t.length>0&&c.toLowerCase()!==t.toLowerCase())&&(t.length===0&&c.length>0&&(t=c),r||=(n=`${a.slice(s)}\\${n}`,l),t.length>0&&r))break}return n=normalizeString(n,!r,`\\`,isPathSeparator),t+(r?`\\`:``)+n||`.`}function normalize(e){assertPath(e);let t=e.length;if(t===0)return`.`;let n=0,r,i=!1,a=e.charCodeAt(0);if(t>1)if(isPathSeparator(a))if(i=!0,isPathSeparator(e.charCodeAt(1))){let i=2,a=i;for(;i<t&&!isPathSeparator(e.charCodeAt(i));++i);if(i<t&&i!==a){let o=e.slice(a,i);for(a=i;i<t&&isPathSeparator(e.charCodeAt(i));++i);if(i<t&&i!==a){for(a=i;i<t&&!isPathSeparator(e.charCodeAt(i));++i);if(i===t)return`\\\\${o}\\${e.slice(a)}\\`;i!==a&&(r=`\\\\${o}\\${e.slice(a,i)}`,n=i)}}}else n=1;else isWindowsDeviceRoot(a)&&e.charCodeAt(1)===58&&(r=e.slice(0,2),n=2,t>2&&isPathSeparator(e.charCodeAt(2))&&(i=!0,n=3));else if(isPathSeparator(a))return`\\`;let o;return o=n<t?normalizeString(e.slice(n),!i,`\\`,isPathSeparator):``,o.length===0&&!i&&(o=`.`),o.length>0&&isPathSeparator(e.charCodeAt(t-1))&&(o+=`\\`),r===void 0?i?o.length>0?`\\${o}`:`\\`:o.length>0?o:``:i?o.length>0?`${r}\\${o}`:`${r}\\`:o.length>0?r+o:r}function isAbsolute(e){assertPath(e);let t=e.length;if(t===0)return!1;let n=e.charCodeAt(0);return!!(isPathSeparator(n)||isWindowsDeviceRoot(n)&&t>2&&e.charCodeAt(1)===58&&isPathSeparator(e.charCodeAt(2)))}function join(...e){if(e.length===0)return`.`;let t,n;for(let r=0;r<e.length;++r){let i=e[r];assertPath(i),i.length>0&&(t===void 0?t=n=i:t+=`\\${i}`)}if(t===void 0)return`.`;let r=!0,i=0;if(isPathSeparator(n.charCodeAt(0))){++i;let e=n.length;e>1&&isPathSeparator(n.charCodeAt(1))&&(++i,e>2&&(isPathSeparator(n.charCodeAt(2))?++i:r=!1))}if(r){for(;i<t.length&&isPathSeparator(t.charCodeAt(i));++i);i>=2&&(t=`\\${t.slice(i)}`)}return normalize(t)}function relative(e,t){if(assertPath(e),assertPath(t),e===t)return``;let n=resolve(e),r=resolve(t);if(n===r||(e=n.toLowerCase(),t=r.toLowerCase(),e===t))return``;let i=0;for(;i<e.length&&e.charCodeAt(i)===92;++i);let a=e.length;for(;a-1>i&&e.charCodeAt(a-1)===92;--a);let o=a-i,s=0;for(;s<t.length&&t.charCodeAt(s)===92;++s);let c=t.length;for(;c-1>s&&t.charCodeAt(c-1)===92;--c);let l=c-s,u=o<l?o:l,d=-1,p=0;for(;p<=u;++p){if(p===u){if(l>u){if(t.charCodeAt(s+p)===92)return r.slice(s+p+1);if(p===2)return r.slice(s+p)}o>u&&(e.charCodeAt(i+p)===92?d=p:p===2&&(d=3));break}let n=e.charCodeAt(i+p);if(n!==t.charCodeAt(s+p))break;n===92&&(d=p)}if(p!==u&&d===-1)return r;let m=``;for(d===-1&&(d=0),p=i+d+1;p<=a;++p)(p===a||e.charCodeAt(p)===92)&&(m.length===0?m+=`..`:m+=`\\..`);return m.length>0?m+r.slice(s+d,c):(s+=d,r.charCodeAt(s)===92&&++s,r.slice(s,c))}function toNamespacedPath(e){if(typeof e!=`string`)return e;if(e.length===0)return``;let t=resolve(e);if(t.length>=3){if(t.charCodeAt(0)===92){if(t.charCodeAt(1)===92){let e=t.charCodeAt(2);if(e!==63&&e!==46)return`\\\\?\\UNC\\${t.slice(2)}`}}else if(isWindowsDeviceRoot(t.charCodeAt(0))&&t.charCodeAt(1)===58&&t.charCodeAt(2)===92)return`\\\\?\\${t}`}return e}function dirname(e){assertPath(e);let t=e.length;if(t===0)return`.`;let n=-1,r=-1,i=!0,a=0,o=e.charCodeAt(0);if(t>1)if(isPathSeparator(o)){if(n=a=1,isPathSeparator(e.charCodeAt(1))){let r=2,i=r;for(;r<t&&!isPathSeparator(e.charCodeAt(r));++r);if(r<t&&r!==i){for(i=r;r<t&&isPathSeparator(e.charCodeAt(r));++r);if(r<t&&r!==i){for(i=r;r<t&&!isPathSeparator(e.charCodeAt(r));++r);if(r===t)return e;r!==i&&(n=a=r+1)}}}}else isWindowsDeviceRoot(o)&&e.charCodeAt(1)===58&&(n=a=2,t>2&&isPathSeparator(e.charCodeAt(2))&&(n=a=3));else if(isPathSeparator(o))return e;for(let n=t-1;n>=a;--n)if(isPathSeparator(e.charCodeAt(n))){if(!i){r=n;break}}else i=!1;if(r===-1){if(n===-1)return`.`;r=n}return e.slice(0,r)}function basename(e,t){t!==void 0&&assertPath(t),assertPath(e);let n=0,r=-1,i=!0;if(e.length>=2&&isWindowsDeviceRoot(e.charCodeAt(0))&&e.charCodeAt(1)===58&&(n=2),t!==void 0&&t.length>0&&t.length<=e.length){if(t.length===e.length&&t===e)return``;let a=t.length-1,o=-1;for(let s=e.length-1;s>=n;--s){let c=e.charCodeAt(s);if(isPathSeparator(c)){if(!i){n=s+1;break}}else o===-1&&(i=!1,o=s+1),a>=0&&(c===t.charCodeAt(a)?--a===-1&&(r=s):(a=-1,r=o))}return n===r?r=o:r===-1&&(r=e.length),e.slice(n,r)}else{for(let t=e.length-1;t>=n;--t)if(isPathSeparator(e.charCodeAt(t))){if(!i){n=t+1;break}}else r===-1&&(i=!1,r=t+1);return r===-1?``:e.slice(n,r)}}function extname(e){assertPath(e);let t=0,n=-1,r=0,i=-1,a=!0,o=0;e.length>=2&&e.charCodeAt(1)===58&&isWindowsDeviceRoot(e.charCodeAt(0))&&(t=r=2);for(let s=e.length-1;s>=t;--s){let t=e.charCodeAt(s);if(isPathSeparator(t)){if(!a){r=s+1;break}continue}i===-1&&(a=!1,i=s+1),t===46?n===-1?n=s:o!==1&&(o=1):n!==-1&&(o=-1)}return n===-1||i===-1||o===0||o===1&&n===i-1&&n===r+1?``:e.slice(n,i)}function format$1(e){if(typeof e!=`object`||!e)throw TypeError(`The "pathObject" argument must be of type Object. Received type `+typeof e);return _format(`\\`,e)}function parse$1(e){assertPath(e);let t={root:``,dir:``,base:``,ext:``,name:``};if(e.length===0)return t;let n=e.length,r=0,i=e.charCodeAt(0);if(n>1)if(isPathSeparator(i)){if(r=1,isPathSeparator(e.charCodeAt(1))){let t=2,i=t;for(;t<n&&!isPathSeparator(e.charCodeAt(t));++t);if(t<n&&t!==i){for(i=t;t<n&&isPathSeparator(e.charCodeAt(t));++t);if(t<n&&t!==i){for(i=t;t<n&&!isPathSeparator(e.charCodeAt(t));++t);t===n?r=t:t!==i&&(r=t+1)}}}}else isWindowsDeviceRoot(i)&&e.charCodeAt(1)===58&&(r=2,n>2&&isPathSeparator(e.charCodeAt(2))&&(r=3));else if(isPathSeparator(i))return t.root=t.dir=e,t;r>0&&(t.root=e.slice(0,r));let a=-1,o=r,s=-1,c=!0,l=e.length-1,u=0;for(;l>=r;--l){if(i=e.charCodeAt(l),isPathSeparator(i)){if(!c){o=l+1;break}continue}s===-1&&(c=!1,s=l+1),i===46?a===-1?a=l:u!==1&&(u=1):a!==-1&&(u=-1)}return a===-1||s===-1||u===0||u===1&&a===s-1&&a===o+1?s!==-1&&(t.base=t.name=e.slice(o,s)):(t.name=e.slice(o,a),t.base=e.slice(o,s),t.ext=e.slice(a,s)),o>0&&o!==r?t.dir=e.slice(0,o-1):t.dir=t.root,t}var Ka,qa=__esmMin(()=>{Ha(),Ua(),Ka=Va({basename:()=>basename,delimiter:()=>`;`,dirname:()=>dirname,extname:()=>extname,format:()=>format$1,isAbsolute:()=>isAbsolute,join:()=>join,normalize:()=>normalize,parse:()=>parse$1,relative:()=>relative,resolve:()=>resolve,sep:()=>`\\`,toNamespacedPath:()=>toNamespacedPath}),__name(format$1,`format`),__name(parse$1,`parse`)}),Ja=__exportAll$4({basename:()=>no,default:()=>co,delimiter:()=>so,dirname:()=>to,extname:()=>ro,format:()=>io,isAbsolute:()=>Za,join:()=>Qa,normalize:()=>Xa,parse:()=>ao,posix:()=>Wa,relative:()=>$a,resolve:()=>Ya,sep:()=>oo,toNamespacedPath:()=>eo,win32:()=>Ka}),Ya,Xa,Za,Qa,$a,eo,to,no,ro,io,ao,oo,so,co,lo=__esmMin(()=>{Ga(),qa(),{resolve:Ya,normalize:Xa,isAbsolute:Za,join:Qa,relative:$a,toNamespacedPath:eo,dirname:to,basename:no,extname:ro,format:io,parse:ao,sep:oo,delimiter:so}=Wa,co={resolve:resolve$1,normalize:normalize$1,isAbsolute:isAbsolute$1,join:join$1,relative:relative$1,toNamespacedPath:toNamespacedPath$1,dirname:dirname$1,basename:basename$1,extname:extname$1,format:format$2,parse:parse$2,sep:`/`,delimiter:`:`,posix:Wa,win32:Ka}}),uo=__commonJSMin(((e,t)=>{var n=1e3,r=n*60,i=r*60,a=i*24,o=a*7,s=a*365.25;t.exports=function(e,t){t||={};var n=typeof e;if(n===`string`&&e.length>0)return parse(e);if(n===`number`&&isFinite(e))return t.long?fmtLong(e):fmtShort(e);throw Error(`val is not a non-empty string or a valid number. val=`+JSON.stringify(e))};function parse(e){if(e=String(e),!(e.length>100)){var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(t){var c=parseFloat(t[1]);switch((t[2]||`ms`).toLowerCase()){case`years`:case`year`:case`yrs`:case`yr`:case`y`:return c*s;case`weeks`:case`week`:case`w`:return c*o;case`days`:case`day`:case`d`:return c*a;case`hours`:case`hour`:case`hrs`:case`hr`:case`h`:return c*i;case`minutes`:case`minute`:case`mins`:case`min`:case`m`:return c*r;case`seconds`:case`second`:case`secs`:case`sec`:case`s`:return c*n;case`milliseconds`:case`millisecond`:case`msecs`:case`msec`:case`ms`:return c;default:return}}}}function fmtShort(e){var t=Math.abs(e);return t>=a?Math.round(e/a)+`d`:t>=i?Math.round(e/i)+`h`:t>=r?Math.round(e/r)+`m`:t>=n?Math.round(e/n)+`s`:e+`ms`}function fmtLong(e){var t=Math.abs(e);return t>=a?plural(e,t,a,`day`):t>=i?plural(e,t,i,`hour`):t>=r?plural(e,t,r,`minute`):t>=n?plural(e,t,n,`second`):e+` ms`}function plural(e,t,n,r){var i=t>=n*1.5;return Math.round(e/n)+` `+r+(i?`s`:``)}})),fo=__commonJSMin(((e,t)=>{me();function setup(e){createDebug.debug=createDebug,createDebug.default=createDebug,createDebug.coerce=coerce,createDebug.disable=disable,createDebug.enable=enable,createDebug.enabled=enabled,createDebug.humanize=uo(),createDebug.destroy=destroy,Object.keys(e).forEach(t=>{createDebug[t]=e[t]}),createDebug.names=[],createDebug.skips=[],createDebug.formatters={};function selectColor(e){let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n),t|=0;return createDebug.colors[Math.abs(t)%createDebug.colors.length]}createDebug.selectColor=selectColor;function createDebug(e){let t,n=null,r,i;function debug(...e){if(!debug.enabled)return;let n=debug,r=Number(new Date);n.diff=r-(t||r),n.prev=t,n.curr=r,t=r,e[0]=createDebug.coerce(e[0]),typeof e[0]!=`string`&&e.unshift(`%O`);let i=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,(t,r)=>{if(t===`%%`)return`%`;i++;let a=createDebug.formatters[r];if(typeof a==`function`){let r=e[i];t=a.call(n,r),e.splice(i,1),i--}return t}),createDebug.formatArgs.call(n,e),(n.log||createDebug.log).apply(n,e)}return debug.namespace=e,debug.useColors=createDebug.useColors(),debug.color=createDebug.selectColor(e),debug.extend=extend,debug.destroy=createDebug.destroy,Object.defineProperty(debug,"enabled",{enumerable:!0,configurable:!1,get:()=>n===null?(r!==createDebug.namespaces&&(r=createDebug.namespaces,i=createDebug.enabled(e)),i):n,set:e=>{n=e}}),typeof createDebug.init==`function`&&createDebug.init(debug),debug}function extend(e,t){let n=createDebug(this.namespace+(t===void 0?`:`:t)+e);return n.log=this.log,n}function enable(e){createDebug.save(e),createDebug.namespaces=e,createDebug.names=[],createDebug.skips=[];let t=(typeof e==`string`?e:``).trim().replace(/\s+/g,`,`).split(`,`).filter(Boolean);for(let e of t)e[0]===`-`?createDebug.skips.push(e.slice(1)):createDebug.names.push(e)}function matchesTemplate(e,t){let n=0,r=0,i=-1,a=0;for(;n<e.length;)if(r<t.length&&(t[r]===e[n]||t[r]===`*`))t[r]===`*`?(i=r,a=n,r++):(n++,r++);else if(i!==-1)r=i+1,a++,n=a;else return!1;for(;r<t.length&&t[r]===`*`;)r++;return r===t.length}function disable(){let e=[...createDebug.names,...createDebug.skips.map(e=>`-`+e)].join(`,`);return createDebug.enable(``),e}function enabled(e){for(let t of createDebug.skips)if(matchesTemplate(e,t))return!1;for(let t of createDebug.names)if(matchesTemplate(e,t))return!0;return!1}function coerce(e){return e instanceof Error?e.stack||e.message:e}function destroy(){I.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return createDebug.enable(createDebug.load()),createDebug}t.exports=setup})),po=__commonJSMin(((e,t)=>{me(),e.formatArgs=formatArgs,e.save=save,e.load=load,e.useColors=useColors,e.storage=localstorage(),e.destroy=(()=>{let e=!1;return()=>{e||(e=!0,I.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),e.colors=`#0000CC.#0000FF.#0033CC.#0033FF.#0066CC.#0066FF.#0099CC.#0099FF.#00CC00.#00CC33.#00CC66.#00CC99.#00CCCC.#00CCFF.#3300CC.#3300FF.#3333CC.#3333FF.#3366CC.#3366FF.#3399CC.#3399FF.#33CC00.#33CC33.#33CC66.#33CC99.#33CCCC.#33CCFF.#6600CC.#6600FF.#6633CC.#6633FF.#66CC00.#66CC33.#9900CC.#9900FF.#9933CC.#9933FF.#99CC00.#99CC33.#CC0000.#CC0033.#CC0066.#CC0099.#CC00CC.#CC00FF.#CC3300.#CC3333.#CC3366.#CC3399.#CC33CC.#CC33FF.#CC6600.#CC6633.#CC9900.#CC9933.#CCCC00.#CCCC33.#FF0000.#FF0033.#FF0066.#FF0099.#FF00CC.#FF00FF.#FF3300.#FF3333.#FF3366.#FF3399.#FF33CC.#FF33FF.#FF6600.#FF6633.#FF9900.#FF9933.#FFCC00.#FFCC33`.split(`.`);function useColors(){if(typeof globalThis<`u`&&globalThis.process&&(globalThis.process.type===`renderer`||globalThis.process.__nwjs))return!0;if(typeof navigator<`u`&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let e;return typeof document<`u`&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof globalThis<`u`&&globalThis.console&&(globalThis.console.firebug||globalThis.console.exception&&globalThis.console.table)||typeof navigator<`u`&&navigator.userAgent&&(e=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(e[1],10)>=31||typeof navigator<`u`&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function formatArgs(e){if(e[0]=(this.useColors?`%c`:``)+this.namespace+(this.useColors?` %c`:` `)+e[0]+(this.useColors?`%c `:` `)+`+`+t.exports.humanize(this.diff),!this.useColors)return;let n=`color: `+this.color;e.splice(1,0,n,`color: inherit`);let r=0,i=0;e[0].replace(/%[a-zA-Z%]/g,e=>{e!==`%%`&&(r++,e===`%c`&&(i=r))}),e.splice(i,0,n)}e.log=I.debug||I.log||(()=>{});function save(t){try{t?e.storage.setItem(`debug`,t):e.storage.removeItem(`debug`)}catch{}}function load(){let t;try{t=e.storage.getItem(`debug`)||e.storage.getItem(`DEBUG`)}catch{}return!t&&typeof process<`u`&&`env`in process&&(t=process.env.DEBUG),t}function localstorage(){try{return localStorage}catch{}}t.exports=fo()(e);let{formatters:n}=t.exports;n.j=function(e){try{return JSON.stringify(e)}catch(e){return`[UnexpectedJSONParseError]: `+e.message}}})),mo=__commonJSMin(((e,t)=>{
7
7
  /*!
8
8
  * depd
9
9
  * Copyright(c) 2015 Douglas Christopher Wilson
@@ -215,35 +215,35 @@ t.exports=forwarded;function forwarded(e){if(!e)throw TypeError(`argument req is
215
215
  * Copyright(c) 2014-2016 Douglas Christopher Wilson
216
216
  * MIT Licensed
217
217
  */
218
- t.exports=proxyaddr,t.exports.all=alladdrs,t.exports.compile=compile;var n=Au(),r=ju(),i=/^[0-9]+$/,a=r.isValid,o=r.parse,s={linklocal:[`169.254.0.0/16`,`fe80::/10`],loopback:[`127.0.0.1/8`,`::1/128`],uniquelocal:[`10.0.0.0/8`,`172.16.0.0/12`,`192.168.0.0/16`,`fc00::/7`]};function alladdrs(e,t){var r=n(e);if(!t)return r;typeof t!=`function`&&(t=compile(t));for(var i=0;i<r.length-1;i++)t(r[i],i)||(r.length=i+1);return r}function compile(e){if(!e)throw TypeError(`argument is required`);var t;if(typeof e==`string`)t=[e];else if(Array.isArray(e))t=e.slice();else throw TypeError(`unsupported trust argument`);for(var n=0;n<t.length;n++)e=t[n],Object.prototype.hasOwnProperty.call(s,e)&&(e=s[e],t.splice.apply(t,[n,1].concat(e)),n+=e.length-1);return compileTrust(compileRangeSubnets(t))}function compileRangeSubnets(e){for(var t=Array(e.length),n=0;n<e.length;n++)t[n]=parseipNotation(e[n]);return t}function compileTrust(e){var t=e.length;return t===0?trustNone:t===1?trustSingle(e[0]):trustMulti(e)}function parseipNotation(e){var t=e.lastIndexOf(`/`),n=t===-1?e:e.substring(0,t);if(!a(n))throw TypeError(`invalid IP address: `+n);var r=o(n);t===-1&&r.kind()===`ipv6`&&r.isIPv4MappedAddress()&&(r=r.toIPv4Address());var s=r.kind()===`ipv6`?128:32,c=t===-1?null:e.substring(t+1,e.length);if(c=c===null?s:i.test(c)?parseInt(c,10):r.kind()===`ipv4`&&a(c)?parseNetmask(c):null,c<=0||c>s)throw TypeError(`invalid range on address: `+e);return[r,c]}function parseNetmask(e){var t=o(e);return t.kind()===`ipv4`?t.prefixLengthFromSubnetMask():null}function proxyaddr(e,t){if(!e)throw TypeError(`req argument is required`);if(!t)throw TypeError(`trust argument is required`);var n=alladdrs(e,t);return n[n.length-1]}function trustNone(){return!1}function trustMulti(e){return function trust(t){if(!a(t))return!1;for(var n=o(t),r,i=n.kind(),s=0;s<e.length;s++){var c=e[s],l=c[0],u=l.kind(),d=c[1],p=n;if(i!==u){if(u===`ipv4`&&!n.isIPv4MappedAddress())continue;r||=u===`ipv4`?n.toIPv4Address():n.toIPv4MappedAddress(),p=r}if(p.match(l,d))return!0}return!1}}function trustSingle(e){var t=e[0],n=t.kind(),r=n===`ipv4`,i=e[1];return function trust(e){if(!a(e))return!1;var s=o(e);if(s.kind()!==n){if(r&&!s.isIPv4MappedAddress())return!1;s=r?s.toIPv4Address():s.toIPv4MappedAddress()}return s.match(t,i)}}})),NodeErrorAbstraction,NodeURIError,Nu=__esmMin(()=>{NodeErrorAbstraction=class extends Error{code;constructor(e,t,n){super(n),this.code=t,this.name=e,this.stack=this.stack&&`${e} [${this.code}]${this.stack.slice(20)}`}toString(){return`${this.name} [${this.code}]: ${this.message}`}},NodeURIError=class extends NodeErrorAbstraction{constructor(e,t){super(URIError.prototype.name,e,t),Object.setPrototypeOf(this,URIError.prototype),this.toString=function(){return`${this.name} [${this.code}]: ${this.message}`}}}}),Pu=__exportAll$4({ERR_INVALID_URI:()=>ERR_INVALID_URI,decode:()=>Iu,default:()=>Uu,encode:()=>Lu,escape:()=>Ru,parse:()=>parse,stringify:()=>stringify,unescape:()=>Hu,unescapeBuffer:()=>unescapeBuffer});function encodeStr(e,t,n){let r=e.length;if(r===0)return``;let i=``,a=0;for(let o=0;o<r;o++){let s=e.charCodeAt(o);if(s<128){if(t[s]===1)continue;a<o&&(i+=e.slice(a,o)),a=o+1,i+=n[s];continue}if(a<o&&(i+=e.slice(a,o)),s<2048){a=o+1,i+=n[192|s>>6]+n[128|s&63];continue}if(s<55296||s>=57344){a=o+1,i+=n[224|s>>12]+n[128|s>>6&63]+n[128|s&63];continue}if(++o,o>=r)throw new ERR_INVALID_URI;let c=e.charCodeAt(o)&1023;a=o+1,s=65536+((s&1023)<<10|c),i+=n[240|s>>18]+n[128|s>>12&63]+n[128|s>>6&63]+n[128|s&63]}return a===0?e:a<r?i+e.slice(a):i}function qsEscape(e){return typeof e!=`string`&&(typeof e==`object`?e=String(e):e+=``),encodeStr(e,Bu,Fu)}function charCodes(e){let t=Array.from({length:e.length});for(let n=0;n<e.length;++n)t[n]=e.charCodeAt(n);return t}function addKeyVal(e,t,n,r,i,a){if(t.length>0&&r)try{t=a(t)}catch{}if(n.length>0&&i)try{n=a(n)}catch{}if(e[t]===void 0)e[t]=n;else{let r=e[t];r.pop?r[r.length]=n:e[t]=[r,n]}}function parse(e,t=`&`,n=`=`,{decodeURIComponent:r=Hu,maxKeys:i=1e3}={}){let a=Object.create(null);if(typeof e!=`string`||e.length===0)return a;let o=t?charCodes(String(t)):[38],s=n?charCodes(String(n)):[61],c=o.length,l=s.length,u=1e3;typeof i==`number`&&(u=i>0?i:-1);let d=Hu;r&&(d=r);let p=d!==Hu,m=0,h=0,g=0,_=``,v=``,y=p,b=p,x=p?`%20`:` `,S=0;for(let t=0;t<e.length;++t){let n=e.charCodeAt(t);if(n===o[h]){if(++h===c){let n=t-h+1;if(g<l){if(m<n)_+=e.slice(m,n);else if(_.length===0){if(--u===0)return a;m=t+1,h=g=0;continue}}else m<n&&(v+=e.slice(m,n));if(addKeyVal(a,_,v,y,b,d),--u===0)return a;_=v=``,S=0,m=t+1,h=g=0}}else{if(h=0,g<l){if(n===s[g]){if(++g===l){let n=t-g+1;m<n&&(_+=e.slice(m,n)),S=0,m=t+1}continue}else if(g=0,!y){if(n===37){S=1;continue}else if(S>0)if(zu[n]===1){++S===3&&(y=!0);continue}else S=0}if(n===43){m<t&&(_+=e.slice(m,t)),_+=x,m=t+1;continue}}n===43?(m<t&&(v+=e.slice(m,t)),v+=x,m=t+1):b||(n===37?S=1:S>0&&(zu[n]===1?++S===3&&(b=!0):S=0))}}if(m<e.length)g<l?_+=e.slice(m):h<c&&(v+=e.slice(m));else if(g===0&&_.length===0)return a;return addKeyVal(a,_,v,y,b,d),a}function stringifyPrimitive(e){return typeof e==`string`?e:typeof e==`number`&&isFinite(e)||typeof e==`bigint`?``+e:typeof e==`boolean`?e?`true`:`false`:``}function encodeStringifiedCustom(e,t){return t(stringifyPrimitive(e))}function encodeStringified(e,t){return typeof e==`string`?e.length?t(e):``:typeof e==`number`&&isFinite(e)?Math.abs(e)<1e21?``+e:t(``+e):typeof e==`bigint`?``+e:typeof e==`boolean`?e?`true`:`false`:``}function stringify(e,t,n,r){t||=`&`,n||=`=`;let i=r?r.encodeURIComponent:qsEscape,a=r?encodeStringifiedCustom:encodeStringified;if(typeof e==`object`&&e){let r=Object.keys(e),o=r.length,s=``;for(let c=0;c<o;++c){let o=r[c],l=e[o],u=a(o,i);if(u+=n,Array.isArray(l)){let e=l.length;if(e===0)continue;s&&(s+=t);for(let n=0;n<e;++n)n&&(s+=t),s+=u,s+=a(l[n],i)}else s&&(s+=t),s+=u,s+=a(l,i)}return s}return``}function unescapeBuffer(e,t=!1){let n=new q(e.length),r=0,i=0,a,o,s,c,l=e.length-2,u=!1;for(;r<e.length;){if(a=e.charCodeAt(r),a===43&&t){n[i++]=32,r++;continue}if(a===37&&r<l)if(a=e.charCodeAt(++r),s=Vu[a],s>=0)o=e.charCodeAt(++r),c=Vu[o],c>=0?(u=!0,a=s*16+c):(n[i++]=37,r--);else{n[i++]=37;continue}n[i++]=a,r++}return u?n.slice(0,i):n}function qsUnescape(e){try{return decodeURIComponent(e)}catch{return unescapeBuffer(e).toString()}}var Fu,ERR_INVALID_URI,Iu,Lu,Ru,zu,Bu,Vu,Hu,Uu,Wu=__esmMin(()=>{Nu(),J(),Fu=Array.from({length:256});for(let e=0;e<256;++e)Fu[e]=`%`+((e<16?`0`:``)+e.toString(16)).toUpperCase();ERR_INVALID_URI=class extends NodeURIError{constructor(){super(`ERR_INVALID_URI`,`URI malformed`)}},Iu=parse,Lu=stringify,Ru=qsEscape,zu=new Int8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),Bu=new Int8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,1,1,1,0,0,1,1,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,0]),Vu=new Int8Array([-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,-1,-1,-1,-1,-1,-1,-1,10,11,12,13,14,15,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,10,11,12,13,14,15,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1]),Hu=qsUnescape,Uu={parse,stringify,decode:Iu,encode:Lu,unescape:Hu,escape:Ru,unescapeBuffer}}),Gu=__commonJSMin((e=>{
218
+ t.exports=proxyaddr,t.exports.all=alladdrs,t.exports.compile=compile;var n=Au(),r=ju(),i=/^[0-9]+$/,a=r.isValid,o=r.parse,s={linklocal:[`169.254.0.0/16`,`fe80::/10`],loopback:[`127.0.0.1/8`,`::1/128`],uniquelocal:[`10.0.0.0/8`,`172.16.0.0/12`,`192.168.0.0/16`,`fc00::/7`]};function alladdrs(e,t){var r=n(e);if(!t)return r;typeof t!=`function`&&(t=compile(t));for(var i=0;i<r.length-1;i++)t(r[i],i)||(r.length=i+1);return r}function compile(e){if(!e)throw TypeError(`argument is required`);var t;if(typeof e==`string`)t=[e];else if(Array.isArray(e))t=e.slice();else throw TypeError(`unsupported trust argument`);for(var n=0;n<t.length;n++)e=t[n],Object.prototype.hasOwnProperty.call(s,e)&&(e=s[e],t.splice.apply(t,[n,1].concat(e)),n+=e.length-1);return compileTrust(compileRangeSubnets(t))}function compileRangeSubnets(e){for(var t=Array(e.length),n=0;n<e.length;n++)t[n]=parseipNotation(e[n]);return t}function compileTrust(e){var t=e.length;return t===0?trustNone:t===1?trustSingle(e[0]):trustMulti(e)}function parseipNotation(e){var t=e.lastIndexOf(`/`),n=t===-1?e:e.substring(0,t);if(!a(n))throw TypeError(`invalid IP address: `+n);var r=o(n);t===-1&&r.kind()===`ipv6`&&r.isIPv4MappedAddress()&&(r=r.toIPv4Address());var s=r.kind()===`ipv6`?128:32,c=t===-1?null:e.substring(t+1,e.length);if(c=c===null?s:i.test(c)?parseInt(c,10):r.kind()===`ipv4`&&a(c)?parseNetmask(c):null,c<=0||c>s)throw TypeError(`invalid range on address: `+e);return[r,c]}function parseNetmask(e){var t=o(e);return t.kind()===`ipv4`?t.prefixLengthFromSubnetMask():null}function proxyaddr(e,t){if(!e)throw TypeError(`req argument is required`);if(!t)throw TypeError(`trust argument is required`);var n=alladdrs(e,t);return n[n.length-1]}function trustNone(){return!1}function trustMulti(e){return function trust(t){if(!a(t))return!1;for(var n=o(t),r,i=n.kind(),s=0;s<e.length;s++){var c=e[s],l=c[0],u=l.kind(),d=c[1],p=n;if(i!==u){if(u===`ipv4`&&!n.isIPv4MappedAddress())continue;r||=u===`ipv4`?n.toIPv4Address():n.toIPv4MappedAddress(),p=r}if(p.match(l,d))return!0}return!1}}function trustSingle(e){var t=e[0],n=t.kind(),r=n===`ipv4`,i=e[1];return function trust(e){if(!a(e))return!1;var s=o(e);if(s.kind()!==n){if(r&&!s.isIPv4MappedAddress())return!1;s=r?s.toIPv4Address():s.toIPv4MappedAddress()}return s.match(t,i)}}})),NodeErrorAbstraction,NodeURIError,Nu=__esmMin(()=>{NodeErrorAbstraction=class extends Error{code;constructor(e,t,n){super(n),this.code=t,this.name=e,this.stack=this.stack&&`${e} [${this.code}]${this.stack.slice(20)}`}toString(){return`${this.name} [${this.code}]: ${this.message}`}},NodeURIError=class extends NodeErrorAbstraction{constructor(e,t){super(URIError.prototype.name,e,t),Object.setPrototypeOf(this,URIError.prototype),this.toString=function(){return`${this.name} [${this.code}]: ${this.message}`}}}}),Pu,Fu,Iu,Lu,Ru=__esmMin(()=>{Pu=Array.from({length:256});for(let e=0;e<256;++e)Pu[e]=`%`+((e<16?`0`:``)+e.toString(16)).toUpperCase();Fu=new Int8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),Iu=new Int8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,1,1,1,0,0,1,1,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,0]),Lu=new Int8Array([-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,-1,-1,-1,-1,-1,-1,-1,10,11,12,13,14,15,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,10,11,12,13,14,15,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1])});function encodeStr(e,t,n){let r=e.length;if(r===0)return``;let i=``,a=0;for(let o=0;o<r;o++){let s=e.charCodeAt(o);if(s<128){if(t[s]===1)continue;a<o&&(i+=e.slice(a,o)),a=o+1,i+=n[s];continue}if(a<o&&(i+=e.slice(a,o)),s<2048){a=o+1,i+=n[192|s>>6]+n[128|s&63];continue}if(s<55296||s>=57344){a=o+1,i+=n[224|s>>12]+n[128|s>>6&63]+n[128|s&63];continue}if(++o,o>=r)throw new ERR_INVALID_URI;let c=e.charCodeAt(o)&1023;a=o+1,s=65536+((s&1023)<<10|c),i+=n[240|s>>18]+n[128|s>>12&63]+n[128|s>>6&63]+n[128|s&63]}return a===0?e:a<r?i+e.slice(a):i}function qsEscape(e){return typeof e!=`string`&&(typeof e==`object`?e=String(e):e+=``),encodeStr(e,Iu,Pu)}var ERR_INVALID_URI,zu=__esmMin(()=>{Nu(),Ru(),ERR_INVALID_URI=class extends NodeURIError{constructor(){super(`ERR_INVALID_URI`,`URI malformed`)}}});function unescapeBuffer(e,t=!1){let n=new q(e.length),r=0,i=0,a,o,s,c,l=e.length-2,u=!1;for(;r<e.length;){if(a=e.charCodeAt(r),a===43&&t){n[i++]=32,r++;continue}if(a===37&&r<l)if(a=e.charCodeAt(++r),s=Lu[a],s>=0)o=e.charCodeAt(++r),c=Lu[o],c>=0?(u=!0,a=s*16+c):(n[i++]=37,r--);else{n[i++]=37;continue}n[i++]=a,r++}return u?n.slice(0,i):n}function qsUnescape(e){try{return decodeURIComponent(e)}catch{return unescapeBuffer(e).toString()}}var Bu=__esmMin(()=>{Ru(),J()});function charCodes(e){let t=Array.from({length:e.length});for(let n=0;n<e.length;++n)t[n]=e.charCodeAt(n);return t}function addKeyVal(e,t,n,r,i,a){if(t.length>0&&r)try{t=a(t)}catch{}if(n.length>0&&i)try{n=a(n)}catch{}if(e[t]===void 0)e[t]=n;else{let r=e[t];r.pop?r[r.length]=n:e[t]=[r,n]}}function parse(e,t=`&`,n=`=`,{decodeURIComponent:r=qsUnescape,maxKeys:i=1e3}={}){let a=Object.create(null);if(typeof e!=`string`||e.length===0)return a;let o=t?charCodes(String(t)):[38],s=n?charCodes(String(n)):[61],c=o.length,l=s.length,u=1e3;typeof i==`number`&&(u=i>0?i:-1);let d=qsUnescape;r&&(d=r);let p=d!==qsUnescape,m=0,h=0,g=0,_=``,v=``,y=p,b=p,x=p?`%20`:` `,S=0;for(let t=0;t<e.length;++t){let n=e.charCodeAt(t);if(n===o[h]){if(++h===c){let n=t-h+1;if(g<l){if(m<n)_+=e.slice(m,n);else if(_.length===0){if(--u===0)return a;m=t+1,h=g=0;continue}}else m<n&&(v+=e.slice(m,n));if(addKeyVal(a,_,v,y,b,d),--u===0)return a;_=v=``,S=0,m=t+1,h=g=0}}else{if(h=0,g<l){if(n===s[g]){if(++g===l){let n=t-g+1;m<n&&(_+=e.slice(m,n)),S=0,m=t+1}continue}else if(g=0,!y){if(n===37){S=1;continue}else if(S>0)if(Fu[n]===1){++S===3&&(y=!0);continue}else S=0}if(n===43){m<t&&(_+=e.slice(m,t)),_+=x,m=t+1;continue}}n===43?(m<t&&(v+=e.slice(m,t)),v+=x,m=t+1):b||(n===37?S=1:S>0&&(Fu[n]===1?++S===3&&(b=!0):S=0))}}if(m<e.length)g<l?_+=e.slice(m):h<c&&(v+=e.slice(m));else if(g===0&&_.length===0)return a;return addKeyVal(a,_,v,y,b,d),a}var Vu=__esmMin(()=>{Ru(),Bu()});function stringifyPrimitive(e){return typeof e==`string`?e:typeof e==`number`&&isFinite(e)||typeof e==`bigint`?``+e:typeof e==`boolean`?e?`true`:`false`:``}function encodeStringifiedCustom(e,t){return t(stringifyPrimitive(e))}function encodeStringified(e,t){return typeof e==`string`?e.length?t(e):``:typeof e==`number`&&isFinite(e)?Math.abs(e)<1e21?``+e:t(``+e):typeof e==`bigint`?``+e:typeof e==`boolean`?e?`true`:`false`:``}function stringify(e,t,n,r){t||=`&`,n||=`=`;let i=r?r.encodeURIComponent:qsEscape,a=r?encodeStringifiedCustom:encodeStringified;if(typeof e==`object`&&e){let r=Object.keys(e),o=r.length,s=``;for(let c=0;c<o;++c){let o=r[c],l=e[o],u=a(o,i);if(u+=n,Array.isArray(l)){let e=l.length;if(e===0)continue;s&&(s+=t);for(let n=0;n<e;++n)n&&(s+=t),s+=u,s+=a(l[n],i)}else s&&(s+=t),s+=u,s+=a(l,i)}return s}return``}var Hu=__esmMin(()=>{zu()}),Uu=__exportAll$4({ERR_INVALID_URI:()=>ERR_INVALID_URI,decode:()=>Wu,default:()=>Ju,encode:()=>Gu,escape:()=>Ku,parse:()=>parse,stringify:()=>stringify,unescape:()=>qu,unescapeBuffer:()=>unescapeBuffer}),Wu,Gu,Ku,qu,Ju,Yu=__esmMin(()=>{zu(),Bu(),Vu(),Hu(),Wu=parse,Gu=stringify,Ku=qsEscape,qu=qsUnescape,Ju={parse,stringify,decode:Wu,encode:Gu,unescape:qu,escape:Ku,unescapeBuffer}}),Xu=__commonJSMin((e=>{
219
219
  /*!
220
220
  * express
221
221
  * Copyright(c) 2009-2013 TJ Holowaychuk
222
222
  * Copyright(c) 2014-2015 Douglas Christopher Wilson
223
223
  * MIT Licensed
224
224
  */
225
- var{METHODS:t}=(Ou(),__toCommonJS(wu)),n=ms(),r=ku(),i=ds(),a=Mu(),o=ul(),s=(Wu(),__toCommonJS(Pu));let{Buffer:c}=(J(),__toCommonJS(Yt));e.methods=t.map(e=>e.toLowerCase()),e.etag=createETagGenerator({weak:!1}),e.wetag=createETagGenerator({weak:!0}),e.normalizeType=function(e){return~e.indexOf(`/`)?acceptParams(e):{value:i.lookup(e)||`application/octet-stream`,params:{}}},e.normalizeTypes=function(t){return t.map(e.normalizeType)};function acceptParams(e){for(var t=e.length,n=e.indexOf(`;`),r=n===-1?t:n,i={value:e.slice(0,r).trim(),quality:1,params:{}};r<t;){var a=e.indexOf(`=`,r);if(a===-1)break;var n=e.indexOf(`;`,r),o=n===-1?t:n;if(a>o){r=e.lastIndexOf(`;`,a-1)+1;continue}var s=e.slice(r,a).trim(),c=e.slice(a+1,o).trim();s===`q`?i.quality=parseFloat(c):i.params[s]=c,r=o+1}return i}e.compileETag=function(t){var n;if(typeof t==`function`)return t;switch(t){case!0:case`weak`:n=e.wetag;break;case!1:break;case`strong`:n=e.etag;break;default:throw TypeError(`unknown value for etag function: `+t)}return n},e.compileQueryParser=function compileQueryParser(e){var t;if(typeof e==`function`)return e;switch(e){case!0:case`simple`:t=s.parse;break;case!1:break;case`extended`:t=parseExtendedQueryString;break;default:throw TypeError(`unknown value for query parser function: `+e)}return t},e.compileTrust=function(e){return typeof e==`function`?e:e===!0?function(){return!0}:typeof e==`number`?function(t,n){return n<e}:(typeof e==`string`&&(e=e.split(`,`).map(function(e){return e.trim()})),a.compile(e||[]))},e.setCharset=function setCharset(e,t){if(!e||!t)return e;var r=n.parse(e);return r.parameters.charset=t,n.format(r)};function createETagGenerator(e){return function generateETag(t,n){return r(c.isBuffer(t)?t:c.from(t,n),e)}}function parseExtendedQueryString(e){return o.parse(e,{allowPrototypes:!0})}})),Ku=__commonJSMin(((e,t)=>{t.exports=wrappy;function wrappy(e,t){if(e&&t)return wrappy(e)(t);if(typeof e!=`function`)throw TypeError(`need wrapper function`);return Object.keys(e).forEach(function(t){wrapper[t]=e[t]}),wrapper;function wrapper(){for(var t=Array(arguments.length),n=0;n<t.length;n++)t[n]=arguments[n];var r=e.apply(this,t),i=t[t.length-1];return typeof r==`function`&&r!==i&&Object.keys(i).forEach(function(e){r[e]=i[e]}),r}}})),qu=__commonJSMin(((e,t)=>{var n=Ku();t.exports=n(once),t.exports.strict=n(onceStrict),once.proto=once(function(){Object.defineProperty(Function.prototype,"once",{value:function(){return once(this)},configurable:!0}),Object.defineProperty(Function.prototype,"onceStrict",{value:function(){return onceStrict(this)},configurable:!0})});function once(e){var f=function(){return f.called?f.value:(f.called=!0,f.value=e.apply(this,arguments))};return f.called=!1,f}function onceStrict(e){var f=function(){if(f.called)throw Error(f.onceError);return f.called=!0,f.value=e.apply(this,arguments)};return f.onceError=(e.name||"Function wrapped with `once`")+` shouldn't be called more than once`,f.called=!1,f}})),Ju=__exportAll$4({default:()=>isPromise});function isPromise(e){return!!e&&(typeof e==`object`||typeof e==`function`)&&typeof e.then==`function`}var Yu=__esmMin(()=>{}),Xu=__commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.PathError=e.TokenData=void 0,e.parse=parse,e.compile=compile,e.match=match,e.pathToRegexp=pathToRegexp,e.stringify=stringify;let NOOP_VALUE=e=>e,t=/^[$_\p{ID_Start}]$/u,n=/^[$\u200c\u200d\p{ID_Continue}]$/u,r=/^[$_\p{ID_Start}][$\u200c\u200d\p{ID_Continue}]*$/u;function escapeText(e){return e.replace(/[{}()\[\]+?!:*\\]/g,`\\$&`)}function escape(e){return e.replace(/[.+*?^${}()[\]|/\\]/g,`\\$&`)}var TokenData=class{constructor(e,t){this.tokens=e,this.originalPath=t}};e.TokenData=TokenData;var PathError=class extends TypeError{constructor(e,t){let n=e;t&&(n+=`: ${t}`),n+=`; visit https://git.new/pathToRegexpError for info`,super(n),this.originalPath=t}};e.PathError=PathError;function parse(e,r={}){let{encodePath:i=NOOP_VALUE}=r,a=[...e],o=0;function consumeUntil(r){let s=[],c=``;function writePath(){c&&=(s.push({type:`text`,value:i(c)}),``)}for(;o<a.length;){let i=a[o++];if(i===r)return writePath(),s;if(i===`\\`){if(o===a.length)throw new PathError(`Unexpected end after \\ at index ${o}`,e);c+=a[o++];continue}if(i===`:`||i===`*`){let r=i===`:`?`param`:`wildcard`,c=``;if(t.test(a[o]))do c+=a[o++];while(n.test(a[o]));else if(a[o]===`"`){let t=o;for(;o<a.length;){if(a[++o]===`"`){o++,t=0;break}a[o]===`\\`&&o++,c+=a[o]}if(t)throw new PathError(`Unterminated quote at index ${t}`,e)}if(!c)throw new PathError(`Missing parameter name at index ${o}`,e);writePath(),s.push({type:r,name:c});continue}if(i===`{`){writePath(),s.push({type:`group`,tokens:consumeUntil(`}`)});continue}if(i===`}`||i===`(`||i===`)`||i===`[`||i===`]`||i===`+`||i===`?`||i===`!`)throw new PathError(`Unexpected ${i} at index ${o-1}`,e);c+=i}if(r)throw new PathError(`Unexpected end at index ${o}, expected ${r}`,e);return writePath(),s}return new TokenData(consumeUntil(``),e)}function compile(e,t={}){let{encode:n=encodeURIComponent,delimiter:r=`/`}=t,i=tokensToFunction((typeof e==`object`?e:parse(e,t)).tokens,r,n);return function path(e={}){let t=[],n=i(e,t);if(t.length)throw TypeError(`Missing parameters: ${t.join(`, `)}`);return n}}function tokensToFunction(e,t,n){let r=e.map(e=>tokenToFunction(e,t,n));return(e,t)=>{let n=``;for(let i of r)n+=i(e,t);return n}}function tokenToFunction(e,t,n){if(e.type===`text`)return()=>e.value;if(e.type===`group`){let r=tokensToFunction(e.tokens,t,n);return(e,t)=>{let n=t.length,i=r(e,t);return t.length===n?i:(t.length=n,``)}}let r=n||NOOP_VALUE;return e.type===`wildcard`&&n!==!1?(n,i)=>{let a=n[e.name];if(a==null)return i.push(e.name),``;if(!Array.isArray(a)||a.length===0)throw TypeError(`Expected "${e.name}" to be a non-empty array`);let o=``;for(let n=0;n<a.length;n++){if(typeof a[n]!=`string`)throw TypeError(`Expected "${e.name}/${n}" to be a string`);n>0&&(o+=t),o+=r(a[n])}return o}:(t,n)=>{let i=t[e.name];if(i==null)return n.push(e.name),``;if(typeof i!=`string`)throw TypeError(`Expected "${e.name}" to be a string`);return r(i)}}function match(e,t={}){let{decode:n=decodeURIComponent,delimiter:r=`/`}=t,{regexp:i,keys:a}=pathToRegexp(e,t),o=a.map(e=>n===!1?NOOP_VALUE:e.type===`param`?n:e=>e.split(r).map(n));return function match(e){let t=i.exec(e);if(!t)return!1;let n=t[0],r=Object.create(null);for(let e=1;e<t.length;e++){if(t[e]===void 0)continue;let n=a[e-1],i=o[e-1];r[n.name]=i(t[e])}return{path:n,params:r}}}function pathToRegexp(e,t={}){let{delimiter:n=`/`,end:r=!0,sensitive:i=!1,trailing:a=!0}=t,o=[],s=``,c=0;function process(e){if(Array.isArray(e)){for(let t of e)process(t);return}let r=typeof e==`object`?e:parse(e,t);flatten(r.tokens,0,[],e=>{if(c>=256)throw new PathError(`Too many path combinations`,r.originalPath);c>0&&(s+=`|`),s+=toRegExpSource(e,n,o,r.originalPath),c++})}process(e);let l=`^(?:${s})`;return a&&(l+=`(?:`+escape(n)+`$)?`),l+=r?`$`:`(?=`+escape(n)+`|$)`,{regexp:new RegExp(l,i?``:`i`),keys:o}}function flatten(e,t,n,r){for(;t<e.length;){let i=e[t++];if(i.type===`group`){let a=n.length;flatten(i.tokens,0,n,n=>flatten(e,t,n,r)),n.length=a;continue}n.push(i)}r(n)}function toRegExpSource(e,t,n,r){let i=``,a=``,o=``,s=0,c=0,l=0;function hasInSegment(n,r){for(;n<e.length;){let i=e[n++];if(i.type===r)return!0;if(i.type===`text`&&i.value.includes(t))break}return!1}function peekText(t){let n=``;for(;t<e.length;){let r=e[t++];if(r.type!==`text`)break;n+=r.value}return n}for(;l<e.length;){let u=e[l++];if(u.type===`text`){i+=escape(u.value),a+=u.value,s===2&&(o+=u.value),u.value.includes(t)&&(c=0);continue}if(u.type===`param`||u.type===`wildcard`){if(s&&!a)throw new PathError(`Missing text before "${u.name}" ${u.type}`,r);u.type===`param`?(i+=c&2?`(${negate(t,a)}+)`:hasInSegment(l,`wildcard`)?`(${negate(t,peekText(l))}+)`:c&1?`(${negate(t,a)}+|${escape(a)})`:`(${negate(t,``)}+)`,c|=s=1):(i+=c&2?`(${negate(a,``)}+)`:o?`(${negate(o,``)}+|${negate(t,``)}+)`:`([^]+)`,o=``,c|=s=2),n.push(u),a=``;continue}throw TypeError(`Unknown token type: ${u.type}`)}return i}function negate(e,t){return t.length>e.length?negate(t,e):(e===t&&(t=``),t.length>1?`(?:(?!${escape(e)}|${escape(t)})[^])`:e.length>1?`(?:(?!${escape(e)})[^${escape(t)}])`:`[^${escape(e+t)}]`)}function stringifyTokens(e,t){let n=``;for(;t<e.length;){let r=e[t++];if(r.type===`text`){n+=escapeText(r.value);continue}if(r.type===`group`){n+=`{`+stringifyTokens(r.tokens,0)+`}`;continue}if(r.type===`param`){n+=`:`+stringifyName(r.name,e[t]);continue}if(r.type===`wildcard`){n+=`*`+stringifyName(r.name,e[t]);continue}throw TypeError(`Unknown token type: ${r.type}`)}return n}function stringify(e){return stringifyTokens(e.tokens,0)}function stringifyName(e,t){return!r.test(e)||t?.type===`text`&&n.test(t.value[0])?JSON.stringify(e):e}})),Zu=__commonJSMin(((e,t)=>{
225
+ var{METHODS:t}=(Ou(),__toCommonJS(wu)),n=ms(),r=ku(),i=ds(),a=Mu(),o=ul(),s=(Yu(),__toCommonJS(Uu));let{Buffer:c}=(J(),__toCommonJS(Yt));e.methods=t.map(e=>e.toLowerCase()),e.etag=createETagGenerator({weak:!1}),e.wetag=createETagGenerator({weak:!0}),e.normalizeType=function(e){return~e.indexOf(`/`)?acceptParams(e):{value:i.lookup(e)||`application/octet-stream`,params:{}}},e.normalizeTypes=function(t){return t.map(e.normalizeType)};function acceptParams(e){for(var t=e.length,n=e.indexOf(`;`),r=n===-1?t:n,i={value:e.slice(0,r).trim(),quality:1,params:{}};r<t;){var a=e.indexOf(`=`,r);if(a===-1)break;var n=e.indexOf(`;`,r),o=n===-1?t:n;if(a>o){r=e.lastIndexOf(`;`,a-1)+1;continue}var s=e.slice(r,a).trim(),c=e.slice(a+1,o).trim();s===`q`?i.quality=parseFloat(c):i.params[s]=c,r=o+1}return i}e.compileETag=function(t){var n;if(typeof t==`function`)return t;switch(t){case!0:case`weak`:n=e.wetag;break;case!1:break;case`strong`:n=e.etag;break;default:throw TypeError(`unknown value for etag function: `+t)}return n},e.compileQueryParser=function compileQueryParser(e){var t;if(typeof e==`function`)return e;switch(e){case!0:case`simple`:t=s.parse;break;case!1:break;case`extended`:t=parseExtendedQueryString;break;default:throw TypeError(`unknown value for query parser function: `+e)}return t},e.compileTrust=function(e){return typeof e==`function`?e:e===!0?function(){return!0}:typeof e==`number`?function(t,n){return n<e}:(typeof e==`string`&&(e=e.split(`,`).map(function(e){return e.trim()})),a.compile(e||[]))},e.setCharset=function setCharset(e,t){if(!e||!t)return e;var r=n.parse(e);return r.parameters.charset=t,n.format(r)};function createETagGenerator(e){return function generateETag(t,n){return r(c.isBuffer(t)?t:c.from(t,n),e)}}function parseExtendedQueryString(e){return o.parse(e,{allowPrototypes:!0})}})),Zu=__commonJSMin(((e,t)=>{t.exports=wrappy;function wrappy(e,t){if(e&&t)return wrappy(e)(t);if(typeof e!=`function`)throw TypeError(`need wrapper function`);return Object.keys(e).forEach(function(t){wrapper[t]=e[t]}),wrapper;function wrapper(){for(var t=Array(arguments.length),n=0;n<t.length;n++)t[n]=arguments[n];var r=e.apply(this,t),i=t[t.length-1];return typeof r==`function`&&r!==i&&Object.keys(i).forEach(function(e){r[e]=i[e]}),r}}})),Qu=__commonJSMin(((e,t)=>{var n=Zu();t.exports=n(once),t.exports.strict=n(onceStrict),once.proto=once(function(){Object.defineProperty(Function.prototype,"once",{value:function(){return once(this)},configurable:!0}),Object.defineProperty(Function.prototype,"onceStrict",{value:function(){return onceStrict(this)},configurable:!0})});function once(e){var f=function(){return f.called?f.value:(f.called=!0,f.value=e.apply(this,arguments))};return f.called=!1,f}function onceStrict(e){var f=function(){if(f.called)throw Error(f.onceError);return f.called=!0,f.value=e.apply(this,arguments)};return f.onceError=(e.name||"Function wrapped with `once`")+` shouldn't be called more than once`,f.called=!1,f}})),$u=__exportAll$4({default:()=>isPromise});function isPromise(e){return!!e&&(typeof e==`object`||typeof e==`function`)&&typeof e.then==`function`}var ed=__esmMin(()=>{}),td=__commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.PathError=e.TokenData=void 0,e.parse=parse,e.compile=compile,e.match=match,e.pathToRegexp=pathToRegexp,e.stringify=stringify;let NOOP_VALUE=e=>e,t=/^[$_\p{ID_Start}]$/u,n=/^[$\u200c\u200d\p{ID_Continue}]$/u,r=/^[$_\p{ID_Start}][$\u200c\u200d\p{ID_Continue}]*$/u;function escapeText(e){return e.replace(/[{}()\[\]+?!:*\\]/g,`\\$&`)}function escape(e){return e.replace(/[.+*?^${}()[\]|/\\]/g,`\\$&`)}var TokenData=class{constructor(e,t){this.tokens=e,this.originalPath=t}};e.TokenData=TokenData;var PathError=class extends TypeError{constructor(e,t){let n=e;t&&(n+=`: ${t}`),n+=`; visit https://git.new/pathToRegexpError for info`,super(n),this.originalPath=t}};e.PathError=PathError;function parse(e,r={}){let{encodePath:i=NOOP_VALUE}=r,a=[...e],o=0;function consumeUntil(r){let s=[],c=``;function writePath(){c&&=(s.push({type:`text`,value:i(c)}),``)}for(;o<a.length;){let i=a[o++];if(i===r)return writePath(),s;if(i===`\\`){if(o===a.length)throw new PathError(`Unexpected end after \\ at index ${o}`,e);c+=a[o++];continue}if(i===`:`||i===`*`){let r=i===`:`?`param`:`wildcard`,c=``;if(t.test(a[o]))do c+=a[o++];while(n.test(a[o]));else if(a[o]===`"`){let t=o;for(;o<a.length;){if(a[++o]===`"`){o++,t=0;break}a[o]===`\\`&&o++,c+=a[o]}if(t)throw new PathError(`Unterminated quote at index ${t}`,e)}if(!c)throw new PathError(`Missing parameter name at index ${o}`,e);writePath(),s.push({type:r,name:c});continue}if(i===`{`){writePath(),s.push({type:`group`,tokens:consumeUntil(`}`)});continue}if(i===`}`||i===`(`||i===`)`||i===`[`||i===`]`||i===`+`||i===`?`||i===`!`)throw new PathError(`Unexpected ${i} at index ${o-1}`,e);c+=i}if(r)throw new PathError(`Unexpected end at index ${o}, expected ${r}`,e);return writePath(),s}return new TokenData(consumeUntil(``),e)}function compile(e,t={}){let{encode:n=encodeURIComponent,delimiter:r=`/`}=t,i=tokensToFunction((typeof e==`object`?e:parse(e,t)).tokens,r,n);return function path(e={}){let t=[],n=i(e,t);if(t.length)throw TypeError(`Missing parameters: ${t.join(`, `)}`);return n}}function tokensToFunction(e,t,n){let r=e.map(e=>tokenToFunction(e,t,n));return(e,t)=>{let n=``;for(let i of r)n+=i(e,t);return n}}function tokenToFunction(e,t,n){if(e.type===`text`)return()=>e.value;if(e.type===`group`){let r=tokensToFunction(e.tokens,t,n);return(e,t)=>{let n=t.length,i=r(e,t);return t.length===n?i:(t.length=n,``)}}let r=n||NOOP_VALUE;return e.type===`wildcard`&&n!==!1?(n,i)=>{let a=n[e.name];if(a==null)return i.push(e.name),``;if(!Array.isArray(a)||a.length===0)throw TypeError(`Expected "${e.name}" to be a non-empty array`);let o=``;for(let n=0;n<a.length;n++){if(typeof a[n]!=`string`)throw TypeError(`Expected "${e.name}/${n}" to be a string`);n>0&&(o+=t),o+=r(a[n])}return o}:(t,n)=>{let i=t[e.name];if(i==null)return n.push(e.name),``;if(typeof i!=`string`)throw TypeError(`Expected "${e.name}" to be a string`);return r(i)}}function match(e,t={}){let{decode:n=decodeURIComponent,delimiter:r=`/`}=t,{regexp:i,keys:a}=pathToRegexp(e,t),o=a.map(e=>n===!1?NOOP_VALUE:e.type===`param`?n:e=>e.split(r).map(n));return function match(e){let t=i.exec(e);if(!t)return!1;let n=t[0],r=Object.create(null);for(let e=1;e<t.length;e++){if(t[e]===void 0)continue;let n=a[e-1],i=o[e-1];r[n.name]=i(t[e])}return{path:n,params:r}}}function pathToRegexp(e,t={}){let{delimiter:n=`/`,end:r=!0,sensitive:i=!1,trailing:a=!0}=t,o=[],s=``,c=0;function process(e){if(Array.isArray(e)){for(let t of e)process(t);return}let r=typeof e==`object`?e:parse(e,t);flatten(r.tokens,0,[],e=>{if(c>=256)throw new PathError(`Too many path combinations`,r.originalPath);c>0&&(s+=`|`),s+=toRegExpSource(e,n,o,r.originalPath),c++})}process(e);let l=`^(?:${s})`;return a&&(l+=`(?:`+escape(n)+`$)?`),l+=r?`$`:`(?=`+escape(n)+`|$)`,{regexp:new RegExp(l,i?``:`i`),keys:o}}function flatten(e,t,n,r){for(;t<e.length;){let i=e[t++];if(i.type===`group`){let a=n.length;flatten(i.tokens,0,n,n=>flatten(e,t,n,r)),n.length=a;continue}n.push(i)}r(n)}function toRegExpSource(e,t,n,r){let i=``,a=``,o=``,s=0,c=0,l=0;function hasInSegment(n,r){for(;n<e.length;){let i=e[n++];if(i.type===r)return!0;if(i.type===`text`&&i.value.includes(t))break}return!1}function peekText(t){let n=``;for(;t<e.length;){let r=e[t++];if(r.type!==`text`)break;n+=r.value}return n}for(;l<e.length;){let u=e[l++];if(u.type===`text`){i+=escape(u.value),a+=u.value,s===2&&(o+=u.value),u.value.includes(t)&&(c=0);continue}if(u.type===`param`||u.type===`wildcard`){if(s&&!a)throw new PathError(`Missing text before "${u.name}" ${u.type}`,r);u.type===`param`?(i+=c&2?`(${negate(t,a)}+)`:hasInSegment(l,`wildcard`)?`(${negate(t,peekText(l))}+)`:c&1?`(${negate(t,a)}+|${escape(a)})`:`(${negate(t,``)}+)`,c|=s=1):(i+=c&2?`(${negate(a,``)}+)`:o?`(${negate(o,``)}+|${negate(t,``)}+)`:`([^]+)`,o=``,c|=s=2),n.push(u),a=``;continue}throw TypeError(`Unknown token type: ${u.type}`)}return i}function negate(e,t){return t.length>e.length?negate(t,e):(e===t&&(t=``),t.length>1?`(?:(?!${escape(e)}|${escape(t)})[^])`:e.length>1?`(?:(?!${escape(e)})[^${escape(t)}])`:`[^${escape(e+t)}]`)}function stringifyTokens(e,t){let n=``;for(;t<e.length;){let r=e[t++];if(r.type===`text`){n+=escapeText(r.value);continue}if(r.type===`group`){n+=`{`+stringifyTokens(r.tokens,0)+`}`;continue}if(r.type===`param`){n+=`:`+stringifyName(r.name,e[t]);continue}if(r.type===`wildcard`){n+=`*`+stringifyName(r.name,e[t]);continue}throw TypeError(`Unknown token type: ${r.type}`)}return n}function stringify(e){return stringifyTokens(e.tokens,0)}function stringifyName(e,t){return!r.test(e)||t?.type===`text`&&n.test(t.value[0])?JSON.stringify(e):e}})),nd=__commonJSMin(((e,t)=>{
226
226
  /*!
227
227
  * router
228
228
  * Copyright(c) 2013 Roman Shtylman
229
229
  * Copyright(c) 2014-2022 Douglas Christopher Wilson
230
230
  * MIT Licensed
231
231
  */
232
- let n=(Yu(),__toCommonJS(Ju)),r=Xu(),i=po()(`router:layer`),a=mo()(`router`),o=/\/+$/,s=/\((?:\?<(.*?)>)?(?!\?)/g;t.exports=Layer;function Layer(e,t,n){if(!(this instanceof Layer))return new Layer(e,t,n);i(`new %o`,e);let a=t||{};this.handle=n,this.keys=[],this.name=n.name||`<anonymous>`,this.params=void 0,this.path=void 0,this.slash=e===`/`&&a.end===!1;function matcher(e){if(e instanceof RegExp){let t=[],n=0,r;for(;r=s.exec(e.source);)t.push({name:r[1]||n++,offset:r.index});return function regexpMatcher(n){let r=e.exec(n);if(!r)return!1;let i={};for(let e=1;e<r.length;e++){let n=t[e-1].name,a=decodeParam(r[e]);a!==void 0&&(i[n]=a)}return{params:i,path:r[0]}}}return r.match(a.strict?e:loosen(e),{sensitive:a.sensitive,end:a.end,trailing:!a.strict,decode:decodeParam})}this.matchers=Array.isArray(e)?e.map(matcher):[matcher(e)]}Layer.prototype.handleError=function handleError(e,t,r,i){let o=this.handle;if(o.length!==4)return i(e);try{let s=o(e,t,r,i);n(s)&&(s instanceof Promise||a(`handlers that are Promise-like are deprecated, use a native Promise instead`),s.then(null,function(e){i(e||Error(`Rejected promise`))}))}catch(e){i(e)}},Layer.prototype.handleRequest=function handleRequest(e,t,r){let i=this.handle;if(i.length>3)return r();try{let o=i(e,t,r);n(o)&&(o instanceof Promise||a(`handlers that are Promise-like are deprecated, use a native Promise instead`),o.then(null,function(e){r(e||Error(`Rejected promise`))}))}catch(e){r(e)}},Layer.prototype.match=function match(e){let t;if(e!=null){if(this.slash)return this.params={},this.path=``,!0;let n=0;for(;!t&&n<this.matchers.length;)t=this.matchers[n](e),n++}return t?(this.params=t.params,this.path=t.path,this.keys=Object.keys(t.params),!0):(this.params=void 0,this.path=void 0,!1)};function decodeParam(e){if(typeof e!=`string`||e.length===0)return e;try{return decodeURIComponent(e)}catch(t){throw t instanceof URIError&&(t.message=`Failed to decode param '`+e+`'`,t.status=400),t}}function loosen(e){return e instanceof RegExp||e===`/`?e:Array.isArray(e)?e.map(function(e){return loosen(e)}):String(e).replace(o,``)}})),Qu=__commonJSMin(((e,t)=>{
232
+ let n=(ed(),__toCommonJS($u)),r=td(),i=po()(`router:layer`),a=mo()(`router`),o=/\/+$/,s=/\((?:\?<(.*?)>)?(?!\?)/g;t.exports=Layer;function Layer(e,t,n){if(!(this instanceof Layer))return new Layer(e,t,n);i(`new %o`,e);let a=t||{};this.handle=n,this.keys=[],this.name=n.name||`<anonymous>`,this.params=void 0,this.path=void 0,this.slash=e===`/`&&a.end===!1;function matcher(e){if(e instanceof RegExp){let t=[],n=0,r;for(;r=s.exec(e.source);)t.push({name:r[1]||n++,offset:r.index});return function regexpMatcher(n){let r=e.exec(n);if(!r)return!1;let i={};for(let e=1;e<r.length;e++){let n=t[e-1].name,a=decodeParam(r[e]);a!==void 0&&(i[n]=a)}return{params:i,path:r[0]}}}return r.match(a.strict?e:loosen(e),{sensitive:a.sensitive,end:a.end,trailing:!a.strict,decode:decodeParam})}this.matchers=Array.isArray(e)?e.map(matcher):[matcher(e)]}Layer.prototype.handleError=function handleError(e,t,r,i){let o=this.handle;if(o.length!==4)return i(e);try{let s=o(e,t,r,i);n(s)&&(s instanceof Promise||a(`handlers that are Promise-like are deprecated, use a native Promise instead`),s.then(null,function(e){i(e||Error(`Rejected promise`))}))}catch(e){i(e)}},Layer.prototype.handleRequest=function handleRequest(e,t,r){let i=this.handle;if(i.length>3)return r();try{let o=i(e,t,r);n(o)&&(o instanceof Promise||a(`handlers that are Promise-like are deprecated, use a native Promise instead`),o.then(null,function(e){r(e||Error(`Rejected promise`))}))}catch(e){r(e)}},Layer.prototype.match=function match(e){let t;if(e!=null){if(this.slash)return this.params={},this.path=``,!0;let n=0;for(;!t&&n<this.matchers.length;)t=this.matchers[n](e),n++}return t?(this.params=t.params,this.path=t.path,this.keys=Object.keys(t.params),!0):(this.params=void 0,this.path=void 0,!1)};function decodeParam(e){if(typeof e!=`string`||e.length===0)return e;try{return decodeURIComponent(e)}catch(t){throw t instanceof URIError&&(t.message=`Failed to decode param '`+e+`'`,t.status=400),t}}function loosen(e){return e instanceof RegExp||e===`/`?e:Array.isArray(e)?e.map(function(e){return loosen(e)}):String(e).replace(o,``)}})),rd=__commonJSMin(((e,t)=>{
233
233
  /*!
234
234
  * router
235
235
  * Copyright(c) 2013 Roman Shtylman
236
236
  * Copyright(c) 2014-2022 Douglas Christopher Wilson
237
237
  * MIT Licensed
238
238
  */
239
- let n=po()(`router:route`),r=Zu(),{METHODS:i}=(Ou(),__toCommonJS(wu)),a=Array.prototype.slice,o=Array.prototype.flat,s=i.map(e=>e.toLowerCase());t.exports=Route;function Route(e){n(`new %o`,e),this.path=e,this.stack=[],this.methods=Object.create(null)}Route.prototype._handlesMethod=function _handlesMethod(e){if(this.methods._all)return!0;let t=typeof e==`string`?e.toLowerCase():e;return t===`head`&&!this.methods.head&&(t=`get`),!!this.methods[t]},Route.prototype._methods=function _methods(){let e=Object.keys(this.methods);this.methods.get&&!this.methods.head&&e.push(`head`);for(let t=0;t<e.length;t++)e[t]=e[t].toUpperCase();return e},Route.prototype.dispatch=function dispatch(e,t,n){let r=0,i=this.stack,a=0;if(i.length===0)return n();let o=typeof e.method==`string`?e.method.toLowerCase():e.method;o===`head`&&!this.methods.head&&(o=`get`),e.route=this,next();function next(s){if(s&&s===`route`)return n();if(s&&s===`router`||r>=i.length)return n(s);if(++a>100)return setImmediate(next,s);let c,l;for(;l!==!0&&r<i.length;)c=i[r++],l=!c.method||c.method===o;if(l!==!0)return n(s);s?c.handleError(s,e,t,next):c.handleRequest(e,t,next),a=0}},Route.prototype.all=function all(e){let t=o.call(a.call(arguments),1/0);if(t.length===0)throw TypeError(`argument handler is required`);for(let e=0;e<t.length;e++){let n=t[e];if(typeof n!=`function`)throw TypeError(`argument handler must be a function`);let i=r(`/`,{},n);i.method=void 0,this.methods._all=!0,this.stack.push(i)}return this},s.forEach(function(e){Route.prototype[e]=function(t){let i=o.call(a.call(arguments),1/0);if(i.length===0)throw TypeError(`argument handler is required`);for(let t=0;t<i.length;t++){let a=i[t];if(typeof a!=`function`)throw TypeError(`argument handler must be a function`);n(`%s %s`,e,this.path);let o=r(`/`,{},a);o.method=e,this.methods[e]=!0,this.stack.push(o)}return this}})})),$u=__commonJSMin(((e,t)=>{
239
+ let n=po()(`router:route`),r=nd(),{METHODS:i}=(Ou(),__toCommonJS(wu)),a=Array.prototype.slice,o=Array.prototype.flat,s=i.map(e=>e.toLowerCase());t.exports=Route;function Route(e){n(`new %o`,e),this.path=e,this.stack=[],this.methods=Object.create(null)}Route.prototype._handlesMethod=function _handlesMethod(e){if(this.methods._all)return!0;let t=typeof e==`string`?e.toLowerCase():e;return t===`head`&&!this.methods.head&&(t=`get`),!!this.methods[t]},Route.prototype._methods=function _methods(){let e=Object.keys(this.methods);this.methods.get&&!this.methods.head&&e.push(`head`);for(let t=0;t<e.length;t++)e[t]=e[t].toUpperCase();return e},Route.prototype.dispatch=function dispatch(e,t,n){let r=0,i=this.stack,a=0;if(i.length===0)return n();let o=typeof e.method==`string`?e.method.toLowerCase():e.method;o===`head`&&!this.methods.head&&(o=`get`),e.route=this,next();function next(s){if(s&&s===`route`)return n();if(s&&s===`router`||r>=i.length)return n(s);if(++a>100)return setImmediate(next,s);let c,l;for(;l!==!0&&r<i.length;)c=i[r++],l=!c.method||c.method===o;if(l!==!0)return n(s);s?c.handleError(s,e,t,next):c.handleRequest(e,t,next),a=0}},Route.prototype.all=function all(e){let t=o.call(a.call(arguments),1/0);if(t.length===0)throw TypeError(`argument handler is required`);for(let e=0;e<t.length;e++){let n=t[e];if(typeof n!=`function`)throw TypeError(`argument handler must be a function`);let i=r(`/`,{},n);i.method=void 0,this.methods._all=!0,this.stack.push(i)}return this},s.forEach(function(e){Route.prototype[e]=function(t){let i=o.call(a.call(arguments),1/0);if(i.length===0)throw TypeError(`argument handler is required`);for(let t=0;t<i.length;t++){let a=i[t];if(typeof a!=`function`)throw TypeError(`argument handler must be a function`);n(`%s %s`,e,this.path);let o=r(`/`,{},a);o.method=e,this.methods[e]=!0,this.stack.push(o)}return this}})})),id=__commonJSMin(((e,t)=>{
240
240
  /*!
241
241
  * router
242
242
  * Copyright(c) 2013 Roman Shtylman
243
243
  * Copyright(c) 2014-2022 Douglas Christopher Wilson
244
244
  * MIT Licensed
245
245
  */
246
- let n=(Yu(),__toCommonJS(Ju)),r=Zu(),{METHODS:i}=(Ou(),__toCommonJS(wu)),a=_l(),o=Qu(),s=po()(`router`),c=mo()(`router`),l=Array.prototype.slice,u=Array.prototype.flat,d=i.map(e=>e.toLowerCase());t.exports=Router,t.exports.Route=o;function Router(e){if(!(this instanceof Router))return new Router(e);let t=e||{};function router(e,t,n){router.handle(e,t,n)}return Object.setPrototypeOf(router,this),router.caseSensitive=t.caseSensitive,router.mergeParams=t.mergeParams,router.params={},router.strict=t.strict,router.stack=[],router}Router.prototype=function(){},Router.prototype.param=function param(e,t){if(!e)throw TypeError(`argument name is required`);if(typeof e!=`string`)throw TypeError(`argument name must be a string`);if(!t)throw TypeError(`argument fn is required`);if(typeof t!=`function`)throw TypeError(`argument fn must be a function`);let n=this.params[e];return n||=this.params[e]=[],n.push(t),this},Router.prototype.handle=function handle(e,t,n){if(!n)throw TypeError(`argument callback is required`);s(`dispatching %s %s`,e.method,e.url);let r=0,i,a=getProtohost(e.url)||``,o=``,c=this,l=!1,u=0,d={},p=this.stack,m=e.params,h=e.baseUrl||``,g=restore(n,e,`baseUrl`,`next`,`params`);e.next=next,e.method===`OPTIONS`&&(i=[],g=wrap(g,generateOptionsResponder(t,i))),e.baseUrl=h,e.originalUrl=e.originalUrl||e.url,next();function next(n){let s=n===`route`?null:n;if(l&&=(e.url=e.url.slice(1),!1),o.length!==0&&(e.baseUrl=h,e.url=a+o+e.url.slice(a.length),o=``),s===`router`){setImmediate(g,null);return}if(r>=p.length){setImmediate(g,s);return}if(++u>100)return setImmediate(next,n);let _=getPathname(e);if(_==null)return g(s);let v,y,b;for(;y!==!0&&r<p.length;){if(v=p[r++],y=matchLayer(v,_),b=v.route,typeof y!=`boolean`&&(s||=y),y!==!0||!b)continue;if(s){y=!1;continue}let t=e.method,n=b._handlesMethod(t);!n&&t===`OPTIONS`&&i&&i.push.apply(i,b._methods()),!n&&t!==`HEAD`&&(y=!1)}if(y!==!0)return g(s);b&&(e.route=b),e.params=c.mergeParams?mergeParams(v.params,m):v.params;let x=v.path;processParams(c.params,v,d,e,t,function(n){n?next(s||n):b?v.handleRequest(e,t,next):trimPrefix(v,s,x,_),u=0})}function trimPrefix(n,r,i,c){if(i.length!==0){if(i!==c.substring(0,i.length)){next(r);return}let t=c[i.length];if(t&&t!==`/`){next(r);return}s(`trim prefix (%s) from url %s`,i,e.url),o=i,e.url=a+e.url.slice(a.length+o.length),!a&&e.url[0]!==`/`&&(e.url=`/`+e.url,l=!0),e.baseUrl=h+(o[o.length-1]===`/`?o.substring(0,o.length-1):o)}s(`%s %s : %s`,n.name,i,e.originalUrl),r?n.handleError(r,e,t,next):n.handleRequest(e,t,next)}},Router.prototype.use=function use(e){let t=0,n=`/`;if(typeof e!=`function`){let r=e;for(;Array.isArray(r)&&r.length!==0;)r=r[0];typeof r!=`function`&&(t=1,n=e)}let i=u.call(l.call(arguments,t),1/0);if(i.length===0)throw TypeError(`argument handler is required`);for(let e=0;e<i.length;e++){let t=i[e];if(typeof t!=`function`)throw TypeError(`argument handler must be a function`);s(`use %o %s`,n,t.name||`<anonymous>`);let a=new r(n,{sensitive:this.caseSensitive,strict:!1,end:!1},t);a.route=void 0,this.stack.push(a)}return this},Router.prototype.route=function route(e){let t=new o(e),n=new r(e,{sensitive:this.caseSensitive,strict:this.strict,end:!0},handle);function handle(e,n,r){t.dispatch(e,n,r)}return n.route=t,this.stack.push(n),t},d.concat(`all`).forEach(function(e){Router.prototype[e]=function(t){let n=this.route(t);return n[e].apply(n,l.call(arguments,1)),this}});function generateOptionsResponder(e,t){return function onDone(n,r){if(r||t.length===0)return n(r);trySendOptionsResponse(e,t,n)}}function getPathname(e){try{return a(e).pathname}catch{return}}function getProtohost(e){if(typeof e!=`string`||e.length===0||e[0]===`/`)return;let t=e.indexOf(`?`),n=t===-1?e.length:t,r=e.substring(0,n).indexOf(`://`);return r===-1?void 0:e.substring(0,e.indexOf(`/`,3+r))}function matchLayer(e,t){try{return e.match(t)}catch(e){return e}}function mergeParams(e,t){if(typeof t!=`object`||!t)return e;let n=Object.assign({},t);if(!(0 in e)||!(0 in t))return Object.assign(n,e);let r=0,i=0;for(;r in e;)r++;for(;i in t;)i++;for(r--;r>=0;r--)e[r+i]=e[r],r<i&&delete e[r];return Object.assign(n,e)}function processParams(e,t,r,i,a,o){let s=t.keys;if(!s||s.length===0)return o();let l=0,u=0,d,p,m,h;function param(t){if(t)return o(t);if(l>=s.length)return o();if(u=0,d=s[l++],p=i.params[d],m=e[d],h=r[d],p===void 0||!m)return param();if(h&&(h.match===p||h.error&&h.error!==`route`))return i.params[d]=h.value,param(h.error);r[d]=h={error:null,match:p,value:p},paramCallback()}function paramCallback(e){let t=m[u++];if(h.value=i.params[d],e){h.error=e,param(e);return}if(!t)return param();try{let e=t(i,a,paramCallback,p,d);n(e)&&(e instanceof Promise||c(`parameters that are Promise-like are deprecated, use a native Promise instead`),e.then(null,function(e){paramCallback(e||Error(`Rejected promise`))}))}catch(e){paramCallback(e)}}param()}function restore(e,t){let n=Array(arguments.length-2),r=Array(arguments.length-2);for(let e=0;e<n.length;e++)n[e]=arguments[e+2],r[e]=t[n[e]];return function(){for(let e=0;e<n.length;e++)t[n[e]]=r[e];return e.apply(this,arguments)}}function sendOptionsResponse(e,t){let n=Object.create(null);for(let e=0;e<t.length;e++)n[t[e]]=!0;let r=Object.keys(n).sort().join(`, `);e.setHeader(`Allow`,r),e.setHeader(`Content-Length`,Buffer.byteLength(r)),e.setHeader(`Content-Type`,`text/plain`),e.setHeader(`X-Content-Type-Options`,`nosniff`),e.end(r)}function trySendOptionsResponse(e,t,n){try{sendOptionsResponse(e,t)}catch(e){n(e)}}function wrap(e,t){return function proxy(){let n=Array(arguments.length+1);n[0]=e;for(let e=0,t=arguments.length;e<t;e++)n[e+1]=arguments[e];t.apply(this,n)}}})),ed=__commonJSMin(((e,t)=>{
246
+ let n=(ed(),__toCommonJS($u)),r=nd(),{METHODS:i}=(Ou(),__toCommonJS(wu)),a=_l(),o=rd(),s=po()(`router`),c=mo()(`router`),l=Array.prototype.slice,u=Array.prototype.flat,d=i.map(e=>e.toLowerCase());t.exports=Router,t.exports.Route=o;function Router(e){if(!(this instanceof Router))return new Router(e);let t=e||{};function router(e,t,n){router.handle(e,t,n)}return Object.setPrototypeOf(router,this),router.caseSensitive=t.caseSensitive,router.mergeParams=t.mergeParams,router.params={},router.strict=t.strict,router.stack=[],router}Router.prototype=function(){},Router.prototype.param=function param(e,t){if(!e)throw TypeError(`argument name is required`);if(typeof e!=`string`)throw TypeError(`argument name must be a string`);if(!t)throw TypeError(`argument fn is required`);if(typeof t!=`function`)throw TypeError(`argument fn must be a function`);let n=this.params[e];return n||=this.params[e]=[],n.push(t),this},Router.prototype.handle=function handle(e,t,n){if(!n)throw TypeError(`argument callback is required`);s(`dispatching %s %s`,e.method,e.url);let r=0,i,a=getProtohost(e.url)||``,o=``,c=this,l=!1,u=0,d={},p=this.stack,m=e.params,h=e.baseUrl||``,g=restore(n,e,`baseUrl`,`next`,`params`);e.next=next,e.method===`OPTIONS`&&(i=[],g=wrap(g,generateOptionsResponder(t,i))),e.baseUrl=h,e.originalUrl=e.originalUrl||e.url,next();function next(n){let s=n===`route`?null:n;if(l&&=(e.url=e.url.slice(1),!1),o.length!==0&&(e.baseUrl=h,e.url=a+o+e.url.slice(a.length),o=``),s===`router`){setImmediate(g,null);return}if(r>=p.length){setImmediate(g,s);return}if(++u>100)return setImmediate(next,n);let _=getPathname(e);if(_==null)return g(s);let v,y,b;for(;y!==!0&&r<p.length;){if(v=p[r++],y=matchLayer(v,_),b=v.route,typeof y!=`boolean`&&(s||=y),y!==!0||!b)continue;if(s){y=!1;continue}let t=e.method,n=b._handlesMethod(t);!n&&t===`OPTIONS`&&i&&i.push.apply(i,b._methods()),!n&&t!==`HEAD`&&(y=!1)}if(y!==!0)return g(s);b&&(e.route=b),e.params=c.mergeParams?mergeParams(v.params,m):v.params;let x=v.path;processParams(c.params,v,d,e,t,function(n){n?next(s||n):b?v.handleRequest(e,t,next):trimPrefix(v,s,x,_),u=0})}function trimPrefix(n,r,i,c){if(i.length!==0){if(i!==c.substring(0,i.length)){next(r);return}let t=c[i.length];if(t&&t!==`/`){next(r);return}s(`trim prefix (%s) from url %s`,i,e.url),o=i,e.url=a+e.url.slice(a.length+o.length),!a&&e.url[0]!==`/`&&(e.url=`/`+e.url,l=!0),e.baseUrl=h+(o[o.length-1]===`/`?o.substring(0,o.length-1):o)}s(`%s %s : %s`,n.name,i,e.originalUrl),r?n.handleError(r,e,t,next):n.handleRequest(e,t,next)}},Router.prototype.use=function use(e){let t=0,n=`/`;if(typeof e!=`function`){let r=e;for(;Array.isArray(r)&&r.length!==0;)r=r[0];typeof r!=`function`&&(t=1,n=e)}let i=u.call(l.call(arguments,t),1/0);if(i.length===0)throw TypeError(`argument handler is required`);for(let e=0;e<i.length;e++){let t=i[e];if(typeof t!=`function`)throw TypeError(`argument handler must be a function`);s(`use %o %s`,n,t.name||`<anonymous>`);let a=new r(n,{sensitive:this.caseSensitive,strict:!1,end:!1},t);a.route=void 0,this.stack.push(a)}return this},Router.prototype.route=function route(e){let t=new o(e),n=new r(e,{sensitive:this.caseSensitive,strict:this.strict,end:!0},handle);function handle(e,n,r){t.dispatch(e,n,r)}return n.route=t,this.stack.push(n),t},d.concat(`all`).forEach(function(e){Router.prototype[e]=function(t){let n=this.route(t);return n[e].apply(n,l.call(arguments,1)),this}});function generateOptionsResponder(e,t){return function onDone(n,r){if(r||t.length===0)return n(r);trySendOptionsResponse(e,t,n)}}function getPathname(e){try{return a(e).pathname}catch{return}}function getProtohost(e){if(typeof e!=`string`||e.length===0||e[0]===`/`)return;let t=e.indexOf(`?`),n=t===-1?e.length:t,r=e.substring(0,n).indexOf(`://`);return r===-1?void 0:e.substring(0,e.indexOf(`/`,3+r))}function matchLayer(e,t){try{return e.match(t)}catch(e){return e}}function mergeParams(e,t){if(typeof t!=`object`||!t)return e;let n=Object.assign({},t);if(!(0 in e)||!(0 in t))return Object.assign(n,e);let r=0,i=0;for(;r in e;)r++;for(;i in t;)i++;for(r--;r>=0;r--)e[r+i]=e[r],r<i&&delete e[r];return Object.assign(n,e)}function processParams(e,t,r,i,a,o){let s=t.keys;if(!s||s.length===0)return o();let l=0,u=0,d,p,m,h;function param(t){if(t)return o(t);if(l>=s.length)return o();if(u=0,d=s[l++],p=i.params[d],m=e[d],h=r[d],p===void 0||!m)return param();if(h&&(h.match===p||h.error&&h.error!==`route`))return i.params[d]=h.value,param(h.error);r[d]=h={error:null,match:p,value:p},paramCallback()}function paramCallback(e){let t=m[u++];if(h.value=i.params[d],e){h.error=e,param(e);return}if(!t)return param();try{let e=t(i,a,paramCallback,p,d);n(e)&&(e instanceof Promise||c(`parameters that are Promise-like are deprecated, use a native Promise instead`),e.then(null,function(e){paramCallback(e||Error(`Rejected promise`))}))}catch(e){paramCallback(e)}}param()}function restore(e,t){let n=Array(arguments.length-2),r=Array(arguments.length-2);for(let e=0;e<n.length;e++)n[e]=arguments[e+2],r[e]=t[n[e]];return function(){for(let e=0;e<n.length;e++)t[n[e]]=r[e];return e.apply(this,arguments)}}function sendOptionsResponse(e,t){let n=Object.create(null);for(let e=0;e<t.length;e++)n[t[e]]=!0;let r=Object.keys(n).sort().join(`, `);e.setHeader(`Allow`,r),e.setHeader(`Content-Length`,Buffer.byteLength(r)),e.setHeader(`Content-Type`,`text/plain`),e.setHeader(`X-Content-Type-Options`,`nosniff`),e.end(r)}function trySendOptionsResponse(e,t,n){try{sendOptionsResponse(e,t)}catch(e){n(e)}}function wrap(e,t){return function proxy(){let n=Array(arguments.length+1);n[0]=e;for(let e=0,t=arguments.length;e<t;e++)n[e+1]=arguments[e];t.apply(this,n)}}})),ad=__commonJSMin(((e,t)=>{
247
247
  /*!
248
248
  * express
249
249
  * Copyright(c) 2009-2013 TJ Holowaychuk
@@ -251,7 +251,7 @@ let n=(Yu(),__toCommonJS(Ju)),r=Zu(),{METHODS:i}=(Ou(),__toCommonJS(wu)),a=_l(),
251
251
  * Copyright(c) 2014-2015 Douglas Christopher Wilson
252
252
  * MIT Licensed
253
253
  */
254
- me();var n=vl(),r=po()(`express:application`),i=su(),a=(Ou(),__toCommonJS(wu)),o=Gu().methods,s=Gu().compileETag,c=Gu().compileQueryParser,l=Gu().compileTrust,u=(lo(),__toCommonJS(Ja)).resolve,d=qu(),p=$u(),m=Array.prototype.slice,h=Array.prototype.flat,g=e=t.exports={},_=`@@symbol:trust_proxy_default`;g.init=function init(){var e=null;this.cache=Object.create(null),this.engines=Object.create(null),this.settings=Object.create(null),this.defaultConfiguration(),Object.defineProperty(this,"router",{configurable:!0,enumerable:!0,get:function getrouter(){return e===null&&(e=new p({caseSensitive:this.enabled(`case sensitive routing`),strict:this.enabled(`strict routing`)})),e}})},g.defaultConfiguration=function defaultConfiguration(){var e=process.env.NODE_ENV||`development`;this.enable(`x-powered-by`),this.set(`etag`,`weak`),this.set(`env`,e),this.set(`query parser`,`simple`),this.set(`subdomain offset`,2),this.set(`trust proxy`,!1),Object.defineProperty(this.settings,_,{configurable:!0,value:!0}),r(`booting in %s mode`,e),this.on(`mount`,function onmount(e){this.settings[_]===!0&&typeof e.settings[`trust proxy fn`]==`function`&&(delete this.settings[`trust proxy`],delete this.settings[`trust proxy fn`]),Object.setPrototypeOf(this.request,e.request),Object.setPrototypeOf(this.response,e.response),Object.setPrototypeOf(this.engines,e.engines),Object.setPrototypeOf(this.settings,e.settings)}),this.locals=Object.create(null),this.mountpath=`/`,this.locals.settings=this.settings,this.set(`view`,i),this.set(`views`,u(`views`)),this.set(`jsonp callback name`,`callback`),e===`production`&&this.enable(`view cache`)},g.handle=function handle(e,t,r){var i=r||n(e,t,{env:this.get(`env`),onerror:logerror.bind(this)});this.enabled(`x-powered-by`)&&t.setHeader(`X-Powered-By`,`Express`),e.res=t,t.req=e,Object.setPrototypeOf(e,this.request),Object.setPrototypeOf(t,this.response),t.locals||=Object.create(null),this.router.handle(e,t,i)},g.use=function use(e){var t=0,n=`/`;if(typeof e!=`function`){for(var i=e;Array.isArray(i)&&i.length!==0;)i=i[0];typeof i!=`function`&&(t=1,n=e)}var a=h.call(m.call(arguments,t),1/0);if(a.length===0)throw TypeError(`app.use() requires a middleware function`);var o=this.router;return a.forEach(function(e){if(!e||!e.handle||!e.set)return o.use(n,e);r(`.use app under %s`,n),e.mountpath=n,e.parent=this,o.use(n,function mounted_app(t,n,r){var i=t.app;e.handle(t,n,function(e){Object.setPrototypeOf(t,i.request),Object.setPrototypeOf(n,i.response),r(e)})}),e.emit(`mount`,this)},this),this},g.route=function route(e){return this.router.route(e)},g.engine=function engine(e,t){if(typeof t!=`function`)throw Error(`callback function required`);var n=e[0]===`.`?e:`.`+e;return this.engines[n]=t,this},g.param=function param(e,t){if(Array.isArray(e)){for(var n=0;n<e.length;n++)this.param(e[n],t);return this}return this.router.param(e,t),this},g.set=function set(e,t){if(arguments.length===1)return this.settings[e];switch(r(`set "%s" to %o`,e,t),this.settings[e]=t,e){case`etag`:this.set(`etag fn`,s(t));break;case`query parser`:this.set(`query parser fn`,c(t));break;case`trust proxy`:this.set(`trust proxy fn`,l(t)),Object.defineProperty(this.settings,_,{configurable:!0,value:!1});break}return this},g.path=function path(){return this.parent?this.parent.path()+this.mountpath:``},g.enabled=function enabled(e){return!!this.set(e)},g.disabled=function disabled(e){return!this.set(e)},g.enable=function enable(e){return this.set(e,!0)},g.disable=function disable(e){return this.set(e,!1)},o.forEach(function(e){g[e]=function(t){if(e===`get`&&arguments.length===1)return this.set(t);var n=this.route(t);return n[e].apply(n,m.call(arguments,1)),this}}),g.all=function all(e){for(var t=this.route(e),n=m.call(arguments,1),r=0;r<o.length;r++)t[o[r]].apply(t,n);return this},g.render=function render(e,t,n){var r=this.cache,i=n,a=this.engines,o=t,s;typeof t==`function`&&(i=t,o={});var c={...this.locals,...o._locals,...o};if(c.cache??=this.enabled(`view cache`),c.cache&&(s=r[e]),!s){if(s=new(this.get(`view`))(e,{defaultEngine:this.get(`view engine`),root:this.get(`views`),engines:a}),!s.path){var l=Array.isArray(s.root)&&s.root.length>1?`directories "`+s.root.slice(0,-1).join(`", "`)+`" or "`+s.root[s.root.length-1]+`"`:`directory "`+s.root+`"`,u=Error(`Failed to lookup view "`+e+`" in views `+l);return u.view=s,i(u)}c.cache&&(r[e]=s)}tryRender(s,c,i)},g.listen=function listen(){var e=a.createServer(this),t=m.call(arguments);if(typeof t[t.length-1]==`function`){var n=t[t.length-1]=d(t[t.length-1]);e.once(`error`,n)}return e.listen.apply(e,t)};function logerror(e){this.get(`env`)!==`test`&&I.error(e.stack||e.toString())}function tryRender(e,t,n){try{e.render(t,n)}catch(e){n(e)}}})),td=__commonJSMin(((e,t)=>{t.exports=preferredCharsets,t.exports.preferredCharsets=preferredCharsets;var n=/^\s*([^\s;]+)\s*(?:;(.*))?$/;function parseAcceptCharset(e){for(var t=e.split(`,`),n=0,r=0;n<t.length;n++){var i=parseCharset(t[n].trim(),n);i&&(t[r++]=i)}return t.length=r,t}function parseCharset(e,t){var r=n.exec(e);if(!r)return null;var i=r[1],a=1;if(r[2])for(var o=r[2].split(`;`),s=0;s<o.length;s++){var c=o[s].trim().split(`=`);if(c[0]===`q`){a=parseFloat(c[1]);break}}return{charset:i,q:a,i:t}}function getCharsetPriority(e,t,n){for(var r={o:-1,q:0,s:0},i=0;i<t.length;i++){var a=specify(e,t[i],n);a&&(r.s-a.s||r.q-a.q||r.o-a.o)<0&&(r=a)}return r}function specify(e,t,n){var r=0;if(t.charset.toLowerCase()===e.toLowerCase())r|=1;else if(t.charset!==`*`)return null;return{i:n,o:t.i,q:t.q,s:r}}function preferredCharsets(e,t){var n=parseAcceptCharset(e===void 0?`*`:e||``);if(!t)return n.filter(isQuality).sort(compareSpecs).map(getFullCharset);var r=t.map(function getPriority(e,t){return getCharsetPriority(e,n,t)});return r.filter(isQuality).sort(compareSpecs).map(function getCharset(e){return t[r.indexOf(e)]})}function compareSpecs(e,t){return t.q-e.q||t.s-e.s||e.o-t.o||e.i-t.i||0}function getFullCharset(e){return e.charset}function isQuality(e){return e.q>0}})),nd=__commonJSMin(((e,t)=>{t.exports=preferredEncodings,t.exports.preferredEncodings=preferredEncodings;var n=/^\s*([^\s;]+)\s*(?:;(.*))?$/;function parseAcceptEncoding(e){for(var t=e.split(`,`),n=!1,r=1,i=0,a=0;i<t.length;i++){var o=parseEncoding(t[i].trim(),i);o&&(t[a++]=o,n||=specify(`identity`,o),r=Math.min(r,o.q||1))}return n||(t[a++]={encoding:`identity`,q:r,i}),t.length=a,t}function parseEncoding(e,t){var r=n.exec(e);if(!r)return null;var i=r[1],a=1;if(r[2])for(var o=r[2].split(`;`),s=0;s<o.length;s++){var c=o[s].trim().split(`=`);if(c[0]===`q`){a=parseFloat(c[1]);break}}return{encoding:i,q:a,i:t}}function getEncodingPriority(e,t,n){for(var r={encoding:e,o:-1,q:0,s:0},i=0;i<t.length;i++){var a=specify(e,t[i],n);a&&(r.s-a.s||r.q-a.q||r.o-a.o)<0&&(r=a)}return r}function specify(e,t,n){var r=0;if(t.encoding.toLowerCase()===e.toLowerCase())r|=1;else if(t.encoding!==`*`)return null;return{encoding:e,i:n,o:t.i,q:t.q,s:r}}function preferredEncodings(e,t,n){var r=parseAcceptEncoding(e||``),i=n?function comparator(e,t){if(e.q!==t.q)return t.q-e.q;var r=n.indexOf(e.encoding),i=n.indexOf(t.encoding);return r===-1&&i===-1?t.s-e.s||e.o-t.o||e.i-t.i:r!==-1&&i!==-1?r-i:r===-1?1:-1}:compareSpecs;if(!t)return r.filter(isQuality).sort(i).map(getFullEncoding);var a=t.map(function getPriority(e,t){return getEncodingPriority(e,r,t)});return a.filter(isQuality).sort(i).map(function getEncoding(e){return t[a.indexOf(e)]})}function compareSpecs(e,t){return t.q-e.q||t.s-e.s||e.o-t.o||e.i-t.i}function getFullEncoding(e){return e.encoding}function isQuality(e){return e.q>0}})),rd=__commonJSMin(((e,t)=>{t.exports=preferredLanguages,t.exports.preferredLanguages=preferredLanguages;var n=/^\s*([^\s\-;]+)(?:-([^\s;]+))?\s*(?:;(.*))?$/;function parseAcceptLanguage(e){for(var t=e.split(`,`),n=0,r=0;n<t.length;n++){var i=parseLanguage(t[n].trim(),n);i&&(t[r++]=i)}return t.length=r,t}function parseLanguage(e,t){var r=n.exec(e);if(!r)return null;var i=r[1],a=r[2],o=i;a&&(o+=`-`+a);var s=1;if(r[3])for(var c=r[3].split(`;`),l=0;l<c.length;l++){var u=c[l].split(`=`);u[0]===`q`&&(s=parseFloat(u[1]))}return{prefix:i,suffix:a,q:s,i:t,full:o}}function getLanguagePriority(e,t,n){for(var r={o:-1,q:0,s:0},i=0;i<t.length;i++){var a=specify(e,t[i],n);a&&(r.s-a.s||r.q-a.q||r.o-a.o)<0&&(r=a)}return r}function specify(e,t,n){var r=parseLanguage(e);if(!r)return null;var i=0;if(t.full.toLowerCase()===r.full.toLowerCase())i|=4;else if(t.prefix.toLowerCase()===r.full.toLowerCase())i|=2;else if(t.full.toLowerCase()===r.prefix.toLowerCase())i|=1;else if(t.full!==`*`)return null;return{i:n,o:t.i,q:t.q,s:i}}function preferredLanguages(e,t){var n=parseAcceptLanguage(e===void 0?`*`:e||``);if(!t)return n.filter(isQuality).sort(compareSpecs).map(getFullLanguage);var r=t.map(function getPriority(e,t){return getLanguagePriority(e,n,t)});return r.filter(isQuality).sort(compareSpecs).map(function getLanguage(e){return t[r.indexOf(e)]})}function compareSpecs(e,t){return t.q-e.q||t.s-e.s||e.o-t.o||e.i-t.i||0}function getFullLanguage(e){return e.full}function isQuality(e){return e.q>0}})),id=__commonJSMin(((e,t)=>{t.exports=preferredMediaTypes,t.exports.preferredMediaTypes=preferredMediaTypes;var n=/^\s*([^\s\/;]+)\/([^;\s]+)\s*(?:;(.*))?$/;function parseAccept(e){for(var t=splitMediaTypes(e),n=0,r=0;n<t.length;n++){var i=parseMediaType(t[n].trim(),n);i&&(t[r++]=i)}return t.length=r,t}function parseMediaType(e,t){var r=n.exec(e);if(!r)return null;var i=Object.create(null),a=1,o=r[2],s=r[1];if(r[3])for(var c=splitParameters(r[3]).map(splitKeyValuePair),l=0;l<c.length;l++){var u=c[l],d=u[0].toLowerCase(),p=u[1],m=p&&p[0]===`"`&&p[p.length-1]===`"`?p.slice(1,-1):p;if(d===`q`){a=parseFloat(m);break}i[d]=m}return{type:s,subtype:o,params:i,q:a,i:t}}function getMediaTypePriority(e,t,n){for(var r={o:-1,q:0,s:0},i=0;i<t.length;i++){var a=specify(e,t[i],n);a&&(r.s-a.s||r.q-a.q||r.o-a.o)<0&&(r=a)}return r}function specify(e,t,n){var r=parseMediaType(e),i=0;if(!r)return null;if(t.type.toLowerCase()==r.type.toLowerCase())i|=4;else if(t.type!=`*`)return null;if(t.subtype.toLowerCase()==r.subtype.toLowerCase())i|=2;else if(t.subtype!=`*`)return null;var a=Object.keys(t.params);if(a.length>0)if(a.every(function(e){return t.params[e]==`*`||(t.params[e]||``).toLowerCase()==(r.params[e]||``).toLowerCase()}))i|=1;else return null;return{i:n,o:t.i,q:t.q,s:i}}function preferredMediaTypes(e,t){var n=parseAccept(e===void 0?`*/*`:e||``);if(!t)return n.filter(isQuality).sort(compareSpecs).map(getFullType);var r=t.map(function getPriority(e,t){return getMediaTypePriority(e,n,t)});return r.filter(isQuality).sort(compareSpecs).map(function getType(e){return t[r.indexOf(e)]})}function compareSpecs(e,t){return t.q-e.q||t.s-e.s||e.o-t.o||e.i-t.i||0}function getFullType(e){return e.type+`/`+e.subtype}function isQuality(e){return e.q>0}function quoteCount(e){for(var t=0,n=0;(n=e.indexOf(`"`,n))!==-1;)t++,n++;return t}function splitKeyValuePair(e){var t=e.indexOf(`=`),n,r;return t===-1?n=e:(n=e.slice(0,t),r=e.slice(t+1)),[n,r]}function splitMediaTypes(e){for(var t=e.split(`,`),n=1,r=0;n<t.length;n++)quoteCount(t[r])%2==0?t[++r]=t[n]:t[r]+=`,`+t[n];return t.length=r+1,t}function splitParameters(e){for(var t=e.split(`;`),n=1,r=0;n<t.length;n++)quoteCount(t[r])%2==0?t[++r]=t[n]:t[r]+=`;`+t[n];t.length=r+1;for(var n=0;n<t.length;n++)t[n]=t[n].trim();return t}})),ad=__commonJSMin(((e,t)=>{
254
+ me();var n=vl(),r=po()(`express:application`),i=su(),a=(Ou(),__toCommonJS(wu)),o=Xu().methods,s=Xu().compileETag,c=Xu().compileQueryParser,l=Xu().compileTrust,u=(lo(),__toCommonJS(Ja)).resolve,d=Qu(),p=id(),m=Array.prototype.slice,h=Array.prototype.flat,g=e=t.exports={},_=`@@symbol:trust_proxy_default`;g.init=function init(){var e=null;this.cache=Object.create(null),this.engines=Object.create(null),this.settings=Object.create(null),this.defaultConfiguration(),Object.defineProperty(this,"router",{configurable:!0,enumerable:!0,get:function getrouter(){return e===null&&(e=new p({caseSensitive:this.enabled(`case sensitive routing`),strict:this.enabled(`strict routing`)})),e}})},g.defaultConfiguration=function defaultConfiguration(){var e=process.env.NODE_ENV||`development`;this.enable(`x-powered-by`),this.set(`etag`,`weak`),this.set(`env`,e),this.set(`query parser`,`simple`),this.set(`subdomain offset`,2),this.set(`trust proxy`,!1),Object.defineProperty(this.settings,_,{configurable:!0,value:!0}),r(`booting in %s mode`,e),this.on(`mount`,function onmount(e){this.settings[_]===!0&&typeof e.settings[`trust proxy fn`]==`function`&&(delete this.settings[`trust proxy`],delete this.settings[`trust proxy fn`]),Object.setPrototypeOf(this.request,e.request),Object.setPrototypeOf(this.response,e.response),Object.setPrototypeOf(this.engines,e.engines),Object.setPrototypeOf(this.settings,e.settings)}),this.locals=Object.create(null),this.mountpath=`/`,this.locals.settings=this.settings,this.set(`view`,i),this.set(`views`,u(`views`)),this.set(`jsonp callback name`,`callback`),e===`production`&&this.enable(`view cache`)},g.handle=function handle(e,t,r){var i=r||n(e,t,{env:this.get(`env`),onerror:logerror.bind(this)});this.enabled(`x-powered-by`)&&t.setHeader(`X-Powered-By`,`Express`),e.res=t,t.req=e,Object.setPrototypeOf(e,this.request),Object.setPrototypeOf(t,this.response),t.locals||=Object.create(null),this.router.handle(e,t,i)},g.use=function use(e){var t=0,n=`/`;if(typeof e!=`function`){for(var i=e;Array.isArray(i)&&i.length!==0;)i=i[0];typeof i!=`function`&&(t=1,n=e)}var a=h.call(m.call(arguments,t),1/0);if(a.length===0)throw TypeError(`app.use() requires a middleware function`);var o=this.router;return a.forEach(function(e){if(!e||!e.handle||!e.set)return o.use(n,e);r(`.use app under %s`,n),e.mountpath=n,e.parent=this,o.use(n,function mounted_app(t,n,r){var i=t.app;e.handle(t,n,function(e){Object.setPrototypeOf(t,i.request),Object.setPrototypeOf(n,i.response),r(e)})}),e.emit(`mount`,this)},this),this},g.route=function route(e){return this.router.route(e)},g.engine=function engine(e,t){if(typeof t!=`function`)throw Error(`callback function required`);var n=e[0]===`.`?e:`.`+e;return this.engines[n]=t,this},g.param=function param(e,t){if(Array.isArray(e)){for(var n=0;n<e.length;n++)this.param(e[n],t);return this}return this.router.param(e,t),this},g.set=function set(e,t){if(arguments.length===1)return this.settings[e];switch(r(`set "%s" to %o`,e,t),this.settings[e]=t,e){case`etag`:this.set(`etag fn`,s(t));break;case`query parser`:this.set(`query parser fn`,c(t));break;case`trust proxy`:this.set(`trust proxy fn`,l(t)),Object.defineProperty(this.settings,_,{configurable:!0,value:!1});break}return this},g.path=function path(){return this.parent?this.parent.path()+this.mountpath:``},g.enabled=function enabled(e){return!!this.set(e)},g.disabled=function disabled(e){return!this.set(e)},g.enable=function enable(e){return this.set(e,!0)},g.disable=function disable(e){return this.set(e,!1)},o.forEach(function(e){g[e]=function(t){if(e===`get`&&arguments.length===1)return this.set(t);var n=this.route(t);return n[e].apply(n,m.call(arguments,1)),this}}),g.all=function all(e){for(var t=this.route(e),n=m.call(arguments,1),r=0;r<o.length;r++)t[o[r]].apply(t,n);return this},g.render=function render(e,t,n){var r=this.cache,i=n,a=this.engines,o=t,s;typeof t==`function`&&(i=t,o={});var c={...this.locals,...o._locals,...o};if(c.cache??=this.enabled(`view cache`),c.cache&&(s=r[e]),!s){if(s=new(this.get(`view`))(e,{defaultEngine:this.get(`view engine`),root:this.get(`views`),engines:a}),!s.path){var l=Array.isArray(s.root)&&s.root.length>1?`directories "`+s.root.slice(0,-1).join(`", "`)+`" or "`+s.root[s.root.length-1]+`"`:`directory "`+s.root+`"`,u=Error(`Failed to lookup view "`+e+`" in views `+l);return u.view=s,i(u)}c.cache&&(r[e]=s)}tryRender(s,c,i)},g.listen=function listen(){var e=a.createServer(this),t=m.call(arguments);if(typeof t[t.length-1]==`function`){var n=t[t.length-1]=d(t[t.length-1]);e.once(`error`,n)}return e.listen.apply(e,t)};function logerror(e){this.get(`env`)!==`test`&&I.error(e.stack||e.toString())}function tryRender(e,t,n){try{e.render(t,n)}catch(e){n(e)}}})),od=__commonJSMin(((e,t)=>{t.exports=preferredCharsets,t.exports.preferredCharsets=preferredCharsets;var n=/^\s*([^\s;]+)\s*(?:;(.*))?$/;function parseAcceptCharset(e){for(var t=e.split(`,`),n=0,r=0;n<t.length;n++){var i=parseCharset(t[n].trim(),n);i&&(t[r++]=i)}return t.length=r,t}function parseCharset(e,t){var r=n.exec(e);if(!r)return null;var i=r[1],a=1;if(r[2])for(var o=r[2].split(`;`),s=0;s<o.length;s++){var c=o[s].trim().split(`=`);if(c[0]===`q`){a=parseFloat(c[1]);break}}return{charset:i,q:a,i:t}}function getCharsetPriority(e,t,n){for(var r={o:-1,q:0,s:0},i=0;i<t.length;i++){var a=specify(e,t[i],n);a&&(r.s-a.s||r.q-a.q||r.o-a.o)<0&&(r=a)}return r}function specify(e,t,n){var r=0;if(t.charset.toLowerCase()===e.toLowerCase())r|=1;else if(t.charset!==`*`)return null;return{i:n,o:t.i,q:t.q,s:r}}function preferredCharsets(e,t){var n=parseAcceptCharset(e===void 0?`*`:e||``);if(!t)return n.filter(isQuality).sort(compareSpecs).map(getFullCharset);var r=t.map(function getPriority(e,t){return getCharsetPriority(e,n,t)});return r.filter(isQuality).sort(compareSpecs).map(function getCharset(e){return t[r.indexOf(e)]})}function compareSpecs(e,t){return t.q-e.q||t.s-e.s||e.o-t.o||e.i-t.i||0}function getFullCharset(e){return e.charset}function isQuality(e){return e.q>0}})),sd=__commonJSMin(((e,t)=>{t.exports=preferredEncodings,t.exports.preferredEncodings=preferredEncodings;var n=/^\s*([^\s;]+)\s*(?:;(.*))?$/;function parseAcceptEncoding(e){for(var t=e.split(`,`),n=!1,r=1,i=0,a=0;i<t.length;i++){var o=parseEncoding(t[i].trim(),i);o&&(t[a++]=o,n||=specify(`identity`,o),r=Math.min(r,o.q||1))}return n||(t[a++]={encoding:`identity`,q:r,i}),t.length=a,t}function parseEncoding(e,t){var r=n.exec(e);if(!r)return null;var i=r[1],a=1;if(r[2])for(var o=r[2].split(`;`),s=0;s<o.length;s++){var c=o[s].trim().split(`=`);if(c[0]===`q`){a=parseFloat(c[1]);break}}return{encoding:i,q:a,i:t}}function getEncodingPriority(e,t,n){for(var r={encoding:e,o:-1,q:0,s:0},i=0;i<t.length;i++){var a=specify(e,t[i],n);a&&(r.s-a.s||r.q-a.q||r.o-a.o)<0&&(r=a)}return r}function specify(e,t,n){var r=0;if(t.encoding.toLowerCase()===e.toLowerCase())r|=1;else if(t.encoding!==`*`)return null;return{encoding:e,i:n,o:t.i,q:t.q,s:r}}function preferredEncodings(e,t,n){var r=parseAcceptEncoding(e||``),i=n?function comparator(e,t){if(e.q!==t.q)return t.q-e.q;var r=n.indexOf(e.encoding),i=n.indexOf(t.encoding);return r===-1&&i===-1?t.s-e.s||e.o-t.o||e.i-t.i:r!==-1&&i!==-1?r-i:r===-1?1:-1}:compareSpecs;if(!t)return r.filter(isQuality).sort(i).map(getFullEncoding);var a=t.map(function getPriority(e,t){return getEncodingPriority(e,r,t)});return a.filter(isQuality).sort(i).map(function getEncoding(e){return t[a.indexOf(e)]})}function compareSpecs(e,t){return t.q-e.q||t.s-e.s||e.o-t.o||e.i-t.i}function getFullEncoding(e){return e.encoding}function isQuality(e){return e.q>0}})),cd=__commonJSMin(((e,t)=>{t.exports=preferredLanguages,t.exports.preferredLanguages=preferredLanguages;var n=/^\s*([^\s\-;]+)(?:-([^\s;]+))?\s*(?:;(.*))?$/;function parseAcceptLanguage(e){for(var t=e.split(`,`),n=0,r=0;n<t.length;n++){var i=parseLanguage(t[n].trim(),n);i&&(t[r++]=i)}return t.length=r,t}function parseLanguage(e,t){var r=n.exec(e);if(!r)return null;var i=r[1],a=r[2],o=i;a&&(o+=`-`+a);var s=1;if(r[3])for(var c=r[3].split(`;`),l=0;l<c.length;l++){var u=c[l].split(`=`);u[0]===`q`&&(s=parseFloat(u[1]))}return{prefix:i,suffix:a,q:s,i:t,full:o}}function getLanguagePriority(e,t,n){for(var r={o:-1,q:0,s:0},i=0;i<t.length;i++){var a=specify(e,t[i],n);a&&(r.s-a.s||r.q-a.q||r.o-a.o)<0&&(r=a)}return r}function specify(e,t,n){var r=parseLanguage(e);if(!r)return null;var i=0;if(t.full.toLowerCase()===r.full.toLowerCase())i|=4;else if(t.prefix.toLowerCase()===r.full.toLowerCase())i|=2;else if(t.full.toLowerCase()===r.prefix.toLowerCase())i|=1;else if(t.full!==`*`)return null;return{i:n,o:t.i,q:t.q,s:i}}function preferredLanguages(e,t){var n=parseAcceptLanguage(e===void 0?`*`:e||``);if(!t)return n.filter(isQuality).sort(compareSpecs).map(getFullLanguage);var r=t.map(function getPriority(e,t){return getLanguagePriority(e,n,t)});return r.filter(isQuality).sort(compareSpecs).map(function getLanguage(e){return t[r.indexOf(e)]})}function compareSpecs(e,t){return t.q-e.q||t.s-e.s||e.o-t.o||e.i-t.i||0}function getFullLanguage(e){return e.full}function isQuality(e){return e.q>0}})),ld=__commonJSMin(((e,t)=>{t.exports=preferredMediaTypes,t.exports.preferredMediaTypes=preferredMediaTypes;var n=/^\s*([^\s\/;]+)\/([^;\s]+)\s*(?:;(.*))?$/;function parseAccept(e){for(var t=splitMediaTypes(e),n=0,r=0;n<t.length;n++){var i=parseMediaType(t[n].trim(),n);i&&(t[r++]=i)}return t.length=r,t}function parseMediaType(e,t){var r=n.exec(e);if(!r)return null;var i=Object.create(null),a=1,o=r[2],s=r[1];if(r[3])for(var c=splitParameters(r[3]).map(splitKeyValuePair),l=0;l<c.length;l++){var u=c[l],d=u[0].toLowerCase(),p=u[1],m=p&&p[0]===`"`&&p[p.length-1]===`"`?p.slice(1,-1):p;if(d===`q`){a=parseFloat(m);break}i[d]=m}return{type:s,subtype:o,params:i,q:a,i:t}}function getMediaTypePriority(e,t,n){for(var r={o:-1,q:0,s:0},i=0;i<t.length;i++){var a=specify(e,t[i],n);a&&(r.s-a.s||r.q-a.q||r.o-a.o)<0&&(r=a)}return r}function specify(e,t,n){var r=parseMediaType(e),i=0;if(!r)return null;if(t.type.toLowerCase()==r.type.toLowerCase())i|=4;else if(t.type!=`*`)return null;if(t.subtype.toLowerCase()==r.subtype.toLowerCase())i|=2;else if(t.subtype!=`*`)return null;var a=Object.keys(t.params);if(a.length>0)if(a.every(function(e){return t.params[e]==`*`||(t.params[e]||``).toLowerCase()==(r.params[e]||``).toLowerCase()}))i|=1;else return null;return{i:n,o:t.i,q:t.q,s:i}}function preferredMediaTypes(e,t){var n=parseAccept(e===void 0?`*/*`:e||``);if(!t)return n.filter(isQuality).sort(compareSpecs).map(getFullType);var r=t.map(function getPriority(e,t){return getMediaTypePriority(e,n,t)});return r.filter(isQuality).sort(compareSpecs).map(function getType(e){return t[r.indexOf(e)]})}function compareSpecs(e,t){return t.q-e.q||t.s-e.s||e.o-t.o||e.i-t.i||0}function getFullType(e){return e.type+`/`+e.subtype}function isQuality(e){return e.q>0}function quoteCount(e){for(var t=0,n=0;(n=e.indexOf(`"`,n))!==-1;)t++,n++;return t}function splitKeyValuePair(e){var t=e.indexOf(`=`),n,r;return t===-1?n=e:(n=e.slice(0,t),r=e.slice(t+1)),[n,r]}function splitMediaTypes(e){for(var t=e.split(`,`),n=1,r=0;n<t.length;n++)quoteCount(t[r])%2==0?t[++r]=t[n]:t[r]+=`,`+t[n];return t.length=r+1,t}function splitParameters(e){for(var t=e.split(`;`),n=1,r=0;n<t.length;n++)quoteCount(t[r])%2==0?t[++r]=t[n]:t[r]+=`;`+t[n];t.length=r+1;for(var n=0;n<t.length;n++)t[n]=t[n].trim();return t}})),ud=__commonJSMin(((e,t)=>{
255
255
  /*!
256
256
  * negotiator
257
257
  * Copyright(c) 2012 Federico Romero
@@ -259,28 +259,28 @@ me();var n=vl(),r=po()(`express:application`),i=su(),a=(Ou(),__toCommonJS(wu)),o
259
259
  * Copyright(c) 2015 Douglas Christopher Wilson
260
260
  * MIT Licensed
261
261
  */
262
- var n=td(),r=nd(),i=rd(),a=id();t.exports=Negotiator,t.exports.Negotiator=Negotiator;function Negotiator(e){if(!(this instanceof Negotiator))return new Negotiator(e);this.request=e}Negotiator.prototype.charset=function charset(e){var t=this.charsets(e);return t&&t[0]},Negotiator.prototype.charsets=function charsets(e){return n(this.request.headers[`accept-charset`],e)},Negotiator.prototype.encoding=function encoding(e,t){var n=this.encodings(e,t);return n&&n[0]},Negotiator.prototype.encodings=function encodings(e,t){var n=t||{};return r(this.request.headers[`accept-encoding`],e,n.preferred)},Negotiator.prototype.language=function language(e){var t=this.languages(e);return t&&t[0]},Negotiator.prototype.languages=function languages(e){return i(this.request.headers[`accept-language`],e)},Negotiator.prototype.mediaType=function mediaType(e){var t=this.mediaTypes(e);return t&&t[0]},Negotiator.prototype.mediaTypes=function mediaTypes(e){return a(this.request.headers.accept,e)},Negotiator.prototype.preferredCharset=Negotiator.prototype.charset,Negotiator.prototype.preferredCharsets=Negotiator.prototype.charsets,Negotiator.prototype.preferredEncoding=Negotiator.prototype.encoding,Negotiator.prototype.preferredEncodings=Negotiator.prototype.encodings,Negotiator.prototype.preferredLanguage=Negotiator.prototype.language,Negotiator.prototype.preferredLanguages=Negotiator.prototype.languages,Negotiator.prototype.preferredMediaType=Negotiator.prototype.mediaType,Negotiator.prototype.preferredMediaTypes=Negotiator.prototype.mediaTypes})),od=__commonJSMin(((e,t)=>{
262
+ var n=od(),r=sd(),i=cd(),a=ld();t.exports=Negotiator,t.exports.Negotiator=Negotiator;function Negotiator(e){if(!(this instanceof Negotiator))return new Negotiator(e);this.request=e}Negotiator.prototype.charset=function charset(e){var t=this.charsets(e);return t&&t[0]},Negotiator.prototype.charsets=function charsets(e){return n(this.request.headers[`accept-charset`],e)},Negotiator.prototype.encoding=function encoding(e,t){var n=this.encodings(e,t);return n&&n[0]},Negotiator.prototype.encodings=function encodings(e,t){var n=t||{};return r(this.request.headers[`accept-encoding`],e,n.preferred)},Negotiator.prototype.language=function language(e){var t=this.languages(e);return t&&t[0]},Negotiator.prototype.languages=function languages(e){return i(this.request.headers[`accept-language`],e)},Negotiator.prototype.mediaType=function mediaType(e){var t=this.mediaTypes(e);return t&&t[0]},Negotiator.prototype.mediaTypes=function mediaTypes(e){return a(this.request.headers.accept,e)},Negotiator.prototype.preferredCharset=Negotiator.prototype.charset,Negotiator.prototype.preferredCharsets=Negotiator.prototype.charsets,Negotiator.prototype.preferredEncoding=Negotiator.prototype.encoding,Negotiator.prototype.preferredEncodings=Negotiator.prototype.encodings,Negotiator.prototype.preferredLanguage=Negotiator.prototype.language,Negotiator.prototype.preferredLanguages=Negotiator.prototype.languages,Negotiator.prototype.preferredMediaType=Negotiator.prototype.mediaType,Negotiator.prototype.preferredMediaTypes=Negotiator.prototype.mediaTypes})),dd=__commonJSMin(((e,t)=>{
263
263
  /*!
264
264
  * accepts
265
265
  * Copyright(c) 2014 Jonathan Ong
266
266
  * Copyright(c) 2015 Douglas Christopher Wilson
267
267
  * MIT Licensed
268
268
  */
269
- var n=ad(),r=ds();t.exports=Accepts;function Accepts(e){if(!(this instanceof Accepts))return new Accepts(e);this.headers=e.headers,this.negotiator=new n(e)}Accepts.prototype.type=Accepts.prototype.types=function(e){var t=e;if(t&&!Array.isArray(t)){t=Array(arguments.length);for(var n=0;n<t.length;n++)t[n]=arguments[n]}if(!t||t.length===0)return this.negotiator.mediaTypes();if(!this.headers.accept)return t[0];var r=t.map(extToMime),i=this.negotiator.mediaTypes(r.filter(validMime))[0];return i?t[r.indexOf(i)]:!1},Accepts.prototype.encoding=Accepts.prototype.encodings=function(e){var t=e;if(t&&!Array.isArray(t)){t=Array(arguments.length);for(var n=0;n<t.length;n++)t[n]=arguments[n]}return!t||t.length===0?this.negotiator.encodings():this.negotiator.encodings(t)[0]||!1},Accepts.prototype.charset=Accepts.prototype.charsets=function(e){var t=e;if(t&&!Array.isArray(t)){t=Array(arguments.length);for(var n=0;n<t.length;n++)t[n]=arguments[n]}return!t||t.length===0?this.negotiator.charsets():this.negotiator.charsets(t)[0]||!1},Accepts.prototype.lang=Accepts.prototype.langs=Accepts.prototype.language=Accepts.prototype.languages=function(e){var t=e;if(t&&!Array.isArray(t)){t=Array(arguments.length);for(var n=0;n<t.length;n++)t[n]=arguments[n]}return!t||t.length===0?this.negotiator.languages():this.negotiator.languages(t)[0]||!1};function extToMime(e){return e.indexOf(`/`)===-1?r.lookup(e):e}function validMime(e){return typeof e==`string`}})),sd,Server,cd=__esmMin(()=>{pu(),P(),L(),yn(),sd=new Set,Server=class extends Y{listening=!1;maxConnections;allowHalfOpen;_service=null;_connections=new Set;_address=null;constructor(e,t){super(),typeof e==`function`?(t=e,this.allowHalfOpen=!1):this.allowHalfOpen=e?.allowHalfOpen??!1,t&&this.on(`connection`,t)}listen(...e){let t=0,n=`0.0.0.0`,r=511,i;if(typeof e[0]==`object`&&e[0]!==null&&!Array.isArray(e[0])){let a=e[0];t=a.port??0,n=a.host??`0.0.0.0`,r=a.backlog??511,i=e[1]}else{typeof e[0]==`number`&&(t=e[0]);for(let t=1;t<e.length;t++)typeof e[t]==`string`?n=e[t]:typeof e[t]==`number`?r=e[t]:typeof e[t]==`function`&&(i=e[t])}i&&this.once(`listening`,i);try{this._service=new N.SocketService,this._service.set_backlog(r);let e;t===0?e=this._service.add_any_inet_port(null):(this._service.add_inet_port(t,null),e=t),this._service.connect(`incoming`,(e,t)=>(this._handleConnection(t),!0)),this._service.start(),ensureMainLoop(),this.listening=!0,sd.add(this);let i=n.includes(`:`)?`IPv6`:`IPv4`;this._address={port:e,family:i,address:n},deferEmit(this,`listening`)}catch(e){let r=createNodeError$1(e,`listen`,{address:n,port:t});deferEmit(this,`error`,r)}return this}_handleConnection(e){if(this.maxConnections&&this._connections.size>=this.maxConnections){try{e.close(null)}catch{}return}let t=new Socket({allowHalfOpen:this.allowHalfOpen});t._setConnection(e),t._setupConnection({}),this._connections.add(t),t.on(`close`,()=>{this._connections.delete(t)}),this.emit(`connection`,t)}address(){return this._address}close(e){if(e&&this.once(`close`,e),!this._service||!this.listening)return setTimeout(()=>{let e=Error(`Server is not running`);e.code=`ERR_SERVER_NOT_RUNNING`,this.emit(`error`,e)},0),this;this._service.stop(),this._service.close(),this._service=null,this.listening=!1,sd.delete(this);for(let e of this._connections)e.destroy();return this._connections.clear(),deferEmit(this,`close`),this}getConnections(e){e(null,this._connections.size)}ref(){return this}unref(){return this}}}),ld=__exportAll$4({Server:()=>Server,Socket:()=>Socket,connect:()=>ud,createConnection:()=>createConnection,createServer:()=>createServer,default:()=>dd,isIP:()=>isIP,isIPv4:()=>isIPv4,isIPv6:()=>isIPv6});function isIP(e){if(typeof e!=`string`)return 0;let t=e.includes(`%`)?e.split(`%`)[0]:e,n=N.InetAddress.new_from_string(t);if(!n)return 0;switch(n.get_family()){case N.SocketFamily.INVALID:return 0;case N.SocketFamily.IPV4:return 4;case N.SocketFamily.IPV6:return 6}}function isIPv4(e){return isIP(e)===4}function isIPv6(e){return isIP(e)===6}function createConnection(e,t,n){return new Socket().connect(e,t,n)}function createServer(e,t){return typeof e==`function`?new Server(e):new Server(e,t)}var ud,dd,fd=__esmMin(()=>{pu(),cd(),P(),ud=createConnection,dd={Socket,Server,isIP,isIPv4,isIPv6,createConnection,connect:ud,createServer}}),pd=__commonJSMin(((e,t)=>{
269
+ var n=ud(),r=ds();t.exports=Accepts;function Accepts(e){if(!(this instanceof Accepts))return new Accepts(e);this.headers=e.headers,this.negotiator=new n(e)}Accepts.prototype.type=Accepts.prototype.types=function(e){var t=e;if(t&&!Array.isArray(t)){t=Array(arguments.length);for(var n=0;n<t.length;n++)t[n]=arguments[n]}if(!t||t.length===0)return this.negotiator.mediaTypes();if(!this.headers.accept)return t[0];var r=t.map(extToMime),i=this.negotiator.mediaTypes(r.filter(validMime))[0];return i?t[r.indexOf(i)]:!1},Accepts.prototype.encoding=Accepts.prototype.encodings=function(e){var t=e;if(t&&!Array.isArray(t)){t=Array(arguments.length);for(var n=0;n<t.length;n++)t[n]=arguments[n]}return!t||t.length===0?this.negotiator.encodings():this.negotiator.encodings(t)[0]||!1},Accepts.prototype.charset=Accepts.prototype.charsets=function(e){var t=e;if(t&&!Array.isArray(t)){t=Array(arguments.length);for(var n=0;n<t.length;n++)t[n]=arguments[n]}return!t||t.length===0?this.negotiator.charsets():this.negotiator.charsets(t)[0]||!1},Accepts.prototype.lang=Accepts.prototype.langs=Accepts.prototype.language=Accepts.prototype.languages=function(e){var t=e;if(t&&!Array.isArray(t)){t=Array(arguments.length);for(var n=0;n<t.length;n++)t[n]=arguments[n]}return!t||t.length===0?this.negotiator.languages():this.negotiator.languages(t)[0]||!1};function extToMime(e){return e.indexOf(`/`)===-1?r.lookup(e):e}function validMime(e){return typeof e==`string`}})),fd,Server,pd=__esmMin(()=>{pu(),P(),L(),yn(),fd=new Set,Server=class extends Y{listening=!1;maxConnections;allowHalfOpen;_service=null;_connections=new Set;_address=null;constructor(e,t){super(),typeof e==`function`?(t=e,this.allowHalfOpen=!1):this.allowHalfOpen=e?.allowHalfOpen??!1,t&&this.on(`connection`,t)}listen(...e){let t=0,n=`0.0.0.0`,r=511,i;if(typeof e[0]==`object`&&e[0]!==null&&!Array.isArray(e[0])){let a=e[0];t=a.port??0,n=a.host??`0.0.0.0`,r=a.backlog??511,i=e[1]}else{typeof e[0]==`number`&&(t=e[0]);for(let t=1;t<e.length;t++)typeof e[t]==`string`?n=e[t]:typeof e[t]==`number`?r=e[t]:typeof e[t]==`function`&&(i=e[t])}i&&this.once(`listening`,i);try{this._service=new N.SocketService,this._service.set_backlog(r);let e;t===0?e=this._service.add_any_inet_port(null):(this._service.add_inet_port(t,null),e=t),this._service.connect(`incoming`,(e,t)=>(this._handleConnection(t),!0)),this._service.start(),ensureMainLoop(),this.listening=!0,fd.add(this);let i=n.includes(`:`)?`IPv6`:`IPv4`;this._address={port:e,family:i,address:n},deferEmit(this,`listening`)}catch(e){let r=createNodeError$1(e,`listen`,{address:n,port:t});deferEmit(this,`error`,r)}return this}_handleConnection(e){if(this.maxConnections&&this._connections.size>=this.maxConnections){try{e.close(null)}catch{}return}let t=new Socket({allowHalfOpen:this.allowHalfOpen});t._setConnection(e),t._setupConnection({}),this._connections.add(t),t.on(`close`,()=>{this._connections.delete(t)}),this.emit(`connection`,t)}address(){return this._address}close(e){if(e&&this.once(`close`,e),!this._service||!this.listening)return setTimeout(()=>{let e=Error(`Server is not running`);e.code=`ERR_SERVER_NOT_RUNNING`,this.emit(`error`,e)},0),this;this._service.stop(),this._service.close(),this._service=null,this.listening=!1,fd.delete(this);for(let e of this._connections)e.destroy();return this._connections.clear(),deferEmit(this,`close`),this}getConnections(e){e(null,this._connections.size)}ref(){return this}unref(){return this}}}),md=__exportAll$4({Server:()=>Server,Socket:()=>Socket,connect:()=>hd,createConnection:()=>createConnection,createServer:()=>createServer,default:()=>gd,isIP:()=>isIP,isIPv4:()=>isIPv4,isIPv6:()=>isIPv6});function isIP(e){if(typeof e!=`string`)return 0;let t=e.includes(`%`)?e.split(`%`)[0]:e,n=N.InetAddress.new_from_string(t);if(!n)return 0;switch(n.get_family()){case N.SocketFamily.INVALID:return 0;case N.SocketFamily.IPV4:return 4;case N.SocketFamily.IPV6:return 6}}function isIPv4(e){return isIP(e)===4}function isIPv6(e){return isIP(e)===6}function createConnection(e,t,n){return new Socket().connect(e,t,n)}function createServer(e,t){return typeof e==`function`?new Server(e):new Server(e,t)}var hd,gd,_d=__esmMin(()=>{pu(),pd(),P(),hd=createConnection,gd={Socket,Server,isIP,isIPv4,isIPv6,createConnection,connect:hd,createServer}}),vd=__commonJSMin(((e,t)=>{
270
270
  /*!
271
271
  * fresh
272
272
  * Copyright(c) 2012 TJ Holowaychuk
273
273
  * Copyright(c) 2016-2017 Douglas Christopher Wilson
274
274
  * MIT Licensed
275
275
  */
276
- var n=/(?:^|,)\s*?no-cache\s*?(?:,|$)/;t.exports=fresh;function fresh(e,t){var r=e[`if-modified-since`],i=e[`if-none-match`];if(!r&&!i)return!1;var a=e[`cache-control`];if(a&&n.test(a))return!1;if(i){if(i===`*`)return!0;var o=t.etag;if(!o)return!1;for(var s=parseTokenList(i),c=0;c<s.length;c++){var l=s[c];if(l===o||l===`W/`+o||`W/`+l===o)return!0}return!1}if(r){var u=t[`last-modified`];if(!u||!(parseHttpDate(u)<=parseHttpDate(r)))return!1}return!0}function parseHttpDate(e){var t=e&&Date.parse(e);return typeof t==`number`?t:NaN}function parseTokenList(e){for(var t=0,n=[],r=0,i=0,a=e.length;i<a;i++)switch(e.charCodeAt(i)){case 32:r===t&&(r=t=i+1);break;case 44:n.push(e.substring(r,t)),r=t=i+1;break;default:t=i+1;break}return n.push(e.substring(r,t)),n}})),md=__commonJSMin(((e,t)=>{
276
+ var n=/(?:^|,)\s*?no-cache\s*?(?:,|$)/;t.exports=fresh;function fresh(e,t){var r=e[`if-modified-since`],i=e[`if-none-match`];if(!r&&!i)return!1;var a=e[`cache-control`];if(a&&n.test(a))return!1;if(i){if(i===`*`)return!0;var o=t.etag;if(!o)return!1;for(var s=parseTokenList(i),c=0;c<s.length;c++){var l=s[c];if(l===o||l===`W/`+o||`W/`+l===o)return!0}return!1}if(r){var u=t[`last-modified`];if(!u||!(parseHttpDate(u)<=parseHttpDate(r)))return!1}return!0}function parseHttpDate(e){var t=e&&Date.parse(e);return typeof t==`number`?t:NaN}function parseTokenList(e){for(var t=0,n=[],r=0,i=0,a=e.length;i<a;i++)switch(e.charCodeAt(i)){case 32:r===t&&(r=t=i+1);break;case 44:n.push(e.substring(r,t)),r=t=i+1;break;default:t=i+1;break}return n.push(e.substring(r,t)),n}})),yd=__commonJSMin(((e,t)=>{
277
277
  /*!
278
278
  * range-parser
279
279
  * Copyright(c) 2012-2014 TJ Holowaychuk
280
280
  * Copyright(c) 2015-2016 Douglas Christopher Wilson
281
281
  * MIT Licensed
282
282
  */
283
- t.exports=rangeParser;function rangeParser(e,t,n){if(typeof t!=`string`)throw TypeError(`argument str must be a string`);var r=t.indexOf(`=`);if(r===-1)return-2;var i=t.slice(r+1).split(`,`),a=[];a.type=t.slice(0,r);for(var o=0;o<i.length;o++){var s=i[o].split(`-`),c=parseInt(s[0],10),l=parseInt(s[1],10);isNaN(c)?(c=e-l,l=e-1):isNaN(l)&&(l=e-1),l>e-1&&(l=e-1),!(isNaN(c)||isNaN(l)||c>l||c<0)&&a.push({start:c,end:l})}return a.length<1?-1:n&&n.combine?combineRanges(a):a}function combineRanges(e){for(var t=e.map(mapWithIndex).sort(sortByRangeStart),n=0,r=1;r<t.length;r++){var i=t[r],a=t[n];i.start>a.end+1?t[++n]=i:i.end>a.end&&(a.end=i.end,a.index=Math.min(a.index,i.index))}t.length=n+1;var o=t.sort(sortByRangeIndex).map(mapWithoutIndex);return o.type=e.type,o}function mapWithIndex(e,t){return{start:e.start,end:e.end,index:t}}function mapWithoutIndex(e){return{start:e.start,end:e.end}}function sortByRangeIndex(e,t){return e.index-t.index}function sortByRangeStart(e,t){return e.start-t.start}})),hd=__commonJSMin(((e,t)=>{
283
+ t.exports=rangeParser;function rangeParser(e,t,n){if(typeof t!=`string`)throw TypeError(`argument str must be a string`);var r=t.indexOf(`=`);if(r===-1)return-2;var i=t.slice(r+1).split(`,`),a=[];a.type=t.slice(0,r);for(var o=0;o<i.length;o++){var s=i[o].split(`-`),c=parseInt(s[0],10),l=parseInt(s[1],10);isNaN(c)?(c=e-l,l=e-1):isNaN(l)&&(l=e-1),l>e-1&&(l=e-1),!(isNaN(c)||isNaN(l)||c>l||c<0)&&a.push({start:c,end:l})}return a.length<1?-1:n&&n.combine?combineRanges(a):a}function combineRanges(e){for(var t=e.map(mapWithIndex).sort(sortByRangeStart),n=0,r=1;r<t.length;r++){var i=t[r],a=t[n];i.start>a.end+1?t[++n]=i:i.end>a.end&&(a.end=i.end,a.index=Math.min(a.index,i.index))}t.length=n+1;var o=t.sort(sortByRangeIndex).map(mapWithoutIndex);return o.type=e.type,o}function mapWithIndex(e,t){return{start:e.start,end:e.end,index:t}}function mapWithoutIndex(e){return{start:e.start,end:e.end}}function sortByRangeIndex(e,t){return e.index-t.index}function sortByRangeStart(e,t){return e.start-t.start}})),bd=__commonJSMin(((e,t)=>{
284
284
  /*!
285
285
  * express
286
286
  * Copyright(c) 2009-2013 TJ Holowaychuk
@@ -288,27 +288,27 @@ t.exports=rangeParser;function rangeParser(e,t,n){if(typeof t!=`string`)throw Ty
288
288
  * Copyright(c) 2014-2015 Douglas Christopher Wilson
289
289
  * MIT Licensed
290
290
  */
291
- var n=od(),r=(fd(),__toCommonJS(ld)).isIP,i=ps(),a=(Ou(),__toCommonJS(wu)),o=pd(),s=md(),c=_l(),l=Mu(),u=Object.create(a.IncomingMessage.prototype);t.exports=u,u.get=u.header=function header(e){if(!e)throw TypeError(`name argument is required to req.get`);if(typeof e!=`string`)throw TypeError(`name must be a string to req.get`);var t=e.toLowerCase();switch(t){case`referer`:case`referrer`:return this.headers.referrer||this.headers.referer;default:return this.headers[t]}},u.accepts=function(){var e=n(this);return e.types.apply(e,arguments)},u.acceptsEncodings=function(){var e=n(this);return e.encodings.apply(e,arguments)},u.acceptsCharsets=function(){var e=n(this);return e.charsets.apply(e,arguments)},u.acceptsLanguages=function(...e){return n(this).languages(...e)},u.range=function range(e,t){var n=this.get(`Range`);if(n)return s(e,n,t)},defineGetter(u,`query`,function query(){var e=this.app.get(`query parser fn`);if(!e)return Object.create(null);var t=c(this).query;return e(t)}),u.is=function is(e){var t=e;if(!Array.isArray(e)){t=Array(arguments.length);for(var n=0;n<t.length;n++)t[n]=arguments[n]}return i(this,t)},defineGetter(u,`protocol`,function protocol(){var e=this.socket.encrypted?`https`:`http`;if(!this.app.get(`trust proxy fn`)(this.socket.remoteAddress,0))return e;var t=this.get(`X-Forwarded-Proto`)||e,n=t.indexOf(`,`);return n===-1?t.trim():t.substring(0,n).trim()}),defineGetter(u,`secure`,function secure(){return this.protocol===`https`}),defineGetter(u,`ip`,function ip(){var e=this.app.get(`trust proxy fn`);return l(this,e)}),defineGetter(u,`ips`,function ips(){var e=this.app.get(`trust proxy fn`),t=l.all(this,e);return t.reverse().pop(),t}),defineGetter(u,`subdomains`,function subdomains(){var e=this.hostname;if(!e)return[];var t=this.app.get(`subdomain offset`);return(r(e)?[e]:e.split(`.`).reverse()).slice(t)}),defineGetter(u,`path`,function path(){return c(this).pathname}),defineGetter(u,`host`,function host(){var e=this.app.get(`trust proxy fn`),t=this.get(`X-Forwarded-Host`);return!t||!e(this.socket.remoteAddress,0)?t=this.get(`Host`):t.indexOf(`,`)!==-1&&(t=t.substring(0,t.indexOf(`,`)).trimRight()),t||void 0}),defineGetter(u,`hostname`,function hostname(){var e=this.host;if(e){var t=e[0]===`[`?e.indexOf(`]`)+1:0,n=e.indexOf(`:`,t);return n===-1?e:e.substring(0,n)}}),defineGetter(u,`fresh`,function(){var e=this.method,t=this.res,n=t.statusCode;return e!==`GET`&&e!==`HEAD`?!1:n>=200&&n<300||n===304?o(this.headers,{etag:t.get(`ETag`),"last-modified":t.get(`Last-Modified`)}):!1}),defineGetter(u,`stale`,function stale(){return!this.fresh}),defineGetter(u,`xhr`,function xhr(){return(this.get(`X-Requested-With`)||``).toLowerCase()===`xmlhttprequest`});function defineGetter(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!0,get:n})}})),gd=__commonJSMin(((e,t)=>{
291
+ var n=dd(),r=(_d(),__toCommonJS(md)).isIP,i=ps(),a=(Ou(),__toCommonJS(wu)),o=vd(),s=yd(),c=_l(),l=Mu(),u=Object.create(a.IncomingMessage.prototype);t.exports=u,u.get=u.header=function header(e){if(!e)throw TypeError(`name argument is required to req.get`);if(typeof e!=`string`)throw TypeError(`name must be a string to req.get`);var t=e.toLowerCase();switch(t){case`referer`:case`referrer`:return this.headers.referrer||this.headers.referer;default:return this.headers[t]}},u.accepts=function(){var e=n(this);return e.types.apply(e,arguments)},u.acceptsEncodings=function(){var e=n(this);return e.encodings.apply(e,arguments)},u.acceptsCharsets=function(){var e=n(this);return e.charsets.apply(e,arguments)},u.acceptsLanguages=function(...e){return n(this).languages(...e)},u.range=function range(e,t){var n=this.get(`Range`);if(n)return s(e,n,t)},defineGetter(u,`query`,function query(){var e=this.app.get(`query parser fn`);if(!e)return Object.create(null);var t=c(this).query;return e(t)}),u.is=function is(e){var t=e;if(!Array.isArray(e)){t=Array(arguments.length);for(var n=0;n<t.length;n++)t[n]=arguments[n]}return i(this,t)},defineGetter(u,`protocol`,function protocol(){var e=this.socket.encrypted?`https`:`http`;if(!this.app.get(`trust proxy fn`)(this.socket.remoteAddress,0))return e;var t=this.get(`X-Forwarded-Proto`)||e,n=t.indexOf(`,`);return n===-1?t.trim():t.substring(0,n).trim()}),defineGetter(u,`secure`,function secure(){return this.protocol===`https`}),defineGetter(u,`ip`,function ip(){var e=this.app.get(`trust proxy fn`);return l(this,e)}),defineGetter(u,`ips`,function ips(){var e=this.app.get(`trust proxy fn`),t=l.all(this,e);return t.reverse().pop(),t}),defineGetter(u,`subdomains`,function subdomains(){var e=this.hostname;if(!e)return[];var t=this.app.get(`subdomain offset`);return(r(e)?[e]:e.split(`.`).reverse()).slice(t)}),defineGetter(u,`path`,function path(){return c(this).pathname}),defineGetter(u,`host`,function host(){var e=this.app.get(`trust proxy fn`),t=this.get(`X-Forwarded-Host`);return!t||!e(this.socket.remoteAddress,0)?t=this.get(`Host`):t.indexOf(`,`)!==-1&&(t=t.substring(0,t.indexOf(`,`)).trimRight()),t||void 0}),defineGetter(u,`hostname`,function hostname(){var e=this.host;if(e){var t=e[0]===`[`?e.indexOf(`]`)+1:0,n=e.indexOf(`:`,t);return n===-1?e:e.substring(0,n)}}),defineGetter(u,`fresh`,function(){var e=this.method,t=this.res,n=t.statusCode;return e!==`GET`&&e!==`HEAD`?!1:n>=200&&n<300||n===304?o(this.headers,{etag:t.get(`ETag`),"last-modified":t.get(`Last-Modified`)}):!1}),defineGetter(u,`stale`,function stale(){return!this.fresh}),defineGetter(u,`xhr`,function xhr(){return(this.get(`X-Requested-With`)||``).toLowerCase()===`xmlhttprequest`});function defineGetter(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!0,get:n})}})),xd=__commonJSMin(((e,t)=>{
292
292
  /*!
293
293
  * content-disposition
294
294
  * Copyright(c) 2014-2017 Douglas Christopher Wilson
295
295
  * MIT Licensed
296
296
  */
297
- t.exports=contentDisposition,t.exports.parse=parse;let n=new TextDecoder(`utf-8`);var r=/[\x00-\x20"'()*,/:;<=>?@[\\\]{}\x7f]/g,i=/[^\x20-\x7e\xa0-\xff]/g,a=/\\([\u0000-\u007f])/g,o=/([\\"])/g,s=/;[\x09\x20]*([!#$%&'*+.0-9A-Z^_`a-z|~-]+)[\x09\x20]*=[\x09\x20]*("(?:[\x20!\x23-\x5b\x5d-\x7e\x80-\xff]|\\[\x20-\x7e])*"|[!#$%&'*+.0-9A-Z^_`a-z|~-]+)[\x09\x20]*/g,c=/^[\x20-\x7e\x80-\xff]+$/,l=/^[!#$%&'*+.0-9A-Z^_`a-z|~-]+$/,u=/^([A-Za-z0-9!#$%&+\-^_`{}~]+)'(?:[A-Za-z]{2,3}(?:-[A-Za-z]{3}){0,3}|[A-Za-z]{4,8}|)'((?:%[0-9A-Fa-f]{2}|[A-Za-z0-9!#$&+.^_`|~-])+)$/,d=/^([!#$%&'*+.0-9A-Z^_`a-z|~-]+)[\x09\x20]*(?:$|;)/;function contentDisposition(e,t){var n=t||{};return format(new ContentDisposition(n.type||`attachment`,createparams(e,n.fallback)))}function createparams(e,t){if(e!==void 0){var n={};if(typeof e!=`string`)throw TypeError(`filename must be a string`);if(t===void 0&&(t=!0),typeof t!=`string`&&typeof t!=`boolean`)throw TypeError(`fallback must be a string or boolean`);if(typeof t==`string`&&i.test(t))throw TypeError(`fallback must be ISO-8859-1 string`);var r=basename(e),a=c.test(r),o=typeof t==`string`?basename(t):t&&getlatin1(r),s=typeof o==`string`&&o!==r;return(s||!a||hasHexEscape(r))&&(n[`filename*`]=r),(a||s)&&(n.filename=s?o:r),n}}function format(e){var t=e.parameters,n=e.type;if(!n||typeof n!=`string`||!l.test(n))throw TypeError(`invalid type`);var r=String(n).toLowerCase();if(t&&typeof t==`object`)for(var i,a=Object.keys(t).sort(),o=0;o<a.length;o++){i=a[o];var s=i.slice(-1)===`*`?ustring(t[i]):qstring(t[i]);r+=`; `+i+`=`+s}return r}function decodefield(e){let t=u.exec(e);if(!t)throw TypeError(`invalid extended field value`);let r=t[1].toLowerCase(),i=t[2];switch(r){case`iso-8859-1`:return getlatin1(decodeHexEscapes(i));case`utf-8`:case`utf8`:try{return decodeURIComponent(i)}catch{let e=decodeHexEscapes(i),t=new Uint8Array(e.length);for(let n=0;n<e.length;n++)t[n]=e.charCodeAt(n);return n.decode(t)}}throw TypeError(`unsupported charset in extended field`)}function getlatin1(e){return String(e).replace(i,`?`)}function parse(e){if(!e||typeof e!=`string`)throw TypeError(`argument string is required`);var t=d.exec(e);if(!t)throw TypeError(`invalid type format`);var n=t[0].length,r=t[1].toLowerCase(),i,o=[],c={},l;for(n=s.lastIndex=t[0].slice(-1)===`;`?n-1:n;t=s.exec(e);){if(t.index!==n)throw TypeError(`invalid parameter format`);if(n+=t[0].length,i=t[1].toLowerCase(),l=t[2],o.indexOf(i)!==-1)throw TypeError(`invalid duplicate parameter`);if(o.push(i),i.indexOf(`*`)+1===i.length){i=i.slice(0,-1),l=decodefield(l),c[i]=l;continue}typeof c[i]!=`string`&&(l[0]===`"`&&(l=l.slice(1,-1).replace(a,`$1`)),c[i]=l)}if(n!==-1&&n!==e.length)throw TypeError(`invalid parameter format`);return new ContentDisposition(r,c)}function pencode(e){return`%`+String(e).charCodeAt(0).toString(16).toUpperCase()}function qstring(e){return`"`+String(e).replace(o,`\\$1`)+`"`}function ustring(e){return`UTF-8''`+encodeURIComponent(String(e)).replace(r,pencode)}function ContentDisposition(e,t){this.type=e,this.parameters=t}function basename(e){let t=e.replaceAll(`\\`,`/`),n=t.length;for(;n>0&&t[n-1]===`/`;)n--;if(n===0)return``;let r=n-1;for(;r>=0&&t[r]!==`/`;)r--;return t.slice(r+1,n)}function isHexDigit(e){let t=e.charCodeAt(0);return t>=48&&t<=57||t>=65&&t<=70||t>=97&&t<=102}function hasHexEscape(e){let t=e.length-3,n=-1;for(;(n=e.indexOf(`%`,n+1))!==-1&&n<=t;)if(isHexDigit(e[n+1])&&isHexDigit(e[n+2]))return!0;return!1}function decodeHexEscapes(e){let t=e.indexOf(`%`);if(t===-1)return e;let n=e.slice(0,t);for(let r=t;r<e.length;r++)e[r]===`%`&&r+2<e.length&&isHexDigit(e[r+1])&&isHexDigit(e[r+2])?(n+=String.fromCharCode(Number.parseInt(e[r+1]+e[r+2],16)),r+=2):n+=e[r];return n}})),_d=__commonJSMin((e=>{var t=(ma(),__toCommonJS(fa));e.sign=function(e,n){if(typeof e!=`string`)throw TypeError(`Cookie value must be provided as a string.`);if(n==null)throw TypeError(`Secret key must be provided.`);return e+`.`+t.createHmac(`sha256`,n).update(e).digest(`base64`).replace(/\=+$/,``)},e.unsign=function(n,r){if(typeof n!=`string`)throw TypeError(`Signed cookie string must be provided.`);if(r==null)throw TypeError(`Secret key must be provided.`);var i=n.slice(0,n.lastIndexOf(`.`)),a=e.sign(i,r),o=Buffer.from(a),s=Buffer.from(n);return o.length===s.length&&t.timingSafeEqual(o,s)?i:!1}})),vd=__commonJSMin((e=>{
297
+ t.exports=contentDisposition,t.exports.parse=parse;let n=new TextDecoder(`utf-8`);var r=/[\x00-\x20"'()*,/:;<=>?@[\\\]{}\x7f]/g,i=/[^\x20-\x7e\xa0-\xff]/g,a=/\\([\u0000-\u007f])/g,o=/([\\"])/g,s=/;[\x09\x20]*([!#$%&'*+.0-9A-Z^_`a-z|~-]+)[\x09\x20]*=[\x09\x20]*("(?:[\x20!\x23-\x5b\x5d-\x7e\x80-\xff]|\\[\x20-\x7e])*"|[!#$%&'*+.0-9A-Z^_`a-z|~-]+)[\x09\x20]*/g,c=/^[\x20-\x7e\x80-\xff]+$/,l=/^[!#$%&'*+.0-9A-Z^_`a-z|~-]+$/,u=/^([A-Za-z0-9!#$%&+\-^_`{}~]+)'(?:[A-Za-z]{2,3}(?:-[A-Za-z]{3}){0,3}|[A-Za-z]{4,8}|)'((?:%[0-9A-Fa-f]{2}|[A-Za-z0-9!#$&+.^_`|~-])+)$/,d=/^([!#$%&'*+.0-9A-Z^_`a-z|~-]+)[\x09\x20]*(?:$|;)/;function contentDisposition(e,t){var n=t||{};return format(new ContentDisposition(n.type||`attachment`,createparams(e,n.fallback)))}function createparams(e,t){if(e!==void 0){var n={};if(typeof e!=`string`)throw TypeError(`filename must be a string`);if(t===void 0&&(t=!0),typeof t!=`string`&&typeof t!=`boolean`)throw TypeError(`fallback must be a string or boolean`);if(typeof t==`string`&&i.test(t))throw TypeError(`fallback must be ISO-8859-1 string`);var r=basename(e),a=c.test(r),o=typeof t==`string`?basename(t):t&&getlatin1(r),s=typeof o==`string`&&o!==r;return(s||!a||hasHexEscape(r))&&(n[`filename*`]=r),(a||s)&&(n.filename=s?o:r),n}}function format(e){var t=e.parameters,n=e.type;if(!n||typeof n!=`string`||!l.test(n))throw TypeError(`invalid type`);var r=String(n).toLowerCase();if(t&&typeof t==`object`)for(var i,a=Object.keys(t).sort(),o=0;o<a.length;o++){i=a[o];var s=i.slice(-1)===`*`?ustring(t[i]):qstring(t[i]);r+=`; `+i+`=`+s}return r}function decodefield(e){let t=u.exec(e);if(!t)throw TypeError(`invalid extended field value`);let r=t[1].toLowerCase(),i=t[2];switch(r){case`iso-8859-1`:return getlatin1(decodeHexEscapes(i));case`utf-8`:case`utf8`:try{return decodeURIComponent(i)}catch{let e=decodeHexEscapes(i),t=new Uint8Array(e.length);for(let n=0;n<e.length;n++)t[n]=e.charCodeAt(n);return n.decode(t)}}throw TypeError(`unsupported charset in extended field`)}function getlatin1(e){return String(e).replace(i,`?`)}function parse(e){if(!e||typeof e!=`string`)throw TypeError(`argument string is required`);var t=d.exec(e);if(!t)throw TypeError(`invalid type format`);var n=t[0].length,r=t[1].toLowerCase(),i,o=[],c={},l;for(n=s.lastIndex=t[0].slice(-1)===`;`?n-1:n;t=s.exec(e);){if(t.index!==n)throw TypeError(`invalid parameter format`);if(n+=t[0].length,i=t[1].toLowerCase(),l=t[2],o.indexOf(i)!==-1)throw TypeError(`invalid duplicate parameter`);if(o.push(i),i.indexOf(`*`)+1===i.length){i=i.slice(0,-1),l=decodefield(l),c[i]=l;continue}typeof c[i]!=`string`&&(l[0]===`"`&&(l=l.slice(1,-1).replace(a,`$1`)),c[i]=l)}if(n!==-1&&n!==e.length)throw TypeError(`invalid parameter format`);return new ContentDisposition(r,c)}function pencode(e){return`%`+String(e).charCodeAt(0).toString(16).toUpperCase()}function qstring(e){return`"`+String(e).replace(o,`\\$1`)+`"`}function ustring(e){return`UTF-8''`+encodeURIComponent(String(e)).replace(r,pencode)}function ContentDisposition(e,t){this.type=e,this.parameters=t}function basename(e){let t=e.replaceAll(`\\`,`/`),n=t.length;for(;n>0&&t[n-1]===`/`;)n--;if(n===0)return``;let r=n-1;for(;r>=0&&t[r]!==`/`;)r--;return t.slice(r+1,n)}function isHexDigit(e){let t=e.charCodeAt(0);return t>=48&&t<=57||t>=65&&t<=70||t>=97&&t<=102}function hasHexEscape(e){let t=e.length-3,n=-1;for(;(n=e.indexOf(`%`,n+1))!==-1&&n<=t;)if(isHexDigit(e[n+1])&&isHexDigit(e[n+2]))return!0;return!1}function decodeHexEscapes(e){let t=e.indexOf(`%`);if(t===-1)return e;let n=e.slice(0,t);for(let r=t;r<e.length;r++)e[r]===`%`&&r+2<e.length&&isHexDigit(e[r+1])&&isHexDigit(e[r+2])?(n+=String.fromCharCode(Number.parseInt(e[r+1]+e[r+2],16)),r+=2):n+=e[r];return n}})),Sd=__commonJSMin((e=>{var t=(ma(),__toCommonJS(fa));e.sign=function(e,n){if(typeof e!=`string`)throw TypeError(`Cookie value must be provided as a string.`);if(n==null)throw TypeError(`Secret key must be provided.`);return e+`.`+t.createHmac(`sha256`,n).update(e).digest(`base64`).replace(/\=+$/,``)},e.unsign=function(n,r){if(typeof n!=`string`)throw TypeError(`Signed cookie string must be provided.`);if(r==null)throw TypeError(`Secret key must be provided.`);var i=n.slice(0,n.lastIndexOf(`.`)),a=e.sign(i,r),o=Buffer.from(a),s=Buffer.from(n);return o.length===s.length&&t.timingSafeEqual(o,s)?i:!1}})),Cd=__commonJSMin((e=>{
298
298
  /*!
299
299
  * cookie
300
300
  * Copyright(c) 2012-2014 Roman Shtylman
301
301
  * Copyright(c) 2015 Douglas Christopher Wilson
302
302
  * MIT Licensed
303
303
  */
304
- e.parse=parse,e.serialize=serialize;var t=Object.prototype.toString,n=Object.prototype.hasOwnProperty,r=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/,i=/^("?)[\u0021\u0023-\u002B\u002D-\u003A\u003C-\u005B\u005D-\u007E]*\1$/,a=/^([.]?[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)([.][a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*$/i,o=/^[\u0020-\u003A\u003D-\u007E]*$/;function parse(e,t){if(typeof e!=`string`)throw TypeError(`argument str must be a string`);var r={},i=e.length;if(i<2)return r;var a=t&&t.decode||decode,o=0,s=0,c=0;do{if(s=e.indexOf(`=`,o),s===-1)break;if(c=e.indexOf(`;`,o),c===-1)c=i;else if(s>c){o=e.lastIndexOf(`;`,s-1)+1;continue}var l=startIndex(e,o,s),u=endIndex(e,s,l),d=e.slice(l,u);if(!n.call(r,d)){var p=startIndex(e,s+1,c),m=endIndex(e,c,p);e.charCodeAt(p)===34&&e.charCodeAt(m-1)===34&&(p++,m--),r[d]=tryDecode(e.slice(p,m),a)}o=c+1}while(o<i);return r}function startIndex(e,t,n){do{var r=e.charCodeAt(t);if(r!==32&&r!==9)return t}while(++t<n);return n}function endIndex(e,t,n){for(;t>n;){var r=e.charCodeAt(--t);if(r!==32&&r!==9)return t+1}return n}function serialize(e,t,n){var s=n&&n.encode||encodeURIComponent;if(typeof s!=`function`)throw TypeError(`option encode is invalid`);if(!r.test(e))throw TypeError(`argument name is invalid`);var c=s(t);if(!i.test(c))throw TypeError(`argument val is invalid`);var l=e+`=`+c;if(!n)return l;if(n.maxAge!=null){var u=Math.floor(n.maxAge);if(!isFinite(u))throw TypeError(`option maxAge is invalid`);l+=`; Max-Age=`+u}if(n.domain){if(!a.test(n.domain))throw TypeError(`option domain is invalid`);l+=`; Domain=`+n.domain}if(n.path){if(!o.test(n.path))throw TypeError(`option path is invalid`);l+=`; Path=`+n.path}if(n.expires){var d=n.expires;if(!isDate(d)||isNaN(d.valueOf()))throw TypeError(`option expires is invalid`);l+=`; Expires=`+d.toUTCString()}if(n.httpOnly&&(l+=`; HttpOnly`),n.secure&&(l+=`; Secure`),n.partitioned&&(l+=`; Partitioned`),n.priority)switch(typeof n.priority==`string`?n.priority.toLowerCase():n.priority){case`low`:l+=`; Priority=Low`;break;case`medium`:l+=`; Priority=Medium`;break;case`high`:l+=`; Priority=High`;break;default:throw TypeError(`option priority is invalid`)}if(n.sameSite)switch(typeof n.sameSite==`string`?n.sameSite.toLowerCase():n.sameSite){case!0:l+=`; SameSite=Strict`;break;case`lax`:l+=`; SameSite=Lax`;break;case`strict`:l+=`; SameSite=Strict`;break;case`none`:l+=`; SameSite=None`;break;default:throw TypeError(`option sameSite is invalid`)}return l}function decode(e){return e.indexOf(`%`)===-1?e:decodeURIComponent(e)}function isDate(e){return t.call(e)===`[object Date]`}function tryDecode(e,t){try{return t(e)}catch{return e}}})),yd=__commonJSMin(((e,t)=>{
304
+ e.parse=parse,e.serialize=serialize;var t=Object.prototype.toString,n=Object.prototype.hasOwnProperty,r=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/,i=/^("?)[\u0021\u0023-\u002B\u002D-\u003A\u003C-\u005B\u005D-\u007E]*\1$/,a=/^([.]?[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)([.][a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*$/i,o=/^[\u0020-\u003A\u003D-\u007E]*$/;function parse(e,t){if(typeof e!=`string`)throw TypeError(`argument str must be a string`);var r={},i=e.length;if(i<2)return r;var a=t&&t.decode||decode,o=0,s=0,c=0;do{if(s=e.indexOf(`=`,o),s===-1)break;if(c=e.indexOf(`;`,o),c===-1)c=i;else if(s>c){o=e.lastIndexOf(`;`,s-1)+1;continue}var l=startIndex(e,o,s),u=endIndex(e,s,l),d=e.slice(l,u);if(!n.call(r,d)){var p=startIndex(e,s+1,c),m=endIndex(e,c,p);e.charCodeAt(p)===34&&e.charCodeAt(m-1)===34&&(p++,m--),r[d]=tryDecode(e.slice(p,m),a)}o=c+1}while(o<i);return r}function startIndex(e,t,n){do{var r=e.charCodeAt(t);if(r!==32&&r!==9)return t}while(++t<n);return n}function endIndex(e,t,n){for(;t>n;){var r=e.charCodeAt(--t);if(r!==32&&r!==9)return t+1}return n}function serialize(e,t,n){var s=n&&n.encode||encodeURIComponent;if(typeof s!=`function`)throw TypeError(`option encode is invalid`);if(!r.test(e))throw TypeError(`argument name is invalid`);var c=s(t);if(!i.test(c))throw TypeError(`argument val is invalid`);var l=e+`=`+c;if(!n)return l;if(n.maxAge!=null){var u=Math.floor(n.maxAge);if(!isFinite(u))throw TypeError(`option maxAge is invalid`);l+=`; Max-Age=`+u}if(n.domain){if(!a.test(n.domain))throw TypeError(`option domain is invalid`);l+=`; Domain=`+n.domain}if(n.path){if(!o.test(n.path))throw TypeError(`option path is invalid`);l+=`; Path=`+n.path}if(n.expires){var d=n.expires;if(!isDate(d)||isNaN(d.valueOf()))throw TypeError(`option expires is invalid`);l+=`; Expires=`+d.toUTCString()}if(n.httpOnly&&(l+=`; HttpOnly`),n.secure&&(l+=`; Secure`),n.partitioned&&(l+=`; Partitioned`),n.priority)switch(typeof n.priority==`string`?n.priority.toLowerCase():n.priority){case`low`:l+=`; Priority=Low`;break;case`medium`:l+=`; Priority=Medium`;break;case`high`:l+=`; Priority=High`;break;default:throw TypeError(`option priority is invalid`)}if(n.sameSite)switch(typeof n.sameSite==`string`?n.sameSite.toLowerCase():n.sameSite){case!0:l+=`; SameSite=Strict`;break;case`lax`:l+=`; SameSite=Lax`;break;case`strict`:l+=`; SameSite=Strict`;break;case`none`:l+=`; SameSite=None`;break;default:throw TypeError(`option sameSite is invalid`)}return l}function decode(e){return e.indexOf(`%`)===-1?e:decodeURIComponent(e)}function isDate(e){return t.call(e)===`[object Date]`}function tryDecode(e,t){try{return t(e)}catch{return e}}})),wd=__commonJSMin(((e,t)=>{
305
305
  /*!
306
306
  * send
307
307
  * Copyright(c) 2012 TJ Holowaychuk
308
308
  * Copyright(c) 2014-2022 Douglas Christopher Wilson
309
309
  * MIT Licensed
310
310
  */
311
- var n=bo(),r=po()(`send`),i=hl(),a=gl(),o=ku(),s=pd(),c=(ou(),__toCommonJS(ru)),l=ds(),u=uo(),d=os(),p=md(),m=(lo(),__toCommonJS(Ja)),h=_o(),g=Jo(),_=(ic(),__toCommonJS(ec)),v=m.extname,y=m.join,b=m.normalize,x=m.resolve,S=m.sep,w=/^ *bytes=/,T=3600*24*365*1e3,E=/(?:^|[\\/])\.\.(?:[\\/]|$)/;t.exports=send;function send(e,t,n){return new SendStream(e,t,n)}function SendStream(e,t,n){g.call(this);var r=n||{};if(this.options=r,this.path=t,this.req=e,this._acceptRanges=r.acceptRanges===void 0?!0:!!r.acceptRanges,this._cacheControl=r.cacheControl===void 0?!0:!!r.cacheControl,this._etag=r.etag===void 0?!0:!!r.etag,this._dotfiles=r.dotfiles===void 0?`ignore`:r.dotfiles,this._dotfiles!==`ignore`&&this._dotfiles!==`allow`&&this._dotfiles!==`deny`)throw TypeError(`dotfiles option must be "allow", "deny", or "ignore"`);this._extensions=r.extensions===void 0?[]:normalizeList(r.extensions,`extensions option`),this._immutable=r.immutable===void 0?!1:!!r.immutable,this._index=r.index===void 0?[`index.html`]:normalizeList(r.index,`index option`),this._lastModified=r.lastModified===void 0?!0:!!r.lastModified,this._maxage=r.maxAge||r.maxage,this._maxage=typeof this._maxage==`string`?u(this._maxage):Number(this._maxage),this._maxage=isNaN(this._maxage)?0:Math.min(Math.max(0,this._maxage),T),this._root=r.root?x(r.root):null}_.inherits(SendStream,g),SendStream.prototype.error=function error(e,t){if(hasListeners(this,`error`))return this.emit(`error`,createHttpError(e,t));var n=this.res,r=createHtmlDocument(`Error`,a(h.message[e]||String(e)));clearHeaders(n),t&&t.headers&&setHeaders(n,t.headers),n.statusCode=e,n.setHeader(`Content-Type`,`text/html; charset=UTF-8`),n.setHeader(`Content-Length`,Buffer.byteLength(r)),n.setHeader(`Content-Security-Policy`,`default-src 'none'`),n.setHeader(`X-Content-Type-Options`,`nosniff`),n.end(r)},SendStream.prototype.hasTrailingSlash=function hasTrailingSlash(){return this.path[this.path.length-1]===`/`},SendStream.prototype.isConditionalGET=function isConditionalGET(){return this.req.headers[`if-match`]||this.req.headers[`if-unmodified-since`]||this.req.headers[`if-none-match`]||this.req.headers[`if-modified-since`]},SendStream.prototype.isPreconditionFailure=function isPreconditionFailure(){var e=this.req,t=this.res,n=e.headers[`if-match`];if(n){var r=t.getHeader(`ETag`);return!r||n!==`*`&&parseTokenList(n).every(function(e){return e!==r&&e!==`W/`+r&&`W/`+e!==r})}var i=parseHttpDate(e.headers[`if-unmodified-since`]);if(!isNaN(i)){var a=parseHttpDate(t.getHeader(`Last-Modified`));return isNaN(a)||a>i}return!1},SendStream.prototype.removeContentHeaderFields=function removeContentHeaderFields(){var e=this.res;e.removeHeader(`Content-Encoding`),e.removeHeader(`Content-Language`),e.removeHeader(`Content-Length`),e.removeHeader(`Content-Range`),e.removeHeader(`Content-Type`)},SendStream.prototype.notModified=function notModified(){var e=this.res;r(`not modified`),this.removeContentHeaderFields(),e.statusCode=304,e.end()},SendStream.prototype.headersAlreadySent=function headersAlreadySent(){var e=Error(`Can't set headers after they are sent.`);r(`headers already sent`),this.error(500,e)},SendStream.prototype.isCachable=function isCachable(){var e=this.res.statusCode;return e>=200&&e<300||e===304},SendStream.prototype.onStatError=function onStatError(e){switch(e.code){case`ENAMETOOLONG`:case`ENOENT`:case`ENOTDIR`:this.error(404,e);break;default:this.error(500,e);break}},SendStream.prototype.isFresh=function isFresh(){return s(this.req.headers,{etag:this.res.getHeader(`ETag`),"last-modified":this.res.getHeader(`Last-Modified`)})},SendStream.prototype.isRangeFresh=function isRangeFresh(){var e=this.req.headers[`if-range`];if(!e)return!0;if(e.indexOf(`"`)!==-1){var t=this.res.getHeader(`ETag`);return!!(t&&e.indexOf(t)!==-1)}return parseHttpDate(this.res.getHeader(`Last-Modified`))<=parseHttpDate(e)},SendStream.prototype.redirect=function redirect(e){var t=this.res;if(hasListeners(this,`directory`)){this.emit(`directory`,t,e);return}if(this.hasTrailingSlash()){this.error(403);return}var n=i(collapseLeadingSlashes(this.path+`/`)),r=createHtmlDocument(`Redirecting`,`Redirecting to `+a(n));t.statusCode=301,t.setHeader(`Content-Type`,`text/html; charset=UTF-8`),t.setHeader(`Content-Length`,Buffer.byteLength(r)),t.setHeader(`Content-Security-Policy`,`default-src 'none'`),t.setHeader(`X-Content-Type-Options`,`nosniff`),t.setHeader(`Location`,n),t.end(r)},SendStream.prototype.pipe=function pipe(e){var t=this._root;this.res=e;var n=decode(this.path);if(n===-1||~n.indexOf(`\0`))return this.error(400),e;var i;if(t!==null){if(n&&=b(`.`+S+n),E.test(n))return r(`malicious path "%s"`,n),this.error(403),e;i=n.split(S),n=b(y(t,n))}else{if(E.test(n))return r(`malicious path "%s"`,n),this.error(403),e;i=b(n).split(S),n=x(n)}if(containsDotFile(i))switch(r(`%s dotfile "%s"`,this._dotfiles,n),this._dotfiles){case`allow`:break;case`deny`:return this.error(403),e;default:return this.error(404),e}return this._index.length&&this.hasTrailingSlash()?(this.sendIndex(n),e):(this.sendFile(n),e)},SendStream.prototype.send=function send(e,t){var n=t.size,i=this.options,a={},o=this.res,s=this.req,c=s.headers.range,l=i.start||0;if(o.headersSent){this.headersAlreadySent();return}if(r(`pipe "%s"`,e),this.setHeader(e,t),this.type(e),this.isConditionalGET()){if(this.isPreconditionFailure()){this.error(412);return}if(this.isCachable()&&this.isFresh()){this.notModified();return}}if(n=Math.max(0,n-l),i.end!==void 0){var u=i.end-l+1;n>u&&(n=u)}if(this._acceptRanges&&w.test(c)){if(c=p(n,c,{combine:!0}),this.isRangeFresh()||(r(`range stale`),c=-2),c===-1)return r(`range unsatisfiable`),o.setHeader(`Content-Range`,contentRange(`bytes`,n)),this.error(416,{headers:{"Content-Range":o.getHeader(`Content-Range`)}});c!==-2&&c.length===1&&(r(`range %j`,c),o.statusCode=206,o.setHeader(`Content-Range`,contentRange(`bytes`,n,c[0])),l+=c[0].start,n=c[0].end-c[0].start+1)}for(var d in i)a[d]=i[d];if(a.start=l,a.end=Math.max(l,l+n-1),o.setHeader(`Content-Length`,n),s.method===`HEAD`){o.end();return}this.stream(e,a)},SendStream.prototype.sendFile=function sendFile(e){var t=0,n=this;r(`stat "%s"`,e),c.stat(e,function onstat(t,r){var i=e[e.length-1]===S;if(t&&t.code===`ENOENT`&&!v(e)&&!i)return next(t);if(t)return n.onStatError(t);if(r.isDirectory())return n.redirect(e);if(i)return n.error(404);n.emit(`file`,e,r),n.send(e,r)});function next(i){if(n._extensions.length<=t)return i?n.onStatError(i):n.error(404);var a=e+`.`+n._extensions[t++];r(`stat "%s"`,a),c.stat(a,function(e,t){if(e)return next(e);if(t.isDirectory())return next();n.emit(`file`,a,t),n.send(a,t)})}},SendStream.prototype.sendIndex=function sendIndex(e){var t=-1,n=this;function next(i){if(++t>=n._index.length)return i?n.onStatError(i):n.error(404);var a=y(e,n._index[t]);r(`stat "%s"`,a),c.stat(a,function(e,t){if(e)return next(e);if(t.isDirectory())return next();n.emit(`file`,a,t),n.send(a,t)})}next()},SendStream.prototype.stream=function stream(e,t){var n=this,r=this.res,i=c.createReadStream(e,t);this.emit(`stream`,i),i.pipe(r);function cleanup(){i.destroy()}d(r,cleanup),i.on(`error`,function onerror(e){cleanup(),n.onStatError(e)}),i.on(`end`,function onend(){n.emit(`end`)})},SendStream.prototype.type=function type(e){var t=this.res;if(!t.getHeader(`Content-Type`)){var n=v(e),i=l.contentType(n)||`application/octet-stream`;r(`content-type %s`,i),t.setHeader(`Content-Type`,i)}},SendStream.prototype.setHeader=function setHeader(e,t){var n=this.res;if(this.emit(`headers`,n,e,t),this._acceptRanges&&!n.getHeader(`Accept-Ranges`)&&(r(`accept ranges`),n.setHeader(`Accept-Ranges`,`bytes`)),this._cacheControl&&!n.getHeader(`Cache-Control`)){var i=`public, max-age=`+Math.floor(this._maxage/1e3);this._immutable&&(i+=`, immutable`),r(`cache-control %s`,i),n.setHeader(`Cache-Control`,i)}if(this._lastModified&&!n.getHeader(`Last-Modified`)){var a=t.mtime.toUTCString();r(`modified %s`,a),n.setHeader(`Last-Modified`,a)}if(this._etag&&!n.getHeader(`ETag`)){var s=o(t);r(`etag %s`,s),n.setHeader(`ETag`,s)}};function clearHeaders(e){for(let t of e.getHeaderNames())e.removeHeader(t)}function collapseLeadingSlashes(e){for(var t=0;t<e.length&&e[t]===`/`;t++);return t>1?`/`+e.substr(t):e}function containsDotFile(e){for(var t=0;t<e.length;t++){var n=e[t];if(n.length>1&&n[0]===`.`)return!0}return!1}function contentRange(e,t,n){return e+` `+(n?n.start+`-`+n.end:`*`)+`/`+t}function createHtmlDocument(e,t){return`<!DOCTYPE html>
311
+ var n=bo(),r=po()(`send`),i=hl(),a=gl(),o=ku(),s=vd(),c=(ou(),__toCommonJS(ru)),l=ds(),u=uo(),d=os(),p=yd(),m=(lo(),__toCommonJS(Ja)),h=_o(),g=Jo(),_=(ic(),__toCommonJS(ec)),v=m.extname,y=m.join,b=m.normalize,x=m.resolve,S=m.sep,w=/^ *bytes=/,T=3600*24*365*1e3,E=/(?:^|[\\/])\.\.(?:[\\/]|$)/;t.exports=send;function send(e,t,n){return new SendStream(e,t,n)}function SendStream(e,t,n){g.call(this);var r=n||{};if(this.options=r,this.path=t,this.req=e,this._acceptRanges=r.acceptRanges===void 0?!0:!!r.acceptRanges,this._cacheControl=r.cacheControl===void 0?!0:!!r.cacheControl,this._etag=r.etag===void 0?!0:!!r.etag,this._dotfiles=r.dotfiles===void 0?`ignore`:r.dotfiles,this._dotfiles!==`ignore`&&this._dotfiles!==`allow`&&this._dotfiles!==`deny`)throw TypeError(`dotfiles option must be "allow", "deny", or "ignore"`);this._extensions=r.extensions===void 0?[]:normalizeList(r.extensions,`extensions option`),this._immutable=r.immutable===void 0?!1:!!r.immutable,this._index=r.index===void 0?[`index.html`]:normalizeList(r.index,`index option`),this._lastModified=r.lastModified===void 0?!0:!!r.lastModified,this._maxage=r.maxAge||r.maxage,this._maxage=typeof this._maxage==`string`?u(this._maxage):Number(this._maxage),this._maxage=isNaN(this._maxage)?0:Math.min(Math.max(0,this._maxage),T),this._root=r.root?x(r.root):null}_.inherits(SendStream,g),SendStream.prototype.error=function error(e,t){if(hasListeners(this,`error`))return this.emit(`error`,createHttpError(e,t));var n=this.res,r=createHtmlDocument(`Error`,a(h.message[e]||String(e)));clearHeaders(n),t&&t.headers&&setHeaders(n,t.headers),n.statusCode=e,n.setHeader(`Content-Type`,`text/html; charset=UTF-8`),n.setHeader(`Content-Length`,Buffer.byteLength(r)),n.setHeader(`Content-Security-Policy`,`default-src 'none'`),n.setHeader(`X-Content-Type-Options`,`nosniff`),n.end(r)},SendStream.prototype.hasTrailingSlash=function hasTrailingSlash(){return this.path[this.path.length-1]===`/`},SendStream.prototype.isConditionalGET=function isConditionalGET(){return this.req.headers[`if-match`]||this.req.headers[`if-unmodified-since`]||this.req.headers[`if-none-match`]||this.req.headers[`if-modified-since`]},SendStream.prototype.isPreconditionFailure=function isPreconditionFailure(){var e=this.req,t=this.res,n=e.headers[`if-match`];if(n){var r=t.getHeader(`ETag`);return!r||n!==`*`&&parseTokenList(n).every(function(e){return e!==r&&e!==`W/`+r&&`W/`+e!==r})}var i=parseHttpDate(e.headers[`if-unmodified-since`]);if(!isNaN(i)){var a=parseHttpDate(t.getHeader(`Last-Modified`));return isNaN(a)||a>i}return!1},SendStream.prototype.removeContentHeaderFields=function removeContentHeaderFields(){var e=this.res;e.removeHeader(`Content-Encoding`),e.removeHeader(`Content-Language`),e.removeHeader(`Content-Length`),e.removeHeader(`Content-Range`),e.removeHeader(`Content-Type`)},SendStream.prototype.notModified=function notModified(){var e=this.res;r(`not modified`),this.removeContentHeaderFields(),e.statusCode=304,e.end()},SendStream.prototype.headersAlreadySent=function headersAlreadySent(){var e=Error(`Can't set headers after they are sent.`);r(`headers already sent`),this.error(500,e)},SendStream.prototype.isCachable=function isCachable(){var e=this.res.statusCode;return e>=200&&e<300||e===304},SendStream.prototype.onStatError=function onStatError(e){switch(e.code){case`ENAMETOOLONG`:case`ENOENT`:case`ENOTDIR`:this.error(404,e);break;default:this.error(500,e);break}},SendStream.prototype.isFresh=function isFresh(){return s(this.req.headers,{etag:this.res.getHeader(`ETag`),"last-modified":this.res.getHeader(`Last-Modified`)})},SendStream.prototype.isRangeFresh=function isRangeFresh(){var e=this.req.headers[`if-range`];if(!e)return!0;if(e.indexOf(`"`)!==-1){var t=this.res.getHeader(`ETag`);return!!(t&&e.indexOf(t)!==-1)}return parseHttpDate(this.res.getHeader(`Last-Modified`))<=parseHttpDate(e)},SendStream.prototype.redirect=function redirect(e){var t=this.res;if(hasListeners(this,`directory`)){this.emit(`directory`,t,e);return}if(this.hasTrailingSlash()){this.error(403);return}var n=i(collapseLeadingSlashes(this.path+`/`)),r=createHtmlDocument(`Redirecting`,`Redirecting to `+a(n));t.statusCode=301,t.setHeader(`Content-Type`,`text/html; charset=UTF-8`),t.setHeader(`Content-Length`,Buffer.byteLength(r)),t.setHeader(`Content-Security-Policy`,`default-src 'none'`),t.setHeader(`X-Content-Type-Options`,`nosniff`),t.setHeader(`Location`,n),t.end(r)},SendStream.prototype.pipe=function pipe(e){var t=this._root;this.res=e;var n=decode(this.path);if(n===-1||~n.indexOf(`\0`))return this.error(400),e;var i;if(t!==null){if(n&&=b(`.`+S+n),E.test(n))return r(`malicious path "%s"`,n),this.error(403),e;i=n.split(S),n=b(y(t,n))}else{if(E.test(n))return r(`malicious path "%s"`,n),this.error(403),e;i=b(n).split(S),n=x(n)}if(containsDotFile(i))switch(r(`%s dotfile "%s"`,this._dotfiles,n),this._dotfiles){case`allow`:break;case`deny`:return this.error(403),e;default:return this.error(404),e}return this._index.length&&this.hasTrailingSlash()?(this.sendIndex(n),e):(this.sendFile(n),e)},SendStream.prototype.send=function send(e,t){var n=t.size,i=this.options,a={},o=this.res,s=this.req,c=s.headers.range,l=i.start||0;if(o.headersSent){this.headersAlreadySent();return}if(r(`pipe "%s"`,e),this.setHeader(e,t),this.type(e),this.isConditionalGET()){if(this.isPreconditionFailure()){this.error(412);return}if(this.isCachable()&&this.isFresh()){this.notModified();return}}if(n=Math.max(0,n-l),i.end!==void 0){var u=i.end-l+1;n>u&&(n=u)}if(this._acceptRanges&&w.test(c)){if(c=p(n,c,{combine:!0}),this.isRangeFresh()||(r(`range stale`),c=-2),c===-1)return r(`range unsatisfiable`),o.setHeader(`Content-Range`,contentRange(`bytes`,n)),this.error(416,{headers:{"Content-Range":o.getHeader(`Content-Range`)}});c!==-2&&c.length===1&&(r(`range %j`,c),o.statusCode=206,o.setHeader(`Content-Range`,contentRange(`bytes`,n,c[0])),l+=c[0].start,n=c[0].end-c[0].start+1)}for(var d in i)a[d]=i[d];if(a.start=l,a.end=Math.max(l,l+n-1),o.setHeader(`Content-Length`,n),s.method===`HEAD`){o.end();return}this.stream(e,a)},SendStream.prototype.sendFile=function sendFile(e){var t=0,n=this;r(`stat "%s"`,e),c.stat(e,function onstat(t,r){var i=e[e.length-1]===S;if(t&&t.code===`ENOENT`&&!v(e)&&!i)return next(t);if(t)return n.onStatError(t);if(r.isDirectory())return n.redirect(e);if(i)return n.error(404);n.emit(`file`,e,r),n.send(e,r)});function next(i){if(n._extensions.length<=t)return i?n.onStatError(i):n.error(404);var a=e+`.`+n._extensions[t++];r(`stat "%s"`,a),c.stat(a,function(e,t){if(e)return next(e);if(t.isDirectory())return next();n.emit(`file`,a,t),n.send(a,t)})}},SendStream.prototype.sendIndex=function sendIndex(e){var t=-1,n=this;function next(i){if(++t>=n._index.length)return i?n.onStatError(i):n.error(404);var a=y(e,n._index[t]);r(`stat "%s"`,a),c.stat(a,function(e,t){if(e)return next(e);if(t.isDirectory())return next();n.emit(`file`,a,t),n.send(a,t)})}next()},SendStream.prototype.stream=function stream(e,t){var n=this,r=this.res,i=c.createReadStream(e,t);this.emit(`stream`,i),i.pipe(r);function cleanup(){i.destroy()}d(r,cleanup),i.on(`error`,function onerror(e){cleanup(),n.onStatError(e)}),i.on(`end`,function onend(){n.emit(`end`)})},SendStream.prototype.type=function type(e){var t=this.res;if(!t.getHeader(`Content-Type`)){var n=v(e),i=l.contentType(n)||`application/octet-stream`;r(`content-type %s`,i),t.setHeader(`Content-Type`,i)}},SendStream.prototype.setHeader=function setHeader(e,t){var n=this.res;if(this.emit(`headers`,n,e,t),this._acceptRanges&&!n.getHeader(`Accept-Ranges`)&&(r(`accept ranges`),n.setHeader(`Accept-Ranges`,`bytes`)),this._cacheControl&&!n.getHeader(`Cache-Control`)){var i=`public, max-age=`+Math.floor(this._maxage/1e3);this._immutable&&(i+=`, immutable`),r(`cache-control %s`,i),n.setHeader(`Cache-Control`,i)}if(this._lastModified&&!n.getHeader(`Last-Modified`)){var a=t.mtime.toUTCString();r(`modified %s`,a),n.setHeader(`Last-Modified`,a)}if(this._etag&&!n.getHeader(`ETag`)){var s=o(t);r(`etag %s`,s),n.setHeader(`ETag`,s)}};function clearHeaders(e){for(let t of e.getHeaderNames())e.removeHeader(t)}function collapseLeadingSlashes(e){for(var t=0;t<e.length&&e[t]===`/`;t++);return t>1?`/`+e.substr(t):e}function containsDotFile(e){for(var t=0;t<e.length;t++){var n=e[t];if(n.length>1&&n[0]===`.`)return!0}return!1}function contentRange(e,t,n){return e+` `+(n?n.start+`-`+n.end:`*`)+`/`+t}function createHtmlDocument(e,t){return`<!DOCTYPE html>
312
312
  <html lang="en">
313
313
  <head>
314
314
  <meta charset="utf-8">
@@ -318,20 +318,20 @@ var n=bo(),r=po()(`send`),i=hl(),a=gl(),o=ku(),s=pd(),c=(ou(),__toCommonJS(ru)),
318
318
  <pre>`+t+`</pre>
319
319
  </body>
320
320
  </html>
321
- `}function createHttpError(e,t){return t?t instanceof Error?n(e,t,{expose:!1}):n(e,t):n(e)}function decode(e){try{return decodeURIComponent(e)}catch{return-1}}function hasListeners(e,t){return(typeof e.listenerCount==`function`?e.listenerCount(t):e.listeners(t).length)>0}function normalizeList(e,t){for(var n=[].concat(e||[]),r=0;r<n.length;r++)if(typeof n[r]!=`string`)throw TypeError(t+` must be array of strings or false`);return n}function parseHttpDate(e){var t=e&&Date.parse(e);return typeof t==`number`?t:NaN}function parseTokenList(e){for(var t=0,n=[],r=0,i=0,a=e.length;i<a;i++)switch(e.charCodeAt(i)){case 32:r===t&&(r=t=i+1);break;case 44:r!==t&&n.push(e.substring(r,t)),r=t=i+1;break;default:t=i+1;break}return r!==t&&n.push(e.substring(r,t)),n}function setHeaders(e,t){for(var n=Object.keys(t),r=0;r<n.length;r++){var i=n[r];e.setHeader(i,t[i])}}})),bd=__commonJSMin(((e,t)=>{
321
+ `}function createHttpError(e,t){return t?t instanceof Error?n(e,t,{expose:!1}):n(e,t):n(e)}function decode(e){try{return decodeURIComponent(e)}catch{return-1}}function hasListeners(e,t){return(typeof e.listenerCount==`function`?e.listenerCount(t):e.listeners(t).length)>0}function normalizeList(e,t){for(var n=[].concat(e||[]),r=0;r<n.length;r++)if(typeof n[r]!=`string`)throw TypeError(t+` must be array of strings or false`);return n}function parseHttpDate(e){var t=e&&Date.parse(e);return typeof t==`number`?t:NaN}function parseTokenList(e){for(var t=0,n=[],r=0,i=0,a=e.length;i<a;i++)switch(e.charCodeAt(i)){case 32:r===t&&(r=t=i+1);break;case 44:r!==t&&n.push(e.substring(r,t)),r=t=i+1;break;default:t=i+1;break}return r!==t&&n.push(e.substring(r,t)),n}function setHeaders(e,t){for(var n=Object.keys(t),r=0;r<n.length;r++){var i=n[r];e.setHeader(i,t[i])}}})),Td=__commonJSMin(((e,t)=>{
322
322
  /*!
323
323
  * vary
324
324
  * Copyright(c) 2014-2017 Douglas Christopher Wilson
325
325
  * MIT Licensed
326
326
  */
327
- t.exports=vary,t.exports.append=append;var n=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/;function append(e,t){if(typeof e!=`string`)throw TypeError(`header argument is required`);if(!t)throw TypeError(`field argument is required`);for(var r=Array.isArray(t)?t:parse(String(t)),i=0;i<r.length;i++)if(!n.test(r[i]))throw TypeError(`field argument contains an invalid header name`);if(e===`*`)return e;var a=e,o=parse(e.toLowerCase());if(r.indexOf(`*`)!==-1||o.indexOf(`*`)!==-1)return`*`;for(var s=0;s<r.length;s++){var c=r[s].toLowerCase();o.indexOf(c)===-1&&(o.push(c),a=a?a+`, `+r[s]:r[s])}return a}function parse(e){for(var t=0,n=[],r=0,i=0,a=e.length;i<a;i++)switch(e.charCodeAt(i)){case 32:r===t&&(r=t=i+1);break;case 44:n.push(e.substring(r,t)),r=t=i+1;break;default:t=i+1;break}return n.push(e.substring(r,t)),n}function vary(e,t){if(!e||!e.getHeader||!e.setHeader)throw TypeError(`res argument is required`);var n=e.getHeader(`Vary`)||``;(n=append(Array.isArray(n)?n.join(`, `):String(n),t))&&e.setHeader(`Vary`,n)}})),xd=__commonJSMin(((e,t)=>{
327
+ t.exports=vary,t.exports.append=append;var n=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/;function append(e,t){if(typeof e!=`string`)throw TypeError(`header argument is required`);if(!t)throw TypeError(`field argument is required`);for(var r=Array.isArray(t)?t:parse(String(t)),i=0;i<r.length;i++)if(!n.test(r[i]))throw TypeError(`field argument contains an invalid header name`);if(e===`*`)return e;var a=e,o=parse(e.toLowerCase());if(r.indexOf(`*`)!==-1||o.indexOf(`*`)!==-1)return`*`;for(var s=0;s<r.length;s++){var c=r[s].toLowerCase();o.indexOf(c)===-1&&(o.push(c),a=a?a+`, `+r[s]:r[s])}return a}function parse(e){for(var t=0,n=[],r=0,i=0,a=e.length;i<a;i++)switch(e.charCodeAt(i)){case 32:r===t&&(r=t=i+1);break;case 44:n.push(e.substring(r,t)),r=t=i+1;break;default:t=i+1;break}return n.push(e.substring(r,t)),n}function vary(e,t){if(!e||!e.getHeader||!e.setHeader)throw TypeError(`res argument is required`);var n=e.getHeader(`Vary`)||``;(n=append(Array.isArray(n)?n.join(`, `):String(n),t))&&e.setHeader(`Vary`,n)}})),Ed=__commonJSMin(((e,t)=>{
328
328
  /*!
329
329
  * express
330
330
  * Copyright(c) 2009-2013 TJ Holowaychuk
331
331
  * Copyright(c) 2014-2015 Douglas Christopher Wilson
332
332
  * MIT Licensed
333
333
  */
334
- var n=gd(),r=bo(),i=mo()(`express`),a=hl(),o=gl(),s=(Ou(),__toCommonJS(wu)),c=os(),l=ds(),u=(lo(),__toCommonJS(Ja)),d=(lo(),__toCommonJS(Ja)).isAbsolute,p=_o(),m=_d().sign,h=Gu().normalizeType,g=Gu().normalizeTypes,_=Gu().setCharset,v=vd(),y=yd(),b=u.extname,x=u.resolve,S=bd();let{Buffer:w}=(J(),__toCommonJS(Yt));var T=Object.create(s.ServerResponse.prototype);t.exports=T,T.status=function status(e){if(!Number.isInteger(e))throw TypeError(`Invalid status code: ${JSON.stringify(e)}. Status code must be an integer.`);if(e<100||e>999)throw RangeError(`Invalid status code: ${JSON.stringify(e)}. Status code must be greater than 99 and less than 1000.`);return this.statusCode=e,this},T.links=function(e){var t=this.get(`Link`)||``;return t&&(t+=`, `),this.set(`Link`,t+Object.keys(e).map(function(t){return Array.isArray(e[t])?e[t].map(function(e){return`<${e}>; rel="${t}"`}).join(`, `):`<${e[t]}>; rel="${t}"`}).join(`, `))},T.send=function send(e){var t=e,n,r=this.req,i,a=this.app;switch(typeof t){case`string`:this.get(`Content-Type`)||this.type(`html`);break;case`boolean`:case`number`:case`object`:if(t===null)t=``;else if(ArrayBuffer.isView(t))this.get(`Content-Type`)||this.type(`bin`);else return this.json(t);break}typeof t==`string`&&(n=`utf8`,i=this.get(`Content-Type`),typeof i==`string`&&this.set(`Content-Type`,_(i,`utf-8`)));var o=a.get(`etag fn`),s=!this.get(`ETag`)&&typeof o==`function`,c;t!==void 0&&(w.isBuffer(t)?c=t.length:!s&&t.length<1e3?c=w.byteLength(t,n):(t=w.from(t,n),n=void 0,c=t.length),this.set(`Content-Length`,c));var l;return s&&c!==void 0&&(l=o(t,n))&&this.set(`ETag`,l),r.fresh&&this.status(304),(this.statusCode===204||this.statusCode===304)&&(this.removeHeader(`Content-Type`),this.removeHeader(`Content-Length`),this.removeHeader(`Transfer-Encoding`),t=``),this.statusCode===205&&(this.set(`Content-Length`,`0`),this.removeHeader(`Transfer-Encoding`),t=``),r.method===`HEAD`?this.end():this.end(t,n),this},T.json=function json(e){var t=this.app,n=t.get(`json escape`),r=stringify(e,t.get(`json replacer`),t.get(`json spaces`),n);return this.get(`Content-Type`)||this.set(`Content-Type`,`application/json`),this.send(r)},T.jsonp=function jsonp(e){var t=this.app,n=t.get(`json escape`),r=stringify(e,t.get(`json replacer`),t.get(`json spaces`),n),i=this.req.query[t.get(`jsonp callback name`)];return this.get(`Content-Type`)||(this.set(`X-Content-Type-Options`,`nosniff`),this.set(`Content-Type`,`application/json`)),Array.isArray(i)&&(i=i[0]),typeof i==`string`&&i.length!==0&&(this.set(`X-Content-Type-Options`,`nosniff`),this.set(`Content-Type`,`text/javascript`),i=i.replace(/[^\[\]\w$.]/g,``),r===void 0?r=``:typeof r==`string`&&(r=r.replace(/\u2028/g,`\\u2028`).replace(/\u2029/g,`\\u2029`)),r=`/**/ typeof `+i+` === 'function' && `+i+`(`+r+`);`),this.send(r)},T.sendStatus=function sendStatus(e){var t=p.message[e]||String(e);return this.status(e),this.type(`txt`),this.send(t)},T.sendFile=function sendFile(e,t,n){var r=n,i=this.req,a=this,o=i.next,s=t||{};if(!e)throw TypeError(`path argument is required to res.sendFile`);if(typeof e!=`string`)throw TypeError(`path must be a string to res.sendFile`);if(typeof t==`function`&&(r=t,s={}),!s.root&&!d(e))throw TypeError(`path must be absolute or specify root to res.sendFile`);var c=encodeURI(e);s.etag=this.app.enabled(`etag`),sendfile(a,y(i,c,s),s,function(e){if(r)return r(e);if(e&&e.code===`EISDIR`)return o();e&&e.code!==`ECONNABORTED`&&e.syscall!==`write`&&o(e)})},T.download=function download(e,t,r,i){var a=i,o=t,s=r||null;typeof t==`function`?(a=t,o=null,s=null):typeof r==`function`&&(a=r,s=null),typeof t==`object`&&(typeof r==`function`||r===void 0)&&(o=null,s=t);var c={"Content-Disposition":n(o||e)};if(s&&s.headers)for(var l=Object.keys(s.headers),u=0;u<l.length;u++){var d=l[u];d.toLowerCase()!==`content-disposition`&&(c[d]=s.headers[d])}s=Object.create(s),s.headers=c;var p=s.root?e:x(e);return this.sendFile(p,s,a)},T.contentType=T.type=function contentType(e){var t=e.indexOf(`/`)===-1?l.contentType(e)||`application/octet-stream`:e;return this.set(`Content-Type`,t)},T.format=function(e){var t=this.req,n=t.next,i=Object.keys(e).filter(function(e){return e!=="default"}),a=i.length>0?t.accepts(i):!1;return this.vary(`Accept`),a?(this.set(`Content-Type`,h(a).value),e[a](t,this,n)):e.default?e.default(t,this,n):n(r(406,{types:g(i).map(function(e){return e.value})})),this},T.attachment=function attachment(e){return e&&this.type(b(e)),this.set(`Content-Disposition`,n(e)),this},T.append=function append(e,t){var n=this.get(e),r=t;return n&&(r=Array.isArray(n)?n.concat(t):Array.isArray(t)?[n].concat(t):[n,t]),this.set(e,r)},T.set=T.header=function header(e,t){if(arguments.length===2){var n=Array.isArray(t)?t.map(String):String(t);if(e.toLowerCase()===`content-type`){if(Array.isArray(n))throw TypeError(`Content-Type cannot be set to an Array`);n=l.contentType(n)}this.setHeader(e,n)}else for(var r in e)this.set(r,e[r]);return this},T.get=function(e){return this.getHeader(e)},T.clearCookie=function clearCookie(e,t){let n={path:`/`,...t,expires:new Date(1)};return delete n.maxAge,this.cookie(e,``,n)},T.cookie=function(e,t,n){var r={...n},i=this.req.secret,a=r.signed;if(a&&!i)throw Error(`cookieParser("secret") required for signed cookies`);var o=typeof t==`object`?`j:`+JSON.stringify(t):String(t);if(a&&(o=`s:`+m(o,i)),r.maxAge!=null){var s=r.maxAge-0;isNaN(s)||(r.expires=new Date(Date.now()+s),r.maxAge=Math.floor(s/1e3))}return r.path??=`/`,this.append(`Set-Cookie`,v.serialize(e,String(o),r)),this},T.location=function location(e){return this.set(`Location`,a(e))},T.redirect=function redirect(e){var t=e,n,r=302;arguments.length===2&&(r=arguments[0],t=arguments[1]),t||i(`Provide a url argument`),typeof t!=`string`&&i(`Url must be a string`),typeof r!=`number`&&i(`Status must be a number`),t=this.location(t).get(`Location`),this.format({text:function(){n=p.message[r]+`. Redirecting to `+t},html:function(){var e=o(t);n=`<p>`+p.message[r]+`. Redirecting to `+e+`</p>`},default:function(){n=``}}),this.status(r),this.set(`Content-Length`,w.byteLength(n)),this.req.method===`HEAD`?this.end():this.end(n)},T.vary=function(e){return S(this,e),this},T.render=function render(e,t,n){var r=this.req.app,done=n,i=t||{},a=this.req,o=this;typeof t==`function`&&(done=t,i={}),i._locals=o.locals,done||=function(e,t){if(e)return a.next(e);o.send(t)},r.render(e,i,done)};function sendfile(e,t,n,r){var i=!1,a;function onaborted(){if(!i){i=!0;var e=Error(`Request aborted`);e.code=`ECONNABORTED`,r(e)}}function ondirectory(){if(!i){i=!0;var e=Error(`EISDIR, read`);e.code=`EISDIR`,r(e)}}function onerror(e){i||(i=!0,r(e))}function onend(){i||(i=!0,r())}function onfile(){a=!1}function onfinish(e){if(e&&e.code===`ECONNRESET`)return onaborted();if(e)return onerror(e);i||setImmediate(function(){if(a!==!1&&!i){onaborted();return}i||(i=!0,r())})}function onstream(){a=!0}t.on(`directory`,ondirectory),t.on(`end`,onend),t.on(`error`,onerror),t.on(`file`,onfile),t.on(`stream`,onstream),c(e,onfinish),n.headers&&t.on(`headers`,function headers(e){for(var t=n.headers,r=Object.keys(t),i=0;i<r.length;i++){var a=r[i];e.setHeader(a,t[a])}}),t.pipe(e)}function stringify(e,t,n,r){var i=t||n?JSON.stringify(e,t,n):JSON.stringify(e);return r&&typeof i==`string`&&(i=i.replace(/[<>&]/g,function(e){switch(e.charCodeAt(0)){case 60:return`\\u003c`;case 62:return`\\u003e`;case 38:return`\\u0026`;default:return e}})),i}})),Sd=__commonJSMin(((e,t)=>{
334
+ var n=xd(),r=bo(),i=mo()(`express`),a=hl(),o=gl(),s=(Ou(),__toCommonJS(wu)),c=os(),l=ds(),u=(lo(),__toCommonJS(Ja)),d=(lo(),__toCommonJS(Ja)).isAbsolute,p=_o(),m=Sd().sign,h=Xu().normalizeType,g=Xu().normalizeTypes,_=Xu().setCharset,v=Cd(),y=wd(),b=u.extname,x=u.resolve,S=Td();let{Buffer:w}=(J(),__toCommonJS(Yt));var T=Object.create(s.ServerResponse.prototype);t.exports=T,T.status=function status(e){if(!Number.isInteger(e))throw TypeError(`Invalid status code: ${JSON.stringify(e)}. Status code must be an integer.`);if(e<100||e>999)throw RangeError(`Invalid status code: ${JSON.stringify(e)}. Status code must be greater than 99 and less than 1000.`);return this.statusCode=e,this},T.links=function(e){var t=this.get(`Link`)||``;return t&&(t+=`, `),this.set(`Link`,t+Object.keys(e).map(function(t){return Array.isArray(e[t])?e[t].map(function(e){return`<${e}>; rel="${t}"`}).join(`, `):`<${e[t]}>; rel="${t}"`}).join(`, `))},T.send=function send(e){var t=e,n,r=this.req,i,a=this.app;switch(typeof t){case`string`:this.get(`Content-Type`)||this.type(`html`);break;case`boolean`:case`number`:case`object`:if(t===null)t=``;else if(ArrayBuffer.isView(t))this.get(`Content-Type`)||this.type(`bin`);else return this.json(t);break}typeof t==`string`&&(n=`utf8`,i=this.get(`Content-Type`),typeof i==`string`&&this.set(`Content-Type`,_(i,`utf-8`)));var o=a.get(`etag fn`),s=!this.get(`ETag`)&&typeof o==`function`,c;t!==void 0&&(w.isBuffer(t)?c=t.length:!s&&t.length<1e3?c=w.byteLength(t,n):(t=w.from(t,n),n=void 0,c=t.length),this.set(`Content-Length`,c));var l;return s&&c!==void 0&&(l=o(t,n))&&this.set(`ETag`,l),r.fresh&&this.status(304),(this.statusCode===204||this.statusCode===304)&&(this.removeHeader(`Content-Type`),this.removeHeader(`Content-Length`),this.removeHeader(`Transfer-Encoding`),t=``),this.statusCode===205&&(this.set(`Content-Length`,`0`),this.removeHeader(`Transfer-Encoding`),t=``),r.method===`HEAD`?this.end():this.end(t,n),this},T.json=function json(e){var t=this.app,n=t.get(`json escape`),r=stringify(e,t.get(`json replacer`),t.get(`json spaces`),n);return this.get(`Content-Type`)||this.set(`Content-Type`,`application/json`),this.send(r)},T.jsonp=function jsonp(e){var t=this.app,n=t.get(`json escape`),r=stringify(e,t.get(`json replacer`),t.get(`json spaces`),n),i=this.req.query[t.get(`jsonp callback name`)];return this.get(`Content-Type`)||(this.set(`X-Content-Type-Options`,`nosniff`),this.set(`Content-Type`,`application/json`)),Array.isArray(i)&&(i=i[0]),typeof i==`string`&&i.length!==0&&(this.set(`X-Content-Type-Options`,`nosniff`),this.set(`Content-Type`,`text/javascript`),i=i.replace(/[^\[\]\w$.]/g,``),r===void 0?r=``:typeof r==`string`&&(r=r.replace(/\u2028/g,`\\u2028`).replace(/\u2029/g,`\\u2029`)),r=`/**/ typeof `+i+` === 'function' && `+i+`(`+r+`);`),this.send(r)},T.sendStatus=function sendStatus(e){var t=p.message[e]||String(e);return this.status(e),this.type(`txt`),this.send(t)},T.sendFile=function sendFile(e,t,n){var r=n,i=this.req,a=this,o=i.next,s=t||{};if(!e)throw TypeError(`path argument is required to res.sendFile`);if(typeof e!=`string`)throw TypeError(`path must be a string to res.sendFile`);if(typeof t==`function`&&(r=t,s={}),!s.root&&!d(e))throw TypeError(`path must be absolute or specify root to res.sendFile`);var c=encodeURI(e);s.etag=this.app.enabled(`etag`),sendfile(a,y(i,c,s),s,function(e){if(r)return r(e);if(e&&e.code===`EISDIR`)return o();e&&e.code!==`ECONNABORTED`&&e.syscall!==`write`&&o(e)})},T.download=function download(e,t,r,i){var a=i,o=t,s=r||null;typeof t==`function`?(a=t,o=null,s=null):typeof r==`function`&&(a=r,s=null),typeof t==`object`&&(typeof r==`function`||r===void 0)&&(o=null,s=t);var c={"Content-Disposition":n(o||e)};if(s&&s.headers)for(var l=Object.keys(s.headers),u=0;u<l.length;u++){var d=l[u];d.toLowerCase()!==`content-disposition`&&(c[d]=s.headers[d])}s=Object.create(s),s.headers=c;var p=s.root?e:x(e);return this.sendFile(p,s,a)},T.contentType=T.type=function contentType(e){var t=e.indexOf(`/`)===-1?l.contentType(e)||`application/octet-stream`:e;return this.set(`Content-Type`,t)},T.format=function(e){var t=this.req,n=t.next,i=Object.keys(e).filter(function(e){return e!=="default"}),a=i.length>0?t.accepts(i):!1;return this.vary(`Accept`),a?(this.set(`Content-Type`,h(a).value),e[a](t,this,n)):e.default?e.default(t,this,n):n(r(406,{types:g(i).map(function(e){return e.value})})),this},T.attachment=function attachment(e){return e&&this.type(b(e)),this.set(`Content-Disposition`,n(e)),this},T.append=function append(e,t){var n=this.get(e),r=t;return n&&(r=Array.isArray(n)?n.concat(t):Array.isArray(t)?[n].concat(t):[n,t]),this.set(e,r)},T.set=T.header=function header(e,t){if(arguments.length===2){var n=Array.isArray(t)?t.map(String):String(t);if(e.toLowerCase()===`content-type`){if(Array.isArray(n))throw TypeError(`Content-Type cannot be set to an Array`);n=l.contentType(n)}this.setHeader(e,n)}else for(var r in e)this.set(r,e[r]);return this},T.get=function(e){return this.getHeader(e)},T.clearCookie=function clearCookie(e,t){let n={path:`/`,...t,expires:new Date(1)};return delete n.maxAge,this.cookie(e,``,n)},T.cookie=function(e,t,n){var r={...n},i=this.req.secret,a=r.signed;if(a&&!i)throw Error(`cookieParser("secret") required for signed cookies`);var o=typeof t==`object`?`j:`+JSON.stringify(t):String(t);if(a&&(o=`s:`+m(o,i)),r.maxAge!=null){var s=r.maxAge-0;isNaN(s)||(r.expires=new Date(Date.now()+s),r.maxAge=Math.floor(s/1e3))}return r.path??=`/`,this.append(`Set-Cookie`,v.serialize(e,String(o),r)),this},T.location=function location(e){return this.set(`Location`,a(e))},T.redirect=function redirect(e){var t=e,n,r=302;arguments.length===2&&(r=arguments[0],t=arguments[1]),t||i(`Provide a url argument`),typeof t!=`string`&&i(`Url must be a string`),typeof r!=`number`&&i(`Status must be a number`),t=this.location(t).get(`Location`),this.format({text:function(){n=p.message[r]+`. Redirecting to `+t},html:function(){var e=o(t);n=`<p>`+p.message[r]+`. Redirecting to `+e+`</p>`},default:function(){n=``}}),this.status(r),this.set(`Content-Length`,w.byteLength(n)),this.req.method===`HEAD`?this.end():this.end(n)},T.vary=function(e){return S(this,e),this},T.render=function render(e,t,n){var r=this.req.app,done=n,i=t||{},a=this.req,o=this;typeof t==`function`&&(done=t,i={}),i._locals=o.locals,done||=function(e,t){if(e)return a.next(e);o.send(t)},r.render(e,i,done)};function sendfile(e,t,n,r){var i=!1,a;function onaborted(){if(!i){i=!0;var e=Error(`Request aborted`);e.code=`ECONNABORTED`,r(e)}}function ondirectory(){if(!i){i=!0;var e=Error(`EISDIR, read`);e.code=`EISDIR`,r(e)}}function onerror(e){i||(i=!0,r(e))}function onend(){i||(i=!0,r())}function onfile(){a=!1}function onfinish(e){if(e&&e.code===`ECONNRESET`)return onaborted();if(e)return onerror(e);i||setImmediate(function(){if(a!==!1&&!i){onaborted();return}i||(i=!0,r())})}function onstream(){a=!0}t.on(`directory`,ondirectory),t.on(`end`,onend),t.on(`error`,onerror),t.on(`file`,onfile),t.on(`stream`,onstream),c(e,onfinish),n.headers&&t.on(`headers`,function headers(e){for(var t=n.headers,r=Object.keys(t),i=0;i<r.length;i++){var a=r[i];e.setHeader(a,t[a])}}),t.pipe(e)}function stringify(e,t,n,r){var i=t||n?JSON.stringify(e,t,n):JSON.stringify(e);return r&&typeof i==`string`&&(i=i.replace(/[<>&]/g,function(e){switch(e.charCodeAt(0)){case 60:return`\\u003c`;case 62:return`\\u003e`;case 38:return`\\u0026`;default:return e}})),i}})),Dd=__commonJSMin(((e,t)=>{
335
335
  /*!
336
336
  * serve-static
337
337
  * Copyright(c) 2010 Sencha Inc.
@@ -339,7 +339,7 @@ var n=gd(),r=bo(),i=mo()(`express`),a=hl(),o=gl(),s=(Ou(),__toCommonJS(wu)),c=os
339
339
  * Copyright(c) 2014-2016 Douglas Christopher Wilson
340
340
  * MIT Licensed
341
341
  */
342
- var n=hl(),r=gl(),i=_l(),a=(lo(),__toCommonJS(Ja)).resolve,o=yd(),s=(Dn(),__toCommonJS(Cn));t.exports=serveStatic;function serveStatic(e,t){if(!e)throw TypeError(`root path required`);if(typeof e!=`string`)throw TypeError(`root path must be a string`);var n=Object.create(t||null),r=n.fallthrough!==!1,s=n.redirect!==!1,c=n.setHeaders;if(c&&typeof c!=`function`)throw TypeError(`option setHeaders must be function`);n.maxage=n.maxage||n.maxAge||0,n.root=a(e);var l=s?createRedirectDirectoryListener():createNotFoundDirectoryListener();return function serveStatic(e,t,a){if(e.method!==`GET`&&e.method!==`HEAD`){if(r)return a();t.statusCode=405,t.setHeader(`Allow`,`GET, HEAD`),t.setHeader(`Content-Length`,`0`),t.end();return}var s=!r,u=i.original(e),d=i(e).pathname;d===`/`&&u.pathname.substr(-1)!==`/`&&(d=``);var p=o(e,d,n);p.on(`directory`,l),c&&p.on(`headers`,c),r&&p.on(`file`,function onFile(){s=!0}),p.on(`error`,function error(e){if(s||!(e.statusCode<500)){a(e);return}a()}),p.pipe(t)}}function collapseLeadingSlashes(e){for(var t=0;t<e.length&&e.charCodeAt(t)===47;t++);return t>1?`/`+e.substr(t):e}function createHtmlDocument(e,t){return`<!DOCTYPE html>
342
+ var n=hl(),r=gl(),i=_l(),a=(lo(),__toCommonJS(Ja)).resolve,o=wd(),s=(Dn(),__toCommonJS(Cn));t.exports=serveStatic;function serveStatic(e,t){if(!e)throw TypeError(`root path required`);if(typeof e!=`string`)throw TypeError(`root path must be a string`);var n=Object.create(t||null),r=n.fallthrough!==!1,s=n.redirect!==!1,c=n.setHeaders;if(c&&typeof c!=`function`)throw TypeError(`option setHeaders must be function`);n.maxage=n.maxage||n.maxAge||0,n.root=a(e);var l=s?createRedirectDirectoryListener():createNotFoundDirectoryListener();return function serveStatic(e,t,a){if(e.method!==`GET`&&e.method!==`HEAD`){if(r)return a();t.statusCode=405,t.setHeader(`Allow`,`GET, HEAD`),t.setHeader(`Content-Length`,`0`),t.end();return}var s=!r,u=i.original(e),d=i(e).pathname;d===`/`&&u.pathname.substr(-1)!==`/`&&(d=``);var p=o(e,d,n);p.on(`directory`,l),c&&p.on(`headers`,c),r&&p.on(`file`,function onFile(){s=!0}),p.on(`error`,function error(e){if(s||!(e.statusCode<500)){a(e);return}a()}),p.pipe(t)}}function collapseLeadingSlashes(e){for(var t=0;t<e.length&&e.charCodeAt(t)===47;t++);return t>1?`/`+e.substr(t):e}function createHtmlDocument(e,t){return`<!DOCTYPE html>
343
343
  <html lang="en">
344
344
  <head>
345
345
  <meta charset="utf-8">
@@ -349,7 +349,7 @@ var n=hl(),r=gl(),i=_l(),a=(lo(),__toCommonJS(Ja)).resolve,o=yd(),s=(Dn(),__toCo
349
349
  <pre>`+t+`</pre>
350
350
  </body>
351
351
  </html>
352
- `}function createNotFoundDirectoryListener(){return function notFound(){this.error(404)}}function createRedirectDirectoryListener(){return function redirect(e){if(this.hasTrailingSlash()){this.error(404);return}var t=i.original(this.req);t.path=null,t.pathname=collapseLeadingSlashes(t.pathname+`/`);var a=n(s.format(t)),o=createHtmlDocument(`Redirecting`,`Redirecting to `+r(a));e.statusCode=301,e.setHeader(`Content-Type`,`text/html; charset=UTF-8`),e.setHeader(`Content-Length`,Buffer.byteLength(o)),e.setHeader(`Content-Security-Policy`,`default-src 'none'`),e.setHeader(`X-Content-Type-Options`,`nosniff`),e.setHeader(`Location`,a),e.end(o)}}})),Cd=__commonJSMin(((e,t)=>{
352
+ `}function createNotFoundDirectoryListener(){return function notFound(){this.error(404)}}function createRedirectDirectoryListener(){return function redirect(e){if(this.hasTrailingSlash()){this.error(404);return}var t=i.original(this.req);t.path=null,t.pathname=collapseLeadingSlashes(t.pathname+`/`);var a=n(s.format(t)),o=createHtmlDocument(`Redirecting`,`Redirecting to `+r(a));e.statusCode=301,e.setHeader(`Content-Type`,`text/html; charset=UTF-8`),e.setHeader(`Content-Length`,Buffer.byteLength(o)),e.setHeader(`Content-Security-Policy`,`default-src 'none'`),e.setHeader(`X-Content-Type-Options`,`nosniff`),e.setHeader(`Location`,a),e.end(o)}}})),Od=__commonJSMin(((e,t)=>{
353
353
  /*!
354
354
  * express
355
355
  * Copyright(c) 2009-2013 TJ Holowaychuk
@@ -357,7 +357,7 @@ var n=hl(),r=gl(),i=_l(),a=(lo(),__toCommonJS(Ja)).resolve,o=yd(),s=(Dn(),__toCo
357
357
  * Copyright(c) 2014-2015 Douglas Christopher Wilson
358
358
  * MIT Licensed
359
359
  */
360
- var n=fl(),r=pl().EventEmitter,i=ml(),a=ed(),o=$u(),s=hd(),c=xd();e=t.exports=createApplication;function createApplication(){var app=function(e,t,n){app.handle(e,t,n)};return i(app,r.prototype,!1),i(app,a,!1),app.request=Object.create(s,{app:{configurable:!0,enumerable:!0,writable:!0,value:app}}),app.response=Object.create(c,{app:{configurable:!0,enumerable:!0,writable:!0,value:app}}),app.init(),app}e.application=a,e.request=s,e.response=c,e.Route=o.Route,e.Router=o,e.json=n.json,e.raw=n.raw,e.static=Sd(),e.text=n.text,e.urlencoded=n.urlencoded})),wd=__toESM(__commonJSMin(((e,t)=>{
360
+ var n=fl(),r=pl().EventEmitter,i=ml(),a=ad(),o=id(),s=bd(),c=Ed();e=t.exports=createApplication;function createApplication(){var app=function(e,t,n){app.handle(e,t,n)};return i(app,r.prototype,!1),i(app,a,!1),app.request=Object.create(s,{app:{configurable:!0,enumerable:!0,writable:!0,value:app}}),app.response=Object.create(c,{app:{configurable:!0,enumerable:!0,writable:!0,value:app}}),app.init(),app}e.application=a,e.request=s,e.response=c,e.Route=o.Route,e.Router=o,e.json=n.json,e.raw=n.raw,e.static=Dd(),e.text=n.text,e.urlencoded=n.urlencoded})),kd=__toESM(__commonJSMin(((e,t)=>{
361
361
  /*!
362
362
  * express
363
363
  * Copyright(c) 2009-2013 TJ Holowaychuk
@@ -365,14 +365,14 @@ var n=fl(),r=pl().EventEmitter,i=ml(),a=ed(),o=$u(),s=hd(),c=xd();e=t.exports=cr
365
365
  * Copyright(c) 2014-2015 Douglas Christopher Wilson
366
366
  * MIT Licensed
367
367
  */
368
- t.exports=Cd()}))());const Td=[{id:1,slug:`hello-gjs`,title:`Hello, GJS!`,author:`Pascal`,date:`2026-04-01`,excerpt:`Running Express.js natively on Linux via GJS — no Node.js required.`,content:"This blog is served by a real Express.js application — the same code you would\nwrite for Node.js. The difference: it's running inside GJS, the GNOME JavaScript\nruntime, backed by GLib, Gio and Soup. No Node binary, no V8 — just SpiderMonkey\nand native Linux libraries.\n\nWith `@gjsify/node-globals` and the `@gjsify/*` package set, the full Node.js\nAPI surface is available: `fs`, `net`, `http`, `crypto`, `stream`, `events`,\nand many more. That means your existing npm ecosystem works out of the box."},{id:2,slug:`why-gjsify`,title:`Why GJSify?`,author:`Pascal`,date:`2026-04-03`,excerpt:`Bringing the full TypeScript ecosystem to the GNOME JavaScript runtime.`,content:`GJS is fantastic for writing GNOME applications, but historically you had to
368
+ t.exports=Od()}))());const Ad=[{id:1,slug:`hello-gjs`,title:`Hello, GJS!`,author:`Pascal`,date:`2026-04-01`,excerpt:`Running Express.js natively on Linux via GJS — no Node.js required.`,content:"This blog is served by a real Express.js application — the same code you would\nwrite for Node.js. The difference: it's running inside GJS, the GNOME JavaScript\nruntime, backed by GLib, Gio and Soup. No Node binary, no V8 — just SpiderMonkey\nand native Linux libraries.\n\nWith `@gjsify/node-globals` and the `@gjsify/*` package set, the full Node.js\nAPI surface is available: `fs`, `net`, `http`, `crypto`, `stream`, `events`,\nand many more. That means your existing npm ecosystem works out of the box."},{id:2,slug:`why-gjsify`,title:`Why GJSify?`,author:`Pascal`,date:`2026-04-03`,excerpt:`Bringing the full TypeScript ecosystem to the GNOME JavaScript runtime.`,content:`GJS is fantastic for writing GNOME applications, but historically you had to
369
369
  choose between the GObject world and the rich npm ecosystem. GJSify bridges
370
370
  that gap by implementing the Node.js and Web APIs on top of native GNOME
371
371
  libraries — so a package like Express, Koa or Hono Just Works, and you can
372
372
  still reach into GTK, Cairo or WebKit whenever you need to.
373
373
 
374
374
  The trade-off is no longer "Node.js or GNOME" — you can have both in the
375
- same application.`},{id:3,slug:`express-on-soup`,title:`Express on Soup 3.0`,author:`Pascal`,date:`2026-04-05`,excerpt:`How Express listens on a port when there is no V8 event loop.`,content:"The magic trick is `@gjsify/http`: it implements Node's `http` module on top\nof `Soup.Server`. When Express calls `app.listen(3000)`, GJSify starts a\nGLib MainLoop under the hood and wires Soup's request signals into Node-style\n`IncomingMessage` / `ServerResponse` objects.\n\nThe result: Express middleware, routing, template engines and the rest of the\necosystem simply work — on the GNOME stack."}];me(),lo(),Dn();const Ed=Qa(to(fileURLToPath(import.meta.url)),`public`),Dd=parseInt(process.env.PORT||`3000`,10),Od=(0,wd.default)();function escapeHtml(e){return e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`).replace(/"/g,`&quot;`)}function renderContent(e){return e.split(/\n\n+/).map(e=>`<p>${escapeHtml(e.trim()).replace(/\n/g,`<br />`)}</p>`).join(`
375
+ same application.`},{id:3,slug:`express-on-soup`,title:`Express on Soup 3.0`,author:`Pascal`,date:`2026-04-05`,excerpt:`How Express listens on a port when there is no V8 event loop.`,content:"The magic trick is `@gjsify/http`: it implements Node's `http` module on top\nof `Soup.Server`. When Express calls `app.listen(3000)`, GJSify starts a\nGLib MainLoop under the hood and wires Soup's request signals into Node-style\n`IncomingMessage` / `ServerResponse` objects.\n\nThe result: Express middleware, routing, template engines and the rest of the\necosystem simply work — on the GNOME stack."}];me(),lo(),Dn();const jd=Qa(to(fileURLToPath(import.meta.url)),`public`),Md=parseInt(process.env.PORT||`3000`,10),Nd=(0,kd.default)();function escapeHtml(e){return e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`).replace(/"/g,`&quot;`)}function renderContent(e){return e.split(/\n\n+/).map(e=>`<p>${escapeHtml(e.trim()).replace(/\n/g,`<br />`)}</p>`).join(`
376
376
  `)}function renderPage(e,t){return`<!DOCTYPE html>
377
377
  <html lang="en">
378
378
  <head>
@@ -398,7 +398,7 @@ ${t}
398
398
  </footer>
399
399
  <script src="/app.js" defer><\/script>
400
400
  </body>
401
- </html>`}Od.use(wd.json()),Od.use((e,t,n)=>{let r=new Date().toISOString().slice(11,19);I.log(`[${r}] ${e.method} ${e.url}`),n()}),Od.get(`/api/posts`,(e,t)=>{t.json({count:Td.length,posts:Td.map(({id:e,slug:t,title:n,author:r,date:i,excerpt:a})=>({id:e,slug:t,title:n,author:r,date:i,excerpt:a}))})}),Od.get(`/api/posts/:slug`,(e,t)=>{let n=Td.find(t=>t.slug===e.params.slug);if(!n){t.status(404).json({error:`Post not found`});return}t.json(n)}),Od.get(`/api/runtime`,(e,t)=>{t.json({runtime:za,platform:process.platform,version:process.version,time:new Date().toISOString()})}),Od.get(`/posts/:slug`,(e,t)=>{let n=Td.find(t=>t.slug===e.params.slug);if(!n){t.status(404).send(renderPage(`Post not found`,`
401
+ </html>`}Nd.use(kd.json()),Nd.use((e,t,n)=>{let r=new Date().toISOString().slice(11,19);I.log(`[${r}] ${e.method} ${e.url}`),n()}),Nd.get(`/api/posts`,(e,t)=>{t.json({count:Ad.length,posts:Ad.map(({id:e,slug:t,title:n,author:r,date:i,excerpt:a})=>({id:e,slug:t,title:n,author:r,date:i,excerpt:a}))})}),Nd.get(`/api/posts/:slug`,(e,t)=>{let n=Ad.find(t=>t.slug===e.params.slug);if(!n){t.status(404).json({error:`Post not found`});return}t.json(n)}),Nd.get(`/api/runtime`,(e,t)=>{t.json({runtime:za,platform:process.platform,version:process.version,time:new Date().toISOString()})}),Nd.get(`/posts/:slug`,(e,t)=>{let n=Ad.find(t=>t.slug===e.params.slug);if(!n){t.status(404).send(renderPage(`Post not found`,`
402
402
  <main class="post-detail">
403
403
  <a href="/" class="back-link">← Back to posts</a>
404
404
  <p class="loading">Post not found.</p>
@@ -415,4 +415,4 @@ ${t}
415
415
  ${renderContent(n.content)}
416
416
  </div>
417
417
  </article>
418
- </main>`))}),Od.use(wd.static(Ed)),Od.listen(Dd,()=>{I.log(``),I.log(` Express.js blog running on ${za}`),I.log(``),I.log(` ➜ Local: http://localhost:${Dd}/`),I.log(` ➜ API: http://localhost:${Dd}/api/posts`),I.log(``),I.log(` Press Ctrl+C to stop`),I.log(``)});
418
+ </main>`))}),Nd.use(kd.static(jd)),Nd.listen(Md,()=>{I.log(``),I.log(` Express.js blog running on ${za}`),I.log(``),I.log(` ➜ Local: http://localhost:${Md}/`),I.log(` ➜ API: http://localhost:${Md}/api/posts`),I.log(``),I.log(` Press Ctrl+C to stop`),I.log(``)});