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