@everymatrix/lottery-banner 0.0.17 → 0.0.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. package/dist/cjs/{index-4511b749.js → index-0a0cc64c.js} +18 -1
  2. package/dist/cjs/index.cjs.js +2 -2
  3. package/dist/cjs/loader.cjs.js +2 -2
  4. package/dist/cjs/lottery-banner-a5256c5a.js +3032 -0
  5. package/dist/cjs/lottery-banner.cjs.entry.js +2 -2
  6. package/dist/cjs/lottery-banner.cjs.js +2 -2
  7. package/dist/collection/components/lottery-banner/lottery-banner.css +7 -3
  8. package/dist/collection/components/lottery-banner/lottery-banner.js +76 -3
  9. package/dist/collection/utils/locale.utils.js +5 -2
  10. package/dist/collection/utils/utils.js +42 -1
  11. package/dist/esm/{index-0b45dd81.js → index-58dd14ef.js} +18 -2
  12. package/dist/esm/index.js +2 -2
  13. package/dist/esm/loader.js +3 -3
  14. package/dist/esm/lottery-banner-925a2ddf.js +3030 -0
  15. package/dist/esm/lottery-banner.entry.js +2 -2
  16. package/dist/esm/lottery-banner.js +3 -3
  17. package/dist/lottery-banner/index-58dd14ef.js +2 -0
  18. package/dist/lottery-banner/index.esm.js +1 -1
  19. package/dist/lottery-banner/lottery-banner-925a2ddf.js +1 -0
  20. package/dist/lottery-banner/lottery-banner.entry.js +1 -1
  21. package/dist/lottery-banner/lottery-banner.esm.js +1 -1
  22. package/dist/types/components/lottery-banner/lottery-banner.d.ts +18 -1
  23. package/dist/types/components.d.ts +29 -2
  24. package/dist/types/utils/utils.d.ts +10 -0
  25. package/package.json +1 -1
  26. package/dist/cjs/lottery-banner-73236552.js +0 -252
  27. package/dist/esm/lottery-banner-89c08855.js +0 -250
  28. package/dist/lottery-banner/index-0b45dd81.js +0 -2
  29. package/dist/lottery-banner/lottery-banner-89c08855.js +0 -1
@@ -1,2 +1,2 @@
1
- export { L as lottery_banner } from './lottery-banner-89c08855.js';
2
- import './index-0b45dd81.js';
1
+ export { L as lottery_banner } from './lottery-banner-925a2ddf.js';
2
+ import './index-58dd14ef.js';
@@ -1,5 +1,5 @@
1
- import { p as promiseResolve, b as bootstrapLazy } from './index-0b45dd81.js';
2
- export { s as setNonce } from './index-0b45dd81.js';
1
+ import { p as promiseResolve, b as bootstrapLazy } from './index-58dd14ef.js';
2
+ export { s as setNonce } from './index-58dd14ef.js';
3
3
  import { g as globalScripts } from './app-globals-0f993ce5.js';
4
4
 
5
5
  /*
@@ -16,5 +16,5 @@ var patchBrowser = () => {
16
16
 
17
17
  patchBrowser().then(async (options) => {
18
18
  await globalScripts();
19
- return bootstrapLazy([["lottery-banner",[[1,"lottery-banner",{"mbSource":[513,"mb-source"],"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"translationUrl":[513,"translation-url"],"language":[513],"logoUrl":[513,"logo-url"],"stopTime":[1,"stop-time"],"bannerTitle":[1,"banner-title"],"turnover":[1],"layout":[1]},null,{"clientStyling":["handleClientStylingChange"],"clientStylingUrl":["handleClientStylingUrlChange"],"mbSource":["handleMbSourceChange"]}]]]], options);
19
+ return bootstrapLazy([["lottery-banner",[[1,"lottery-banner",{"mbSource":[513,"mb-source"],"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"translationUrl":[513,"translation-url"],"language":[513],"logoUrl":[513,"logo-url"],"stopTime":[1,"stop-time"],"startTime":[1,"start-time"],"bannerTitle":[1,"banner-title"],"turnover":[1],"layout":[1],"formattedTime":[32]},null,{"clientStyling":["handleClientStylingChange"],"clientStylingUrl":["handleClientStylingUrlChange"],"mbSource":["handleMbSourceChange"],"startTime":["handleTimeChange"],"stopTime":["handleTimeChange"]}]]]], options);
20
20
  });
@@ -0,0 +1,2 @@
1
+ var e=Object.defineProperty,t=new WeakMap,n=e=>t.get(e),l=(e,n)=>t.set(n.t=e,n),o=(e,t)=>(0,console.error)(e,t),s=new Map,r=new Map,i="slot-fb{display:contents}slot-fb[hidden]{display:none}",c="undefined"!=typeof window?window:{},u=c.document||{head:{}},a={l:0,o:"",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)},f=e=>Promise.resolve(e),h=(()=>{try{return new CSSStyleSheet,"function"==typeof(new CSSStyleSheet).replaceSync}catch(e){}return!1})(),d=!1,m=[],p=[],y=(e,t)=>n=>{e.push(n),d||(d=!0,t&&4&a.l?w(b):a.raf(b))},$=e=>{for(let t=0;t<e.length;t++)try{e[t](performance.now())}catch(e){o(e)}e.length=0},b=()=>{$(m),$(p),(d=m.length>0)&&a.raf(b)},w=e=>f().then(e),v=y(p,!0),S={},g=e=>"object"==(e=typeof e)||"function"===e;function j(e){var t,n,l;return null!=(l=null==(n=null==(t=e.head)?void 0:t.querySelector('meta[name="csp-nonce"]'))?void 0:n.getAttribute("content"))?l:void 0}((t,n)=>{for(var l in n)e(t,l,{get:n[l],enumerable:!0})})({},{err:()=>O,map:()=>E,ok:()=>k,unwrap:()=>P,unwrapErr:()=>x});var k=e=>({isOk:!0,isErr:!1,value:e}),O=e=>({isOk:!1,isErr:!0,value:e});function E(e,t){if(e.isOk){const n=t(e.value);return n instanceof Promise?n.then((e=>k(e))):k(n)}if(e.isErr)return O(e.value);throw"should never get here"}var C,M,P=e=>{if(e.isOk)return e.value;throw e.value},x=e=>{if(e.isErr)return e.value;throw e.value},L=(e,t,...n)=>{let l=null,o=null,s=!1,r=!1;const i=[],c=t=>{for(let n=0;n<t.length;n++)l=t[n],Array.isArray(l)?c(l):null!=l&&"boolean"!=typeof l&&((s="function"!=typeof e&&!g(l))&&(l+=""),s&&r?i[i.length-1].i+=l:i.push(s?T(null,l):l),r=s)};if(c(n),t){t.key&&(o=t.key);{const e=t.className||t.class;e&&(t.class="object"!=typeof e?e:Object.keys(e).filter((t=>e[t])).join(" "))}}const u=T(e,null);return u.u=t,i.length>0&&(u.h=i),u.m=o,u},T=(e,t)=>({l:0,p:e,i:t,$:null,h:null,u:null,m:null}),A={},N=(e,t,l)=>{const o=(e=>n(e).$hostElement$)(e);return{emit:e=>R(o,t,{bubbles:!!(4&l),composed:!!(2&l),cancelable:!!(1&l),detail:e})}},R=(e,t,n)=>{const l=a.ce(t,n);return e.dispatchEvent(l),l},U=new WeakMap,W=e=>"sc-"+e.v,D=(e,t,n,l,o,s)=>{if(n!==l){let r=((e,t)=>t in e)(e,t);if(t.toLowerCase(),"class"===t){const t=e.classList,o=H(n),s=H(l);t.remove(...o.filter((e=>e&&!s.includes(e)))),t.add(...s.filter((e=>e&&!o.includes(e))))}else if("key"===t);else if("ref"===t)l&&l(e);else{const i=g(l);if((r||i&&null!==l)&&!o)try{if(e.tagName.includes("-"))e[t]=l;else{const o=null==l?"":l;"list"===t?r=!1:null!=n&&e[t]==o||(e[t]=o)}}catch(e){}null==l||!1===l?!1===l&&""!==e.getAttribute(t)||e.removeAttribute(t):(!r||4&s||o)&&!i&&e.setAttribute(t,l=!0===l?"":l)}}},F=/\s/,H=e=>e?e.split(F):[],q=(e,t,n)=>{const l=11===t.$.nodeType&&t.$.host?t.$.host:t.$,o=e&&e.u||S,s=t.u||S;for(const e of G(Object.keys(o)))e in s||D(l,e,o[e],void 0,n,t.l);for(const e of G(Object.keys(s)))D(l,e,o[e],s[e],n,t.l)};function G(e){return e.includes("ref")?[...e.filter((e=>"ref"!==e)),"ref"]:e}var V=!1,_=(e,t,n)=>{const l=t.h[n];let o,s,r=0;if(null!==l.i)o=l.$=u.createTextNode(l.i);else if(o=l.$=u.createElement(l.p),q(null,l,V),null!=C&&o["s-si"]!==C&&o.classList.add(o["s-si"]=C),l.h)for(r=0;r<l.h.length;++r)s=_(e,l,r),s&&o.appendChild(s);return o["s-hn"]=M,o},z=(e,t,n,l,o,s)=>{let r,i=e;for(i.shadowRoot&&i.tagName===M&&(i=i.shadowRoot);o<=s;++o)l[o]&&(r=_(null,n,o),r&&(l[o].$=r,Q(i,r,t)))},B=(e,t,n)=>{for(let l=t;l<=n;++l){const t=e[l];if(t){const e=t.$;K(t),e&&e.remove()}}},I=(e,t,n=!1)=>e.p===t.p&&(!!n||e.m===t.m),J=(e,t,n=!1)=>{const l=t.$=e.$,o=e.h,s=t.h,r=t.i;null===r?(q(e,t,V),null!==o&&null!==s?((e,t,n,l,o=!1)=>{let s,r,i=0,c=0,u=0,a=0,f=t.length-1,h=t[0],d=t[f],m=l.length-1,p=l[0],y=l[m];for(;i<=f&&c<=m;)if(null==h)h=t[++i];else if(null==d)d=t[--f];else if(null==p)p=l[++c];else if(null==y)y=l[--m];else if(I(h,p,o))J(h,p,o),h=t[++i],p=l[++c];else if(I(d,y,o))J(d,y,o),d=t[--f],y=l[--m];else if(I(h,y,o))J(h,y,o),Q(e,h.$,d.$.nextSibling),h=t[++i],y=l[--m];else if(I(d,p,o))J(d,p,o),Q(e,d.$,h.$),d=t[--f],p=l[++c];else{for(u=-1,a=i;a<=f;++a)if(t[a]&&null!==t[a].m&&t[a].m===p.m){u=a;break}u>=0?(r=t[u],r.p!==p.p?s=_(t&&t[c],n,u):(J(r,p,o),t[u]=void 0,s=r.$),p=l[++c]):(s=_(t&&t[c],n,c),p=l[++c]),s&&Q(h.$.parentNode,s,h.$)}i>f?z(e,null==l[m+1]?null:l[m+1].$,n,l,c,m):c>m&&B(t,i,f)})(l,o,t,s,n):null!==s?(null!==e.i&&(l.textContent=""),z(l,null,t,s,0,s.length-1)):null!==o&&B(o,0,o.length-1)):e.i!==r&&(l.data=r)},K=e=>{e.u&&e.u.ref&&e.u.ref(null),e.h&&e.h.map(K)},Q=(e,t,n)=>null==e?void 0:e.insertBefore(t,n),X=(e,t)=>{t&&!e.S&&t["s-p"]&&t["s-p"].push(new Promise((t=>e.S=t)))},Y=(e,t)=>{if(e.l|=16,!(4&e.l))return X(e,e.j),v((()=>Z(e,t)));e.l|=512},Z=(e,t)=>{const n=e.t;if(!n)throw Error(`Can't render component <${e.$hostElement$.tagName.toLowerCase()} /> with invalid Stencil runtime! Make sure this imported component is compiled with a \`externalRuntime: true\` flag. For more information, please refer to https://stenciljs.com/docs/custom-elements#externalruntime`);let l;return t&&(l=re(n,"componentWillLoad")),ee(l,(()=>ne(e,n,t)))},ee=(e,t)=>te(e)?e.then(t).catch((e=>{console.error(e),t()})):t(),te=e=>e instanceof Promise||e&&e.then&&"function"==typeof e.then,ne=async(e,t,n)=>{var l;const o=e.$hostElement$,s=o["s-rc"];n&&(e=>{const t=e.k,n=e.$hostElement$,l=t.l,o=((e,t)=>{var n;const l=W(t),o=r.get(l);if(e=11===e.nodeType?e:u,o)if("string"==typeof o){let s,r=U.get(e=e.head||e);if(r||U.set(e,r=new Set),!r.has(l)){{s=u.createElement("style"),s.innerHTML=o;const t=null!=(n=a.O)?n:j(u);null!=t&&s.setAttribute("nonce",t),e.insertBefore(s,e.querySelector("link"))}4&t.l&&(s.innerHTML+=i),r&&r.add(l)}}else e.adoptedStyleSheets.includes(o)||(e.adoptedStyleSheets=[...e.adoptedStyleSheets,o]);return l})(n.shadowRoot?n.shadowRoot:n.getRootNode(),t);10&l&&(n["s-sc"]=o,n.classList.add(o+"-h"))})(e);le(e,t,o,n),s&&(s.map((e=>e())),o["s-rc"]=void 0);{const t=null!=(l=o["s-p"])?l:[],n=()=>oe(e);0===t.length?n():(Promise.all(t).then(n),e.l|=4,t.length=0)}},le=(e,t,n,l)=>{try{t=t.render(),e.l&=-17,e.l|=2,((e,t,n=!1)=>{const l=e.$hostElement$,o=e.k,s=e.C||T(null,null),r=(e=>e&&e.p===A)(t)?t:L(null,null,t);if(M=l.tagName,o.M&&(r.u=r.u||{},o.M.map((([e,t])=>r.u[t]=l[e]))),n&&r.u)for(const e of Object.keys(r.u))l.hasAttribute(e)&&!["key","ref","style","class"].includes(e)&&(r.u[e]=l[e]);r.p=null,r.l|=4,e.C=r,r.$=s.$=l.shadowRoot||l,C=l["s-sc"],J(s,r,n)})(e,t,l)}catch(t){o(t,e.$hostElement$)}return null},oe=e=>{const t=e.$hostElement$,n=e.t,l=e.j;64&e.l||(e.l|=64,ie(t),re(n,"componentDidLoad"),e.P(t),l||se()),e.S&&(e.S(),e.S=void 0),512&e.l&&w((()=>Y(e,!1))),e.l&=-517},se=()=>{ie(u.documentElement),w((()=>R(c,"appload",{detail:{namespace:"lottery-banner"}})))},re=(e,t,n)=>{if(e&&e[t])try{return e[t](n)}catch(e){o(e)}},ie=e=>e.classList.add("hydrated"),ce=(e,t,l)=>{var s,r;const i=e.prototype;if(t.L||t.T||e.watchers){e.watchers&&!t.T&&(t.T=e.watchers);const c=Object.entries(null!=(s=t.L)?s:{});if(c.map((([e,[s]])=>{(31&s||2&l&&32&s)&&Object.defineProperty(i,e,{get(){return((e,t)=>n(this).A.get(t))(0,e)},set(l){((e,t,l,s)=>{const r=n(e);if(!r)throw Error(`Couldn't find host element for "${s.v}" as it is unknown to this Stencil runtime. This usually happens when integrating a 3rd party Stencil component with another Stencil component or application. Please reach out to the maintainers of the 3rd party Stencil component or report this on the Stencil Discord server (https://chat.stenciljs.com) or comment on this similar [GitHub issue](https://github.com/ionic-team/stencil/issues/5457).`);const i=r.$hostElement$,c=r.A.get(t),u=r.l,a=r.t;if(l=((e,t)=>null==e||g(e)?e:1&t?e+"":e)(l,s.L[t][0]),(!(8&u)||void 0===c)&&l!==c&&(!Number.isNaN(c)||!Number.isNaN(l))&&(r.A.set(t,l),a)){if(s.T&&128&u){const e=s.T[t];e&&e.map((e=>{try{a[e](l,c,t)}catch(e){o(e,i)}}))}2==(18&u)&&Y(r,!1)}})(this,e,l,t)},configurable:!0,enumerable:!0})})),1&l){const l=new Map;i.attributeChangedCallback=function(e,o,s){a.jmp((()=>{var r;const c=l.get(e);if(this.hasOwnProperty(c))s=this[c],delete this[c];else{if(i.hasOwnProperty(c)&&"number"==typeof this[c]&&this[c]==s)return;if(null==c){const l=n(this),i=null==l?void 0:l.l;if(i&&!(8&i)&&128&i&&s!==o){const n=l.t,i=null==(r=t.T)?void 0:r[e];null==i||i.forEach((t=>{null!=n[t]&&n[t].call(n,s,o,e)}))}return}}this[c]=(null!==s||"boolean"!=typeof this[c])&&s}))},e.observedAttributes=Array.from(new Set([...Object.keys(null!=(r=t.T)?r:{}),...c.filter((([e,t])=>15&t[0])).map((([e,n])=>{var o;const s=n[1]||e;return l.set(s,e),512&n[0]&&(null==(o=t.M)||o.push([e,s])),s}))]))}}return e},ue=e=>{re(e,"disconnectedCallback")},ae=(e,l={})=>{var f;const d=[],m=l.exclude||[],p=c.customElements,y=u.head,$=y.querySelector("meta[charset]"),b=u.createElement("style"),w=[];let v,S=!0;Object.assign(a,l),a.o=new URL(l.resourcesUrl||"./",u.baseURI).href;let g=!1;if(e.map((e=>{e[1].map((l=>{var i;const c={l:l[0],v:l[1],L:l[2],N:l[3]};4&c.l&&(g=!0),c.L=l[2],c.M=[],c.T=null!=(i=l[4])?i:{};const u=c.v,f=class extends HTMLElement{constructor(e){if(super(e),this.hasRegisteredEventListeners=!1,((e,n)=>{const l={l:0,$hostElement$:e,k:n,A:new Map};l.R=new Promise((e=>l.P=e)),e["s-p"]=[],e["s-rc"]=[],t.set(e,l)})(e=this,c),1&c.l)if(e.shadowRoot){if("open"!==e.shadowRoot.mode)throw Error(`Unable to re-use existing shadow root for ${c.v}! Mode is set to ${e.shadowRoot.mode} but Stencil only supports open shadow roots.`)}else e.attachShadow({mode:"open"})}connectedCallback(){this.hasRegisteredEventListeners||(this.hasRegisteredEventListeners=!0),v&&(clearTimeout(v),v=null),S?w.push(this):a.jmp((()=>(e=>{if(!(1&a.l)){const t=n(e),l=t.k,i=()=>{};if(1&t.l)(null==t?void 0:t.t)||(null==t?void 0:t.R)&&t.R.then((()=>{}));else{t.l|=1;{let n=e;for(;n=n.parentNode||n.host;)if(n["s-p"]){X(t,t.j=n);break}}l.L&&Object.entries(l.L).map((([t,[n]])=>{if(31&n&&e.hasOwnProperty(t)){const n=e[t];delete e[t],e[t]=n}})),(async(e,t,n)=>{let l;if(!(32&t.l)){if(t.l|=32,n.U){const e=(e=>{const t=e.v.replace(/-/g,"_"),n=e.U;if(!n)return;const l=s.get(n);return l?l[t]:import(`./${n}.entry.js`).then((e=>(s.set(n,e),e[t])),o)
2
+ /*!__STENCIL_STATIC_IMPORT_SWITCH__*/})(n);if(e&&"then"in e){const t=()=>{};l=await e,t()}else l=e;if(!l)throw Error(`Constructor for "${n.v}#${t.W}" was not found`);l.isProxied||(n.T=l.watchers,ce(l,n,2),l.isProxied=!0);const r=()=>{};t.l|=8;try{new l(t)}catch(e){o(e)}t.l&=-9,t.l|=128,r()}else l=e.constructor,customElements.whenDefined(e.localName).then((()=>t.l|=128));if(l&&l.style){let e;"string"==typeof l.style&&(e=l.style);const t=W(n);if(!r.has(t)){const l=()=>{};((e,t,n)=>{let l=r.get(e);h&&n?(l=l||new CSSStyleSheet,"string"==typeof l?l=t:l.replaceSync(t)):l=t,r.set(e,l)})(t,e,!!(1&n.l)),l()}}}const i=t.j,c=()=>Y(t,!0);i&&i["s-rc"]?i["s-rc"].push(c):c()})(e,t,l)}i()}})(this)))}disconnectedCallback(){a.jmp((()=>(async()=>{if(!(1&a.l)){const e=n(this);(null==e?void 0:e.t)?ue(e.t):(null==e?void 0:e.R)&&e.R.then((()=>ue(e.t)))}})()))}componentOnReady(){return n(this).R}};c.U=e[0],m.includes(u)||p.get(u)||(d.push(u),p.define(u,ce(f,c,1)))}))})),d.length>0&&(g&&(b.textContent+=i),b.textContent+=d.sort()+"{visibility:hidden}.hydrated{visibility:inherit}",b.innerHTML.length)){b.setAttribute("data-styles","");const e=null!=(f=a.O)?f:j(u);null!=e&&b.setAttribute("nonce",e),y.insertBefore(b,$?$.nextSibling:y.firstChild)}S=!1,w.length?w.map((e=>e.connectedCallback())):a.jmp((()=>v=setTimeout(se,30)))},fe=e=>a.O=e;export{ae as b,N as c,L as h,f as p,l as r,fe as s}
@@ -1 +1 @@
1
- export{L as LotteryBanner}from"./lottery-banner-89c08855.js";import"./index-0b45dd81.js";
1
+ export{L as LotteryBanner}from"./lottery-banner-925a2ddf.js";import"./index-58dd14ef.js";
@@ -0,0 +1 @@
1
+ import{r as t,c as n,h as e}from"./index-58dd14ef.js";const r="__WIDGET_GLOBAL_STYLE_CACHE__";function a(t,n){if(t){const e=document.createElement("style");e.innerHTML=n,t.appendChild(e)}}function i(t,n){if(!t||!n)return;const e=new URL(n);fetch(e.href).then((t=>t.text())).then((n=>{const e=document.createElement("style");e.innerHTML=n,t&&t.appendChild(e)})).catch((t=>{console.error("There was an error while trying to load client styling from URL",t)}))}function o(t,n,e,a=!1){if(!window.emMessageBus)return;if(!("adoptedStyleSheets"in Document.prototype)||!a)return e=function(t,n){const e=document.createElement("style");return window.emMessageBus.subscribe(n,(n=>{t&&(e.innerHTML=n,t.appendChild(e))}))}(t,n),e;window[r]||(window[r]={}),e=function(t,n){return window.emMessageBus.subscribe(n,(e=>{if(!t)return;const a=t.getRootNode(),i=window[r];let o=i[n]?.sheet;o?i[n].refCount=i[n].refCount+1:(o=new CSSStyleSheet,o.replaceSync(e),i[n]={sheet:o,refCount:1});const u=a.adoptedStyleSheets||[];u.includes(o)||(a.adoptedStyleSheets=[...u,o])}))}(t,n);const i=e.unsubscribe.bind(e);return e.unsubscribe=()=>{if(window[r][n]){const t=window[r][n];t.refCount>1?t.refCount=t.refCount-1:delete window[r][n]}i()},e}const u=["ro","en","fr","ar","hr"],s={en:{stop:"Stop",at:"at",turnover:"Turnover: ",start:"Sales Start",in:"in"},ro:{stop:"Oprește",at:"la"},fr:{stop:"Arrêtez",at:"à"},ar:{stop:"توقف",at:"في"},hr:{stop:"Stop",at:"u"}},l=(t,n)=>{const e=n;return s[void 0!==e&&u.includes(e)?e:"en"][t]};function d(t){return d="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},d(t)}function c(t){if(null===t||!0===t||!1===t)return NaN;var n=Number(t);return isNaN(n)?n:n<0?Math.ceil(n):Math.floor(n)}function f(t,n){if(n.length<t)throw new TypeError(t+" argument"+(t>1?"s":"")+" required, but only "+n.length+" present")}function h(t){f(1,arguments);var n=Object.prototype.toString.call(t);return t instanceof Date||"object"===d(t)&&"[object Date]"===n?new Date(t.getTime()):"number"==typeof t||"[object Number]"===n?new Date(t):("string"!=typeof t&&"[object String]"!==n||"undefined"==typeof console||(console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#string-arguments"),console.warn((new Error).stack)),new Date(NaN))}var m={};function v(){return m}function w(t){f(1,arguments);var n=h(t);return n.setHours(0,0,0,0),n}var b=6e4,g=36e5;var y={ceil:Math.ceil,round:Math.round,floor:Math.floor,trunc:function(t){return t<0?Math.ceil(t):Math.floor(t)}},p="trunc";function M(t){f(1,arguments);var n=h(t),e=n.getUTCDay(),r=(e<1?7:0)+e-1;return n.setUTCDate(n.getUTCDate()-r),n.setUTCHours(0,0,0,0),n}function x(t){f(1,arguments);var n=h(t),e=n.getUTCFullYear(),r=new Date(0);r.setUTCFullYear(e+1,0,4),r.setUTCHours(0,0,0,0);var a=M(r),i=new Date(0);i.setUTCFullYear(e,0,4),i.setUTCHours(0,0,0,0);var o=M(i);return n.getTime()>=a.getTime()?e+1:n.getTime()>=o.getTime()?e:e-1}function S(t,n){var e,r,a,i,o,u,s,l;f(1,arguments);var d=v(),m=c(null!==(e=null!==(r=null!==(a=null!==(i=null==n?void 0:n.weekStartsOn)&&void 0!==i?i:null==n||null===(o=n.locale)||void 0===o||null===(u=o.options)||void 0===u?void 0:u.weekStartsOn)&&void 0!==a?a:d.weekStartsOn)&&void 0!==r?r:null===(s=d.locale)||void 0===s||null===(l=s.options)||void 0===l?void 0:l.weekStartsOn)&&void 0!==e?e:0);if(!(m>=0&&m<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var w=h(t),b=w.getUTCDay(),g=(b<m?7:0)+b-m;return w.setUTCDate(w.getUTCDate()-g),w.setUTCHours(0,0,0,0),w}function _(t,n){var e,r,a,i,o,u,s,l;f(1,arguments);var d=h(t),m=d.getUTCFullYear(),w=v(),b=c(null!==(e=null!==(r=null!==(a=null!==(i=null==n?void 0:n.firstWeekContainsDate)&&void 0!==i?i:null==n||null===(o=n.locale)||void 0===o||null===(u=o.options)||void 0===u?void 0:u.firstWeekContainsDate)&&void 0!==a?a:w.firstWeekContainsDate)&&void 0!==r?r:null===(s=w.locale)||void 0===s||null===(l=s.options)||void 0===l?void 0:l.firstWeekContainsDate)&&void 0!==e?e:1);if(!(b>=1&&b<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var g=new Date(0);g.setUTCFullYear(m+1,0,b),g.setUTCHours(0,0,0,0);var y=S(g,n),p=new Date(0);p.setUTCFullYear(m,0,b),p.setUTCHours(0,0,0,0);var M=S(p,n);return d.getTime()>=y.getTime()?m+1:d.getTime()>=M.getTime()?m:m-1}function D(t,n){for(var e=t<0?"-":"",r=Math.abs(t).toString();r.length<n;)r="0"+r;return e+r}const N=function(t,n){var e=t.getUTCFullYear(),r=e>0?e:1-e;return D("yy"===n?r%100:r,n.length)},E=function(t,n){var e=t.getUTCMonth();return"M"===n?String(e+1):D(e+1,2)},P=function(t,n){return D(t.getUTCDate(),n.length)},k=function(t,n){return D(t.getUTCHours()%12||12,n.length)},T=function(t,n){return D(t.getUTCHours(),n.length)},W=function(t,n){return D(t.getUTCMinutes(),n.length)},j=function(t,n){return D(t.getUTCSeconds(),n.length)},Y=function(t,n){var e=n.length,r=t.getUTCMilliseconds();return D(Math.floor(r*Math.pow(10,e-3)),n.length)};var C={G:function(t,n,e){var r=t.getUTCFullYear()>0?1:0;switch(n){case"G":case"GG":case"GGG":return e.era(r,{width:"abbreviated"});case"GGGGG":return e.era(r,{width:"narrow"});default:return e.era(r,{width:"wide"})}},y:function(t,n,e){if("yo"===n){var r=t.getUTCFullYear();return e.ordinalNumber(r>0?r:1-r,{unit:"year"})}return N(t,n)},Y:function(t,n,e,r){var a=_(t,r),i=a>0?a:1-a;return"YY"===n?D(i%100,2):"Yo"===n?e.ordinalNumber(i,{unit:"year"}):D(i,n.length)},R:function(t,n){return D(x(t),n.length)},u:function(t,n){return D(t.getUTCFullYear(),n.length)},Q:function(t,n,e){var r=Math.ceil((t.getUTCMonth()+1)/3);switch(n){case"Q":return String(r);case"QQ":return D(r,2);case"Qo":return e.ordinalNumber(r,{unit:"quarter"});case"QQQ":return e.quarter(r,{width:"abbreviated",context:"formatting"});case"QQQQQ":return e.quarter(r,{width:"narrow",context:"formatting"});default:return e.quarter(r,{width:"wide",context:"formatting"})}},q:function(t,n,e){var r=Math.ceil((t.getUTCMonth()+1)/3);switch(n){case"q":return String(r);case"qq":return D(r,2);case"qo":return e.ordinalNumber(r,{unit:"quarter"});case"qqq":return e.quarter(r,{width:"abbreviated",context:"standalone"});case"qqqqq":return e.quarter(r,{width:"narrow",context:"standalone"});default:return e.quarter(r,{width:"wide",context:"standalone"})}},M:function(t,n,e){var r=t.getUTCMonth();switch(n){case"M":case"MM":return E(t,n);case"Mo":return e.ordinalNumber(r+1,{unit:"month"});case"MMM":return e.month(r,{width:"abbreviated",context:"formatting"});case"MMMMM":return e.month(r,{width:"narrow",context:"formatting"});default:return e.month(r,{width:"wide",context:"formatting"})}},L:function(t,n,e){var r=t.getUTCMonth();switch(n){case"L":return String(r+1);case"LL":return D(r+1,2);case"Lo":return e.ordinalNumber(r+1,{unit:"month"});case"LLL":return e.month(r,{width:"abbreviated",context:"standalone"});case"LLLLL":return e.month(r,{width:"narrow",context:"standalone"});default:return e.month(r,{width:"wide",context:"standalone"})}},w:function(t,n,e,r){var a=function(t,n){f(1,arguments);var e=h(t),r=S(e,n).getTime()-function(t,n){var e,r,a,i,o,u,s,l;f(1,arguments);var d=v(),h=c(null!==(e=null!==(r=null!==(a=null!==(i=null==n?void 0:n.firstWeekContainsDate)&&void 0!==i?i:null==n||null===(o=n.locale)||void 0===o||null===(u=o.options)||void 0===u?void 0:u.firstWeekContainsDate)&&void 0!==a?a:d.firstWeekContainsDate)&&void 0!==r?r:null===(s=d.locale)||void 0===s||null===(l=s.options)||void 0===l?void 0:l.firstWeekContainsDate)&&void 0!==e?e:1),m=_(t,n),w=new Date(0);return w.setUTCFullYear(m,0,h),w.setUTCHours(0,0,0,0),S(w,n)}(e,n).getTime();return Math.round(r/6048e5)+1}(t,r);return"wo"===n?e.ordinalNumber(a,{unit:"week"}):D(a,n.length)},I:function(t,n,e){var r=function(t){f(1,arguments);var n=h(t),e=M(n).getTime()-function(t){f(1,arguments);var n=x(t),e=new Date(0);return e.setUTCFullYear(n,0,4),e.setUTCHours(0,0,0,0),M(e)}(n).getTime();return Math.round(e/6048e5)+1}(t);return"Io"===n?e.ordinalNumber(r,{unit:"week"}):D(r,n.length)},d:function(t,n,e){return"do"===n?e.ordinalNumber(t.getUTCDate(),{unit:"date"}):P(t,n)},D:function(t,n,e){var r=function(t){f(1,arguments);var n=h(t),e=n.getTime();n.setUTCMonth(0,1),n.setUTCHours(0,0,0,0);var r=n.getTime();return Math.floor((e-r)/864e5)+1}(t);return"Do"===n?e.ordinalNumber(r,{unit:"dayOfYear"}):D(r,n.length)},E:function(t,n,e){var r=t.getUTCDay();switch(n){case"E":case"EE":case"EEE":return e.day(r,{width:"abbreviated",context:"formatting"});case"EEEEE":return e.day(r,{width:"narrow",context:"formatting"});case"EEEEEE":return e.day(r,{width:"short",context:"formatting"});default:return e.day(r,{width:"wide",context:"formatting"})}},e:function(t,n,e,r){var a=t.getUTCDay(),i=(a-r.weekStartsOn+8)%7||7;switch(n){case"e":return String(i);case"ee":return D(i,2);case"eo":return e.ordinalNumber(i,{unit:"day"});case"eee":return e.day(a,{width:"abbreviated",context:"formatting"});case"eeeee":return e.day(a,{width:"narrow",context:"formatting"});case"eeeeee":return e.day(a,{width:"short",context:"formatting"});default:return e.day(a,{width:"wide",context:"formatting"})}},c:function(t,n,e,r){var a=t.getUTCDay(),i=(a-r.weekStartsOn+8)%7||7;switch(n){case"c":return String(i);case"cc":return D(i,n.length);case"co":return e.ordinalNumber(i,{unit:"day"});case"ccc":return e.day(a,{width:"abbreviated",context:"standalone"});case"ccccc":return e.day(a,{width:"narrow",context:"standalone"});case"cccccc":return e.day(a,{width:"short",context:"standalone"});default:return e.day(a,{width:"wide",context:"standalone"})}},i:function(t,n,e){var r=t.getUTCDay(),a=0===r?7:r;switch(n){case"i":return String(a);case"ii":return D(a,n.length);case"io":return e.ordinalNumber(a,{unit:"day"});case"iii":return e.day(r,{width:"abbreviated",context:"formatting"});case"iiiii":return e.day(r,{width:"narrow",context:"formatting"});case"iiiiii":return e.day(r,{width:"short",context:"formatting"});default:return e.day(r,{width:"wide",context:"formatting"})}},a:function(t,n,e){var r=t.getUTCHours()/12>=1?"pm":"am";switch(n){case"a":case"aa":return e.dayPeriod(r,{width:"abbreviated",context:"formatting"});case"aaa":return e.dayPeriod(r,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return e.dayPeriod(r,{width:"narrow",context:"formatting"});default:return e.dayPeriod(r,{width:"wide",context:"formatting"})}},b:function(t,n,e){var r,a=t.getUTCHours();switch(r=12===a?"noon":0===a?"midnight":a/12>=1?"pm":"am",n){case"b":case"bb":return e.dayPeriod(r,{width:"abbreviated",context:"formatting"});case"bbb":return e.dayPeriod(r,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return e.dayPeriod(r,{width:"narrow",context:"formatting"});default:return e.dayPeriod(r,{width:"wide",context:"formatting"})}},B:function(t,n,e){var r,a=t.getUTCHours();switch(r=a>=17?"evening":a>=12?"afternoon":a>=4?"morning":"night",n){case"B":case"BB":case"BBB":return e.dayPeriod(r,{width:"abbreviated",context:"formatting"});case"BBBBB":return e.dayPeriod(r,{width:"narrow",context:"formatting"});default:return e.dayPeriod(r,{width:"wide",context:"formatting"})}},h:function(t,n,e){if("ho"===n){var r=t.getUTCHours()%12;return 0===r&&(r=12),e.ordinalNumber(r,{unit:"hour"})}return k(t,n)},H:function(t,n,e){return"Ho"===n?e.ordinalNumber(t.getUTCHours(),{unit:"hour"}):T(t,n)},K:function(t,n,e){var r=t.getUTCHours()%12;return"Ko"===n?e.ordinalNumber(r,{unit:"hour"}):D(r,n.length)},k:function(t,n,e){var r=t.getUTCHours();return 0===r&&(r=24),"ko"===n?e.ordinalNumber(r,{unit:"hour"}):D(r,n.length)},m:function(t,n,e){return"mo"===n?e.ordinalNumber(t.getUTCMinutes(),{unit:"minute"}):W(t,n)},s:function(t,n,e){return"so"===n?e.ordinalNumber(t.getUTCSeconds(),{unit:"second"}):j(t,n)},S:function(t,n){return Y(t,n)},X:function(t,n,e,r){var a=(r._originalDate||t).getTimezoneOffset();if(0===a)return"Z";switch(n){case"X":return L(a);case"XXXX":case"XX":return z(a);default:return z(a,":")}},x:function(t,n,e,r){var a=(r._originalDate||t).getTimezoneOffset();switch(n){case"x":return L(a);case"xxxx":case"xx":return z(a);default:return z(a,":")}},O:function(t,n,e,r){var a=(r._originalDate||t).getTimezoneOffset();switch(n){case"O":case"OO":case"OOO":return"GMT"+q(a,":");default:return"GMT"+z(a,":")}},z:function(t,n,e,r){var a=(r._originalDate||t).getTimezoneOffset();switch(n){case"z":case"zz":case"zzz":return"GMT"+q(a,":");default:return"GMT"+z(a,":")}},t:function(t,n,e,r){return D(Math.floor((r._originalDate||t).getTime()/1e3),n.length)},T:function(t,n,e,r){return D((r._originalDate||t).getTime(),n.length)}};function q(t,n){var e=t>0?"-":"+",r=Math.abs(t),a=Math.floor(r/60),i=r%60;if(0===i)return e+String(a);var o=n||"";return e+String(a)+o+D(i,2)}function L(t,n){return t%60==0?(t>0?"-":"+")+D(Math.abs(t)/60,2):z(t,n)}function z(t,n){var e=n||"",r=t>0?"-":"+",a=Math.abs(t);return r+D(Math.floor(a/60),2)+e+D(a%60,2)}const O=C;var R=function(t,n){switch(t){case"P":return n.date({width:"short"});case"PP":return n.date({width:"medium"});case"PPP":return n.date({width:"long"});default:return n.date({width:"full"})}},G=function(t,n){switch(t){case"p":return n.time({width:"short"});case"pp":return n.time({width:"medium"});case"ppp":return n.time({width:"long"});default:return n.time({width:"full"})}},$={p:G,P:function(t,n){var e,r=t.match(/(P+)(p+)?/)||[],a=r[1],i=r[2];if(!i)return R(t,n);switch(a){case"P":e=n.dateTime({width:"short"});break;case"PP":e=n.dateTime({width:"medium"});break;case"PPP":e=n.dateTime({width:"long"});break;default:e=n.dateTime({width:"full"})}return e.replace("{{date}}",R(a,n)).replace("{{time}}",G(i,n))}};const I=$;var Q=["D","DD"],A=["YY","YYYY"];function B(t,n,e){if("YYYY"===t)throw new RangeError("Use `yyyy` instead of `YYYY` (in `".concat(n,"`) for formatting years to the input `").concat(e,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if("YY"===t)throw new RangeError("Use `yy` instead of `YY` (in `".concat(n,"`) for formatting years to the input `").concat(e,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if("D"===t)throw new RangeError("Use `d` instead of `D` (in `".concat(n,"`) for formatting days of the month to the input `").concat(e,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if("DD"===t)throw new RangeError("Use `dd` instead of `DD` (in `".concat(n,"`) for formatting days of the month to the input `").concat(e,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"))}var H={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}};function X(t){return function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=n.width?String(n.width):t.defaultWidth;return t.formats[e]||t.formats[t.defaultWidth]}}var F,U={date:X({formats:{full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},defaultWidth:"full"}),time:X({formats:{full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},defaultWidth:"full"}),dateTime:X({formats:{full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},defaultWidth:"full"})},J={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"};function Z(t){return function(n,e){var r;if("formatting"===(null!=e&&e.context?String(e.context):"standalone")&&t.formattingValues){var a=t.defaultFormattingWidth||t.defaultWidth,i=null!=e&&e.width?String(e.width):a;r=t.formattingValues[i]||t.formattingValues[a]}else{var o=t.defaultWidth,u=null!=e&&e.width?String(e.width):t.defaultWidth;r=t.values[u]||t.values[o]}return r[t.argumentCallback?t.argumentCallback(n):n]}}function K(t){return function(n){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=e.width,a=n.match(r&&t.matchPatterns[r]||t.matchPatterns[t.defaultMatchWidth]);if(!a)return null;var i,o=a[0],u=r&&t.parsePatterns[r]||t.parsePatterns[t.defaultParseWidth],s=Array.isArray(u)?function(t){for(var n=0;n<t.length;n++)if(t[n].test(o))return n}(u):function(t){for(var n in t)if(t.hasOwnProperty(n)&&t[n].test(o))return n}(u);return i=t.valueCallback?t.valueCallback(s):s,{value:i=e.valueCallback?e.valueCallback(i):i,rest:n.slice(o.length)}}}const V={code:"en-US",formatDistance:function(t,n,e){var r,a=H[t];return r="string"==typeof a?a:1===n?a.one:a.other.replace("{{count}}",n.toString()),null!=e&&e.addSuffix?e.comparison&&e.comparison>0?"in "+r:r+" ago":r},formatLong:U,formatRelative:function(t){return J[t]},localize:{ordinalNumber:function(t){var n=Number(t),e=n%100;if(e>20||e<10)switch(e%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},era:Z({values:{narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},defaultWidth:"wide"}),quarter:Z({values:{narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},defaultWidth:"wide",argumentCallback:function(t){return t-1}}),month:Z({values:{narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},defaultWidth:"wide"}),day:Z({values:{narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},defaultWidth:"wide"}),dayPeriod:Z({values:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},defaultWidth:"wide",formattingValues:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},defaultFormattingWidth:"wide"})},match:{ordinalNumber:(F={matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:function(t){return parseInt(t,10)}},function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},e=t.match(F.matchPattern);if(!e)return null;var r=e[0],a=t.match(F.parsePattern);if(!a)return null;var i=F.valueCallback?F.valueCallback(a[0]):a[0];return{value:i=n.valueCallback?n.valueCallback(i):i,rest:t.slice(r.length)}}),era:K({matchPatterns:{narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},defaultMatchWidth:"wide",parsePatterns:{any:[/^b/i,/^(a|c)/i]},defaultParseWidth:"any"}),quarter:K({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},defaultMatchWidth:"wide",parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:"any",valueCallback:function(t){return t+1}}),month:K({matchPatterns:{narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},defaultParseWidth:"any"}),day:K({matchPatterns:{narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},defaultParseWidth:"any"}),dayPeriod:K({matchPatterns:{narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},defaultMatchWidth:"any",parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},defaultParseWidth:"any"})},options:{weekStartsOn:0,firstWeekContainsDate:1}};var tt=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,nt=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,et=/^'([^]*?)'?$/,rt=/''/g,at=/[a-zA-Z]/;function it(t,n,e){var r,a,i,o,u,s,l,m,w,b,g,y,p,M,x,S,_,D;f(2,arguments);var N=String(n),E=v(),P=null!==(r=null!==(a=null==e?void 0:e.locale)&&void 0!==a?a:E.locale)&&void 0!==r?r:V,k=c(null!==(i=null!==(o=null!==(u=null!==(s=null==e?void 0:e.firstWeekContainsDate)&&void 0!==s?s:null==e||null===(l=e.locale)||void 0===l||null===(m=l.options)||void 0===m?void 0:m.firstWeekContainsDate)&&void 0!==u?u:E.firstWeekContainsDate)&&void 0!==o?o:null===(w=E.locale)||void 0===w||null===(b=w.options)||void 0===b?void 0:b.firstWeekContainsDate)&&void 0!==i?i:1);if(!(k>=1&&k<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var T=c(null!==(g=null!==(y=null!==(p=null!==(M=null==e?void 0:e.weekStartsOn)&&void 0!==M?M:null==e||null===(x=e.locale)||void 0===x||null===(S=x.options)||void 0===S?void 0:S.weekStartsOn)&&void 0!==p?p:E.weekStartsOn)&&void 0!==y?y:null===(_=E.locale)||void 0===_||null===(D=_.options)||void 0===D?void 0:D.weekStartsOn)&&void 0!==g?g:0);if(!(T>=0&&T<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");if(!P.localize)throw new RangeError("locale must contain localize property");if(!P.formatLong)throw new RangeError("locale must contain formatLong property");var W=h(t);if(!function(t){if(f(1,arguments),!function(t){return f(1,arguments),t instanceof Date||"object"===d(t)&&"[object Date]"===Object.prototype.toString.call(t)}(t)&&"number"!=typeof t)return!1;var n=h(t);return!isNaN(Number(n))}(W))throw new RangeError("Invalid time value");var j=function(t){var n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return n.setUTCFullYear(t.getFullYear()),t.getTime()-n.getTime()}(W),Y=function(t,n){return f(2,arguments),function(t,n){f(2,arguments);var e=h(t).getTime(),r=c(n);return new Date(e+r)}(t,-c(n))}(W,j),C={firstWeekContainsDate:k,weekStartsOn:T,locale:P,_originalDate:W};return N.match(nt).map((function(t){var n=t[0];return"p"===n||"P"===n?(0,I[n])(t,P.formatLong):t})).join("").match(tt).map((function(r){if("''"===r)return"'";var a,i,o=r[0];if("'"===o)return(i=(a=r).match(et))?i[1].replace(rt,"'"):a;var u=O[o];if(u)return null!=e&&e.useAdditionalWeekYearTokens||-1===A.indexOf(r)||B(r,n,String(t)),null!=e&&e.useAdditionalDayOfYearTokens||!(-1!==Q.indexOf(r))||B(r,n,String(t)),u(Y,r,P.localize,C);if(o.match(at))throw new RangeError("Format string contains an unescaped latin alphabet character `"+o+"`");return r})).join("")}function ot(t,n){var e;f(1,arguments);var r=c(null!==(e=null==n?void 0:n.additionalDigits)&&void 0!==e?e:2);if(2!==r&&1!==r&&0!==r)throw new RangeError("additionalDigits must be 0, 1 or 2");if("string"!=typeof t&&"[object String]"!==Object.prototype.toString.call(t))return new Date(NaN);var a,i=function(t){var n,e={},r=t.split(ut.dateTimeDelimiter);if(r.length>2)return e;if(/:/.test(r[0])?n=r[0]:(e.date=r[0],n=r[1],ut.timeZoneDelimiter.test(e.date)&&(e.date=t.split(ut.timeZoneDelimiter)[0],n=t.substr(e.date.length,t.length))),n){var a=ut.timezone.exec(n);a?(e.time=n.replace(a[1],""),e.timezone=a[1]):e.time=n}return e}(t);if(i.date){var o=function(t,n){var e=new RegExp("^(?:(\\d{4}|[+-]\\d{"+(4+n)+"})|(\\d{2}|[+-]\\d{"+(2+n)+"})$)"),r=t.match(e);if(!r)return{year:NaN,restDateString:""};var a=r[1]?parseInt(r[1]):null,i=r[2]?parseInt(r[2]):null;return{year:null===i?a:100*i,restDateString:t.slice((r[1]||r[2]).length)}}(i.date,r);a=function(t,n){if(null===n)return new Date(NaN);var e=t.match(st);if(!e)return new Date(NaN);var r=!!e[4],a=ct(e[1]),i=ct(e[2])-1,o=ct(e[3]),u=ct(e[4]),s=ct(e[5])-1;if(r)return function(t,n,e){return n>=1&&n<=53&&e>=0&&e<=6}(0,u,s)?function(t,n,e){var r=new Date(0);r.setUTCFullYear(t,0,4);var a=7*(n-1)+e+1-(r.getUTCDay()||7);return r.setUTCDate(r.getUTCDate()+a),r}(n,u,s):new Date(NaN);var l=new Date(0);return function(t,n,e){return n>=0&&n<=11&&e>=1&&e<=(ht[n]||(mt(t)?29:28))}(n,i,o)&&function(t,n){return n>=1&&n<=(mt(t)?366:365)}(n,a)?(l.setUTCFullYear(n,i,Math.max(a,o)),l):new Date(NaN)}(o.restDateString,o.year)}if(!a||isNaN(a.getTime()))return new Date(NaN);var u,s=a.getTime(),l=0;if(i.time&&(l=function(t){var n=t.match(lt);if(!n)return NaN;var e=ft(n[1]),r=ft(n[2]),a=ft(n[3]);return function(t,n,e){return 24===t?0===n&&0===e:e>=0&&e<60&&n>=0&&n<60&&t>=0&&t<25}(e,r,a)?e*g+r*b+1e3*a:NaN}(i.time),isNaN(l)))return new Date(NaN);if(!i.timezone){var d=new Date(s+l),h=new Date(0);return h.setFullYear(d.getUTCFullYear(),d.getUTCMonth(),d.getUTCDate()),h.setHours(d.getUTCHours(),d.getUTCMinutes(),d.getUTCSeconds(),d.getUTCMilliseconds()),h}return u=function(t){if("Z"===t)return 0;var n=t.match(dt);if(!n)return 0;var e="+"===n[1]?-1:1,r=parseInt(n[2]),a=n[3]&&parseInt(n[3])||0;return function(t,n){return n>=0&&n<=59}(0,a)?e*(r*g+a*b):NaN}(i.timezone),isNaN(u)?new Date(NaN):new Date(s+l+u)}var ut={dateTimeDelimiter:/[T ]/,timeZoneDelimiter:/[Z ]/i,timezone:/([Z+-].*)$/},st=/^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/,lt=/^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/,dt=/^([+-])(\d{2})(?::?(\d{2}))?$/;function ct(t){return t?parseInt(t):1}function ft(t){return t&&parseFloat(t.replace(",","."))||0}var ht=[31,null,31,30,31,30,31,31,30,31,30,31];function mt(t){return t%400==0||t%4==0&&t%100!=0}const vt=({date:t,type:n="date",format:e})=>{try{const r=ot(t);if(isNaN(r.getTime()))throw new Error(`Invalid date: ${t}`);if(e)return it(r,e);let a="dd/MM/yyyy";return"time"===n?a="dd/MM/yyyy HH:mm:ss":"week"===n&&(a="ccc dd/MM/yyyy HH:mm:ss"),it(r,a)}catch(t){return console.error("Error formatting date:",t.message),""}};function wt(t){if(t)return function(t){return f(1,arguments),function(t,n){f(2,arguments);var e=w(t),r=w(n);return e.getTime()===r.getTime()}(t,Date.now())}(new Date(t))?vt({date:t,format:"HH:mm"}):vt({date:t,format:"dd/MM/yyyy HH:mm"})}function bt(t,n){if(!t)return;let e=function(t,n,e){f(2,arguments);var r,a=function(t,n){return f(2,arguments),h(t).getTime()-h(n).getTime()}(t,n)/1e3;return((r=null==e?void 0:e.roundingMethod)?y[r]:y[p])(a)}("string"==typeof t?ot(t):t,n&&new Date);if(e<0)return"0D 00H 00M 00S";const r=Math.floor(e/86400);e%=86400;const a=Math.floor(e/3600);e%=3600;const i=Math.floor(e/60),o=e%60;return`${r}D ${a.toString().padStart(2,"0")}H ${i.toString().padStart(2,"0")}M ${o.toString().padStart(2,"0")}S`}const gt=class{constructor(e){t(this,e),this.lotteryBannerTimerStop=n(this,"lotteryBannerTimerStop",7),this.mbSource=void 0,this.clientStyling=void 0,this.clientStylingUrl=void 0,this.translationUrl="",this.language="en",this.logoUrl=void 0,this.stopTime="",this.startTime="",this.bannerTitle=void 0,this.turnover=void 0,this.layout="logo,title,info",this.formattedTime=void 0}handleClientStylingChange(t,n){t!==n&&a(this.stylingContainer,this.clientStyling)}handleClientStylingUrlChange(t,n){t!==n&&i(this.stylingContainer,this.clientStylingUrl)}handleMbSourceChange(t,n){t!==n&&o(this.stylingContainer,`${this.mbSource}.Style`,this.stylingSubscription)}handleTimeChange(){this.startTimer()}async componentWillLoad(){this.translationUrl&&(async t=>{if(t)try{const e=await fetch(t);if(!e.ok)throw new Error(`HTTP error! status: ${e.status}`);const r=await e.json();n=r,Object.keys(n).forEach((t=>{for(let e in n[t])s[t][e]=n[t][e]}))}catch(t){console.error("Failed to fetch or parse translations from URL:",t)}var n})(this.translationUrl),this.startTimer()}startTimer(){this.timer&&clearInterval(this.timer),this.updateTime(),this.timer=setInterval((()=>{this.updateTime()}),1e3)}updateTime(){var t;this.formattedTime=function(t,n){const e=new Date;return t&&function(t,n){f(2,arguments);var e=h(t),r=h(n);return e.getTime()<r.getTime()}(e,ot(t))?{start:bt(t,e)}:t&&n&&function(t,n){f(2,arguments);var e=h(t).getTime(),r=h(n.start).getTime(),a=h(n.end).getTime();if(!(r<=a))throw new RangeError("Invalid interval");return e>=r&&e<=a}(e,{start:ot(t),end:ot(n)})?{end:wt(n)}:{}}(this.startTime,this.stopTime),(null===(t=this.formattedTime)||void 0===t?void 0:t.end)&&(this.timer&&clearInterval(this.timer),this.lotteryBannerTimerStop.emit())}componentDidLoad(){this.stylingContainer&&(this.mbSource&&o(this.stylingContainer,`${this.mbSource}.Style`,this.stylingSubscription),this.clientStyling&&a(this.stylingContainer,this.clientStyling),this.clientStylingUrl&&i(this.stylingContainer,this.clientStylingUrl))}disconnectedCallback(){this.stylingSubscription&&this.stylingSubscription.unsubscribe(),this.timer&&clearInterval(this.timer)}renderElement(t,n=""){var r,a;switch(t){case"logo":return e("div",{class:`lottery-banner__logo-wrapper ${n}`},this.logoUrl&&e("img",{alt:"logo",src:this.logoUrl,class:"lottery-banner__logo"}));case"title":return this.bannerTitle&&e("div",{class:`lottery-banner__title ${n}`},this.bannerTitle);case"info":return e("div",{class:`lottery-banner__info ${n}`},(null===(r=this.formattedTime)||void 0===r?void 0:r.start)&&e("div",{class:"lottery-banner__info-item"},e("span",{class:"lottery-banner__info-item-label"},e("span",{class:"lottery-banner__info-item-label__strong"},l("start",this.language))," ",l("in",this.language)),e("span",{class:"lottery-banner__info-item-value"},this.formattedTime.start)),(null===(a=this.formattedTime)||void 0===a?void 0:a.end)&&e("div",{class:"lottery-banner__info-item"},e("span",{class:"lottery-banner__info-item-label"},e("span",{class:"lottery-banner__info-item-label__strong"},l("stop",this.language))," ",l("at",this.language)),e("span",{class:"lottery-banner__info-item-value"},this.formattedTime.end)),null!=this.turnover&&e("div",{class:"lottery-banner__info-item"},e("span",{class:"lottery-banner__info-item-label"},l("turnover",this.language)),e("span",{class:"lottery-banner__info-item-value"},this.turnover)));default:return null}}render(){const t=this.layout.split(",").map((t=>t.trim()));return e("section",{key:"058aa04a8104d393f6066fd2738fb33cb6d832a2",ref:t=>this.stylingContainer=t,class:"lottery-banner"},t.map(((n,e)=>this.renderElement(n,3===t.length&&1===e?"lottery-banner__item--center":""))))}static get watchers(){return{clientStyling:["handleClientStylingChange"],clientStylingUrl:["handleClientStylingUrlChange"],mbSource:["handleMbSourceChange"],startTime:["handleTimeChange"],stopTime:["handleTimeChange"]}}};gt.style=":host {\n display: block;\n container-type: inline-size;\n}\n\n.lottery-banner {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: var(--lottery-banner-gap, 0.5rem);\n padding: var(--lottery-banner-padding, 0px 20px);\n background: var(--lottery-banner-background, var(--emw--color-primary, #fed275));\n border-top: var(--lottery-banner-border-width, 2px) var(--lottery-banner-border-style, solid) var(--lottery-banner-border-color, var(--emw--color-primary, #fed275));\n border-bottom: var(--lottery-banner-border-width, 2px) var(--lottery-banner-border-style, solid) var(--lottery-banner-border-color, var(--emw--color-primary, #fed275));\n border-left: var(--lottery-banner-border-left, none);\n border-right: var(--lottery-banner-border-right, none);\n border-radius: var(--lottery-banner-border-radius, 0);\n white-space: nowrap;\n height: var(--lottery-banner-height, 50px);\n position: relative;\n box-sizing: border-box;\n}\n\n.lottery-banner__logo-wrapper {\n display: flex;\n align-items: center;\n justify-content: center;\n height: 100%;\n}\n.lottery-banner__logo-wrapper img {\n height: 100%;\n object-fit: var(--lottery-banner-logo-object-fit, contain);\n}\n\n.lottery-banner__item--center {\n position: absolute;\n left: 50%;\n top: 50%;\n transform: translate(-50%, -50%);\n}\n\n.lottery-banner__title {\n text-align: center;\n font-size: var(--lottery-banner-title-font-size, 1.5rem);\n font-weight: 800;\n font-style: italic;\n letter-spacing: var(--lottery-banner-title-font-letter-spacing, 0.04em);\n color: var(--emw--color-typography, #000);\n}\n\n.lottery-banner__info {\n display: flex;\n align-items: center;\n gap: var(--lottery-banner-info-gap, 0.75rem);\n}\n\n.lottery-banner__info-item {\n font-size: var(--lottery-banner-info-font-size, 0.9rem);\n color: var(--lottery-banner-info-color, var(--emw--color-typography, #000));\n display: inline-flex;\n align-items: center;\n gap: 0.3rem;\n}\n\n.lottery-banner__info-item-label {\n color: var(--lottery-banner-info-label-color, var(--emw--color-typography, #000));\n}\n.lottery-banner__info-item-label__strong {\n font-weight: var(--lottery-banner-info-label-font-weight, 700);\n}\n\n.lottery-banner__info-item-value {\n font-weight: var(--lottery-banner-info-value-font-weight, inherit);\n color: var(--lottery-banner-info-value-color, var(--emw--color-typography, #000));\n}\n\n@container (max-width: 700px) {\n .lottery-banner {\n height: auto;\n padding: var(--lottery-banner-mobile-padding, 0.5rem 1rem);\n }\n .lottery-banner__title {\n flex-basis: 100%;\n text-align: var(--lottery-banner-mobile-title-text-align, left);\n }\n .lottery-banner__info {\n flex-direction: column;\n align-items: flex-start;\n gap: var(--lottery-banner-mobile-info-gap, 0.1rem);\n }\n}";export{gt as L}
@@ -1 +1 @@
1
- export{L as lottery_banner}from"./lottery-banner-89c08855.js";import"./index-0b45dd81.js";
1
+ export{L as lottery_banner}from"./lottery-banner-925a2ddf.js";import"./index-58dd14ef.js";
@@ -1 +1 @@
1
- import{p as n,b as l}from"./index-0b45dd81.js";export{s as setNonce}from"./index-0b45dd81.js";import{g as t}from"./app-globals-0f993ce5.js";(()=>{const l=import.meta.url,t={};return""!==l&&(t.resourcesUrl=new URL(".",l).href),n(t)})().then((async n=>(await t(),l([["lottery-banner",[[1,"lottery-banner",{mbSource:[513,"mb-source"],clientStyling:[513,"client-styling"],clientStylingUrl:[513,"client-styling-url"],translationUrl:[513,"translation-url"],language:[513],logoUrl:[513,"logo-url"],stopTime:[1,"stop-time"],bannerTitle:[1,"banner-title"],turnover:[1],layout:[1]},null,{clientStyling:["handleClientStylingChange"],clientStylingUrl:["handleClientStylingUrlChange"],mbSource:["handleMbSourceChange"]}]]]],n))));
1
+ import{p as e,b as t}from"./index-58dd14ef.js";export{s as setNonce}from"./index-58dd14ef.js";import{g as n}from"./app-globals-0f993ce5.js";(()=>{const t=import.meta.url,n={};return""!==t&&(n.resourcesUrl=new URL(".",t).href),e(n)})().then((async e=>(await n(),t([["lottery-banner",[[1,"lottery-banner",{mbSource:[513,"mb-source"],clientStyling:[513,"client-styling"],clientStylingUrl:[513,"client-styling-url"],translationUrl:[513,"translation-url"],language:[513],logoUrl:[513,"logo-url"],stopTime:[1,"stop-time"],startTime:[1,"start-time"],bannerTitle:[1,"banner-title"],turnover:[1],layout:[1],formattedTime:[32]},null,{clientStyling:["handleClientStylingChange"],clientStylingUrl:["handleClientStylingUrlChange"],mbSource:["handleMbSourceChange"],startTime:["handleTimeChange"],stopTime:["handleTimeChange"]}]]]],e))));
@@ -1,3 +1,4 @@
1
+ import { EventEmitter } from '../../stencil-public-runtime';
1
2
  export declare class LotteryBanner {
2
3
  /**
3
4
  * Client custom styling via message bus
@@ -31,12 +32,17 @@ export declare class LotteryBanner {
31
32
  * Subscription for the message bus styling stream
32
33
  */
33
34
  private stylingSubscription;
35
+ private timer;
34
36
  /**
35
37
  * Draw stop time
36
38
  */
37
39
  stopTime: string;
38
40
  /**
39
- * Draw title
41
+ * Sales start time
42
+ */
43
+ startTime: string;
44
+ /**
45
+ * Banner title
40
46
  */
41
47
  bannerTitle: string;
42
48
  /**
@@ -49,10 +55,21 @@ export declare class LotteryBanner {
49
55
  * Example: 'logo,title,info' or 'title,logo,info'.
50
56
  */
51
57
  layout: string;
58
+ formattedTime: {
59
+ start?: string;
60
+ end?: string;
61
+ };
62
+ /**
63
+ * Event emitted when the timer stops
64
+ */
65
+ lotteryBannerTimerStop: EventEmitter<void>;
52
66
  handleClientStylingChange(newValue: any, oldValue: any): void;
53
67
  handleClientStylingUrlChange(newValue: any, oldValue: any): void;
54
68
  handleMbSourceChange(newValue: any, oldValue: any): void;
69
+ handleTimeChange(): void;
55
70
  componentWillLoad(): Promise<void>;
71
+ startTimer(): void;
72
+ updateTime(): void;
56
73
  componentDidLoad(): void;
57
74
  disconnectedCallback(): void;
58
75
  renderElement(item: string, className?: string): any;
@@ -8,7 +8,7 @@ import { HTMLStencilElement, JSXBase } from "./stencil-public-runtime";
8
8
  export namespace Components {
9
9
  interface LotteryBanner {
10
10
  /**
11
- * Draw title
11
+ * Banner title
12
12
  */
13
13
  "bannerTitle": string;
14
14
  /**
@@ -35,6 +35,10 @@ export namespace Components {
35
35
  * Client custom styling via message bus
36
36
  */
37
37
  "mbSource": string;
38
+ /**
39
+ * Sales start time
40
+ */
41
+ "startTime": string;
38
42
  /**
39
43
  * Draw stop time
40
44
  */
@@ -49,8 +53,23 @@ export namespace Components {
49
53
  "turnover": string;
50
54
  }
51
55
  }
56
+ export interface LotteryBannerCustomEvent<T> extends CustomEvent<T> {
57
+ detail: T;
58
+ target: HTMLLotteryBannerElement;
59
+ }
52
60
  declare global {
61
+ interface HTMLLotteryBannerElementEventMap {
62
+ "lotteryBannerTimerStop": void;
63
+ }
53
64
  interface HTMLLotteryBannerElement extends Components.LotteryBanner, HTMLStencilElement {
65
+ addEventListener<K extends keyof HTMLLotteryBannerElementEventMap>(type: K, listener: (this: HTMLLotteryBannerElement, ev: LotteryBannerCustomEvent<HTMLLotteryBannerElementEventMap[K]>) => any, options?: boolean | AddEventListenerOptions): void;
66
+ addEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
67
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
68
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
69
+ removeEventListener<K extends keyof HTMLLotteryBannerElementEventMap>(type: K, listener: (this: HTMLLotteryBannerElement, ev: LotteryBannerCustomEvent<HTMLLotteryBannerElementEventMap[K]>) => any, options?: boolean | EventListenerOptions): void;
70
+ removeEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
71
+ removeEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
72
+ removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
54
73
  }
55
74
  var HTMLLotteryBannerElement: {
56
75
  prototype: HTMLLotteryBannerElement;
@@ -63,7 +82,7 @@ declare global {
63
82
  declare namespace LocalJSX {
64
83
  interface LotteryBanner {
65
84
  /**
66
- * Draw title
85
+ * Banner title
67
86
  */
68
87
  "bannerTitle"?: string;
69
88
  /**
@@ -90,6 +109,14 @@ declare namespace LocalJSX {
90
109
  * Client custom styling via message bus
91
110
  */
92
111
  "mbSource"?: string;
112
+ /**
113
+ * Event emitted when the timer stops
114
+ */
115
+ "onLotteryBannerTimerStop"?: (event: LotteryBannerCustomEvent<void>) => void;
116
+ /**
117
+ * Sales start time
118
+ */
119
+ "startTime"?: string;
93
120
  /**
94
121
  * Draw stop time
95
122
  */
@@ -4,3 +4,13 @@ export declare const formatDate: ({ date, type, format }: {
4
4
  type?: 'time' | 'date' | 'week';
5
5
  format?: string;
6
6
  }) => string;
7
+ export declare function getWagerTime(startTime: any, stopTime: any): {
8
+ start: string;
9
+ end?: undefined;
10
+ } | {
11
+ end: string;
12
+ start?: undefined;
13
+ } | {
14
+ start?: undefined;
15
+ end?: undefined;
16
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@everymatrix/lottery-banner",
3
- "version": "0.0.17",
3
+ "version": "0.0.18",
4
4
  "main": "./dist/index.cjs.js",
5
5
  "module": "./dist/index.js",
6
6
  "es2015": "./dist/esm/index.mjs",
@@ -1,252 +0,0 @@
1
- 'use strict';
2
-
3
- const index = require('./index-4511b749.js');
4
-
5
- const StyleCacheKey = '__WIDGET_GLOBAL_STYLE_CACHE__';
6
-
7
- /**
8
- * @name setClientStyling
9
- * @description Method used to create and append to the passed element of the widget a style element with the content received
10
- * @param {HTMLElement} stylingContainer The reference element of the widget
11
- * @param {string} clientStyling The style content
12
- */
13
- function setClientStyling(stylingContainer, clientStyling) {
14
- if (stylingContainer) {
15
- const sheet = document.createElement('style');
16
- sheet.innerHTML = clientStyling;
17
- stylingContainer.appendChild(sheet);
18
- }
19
- }
20
-
21
- /**
22
- * @name setClientStylingURL
23
- * @description Method used to create and append to the passed element of the widget a style element with the content fetched from a given URL
24
- * @param {HTMLElement} stylingContainer The reference element of the widget
25
- * @param {string} clientStylingUrl The URL of the style content
26
- */
27
- function setClientStylingURL(stylingContainer, clientStylingUrl) {
28
- if (!stylingContainer || !clientStylingUrl) return;
29
-
30
- const url = new URL(clientStylingUrl);
31
-
32
- fetch(url.href)
33
- .then((res) => res.text())
34
- .then((data) => {
35
- const cssFile = document.createElement('style');
36
- cssFile.innerHTML = data;
37
- if (stylingContainer) {
38
- stylingContainer.appendChild(cssFile);
39
- }
40
- })
41
- .catch((err) => {
42
- console.error('There was an error while trying to load client styling from URL', err);
43
- });
44
- }
45
-
46
- /**
47
- * @name setStreamLibrary
48
- * @description Method used to create and append to the passed element of the widget a style element with content fetched from the MessageBus
49
- * @param {HTMLElement} stylingContainer The highest element of the widget
50
- * @param {string} domain The domain from where the content should be fetched (e.g. 'Casino.Style', 'App.Style', 'casino-footer.style', etc.)
51
- * @param {ref} subscription A reference to a variable where the subscription should be saved for unsubscribing when no longer needed
52
- * @param {boolean} useAdoptedStyleSheets A flag to gradually enable testing of adoptedStyleSheets
53
- */
54
- function setStreamStyling(stylingContainer, domain, subscription, useAdoptedStyleSheets = false) {
55
- if (!window.emMessageBus) return;
56
-
57
- const supportAdoptStyle = 'adoptedStyleSheets' in Document.prototype;
58
-
59
- if (!supportAdoptStyle || !useAdoptedStyleSheets) {
60
- subscription = getStyleTagSubscription(stylingContainer, domain);
61
-
62
- return subscription;
63
- }
64
-
65
- if (!window[StyleCacheKey]) {
66
- window[StyleCacheKey] = {};
67
- }
68
- subscription = getAdoptStyleSubscription(stylingContainer, domain);
69
-
70
- const originalUnsubscribe = subscription.unsubscribe.bind(subscription);
71
- const wrappedUnsubscribe = () => {
72
- if (window[StyleCacheKey][domain]) {
73
- const cachedObject = window[StyleCacheKey][domain];
74
- cachedObject.refCount > 1
75
- ? (cachedObject.refCount = cachedObject.refCount - 1)
76
- : delete window[StyleCacheKey][domain];
77
- }
78
-
79
- originalUnsubscribe();
80
- };
81
- subscription.unsubscribe = wrappedUnsubscribe;
82
-
83
- return subscription;
84
- }
85
-
86
- function getStyleTagSubscription(stylingContainer, domain) {
87
- const sheet = document.createElement('style');
88
-
89
- return window.emMessageBus.subscribe(domain, (data) => {
90
- if (stylingContainer) {
91
- sheet.innerHTML = data;
92
- stylingContainer.appendChild(sheet);
93
- }
94
- });
95
- }
96
-
97
- function getAdoptStyleSubscription(stylingContainer, domain) {
98
- return window.emMessageBus.subscribe(domain, (data) => {
99
- if (!stylingContainer) return;
100
-
101
- const shadowRoot = stylingContainer.getRootNode();
102
- const cacheStyleObject = window[StyleCacheKey];
103
- let cachedStyle = cacheStyleObject[domain]?.sheet;
104
-
105
- if (!cachedStyle) {
106
- cachedStyle = new CSSStyleSheet();
107
- cachedStyle.replaceSync(data);
108
- cacheStyleObject[domain] = {
109
- sheet: cachedStyle,
110
- refCount: 1
111
- };
112
- } else {
113
- cacheStyleObject[domain].refCount = cacheStyleObject[domain].refCount + 1;
114
- }
115
-
116
- const currentSheets = shadowRoot.adoptedStyleSheets || [];
117
- if (!currentSheets.includes(cachedStyle)) {
118
- shadowRoot.adoptedStyleSheets = [...currentSheets, cachedStyle];
119
- }
120
- });
121
- }
122
-
123
- const DEFAULT_LANGUAGE = 'en';
124
- const SUPPORTED_LANGUAGES = ['ro', 'en', 'fr', 'ar', 'hr'];
125
- const TRANSLATIONS = {
126
- en: {
127
- stopAt: 'Stop at',
128
- turnover: 'Turnover: '
129
- },
130
- ro: {
131
- stop: 'Oprește',
132
- at: 'la'
133
- },
134
- fr: {
135
- stop: 'Arrêtez',
136
- at: 'à'
137
- },
138
- ar: {
139
- stop: 'توقف',
140
- at: 'في'
141
- },
142
- hr: {
143
- stop: 'Stop',
144
- at: 'u'
145
- }
146
- };
147
- const translate = (key, customLang) => {
148
- const lang = customLang;
149
- return TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
150
- };
151
- const getTranslations = (data) => {
152
- Object.keys(data).forEach((item) => {
153
- for (let key in data[item]) {
154
- TRANSLATIONS[item][key] = data[item][key];
155
- }
156
- });
157
- };
158
- const resolveTranslationUrl = async (translationUrl) => {
159
- if (translationUrl) {
160
- try {
161
- const response = await fetch(translationUrl);
162
- if (!response.ok) {
163
- throw new Error(`HTTP error! status: ${response.status}`);
164
- }
165
- const translations = await response.json();
166
- getTranslations(translations);
167
- }
168
- catch (error) {
169
- console.error('Failed to fetch or parse translations from URL:', error);
170
- }
171
- }
172
- };
173
-
174
- const lotteryBannerCss = ":host {\n display: block;\n}\n\n.lottery-banner {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: var(--lottery-banner-gap, 0.5rem);\n padding: var(--lottery-banner-padding, 0px 20px);\n background: var(--lottery-banner-background, var(--emw--color-primary, #fed275));\n border-top: var(--lottery-banner-border-width, 2px) var(--lottery-banner-border-style, solid) var(--lottery-banner-border-color, var(--emw--color-primary, #fed275));\n border-bottom: var(--lottery-banner-border-width, 2px) var(--lottery-banner-border-style, solid) var(--lottery-banner-border-color, var(--emw--color-primary, #fed275));\n border-left: var(--lottery-banner-border-left, none);\n border-right: var(--lottery-banner-border-right, none);\n border-radius: var(--lottery-banner-border-radius, 0);\n white-space: nowrap;\n height: var(--lottery-banner-height, 50px);\n container-type: inline-size;\n position: relative;\n box-sizing: border-box;\n}\n\n.lottery-banner__logo-wrapper {\n display: flex;\n align-items: center;\n justify-content: center;\n height: 100%;\n}\n.lottery-banner__logo-wrapper img {\n height: 100%;\n object-fit: var(--lottery-banner-logo-object-fit, contain);\n}\n\n.lottery-banner__item--center {\n position: absolute;\n left: 50%;\n top: 50%;\n transform: translate(-50%, -50%);\n}\n\n.lottery-banner__title {\n text-align: center;\n font-size: var(--lottery-banner-title-font-size, 1.5rem);\n font-weight: 800;\n font-style: italic;\n color: var(--emw--color-typography, #000);\n}\n\n.lottery-banner__info {\n display: flex;\n align-items: center;\n gap: var(--lottery-banner-info-gap, 0.75rem);\n}\n\n.lottery-banner__info-item {\n font-size: var(--lottery-banner-info-font-size, 0.9rem);\n color: var(--lottery-banner-info-color, var(--emw--color-typography, #000));\n display: inline-flex;\n align-items: center;\n gap: 0.3rem;\n}\n\n.lottery-banner__info-item-label {\n font-weight: var(--lottery-banner-info-label-font-weight, 700);\n color: var(--lottery-banner-info-label-color, var(--emw--color-typography, #000));\n}\n\n.lottery-banner__info-item-value {\n font-weight: var(--lottery-banner-info-value-font-weight, inherit);\n color: var(--lottery-banner-info-value-color, var(--emw--color-typography, #000));\n}\n\n@container (max-width: 700px) {\n .lottery-banner {\n height: auto;\n padding: var(--lottery-banner-mobile-padding, 0.5rem 1rem);\n }\n .lottery-banner__title {\n flex-basis: 100%;\n text-align: var(--lottery-banner-mobile-title-text-align, left);\n }\n .lottery-banner__info {\n flex-wrap: wrap;\n gap: var(--lottery-banner-mobile-info-gap, 0.1rem);\n }\n}";
175
- const LotteryBannerStyle0 = lotteryBannerCss;
176
-
177
- const LotteryBanner = class {
178
- constructor(hostRef) {
179
- index.registerInstance(this, hostRef);
180
- this.mbSource = undefined;
181
- this.clientStyling = undefined;
182
- this.clientStylingUrl = undefined;
183
- this.translationUrl = '';
184
- this.language = 'en';
185
- this.logoUrl = undefined;
186
- this.stopTime = '';
187
- this.bannerTitle = undefined;
188
- this.turnover = undefined;
189
- this.layout = 'logo,title,info';
190
- }
191
- handleClientStylingChange(newValue, oldValue) {
192
- if (newValue !== oldValue) {
193
- setClientStyling(this.stylingContainer, this.clientStyling);
194
- }
195
- }
196
- handleClientStylingUrlChange(newValue, oldValue) {
197
- if (newValue !== oldValue) {
198
- setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
199
- }
200
- }
201
- handleMbSourceChange(newValue, oldValue) {
202
- if (newValue !== oldValue) {
203
- setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
204
- }
205
- }
206
- async componentWillLoad() {
207
- if (this.translationUrl) {
208
- resolveTranslationUrl(this.translationUrl);
209
- }
210
- }
211
- componentDidLoad() {
212
- if (this.stylingContainer) {
213
- if (this.mbSource)
214
- setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
215
- if (this.clientStyling)
216
- setClientStyling(this.stylingContainer, this.clientStyling);
217
- if (this.clientStylingUrl)
218
- setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
219
- }
220
- }
221
- disconnectedCallback() {
222
- this.stylingSubscription && this.stylingSubscription.unsubscribe();
223
- }
224
- renderElement(item, className = '') {
225
- switch (item) {
226
- case 'logo':
227
- return (index.h("div", { class: `lottery-banner__logo-wrapper ${className}` }, this.logoUrl && index.h("img", { alt: "logo", src: this.logoUrl, class: "lottery-banner__logo" })));
228
- case 'title':
229
- return this.bannerTitle && index.h("div", { class: `lottery-banner__title ${className}` }, this.bannerTitle);
230
- case 'info':
231
- return (index.h("div", { class: `lottery-banner__info ${className}` }, this.stopTime && (index.h("div", { class: "lottery-banner__info-item" }, index.h("span", { class: "lottery-banner__info-item-label" }, translate('stopAt', this.language)), index.h("span", { class: "lottery-banner__info-item-value" }, this.stopTime))), (this.turnover !== null && this.turnover !== undefined) && (index.h("div", { class: "lottery-banner__info-item" }, index.h("span", { class: "lottery-banner__info-item-label" }, translate('turnover', this.language)), index.h("span", { class: "lottery-banner__info-item-value" }, this.turnover)))));
232
- default:
233
- return null;
234
- }
235
- }
236
- render() {
237
- const layoutItems = this.layout.split(',').map((item) => item.trim());
238
- return (index.h("section", { key: 'd26c3cb4854c8fea2367df25b6e8cf11b23731e4', ref: (el) => (this.stylingContainer = el), class: "lottery-banner" }, layoutItems.map((item, index) => {
239
- const isMiddle = layoutItems.length === 3 && index === 1;
240
- const className = isMiddle ? 'lottery-banner__item--center' : '';
241
- return this.renderElement(item, className);
242
- })));
243
- }
244
- static get watchers() { return {
245
- "clientStyling": ["handleClientStylingChange"],
246
- "clientStylingUrl": ["handleClientStylingUrlChange"],
247
- "mbSource": ["handleMbSourceChange"]
248
- }; }
249
- };
250
- LotteryBanner.style = LotteryBannerStyle0;
251
-
252
- exports.LotteryBanner = LotteryBanner;