Rechargeable Behind Ear Hearing Aids, Bluetooth with App Control (2024)

`}))}getlowestPricedProduct(t,e){let i=[],o=[],n=e;const s=[...t];return s.sort(((t,e)=>Number(t.price)-Number(e.price))),s.forEach((t=>{if(0===n)o.push(t);else{const e=Number(t.count);e<=n?(i.push(t),n-=e):(i.push(Object.assign(Object.assign({},t),{count:`${n}`})),o.push(Object.assign(Object.assign({},t),{count:""+(e-n)})),n=0)}})),[i,o]}getPrice(t,e="price"){let i=0;return t.filter((t=>t.is_selected)).forEach((t=>{var o;const n=null===(o=t.variants)||void 0===o?void 0:o.find((e=>e.id===t.selected_id)),s=+(n&&n[e]||0);i+=+t.count*s})),i}handlePriceValue(){const t=this.getPrice(this.selectedInfo);let e=t,i=0;if(this.bundleInfo.layer_type===Wt){const t=this.selectedInfo.filter((t=>t.is_selected));if(!this.bundleInfo.target_product_id||this.bundleInfo.target_product_id&&this.selectedInfo.filter((t=>t.is_selected)).some((t=>t.id===this.bundleInfo.target_product_id))){let o=0,n=0;const s=t.reduce(((t,e)=>t+Number(e.count)),0),r=this.bundleInfo.prerequisite_quantity_range;for(let t=r.length-1;t>=0;t--){const e=r[t],{value:i,greater_than_or_equal_to:l}=e;if(s>=Number(l)){o=Number(i),n=Number(l);break}}if(this.bundleInfo.value_type===Ut)i=o,e-=o;else if(this.bundleInfo.value_type===Dt){const[s,r]=this.getlowestPricedProduct(t,n),l=this.getPrice(s),a=this.getPrice(r);i=Math.round(l*(o/100)*100)/100,e=l-i+a}}}else{const o=Number(this.bundleInfo.value);this.bundleInfo.value_type===Mt?o

{this.modalVisible=!1,e.remove()},null===(t=document.querySelector(".bundle-combination-container"))||void 0===t||t.appendChild(e)}}changeCheckBox(t){const{index:e}=t.detail,i=this.selectedInfo[e].is_selected;this.selectedInfo[e].is_selected=!i,this.requestUpdate(),window.sa&&window.sa.track("plugin_bundle_combination_product_select",{block:!0})}render(){var t,e;if(!this.bundleInfo)return;const i=this.parentNode.offsetWidth>960;i&&(null===(e=null===(t=document.querySelector(".bundle-combination-container"))||void 0===t?void 0:t.classList)||void 0===e||e.add("app-container")),this.selectedInfo=this.bundleInfo?this.bundleInfo.entitled_products.filter((t=>t.published)):[],this.clickSelect();const{salePrice:o,savePrice:n}=this.handlePriceValue();let s="";return[Vt.FASHION_HORIZONTAL,Vt.FASHION_VERTICAL].includes(this.styleType)&&(s=this.styleType),R`

${this.titleText}

${this.switchable?R`

Related Items

`:""}

${s?R`

`:R`

`}

${""}`}}Gt.styles=[l`.main{padding:20px 0;margin-left:auto;margin-right:auto;max-width:var(--layout-width,1366px)}.header{display:flex;align-items:center}.title{font-size:24px;line-height:24px}.switch{cursor:pointer;text-decoration:underline;font-size:16px;white-space:nowrap;margin-left:10px}.main--in.main{padding:20px 0}.main--in .header{flex-direction:column;align-items:flex-start}.main--in .switch{font-size:14px;margin-top:4px;margin-left:0}@media (max-width:960px){.main{padding:20px 0;max-width:unset}.header{flex-direction:column;align-items:flex-start;margin-bottom:8px}.title{font-size:16px!important}.switch{font-size:14px;margin-top:4px;margin-left:0}}`,l`.fashionHorizontal .title{font-size:22px;line-height:24px}.fashionHorizontal .switch{color:val(--color-body-text,#292929);font-weight:400}.fashionHorizontal .header{justify-content:space-between}.fashionVertical .header{flex-direction:column;align-items:flex-start}.fashionVertical .switch{margin-top:10px;margin-left:0}.fashionVertical.main{margin-right:initial}.main--in.fashionHorizontal .header{flex-direction:column;align-items:flex-start;justify-content:flex-start}.main--in.fashionHorizontal .switch{margin-top:4px;margin-left:0}.main--in.fashionHorizontal.main{padding:20px 0}.main--in.fashionVertical.main{padding:20px 0!important;margin-left:0}.main--in.fashionVertical.main{margin-right:auto}@media (max-width:960px){.fashionVertical.main{margin-right:auto}}`],t([dt({type:String,attribute:"title-text"})],Gt.prototype,"titleText",void 0),t([dt()],Gt.prototype,"switchable",void 0),t([dt({type:String,attribute:"title-color"})],Gt.prototype,"titleColor",void 0),t([dt({type:String,attribute:"btn-bg-color"})],Gt.prototype,"btnBgColor",void 0),t([dt({type:String,attribute:"btn-text-color"})],Gt.prototype,"btnTextColor",void 0),t([dt({type:String,attribute:!1})],Gt.prototype,"pid",void 0),t([dt({type:String,attribute:!1})],Gt.prototype,"discount_ids",void 0),t([dt({attribute:!1})],Gt.prototype,"bundleInfo",void 0),t([dt({type:String,attribute:"style-type"})],Gt.prototype,"styleType",void 0),t([dt({attribute:"is-quick-shop"})],Gt.prototype,"isQuickShop",void 0),t([dt({attribute:!1})],Gt.prototype,"atcBtnStyle",void 0),t([ct()],Gt.prototype,"selected_all",void 0),t([ct()],Gt.prototype,"select_one",void 0),t([ct()],Gt.prototype,"selectedInfo",void 0),t([ct()],Gt.prototype,"modalProduct",void 0),t([ct()],Gt.prototype,"modalVisible",void 0),t([ct()],Gt.prototype,"loading",void 0),t([ct()],Gt.prototype,"success",void 0),t([ct()],Gt.prototype,"onResize",void 0),window.customElements.get("bundle-product-list")||window.customElements.define("bundle-product-list",Gt);class Qt extends st{constructor(){super(...arguments),this.src="",this.href="",this.styleTypeClass="",this.isFirst=!1,this.isSelect=!0,this.isQuickShop=!1,this.count=1,this.icon=R``}updated(){if(window.innerWidth<960)return;const{isInProductInfo:t,productInfoWidth:e}=qt(!0);if(!t)return;this.item.classList.add("product-img--in");const i=e||500;if(this.styleTypeClass===Vt.FASHION_HORIZONTAL){const t=(i-32)/3;this.item.style.width=`${t}px`,this.item.style.height=4*t/3+"px"}else if(this.styleTypeClass===Vt.FASHION_VERTICAL);else{const t=(i-88)/3;this.item.style.height=`${t}px`,this.item.style.width=`${t}px`}}render(){return R`

Rechargeable Behind Ear Hearing Aids, Bluetooth with App Control (33) ${this.count>1?R`

x ${this.count}

`:""}

`}}Qt.styles=[l`:host{display:flex;align-items:center}:host(.sutra) .product-img{position:relative;max-width:160px;max-height:160px;width:9vw;height:9vw;border-radius:4px;overflow:hidden}a{position:relative;display:block;width:100%;height:100%}img{position:absolute;left:0;right:0;top:0;bottom:0;max-width:100%;max-height:100%;display:block;margin:auto;opacity:.2}.product-img .select{opacity:1}.icon{padding:0 16px}.count{position:absolute;top:0;right:0;background-color:#ec9154;color:#fff;font-size:12px;line-height:1;padding:4px 6px;font-weight:800;border-bottom-left-radius:4px;opacity:.2}@media (max-width:960px){:host(.sutra) .product-img{width:90px!important;height:90px!important}}`,l`:host(.fashionHorizontal) .product-img{width:100%;height:260px;position:relative}:host(.fashionHorizontal) .count{top:initial;bottom:0;right:0;border-bottom-left-radius:0;padding:6px 10px;background:rgba(41,41,41,.4);font-family:Jost;font-size:14px;font-style:normal;font-weight:400;line-height:14px}:host(.fashionHorizontal) .product-img--in.product-img{height:200px}:host(.fashionHorizontal) .product-img--in .count{padding:2px 4px;font-size:12px}@media (max-width:960px){:host(.fashionHorizontal) .product-img{height:200px}:host(.fashionHorizontal) .count{padding:4px 8px;font-size:12px}}`,l`:host(.fashionVertical){height:100%;margin:0 16px;position:relative}:host(.fashionVertical) .product-img{width:103px;height:138px}:host(.fashionVertical) .count{top:initial;bottom:0;right:0;border-bottom-left-radius:0;padding:6px 10px;background:rgba(41,41,41,.4);font-family:Jost;font-size:14px;font-style:normal;font-weight:400;line-height:14px}:host(.fashionVertical) .product-img--in.product-img{width:85px;height:113px}:host(.fashionVertical) .product-img--in.count{padding:2px 4px;font-size:12px}@media (max-width:960px){:host(.fashionVertical) .product-img{width:85px;height:113px}:host(.fashionVertical) .count{padding:4px 8px;font-size:12px}}`],t([dt({type:String})],Qt.prototype,"src",void 0),t([dt({type:String})],Qt.prototype,"href",void 0),t([dt()],Qt.prototype,"styleTypeClass",void 0),t([dt({type:Boolean,attribute:"is-first"})],Qt.prototype,"isFirst",void 0),t([dt({type:Boolean,attribute:"is-select"})],Qt.prototype,"isSelect",void 0),t([dt({type:Boolean})],Qt.prototype,"isQuickShop",void 0),t([dt({type:Number})],Qt.prototype,"count",void 0),t([ht(".product-img")],Qt.prototype,"item",void 0),window.customElements.get("bundle-product-img")||window.customElements.define("bundle-product-img",Qt);const Jt=R``,Yt=R``,Zt=R``,Kt=R``,Xt=R``,te=R``,ee=R``,ie=document.querySelector("bundle-product-list");class oe extends st{constructor(){super(...arguments),this.backgroundColor=(null==ie?void 0:ie.getAttribute("btn-bg-color"))||"#EE7C30",this.textColor=(null==ie?void 0:ie.getAttribute("btn-text-color"))||"#FFFFFF",this.disabled=!1,this.loading=!1,this.success=!1,this.successHtml=R`Added`}render(){let t=null;return this.loading&&(t=ee),this.success&&(t=this.successHtml),R`

${t||R`

`}

`}}oe.styles=[l`.button{font-size:14px;line-height:24px;font-weight:500;justify-content:center;align-items:center;padding:12px 20px;border-radius:4px 4px 4px 4px;cursor:pointer;white-space:initial;word-break:keep-all}@media (max-width:960px){.button{text-align:center}}`,l`:host(.fashionHorizontal) .button{border-radius:0;text-align:center}`,l`:host(.fashionVertical) .button{border-radius:0}`],t([dt({type:String,attribute:"bg-color"})],oe.prototype,"backgroundColor",void 0),t([dt({type:String,attribute:"text-color"})],oe.prototype,"textColor",void 0),t([dt({type:Boolean})],oe.prototype,"disabled",void 0),t([dt({type:Boolean})],oe.prototype,"loading",void 0),t([dt({type:Boolean})],oe.prototype,"success",void 0),window.customElements.get("bundle-button")||window.customElements.define("bundle-button",oe);const ne=l`:host(fashion-horizontal) .content_flex{display:flex}`;class se extends st{constructor(){super(...arguments),this.index=0,this.isSelect=!1,this.selectedOptions={},this.thisOne=!1,this.styleTypeClass="",this.price="",this.compare_at_price="",this.modalWidth=260,this.modalLeft=0,this.modalTop=0,this.showModal=t=>{if(window.innerWidth<960||/none/.test(t.target.classList))return;const e=t.clientX-t.offsetX;e+300>window.innerWidth?this.modalLeft=e-(this.modalWidth-t.target.offsetWidth):this.modalLeft=e,this.modalTop=t.clientY-t.offsetY+t.target.offsetHeight,this.isSelect=!0,this.eva(this.isSelect)},this.hideModal=()=>{window.innerWidth<960||(this.isSelect=!1,this.eva(this.isSelect))}}requestUpdate(){super.requestUpdate()}willUpdate(){if(this.data.variants){if(this.data.selected_options)this.selectedOptions=Object.assign({},this.data.selected_options);else for(let t of this.data.variants)if(t.available){this.selectedOptions.option1=t.option1,this.selectedOptions.option2=t.option2,this.selectedOptions.option3=t.option3;break}this.data.selected_id?this.data.variants.forEach((t=>{t.id===this.data.selected_id&&(this.price=t.price,this.compare_at_price=t.compare_at_price)})):(this.price=this.data.variants[0].price,this.compare_at_price=this.data.variants[0].compare_at_price)}}updated(){const{isInProductInfo:t}=qt();t&&this.bundleProductSelect&&(t?this.bundleProductSelect.classList.add("bundle-product-select--in"):this.bundleProductSelect.classList.remove("bundle-product-select--in"))}eva(t){const e=!document.querySelector('div[data-section-type*="//apps/appbundle/blocks/bundle-combination/"] bundle-product-list');if("Eva"===window.C_SETTINGS.theme.merchant_theme_name&&e){const e=document.querySelector(".product-info__body");e&&(t?e.classList.remove("tw-overflow-hidden"):e.classList.add("tw-overflow-hidden"))}}clickBundle(){if(window.innerWidth>960)return;const t=this.data.options&&0===this.data.options.length,e=this.data.options&&this.data.options.length>0&&1===this.data.variants.length;t||e||(this.isSelect=!this.isSelect,this.eva(this.isSelect))}variantClick(t){var e,i;const o=this;Object.assign(this.selectedOptions,t.detail),null===(i=null===(e=this.data)||void 0===e?void 0:e.variants)||void 0===i||i.forEach((function(t){t.option1===o.selectedOptions.option1&&t.option2===((null==o?void 0:o.selectedOptions.option2)||"")&&t.option3===((null==o?void 0:o.selectedOptions.option3)||"")&&(o.data.selected_id=t.id,o.price=t.price,o.compare_at_price=t.compare_at_price)})),this.data.selected_options=Object.assign({},this.selectedOptions)}onChange(){this.dispatchEvent(new CustomEvent("changeCheckBox",{detail:{index:this.index},bubbles:!0,composed:!0}))}render(){var t;const e=this.data.options&&0===this.data.options.length||!this.data.options,i=this.data.options&&this.data.options.length>0&&1===this.data.variants.length,o=R`

${Nt(Number(this.price).toFixed(2))}

`;return R`

${this.thisOne?R`This item:`:""}${this.data.title}

${this.styleTypeClass?R`

${o}

`:""}

${e?"":R`

${Object.values(this.selectedOptions).filter((t=>!!t)).join("/")}

${i?"":te}

`} ${this.styleTypeClass?"":o} ${this.isSelect?R`

{setTimeout((()=>{this.isSelect=!1,this.eva(this.isSelect)}),200)}}" class="option_overlay ${this.isSelect?"":"hidden"}" style="${window.innerWidth>960?`left: ${this.modalLeft}px; top: ${this.modalTop}px;`:""}width:${this.modalWidth}" .selectedOptions="${this.data.selected_options||this.selectedOptions}" .options="${null===(t=this.data)||void 0===t?void 0:t.options}" .data="${this.data}" .isSelect="${this.isSelect}">

`:""}

{this.isSelect=!1}}">

`}}se.styles=[ne,l`.content_flex{display:flex;align-items:center;position:relative;max-width:100%}.price{white-space:nowrap;color:var(--color_price)}.label{cursor:pointer}`,l`:host(.sutra) .bundle-product-select{display:flex}:host(.sutra) .title{margin-left:16px;margin-right:16px;width:372px;overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;cursor:pointer;line-height:16px;color:#212b36;align-self:center}input{width:16px;height:16px;margin:0;padding:0;margin-right:12px;cursor:pointer}:host(.sutra) .label{display:flex;align-items:center;justify-content:space-between;width:260px;min-width:0;margin-right:16px;padding:6px 12px;border-radius:2px 2px 2px 2px;border:1px solid #d8dbe6;box-sizing:border-box}.one-option{padding-left:0;padding-right:0;border:none;width:auto!important}.label>svg{flex-shrink:0;margin-left:10px}.hidden{display:none!important}.lable-select{border:1px solid #30354d!important}.options{max-width:212px}:host(.sutra) .price{margin-right:auto;flex-shrink:0;font-size:16px}.selected-variant{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:#212b36}.option_overlay{position:fixed;box-sizing:border-box;top:100%;left:0;max-height:300px;width:260px;overflow-y:scroll;background:#fff;box-shadow:0 2px 10px 1px rgba(0,0,0,.10000000149011612),0 0 4px 1px rgba(0,0,0,.03999999910593033);display:none;z-index:1100;padding:16px;padding-bottom:0;display:block;scrollbar-width:none;-ms-overflow-style:none}.option_overlay::-webkit-scrollbar{display:none}:host(.w-full) .bundle-product-select{flex-direction:column}:host(.w-full) .bundle-product-select .title{align-self:auto}:host(.w-full) .select{justify-content:space-between;margin-top:8px;margin-left:16px;box-sizing:border-box}:host(.w-full) .content,:host(.w-full) .content_flex,:host(.w-full) .title{width:auto}:host(.w-full) .label{flex:1}@media (max-width:960px){.bundle-product-select{flex-direction:column}.bundle-product-select .title{align-self:auto}.content,.content_flex,.title{width:auto}:host(.sutra) .label{flex:1}:host(.sutra) .bundle-product-select{flex-direction:column}.option_overlay{position:fixed;max-height:80vh;top:50%;left:50%!important;overflow-y:auto;transform:translate(-50%,-50%);z-index:1101;border-radius:4px;width:90%!important;padding:0}:host(.sutra) .title{width:auto}:host(.sutra) .price{font-size:14px}.dropdown-overlay{position:fixed;top:0;bottom:0;left:0;right:0;display:block;background-color:rgba(0,0,0,.5);z-index:1100}:host(.sutra) .select{justify-content:space-between;margin-top:8px;margin-left:16px;box-sizing:border-box}}`,l`:host(.fashionHorizontal) .title,:host(.fashionVertical) .title{width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:rgba(41,41,41,.75);font-family:Jost;font-size:14px;font-style:normal;font-weight:400;margin-bottom:10px}:host(.fashionHorizontal) .price-wrap{display:flex;flex-wrap:wrap;align-items:baseline;margin-bottom:20px}:host(.fashionHorizontal) .price,:host(.fashionVertical) .price{font-size:22px;margin-right:8px;line-height:18px;overflow:hidden;text-overflow:ellipsis}:host(.fashionHorizontal) .originPrice,:host(.fashionVertical) .originPrice{color:var(--color_price);color:#9f9f9f;font-family:Jost;font-size:16px;font-style:normal;font-weight:400;text-decoration:line-through;line-height:18px}:host(.fashionHorizontal) .label{display:flex;align-items:center;justify-content:center;width:100%;max-width:200px;border:1px solid #e6e6e6;box-sizing:border-box;padding:10px 20px}:host(.fashionHorizontal) .option_overlay{position:fixed}:host(.fashion-full.fashionHorizontal) .label{padding:4px 8px}:host(.fashion-full.fashionHorizontal) .price-wrap{display:block;margin-bottom:10px}:host(.fashion-full.fashionHorizontal) .price{margin-right:0;margin-bottom:8px;font-size:14px;white-space:initial}@media (max-width:960px){:host(.fashionHorizontal) .label{padding:4px 8px}:host(.fashionHorizontal) .price{font-size:14px}}`,l`:host(.fashionVertical) .select{margin-right:auto}:host(.fashionVertical) .bundle-product-select{display:flex;flex-direction:column;min-height:128px;height:100%}:host(.fashionVertical) .price-wrap{display:flex;flex-wrap:wrap;align-items:baseline;margin-bottom:auto}:host(.fashionVertical) .label{display:flex;align-items:center;justify-content:center;width:auto;max-width:100%;border:1px solid #e6e6e6;box-sizing:border-box;padding:10px 20px;margin-top:10px}:host(.fashion-full.fashionVertical) .label{padding:4px 8px}:host(.fashionVertical) .bundle-product-select--in .price{font-size:14px}:host(.fashion-full.fashionVertical) .bundle-product-select{min-height:100px}:host(.fashion-full.fashionVertical) .select{width:auto}@media (min-width:960px){:host(.fashionVertical) .bundle-product-select--in .label>svg{margin-left:0}}@media (max-width:960px){:host(.fashionVertical) .label{padding:4px 8px}:host(.fashionVertical) .bundle-product-select{min-height:100px}:host(.fashionVertical) .select{margin-right:initial;width:auto}:host(.fashionVertical) .price{font-size:14px}}`],t([dt()],se.prototype,"data",void 0),t([dt({type:Number,attribute:"index"})],se.prototype,"index",void 0),t([dt({type:Boolean})],se.prototype,"isSelect",void 0),t([dt()],se.prototype,"selectedOptions",void 0),t([dt({type:Boolean,attribute:"this-one"})],se.prototype,"thisOne",void 0),t([dt()],se.prototype,"styleTypeClass",void 0),t([ht(".option_overlay")],se.prototype,"modalEl",void 0),t([ht(".label")],se.prototype,"labelEl",void 0),t([ht(".bundle-product-select")],se.prototype,"bundleProductSelect",void 0),t([ht(".dropdown-overlay")],se.prototype,"maskEl",void 0),t([ct()],se.prototype,"price",void 0),t([ct()],se.prototype,"compare_at_price",void 0),t([ct()],se.prototype,"modalWidth",void 0),t([ct()],se.prototype,"modalLeft",void 0),t([ct()],se.prototype,"modalTop",void 0),window.customElements.get("bundle-product-select")||window.customElements.define("bundle-product-select",se);var re=!1;if("undefined"!=typeof window){var le={get passive(){re=!0}};window.addEventListener("testPassive",null,le),window.removeEventListener("testPassive",null,le)}var ae="undefined"!=typeof window&&window.navigator&&window.navigator.platform&&(/iP(ad|hone|od)/.test(window.navigator.platform)||"MacIntel"===window.navigator.platform&&window.navigator.maxTouchPoints>1),de=[],ce=!1,pe=-1,he=void 0,ue=void 0,fe=void 0,ve=function(t){return de.some((function(e){return!(!e.options.allowTouchMove||!e.options.allowTouchMove(t))}))},me=function(t){var e=t||window.event;return!!ve(e.target)||(e.touches.length>1||(e.preventDefault&&e.preventDefault(),!1))},ge=function(t,e){if(t){if(!de.some((function(e){return e.targetElement===t}))){var i={targetElement:t,options:e||{}};de=[].concat(function(t){if(Array.isArray(t)){for(var e=0,i=Array(t.length);e=o&&(document.body.style.top=-(e+t))}))}),300)}})):function(t){if(void 0===fe){var e=!!t&&!0===t.reserveScrollBarGap,i=window.innerWidth-document.documentElement.clientWidth;if(e&&i>0){var o=parseInt(window.getComputedStyle(document.body).getPropertyValue("padding-right"),10);fe=document.body.style.paddingRight,document.body.style.paddingRight=o+i+"px"}}void 0===he&&(he=document.body.style.overflow,document.body.style.overflow="hidden")}(e),ae&&(t.ontouchstart=function(t){1===t.targetTouches.length&&(pe=t.targetTouches[0].clientY)},t.ontouchmove=function(e){1===e.targetTouches.length&&function(t,e){var i=t.targetTouches[0].clientY-pe;!ve(t.target)&&(e&&0===e.scrollTop&&i>0||function(t){return!!t&&t.scrollHeight-t.scrollTop<=t.clientHeight}(e)&&i<0?me(t):t.stopPropagation())}(e,t)},ce||(document.addEventListener("touchmove",me,re?{passive:!1}:void 0),ce=!0))}}else console.error("disableBodyScroll unsuccessful - targetElement must be provided when calling disableBodyScroll on IOS devices.")},ye=function(t){t?(de=de.filter((function(e){return e.targetElement!==t})),ae&&(t.ontouchstart=null,t.ontouchmove=null,ce&&0===de.length&&(document.removeEventListener("touchmove",me,re?{passive:!1}:void 0),ce=!1)),ae?function(){if(void 0!==ue){var t=-parseInt(document.body.style.top,10),e=-parseInt(document.body.style.left,10);document.body.style.position=ue.position,document.body.style.top=ue.top,document.body.style.left=ue.left,window.scrollTo(e,t),ue=void 0}}():(void 0!==fe&&(document.body.style.paddingRight=fe,fe=void 0),void 0!==he&&(document.body.style.overflow=he,he=void 0))):console.error("enableBodyScroll unsuccessful - targetElement must be provided when calling enableBodyScroll on IOS devices.")};let be;class xe extends st{constructor(){super(...arguments),this.selectedOptions={},this.options=[],this.data={},this.price="",this.compareAtPrice="",this.image={},this.isSelect=!1,this.priceScope="",this.backgroundColor="#EE7C30"}willUpdate(){var t,e;const i=this;null===(e=null===(t=this.data)||void 0===t?void 0:t.variants)||void 0===e||e.forEach((function(t,e){var o;t.option1===i.selectedOptions.option1&&t.option2===((null==i?void 0:i.selectedOptions.option2)||"")&&t.option3===((null==i?void 0:i.selectedOptions.option3)||"")&&(i.image=(null===(o=null==t?void 0:t.image)||void 0===o?void 0:o.src)?null==t?void 0:t.image:i.data.image,i.price=t.price,i.compareAtPrice=t.compare_at_price)})),setTimeout((()=>{this.disposeScroll(!1)}),0)}disposeScroll(t){if(window.innerWidth>=960)return;const e=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);t?(ye(this.selectEl),document.documentElement.scrollTop=be,e||(document.documentElement.style.overflow="")):this.isSelect&&(ge(this.selectEl),e||(document.documentElement.style.overflow="hidden"))}disconnectedCallback(){this.disposeScroll(!0)}closeModal(){this.dispatchEvent(new CustomEvent("closeModal",{bubbles:!0,composed:!0,cancelable:!0}))}firstUpdated(){window.innerWidth<960?be=document.documentElement.scrollTop:this.modalEl.addEventListener("mousedown",(t=>{this.closeIconEl.contains(t.target)||t.preventDefault()}))}variantChange(t){this.priceScope=t.detail}render(){var t,e;const i=(null===(t=this.selectEl)||void 0===t?void 0:t.scrollHeight)>(null===(e=this.selectEl)||void 0===e?void 0:e.clientHeight);return R`

confirm

`}}xe.styles=l`:host{position:relative}.modal_header{display:none}input#modal{height:0;opacity:0;border:0;position:absolute}.btn{display:none}@media (max-width:960px){.modal{display:flex;max-height:80vh;overflow:hidden}.modal_content{display:flex;flex-direction:column;overflow:hidden;width:100%}.modal_header{display:flex;position:relative;margin-bottom:16px;padding:16px;padding-bottom:0;flex-shrink:0}.modal_header .modal_close_icon{position:absolute;top:8px;right:6px}.modal_header_img img{margin-right:16px;flex-shrink:0}.modal_header_img{height:66px}.modal_header_img img{width:66px;height:66px;object-fit:cover;border-radius:4px 4px 4px 4px}.modal_header_info{margin-right:36px}.prices{display:flex;align-items:baseline}.modal_header_title{width:100%;margin-bottom:8px;overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;line-height:16px}.modal_header_price{color:var(--color_price);font-size:16px;font-weight:500}.modal_compare_price{color:var(--color_origin_price);font-size:14px;margin-left:8px;text-decoration:line-through;font-weight:400}.options_wrap{padding:0 16px 78px 16px;flex:1;overflow:hidden}.options{flex:1;display:flex;overflow:hidden;padding-bottom:74px}.select{overflow:auto;padding:0 16px}.btn{display:block;position:fixed;bottom:0;left:0;width:100%;box-sizing:border-box;padding:16px;background-color:#fff;font-size:16px}}`,t([dt({})],xe.prototype,"selectedOptions",void 0),t([dt({type:Array})],xe.prototype,"options",void 0),t([dt()],xe.prototype,"data",void 0),t([dt()],xe.prototype,"price",void 0),t([dt()],xe.prototype,"compareAtPrice",void 0),t([dt()],xe.prototype,"image",void 0),t([dt({type:Boolean})],xe.prototype,"isSelect",void 0),t([ht("label.modal")],xe.prototype,"modalEl",void 0),t([ht(".modal_close_icon")],xe.prototype,"closeIconEl",void 0),t([ht(".select")],xe.prototype,"selectEl",void 0),t([ct()],xe.prototype,"priceScope",void 0),t([dt({type:String,attribute:"background-color"})],xe.prototype,"backgroundColor",void 0),window.customElements.get("bundle-select-modal")||window.customElements.define("bundle-select-modal",xe);class we extends st{constructor(){super(...arguments),this.options=[],this.selectedOptions={},this.overlay=!1,this.index=0,this.isSelect=!1}variantsTypeChange(t){var e,i;let o=t.currentTarget;if(o.classList.contains("option_container_selected"))o.classList.remove("option_container_selected");else{null===(e=o.parentElement.querySelector(".option_container_selected"))||void 0===e||e.classList.remove("option_container_selected"),o.classList.add("option_container_selected");if(this.options.length===((null===(i=this.shadowRoot.querySelectorAll(".option_container_selected"))||void 0===i?void 0:i.length)||0)){let t={};for(let e=0;e{var t;if(this.options.length===((null===(t=this.shadowRoot.querySelectorAll(".option_container_selected"))||void 0===t?void 0:t.length)||0))return;let e=this.data.variants.slice();const i=this.data.options;this.shadowRoot.querySelectorAll(".option_container_selected").forEach((t=>{const o=t.id.split("-"),n=parseInt(o[0].substring(6),10)-1,s=parseInt(o[1],10);e=e.filter((t=>t[o[0]]==i[n].values[s]))}));const o=e.reduce(((t,e)=>parseFloat(t.price)>parseFloat(e.price)?e:t),e[0]).price,n=e.reduce(((t,e)=>parseFloat(t.price){var n=o.id.split("-"),s=parseInt(n[0].substring(6),10)-1,r=parseInt(n[1],10);i.push(n[0]),t=t.filter((t=>t[n[0]]==e[s].values[r]))}));this.shadowRoot.querySelectorAll(".option_container:not(.option_container_selected)").forEach((o=>{var n=o.id.split("-"),s=parseInt(n[0].substring(6),10)-1,r=parseInt(n[1],10),l=Object.assign({},t[0]);l[n[0]]=e[s].values[r];var a=i.slice();-1==a.indexOf(n[0])&&a.push(n[0]);var d=0==this.data.variants.filter((t=>(t.option1==l.option1||-1===a.indexOf("option1"))&&(t.option2==l.option2||-1===a.indexOf("option2"))&&(t.option3==l.option3||-1===a.indexOf("option3"))&&+t.available_quantity>0)).length;d?o.classList.add("disabled"):o.classList.remove("disabled")}))}render(){var t;return R`

${null===(t=this.options)||void 0===t?void 0:t.map(((t,e)=>R`

${t.name}

${t.values.map(((t,i)=>R`

${t}

`))}

`))}

`}}we.styles=l`@media(max-width:960px){:host(.select) .product_option{max-height:70vh}}.option_content{display:flex;flex-wrap:wrap;margin-bottom:8px;margin-top:8px}.option_name{font-size:12px;line-height:16px}.option_container{min-width:36px;min-height:36px;box-shadow:inset 0 0 0 1px rgba(33,43,54,.25),inset 0 0 0 3px transparent;padding:6px 12px;margin-right:8px;margin-bottom:8px;display:flex;justify-content:center;align-items:center;box-sizing:border-box;border-radius:2px;font-size:14px;cursor:pointer;word-break:break-word}.option_container_selected{box-shadow:inset 0 0 0 2px var(--color-body-text,#212b36)}.disabled{background-color:#efefef;pointer-events:none}@media(max-width:960px){.option_name{font-size:14px}.option_content{font-size:16px}.option_container{min-width:42px;min-height:42px}.product_option{scrollbar-width:none;-ms-overflow-style:none}.product_option::-webkit-scrollbar{display:none}}`,t([function(t){return pt({descriptor:e=>({get(){var e,i;return null!==(i=null===(e=this.renderRoot)||void 0===e?void 0:e.querySelectorAll(t))&&void 0!==i?i:[]},enumerable:!0,configurable:!0})})}(".option_content")],we.prototype,"contentEls",void 0),t([dt()],we.prototype,"options",void 0),t([dt()],we.prototype,"data",void 0),t([dt({})],we.prototype,"selectedOptions",void 0),t([dt({type:Boolean})],we.prototype,"overlay",void 0),t([dt({type:Number})],we.prototype,"index",void 0),t([dt({type:Boolean})],we.prototype,"isSelect",void 0),window.customElements.get("bundle-product-option")||window.customElements.define("bundle-product-option",we);const _e=window.C_SETTINGS.shop.wholesale_enabled;class $e extends st{constructor(){super(...arguments),this.data={},this.selectedOptions={},this.options=[],this.numDropDown=1,this.imgList=[],this.currentImgIndex=0,this.currentPosition=1,this.loading=!1,this.priceScope="",this.icon=R``,this.closeIcon=R``}firstUpdated(){var t,e,i,o,n;if(ge(null===(t=this.shadowRoot)||void 0===t?void 0:t.querySelector(".content")),this.imgList=this.data.images.map((t=>t.src))||[],null===(e=this.data)||void 0===e?void 0:e.variants){if(this.data.selected_options)this.selectedOptions=Object.assign({},this.data.selected_options);else for(let t of this.data.variants)if(t.available){this.selectedOptions.option1=t.option1,this.selectedOptions.option2=t.option2,this.selectedOptions.option3=t.option3;break}this.data.selected_id&&this.data.variants.forEach(((t,e)=>{if(t.id===this.data.selected_id){let e=this.imgList.findIndex((e=>{var i;return(null===(i=t.image)||void 0===i?void 0:i.src)===e}));e>-1&&(this.currentImgIndex=e),this.changeNextOrPrev(0,1)}}))}this.listEl.addEventListener("scroll",Lt((t=>{const e=this.listEl.scrollLeft,i=.75*document.body.offsetWidth,o="rtl"===window.getComputedStyle(this.listEl).direction;this.currentPosition=Math.round((o?0-e:e)/i)+1}),100)),this.shadowRoot.querySelector(".modal").addEventListener("touchstart",(t=>{t.stopPropagation()}));(null===(i=this.shadowRoot)||void 0===i?void 0:i.querySelector(".num_input")).addEventListener("blur",(t=>{if(t.target.value=t.target.value.replace(/[^\d]/g,""),""===t.target.value.trim()||+t.target.value.trim()<1)return t.target.value=1,void(this.numDropDown=1);this.numDropDown=+t.target.value}));const s=null===(o=this.shadowRoot)||void 0===o?void 0:o.querySelector(".num_item_sub"),r=null===(n=this.shadowRoot)||void 0===n?void 0:n.querySelector(".num_item_add");1===this.numDropDown&&s.classList.add("num_item_not_allow"),s.addEventListener("click",(t=>{this.numDropDown>1&&this.numDropDown--})),r.addEventListener("click",(t=>{var e,i,o;const n=this.data.variants.find((t=>t.id===this.data.selected_id));+n.available_quantity>+this.numDropDown&&(this.numDropDown++,null===(o=null===(i=null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector(".num_item_not_allow"))||void 0===i?void 0:i.classList)||void 0===o||o.remove("num_item_not_allow"))}))}variantChange(t){this.priceScope=t.detail}getQualifiedWPriceClassName(t){let e="";return t.max_quantity?this.numDropDown<=t.max_quantity&&this.numDropDown>=t.min_quantity&&(e="w-price-qualified"):this.numDropDown>=t.min_quantity&&(e="w-price-qualified"),e}variantClick(t){var e,i;Object.assign(this.selectedOptions,t.detail),null===(i=null===(e=this.data)||void 0===e?void 0:e.variants)||void 0===i||i.forEach(((t,e)=>{if(t.option1===this.selectedOptions.option1&&t.option2===((null==this?void 0:this.selectedOptions.option2)||"")&&t.option3===((null==this?void 0:this.selectedOptions.option3)||"")){const e=this.imgList.findIndex((e=>{var i;return(null===(i=t.image)||void 0===i?void 0:i.src)===e}));this.data.selected_id=t.id,-1!==e&&(this.currentImgIndex=e)}})),this.data.selected_options=Object.assign({},this.selectedOptions),this.scrollList(),this.changeNextOrPrev(0);const o=this.data.variants.find((t=>t.id===this.data.selected_id));+this.numDropDown>+o.available_quantity&&(this.numDropDown=+o.available_quantity),this.priceScope="",this.requestUpdate()}changeImage(t){this.currentImgIndex=t,this.scrollList(),this.changeNextOrPrev(0)}scrollList(){setTimeout((()=>{try{const t=this.shadowRoot.querySelector(".img-item-selected");t.parentElement.scrollTo({left:t.offsetLeft,behavior:"smooth"})}catch(t){console.error(t)}}))}changeNextOrPrev(t,e){const i=this.currentImgIndex+t;i<0||i>this.imgList.length-1||(this.currentImgIndex+=t,e?setTimeout((()=>{this.shadowRoot.querySelector(".img-item-selected").scrollIntoView({inline:"start"})})):this.scrollList())}closeModal(){var t;ye(null===(t=this.shadowRoot)||void 0===t?void 0:t.querySelector(".content")),document.documentElement.scrollTop=this.currentScrollTop,this.close()}buyNowProcess(t){var i;return e(this,void 0,void 0,(function*(){let e=t.properties||{};const o=yield Bt.post("/api/checkout/order",{body:{line_items:[{quantity:+this.numDropDown||1,variant_id:t.selected_id,note:"",properties:e}],refer_info:{source:"buy_now"}}});if("success"===o.state)return window.safeHref=zt(`/checkout/${null===(i=o.data)||void 0===i?void 0:i.order_token}?step=contact_information`)}))}addToCart(){var t,i;return e(this,void 0,void 0,(function*(){if(""!==this.priceScope)return void this.showToast('Please select a variant at least');this.loading=!0;const e={product_id:this.data.id,variant_id:this.data.selected_id,quantity:+this.numDropDown||1},o=yield Bt.post("/api/cart/batch",{body:{line_items:[e]}});if(o.errors)return this.showToast(o.errors[0]),this.loading=!1,void this.closeModal();this.loading=!1;const n=((null===(t=window.SHOP_PARAMS)||void 0===t?void 0:t.product_settings)||{}).add_to_cart_process;"to_cart"===n&&"page"===n||(Rt?window.$(document).trigger("dj.common.cart.change"):document.dispatchEvent(new CustomEvent("dj.cartChange")));const s={id:this.data.id,product_id:this.data.id,number:this.data.count||1,quantity:this.numDropDown||1,variant_id:this.data.selected_id,childrenId:this.data.selected_id,item_price:this.data.variants.find((t=>t.id===this.data.selected_id)).price,name:this.data.title,type:"",source:"bundle",process:((null===(i=window.SHOP_PARAMS)||void 0===i?void 0:i.product_settings)||{}).add_to_cart_process};Rt?window.$(document.body).trigger("dj.addToCart",s):document.dispatchEvent(new CustomEvent("dj.addToCart",{detail:s})),this.closeModal(),"to_cart"===n||"page"===n?window.safeHref?window.safeHref=zt("/cart"):window.location.href=zt("/cart"):"to_checkout"===n&&this.buyNowProcess(this.data),this.showToast()}))}showToast(t){const e=document.createElement("bundle-toast");t&&(e.text=t),document.body.appendChild(e)}render(){const t=this.data.variants.find((t=>t.id===this.data.selected_id)),e=null==t?void 0:t.price,i=null==t?void 0:t.compare_at_price,o=window.innerWidth<960,n=this.currentImgIndex>0,s=this.currentImgIndex

Rechargeable Behind Ear Hearing Aids, Bluetooth with App Control (35) ${n?R`

this.changeNextOrPrev(-1)}">

`:""} ${s?R`

this.changeNextOrPrev(1)}">

`:""}

${this.imgList.map(((t,e)=>R`Rechargeable Behind Ear Hearing Aids, Bluetooth with App Control (36)this.changeImage(e)}">`))} ${this.imgList.length>1?R`

${this.currentPosition}/${this.imgList.length}

`:""}

${this.data.title}

${_e?R`

See detail${this.icon}

${((null==t?void 0:t.wholesale_price)||[]).map((t=>R`

${Nt(t.price)}

${t.max_quantity?`${t.min_quantity} - ${t.max_quantity} Pieces`:`>= ${t.min_quantity} Pieces`}

`))}

`:R`

${this.priceScope||Nt(e)} ${Nt(i)}

See detail${this.icon}

`}

${o?R`

`:""}

Quantity

Add to Cart

${this.closeIcon}

`}}$e.styles=l`.content{position:fixed;top:50%;left:50%;transform:translate(-50%,-50%);z-index:1101;background-color:#fff;display:flex}@media (max-width:960px){.content{top:68px;left:0;right:0;bottom:0;transform:unset;flex-direction:column;overflow:scroll;padding-bottom:86px}}.slider{position:relative;flex-shrink:0;padding:24px;width:360px;user-select:none;padding-inline-end:0}@media (max-width:960px){.slider{width:100%;padding:0}}.title{overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;color:#212b36;line-height:22px;font-size:16px}.price{font-size:22px;font-weight:500;color:var(--color_price);line-height:22px}.prices{display:flex;align-items:center}.compare-price{margin-left:8px;font-size:16px;font-weight:400;color:var(--color_origin_price);line-height:22px;text-decoration:line-through}@media (min-width:960px){.options{max-height:420px;overflow:scroll;scrollbar-width:none;-ms-overflow-style:none}.options::-webkit-scrollbar{display:none}}.image{position:relative;width:100%;height:480px}@media (max-width:960px){.image{display:none}}.image>img{width:100%;height:100%;object-fit:contain}.arrow{position:absolute;top:50%;width:40px;height:40px;background-color:rgba(0,0,0,.14);border-radius:50%;cursor:pointer;z-index:1}.arrow-not-allow{opacity:.7}.arrow-l{left:16px;transform:translate(0,-50%)}.arrow-r{right:16px;transform:translate(0,-50%)}.body{display:flex;flex-direction:column;width:350px;padding:24px 48px 24px 40px}.quantity{font-size:14px}.quantity_title{margin-bottom:8px}.num_select_mobile{display:none}.num_select_mobile{display:flex;align-items:center;justify-content:center;width:120px}.num_item_add,.num_item_sub{border:1px solid #ddd;cursor:pointer}.num_item_add,.num_item_sub,.num_item_val{display:flex;align-items:center;justify-content:center;width:38px;height:38px}.num_item_not_allow{background-color:#e6e6e6;color:rgba(16,16,16,.3)}.num_input{box-sizing:border-box;border:1px solid transparent;width:36px;height:40px;outline:0;font-size:16px;text-align:center}.quantity_select{display:flex}.select_icon{margin-top:10px;margin-left:-26px;pointer-events:none}@media (max-width:960px){.body{width:100%;padding:16px;box-sizing:border-box}}.header{display:flex;flex-direction:column}.sub{display:flex;align-items:center;padding:16px 0}.see-detail{display:flex;align-items:center;margin-left:auto;color:#30354d;font-size:14px;text-decoration:auto;cursor:pointer;white-space:nowrap;flex-shrink:0}.see-detail svg{margin-left:4px;transform:rotateZ(270deg)}.see-detail-trial{margin-top:8px}.w-price-list{display:flex;padding:12px 16px;background:#f9f9fa;border-radius:4px;overflow-x:scroll;margin-top:8px}.w-price-list::-webkit-scrollbar{height:4px}.w-price-list::-webkit-scrollbar-track{background:#f9f9fa}.w-price-list::-webkit-scrollbar-thumb{background:#cccbcb;border-radius:2px}.w-price-list::-webkit-scrollbar-thumb:hover{background:#888}.w-price-item{margin-right:32px;flex-shrink:0}.w-price-item:last-child{margin-right:0}.w-price{font-weight:500;font-size:16px;line-height:23px;color:val(--color-body-text,#292929)}.w-price-qualified{color:#ff3f02}.w-item{font-weight:400;font-size:12px;line-height:17px;color:rgba(41,41,41,.7);margin-top:4px}.list{display:grid;grid-column-gap:8px;overflow-x:scroll;width:100%;margin-top:8px;scrollbar-width:none;-ms-overflow-style:none}.list::-webkit-scrollbar{display:none}@media (max-width:960px){.list{scroll-snap-type:x mandatory;margin-top:0}.sub{padding:8px 0}.price{font-size:20px}.divider{border-bottom:1px solid #d8dbe6;margin:12px 0 20px 0}.see-detail{font-size:12px}}@media (min-width:960px){.position{display:none}}.position{position:absolute;right:12px;bottom:12px;z-index:1;background:rgba(0,0,0,.4);border-radius:17px 17px 17px 17px;padding:4px 8px;font-size:12px;color:#fff;line-height:14px}.img-item{width:68px;height:68px;object-fit:cover;border-radius:4px;box-sizing:border-box}@media (max-width:960px){.img-item{width:100%;height:75vw;scroll-snap-align:start;border-radius:0}.lonely{height:80vw;object-fit:contain;background-color:#f9f9f9}}@media (min-width:960px){.img-item-selected{padding:3px;border:1px solid #212b36}}.btn{margin-top:auto;text-align:center;padding-top:16px;margin-bottom:-8px}@media (max-width:960px){.btn{position:fixed;bottom:0;left:0;width:100%;box-sizing:border-box;padding:16px;box-shadow:0 2px 10px 1px rgb(0 0 0 / 10%);background-color:#fff;margin-bottom:0}.title{font-size:14px;line-height:16px}}.mask{position:fixed;top:0;left:0;bottom:0;right:0;z-index:1100;background-color:rgba(0,0,0,.7)}.close-icon{position:absolute;top:8px;right:8px;display:flex;justify-content:center;align-items:center;color:#0a1533;width:36px;height:36px;background-color:transparent;cursor:pointer;z-index:1}html[dir=rtl] .close-icon{left:8px;right:unset}@media (max-width:960px){.close-icon{position:fixed;top:80px;right:12px;color:#fff;border-radius:50%;background-color:rgba(0,0,0,.2)}}input[type=number]::-webkit-inner-spin-button,input[type=number]::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}input[type=number]{-moz-appearance:textfield}`,t([ht(".list")],$e.prototype,"listEl",void 0),t([dt()],$e.prototype,"data",void 0),t([dt()],$e.prototype,"selectedOptions",void 0),t([dt({type:Array})],$e.prototype,"options",void 0),t([dt()],$e.prototype,"close",void 0),t([dt()],$e.prototype,"numDropDown",void 0),t([dt({attribute:"btn-bg-color"})],$e.prototype,"btnBgColor",void 0),t([dt({attribute:"btn-text-color"})],$e.prototype,"btnTextColor",void 0),t([dt({attribute:"top"})],$e.prototype,"currentScrollTop",void 0),t([ct()],$e.prototype,"imgList",void 0),t([ct()],$e.prototype,"currentImgIndex",void 0),t([ct()],$e.prototype,"currentPosition",void 0),t([ct()],$e.prototype,"loading",void 0),t([ct()],$e.prototype,"priceScope",void 0),window.customElements.get("bundle-product-modal")||window.customElements.define("bundle-product-modal",$e);class Se extends st{updated(){var t;const e=window.innerWidth<960,i=!document.querySelector('div[data-section-type*="//apps/appbundle/blocks/bundle-combination/"] bundle-product-list'),o=this.shadowRoot.querySelector(".wrap"),n=this.shadowRoot.querySelector(".skeleton");i&&!e&&(o.style.padding="40px 0",n.style.padding="40px 8px 12px",null===(t=this.shadowRoot.querySelector(".skeleton br"))||void 0===t||t.remove()),i&&e&&(o.style.padding="16px 0"),i||e||(o.style.padding="40px 0"),!i&&e&&(o.style.padding="16px 0")}render(){return R`

The current item does not participate in the bundling. Switch the participating items to check the design.
(This prompt will not be displayed on the client-side)

`}}Se.styles=l`.wrap{max-width:var(--layout-width,1000px);margin:0 auto}.skeleton{position:relative;border-radius:4px;border:2px dashed #000;color:#000;line-height:20px!important;text-align:center;font-size:14px;padding:24px 16px;font-weight:500}@media (max-width:960px){.skeleton{font-size:12px;padding:40px 8px 12px!important}.skeleton::before{font-size:12px}}.skeleton::before{content:"Bundle sales";position:absolute;top:-2px;left:-2px;padding:8px 12px;font-size:14px;background-color:#000;color:#fff;border-radius:4px 0 4px 0;text-align:center;font-weight:500}`,window.customElements.get("bundle-skeleton")||window.customElements.define("bundle-skeleton",Se);class Ce extends st{constructor(){super(...arguments),this.text="",this.successHtml=R`

`}firstUpdated(){setTimeout((()=>{const t=document.querySelector("bundle-toast");null==t||t.remove()}),3e3)}render(){return R`

${this.text?"":R`

${this.successHtml}

`} ${this.text||'Added'}

`}}Ce.styles=l`.toast{position:fixed;z-index:1250;left:50%;transform:translateX(-50%);display:flex;justify-content:center;align-items:center;padding:12px 120px;background-color:rgba(0,0,0,.8);font-size:16px;color:#fff;animation:fade_pc 3s;animation-fill-mode:forwards;border-radius:4px;text-align:center}.icon{display:flex;align-items:center;margin-right:12px}@media (max-width:960px){.toast{padding:12px 28px;animation:fade_mobile 3s;animation-fill-mode:forwards}}@keyframes fade_pc{0%{opacity:.1;top:20px}20%{opacity:1;top:100px}80%{opacity:1;top:100px}100%{opacity:0;top:20px}}@keyframes fade_mobile{0%{opacity:.1;top:0}20%{opacity:1;top:50px}80%{opacity:1;top:50px}100%{opacity:0;top:0}}`,t([dt()],Ce.prototype,"text",void 0),window.customElements.get("bundle-toast")||window.customElements.define("bundle-toast",Ce);class ke extends st{constructor(){super(...arguments),this.overWidth=!1,this.titleText="",this.savePrice="",this.salePrice="",this.switchable=!1,this.atcBtnStyle=1,this.titleColor="",this.btnBgColor="",this.btnTextColor="",this.bundleInfo={},this.styleType="sutra",this.isQuickShop=!1,this.selected_all=!1,this.select_one=!1,this.selectedInfo=[],this.loading=!1,this.success=!1,this.styleTypeClass=""}renderImgs(t,e){var i;const o=this.overWidth;return null===(i=this.selectedInfo)||void 0===i?void 0:i.slice(t,e).map(((e,i)=>{var n,s,r;const l=null===(n=e.variants)||void 0===n?void 0:n.find((t=>t.id===e.selected_id)),a=(null===(s=null==l?void 0:l.image)||void 0===s?void 0:s.src)||(null===(r=e.image)||void 0===r?void 0:r.src);return R`

${0!==i||3===t?R`

`:""}

this.clickProduct(e)}">

`}))}clickProduct(t){this.dispatchEvent(new CustomEvent("clickProduct",{detail:t}))}clickSelect(){this.dispatchEvent(new CustomEvent("clickSelect"))}render(){const t=this.overWidth,e=R`

`;return R`

${this.renderImgs(0,3)}

${this.renderImgs(3)}

${t?e:""}

${this.selectedInfo.map(((e,i)=>R`

`))}

${t?"":e}

`}}ke.styles=l`.select-list{width:100%}.container{display:flex;flex-wrap:wrap}.checkbox-wrap{flex-shrink:0}.select-wrap{flex:1;width:0}.content{position:relative;display:flex;flex-wrap:wrap;align-items:center;margin-bottom:16px;flex-wrap:wrap;font-size:14px}.content-list{display:flex;margin-bottom:24px}.content-list svg{width:20px;height:20px;padding:0 16px}.img-list{display:flex}.img-item{display:flex;align-items:center;margin-top:32px}.grow-1{flex-grow:1;text-align:center}.first-list,.second-list{display:flex}.checkbox-top{align-self:flex-start}@media (max-width:960px){.checkbox-wrap{align-self:flex-start}.content-list svg{width:12px;height:12px;padding:0 8px!important}.bundle_money{color:var(--color_price)}.origin_money{font-size:14px}.img-item{margin-top:16px}.first-list{width:100%;justify-content:center}.second-list{width:100%;margin-left:50px}}`,t([dt({type:Boolean})],ke.prototype,"overWidth",void 0),t([dt({type:String,attribute:"title-text"})],ke.prototype,"titleText",void 0),t([dt({attribute:"savePrice"})],ke.prototype,"savePrice",void 0),t([dt({attribute:"salePrice"})],ke.prototype,"salePrice",void 0),t([dt()],ke.prototype,"switchable",void 0),t([dt({attribute:"atcBtnStyle"})],ke.prototype,"atcBtnStyle",void 0),t([dt({type:String,attribute:"title-color"})],ke.prototype,"titleColor",void 0),t([dt({type:String,attribute:"btn-bg-color"})],ke.prototype,"btnBgColor",void 0),t([dt({type:String,attribute:"btn-text-color"})],ke.prototype,"btnTextColor",void 0),t([dt({type:Object,attribute:"bundleInfo"})],ke.prototype,"bundleInfo",void 0),t([dt({type:String,attribute:"style-type"})],ke.prototype,"styleType",void 0),t([dt({type:Boolean})],ke.prototype,"isQuickShop",void 0),t([dt({type:Boolean,attribute:"selected_all"})],ke.prototype,"selected_all",void 0),t([dt({type:Boolean,attribute:"select_one"})],ke.prototype,"select_one",void 0),t([dt({type:Object,attribute:"selectedInfo",reflect:!0})],ke.prototype,"selectedInfo",void 0),t([dt({type:Boolean,attribute:"loading"})],ke.prototype,"loading",void 0),t([dt({type:Boolean,attribute:"success"})],ke.prototype,"success",void 0),t([dt()],ke.prototype,"styleTypeClass",void 0),window.customElements.get("bundle-sutra")||window.customElements.define("bundle-sutra",ke);class Ee extends st{constructor(){super(...arguments),this.overWidth=!1,this.titleText="",this.salePrice="",this.savePrice="",this.switchable=!1,this.atcBtnStyle=1,this.titleColor="",this.btnBgColor="",this.btnTextColor="",this.bundleInfo={},this.styleType="sutra",this.isQuickShop=!1,this.selected_all=!1,this.select_one=!1,this.selectedInfo=[],this.loading=!1,this.success=!1,this.styleTypeClass="",this.vertical=!1,this.scrollTimer=null,this.isShowArrow=!1,this.isArSa="ar-SA"===document.documentElement.lang}clickProduct(t){this.dispatchEvent(new CustomEvent("clickProduct",{detail:t}))}clickSelect(){this.dispatchEvent(new CustomEvent("clickSelect"))}shiftMove(t){if(this.scrollContainer){let e=this.scrollContainer.scrollLeft;if(t)e-=230,this.isArSa||(e=e<0?0:e);else{const t=this.scrollContainer.offsetWidth,i=this.scrollContainer.scrollWidth-t;e+=230,e=e>i?i:e}this.scrollContainer.scrollTo?this.scrollContainer.scrollTo({left:e,behavior:"smooth"}):this.scrollContainer.scrollLeft=e}}shiftLeft(){this.shiftMove(!0)}shiftRight(){this.shiftMove(!1)}showArrow(){this.isShowArrow=!0}hideArrow(){this.isShowArrow=!1}updated(){if(window.innerWidth<960)return;const{isInProductInfo:t}=qt(!1);t?this.fashionContainer.classList.add("fashion--in"):this.fashionContainer.classList.remove("fashion--in")}render(){var t;const e=this.styleTypeClass===Vt.FASHION_VERTICAL;let i=!1;return this.scrollContainer&&(i=this.scrollContainer.scrollWidth>this.scrollContainer.offsetWidth),R`

${null===(t=this.selectedInfo)||void 0===t?void 0:t.map(((t,e)=>{var i,o,n;const s=null===(i=t.variants)||void 0===i?void 0:i.find((e=>e.id===t.selected_id)),r=(null===(o=null==s?void 0:s.image)||void 0===o?void 0:o.src)||(null===(n=t.image)||void 0===n?void 0:n.src);return R`

this.clickProduct(t)}">

`}))}

${e?"":R`

${Jt}

`} ${e?"":R`

${Yt}

`}

${R`

`}

`}}Ee.styles=[l`.fashion-container{overflow:hidden;display:flex;border:1px solid #e6e6e6}.flex-center{display:flex;align-items:center;justify-content:center}`,l`.fashionHorizontal.fashion-container{flex-direction:row;padding:20px;display:inline-flex;max-width:100%;box-sizing:border-box}.fashionHorizontal .container{flex:1;min-width:0;position:relative}.fashionHorizontal .container-scroll{overflow:overlay;width:100%;height:100%}.fashionHorizontal .container-scroll::-webkit-scrollbar{width:0;height:0}.fashionHorizontal .container-scroll-inner{display:flex;height:100%}.fashionHorizontal .container-img{position:relative;width:210px;display:flex;flex-direction:column;flex-shrink:0}.fashionHorizontal .container-img:not(:first-child){margin-left:20px}.fashionHorizontal .img-checkbox{position:absolute;top:10px;right:10px;z-index:10}.fashionHorizontal .container-arrow{position:absolute;width:40px;height:40px;top:50%;border-radius:50%;border:1px solid #e6e6e6;transform:translateY(-50%);background-color:#fff;cursor:pointer;opacity:0;transition:opacity .3s cubic-bezier(.455,.03,.515,.955)}.fashionHorizontal .container-arrow--show{opacity:1}.fashionHorizontal .container-arrow-left{left:10px}.fashionHorizontal .container-arrow-right{right:10px}.fashionHorizontal .interval{border-left:1px solid #e6e6e6;margin:0 20px;flex-shrink:0}.fashionHorizontal .select-specification{margin-top:12px}.fashionHorizontal .totalinfo{display:flex;align-items:center;padding:0 30px;width:220px;flex-shrink:0;box-sizing:border-box}.fashion--in.fashionHorizontal.fashion-container{flex-direction:column;padding:16px;display:flex}.fashion--in.fashionHorizontal .container{width:auto}.fashion--in.fashionHorizontal .interval{border-top:1px solid #e6e6e6;margin:20px 0;flex-shrink:0}.fashion--in.fashionHorizontal .container-img{width:calc((100% - 32px)/ 3)}.fashion--in.fashionHorizontal .container-img:not(:first-child){margin-left:16px}.fashion--in.fashionHorizontal .select-specification{margin-top:10px}.fashion--in.fashionHorizontal .totalinfo{width:auto;padding:0}@media (max-width:960px){.fashionHorizontal.fashion-container{flex-direction:column;padding:16px;display:flex}.fashionHorizontal .container{width:auto}.fashionHorizontal .interval{border-top:1px solid #e6e6e6;margin:20px 0;flex-shrink:0}.fashionHorizontal .container-img{width:120px}.fashion--in.fashionHorizontal .container-img{width:120px}.fashionHorizontal .container-img:not(:first-child){margin-left:16px}.fashionHorizontal .select-specification{margin-top:10px}.fashionHorizontal .totalinfo{width:auto;padding:0}}`,l`.fashionVertical.fashion-container{flex-direction:column;padding:10px 0}.fashionVertical .container-img{display:flex;padding:20px}.fashionVertical .img-checkbox{flex-shrink:0;display:flex;align-items:center}.fashionVertical .select-specification{flex:1;width:0}.fashionVertical .interval{border-top:1px solid #e6e6e6;margin:10px 20px;flex-shrink:0}.fashionVertical .totalinfo{display:flex;flex-direction:column;padding:20px}.fashion--in.fashionVertical .container-img{padding:20px 16px}.fashion--in.fashionVertical .interval{margin:0 16px}.fashion--in.fashionVertical .totalinfo{padding:20px 16px}@media (max-width:960px){.fashionVertical .container-img{padding:20px 16px}.fashionVertical .interval{margin:0 16px}.fashionVertical .totalinfo{padding:20px 16px}}`],t([dt({type:Boolean})],Ee.prototype,"overWidth",void 0),t([dt({type:String,attribute:"title-text"})],Ee.prototype,"titleText",void 0),t([dt({attribute:"salePrice"})],Ee.prototype,"salePrice",void 0),t([dt({attribute:"savePrice"})],Ee.prototype,"savePrice",void 0),t([dt()],Ee.prototype,"switchable",void 0),t([dt({attribute:"atcBtnStyle"})],Ee.prototype,"atcBtnStyle",void 0),t([dt({type:String,attribute:"title-color"})],Ee.prototype,"titleColor",void 0),t([dt({type:String,attribute:"btn-bg-color"})],Ee.prototype,"btnBgColor",void 0),t([dt({type:String,attribute:"btn-text-color"})],Ee.prototype,"btnTextColor",void 0),t([dt({type:Object,attribute:"bundleInfo"})],Ee.prototype,"bundleInfo",void 0),t([dt({type:String,attribute:"style-type"})],Ee.prototype,"styleType",void 0),t([dt({type:Boolean})],Ee.prototype,"isQuickShop",void 0),t([dt({type:Boolean,attribute:"selected_all"})],Ee.prototype,"selected_all",void 0),t([dt({type:Boolean,attribute:"select_one"})],Ee.prototype,"select_one",void 0),t([dt({type:Object,attribute:"selectedInfo",reflect:!0})],Ee.prototype,"selectedInfo",void 0),t([dt({type:Boolean,attribute:"loading"})],Ee.prototype,"loading",void 0),t([dt({type:Boolean,attribute:"success"})],Ee.prototype,"success",void 0),t([dt()],Ee.prototype,"styleTypeClass",void 0),t([ht(".fashion-container")],Ee.prototype,"fashionContainer",void 0),t([ht(".container-scroll")],Ee.prototype,"scrollContainer",void 0),t([ct()],Ee.prototype,"vertical",void 0),t([ct()],Ee.prototype,"scrollTimer",void 0),t([ct()],Ee.prototype,"isShowArrow",void 0),t([ct()],Ee.prototype,"isArSa",void 0),window.customElements.get("bundle-fashion")||window.customElements.define("bundle-fashion",Ee);class Pe extends st{constructor(){super(...arguments),this.layer_type=Ft,this.value="",this.value_type="",this.total_price="",this.atcBtnStyle=1,this.selectedInfo=[],this.selected_all=!1,this.salePrice="",this.savePrice="",this.loading=!1,this.success=!1,this.select_one=!1,this.btnTextColor="",this.btnBgColor="",this.styleTypeClass=""}updated(){if(window.innerWidth<960)return;const{isInProductInfo:t}=qt();t&&this.addCartPanel.classList.add("addCartPanel--in")}addToCart(){this.dispatchEvent(new CustomEvent("addToCart",{bubbles:!0,composed:!0}))}buySelectedProduct(){this.dispatchEvent(new CustomEvent("buySelectedProduct",{bubbles:!0,composed:!0}))}render(){const t=this.layer_type===Wt&&0!==Number(this.savePrice),e=!t&&this.selected_all,i=t||e?this.total_price:this.salePrice,o=this.value_type===Mt&&!t&&Number(this.value)>=Number(this.salePrice),n=!t&&!this.selected_all||"none"===this.value_type||o?"display: none":"",s=this.selectedInfo.every((t=>!t.is_selected));return R`

${this.styleTypeClass&&0!==Number(this.savePrice)&&(t||this.selected_all)?R`

save ${` ${Nt(this.savePrice)}`}

`:""}

Total price: ${Nt(i)} ${Nt(this.salePrice)}

${2===this.atcBtnStyle?'Buy Now':this.select_one?'Add to Cart':'Add selected to cart'}

`}}Pe.styles=[l`.addCartPanel{flex-shrink:0}.discountAmount{display:inline-block;border:1px solid var(--color-text-critical,#db393a);color:var(--color-text-critical,#db393a);font-size:14px;font-weight:400;padding:4px 8px}.price-title{white-space:nowrap}.bundle_money{color:var(--color_price,#db393a);font-weight:500;white-space:nowrap}.origin_money{color:var(--color_price);font-weight:500;font-size:16px;white-space:nowrap}.money_delete{text-decoration:line-through;color:var(--color_origin_price)}`,l`:host(.sutra){width:100%}:host(.sutra) .addCartPanel{margin-top:56px;text-align:center;margin-left:60px;white-space:nowrap}:host(.sutra) .price{display:flex;justify-content:center;align-items:center;margin-bottom:16px;line-height:20px;font-size:16px}:host(.sutra) .price-title{margin-right:8px}:host(.sutra) .bundle_money{margin-right:8px}:host(.sutra) .origin_money{margin-right:8px}:host(.w-full) .addCartPanel{width:100%;text-align:center;margin-top:8px;margin-left:0}@media (max-width:960px){:host(.sutra) .addCartPanel{width:100%;text-align:center;margin-top:8px;margin-left:0}}`,l`:host(.fashionHorizontal){width:100%}.fashionHorizontal .discountAmount{margin-bottom:20px}.fashionHorizontal .price{margin-bottom:40px;display:flex;flex-wrap:wrap;align-items:baseline}.fashionHorizontal .price-title{width:100%;margin-bottom:8px;color:val(--color-body-text,#292929);font-family:Jost;font-size:18px;font-style:normal;font-weight:500;line-height:20px;text-transform:capitalize}.fashionHorizontal .bundle_money{margin-right:10px;font-size:24px}.fashionHorizontal .origin_money{font-weight:400}.addCartPanel--in.fashionHorizontal .price-title{width:auto}.addCartPanel--in.fashionHorizontal.addCartPanel{display:flex;flex-direction:column;align-items:flex-end}.addCartPanel--in.fashionHorizontal .price{text-align:right;margin-bottom:30px;justify-content:flex-end}.addCartPanel--in.fashionHorizontal .bundle_money{margin:0 10px}.addCartPanel--in.fashionHorizontal .add-cart-btn{width:auto}@media (max-width:960px){.addCartPanel--in.fashionHorizontal.addCartPanel,.fashionHorizontal.addCartPanel{display:flex;flex-direction:column;align-items:center}.fashionHorizontal .price-title{width:auto}.fashionHorizontal .price{margin-bottom:30px}.fashionHorizontal .bundle_money{margin:0 10px}.addCartPanel--in.fashionHorizontal .add-cart-btn,.fashionHorizontal .add-cart-btn{width:100%}}`,l`.fashionVertical{text-align:right;white-space:nowrap}.fashionVertical .discountAmount{margin-bottom:10px}.fashionVertical .price{margin-bottom:30px;display:flex;flex-wrap:wrap;justify-content:flex-end;align-items:baseline}.fashionVertical .price-title{margin-bottom:8px;color:val(--color-body-text,#292929);font-family:Jost;font-size:18px;font-style:normal;font-weight:500;line-height:20px;text-transform:capitalize}.fashionVertical .bundle_money{margin:0 10px;font-size:22px}.fashionVertical .origin_money{font-weight:400}.fashionVertical .add-cart-btn{width:auto;display:inline-block;margin-left:auto}:host(.fashion-full) .fashionVertical .add-cart-btn{width:auto}@media (max-width:960px){.fashionVertical .add-cart-btn,:host(.fashion-full) .fashionVertical .add-cart-btn{width:100%}}`],t([dt()],Pe.prototype,"layer_type",void 0),t([dt()],Pe.prototype,"value",void 0),t([dt()],Pe.prototype,"value_type",void 0),t([dt()],Pe.prototype,"total_price",void 0),t([dt({attribute:"atcBtnStyle"})],Pe.prototype,"atcBtnStyle",void 0),t([dt({type:Object,attribute:"selectedInfo",reflect:!0})],Pe.prototype,"selectedInfo",void 0),t([dt({type:Boolean,attribute:"selected_all"})],Pe.prototype,"selected_all",void 0),t([dt({attribute:"salePrice"})],Pe.prototype,"salePrice",void 0),t([dt({attribute:"savePrice"})],Pe.prototype,"savePrice",void 0),t([dt({type:Boolean,attribute:"loading"})],Pe.prototype,"loading",void 0),t([dt({type:Boolean,attribute:"success"})],Pe.prototype,"success",void 0),t([dt({type:Boolean,attribute:"select_one"})],Pe.prototype,"select_one",void 0),t([dt({attribute:"btnTextColor"})],Pe.prototype,"btnTextColor",void 0),t([dt({attribute:"btnBgColor"})],Pe.prototype,"btnBgColor",void 0),t([dt()],Pe.prototype,"styleTypeClass",void 0),t([ht(".addCartPanel")],Pe.prototype,"addCartPanel",void 0),window.customElements.get("bundle-add-cart")||window.customElements.define("bundle-add-cart",Pe);class Te extends st{constructor(){super(...arguments),this.data={},this.styleTypeClass="",this.thisOne=!1,this.index=0}onChange(){this.dispatchEvent(new CustomEvent("changeCheckBox",{detail:{index:this.index},bubbles:!0,composed:!0}))}requestUpdate(){super.requestUpdate()}render(){return R`

${this.data.is_selected?this.styleTypeClass?Zt:Kt:Xt}

`}}Te.styles=l`.content_flex{display:flex;align-items:center;position:relative}.check-label{display:flex;align-items:center}.close-icon{display:flex;cursor:pointer}:host(.fashionHorizontal) .close-icon svg,:host(.fashionVertical) .close-icon svg{width:24px;height:24px}:host(.fashion-full.fashionHorizontal) .close-icon svg,:host(.fashion-full.fashionVertical) .close-icon svg{width:16px;height:16px}@media (max-width:960px){:host(.fashionHorizontal) .close-icon svg,:host(.fashionVertical) .close-icon svg{width:16px;height:16px}}`,t([dt()],Te.prototype,"data",void 0),t([dt()],Te.prototype,"styleTypeClass",void 0),t([dt({type:Boolean,attribute:"thisOne"})],Te.prototype,"thisOne",void 0),t([dt({type:Number,attribute:"index"})],Te.prototype,"index",void 0),window.customElements.get("bundle-check-box")||window.customElements.define("bundle-check-box",Te),e(void 0,void 0,void 0,(function*(){var t,i;let o=[];const n=t=>e(void 0,void 0,void 0,(function*(){if(!t)return[];const{data:e}=yield Bt.get(`/api/product/list?${function(t){var e=[],i=function(t,i){i=null==(i="function"==typeof i?i():i)?"":i,e[e.length]=encodeURIComponent(t)+"="+encodeURIComponent(i)};return function t(o,n){var s,r,l;if(o)if(Array.isArray(n))for(s=0,r=n.length;s

{window.C_SETTINGS.store_trial&&(t.variant||[]).forEach((t=>{(t.wholesale_price||[]).forEach(((e,i)=>{const o=t.wholesale_price[i+1];o&&(e.max_quantity=o.min_quantity-1)}))}))})),i})),s=t=>e(void 0,void 0,void 0,(function*(){if(d&&(d.style.cursor="wait",d.pid=t,d.style.pointerEvents="none",d.switchable=p.bundle_sales.length>1),0===p.bundle_sales.length)return void r(d);const e=p.bundle_sales[a];e.entitled_products.forEach((t=>Object.assign(t,o.find((e=>e.id===t.id)))));const i=e.entitled_products.find((e=>e.id===t)),n=e.entitled_products.findIndex((e=>e.id===t));e.entitled_products.splice(n,1),e.entitled_products.unshift(i),e.isRequested=!0,d&&(d.bundleInfo=e,d.discount_ids=p.bundle_sales.map((t=>t.id)).join(","),d.bundleInfo.entitled_products.filter((t=>t.price)).forEach((e=>{e.is_selected=!0,e.selected_id=e.variants.filter((t=>t.available))[0].id,e.id===t&&(e.thisOne=!0)})),d.style.cursor="",d.style.pointerEvents=""),function(t,e){var i=document.querySelector(t),o=function(){e()};i&&!i.getAttribute("imprsd")?i.addEventListener("impress",o):o()}("bundle-product-list",(()=>{var e,i;const o=p.bundle_sales[a],n={discount_id:o.id,value_type:o.value_type,popups_setting:o.popups_setting,global_show_text:o.global_show_text,target_selection:o.target_selection,page:null===(e=window.SHOP_PARAMS)||void 0===e?void 0:e.template_type,product_id:t,plugin_timestamp:Date.now(),show_related_items:p.bundle_sales.length>1,block:!0,discount_ids:p.bundle_sales.map((t=>t.id)).join(","),operation_type:o.operation_type,entitled_product_ids:o.entitled_product_ids};window.sa&&(null===(i=window.sa)||void 0===i||i.track("plugin_bundle_combination_pv",n))}))})),r=t=>{var e;if(!document.querySelector("bundle-skeleton")&&window.self!==window.top){const i=document.createElement("bundle-skeleton");null===(e=null==t?void 0:t.parentElement)||void 0===e||e.insertBefore(i,t)}};let l=window.innerWidth;window.addEventListener("resize",Ht((()=>{window.innerWidth!==l&&window.top!==window.self&&window.location.reload()}),500));let a=0;const d=document.querySelector('[data-section-id="1539149753700"] .bundle-main'),c=d.getAttribute("pid")||"",p=yield Bt.get(`/api/bundle-sales?product_id=${c}`);yield e(void 0,void 0,void 0,(function*(){const t=yield Bt.get("/api/bundle-sales/setting?type=discount_code");d&&(d.atcBtnStyle=t.style||1)})),yield e(void 0,void 0,void 0,(function*(){const t=p.bundle_sales.map((t=>t.entitled_product_ids)).flat();o=yield n(t);const e=[];p.bundle_sales.forEach((t=>{t.entitled_product_ids.every((t=>null==o?void 0:o.find((e=>e.id===t&&e.available))))&&e.push(t)})),p.bundle_sales=e})),yield s(c);const{isInProductInfo:h}=qt();h||null===(i=null===(t=document.querySelector(".bundle-combination-container"))||void 0===t?void 0:t.classList)||void 0===i||i.add("tw-container","container","container-gap","page-width"),null==d||d.addEventListener("bundle-combination-switch",Ht((()=>e(void 0,void 0,void 0,(function*(){var t;if(a=a===p.bundle_sales.length-1?0:a+1,p.bundle_sales[a].isRequested)return void(d.bundleInfo=p.bundle_sales[a]);yield s(c);const e=p.bundle_sales[a];window.sa&&(null===(t=window.sa)||void 0===t||t.track("plugin_bundle_combination_related_item_click",{discount_ids:p.bundle_sales.map((t=>t.id)),product_id:c,block:!0,discount_id:e.id,operation_type:e.operation_type,entitled_product_ids:e.entitled_product_ids.join(",")}))}))),300))}))}));} catch (err) { console.log('bundle sales error' + err) } })() } catch (e) {console.error(e)} class SpzSmartBlockComponent extends SPZ.BaseElement { constructor(element) { super(element); this.templates_ = null; this.container_ = null; this.i18n_ = {}; this.config_ = {}; this.show_type_ = 3; this.product_resource_id_ = ''; this.collection_resource_id_ = ''; this.cart_items_ = []; this.customer_id_ = ''; this.order_id_ = ''; } static deferredMount() { return false; } isLayoutSupported(layout) { return layout == SPZCore.Layout.CONTAINER; } buildCallback() { const template_type = window.SHOPLAZZA.meta.page.template_type; if (template_type === 1) { this.show_type_ = 3; this.product_resource_id_ = window.SHOPLAZZA.meta.page.resource_id; } else if (template_type === 2) { this.show_type_ = 4; this.collection_resource_id_ = window.SHOPLAZZA.meta.page.resource_id; } else if (template_type === 15){ this.show_type_ = 5; } else if (template_type === 13){ this.show_type_ = 6; } else if (template_type === 20){ this.show_type_ = 7; this.customer_id_ = window.SHOPLAZZA.customer.customer_id; } else if (template_type === 35){ this.show_type_ = 8; this.order_id_ = window.location.pathname.split('/').pop(); } this.templates_ = SPZServices.templatesForDoc(this.element); this.setAction_(); } mountCallback() { console.log('smart mounted'); const that = this; const themeName = window.SHOPLAZZA.theme.merchant_theme_name; const isGeek = /Geek/.test(themeName); this.fetchRules().then((res) => { if (res && res.rules && res.rules.length) { const blockEl = document.getElementById('smart_recommend_block'); SPZ.whenApiDefined(blockEl).then((api) => { api.render({data: res}, true).then(() => { if (isGeek && that.show_type_ === 6) { blockEl.querySelector('.plugin_container_wrpper').style.padding = '30px 0'; } const recommendStyle = document.createElement('style'); recommendStyle.innerHTML = ` .plugin__recommend_container,.app-recommend-card { display: none !important; } `; document.head.appendChild(recommendStyle); const fetchList = []; res.rules.forEach((rule) => { fetchList.push(this.fetchRuleProductList(rule.id)); }); const fetchAll = Promise.all(fetchList); fetchAll.then((p_res) => { res.rules.forEach((rule, index) => { rule.products = p_res[index] && p_res[index].products; const ruleEl = document.getElementById('smart_recommend_rule_' + rule.id); SPZ.whenApiDefined(ruleEl).then((api) => { api.render({data: rule}, true).then(() => { that.impressListen(`#smart_recommend_rule_ul_${rule.id}`, function(){ that.trackRuleImpress(rule); }); const btnElList = document.querySelectorAll(`#smart_recommend_rule_ul_${rule.id} button`); btnElList.forEach((btnEl) => { if (btnEl && rule.config && rule.config.quick_shop_button_bg_color && rule.config.quick_shop_button_text_color) { btnEl.style.backgroundColor = rule.config.quick_shop_button_bg_color; btnEl.style.color = rule.config.quick_shop_button_text_color; } }) }); }); }); }); }) }) } else { if (window.top !== window.self) { const template_type = window.SHOPLAZZA.meta.page.template_type; const holderEl = document.getElementById('smart_recommend_preview_no_data_placeholder'); SPZ.whenApiDefined(holderEl).then((api) => { api.render({data: { isCart: template_type === 13, isCollection: template_type === 2, isProduct: template_type === 1, isIndex: template_type === 15 }}, true); }); } } }); } setAction_() { this.registerAction('quickShop', (data) => { const that = this; const product_id = data.args.product_id; const productIndex = data.args.productIndex; const rule_id = data.args.rule_id; const ssp = data.args.ssp; const scm = data.args.scm; const cfb = data.args.cfb; const ifb = data.args.ifb; const modalRender = document.getElementById('smart_recommend_product_modal_render'); if (product_id) { this.fetchProductData(product_id).then((res) => { const product = res.products && res.products.length && res.products[0] || {}; product.cfb = cfb; product.ifb = ifb; SPZ.whenApiDefined(modalRender).then((api) => { api.render({product: product, productIndex: productIndex, rule_id: rule_id, ssp: ssp, scm: scm, show_type: that.show_type_}, true).then(() => { const modalEl = document.getElementById('smart_recommend_product_modal'); SPZ.whenApiDefined(modalEl).then((modal) => { that.impressListen('#smart_recommend_product_modal', function(){ that.trackQuickShop({ rule_id: rule_id, product_id: product_id }); }); modal.open(); }); const formEl = document.getElementById('smart_recommend_product_form'); SPZ.whenApiDefined(formEl).then((form) => { form.setProduct(product); }); const variantEl = document.getElementById('smart_recommend_product_variants'); SPZ.whenApiDefined(variantEl).then((variant) => { variant.handleRender(product); }); }); }) }); } }); this.registerAction('handleScroll', (data) => { this.directTo(data.args.rule_id, data.args.direction); }); this.registerAction('handleProductChange', (data) => { const variant = data.args.data.variant; const product = data.args.data.product; const imageRenderEl = document.getElementById('smart_recommend_product_image'); SPZ.whenApiDefined(imageRenderEl).then((api) => { api.render({ variant: variant, product: product }, true); }); }); this.registerAction('handleAtcSuccess', (detail) => { const data = detail.args; data.data.product = data.data.product || {}; data.data.variant = data.data.variant || {}; const product_id = data.data.product.id; const product_title = data.data.product.title; const variant_id = data.data.variant.id; const price = data.data.variant.price; const rule_id = data.rule_id; const aid = `smart_recommend.${this.show_type_}.${rule_id}`; const ifb = data.data.product.ifb; const cfb = data.data.product.cfb; const ssp = data.ssp; const scm = data.scm; const spm = `smart_recommend_${this.show_type_}.${data.spmIndex}`; const params = { id: product_id, product_id: product_id, number: 1, name: product_title, variant_id: variant_id, childrenId: variant_id, item_price: price, source: 'add_to_cart', _extra: { aid: aid, ifb: ifb, cfb: cfb, scm: scm, spm: `..${window.SHOPLAZZA.meta.page.template_name}.${spm}`, ssp: ssp, } }; this.tranckAddToCart(params); }); this.registerAction('addATCHook', (data) => { const params = data.args; const spm = `smart_recommend_${this.show_type_}.${params.spmIndex}`; this.myInterceptor_ = window.djInterceptors && window.djInterceptors.track.use({ event: 'dj.addToCart', params: { aid: `smart_recommend.${this.show_type_}.` + params.rule_id, ssp: params.ssp, scm: params.scm, cfb: params.cfb, spm: `..${window.SHOPLAZZA.meta.page.template_name}.${spm}`, }, once: true }); }); } tranckAddToCart(detail) { if (window.$) { window.$(document.body).trigger('dj.addToCart', detail); } } fetchRules() { const payload = { show_type: this.show_type_, }; let that = this; if (this.show_type_ === 6) { let line_items = []; return this.fetchCart().then((res) => { if (res && res.cart && res.cart.line_items) { line_items = res.cart.line_items.map((item) => { return { product_id: item.product_id, variant_id: item.variant_id, quantity: item.quantity, price: item.price } }); } payload.line_items = line_items; that.cart_items_ = line_items; return that.fetchRulesRequest(payload); }); } else { if (this.show_type_ === 3) { payload.line_items = [{ product_id: this.product_resource_id_ }]; } else if (this.show_type_ === 4) { payload.collection_id = this.collection_resource_id_; } else if (this.show_type_ === 7) { payload.customer_id = this.customer_id_; } else if (this.show_type_ === 8) { payload.order_id = this.order_id_; } return this.fetchRulesRequest(payload); } } fetchRulesRequest(payload) { return fetch(window.SHOPLAZZA.routes.root + "/api/possum/recommend_query", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify(payload) }).then(function(res){ if(res.ok){ return res.json(); } }); } fetchCart() { return fetch(`/api/cart/cart-select?r=${Math.random().toString(36).slice(-4)}`) .then((res) => { if (res.ok) { return res.json(); } }); } fetchRuleProductList(rule_id) { const payload = { page: 1, limit: 100, fields: ["title", "url", "image", "min_price_variant.price", "min_price_variant.compare_at_price"], rule_id: rule_id, }; if (this.show_type_ === 3) { payload.line_items = [{ product_id: this.product_resource_id_ }]; } else if (this.show_type_ === 4) { payload.collection_id = this.collection_resource_id_; } else if (this.show_type_ === 6) { payload.line_items = this.cart_items_; } else if (this.show_type_ === 7) { payload.customer_id = this.customer_id_; } else if (this.show_type_ === 8) { payload.order_id = this.order_id_; } return fetch(window.SHOPLAZZA.routes.root + "/api/possum/recommend_products", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify(payload) }).then(function(res){ if(res.ok){ return res.json(); } }).catch(function(err){ console.log(err); }); } fetchProductData(product_id) { return fetch(window.SHOPLAZZA.routes.root + "/api/possum/products", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ product_ids: [product_id], fields: [ "images", "options", "min_price_variant", "variants"] }) }).then(function(res){ if(res.ok){ return res.json(); } }).catch(function(err){ console.log(err); const loadingEl = document.getElementById('smart_recommend_loading'); if (loadingEl) { loadingEl.style.display = 'none'; } }); } getStyle(ele, style) { if (!ele) return; if (window.getComputedStyle) { return window.getComputedStyle(ele)[style]; } return ele.currentStyle[style]; } directTo(id, direction) { const scrollElement = document.getElementById(`smart_recommend_rule_ul_${id}`); const blockWidth = parseInt(this.getStyle(scrollElement, 'width')); const scrollLength = (blockWidth * 0.19 - 12) * 5; const scrollPoint = scrollElement.scrollWidth - scrollElement.clientWidth; if (!scrollElement) return; if (direction === 'left') { if (document.dir === 'rtl') { scrollElement.scrollTo({ left: Math.abs(scrollElement.scrollLeft) >= scrollPoint - 100 ? 0 : scrollElement.scrollLeft - scrollLength, behavior: 'smooth' }); return; } scrollElement.scrollTo({ left: Math.max(scrollElement.scrollLeft - scrollLength, 0), behavior: 'smooth' }); } else { if (document.dir === 'rtl') { scrollElement.scrollTo({ left: Math.abs(scrollElement.scrollLeft) >= scrollPoint + 100 ? 0 : scrollElement.scrollLeft + scrollLength, behavior: 'smooth' }); return; } scrollElement.scrollTo({ left: scrollElement.scrollLeft >= scrollPoint - 100 ? 0 : scrollElement.scrollLeft + scrollLength, behavior: 'smooth' }); } } trackRuleImpress(rule) { if (window.sa && window.sa.track) { window.sa.track("plugin_common", { plugin_name: "upsell", event_type: "impressions", rule_id: rule.id, ssp: rule.ssp, scm: rule.scm, show_type: this.show_type_, support_app_block: window.SHOPLAZZA.theme.support_app_block }); window.sa.track("module_impressions", { aid: `smart_recommend.${this.show_type_}.${rule.id}`, support_app_block: window.SHOPLAZZA.theme.support_app_block }); } } trackQuickShop(data) { window.sa && sa.track && sa.track("plugin_common", { plugin_name: "upsell", event_type: "quick_shop", rule_id: data.rule_id, product_id: data.product_id, show_type: this.show_type_, }); } impressListen(selector, cb) { const el = document.querySelector(selector); const onImpress = (e) => { if (e) { e.stopPropagation(); } cb(); }; if (el && !el.getAttribute('imprsd')) { el.addEventListener('impress', onImpress) } else if (el) { onImpress(); } } } SPZ.defineElement('spz-custom-smart-block', SpzSmartBlockComponent);
Rechargeable Behind Ear Hearing Aids, Bluetooth with App Control (2024)

References

Top Articles
Latest Posts
Recommended Articles
Article information

Author: Msgr. Benton Quitzon

Last Updated:

Views: 6136

Rating: 4.2 / 5 (63 voted)

Reviews: 94% of readers found this page helpful

Author information

Name: Msgr. Benton Quitzon

Birthday: 2001-08-13

Address: 96487 Kris Cliff, Teresiafurt, WI 95201

Phone: +9418513585781

Job: Senior Designer

Hobby: Calligraphy, Rowing, Vacation, Geocaching, Web surfing, Electronics, Electronics

Introduction: My name is Msgr. Benton Quitzon, I am a comfortable, charming, thankful, happy, adventurous, handsome, precious person who loves writing and wants to share my knowledge and understanding with you.