@shgysk8zer0/polyfills 0.3.9 → 0.3.10

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/CHANGELOG.md CHANGED
@@ -6,6 +6,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [v0.3.10] - 2024-04-10
10
+
11
+ ### Added
12
+ - Add `Math.sumPrecise()`
13
+
14
+ ### Changed
15
+ - Update `@aegisjsproject/sanitizer`
16
+
17
+ ### Deprecated
18
+ - Deprecate old `Math.sum` method (now `Math.sumPrecise`)
19
+
9
20
  ## [v0.3.9] - 2024-04-03
10
21
 
11
22
  ### Changed
package/all.min.js CHANGED
@@ -1,4 +1,4 @@
1
- !function(){"use strict";!function(){"undefined"==typeof globalThis&&("undefined"!=typeof window?Object.defineProperty(Window.prototype,"globalThis",{enumerable:!1,writable:!0,configurable:!0,value:window}):"undefined"!=typeof global?Object.defineProperty(global,"globalThis",{enumerable:!1,writable:!0,configurable:!0,value:global}):"undefined"!=typeof self?Object.defineProperty(self,"globalThis",{enumerable:!1,writable:!0,configurable:!0,value:self}):Object.defineProperty(this,"globalThis",{enumerable:!1,writable:!0,configurable:!0,value:this}))}(),!("crypto"in window)&&"msCrypto"in window&&(globalThis.crypto=globalThis.msCrypto),"Notification"in window||(globalThis.Notification=globalThis.notifications||globalThis.webkitNotifications||globalThis.oNotifications||globalThis.msNotifications||!1),"doNotTrack"in navigator||(navigator.doNotTrack=globalThis.doNotTrack||navigator.msDoNotTrack||"unspecified"),"indexedDB"in window||(globalThis.indexedDB=globalThis.indexedDB||globalThis.mozIndexedDB||globalThis.webkitIndexedDB||globalThis.msIndexedDB||!1),"hidden"in document||(document.hidden=document.webkitHidden||document.msHidden||document.mozHidden||!1),"visibilityState"in document||(document.visibilityState=document.webkitVisibilityState||document.msVisibilityState||document.mozVisibilityState||"visible"),"fullscreenElement"in document||(document.fullscreenElement=document.mozFullScreenElement||document.webkitFullscreenElement||!1),"requestAnimationFrame"in window||(globalThis.requestAnimationFrame=globalThis.mozRequestAnimationFrame||globalThis.webkitRequestAnimationFrame||globalThis.msRequestAnimationFrame||!1),"exitFullscreen"in Document.prototype||(Document.prototype.exitFullscreen=document.mozCancelFullScreen||document.webkitCancelFullScreen||document.msCancelFullScreen||!1),"requestFullscreen"in HTMLElement.prototype||(HTMLElement.prototype.requestFullscreen=HTMLElement.prototype.requestFullScreen||HTMLElement.prototype.mozRequestFullScreen||HTMLElement.prototype.webkitRequestFullScreen||!1),"fullscreen"in Document.prototype||Object.defineProperty(Document.prototype,"fullscreen",{get:()=>document.fullscreenElement instanceof Element}),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}),{})}),Map.prototype.emplace instanceof Function||(Map.prototype.emplace=function(e,{insert:t,update:r}={}){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")}),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)});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,a)=>{e.call(t,n,o,a)&&(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,a)=>{e.call(t,n,o,a)&&(r=o)}),t),r}),!(Array.prototype.at instanceof Function)){const Se=function(e){if((e=Math.trunc(e)||0)<0&&(e+=this.length),!(e<0||e>=this.length))return this[e]};for(const Ee of e)void 0!==Ee&&Object.defineProperty(Ee.prototype,"at",{value:Se,writable:!0,enumerable:!1,configurable:!0})}function t(e,t,r,{writable:n=!0,enumerable:o=!0,configurable:a=!0}={}){e[t]instanceof Function||Object.defineProperty(e,t,{value:r,writable:n,enumerable:o,configurable:a})}function r(e,t,{get:r,set:n,enumerable:o=!0,configurable:a=!0}={}){e.hasOwnProperty(t)||Object.defineProperty(e,t,{get:r,set:n,enumerable:o,configurable:a})}!(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){if(void 0===e)return[...new Set(this)];if("string"==typeof e){const t=[];return this.filter((r=>{const n=r[e];return!t.includes(n)&&(t.push(n),!0)}))}if(e instanceof Function){const t=[];return this.filter(((...r)=>{try{const n=e.apply(this,r);return"string"==typeof n&&(!t.includes(n)&&(t.push(n),!0))}catch(e){return!1}}))}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).map((e=>e.toString(16).padStart("0",2))).join("")}),Uint8Array.prototype.toBase64 instanceof Function||(Uint8Array.prototype.toBase64=function({alphabet:e="base64"}={}){if("base64"===e)return btoa(String.fromCodePoint(...this));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(new TextEncoder).encode(atob(e));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"in globalThis&&(void 0===Symbol.toStringTag&&(Symbol.toStringTag=Symbol("Symbol.toStringTag")),void 0===Symbol.iterator&&(Symbol.iterator=Symbol("Symbol.iterator"))),function(){if(!(Function.prototype.once instanceof Function)){const e=new WeakMap;Function.prototype.once=function(t){const r=this;return function(...n){if(e.has(r))return e.get(r);if("AsyncFunction"===r.constructor.name){const o=r.apply(t||r,n).catch((t=>{throw e.delete(r),t}));return e.set(r,o),o}if(r instanceof Function){const o=r.apply(t||r,n);return e.set(r,o),o}}}}}(),t(URL,"canParse",((e,t)=>{try{return new URL(e,t),!0}catch{return!1}})),Number.range instanceof Function||(Number.range=function(e,t,r=1){return console.warn("`Number.range()` is deprecated. Use `Iterator.range()` instead."),globalThis.Iterator.range(e,t,{step:r})});const n="Iterator"in globalThis,o=n?Object.getPrototypeOf(globalThis.Iterator):Object.getPrototypeOf(Object.getPrototypeOf([][Symbol.iterator]())),a=n?globalThis.Iterator:(e=>{class t{[Symbol.iterator](){return this}}return Object.setPrototypeOf(t,e),t})(o);var i;a.range instanceof Function||(a.range=function(e,t,r){if("number"==typeof r||"bigint"==typeof r)return a.range(e,t,{step:r});if("object"!=typeof r||Object.is(r,null))return a.range(e,t,{});{const{step:n=("number"==typeof e?e<t?1:-1:e<t?1n:-1n),inclusive:o=!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(o){let r=e;return n>0?a.from({next(){const e=r<=t?{value:r,done:!1}:{done:!0};return r+=n,e}}):a.from({next(){const e=r>=t?{value:r,done:!1}:{done:!0};return r+=n,e}})}{let r=e;if(n>0)return a.from({next(){const e=r<t?{value:r,done:!1}:{done:!0};return r+=n,e}});{let r=e;return a.from({next(){const e=r>t?{value:r,done:!1}:{done:!0};return r+=n,e}})}}}}),o[Symbol.toStringTag]||(o[Symbol.toStringTag]="Iterator"),o.take instanceof Function||(o.take=function(e){let t=0;const r=this;return a.from({next:()=>t++>=e?{done:!0}:r.next()})}),o.drop instanceof Function||(o.drop=function(e){for(let t=0;t<e;t++){const{done:e}=this.next();if(e)break}return this}),o.toArray instanceof Function||(o.toArray=function(){return Array.from(this)}),o.forEach instanceof Function||(o.forEach=function(e){for(const t of this)e.call(this,t)}),o.flatMap instanceof Function||(o.flatMap=function(e){const t=this;let r=this.next();const n=({value:r,done:n=!0}={})=>n?a.from({next:()=>({done:!0})}):a.from(e.call(t,r));let o=n(r);return a.from({next(){const{value:e,done:a=!0}=o.next();return r.done&&a?{done:!0}:a?r.done?{done:!0}:(r=t.next(),o=n(r),o.next()):{value:e,done:a}}})}),o.map instanceof Function||(o.map=function(e){const t=this;return a.from({next(){const{done:r,value:n}=t.next();return r?{done:r}:{value:e.call(t,n),done:!1}}})}),o.reduce instanceof Function||(o.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}),o.filter instanceof Function||(o.filter=function(e){const t=this;let r,n=!1;return a.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}}})}),o.some instanceof Function||(o.some=function(e){let t=!1;for(const r of this)if(e.call(this,r)){t=!0;break}return t}),o.every instanceof Function||(o.every=function(e){let t=!0;for(const r of this)if(!e.call(this,r)){t=!1;break}return t}),o.find instanceof Function||(o.find=function(e){for(const t of this)if(e.call(this,t))return t}),o.indexed instanceof Function||(o.indexed=function(){let e=0;return this.map((t=>[e++,t]))}),o.chunks instanceof Function||(o.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 a.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}}}})}}),a.from instanceof Function||(a.from=function(e){if("object"!=typeof e||null===e)throw new TypeError("Not an object.");if(e.next instanceof Function){return Object.create(o,{next:{enumerable:!0,configurable:!1,writable:!1,value:(...t)=>e.next(...t)}})}if(e[Symbol.iterator]instanceof Function)return a.from(e[Symbol.iterator]())}),n||(globalThis.Iterator=a),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.sum instanceof Function||(Math.sum=function(...e){return e.map((e=>parseFloat(e))).reduce(((e,t)=>e+t))}),function(){if(!("isSecureContext"in globalThis)){const e=["localhost","127.0.0.1"],t="https:",r=[t,"file:","wss:"],n=(e=globalThis.document)=>[...e.scripts].every((({src:r})=>{if(0===r.length)return!0;{const{protocol:n,hostname:o}=new URL(r,e.baseURI);return n===t||o===location.hostname}}));Object.defineProperty(globalThis,"isSecureContext",{enumerable:!0,configurable:!0,get:function(){return window.parent===window&&(!(!r.includes(location.protocol)&&!e.includes(location.hostname))&&n())}})}}();function s(e){return function(e){return e instanceof Function&&"AsyncFunction"===e.constructor.name}(e)||e instanceof Promise}
1
+ !function(){"use strict";!function(){"undefined"==typeof globalThis&&("undefined"!=typeof window?Object.defineProperty(Window.prototype,"globalThis",{enumerable:!1,writable:!0,configurable:!0,value:window}):"undefined"!=typeof global?Object.defineProperty(global,"globalThis",{enumerable:!1,writable:!0,configurable:!0,value:global}):"undefined"!=typeof self?Object.defineProperty(self,"globalThis",{enumerable:!1,writable:!0,configurable:!0,value:self}):Object.defineProperty(this,"globalThis",{enumerable:!1,writable:!0,configurable:!0,value:this}))}(),!("crypto"in window)&&"msCrypto"in window&&(globalThis.crypto=globalThis.msCrypto),"Notification"in window||(globalThis.Notification=globalThis.notifications||globalThis.webkitNotifications||globalThis.oNotifications||globalThis.msNotifications||!1),"doNotTrack"in navigator||(navigator.doNotTrack=globalThis.doNotTrack||navigator.msDoNotTrack||"unspecified"),"indexedDB"in window||(globalThis.indexedDB=globalThis.indexedDB||globalThis.mozIndexedDB||globalThis.webkitIndexedDB||globalThis.msIndexedDB||!1),"hidden"in document||(document.hidden=document.webkitHidden||document.msHidden||document.mozHidden||!1),"visibilityState"in document||(document.visibilityState=document.webkitVisibilityState||document.msVisibilityState||document.mozVisibilityState||"visible"),"fullscreenElement"in document||(document.fullscreenElement=document.mozFullScreenElement||document.webkitFullscreenElement||!1),"requestAnimationFrame"in window||(globalThis.requestAnimationFrame=globalThis.mozRequestAnimationFrame||globalThis.webkitRequestAnimationFrame||globalThis.msRequestAnimationFrame||!1),"exitFullscreen"in Document.prototype||(Document.prototype.exitFullscreen=document.mozCancelFullScreen||document.webkitCancelFullScreen||document.msCancelFullScreen||!1),"requestFullscreen"in HTMLElement.prototype||(HTMLElement.prototype.requestFullscreen=HTMLElement.prototype.requestFullScreen||HTMLElement.prototype.mozRequestFullScreen||HTMLElement.prototype.webkitRequestFullScreen||!1),"fullscreen"in Document.prototype||Object.defineProperty(Document.prototype,"fullscreen",{get:()=>document.fullscreenElement instanceof Element}),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}),{})}),Map.prototype.emplace instanceof Function||(Map.prototype.emplace=function(e,{insert:t,update:r}={}){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")}),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)});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,a)=>{e.call(t,n,o,a)&&(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,a)=>{e.call(t,n,o,a)&&(r=o)}),t),r}),!(Array.prototype.at instanceof Function)){const Se=function(e){if((e=Math.trunc(e)||0)<0&&(e+=this.length),!(e<0||e>=this.length))return this[e]};for(const Ee of e)void 0!==Ee&&Object.defineProperty(Ee.prototype,"at",{value:Se,writable:!0,enumerable:!1,configurable:!0})}function t(e,t,r,{writable:n=!0,enumerable:o=!0,configurable:a=!0}={}){e[t]instanceof Function||Object.defineProperty(e,t,{value:r,writable:n,enumerable:o,configurable:a})}function r(e,t,{get:r,set:n,enumerable:o=!0,configurable:a=!0}={}){e.hasOwnProperty(t)||Object.defineProperty(e,t,{get:r,set:n,enumerable:o,configurable:a})}!(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){if(void 0===e)return[...new Set(this)];if("string"==typeof e){const t=[];return this.filter((r=>{const n=r[e];return!t.includes(n)&&(t.push(n),!0)}))}if(e instanceof Function){const t=[];return this.filter(((...r)=>{try{const n=e.apply(this,r);return"string"==typeof n&&(!t.includes(n)&&(t.push(n),!0))}catch(e){return!1}}))}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).map((e=>e.toString(16).padStart("0",2))).join("")}),Uint8Array.prototype.toBase64 instanceof Function||(Uint8Array.prototype.toBase64=function({alphabet:e="base64"}={}){if("base64"===e)return btoa(String.fromCodePoint(...this));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(new TextEncoder).encode(atob(e));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"in globalThis&&(void 0===Symbol.toStringTag&&(Symbol.toStringTag=Symbol("Symbol.toStringTag")),void 0===Symbol.iterator&&(Symbol.iterator=Symbol("Symbol.iterator"))),function(){if(!(Function.prototype.once instanceof Function)){const e=new WeakMap;Function.prototype.once=function(t){const r=this;return function(...n){if(e.has(r))return e.get(r);if("AsyncFunction"===r.constructor.name){const o=r.apply(t||r,n).catch((t=>{throw e.delete(r),t}));return e.set(r,o),o}if(r instanceof Function){const o=r.apply(t||r,n);return e.set(r,o),o}}}}}(),t(URL,"canParse",((e,t)=>{try{return new URL(e,t),!0}catch{return!1}})),Number.range instanceof Function||(Number.range=function(e,t,r=1){return console.warn("`Number.range()` is deprecated. Use `Iterator.range()` instead."),globalThis.Iterator.range(e,t,{step:r})});const n="Iterator"in globalThis,o=n?Object.getPrototypeOf(globalThis.Iterator):Object.getPrototypeOf(Object.getPrototypeOf([][Symbol.iterator]())),a=n?globalThis.Iterator:(e=>{class t{[Symbol.iterator](){return this}}return Object.setPrototypeOf(t,e),t})(o);var i;a.range instanceof Function||(a.range=function(e,t,r){if("number"==typeof r||"bigint"==typeof r)return a.range(e,t,{step:r});if("object"!=typeof r||Object.is(r,null))return a.range(e,t,{});{const{step:n=("number"==typeof e?e<t?1:-1:e<t?1n:-1n),inclusive:o=!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(o){let r=e;return n>0?a.from({next(){const e=r<=t?{value:r,done:!1}:{done:!0};return r+=n,e}}):a.from({next(){const e=r>=t?{value:r,done:!1}:{done:!0};return r+=n,e}})}{let r=e;if(n>0)return a.from({next(){const e=r<t?{value:r,done:!1}:{done:!0};return r+=n,e}});{let r=e;return a.from({next(){const e=r>t?{value:r,done:!1}:{done:!0};return r+=n,e}})}}}}),o[Symbol.toStringTag]||(o[Symbol.toStringTag]="Iterator"),o.take instanceof Function||(o.take=function(e){let t=0;const r=this;return a.from({next:()=>t++>=e?{done:!0}:r.next()})}),o.drop instanceof Function||(o.drop=function(e){for(let t=0;t<e;t++){const{done:e}=this.next();if(e)break}return this}),o.toArray instanceof Function||(o.toArray=function(){return Array.from(this)}),o.forEach instanceof Function||(o.forEach=function(e){for(const t of this)e.call(this,t)}),o.flatMap instanceof Function||(o.flatMap=function(e){const t=this;let r=this.next();const n=({value:r,done:n=!0}={})=>n?a.from({next:()=>({done:!0})}):a.from(e.call(t,r));let o=n(r);return a.from({next(){const{value:e,done:a=!0}=o.next();return r.done&&a?{done:!0}:a?r.done?{done:!0}:(r=t.next(),o=n(r),o.next()):{value:e,done:a}}})}),o.map instanceof Function||(o.map=function(e){const t=this;return a.from({next(){const{done:r,value:n}=t.next();return r?{done:r}:{value:e.call(t,n),done:!1}}})}),o.reduce instanceof Function||(o.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}),o.filter instanceof Function||(o.filter=function(e){const t=this;let r,n=!1;return a.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}}})}),o.some instanceof Function||(o.some=function(e){let t=!1;for(const r of this)if(e.call(this,r)){t=!0;break}return t}),o.every instanceof Function||(o.every=function(e){let t=!0;for(const r of this)if(!e.call(this,r)){t=!1;break}return t}),o.find instanceof Function||(o.find=function(e){for(const t of this)if(e.call(this,t))return t}),o.indexed instanceof Function||(o.indexed=function(){let e=0;return this.map((t=>[e++,t]))}),o.chunks instanceof Function||(o.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 a.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}}}})}}),a.from instanceof Function||(a.from=function(e){if("object"!=typeof e||null===e)throw new TypeError("Not an object.");if(e.next instanceof Function){return Object.create(o,{next:{enumerable:!0,configurable:!1,writable:!1,value:(...t)=>e.next(...t)}})}if(e[Symbol.iterator]instanceof Function)return a.from(e[Symbol.iterator]())}),n||(globalThis.Iterator=a),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)}),function(){if(!("isSecureContext"in globalThis)){const e=["localhost","127.0.0.1"],t="https:",r=[t,"file:","wss:"],n=(e=globalThis.document)=>[...e.scripts].every((({src:r})=>{if(0===r.length)return!0;{const{protocol:n,hostname:o}=new URL(r,e.baseURI);return n===t||o===location.hostname}}));Object.defineProperty(globalThis,"isSecureContext",{enumerable:!0,configurable:!0,get:function(){return window.parent===window&&(!(!r.includes(location.protocol)&&!e.includes(location.hostname))&&n())}})}}();function s(e){return function(e){return e instanceof Function&&"AsyncFunction"===e.constructor.name}(e)||e instanceof Promise}
2
2
  /**
3
3
  * @copyright 2023 Chris Zuber <admin@kernvalley.us>
4
4
  * @see https://developer.mozilla.org/en-US/docs/Web/API/Lock
@@ -11,7 +11,7 @@
11
11
  */;let O=class{get encoding(){return"utf-8"}encode(e){return new Uint8Array(e.split("").flatMap((e=>{const t=e.charCodeAt(0);if(t<128)return[t];return[194+Math.floor((t-128)/64),t%64+128]})))}encodeInto(e,t){if(t instanceof Uint8Array){const r=this.encode(e),n=Math.min(t.length,r.length);return r.length>t.length?t.set(r.slice(0,n)):t.set(r),{read:n,written:n}}throw new TypeError("TextEncoder.encodeInto: Argument 2 does not implement interface Uint8Array.")}};
12
12
  /**
13
13
  * @copyright 2023 Chris Zuber <admin@kernvalley.us>
14
- */const x=["utf-8","utf8"];class F{constructor(e="utf-8",{fatal:t=!1,ignoreBOM:r=!1}={}){if(e="string"!=typeof e?e.toString().toLowerCase():e.toLowerCase(),!x.includes(e))throw new RangeError(`TextDecoder constructor: The given encoding '${e}' is not supported.`);Object.defineProperties(this,{encoding:{configurable:!1,enumerable:!0,writable:!1,value:e},fatal:{configurable:!1,enumerable:!0,writable:!1,value:t},ignoreBOM:{configurable:!1,enumerable:!0,writable:!1,value:r}})}decode(e){switch(this.encoding){case"utf-8":case"utf8":{let t=NaN;return e.reduce(((e,r,n)=>{if(Number.isNaN(t)&&r<128)return e+String.fromCharCode(r);if(Number.isNaN(t)&&r>193)return t=r,e;if(t>193&&(o=128,i=194,"number"==typeof(a=r)&&a>=o&&a<=i)){const n=64*(t-194);return t=NaN,e+String.fromCharCode(n+r)}if(this.fatal)throw new RangeError(`Unhandled character at postion ${n}`);return t=NaN,e;var o,a,i}),"")}default:throw new TypeError(`Unsupported encoding '${this.encoding}'`)}}}"TextEncoder"in globalThis||(globalThis.TextEncoder=O),"TextDecoder"in globalThis||(globalThis.TextDecoder=F),globalThis.TextEncoder.prototype.encodeInto instanceof Function||(globalThis.TextEncoder.prototype.encodeInto=function(...e){return O.prototype.encodeInto.apply(this,e)}),!(crypto in globalThis)||crypto.randomUUID instanceof Function||(crypto.randomUUID=function(){return([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)))})
14
+ */const x=["utf-8","utf8"];class P{constructor(e="utf-8",{fatal:t=!1,ignoreBOM:r=!1}={}){if(e="string"!=typeof e?e.toString().toLowerCase():e.toLowerCase(),!x.includes(e))throw new RangeError(`TextDecoder constructor: The given encoding '${e}' is not supported.`);Object.defineProperties(this,{encoding:{configurable:!1,enumerable:!0,writable:!1,value:e},fatal:{configurable:!1,enumerable:!0,writable:!1,value:t},ignoreBOM:{configurable:!1,enumerable:!0,writable:!1,value:r}})}decode(e){switch(this.encoding){case"utf-8":case"utf8":{let t=NaN;return e.reduce(((e,r,n)=>{if(Number.isNaN(t)&&r<128)return e+String.fromCharCode(r);if(Number.isNaN(t)&&r>193)return t=r,e;if(t>193&&(o=128,i=194,"number"==typeof(a=r)&&a>=o&&a<=i)){const n=64*(t-194);return t=NaN,e+String.fromCharCode(n+r)}if(this.fatal)throw new RangeError(`Unhandled character at postion ${n}`);return t=NaN,e;var o,a,i}),"")}default:throw new TypeError(`Unsupported encoding '${this.encoding}'`)}}}"TextEncoder"in globalThis||(globalThis.TextEncoder=O),"TextDecoder"in globalThis||(globalThis.TextDecoder=P),globalThis.TextEncoder.prototype.encodeInto instanceof Function||(globalThis.TextEncoder.prototype.encodeInto=function(...e){return O.prototype.encodeInto.apply(this,e)}),!(crypto in globalThis)||crypto.randomUUID instanceof Function||(crypto.randomUUID=function(){return([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)))})
15
15
  /**
16
16
  * @copyright 2023 Chris Zuber <admin@kernvalley.us>
17
17
  * @SEE https://wicg.github.io/cookie-store/
@@ -20,17 +20,17 @@
20
20
  * cookie properties, such as expires, etc.
21
21
  *
22
22
  * @TODO verify spec compliance as best as is possible
23
- */;const P="cookieStore"in globalThis,k={constructor:Symbol("constructor")};function N(){return 0===document.cookie.length?[]:document.cookie.split(";").map((e=>{const[t,r=null]=e.split("=");return{name:decodeURIComponent(t.trim()),value:"string"==typeof r?decodeURIComponent(r.trim()):null,path:void 0,expires:void 0,domain:void 0,sameSite:void 0,secure:void 0,partitioned:!1}}))}function j({name:e=null,value:t=null}={}){return"string"==typeof e&&(e=decodeURIComponent(e)),"string"==typeof t&&(t=decodeURIComponent(t)),"string"==typeof e&&"string"==typeof t?N().filter((r=>r.name===e&&r.value===t)):"string"==typeof e?N().filter((t=>t.name===e)):"string"==typeof t?N().filter((e=>e.value===t)):N()}function I({name:e,value:t,expires:r=null,maxAge:n=null,path:o="/",sameSite:a="lax",domain:i=null,secure:s=!1,partitioned:l=!1}){if(Number.isInteger(n))I({name:e,value:t,expires:Date.now()+n,path:o,sameSite:a,domain:i,secure:s,partitioned:l});else{let n=`${encodeURIComponent(e)}=`;t&&(n+=encodeURIComponent(t)),Number.isInteger(r)?n+=`;expires=${new Date(r).toUTCString()}`:r instanceof Date&&(n+=`;expires=${r.toUTCString()}`),"string"==typeof o&&(n+=`;path=${o}`),"string"==typeof i&&(n+=`;domain=${i}`),"string"==typeof a&&(n+=`;sameSite=${a}`),!0===s&&(n+=";secure"),!0===l&&(n+=";partitioned"),document.cookie=n}}class R extends EventTarget{constructor(e){if(e!==k.constructor)throw new DOMException("Invalid constructor");super(),Object.defineProperty(this,k.onchange,{enumerable:!1,configurable:!1,writable:!0,value:null})}get onchange(){return this[k.onchange]}set onchange(e){this[k.onchange]instanceof Function&&this.removeEventListener("change",this[k.onchange]),e instanceof Function&&this.addEventListener("change",e)}async get(e){const t=await this.getAll(e);return Array.isArray(t)&&0!==t.length?t[0]:null}async getAll(e){return j("string"==typeof e?{name:e}:e)}async set(...e){if(1===e.length&&"object"==typeof e[0]&&"string"==typeof e[0].name){const t=function({name:e,value:t=null,domain:r=null,path:n="/",expires:o=null,maxAge:a=null,sameSite:i="lax",secure:s=!1,partitioned:l=!1}){return{name:e,value:t,domain:r,path:n,expires:o,maxAge:a,sameSite:i,secure:s,partitioned:l}}(e[0]);I(t);const r=new Event("change");r.changed=[t],r.deleted=[],this.dispatchEvent(r)}else{if(2!==e.length)throw new Error("Invalid arguments");this.set({name:e[0],value:e[1]})}}async delete(e={}){if("string"==typeof e)this.delete({name:e});else{if("object"!=typeof e||"string"!=typeof e.name)throw new TypeError("Failed to execute 'delete' on 'CookieStore': required member name is undefined.");{const t=await this.getAll(e);if(0!==t.length){const r=new Event("change");r.changed=[],r.deleted=new Array(t.length),t.forEach(((t,n)=>{t.path=e.path||"/",t.domain=e.domain||null,t.secure=e.secure||null,delete t.value,t.sameSite=e.sameSite||"lax",r.deleted[n]=t,I({...t,value:null,expires:1})})),this.dispatchEvent(r)}}}}}const C=new R(k.constructor);if(!P&&(globalThis.cookieStore=C),globalThis.hasOwnProperty("Animation")&&!Animation.prototype.hasOwnProperty("finished")&&Object.defineProperty(Animation.prototype,"finished",{get:function(){return new Promise(((e,t)=>{"finished"===this.playState?e(this):(this.addEventListener("finish",(()=>e(this)),{once:!0}),this.addEventListener("error",(e=>t(e)),{once:!0}))}))}}),globalThis.hasOwnProperty("Animation")&&!Animation.prototype.hasOwnProperty("ready")&&Object.defineProperty(Animation.prototype,"ready",{get:function(){return new Promise(((e,t)=>{this.pending?(this.addEventListener("ready",(()=>e(this)),{once:!0}),this.addEventListener("error",(e=>t(e)),{once:!0})):e(this)}))}}),"HTMLElement"in globalThis&&!("trustedTypes"in globalThis)){const Ae={key:Symbol("trust:key")},Me=new Set(Object.keys(HTMLElement.prototype).filter((e=>e.startsWith("on")))),Le=()=>{const e=document.head.querySelector('meta[http-equiv="Content-Security-Policy"][content]');if(e instanceof HTMLMetaElement){const t=e.content.trim().split(";").filter((e=>0!==e.length)).map((e=>e.trim())),r=Object.fromEntries(t.map((e=>{const[t,...r]=e.trim().split(" ").filter((e=>0!==e.length));return[t,r]}))),n=Array.isArray(r["require-trusted-types-for"])&&r["require-trusted-types-for"].includes("'script'"),o=n&&Array.isArray(r["trusted-types"])?new Set(r["trusted-types"]):new Set,a=o.has("'allow-duplicates'");return o.has("'none'")?o.clear():a&&o.delete("'allow-duplicates'"),{enforced:n,allowedPolicies:o,allowDuplicates:a}}if(document.documentElement.dataset.hasOwnProperty("trustedPolicies")){const e=new Set(document.documentElement.dataset.trustedPolicies.split(" ")),t=e.has("'allow-duplicates'"),r=e.has("'none'");return t&&e.delete("'allow-duplicates'"),r&&e.clear(),{enforced:!0,allowedPolicies:e,allowDuplicates:t}}return{enforced:!1,allowedPolicies:new Set,allowDuplicates:!0}};class Oe{#e;#t;#r;#n;constructor({enforced:e,allowedPolicies:t,allowDuplicates:r}={},n){if(n!==Ae.key)throw new TypeError("Invalid constructor of TrustedTypePolicyFactory.");if(!(t instanceof Set))throw new TypeError("`allowedPolicies` must be a Set.");this.#t=t,this.#r=e,this.#n=r,this.#e=new Map}get defaultPolicy(){return this.#e.has("default")?this.#e.get("default"):null}createPolicy(e,{createHTML:t,createScript:r,createScriptURL:n}){if(/^[-#a-zA-Z0-9=_/@.%]+$/.test(e.toString())){if(this.#r&&!this.#t.has(e))throw new TypeError(`${e} is not an allowed policy.`);if(!this.#n&&this.#e.has(e))throw new TypeError(`${e} has already been created and duplicates are not allowed.`);{const o=new xe(e.toString(),{createHTML:t,createScript:r,createScriptURL:n},Ae.key);return this.#e.set(o.name,o),o}}throw new TypeError(`Failed to execute 'createPolicy' on 'TrustedTypePolicyFactory': Policy: "${e}" contains invalid characters.`)}getAttributeType(e,t,r){if(e=e.toLowerCase(),t=t.toLowerCase(),"string"==typeof elementNS&&0!==r.length)return Me.has(t)?"TrustedScript":null;if(Me.has(t))return"TrustedScript";switch(e){case"script":return"src"===t?"TrustedScriptURL":null;case"iframe":return"srcdoc"===t?"TrustedHTML":"src"===t?"TrustedScriptURL":null;default:return null}}getPropertyType(e,t){if(e=e.toLowerCase(),Me.has(t.toLowerCase()))return"TrustedScript";switch(e){case"embed":case"iframe":return"src"===t?"TrustedScriptURL":null;case"script":return"src"===t?"TrustedScriptURL":["text","innerText","textContent","innerHTML"].includes(t)?"TrustedScript":["outerHTML"].includes(t)?"TrustedHTML":null;default:return["innerHTML","outerHTML"].includes(t)?"TrustedHTML":null}}isHTML(e){return e instanceof globalThis.TrustedHTML}isScript(e){return e instanceof globalThis.TrustedScript}isScriptURL(e){return e instanceof globalThis.TrustedScriptURL}get emptyHTML(){return new Pe("",Ae.key)}get emptyScript(){return new ke("",Ae.key)}get[Symbol.for("polyfilled")](){return!0}get[Symbol.for("enforced")](){return this.#r}}class xe{#o;#a;#i;#s;#e;constructor(e,{createHTML:t,createScript:r,createScriptURL:n},o){if(o!==Ae.key)throw new Error(`Invalid construction of ${e} policy.`);this.#o=e,this.#a=t,this.#i=r,this.#s=n}get name(){return this.#o}createHTML(e,...t){if(this.#a instanceof Function)return new Pe(this.#a(e.toString(),...t).toString(),Ae.key);throw new TypeError("This policy does not provide `createHTML()`")}createScript(e,...t){if(this.#i instanceof Function)return new ke(this.#i(e.toString(),...t).toString(),Ae.key);throw new TypeError("This policy does not provide `createScript()`")}createScriptURL(e,...t){if(this.#s instanceof Function)return new Ne(this.#s(e.toString(),...t).toString(),Ae.key);throw new TypeError("This policy does not provide `createScriptURL()`")}}class Fe{#l;constructor(e,t){if(t!==Ae.key)throw new Error("Invalid constructor of TrustedType.");this.#l=e}toString(){return this.#l}toJSON(){return this.#l}}class Pe extends Fe{}class ke extends Fe{}class Ne extends Fe{}globalThis.TrustedTypePolicyFactory=Oe,globalThis.trustedTypes=new Oe(Le(),Ae.key),globalThis.TrustedHTML=Pe,globalThis.TrustedScript=ke,globalThis.TrustedScriptURL=Ne}
23
+ */;const F="cookieStore"in globalThis,k={constructor:Symbol("constructor")};function N(){return 0===document.cookie.length?[]:document.cookie.split(";").map((e=>{const[t,r=null]=e.split("=");return{name:decodeURIComponent(t.trim()),value:"string"==typeof r?decodeURIComponent(r.trim()):null,path:void 0,expires:void 0,domain:void 0,sameSite:void 0,secure:void 0,partitioned:!1}}))}function j({name:e=null,value:t=null}={}){return"string"==typeof e&&(e=decodeURIComponent(e)),"string"==typeof t&&(t=decodeURIComponent(t)),"string"==typeof e&&"string"==typeof t?N().filter((r=>r.name===e&&r.value===t)):"string"==typeof e?N().filter((t=>t.name===e)):"string"==typeof t?N().filter((e=>e.value===t)):N()}function I({name:e,value:t,expires:r=null,maxAge:n=null,path:o="/",sameSite:a="lax",domain:i=null,secure:s=!1,partitioned:l=!1}){if(Number.isInteger(n))I({name:e,value:t,expires:Date.now()+n,path:o,sameSite:a,domain:i,secure:s,partitioned:l});else{let n=`${encodeURIComponent(e)}=`;t&&(n+=encodeURIComponent(t)),Number.isInteger(r)?n+=`;expires=${new Date(r).toUTCString()}`:r instanceof Date&&(n+=`;expires=${r.toUTCString()}`),"string"==typeof o&&(n+=`;path=${o}`),"string"==typeof i&&(n+=`;domain=${i}`),"string"==typeof a&&(n+=`;sameSite=${a}`),!0===s&&(n+=";secure"),!0===l&&(n+=";partitioned"),document.cookie=n}}class R extends EventTarget{constructor(e){if(e!==k.constructor)throw new DOMException("Invalid constructor");super(),Object.defineProperty(this,k.onchange,{enumerable:!1,configurable:!1,writable:!0,value:null})}get onchange(){return this[k.onchange]}set onchange(e){this[k.onchange]instanceof Function&&this.removeEventListener("change",this[k.onchange]),e instanceof Function&&this.addEventListener("change",e)}async get(e){const t=await this.getAll(e);return Array.isArray(t)&&0!==t.length?t[0]:null}async getAll(e){return j("string"==typeof e?{name:e}:e)}async set(...e){if(1===e.length&&"object"==typeof e[0]&&"string"==typeof e[0].name){const t=function({name:e,value:t=null,domain:r=null,path:n="/",expires:o=null,maxAge:a=null,sameSite:i="lax",secure:s=!1,partitioned:l=!1}){return{name:e,value:t,domain:r,path:n,expires:o,maxAge:a,sameSite:i,secure:s,partitioned:l}}(e[0]);I(t);const r=new Event("change");r.changed=[t],r.deleted=[],this.dispatchEvent(r)}else{if(2!==e.length)throw new Error("Invalid arguments");this.set({name:e[0],value:e[1]})}}async delete(e={}){if("string"==typeof e)this.delete({name:e});else{if("object"!=typeof e||"string"!=typeof e.name)throw new TypeError("Failed to execute 'delete' on 'CookieStore': required member name is undefined.");{const t=await this.getAll(e);if(0!==t.length){const r=new Event("change");r.changed=[],r.deleted=new Array(t.length),t.forEach(((t,n)=>{t.path=e.path||"/",t.domain=e.domain||null,t.secure=e.secure||null,delete t.value,t.sameSite=e.sameSite||"lax",r.deleted[n]=t,I({...t,value:null,expires:1})})),this.dispatchEvent(r)}}}}}const C=new R(k.constructor);if(!F&&(globalThis.cookieStore=C),globalThis.hasOwnProperty("Animation")&&!Animation.prototype.hasOwnProperty("finished")&&Object.defineProperty(Animation.prototype,"finished",{get:function(){return new Promise(((e,t)=>{"finished"===this.playState?e(this):(this.addEventListener("finish",(()=>e(this)),{once:!0}),this.addEventListener("error",(e=>t(e)),{once:!0}))}))}}),globalThis.hasOwnProperty("Animation")&&!Animation.prototype.hasOwnProperty("ready")&&Object.defineProperty(Animation.prototype,"ready",{get:function(){return new Promise(((e,t)=>{this.pending?(this.addEventListener("ready",(()=>e(this)),{once:!0}),this.addEventListener("error",(e=>t(e)),{once:!0})):e(this)}))}}),"HTMLElement"in globalThis&&!("trustedTypes"in globalThis)){const Ae={key:Symbol("trust:key")},Me=new Set(Object.keys(HTMLElement.prototype).filter((e=>e.startsWith("on")))),Le=()=>{const e=document.head.querySelector('meta[http-equiv="Content-Security-Policy"][content]');if(e instanceof HTMLMetaElement){const t=e.content.trim().split(";").filter((e=>0!==e.length)).map((e=>e.trim())),r=Object.fromEntries(t.map((e=>{const[t,...r]=e.trim().split(" ").filter((e=>0!==e.length));return[t,r]}))),n=Array.isArray(r["require-trusted-types-for"])&&r["require-trusted-types-for"].includes("'script'"),o=n&&Array.isArray(r["trusted-types"])?new Set(r["trusted-types"]):new Set,a=o.has("'allow-duplicates'");return o.has("'none'")?o.clear():a&&o.delete("'allow-duplicates'"),{enforced:n,allowedPolicies:o,allowDuplicates:a}}if(document.documentElement.dataset.hasOwnProperty("trustedPolicies")){const e=new Set(document.documentElement.dataset.trustedPolicies.split(" ")),t=e.has("'allow-duplicates'"),r=e.has("'none'");return t&&e.delete("'allow-duplicates'"),r&&e.clear(),{enforced:!0,allowedPolicies:e,allowDuplicates:t}}return{enforced:!1,allowedPolicies:new Set,allowDuplicates:!0}};class Oe{#e;#t;#r;#n;constructor({enforced:e,allowedPolicies:t,allowDuplicates:r}={},n){if(n!==Ae.key)throw new TypeError("Invalid constructor of TrustedTypePolicyFactory.");if(!(t instanceof Set))throw new TypeError("`allowedPolicies` must be a Set.");this.#t=t,this.#r=e,this.#n=r,this.#e=new Map}get defaultPolicy(){return this.#e.has("default")?this.#e.get("default"):null}createPolicy(e,{createHTML:t,createScript:r,createScriptURL:n}){if(/^[-#a-zA-Z0-9=_/@.%]+$/.test(e.toString())){if(this.#r&&!this.#t.has(e))throw new TypeError(`${e} is not an allowed policy.`);if(!this.#n&&this.#e.has(e))throw new TypeError(`${e} has already been created and duplicates are not allowed.`);{const o=new xe(e.toString(),{createHTML:t,createScript:r,createScriptURL:n},Ae.key);return this.#e.set(o.name,o),o}}throw new TypeError(`Failed to execute 'createPolicy' on 'TrustedTypePolicyFactory': Policy: "${e}" contains invalid characters.`)}getAttributeType(e,t,r){if(e=e.toLowerCase(),t=t.toLowerCase(),"string"==typeof elementNS&&0!==r.length)return Me.has(t)?"TrustedScript":null;if(Me.has(t))return"TrustedScript";switch(e){case"script":return"src"===t?"TrustedScriptURL":null;case"iframe":return"srcdoc"===t?"TrustedHTML":"src"===t?"TrustedScriptURL":null;default:return null}}getPropertyType(e,t){if(e=e.toLowerCase(),Me.has(t.toLowerCase()))return"TrustedScript";switch(e){case"embed":case"iframe":return"src"===t?"TrustedScriptURL":null;case"script":return"src"===t?"TrustedScriptURL":["text","innerText","textContent","innerHTML"].includes(t)?"TrustedScript":["outerHTML"].includes(t)?"TrustedHTML":null;default:return["innerHTML","outerHTML"].includes(t)?"TrustedHTML":null}}isHTML(e){return e instanceof globalThis.TrustedHTML}isScript(e){return e instanceof globalThis.TrustedScript}isScriptURL(e){return e instanceof globalThis.TrustedScriptURL}get emptyHTML(){return new Fe("",Ae.key)}get emptyScript(){return new ke("",Ae.key)}get[Symbol.for("polyfilled")](){return!0}get[Symbol.for("enforced")](){return this.#r}}class xe{#o;#a;#i;#s;#e;constructor(e,{createHTML:t,createScript:r,createScriptURL:n},o){if(o!==Ae.key)throw new Error(`Invalid construction of ${e} policy.`);this.#o=e,this.#a=t,this.#i=r,this.#s=n}get name(){return this.#o}createHTML(e,...t){if(this.#a instanceof Function)return new Fe(this.#a(e.toString(),...t).toString(),Ae.key);throw new TypeError("This policy does not provide `createHTML()`")}createScript(e,...t){if(this.#i instanceof Function)return new ke(this.#i(e.toString(),...t).toString(),Ae.key);throw new TypeError("This policy does not provide `createScript()`")}createScriptURL(e,...t){if(this.#s instanceof Function)return new Ne(this.#s(e.toString(),...t).toString(),Ae.key);throw new TypeError("This policy does not provide `createScriptURL()`")}}class Pe{#l;constructor(e,t){if(t!==Ae.key)throw new Error("Invalid constructor of TrustedType.");this.#l=e}toString(){return this.#l}toJSON(){return this.#l}}class Fe extends Pe{}class ke extends Pe{}class Ne extends Pe{}globalThis.TrustedTypePolicyFactory=Oe,globalThis.trustedTypes=new Oe(Le(),Ae.key),globalThis.TrustedHTML=Fe,globalThis.TrustedScript=ke,globalThis.TrustedScriptURL=Ne}
24
24
  /**
25
25
  * @copyright 2023-2024 Chris Zuber <admin@kernvalley.us>
26
26
  */("HTMLElement"in globalThis&&!("trustedTypes"in globalThis)||"HTMLElement"in globalThis&&globalThis.trustedTypes[Symbol.for("polyfilled")]&&globalThis.trustedTypes[Symbol.for("enforced")])&&function(){function e(){return"trustedTypes"in globalThis}function t(){return e()&&!Object.is(trustedTypes.defaultPolicy,null)}function r(r){if(function(t){return e()&&trustedTypes.isHTML(t)}(r)||!e())return r;if(t())return trustedTypes.defaultPolicy.createHTML(r);throw new TypeError("Attempting to set HTML and no default policy is available.")}function n(r){if(function(t){return e()&&trustedTypes.isScript(t)}(r)||!e())return r;if(t())return trustedTypes.defaultPolicy.createScript(r);throw new TypeError("Attempting to create script and no default policy is available.")}function o(r){if(function(t){return e()&&trustedTypes.isScriptURL(t)}(r)||!e())return r;if(t())return trustedTypes.defaultPolicy.createScriptURL(r);throw new TypeError("Attempting to create script URL and no default policy is available.")}function a(t,r,n){return e()?trustedTypes.getAttributeType(t,r,n):null}try{const{write:e,writeln:t,execCommand:n}=Object.getOwnPropertyDescriptors(Document.prototype);Object.defineProperties(Document.prototype,{write:{value:function(t){e.value.call(this,r(t))},enumerable:e.enumerable,configurable:e.configurable,writable:e.writable},writeln:{value:function(e){t.value.call(this,r(e))},enumerable:t.enumerable,configurable:t.configurable,writable:t.writable},execCommand:{value:function(e,t,o){return["insertHTML"].includes(e)?n.value.call(this,e,t,r(o)):n.value.call(this,e,t,o)},enumerable:n.enumerable,configurable:n.configurable}})}catch(e){console.error(e)}if("ServiceWorkerContainer"in globalThis)try{const e=Object.getOwnPropertyDescriptor(ServiceWorkerContainer.prototype,"register");Object.defineProperty(ServiceWorkerContainer.prototype,"register",{value:function(t,r){return e.value.call(this,o(t),r)},enumerable:e.enumerable,configurable:e.configurable})}catch(e){console.error(e)}try{const e=Object.getOwnPropertyDescriptor(Range.prototype,"createContextualFragment");Object.defineProperty(Range.prototype,"createContextualFragment",{value:function(t){return e.value.call(this,r(t))},enumerable:e.enumerable,configurable:e.configurable})}catch(e){console.error(e)}try{const{parseFromString:e}=Object.getOwnPropertyDescriptors(DOMParser.prototype);Object.defineProperties(DOMParser.prototype,{parseFromString:{value:function(t,n){return"text/html"===n?e.value.call(this,r(t),n):e.value.call(this,t,n)},enumerable:e.enumerable,configurable:e.configurable,writable:e.writable}})}catch(e){console.error(e)}try{const{src:e,text:t}=Object.getOwnPropertyDescriptors(HTMLScriptElement.prototype);Object.defineProperties(HTMLScriptElement.prototype,{text:{get:function(){return t.get.call(this)},set:function(e){t.set.call(this,n(e))},enumerable:t.enumerable,configurable:t.configurable},src:{get:function(){return e.get.call(this)},set:function(t){e.set.call(this,o(t))},enumerable:e.enumerable,configurable:e.configurable}})}catch(e){console.error(e)}try{const{setAttribute:e,setAttributeNS:t,innerHTML:i,outerHTML:s,insertAdjacentHTML:l}=Object.getOwnPropertyDescriptors(Element.prototype);Object.defineProperties(Element.prototype,{setAttribute:{value:function(t,i){switch(a(this.tagName,t)){case"TrustedHTML":e.value.call(this,t,r(i));break;case"TrustedScript":e.value.call(this,t,n(i));break;case"TrustedScriptURL":e.value.call(this,t,o(i));break;default:e.value.call(this,t,i)}},enumerable:e.enumerable,configurable:e.configurable},setAttributeNS:{value:function(e,i,s){switch(a(this.tagName,i,e)){case"TrustedHTML":t.value.call(this,e,i,r(s));break;case"TrustedScript":t.value.call(this,e,i,n(s));break;case"TrustedScriptURL":t.value.call(this,e,i,o(s));break;default:t.value.call(this,e,i,s)}},enumerable:t.enumerable,configurable:t.configurable},innerHTML:{get:function(){return i.get.call(this)},set:function(e){i.set.call(this,r(e))},enumerable:i.enumerable,configurable:i.configurable},outerHTML:{get:function(){return s.get.call(this)},set:function(e){s.set.call(this,r(e))},enumerable:s.enumerable,configurable:s.configurable},insertAdjacentHTML:{value:function(e,t){l.value.call(this,e,r(t))},enumerable:l.enumerable,configurable:l.configurable}})}catch(e){console.error(e)}try{const{srcdoc:e,src:t}=Object.getOwnPropertyDescriptors(HTMLIFrameElement.prototype);Object.defineProperties(HTMLIFrameElement.prototype,{srcdoc:{get:function(){return e.get.call(this)},set:function(t){e.set.call(this,r(t))},enumerable:e.enumerable,configurable:e.configurable},src:{get:function(){return t.get.call(this)},set:function(e){t.set.call(this,o(e))},enumerable:t.enumerable,configurable:t.configurable}})}catch(e){console.error(e)}try{const{data:e,codeBase:t}=Object.getOwnPropertyDescriptors(HTMLObjectElement.prototype);Object.defineProperties(HTMLObjectElement.prototype,{data:{get:function(){return e.get.call(this)},set:function(t){e.set.call(this,o(t))},enumerable:e.enumerable,configurable:e.configurable},codeBase:{get:function(){return t.get.call(this)},set:function(e){t.set.call(this,o(e))},enumerable:t.enumerable,configurable:t.configurable}})}catch(e){console.error(e)}try{const{eval:e,setTimeout:t,setInterval:r}=globalThis;globalThis.eval=function(t){return e(n(t).toString())},globalThis.setTimeout=function(e,r,...o){return"string"==typeof e?t(n(e),r,...o):t(e,r,...o)},globalThis.setInterval=function(e,t,...o){return"string"==typeof e?r(n(e),t,...o):r(e,t,...o)};try{const e=globalThis.Function;globalThis.Function=function(...t){if(0===t.length)return e();{const r=n(t.pop());return e(...t,r.toString())}},globalThis.Function.prototype=e.prototype,e.prototype.constructor=globalThis.Function}catch(e){console.error(e)}}catch(e){console.error(e)}}();const H={get(){return Array.from(this.styleSheets).filter((e=>e.ownerNode.classList.contains("_adopted")))},set(e){if(!Array.isArray(e))throw new TypeError("Must be an array");{const t=new Set(this.adoptedStyleSheets);t.difference(e).forEach((e=>e.ownerNode.remove()));const r=[...new Set(e).difference(t)].map((e=>{const t=document.createElement("link"),r=new AbortController,n=r.signal,o=URL.createObjectURL(new File([],"adopted.css",{type:"text/css"}));return t.rel="stylesheet",t.href=o,t.classList.add("_adopted"),t.disabled=e.disabled,t.addEventListener("load",(({target:n})=>{r.abort(),t.media=e.media.mediaText,[...e.cssRules].forEach(((e,t)=>{n.sheet.insertRule(e.cssText,t)})),setTimeout((()=>URL.revokeObjectURL(n.href)),100)}),{once:!0,signal:n}),t.addEventListener("error",(({target:e})=>{r.abort(),URL.revokeObjectURL(e.href)}),{once:!0,signal:n}),t}));this instanceof Document?this.head.append(...r):this.append(...r)}}};function D(e){for(;e.cssRules.length>0;)e.deleteRule(0)}r(Document.prototype,"adoptedStyleSheets",H),"ShadowRoot"in globalThis&&r(ShadowRoot.prototype,"adoptedStyleSheets",H);try{new CSSStyleSheet}catch{const je=globalThis.CSSStyleSheet;globalThis.CSSStyleSheet=function({disabled:e=!1,media:t}={}){const r=function(e="",{disabled:t=!1,media:r}={}){const n=Document.parseHTML(`<style>${e}</style>`,{sanitizer:new Sanitizer({allowElements:["style","html","head","body"]})}).styleSheets.item(0);return"string"==typeof r&&n.media.appendMedium(r),n.disabled=t,n}("#dfgbkjdfg{color:red;}",{disabled:e,media:t});return r.deleteRule(0),r},globalThis.CSSStyleSheet.prototype=je.prototype,je.prototype.constructor=globalThis.CSSStyleSheet}CSSStyleSheet.prototype.replace instanceof Function||(CSSStyleSheet.prototype.replace=function(e){const t=document.createElement("link"),r=new AbortController,{resolve:n,reject:o,promise:a}=Promise.withResolvers();return t.addEventListener("load",(({target:e})=>{D(this),[...e.sheet.cssRules].forEach(((e,t)=>this.insertRule(e.cssText,t))),n(this),r.abort(),URL.revokeObjectURL(e.href),e.remove()}),{once:!0,signal:r.signal}),t.addEventListener("error",(({target:e})=>{const t=new DOMException("Error loading stylesheet.");o(t),r.abort(t),URL.revokeObjectURL(e.href),e.remove()}),{once:!0,signal:r.signal}),t.rel="stylesheet",t.crossOrigin="anonymous",t.referrerPolicy="no-referrer",t.media="no-op",t.href=URL.createObjectURL(new File([e],"tmp.css",{type:"text/css"})),document.head.append(t),a}),CSSStyleSheet.prototype.replaceSync instanceof Function||(CSSStyleSheet.prototype.replaceSync=function(e){const t=Document.parseHTML(`<style>${e}</style>`,{sanitizer:new Sanitizer({allowElements:["style","html","head","body"]})}).styleSheets.item(0);D(this),[...t.cssRules].forEach(((e,t)=>this.insertRule(e.cssText,t)))});const U={ariaAtomic:"aria-atomic",ariaAutoComplete:"aria-autocomplete",ariaBusy:"aria-busy",ariaChecked:"aria-checked",ariaColCount:"aria-colcount",ariaColIndex:"aria-colindex",ariaColIndexText:"aria-colindextext",ariaColSpan:"aria-colspan",ariaCurrent:"aria-current",ariaDisabled:"aria-disabled",ariaExpanded:"aria-expanded",ariaHasPopup:"aria-haspopup",ariaHidden:"aria-hidden",ariaInvalid:"aria-invalid",ariaKeyShortcuts:"aria-keyshortcuts",ariaLabel:"aria-label",ariaLevel:"aria-level",ariaLive:"aria-live",ariaModal:"aria-modal",ariaMultiLine:"aria-multiline",ariaMultiSelectable:"aria-multiselectable",ariaOrientation:"aria-orientation",ariaPlaceholder:"aria-placeholder",ariaPosInSet:"aria-posinset",ariaPressed:"aria-pressed",ariaReadOnly:"aria-readonly",ariaRelevant:"aria-relevant",ariaRequired:"aria-required",ariaRoleDescription:"aria-roledescription",ariaRowCount:"aria-rowcount",ariaRowIndex:"aria-rowindex",ariaRowIndexText:"aria-rowindextext",ariaRowSpan:"aria-rowspan",ariaSelected:"aria-selected",ariaSetSize:"aria-setsize",ariaSort:"aria-sort",ariaValueMax:"aria-valuemax",ariaValueMin:"aria-valuemin",ariaValueNow:"aria-valuenow",ariaValueText:"aria-valuetext",role:"role"},q="http://www.w3.org/1999/xhtml",B=new Set(("HTMLElement"in globalThis?Object.keys(HTMLElement.prototype):[]).filter((e=>e.startsWith("on"))));
27
27
  /**
28
28
  * @copyright 2023-2024 Chris Zuber <admin@kernvalley.us>
29
- */function z(e,t=q){if("string"==typeof e)return Object.freeze({name:e,namespace:t});if("object"==typeof e&&"string"==typeof e.name){const{name:r,namespace:n=t,attributes:o}=e;return Object.freeze({name:r,namespace:"string"==typeof n&&0!==n.length?n:t,attributes:o})}throw new TypeError("Invalid config entry for `elements`.")}function $({elements:e,allowElements:t},r=q){if(Array.isArray(t))return console.warn("Use of `allowElements` is deprecated. Please use `elements` instead."),$({elements:t},r);if(Array.isArray(e))return e.map((e=>z(e,r)));throw new TypeError("`elements` expected to be an array.")}function _(e,t){if("string"==typeof e)return Object.freeze({name:e,namespace:t});if("object"==typeof e&&"string"==typeof e.name){const{name:r,namespace:n=t,elements:o,...a}=e;return Object.freeze({name:r,namespace:"string"==typeof n?n:t,elements:o,...a})}throw new TypeError("Invalid entry in `attributes` config.")}function V({attributes:e,allowAttributes:t},r){if(void 0!==t)return console.warn("Use of `allowAttributes` is deprecated. Please use `attributes` instead."),V({attributes:t},r);if(Array.isArray(e))return e.map((e=>_(e,r)));if("object"==typeof e&&null!==e)return console.warn("`attributes` should be an array, not an oobject."),V({attributes:Object.entries(e).map((([e,t])=>({name:e,elements:t})))},r);throw new TypeError("`attributes` expected to be an array.")}function W({comments:e,allowComments:t}){return"boolean"==typeof e?e:"boolean"==typeof t&&(console.warn("Use of `allowComments` is deprecated. Please use `comments` instead."),t)}function G({attributes:e,allowAttributes:t},r){return Object.freeze(Object.groupBy(V({attributes:e,allowAttributes:t},r),(({namespace:e})=>e??"")))}function Q({elements:e,allowElements:t},r=q){return Object.freeze(Object.groupBy($({elements:e,allowElements:t},r),(({namespace:e})=>e)))}const J=Object.freeze(["accesskey","autocapitalize","autofocus","class","contenteditable","dir","draggable","enterkeyhint","exportparts","hidden","id","inert","inputmode","itemid","itemprop","itemref","itemscope","itemtype","lang","part","popover","slot","spellcheck","tabindex","title","translate","virtualkeyboardpolicy","aria-keyshortcuts","aria-activedescendant","aria-atomic","aria-autocomplete","aria-braillelabel","aria-brailleroledescription","aria-busy","aria-checked","aria-colcount","aria-colindex","aria-colindextext","aria-colspan","aria-controls","aria-current","aria-describedby","aria-description","aria-details","aria-disabled","aria-dropeffect","aria-errormessage","aria-expanded","aria-flowto","aria-grabbed","aria-haspopup","aria-hidden","aria-invalid","aria-keyshortcuts","aria-label","aria-labelledby","aria-level","aria-live","aria-modal","aria-multiline","aria-multiselectable","aria-orientation","aria-owns","aria-placeholder","aria-posinset","aria-pressed","aria-readonly","aria-relevant","aria-required","aria-roledescription","aria-rowcount","aria-rowindex","aria-rowindextext","aria-rowspan","aria-selected","aria-setsize","aria-sort","aria-valuemax","aria-valuemin","aria-valuenow","aria-valuetext"].map((e=>_(e)))),X=!1,K=!0,Y=Object.freeze(["html","head","link","meta","body","address","article","aside","footer","header","h1","h2","h3","h4","h5","h6","hgroup","main","nav","section","search","blockquote","cite","div","dd","dt","dl","figcaption","figure","hr","li","ol","ul","menu","p","pre","a","abbr","b","bdi","bdo","br","code","data","dfn","em","i","kbd","mark","q","rp","ruby","rt","s","del","ins","samp","small","span","strong","sub","sup","time","u","var","wbr","area","audio","img","map","track","video","picture","source","canvas","caption","col","colgroup","table","tbody","tr","td","tfoot","th","thead","button","datalist","option","fieldset","label","form","input","legend","meter","optgroup","select","output","progress","textarea","details","summary","dialog","slot","template","dir","strike","selectmenu","center"].map((e=>z(e,q)))),Z=Object.freeze(["abbr","accept","accept-charset","align","alink","allow","allowfullscreen","alt","anchor","archive","as","async","autocomplete","autocorrect","autopictureinpicture","autoplay","axis","background","behavior","border","bordercolor","capture","cellpadding","cellspacing","challenge","char","charoff","charset","checked","cite","classid","clear","code","codetype","color","cols","colspan","compact","content","controls","controlslist","conversiondestination","coords","crossorigin","csp","data","datetime","declare","decoding","default","defer","direction","dirname","disabled","disablepictureinpicture","disableremoteplayback","disallowdocumentaccess","download","elementtiming","enctype","end","for","form","formenctype","formmethod","formnovalidate","formtarget","frameborder","headers","height","high","href","hreflang","hreftranslate","hspace","imagesizes","imagesrcset","importance","impressiondata","impressionexpiry","incremental","integrity","invisible","invoketarget","invokeaction","is","ismap","keytype","kind","label","language","latencyhint","leftmargin","link","list","loading","longdesc","loop","low","lowsrc","manifest","marginheight","marginwidth","max","maxlength","mayscript","media","method","min","minlength","multiple","muted","name","nohref","nomodule","noresize","noshade","novalidate","nowrap","object","open","optimum","pattern","ping","placeholder","playsinline","policy","popovertarget","popovertargetaction","poster","preload","pseudo","readonly","referrerpolicy","rel","reportingorigin","required","resources","rev","reversed","role","rows","rowspan","rules","sandbox","scheme","scope","scopes","scrollamount","scrolldelay","scrolling","select","selected","shadowrootmode","shadowrootdelegatesfocus","shape","size","sizes","span","src","srcdoc","srclang","srcset","standby","start","step","summary","target","text","topmargin","truespeed","trusttoken","type","usemap","valign","value","valuetype","version","vlink","vspace","webkitdirectory","width","wrap"].map((e=>_(e))).concat(J)),ee=Object.freeze({comments:X,elements:Y,attributes:Z,dataAttributes:K});
29
+ */function z(e,t=q){if("string"==typeof e)return Object.freeze({name:e,namespace:t});if("object"==typeof e&&"string"==typeof e.name){const{name:r,namespace:n=t,attributes:o}=e;return Object.freeze({name:r,namespace:"string"==typeof n&&0!==n.length?n:t,attributes:o})}throw new TypeError("Invalid config entry for `elements`.")}function $({elements:e,allowElements:t},r=q){if(Array.isArray(t))return console.warn("Use of `allowElements` is deprecated. Please use `elements` instead."),$({elements:t},r);if(Array.isArray(e))return e.map((e=>z(e,r)));throw new TypeError("`elements` expected to be an array.")}function _(e,t){if("string"==typeof e)return Object.freeze({name:e,namespace:t});if("object"==typeof e&&"string"==typeof e.name){const{name:r,namespace:n=t,elements:o,...a}=e;return Object.freeze({name:r,namespace:"string"==typeof n?n:t,elements:o,...a})}throw new TypeError("Invalid entry in `attributes` config.")}function V({attributes:e,allowAttributes:t},r){if(void 0!==t)return console.warn("Use of `allowAttributes` is deprecated. Please use `attributes` instead."),V({attributes:t},r);if(Array.isArray(e))return e.map((e=>_(e,r)));if("object"==typeof e&&null!==e)return console.warn("`attributes` should be an array, not an oobject."),V({attributes:Object.entries(e).map((([e,t])=>({name:e,elements:t})))},r);throw new TypeError("`attributes` expected to be an array.")}function W({comments:e,allowComments:t}){return"boolean"==typeof t?(console.warn("Use of `allowComments` is deprecated. Please use `comments` instead."),t):"boolean"!=typeof e||e}function G({attributes:e,allowAttributes:t},r){return Object.freeze(Object.groupBy(V({attributes:e,allowAttributes:t},r),(({namespace:e})=>e??"")))}function Q({elements:e,allowElements:t},r=q){return Object.freeze(Object.groupBy($({elements:e,allowElements:t},r),(({namespace:e})=>e)))}const J=Object.freeze(["accesskey","autocapitalize","autofocus","class","contenteditable","dir","draggable","enterkeyhint","exportparts","hidden","id","inert","inputmode","itemid","itemprop","itemref","itemscope","itemtype","lang","part","popover","slot","spellcheck","tabindex","title","translate","virtualkeyboardpolicy","aria-keyshortcuts","aria-activedescendant","aria-atomic","aria-autocomplete","aria-braillelabel","aria-brailleroledescription","aria-busy","aria-checked","aria-colcount","aria-colindex","aria-colindextext","aria-colspan","aria-controls","aria-current","aria-describedby","aria-description","aria-details","aria-disabled","aria-dropeffect","aria-errormessage","aria-expanded","aria-flowto","aria-grabbed","aria-haspopup","aria-hidden","aria-invalid","aria-keyshortcuts","aria-label","aria-labelledby","aria-level","aria-live","aria-modal","aria-multiline","aria-multiselectable","aria-orientation","aria-owns","aria-placeholder","aria-posinset","aria-pressed","aria-readonly","aria-relevant","aria-required","aria-roledescription","aria-rowcount","aria-rowindex","aria-rowindextext","aria-rowspan","aria-selected","aria-setsize","aria-sort","aria-valuemax","aria-valuemin","aria-valuenow","aria-valuetext"].map((e=>_(e)))),X=Object.freeze(["html","head","link","meta","body","address","article","aside","footer","header","h1","h2","h3","h4","h5","h6","hgroup","main","nav","section","search","blockquote","cite","div","dd","dt","dl","figcaption","figure","hr","li","ol","ul","menu","p","pre","a","abbr","b","bdi","bdo","br","code","data","dfn","em","i","kbd","mark","q","rp","ruby","rt","s","del","ins","samp","small","span","strong","sub","sup","time","u","var","wbr","area","audio","img","map","track","video","picture","source","canvas","caption","col","colgroup","table","tbody","tr","td","tfoot","th","thead","button","datalist","option","fieldset","label","form","input","legend","meter","optgroup","select","output","progress","textarea","details","summary","dialog","slot","template","dir","strike","selectmenu","center"].map((e=>z(e,q)))),K=Object.freeze(["abbr","accept","accept-charset","align","alink","allow","allowfullscreen","alt","anchor","archive","as","async","autocomplete","autocorrect","autopictureinpicture","autoplay","axis","background","behavior","border","bordercolor","capture","cellpadding","cellspacing","challenge","char","charoff","charset","checked","cite","classid","clear","code","codetype","color","cols","colspan","compact","content","controls","controlslist","conversiondestination","coords","crossorigin","csp","data","datetime","declare","decoding","default","defer","direction","dirname","disabled","disablepictureinpicture","disableremoteplayback","disallowdocumentaccess","download","elementtiming","enctype","end","for","form","formenctype","formmethod","formnovalidate","formtarget","frameborder","headers","height","high","href","hreflang","hreftranslate","hspace","imagesizes","imagesrcset","importance","impressiondata","impressionexpiry","incremental","integrity","invisible","invoketarget","invokeaction","is","ismap","keytype","kind","label","language","latencyhint","leftmargin","link","list","loading","longdesc","loop","low","lowsrc","manifest","marginheight","marginwidth","max","maxlength","mayscript","media","method","min","minlength","multiple","muted","name","nohref","nomodule","noresize","noshade","novalidate","nowrap","object","open","optimum","pattern","ping","placeholder","playsinline","policy","popovertarget","popovertargetaction","poster","preload","pseudo","readonly","referrerpolicy","rel","reportingorigin","required","resources","rev","reversed","role","rows","rowspan","rules","sandbox","scheme","scope","scopes","scrollamount","scrolldelay","scrolling","select","selected","shadowrootmode","shadowrootdelegatesfocus","shape","size","sizes","span","src","srcdoc","srclang","srcset","standby","start","step","summary","target","text","topmargin","truespeed","trusttoken","type","usemap","valign","value","valuetype","version","vlink","vspace","webkitdirectory","width","wrap"].map((e=>_(e))).concat(J)),Y=Object.freeze({comments:!0,elements:X,attributes:K,dataAttributes:!0});
30
30
  /**
31
31
  * @copyright 2023-2024 Chris Zuber <admin@kernvalley.us>
32
32
  * @see https://wicg.github.io/sanitizer-api/#default-configuration-dictionary
33
- */const te=new Set(["href","src","action","xlink:href"]),re=new Set(["javascript:","data:","file:","ftp:"]),ne=function(e,{createHTML:t,createScript:r,createScriptURL:n}){return"trustedTypes"in globalThis?trustedTypes.createPolicy(e,{createHTML:t,createScript:r,createScriptURL:n}):Object.freeze({[Symbol.for("policy-name")]:e.toString(),createHTML(r,...n){if(t instanceof Function){const e=t(r.toString(),...n).toString();return Object.freeze({toString:()=>e})}throw new TypeError(`Policy "${e}" does not provide a createHTML method.`)},createScript(t,...n){if(r instanceof Function){const e=r(t.toString(),...n).toString();return Object.freeze({toString:()=>e})}throw new TypeError(`Policy "${e}" does not provide a createScript method.`)},createScriptURL(t,...r){if(n instanceof Function){const e=n(t.toString(),...r).toString();return Object.freeze({toString:()=>e})}throw new TypeError(`Policy "${e}" does not provide a createScriptURL method.`)}})}("aegis-sanitizer#html",{createHTML:e=>e});function oe(e,t=ee,r=!1){if(e instanceof Node){const n=function(e,{elementNS:t=q,attributeNS:r}={}){if("object"!=typeof e||null===e)throw new TypeError("Sanitizer config must be an object.");if(e.getConfiguration instanceof Function){console.warn("`Sanitzer` objects are deprecated and will be removed.");const{allowElements:n,allowAttributes:o,allowComments:a,...i}=e.getConfiguration();return Object.freeze({elements:Q({elements:n},t),attributes:G({attributes:o},r),comments:a,...i})}return Object.freeze({elements:Q(e,t),attributes:G(e,r),comments:W(e),dataAttributes:void 0===e.dataAttributes||e.dataAttributes})}(t);return se(e,n,r)}throw new TypeError("Not a node.")}const ae="trustedTypes"in globalThis?e=>null!==trustedTypes.getAttributeType(e.ownerElement.tagName,e.localName,e.ownerElement.namespaceURI,e.namespaceURI):e=>B.has(e.localName);function ie(e,t,r=!1){const n=e.namespaceURI||"";return(!("dataAttributes"in t)||t.dataAttributes)&&e.name.startsWith("data-")||n in t.attributes&&t.attributes[n].some((t=>t.name===e.localName))&&!(r||ae(e))&&!(r||function(e){if(te.has(e.name)){if(URL.canParse(e.value)){const{protocol:t}=new URL(e.value);return re.has(t)}return!1}return!1}(e))}function se(e,t,r=!1){switch(e.nodeType){case Node.ELEMENT_NODE:!function(e,t,r){if(function(e,t){return e.namespaceURI in t.elements&&t.elements[e.namespaceURI].some((t=>t.name===e.localName))}(e,t)){if(e.hasAttributes()){const n=e.attributes;for(let e=n.length-1;-1!==e;e--)le(n[e],t,r)}if("TEMPLATE"===e.tagName)ce(e.content,t,r);else if(e.hasChildNodes()){const n=e.childNodes;for(let e=n.length-1;-1!==e;e--)se(n[e],t,r)}}else e.remove()}(e,t,r);break;case Node.DOCUMENT_NODE:case Node.DOCUMENT_FRAGMENT_NODE:ce(e,t,r);break;case Node.COMMENT_NODE:!function(e,t){t.comments||e.remove()}(e,t);break;case Node.ATTRIBUTE_NODE:le(e,t,r);break;case Node.TEXT_NODE:case Node.DOCUMENT_TYPE_NODE:break;default:e.ownerElement instanceof Element&&e.ownerElement.removeChild(e)}}function le(e,t,r=!1){!ie(e,t,r)&&e.ownerElement instanceof Element&&e.ownerElement.removeAttributeNode(e)}function ce(e,t,r=!1){if(e.hasChildNodes()){const n=e.childNodes;for(let e=n.length-1;-1!==e;e--)se(n[e],t,r)}}function ue({currentTarget:e}){switch(e.popoverTargetAction){case"show":e.popoverTargetElement.showPopover();break;case"hide":e.popoverTargetElement.hidePopover();break;default:e.popoverTargetElement.togglePopover()}}if(Promise.withResolvers instanceof Function||(Promise.withResolvers=function(){const e={};return e.promise=new Promise(((t,r)=>{e.resolve=t,e.reject=r})),e}),URL.canParse instanceof Function||(URL.canParse=function(e,t){try{return new URL(e,t),!0}catch{return!1}}),URL.parse instanceof Function||(URL.parse=function(e,t){return URL.canParse(e,t)?new URL(e,t):null}),Object.groupBy instanceof Function||(Object.groupBy=function(e,t){const r={};for(const n of e){const e=t(n);e in r?r[e].push(n):r[e]=[n]}return r}),Element.prototype.setHTML instanceof Function||(Element.prototype.setHTML=function(e,{sanitizer:{elements:t=Y,attributes:r=Z,comments:n=false,dataAttributes:o=true,...a}=ee}={}){!function(e,t,{sanitizer:r=ee,allowInsecure:n=!1}={}){const o=document.createElement("template");o.innerHTML=ne.createHTML(t),oe(o.content,r,n),e.replaceChildren(o.content)}(this,e,{sanitizer:{elements:t,attributes:r,comments:n,dataAttributes:o,...a}})}),Document.parseHTML instanceof Function||(Document.parseHTML=function(e,{sanitizer:{elements:t=Y,attributes:r=Z,comments:n=false,dataAttributes:o=true,...a}=ee}={}){return function(e,{sanitizer:t=ee,allowInsecure:r=!1}={}){const n=(new DOMParser).parseFromString(ne.createHTML(e),"text/html");return oe(n,t,r),n}(e,{sanitizer:{elements:t,attributes:r,comments:n,dataAttributes:o,...a}})}),globalThis.ToggleEvent instanceof Function){class Ie extends Event{#c;#u;constructor(e,{newState:t,oldState:r}){super(e,{bubbles:!0}),this.#c=t,this.#u=r}get newState(){return this.#c}get oldState(){return this.#u}}globalThis.ToggleEvent=Ie}if(!(HTMLElement.prototype.showPopover instanceof Function)){const Re=e=>e.classList.contains("_popover-open");Object.defineProperties(HTMLElement.prototype,{showPopover:{value:function(){if(!Re(this)){if(this.dispatchEvent(new ToggleEvent("beforetoggle",{oldState:"closed",newState:"open"})),"auto"===this.getAttribute("popover")){const e=new AbortController;document.body.addEventListener("click",(({target:t})=>{this.contains(t)||this.isSameNode(t.popoverTargetElement)||(e.abort(),this.hidePopover())}),{signal:e.signal,capture:!0}),document.body.addEventListener("keydown",(({key:t})=>{"Escape"===t&&(e.abort(),this.hidePopover())}),{signal:e.signal,capture:!0}),document.addEventListener("beforetoggle",(({target:t})=>{t.isSameNode(this)||"auto"!==t.getAttribute("popover")||(e.abort(),this.hidePopover())}),{signal:e.signal})}this.classList.add("_popover-open"),this.dispatchEvent(new ToggleEvent("toggle",{oldState:"closed",newState:"open"}))}}},hidePopover:{value:function(){Re(this)&&(this.dispatchEvent(new ToggleEvent("beforetoggle",{oldState:"open",newState:"closed"})),queueMicrotask((()=>this.classList.remove("_popover-open"))),this.dispatchEvent(new ToggleEvent("toggle",{oldState:"open",newState:"closed"})))}},togglePopover:{value:function(){Re(this)?this.hidePopover():this.showPopover()}}}),Object.defineProperties(HTMLButtonElement.prototype,{popoverTargetElement:{get(){return document.getElementById(this.getAttribute("popovertarget"))}},popoverTargetAction:{get(){return this.getAttribute("popovertargetaction")||"toggle"},set(e){this.setAttribute("popovertargetaction",e)}}}),function(e=document.body){e.querySelectorAll('button[popovertarget], input[type="button"][popovertarget]').forEach((e=>e.addEventListener("click",ue)))}()}if(HTMLScriptElement.supports instanceof Function||(HTMLScriptElement.supports=function(e){switch(e.toLowerCase()){case"classic":return!0;case"module":return"noModule"in HTMLScriptElement.prototype;default:return!1}}),!Element.prototype.hasOwnProperty(U.role)){const Ce=!0,He=!0,De=Object.fromEntries(Object.entries(U).map((([e,t])=>[e,{get:function(){return this.getAttribute(t)},set:function(e){"string"==typeof e?this.setAttribute(t,e):this.removeAttribute(t)},enumerable:Ce,configurable:He}])));Object.defineProperties(Element.prototype,De)}if(!HTMLElement.prototype.hasOwnProperty("inert")){const Ue=new WeakMap,qe=e=>{Ue.has(e)&&(e.tabIndex=Ue.get(e)),e.hasChildNodes()&&[...e.children].forEach(qe)},Be=e=>{-1!==e.tabIndex&&(Ue.set(e,e.tabIndex),e.tabIndex=-1),e.hasChildNodes()&&[...e.children].forEach(Be)};Object.defineProperty(HTMLElement.prototype,"inert",{get:function(){return this.hasAttribute("inert")},set:function(e){e?(this.setAttribute("aria-hidden","true"),this.setAttribute("inert",""),Be(this)):(this.removeAttribute("aria-hidden"),this.removeAttribute("inert"),qe(this))},enumerable:!0,configurable:!0})}if(HTMLImageElement.prototype.hasOwnProperty("complete")||Object.defineProperty(HTMLImageElement.prototype,"complete",{get:function(){return""===this.src||this.naturalHeight>0}}),HTMLImageElement.prototype.decode instanceof Function||(HTMLImageElement.prototype.decode=function(){return this.complete?Promise.resolve():new Promise(((e,t)=>{const r=()=>{this.removeEventListener("error",n),this.removeEventListener("load",r),e()},n=e=>{this.removeEventListener("error",n),this.removeEventListener("load",r),t(e)};this.addEventListener("load",r),this.addEventListener("error",n)}))}),!HTMLTemplateElement.prototype.hasOwnProperty("shadowRootMode")){Object.defineProperty(HTMLTemplateElement.prototype,"shadowRootMode",{get:function(){return this.getAttribute("shadowrootmode")},set:function(e){this.setAttribute("shadowrootmode",e)},enumerable:!0,configurable:!0});const ze=(e=document)=>{e.querySelectorAll("template[shadowrootmode]").forEach((e=>{const t=e.parentElement.attachShadow({mode:e.shadowRootMode});t.append(e.content),e.remove(),ze(t)}))};"loading"===document.readyState?document.addEventListener("readystatechange",(()=>ze(document)),{once:!0}):ze(document)}HTMLFormElement.prototype.requestSubmit instanceof Function||(HTMLFormElement.prototype.requestSubmit=function(e){if(void 0===e){const e=document.createElement("button");e.type="submit",e.hidden=!0,this.append(e),this.requestSubmit(e),setTimeout((()=>e.remove()),100)}else{if(!(e instanceof HTMLButtonElement||e instanceof HTMLInputElement))throw new TypeError("HTMLFormElement.requestSubmit: The submitter is not a submit button.");if(!("submit"===e.type||e instanceof HTMLInputElement&&"image"===e.type))throw new TypeError("HTMLFormElement.requestSubmit: The submitter is not a submit button.");if(!this.isSameNode(e.form))throw new DOMException("HTMLFormElement.requestSubmit: The submitter is not owned by this form.","NotFoundError");e.click()}}),"loading"in HTMLIFrameElement.prototype||r(HTMLIFrameElement.prototype,"loading",{get:function(){return this.getAttribute("loading")||"auto"},set:function(e){this.setAttribute("loading",e)}}),"credentialless"in HTMLIFrameElement.prototype||r(HTMLIFrameElement.prototype,"credentialless",{get:function(){return this.hasAttribute("credentialless")},set:function(e){this.toggleAttribute("credentialless",e)}});const pe="Expected a set-like object.",de=["has","keys"],fe=["size"],he=e=>e instanceof Set,me=e=>he(e)||"object"==typeof e&&null!==e&&de.every((t=>e[t]instanceof Function))&&fe.every((t=>t in e));Set.prototype.intersection instanceof Function||(Set.prototype.intersection=function(e){if(!me(e))throw new TypeError(pe);return new Set([...this].filter((t=>e.has(t))))}),Set.prototype.difference instanceof Function||(Set.prototype.difference=function(e){if(!me(e))throw new TypeError(pe);return new Set([...this].filter((t=>!e.has(t))))}),Set.prototype.union instanceof Function||(Set.prototype.union=function(e){return new Set([...this,...e])}),Set.prototype.isSubsetOf instanceof Function||(Set.prototype.isSubsetOf=function(e){if(!me(e))throw new TypeError(pe);return[...this].every((t=>e.has(t)))}),Set.prototype.isSupersetOf instanceof Function||(Set.prototype.isSupersetOf=function(e){if(!me(e))throw new TypeError(pe);return he(e)?e.isSubsetOf(this):new Set(e.keys()).isSubsetOf(this)}),Set.prototype.symmetricDifference instanceof Function||(Set.prototype.symmetricDifference=function(e){if(!me(e))throw new TypeError(pe);return he(e)?new Set([...this.difference(e),...e.difference(this)]):new Set([...this.difference(e),...new Set(e.keys()).difference(this)])}),Set.prototype.isDisjointFrom instanceof Function||(Set.prototype.isDisjointFrom=function(e){if(!me(e))throw new TypeError(pe);return new Set([...this,...e]).size===this.size+e.size}),WeakMap.prototype.emplace instanceof Function||(WeakMap.prototype.emplace=function(e,{insert:t,update:r}={}){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,t),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")}),function(){if("screen"in globalThis&&!(globalThis.getScreenDetails instanceof Function)){class e extends EventTarget{get availHeight(){return screen.availHeight}get availLeft(){return screen.availLeft}get availTop(){return screen.availTop}get availWidth(){return screen.availWidth}get colorDepth(){return screen.colorDepth}get devicePixelRatio(){return globalThis.devicePixelRatio||1}get height(){return screen.height}get isExtended(){return screen.isExtended}get isInternal(){return!0}get isPrimary(){return!0}get label(){return"Unknown"}get orientation(){return screen.orientation}get pixelDepth(){return screen.pixelDepth}get top(){return screen.top}get width(){return screen.width}}class t extends EventTarget{get currentScreen(){return new e}get screens(){return[this.currentScreen]}}Object.defineProperty(Screen.prototype,"isExtended",{enumerable:!0,configurable:!0,get:()=>!1}),globalThis.getScreenDetails=async()=>new t}}();
33
+ */const Z=new Set(["href","src","action","xlink:href"]),ee=new Set(["javascript:","data:","file:","ftp:"]),te=function(e,{createHTML:t,createScript:r,createScriptURL:n}){return"trustedTypes"in globalThis?trustedTypes.createPolicy(e,{createHTML:t,createScript:r,createScriptURL:n}):Object.freeze({[Symbol.for("policy-name")]:e.toString(),createHTML(r,...n){if(t instanceof Function){const e=t(r.toString(),...n).toString();return Object.freeze({toString:()=>e})}throw new TypeError(`Policy "${e}" does not provide a createHTML method.`)},createScript(t,...n){if(r instanceof Function){const e=r(t.toString(),...n).toString();return Object.freeze({toString:()=>e})}throw new TypeError(`Policy "${e}" does not provide a createScript method.`)},createScriptURL(t,...r){if(n instanceof Function){const e=n(t.toString(),...r).toString();return Object.freeze({toString:()=>e})}throw new TypeError(`Policy "${e}" does not provide a createScriptURL method.`)}})}("aegis-sanitizer#html",{createHTML:e=>e});function re(e,t,{elements:r=Y.elements,attributes:n=Y.attributes,comments:o=Y.comments,dataAttributes:a=Y.dataAttributes,...i}=Y,{allowInsecure:s=!1}={}){const l=document.createElement("template");l.innerHTML=te.createHTML(t),oe(l.content,{elements:r,attributes:n,comments:o,dataAttributes:a,...i},s),e.replaceChildren(l.content)}function ne(e,{elements:t=Y.elements,attributes:r=Y.attributes,comments:n=Y.comments,dataAttributes:o=Y.dataAttributes,...a}=Y,{allowInsecure:i=!1}={}){const s=(new DOMParser).parseFromString(te.createHTML(e),"text/html");return oe(s,{elements:t,attributes:r,comments:n,dataAttributes:o,...a},i),s}function oe(e,t=Y,r=!1){if(e instanceof Node){const n=function(e,{elementNS:t=q,attributeNS:r}={}){if("object"!=typeof e||null===e)throw new TypeError("Sanitizer config must be an object.");return Object.freeze({elements:Q(e,t),attributes:G(e,r),comments:W(e),dataAttributes:void 0===e.dataAttributes||e.dataAttributes})}(t);return se(e,n,r)}throw new TypeError("Not a node.")}const ae="trustedTypes"in globalThis?e=>null!==trustedTypes.getAttributeType(e.ownerElement.tagName,e.localName,e.ownerElement.namespaceURI,e.namespaceURI):e=>B.has(e.localName);function ie(e,t,r=!1){const n=e.namespaceURI||"";return(!("dataAttributes"in t)||t.dataAttributes)&&e.name.startsWith("data-")||n in t.attributes&&t.attributes[n].some((t=>t.name===e.localName))&&!(r||ae(e))&&!(r||function(e){if(Z.has(e.name)){if(URL.canParse(e.value)){const{protocol:t}=new URL(e.value);return ee.has(t)}return!1}return!1}(e))}function se(e,t,r=!1){switch(e.nodeType){case Node.ELEMENT_NODE:!function(e,t,r){if(function(e,t){return e.namespaceURI in t.elements&&t.elements[e.namespaceURI].some((t=>t.name===e.localName))}(e,t)){if(e.hasAttributes()){const n=e.attributes;for(let e=n.length-1;-1!==e;e--)le(n[e],t,r)}if("TEMPLATE"===e.tagName)ce(e.content,t,r);else if(e.hasChildNodes()){const n=e.childNodes;for(let e=n.length-1;-1!==e;e--)se(n[e],t,r)}}else e.remove()}(e,t,r);break;case Node.DOCUMENT_NODE:case Node.DOCUMENT_FRAGMENT_NODE:ce(e,t,r);break;case Node.COMMENT_NODE:!function(e,t){t.comments||e.remove()}(e,t);break;case Node.ATTRIBUTE_NODE:le(e,t,r);break;case Node.TEXT_NODE:case Node.DOCUMENT_TYPE_NODE:break;default:e.ownerElement instanceof Element&&e.ownerElement.removeChild(e)}}function le(e,t,r=!1){!ie(e,t,r)&&e.ownerElement instanceof Element&&e.ownerElement.removeAttributeNode(e)}function ce(e,t,r=!1){if(e.hasChildNodes()){const n=e.childNodes;for(let e=n.length-1;-1!==e;e--)se(n[e],t,r)}}function ue({currentTarget:e}){switch(e.popoverTargetAction){case"show":e.popoverTargetElement.showPopover();break;case"hide":e.popoverTargetElement.hidePopover();break;default:e.popoverTargetElement.togglePopover()}}if(Promise.withResolvers instanceof Function||(Promise.withResolvers=function(){const e={};return e.promise=new Promise(((t,r)=>{e.resolve=t,e.reject=r})),e}),URL.canParse instanceof Function||(URL.canParse=function(e,t){try{return new URL(e,t),!0}catch{return!1}}),URL.parse instanceof Function||(URL.parse=function(e,t){return URL.canParse(e,t)?new URL(e,t):null}),Object.groupBy instanceof Function||(Object.groupBy=function(e,t){const r={};for(const n of e){const e=t(n);e in r?r[e].push(n):r[e]=[n]}return r}),Element.prototype.setHTML instanceof Function||(Element.prototype.setHTML=function(e,{elements:t,attributes:r,comments:n,dataAttributes:o,sanitizer:a,...i}={}){"object"==typeof a&&null!==a?(console.warn("Use of `sanitizer` in config is deprecated. Please set config directly."),re(this,e,a.getConfiguration instanceof Function?a.getConfiguration():a)):re(this,e,{elements:t,attributes:r,comments:n,dataAttributes:o,...i})},DocumentFragment.prototype.setHTML=function(...e){Element.prototype.setHTML.apply(this,e)},HTMLTemplateElement.prototype.setHTML=function(e,t){this.content.setHTML(e,t)}),Document.parseHTML instanceof Function||(Document.parseHTML=function(e,{elements:t,attributes:r,comments:n,dataAttributes:o,sanitizer:a,...i}={}){return"object"==typeof a&&null!==a?Document.parseHTML(e,a.getConfiguration instanceof Function?a.getConfiguration():a):ne(e,{elements:t,attributes:r,comments:n,dataAttributes:o,...i})}),globalThis.ToggleEvent instanceof Function){class Ie extends Event{#c;#u;constructor(e,{newState:t,oldState:r}){super(e,{bubbles:!0}),this.#c=t,this.#u=r}get newState(){return this.#c}get oldState(){return this.#u}}globalThis.ToggleEvent=Ie}if(!(HTMLElement.prototype.showPopover instanceof Function)){const Re=e=>e.classList.contains("_popover-open");Object.defineProperties(HTMLElement.prototype,{showPopover:{value:function(){if(!Re(this)){if(this.dispatchEvent(new ToggleEvent("beforetoggle",{oldState:"closed",newState:"open"})),"auto"===this.getAttribute("popover")){const e=new AbortController;document.body.addEventListener("click",(({target:t})=>{this.contains(t)||this.isSameNode(t.popoverTargetElement)||(e.abort(),this.hidePopover())}),{signal:e.signal,capture:!0}),document.body.addEventListener("keydown",(({key:t})=>{"Escape"===t&&(e.abort(),this.hidePopover())}),{signal:e.signal,capture:!0}),document.addEventListener("beforetoggle",(({target:t})=>{t.isSameNode(this)||"auto"!==t.getAttribute("popover")||(e.abort(),this.hidePopover())}),{signal:e.signal})}this.classList.add("_popover-open"),this.dispatchEvent(new ToggleEvent("toggle",{oldState:"closed",newState:"open"}))}}},hidePopover:{value:function(){Re(this)&&(this.dispatchEvent(new ToggleEvent("beforetoggle",{oldState:"open",newState:"closed"})),queueMicrotask((()=>this.classList.remove("_popover-open"))),this.dispatchEvent(new ToggleEvent("toggle",{oldState:"open",newState:"closed"})))}},togglePopover:{value:function(){Re(this)?this.hidePopover():this.showPopover()}}}),Object.defineProperties(HTMLButtonElement.prototype,{popoverTargetElement:{get(){return document.getElementById(this.getAttribute("popovertarget"))}},popoverTargetAction:{get(){return this.getAttribute("popovertargetaction")||"toggle"},set(e){this.setAttribute("popovertargetaction",e)}}}),function(e=document.body){e.querySelectorAll('button[popovertarget], input[type="button"][popovertarget]').forEach((e=>e.addEventListener("click",ue)))}()}if(HTMLScriptElement.supports instanceof Function||(HTMLScriptElement.supports=function(e){switch(e.toLowerCase()){case"classic":return!0;case"module":return"noModule"in HTMLScriptElement.prototype;default:return!1}}),!Element.prototype.hasOwnProperty(U.role)){const Ce=!0,He=!0,De=Object.fromEntries(Object.entries(U).map((([e,t])=>[e,{get:function(){return this.getAttribute(t)},set:function(e){"string"==typeof e?this.setAttribute(t,e):this.removeAttribute(t)},enumerable:Ce,configurable:He}])));Object.defineProperties(Element.prototype,De)}if(!HTMLElement.prototype.hasOwnProperty("inert")){const Ue=new WeakMap,qe=e=>{Ue.has(e)&&(e.tabIndex=Ue.get(e)),e.hasChildNodes()&&[...e.children].forEach(qe)},Be=e=>{-1!==e.tabIndex&&(Ue.set(e,e.tabIndex),e.tabIndex=-1),e.hasChildNodes()&&[...e.children].forEach(Be)};Object.defineProperty(HTMLElement.prototype,"inert",{get:function(){return this.hasAttribute("inert")},set:function(e){e?(this.setAttribute("aria-hidden","true"),this.setAttribute("inert",""),Be(this)):(this.removeAttribute("aria-hidden"),this.removeAttribute("inert"),qe(this))},enumerable:!0,configurable:!0})}if(HTMLImageElement.prototype.hasOwnProperty("complete")||Object.defineProperty(HTMLImageElement.prototype,"complete",{get:function(){return""===this.src||this.naturalHeight>0}}),HTMLImageElement.prototype.decode instanceof Function||(HTMLImageElement.prototype.decode=function(){return this.complete?Promise.resolve():new Promise(((e,t)=>{const r=()=>{this.removeEventListener("error",n),this.removeEventListener("load",r),e()},n=e=>{this.removeEventListener("error",n),this.removeEventListener("load",r),t(e)};this.addEventListener("load",r),this.addEventListener("error",n)}))}),!HTMLTemplateElement.prototype.hasOwnProperty("shadowRootMode")){Object.defineProperty(HTMLTemplateElement.prototype,"shadowRootMode",{get:function(){return this.getAttribute("shadowrootmode")},set:function(e){this.setAttribute("shadowrootmode",e)},enumerable:!0,configurable:!0});const ze=(e=document)=>{e.querySelectorAll("template[shadowrootmode]").forEach((e=>{const t=e.parentElement.attachShadow({mode:e.shadowRootMode});t.append(e.content),e.remove(),ze(t)}))};"loading"===document.readyState?document.addEventListener("readystatechange",(()=>ze(document)),{once:!0}):ze(document)}HTMLFormElement.prototype.requestSubmit instanceof Function||(HTMLFormElement.prototype.requestSubmit=function(e){if(void 0===e){const e=document.createElement("button");e.type="submit",e.hidden=!0,this.append(e),this.requestSubmit(e),setTimeout((()=>e.remove()),100)}else{if(!(e instanceof HTMLButtonElement||e instanceof HTMLInputElement))throw new TypeError("HTMLFormElement.requestSubmit: The submitter is not a submit button.");if(!("submit"===e.type||e instanceof HTMLInputElement&&"image"===e.type))throw new TypeError("HTMLFormElement.requestSubmit: The submitter is not a submit button.");if(!this.isSameNode(e.form))throw new DOMException("HTMLFormElement.requestSubmit: The submitter is not owned by this form.","NotFoundError");e.click()}}),"loading"in HTMLIFrameElement.prototype||r(HTMLIFrameElement.prototype,"loading",{get:function(){return this.getAttribute("loading")||"auto"},set:function(e){this.setAttribute("loading",e)}}),"credentialless"in HTMLIFrameElement.prototype||r(HTMLIFrameElement.prototype,"credentialless",{get:function(){return this.hasAttribute("credentialless")},set:function(e){this.toggleAttribute("credentialless",e)}});const pe="Expected a set-like object.",de=["has","keys"],fe=["size"],he=e=>e instanceof Set,me=e=>he(e)||"object"==typeof e&&null!==e&&de.every((t=>e[t]instanceof Function))&&fe.every((t=>t in e));Set.prototype.intersection instanceof Function||(Set.prototype.intersection=function(e){if(!me(e))throw new TypeError(pe);return new Set([...this].filter((t=>e.has(t))))}),Set.prototype.difference instanceof Function||(Set.prototype.difference=function(e){if(!me(e))throw new TypeError(pe);return new Set([...this].filter((t=>!e.has(t))))}),Set.prototype.union instanceof Function||(Set.prototype.union=function(e){return new Set([...this,...e])}),Set.prototype.isSubsetOf instanceof Function||(Set.prototype.isSubsetOf=function(e){if(!me(e))throw new TypeError(pe);return[...this].every((t=>e.has(t)))}),Set.prototype.isSupersetOf instanceof Function||(Set.prototype.isSupersetOf=function(e){if(!me(e))throw new TypeError(pe);return he(e)?e.isSubsetOf(this):new Set(e.keys()).isSubsetOf(this)}),Set.prototype.symmetricDifference instanceof Function||(Set.prototype.symmetricDifference=function(e){if(!me(e))throw new TypeError(pe);return he(e)?new Set([...this.difference(e),...e.difference(this)]):new Set([...this.difference(e),...new Set(e.keys()).difference(this)])}),Set.prototype.isDisjointFrom instanceof Function||(Set.prototype.isDisjointFrom=function(e){if(!me(e))throw new TypeError(pe);return new Set([...this,...e]).size===this.size+e.size}),WeakMap.prototype.emplace instanceof Function||(WeakMap.prototype.emplace=function(e,{insert:t,update:r}={}){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,t),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")}),function(){if("screen"in globalThis&&!(globalThis.getScreenDetails instanceof Function)){class e extends EventTarget{get availHeight(){return screen.availHeight}get availLeft(){return screen.availLeft}get availTop(){return screen.availTop}get availWidth(){return screen.availWidth}get colorDepth(){return screen.colorDepth}get devicePixelRatio(){return globalThis.devicePixelRatio||1}get height(){return screen.height}get isExtended(){return screen.isExtended}get isInternal(){return!0}get isPrimary(){return!0}get label(){return"Unknown"}get orientation(){return screen.orientation}get pixelDepth(){return screen.pixelDepth}get top(){return screen.top}get width(){return screen.width}}class t extends EventTarget{get currentScreen(){return new e}get screens(){return[this.currentScreen]}}Object.defineProperty(Screen.prototype,"isExtended",{enumerable:!0,configurable:!0,get:()=>!1}),globalThis.getScreenDetails=async()=>new t}}();
34
34
  /**
35
35
  * @copyright 2023 Chris Zuber <admin@kernvalley.us>
36
36
  */