@shgysk8zer0/polyfills 0.5.3 → 0.5.5
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 +3 -3
- package/all.min.js.map +1 -1
- package/browser.min.js +3 -3
- package/browser.min.js.map +1 -1
- package/package.json +2 -2
package/browser.min.js
CHANGED
|
@@ -26,10 +26,10 @@
|
|
|
26
26
|
*/("HTMLElement"in globalThis&&!("trustedTypes"in globalThis)||"HTMLElement"in globalThis&&globalThis.trustedTypes[Symbol.for("polyfilled")]&&globalThis.trustedTypes[Symbol.for("enforced")])&&function(){function e(){return"trustedTypes"in globalThis}function t(){return e()&&!Object.is(trustedTypes.defaultPolicy,null)}function r(r){if(function(t){return e()&&trustedTypes.isHTML(t)}(r)||!e())return r;if(t())return trustedTypes.defaultPolicy.createHTML(r);throw new TypeError("Attempting to set HTML and no default policy is available.")}function n(r){if(function(t){return e()&&trustedTypes.isScript(t)}(r)||!e())return r;if(t())return trustedTypes.defaultPolicy.createScript(r);throw new TypeError("Attempting to create script and no default policy is available.")}function o(r){if(function(t){return e()&&trustedTypes.isScriptURL(t)}(r)||!e())return r;if(t())return trustedTypes.defaultPolicy.createScriptURL(r);throw new TypeError("Attempting to create script URL and no default policy is available.")}function i(t,r,n){return e()?trustedTypes.getAttributeType(t,r,n):null}try{const{write:e,writeln:t,execCommand:n}=Object.getOwnPropertyDescriptors(Document.prototype);Object.defineProperties(Document.prototype,{write:{value:function(t){e.value.call(this,r(t))},enumerable:e.enumerable,configurable:e.configurable,writable:e.writable},writeln:{value:function(e){t.value.call(this,r(e))},enumerable:t.enumerable,configurable:t.configurable,writable:t.writable},execCommand:{value:function(e,t,o){return["insertHTML"].includes(e)?n.value.call(this,e,t,r(o)):n.value.call(this,e,t,o)},enumerable:n.enumerable,configurable:n.configurable}})}catch(e){console.error(e)}if("ServiceWorkerContainer"in globalThis)try{const e=Object.getOwnPropertyDescriptor(ServiceWorkerContainer.prototype,"register");Object.defineProperty(ServiceWorkerContainer.prototype,"register",{value:function(t,r){return e.value.call(this,o(t),r)},enumerable:e.enumerable,configurable:e.configurable})}catch(e){console.error(e)}try{const e=Object.getOwnPropertyDescriptor(Range.prototype,"createContextualFragment");Object.defineProperty(Range.prototype,"createContextualFragment",{value:function(t){return e.value.call(this,r(t))},enumerable:e.enumerable,configurable:e.configurable})}catch(e){console.error(e)}try{const{parseFromString:e}=Object.getOwnPropertyDescriptors(DOMParser.prototype);Object.defineProperties(DOMParser.prototype,{parseFromString:{value:function(t,n){return"text/html"===n?e.value.call(this,r(t),n):e.value.call(this,t,n)},enumerable:e.enumerable,configurable:e.configurable,writable:e.writable}})}catch(e){console.error(e)}try{const{src:e,text:t}=Object.getOwnPropertyDescriptors(HTMLScriptElement.prototype);Object.defineProperties(HTMLScriptElement.prototype,{text:{get:function(){return t.get.call(this)},set:function(e){t.set.call(this,n(e))},enumerable:t.enumerable,configurable:t.configurable},src:{get:function(){return e.get.call(this)},set:function(t){e.set.call(this,o(t))},enumerable:e.enumerable,configurable:e.configurable}})}catch(e){console.error(e)}try{const{setAttribute:e,setAttributeNS:t,innerHTML:a,outerHTML:s,insertAdjacentHTML:l}=Object.getOwnPropertyDescriptors(Element.prototype);Object.defineProperties(Element.prototype,{setAttribute:{value:function(t,a){switch(i(this.tagName,t)){case"TrustedHTML":e.value.call(this,t,r(a));break;case"TrustedScript":e.value.call(this,t,n(a));break;case"TrustedScriptURL":e.value.call(this,t,o(a));break;default:e.value.call(this,t,a)}},enumerable:e.enumerable,configurable:e.configurable},setAttributeNS:{value:function(e,a,s){switch(i(this.tagName,a,e)){case"TrustedHTML":t.value.call(this,e,a,r(s));break;case"TrustedScript":t.value.call(this,e,a,n(s));break;case"TrustedScriptURL":t.value.call(this,e,a,o(s));break;default:t.value.call(this,e,a,s)}},enumerable:t.enumerable,configurable:t.configurable},innerHTML:{get:function(){return a.get.call(this)},set:function(e){a.set.call(this,r(e))},enumerable:a.enumerable,configurable:a.configurable},outerHTML:{get:function(){return s.get.call(this)},set:function(e){s.set.call(this,r(e))},enumerable:s.enumerable,configurable:s.configurable},insertAdjacentHTML:{value:function(e,t){l.value.call(this,e,r(t))},enumerable:l.enumerable,configurable:l.configurable}})}catch(e){console.error(e)}try{const{srcdoc:e,src:t}=Object.getOwnPropertyDescriptors(HTMLIFrameElement.prototype);Object.defineProperties(HTMLIFrameElement.prototype,{srcdoc:{get:function(){return e.get.call(this)},set:function(t){e.set.call(this,r(t))},enumerable:e.enumerable,configurable:e.configurable},src:{get:function(){return t.get.call(this)},set:function(e){t.set.call(this,o(e))},enumerable:t.enumerable,configurable:t.configurable}})}catch(e){console.error(e)}try{const{data:e,codeBase:t}=Object.getOwnPropertyDescriptors(HTMLObjectElement.prototype);Object.defineProperties(HTMLObjectElement.prototype,{data:{get:function(){return e.get.call(this)},set:function(t){e.set.call(this,o(t))},enumerable:e.enumerable,configurable:e.configurable},codeBase:{get:function(){return t.get.call(this)},set:function(e){t.set.call(this,o(e))},enumerable:t.enumerable,configurable:t.configurable}})}catch(e){console.error(e)}try{const{eval:e,setTimeout:t,setInterval:r}=globalThis;globalThis.eval=function(t){return e(n(t).toString())},globalThis.setTimeout=function(e,r,...o){return"string"==typeof e?t(n(e),r,...o):t(e,r,...o)},globalThis.setInterval=function(e,t,...o){return"string"==typeof e?r(n(e),t,...o):r(e,t,...o)};try{const e=globalThis.Function;globalThis.Function=function(...t){if(0===t.length)return e();{const r=n(t.pop());return e(...t,r.toString())}},globalThis.Function.prototype=e.prototype,e.prototype.constructor=globalThis.Function}catch(e){console.error(e)}}catch(e){console.error(e)}}();const ee={get(){return Array.from(this.styleSheets).filter(e=>e.ownerNode.classList.contains("_adopted"))},set(e){if(!Array.isArray(e))throw new TypeError("Must be an array");{const t=new Set(this.adoptedStyleSheets);t.difference(e).forEach(e=>e.ownerNode.remove());const r=[...new Set(e).difference(t)].map(e=>{const t=document.createElement("link"),r=new AbortController,n=r.signal,o=URL.createObjectURL(new File([],"adopted.css",{type:"text/css"}));return t.rel="stylesheet",t.href=o,t.classList.add("_adopted"),t.disabled=e.disabled,t.addEventListener("load",({target:n})=>{r.abort(),t.media=e.media.mediaText,[...e.cssRules].forEach((e,t)=>{n.sheet.insertRule(e.cssText,t)}),setTimeout(()=>URL.revokeObjectURL(n.href),100)},{once:!0,signal:n}),t.addEventListener("error",({target:e})=>{r.abort(),URL.revokeObjectURL(e.href)},{once:!0,signal:n}),t});this instanceof Document?this.head.append(...r):this.append(...r)}}},te=Symbol("shadow:hosts");function re(e){if(e instanceof HTMLTemplateElement&&e.parentElement instanceof HTMLElement){e.parentElement.attachShadow({mode:e.getAttribute("shadowrootmode"),clonable:e.hasAttribute("shadowrootclonable"),delegatesFocus:e.hasAttribute("shadowrootdelegatesfocus"),serializable:e.hasAttribute("shadowrootserializable")}).append(e.content),e.remove()}}function ne(e,{serializableShadowRoots:t=!1,shadowRoots:r=[],[te]:n=[]}={}){return Array.from(e.childNodes,e=>{if(e.nodeType===Node.ELEMENT_NODE){const[o,i]=function(e){const t=e.cloneNode().outerHTML,r=t.indexOf("/")-1;return r>0?[t.substring(0,r),t.substring(r)]:[t,""]}(e);return o+e.getHTML({serializableShadowRoots:t,shadowRoots:r,[te]:n})+i}return e.textContent}).join("")}function oe(e,{serializableShadowRoots:t,shadowRoots:r,[te]:n=[]}={}){if(e.serializable){const o=`<template shadowrootmode="${e.mode}"`,i=[];e.clonable&&i.push(' shadowrootclonable=""'),e.serializable&&i.push(' shadowrootserializable=""'),e.delegatesFocus&&i.push(' shadowrootdelegatesfocus=""');return(0===i.length?o+">":o+" "+i.join("")+">")+ne(e,{serializableShadowRoots:t,shadowRoots:r,[te]:n})+"</template>"}return ne(e,{serializableShadowRoots:t,shadowRoots:r,[te]:n})}function ie(e){const t=(new DOMParser).parseFromString(e,"text/html"),r=document.createDocumentFragment();r.append(...t.body.childNodes),r.querySelectorAll("* > template[shadowrootmode]").forEach(re),this.replaceChildren(r)}function ae({serializableShadowRoots:e=!1,shadowRoots:t=[],[te]:r=[]}={}){switch(e&&0===r.length&&0!==t.length&&r.push(...t.map(e=>e.host)),this.nodeType){case Node.ELEMENT_NODE:if(e&&this.shadowRoot instanceof ShadowRoot&&(this.shadowRoot.serializable||t.includes(this.shadowRoot)))return this.shadowRoot.getHTML({serializableShadowRoots:e,shadowRoots:t,[te]:r})+ne(this,{serializableShadowRoots:e,shadowRoots:t,[te]:r});if(e&&r.includes(this)){return oe(t.find(e=>e.host.isSameNode(this)),{serializableShadowRoots:e,shadowRoots:t,[te]:r})+ne(this,{serializableShadowRoots:e,shadowRoots:t,[te]:r})}return this.innerHTML;case Node.DOCUMENT_FRAGMENT_NODE:return this instanceof ShadowRoot?e&&(this.serializable||t.includes(this))?oe(this,{serializableShadowRoots:e,shadowRoots:t,[te]:r}):ne(this,{serializableShadowRoots:e,shadowRoots:t,[te]:r}):"";default:throw new TypeError("'getHTML' called on an object that does not implement interface Element.")}}function se(e){for(;e.cssRules.length>0;)e.deleteRule(0)}c(Document.prototype,"adoptedStyleSheets",ee),l(Document,"parseHTMLUnsafe",function(e){const t=new DOMParser,r=document.implementation.createHTMLDocument(),n=t.parseFromString(e,"text/html");return r.head.append(...n.head.childNodes),r.body.append(...n.body.childNodes),r.querySelectorAll("* > template[shadowrootmode]").forEach(re),r}),"ShadowRoot"in globalThis&&(c(ShadowRoot.prototype,"adoptedStyleSheets",ee),l(ShadowRoot.prototype,"setHTMLUnsafe",ie),l(ShadowRoot.prototype,"getHTML",ae));try{new CSSStyleSheet}catch{const gt=globalThis.CSSStyleSheet;globalThis.CSSStyleSheet=function({disabled:e=!1,media:t}={}){const r=function(e="",{disabled:t=!1,media:r}={}){const n=Document.parseHTML(`<style>${e}</style>`,{sanitizer:{allowElements:["style","html","head","body"]}}).styleSheets.item(0);return"string"==typeof r&&n.media.appendMedium(r),n.disabled=t,n}("#dfgbkjdfg{color:red;}",{disabled:e,media:t});return r.deleteRule(0),r},globalThis.CSSStyleSheet.prototype=gt.prototype,gt.prototype.constructor=globalThis.CSSStyleSheet}CSSStyleSheet.prototype.replace instanceof Function||(CSSStyleSheet.prototype.replace=function(e){const t=document.createElement("link"),r=new AbortController,{resolve:n,reject:o,promise:i}=Promise.withResolvers();return t.addEventListener("load",({target:e})=>{se(this),[...e.sheet.cssRules].forEach((e,t)=>this.insertRule(e.cssText,t)),n(this),r.abort(),URL.revokeObjectURL(e.href),e.remove()},{once:!0,signal:r.signal}),t.addEventListener("error",({target:e})=>{const t=new DOMException("Error loading stylesheet.");o(t),r.abort(t),URL.revokeObjectURL(e.href),e.remove()},{once:!0,signal:r.signal}),t.rel="stylesheet",t.crossOrigin="anonymous",t.referrerPolicy="no-referrer",t.media="no-op",t.href=URL.createObjectURL(new File([e],"tmp.css",{type:"text/css"})),document.head.append(t),i}),CSSStyleSheet.prototype.replaceSync instanceof Function||(CSSStyleSheet.prototype.replaceSync=function(e){const t=Document.parseHTML(`<style>${e}</style>`,{sanitizer:{allowElements:["style","html","head","body"]}}).styleSheets.item(0);se(this),[...t.cssRules].forEach((e,t)=>this.insertRule(e.cssText,t))});const le={ariaAtomic:"aria-atomic",ariaAutoComplete:"aria-autocomplete",ariaBusy:"aria-busy",ariaChecked:"aria-checked",ariaColCount:"aria-colcount",ariaColIndex:"aria-colindex",ariaColIndexText:"aria-colindextext",ariaColSpan:"aria-colspan",ariaCurrent:"aria-current",ariaDisabled:"aria-disabled",ariaExpanded:"aria-expanded",ariaHasPopup:"aria-haspopup",ariaHidden:"aria-hidden",ariaInvalid:"aria-invalid",ariaKeyShortcuts:"aria-keyshortcuts",ariaLabel:"aria-label",ariaLevel:"aria-level",ariaLive:"aria-live",ariaModal:"aria-modal",ariaMultiLine:"aria-multiline",ariaMultiSelectable:"aria-multiselectable",ariaOrientation:"aria-orientation",ariaPlaceholder:"aria-placeholder",ariaPosInSet:"aria-posinset",ariaPressed:"aria-pressed",ariaReadOnly:"aria-readonly",ariaRelevant:"aria-relevant",ariaRequired:"aria-required",ariaRoleDescription:"aria-roledescription",ariaRowCount:"aria-rowcount",ariaRowIndex:"aria-rowindex",ariaRowIndexText:"aria-rowindextext",ariaRowSpan:"aria-rowspan",ariaSelected:"aria-selected",ariaSetSize:"aria-setsize",ariaSort:"aria-sort",ariaValueMax:"aria-valuemax",ariaValueMin:"aria-valuemin",ariaValueNow:"aria-valuenow",ariaValueText:"aria-valuetext",role:"role"},ce="http://www.w3.org/1999/xhtml",ue="http://www.w3.org/1999/xlink",pe="http://www.w3.org/1998/Math/MathML",he=new Set(("HTMLElement"in globalThis?Object.keys(HTMLElement.prototype):[]).filter(e=>e.startsWith("on")));
|
|
27
27
|
/**
|
|
28
28
|
* @copyright 2023-2024 Chris Zuber <admin@kernvalley.us>
|
|
29
|
-
*/function fe(e,t=ce){if("string"==typeof e)return Object.freeze({name:e,namespace:t});if("object"==typeof e&&"string"==typeof e.name){const{name:r,namespace:n=t,attributes:o}=e;return Object.freeze({name:r,namespace:"string"==typeof n&&0!==n.length?n:t,attributes:o})}throw new TypeError("Invalid config entry for `elements`.")}function de({elements:e,allowElements:t},r=ce){if(Array.isArray(t))return console.warn("Use of `allowElements` is deprecated. Please use `elements` instead."),de({elements:t},r);if(Array.isArray(e))return e.map(e=>fe(e,r));throw new TypeError("`elements` expected to be an array.")}function me(e,t){if("string"==typeof e)return Object.freeze({name:e,namespace:t});if("object"==typeof e&&"string"==typeof e.name){const{name:r,namespace:n=t,elements:o,...i}=e;return Object.freeze({name:r,namespace:"string"==typeof n?n:t,elements:o,...i})}throw new TypeError("Invalid entry in `attributes` config.")}function ge({attributes:e,allowAttributes:t},r){if(void 0!==t)return console.warn("Use of `allowAttributes` is deprecated. Please use `attributes` instead."),ge({attributes:t},r);if(Array.isArray(e))return e.map(e=>me(e,r));if("object"==typeof e&&null!==e)return console.warn("`attributes` should be an array, not an oobject."),ge({attributes:Object.entries(e).map(([e,t])=>({name:e,elements:t}))},r);throw new TypeError("`attributes` expected to be an array.")}function be({comments:e,allowComments:t}){return"boolean"==typeof t?(console.warn("Use of `allowComments` is deprecated. Please use `comments` instead."),t):"boolean"!=typeof e||e}function ye({attributes:e,allowAttributes:t},r){return Object.freeze(Object.groupBy(ge({attributes:e,allowAttributes:t},r),({namespace:e})=>e??""))}function we({elements:e,allowElements:t},r=ce){return Object.freeze(Object.groupBy(de({elements:e,allowElements:t},r),({namespace:e})=>e))}function ve(e,{elementNS:t=ce,attributeNS:r}={}){if("object"!=typeof e||null===e)throw new TypeError("Sanitizer config must be an object.");return e.get instanceof Function?ve(e.get()):Object.freeze({elements:we(e,t),attributes:ye(e,r),comments:be(e),dataAttributes:void 0===e.dataAttributes||e.dataAttributes})}const Te=Object.freeze(["accesskey","autocapitalize","autofocus","class","contenteditable","dir","draggable","enterkeyhint","exportparts","height","hidden","id","inert","inputmode","itemid","itemprop","itemref","itemscope","itemtype","lang","part","popover","slot","spellcheck","tabindex","title","translate","virtualkeyboardpolicy","width","aria-keyshortcuts","aria-activedescendant","aria-atomic","aria-autocomplete","aria-braillelabel","aria-brailleroledescription","aria-busy","aria-checked","aria-colcount","aria-colindex","aria-colindextext","aria-colspan","aria-controls","aria-current","aria-describedby","aria-description","aria-details","aria-disabled","aria-dropeffect","aria-errormessage","aria-expanded","aria-flowto","aria-grabbed","aria-haspopup","aria-hidden","aria-invalid","aria-label","aria-labelledby","aria-level","aria-live","aria-modal","aria-multiline","aria-multiselectable","aria-orientation","aria-owns","aria-placeholder","aria-posinset","aria-pressed","aria-readonly","aria-relevant","aria-required","aria-roledescription","aria-rowcount","aria-rowindex","aria-rowindextext","aria-rowspan","aria-selected","aria-setsize","aria-sort","aria-valuemax","aria-valuemin","aria-valuenow","aria-valuetext"].map(e=>me(e,null))),Ee=Object.freeze(["html","head","link","meta","body","address","`article","aside","footer","header","h1","h2","h3","h4","h5","h6","hgroup","main","nav","section","search","blockquote","cite","div","dd","dt","dl","figcaption","figure","hr","li","ol","ul","menu","p","pre","a","abbr","b","bdi","bdo","br","code","data","dfn","em","i","kbd","mark","q","rp","ruby","rt","s","del","ins","samp","small","span","strong","sub","sup","time","u","var","wbr","area","audio","img","map","track","video","picture","source","canvas","caption","col","colgroup","table","tbody","tr","td","tfoot","th","thead","button","datalist","option","fieldset","label","form","input","legend","meter","optgroup","select","output","progress","textarea","details","summary","dialog","slot","dir","template","strike","selectmenu","center"].map(e=>fe(e,ce))),Se=Object.freeze(["abbr","accept","accept-charset","align","alink","allow","allowfullscreen","alt","anchor","archive","as","async","autocomplete","autocorrect","autopictureinpicture","autoplay","axis","background","behavior","border","bordercolor","capture","cellpadding","cellspacing","challenge","char","charoff","charset","checked","cite","classid","clear","code","codetype","color","cols","colspan","command","commandfor","compact","content","controls","controlslist","conversiondestination","coords","crossorigin","csp","data","datetime","declare","decoding","default","defer","direction","dirname","disabled","disablepictureinpicture","disableremoteplayback","disallowdocumentaccess","download","elementtiming","enctype","end","for","form","formenctype","formmethod","formnovalidate","formtarget","frameborder","headers","high","href","hreflang","hreftranslate","hspace","imagesizes","imagesrcset","importance","impressiondata","impressionexpiry","incremental","integrity","invisible","is","ismap","keytype","kind","label","language","latencyhint","leftmargin","link","list","loading","longdesc","loop","low","lowsrc","manifest","marginheight","marginwidth","max","maxlength","mayscript","media","method","min","minlength","multiple","muted","name","nohref","nomodule","noresize","noshade","novalidate","nowrap","object","open","optimum","pattern","ping","placeholder","playsinline","policy","popovertarget","popovertargetaction","poster","preload","pseudo","readonly","referrerpolicy","rel","reportingorigin","required","resources","rev","reversed","role","rows","rowspan","rules","sandbox","scheme","scope","scopes","scrollamount","scrolldelay","scrolling","select","selected","shadowrootclonable","shadowrootdelegatesfocus","shadowrootmode","shadowrootserializable","shape","size","sizes","span","src","srcdoc","srclang","srcset","standby","start","step","summary","target","text","topmargin","truespeed","trusttoken","type","usemap","valign","value","valuetype","version","vlink","vspace","webkitdirectory","wrap"].map(e=>me(e,null))),Ae=Object.freeze(Se.concat(Te)),Me=Object.freeze({comments:!0,elements:Ee,attributes:Ae,dataAttributes:!0}),xe=Object.freeze(["a","animate","animateMotion","animateTransform","circle","clipPath","defs","desc","ellipse","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","filter","foreignObject","g","line","linearGradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialGradient","rect","script","set","stop","style","svg","switch","symbol","text","textPath","title","tspan","view","missing-glyph","font","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","hkern","vkern","glyph","glyphRef","tref","cursor"].map(e=>fe(e,"http://www.w3.org/2000/svg"))),Le=Object.freeze(["accent-height","accumulate","additive","alignment-baseline","alphabetic","amplitude","arabic-form","ascent","attributeName","attributeType","azimuth","baseFrequency","baseline-shift","baseProfile","bbox","begin","bias","by","calcMode","cap-height","clip","clipPathUnits","clip-path","clip-rule","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cursor","cx","cy","d","decelerate","descent","diffuseConstant","display","divisor","dominant-baseline","dur","dx","dy","edgeMode","elevation","enable-background","exponent","fill","fill-opacity","fill-rule","filter","filterUnits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","format","from","fr","fx","fy","g1","g2","glyph-name","glyph-orientation-horizontal","glyph-orientation-vertical","glyphRef","gradientTransform","gradientUnits","hanging","horiz-adv-x","horiz-origin-x","ideographic","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kernelMatrix","kernelUnitLength","kerning","keyPoints","keySplines","keyTimes","lengthAdjust","letter-spacing","lighting-color","limitingConeAngle","local","marker-end","marker-mid","marker-start","markerHeight","markerUnits","markerWidth","mask","maskContentUnits","maskUnits","mathematical","mode","numOctaves","offset","opacity","operator","order","orient","orientation","origin","overflow","overline-position","overline-thickness","panose-1","paint-order","path","pathLength","patternContentUnits","patternTransform","patternUnits","pointer-events","points","pointsAtX","pointsAtY","pointsAtZ","preserveAlpha","preserveAspectRatio","primitiveUnits","r","radius","refX","refY","rendering-intent","repeatCount","repeatDur","requiredExtensions","requiredFeatures","restart","result","rotate","rx","ry","scale","seed","shape-rendering","slope","spacing","specularConstant","specularExponent","speed","spreadMethod","startOffset","stdDeviation","stemh","stemv","stitchTiles","stop-color","stop-opacity","strikethrough-position","strikethrough-thickness","string","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","surfaceScale","systemLanguage","tableValues","targetX","targetY","text-anchor","text-decoration","text-rendering","textLength","to","transform","transform-origin","u1","u2","underline-position","underline-thickness","unicode","unicode-bidi","unicode-range","units-per-em","v-alphabetic","v-hanging","v-ideographic","v-mathematical","values","vector-effect","vert-adv-y","vert-origin-x","vert-origin-y","viewBox","visibility","widths","word-spacing","writing-mode","x","x-height","x1","x2","xChannelSelector","y","y1","y2","yChannelSelector","z","zoomAndPan","autoReverse","accelerate","xmlns",{name:"actuate",namespace:ue},{name:"arcrole",namespaec:ue},{name:"href",namespace:ue},{name:"role",namespace:ue},{name:"show",namespace:ue},{name:"title",namespace:ue},{name:"type",namespace:ue},{name:"space",namespace:"http://www.w3.org/XML/1998/namespace"}].map(e=>"string"==typeof e?me(e):e));
|
|
29
|
+
*/function fe(e,t=ce){if("string"==typeof e)return Object.freeze({name:e,namespace:t});if("object"==typeof e&&"string"==typeof e.name){const{name:r,namespace:n=t,attributes:o}=e;return Object.freeze({name:r,namespace:"string"==typeof n&&0!==n.length?n:t,attributes:o})}throw new TypeError("Invalid config entry for `elements`.")}function de({elements:e,allowElements:t},r=ce){if(Array.isArray(t))return console.warn("Use of `allowElements` is deprecated. Please use `elements` instead."),de({elements:t},r);if(Array.isArray(e))return e.map(e=>fe(e,r));throw new TypeError("`elements` expected to be an array.")}function me(e,t){if("string"==typeof e)return Object.freeze({name:e,namespace:t});if("object"==typeof e&&"string"==typeof e.name){const{name:r,namespace:n=t,elements:o,...i}=e;return Object.freeze({name:r,namespace:"string"==typeof n?n:t,elements:o,...i})}throw new TypeError("Invalid entry in `attributes` config.")}function ge({attributes:e,allowAttributes:t},r){if(void 0!==t)return console.warn("Use of `allowAttributes` is deprecated. Please use `attributes` instead."),ge({attributes:t},r);if(Array.isArray(e))return e.map(e=>me(e,r));if("object"==typeof e&&null!==e)return console.warn("`attributes` should be an array, not an oobject."),ge({attributes:Object.entries(e).map(([e,t])=>({name:e,elements:t}))},r);throw new TypeError("`attributes` expected to be an array.")}function be({comments:e,allowComments:t}){return"boolean"==typeof t?(console.warn("Use of `allowComments` is deprecated. Please use `comments` instead."),t):"boolean"!=typeof e||e}function ye({attributes:e,allowAttributes:t},r){return Object.freeze(Object.groupBy(ge({attributes:e,allowAttributes:t},r),({namespace:e})=>e??""))}function we({elements:e,allowElements:t},r=ce){return Object.freeze(Object.groupBy(de({elements:e,allowElements:t},r),({namespace:e})=>e))}function ve(e,{elementNS:t=ce,attributeNS:r}={}){if("object"!=typeof e||null===e)throw new TypeError("Sanitizer config must be an object.");return e.get instanceof Function?ve(e.get()):Object.freeze({elements:we(e,t),attributes:ye(e,r),comments:be(e),dataAttributes:void 0===e.dataAttributes||e.dataAttributes})}const Te=Object.freeze(["accesskey","autocapitalize","autofocus","class","contenteditable","dir","draggable","enterkeyhint","exportparts","height","hidden","id","inert","inputmode","itemid","itemprop","itemref","itemscope","itemtype","lang","part","popover","slot","spellcheck","tabindex","title","translate","virtualkeyboardpolicy","width","aria-keyshortcuts","aria-activedescendant","aria-atomic","aria-autocomplete","aria-braillelabel","aria-brailleroledescription","aria-busy","aria-checked","aria-colcount","aria-colindex","aria-colindextext","aria-colspan","aria-controls","aria-current","aria-describedby","aria-description","aria-details","aria-disabled","aria-dropeffect","aria-errormessage","aria-expanded","aria-flowto","aria-grabbed","aria-haspopup","aria-hidden","aria-invalid","aria-label","aria-labelledby","aria-level","aria-live","aria-modal","aria-multiline","aria-multiselectable","aria-orientation","aria-owns","aria-placeholder","aria-posinset","aria-pressed","aria-readonly","aria-relevant","aria-required","aria-roledescription","aria-rowcount","aria-rowindex","aria-rowindextext","aria-rowspan","aria-selected","aria-setsize","aria-sort","aria-valuemax","aria-valuemin","aria-valuenow","aria-valuetext"].map(e=>me(e,null))),Ee=Object.freeze(["html","head","link","meta","body","address","article","aside","footer","header","h1","h2","h3","h4","h5","h6","hgroup","main","nav","section","search","blockquote","cite","div","dd","dt","dl","figcaption","figure","hr","li","ol","ul","menu","p","pre","a","abbr","b","bdi","bdo","br","code","data","dfn","em","i","kbd","mark","q","rp","ruby","rt","s","del","ins","samp","small","span","strong","sub","sup","time","u","var","wbr","area","audio","img","map","track","video","picture","source","canvas","caption","col","colgroup","table","tbody","tr","td","tfoot","th","thead","button","datalist","option","fieldset","label","form","input","legend","meter","optgroup","select","output","progress","textarea","details","summary","dialog","slot","dir","template","strike","selectmenu","center"].map(e=>fe(e,ce))),Se=Object.freeze(["abbr","accept","accept-charset","align","alink","allow","allowfullscreen","alt","anchor","archive","as","async","autocomplete","autocorrect","autopictureinpicture","autoplay","axis","background","behavior","border","bordercolor","capture","cellpadding","cellspacing","challenge","char","charoff","charset","checked","cite","classid","clear","code","codetype","color","cols","colspan","command","commandfor","compact","content","controls","controlslist","conversiondestination","coords","crossorigin","csp","data","datetime","declare","decoding","default","defer","direction","dirname","disabled","disablepictureinpicture","disableremoteplayback","disallowdocumentaccess","download","elementtiming","enctype","end","for","form","formenctype","formmethod","formnovalidate","formtarget","frameborder","headers","high","href","hreflang","hreftranslate","hspace","imagesizes","imagesrcset","importance","impressiondata","impressionexpiry","incremental","integrity","invisible","is","ismap","keytype","kind","label","language","latencyhint","leftmargin","link","list","loading","longdesc","loop","low","lowsrc","manifest","marginheight","marginwidth","max","maxlength","mayscript","media","method","min","minlength","multiple","muted","name","nohref","nomodule","noresize","noshade","novalidate","nowrap","object","open","optimum","pattern","ping","placeholder","playsinline","policy","popovertarget","popovertargetaction","poster","preload","pseudo","readonly","referrerpolicy","rel","reportingorigin","required","resources","rev","reversed","role","rows","rowspan","rules","sandbox","scheme","scope","scopes","scrollamount","scrolldelay","scrolling","select","selected","shadowrootclonable","shadowrootdelegatesfocus","shadowrootmode","shadowrootserializable","shape","size","sizes","span","src","srcdoc","srclang","srcset","standby","start","step","summary","target","text","topmargin","truespeed","trusttoken","type","usemap","valign","value","valuetype","version","vlink","vspace","webkitdirectory","wrap"].map(e=>me(e,null))),Ae=Object.freeze(Se.concat(Te)),Me=Object.freeze({comments:!0,elements:Ee,attributes:Ae,dataAttributes:!0}),xe=Object.freeze(["a","animate","animateMotion","animateTransform","circle","clipPath","defs","desc","ellipse","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","filter","foreignObject","g","line","linearGradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialGradient","rect","script","set","stop","style","svg","switch","symbol","text","textPath","title","tspan","view","missing-glyph","font","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","hkern","vkern","glyph","glyphRef","tref","cursor"].map(e=>fe(e,"http://www.w3.org/2000/svg"))),Le=Object.freeze(["accent-height","accumulate","additive","alignment-baseline","alphabetic","amplitude","arabic-form","ascent","attributeName","attributeType","azimuth","baseFrequency","baseline-shift","baseProfile","bbox","begin","bias","by","calcMode","cap-height","clip","clipPathUnits","clip-path","clip-rule","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cursor","cx","cy","d","decelerate","descent","diffuseConstant","display","divisor","dominant-baseline","dur","dx","dy","edgeMode","elevation","enable-background","exponent","fill","fill-opacity","fill-rule","filter","filterUnits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","format","from","fr","fx","fy","g1","g2","glyph-name","glyph-orientation-horizontal","glyph-orientation-vertical","glyphRef","gradientTransform","gradientUnits","hanging","horiz-adv-x","horiz-origin-x","ideographic","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kernelMatrix","kernelUnitLength","kerning","keyPoints","keySplines","keyTimes","lengthAdjust","letter-spacing","lighting-color","limitingConeAngle","local","marker-end","marker-mid","marker-start","markerHeight","markerUnits","markerWidth","mask","maskContentUnits","maskUnits","mathematical","mode","numOctaves","offset","opacity","operator","order","orient","orientation","origin","overflow","overline-position","overline-thickness","panose-1","paint-order","path","pathLength","patternContentUnits","patternTransform","patternUnits","pointer-events","points","pointsAtX","pointsAtY","pointsAtZ","preserveAlpha","preserveAspectRatio","primitiveUnits","r","radius","refX","refY","rendering-intent","repeatCount","repeatDur","requiredExtensions","requiredFeatures","restart","result","rotate","rx","ry","scale","seed","shape-rendering","slope","spacing","specularConstant","specularExponent","speed","spreadMethod","startOffset","stdDeviation","stemh","stemv","stitchTiles","stop-color","stop-opacity","strikethrough-position","strikethrough-thickness","string","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","surfaceScale","systemLanguage","tableValues","targetX","targetY","text-anchor","text-decoration","text-rendering","textLength","to","transform","transform-origin","u1","u2","underline-position","underline-thickness","unicode","unicode-bidi","unicode-range","units-per-em","v-alphabetic","v-hanging","v-ideographic","v-mathematical","values","vector-effect","vert-adv-y","vert-origin-x","vert-origin-y","viewBox","visibility","widths","word-spacing","writing-mode","x","x-height","x1","x2","xChannelSelector","y","y1","y2","yChannelSelector","z","zoomAndPan","autoReverse","accelerate","xmlns",{name:"actuate",namespace:ue},{name:"arcrole",namespaec:ue},{name:"href",namespace:ue},{name:"role",namespace:ue},{name:"show",namespace:ue},{name:"title",namespace:ue},{name:"type",namespace:ue},{name:"space",namespace:"http://www.w3.org/XML/1998/namespace"}].map(e=>"string"==typeof e?me(e):e));
|
|
30
30
|
/**
|
|
31
|
-
* @copyright 2023-
|
|
32
|
-
* @see https://wicg.github.io/sanitizer-api/#default-configuration
|
|
31
|
+
* @copyright 2023-2025 Chris Zuber <admin@kernvalley.us>
|
|
32
|
+
* @see https://wicg.github.io/sanitizer-api/#built-in-safe-default-configuration
|
|
33
33
|
*/Object.freeze(Le.concat(Te));const Oe=Object.freeze(["math","maction","annotation","annotation-xml","menclose","merror","mfenced","mfrac","mi","mmultiscripts","mn","mo","mover","mpadded","mphantom","mprescripts","mroot","mrow","ms","semantics","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover"].map(e=>fe(e,pe))),ke=Object.freeze(["accent","accentunder","actiontype","align","background","close","color","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","fence","fontfamily","fontsize","fontstyle","fontweight","frame","framespacing","height","href","id","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","superscriptshift","symmetric","voffset","width","xmlns"].map(e=>me(e,pe)));Object.freeze(ke.concat(Te)),Object.freeze([...Ee,...xe]),Object.freeze([...Te,...Se,...Le]),Object.freeze([...Ee,...xe,...Oe]),Object.freeze([...Te,...Se,...Le,...ke]);const Pe=new Set(["href","src","action","xlink:href"]),Re=new Set(["javascript:","data:","file:","ftp:"]),Fe=function(e,{createHTML:t,createScript:r,createScriptURL:n}){return"trustedTypes"in globalThis?trustedTypes.createPolicy(e,{createHTML:t,createScript:r,createScriptURL:n}):Object.freeze({[Symbol.for("policy-name")]:e.toString(),createHTML(r,...n){if(t instanceof Function){const e=t(r.toString(),...n).toString();return Object.freeze({toString:()=>e})}throw new TypeError(`Policy "${e}" does not provide a createHTML method.`)},createScript(t,...n){if(r instanceof Function){const e=r(t.toString(),...n).toString();return Object.freeze({toString:()=>e})}throw new TypeError(`Policy "${e}" does not provide a createScript method.`)},createScriptURL(t,...r){if(n instanceof Function){const e=n(t.toString(),...r).toString();return Object.freeze({toString:()=>e})}throw new TypeError(`Policy "${e}" does not provide a createScriptURL method.`)}})}("aegis-sanitizer#html",{createHTML:e=>e});function Ce(e,t,{elements:r=Me.elements,attributes:n=Me.attributes,comments:o=Me.comments,dataAttributes:i=Me.dataAttributes,sanitizer:a,...s}=Me,{allowInsecure:l=!1}={}){const c=document.createElement("template");c.setHTMLUnsafe(Fe.createHTML(t)),Ie(c.content,{elements:r,attributes:n,comments:o,dataAttributes:i,sanitizer:a,...s},l),e.replaceChildren(c.content)}function je(e,{elements:t=Me.elements,attributes:r=Me.attributes,comments:n=Me.comments,dataAttributes:o=Me.dataAttributes,sanitizer:i,...a}=Me,{allowInsecure:s=!1}={}){const l=(new DOMParser).parseFromString(Fe.createHTML(e),"text/html");return Ie(l,{elements:t,attributes:r,comments:n,dataAttributes:o,sanitizer:i,...a},s),l}function Ie(e,t=Me,r=!1){if(e instanceof Node){return Ue(e,ve(t),r)}throw new TypeError("Not a node.")}const Ne="trustedTypes"in globalThis?e=>null!==trustedTypes.getAttributeType(e.ownerElement.tagName,e.localName,e.ownerElement.namespaceURI,e.namespaceURI):e=>he.has(e.localName);function He(e,t,r=!1){const n=e.namespaceURI||"";return(!("dataAttributes"in t)||t.dataAttributes)&&e.name.startsWith("data-")||n in t.attributes&&t.attributes[n].some(t=>t.name===e.localName)&&!(r||Ne(e))&&!(r||function(e){if(Pe.has(e.name)){if(URL.canParse(e.value)){const{protocol:t}=new URL(e.value);return Re.has(t)}return!1}return!1}(e))}function Ue(e,t,r=!1){switch(e.nodeType){case Node.ELEMENT_NODE:!function(e,t,r){if(function(e,t){return e.namespaceURI in t.elements&&t.elements[e.namespaceURI].some(t=>t.name===e.localName)}(e,t)){if(e.hasAttributes()){const n=e.attributes;for(let e=n.length-1;-1!==e;e--)De(n[e],t,r)}if("TEMPLATE"===e.tagName)ze(e.content,t,r);else if(e.hasChildNodes()){const n=e.childNodes;for(let e=n.length-1;-1!==e;e--)Ue(n[e],t,r)}}else e.remove()}(e,t,r);break;case Node.DOCUMENT_NODE:case Node.DOCUMENT_FRAGMENT_NODE:ze(e,t,r);break;case Node.COMMENT_NODE:!function(e,t){t.comments||e.remove()}(e,t);break;case Node.ATTRIBUTE_NODE:De(e,t,r);break;case Node.TEXT_NODE:case Node.DOCUMENT_TYPE_NODE:break;default:e.ownerElement instanceof Element&&e.ownerElement.removeChild(e)}}function De(e,t,r=!1){!He(e,t,r)&&e.ownerElement instanceof Element&&e.ownerElement.removeAttributeNode(e)}function ze(e,t,r=!1){if(e.hasChildNodes()){const n=e.childNodes;for(let e=n.length-1;-1!==e;e--)Ue(n[e],t,r)}}if(Promise.withResolvers instanceof Function||(Promise.withResolvers=function(){const e={};return e.promise=new Promise((t,r)=>{e.resolve=t,e.reject=r}),e}),URL.canParse instanceof Function||(URL.canParse=function(e,t){try{return new URL(e,t),!0}catch{return!1}}),URL.parse instanceof Function||(URL.parse=function(e,t){try{return new URL(e,t)}catch{return null}}),Object.groupBy instanceof Function||(Object.groupBy=function(e,t){const r={};for(const n of e){const e=t(n);e in r?r[e].push(n):r[e]=[n]}return r}),Element.prototype.setHTML instanceof Function||(Element.prototype.setHTML=function(e,{elements:t,attributes:r,comments:n,dataAttributes:o,sanitizer:i,...a}={}){Ce(this,e,"object"==typeof i&&null!==i?i.getConfiguration instanceof Function?i.getConfiguration():i:{elements:t,attributes:r,comments:n,dataAttributes:o,...a})},DocumentFragment.prototype.setHTML=function(...e){Element.prototype.setHTML.apply(this,e)},HTMLTemplateElement.prototype.setHTML=function(e,t){this.content.setHTML(e,t)}),Document.parseHTML instanceof Function||(Document.parseHTML=function(e,{elements:t,attributes:r,comments:n,dataAttributes:o,sanitizer:i,...a}={}){return"object"==typeof i&&null!==i?Document.parseHTML(e,i.getConfiguration instanceof Function?i.getConfiguration():i):je(e,{elements:t,attributes:r,comments:n,dataAttributes:o,...a})}),!("command"in HTMLButtonElement.prototype)){const bt=Symbol("command:for"),yt={passive:!0};Object.defineProperty(HTMLButtonElement.prototype,"command",{get(){return this.getAttribute("command")},set(e){"string"==typeof e?this.setAttribute("command",e):this.removeAttribute("command")}}),Object.defineProperty(HTMLButtonElement.prototype,"commandForElement",{get(){return this[bt]instanceof Element?this[bt]:this.hasAttribute("commandfor")?document.getElementById(this.getAttribute("commandfor")):null},set(e){e instanceof Element?0===e.id.length?(this.setAttribute("commandfor",""),this[bt]=e):(this.setAttribute("commandfor",e.id),this[bt]=null):(this.removeAttribute("commandfor"),this[bt]=null)}});class wt extends Event{#D=null;#z="";constructor(e,{source:t,command:r,bubbles:n,cancelable:o,composed:i}={}){super(e,{bubbles:n,cancelable:o,composed:i}),"string"==typeof r&&(this.#z=r),t instanceof HTMLButtonElement&&(this.#D=t)}get command(){return this.#z}get source(){return this.#D}}function vt({currentTarget:e}){if(e instanceof HTMLButtonElement&&e.hasAttribute("command")&&e.hasAttribute("commandfor")){const t=e.commandForElement,r=e.command;if(t instanceof Element&&"string"==typeof r){const n=new wt("command",{command:r,source:e,cancelable:!0});if(t.dispatchEvent(n),!n.defaultPrevented)switch(r){case"show-modal":t instanceof HTMLDialogElement&&t.showModal();break;case"close":t instanceof HTMLDialogElement&&t.close();break;case"request-close":t instanceof HTMLDialogElement&&t.requestClose();break;case"show-popover":t.showPopover();break;case"hide-popover":t.hidePopover();break;case"toggle-popover":t.togglePopover()}}}}const Tt=new MutationObserver(e=>{for(const t of e)if("childList"===t.type){for(const e of t.addedNodes)if(e instanceof HTMLButtonElement&&e.hasAttribute("command")&&e.hasAttribute("commandfor"))e.addEventListener("click",vt,yt);else if(e instanceof Element)for(const t of e.querySelectorAll("button[command][commandfor]"))t.addEventListener("click",vt,yt)}else"attributes"===t.type&&t.target instanceof HTMLButtonElement&&typeof t.oldValue!=typeof t.target.getAttribute(t.attributeName)&&(t.target.hasAttribute("command")&&t.target.hasAttribute("commandfor")?t.target.addEventListener("click",vt,yt):t.target.removeEventListener("click",vt,yt))}),Et={childList:!0,subtree:!0,attributes:!0,attributeFilter:["command","commandfor"],attributeOldValue:!0};Tt.observe(document,Et),document.querySelectorAll("button").forEach(e=>e.addEventListener("click",vt,yt)),globalThis.CommandEvent=wt,globalThis[Symbol.for("polyfill-command")]=e=>Tt.observe(e,Et)}if(l(Element.prototype,"setHTMLUnsafe",ie),l(Element.prototype,"getHTML",ae),"CustomElementRegistry"in globalThis&&!(CustomElementRegistry.prototype.getName instanceof Function)){const St=new Map;u(CustomElementRegistry.prototype,"define",e=>(t,r,n)=>{e.call(customElements,t,r,n),St.set(r,"string"==typeof n.extends?n.extends:t)}),l(CustomElementRegistry.prototype,"getName",e=>{if("function"==typeof e)return St.get(e)??null;throw"object"==typeof e&&null!==e?new TypeError("CustomElementRegistry.getName: Argument 1 is not callable."):new TypeError("CustomElementRegistry.getName: Argument 1 is not an object.")})}function $e({currentTarget:e}){switch(e.popoverTargetAction){case"show":e.popoverTargetElement.showPopover();break;case"hide":e.popoverTargetElement.hidePopover();break;default:e.popoverTargetElement.togglePopover()}}if(!(globalThis.ToggleEvent instanceof Function)){class At extends Event{#$;#q;constructor(e,{newState:t,oldState:r}){super(e,{bubbles:!0}),this.#$=t,this.#q=r}get newState(){return this.#$}get oldState(){return this.#q}}globalThis.ToggleEvent=At}if(!(HTMLElement.prototype.showPopover instanceof Function)){const Mt=e=>e.classList.contains("_popover-open");Object.defineProperties(HTMLElement.prototype,{showPopover:{value:function(){if(!Mt(this)){if(this.dispatchEvent(new ToggleEvent("beforetoggle",{oldState:"closed",newState:"open"})),"auto"===this.getAttribute("popover")){const e=new AbortController;document.body.addEventListener("click",({target:t})=>{this.contains(t)||this.isSameNode(t.popoverTargetElement)||(e.abort(),this.hidePopover())},{signal:e.signal,capture:!0}),document.body.addEventListener("keydown",({key:t})=>{"Escape"===t&&(e.abort(),this.hidePopover())},{signal:e.signal,capture:!0}),document.addEventListener("beforetoggle",({target:t})=>{t.isSameNode(this)||"auto"!==t.getAttribute("popover")||(e.abort(),this.hidePopover())},{signal:e.signal})}this.classList.add("_popover-open"),this.dispatchEvent(new ToggleEvent("toggle",{oldState:"closed",newState:"open"}))}}},hidePopover:{value:function(){Mt(this)&&(this.dispatchEvent(new ToggleEvent("beforetoggle",{oldState:"open",newState:"closed"})),queueMicrotask(()=>this.classList.remove("_popover-open")),this.dispatchEvent(new ToggleEvent("toggle",{oldState:"open",newState:"closed"})))}},togglePopover:{value:function(){Mt(this)?this.hidePopover():this.showPopover()}}}),Object.defineProperties(HTMLButtonElement.prototype,{popoverTargetElement:{get(){return document.getElementById(this.getAttribute("popovertarget"))}},popoverTargetAction:{get(){return this.getAttribute("popovertargetaction")||"toggle"},set(e){this.setAttribute("popovertargetaction",e)}}}),function(e=document.body){e.querySelectorAll('button[popovertarget], input[type="button"][popovertarget]').forEach(e=>e.addEventListener("click",$e))}()}if(HTMLScriptElement.supports instanceof Function||(HTMLScriptElement.supports=function(e){switch(e.toLowerCase()){case"classic":return!0;case"module":return"noModule"in HTMLScriptElement.prototype;default:return!1}}),!Element.prototype.hasOwnProperty(le.role)){const xt=!0,Lt=!0,Ot=Object.fromEntries(Object.entries(le).map(([e,t])=>[e,{get:function(){return this.getAttribute(t)},set:function(e){"string"==typeof e?this.setAttribute(t,e):this.removeAttribute(t)},enumerable:xt,configurable:Lt}]));Object.defineProperties(Element.prototype,Ot)}if(!HTMLElement.prototype.hasOwnProperty("inert")){const kt=new WeakMap,Pt=e=>{kt.has(e)&&(e.tabIndex=kt.get(e)),e.hasChildNodes()&&[...e.children].forEach(Pt)},Rt=e=>{-1!==e.tabIndex&&(kt.set(e,e.tabIndex),e.tabIndex=-1),e.hasChildNodes()&&[...e.children].forEach(Rt)};Object.defineProperty(HTMLElement.prototype,"inert",{get:function(){return this.hasAttribute("inert")},set:function(e){e?(this.setAttribute("aria-hidden","true"),this.setAttribute("inert",""),Rt(this)):(this.removeAttribute("aria-hidden"),this.removeAttribute("inert"),Pt(this))},enumerable:!0,configurable:!0})}if(HTMLImageElement.prototype.hasOwnProperty("complete")||Object.defineProperty(HTMLImageElement.prototype,"complete",{get:function(){return""===this.src||this.naturalHeight>0}}),HTMLImageElement.prototype.decode instanceof Function||(HTMLImageElement.prototype.decode=function(){return this.complete?Promise.resolve():new Promise((e,t)=>{const r=()=>{this.removeEventListener("error",n),this.removeEventListener("load",r),e()},n=e=>{this.removeEventListener("error",n),this.removeEventListener("load",r),t(e)};this.addEventListener("load",r),this.addEventListener("error",n)})}),!HTMLTemplateElement.prototype.hasOwnProperty("shadowRootMode")){const Ft=new WeakMap;c(HTMLTemplateElement.prototype,"shadowRootMode",{get(){return this.getAttribute("shadowrootmode")},set(e){this.setAttribute("shadowrootmode",e)}}),c(HTMLTemplateElement.prototype,"shadowRootDelegatesFocus",{get(){return this.hasAttribute("shadowrootdelegatesfocus")},set(e){this.toggleAttribute("shadowrootdelegatesfocus",e)}}),c(HTMLTemplateElement.prototype,"shadowRootClonable",{get(){return this.hasAttribute("shadowrootclonable")},set(e){this.toggleAttribute("shadowrootclonable",e)}}),c(HTMLTemplateElement.prototype,"shadowRootSerializable",{get(){return this.hasAttribute("shadowrootserializable")},set(e){this.toggleAttribute("shadowrootserializable",e)}});const Ct=(e=document)=>{e.querySelectorAll("template[shadowrootmode]").forEach(e=>{const t=e.parentElement.attachShadow({mode:e.shadowRootMode,clonable:e.shadowRootClonable,delegatesFocus:e.shadowRootDelegatesFocus,serializable:e.shadowRootSerializable});t.append(e.content),e.remove(),Ct(t),Ft.set(t.host,t)})};u(HTMLElement.prototype,"attachShadow",function(e){return({mode:t,clonable:r=!1,delegatesFocus:n=!1,serializable:o=!1,slotAssignment:i="auto"})=>{if(Ft.has(this)){const e=Ft.get(this);if(t===e.shadowRootMode)return Ct.remove(this),e;throw new DOMException("Element.attachShadow: Unable to re-attach to existing ShadowDOM")}return e.call(this,{mode:t,clonable:r,delegatesFocus:n,serializable:o,slotAssignment:i})}}),"loading"===document.readyState?document.addEventListener("readystatechange",()=>Ct(document),{once:!0}):Ct(document)}HTMLFormElement.prototype.requestSubmit instanceof Function||(HTMLFormElement.prototype.requestSubmit=function(e){if(void 0===e){const e=document.createElement("button");e.type="submit",e.hidden=!0,this.append(e),this.requestSubmit(e),setTimeout(()=>e.remove(),100)}else{if(!(e instanceof HTMLButtonElement||e instanceof HTMLInputElement))throw new TypeError("HTMLFormElement.requestSubmit: The submitter is not a submit button.");if(!("submit"===e.type||e instanceof HTMLInputElement&&"image"===e.type))throw new TypeError("HTMLFormElement.requestSubmit: The submitter is not a submit button.");if(!this.isSameNode(e.form))throw new DOMException("HTMLFormElement.requestSubmit: The submitter is not owned by this form.","NotFoundError");e.click()}}),"loading"in HTMLIFrameElement.prototype||c(HTMLIFrameElement.prototype,"loading",{get:function(){return this.getAttribute("loading")||"auto"},set:function(e){this.setAttribute("loading",e)}}),"credentialless"in HTMLIFrameElement.prototype||c(HTMLIFrameElement.prototype,"credentialless",{get:function(){return this.hasAttribute("credentialless")},set:function(e){this.toggleAttribute("credentialless",e)}}),!("HTMLDialogElement"in globalThis)||HTMLDialogElement.prototype.requestClose instanceof Function||(HTMLDialogElement.prototype.requestClose=function(e){const t=new Event("cancel",{cancelable:!0,bubbles:!1});this.dispatchEvent(t),t.defaultPrevented||this.close(e)});const qe="Expected a set-like object.",Be=["has","keys"],_e=["size"],Ve=e=>e instanceof Set,We=e=>Ve(e)||"object"==typeof e&&null!==e&&Be.every(t=>e[t]instanceof Function)&&_e.every(t=>t in e);Set.prototype.intersection instanceof Function||(Set.prototype.intersection=function(e){if(!We(e))throw new TypeError(qe);return new Set([...this].filter(t=>e.has(t)))}),Set.prototype.difference instanceof Function||(Set.prototype.difference=function(e){if(!We(e))throw new TypeError(qe);return new Set([...this].filter(t=>!e.has(t)))}),Set.prototype.union instanceof Function||(Set.prototype.union=function(e){return new Set([...this,...e])}),Set.prototype.isSubsetOf instanceof Function||(Set.prototype.isSubsetOf=function(e){if(!We(e))throw new TypeError(qe);return[...this].every(t=>e.has(t))}),Set.prototype.isSupersetOf instanceof Function||(Set.prototype.isSupersetOf=function(e){if(!We(e))throw new TypeError(qe);return Ve(e)?e.isSubsetOf(this):new Set(e.keys()).isSubsetOf(this)}),Set.prototype.symmetricDifference instanceof Function||(Set.prototype.symmetricDifference=function(e){if(!We(e))throw new TypeError(qe);return Ve(e)?new Set([...this.difference(e),...e.difference(this)]):new Set([...this.difference(e),...new Set(e.keys()).difference(this)])}),Set.prototype.isDisjointFrom instanceof Function||(Set.prototype.isDisjointFrom=function(e){if(!We(e))throw new TypeError(qe);return new Set([...this,...e]).size===this.size+e.size}),WeakMap.prototype.emplace instanceof Function||(WeakMap.prototype.emplace=function(e,{insert:t,update:r}={}){const n=this.has(e);if(n&&r instanceof Function){const t=this.get(e),n=r.call(this,t,e,this);return n!==t&&this.set(e,t),n}if(n)return this.get(e);if(t instanceof Function){const r=t.call(this,e,this);return this.set(e,r),r}throw new Error("Key is not found and no `insert()` given")}),function(){if("screen"in globalThis&&!(globalThis.getScreenDetails instanceof Function)){class e extends EventTarget{get availHeight(){return screen.availHeight}get availLeft(){return screen.availLeft}get availTop(){return screen.availTop}get availWidth(){return screen.availWidth}get colorDepth(){return screen.colorDepth}get devicePixelRatio(){return globalThis.devicePixelRatio||1}get height(){return screen.height}get isExtended(){return screen.isExtended}get isInternal(){return!0}get isPrimary(){return!0}get label(){return"Unknown"}get orientation(){return screen.orientation}get pixelDepth(){return screen.pixelDepth}get top(){return screen.top}get width(){return screen.width}}class t extends EventTarget{get currentScreen(){return new e}get screens(){return[this.currentScreen]}}Object.defineProperty(Screen.prototype,"isExtended",{enumerable:!0,configurable:!0,get:()=>!1}),globalThis.getScreenDetails=async()=>new t}}();
|
|
34
34
|
/**
|
|
35
35
|
* @copyright 2024 Chris Zuber <admin@kernvalley.us>
|