UNPKG

web-component-stencil-test

Version:
1 lines 10.8 kB
let t,e,n,s=0,o=!1,l=!1,r=!1,c=!1;const i=window,a=document,f={t:0,s:"",jmp:t=>t(),raf:t=>requestAnimationFrame(t),ael:(t,e,n,s)=>t.addEventListener(e,n,s),rel:(t,e,n,s)=>t.removeEventListener(e,n,s)},u=(()=>!!a.documentElement.attachShadow)(),$=(()=>{try{return new CSSStyleSheet,!0}catch(t){}return!1})(),p=new WeakMap,m=t=>p.get(t),d=(t,e)=>p.set(e.o=t,e),h=(t,e)=>e in t,w=t=>console.error(t),y=new Map,b=new Map,_=[],g=[],j=[],S=(t,e)=>n=>{t.push(n),o||(o=!0,e&&4&f.t?R(M):f.raf(M))},v=(t,e)=>{let n=0,s=0;for(;n<t.length&&(s=performance.now())<e;)try{t[n++](s)}catch(o){w(o)}n===t.length?t.length=0:0!==n&&t.splice(0,n)},M=()=>{s++,(t=>{for(let n=0;n<t.length;n++)try{t[n](performance.now())}catch(e){w(e)}t.length=0})(_);const t=2==(6&f.t)?performance.now()+10*Math.ceil(s*(1/22)):1/0;v(g,t),v(j,t),g.length>0&&(j.push(...g),g.length=0),(o=_.length+g.length+j.length>0)?f.raf(M):s=0},R=t=>Promise.resolve().then(t),k=S(g,!0),O={},U=t=>null!=t,L=t=>"object"==(t=typeof t)||"function"===t,x=()=>i.CSS&&i.CSS.supports&&i.CSS.supports("color","var(--c)")?Promise.resolve():__sc_import_test("./p-1635c1a0.js").then(()=>{f.l=i.__stencil_cssshim}),C=async()=>{f.l=i.__stencil_cssshim;const t=new RegExp("/test(\\.esm)?\\.js($|\\?|#)"),e=Array.from(a.querySelectorAll("script")).find(e=>t.test(e.src)||"test"===e.getAttribute("data-stencil-namespace")),n=e["data-opts"];{const t=new URL(".",new URL(e.getAttribute("data-resources-url")||e.src,i.location.href));return P(t.href),window.customElements||await __sc_import_test("./p-d0882b30.js"),Object.assign(Object.assign({},n),{resourcesUrl:t.href})}},P=t=>{const e=(()=>`__sc_import_${"test".replace(/\s|-/g,"_")}`)();try{i[e]=new Function("w",`return import(w);//${Math.random()}`)}catch(n){const s=new Map;i[e]=n=>{const o=new URL(n,t).href;let l=s.get(o);if(!l){const t=a.createElement("script");t.type="module",t.src=URL.createObjectURL(new Blob([`import * as m from '${o}'; window.${e}.m = m;`],{type:"application/javascript"})),l=new Promise(n=>{t.onload=()=>{n(i[e].m),t.remove()}}),s.set(o,l),a.head.appendChild(t)}return l}}},T=new WeakMap,A=t=>"sc-"+t,E=(t,e,...n)=>{let s,o=null,l=!1,r=!1,c=[];const i=e=>{for(let n=0;n<e.length;n++)o=e[n],Array.isArray(o)?i(o):null!=o&&"boolean"!=typeof o&&((l="function"!=typeof t&&!L(o))&&(o=String(o)),l&&r?c[c.length-1].i+=o:c.push(l?{t:0,i:o}:o),r=l)};if(i(n),e){s=e.name;{const t=e.className||e.class;t&&(e.class="object"!=typeof t?t:Object.keys(t).filter(e=>t[e]).join(" "))}}const a={t:0,u:t,$:c.length>0?c:null,p:void 0,h:e};return a._=s,a},W={},F=(t,e,n,s,o,l)=>{if(n===s)return;let r=h(t,e),c=e.toLowerCase();if("class"===e){const e=t.classList;N(n).forEach(t=>e.remove(t)),N(s).forEach(t=>e.add(t))}else if(r||"o"!==e[0]||"n"!==e[1]){const c=L(s);if((r||c&&null!==s)&&!o)try{if(t.tagName.includes("-"))t[e]=s;else{let o=null==s?"":s;null!=n&&t[e]==o||(t[e]=o)}}catch(i){}null==s||!1===s?t.removeAttribute(e):(!r||4&l||o)&&!c&&t.setAttribute(e,s=!0===s?"":s)}else e="-"===e[2]?e.substr(3):h(t,c)?c.substr(2):c[2]+e.substr(3),n&&f.rel(t,e,n,!1),s&&f.ael(t,e,s,!1)},N=t=>t?t.split(/\s+/).filter(t=>t):[],q=(t,e,n,s)=>{const o=11===e.p.nodeType&&e.p.host?e.p.host:e.p,l=t&&t.h||O,r=e.h||O;for(s in l)s in r||F(o,s,l[s],void 0,n,e.t);for(s in r)F(o,s,l[s],r[s],n,e.t)},B=(s,o,r,i)=>{let f,u,$,p=o.$[r],m=0;if(l||(c=!0,"slot"===p.u&&(t&&i.classList.add(t+"-s"),p.t|=p.$?2:1)),U(p.i))p.p=a.createTextNode(p.i);else if(1&p.t)p.p=a.createTextNode("");else if(f=p.p=a.createElement(2&p.t?"slot-fb":p.u),q(null,p,!1),U(t)&&f["s-si"]!==t&&f.classList.add(f["s-si"]=t),p.$)for(m=0;m<p.$.length;++m)(u=B(s,p,m,f))&&f.appendChild(u);return p.p["s-hn"]=n,3&p.t&&(p.p["s-sr"]=!0,p.p["s-cr"]=e,p.p["s-sn"]=p._||"",($=s&&s.$&&s.$[r])&&$.u===p.u&&s.p&&H(s.p,!1)),p.p},H=(t,e)=>{f.t|=1;const s=t.childNodes;for(let o=s.length-1;o>=0;o--){const t=s[o];t["s-hn"]!==n&&t["s-ol"]&&(I(t).insertBefore(t,G(t)),t["s-ol"].remove(),t["s-ol"]=void 0,c=!0),e&&H(t,e)}f.t&=-2},V=(t,e,s,o,l,r)=>{let c,i=t["s-cr"]&&t["s-cr"].parentNode||t;for(i.shadowRoot&&i.tagName===n&&(i=i.shadowRoot);l<=r;++l)o[l]&&(c=B(null,s,l,t))&&(o[l].p=c,i.insertBefore(c,G(e)))},z=(t,e,n,s)=>{for(;e<=n;++e)U(t[e])&&(r=!0,(s=t[e].p)["s-ol"]?s["s-ol"].remove():H(s,!0),s.remove())},D=(t,e)=>t.u===e.u&&("slot"!==t.u||t._===e._),G=t=>t&&t["s-ol"]||t,I=t=>(t["s-ol"]?t["s-ol"]:t).parentNode,J=(t,e)=>{const n=e.p=t.p,s=t.$,o=e.$;let l;U(e.i)?(l=n["s-cr"])?l.parentNode.textContent=e.i:t.i!==e.i&&(n.textContent=e.i):("slot"===e.u||q(t,e,!1),U(s)&&U(o)?((t,e,n,s)=>{let o,l=0,r=0,c=e.length-1,i=e[0],a=e[c],f=s.length-1,u=s[0],$=s[f];for(;l<=c&&r<=f;)null==i?i=e[++l]:null==a?a=e[--c]:null==u?u=s[++r]:null==$?$=s[--f]:D(i,u)?(J(i,u),i=e[++l],u=s[++r]):D(a,$)?(J(a,$),a=e[--c],$=s[--f]):D(i,$)?("slot"!==i.u&&"slot"!==$.u||H(i.p.parentNode,!1),J(i,$),t.insertBefore(i.p,a.p.nextSibling),i=e[++l],$=s[--f]):D(a,u)?("slot"!==i.u&&"slot"!==$.u||H(a.p.parentNode,!1),J(a,u),t.insertBefore(a.p,i.p),a=e[--c],u=s[++r]):(o=B(e&&e[r],n,r,t),u=s[++r],o&&I(i.p).insertBefore(o,G(i.p)));l>c?V(t,null==s[f+1]?null:s[f+1].p,n,s,r,f):r>f&&z(e,l,c)})(n,s,e,o):U(o)?(U(t.i)&&(n.textContent=""),V(n,null,e,o,0,o.length-1)):U(s)&&z(s,0,s.length-1))},K=(t,e,n,s,o,l,r,c)=>{for(s=0,o=(n=t.childNodes).length;s<o;s++)if(1===(e=n[s]).nodeType){if(e["s-sr"])for(r=e["s-sn"],e.hidden=!1,l=0;l<o;l++)if(n[l]["s-hn"]!==e["s-hn"])if(c=n[l].nodeType,""!==r){if(1===c&&r===n[l].getAttribute("slot")){e.hidden=!0;break}}else if(1===c||3===c&&""!==n[l].textContent.trim()){e.hidden=!0;break}K(e)}},Q=[],X=t=>{let e,n,s,o,l=t.childNodes,c=l.length,i=0,a=0,f=0;for(c=l.length;i<c;i++){if((e=l[i])["s-sr"]&&(n=e["s-cr"]))for(o=e["s-sn"],a=(s=n.parentNode.childNodes).length-1;a>=0;a--)(n=s[a])["s-cn"]||n["s-nr"]||n["s-hn"]===e["s-hn"]||((3===(f=n.nodeType)||8===f)&&""===o||1===f&&null===n.getAttribute("slot")&&""===o||1===f&&n.getAttribute("slot")===o)&&(Q.some(t=>t.g===n)||(r=!0,n["s-sn"]=o,Q.push({j:e,g:n})));1===e.nodeType&&X(e)}},Y=(t,e,n,s)=>{e.t|=16;const o=e.o,l=()=>Z(t,e,n,o,s);let r;return s&&(r=nt(o,"componentWillLoad")),st(r,()=>k(l))},Z=(s,o,i,$,p)=>{o.t&=-17,s["s-lr"]=!1,p&&((t,e)=>{const n=((t,e)=>{let n=A(e.S),s=b.get(n);if(t=11===t.nodeType?t:a,s)if("string"==typeof s){let e,o=T.get(t=t.head||t);o||T.set(t,o=new Set),o.has(n)||((e=a.createElement("style")).setAttribute("data-styles",""),e.innerHTML=s,t.insertBefore(e,t.querySelector("link")),o&&o.add(n))}else t.adoptedStyleSheets.includes(s)||(t.adoptedStyleSheets=[...t.adoptedStyleSheets,s]);return n})(u&&t.shadowRoot?t.shadowRoot:t.getRootNode(),e);10&e.t&&(t["s-sc"]=n,t.classList.add(n+"-h"))})(s,i),o.t|=4;try{((s,o,i,$)=>{n=s.tagName;const p=o.v||{t:0},m=(t=>t&&t.u===W)($)?$:E(null,null,$);if(m.u=null,m.t|=4,o.v=m,m.p=p.p=s.shadowRoot||s,t=s["s-sc"],e=s["s-cr"],l=u&&0!=(1&i.t),c=r=!1,J(p,m),c){X(m.p);for(let t=0;t<Q.length;t++){const e=Q[t];if(!e.g["s-ol"]){const t=a.createTextNode("");t["s-nr"]=e.g,e.g.parentNode.insertBefore(e.g["s-ol"]=t,e.g)}}f.t|=1;for(let t=0;t<Q.length;t++){const e=Q[t],n=e.j.parentNode;let s=e.j.nextSibling,o=e.g["s-ol"];for(;o=o.previousSibling;){let t=o["s-nr"];if(t&&t["s-sn"]===e.g["s-sn"]&&n===t.parentNode&&(!(t=t.nextSibling)||!t["s-nr"])){s=t;break}}(!s&&n!==e.g.parentNode||e.g.nextSibling!==s)&&e.g!==s&&n.insertBefore(e.g,s)}f.t&=-2}r&&K(m.p),Q.length=0})(s,o,i,$.render())}catch(m){w(m)}o.t&=-5,s["s-lr"]=!0,o.t|=2,s["s-rc"].length>0&&(s["s-rc"].forEach(t=>t()),s["s-rc"].length=0),tt(s,o)},tt=(t,e,n)=>{if(!t["s-al"]){const s=e.M;64&e.t||(e.t|=64,t.classList.add("hydrated"),e.R(t),s||et()),s&&((n=s["s-al"])&&(n.delete(t),0===n.size&&(s["s-al"]=void 0,s["s-init"]())),e.M=void 0)}},et=()=>{a.documentElement.classList.add("hydrated"),f.t|=2},nt=(t,e,n)=>{if(t&&t[e])try{return t[e](n)}catch(s){w(s)}},st=(t,e)=>t&&t.then?t.then(e):e(),ot=(t,e,n)=>{if(e.k){t.watchers&&(e.O=t.watchers);const s=Object.entries(e.k),o=t.prototype;if(s.forEach(([t,[s]])=>{(31&s||2&n&&32&s)&&Object.defineProperty(o,t,{get(){return((t,e)=>m(t).U.get(e))(this,t)},set(n){((t,e,n,s)=>{const o=m(this),l=o.L,r=o.U.get(e),c=o.t,i=o.o;if(!((n=((t,e)=>null==t||L(t)?t:4&e?"false"!==t&&(""===t||!!t):1&e?String(t):t)(n,s.k[e][0]))===r||8&c&&void 0!==r)&&(o.U.set(e,n),i)){if(s.O&&128&c){const t=s.O[e];t&&t.forEach(t=>{try{i[t](n,r,e)}catch(s){w(s)}})}2==(22&c)&&Y(l,o,s,!1)}})(0,t,n,e)},configurable:!0,enumerable:!0})}),1&n){const e=new Map;o.attributeChangedCallback=function(t,n,s){f.jmp(()=>{const n=e.get(t);this[n]=(null!==s||"boolean"!=typeof this[n])&&s})},t.observedAttributes=s.filter(([t,e])=>15&e[0]).map(([t,n])=>{const s=n[1]||t;return e.set(s,t),s})}}return t},lt=(t,e={})=>{const n=[],s=e.exclude||[],o=a.head,l=i.customElements,r=o.querySelector("meta[charset]"),c=a.createElement("style");let d;Object.assign(f,e),f.s=new URL(e.resourcesUrl||"./",a.baseURI).href,e.syncQueue&&(f.t|=4),t.forEach(t=>t[1].forEach(e=>{const o={t:e[0],S:e[1],k:e[2],C:e[3],O:{}};!u&&1&o.t&&(o.t|=8);const r=o.S,c=class extends HTMLElement{constructor(t){super(t),t=this,this["s-lr"]=!1,this["s-rc"]=[],(t=>{{const e={t:0,L:t,U:new Map};e.P=new Promise(t=>e.R=t),p.set(t,e)}})(t),1&o.t&&(u?t.attachShadow({mode:"open"}):"shadowRoot"in t||(t.shadowRoot=t))}connectedCallback(){d&&(clearTimeout(d),d=null),f.jmp(()=>((t,e)=>{if(0==(1&f.t)){const n=m(t);if(!(1&n.t)){let s;n.t|=1,s||(4&e.t||8&e.t)&&((t,e)=>{(e=t["s-cr"]=a.createComment(""))["s-cn"]=!0,t.insertBefore(e,t.firstChild)})(t);{let e=t;for(;e=e.parentNode||e.host;)if(e["s-init"]&&!1===e["s-lr"]){n.M=e,(e["s-al"]=e["s-al"]||new Set).add(t);break}}e.k&&Object.entries(e.k).forEach(([e,[n]])=>{if(31&n&&t.hasOwnProperty(e)){const n=t[e];delete t[e],t[e]=n}}),R(()=>(async(t,e,n,s,o)=>{if(0==(32&e.t)){e.t|=32,(o=(t=>{const e=t.S.replace(/-/g,"_"),n=t.T,s=y.get(n);return s?s[e]:__sc_import_test(`./${n}.entry.js`).then(t=>(y.set(n,t),t[e]),w)})(n)).then&&(o=await o),o.isProxied||(n.O=o.watchers,ot(o,n,2),o.isProxied=!0),e.t|=8;try{new o(e)}catch(c){w(c)}e.t&=-9,e.t|=128;const t=A(n.S);if(!b.has(t)&&o.style){let e=o.style;8&n.t&&(e=await __sc_import_test("./p-affe7c09.js").then(n=>n.scopeCss(e,t,!1))),((t,e,n)=>{let s=b.get(t);$&&n?(s=s||new CSSStyleSheet).replace(e):s=e,b.set(t,s)})(t,e,!!(1&n.t))}}const l=e.M,r=()=>Y(t,e,n,!0);l&&!1===l["s-lr"]&&l["s-rc"]?l["s-rc"].push(r):r()})(t,n,e))}}})(this,o))}disconnectedCallback(){f.jmp(()=>void 0)}"s-init"(){const t=m(this);t.o&&tt(this,t)}"s-hmr"(t){}forceUpdate(){((t,e)=>{{const n=m(t);2&n.t&&Y(t,n,e,!1)}})(this,o)}componentOnReady(){return m(this).P}};o.T=t[0],s.includes(r)||l.get(r)||(n.push(r),l.define(r,ot(c,o,1)))})),c.innerHTML=n+"{visibility:hidden}.hydrated{visibility:inherit}",c.setAttribute("data-styles",""),o.insertBefore(c,r?r.nextSibling:o.firstChild),f.jmp(()=>d=setTimeout(et,30))};export{x as a,lt as b,E as h,C as p,d as r};