-
Notifications
You must be signed in to change notification settings - Fork 1
/
celo.min.js
1 lines (1 loc) · 1.66 KB
/
celo.min.js
1
"use strict";function _instanceof(n,e){return null!=e&&"undefined"!=typeof Symbol&&e[Symbol.hasInstance]?!!e[Symbol.hasInstance](n):n instanceof e}!function(){var n=window.celoConfig?window.celoConfig:{},e=n.componentsPath?n.componentsPath:"/components",t=n.containerId?n.containerId:"_celo",o=[];function c(n){n.forEach(function(n){if(n.addedNodes&&(n=n.addedNodes[0]),!_instanceof(n,HTMLElement))return!1;if(c(n.childNodes),!n.tagName.includes("-"))return!1;var i=n.tagName.toLowerCase();o.includes(i)||(r(),function(n){o.push(n)}(i),function(n){return fetch("".concat(e,"/").concat(n,".html")).then(function(e){if(e.ok)return e.text();console.warn("Component <".concat(n,"> not found. Is it a subcomponent?"))})}(i).then(function(n){return function(n){if(!n)return!1;var e=document.createDocumentFragment(),t=document.createElement("div");t.innerHTML=n;for(;t.firstChild;)e.appendChild(t.firstChild);return e}(n)}).then(function(n){return!!(e=n)&&(e.querySelectorAll("script").forEach(function(n){var t=document.createElement("script");t.appendChild(document.createTextNode(n.innerHTML));var o=n.parentElement||e;o.appendChild(t),o.removeChild(n)}),e);var e}).then(function(n){return function(n){if(!n)return!1;document.querySelector("#".concat(t)).append(n)}(n)}).then(function(){return n.shadowRoot&&c(n.shadowRoot.childNodes)}))})}function r(){if(!document.querySelector("#".concat(t))&&document.querySelector("body")){var n=document.createElement("div");n.id=t,document.body.appendChild(n)}}var i,u=customElements.define;customElements.define=function(){return o.push(arguments[0]),u.apply(customElements,arguments)},r(),(i=new MutationObserver(c)).observe(document,{childList:!0,subtree:!0})}();