UNPKG

@bulmil/core

Version:

![bulmil](https://user-images.githubusercontent.com/2362138/65766959-c721a080-e16f-11e9-9fb9-45a5a2ad0391.jpg)

5 lines 14.2 kB
/*! * Bulmil - MIT License */ let l,e,n=!1,t=!1,o=!1,s=!1;const i="s-id",c="c-id",f="slot-fb{display:contents}slot-fb[hidden]{display:none}",r={},u=l=>"object"==(l=typeof l)||"function"===l;function a(l){var e,n,t;return null!==(t=null===(n=null===(e=l.head)||void 0===e?void 0:e.querySelector('meta[name="csp-nonce"]'))||void 0===n?void 0:n.getAttribute("content"))&&void 0!==t?t:void 0}const $=(l,e,...n)=>{let t=null,o=null,s=null,i=!1,c=!1;const f=[],r=e=>{for(let n=0;n<e.length;n++)t=e[n],Array.isArray(t)?r(t):null!=t&&"boolean"!=typeof t&&((i="function"!=typeof l&&!u(t))&&(t+=""),i&&c?f[f.length-1].l+=t:f.push(i?d(null,t):t),c=i)};if(r(n),e){e.key&&(o=e.key),e.name&&(s=e.name);{const l=e.className||e.class;l&&(e.class="object"!=typeof l?l:Object.keys(l).filter((e=>l[e])).join(" "))}}if("function"==typeof l)return l(null===e?{}:e,f,y);const a=d(l,null);return a.t=e,f.length>0&&(a.o=f),a.i=o,a.u=s,a},d=(l,e)=>({$:0,v:l,l:e,h:null,o:null,t:null,i:null,u:null}),v={},y={forEach:(l,e)=>l.map(h).forEach(e),map:(l,e)=>l.map(h).map(e).map(p)},h=l=>({vattrs:l.t,vchildren:l.o,vkey:l.i,vname:l.u,vtag:l.v,vtext:l.l}),p=l=>{if("function"==typeof l.vtag){const e=Object.assign({},l.vattrs);return l.vkey&&(e.key=l.vkey),l.vname&&(e.name=l.vname),$(l.vtag,e,...l.vchildren||[])}const e=d(l.vtag,l.vtext);return e.t=l.vattrs,e.o=l.vchildren,e.i=l.vkey,e.u=l.vname,e},m=(l,e,n,t,o,s,i)=>{let f,r,u,a;if(1===s.nodeType){for(f=s.getAttribute(c),f&&(r=f.split("."),r[0]!==i&&"0"!==r[0]||(u={$:0,p:r[0],m:r[1],k:r[2],S:r[3],v:s.tagName.toLowerCase(),h:s,t:null,o:null,i:null,u:null,l:null},e.push(u),s.removeAttribute(c),l.o||(l.o=[]),l.o[u.S]=u,l=u,t&&"0"===u.k&&(t[u.S]=u.h))),a=s.childNodes.length-1;a>=0;a--)m(l,e,n,t,o,s.childNodes[a],i);if(s.shadowRoot)for(a=s.shadowRoot.childNodes.length-1;a>=0;a--)m(l,e,n,t,o,s.shadowRoot.childNodes[a],i)}else if(8===s.nodeType)r=s.nodeValue.split("."),r[1]!==i&&"0"!==r[1]||(f=r[0],u={$:0,p:r[1],m:r[2],k:r[3],S:r[4],h:s,t:null,o:null,i:null,u:null,v:null,l:null},"t"===f?(u.h=s.nextSibling,u.h&&3===u.h.nodeType&&(u.l=u.h.textContent,e.push(u),s.remove(),l.o||(l.o=[]),l.o[u.S]=u,t&&"0"===u.k&&(t[u.S]=u.h))):u.p===i&&("s"===f?(u.v="slot",s["s-sn"]=r[5]?u.u=r[5]:"",s["s-sr"]=!0,n.push(u),l.o||(l.o=[]),l.o[u.S]=u):"r"===f&&(o["s-cr"]=s,s["s-cn"]=!0)));else if(l&&"style"===l.v){const e=d(null,s.textContent);e.h=s,e.S="0",l.o=[e]}},b=(l,e)=>{if(1===l.nodeType){let n=0;for(;n<l.childNodes.length;n++)b(l.childNodes[n],e);if(l.shadowRoot)for(n=0;n<l.shadowRoot.childNodes.length;n++)b(l.shadowRoot.childNodes[n],e)}else if(8===l.nodeType){const n=l.nodeValue.split(".");"o"===n[0]&&(e.set(n[1]+"."+n[2],l),l.nodeValue="",l["s-en"]=n[3])}},w=new WeakMap,g=l=>"sc-"+l.j,k=(l,e,n,t,o,s)=>{if(n!==t){let i=sl(l,e),c=e.toLowerCase();if("class"===e){const e=l.classList,o=j(n),s=j(t);e.remove(...o.filter((l=>l&&!s.includes(l)))),e.add(...s.filter((l=>l&&!o.includes(l))))}else if("key"===e);else if(i||"o"!==e[0]||"n"!==e[1]){const c=u(t);if((i||c&&null!==t)&&!o)try{if(l.tagName.includes("-"))l[e]=t;else{const o=null==t?"":t;"list"===e?i=!1:null!=n&&l[e]==o||(l[e]=o)}}catch(l){}null==t||!1===t?!1===t&&""!==l.getAttribute(e)||l.removeAttribute(e):(!i||4&s||o)&&!c&&l.setAttribute(e,t=!0===t?"":t)}else if(e="-"===e[2]?e.slice(3):sl(ul,c)?c.slice(2):c[2]+e.slice(3),n||t){const o=e.endsWith(x);e=e.replace(M,""),n&&$l.rel(l,e,n,o),t&&$l.ael(l,e,t,o)}}},S=/\s/,j=l=>l?l.split(S):[],x="Capture",M=RegExp(x+"$"),O=(l,e,n,t)=>{const o=11===e.h.nodeType&&e.h.host?e.h.host:e.h,s=l&&l.t||r,i=e.t||r;for(t in s)t in i||k(o,t,s[t],void 0,n,e.$);for(t in i)k(o,t,s[t],i[t],n,e.$)},C=(t,s,i)=>{const c=s.o[i];let f,r,u,a=0;if(n||(o=!0,"slot"===c.v&&(c.$|=c.o?2:1)),null!==c.l)f=c.h=al.createTextNode(c.l);else if(1&c.$)f=c.h=al.createTextNode("");else if(f=c.h=al.createElement(2&c.$?"slot-fb":c.v),O(null,c,!1),c.o)for(a=0;a<c.o.length;++a)r=C(t,c,a),r&&f.appendChild(r);return f["s-hn"]=e,3&c.$&&(f["s-sr"]=!0,f["s-cr"]=l,f["s-sn"]=c.u||"",u=t&&t.o&&t.o[i],u&&u.v===c.v&&t.h&&E(t.h,!1)),f},E=(l,n)=>{$l.$|=1;const t=l.childNodes;for(let l=t.length-1;l>=0;l--){const s=t[l];s["s-hn"]!==e&&s["s-ol"]&&(N(s).insertBefore(s,I(s)),s["s-ol"].remove(),s["s-ol"]=void 0,s["s-sh"]=void 0,o=!0),n&&E(s,n)}$l.$&=-2},R=(l,e,n,t,o,s)=>{let i,c=l["s-cr"]&&l["s-cr"].parentNode||l;for(;o<=s;++o)t[o]&&(i=C(null,n,o),i&&(t[o].h=i,c.insertBefore(i,I(e))))},P=(l,e,n)=>{for(let o=e;o<=n;++o){const e=l[o];if(e){const l=e.h;l&&(t=!0,l["s-ol"]?l["s-ol"].remove():E(l,!0),l.remove())}}},T=(l,e,n=!1)=>l.v===e.v&&("slot"===l.v?l.u===e.u:!!n||l.i===e.i),I=l=>l&&l["s-ol"]||l,N=l=>(l["s-ol"]?l["s-ol"]:l).parentNode,A=(l,e,t=!1)=>{const o=e.h=l.h,s=l.o,i=e.o,c=e.l;let f;null===c?(("slot"!==e.v||n)&&O(l,e,!1),null!==s&&null!==i?((l,e,n,t,o=!1)=>{let s,i,c=0,f=0,r=0,u=0,a=e.length-1,$=e[0],d=e[a],v=t.length-1,y=t[0],h=t[v];for(;c<=a&&f<=v;)if(null==$)$=e[++c];else if(null==d)d=e[--a];else if(null==y)y=t[++f];else if(null==h)h=t[--v];else if(T($,y,o))A($,y,o),$=e[++c],y=t[++f];else if(T(d,h,o))A(d,h,o),d=e[--a],h=t[--v];else if(T($,h,o))"slot"!==$.v&&"slot"!==h.v||E($.h.parentNode,!1),A($,h,o),l.insertBefore($.h,d.h.nextSibling),$=e[++c],h=t[--v];else if(T(d,y,o))"slot"!==$.v&&"slot"!==h.v||E(d.h.parentNode,!1),A(d,y,o),l.insertBefore(d.h,$.h),d=e[--a],y=t[++f];else{for(r=-1,u=c;u<=a;++u)if(e[u]&&null!==e[u].i&&e[u].i===y.i){r=u;break}r>=0?(i=e[r],i.v!==y.v?s=C(e&&e[f],n,r):(A(i,y,o),e[r]=void 0,s=i.h),y=t[++f]):(s=C(e&&e[f],n,f),y=t[++f]),s&&N($.h).insertBefore(s,I($.h))}c>a?R(l,null==t[v+1]?null:t[v+1].h,n,t,f,v):f>v&&P(e,c,a)})(o,s,e,i,t):null!==i?(null!==l.l&&(o.textContent=""),R(o,null,e,i,0,i.length-1)):null!==s&&P(s,0,s.length-1)):(f=o["s-cr"])?f.parentNode.textContent=c:l.l!==c&&(o.data=c)},F=l=>{const e=l.childNodes;for(const l of e)if(1===l.nodeType){if(l["s-sr"]){const n=l["s-sn"];l.hidden=!1;for(const t of e)if(t!==l)if(t["s-hn"]!==l["s-hn"]||""!==n){if(1===t.nodeType&&(n===t.getAttribute("slot")||n===t["s-sn"])){l.hidden=!0;break}}else if(1===t.nodeType||3===t.nodeType&&""!==t.textContent.trim()){l.hidden=!0;break}}F(l)}},H=[],L=l=>{let e,n,o;for(const s of l.childNodes){if(s["s-sr"]&&(e=s["s-cr"])&&e.parentNode){n=e.parentNode.childNodes;const l=s["s-sn"];for(o=n.length-1;o>=0;o--)if(e=n[o],!e["s-cn"]&&!e["s-nr"]&&e["s-hn"]!==s["s-hn"])if(U(e,l)){let n=H.find((l=>l.M===e));t=!0,e["s-sn"]=e["s-sn"]||l,n?(n.M["s-sh"]=s["s-hn"],n.O=s):(e["s-sh"]=s["s-hn"],H.push({O:s,M:e})),e["s-sr"]&&H.map((l=>{U(l.M,e["s-sn"])&&(n=H.find((l=>l.M===e)),n&&!l.O&&(l.O=n.O))}))}else H.some((l=>l.M===e))||H.push({M:e})}1===s.nodeType&&L(s)}},U=(l,e)=>1===l.nodeType?null===l.getAttribute("slot")&&""===e||l.getAttribute("slot")===e:l["s-sn"]===e||""===e,W=(l,e)=>{e&&!l.C&&e["s-p"]&&e["s-p"].push(new Promise((e=>l.C=e)))},q=(l,e)=>{if(l.$|=16,!(4&l.$))return W(l,l.R),kl((()=>V(l,e)));l.$|=512},V=(l,e)=>{const n=l.P;return _(void 0,(()=>B(l,n,e)))},_=(l,e)=>z(l)?l.then(e):e(),z=l=>l instanceof Promise||l&&l.then&&"function"==typeof l.then,B=async(l,e,n)=>{var t;const o=l.$hostElement$,s=o["s-rc"];n&&(l=>{const e=l.T;((l,e)=>{var n;const t=g(e),o=rl.get(t);if(l=11===l.nodeType?l:al,o)if("string"==typeof o){let s,i=w.get(l=l.head||l);if(i||w.set(l,i=new Set),!i.has(t)){if(l.host&&(s=l.querySelector(`[sty-id="${t}"]`)))s.innerHTML=o;else{s=al.createElement("style"),s.innerHTML=o;const e=null!==(n=$l.I)&&void 0!==n?n:a(al);null!=e&&s.setAttribute("nonce",e),l.insertBefore(s,l.querySelector("link"))}4&e.$&&(s.innerHTML+=f),i&&i.add(t)}}else l.adoptedStyleSheets.includes(o)||(l.adoptedStyleSheets=[...l.adoptedStyleSheets,o])})(l.$hostElement$.getRootNode(),e)})(l);D(l,e,o,n),s&&(s.map((l=>l())),o["s-rc"]=void 0);{const e=null!==(t=o["s-p"])&&void 0!==t?t:[],n=()=>G(l);0===e.length?n():(Promise.all(e).then(n),l.$|=4,e.length=0)}},D=(s,i,c,f)=>{try{i=i.render(),s.$&=-17,s.$|=2,((s,i,c=!1)=>{var f,r,u,a;const y=s.$hostElement$,h=s.T,p=s.N||d(null,null),m=(l=>l&&l.v===v)(i)?i:$(null,null,i);if(e=y.tagName,h.A&&(m.t=m.t||{},h.A.map((([l,e])=>m.t[e]=y[l]))),c&&m.t)for(const l of Object.keys(m.t))y.hasAttribute(l)&&!["key","ref","style","class"].includes(l)&&(m.t[l]=y[l]);if(m.v=null,m.$|=4,s.N=m,m.h=p.h=y,n=!!(1&h.$),l=y["s-cr"],t=!1,A(p,m,c),$l.$|=1,o){L(m.h);for(const l of H){const e=l.M;if(!e["s-ol"]){const l=al.createTextNode("");l["s-nr"]=e,e.parentNode.insertBefore(e["s-ol"]=l,e)}}for(const l of H){const e=l.M,n=l.O;if(n){const l=n.parentNode;let t=n.nextSibling;{let n=null===(f=e["s-ol"])||void 0===f?void 0:f.previousSibling;for(;n;){let o=null!==(r=n["s-nr"])&&void 0!==r?r:null;if(o&&o["s-sn"]===e["s-sn"]&&l===o.parentNode&&(o=o.nextSibling,!o||!o["s-nr"])){t=o;break}n=n.previousSibling}}(!t&&l!==e.parentNode||e.nextSibling!==t)&&e!==t&&(!e["s-hn"]&&e["s-ol"]&&(e["s-hn"]=e["s-ol"].parentNode.nodeName),l.insertBefore(e,t),1===e.nodeType&&(e.hidden=null!==(u=e["s-ih"])&&void 0!==u&&u))}else 1===e.nodeType&&(c&&(e["s-ih"]=null!==(a=e.hidden)&&void 0!==a&&a),e.hidden=!0)}}t&&F(m.h),$l.$&=-2,H.length=0,l=void 0})(s,i,f)}catch(l){il(l,s.$hostElement$)}return null},G=l=>{const e=l.$hostElement$,n=l.R;64&l.$||(l.$|=64,K(e),l.F(e),n||J()),l.C&&(l.C(),l.C=void 0),512&l.$&&gl((()=>q(l,!1))),l.$&=-517},J=()=>{K(al.documentElement),gl((()=>(l=>{const e=$l.ce("appload",{detail:{namespace:"bulmil"}});return l.dispatchEvent(e),e})(ul)))},K=l=>l.classList.add("hydrated"),Q=(l,e,n)=>{var t;const o=l.prototype;if(e.H){const s=Object.entries(e.H);if(s.map((([l,[t]])=>{(31&t||2&n&&32&t)&&Object.defineProperty(o,l,{get(){return((l,e)=>nl(this).L.get(e))(0,l)},set(n){((l,e,n,t)=>{const o=nl(l),s=o.L.get(e),i=o.$,c=o.P;n=((l,e)=>null==l||u(l)?l:4&e?"false"!==l&&(""===l||!!l):2&e?parseFloat(l):1&e?l+"":l)(n,t.H[e][0]),8&i&&void 0!==s||n===s||Number.isNaN(s)&&Number.isNaN(n)||(o.L.set(e,n),c&&2==(18&i)&&q(o,!1))})(this,l,n,e)},configurable:!0,enumerable:!0})})),1&n){const n=new Map;o.attributeChangedCallback=function(l,t,s){$l.jmp((()=>{var i;const c=n.get(l);if(this.hasOwnProperty(c))s=this[c],delete this[c];else{if(o.hasOwnProperty(c)&&"number"==typeof this[c]&&this[c]==s)return;if(null==c){const n=nl(this),o=null==n?void 0:n.$;if(o&&!(8&o)&&128&o&&s!==t){const o=n.P,c=null===(i=e.U)||void 0===i?void 0:i[l];null==c||c.forEach((e=>{null!=o[e]&&o[e].call(o,s,t,l)}))}return}}this[c]=(null!==s||"boolean"!=typeof this[c])&&s}))},l.observedAttributes=Array.from(new Set([...Object.keys(null!==(t=e.U)&&void 0!==t?t:{}),...s.filter((([l,e])=>15&e[0])).map((([l,t])=>{var o;const s=t[1]||l;return n.set(s,l),512&t[0]&&(null===(o=e.A)||void 0===o||o.push([l,s])),s}))]))}}return l},X=l=>{if(!(1&$l.$)){const e=nl(l),n=e.T,t=()=>{};if(1&e.$)(null==e?void 0:e.P)||(null==e?void 0:e.W)&&e.W.then((()=>{}));else{let t;e.$|=1,t=l.getAttribute(i),t&&((l,e,n,t)=>{const o=l.shadowRoot,s=[],c=t.N=d(e,null);$l.q||b(al.body,$l.q=new Map),l[i]=n,l.removeAttribute(i),m(c,s,[],null,l,l,n),s.map((l=>{const n=l.p+"."+l.m,t=$l.q.get(n),s=l.h;t&&dl&&""===t["s-en"]&&t.parentNode.insertBefore(s,t.nextSibling),o||(s["s-hn"]=e,t&&(s["s-ol"]=t,s["s-ol"]["s-nr"]=s)),$l.q.delete(n)}))})(l,n.j,t,e),t||12&n.$&&Y(l);{let n=l;for(;n=n.parentNode||n.host;)if(1===n.nodeType&&n.hasAttribute("s-id")&&n["s-p"]||n["s-p"]){W(e,e.R=n);break}}n.H&&Object.entries(n.H).map((([e,[n]])=>{if(31&n&&l.hasOwnProperty(e)){const n=l[e];delete l[e],l[e]=n}})),(async(l,e,n)=>{let t;if(!(32&e.$)){if(e.$|=32,n.V){if(t=fl(n),t.then){const l=()=>{};t=await t,l()}t.isProxied||(Q(t,n,2),t.isProxied=!0);const l=()=>{};e.$|=8;try{new t(e)}catch(l){il(l)}e.$&=-9,l()}else t=l.constructor,customElements.whenDefined(n.j).then((()=>e.$|=128));if(t.style){let l=t.style;const e=g(n);if(!rl.has(e)){const t=()=>{};((l,e,n)=>{let t=rl.get(l);yl&&n?(t=t||new CSSStyleSheet,"string"==typeof t?t=e:t.replaceSync(e)):t=e,rl.set(l,t)})(e,l,!!(1&n.$)),t()}}}const o=e.R,s=()=>q(e,!0);o&&o["s-rc"]?o["s-rc"].push(s):s()})(l,e,n)}t()}},Y=l=>{const e=l["s-cr"]=al.createComment("");e["s-cn"]=!0,l.insertBefore(e,l.firstChild)},Z=(l,e={})=>{var n;const t=[],o=e.exclude||[],s=ul.customElements,i=al.head,c=i.querySelector("meta[charset]"),r=al.createElement("style"),u=[];let $,d=!0;Object.assign($l,e),$l._=new URL(e.resourcesUrl||"./",al.baseURI).href,$l.$|=2;let v=!1;if(l.map((l=>{l[1].map((e=>{const n={$:e[0],j:e[1],H:e[2],B:e[3]};4&n.$&&(v=!0),n.H=e[2],n.A=[];const i=n.j,c=class extends HTMLElement{constructor(l){super(l),ol(l=this,n)}connectedCallback(){$&&(clearTimeout($),$=null),d?u.push(this):$l.jmp((()=>X(this)))}disconnectedCallback(){$l.jmp((()=>(async()=>{if(!(1&$l.$)){const l=nl(this);(null==l?void 0:l.P)||(null==l?void 0:l.W)&&l.W.then((()=>{}))}})()))}componentOnReady(){return nl(this).W}};n.V=l[0],o.includes(i)||s.get(i)||(t.push(i),s.define(i,Q(c,n,1)))}))})),t.length>0&&(v&&(r.textContent+=f),r.textContent+=t+"{visibility:hidden}.hydrated{visibility:inherit}",r.innerHTML.length)){r.setAttribute("data-styles","");const l=null!==(n=$l.I)&&void 0!==n?n:a(al);null!=l&&r.setAttribute("nonce",l),i.insertBefore(r,c?c.nextSibling:i.firstChild)}d=!1,u.length?u.map((l=>l.connectedCallback())):$l.jmp((()=>$=setTimeout(J,30)))},ll=l=>$l.I=l,el=new WeakMap,nl=l=>el.get(l),tl=(l,e)=>el.set(e.P=l,e),ol=(l,e)=>{const n={$:0,$hostElement$:l,T:e,L:new Map};return n.W=new Promise((l=>n.F=l)),l["s-p"]=[],l["s-rc"]=[],el.set(l,n)},sl=(l,e)=>e in l,il=(l,e)=>(0,console.error)(l,e),cl=new Map,fl=l=>{const e=l.j.replace(/-/g,"_"),n=l.V,t=cl.get(n);return t?t[e]:import(`./${n}.entry.js`).then((l=>(cl.set(n,l),l[e])),il) /*!__STENCIL_STATIC_IMPORT_SWITCH__*/},rl=new Map,ul="undefined"!=typeof window?window:{},al=ul.document||{head:{}},$l={$:0,_:"",jmp:l=>l(),raf:l=>requestAnimationFrame(l),ael:(l,e,n,t)=>l.addEventListener(e,n,t),rel:(l,e,n,t)=>l.removeEventListener(e,n,t),ce:(l,e)=>new CustomEvent(l,e)},dl=!0,vl=l=>Promise.resolve(l),yl=(()=>{try{return new CSSStyleSheet,"function"==typeof(new CSSStyleSheet).replaceSync}catch(l){}return!1})(),hl=[],pl=[],ml=(l,e)=>n=>{l.push(n),s||(s=!0,e&&4&$l.$?gl(wl):$l.raf(wl))},bl=l=>{for(let e=0;e<l.length;e++)try{l[e](performance.now())}catch(l){il(l)}l.length=0},wl=()=>{bl(hl),bl(pl),(s=hl.length>0)&&$l.raf(wl)},gl=l=>vl().then(l),kl=ml(pl,!0);export{v as H,Z as b,$ as h,vl as p,tl as r,ll as s}