@malga-checkout/core
Version:
Core components for Malga Checkout
1 lines • 13 kB
JavaScript
let e,l,t=!1,n=!1,o=!1,s=null,i=!1;const r="undefined"!=typeof window?window:{},c=r.document||{head:{}},f={l:0,t:"",jmp:e=>e(),raf:e=>requestAnimationFrame(e),ael:(e,l,t,n)=>e.addEventListener(l,t,n),rel:(e,l,t,n)=>e.removeEventListener(l,t,n),ce:(e,l)=>new CustomEvent(e,l)},a=e=>Promise.resolve(e),u=(()=>{try{return new CSSStyleSheet,"function"==typeof(new CSSStyleSheet).replace}catch(e){}return!1})(),$="http://www.w3.org/1999/xlink",d=new WeakMap,y=e=>"sc-"+e.o,p={},m=e=>"object"==(e=typeof e)||"function"===e,h=(e,l,...t)=>{let n=null,o=null,s=null,i=!1,r=!1,c=[];const f=l=>{for(let t=0;t<l.length;t++)n=l[t],Array.isArray(n)?f(n):null!=n&&"boolean"!=typeof n&&((i="function"!=typeof e&&!m(n))&&(n+=""),i&&r?c[c.length-1].i+=n:c.push(i?b(null,n):n),r=i)};if(f(t),l){l.key&&(o=l.key),l.name&&(s=l.name);{const e=l.className||l.class;e&&(l.class="object"!=typeof e?e:Object.keys(e).filter((l=>e[l])).join(" "))}}if("function"==typeof e)return e(null===l?{}:l,c,g);const a=b(e,null);return a.u=l,c.length>0&&(a.$=c),a.p=o,a.m=s,a},b=(e,l)=>({l:0,h:e,i:l,g:null,$:null,u:null,p:null,m:null}),w={},g={forEach:(e,l)=>e.map(k).forEach(l),map:(e,l)=>e.map(k).map(l).map(v)},k=e=>({vattrs:e.u,vchildren:e.$,vkey:e.p,vname:e.m,vtag:e.h,vtext:e.i}),v=e=>{if("function"==typeof e.vtag){const l=Object.assign({},e.vattrs);return e.vkey&&(l.key=e.vkey),e.vname&&(l.name=e.vname),h(e.vtag,l,...e.vchildren||[])}const l=b(e.vtag,e.vtext);return l.u=e.vattrs,l.$=e.vchildren,l.p=e.vkey,l.m=e.vname,l},S=(e,l,t,n,o,s)=>{if(t!==n){let i=ue(e,l),c=l.toLowerCase();if("class"===l){const l=e.classList,o=x(t),s=x(n);l.remove(...o.filter((e=>e&&!s.includes(e)))),l.add(...s.filter((e=>e&&!o.includes(e))))}else if("style"===l){for(const l in t)n&&null!=n[l]||(l.includes("-")?e.style.removeProperty(l):e.style[l]="");for(const l in n)t&&n[l]===t[l]||(l.includes("-")?e.style.setProperty(l,n[l]):e.style[l]=n[l])}else if("key"===l);else if("ref"===l)n&&n(e);else if(i||"o"!==l[0]||"n"!==l[1]){const r=m(n);if((i||r&&null!==n)&&!o)try{if(e.tagName.includes("-"))e[l]=n;else{let o=null==n?"":n;"list"===l?i=!1:null!=t&&e[l]==o||(e[l]=o)}}catch(e){}let f=!1;c!==(c=c.replace(/^xlink\:?/,""))&&(l=c,f=!0),null==n||!1===n?!1===n&&""!==e.getAttribute(l)||(f?e.removeAttributeNS($,l):e.removeAttribute(l)):(!i||4&s||o)&&!r&&(n=!0===n?"":n,f?e.setAttributeNS($,l,n):e.setAttribute(l,n))}else l="-"===l[2]?l.slice(3):ue(r,c)?c.slice(2):c[2]+l.slice(3),t&&f.rel(e,l,t,!1),n&&f.ael(e,l,n,!1)}},j=/\s/,x=e=>e?e.split(j):[],M=(e,l,t,n)=>{const o=11===l.g.nodeType&&l.g.host?l.g.host:l.g,s=e&&e.u||p,i=l.u||p;for(n in s)n in i||S(o,n,s[n],void 0,t,l.l);for(n in i)S(o,n,s[n],i[n],t,l.l)},O=(n,s,i)=>{let r,f,a,u=s.$[i],$=0;if(t||(o=!0,"slot"===u.h&&(u.l|=u.$?2:1)),null!==u.i)r=u.g=c.createTextNode(u.i);else if(1&u.l)r=u.g=c.createTextNode("");else if(r=u.g=c.createElement(2&u.l?"slot-fb":u.h),M(null,u,!1),u.$)for($=0;$<u.$.length;++$)f=O(n,u,$),f&&r.appendChild(f);return r["s-hn"]=l,3&u.l&&(r["s-sr"]=!0,r["s-cr"]=e,r["s-sn"]=u.m||"",a=n&&n.$&&n.$[i],a&&a.h===u.h&&n.g&&C(n.g,!1)),r},C=(e,t)=>{f.l|=1;const n=e.childNodes;for(let e=n.length-1;e>=0;e--){const s=n[e];s["s-hn"]!==l&&s["s-ol"]&&(L(s).insertBefore(s,I(s)),s["s-ol"].remove(),s["s-ol"]=void 0,o=!0),t&&C(s,t)}f.l&=-2},R=(e,l,t,n,o,s)=>{let i,r=e["s-cr"]&&e["s-cr"].parentNode||e;for(;o<=s;++o)n[o]&&(i=O(null,t,o),i&&(n[o].g=i,r.insertBefore(i,I(l))))},T=(e,l,t,o,s)=>{for(;l<=t;++l)(o=e[l])&&(s=o.g,D(o),n=!0,s["s-ol"]?s["s-ol"].remove():C(s,!0),s.remove())},E=(e,l)=>e.h===l.h&&("slot"===e.h?e.m===l.m:e.p===l.p),I=e=>e&&e["s-ol"]||e,L=e=>(e["s-ol"]?e["s-ol"]:e).parentNode,P=(e,l)=>{const t=l.g=e.g,n=e.$,o=l.$,s=l.i;let i;null===s?("slot"===l.h||M(e,l,!1),null!==n&&null!==o?((e,l,t,n)=>{let o,s,i=0,r=0,c=0,f=0,a=l.length-1,u=l[0],$=l[a],d=n.length-1,y=n[0],p=n[d];for(;i<=a&&r<=d;)if(null==u)u=l[++i];else if(null==$)$=l[--a];else if(null==y)y=n[++r];else if(null==p)p=n[--d];else if(E(u,y))P(u,y),u=l[++i],y=n[++r];else if(E($,p))P($,p),$=l[--a],p=n[--d];else if(E(u,p))"slot"!==u.h&&"slot"!==p.h||C(u.g.parentNode,!1),P(u,p),e.insertBefore(u.g,$.g.nextSibling),u=l[++i],p=n[--d];else if(E($,y))"slot"!==u.h&&"slot"!==p.h||C($.g.parentNode,!1),P($,y),e.insertBefore($.g,u.g),$=l[--a],y=n[++r];else{for(c=-1,f=i;f<=a;++f)if(l[f]&&null!==l[f].p&&l[f].p===y.p){c=f;break}c>=0?(s=l[c],s.h!==y.h?o=O(l&&l[r],t,c):(P(s,y),l[c]=void 0,o=s.g),y=n[++r]):(o=O(l&&l[r],t,r),y=n[++r]),o&&L(u.g).insertBefore(o,I(u.g))}i>a?R(e,null==n[d+1]?null:n[d+1].g,t,n,r,d):r>d&&T(l,i,a)})(t,n,l,o):null!==o?(null!==e.i&&(t.textContent=""),R(t,null,l,o,0,o.length-1)):null!==n&&T(n,0,n.length-1)):(i=t["s-cr"])?i.parentNode.textContent=s:e.i!==s&&(t.data=s)},W=e=>{let l,t,n,o,s,i,r=e.childNodes;for(t=0,n=r.length;t<n;t++)if(l=r[t],1===l.nodeType){if(l["s-sr"])for(s=l["s-sn"],l.hidden=!1,o=0;o<n;o++)if(i=r[o].nodeType,r[o]["s-hn"]!==l["s-hn"]||""!==s){if(1===i&&s===r[o].getAttribute("slot")){l.hidden=!0;break}}else if(1===i||3===i&&""!==r[o].textContent.trim()){l.hidden=!0;break}W(l)}},F=[],U=e=>{let l,t,o,s,i,r,c=0,f=e.childNodes,a=f.length;for(;c<a;c++){if(l=f[c],l["s-sr"]&&(t=l["s-cr"])&&t.parentNode)for(o=t.parentNode.childNodes,s=l["s-sn"],r=o.length-1;r>=0;r--)t=o[r],t["s-cn"]||t["s-nr"]||t["s-hn"]===l["s-hn"]||(A(t,s)?(i=F.find((e=>e.k===t)),n=!0,t["s-sn"]=t["s-sn"]||s,i?i.v=l:F.push({v:l,k:t}),t["s-sr"]&&F.map((e=>{A(e.k,t["s-sn"])&&(i=F.find((e=>e.k===t)),i&&!e.v&&(e.v=i.v))}))):F.some((e=>e.k===t))||F.push({k:t}));1===l.nodeType&&U(l)}},A=(e,l)=>1===e.nodeType?null===e.getAttribute("slot")&&""===l||e.getAttribute("slot")===l:e["s-sn"]===l||""===l,D=e=>{e.u&&e.u.ref&&e.u.ref(null),e.$&&e.$.map(D)},H=(e,l,t)=>{const n=(e=>ce(e).S)(e);return{emit:e=>N(n,l,{bubbles:!!(4&t),composed:!!(2&t),cancelable:!!(1&t),detail:e})}},N=(e,l,t)=>{const n=f.ce(l,t);return e.dispatchEvent(n),n},q=(e,l)=>{l&&!e.j&&l["s-p"]&&l["s-p"].push(new Promise((l=>e.j=l)))},V=(e,l)=>{if(e.l|=16,!(4&e.l))return q(e,e.M),ve((()=>_(e,l)));e.l|=512},_=(e,l)=>{const t=e.O;let n;return n=X(t,l?"componentWillLoad":"componentWillUpdate"),Y(n,(()=>z(e,t,l)))},z=async(e,l,t)=>{const n=e.S,o=n["s-rc"];t&&(e=>{const l=e.C;((e,l)=>{let t=y(l),n=pe.get(t);if(e=11===e.nodeType?e:c,n)if("string"==typeof n){let l,o=d.get(e=e.head||e);o||d.set(e,o=new Set),o.has(t)||(e.host&&(l=e.querySelector(`[sty-id="${t}"]`))?l.innerHTML=n:(l=c.createElement("style"),l.innerHTML=n,e.insertBefore(l,e.querySelector("link"))),o&&o.add(t))}else e.adoptedStyleSheets.includes(n)||(e.adoptedStyleSheets=[...e.adoptedStyleSheets,n])})(e.S.getRootNode(),l)})(e);B(e,l),o&&(o.map((e=>e())),n["s-rc"]=void 0);{const l=n["s-p"],t=()=>J(e);0===l.length?t():(Promise.all(l).then(t),e.l|=4,l.length=0)}},B=(i,r)=>{try{s=r,r=r.render(),i.l&=-17,i.l|=2,((s,i)=>{const r=s.S,a=s.C,u=s.R||b(null,null),$=(e=>e&&e.h===w)(i)?i:h(null,null,i);if(l=r.tagName,$.h=null,$.l|=4,s.R=$,$.g=u.g=r,e=r["s-cr"],t=0!=(1&a.l),n=!1,P(u,$),f.l|=1,o){let e,l,t,n,o,s;U($.g);let i=0;for(;i<F.length;i++)e=F[i],l=e.k,l["s-ol"]||(t=c.createTextNode(""),t["s-nr"]=l,l.parentNode.insertBefore(l["s-ol"]=t,l));for(i=0;i<F.length;i++)if(e=F[i],l=e.k,e.v){for(n=e.v.parentNode,o=e.v.nextSibling,t=l["s-ol"];t=t.previousSibling;)if(s=t["s-nr"],s&&s["s-sn"]===l["s-sn"]&&n===s.parentNode&&(s=s.nextSibling,!s||!s["s-nr"])){o=s;break}(!o&&n!==l.parentNode||l.nextSibling!==o)&&l!==o&&(!l["s-hn"]&&l["s-ol"]&&(l["s-hn"]=l["s-ol"].parentNode.nodeName),n.insertBefore(l,o))}else 1===l.nodeType&&(l.hidden=!0)}n&&W($.g),f.l&=-2,F.length=0})(i,r)}catch(e){$e(e,i.S)}return s=null,null},G=()=>s,J=e=>{const l=e.S,t=e.O,n=e.M;X(t,"componentDidRender"),64&e.l||(e.l|=64,Z(l),X(t,"componentDidLoad"),e.T(l),n||Q()),e.j&&(e.j(),e.j=void 0),512&e.l&&ke((()=>V(e,!1))),e.l&=-517},K=e=>{{const l=ce(e),t=l.S.isConnected;return t&&2==(18&l.l)&&V(l,!1),t}},Q=()=>{Z(c.documentElement),ke((()=>N(r,"appload",{detail:{namespace:"malga-checkout"}})))},X=(e,l,t)=>{if(e&&e[l])try{return e[l](t)}catch(e){$e(e)}},Y=(e,l)=>e&&e.then?e.then(l):l(),Z=e=>e.classList.add("hydrated"),ee=(e,l,t,n,o,s,i)=>{let r,c,f,a;if(1===s.nodeType){for(r=s.getAttribute("c-id"),r&&(c=r.split("."),c[0]!==i&&"0"!==c[0]||(f={l:0,I:c[0],L:c[1],P:c[2],W:c[3],h:s.tagName.toLowerCase(),g:s,u:null,$:null,p:null,m:null,i:null},l.push(f),s.removeAttribute("c-id"),e.$||(e.$=[]),e.$[f.W]=f,e=f,n&&"0"===f.P&&(n[f.W]=f.g))),a=s.childNodes.length-1;a>=0;a--)ee(e,l,t,n,o,s.childNodes[a],i);if(s.shadowRoot)for(a=s.shadowRoot.childNodes.length-1;a>=0;a--)ee(e,l,t,n,o,s.shadowRoot.childNodes[a],i)}else if(8===s.nodeType)c=s.nodeValue.split("."),c[1]!==i&&"0"!==c[1]||(r=c[0],f={l:0,I:c[1],L:c[2],P:c[3],W:c[4],g:s,u:null,$:null,p:null,m:null,h:null,i:null},"t"===r?(f.g=s.nextSibling,f.g&&3===f.g.nodeType&&(f.i=f.g.textContent,l.push(f),s.remove(),e.$||(e.$=[]),e.$[f.W]=f,n&&"0"===f.P&&(n[f.W]=f.g))):f.I===i&&("s"===r?(f.h="slot",s["s-sn"]=c[5]?f.m=c[5]:"",s["s-sr"]=!0,t.push(f),e.$||(e.$=[]),e.$[f.W]=f):"r"===r&&(o["s-cr"]=s,s["s-cn"]=!0)));else if(e&&"style"===e.h){const l=b(null,s.textContent);l.g=s,l.W="0",e.$=[l]}},le=(e,l)=>{if(1===e.nodeType){let t=0;for(;t<e.childNodes.length;t++)le(e.childNodes[t],l);if(e.shadowRoot)for(t=0;t<e.shadowRoot.childNodes.length;t++)le(e.shadowRoot.childNodes[t],l)}else if(8===e.nodeType){const t=e.nodeValue.split(".");"o"===t[0]&&(l.set(t[1]+"."+t[2],e),e.nodeValue="",e["s-en"]=t[3])}},te=(e,l,t)=>{if(l.F){e.watchers&&(l.U=e.watchers);const n=Object.entries(l.F),o=e.prototype;if(n.map((([e,[n]])=>{(31&n||2&t&&32&n)&&Object.defineProperty(o,e,{get(){return((e,l)=>ce(this).A.get(l))(0,e)},set(t){((e,l,t,n)=>{const o=ce(e),s=o.S,i=o.A.get(l),r=o.l,c=o.O;if(t=((e,l)=>null==e||m(e)?e:4&l?"false"!==e&&(""===e||!!e):2&l?parseFloat(e):1&l?e+"":e)(t,n.F[l][0]),!(8&r&&void 0!==i||t===i)&&(o.A.set(l,t),c)){if(n.U&&128&r){const e=n.U[l];e&&e.map((e=>{try{c[e](t,i,l)}catch(e){$e(e,s)}}))}2==(18&r)&&V(o,!1)}})(this,e,t,l)},configurable:!0,enumerable:!0})})),1&t){const l=new Map;o.attributeChangedCallback=function(e,t,n){f.jmp((()=>{const t=l.get(e);this[t]=(null!==n||"boolean"!=typeof this[t])&&n}))},e.observedAttributes=n.filter((([e,l])=>15&l[0])).map((([e,t])=>{const n=t[1]||e;return l.set(n,e),n}))}}return e},ne=e=>{if(0==(1&f.l)){const l=ce(e),t=l.C,n=()=>{};if(!(1&l.l)){let n;l.l|=1,n=e.getAttribute("s-id"),n&&((e,l,t,n)=>{const o=e.shadowRoot,s=[],i=n.R=b(l,null);f.D||le(c.body,f.D=new Map),e["s-id"]=t,e.removeAttribute("s-id"),ee(i,s,[],null,e,e,t),s.map((e=>{const t=e.I+"."+e.L,n=f.D.get(t),s=e.g;n&&""===n["s-en"]&&n.parentNode.insertBefore(s,n.nextSibling),o||(s["s-hn"]=l,n&&(s["s-ol"]=n,s["s-ol"]["s-nr"]=s)),f.D.delete(t)}))})(e,t.o,n,l),n||12&t.l&&oe(e);{let t=e;for(;t=t.parentNode||t.host;)if(1===t.nodeType&&t.hasAttribute("s-id")&&t["s-p"]||t["s-p"]){q(l,l.M=t);break}}t.F&&Object.entries(t.F).map((([l,[t]])=>{if(31&t&&e.hasOwnProperty(l)){const t=e[l];delete e[l],e[l]=t}})),(async(e,l,t,n,o)=>{if(0==(32&l.l)){{if(l.l|=32,(o=ye(t)).then){const e=()=>{};o=await o,e()}o.isProxied||(t.U=o.watchers,te(o,t,2),o.isProxied=!0);const e=()=>{};l.l|=8;try{new o(l)}catch(e){$e(e)}l.l&=-9,l.l|=128,e()}if(o.style){let e=o.style;const l=y(t);if(!pe.has(l)){const n=()=>{};((e,l,t)=>{let n=pe.get(e);u&&t?(n=n||new CSSStyleSheet,n.replace(l)):n=l,pe.set(e,n)})(l,e,!!(1&t.l)),n()}}}const s=l.M,i=()=>V(l,!0);s&&s["s-rc"]?s["s-rc"].push(i):i()})(0,l,t)}n()}},oe=e=>{const l=e["s-cr"]=c.createComment("");l["s-cn"]=!0,e.insertBefore(l,e.firstChild)},se=(e,l={})=>{const t=[],n=l.exclude||[],o=r.customElements,s=c.head,i=s.querySelector("meta[charset]"),a=c.createElement("style"),u=[];let $,d=!0;Object.assign(f,l),f.t=new URL(l.resourcesUrl||"./",c.baseURI).href,f.l|=2,e.map((e=>e[1].map((l=>{const s={l:l[0],o:l[1],F:l[2],H:l[3]};s.F=l[2],s.U={};const i=s.o,r=class extends HTMLElement{constructor(e){super(e),ae(e=this,s)}connectedCallback(){$&&(clearTimeout($),$=null),d?u.push(this):f.jmp((()=>ne(this)))}disconnectedCallback(){f.jmp((()=>{}))}componentOnReady(){return ce(this).N}};s.q=e[0],n.includes(i)||o.get(i)||(t.push(i),o.define(i,te(r,s,1)))})))),a.innerHTML=t+"{visibility:hidden}.hydrated{visibility:inherit}",a.setAttribute("data-styles",""),s.insertBefore(a,i?i.nextSibling:s.firstChild),d=!1,u.length?u.map((e=>e.connectedCallback())):f.jmp((()=>$=setTimeout(Q,30)))},ie=(e,l)=>l,re=new WeakMap,ce=e=>re.get(e),fe=(e,l)=>re.set(l.O=e,l),ae=(e,l)=>{const t={l:0,S:e,C:l,A:new Map};return t.N=new Promise((e=>t.T=e)),e["s-p"]=[],e["s-rc"]=[],re.set(e,t)},ue=(e,l)=>l in e,$e=(e,l)=>(0,console.error)(e,l),de=new Map,ye=e=>{const l=e.o.replace(/-/g,"_"),t=e.q,n=de.get(t);return n?n[l]:import(`./${t}.entry.js`).then((e=>(de.set(t,e),e[l])),$e)},pe=new Map,me=[],he=[],be=(e,l)=>t=>{e.push(t),i||(i=!0,l&&4&f.l?ke(ge):f.raf(ge))},we=e=>{for(let l=0;l<e.length;l++)try{e[l](performance.now())}catch(e){$e(e)}e.length=0},ge=()=>{we(me),we(he),(i=me.length>0)&&f.raf(ge)},ke=e=>a().then(e),ve=be(he,!0);export{ie as F,w as H,se as b,H as c,K as f,G as g,h,a as p,fe as r}