@shgysk8zer0/polyfills 0.6.2 → 0.6.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/node.cjs CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";if(!("AbortSignal"in globalThis)){const e={signal:Symbol("signal"),aborted:Symbol("aborted"),reason:Symbol("reason"),onabort:Symbol("onabort")};globalThis.AbortError=class extends Error{},globalThis.AbortSignal=class t extends EventTarget{constructor(){super(),Object.defineProperties(this,{[e.aborted]:{enumerable:!1,writable:!0,configurable:!1,value:!1},[e.reason]:{enumerable:!1,writable:!0,configurable:!1,value:void 0},[e.onabort]:{enumerable:!1,writable:!0,configurable:!1,value:null}}),this.addEventListener("abort",e=>{this.onabort instanceof Function&&this.onabort.call(this,e)})}get aborted(){return this[e.aborted]}get onabort(){return this[e.onabort]}set onabort(t){this[e.onabort]=t instanceof Function?t:null}get reason(){return this[e.reason]}throwIfAborted(){if(this.aborted)throw this.reason}static abort(r=new DOMException("Operation aborted")){const n=new t;return n[e.aborted]=!0,n[e.reason]=r,n}},globalThis.AbortController=class{constructor(){this[e.signal]=new AbortSignal}get signal(){return this[e.signal]}abort(t=new DOMException("Operation aborted")){const r=this.signal;r.aborted||(r[e.aborted]=!0,r[e.reason]=t,r.dispatchEvent(new Event("abort")))}}}if(!("reason"in AbortSignal.prototype)){const e=new WeakMap,t=AbortController.prototype.abort;if(AbortSignal.abort instanceof Function){const t=AbortSignal.abort;AbortSignal.abort=function(r=new DOMException("Operation aborted")){const n=t();return e.set(n,r),n}}else AbortSignal.abort=function(e=new DOMException("Operation aborted")){const t=new AbortController;return t.abort(e),t.reason};Object.defineProperty(AbortSignal.prototype,"reason",{enumerable:!0,configurable:!0,get:function(){return e.has(this)?e.get(this):void 0}}),AbortController.prototype.abort=function(r=new DOMException("Operation aborted")){e.set(this.signal,r),t.call(this)}}AbortSignal.prototype.throwIfAborted instanceof Function||(AbortSignal.prototype.throwIfAborted=function(){if(this.aborted)throw this.reason}),AbortSignal.timeout instanceof Function||(AbortSignal.timeout=function(e){if(void 0===e)throw new TypeError("At least one 1 argument required but only 0 passed");if(Number.isFinite(e)){if(e<0)throw new TypeError("Argument 1 is out of range for unsigned long long.");{const t=new AbortController;return setTimeout(()=>t.abort(new DOMException("The operation timed out.")),e),t.signal}}throw new TypeError("Argument 1 is not a finite value, so it is out of range for unsigned long long.")}),AbortSignal.any instanceof Function||(AbortSignal.any=function(e){if(!Array.isArray(e))throw new TypeError("Expected an array of signals");const t=new AbortController;for(const r of e){if(!(r instanceof AbortSignal)){const e=new TypeError("`signal` is not an `AbortSignal`");throw t.abort(e),e}if(r.aborted){t.abort(r.reason||new DOMException("Operation aborted."));break}r.addEventListener("abort",({target:e})=>{t.abort(e.reason||new DOMException("Operation aborted."))},{signal:t.signal})}return t.signal});const e=[Array,String,globalThis.Int8Array,globalThis.Uint8Array,globalThis.Uint8ClampedArray,globalThis.Int16Array,globalThis.Uint16Array,globalThis.Int32Array,globalThis.Uint32Array,globalThis.Float32Array,globalThis.Float64Array,globalThis.BigInt64Array,globalThis.BigUint64Array];if(Array.prototype.flat instanceof Function||(Array.prototype.flat=function(e=1){const t=[];e=Math.min(Number.MAX_SAFE_INTEGER,Math.max(0,e));const r=(e,n)=>{Array.isArray(e)&&n>=0?e.forEach(e=>r(e,n-1)):t.push(e)};return r(this,Number.isNaN(e)?0:e),t}),Array.prototype.flatMap instanceof Function||(Array.prototype.flatMap=function(e,t){return this.map(e,t).flat(1)}),Array.prototype.findLast instanceof Function||(Array.prototype.findLast=function(e,t){let r;return this.forEach((n,o,i)=>{e.call(t,n,o,i)&&(r=n)},t),r}),"lastIndex"in Array.prototype||Object.defineProperty(Array.prototype,"lastIndex",{enumerable:!1,configurable:!1,get:function(){return Math.max(0,this.length-1)}}),"lastItem"in Array.prototype||Object.defineProperty(Array.prototype,"lastItem",{enumerable:!1,configurable:!1,get:function(){return this[this.lastIndex]},set:function(e){this[this.lastIndex]=e}}),Array.prototype.findLastIndex instanceof Function||(Array.prototype.findLastIndex=function(e,t){let r=-1;return this.forEach((n,o,i)=>{e.call(t,n,o,i)&&(r=o)},t),r}),!(Array.prototype.at instanceof Function)){const t=function(e){if((e=Math.trunc(e)||0)<0&&(e+=this.length),!(e<0||e>=this.length))return this[e]};for(const r of e)void 0!==r&&Object.defineProperty(r.prototype,"at",{value:t,writable:!0,enumerable:!1,configurable:!0})}function t(e,t,r,{writable:n=!0,enumerable:o=!0,configurable:i=!0}={}){e[t]instanceof Function||Object.defineProperty(e,t,{value:r,writable:n,enumerable:o,configurable:i})}if(!(Array.prototype.group instanceof Function)&&Object.groupBy instanceof Function&&(Array.prototype.group=function(e){return console.warn("`Array.group()` is deprecated. Please use `Object.groupBy()` instead."),Object.groupBy(this,e)}),!(Array.prototype.groupBy instanceof Function)&&Object.groupBy instanceof Function&&(Array.prototype.groupBy=function(e){return console.warn("`Array.goupBy()` is deprecated. Please use `Object.groupBy()` instead."),Object.groupBy(this,e)}),!(Array.prototype.groupToMap instanceof Function)&&Map.groupBy instanceof Function&&(Array.prototype.groupToMap=function(e){return console.warn("`Array.groupToMap()` is deprecated. Please use `Map.groupBy()` instead."),Map.groupBy(this,e)}),Map.groupBy instanceof Function&&(Array.prototype.groupByToMap=function(e){return console.warn("`Array.groupByToMap()` is deprecated. Please use `Map.groupBy()` instead."),Map.groupBy(this,e)}),Array.fromAsync instanceof Function||(Array.fromAsync=async function(e,t,r=globalThis){let n=[];for await(const t of e)n.push(await t);return Array.from(n,t,r)}),Array.prototype.equals instanceof Function||(Array.prototype.equals=function(e){return this===e||!!Array.isArray(e)&&(this.length===e.length&&this.every((t,r)=>{const n=e[r];return Array.isArray(t)?Array.isArray(n)&&t.equals(n):Object.is(t,n)}))}),Array.prototype.uniqueBy instanceof Function||(Array.prototype.uniqueBy=function(e){switch(typeof e){case"undefined":return[...new Set(this)];case"string":case"number":case"symbol":return this.uniqueBy(t=>t[e]);case"function":{const t=new Set;return this.filter((...r)=>{const n=e.apply(this,r);return!t.has(n)&&(t.add(n),!0)})}default:throw new TypeError("Not a valid argument for uniqueBy")}}),Array.prototype.toReversed instanceof Function||(Array.prototype.toReversed=function(){return[...this].reverse()}),Array.prototype.toSorted instanceof Function||(Array.prototype.toSorted=function(e){return[...this].sort(e)}),Array.prototype.toSpliced instanceof Function||(Array.prototype.toSpliced=function(e,t,...r){const n=[...this];return n.splice(e,t,...r),n}),Array.prototype.with instanceof Function||(Array.prototype.with=function(e,t){const r=[...this];return r[e]=t,r}),Array.isTemplateObject instanceof Function||(Array.isTemplateObject=function(e){return!!(Array.isArray(e)&&Array.isArray(e.raw)&&Object.isFrozen(e)&&Object.isFrozen(e.raw))&&(0!==e.length&&e.length===e.raw.length)}),Uint8Array.prototype.toHex instanceof Function||(Uint8Array.prototype.toHex=function(){return Array.from(this,e=>e.toString(16).padStart(2,"0")).join("")}),Uint8Array.prototype.toBase64 instanceof Function||(Uint8Array.prototype.toBase64=function({alphabet:e="base64"}={}){if("base64"===e){const e=32768;let t="";for(let r=0;r<this.length;r+=e){const n=this.subarray(r,r+e);t+=String.fromCharCode.apply(null,n)}return btoa(t)}if("base64url"===e)return this.toBase64({alphabet:"base64"}).replaceAll("+","-").replaceAll("/","_");throw new TypeError('expected alphabet to be either "base64" or "base64url')}),Uint8Array.fromHex instanceof Function||(Uint8Array.fromHex=function(e){if("string"!=typeof e)throw new TypeError("expected input to be a string");if(0===!(1&e.length))throw new SyntaxError("string should be an even number of characters");return Uint8Array.from(globalThis.Iterator.range(0,e.length,{step:2}),t=>parseInt(e.substring(t,t+2),16))}),Uint8Array.fromBase64 instanceof Function||(Uint8Array.fromBase64=function(e,{alphabet:t="base64",lastChunkHandling:r="loose"}={}){if("string"!=typeof e)throw new TypeError("expected input to be a string");if(!["base64","base64url"].includes(t))throw new TypeError('expected alphabet to be either "base64" or "base64url');if(!["loose","strict","stop-before-partial"].includes(r))throw new TypeError(`Invalid \`lastChunkHandling\`: "${r}".`);if("base64"!==t)return Uint8Array.fromBase64(e.replaceAll("-","+").replaceAll("_","/"),{alphabet:"base64"});{const t=e.length%4;if(1===t)throw new TypeError("Invalid string length.");if(0===t)return Uint8Array.from(atob(e),e=>e.charCodeAt(0));switch(r){case"strict":throw new SyntaxError("Missing padding.");case"loose":return Uint8Array.fromBase64(e.padEnd(e.length+(4-t),"="),{alphabet:"base64",lastChunkHandling:"strict"});case"stop-before-partial":return Uint8Array.fromBase64(e.slice(0,e.length-t),{alphabet:"base64",lastChunkHandling:"strict"})}}}),"symbol"!=typeof Symbol.dispose&&(Symbol.dispose=Symbol("Symbol.dispose")),"symbol"!=typeof Symbol.asyncDispose&&(Symbol.asyncDispose=Symbol("Symbol.asyncDispose")),void 0===globalThis.SuppressedError&&(globalThis.SuppressedError=class extends Error{constructor(e,t,r=""){super(r),this.name="SuppressedError",this.error=e,this.suppressed=t}}),void 0===globalThis.AsyncDisposableStack&&(globalThis.AsyncDisposableStack=class e{#e=[];#t=!1;get[Symbol.toStringTag](){return"AsyncDisposableStack"}async[Symbol.asyncDispose](){if(!this.#t){let e;for(this.#t=!0;0!==this.#e.length;){const t=this.#e.pop();await Promise.try(t).catch(t=>{e=void 0===e?t:new SuppressedError(e,t,"An error is suppressed because another error happened while disposing an object")})}if(void 0!==e)throw e}}get disposed(){return this.#t}adopt(e,t){if(this.#t)throw new ReferenceError("AsyncDisposableStack has already been disposed");if("function"!=typeof t)throw new TypeError(`(${t}) is not a function.`);return this.#e.push(()=>t(e)),e}defer(e){if(this.#t)throw new ReferenceError("AsyncDisposableStack has already been disposed");if("function"!=typeof e)throw new TypeError(`${e} is not a function`);this.#e.push(e)}async disposeAsync(){await this[Symbol.asyncDispose]()}move(){if(this.#t)throw new ReferenceError("AsyncDisposableStack has already been disposed");{const t=new e;return t.#e=this.#e,this.#e=[],this.#t=!0,t}}use(e){switch(typeof e){case"function":case"object":if("function"==typeof e?.[Symbol.asyncDispose])return this.#e.push(e[Symbol.asyncDispose].bind(e)),e;if("function"==typeof e?.[Symbol.dispose])return this.#e.push(e[Symbol.dispose].bind(e)),e;if(null===e)return null;throw new TypeError("'Symbol.asyncDispose' property is not callable");case"undefined":break;default:throw new TypeError("Value to be disposed is not an object")}}}),void 0===globalThis.DisposableStack&&(globalThis.DisposableStack=class e{#e=[];#t=!1;get[Symbol.toStringTag](){return"DisposableStack"}[Symbol.dispose](){if(!this.#t){let e;for(this.#t=!0;0!==this.#e.length;){const t=this.#e.pop();try{t()}catch(t){e=void 0===e?t:new SuppressedError(e,t,"An error is suppressed because another error happened while disposing an object")}}if(void 0!==e)throw e}}get disposed(){return this.#t}adopt(e,t){if(this.#t)throw new ReferenceError("DisposableStack has already been disposed");if("function"!=typeof t)throw new TypeError(`(${t}) is not a function.`);return this.#e.push(()=>t(e)),e}defer(e){if(this.#t)throw new ReferenceError("DisposableStack has already been disposed");if("function"!=typeof e)throw new TypeError(`${e} is not a function`);this.#e.push(e)}dispose(){this[Symbol.dispose]()}move(){if(this.#t)throw new ReferenceError("DisposableStack has already been disposed");{const t=new e;return t.#e=this.#e,this.#e=[],this.#t=!0,t}}use(e){switch(typeof e){case"function":case"object":if("function"==typeof e?.[Symbol.dispose])return this.#e.push(e[Symbol.dispose].bind(e)),e;if(null===e)return null;throw new TypeError("'Symbol.dispose' property is not callable");case"undefined":break;default:throw new TypeError("Value to be disposed is not an object")}}}),t(Blob.prototype,"bytes",async function(){return new Uint8Array(await this.arrayBuffer())}),globalThis.hasOwnProperty("AggregateError")||(globalThis.AggregateError=class extends Error{constructor(e,t){void 0===t?(super(e),this.errors=[]):(super(t),this.errors=e)}}),globalThis.reportError instanceof Function||(globalThis.reportError=function(e){globalThis.dispatchEvent(function(e,t="error"){if(e instanceof Error){const{message:r,name:n,fileName:o,lineNumber:i,columnNumber:s}=e;return new ErrorEvent(t,{error:e,message:`${n}: ${r}`,filename:o,lineno:i,colno:s})}throw new TypeError("`errorToEvent()` only accepts Errors")}(e))}),!(Error.isError instanceof Function)){const e=Function.bind.call(Function.call,Object.prototype.toString);Error.isError=function(t){return t instanceof Error||"object"==typeof t&&"[object Error]"===e(t)&&void 0===t[Symbol.toStringTag]}}const r="Iterator"in globalThis,n=r?globalThis.Iterator.prototype:Object.getPrototypeOf(Object.getPrototypeOf([][Symbol.iterator]())),o=r?globalThis.Iterator:(e=>{class t{[Symbol.iterator](){return this}get[Symbol.toStringTag](){return"Iterator"}}return Object.setPrototypeOf(t,e),t})(n);var i;if(o.range instanceof Function||(o.range=function(e,t,r){if("number"==typeof r||"bigint"==typeof r)return o.range(e,t,{step:r});if("object"!=typeof r||Object.is(r,null))return o.range(e,t,{});{const{step:n=("number"==typeof e?e<t?1:-1:e<t?1n:-1n),inclusive:i=!1}=r;if("number"!=typeof e&&"bigint"!=typeof e)throw new TypeError("Start must be a number");if(Number.isNaN(e))throw new RangeError("Invalid start");if("number"!=typeof t&&"bigint"!=typeof t)throw new TypeError("End must be a number");if(Number.isNaN(t))throw new RangeError("Invalid end");if("number"!=typeof n&&"bigint"!=typeof n)throw new TypeError("Step must be a number");if(Number.isNaN(n))throw new RangeError("Invalid step");if(0===n)throw new RangeError("Step must not be 0");if(n<0&&e<t||n>0&&e>t)return;if(i){let r=e;return n>0?o.from({next(){const e=r<=t?{value:r,done:!1}:{done:!0};return r+=n,e}}):o.from({next(){const e=r>=t?{value:r,done:!1}:{done:!0};return r+=n,e}})}{let r=e;if(n>0)return o.from({next(){const e=r<t?{value:r,done:!1}:{done:!0};return r+=n,e}});{let r=e;return o.from({next(){const e=r>t?{value:r,done:!1}:{done:!0};return r+=n,e}})}}}}),n[Symbol.toStringTag]||(n[Symbol.toStringTag]="Iterator"),n.take instanceof Function||(n.take=function(e){let t=0;const r=this;return o.from({next:()=>t++>=e?{done:!0}:r.next()})}),n.drop instanceof Function||(n.drop=function(e){for(let t=0;t<e;t++){const{done:e}=this.next();if(e)break}return this}),n.toArray instanceof Function||(n.toArray=function(){return Array.from(this)}),n.forEach instanceof Function||(n.forEach=function(e){for(const t of this)e.call(this,t)}),n.flatMap instanceof Function||(n.flatMap=function(e){const t=this;let r=this.next();const n=({value:r,done:n=!0}={})=>n?o.from({next:()=>({done:!0})}):o.from(e.call(t,r));let i=n(r);return o.from({next(){const{value:e,done:o=!0}=i.next();return r.done&&o?{done:!0}:o?r.done?{done:!0}:(r=t.next(),i=n(r),i.next()):{value:e,done:o}}})}),n.map instanceof Function||(n.map=function(e){const t=this;return o.from({next(){const{done:r,value:n}=t.next();return r?{done:r}:{value:e.call(t,n),done:!1}}})}),n.reduce instanceof Function||(n.reduce=function(e,t){let r=void 0===t?this.next().value:t;for(const t of this)r=e.call(this,r,t);return r}),n.filter instanceof Function||(n.filter=function(e){const t=this;let r,n=!1;return o.from({next(){for(;!n;){const o=t.next();if(n=o.done,n)break;if(e.call(t,o.value)){r=o.value;break}}return{done:n,value:r}}})}),n.some instanceof Function||(n.some=function(e){let t=!1;for(const r of this)if(e.call(this,r)){t=!0;break}return t}),n.every instanceof Function||(n.every=function(e){let t=!0;for(const r of this)if(!e.call(this,r)){t=!1;break}return t}),n.find instanceof Function||(n.find=function(e){for(const t of this)if(e.call(this,t))return t}),n.indexed instanceof Function||(n.indexed=function(){let e=0;return this.map(t=>[e++,t])}),n.chunks instanceof Function||(n.chunks=function(e){if(!Number.isSafeInteger(e)||e<1)throw new TypeError("Size must be a positive integer.");{const t=this;let r=!1;return o.from({next(){if(r)return{done:r};{const n=[];let o=0;for(;o++<e&&!r;){const e=t.next();if(e.done){r=!0,void 0!==e.value&&n.push(e.value);break}n.push(e.value)}return{value:n,done:!1}}}})}}),o.from instanceof Function||(o.from=function(e){if("object"!=typeof e||null===e)throw new TypeError("Not an object.");if(e.next instanceof Function){return Object.create(n,{next:{enumerable:!0,configurable:!1,writable:!1,value:(...t)=>e.next(...t)}})}if(e[Symbol.iterator]instanceof Function)return o.from(e[Symbol.iterator]())}),r||(globalThis.Iterator=o),t(ReadableStream,"from",function(e){if(e[Symbol.iterator]instanceof Function)return new ReadableStream({start(t){try{for(const r of e)t.enqueue(r)}catch(e){t.error(e)}finally{t.close()}}});if(e[Symbol.asyncIterator]instanceof Function)return new ReadableStream({async start(t){try{for await(const r of e)t.enqueue(r)}catch(e){t.error(e)}finally{t.close()}}});throw new TypeError("`ReadableStream.from()` requires an iterable source.")}),Map.prototype.getOrInsert instanceof Function||(Map.prototype.getOrInsert=function(e,t){return this.has(e)?this.get(e):(this.set(e,t),t)},Map.prototype.getOrInsertComputed=function(e,t){if(this.has(e))return this.get(e);{const r=t.call(this,e);return this.set(e,r),r}}),WeakMap.prototype.getOrInsert instanceof Function||(WeakMap.prototype.getOrInsert=function(e,t){return Map.prototype.getOrInsert.call(this,e,t)},WeakMap.prototype.getOrInsertComputed=function(e,t){return WeakMap.prototype.getOrInsertComputed.call(this,e,t)}),Map.groupBy instanceof Function||(Map.groupBy=function(e,t){return Array.from(e).reduce((e,r,n)=>(e.emplace(t.call(e,r,n),{insert:()=>[r],update:e=>(e.push(r),e)}),e),new Map)}),Map.prototype.emplace instanceof Function||(Map.prototype.emplace=function(e,{insert:t,update:r}={}){console.warn("`Map.prototype.emplace()` has been removed from the proposal and will be removed in the future.");const n=this.has(e);if(n&&r instanceof Function){const t=this.get(e),n=r.call(this,t,e,this);return n!==t&&this.set(e,n),n}if(n)return this.get(e);if(t instanceof Function){const r=t.call(this,e,this);return this.set(e,r),r}throw new Error("Key is not found and no `insert()` given")}),Number.hasOwnProperty("isSafeInteger")||(Number.MAX_SAFE_INTEGER=2**53-1,Number.MIN_SAFE_INTEGER=-Number.MAX_SAFE_INTEGER,Number.isSafeInteger=e=>e<=Number.MAX_SAFE_INTEGER&&e>=Number.MIN_SAFE_INTEGER),Number.hasOwnProperty("EPSILON")||(Number.EPSILON=2**-52),Math.hasOwnProperty("sign")||(Math.sign=e=>(e>0)-(e<0)||+e),Math.hasOwnProperty("trunc")||(Math.trunc=e=>{const t=e-e%1;return 0===t&&(e<0||0===e&&1/e!=1/0)?-0:t}),Math.hasOwnProperty("expm1")||(Math.expm1=e=>Math.exp(e)-1),Math.hasOwnProperty("hypot")||(Math.hypot=(...e)=>Math.sqrt(e.reduce((e,t)=>e+t**2,0))),Math.hasOwnProperty("cbrt")||(Math.cbrt=e=>e**(1/3)),Math.hasOwnProperty("log10")||(Math.log10=e=>Math.log(e)*Math.LOG10E),Math.hasOwnProperty("log2")||(Math.log2=e=>Math.log(e)*Math.LOG2E),Math.hasOwnProperty("log1p")||(Math.log1p=e=>Math.log(1+e)),Math.hasOwnProperty("fround")||(Math.fround=(i=new Float32Array(1),function(e){return i[0]=e,i[0]})),Math.clamp instanceof Function||(Math.clamp=function(e,t,r){return Math.min(Math.max(e,t),r)}),Math.constrain instanceof Function||(Math.constrain=Math.clamp),Math.sumPrecise instanceof Function||(Math.sumPrecise=function(e){let t=-0;for(const r of e){if(!Number.isFinite(r)){t=-0;break}t+=r}return t}),Math.sum instanceof Function||(Math.sum=function(...e){return console.warn("Math.sum is deprecated. Please use Math.sumPrecise instead."),Math.sumPrecise(e)}),Object.groupBy instanceof Function||(Object.groupBy=function(e,t){return Array.from(e).reduce((e,r,n)=>{const o=t.call(e,r,n);return e.hasOwnProperty(o)?e[o].push(r):e[o]=[r],e},{})}),function(){if(!(globalThis.requestIdleCallback instanceof Function)){const e=e=>Number.isSafeInteger(e)&&e>0;globalThis.requestIdleCallback=function(t,{timeout:r}={}){const n=performance.now(),o=()=>e(r)?Math.max(0,r-(performance.now()-n)):Math.max(0,600-(performance.now()-n));return setTimeout(()=>t({didTimeout:!!e(r)&&0===o(),timeRemaining:o}),1)}}globalThis.cancelIdleCallback instanceof Function||(globalThis.cancelIdleCallback=e=>clearTimeout(e)),globalThis.requestAnimationFrame instanceof Function||(globalThis.requestAnimationFrame=e=>setTimeout(()=>e(performance.now()),1e3/60)),globalThis.cancelAnimationFrame instanceof Function||(globalThis.cancelAnimationFrame=e=>clearTimeout(e)),globalThis.queueMicrotask instanceof Function||(globalThis.queueMicrotask=e=>Promise.resolve().then(e).catch(e=>setTimeout(()=>{throw e})))}(),"Promise"in globalThis&&(Promise.prototype.finally instanceof Function||(Promise.prototype.finally=function(e){return this.then(async t=>(await e(),t),async t=>(await e(),t))}),Promise.allSettled instanceof Function||(Promise.allSettled=function(e){return Promise.all(Array.from(e).map(function(e){return new Promise(function(t){e instanceof Promise||(e=Promise.resolve(e)),e.then(function(e){t({status:"fulfilled",value:e})}).catch(function(e){t({status:"rejected",reason:e})})})}))}),Promise.any instanceof Function||(Promise.any=e=>new Promise((t,r)=>{let n=[];e.forEach(o=>{o.then(t).catch(t=>{n.push(t),n.length===e.length&&r(new globalThis.AggregateError(n,"No Promise in Promise.any was resolved"))})})})),Promise.race instanceof Function||(Promise.race=e=>new Promise((t,r)=>{e.forEach(e=>e.then(t,r))})),Promise.try instanceof Function||(Promise.try=(e,...t)=>new Promise(r=>r(e(...t)))),Promise.withResolvers instanceof Function||(Promise.withResolvers=function(){const e={};return e.promise=new Promise((t,r)=>{e.resolve=t,e.reject=r}),e}),Promise.fromEntries instanceof Function||(Promise.fromEntries=async function(e){const t=[],r=[];for(const[n,o]of e)t.push(n),r.push(o);return await Promise.all(r).then(e=>Object.fromEntries(e.map((e,r)=>[t[r],e])))}),Promise.ownProperties instanceof Function||(Promise.ownProperties=async function(e){return await Promise.fromEntries(Object.entries(e))})),!(RegExp.escape instanceof Function)){const e=/[-[\]/{}()<>=#&!@%*+?.\\^$|;:"'`\s]/g;RegExp.escape=function(t){return t.toString().replace(e,"\\$&")}}t(Request.prototype,"bytes",async function(){return new Uint8Array(await this.arrayBuffer())}),t(Response,"json",(e,{status:t=200,statusText:r="",headers:n=new Headers}={})=>n instanceof Headers?(n.set("Content-Type","application/json"),new Response(JSON.stringify(e),{status:t,statusText:r,headers:n})):Response.json(e,{status:t,statusText:r,headers:new Headers(n)})),t(Response,"redirect",(e,t=302)=>new Response(null,{status:t,headers:new Headers({Location:e})})),t(Response.prototype,"bytes",async function(){return new Uint8Array(await this.arrayBuffer())});
1
+ "use strict";if(!("AbortSignal"in globalThis)){const e={signal:Symbol("signal"),aborted:Symbol("aborted"),reason:Symbol("reason"),onabort:Symbol("onabort")};globalThis.AbortError=class extends Error{},globalThis.AbortSignal=class t extends EventTarget{constructor(){super(),Object.defineProperties(this,{[e.aborted]:{enumerable:!1,writable:!0,configurable:!1,value:!1},[e.reason]:{enumerable:!1,writable:!0,configurable:!1,value:void 0},[e.onabort]:{enumerable:!1,writable:!0,configurable:!1,value:null}}),this.addEventListener("abort",e=>{this.onabort instanceof Function&&this.onabort.call(this,e)})}get aborted(){return this[e.aborted]}get onabort(){return this[e.onabort]}set onabort(t){this[e.onabort]=t instanceof Function?t:null}get reason(){return this[e.reason]}throwIfAborted(){if(this.aborted)throw this.reason}static abort(r=new DOMException("Operation aborted")){const n=new t;return n[e.aborted]=!0,n[e.reason]=r,n}},globalThis.AbortController=class{constructor(){this[e.signal]=new AbortSignal}get signal(){return this[e.signal]}abort(t=new DOMException("Operation aborted")){const r=this.signal;r.aborted||(r[e.aborted]=!0,r[e.reason]=t,r.dispatchEvent(new Event("abort")))}}}if(!("reason"in AbortSignal.prototype)){const e=new WeakMap,t=AbortController.prototype.abort;if(AbortSignal.abort instanceof Function){const t=AbortSignal.abort;AbortSignal.abort=function(r=new DOMException("Operation aborted")){const n=t();return e.set(n,r),n}}else AbortSignal.abort=function(e=new DOMException("Operation aborted")){const t=new AbortController;return t.abort(e),t.reason};Object.defineProperty(AbortSignal.prototype,"reason",{enumerable:!0,configurable:!0,get:function(){return e.has(this)?e.get(this):void 0}}),AbortController.prototype.abort=function(r=new DOMException("Operation aborted")){e.set(this.signal,r),t.call(this)}}AbortSignal.prototype.throwIfAborted instanceof Function||(AbortSignal.prototype.throwIfAborted=function(){if(this.aborted)throw this.reason}),AbortSignal.timeout instanceof Function||(AbortSignal.timeout=function(e){if(void 0===e)throw new TypeError("At least one 1 argument required but only 0 passed");if(Number.isFinite(e)){if(e<0)throw new TypeError("Argument 1 is out of range for unsigned long long.");{const t=new AbortController;return setTimeout(()=>t.abort(new DOMException("The operation timed out.")),e),t.signal}}throw new TypeError("Argument 1 is not a finite value, so it is out of range for unsigned long long.")}),AbortSignal.any instanceof Function||(AbortSignal.any=function(e){if(!Array.isArray(e))throw new TypeError("Expected an array of signals");const t=new AbortController;for(const r of e){if(!(r instanceof AbortSignal)){const e=new TypeError("`signal` is not an `AbortSignal`");throw t.abort(e),e}if(r.aborted){t.abort(r.reason||new DOMException("Operation aborted."));break}r.addEventListener("abort",({target:e})=>{t.abort(e.reason||new DOMException("Operation aborted."))},{signal:t.signal})}return t.signal});const e=[Array,String,globalThis.Int8Array,globalThis.Uint8Array,globalThis.Uint8ClampedArray,globalThis.Int16Array,globalThis.Uint16Array,globalThis.Int32Array,globalThis.Uint32Array,globalThis.Float32Array,globalThis.Float64Array,globalThis.BigInt64Array,globalThis.BigUint64Array];if(Array.prototype.flat instanceof Function||(Array.prototype.flat=function(e=1){const t=[];e=Math.min(Number.MAX_SAFE_INTEGER,Math.max(0,e));const r=(e,n)=>{Array.isArray(e)&&n>=0?e.forEach(e=>r(e,n-1)):t.push(e)};return r(this,Number.isNaN(e)?0:e),t}),Array.prototype.flatMap instanceof Function||(Array.prototype.flatMap=function(e,t){return this.map(e,t).flat(1)}),Array.prototype.findLast instanceof Function||(Array.prototype.findLast=function(e,t){let r;return this.forEach((n,o,i)=>{e.call(t,n,o,i)&&(r=n)},t),r}),"lastIndex"in Array.prototype||Object.defineProperty(Array.prototype,"lastIndex",{enumerable:!1,configurable:!1,get:function(){return Math.max(0,this.length-1)}}),"lastItem"in Array.prototype||Object.defineProperty(Array.prototype,"lastItem",{enumerable:!1,configurable:!1,get:function(){return this[this.lastIndex]},set:function(e){this[this.lastIndex]=e}}),Array.prototype.findLastIndex instanceof Function||(Array.prototype.findLastIndex=function(e,t){let r=-1;return this.forEach((n,o,i)=>{e.call(t,n,o,i)&&(r=o)},t),r}),!(Array.prototype.at instanceof Function)){const t=function(e){if((e=Math.trunc(e)||0)<0&&(e+=this.length),!(e<0||e>=this.length))return this[e]};for(const r of e)void 0!==r&&Object.defineProperty(r.prototype,"at",{value:t,writable:!0,enumerable:!1,configurable:!0})}function t(e,t,r,{writable:n=!0,enumerable:o=!0,configurable:i=!0}={}){e[t]instanceof Function||Object.defineProperty(e,t,{value:r,writable:n,enumerable:o,configurable:i})}if(!(Array.prototype.group instanceof Function)&&Object.groupBy instanceof Function&&(Array.prototype.group=function(e){return console.warn("`Array.group()` is deprecated. Please use `Object.groupBy()` instead."),Object.groupBy(this,e)}),!(Array.prototype.groupBy instanceof Function)&&Object.groupBy instanceof Function&&(Array.prototype.groupBy=function(e){return console.warn("`Array.goupBy()` is deprecated. Please use `Object.groupBy()` instead."),Object.groupBy(this,e)}),!(Array.prototype.groupToMap instanceof Function)&&Map.groupBy instanceof Function&&(Array.prototype.groupToMap=function(e){return console.warn("`Array.groupToMap()` is deprecated. Please use `Map.groupBy()` instead."),Map.groupBy(this,e)}),Map.groupBy instanceof Function&&(Array.prototype.groupByToMap=function(e){return console.warn("`Array.groupByToMap()` is deprecated. Please use `Map.groupBy()` instead."),Map.groupBy(this,e)}),Array.fromAsync instanceof Function||(Array.fromAsync=async function(e,t,r=globalThis){let n=[];for await(const t of e)n.push(await t);return Array.from(n,t,r)}),Array.prototype.equals instanceof Function||(Array.prototype.equals=function(e){return this===e||!!Array.isArray(e)&&(this.length===e.length&&this.every((t,r)=>{const n=e[r];return Array.isArray(t)?Array.isArray(n)&&t.equals(n):Object.is(t,n)}))}),Array.prototype.uniqueBy instanceof Function||(Array.prototype.uniqueBy=function(e){switch(typeof e){case"undefined":return[...new Set(this)];case"string":case"number":case"symbol":return this.uniqueBy(t=>t[e]);case"function":{const t=new Set;return this.filter((...r)=>{const n=e.apply(this,r);return!t.has(n)&&(t.add(n),!0)})}default:throw new TypeError("Not a valid argument for uniqueBy")}}),Array.prototype.toReversed instanceof Function||(Array.prototype.toReversed=function(){return[...this].reverse()}),Array.prototype.toSorted instanceof Function||(Array.prototype.toSorted=function(e){return[...this].sort(e)}),Array.prototype.toSpliced instanceof Function||(Array.prototype.toSpliced=function(e,t,...r){const n=[...this];return n.splice(e,t,...r),n}),Array.prototype.with instanceof Function||(Array.prototype.with=function(e,t){const r=[...this];return r[e]=t,r}),Array.isTemplateObject instanceof Function||(Array.isTemplateObject=function(e){return!!(Array.isArray(e)&&Array.isArray(e.raw)&&Object.isFrozen(e)&&Object.isFrozen(e.raw))&&(0!==e.length&&e.length===e.raw.length)}),Uint8Array.prototype.toHex instanceof Function||(Uint8Array.prototype.toHex=function(){return Array.from(this,e=>e.toString(16).padStart(2,"0")).join("")}),Uint8Array.prototype.toBase64 instanceof Function||(Uint8Array.prototype.toBase64=function({alphabet:e="base64",omitPadding:t=!1}={}){if("base64"===e){const e=32768;let r="";for(let t=0;t<this.length;t+=e){const n=this.subarray(t,t+e);r+=String.fromCharCode.apply(null,n)}return t?btoa(r).replace(/=+$/,""):btoa(r)}if("base64url"===e)return this.toBase64({alphabet:"base64",omitPadding:t}).replaceAll("+","-").replaceAll("/","_");throw new TypeError('expected alphabet to be either "base64" or "base64url')}),Uint8Array.fromHex instanceof Function||(Uint8Array.fromHex=function(e){if("string"!=typeof e)throw new TypeError("expected input to be a string");if(0===!(1&e.length))throw new SyntaxError("string should be an even number of characters");return Uint8Array.from(globalThis.Iterator.range(0,e.length,{step:2}),t=>parseInt(e.substring(t,t+2),16))}),Uint8Array.fromBase64 instanceof Function||(Uint8Array.fromBase64=function(e,{alphabet:t="base64",lastChunkHandling:r="loose"}={}){if("string"!=typeof e)throw new TypeError("expected input to be a string");if(!["base64","base64url"].includes(t))throw new TypeError('expected alphabet to be either "base64" or "base64url');if(!["loose","strict","stop-before-partial"].includes(r))throw new TypeError(`Invalid \`lastChunkHandling\`: "${r}".`);if("base64"!==t)return Uint8Array.fromBase64(e.replaceAll("-","+").replaceAll("_","/"),{alphabet:"base64"});{const t=e.length%4;if(1===t)throw new TypeError("Invalid string length.");if(0===t)return Uint8Array.from(atob(e),e=>e.charCodeAt(0));switch(r){case"strict":throw new SyntaxError("Missing padding.");case"loose":return Uint8Array.fromBase64(e.padEnd(e.length+(4-t),"="),{alphabet:"base64",lastChunkHandling:"strict"});case"stop-before-partial":return Uint8Array.fromBase64(e.slice(0,e.length-t),{alphabet:"base64",lastChunkHandling:"strict"})}}}),"symbol"!=typeof Symbol.dispose&&(Symbol.dispose=Symbol("Symbol.dispose")),"symbol"!=typeof Symbol.asyncDispose&&(Symbol.asyncDispose=Symbol("Symbol.asyncDispose")),void 0===globalThis.SuppressedError&&(globalThis.SuppressedError=class extends Error{constructor(e,t,r=""){super(r),this.name="SuppressedError",this.error=e,this.suppressed=t}}),void 0===globalThis.AsyncDisposableStack&&(globalThis.AsyncDisposableStack=class e{#e=[];#t=!1;get[Symbol.toStringTag](){return"AsyncDisposableStack"}async[Symbol.asyncDispose](){if(!this.#t){let e;for(this.#t=!0;0!==this.#e.length;){const t=this.#e.pop();await Promise.try(t).catch(t=>{e=void 0===e?t:new SuppressedError(e,t,"An error is suppressed because another error happened while disposing an object")})}if(void 0!==e)throw e}}get disposed(){return this.#t}adopt(e,t){if(this.#t)throw new ReferenceError("AsyncDisposableStack has already been disposed");if("function"!=typeof t)throw new TypeError(`(${t}) is not a function.`);return this.#e.push(()=>t(e)),e}defer(e){if(this.#t)throw new ReferenceError("AsyncDisposableStack has already been disposed");if("function"!=typeof e)throw new TypeError(`${e} is not a function`);this.#e.push(e)}async disposeAsync(){await this[Symbol.asyncDispose]()}move(){if(this.#t)throw new ReferenceError("AsyncDisposableStack has already been disposed");{const t=new e;return t.#e=this.#e,this.#e=[],this.#t=!0,t}}use(e){switch(typeof e){case"function":case"object":if("function"==typeof e?.[Symbol.asyncDispose])return this.#e.push(e[Symbol.asyncDispose].bind(e)),e;if("function"==typeof e?.[Symbol.dispose])return this.#e.push(e[Symbol.dispose].bind(e)),e;if(null===e)return null;throw new TypeError("'Symbol.asyncDispose' property is not callable");case"undefined":break;default:throw new TypeError("Value to be disposed is not an object")}}}),void 0===globalThis.DisposableStack&&(globalThis.DisposableStack=class e{#e=[];#t=!1;get[Symbol.toStringTag](){return"DisposableStack"}[Symbol.dispose](){if(!this.#t){let e;for(this.#t=!0;0!==this.#e.length;){const t=this.#e.pop();try{t()}catch(t){e=void 0===e?t:new SuppressedError(e,t,"An error is suppressed because another error happened while disposing an object")}}if(void 0!==e)throw e}}get disposed(){return this.#t}adopt(e,t){if(this.#t)throw new ReferenceError("DisposableStack has already been disposed");if("function"!=typeof t)throw new TypeError(`(${t}) is not a function.`);return this.#e.push(()=>t(e)),e}defer(e){if(this.#t)throw new ReferenceError("DisposableStack has already been disposed");if("function"!=typeof e)throw new TypeError(`${e} is not a function`);this.#e.push(e)}dispose(){this[Symbol.dispose]()}move(){if(this.#t)throw new ReferenceError("DisposableStack has already been disposed");{const t=new e;return t.#e=this.#e,this.#e=[],this.#t=!0,t}}use(e){switch(typeof e){case"function":case"object":if("function"==typeof e?.[Symbol.dispose])return this.#e.push(e[Symbol.dispose].bind(e)),e;if(null===e)return null;throw new TypeError("'Symbol.dispose' property is not callable");case"undefined":break;default:throw new TypeError("Value to be disposed is not an object")}}}),t(Blob.prototype,"bytes",async function(){return new Uint8Array(await this.arrayBuffer())}),globalThis.hasOwnProperty("AggregateError")||(globalThis.AggregateError=class extends Error{constructor(e,t){void 0===t?(super(e),this.errors=[]):(super(t),this.errors=e)}}),globalThis.reportError instanceof Function||(globalThis.reportError=function(e){globalThis.dispatchEvent(function(e,t="error"){if(e instanceof Error){const{message:r,name:n,fileName:o,lineNumber:i,columnNumber:s}=e;return new ErrorEvent(t,{error:e,message:`${n}: ${r}`,filename:o,lineno:i,colno:s})}throw new TypeError("`errorToEvent()` only accepts Errors")}(e))}),!(Error.isError instanceof Function)){const e=Function.bind.call(Function.call,Object.prototype.toString);Error.isError=function(t){return t instanceof Error||"object"==typeof t&&"[object Error]"===e(t)&&void 0===t[Symbol.toStringTag]}}const r="Iterator"in globalThis,n=r?globalThis.Iterator.prototype:Object.getPrototypeOf(Object.getPrototypeOf([][Symbol.iterator]())),o=r?globalThis.Iterator:(e=>{class t{[Symbol.iterator](){return this}get[Symbol.toStringTag](){return"Iterator"}}return Object.setPrototypeOf(t,e),t})(n);var i;if(o.range instanceof Function||(o.range=function(e,t,r){if("number"==typeof r||"bigint"==typeof r)return o.range(e,t,{step:r});if("object"!=typeof r||Object.is(r,null))return o.range(e,t,{});{const{step:n=("number"==typeof e?e<t?1:-1:e<t?1n:-1n),inclusive:i=!1}=r;if("number"!=typeof e&&"bigint"!=typeof e)throw new TypeError("Start must be a number");if(Number.isNaN(e))throw new RangeError("Invalid start");if("number"!=typeof t&&"bigint"!=typeof t)throw new TypeError("End must be a number");if(Number.isNaN(t))throw new RangeError("Invalid end");if("number"!=typeof n&&"bigint"!=typeof n)throw new TypeError("Step must be a number");if(Number.isNaN(n))throw new RangeError("Invalid step");if(0===n)throw new RangeError("Step must not be 0");if(n<0&&e<t||n>0&&e>t)return;if(i){let r=e;return n>0?o.from({next(){const e=r<=t?{value:r,done:!1}:{done:!0};return r+=n,e}}):o.from({next(){const e=r>=t?{value:r,done:!1}:{done:!0};return r+=n,e}})}{let r=e;if(n>0)return o.from({next(){const e=r<t?{value:r,done:!1}:{done:!0};return r+=n,e}});{let r=e;return o.from({next(){const e=r>t?{value:r,done:!1}:{done:!0};return r+=n,e}})}}}}),n[Symbol.toStringTag]||(n[Symbol.toStringTag]="Iterator"),n.take instanceof Function||(n.take=function(e){let t=0;const r=this;return o.from({next:()=>t++>=e?{done:!0}:r.next()})}),n.drop instanceof Function||(n.drop=function(e){for(let t=0;t<e;t++){const{done:e}=this.next();if(e)break}return this}),n.toArray instanceof Function||(n.toArray=function(){return Array.from(this)}),n.forEach instanceof Function||(n.forEach=function(e){for(const t of this)e.call(this,t)}),n.flatMap instanceof Function||(n.flatMap=function(e){const t=this;let r=this.next();const n=({value:r,done:n=!0}={})=>n?o.from({next:()=>({done:!0})}):o.from(e.call(t,r));let i=n(r);return o.from({next(){const{value:e,done:o=!0}=i.next();return r.done&&o?{done:!0}:o?r.done?{done:!0}:(r=t.next(),i=n(r),i.next()):{value:e,done:o}}})}),n.map instanceof Function||(n.map=function(e){const t=this;return o.from({next(){const{done:r,value:n}=t.next();return r?{done:r}:{value:e.call(t,n),done:!1}}})}),n.reduce instanceof Function||(n.reduce=function(e,t){let r=void 0===t?this.next().value:t;for(const t of this)r=e.call(this,r,t);return r}),n.filter instanceof Function||(n.filter=function(e){const t=this;let r,n=!1;return o.from({next(){for(;!n;){const o=t.next();if(n=o.done,n)break;if(e.call(t,o.value)){r=o.value;break}}return{done:n,value:r}}})}),n.some instanceof Function||(n.some=function(e){let t=!1;for(const r of this)if(e.call(this,r)){t=!0;break}return t}),n.every instanceof Function||(n.every=function(e){let t=!0;for(const r of this)if(!e.call(this,r)){t=!1;break}return t}),n.find instanceof Function||(n.find=function(e){for(const t of this)if(e.call(this,t))return t}),n.indexed instanceof Function||(n.indexed=function(){let e=0;return this.map(t=>[e++,t])}),n.chunks instanceof Function||(n.chunks=function(e){if(!Number.isSafeInteger(e)||e<1)throw new TypeError("Size must be a positive integer.");{const t=this;let r=!1;return o.from({next(){if(r)return{done:r};{const n=[];let o=0;for(;o++<e&&!r;){const e=t.next();if(e.done){r=!0,void 0!==e.value&&n.push(e.value);break}n.push(e.value)}return{value:n,done:!1}}}})}}),o.from instanceof Function||(o.from=function(e){if("object"!=typeof e||null===e)throw new TypeError("Not an object.");if(e.next instanceof Function){return Object.create(n,{next:{enumerable:!0,configurable:!1,writable:!1,value:(...t)=>e.next(...t)}})}if(e[Symbol.iterator]instanceof Function)return o.from(e[Symbol.iterator]())}),r||(globalThis.Iterator=o),t(ReadableStream,"from",function(e){if(e[Symbol.iterator]instanceof Function)return new ReadableStream({start(t){try{for(const r of e)t.enqueue(r)}catch(e){t.error(e)}finally{t.close()}}});if(e[Symbol.asyncIterator]instanceof Function)return new ReadableStream({async start(t){try{for await(const r of e)t.enqueue(r)}catch(e){t.error(e)}finally{t.close()}}});throw new TypeError("`ReadableStream.from()` requires an iterable source.")}),Map.prototype.getOrInsert instanceof Function||(Map.prototype.getOrInsert=function(e,t){return this.has(e)?this.get(e):(this.set(e,t),t)},Map.prototype.getOrInsertComputed=function(e,t){if(this.has(e))return this.get(e);{const r=t.call(this,e);return this.set(e,r),r}}),WeakMap.prototype.getOrInsert instanceof Function||(WeakMap.prototype.getOrInsert=function(e,t){return Map.prototype.getOrInsert.call(this,e,t)},WeakMap.prototype.getOrInsertComputed=function(e,t){return WeakMap.prototype.getOrInsertComputed.call(this,e,t)}),Map.groupBy instanceof Function||(Map.groupBy=function(e,t){return Array.from(e).reduce((e,r,n)=>(e.emplace(t.call(e,r,n),{insert:()=>[r],update:e=>(e.push(r),e)}),e),new Map)}),Map.prototype.emplace instanceof Function||(Map.prototype.emplace=function(e,{insert:t,update:r}={}){console.warn("`Map.prototype.emplace()` has been removed from the proposal and will be removed in the future.");const n=this.has(e);if(n&&r instanceof Function){const t=this.get(e),n=r.call(this,t,e,this);return n!==t&&this.set(e,n),n}if(n)return this.get(e);if(t instanceof Function){const r=t.call(this,e,this);return this.set(e,r),r}throw new Error("Key is not found and no `insert()` given")}),Number.hasOwnProperty("isSafeInteger")||(Number.MAX_SAFE_INTEGER=2**53-1,Number.MIN_SAFE_INTEGER=-Number.MAX_SAFE_INTEGER,Number.isSafeInteger=e=>e<=Number.MAX_SAFE_INTEGER&&e>=Number.MIN_SAFE_INTEGER),Number.hasOwnProperty("EPSILON")||(Number.EPSILON=2**-52),Math.hasOwnProperty("sign")||(Math.sign=e=>(e>0)-(e<0)||+e),Math.hasOwnProperty("trunc")||(Math.trunc=e=>{const t=e-e%1;return 0===t&&(e<0||0===e&&1/e!=1/0)?-0:t}),Math.hasOwnProperty("expm1")||(Math.expm1=e=>Math.exp(e)-1),Math.hasOwnProperty("hypot")||(Math.hypot=(...e)=>Math.sqrt(e.reduce((e,t)=>e+t**2,0))),Math.hasOwnProperty("cbrt")||(Math.cbrt=e=>e**(1/3)),Math.hasOwnProperty("log10")||(Math.log10=e=>Math.log(e)*Math.LOG10E),Math.hasOwnProperty("log2")||(Math.log2=e=>Math.log(e)*Math.LOG2E),Math.hasOwnProperty("log1p")||(Math.log1p=e=>Math.log(1+e)),Math.hasOwnProperty("fround")||(Math.fround=(i=new Float32Array(1),function(e){return i[0]=e,i[0]})),Math.clamp instanceof Function||(Math.clamp=function(e,t,r){return Math.min(Math.max(e,t),r)}),Math.constrain instanceof Function||(Math.constrain=Math.clamp),Math.sumPrecise instanceof Function||(Math.sumPrecise=function(e){let t=-0;for(const r of e){if(!Number.isFinite(r)){t=-0;break}t+=r}return t}),Math.sum instanceof Function||(Math.sum=function(...e){return console.warn("Math.sum is deprecated. Please use Math.sumPrecise instead."),Math.sumPrecise(e)}),Object.groupBy instanceof Function||(Object.groupBy=function(e,t){return Array.from(e).reduce((e,r,n)=>{const o=t.call(e,r,n);return e.hasOwnProperty(o)?e[o].push(r):e[o]=[r],e},{})}),function(){if(!(globalThis.requestIdleCallback instanceof Function)){const e=e=>Number.isSafeInteger(e)&&e>0;globalThis.requestIdleCallback=function(t,{timeout:r}={}){const n=performance.now(),o=()=>e(r)?Math.max(0,r-(performance.now()-n)):Math.max(0,600-(performance.now()-n));return setTimeout(()=>t({didTimeout:!!e(r)&&0===o(),timeRemaining:o}),1)}}globalThis.cancelIdleCallback instanceof Function||(globalThis.cancelIdleCallback=e=>clearTimeout(e)),globalThis.requestAnimationFrame instanceof Function||(globalThis.requestAnimationFrame=e=>setTimeout(()=>e(performance.now()),1e3/60)),globalThis.cancelAnimationFrame instanceof Function||(globalThis.cancelAnimationFrame=e=>clearTimeout(e)),globalThis.queueMicrotask instanceof Function||(globalThis.queueMicrotask=e=>Promise.resolve().then(e).catch(e=>setTimeout(()=>{throw e})))}(),"Promise"in globalThis&&(Promise.prototype.finally instanceof Function||(Promise.prototype.finally=function(e){return this.then(async t=>(await e(),t),async t=>(await e(),t))}),Promise.allSettled instanceof Function||(Promise.allSettled=function(e){return Promise.all(Array.from(e).map(function(e){return new Promise(function(t){e instanceof Promise||(e=Promise.resolve(e)),e.then(function(e){t({status:"fulfilled",value:e})}).catch(function(e){t({status:"rejected",reason:e})})})}))}),Promise.any instanceof Function||(Promise.any=e=>new Promise((t,r)=>{let n=[];e.forEach(o=>{o.then(t).catch(t=>{n.push(t),n.length===e.length&&r(new globalThis.AggregateError(n,"No Promise in Promise.any was resolved"))})})})),Promise.race instanceof Function||(Promise.race=e=>new Promise((t,r)=>{e.forEach(e=>e.then(t,r))})),Promise.try instanceof Function||(Promise.try=(e,...t)=>new Promise(r=>r(e(...t)))),Promise.withResolvers instanceof Function||(Promise.withResolvers=function(){const e={};return e.promise=new Promise((t,r)=>{e.resolve=t,e.reject=r}),e}),Promise.fromEntries instanceof Function||(Promise.fromEntries=async function(e){const t=[],r=[];for(const[n,o]of e)t.push(n),r.push(o);return await Promise.all(r).then(e=>Object.fromEntries(e.map((e,r)=>[t[r],e])))}),Promise.ownProperties instanceof Function||(Promise.ownProperties=async function(e){return await Promise.fromEntries(Object.entries(e))})),!(RegExp.escape instanceof Function)){const e=/[-[\]/{}()<>=#&!@%*+?.\\^$|;:"'`\s]/g;RegExp.escape=function(t){return t.toString().replace(e,"\\$&")}}t(Request.prototype,"bytes",async function(){return new Uint8Array(await this.arrayBuffer())}),t(Response,"json",(e,{status:t=200,statusText:r="",headers:n=new Headers}={})=>n instanceof Headers?(n.set("Content-Type","application/json"),new Response(JSON.stringify(e),{status:t,statusText:r,headers:n})):Response.json(e,{status:t,statusText:r,headers:new Headers(n)})),t(Response,"redirect",(e,t=302)=>new Response(null,{status:t,headers:new Headers({Location:e})})),t(Response.prototype,"bytes",async function(){return new Uint8Array(await this.arrayBuffer())});
2
2
  /**
3
3
  * @copyright 2024 Chris Zuber <admin@kernvalley.us>
4
4
  */
package/node.min.js CHANGED
@@ -1,4 +1,4 @@
1
- !function(){"use strict";if(!("AbortSignal"in globalThis)){const e={signal:Symbol("signal"),aborted:Symbol("aborted"),reason:Symbol("reason"),onabort:Symbol("onabort")};globalThis.AbortError=class extends Error{},globalThis.AbortSignal=class t extends EventTarget{constructor(){super(),Object.defineProperties(this,{[e.aborted]:{enumerable:!1,writable:!0,configurable:!1,value:!1},[e.reason]:{enumerable:!1,writable:!0,configurable:!1,value:void 0},[e.onabort]:{enumerable:!1,writable:!0,configurable:!1,value:null}}),this.addEventListener("abort",e=>{this.onabort instanceof Function&&this.onabort.call(this,e)})}get aborted(){return this[e.aborted]}get onabort(){return this[e.onabort]}set onabort(t){this[e.onabort]=t instanceof Function?t:null}get reason(){return this[e.reason]}throwIfAborted(){if(this.aborted)throw this.reason}static abort(r=new DOMException("Operation aborted")){const n=new t;return n[e.aborted]=!0,n[e.reason]=r,n}},globalThis.AbortController=class{constructor(){this[e.signal]=new AbortSignal}get signal(){return this[e.signal]}abort(t=new DOMException("Operation aborted")){const r=this.signal;r.aborted||(r[e.aborted]=!0,r[e.reason]=t,r.dispatchEvent(new Event("abort")))}}}if(!("reason"in AbortSignal.prototype)){const e=new WeakMap,t=AbortController.prototype.abort;if(AbortSignal.abort instanceof Function){const t=AbortSignal.abort;AbortSignal.abort=function(r=new DOMException("Operation aborted")){const n=t();return e.set(n,r),n}}else AbortSignal.abort=function(e=new DOMException("Operation aborted")){const t=new AbortController;return t.abort(e),t.reason};Object.defineProperty(AbortSignal.prototype,"reason",{enumerable:!0,configurable:!0,get:function(){return e.has(this)?e.get(this):void 0}}),AbortController.prototype.abort=function(r=new DOMException("Operation aborted")){e.set(this.signal,r),t.call(this)}}AbortSignal.prototype.throwIfAborted instanceof Function||(AbortSignal.prototype.throwIfAborted=function(){if(this.aborted)throw this.reason}),AbortSignal.timeout instanceof Function||(AbortSignal.timeout=function(e){if(void 0===e)throw new TypeError("At least one 1 argument required but only 0 passed");if(Number.isFinite(e)){if(e<0)throw new TypeError("Argument 1 is out of range for unsigned long long.");{const t=new AbortController;return setTimeout(()=>t.abort(new DOMException("The operation timed out.")),e),t.signal}}throw new TypeError("Argument 1 is not a finite value, so it is out of range for unsigned long long.")}),AbortSignal.any instanceof Function||(AbortSignal.any=function(e){if(!Array.isArray(e))throw new TypeError("Expected an array of signals");const t=new AbortController;for(const r of e){if(!(r instanceof AbortSignal)){const e=new TypeError("`signal` is not an `AbortSignal`");throw t.abort(e),e}if(r.aborted){t.abort(r.reason||new DOMException("Operation aborted."));break}r.addEventListener("abort",({target:e})=>{t.abort(e.reason||new DOMException("Operation aborted."))},{signal:t.signal})}return t.signal});const e=[Array,String,globalThis.Int8Array,globalThis.Uint8Array,globalThis.Uint8ClampedArray,globalThis.Int16Array,globalThis.Uint16Array,globalThis.Int32Array,globalThis.Uint32Array,globalThis.Float32Array,globalThis.Float64Array,globalThis.BigInt64Array,globalThis.BigUint64Array];if(Array.prototype.flat instanceof Function||(Array.prototype.flat=function(e=1){const t=[];e=Math.min(Number.MAX_SAFE_INTEGER,Math.max(0,e));const r=(e,n)=>{Array.isArray(e)&&n>=0?e.forEach(e=>r(e,n-1)):t.push(e)};return r(this,Number.isNaN(e)?0:e),t}),Array.prototype.flatMap instanceof Function||(Array.prototype.flatMap=function(e,t){return this.map(e,t).flat(1)}),Array.prototype.findLast instanceof Function||(Array.prototype.findLast=function(e,t){let r;return this.forEach((n,o,i)=>{e.call(t,n,o,i)&&(r=n)},t),r}),"lastIndex"in Array.prototype||Object.defineProperty(Array.prototype,"lastIndex",{enumerable:!1,configurable:!1,get:function(){return Math.max(0,this.length-1)}}),"lastItem"in Array.prototype||Object.defineProperty(Array.prototype,"lastItem",{enumerable:!1,configurable:!1,get:function(){return this[this.lastIndex]},set:function(e){this[this.lastIndex]=e}}),Array.prototype.findLastIndex instanceof Function||(Array.prototype.findLastIndex=function(e,t){let r=-1;return this.forEach((n,o,i)=>{e.call(t,n,o,i)&&(r=o)},t),r}),!(Array.prototype.at instanceof Function)){const t=function(e){if((e=Math.trunc(e)||0)<0&&(e+=this.length),!(e<0||e>=this.length))return this[e]};for(const r of e)void 0!==r&&Object.defineProperty(r.prototype,"at",{value:t,writable:!0,enumerable:!1,configurable:!0})}function t(e,t,r,{writable:n=!0,enumerable:o=!0,configurable:i=!0}={}){e[t]instanceof Function||Object.defineProperty(e,t,{value:r,writable:n,enumerable:o,configurable:i})}if(!(Array.prototype.group instanceof Function)&&Object.groupBy instanceof Function&&(Array.prototype.group=function(e){return console.warn("`Array.group()` is deprecated. Please use `Object.groupBy()` instead."),Object.groupBy(this,e)}),!(Array.prototype.groupBy instanceof Function)&&Object.groupBy instanceof Function&&(Array.prototype.groupBy=function(e){return console.warn("`Array.goupBy()` is deprecated. Please use `Object.groupBy()` instead."),Object.groupBy(this,e)}),!(Array.prototype.groupToMap instanceof Function)&&Map.groupBy instanceof Function&&(Array.prototype.groupToMap=function(e){return console.warn("`Array.groupToMap()` is deprecated. Please use `Map.groupBy()` instead."),Map.groupBy(this,e)}),Map.groupBy instanceof Function&&(Array.prototype.groupByToMap=function(e){return console.warn("`Array.groupByToMap()` is deprecated. Please use `Map.groupBy()` instead."),Map.groupBy(this,e)}),Array.fromAsync instanceof Function||(Array.fromAsync=async function(e,t,r=globalThis){let n=[];for await(const t of e)n.push(await t);return Array.from(n,t,r)}),Array.prototype.equals instanceof Function||(Array.prototype.equals=function(e){return this===e||!!Array.isArray(e)&&(this.length===e.length&&this.every((t,r)=>{const n=e[r];return Array.isArray(t)?Array.isArray(n)&&t.equals(n):Object.is(t,n)}))}),Array.prototype.uniqueBy instanceof Function||(Array.prototype.uniqueBy=function(e){switch(typeof e){case"undefined":return[...new Set(this)];case"string":case"number":case"symbol":return this.uniqueBy(t=>t[e]);case"function":{const t=new Set;return this.filter((...r)=>{const n=e.apply(this,r);return!t.has(n)&&(t.add(n),!0)})}default:throw new TypeError("Not a valid argument for uniqueBy")}}),Array.prototype.toReversed instanceof Function||(Array.prototype.toReversed=function(){return[...this].reverse()}),Array.prototype.toSorted instanceof Function||(Array.prototype.toSorted=function(e){return[...this].sort(e)}),Array.prototype.toSpliced instanceof Function||(Array.prototype.toSpliced=function(e,t,...r){const n=[...this];return n.splice(e,t,...r),n}),Array.prototype.with instanceof Function||(Array.prototype.with=function(e,t){const r=[...this];return r[e]=t,r}),Array.isTemplateObject instanceof Function||(Array.isTemplateObject=function(e){return!!(Array.isArray(e)&&Array.isArray(e.raw)&&Object.isFrozen(e)&&Object.isFrozen(e.raw))&&(0!==e.length&&e.length===e.raw.length)}),Uint8Array.prototype.toHex instanceof Function||(Uint8Array.prototype.toHex=function(){return Array.from(this,e=>e.toString(16).padStart(2,"0")).join("")}),Uint8Array.prototype.toBase64 instanceof Function||(Uint8Array.prototype.toBase64=function({alphabet:e="base64"}={}){if("base64"===e){const e=32768;let t="";for(let r=0;r<this.length;r+=e){const n=this.subarray(r,r+e);t+=String.fromCharCode.apply(null,n)}return btoa(t)}if("base64url"===e)return this.toBase64({alphabet:"base64"}).replaceAll("+","-").replaceAll("/","_");throw new TypeError('expected alphabet to be either "base64" or "base64url')}),Uint8Array.fromHex instanceof Function||(Uint8Array.fromHex=function(e){if("string"!=typeof e)throw new TypeError("expected input to be a string");if(0===!(1&e.length))throw new SyntaxError("string should be an even number of characters");return Uint8Array.from(globalThis.Iterator.range(0,e.length,{step:2}),t=>parseInt(e.substring(t,t+2),16))}),Uint8Array.fromBase64 instanceof Function||(Uint8Array.fromBase64=function(e,{alphabet:t="base64",lastChunkHandling:r="loose"}={}){if("string"!=typeof e)throw new TypeError("expected input to be a string");if(!["base64","base64url"].includes(t))throw new TypeError('expected alphabet to be either "base64" or "base64url');if(!["loose","strict","stop-before-partial"].includes(r))throw new TypeError(`Invalid \`lastChunkHandling\`: "${r}".`);if("base64"!==t)return Uint8Array.fromBase64(e.replaceAll("-","+").replaceAll("_","/"),{alphabet:"base64"});{const t=e.length%4;if(1===t)throw new TypeError("Invalid string length.");if(0===t)return Uint8Array.from(atob(e),e=>e.charCodeAt(0));switch(r){case"strict":throw new SyntaxError("Missing padding.");case"loose":return Uint8Array.fromBase64(e.padEnd(e.length+(4-t),"="),{alphabet:"base64",lastChunkHandling:"strict"});case"stop-before-partial":return Uint8Array.fromBase64(e.slice(0,e.length-t),{alphabet:"base64",lastChunkHandling:"strict"})}}}),"symbol"!=typeof Symbol.dispose&&(Symbol.dispose=Symbol("Symbol.dispose")),"symbol"!=typeof Symbol.asyncDispose&&(Symbol.asyncDispose=Symbol("Symbol.asyncDispose")),void 0===globalThis.SuppressedError&&(globalThis.SuppressedError=class extends Error{constructor(e,t,r=""){super(r),this.name="SuppressedError",this.error=e,this.suppressed=t}}),void 0===globalThis.AsyncDisposableStack&&(globalThis.AsyncDisposableStack=class e{#e=[];#t=!1;get[Symbol.toStringTag](){return"AsyncDisposableStack"}async[Symbol.asyncDispose](){if(!this.#t){let e;for(this.#t=!0;0!==this.#e.length;){const t=this.#e.pop();await Promise.try(t).catch(t=>{e=void 0===e?t:new SuppressedError(e,t,"An error is suppressed because another error happened while disposing an object")})}if(void 0!==e)throw e}}get disposed(){return this.#t}adopt(e,t){if(this.#t)throw new ReferenceError("AsyncDisposableStack has already been disposed");if("function"!=typeof t)throw new TypeError(`(${t}) is not a function.`);return this.#e.push(()=>t(e)),e}defer(e){if(this.#t)throw new ReferenceError("AsyncDisposableStack has already been disposed");if("function"!=typeof e)throw new TypeError(`${e} is not a function`);this.#e.push(e)}async disposeAsync(){await this[Symbol.asyncDispose]()}move(){if(this.#t)throw new ReferenceError("AsyncDisposableStack has already been disposed");{const t=new e;return t.#e=this.#e,this.#e=[],this.#t=!0,t}}use(e){switch(typeof e){case"function":case"object":if("function"==typeof e?.[Symbol.asyncDispose])return this.#e.push(e[Symbol.asyncDispose].bind(e)),e;if("function"==typeof e?.[Symbol.dispose])return this.#e.push(e[Symbol.dispose].bind(e)),e;if(null===e)return null;throw new TypeError("'Symbol.asyncDispose' property is not callable");case"undefined":break;default:throw new TypeError("Value to be disposed is not an object")}}}),void 0===globalThis.DisposableStack&&(globalThis.DisposableStack=class e{#e=[];#t=!1;get[Symbol.toStringTag](){return"DisposableStack"}[Symbol.dispose](){if(!this.#t){let e;for(this.#t=!0;0!==this.#e.length;){const t=this.#e.pop();try{t()}catch(t){e=void 0===e?t:new SuppressedError(e,t,"An error is suppressed because another error happened while disposing an object")}}if(void 0!==e)throw e}}get disposed(){return this.#t}adopt(e,t){if(this.#t)throw new ReferenceError("DisposableStack has already been disposed");if("function"!=typeof t)throw new TypeError(`(${t}) is not a function.`);return this.#e.push(()=>t(e)),e}defer(e){if(this.#t)throw new ReferenceError("DisposableStack has already been disposed");if("function"!=typeof e)throw new TypeError(`${e} is not a function`);this.#e.push(e)}dispose(){this[Symbol.dispose]()}move(){if(this.#t)throw new ReferenceError("DisposableStack has already been disposed");{const t=new e;return t.#e=this.#e,this.#e=[],this.#t=!0,t}}use(e){switch(typeof e){case"function":case"object":if("function"==typeof e?.[Symbol.dispose])return this.#e.push(e[Symbol.dispose].bind(e)),e;if(null===e)return null;throw new TypeError("'Symbol.dispose' property is not callable");case"undefined":break;default:throw new TypeError("Value to be disposed is not an object")}}}),t(Blob.prototype,"bytes",async function(){return new Uint8Array(await this.arrayBuffer())}),globalThis.hasOwnProperty("AggregateError")||(globalThis.AggregateError=class extends Error{constructor(e,t){void 0===t?(super(e),this.errors=[]):(super(t),this.errors=e)}}),globalThis.reportError instanceof Function||(globalThis.reportError=function(e){globalThis.dispatchEvent(function(e,t="error"){if(e instanceof Error){const{message:r,name:n,fileName:o,lineNumber:i,columnNumber:s}=e;return new ErrorEvent(t,{error:e,message:`${n}: ${r}`,filename:o,lineno:i,colno:s})}throw new TypeError("`errorToEvent()` only accepts Errors")}(e))}),!(Error.isError instanceof Function)){const e=Function.bind.call(Function.call,Object.prototype.toString);Error.isError=function(t){return t instanceof Error||"object"==typeof t&&"[object Error]"===e(t)&&void 0===t[Symbol.toStringTag]}}const r="Iterator"in globalThis,n=r?globalThis.Iterator.prototype:Object.getPrototypeOf(Object.getPrototypeOf([][Symbol.iterator]())),o=r?globalThis.Iterator:(e=>{class t{[Symbol.iterator](){return this}get[Symbol.toStringTag](){return"Iterator"}}return Object.setPrototypeOf(t,e),t})(n);var i;if(o.range instanceof Function||(o.range=function(e,t,r){if("number"==typeof r||"bigint"==typeof r)return o.range(e,t,{step:r});if("object"!=typeof r||Object.is(r,null))return o.range(e,t,{});{const{step:n=("number"==typeof e?e<t?1:-1:e<t?1n:-1n),inclusive:i=!1}=r;if("number"!=typeof e&&"bigint"!=typeof e)throw new TypeError("Start must be a number");if(Number.isNaN(e))throw new RangeError("Invalid start");if("number"!=typeof t&&"bigint"!=typeof t)throw new TypeError("End must be a number");if(Number.isNaN(t))throw new RangeError("Invalid end");if("number"!=typeof n&&"bigint"!=typeof n)throw new TypeError("Step must be a number");if(Number.isNaN(n))throw new RangeError("Invalid step");if(0===n)throw new RangeError("Step must not be 0");if(n<0&&e<t||n>0&&e>t)return;if(i){let r=e;return n>0?o.from({next(){const e=r<=t?{value:r,done:!1}:{done:!0};return r+=n,e}}):o.from({next(){const e=r>=t?{value:r,done:!1}:{done:!0};return r+=n,e}})}{let r=e;if(n>0)return o.from({next(){const e=r<t?{value:r,done:!1}:{done:!0};return r+=n,e}});{let r=e;return o.from({next(){const e=r>t?{value:r,done:!1}:{done:!0};return r+=n,e}})}}}}),n[Symbol.toStringTag]||(n[Symbol.toStringTag]="Iterator"),n.take instanceof Function||(n.take=function(e){let t=0;const r=this;return o.from({next:()=>t++>=e?{done:!0}:r.next()})}),n.drop instanceof Function||(n.drop=function(e){for(let t=0;t<e;t++){const{done:e}=this.next();if(e)break}return this}),n.toArray instanceof Function||(n.toArray=function(){return Array.from(this)}),n.forEach instanceof Function||(n.forEach=function(e){for(const t of this)e.call(this,t)}),n.flatMap instanceof Function||(n.flatMap=function(e){const t=this;let r=this.next();const n=({value:r,done:n=!0}={})=>n?o.from({next:()=>({done:!0})}):o.from(e.call(t,r));let i=n(r);return o.from({next(){const{value:e,done:o=!0}=i.next();return r.done&&o?{done:!0}:o?r.done?{done:!0}:(r=t.next(),i=n(r),i.next()):{value:e,done:o}}})}),n.map instanceof Function||(n.map=function(e){const t=this;return o.from({next(){const{done:r,value:n}=t.next();return r?{done:r}:{value:e.call(t,n),done:!1}}})}),n.reduce instanceof Function||(n.reduce=function(e,t){let r=void 0===t?this.next().value:t;for(const t of this)r=e.call(this,r,t);return r}),n.filter instanceof Function||(n.filter=function(e){const t=this;let r,n=!1;return o.from({next(){for(;!n;){const o=t.next();if(n=o.done,n)break;if(e.call(t,o.value)){r=o.value;break}}return{done:n,value:r}}})}),n.some instanceof Function||(n.some=function(e){let t=!1;for(const r of this)if(e.call(this,r)){t=!0;break}return t}),n.every instanceof Function||(n.every=function(e){let t=!0;for(const r of this)if(!e.call(this,r)){t=!1;break}return t}),n.find instanceof Function||(n.find=function(e){for(const t of this)if(e.call(this,t))return t}),n.indexed instanceof Function||(n.indexed=function(){let e=0;return this.map(t=>[e++,t])}),n.chunks instanceof Function||(n.chunks=function(e){if(!Number.isSafeInteger(e)||e<1)throw new TypeError("Size must be a positive integer.");{const t=this;let r=!1;return o.from({next(){if(r)return{done:r};{const n=[];let o=0;for(;o++<e&&!r;){const e=t.next();if(e.done){r=!0,void 0!==e.value&&n.push(e.value);break}n.push(e.value)}return{value:n,done:!1}}}})}}),o.from instanceof Function||(o.from=function(e){if("object"!=typeof e||null===e)throw new TypeError("Not an object.");if(e.next instanceof Function){return Object.create(n,{next:{enumerable:!0,configurable:!1,writable:!1,value:(...t)=>e.next(...t)}})}if(e[Symbol.iterator]instanceof Function)return o.from(e[Symbol.iterator]())}),r||(globalThis.Iterator=o),t(ReadableStream,"from",function(e){if(e[Symbol.iterator]instanceof Function)return new ReadableStream({start(t){try{for(const r of e)t.enqueue(r)}catch(e){t.error(e)}finally{t.close()}}});if(e[Symbol.asyncIterator]instanceof Function)return new ReadableStream({async start(t){try{for await(const r of e)t.enqueue(r)}catch(e){t.error(e)}finally{t.close()}}});throw new TypeError("`ReadableStream.from()` requires an iterable source.")}),Map.prototype.getOrInsert instanceof Function||(Map.prototype.getOrInsert=function(e,t){return this.has(e)?this.get(e):(this.set(e,t),t)},Map.prototype.getOrInsertComputed=function(e,t){if(this.has(e))return this.get(e);{const r=t.call(this,e);return this.set(e,r),r}}),WeakMap.prototype.getOrInsert instanceof Function||(WeakMap.prototype.getOrInsert=function(e,t){return Map.prototype.getOrInsert.call(this,e,t)},WeakMap.prototype.getOrInsertComputed=function(e,t){return WeakMap.prototype.getOrInsertComputed.call(this,e,t)}),Map.groupBy instanceof Function||(Map.groupBy=function(e,t){return Array.from(e).reduce((e,r,n)=>(e.emplace(t.call(e,r,n),{insert:()=>[r],update:e=>(e.push(r),e)}),e),new Map)}),Map.prototype.emplace instanceof Function||(Map.prototype.emplace=function(e,{insert:t,update:r}={}){console.warn("`Map.prototype.emplace()` has been removed from the proposal and will be removed in the future.");const n=this.has(e);if(n&&r instanceof Function){const t=this.get(e),n=r.call(this,t,e,this);return n!==t&&this.set(e,n),n}if(n)return this.get(e);if(t instanceof Function){const r=t.call(this,e,this);return this.set(e,r),r}throw new Error("Key is not found and no `insert()` given")}),Number.hasOwnProperty("isSafeInteger")||(Number.MAX_SAFE_INTEGER=2**53-1,Number.MIN_SAFE_INTEGER=-Number.MAX_SAFE_INTEGER,Number.isSafeInteger=e=>e<=Number.MAX_SAFE_INTEGER&&e>=Number.MIN_SAFE_INTEGER),Number.hasOwnProperty("EPSILON")||(Number.EPSILON=2**-52),Math.hasOwnProperty("sign")||(Math.sign=e=>(e>0)-(e<0)||+e),Math.hasOwnProperty("trunc")||(Math.trunc=e=>{const t=e-e%1;return 0===t&&(e<0||0===e&&1/e!=1/0)?-0:t}),Math.hasOwnProperty("expm1")||(Math.expm1=e=>Math.exp(e)-1),Math.hasOwnProperty("hypot")||(Math.hypot=(...e)=>Math.sqrt(e.reduce((e,t)=>e+t**2,0))),Math.hasOwnProperty("cbrt")||(Math.cbrt=e=>e**(1/3)),Math.hasOwnProperty("log10")||(Math.log10=e=>Math.log(e)*Math.LOG10E),Math.hasOwnProperty("log2")||(Math.log2=e=>Math.log(e)*Math.LOG2E),Math.hasOwnProperty("log1p")||(Math.log1p=e=>Math.log(1+e)),Math.hasOwnProperty("fround")||(Math.fround=(i=new Float32Array(1),function(e){return i[0]=e,i[0]})),Math.clamp instanceof Function||(Math.clamp=function(e,t,r){return Math.min(Math.max(e,t),r)}),Math.constrain instanceof Function||(Math.constrain=Math.clamp),Math.sumPrecise instanceof Function||(Math.sumPrecise=function(e){let t=-0;for(const r of e){if(!Number.isFinite(r)){t=-0;break}t+=r}return t}),Math.sum instanceof Function||(Math.sum=function(...e){return console.warn("Math.sum is deprecated. Please use Math.sumPrecise instead."),Math.sumPrecise(e)}),Object.groupBy instanceof Function||(Object.groupBy=function(e,t){return Array.from(e).reduce((e,r,n)=>{const o=t.call(e,r,n);return e.hasOwnProperty(o)?e[o].push(r):e[o]=[r],e},{})}),function(){if(!(globalThis.requestIdleCallback instanceof Function)){const e=e=>Number.isSafeInteger(e)&&e>0;globalThis.requestIdleCallback=function(t,{timeout:r}={}){const n=performance.now(),o=()=>e(r)?Math.max(0,r-(performance.now()-n)):Math.max(0,600-(performance.now()-n));return setTimeout(()=>t({didTimeout:!!e(r)&&0===o(),timeRemaining:o}),1)}}globalThis.cancelIdleCallback instanceof Function||(globalThis.cancelIdleCallback=e=>clearTimeout(e)),globalThis.requestAnimationFrame instanceof Function||(globalThis.requestAnimationFrame=e=>setTimeout(()=>e(performance.now()),1e3/60)),globalThis.cancelAnimationFrame instanceof Function||(globalThis.cancelAnimationFrame=e=>clearTimeout(e)),globalThis.queueMicrotask instanceof Function||(globalThis.queueMicrotask=e=>Promise.resolve().then(e).catch(e=>setTimeout(()=>{throw e})))}(),"Promise"in globalThis&&(Promise.prototype.finally instanceof Function||(Promise.prototype.finally=function(e){return this.then(async t=>(await e(),t),async t=>(await e(),t))}),Promise.allSettled instanceof Function||(Promise.allSettled=function(e){return Promise.all(Array.from(e).map(function(e){return new Promise(function(t){e instanceof Promise||(e=Promise.resolve(e)),e.then(function(e){t({status:"fulfilled",value:e})}).catch(function(e){t({status:"rejected",reason:e})})})}))}),Promise.any instanceof Function||(Promise.any=e=>new Promise((t,r)=>{let n=[];e.forEach(o=>{o.then(t).catch(t=>{n.push(t),n.length===e.length&&r(new globalThis.AggregateError(n,"No Promise in Promise.any was resolved"))})})})),Promise.race instanceof Function||(Promise.race=e=>new Promise((t,r)=>{e.forEach(e=>e.then(t,r))})),Promise.try instanceof Function||(Promise.try=(e,...t)=>new Promise(r=>r(e(...t)))),Promise.withResolvers instanceof Function||(Promise.withResolvers=function(){const e={};return e.promise=new Promise((t,r)=>{e.resolve=t,e.reject=r}),e}),Promise.fromEntries instanceof Function||(Promise.fromEntries=async function(e){const t=[],r=[];for(const[n,o]of e)t.push(n),r.push(o);return await Promise.all(r).then(e=>Object.fromEntries(e.map((e,r)=>[t[r],e])))}),Promise.ownProperties instanceof Function||(Promise.ownProperties=async function(e){return await Promise.fromEntries(Object.entries(e))})),!(RegExp.escape instanceof Function)){const e=/[-[\]/{}()<>=#&!@%*+?.\\^$|;:"'`\s]/g;RegExp.escape=function(t){return t.toString().replace(e,"\\$&")}}t(Request.prototype,"bytes",async function(){return new Uint8Array(await this.arrayBuffer())}),t(Response,"json",(e,{status:t=200,statusText:r="",headers:n=new Headers}={})=>n instanceof Headers?(n.set("Content-Type","application/json"),new Response(JSON.stringify(e),{status:t,statusText:r,headers:n})):Response.json(e,{status:t,statusText:r,headers:new Headers(n)})),t(Response,"redirect",(e,t=302)=>new Response(null,{status:t,headers:new Headers({Location:e})})),t(Response.prototype,"bytes",async function(){return new Uint8Array(await this.arrayBuffer())});
1
+ !function(){"use strict";if(!("AbortSignal"in globalThis)){const e={signal:Symbol("signal"),aborted:Symbol("aborted"),reason:Symbol("reason"),onabort:Symbol("onabort")};globalThis.AbortError=class extends Error{},globalThis.AbortSignal=class t extends EventTarget{constructor(){super(),Object.defineProperties(this,{[e.aborted]:{enumerable:!1,writable:!0,configurable:!1,value:!1},[e.reason]:{enumerable:!1,writable:!0,configurable:!1,value:void 0},[e.onabort]:{enumerable:!1,writable:!0,configurable:!1,value:null}}),this.addEventListener("abort",e=>{this.onabort instanceof Function&&this.onabort.call(this,e)})}get aborted(){return this[e.aborted]}get onabort(){return this[e.onabort]}set onabort(t){this[e.onabort]=t instanceof Function?t:null}get reason(){return this[e.reason]}throwIfAborted(){if(this.aborted)throw this.reason}static abort(r=new DOMException("Operation aborted")){const n=new t;return n[e.aborted]=!0,n[e.reason]=r,n}},globalThis.AbortController=class{constructor(){this[e.signal]=new AbortSignal}get signal(){return this[e.signal]}abort(t=new DOMException("Operation aborted")){const r=this.signal;r.aborted||(r[e.aborted]=!0,r[e.reason]=t,r.dispatchEvent(new Event("abort")))}}}if(!("reason"in AbortSignal.prototype)){const e=new WeakMap,t=AbortController.prototype.abort;if(AbortSignal.abort instanceof Function){const t=AbortSignal.abort;AbortSignal.abort=function(r=new DOMException("Operation aborted")){const n=t();return e.set(n,r),n}}else AbortSignal.abort=function(e=new DOMException("Operation aborted")){const t=new AbortController;return t.abort(e),t.reason};Object.defineProperty(AbortSignal.prototype,"reason",{enumerable:!0,configurable:!0,get:function(){return e.has(this)?e.get(this):void 0}}),AbortController.prototype.abort=function(r=new DOMException("Operation aborted")){e.set(this.signal,r),t.call(this)}}AbortSignal.prototype.throwIfAborted instanceof Function||(AbortSignal.prototype.throwIfAborted=function(){if(this.aborted)throw this.reason}),AbortSignal.timeout instanceof Function||(AbortSignal.timeout=function(e){if(void 0===e)throw new TypeError("At least one 1 argument required but only 0 passed");if(Number.isFinite(e)){if(e<0)throw new TypeError("Argument 1 is out of range for unsigned long long.");{const t=new AbortController;return setTimeout(()=>t.abort(new DOMException("The operation timed out.")),e),t.signal}}throw new TypeError("Argument 1 is not a finite value, so it is out of range for unsigned long long.")}),AbortSignal.any instanceof Function||(AbortSignal.any=function(e){if(!Array.isArray(e))throw new TypeError("Expected an array of signals");const t=new AbortController;for(const r of e){if(!(r instanceof AbortSignal)){const e=new TypeError("`signal` is not an `AbortSignal`");throw t.abort(e),e}if(r.aborted){t.abort(r.reason||new DOMException("Operation aborted."));break}r.addEventListener("abort",({target:e})=>{t.abort(e.reason||new DOMException("Operation aborted."))},{signal:t.signal})}return t.signal});const e=[Array,String,globalThis.Int8Array,globalThis.Uint8Array,globalThis.Uint8ClampedArray,globalThis.Int16Array,globalThis.Uint16Array,globalThis.Int32Array,globalThis.Uint32Array,globalThis.Float32Array,globalThis.Float64Array,globalThis.BigInt64Array,globalThis.BigUint64Array];if(Array.prototype.flat instanceof Function||(Array.prototype.flat=function(e=1){const t=[];e=Math.min(Number.MAX_SAFE_INTEGER,Math.max(0,e));const r=(e,n)=>{Array.isArray(e)&&n>=0?e.forEach(e=>r(e,n-1)):t.push(e)};return r(this,Number.isNaN(e)?0:e),t}),Array.prototype.flatMap instanceof Function||(Array.prototype.flatMap=function(e,t){return this.map(e,t).flat(1)}),Array.prototype.findLast instanceof Function||(Array.prototype.findLast=function(e,t){let r;return this.forEach((n,o,i)=>{e.call(t,n,o,i)&&(r=n)},t),r}),"lastIndex"in Array.prototype||Object.defineProperty(Array.prototype,"lastIndex",{enumerable:!1,configurable:!1,get:function(){return Math.max(0,this.length-1)}}),"lastItem"in Array.prototype||Object.defineProperty(Array.prototype,"lastItem",{enumerable:!1,configurable:!1,get:function(){return this[this.lastIndex]},set:function(e){this[this.lastIndex]=e}}),Array.prototype.findLastIndex instanceof Function||(Array.prototype.findLastIndex=function(e,t){let r=-1;return this.forEach((n,o,i)=>{e.call(t,n,o,i)&&(r=o)},t),r}),!(Array.prototype.at instanceof Function)){const t=function(e){if((e=Math.trunc(e)||0)<0&&(e+=this.length),!(e<0||e>=this.length))return this[e]};for(const r of e)void 0!==r&&Object.defineProperty(r.prototype,"at",{value:t,writable:!0,enumerable:!1,configurable:!0})}function t(e,t,r,{writable:n=!0,enumerable:o=!0,configurable:i=!0}={}){e[t]instanceof Function||Object.defineProperty(e,t,{value:r,writable:n,enumerable:o,configurable:i})}if(!(Array.prototype.group instanceof Function)&&Object.groupBy instanceof Function&&(Array.prototype.group=function(e){return console.warn("`Array.group()` is deprecated. Please use `Object.groupBy()` instead."),Object.groupBy(this,e)}),!(Array.prototype.groupBy instanceof Function)&&Object.groupBy instanceof Function&&(Array.prototype.groupBy=function(e){return console.warn("`Array.goupBy()` is deprecated. Please use `Object.groupBy()` instead."),Object.groupBy(this,e)}),!(Array.prototype.groupToMap instanceof Function)&&Map.groupBy instanceof Function&&(Array.prototype.groupToMap=function(e){return console.warn("`Array.groupToMap()` is deprecated. Please use `Map.groupBy()` instead."),Map.groupBy(this,e)}),Map.groupBy instanceof Function&&(Array.prototype.groupByToMap=function(e){return console.warn("`Array.groupByToMap()` is deprecated. Please use `Map.groupBy()` instead."),Map.groupBy(this,e)}),Array.fromAsync instanceof Function||(Array.fromAsync=async function(e,t,r=globalThis){let n=[];for await(const t of e)n.push(await t);return Array.from(n,t,r)}),Array.prototype.equals instanceof Function||(Array.prototype.equals=function(e){return this===e||!!Array.isArray(e)&&(this.length===e.length&&this.every((t,r)=>{const n=e[r];return Array.isArray(t)?Array.isArray(n)&&t.equals(n):Object.is(t,n)}))}),Array.prototype.uniqueBy instanceof Function||(Array.prototype.uniqueBy=function(e){switch(typeof e){case"undefined":return[...new Set(this)];case"string":case"number":case"symbol":return this.uniqueBy(t=>t[e]);case"function":{const t=new Set;return this.filter((...r)=>{const n=e.apply(this,r);return!t.has(n)&&(t.add(n),!0)})}default:throw new TypeError("Not a valid argument for uniqueBy")}}),Array.prototype.toReversed instanceof Function||(Array.prototype.toReversed=function(){return[...this].reverse()}),Array.prototype.toSorted instanceof Function||(Array.prototype.toSorted=function(e){return[...this].sort(e)}),Array.prototype.toSpliced instanceof Function||(Array.prototype.toSpliced=function(e,t,...r){const n=[...this];return n.splice(e,t,...r),n}),Array.prototype.with instanceof Function||(Array.prototype.with=function(e,t){const r=[...this];return r[e]=t,r}),Array.isTemplateObject instanceof Function||(Array.isTemplateObject=function(e){return!!(Array.isArray(e)&&Array.isArray(e.raw)&&Object.isFrozen(e)&&Object.isFrozen(e.raw))&&(0!==e.length&&e.length===e.raw.length)}),Uint8Array.prototype.toHex instanceof Function||(Uint8Array.prototype.toHex=function(){return Array.from(this,e=>e.toString(16).padStart(2,"0")).join("")}),Uint8Array.prototype.toBase64 instanceof Function||(Uint8Array.prototype.toBase64=function({alphabet:e="base64",omitPadding:t=!1}={}){if("base64"===e){const e=32768;let r="";for(let t=0;t<this.length;t+=e){const n=this.subarray(t,t+e);r+=String.fromCharCode.apply(null,n)}return t?btoa(r).replace(/=+$/,""):btoa(r)}if("base64url"===e)return this.toBase64({alphabet:"base64",omitPadding:t}).replaceAll("+","-").replaceAll("/","_");throw new TypeError('expected alphabet to be either "base64" or "base64url')}),Uint8Array.fromHex instanceof Function||(Uint8Array.fromHex=function(e){if("string"!=typeof e)throw new TypeError("expected input to be a string");if(0===!(1&e.length))throw new SyntaxError("string should be an even number of characters");return Uint8Array.from(globalThis.Iterator.range(0,e.length,{step:2}),t=>parseInt(e.substring(t,t+2),16))}),Uint8Array.fromBase64 instanceof Function||(Uint8Array.fromBase64=function(e,{alphabet:t="base64",lastChunkHandling:r="loose"}={}){if("string"!=typeof e)throw new TypeError("expected input to be a string");if(!["base64","base64url"].includes(t))throw new TypeError('expected alphabet to be either "base64" or "base64url');if(!["loose","strict","stop-before-partial"].includes(r))throw new TypeError(`Invalid \`lastChunkHandling\`: "${r}".`);if("base64"!==t)return Uint8Array.fromBase64(e.replaceAll("-","+").replaceAll("_","/"),{alphabet:"base64"});{const t=e.length%4;if(1===t)throw new TypeError("Invalid string length.");if(0===t)return Uint8Array.from(atob(e),e=>e.charCodeAt(0));switch(r){case"strict":throw new SyntaxError("Missing padding.");case"loose":return Uint8Array.fromBase64(e.padEnd(e.length+(4-t),"="),{alphabet:"base64",lastChunkHandling:"strict"});case"stop-before-partial":return Uint8Array.fromBase64(e.slice(0,e.length-t),{alphabet:"base64",lastChunkHandling:"strict"})}}}),"symbol"!=typeof Symbol.dispose&&(Symbol.dispose=Symbol("Symbol.dispose")),"symbol"!=typeof Symbol.asyncDispose&&(Symbol.asyncDispose=Symbol("Symbol.asyncDispose")),void 0===globalThis.SuppressedError&&(globalThis.SuppressedError=class extends Error{constructor(e,t,r=""){super(r),this.name="SuppressedError",this.error=e,this.suppressed=t}}),void 0===globalThis.AsyncDisposableStack&&(globalThis.AsyncDisposableStack=class e{#e=[];#t=!1;get[Symbol.toStringTag](){return"AsyncDisposableStack"}async[Symbol.asyncDispose](){if(!this.#t){let e;for(this.#t=!0;0!==this.#e.length;){const t=this.#e.pop();await Promise.try(t).catch(t=>{e=void 0===e?t:new SuppressedError(e,t,"An error is suppressed because another error happened while disposing an object")})}if(void 0!==e)throw e}}get disposed(){return this.#t}adopt(e,t){if(this.#t)throw new ReferenceError("AsyncDisposableStack has already been disposed");if("function"!=typeof t)throw new TypeError(`(${t}) is not a function.`);return this.#e.push(()=>t(e)),e}defer(e){if(this.#t)throw new ReferenceError("AsyncDisposableStack has already been disposed");if("function"!=typeof e)throw new TypeError(`${e} is not a function`);this.#e.push(e)}async disposeAsync(){await this[Symbol.asyncDispose]()}move(){if(this.#t)throw new ReferenceError("AsyncDisposableStack has already been disposed");{const t=new e;return t.#e=this.#e,this.#e=[],this.#t=!0,t}}use(e){switch(typeof e){case"function":case"object":if("function"==typeof e?.[Symbol.asyncDispose])return this.#e.push(e[Symbol.asyncDispose].bind(e)),e;if("function"==typeof e?.[Symbol.dispose])return this.#e.push(e[Symbol.dispose].bind(e)),e;if(null===e)return null;throw new TypeError("'Symbol.asyncDispose' property is not callable");case"undefined":break;default:throw new TypeError("Value to be disposed is not an object")}}}),void 0===globalThis.DisposableStack&&(globalThis.DisposableStack=class e{#e=[];#t=!1;get[Symbol.toStringTag](){return"DisposableStack"}[Symbol.dispose](){if(!this.#t){let e;for(this.#t=!0;0!==this.#e.length;){const t=this.#e.pop();try{t()}catch(t){e=void 0===e?t:new SuppressedError(e,t,"An error is suppressed because another error happened while disposing an object")}}if(void 0!==e)throw e}}get disposed(){return this.#t}adopt(e,t){if(this.#t)throw new ReferenceError("DisposableStack has already been disposed");if("function"!=typeof t)throw new TypeError(`(${t}) is not a function.`);return this.#e.push(()=>t(e)),e}defer(e){if(this.#t)throw new ReferenceError("DisposableStack has already been disposed");if("function"!=typeof e)throw new TypeError(`${e} is not a function`);this.#e.push(e)}dispose(){this[Symbol.dispose]()}move(){if(this.#t)throw new ReferenceError("DisposableStack has already been disposed");{const t=new e;return t.#e=this.#e,this.#e=[],this.#t=!0,t}}use(e){switch(typeof e){case"function":case"object":if("function"==typeof e?.[Symbol.dispose])return this.#e.push(e[Symbol.dispose].bind(e)),e;if(null===e)return null;throw new TypeError("'Symbol.dispose' property is not callable");case"undefined":break;default:throw new TypeError("Value to be disposed is not an object")}}}),t(Blob.prototype,"bytes",async function(){return new Uint8Array(await this.arrayBuffer())}),globalThis.hasOwnProperty("AggregateError")||(globalThis.AggregateError=class extends Error{constructor(e,t){void 0===t?(super(e),this.errors=[]):(super(t),this.errors=e)}}),globalThis.reportError instanceof Function||(globalThis.reportError=function(e){globalThis.dispatchEvent(function(e,t="error"){if(e instanceof Error){const{message:r,name:n,fileName:o,lineNumber:i,columnNumber:s}=e;return new ErrorEvent(t,{error:e,message:`${n}: ${r}`,filename:o,lineno:i,colno:s})}throw new TypeError("`errorToEvent()` only accepts Errors")}(e))}),!(Error.isError instanceof Function)){const e=Function.bind.call(Function.call,Object.prototype.toString);Error.isError=function(t){return t instanceof Error||"object"==typeof t&&"[object Error]"===e(t)&&void 0===t[Symbol.toStringTag]}}const r="Iterator"in globalThis,n=r?globalThis.Iterator.prototype:Object.getPrototypeOf(Object.getPrototypeOf([][Symbol.iterator]())),o=r?globalThis.Iterator:(e=>{class t{[Symbol.iterator](){return this}get[Symbol.toStringTag](){return"Iterator"}}return Object.setPrototypeOf(t,e),t})(n);var i;if(o.range instanceof Function||(o.range=function(e,t,r){if("number"==typeof r||"bigint"==typeof r)return o.range(e,t,{step:r});if("object"!=typeof r||Object.is(r,null))return o.range(e,t,{});{const{step:n=("number"==typeof e?e<t?1:-1:e<t?1n:-1n),inclusive:i=!1}=r;if("number"!=typeof e&&"bigint"!=typeof e)throw new TypeError("Start must be a number");if(Number.isNaN(e))throw new RangeError("Invalid start");if("number"!=typeof t&&"bigint"!=typeof t)throw new TypeError("End must be a number");if(Number.isNaN(t))throw new RangeError("Invalid end");if("number"!=typeof n&&"bigint"!=typeof n)throw new TypeError("Step must be a number");if(Number.isNaN(n))throw new RangeError("Invalid step");if(0===n)throw new RangeError("Step must not be 0");if(n<0&&e<t||n>0&&e>t)return;if(i){let r=e;return n>0?o.from({next(){const e=r<=t?{value:r,done:!1}:{done:!0};return r+=n,e}}):o.from({next(){const e=r>=t?{value:r,done:!1}:{done:!0};return r+=n,e}})}{let r=e;if(n>0)return o.from({next(){const e=r<t?{value:r,done:!1}:{done:!0};return r+=n,e}});{let r=e;return o.from({next(){const e=r>t?{value:r,done:!1}:{done:!0};return r+=n,e}})}}}}),n[Symbol.toStringTag]||(n[Symbol.toStringTag]="Iterator"),n.take instanceof Function||(n.take=function(e){let t=0;const r=this;return o.from({next:()=>t++>=e?{done:!0}:r.next()})}),n.drop instanceof Function||(n.drop=function(e){for(let t=0;t<e;t++){const{done:e}=this.next();if(e)break}return this}),n.toArray instanceof Function||(n.toArray=function(){return Array.from(this)}),n.forEach instanceof Function||(n.forEach=function(e){for(const t of this)e.call(this,t)}),n.flatMap instanceof Function||(n.flatMap=function(e){const t=this;let r=this.next();const n=({value:r,done:n=!0}={})=>n?o.from({next:()=>({done:!0})}):o.from(e.call(t,r));let i=n(r);return o.from({next(){const{value:e,done:o=!0}=i.next();return r.done&&o?{done:!0}:o?r.done?{done:!0}:(r=t.next(),i=n(r),i.next()):{value:e,done:o}}})}),n.map instanceof Function||(n.map=function(e){const t=this;return o.from({next(){const{done:r,value:n}=t.next();return r?{done:r}:{value:e.call(t,n),done:!1}}})}),n.reduce instanceof Function||(n.reduce=function(e,t){let r=void 0===t?this.next().value:t;for(const t of this)r=e.call(this,r,t);return r}),n.filter instanceof Function||(n.filter=function(e){const t=this;let r,n=!1;return o.from({next(){for(;!n;){const o=t.next();if(n=o.done,n)break;if(e.call(t,o.value)){r=o.value;break}}return{done:n,value:r}}})}),n.some instanceof Function||(n.some=function(e){let t=!1;for(const r of this)if(e.call(this,r)){t=!0;break}return t}),n.every instanceof Function||(n.every=function(e){let t=!0;for(const r of this)if(!e.call(this,r)){t=!1;break}return t}),n.find instanceof Function||(n.find=function(e){for(const t of this)if(e.call(this,t))return t}),n.indexed instanceof Function||(n.indexed=function(){let e=0;return this.map(t=>[e++,t])}),n.chunks instanceof Function||(n.chunks=function(e){if(!Number.isSafeInteger(e)||e<1)throw new TypeError("Size must be a positive integer.");{const t=this;let r=!1;return o.from({next(){if(r)return{done:r};{const n=[];let o=0;for(;o++<e&&!r;){const e=t.next();if(e.done){r=!0,void 0!==e.value&&n.push(e.value);break}n.push(e.value)}return{value:n,done:!1}}}})}}),o.from instanceof Function||(o.from=function(e){if("object"!=typeof e||null===e)throw new TypeError("Not an object.");if(e.next instanceof Function){return Object.create(n,{next:{enumerable:!0,configurable:!1,writable:!1,value:(...t)=>e.next(...t)}})}if(e[Symbol.iterator]instanceof Function)return o.from(e[Symbol.iterator]())}),r||(globalThis.Iterator=o),t(ReadableStream,"from",function(e){if(e[Symbol.iterator]instanceof Function)return new ReadableStream({start(t){try{for(const r of e)t.enqueue(r)}catch(e){t.error(e)}finally{t.close()}}});if(e[Symbol.asyncIterator]instanceof Function)return new ReadableStream({async start(t){try{for await(const r of e)t.enqueue(r)}catch(e){t.error(e)}finally{t.close()}}});throw new TypeError("`ReadableStream.from()` requires an iterable source.")}),Map.prototype.getOrInsert instanceof Function||(Map.prototype.getOrInsert=function(e,t){return this.has(e)?this.get(e):(this.set(e,t),t)},Map.prototype.getOrInsertComputed=function(e,t){if(this.has(e))return this.get(e);{const r=t.call(this,e);return this.set(e,r),r}}),WeakMap.prototype.getOrInsert instanceof Function||(WeakMap.prototype.getOrInsert=function(e,t){return Map.prototype.getOrInsert.call(this,e,t)},WeakMap.prototype.getOrInsertComputed=function(e,t){return WeakMap.prototype.getOrInsertComputed.call(this,e,t)}),Map.groupBy instanceof Function||(Map.groupBy=function(e,t){return Array.from(e).reduce((e,r,n)=>(e.emplace(t.call(e,r,n),{insert:()=>[r],update:e=>(e.push(r),e)}),e),new Map)}),Map.prototype.emplace instanceof Function||(Map.prototype.emplace=function(e,{insert:t,update:r}={}){console.warn("`Map.prototype.emplace()` has been removed from the proposal and will be removed in the future.");const n=this.has(e);if(n&&r instanceof Function){const t=this.get(e),n=r.call(this,t,e,this);return n!==t&&this.set(e,n),n}if(n)return this.get(e);if(t instanceof Function){const r=t.call(this,e,this);return this.set(e,r),r}throw new Error("Key is not found and no `insert()` given")}),Number.hasOwnProperty("isSafeInteger")||(Number.MAX_SAFE_INTEGER=2**53-1,Number.MIN_SAFE_INTEGER=-Number.MAX_SAFE_INTEGER,Number.isSafeInteger=e=>e<=Number.MAX_SAFE_INTEGER&&e>=Number.MIN_SAFE_INTEGER),Number.hasOwnProperty("EPSILON")||(Number.EPSILON=2**-52),Math.hasOwnProperty("sign")||(Math.sign=e=>(e>0)-(e<0)||+e),Math.hasOwnProperty("trunc")||(Math.trunc=e=>{const t=e-e%1;return 0===t&&(e<0||0===e&&1/e!=1/0)?-0:t}),Math.hasOwnProperty("expm1")||(Math.expm1=e=>Math.exp(e)-1),Math.hasOwnProperty("hypot")||(Math.hypot=(...e)=>Math.sqrt(e.reduce((e,t)=>e+t**2,0))),Math.hasOwnProperty("cbrt")||(Math.cbrt=e=>e**(1/3)),Math.hasOwnProperty("log10")||(Math.log10=e=>Math.log(e)*Math.LOG10E),Math.hasOwnProperty("log2")||(Math.log2=e=>Math.log(e)*Math.LOG2E),Math.hasOwnProperty("log1p")||(Math.log1p=e=>Math.log(1+e)),Math.hasOwnProperty("fround")||(Math.fround=(i=new Float32Array(1),function(e){return i[0]=e,i[0]})),Math.clamp instanceof Function||(Math.clamp=function(e,t,r){return Math.min(Math.max(e,t),r)}),Math.constrain instanceof Function||(Math.constrain=Math.clamp),Math.sumPrecise instanceof Function||(Math.sumPrecise=function(e){let t=-0;for(const r of e){if(!Number.isFinite(r)){t=-0;break}t+=r}return t}),Math.sum instanceof Function||(Math.sum=function(...e){return console.warn("Math.sum is deprecated. Please use Math.sumPrecise instead."),Math.sumPrecise(e)}),Object.groupBy instanceof Function||(Object.groupBy=function(e,t){return Array.from(e).reduce((e,r,n)=>{const o=t.call(e,r,n);return e.hasOwnProperty(o)?e[o].push(r):e[o]=[r],e},{})}),function(){if(!(globalThis.requestIdleCallback instanceof Function)){const e=e=>Number.isSafeInteger(e)&&e>0;globalThis.requestIdleCallback=function(t,{timeout:r}={}){const n=performance.now(),o=()=>e(r)?Math.max(0,r-(performance.now()-n)):Math.max(0,600-(performance.now()-n));return setTimeout(()=>t({didTimeout:!!e(r)&&0===o(),timeRemaining:o}),1)}}globalThis.cancelIdleCallback instanceof Function||(globalThis.cancelIdleCallback=e=>clearTimeout(e)),globalThis.requestAnimationFrame instanceof Function||(globalThis.requestAnimationFrame=e=>setTimeout(()=>e(performance.now()),1e3/60)),globalThis.cancelAnimationFrame instanceof Function||(globalThis.cancelAnimationFrame=e=>clearTimeout(e)),globalThis.queueMicrotask instanceof Function||(globalThis.queueMicrotask=e=>Promise.resolve().then(e).catch(e=>setTimeout(()=>{throw e})))}(),"Promise"in globalThis&&(Promise.prototype.finally instanceof Function||(Promise.prototype.finally=function(e){return this.then(async t=>(await e(),t),async t=>(await e(),t))}),Promise.allSettled instanceof Function||(Promise.allSettled=function(e){return Promise.all(Array.from(e).map(function(e){return new Promise(function(t){e instanceof Promise||(e=Promise.resolve(e)),e.then(function(e){t({status:"fulfilled",value:e})}).catch(function(e){t({status:"rejected",reason:e})})})}))}),Promise.any instanceof Function||(Promise.any=e=>new Promise((t,r)=>{let n=[];e.forEach(o=>{o.then(t).catch(t=>{n.push(t),n.length===e.length&&r(new globalThis.AggregateError(n,"No Promise in Promise.any was resolved"))})})})),Promise.race instanceof Function||(Promise.race=e=>new Promise((t,r)=>{e.forEach(e=>e.then(t,r))})),Promise.try instanceof Function||(Promise.try=(e,...t)=>new Promise(r=>r(e(...t)))),Promise.withResolvers instanceof Function||(Promise.withResolvers=function(){const e={};return e.promise=new Promise((t,r)=>{e.resolve=t,e.reject=r}),e}),Promise.fromEntries instanceof Function||(Promise.fromEntries=async function(e){const t=[],r=[];for(const[n,o]of e)t.push(n),r.push(o);return await Promise.all(r).then(e=>Object.fromEntries(e.map((e,r)=>[t[r],e])))}),Promise.ownProperties instanceof Function||(Promise.ownProperties=async function(e){return await Promise.fromEntries(Object.entries(e))})),!(RegExp.escape instanceof Function)){const e=/[-[\]/{}()<>=#&!@%*+?.\\^$|;:"'`\s]/g;RegExp.escape=function(t){return t.toString().replace(e,"\\$&")}}t(Request.prototype,"bytes",async function(){return new Uint8Array(await this.arrayBuffer())}),t(Response,"json",(e,{status:t=200,statusText:r="",headers:n=new Headers}={})=>n instanceof Headers?(n.set("Content-Type","application/json"),new Response(JSON.stringify(e),{status:t,statusText:r,headers:n})):Response.json(e,{status:t,statusText:r,headers:new Headers(n)})),t(Response,"redirect",(e,t=302)=>new Response(null,{status:t,headers:new Headers({Location:e})})),t(Response.prototype,"bytes",async function(){return new Uint8Array(await this.arrayBuffer())});
2
2
  /**
3
3
  * @copyright 2024 Chris Zuber <admin@kernvalley.us>
4
4
  */