@letscooee/web-sdk 14.0.0 → 14.0.1

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.
@@ -1,4 +1,4 @@
1
- import { k as ke, a as Be$1, z as zr, Y, r, s, R as Rn, L as Ln } from './chunk-CCm99pJA-CLFCz8r4.js';
1
+ import { k as ke, a as Be$1, z as zr, Y, r, s, R as Rn, L as Ln } from './chunk-cN7DAvpe-BbA9dPrS.js';
2
2
  import { G, c as H$1, B as Be, M, e as V, m as mt, f as fe, I as Ir, $ as $r, q as qr, g as yt, h as Gr, i as it, j as qt, k as Vr, o as Hr, A as A$1, S as S$1, p as nt, r as Ve, v as vi, s as f$1, F as Fr, t as He, w as yi } from './main.min.js';
3
3
 
4
4
  var L=class{loadedFonts=[];async loadAllFonts(e){e.elems?.forEach(t=>{t instanceof Ve&&this.loadFamily(t.typography?.fam);});}async loadFamily(e){if(!e?.fonts||this.loadedFonts.indexOf(e.name)>-1)return;let t=[];e.fonts.forEach(n=>{if(n.url){let l=new FontFace(`cooee`+e.name,n.getURL(),n.getFontDescriptor());t.push(l.load());}}),this.loadedFonts.push(e.name),(await Promise.all(t)).forEach(n=>{document.fonts.add(n);});}};var S=class{static updateIdentity(e){if(!this.isInstalled())return;let t={};e.email&&(t.email=e.email),e.mobile&&(t.phone_number=e.mobile),Y.verbose(`Sending email/mobile to Klaviyo`),window.klaviyo.push([`identify`,t]);}static isInstalled(){return window.klaviyo&&typeof window.klaviyo==`object`}};var H=class{action;triggerContext;constructor(e,t){this.action=e,this.triggerContext=t;}async execute(){let e=this.containsCTA()?`CE Trigger Clicked`:`CE Trigger Closed`;switch(this.action.at!==He.SUBMIT_FORM&&await this.closeTriggerAndSendEvent(e),this.action.at){case He.ACCEPT_POPUP:break;case He.GO_TO_URL:this.gotoURLAction();break;case He.SHARE:this.shareAction();break;case He.SUBMIT_FORM:await this.collectFormData();break;case void 0:case He.OPEN_CART:break;default:Y.error(`Received an invalid ClickActionType: `,this.action.at);return}}externalAction(){this.action.ext?.u&&window.open(this.action.ext.u,`_blank`)?.focus();}gotoURLAction(){if(this.action.gu?.u){let e=this.action.gu.u;Rn(e)||(e=`//${e}`),window.open(e,`_self`);}}async closeTriggerAndSendEvent(e,t){this.triggerContext.closeInApp(e,t),await this.dispatchEvent();}shareAction(){if(!this.action.share)return;if(!navigator.share){Y.warn(`Navigator.share is not compatible with this browser`);return}navigator.share({text:this.action.share.text,title:`Share`}).then(t=>console.log(t)).catch(t=>console.error(t));}containsCTA(){return this.action.at&&this.action.at!==He.REJECT_POPUP?true:!(this.isEmpty(this.action.custKV)&&this.isEmpty(this.action.up))}isEmpty(e){return e?Object.keys(e).length===0:true}async collectFormData(){let e={};for(let t of this.triggerContext.inputs){if(!t.isValid)return;let n=document.getElementById(t.id).value;t.type===51?e.email=n:t.type===52&&(e.mobile=n);}await this.closeTriggerAndSendEvent(`CE Form Submitted`,{form:e}),this.action.applyDiscount&&Ln(`Coupon applied on cart`),S.updateIdentity(e);}async dispatchEvent(){let e=this.triggerContext.triggerData,t={clickAction:this.action,items:this.triggerContext.selectedEmbeddedItems??e.embeddedItems??e.items,collections:e.collections,triggerData:e};await new yi().process(t);let r={action:this.containsCTA()?`CLICKED`:`CLOSED`};document.dispatchEvent(new CustomEvent(`letscooee:outbound:popup-activities`,{detail:r}));}};var a=class{renderer=I.get();parentHTMLEl;inappElement;inappHTMLEl;triggerContext;stylesConverter;scalingFactor;constructor(e,t,r){this.parentHTMLEl=e,this.inappElement=t,this.triggerContext=r,this.stylesConverter=new vi(this.renderer.getScalingFactor());}getHTMLElement(){return this.inappHTMLEl}insertElement(){this.parentHTMLEl.appendChild(this.inappHTMLEl);}processCommonBlocks(){this.processWidthAndHeight(),this.processPositionBlock(),this.processTransformBlock(),this.processTransparency(),this.processShadow(),this.registerAction();let e=s(r(r(r(r({},this.getDisplayStyles()),this.getSpaceStyles()),this.getBorderStyles()),this.getBackgroundStyles()),{boxSizing:`border-box`,outline:`none`});S$1(this.inappHTMLEl,e);}getDisplayStyles(){return {display:`block`}}processWidthAndHeight(){this.inappElement.w&&H$1(this.inappHTMLEl,`width`,this.stylesConverter.getSizePx(this.inappElement.w)),this.inappElement.h&&H$1(this.inappHTMLEl,`height`,this.stylesConverter.getSizePx(this.inappElement.h));}processPositionBlock(){let e={position:`absolute`,left:this.stylesConverter.getSizePx(this.inappElement.x),top:this.stylesConverter.getSizePx(this.inappElement.y)};S$1(this.inappHTMLEl,e);}getBorderStyles(){return this.stylesConverter.getBorderStyles(this.inappElement.br)}getSpaceStyles(){return this.stylesConverter.getSpaceStyles(this.inappElement.spc)}processTransparency(){let e=this.inappElement.alpha;if(!isNaN(e)){let t=(e/100).toFixed(2);H$1(this.inappHTMLEl,`opacity`,t);}}processShadow(){let e=this.inappElement.shd;e?H$1(this.inappHTMLEl,`box-shadow`,e.getStyle(this.scalingFactor)):H$1(this.inappHTMLEl,`box-shadow`,`unset`);}processTransformBlock(){let e=new f$1(this.inappElement.trf);e&&e.rotate&&H$1(this.inappHTMLEl,`transform`,`rotate(${e.rotate}deg)`);}registerAction(){let e=this.inappElement.clc;!e||Object.keys(e).length===0||(this.inappHTMLEl.addEventListener(`click`,t=>{t.stopPropagation(),new H(e,this.triggerContext).execute();}),H$1(this.inappHTMLEl,`cursor`,`pointer`));}getBackgroundStyles(){return this.stylesConverter.getBackgroundStyles(this.inappElement.bg)}};var p=class extends a{constructor(e,t,r){super(e,t,r);}processCommonBlocks(){super.processCommonBlocks(),this.processFontBlock(),this.processAlignment();}processFontBlock(){let e={},t=this.inappElement.typography;return t&&(e.fontSize=this.stylesConverter.getSizePx(t.fs),e.fontFamily=`cooee`+t.fam?.name,e.lineHeight=`${t.lh}`,e.letterSpacing=t.letterSpacing),this.stylesConverter.getColourStyles(this.inappElement.color,`color`,e),S$1(this.inappHTMLEl,e),e}processPart(e,t){let r=[];t.u&&r.push(`underline`),t.st&&r.push(`line-through`),r.length||r.push(`normal`),H$1(e,`font-weight`,t.b?`bold`:`normal`),H$1(e,`font-style`,t.i?`italic`:`normal`),H$1(e,`text-decoration`,r.join(` `)),H$1(e,`color`,t.c??`inherit`),H$1(e,`font-family`,`inherit`);}processAlignment(){let e=this.inappElement.typography.ta,t=e?Fr[e]?.toLowerCase():this.inappElement.typography.alignment;t||(t=`start`),H$1(this.inappHTMLEl,`text-align`,t);}};var u=class extends p{constructor(e,t,r){super(e,t,r),this.inappHTMLEl=document.createElement(`div`),this.insertElement();}render(){this.inappElement.parts?.forEach(e=>{let t=document.createElement(`span`);t.innerHTML=e.txt?.toString()?.replace(/\n/g,`<br />`),this.processPart(t,e),this.inappHTMLEl.appendChild(t);}),this.processCommonBlocks();}};var f=class extends a{constructor(e,t,r){super(e,t,r),this.inappHTMLEl=document.createElement(`div`),this.insertElement();}render(){this.processCommonBlocks();}};var E=class extends a{constructor(e,t,r){super(e,t,r),this.inappHTMLEl=document.createElement(`img`),this.insertElement();}render(){this.inappHTMLEl.setAttribute(`src`,this.inappElement.src),H$1(this.inappHTMLEl,`max-width`,`none`),H$1(this.inappHTMLEl,`max-height`,`none`),H$1(this.inappHTMLEl,`margin`,`0 auto`),this.processCommonBlocks();}};var v=class o extends a{constructor(t,r,n){super(t,r,n);this.parent=t;this.inappHTMLEl=document.createElement(`div`);}static MAX_Z_INDEX=`2147483647`;render(){return this.parent||this.renderer.removeInApp(),this.insertElement(),this.processCommonBlocks(),this.inappHTMLEl.classList.add(`cooee-wrapper`),this.inappHTMLEl.classList.add(this.triggerContext.rootClassName),H$1(this.inappHTMLEl,`z-index`,o.MAX_Z_INDEX),this.inappHTMLEl}getBackgroundStyles(){return this.inappElement.cover?super.getBackgroundStyles():{}}processWidthAndHeight(){let t=this.inappElement.cont;if(this.inappElement.cover)this.renderer.isParentNotBody()?(H$1(this.inappHTMLEl,`width`,`100%`),H$1(this.inappHTMLEl,`height`,`100%`)):(H$1(this.inappHTMLEl,`width`,`100vw`),H$1(this.inappHTMLEl,`height`,`100vh`)),H$1(this.inappHTMLEl,`top`,`0`),H$1(this.inappHTMLEl,`left`,`0`);else {let r=this.inappElement.spc,n=this.stylesConverter.getScaledSize(t.w)+r.getHorizontal(),l=this.stylesConverter.getScaledSize(t.h)+r.getVertical();H$1(this.inappHTMLEl,`width`,n+`px`),H$1(this.inappHTMLEl,`height`,l+`px`);}}getSpaceStyles(){return {padding:this.inappElement.spc.getPaddingCSS()}}getDisplayStyles(){return r(r({display:`flex`},this.inappElement.getStylesForWrapper()),this.inappElement.getFlexStylesForContainer())}processPositionBlock(){this.renderer.isParentNotBody()?H$1(this.inappHTMLEl,`position`,`absolute`):H$1(this.inappHTMLEl,`position`,`fixed`);}getBorderStyles(){return {}}processTransparency(){}processTransformBlock(){}processShadow(){}};var se=`cooee-container`,w=class extends a{constructor(e,t,r){super(e,t,r),this.inappHTMLEl=document.createElement(`div`),this.insertElement();}render(){return this.processCommonBlocks(),H$1(this.inappHTMLEl,`position`,`relative`),H$1(this.inappHTMLEl,`overflow`,`hidden`),this.inappHTMLEl.classList.add(se),this}};var A=class o extends p{static DAYS=`Days`;static HOURS=`Hours`;static MINUTES=`Minutes`;static SECONDS=`Seconds`;elements;spans=[];constructor(e,t,r){super(e,t,r),this.inappHTMLEl=document.createElement(`div`),this.insertElement();}render(){this.addTimerChildren(),this.processAndStartTimer(),this.processCommonBlocks();let e=s(r(r(r({flex:`1 1 0`},this.stylesConverter.getBackgroundStyles(this.inappElement.bg)),this.stylesConverter.getBorderStyles(this.inappElement.br)),this.stylesConverter.getSpaceStyles(this.inappElement.spc)),{marginLeft:this.stylesConverter.getSizePx(this.inappElement.gap),marginRight:this.stylesConverter.getSizePx(this.inappElement.gap)});this.addStylesToTimer(e);}getBackgroundStyles(){return {}}processFontBlock(){let e=super.processFontBlock();return this.stylesConverter.getColourStyles(this.inappElement.color,`color`,e),this.addStylesToTimer(e),e}getSpaceStyles(){return {}}getBorderStyles(){return {}}getDisplayStyles(){return {display:`flex`,flexWrap:`nowrap`,justifyContent:`center`}}addStylesToTimer(e){this.elements.forEach(t=>S$1(t,e));}addTimerChildren(){let e=this.inappElement.show;this.elements=[],e.day&&this.elements.push(this.getChild(o.DAYS)),e.hour&&this.elements.push(this.getChild(o.HOURS)),e.minute&&this.elements.push(this.getChild(o.MINUTES)),e.second&&this.elements.push(this.getChild(o.SECONDS)),this.elements.forEach(t=>this.inappHTMLEl.appendChild(t));}getChild(e){let t=document.createElement(`div`),r=document.createElement(`span`),n=document.createElement(`span`);return n.innerText=e,r.innerText=`00`,r.id=`lc-${e}`,H$1(n,`font-size`,`0.5em`),H$1(n,`text-align`,`center`),H$1(n,`font-family`,`inherit`),H$1(r,`text-align`,`center`),H$1(r,`font-family`,`inherit`),this.inappElement.lblPos===`start`?(t.appendChild(n),t.appendChild(r)):(t.appendChild(r),t.appendChild(n)),H$1(t,`display`,`flex`),H$1(t,`flex-direction`,this.inappElement.horizontal?``:`column`),H$1(t,`justify-content`,`center`),H$1(t,`align-items`,`center`),H$1(t,`gap`,`5px`),this.spans.push(r),t}processAndStartTimer(){let e=this.inappElement.timer.start(this.inappElement.timerType,t=>{this.spans.forEach(r=>{r.id===`lc-${o.DAYS}`?r.innerText=String(t.days).padStart(2,`0`):r.id===`lc-${o.HOURS}`?r.innerText=String(t.hours).padStart(2,`0`):r.id===`lc-${o.MINUTES}`?r.innerText=String(t.minutes).padStart(2,`0`):r.id===`lc-${o.SECONDS}`&&(r.innerText=String(t.seconds).padStart(2,`0`));});});this.triggerContext.intervals.push(e);}};var b=class extends p{constructor(e,t,r){super(e,t,r),this.inappHTMLEl=document.createElement(`select`),this.insertElement();}render(){H$1(this.inappHTMLEl,`background`,`#ffffff00`),H$1(this.inappHTMLEl,`outline`,`none`),this.processCommonBlocks(),this.addListener(this.inappHTMLEl),this.addOptions();}addListener(e){this.triggerContext.selectedEmbeddedItems?.length||this.updateItems(this.triggerContext.triggerData.items[0].vars[0]),e.addEventListener(`click`,t=>{t.stopPropagation();}),e.addEventListener(`change`,()=>{let t=new nt(JSON.parse(e.value));this.updateItems(t);});}updateItems(e){let t=this.triggerContext.triggerData.items[0];this.triggerContext.selectedEmbeddedItems=[t.toEmbed(e)];let r=this.parentHTMLEl.querySelector(`#coo-13`);if(!r)return;let n=e.imgs[0]??t.imgs?.at(0);n?.url&&r.setAttribute(`src`,n.url);}addOptions(){let e=this.triggerContext.triggerData.items,t=this.inappHTMLEl;if(!e?.length){t.add(this.createOption(this.inappElement.placeholderText));return}let r=this.triggerContext.selectedEmbeddedItems?.at(0);e[0].vars.forEach(n=>{t.add(this.createOption(n.name??`Default`,n,n.mID===r?.vID));});}createOption(e,t,r){let n=document.createElement(`option`);return n.text=e,n.value=JSON.stringify(t),r&&(n.selected=true),t||(n.disabled=true),n}};var T=class extends p{borderColor=``;constructor(e,t,r){super(e,t,r),this.inappHTMLEl=document.createElement(`input`),this.insertElement();}render(){let e=this.setInputType();this.inappHTMLEl.setAttribute(`placeholder`,this.inappElement.placeholderText),H$1(this.inappHTMLEl,`background`,`#ffffff00`),H$1(this.inappHTMLEl,`outline`,`none`),this.inappHTMLEl.addEventListener(`click`,t=>{t.stopPropagation();}),this.processCommonBlocks(),this.addListener(this.inappHTMLEl,e),this.triggerContext.addInputField(e,this.inappElement.t);}};var R=class o extends T{static EMAIL_REGEX=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/;constructor(e,t,r){super(e,t,r);}setInputType(){let e=`coo-${this.inappElement.t}`;return this.inappHTMLEl.setAttribute(`type`,`email`),this.inappHTMLEl.setAttribute(`id`,e),e}addListener(e,t){e.addEventListener(`keydown`,r=>{this.borderColor||(this.borderColor=this.inappHTMLEl.style.borderColor),e.value.match(o.EMAIL_REGEX)?(H$1(this.inappHTMLEl,`border-color`,this.borderColor),this.triggerContext.updateValidation(t,true)):(H$1(this.inappHTMLEl,`border-color`,`red`),this.triggerContext.updateValidation(t,false)),r.stopPropagation();});}};var D=class o extends T{static MOBILE_REGEX=/^\d+$/;constructor(e,t,r){super(e,t,r);}setInputType(){let e=`coo-${this.inappElement.t}`;return this.inappHTMLEl.setAttribute(`type`,`tel`),this.inappHTMLEl.setAttribute(`id`,e),e}addListener(e,t){e.addEventListener(`keydown`,r=>{this.borderColor||(this.borderColor=this.inappHTMLEl.style.borderColor),e.value.match(o.MOBILE_REGEX)?(H$1(this.inappHTMLEl,`border-color`,this.borderColor),this.triggerContext.updateValidation(t,true)):(H$1(this.inappHTMLEl,`border-color`,`red`),this.triggerContext.updateValidation(t,false)),r.stopPropagation();});}};var P=class extends E{constructor(e,t,r){super(e,t,r);}render(){super.render(),this.inappHTMLEl.setAttribute(`id`,`coo-${this.inappElement.type}`);}};var I=class o{static DOCUMENT_STANDARD_MODE=`CSS1Compat`;static ACTIVE_TRIGGER_DATA;static _instance;parent;rootContainer;containerHTMLElement;ian;scalingFactor=1;triggerContext;resizeListener;cartDrawerToggleSubscription;constructor(e){this.resizeListener=()=>this.screenResized(),this.setParentContainer(e);}static get(){return o._instance}render(e){this.renderEngagement(new G(e));}getScalingFactor(){return this.scalingFactor}calculateScalingFactor(e){let t=e.max,r=e.cont.w,n=e.cont.h,l=e.spc,c=this.getWidth(),h=this.getHeight();t&&(c=c?Math.min(c,t):t,h=h?Math.min(h,t):t),h&&(c-=l.getHorizontal(),h-=l.getVertical(),c/h<r/n?this.scalingFactor=c/r:this.scalingFactor=h/n,this.scalingFactor=Math.min(this.scalingFactor,1));}setParentContainer(e){this.parent=e||document.body,this.isParentNotBody()&&H$1(this.parent,`position`,`relative`);}isParentNotBody(){return this.parent&&this.parent!==document.body}getWidth(){return this.isParentNotBody()?this.parent.clientWidth:document.compatMode===o.DOCUMENT_STANDARD_MODE?document.documentElement.clientWidth:window.innerWidth}getHeight(){return this.isParentNotBody()?this.parent.clientHeight:document.compatMode===o.DOCUMENT_STANDARD_MODE?document.documentElement.clientHeight:window.innerHeight}async renderEngagement(e){this.triggerContext=new Be(new Date,e),this.triggerContext.onClose(t=>{this.closeInApp(t);}),this.ian=e.ian,(M()||e.previewType===`mobile`)&&this.ian.overrideForMobileView(),await this.preloadImages(e),e.shouldDelay()?window.setTimeout(()=>{this.withCartDrawerClosed();},e.getDelaySeconds()):this.withCartDrawerClosed();}withCartDrawerClosed(){if(!V.get().isOpen()){this.startRenderingOnce();return}this.cartDrawerToggleSubscription=window.CooeeSDK.cartDrawerToggle$.subscribe(({open:t})=>{!t&&this.startRenderingOnce();});}startRenderingOnce(){if(!this.shouldSkipCampaign()){o.ACTIVE_TRIGGER_DATA=this.triggerContext.triggerData,o._instance=this;try{this.startRendering();}catch(e){ke(e,`render-popup`,{triggerContext:this.triggerContext});return}this.sendTriggerDisplayed(),M()||window.addEventListener(`resize`,this.resizeListener),this.cartDrawerToggleSubscription?.unsubscribe();}}shouldSkipCampaign(){let e=this.triggerContext.triggerData;if(!e.previewType&&o.ACTIVE_TRIGGER_DATA){let r={triggerShown:new mt(o.ACTIVE_TRIGGER_DATA??{})};return this.skipTrigger(e,r),true}if(Be$1().isGoKwikPopupOpen)return this.skipTrigger(e,{reason:`GoKwik popup is open`}),true;let t=zr.find(r=>!!document.querySelector(r.identifier));return t?(this.skipTrigger(e,{reason:`${t.gateway} modal is open`}),true):false}startRendering(){this.calculateScalingFactor(this.ian),this.rootContainer=new v(this.parent,this.ian,this.triggerContext).render();try{this.renderContainer(this.triggerContext);}catch(e){throw Y.error(e),e}}sendTriggerDisplayed(){let e={};this.triggerContext.triggerData.items?.length&&(e.promotedMIDs=this.triggerContext.triggerData.items?.map(n=>n.mID));fe(new Ir(`CE Trigger Displayed`,e,this.triggerContext.triggerData));document.dispatchEvent(new CustomEvent(`letscooee:outbound:popup-activities`,{detail:{action:`DISPLAYED`}}));}sendTriggerClosed(e){let t=e.eventName;delete e.eventName;let r=new Ir(t,e,this.triggerContext.triggerData);r.name===`CE Trigger Clicked`&&(r.items=this.triggerContext.selectedEmbeddedItems??this.triggerContext.triggerData.items?.map(n=>n.toEmbed())),fe(r);}addEnterAnimation(e){this.containerHTMLElement.animate(e.getEnterAnimation(),{duration:500});}renderElement(e,t,r){t instanceof $r?new R(e,t,r).render():t instanceof qr?new D(e,t,r).render():t instanceof yt?new u(e,t,r).render():t instanceof Gr?new P(e,t,r).render():t instanceof it?new E(e,t,r).render():t instanceof qt?new f(e,t,r).render():t instanceof Vr?new A(e,t,r).render():t instanceof Hr?new b(e,t,r).render():Y.error(`Unsupported element type- `+t.type);}renderContainer(e){let t=this.ian?.cont;t&&(this.containerHTMLElement=new w(this.rootContainer,t,e).render().getHTMLElement(),new L().loadAllFonts(this.ian),this.ian.elems?.forEach(async r=>{await this.renderElement(this.containerHTMLElement,r,e);}),this.addEnterAnimation(this.ian.anim));}closeInApp(e){let t=this.ian.anim.getExitAnimation();this.sendTriggerClosed(e),o.ACTIVE_TRIGGER_DATA=void 0;let r=this.containerHTMLElement.animate(t,{duration:500,easing:`ease-in-out`});r.onfinish=()=>{this.removeInApp(),window.removeEventListener(`resize`,this.resizeListener);};}screenResized(){this.removeInApp(),this.startRendering();}removeInApp(){let e=document.querySelector(`.${this.triggerContext.rootClassName}`);e&&e.parentElement.removeChild(e);}skipTrigger(e,t){fe(new Ir(`CE Campaign Rejected`,t,e));}async preloadImages(e){let t=e.ian;if(!t)return;let r=[];t.elems.forEach(n=>{let l=n.bg?.img?.src;if(l&&r.push(l),n.t===1){let c=n.src;if(!c)return;r.push(c);}}),t.bg?.img?.src&&r.push(t.bg.img.src),t.cont.bg?.img?.src&&r.push(t.cont.bg.img.src),await Promise.all(r.map(n=>A$1(n)));}};
@@ -1,7 +1,7 @@
1
- import './chunk-CCm99pJA-CLFCz8r4.js';
1
+ import './chunk-cN7DAvpe-BbA9dPrS.js';
2
2
  import './main.min.js';
3
- import { h as g, j as W, G as Ge, K as Ke, o as of, y as ye, k as Ka, u as uv, J as Ja, S as Sf, D as Df } from './widgets-B557Uqe1-Bv1U29wt.js';
4
- import { l, f } from './video-detail-dialog.component-Bad60nD4-CNerR2IU.js';
3
+ import { h as g, j as W, G as Ge, K as Ke, o as of, y as ye, k as Ka, u as uv, J as Ja, S as Sf, D as Df } from './widgets-DkXU5112-D30WP3Pt.js';
4
+ import { l, f } from './video-detail-dialog.component-CXwW6KbY-CCLwK_4I.js';
5
5
 
6
6
  var _=class d{dialogRef=g(W);eventData=g(Ge);triggerData=g(Ke)().triggerData;onShareAndClose(p,o){p.stopPropagation();let{url:t,text:a}=l(this.triggerData,this.eventData.video,o!==`Clipboard`);switch(o){case `Whatsapp`:window.open(`https://wa.me/?text=${a}%20${t}`,`_blank`,`noopener,noreferrer`);break;case `X(Twitter)`:window.open(`https://x.com/intent/post?text=${a}&url=${t}`,`_blank`,`noopener,noreferrer`);break;case `Clipboard`:navigator.clipboard.writeText(t).catch(()=>{let e=document.createElement(`textarea`);e.value=t,document.body.appendChild(e),e.select(),document.execCommand(`copy`),document.body.removeChild(e);});break;}o&&f(this.triggerData,this.eventData.video,this.eventData.index,o),this.dialogRef.close();}static ɵfac=function(o){return new(o||d)};static ɵcmp=of({type:d,selectors:[[`cooee-share-dialog`]],decls:19,vars:0,consts:[[1,`share-dialog`],[1,`share-dialog-header`],[`type`,`button`,`aria-label`,`Close`,1,`close-button`,3,`click`],[`name`,`close`,`aria-hidden`,`true`],[1,`share-options`],[`type`,`button`,`aria-label`,`Share on WhatsApp`,1,`share-option`,3,`click`],[`name`,`whatsapp`,`aria-hidden`,`true`],[`type`,`button`,`aria-label`,`Share on X`,1,`share-option`,3,`click`],[`name`,`x-twitter`,`aria-hidden`,`true`],[`type`,`button`,`aria-label`,`Copy link`,1,`share-option`,3,`click`],[`name`,`copy`,`aria-hidden`,`true`]],template:function(o,t){o&1&&(Ka(0,`div`,0)(1,`div`,1)(2,`h3`),uv(3,`Share`),Ja(),Ka(4,`button`,2),Sf(`click`,function(e){return t.onShareAndClose(e)}),Df(5,`cooee-icon`,3),Ja()(),Ka(6,`div`,4)(7,`button`,5),Sf(`click`,function(e){return t.onShareAndClose(e,`Whatsapp`)}),Df(8,`cooee-icon`,6),Ka(9,`span`),uv(10,`Whatsapp`),Ja()(),Ka(11,`button`,7),Sf(`click`,function(e){return t.onShareAndClose(e,`X(Twitter)`)}),Df(12,`cooee-icon`,8),Ka(13,`span`),uv(14,`X`),Ja()(),Ka(15,`button`,9),Sf(`click`,function(e){return t.onShareAndClose(e,`Clipboard`)}),Df(16,`cooee-icon`,10),Ka(17,`span`),uv(18,`Copy link`),Ja()()()());},dependencies:[ye],styles:[`@keyframes _ngcontent-%COMP%_slideInScale{0%{opacity:0;transform:scale(.9) translateY(8px)}to{opacity:1;transform:scale(1) translateY(0)}}.share-dialog[_ngcontent-%COMP%]{background:#fff;border-radius:12px;padding:20px;min-width:280px;box-shadow:0 8px 32px #00000026;color:#333;animation:_ngcontent-%COMP%_slideInScale .25s ease-out}.share-dialog-header[_ngcontent-%COMP%]{display:flex;justify-content:space-between;align-items:center;margin-bottom:20px}.share-dialog-header[_ngcontent-%COMP%] h3[_ngcontent-%COMP%]{font-family:var(--lc-heading-family),serif;margin:0;font-size:18px;font-weight:600}.share-options[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:12px;font-family:var(--lc-text-family),serif}.share-option[_ngcontent-%COMP%]{display:flex;align-items:center;gap:12px;padding:12px 16px;background:#0002;border:1px solid #e9ecef;border-radius:8px;color:#333;font-size:16px;font-weight:500;cursor:pointer;transition:all .2s ease}.share-option[_ngcontent-%COMP%]:hover{background:#0004;border-color:#dee2e6;transform:translateY(-1px)}.share-option[_ngcontent-%COMP%]:active{transform:translateY(0)}.share-option[_ngcontent-%COMP%] cooee-icon[_ngcontent-%COMP%]{width:24px;height:24px}.share-option[_ngcontent-%COMP%] cooee-icon[name=whatsapp][_ngcontent-%COMP%]{color:#25d366}.share-option[_ngcontent-%COMP%] cooee-icon[name=x-twitter][_ngcontent-%COMP%], .share-option[_ngcontent-%COMP%] cooee-icon[name=copy][_ngcontent-%COMP%]{color:#000}.share-option[_ngcontent-%COMP%] span[_ngcontent-%COMP%]{flex:1;text-align:left}button.close-button[_ngcontent-%COMP%]{background-color:transparent;border:none}button.close-button[_ngcontent-%COMP%] cooee-icon[name=close][_ngcontent-%COMP%]{border-radius:100%;color:#000}`]})};
7
7
 
@@ -1,15 +1,15 @@
1
- import { f as fe, Y } from './chunk-CCm99pJA-CLFCz8r4.js';
1
+ import { f as fe, Y } from './chunk-cN7DAvpe-BbA9dPrS.js';
2
2
  import { I as Ir, V as Ve, H as He, y as ye, M, l as le, u as ue, d, n, a as Mi, b as V } from './main.min.js';
3
- import { l as Mt, h as g, m as Ye, n as Se$1, G as Ge, j as W, o as of, p as ht, q as ut, r as ft, s as TE, t as wE, v as mt, x as pt, y as ye$1, k as Ka, S as Sf, z as ec, w as wD, I as ID, H as Ho, J as Ja, A as lf, C as jD, E as yf, c as ud, _ as _D, F as nc, R as Rf, L as xf, N as Hb, O as Ro, K as Ke, P as Ft, D as Df, $ as $b, Q as Es, B as Bo, X as Xa, V as Vo, U as rc, Z as mf, a0 as ND, a1 as vD, a2 as fu, a3 as pu, a4 as kD, a5 as ED, a6 as Ef, a7 as gv, a8 as Zf, a9 as qf, aa as fv, ab as Sv, ac as Kg } from './widgets-B557Uqe1-Bv1U29wt.js';
3
+ import { l as Mt, h as g, m as Ye, n as Se$1, G as Ge, j as W, o as of, p as ht, q as ut, r as ft, s as TE, t as wE, v as mt, x as pt, y as ye$1, k as Ka, S as Sf, z as ec, w as wD, I as ID, H as Ho, J as Ja, A as lf, C as jD, E as yf, c as ud, _ as _D, F as nc, R as Rf, L as xf, N as Hb, O as Ro, K as Ke, P as Ft, D as Df, $ as $b, Q as Es, B as Bo, X as Xa, V as Vo, U as rc, Z as mf, a0 as ND, a1 as vD, a2 as fu, a3 as pu, a4 as kD, a5 as ED, a6 as Ef, a7 as gv, a8 as Zf, a9 as qf, aa as fv, ab as Sv, ac as Kg } from './widgets-DkXU5112-D30WP3Pt.js';
4
4
 
5
5
  var f=(t,e,o,r)=>{if(!e)return;let i=new Ir(`CE Video Shared`,{current:{videoID:e.id,videoIndex:o},platform:r},t);window.CooeeSDK.sendEvent(i);},l=(t,e,o=true)=>{let r=o?encodeURIComponent(m(t,e)):m(t,e),n=`Hey! Check out this video for an amazing product -`;return {url:r,text:o?encodeURIComponent(n):n}},m=(t,e)=>{return Ve(He(window.location.href,t),e)};
6
6
 
7
- var S=class n{video=$b.required();progress=Mt(0);constructor(){Es(t=>{let e=this.video(),i=()=>{this.progress.set(e.currentTime/e.duration*100);};e.addEventListener(`timeupdate`,i),t(()=>{e.removeEventListener(`timeupdate`,i);});});}static ɵfac=function(e){return new(e||n)};static ɵcmp=of({type:n,selectors:[[`cooee-video-progress-bar`]],inputs:{video:[1,`video`]},decls:3,vars:3,consts:[[1,`video-untracked-path`],[`role`,`progressbar`,1,`video-tracked-path`]],template:function(e,i){e&1&&(Bo(0,`div`,0)(1,`div`,1),Xa(2,`div`),Vo()()),e&2&&(ud(),rc(`width`,i.progress(),`%`),mf(`aria-valuenow`,i.progress()));},styles:[`[_nghost-%COMP%]{display:block;width:100%;position:absolute;z-index:10;top:4px;padding-inline:8px;box-sizing:border-box}.video-untracked-path[_ngcontent-%COMP%], .video-tracked-path[_ngcontent-%COMP%]{height:4px;border-radius:var(--lc-video-progress-bar-radius)}.video-untracked-path[_ngcontent-%COMP%]{background-color:rgba(var(--lc-video-progress-bar-bg-color));width:100%;margin-bottom:2px}.video-tracked-path[_ngcontent-%COMP%]{background-color:rgba(var(--lc-video-progress-bar-color));transition:width .5s ease-in-out}@media(prefers-reduced-motion:reduce){.video-tracked-path[_ngcontent-%COMP%]{transition:none}}`]})};var P=class n{dialogState=Hb();dialog=g(Ro);triggerData=g(Ke)().triggerData;eventData=g(Ge);containerRef=g(Ft);async share(t){t.stopPropagation(),t.preventDefault(),M()&&V()?await this.shareNative():await this.shareWithDialog();}async shareNative(){let t=l(this.triggerData,this.eventData.video,false);await navigator.share(t),f(this.triggerData,this.eventData.video,this.eventData.index,`Native`);}async shareWithDialog(){let t=await import('./share-dialog.component-DzgdZ933-DoNUR5zU.js');this.dialogState.emit(true),this.dialog.open(t.ShareDialogComponent,{viewContainerRef:this.containerRef}).closed.subscribe(()=>this.dialogState.emit(false));}static ɵfac=function(e){return new(e||n)};static ɵcmp=of({type:n,selectors:[[`cooee-share-button`]],outputs:{dialogState:`dialogState`},decls:2,vars:0,consts:[[`type`,`button`,`aria-label`,`Share video`,3,`click`],[`name`,`share`]],template:function(e,i){e&1&&(Ka(0,`button`,0),Sf(`click`,function(r){return i.share(r)}),Df(1,`cooee-icon`,1),Ja());},dependencies:[ye$1],styles:[`button[_ngcontent-%COMP%]{width:var(--lc-icon-button-size, 44px);height:var(--lc-icon-button-size, 44px);display:flex;justify-content:center;align-items:center;border:none;border-radius:100%;background:#00000080;background:color-mix(in oklab,#000 50%,transparent)}button[_ngcontent-%COMP%] cooee-icon[name=share][_ngcontent-%COMP%]{color:#fff}`]})};var Ie=[`swiperComp`],Se=[`videoEl`],Pe=(n,t)=>t.url;function ke(n,t){n&1&&(Ka(0,`div`,11),Df(1,`div`,15),Ja());}function Me(n,t){if(n&1&&Df(0,`source`,13),n&2){let e=t.$implicit;yf(`type`,gv(e.mimeType))(`src`,e.url);}}function Oe(n,t){n&1&&Ef(0);}function Ne(n,t){if(n&1){let e=ND();Ka(0,`cooee-video-promoted-items`,24),Sf(`cardClick`,function(o){fu(e);let r=kD(2).$implicit;return pu(kD().productCardClicked(o,r))}),Ja();}if(n&2){let e=kD(2).$implicit;yf(`items`,e.items);}}function ze(n,t){if(n&1&&Df(0,`cooee-video-card`,23),n&2){let e=kD(2).$implicit;yf(`card`,e.card);}}function Fe(n,t){if(n&1){let e=ND();Df(0,`cooee-video-progress-bar`,16),Ka(1,`div`,17)(2,`cooee-mute-toggle`,18),Zf(`mutedChange`,function(o){fu(e);let r=kD(2);return fv(r.muted,o)||(r.muted=o),pu(o)}),Sf(`toggled`,function(){fu(e);return pu(kD(2).muteToggled())}),Ja(),lf(3,Oe,1,0,`ng-container`,8),Ja(),Ka(4,`div`,19)(5,`cooee-share-button`,20),Sf(`dialogState`,function(o){fu(e);return pu(kD(2).shareDialogOpen.set(o))}),Ja()(),Ka(6,`div`,21),vD(7,Ne,1,1,`cooee-video-promoted-items`,22)(8,ze,1,1,`cooee-video-card`,23),Ja();}if(n&2){let e=kD().$implicit,i=jD(5),o=kD(),r=jD(9);yf(`video`,i),ud(2),qf(`muted`,o.muted),yf(`videoEl`,i),ud(),yf(`ngTemplateOutlet`,r),ud(4),ED(e.items.length&&o.videoConfig.showItems()?7:e.card&&o.videoConfig.footerContent===o.VideoConfigFooterContent.CARD?8:-1);}}function Le(n,t){if(n&1){let e=ND();Ka(0,`cooee-item-detail`,25),Sf(`closeClick`,function(){fu(e);return pu(kD(2).productModalClosed())}),Ja();}if(n&2){let e=kD(2);yf(`item`,e.selectedItem)(`similarItems`,e.selectedVideo.items)(`template`,e.videoConfig.itemDetailConfig.template);}}function Re(n,t){if(n&1){let e=ND();Ka(0,`div`,6)(1,`div`,9)(2,`div`,10),vD(3,ke,2,0,`div`,11),Ka(4,`video`,12,2),Sf(`click`,function(){let o=fu(e).$index,r=kD();return pu(r.currentIndex===o&&r.toggleMute())})(`ended`,function(){fu(e);let o=jD(5);return pu(kD().onVideoEnded(o))})(`loadstart`,function(){let o=fu(e).$index;return pu(kD().onVideoLoadStart(o))})(`canplay`,function(){let o=fu(e).$index;return pu(kD().onVideoCanPlay(o))}),wD(6,Me,1,3,`source`,13,Pe),Ja(),vD(8,Fe,9,5),Ja(),vD(9,Le,1,3,`cooee-item-detail`,14),Ja()();}if(n&2){let e=t.$implicit,i=t.$index,o=kD();ud(2),rc(`background-image`,e.thumbnail?`url(`+e.thumbnail+`)`:null),ud(),ED(o.shouldShowVideoSpinner(i)?3:-1),ud(),yf(`ngClass`,o.viewTemplateClassName)(`muted`,true),mf(`preload`,o.isVideoVisible(i)?`metadata`:`none`)(`data-video-id`,e.id)(`autoplay`,null),ud(2),_D(e.sources),ud(2),ED(o.currentIndex===i?8:-1),ud(),ED(o.selectedItem&&o.currentIndex===i?9:-1);}}function Ae(n,t){n&1&&Ef(0);}function Be(n,t){if(n&1){let e=ND();Ka(0,`button`,26),Sf(`click`,function(){fu(e);return pu(kD().close())}),Df(1,`cooee-icon`,27),Ja();}}var Te=class n$1{swiperComponent;videoElements;VideoConfigFooterContent=ye;currentIndex=0;muted=Mt(false);selectedItem=null;selectedVideo;detailPopupTemplate;viewTemplateClassName=`lc-video-only-view`;shareDialogOpen=Mt(false);data=g(Ye);elementRef=g(Se$1);eventData=g(Ge);dialogRef=g(W);swiperInitialized=Mt(false);swiperOptions=Mt(null);videos=[];videoConfig;triggerContext;engagementTrigger;isMobile=M();navigationConfig;cssLoadedPromise;resizeDebouncer=new le(this.onResize.bind(this));videoLoadingStates=new Map;constructor(){this.videos=this.data.videos,this.currentIndex=this.data.currentIndex,this.selectedItem=this.data.selectedItem??null,this.selectedVideo=this.videos[this.currentIndex],this.triggerContext=this.data.triggerContext,this.engagementTrigger=this.triggerContext.triggerData,this.videoConfig=this.engagementTrigger?.content?.videoConfig??new ue,this.navigationConfig=new d({enabled:true,size:50,color:new n({h:`#000000`})}),this.cssLoadedPromise=Mi(this.elementRef.nativeElement.shadowRoot);}onKeyDown(t){t.preventDefault(),t.stopPropagation(),this.close();}async ngOnInit(){switch(this.muted.set(await fe.get(`muted`,false)),this.videoConfig.detailPopup.template){case `PRODUCT_DETAIL_VIEW`:this.selectItemForDetailView(),this.viewTemplateClassName=`lc-product-detail-view`;break;case `VIDEO_ONLY_VIEW`:this.viewTemplateClassName=`lc-video-only-view`;break}}ngAfterViewInit(){this.initializeSwiperWithVideoDimensions();}ngOnDestroy(){this.resizeDebouncer?.destroy();}initializeSwiperWithVideoDimensions(){this.applyOptimalVideoDimensions(),this.initSwiperOptions(),this.playActiveVideo(false);}close(){let t=this.getCurrentVideoElement();this.dialogRef.close({lastVideo:this.videos[this.currentIndex],lastVideoIndex:this.currentIndex,lastVideoDuration:t?.currentTime});}getCurrentVideoElement(){return this.videoElements.get(this.currentIndex)?.nativeElement}moveToNextVideo(){this.swiperComponent.swiper.slideTo(this.currentIndex+1);}productModalClosed(){this.selectedItem=null;}pauseAll(){this.videoElements.forEach(t=>t.nativeElement.pause());}toggleMute(){this.muted.update(t=>!t);}async muteToggled(){await fe.set(`muted`,this.muted());let e=[this.muted()?`CE Video Muted`:`CE Video Unmuted`,{current:this.currentVideoProps()},{triggerData:this.engagementTrigger}];window.CooeeSDK.events.push(e);}playActiveVideo(t=true){t&&this.pauseAll();let e=this.getCurrentVideoElement();e&&this.playVideo(e);}playVideo(t){t.currentTime=0,t.play().catch(e=>Y.error(e));}onVideoEnded(t){if(this.currentIndex<this.videos.length-1)this.selectedItem||this.shareDialogOpen()?this.playVideo(t):this.moveToNextVideo();else {let i=[`CE Last Video Ended`,{previous:this.getPreviousVideoDataForEvent()},{triggerData:this.engagementTrigger}];window.CooeeSDK.events.push(i),this.playVideo(t);}}onSlideChange(t){let e=this.getPreviousVideoDataForEvent();this.currentIndex=t.realIndex,this.selectedVideo=this.videos[this.currentIndex],this.eventData.video=this.selectedVideo,this.eventData.index=this.currentIndex,this.playActiveVideo(),this.isProductDetailView()?this.selectItemForDetailView():this.selectedItem=null;let r=new Ir(`CE Video Changed`,{previous:e,current:this.currentVideoProps()},this.engagementTrigger);r.setVideos(this.videos[this.currentIndex]),window.CooeeSDK.sendEvent(r);}productCardClicked(t,e){let o=new Ir(`CE More Item Info Clicked`,{current:{videoID:e.id,videoIndex:this.currentIndex}},this.engagementTrigger);o.setVideos(e),window.CooeeSDK.sendEvent(o),this.selectedItem=t;}onVideoLoadStart(t){this.videoLoadingStates.set(t,true);}onVideoCanPlay(t){this.videoLoadingStates.set(t,false);}shouldShowVideoSpinner(t){return this.swiperInitialized()?this.videoLoadingStates.get(t)===true&&this.isVideoVisible(t):this.isVideoVisible(t)}isVideoVisible(t){let e=this.currentIndex-1,i=this.currentIndex+1;return t===this.currentIndex||t===e||t===i}async initSwiperOptions(){await this.cssLoadedPromise;let t=this.isMobile?1:`auto`,e=0;this.isProductDetailView()&&(t=`auto`,e=10),this.swiperOptions.set({direction:this.isMobile?`vertical`:`horizontal`,effect:this.isMobile?`slide`:`coverflow`,slidesPerView:t,initialSlide:this.currentIndex,centeredSlides:true,spaceBetween:e,coverflowEffect:{rotate:0,stretch:0,depth:400,modifier:1,slideShadows:false},on:{init:i=>{this.swiperInitialized.set(true),setTimeout(()=>{i.update();},100);}},mousewheel:{enabled:!this.isMobile,invert:false,thresholdDelta:20}});}isProductDetailView(){return this.videoConfig.detailPopup.template===`PRODUCT_DETAIL_VIEW`}currentVideoProps(){return {videoID:this.videos[this.currentIndex].id,videoIndex:this.currentIndex}}getPreviousVideoDataForEvent(){let t=this.currentVideoProps(),e=this.videoElements.find(o=>o.nativeElement.dataset.videoId===this.videos[this.currentIndex].id)?.nativeElement;t.playedTillMS=Math.ceil(e?.currentTime*1e3);let i=e?.duration*1e3;return t.playedTillPercent=+(t.playedTillMS/i).toFixed(4),t}selectItemForDetailView(){this.selectedItem=this.isMobile?null:this.selectedVideo?.items?.[0]??null;}applyOptimalVideoDimensions(){if(this.isMobile||this.isProductDetailView())return;let t=this.calculateOptimalVideoDimensions();t&&this.setVideoContainerDimensions(t.width,t.height);}calculateOptimalVideoDimensions(){let t=this.videos.map(h=>h.sources?.[0]).filter(h=>h?.width&&h?.height).map(h=>({width:h.width,height:h.height,aspectRatio:h.width/h.height}));if(t.length===0)return null;let e=t[0],i=window.innerWidth*.9,o=window.innerHeight*.9,r=i/e.width,k=o/e.height,A=Math.min(r,k);return {width:Math.floor(e.width*A),height:Math.floor(e.height*A)}}setVideoContainerDimensions(t,e){let i=this.elementRef.nativeElement;i.style.setProperty(`--video-container-width`,`${t}px`),i.style.setProperty(`--video-container-height`,`${e}px`);}onResize(){this.applyOptimalVideoDimensions();}static ɵfac=function(e){return new(e||n$1)};static ɵcmp=of({type:n$1,selectors:[[`cooee-video-detail-dialog`]],viewQuery:function(e,i){if(e&1&&nc(Ie,7)(Se,5),e&2){let o;Rf(o=xf())&&(i.swiperComponent=o.first),Rf(o=xf())&&(i.videoElements=o);}},hostAttrs:[1,`letscooee-widget`],hostBindings:function(e,i){e&1&&Sf(`keydown.escape`,function(r){return i.onKeyDown(r)},Kg);},decls:10,vars:4,consts:[[`swiperComp`,``],[`closeButtonTemplate`,``],[`videoEl`,``],[1,`lc-shadow-inner`,3,`ngClass`],[1,`video-swiper`,3,`slideChange`,`options`,`navigationConfig`],[`ngProjectAs`,`swiper-slides`,5,[`swiper-slides`]],[1,`swiper-slide`,`video-slide`],[1,`lc-desktop-controls`],[4,`ngTemplateOutlet`],[1,`lc-video-modal-row`],[1,`lc-video-container`],[1,`video-loading-overlay`],[`playsinline`,``,1,`lc-video-el`,3,`click`,`ended`,`loadstart`,`canplay`,`ngClass`,`muted`],[3,`src`,`type`],[1,`swiper-no-swiping`,`swiper-no-mousewheel`,3,`item`,`similarItems`,`template`],[1,`loading-spinner`],[3,`video`],[1,`lc-video-controls`],[3,`mutedChange`,`toggled`,`muted`,`videoEl`],[1,`share-controls`],[3,`dialogState`],[1,`lc-card-container`],[3,`items`],[3,`card`],[3,`cardClick`,`items`],[1,`swiper-no-swiping`,`swiper-no-mousewheel`,3,`closeClick`,`item`,`similarItems`,`template`],[`type`,`button`,`aria-label`,`Close`,1,`lc-close-button`,3,`click`],[`name`,`close`,`aria-hidden`,`true`]],template:function(e,i){if(e&1&&(Ka(0,`div`,3)(1,`cooee-swiper`,4,0),Sf(`slideChange`,function(r){return i.onSlideChange(r)}),ec(3,5),wD(4,Re,10,10,`div`,6,ID),Ho(),Ja(),Ka(6,`div`,7),lf(7,Ae,1,0,`ng-container`,8),Ja()(),lf(8,Be,2,0,`ng-template`,null,1,Sv)),e&2){let o=jD(9);yf(`ngClass`,i.viewTemplateClassName),ud(),yf(`options`,i.swiperOptions())(`navigationConfig`,i.navigationConfig),ud(3),_D(i.videos),ud(3),yf(`ngTemplateOutlet`,o);}},dependencies:[ht,ut,ft,P,S,TE,wE,mt,pt,ye$1],styles:[`:host{display:flex}.lc-shadow-inner{position:relative;width:100vw;height:100vh;display:flex}@media(min-width:768px){.lc-shadow-inner{background-color:color-mix(in oklab,#000 70%,transparent);justify-content:center;align-items:center}}.video-swiper{--swiper-navigation-size: 50px;--swiper-navigation-color: white;width:100dvw;height:100dvh}.lc-product-detail-view .video-swiper{align-items:center}@media(min-width:768px){.video-swiper{width:100%;height:100%;max-width:90vw;max-height:90vh}}.video-swiper>.swiper-wrapper{max-height:100%;pointer-events:none}.lc-product-detail-view .video-swiper>.swiper-wrapper{align-items:center}@media(max-width:768px){.video-swiper>.swiper-button-prev{display:none!important}}@media(max-width:768px){.video-swiper>.swiper-button-next{display:var(--lc-next-video-button-display)!important;width:var(--lc-icon-button-size, 44px);height:var(--lc-icon-button-size, 44px);display:flex;justify-content:center;align-items:center;border:none;border-radius:100%;background:#00000080;background:color-mix(in oklab,#000 50%,transparent);color:#fff;inset:auto auto 12px 50%;transform:translate(-50%) rotate(90deg)}.video-swiper>.swiper-button-next:after{color:#fff;font-weight:900}}.video-swiper:has(cooee-item-detail)>.swiper-button-next{display:none!important}.video-slide{position:relative;display:flex;align-items:center;visibility:hidden;pointer-events:auto}.lc-product-detail-view .video-slide{width:40vw!important;height:70vh!important}@media(min-width:768px){.lc-product-detail-view .video-slide{min-width:650px!important}}@media(max-width:768px){.lc-product-detail-view .video-slide{width:100%!important;height:100%!important}}@media(min-width:768px){.lc-video-only-view .video-slide{width:fit-content!important}}@media(min-width:768px){.video-slide{border-radius:var(--lc-media-radius);overflow:hidden}}.video-slide.swiper-slide-active,.video-slide.swiper-slide-prev,.video-slide.swiper-slide-next{visibility:visible}video{width:100%;height:100%;object-fit:cover;position:relative;z-index:3}.lc-desktop-controls{position:absolute;top:2rem;right:4rem;z-index:10;display:flex;gap:.5rem}@media(max-width:768px){.lc-desktop-controls{display:none}}.lc-video-controls{position:absolute;top:1rem;z-index:10;right:.5rem;display:flex;gap:.25rem}@media(min-width:768px){.lc-video-controls .lc-close-button{display:none}}.share-controls{position:absolute;bottom:30%;right:.5rem;z-index:10;display:flex;gap:.25rem;flex-direction:column;justify-content:center;align-items:center}.lc-close-button{width:var(--lc-icon-button-size, 44px);height:var(--lc-icon-button-size, 44px);display:flex;justify-content:center;align-items:center;border:none;border-radius:100%;background:#00000080;background:color-mix(in oklab,#000 50%,transparent)}.lc-video-container{position:relative;height:100%;width:100%;background:#000000b3 no-repeat center;background-size:cover}@media(min-width:768px){.lc-product-detail-view .lc-video-container{width:50%}}@media(min-width:768px){.lc-video-only-view .lc-video-container{width:var(--video-container-width, 100%);height:var(--video-container-height, 100%)}}.lc-card-container{position:absolute;bottom:12px;z-index:10;width:100%;padding-inline:12px;box-sizing:border-box}.lc-product-detail-view .lc-card-container{display:none}@media(max-width:768px){.lc-product-detail-view .lc-card-container{display:block}}.lc-product-detail-view .lc-video-modal-row{display:flex;justify-content:center;height:100%;width:100%}.lc-video-only-view .lc-video-modal-row{display:block;height:100%}.lc-product-detail-view cooee-item-detail{--header-display: none;width:50%;flex:1}@media(max-width:768px){.lc-product-detail-view cooee-item-detail{--header-display: flex;width:100%;height:70dvh;position:absolute;bottom:0;z-index:2147483646}}.lc-video-only-view cooee-item-detail{width:100%;height:70dvh;z-index:2147483646;bottom:0;position:absolute;border-radius:var(--lc-card-radius) var(--lc-card-radius) 0 0}@keyframes spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.video-loading-overlay{position:absolute;top:0;left:0;width:100%;height:100%;display:flex;align-items:center;justify-content:center;background-color:#0000004d;z-index:2}.video-loading-overlay .loading-spinner{width:30px;height:30px;border:3px solid rgba(255,255,255,.3);border-top:3px solid #fff;border-radius:50%;animation:spin 1s linear infinite}
7
+ var S=class n{video=$b.required();progress=Mt(0);constructor(){Es(t=>{let e=this.video(),i=()=>{this.progress.set(e.currentTime/e.duration*100);};e.addEventListener(`timeupdate`,i),t(()=>{e.removeEventListener(`timeupdate`,i);});});}static ɵfac=function(e){return new(e||n)};static ɵcmp=of({type:n,selectors:[[`cooee-video-progress-bar`]],inputs:{video:[1,`video`]},decls:3,vars:3,consts:[[1,`video-untracked-path`],[`role`,`progressbar`,1,`video-tracked-path`]],template:function(e,i){e&1&&(Bo(0,`div`,0)(1,`div`,1),Xa(2,`div`),Vo()()),e&2&&(ud(),rc(`width`,i.progress(),`%`),mf(`aria-valuenow`,i.progress()));},styles:[`[_nghost-%COMP%]{display:block;width:100%;position:absolute;z-index:10;top:4px;padding-inline:8px;box-sizing:border-box}.video-untracked-path[_ngcontent-%COMP%], .video-tracked-path[_ngcontent-%COMP%]{height:4px;border-radius:var(--lc-video-progress-bar-radius)}.video-untracked-path[_ngcontent-%COMP%]{background-color:rgba(var(--lc-video-progress-bar-bg-color));width:100%;margin-bottom:2px}.video-tracked-path[_ngcontent-%COMP%]{background-color:rgba(var(--lc-video-progress-bar-color));transition:width .5s ease-in-out}@media(prefers-reduced-motion:reduce){.video-tracked-path[_ngcontent-%COMP%]{transition:none}}`]})};var P=class n{dialogState=Hb();dialog=g(Ro);triggerData=g(Ke)().triggerData;eventData=g(Ge);containerRef=g(Ft);async share(t){t.stopPropagation(),t.preventDefault(),M()&&V()?await this.shareNative():await this.shareWithDialog();}async shareNative(){let t=l(this.triggerData,this.eventData.video,false);await navigator.share(t),f(this.triggerData,this.eventData.video,this.eventData.index,`Native`);}async shareWithDialog(){let t=await import('./share-dialog.component-DW70EFA1-7Yurj28Q.js');this.dialogState.emit(true),this.dialog.open(t.ShareDialogComponent,{viewContainerRef:this.containerRef}).closed.subscribe(()=>this.dialogState.emit(false));}static ɵfac=function(e){return new(e||n)};static ɵcmp=of({type:n,selectors:[[`cooee-share-button`]],outputs:{dialogState:`dialogState`},decls:2,vars:0,consts:[[`type`,`button`,`aria-label`,`Share video`,3,`click`],[`name`,`share`]],template:function(e,i){e&1&&(Ka(0,`button`,0),Sf(`click`,function(r){return i.share(r)}),Df(1,`cooee-icon`,1),Ja());},dependencies:[ye$1],styles:[`button[_ngcontent-%COMP%]{width:var(--lc-icon-button-size, 44px);height:var(--lc-icon-button-size, 44px);display:flex;justify-content:center;align-items:center;border:none;border-radius:100%;background:#00000080;background:color-mix(in oklab,#000 50%,transparent)}button[_ngcontent-%COMP%] cooee-icon[name=share][_ngcontent-%COMP%]{color:#fff}`]})};var Ie=[`swiperComp`],Se=[`videoEl`],Pe=(n,t)=>t.url;function ke(n,t){n&1&&(Ka(0,`div`,11),Df(1,`div`,15),Ja());}function Me(n,t){if(n&1&&Df(0,`source`,13),n&2){let e=t.$implicit;yf(`type`,gv(e.mimeType))(`src`,e.url);}}function Oe(n,t){n&1&&Ef(0);}function Ne(n,t){if(n&1){let e=ND();Ka(0,`cooee-video-promoted-items`,24),Sf(`cardClick`,function(o){fu(e);let r=kD(2).$implicit;return pu(kD().productCardClicked(o,r))}),Ja();}if(n&2){let e=kD(2).$implicit;yf(`items`,e.items);}}function ze(n,t){if(n&1&&Df(0,`cooee-video-card`,23),n&2){let e=kD(2).$implicit;yf(`card`,e.card);}}function Fe(n,t){if(n&1){let e=ND();Df(0,`cooee-video-progress-bar`,16),Ka(1,`div`,17)(2,`cooee-mute-toggle`,18),Zf(`mutedChange`,function(o){fu(e);let r=kD(2);return fv(r.muted,o)||(r.muted=o),pu(o)}),Sf(`toggled`,function(){fu(e);return pu(kD(2).muteToggled())}),Ja(),lf(3,Oe,1,0,`ng-container`,8),Ja(),Ka(4,`div`,19)(5,`cooee-share-button`,20),Sf(`dialogState`,function(o){fu(e);return pu(kD(2).shareDialogOpen.set(o))}),Ja()(),Ka(6,`div`,21),vD(7,Ne,1,1,`cooee-video-promoted-items`,22)(8,ze,1,1,`cooee-video-card`,23),Ja();}if(n&2){let e=kD().$implicit,i=jD(5),o=kD(),r=jD(9);yf(`video`,i),ud(2),qf(`muted`,o.muted),yf(`videoEl`,i),ud(),yf(`ngTemplateOutlet`,r),ud(4),ED(e.items.length&&o.videoConfig.showItems()?7:e.card&&o.videoConfig.footerContent===o.VideoConfigFooterContent.CARD?8:-1);}}function Le(n,t){if(n&1){let e=ND();Ka(0,`cooee-item-detail`,25),Sf(`closeClick`,function(){fu(e);return pu(kD(2).productModalClosed())}),Ja();}if(n&2){let e=kD(2);yf(`item`,e.selectedItem)(`similarItems`,e.selectedVideo.items)(`template`,e.videoConfig.itemDetailConfig.template);}}function Re(n,t){if(n&1){let e=ND();Ka(0,`div`,6)(1,`div`,9)(2,`div`,10),vD(3,ke,2,0,`div`,11),Ka(4,`video`,12,2),Sf(`click`,function(){let o=fu(e).$index,r=kD();return pu(r.currentIndex===o&&r.toggleMute())})(`ended`,function(){fu(e);let o=jD(5);return pu(kD().onVideoEnded(o))})(`loadstart`,function(){let o=fu(e).$index;return pu(kD().onVideoLoadStart(o))})(`canplay`,function(){let o=fu(e).$index;return pu(kD().onVideoCanPlay(o))}),wD(6,Me,1,3,`source`,13,Pe),Ja(),vD(8,Fe,9,5),Ja(),vD(9,Le,1,3,`cooee-item-detail`,14),Ja()();}if(n&2){let e=t.$implicit,i=t.$index,o=kD();ud(2),rc(`background-image`,e.thumbnail?`url(`+e.thumbnail+`)`:null),ud(),ED(o.shouldShowVideoSpinner(i)?3:-1),ud(),yf(`ngClass`,o.viewTemplateClassName)(`muted`,true),mf(`preload`,o.isVideoVisible(i)?`metadata`:`none`)(`data-video-id`,e.id)(`autoplay`,null),ud(2),_D(e.sources),ud(2),ED(o.currentIndex===i?8:-1),ud(),ED(o.selectedItem&&o.currentIndex===i?9:-1);}}function Ae(n,t){n&1&&Ef(0);}function Be(n,t){if(n&1){let e=ND();Ka(0,`button`,26),Sf(`click`,function(){fu(e);return pu(kD().close())}),Df(1,`cooee-icon`,27),Ja();}}var Te=class n$1{swiperComponent;videoElements;VideoConfigFooterContent=ye;currentIndex=0;muted=Mt(false);selectedItem=null;selectedVideo;detailPopupTemplate;viewTemplateClassName=`lc-video-only-view`;shareDialogOpen=Mt(false);data=g(Ye);elementRef=g(Se$1);eventData=g(Ge);dialogRef=g(W);swiperInitialized=Mt(false);swiperOptions=Mt(null);videos=[];videoConfig;triggerContext;engagementTrigger;isMobile=M();navigationConfig;cssLoadedPromise;resizeDebouncer=new le(this.onResize.bind(this));videoLoadingStates=new Map;constructor(){this.videos=this.data.videos,this.currentIndex=this.data.currentIndex,this.selectedItem=this.data.selectedItem??null,this.selectedVideo=this.videos[this.currentIndex],this.triggerContext=this.data.triggerContext,this.engagementTrigger=this.triggerContext.triggerData,this.videoConfig=this.engagementTrigger?.content?.videoConfig??new ue,this.navigationConfig=new d({enabled:true,size:50,color:new n({h:`#000000`})}),this.cssLoadedPromise=Mi(this.elementRef.nativeElement.shadowRoot);}onKeyDown(t){t.preventDefault(),t.stopPropagation(),this.close();}async ngOnInit(){switch(this.muted.set(await fe.get(`muted`,false)),this.videoConfig.detailPopup.template){case `PRODUCT_DETAIL_VIEW`:this.selectItemForDetailView(),this.viewTemplateClassName=`lc-product-detail-view`;break;case `VIDEO_ONLY_VIEW`:this.viewTemplateClassName=`lc-video-only-view`;break}}ngAfterViewInit(){this.initializeSwiperWithVideoDimensions();}ngOnDestroy(){this.resizeDebouncer?.destroy();}initializeSwiperWithVideoDimensions(){this.applyOptimalVideoDimensions(),this.initSwiperOptions(),this.playActiveVideo(false);}close(){let t=this.getCurrentVideoElement();this.dialogRef.close({lastVideo:this.videos[this.currentIndex],lastVideoIndex:this.currentIndex,lastVideoDuration:t?.currentTime});}getCurrentVideoElement(){return this.videoElements.get(this.currentIndex)?.nativeElement}moveToNextVideo(){this.swiperComponent.swiper.slideTo(this.currentIndex+1);}productModalClosed(){this.selectedItem=null;}pauseAll(){this.videoElements.forEach(t=>t.nativeElement.pause());}toggleMute(){this.muted.update(t=>!t);}async muteToggled(){await fe.set(`muted`,this.muted());let e=[this.muted()?`CE Video Muted`:`CE Video Unmuted`,{current:this.currentVideoProps()},{triggerData:this.engagementTrigger}];window.CooeeSDK.events.push(e);}playActiveVideo(t=true){t&&this.pauseAll();let e=this.getCurrentVideoElement();e&&this.playVideo(e);}playVideo(t){t.currentTime=0,t.play().catch(e=>Y.error(e));}onVideoEnded(t){if(this.currentIndex<this.videos.length-1)this.selectedItem||this.shareDialogOpen()?this.playVideo(t):this.moveToNextVideo();else {let i=[`CE Last Video Ended`,{previous:this.getPreviousVideoDataForEvent()},{triggerData:this.engagementTrigger}];window.CooeeSDK.events.push(i),this.playVideo(t);}}onSlideChange(t){let e=this.getPreviousVideoDataForEvent();this.currentIndex=t.realIndex,this.selectedVideo=this.videos[this.currentIndex],this.eventData.video=this.selectedVideo,this.eventData.index=this.currentIndex,this.playActiveVideo(),this.isProductDetailView()?this.selectItemForDetailView():this.selectedItem=null;let r=new Ir(`CE Video Changed`,{previous:e,current:this.currentVideoProps()},this.engagementTrigger);r.setVideos(this.videos[this.currentIndex]),window.CooeeSDK.sendEvent(r);}productCardClicked(t,e){let o=new Ir(`CE More Item Info Clicked`,{current:{videoID:e.id,videoIndex:this.currentIndex}},this.engagementTrigger);o.setVideos(e),window.CooeeSDK.sendEvent(o),this.selectedItem=t;}onVideoLoadStart(t){this.videoLoadingStates.set(t,true);}onVideoCanPlay(t){this.videoLoadingStates.set(t,false);}shouldShowVideoSpinner(t){return this.swiperInitialized()?this.videoLoadingStates.get(t)===true&&this.isVideoVisible(t):this.isVideoVisible(t)}isVideoVisible(t){let e=this.currentIndex-1,i=this.currentIndex+1;return t===this.currentIndex||t===e||t===i}async initSwiperOptions(){await this.cssLoadedPromise;let t=this.isMobile?1:`auto`,e=0;this.isProductDetailView()&&(t=`auto`,e=10),this.swiperOptions.set({direction:this.isMobile?`vertical`:`horizontal`,effect:this.isMobile?`slide`:`coverflow`,slidesPerView:t,initialSlide:this.currentIndex,centeredSlides:true,spaceBetween:e,coverflowEffect:{rotate:0,stretch:0,depth:400,modifier:1,slideShadows:false},on:{init:i=>{this.swiperInitialized.set(true),setTimeout(()=>{i.update();},100);}},mousewheel:{enabled:!this.isMobile,invert:false,thresholdDelta:20}});}isProductDetailView(){return this.videoConfig.detailPopup.template===`PRODUCT_DETAIL_VIEW`}currentVideoProps(){return {videoID:this.videos[this.currentIndex].id,videoIndex:this.currentIndex}}getPreviousVideoDataForEvent(){let t=this.currentVideoProps(),e=this.videoElements.find(o=>o.nativeElement.dataset.videoId===this.videos[this.currentIndex].id)?.nativeElement;t.playedTillMS=Math.ceil(e?.currentTime*1e3);let i=e?.duration*1e3;return t.playedTillPercent=+(t.playedTillMS/i).toFixed(4),t}selectItemForDetailView(){this.selectedItem=this.isMobile?null:this.selectedVideo?.items?.[0]??null;}applyOptimalVideoDimensions(){if(this.isMobile||this.isProductDetailView())return;let t=this.calculateOptimalVideoDimensions();t&&this.setVideoContainerDimensions(t.width,t.height);}calculateOptimalVideoDimensions(){let t=this.videos.map(h=>h.sources?.[0]).filter(h=>h?.width&&h?.height).map(h=>({width:h.width,height:h.height,aspectRatio:h.width/h.height}));if(t.length===0)return null;let e=t[0],i=window.innerWidth*.9,o=window.innerHeight*.9,r=i/e.width,k=o/e.height,A=Math.min(r,k);return {width:Math.floor(e.width*A),height:Math.floor(e.height*A)}}setVideoContainerDimensions(t,e){let i=this.elementRef.nativeElement;i.style.setProperty(`--video-container-width`,`${t}px`),i.style.setProperty(`--video-container-height`,`${e}px`);}onResize(){this.applyOptimalVideoDimensions();}static ɵfac=function(e){return new(e||n$1)};static ɵcmp=of({type:n$1,selectors:[[`cooee-video-detail-dialog`]],viewQuery:function(e,i){if(e&1&&nc(Ie,7)(Se,5),e&2){let o;Rf(o=xf())&&(i.swiperComponent=o.first),Rf(o=xf())&&(i.videoElements=o);}},hostAttrs:[1,`letscooee-widget`],hostBindings:function(e,i){e&1&&Sf(`keydown.escape`,function(r){return i.onKeyDown(r)},Kg);},decls:10,vars:4,consts:[[`swiperComp`,``],[`closeButtonTemplate`,``],[`videoEl`,``],[1,`lc-shadow-inner`,3,`ngClass`],[1,`video-swiper`,3,`slideChange`,`options`,`navigationConfig`],[`ngProjectAs`,`swiper-slides`,5,[`swiper-slides`]],[1,`swiper-slide`,`video-slide`],[1,`lc-desktop-controls`],[4,`ngTemplateOutlet`],[1,`lc-video-modal-row`],[1,`lc-video-container`],[1,`video-loading-overlay`],[`playsinline`,``,1,`lc-video-el`,3,`click`,`ended`,`loadstart`,`canplay`,`ngClass`,`muted`],[3,`src`,`type`],[1,`swiper-no-swiping`,`swiper-no-mousewheel`,3,`item`,`similarItems`,`template`],[1,`loading-spinner`],[3,`video`],[1,`lc-video-controls`],[3,`mutedChange`,`toggled`,`muted`,`videoEl`],[1,`share-controls`],[3,`dialogState`],[1,`lc-card-container`],[3,`items`],[3,`card`],[3,`cardClick`,`items`],[1,`swiper-no-swiping`,`swiper-no-mousewheel`,3,`closeClick`,`item`,`similarItems`,`template`],[`type`,`button`,`aria-label`,`Close`,1,`lc-close-button`,3,`click`],[`name`,`close`,`aria-hidden`,`true`]],template:function(e,i){if(e&1&&(Ka(0,`div`,3)(1,`cooee-swiper`,4,0),Sf(`slideChange`,function(r){return i.onSlideChange(r)}),ec(3,5),wD(4,Re,10,10,`div`,6,ID),Ho(),Ja(),Ka(6,`div`,7),lf(7,Ae,1,0,`ng-container`,8),Ja()(),lf(8,Be,2,0,`ng-template`,null,1,Sv)),e&2){let o=jD(9);yf(`ngClass`,i.viewTemplateClassName),ud(),yf(`options`,i.swiperOptions())(`navigationConfig`,i.navigationConfig),ud(3),_D(i.videos),ud(3),yf(`ngTemplateOutlet`,o);}},dependencies:[ht,ut,ft,P,S,TE,wE,mt,pt,ye$1],styles:[`:host{display:flex}.lc-shadow-inner{position:relative;width:100vw;height:100vh;display:flex}@media(min-width:768px){.lc-shadow-inner{background-color:color-mix(in oklab,#000 70%,transparent);justify-content:center;align-items:center}}.video-swiper{--swiper-navigation-size: 50px;--swiper-navigation-color: white;width:100dvw;height:100dvh}.lc-product-detail-view .video-swiper{align-items:center}@media(min-width:768px){.video-swiper{width:100%;height:100%;max-width:90vw;max-height:90vh}}.video-swiper>.swiper-wrapper{max-height:100%;pointer-events:none}.lc-product-detail-view .video-swiper>.swiper-wrapper{align-items:center}@media(max-width:768px){.video-swiper>.swiper-button-prev{display:none!important}}@media(max-width:768px){.video-swiper>.swiper-button-next{display:var(--lc-next-video-button-display)!important;width:var(--lc-icon-button-size, 44px);height:var(--lc-icon-button-size, 44px);display:flex;justify-content:center;align-items:center;border:none;border-radius:100%;background:#00000080;background:color-mix(in oklab,#000 50%,transparent);color:#fff;inset:auto auto 12px 50%;transform:translate(-50%) rotate(90deg)}.video-swiper>.swiper-button-next:after{color:#fff;font-weight:900}}.video-swiper:has(cooee-item-detail)>.swiper-button-next{display:none!important}.video-slide{position:relative;display:flex;align-items:center;visibility:hidden;pointer-events:auto}.lc-product-detail-view .video-slide{width:40vw!important;height:70vh!important}@media(min-width:768px){.lc-product-detail-view .video-slide{min-width:650px!important}}@media(max-width:768px){.lc-product-detail-view .video-slide{width:100%!important;height:100%!important}}@media(min-width:768px){.lc-video-only-view .video-slide{width:fit-content!important}}@media(min-width:768px){.video-slide{border-radius:var(--lc-media-radius);overflow:hidden}}.video-slide.swiper-slide-active,.video-slide.swiper-slide-prev,.video-slide.swiper-slide-next{visibility:visible}video{width:100%;height:100%;object-fit:cover;position:relative;z-index:3}.lc-desktop-controls{position:absolute;top:2rem;right:4rem;z-index:10;display:flex;gap:.5rem}@media(max-width:768px){.lc-desktop-controls{display:none}}.lc-video-controls{position:absolute;top:1rem;z-index:10;right:.5rem;display:flex;gap:.25rem}@media(min-width:768px){.lc-video-controls .lc-close-button{display:none}}.share-controls{position:absolute;bottom:30%;right:.5rem;z-index:10;display:flex;gap:.25rem;flex-direction:column;justify-content:center;align-items:center}.lc-close-button{width:var(--lc-icon-button-size, 44px);height:var(--lc-icon-button-size, 44px);display:flex;justify-content:center;align-items:center;border:none;border-radius:100%;background:#00000080;background:color-mix(in oklab,#000 50%,transparent)}.lc-video-container{position:relative;height:100%;width:100%;background:#000000b3 no-repeat center;background-size:cover}@media(min-width:768px){.lc-product-detail-view .lc-video-container{width:50%}}@media(min-width:768px){.lc-video-only-view .lc-video-container{width:var(--video-container-width, 100%);height:var(--video-container-height, 100%)}}.lc-card-container{position:absolute;bottom:12px;z-index:10;width:100%;padding-inline:12px;box-sizing:border-box}.lc-product-detail-view .lc-card-container{display:none}@media(max-width:768px){.lc-product-detail-view .lc-card-container{display:block}}.lc-product-detail-view .lc-video-modal-row{display:flex;justify-content:center;height:100%;width:100%}.lc-video-only-view .lc-video-modal-row{display:block;height:100%}.lc-product-detail-view cooee-item-detail{--header-display: none;width:50%;flex:1}@media(max-width:768px){.lc-product-detail-view cooee-item-detail{--header-display: flex;width:100%;height:70dvh;position:absolute;bottom:0;z-index:2147483646}}.lc-video-only-view cooee-item-detail{width:100%;height:70dvh;z-index:2147483646;bottom:0;position:absolute;border-radius:var(--lc-card-radius) var(--lc-card-radius) 0 0}@keyframes spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.video-loading-overlay{position:absolute;top:0;left:0;width:100%;height:100%;display:flex;align-items:center;justify-content:center;background-color:#0000004d;z-index:2}.video-loading-overlay .loading-spinner{width:30px;height:30px;border:3px solid rgba(255,255,255,.3);border-top:3px solid #fff;border-radius:50%;animation:spin 1s linear infinite}
8
8
  `],encapsulation:3})};
9
9
 
10
- var videoDetailDialog_componentBad60nD4 = /*#__PURE__*/Object.freeze({
10
+ var videoDetailDialog_componentCXwW6KbY = /*#__PURE__*/Object.freeze({
11
11
  __proto__: null,
12
12
  VideoDetailDialogComponent: Te
13
13
  });
14
14
 
15
- export { f, l, videoDetailDialog_componentBad60nD4 as v };
15
+ export { f, l, videoDetailDialog_componentCXwW6KbY as v };
@@ -1,4 +1,4 @@
1
- import { s, r, Y as Y$1, b as zn$1, t as te$1, h as he$2, A as Ar$1, x as xn$2, f as fe$2 } from './chunk-CCm99pJA-CLFCz8r4.js';
1
+ import { s, r, Y as Y$1, b as zn$1, t as te$1, h as he$2, A as Ar$1, x as xn$2, f as fe$2 } from './chunk-cN7DAvpe-BbA9dPrS.js';
2
2
  import { x as v$1, U as U$1, z as q, C as Sr$1, D as m$1, E as vs$1, J as ve$2, K as pi$1, N as Nn$1, L as bi$1, O as ii, _ as _e$2, P as Fs$1, Q as Ps$1, R as Se$2, T as ye$2, a as Mi$1, W as Ce$2, t as He$3, X as Me$2, I as Ir$1, Y as De$2, l as le$2, M as M$3, Z as Vi$1, a0 as $e$2, a1 as gr$1, a2 as He$4, a3 as qe$2, a4 as Re$2, a5 as Fe$2, a6 as We$3, a7 as Je$1, a8 as Ae$2, y as ye$3, a9 as ge$3 } from './main.min.js';
3
3
 
4
4
  var Y=null,mr=false,di=1,G=Symbol(`SIGNAL`);function v(e){let t=Y;return Y=e,t}function Dr(){return Y}var Pt$2={version:0,lastCleanEpoch:0,dirty:false,producers:void 0,producersTail:void 0,consumers:void 0,consumersTail:void 0,recomputing:false,consumerAllowSignalWrites:false,consumerIsAlwaysLive:false,kind:`unknown`,producerMustRecompute:()=>false,producerRecomputeValue:()=>{},consumerMarkedDirty:()=>{},consumerOnSignalRead:()=>{}};function jt$1(e){if(mr)throw new Error(``);if(Y===null)return;Y.consumerOnSignalRead(e);let t=Y.producersTail;if(t!==void 0&&t.producer===e)return;let n,r=Y.recomputing;if(r&&(n=t!==void 0?t.nextProducer:Y.producers,n!==void 0&&n.producer===e)){Y.producersTail=n,n.lastReadVersion=e.version;return}let o=e.consumersTail;if(o!==void 0&&o.consumer===Y&&(!r||Qp(o,Y)))return;let i=Vt$2(Y),s={producer:e,consumer:Y,nextProducer:n,prevConsumer:o,lastReadVersion:e.version,nextConsumer:void 0};Y.producersTail=s,t!==void 0?t.nextProducer=s:Y.producers=s,i&&Oc(e,s);}function Ac(){di++;}function fi$1(e){if(!(Vt$2(e)&&!e.dirty)&&!(!e.dirty&&e.lastCleanEpoch===di)){if(!e.producerMustRecompute(e)&&!Dn$1(e)){li(e);return}e.producerRecomputeValue(e),li(e);}}function pi(e){if(e.consumers===void 0)return;let t=mr;mr=true;try{for(let n=e.consumers;n!==void 0;n=n.nextConsumer){let r=n.consumer;r.dirty||Yp(r);}}finally{mr=t;}}function hi$1(){return Y?.consumerAllowSignalWrites!==false}function Yp(e){e.dirty=true,pi(e),e.consumerMarkedDirty?.(e);}function li(e){e.dirty=false,e.lastCleanEpoch=di;}function Bt$2(e){return e&&Rc(e),v(e)}function Rc(e){e.producersTail=void 0,e.recomputing=true;}function yn$1(e,t){v(t),e&&xc(e);}function xc(e){e.recomputing=false;let t=e.producersTail,n=t!==void 0?t.nextProducer:e.producers;if(n!==void 0){if(Vt$2(e))do n=gi(n);while(n!==void 0);t!==void 0?t.nextProducer=void 0:e.producers=void 0;}}function Dn$1(e){for(let t=e.producers;t!==void 0;t=t.nextProducer){let n=t.producer,r=t.lastReadVersion;if(r!==n.version||(fi$1(n),r!==n.version))return true}return false}function lt$2(e){if(Vt$2(e)){let t=e.producers;for(;t!==void 0;)t=gi(t);}e.producers=void 0,e.producersTail=void 0,e.consumers=void 0,e.consumersTail=void 0;}function Oc(e,t){let n=e.consumersTail,r=Vt$2(e);if(n!==void 0?(t.nextConsumer=n.nextConsumer,n.nextConsumer=t):(t.nextConsumer=void 0,e.consumers=t),t.prevConsumer=n,e.consumersTail=t,!r)for(let o=e.producers;o!==void 0;o=o.nextProducer)Oc(o.producer,o);}function gi(e){let t=e.producer,n=e.nextProducer,r=e.nextConsumer,o=e.prevConsumer;if(e.nextConsumer=void 0,e.prevConsumer=void 0,r!==void 0?r.prevConsumer=o:t.consumersTail=o,o!==void 0)o.nextConsumer=r;else if(t.consumers=r,!Vt$2(t)){let i=t.producers;for(;i!==void 0;)i=gi(i);}return n}function Vt$2(e){return e.consumerIsAlwaysLive||e.consumers!==void 0}function Qp(e,t){let n=t.producersTail;if(n!==void 0){let r=t.producers;do{if(r===e)return true;if(r===n)break;r=r.nextProducer;}while(r!==void 0)}return false}function yi(e,t){return Object.is(e,t)}function vn$1(e,t){let n=Object.create(Kp);n.computation=e;let r=()=>{if(fi$1(n),jt$1(n),n.value===yr)throw n.error;return n.value};return r[G]=n,r}var ci=Symbol(`UNSET`),ui$1=Symbol(`COMPUTING`),yr=Symbol(`ERRORED`),Kp=s(r({},Pt$2),{value:ci,dirty:true,error:null,equal:yi,kind:`computed`,producerMustRecompute(e){return e.value===ci||e.value===ui$1},producerRecomputeValue(e){if(e.value===ui$1)throw new Error(``);let t=e.value;e.value=ui$1;let n=Bt$2(e),r,o=false;try{r=e.computation(),v(null),o=t!==ci&&t!==yr&&r!==yr&&e.equal(t,r);}catch(i){r=yr,e.error=i;}finally{yn$1(e,n);}if(o){e.value=t;return}e.value=r,e.version++;}});function Jp(){throw new Error}var kc=Jp;function Fc(e){kc(e);}function Di(e){kc=e;}function vi$1(e,t){let n=Object.create(vr);n.value=e;let r=()=>Lc(n);return r[G]=n,[r,s=>Ht$2(n,s),s=>Pc(n,s)]}function Lc(e){return jt$1(e),e.value}function Ht$2(e,t){hi$1()||Fc(e),e.equal(e.value,t)||(e.value=t,eh(e));}function Pc(e,t){hi$1()||Fc(e),Ht$2(e,t(e.value));}var vr=s(r({},Pt$2),{equal:yi,value:void 0,kind:`signal`});function eh(e){e.version++,Ac(),pi(e);}var Ei=s(r({},Pt$2),{consumerIsAlwaysLive:true,consumerAllowSignalWrites:true,dirty:true,kind:`effect`});function Ci(e){if(e.dirty=false,e.version>0&&!Dn$1(e))return;e.version++;let t=Bt$2(e);try{e.cleanup(),e.fn();}finally{yn$1(e,t);}}var Ii;function Er(){return Ii}function Ae$1(e){let t=Ii;return Ii=e,t}var jc=Symbol(`NotFound`);function $t$1(e){return e===jc||e?.name===`ɵNotFound`}var Mr=`https://angular.dev/best-practices/security#preventing-cross-site-scripting-xss`,m=class extends Error{code;constructor(t,n){super(gt$2(t,n)),this.code=t;}};function th(e){return `NG0${Math.abs(e)}`}function gt$2(e,t){return `${th(e)}${t?`: `+t:``}`}var de$2=globalThis;function A$1(e){for(let t in e)if(e[t]===A$1)return t;throw Error(``)}function Uc(e,t){for(let n in t)t.hasOwnProperty(n)&&!e.hasOwnProperty(n)&&(e[n]=t[n]);}function br(e){if(typeof e==`string`)return e;if(Array.isArray(e))return `[${e.map(br).join(`, `)}]`;if(e==null)return ``+e;let t=e.overriddenName||e.name;if(t)return `${t}`;let n=e.toString();if(n==null)return ``+n;let r=n.indexOf(`
@@ -27,19 +27,19 @@ var Ct=new I$1(``,{factory:()=>at$1}),at$1=`always`;var yt=(()=>{class t{static
27
27
 
28
28
  var Ui={schedule(n,t){let e=setTimeout(n,t);return ()=>clearTimeout(e)}};function Qi(n){return n.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}function Zi(n){return !!n&&n.nodeType===Node.ELEMENT_NODE}var it;function Wi(n,t){if(!it){let e=Element.prototype;it=e.matches||e.matchesSelector||e.mozMatchesSelector||e.msMatchesSelector||e.oMatchesSelector||e.webkitMatchesSelector;}return n.nodeType===Node.ELEMENT_NODE?it.call(n,t):false}function qi(n){let t={};return n.forEach(({propName:e,templateName:i,transform:r})=>{t[Qi(i)]=[e,r];}),t}function Gi(n,t){return t.get(Po$1).resolveComponentFactory(n).inputs}function Ki(n,t){let e=n.childNodes,i=t.map(()=>[]),r=-1;t.some((s,l)=>s===`*`?(r=l,true):false);for(let s=0,l=e.length;s<l;++s){let c=e[s],f=Yi(c,t,r);f!==-1&&i[f].push(c);}return i}function Yi(n,t,e){let i=e;return Zi(n)&&t.some((r,s)=>r!==`*`&&Wi(n,r)?(i=s,true):false),i}var Ji=10,ot=class{componentFactory;inputMap=new Map;constructor(t,e){this.componentFactory=e.get(Po$1).resolveComponentFactory(t);for(let i of this.componentFactory.inputs)this.inputMap.set(i.propName,i.templateName);}create(t){return new nt(this.componentFactory,t,this.inputMap)}},nt=class{componentFactory;injector;inputMap;eventEmitters=new gr$1(1);events=this.eventEmitters.pipe(ii(t=>ve$2(...t)));componentRef=null;scheduledDestroyFn=null;initialInputValues=new Map;ngZone;elementZone;appRef;cdScheduler;constructor(t,e,i){this.componentFactory=t,this.injector=e,this.inputMap=i,this.ngZone=this.injector.get(X),this.appRef=this.injector.get(ct$1),this.cdScheduler=e.get(tt$1),this.elementZone=typeof Zone>`u`?null:this.ngZone.run(()=>Zone.current);}connect(t){this.runInZone(()=>{if(this.scheduledDestroyFn!==null){this.scheduledDestroyFn(),this.scheduledDestroyFn=null;return}this.componentRef===null&&this.initializeComponent(t);});}disconnect(){this.runInZone(()=>{this.componentRef===null||this.scheduledDestroyFn!==null||(this.scheduledDestroyFn=Ui.schedule(()=>{this.componentRef!==null&&(this.componentRef.destroy(),this.componentRef=null);},Ji));});}getInputValue(t){return this.runInZone(()=>this.componentRef===null?this.initialInputValues.get(t):this.componentRef.instance[t])}setInputValue(t,e){if(this.componentRef===null){this.initialInputValues.set(t,e);return}this.runInZone(()=>{this.componentRef.setInput(this.inputMap.get(t)??t,e),ay(this.componentRef.hostView)&&(cy(this.componentRef.changeDetectorRef),this.cdScheduler.notify(6));});}initializeComponent(t){let e=Z.create({providers:[],parent:this.injector}),i=Ki(t,this.componentFactory.ngContentSelectors);this.componentRef=this.componentFactory.create(e,i,t),this.initializeInputs(),this.initializeOutputs(this.componentRef),this.appRef.attachView(this.componentRef.hostView),this.componentRef.hostView.detectChanges();}initializeInputs(){for(let[t,e]of this.initialInputValues)this.setInputValue(t,e);this.initialInputValues.clear();}initializeOutputs(t){let e=this.componentFactory.outputs.map(({propName:i,templateName:r})=>{let s=t.instance[i];return new m$1(l=>{let c=s.subscribe(f=>l.next({name:r,value:f}));return ()=>c.unsubscribe()})});this.eventEmitters.next(e);}runInZone(t){return this.elementZone&&Zone.current!==this.elementZone?this.ngZone.run(t):t()}},rt=class extends HTMLElement{ngElementEventsSubscription=null};function ui(n,t){let e=Gi(n,t.injector),i=t.strategyFactory||new ot(n,t.injector),r=qi(e);class s extends rt{injector;static observedAttributes=Object.keys(r);get ngElementStrategy(){if(!this._ngElementStrategy){let c=this._ngElementStrategy=i.create(this.injector||t.injector);e.forEach(({propName:f,transform:w})=>{if(!this.hasOwnProperty(f))return;let ne=this[f];delete this[f],c.setInputValue(f,ne,w);});}return this._ngElementStrategy}_ngElementStrategy;constructor(c){super(),this.injector=c;}attributeChangedCallback(c,f,w,ne){let[Ee,Ge]=r[c];this.ngElementStrategy.setInputValue(Ee,w,Ge);}connectedCallback(){let c=false;this.ngElementStrategy.events&&(this.subscribeToEvents(),c=true),this.ngElementStrategy.connect(this),c||this.subscribeToEvents();}disconnectedCallback(){this._ngElementStrategy&&this._ngElementStrategy.disconnect(),this.ngElementEventsSubscription&&(this.ngElementEventsSubscription.unsubscribe(),this.ngElementEventsSubscription=null);}subscribeToEvents(){this.ngElementEventsSubscription=this.ngElementStrategy.events.subscribe(c=>{let f=new CustomEvent(c.name,{detail:c.value});this.dispatchEvent(f);});}}return e.forEach(({propName:l,transform:c,isSignal:f})=>{Object.defineProperty(s.prototype,l,{get(){let w=this.ngElementStrategy.getInputValue(l);return f&&Ga(w)?w():w},set(w){this.ngElementStrategy.setInputValue(l,w,c);},configurable:true,enumerable:true});}),s}var fi={providers:[Mv()]};var at=n=>({active:n});function Xi(n,t){if(n&1&&(Ka(0,`span`,4),uv(1),Ja()),n&2){let e=kD(2);ud(),Wf(e.collectionFilterConfig.subtitle);}}function eo(n,t){if(n&1&&(Ka(0,`div`,1)(1,`span`,3),uv(2),Ja(),vD(3,Xi,2,1,`span`,4),Ja()),n&2){let e=kD();ud(2),Wf(e.collectionFilterConfig.title),ud(),ED(e.collectionFilterConfig.subtitle?3:-1);}}function to(n,t){if(n&1&&(Ka(0,`span`,9),uv(1),Ja()),n&2){let e=kD(2).$implicit;yf(`ngClass`,Ev(2,at,hv(0))),ud(),ic(``,e.label,` `);}}function io(n,t){if(n&1){let e=ND();Ka(0,`div`,7),Sf(`mousedown`,function(){fu(e);let r=kD().$implicit,s=hv(0);return pu(kD(2).filterClick(r,s))}),Df(1,`img`,8),vD(2,to,2,4,`span`,9),Ja();}if(n&2){let e=kD().$implicit,i=hv(0);ud(),yf(`src`,e.imageSrc,Qg)(`ngClass`,Ev(3,at,i)),ud(),ED(e.label?2:-1);}}function oo(n,t){if(n&1){let e=ND();Ka(0,`button`,10),Sf(`click`,function(){fu(e);let r=kD().$implicit,s=hv(0);return pu(kD(2).filterClick(r,s))}),uv(1),Ja();}if(n&2){let e=kD().$implicit;yf(`ngClass`,Ev(2,at,hv(0))),ud(),ic(``,e.label,` `);}}function no(n,t){if(n&1&&(Qf(0),vD(1,io,3,5,`div`,5)(2,oo,2,4,`button`,6)),n&2){let e=t.$implicit,i=kD(2);pv(e.value===i.currentActiveParams()[e.key]),ud(),ED(i.collectionFilterConfig.template===i.CollectionFilterTemplate.IMAGE?1:i.collectionFilterConfig.template===i.CollectionFilterTemplate.BUTTON?2:-1);}}function ro(n,t){if(n&1&&wD(0,no,3,2,null,null,ID),n&2)_D(kD().collectionFilterConfig.options);}var Be=class n extends xe{currentActiveParams=Mt$2({});collectionFilterConfig;CollectionFilterTemplate=He$4;originalPushState;constructor(){super(),this.attachedURLStateChecker();}engagementTriggerReceived(t){this.collectionFilterConfig=t.content.collectionFilterConfig;}update(){}ngOnDestroy(){this.originalPushState&&(window.history.pushState=this.originalPushState);}filterClick(t,e=false){let i=new URL(window.location.href),r=e?`removed`:`applied`;if(e?i.searchParams.delete(t.key):i.searchParams.set(t.key,t.value),this.collectionFilterConfig.refreshPage){this.sendEvent(t,r),window.location.href=i.href;return}window.history.replaceState({path:i.href},``,i),this.sendEvent(t,r),this.checkAndUpdateParams();}sendEvent(t,e){let i=new Ir$1(`CE Trigger Clicked`,{filterApplication:e,filter:{key:t.key,value:t.value}},this.engagementTrigger);window.CooeeSDK.sendEvent(i);}attachedURLStateChecker(){this.checkAndUpdateParams(),this.originalPushState=window.history.pushState,window.history.pushState=new Proxy(window.history.pushState,{apply:(t,e,i)=>{t.apply(e,i),this.checkAndUpdateParams();}});}checkAndUpdateParams(){let t=new URL(window.location.href),e={};t.searchParams.forEach((i,r)=>{e[r]=i;}),this.currentActiveParams.set(e);}static ɵfac=function(e){return new(e||n)};static ɵcmp=of({type:n,selectors:[[`cooee-collection-filter`]],features:[Xf(lt()),za],decls:4,vars:2,consts:[[1,`wrapper`],[1,`filter-title-container`],[1,`options-container`],[1,`filter-title`],[1,`filter-subtitle`],[1,`image-filter-wrapper`],[`type`,`button`,1,`filter-button`,3,`ngClass`],[1,`image-filter-wrapper`,3,`mousedown`],[`alt`,`collection filter image`,1,`filter-image`,3,`src`,`ngClass`],[1,`filter-label`,3,`ngClass`],[`type`,`button`,1,`filter-button`,3,`click`,`ngClass`]],template:function(e,i){e&1&&(Ka(0,`div`,0),vD(1,eo,4,2,`div`,1),Ka(2,`div`,2),vD(3,ro,2,0),Ja()()),e&2&&(ud(),ED(i.collectionFilterConfig.title?1:-1),ud(2),ED(i.collectionFilterConfig.options.length?3:-1));},dependencies:[wE],styles:[`.wrapper{display:flex;flex-direction:column;gap:10px;padding:10px;justify-content:center;align-items:center}.filter-title-container{display:flex;flex-direction:column;gap:5px;align-items:center}.filter-title-container .filter-title{color:rgba(var(--lc-heading-color));font-family:var(--lc-heading-family),serif;font-weight:var(--lc-heading-weight);font-size:var(--lc-heading-size);transform:var(--lc-heading-transform);letter-spacing:var(--lc-heading-letter-spacing);text-align:var(--lc-heading-align)}.filter-title-container .filter-subtitle{color:rgba(var(--lc-subheading-color));font-weight:var(--lc-subheading-weight);font-size:var(--lc-subheading-size)}.options-container{display:flex;gap:35px;align-items:center;flex-wrap:wrap;justify-content:center}.options-container .image-filter-wrapper{display:flex;gap:10px;flex-direction:column;align-items:center;cursor:pointer}.options-container .image-filter-wrapper .filter-image{width:var(--lc-image-width, 80px);height:var(--lc-image-height, 80px);border-radius:40px}.options-container .image-filter-wrapper .filter-image.active{border:2px solid rgba(var(--lc-primary-color));padding:2px}.options-container .image-filter-wrapper .filter-label{font-size:var(--lc-text-size, 14px);color:rgba(var(--lc-text-color));font-weight:var(--lc-text-weight)}.options-container .image-filter-wrapper .filter-label.active{color:rgba(var(--lc-primary-color))}.options-container .filter-button{background-color:rgba(var(--lc-secondary-button-bg-color));font-size:var(--lc-button-size, 14px);color:rgba(var(--lc-secondary-button-color));border-color:rgba(var(--lc-secondary-button-border-color));font-weight:var(--lc-secondary-button-weight);border-radius:var(--lc-button-radius);font-family:var(--lc-button-family),serif;height:var(--lc-button-height, 36px);padding:0 16px}.options-container .filter-button:hover,.options-container .filter-button.active{background-color:rgba(var(--lc-primary-button-bg-color));color:rgba(var(--lc-primary-button-color));border-color:rgba(var(--lc-primary-button-border-color));font-weight:var(--lc-primary-button-weight)}
29
29
  `],encapsulation:3})};var Ne=class n{transform(t,e){return t?qe$2(t,r({},e)):null}static ɵfac=function(e){return new(e||n)};static ɵpipe=Ua({name:`cooeeDynamicVariables`,type:n,pure:true})};var st={};(function n(t,e,i,r){var s=!!(t.Worker&&t.Blob&&t.Promise&&t.OffscreenCanvas&&t.OffscreenCanvasRenderingContext2D&&t.HTMLCanvasElement&&t.HTMLCanvasElement.prototype.transferControlToOffscreen&&t.URL&&t.URL.createObjectURL),l=typeof Path2D==`function`&&typeof DOMMatrix==`function`,c=(function(){if(!t.OffscreenCanvas)return false;var a=new OffscreenCanvas(1,1),o=a.getContext(`2d`);o.fillRect(0,0,1,1);var p=a.transferToImageBitmap();try{o.createPattern(p,`no-repeat`);}catch{return false}return true})();function f(){}function w(a){var o=e.exports.Promise,p=o!==void 0?o:t.Promise;return typeof p==`function`?new p(a):(a(f,f),null)}var ne=(function(a,o){return {transform:function(p){if(a)return p;if(o.has(p))return o.get(p);var g=new OffscreenCanvas(p.width,p.height);return g.getContext(`2d`).drawImage(p,0,0),o.set(p,g),g},clear:function(){o.clear();}}})(c,new Map),Ee=(function(){var a=Math.floor(16.666666666666668),o,p,g={},v=0;return typeof requestAnimationFrame==`function`&&typeof cancelAnimationFrame==`function`?(o=function(y){var _=Math.random();return g[_]=requestAnimationFrame(function u(x){v===x||v+a-1<x?(v=x,delete g[_],y()):g[_]=requestAnimationFrame(u);}),_},p=function(y){g[y]&&cancelAnimationFrame(g[y]);}):(o=function(y){return setTimeout(y,a)},p=function(y){return clearTimeout(y)}),{frame:o,cancel:p}})(),Ge=(function(){var a,o,p={};function g(v){function y(_,u){v.postMessage({options:_||{},callback:u});}v.init=function(u){var x=u.transferControlToOffscreen();v.postMessage({canvas:x},[x]);},v.fire=function(u,x,V){if(o)return y(u,null),o;var k=Math.random().toString(36).slice(2);return o=w(function(T){function P(B){B.data.callback===k&&(delete p[k],v.removeEventListener(`message`,P),o=null,ne.clear(),V(),T());}v.addEventListener(`message`,P),y(u,k),p[k]=P.bind(null,{data:{callback:k}});}),o},v.reset=function(){v.postMessage({reset:true});for(var u in p)p[u](),delete p[u];};}return function(){if(a)return a;if(!i&&s){var v=[`var CONFETTI, SIZE = {}, module = {};`,`(`+n.toString()+`)(this, module, true, SIZE);`,`onmessage = function(msg) {`,` if (msg.data.options) {`,` CONFETTI(msg.data.options).then(function () {`,` if (msg.data.callback) {`,` postMessage({ callback: msg.data.callback });`,` }`,` });`,` } else if (msg.data.reset) {`,` CONFETTI && CONFETTI.reset();`,` } else if (msg.data.resize) {`,` SIZE.width = msg.data.resize.width;`,` SIZE.height = msg.data.resize.height;`,` } else if (msg.data.canvas) {`,` SIZE.width = msg.data.canvas.width;`,` SIZE.height = msg.data.canvas.height;`,` CONFETTI = module.exports.create(msg.data.canvas);`,` }`,`}`].join(`
30
- `);try{a=new Worker(URL.createObjectURL(new Blob([v])));}catch(y){return typeof console.warn==`function`&&console.warn(`🎊 Could not load worker`,y),null}g(a);}return a}})(),Ci={particleCount:50,angle:90,spread:45,startVelocity:45,decay:.9,gravity:1,drift:0,ticks:200,x:.5,y:.5,shapes:[`square`,`circle`],zIndex:100,colors:[`#26ccff`,`#a25afd`,`#ff5e7e`,`#88ff5a`,`#fcff42`,`#ffa62d`,`#ff36ff`],disableForReducedMotion:false,scalar:1};function yi(a,o){return o?o(a):a}function _i(a){return a!=null}function A(a,o,p){return yi(a&&_i(a[o])?a[o]:Ci[o],p)}function xi(a){return a<0?0:Math.floor(a)}function bi(a,o){return Math.floor(Math.random()*(o-a))+a}function Ke(a){return parseInt(a,16)}function wi(a){return a.map(Vi)}function Vi(a){var o=String(a).replace(/[^0-9a-f]/gi,``);return o.length<6&&(o=o[0]+o[0]+o[1]+o[1]+o[2]+o[2]),{r:Ke(o.substring(0,2)),g:Ke(o.substring(2,4)),b:Ke(o.substring(4,6))}}function Ti(a){var o=A(a,`origin`,Object);return o.x=A(o,`x`,Number),o.y=A(o,`y`,Number),o}function Ei(a){a.width=document.documentElement.clientWidth,a.height=document.documentElement.clientHeight;}function Si(a){var o=a.getBoundingClientRect();a.width=o.width,a.height=o.height;}function Ii(a){var o=document.createElement(`canvas`);return o.style.position=`fixed`,o.style.top=`0px`,o.style.left=`0px`,o.style.pointerEvents=`none`,o.style.zIndex=a,o}function Mi(a,o,p,g,v,y,_,u,x){a.save(),a.translate(o,p),a.rotate(y),a.scale(g,v),a.arc(0,0,1,_,u,x),a.restore();}function ki(a){var o=a.angle*(Math.PI/180),p=a.spread*(Math.PI/180);return {x:a.x,y:a.y,wobble:Math.random()*10,wobbleSpeed:Math.min(.11,Math.random()*.1+.05),velocity:a.startVelocity*.5+Math.random()*a.startVelocity,angle2D:-o+(.5*p-Math.random()*p),tiltAngle:(Math.random()*.5+.25)*Math.PI,color:a.color,shape:a.shape,tick:0,totalTicks:a.ticks,decay:a.decay,drift:a.drift,random:Math.random()+2,tiltSin:0,tiltCos:0,wobbleX:0,wobbleY:0,gravity:a.gravity*3,ovalScalar:.6,scalar:a.scalar,flat:a.flat}}function Pi(a,o){o.x+=Math.cos(o.angle2D)*o.velocity+o.drift,o.y+=Math.sin(o.angle2D)*o.velocity+o.gravity,o.velocity*=o.decay,o.flat?(o.wobble=0,o.wobbleX=o.x+10*o.scalar,o.wobbleY=o.y+10*o.scalar,o.tiltSin=0,o.tiltCos=0,o.random=1):(o.wobble+=o.wobbleSpeed,o.wobbleX=o.x+10*o.scalar*Math.cos(o.wobble),o.wobbleY=o.y+10*o.scalar*Math.sin(o.wobble),o.tiltAngle+=.1,o.tiltSin=Math.sin(o.tiltAngle),o.tiltCos=Math.cos(o.tiltAngle),o.random=Math.random()+2);var p=o.tick++/o.totalTicks,g=o.x+o.random*o.tiltCos,v=o.y+o.random*o.tiltSin,y=o.wobbleX+o.random*o.tiltCos,_=o.wobbleY+o.random*o.tiltSin;if(a.fillStyle=`rgba(`+o.color.r+`, `+o.color.g+`, `+o.color.b+`, `+(1-p)+`)`,a.beginPath(),l&&o.shape.type===`path`&&typeof o.shape.path==`string`&&Array.isArray(o.shape.matrix))a.fill(Di(o.shape.path,o.shape.matrix,o.x,o.y,Math.abs(y-g)*.1,Math.abs(_-v)*.1,Math.PI/10*o.wobble));else if(o.shape.type===`bitmap`){var u=Math.PI/10*o.wobble,x=Math.abs(y-g)*.1,V=Math.abs(_-v)*.1,k=o.shape.bitmap.width*o.scalar,T=o.shape.bitmap.height*o.scalar,P=new DOMMatrix([Math.cos(u)*x,Math.sin(u)*x,-Math.sin(u)*V,Math.cos(u)*V,o.x,o.y]);P.multiplySelf(new DOMMatrix(o.shape.matrix));var B=a.createPattern(ne.transform(o.shape.bitmap),`no-repeat`);B.setTransform(P),a.globalAlpha=1-p,a.fillStyle=B,a.fillRect(o.x-k/2,o.y-T/2,k,T),a.globalAlpha=1;}else if(o.shape===`circle`)a.ellipse?a.ellipse(o.x,o.y,Math.abs(y-g)*o.ovalScalar,Math.abs(_-v)*o.ovalScalar,Math.PI/10*o.wobble,0,2*Math.PI):Mi(a,o.x,o.y,Math.abs(y-g)*o.ovalScalar,Math.abs(_-v)*o.ovalScalar,Math.PI/10*o.wobble,0,2*Math.PI);else if(o.shape===`star`)for(var b=Math.PI/2*3,H=4*o.scalar,Z=8*o.scalar,W=o.x,re=o.y,fe=5,J=Math.PI/fe;fe--;)W=o.x+Math.cos(b)*Z,re=o.y+Math.sin(b)*Z,a.lineTo(W,re),b+=J,W=o.x+Math.cos(b)*H,re=o.y+Math.sin(b)*H,a.lineTo(W,re),b+=J;else a.moveTo(Math.floor(o.x),Math.floor(o.y)),a.lineTo(Math.floor(o.wobbleX),Math.floor(v)),a.lineTo(Math.floor(y),Math.floor(_)),a.lineTo(Math.floor(g),Math.floor(o.wobbleY));return a.closePath(),a.fill(),o.tick<o.totalTicks}function Fi(a,o,p,g,v){var y=o.slice(),_=a.getContext(`2d`),u,x,V=w(function(k){function T(){u=x=null,_.clearRect(0,0,g.width,g.height),ne.clear(),v(),k();}function P(){i&&!(g.width===r.width&&g.height===r.height)&&(g.width=a.width=r.width,g.height=a.height=r.height),!g.width&&!g.height&&(p(a),g.width=a.width,g.height=a.height),_.clearRect(0,0,g.width,g.height),y=y.filter(function(B){return Pi(_,B)}),y.length?u=Ee.frame(P):T();}u=Ee.frame(P),x=T;});return {addFettis:function(k){return y=y.concat(k),V},canvas:a,promise:V,reset:function(){u&&Ee.cancel(u),x&&x();}}}function lt(a,o){var p=!a,g=!!A(o||{},`resize`),v=false,y=A(o,`disableForReducedMotion`,Boolean),u=s&&!!A(o||{},`useWorker`)?Ge():null,x=p?Ei:Si,V=a&&u?!!a.__confetti_initialized:false,k=typeof matchMedia==`function`&&matchMedia(`(prefers-reduced-motion)`).matches,T;function P(b,H,Z){for(var W=A(b,`particleCount`,xi),re=A(b,`angle`,Number),fe=A(b,`spread`,Number),J=A(b,`startVelocity`,Number),Li=A(b,`decay`,Number),Oi=A(b,`gravity`,Number),Bi=A(b,`drift`,Number),dt=A(b,`colors`,wi),Ni=A(b,`ticks`,Number),pt=A(b,`shapes`),Hi=A(b,`scalar`),ji=!!A(b,`flat`),mt=Ti(b),ut=W,Je=[],$i=a.width*mt.x,zi=a.height*mt.y;ut--;)Je.push(ki({x:$i,y:zi,angle:re,spread:fe,startVelocity:J,color:dt[ut%dt.length],shape:pt[bi(0,pt.length)],ticks:Ni,decay:Li,gravity:Oi,drift:Bi,scalar:Hi,flat:ji}));return T?T.addFettis(Je):(T=Fi(a,Je,x,H,Z),T.promise)}function B(b){var H=y||A(b,`disableForReducedMotion`,Boolean),Z=A(b,`zIndex`,Number);if(H&&k)return w(function(J){J();});p&&T?a=T.canvas:p&&!a&&(a=Ii(Z),document.body.appendChild(a)),g&&!V&&x(a);var W={width:a.width,height:a.height};u&&!V&&u.init(a),V=true,u&&(a.__confetti_initialized=true);function re(){if(u){var J={getBoundingClientRect:function(){if(!p)return a.getBoundingClientRect()}};x(J),u.postMessage({resize:{width:J.width,height:J.height}});return}W.width=W.height=null;}function fe(){T=null,g&&(v=false,t.removeEventListener(`resize`,re)),p&&a&&(document.body.contains(a)&&document.body.removeChild(a),a=null,V=false);}return g&&!v&&(v=true,t.addEventListener(`resize`,re,false)),u?u.fire(b,W,fe):P(b,W,fe)}return B.reset=function(){u&&u.reset(),T&&T.reset();},B}var Ye;function ct(){return Ye||(Ye=lt(null,{useWorker:true,resize:true})),Ye}function Di(a,o,p,g,v,y,_){var u=new Path2D(a),x=new Path2D;x.addPath(u,new DOMMatrix(o));var V=new Path2D;return V.addPath(x,new DOMMatrix([Math.cos(_)*v,Math.sin(_)*v,-Math.sin(_)*y,Math.cos(_)*y,p,g])),V}function Ai(a){if(!l)throw new Error(`path confetti are not supported in this browser`);var o,p;typeof a==`string`?o=a:(o=a.path,p=a.matrix);var g=new Path2D(o),y=document.createElement(`canvas`).getContext(`2d`);if(!p){for(var _=1e3,u=_,x=_,V=0,k=0,T,P,B=0;B<_;B+=2)for(var b=0;b<_;b+=2)y.isPointInPath(g,B,b,`nonzero`)&&(u=Math.min(u,B),x=Math.min(x,b),V=Math.max(V,B),k=Math.max(k,b));T=V-u,P=k-x;var H=10,Z=Math.min(H/T,H/P);p=[Z,0,0,Z,-Math.round(T/2+u)*Z,-Math.round(P/2+x)*Z];}return {type:`path`,path:o,matrix:p}}function Ri(a){var o,p=1,g=`#000000`,v=`"Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji", "EmojiOne Color", "Android Emoji", "Twemoji Mozilla", "system emoji", sans-serif`;typeof a==`string`?o=a:(o=a.text,p=`scalar`in a?a.scalar:p,v=`fontFamily`in a?a.fontFamily:v,g=`color`in a?a.color:g);var y=10*p,_=``+y+`px `+v,u=new OffscreenCanvas(y,y),x=u.getContext(`2d`);x.font=_;var V=x.measureText(o),k=Math.ceil(V.actualBoundingBoxRight+V.actualBoundingBoxLeft),T=Math.ceil(V.actualBoundingBoxAscent+V.actualBoundingBoxDescent),P=2,B=V.actualBoundingBoxLeft+P,b=V.actualBoundingBoxAscent+P;k+=P+P,T+=P+P,u=new OffscreenCanvas(k,T),x=u.getContext(`2d`),x.font=_,x.fillStyle=g,x.fillText(o,B,b);var H=1/p;return {type:`bitmap`,bitmap:u.transferToImageBitmap(),matrix:[H,0,0,H,-k*H/2,-T*H/2]}}e.exports=function(){return ct().apply(this,arguments)},e.exports.reset=function(){ct().reset();},e.exports.create=lt,e.exports.shapeFromPath=Ai,e.exports.shapeFromText=Ri;})((function(){return typeof window<`u`?window:typeof self<`u`?self:this||{}})(),st,false);var hi=st.exports;st.exports.create;var He=class{static DEFAULTS={scalar:1.4,zIndex:1e4,shapes:[`circle`,`circle`,`square`],colors:[`#f51c8f`,`#2179e2`,`#d52dc8`,`#01a9d9`,`#78ff44`,`#fdff6a`]};static async basic(){await this.fire({particleCount:100,spread:70,origin:{y:.6}});}static async leftRight(t=100){let e=[],i=Date.now()+2e3,r=()=>{e.push(this.fire({angle:60,spread:55,origin:{x:0}}),this.fire({angle:120,spread:55,origin:{x:1}})),Date.now()<i&&t>0&&(requestAnimationFrame(r),t--);};r(),await Promise.all(e);}static async realistic(){await Promise.all([this.realisticFire(.25,{spread:26,startVelocity:55}),this.realisticFire(.2,{spread:60}),this.realisticFire(.35,{spread:100,decay:.91,scalar:.8}),this.realisticFire(.1,{spread:120,startVelocity:25,decay:.92,scalar:1.2}),this.realisticFire(.1,{spread:120,startVelocity:45})]);}static async fire(t){Object.assign(t,this.DEFAULTS,t),t.particleCount=t.particleCount??this.DEFAULTS.colors.length,await hi(t);}static async realisticFire(t,e){await this.fire(Object.assign({},{origin:{y:.7}},e,{particleCount:Math.floor(200*t)}));}};var ao=(n,t)=>t.minValue;function so(n,t){if(n&1&&(Xa(0,`div`,7),Iv(1,`safeHtml`)),n&2){let e=kD().$implicit;_f(`innerHTML`,_v(1,1,e.minValue+` Products`),Yg);}}function lo(n,t){if(n&1&&(Xa(0,`div`,7),Iv(1,`cooeeCurrency`),Iv(2,`safeHtml`)),n&2){let e=kD().$implicit;_f(`innerHTML`,_v(2,3,_v(1,1,e.minValue)),Yg);}}function co(n,t){if(n&1&&(Bo(0,`li`,6)(1,`div`),vD(2,so,2,3,`div`,7)(3,lo,3,5,`div`,7),Xa(4,`img`,8),Bo(5,`div`,9),uv(6),Vo$1()()()),n&2){let e=t.$implicit,i=kD(2);rc(`left`,e.calculatedAlignment+`%`),ud(2),ED((i.progressBarConfig==null?null:i.progressBarConfig.rewardBasis)===i.RewardBasis.ITEM_COUNT?2:3),ud(2),_f(`src`,i.getIconURL(e),Qg),ud(2),Wf(e.label);}}function po(n,t){if(n&1&&(Xa(0,`div`,0),Iv(1,`cooeeDynamicVariables`),Iv(2,`safeHtml`),Bo(3,`div`,1)(4,`ul`,2)(5,`div`,3),Xa(6,`div`,4),Vo$1(),wD(7,co,7,5,`li`,5,ao),Vo$1()()),n&2){let e=kD(),i=e.calculatedState();_f(`innerHTML`,_v(2,6,Tv(1,3,i.nextMilestone?i.nextMilestone.reachingText:i.lastMilestone.reachedText,e.localDynamicVariables())),Yg),ud(6),rc(`width`,i.cartValuePercentage+`%`),ud(),_D(i.milestones);}}var je=class n extends xe{cart;localDynamicVariables=Mt$2({});calculatedState=Mt$2({});progressBarConfig;RewardBasis=Re$2;constructor(){super();}engagementTriggerReceived(t){this.progressBarConfig=t.progressBarConfig;}ngOnInit(){super.ngOnInit(),this.calculateMilestonesSilently();}update(){this.calculateMilestonesSilently();}getIconURL(t){return t.rewardType===Fe$2.FREE_SHIPPING?`https://img.icons8.com/ios-filled/50/FFFFFF/free-shipping.png`:t.rewardType===Fe$2.DISCOUNT?`https://img.icons8.com/ios-glyphs/30/FFFFFF/sale-price-tag.png`:t.rewardType===Fe$2.FREE_AUTO_GIFT?`https://img.icons8.com/ios-filled/50/FFFFFF/gift--v1.png`:``}calculateMilestonesSilently(){this.calculateMilestones().catch(t=>Y$1.error(t));}async calculateMilestones(){let t=this.engagementTrigger,e=this.progressBarConfig;if(!e?.milestones?.length){Y$1.warn(`Milestones not available in progress bar config`,t);return}let i=await this.cart.getNormalisedCart(),r=e.milestones.at(-1),s=e?.reachedAmountOrCount??i.originalAmount,l=e.totalProgress??0;Y$1.verbose(`Cart value:`,s,`, percentage: ${l}%`),this.celebrate(t,s);let c={milestonesReady:true,cartValuePercentage:l,milestones:e.milestones},f=e.milestones.find(w=>!w.reached);if(f){let w=Ar$1(f.minValue-s);if(e.rewardBasis===`ITEM_COUNT`){let ne=f.minValue-s;w=`${ne} ${ne===1?`product`:`products`}`;}this.localDynamicVariables.set({amount_left:w}),c.nextMilestone=f,this.calculatedState.set(c);return}c.lastMilestone=r,this.calculatedState.set(c);}celebrate(t,e){let s=[...t.progressBarConfig.milestones].reverse().find(f=>f.minValue<e);if(!s)return;let l=`lc/en/${t.shortID}/${s.minValue}`;sessionStorage.getItem(l)||(sessionStorage.setItem(l,`1`),this.progressBarConfig?.noConfetti||He.realistic());}static ɵfac=function(e){return new(e||n)};static ɵcmp=of({type:n,selectors:[[`cooee-progressbar`]],inputs:{cart:`cart`},features:[Xf(lt()),za],decls:1,vars:1,consts:[[1,`heading`,3,`innerHTML`],[1,`milestone-container`],[1,`milestone-list`],[1,`untracked-path`],[1,`tracked-path`],[1,`milestone-list-item`,3,`left`],[1,`milestone-list-item`],[1,`milestone-value`,3,`innerHTML`],[`width`,`20`,`height`,`20`,`alt`,`milestone icon`,1,`milestone-icon`,3,`src`],[1,`milestone-label`]],template:function(e,i){e&1&&vD(0,po,9,8),e&2&&ED(i.calculatedState().milestonesReady?0:-1);},dependencies:[Ne,a,oe],styles:[`:host{display:block;padding:10px;background:linear-gradient(0deg,rgba(var(--lc-primary-color),.1) 0%,transparent 100%)}.milestone-container{width:95%;margin:8px 0}.heading{font-weight:500;text-align:center;font-size:12px}.milestone-list{display:flex;align-items:center;position:relative;font-size:10px;font-weight:500}.untracked-path{width:100%;background-color:#e5e7eb;height:4px;position:absolute}.tracked-path{background-color:rgba(var(--lc-primary-color));height:100%;display:block;transition:width .5s ease-in-out}.milestone-list{padding:0;margin:0}.milestone-list-item{position:relative;display:flex;flex-direction:column;align-items:center;height:75px}.milestone-list-item>div{display:flex;flex-direction:column;align-items:center;justify-content:space-between;position:absolute;height:100%;width:100px}.milestone-icon{padding:5px;border-radius:1000px;background-color:rgba(var(--lc-primary-color))}
30
+ `);try{a=new Worker(URL.createObjectURL(new Blob([v])));}catch(y){return typeof console.warn==`function`&&console.warn(`🎊 Could not load worker`,y),null}g(a);}return a}})(),Ci={particleCount:50,angle:90,spread:45,startVelocity:45,decay:.9,gravity:1,drift:0,ticks:200,x:.5,y:.5,shapes:[`square`,`circle`],zIndex:100,colors:[`#26ccff`,`#a25afd`,`#ff5e7e`,`#88ff5a`,`#fcff42`,`#ffa62d`,`#ff36ff`],disableForReducedMotion:false,scalar:1};function yi(a,o){return o?o(a):a}function _i(a){return a!=null}function A(a,o,p){return yi(a&&_i(a[o])?a[o]:Ci[o],p)}function xi(a){return a<0?0:Math.floor(a)}function bi(a,o){return Math.floor(Math.random()*(o-a))+a}function Ke(a){return parseInt(a,16)}function wi(a){return a.map(Vi)}function Vi(a){var o=String(a).replace(/[^0-9a-f]/gi,``);return o.length<6&&(o=o[0]+o[0]+o[1]+o[1]+o[2]+o[2]),{r:Ke(o.substring(0,2)),g:Ke(o.substring(2,4)),b:Ke(o.substring(4,6))}}function Ti(a){var o=A(a,`origin`,Object);return o.x=A(o,`x`,Number),o.y=A(o,`y`,Number),o}function Ei(a){a.width=document.documentElement.clientWidth,a.height=document.documentElement.clientHeight;}function Si(a){var o=a.getBoundingClientRect();a.width=o.width,a.height=o.height;}function Ii(a){var o=document.createElement(`canvas`);return o.style.position=`fixed`,o.style.top=`0px`,o.style.left=`0px`,o.style.pointerEvents=`none`,o.style.zIndex=a,o}function Mi(a,o,p,g,v,y,_,u,x){a.save(),a.translate(o,p),a.rotate(y),a.scale(g,v),a.arc(0,0,1,_,u,x),a.restore();}function ki(a){var o=a.angle*(Math.PI/180),p=a.spread*(Math.PI/180);return {x:a.x,y:a.y,wobble:Math.random()*10,wobbleSpeed:Math.min(.11,Math.random()*.1+.05),velocity:a.startVelocity*.5+Math.random()*a.startVelocity,angle2D:-o+(.5*p-Math.random()*p),tiltAngle:(Math.random()*.5+.25)*Math.PI,color:a.color,shape:a.shape,tick:0,totalTicks:a.ticks,decay:a.decay,drift:a.drift,random:Math.random()+2,tiltSin:0,tiltCos:0,wobbleX:0,wobbleY:0,gravity:a.gravity*3,ovalScalar:.6,scalar:a.scalar,flat:a.flat}}function Pi(a,o){o.x+=Math.cos(o.angle2D)*o.velocity+o.drift,o.y+=Math.sin(o.angle2D)*o.velocity+o.gravity,o.velocity*=o.decay,o.flat?(o.wobble=0,o.wobbleX=o.x+10*o.scalar,o.wobbleY=o.y+10*o.scalar,o.tiltSin=0,o.tiltCos=0,o.random=1):(o.wobble+=o.wobbleSpeed,o.wobbleX=o.x+10*o.scalar*Math.cos(o.wobble),o.wobbleY=o.y+10*o.scalar*Math.sin(o.wobble),o.tiltAngle+=.1,o.tiltSin=Math.sin(o.tiltAngle),o.tiltCos=Math.cos(o.tiltAngle),o.random=Math.random()+2);var p=o.tick++/o.totalTicks,g=o.x+o.random*o.tiltCos,v=o.y+o.random*o.tiltSin,y=o.wobbleX+o.random*o.tiltCos,_=o.wobbleY+o.random*o.tiltSin;if(a.fillStyle=`rgba(`+o.color.r+`, `+o.color.g+`, `+o.color.b+`, `+(1-p)+`)`,a.beginPath(),l&&o.shape.type===`path`&&typeof o.shape.path==`string`&&Array.isArray(o.shape.matrix))a.fill(Di(o.shape.path,o.shape.matrix,o.x,o.y,Math.abs(y-g)*.1,Math.abs(_-v)*.1,Math.PI/10*o.wobble));else if(o.shape.type===`bitmap`){var u=Math.PI/10*o.wobble,x=Math.abs(y-g)*.1,V=Math.abs(_-v)*.1,k=o.shape.bitmap.width*o.scalar,T=o.shape.bitmap.height*o.scalar,P=new DOMMatrix([Math.cos(u)*x,Math.sin(u)*x,-Math.sin(u)*V,Math.cos(u)*V,o.x,o.y]);P.multiplySelf(new DOMMatrix(o.shape.matrix));var B=a.createPattern(ne.transform(o.shape.bitmap),`no-repeat`);B.setTransform(P),a.globalAlpha=1-p,a.fillStyle=B,a.fillRect(o.x-k/2,o.y-T/2,k,T),a.globalAlpha=1;}else if(o.shape===`circle`)a.ellipse?a.ellipse(o.x,o.y,Math.abs(y-g)*o.ovalScalar,Math.abs(_-v)*o.ovalScalar,Math.PI/10*o.wobble,0,2*Math.PI):Mi(a,o.x,o.y,Math.abs(y-g)*o.ovalScalar,Math.abs(_-v)*o.ovalScalar,Math.PI/10*o.wobble,0,2*Math.PI);else if(o.shape===`star`)for(var b=Math.PI/2*3,H=4*o.scalar,Z=8*o.scalar,W=o.x,re=o.y,fe=5,J=Math.PI/fe;fe--;)W=o.x+Math.cos(b)*Z,re=o.y+Math.sin(b)*Z,a.lineTo(W,re),b+=J,W=o.x+Math.cos(b)*H,re=o.y+Math.sin(b)*H,a.lineTo(W,re),b+=J;else a.moveTo(Math.floor(o.x),Math.floor(o.y)),a.lineTo(Math.floor(o.wobbleX),Math.floor(v)),a.lineTo(Math.floor(y),Math.floor(_)),a.lineTo(Math.floor(g),Math.floor(o.wobbleY));return a.closePath(),a.fill(),o.tick<o.totalTicks}function Fi(a,o,p,g,v){var y=o.slice(),_=a.getContext(`2d`),u,x,V=w(function(k){function T(){u=x=null,_.clearRect(0,0,g.width,g.height),ne.clear(),v(),k();}function P(){i&&!(g.width===r.width&&g.height===r.height)&&(g.width=a.width=r.width,g.height=a.height=r.height),!g.width&&!g.height&&(p(a),g.width=a.width,g.height=a.height),_.clearRect(0,0,g.width,g.height),y=y.filter(function(B){return Pi(_,B)}),y.length?u=Ee.frame(P):T();}u=Ee.frame(P),x=T;});return {addFettis:function(k){return y=y.concat(k),V},canvas:a,promise:V,reset:function(){u&&Ee.cancel(u),x&&x();}}}function lt(a,o){var p=!a,g=!!A(o||{},`resize`),v=false,y=A(o,`disableForReducedMotion`,Boolean),u=s&&!!A(o||{},`useWorker`)?Ge():null,x=p?Ei:Si,V=a&&u?!!a.__confetti_initialized:false,k=typeof matchMedia==`function`&&matchMedia(`(prefers-reduced-motion)`).matches,T;function P(b,H,Z){for(var W=A(b,`particleCount`,xi),re=A(b,`angle`,Number),fe=A(b,`spread`,Number),J=A(b,`startVelocity`,Number),Li=A(b,`decay`,Number),Oi=A(b,`gravity`,Number),Bi=A(b,`drift`,Number),dt=A(b,`colors`,wi),Ni=A(b,`ticks`,Number),pt=A(b,`shapes`),Hi=A(b,`scalar`),ji=!!A(b,`flat`),mt=Ti(b),ut=W,Je=[],$i=a.width*mt.x,zi=a.height*mt.y;ut--;)Je.push(ki({x:$i,y:zi,angle:re,spread:fe,startVelocity:J,color:dt[ut%dt.length],shape:pt[bi(0,pt.length)],ticks:Ni,decay:Li,gravity:Oi,drift:Bi,scalar:Hi,flat:ji}));return T?T.addFettis(Je):(T=Fi(a,Je,x,H,Z),T.promise)}function B(b){var H=y||A(b,`disableForReducedMotion`,Boolean),Z=A(b,`zIndex`,Number);if(H&&k)return w(function(J){J();});p&&T?a=T.canvas:p&&!a&&(a=Ii(Z),document.body.appendChild(a)),g&&!V&&x(a);var W={width:a.width,height:a.height};u&&!V&&u.init(a),V=true,u&&(a.__confetti_initialized=true);function re(){if(u){var J={getBoundingClientRect:function(){if(!p)return a.getBoundingClientRect()}};x(J),u.postMessage({resize:{width:J.width,height:J.height}});return}W.width=W.height=null;}function fe(){T=null,g&&(v=false,t.removeEventListener(`resize`,re)),p&&a&&(document.body.contains(a)&&document.body.removeChild(a),a=null,V=false);}return g&&!v&&(v=true,t.addEventListener(`resize`,re,false)),u?u.fire(b,W,fe):P(b,W,fe)}return B.reset=function(){u&&u.reset(),T&&T.reset();},B}var Ye;function ct(){return Ye||(Ye=lt(null,{useWorker:true,resize:true})),Ye}function Di(a,o,p,g,v,y,_){var u=new Path2D(a),x=new Path2D;x.addPath(u,new DOMMatrix(o));var V=new Path2D;return V.addPath(x,new DOMMatrix([Math.cos(_)*v,Math.sin(_)*v,-Math.sin(_)*y,Math.cos(_)*y,p,g])),V}function Ai(a){if(!l)throw new Error(`path confetti are not supported in this browser`);var o,p;typeof a==`string`?o=a:(o=a.path,p=a.matrix);var g=new Path2D(o),y=document.createElement(`canvas`).getContext(`2d`);if(!p){for(var _=1e3,u=_,x=_,V=0,k=0,T,P,B=0;B<_;B+=2)for(var b=0;b<_;b+=2)y.isPointInPath(g,B,b,`nonzero`)&&(u=Math.min(u,B),x=Math.min(x,b),V=Math.max(V,B),k=Math.max(k,b));T=V-u,P=k-x;var H=10,Z=Math.min(H/T,H/P);p=[Z,0,0,Z,-Math.round(T/2+u)*Z,-Math.round(P/2+x)*Z];}return {type:`path`,path:o,matrix:p}}function Ri(a){var o,p=1,g=`#000000`,v=`"Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji", "EmojiOne Color", "Android Emoji", "Twemoji Mozilla", "system emoji", sans-serif`;typeof a==`string`?o=a:(o=a.text,p=`scalar`in a?a.scalar:p,v=`fontFamily`in a?a.fontFamily:v,g=`color`in a?a.color:g);var y=10*p,_=``+y+`px `+v,u=new OffscreenCanvas(y,y),x=u.getContext(`2d`);x.font=_;var V=x.measureText(o),k=Math.ceil(V.actualBoundingBoxRight+V.actualBoundingBoxLeft),T=Math.ceil(V.actualBoundingBoxAscent+V.actualBoundingBoxDescent),P=2,B=V.actualBoundingBoxLeft+P,b=V.actualBoundingBoxAscent+P;k+=P+P,T+=P+P,u=new OffscreenCanvas(k,T),x=u.getContext(`2d`),x.font=_,x.fillStyle=g,x.fillText(o,B,b);var H=1/p;return {type:`bitmap`,bitmap:u.transferToImageBitmap(),matrix:[H,0,0,H,-k*H/2,-T*H/2]}}e.exports=function(){return ct().apply(this,arguments)},e.exports.reset=function(){ct().reset();},e.exports.create=lt,e.exports.shapeFromPath=Ai,e.exports.shapeFromText=Ri;})((function(){return typeof window<`u`?window:typeof self<`u`?self:this||{}})(),st,false);var hi=st.exports;st.exports.create;var He=class{static DEFAULTS={scalar:1.4,zIndex:1e4,shapes:[`circle`,`circle`,`square`],colors:[`#f51c8f`,`#2179e2`,`#d52dc8`,`#01a9d9`,`#78ff44`,`#fdff6a`]};static async basic(){await this.fire({particleCount:100,spread:70,origin:{y:.6}});}static async leftRight(t=100){let e=[],i=Date.now()+2e3,r=()=>{e.push(this.fire({angle:60,spread:55,origin:{x:0}}),this.fire({angle:120,spread:55,origin:{x:1}})),Date.now()<i&&t>0&&(requestAnimationFrame(r),t--);};r(),await Promise.all(e);}static async realistic(){await Promise.all([this.realisticFire(.25,{spread:26,startVelocity:55}),this.realisticFire(.2,{spread:60}),this.realisticFire(.35,{spread:100,decay:.91,scalar:.8}),this.realisticFire(.1,{spread:120,startVelocity:25,decay:.92,scalar:1.2}),this.realisticFire(.1,{spread:120,startVelocity:45})]);}static async fire(t){Object.assign(t,this.DEFAULTS,t),t.particleCount=t.particleCount??this.DEFAULTS.colors.length,await hi(t);}static async realisticFire(t,e){await this.fire(Object.assign({},{origin:{y:.7}},e,{particleCount:Math.floor(200*t)}));}};var ao=(n,t)=>t.minValue;function so(n,t){if(n&1&&(Xa(0,`div`,7),Iv(1,`safeHtml`)),n&2){let e=kD().$implicit;_f(`innerHTML`,_v(1,1,e.minValue+` Products`),Yg);}}function lo(n,t){if(n&1&&(Xa(0,`div`,7),Iv(1,`cooeeCurrency`),Iv(2,`safeHtml`)),n&2){let e=kD().$implicit;_f(`innerHTML`,_v(2,3,_v(1,1,e.minValue)),Yg);}}function co(n,t){if(n&1&&(Bo(0,`li`,6)(1,`div`),vD(2,so,2,3,`div`,7)(3,lo,3,5,`div`,7),Xa(4,`img`,8),Bo(5,`div`,9),uv(6),Vo$1()()()),n&2){let e=t.$implicit,i=kD(2);rc(`left`,e.calculatedAlignment+`%`),ud(2),ED((i.progressBarConfig==null?null:i.progressBarConfig.rewardBasis)===i.RewardBasis.ITEM_COUNT?2:3),ud(2),_f(`src`,i.getIconURL(e),Qg),ud(2),Wf(e.label);}}function po(n,t){if(n&1&&(Xa(0,`div`,0),Iv(1,`cooeeDynamicVariables`),Iv(2,`safeHtml`),Bo(3,`div`,1)(4,`ul`,2)(5,`div`,3),Xa(6,`div`,4),Vo$1(),wD(7,co,7,5,`li`,5,ao),Vo$1()()),n&2){let e=kD(),i=e.calculatedState();_f(`innerHTML`,_v(2,6,Tv(1,3,i.nextMilestone?i.nextMilestone.reachingText:i.lastMilestone.reachedText,e.localDynamicVariables())),Yg),ud(6),rc(`width`,i.cartValuePercentage+`%`),ud(),_D(i.milestones);}}var je=class n extends xe{cart;localDynamicVariables=Mt$2({});calculatedState=Mt$2({});progressBarConfig;RewardBasis=Re$2;constructor(){super();}engagementTriggerReceived(t){this.progressBarConfig=t.progressBarConfig;}ngOnInit(){super.ngOnInit(),this.calculateMilestonesSilently();}update(){this.calculateMilestonesSilently();}getIconURL(t){return (this.calculatedState().cartValuePercentage??0)>=t.calculatedAlignment&&t.images?.active?t.images.active:t.images?.base?t.images.base:t.rewardType===Fe$2.FREE_SHIPPING?`https://img.icons8.com/ios-filled/50/FFFFFF/free-shipping.png`:t.rewardType===Fe$2.DISCOUNT?`https://img.icons8.com/ios-glyphs/30/FFFFFF/sale-price-tag.png`:t.rewardType===Fe$2.FREE_AUTO_GIFT?`https://img.icons8.com/ios-filled/50/FFFFFF/gift--v1.png`:``}calculateMilestonesSilently(){this.calculateMilestones().catch(t=>Y$1.error(t));}async calculateMilestones(){let t=this.engagementTrigger,e=this.progressBarConfig;if(!e?.milestones?.length){Y$1.warn(`Milestones not available in progress bar config`,t);return}let i=await this.cart.getNormalisedCart(),r=e.milestones.at(-1),s=e?.reachedAmountOrCount??i.originalAmount,l=e.totalProgress??0;Y$1.verbose(`Cart value:`,s,`, percentage: ${l}%`),this.celebrate(t,s);let c={milestonesReady:true,cartValuePercentage:l,milestones:e.milestones},f=e.milestones.find(w=>!w.reached);if(f){let w=Ar$1(f.minValue-s);if(e.rewardBasis===`ITEM_COUNT`){let ne=f.minValue-s;w=`${ne} ${ne===1?`product`:`products`}`;}this.localDynamicVariables.set({amount_left:w}),c.nextMilestone=f,this.calculatedState.set(c);return}c.lastMilestone=r,this.calculatedState.set(c);}celebrate(t,e){let s=[...t.progressBarConfig.milestones].reverse().find(f=>f.minValue<e);if(!s)return;let l=`lc/en/${t.shortID}/${s.minValue}`;sessionStorage.getItem(l)||(sessionStorage.setItem(l,`1`),this.progressBarConfig?.noConfetti||He.realistic());}static ɵfac=function(e){return new(e||n)};static ɵcmp=of({type:n,selectors:[[`cooee-progressbar`]],inputs:{cart:`cart`},features:[Xf(lt()),za],decls:1,vars:1,consts:[[1,`heading`,3,`innerHTML`],[1,`milestone-container`],[1,`milestone-list`],[1,`untracked-path`],[1,`tracked-path`],[1,`milestone-list-item`,3,`left`],[1,`milestone-list-item`],[1,`milestone-value`,3,`innerHTML`],[`width`,`20`,`height`,`20`,`alt`,`milestone icon`,1,`milestone-icon`,3,`src`],[1,`milestone-label`]],template:function(e,i){e&1&&vD(0,po,9,8),e&2&&ED(i.calculatedState().milestonesReady?0:-1);},dependencies:[Ne,a,oe],styles:[`:host{display:block;padding:10px;background:linear-gradient(0deg,rgba(var(--lc-primary-color),.1) 0%,transparent 100%)}.milestone-container{width:95%;margin:8px 0}.heading{font-weight:500;text-align:center;font-size:12px}.milestone-list{display:flex;align-items:center;position:relative;font-size:10px;font-weight:500}.untracked-path{width:100%;background-color:#e5e7eb;height:4px;position:absolute}.tracked-path{background-color:rgba(var(--lc-primary-color));height:100%;display:block;transition:width .5s ease-in-out}.milestone-list{padding:0;margin:0}.milestone-list-item{position:relative;display:flex;flex-direction:column;align-items:center;height:75px}.milestone-list-item>div{display:flex;flex-direction:column;align-items:center;justify-content:space-between;position:absolute;height:100%;width:100px}.milestone-icon{padding:5px;border-radius:1000px;background-color:rgba(var(--lc-primary-color))}
31
31
  `],encapsulation:3})};var mo=[`numberVariable`],$e=class n extends xe{numberSlot;savingsBarConfig;textParts=Mt$2({start:``,end:``});globalIntervals=[];constructor(){super();}ngAfterViewInit(){this.updateUIVars();}engagementTriggerReceived(t){this.savingsBarConfig=t.content.savingsBarConfig,this.elementRef.nativeElement.classList.add(`lc_`+t.entryAnimation?.toLowerCase()),this.savingsBarConfig.iconURL&&this.elementRef.nativeElement.style.setProperty(`--lc-discount-icon`,this.savingsBarConfig.iconURL);}update(){this.updateUIVars();}updateUIVars(){let t=r(r({},this.engagementTrigger.getCartMagicVariables()),xn$2(`total_savings`,this.savingsBarConfig.totalSavings)),e=qe$2(this.savingsBarConfig.text,{cart:t},this.triggerContext),i=e.match(/[\d.,]+/)?.[0];if(!i){Y$1.error(`No amount found in text`,e);return}let[r$1,s]=e.split(i);this.textParts.set({start:r$1,end:s}),this.savingsBarConfig.animateNumber?this.runAnimation(i):this.numberSlot.nativeElement.innerHTML=i;}runSlotMachineAnimation(t=`0`){let e=this.numberSlot.nativeElement;e.innerHTML=``;let i=this.savingsBarConfig.animationDuration/t.length;this.clearPreviousIntervals();for(let r=0;r<t.length;r++){let s=document.createElement(`div`);s.className=`digit`,s.style.display=`inline-block`,e.appendChild(s);let l=setInterval(()=>{s.innerHTML=`<div>${Math.floor(Math.random()*10)}</div>`;},50);this.globalIntervals.push(l),setTimeout(()=>{clearInterval(l);s.innerHTML=`${t?.[r]??Math.floor(Math.random()*10)}`;},(r+1)*i);}}clearPreviousIntervals(){this.globalIntervals.forEach(clearInterval),this.globalIntervals=[];}runIncrementalAnimation(t){let e=performance.now(),i=r=>{let s=Math.min((r-e)/this.savingsBarConfig.animationDuration,1);this.numberSlot.nativeElement.innerHTML=Math.floor(t*s).toString(),s<1&&requestAnimationFrame(i);};requestAnimationFrame(i);}runAnimation(t){this.savingsBarConfig.animation===`SLOT_MACHINE`?this.runSlotMachineAnimation(t):this.savingsBarConfig.animation===`INCREMENTAL`&&this.runIncrementalAnimation(Number(t));}static ɵfac=function(e){return new(e||n)};static ɵcmp=of({type:n,selectors:[[`cooee-savings-bar`]],viewQuery:function(e,i){if(e&1&&nc(mo,5),e&2){let r;Rf(r=xf())&&(i.numberSlot=r.first);}},features:[za],decls:6,vars:2,consts:[[`numberVariable`,``],[1,`container`],[1,`icon`],[1,`primary-text`,3,`innerHTML`],[1,`counter-text`],[1,`final-text`,3,`innerHTML`]],template:function(e,i){e&1&&(Bo(0,`div`,1),Xa(1,`div`,2)(2,`div`,3)(3,`div`,4,0)(5,`div`,5),Vo$1()),e&2&&(ud(2),_f(`innerHTML`,i.textParts().start,Yg),ud(3),_f(`innerHTML`,i.textParts().end,Yg));},styles:[`:host{display:block}.container{white-space:pre;display:flex;justify-content:center;align-items:center;background-color:rgba(var(--lc-primary-button-bg-color, 0 162 81));color:rgba(var(--lc-primary-button-color, 255 255 255));padding:8px;border-radius:4px 4px 0 0;overflow:hidden}.container .icon{background-image:var(--lc-discount-icon, url(https://img.icons8.com/ios-glyphs/30/FFFFFF/discount--v1.png));background-position:center;background-size:cover;height:20px;width:20px;margin-right:2px}
32
32
  `],encapsulation:3})};var ze=class n extends xe{item;data=g(Ye);dialogRef=g(W);ItemDetailLayout=$e$2;constructor(){super(),this.triggerContext=this.data.triggerContext,this.item=this.data.item;}close(){this.dialogRef.close();}engagementTriggerReceived(t){}update(){}static ɵfac=function(e){return new(e||n)};static ɵcmp=of({type:n,selectors:[[`cooee-item-quick-view`]],features:[Xf(lt()),za],decls:1,vars:2,consts:[[3,`closeClick`,`item`,`layout`]],template:function(e,i){e&1&&(Ka(0,`cooee-item-detail`,0),Sf(`closeClick`,function(){return i.close()}),Ja()),e&2&&yf(`item`,i.item)(`layout`,i.ItemDetailLayout.TWO_PANE);},dependencies:[ut],styles:[`:host{display:flex;align-items:center;justify-content:center;height:100%}@media(min-width:768px){cooee-item-detail{max-width:900px;max-height:80vh;border-radius:var(--lc-card-radius)}}
33
33
  `],encapsulation:3})};var Ue=class n{dialog=g(Ro);dialogRef;constructor(){}showItemQuickView(t,e){this.dialogRef=this.dialog.open(ze,{width:`100vw`,height:`100dvh`,backdropClass:[`letscooee-backdrop`],data:{item:e,triggerContext:t}});}static ɵfac=function(e){return new(e||n)};static ɵprov=C({token:n,factory:n.ɵfac,providedIn:`root`})};var uo=(n,t)=>({enter:n,exit:t});function fo(n,t){if(n&1&&(Ka(0,`div`,7),uv(1),Ja(),Ka(2,`div`,8),uv(3),Ja()),n&2){let e=kD(2);ud(),ic(` `,e.getCurrency(e.selectedVariant().price.cmp),` `),ud(2),ic(` `,e.getDiscountPercentage(e.selectedVariant().price),`% off `);}}function go(n,t){if(n&1&&(Ka(0,`div`,6),uv(1),Ja()),n&2){let e=kD(2);ud(),ic(` `,e.stickyATCConfig.leftText,` `);}}function ho(n,t){if(n&1&&(Ka(0,`div`,1)(1,`div`,5),uv(2),Ja(),vD(3,fo,4,2),vD(4,go,2,1,`div`,6),Ja()),n&2){let e=kD();ud(2),ic(` `,e.getCurrency(e.selectedVariant().price.d),` `),ud(),ED(e.selectedVariant().price.cmp?3:-1),ud(),ED(e.stickyATCConfig.leftText?4:-1);}}function vo(n,t){if(n&1&&(Ka(0,`div`,9),uv(1),Ja()),n&2){let e=t.$implicit,i=t.$index;kD(2);let r=hv(5);yf(`ngClass`,Cv(2,uo,i===r.currentIndex,i===r.previousIndex)),ud(),ic(` `,e,` `);}}function Co(n,t){if(n&1&&(Ka(0,`div`,4),wD(1,vo,2,5,`div`,9,ID),Ja()),n&2){kD();let e=hv(5);ud(),_D(e.features);}}var Qe=class n extends xe{currentItem;stickyATCConfig;selectedVariant=Mt$2(void 0);featureSlider=Mt$2({features:[],currentIndex:0});constructor(){super();}onVariantChange(t){this.currentItem&&(this.currentItem.setSelectedVariantByID(t.detail.variantID),this.selectedVariant.set(this.currentItem.selectedOrFirstVariant.value));}engagementTriggerReceived(t){this.stickyATCConfig=t.stickyATCConfig??{},this.currentItem=t.items[0],this.selectedVariant.set(this.currentItem.vars[0]),this.stickyATCConfig.leftText=this.replaceVariables(this.stickyATCConfig.leftText),this.stickyATCConfig.rightText=this.replaceVariables(this.stickyATCConfig.rightText),this.startFeatureRotation();}update(){}getCurrency(t){return Ar$1(t)}getDiscountPercentage(t){return ((t.cmp-t.d)/t.cmp*100).toFixed(0)}addToCart(){this.engagementService.executeCTA(He$3.ADD_TO_CART,{item:this.currentItem});}startFeatureRotation(){if(!this.stickyATCConfig.rightText)return;let t=this.stickyATCConfig.rightText.split(`
34
34
  `),e=t.length===1?null:setInterval(()=>{this.featureSlider.update(i=>s(r({},i),{previousIndex:i.currentIndex,currentIndex:(i.currentIndex+1)%i.features.length}));},3e3);this.featureSlider.set({intervalRef:e,currentIndex:0,features:t});}replaceVariables(t){return t?qe$2(t,this.currentItem.getTemplateVariables(),this.triggerContext):``}static ɵfac=function(e){return new(e||n)};static ɵcmp=of({type:n,selectors:[[`cooee-sticky-atc`]],hostBindings:function(e,i){e&1&&Sf(`letscooee:variant-change`,function(s){return i.onVariantChange(s)},Jg);},features:[Xf(lt()),za],decls:7,vars:3,consts:[[1,`lc-wrapper`],[1,`lc-prices`],[1,`lc-button-wrapper`],[`type`,`button`,1,`lc-button`,`lc-button-atc`,3,`click`],[1,`lc-features`],[1,`lc-sale-price`],[1,`lc-additional-text`],[1,`lc-compare-price`],[1,`lc-discount-label`],[1,`lc-feature`,3,`ngClass`]],template:function(e,i){if(e&1&&(Ka(0,`div`,0),vD(1,ho,5,3,`div`,1),Ka(2,`div`,2)(3,`button`,3),Sf(`click`,function(){return i.addToCart()}),uv(4,`Add To Cart`),Ja(),Qf(5),vD(6,Co,3,0,`div`,4),Ja()()),e&2){ud(),ED(i.selectedVariant()&&i.stickyATCConfig.showProductInfo?1:-1),ud(4);let r=pv(i.featureSlider());ud(),ED(r.features.length?6:-1);}},dependencies:[wE],styles:[`:host{display:flex;justify-content:center;padding:10px;background-color:#fff;width:100%;box-shadow:4px 0 10px #0006;line-height:normal}.lc-wrapper{display:flex;justify-content:space-between;align-items:center;gap:8px;max-width:1100px;width:100%}.lc-prices{flex:1 1 100%;display:flex;flex-wrap:wrap;align-items:center;gap:6px}@media(min-width:768px){.lc-prices{gap:8px}}.lc-sale-price{font-size:24px;font-weight:600}.lc-compare-price{font-size:18px;font-weight:600;color:red;text-decoration:line-through}.lc-discount-label{font-size:12px;font-weight:500;color:green}.lc-button-wrapper{flex:1 1 100%;display:flex;flex-direction:column;gap:4px;align-items:center}.lc-button{background-color:#000;color:#fff;opacity:1;pointer-events:auto;border-radius:4px;min-width:150px;width:100%;padding:8px}.lc-additional-text,.lc-feature{font-size:12px;color:#666}.lc-features{position:relative;overflow:hidden;height:16px;text-align:center;width:100%}.lc-features .lc-feature{position:absolute;width:100%;opacity:0;transform:translateY(100%);transition:transform .5s ease,opacity .5s ease}.lc-features .lc-feature.enter{opacity:1;transform:translateY(0);z-index:2}.lc-features .lc-feature.exit{opacity:0;transform:translateY(-100%);z-index:1}
35
- `],encapsulation:3})};var yo=[`videoEl`];async function vi(){return (await import('./video-detail-dialog.component-Bad60nD4-CNerR2IU.js').then(function (n) { return n.v; })).VideoDetailDialogComponent}var me=class n extends xe{videoElements;videos;videoConfig;dialogRef=null;dialog=g(Ro);isMobile=M$3();pausedVideos=[];videoLoadingStates=new Map;intersectionObserver;visibleVideos=new Set;constructor(){super(),vi();}ngAfterViewInit(){this.checkAndOpenVideoFromUrl();}ngOnDestroy(){super.ngOnDestroy(),this.intersectionObserver?.disconnect();}engagementTriggerReceived(t){this.videoConfig=t.content?.videoConfig,this.videos=this.videoConfig.videos;}onMuteToggled(t,e){t||this.videoElements.forEach(i=>{i.nativeElement!==e&&(i.nativeElement.muted=true,i.nativeElement.pause());});}sendTriggerClicked(t,e){this.sendEvent(`CE Trigger Clicked`,{},t,e);}async onVideoTap(t,e,i,r,s){t?.stopPropagation(),t?.preventDefault();let l=e.items?.[0];if(this.sendTriggerClicked(e,l),this.videoConfig.footerContent===`NONE`){r&&(r.muted=false,r.play(),this.onMuteToggled(false,r));return}await this.openDialog(e,i,s);}sendEvent(t,e,i,r){let s=new Ir$1(t,e,this.engagementTrigger);s.setVideos(i),r&&(s.items=[r.toEmbed()]),window.CooeeSDK.sendEvent(s);}onDialogClosed(){this.resumePlaylistVideos();}isVideoLoading(t){return this.videoLoadingStates.get(t)??true}onVideoLoadStart(t){this.videoLoadingStates.set(t,true);}onVideoCanPlay(t){this.videoLoadingStates.set(t,false);}playVideo(t){t.play().catch(e=>{Y$1.error(`Failed to play video:`,e);});}setupIntersectionObserver(t=.5,e=`50px`){this.intersectionObserver=new IntersectionObserver(i=>{i.forEach(r=>{let s=r.target,l=s.dataset.videoId;l&&(r.isIntersecting?(this.visibleVideos.add(l),this.handleVideoVisibilityChange(s,true)):(this.visibleVideos.delete(l),this.handleVideoVisibilityChange(s,false)));});},{threshold:t,rootMargin:e}),setTimeout(()=>{this.videoElements.forEach(i=>{this.intersectionObserver?.observe(i.nativeElement);});},100);}handleVideoVisibilityChange(t,e){e?this.onVideoBecameVisible(t):t.pause();}onVideoBecameVisible(t){this.playVideo(t);}pauseAllPlaylistVideos(){this.pausedVideos=[],this.videoElements.forEach(t=>{let e=t.nativeElement;e.paused||(this.pausedVideos.push(e),e.pause());});}resumePlaylistVideos(){this.pausedVideos.forEach(t=>{t.play().catch(()=>{});}),this.pausedVideos=[];}async checkAndOpenVideoFromUrl(){let t=We$3();if(!t||!this.videos)return;let e=Je$1();if(e.utm_campaign?.toLowerCase()!==`shoppable_video`||e.utm_source?.toLowerCase()!==Ae$2)return;let i=this.videos.findIndex(r=>r.shortID===+t);if(i!==-1){let r=this.videos[i];await fe$2.set(`muted`,true),await this.openDialog(r,i);}}async openDialog(t,e,i){await Vi$1();let r={videos:this.videos,currentIndex:e,triggerContext:this.triggerContext,selectedItem:i};this.dialogRef&&this.dialogRef.close(),this.pauseAllPlaylistVideos();let s=await vi();this.dialogRef=this.dialog.open(s,{width:`100vw`,height:`100vh`,data:r,providers:bt(this.triggerContext,{video:t,index:e}),disableClose:true});let l={videoID:t.id,videoIndex:e};this.sendEvent(`CE Video Dialog Opened`,{current:l},t),this.dialogRef.closed.subscribe(c=>{if(this.dialogRef=null,!c)return;let f=c.lastVideoDuration*1e3,w={videoID:c.lastVideo.id,videoIndex:c.lastVideoIndex,playedTillMS:f,playedTillPercent:f/c.lastVideo.durationMS};this.sendEvent(`CE Video Dialog Closed`,{current:w},c.lastVideo),this.onDialogClosed();});}static ɵfac=function(e){return new(e||n)};static ɵcmp=of({type:n,selectors:[[`cooee-abstract-video`]],viewQuery:function(e,i){if(e&1&&nc(yo,5),e&2){let r;Rf(r=xf())&&(i.videoElements=r);}},features:[za],decls:0,vars:0,template:function(e,i){},encapsulation:2})};var ue=class n{video=$b.required({alias:`cooeeVideoSources`});prioritySource=$b(`high`);elementRef=g(Se$1);constructor(){Es(()=>{this.updateSources();});}updateSources(){let t=this.elementRef.nativeElement,e=this.video(),i=this.prioritySource();t.querySelectorAll(`source`).forEach(s=>s.remove()),i===`best`?(this.addSource(e.bestSource),this.addSource(e.highSource),this.addSource(e.lowSource)):i===`low`?(this.addSource(e.lowSource),this.addSource(e.highSource),this.addSource(e.bestSource)):(this.addSource(e.highSource),this.addSource(e.bestSource),this.addSource(e.lowSource)),this.addSource(e.m3u8Source),t.load();}addSource(t){if(!t)return;let e=document.createElement(`source`);e.src=t.url,e.type=t.mimeType,this.elementRef.nativeElement.appendChild(e);}static ɵfac=function(e){return new(e||n)};static ɵdir=hn$1({type:n,selectors:[[`video`,`cooeeVideoSources`,``]],inputs:{video:[1,`cooeeVideoSources`,`video`],prioritySource:[1,`prioritySource`]}})};var _o=(n,t)=>t.id;function xo(n,t){if(n&1&&(Df(0,`div`,1),Iv(1,`safeHtml`)),n&2)yf(`innerHTML`,_v(1,1,kD().videoConfig.heading),Yg);}function bo(n,t){n&1&&(Ka(0,`div`,6),Df(1,`div`,12),Ja());}function wo(n,t){if(n&1){let e=ND();Ka(0,`cooee-mute-toggle`,13),Sf(`toggled`,function(r){fu(e),kD();let s=jD(6);return pu(kD().onMuteToggled(r,s))}),Ja();}if(n&2){kD();let e=jD(6);yf(`muted`,e.muted)(`videoEl`,e);}}function Vo(n,t){if(n&1){let e=ND();Ka(0,`cooee-video-promoted-items`,16),Sf(`cardClick`,function(r){fu(e);let s=kD(2),l=s.$implicit,c=s.$index,f=jD(6);return pu(kD().onItemCardClick(r,l,c,f))}),Ja();}if(n&2){let e=kD(2).$implicit;yf(`items`,e.items)(`centeredSlides`,false);}}function To(n,t){if(n&1){let e=ND();Ka(0,`cooee-item-card`,17),Sf(`buttonClick`,function(){fu(e);let r=kD(2),s=r.$implicit,l=r.$index,c=jD(6);return pu(kD().addToCartClicked(null,s,l,c))})(`click`,function(){fu(e);let r=kD(2),s=r.$implicit,l=r.$index,c=jD(6),f=hv(0);return pu(kD().onItemCardClick(f,s,l,c))}),Ja();}if(n&2){kD(2);yf(`item`,hv(0));}}function Eo(n,t){if(n&1&&vD(0,Vo,1,2,`cooee-video-promoted-items`,14)(1,To,1,1,`cooee-item-card`,15),n&2){let e=kD().$implicit,i=kD();ED(hv(2)===i.VideoConfigFooterContent.ITEM_SWIPER&&e.items.length>1?0:e.items.length?1:-1);}}function So(n,t){if(n&1){let e=ND();Ka(0,`cooee-video-card`,18),Sf(`linkClicked`,function(){fu(e);let r=kD().$implicit;return pu(kD().sendTriggerClicked(r))}),Ja();}if(n&2){kD();yf(`card`,hv(1));}}function Io(n,t){if(n&1){let e=ND();Qf(0)(1),Ka(2,`div`,4)(3,`div`,5),Sf(`click`,function(r){let s=fu(e),l=s.$implicit,c=s.$index,f=jD(6);return pu(kD().onVideoTap(r,l,c,f))})(`keydown.enter`,function(r){let s=fu(e),l=s.$implicit,c=s.$index,f=jD(6);return pu(kD().onVideoTap(r,l,c,f))})(`keydown.space`,function(r){let s=fu(e),l=s.$implicit,c=s.$index,f=jD(6);return pu(kD().onVideoTap(r,l,c,f))}),vD(4,bo,2,0,`div`,6),Ka(5,`video`,7,0),Sf(`mouseenter`,function(){fu(e);let r=jD(6);kD();return pu(hv(1)&&r.play())})(`mouseleave`,function(){fu(e);let r=jD(6);kD();return pu(hv(1)&&r.pause())})(`loadstart`,function(){let r=fu(e).$implicit;return pu(kD().onVideoLoadStart(r.id))})(`canplay`,function(){let r=fu(e).$implicit;return pu(kD().onVideoCanPlay(r.id))}),Ja(),Ka(7,`div`,8),vD(8,wo,1,2,`cooee-mute-toggle`,9),Ja()(),Ka(9,`div`,10),vD(10,Eo,2,1)(11,So,1,1,`cooee-video-card`,11),Ja()();}if(n&2){let e=t.$implicit,i=kD(),r=hv(0),s=hv(2);pv(e.items[0]),ud();let c=pv(e.card)&&s===i.VideoConfigFooterContent.CARD;ud(2),rc(`background-image`,e.thumbnail?`url(`+e.thumbnail+`)`:null),ud(),ED(i.isVideoLoading(e.id)?4:-1),ud(),yf(`cooeeVideoSources`,e)(`muted`,true),mf(`preload`,r?`metadata`:`none`)(`autoplay`,null)(`data-video-id`,e.id),ud(3),ED(i.videoConfig.showMuteButton?8:-1),ud(2),ED(i.videoConfig.showItems()?10:c?11:-1);}}var Ze=class n extends me{VideoConfigFooterContent=ye$3;VideoConfigAutoPlay=ge$3;swiperOptions=null;constructor(){super(),this.hasSwiper=true;}ngAfterViewInit(){super.ngAfterViewInit();let t=this.videoConfig.playlistConfig.videoSwiper,e=t?(this.isMobile?t.gapSm:t.gap)+`px`:window.cooeePlaylistGap??24,i=t?this.isMobile?t.maxInRowSm:t.maxInRow:`auto`;this.swiperOptions={direction:`horizontal`,effect:`slide`,loop:t?.loop,freeMode:true,spaceBetween:e,slidesPerView:i,mousewheel:{enabled:true,forceToAxis:true},autoplay:t?.autoplay?.enabled?{delay:t?.autoplay?.delay,disableOnInteraction:false}:false},this.setupIntersectionObserver(),this.playFirstVideo();}ngOnDestroy(){super.ngOnDestroy();}addToCartClicked(t,e,i,r){let s=e.items?.[0],l=he$2.get().website?.canChangeVariantInCart;if(e.items?.length>1||s?.hasVariants()&&!l){this.onItemCardClick(s,e,i,r);return}this.engagementService.executeCTA(He$3.ADD_TO_CART,{item:s,video:e});}goToPDP(t,e){t?.stopPropagation(),t?.preventDefault();let i=e.items?.[0];this.engagementService.executeCTA(He$3.GO_TO_PRODUCT,{item:i,video:e});}onItemCardClick(t,e,i,r){this.videoConfig.playlistConfig.itemCardClickBehavior===`OPEN_ITEM_DETAIL`?this.onVideoTap(null,e,i,r,t):this.onVideoTap(null,e,i,r);}update(){}onVideoBecameVisible(t){this.shouldAutoPlay()&&(this.dialogRef?this.pausedVideos.push(t):this.playVideo(t));}shouldAutoPlay(){return this.videoConfig.autoPlay===`ON`||this.videoConfig.autoPlay===`ON_HOVER`&&this.isMobile}playFirstVideo(){}static ɵfac=function(e){return new(e||n)};static ɵcmp=of({type:n,selectors:[[`cooee-video-playlist`]],features:[Xf(lt()),za],decls:8,vars:7,consts:[[`videoEl`,``],[1,`heading-text`,3,`innerHTML`],[3,`options`,`navigationConfig`,`paginationConfig`],[`ngProjectAs`,`swiper-slides`,5,[`swiper-slides`]],[1,`swiper-slide`,`video-card`],[`role`,`button`,`tabindex`,`0`,`aria-label`,`Play video`,`aria-haspopup`,`dialog`,1,`video-wrapper`,3,`click`,`keydown.enter`,`keydown.space`],[1,`video-loading-overlay`],[`width`,`100%`,`playsinline`,``,`loop`,``,3,`mouseenter`,`mouseleave`,`loadstart`,`canplay`,`cooeeVideoSources`,`muted`],[1,`video-controls`],[3,`muted`,`videoEl`],[`role`,`region`,`aria-label`,`Video details`,1,`video-footer`],[3,`card`],[1,`loading-spinner`],[3,`toggled`,`muted`,`videoEl`],[3,`items`,`centeredSlides`],[`role`,`button`,`tabindex`,`0`,`aria-label`,`Product detail`,3,`item`],[3,`cardClick`,`items`,`centeredSlides`],[`role`,`button`,`tabindex`,`0`,`aria-label`,`Product detail`,3,`buttonClick`,`click`,`item`],[3,`linkClicked`,`card`]],template:function(e,i){if(e&1&&(Qf(0)(1)(2),vD(3,xo,2,3,`div`,1),Ka(4,`cooee-swiper`,2),ec(5,3),wD(6,Io,12,12,`div`,4,_o),Ho(),Ja()),e&2){pv(!i.videoConfig.autoPlay||i.videoConfig.autoPlay===i.VideoConfigAutoPlay.ON),ud(),pv(i.videoConfig.autoPlay===i.VideoConfigAutoPlay.ON_HOVER),ud(),pv(i.videoConfig.footerContent),ud(),ED(i.videoConfig.heading?3:-1);let r=i.videoConfig.playlistConfig.videoSwiper;ud(),yf(`options`,i.swiperOptions)(`navigationConfig`,r==null?null:r.navigation)(`paginationConfig`,r==null?null:r.pagination),ud(2),_D(i.videos);}},dependencies:[ft,mt,pt,re,ue,ht,a],styles:[`:host{display:block}cooee-swiper.swiper{margin:8px;padding-top:25px;padding-bottom:25px}.video-wrapper{position:relative;cursor:pointer;outline:none;border-radius:var(--lc-media-radius, 8px);background-size:cover;background-position:center;background-repeat:no-repeat}.video-wrapper video{width:100%;height:var(--lc-video-card-height);object-fit:cover;border-radius:var(--lc-media-radius, 8px);position:relative}.video-card.swiper-slide{width:var(--lc-video-card-width);transition:transform .3s ease}.video-card.swiper-slide:hover{transform:scale(1.05)}@media(max-width:768px),(prefers-reduced-motion:reduce){.video-card.swiper-slide{transition:none}.video-card.swiper-slide:hover{transform:none}}.video-controls{position:absolute;bottom:8px;z-index:10;right:8px;display:flex;gap:8px}.video-footer{overflow-x:hidden}cooee-item-card{cursor:pointer;padding-left:0!important;padding-right:0!important}cooee-item-card .item-image{width:50px;height:50px;display:none}cooee-item-card .item-detail-button{display:none!important}cooee-item-card .item-info{font-size:14px;line-height:normal;margin-right:unset!important}cooee-item-card .item-info .item-name{-webkit-line-clamp:1;overflow:hidden}.video-loading-overlay{border-radius:var(--lc-media-radius, 8px)}
35
+ `],encapsulation:3})};var yo=[`videoEl`];async function vi(){return (await import('./video-detail-dialog.component-CXwW6KbY-CCLwK_4I.js').then(function (n) { return n.v; })).VideoDetailDialogComponent}var me=class n extends xe{videoElements;videos;videoConfig;dialogRef=null;dialog=g(Ro);isMobile=M$3();pausedVideos=[];videoLoadingStates=new Map;intersectionObserver;visibleVideos=new Set;constructor(){super(),vi();}ngAfterViewInit(){this.checkAndOpenVideoFromUrl();}ngOnDestroy(){super.ngOnDestroy(),this.intersectionObserver?.disconnect();}engagementTriggerReceived(t){this.videoConfig=t.content?.videoConfig,this.videos=this.videoConfig.videos;}onMuteToggled(t,e){t||this.videoElements.forEach(i=>{i.nativeElement!==e&&(i.nativeElement.muted=true,i.nativeElement.pause());});}sendTriggerClicked(t,e){this.sendEvent(`CE Trigger Clicked`,{},t,e);}async onVideoTap(t,e,i,r,s){t?.stopPropagation(),t?.preventDefault();let l=e.items?.[0];if(this.sendTriggerClicked(e,l),this.videoConfig.footerContent===`NONE`){r&&(r.muted=false,r.play(),this.onMuteToggled(false,r));return}await this.openDialog(e,i,s);}sendEvent(t,e,i,r){let s=new Ir$1(t,e,this.engagementTrigger);s.setVideos(i),r&&(s.items=[r.toEmbed()]),window.CooeeSDK.sendEvent(s);}onDialogClosed(){this.resumePlaylistVideos();}isVideoLoading(t){return this.videoLoadingStates.get(t)??true}onVideoLoadStart(t){this.videoLoadingStates.set(t,true);}onVideoCanPlay(t){this.videoLoadingStates.set(t,false);}playVideo(t){t.play().catch(e=>{Y$1.error(`Failed to play video:`,e);});}setupIntersectionObserver(t=.5,e=`50px`){this.intersectionObserver=new IntersectionObserver(i=>{i.forEach(r=>{let s=r.target,l=s.dataset.videoId;l&&(r.isIntersecting?(this.visibleVideos.add(l),this.handleVideoVisibilityChange(s,true)):(this.visibleVideos.delete(l),this.handleVideoVisibilityChange(s,false)));});},{threshold:t,rootMargin:e}),setTimeout(()=>{this.videoElements.forEach(i=>{this.intersectionObserver?.observe(i.nativeElement);});},100);}handleVideoVisibilityChange(t,e){e?this.onVideoBecameVisible(t):t.pause();}onVideoBecameVisible(t){this.playVideo(t);}pauseAllPlaylistVideos(){this.pausedVideos=[],this.videoElements.forEach(t=>{let e=t.nativeElement;e.paused||(this.pausedVideos.push(e),e.pause());});}resumePlaylistVideos(){this.pausedVideos.forEach(t=>{t.play().catch(()=>{});}),this.pausedVideos=[];}async checkAndOpenVideoFromUrl(){let t=We$3();if(!t||!this.videos)return;let e=Je$1();if(e.utm_campaign?.toLowerCase()!==`shoppable_video`||e.utm_source?.toLowerCase()!==Ae$2)return;let i=this.videos.findIndex(r=>r.shortID===+t);if(i!==-1){let r=this.videos[i];await fe$2.set(`muted`,true),await this.openDialog(r,i);}}async openDialog(t,e,i){await Vi$1();let r={videos:this.videos,currentIndex:e,triggerContext:this.triggerContext,selectedItem:i};this.dialogRef&&this.dialogRef.close(),this.pauseAllPlaylistVideos();let s=await vi();this.dialogRef=this.dialog.open(s,{width:`100vw`,height:`100vh`,data:r,providers:bt(this.triggerContext,{video:t,index:e}),disableClose:true});let l={videoID:t.id,videoIndex:e};this.sendEvent(`CE Video Dialog Opened`,{current:l},t),this.dialogRef.closed.subscribe(c=>{if(this.dialogRef=null,!c)return;let f=c.lastVideoDuration*1e3,w={videoID:c.lastVideo.id,videoIndex:c.lastVideoIndex,playedTillMS:f,playedTillPercent:f/c.lastVideo.durationMS};this.sendEvent(`CE Video Dialog Closed`,{current:w},c.lastVideo),this.onDialogClosed();});}static ɵfac=function(e){return new(e||n)};static ɵcmp=of({type:n,selectors:[[`cooee-abstract-video`]],viewQuery:function(e,i){if(e&1&&nc(yo,5),e&2){let r;Rf(r=xf())&&(i.videoElements=r);}},features:[za],decls:0,vars:0,template:function(e,i){},encapsulation:2})};var ue=class n{video=$b.required({alias:`cooeeVideoSources`});prioritySource=$b(`high`);elementRef=g(Se$1);constructor(){Es(()=>{this.updateSources();});}updateSources(){let t=this.elementRef.nativeElement,e=this.video(),i=this.prioritySource();t.querySelectorAll(`source`).forEach(s=>s.remove()),i===`best`?(this.addSource(e.bestSource),this.addSource(e.highSource),this.addSource(e.lowSource)):i===`low`?(this.addSource(e.lowSource),this.addSource(e.highSource),this.addSource(e.bestSource)):(this.addSource(e.highSource),this.addSource(e.bestSource),this.addSource(e.lowSource)),this.addSource(e.m3u8Source),t.load();}addSource(t){if(!t)return;let e=document.createElement(`source`);e.src=t.url,e.type=t.mimeType,this.elementRef.nativeElement.appendChild(e);}static ɵfac=function(e){return new(e||n)};static ɵdir=hn$1({type:n,selectors:[[`video`,`cooeeVideoSources`,``]],inputs:{video:[1,`cooeeVideoSources`,`video`],prioritySource:[1,`prioritySource`]}})};var _o=(n,t)=>t.id;function xo(n,t){if(n&1&&(Df(0,`div`,1),Iv(1,`safeHtml`)),n&2)yf(`innerHTML`,_v(1,1,kD().videoConfig.heading),Yg);}function bo(n,t){n&1&&(Ka(0,`div`,6),Df(1,`div`,12),Ja());}function wo(n,t){if(n&1){let e=ND();Ka(0,`cooee-mute-toggle`,13),Sf(`toggled`,function(r){fu(e),kD();let s=jD(6);return pu(kD().onMuteToggled(r,s))}),Ja();}if(n&2){kD();let e=jD(6);yf(`muted`,e.muted)(`videoEl`,e);}}function Vo(n,t){if(n&1){let e=ND();Ka(0,`cooee-video-promoted-items`,16),Sf(`cardClick`,function(r){fu(e);let s=kD(2),l=s.$implicit,c=s.$index,f=jD(6);return pu(kD().onItemCardClick(r,l,c,f))}),Ja();}if(n&2){let e=kD(2).$implicit;yf(`items`,e.items)(`centeredSlides`,false);}}function To(n,t){if(n&1){let e=ND();Ka(0,`cooee-item-card`,17),Sf(`buttonClick`,function(){fu(e);let r=kD(2),s=r.$implicit,l=r.$index,c=jD(6);return pu(kD().addToCartClicked(null,s,l,c))})(`click`,function(){fu(e);let r=kD(2),s=r.$implicit,l=r.$index,c=jD(6),f=hv(0);return pu(kD().onItemCardClick(f,s,l,c))}),Ja();}if(n&2){kD(2);yf(`item`,hv(0));}}function Eo(n,t){if(n&1&&vD(0,Vo,1,2,`cooee-video-promoted-items`,14)(1,To,1,1,`cooee-item-card`,15),n&2){let e=kD().$implicit,i=kD();ED(hv(2)===i.VideoConfigFooterContent.ITEM_SWIPER&&e.items.length>1?0:e.items.length?1:-1);}}function So(n,t){if(n&1){let e=ND();Ka(0,`cooee-video-card`,18),Sf(`linkClicked`,function(){fu(e);let r=kD().$implicit;return pu(kD().sendTriggerClicked(r))}),Ja();}if(n&2){kD();yf(`card`,hv(1));}}function Io(n,t){if(n&1){let e=ND();Qf(0)(1),Ka(2,`div`,4)(3,`div`,5),Sf(`click`,function(r){let s=fu(e),l=s.$implicit,c=s.$index,f=jD(6);return pu(kD().onVideoTap(r,l,c,f))})(`keydown.enter`,function(r){let s=fu(e),l=s.$implicit,c=s.$index,f=jD(6);return pu(kD().onVideoTap(r,l,c,f))})(`keydown.space`,function(r){let s=fu(e),l=s.$implicit,c=s.$index,f=jD(6);return pu(kD().onVideoTap(r,l,c,f))}),vD(4,bo,2,0,`div`,6),Ka(5,`video`,7,0),Sf(`mouseenter`,function(){fu(e);let r=jD(6);kD();return pu(hv(1)&&r.play())})(`mouseleave`,function(){fu(e);let r=jD(6);kD();return pu(hv(1)&&r.pause())})(`loadstart`,function(){let r=fu(e).$implicit;return pu(kD().onVideoLoadStart(r.id))})(`canplay`,function(){let r=fu(e).$implicit;return pu(kD().onVideoCanPlay(r.id))}),Ja(),Ka(7,`div`,8),vD(8,wo,1,2,`cooee-mute-toggle`,9),Ja()(),Ka(9,`div`,10),vD(10,Eo,2,1)(11,So,1,1,`cooee-video-card`,11),Ja()();}if(n&2){let e=t.$implicit,i=kD(),r=hv(0),s=hv(2);pv(e.items[0]),ud();let c=pv(e.card)&&s===i.VideoConfigFooterContent.CARD;ud(2),rc(`background-image`,e.thumbnail?`url(`+e.thumbnail+`)`:null),ud(),ED(i.isVideoLoading(e.id)?4:-1),ud(),yf(`cooeeVideoSources`,e)(`muted`,true),mf(`preload`,r?`metadata`:`none`)(`autoplay`,null)(`data-video-id`,e.id),ud(3),ED(i.videoConfig.showMuteButton?8:-1),ud(2),ED(i.videoConfig.showItems()?10:c?11:-1);}}var Ze=class n extends me{VideoConfigFooterContent=ye$3;VideoConfigAutoPlay=ge$3;swiperOptions=null;constructor(){super(),this.hasSwiper=true;}ngAfterViewInit(){super.ngAfterViewInit();let t=this.videoConfig.playlistConfig.videoSwiper,e=t?(this.isMobile?t.gapSm:t.gap)+`px`:window.cooeePlaylistGap??24,i=t?this.isMobile?t.maxInRowSm:t.maxInRow:`auto`;this.swiperOptions={direction:`horizontal`,effect:`slide`,loop:t?.loop,freeMode:true,spaceBetween:e,slidesPerView:i,mousewheel:{enabled:true,forceToAxis:true},autoplay:t?.autoplay?.enabled?{delay:t?.autoplay?.delay,disableOnInteraction:false}:false},this.setupIntersectionObserver(),this.playFirstVideo();}ngOnDestroy(){super.ngOnDestroy();}addToCartClicked(t,e,i,r){let s=e.items?.[0],l=he$2.get().website?.canChangeVariantInCart;if(e.items?.length>1||s?.hasVariants()&&!l){this.onItemCardClick(s,e,i,r);return}this.engagementService.executeCTA(He$3.ADD_TO_CART,{item:s,video:e});}goToPDP(t,e){t?.stopPropagation(),t?.preventDefault();let i=e.items?.[0];this.engagementService.executeCTA(He$3.GO_TO_PRODUCT,{item:i,video:e});}onItemCardClick(t,e,i,r){this.videoConfig.playlistConfig.itemCardClickBehavior===`OPEN_ITEM_DETAIL`?this.onVideoTap(null,e,i,r,t):this.onVideoTap(null,e,i,r);}update(){}onVideoBecameVisible(t){this.shouldAutoPlay()&&(this.dialogRef?this.pausedVideos.push(t):this.playVideo(t));}shouldAutoPlay(){return this.videoConfig.autoPlay===`ON`||this.videoConfig.autoPlay===`ON_HOVER`&&this.isMobile}playFirstVideo(){}static ɵfac=function(e){return new(e||n)};static ɵcmp=of({type:n,selectors:[[`cooee-video-playlist`]],features:[Xf(lt()),za],decls:8,vars:7,consts:[[`videoEl`,``],[1,`heading-text`,3,`innerHTML`],[3,`options`,`navigationConfig`,`paginationConfig`],[`ngProjectAs`,`swiper-slides`,5,[`swiper-slides`]],[1,`swiper-slide`,`video-card`],[`role`,`button`,`tabindex`,`0`,`aria-label`,`Play video`,`aria-haspopup`,`dialog`,1,`video-wrapper`,3,`click`,`keydown.enter`,`keydown.space`],[1,`video-loading-overlay`],[`width`,`100%`,`playsinline`,``,`loop`,``,3,`mouseenter`,`mouseleave`,`loadstart`,`canplay`,`cooeeVideoSources`,`muted`],[1,`video-controls`],[3,`muted`,`videoEl`],[`role`,`region`,`aria-label`,`Video details`,1,`video-footer`],[3,`card`],[1,`loading-spinner`],[3,`toggled`,`muted`,`videoEl`],[3,`items`,`centeredSlides`],[`role`,`button`,`tabindex`,`0`,`aria-label`,`Product detail`,3,`item`],[3,`cardClick`,`items`,`centeredSlides`],[`role`,`button`,`tabindex`,`0`,`aria-label`,`Product detail`,3,`buttonClick`,`click`,`item`],[3,`linkClicked`,`card`]],template:function(e,i){if(e&1&&(Qf(0)(1)(2),vD(3,xo,2,3,`div`,1),Ka(4,`cooee-swiper`,2),ec(5,3),wD(6,Io,12,12,`div`,4,_o),Ho(),Ja()),e&2){pv(!i.videoConfig.autoPlay||i.videoConfig.autoPlay===i.VideoConfigAutoPlay.ON),ud(),pv(i.videoConfig.autoPlay===i.VideoConfigAutoPlay.ON_HOVER),ud(),pv(i.videoConfig.footerContent),ud(),ED(i.videoConfig.heading?3:-1);let r=i.videoConfig.playlistConfig.videoSwiper;ud(),yf(`options`,i.swiperOptions)(`navigationConfig`,r==null?null:r.navigation)(`paginationConfig`,r==null?null:r.pagination),ud(2),_D(i.videos);}},dependencies:[ft,mt,pt,re,ue,ht,a],styles:[`:host{display:block}cooee-swiper.swiper{margin:8px;padding-top:25px;padding-bottom:25px}.video-wrapper{position:relative;cursor:pointer;outline:none;border-radius:var(--lc-media-radius, 8px);background-size:cover;background-position:center;background-repeat:no-repeat}.video-wrapper video{width:100%;height:var(--lc-video-card-height);object-fit:cover;border-radius:var(--lc-media-radius, 8px);position:relative}.video-card.swiper-slide{width:var(--lc-video-card-width);transition:transform .3s ease}.video-card.swiper-slide:hover{transform:scale(1.05)}@media(max-width:768px),(prefers-reduced-motion:reduce){.video-card.swiper-slide{transition:none}.video-card.swiper-slide:hover{transform:none}}.video-controls{position:absolute;bottom:8px;z-index:10;right:8px;display:flex;gap:8px}.video-footer{overflow-x:hidden}cooee-item-card{cursor:pointer;padding-left:0!important;padding-right:0!important}cooee-item-card .item-image{width:50px;height:50px;display:none}cooee-item-card .item-detail-button{display:none!important}cooee-item-card .item-info{font-size:14px;line-height:normal;margin-right:unset!important}cooee-item-card .item-info .item-name{-webkit-line-clamp:1;overflow:hidden}.video-loading-overlay{border-radius:var(--lc-media-radius, 8px)}
36
36
  `],encapsulation:3})};var Mo=[`videoElement`],ko=n=>({"cursor-grab":n}),We=class n extends me{videoElement;video;isDragging=false;hidden=false;cdkDrag=g(ge$1,{self:true});untilDestroyed=dt();constructor(){super();}get popupClasses(){return this.hidden?[`hidden`]:[`visible`]}onClick(t){t.stopPropagation(),t.preventDefault(),this.onVideoClick();}ngOnInit(){super.ngOnInit();let t=this.elementRef.nativeElement.closest(`.letscooee-engagement`);t&&(t.style.zIndex=`10000`),this.cdkDrag.moved.pipe(this.untilDestroyed).subscribe(()=>this.isDragging=true);}ngAfterViewInit(){super.ngAfterViewInit(),setTimeout(()=>{this.autoPlay();},100);}onVideoClick(){if(this.isDragging){this.isDragging=false;return}this.hidden=true,this.onVideoTap(null,this.video,0);}close(){this.hidden=true;let t=(new Date().getTime()-this.triggerContext.startTime.getTime())/1e3;this.sendEvent(`CE Trigger Closed`,{duration:t});}engagementTriggerReceived(t){super.engagementTriggerReceived(t),this.video=this.videos[0];}update(){}onDialogClosed(){this.hidden=false;}autoPlay(){let t=this.videoElement.nativeElement;this.hidden||this.playVideo(t);}static ɵfac=function(e){return new(e||n)};static ɵcmp=of({type:n,selectors:[[`cooee-video-popup`]],viewQuery:function(e,i){if(e&1&&nc(Mo,5),e&2){let r;Rf(r=xf())&&(i.videoElement=r.first);}},hostAttrs:[`role`,`button`,`tabindex`,`0`,`aria-label`,`Open video popup `,`cdkDragBoundary`,`body`],hostVars:2,hostBindings:function(e,i){e&1&&Sf(`keydown.enter`,function(s){return i.onClick(s)})(`keydown.space`,function(s){return i.onClick(s)})(`click`,function(s){return i.onClick(s)}),e&2&&XD(i.popupClasses);},features:[Xf(lt()),iD([{directive:ge$1,inputs:[`cdkDragBoundary`,`cdkDragBoundary`]}]),za],decls:9,vars:5,consts:[[`videoElement`,``],[1,`popup-inner`,3,`ngClass`],[`type`,`button`,`aria-label`,`Close video popup`,1,`close-button`,3,`click`],[`name`,`close`,`aria-hidden`,`true`],[1,`play-button`],[`name`,`unmute`,`aria-hidden`,`true`],[1,`text`],[`loop`,``,`preload`,`metadata`,`playsinline`,``,3,`muted`,`cooeeVideoSources`]],template:function(e,i){if(e&1){let r=ND();Ka(0,`div`,1)(1,`button`,2),Sf(`click`,function(l){return fu(r),l.stopPropagation(),pu(i.close())}),Df(2,`cooee-icon`,3),Ja(),Ka(3,`div`,4),Df(4,`cooee-icon`,5),Ka(5,`div`,6),uv(6,`Tap to unmute`),Ja()(),Df(7,`video`,7,0),Ja();}e&2&&(yf(`ngClass`,Ev(3,ko,i.isDragging)),ud(7),yf(`muted`,true)(`cooeeVideoSources`,i.video));},dependencies:[wE,ye,ue],styles:[`:host{position:fixed;display:block;right:24px;bottom:24px;min-height:150px;max-width:150px;box-shadow:0 25px 50px -12px #00000040}:host(.hidden){display:none}.popup-inner{display:flex;justify-content:center;align-items:center;position:relative}video{width:100%;border-radius:8px;background-color:#fff}.close-button{position:absolute;top:-14px;right:-14px;background-color:#00000080;border-radius:9999px;width:32px;height:32px;border:none;z-index:10;display:flex;justify-content:center;align-items:center}.play-button{display:flex;justify-content:center;align-items:center;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%) scale(1);transition:all .1s ease-in-out;z-index:999;flex-wrap:wrap;width:100%;max-width:130px;border-radius:5px;padding:5px 10px;background-color:#97979761;-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px)}.play-button cooee-icon{width:14px;height:14px}.play-button .text{font-size:11px;line-height:1;color:#fff;font-weight:400;margin-left:5px;text-align:center}
37
37
  `],encapsulation:3})};var Po=(n,t)=>t.id;function Fo(n,t){if(n&1&&(Df(0,`div`,1),Iv(1,`safeHtml`)),n&2)yf(`innerHTML`,_v(1,1,kD().videoConfig.heading),Yg);}function Do(n,t){n&1&&(Ka(0,`div`,9),Df(1,`div`,11),Ja());}function Ao(n,t){if(n&1){let e=ND();Ka(0,`div`,4),Sf(`click`,function(r){let s=fu(e),l=s.$implicit,c=s.$index;return pu(kD().onVideoTap(r,l,c))})(`keydown.enter`,function(r){let s=fu(e),l=s.$implicit,c=s.$index;return pu(kD().onVideoTap(r,l,c))})(`keydown.space`,function(r){let s=fu(e),l=s.$implicit,c=s.$index;return pu(kD().onVideoTap(r,l,c))}),_u(),Ka(1,`svg`,5),Df(2,`circle`,6)(3,`circle`,7),Ja(),Tu(),Ka(4,`div`,8),vD(5,Do,2,0,`div`,9),Ka(6,`video`,10,0),Sf(`loadstart`,function(){let r=fu(e).$implicit;return pu(kD().onVideoLoadStart(r.id))})(`canplay`,function(){let r=fu(e).$implicit;return pu(kD().onVideoCanPlay(r.id))}),Ja()()();}if(n&2){let e=t.$implicit,i=t.$index,r=kD();mf(`aria-label`,`Open video story `+(i+1)),ud(5),ED(r.isVideoLoading(e.id)?5:-1),ud(),yf(`poster`,e.thumbnail)(`cooeeVideoSources`,e)(`prioritySource`,`low`)(`muted`,true),mf(`data-video-id`,e.id);}}var qe=class n extends me{constructor(){super();}ngAfterViewInit(){super.ngAfterViewInit(),this.setupIntersectionObserver();}ngOnDestroy(){super.ngOnDestroy();}update(){}static ɵfac=function(e){return new(e||n)};static ɵcmp=of({type:n,selectors:[[`cooee-video-stories`]],features:[Xf(lt()),za],decls:4,vars:1,consts:[[`videoEl`,``],[1,`heading-text`,3,`innerHTML`],[1,`video-stories`],[`role`,`button`,`tabindex`,`0`,1,`video-story`],[`role`,`button`,`tabindex`,`0`,1,`video-story`,3,`click`,`keydown.enter`,`keydown.space`],[`viewBox`,`0 0 100 100`],[`cx`,`50`,`cy`,`50`,`r`,`48`,`fill`,`none`,`stroke-width`,`4`],[`cx`,`50`,`cy`,`50`,`r`,`48`,`fill`,`none`,`stroke-width`,`4`,`stroke-linecap`,`round`,`stroke-dasharray`,`301.6`,`stroke-dashoffset`,`301.6`,1,`video-story-circle`],[1,`video-wrapper`],[1,`video-loading-overlay`],[`loop`,``,`playsinline`,``,`preload`,`metadata`,3,`loadstart`,`canplay`,`poster`,`cooeeVideoSources`,`prioritySource`,`muted`],[1,`loading-spinner`]],template:function(e,i){e&1&&(vD(0,Fo,2,3,`div`,1),Ka(1,`div`,2),wD(2,Ao,8,7,`div`,3,Po),Ja()),e&2&&(ED(i.videoConfig.heading?0:-1),ud(2),_D(i.videos));},dependencies:[ue,a],styles:[`:host{display:block}.video-stories{display:flex;overflow:auto;margin:.75rem;gap:.75rem;justify-content:center;align-items:center;scrollbar-width:none}.video-stories::-webkit-scrollbar{display:none}@media(max-width:768px){.video-stories{justify-content:start!important}}.video-story{position:relative;width:5rem;height:5rem;cursor:pointer;flex-shrink:0}.video-story svg{position:absolute;top:0;left:0;width:100%;height:100%}.video-story svg circle:first-child{stroke:#d1d5db}.video-story svg circle:last-child{stroke:#3b82f6}.video-story .video-wrapper{position:relative;width:100%;height:100%;border-radius:9999px;overflow:hidden}.video-story .video-wrapper video{width:100%;height:100%;object-fit:cover;border-radius:9999px;position:relative;z-index:1}.video-story .video-wrapper .video-loading-overlay{border-radius:9999px}
38
- `],encapsulation:3})};async function Ba(){let n=await $E(fi),t=(e,i)=>{let r=ui(e,{injector:n.injector});customElements.define(i,r);};t(Qe,`cooee-sticky-atc`),t($e,`cooee-savings-bar`),t(je,`cooee-progressbar`),t(Ze,`cooee-video-playlist`),t(We,`cooee-video-popup`),t(qe,`cooee-video-stories`),t(Ve,`cooee-product-options-picker`),t(Be,`cooee-collection-filter`),sessionStorage.cooeeDebug&&import('./debugger.component-CODfBvfj-VZT64w_e.js').then(e=>{t(e.DebuggerComponent,`cooee-debugger`);}),window.cooeeShowQuickItem=(e,i)=>{n.injector.get(Ue).showItemQuickView(e,i);};}
38
+ `],encapsulation:3})};async function Ba(){let n=await $E(fi),t=(e,i)=>{let r=ui(e,{injector:n.injector});customElements.define(i,r);};t(Qe,`cooee-sticky-atc`),t($e,`cooee-savings-bar`),t(je,`cooee-progressbar`),t(Ze,`cooee-video-playlist`),t(We,`cooee-video-popup`),t(qe,`cooee-video-stories`),t(Ve,`cooee-product-options-picker`),t(Be,`cooee-collection-filter`),sessionStorage.cooeeDebug&&import('./debugger.component-ggvhl60P-CNpH_9jJ.js').then(e=>{t(e.DebuggerComponent,`cooee-debugger`);}),window.cooeeShowQuickItem=(e,i)=>{n.injector.get(Ue).showItemQuickView(e,i);};}
39
39
 
40
- var widgetsB557Uqe1 = /*#__PURE__*/Object.freeze({
40
+ var widgetsDkXU5112 = /*#__PURE__*/Object.freeze({
41
41
  __proto__: null,
42
42
  loadAngularWidgets: Ba
43
43
  });
44
44
 
45
- export { $b as $, lf as A, Bo as B, jD as C, Df as D, yf as E, nc as F, Ge as G, Ho as H, ID as I, Ja as J, Ke as K, xf as L, Mf as M, Hb as N, Ro as O, Ft$2 as P, Es as Q, Rf as R, Sf as S, Tv as T, rc as U, Vo$1 as V, Wf as W, Xa as X, Yg as Y, mf as Z, _D as _, a, ND as a0, vD as a1, fu as a2, pu as a3, kD as a4, ED as a5, Ef as a6, gv as a7, Zf as a8, qf as a9, fv as aa, Sv as ab, Kg as ac, widgetsB557Uqe1 as ad, bE as b, ud as c, Iv as d, _f as e, _v as f, ge$1 as g, g as h, iD as i, W as j, Ka as k, Mt$2 as l, Ye as m, Se$1 as n, of as o, ht as p, ut as q, ft as r, TE as s, wE as t, uv as u, mt as v, wD as w, pt as x, ye as y, ec as z };
45
+ export { $b as $, lf as A, Bo as B, jD as C, Df as D, yf as E, nc as F, Ge as G, Ho as H, ID as I, Ja as J, Ke as K, xf as L, Mf as M, Hb as N, Ro as O, Ft$2 as P, Es as Q, Rf as R, Sf as S, Tv as T, rc as U, Vo$1 as V, Wf as W, Xa as X, Yg as Y, mf as Z, _D as _, a, ND as a0, vD as a1, fu as a2, pu as a3, kD as a4, ED as a5, Ef as a6, gv as a7, Zf as a8, qf as a9, fv as aa, Sv as ab, Kg as ac, widgetsDkXU5112 as ad, bE as b, ud as c, Iv as d, _f as e, _v as f, ge$1 as g, g as h, iD as i, W as j, Ka as k, Mt$2 as l, Ye as m, Se$1 as n, of as o, ht as p, ut as q, ft as r, TE as s, wE as t, uv as u, mt as v, wD as w, pt as x, ye as y, ec as z };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@letscooee/web-sdk",
3
3
  "description": "Engage uniquely and boost conversions with AI-powered customer journeys driven by real-time intent",
4
- "version": "14.0.0",
4
+ "version": "14.0.1",
5
5
  "scripts": {
6
6
  "lint": "ng lint",
7
7
  "integrity": "./scripts/validate-integrity.sh",