@shgysk8zer0/polyfills 0.2.6 → 0.2.8
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 +11 -0
- package/JSON.js +23 -0
- package/Record.js +25 -0
- package/Tuple.js +146 -0
- package/all.js +3 -0
- package/all.min.js +12 -12
- package/all.min.js.map +1 -1
- package/array.js +23 -0
- package/package.json +1 -1
package/all.min.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
!function(){"use strict";function e(e,t,n,{writable:o=!0,enumerable:r=!0,configurable:i=!0}={}){e[t]instanceof Function||Object.defineProperty(e,t,{value:n,writable:o,enumerable:r,configurable:i})}function t(e,t,{get:n,set:o,enumerable:r=!0,configurable:i=!0}={}){e.hasOwnProperty(t)||Object.defineProperty(e,t,{get:n,set:o,enumerable:r,configurable:i})}var n;!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,n,o)=>{const r=t.call(e,n,o);return e.hasOwnProperty(r)?e[r].push(n):e[r]=[n],e}),{})}),Map.prototype.emplace instanceof Function||(Map.prototype.emplace=function(e,{insert:t,update:n}={}){const o=this.has(e);if(o&&n instanceof Function){const t=this.get(e),o=n.call(this,t,e,this);return o!==t&&this.set(e,o),o}if(o)return this.get(e);if(t instanceof Function){const n=t.call(this,e,this);return this.set(e,n),n}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,n,o)=>(e.emplace(t.call(e,n,o),{insert:()=>[n],update:e=>(e.push(n),e)}),e)),new Map)}),function(){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 n=(e,o)=>{Array.isArray(e)&&o>=0?e.forEach((e=>n(e,o-1))):t.push(e)};return n(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 n;return this.forEach(((o,r,i)=>{e.call(t,o,r,i)&&(n=o)}),t),n}),Array.prototype.findLastIndex instanceof Function||(Array.prototype.findLastIndex=function(e,t){let n=-1;return this.forEach(((o,r,i)=>{e.call(t,o,r,i)&&(n=r)}),t),n}),!(Array.prototype.at instanceof Function)){const t=function(e){if((e=Math.trunc(e)||0)<0&&(e+=this.length),!(e<0||e>=this.length))return this[e]};for(const n of e)void 0!==n&&Object.defineProperty(n.prototype,"at",{value:t,writable:!0,enumerable:!1,configurable:!0})}!(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,n=globalThis){let o=[];for await(const t of e)o.push(await t);return Array.from(o,t,n)}),Array.prototype.equals instanceof Function||(Array.prototype.equals=function(e){return this===e||!!Array.isArray(e)&&(this.length===e.length&&this.every(((t,n)=>{const o=e[n];return Array.isArray(t)?Array.isArray(o)&&t.equals(o):Object.is(t,o)})))}),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((n=>{const o=n[e];return!t.includes(o)&&(t.push(o),!0)}))}if(e instanceof Function){const t=[];return this.filter(((...n)=>{try{const o=e.apply(this,n);return"string"==typeof o&&(!t.includes(o)&&(t.push(o),!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,...n){const o=[...this];return o.splice(e,t,...n),o}),Array.prototype.with instanceof Function||(Array.prototype.with=function(e,t){const n=[...this];return n[e]=t,n})}(),"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 n=this;return function(...o){if(e.has(n))return e.get(n);if("AsyncFunction"===n.constructor.name){const r=n.apply(t||n,o).catch((t=>{throw e.delete(n),t}));return e.set(n,r),r}if(n instanceof Function){const r=n.apply(t||n,o);return e.set(n,r),r}}}}}(),e(URL,"canParse",((e,t)=>{try{return new URL(e,t),!0}catch{return!1}})),Number.range instanceof Function||(Number.range=function(e,t,n=1){return console.warn("`Number.range()` is deprecated. Use `Iterator.range()` instead."),globalThis.Iterator.range(e,t,{step:n})}),function(){"Iterator"in globalThis||(globalThis.Iterator={prototype:Object.getPrototypeOf(Object.getPrototypeOf([][Symbol.iterator]()))});const e=globalThis.Iterator;e.range instanceof Function||(e.range=function*(t,n,o){if("number"==typeof o||"bigint"==typeof o)for(const r of e.range(t,n,{step:o}))yield r;else if("object"!=typeof o||Object.is(o,null))for(const o of e.range(t,n,{}))yield o;else{const{step:e=("number"==typeof t?t<n?1:-1:t<n?1n:-1n),inclusive:r=!1}=o;if("number"!=typeof t&&"bigint"!=typeof t)throw new TypeError("Start must be a number");if(Number.isNaN(t))throw new RangeError("Invalid start");if("number"!=typeof n&&"bigint"!=typeof n)throw new TypeError("End must be a number");if(Number.isNaN(n))throw new RangeError("Invalid end");if("number"!=typeof e&&"bigint"!=typeof e)throw new TypeError("Step must be a number");if(Number.isNaN(e))throw new RangeError("Invalid step");if(0===e)throw new RangeError("Step must not be 0");if(e<0&&t<n||e>0&&t>n)return;if(r)if(e>0)for(let o=t;o<=n;o+=e)yield o;else for(let o=t;o>=n;o+=e)yield o;else if(e>0)for(let o=t;o<n;o+=e)yield o;else for(let o=t;o>n;o+=e)yield o}}),e.prototype[Symbol.toStringTag]||(e.prototype[Symbol.toStringTag]="Iterator"),e.prototype.take instanceof Function||(e.prototype.take=function*(e){let t=0;for(const n of this){if(++t>e)break;yield n}}),e.prototype.drop instanceof Function||(e.prototype.drop=function*(e){let t=0;for(const n of this)t++>=e&&(yield n)}),e.prototype.toArray instanceof Function||(e.prototype.toArray=function(){return Array.from(this)}),e.prototype.forEach instanceof Function||(e.prototype.forEach=function(e){for(const t of this)e(t)}),e.prototype.map instanceof Function||(e.prototype.map=function*(e){for(const t of this)yield e(t)}),e.prototype.reduce instanceof Function||(e.prototype.reduce=function(e,t){let n=void 0===t?this.next().value:t;for(const t of this)n=e(n,t);return n}),e.prototype.filter instanceof Function||(e.prototype.filter=function*(e){for(const t of this)e(t)&&(yield t)}),e.prototype.some instanceof Function||(e.prototype.some=function(e){let t=!1;for(const n of this)if(e(n)){t=!0;break}return t}),e.prototype.every instanceof Function||(e.prototype.every=function(e){let t=!0;for(const n of this)if(!e(n)){t=!1;break}return t}),e.prototype.find instanceof Function||(e.prototype.find=function(e){for(const t of this)if(e(t))return t}),e.prototype.indexed instanceof Function||(e.prototype.indexed=function*(){let e=0;for(const t of this)yield[e++,t]})}(),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=(n=new Float32Array(1),function(e){return n[0]=e,n[0]})),Math.clamp instanceof Function||(Math.clamp=function(e,t,n){return Math.min(Math.max(e,t),n)}),Math.constrain instanceof Function||(Math.constrain=Math.clamp),function(){if(!("isSecureContext"in globalThis)){const e=["localhost","127.0.0.1"],t="https:",n=[t,"file:","wss:"],o=(e=globalThis.document)=>[...e.scripts].every((({src:n})=>{if(0===n.length)return!0;{const{protocol:o,hostname:r}=new URL(n,e.baseURI);return o===t||r===location.hostname}}));Object.defineProperty(globalThis,"isSecureContext",{enumerable:!0,configurable:!0,get:function(){return window.parent===window&&(!(!n.includes(location.protocol)&&!e.includes(location.hostname))&&o())}})}}();const o=new WeakMap;function r(e){return e instanceof Function&&"AsyncFunction"===e.constructor.name}function i(e){return"object"==typeof e&&!Object.is(e,null)&&!Array.isArray(e)}function a(e){switch(typeof e){case"undefined":return"Undefined";case"function":return"prototype"in e?a(e.prototype):"constructor"in e?e.constructor.name:"Function";case"object":return Object.is(e,null)?"Null":"constructor"in e?e.constructor.name:Symbol.toStringTag in e?e[Symbol.toStringTag]:"prototype"in e?a(e.prototype):(console.log(e),"Unknown Object");case"string":return"String";case"number":return Number.isNaN(e)?"NaN":"Number";case"bigint":return"BigInt";case"boolean":return"Boolean";case"symbol":return"Symbol";default:return"Unknown"}}function s(e,t){return e.once instanceof Function?e.once(t):function(...n){if(o.has(e))return o.get(e);if(r(e)){const r=e.apply(t||this,n).catch((t=>{throw o.delete(e),t}));return o.set(e,r),r}if(e instanceof Function){const r=e.apply(t||this,n);return o.set(e,r),r}}}
|
|
1
|
+
!function(){"use strict";function e(e,t,n,{writable:r=!0,enumerable:o=!0,configurable:i=!0}={}){e[t]instanceof Function||Object.defineProperty(e,t,{value:n,writable:r,enumerable:o,configurable:i})}function t(e,t,{get:n,set:r,enumerable:o=!0,configurable:i=!0}={}){e.hasOwnProperty(t)||Object.defineProperty(e,t,{get:n,set:r,enumerable:o,configurable:i})}var n;!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,n,r)=>{const o=t.call(e,n,r);return e.hasOwnProperty(o)?e[o].push(n):e[o]=[n],e}),{})}),Map.prototype.emplace instanceof Function||(Map.prototype.emplace=function(e,{insert:t,update:n}={}){const r=this.has(e);if(r&&n instanceof Function){const t=this.get(e),r=n.call(this,t,e,this);return r!==t&&this.set(e,r),r}if(r)return this.get(e);if(t instanceof Function){const n=t.call(this,e,this);return this.set(e,n),n}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,n,r)=>(e.emplace(t.call(e,n,r),{insert:()=>[n],update:e=>(e.push(n),e)}),e)),new Map)}),function(){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 n=(e,r)=>{Array.isArray(e)&&r>=0?e.forEach((e=>n(e,r-1))):t.push(e)};return n(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 n;return this.forEach(((r,o,i)=>{e.call(t,r,o,i)&&(n=r)}),t),n}),"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 n=-1;return this.forEach(((r,o,i)=>{e.call(t,r,o,i)&&(n=o)}),t),n}),!(Array.prototype.at instanceof Function)){const t=function(e){if((e=Math.trunc(e)||0)<0&&(e+=this.length),!(e<0||e>=this.length))return this[e]};for(const n of e)void 0!==n&&Object.defineProperty(n.prototype,"at",{value:t,writable:!0,enumerable:!1,configurable:!0})}!(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,n=globalThis){let r=[];for await(const t of e)r.push(await t);return Array.from(r,t,n)}),Array.prototype.equals instanceof Function||(Array.prototype.equals=function(e){return this===e||!!Array.isArray(e)&&(this.length===e.length&&this.every(((t,n)=>{const r=e[n];return Array.isArray(t)?Array.isArray(r)&&t.equals(r):Object.is(t,r)})))}),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((n=>{const r=n[e];return!t.includes(r)&&(t.push(r),!0)}))}if(e instanceof Function){const t=[];return this.filter(((...n)=>{try{const r=e.apply(this,n);return"string"==typeof r&&(!t.includes(r)&&(t.push(r),!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,...n){const r=[...this];return r.splice(e,t,...n),r}),Array.prototype.with instanceof Function||(Array.prototype.with=function(e,t){const n=[...this];return n[e]=t,n})}(),"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 n=this;return function(...r){if(e.has(n))return e.get(n);if("AsyncFunction"===n.constructor.name){const o=n.apply(t||n,r).catch((t=>{throw e.delete(n),t}));return e.set(n,o),o}if(n instanceof Function){const o=n.apply(t||n,r);return e.set(n,o),o}}}}}(),e(URL,"canParse",((e,t)=>{try{return new URL(e,t),!0}catch{return!1}})),Number.range instanceof Function||(Number.range=function(e,t,n=1){return console.warn("`Number.range()` is deprecated. Use `Iterator.range()` instead."),globalThis.Iterator.range(e,t,{step:n})}),function(){"Iterator"in globalThis||(globalThis.Iterator={prototype:Object.getPrototypeOf(Object.getPrototypeOf([][Symbol.iterator]()))});const e=globalThis.Iterator;e.range instanceof Function||(e.range=function*(t,n,r){if("number"==typeof r||"bigint"==typeof r)for(const o of e.range(t,n,{step:r}))yield o;else if("object"!=typeof r||Object.is(r,null))for(const r of e.range(t,n,{}))yield r;else{const{step:e=("number"==typeof t?t<n?1:-1:t<n?1n:-1n),inclusive:o=!1}=r;if("number"!=typeof t&&"bigint"!=typeof t)throw new TypeError("Start must be a number");if(Number.isNaN(t))throw new RangeError("Invalid start");if("number"!=typeof n&&"bigint"!=typeof n)throw new TypeError("End must be a number");if(Number.isNaN(n))throw new RangeError("Invalid end");if("number"!=typeof e&&"bigint"!=typeof e)throw new TypeError("Step must be a number");if(Number.isNaN(e))throw new RangeError("Invalid step");if(0===e)throw new RangeError("Step must not be 0");if(e<0&&t<n||e>0&&t>n)return;if(o)if(e>0)for(let r=t;r<=n;r+=e)yield r;else for(let r=t;r>=n;r+=e)yield r;else if(e>0)for(let r=t;r<n;r+=e)yield r;else for(let r=t;r>n;r+=e)yield r}}),e.prototype[Symbol.toStringTag]||(e.prototype[Symbol.toStringTag]="Iterator"),e.prototype.take instanceof Function||(e.prototype.take=function*(e){let t=0;for(const n of this){if(++t>e)break;yield n}}),e.prototype.drop instanceof Function||(e.prototype.drop=function*(e){let t=0;for(const n of this)t++>=e&&(yield n)}),e.prototype.toArray instanceof Function||(e.prototype.toArray=function(){return Array.from(this)}),e.prototype.forEach instanceof Function||(e.prototype.forEach=function(e){for(const t of this)e(t)}),e.prototype.map instanceof Function||(e.prototype.map=function*(e){for(const t of this)yield e(t)}),e.prototype.reduce instanceof Function||(e.prototype.reduce=function(e,t){let n=void 0===t?this.next().value:t;for(const t of this)n=e(n,t);return n}),e.prototype.filter instanceof Function||(e.prototype.filter=function*(e){for(const t of this)e(t)&&(yield t)}),e.prototype.some instanceof Function||(e.prototype.some=function(e){let t=!1;for(const n of this)if(e(n)){t=!0;break}return t}),e.prototype.every instanceof Function||(e.prototype.every=function(e){let t=!0;for(const n of this)if(!e(n)){t=!1;break}return t}),e.prototype.find instanceof Function||(e.prototype.find=function(e){for(const t of this)if(e(t))return t}),e.prototype.indexed instanceof Function||(e.prototype.indexed=function*(){let e=0;for(const t of this)yield[e++,t]})}(),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=(n=new Float32Array(1),function(e){return n[0]=e,n[0]})),Math.clamp instanceof Function||(Math.clamp=function(e,t,n){return Math.min(Math.max(e,t),n)}),Math.constrain instanceof Function||(Math.constrain=Math.clamp),function(){if(!("isSecureContext"in globalThis)){const e=["localhost","127.0.0.1"],t="https:",n=[t,"file:","wss:"],r=(e=globalThis.document)=>[...e.scripts].every((({src:n})=>{if(0===n.length)return!0;{const{protocol:r,hostname:o}=new URL(n,e.baseURI);return r===t||o===location.hostname}}));Object.defineProperty(globalThis,"isSecureContext",{enumerable:!0,configurable:!0,get:function(){return window.parent===window&&(!(!n.includes(location.protocol)&&!e.includes(location.hostname))&&r())}})}}();const r=new WeakMap;function o(e){return e instanceof Function&&"AsyncFunction"===e.constructor.name}function i(e){return"object"==typeof e&&!Object.is(e,null)&&!Array.isArray(e)}function a(e){switch(typeof e){case"undefined":return"Undefined";case"function":return"prototype"in e?a(e.prototype):"constructor"in e?e.constructor.name:"Function";case"object":return Object.is(e,null)?"Null":"constructor"in e?e.constructor.name:Symbol.toStringTag in e?e[Symbol.toStringTag]:"prototype"in e?a(e.prototype):(console.log(e),"Unknown Object");case"string":return"String";case"number":return Number.isNaN(e)?"NaN":"Number";case"bigint":return"BigInt";case"boolean":return"Boolean";case"symbol":return"Symbol";default:return"Unknown"}}function s(e,t){return e.once instanceof Function?e.once(t):function(...n){if(r.has(e))return r.get(e);if(o(e)){const o=e.apply(t||this,n).catch((t=>{throw r.delete(e),t}));return r.set(e,o),o}if(e instanceof Function){const o=e.apply(t||this,n);return r.set(e,o),o}}}
|
|
2
2
|
/**
|
|
3
3
|
* @copyright 2023 Chris Zuber <admin@kernvalley.us>
|
|
4
4
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/Lock
|
|
5
5
|
*/const l=new WeakMap;class c{constructor(e,t="exclusive"){if(!["exclusive","shared"].includes(t))throw new TypeError(`'${t}' (value of 'mode' member of LockOptions) is not a valid value for enumeration LockMode.`);if("string"!=typeof e&&(e=e.toString()),e.startsWith("-"))throw new DOMException("Names starting with `-` are reserved");l.set(this,{name:e,mode:t})}get name(){return l.get(this).name}get mode(){return l.get(this).mode}}
|
|
6
6
|
/**
|
|
7
7
|
* @copyright 2023 Chris Zuber <admin@kernvalley.us>
|
|
8
|
-
*/const u=new Map,p=Symbol("lock-key"),d="locks"in navigator&&navigator.locks.request instanceof Function;const m=async function(){return await new Promise((e=>{"locks"in navigator&&navigator.locks.request instanceof Function?navigator.locks.query().then((()=>e(!0))).catch((()=>e(!1))):e(!1)}))}();async function f(e,t=null){return new Promise(((n,o)=>{var i;r(i=e)||i instanceof Promise?e.call(globalThis,t).then(n,o):queueMicrotask((()=>{try{const o=e.call(globalThis,t);n(o)}catch(e){o(e)}}))}))}async function h(e){u.has(e)&&await u.get(e).promise.catch(console.error)}function y(e,t,n){const{resolve:o,reject:r,promise:i}=function(){if(Promise.withResolvers instanceof Function)return Promise.withResolvers();{const e={};return e.promise=new Promise(((t,n)=>{e.resolve=t,e.reject=n})),e}}(),a=new AbortController,s=new c(e,t),l=function({name:e,mode:t}){switch(t){case"exclusive":return b().some((t=>t.name===e));case"shared":return b().some((t=>t.name===e&&"exclusive"===t.mode))}}(s);return u.set(s,{resolve:o,reject:r,promise:i,callback:n,pending:l,controller:a}),s}function g(e){return e instanceof c&&u.has(e)&&u.get(e).pending}function b(e){return"string"==typeof e?[...u.keys()].filter((t=>t.name===e)):[...u.keys()]}function w(e){return b(e).filter((e=>!g(e)))}function T(e){return b(e).filter((e=>g(e)))}async function v(e){switch(e.mode){case"exclusive":await Promise.allSettled(b().filter((t=>t.name===e.name&&t!==e)).map(h));break;case"shared":await Promise.allSettled(b().filter((t=>t.name===e.name&&"exclusive"===t.mode&&t!==e)).map(h))}}function E(e){if(u.has(e))return u.get(e).controller.signal}async function S(e){if(u.has(e)){const{resolve:t,reject:n,promise:o,callback:r,pending:i,controller:a}=u.get(e);return i&&function(e,t=!0){u.has(e)&&u.set(e,{...u.get(e),pending:t})}(e,!1),f(r,e).then(t,n).finally((()=>{u.delete(e),requestIdleCallback((()=>a.abort()))})),o}}class M{constructor(e){if(e!==p)throw new TypeError("Invalid constructor")}static async request(e,...t){let n,o={};t[0]instanceof Function?n=t[0]:t[1]instanceof Function&&([o,n]=t),"string"!=typeof e&&(e=e.toString());const{mode:r="exclusive",ifAvailable:i=!1,steal:a=!1,signal:s}=o;if(a&&i)throw new DOMException("LockManager.request: `steal` and `ifAvailable` cannot be used together");if(e.startsWith("-"))throw new DOMException("LockManager.request: Names starting with `-` are reserved");if(!["exclusive","shared"].includes(r))throw new TypeError(`LockManager.request: '${r}' (value of 'mode' member of LockOptions) is not a valid value for enumeration LockMode.`);if(s instanceof AbortSignal&&s.aborted)throw s.reason;if("shared"===r&&a)throw new DOMException("LockManager.request: `steal` is only supported for exclusive lock requests");const l=w(e),c=T(e),p=[...l,...c].some((t=>t.name===e));a&&p&&function(e){[...u.entries()].filter((([t])=>t.name===e)).forEach((([e,{reject:t,controller:n}])=>{requestIdleCallback((()=>{n.abort(),u.delete(e)})),t(new DOMException("The lock request is aborted"))}))}(e);const d=y(e,r,n);switch(s instanceof AbortSignal&&s.addEventListener("abort",(()=>{if(u.has(d)){const{reject:e,controller:t}=u.get(d);u.delete(d),e(new DOMException("The lock request is aborted")),t.abort()}}),{once:!0,signal:E(d)}),r){case"exclusive":if(!i||0===l.length&&0===c.length)return await v(d),await S(d);{const e=u.get(d).controller;return u.delete(d),await f(n,null).then((t=>(requestIdleCallback((()=>e.abort())),t)))}case"shared":if(i){if([...l,...c].some((e=>"exclusive"===e.mode))){const e=u.get(d).controller;return u.delete(d),await f(n,null).then((t=>(requestIdleCallback((()=>e.abort())),t)))}return await v(d),await S(d)}return await v(d),await S(d);default:throw new TypeError(`LockManager.request: '${r}' (value of 'mode' member of LockOptions) is not a valid value for enumeration LockMode.`)}}static async query(){return{held:w().map((({name:e,mode:t})=>({name:e,mode:t,clientId:null}))),pending:T().map((({name:e,mode:t})=>({name:e,mode:t,clientId:null})))}}}function A(e,t="error"){if(e instanceof Error){const{message:n,name:o,fileName:r,lineNumber:i,columnNumber:a}=e;return new ErrorEvent(t,{error:e,message:`${o}: ${n}`,filename:r,lineno:i,colno:a})}throw new TypeError("`errorToEvent()` only accepts Errors")}let L=!1;new Promise((async e=>{if(d)if(await m)e(!1);else try{navigator.locks.request=M.request,navigator.locks.query=M.query,L=!0,e(!0)}catch(t){globalThis.dispatchEvent(A(t)),e(!1)}else try{navigator.locks=M,L=!0,e(!0)}catch(t){globalThis.dispatchEvent(A(t)),e(!1)}})),navigator.canShare instanceof Function||(navigator.canShare=function({title:e,text:t,url:n,files:o}={}){return navigator.share instanceof Function&&(!Array.isArray(o)||0===o.length)&&(!![e,t,n].every((e=>void 0===e))||[e,t,n].some((e=>"string"==typeof e&&0!==e.length)))}),navigator.setAppBadge instanceof Function||(navigator.setAppBadge=async e=>{if(!Number.isInteger(e))throw new TypeError("Failed to execute 'setAppBadge' on 'Navigator': Value is not of type 'unsigned long long'");if(e<0)throw new TypeError("Failed to execute 'setAppBadge' on 'Navigator': Value is outside the 'unsigned long long' value range.");0===e?document.title.startsWith("(")&&(document.title=document.title.replace(/^\((\d{1,2}\+?)\)\s/,"")):e<100?(await navigator.clearAppBadge(),document.title=`(${e}) ${document.title}`):(await navigator.clearAppBadge(),document.title=`(99+) ${document.title}`)}),navigator.clearAppBadge instanceof Function||(navigator.clearAppBadge=()=>navigator.setAppBadge(0)),Navigator.prototype.hasOwnProperty("pdfViewerEnabled")||Object.defineProperty(navigator,"pdfViewerEnabled",{enumerable:!0,configurable:!1,writable:!1,value:!1}),Navigator.prototype.getInstalledRelatedApps instanceof Function||(Navigator.prototype.getInstalledRelatedApps=async()=>[]),Navigator.prototype.getGamepads instanceof Function||(Navigator.prototype.getGamepads=()=>[]),"hardwareConcurrency"in Navigator.prototype||Object.defineProperty(Navigator.prototype,"hardwareConcurrency",{get:()=>1}),"connection"in Navigator.prototype?"type"in navigator.connection||(navigator.connection.type="unknown"):Object.defineProperty(Navigator.prototype,"connection",{get:()=>Object.create(EventTarget.prototype,{type:{value:"unknown"},effectiveType:{value:"4g"},rtt:{value:NaN},downlink:{value:NaN},downlinkMax:{value:1/0},saveData:{value:!1},onchange:{value:null,writable:!0},ontypechange:{value:null,writable:!0}})}),"doNotTrack"in Navigator.prototype||Object.defineProperty(Navigator.prototype,"doNotTrack",{get:()=>"unspecified"}),"globalPrivacyControl"in Navigator.prototype||Object.defineProperty(Navigator.prototype,"globalPrivacyControl",{get:()=>!1}),function(){if(!(globalThis.requestIdleCallback instanceof Function)){const e=e=>Number.isSafeInteger(e)&&e>0;globalThis.requestIdleCallback=function(t,{timeout:n}={}){const o=performance.now(),r=()=>e(n)?Math.max(0,n-(performance.now()-o)):Math.max(0,600-(performance.now()-o));return setTimeout((()=>t({didTimeout:!!e(n)&&0===r(),timeRemaining:r})),1)}}globalThis.cancelIdleCallback instanceof Function||(globalThis.cancelIdleCallback=e=>clearTimeout(e)),globalThis.requestAnimationFrame instanceof Function||(globalThis.requestAnimationFrame=e=>setTimeout((()=>e(performance.now())),1e3/60)),globalThis.cancelAnimationFrame instanceof Function||(globalThis.cancelAnimationFrame=e=>clearTimeout(e)),globalThis.queueMicrotask instanceof Function||(globalThis.queueMicrotask=e=>Promise.resolve().then(e).catch((e=>setTimeout((()=>{throw e})))))}(),function(){if(!("AbortSignal"in globalThis)){const e={signal:Symbol("signal"),aborted:Symbol("aborted"),reason:Symbol("reason"),onabort:Symbol("onabort")};globalThis.AbortError=class extends Error{},globalThis.AbortSignal=class t extends EventTarget{constructor(){super(),Object.defineProperties(this,{[e.aborted]:{enumerable:!1,writable:!0,configurable:!1,value:!1},[e.reason]:{enumerable:!1,writable:!0,configurable:!1,value:void 0},[e.onabort]:{enumerable:!1,writable:!0,configurable:!1,value:null}}),this.addEventListener("abort",(e=>{this.onabort instanceof Function&&this.onabort.call(this,e)}))}get aborted(){return this[e.aborted]}get onabort(){return this[e.onabort]}set onabort(t){this[e.onabort]=t instanceof Function?t:null}get reason(){return this[e.reason]}throwIfAborted(){if(this.aborted)throw this.reason}static abort(n=new DOMException("Operation aborted")){const o=new t;return o[e.aborted]=!0,o[e.reason]=n,o}},globalThis.AbortController=class{constructor(){this[e.signal]=new AbortSignal}get signal(){return this[e.signal]}abort(t=new DOMException("Operation aborted")){const n=this.signal;n.aborted||(n[e.aborted]=!0,n[e.reason]=t,n.dispatchEvent(new Event("abort")))}}}if(!("reason"in AbortSignal.prototype)){const e=new WeakMap,t=AbortController.prototype.abort;if(AbortSignal.abort instanceof Function){const t=AbortSignal.abort;AbortSignal.abort=function(n=new DOMException("Operation aborted")){const o=t();return e.set(o,n),o}}else AbortSignal.abort=function(e=new DOMException("Operation aborted")){const t=new AbortController;return t.abort(e),t.reason};Object.defineProperty(AbortSignal.prototype,"reason",{enumerable:!0,configurable:!0,get:function(){return e.has(this)?e.get(this):void 0}}),AbortController.prototype.abort=function(n=new DOMException("Operation aborted")){e.set(this.signal,n),t.call(this)}}AbortSignal.prototype.throwIfAborted instanceof Function||(AbortSignal.prototype.throwIfAborted=function(){if(this.aborted)throw this.reason}),AbortSignal.timeout instanceof Function||(AbortSignal.timeout=function(e){if(void 0===e)throw new TypeError("At least one 1 argument required but only 0 passed");if(Number.isFinite(e)){if(e<0)throw new TypeError("Argument 1 is out of range for unsigned long long.");{const t=new AbortController;return setTimeout((()=>t.abort(new DOMException("The operation timed out."))),e),t.signal}}throw new TypeError("Argument 1 is not a finite value, so it is out of range for unsigned long long.")}),AbortSignal.any instanceof Function||(AbortSignal.any=function(e){if(!Array.isArray(e))throw new TypeError("Expected an array of signals");const t=new AbortController;for(const n of e){if(!(n instanceof AbortSignal)){const e=new TypeError("`signal` is not an `AbortSignal`");throw t.abort(e),e}if(n.aborted){t.abort(n.reason||new DOMException("Operation aborted."));break}n.addEventListener("abort",(({target:e})=>{t.abort(e.reason||new DOMException("Operation aborted."))}),{signal:t.signal})}return t.signal})}(),globalThis.hasOwnProperty("AggregateError")||(globalThis.AggregateError=class extends Error{constructor(e,t){void 0===t?(super(e),this.errors=[]):(super(t),this.errors=e)}}),globalThis.reportError instanceof Function||(globalThis.reportError=function(e){globalThis.dispatchEvent(A(e))}),function(){if("MediaQueryListEvent"in globalThis||(globalThis.MediaQueryListEvent=class extends Event{constructor(e,{media:t,matches:n}={}){super(e),Object.defineProperties(this,{media:{enumerable:!0,configurable:!1,writable:!1,value:t},matches:{enumerable:!0,configurable:!1,writable:!1,value:n}})}}),"MediaQueryList"in globalThis&&!(globalThis.MediaQueryList.prototype.addEventListener instanceof Function)){const e=new WeakMap,t=function(){const{media:e,matches:t}=this;this.dispatchEvent(new MediaQueryListEvent("change",{media:e,matches:t}))},n=function(n){return e.has(n)||(e.set(n,new EventTarget),n.addListener(t.bind(n))),e.get(n)};globalThis.MediaQueryList.prototype.addEventListener=function(e,t,o){n(this).addEventListener(e,t,o)},globalThis.MediaQueryList.prototype.removeEventListener=function(e,t,o){n(this).removeEventListener(e,t,o)},globalThis.MediaQueryList.prototype.dispatchEvent=function(e){n(this).dispatchEvent(e)}}}(),"Promise"in globalThis&&(Promise.prototype.finally instanceof Function||(Promise.prototype.finally=function(e){return this.then((async t=>(await e(),t)),(async t=>(await e(),t)))}),Promise.allSettled instanceof Function||(Promise.allSettled=function(e){return Promise.all(Array.from(e).map((function(e){return new Promise((function(t){e instanceof Promise||(e=Promise.resolve(e)),e.then((function(e){t({status:"fulfilled",value:e})})).catch((function(e){t({status:"rejected",reason:e})}))}))})))}),Promise.any instanceof Function||(Promise.any=e=>new Promise(((t,n)=>{let o=[];e.forEach((r=>{r.then(t).catch((t=>{o.push(t),o.length===e.length&&n(new globalThis.AggregateError(o,"No Promise in Promise.any was resolved"))}))}))}))),Promise.race instanceof Function||(Promise.race=e=>new Promise(((t,n)=>{e.forEach((e=>e.then(t,n)))}))),Promise.try instanceof Function||(Promise.try=e=>new Promise((t=>t(e())))),Promise.withResolvers instanceof Function||(Promise.withResolvers=function(){const e={};return e.promise=new Promise(((t,n)=>{e.resolve=t,e.reject=n})),e}))
|
|
8
|
+
*/const u=new Map,p=Symbol("lock-key"),d="locks"in navigator&&navigator.locks.request instanceof Function;const f=async function(){return await new Promise((e=>{"locks"in navigator&&navigator.locks.request instanceof Function?navigator.locks.query().then((()=>e(!0))).catch((()=>e(!1))):e(!1)}))}();async function m(e,t=null){return new Promise(((n,r)=>{var i;o(i=e)||i instanceof Promise?e.call(globalThis,t).then(n,r):queueMicrotask((()=>{try{const r=e.call(globalThis,t);n(r)}catch(e){r(e)}}))}))}async function h(e){u.has(e)&&await u.get(e).promise.catch(console.error)}function y(e,t,n){const{resolve:r,reject:o,promise:i}=function(){if(Promise.withResolvers instanceof Function)return Promise.withResolvers();{const e={};return e.promise=new Promise(((t,n)=>{e.resolve=t,e.reject=n})),e}}(),a=new AbortController,s=new c(e,t),l=function({name:e,mode:t}){switch(t){case"exclusive":return g().some((t=>t.name===e));case"shared":return g().some((t=>t.name===e&&"exclusive"===t.mode))}}(s);return u.set(s,{resolve:r,reject:o,promise:i,callback:n,pending:l,controller:a}),s}function b(e){return e instanceof c&&u.has(e)&&u.get(e).pending}function g(e){return"string"==typeof e?[...u.keys()].filter((t=>t.name===e)):[...u.keys()]}function w(e){return g(e).filter((e=>!b(e)))}function T(e){return g(e).filter((e=>b(e)))}async function v(e){switch(e.mode){case"exclusive":await Promise.allSettled(g().filter((t=>t.name===e.name&&t!==e)).map(h));break;case"shared":await Promise.allSettled(g().filter((t=>t.name===e.name&&"exclusive"===t.mode&&t!==e)).map(h))}}function E(e){if(u.has(e))return u.get(e).controller.signal}async function S(e){if(u.has(e)){const{resolve:t,reject:n,promise:r,callback:o,pending:i,controller:a}=u.get(e);return i&&function(e,t=!0){u.has(e)&&u.set(e,{...u.get(e),pending:t})}(e,!1),m(o,e).then(t,n).finally((()=>{u.delete(e),requestIdleCallback((()=>a.abort()))})),r}}class A{constructor(e){if(e!==p)throw new TypeError("Invalid constructor")}static async request(e,...t){let n,r={};t[0]instanceof Function?n=t[0]:t[1]instanceof Function&&([r,n]=t),"string"!=typeof e&&(e=e.toString());const{mode:o="exclusive",ifAvailable:i=!1,steal:a=!1,signal:s}=r;if(a&&i)throw new DOMException("LockManager.request: `steal` and `ifAvailable` cannot be used together");if(e.startsWith("-"))throw new DOMException("LockManager.request: Names starting with `-` are reserved");if(!["exclusive","shared"].includes(o))throw new TypeError(`LockManager.request: '${o}' (value of 'mode' member of LockOptions) is not a valid value for enumeration LockMode.`);if(s instanceof AbortSignal&&s.aborted)throw s.reason;if("shared"===o&&a)throw new DOMException("LockManager.request: `steal` is only supported for exclusive lock requests");const l=w(e),c=T(e),p=[...l,...c].some((t=>t.name===e));a&&p&&function(e){[...u.entries()].filter((([t])=>t.name===e)).forEach((([e,{reject:t,controller:n}])=>{requestIdleCallback((()=>{n.abort(),u.delete(e)})),t(new DOMException("The lock request is aborted"))}))}(e);const d=y(e,o,n);switch(s instanceof AbortSignal&&s.addEventListener("abort",(()=>{if(u.has(d)){const{reject:e,controller:t}=u.get(d);u.delete(d),e(new DOMException("The lock request is aborted")),t.abort()}}),{once:!0,signal:E(d)}),o){case"exclusive":if(!i||0===l.length&&0===c.length)return await v(d),await S(d);{const e=u.get(d).controller;return u.delete(d),await m(n,null).then((t=>(requestIdleCallback((()=>e.abort())),t)))}case"shared":if(i){if([...l,...c].some((e=>"exclusive"===e.mode))){const e=u.get(d).controller;return u.delete(d),await m(n,null).then((t=>(requestIdleCallback((()=>e.abort())),t)))}return await v(d),await S(d)}return await v(d),await S(d);default:throw new TypeError(`LockManager.request: '${o}' (value of 'mode' member of LockOptions) is not a valid value for enumeration LockMode.`)}}static async query(){return{held:w().map((({name:e,mode:t})=>({name:e,mode:t,clientId:null}))),pending:T().map((({name:e,mode:t})=>({name:e,mode:t,clientId:null})))}}}function M(e,t="error"){if(e instanceof Error){const{message:n,name:r,fileName:o,lineNumber:i,columnNumber:a}=e;return new ErrorEvent(t,{error:e,message:`${r}: ${n}`,filename:o,lineno:i,colno:a})}throw new TypeError("`errorToEvent()` only accepts Errors")}let L=!1;new Promise((async e=>{if(d)if(await f)e(!1);else try{navigator.locks.request=A.request,navigator.locks.query=A.query,L=!0,e(!0)}catch(t){globalThis.dispatchEvent(M(t)),e(!1)}else try{navigator.locks=A,L=!0,e(!0)}catch(t){globalThis.dispatchEvent(M(t)),e(!1)}})),navigator.canShare instanceof Function||(navigator.canShare=function({title:e,text:t,url:n,files:r}={}){return navigator.share instanceof Function&&(!Array.isArray(r)||0===r.length)&&(!![e,t,n].every((e=>void 0===e))||[e,t,n].some((e=>"string"==typeof e&&0!==e.length)))}),navigator.setAppBadge instanceof Function||(navigator.setAppBadge=async e=>{if(!Number.isInteger(e))throw new TypeError("Failed to execute 'setAppBadge' on 'Navigator': Value is not of type 'unsigned long long'");if(e<0)throw new TypeError("Failed to execute 'setAppBadge' on 'Navigator': Value is outside the 'unsigned long long' value range.");0===e?document.title.startsWith("(")&&(document.title=document.title.replace(/^\((\d{1,2}\+?)\)\s/,"")):e<100?(await navigator.clearAppBadge(),document.title=`(${e}) ${document.title}`):(await navigator.clearAppBadge(),document.title=`(99+) ${document.title}`)}),navigator.clearAppBadge instanceof Function||(navigator.clearAppBadge=()=>navigator.setAppBadge(0)),Navigator.prototype.hasOwnProperty("pdfViewerEnabled")||Object.defineProperty(navigator,"pdfViewerEnabled",{enumerable:!0,configurable:!1,writable:!1,value:!1}),Navigator.prototype.getInstalledRelatedApps instanceof Function||(Navigator.prototype.getInstalledRelatedApps=async()=>[]),Navigator.prototype.getGamepads instanceof Function||(Navigator.prototype.getGamepads=()=>[]),"hardwareConcurrency"in Navigator.prototype||Object.defineProperty(Navigator.prototype,"hardwareConcurrency",{get:()=>1}),"connection"in Navigator.prototype?"type"in navigator.connection||(navigator.connection.type="unknown"):Object.defineProperty(Navigator.prototype,"connection",{get:()=>Object.create(EventTarget.prototype,{type:{value:"unknown"},effectiveType:{value:"4g"},rtt:{value:NaN},downlink:{value:NaN},downlinkMax:{value:1/0},saveData:{value:!1},onchange:{value:null,writable:!0},ontypechange:{value:null,writable:!0}})}),"doNotTrack"in Navigator.prototype||Object.defineProperty(Navigator.prototype,"doNotTrack",{get:()=>"unspecified"}),"globalPrivacyControl"in Navigator.prototype||Object.defineProperty(Navigator.prototype,"globalPrivacyControl",{get:()=>!1}),function(){if(!(globalThis.requestIdleCallback instanceof Function)){const e=e=>Number.isSafeInteger(e)&&e>0;globalThis.requestIdleCallback=function(t,{timeout:n}={}){const r=performance.now(),o=()=>e(n)?Math.max(0,n-(performance.now()-r)):Math.max(0,600-(performance.now()-r));return setTimeout((()=>t({didTimeout:!!e(n)&&0===o(),timeRemaining:o})),1)}}globalThis.cancelIdleCallback instanceof Function||(globalThis.cancelIdleCallback=e=>clearTimeout(e)),globalThis.requestAnimationFrame instanceof Function||(globalThis.requestAnimationFrame=e=>setTimeout((()=>e(performance.now())),1e3/60)),globalThis.cancelAnimationFrame instanceof Function||(globalThis.cancelAnimationFrame=e=>clearTimeout(e)),globalThis.queueMicrotask instanceof Function||(globalThis.queueMicrotask=e=>Promise.resolve().then(e).catch((e=>setTimeout((()=>{throw e})))))}(),function(){if(!("AbortSignal"in globalThis)){const e={signal:Symbol("signal"),aborted:Symbol("aborted"),reason:Symbol("reason"),onabort:Symbol("onabort")};globalThis.AbortError=class extends Error{},globalThis.AbortSignal=class t extends EventTarget{constructor(){super(),Object.defineProperties(this,{[e.aborted]:{enumerable:!1,writable:!0,configurable:!1,value:!1},[e.reason]:{enumerable:!1,writable:!0,configurable:!1,value:void 0},[e.onabort]:{enumerable:!1,writable:!0,configurable:!1,value:null}}),this.addEventListener("abort",(e=>{this.onabort instanceof Function&&this.onabort.call(this,e)}))}get aborted(){return this[e.aborted]}get onabort(){return this[e.onabort]}set onabort(t){this[e.onabort]=t instanceof Function?t:null}get reason(){return this[e.reason]}throwIfAborted(){if(this.aborted)throw this.reason}static abort(n=new DOMException("Operation aborted")){const r=new t;return r[e.aborted]=!0,r[e.reason]=n,r}},globalThis.AbortController=class{constructor(){this[e.signal]=new AbortSignal}get signal(){return this[e.signal]}abort(t=new DOMException("Operation aborted")){const n=this.signal;n.aborted||(n[e.aborted]=!0,n[e.reason]=t,n.dispatchEvent(new Event("abort")))}}}if(!("reason"in AbortSignal.prototype)){const e=new WeakMap,t=AbortController.prototype.abort;if(AbortSignal.abort instanceof Function){const t=AbortSignal.abort;AbortSignal.abort=function(n=new DOMException("Operation aborted")){const r=t();return e.set(r,n),r}}else AbortSignal.abort=function(e=new DOMException("Operation aborted")){const t=new AbortController;return t.abort(e),t.reason};Object.defineProperty(AbortSignal.prototype,"reason",{enumerable:!0,configurable:!0,get:function(){return e.has(this)?e.get(this):void 0}}),AbortController.prototype.abort=function(n=new DOMException("Operation aborted")){e.set(this.signal,n),t.call(this)}}AbortSignal.prototype.throwIfAborted instanceof Function||(AbortSignal.prototype.throwIfAborted=function(){if(this.aborted)throw this.reason}),AbortSignal.timeout instanceof Function||(AbortSignal.timeout=function(e){if(void 0===e)throw new TypeError("At least one 1 argument required but only 0 passed");if(Number.isFinite(e)){if(e<0)throw new TypeError("Argument 1 is out of range for unsigned long long.");{const t=new AbortController;return setTimeout((()=>t.abort(new DOMException("The operation timed out."))),e),t.signal}}throw new TypeError("Argument 1 is not a finite value, so it is out of range for unsigned long long.")}),AbortSignal.any instanceof Function||(AbortSignal.any=function(e){if(!Array.isArray(e))throw new TypeError("Expected an array of signals");const t=new AbortController;for(const n of e){if(!(n instanceof AbortSignal)){const e=new TypeError("`signal` is not an `AbortSignal`");throw t.abort(e),e}if(n.aborted){t.abort(n.reason||new DOMException("Operation aborted."));break}n.addEventListener("abort",(({target:e})=>{t.abort(e.reason||new DOMException("Operation aborted."))}),{signal:t.signal})}return t.signal})}(),globalThis.hasOwnProperty("AggregateError")||(globalThis.AggregateError=class extends Error{constructor(e,t){void 0===t?(super(e),this.errors=[]):(super(t),this.errors=e)}}),globalThis.reportError instanceof Function||(globalThis.reportError=function(e){globalThis.dispatchEvent(M(e))}),function(){if("MediaQueryListEvent"in globalThis||(globalThis.MediaQueryListEvent=class extends Event{constructor(e,{media:t,matches:n}={}){super(e),Object.defineProperties(this,{media:{enumerable:!0,configurable:!1,writable:!1,value:t},matches:{enumerable:!0,configurable:!1,writable:!1,value:n}})}}),"MediaQueryList"in globalThis&&!(globalThis.MediaQueryList.prototype.addEventListener instanceof Function)){const e=new WeakMap,t=function(){const{media:e,matches:t}=this;this.dispatchEvent(new MediaQueryListEvent("change",{media:e,matches:t}))},n=function(n){return e.has(n)||(e.set(n,new EventTarget),n.addListener(t.bind(n))),e.get(n)};globalThis.MediaQueryList.prototype.addEventListener=function(e,t,r){n(this).addEventListener(e,t,r)},globalThis.MediaQueryList.prototype.removeEventListener=function(e,t,r){n(this).removeEventListener(e,t,r)},globalThis.MediaQueryList.prototype.dispatchEvent=function(e){n(this).dispatchEvent(e)}}}(),"Promise"in globalThis&&(Promise.prototype.finally instanceof Function||(Promise.prototype.finally=function(e){return this.then((async t=>(await e(),t)),(async t=>(await e(),t)))}),Promise.allSettled instanceof Function||(Promise.allSettled=function(e){return Promise.all(Array.from(e).map((function(e){return new Promise((function(t){e instanceof Promise||(e=Promise.resolve(e)),e.then((function(e){t({status:"fulfilled",value:e})})).catch((function(e){t({status:"rejected",reason:e})}))}))})))}),Promise.any instanceof Function||(Promise.any=e=>new Promise(((t,n)=>{let r=[];e.forEach((o=>{o.then(t).catch((t=>{r.push(t),r.length===e.length&&n(new globalThis.AggregateError(r,"No Promise in Promise.any was resolved"))}))}))}))),Promise.race instanceof Function||(Promise.race=e=>new Promise(((t,n)=>{e.forEach((e=>e.then(t,n)))}))),Promise.try instanceof Function||(Promise.try=e=>new Promise((t=>t(e())))),Promise.withResolvers instanceof Function||(Promise.withResolvers=function(){const e={};return e.promise=new Promise(((t,n)=>{e.resolve=t,e.reject=n})),e}))
|
|
9
9
|
/**
|
|
10
10
|
* @copyright 2023 Chris Zuber <admin@kernvalley.us>
|
|
11
|
-
*/;class
|
|
11
|
+
*/;class O{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 n=this.encode(e),r=Math.min(t.length,n.length);return n.length>t.length?t.set(n.slice(0,r)):t.set(n),{read:r,written:r}}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
|
|
14
|
+
*/const F=["utf-8","utf8"];class k{constructor(e="utf-8",{fatal:t=!1,ignoreBOM:n=!1}={}){if(e="string"!=typeof e?e.toString().toLowerCase():e.toLowerCase(),!F.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:n}})}decode(e){switch(this.encoding){case"utf-8":case"utf8":{let t=NaN;return e.reduce(((e,n,r)=>{if(Number.isNaN(t)&&n<128)return e+String.fromCharCode(n);if(Number.isNaN(t)&&n>193)return t=n,e;if(t>193&&(o=128,a=194,"number"==typeof(i=n)&&i>=o&&i<=a)){const r=64*(t-194);return t=NaN,e+String.fromCharCode(r+n)}if(this.fatal)throw new RangeError(`Unhandled character at postion ${r}`);return t=NaN,e;var o,i,a}),"")}default:throw new TypeError(`Unsupported encoding '${this.encoding}'`)}}}"TextEncoder"in globalThis||(globalThis.TextEncoder=O),"TextDecoder"in globalThis||(globalThis.TextDecoder=k),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,31 +20,31 @@
|
|
|
20
20
|
* cookie properties, such as expires, etc.
|
|
21
21
|
*
|
|
22
22
|
* @TODO verify spec compliance as best as is possible
|
|
23
|
-
*/;const
|
|
23
|
+
*/;const P="cookieStore"in globalThis,x={constructor:Symbol("constructor")};function N(){return 0===document.cookie.length?[]:document.cookie.split(";").map((e=>{const[t,n=null]=e.split("=");return{name:decodeURIComponent(t.trim()),value:"string"==typeof n?decodeURIComponent(n.trim()):null,path:void 0,expires:void 0,domain:void 0,sameSite:void 0,secure:void 0,partitioned:!1}}))}function C({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((n=>n.name===e&&n.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:n=null,maxAge:r=null,path:o="/",sameSite:i="lax",domain:a=null,secure:s=!1,partitioned:l=!1}){if(Number.isInteger(r))I({name:e,value:t,expires:Date.now()+r,path:o,sameSite:i,domain:a,secure:s,partitioned:l});else{let r=`${encodeURIComponent(e)}=`;t&&(r+=encodeURIComponent(t)),Number.isInteger(n)?r+=`;expires=${new Date(n).toUTCString()}`:n instanceof Date&&(r+=`;expires=${n.toUTCString()}`),"string"==typeof o&&(r+=`;path=${o}`),"string"==typeof a&&(r+=`;domain=${a}`),"string"==typeof i&&(r+=`;sameSite=${i}`),!0===s&&(r+=";secure"),!0===l&&(r+=";partitioned"),document.cookie=r}}class D extends EventTarget{constructor(e){if(e!==x.constructor)throw new DOMException("Invalid constructor");super(),Object.defineProperty(this,x.onchange,{enumerable:!1,configurable:!1,writable:!0,value:null})}get onchange(){return this[x.onchange]}set onchange(e){this[x.onchange]instanceof Function&&this.removeEventListener("change",this[x.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 C("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:n=null,path:r="/",expires:o=null,maxAge:i=null,sameSite:a="lax",secure:s=!1,partitioned:l=!1}){return{name:e,value:t,domain:n,path:r,expires:o,maxAge:i,sameSite:a,secure:s,partitioned:l}}(e[0]);I(t);const n=new Event("change");n.changed=[t],n.deleted=[],this.dispatchEvent(n)}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 n=new Event("change");n.changed=[],n.deleted=new Array(t.length),t.forEach(((t,r)=>{t.path=e.path||"/",t.domain=e.domain||null,t.secure=e.secure||null,delete t.value,t.sameSite=e.sameSite||"lax",n.deleted[r]=t,I({...t,value:null,expires:1})})),this.dispatchEvent(n)}}}}}const j=new D(x.constructor);
|
|
24
24
|
/**
|
|
25
25
|
* @copyright 2023 Chris Zuber <admin@kernvalley.us>
|
|
26
26
|
*/
|
|
27
|
-
function
|
|
27
|
+
function R(){return"trustedTypes"in globalThis&&trustedTypes instanceof EventTarget&&trustedTypes.createPolicy instanceof Function}!P&&(globalThis.cookieStore=j),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)}))}});
|
|
28
28
|
/**
|
|
29
29
|
* @copyright 2023 Chris Zuber <admin@kernvalley.us>
|
|
30
30
|
*/
|
|
31
|
-
const
|
|
31
|
+
const H=Object.keys(Object.getOwnPropertyDescriptors(HTMLElement.prototype)).filter((e=>e.startsWith("on"))),U=["action","cite","formaction","href","ping","src"],q=s((async function(){const{ok:e,headers:t}=await fetch(location.href,{method:"HEAD"});if(e&&t.has("Content-Security-Policy")){const e=t.get("Content-Security-Policy").trim().split(";").filter((e=>0!==e.length));return Object.fromEntries(e.map((e=>{const[t,...n]=e.trim().split(" ").filter((e=>0!==e.length));return[t,n]})))}}));function z(){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));return Object.fromEntries(t.map((e=>{const[t,...n]=e.trim().split(" ").filter((e=>0!==e.length));return[t,n]})))}return{}}
|
|
32
32
|
/**
|
|
33
33
|
* @copyright 2023 Chris Zuber <admin@kernvalley.us>
|
|
34
|
-
*/const B="1"===document.documentElement.dataset.fetchTrustCsp;function $({"trusted-types":e=null}={}){if(Array.isArray(e)){const t=new Set(e),n=t.has("'allow-duplicates'"),
|
|
34
|
+
*/const B="1"===document.documentElement.dataset.fetchTrustCsp;function $({"trusted-types":e=null}={}){if(Array.isArray(e)){const t=new Set(e),n=t.has("'allow-duplicates'"),r=t.has("'none'");return n&&t.delete("'allow-duplicates'"),r&&t.clear(),t.add("empty#html"),t.add("empty#script"),{policies:t,allowDuplicates:n,hasNone:r}}return{}}const{allowDuplicates:_,allowedPolicies:V}=function(){const e=$(z());if("object"==typeof e&&e.policies instanceof Set){const{policies:t,allowDuplicates:n}=e;return{allowDuplicates:n,allowedPolicies:t}}{const e=(()=>{const e=$(z());return"object"==typeof e&&"allowDuplicates"in e?e.allowDuplicates:"1"===document.documentElement.dataset.allowTrustDuplicates})(),t=(()=>{if(document.documentElement.dataset.hasOwnProperty("trustedPolicies"))return new Set(["empty#html","empty#script",...document.documentElement.dataset.trustedPolicies.split(" ")]);{const{policies:e}=$(z());return e instanceof Set?e:new Set(["empty#html","empty#script"])}})();return t.has("'none'")&&t.clear(),t.add("empty#html"),t.add("empty#script"),{allowDuplicates:e,allowedPolicies:t}}}();R();const W={trustedValue:Symbol("[[Data]]"),trustedKey:Symbol("trusted-key"),emptyHTML:Symbol("policy-empty#html"),emptyScript:Symbol("policy-empty#script"),policy:Symbol.for("trust-policy"),defaultPolicy:Symbol("default-policy"),trustedTypesCSP:Symbol("trusted-types-csp")};Symbol.hasOwnProperty("toStringTag")||(Symbol.toStringTag=Symbol("Symbol.toStringTag"));const G=[];function K(e){return null!==function(e){return G.find((t=>t.name===e))||null}(e)}function Q(e,t){return function(){throw new TypeError(`Failed to execute '${t}' on 'TrustedTypePolicy': Policy ${e.name}'s TrustedTypePolicyOptions did not specify a '${t}' member.`)}}class J{constructor(e,{key:t,policy:n}){if(t!==W.trustedKey)throw new TypeError("Invalid constructor");Object.defineProperties(this,{[W.trustedValue]:{enumerable:!1,configurable:!1,writable:!1,value:e.toString()},[W.policy]:{enumerable:!1,configurable:!1,writable:!1,value:n.name}}),Object.freeze(this)}toString(){return this.valueOf()}toJSON(){return this.valueOf()}valueOf(){return this[W.trustedValue]}}class X extends J{[Symbol.toStringTag](){return"TrustedHTML"}}class Z extends J{[Symbol.toStringTag](){return"TrustedScript"}}class Y extends J{[Symbol.toStringTag](){return"TrustedScriptURL"}}class ee{constructor(e,{createHTML:t,createScript:n,createScriptURL:r}={},{key:o}){if(o!==W.trustedKey)throw new TypeError("Invalid constructor");Object.defineProperties(this,{name:{enumerable:!0,configurable:!1,writable:!1,value:e.toString()},createHTML:{enumerable:!0,configurable:!1,writable:!1,value:t instanceof Function?(e,...n)=>new X(t(e.toString(),...n),{key:W.trustedKey,policy:this}):Q(this,"createHTML")},createScript:{enumerable:!0,configurable:!1,writable:!1,value:n instanceof Function?(e,...t)=>new Z(n(e.toString(),...t),{key:W.trustedKey,policy:this}):Q(this,"createScript")},createScriptURL:{enumerable:!0,configurable:!1,writable:!1,value:r instanceof Function?(e,...t)=>new Y(r(e.toString(),...t),{key:W.trustedKey,policy:this}):Q(this,"createScriptURL")}})}}class te extends EventTarget{constructor(e){if(super(),e!==W.trustedKey)throw new TypeError("Invalid constructor");B&&async function(){const{policies:e,allowDuplicates:t=!1,hasNone:n=!1}=await q().then($);return e instanceof Set?{policies:e,allowDuplicates:t,hasNone:n}:{}}().then((({policies:e,allowDuplicates:t=!1,hasNone:n=!1})=>{void 0!==e&&Object.defineProperty(te,W.trustedTypesCSP,{value:{policies:e,allowDuplicates:t,hasNone:n},enumberable:!1,writable:!1,configurable:!1})})).catch((e=>console.error(e))),Object.defineProperties(this,{[W.defaultPolicy]:{enumerable:!1,configurable:!1,writable:!0,value:null},[W.emptyHTML]:{enumerable:!1,configurable:!1,writable:!1,value:this.createPolicy("empty#html",{createHTML:()=>""})},[W.emptyScript]:{enumerable:!1,configurable:!1,writable:!1,value:this.createPolicy("empty#script",{createScript:()=>""})}})}isHTML(e){return e instanceof globalThis.TrustedHTML}isScript(e){return e instanceof globalThis.TrustedScript}isScriptURL(e){return e instanceof globalThis.TrustedScriptURL}createPolicy(e,{createHTML:t,createScript:n,createScriptURL:r}={}){const o=new ee(e,{createHTML:t,createScript:n,createScriptURL:r},{key:W.trustedKey});if(!e.toString().match(/^[-#a-zA-Z0-9=_/@.%]+$/g))throw new TypeError(`Failed to execute 'createPolicy' on 'TrustedTypePolicyFactory': Policy: "${e}" contains invalid characters.`);if(te.hasOwnProperty(W.trustedTypesCSP)){const{policies:t,allowDuplicates:n,hasNone:r}=te[W.trustedTypesCSP];if(r&&"empty#html"!==e&&"empty#script"!==e)throw new TypeError(`Failed to execute 'createPolicy' on 'TrustedTypePolicyFactory': Policy: "${e}" disallowed.`);if(!t.has(e))throw new TypeError(`Failed to execute 'createPolicy' on 'TrustedTypePolicyFactory': Policy: "${e}" disallowed.`);if(!n&&K(e))throw new TypeError(`Failed to execute 'createPolicy' on 'TrustedTypePolicyFactory': Policy: "${e}" already exists.`)}else{if(V.size>2&&!V.has(e))throw new TypeError(`Failed to execute 'createPolicy' on 'TrustedTypePolicyFactory': Policy: "${e}" disallowed.`);if(!_&&K(e))throw new TypeError(`Failed to execute 'createPolicy' on 'TrustedTypePolicyFactory': Policy: "${e}" already exists.`)}return"default"===o.name&&(this[W.defaultPolicy]=o),G.push(o),o}getAttributeType(e,t,n){if(e=e.toLowerCase(),t=t.toLowerCase(),"string"==typeof elementNS&&0!==n.length)return H.includes(t)?"TrustedScript":null;if(H.includes(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(),H.includes(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}}get emptyHTML(){return this[W.emptyHTML].createHTML("")}get emptyScript(){return this[W.emptyScript].createScript("")}get defaultPolicy(){return this[W.defaultPolicy]}get _isPolyfill_(){return!0}static get allowDuplicates(){return _}}const ne=new te(W.trustedKey);!function(){if("TrustedTypePolicyFactory"in globalThis||(globalThis.TrustedTypePolicyFactory=te),"TrustedTypePolicy"in globalThis||(globalThis.TrustedTypePolicy=ee),"TrustedType"in globalThis||(globalThis.TrustedType=J),"TrustedHTML"in globalThis||(globalThis.TrustedHTML=X),"TrustedScript"in globalThis||(globalThis.TrustedScript=Z),"TrustedScriptURL"in globalThis||(globalThis.TrustedScriptURL=Y),"trustedTypes"in globalThis)try{globalThis.trustedTypes.createPolicy("empty#html",{createHTML:()=>""}),globalThis.trustedTypes.createPolicy("empty#script",{createScript:()=>""})}catch(e){console.error(e)}else globalThis.trustedTypes=ne}();
|
|
35
35
|
/**
|
|
36
36
|
* @copyright 2023 Chris Zuber <admin@kernvalley.us>
|
|
37
37
|
* @see https://wicg.github.io/sanitizer-api/#default-configuration-dictionary
|
|
38
38
|
*/
|
|
39
|
-
const oe=JSON.parse('{\n "allowCustomElements": false,\n "allowUnknownMarkup": false,\n "allowElements": [\n "a",\n "abbr",\n "acronym",\n "address",\n "area",\n "article",\n "aside",\n "audio",\n "b",\n "bdi",\n "bdo",\n "bgsound",\n "big",\n "blockquote",\n "body",\n "br",\n "button",\n "canvas",\n "caption",\n "center",\n "cite",\n "code",\n "col",\n "colgroup",\n "datalist",\n "dd",\n "del",\n "details",\n "dfn",\n "dialog",\n "dir",\n "div",\n "dl",\n "dt",\n "em",\n "fieldset",\n "figcaption",\n "figure",\n "font",\n "footer",\n "form",\n "h1",\n "h2",\n "h3",\n "h4",\n "h5",\n "h6",\n "head",\n "header",\n "hgroup",\n "hr",\n "html",\n "i",\n "img",\n "input",\n "ins",\n "kbd",\n "keygen",\n "label",\n "layer",\n "legend",\n "li",\n "link",\n "listing",\n "main",\n "map",\n "mark",\n "marquee",\n "menu",\n "meta",\n "meter",\n "nav",\n "nobr",\n "ol",\n "optgroup",\n "option",\n "output",\n "p",\n "picture",\n "popup",\n "pre",\n "progress",\n "q",\n "rb",\n "rp",\n "rt",\n "rtc",\n "ruby",\n "s",\n "samp",\n "section",\n "select",\n "selectmenu",\n "small",\n "source",\n "span",\n "strike",\n "strong",\n "style",\n "sub",\n "summary",\n "sup",\n "table",\n "tbody",\n "td",\n "tfoot",\n "th",\n "thead",\n "time",\n "tr",\n "track",\n "tt",\n "u",\n "ul",\n "var",\n "video",\n "wbr"\n ],\n "allowAttributes": {\n "abbr": [\n "*"\n ],\n "accept": [\n "*"\n ],\n "accept-charset": [\n "*"\n ],\n "accesskey": [\n "*"\n ],\n "action": [\n "*"\n ],\n "align": [\n "*"\n ],\n "alink": [\n "*"\n ],\n "allow": [\n "*"\n ],\n "allowfullscreen": [\n "*"\n ],\n "alt": [\n "*"\n ],\n "anchor": [\n "*"\n ],\n "archive": [\n "*"\n ],\n "as": [\n "*"\n ],\n "async": [\n "*"\n ],\n "autocapitalize": [\n "*"\n ],\n "autocomplete": [\n "*"\n ],\n "autocorrect": [\n "*"\n ],\n "autofocus": [\n "*"\n ],\n "autopictureinpicture": [\n "*"\n ],\n "autoplay": [\n "*"\n ],\n "axis": [\n "*"\n ],\n "background": [\n "*"\n ],\n "behavior": [\n "*"\n ],\n "bgcolor": [\n "*"\n ],\n "border": [\n "*"\n ],\n "bordercolor": [\n "*"\n ],\n "capture": [\n "*"\n ],\n "cellpadding": [\n "*"\n ],\n "cellspacing": [\n "*"\n ],\n "challenge": [\n "*"\n ],\n "char": [\n "*"\n ],\n "charoff": [\n "*"\n ],\n "charset": [\n "*"\n ],\n "checked": [\n "*"\n ],\n "cite": [\n "*"\n ],\n "class": [\n "*"\n ],\n "classid": [\n "*"\n ],\n "clear": [\n "*"\n ],\n "code": [\n "*"\n ],\n "codebase": [\n "*"\n ],\n "codetype": [\n "*"\n ],\n "color": [\n "*"\n ],\n "cols": [\n "*"\n ],\n "colspan": [\n "*"\n ],\n "compact": [\n "*"\n ],\n "content": [\n "*"\n ],\n "contenteditable": [\n "*"\n ],\n "controls": [\n "*"\n ],\n "controlslist": [\n "*"\n ],\n "conversiondestination": [\n "*"\n ],\n "coords": [\n "*"\n ],\n "crossorigin": [\n "*"\n ],\n "csp": [\n "*"\n ],\n "data": [\n "*"\n ],\n "datetime": [\n "*"\n ],\n "declare": [\n "*"\n ],\n "decoding": [\n "*"\n ],\n "default": [\n "*"\n ],\n "defer": [\n "*"\n ],\n "dir": [\n "*"\n ],\n "direction": [\n "*"\n ],\n "dirname": [\n "*"\n ],\n "disabled": [\n "*"\n ],\n "disablepictureinpicture": [\n "*"\n ],\n "disableremoteplayback": [\n "*"\n ],\n "disallowdocumentaccess": [\n "*"\n ],\n "download": [\n "*"\n ],\n "draggable": [\n "*"\n ],\n "elementtiming": [\n "*"\n ],\n "enctype": [\n "*"\n ],\n "end": [\n "*"\n ],\n "enterkeyhint": [\n "*"\n ],\n "event": [\n "*"\n ],\n "exportparts": [\n "*"\n ],\n "face": [\n "*"\n ],\n "for": [\n "*"\n ],\n "form": [\n "*"\n ],\n "formaction": [\n "*"\n ],\n "formenctype": [\n "*"\n ],\n "formmethod": [\n "*"\n ],\n "formnovalidate": [\n "*"\n ],\n "formtarget": [\n "*"\n ],\n "frame": [\n "*"\n ],\n "frameborder": [\n "*"\n ],\n "headers": [\n "*"\n ],\n "height": [\n "*"\n ],\n "hidden": [\n "*"\n ],\n "high": [\n "*"\n ],\n "href": [\n "*"\n ],\n "hreflang": [\n "*"\n ],\n "hreftranslate": [\n "*"\n ],\n "hspace": [\n "*"\n ],\n "http-equiv": [\n "*"\n ],\n "id": [\n "*"\n ],\n "imagesizes": [\n "*"\n ],\n "imagesrcset": [\n "*"\n ],\n "importance": [\n "*"\n ],\n "impressiondata": [\n "*"\n ],\n "impressionexpiry": [\n "*"\n ],\n "incremental": [\n "*"\n ],\n "inert": [\n "*"\n ],\n "inputmode": [\n "*"\n ],\n "integrity": [\n "*"\n ],\n "invisible": [\n "*"\n ],\n "is": [\n "*"\n ],\n "ismap": [\n "*"\n ],\n "keytype": [\n "*"\n ],\n "kind": [\n "*"\n ],\n "label": [\n "*"\n ],\n "lang": [\n "*"\n ],\n "language": [\n "*"\n ],\n "latencyhint": [\n "*"\n ],\n "leftmargin": [\n "*"\n ],\n "link": [\n "*"\n ],\n "list": [\n "*"\n ],\n "loading": [\n "*"\n ],\n "longdesc": [\n "*"\n ],\n "loop": [\n "*"\n ],\n "low": [\n "*"\n ],\n "lowsrc": [\n "*"\n ],\n "manifest": [\n "*"\n ],\n "marginheight": [\n "*"\n ],\n "marginwidth": [\n "*"\n ],\n "max": [\n "*"\n ],\n "maxlength": [\n "*"\n ],\n "mayscript": [\n "*"\n ],\n "media": [\n "*"\n ],\n "method": [\n "*"\n ],\n "min": [\n "*"\n ],\n "minlength": [\n "*"\n ],\n "multiple": [\n "*"\n ],\n "muted": [\n "*"\n ],\n "name": [\n "*"\n ],\n "nohref": [\n "*"\n ],\n "nomodule": [\n "*"\n ],\n "nonce": [\n "*"\n ],\n "noresize": [\n "*"\n ],\n "noshade": [\n "*"\n ],\n "novalidate": [\n "*"\n ],\n "nowrap": [\n "*"\n ],\n "object": [\n "*"\n ],\n "open": [\n "*"\n ],\n "optimum": [\n "*"\n ],\n "part": [\n "*"\n ],\n "pattern": [\n "*"\n ],\n "ping": [\n "*"\n ],\n "placeholder": [\n "*"\n ],\n "playsinline": [\n "*"\n ],\n "policy": [\n "*"\n ],\n "poster": [\n "*"\n ],\n "preload": [\n "*"\n ],\n "pseudo": [\n "*"\n ],\n "readonly": [\n "*"\n ],\n "referrerpolicy": [\n "*"\n ],\n "rel": [\n "*"\n ],\n "reportingorigin": [\n "*"\n ],\n "required": [\n "*"\n ],\n "resources": [\n "*"\n ],\n "rev": [\n "*"\n ],\n "reversed": [\n "*"\n ],\n "role": [\n "*"\n ],\n "rows": [\n "*"\n ],\n "rowspan": [\n "*"\n ],\n "rules": [\n "*"\n ],\n "sandbox": [\n "*"\n ],\n "scheme": [\n "*"\n ],\n "scope": [\n "*"\n ],\n "scopes": [\n "*"\n ],\n "scrollamount": [\n "*"\n ],\n "scrolldelay": [\n "*"\n ],\n "scrolling": [\n "*"\n ],\n "select": [\n "*"\n ],\n "selected": [\n "*"\n ],\n "shadowroot": [\n "*"\n ],\n "shadowrootdelegatesfocus": [\n "*"\n ],\n "shape": [\n "*"\n ],\n "size": [\n "*"\n ],\n "sizes": [\n "*"\n ],\n "slot": [\n "*"\n ],\n "span": [\n "*"\n ],\n "spellcheck": [\n "*"\n ],\n "src": [\n "*"\n ],\n "srcdoc": [\n "*"\n ],\n "srclang": [\n "*"\n ],\n "srcset": [\n "*"\n ],\n "standby": [\n "*"\n ],\n "start": [\n "*"\n ],\n "step": [\n "*"\n ],\n "style": [\n "*"\n ],\n "summary": [\n "*"\n ],\n "tabindex": [\n "*"\n ],\n "target": [\n "*"\n ],\n "text": [\n "*"\n ],\n "title": [\n "*"\n ],\n "topmargin": [\n "*"\n ],\n "translate": [\n "*"\n ],\n "truespeed": [\n "*"\n ],\n "trusttoken": [\n "*"\n ],\n "type": [\n "*"\n ],\n "usemap": [\n "*"\n ],\n "valign": [\n "*"\n ],\n "value": [\n "*"\n ],\n "valuetype": [\n "*"\n ],\n "version": [\n "*"\n ],\n "virtualkeyboardpolicy": [\n "*"\n ],\n "vlink": [\n "*"\n ],\n "vspace": [\n "*"\n ],\n "webkitdirectory": [\n "*"\n ],\n "width": [\n "*"\n ],\n "wrap": [\n "*"\n ]\n }\n}'),re=function(e,t,n=oe){const o=ue(t,n);e.replaceChildren(le(o))},ie=["https:"];ie.includes(location.protocol)||ie.push(location.protocol);const ae=s((()=>function(e,{createHTML:t=(()=>{throw new TypeError("This policy does not provide `createHTML()`")}),createScript:n=(()=>{throw new TypeError("This policy does not provide `createScript()`")}),createScriptURL:o=(()=>{throw new TypeError("This policy does not provide `createScriptURL()`")})}){return H()?trustedTypes.createPolicy(e,{createHTML:t,createScript:n,createScriptURL:o}):Object.freeze({name:e,createHTML:(e,...n)=>t(e.toString(),...n),createScript:(e,...t)=>n(e.toString(),...t),createScriptURL:(e,...t)=>o(e.toString(),...t)})}("sanitizer-raw#html",{createHTML:e=>e}))),se=e=>ae().createHTML(e);function le(e){const t=document.createDocumentFragment(),n=e.cloneNode(!0);return t.append(...n.head.childNodes,...n.body.childNodes),t}function ce({allowAttributes:e,allowComments:t,allowElements:n,allowCustomElements:o,blockElements:r,dropAttributes:i,dropElements:a,allowUnknownMarkup:s,sanitizer:l}={},c){return l instanceof Sanitizer?ce(l.getConfiguration(),c):(void 0===e&&void 0===i&&(e=oe.allowAttributes),void 0===n&&void 0===a&&(n=oe.allowElements),{allowAttributes:e,allowComments:t,allowElements:n,allowCustomElements:o,blockElements:r,dropAttributes:i,dropElements:a,allowUnknownMarkup:s})}function ue(e,t=oe){const n=(new DOMParser).parseFromString(se(e),"text/html");return Array.isArray(t.allowElements)&&!t.allowElements.includes("html")&&(t.allowElements=[...new Set([...t.allowElements,"html","head","body"])]),de(n,t)}function pe(e,t=oe){if(e instanceof Node){if(e.nodeType===Node.DOCUMENT_FRAGMENT_NODE)return de(e,t);if(e.nodeType===Node.DOCUMENT_NODE)return de(le(e),t);throw new TypeError("sanitize requires a Document or DocumentFragment")}throw new TypeError("sanitize requires a Document or DocumentFragment")}function de(e,t=oe){try{if(!(e instanceof Node))throw new TypeError(`Expected a Node but got a ${a(e)}.`);if(!i(t))throw new TypeError(`Expected config to be an object but got ${a(t)}.`);const{allowElements:n,allowComments:o,allowAttributes:r,allowCustomElements:s,blockElements:l,dropAttributes:c,dropElements:u,allowUnknownMarkup:p}=ce(t),d=document.createNodeIterator(e,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_COMMENT);let m=d.root.nodeType===Node.ELEMENT_NODE?d.root:d.nextNode();for(;m instanceof Node;){switch(m.nodeType){case Node.ELEMENT_NODE:{if(!p&&(!(m instanceof HTMLElement)||m instanceof HTMLUnknownElement)){m.remove();break}const e=m.tagName.toLowerCase();Array.isArray(u)&&u.includes(e)?m.remove():Array.isArray(l)&&l.includes(e)?m.hasChildNodes()?m.replaceWith(...m.childNodes):m.remove():e.includes("-")&&!s||Array.isArray(n)&&!n.includes(e)?m.remove():m.hasAttributes()&&m.getAttributeNames().forEach((t=>{const n=m.getAttributeNode(t),{value:o}=n;U.includes(t)&&!ie.includes(new URL(o,document.baseURI).protocol)?m.removeAttributeNode(n):i(c)?t in c&&["*",e].some((e=>c[t].includes(e)))&&m.removeAttributeNode(n):i(r)&&(t in r&&["*",e].some((e=>r[t].includes(e)))||m.removeAttributeNode(n))}));break}case Node.COMMENT_NODE:o||m.remove()}"template"===m.localName&&de(m.content,t),m=d.nextNode()}return e}catch(t){console.error(t),e.parentElement.removeChild(e)}}
|
|
39
|
+
const re=JSON.parse('{\n "allowCustomElements": false,\n "allowUnknownMarkup": false,\n "allowElements": [\n "a",\n "abbr",\n "acronym",\n "address",\n "area",\n "article",\n "aside",\n "audio",\n "b",\n "bdi",\n "bdo",\n "bgsound",\n "big",\n "blockquote",\n "body",\n "br",\n "button",\n "canvas",\n "caption",\n "center",\n "cite",\n "code",\n "col",\n "colgroup",\n "datalist",\n "dd",\n "del",\n "details",\n "dfn",\n "dialog",\n "dir",\n "div",\n "dl",\n "dt",\n "em",\n "fieldset",\n "figcaption",\n "figure",\n "font",\n "footer",\n "form",\n "h1",\n "h2",\n "h3",\n "h4",\n "h5",\n "h6",\n "head",\n "header",\n "hgroup",\n "hr",\n "html",\n "i",\n "img",\n "input",\n "ins",\n "kbd",\n "keygen",\n "label",\n "layer",\n "legend",\n "li",\n "link",\n "listing",\n "main",\n "map",\n "mark",\n "marquee",\n "menu",\n "meta",\n "meter",\n "nav",\n "nobr",\n "ol",\n "optgroup",\n "option",\n "output",\n "p",\n "picture",\n "popup",\n "pre",\n "progress",\n "q",\n "rb",\n "rp",\n "rt",\n "rtc",\n "ruby",\n "s",\n "samp",\n "section",\n "select",\n "selectmenu",\n "small",\n "source",\n "span",\n "strike",\n "strong",\n "style",\n "sub",\n "summary",\n "sup",\n "table",\n "tbody",\n "td",\n "tfoot",\n "th",\n "thead",\n "time",\n "tr",\n "track",\n "tt",\n "u",\n "ul",\n "var",\n "video",\n "wbr"\n ],\n "allowAttributes": {\n "abbr": [\n "*"\n ],\n "accept": [\n "*"\n ],\n "accept-charset": [\n "*"\n ],\n "accesskey": [\n "*"\n ],\n "action": [\n "*"\n ],\n "align": [\n "*"\n ],\n "alink": [\n "*"\n ],\n "allow": [\n "*"\n ],\n "allowfullscreen": [\n "*"\n ],\n "alt": [\n "*"\n ],\n "anchor": [\n "*"\n ],\n "archive": [\n "*"\n ],\n "as": [\n "*"\n ],\n "async": [\n "*"\n ],\n "autocapitalize": [\n "*"\n ],\n "autocomplete": [\n "*"\n ],\n "autocorrect": [\n "*"\n ],\n "autofocus": [\n "*"\n ],\n "autopictureinpicture": [\n "*"\n ],\n "autoplay": [\n "*"\n ],\n "axis": [\n "*"\n ],\n "background": [\n "*"\n ],\n "behavior": [\n "*"\n ],\n "bgcolor": [\n "*"\n ],\n "border": [\n "*"\n ],\n "bordercolor": [\n "*"\n ],\n "capture": [\n "*"\n ],\n "cellpadding": [\n "*"\n ],\n "cellspacing": [\n "*"\n ],\n "challenge": [\n "*"\n ],\n "char": [\n "*"\n ],\n "charoff": [\n "*"\n ],\n "charset": [\n "*"\n ],\n "checked": [\n "*"\n ],\n "cite": [\n "*"\n ],\n "class": [\n "*"\n ],\n "classid": [\n "*"\n ],\n "clear": [\n "*"\n ],\n "code": [\n "*"\n ],\n "codebase": [\n "*"\n ],\n "codetype": [\n "*"\n ],\n "color": [\n "*"\n ],\n "cols": [\n "*"\n ],\n "colspan": [\n "*"\n ],\n "compact": [\n "*"\n ],\n "content": [\n "*"\n ],\n "contenteditable": [\n "*"\n ],\n "controls": [\n "*"\n ],\n "controlslist": [\n "*"\n ],\n "conversiondestination": [\n "*"\n ],\n "coords": [\n "*"\n ],\n "crossorigin": [\n "*"\n ],\n "csp": [\n "*"\n ],\n "data": [\n "*"\n ],\n "datetime": [\n "*"\n ],\n "declare": [\n "*"\n ],\n "decoding": [\n "*"\n ],\n "default": [\n "*"\n ],\n "defer": [\n "*"\n ],\n "dir": [\n "*"\n ],\n "direction": [\n "*"\n ],\n "dirname": [\n "*"\n ],\n "disabled": [\n "*"\n ],\n "disablepictureinpicture": [\n "*"\n ],\n "disableremoteplayback": [\n "*"\n ],\n "disallowdocumentaccess": [\n "*"\n ],\n "download": [\n "*"\n ],\n "draggable": [\n "*"\n ],\n "elementtiming": [\n "*"\n ],\n "enctype": [\n "*"\n ],\n "end": [\n "*"\n ],\n "enterkeyhint": [\n "*"\n ],\n "event": [\n "*"\n ],\n "exportparts": [\n "*"\n ],\n "face": [\n "*"\n ],\n "for": [\n "*"\n ],\n "form": [\n "*"\n ],\n "formaction": [\n "*"\n ],\n "formenctype": [\n "*"\n ],\n "formmethod": [\n "*"\n ],\n "formnovalidate": [\n "*"\n ],\n "formtarget": [\n "*"\n ],\n "frame": [\n "*"\n ],\n "frameborder": [\n "*"\n ],\n "headers": [\n "*"\n ],\n "height": [\n "*"\n ],\n "hidden": [\n "*"\n ],\n "high": [\n "*"\n ],\n "href": [\n "*"\n ],\n "hreflang": [\n "*"\n ],\n "hreftranslate": [\n "*"\n ],\n "hspace": [\n "*"\n ],\n "http-equiv": [\n "*"\n ],\n "id": [\n "*"\n ],\n "imagesizes": [\n "*"\n ],\n "imagesrcset": [\n "*"\n ],\n "importance": [\n "*"\n ],\n "impressiondata": [\n "*"\n ],\n "impressionexpiry": [\n "*"\n ],\n "incremental": [\n "*"\n ],\n "inert": [\n "*"\n ],\n "inputmode": [\n "*"\n ],\n "integrity": [\n "*"\n ],\n "invisible": [\n "*"\n ],\n "is": [\n "*"\n ],\n "ismap": [\n "*"\n ],\n "keytype": [\n "*"\n ],\n "kind": [\n "*"\n ],\n "label": [\n "*"\n ],\n "lang": [\n "*"\n ],\n "language": [\n "*"\n ],\n "latencyhint": [\n "*"\n ],\n "leftmargin": [\n "*"\n ],\n "link": [\n "*"\n ],\n "list": [\n "*"\n ],\n "loading": [\n "*"\n ],\n "longdesc": [\n "*"\n ],\n "loop": [\n "*"\n ],\n "low": [\n "*"\n ],\n "lowsrc": [\n "*"\n ],\n "manifest": [\n "*"\n ],\n "marginheight": [\n "*"\n ],\n "marginwidth": [\n "*"\n ],\n "max": [\n "*"\n ],\n "maxlength": [\n "*"\n ],\n "mayscript": [\n "*"\n ],\n "media": [\n "*"\n ],\n "method": [\n "*"\n ],\n "min": [\n "*"\n ],\n "minlength": [\n "*"\n ],\n "multiple": [\n "*"\n ],\n "muted": [\n "*"\n ],\n "name": [\n "*"\n ],\n "nohref": [\n "*"\n ],\n "nomodule": [\n "*"\n ],\n "nonce": [\n "*"\n ],\n "noresize": [\n "*"\n ],\n "noshade": [\n "*"\n ],\n "novalidate": [\n "*"\n ],\n "nowrap": [\n "*"\n ],\n "object": [\n "*"\n ],\n "open": [\n "*"\n ],\n "optimum": [\n "*"\n ],\n "part": [\n "*"\n ],\n "pattern": [\n "*"\n ],\n "ping": [\n "*"\n ],\n "placeholder": [\n "*"\n ],\n "playsinline": [\n "*"\n ],\n "policy": [\n "*"\n ],\n "poster": [\n "*"\n ],\n "preload": [\n "*"\n ],\n "pseudo": [\n "*"\n ],\n "readonly": [\n "*"\n ],\n "referrerpolicy": [\n "*"\n ],\n "rel": [\n "*"\n ],\n "reportingorigin": [\n "*"\n ],\n "required": [\n "*"\n ],\n "resources": [\n "*"\n ],\n "rev": [\n "*"\n ],\n "reversed": [\n "*"\n ],\n "role": [\n "*"\n ],\n "rows": [\n "*"\n ],\n "rowspan": [\n "*"\n ],\n "rules": [\n "*"\n ],\n "sandbox": [\n "*"\n ],\n "scheme": [\n "*"\n ],\n "scope": [\n "*"\n ],\n "scopes": [\n "*"\n ],\n "scrollamount": [\n "*"\n ],\n "scrolldelay": [\n "*"\n ],\n "scrolling": [\n "*"\n ],\n "select": [\n "*"\n ],\n "selected": [\n "*"\n ],\n "shadowroot": [\n "*"\n ],\n "shadowrootdelegatesfocus": [\n "*"\n ],\n "shape": [\n "*"\n ],\n "size": [\n "*"\n ],\n "sizes": [\n "*"\n ],\n "slot": [\n "*"\n ],\n "span": [\n "*"\n ],\n "spellcheck": [\n "*"\n ],\n "src": [\n "*"\n ],\n "srcdoc": [\n "*"\n ],\n "srclang": [\n "*"\n ],\n "srcset": [\n "*"\n ],\n "standby": [\n "*"\n ],\n "start": [\n "*"\n ],\n "step": [\n "*"\n ],\n "style": [\n "*"\n ],\n "summary": [\n "*"\n ],\n "tabindex": [\n "*"\n ],\n "target": [\n "*"\n ],\n "text": [\n "*"\n ],\n "title": [\n "*"\n ],\n "topmargin": [\n "*"\n ],\n "translate": [\n "*"\n ],\n "truespeed": [\n "*"\n ],\n "trusttoken": [\n "*"\n ],\n "type": [\n "*"\n ],\n "usemap": [\n "*"\n ],\n "valign": [\n "*"\n ],\n "value": [\n "*"\n ],\n "valuetype": [\n "*"\n ],\n "version": [\n "*"\n ],\n "virtualkeyboardpolicy": [\n "*"\n ],\n "vlink": [\n "*"\n ],\n "vspace": [\n "*"\n ],\n "webkitdirectory": [\n "*"\n ],\n "width": [\n "*"\n ],\n "wrap": [\n "*"\n ]\n }\n}'),oe=function(e,t,n=re){const r=ue(t,n);e.replaceChildren(le(r))},ie=["https:"];ie.includes(location.protocol)||ie.push(location.protocol);const ae=s((()=>function(e,{createHTML:t=(()=>{throw new TypeError("This policy does not provide `createHTML()`")}),createScript:n=(()=>{throw new TypeError("This policy does not provide `createScript()`")}),createScriptURL:r=(()=>{throw new TypeError("This policy does not provide `createScriptURL()`")})}){return R()?trustedTypes.createPolicy(e,{createHTML:t,createScript:n,createScriptURL:r}):Object.freeze({name:e,createHTML:(e,...n)=>t(e.toString(),...n),createScript:(e,...t)=>n(e.toString(),...t),createScriptURL:(e,...t)=>r(e.toString(),...t)})}("sanitizer-raw#html",{createHTML:e=>e}))),se=e=>ae().createHTML(e);function le(e){const t=document.createDocumentFragment(),n=e.cloneNode(!0);return t.append(...n.head.childNodes,...n.body.childNodes),t}function ce({allowAttributes:e,allowComments:t,allowElements:n,allowCustomElements:r,blockElements:o,dropAttributes:i,dropElements:a,allowUnknownMarkup:s,sanitizer:l}={},c){return l instanceof Sanitizer?ce(l.getConfiguration(),c):(void 0===e&&void 0===i&&(e=re.allowAttributes),void 0===n&&void 0===a&&(n=re.allowElements),{allowAttributes:e,allowComments:t,allowElements:n,allowCustomElements:r,blockElements:o,dropAttributes:i,dropElements:a,allowUnknownMarkup:s})}function ue(e,t=re){const n=(new DOMParser).parseFromString(se(e),"text/html");return Array.isArray(t.allowElements)&&!t.allowElements.includes("html")&&(t.allowElements=[...new Set([...t.allowElements,"html","head","body"])]),de(n,t)}function pe(e,t=re){if(e instanceof Node){if(e.nodeType===Node.DOCUMENT_FRAGMENT_NODE)return de(e,t);if(e.nodeType===Node.DOCUMENT_NODE)return de(le(e),t);throw new TypeError("sanitize requires a Document or DocumentFragment")}throw new TypeError("sanitize requires a Document or DocumentFragment")}function de(e,t=re){try{if(!(e instanceof Node))throw new TypeError(`Expected a Node but got a ${a(e)}.`);if(!i(t))throw new TypeError(`Expected config to be an object but got ${a(t)}.`);const{allowElements:n,allowComments:r,allowAttributes:o,allowCustomElements:s,blockElements:l,dropAttributes:c,dropElements:u,allowUnknownMarkup:p}=ce(t),d=document.createNodeIterator(e,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_COMMENT);let f=d.root.nodeType===Node.ELEMENT_NODE?d.root:d.nextNode();for(;f instanceof Node;){switch(f.nodeType){case Node.ELEMENT_NODE:{if(!p&&(!(f instanceof HTMLElement)||f instanceof HTMLUnknownElement)){f.remove();break}const e=f.tagName.toLowerCase();Array.isArray(u)&&u.includes(e)?f.remove():Array.isArray(l)&&l.includes(e)?f.hasChildNodes()?f.replaceWith(...f.childNodes):f.remove():e.includes("-")&&!s||Array.isArray(n)&&!n.includes(e)?f.remove():f.hasAttributes()&&f.getAttributeNames().forEach((t=>{const n=f.getAttributeNode(t),{value:r}=n;U.includes(t)&&!ie.includes(new URL(r,document.baseURI).protocol)?f.removeAttributeNode(n):i(c)?t in c&&["*",e].some((e=>c[t].includes(e)))&&f.removeAttributeNode(n):i(o)&&(t in o&&["*",e].some((e=>o[t].includes(e)))||f.removeAttributeNode(n))}));break}case Node.COMMENT_NODE:r||f.remove()}"template"===f.localName&&de(f.content,t),f=d.nextNode()}return e}catch(t){console.error(t),e.parentElement.removeChild(e)}}
|
|
40
40
|
/**
|
|
41
41
|
* @copyright 2022-2023 Chris Zuber <admin@kernvalley.us>
|
|
42
42
|
*/
|
|
43
|
-
const me=new WeakMap;const{setHTML:fe,polyfill:he}=function(e,t){return{setHTML:re,polyfill:function(){let n=!1;if("Sanitizer"in globalThis){if(globalThis.Sanitizer.getDefaultConfiguration instanceof Function||(globalThis.Sanitizer.getDefaultConfiguration=function(){return t},n=!0),!(globalThis.Sanitizer.prototype.getConfiguration instanceof Function)){const e=new WeakMap,t=globalThis.Sanitizer;globalThis.Sanitizer=class extends t{constructor({allowAttributes:n,allowComments:o,allowElements:r,allowCustomElements:i,blockElements:a,dropAttributes:s,dropElements:l,allowUnknownMarkup:c}=t.getDefaultConfiguration()){super({allowAttributes:n,allowComments:o,allowElements:r,allowCustomElements:i,blockElements:a,dropAttributes:s,dropElements:l,allowUnknownMarkup:c}),e.set(this,{allowAttributes:n,allowComments:o,allowElements:r,allowCustomElements:i,blockElements:a,dropAttributes:s,dropElements:l,allowUnknownMarkup:c})}getConfiguration(){return e.get(this)}},n=!0}globalThis.Sanitizer.prototype.sanitize instanceof Function||(globalThis.Sanitizer.prototype.sanitize=function(e){if(e instanceof Node){if([Node.DOCUMENT_NODE,Node.DOCUMENT_FRAGMENT_NODE].includes(e.nodeType))return pe(e,this.getConfiguration());throw new TypeError("Expected a Document or DocumentFragment in `Sanitizer.sanitize()`.")}throw new TypeError("`Sanitizer.sanitize()` expects a `Node`")},n=!0),globalThis.Sanitizer.prototype.sanitizeFor instanceof Function||(globalThis.Sanitizer.prototype.sanitizeFor=function(e,t){const n=document.createElement(e);return re(n,t,this.getConfiguration()),n},n=!0),Element.prototype.setHTML instanceof Function||(Element.prototype.setHTML=function(e,n=t){re(this,e,n)},n=!0)}else globalThis.Sanitizer=e,n=!0;return n}}}(class e{constructor({allowElements:t,allowAttributes:n,blockElements:o,dropAttributes:r,dropElements:i,allowComments:a=oe.allowComments,allowCustomElements:s=oe.allowCustomElements,allowUnknownMarkup:l=oe.allowUnknownMarkup}=e.getDefaultConfiguration()){me.set(this,{allowElements:t,allowComments:a,allowAttributes:n,allowCustomElements:s,blockElements:o,dropAttributes:r,dropElements:i,allowUnknownMarkup:l})}getConfiguration(){return me.get(this)}sanitize(e){return pe(e,this.getConfiguration())}sanitizeFor(e,t){const n=document.createElement(e);return n.setHTML(t,this.getConfiguration()),n}static getDefaultConfiguration(){return oe}},oe);he();const ye={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 n=[...new Set(e).difference(t)].map((e=>{const t=document.createElement("link"),n=new AbortController,o=n.signal,r=URL.createObjectURL(new File([],"adopted.css",{type:"text/css"}));return t.rel="stylesheet",t.href=r,t.classList.add("_adopted"),t.disabled=e.disabled,t.addEventListener("load",(({target:o})=>{n.abort(),t.media=e.media.mediaText,[...e.cssRules].forEach(((e,t)=>{o.sheet.insertRule(e.cssText,t)})),setTimeout((()=>URL.revokeObjectURL(o.href)),100)}),{once:!0,signal:o}),t.addEventListener("error",(({target:e})=>{n.abort(),URL.revokeObjectURL(e.href)}),{once:!0,signal:o}),t}));this instanceof Document?this.head.append(...n):this.append(...n)}}};function ge(e){for(;e.cssRules.length>0;)e.deleteRule(0)}e(Document,"parseHTML",((...e)=>ue(...e))),t(Document.prototype,"adoptedStyleSheets",ye),"ShadowRoot"in globalThis&&t(ShadowRoot.prototype,"adoptedStyleSheets",ye);try{new CSSStyleSheet}catch{const e=globalThis.CSSStyleSheet;globalThis.CSSStyleSheet=function({disabled:e=!1,media:t}={}){const n=function(e="",{disabled:t=!1,media:n}={}){const o=Document.parseHTML(`<style>${e}</style>`,{sanitizer:new Sanitizer({allowElements:["style","html","head","body"]})}).styleSheets.item(0);return"string"==typeof n&&o.media.appendMedium(n),o.disabled=t,o}("#dfgbkjdfg{color:red;}",{disabled:e,media:t});return n.deleteRule(0),n},globalThis.CSSStyleSheet.prototype=e.prototype,e.prototype.constructor=globalThis.CSSStyleSheet}CSSStyleSheet.prototype.replace instanceof Function||(CSSStyleSheet.prototype.replace=function(e){const t=document.createElement("link"),n=new AbortController,{resolve:o,reject:r,promise:i}=Promise.withResolvers();return t.addEventListener("load",(({target:e})=>{ge(this),[...e.sheet.cssRules].forEach(((e,t)=>this.insertRule(e.cssText,t))),o(this),n.abort(),URL.revokeObjectURL(e.href),e.remove()}),{once:!0,signal:n.signal}),t.addEventListener("error",(({target:e})=>{const t=new DOMException("Error loading stylesheet.");r(t),n.abort(t),URL.revokeObjectURL(e.href),e.remove()}),{once:!0,signal:n.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),i}),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);ge(this),[...t.cssRules].forEach(((e,t)=>this.insertRule(e.cssText,t)))});const be={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"};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(be.role)){const e=!0,t=!0,n=Object.fromEntries(Object.entries(be).map((([n,o])=>[n,{get:function(){return this.getAttribute(o)},set:function(e){"string"==typeof e?this.setAttribute(o,e):this.removeAttribute(o)},enumerable:e,configurable:t}])));Object.defineProperties(Element.prototype,n)}if(!HTMLElement.prototype.hasOwnProperty("inert")){const e=new WeakMap,t=n=>{e.has(n)&&(n.tabIndex=e.get(n)),n.hasChildNodes()&&[...n.children].forEach(t)},n=t=>{-1!==t.tabIndex&&(e.set(t,t.tabIndex),t.tabIndex=-1),t.hasChildNodes()&&[...t.children].forEach(n)};Object.defineProperty(HTMLElement.prototype,"inert",{get:function(){return this.hasAttribute("inert")},set:function(e){e?(this.setAttribute("aria-hidden","true"),this.setAttribute("inert",""),n(this)):(this.removeAttribute("aria-hidden"),this.removeAttribute("inert"),t(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 n=()=>{this.removeEventListener("error",o),this.removeEventListener("load",n),e()},o=e=>{this.removeEventListener("error",o),this.removeEventListener("load",n),t(e)};this.addEventListener("load",n),this.addEventListener("error",o)}))}),Element.prototype.setHTML instanceof Function?function(e,t,n){const{value:o,enumerable:r,configurable:i,writable:a}=Object.getOwnPropertyDescriptor(e,t),s=n(o);if(!(s instanceof Function))throw new TypeError(`Error overwriting ${t}. The func MUST be a function that accepts the original as an argument and return a function.`);Object.defineProperty(e,t,{value:s,enumerable:r,configurable:i,writable:a})}(Element.prototype,"setHTML",(function(e){return function(t,n={}){if(n.sanitizer instanceof Sanitizer)e.call(this,t,n);else{const o=new Sanitizer(function({allowAttributes:e,allowComments:t,allowElements:n,allowCustomElements:o,blockElements:r,dropAttributes:i,dropElements:a,allowUnknownMarkup:s}={}){return void 0===e&&void 0===i&&(e=oe.allowAttributes),void 0===n&&void 0===a&&(n=oe.allowElements),{allowAttributes:e,allowComments:t,allowElements:n,allowCustomElements:o,blockElements:r,dropAttributes:i,dropElements:a,allowUnknownMarkup:s}}(n));e.call(this,t,{sanitizer:o})}}})):Element.prototype.setHTML=function(e,t=oe){re(this,e,t)},!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 e=(t=document)=>{t.querySelectorAll("template[shadowrootmode]").forEach((t=>{const n=t.parentElement.attachShadow({mode:t.shadowRootMode});n.append(t.content),t.remove(),e(n)}))};"loading"===document.readyState?document.addEventListener("readystatechange",(()=>e(document)),{once:!0}):e(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||t(HTMLIFrameElement.prototype,"loading",{get:function(){return this.getAttribute("loading")||"auto"},set:function(e){this.setAttribute("loading",e)}}),"credentialless"in HTMLIFrameElement.prototype||t(HTMLIFrameElement.prototype,"credentialless",{get:function(){return this.hasAttribute("credentialless")},set:function(e){this.toggleAttribute("credentialless",e)}}),Set.prototype.intersection instanceof Function||(Set.prototype.intersection=function(e){return e instanceof Set||(e=new Set(e)),new Set([...this].filter((t=>e.has(t))))}),Set.prototype.difference instanceof Function||(Set.prototype.difference=function(e){return e instanceof Set||(e=new Set(e)),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){return e instanceof Set||(e=new Set(e)),[...this].every((t=>e.has(t)))}),Set.prototype.isSupersetOf instanceof Function||(Set.prototype.isSupersetOf=function(e){return e instanceof Set||(e=new Set(e)),e.isSubsetOf(this)}),Set.prototype.symmetricDifference instanceof Function||(Set.prototype.symmetricDifference=function(e){return e instanceof Set||(e=new Set(e)),new Set([...this.difference(e),...e.difference(this)])}),Set.prototype.isDisjointFrom instanceof Function||(Set.prototype.isDisjointFrom=function(e){return e instanceof Set||(e=new Set(e)),new Set([...this,...e]).size===this.size+e.size}),WeakMap.prototype.emplace instanceof Function||(WeakMap.prototype.emplace=function(e,{insert:t,update:n}={}){const o=this.has(e);if(o&&n instanceof Function){const t=this.get(e),o=n.call(this,t,e,this);return o!==t&&this.set(e,t),o}if(o)return this.get(e);if(t instanceof Function){const n=t.call(this,e,this);return this.set(e,n),n}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}}();
|
|
43
|
+
const fe=new WeakMap;const{setHTML:me,polyfill:he}=function(e,t){return{setHTML:oe,polyfill:function(){let n=!1;if("Sanitizer"in globalThis){if(globalThis.Sanitizer.getDefaultConfiguration instanceof Function||(globalThis.Sanitizer.getDefaultConfiguration=function(){return t},n=!0),!(globalThis.Sanitizer.prototype.getConfiguration instanceof Function)){const e=new WeakMap,t=globalThis.Sanitizer;globalThis.Sanitizer=class extends t{constructor({allowAttributes:n,allowComments:r,allowElements:o,allowCustomElements:i,blockElements:a,dropAttributes:s,dropElements:l,allowUnknownMarkup:c}=t.getDefaultConfiguration()){super({allowAttributes:n,allowComments:r,allowElements:o,allowCustomElements:i,blockElements:a,dropAttributes:s,dropElements:l,allowUnknownMarkup:c}),e.set(this,{allowAttributes:n,allowComments:r,allowElements:o,allowCustomElements:i,blockElements:a,dropAttributes:s,dropElements:l,allowUnknownMarkup:c})}getConfiguration(){return e.get(this)}},n=!0}globalThis.Sanitizer.prototype.sanitize instanceof Function||(globalThis.Sanitizer.prototype.sanitize=function(e){if(e instanceof Node){if([Node.DOCUMENT_NODE,Node.DOCUMENT_FRAGMENT_NODE].includes(e.nodeType))return pe(e,this.getConfiguration());throw new TypeError("Expected a Document or DocumentFragment in `Sanitizer.sanitize()`.")}throw new TypeError("`Sanitizer.sanitize()` expects a `Node`")},n=!0),globalThis.Sanitizer.prototype.sanitizeFor instanceof Function||(globalThis.Sanitizer.prototype.sanitizeFor=function(e,t){const n=document.createElement(e);return oe(n,t,this.getConfiguration()),n},n=!0),Element.prototype.setHTML instanceof Function||(Element.prototype.setHTML=function(e,n=t){oe(this,e,n)},n=!0)}else globalThis.Sanitizer=e,n=!0;return n}}}(class e{constructor({allowElements:t,allowAttributes:n,blockElements:r,dropAttributes:o,dropElements:i,allowComments:a=re.allowComments,allowCustomElements:s=re.allowCustomElements,allowUnknownMarkup:l=re.allowUnknownMarkup}=e.getDefaultConfiguration()){fe.set(this,{allowElements:t,allowComments:a,allowAttributes:n,allowCustomElements:s,blockElements:r,dropAttributes:o,dropElements:i,allowUnknownMarkup:l})}getConfiguration(){return fe.get(this)}sanitize(e){return pe(e,this.getConfiguration())}sanitizeFor(e,t){const n=document.createElement(e);return n.setHTML(t,this.getConfiguration()),n}static getDefaultConfiguration(){return re}},re);he();const ye={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 n=[...new Set(e).difference(t)].map((e=>{const t=document.createElement("link"),n=new AbortController,r=n.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:r})=>{n.abort(),t.media=e.media.mediaText,[...e.cssRules].forEach(((e,t)=>{r.sheet.insertRule(e.cssText,t)})),setTimeout((()=>URL.revokeObjectURL(r.href)),100)}),{once:!0,signal:r}),t.addEventListener("error",(({target:e})=>{n.abort(),URL.revokeObjectURL(e.href)}),{once:!0,signal:r}),t}));this instanceof Document?this.head.append(...n):this.append(...n)}}};function be(e){for(;e.cssRules.length>0;)e.deleteRule(0)}e(Document,"parseHTML",((...e)=>ue(...e))),t(Document.prototype,"adoptedStyleSheets",ye),"ShadowRoot"in globalThis&&t(ShadowRoot.prototype,"adoptedStyleSheets",ye);try{new CSSStyleSheet}catch{const Me=globalThis.CSSStyleSheet;globalThis.CSSStyleSheet=function({disabled:e=!1,media:t}={}){const n=function(e="",{disabled:t=!1,media:n}={}){const r=Document.parseHTML(`<style>${e}</style>`,{sanitizer:new Sanitizer({allowElements:["style","html","head","body"]})}).styleSheets.item(0);return"string"==typeof n&&r.media.appendMedium(n),r.disabled=t,r}("#dfgbkjdfg{color:red;}",{disabled:e,media:t});return n.deleteRule(0),n},globalThis.CSSStyleSheet.prototype=Me.prototype,Me.prototype.constructor=globalThis.CSSStyleSheet}CSSStyleSheet.prototype.replace instanceof Function||(CSSStyleSheet.prototype.replace=function(e){const t=document.createElement("link"),n=new AbortController,{resolve:r,reject:o,promise:i}=Promise.withResolvers();return t.addEventListener("load",(({target:e})=>{be(this),[...e.sheet.cssRules].forEach(((e,t)=>this.insertRule(e.cssText,t))),r(this),n.abort(),URL.revokeObjectURL(e.href),e.remove()}),{once:!0,signal:n.signal}),t.addEventListener("error",(({target:e})=>{const t=new DOMException("Error loading stylesheet.");o(t),n.abort(t),URL.revokeObjectURL(e.href),e.remove()}),{once:!0,signal:n.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),i}),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);be(this),[...t.cssRules].forEach(((e,t)=>this.insertRule(e.cssText,t)))});const ge={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"};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(ge.role)){const Le=!0,Oe=!0,Fe=Object.fromEntries(Object.entries(ge).map((([e,t])=>[e,{get:function(){return this.getAttribute(t)},set:function(e){"string"==typeof e?this.setAttribute(t,e):this.removeAttribute(t)},enumerable:Le,configurable:Oe}])));Object.defineProperties(Element.prototype,Fe)}if(!HTMLElement.prototype.hasOwnProperty("inert")){const ke=new WeakMap,Pe=e=>{ke.has(e)&&(e.tabIndex=ke.get(e)),e.hasChildNodes()&&[...e.children].forEach(Pe)},xe=e=>{-1!==e.tabIndex&&(ke.set(e,e.tabIndex),e.tabIndex=-1),e.hasChildNodes()&&[...e.children].forEach(xe)};Object.defineProperty(HTMLElement.prototype,"inert",{get:function(){return this.hasAttribute("inert")},set:function(e){e?(this.setAttribute("aria-hidden","true"),this.setAttribute("inert",""),xe(this)):(this.removeAttribute("aria-hidden"),this.removeAttribute("inert"),Pe(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 n=()=>{this.removeEventListener("error",r),this.removeEventListener("load",n),e()},r=e=>{this.removeEventListener("error",r),this.removeEventListener("load",n),t(e)};this.addEventListener("load",n),this.addEventListener("error",r)}))}),Element.prototype.setHTML instanceof Function?function(e,t,n){const{value:r,enumerable:o,configurable:i,writable:a}=Object.getOwnPropertyDescriptor(e,t),s=n(r);if(!(s instanceof Function))throw new TypeError(`Error overwriting ${t}. The func MUST be a function that accepts the original as an argument and return a function.`);Object.defineProperty(e,t,{value:s,enumerable:o,configurable:i,writable:a})}(Element.prototype,"setHTML",(function(e){return function(t,n={}){if(n.sanitizer instanceof Sanitizer)e.call(this,t,n);else{const r=new Sanitizer(function({allowAttributes:e,allowComments:t,allowElements:n,allowCustomElements:r,blockElements:o,dropAttributes:i,dropElements:a,allowUnknownMarkup:s}={}){return void 0===e&&void 0===i&&(e=re.allowAttributes),void 0===n&&void 0===a&&(n=re.allowElements),{allowAttributes:e,allowComments:t,allowElements:n,allowCustomElements:r,blockElements:o,dropAttributes:i,dropElements:a,allowUnknownMarkup:s}}(n));e.call(this,t,{sanitizer:r})}}})):Element.prototype.setHTML=function(e,t=re){oe(this,e,t)},!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 Ne=(e=document)=>{e.querySelectorAll("template[shadowrootmode]").forEach((e=>{const t=e.parentElement.attachShadow({mode:e.shadowRootMode});t.append(e.content),e.remove(),Ne(t)}))};"loading"===document.readyState?document.addEventListener("readystatechange",(()=>Ne(document)),{once:!0}):Ne(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||t(HTMLIFrameElement.prototype,"loading",{get:function(){return this.getAttribute("loading")||"auto"},set:function(e){this.setAttribute("loading",e)}}),"credentialless"in HTMLIFrameElement.prototype||t(HTMLIFrameElement.prototype,"credentialless",{get:function(){return this.hasAttribute("credentialless")},set:function(e){this.toggleAttribute("credentialless",e)}}),Set.prototype.intersection instanceof Function||(Set.prototype.intersection=function(e){return e instanceof Set||(e=new Set(e)),new Set([...this].filter((t=>e.has(t))))}),Set.prototype.difference instanceof Function||(Set.prototype.difference=function(e){return e instanceof Set||(e=new Set(e)),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){return e instanceof Set||(e=new Set(e)),[...this].every((t=>e.has(t)))}),Set.prototype.isSupersetOf instanceof Function||(Set.prototype.isSupersetOf=function(e){return e instanceof Set||(e=new Set(e)),e.isSubsetOf(this)}),Set.prototype.symmetricDifference instanceof Function||(Set.prototype.symmetricDifference=function(e){return e instanceof Set||(e=new Set(e)),new Set([...this.difference(e),...e.difference(this)])}),Set.prototype.isDisjointFrom instanceof Function||(Set.prototype.isDisjointFrom=function(e){return e instanceof Set||(e=new Set(e)),new Set([...this,...e]).size===this.size+e.size}),WeakMap.prototype.emplace instanceof Function||(WeakMap.prototype.emplace=function(e,{insert:t,update:n}={}){const r=this.has(e);if(r&&n instanceof Function){const t=this.get(e),r=n.call(this,t,e,this);return r!==t&&this.set(e,t),r}if(r)return this.get(e);if(t instanceof Function){const n=t.call(this,e,this);return this.set(e,n),n}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}}();
|
|
44
44
|
/**
|
|
45
45
|
* @copyright 2023 Chris Zuber <admin@kernvalley.us>
|
|
46
46
|
*/
|
|
47
|
-
const we="user-blocking",Te="user-visible",ve="background";async function Ee(e,{delay:t=0,signal:n}={}){return new Promise(((o
|
|
47
|
+
const we="user-blocking",Te="user-visible",ve="background";async function Ee(e,{delay:t=0,signal:n}={}){return new Promise(((r,o)=>{if(n instanceof AbortSignal&&n.aborted)o(n.reason);else{const i=new AbortController,a=setTimeout((()=>{r(e()),i.abort()}),t);n instanceof AbortSignal&&n.addEventListener("abort",(({target:e})=>{o(e.reason),clearTimeout(a)}),{once:!0,signal:i.signal})}}))}class Se{async postTask(e,{priority:t=Te,delay:n,signal:r}={}){return new Promise(((o,i)=>{if(r instanceof AbortSignal&&r.aborted)i(r.reason);else switch(t){case we:"number"==typeof n&&!Number.isNaN(n)&&n>0?Ee(e,{delay:n,signal:r}).then(o,i):o((async()=>await e())());break;case Te:if("number"==typeof n&&!Number.isNaN(n)&&n>0)Ee((()=>requestAnimationFrame((async()=>{try{const t=await e();o(t)}catch(e){i(e)}}))),{delay:n,signal:r}).catch(i);else{const t=new AbortController,n=requestAnimationFrame((async()=>{try{const t=await e();o(t)}catch(e){i(e)}finally{t.abort()}}));r instanceof AbortSignal&&r.addEventListener("abort",(({target:e})=>{cancelAnimationFrame(n),i(e.reason)}),{once:!0,signal:t.signal})}break;case ve:if("number"==typeof n&&!Number.isNaN(n)&&n>0)Ee((()=>requestIdleCallback((async()=>{try{const t=await e();o(t)}catch(e){i(e)}}))),{delay:n,signal:r}).catch(i);else{const t=new AbortController,n=requestIdleCallback((async()=>{try{const t=await e();o(t)}catch(e){i(e)}finally{t.abort()}}));r instanceof AbortSignal&&r.addEventListener("abort",(({target:e})=>{cancelIdleCallback(n),i(e.reason)}),{once:!0,signal:t.signal})}break;default:throw new TypeError(`Scheduler.postTask: '${t}' (value of 'priority' member of SchedulerPostTaskOptions) is not a valid value for enumeration TaskPriority.`)}}))}}"scheduler"in globalThis||(globalThis.scheduler=new Se)
|
|
48
48
|
/**
|
|
49
49
|
* @copyright 2023 Chris Zuber <admin@kernvalley.us>
|
|
50
50
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/ElementInternals
|
|
@@ -62,5 +62,5 @@ const we="user-blocking",Te="user-visible",ve="background";async function Ee(e,{
|
|
|
62
62
|
* Additionally, if `internals.states._polyfilled`
|
|
63
63
|
* - Use `._state--*` in addition to `:--*` to query element internals states
|
|
64
64
|
* - This includes `:disabled` -> `._state--disabled` & `:invalid` -> `._state--invalid`
|
|
65
|
-
*/;const Me={key:Symbol("key"),internals:Symbol("element-internals"),form:Symbol("form"),fieldset:Symbol("fieldset"),element:Symbol("element"),validity:Symbol("validity"),validationMessage:Symbol("validation-message"),value:Symbol("value"),state:Symbol("state"),formController:Symbol("form-controller"),anchor:Symbol("anchor"),customInputs:Symbol("custom-inputs")};if(!(HTMLElement.prototype.attachInternals instanceof Function)&&"FormDataEvent"in globalThis){const e={valueMissing:!1,typeMismatch:!1,patternMismatch:!1,tooLong:!1,tooShort:!1,rangeUnderflow:!1,rangeOverflow:!1,stepMismatch:!1,badInput:!1,customError:!1,valid:!0},t=e=>e.hasOwnProperty(Me.fieldset)&&e[Me.fieldset]instanceof HTMLFieldSetElement&&e[Me.fieldset].disabled,n=e=>e instanceof HTMLElement&&e.tagName.includes("-")&&customElements.get(e.tagName.toLowerCase()).formAssociated,o=(e,t)=>function(n){if(n.target.reportValidity()){if(t.willValidate&&n.formData instanceof FormData){const o=t[Me.value];o instanceof FormData?o.entries().forEach((([e,t])=>n.formData.set(e,t))):e.hasAttribute("name")&&n.formData.set(e.getAttribute("name"),t[Me.value])}}else n.preventDefault(),n.stopImmediatePropagation(),n.stopPropagation()},r=(e,t)=>{Object.entries(t).forEach((([t,n])=>e.style.setProperty(t,n)))},i=e=>e.hasAttribute("form")&&document.forms[e.getAttribute("form")]||e.closest("form"),a=(e,t,r)=>{if(e instanceof HTMLFormElement){if(!(r instanceof HTMLElement&&r.tagName.includes("-")))throw new TypeError("Not a custom element");if(!(t instanceof c||t instanceof globalThis.ElementInternals))throw new TypeError("Invalid ElementInternals");if(!n(r))throw new TypeError(`${r.tagName} is not form associated.`);if(!(r.formAssociatedCallback instanceof Function))throw new TypeError(`${r.tagName} is missing a formAssociatedCallback method.`);{const n=new AbortController,i=r.closest("fieldset");i instanceof Element&&(r[Me.fieldset]=i,i.hasOwnProperty(Me.customInputs)||(i[Me.customInputs]=new Set),i[Me.customInputs].add(r),s.observe(i,l)),t[Me.form]=e,t[Me.formController]=n;const{checkValidity:a,reportValidity:c}=e;e.reportValidity=function(){return!!c.call(this)&&t.reportValidity()},e.checkValidity=function(){return!!a.call(this)&&t.checkValidity()},n.signal.addEventListener("abort",(()=>{e.reportValidity=c,e.checkValidity=a}),{once:!0}),e.addEventListener("formdata",o(r,t),{signal:n.signal}),e.addEventListener("submit",(e=>{e.target.reportValidity()||(e.preventDefault(),e.stopImmediatePropagation(),e.stopPropagation())}),{signal:n.signal}),r.formResetCallback instanceof Function&&e.addEventListener("reset",(()=>r.formResetCallback()),{signal:n.signal})}}else if(t[Me.formController]instanceof AbortController&&t[Me.formController].abort(),t[Me.form]=null,t[Me.formController]=null,r.hasOwnProperty(Me.fieldset)){const e=r[Me.fieldset];e.hasOwnProperty(Me.customInputs)&&(e[Me.customInputs].delete(r),0===e[Me.customInputs.size]&&delete e[Me.customInputs]),r[Me.fieldset]=null}},s=new MutationObserver((e=>{e.forEach((({target:o,type:r,attributeName:i})=>{if("attributes"===r&&"disabled"===i){const r=o.hasAttribute("disabled");if(n(o)&&o.hasOwnProperty(Me.internals)&&o[Me.internals].states.has("--disabled")!==r&&(1===e.length?!t(o):o.hasAttribute("disabled")===t(o)&&e.some((e=>e.target.isSameNode(o[Me.fieldset]))))){const e=o[Me.internals];r?e.states.add("--disabled"):e.states.delete("--disabled"),o.formDisabledCallback instanceof Function&&o.formDisabledCallback(r)}else"FIELDSET"!==o.tagName||!o.hasOwnProperty(Me.customInputs)||1!==e.length&&e.some((e=>o[Me.customInputs].has(e.target)))||o[Me.customInputs].forEach((e=>{e.isConnected&&e.hasOwnProperty(Me.internals)?e.hasAttribute("disabled")||(r?e[Me.internals].states.add("--disabled"):e[Me.internals].states.delete("--disabled"),e.formDisabledCallback instanceof Function&&e.formDisabledCallback(r)):o[Me.customInputs].delete(e)}))}}))})),l={attributes:!0,attributeFilter:["disabled"]};class c{constructor(t,o){if(o!==Me.key)throw new TypeError("Illegal constructor");if(!(t instanceof HTMLElement))throw new TypeError("Must be called on an HTMLElement");if(!t.tagName.includes("-"))throw new DOMException("Cannot attach internals to a built-in element.");{const o=!0,r=!1,i=!0;Object.defineProperties(this,{[Me.element]:{value:t,configurable:o,enumerable:r,writable:i},[Me.form]:{value:null,configurable:o,enumerable:r,writable:i},[Me.fieldset]:{value:null,configurable:o,enumerable:r,writable:i},[Me.anchor]:{value:null,configurable:o,enumerable:r,writable:i},[Me.validity]:{value:e,configurable:o,enumerable:r,writable:i},[Me.validationMessage]:{value:"",configurable:o,enumerable:r,writable:i},[Me.value]:{value:null,configurable:o,enumerable:r,writable:i},[Me.state]:{value:null,configurable:o,enumerable:r,writable:i},[Me.formController]:{value:null,configurable:o,enumerable:r,writable:i}}),n(t)&&s.observe(t,l),Object.defineProperty(t,Me.internals,{value:this,enumerable:!1,configurable:!1,writable:!1}),setTimeout((()=>this.states.add("--element-internals-polyfilled")),10)}}get form(){return this[Me.form]}get labels(){const e=this.form;return e instanceof HTMLFormElement&&0!==this[Me.element].id.length?e.querySelectorAll(`label[for="${this[Me.element].id}"]`):document.createDocumentFragment().childNodes}get _polyfilled(){return!0}get shadowRoot(){return this[Me.element].shadowRoot}get validity(){return n(this[Me.element])?this[Me.validity]:void 0}get validationMessage(){return n(this[Me.element])?this[Me.validationMessage]||"":void 0}get willValidate(){const e=this[Me.element];return n(e)&&!t(e)&&!["disabled","readonly"].some((t=>e.hasAttribute(t)))}checkValidity(){if(this.willValidate){if(this.validity.valid){const e=this[Me.element].nextElementSibling;return e instanceof HTMLElement&&e.classList.contains("_element-internals-popup")&&e.remove(),!0}return this[Me.element].dispatchEvent(new Event("invalid")),!1}return!0}reportValidity(){if(this.checkValidity())return!0;{const e=this.validationMessage;if("string"==typeof e&&0!==e.length){const{bottom:t,left:n}=this[Me.element].getBoundingClientRect(),o=document.createElement("div");o.textContent=e,r(o,{position:"fixed","background-color":"#2b2a33",color:"#fafafa",top:`${t+2}px`,left:`${n}px`,"z-index":2147483647,"color-scheme":"light-dark","font-family":"system-ui, serif","font-size":"18px",display:"inline-block",padding:"0.6em 0.8em",border:"1px solid #1a1a1a","border-radius":"6px"}),o.classList.add("_element-internals-popup"),this[Me.element].focus();const i=this[Me.element].nextElementSibling;i instanceof Element&&i.classList.contains("_element-internals-popup")&&i.remove(),this[Me.element].insertAdjacentElement("afterend",o),this[Me.anchor]instanceof Element&&this[Me.anchor].focus(),setTimeout((()=>{o.isConnected&&o.remove()}),3e3)}return!1}}setFormValue(e,t){if(!n(this[Me.element]))throw new DOMException("Not form associated");this[Me.value]=e,this[Me.state]=t}setValidity({valueMissing:e=!1,typeMismatch:t=!1,patternMismatch:o=!1,tooLong:r=!1,tooShort:i=!1,rangeUnderflow:a=!1,rangeOverflow:s=!1,stepMismatch:l=!1,badInput:c=!1,customError:u=!1},p="",d){if(!n(this[Me.element]))throw new DOMException("Not form associated");if(("string"!=typeof p||0===p.length)&&(e||t||o||r||i||a||s||l||c||u))throw new DOMException("Message required if any flags are true.");{const n=[e,t,o,r,i,a,s,l,c,u].every((e=>!1===e));this[Me.validity]={valueMissing:e,typeMismatch:t,patternMismatch:o,tooLong:r,tooShort:i,rangeUnderflow:a,rangeOverflow:s,stepMismatch:l,badInput:c,customError:u,valid:n},this[Me.validationMessage]=p,this[Me.anchor]=d,n?(this.states.delete("--invalid"),this.states.add("--valid")):(this.states.add("--invalid"),this.states.delete("--valid"),this[Me.element].dispatchEvent(new Event("invalid")))}}_associateForm(e,t){a(e,this,t)}_findAssociatedForm(e){return i(e)}}HTMLElement.prototype.attachInternals=function(){if(this.hasOwnProperty(Me.internals))throw new DOMException("Invalid operation");if(this.tagName.includes("-"))return new c(this,Me.key);throw new DOMException("Cannot call attachInternals on built-in elements.")},globalThis.ElementInternals=c}if("ElementInternals"in globalThis&&!("CustomStateSet"in globalThis)){const e="_state",t=new WeakMap,n=t=>{if(t.toString().startsWith("--"))return`${e}${t}`;throw new DOMException(`Failed to execute 'add' on 'CustomStateSet': The specified value '${t}' must start with '--'.`)},{value:o,writable:r,configurable:i,enumerable:a}=Object.getOwnPropertyDescriptor(HTMLElement.prototype,"attachInternals");class s{constructor(e,n){if(n!==Me.key)throw new TypeError("Illegal Constructor");if(!(e instanceof HTMLElement))throw new TypeError("el must be an HTMLElement");t.set(this,e),this.add("--custom-states-polyfilled")}get _polyfilled(){return!0}get size(){return[...this.values()].length}add(e){t.get(this).classList.add(n(e))}has(e){return t.get(this).classList.contains(n(e))}delete(e){const o=n(e);return!!t.get(this).classList.contains(o)&&(t.get(this).classList.remove(o),!0)}clear(){this.values().forEach((e=>this.delete(e)))}keys(){return this.values()}values(){return t.get(this).classList.values().filter((t=>t.startsWith(`${e}--`))).map((t=>t.substr(e.length)))}entries(){return this.values().map((e=>[e,e]))}forEach(e,t){this.values().forEach((n=>e.call(t||this,n,n,this)))}[Symbol.toStringTag](){return"CustomStateSet"}[Symbol.iterator](){return this.values()}}Object.defineProperty(HTMLElement.prototype,"attachInternals",{value:function(){const e=o.call(this);return Object.defineProperty(e,Me.element,{value:this,enumerable:!1,writable:!1,configurable:!1}),Object.defineProperty(e,"states",{value:new s(this,Me.key),configurable:!0,enumberable:!0}),Object.is(e.shadowRoot,null)&&!Object.is(this.shadowRoot,null)&&Object.defineProperty(e,"shadowRoot",{value:this.shadowRoot,configurable:!0,enumerable:!0}),e},writable:r,configurable:i,enumerable:a}),globalThis.CustomStateSet=s,function(e){const t=Object.fromEntries(Object.keys(be).map((e=>[e,{get:function(){return this[Me.element][e]},set:function(t){this[Me.element][e]=t},enumerable:!0,configurable:!0}])));Object.defineProperties(e,t)}(ElementInternals.prototype)}e(Response,"json",((e,{status:t=200,statusText:n="",headers:o=new Headers}={})=>o instanceof Headers?(o.set("Content-Type","application/json"),new Response(JSON.stringify(e),{status:t,statusText:n,headers:o})):Response.json(e,{status:t,statusText:n,headers:new Headers(o)}))),e(Response,"redirect",((e,t=302)=>new Response("",{status:t,headers:new Headers({Location:e})})))}();
|
|
65
|
+
*/;const Ae={key:Symbol("key"),internals:Symbol("element-internals"),form:Symbol("form"),fieldset:Symbol("fieldset"),element:Symbol("element"),validity:Symbol("validity"),validationMessage:Symbol("validation-message"),value:Symbol("value"),state:Symbol("state"),formController:Symbol("form-controller"),anchor:Symbol("anchor"),customInputs:Symbol("custom-inputs")};if(!(HTMLElement.prototype.attachInternals instanceof Function)&&"FormDataEvent"in globalThis){const Ce={valueMissing:!1,typeMismatch:!1,patternMismatch:!1,tooLong:!1,tooShort:!1,rangeUnderflow:!1,rangeOverflow:!1,stepMismatch:!1,badInput:!1,customError:!1,valid:!0},Ie=e=>e.hasOwnProperty(Ae.fieldset)&&e[Ae.fieldset]instanceof HTMLFieldSetElement&&e[Ae.fieldset].disabled,De=e=>e instanceof HTMLElement&&e.tagName.includes("-")&&customElements.get(e.tagName.toLowerCase()).formAssociated,je=(e,t)=>function(n){if(n.target.reportValidity()){if(t.willValidate&&n.formData instanceof FormData){const r=t[Ae.value];r instanceof FormData?r.entries().forEach((([e,t])=>n.formData.set(e,t))):e.hasAttribute("name")&&n.formData.set(e.getAttribute("name"),t[Ae.value])}}else n.preventDefault(),n.stopImmediatePropagation(),n.stopPropagation()},Re=(e,t)=>{Object.entries(t).forEach((([t,n])=>e.style.setProperty(t,n)))},He=e=>e.hasAttribute("form")&&document.forms[e.getAttribute("form")]||e.closest("form"),Ue=(e,t,n)=>{if(e instanceof HTMLFormElement){if(!(n instanceof HTMLElement&&n.tagName.includes("-")))throw new TypeError("Not a custom element");if(!(t instanceof Be||t instanceof globalThis.ElementInternals))throw new TypeError("Invalid ElementInternals");if(!De(n))throw new TypeError(`${n.tagName} is not form associated.`);if(!(n.formAssociatedCallback instanceof Function))throw new TypeError(`${n.tagName} is missing a formAssociatedCallback method.`);{const r=new AbortController,o=n.closest("fieldset");o instanceof Element&&(n[Ae.fieldset]=o,o.hasOwnProperty(Ae.customInputs)||(o[Ae.customInputs]=new Set),o[Ae.customInputs].add(n),qe.observe(o,ze)),t[Ae.form]=e,t[Ae.formController]=r;const{checkValidity:i,reportValidity:a}=e;e.reportValidity=function(){return!!a.call(this)&&t.reportValidity()},e.checkValidity=function(){return!!i.call(this)&&t.checkValidity()},r.signal.addEventListener("abort",(()=>{e.reportValidity=a,e.checkValidity=i}),{once:!0}),e.addEventListener("formdata",je(n,t),{signal:r.signal}),e.addEventListener("submit",(e=>{e.target.reportValidity()||(e.preventDefault(),e.stopImmediatePropagation(),e.stopPropagation())}),{signal:r.signal}),n.formResetCallback instanceof Function&&e.addEventListener("reset",(()=>n.formResetCallback()),{signal:r.signal})}}else if(t[Ae.formController]instanceof AbortController&&t[Ae.formController].abort(),t[Ae.form]=null,t[Ae.formController]=null,n.hasOwnProperty(Ae.fieldset)){const e=n[Ae.fieldset];e.hasOwnProperty(Ae.customInputs)&&(e[Ae.customInputs].delete(n),0===e[Ae.customInputs.size]&&delete e[Ae.customInputs]),n[Ae.fieldset]=null}},qe=new MutationObserver((e=>{e.forEach((({target:t,type:n,attributeName:r})=>{if("attributes"===n&&"disabled"===r){const n=t.hasAttribute("disabled");if(De(t)&&t.hasOwnProperty(Ae.internals)&&t[Ae.internals].states.has("--disabled")!==n&&(1===e.length?!Ie(t):t.hasAttribute("disabled")===Ie(t)&&e.some((e=>e.target.isSameNode(t[Ae.fieldset]))))){const e=t[Ae.internals];n?e.states.add("--disabled"):e.states.delete("--disabled"),t.formDisabledCallback instanceof Function&&t.formDisabledCallback(n)}else"FIELDSET"!==t.tagName||!t.hasOwnProperty(Ae.customInputs)||1!==e.length&&e.some((e=>t[Ae.customInputs].has(e.target)))||t[Ae.customInputs].forEach((e=>{e.isConnected&&e.hasOwnProperty(Ae.internals)?e.hasAttribute("disabled")||(n?e[Ae.internals].states.add("--disabled"):e[Ae.internals].states.delete("--disabled"),e.formDisabledCallback instanceof Function&&e.formDisabledCallback(n)):t[Ae.customInputs].delete(e)}))}}))})),ze={attributes:!0,attributeFilter:["disabled"]};class Be{constructor(e,t){if(t!==Ae.key)throw new TypeError("Illegal constructor");if(!(e instanceof HTMLElement))throw new TypeError("Must be called on an HTMLElement");if(!e.tagName.includes("-"))throw new DOMException("Cannot attach internals to a built-in element.");{const t=!0,n=!1,r=!0;Object.defineProperties(this,{[Ae.element]:{value:e,configurable:t,enumerable:n,writable:r},[Ae.form]:{value:null,configurable:t,enumerable:n,writable:r},[Ae.fieldset]:{value:null,configurable:t,enumerable:n,writable:r},[Ae.anchor]:{value:null,configurable:t,enumerable:n,writable:r},[Ae.validity]:{value:Ce,configurable:t,enumerable:n,writable:r},[Ae.validationMessage]:{value:"",configurable:t,enumerable:n,writable:r},[Ae.value]:{value:null,configurable:t,enumerable:n,writable:r},[Ae.state]:{value:null,configurable:t,enumerable:n,writable:r},[Ae.formController]:{value:null,configurable:t,enumerable:n,writable:r}}),De(e)&&qe.observe(e,ze),Object.defineProperty(e,Ae.internals,{value:this,enumerable:!1,configurable:!1,writable:!1}),setTimeout((()=>this.states.add("--element-internals-polyfilled")),10)}}get form(){return this[Ae.form]}get labels(){const e=this.form;return e instanceof HTMLFormElement&&0!==this[Ae.element].id.length?e.querySelectorAll(`label[for="${this[Ae.element].id}"]`):document.createDocumentFragment().childNodes}get _polyfilled(){return!0}get shadowRoot(){return this[Ae.element].shadowRoot}get validity(){return De(this[Ae.element])?this[Ae.validity]:void 0}get validationMessage(){return De(this[Ae.element])?this[Ae.validationMessage]||"":void 0}get willValidate(){const e=this[Ae.element];return De(e)&&!Ie(e)&&!["disabled","readonly"].some((t=>e.hasAttribute(t)))}checkValidity(){if(this.willValidate){if(this.validity.valid){const e=this[Ae.element].nextElementSibling;return e instanceof HTMLElement&&e.classList.contains("_element-internals-popup")&&e.remove(),!0}return this[Ae.element].dispatchEvent(new Event("invalid")),!1}return!0}reportValidity(){if(this.checkValidity())return!0;{const e=this.validationMessage;if("string"==typeof e&&0!==e.length){const{bottom:t,left:n}=this[Ae.element].getBoundingClientRect(),r=document.createElement("div");r.textContent=e,Re(r,{position:"fixed","background-color":"#2b2a33",color:"#fafafa",top:`${t+2}px`,left:`${n}px`,"z-index":2147483647,"color-scheme":"light-dark","font-family":"system-ui, serif","font-size":"18px",display:"inline-block",padding:"0.6em 0.8em",border:"1px solid #1a1a1a","border-radius":"6px"}),r.classList.add("_element-internals-popup"),this[Ae.element].focus();const o=this[Ae.element].nextElementSibling;o instanceof Element&&o.classList.contains("_element-internals-popup")&&o.remove(),this[Ae.element].insertAdjacentElement("afterend",r),this[Ae.anchor]instanceof Element&&this[Ae.anchor].focus(),setTimeout((()=>{r.isConnected&&r.remove()}),3e3)}return!1}}setFormValue(e,t){if(!De(this[Ae.element]))throw new DOMException("Not form associated");this[Ae.value]=e,this[Ae.state]=t}setValidity({valueMissing:e=!1,typeMismatch:t=!1,patternMismatch:n=!1,tooLong:r=!1,tooShort:o=!1,rangeUnderflow:i=!1,rangeOverflow:a=!1,stepMismatch:s=!1,badInput:l=!1,customError:c=!1},u="",p){if(!De(this[Ae.element]))throw new DOMException("Not form associated");if(("string"!=typeof u||0===u.length)&&(e||t||n||r||o||i||a||s||l||c))throw new DOMException("Message required if any flags are true.");{const d=[e,t,n,r,o,i,a,s,l,c].every((e=>!1===e));this[Ae.validity]={valueMissing:e,typeMismatch:t,patternMismatch:n,tooLong:r,tooShort:o,rangeUnderflow:i,rangeOverflow:a,stepMismatch:s,badInput:l,customError:c,valid:d},this[Ae.validationMessage]=u,this[Ae.anchor]=p,d?(this.states.delete("--invalid"),this.states.add("--valid")):(this.states.add("--invalid"),this.states.delete("--valid"),this[Ae.element].dispatchEvent(new Event("invalid")))}}_associateForm(e,t){Ue(e,this,t)}_findAssociatedForm(e){return He(e)}}HTMLElement.prototype.attachInternals=function(){if(this.hasOwnProperty(Ae.internals))throw new DOMException("Invalid operation");if(this.tagName.includes("-"))return new Be(this,Ae.key);throw new DOMException("Cannot call attachInternals on built-in elements.")},globalThis.ElementInternals=Be}if("ElementInternals"in globalThis&&!("CustomStateSet"in globalThis)){const $e="_state",_e=new WeakMap,Ve=e=>{if(e.toString().startsWith("--"))return`${$e}${e}`;throw new DOMException(`Failed to execute 'add' on 'CustomStateSet': The specified value '${e}' must start with '--'.`)},{value:We,writable:Ge,configurable:Ke,enumerable:Qe}=Object.getOwnPropertyDescriptor(HTMLElement.prototype,"attachInternals");class Je{constructor(e,t){if(t!==Ae.key)throw new TypeError("Illegal Constructor");if(!(e instanceof HTMLElement))throw new TypeError("el must be an HTMLElement");_e.set(this,e),this.add("--custom-states-polyfilled")}get _polyfilled(){return!0}get size(){return[...this.values()].length}add(e){_e.get(this).classList.add(Ve(e))}has(e){return _e.get(this).classList.contains(Ve(e))}delete(e){const t=Ve(e);return!!_e.get(this).classList.contains(t)&&(_e.get(this).classList.remove(t),!0)}clear(){this.values().forEach((e=>this.delete(e)))}keys(){return this.values()}values(){return _e.get(this).classList.values().filter((e=>e.startsWith(`${$e}--`))).map((e=>e.substr($e.length)))}entries(){return this.values().map((e=>[e,e]))}forEach(e,t){this.values().forEach((n=>e.call(t||this,n,n,this)))}[Symbol.toStringTag](){return"CustomStateSet"}[Symbol.iterator](){return this.values()}}Object.defineProperty(HTMLElement.prototype,"attachInternals",{value:function(){const e=We.call(this);return Object.defineProperty(e,Ae.element,{value:this,enumerable:!1,writable:!1,configurable:!1}),Object.defineProperty(e,"states",{value:new Je(this,Ae.key),configurable:!0,enumberable:!0}),Object.is(e.shadowRoot,null)&&!Object.is(this.shadowRoot,null)&&Object.defineProperty(e,"shadowRoot",{value:this.shadowRoot,configurable:!0,enumerable:!0}),e},writable:Ge,configurable:Ke,enumerable:Qe}),globalThis.CustomStateSet=Je,function(e){const t=Object.fromEntries(Object.keys(ge).map((e=>[e,{get:function(){return this[Ae.element][e]},set:function(t){this[Ae.element][e]=t},enumerable:!0,configurable:!0}])));Object.defineProperties(e,t)}(ElementInternals.prototype)}if(e(Response,"json",((e,{status:t=200,statusText:n="",headers:r=new Headers}={})=>r instanceof Headers?(r.set("Content-Type","application/json"),new Response(JSON.stringify(e),{status:t,statusText:n,headers:r})):Response.json(e,{status:t,statusText:n,headers:new Headers(r)}))),e(Response,"redirect",((e,t=302)=>new Response("",{status:t,headers:new Headers({Location:e})}))),!(globalThis.Record instanceof Function)){function Xe(e){const t=Object.create(Xe.prototype);return Object.defineProperties(t,Object.fromEntries(Object.entries(e).map((([e,t])=>[e,{enumerable:!0,configurable:!1,writable:!1,value:t}])))),Object.freeze(t),t}Xe.prototype={constructor:Xe},Xe.fromEntries=function(e){return new Xe(Object.fromEntries(e))},globalThis.Record=Xe}if(!(globalThis.Tuple instanceof Function)){function Ze(...e){const t=Array.apply(Object.create(Ze.prototype),e);return Object.setPrototypeOf(t,Ze.prototype),Object.freeze(t),t}Ze.prototype.forEach=function(){Array.prototype.forEach.apply(this,arguments)},Ze.prototype.join=function(){return Array.prototype.join.apply(this,arguments)},Ze.prototype.indexOf=function(){return Array.prototype.indexOf.apply(this,arguments)},Ze.prototype.lastIndexOf=function(){return Array.prototype.lastIndexOf.apply(this,arguments)},Ze.prototype.findIndex=function(){return Array.prototype.findIndex.apply(this,arguments)},Ze.prototype.find=function(){return Array.prototype.find.apply(this,arguments)},Ze.prototype.findLast=function(){return Array.prototype.findLast.apply(this,arguments)},Ze.prototype.findLastIndex=function(){return Array.prototype.findLastIndex.apply(this,arguments)},Ze.prototype.every=function(){return Array.prototype.every.apply(this,arguments)},Ze.prototype.some=function(){return Array.prototype.some.apply(this,arguments)},Ze.prototype.includes=function(){return Array.prototype.includes.apply(this,arguments)},Ze.prototype.map=function(){return Ze.from(Array.prototype.map.apply(this,arguments))},Ze.prototype.filter=function(){return Ze.from(Array.prototype.filter.apply(this,arguments))},Ze.prototype.flat=function(){return Ze.from(Array.prototype.flat.apply(this,arguments))},Ze.prototype.flatMap=function(){return Ze.from(Array.prototype.flatMap.apply(this,arguments))},Ze.prototype.at=function(){return Array.prototype.at.apply(this,arguments)},Ze.prototype.reduce=function(){return Ze.from(Array.prototype.reduce.apply(this,arguments))},Ze.prototype.reduceRight=function(){return Ze.from(Array.prototype.reduceRight.apply(this,arguments))},Ze.prototype.toSorted=function(){return Ze.from(Array.prototype.toSorted.apply(this,arguments))},Ze.prototype.toSpliced=function(){return Ze.from(Array.prototype.toSpliced.apply(this,arguments))},Ze.prototype.toReversed=function(){return Ze.from(Array.prototype.toReversed.apply(this,arguments))},Ze.prototype.toJSON=function(){return[...this]},Ze.prototype.keys=function(){return Array.prototype.keys.apply(this)},Ze.prototype.values=function(){return Array.prototype.values.apply(this)},Ze.prototype.entries=function(){return Array.prototype.entries.apply(this)},Ze.prototype[Symbol.iterator]=function(){return Array.prototype[Symbol.iterator].apply(this)},Ze.from=function(e){return Ze(...e)},Object.defineProperties(Ze.prototype,{length:{get:function(){return Object.getOwnPropertyDescriptor(Array.prototype,"length").get.apply(this)},enumerable:!0,configurable:!1},lastItem:{get:function(){return this[this.lastIndex]},enumerable:!0,configurable:!1},lastIndex:{get:function(){return Object.getOwnPropertyDescriptor(Array.prototype,"lastIndex").get.apply(this)},enumerable:!0,configurable:!1}}),globalThis.Tuple=Ze}if(!(JSON.parseImmutable instanceof Function)){function Ye(e){return"object"==typeof e?null===e?null:Array.isArray(e)?Tuple.from(e.map((e=>Ye(e)))):Record.fromEntries(Object.entries(e).map((([e,t])=>[e,Ye(t)]))):e}JSON.parseImmutable=function(e){return JSON.parse(e,((e,t)=>Ye(t)))}}}();
|
|
66
66
|
//# sourceMappingURL=all.min.js.map
|