genie-component-library
Version:
Genie Component Library
1 lines • 8.59 kB
JavaScript
let e,t,n=!1,l=!1;const s="undefined"!=typeof window?window:{},o=s.document||{head:{}},r={t:0,l:"",jmp:e=>e(),raf:e=>requestAnimationFrame(e),ael:(e,t,n,l)=>e.addEventListener(t,n,l),rel:(e,t,n,l)=>e.removeEventListener(t,n,l),ce:(e,t)=>new CustomEvent(e,t)},i=e=>Promise.resolve(e),c=(()=>{try{return new CSSStyleSheet,!0}catch(e){}return!1})(),u="http://www.w3.org/1999/xlink",f=new WeakMap,a=e=>"sc-"+e.s,$={},p=e=>"object"==(e=typeof e)||"function"===e,y=(e,t,...n)=>{let l=null,s=null,o=!1,r=!1,i=[];const c=t=>{for(let n=0;n<t.length;n++)l=t[n],Array.isArray(l)?c(l):null!=l&&"boolean"!=typeof l&&((o="function"!=typeof e&&!p(l))&&(l+=""),o&&r?i[i.length-1].o+=l:i.push(o?d(null,l):l),r=o)};if(c(n),t){t.key&&(s=t.key);{const e=t.className||t.class;e&&(t.class="object"!=typeof e?e:Object.keys(e).filter(t=>e[t]).join(" "))}}if("function"==typeof e)return e(null===t?{}:t,i,w);const u=d(e,null);return u.i=t,i.length>0&&(u.u=i),u.$=s,u},d=(e,t)=>({t:0,p:e,o:t,h:null,u:null,i:null,$:null}),h={},w={forEach:(e,t)=>e.map(m).forEach(t),map:(e,t)=>e.map(m).map(t).map(b)},m=e=>({vattrs:e.i,vchildren:e.u,vkey:e.$,vname:e.m,vtag:e.p,vtext:e.o}),b=e=>{if("function"==typeof e.vtag){const t=Object.assign({},e.vattrs);return e.vkey&&(t.key=e.vkey),e.vname&&(t.name=e.vname),y(e.vtag,t,...e.vchildren||[])}const t=d(e.vtag,e.vtext);return t.i=e.vattrs,t.u=e.vchildren,t.$=e.vkey,t.m=e.vname,t},g=(e,t,n,l,o,i)=>{if(n!==l){let c=G(e,t),f=t.toLowerCase();if("class"===t){const t=e.classList,s=j(n),o=j(l);t.remove(...s.filter(e=>e&&!o.includes(e))),t.add(...o.filter(e=>e&&!s.includes(e)))}else if("style"===t){for(const t in n)l&&null!=l[t]||(t.includes("-")?e.style.removeProperty(t):e.style[t]="");for(const t in l)n&&l[t]===n[t]||(t.includes("-")?e.style.setProperty(t,l[t]):e.style[t]=l[t])}else if("key"===t);else if("ref"===t)l&&l(e);else if(c||"o"!==t[0]||"n"!==t[1]){const s=p(l);if((c||s&&null!==l)&&!o)try{if(e.tagName.includes("-"))e[t]=l;else{let s=null==l?"":l;"list"===t?c=!1:null!=n&&e[t]==s||(e[t]=s)}}catch(e){}let r=!1;f!==(f=f.replace(/^xlink\:?/,""))&&(t=f,r=!0),null==l||!1===l?!1===l&&""!==e.getAttribute(t)||(r?e.removeAttributeNS(u,t):e.removeAttribute(t)):(!c||4&i||o)&&!s&&(l=!0===l?"":l,r?e.setAttributeNS(u,t,l):e.setAttribute(t,l))}else t="-"===t[2]?t.slice(3):G(s,f)?f.slice(2):f[2]+t.slice(3),n&&r.rel(e,t,n,!1),l&&r.ael(e,t,l,!1)}},v=/\s/,j=e=>e?e.split(v):[],k=(e,t,n,l)=>{const s=11===t.h.nodeType&&t.h.host?t.h.host:t.h,o=e&&e.i||$,r=t.i||$;for(l in o)l in r||g(s,l,o[l],void 0,n,t.t);for(l in r)g(s,l,o[l],r[l],n,t.t)},O=(t,l,s)=>{let r,i,c=l.u[s],u=0;if(null!==c.o)r=c.h=o.createTextNode(c.o);else{if(n||(n="svg"===c.p),r=c.h=o.createElementNS(n?"http://www.w3.org/2000/svg":"http://www.w3.org/1999/xhtml",c.p),n&&"foreignObject"===c.p&&(n=!1),k(null,c,n),null!=e&&r["s-si"]!==e&&r.classList.add(r["s-si"]=e),c.u)for(u=0;u<c.u.length;++u)i=O(t,c,u),i&&r.appendChild(i);"svg"===c.p?n=!1:"foreignObject"===r.tagName&&(n=!0)}return r},S=(e,n,l,s,o,r)=>{let i,c=e;for(c.shadowRoot&&c.tagName===t&&(c=c.shadowRoot);o<=r;++o)s[o]&&(i=O(null,l,o),i&&(s[o].h=i,c.insertBefore(i,n)))},M=(e,t,n,l,s)=>{for(;t<=n;++t)(l=e[t])&&(s=l.h,E(l),s.remove())},x=(e,t)=>e.p===t.p&&e.$===t.$,C=(e,t)=>{const l=t.h=e.h,s=e.u,o=t.u,r=t.p,i=t.o;null===i?(n="svg"===r||"foreignObject"!==r&&n,"slot"===r||k(e,t,n),null!==s&&null!==o?((e,t,n,l)=>{let s,o,r=0,i=0,c=0,u=0,f=t.length-1,a=t[0],$=t[f],p=l.length-1,y=l[0],d=l[p];for(;r<=f&&i<=p;)if(null==a)a=t[++r];else if(null==$)$=t[--f];else if(null==y)y=l[++i];else if(null==d)d=l[--p];else if(x(a,y))C(a,y),a=t[++r],y=l[++i];else if(x($,d))C($,d),$=t[--f],d=l[--p];else if(x(a,d))C(a,d),e.insertBefore(a.h,$.h.nextSibling),a=t[++r],d=l[--p];else if(x($,y))C($,y),e.insertBefore($.h,a.h),$=t[--f],y=l[++i];else{for(c=-1,u=r;u<=f;++u)if(t[u]&&null!==t[u].$&&t[u].$===y.$){c=u;break}c>=0?(o=t[c],o.p!==y.p?s=O(t&&t[i],n,c):(C(o,y),t[c]=void 0,s=o.h),y=l[++i]):(s=O(t&&t[i],n,i),y=l[++i]),s&&a.h.parentNode.insertBefore(s,a.h)}r>f?S(e,null==l[p+1]?null:l[p+1].h,n,l,i,p):i>p&&M(t,r,f)})(l,s,t,o):null!==o?(null!==e.o&&(l.textContent=""),S(l,null,t,o,0,o.length-1)):null!==s&&M(s,0,s.length-1),n&&"svg"===r&&(n=!1)):e.o!==i&&(l.data=i)},E=e=>{e.i&&e.i.ref&&e.i.ref(null),e.u&&e.u.map(E)},L=(e,t)=>{t&&!e.g&&t["s-p"]&&t["s-p"].push(new Promise(t=>e.g=t))},P=(e,t)=>{if(e.t|=16,!(4&e.t))return L(e,e.v),le(()=>T(e,t));e.t|=512},T=(e,t)=>{const n=e.j;let l;return t&&(l=R(n,"componentWillLoad")),U(l,()=>W(e,n,t))},W=async(n,l,s)=>{const r=n.k,i=r["s-rc"];s&&(e=>{const t=e.O,n=e.k,l=t.t,s=((e,t)=>{let n=a(t),l=Q.get(n);if(e=11===e.nodeType?e:o,l)if("string"==typeof l){let t,s=f.get(e=e.head||e);s||f.set(e,s=new Set),s.has(n)||(t=o.createElement("style"),t.innerHTML=l,e.insertBefore(t,e.querySelector("link")),s&&s.add(n))}else e.adoptedStyleSheets.includes(l)||(e.adoptedStyleSheets=[...e.adoptedStyleSheets,l]);return n})(n.shadowRoot?n.shadowRoot:n.getRootNode(),t);10&l&&(n["s-sc"]=s,n.classList.add(s+"-h"))})(n);((n,l)=>{const s=n.k,o=n.S||d(null,null),r=(e=>e&&e.p===h)(l)?l:y(null,null,l);t=s.tagName,r.p=null,r.t|=4,n.S=r,r.h=o.h=s.shadowRoot||s,e=s["s-sc"],C(o,r)})(n,A(n,l)),i&&(i.map(e=>e()),r["s-rc"]=void 0);{const e=r["s-p"],t=()=>F(n);0===e.length?t():(Promise.all(e).then(t),n.t|=4,e.length=0)}},A=(e,t)=>{try{t=t.render(),e.t&=-17,e.t|=2}catch(e){I(e)}return t},F=e=>{const t=e.k,n=e.j,l=e.v;64&e.t||(e.t|=64,q(t),R(n,"componentDidLoad"),e.M(t),l||H()),e.g&&(e.g(),e.g=void 0),512&e.t&&ne(()=>P(e,!1)),e.t&=-517},H=()=>{q(o.documentElement),ne(()=>(e=>{const t=r.ce("appload",{detail:{namespace:"genie"}});return e.dispatchEvent(t),t})(s))},R=(e,t,n)=>{if(e&&e[t])try{return e[t](n)}catch(e){I(e)}},U=(e,t)=>e&&e.then?e.then(t):t(),q=e=>e.classList.add("hydrated"),D=(e,t,n)=>{if(t.C){const l=Object.entries(t.C),s=e.prototype;if(l.map(([e,[l]])=>{(31&l||2&n&&32&l)&&Object.defineProperty(s,e,{get(){return((e,t)=>_(this).L.get(t))(0,e)},set(n){((e,t,n,l)=>{const s=_(e),o=s.L.get(t),r=s.t,i=s.j;n=((e,t)=>null==e||p(e)?e:4&t?"false"!==e&&(""===e||!!e):2&t?parseFloat(e):1&t?e+"":e)(n,l.C[t][0]),8&r&&void 0!==o||n===o||(s.L.set(t,n),i&&2==(18&r)&&P(s,!1))})(this,e,n,t)},configurable:!0,enumerable:!0})}),1&n){const t=new Map;s.attributeChangedCallback=function(e,n,l){r.jmp(()=>{const n=t.get(e);this[n]=(null!==l||"boolean"!=typeof this[n])&&l})},e.observedAttributes=l.filter(([e,t])=>15&t[0]).map(([e,n])=>{const l=n[1]||e;return t.set(l,e),l})}}return e},N=(e,t={})=>{const n=[],l=t.exclude||[],i=s.customElements,u=o.head,f=u.querySelector("meta[charset]"),$=o.createElement("style"),p=[];let y,d=!0;Object.assign(r,t),r.l=new URL(t.resourcesUrl||"./",o.baseURI).href,e.map(e=>e[1].map(t=>{const s={t:t[0],s:t[1],C:t[2],P:t[3]};s.C=t[2];const o=s.s,u=class extends HTMLElement{constructor(e){super(e),B(e=this,s),1&s.t&&e.attachShadow({mode:"open"})}connectedCallback(){y&&(clearTimeout(y),y=null),d?p.push(this):r.jmp(()=>(e=>{if(0==(1&r.t)){const t=_(e),n=t.O,l=()=>{};if(!(1&t.t)){t.t|=1;{let n=e;for(;n=n.parentNode||n.host;)if(n["s-p"]){L(t,t.v=n);break}}n.C&&Object.entries(n.C).map(([t,[n]])=>{if(31&n&&e.hasOwnProperty(t)){const n=e[t];delete e[t],e[t]=n}}),(async(e,t,n,l,s)=>{if(0==(32&t.t)){{if(t.t|=32,(s=K(n)).then){const e=()=>{};s=await s,e()}s.isProxied||(D(s,n,2),s.isProxied=!0);const e=()=>{};t.t|=8;try{new s(t)}catch(e){I(e)}t.t&=-9,e()}if(s.style){let e=s.style;const t=a(n);if(!Q.has(t)){const l=()=>{};((e,t,n)=>{let l=Q.get(e);c&&n?(l=l||new CSSStyleSheet,l.replace(t)):l=t,Q.set(e,l)})(t,e,!!(1&n.t)),l()}}}const o=t.v,r=()=>P(t,!0);o&&o["s-rc"]?o["s-rc"].push(r):r()})(0,t,n)}l()}})(this))}disconnectedCallback(){r.jmp(()=>{})}componentOnReady(){return _(this).T}};s.W=e[0],l.includes(o)||i.get(o)||(n.push(o),i.define(o,D(u,s,1)))})),$.innerHTML=n+"{visibility:hidden}.hydrated{visibility:inherit}",$.setAttribute("data-styles",""),u.insertBefore($,f?f.nextSibling:u.firstChild),d=!1,p.length?p.map(e=>e.connectedCallback()):r.jmp(()=>y=setTimeout(H,30))},V=new WeakMap,_=e=>V.get(e),z=(e,t)=>V.set(t.j=e,t),B=(e,t)=>{const n={t:0,k:e,O:t,L:new Map};return n.T=new Promise(e=>n.M=e),e["s-p"]=[],e["s-rc"]=[],V.set(e,n)},G=(e,t)=>t in e,I=e=>console.error(e),J=new Map,K=e=>{const t=e.s.replace(/-/g,"_"),n=e.W,l=J.get(n);return l?l[t]:import(`./${n}.entry.js`).then(e=>(J.set(n,e),e[t]),I)},Q=new Map,X=[],Y=[],Z=(e,t)=>n=>{e.push(n),l||(l=!0,t&&4&r.t?ne(te):r.raf(te))},ee=e=>{for(let t=0;t<e.length;t++)try{e[t](performance.now())}catch(e){I(e)}e.length=0},te=()=>{ee(X),ee(Y),(l=X.length>0)&&r.raf(te)},ne=e=>i().then(e),le=Z(Y,!0);export{h as H,N as b,y as h,i as p,z as r}