1
0
mirror of https://codeberg.org/nobody/LocalCDN.git synced 2024-12-22 08:04:10 +01:00
LocalCDN-Firefox-Chrome-Brave/resources/webcomponentsjs/latest/webcomponents-loader.min.jsm

1 line
2.3 KiB
JavaScript
Raw Normal View History

!function(){"use strict";var n,t=!1,o=[],d=!1;function e(){window.WebComponents.ready=!0,document.dispatchEvent(new CustomEvent("WebComponentsReady",{bubbles:!0}))}function i(){window.customElements&&customElements.polyfillWrapFlushCallback&&customElements.polyfillWrapFlushCallback(function(e){n=e,d&&n()})}function c(){window.HTMLTemplateElement&&HTMLTemplateElement.bootstrap&&HTMLTemplateElement.bootstrap(window.document),t=!0,r().then(e)}function r(){d=!1;var e=o.map(function(e){return e instanceof Function?e():e});return o=[],Promise.all(e).then(function(){d=!0,n&&n()}).catch(function(e){console.error(e)})}window.WebComponents=window.WebComponents||{},window.WebComponents.ready=window.WebComponents.ready||!1,window.WebComponents.waitFor=window.WebComponents.waitFor||function(e){e&&(o.push(e),t&&r())},window.WebComponents._batchCustomElements=i;var l="webcomponents-loader.js",a=[];"attachShadow"in Element.prototype&&"getRootNode"in Element.prototype&&(!window.ShadyDOM||!window.ShadyDOM.force)||a.push("sd"),window.customElements&&!window.customElements.forcePolyfill||a.push("ce");var s,m=function(){var e=document.createElement("template");if(!("content"in e))return!0;if(!(e.content.cloneNode()instanceof DocumentFragment))return!0;var n=document.createElement("template");n.content.appendChild(document.createElement("div")),e.content.appendChild(n);e=e.cloneNode(!0);return 0===e.content.childNodes.length||0===e.content.firstChild.content.childNodes.length}();(a=!(window.Promise&&Array.from&&window.URL&&window.Symbol)||m?["sd-ce-pf"]:a).length?(a="bundles/webcomponents-"+a.join("-")+".js",s=window.WebComponents.root?window.WebComponents.root+a:document.querySelector('script[src*="'+l+'"]').src.replace(l,a),(a=document.createElement("script")).src=s,"loading"===document.readyState?(a.setAttribute("onload","window.WebComponents._batchCustomElements()"),document.write(a.outerHTML),document.addEventListener("DOMContentLoaded",c)):(a.addEventListener("load",function(){i(),c()}),a.addEventListener("error",function(){throw new Error("Could not load polyfill bundle"+s)}),document.head.appendChild(a))):"complete"===document.readyState?(t=!0,e()):(window.addEventListener("load",c),window.addEventListener("DOMContentLoaded",function(){window.removeEventListener("load",c),c()}))}();