@shgysk8zer0/polyfills 0.5.0 → 0.5.1
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 +5 -0
- package/all.min.js +6 -6
- package/all.min.js.map +1 -1
- package/assets/dedent.js +1 -1
- package/browser.min.js +6 -6
- package/browser.min.js.map +1 -1
- package/node.min.js.map +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
package/all.min.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
!function(){"use strict";function e(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}!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}))}();var t,r,n,o={exports:{}};function i(){return t||(t=1,o.exports=function(){const e=new WeakMap,t=/(\n|\r\n?|\u2028|\u2029)/g,r=/^\s*/,n=/\S/,o=Array.prototype.slice,i="0".charCodeAt(0),a="9".charCodeAt(0),s="a".charCodeAt(0),l="f".charCodeAt(0),c="A".charCodeAt(0),u="F".charCodeAt(0);function p(e){if("string"==typeof e)return d([e])[0];if("function"==typeof e)return function(){const t=o.call(arguments);return t[0]=f(t[0]),e.apply(this,t)};const t=f(e);let r=h(t,0);for(let e=1;e<t.length;e++)r+=arguments[e]+h(t,e);return r}function h(e,t){const r=e[t];if(void 0===r)throw new TypeError(`invalid cooked string at index ${t}`);return r}function f(t){const r=e.get(t);if(r)return r;const n=d(t.raw),o=n.map(g);return Object.defineProperty(o,"raw",{value:Object.freeze(n)}),Object.freeze(o),e.set(t,o),o}function d(e){const o=e.map(e=>e.split(t));let i;for(let e=0;e<o.length;e++){const t=o[e],a=0===e,s=e+1===o.length;if(a){if(1===t.length||t[0].length>0)throw new Error("invalid content on opening line");t[1]=""}if(s){if(1===t.length||n.test(t[t.length-1]))throw new Error("invalid content on closing line");t[t.length-2]="",t[t.length-1]=""}for(let e=2;e<t.length;e+=2){const n=t[e],o=e+1===t.length&&!s,a=r.exec(n)[0];o||a.length!==n.length?i=m(a,i):t[e]=""}}const a=i?i.length:0;return o.map(e=>{let t=e[0];for(let r=1;r<e.length;r+=2)t+=e[r]+e[r+1].slice(a);return t})}function m(e,t){if(void 0===t||e===t)return e;let r=0;for(const n=Math.min(e.length,t.length);r<n&&e[r]===t[r];r++);return e.slice(0,r)}function g(e){let t="",r=0,n=0;for(;(n=e.indexOf("\\",n))>-1;){if(t+=e.slice(r,n),++n===e.length)return;const o=e[n++];switch(o){case"b":t+="\b";break;case"t":t+="\t";break;case"n":t+="\n";break;case"v":t+="\v";break;case"f":t+="\f";break;case"r":t+="\r";break;case"\r":n<e.length&&"\n"===e[n]&&++n;case"\n":case"\u2028":case"\u2029":break;case"0":if(b(e,n))return;t+="\0";break;case"x":{const r=y(e,n,n+2);if(-1===r)return;n+=2,t+=String.fromCharCode(r);break}case"u":{let r;if(n<e.length&&"{"===e[n]){const t=e.indexOf("}",++n);if(-1===t)return;r=y(e,n,t),n=t+1}else r=y(e,n,n+4),n+=4;if(-1===r||r>1114111)return;t+=String.fromCodePoint(r);break}default:if(b(o,0))return;t+=o}r=n}return t+e.slice(r)}function b(e,t){const r=e.charCodeAt(t);return r>=i&&r<=a}function y(e,t,r){if(r>=e.length)return-1;let n=0;for(;t<r;t++){const r=w(e.charCodeAt(t));if(-1===r)return-1;n=16*n+r}return n}function w(e){return e>=i&&e<=a?e-i:e>=s&&e<=l?e-s+10:e>=c&&e<=u?e-c+10:-1}return p}()),o.exports}var a=e(n?r:(n=1,r=i()));String.dedent instanceof Function||(String.dedent=a),!("crypto"in window)&&"msCrypto"in window&&(globalThis.crypto=globalThis.msCrypto),"Notification"in window||(globalThis.Notification=globalThis.notifications||globalThis.webkitNotifications||globalThis.oNotifications||globalThis.msNotifications||!1),"doNotTrack"in navigator||(navigator.doNotTrack=globalThis.doNotTrack||navigator.msDoNotTrack||"unspecified"),"indexedDB"in window||(globalThis.indexedDB=globalThis.indexedDB||globalThis.mozIndexedDB||globalThis.webkitIndexedDB||globalThis.msIndexedDB||!1),"hidden"in document||(document.hidden=document.webkitHidden||document.msHidden||document.mozHidden||!1),"visibilityState"in document||(document.visibilityState=document.webkitVisibilityState||document.msVisibilityState||document.mozVisibilityState||"visible"),"fullscreenElement"in document||(document.fullscreenElement=document.mozFullScreenElement||document.webkitFullscreenElement||!1),"requestAnimationFrame"in window||(globalThis.requestAnimationFrame=globalThis.mozRequestAnimationFrame||globalThis.webkitRequestAnimationFrame||globalThis.msRequestAnimationFrame||!1),"exitFullscreen"in Document.prototype||(Document.prototype.exitFullscreen=document.mozCancelFullScreen||document.webkitCancelFullScreen||document.msCancelFullScreen||!1),"requestFullscreen"in HTMLElement.prototype||(HTMLElement.prototype.requestFullscreen=HTMLElement.prototype.requestFullScreen||HTMLElement.prototype.mozRequestFullScreen||HTMLElement.prototype.webkitRequestFullScreen||!1),"fullscreen"in Document.prototype||Object.defineProperty(Document.prototype,"fullscreen",{get:()=>document.fullscreenElement instanceof Element}),Object.groupBy instanceof Function||(Object.groupBy=function(e,t){return Array.from(e).reduce((e,r,n)=>{const o=t.call(e,r,n);return e.hasOwnProperty(o)?e[o].push(r):e[o]=[r],e},{})}),Map.prototype.getOrInsert instanceof Function||(Map.prototype.getOrInsert=function(e,t){return this.has(e)?this.get(e):(this.set(e,t),t)},Map.prototype.getOrInsertComputed=function(e,t){if(this.has(e))return this.get(e);{const r=t(e);return this.set(e,r),r}}),WeakMap.prototype.getOrInsert instanceof Function||(WeakMap.prototype.getOrInsert=function(e,t){return Map.prototype.getOrInsert.call(this,e,t)},WeakMap.prototype.getOrInsertComputed=function(e,t){return WeakMap.prototype.getOrInsertComputed.call(this,e,t)}),Map.groupBy instanceof Function||(Map.groupBy=function(e,t){return Array.from(e).reduce((e,r,n)=>(e.emplace(t.call(e,r,n),{insert:()=>[r],update:e=>(e.push(r),e)}),e),new Map)}),Map.prototype.emplace instanceof Function||(Map.prototype.emplace=function(e,{insert:t,update:r}={}){console.warn("`Map.prototype.emplace()` has been removed from the proposal and will be removed in the future.");const n=this.has(e);if(n&&r instanceof Function){const t=this.get(e),n=r.call(this,t,e,this);return n!==t&&this.set(e,n),n}if(n)return this.get(e);if(t instanceof Function){const r=t.call(this,e,this);return this.set(e,r),r}throw new Error("Key is not found and no `insert()` given")});const s=[Array,String,globalThis.Int8Array,globalThis.Uint8Array,globalThis.Uint8ClampedArray,globalThis.Int16Array,globalThis.Uint16Array,globalThis.Int32Array,globalThis.Uint32Array,globalThis.Float32Array,globalThis.Float64Array,globalThis.BigInt64Array,globalThis.BigUint64Array];if(Array.prototype.flat instanceof Function||(Array.prototype.flat=function(e=1){const t=[];e=Math.min(Number.MAX_SAFE_INTEGER,Math.max(0,e));const r=(e,n)=>{Array.isArray(e)&&n>=0?e.forEach(e=>r(e,n-1)):t.push(e)};return r(this,Number.isNaN(e)?0:e),t}),Array.prototype.flatMap instanceof Function||(Array.prototype.flatMap=function(e,t){return this.map(e,t).flat(1)}),Array.prototype.findLast instanceof Function||(Array.prototype.findLast=function(e,t){let r;return this.forEach((n,o,i)=>{e.call(t,n,o,i)&&(r=n)},t),r}),"lastIndex"in Array.prototype||Object.defineProperty(Array.prototype,"lastIndex",{enumerable:!1,configurable:!1,get:function(){return Math.max(0,this.length-1)}}),"lastItem"in Array.prototype||Object.defineProperty(Array.prototype,"lastItem",{enumerable:!1,configurable:!1,get:function(){return this[this.lastIndex]},set:function(e){this[this.lastIndex]=e}}),Array.prototype.findLastIndex instanceof Function||(Array.prototype.findLastIndex=function(e,t){let r=-1;return this.forEach((n,o,i)=>{e.call(t,n,o,i)&&(r=o)},t),r}),!(Array.prototype.at instanceof Function)){const Ze=function(e){if((e=Math.trunc(e)||0)<0&&(e+=this.length),!(e<0||e>=this.length))return this[e]};for(const et of s)void 0!==et&&Object.defineProperty(et.prototype,"at",{value:Ze,writable:!0,enumerable:!1,configurable:!0})}function l(e,t,r,{writable:n=!0,enumerable:o=!0,configurable:i=!0}={}){e[t]instanceof Function||Object.defineProperty(e,t,{value:r,writable:n,enumerable:o,configurable:i})}function c(e,t,{get:r,set:n,enumerable:o=!0,configurable:i=!0}={}){e.hasOwnProperty(t)||Object.defineProperty(e,t,{get:r,set:n,enumerable:o,configurable:i})}function u(e,t,r){const{value:n,enumerable:o,configurable:i,writable:a}=Object.getOwnPropertyDescriptor(e,t),s=r(n);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})}if(!(Array.prototype.group instanceof Function)&&Object.groupBy instanceof Function&&(Array.prototype.group=function(e){return console.warn("`Array.group()` is deprecated. Please use `Object.groupBy()` instead."),Object.groupBy(this,e)}),!(Array.prototype.groupBy instanceof Function)&&Object.groupBy instanceof Function&&(Array.prototype.groupBy=function(e){return console.warn("`Array.goupBy()` is deprecated. Please use `Object.groupBy()` instead."),Object.groupBy(this,e)}),!(Array.prototype.groupToMap instanceof Function)&&Map.groupBy instanceof Function&&(Array.prototype.groupToMap=function(e){return console.warn("`Array.groupToMap()` is deprecated. Please use `Map.groupBy()` instead."),Map.groupBy(this,e)}),Map.groupBy instanceof Function&&(Array.prototype.groupByToMap=function(e){return console.warn("`Array.groupByToMap()` is deprecated. Please use `Map.groupBy()` instead."),Map.groupBy(this,e)}),Array.fromAsync instanceof Function||(Array.fromAsync=async function(e,t,r=globalThis){let n=[];for await(const t of e)n.push(await t);return Array.from(n,t,r)}),Array.prototype.equals instanceof Function||(Array.prototype.equals=function(e){return this===e||!!Array.isArray(e)&&(this.length===e.length&&this.every((t,r)=>{const n=e[r];return Array.isArray(t)?Array.isArray(n)&&t.equals(n):Object.is(t,n)}))}),Array.prototype.uniqueBy instanceof Function||(Array.prototype.uniqueBy=function(e){switch(typeof e){case"undefined":return[...new Set(this)];case"string":case"number":case"symbol":return this.uniqueBy(t=>t[e]);case"function":{const t=new Set;return this.filter((...r)=>{const n=e.apply(this,r);return!t.has(n)&&(t.add(n),!0)})}default:throw new TypeError("Not a valid argument for uniqueBy")}}),Array.prototype.toReversed instanceof Function||(Array.prototype.toReversed=function(){return[...this].reverse()}),Array.prototype.toSorted instanceof Function||(Array.prototype.toSorted=function(e){return[...this].sort(e)}),Array.prototype.toSpliced instanceof Function||(Array.prototype.toSpliced=function(e,t,...r){const n=[...this];return n.splice(e,t,...r),n}),Array.prototype.with instanceof Function||(Array.prototype.with=function(e,t){const r=[...this];return r[e]=t,r}),Array.isTemplateObject instanceof Function||(Array.isTemplateObject=function(e){return!!(Array.isArray(e)&&Array.isArray(e.raw)&&Object.isFrozen(e)&&Object.isFrozen(e.raw))&&(0!==e.length&&e.length===e.raw.length)}),Uint8Array.prototype.toHex instanceof Function||(Uint8Array.prototype.toHex=function(){return Array.from(this,e=>e.toString(16).padStart(2,"0")).join("")}),Uint8Array.prototype.toBase64 instanceof Function||(Uint8Array.prototype.toBase64=function({alphabet:e="base64"}={}){if("base64"===e){const e=32768;let t="";for(let r=0;r<this.length;r+=e){const n=this.subarray(r,r+e);t+=String.fromCharCode.apply(null,n)}return btoa(t)}if("base64url"===e)return this.toBase64({alphabet:"base64"}).replaceAll("+","-").replaceAll("/","_");throw new TypeError('expected alphabet to be either "base64" or "base64url')}),Uint8Array.fromHex instanceof Function||(Uint8Array.fromHex=function(e){if("string"!=typeof e)throw new TypeError("expected input to be a string");if(0===!(1&e.length))throw new SyntaxError("string should be an even number of characters");return Uint8Array.from(globalThis.Iterator.range(0,e.length,{step:2}),t=>parseInt(e.substring(t,t+2),16))}),Uint8Array.fromBase64 instanceof Function||(Uint8Array.fromBase64=function(e,{alphabet:t="base64",lastChunkHandling:r="loose"}={}){if("string"!=typeof e)throw new TypeError("expected input to be a string");if(!["base64","base64url"].includes(t))throw new TypeError('expected alphabet to be either "base64" or "base64url');if(!["loose","strict","stop-before-partial"].includes(r))throw new TypeError(`Invalid \`lastChunkHandling\`: "${r}".`);if("base64"!==t)return Uint8Array.fromBase64(e.replaceAll("-","+").replaceAll("_","/"),{alphabet:"base64"});{const t=e.length%4;if(1===t)throw new TypeError("Invalid string length.");if(0===t)return Uint8Array.from(atob(e),e=>e.charCodeAt(0));switch(r){case"strict":throw new SyntaxError("Missing padding.");case"loose":return Uint8Array.fromBase64(e.padEnd(e.length+(4-t),"="),{alphabet:"base64",lastChunkHandling:"strict"});case"stop-before-partial":return Uint8Array.fromBase64(e.slice(0,e.length-t),{alphabet:"base64",lastChunkHandling:"strict"})}}}),"Symbol"in globalThis){const tt=new Set(Reflect.ownKeys(Symbol).filter(e=>"symbol"==typeof Symbol[e]).map(e=>Symbol[e]));void 0===Symbol.toStringTag&&(Symbol.toStringTag=Symbol("Symbol.toStringTag")),void 0===Symbol.iterator&&(Symbol.iterator=Symbol("Symbol.iterator")),l(Symbol,"isRegistered",function(e){return"symbol"==typeof e&&"string"==typeof Symbol.keyFor(e)}),l(Symbol,"isWellKnown",function(e){return tt.has(e)})}function p(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var h,f,d,m,g,b;function y(){if(f)return h;f=1;var e,t=Object.defineProperty,r=Object.getOwnPropertyDescriptor,n=Object.getOwnPropertyNames,o=Object.prototype.hasOwnProperty,i=(e,r)=>t(e,"name",{value:r,configurable:!0}),a={};((e,r)=>{for(var n in r)t(e,n,{get:r[n],enumerable:!0})})(a,{URLPattern:()=>oe}),e=a,h=((e,i,a,s)=>{if(i&&"object"==typeof i||"function"==typeof i)for(let l of n(i))!o.call(e,l)&&l!==a&&t(e,l,{get:()=>i[l],enumerable:!(s=r(i,l))||s.enumerable});return e})(t({},"__esModule",{value:!0}),e);var s=class{type=3;name="";prefix="";value="";suffix="";modifier=3;constructor(e,t,r,n,o,i){this.type=e,this.name=t,this.prefix=r,this.value=n,this.suffix=o,this.modifier=i}hasCustomName(){return""!==this.name&&"number"!=typeof this.name}};i(s,"Part");var l=/[$_\p{ID_Start}]/u,c=/[$_\u200C\u200D\p{ID_Continue}]/u,u=".*";function p(e,t){return(t?/^[\x00-\xFF]*$/:/^[\x00-\x7F]*$/).test(e)}function d(e,t=!1){let r=[],n=0;for(;n<e.length;){let o=e[n],a=i(function(o){if(!t)throw new TypeError(o);r.push({type:"INVALID_CHAR",index:n,value:e[n++]})},"ErrorOrInvalid");if("*"!==o)if("+"!==o&&"?"!==o)if("\\"!==o)if("{"!==o)if("}"!==o){if(":"===o){let t="",o=n+1;for(;o<e.length;){let r=e.substr(o,1);if(!(o===n+1&&l.test(r)||o!==n+1&&c.test(r)))break;t+=e[o++]}if(!t){a(`Missing parameter name at ${n}`);continue}r.push({type:"NAME",index:n,value:t}),n=o;continue}if("("===o){let t=1,o="",i=n+1,s=!1;if("?"===e[i]){a(`Pattern cannot start with "?" at ${i}`);continue}for(;i<e.length;){if(!p(e[i],!1)){a(`Invalid character '${e[i]}' at ${i}.`),s=!0;break}if("\\"!==e[i]){if(")"===e[i]){if(t--,0===t){i++;break}}else if("("===e[i]&&(t++,"?"!==e[i+1])){a(`Capturing groups are not allowed at ${i}`),s=!0;break}o+=e[i++]}else o+=e[i++]+e[i++]}if(s)continue;if(t){a(`Unbalanced pattern at ${n}`);continue}if(!o){a(`Missing pattern at ${n}`);continue}r.push({type:"REGEX",index:n,value:o}),n=i;continue}r.push({type:"CHAR",index:n,value:e[n++]})}else r.push({type:"CLOSE",index:n,value:e[n++]});else r.push({type:"OPEN",index:n,value:e[n++]});else r.push({type:"ESCAPED_CHAR",index:n++,value:e[n++]});else r.push({type:"OTHER_MODIFIER",index:n,value:e[n++]});else r.push({type:"ASTERISK",index:n,value:e[n++]})}return r.push({type:"END",index:n,value:""}),r}function m(e,t={}){let r=d(e);t.delimiter??="/#?",t.prefixes??="./";let n=`[^${g(t.delimiter)}]+?`,o=[],a=0,l=0,c=new Set,p=i(e=>{if(l<r.length&&r[l].type===e)return r[l++].value},"tryConsume"),h=i(()=>p("OTHER_MODIFIER")??p("ASTERISK"),"tryConsumeModifier"),f=i(e=>{let t=p(e);if(void 0!==t)return t;let{type:n,index:o}=r[l];throw new TypeError(`Unexpected ${n} at ${o}, expected ${e}`)},"mustConsume"),m=i(()=>{let e,t="";for(;e=p("CHAR")??p("ESCAPED_CHAR");)t+=e;return t},"consumeText"),b=i(e=>e,"DefaultEncodePart"),y=t.encodePart||b,w="",v=i(e=>{w+=e},"appendToPendingFixedValue"),T=i(()=>{w.length&&(o.push(new s(3,"","",y(w),"",3)),w="")},"maybeAddPartFromPendingFixedValue"),E=i((e,t,r,i,l)=>{let p,h=3;switch(l){case"?":h=1;break;case"*":h=0;break;case"+":h=2}if(!t&&!r&&3===h)return void v(e);if(T(),!t&&!r){if(!e)return;return void o.push(new s(3,"","",y(e),"",h))}p=r?"*"===r?u:r:n;let f,d=2;if(p===n?(d=1,p=""):p===u&&(d=0,p=""),t?f=t:r&&(f=a++),c.has(f))throw new TypeError(`Duplicate name '${f}'.`);c.add(f),o.push(new s(d,f,y(e),p,y(i),h))},"addPart");for(;l<r.length;){let e=p("CHAR"),r=p("NAME"),n=p("REGEX");if(!r&&!n&&(n=p("ASTERISK")),r||n){let o=e??"";-1===t.prefixes.indexOf(o)&&(v(o),o=""),T(),E(o,r,n,"",h());continue}let o=e??p("ESCAPED_CHAR");if(o)v(o);else{if(p("OPEN")){let e=m(),t=p("NAME"),r=p("REGEX");!t&&!r&&(r=p("ASTERISK"));let n=m();f("CLOSE"),E(e,t,r,n,h());continue}T(),f("END")}}return o}function g(e){return e.replace(/([.+*?^${}()[\]|/\\])/g,"\\$1")}function b(e){return e&&e.ignoreCase?"ui":"u"}function y(e,t,r){return v(m(e,r),t,r)}function w(e){switch(e){case 0:return"*";case 1:return"?";case 2:return"+";case 3:return""}}function v(e,t,r={}){r.delimiter??="/#?",r.prefixes??="./",r.sensitive??=!1,r.strict??=!1,r.end??=!0,r.start??=!0,r.endsWith="";let n=r.start?"^":"";for(let o of e){if(3===o.type){3===o.modifier?n+=g(o.value):n+=`(?:${g(o.value)})${w(o.modifier)}`;continue}t&&t.push(o.name);let e=`[^${g(r.delimiter)}]+?`,i=o.value;(1===o.type?i=e:0===o.type&&(i=u),o.prefix.length||o.suffix.length)?3!==o.modifier&&1!==o.modifier?(n+=`(?:${g(o.prefix)}`,n+=`((?:${i})(?:`,n+=g(o.suffix),n+=g(o.prefix),n+=`(?:${i}))*)${g(o.suffix)})`,0===o.modifier&&(n+="?")):(n+=`(?:${g(o.prefix)}(${i})${g(o.suffix)})`,n+=w(o.modifier)):3===o.modifier||1===o.modifier?n+=`(${i})${w(o.modifier)}`:n+=`((?:${i})${w(o.modifier)})`}let o=`[${g(r.endsWith)}]|$`,i=`[${g(r.delimiter)}]`;if(r.end)return r.strict||(n+=`${i}?`),r.endsWith.length?n+=`(?=${o})`:n+="$",new RegExp(n,b(r));r.strict||(n+=`(?:${i}(?=${o}))?`);let a=!1;if(e.length){let t=e[e.length-1];3===t.type&&3===t.modifier&&(a=r.delimiter.indexOf(t)>-1)}return a||(n+=`(?=${i}|${o})`),new RegExp(n,b(r))}i(p,"isASCII"),i(d,"lexer"),i(m,"parse"),i(g,"escapeString"),i(b,"flags"),i(y,"stringToRegexp"),i(w,"modifierToString"),i(v,"partsToRegexp");var T={delimiter:"",prefixes:"",sensitive:!0,strict:!0},E={delimiter:".",prefixes:"",sensitive:!0,strict:!0},S={delimiter:"/",prefixes:"/",sensitive:!0,strict:!0};function A(e,t){return!!e.length&&("/"===e[0]||!(!t||e.length<2)&&(("\\"==e[0]||"{"==e[0])&&"/"==e[1]))}function x(e,t){return e.startsWith(t)?e.substring(t.length,e.length):e}function M(e,t){return e.endsWith(t)?e.substr(0,e.length-t.length):e}function L(e){return!(!e||e.length<2)&&("["===e[0]||("\\"===e[0]||"{"===e[0])&&"["===e[1])}i(A,"isAbsolutePathname"),i(x,"maybeStripPrefix"),i(M,"maybeStripSuffix"),i(L,"treatAsIPv6Hostname");var k=["ftp","file","http","https","ws","wss"];function O(e){if(!e)return!0;for(let t of k)if(e.test(t))return!0;return!1}function P(e,t){if(e=x(e,"#"),t||""===e)return e;let r=new URL("https://example.com");return r.hash=e,r.hash?r.hash.substring(1,r.hash.length):""}function R(e,t){if(e=x(e,"?"),t||""===e)return e;let r=new URL("https://example.com");return r.search=e,r.search?r.search.substring(1,r.search.length):""}function F(e,t){return t||""===e?e:L(e)?B(e):q(e)}function C(e,t){if(t||""===e)return e;let r=new URL("https://example.com");return r.password=e,r.password}function j(e,t){if(t||""===e)return e;let r=new URL("https://example.com");return r.username=e,r.username}function I(e,t,r){if(r||""===e)return e;if(t&&!k.includes(t))return new URL(`${t}:${e}`).pathname;let n="/"==e[0];return e=new URL(n?e:"/-"+e,"https://example.com").pathname,n||(e=e.substring(2,e.length)),e}function N(e,t,r){return U(t)===e&&(e=""),r||""===e?e:_(e)}function H(e,t){return e=M(e,":"),t||""===e?e:D(e)}function U(e){switch(e){case"ws":case"http":return"80";case"wws":case"https":return"443";case"ftp":return"21";default:return""}}function D(e){if(""===e)return e;if(/^[-+.A-Za-z0-9]*$/.test(e))return e.toLowerCase();throw new TypeError(`Invalid protocol '${e}'.`)}function z(e){if(""===e)return e;let t=new URL("https://example.com");return t.username=e,t.username}function $(e){if(""===e)return e;let t=new URL("https://example.com");return t.password=e,t.password}function q(e){if(""===e)return e;if(/[\t\n\r #%/:<>?@[\]^\\|]/g.test(e))throw new TypeError(`Invalid hostname '${e}'`);let t=new URL("https://example.com");return t.hostname=e,t.hostname}function B(e){if(""===e)return e;if(/[^0-9a-fA-F[\]:]/g.test(e))throw new TypeError(`Invalid IPv6 hostname '${e}'`);return e.toLowerCase()}function _(e){if(""===e||/^[0-9]*$/.test(e)&&parseInt(e)<=65535)return e;throw new TypeError(`Invalid port '${e}'.`)}function V(e){if(""===e)return e;let t=new URL("https://example.com");return t.pathname="/"!==e[0]?"/-"+e:e,"/"!==e[0]?t.pathname.substring(2,t.pathname.length):t.pathname}function W(e){return""===e?e:new URL(`data:${e}`).pathname}function G(e){if(""===e)return e;let t=new URL("https://example.com");return t.search=e,t.search.substring(1,t.search.length)}function X(e){if(""===e)return e;let t=new URL("https://example.com");return t.hash=e,t.hash.substring(1,t.hash.length)}i(O,"isSpecialScheme"),i(P,"canonicalizeHash"),i(R,"canonicalizeSearch"),i(F,"canonicalizeHostname"),i(C,"canonicalizePassword"),i(j,"canonicalizeUsername"),i(I,"canonicalizePathname"),i(N,"canonicalizePort"),i(H,"canonicalizeProtocol"),i(U,"defaultPortForProtocol"),i(D,"protocolEncodeCallback"),i(z,"usernameEncodeCallback"),i($,"passwordEncodeCallback"),i(q,"hostnameEncodeCallback"),i(B,"ipv6HostnameEncodeCallback"),i(_,"portEncodeCallback"),i(V,"standardURLPathnameEncodeCallback"),i(W,"pathURLPathnameEncodeCallback"),i(G,"searchEncodeCallback"),i(X,"hashEncodeCallback");var K=class{#e;#t=[];#r={};#n=0;#o=1;#i=0;#a=0;#s=0;#l=0;#c=!1;constructor(e){this.#e=e}get result(){return this.#r}parse(){for(this.#t=d(this.#e,!0);this.#n<this.#t.length;this.#n+=this.#o){if(this.#o=1,"END"===this.#t[this.#n].type){if(0===this.#a){this.#u(),this.#p()?this.#h(9,1):this.#f()?this.#h(8,1):this.#h(7,0);continue}if(2===this.#a){this.#d(5);continue}this.#h(10,0);break}if(this.#s>0){if(!this.#m())continue;this.#s-=1}if(this.#g())this.#s+=1;else switch(this.#a){case 0:this.#b()&&this.#d(1);break;case 1:if(this.#b()){this.#y();let e=7,t=1;this.#w()?(e=2,t=3):this.#c&&(e=2),this.#h(e,t)}break;case 2:this.#v()?this.#d(3):(this.#T()||this.#f()||this.#p())&&this.#d(5);break;case 3:this.#E()?this.#h(4,1):this.#v()&&this.#h(5,1);break;case 4:this.#v()&&this.#h(5,1);break;case 5:this.#S()?this.#l+=1:this.#A()&&(this.#l-=1),this.#x()&&!this.#l?this.#h(6,1):this.#T()?this.#h(7,0):this.#f()?this.#h(8,1):this.#p()&&this.#h(9,1);break;case 6:this.#T()?this.#h(7,0):this.#f()?this.#h(8,1):this.#p()&&this.#h(9,1);break;case 7:this.#f()?this.#h(8,1):this.#p()&&this.#h(9,1);break;case 8:this.#p()&&this.#h(9,1)}}void 0!==this.#r.hostname&&void 0===this.#r.port&&(this.#r.port="")}#h(e,t){switch(this.#a){case 0:case 2:break;case 1:this.#r.protocol=this.#M();break;case 3:this.#r.username=this.#M();break;case 4:this.#r.password=this.#M();break;case 5:this.#r.hostname=this.#M();break;case 6:this.#r.port=this.#M();break;case 7:this.#r.pathname=this.#M();break;case 8:this.#r.search=this.#M();break;case 9:this.#r.hash=this.#M()}0!==this.#a&&10!==e&&([1,2,3,4].includes(this.#a)&&[6,7,8,9].includes(e)&&(this.#r.hostname??=""),[1,2,3,4,5,6].includes(this.#a)&&[8,9].includes(e)&&(this.#r.pathname??=this.#c?"/":""),[1,2,3,4,5,6,7].includes(this.#a)&&9===e&&(this.#r.search??="")),this.#L(e,t)}#L(e,t){this.#a=e,this.#i=this.#n+t,this.#n+=t,this.#o=0}#u(){this.#n=this.#i,this.#o=0}#d(e){this.#u(),this.#a=e}#k(e){return e<0&&(e=this.#t.length-e),e<this.#t.length?this.#t[e]:this.#t[this.#t.length-1]}#O(e,t){let r=this.#k(e);return r.value===t&&("CHAR"===r.type||"ESCAPED_CHAR"===r.type||"INVALID_CHAR"===r.type)}#b(){return this.#O(this.#n,":")}#w(){return this.#O(this.#n+1,"/")&&this.#O(this.#n+2,"/")}#v(){return this.#O(this.#n,"@")}#E(){return this.#O(this.#n,":")}#x(){return this.#O(this.#n,":")}#T(){return this.#O(this.#n,"/")}#f(){if(this.#O(this.#n,"?"))return!0;if("?"!==this.#t[this.#n].value)return!1;let e=this.#k(this.#n-1);return"NAME"!==e.type&&"REGEX"!==e.type&&"CLOSE"!==e.type&&"ASTERISK"!==e.type}#p(){return this.#O(this.#n,"#")}#g(){return"OPEN"==this.#t[this.#n].type}#m(){return"CLOSE"==this.#t[this.#n].type}#S(){return this.#O(this.#n,"[")}#A(){return this.#O(this.#n,"]")}#M(){let e=this.#t[this.#n],t=this.#k(this.#i).index;return this.#e.substring(t,e.index)}#y(){let e={};Object.assign(e,T),e.encodePart=D;let t=y(this.#M(),void 0,e);this.#c=O(t)}};i(K,"Parser");var Q=["protocol","username","password","hostname","port","pathname","search","hash"],J="*";function Y(e,t){if("string"!=typeof e)throw new TypeError("parameter 1 is not of type 'string'.");let r=new URL(e,t);return{protocol:r.protocol.substring(0,r.protocol.length-1),username:r.username,password:r.password,hostname:r.hostname,port:r.port,pathname:r.pathname,search:""!==r.search?r.search.substring(1,r.search.length):void 0,hash:""!==r.hash?r.hash.substring(1,r.hash.length):void 0}}function Z(e,t){return t?te(e):e}function ee(e,t,r){let n;if("string"==typeof t.baseURL)try{n=new URL(t.baseURL),void 0===t.protocol&&(e.protocol=Z(n.protocol.substring(0,n.protocol.length-1),r)),!r&&void 0===t.protocol&&void 0===t.hostname&&void 0===t.port&&void 0===t.username&&(e.username=Z(n.username,r)),!r&&void 0===t.protocol&&void 0===t.hostname&&void 0===t.port&&void 0===t.username&&void 0===t.password&&(e.password=Z(n.password,r)),void 0===t.protocol&&void 0===t.hostname&&(e.hostname=Z(n.hostname,r)),void 0===t.protocol&&void 0===t.hostname&&void 0===t.port&&(e.port=Z(n.port,r)),void 0===t.protocol&&void 0===t.hostname&&void 0===t.port&&void 0===t.pathname&&(e.pathname=Z(n.pathname,r)),void 0===t.protocol&&void 0===t.hostname&&void 0===t.port&&void 0===t.pathname&&void 0===t.search&&(e.search=Z(n.search.substring(1,n.search.length),r)),void 0===t.protocol&&void 0===t.hostname&&void 0===t.port&&void 0===t.pathname&&void 0===t.search&&void 0===t.hash&&(e.hash=Z(n.hash.substring(1,n.hash.length),r))}catch{throw new TypeError(`invalid baseURL '${t.baseURL}'.`)}if("string"==typeof t.protocol&&(e.protocol=H(t.protocol,r)),"string"==typeof t.username&&(e.username=j(t.username,r)),"string"==typeof t.password&&(e.password=C(t.password,r)),"string"==typeof t.hostname&&(e.hostname=F(t.hostname,r)),"string"==typeof t.port&&(e.port=N(t.port,e.protocol,r)),"string"==typeof t.pathname){if(e.pathname=t.pathname,n&&!A(e.pathname,r)){let t=n.pathname.lastIndexOf("/");t>=0&&(e.pathname=Z(n.pathname.substring(0,t+1),r)+e.pathname)}e.pathname=I(e.pathname,e.protocol,r)}return"string"==typeof t.search&&(e.search=R(t.search,r)),"string"==typeof t.hash&&(e.hash=P(t.hash,r)),e}function te(e){return e.replace(/([+*?:{}()\\])/g,"\\$1")}function re(e){return e.replace(/([.+*?^${}()[\]|/\\])/g,"\\$1")}function ne(e,t){t.delimiter??="/#?",t.prefixes??="./",t.sensitive??=!1,t.strict??=!1,t.end??=!0,t.start??=!0,t.endsWith="";let r=`[^${re(t.delimiter)}]+?`,n=/[$_\u200C\u200D\p{ID_Continue}]/u,o="";for(let i=0;i<e.length;++i){let a=e[i];if(3===a.type){if(3===a.modifier){o+=te(a.value);continue}o+=`{${te(a.value)}}${w(a.modifier)}`;continue}let s=a.hasCustomName(),l=!!a.suffix.length||!!a.prefix.length&&(1!==a.prefix.length||!t.prefixes.includes(a.prefix)),c=i>0?e[i-1]:null,u=i<e.length-1?e[i+1]:null;if(!l&&s&&1===a.type&&3===a.modifier&&u&&!u.prefix.length&&!u.suffix.length)if(3===u.type){let e=u.value.length>0?u.value[0]:"";l=n.test(e)}else l=!u.hasCustomName();if(!l&&!a.prefix.length&&c&&3===c.type){let e=c.value[c.value.length-1];l=t.prefixes.includes(e)}l&&(o+="{"),o+=te(a.prefix),s&&(o+=`:${a.name}`),2===a.type?o+=`(${a.value})`:1===a.type?s||(o+=`(${r})`):0===a.type&&(s||c&&3!==c.type&&3===c.modifier&&!l&&""===a.prefix?o+="(.*)":o+="*"),1===a.type&&s&&a.suffix.length&&n.test(a.suffix[0])&&(o+="\\"),o+=te(a.suffix),l&&(o+="}"),3!==a.modifier&&(o+=w(a.modifier))}return o}i(Y,"extractValues"),i(Z,"processBaseURLString"),i(ee,"applyInit"),i(te,"escapePatternString"),i(re,"escapeRegexpString"),i(ne,"partsToPattern");var oe=class{#e;#t={};#r={};#n={};#o={};#i=!1;constructor(e={},t,r){try{let n;if("string"==typeof t?n=t:r=t,"string"==typeof e){let t=new K(e);if(t.parse(),e=t.result,void 0===n&&"string"!=typeof e.protocol)throw new TypeError("A base URL must be provided for a relative constructor string.");e.baseURL=n}else{if(!e||"object"!=typeof e)throw new TypeError("parameter 1 is not of type 'string' and cannot convert to dictionary.");if(n)throw new TypeError("parameter 1 is not of type 'string'.")}typeof r>"u"&&(r={ignoreCase:!1});let o,i={ignoreCase:!0===r.ignoreCase},a={pathname:J,protocol:J,username:J,password:J,hostname:J,port:J,search:J,hash:J};for(o of(this.#e=ee(a,e,!0),U(this.#e.protocol)===this.#e.port&&(this.#e.port=""),Q)){if(!(o in this.#e))continue;let e={},t=this.#e[o];switch(this.#r[o]=[],o){case"protocol":Object.assign(e,T),e.encodePart=D;break;case"username":Object.assign(e,T),e.encodePart=z;break;case"password":Object.assign(e,T),e.encodePart=$;break;case"hostname":Object.assign(e,E),L(t)?e.encodePart=B:e.encodePart=q;break;case"port":Object.assign(e,T),e.encodePart=_;break;case"pathname":O(this.#t.protocol)?(Object.assign(e,S,i),e.encodePart=V):(Object.assign(e,T,i),e.encodePart=W);break;case"search":Object.assign(e,T,i),e.encodePart=G;break;case"hash":Object.assign(e,T,i),e.encodePart=X}try{this.#o[o]=m(t,e),this.#t[o]=v(this.#o[o],this.#r[o],e),this.#n[o]=ne(this.#o[o],e),this.#i=this.#i||this.#o[o].some(e=>2===e.type)}catch{throw new TypeError(`invalid ${o} pattern '${this.#e[o]}'.`)}}}catch(e){throw new TypeError(`Failed to construct 'URLPattern': ${e.message}`)}}get[Symbol.toStringTag](){return"URLPattern"}test(e={},t){let r,n={pathname:"",protocol:"",username:"",password:"",hostname:"",port:"",search:"",hash:""};if("string"!=typeof e&&t)throw new TypeError("parameter 1 is not of type 'string'.");if(typeof e>"u")return!1;try{n=ee(n,"object"==typeof e?e:Y(e,t),!1)}catch{return!1}for(r of Q)if(!this.#t[r].exec(n[r]))return!1;return!0}exec(e={},t){let r={pathname:"",protocol:"",username:"",password:"",hostname:"",port:"",search:"",hash:""};if("string"!=typeof e&&t)throw new TypeError("parameter 1 is not of type 'string'.");if(typeof e>"u")return;try{r=ee(r,"object"==typeof e?e:Y(e,t),!1)}catch{return null}let n,o={};for(n of(o.inputs=t?[e,t]:[e],Q)){let e=this.#t[n].exec(r[n]);if(!e)return null;let t={};for(let[r,o]of this.#r[n].entries())if("string"==typeof o||"number"==typeof o){let n=e[r+1];t[o]=n}o[n]={input:r[n]??"",groups:t}}return o}static compareComponent(e,t,r){let n=i((e,t)=>{for(let r of["type","modifier","prefix","value","suffix"]){if(e[r]<t[r])return-1;if(e[r]!==t[r])return 1}return 0},"comparePart"),o=new s(3,"","","","",3),a=new s(0,"","","","",3),l=i((e,t)=>{let r=0;for(;r<Math.min(e.length,t.length);++r){let o=n(e[r],t[r]);if(o)return o}return e.length===t.length?0:n(e[r]??o,t[r]??o)},"comparePartList");return t.#n[e]||r.#n[e]?t.#n[e]&&!r.#n[e]?l(t.#o[e],[a]):!t.#n[e]&&r.#n[e]?l([a],r.#o[e]):l(t.#o[e],r.#o[e]):0}get protocol(){return this.#n.protocol}get username(){return this.#n.username}get password(){return this.#n.password}get hostname(){return this.#n.hostname}get port(){return this.#n.port}get pathname(){return this.#n.pathname}get search(){return this.#n.search}get hash(){return this.#n.hash}get hasRegExpGroups(){return this.#i}};return i(oe,"URLPattern"),h}!function(){if(!(Function.prototype.once instanceof Function)){const e=new WeakMap;Function.prototype.once=function(t){const r=this;return function(...n){if(e.has(r))return e.get(r);if("AsyncFunction"===r.constructor.name){const o=r.apply(t||r,n).catch(t=>{throw e.delete(r),t});return e.set(r,o),o}if(r instanceof Function){const o=r.apply(t||r,n);return e.set(r,o),o}}}}}();var w=p(b?g:(b=1,g=function(){if(m)return d;m=1;const{URLPattern:e}=y();return d={URLPattern:e},globalThis.URLPattern||(globalThis.URLPattern=e),d}()));"URLPattern"in globalThis||(globalThis.URLPattern=w),l(URL,"parse",(e,t)=>{try{return new URL(e,t)}catch{return null}}),l(URL,"canParse",(e,t)=>{try{return new URL(e,t)instanceof URL}catch{return!1}}),Number.range instanceof Function||(Number.range=function(e,t,r=1){return console.warn("`Number.range()` is deprecated. Use `Iterator.range()` instead."),globalThis.Iterator.range(e,t,{step:r})});const v="Iterator"in globalThis,T=v?Object.getPrototypeOf(globalThis.Iterator):Object.getPrototypeOf(Object.getPrototypeOf([][Symbol.iterator]())),E=v?globalThis.Iterator:(e=>{class t{[Symbol.iterator](){return this}}return Object.setPrototypeOf(t,e),t})(T);var S;E.range instanceof Function||(E.range=function(e,t,r){if("number"==typeof r||"bigint"==typeof r)return E.range(e,t,{step:r});if("object"!=typeof r||Object.is(r,null))return E.range(e,t,{});{const{step:n=("number"==typeof e?e<t?1:-1:e<t?1n:-1n),inclusive:o=!1}=r;if("number"!=typeof e&&"bigint"!=typeof e)throw new TypeError("Start must be a number");if(Number.isNaN(e))throw new RangeError("Invalid start");if("number"!=typeof t&&"bigint"!=typeof t)throw new TypeError("End must be a number");if(Number.isNaN(t))throw new RangeError("Invalid end");if("number"!=typeof n&&"bigint"!=typeof n)throw new TypeError("Step must be a number");if(Number.isNaN(n))throw new RangeError("Invalid step");if(0===n)throw new RangeError("Step must not be 0");if(n<0&&e<t||n>0&&e>t)return;if(o){let r=e;return n>0?E.from({next(){const e=r<=t?{value:r,done:!1}:{done:!0};return r+=n,e}}):E.from({next(){const e=r>=t?{value:r,done:!1}:{done:!0};return r+=n,e}})}{let r=e;if(n>0)return E.from({next(){const e=r<t?{value:r,done:!1}:{done:!0};return r+=n,e}});{let r=e;return E.from({next(){const e=r>t?{value:r,done:!1}:{done:!0};return r+=n,e}})}}}}),T[Symbol.toStringTag]||(T[Symbol.toStringTag]="Iterator"),T.take instanceof Function||(T.take=function(e){let t=0;const r=this;return E.from({next:()=>t++>=e?{done:!0}:r.next()})}),T.drop instanceof Function||(T.drop=function(e){for(let t=0;t<e;t++){const{done:e}=this.next();if(e)break}return this}),T.toArray instanceof Function||(T.toArray=function(){return Array.from(this)}),T.forEach instanceof Function||(T.forEach=function(e){for(const t of this)e.call(this,t)}),T.flatMap instanceof Function||(T.flatMap=function(e){const t=this;let r=this.next();const n=({value:r,done:n=!0}={})=>n?E.from({next:()=>({done:!0})}):E.from(e.call(t,r));let o=n(r);return E.from({next(){const{value:e,done:i=!0}=o.next();return r.done&&i?{done:!0}:i?r.done?{done:!0}:(r=t.next(),o=n(r),o.next()):{value:e,done:i}}})}),T.map instanceof Function||(T.map=function(e){const t=this;return E.from({next(){const{done:r,value:n}=t.next();return r?{done:r}:{value:e.call(t,n),done:!1}}})}),T.reduce instanceof Function||(T.reduce=function(e,t){let r=void 0===t?this.next().value:t;for(const t of this)r=e.call(this,r,t);return r}),T.filter instanceof Function||(T.filter=function(e){const t=this;let r,n=!1;return E.from({next(){for(;!n;){const o=t.next();if(n=o.done,n)break;if(e.call(t,o.value)){r=o.value;break}}return{done:n,value:r}}})}),T.some instanceof Function||(T.some=function(e){let t=!1;for(const r of this)if(e.call(this,r)){t=!0;break}return t}),T.every instanceof Function||(T.every=function(e){let t=!0;for(const r of this)if(!e.call(this,r)){t=!1;break}return t}),T.find instanceof Function||(T.find=function(e){for(const t of this)if(e.call(this,t))return t}),T.indexed instanceof Function||(T.indexed=function(){let e=0;return this.map(t=>[e++,t])}),T.chunks instanceof Function||(T.chunks=function(e){if(!Number.isSafeInteger(e)||e<1)throw new TypeError("Size must be a positive integer.");{const t=this;let r=!1;return E.from({next(){if(r)return{done:r};{const n=[];let o=0;for(;o++<e&&!r;){const e=t.next();if(e.done){r=!0,void 0!==e.value&&n.push(e.value);break}n.push(e.value)}return{value:n,done:!1}}}})}}),E.from instanceof Function||(E.from=function(e){if("object"!=typeof e||null===e)throw new TypeError("Not an object.");if(e.next instanceof Function){return Object.create(T,{next:{enumerable:!0,configurable:!1,writable:!1,value:(...t)=>e.next(...t)}})}if(e[Symbol.iterator]instanceof Function)return E.from(e[Symbol.iterator]())}),v||(globalThis.Iterator=E),l(ReadableStream,"from",function(e){if(e[Symbol.iterator]instanceof Function)return new ReadableStream({start(t){try{for(const r of e)t.enqueue(r)}catch(e){t.error(e)}finally{t.close()}}});if(e[Symbol.asyncIterator]instanceof Function)return new ReadableStream({async start(t){try{for await(const r of e)t.enqueue(r)}catch(e){t.error(e)}finally{t.close()}}});throw new TypeError("`ReadableStream.from()` requires an iterable source.")}),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=(S=new Float32Array(1),function(e){return S[0]=e,S[0]})),Math.clamp instanceof Function||(Math.clamp=function(e,t,r){return Math.min(Math.max(e,t),r)}),Math.constrain instanceof Function||(Math.constrain=Math.clamp),Math.sumPrecise instanceof Function||(Math.sumPrecise=function(e){let t=-0;for(const r of e){if(!Number.isFinite(r)){t=-0;break}t+=r}return t}),Math.sum instanceof Function||(Math.sum=function(...e){return console.warn("Math.sum is deprecated. Please use Math.sumPrecise instead."),Math.sumPrecise(e)}),function(){if(!("isSecureContext"in globalThis)){const e=["localhost","127.0.0.1"],t="https:",r=[t,"file:","wss:"],n=(e=globalThis.document)=>[...e.scripts].every(({src:r})=>{if(0===r.length)return!0;{const{protocol:n,hostname:o}=new URL(r,e.baseURI);return n===t||o===location.hostname}});Object.defineProperty(globalThis,"isSecureContext",{enumerable:!0,configurable:!0,get:function(){return window.parent===window&&(!(!r.includes(location.protocol)&&!e.includes(location.hostname))&&n())}})}}();function A(e){return function(e){return e instanceof Function&&"AsyncFunction"===e.constructor.name}(e)||e instanceof Promise}
|
|
1
|
+
!function(){"use strict";function e(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}!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}))}();var t,r,n,o={exports:{}};function i(){return t||(t=1,o.exports=function(){const e=new WeakMap,t=/(\n|\r\n?|\u2028|\u2029)/g,r=/^\s*/,n=/\S/,o=Array.prototype.slice,i="0".charCodeAt(0),a="9".charCodeAt(0),s="a".charCodeAt(0),l="f".charCodeAt(0),c="A".charCodeAt(0),u="F".charCodeAt(0);function p(e){if("string"==typeof e)return d([e])[0];if("function"==typeof e)return function(){const t=o.call(arguments);return t[0]=f(t[0]),e.apply(this,t)};const t=f(e);let r=h(t,0);for(let e=1;e<t.length;e++)r+=arguments[e]+h(t,e);return r}function h(e,t){const r=e[t];if(void 0===r)throw new TypeError(`invalid cooked string at index ${t}`);return r}function f(t){const r=e.get(t);if(r)return r;const n=d(t.raw),o=n.map(g);return Object.defineProperty(o,"raw",{value:Object.freeze(n)}),Object.freeze(o),e.set(t,o),o}function d(e){const o=e.map(e=>e.split(t));let i;for(let e=0;e<o.length;e++){const t=o[e],a=0===e,s=e+1===o.length;if(a){if(1===t.length||t[0].length>0)throw new Error("invalid content on opening line");t[1]=""}if(s){if(1===t.length||n.test(t[t.length-1]))throw new Error("invalid content on closing line");t[t.length-2]="",t[t.length-1]=""}for(let e=2;e<t.length;e+=2){const n=t[e],o=e+1===t.length&&!s,a=r.exec(n)[0];o||a.length!==n.length?i=m(a,i):t[e]=""}}const a=i?i.length:0;return o.map(e=>{let t=e[0];for(let r=1;r<e.length;r+=2)t+=e[r]+e[r+1].slice(a);return t})}function m(e,t){if(void 0===t||e===t)return e;let r=0;for(const n=Math.min(e.length,t.length);r<n&&e[r]===t[r];r++);return e.slice(0,r)}function g(e){let t="",r=0,n=0;for(;(n=e.indexOf("\\",n))>-1;){if(t+=e.slice(r,n),++n===e.length)return;const o=e[n++];switch(o){case"b":t+="\b";break;case"t":t+="\t";break;case"n":t+="\n";break;case"v":t+="\v";break;case"f":t+="\f";break;case"r":t+="\r";break;case"\r":n<e.length&&"\n"===e[n]&&++n;case"\n":case"\u2028":case"\u2029":break;case"0":if(b(e,n))return;t+="\0";break;case"x":{const r=y(e,n,n+2);if(-1===r)return;n+=2,t+=String.fromCharCode(r);break}case"u":{let r;if(n<e.length&&"{"===e[n]){const t=e.indexOf("}",++n);if(-1===t)return;r=y(e,n,t),n=t+1}else r=y(e,n,n+4),n+=4;if(-1===r||r>1114111)return;t+=String.fromCodePoint(r);break}default:if(b(o,0))return;t+=o}r=n}return t+e.slice(r)}function b(e,t){const r=e.charCodeAt(t);return r>=i&&r<=a}function y(e,t,r){if(r>=e.length)return-1;let n=0;for(;t<r;t++){const r=w(e.charCodeAt(t));if(-1===r)return-1;n=16*n+r}return n}function w(e){return e>=i&&e<=a?e-i:e>=s&&e<=l?e-s+10:e>=c&&e<=u?e-c+10:-1}return p}()),o.exports}var a=e(n?r:(n=1,r=i()));String.dedent instanceof Function||(String.dedent=a),!("crypto"in window)&&"msCrypto"in window&&(globalThis.crypto=globalThis.msCrypto),"Notification"in window||(globalThis.Notification=globalThis.notifications||globalThis.webkitNotifications||globalThis.oNotifications||globalThis.msNotifications||!1),"doNotTrack"in navigator||(navigator.doNotTrack=globalThis.doNotTrack||navigator.msDoNotTrack||"unspecified"),"indexedDB"in window||(globalThis.indexedDB=globalThis.indexedDB||globalThis.mozIndexedDB||globalThis.webkitIndexedDB||globalThis.msIndexedDB||!1),"hidden"in document||(document.hidden=document.webkitHidden||document.msHidden||document.mozHidden||!1),"visibilityState"in document||(document.visibilityState=document.webkitVisibilityState||document.msVisibilityState||document.mozVisibilityState||"visible"),"fullscreenElement"in document||(document.fullscreenElement=document.mozFullScreenElement||document.webkitFullscreenElement||!1),"requestAnimationFrame"in window||(globalThis.requestAnimationFrame=globalThis.mozRequestAnimationFrame||globalThis.webkitRequestAnimationFrame||globalThis.msRequestAnimationFrame||!1),"exitFullscreen"in Document.prototype||(Document.prototype.exitFullscreen=document.mozCancelFullScreen||document.webkitCancelFullScreen||document.msCancelFullScreen||!1),"requestFullscreen"in HTMLElement.prototype||(HTMLElement.prototype.requestFullscreen=HTMLElement.prototype.requestFullScreen||HTMLElement.prototype.mozRequestFullScreen||HTMLElement.prototype.webkitRequestFullScreen||!1),"fullscreen"in Document.prototype||Object.defineProperty(Document.prototype,"fullscreen",{get:()=>document.fullscreenElement instanceof Element}),Object.groupBy instanceof Function||(Object.groupBy=function(e,t){return Array.from(e).reduce((e,r,n)=>{const o=t.call(e,r,n);return e.hasOwnProperty(o)?e[o].push(r):e[o]=[r],e},{})}),Map.prototype.getOrInsert instanceof Function||(Map.prototype.getOrInsert=function(e,t){return this.has(e)?this.get(e):(this.set(e,t),t)},Map.prototype.getOrInsertComputed=function(e,t){if(this.has(e))return this.get(e);{const r=t(e);return this.set(e,r),r}}),WeakMap.prototype.getOrInsert instanceof Function||(WeakMap.prototype.getOrInsert=function(e,t){return Map.prototype.getOrInsert.call(this,e,t)},WeakMap.prototype.getOrInsertComputed=function(e,t){return WeakMap.prototype.getOrInsertComputed.call(this,e,t)}),Map.groupBy instanceof Function||(Map.groupBy=function(e,t){return Array.from(e).reduce((e,r,n)=>(e.emplace(t.call(e,r,n),{insert:()=>[r],update:e=>(e.push(r),e)}),e),new Map)}),Map.prototype.emplace instanceof Function||(Map.prototype.emplace=function(e,{insert:t,update:r}={}){console.warn("`Map.prototype.emplace()` has been removed from the proposal and will be removed in the future.");const n=this.has(e);if(n&&r instanceof Function){const t=this.get(e),n=r.call(this,t,e,this);return n!==t&&this.set(e,n),n}if(n)return this.get(e);if(t instanceof Function){const r=t.call(this,e,this);return this.set(e,r),r}throw new Error("Key is not found and no `insert()` given")});const s=[Array,String,globalThis.Int8Array,globalThis.Uint8Array,globalThis.Uint8ClampedArray,globalThis.Int16Array,globalThis.Uint16Array,globalThis.Int32Array,globalThis.Uint32Array,globalThis.Float32Array,globalThis.Float64Array,globalThis.BigInt64Array,globalThis.BigUint64Array];if(Array.prototype.flat instanceof Function||(Array.prototype.flat=function(e=1){const t=[];e=Math.min(Number.MAX_SAFE_INTEGER,Math.max(0,e));const r=(e,n)=>{Array.isArray(e)&&n>=0?e.forEach(e=>r(e,n-1)):t.push(e)};return r(this,Number.isNaN(e)?0:e),t}),Array.prototype.flatMap instanceof Function||(Array.prototype.flatMap=function(e,t){return this.map(e,t).flat(1)}),Array.prototype.findLast instanceof Function||(Array.prototype.findLast=function(e,t){let r;return this.forEach((n,o,i)=>{e.call(t,n,o,i)&&(r=n)},t),r}),"lastIndex"in Array.prototype||Object.defineProperty(Array.prototype,"lastIndex",{enumerable:!1,configurable:!1,get:function(){return Math.max(0,this.length-1)}}),"lastItem"in Array.prototype||Object.defineProperty(Array.prototype,"lastItem",{enumerable:!1,configurable:!1,get:function(){return this[this.lastIndex]},set:function(e){this[this.lastIndex]=e}}),Array.prototype.findLastIndex instanceof Function||(Array.prototype.findLastIndex=function(e,t){let r=-1;return this.forEach((n,o,i)=>{e.call(t,n,o,i)&&(r=o)},t),r}),!(Array.prototype.at instanceof Function)){const Ze=function(e){if((e=Math.trunc(e)||0)<0&&(e+=this.length),!(e<0||e>=this.length))return this[e]};for(const et of s)void 0!==et&&Object.defineProperty(et.prototype,"at",{value:Ze,writable:!0,enumerable:!1,configurable:!0})}function l(e,t,r,{writable:n=!0,enumerable:o=!0,configurable:i=!0}={}){e[t]instanceof Function||Object.defineProperty(e,t,{value:r,writable:n,enumerable:o,configurable:i})}function c(e,t,{get:r,set:n,enumerable:o=!0,configurable:i=!0}={}){e.hasOwnProperty(t)||Object.defineProperty(e,t,{get:r,set:n,enumerable:o,configurable:i})}function u(e,t,r){const{value:n,enumerable:o,configurable:i,writable:a}=Object.getOwnPropertyDescriptor(e,t),s=r(n);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})}if(!(Array.prototype.group instanceof Function)&&Object.groupBy instanceof Function&&(Array.prototype.group=function(e){return console.warn("`Array.group()` is deprecated. Please use `Object.groupBy()` instead."),Object.groupBy(this,e)}),!(Array.prototype.groupBy instanceof Function)&&Object.groupBy instanceof Function&&(Array.prototype.groupBy=function(e){return console.warn("`Array.goupBy()` is deprecated. Please use `Object.groupBy()` instead."),Object.groupBy(this,e)}),!(Array.prototype.groupToMap instanceof Function)&&Map.groupBy instanceof Function&&(Array.prototype.groupToMap=function(e){return console.warn("`Array.groupToMap()` is deprecated. Please use `Map.groupBy()` instead."),Map.groupBy(this,e)}),Map.groupBy instanceof Function&&(Array.prototype.groupByToMap=function(e){return console.warn("`Array.groupByToMap()` is deprecated. Please use `Map.groupBy()` instead."),Map.groupBy(this,e)}),Array.fromAsync instanceof Function||(Array.fromAsync=async function(e,t,r=globalThis){let n=[];for await(const t of e)n.push(await t);return Array.from(n,t,r)}),Array.prototype.equals instanceof Function||(Array.prototype.equals=function(e){return this===e||!!Array.isArray(e)&&(this.length===e.length&&this.every((t,r)=>{const n=e[r];return Array.isArray(t)?Array.isArray(n)&&t.equals(n):Object.is(t,n)}))}),Array.prototype.uniqueBy instanceof Function||(Array.prototype.uniqueBy=function(e){switch(typeof e){case"undefined":return[...new Set(this)];case"string":case"number":case"symbol":return this.uniqueBy(t=>t[e]);case"function":{const t=new Set;return this.filter((...r)=>{const n=e.apply(this,r);return!t.has(n)&&(t.add(n),!0)})}default:throw new TypeError("Not a valid argument for uniqueBy")}}),Array.prototype.toReversed instanceof Function||(Array.prototype.toReversed=function(){return[...this].reverse()}),Array.prototype.toSorted instanceof Function||(Array.prototype.toSorted=function(e){return[...this].sort(e)}),Array.prototype.toSpliced instanceof Function||(Array.prototype.toSpliced=function(e,t,...r){const n=[...this];return n.splice(e,t,...r),n}),Array.prototype.with instanceof Function||(Array.prototype.with=function(e,t){const r=[...this];return r[e]=t,r}),Array.isTemplateObject instanceof Function||(Array.isTemplateObject=function(e){return!!(Array.isArray(e)&&Array.isArray(e.raw)&&Object.isFrozen(e)&&Object.isFrozen(e.raw))&&(0!==e.length&&e.length===e.raw.length)}),Uint8Array.prototype.toHex instanceof Function||(Uint8Array.prototype.toHex=function(){return Array.from(this,e=>e.toString(16).padStart(2,"0")).join("")}),Uint8Array.prototype.toBase64 instanceof Function||(Uint8Array.prototype.toBase64=function({alphabet:e="base64"}={}){if("base64"===e){const e=32768;let t="";for(let r=0;r<this.length;r+=e){const n=this.subarray(r,r+e);t+=String.fromCharCode.apply(null,n)}return btoa(t)}if("base64url"===e)return this.toBase64({alphabet:"base64"}).replaceAll("+","-").replaceAll("/","_");throw new TypeError('expected alphabet to be either "base64" or "base64url')}),Uint8Array.fromHex instanceof Function||(Uint8Array.fromHex=function(e){if("string"!=typeof e)throw new TypeError("expected input to be a string");if(0===!(1&e.length))throw new SyntaxError("string should be an even number of characters");return Uint8Array.from(globalThis.Iterator.range(0,e.length,{step:2}),t=>parseInt(e.substring(t,t+2),16))}),Uint8Array.fromBase64 instanceof Function||(Uint8Array.fromBase64=function(e,{alphabet:t="base64",lastChunkHandling:r="loose"}={}){if("string"!=typeof e)throw new TypeError("expected input to be a string");if(!["base64","base64url"].includes(t))throw new TypeError('expected alphabet to be either "base64" or "base64url');if(!["loose","strict","stop-before-partial"].includes(r))throw new TypeError(`Invalid \`lastChunkHandling\`: "${r}".`);if("base64"!==t)return Uint8Array.fromBase64(e.replaceAll("-","+").replaceAll("_","/"),{alphabet:"base64"});{const t=e.length%4;if(1===t)throw new TypeError("Invalid string length.");if(0===t)return Uint8Array.from(atob(e),e=>e.charCodeAt(0));switch(r){case"strict":throw new SyntaxError("Missing padding.");case"loose":return Uint8Array.fromBase64(e.padEnd(e.length+(4-t),"="),{alphabet:"base64",lastChunkHandling:"strict"});case"stop-before-partial":return Uint8Array.fromBase64(e.slice(0,e.length-t),{alphabet:"base64",lastChunkHandling:"strict"})}}}),"Symbol"in globalThis){const tt=new Set(Reflect.ownKeys(Symbol).filter(e=>"symbol"==typeof Symbol[e]).map(e=>Symbol[e]));void 0===Symbol.toStringTag&&(Symbol.toStringTag=Symbol("Symbol.toStringTag")),void 0===Symbol.iterator&&(Symbol.iterator=Symbol("Symbol.iterator")),l(Symbol,"isRegistered",function(e){return"symbol"==typeof e&&"string"==typeof Symbol.keyFor(e)}),l(Symbol,"isWellKnown",function(e){return tt.has(e)})}function p(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var h,f,d,m,g,b;function y(){if(f)return h;f=1;var e,t=Object.defineProperty,r=Object.getOwnPropertyDescriptor,n=Object.getOwnPropertyNames,o=Object.prototype.hasOwnProperty,i=(e,r)=>t(e,"name",{value:r,configurable:!0}),a={};((e,r)=>{for(var n in r)t(e,n,{get:r[n],enumerable:!0})})(a,{URLPattern:()=>oe}),e=a,h=((e,i,a,s)=>{if(i&&"object"==typeof i||"function"==typeof i)for(let l of n(i))!o.call(e,l)&&l!==a&&t(e,l,{get:()=>i[l],enumerable:!(s=r(i,l))||s.enumerable});return e})(t({},"__esModule",{value:!0}),e);var s=class{type=3;name="";prefix="";value="";suffix="";modifier=3;constructor(e,t,r,n,o,i){this.type=e,this.name=t,this.prefix=r,this.value=n,this.suffix=o,this.modifier=i}hasCustomName(){return""!==this.name&&"number"!=typeof this.name}};i(s,"Part");var l=/[$_\p{ID_Start}]/u,c=/[$_\u200C\u200D\p{ID_Continue}]/u,u=".*";function p(e,t){return(t?/^[\x00-\xFF]*$/:/^[\x00-\x7F]*$/).test(e)}function d(e,t=!1){let r=[],n=0;for(;n<e.length;){let o=e[n],a=i(function(o){if(!t)throw new TypeError(o);r.push({type:"INVALID_CHAR",index:n,value:e[n++]})},"ErrorOrInvalid");if("*"!==o)if("+"!==o&&"?"!==o)if("\\"!==o)if("{"!==o)if("}"!==o){if(":"===o){let t="",o=n+1;for(;o<e.length;){let r=e.substr(o,1);if(!(o===n+1&&l.test(r)||o!==n+1&&c.test(r)))break;t+=e[o++]}if(!t){a(`Missing parameter name at ${n}`);continue}r.push({type:"NAME",index:n,value:t}),n=o;continue}if("("===o){let t=1,o="",i=n+1,s=!1;if("?"===e[i]){a(`Pattern cannot start with "?" at ${i}`);continue}for(;i<e.length;){if(!p(e[i],!1)){a(`Invalid character '${e[i]}' at ${i}.`),s=!0;break}if("\\"!==e[i]){if(")"===e[i]){if(t--,0===t){i++;break}}else if("("===e[i]&&(t++,"?"!==e[i+1])){a(`Capturing groups are not allowed at ${i}`),s=!0;break}o+=e[i++]}else o+=e[i++]+e[i++]}if(s)continue;if(t){a(`Unbalanced pattern at ${n}`);continue}if(!o){a(`Missing pattern at ${n}`);continue}r.push({type:"REGEX",index:n,value:o}),n=i;continue}r.push({type:"CHAR",index:n,value:e[n++]})}else r.push({type:"CLOSE",index:n,value:e[n++]});else r.push({type:"OPEN",index:n,value:e[n++]});else r.push({type:"ESCAPED_CHAR",index:n++,value:e[n++]});else r.push({type:"OTHER_MODIFIER",index:n,value:e[n++]});else r.push({type:"ASTERISK",index:n,value:e[n++]})}return r.push({type:"END",index:n,value:""}),r}function m(e,t={}){let r=d(e);t.delimiter??="/#?",t.prefixes??="./";let n=`[^${g(t.delimiter)}]+?`,o=[],a=0,l=0,c=new Set,p=i(e=>{if(l<r.length&&r[l].type===e)return r[l++].value},"tryConsume"),h=i(()=>p("OTHER_MODIFIER")??p("ASTERISK"),"tryConsumeModifier"),f=i(e=>{let t=p(e);if(void 0!==t)return t;let{type:n,index:o}=r[l];throw new TypeError(`Unexpected ${n} at ${o}, expected ${e}`)},"mustConsume"),m=i(()=>{let e,t="";for(;e=p("CHAR")??p("ESCAPED_CHAR");)t+=e;return t},"consumeText"),b=i(e=>e,"DefaultEncodePart"),y=t.encodePart||b,w="",v=i(e=>{w+=e},"appendToPendingFixedValue"),T=i(()=>{w.length&&(o.push(new s(3,"","",y(w),"",3)),w="")},"maybeAddPartFromPendingFixedValue"),E=i((e,t,r,i,l)=>{let p,h=3;switch(l){case"?":h=1;break;case"*":h=0;break;case"+":h=2}if(!t&&!r&&3===h)return void v(e);if(T(),!t&&!r){if(!e)return;return void o.push(new s(3,"","",y(e),"",h))}p=r?"*"===r?u:r:n;let f,d=2;if(p===n?(d=1,p=""):p===u&&(d=0,p=""),t?f=t:r&&(f=a++),c.has(f))throw new TypeError(`Duplicate name '${f}'.`);c.add(f),o.push(new s(d,f,y(e),p,y(i),h))},"addPart");for(;l<r.length;){let e=p("CHAR"),r=p("NAME"),n=p("REGEX");if(!r&&!n&&(n=p("ASTERISK")),r||n){let o=e??"";-1===t.prefixes.indexOf(o)&&(v(o),o=""),T(),E(o,r,n,"",h());continue}let o=e??p("ESCAPED_CHAR");if(o)v(o);else{if(p("OPEN")){let e=m(),t=p("NAME"),r=p("REGEX");!t&&!r&&(r=p("ASTERISK"));let n=m();f("CLOSE"),E(e,t,r,n,h());continue}T(),f("END")}}return o}function g(e){return e.replace(/([.+*?^${}()[\]|/\\])/g,"\\$1")}function b(e){return e&&e.ignoreCase?"ui":"u"}function y(e,t,r){return v(m(e,r),t,r)}function w(e){switch(e){case 0:return"*";case 1:return"?";case 2:return"+";case 3:return""}}function v(e,t,r={}){r.delimiter??="/#?",r.prefixes??="./",r.sensitive??=!1,r.strict??=!1,r.end??=!0,r.start??=!0,r.endsWith="";let n=r.start?"^":"";for(let o of e){if(3===o.type){3===o.modifier?n+=g(o.value):n+=`(?:${g(o.value)})${w(o.modifier)}`;continue}t&&t.push(o.name);let e=`[^${g(r.delimiter)}]+?`,i=o.value;(1===o.type?i=e:0===o.type&&(i=u),o.prefix.length||o.suffix.length)?3!==o.modifier&&1!==o.modifier?(n+=`(?:${g(o.prefix)}`,n+=`((?:${i})(?:`,n+=g(o.suffix),n+=g(o.prefix),n+=`(?:${i}))*)${g(o.suffix)})`,0===o.modifier&&(n+="?")):(n+=`(?:${g(o.prefix)}(${i})${g(o.suffix)})`,n+=w(o.modifier)):3===o.modifier||1===o.modifier?n+=`(${i})${w(o.modifier)}`:n+=`((?:${i})${w(o.modifier)})`}let o=`[${g(r.endsWith)}]|$`,i=`[${g(r.delimiter)}]`;if(r.end)return r.strict||(n+=`${i}?`),r.endsWith.length?n+=`(?=${o})`:n+="$",new RegExp(n,b(r));r.strict||(n+=`(?:${i}(?=${o}))?`);let a=!1;if(e.length){let t=e[e.length-1];3===t.type&&3===t.modifier&&(a=r.delimiter.indexOf(t)>-1)}return a||(n+=`(?=${i}|${o})`),new RegExp(n,b(r))}i(p,"isASCII"),i(d,"lexer"),i(m,"parse"),i(g,"escapeString"),i(b,"flags"),i(y,"stringToRegexp"),i(w,"modifierToString"),i(v,"partsToRegexp");var T={delimiter:"",prefixes:"",sensitive:!0,strict:!0},E={delimiter:".",prefixes:"",sensitive:!0,strict:!0},S={delimiter:"/",prefixes:"/",sensitive:!0,strict:!0};function A(e,t){return!!e.length&&("/"===e[0]||!(!t||e.length<2)&&(("\\"==e[0]||"{"==e[0])&&"/"==e[1]))}function M(e,t){return e.startsWith(t)?e.substring(t.length,e.length):e}function x(e,t){return e.endsWith(t)?e.substr(0,e.length-t.length):e}function L(e){return!(!e||e.length<2)&&("["===e[0]||("\\"===e[0]||"{"===e[0])&&"["===e[1])}i(A,"isAbsolutePathname"),i(M,"maybeStripPrefix"),i(x,"maybeStripSuffix"),i(L,"treatAsIPv6Hostname");var O=["ftp","file","http","https","ws","wss"];function k(e){if(!e)return!0;for(let t of O)if(e.test(t))return!0;return!1}function P(e,t){if(e=M(e,"#"),t||""===e)return e;let r=new URL("https://example.com");return r.hash=e,r.hash?r.hash.substring(1,r.hash.length):""}function R(e,t){if(e=M(e,"?"),t||""===e)return e;let r=new URL("https://example.com");return r.search=e,r.search?r.search.substring(1,r.search.length):""}function F(e,t){return t||""===e?e:L(e)?B(e):q(e)}function C(e,t){if(t||""===e)return e;let r=new URL("https://example.com");return r.password=e,r.password}function j(e,t){if(t||""===e)return e;let r=new URL("https://example.com");return r.username=e,r.username}function I(e,t,r){if(r||""===e)return e;if(t&&!O.includes(t))return new URL(`${t}:${e}`).pathname;let n="/"==e[0];return e=new URL(n?e:"/-"+e,"https://example.com").pathname,n||(e=e.substring(2,e.length)),e}function N(e,t,r){return U(t)===e&&(e=""),r||""===e?e:_(e)}function H(e,t){return e=x(e,":"),t||""===e?e:D(e)}function U(e){switch(e){case"ws":case"http":return"80";case"wws":case"https":return"443";case"ftp":return"21";default:return""}}function D(e){if(""===e)return e;if(/^[-+.A-Za-z0-9]*$/.test(e))return e.toLowerCase();throw new TypeError(`Invalid protocol '${e}'.`)}function z(e){if(""===e)return e;let t=new URL("https://example.com");return t.username=e,t.username}function $(e){if(""===e)return e;let t=new URL("https://example.com");return t.password=e,t.password}function q(e){if(""===e)return e;if(/[\t\n\r #%/:<>?@[\]^\\|]/g.test(e))throw new TypeError(`Invalid hostname '${e}'`);let t=new URL("https://example.com");return t.hostname=e,t.hostname}function B(e){if(""===e)return e;if(/[^0-9a-fA-F[\]:]/g.test(e))throw new TypeError(`Invalid IPv6 hostname '${e}'`);return e.toLowerCase()}function _(e){if(""===e||/^[0-9]*$/.test(e)&&parseInt(e)<=65535)return e;throw new TypeError(`Invalid port '${e}'.`)}function V(e){if(""===e)return e;let t=new URL("https://example.com");return t.pathname="/"!==e[0]?"/-"+e:e,"/"!==e[0]?t.pathname.substring(2,t.pathname.length):t.pathname}function W(e){return""===e?e:new URL(`data:${e}`).pathname}function G(e){if(""===e)return e;let t=new URL("https://example.com");return t.search=e,t.search.substring(1,t.search.length)}function X(e){if(""===e)return e;let t=new URL("https://example.com");return t.hash=e,t.hash.substring(1,t.hash.length)}i(k,"isSpecialScheme"),i(P,"canonicalizeHash"),i(R,"canonicalizeSearch"),i(F,"canonicalizeHostname"),i(C,"canonicalizePassword"),i(j,"canonicalizeUsername"),i(I,"canonicalizePathname"),i(N,"canonicalizePort"),i(H,"canonicalizeProtocol"),i(U,"defaultPortForProtocol"),i(D,"protocolEncodeCallback"),i(z,"usernameEncodeCallback"),i($,"passwordEncodeCallback"),i(q,"hostnameEncodeCallback"),i(B,"ipv6HostnameEncodeCallback"),i(_,"portEncodeCallback"),i(V,"standardURLPathnameEncodeCallback"),i(W,"pathURLPathnameEncodeCallback"),i(G,"searchEncodeCallback"),i(X,"hashEncodeCallback");var K=class{#e;#t=[];#r={};#n=0;#o=1;#i=0;#a=0;#s=0;#l=0;#c=!1;constructor(e){this.#e=e}get result(){return this.#r}parse(){for(this.#t=d(this.#e,!0);this.#n<this.#t.length;this.#n+=this.#o){if(this.#o=1,"END"===this.#t[this.#n].type){if(0===this.#a){this.#u(),this.#p()?this.#h(9,1):this.#f()?this.#h(8,1):this.#h(7,0);continue}if(2===this.#a){this.#d(5);continue}this.#h(10,0);break}if(this.#s>0){if(!this.#m())continue;this.#s-=1}if(this.#g())this.#s+=1;else switch(this.#a){case 0:this.#b()&&this.#d(1);break;case 1:if(this.#b()){this.#y();let e=7,t=1;this.#w()?(e=2,t=3):this.#c&&(e=2),this.#h(e,t)}break;case 2:this.#v()?this.#d(3):(this.#T()||this.#f()||this.#p())&&this.#d(5);break;case 3:this.#E()?this.#h(4,1):this.#v()&&this.#h(5,1);break;case 4:this.#v()&&this.#h(5,1);break;case 5:this.#S()?this.#l+=1:this.#A()&&(this.#l-=1),this.#M()&&!this.#l?this.#h(6,1):this.#T()?this.#h(7,0):this.#f()?this.#h(8,1):this.#p()&&this.#h(9,1);break;case 6:this.#T()?this.#h(7,0):this.#f()?this.#h(8,1):this.#p()&&this.#h(9,1);break;case 7:this.#f()?this.#h(8,1):this.#p()&&this.#h(9,1);break;case 8:this.#p()&&this.#h(9,1)}}void 0!==this.#r.hostname&&void 0===this.#r.port&&(this.#r.port="")}#h(e,t){switch(this.#a){case 0:case 2:break;case 1:this.#r.protocol=this.#x();break;case 3:this.#r.username=this.#x();break;case 4:this.#r.password=this.#x();break;case 5:this.#r.hostname=this.#x();break;case 6:this.#r.port=this.#x();break;case 7:this.#r.pathname=this.#x();break;case 8:this.#r.search=this.#x();break;case 9:this.#r.hash=this.#x()}0!==this.#a&&10!==e&&([1,2,3,4].includes(this.#a)&&[6,7,8,9].includes(e)&&(this.#r.hostname??=""),[1,2,3,4,5,6].includes(this.#a)&&[8,9].includes(e)&&(this.#r.pathname??=this.#c?"/":""),[1,2,3,4,5,6,7].includes(this.#a)&&9===e&&(this.#r.search??="")),this.#L(e,t)}#L(e,t){this.#a=e,this.#i=this.#n+t,this.#n+=t,this.#o=0}#u(){this.#n=this.#i,this.#o=0}#d(e){this.#u(),this.#a=e}#O(e){return e<0&&(e=this.#t.length-e),e<this.#t.length?this.#t[e]:this.#t[this.#t.length-1]}#k(e,t){let r=this.#O(e);return r.value===t&&("CHAR"===r.type||"ESCAPED_CHAR"===r.type||"INVALID_CHAR"===r.type)}#b(){return this.#k(this.#n,":")}#w(){return this.#k(this.#n+1,"/")&&this.#k(this.#n+2,"/")}#v(){return this.#k(this.#n,"@")}#E(){return this.#k(this.#n,":")}#M(){return this.#k(this.#n,":")}#T(){return this.#k(this.#n,"/")}#f(){if(this.#k(this.#n,"?"))return!0;if("?"!==this.#t[this.#n].value)return!1;let e=this.#O(this.#n-1);return"NAME"!==e.type&&"REGEX"!==e.type&&"CLOSE"!==e.type&&"ASTERISK"!==e.type}#p(){return this.#k(this.#n,"#")}#g(){return"OPEN"==this.#t[this.#n].type}#m(){return"CLOSE"==this.#t[this.#n].type}#S(){return this.#k(this.#n,"[")}#A(){return this.#k(this.#n,"]")}#x(){let e=this.#t[this.#n],t=this.#O(this.#i).index;return this.#e.substring(t,e.index)}#y(){let e={};Object.assign(e,T),e.encodePart=D;let t=y(this.#x(),void 0,e);this.#c=k(t)}};i(K,"Parser");var Q=["protocol","username","password","hostname","port","pathname","search","hash"],J="*";function Y(e,t){if("string"!=typeof e)throw new TypeError("parameter 1 is not of type 'string'.");let r=new URL(e,t);return{protocol:r.protocol.substring(0,r.protocol.length-1),username:r.username,password:r.password,hostname:r.hostname,port:r.port,pathname:r.pathname,search:""!==r.search?r.search.substring(1,r.search.length):void 0,hash:""!==r.hash?r.hash.substring(1,r.hash.length):void 0}}function Z(e,t){return t?te(e):e}function ee(e,t,r){let n;if("string"==typeof t.baseURL)try{n=new URL(t.baseURL),void 0===t.protocol&&(e.protocol=Z(n.protocol.substring(0,n.protocol.length-1),r)),!r&&void 0===t.protocol&&void 0===t.hostname&&void 0===t.port&&void 0===t.username&&(e.username=Z(n.username,r)),!r&&void 0===t.protocol&&void 0===t.hostname&&void 0===t.port&&void 0===t.username&&void 0===t.password&&(e.password=Z(n.password,r)),void 0===t.protocol&&void 0===t.hostname&&(e.hostname=Z(n.hostname,r)),void 0===t.protocol&&void 0===t.hostname&&void 0===t.port&&(e.port=Z(n.port,r)),void 0===t.protocol&&void 0===t.hostname&&void 0===t.port&&void 0===t.pathname&&(e.pathname=Z(n.pathname,r)),void 0===t.protocol&&void 0===t.hostname&&void 0===t.port&&void 0===t.pathname&&void 0===t.search&&(e.search=Z(n.search.substring(1,n.search.length),r)),void 0===t.protocol&&void 0===t.hostname&&void 0===t.port&&void 0===t.pathname&&void 0===t.search&&void 0===t.hash&&(e.hash=Z(n.hash.substring(1,n.hash.length),r))}catch{throw new TypeError(`invalid baseURL '${t.baseURL}'.`)}if("string"==typeof t.protocol&&(e.protocol=H(t.protocol,r)),"string"==typeof t.username&&(e.username=j(t.username,r)),"string"==typeof t.password&&(e.password=C(t.password,r)),"string"==typeof t.hostname&&(e.hostname=F(t.hostname,r)),"string"==typeof t.port&&(e.port=N(t.port,e.protocol,r)),"string"==typeof t.pathname){if(e.pathname=t.pathname,n&&!A(e.pathname,r)){let t=n.pathname.lastIndexOf("/");t>=0&&(e.pathname=Z(n.pathname.substring(0,t+1),r)+e.pathname)}e.pathname=I(e.pathname,e.protocol,r)}return"string"==typeof t.search&&(e.search=R(t.search,r)),"string"==typeof t.hash&&(e.hash=P(t.hash,r)),e}function te(e){return e.replace(/([+*?:{}()\\])/g,"\\$1")}function re(e){return e.replace(/([.+*?^${}()[\]|/\\])/g,"\\$1")}function ne(e,t){t.delimiter??="/#?",t.prefixes??="./",t.sensitive??=!1,t.strict??=!1,t.end??=!0,t.start??=!0,t.endsWith="";let r=`[^${re(t.delimiter)}]+?`,n=/[$_\u200C\u200D\p{ID_Continue}]/u,o="";for(let i=0;i<e.length;++i){let a=e[i];if(3===a.type){if(3===a.modifier){o+=te(a.value);continue}o+=`{${te(a.value)}}${w(a.modifier)}`;continue}let s=a.hasCustomName(),l=!!a.suffix.length||!!a.prefix.length&&(1!==a.prefix.length||!t.prefixes.includes(a.prefix)),c=i>0?e[i-1]:null,u=i<e.length-1?e[i+1]:null;if(!l&&s&&1===a.type&&3===a.modifier&&u&&!u.prefix.length&&!u.suffix.length)if(3===u.type){let e=u.value.length>0?u.value[0]:"";l=n.test(e)}else l=!u.hasCustomName();if(!l&&!a.prefix.length&&c&&3===c.type){let e=c.value[c.value.length-1];l=t.prefixes.includes(e)}l&&(o+="{"),o+=te(a.prefix),s&&(o+=`:${a.name}`),2===a.type?o+=`(${a.value})`:1===a.type?s||(o+=`(${r})`):0===a.type&&(s||c&&3!==c.type&&3===c.modifier&&!l&&""===a.prefix?o+="(.*)":o+="*"),1===a.type&&s&&a.suffix.length&&n.test(a.suffix[0])&&(o+="\\"),o+=te(a.suffix),l&&(o+="}"),3!==a.modifier&&(o+=w(a.modifier))}return o}i(Y,"extractValues"),i(Z,"processBaseURLString"),i(ee,"applyInit"),i(te,"escapePatternString"),i(re,"escapeRegexpString"),i(ne,"partsToPattern");var oe=class{#e;#t={};#r={};#n={};#o={};#i=!1;constructor(e={},t,r){try{let n;if("string"==typeof t?n=t:r=t,"string"==typeof e){let t=new K(e);if(t.parse(),e=t.result,void 0===n&&"string"!=typeof e.protocol)throw new TypeError("A base URL must be provided for a relative constructor string.");e.baseURL=n}else{if(!e||"object"!=typeof e)throw new TypeError("parameter 1 is not of type 'string' and cannot convert to dictionary.");if(n)throw new TypeError("parameter 1 is not of type 'string'.")}typeof r>"u"&&(r={ignoreCase:!1});let o,i={ignoreCase:!0===r.ignoreCase},a={pathname:J,protocol:J,username:J,password:J,hostname:J,port:J,search:J,hash:J};for(o of(this.#e=ee(a,e,!0),U(this.#e.protocol)===this.#e.port&&(this.#e.port=""),Q)){if(!(o in this.#e))continue;let e={},t=this.#e[o];switch(this.#r[o]=[],o){case"protocol":Object.assign(e,T),e.encodePart=D;break;case"username":Object.assign(e,T),e.encodePart=z;break;case"password":Object.assign(e,T),e.encodePart=$;break;case"hostname":Object.assign(e,E),L(t)?e.encodePart=B:e.encodePart=q;break;case"port":Object.assign(e,T),e.encodePart=_;break;case"pathname":k(this.#t.protocol)?(Object.assign(e,S,i),e.encodePart=V):(Object.assign(e,T,i),e.encodePart=W);break;case"search":Object.assign(e,T,i),e.encodePart=G;break;case"hash":Object.assign(e,T,i),e.encodePart=X}try{this.#o[o]=m(t,e),this.#t[o]=v(this.#o[o],this.#r[o],e),this.#n[o]=ne(this.#o[o],e),this.#i=this.#i||this.#o[o].some(e=>2===e.type)}catch{throw new TypeError(`invalid ${o} pattern '${this.#e[o]}'.`)}}}catch(e){throw new TypeError(`Failed to construct 'URLPattern': ${e.message}`)}}get[Symbol.toStringTag](){return"URLPattern"}test(e={},t){let r,n={pathname:"",protocol:"",username:"",password:"",hostname:"",port:"",search:"",hash:""};if("string"!=typeof e&&t)throw new TypeError("parameter 1 is not of type 'string'.");if(typeof e>"u")return!1;try{n=ee(n,"object"==typeof e?e:Y(e,t),!1)}catch{return!1}for(r of Q)if(!this.#t[r].exec(n[r]))return!1;return!0}exec(e={},t){let r={pathname:"",protocol:"",username:"",password:"",hostname:"",port:"",search:"",hash:""};if("string"!=typeof e&&t)throw new TypeError("parameter 1 is not of type 'string'.");if(typeof e>"u")return;try{r=ee(r,"object"==typeof e?e:Y(e,t),!1)}catch{return null}let n,o={};for(n of(o.inputs=t?[e,t]:[e],Q)){let e=this.#t[n].exec(r[n]);if(!e)return null;let t={};for(let[r,o]of this.#r[n].entries())if("string"==typeof o||"number"==typeof o){let n=e[r+1];t[o]=n}o[n]={input:r[n]??"",groups:t}}return o}static compareComponent(e,t,r){let n=i((e,t)=>{for(let r of["type","modifier","prefix","value","suffix"]){if(e[r]<t[r])return-1;if(e[r]!==t[r])return 1}return 0},"comparePart"),o=new s(3,"","","","",3),a=new s(0,"","","","",3),l=i((e,t)=>{let r=0;for(;r<Math.min(e.length,t.length);++r){let o=n(e[r],t[r]);if(o)return o}return e.length===t.length?0:n(e[r]??o,t[r]??o)},"comparePartList");return t.#n[e]||r.#n[e]?t.#n[e]&&!r.#n[e]?l(t.#o[e],[a]):!t.#n[e]&&r.#n[e]?l([a],r.#o[e]):l(t.#o[e],r.#o[e]):0}get protocol(){return this.#n.protocol}get username(){return this.#n.username}get password(){return this.#n.password}get hostname(){return this.#n.hostname}get port(){return this.#n.port}get pathname(){return this.#n.pathname}get search(){return this.#n.search}get hash(){return this.#n.hash}get hasRegExpGroups(){return this.#i}};return i(oe,"URLPattern"),h}!function(){if(!(Function.prototype.once instanceof Function)){const e=new WeakMap;Function.prototype.once=function(t){const r=this;return function(...n){if(e.has(r))return e.get(r);if("AsyncFunction"===r.constructor.name){const o=r.apply(t||r,n).catch(t=>{throw e.delete(r),t});return e.set(r,o),o}if(r instanceof Function){const o=r.apply(t||r,n);return e.set(r,o),o}}}}}();var w=p(b?g:(b=1,g=function(){if(m)return d;m=1;const{URLPattern:e}=y();return d={URLPattern:e},globalThis.URLPattern||(globalThis.URLPattern=e),d}()));"URLPattern"in globalThis||(globalThis.URLPattern=w),l(URL,"parse",(e,t)=>{try{return new URL(e,t)}catch{return null}}),l(URL,"canParse",(e,t)=>{try{return new URL(e,t)instanceof URL}catch{return!1}}),Number.range instanceof Function||(Number.range=function(e,t,r=1){return console.warn("`Number.range()` is deprecated. Use `Iterator.range()` instead."),globalThis.Iterator.range(e,t,{step:r})});const v="Iterator"in globalThis,T=v?Object.getPrototypeOf(globalThis.Iterator):Object.getPrototypeOf(Object.getPrototypeOf([][Symbol.iterator]())),E=v?globalThis.Iterator:(e=>{class t{[Symbol.iterator](){return this}}return Object.setPrototypeOf(t,e),t})(T);var S;E.range instanceof Function||(E.range=function(e,t,r){if("number"==typeof r||"bigint"==typeof r)return E.range(e,t,{step:r});if("object"!=typeof r||Object.is(r,null))return E.range(e,t,{});{const{step:n=("number"==typeof e?e<t?1:-1:e<t?1n:-1n),inclusive:o=!1}=r;if("number"!=typeof e&&"bigint"!=typeof e)throw new TypeError("Start must be a number");if(Number.isNaN(e))throw new RangeError("Invalid start");if("number"!=typeof t&&"bigint"!=typeof t)throw new TypeError("End must be a number");if(Number.isNaN(t))throw new RangeError("Invalid end");if("number"!=typeof n&&"bigint"!=typeof n)throw new TypeError("Step must be a number");if(Number.isNaN(n))throw new RangeError("Invalid step");if(0===n)throw new RangeError("Step must not be 0");if(n<0&&e<t||n>0&&e>t)return;if(o){let r=e;return n>0?E.from({next(){const e=r<=t?{value:r,done:!1}:{done:!0};return r+=n,e}}):E.from({next(){const e=r>=t?{value:r,done:!1}:{done:!0};return r+=n,e}})}{let r=e;if(n>0)return E.from({next(){const e=r<t?{value:r,done:!1}:{done:!0};return r+=n,e}});{let r=e;return E.from({next(){const e=r>t?{value:r,done:!1}:{done:!0};return r+=n,e}})}}}}),T[Symbol.toStringTag]||(T[Symbol.toStringTag]="Iterator"),T.take instanceof Function||(T.take=function(e){let t=0;const r=this;return E.from({next:()=>t++>=e?{done:!0}:r.next()})}),T.drop instanceof Function||(T.drop=function(e){for(let t=0;t<e;t++){const{done:e}=this.next();if(e)break}return this}),T.toArray instanceof Function||(T.toArray=function(){return Array.from(this)}),T.forEach instanceof Function||(T.forEach=function(e){for(const t of this)e.call(this,t)}),T.flatMap instanceof Function||(T.flatMap=function(e){const t=this;let r=this.next();const n=({value:r,done:n=!0}={})=>n?E.from({next:()=>({done:!0})}):E.from(e.call(t,r));let o=n(r);return E.from({next(){const{value:e,done:i=!0}=o.next();return r.done&&i?{done:!0}:i?r.done?{done:!0}:(r=t.next(),o=n(r),o.next()):{value:e,done:i}}})}),T.map instanceof Function||(T.map=function(e){const t=this;return E.from({next(){const{done:r,value:n}=t.next();return r?{done:r}:{value:e.call(t,n),done:!1}}})}),T.reduce instanceof Function||(T.reduce=function(e,t){let r=void 0===t?this.next().value:t;for(const t of this)r=e.call(this,r,t);return r}),T.filter instanceof Function||(T.filter=function(e){const t=this;let r,n=!1;return E.from({next(){for(;!n;){const o=t.next();if(n=o.done,n)break;if(e.call(t,o.value)){r=o.value;break}}return{done:n,value:r}}})}),T.some instanceof Function||(T.some=function(e){let t=!1;for(const r of this)if(e.call(this,r)){t=!0;break}return t}),T.every instanceof Function||(T.every=function(e){let t=!0;for(const r of this)if(!e.call(this,r)){t=!1;break}return t}),T.find instanceof Function||(T.find=function(e){for(const t of this)if(e.call(this,t))return t}),T.indexed instanceof Function||(T.indexed=function(){let e=0;return this.map(t=>[e++,t])}),T.chunks instanceof Function||(T.chunks=function(e){if(!Number.isSafeInteger(e)||e<1)throw new TypeError("Size must be a positive integer.");{const t=this;let r=!1;return E.from({next(){if(r)return{done:r};{const n=[];let o=0;for(;o++<e&&!r;){const e=t.next();if(e.done){r=!0,void 0!==e.value&&n.push(e.value);break}n.push(e.value)}return{value:n,done:!1}}}})}}),E.from instanceof Function||(E.from=function(e){if("object"!=typeof e||null===e)throw new TypeError("Not an object.");if(e.next instanceof Function){return Object.create(T,{next:{enumerable:!0,configurable:!1,writable:!1,value:(...t)=>e.next(...t)}})}if(e[Symbol.iterator]instanceof Function)return E.from(e[Symbol.iterator]())}),v||(globalThis.Iterator=E),l(ReadableStream,"from",function(e){if(e[Symbol.iterator]instanceof Function)return new ReadableStream({start(t){try{for(const r of e)t.enqueue(r)}catch(e){t.error(e)}finally{t.close()}}});if(e[Symbol.asyncIterator]instanceof Function)return new ReadableStream({async start(t){try{for await(const r of e)t.enqueue(r)}catch(e){t.error(e)}finally{t.close()}}});throw new TypeError("`ReadableStream.from()` requires an iterable source.")}),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=(S=new Float32Array(1),function(e){return S[0]=e,S[0]})),Math.clamp instanceof Function||(Math.clamp=function(e,t,r){return Math.min(Math.max(e,t),r)}),Math.constrain instanceof Function||(Math.constrain=Math.clamp),Math.sumPrecise instanceof Function||(Math.sumPrecise=function(e){let t=-0;for(const r of e){if(!Number.isFinite(r)){t=-0;break}t+=r}return t}),Math.sum instanceof Function||(Math.sum=function(...e){return console.warn("Math.sum is deprecated. Please use Math.sumPrecise instead."),Math.sumPrecise(e)}),function(){if(!("isSecureContext"in globalThis)){const e=["localhost","127.0.0.1"],t="https:",r=[t,"file:","wss:"],n=(e=globalThis.document)=>[...e.scripts].every(({src:r})=>{if(0===r.length)return!0;{const{protocol:n,hostname:o}=new URL(r,e.baseURI);return n===t||o===location.hostname}});Object.defineProperty(globalThis,"isSecureContext",{enumerable:!0,configurable:!0,get:function(){return window.parent===window&&(!(!r.includes(location.protocol)&&!e.includes(location.hostname))&&n())}})}}();function A(e){return function(e){return e instanceof Function&&"AsyncFunction"===e.constructor.name}(e)||e instanceof Promise}
|
|
2
2
|
/**
|
|
3
3
|
* @copyright 2023 Chris Zuber <admin@kernvalley.us>
|
|
4
4
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/Lock
|
|
5
|
-
*/const
|
|
5
|
+
*/const M=new WeakMap;class x{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");M.set(this,{name:e,mode:t})}get name(){return M.get(this).name}get mode(){return M.get(this).mode}}
|
|
6
6
|
/**
|
|
7
7
|
* @copyright 2023 Chris Zuber <admin@kernvalley.us>
|
|
8
|
-
*/const L=new Map,k=Symbol("lock-key"),O="locks"in navigator&&navigator.locks.request instanceof Function;const P=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 R(e,t=null){return new Promise((r,n)=>{A(e)?e.call(globalThis,t).then(r,n):queueMicrotask(()=>{try{const n=e.call(globalThis,t);r(n)}catch(e){n(e)}})})}async function F(e){L.has(e)&&await L.get(e).promise.catch(console.error)}function C(e,t,r){const{resolve:n,reject:o,promise:i}=function(){if(Promise.withResolvers instanceof Function)return Promise.withResolvers();{const e={};return e.promise=new Promise((t,r)=>{e.resolve=t,e.reject=r}),e}}(),a=new AbortController,s=new M(e,t),l=function({name:e,mode:t}){switch(t){case"exclusive":return I().some(t=>t.name===e);case"shared":return I().some(t=>t.name===e&&"exclusive"===t.mode)}}(s);return L.set(s,{resolve:n,reject:o,promise:i,callback:r,pending:l,controller:a}),s}function j(e){return e instanceof M&&L.has(e)&&L.get(e).pending}function I(e){return"string"==typeof e?[...L.keys()].filter(t=>t.name===e):[...L.keys()]}function N(e){return I(e).filter(e=>!j(e))}function H(e){return I(e).filter(e=>j(e))}async function U(e){switch(e.mode){case"exclusive":await Promise.allSettled(I().filter(t=>t.name===e.name&&t!==e).map(F));break;case"shared":await Promise.allSettled(I().filter(t=>t.name===e.name&&"exclusive"===t.mode&&t!==e).map(F))}}function D(e){if(L.has(e))return L.get(e).controller.signal}async function z(e){if(L.has(e)){const{resolve:t,reject:r,promise:n,callback:o,pending:i,controller:a}=L.get(e);return i&&function(e,t=!0){L.has(e)&&L.set(e,{...L.get(e),pending:t})}(e,!1),R(o,e).then(t,r).finally(()=>{L.delete(e),requestIdleCallback(()=>a.abort())}),n}}class ${constructor(e){if(e!==k)throw new TypeError("Invalid constructor")}static async request(e,...t){let r,n={};t[0]instanceof Function?r=t[0]:t[1]instanceof Function&&([n,r]=t),"string"!=typeof e&&(e=e.toString());const{mode:o="exclusive",ifAvailable:i=!1,steal:a=!1,signal:s}=n;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=N(e),c=H(e),u=[...l,...c].some(t=>t.name===e);a&&u&&function(e){[...L.entries()].filter(([t])=>t.name===e).forEach(([e,{reject:t,controller:r}])=>{requestIdleCallback(()=>{r.abort(),L.delete(e)}),t(new DOMException("The lock request is aborted"))})}(e);const p=C(e,o,r);switch(s instanceof AbortSignal&&s.addEventListener("abort",()=>{if(L.has(p)){const{reject:e,controller:t}=L.get(p);L.delete(p),e(new DOMException("The lock request is aborted")),t.abort()}},{once:!0,signal:D(p)}),o){case"exclusive":if(!i||0===l.length&&0===c.length)return await U(p),await z(p);{const e=L.get(p).controller;return L.delete(p),await R(r,null).then(t=>(requestIdleCallback(()=>e.abort()),t))}case"shared":if(i){if([...l,...c].some(e=>"exclusive"===e.mode)){const e=L.get(p).controller;return L.delete(p),await R(r,null).then(t=>(requestIdleCallback(()=>e.abort()),t))}return await U(p),await z(p)}return await U(p),await z(p);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:N().map(({name:e,mode:t})=>({name:e,mode:t,clientId:null})),pending:H().map(({name:e,mode:t})=>({name:e,mode:t,clientId:null}))}}}function q(e,t="error"){if(e instanceof Error){const{message:r,name:n,fileName:o,lineNumber:i,columnNumber:a}=e;return new ErrorEvent(t,{error:e,message:`${n}: ${r}`,filename:o,lineno:i,colno:a})}throw new TypeError("`errorToEvent()` only accepts Errors")}let B=!1;if(new Promise(async e=>{if(O)if(await P)e(!1);else try{navigator.locks.request=$.request,navigator.locks.query=$.query,B=!0,e(!0)}catch(t){globalThis.dispatchEvent(q(t)),e(!1)}else try{navigator.locks=$,B=!0,e(!0)}catch(t){globalThis.dispatchEvent(q(t)),e(!1)}}),navigator.canShare instanceof Function||(navigator.canShare=function({title:e,text:t,url:r,files:n}={}){return navigator.share instanceof Function&&(!Array.isArray(n)||0===n.length)&&(!![e,t,r].every(e=>void 0===e)||[e,t,r].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:r}={}){const n=performance.now(),o=()=>e(r)?Math.max(0,r-(performance.now()-n)):Math.max(0,600-(performance.now()-n));return setTimeout(()=>t({didTimeout:!!e(r)&&0===o(),timeRemaining:o}),1)}}globalThis.cancelIdleCallback instanceof Function||(globalThis.cancelIdleCallback=e=>clearTimeout(e)),globalThis.requestAnimationFrame instanceof Function||(globalThis.requestAnimationFrame=e=>setTimeout(()=>e(performance.now()),1e3/60)),globalThis.cancelAnimationFrame instanceof Function||(globalThis.cancelAnimationFrame=e=>clearTimeout(e)),globalThis.queueMicrotask instanceof Function||(globalThis.queueMicrotask=e=>Promise.resolve().then(e).catch(e=>setTimeout(()=>{throw e})))}(),!("AbortSignal"in globalThis)){const rt={signal:Symbol("signal"),aborted:Symbol("aborted"),reason:Symbol("reason"),onabort:Symbol("onabort")};globalThis.AbortError=class extends Error{},globalThis.AbortSignal=class e extends EventTarget{constructor(){super(),Object.defineProperties(this,{[rt.aborted]:{enumerable:!1,writable:!0,configurable:!1,value:!1},[rt.reason]:{enumerable:!1,writable:!0,configurable:!1,value:void 0},[rt.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[rt.aborted]}get onabort(){return this[rt.onabort]}set onabort(e){this[rt.onabort]=e instanceof Function?e:null}get reason(){return this[rt.reason]}throwIfAborted(){if(this.aborted)throw this.reason}static abort(t=new DOMException("Operation aborted")){const r=new e;return r[rt.aborted]=!0,r[rt.reason]=t,r}},globalThis.AbortController=class{constructor(){this[rt.signal]=new AbortSignal}get signal(){return this[rt.signal]}abort(e=new DOMException("Operation aborted")){const t=this.signal;t.aborted||(t[rt.aborted]=!0,t[rt.reason]=e,t.dispatchEvent(new Event("abort")))}}}if(!("reason"in AbortSignal.prototype)){const nt=new WeakMap,ot=AbortController.prototype.abort;if(AbortSignal.abort instanceof Function){const it=AbortSignal.abort;AbortSignal.abort=function(e=new DOMException("Operation aborted")){const t=it();return nt.set(t,e),t}}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 nt.has(this)?nt.get(this):void 0}}),AbortController.prototype.abort=function(e=new DOMException("Operation aborted")){nt.set(this.signal,e),ot.call(this)}}if(AbortSignal.prototype.throwIfAborted instanceof Function||(AbortSignal.prototype.throwIfAborted=function(){if(this.aborted)throw this.reason}),AbortSignal.timeout instanceof Function||(AbortSignal.timeout=function(e){if(void 0===e)throw new TypeError("At least one 1 argument required but only 0 passed");if(Number.isFinite(e)){if(e<0)throw new TypeError("Argument 1 is out of range for unsigned long long.");{const t=new AbortController;return setTimeout(()=>t.abort(new DOMException("The operation timed out.")),e),t.signal}}throw new TypeError("Argument 1 is not a finite value, so it is out of range for unsigned long long.")}),AbortSignal.any instanceof Function||(AbortSignal.any=function(e){if(!Array.isArray(e))throw new TypeError("Expected an array of signals");const t=new AbortController;for(const r of e){if(!(r instanceof AbortSignal)){const e=new TypeError("`signal` is not an `AbortSignal`");throw t.abort(e),e}if(r.aborted){t.abort(r.reason||new DOMException("Operation aborted."));break}r.addEventListener("abort",({target:e})=>{t.abort(e.reason||new DOMException("Operation aborted."))},{signal:t.signal})}return t.signal}),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(q(e))}),!(Error.isError instanceof Function)){const at=Function.bind.call(Function.call,Object.prototype.toString);Error.isError=function(e){return e instanceof Error||"object"==typeof e&&"[object Error]"===at(e)&&void 0===e[Symbol.toStringTag]}}!function(){if("MediaQueryListEvent"in globalThis||(globalThis.MediaQueryListEvent=class extends Event{constructor(e,{media:t,matches:r}={}){super(e),Object.defineProperties(this,{media:{enumerable:!0,configurable:!1,writable:!1,value:t},matches:{enumerable:!0,configurable:!1,writable:!1,value:r}})}}),"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}))},r=function(r){return e.has(r)||(e.set(r,new EventTarget),r.addListener(t.bind(r))),e.get(r)};globalThis.MediaQueryList.prototype.addEventListener=function(e,t,n){r(this).addEventListener(e,t,n)},globalThis.MediaQueryList.prototype.removeEventListener=function(e,t,n){r(this).removeEventListener(e,t,n)},globalThis.MediaQueryList.prototype.dispatchEvent=function(e){r(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,r)=>{let n=[];e.forEach(o=>{o.then(t).catch(t=>{n.push(t),n.length===e.length&&r(new globalThis.AggregateError(n,"No Promise in Promise.any was resolved"))})})})),Promise.race instanceof Function||(Promise.race=e=>new Promise((t,r)=>{e.forEach(e=>e.then(t,r))})),Promise.try instanceof Function||(Promise.try=(e,...t)=>new Promise(r=>r(e(...t)))),Promise.withResolvers instanceof Function||(Promise.withResolvers=function(){const e={};return e.promise=new Promise((t,r)=>{e.resolve=t,e.reject=r}),e}),Promise.fromEntries instanceof Function||(Promise.fromEntries=async function(e){const t=[],r=[];for(const[n,o]of e)t.push(n),r.push(o);return await Promise.all(r).then(e=>Object.fromEntries(e.map((e,r)=>[t[r],e])))}),Promise.ownProperties instanceof Function||(Promise.ownProperties=async function(e){return await Promise.fromEntries(Object.entries(e))}))
|
|
8
|
+
*/const L=new Map,O=Symbol("lock-key"),k="locks"in navigator&&navigator.locks.request instanceof Function;const P=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 R(e,t=null){return new Promise((r,n)=>{A(e)?e.call(globalThis,t).then(r,n):queueMicrotask(()=>{try{const n=e.call(globalThis,t);r(n)}catch(e){n(e)}})})}async function F(e){L.has(e)&&await L.get(e).promise.catch(console.error)}function C(e,t,r){const{resolve:n,reject:o,promise:i}=function(){if(Promise.withResolvers instanceof Function)return Promise.withResolvers();{const e={};return e.promise=new Promise((t,r)=>{e.resolve=t,e.reject=r}),e}}(),a=new AbortController,s=new x(e,t),l=function({name:e,mode:t}){switch(t){case"exclusive":return I().some(t=>t.name===e);case"shared":return I().some(t=>t.name===e&&"exclusive"===t.mode)}}(s);return L.set(s,{resolve:n,reject:o,promise:i,callback:r,pending:l,controller:a}),s}function j(e){return e instanceof x&&L.has(e)&&L.get(e).pending}function I(e){return"string"==typeof e?[...L.keys()].filter(t=>t.name===e):[...L.keys()]}function N(e){return I(e).filter(e=>!j(e))}function H(e){return I(e).filter(e=>j(e))}async function U(e){switch(e.mode){case"exclusive":await Promise.allSettled(I().filter(t=>t.name===e.name&&t!==e).map(F));break;case"shared":await Promise.allSettled(I().filter(t=>t.name===e.name&&"exclusive"===t.mode&&t!==e).map(F))}}function D(e){if(L.has(e))return L.get(e).controller.signal}async function z(e){if(L.has(e)){const{resolve:t,reject:r,promise:n,callback:o,pending:i,controller:a}=L.get(e);return i&&function(e,t=!0){L.has(e)&&L.set(e,{...L.get(e),pending:t})}(e,!1),R(o,e).then(t,r).finally(()=>{L.delete(e),requestIdleCallback(()=>a.abort())}),n}}class ${constructor(e){if(e!==O)throw new TypeError("Invalid constructor")}static async request(e,...t){let r,n={};t[0]instanceof Function?r=t[0]:t[1]instanceof Function&&([n,r]=t),"string"!=typeof e&&(e=e.toString());const{mode:o="exclusive",ifAvailable:i=!1,steal:a=!1,signal:s}=n;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=N(e),c=H(e),u=[...l,...c].some(t=>t.name===e);a&&u&&function(e){[...L.entries()].filter(([t])=>t.name===e).forEach(([e,{reject:t,controller:r}])=>{requestIdleCallback(()=>{r.abort(),L.delete(e)}),t(new DOMException("The lock request is aborted"))})}(e);const p=C(e,o,r);switch(s instanceof AbortSignal&&s.addEventListener("abort",()=>{if(L.has(p)){const{reject:e,controller:t}=L.get(p);L.delete(p),e(new DOMException("The lock request is aborted")),t.abort()}},{once:!0,signal:D(p)}),o){case"exclusive":if(!i||0===l.length&&0===c.length)return await U(p),await z(p);{const e=L.get(p).controller;return L.delete(p),await R(r,null).then(t=>(requestIdleCallback(()=>e.abort()),t))}case"shared":if(i){if([...l,...c].some(e=>"exclusive"===e.mode)){const e=L.get(p).controller;return L.delete(p),await R(r,null).then(t=>(requestIdleCallback(()=>e.abort()),t))}return await U(p),await z(p)}return await U(p),await z(p);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:N().map(({name:e,mode:t})=>({name:e,mode:t,clientId:null})),pending:H().map(({name:e,mode:t})=>({name:e,mode:t,clientId:null}))}}}function q(e,t="error"){if(e instanceof Error){const{message:r,name:n,fileName:o,lineNumber:i,columnNumber:a}=e;return new ErrorEvent(t,{error:e,message:`${n}: ${r}`,filename:o,lineno:i,colno:a})}throw new TypeError("`errorToEvent()` only accepts Errors")}let B=!1;if(new Promise(async e=>{if(k)if(await P)e(!1);else try{navigator.locks.request=$.request,navigator.locks.query=$.query,B=!0,e(!0)}catch(t){globalThis.dispatchEvent(q(t)),e(!1)}else try{navigator.locks=$,B=!0,e(!0)}catch(t){globalThis.dispatchEvent(q(t)),e(!1)}}),navigator.canShare instanceof Function||(navigator.canShare=function({title:e,text:t,url:r,files:n}={}){return navigator.share instanceof Function&&(!Array.isArray(n)||0===n.length)&&(!![e,t,r].every(e=>void 0===e)||[e,t,r].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:r}={}){const n=performance.now(),o=()=>e(r)?Math.max(0,r-(performance.now()-n)):Math.max(0,600-(performance.now()-n));return setTimeout(()=>t({didTimeout:!!e(r)&&0===o(),timeRemaining:o}),1)}}globalThis.cancelIdleCallback instanceof Function||(globalThis.cancelIdleCallback=e=>clearTimeout(e)),globalThis.requestAnimationFrame instanceof Function||(globalThis.requestAnimationFrame=e=>setTimeout(()=>e(performance.now()),1e3/60)),globalThis.cancelAnimationFrame instanceof Function||(globalThis.cancelAnimationFrame=e=>clearTimeout(e)),globalThis.queueMicrotask instanceof Function||(globalThis.queueMicrotask=e=>Promise.resolve().then(e).catch(e=>setTimeout(()=>{throw e})))}(),!("AbortSignal"in globalThis)){const rt={signal:Symbol("signal"),aborted:Symbol("aborted"),reason:Symbol("reason"),onabort:Symbol("onabort")};globalThis.AbortError=class extends Error{},globalThis.AbortSignal=class e extends EventTarget{constructor(){super(),Object.defineProperties(this,{[rt.aborted]:{enumerable:!1,writable:!0,configurable:!1,value:!1},[rt.reason]:{enumerable:!1,writable:!0,configurable:!1,value:void 0},[rt.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[rt.aborted]}get onabort(){return this[rt.onabort]}set onabort(e){this[rt.onabort]=e instanceof Function?e:null}get reason(){return this[rt.reason]}throwIfAborted(){if(this.aborted)throw this.reason}static abort(t=new DOMException("Operation aborted")){const r=new e;return r[rt.aborted]=!0,r[rt.reason]=t,r}},globalThis.AbortController=class{constructor(){this[rt.signal]=new AbortSignal}get signal(){return this[rt.signal]}abort(e=new DOMException("Operation aborted")){const t=this.signal;t.aborted||(t[rt.aborted]=!0,t[rt.reason]=e,t.dispatchEvent(new Event("abort")))}}}if(!("reason"in AbortSignal.prototype)){const nt=new WeakMap,ot=AbortController.prototype.abort;if(AbortSignal.abort instanceof Function){const it=AbortSignal.abort;AbortSignal.abort=function(e=new DOMException("Operation aborted")){const t=it();return nt.set(t,e),t}}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 nt.has(this)?nt.get(this):void 0}}),AbortController.prototype.abort=function(e=new DOMException("Operation aborted")){nt.set(this.signal,e),ot.call(this)}}if(AbortSignal.prototype.throwIfAborted instanceof Function||(AbortSignal.prototype.throwIfAborted=function(){if(this.aborted)throw this.reason}),AbortSignal.timeout instanceof Function||(AbortSignal.timeout=function(e){if(void 0===e)throw new TypeError("At least one 1 argument required but only 0 passed");if(Number.isFinite(e)){if(e<0)throw new TypeError("Argument 1 is out of range for unsigned long long.");{const t=new AbortController;return setTimeout(()=>t.abort(new DOMException("The operation timed out.")),e),t.signal}}throw new TypeError("Argument 1 is not a finite value, so it is out of range for unsigned long long.")}),AbortSignal.any instanceof Function||(AbortSignal.any=function(e){if(!Array.isArray(e))throw new TypeError("Expected an array of signals");const t=new AbortController;for(const r of e){if(!(r instanceof AbortSignal)){const e=new TypeError("`signal` is not an `AbortSignal`");throw t.abort(e),e}if(r.aborted){t.abort(r.reason||new DOMException("Operation aborted."));break}r.addEventListener("abort",({target:e})=>{t.abort(e.reason||new DOMException("Operation aborted."))},{signal:t.signal})}return t.signal}),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(q(e))}),!(Error.isError instanceof Function)){const at=Function.bind.call(Function.call,Object.prototype.toString);Error.isError=function(e){return e instanceof Error||"object"==typeof e&&"[object Error]"===at(e)&&void 0===e[Symbol.toStringTag]}}!function(){if("MediaQueryListEvent"in globalThis||(globalThis.MediaQueryListEvent=class extends Event{constructor(e,{media:t,matches:r}={}){super(e),Object.defineProperties(this,{media:{enumerable:!0,configurable:!1,writable:!1,value:t},matches:{enumerable:!0,configurable:!1,writable:!1,value:r}})}}),"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}))},r=function(r){return e.has(r)||(e.set(r,new EventTarget),r.addListener(t.bind(r))),e.get(r)};globalThis.MediaQueryList.prototype.addEventListener=function(e,t,n){r(this).addEventListener(e,t,n)},globalThis.MediaQueryList.prototype.removeEventListener=function(e,t,n){r(this).removeEventListener(e,t,n)},globalThis.MediaQueryList.prototype.dispatchEvent=function(e){r(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,r)=>{let n=[];e.forEach(o=>{o.then(t).catch(t=>{n.push(t),n.length===e.length&&r(new globalThis.AggregateError(n,"No Promise in Promise.any was resolved"))})})})),Promise.race instanceof Function||(Promise.race=e=>new Promise((t,r)=>{e.forEach(e=>e.then(t,r))})),Promise.try instanceof Function||(Promise.try=(e,...t)=>new Promise(r=>r(e(...t)))),Promise.withResolvers instanceof Function||(Promise.withResolvers=function(){const e={};return e.promise=new Promise((t,r)=>{e.resolve=t,e.reject=r}),e}),Promise.fromEntries instanceof Function||(Promise.fromEntries=async function(e){const t=[],r=[];for(const[n,o]of e)t.push(n),r.push(o);return await Promise.all(r).then(e=>Object.fromEntries(e.map((e,r)=>[t[r],e])))}),Promise.ownProperties instanceof Function||(Promise.ownProperties=async function(e){return await Promise.fromEntries(Object.entries(e))}))
|
|
9
9
|
/**
|
|
10
10
|
* @copyright 2023 Chris Zuber <admin@kernvalley.us>
|
|
11
11
|
*/;class _{get encoding(){return"utf-8"}encode(e){return new Uint8Array(e.split("").flatMap(e=>{const t=e.charCodeAt(0);if(t<128)return[t];return[194+Math.floor((t-128)/64),t%64+128]}))}encodeInto(e,t){if(t instanceof Uint8Array){const r=this.encode(e),n=Math.min(t.length,r.length);return r.length>t.length?t.set(r.slice(0,n)):t.set(r),{read:n,written:n}}throw new TypeError("TextEncoder.encodeInto: Argument 2 does not implement interface Uint8Array.")}}
|
|
@@ -23,14 +23,14 @@
|
|
|
23
23
|
*/;const G="cookieStore"in globalThis,X={constructor:Symbol("constructor")};function K(){return 0===document.cookie.length?[]:document.cookie.split(";").map(e=>{const[t,r=null]=e.split("=");return{name:decodeURIComponent(t.trim()),value:"string"==typeof r?decodeURIComponent(r.trim()):null,path:void 0,expires:void 0,domain:void 0,sameSite:void 0,secure:void 0,partitioned:!1}})}function Q({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?K().filter(r=>r.name===e&&r.value===t):"string"==typeof e?K().filter(t=>t.name===e):"string"==typeof t?K().filter(e=>e.value===t):K()}function J({name:e,value:t,expires:r=null,maxAge:n=null,path:o="/",sameSite:i="lax",domain:a=null,secure:s=!1,partitioned:l=!1}){if(Number.isInteger(n))J({name:e,value:t,expires:Date.now()+n,path:o,sameSite:i,domain:a,secure:s,partitioned:l});else{let n=`${encodeURIComponent(e)}=`;t&&(n+=encodeURIComponent(t)),Number.isInteger(r)?n+=`;expires=${new Date(r).toUTCString()}`:r instanceof Date&&(n+=`;expires=${r.toUTCString()}`),"string"==typeof o&&(n+=`;path=${o}`),"string"==typeof a&&(n+=`;domain=${a}`),"string"==typeof i&&(n+=`;sameSite=${i}`),!0===s&&(n+=";secure"),!0===l&&(n+=";partitioned"),document.cookie=n}}class Y 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 Q("string"==typeof e?{name:e}:e)}async set(...e){if(1===e.length&&"object"==typeof e[0]&&"string"==typeof e[0].name){const t=function({name:e,value:t=null,domain:r=null,path:n="/",expires:o=null,maxAge:i=null,sameSite:a="lax",secure:s=!1,partitioned:l=!1}){return{name:e,value:t,domain:r,path:n,expires:o,maxAge:i,sameSite:a,secure:s,partitioned:l}}(e[0]);J(t);const r=new Event("change");r.changed=[t],r.deleted=[],this.dispatchEvent(r)}else{if(2!==e.length)throw new Error("Invalid arguments");this.set({name:e[0],value:e[1]})}}async delete(e={}){if("string"==typeof e)this.delete({name:e});else{if("object"!=typeof e||"string"!=typeof e.name)throw new TypeError("Failed to execute 'delete' on 'CookieStore': required member name is undefined.");{const t=await this.getAll(e);if(0!==t.length){const r=new Event("change");r.changed=[],r.deleted=new Array(t.length),t.forEach((t,n)=>{t.path=e.path||"/",t.domain=e.domain||null,t.secure=e.secure||null,delete t.value,t.sameSite=e.sameSite||"lax",r.deleted[n]=t,J({...t,value:null,expires:1})}),this.dispatchEvent(r)}}}}}const Z=new Y(X.constructor);if(!G&&(globalThis.cookieStore=Z),globalThis.hasOwnProperty("Animation")&&!Animation.prototype.hasOwnProperty("finished")&&Object.defineProperty(Animation.prototype,"finished",{get:function(){return new Promise((e,t)=>{"finished"===this.playState?e(this):(this.addEventListener("finish",()=>e(this),{once:!0}),this.addEventListener("error",e=>t(e),{once:!0}))})}}),globalThis.hasOwnProperty("Animation")&&!Animation.prototype.hasOwnProperty("ready")&&Object.defineProperty(Animation.prototype,"ready",{get:function(){return new Promise((e,t)=>{this.pending?(this.addEventListener("ready",()=>e(this),{once:!0}),this.addEventListener("error",e=>t(e),{once:!0})):e(this)})}}),"HTMLElement"in globalThis&&!("trustedTypes"in globalThis)){const st={key:Symbol("trust:key")},lt=new Set(Object.keys(HTMLElement.prototype).filter(e=>e.startsWith("on"))),ct=()=>{const e=document.head.querySelector('meta[http-equiv="Content-Security-Policy"][content]');if(e instanceof HTMLMetaElement){const t=e.content.trim().split(";").filter(e=>0!==e.length).map(e=>e.trim()),r=Object.fromEntries(t.map(e=>{const[t,...r]=e.trim().split(" ").filter(e=>0!==e.length);return[t,r]})),n=Array.isArray(r["require-trusted-types-for"])&&r["require-trusted-types-for"].includes("'script'"),o=n&&Array.isArray(r["trusted-types"])?new Set(r["trusted-types"]):new Set,i=o.has("'allow-duplicates'");return o.has("'none'")?o.clear():i&&o.delete("'allow-duplicates'"),{enforced:n,allowedPolicies:o,allowDuplicates:i}}if(document.documentElement.dataset.hasOwnProperty("trustedPolicies")){const e=new Set(document.documentElement.dataset.trustedPolicies.split(" ")),t=e.has("'allow-duplicates'"),r=e.has("'none'");return t&&e.delete("'allow-duplicates'"),r&&e.clear(),{enforced:!0,allowedPolicies:e,allowDuplicates:t}}return{enforced:!1,allowedPolicies:new Set,allowDuplicates:!0}};class ut{#P;#R;#F;#C;constructor({enforced:e,allowedPolicies:t,allowDuplicates:r}={},n){if(n!==st.key)throw new TypeError("Invalid constructor of TrustedTypePolicyFactory.");if(!(t instanceof Set))throw new TypeError("`allowedPolicies` must be a Set.");this.#R=t,this.#F=e,this.#C=r,this.#P=new Map}get defaultPolicy(){return this.#P.has("default")?this.#P.get("default"):null}createPolicy(e,{createHTML:t,createScript:r,createScriptURL:n}){if(/^[-#a-zA-Z0-9=_/@.%]+$/.test(e.toString())){if(this.#F&&!this.#R.has(e))throw new TypeError(`${e} is not an allowed policy.`);if(!this.#C&&this.#P.has(e))throw new TypeError(`${e} has already been created and duplicates are not allowed.`);{const o=new pt(e.toString(),{createHTML:t,createScript:r,createScriptURL:n},st.key);return this.#P.set(o.name,o),o}}throw new TypeError(`Failed to execute 'createPolicy' on 'TrustedTypePolicyFactory': Policy: "${e}" contains invalid characters.`)}getAttributeType(e,t,r){if(e=e.toLowerCase(),t=t.toLowerCase(),"string"==typeof elementNS&&0!==r.length)return lt.has(t)?"TrustedScript":null;if(lt.has(t))return"TrustedScript";switch(e){case"script":return"src"===t?"TrustedScriptURL":null;case"iframe":return"srcdoc"===t?"TrustedHTML":"src"===t?"TrustedScriptURL":null;default:return null}}getPropertyType(e,t){if(e=e.toLowerCase(),lt.has(t.toLowerCase()))return"TrustedScript";switch(e){case"embed":case"iframe":return"src"===t?"TrustedScriptURL":null;case"script":return"src"===t?"TrustedScriptURL":["text","innerText","textContent","innerHTML"].includes(t)?"TrustedScript":["outerHTML"].includes(t)?"TrustedHTML":null;default:return["innerHTML","outerHTML"].includes(t)?"TrustedHTML":null}}isHTML(e){return e instanceof globalThis.TrustedHTML}isScript(e){return e instanceof globalThis.TrustedScript}isScriptURL(e){return e instanceof globalThis.TrustedScriptURL}get emptyHTML(){return new ft("",st.key)}get emptyScript(){return new dt("",st.key)}get[Symbol.for("polyfilled")](){return!0}get[Symbol.for("enforced")](){return this.#F}}class pt{#j;#I;#N;#H;constructor(e,{createHTML:t,createScript:r,createScriptURL:n},o){if(o!==st.key)throw new Error(`Invalid construction of ${e} policy.`);this.#j=e,this.#I=t,this.#N=r,this.#H=n}get name(){return this.#j}createHTML(e,...t){if(this.#I instanceof Function)return new ft(this.#I(e.toString(),...t).toString(),st.key);throw new TypeError("This policy does not provide `createHTML()`")}createScript(e,...t){if(this.#N instanceof Function)return new dt(this.#N(e.toString(),...t).toString(),st.key);throw new TypeError("This policy does not provide `createScript()`")}createScriptURL(e,...t){if(this.#H instanceof Function)return new mt(this.#H(e.toString(),...t).toString(),st.key);throw new TypeError("This policy does not provide `createScriptURL()`")}}class ht{#U;constructor(e,t){if(t!==st.key)throw new Error("Invalid constructor of TrustedType.");this.#U=e}toString(){return this.#U}toJSON(){return this.#U}}class ft extends ht{}class dt extends ht{}class mt extends ht{}globalThis.TrustedTypePolicyFactory=ut,globalThis.trustedTypes=new ut(ct(),st.key),globalThis.TrustedHTML=ft,globalThis.TrustedScript=dt,globalThis.TrustedScriptURL=mt}
|
|
24
24
|
/**
|
|
25
25
|
* @copyright 2023-2024 Chris Zuber <admin@kernvalley.us>
|
|
26
|
-
*/("HTMLElement"in globalThis&&!("trustedTypes"in globalThis)||"HTMLElement"in globalThis&&globalThis.trustedTypes[Symbol.for("polyfilled")]&&globalThis.trustedTypes[Symbol.for("enforced")])&&function(){function e(){return"trustedTypes"in globalThis}function t(){return e()&&!Object.is(trustedTypes.defaultPolicy,null)}function r(r){if(function(t){return e()&&trustedTypes.isHTML(t)}(r)||!e())return r;if(t())return trustedTypes.defaultPolicy.createHTML(r);throw new TypeError("Attempting to set HTML and no default policy is available.")}function n(r){if(function(t){return e()&&trustedTypes.isScript(t)}(r)||!e())return r;if(t())return trustedTypes.defaultPolicy.createScript(r);throw new TypeError("Attempting to create script and no default policy is available.")}function o(r){if(function(t){return e()&&trustedTypes.isScriptURL(t)}(r)||!e())return r;if(t())return trustedTypes.defaultPolicy.createScriptURL(r);throw new TypeError("Attempting to create script URL and no default policy is available.")}function i(t,r,n){return e()?trustedTypes.getAttributeType(t,r,n):null}try{const{write:e,writeln:t,execCommand:n}=Object.getOwnPropertyDescriptors(Document.prototype);Object.defineProperties(Document.prototype,{write:{value:function(t){e.value.call(this,r(t))},enumerable:e.enumerable,configurable:e.configurable,writable:e.writable},writeln:{value:function(e){t.value.call(this,r(e))},enumerable:t.enumerable,configurable:t.configurable,writable:t.writable},execCommand:{value:function(e,t,o){return["insertHTML"].includes(e)?n.value.call(this,e,t,r(o)):n.value.call(this,e,t,o)},enumerable:n.enumerable,configurable:n.configurable}})}catch(e){console.error(e)}if("ServiceWorkerContainer"in globalThis)try{const e=Object.getOwnPropertyDescriptor(ServiceWorkerContainer.prototype,"register");Object.defineProperty(ServiceWorkerContainer.prototype,"register",{value:function(t,r){return e.value.call(this,o(t),r)},enumerable:e.enumerable,configurable:e.configurable})}catch(e){console.error(e)}try{const e=Object.getOwnPropertyDescriptor(Range.prototype,"createContextualFragment");Object.defineProperty(Range.prototype,"createContextualFragment",{value:function(t){return e.value.call(this,r(t))},enumerable:e.enumerable,configurable:e.configurable})}catch(e){console.error(e)}try{const{parseFromString:e}=Object.getOwnPropertyDescriptors(DOMParser.prototype);Object.defineProperties(DOMParser.prototype,{parseFromString:{value:function(t,n){return"text/html"===n?e.value.call(this,r(t),n):e.value.call(this,t,n)},enumerable:e.enumerable,configurable:e.configurable,writable:e.writable}})}catch(e){console.error(e)}try{const{src:e,text:t}=Object.getOwnPropertyDescriptors(HTMLScriptElement.prototype);Object.defineProperties(HTMLScriptElement.prototype,{text:{get:function(){return t.get.call(this)},set:function(e){t.set.call(this,n(e))},enumerable:t.enumerable,configurable:t.configurable},src:{get:function(){return e.get.call(this)},set:function(t){e.set.call(this,o(t))},enumerable:e.enumerable,configurable:e.configurable}})}catch(e){console.error(e)}try{const{setAttribute:e,setAttributeNS:t,innerHTML:a,outerHTML:s,insertAdjacentHTML:l}=Object.getOwnPropertyDescriptors(Element.prototype);Object.defineProperties(Element.prototype,{setAttribute:{value:function(t,a){switch(i(this.tagName,t)){case"TrustedHTML":e.value.call(this,t,r(a));break;case"TrustedScript":e.value.call(this,t,n(a));break;case"TrustedScriptURL":e.value.call(this,t,o(a));break;default:e.value.call(this,t,a)}},enumerable:e.enumerable,configurable:e.configurable},setAttributeNS:{value:function(e,a,s){switch(i(this.tagName,a,e)){case"TrustedHTML":t.value.call(this,e,a,r(s));break;case"TrustedScript":t.value.call(this,e,a,n(s));break;case"TrustedScriptURL":t.value.call(this,e,a,o(s));break;default:t.value.call(this,e,a,s)}},enumerable:t.enumerable,configurable:t.configurable},innerHTML:{get:function(){return a.get.call(this)},set:function(e){a.set.call(this,r(e))},enumerable:a.enumerable,configurable:a.configurable},outerHTML:{get:function(){return s.get.call(this)},set:function(e){s.set.call(this,r(e))},enumerable:s.enumerable,configurable:s.configurable},insertAdjacentHTML:{value:function(e,t){l.value.call(this,e,r(t))},enumerable:l.enumerable,configurable:l.configurable}})}catch(e){console.error(e)}try{const{srcdoc:e,src:t}=Object.getOwnPropertyDescriptors(HTMLIFrameElement.prototype);Object.defineProperties(HTMLIFrameElement.prototype,{srcdoc:{get:function(){return e.get.call(this)},set:function(t){e.set.call(this,r(t))},enumerable:e.enumerable,configurable:e.configurable},src:{get:function(){return t.get.call(this)},set:function(e){t.set.call(this,o(e))},enumerable:t.enumerable,configurable:t.configurable}})}catch(e){console.error(e)}try{const{data:e,codeBase:t}=Object.getOwnPropertyDescriptors(HTMLObjectElement.prototype);Object.defineProperties(HTMLObjectElement.prototype,{data:{get:function(){return e.get.call(this)},set:function(t){e.set.call(this,o(t))},enumerable:e.enumerable,configurable:e.configurable},codeBase:{get:function(){return t.get.call(this)},set:function(e){t.set.call(this,o(e))},enumerable:t.enumerable,configurable:t.configurable}})}catch(e){console.error(e)}try{const{eval:e,setTimeout:t,setInterval:r}=globalThis;globalThis.eval=function(t){return e(n(t).toString())},globalThis.setTimeout=function(e,r,...o){return"string"==typeof e?t(n(e),r,...o):t(e,r,...o)},globalThis.setInterval=function(e,t,...o){return"string"==typeof e?r(n(e),t,...o):r(e,t,...o)};try{const e=globalThis.Function;globalThis.Function=function(...t){if(0===t.length)return e();{const r=n(t.pop());return e(...t,r.toString())}},globalThis.Function.prototype=e.prototype,e.prototype.constructor=globalThis.Function}catch(e){console.error(e)}}catch(e){console.error(e)}}();const ee={get(){return Array.from(this.styleSheets).filter(e=>e.ownerNode.classList.contains("_adopted"))},set(e){if(!Array.isArray(e))throw new TypeError("Must be an array");{const t=new Set(this.adoptedStyleSheets);t.difference(e).forEach(e=>e.ownerNode.remove());const r=[...new Set(e).difference(t)].map(e=>{const t=document.createElement("link"),r=new AbortController,n=r.signal,o=URL.createObjectURL(new File([],"adopted.css",{type:"text/css"}));return t.rel="stylesheet",t.href=o,t.classList.add("_adopted"),t.disabled=e.disabled,t.addEventListener("load",({target:n})=>{r.abort(),t.media=e.media.mediaText,[...e.cssRules].forEach((e,t)=>{n.sheet.insertRule(e.cssText,t)}),setTimeout(()=>URL.revokeObjectURL(n.href),100)},{once:!0,signal:n}),t.addEventListener("error",({target:e})=>{r.abort(),URL.revokeObjectURL(e.href)},{once:!0,signal:n}),t});this instanceof Document?this.head.append(...r):this.append(...r)}}},te=Symbol("shadow:hosts");function re(e){if(e instanceof HTMLTemplateElement&&e.parentElement instanceof HTMLElement){e.parentElement.attachShadow({mode:e.getAttribute("shadowrootmode"),clonable:e.hasAttribute("shadowrootclonable"),delegatesFocus:e.hasAttribute("shadowrootdelegatesfocus"),serializable:e.hasAttribute("shadowrootserializable")}).append(e.content),e.remove()}}function ne(e,{serializableShadowRoots:t=!1,shadowRoots:r=[],[te]:n=[]}={}){return Array.from(e.childNodes,e=>{if(e.nodeType===Node.ELEMENT_NODE){const[o,i]=function(e){const t=e.cloneNode().outerHTML,r=t.indexOf("/")-1;return r>0?[t.substring(0,r),t.substring(r)]:[t,""]}(e);return o+e.getHTML({serializableShadowRoots:t,shadowRoots:r,[te]:n})+i}return e.textContent}).join("")}function oe(e,{serializableShadowRoots:t,shadowRoots:r,[te]:n=[]}={}){if(e.serializable){const o=`<template shadowrootmode="${e.mode}"`,i=[];e.clonable&&i.push(' shadowrootclonable=""'),e.serializable&&i.push(' shadowrootserializable=""'),e.delegatesFocus&&i.push(' shadowrootdelegatesfocus=""');return(0===i.length?o+">":o+" "+i.join("")+">")+ne(e,{serializableShadowRoots:t,shadowRoots:r,[te]:n})+"</template>"}return ne(e,{serializableShadowRoots:t,shadowRoots:r,[te]:n})}function ie(e){const t=(new DOMParser).parseFromString(e,"text/html"),r=document.createDocumentFragment();r.append(...t.body.childNodes),r.querySelectorAll("* > template[shadowrootmode]").forEach(re),this.replaceChildren(r)}function ae({serializableShadowRoots:e=!1,shadowRoots:t=[],[te]:r=[]}={}){switch(e&&0===r.length&&0!==t.length&&r.push(...t.map(e=>e.host)),this.nodeType){case Node.ELEMENT_NODE:if(e&&this.shadowRoot instanceof ShadowRoot&&(this.shadowRoot.serializable||t.includes(this.shadowRoot)))return this.shadowRoot.getHTML({serializableShadowRoots:e,shadowRoots:t,[te]:r})+ne(this,{serializableShadowRoots:e,shadowRoots:t,[te]:r});if(e&&r.includes(this)){return oe(t.find(e=>e.host.isSameNode(this)),{serializableShadowRoots:e,shadowRoots:t,[te]:r})+ne(this,{serializableShadowRoots:e,shadowRoots:t,[te]:r})}return this.innerHTML;case Node.DOCUMENT_FRAGMENT_NODE:return this instanceof ShadowRoot?e&&(this.serializable||t.includes(this))?oe(this,{serializableShadowRoots:e,shadowRoots:t,[te]:r}):ne(this,{serializableShadowRoots:e,shadowRoots:t,[te]:r}):"";default:throw new TypeError("'getHTML' called on an object that does not implement interface Element.")}}function se(e){for(;e.cssRules.length>0;)e.deleteRule(0)}c(Document.prototype,"adoptedStyleSheets",ee),l(Document,"parseHTMLUnsafe",function(e){const t=new DOMParser,r=document.implementation.createHTMLDocument(),n=t.parseFromString(e,"text/html");return r.head.append(...n.head.childNodes),r.body.append(...n.body.childNodes),r.querySelectorAll("* > template[shadowrootmode]").forEach(re),r}),"ShadowRoot"in globalThis&&(c(ShadowRoot.prototype,"adoptedStyleSheets",ee),l(ShadowRoot.prototype,"setHTMLUnsafe",ie),l(ShadowRoot.prototype,"getHTML",ae));try{new CSSStyleSheet}catch{const gt=globalThis.CSSStyleSheet;globalThis.CSSStyleSheet=function({disabled:e=!1,media:t}={}){const r=function(e="",{disabled:t=!1,media:r}={}){const n=Document.parseHTML(`<style>${e}</style>`,{sanitizer:{allowElements:["style","html","head","body"]}}).styleSheets.item(0);return"string"==typeof r&&n.media.appendMedium(r),n.disabled=t,n}("#dfgbkjdfg{color:red;}",{disabled:e,media:t});return r.deleteRule(0),r},globalThis.CSSStyleSheet.prototype=gt.prototype,gt.prototype.constructor=globalThis.CSSStyleSheet}CSSStyleSheet.prototype.replace instanceof Function||(CSSStyleSheet.prototype.replace=function(e){const t=document.createElement("link"),r=new AbortController,{resolve:n,reject:o,promise:i}=Promise.withResolvers();return t.addEventListener("load",({target:e})=>{se(this),[...e.sheet.cssRules].forEach((e,t)=>this.insertRule(e.cssText,t)),n(this),r.abort(),URL.revokeObjectURL(e.href),e.remove()},{once:!0,signal:r.signal}),t.addEventListener("error",({target:e})=>{const t=new DOMException("Error loading stylesheet.");o(t),r.abort(t),URL.revokeObjectURL(e.href),e.remove()},{once:!0,signal:r.signal}),t.rel="stylesheet",t.crossOrigin="anonymous",t.referrerPolicy="no-referrer",t.media="no-op",t.href=URL.createObjectURL(new File([e],"tmp.css",{type:"text/css"})),document.head.append(t),i}),CSSStyleSheet.prototype.replaceSync instanceof Function||(CSSStyleSheet.prototype.replaceSync=function(e){const t=Document.parseHTML(`<style>${e}</style>`,{sanitizer:{allowElements:["style","html","head","body"]}}).styleSheets.item(0);se(this),[...t.cssRules].forEach((e,t)=>this.insertRule(e.cssText,t))});const le={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"},ce="http://www.w3.org/1999/xhtml",ue="http://www.w3.org/2000/svg",pe="http://www.w3.org/1999/xlink",he="http://www.w3.org/1998/Math/MathML",fe=new Set(("HTMLElement"in globalThis?Object.keys(HTMLElement.prototype):[]).filter(e=>e.startsWith("on")));
|
|
26
|
+
*/("HTMLElement"in globalThis&&!("trustedTypes"in globalThis)||"HTMLElement"in globalThis&&globalThis.trustedTypes[Symbol.for("polyfilled")]&&globalThis.trustedTypes[Symbol.for("enforced")])&&function(){function e(){return"trustedTypes"in globalThis}function t(){return e()&&!Object.is(trustedTypes.defaultPolicy,null)}function r(r){if(function(t){return e()&&trustedTypes.isHTML(t)}(r)||!e())return r;if(t())return trustedTypes.defaultPolicy.createHTML(r);throw new TypeError("Attempting to set HTML and no default policy is available.")}function n(r){if(function(t){return e()&&trustedTypes.isScript(t)}(r)||!e())return r;if(t())return trustedTypes.defaultPolicy.createScript(r);throw new TypeError("Attempting to create script and no default policy is available.")}function o(r){if(function(t){return e()&&trustedTypes.isScriptURL(t)}(r)||!e())return r;if(t())return trustedTypes.defaultPolicy.createScriptURL(r);throw new TypeError("Attempting to create script URL and no default policy is available.")}function i(t,r,n){return e()?trustedTypes.getAttributeType(t,r,n):null}try{const{write:e,writeln:t,execCommand:n}=Object.getOwnPropertyDescriptors(Document.prototype);Object.defineProperties(Document.prototype,{write:{value:function(t){e.value.call(this,r(t))},enumerable:e.enumerable,configurable:e.configurable,writable:e.writable},writeln:{value:function(e){t.value.call(this,r(e))},enumerable:t.enumerable,configurable:t.configurable,writable:t.writable},execCommand:{value:function(e,t,o){return["insertHTML"].includes(e)?n.value.call(this,e,t,r(o)):n.value.call(this,e,t,o)},enumerable:n.enumerable,configurable:n.configurable}})}catch(e){console.error(e)}if("ServiceWorkerContainer"in globalThis)try{const e=Object.getOwnPropertyDescriptor(ServiceWorkerContainer.prototype,"register");Object.defineProperty(ServiceWorkerContainer.prototype,"register",{value:function(t,r){return e.value.call(this,o(t),r)},enumerable:e.enumerable,configurable:e.configurable})}catch(e){console.error(e)}try{const e=Object.getOwnPropertyDescriptor(Range.prototype,"createContextualFragment");Object.defineProperty(Range.prototype,"createContextualFragment",{value:function(t){return e.value.call(this,r(t))},enumerable:e.enumerable,configurable:e.configurable})}catch(e){console.error(e)}try{const{parseFromString:e}=Object.getOwnPropertyDescriptors(DOMParser.prototype);Object.defineProperties(DOMParser.prototype,{parseFromString:{value:function(t,n){return"text/html"===n?e.value.call(this,r(t),n):e.value.call(this,t,n)},enumerable:e.enumerable,configurable:e.configurable,writable:e.writable}})}catch(e){console.error(e)}try{const{src:e,text:t}=Object.getOwnPropertyDescriptors(HTMLScriptElement.prototype);Object.defineProperties(HTMLScriptElement.prototype,{text:{get:function(){return t.get.call(this)},set:function(e){t.set.call(this,n(e))},enumerable:t.enumerable,configurable:t.configurable},src:{get:function(){return e.get.call(this)},set:function(t){e.set.call(this,o(t))},enumerable:e.enumerable,configurable:e.configurable}})}catch(e){console.error(e)}try{const{setAttribute:e,setAttributeNS:t,innerHTML:a,outerHTML:s,insertAdjacentHTML:l}=Object.getOwnPropertyDescriptors(Element.prototype);Object.defineProperties(Element.prototype,{setAttribute:{value:function(t,a){switch(i(this.tagName,t)){case"TrustedHTML":e.value.call(this,t,r(a));break;case"TrustedScript":e.value.call(this,t,n(a));break;case"TrustedScriptURL":e.value.call(this,t,o(a));break;default:e.value.call(this,t,a)}},enumerable:e.enumerable,configurable:e.configurable},setAttributeNS:{value:function(e,a,s){switch(i(this.tagName,a,e)){case"TrustedHTML":t.value.call(this,e,a,r(s));break;case"TrustedScript":t.value.call(this,e,a,n(s));break;case"TrustedScriptURL":t.value.call(this,e,a,o(s));break;default:t.value.call(this,e,a,s)}},enumerable:t.enumerable,configurable:t.configurable},innerHTML:{get:function(){return a.get.call(this)},set:function(e){a.set.call(this,r(e))},enumerable:a.enumerable,configurable:a.configurable},outerHTML:{get:function(){return s.get.call(this)},set:function(e){s.set.call(this,r(e))},enumerable:s.enumerable,configurable:s.configurable},insertAdjacentHTML:{value:function(e,t){l.value.call(this,e,r(t))},enumerable:l.enumerable,configurable:l.configurable}})}catch(e){console.error(e)}try{const{srcdoc:e,src:t}=Object.getOwnPropertyDescriptors(HTMLIFrameElement.prototype);Object.defineProperties(HTMLIFrameElement.prototype,{srcdoc:{get:function(){return e.get.call(this)},set:function(t){e.set.call(this,r(t))},enumerable:e.enumerable,configurable:e.configurable},src:{get:function(){return t.get.call(this)},set:function(e){t.set.call(this,o(e))},enumerable:t.enumerable,configurable:t.configurable}})}catch(e){console.error(e)}try{const{data:e,codeBase:t}=Object.getOwnPropertyDescriptors(HTMLObjectElement.prototype);Object.defineProperties(HTMLObjectElement.prototype,{data:{get:function(){return e.get.call(this)},set:function(t){e.set.call(this,o(t))},enumerable:e.enumerable,configurable:e.configurable},codeBase:{get:function(){return t.get.call(this)},set:function(e){t.set.call(this,o(e))},enumerable:t.enumerable,configurable:t.configurable}})}catch(e){console.error(e)}try{const{eval:e,setTimeout:t,setInterval:r}=globalThis;globalThis.eval=function(t){return e(n(t).toString())},globalThis.setTimeout=function(e,r,...o){return"string"==typeof e?t(n(e),r,...o):t(e,r,...o)},globalThis.setInterval=function(e,t,...o){return"string"==typeof e?r(n(e),t,...o):r(e,t,...o)};try{const e=globalThis.Function;globalThis.Function=function(...t){if(0===t.length)return e();{const r=n(t.pop());return e(...t,r.toString())}},globalThis.Function.prototype=e.prototype,e.prototype.constructor=globalThis.Function}catch(e){console.error(e)}}catch(e){console.error(e)}}();const ee={get(){return Array.from(this.styleSheets).filter(e=>e.ownerNode.classList.contains("_adopted"))},set(e){if(!Array.isArray(e))throw new TypeError("Must be an array");{const t=new Set(this.adoptedStyleSheets);t.difference(e).forEach(e=>e.ownerNode.remove());const r=[...new Set(e).difference(t)].map(e=>{const t=document.createElement("link"),r=new AbortController,n=r.signal,o=URL.createObjectURL(new File([],"adopted.css",{type:"text/css"}));return t.rel="stylesheet",t.href=o,t.classList.add("_adopted"),t.disabled=e.disabled,t.addEventListener("load",({target:n})=>{r.abort(),t.media=e.media.mediaText,[...e.cssRules].forEach((e,t)=>{n.sheet.insertRule(e.cssText,t)}),setTimeout(()=>URL.revokeObjectURL(n.href),100)},{once:!0,signal:n}),t.addEventListener("error",({target:e})=>{r.abort(),URL.revokeObjectURL(e.href)},{once:!0,signal:n}),t});this instanceof Document?this.head.append(...r):this.append(...r)}}},te=Symbol("shadow:hosts");function re(e){if(e instanceof HTMLTemplateElement&&e.parentElement instanceof HTMLElement){e.parentElement.attachShadow({mode:e.getAttribute("shadowrootmode"),clonable:e.hasAttribute("shadowrootclonable"),delegatesFocus:e.hasAttribute("shadowrootdelegatesfocus"),serializable:e.hasAttribute("shadowrootserializable")}).append(e.content),e.remove()}}function ne(e,{serializableShadowRoots:t=!1,shadowRoots:r=[],[te]:n=[]}={}){return Array.from(e.childNodes,e=>{if(e.nodeType===Node.ELEMENT_NODE){const[o,i]=function(e){const t=e.cloneNode().outerHTML,r=t.indexOf("/")-1;return r>0?[t.substring(0,r),t.substring(r)]:[t,""]}(e);return o+e.getHTML({serializableShadowRoots:t,shadowRoots:r,[te]:n})+i}return e.textContent}).join("")}function oe(e,{serializableShadowRoots:t,shadowRoots:r,[te]:n=[]}={}){if(e.serializable){const o=`<template shadowrootmode="${e.mode}"`,i=[];e.clonable&&i.push(' shadowrootclonable=""'),e.serializable&&i.push(' shadowrootserializable=""'),e.delegatesFocus&&i.push(' shadowrootdelegatesfocus=""');return(0===i.length?o+">":o+" "+i.join("")+">")+ne(e,{serializableShadowRoots:t,shadowRoots:r,[te]:n})+"</template>"}return ne(e,{serializableShadowRoots:t,shadowRoots:r,[te]:n})}function ie(e){const t=(new DOMParser).parseFromString(e,"text/html"),r=document.createDocumentFragment();r.append(...t.body.childNodes),r.querySelectorAll("* > template[shadowrootmode]").forEach(re),this.replaceChildren(r)}function ae({serializableShadowRoots:e=!1,shadowRoots:t=[],[te]:r=[]}={}){switch(e&&0===r.length&&0!==t.length&&r.push(...t.map(e=>e.host)),this.nodeType){case Node.ELEMENT_NODE:if(e&&this.shadowRoot instanceof ShadowRoot&&(this.shadowRoot.serializable||t.includes(this.shadowRoot)))return this.shadowRoot.getHTML({serializableShadowRoots:e,shadowRoots:t,[te]:r})+ne(this,{serializableShadowRoots:e,shadowRoots:t,[te]:r});if(e&&r.includes(this)){return oe(t.find(e=>e.host.isSameNode(this)),{serializableShadowRoots:e,shadowRoots:t,[te]:r})+ne(this,{serializableShadowRoots:e,shadowRoots:t,[te]:r})}return this.innerHTML;case Node.DOCUMENT_FRAGMENT_NODE:return this instanceof ShadowRoot?e&&(this.serializable||t.includes(this))?oe(this,{serializableShadowRoots:e,shadowRoots:t,[te]:r}):ne(this,{serializableShadowRoots:e,shadowRoots:t,[te]:r}):"";default:throw new TypeError("'getHTML' called on an object that does not implement interface Element.")}}function se(e){for(;e.cssRules.length>0;)e.deleteRule(0)}c(Document.prototype,"adoptedStyleSheets",ee),l(Document,"parseHTMLUnsafe",function(e){const t=new DOMParser,r=document.implementation.createHTMLDocument(),n=t.parseFromString(e,"text/html");return r.head.append(...n.head.childNodes),r.body.append(...n.body.childNodes),r.querySelectorAll("* > template[shadowrootmode]").forEach(re),r}),"ShadowRoot"in globalThis&&(c(ShadowRoot.prototype,"adoptedStyleSheets",ee),l(ShadowRoot.prototype,"setHTMLUnsafe",ie),l(ShadowRoot.prototype,"getHTML",ae));try{new CSSStyleSheet}catch{const gt=globalThis.CSSStyleSheet;globalThis.CSSStyleSheet=function({disabled:e=!1,media:t}={}){const r=function(e="",{disabled:t=!1,media:r}={}){const n=Document.parseHTML(`<style>${e}</style>`,{sanitizer:{allowElements:["style","html","head","body"]}}).styleSheets.item(0);return"string"==typeof r&&n.media.appendMedium(r),n.disabled=t,n}("#dfgbkjdfg{color:red;}",{disabled:e,media:t});return r.deleteRule(0),r},globalThis.CSSStyleSheet.prototype=gt.prototype,gt.prototype.constructor=globalThis.CSSStyleSheet}CSSStyleSheet.prototype.replace instanceof Function||(CSSStyleSheet.prototype.replace=function(e){const t=document.createElement("link"),r=new AbortController,{resolve:n,reject:o,promise:i}=Promise.withResolvers();return t.addEventListener("load",({target:e})=>{se(this),[...e.sheet.cssRules].forEach((e,t)=>this.insertRule(e.cssText,t)),n(this),r.abort(),URL.revokeObjectURL(e.href),e.remove()},{once:!0,signal:r.signal}),t.addEventListener("error",({target:e})=>{const t=new DOMException("Error loading stylesheet.");o(t),r.abort(t),URL.revokeObjectURL(e.href),e.remove()},{once:!0,signal:r.signal}),t.rel="stylesheet",t.crossOrigin="anonymous",t.referrerPolicy="no-referrer",t.media="no-op",t.href=URL.createObjectURL(new File([e],"tmp.css",{type:"text/css"})),document.head.append(t),i}),CSSStyleSheet.prototype.replaceSync instanceof Function||(CSSStyleSheet.prototype.replaceSync=function(e){const t=Document.parseHTML(`<style>${e}</style>`,{sanitizer:{allowElements:["style","html","head","body"]}}).styleSheets.item(0);se(this),[...t.cssRules].forEach((e,t)=>this.insertRule(e.cssText,t))});const le={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"},ce="http://www.w3.org/1999/xhtml",ue="http://www.w3.org/1999/xlink",pe="http://www.w3.org/1998/Math/MathML",he=new Set(("HTMLElement"in globalThis?Object.keys(HTMLElement.prototype):[]).filter(e=>e.startsWith("on")));
|
|
27
27
|
/**
|
|
28
28
|
* @copyright 2023-2024 Chris Zuber <admin@kernvalley.us>
|
|
29
|
-
*/function de(e,t=ce){if("string"==typeof e)return Object.freeze({name:e,namespace:t});if("object"==typeof e&&"string"==typeof e.name){const{name:r,namespace:n=t,attributes:o}=e;return Object.freeze({name:r,namespace:"string"==typeof n&&0!==n.length?n:t,attributes:o})}throw new TypeError("Invalid config entry for `elements`.")}function me({elements:e,allowElements:t},r=ce){if(Array.isArray(t))return console.warn("Use of `allowElements` is deprecated. Please use `elements` instead."),me({elements:t},r);if(Array.isArray(e))return e.map(e=>de(e,r));throw new TypeError("`elements` expected to be an array.")}function ge(e,t){if("string"==typeof e)return Object.freeze({name:e,namespace:t});if("object"==typeof e&&"string"==typeof e.name){const{name:r,namespace:n=t,elements:o,...i}=e;return Object.freeze({name:r,namespace:"string"==typeof n?n:t,elements:o,...i})}throw new TypeError("Invalid entry in `attributes` config.")}function be({attributes:e,allowAttributes:t},r){if(void 0!==t)return console.warn("Use of `allowAttributes` is deprecated. Please use `attributes` instead."),be({attributes:t},r);if(Array.isArray(e))return e.map(e=>ge(e,r));if("object"==typeof e&&null!==e)return console.warn("`attributes` should be an array, not an oobject."),be({attributes:Object.entries(e).map(([e,t])=>({name:e,elements:t}))},r);throw new TypeError("`attributes` expected to be an array.")}function ye({comments:e,allowComments:t}){return"boolean"==typeof t?(console.warn("Use of `allowComments` is deprecated. Please use `comments` instead."),t):"boolean"!=typeof e||e}function we({attributes:e,allowAttributes:t},r){return Object.freeze(Object.groupBy(be({attributes:e,allowAttributes:t},r),({namespace:e})=>e??""))}function ve({elements:e,allowElements:t},r=ce){return Object.freeze(Object.groupBy(me({elements:e,allowElements:t},r),({namespace:e})=>e))}function Te(e,{elementNS:t=ce,attributeNS:r}={}){if("object"!=typeof e||null===e)throw new TypeError("Sanitizer config must be an object.");return e.get instanceof Function?Te(e.get()):Object.freeze({elements:ve(e,t),attributes:we(e,r),comments:ye(e),dataAttributes:void 0===e.dataAttributes||e.dataAttributes})}const Ee=Object.freeze(["accesskey","autocapitalize","autofocus","class","contenteditable","dir","draggable","enterkeyhint","exportparts","hidden","id","inert","inputmode","itemid","itemprop","itemref","itemscope","itemtype","lang","part","popover","slot","spellcheck","tabindex","title","translate","virtualkeyboardpolicy","aria-keyshortcuts","aria-activedescendant","aria-atomic","aria-autocomplete","aria-braillelabel","aria-brailleroledescription","aria-busy","aria-checked","aria-colcount","aria-colindex","aria-colindextext","aria-colspan","aria-controls","aria-current","aria-describedby","aria-description","aria-details","aria-disabled","aria-dropeffect","aria-errormessage","aria-expanded","aria-flowto","aria-grabbed","aria-haspopup","aria-hidden","aria-invalid","aria-label","aria-labelledby","aria-level","aria-live","aria-modal","aria-multiline","aria-multiselectable","aria-orientation","aria-owns","aria-placeholder","aria-posinset","aria-pressed","aria-readonly","aria-relevant","aria-required","aria-roledescription","aria-rowcount","aria-rowindex","aria-rowindextext","aria-rowspan","aria-selected","aria-setsize","aria-sort","aria-valuemax","aria-valuemin","aria-valuenow","aria-valuetext"].map(e=>ge(e,null))),Se=Object.freeze(["html","head","link","meta","body","address","`article","aside","footer","header","h1","h2","h3","h4","h5","h6","hgroup","main","nav","section","search","blockquote","cite","div","dd","dt","dl","figcaption","figure","hr","li","ol","ul","menu","p","pre","a","abbr","b","bdi","bdo","br","code","data","dfn","em","i","kbd","mark","q","rp","ruby","rt","s","del","ins","samp","small","span","strong","sub","sup","time","u","var","wbr","area","audio","img","map","track","video","picture","source","canvas","caption","col","colgroup","table","tbody","tr","td","tfoot","th","thead","button","datalist","option","fieldset","label","form","input","legend","meter","optgroup","select","output","progress","textarea","details","summary","dialog","slot","template","dir","strike","selectmenu","center"].map(e=>de(e,ce))),Ae=Object.freeze(["abbr","accept","accept-charset","align","alink","allow","allowfullscreen","alt","anchor","archive","as","async","autocomplete","autocorrect","autopictureinpicture","autoplay","axis","background","behavior","border","bordercolor","capture","cellpadding","cellspacing","challenge","char","charoff","charset","checked","cite","classid","clear","code","codetype","color","cols","colspan","command","commandfor","compact","content","controls","controlslist","conversiondestination","coords","crossorigin","csp","data","datetime","declare","decoding","default","defer","direction","dirname","disabled","disablepictureinpicture","disableremoteplayback","disallowdocumentaccess","download","elementtiming","enctype","end","for","form","formenctype","formmethod","formnovalidate","formtarget","frameborder","headers","height","high","href","hreflang","hreftranslate","hspace","imagesizes","imagesrcset","importance","impressiondata","impressionexpiry","incremental","integrity","invisible","is","ismap","keytype","kind","label","language","latencyhint","leftmargin","link","list","loading","longdesc","loop","low","lowsrc","manifest","marginheight","marginwidth","max","maxlength","mayscript","media","method","min","minlength","multiple","muted","name","nohref","nomodule","noresize","noshade","novalidate","nowrap","object","open","optimum","pattern","ping","placeholder","playsinline","policy","popovertarget","popovertargetaction","poster","preload","pseudo","readonly","referrerpolicy","rel","reportingorigin","required","resources","rev","reversed","role","rows","rowspan","rules","sandbox","scheme","scope","scopes","scrollamount","scrolldelay","scrolling","select","selected","shadowrootclonable","shadowrootdelegatesfocus","shadowrootmode","shadowrootserializable","shape","size","sizes","span","src","srcdoc","srclang","srcset","standby","start","step","summary","target","text","topmargin","truespeed","trusttoken","type","usemap","valign","value","valuetype","version","vlink","vspace","webkitdirectory","width","wrap"].map(e=>ge(e,null)).concat(Ee)),xe=Object.freeze({comments:!0,elements:Se,attributes:Ae,dataAttributes:!0}),Me=Object.freeze(["a","animate","animateMotion","animateTransform","circle","clipPath","defs","desc","ellipse","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","filter","foreignObject","g","line","linearGradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialGradient","rect","script","set","stop","style","svg","switch","symbol","text","textPath","title","tspan","view","missing-glyph","font","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","hkern","vkern","glyph","glyphRef","tref","cursor","use"].map(e=>de(e,ue))),Le=Object.freeze(["accent-height","accumulate","additive","alignment-baseline","alphabetic","amplitude","arabic-form","ascent","attributeName","attributeType","azimuth","baseFrequency","baseline-shift","baseProfile","bbox","begin","bias","by","calcMode","cap-height","class","clip","clipPathUnits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","crossorigin","cursor","cx","cy","d","decelerate","descent","diffuseConstant","direction","display","divisor","dominant-baseline","dur","dx","dy","edgeMode","elevation","enable-background","end","exponent","fill","fill-opacity","fill-rule","filter","filterUnits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","format","from","fr","fx","fy","g1","g2","glyph-name","glyph-orientation-horizontal","glyph-orientation-vertical","glyphRef","gradientTransform","gradientUnits","hanging","height","href","hreflang","horiz-adv-x","horiz-origin-x","id","ideographic","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kernelMatrix","kernelUnitLength","kerning","keyPoints","keySplines","keyTimes","lang","lengthAdjust","letter-spacing","lighting-color","limitingConeAngle","local","marker-end","marker-mid","marker-start","markerHeight","markerUnits","markerWidth","mask","maskContentUnits","maskUnits","mathematical","max","media","method","min","mode","name","numOctaves","offset","opacity","operator","order","orient","orientation","origin","overflow","overline-position","overline-thickness","panose-1","paint-order","path","pathLength","patternContentUnits","patternTransform","patternUnits","ping","pointer-events","points","pointsAtX","pointsAtY","pointsAtZ","preserveAlpha","preserveAspectRatio","primitiveUnits","r","radius","referrerPolicy","refX","refY","rel","rendering-intent","repeatCount","repeatDur","requiredExtensions","requiredFeatures","restart","result","rotate","rx","ry","scale","seed","shape-rendering","slope","spacing","specularConstant","specularExponent","speed","spreadMethod","startOffset","stdDeviation","stemh","stemv","stitchTiles","stop-color","stop-opacity","strikethrough-position","strikethrough-thickness","string","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","style","surfaceScale","systemLanguage","tabindex","tableValues","target","targetX","targetY","text-anchor","text-decoration","text-rendering","textLength","to","transform","transform-origin","type","u1","u2","underline-position","underline-thickness","unicode","unicode-bidi","unicode-range","units-per-em","v-alphabetic","v-hanging","v-ideographic","v-mathematical","values","vector-effect","version","vert-adv-y","vert-origin-x","vert-origin-y","viewBox","visibility","width","widths","word-spacing","writing-mode","x","x-height","x1","x2","xChannelSelector","y","y1","y2","yChannelSelector","z","zoomAndPan","autoReverse","accelerate","xmlns",{name:"actuate",namespace:pe},{name:"arcrole",namespaec:pe},{name:"href",namespace:pe},{name:"role",namespace:pe},{name:"show",namespace:pe},{name:"title",namespace:pe},{name:"type",namespace:pe},{name:"space",namespace:"http://www.w3.org/XML/1998/namespace"}].map(e=>ge(e,ue))).concat(Ee),ke=Object.freeze(["math","maction","annotation","annotation-xml","menclose","merror","mfenced","mfrac","mi","mmultiscripts","mn","mo","mover","mpadded","mphantom","mprescripts","mroot","mrow","ms","semantics","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover"].map(e=>de(e,he))),Oe=Object.freeze(["accent","accentunder","actiontype","align","background","close","color","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","fence","fontfamily","fontsize","fontstyle","fontweight","frame","framespacing","height","href","id","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","superscriptshift","symmetric","voffset","width","xmlns"].map(e=>ge(e,he)).concat(Ee));
|
|
29
|
+
*/function fe(e,t=ce){if("string"==typeof e)return Object.freeze({name:e,namespace:t});if("object"==typeof e&&"string"==typeof e.name){const{name:r,namespace:n=t,attributes:o}=e;return Object.freeze({name:r,namespace:"string"==typeof n&&0!==n.length?n:t,attributes:o})}throw new TypeError("Invalid config entry for `elements`.")}function de({elements:e,allowElements:t},r=ce){if(Array.isArray(t))return console.warn("Use of `allowElements` is deprecated. Please use `elements` instead."),de({elements:t},r);if(Array.isArray(e))return e.map(e=>fe(e,r));throw new TypeError("`elements` expected to be an array.")}function me(e,t){if("string"==typeof e)return Object.freeze({name:e,namespace:t});if("object"==typeof e&&"string"==typeof e.name){const{name:r,namespace:n=t,elements:o,...i}=e;return Object.freeze({name:r,namespace:"string"==typeof n?n:t,elements:o,...i})}throw new TypeError("Invalid entry in `attributes` config.")}function ge({attributes:e,allowAttributes:t},r){if(void 0!==t)return console.warn("Use of `allowAttributes` is deprecated. Please use `attributes` instead."),ge({attributes:t},r);if(Array.isArray(e))return e.map(e=>me(e,r));if("object"==typeof e&&null!==e)return console.warn("`attributes` should be an array, not an oobject."),ge({attributes:Object.entries(e).map(([e,t])=>({name:e,elements:t}))},r);throw new TypeError("`attributes` expected to be an array.")}function be({comments:e,allowComments:t}){return"boolean"==typeof t?(console.warn("Use of `allowComments` is deprecated. Please use `comments` instead."),t):"boolean"!=typeof e||e}function ye({attributes:e,allowAttributes:t},r){return Object.freeze(Object.groupBy(ge({attributes:e,allowAttributes:t},r),({namespace:e})=>e??""))}function we({elements:e,allowElements:t},r=ce){return Object.freeze(Object.groupBy(de({elements:e,allowElements:t},r),({namespace:e})=>e))}function ve(e,{elementNS:t=ce,attributeNS:r}={}){if("object"!=typeof e||null===e)throw new TypeError("Sanitizer config must be an object.");return e.get instanceof Function?ve(e.get()):Object.freeze({elements:we(e,t),attributes:ye(e,r),comments:be(e),dataAttributes:void 0===e.dataAttributes||e.dataAttributes})}const Te=Object.freeze(["accesskey","autocapitalize","autofocus","class","contenteditable","dir","draggable","enterkeyhint","exportparts","hidden","id","inert","inputmode","itemid","itemprop","itemref","itemscope","itemtype","lang","part","popover","slot","spellcheck","tabindex","title","translate","virtualkeyboardpolicy","aria-keyshortcuts","aria-activedescendant","aria-atomic","aria-autocomplete","aria-braillelabel","aria-brailleroledescription","aria-busy","aria-checked","aria-colcount","aria-colindex","aria-colindextext","aria-colspan","aria-controls","aria-current","aria-describedby","aria-description","aria-details","aria-disabled","aria-dropeffect","aria-errormessage","aria-expanded","aria-flowto","aria-grabbed","aria-haspopup","aria-hidden","aria-invalid","aria-label","aria-labelledby","aria-level","aria-live","aria-modal","aria-multiline","aria-multiselectable","aria-orientation","aria-owns","aria-placeholder","aria-posinset","aria-pressed","aria-readonly","aria-relevant","aria-required","aria-roledescription","aria-rowcount","aria-rowindex","aria-rowindextext","aria-rowspan","aria-selected","aria-setsize","aria-sort","aria-valuemax","aria-valuemin","aria-valuenow","aria-valuetext"].map(e=>me(e,null))),Ee=Object.freeze(["html","head","link","meta","body","address","`article","aside","footer","header","h1","h2","h3","h4","h5","h6","hgroup","main","nav","section","search","blockquote","cite","div","dd","dt","dl","figcaption","figure","hr","li","ol","ul","menu","p","pre","a","abbr","b","bdi","bdo","br","code","data","dfn","em","i","kbd","mark","q","rp","ruby","rt","s","del","ins","samp","small","span","strong","sub","sup","time","u","var","wbr","area","audio","img","map","track","video","picture","source","canvas","caption","col","colgroup","table","tbody","tr","td","tfoot","th","thead","button","datalist","option","fieldset","label","form","input","legend","meter","optgroup","select","output","progress","textarea","details","summary","dialog","slot","template","dir","strike","selectmenu","center"].map(e=>fe(e,ce))),Se=Object.freeze(["abbr","accept","accept-charset","align","alink","allow","allowfullscreen","alt","anchor","archive","as","async","autocomplete","autocorrect","autopictureinpicture","autoplay","axis","background","behavior","border","bordercolor","capture","cellpadding","cellspacing","challenge","char","charoff","charset","checked","cite","classid","clear","code","codetype","color","cols","colspan","command","commandfor","compact","content","controls","controlslist","conversiondestination","coords","crossorigin","csp","data","datetime","declare","decoding","default","defer","direction","dirname","disabled","disablepictureinpicture","disableremoteplayback","disallowdocumentaccess","download","elementtiming","enctype","end","for","form","formenctype","formmethod","formnovalidate","formtarget","frameborder","headers","height","high","href","hreflang","hreftranslate","hspace","imagesizes","imagesrcset","importance","impressiondata","impressionexpiry","incremental","integrity","invisible","is","ismap","keytype","kind","label","language","latencyhint","leftmargin","link","list","loading","longdesc","loop","low","lowsrc","manifest","marginheight","marginwidth","max","maxlength","mayscript","media","method","min","minlength","multiple","muted","name","nohref","nomodule","noresize","noshade","novalidate","nowrap","object","open","optimum","pattern","ping","placeholder","playsinline","policy","popovertarget","popovertargetaction","poster","preload","pseudo","readonly","referrerpolicy","rel","reportingorigin","required","resources","rev","reversed","role","rows","rowspan","rules","sandbox","scheme","scope","scopes","scrollamount","scrolldelay","scrolling","select","selected","shadowrootclonable","shadowrootdelegatesfocus","shadowrootmode","shadowrootserializable","shape","size","sizes","span","src","srcdoc","srclang","srcset","standby","start","step","summary","target","text","topmargin","truespeed","trusttoken","type","usemap","valign","value","valuetype","version","vlink","vspace","webkitdirectory","width","wrap"].map(e=>me(e,null))),Ae=Object.freeze(Se.concat(Te)),Me=Object.freeze({comments:!0,elements:Ee,attributes:Ae,dataAttributes:!0}),xe=Object.freeze(["a","animate","animateMotion","animateTransform","circle","clipPath","defs","desc","ellipse","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","filter","foreignObject","g","line","linearGradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialGradient","rect","script","set","stop","style","svg","switch","symbol","text","textPath","title","tspan","view","missing-glyph","font","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","hkern","vkern","glyph","glyphRef","tref","cursor","use"].map(e=>fe(e,"http://www.w3.org/2000/svg"))),Le=Object.freeze(["accent-height","accumulate","additive","alignment-baseline","alphabetic","amplitude","arabic-form","ascent","attributeName","attributeType","azimuth","baseFrequency","baseline-shift","baseProfile","bbox","begin","bias","by","calcMode","cap-height","clip","clipPathUnits","clip-path","clip-rule","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cursor","cx","cy","d","decelerate","descent","diffuseConstant","display","divisor","dominant-baseline","dur","dx","dy","edgeMode","elevation","enable-background","exponent","fill","fill-opacity","fill-rule","filter","filterUnits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","format","from","fr","fx","fy","g1","g2","glyph-name","glyph-orientation-horizontal","glyph-orientation-vertical","glyphRef","gradientTransform","gradientUnits","hanging","horiz-adv-x","horiz-origin-x","ideographic","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kernelMatrix","kernelUnitLength","kerning","keyPoints","keySplines","keyTimes","lengthAdjust","letter-spacing","lighting-color","limitingConeAngle","local","marker-end","marker-mid","marker-start","markerHeight","markerUnits","markerWidth","mask","maskContentUnits","maskUnits","mathematical","mode","numOctaves","offset","opacity","operator","order","orient","orientation","origin","overflow","overline-position","overline-thickness","panose-1","paint-order","path","pathLength","patternContentUnits","patternTransform","patternUnits","pointer-events","points","pointsAtX","pointsAtY","pointsAtZ","preserveAlpha","preserveAspectRatio","primitiveUnits","r","radius","refX","refY","rendering-intent","repeatCount","repeatDur","requiredExtensions","requiredFeatures","restart","result","rotate","rx","ry","scale","seed","shape-rendering","slope","spacing","specularConstant","specularExponent","speed","spreadMethod","startOffset","stdDeviation","stemh","stemv","stitchTiles","stop-color","stop-opacity","strikethrough-position","strikethrough-thickness","string","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","surfaceScale","systemLanguage","tableValues","targetX","targetY","text-anchor","text-decoration","text-rendering","textLength","to","transform","transform-origin","u1","u2","underline-position","underline-thickness","unicode","unicode-bidi","unicode-range","units-per-em","v-alphabetic","v-hanging","v-ideographic","v-mathematical","values","vector-effect","vert-adv-y","vert-origin-x","vert-origin-y","viewBox","visibility","widths","word-spacing","writing-mode","x","x-height","x1","x2","xChannelSelector","y","y1","y2","yChannelSelector","z","zoomAndPan","autoReverse","accelerate","xmlns",{name:"actuate",namespace:ue},{name:"arcrole",namespaec:ue},{name:"href",namespace:ue},{name:"role",namespace:ue},{name:"show",namespace:ue},{name:"title",namespace:ue},{name:"type",namespace:ue},{name:"space",namespace:"http://www.w3.org/XML/1998/namespace"}].map(e=>"string"==typeof e?me(e):e));
|
|
30
30
|
/**
|
|
31
31
|
* @copyright 2023-2024 Chris Zuber <admin@kernvalley.us>
|
|
32
32
|
* @see https://wicg.github.io/sanitizer-api/#default-configuration-dictionary
|
|
33
|
-
*/Object.freeze(Array.from(new Set(Se).union(new Set(Me)))),Object.freeze(Array.from(new Set(Ae).union(new Set(Le)))),Object.freeze(Array.from(new Set(Se).union(new Set(Me)).union(new Set(ke)))),Object.freeze(Array.from(new Set(Ae).union(new Set(Le)).union(new Set(Oe))));const Pe=new Set(["href","src","action","xlink:href"]),Re=new Set(["javascript:","data:","file:","ftp:"]),Fe=function(e,{createHTML:t,createScript:r,createScriptURL:n}){return"trustedTypes"in globalThis?trustedTypes.createPolicy(e,{createHTML:t,createScript:r,createScriptURL:n}):Object.freeze({[Symbol.for("policy-name")]:e.toString(),createHTML(r,...n){if(t instanceof Function){const e=t(r.toString(),...n).toString();return Object.freeze({toString:()=>e})}throw new TypeError(`Policy "${e}" does not provide a createHTML method.`)},createScript(t,...n){if(r instanceof Function){const e=r(t.toString(),...n).toString();return Object.freeze({toString:()=>e})}throw new TypeError(`Policy "${e}" does not provide a createScript method.`)},createScriptURL(t,...r){if(n instanceof Function){const e=n(t.toString(),...r).toString();return Object.freeze({toString:()=>e})}throw new TypeError(`Policy "${e}" does not provide a createScriptURL method.`)}})}("aegis-sanitizer#html",{createHTML:e=>e});function Ce(e,t,{elements:r=xe.elements,attributes:n=xe.attributes,comments:o=xe.comments,dataAttributes:i=xe.dataAttributes,sanitizer:a,...s}=xe,{allowInsecure:l=!1}={}){const c=document.createElement("template");c.setHTMLUnsafe(Fe.createHTML(t)),Ie(c.content,{elements:r,attributes:n,comments:o,dataAttributes:i,sanitizer:a,...s},l),e.replaceChildren(c.content)}function je(e,{elements:t=xe.elements,attributes:r=xe.attributes,comments:n=xe.comments,dataAttributes:o=xe.dataAttributes,sanitizer:i,...a}=xe,{allowInsecure:s=!1}={}){const l=(new DOMParser).parseFromString(Fe.createHTML(e),"text/html");return Ie(l,{elements:t,attributes:r,comments:n,dataAttributes:o,sanitizer:i,...a},s),l}function Ie(e,t=xe,r=!1){if(e instanceof Node){return Ue(e,Te(t),r)}throw new TypeError("Not a node.")}const Ne="trustedTypes"in globalThis?e=>null!==trustedTypes.getAttributeType(e.ownerElement.tagName,e.localName,e.ownerElement.namespaceURI,e.namespaceURI):e=>fe.has(e.localName);function He(e,t,r=!1){const n=e.namespaceURI||"";return(!("dataAttributes"in t)||t.dataAttributes)&&e.name.startsWith("data-")||n in t.attributes&&t.attributes[n].some(t=>t.name===e.localName)&&!(r||Ne(e))&&!(r||function(e){if(Pe.has(e.name)){if(URL.canParse(e.value)){const{protocol:t}=new URL(e.value);return Re.has(t)}return!1}return!1}(e))}function Ue(e,t,r=!1){switch(e.nodeType){case Node.ELEMENT_NODE:!function(e,t,r){if(function(e,t){return e.namespaceURI in t.elements&&t.elements[e.namespaceURI].some(t=>t.name===e.localName)}(e,t)){if(e.hasAttributes()){const n=e.attributes;for(let e=n.length-1;-1!==e;e--)De(n[e],t,r)}if("TEMPLATE"===e.tagName)ze(e.content,t,r);else if(e.hasChildNodes()){const n=e.childNodes;for(let e=n.length-1;-1!==e;e--)Ue(n[e],t,r)}}else e.remove()}(e,t,r);break;case Node.DOCUMENT_NODE:case Node.DOCUMENT_FRAGMENT_NODE:ze(e,t,r);break;case Node.COMMENT_NODE:!function(e,t){t.comments||e.remove()}(e,t);break;case Node.ATTRIBUTE_NODE:De(e,t,r);break;case Node.TEXT_NODE:case Node.DOCUMENT_TYPE_NODE:break;default:e.ownerElement instanceof Element&&e.ownerElement.removeChild(e)}}function De(e,t,r=!1){!He(e,t,r)&&e.ownerElement instanceof Element&&e.ownerElement.removeAttributeNode(e)}function ze(e,t,r=!1){if(e.hasChildNodes()){const n=e.childNodes;for(let e=n.length-1;-1!==e;e--)Ue(n[e],t,r)}}if(Promise.withResolvers instanceof Function||(Promise.withResolvers=function(){const e={};return e.promise=new Promise((t,r)=>{e.resolve=t,e.reject=r}),e}),URL.canParse instanceof Function||(URL.canParse=function(e,t){try{return new URL(e,t),!0}catch{return!1}}),URL.parse instanceof Function||(URL.parse=function(e,t){try{return new URL(e,t)}catch{return null}}),Object.groupBy instanceof Function||(Object.groupBy=function(e,t){const r={};for(const n of e){const e=t(n);e in r?r[e].push(n):r[e]=[n]}return r}),Element.prototype.setHTML instanceof Function||(Element.prototype.setHTML=function(e,{elements:t,attributes:r,comments:n,dataAttributes:o,sanitizer:i,...a}={}){Ce(this,e,"object"==typeof i&&null!==i?i.getConfiguration instanceof Function?i.getConfiguration():i:{elements:t,attributes:r,comments:n,dataAttributes:o,...a})},DocumentFragment.prototype.setHTML=function(...e){Element.prototype.setHTML.apply(this,e)},HTMLTemplateElement.prototype.setHTML=function(e,t){this.content.setHTML(e,t)}),Document.parseHTML instanceof Function||(Document.parseHTML=function(e,{elements:t,attributes:r,comments:n,dataAttributes:o,sanitizer:i,...a}={}){return"object"==typeof i&&null!==i?Document.parseHTML(e,i.getConfiguration instanceof Function?i.getConfiguration():i):je(e,{elements:t,attributes:r,comments:n,dataAttributes:o,...a})}),!("command"in HTMLButtonElement.prototype)){const bt=Symbol("command:for"),yt={passive:!0};Object.defineProperty(HTMLButtonElement.prototype,"command",{get(){return this.getAttribute("command")},set(e){"string"==typeof e?this.setAttribute("command",e):this.removeAttribute("command")}}),Object.defineProperty(HTMLButtonElement.prototype,"commandForElement",{get(){return this[bt]instanceof Element?this[bt]:this.hasAttribute("commandfor")?document.getElementById(this.getAttribute("commandfor")):null},set(e){e instanceof Element?0===e.id.length?(this.setAttribute("commandfor",""),this[bt]=e):(this.setAttribute("commandfor",e.id),this[bt]=null):(this.removeAttribute("commandfor"),this[bt]=null)}});class wt extends Event{#D=null;#z="";constructor(e,{source:t,command:r,bubbles:n,cancelable:o,composed:i}={}){super(e,{bubbles:n,cancelable:o,composed:i}),"string"==typeof r&&(this.#z=r),t instanceof HTMLButtonElement&&(this.#D=t)}get command(){return this.#z}get source(){return this.#D}}function vt({currentTarget:e}){if(e instanceof HTMLButtonElement&&e.hasAttribute("command")&&e.hasAttribute("commandfor")){const t=e.commandForElement,r=e.command;if(t instanceof Element&&"string"==typeof r){const n=new wt("command",{command:r,source:e,cancelable:!0});if(t.dispatchEvent(n),!n.defaultPrevented)switch(r){case"show-modal":t instanceof HTMLDialogElement&&t.showModal();break;case"close":t instanceof HTMLDialogElement&&t.close();break;case"request-close":t instanceof HTMLDialogElement&&t.requestClose();break;case"show-popover":t.showPopover();break;case"hide-popover":t.hidePopover();break;case"toggle-popover":t.togglePopover()}}}}const Tt=new MutationObserver(e=>{for(const t of e)if("childList"===t.type){for(const e of t.addedNodes)if(e instanceof HTMLButtonElement&&e.hasAttribute("command")&&e.hasAttribute("commandfor"))e.addEventListener("click",vt,yt);else if(e instanceof Element)for(const t of e.querySelectorAll("button[command][commandfor]"))t.addEventListener("click",vt,yt)}else"attributes"===t.type&&t.target instanceof HTMLButtonElement&&typeof t.oldValue!=typeof t.target.getAttribute(t.attributeName)&&(t.target.hasAttribute("command")&&t.target.hasAttribute("commandfor")?t.target.addEventListener("click",vt,yt):t.target.removeEventListener("click",vt,yt))}),Et={childList:!0,subtree:!0,attributes:!0,attributeFilter:["command","commandfor"],attributeOldValue:!0};Tt.observe(document,Et),document.querySelectorAll("button").forEach(e=>e.addEventListener("click",vt,yt)),globalThis.CommandEvent=wt,globalThis[Symbol.for("polyfill-command")]=e=>Tt.observe(e,Et)}if(l(Element.prototype,"setHTMLUnsafe",ie),l(Element.prototype,"getHTML",ae),"CustomElementRegistry"in globalThis&&!(CustomElementRegistry.prototype.getName instanceof Function)){const St=new Map;u(CustomElementRegistry.prototype,"define",e=>(t,r,n)=>{e.call(customElements,t,r,n),St.set(r,"string"==typeof n.extends?n.extends:t)}),l(CustomElementRegistry.prototype,"getName",e=>{if("function"==typeof e)return St.get(e)??null;throw"object"==typeof e&&null!==e?new TypeError("CustomElementRegistry.getName: Argument 1 is not callable."):new TypeError("CustomElementRegistry.getName: Argument 1 is not an object.")})}function $e({currentTarget:e}){switch(e.popoverTargetAction){case"show":e.popoverTargetElement.showPopover();break;case"hide":e.popoverTargetElement.hidePopover();break;default:e.popoverTargetElement.togglePopover()}}if(!(globalThis.ToggleEvent instanceof Function)){class At extends Event{#$;#q;constructor(e,{newState:t,oldState:r}){super(e,{bubbles:!0}),this.#$=t,this.#q=r}get newState(){return this.#$}get oldState(){return this.#q}}globalThis.ToggleEvent=At}if(!(HTMLElement.prototype.showPopover instanceof Function)){const xt=e=>e.classList.contains("_popover-open");Object.defineProperties(HTMLElement.prototype,{showPopover:{value:function(){if(!xt(this)){if(this.dispatchEvent(new ToggleEvent("beforetoggle",{oldState:"closed",newState:"open"})),"auto"===this.getAttribute("popover")){const e=new AbortController;document.body.addEventListener("click",({target:t})=>{this.contains(t)||this.isSameNode(t.popoverTargetElement)||(e.abort(),this.hidePopover())},{signal:e.signal,capture:!0}),document.body.addEventListener("keydown",({key:t})=>{"Escape"===t&&(e.abort(),this.hidePopover())},{signal:e.signal,capture:!0}),document.addEventListener("beforetoggle",({target:t})=>{t.isSameNode(this)||"auto"!==t.getAttribute("popover")||(e.abort(),this.hidePopover())},{signal:e.signal})}this.classList.add("_popover-open"),this.dispatchEvent(new ToggleEvent("toggle",{oldState:"closed",newState:"open"}))}}},hidePopover:{value:function(){xt(this)&&(this.dispatchEvent(new ToggleEvent("beforetoggle",{oldState:"open",newState:"closed"})),queueMicrotask(()=>this.classList.remove("_popover-open")),this.dispatchEvent(new ToggleEvent("toggle",{oldState:"open",newState:"closed"})))}},togglePopover:{value:function(){xt(this)?this.hidePopover():this.showPopover()}}}),Object.defineProperties(HTMLButtonElement.prototype,{popoverTargetElement:{get(){return document.getElementById(this.getAttribute("popovertarget"))}},popoverTargetAction:{get(){return this.getAttribute("popovertargetaction")||"toggle"},set(e){this.setAttribute("popovertargetaction",e)}}}),function(e=document.body){e.querySelectorAll('button[popovertarget], input[type="button"][popovertarget]').forEach(e=>e.addEventListener("click",$e))}()}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(le.role)){const Mt=!0,Lt=!0,kt=Object.fromEntries(Object.entries(le).map(([e,t])=>[e,{get:function(){return this.getAttribute(t)},set:function(e){"string"==typeof e?this.setAttribute(t,e):this.removeAttribute(t)},enumerable:Mt,configurable:Lt}]));Object.defineProperties(Element.prototype,kt)}if(!HTMLElement.prototype.hasOwnProperty("inert")){const Ot=new WeakMap,Pt=e=>{Ot.has(e)&&(e.tabIndex=Ot.get(e)),e.hasChildNodes()&&[...e.children].forEach(Pt)},Rt=e=>{-1!==e.tabIndex&&(Ot.set(e,e.tabIndex),e.tabIndex=-1),e.hasChildNodes()&&[...e.children].forEach(Rt)};Object.defineProperty(HTMLElement.prototype,"inert",{get:function(){return this.hasAttribute("inert")},set:function(e){e?(this.setAttribute("aria-hidden","true"),this.setAttribute("inert",""),Rt(this)):(this.removeAttribute("aria-hidden"),this.removeAttribute("inert"),Pt(this))},enumerable:!0,configurable:!0})}if(HTMLImageElement.prototype.hasOwnProperty("complete")||Object.defineProperty(HTMLImageElement.prototype,"complete",{get:function(){return""===this.src||this.naturalHeight>0}}),HTMLImageElement.prototype.decode instanceof Function||(HTMLImageElement.prototype.decode=function(){return this.complete?Promise.resolve():new Promise((e,t)=>{const r=()=>{this.removeEventListener("error",n),this.removeEventListener("load",r),e()},n=e=>{this.removeEventListener("error",n),this.removeEventListener("load",r),t(e)};this.addEventListener("load",r),this.addEventListener("error",n)})}),!HTMLTemplateElement.prototype.hasOwnProperty("shadowRootMode")){const Ft=new WeakMap;c(HTMLTemplateElement.prototype,"shadowRootMode",{get(){return this.getAttribute("shadowrootmode")},set(e){this.setAttribute("shadowrootmode",e)}}),c(HTMLTemplateElement.prototype,"shadowRootDelegatesFocus",{get(){return this.hasAttribute("shadowrootdelegatesfocus")},set(e){this.toggleAttribute("shadowrootdelegatesfocus",e)}}),c(HTMLTemplateElement.prototype,"shadowRootClonable",{get(){return this.hasAttribute("shadowrootclonable")},set(e){this.toggleAttribute("shadowrootclonable",e)}}),c(HTMLTemplateElement.prototype,"shadowRootSerializable",{get(){return this.hasAttribute("shadowrootserializable")},set(e){this.toggleAttribute("shadowrootserializable",e)}});const Ct=(e=document)=>{e.querySelectorAll("template[shadowrootmode]").forEach(e=>{const t=e.parentElement.attachShadow({mode:e.shadowRootMode,clonable:e.shadowRootClonable,delegatesFocus:e.shadowRootDelegatesFocus,serializable:e.shadowRootSerializable});t.append(e.content),e.remove(),Ct(t),Ft.set(t.host,t)})};u(HTMLElement.prototype,"attachShadow",function(e){return({mode:t,clonable:r=!1,delegatesFocus:n=!1,serializable:o=!1,slotAssignment:i="auto"})=>{if(Ft.has(this)){const e=Ft.get(this);if(t===e.shadowRootMode)return Ct.remove(this),e;throw new DOMException("Element.attachShadow: Unable to re-attach to existing ShadowDOM")}return e.call(this,{mode:t,clonable:r,delegatesFocus:n,serializable:o,slotAssignment:i})}}),"loading"===document.readyState?document.addEventListener("readystatechange",()=>Ct(document),{once:!0}):Ct(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||c(HTMLIFrameElement.prototype,"loading",{get:function(){return this.getAttribute("loading")||"auto"},set:function(e){this.setAttribute("loading",e)}}),"credentialless"in HTMLIFrameElement.prototype||c(HTMLIFrameElement.prototype,"credentialless",{get:function(){return this.hasAttribute("credentialless")},set:function(e){this.toggleAttribute("credentialless",e)}}),!("HTMLDialogElement"in globalThis)||HTMLDialogElement.prototype.requestClose instanceof Function||(HTMLDialogElement.prototype.requestClose=function(e){const t=new Event("cancel",{cancelable:!0,bubbles:!1});this.dispatchEvent(t),t.defaultPrevented||this.close(e)});const qe="Expected a set-like object.",Be=["has","keys"],_e=["size"],Ve=e=>e instanceof Set,We=e=>Ve(e)||"object"==typeof e&&null!==e&&Be.every(t=>e[t]instanceof Function)&&_e.every(t=>t in e);Set.prototype.intersection instanceof Function||(Set.prototype.intersection=function(e){if(!We(e))throw new TypeError(qe);return new Set([...this].filter(t=>e.has(t)))}),Set.prototype.difference instanceof Function||(Set.prototype.difference=function(e){if(!We(e))throw new TypeError(qe);return new Set([...this].filter(t=>!e.has(t)))}),Set.prototype.union instanceof Function||(Set.prototype.union=function(e){return new Set([...this,...e])}),Set.prototype.isSubsetOf instanceof Function||(Set.prototype.isSubsetOf=function(e){if(!We(e))throw new TypeError(qe);return[...this].every(t=>e.has(t))}),Set.prototype.isSupersetOf instanceof Function||(Set.prototype.isSupersetOf=function(e){if(!We(e))throw new TypeError(qe);return Ve(e)?e.isSubsetOf(this):new Set(e.keys()).isSubsetOf(this)}),Set.prototype.symmetricDifference instanceof Function||(Set.prototype.symmetricDifference=function(e){if(!We(e))throw new TypeError(qe);return Ve(e)?new Set([...this.difference(e),...e.difference(this)]):new Set([...this.difference(e),...new Set(e.keys()).difference(this)])}),Set.prototype.isDisjointFrom instanceof Function||(Set.prototype.isDisjointFrom=function(e){if(!We(e))throw new TypeError(qe);return new Set([...this,...e]).size===this.size+e.size}),WeakMap.prototype.emplace instanceof Function||(WeakMap.prototype.emplace=function(e,{insert:t,update:r}={}){const n=this.has(e);if(n&&r instanceof Function){const t=this.get(e),n=r.call(this,t,e,this);return n!==t&&this.set(e,t),n}if(n)return this.get(e);if(t instanceof Function){const r=t.call(this,e,this);return this.set(e,r),r}throw new Error("Key is not found and no `insert()` given")}),function(){if("screen"in globalThis&&!(globalThis.getScreenDetails instanceof Function)){class e extends EventTarget{get availHeight(){return screen.availHeight}get availLeft(){return screen.availLeft}get availTop(){return screen.availTop}get availWidth(){return screen.availWidth}get colorDepth(){return screen.colorDepth}get devicePixelRatio(){return globalThis.devicePixelRatio||1}get height(){return screen.height}get isExtended(){return screen.isExtended}get isInternal(){return!0}get isPrimary(){return!0}get label(){return"Unknown"}get orientation(){return screen.orientation}get pixelDepth(){return screen.pixelDepth}get top(){return screen.top}get width(){return screen.width}}class t extends EventTarget{get currentScreen(){return new e}get screens(){return[this.currentScreen]}}Object.defineProperty(Screen.prototype,"isExtended",{enumerable:!0,configurable:!0,get:()=>!1}),globalThis.getScreenDetails=async()=>new t}}();
|
|
33
|
+
*/Object.freeze(Le.concat(Te));const Oe=Object.freeze(["math","maction","annotation","annotation-xml","menclose","merror","mfenced","mfrac","mi","mmultiscripts","mn","mo","mover","mpadded","mphantom","mprescripts","mroot","mrow","ms","semantics","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover"].map(e=>fe(e,pe))),ke=Object.freeze(["accent","accentunder","actiontype","align","background","close","color","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","fence","fontfamily","fontsize","fontstyle","fontweight","frame","framespacing","height","href","id","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","superscriptshift","symmetric","voffset","width","xmlns"].map(e=>me(e,pe)));Object.freeze(ke.concat(Te)),Object.freeze([...Ee,...xe]),Object.freeze([...Te,...Se,...Le]),Object.freeze([...Ee,...xe,...Oe]),Object.freeze([...Te,...Se,...Le,...ke]);const Pe=new Set(["href","src","action","xlink:href"]),Re=new Set(["javascript:","data:","file:","ftp:"]),Fe=function(e,{createHTML:t,createScript:r,createScriptURL:n}){return"trustedTypes"in globalThis?trustedTypes.createPolicy(e,{createHTML:t,createScript:r,createScriptURL:n}):Object.freeze({[Symbol.for("policy-name")]:e.toString(),createHTML(r,...n){if(t instanceof Function){const e=t(r.toString(),...n).toString();return Object.freeze({toString:()=>e})}throw new TypeError(`Policy "${e}" does not provide a createHTML method.`)},createScript(t,...n){if(r instanceof Function){const e=r(t.toString(),...n).toString();return Object.freeze({toString:()=>e})}throw new TypeError(`Policy "${e}" does not provide a createScript method.`)},createScriptURL(t,...r){if(n instanceof Function){const e=n(t.toString(),...r).toString();return Object.freeze({toString:()=>e})}throw new TypeError(`Policy "${e}" does not provide a createScriptURL method.`)}})}("aegis-sanitizer#html",{createHTML:e=>e});function Ce(e,t,{elements:r=Me.elements,attributes:n=Me.attributes,comments:o=Me.comments,dataAttributes:i=Me.dataAttributes,sanitizer:a,...s}=Me,{allowInsecure:l=!1}={}){const c=document.createElement("template");c.setHTMLUnsafe(Fe.createHTML(t)),Ie(c.content,{elements:r,attributes:n,comments:o,dataAttributes:i,sanitizer:a,...s},l),e.replaceChildren(c.content)}function je(e,{elements:t=Me.elements,attributes:r=Me.attributes,comments:n=Me.comments,dataAttributes:o=Me.dataAttributes,sanitizer:i,...a}=Me,{allowInsecure:s=!1}={}){const l=(new DOMParser).parseFromString(Fe.createHTML(e),"text/html");return Ie(l,{elements:t,attributes:r,comments:n,dataAttributes:o,sanitizer:i,...a},s),l}function Ie(e,t=Me,r=!1){if(e instanceof Node){return Ue(e,ve(t),r)}throw new TypeError("Not a node.")}const Ne="trustedTypes"in globalThis?e=>null!==trustedTypes.getAttributeType(e.ownerElement.tagName,e.localName,e.ownerElement.namespaceURI,e.namespaceURI):e=>he.has(e.localName);function He(e,t,r=!1){const n=e.namespaceURI||"";return(!("dataAttributes"in t)||t.dataAttributes)&&e.name.startsWith("data-")||n in t.attributes&&t.attributes[n].some(t=>t.name===e.localName)&&!(r||Ne(e))&&!(r||function(e){if(Pe.has(e.name)){if(URL.canParse(e.value)){const{protocol:t}=new URL(e.value);return Re.has(t)}return!1}return!1}(e))}function Ue(e,t,r=!1){switch(e.nodeType){case Node.ELEMENT_NODE:!function(e,t,r){if(function(e,t){return e.namespaceURI in t.elements&&t.elements[e.namespaceURI].some(t=>t.name===e.localName)}(e,t)){if(e.hasAttributes()){const n=e.attributes;for(let e=n.length-1;-1!==e;e--)De(n[e],t,r)}if("TEMPLATE"===e.tagName)ze(e.content,t,r);else if(e.hasChildNodes()){const n=e.childNodes;for(let e=n.length-1;-1!==e;e--)Ue(n[e],t,r)}}else e.remove()}(e,t,r);break;case Node.DOCUMENT_NODE:case Node.DOCUMENT_FRAGMENT_NODE:ze(e,t,r);break;case Node.COMMENT_NODE:!function(e,t){t.comments||e.remove()}(e,t);break;case Node.ATTRIBUTE_NODE:De(e,t,r);break;case Node.TEXT_NODE:case Node.DOCUMENT_TYPE_NODE:break;default:e.ownerElement instanceof Element&&e.ownerElement.removeChild(e)}}function De(e,t,r=!1){!He(e,t,r)&&e.ownerElement instanceof Element&&e.ownerElement.removeAttributeNode(e)}function ze(e,t,r=!1){if(e.hasChildNodes()){const n=e.childNodes;for(let e=n.length-1;-1!==e;e--)Ue(n[e],t,r)}}if(Promise.withResolvers instanceof Function||(Promise.withResolvers=function(){const e={};return e.promise=new Promise((t,r)=>{e.resolve=t,e.reject=r}),e}),URL.canParse instanceof Function||(URL.canParse=function(e,t){try{return new URL(e,t),!0}catch{return!1}}),URL.parse instanceof Function||(URL.parse=function(e,t){try{return new URL(e,t)}catch{return null}}),Object.groupBy instanceof Function||(Object.groupBy=function(e,t){const r={};for(const n of e){const e=t(n);e in r?r[e].push(n):r[e]=[n]}return r}),Element.prototype.setHTML instanceof Function||(Element.prototype.setHTML=function(e,{elements:t,attributes:r,comments:n,dataAttributes:o,sanitizer:i,...a}={}){Ce(this,e,"object"==typeof i&&null!==i?i.getConfiguration instanceof Function?i.getConfiguration():i:{elements:t,attributes:r,comments:n,dataAttributes:o,...a})},DocumentFragment.prototype.setHTML=function(...e){Element.prototype.setHTML.apply(this,e)},HTMLTemplateElement.prototype.setHTML=function(e,t){this.content.setHTML(e,t)}),Document.parseHTML instanceof Function||(Document.parseHTML=function(e,{elements:t,attributes:r,comments:n,dataAttributes:o,sanitizer:i,...a}={}){return"object"==typeof i&&null!==i?Document.parseHTML(e,i.getConfiguration instanceof Function?i.getConfiguration():i):je(e,{elements:t,attributes:r,comments:n,dataAttributes:o,...a})}),!("command"in HTMLButtonElement.prototype)){const bt=Symbol("command:for"),yt={passive:!0};Object.defineProperty(HTMLButtonElement.prototype,"command",{get(){return this.getAttribute("command")},set(e){"string"==typeof e?this.setAttribute("command",e):this.removeAttribute("command")}}),Object.defineProperty(HTMLButtonElement.prototype,"commandForElement",{get(){return this[bt]instanceof Element?this[bt]:this.hasAttribute("commandfor")?document.getElementById(this.getAttribute("commandfor")):null},set(e){e instanceof Element?0===e.id.length?(this.setAttribute("commandfor",""),this[bt]=e):(this.setAttribute("commandfor",e.id),this[bt]=null):(this.removeAttribute("commandfor"),this[bt]=null)}});class wt extends Event{#D=null;#z="";constructor(e,{source:t,command:r,bubbles:n,cancelable:o,composed:i}={}){super(e,{bubbles:n,cancelable:o,composed:i}),"string"==typeof r&&(this.#z=r),t instanceof HTMLButtonElement&&(this.#D=t)}get command(){return this.#z}get source(){return this.#D}}function vt({currentTarget:e}){if(e instanceof HTMLButtonElement&&e.hasAttribute("command")&&e.hasAttribute("commandfor")){const t=e.commandForElement,r=e.command;if(t instanceof Element&&"string"==typeof r){const n=new wt("command",{command:r,source:e,cancelable:!0});if(t.dispatchEvent(n),!n.defaultPrevented)switch(r){case"show-modal":t instanceof HTMLDialogElement&&t.showModal();break;case"close":t instanceof HTMLDialogElement&&t.close();break;case"request-close":t instanceof HTMLDialogElement&&t.requestClose();break;case"show-popover":t.showPopover();break;case"hide-popover":t.hidePopover();break;case"toggle-popover":t.togglePopover()}}}}const Tt=new MutationObserver(e=>{for(const t of e)if("childList"===t.type){for(const e of t.addedNodes)if(e instanceof HTMLButtonElement&&e.hasAttribute("command")&&e.hasAttribute("commandfor"))e.addEventListener("click",vt,yt);else if(e instanceof Element)for(const t of e.querySelectorAll("button[command][commandfor]"))t.addEventListener("click",vt,yt)}else"attributes"===t.type&&t.target instanceof HTMLButtonElement&&typeof t.oldValue!=typeof t.target.getAttribute(t.attributeName)&&(t.target.hasAttribute("command")&&t.target.hasAttribute("commandfor")?t.target.addEventListener("click",vt,yt):t.target.removeEventListener("click",vt,yt))}),Et={childList:!0,subtree:!0,attributes:!0,attributeFilter:["command","commandfor"],attributeOldValue:!0};Tt.observe(document,Et),document.querySelectorAll("button").forEach(e=>e.addEventListener("click",vt,yt)),globalThis.CommandEvent=wt,globalThis[Symbol.for("polyfill-command")]=e=>Tt.observe(e,Et)}if(l(Element.prototype,"setHTMLUnsafe",ie),l(Element.prototype,"getHTML",ae),"CustomElementRegistry"in globalThis&&!(CustomElementRegistry.prototype.getName instanceof Function)){const St=new Map;u(CustomElementRegistry.prototype,"define",e=>(t,r,n)=>{e.call(customElements,t,r,n),St.set(r,"string"==typeof n.extends?n.extends:t)}),l(CustomElementRegistry.prototype,"getName",e=>{if("function"==typeof e)return St.get(e)??null;throw"object"==typeof e&&null!==e?new TypeError("CustomElementRegistry.getName: Argument 1 is not callable."):new TypeError("CustomElementRegistry.getName: Argument 1 is not an object.")})}function $e({currentTarget:e}){switch(e.popoverTargetAction){case"show":e.popoverTargetElement.showPopover();break;case"hide":e.popoverTargetElement.hidePopover();break;default:e.popoverTargetElement.togglePopover()}}if(!(globalThis.ToggleEvent instanceof Function)){class At extends Event{#$;#q;constructor(e,{newState:t,oldState:r}){super(e,{bubbles:!0}),this.#$=t,this.#q=r}get newState(){return this.#$}get oldState(){return this.#q}}globalThis.ToggleEvent=At}if(!(HTMLElement.prototype.showPopover instanceof Function)){const Mt=e=>e.classList.contains("_popover-open");Object.defineProperties(HTMLElement.prototype,{showPopover:{value:function(){if(!Mt(this)){if(this.dispatchEvent(new ToggleEvent("beforetoggle",{oldState:"closed",newState:"open"})),"auto"===this.getAttribute("popover")){const e=new AbortController;document.body.addEventListener("click",({target:t})=>{this.contains(t)||this.isSameNode(t.popoverTargetElement)||(e.abort(),this.hidePopover())},{signal:e.signal,capture:!0}),document.body.addEventListener("keydown",({key:t})=>{"Escape"===t&&(e.abort(),this.hidePopover())},{signal:e.signal,capture:!0}),document.addEventListener("beforetoggle",({target:t})=>{t.isSameNode(this)||"auto"!==t.getAttribute("popover")||(e.abort(),this.hidePopover())},{signal:e.signal})}this.classList.add("_popover-open"),this.dispatchEvent(new ToggleEvent("toggle",{oldState:"closed",newState:"open"}))}}},hidePopover:{value:function(){Mt(this)&&(this.dispatchEvent(new ToggleEvent("beforetoggle",{oldState:"open",newState:"closed"})),queueMicrotask(()=>this.classList.remove("_popover-open")),this.dispatchEvent(new ToggleEvent("toggle",{oldState:"open",newState:"closed"})))}},togglePopover:{value:function(){Mt(this)?this.hidePopover():this.showPopover()}}}),Object.defineProperties(HTMLButtonElement.prototype,{popoverTargetElement:{get(){return document.getElementById(this.getAttribute("popovertarget"))}},popoverTargetAction:{get(){return this.getAttribute("popovertargetaction")||"toggle"},set(e){this.setAttribute("popovertargetaction",e)}}}),function(e=document.body){e.querySelectorAll('button[popovertarget], input[type="button"][popovertarget]').forEach(e=>e.addEventListener("click",$e))}()}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(le.role)){const xt=!0,Lt=!0,Ot=Object.fromEntries(Object.entries(le).map(([e,t])=>[e,{get:function(){return this.getAttribute(t)},set:function(e){"string"==typeof e?this.setAttribute(t,e):this.removeAttribute(t)},enumerable:xt,configurable:Lt}]));Object.defineProperties(Element.prototype,Ot)}if(!HTMLElement.prototype.hasOwnProperty("inert")){const kt=new WeakMap,Pt=e=>{kt.has(e)&&(e.tabIndex=kt.get(e)),e.hasChildNodes()&&[...e.children].forEach(Pt)},Rt=e=>{-1!==e.tabIndex&&(kt.set(e,e.tabIndex),e.tabIndex=-1),e.hasChildNodes()&&[...e.children].forEach(Rt)};Object.defineProperty(HTMLElement.prototype,"inert",{get:function(){return this.hasAttribute("inert")},set:function(e){e?(this.setAttribute("aria-hidden","true"),this.setAttribute("inert",""),Rt(this)):(this.removeAttribute("aria-hidden"),this.removeAttribute("inert"),Pt(this))},enumerable:!0,configurable:!0})}if(HTMLImageElement.prototype.hasOwnProperty("complete")||Object.defineProperty(HTMLImageElement.prototype,"complete",{get:function(){return""===this.src||this.naturalHeight>0}}),HTMLImageElement.prototype.decode instanceof Function||(HTMLImageElement.prototype.decode=function(){return this.complete?Promise.resolve():new Promise((e,t)=>{const r=()=>{this.removeEventListener("error",n),this.removeEventListener("load",r),e()},n=e=>{this.removeEventListener("error",n),this.removeEventListener("load",r),t(e)};this.addEventListener("load",r),this.addEventListener("error",n)})}),!HTMLTemplateElement.prototype.hasOwnProperty("shadowRootMode")){const Ft=new WeakMap;c(HTMLTemplateElement.prototype,"shadowRootMode",{get(){return this.getAttribute("shadowrootmode")},set(e){this.setAttribute("shadowrootmode",e)}}),c(HTMLTemplateElement.prototype,"shadowRootDelegatesFocus",{get(){return this.hasAttribute("shadowrootdelegatesfocus")},set(e){this.toggleAttribute("shadowrootdelegatesfocus",e)}}),c(HTMLTemplateElement.prototype,"shadowRootClonable",{get(){return this.hasAttribute("shadowrootclonable")},set(e){this.toggleAttribute("shadowrootclonable",e)}}),c(HTMLTemplateElement.prototype,"shadowRootSerializable",{get(){return this.hasAttribute("shadowrootserializable")},set(e){this.toggleAttribute("shadowrootserializable",e)}});const Ct=(e=document)=>{e.querySelectorAll("template[shadowrootmode]").forEach(e=>{const t=e.parentElement.attachShadow({mode:e.shadowRootMode,clonable:e.shadowRootClonable,delegatesFocus:e.shadowRootDelegatesFocus,serializable:e.shadowRootSerializable});t.append(e.content),e.remove(),Ct(t),Ft.set(t.host,t)})};u(HTMLElement.prototype,"attachShadow",function(e){return({mode:t,clonable:r=!1,delegatesFocus:n=!1,serializable:o=!1,slotAssignment:i="auto"})=>{if(Ft.has(this)){const e=Ft.get(this);if(t===e.shadowRootMode)return Ct.remove(this),e;throw new DOMException("Element.attachShadow: Unable to re-attach to existing ShadowDOM")}return e.call(this,{mode:t,clonable:r,delegatesFocus:n,serializable:o,slotAssignment:i})}}),"loading"===document.readyState?document.addEventListener("readystatechange",()=>Ct(document),{once:!0}):Ct(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||c(HTMLIFrameElement.prototype,"loading",{get:function(){return this.getAttribute("loading")||"auto"},set:function(e){this.setAttribute("loading",e)}}),"credentialless"in HTMLIFrameElement.prototype||c(HTMLIFrameElement.prototype,"credentialless",{get:function(){return this.hasAttribute("credentialless")},set:function(e){this.toggleAttribute("credentialless",e)}}),!("HTMLDialogElement"in globalThis)||HTMLDialogElement.prototype.requestClose instanceof Function||(HTMLDialogElement.prototype.requestClose=function(e){const t=new Event("cancel",{cancelable:!0,bubbles:!1});this.dispatchEvent(t),t.defaultPrevented||this.close(e)});const qe="Expected a set-like object.",Be=["has","keys"],_e=["size"],Ve=e=>e instanceof Set,We=e=>Ve(e)||"object"==typeof e&&null!==e&&Be.every(t=>e[t]instanceof Function)&&_e.every(t=>t in e);Set.prototype.intersection instanceof Function||(Set.prototype.intersection=function(e){if(!We(e))throw new TypeError(qe);return new Set([...this].filter(t=>e.has(t)))}),Set.prototype.difference instanceof Function||(Set.prototype.difference=function(e){if(!We(e))throw new TypeError(qe);return new Set([...this].filter(t=>!e.has(t)))}),Set.prototype.union instanceof Function||(Set.prototype.union=function(e){return new Set([...this,...e])}),Set.prototype.isSubsetOf instanceof Function||(Set.prototype.isSubsetOf=function(e){if(!We(e))throw new TypeError(qe);return[...this].every(t=>e.has(t))}),Set.prototype.isSupersetOf instanceof Function||(Set.prototype.isSupersetOf=function(e){if(!We(e))throw new TypeError(qe);return Ve(e)?e.isSubsetOf(this):new Set(e.keys()).isSubsetOf(this)}),Set.prototype.symmetricDifference instanceof Function||(Set.prototype.symmetricDifference=function(e){if(!We(e))throw new TypeError(qe);return Ve(e)?new Set([...this.difference(e),...e.difference(this)]):new Set([...this.difference(e),...new Set(e.keys()).difference(this)])}),Set.prototype.isDisjointFrom instanceof Function||(Set.prototype.isDisjointFrom=function(e){if(!We(e))throw new TypeError(qe);return new Set([...this,...e]).size===this.size+e.size}),WeakMap.prototype.emplace instanceof Function||(WeakMap.prototype.emplace=function(e,{insert:t,update:r}={}){const n=this.has(e);if(n&&r instanceof Function){const t=this.get(e),n=r.call(this,t,e,this);return n!==t&&this.set(e,t),n}if(n)return this.get(e);if(t instanceof Function){const r=t.call(this,e,this);return this.set(e,r),r}throw new Error("Key is not found and no `insert()` given")}),function(){if("screen"in globalThis&&!(globalThis.getScreenDetails instanceof Function)){class e extends EventTarget{get availHeight(){return screen.availHeight}get availLeft(){return screen.availLeft}get availTop(){return screen.availTop}get availWidth(){return screen.availWidth}get colorDepth(){return screen.colorDepth}get devicePixelRatio(){return globalThis.devicePixelRatio||1}get height(){return screen.height}get isExtended(){return screen.isExtended}get isInternal(){return!0}get isPrimary(){return!0}get label(){return"Unknown"}get orientation(){return screen.orientation}get pixelDepth(){return screen.pixelDepth}get top(){return screen.top}get width(){return screen.width}}class t extends EventTarget{get currentScreen(){return new e}get screens(){return[this.currentScreen]}}Object.defineProperty(Screen.prototype,"isExtended",{enumerable:!0,configurable:!0,get:()=>!1}),globalThis.getScreenDetails=async()=>new t}}();
|
|
34
34
|
/**
|
|
35
35
|
* @copyright 2024 Chris Zuber <admin@kernvalley.us>
|
|
36
36
|
*/
|