(()=>{class t extends HTMLElement{connectedCallback(){salla.onReady((()=>{this.source=salla.config.get("page.slug"),"landing-page"==this.source&&(this.hideAddBtn=!0,this.showQuantity=!0),this.classList.add("product-block"),this.id=`product_${this.product.id}`,this.product.is_out_of_stock&&this.classList.add("is-out");let t=salla.config.get("store.settings.product.fit_type");t&&this.classList.add(`${t}`),this.horizontal="true"===this.getAttribute("horizontal"),this.showWishlist="true"===this.getAttribute("show-wishlist"),this.render(),salla.lang.translationsLoaded||salla.lang.onLoaded((()=>this.render()))}))}render(){const t=salla.lang.get("pages.products.remained"),a=salla.lang.get("pages.products.starting_price"),s=salla.lang.get("pages.products.out_of_stock"),n=salla.lang.get("pages.products.calories"),o=salla.lang.get("pages.products.donation_placeholder"),i=(salla.lang.get("pages.products.donation_exceed_target_amount"),salla.lang.get("pages.products.target")),d=salla.lang.get("pages.products.donation_exceed_target_date"),e=salla.lang.get("pages.products.donation_will_end_date");this.innerHTML=`\n \n
\n ${this.product.promotion_title?`${this.product.promotion_title}`:this.showQuantity&&this.product.quantity?`${t} ${this.product.quantity}`:this.showQuantity&&this.product.is_out_of_stock?`
${s}
`:""}\n \n ${this.product.image.alt}\n \n
\n ${this.showWishlist?`\n \n \n \n `:""}\n
\n
\n \n

${this.product.name}

\n

${this.product.subtitle?this.product.subtitle:""}

\n
\n ${this.product.calories?`
\n \n ${this.product.calories} ${n}\n
`:""}\n\n ${"donating"==this.product.type?`${!salla.url.is_page("cart")&&this.product?.donation?.target_amount?`
\n ${i}\n
\n ${salla.money(this.product?.donation?.collected_amount)}\n ${salla.money(this.product?.donation?.target_amount)}\n
\n
\n \n
\n ${this.product?.donation?`\n ${this.product?.donation?.can_donate?this.product?.donation?.target_message?"":e+" "+this.product?.donation?.target_end_date:`${this.product?.donation?.target_message?this.product?.donation?.target_message:this.product?.donation?.target_end_date&&"0000-00-00"!==this.product?.donation?.target_end_date?"":d+" "+this.product?.donation?.target_end_date}`}\n `:""}\n
`:""}\n
\n
\n
\n \n ${salla.config.currency().symbol} \n
\n
\n
`:""}\n
\n ${this.product.is_on_sale?`${salla.money(this.product.sale_price)}${salla.money(this.product.regular_price)}`:this.product.starting_price?`${a}${salla.money(this.product.starting_price)}`:`${salla.money(this.product.price)}`}
\n\n ${this.hideAddBtn?"":`
\n \n ${"booking"==this.product.type?'':''}\n \n
`}`,document.lazyLoadInstance?.update(document.querySelectorAll(".product-block__thumb .lazy-load"))}}customElements.define("custom-salla-product-card",t)})();