@shgysk8zer0/polyfills 0.2.2 → 0.2.4
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 +10 -0
- package/all.min.js +7 -7
- package/all.min.js.map +1 -1
- package/element.js +21 -0
- package/package.json +11 -1
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
+
## [v0.2.4] - 2023-008-23
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
- Add polyfill for `HTMLFormElement.prototype.requestSubmit()`
|
|
13
|
+
|
|
14
|
+
## [v0.2.3] - 2023-07-09
|
|
15
|
+
|
|
16
|
+
### Added
|
|
17
|
+
- Add funding
|
|
18
|
+
|
|
9
19
|
## [v0.2.2] - 2023-07-09
|
|
10
20
|
|
|
11
21
|
### Added
|
package/all.min.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/const l=new WeakMap;class c{constructor(e,t="exclusive"){if(!["exclusive","shared"].includes(t))throw new TypeError(`'${t}' (value of 'mode' member of LockOptions) is not a valid value for enumeration LockMode.`);if("string"!=typeof e&&(e=e.toString()),e.startsWith("-"))throw new DOMException("Names starting with `-` are reserved");l.set(this,{name:e,mode:t})}get name(){return l.get(this).name}get mode(){return l.get(this).mode}}
|
|
6
6
|
/**
|
|
7
7
|
* @copyright 2023 Chris Zuber <admin@kernvalley.us>
|
|
8
|
-
*/const u=new Map,p=Symbol("lock-key"),d="locks"in navigator&&navigator.locks.request instanceof Function;const m=async function(){return await new Promise((e=>{"locks"in navigator&&navigator.locks.request instanceof Function?navigator.locks.query().then((()=>e(!0))).catch((()=>e(!1))):e(!1)}))}();async function f(e,t=null){return new Promise(((n,o)=>{var i;r(i=e)||i instanceof Promise?e.call(globalThis,t).then(n,o):queueMicrotask((()=>{try{const o=e.call(globalThis,t);n(o)}catch(e){o(e)}}))}))}async function h(e){u.has(e)&&await u.get(e).promise.catch(console.error)}function y(e,t,n){const{resolve:o,reject:r,promise:i}=function(){if(Promise.withResolvers instanceof Function)return Promise.withResolvers();{const e={};return e.promise=new Promise(((t,n)=>{e.resolve=t,e.reject=n})),e}}(),a=new AbortController,s=new c(e,t),l=function({name:e,mode:t}){switch(t){case"exclusive":return b().some((t=>t.name===e));case"shared":return b().some((t=>t.name===e&&"exclusive"===t.mode))}}(s);return u.set(s,{resolve:o,reject:r,promise:i,callback:n,pending:l,controller:a}),s}function g(e){return e instanceof c&&u.has(e)&&u.get(e).pending}function b(e){return"string"==typeof e?[...u.keys()].filter((t=>t.name===e)):[...u.keys()]}function w(e){return b(e).filter((e=>!g(e)))}function T(e){return b(e).filter((e=>g(e)))}async function v(e){switch(e.mode){case"exclusive":await Promise.allSettled(b().filter((t=>t.name===e.name&&t!==e)).map(h));break;case"shared":await Promise.allSettled(b().filter((t=>t.name===e.name&&"exclusive"===t.mode&&t!==e)).map(h))}}function E(e){if(u.has(e))return u.get(e).controller.signal}async function S(e){if(u.has(e)){const{resolve:t,reject:n,promise:o,callback:r,pending:i,controller:a}=u.get(e);return i&&function(e,t=!0){u.has(e)&&u.set(e,{...u.get(e),pending:t})}(e,!1),f(r,e).then(t,n).finally((()=>{u.delete(e),requestIdleCallback((()=>a.abort()))})),o}}class M{constructor(e){if(e!==p)throw new TypeError("Invalid constructor")}static async request(e,...t){let n,o={};t[0]instanceof Function?n=t[0]:t[1]instanceof Function&&([o,n]=t),"string"!=typeof e&&(e=e.toString());const{mode:r="exclusive",ifAvailable:i=!1,steal:a=!1,signal:s}=o;if(a&&i)throw new DOMException("LockManager.request: `steal` and `ifAvailable` cannot be used together");if(e.startsWith("-"))throw new DOMException("LockManager.request: Names starting with `-` are reserved");if(!["exclusive","shared"].includes(r))throw new TypeError(`LockManager.request: '${r}' (value of 'mode' member of LockOptions) is not a valid value for enumeration LockMode.`);if(s instanceof AbortSignal&&s.aborted)throw s.reason;if("shared"===r&&a)throw new DOMException("LockManager.request: `steal` is only supported for exclusive lock requests");const l=w(e),c=T(e),p=[...l,...c].some((t=>t.name===e));a&&p&&function(e){[...u.entries()].filter((([t])=>t.name===e)).forEach((([e,{reject:t,controller:n}])=>{requestIdleCallback((()=>{n.abort(),u.delete(e)})),t(new DOMException("The lock request is aborted"))}))}(e);const d=y(e,r,n);switch(s instanceof AbortSignal&&s.addEventListener("abort",(()=>{if(u.has(d)){const{reject:e,controller:t}=u.get(d);u.delete(d),e(new DOMException("The lock request is aborted")),t.abort()}}),{once:!0,signal:E(d)}),r){case"exclusive":if(!i||0===l.length&&0===c.length)return await v(d),await S(d);{const e=u.get(d).controller;return u.delete(d),await f(n,null).then((t=>(requestIdleCallback((()=>e.abort())),t)))}case"shared":if(i){if([...l,...c].some((e=>"exclusive"===e.mode))){const e=u.get(d).controller;return u.delete(d),await f(n,null).then((t=>(requestIdleCallback((()=>e.abort())),t)))}return await v(d),await S(d)}return await v(d),await S(d);default:throw new TypeError(`LockManager.request: '${r}' (value of 'mode' member of LockOptions) is not a valid value for enumeration LockMode.`)}}static async query(){return{held:w().map((({name:e,mode:t})=>({name:e,mode:t,clientId:null}))),pending:T().map((({name:e,mode:t})=>({name:e,mode:t,clientId:null})))}}}function A(e,t="error"){if(e instanceof Error){const{message:n,name:o,fileName:r,lineNumber:i,columnNumber:a}=e;return new ErrorEvent(t,{error:e,message:`${o}: ${n}`,filename:r,lineno:i,colno:a})}throw new TypeError("`errorToEvent()` only accepts Errors")}let L=!1;new Promise((async e=>{if(d)if(await m)e(!1);else try{navigator.locks.request=M.request,navigator.locks.query=M.query,L=!0,e(!0)}catch(t){globalThis.dispatchEvent(A(t)),e(!1)}else try{navigator.locks=M,L=!0,e(!0)}catch(t){globalThis.dispatchEvent(A(t)),e(!1)}})),navigator.canShare instanceof Function||(navigator.canShare=function({title:e,text:t,url:n,files:o}={}){return navigator.share instanceof Function&&(!Array.isArray(o)||0===o.length)&&(!![e,t,n].every((e=>void 0===e))||[e,t,n].some((e=>"string"==typeof e&&0!==e.length)))}),navigator.setAppBadge instanceof Function||(navigator.setAppBadge=async e=>{if(!Number.isInteger(e))throw new TypeError("Failed to execute 'setAppBadge' on 'Navigator': Value is not of type 'unsigned long long'");if(e<0)throw new TypeError("Failed to execute 'setAppBadge' on 'Navigator': Value is outside the 'unsigned long long' value range.");0===e?document.title.startsWith("(")&&(document.title=document.title.replace(/^\((\d{1,2}\+?)\)\s/,"")):e<100?(await navigator.clearAppBadge(),document.title=`(${e}) ${document.title}`):(await navigator.clearAppBadge(),document.title=`(99+) ${document.title}`)}),navigator.clearAppBadge instanceof Function||(navigator.clearAppBadge=()=>navigator.setAppBadge(0)),Navigator.prototype.hasOwnProperty("pdfViewerEnabled")||Object.defineProperty(navigator,"pdfViewerEnabled",{enumerable:!0,configurable:!1,writable:!1,value:!1}),Navigator.prototype.getInstalledRelatedApps instanceof Function||(Navigator.prototype.getInstalledRelatedApps=async()=>[]),Navigator.prototype.getGamepads instanceof Function||(Navigator.prototype.getGamepads=()=>[]),"hardwareConcurrency"in Navigator.prototype||Object.defineProperty(Navigator.prototype,"hardwareConcurrency",{get:()=>1}),"connection"in Navigator.prototype?"type"in navigator.connection||(navigator.connection.type="unknown"):Object.defineProperty(Navigator.prototype,"connection",{get:()=>Object.create(EventTarget.prototype,{type:{value:"unknown"},effectiveType:{value:"4g"},rtt:{value:NaN},downlink:{value:NaN},downlinkMax:{value:1/0},saveData:{value:!1},onchange:{value:null,writable:!0},ontypechange:{value:null,writable:!0}})}),"doNotTrack"in Navigator.prototype||Object.defineProperty(Navigator.prototype,"doNotTrack",{get:()=>"unspecified"}),"globalPrivacyControl"in Navigator.prototype||Object.defineProperty(Navigator.prototype,"globalPrivacyControl",{get:()=>!1}),function(){if(!(globalThis.requestIdleCallback instanceof Function)){const e=e=>Number.isSafeInteger(e)&&e>0;globalThis.requestIdleCallback=function(t,{timeout:n}={}){const o=performance.now(),r=()=>e(n)?Math.max(0,n-(performance.now()-o)):Math.max(0,600-(performance.now()-o));return setTimeout((()=>t({didTimeout:!!e(n)&&0===r(),timeRemaining:r})),1)}}globalThis.cancelIdleCallback instanceof Function||(globalThis.cancelIdleCallback=e=>clearTimeout(e)),globalThis.requestAnimationFrame instanceof Function||(globalThis.requestAnimationFrame=e=>setTimeout((()=>e(performance.now())),1e3/60)),globalThis.cancelAnimationFrame instanceof Function||(globalThis.cancelAnimationFrame=e=>clearTimeout(e)),globalThis.queueMicrotask instanceof Function||(globalThis.queueMicrotask=e=>Promise.resolve().then(e).catch((e=>setTimeout((()=>{throw e})))))}(),function(){if(!("AbortSignal"in globalThis)){const e={signal:Symbol("signal"),aborted:Symbol("aborted"),reason:Symbol("reason"),onabort:Symbol("onabort")};globalThis.AbortError=class extends Error{},globalThis.AbortSignal=class t extends EventTarget{constructor(){super(),Object.defineProperties(this,{[e.aborted]:{enumerable:!1,writable:!0,configurable:!1,value:!1},[e.reason]:{enumerable:!1,writable:!0,configurable:!1,value:void 0},[e.onabort]:{enumerable:!1,writable:!0,configurable:!1,value:null}}),this.addEventListener("abort",(e=>{this.onabort instanceof Function&&this.onabort.call(this,e)}))}get aborted(){return this[e.aborted]}get onabort(){return this[e.onabort]}set onabort(t){this[e.onabort]=t instanceof Function?t:null}get reason(){return this[e.reason]}throwIfAborted(){if(this.aborted)throw this.reason}static abort(n=new DOMException("Operation aborted")){const o=new t;return o[e.aborted]=!0,o[e.reason]=n,o}},globalThis.AbortController=class{constructor(){this[e.signal]=new AbortSignal}get signal(){return this[e.signal]}abort(t=new DOMException("Operation aborted")){const n=this.signal;n.aborted||(n[e.aborted]=!0,n[e.reason]=t,n.dispatchEvent(new Event("abort")))}}}if(!("reason"in AbortSignal.prototype)){const e=new WeakMap,t=AbortController.prototype.abort;if(AbortSignal.abort instanceof Function){const t=AbortSignal.abort;AbortSignal.abort=function(n=new DOMException("Operation aborted")){const o=t();return e.set(o,n),o}}else AbortSignal.abort=function(e=new DOMException("Operation aborted")){const t=new AbortController;return t.abort(e),t.reason};Object.defineProperty(AbortSignal.prototype,"reason",{enumerable:!0,configurable:!0,get:function(){return e.has(this)?e.get(this):void 0}}),AbortController.prototype.abort=function(n=new DOMException("Operation aborted")){e.set(this.signal,n),t.call(this)}}AbortSignal.prototype.throwIfAborted instanceof Function||(AbortSignal.prototype.throwIfAborted=function(){if(this.aborted)throw this.reason}),AbortSignal.timeout instanceof Function||(AbortSignal.timeout=function(e){if(void 0===e)throw new TypeError("At least one 1 argument required but only 0 passed");if(Number.isFinite(e)){if(e<0)throw new TypeError("Argument 1 is out of range for unsigned long long.");{const t=new AbortController;return setTimeout((()=>t.abort(new DOMException("The operation timed out."))),e),t.signal}}throw new TypeError("Argument 1 is not a finite value, so it is out of range for unsigned long long.")}),AbortSignal.any instanceof Function||(AbortSignal.any=function(e){if(!Array.isArray(e))throw new TypeError("Expected an array of signals");const t=new AbortController;for(const n of e){if(!(n instanceof AbortSignal)){const e=new TypeError("`signal` is not an `AbortSignal`");throw t.abort(e),e}if(n.aborted){t.abort(n.reason||new DOMException("Operation aborted."));break}n.addEventListener("abort",(({target:e})=>{t.abort(e.reason||new DOMException("Operation aborted."))}),{signal:t.signal})}return t.signal})}(),globalThis.hasOwnProperty("AggregateError")||(globalThis.AggregateError=class extends Error{constructor(e,t){void 0===t?(super(e),this.errors=[]):(super(t),this.errors=e)}}),globalThis.reportError instanceof Function||(globalThis.reportError=function(e){globalThis.dispatchEvent(A(e))}),function(){if("MediaQueryListEvent"in globalThis||(globalThis.MediaQueryListEvent=class extends Event{constructor(e,{media:t,matches:n}={}){super(e),Object.defineProperties(this,{media:{enumerable:!0,configurable:!1,writable:!1,value:t},matches:{enumerable:!0,configurable:!1,writable:!1,value:n}})}}),"MediaQueryList"in globalThis&&!(globalThis.MediaQueryList.prototype.addEventListener instanceof Function)){const e=new WeakMap,t=function(){const{media:e,matches:t}=this;this.dispatchEvent(new MediaQueryListEvent("change",{media:e,matches:t}))},n=function(n){return e.has(n)||(e.set(n,new EventTarget),n.addListener(t.bind(n))),e.get(n)};globalThis.MediaQueryList.prototype.addEventListener=function(e,t,o){n(this).addEventListener(e,t,o)},globalThis.MediaQueryList.prototype.removeEventListener=function(e,t,o){n(this).removeEventListener(e,t,o)},globalThis.MediaQueryList.prototype.dispatchEvent=function(e){n(this).dispatchEvent(e)}}}(),"Promise"in globalThis&&(Promise.prototype.finally instanceof Function||(Promise.prototype.finally=function(e){return this.then((async t=>(await e(),t)),(async t=>(await e(),t)))}),Promise.allSettled instanceof Function||(Promise.allSettled=function(e){return Promise.all(Array.from(e).map((function(e){return new Promise((function(t){e instanceof Promise||(e=Promise.resolve(e)),e.then((function(e){t({status:"fulfilled",value:e})})).catch((function(e){t({status:"rejected",reason:e})}))}))})))}),Promise.any instanceof Function||(Promise.any=e=>new Promise(((t,n)=>{let o=[];e.forEach((r=>{r.then(t).catch((t=>{o.push(t),o.length===e.length&&n(new globalThis.AggregateError(o,"No Promise in Promise.any was resolved"))}))}))}))),Promise.race instanceof Function||(Promise.race=e=>new Promise(((t,n)=>{e.forEach((e=>e.then(t,n)))}))),Promise.try instanceof Function||(Promise.try=e=>new Promise((t=>t(e())))),Promise.withResolvers instanceof Function||(Promise.withResolvers=function(){const e={};return e.promise=new Promise(((t,n)=>{e.resolve=t,e.reject=n})),e}))
|
|
8
|
+
*/const u=new Map,p=Symbol("lock-key"),d="locks"in navigator&&navigator.locks.request instanceof Function;const m=async function(){return await new Promise((e=>{"locks"in navigator&&navigator.locks.request instanceof Function?navigator.locks.query().then((()=>e(!0))).catch((()=>e(!1))):e(!1)}))}();async function f(e,t=null){return new Promise(((n,o)=>{var i;r(i=e)||i instanceof Promise?e.call(globalThis,t).then(n,o):queueMicrotask((()=>{try{const o=e.call(globalThis,t);n(o)}catch(e){o(e)}}))}))}async function h(e){u.has(e)&&await u.get(e).promise.catch(console.error)}function y(e,t,n){const{resolve:o,reject:r,promise:i}=function(){if(Promise.withResolvers instanceof Function)return Promise.withResolvers();{const e={};return e.promise=new Promise(((t,n)=>{e.resolve=t,e.reject=n})),e}}(),a=new AbortController,s=new c(e,t),l=function({name:e,mode:t}){switch(t){case"exclusive":return g().some((t=>t.name===e));case"shared":return g().some((t=>t.name===e&&"exclusive"===t.mode))}}(s);return u.set(s,{resolve:o,reject:r,promise:i,callback:n,pending:l,controller:a}),s}function b(e){return e instanceof c&&u.has(e)&&u.get(e).pending}function g(e){return"string"==typeof e?[...u.keys()].filter((t=>t.name===e)):[...u.keys()]}function w(e){return g(e).filter((e=>!b(e)))}function T(e){return g(e).filter((e=>b(e)))}async function v(e){switch(e.mode){case"exclusive":await Promise.allSettled(g().filter((t=>t.name===e.name&&t!==e)).map(h));break;case"shared":await Promise.allSettled(g().filter((t=>t.name===e.name&&"exclusive"===t.mode&&t!==e)).map(h))}}function E(e){if(u.has(e))return u.get(e).controller.signal}async function S(e){if(u.has(e)){const{resolve:t,reject:n,promise:o,callback:r,pending:i,controller:a}=u.get(e);return i&&function(e,t=!0){u.has(e)&&u.set(e,{...u.get(e),pending:t})}(e,!1),f(r,e).then(t,n).finally((()=>{u.delete(e),requestIdleCallback((()=>a.abort()))})),o}}class M{constructor(e){if(e!==p)throw new TypeError("Invalid constructor")}static async request(e,...t){let n,o={};t[0]instanceof Function?n=t[0]:t[1]instanceof Function&&([o,n]=t),"string"!=typeof e&&(e=e.toString());const{mode:r="exclusive",ifAvailable:i=!1,steal:a=!1,signal:s}=o;if(a&&i)throw new DOMException("LockManager.request: `steal` and `ifAvailable` cannot be used together");if(e.startsWith("-"))throw new DOMException("LockManager.request: Names starting with `-` are reserved");if(!["exclusive","shared"].includes(r))throw new TypeError(`LockManager.request: '${r}' (value of 'mode' member of LockOptions) is not a valid value for enumeration LockMode.`);if(s instanceof AbortSignal&&s.aborted)throw s.reason;if("shared"===r&&a)throw new DOMException("LockManager.request: `steal` is only supported for exclusive lock requests");const l=w(e),c=T(e),p=[...l,...c].some((t=>t.name===e));a&&p&&function(e){[...u.entries()].filter((([t])=>t.name===e)).forEach((([e,{reject:t,controller:n}])=>{requestIdleCallback((()=>{n.abort(),u.delete(e)})),t(new DOMException("The lock request is aborted"))}))}(e);const d=y(e,r,n);switch(s instanceof AbortSignal&&s.addEventListener("abort",(()=>{if(u.has(d)){const{reject:e,controller:t}=u.get(d);u.delete(d),e(new DOMException("The lock request is aborted")),t.abort()}}),{once:!0,signal:E(d)}),r){case"exclusive":if(!i||0===l.length&&0===c.length)return await v(d),await S(d);{const e=u.get(d).controller;return u.delete(d),await f(n,null).then((t=>(requestIdleCallback((()=>e.abort())),t)))}case"shared":if(i){if([...l,...c].some((e=>"exclusive"===e.mode))){const e=u.get(d).controller;return u.delete(d),await f(n,null).then((t=>(requestIdleCallback((()=>e.abort())),t)))}return await v(d),await S(d)}return await v(d),await S(d);default:throw new TypeError(`LockManager.request: '${r}' (value of 'mode' member of LockOptions) is not a valid value for enumeration LockMode.`)}}static async query(){return{held:w().map((({name:e,mode:t})=>({name:e,mode:t,clientId:null}))),pending:T().map((({name:e,mode:t})=>({name:e,mode:t,clientId:null})))}}}function A(e,t="error"){if(e instanceof Error){const{message:n,name:o,fileName:r,lineNumber:i,columnNumber:a}=e;return new ErrorEvent(t,{error:e,message:`${o}: ${n}`,filename:r,lineno:i,colno:a})}throw new TypeError("`errorToEvent()` only accepts Errors")}let L=!1;new Promise((async e=>{if(d)if(await m)e(!1);else try{navigator.locks.request=M.request,navigator.locks.query=M.query,L=!0,e(!0)}catch(t){globalThis.dispatchEvent(A(t)),e(!1)}else try{navigator.locks=M,L=!0,e(!0)}catch(t){globalThis.dispatchEvent(A(t)),e(!1)}})),navigator.canShare instanceof Function||(navigator.canShare=function({title:e,text:t,url:n,files:o}={}){return navigator.share instanceof Function&&(!Array.isArray(o)||0===o.length)&&(!![e,t,n].every((e=>void 0===e))||[e,t,n].some((e=>"string"==typeof e&&0!==e.length)))}),navigator.setAppBadge instanceof Function||(navigator.setAppBadge=async e=>{if(!Number.isInteger(e))throw new TypeError("Failed to execute 'setAppBadge' on 'Navigator': Value is not of type 'unsigned long long'");if(e<0)throw new TypeError("Failed to execute 'setAppBadge' on 'Navigator': Value is outside the 'unsigned long long' value range.");0===e?document.title.startsWith("(")&&(document.title=document.title.replace(/^\((\d{1,2}\+?)\)\s/,"")):e<100?(await navigator.clearAppBadge(),document.title=`(${e}) ${document.title}`):(await navigator.clearAppBadge(),document.title=`(99+) ${document.title}`)}),navigator.clearAppBadge instanceof Function||(navigator.clearAppBadge=()=>navigator.setAppBadge(0)),Navigator.prototype.hasOwnProperty("pdfViewerEnabled")||Object.defineProperty(navigator,"pdfViewerEnabled",{enumerable:!0,configurable:!1,writable:!1,value:!1}),Navigator.prototype.getInstalledRelatedApps instanceof Function||(Navigator.prototype.getInstalledRelatedApps=async()=>[]),Navigator.prototype.getGamepads instanceof Function||(Navigator.prototype.getGamepads=()=>[]),"hardwareConcurrency"in Navigator.prototype||Object.defineProperty(Navigator.prototype,"hardwareConcurrency",{get:()=>1}),"connection"in Navigator.prototype?"type"in navigator.connection||(navigator.connection.type="unknown"):Object.defineProperty(Navigator.prototype,"connection",{get:()=>Object.create(EventTarget.prototype,{type:{value:"unknown"},effectiveType:{value:"4g"},rtt:{value:NaN},downlink:{value:NaN},downlinkMax:{value:1/0},saveData:{value:!1},onchange:{value:null,writable:!0},ontypechange:{value:null,writable:!0}})}),"doNotTrack"in Navigator.prototype||Object.defineProperty(Navigator.prototype,"doNotTrack",{get:()=>"unspecified"}),"globalPrivacyControl"in Navigator.prototype||Object.defineProperty(Navigator.prototype,"globalPrivacyControl",{get:()=>!1}),function(){if(!(globalThis.requestIdleCallback instanceof Function)){const e=e=>Number.isSafeInteger(e)&&e>0;globalThis.requestIdleCallback=function(t,{timeout:n}={}){const o=performance.now(),r=()=>e(n)?Math.max(0,n-(performance.now()-o)):Math.max(0,600-(performance.now()-o));return setTimeout((()=>t({didTimeout:!!e(n)&&0===r(),timeRemaining:r})),1)}}globalThis.cancelIdleCallback instanceof Function||(globalThis.cancelIdleCallback=e=>clearTimeout(e)),globalThis.requestAnimationFrame instanceof Function||(globalThis.requestAnimationFrame=e=>setTimeout((()=>e(performance.now())),1e3/60)),globalThis.cancelAnimationFrame instanceof Function||(globalThis.cancelAnimationFrame=e=>clearTimeout(e)),globalThis.queueMicrotask instanceof Function||(globalThis.queueMicrotask=e=>Promise.resolve().then(e).catch((e=>setTimeout((()=>{throw e})))))}(),function(){if(!("AbortSignal"in globalThis)){const e={signal:Symbol("signal"),aborted:Symbol("aborted"),reason:Symbol("reason"),onabort:Symbol("onabort")};globalThis.AbortError=class extends Error{},globalThis.AbortSignal=class t extends EventTarget{constructor(){super(),Object.defineProperties(this,{[e.aborted]:{enumerable:!1,writable:!0,configurable:!1,value:!1},[e.reason]:{enumerable:!1,writable:!0,configurable:!1,value:void 0},[e.onabort]:{enumerable:!1,writable:!0,configurable:!1,value:null}}),this.addEventListener("abort",(e=>{this.onabort instanceof Function&&this.onabort.call(this,e)}))}get aborted(){return this[e.aborted]}get onabort(){return this[e.onabort]}set onabort(t){this[e.onabort]=t instanceof Function?t:null}get reason(){return this[e.reason]}throwIfAborted(){if(this.aborted)throw this.reason}static abort(n=new DOMException("Operation aborted")){const o=new t;return o[e.aborted]=!0,o[e.reason]=n,o}},globalThis.AbortController=class{constructor(){this[e.signal]=new AbortSignal}get signal(){return this[e.signal]}abort(t=new DOMException("Operation aborted")){const n=this.signal;n.aborted||(n[e.aborted]=!0,n[e.reason]=t,n.dispatchEvent(new Event("abort")))}}}if(!("reason"in AbortSignal.prototype)){const e=new WeakMap,t=AbortController.prototype.abort;if(AbortSignal.abort instanceof Function){const t=AbortSignal.abort;AbortSignal.abort=function(n=new DOMException("Operation aborted")){const o=t();return e.set(o,n),o}}else AbortSignal.abort=function(e=new DOMException("Operation aborted")){const t=new AbortController;return t.abort(e),t.reason};Object.defineProperty(AbortSignal.prototype,"reason",{enumerable:!0,configurable:!0,get:function(){return e.has(this)?e.get(this):void 0}}),AbortController.prototype.abort=function(n=new DOMException("Operation aborted")){e.set(this.signal,n),t.call(this)}}AbortSignal.prototype.throwIfAborted instanceof Function||(AbortSignal.prototype.throwIfAborted=function(){if(this.aborted)throw this.reason}),AbortSignal.timeout instanceof Function||(AbortSignal.timeout=function(e){if(void 0===e)throw new TypeError("At least one 1 argument required but only 0 passed");if(Number.isFinite(e)){if(e<0)throw new TypeError("Argument 1 is out of range for unsigned long long.");{const t=new AbortController;return setTimeout((()=>t.abort(new DOMException("The operation timed out."))),e),t.signal}}throw new TypeError("Argument 1 is not a finite value, so it is out of range for unsigned long long.")}),AbortSignal.any instanceof Function||(AbortSignal.any=function(e){if(!Array.isArray(e))throw new TypeError("Expected an array of signals");const t=new AbortController;for(const n of e){if(!(n instanceof AbortSignal)){const e=new TypeError("`signal` is not an `AbortSignal`");throw t.abort(e),e}if(n.aborted){t.abort(n.reason||new DOMException("Operation aborted."));break}n.addEventListener("abort",(({target:e})=>{t.abort(e.reason||new DOMException("Operation aborted."))}),{signal:t.signal})}return t.signal})}(),globalThis.hasOwnProperty("AggregateError")||(globalThis.AggregateError=class extends Error{constructor(e,t){void 0===t?(super(e),this.errors=[]):(super(t),this.errors=e)}}),globalThis.reportError instanceof Function||(globalThis.reportError=function(e){globalThis.dispatchEvent(A(e))}),function(){if("MediaQueryListEvent"in globalThis||(globalThis.MediaQueryListEvent=class extends Event{constructor(e,{media:t,matches:n}={}){super(e),Object.defineProperties(this,{media:{enumerable:!0,configurable:!1,writable:!1,value:t},matches:{enumerable:!0,configurable:!1,writable:!1,value:n}})}}),"MediaQueryList"in globalThis&&!(globalThis.MediaQueryList.prototype.addEventListener instanceof Function)){const e=new WeakMap,t=function(){const{media:e,matches:t}=this;this.dispatchEvent(new MediaQueryListEvent("change",{media:e,matches:t}))},n=function(n){return e.has(n)||(e.set(n,new EventTarget),n.addListener(t.bind(n))),e.get(n)};globalThis.MediaQueryList.prototype.addEventListener=function(e,t,o){n(this).addEventListener(e,t,o)},globalThis.MediaQueryList.prototype.removeEventListener=function(e,t,o){n(this).removeEventListener(e,t,o)},globalThis.MediaQueryList.prototype.dispatchEvent=function(e){n(this).dispatchEvent(e)}}}(),"Promise"in globalThis&&(Promise.prototype.finally instanceof Function||(Promise.prototype.finally=function(e){return this.then((async t=>(await e(),t)),(async t=>(await e(),t)))}),Promise.allSettled instanceof Function||(Promise.allSettled=function(e){return Promise.all(Array.from(e).map((function(e){return new Promise((function(t){e instanceof Promise||(e=Promise.resolve(e)),e.then((function(e){t({status:"fulfilled",value:e})})).catch((function(e){t({status:"rejected",reason:e})}))}))})))}),Promise.any instanceof Function||(Promise.any=e=>new Promise(((t,n)=>{let o=[];e.forEach((r=>{r.then(t).catch((t=>{o.push(t),o.length===e.length&&n(new globalThis.AggregateError(o,"No Promise in Promise.any was resolved"))}))}))}))),Promise.race instanceof Function||(Promise.race=e=>new Promise(((t,n)=>{e.forEach((e=>e.then(t,n)))}))),Promise.try instanceof Function||(Promise.try=e=>new Promise((t=>t(e())))),Promise.withResolvers instanceof Function||(Promise.withResolvers=function(){const e={};return e.promise=new Promise(((t,n)=>{e.resolve=t,e.reject=n})),e}))
|
|
9
9
|
/**
|
|
10
10
|
* @copyright 2023 Chris Zuber <admin@kernvalley.us>
|
|
11
11
|
*/;class k{get encoding(){return"utf-8"}encode(e){return new Uint8Array(e.split("").flatMap((e=>{const t=e.charCodeAt(0);if(t<128)return[t];return[194+Math.floor((t-128)/64),t%64+128]})))}encodeInto(e,t){if(t instanceof Uint8Array){const n=this.encode(e),o=Math.min(t.length,n.length);return n.length>t.length?t.set(n.slice(0,o)):t.set(n),{read:o,written:o}}throw new TypeError("TextEncoder.encodeInto: Argument 2 does not implement interface Uint8Array.")}}
|
|
@@ -24,23 +24,23 @@
|
|
|
24
24
|
/**
|
|
25
25
|
* @copyright 2023 Chris Zuber <admin@kernvalley.us>
|
|
26
26
|
*/
|
|
27
|
-
function
|
|
27
|
+
function H(){return"trustedTypes"in globalThis&&trustedTypes instanceof EventTarget&&trustedTypes.createPolicy instanceof Function}!O&&(globalThis.cookieStore=R),globalThis.hasOwnProperty("Animation")&&!Animation.prototype.hasOwnProperty("finished")&&Object.defineProperty(Animation.prototype,"finished",{get:function(){return new Promise(((e,t)=>{"finished"===this.playState?e(this):(this.addEventListener("finish",(()=>e(this)),{once:!0}),this.addEventListener("error",(e=>t(e)),{once:!0}))}))}}),globalThis.hasOwnProperty("Animation")&&!Animation.prototype.hasOwnProperty("ready")&&Object.defineProperty(Animation.prototype,"ready",{get:function(){return new Promise(((e,t)=>{this.pending?(this.addEventListener("ready",(()=>e(this)),{once:!0}),this.addEventListener("error",(e=>t(e)),{once:!0})):e(this)}))}});
|
|
28
28
|
/**
|
|
29
29
|
* @copyright 2023 Chris Zuber <admin@kernvalley.us>
|
|
30
30
|
*/
|
|
31
|
-
const
|
|
31
|
+
const j=Object.keys(Object.getOwnPropertyDescriptors(HTMLElement.prototype)).filter((e=>e.startsWith("on"))),U=["action","cite","formaction","href","ping","src"],q=s((async function(){const{ok:e,headers:t}=await fetch(location.href,{method:"HEAD"});if(e&&t.has("Content-Security-Policy")){const e=t.get("Content-Security-Policy").trim().split(";").filter((e=>0!==e.length));return Object.fromEntries(e.map((e=>{const[t,...n]=e.trim().split(" ").filter((e=>0!==e.length));return[t,n]})))}}));function z(){const e=document.head.querySelector('meta[http-equiv="Content-Security-Policy"][content]');if(e instanceof HTMLMetaElement){const t=e.content.trim().split(";").filter((e=>0!==e.length));return Object.fromEntries(t.map((e=>{const[t,...n]=e.trim().split(" ").filter((e=>0!==e.length));return[t,n]})))}return{}}
|
|
32
32
|
/**
|
|
33
33
|
* @copyright 2023 Chris Zuber <admin@kernvalley.us>
|
|
34
|
-
*/const $="1"===document.documentElement.dataset.fetchTrustCsp;function _({"trusted-types":e=null}={}){if(Array.isArray(e)){const t=new Set(e),n=t.has("'allow-duplicates'"),o=t.has("'none'");return n&&t.delete("'allow-duplicates'"),o&&t.clear(),t.add("empty#html"),t.add("empty#script"),{policies:t,allowDuplicates:n,hasNone:o}}return{}}const{allowDuplicates:V,allowedPolicies:B}=function(){const e=_(z());if("object"==typeof e&&e.policies instanceof Set){const{policies:t,allowDuplicates:n}=e;return{allowDuplicates:n,allowedPolicies:t}}{const e=(()=>{const e=_(z());return"object"==typeof e&&"allowDuplicates"in e?e.allowDuplicates:"1"===document.documentElement.dataset.allowTrustDuplicates})(),t=(()=>{if(document.documentElement.dataset.hasOwnProperty("trustedPolicies"))return new Set(["empty#html","empty#script",...document.documentElement.dataset.trustedPolicies.split(" ")]);{const{policies:e}=_(z());return e instanceof Set?e:new Set(["empty#html","empty#script"])}})();return t.has("'none'")&&t.clear(),t.add("empty#html"),t.add("empty#script"),{allowDuplicates:e,allowedPolicies:t}}}();
|
|
34
|
+
*/const $="1"===document.documentElement.dataset.fetchTrustCsp;function _({"trusted-types":e=null}={}){if(Array.isArray(e)){const t=new Set(e),n=t.has("'allow-duplicates'"),o=t.has("'none'");return n&&t.delete("'allow-duplicates'"),o&&t.clear(),t.add("empty#html"),t.add("empty#script"),{policies:t,allowDuplicates:n,hasNone:o}}return{}}const{allowDuplicates:V,allowedPolicies:B}=function(){const e=_(z());if("object"==typeof e&&e.policies instanceof Set){const{policies:t,allowDuplicates:n}=e;return{allowDuplicates:n,allowedPolicies:t}}{const e=(()=>{const e=_(z());return"object"==typeof e&&"allowDuplicates"in e?e.allowDuplicates:"1"===document.documentElement.dataset.allowTrustDuplicates})(),t=(()=>{if(document.documentElement.dataset.hasOwnProperty("trustedPolicies"))return new Set(["empty#html","empty#script",...document.documentElement.dataset.trustedPolicies.split(" ")]);{const{policies:e}=_(z());return e instanceof Set?e:new Set(["empty#html","empty#script"])}})();return t.has("'none'")&&t.clear(),t.add("empty#html"),t.add("empty#script"),{allowDuplicates:e,allowedPolicies:t}}}();H();const W={trustedValue:Symbol("[[Data]]"),trustedKey:Symbol("trusted-key"),emptyHTML:Symbol("policy-empty#html"),emptyScript:Symbol("policy-empty#script"),policy:Symbol.for("trust-policy"),defaultPolicy:Symbol("default-policy"),trustedTypesCSP:Symbol("trusted-types-csp")};Symbol.hasOwnProperty("toStringTag")||(Symbol.toStringTag=Symbol("Symbol.toStringTag"));const G=[];function K(e){return null!==function(e){return G.find((t=>t.name===e))||null}(e)}function Q(e,t){return function(){throw new TypeError(`Failed to execute '${t}' on 'TrustedTypePolicy': Policy ${e.name}'s TrustedTypePolicyOptions did not specify a '${t}' member.`)}}class X{constructor(e,{key:t,policy:n}){if(t!==W.trustedKey)throw new TypeError("Invalid constructor");Object.defineProperties(this,{[W.trustedValue]:{enumerable:!1,configurable:!1,writable:!1,value:e.toString()},[W.policy]:{enumerable:!1,configurable:!1,writable:!1,value:n.name}}),Object.freeze(this)}toString(){return this.valueOf()}toJSON(){return this.valueOf()}valueOf(){return this[W.trustedValue]}}class J extends X{[Symbol.toStringTag](){return"TrustedHTML"}}class Z extends X{[Symbol.toStringTag](){return"TrustedScript"}}class Y extends X{[Symbol.toStringTag](){return"TrustedScriptURL"}}class ee{constructor(e,{createHTML:t,createScript:n,createScriptURL:o}={},{key:r}){if(r!==W.trustedKey)throw new TypeError("Invalid constructor");Object.defineProperties(this,{name:{enumerable:!0,configurable:!1,writable:!1,value:e.toString()},createHTML:{enumerable:!0,configurable:!1,writable:!1,value:t instanceof Function?(e,...n)=>new J(t(e.toString(),...n),{key:W.trustedKey,policy:this}):Q(this,"createHTML")},createScript:{enumerable:!0,configurable:!1,writable:!1,value:n instanceof Function?(e,...t)=>new Z(n(e.toString(),...t),{key:W.trustedKey,policy:this}):Q(this,"createScript")},createScriptURL:{enumerable:!0,configurable:!1,writable:!1,value:o instanceof Function?(e,...t)=>new Y(o(e.toString(),...t),{key:W.trustedKey,policy:this}):Q(this,"createScriptURL")}})}}class te extends EventTarget{constructor(e){if(super(),e!==W.trustedKey)throw new TypeError("Invalid constructor");$&&async function(){const{policies:e,allowDuplicates:t=!1,hasNone:n=!1}=await q().then(_);return e instanceof Set?{policies:e,allowDuplicates:t,hasNone:n}:{}}().then((({policies:e,allowDuplicates:t=!1,hasNone:n=!1})=>{void 0!==e&&Object.defineProperty(te,W.trustedTypesCSP,{value:{policies:e,allowDuplicates:t,hasNone:n},enumberable:!1,writable:!1,configurable:!1})})).catch((e=>console.error(e))),Object.defineProperties(this,{[W.defaultPolicy]:{enumerable:!1,configurable:!1,writable:!0,value:null},[W.emptyHTML]:{enumerable:!1,configurable:!1,writable:!1,value:this.createPolicy("empty#html",{createHTML:()=>""})},[W.emptyScript]:{enumerable:!1,configurable:!1,writable:!1,value:this.createPolicy("empty#script",{createScript:()=>""})}})}isHTML(e){return e instanceof globalThis.TrustedHTML}isScript(e){return e instanceof globalThis.TrustedScript}isScriptURL(e){return e instanceof globalThis.TrustedScriptURL}createPolicy(e,{createHTML:t,createScript:n,createScriptURL:o}={}){const r=new ee(e,{createHTML:t,createScript:n,createScriptURL:o},{key:W.trustedKey});if(!e.toString().match(/^[-#a-zA-Z0-9=_/@.%]+$/g))throw new TypeError(`Failed to execute 'createPolicy' on 'TrustedTypePolicyFactory': Policy: "${e}" contains invalid characters.`);if(te.hasOwnProperty(W.trustedTypesCSP)){const{policies:t,allowDuplicates:n,hasNone:o}=te[W.trustedTypesCSP];if(o&&"empty#html"!==e&&"empty#script"!==e)throw new TypeError(`Failed to execute 'createPolicy' on 'TrustedTypePolicyFactory': Policy: "${e}" disallowed.`);if(!t.has(e))throw new TypeError(`Failed to execute 'createPolicy' on 'TrustedTypePolicyFactory': Policy: "${e}" disallowed.`);if(!n&&K(e))throw new TypeError(`Failed to execute 'createPolicy' on 'TrustedTypePolicyFactory': Policy: "${e}" already exists.`)}else{if(B.size>2&&!B.has(e))throw new TypeError(`Failed to execute 'createPolicy' on 'TrustedTypePolicyFactory': Policy: "${e}" disallowed.`);if(!V&&K(e))throw new TypeError(`Failed to execute 'createPolicy' on 'TrustedTypePolicyFactory': Policy: "${e}" already exists.`)}return"default"===r.name&&(this[W.defaultPolicy]=r),G.push(r),r}getAttributeType(e,t,n){if(e=e.toLowerCase(),t=t.toLowerCase(),"string"==typeof elementNS&&0!==n.length)return j.includes(t)?"TrustedScript":null;if(j.includes(t))return"TrustedScript";switch(e){case"script":return"src"===t?"TrustedScriptURL":null;case"iframe":return"srcdoc"===t?"TrustedHTML":"src"===t?"TrustedScriptURL":null;default:return null}}getPropertyType(e,t){if(e=e.toLowerCase(),j.includes(t.toLowerCase()))return"TrustedScript";switch(e){case"embed":case"iframe":return"src"===t?"TrustedScriptURL":null;case"script":return"src"===t?"TrustedScriptURL":["text","innerText","textContent","innerHTML"].includes(t)?"TrustedScript":["outerHTML"].includes(t)?"TrustedHTML":null;default:return["innerHTML","outerHTML"].includes(t)?"TrustedHTML":null}}get emptyHTML(){return this[W.emptyHTML].createHTML("")}get emptyScript(){return this[W.emptyScript].createScript("")}get defaultPolicy(){return this[W.defaultPolicy]}get _isPolyfill_(){return!0}static get allowDuplicates(){return V}}const ne=new te(W.trustedKey);!function(){if("TrustedTypePolicyFactory"in globalThis||(globalThis.TrustedTypePolicyFactory=te),"TrustedTypePolicy"in globalThis||(globalThis.TrustedTypePolicy=ee),"TrustedType"in globalThis||(globalThis.TrustedType=X),"TrustedHTML"in globalThis||(globalThis.TrustedHTML=J),"TrustedScript"in globalThis||(globalThis.TrustedScript=Z),"TrustedScriptURL"in globalThis||(globalThis.TrustedScriptURL=Y),"trustedTypes"in globalThis)try{globalThis.trustedTypes.createPolicy("empty#html",{createHTML:()=>""}),globalThis.trustedTypes.createPolicy("empty#script",{createScript:()=>""})}catch(e){console.error(e)}else globalThis.trustedTypes=ne}();
|
|
35
35
|
/**
|
|
36
36
|
* @copyright 2023 Chris Zuber <admin@kernvalley.us>
|
|
37
37
|
* @see https://wicg.github.io/sanitizer-api/#default-configuration-dictionary
|
|
38
38
|
*/
|
|
39
|
-
const oe=JSON.parse('{\n "allowCustomElements": false,\n "allowUnknownMarkup": false,\n "allowElements": [\n "a",\n "abbr",\n "acronym",\n "address",\n "area",\n "article",\n "aside",\n "audio",\n "b",\n "bdi",\n "bdo",\n "bgsound",\n "big",\n "blockquote",\n "body",\n "br",\n "button",\n "canvas",\n "caption",\n "center",\n "cite",\n "code",\n "col",\n "colgroup",\n "datalist",\n "dd",\n "del",\n "details",\n "dfn",\n "dialog",\n "dir",\n "div",\n "dl",\n "dt",\n "em",\n "fieldset",\n "figcaption",\n "figure",\n "font",\n "footer",\n "form",\n "h1",\n "h2",\n "h3",\n "h4",\n "h5",\n "h6",\n "head",\n "header",\n "hgroup",\n "hr",\n "html",\n "i",\n "img",\n "input",\n "ins",\n "kbd",\n "keygen",\n "label",\n "layer",\n "legend",\n "li",\n "link",\n "listing",\n "main",\n "map",\n "mark",\n "marquee",\n "menu",\n "meta",\n "meter",\n "nav",\n "nobr",\n "ol",\n "optgroup",\n "option",\n "output",\n "p",\n "picture",\n "popup",\n "pre",\n "progress",\n "q",\n "rb",\n "rp",\n "rt",\n "rtc",\n "ruby",\n "s",\n "samp",\n "section",\n "select",\n "selectmenu",\n "small",\n "source",\n "span",\n "strike",\n "strong",\n "style",\n "sub",\n "summary",\n "sup",\n "table",\n "tbody",\n "td",\n "tfoot",\n "th",\n "thead",\n "time",\n "tr",\n "track",\n "tt",\n "u",\n "ul",\n "var",\n "video",\n "wbr"\n ],\n "allowAttributes": {\n "abbr": [\n "*"\n ],\n "accept": [\n "*"\n ],\n "accept-charset": [\n "*"\n ],\n "accesskey": [\n "*"\n ],\n "action": [\n "*"\n ],\n "align": [\n "*"\n ],\n "alink": [\n "*"\n ],\n "allow": [\n "*"\n ],\n "allowfullscreen": [\n "*"\n ],\n "alt": [\n "*"\n ],\n "anchor": [\n "*"\n ],\n "archive": [\n "*"\n ],\n "as": [\n "*"\n ],\n "async": [\n "*"\n ],\n "autocapitalize": [\n "*"\n ],\n "autocomplete": [\n "*"\n ],\n "autocorrect": [\n "*"\n ],\n "autofocus": [\n "*"\n ],\n "autopictureinpicture": [\n "*"\n ],\n "autoplay": [\n "*"\n ],\n "axis": [\n "*"\n ],\n "background": [\n "*"\n ],\n "behavior": [\n "*"\n ],\n "bgcolor": [\n "*"\n ],\n "border": [\n "*"\n ],\n "bordercolor": [\n "*"\n ],\n "capture": [\n "*"\n ],\n "cellpadding": [\n "*"\n ],\n "cellspacing": [\n "*"\n ],\n "challenge": [\n "*"\n ],\n "char": [\n "*"\n ],\n "charoff": [\n "*"\n ],\n "charset": [\n "*"\n ],\n "checked": [\n "*"\n ],\n "cite": [\n "*"\n ],\n "class": [\n "*"\n ],\n "classid": [\n "*"\n ],\n "clear": [\n "*"\n ],\n "code": [\n "*"\n ],\n "codebase": [\n "*"\n ],\n "codetype": [\n "*"\n ],\n "color": [\n "*"\n ],\n "cols": [\n "*"\n ],\n "colspan": [\n "*"\n ],\n "compact": [\n "*"\n ],\n "content": [\n "*"\n ],\n "contenteditable": [\n "*"\n ],\n "controls": [\n "*"\n ],\n "controlslist": [\n "*"\n ],\n "conversiondestination": [\n "*"\n ],\n "coords": [\n "*"\n ],\n "crossorigin": [\n "*"\n ],\n "csp": [\n "*"\n ],\n "data": [\n "*"\n ],\n "datetime": [\n "*"\n ],\n "declare": [\n "*"\n ],\n "decoding": [\n "*"\n ],\n "default": [\n "*"\n ],\n "defer": [\n "*"\n ],\n "dir": [\n "*"\n ],\n "direction": [\n "*"\n ],\n "dirname": [\n "*"\n ],\n "disabled": [\n "*"\n ],\n "disablepictureinpicture": [\n "*"\n ],\n "disableremoteplayback": [\n "*"\n ],\n "disallowdocumentaccess": [\n "*"\n ],\n "download": [\n "*"\n ],\n "draggable": [\n "*"\n ],\n "elementtiming": [\n "*"\n ],\n "enctype": [\n "*"\n ],\n "end": [\n "*"\n ],\n "enterkeyhint": [\n "*"\n ],\n "event": [\n "*"\n ],\n "exportparts": [\n "*"\n ],\n "face": [\n "*"\n ],\n "for": [\n "*"\n ],\n "form": [\n "*"\n ],\n "formaction": [\n "*"\n ],\n "formenctype": [\n "*"\n ],\n "formmethod": [\n "*"\n ],\n "formnovalidate": [\n "*"\n ],\n "formtarget": [\n "*"\n ],\n "frame": [\n "*"\n ],\n "frameborder": [\n "*"\n ],\n "headers": [\n "*"\n ],\n "height": [\n "*"\n ],\n "hidden": [\n "*"\n ],\n "high": [\n "*"\n ],\n "href": [\n "*"\n ],\n "hreflang": [\n "*"\n ],\n "hreftranslate": [\n "*"\n ],\n "hspace": [\n "*"\n ],\n "http-equiv": [\n "*"\n ],\n "id": [\n "*"\n ],\n "imagesizes": [\n "*"\n ],\n "imagesrcset": [\n "*"\n ],\n "importance": [\n "*"\n ],\n "impressiondata": [\n "*"\n ],\n "impressionexpiry": [\n "*"\n ],\n "incremental": [\n "*"\n ],\n "inert": [\n "*"\n ],\n "inputmode": [\n "*"\n ],\n "integrity": [\n "*"\n ],\n "invisible": [\n "*"\n ],\n "is": [\n "*"\n ],\n "ismap": [\n "*"\n ],\n "keytype": [\n "*"\n ],\n "kind": [\n "*"\n ],\n "label": [\n "*"\n ],\n "lang": [\n "*"\n ],\n "language": [\n "*"\n ],\n "latencyhint": [\n "*"\n ],\n "leftmargin": [\n "*"\n ],\n "link": [\n "*"\n ],\n "list": [\n "*"\n ],\n "loading": [\n "*"\n ],\n "longdesc": [\n "*"\n ],\n "loop": [\n "*"\n ],\n "low": [\n "*"\n ],\n "lowsrc": [\n "*"\n ],\n "manifest": [\n "*"\n ],\n "marginheight": [\n "*"\n ],\n "marginwidth": [\n "*"\n ],\n "max": [\n "*"\n ],\n "maxlength": [\n "*"\n ],\n "mayscript": [\n "*"\n ],\n "media": [\n "*"\n ],\n "method": [\n "*"\n ],\n "min": [\n "*"\n ],\n "minlength": [\n "*"\n ],\n "multiple": [\n "*"\n ],\n "muted": [\n "*"\n ],\n "name": [\n "*"\n ],\n "nohref": [\n "*"\n ],\n "nomodule": [\n "*"\n ],\n "nonce": [\n "*"\n ],\n "noresize": [\n "*"\n ],\n "noshade": [\n "*"\n ],\n "novalidate": [\n "*"\n ],\n "nowrap": [\n "*"\n ],\n "object": [\n "*"\n ],\n "open": [\n "*"\n ],\n "optimum": [\n "*"\n ],\n "part": [\n "*"\n ],\n "pattern": [\n "*"\n ],\n "ping": [\n "*"\n ],\n "placeholder": [\n "*"\n ],\n "playsinline": [\n "*"\n ],\n "policy": [\n "*"\n ],\n "poster": [\n "*"\n ],\n "preload": [\n "*"\n ],\n "pseudo": [\n "*"\n ],\n "readonly": [\n "*"\n ],\n "referrerpolicy": [\n "*"\n ],\n "rel": [\n "*"\n ],\n "reportingorigin": [\n "*"\n ],\n "required": [\n "*"\n ],\n "resources": [\n "*"\n ],\n "rev": [\n "*"\n ],\n "reversed": [\n "*"\n ],\n "role": [\n "*"\n ],\n "rows": [\n "*"\n ],\n "rowspan": [\n "*"\n ],\n "rules": [\n "*"\n ],\n "sandbox": [\n "*"\n ],\n "scheme": [\n "*"\n ],\n "scope": [\n "*"\n ],\n "scopes": [\n "*"\n ],\n "scrollamount": [\n "*"\n ],\n "scrolldelay": [\n "*"\n ],\n "scrolling": [\n "*"\n ],\n "select": [\n "*"\n ],\n "selected": [\n "*"\n ],\n "shadowroot": [\n "*"\n ],\n "shadowrootdelegatesfocus": [\n "*"\n ],\n "shape": [\n "*"\n ],\n "size": [\n "*"\n ],\n "sizes": [\n "*"\n ],\n "slot": [\n "*"\n ],\n "span": [\n "*"\n ],\n "spellcheck": [\n "*"\n ],\n "src": [\n "*"\n ],\n "srcdoc": [\n "*"\n ],\n "srclang": [\n "*"\n ],\n "srcset": [\n "*"\n ],\n "standby": [\n "*"\n ],\n "start": [\n "*"\n ],\n "step": [\n "*"\n ],\n "style": [\n "*"\n ],\n "summary": [\n "*"\n ],\n "tabindex": [\n "*"\n ],\n "target": [\n "*"\n ],\n "text": [\n "*"\n ],\n "title": [\n "*"\n ],\n "topmargin": [\n "*"\n ],\n "translate": [\n "*"\n ],\n "truespeed": [\n "*"\n ],\n "trusttoken": [\n "*"\n ],\n "type": [\n "*"\n ],\n "usemap": [\n "*"\n ],\n "valign": [\n "*"\n ],\n "value": [\n "*"\n ],\n "valuetype": [\n "*"\n ],\n "version": [\n "*"\n ],\n "virtualkeyboardpolicy": [\n "*"\n ],\n "vlink": [\n "*"\n ],\n "vspace": [\n "*"\n ],\n "webkitdirectory": [\n "*"\n ],\n "width": [\n "*"\n ],\n "wrap": [\n "*"\n ]\n }\n}'),re=function(e,t,n=oe){const o=ue(t,n);e.replaceChildren(le(o))},ie=["https:"];ie.includes(location.protocol)||ie.push(location.protocol);const ae=s((()=>function(e,{createHTML:t=(()=>{throw new TypeError("This policy does not provide `createHTML()`")}),createScript:n=(()=>{throw new TypeError("This policy does not provide `createScript()`")}),createScriptURL:o=(()=>{throw new TypeError("This policy does not provide `createScriptURL()`")})}){return j()?trustedTypes.createPolicy(e,{createHTML:t,createScript:n,createScriptURL:o}):Object.freeze({name:e,createHTML:(e,...n)=>t(e.toString(),...n),createScript:(e,...t)=>n(e.toString(),...t),createScriptURL:(e,...t)=>o(e.toString(),...t)})}("sanitizer-raw#html",{createHTML:e=>e}))),se=e=>ae().createHTML(e);function le(e){const t=document.createDocumentFragment(),n=e.cloneNode(!0);return t.append(...n.head.childNodes,...n.body.childNodes),t}function ce({allowAttributes:e,allowComments:t,allowElements:n,allowCustomElements:o,blockElements:r,dropAttributes:i,dropElements:a,allowUnknownMarkup:s,sanitizer:l}={},c){return l instanceof Sanitizer?ce(l.getConfiguration(),c):(void 0===e&&void 0===i&&(e=oe.allowAttributes),void 0===n&&void 0===a&&(n=oe.allowElements),{allowAttributes:e,allowComments:t,allowElements:n,allowCustomElements:o,blockElements:r,dropAttributes:i,dropElements:a,allowUnknownMarkup:s})}function ue(e,t=oe){const n=(new DOMParser).parseFromString(se(e),"text/html");return Array.isArray(t.allowElements)&&!t.allowElements.includes("html")&&(t.allowElements=[...new Set([...t.allowElements,"html","head","body"])]),de(n,t)}function pe(e,t=oe){if(e instanceof Node){if(e.nodeType===Node.DOCUMENT_FRAGMENT_NODE)return de(e,t);if(e.nodeType===Node.DOCUMENT_NODE)return de(le(e),t);throw new TypeError("sanitize requires a Document or DocumentFragment")}throw new TypeError("sanitize requires a Document or DocumentFragment")}function de(e,t=oe){try{if(!(e instanceof Node))throw new TypeError(`Expected a Node but got a ${a(e)}.`);if(!i(t))throw new TypeError(`Expected config to be an object but got ${a(t)}.`);const{allowElements:n,allowComments:o,allowAttributes:r,allowCustomElements:s,blockElements:l,dropAttributes:c,dropElements:u,allowUnknownMarkup:p}=ce(t),d=document.createNodeIterator(e,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_COMMENT);let m=d.root.nodeType===Node.ELEMENT_NODE?d.root:d.nextNode();for(;m instanceof Node;){switch(m.nodeType){case Node.ELEMENT_NODE:{if(!p&&(!(m instanceof HTMLElement)||m instanceof HTMLUnknownElement)){m.remove();break}const e=m.tagName.toLowerCase();Array.isArray(u)&&u.includes(e)?m.remove():Array.isArray(l)&&l.includes(e)?m.hasChildNodes()?m.replaceWith(...m.childNodes):m.remove():e.includes("-")&&!s||Array.isArray(n)&&!n.includes(e)?m.remove():m.hasAttributes()&&m.getAttributeNames().forEach((t=>{const n=m.getAttributeNode(t),{value:o}=n;U.includes(t)&&!ie.includes(new URL(o,document.baseURI).protocol)?m.removeAttributeNode(n):i(c)?t in c&&["*",e].some((e=>c[t].includes(e)))&&m.removeAttributeNode(n):i(r)&&(t in r&&["*",e].some((e=>r[t].includes(e)))||m.removeAttributeNode(n))}));break}case Node.COMMENT_NODE:o||m.remove()}"template"===m.localName&&de(m.content,t),m=d.nextNode()}return e}catch(t){console.error(t),e.parentElement.removeChild(e)}}
|
|
39
|
+
const oe=JSON.parse('{\n "allowCustomElements": false,\n "allowUnknownMarkup": false,\n "allowElements": [\n "a",\n "abbr",\n "acronym",\n "address",\n "area",\n "article",\n "aside",\n "audio",\n "b",\n "bdi",\n "bdo",\n "bgsound",\n "big",\n "blockquote",\n "body",\n "br",\n "button",\n "canvas",\n "caption",\n "center",\n "cite",\n "code",\n "col",\n "colgroup",\n "datalist",\n "dd",\n "del",\n "details",\n "dfn",\n "dialog",\n "dir",\n "div",\n "dl",\n "dt",\n "em",\n "fieldset",\n "figcaption",\n "figure",\n "font",\n "footer",\n "form",\n "h1",\n "h2",\n "h3",\n "h4",\n "h5",\n "h6",\n "head",\n "header",\n "hgroup",\n "hr",\n "html",\n "i",\n "img",\n "input",\n "ins",\n "kbd",\n "keygen",\n "label",\n "layer",\n "legend",\n "li",\n "link",\n "listing",\n "main",\n "map",\n "mark",\n "marquee",\n "menu",\n "meta",\n "meter",\n "nav",\n "nobr",\n "ol",\n "optgroup",\n "option",\n "output",\n "p",\n "picture",\n "popup",\n "pre",\n "progress",\n "q",\n "rb",\n "rp",\n "rt",\n "rtc",\n "ruby",\n "s",\n "samp",\n "section",\n "select",\n "selectmenu",\n "small",\n "source",\n "span",\n "strike",\n "strong",\n "style",\n "sub",\n "summary",\n "sup",\n "table",\n "tbody",\n "td",\n "tfoot",\n "th",\n "thead",\n "time",\n "tr",\n "track",\n "tt",\n "u",\n "ul",\n "var",\n "video",\n "wbr"\n ],\n "allowAttributes": {\n "abbr": [\n "*"\n ],\n "accept": [\n "*"\n ],\n "accept-charset": [\n "*"\n ],\n "accesskey": [\n "*"\n ],\n "action": [\n "*"\n ],\n "align": [\n "*"\n ],\n "alink": [\n "*"\n ],\n "allow": [\n "*"\n ],\n "allowfullscreen": [\n "*"\n ],\n "alt": [\n "*"\n ],\n "anchor": [\n "*"\n ],\n "archive": [\n "*"\n ],\n "as": [\n "*"\n ],\n "async": [\n "*"\n ],\n "autocapitalize": [\n "*"\n ],\n "autocomplete": [\n "*"\n ],\n "autocorrect": [\n "*"\n ],\n "autofocus": [\n "*"\n ],\n "autopictureinpicture": [\n "*"\n ],\n "autoplay": [\n "*"\n ],\n "axis": [\n "*"\n ],\n "background": [\n "*"\n ],\n "behavior": [\n "*"\n ],\n "bgcolor": [\n "*"\n ],\n "border": [\n "*"\n ],\n "bordercolor": [\n "*"\n ],\n "capture": [\n "*"\n ],\n "cellpadding": [\n "*"\n ],\n "cellspacing": [\n "*"\n ],\n "challenge": [\n "*"\n ],\n "char": [\n "*"\n ],\n "charoff": [\n "*"\n ],\n "charset": [\n "*"\n ],\n "checked": [\n "*"\n ],\n "cite": [\n "*"\n ],\n "class": [\n "*"\n ],\n "classid": [\n "*"\n ],\n "clear": [\n "*"\n ],\n "code": [\n "*"\n ],\n "codebase": [\n "*"\n ],\n "codetype": [\n "*"\n ],\n "color": [\n "*"\n ],\n "cols": [\n "*"\n ],\n "colspan": [\n "*"\n ],\n "compact": [\n "*"\n ],\n "content": [\n "*"\n ],\n "contenteditable": [\n "*"\n ],\n "controls": [\n "*"\n ],\n "controlslist": [\n "*"\n ],\n "conversiondestination": [\n "*"\n ],\n "coords": [\n "*"\n ],\n "crossorigin": [\n "*"\n ],\n "csp": [\n "*"\n ],\n "data": [\n "*"\n ],\n "datetime": [\n "*"\n ],\n "declare": [\n "*"\n ],\n "decoding": [\n "*"\n ],\n "default": [\n "*"\n ],\n "defer": [\n "*"\n ],\n "dir": [\n "*"\n ],\n "direction": [\n "*"\n ],\n "dirname": [\n "*"\n ],\n "disabled": [\n "*"\n ],\n "disablepictureinpicture": [\n "*"\n ],\n "disableremoteplayback": [\n "*"\n ],\n "disallowdocumentaccess": [\n "*"\n ],\n "download": [\n "*"\n ],\n "draggable": [\n "*"\n ],\n "elementtiming": [\n "*"\n ],\n "enctype": [\n "*"\n ],\n "end": [\n "*"\n ],\n "enterkeyhint": [\n "*"\n ],\n "event": [\n "*"\n ],\n "exportparts": [\n "*"\n ],\n "face": [\n "*"\n ],\n "for": [\n "*"\n ],\n "form": [\n "*"\n ],\n "formaction": [\n "*"\n ],\n "formenctype": [\n "*"\n ],\n "formmethod": [\n "*"\n ],\n "formnovalidate": [\n "*"\n ],\n "formtarget": [\n "*"\n ],\n "frame": [\n "*"\n ],\n "frameborder": [\n "*"\n ],\n "headers": [\n "*"\n ],\n "height": [\n "*"\n ],\n "hidden": [\n "*"\n ],\n "high": [\n "*"\n ],\n "href": [\n "*"\n ],\n "hreflang": [\n "*"\n ],\n "hreftranslate": [\n "*"\n ],\n "hspace": [\n "*"\n ],\n "http-equiv": [\n "*"\n ],\n "id": [\n "*"\n ],\n "imagesizes": [\n "*"\n ],\n "imagesrcset": [\n "*"\n ],\n "importance": [\n "*"\n ],\n "impressiondata": [\n "*"\n ],\n "impressionexpiry": [\n "*"\n ],\n "incremental": [\n "*"\n ],\n "inert": [\n "*"\n ],\n "inputmode": [\n "*"\n ],\n "integrity": [\n "*"\n ],\n "invisible": [\n "*"\n ],\n "is": [\n "*"\n ],\n "ismap": [\n "*"\n ],\n "keytype": [\n "*"\n ],\n "kind": [\n "*"\n ],\n "label": [\n "*"\n ],\n "lang": [\n "*"\n ],\n "language": [\n "*"\n ],\n "latencyhint": [\n "*"\n ],\n "leftmargin": [\n "*"\n ],\n "link": [\n "*"\n ],\n "list": [\n "*"\n ],\n "loading": [\n "*"\n ],\n "longdesc": [\n "*"\n ],\n "loop": [\n "*"\n ],\n "low": [\n "*"\n ],\n "lowsrc": [\n "*"\n ],\n "manifest": [\n "*"\n ],\n "marginheight": [\n "*"\n ],\n "marginwidth": [\n "*"\n ],\n "max": [\n "*"\n ],\n "maxlength": [\n "*"\n ],\n "mayscript": [\n "*"\n ],\n "media": [\n "*"\n ],\n "method": [\n "*"\n ],\n "min": [\n "*"\n ],\n "minlength": [\n "*"\n ],\n "multiple": [\n "*"\n ],\n "muted": [\n "*"\n ],\n "name": [\n "*"\n ],\n "nohref": [\n "*"\n ],\n "nomodule": [\n "*"\n ],\n "nonce": [\n "*"\n ],\n "noresize": [\n "*"\n ],\n "noshade": [\n "*"\n ],\n "novalidate": [\n "*"\n ],\n "nowrap": [\n "*"\n ],\n "object": [\n "*"\n ],\n "open": [\n "*"\n ],\n "optimum": [\n "*"\n ],\n "part": [\n "*"\n ],\n "pattern": [\n "*"\n ],\n "ping": [\n "*"\n ],\n "placeholder": [\n "*"\n ],\n "playsinline": [\n "*"\n ],\n "policy": [\n "*"\n ],\n "poster": [\n "*"\n ],\n "preload": [\n "*"\n ],\n "pseudo": [\n "*"\n ],\n "readonly": [\n "*"\n ],\n "referrerpolicy": [\n "*"\n ],\n "rel": [\n "*"\n ],\n "reportingorigin": [\n "*"\n ],\n "required": [\n "*"\n ],\n "resources": [\n "*"\n ],\n "rev": [\n "*"\n ],\n "reversed": [\n "*"\n ],\n "role": [\n "*"\n ],\n "rows": [\n "*"\n ],\n "rowspan": [\n "*"\n ],\n "rules": [\n "*"\n ],\n "sandbox": [\n "*"\n ],\n "scheme": [\n "*"\n ],\n "scope": [\n "*"\n ],\n "scopes": [\n "*"\n ],\n "scrollamount": [\n "*"\n ],\n "scrolldelay": [\n "*"\n ],\n "scrolling": [\n "*"\n ],\n "select": [\n "*"\n ],\n "selected": [\n "*"\n ],\n "shadowroot": [\n "*"\n ],\n "shadowrootdelegatesfocus": [\n "*"\n ],\n "shape": [\n "*"\n ],\n "size": [\n "*"\n ],\n "sizes": [\n "*"\n ],\n "slot": [\n "*"\n ],\n "span": [\n "*"\n ],\n "spellcheck": [\n "*"\n ],\n "src": [\n "*"\n ],\n "srcdoc": [\n "*"\n ],\n "srclang": [\n "*"\n ],\n "srcset": [\n "*"\n ],\n "standby": [\n "*"\n ],\n "start": [\n "*"\n ],\n "step": [\n "*"\n ],\n "style": [\n "*"\n ],\n "summary": [\n "*"\n ],\n "tabindex": [\n "*"\n ],\n "target": [\n "*"\n ],\n "text": [\n "*"\n ],\n "title": [\n "*"\n ],\n "topmargin": [\n "*"\n ],\n "translate": [\n "*"\n ],\n "truespeed": [\n "*"\n ],\n "trusttoken": [\n "*"\n ],\n "type": [\n "*"\n ],\n "usemap": [\n "*"\n ],\n "valign": [\n "*"\n ],\n "value": [\n "*"\n ],\n "valuetype": [\n "*"\n ],\n "version": [\n "*"\n ],\n "virtualkeyboardpolicy": [\n "*"\n ],\n "vlink": [\n "*"\n ],\n "vspace": [\n "*"\n ],\n "webkitdirectory": [\n "*"\n ],\n "width": [\n "*"\n ],\n "wrap": [\n "*"\n ]\n }\n}'),re=function(e,t,n=oe){const o=ue(t,n);e.replaceChildren(le(o))},ie=["https:"];ie.includes(location.protocol)||ie.push(location.protocol);const ae=s((()=>function(e,{createHTML:t=(()=>{throw new TypeError("This policy does not provide `createHTML()`")}),createScript:n=(()=>{throw new TypeError("This policy does not provide `createScript()`")}),createScriptURL:o=(()=>{throw new TypeError("This policy does not provide `createScriptURL()`")})}){return H()?trustedTypes.createPolicy(e,{createHTML:t,createScript:n,createScriptURL:o}):Object.freeze({name:e,createHTML:(e,...n)=>t(e.toString(),...n),createScript:(e,...t)=>n(e.toString(),...t),createScriptURL:(e,...t)=>o(e.toString(),...t)})}("sanitizer-raw#html",{createHTML:e=>e}))),se=e=>ae().createHTML(e);function le(e){const t=document.createDocumentFragment(),n=e.cloneNode(!0);return t.append(...n.head.childNodes,...n.body.childNodes),t}function ce({allowAttributes:e,allowComments:t,allowElements:n,allowCustomElements:o,blockElements:r,dropAttributes:i,dropElements:a,allowUnknownMarkup:s,sanitizer:l}={},c){return l instanceof Sanitizer?ce(l.getConfiguration(),c):(void 0===e&&void 0===i&&(e=oe.allowAttributes),void 0===n&&void 0===a&&(n=oe.allowElements),{allowAttributes:e,allowComments:t,allowElements:n,allowCustomElements:o,blockElements:r,dropAttributes:i,dropElements:a,allowUnknownMarkup:s})}function ue(e,t=oe){const n=(new DOMParser).parseFromString(se(e),"text/html");return Array.isArray(t.allowElements)&&!t.allowElements.includes("html")&&(t.allowElements=[...new Set([...t.allowElements,"html","head","body"])]),de(n,t)}function pe(e,t=oe){if(e instanceof Node){if(e.nodeType===Node.DOCUMENT_FRAGMENT_NODE)return de(e,t);if(e.nodeType===Node.DOCUMENT_NODE)return de(le(e),t);throw new TypeError("sanitize requires a Document or DocumentFragment")}throw new TypeError("sanitize requires a Document or DocumentFragment")}function de(e,t=oe){try{if(!(e instanceof Node))throw new TypeError(`Expected a Node but got a ${a(e)}.`);if(!i(t))throw new TypeError(`Expected config to be an object but got ${a(t)}.`);const{allowElements:n,allowComments:o,allowAttributes:r,allowCustomElements:s,blockElements:l,dropAttributes:c,dropElements:u,allowUnknownMarkup:p}=ce(t),d=document.createNodeIterator(e,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_COMMENT);let m=d.root.nodeType===Node.ELEMENT_NODE?d.root:d.nextNode();for(;m instanceof Node;){switch(m.nodeType){case Node.ELEMENT_NODE:{if(!p&&(!(m instanceof HTMLElement)||m instanceof HTMLUnknownElement)){m.remove();break}const e=m.tagName.toLowerCase();Array.isArray(u)&&u.includes(e)?m.remove():Array.isArray(l)&&l.includes(e)?m.hasChildNodes()?m.replaceWith(...m.childNodes):m.remove():e.includes("-")&&!s||Array.isArray(n)&&!n.includes(e)?m.remove():m.hasAttributes()&&m.getAttributeNames().forEach((t=>{const n=m.getAttributeNode(t),{value:o}=n;U.includes(t)&&!ie.includes(new URL(o,document.baseURI).protocol)?m.removeAttributeNode(n):i(c)?t in c&&["*",e].some((e=>c[t].includes(e)))&&m.removeAttributeNode(n):i(r)&&(t in r&&["*",e].some((e=>r[t].includes(e)))||m.removeAttributeNode(n))}));break}case Node.COMMENT_NODE:o||m.remove()}"template"===m.localName&&de(m.content,t),m=d.nextNode()}return e}catch(t){console.error(t),e.parentElement.removeChild(e)}}
|
|
40
40
|
/**
|
|
41
41
|
* @copyright 2022-2023 Chris Zuber <admin@kernvalley.us>
|
|
42
42
|
*/
|
|
43
|
-
const me=new WeakMap;const{setHTML:fe,polyfill:he}=function(e,t){return{setHTML:re,polyfill:function(){let n=!1;if("Sanitizer"in globalThis){if(globalThis.Sanitizer.getDefaultConfiguration instanceof Function||(globalThis.Sanitizer.getDefaultConfiguration=function(){return t},n=!0),!(globalThis.Sanitizer.prototype.getConfiguration instanceof Function)){const e=new WeakMap,t=globalThis.Sanitizer;globalThis.Sanitizer=class extends t{constructor({allowAttributes:n,allowComments:o,allowElements:r,allowCustomElements:i,blockElements:a,dropAttributes:s,dropElements:l,allowUnknownMarkup:c}=t.getDefaultConfiguration()){super({allowAttributes:n,allowComments:o,allowElements:r,allowCustomElements:i,blockElements:a,dropAttributes:s,dropElements:l,allowUnknownMarkup:c}),e.set(this,{allowAttributes:n,allowComments:o,allowElements:r,allowCustomElements:i,blockElements:a,dropAttributes:s,dropElements:l,allowUnknownMarkup:c})}getConfiguration(){return e.get(this)}},n=!0}globalThis.Sanitizer.prototype.sanitize instanceof Function||(globalThis.Sanitizer.prototype.sanitize=function(e){if(e instanceof Node){if([Node.DOCUMENT_NODE,Node.DOCUMENT_FRAGMENT_NODE].includes(e.nodeType))return pe(e,this.getConfiguration());throw new TypeError("Expected a Document or DocumentFragment in `Sanitizer.sanitize()`.")}throw new TypeError("`Sanitizer.sanitize()` expects a `Node`")},n=!0),globalThis.Sanitizer.prototype.sanitizeFor instanceof Function||(globalThis.Sanitizer.prototype.sanitizeFor=function(e,t){const n=document.createElement(e);return re(n,t,this.getConfiguration()),n},n=!0),Element.prototype.setHTML instanceof Function||(Element.prototype.setHTML=function(e,n=t){re(this,e,n)},n=!0)}else globalThis.Sanitizer=e,n=!0;return n}}}(class e{constructor({allowElements:t,allowAttributes:n,blockElements:o,dropAttributes:r,dropElements:i,allowComments:a=oe.allowComments,allowCustomElements:s=oe.allowCustomElements,allowUnknownMarkup:l=oe.allowUnknownMarkup}=e.getDefaultConfiguration()){me.set(this,{allowElements:t,allowComments:a,allowAttributes:n,allowCustomElements:s,blockElements:o,dropAttributes:r,dropElements:i,allowUnknownMarkup:l})}getConfiguration(){return me.get(this)}sanitize(e){return pe(e,this.getConfiguration())}sanitizeFor(e,t){const n=document.createElement(e);return n.setHTML(t,this.getConfiguration()),n}static getDefaultConfiguration(){return oe}},oe);he();const ye={get(){return Array.from(this.styleSheets).filter((e=>e.ownerNode.classList.contains("_adopted")))},set(e){if(!Array.isArray(e))throw new TypeError("Must be an array");{const t=new Set(this.adoptedStyleSheets);t.difference(e).forEach((e=>e.ownerNode.remove()));const n=[...new Set(e).difference(t)].map((e=>{const t=document.createElement("link"),n=new AbortController,o=n.signal,r=URL.createObjectURL(new File([],"adopted.css",{type:"text/css"}));return t.rel="stylesheet",t.href=r,t.classList.add("_adopted"),t.disabled=e.disabled,t.addEventListener("load",(({target:o})=>{n.abort(),t.media=e.media.mediaText,[...e.cssRules].forEach(((e,t)=>{o.sheet.insertRule(e.cssText,t)})),setTimeout((()=>URL.revokeObjectURL(o.href)),100)}),{once:!0,signal:o}),t.addEventListener("error",(({target:e})=>{n.abort(),URL.revokeObjectURL(e.href)}),{once:!0,signal:o}),t}));this instanceof Document?this.head.append(...n):this.append(...n)}}};function ge(e){for(;e.cssRules.length>0;)e.deleteRule(0)}e(Document,"parseHTML",((...e)=>ue(...e))),t(Document.prototype,"adoptedStyleSheets",ye),"ShadowRoot"in globalThis&&t(ShadowRoot.prototype,"adoptedStyleSheets",ye);try{new CSSStyleSheet}catch{const e=globalThis.CSSStyleSheet;globalThis.CSSStyleSheet=function({disabled:e=!1,media:t}={}){const n=function(e="",{disabled:t=!1,media:n}={}){const o=Document.parseHTML(`<style>${e}</style>`,{sanitizer:new Sanitizer({allowElements:["style","html","head","body"]})}).styleSheets.item(0);return"string"==typeof n&&o.media.appendMedium(n),o.disabled=t,o}("#dfgbkjdfg{color:red;}",{disabled:e,media:t});return n.deleteRule(0),n},globalThis.CSSStyleSheet.prototype=e.prototype,e.prototype.constructor=globalThis.CSSStyleSheet}CSSStyleSheet.prototype.replace instanceof Function||(CSSStyleSheet.prototype.replace=function(e){const t=document.createElement("link"),n=new AbortController,{resolve:o,reject:r,promise:i}=Promise.withResolvers();return t.addEventListener("load",(({target:e})=>{ge(this),[...e.sheet.cssRules].forEach(((e,t)=>this.insertRule(e.cssText,t))),o(this),n.abort(),URL.revokeObjectURL(e.href),e.remove()}),{once:!0,signal:n.signal}),t.addEventListener("error",(({target:e})=>{const t=new DOMException("Error loading stylesheet.");r(t),n.abort(t),URL.revokeObjectURL(e.href),e.remove()}),{once:!0,signal:n.signal}),t.rel="stylesheet",t.crossOrigin="anonymous",t.referrerPolicy="no-referrer",t.media="no-op",t.href=URL.createObjectURL(new File([e],"tmp.css",{type:"text/css"})),document.head.append(t),i}),CSSStyleSheet.prototype.replaceSync instanceof Function||(CSSStyleSheet.prototype.replaceSync=function(e){const t=Document.parseHTML(`<style>${e}</style>`,{sanitizer:new Sanitizer({allowElements:["style","html","head","body"]})}).styleSheets.item(0);ge(this),[...t.cssRules].forEach(((e,t)=>this.insertRule(e.cssText,t)))});const be={ariaAtomic:"aria-atomic",ariaAutoComplete:"aria-autocomplete",ariaBusy:"aria-busy",ariaChecked:"aria-checked",ariaColCount:"aria-colcount",ariaColIndex:"aria-colindex",ariaColIndexText:"aria-colindextext",ariaColSpan:"aria-colspan",ariaCurrent:"aria-current",ariaDisabled:"aria-disabled",ariaExpanded:"aria-expanded",ariaHasPopup:"aria-haspopup",ariaHidden:"aria-hidden",ariaInvalid:"aria-invalid",ariaKeyShortcuts:"aria-keyshortcuts",ariaLabel:"aria-label",ariaLevel:"aria-level",ariaLive:"aria-live",ariaModal:"aria-modal",ariaMultiLine:"aria-multiline",ariaMultiSelectable:"aria-multiselectable",ariaOrientation:"aria-orientation",ariaPlaceholder:"aria-placeholder",ariaPosInSet:"aria-posinset",ariaPressed:"aria-pressed",ariaReadOnly:"aria-readonly",ariaRelevant:"aria-relevant",ariaRequired:"aria-required",ariaRoleDescription:"aria-roledescription",ariaRowCount:"aria-rowcount",ariaRowIndex:"aria-rowindex",ariaRowIndexText:"aria-rowindextext",ariaRowSpan:"aria-rowspan",ariaSelected:"aria-selected",ariaSetSize:"aria-setsize",ariaSort:"aria-sort",ariaValueMax:"aria-valuemax",ariaValueMin:"aria-valuemin",ariaValueNow:"aria-valuenow",ariaValueText:"aria-valuetext",role:"role"};if(HTMLScriptElement.supports instanceof Function||(HTMLScriptElement.supports=function(e){switch(e.toLowerCase()){case"classic":return!0;case"module":return"noModule"in HTMLScriptElement.prototype;default:return!1}}),!Element.prototype.hasOwnProperty(be.role)){const e=!0,t=!0,n=Object.fromEntries(Object.entries(be).map((([n,o])=>[n,{get:function(){return this.getAttribute(o)},set:function(e){"string"==typeof e?this.setAttribute(o,e):this.removeAttribute(o)},enumerable:e,configurable:t}])));Object.defineProperties(Element.prototype,n)}if(!HTMLElement.prototype.hasOwnProperty("inert")){const e=new WeakMap,t=n=>{e.has(n)&&(n.tabIndex=e.get(n)),n.hasChildNodes()&&[...n.children].forEach(t)},n=t=>{-1!==t.tabIndex&&(e.set(t,t.tabIndex),t.tabIndex=-1),t.hasChildNodes()&&[...t.children].forEach(n)};Object.defineProperty(HTMLElement.prototype,"inert",{get:function(){return this.hasAttribute("inert")},set:function(e){e?(this.setAttribute("aria-hidden","true"),this.setAttribute("inert",""),n(this)):(this.removeAttribute("aria-hidden"),this.removeAttribute("inert"),t(this))},enumerable:!0,configurable:!0})}if(HTMLImageElement.prototype.hasOwnProperty("complete")||Object.defineProperty(HTMLImageElement.prototype,"complete",{get:function(){return""===this.src||this.naturalHeight>0}}),HTMLImageElement.prototype.decode instanceof Function||(HTMLImageElement.prototype.decode=function(){return this.complete?Promise.resolve():new Promise(((e,t)=>{const n=()=>{this.removeEventListener("error",o),this.removeEventListener("load",n),e()},o=e=>{this.removeEventListener("error",o),this.removeEventListener("load",n),t(e)};this.addEventListener("load",n),this.addEventListener("error",o)}))}),Element.prototype.setHTML instanceof Function?function(e,t,n){const{value:o,enumerable:r,configurable:i,writable:a}=Object.getOwnPropertyDescriptor(e,t),s=n(o);if(!(s instanceof Function))throw new TypeError(`Error overwriting ${t}. The func MUST be a function that accepts the original as an argument and return a function.`);Object.defineProperty(e,t,{value:s,enumerable:r,configurable:i,writable:a})}(Element.prototype,"setHTML",(function(e){return function(t,n={}){if(n.sanitizer instanceof Sanitizer)e.call(this,t,n);else{const o=new Sanitizer(function({allowAttributes:e,allowComments:t,allowElements:n,allowCustomElements:o,blockElements:r,dropAttributes:i,dropElements:a,allowUnknownMarkup:s}={}){return void 0===e&&void 0===i&&(e=oe.allowAttributes),void 0===n&&void 0===a&&(n=oe.allowElements),{allowAttributes:e,allowComments:t,allowElements:n,allowCustomElements:o,blockElements:r,dropAttributes:i,dropElements:a,allowUnknownMarkup:s}}(n));e.call(this,t,{sanitizer:o})}}})):Element.prototype.setHTML=function(e,t=oe){re(this,e,t)},!HTMLTemplateElement.prototype.hasOwnProperty("shadowRootMode")){Object.defineProperty(HTMLTemplateElement.prototype,"shadowRootMode",{get:function(){return this.getAttribute("shadowrootmode")},set:function(e){this.setAttribute("shadowrootmode",e)},enumerable:!0,configurable:!0});const e=(t=document)=>{t.querySelectorAll("template[shadowrootmode]").forEach((t=>{const n=t.parentElement.attachShadow({mode:t.shadowRootMode});n.append(t.content),t.remove(),e(n)}))};"loading"===document.readyState?document.addEventListener("readystatechange",(()=>e(document)),{once:!0}):e(document)}Set.prototype.intersection instanceof Function||(Set.prototype.intersection=function(e){return e instanceof Set||(e=new Set(e)),new Set([...this].filter((t=>e.has(t))))}),Set.prototype.difference instanceof Function||(Set.prototype.difference=function(e){return e instanceof Set||(e=new Set(e)),new Set([...this].filter((t=>!e.has(t))))}),Set.prototype.union instanceof Function||(Set.prototype.union=function(e){return new Set([...this,...e])}),Set.prototype.isSubsetOf instanceof Function||(Set.prototype.isSubsetOf=function(e){return e instanceof Set||(e=new Set(e)),[...this].every((t=>e.has(t)))}),Set.prototype.isSupersetOf instanceof Function||(Set.prototype.isSupersetOf=function(e){return e instanceof Set||(e=new Set(e)),e.isSubsetOf(this)}),Set.prototype.symmetricDifference instanceof Function||(Set.prototype.symmetricDifference=function(e){return e instanceof Set||(e=new Set(e)),new Set([...this.difference(e),...e.difference(this)])}),Set.prototype.isDisjointFrom instanceof Function||(Set.prototype.isDisjointFrom=function(e){return e instanceof Set||(e=new Set(e)),new Set([...this,...e]).size===this.size+e.size}),WeakMap.prototype.emplace instanceof Function||(WeakMap.prototype.emplace=function(e,{insert:t,update:n}={}){const o=this.has(e);if(o&&n instanceof Function){const t=this.get(e),o=n.call(this,t,e,this);return o!==t&&this.set(e,t),o}if(o)return this.get(e);if(t instanceof Function){const n=t.call(this,e,this);return this.set(e,n),n}throw new Error("Key is not found and no `insert()` given")}),function(){if("screen"in globalThis&&!(globalThis.getScreenDetails instanceof Function)){class e extends EventTarget{get availHeight(){return screen.availHeight}get availLeft(){return screen.availLeft}get availTop(){return screen.availTop}get availWidth(){return screen.availWidth}get colorDepth(){return screen.colorDepth}get devicePixelRatio(){return globalThis.devicePixelRatio||1}get height(){return screen.height}get isExtended(){return screen.isExtended}get isInternal(){return!0}get isPrimary(){return!0}get label(){return"Unknown"}get orientation(){return screen.orientation}get pixelDepth(){return screen.pixelDepth}get top(){return screen.top}get width(){return screen.width}}class t extends EventTarget{get currentScreen(){return new e}get screens(){return[this.currentScreen]}}Object.defineProperty(Screen.prototype,"isExtended",{enumerable:!0,configurable:!0,get:()=>!1}),globalThis.getScreenDetails=async()=>new t}}();
|
|
43
|
+
const me=new WeakMap;const{setHTML:fe,polyfill:he}=function(e,t){return{setHTML:re,polyfill:function(){let n=!1;if("Sanitizer"in globalThis){if(globalThis.Sanitizer.getDefaultConfiguration instanceof Function||(globalThis.Sanitizer.getDefaultConfiguration=function(){return t},n=!0),!(globalThis.Sanitizer.prototype.getConfiguration instanceof Function)){const e=new WeakMap,t=globalThis.Sanitizer;globalThis.Sanitizer=class extends t{constructor({allowAttributes:n,allowComments:o,allowElements:r,allowCustomElements:i,blockElements:a,dropAttributes:s,dropElements:l,allowUnknownMarkup:c}=t.getDefaultConfiguration()){super({allowAttributes:n,allowComments:o,allowElements:r,allowCustomElements:i,blockElements:a,dropAttributes:s,dropElements:l,allowUnknownMarkup:c}),e.set(this,{allowAttributes:n,allowComments:o,allowElements:r,allowCustomElements:i,blockElements:a,dropAttributes:s,dropElements:l,allowUnknownMarkup:c})}getConfiguration(){return e.get(this)}},n=!0}globalThis.Sanitizer.prototype.sanitize instanceof Function||(globalThis.Sanitizer.prototype.sanitize=function(e){if(e instanceof Node){if([Node.DOCUMENT_NODE,Node.DOCUMENT_FRAGMENT_NODE].includes(e.nodeType))return pe(e,this.getConfiguration());throw new TypeError("Expected a Document or DocumentFragment in `Sanitizer.sanitize()`.")}throw new TypeError("`Sanitizer.sanitize()` expects a `Node`")},n=!0),globalThis.Sanitizer.prototype.sanitizeFor instanceof Function||(globalThis.Sanitizer.prototype.sanitizeFor=function(e,t){const n=document.createElement(e);return re(n,t,this.getConfiguration()),n},n=!0),Element.prototype.setHTML instanceof Function||(Element.prototype.setHTML=function(e,n=t){re(this,e,n)},n=!0)}else globalThis.Sanitizer=e,n=!0;return n}}}(class e{constructor({allowElements:t,allowAttributes:n,blockElements:o,dropAttributes:r,dropElements:i,allowComments:a=oe.allowComments,allowCustomElements:s=oe.allowCustomElements,allowUnknownMarkup:l=oe.allowUnknownMarkup}=e.getDefaultConfiguration()){me.set(this,{allowElements:t,allowComments:a,allowAttributes:n,allowCustomElements:s,blockElements:o,dropAttributes:r,dropElements:i,allowUnknownMarkup:l})}getConfiguration(){return me.get(this)}sanitize(e){return pe(e,this.getConfiguration())}sanitizeFor(e,t){const n=document.createElement(e);return n.setHTML(t,this.getConfiguration()),n}static getDefaultConfiguration(){return oe}},oe);he();const ye={get(){return Array.from(this.styleSheets).filter((e=>e.ownerNode.classList.contains("_adopted")))},set(e){if(!Array.isArray(e))throw new TypeError("Must be an array");{const t=new Set(this.adoptedStyleSheets);t.difference(e).forEach((e=>e.ownerNode.remove()));const n=[...new Set(e).difference(t)].map((e=>{const t=document.createElement("link"),n=new AbortController,o=n.signal,r=URL.createObjectURL(new File([],"adopted.css",{type:"text/css"}));return t.rel="stylesheet",t.href=r,t.classList.add("_adopted"),t.disabled=e.disabled,t.addEventListener("load",(({target:o})=>{n.abort(),t.media=e.media.mediaText,[...e.cssRules].forEach(((e,t)=>{o.sheet.insertRule(e.cssText,t)})),setTimeout((()=>URL.revokeObjectURL(o.href)),100)}),{once:!0,signal:o}),t.addEventListener("error",(({target:e})=>{n.abort(),URL.revokeObjectURL(e.href)}),{once:!0,signal:o}),t}));this instanceof Document?this.head.append(...n):this.append(...n)}}};function be(e){for(;e.cssRules.length>0;)e.deleteRule(0)}e(Document,"parseHTML",((...e)=>ue(...e))),t(Document.prototype,"adoptedStyleSheets",ye),"ShadowRoot"in globalThis&&t(ShadowRoot.prototype,"adoptedStyleSheets",ye);try{new CSSStyleSheet}catch{const e=globalThis.CSSStyleSheet;globalThis.CSSStyleSheet=function({disabled:e=!1,media:t}={}){const n=function(e="",{disabled:t=!1,media:n}={}){const o=Document.parseHTML(`<style>${e}</style>`,{sanitizer:new Sanitizer({allowElements:["style","html","head","body"]})}).styleSheets.item(0);return"string"==typeof n&&o.media.appendMedium(n),o.disabled=t,o}("#dfgbkjdfg{color:red;}",{disabled:e,media:t});return n.deleteRule(0),n},globalThis.CSSStyleSheet.prototype=e.prototype,e.prototype.constructor=globalThis.CSSStyleSheet}CSSStyleSheet.prototype.replace instanceof Function||(CSSStyleSheet.prototype.replace=function(e){const t=document.createElement("link"),n=new AbortController,{resolve:o,reject:r,promise:i}=Promise.withResolvers();return t.addEventListener("load",(({target:e})=>{be(this),[...e.sheet.cssRules].forEach(((e,t)=>this.insertRule(e.cssText,t))),o(this),n.abort(),URL.revokeObjectURL(e.href),e.remove()}),{once:!0,signal:n.signal}),t.addEventListener("error",(({target:e})=>{const t=new DOMException("Error loading stylesheet.");r(t),n.abort(t),URL.revokeObjectURL(e.href),e.remove()}),{once:!0,signal:n.signal}),t.rel="stylesheet",t.crossOrigin="anonymous",t.referrerPolicy="no-referrer",t.media="no-op",t.href=URL.createObjectURL(new File([e],"tmp.css",{type:"text/css"})),document.head.append(t),i}),CSSStyleSheet.prototype.replaceSync instanceof Function||(CSSStyleSheet.prototype.replaceSync=function(e){const t=Document.parseHTML(`<style>${e}</style>`,{sanitizer:new Sanitizer({allowElements:["style","html","head","body"]})}).styleSheets.item(0);be(this),[...t.cssRules].forEach(((e,t)=>this.insertRule(e.cssText,t)))});const ge={ariaAtomic:"aria-atomic",ariaAutoComplete:"aria-autocomplete",ariaBusy:"aria-busy",ariaChecked:"aria-checked",ariaColCount:"aria-colcount",ariaColIndex:"aria-colindex",ariaColIndexText:"aria-colindextext",ariaColSpan:"aria-colspan",ariaCurrent:"aria-current",ariaDisabled:"aria-disabled",ariaExpanded:"aria-expanded",ariaHasPopup:"aria-haspopup",ariaHidden:"aria-hidden",ariaInvalid:"aria-invalid",ariaKeyShortcuts:"aria-keyshortcuts",ariaLabel:"aria-label",ariaLevel:"aria-level",ariaLive:"aria-live",ariaModal:"aria-modal",ariaMultiLine:"aria-multiline",ariaMultiSelectable:"aria-multiselectable",ariaOrientation:"aria-orientation",ariaPlaceholder:"aria-placeholder",ariaPosInSet:"aria-posinset",ariaPressed:"aria-pressed",ariaReadOnly:"aria-readonly",ariaRelevant:"aria-relevant",ariaRequired:"aria-required",ariaRoleDescription:"aria-roledescription",ariaRowCount:"aria-rowcount",ariaRowIndex:"aria-rowindex",ariaRowIndexText:"aria-rowindextext",ariaRowSpan:"aria-rowspan",ariaSelected:"aria-selected",ariaSetSize:"aria-setsize",ariaSort:"aria-sort",ariaValueMax:"aria-valuemax",ariaValueMin:"aria-valuemin",ariaValueNow:"aria-valuenow",ariaValueText:"aria-valuetext",role:"role"};if(HTMLScriptElement.supports instanceof Function||(HTMLScriptElement.supports=function(e){switch(e.toLowerCase()){case"classic":return!0;case"module":return"noModule"in HTMLScriptElement.prototype;default:return!1}}),!Element.prototype.hasOwnProperty(ge.role)){const e=!0,t=!0,n=Object.fromEntries(Object.entries(ge).map((([n,o])=>[n,{get:function(){return this.getAttribute(o)},set:function(e){"string"==typeof e?this.setAttribute(o,e):this.removeAttribute(o)},enumerable:e,configurable:t}])));Object.defineProperties(Element.prototype,n)}if(!HTMLElement.prototype.hasOwnProperty("inert")){const e=new WeakMap,t=n=>{e.has(n)&&(n.tabIndex=e.get(n)),n.hasChildNodes()&&[...n.children].forEach(t)},n=t=>{-1!==t.tabIndex&&(e.set(t,t.tabIndex),t.tabIndex=-1),t.hasChildNodes()&&[...t.children].forEach(n)};Object.defineProperty(HTMLElement.prototype,"inert",{get:function(){return this.hasAttribute("inert")},set:function(e){e?(this.setAttribute("aria-hidden","true"),this.setAttribute("inert",""),n(this)):(this.removeAttribute("aria-hidden"),this.removeAttribute("inert"),t(this))},enumerable:!0,configurable:!0})}if(HTMLImageElement.prototype.hasOwnProperty("complete")||Object.defineProperty(HTMLImageElement.prototype,"complete",{get:function(){return""===this.src||this.naturalHeight>0}}),HTMLImageElement.prototype.decode instanceof Function||(HTMLImageElement.prototype.decode=function(){return this.complete?Promise.resolve():new Promise(((e,t)=>{const n=()=>{this.removeEventListener("error",o),this.removeEventListener("load",n),e()},o=e=>{this.removeEventListener("error",o),this.removeEventListener("load",n),t(e)};this.addEventListener("load",n),this.addEventListener("error",o)}))}),Element.prototype.setHTML instanceof Function?function(e,t,n){const{value:o,enumerable:r,configurable:i,writable:a}=Object.getOwnPropertyDescriptor(e,t),s=n(o);if(!(s instanceof Function))throw new TypeError(`Error overwriting ${t}. The func MUST be a function that accepts the original as an argument and return a function.`);Object.defineProperty(e,t,{value:s,enumerable:r,configurable:i,writable:a})}(Element.prototype,"setHTML",(function(e){return function(t,n={}){if(n.sanitizer instanceof Sanitizer)e.call(this,t,n);else{const o=new Sanitizer(function({allowAttributes:e,allowComments:t,allowElements:n,allowCustomElements:o,blockElements:r,dropAttributes:i,dropElements:a,allowUnknownMarkup:s}={}){return void 0===e&&void 0===i&&(e=oe.allowAttributes),void 0===n&&void 0===a&&(n=oe.allowElements),{allowAttributes:e,allowComments:t,allowElements:n,allowCustomElements:o,blockElements:r,dropAttributes:i,dropElements:a,allowUnknownMarkup:s}}(n));e.call(this,t,{sanitizer:o})}}})):Element.prototype.setHTML=function(e,t=oe){re(this,e,t)},!HTMLTemplateElement.prototype.hasOwnProperty("shadowRootMode")){Object.defineProperty(HTMLTemplateElement.prototype,"shadowRootMode",{get:function(){return this.getAttribute("shadowrootmode")},set:function(e){this.setAttribute("shadowrootmode",e)},enumerable:!0,configurable:!0});const e=(t=document)=>{t.querySelectorAll("template[shadowrootmode]").forEach((t=>{const n=t.parentElement.attachShadow({mode:t.shadowRootMode});n.append(t.content),t.remove(),e(n)}))};"loading"===document.readyState?document.addEventListener("readystatechange",(()=>e(document)),{once:!0}):e(document)}HTMLFormElement.prototype.requestSubmit instanceof Function||(HTMLFormElement.prototype.requestSubmit=function(e){if(void 0===e){const e=document.createElement("button");e.type="submit",e.hidden=!0,this.append(e),this.requestSubmit(e),setTimeout((()=>e.remove()),100)}else{if(!(e instanceof HTMLButtonElement||e instanceof HTMLInputElement))throw new TypeError("HTMLFormElement.requestSubmit: The submitter is not a submit button.");if(!("submit"===e.type||e instanceof HTMLInputElement&&"image"===e.type))throw new TypeError("HTMLFormElement.requestSubmit: The submitter is not a submit button.");if(!this.isSameNode(e.form))throw new DOMException("HTMLFormElement.requestSubmit: The submitter is not owned by this form.","NotFoundError");e.click()}}),Set.prototype.intersection instanceof Function||(Set.prototype.intersection=function(e){return e instanceof Set||(e=new Set(e)),new Set([...this].filter((t=>e.has(t))))}),Set.prototype.difference instanceof Function||(Set.prototype.difference=function(e){return e instanceof Set||(e=new Set(e)),new Set([...this].filter((t=>!e.has(t))))}),Set.prototype.union instanceof Function||(Set.prototype.union=function(e){return new Set([...this,...e])}),Set.prototype.isSubsetOf instanceof Function||(Set.prototype.isSubsetOf=function(e){return e instanceof Set||(e=new Set(e)),[...this].every((t=>e.has(t)))}),Set.prototype.isSupersetOf instanceof Function||(Set.prototype.isSupersetOf=function(e){return e instanceof Set||(e=new Set(e)),e.isSubsetOf(this)}),Set.prototype.symmetricDifference instanceof Function||(Set.prototype.symmetricDifference=function(e){return e instanceof Set||(e=new Set(e)),new Set([...this.difference(e),...e.difference(this)])}),Set.prototype.isDisjointFrom instanceof Function||(Set.prototype.isDisjointFrom=function(e){return e instanceof Set||(e=new Set(e)),new Set([...this,...e]).size===this.size+e.size}),WeakMap.prototype.emplace instanceof Function||(WeakMap.prototype.emplace=function(e,{insert:t,update:n}={}){const o=this.has(e);if(o&&n instanceof Function){const t=this.get(e),o=n.call(this,t,e,this);return o!==t&&this.set(e,t),o}if(o)return this.get(e);if(t instanceof Function){const n=t.call(this,e,this);return this.set(e,n),n}throw new Error("Key is not found and no `insert()` given")}),function(){if("screen"in globalThis&&!(globalThis.getScreenDetails instanceof Function)){class e extends EventTarget{get availHeight(){return screen.availHeight}get availLeft(){return screen.availLeft}get availTop(){return screen.availTop}get availWidth(){return screen.availWidth}get colorDepth(){return screen.colorDepth}get devicePixelRatio(){return globalThis.devicePixelRatio||1}get height(){return screen.height}get isExtended(){return screen.isExtended}get isInternal(){return!0}get isPrimary(){return!0}get label(){return"Unknown"}get orientation(){return screen.orientation}get pixelDepth(){return screen.pixelDepth}get top(){return screen.top}get width(){return screen.width}}class t extends EventTarget{get currentScreen(){return new e}get screens(){return[this.currentScreen]}}Object.defineProperty(Screen.prototype,"isExtended",{enumerable:!0,configurable:!0,get:()=>!1}),globalThis.getScreenDetails=async()=>new t}}();
|
|
44
44
|
/**
|
|
45
45
|
* @copyright 2023 Chris Zuber <admin@kernvalley.us>
|
|
46
46
|
*/
|
|
@@ -62,5 +62,5 @@ const we="user-blocking",Te="user-visible",ve="background";async function Ee(e,{
|
|
|
62
62
|
* Additionally, if `internals.states._polyfilled`
|
|
63
63
|
* - Use `._state--*` in addition to `:--*` to query element internals states
|
|
64
64
|
* - This includes `:disabled` -> `._state--disabled` & `:invalid` -> `._state--invalid`
|
|
65
|
-
*/;const Me={key:Symbol("key"),internals:Symbol("element-internals"),form:Symbol("form"),fieldset:Symbol("fieldset"),element:Symbol("element"),validity:Symbol("validity"),validationMessage:Symbol("validation-message"),value:Symbol("value"),state:Symbol("state"),formController:Symbol("form-controller"),anchor:Symbol("anchor"),customInputs:Symbol("custom-inputs")};if(!(HTMLElement.prototype.attachInternals instanceof Function)&&"FormDataEvent"in globalThis){const e={valueMissing:!1,typeMismatch:!1,patternMismatch:!1,tooLong:!1,tooShort:!1,rangeUnderflow:!1,rangeOverflow:!1,stepMismatch:!1,badInput:!1,customError:!1,valid:!0},t=e=>e.hasOwnProperty(Me.fieldset)&&e[Me.fieldset]instanceof HTMLFieldSetElement&&e[Me.fieldset].disabled,n=e=>e instanceof HTMLElement&&e.tagName.includes("-")&&customElements.get(e.tagName.toLowerCase()).formAssociated,o=(e,t)=>function(n){if(n.target.reportValidity()){if(t.willValidate&&n.formData instanceof FormData){const o=t[Me.value];o instanceof FormData?o.entries().forEach((([e,t])=>n.formData.set(e,t))):e.hasAttribute("name")&&n.formData.set(e.getAttribute("name"),t[Me.value])}}else n.preventDefault(),n.stopImmediatePropagation(),n.stopPropagation()},r=(e,t)=>{Object.entries(t).forEach((([t,n])=>e.style.setProperty(t,n)))},i=e=>e.hasAttribute("form")&&document.forms[e.getAttribute("form")]||e.closest("form"),a=(e,t,r)=>{if(e instanceof HTMLFormElement){if(!(r instanceof HTMLElement&&r.tagName.includes("-")))throw new TypeError("Not a custom element");if(!(t instanceof c||t instanceof globalThis.ElementInternals))throw new TypeError("Invalid ElementInternals");if(!n(r))throw new TypeError(`${r.tagName} is not form associated.`);if(!(r.formAssociatedCallback instanceof Function))throw new TypeError(`${r.tagName} is missing a formAssociatedCallback method.`);{const n=new AbortController,i=r.closest("fieldset");i instanceof Element&&(r[Me.fieldset]=i,i.hasOwnProperty(Me.customInputs)||(i[Me.customInputs]=new Set),i[Me.customInputs].add(r),s.observe(i,l)),t[Me.form]=e,t[Me.formController]=n;const{checkValidity:a,reportValidity:c}=e;e.reportValidity=function(){return!!c.call(this)&&t.reportValidity()},e.checkValidity=function(){return!!a.call(this)&&t.checkValidity()},n.signal.addEventListener("abort",(()=>{e.reportValidity=c,e.checkValidity=a}),{once:!0}),e.addEventListener("formdata",o(r,t),{signal:n.signal}),e.addEventListener("submit",(e=>{e.target.reportValidity()||(e.preventDefault(),e.stopImmediatePropagation(),e.stopPropagation())}),{signal:n.signal}),r.formResetCallback instanceof Function&&e.addEventListener("reset",(()=>r.formResetCallback()),{signal:n.signal})}}else if(t[Me.formController]instanceof AbortController&&t[Me.formController].abort(),t[Me.form]=null,t[Me.formController]=null,r.hasOwnProperty(Me.fieldset)){const e=r[Me.fieldset];e.hasOwnProperty(Me.customInputs)&&(e[Me.customInputs].delete(r),0===e[Me.customInputs.size]&&delete e[Me.customInputs]),r[Me.fieldset]=null}},s=new MutationObserver((e=>{e.forEach((({target:o,type:r,attributeName:i})=>{if("attributes"===r&&"disabled"===i){const r=o.hasAttribute("disabled");if(n(o)&&o.hasOwnProperty(Me.internals)&&o[Me.internals].states.has("--disabled")!==r&&(1===e.length?!t(o):o.hasAttribute("disabled")===t(o)&&e.some((e=>e.target.isSameNode(o[Me.fieldset]))))){const e=o[Me.internals];r?e.states.add("--disabled"):e.states.delete("--disabled"),o.formDisabledCallback instanceof Function&&o.formDisabledCallback(r)}else"FIELDSET"!==o.tagName||!o.hasOwnProperty(Me.customInputs)||1!==e.length&&e.some((e=>o[Me.customInputs].has(e.target)))||o[Me.customInputs].forEach((e=>{e.isConnected&&e.hasOwnProperty(Me.internals)?e.hasAttribute("disabled")||(r?e[Me.internals].states.add("--disabled"):e[Me.internals].states.delete("--disabled"),e.formDisabledCallback instanceof Function&&e.formDisabledCallback(r)):o[Me.customInputs].delete(e)}))}}))})),l={attributes:!0,attributeFilter:["disabled"]};class c{constructor(t,o){if(o!==Me.key)throw new TypeError("Illegal constructor");if(!(t instanceof HTMLElement))throw new TypeError("Must be called on an HTMLElement");if(!t.tagName.includes("-"))throw new DOMException("Cannot attach internals to a built-in element.");{const o=!0,r=!1,i=!0;Object.defineProperties(this,{[Me.element]:{value:t,configurable:o,enumerable:r,writable:i},[Me.form]:{value:null,configurable:o,enumerable:r,writable:i},[Me.fieldset]:{value:null,configurable:o,enumerable:r,writable:i},[Me.anchor]:{value:null,configurable:o,enumerable:r,writable:i},[Me.validity]:{value:e,configurable:o,enumerable:r,writable:i},[Me.validationMessage]:{value:"",configurable:o,enumerable:r,writable:i},[Me.value]:{value:null,configurable:o,enumerable:r,writable:i},[Me.state]:{value:null,configurable:o,enumerable:r,writable:i},[Me.formController]:{value:null,configurable:o,enumerable:r,writable:i}}),n(t)&&s.observe(t,l),Object.defineProperty(t,Me.internals,{value:this,enumerable:!1,configurable:!1,writable:!1}),setTimeout((()=>this.states.add("--element-internals-polyfilled")),10)}}get form(){return this[Me.form]}get labels(){const e=this.form;return e instanceof HTMLFormElement&&0!==this[Me.element].id.length?e.querySelectorAll(`label[for="${this[Me.element].id}"]`):document.createDocumentFragment().childNodes}get _polyfilled(){return!0}get shadowRoot(){return this[Me.element].shadowRoot}get validity(){return n(this[Me.element])?this[Me.validity]:void 0}get validationMessage(){return n(this[Me.element])?this[Me.validationMessage]||"":void 0}get willValidate(){const e=this[Me.element];return n(e)&&!t(e)&&!["disabled","readonly"].some((t=>e.hasAttribute(t)))}checkValidity(){if(this.willValidate){if(this.validity.valid){const e=this[Me.element].nextElementSibling;return e instanceof HTMLElement&&e.classList.contains("_element-internals-popup")&&e.remove(),!0}return this[Me.element].dispatchEvent(new Event("invalid")),!1}return!0}reportValidity(){if(this.checkValidity())return!0;{const e=this.validationMessage;if("string"==typeof e&&0!==e.length){const{bottom:t,left:n}=this[Me.element].getBoundingClientRect(),o=document.createElement("div");o.textContent=e,r(o,{position:"fixed","background-color":"#2b2a33",color:"#fafafa",top:`${t+2}px`,left:`${n}px`,"z-index":2147483647,"color-scheme":"light-dark","font-family":"system-ui, serif","font-size":"18px",display:"inline-block",padding:"0.6em 0.8em",border:"1px solid #1a1a1a","border-radius":"6px"}),o.classList.add("_element-internals-popup"),this[Me.element].focus();const i=this[Me.element].nextElementSibling;i instanceof Element&&i.classList.contains("_element-internals-popup")&&i.remove(),this[Me.element].insertAdjacentElement("afterend",o),this[Me.anchor]instanceof Element&&this[Me.anchor].focus(),setTimeout((()=>{o.isConnected&&o.remove()}),3e3)}return!1}}setFormValue(e,t){if(!n(this[Me.element]))throw new DOMException("Not form associated");this[Me.value]=e,this[Me.state]=t}setValidity({valueMissing:e=!1,typeMismatch:t=!1,patternMismatch:o=!1,tooLong:r=!1,tooShort:i=!1,rangeUnderflow:a=!1,rangeOverflow:s=!1,stepMismatch:l=!1,badInput:c=!1,customError:u=!1},p="",d){if(!n(this[Me.element]))throw new DOMException("Not form associated");if(("string"!=typeof p||0===p.length)&&(e||t||o||r||i||a||s||l||c||u))throw new DOMException("Message required if any flags are true.");{const n=[e,t,o,r,i,a,s,l,c,u].every((e=>!1===e));this[Me.validity]={valueMissing:e,typeMismatch:t,patternMismatch:o,tooLong:r,tooShort:i,rangeUnderflow:a,rangeOverflow:s,stepMismatch:l,badInput:c,customError:u,valid:n},this[Me.validationMessage]=p,this[Me.anchor]=d,n?(this.states.delete("--invalid"),this.states.add("--valid")):(this.states.add("--invalid"),this.states.delete("--valid"),this[Me.element].dispatchEvent(new Event("invalid")))}}_associateForm(e,t){a(e,this,t)}_findAssociatedForm(e){return i(e)}}HTMLElement.prototype.attachInternals=function(){if(this.hasOwnProperty(Me.internals))throw new DOMException("Invalid operation");if(this.tagName.includes("-"))return new c(this,Me.key);throw new DOMException("Cannot call attachInternals on built-in elements.")},globalThis.ElementInternals=c}if("ElementInternals"in globalThis&&!("CustomStateSet"in globalThis)){const e="_state",t=new WeakMap,n=t=>{if(t.toString().startsWith("--"))return`${e}${t}`;throw new DOMException(`Failed to execute 'add' on 'CustomStateSet': The specified value '${t}' must start with '--'.`)},{value:o,writable:r,configurable:i,enumerable:a}=Object.getOwnPropertyDescriptor(HTMLElement.prototype,"attachInternals");class s{constructor(e,n){if(n!==Me.key)throw new TypeError("Illegal Constructor");if(!(e instanceof HTMLElement))throw new TypeError("el must be an HTMLElement");t.set(this,e),this.add("--custom-states-polyfilled")}get _polyfilled(){return!0}get size(){return[...this.values()].length}add(e){t.get(this).classList.add(n(e))}has(e){return t.get(this).classList.contains(n(e))}delete(e){const o=n(e);return!!t.get(this).classList.contains(o)&&(t.get(this).classList.remove(o),!0)}clear(){this.values().forEach((e=>this.delete(e)))}keys(){return this.values()}values(){return t.get(this).classList.values().filter((t=>t.startsWith(`${e}--`))).map((t=>t.substr(e.length)))}entries(){return this.values().map((e=>[e,e]))}forEach(e,t){this.values().forEach((n=>e.call(t||this,n,n,this)))}[Symbol.toStringTag](){return"CustomStateSet"}[Symbol.iterator](){return this.values()}}Object.defineProperty(HTMLElement.prototype,"attachInternals",{value:function(){const e=o.call(this);return Object.defineProperty(e,Me.element,{value:this,enumerable:!1,writable:!1,configurable:!1}),Object.defineProperty(e,"states",{value:new s(this,Me.key),configurable:!0,enumberable:!0}),Object.is(e.shadowRoot,null)&&!Object.is(this.shadowRoot,null)&&Object.defineProperty(e,"shadowRoot",{value:this.shadowRoot,configurable:!0,enumerable:!0}),e},writable:r,configurable:i,enumerable:a}),globalThis.CustomStateSet=s,function(e){const t=Object.fromEntries(Object.keys(be).map((e=>[e,{get:function(){return this[Me.element][e]},set:function(t){this[Me.element][e]=t},enumerable:!0,configurable:!0}])));Object.defineProperties(e,t)}(ElementInternals.prototype)}e(Response,"json",((e,{status:t=200,statusText:n="",headers:o=new Headers}={})=>o instanceof Headers?(o.set("Content-Type","application/json"),new Response(JSON.stringify(e),{status:t,statusText:n,headers:o})):Response.json(e,{status:t,statusText:n,headers:new Headers(o)}))),e(Response,"redirect",((e,t=302)=>new Response("",{status:t,headers:new Headers({Location:e})})))}();
|
|
65
|
+
*/;const Me={key:Symbol("key"),internals:Symbol("element-internals"),form:Symbol("form"),fieldset:Symbol("fieldset"),element:Symbol("element"),validity:Symbol("validity"),validationMessage:Symbol("validation-message"),value:Symbol("value"),state:Symbol("state"),formController:Symbol("form-controller"),anchor:Symbol("anchor"),customInputs:Symbol("custom-inputs")};if(!(HTMLElement.prototype.attachInternals instanceof Function)&&"FormDataEvent"in globalThis){const e={valueMissing:!1,typeMismatch:!1,patternMismatch:!1,tooLong:!1,tooShort:!1,rangeUnderflow:!1,rangeOverflow:!1,stepMismatch:!1,badInput:!1,customError:!1,valid:!0},t=e=>e.hasOwnProperty(Me.fieldset)&&e[Me.fieldset]instanceof HTMLFieldSetElement&&e[Me.fieldset].disabled,n=e=>e instanceof HTMLElement&&e.tagName.includes("-")&&customElements.get(e.tagName.toLowerCase()).formAssociated,o=(e,t)=>function(n){if(n.target.reportValidity()){if(t.willValidate&&n.formData instanceof FormData){const o=t[Me.value];o instanceof FormData?o.entries().forEach((([e,t])=>n.formData.set(e,t))):e.hasAttribute("name")&&n.formData.set(e.getAttribute("name"),t[Me.value])}}else n.preventDefault(),n.stopImmediatePropagation(),n.stopPropagation()},r=(e,t)=>{Object.entries(t).forEach((([t,n])=>e.style.setProperty(t,n)))},i=e=>e.hasAttribute("form")&&document.forms[e.getAttribute("form")]||e.closest("form"),a=(e,t,r)=>{if(e instanceof HTMLFormElement){if(!(r instanceof HTMLElement&&r.tagName.includes("-")))throw new TypeError("Not a custom element");if(!(t instanceof c||t instanceof globalThis.ElementInternals))throw new TypeError("Invalid ElementInternals");if(!n(r))throw new TypeError(`${r.tagName} is not form associated.`);if(!(r.formAssociatedCallback instanceof Function))throw new TypeError(`${r.tagName} is missing a formAssociatedCallback method.`);{const n=new AbortController,i=r.closest("fieldset");i instanceof Element&&(r[Me.fieldset]=i,i.hasOwnProperty(Me.customInputs)||(i[Me.customInputs]=new Set),i[Me.customInputs].add(r),s.observe(i,l)),t[Me.form]=e,t[Me.formController]=n;const{checkValidity:a,reportValidity:c}=e;e.reportValidity=function(){return!!c.call(this)&&t.reportValidity()},e.checkValidity=function(){return!!a.call(this)&&t.checkValidity()},n.signal.addEventListener("abort",(()=>{e.reportValidity=c,e.checkValidity=a}),{once:!0}),e.addEventListener("formdata",o(r,t),{signal:n.signal}),e.addEventListener("submit",(e=>{e.target.reportValidity()||(e.preventDefault(),e.stopImmediatePropagation(),e.stopPropagation())}),{signal:n.signal}),r.formResetCallback instanceof Function&&e.addEventListener("reset",(()=>r.formResetCallback()),{signal:n.signal})}}else if(t[Me.formController]instanceof AbortController&&t[Me.formController].abort(),t[Me.form]=null,t[Me.formController]=null,r.hasOwnProperty(Me.fieldset)){const e=r[Me.fieldset];e.hasOwnProperty(Me.customInputs)&&(e[Me.customInputs].delete(r),0===e[Me.customInputs.size]&&delete e[Me.customInputs]),r[Me.fieldset]=null}},s=new MutationObserver((e=>{e.forEach((({target:o,type:r,attributeName:i})=>{if("attributes"===r&&"disabled"===i){const r=o.hasAttribute("disabled");if(n(o)&&o.hasOwnProperty(Me.internals)&&o[Me.internals].states.has("--disabled")!==r&&(1===e.length?!t(o):o.hasAttribute("disabled")===t(o)&&e.some((e=>e.target.isSameNode(o[Me.fieldset]))))){const e=o[Me.internals];r?e.states.add("--disabled"):e.states.delete("--disabled"),o.formDisabledCallback instanceof Function&&o.formDisabledCallback(r)}else"FIELDSET"!==o.tagName||!o.hasOwnProperty(Me.customInputs)||1!==e.length&&e.some((e=>o[Me.customInputs].has(e.target)))||o[Me.customInputs].forEach((e=>{e.isConnected&&e.hasOwnProperty(Me.internals)?e.hasAttribute("disabled")||(r?e[Me.internals].states.add("--disabled"):e[Me.internals].states.delete("--disabled"),e.formDisabledCallback instanceof Function&&e.formDisabledCallback(r)):o[Me.customInputs].delete(e)}))}}))})),l={attributes:!0,attributeFilter:["disabled"]};class c{constructor(t,o){if(o!==Me.key)throw new TypeError("Illegal constructor");if(!(t instanceof HTMLElement))throw new TypeError("Must be called on an HTMLElement");if(!t.tagName.includes("-"))throw new DOMException("Cannot attach internals to a built-in element.");{const o=!0,r=!1,i=!0;Object.defineProperties(this,{[Me.element]:{value:t,configurable:o,enumerable:r,writable:i},[Me.form]:{value:null,configurable:o,enumerable:r,writable:i},[Me.fieldset]:{value:null,configurable:o,enumerable:r,writable:i},[Me.anchor]:{value:null,configurable:o,enumerable:r,writable:i},[Me.validity]:{value:e,configurable:o,enumerable:r,writable:i},[Me.validationMessage]:{value:"",configurable:o,enumerable:r,writable:i},[Me.value]:{value:null,configurable:o,enumerable:r,writable:i},[Me.state]:{value:null,configurable:o,enumerable:r,writable:i},[Me.formController]:{value:null,configurable:o,enumerable:r,writable:i}}),n(t)&&s.observe(t,l),Object.defineProperty(t,Me.internals,{value:this,enumerable:!1,configurable:!1,writable:!1}),setTimeout((()=>this.states.add("--element-internals-polyfilled")),10)}}get form(){return this[Me.form]}get labels(){const e=this.form;return e instanceof HTMLFormElement&&0!==this[Me.element].id.length?e.querySelectorAll(`label[for="${this[Me.element].id}"]`):document.createDocumentFragment().childNodes}get _polyfilled(){return!0}get shadowRoot(){return this[Me.element].shadowRoot}get validity(){return n(this[Me.element])?this[Me.validity]:void 0}get validationMessage(){return n(this[Me.element])?this[Me.validationMessage]||"":void 0}get willValidate(){const e=this[Me.element];return n(e)&&!t(e)&&!["disabled","readonly"].some((t=>e.hasAttribute(t)))}checkValidity(){if(this.willValidate){if(this.validity.valid){const e=this[Me.element].nextElementSibling;return e instanceof HTMLElement&&e.classList.contains("_element-internals-popup")&&e.remove(),!0}return this[Me.element].dispatchEvent(new Event("invalid")),!1}return!0}reportValidity(){if(this.checkValidity())return!0;{const e=this.validationMessage;if("string"==typeof e&&0!==e.length){const{bottom:t,left:n}=this[Me.element].getBoundingClientRect(),o=document.createElement("div");o.textContent=e,r(o,{position:"fixed","background-color":"#2b2a33",color:"#fafafa",top:`${t+2}px`,left:`${n}px`,"z-index":2147483647,"color-scheme":"light-dark","font-family":"system-ui, serif","font-size":"18px",display:"inline-block",padding:"0.6em 0.8em",border:"1px solid #1a1a1a","border-radius":"6px"}),o.classList.add("_element-internals-popup"),this[Me.element].focus();const i=this[Me.element].nextElementSibling;i instanceof Element&&i.classList.contains("_element-internals-popup")&&i.remove(),this[Me.element].insertAdjacentElement("afterend",o),this[Me.anchor]instanceof Element&&this[Me.anchor].focus(),setTimeout((()=>{o.isConnected&&o.remove()}),3e3)}return!1}}setFormValue(e,t){if(!n(this[Me.element]))throw new DOMException("Not form associated");this[Me.value]=e,this[Me.state]=t}setValidity({valueMissing:e=!1,typeMismatch:t=!1,patternMismatch:o=!1,tooLong:r=!1,tooShort:i=!1,rangeUnderflow:a=!1,rangeOverflow:s=!1,stepMismatch:l=!1,badInput:c=!1,customError:u=!1},p="",d){if(!n(this[Me.element]))throw new DOMException("Not form associated");if(("string"!=typeof p||0===p.length)&&(e||t||o||r||i||a||s||l||c||u))throw new DOMException("Message required if any flags are true.");{const n=[e,t,o,r,i,a,s,l,c,u].every((e=>!1===e));this[Me.validity]={valueMissing:e,typeMismatch:t,patternMismatch:o,tooLong:r,tooShort:i,rangeUnderflow:a,rangeOverflow:s,stepMismatch:l,badInput:c,customError:u,valid:n},this[Me.validationMessage]=p,this[Me.anchor]=d,n?(this.states.delete("--invalid"),this.states.add("--valid")):(this.states.add("--invalid"),this.states.delete("--valid"),this[Me.element].dispatchEvent(new Event("invalid")))}}_associateForm(e,t){a(e,this,t)}_findAssociatedForm(e){return i(e)}}HTMLElement.prototype.attachInternals=function(){if(this.hasOwnProperty(Me.internals))throw new DOMException("Invalid operation");if(this.tagName.includes("-"))return new c(this,Me.key);throw new DOMException("Cannot call attachInternals on built-in elements.")},globalThis.ElementInternals=c}if("ElementInternals"in globalThis&&!("CustomStateSet"in globalThis)){const e="_state",t=new WeakMap,n=t=>{if(t.toString().startsWith("--"))return`${e}${t}`;throw new DOMException(`Failed to execute 'add' on 'CustomStateSet': The specified value '${t}' must start with '--'.`)},{value:o,writable:r,configurable:i,enumerable:a}=Object.getOwnPropertyDescriptor(HTMLElement.prototype,"attachInternals");class s{constructor(e,n){if(n!==Me.key)throw new TypeError("Illegal Constructor");if(!(e instanceof HTMLElement))throw new TypeError("el must be an HTMLElement");t.set(this,e),this.add("--custom-states-polyfilled")}get _polyfilled(){return!0}get size(){return[...this.values()].length}add(e){t.get(this).classList.add(n(e))}has(e){return t.get(this).classList.contains(n(e))}delete(e){const o=n(e);return!!t.get(this).classList.contains(o)&&(t.get(this).classList.remove(o),!0)}clear(){this.values().forEach((e=>this.delete(e)))}keys(){return this.values()}values(){return t.get(this).classList.values().filter((t=>t.startsWith(`${e}--`))).map((t=>t.substr(e.length)))}entries(){return this.values().map((e=>[e,e]))}forEach(e,t){this.values().forEach((n=>e.call(t||this,n,n,this)))}[Symbol.toStringTag](){return"CustomStateSet"}[Symbol.iterator](){return this.values()}}Object.defineProperty(HTMLElement.prototype,"attachInternals",{value:function(){const e=o.call(this);return Object.defineProperty(e,Me.element,{value:this,enumerable:!1,writable:!1,configurable:!1}),Object.defineProperty(e,"states",{value:new s(this,Me.key),configurable:!0,enumberable:!0}),Object.is(e.shadowRoot,null)&&!Object.is(this.shadowRoot,null)&&Object.defineProperty(e,"shadowRoot",{value:this.shadowRoot,configurable:!0,enumerable:!0}),e},writable:r,configurable:i,enumerable:a}),globalThis.CustomStateSet=s,function(e){const t=Object.fromEntries(Object.keys(ge).map((e=>[e,{get:function(){return this[Me.element][e]},set:function(t){this[Me.element][e]=t},enumerable:!0,configurable:!0}])));Object.defineProperties(e,t)}(ElementInternals.prototype)}e(Response,"json",((e,{status:t=200,statusText:n="",headers:o=new Headers}={})=>o instanceof Headers?(o.set("Content-Type","application/json"),new Response(JSON.stringify(e),{status:t,statusText:n,headers:o})):Response.json(e,{status:t,statusText:n,headers:new Headers(o)}))),e(Response,"redirect",((e,t=302)=>new Response("",{status:t,headers:new Headers({Location:e})})))}();
|
|
66
66
|
//# sourceMappingURL=all.min.js.map
|