var M=Object.defineProperty;var A=(h,t,e)=>t in h?M(h,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):h[t]=e;var l=(h,t,e)=>(A(h,typeof t!="symbol"?t+"":t,e),e);import{c as w}from"./conversionBooster-chunk-index14.js";import{g as I,c as N,a as B}from"./conversionBooster-chunk-icon.js";import{g as O,s as j,r as P}from"./conversionBooster-chunk-store.js";import{T as k,c as q,m as R,d as W,p as L,D as E}from"./conversionBooster-index.js";import"./conversionBooster-chunk-_commonjsHelpers.js";const F="_cartBox_1cud3_1",H="_fix_1cud3_15",K="_countdown_1cud3_18",z="_text_1cud3_26",G="_colon_1cud3_26",V="_number_1cud3_47",m={cartBox:F,fix:H,countdown:K,text:z,colon:G,number:V};class J{constructor(t){l(this,"name","CountdownOfCart");l(this,"dom");l(this,"data");l(this,"curTime");l(this,"curTimeText",["",""]);l(this,"isOver",!1);l(this,"timer");l(this,"listenCarStateConf",!0);l(this,"isAdmin");l(this,"cart");var e;this.dom=t.dom,this.data=t.data,this.listenCarStateConf=((e=this.data)==null?void 0:e.listenCarStateConf)!==void 0?this.data.listenCarStateConf:!0,this.isAdmin=t.isAdmin}init(){var e,n,s,i,p,a,f,r,_,g,b,x,T,v;const t=(e=document.querySelector(".trade_mini_cart"))==null?void 0:e.childNodes.length;if(this.dom.length>0&&this.data){if(!this.listenCarStateConf){this.startPlugin();return}const u=this;if(((s=(n=window==null?void 0:window.Shopline)==null?void 0:n.uri)==null?void 0:s.alias)!=="Cart")try{if(!t){if([k.Wink,k.Arise].find(o=>q.indexOf(o)!==-1)?(p=(i=window.Shopline)==null?void 0:i.event)==null||p.on("DataReport::AddToCart",()=>{setTimeout(()=>{this.startPlugin()})}):(f=(a=window.Shopline)==null?void 0:a.event)==null||f.on("Cart::SidebarRender",()=>{this.startPlugin()}),this.cart=document.querySelector("cart-drawer"),typeof((r=this.cart)==null?void 0:r.open)=="function"){const o=this.cart.open;this.cart.open=function(...d){const C=o.call(this,...d);return u.startPlugin(),C}}if(typeof((_=this.cart)==null?void 0:_.close)=="function"){const o=this.cart.close;this.cart.close=function(...d){const C=o.call(this,...d);return u.startPlugin(),C}}}t&&this.startPlugin()}catch(o){if((g=o==null?void 0:o.stack)!=null&&g.includes("$ is not a function"))return;R("cartCountDown",o)}else this.startPlugin();const y=(x=(b=window==null?void 0:window.CartItems)==null?void 0:b.prototype)==null?void 0:x.updateLiveRegions;typeof y=="function"&&(window.CartItems.prototype.updateLiveRegions=function(...o){const d=y.call(this,...o);return u.startPlugin(),d});const c=document.querySelector("cart-notification")||document.querySelector("cart-drawer-entry"),D=o=>{if(typeof(c==null?void 0:c.renderContents)=="function"){const d=c.renderContents;c.renderContents=function(...C){const S=d.call(this,...C);return u.startPlugin(),S}}else if(typeof(c==null?void 0:c.open)=="function"){const d=c.open;c.open=function(...C){const S=d.call(this,...C);return u.startPlugin(),S}}else o&&window.addEventListener("load",()=>D())};c&&D(!0)}!((v=(T=window==null?void 0:window.Shopline)==null?void 0:T.event)!=null&&v._events["Cart::SidebarRender"])&&this.cart}startPlugin(){var _,g,b,x,T,v;if([k.Wink].find(u=>q.indexOf(u)!==-1)&&$(`.j-shopline-${this.name}`).length)return;$(`.j-shopline-${this.name}`).remove(),this.stop(),this.curTime=(_=O(this.name))==null?void 0:_.curTime,this.curTime===void 0&&(this.curTime=((g=this.data)==null?void 0:g.countDownDuration)||0),this.curTimeText=((b=O(this.name))==null?void 0:b.curTimeText)||["","",""],this.isOver=(x=O(this.name))==null?void 0:x.isOver,this.isOver&&(this.curTime=0);const t=this.assembleHtml();let e=!0,n=null;this.dom.map((u,y)=>{n=$(u),n.length>0&&n.css("display")!=="none"&&n.css("display")&&e&&(y===1?n.append(t):n.before(t),e=!1,(u===".template__cart .trade_cart .main_wrapper .trade-cart-sku-list"||y===0)&&$(`.j-shopline-${this.name}`).addClass(m.fix))}),j(this.name,{curTime:this.curTime}),this.countDown(this.curTime||0);const s=document.querySelector(".trade_cart_empty_wrapper")||document.querySelector("cart-drawer-items"),i=window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver,p=()=>{this.countDown(this.curTime||0)},a=new i(p);s&&a.observe(s,{attributeOldValue:!0});const r={"/cart":[106,2970,"CarCountdown"],"/products/:uniqueKey":[105,3031,"mini_CarCountdown_pdp"],"/collections/:uniqueKey":[103,3032,"mini_CarCountdown_collection"],"/home":[101,3033,"mini_CarCountdown_home"],"/":[101,3033,"mini_CarCountdown_home"],"/collections":[104,3034,"mini_CarCountdown_allproduct"],"/products/search":[102,3035,"mini_CarCountdown_search"]}[(v=(T=window==null?void 0:window.Shopline)==null?void 0:T.uri)==null?void 0:v.path];!this.isAdmin&&r&&W({page:r[0],component:108,event_id:r[1],event_name:r[2]})}assembleHtml(){var e,n,s,i;return`