(()=>{var t=window.TPOConfigs?.product_options||window.TPOConfigs?.product_options_easify||[];window.TPOConfigs.product_options_1?.length&&(t=[...t,...window.TPOConfigs.product_options_1]),window.TPOConfigs.product_options_2?.length&&(t=[...t,...window.TPOConfigs.product_options_2]),window.TPOConfigs.product_options_3?.length&&(t=[...t,...window.TPOConfigs.product_options_3]),window.TPOConfigs.product_options_4?.length&&(t=[...t,...window.TPOConfigs.product_options_4]),t=xt(t),window.TPOConfigs.product_options_tpo=t;var o=window.TPOConfigs?.timezone,i=window.TPOConfigs.settings?.advancedTranslation,n="query"===window.TPOConfigs?.queryOptionSet,a=window.TPOConfigs.settings?.translationFileCSV,r=!!window.upcartOnAddToCart,s=document.querySelector("html").getAttribute("lang"),l={},c={requiredMessage:"This is a required field",requiredOptionMessage:"This is a required option",minCharacterMessage:"Please type at least {{minValue}} characters",maxCharacterMessage:"Please type at maximum {{maxValue}} characters",minValueMessage:"Please enter a minimum value of {{minValue}}",maxValueMessage:"Please enter a maximum value of {{maxValue}}",minOptionMessage:"Please select at least {{minValue}} options",maxOptionMessage:"Please select at maximum {{maxValue}} options",errorQuantityMessage:"Between {{minValue}} - {{maxValue}}",totalQuantitySelectorMessage:"Select a minimum of {{minValue}} and a maximum of {{maxValue}} items",totalSelectedQuantityLabel:"You've chosen: ",totalAdditionalPriceLabel:"Your selections will add an additional charge of",validNumbericMessage:"This input value is not numeric!",tableTitle:"Tiered wholesale price",quantityHeading:"Quantity",savingHeading:"Savings",saveLabel:"Save",discountBoxButton:"Apply",discountBoxPlaceholder:"Enter your discount here",discountText:"Discount",discountValidateBlank:"Discount field must not be blank",discountValidateCode:"Invalid discount code",wholeSaleDiscountLabel:"Wholesale discount",customOptionFor:"Custom Option for {{productName}}",colorPickerText:"Choose color",minFileAtleastMessage:"You must upload at least {{minValue}} file(s)",minFileMessage:"You must upload at least {{minValue}} file(s)"},p=["label"],d=["title","help_text","info_text","option_identifier","placeholder","switch_label"],u=["content","modalTitle","buttonText","labelX","labelY","labelZ"],m=Object.keys(c),_=Object.entries(c),f=new Map;_.forEach((([e,t])=>{f.set(e,t)}));var y=JSON.parse(document.getElementById("tpo-store-data")?.textContent||"{}"),h=y?.product,g=y?.collections,b=y?.cart_type,v=y?.shop?.money_format||"${{amount}}",w=y?.shop?.money_with_currency_format||"${{amount}}",S=window.TPOConfigs.template,E=y?.customer?.id,$=window.TPOConfigs.theme.product.form,C=window.TPOConfigs.theme.cart.form,x=window.TPOConfigs.theme.product.addToCartButton,k=['gp-product-button button:not([class*="tpo_option"])',"#corner-sticky-atc-cta-button"],L=["style-bundle-dev.myshopify.com","style-bundle-au.myshopify.com","textilfarm.myshopify.com","a864ee-3.myshopify.com","sports-beta.myshopify.com","608e06-2.myshopify.com","scarves-by-ruthie-l-designs.myshopify.com","toshipmyshop.myshopify.com","s-and-s-handmade-natural.myshopify.com","creativekidswonderland.myshopify.com","2397da.myshopify.com","the-inspired-stories.myshopify.com","49476b.myshopify.com","bff7f4.myshopify.com","10fae7-82.myshopify.com","reflectiveberlin.myshopify.com","b0f760-f0.myshopify.com","806bad-23.myshopify.com","animus-medicus-gmbh.myshopify.com"],q=["chips-shop-online.myshopify.com","kudosgiftwrap.myshopify.com","61062a-2.myshopify.com"],T=["hoangpm-dev.myshopify.com","frio-sparkling-water.myshopify.com"],O=["liam-test-store.myshopify.com"],A=["prix2pro.myshopify.com","thetowelturban.myshopify.com","26911b-3.myshopify.com","gorgeous-and-beautiful-flowers.myshopify.com","137837.myshopify.com","monk-customs-b2b.myshopify.com","felara.myshopify.com","a53efb.myshopify.com","28c562-3.myshopify.com","erikampowell.myshopify.com","47b05d-aa.myshopify.com","cdfa64-2.myshopify.com","quiz-trail.myshopify.com","nickoftime3.myshopify.com","2c42f0.myshopify.com","c4ac3b.myshopify.com","ea2bb7-7b.myshopify.com","shobputinzdoh.myshopify.com","bebebydunja.myshopify.com","destination-roll.myshopify.com","hicapahub.myshopify.com","3640aa-b4.myshopify.com","faa1a1-4.myshopify.com","roots-to-table.myshopify.com","4f40bd-2.myshopify.com","fennel-and-ginger.myshopify.com","duo-nini-laundry.myshopify.com"],N=["lepage-shop.myshopify.com","cowhides-direct.myshopify.com","842dc1-2.myshopify.com","6bdfce-6a.myshopify.com","2cacec-6.myshopify.com","lumerings.myshopify.com","ad5bfe-41.myshopify.com","a06aea-2.myshopify.com","indoor-golf-store.myshopify.com","spluxwheel.myshopify.com","the-cover-lounge.myshopify.com","mptperformance.myshopify.com"],P=["neonland-8196.myshopify.com","once-upon-a-book-club.myshopify.com","madeoftomorrow.myshopify.com"],M=["style-bundle-au.myshopify.com","lumerings.myshopify.com","94844e-2.myshopify.com","8c05c0-5.myshopify.com","nickrivettsport.myshopify.com","leatherique-australia.myshopify.com","asrinventions.myshopify.com","costlowboxes.myshopify.com"],F=["fa3a6d-3.myshopify.com","mount-it-site.myshopify.com","emblematic-creative.myshopify.com","developecansandco.myshopify.com","c37d5f-72.myshopify.com","the-c0-op.myshopify.com","1a3849-55.myshopify.com"],j=['.seven.columns.omega form[action$="/cart/add"] .ajax-submit.action_button.add_to_cart','.seven.columns.omega form[action$="/cart/add"] .action_button.add_to_cart','form[action$="/cart/add"] .atc-btn-container .add_to_cart',".shopify-product-form .add_to_cart",'.product-form-container form[action$="/cart/add"] .button.ajax-submit.action_button','.seven.columns.omega form[action$="/cart/add"] .action_button.add_to_cart','.six.columns.omega form[action$="/cart/add"] .action_button.add_to_cart','form[action$="/cart/add"] .btn-addtocart',".product-form form .product-form__submit:not(.tpo_ignore)",".product-form form .product-form__add-button",'form[action$="/cart/add"] .product-form--add-to-cart','form[action$="/cart/add"] .btn--subtle-hover','form[action$="/cart/add"] #product-add-to-cart','form[action$="/cart/add"] #AddToCart','form[action$="/cart/add"] .button--large','form[action$="/cart/add"] .AddtoCart','form.product-buy-buttons--form[action$="/cart/add"] .product-buy-buttons--primary[data-item="secondary-button"]','button[aria-label="add to cart"]','button[type="submit"][name="add"][data-variant-id]',".nm-easywholesale-add-to-cart-container .nm-wholesale-btn-add-to-cart",".product__atc .button--addToCart",'form[action$="/cart/add"] .product-addToCart.addToCart','form[action$="/cart/add"] input[type="submit"].add-to-cart-btn','form[action$="/cart/add"] .w-commerce-commerceaddtocartbutton.add-to-cart-button','form[action$="/cart/add"] product-buy-buttons-root .product-buy-buttons--primary',".button.product-form__submit:not(.tpo_ignore)"],I={wrapper:[".sticky-add-to-cart__inner"],form:['.sticky-add-to-cart__inner form[action*="/cart/add"]:not([id*="installment"])'],atcButton:[".product-form__mobile-sticky-button .product-form__btn","product-sticky-bar buy-buttons button",".m-sticky-addtocart .m-add-to-cart",".hs-checkout-bar-add-to-cart.btn",".sticky-add-to-cart__controls .ux-cart.button--add-to-cart","#corner-sticky-atc-cta-button",".tpo_sticky_add_to_cart_btn"]},H=[".product-info quantity-selector",".product__info quantity-selector"],B=window.TPOConfigs.theme.product.variantWrapper,D=window.TPOConfigs.settings||{},z=D?.selectorSettings?JSON.parse(D.selectorSettings):{productPageSelector:{},cartDrawerSelector:{},cartPageSelector:{},quickViewSelector:{},advanceSelectors:{}},V=['form[action*="/cart"] [type="submit"][name="checkout"]','form[action*="/cart"] [name="checkout"]',".cart__checkout-button.button:not(.cart__reset-button)","a.checkout-button.button",'.checkout-buttons a.button[href="/checkout"]',".button-checkout#cart-checkout",'a.btn[href="/checkout"]',".actions button.btn-checkout",".cms-btn-check",".cart__footer--body .cart__checkout-button",".cart-buttons__btn","#CartDrawer-Checkout",'.checkout-button[name="checkout"]',"button#checkout","button#CheckOut","button#checkout-btn-card",".w-commerce-commercecartcheckoutbutton",'[type="submit"][name="checkout"][form="cart"]','a.button[href="/checkout"]',".upcart-checkout-button"],U=["#cart-sidebar-checkout","#CartDrawer-Checkout","button#CheckOut",'.m-cart-drawer__inner [type="submit"][name="checkout"]','.scd__checkout[type="submit"][name="checkout"]',".w-commerce-commercecartcheckoutbutton",'[type="submit"][name="checkout"][form="cart"]',"#CartDrawer-Checkout",'.icartCheckoutBtnGroup button[name="icartCheckout"]',".icart-checkout-btn",".rebuy-cart__checkout-button"],J=window.location.href,R="",W=["gp-product-dynamic button","form[action*='/cart/add'] .shopify-payment-button__button:not([disabled])","form[action*='/cart/add'] .shopify-payment-button shop-pay-wallet-button","form[action*='/cart/add'] .shopify-payment-button shopify-google-pay-button","form[action*='/cart/add'] .shopify-payment-button shopify-apple-pay-button","form[action*='/cart/add'] .shopify-payment-button shopify-paypal-button",".tpo-custom_buy_it_now",".ecom-product-single__buy_it_now_btn--checkout",".m-product-form--wrapper a.buy-now_btn",".main-product__form-buttons--buyitnow button.main-product__form-submit"],Q="undefined"!=typeof Shopify?Shopify.shop:"",G=window.location.hostname,X="undefined"!=typeof Shopify?Shopify:{},Z="undefined"!=typeof Shopify&&X.theme&&(X.theme.schema_name||X.theme.name)||"",Y=["TITLE","TYPE","VENDOR","HANDLE"],K=document.querySelector("form.preview-form"),ee=document.querySelectorAll(".easify-product-options"),te=["span[data-money-convertible]"],oe=['form[action*="/cart"] .cart__final-price.text-right.small--hide [data-cart-item-regular-price]','form[action*="/cart"] .cart-item__totals.right.small-hide .price.price--end:not(.cart-item__old-price)','form[action*="/cart"] .cart-item__totals.right.large-up-hide .price.price--end:not(.cart-item__old-price)','form[action*="/cart"] span.text-right[data-label="Total"]','form[action*="/cart"] .cart__table-cell.cart__table-cell--total.cart__table-cell--right-aligned .cart__price.cart__price--bold','form[action*="/cart"] .grid-item.one-half.medium-down--text-left.text-right .cart-original-price','form[action*="/cart"] .grid__item.two-thirds.text-right .cart__price','form[action*="/cart"] .cart__items .cart__item .cart__price:not(.tpo_ignore)','form[action*="/cart"] .grid__item.one-quarter.one-half.medium-down--one-third.text-right .h5','form[action*="/cart"] .text-right.small--hide [data-cart-item-line-price-container] .cart-item__original-price.cart-item__price','form[action*="/cart"] .cart-item__totals.right:not(.large-up-hide) .cart-item__price-wrapper .price.price--end:not(.cart-item__old-price)','form[action*="/cart"] .cart__page .cart__item .cart__price:not(.tpo_ignore)','form[action*="/cart"] .cartitems .cart-item--inner .cart-item__total .money:not(.tpo_ignore)','form[action*="/cart"] .price_total .money > span:not(.tpo_ignore)',"cart-drawer line-item price-list span.money:not(.tpo_ignore)","cart-drawer line-item price-list sale-price:not(.tpo_ignore)",'form[action*="/cart"] .order-summary__body td:last-child span.money:not(.tpo_ignore)','form[action*="/cart"] .order-summary__body td:last-child','form[action*="/cart"] .cart__page .cart__item .cart__price:not(.tpo_ignore)',"cart-form .cart-item__price .cart-item__selling-price:not(.tpo_ignore)",".previewCartItem-content .previewCartItem-price .price span[data-item-final-price-display]",".cart-item .cart-item-value[data-item-price-with-quantity-display]",".cart__item .cart__item__price","line-item .price-list:not([class*='hidden']) .price:not(.price--compare)","tr.line-item .price-list:not([class*='hidden']) .price:not(.price--compare)",'form[action*="/cart"] .cart__items > div[data-js-product] div:last-child > .price > span',".cart__product .o-layout__item.u-6\\/10.u-2\\/8\\@tab .cart-item__price .money > span",".cart-collateral > .price",".product-item-qty > .price","[data-mczr='item_final_line_price-not-mczr']",".pr_price_rw > .product-price","#cart-items .cart-item .cart-item__total.price .price__current",".cart__item--price .cart__price",".CartItem__PriceList span[data-money-convertible]",".ajaxcart-item__price .money","span.cart-item__final-price",".ajaxcart__product-price-wrapper .ajaxcart__price","cart-remove-button ~ .price.product-price",".cart-item__price .cart-item__price-item",".cart-product__price span",".cart-product__total-price","tr .cart-price:not(.tpo_ignore)",".tdf-cart-item-lp-p",".line-item__line-price span:not(.tpo_ignore)",".line-item__price.line-item__price--highlight:not([data-tpo])",".line-item__price:not([data-tpo])",".cart-item__price .money:not(.tpo_ignore)",".t4s-cart-item-price:not(.tpo_ignore)",".t4s-cart_meta_prices .t4s-cart_price:not(.tpo_ignore)",".cart-item__totals .price.price--end:not(.cart-item__old-price)",".cart-totals .price.price--end:not(.cart-item__old-price) .ymq_item_original_line_price",".cart__items__price .line__price",".ajax-cart__item-line-price span[data-cart-item-regular-price]",".cart-item__price strong",".cart-item__total strong",".scd-item__original_line_price",".scd-item__original-price",".cart-item__total .theme-money:not(.tpo_ignore)",".price_total span.money:not(.tpo_ignore)",".mini-cart__item-price .money",".CartItem__Actions ~ .CartItem__LinePriceList .CartItem__Price.Price",".bcpo-cart-item-line-price",".cart-notification-product .amount",".mini-cart__price-list",".product-cart-item-price ins .amount",".product-subtotal ins .amount",".item.product.product-item .price:not(.tpo_ignore)",".cart-item__total-price span.price:not(.tpo_ignore)",".cart-item__totals .cart-item__price-wrapper span.price:not(.tpo_ignore)",".cart__item__content .cart__price:not(.tpo_ignore)",".totalPriceOfItemElementTPO",".cart-item__total .cart-item__price:not(.tpo_ignore)",".price.price--default .price__items span.price__regular:not(.tpo_ignore)",".cart__price-wrapper .text-money .cart__price:not(.cart__price--compare) span.money",".cart-item-line-prices .money.cart-item-line-price.cart-item-final-line-price:not(.tpo_ignore)",".drawer-item__info .item-info__price span.money",".cart-item__price span.money:not(.tpo_ignore)",".cart-item__total span.money:not(.tpo_ignore)",".cart__item-total.text-body:not(.tpo_ignore)",".item__subtotal-price .tt-price.subtotal",".ajax-cart__price:not(.tpo_ignore)",".cart__total .money:not(.tpo_ignore)",".mini-cart-item__details-right .mini-cart-item__price-wrapper .price--end",".upcart-item-price",".cart-item__totals .total-price > span:not(.tpo_ignore)",".icart-product-price .transcy-money",".icart-pg-item-total .total-cart-price .transcy-money",".rebuy-money > span:not(.sr-only)",'.cart-items__price[headers="productTotal"] text-component'],ie=['form[action*="/cart"] .cart-item__totals.right.small-hide .cart-item__old-price','form[action*="/cart"] .cart-item__totals.right.large-up-hide .cart-item__old-price','form[action*="/cart"] .cart-item__totals.right:not(.large-up-hide) .cart-item__price-wrapper .cart-item__old-price',".previewCartItem-content .previewCartItem-price .price .before-discount-price","cart__price--strikethrough",".line-item__price.line-item__price--compare",".oldPriceOfCartItemElementTPO"],ne=[".cart-subtotal .cart-subtotal__price",".totals .totals__subtotal-value:not(.tpo-ignore)",".totals .totals__total-value:not(.tpo-ignore)",".grid__item.text-center.large-up--one-half.large-up--text-right .cart__subtotal.h3",".cart__subtotal-wrapper .cart__subtotal[data-cart-total]","p.h3.cart__subtotal span",".cart-subtotal .h1.cart-subtotal--price small",".grid__item.one-half.large--one-third .cart__subtotal",".cart__subtotal .h5.cart__subtotal-price",".cart__item-sub [data-subtotal]",".cart__item-sub .cart__item-row",".cart-drawer .subtotal .theme-money",".cart-subtotal-row .product-price",".cart__item-sub .cart__item-row",".totals .totals__total-value:not(.tpo-ignore)",".cart-total .cart-final-total .cart-subtotal .money",".cart-title-total .money",".cart-recap span:nth-child(2):not(.cart-recap__amount-saved)",".cart-drawer__button-price > span.money",".cart-drawer__button-price",".previewCartTotals.total .previewCartTotals-value",".cart-total-value[data-cart-total-value]",".summary > .total > .price","span[data-cart-total].cart__total__money","div.cart__item-sub.cart__item-row.cart__item--subtotal > div.bcpo-cart-original-total span",".mini-cart__total-price",".tpo_cart-drawer-checkout-price",".subtotal .js-total-price",".cart_total .product-price",".ajaxcart__subtotal .money",".ajaxcart__footer-price .ajaxcart__subtotal",".cart-notification-popup-item__price-item",".cart-subtotal .cart-subtotal__totals-price",".cart-total-price .cart-total-price__value",".tpo_total-price_element",".cart-original-total.cart-price",".tdf-cart-total-parent",".cart-recap__price-line-price",".cart__footer-total .money",".t4s-cart__totalPrice",".cart_btns .cart_total span:last-child",".totals.cart_total span:last-child","span[data-cart-final]",".cart__total strong.text-size--heading",".cart__total.cart__details--row strong",".cart_subtotal.js-cart_subtotal span.money",".cart-cost .money",".cart-drawer__total_text-button",".mini-cart-bottom .cart-subtotal span",".cart-total .price .amount",".tpo_cart_subtotal",".cart-total .subtotal .amount.price-container",".minicartpro-summary .amount.price-container",".cart-subtotal:not(:has(.amount))",".cart__total .cart__total__price:not(.tpo_ignore)",".cart-item__total-content .cart-item__price",".cart-drawer__total span[data-price]",".cart__total-price-info .cart__subtotal span.money",".cart-cost span.money",".header-minicart-footer-wrapper .sticky-menu-button-checkout-price.money",".cart-drawer__cart-total span.money",".mini-cart-total .js-cart-total",".ajax-cart__subtotal .money",".mini-cart__subtotal-wrapper .mini-cart__subtotal .totals .totals__subtotal-value",".cart-summary__line-items #cart-total-price",".cart-total-price",".rebuy-cart__flyout-subtotal-amount"],ae=[".cart-subtotal .cart-subtotal__price",".totals .totals__subtotal-value:not(.tpo-ignore)",".totals .totals__total-value:not(.tpo-ignore)",".grid__item.text-center.large-up--one-half.large-up--text-right .cart__subtotal.h3",".cart__subtotal-wrapper .cart__subtotal[data-cart-total]","p.h3.cart__subtotal span",".cart-subtotal .h1.cart-subtotal--price small",".grid__item.one-half.large--one-third .cart__subtotal",".cart__subtotal .h5.cart__subtotal-price",".cart__item-sub [data-subtotal]",".cart__item-sub .cart__item-row",".cart__item-sub .cart__item-row",".totals .totals__total-value:not(.tpo-ignore)",".cart-total .cart-final-total .cart-subtotal .money",".cart-title-total .money",".cart-recap span:nth-child(2):not(.cart-recap__amount-saved)",".previewCartTotals.total .previewCartTotals-value",".cart-total-value[data-cart-total-value]",".total > .label~.price",".cart__total span[data-cart-total].cart__total__money","div.cart__item-sub.cart__item-row.cart__item--subtotal > div.bcpo-cart-original-total span",".cart__total-container > span:last-child",".cart__sidebar .cart__subtotal > h3",".info-checkout .item.total",'[data-mczr="cart_total_price"]',".cart_total .product-price",".subtotal .cart_subtotal .money > span",".totals .totals__subtotal-value.product-price",".cart-subtotal .cart-subtotal__totals-price",".cart-total-price .cart-total-price__value",".cart-original-total.cart-price",".tdf-cart-total-parent",".cart-recap__price-line-price",".cart__footer-total .money",".t4s-cart__totalPrice",".cart_btns .cart_total span:last-child",".totals.cart_total span:last-child",".cart__total strong.text-size--heading",".subtotal .theme-money",".cart__total.cart__details--row strong",".cart_subtotal.js-cart_subtotal span.money",".cart__total cart-total.money .money",".Cart__Recap .Cart__Total span",".tpo_cart_subtotal",".cart-cost .money",".subtotal .subtotal__price",".header-top__cart-button .cart-button__total.money",".checkout-sidebar .cart-subtotal .ymq_cart_total_price",".cart-items__totals .cart-items__total span[data-price]",".cart__total-price-info .cart__subtotal span.money",".cart-cost span.money",".cart-total-row .cart-total-row-value.money",".sticky-menu-container .sticky-menu-button-checkout-price.money",".cart-template__cart-total .ymq_cart_total_price","p#CartSubtotal","tr#grandtotal td",".cart__subtotal-container .cart__subtotalcart__subtotal .money",".cart-total-price",".icart-pg-checkout .icart-pg-discount-price .transcy-money"],re=[".previewCartTotals.subTotal .previewCartTotals-value",'form[action*="/cart"] .cart-total-subtotal .cart-total-value',"div.cart__item-sub.cart__item-row.cart__item--subtotal > div.bcpo-cart-original-total span",".cart__footer-total .money > span",".info-checkout .item.subtotal","#cart-summary > div.flex.justify-between.items-center.mt-6 > p:not(.tpo_ignore)",".cart__footer-page span[data-subtotal]",".sf-cart-subtotal__price",".scd__subtotal-price",".subtotal .subtotal__price",".cart__summary-totals .cart__total-container .cart__summary-item.cart__total .cart__total-value[data-cart-subtotal]"],se=[".btn-secondary.update-cart",".btn--secondary.update-cart",'.cart__actions input[name="update"]','.cart__footer button[name="update"]',".btn--secondary.cart__update",".btn-update-qty.active-update",".ajax-cart__item-update--no-js"],le=[".cart-items__quantity .cart-items__remove",".cart-item__quantity .cart-item__quantity-wrapper cart-remove-button > a",".cart-item__quantity .cart-item__quantity-wrapper cart-remove-button > button",".small--text-left .cart__product-information .cart__remove:not(.tpo_ignore)",".small--text-left .cart-item__remove:not(.tpo_ignore)",".cart-item__totals.right cart-remove-button",".con_row .remove_item_button",".item-details .three .remove_item_multi ",'.cart-page form[action*="/cart"] .ajax-cart__cart-items .ajax-cart__cart-item .ajax-cart__item-remove ',".mini-products-list .remove","quantity-popover cart-remove-button",".cart__item__remove[data-item-remove]",".previewCartItem-remove","a.cart-remove","li.item > a.btn-remove",".cart--remove a.remove",".cart-remove a",".cart__remove:not(.tpo_ignore)","line-item-quantity > a[href*='quantity=0']",".cart__product .cart__remove-wrapper > a",".cart-item__remove-link",".each-item > .delete-item > a",".js-remove-item.remove",".btn.cart_remove",".ajaxcart__qty-remove",'.w-commerce-commercecartiteminfo a[data-node-type="cart-remove-link"]',".cart__items__remove","a.CartItem__Remove","cart-remove-button .btn-remove","cart-remove-button",".ajaxcart__remove",".cart-product__remove",".ajax-cart__item-remove",".t4s-mini_cart__remove",".t4s-page_cart__remove",".cart-item__actions .remove",".scd-item__remove",".cart-item__remove:not(.tpo_ignore)",".cart__remove-btn",".cart__product-remove",".cart-product-info .remove",".product-cart-item-info > a.remove",".product-quantity > a.remove",".quantity__remove",".action.cart-close.btn-remove","cart-remove-button button.link","cart-remove-button > a","a.ajax-cart__item-remove--no-js","button.cart-item-remove",".item-info__remove",".btn.js-remove-mini-cart",".cart__row a.small",".cart-remove-mobile",".cart-item--remove-link",".ajax-cart__delete",".icart-delete-btn",".icart-pg-qty-delete-btn",".rebuy-cart__flyout-item-remove",".cart-items__remove"],ce=["#CartDrawer.drawer","#CartDrawer","#cart-drawer","cart-slideout #MiniCartSlideout","#js_cart_popup","#shopify-section-cart-drawer","#drawer-cart","#halo-cart-sidebar","#sidebar-cart.Drawer",".right-drawer-vue",".js-drawer.drawer","#slideout-ajax-cart","#t4s-mini_cart","sidebar-drawer#site-cart-sidebar","#cart-notification","#mini-cart .mini-cart__inner","#cdz-popup-area",".drawer.drawer--cart",".minicart",".site-main.header-minicart",".site-header__cart .mini-cart-content",".w-commerce-commercecartform","#theme-ajax-cart",".mini-cart__contents",".icart-cart-main","#CartPopup","form.mini-cart__sidebar",".icart-slider-drawer","#rebuy-cart .rebuy-cart__flyout","cart-drawer-component.cart-drawer cart-items-component.cart-items-component"],pe=["cart-drawer-items","cart-drawer > .cart-drawer__items",".cart-drawer__items",".cart-drawer__body",".js-cart-inner",".cart__table-row",".ajax-cart__cart-items","#CartDrawer-CartItems",".cart__items",".w-commerce-commercecartitem",".cart_items .mini-cart__item",".cart-notification-products .cart-notification-product",".item.product.product-item","#header-minicart-drawer .cart-item",".cart-drawer__item",".mini-cart-item",".icart-new-box",".upcart-product-item",".m-cart-drawer__items",".cart-items__wrapper"],de=["cart-items",".cartitems",".cartContainer .cartContent",".shopify-section--main-cart",".cart__items__wrapper .cart__items","#MainContent > div.page-width.page-width--cart.page-content","#CartPageForm > div.cart__page .cart__page-col",".line-item-table__list",".shoppingcart-content > .wrap-cart",".cart-items__items",".cart__table-body .cart__table-row",".cart-wrapper__inner","#cart .cart__items",".cart__products","tbody[data-cart-line-items]",".mini-products-list.minicart-items.product-items",".cart-template__items .cart-item:not(.cart-item--titles)",".icart-pg",".cart-items-container",".icart-pg-cart-content",'[data-template="cart"] cart-items-component.cart-items-component .cart-page'],ue=['tbody:not(.tpo_table-body) > tr:not([class="title"]):not(.cart-total):not(.cart-subtotal):not(.order-total):not(.tpo_table-body > *)',"div.cart__item:not(.cart__item--headers)",".cartitems--list:not(.cartitems > *)",".cart-drawer__items line-item",".cart-drawer__items tr","li.previewCartItem.clearfix",".cart-item:not(td):not(li):not(.cart-item--titles):not(.col):not(.tpo_ignore)","li.cart-product-item","#CartDrawerForm:not(form)",".cart__item:not(.cart__item--headers)","line-item:not(.tpo_ignore)","tr.line-item",".cart__product",".cart__items__row",".Cart__ItemList .CartItem:not(.CartUpsell__ProductItem)",".cart__table-body .cart__table-row",".t4s-page_cart__item",".t4s-mini_cart__item",".cart-items .cart-item:not(.cart-item--titles):not(.col):not(.tpo_ignore)",".ajax-cart__cart-items .ajax-cart__cart-item","#cart .cart__items .cart__item",".cart-form__items .cart-form-item",".w-commerce-commercecartitem",".cart__wrapper .cart__item",".cart_items .mini-cart__item",".cart-notification-products .cart-notification-product",".mini-cart__line-item","#Cart-Drawer .product-cart-item",".drawer__cart-items-wrapper .cart-item",".minicart__entry",".cart-items__products",".cart-template__items .cart-item:not(.cart-item--titles)",".cart-drawer__item",".mini-cart-item","tr.cart__row","li.cart-item:not(.tpo_ignore)",".ajax-cart__product",".cart__card.container",".upcart-product-item",".icart-bottom-new-checkout.ic-cart-item",".icart-pg-cart-item.ic-cart-item",".rebuy-cart__flyout-item",".cart-items__table tbody tr.cart-items__table-row"],me=["dl",".cart__item--name","cart-item--content","div.line-item-info",".cart-item-properties",".cart__item__meta","div.cart__item-details .cart__item--properties",".cart__item-details .cart__item-title",".line-item__info .product-item-meta",".cart-item__description .lightly-spaced-row .small-text",".cart__items__meta",".CartItem__PropertyList",".cart-product__desc",".cart-item .cart-title",".line-item__meta:not([data-tpo])",".t4s-cart_meta_propertyList",".cart-item__details dl",".cart-item__content",".cart-form-item__price-title-variants",".cart__product-options",".mini-cart__item-properties",".tpo_properties_wrapper",".cart-product-info",".line-item__property-list",".mini-cart__property-list",".product-item .product-info",".cart-item-information-row",".cart-item__info .cart-info",".mini-cart-meta",".icart-product-properties",".cart-item__title"],_e={CART:["#main-cart-items .cart-item__media .cart-item__image-container .cart-item__image",".cart__item .cart__image .image-wrap img"],DRAWER:[".drawer__cart-items-wrapper .cart-items .cart-item .cart-item__media .cart-item__image",".cart__item .cart__image .image-wrap img",".cart-items__media .cart-items__media-container .cart-items__media-image"]},fe=[".quantity__input[name*='quantity']:not(.tpo_option-input)","input[name*='quantity']:not(.tpo_option-input)"],ye=["quantity-input",'input[aria-label="Quantity"]',"input.form-input.quantity",".quantity > input.item-quantity",".cart--quantity input",".cart-quantity input",".cart__item__quantity-field","line-item-quantity:not([class*='hidden']) > .quantity-selector",'div[data-js-product] input[name="updates[]"]',".js-qty__num",".js-qty__num .js-qty-input",".input-text.qty.js_qty",".qty.cart__qty-input",".ajaxcart__qty-num",".cart-item-quantity__input",".cart-quantity input","input.quantity-selector__value",".t4s-quantity-input",".ajax-cart__qty-input",".qty.qty-selector.product__quantity",".scd-item__qty_input",".w-commerce-commercecartquantity",".product-quantity-box input.quantity",".cart__qty-input",".QuantitySelector__CurrentQuantity",".cart__product-qty",".quantity-input",'quantity-selector input[name="updates[]"]',".quantity__change .quantity__number",".item-qty.cart-item-qty",".ajax-cart__item-quantity input.ajax-cart__qty-input",".quantity--input__input",".cart-item__quantity quantity-select input.quantity__input",".cart-item__quantity-wrapper .quantity",".item-info__quantity-wrapper ","input.js-qty__input",".icart-qty-picker",".cart-item__quantity .quantity input",".cart-items__quantity quantity-selector-component"],he=["quantity-input","input.quantity__input","input.form-input.quantity","quantity-selector input",".cart__item-sub .js-qty__wrapper input",".cart__item__quantity-field",'input[pattern="[0-9]"]',".input-text.js_qty",".cart-item__quantity-input",'input.ajaxcart__qty-num[name="updates[]"]',"input.QuantitySelector__CurrentQuantity",".counter.input-group input.inputCounter",".ajax-cart__qty-input",".quantity-selector__input",".js-qty__num",".t4s-quantity-input",".qty.qty-selector.product__quantity",".scd-item__qty_input",".w-commerce-commercecartquantity",".product-quantity-box input.quantity",".item-qty.cart-item-qty",".quantity--input__input",".cart-item__quantity-wrapper .quantity",".item-info__quantity-wrapper ",".js-qty .js-qty__input",".tpo_quantity_hidden",".quantity-input",".icart-qty-picker",".upcart-product-quantity-input",".cart-item__quantity .quantity input",".rebuy-cart__flyout-item-quantity-widget-label",".cart-items__quantity quantity-selector-component"],ge=[".quantity__input[name*='quantity']"],be=[".quantity__button.no-js-hidden:not(.qtyremove)","button.js-qty__adjust",".qtyField .qtyBtn:not([rv-text])",".quantity.buttoned-input .notabutton","button.js-qty__adjust",".quantity-selector__wrapper .quantity-selector__button.quantity-selector__button--minus",".quantity-selector__wrapper .quantity-selector__button.quantity-selector__button--plus","line-item-quantity:not([class*='hidden']) > quantity-selector > a","a.btn-quantity",".cart-quantity .qty-group a",".cart__item__quantity button[data-quantity-button]","line-item-quantity:not([class*='hidden']) > .quantity-selector > a","button[name='minus']","button[name='plus']",".group-quantity-button > a","button.ajaxcart__qty-adjust.ajaxcart__qty--minus","button.ajaxcart__qty-adjust.ajaxcart__qty--plus",".quantity__wrapper > .quantity__button",".CartItem__QuantitySelector .QuantitySelector .QuantitySelector__Button","quantity-component quantity-btn",".counter.input-group .inputCounter__btn","button.quantity-selector__button",".t4s-quantity-selector.is--minus",".t4s-quantity-selector.is--plus",".ajax-cart__qty-control--down",".ajax-cart__qty-control--up",".qty-button.qty-minus",".qty-button.qty-plus",".scd-item__btn",".cart-item__quantity .quantity > a",".product-minus",".product-plus",".qty-container .qty-adjust","quantity-selector button",".quantity__change > a",".quantity--input__button",".cart-item-quantity .quantity-decrement",".cart-item-quantity .quantity-increment",".quantity--minus",".quantity--plus",".quantity-minus",".quantity-plus",".icart-minus",".icart-plus",".icart-pg-minus",".icart-pg-plus",".upcart-product-quantity-minus",".upcart-product-quantity-plus",".rebuy-cart__flyout-item-quantity-widget-button"],ve=["span.price-item--last:not(.tpo_ignore)","span.price-item--regular:not(.tpo_ignore)",".cart-item__name ~ .product-option > span",".cart-item__name ~ .product-option",".product-detail .price-container .price-area .price .current-price.theme-money",".product__info-wrapper .price-item.price-item--regular:not(.tpo_ignored) .money",".product__price:not(.product__price--compare) .price__current .money",".price-list > span.price","span.price-item.price-item--regular:not(.tpo_ignore)",".product-info sale-price:not(.tpo_ignore)",'span.pr_price > span[id*="ProductPrice"]',".ProductMeta__PriceList span.ProductMeta__Price",".product-block--price span.product__price:not(.product__price--compare):not(.tpo_ignore)",".price__current .money","#product-price .product-price",".product-price span.product-price--original:not(.tpo_ignore)",".product-single__price-number .money",".product-info__price .price__default .price__current",".price-item.price-item--sale:not(.tpo_ignore)",".tpo_product_price_element",".price-list.price--highlight > span",".product-single__price.product-price.price-box",".price-container__price span.price-container__price",".product-single__price:not(.tpo_ignore)",".product-price .product-price__current-price:not(.tpo_ignore)",".tt-price > .new-price",'product-price div[ref="priceContainer"] .price'],we=["s.price-item.price-item--regular:not(.tpo_ignore)",".price__compare-at .money",".product-block--price .product__price--compare",".was-price.theme-money","del > span.amount",".price.price--compare > span",".tpo_product_old_price_element","s.price__was"],Se=[".product-card-wrapper:not(.tpo_ignore)",'form[action="/cart/add"] [data-pf-type="Column"]','form[action="/cart/add"] .item-content:not(.tpo_ignore)',".product-details-wrapper:not(.tpo_ignore)","product-info:not(.tpo_ignore)","product-card:not(.tpo_ignore)",".product-info:not(.tpo_ignore)",".product__info:not(.tpo_ignore)",".wrap-product-info:not(.tpo_ignore)",".productitem[data-product-item-content]",".productView-details .productView-product:not(.tpo_ignore)",".product__sale-box.product__info-box:not(.tpo_ignore)",".Product__InfoWrapper .Product__Info:not(.tpo_ignore)",".product-details:not(.tpo_ignore)",".product-form[data-product-id]:not(.tpo_ignore)",".product-single__meta:not(.tpo_ignore)","#product-description",".grid-product__content",".product-single__box",".product__info-wrapper",".product-information:not(.tpo_ignore)",".product-block-list__item.product-block-list__item--info",".product-info-main:not(.tpo_ignore)",".card-product:not(.tpo_ignore)",".product-information--inner",".product-single__info-wrapper",".tt-product-single-info",".product-converter__content:not(.tpo_ignore)"],Ee=[".cart__item-details:not(.tpo_ignore)",".cart-item__details:not(.tpo_ignore)",".cart-item-properties:not(.tpo_ignore)","div.line-item-info:not(.tpo_ignore)",".cart__item__info .cart__item__meta:not(.tpo_ignore)",".cart-item--content:not(.tpo_ignore)",".product-item-meta__property-list:not(.tpo_ignore)",".wrap_item_cart dl","ul.product-details:not(.tpo_ignore)",".cart-item__title:not(.tpo_ignore)",".cart-items__details"],$e=["li:not(.tpo_ignore)","figure",".flickity-viewport > div > div",".flickity-viewport .product__media-item",".splide__list .splide__slide",".product__thumb-item","button.product-gallery--media-thumbnail.product-gallery--image-thumbnail",".image-thumbnail.product-single__thumbnails-item.js-thumb-item",".slick-list .slick-track li.slick-slide",".product-thumb-wrap .swiper-wrapper .swiper-slide",".pmslider-dots_container .pmslider-dots_dot-wrapper",".product-gallery__thumbnail",".lSSlideOuter .view-more-list .lslide",".pf-media-slider div",".main-product__media-thumbs-list .main-product__media-thumbs-item",".product-single__thumbnail-item",".prThumb.product-single__thumbnails-item",".media__thumb",".slideshow-controls__thumbnails .slideshow-control"],Ce=[],xe=[],ke=[],Le=[],qe=["5a75b6-6.myshopify.com","79e519-2.myshopify.com","94844e-2.myshopify.com","ofeksjudaica.myshopify.com"],Te=["lowens-little-treasures.myshopify.com","melanie-jayne-com-au.myshopify.com","snapemaltings.myshopify.com","a53efb.myshopify.com","ren-jewelry-4772.myshopify.com","502c73-2.myshopify.com","iboxspring.myshopify.com","aaceeb-2.myshopify.com","f6991b-2.myshopify.com","039f1d-2.myshopify.com","7cc67c.myshopify.com","fireflybazaartx.myshopify.com","e639ab.myshopify.com"],Oe=["a53efb.myshopify.com","a553aa-2.myshopify.com","college-jewelry.myshopify.com","neonland-8196.myshopify.com","hannahchobeauty.myshopify.com"],Ae=["outletdelcafe.myshopify.com","the-f3-gear-store.myshopify.com","ren-jewelry-4772.myshopify.com","pet-on-canvas.myshopify.com","1c30a9-3.myshopify.com","272d29.myshopify.com","d2d521-2.myshopify.com","classyironworks.myshopify.com","ba1d4b.myshopify.com","ohmollydress.myshopify.com","55361c-bc.myshopify.com","eenie-meenie-mine.myshopify.com","3394c3-2.myshopify.com","classyironworks.myshopify.com","de2962-2.myshopify.com","cf463b-3.myshopify.com","mastergrade-hobbies-inc.myshopify.com","66c988-2.myshopify.com","confetticom.myshopify.com","indoor-golf-store.myshopify.com","biaseditions.myshopify.com"],Ne=["creativelykaty.myshopify.com","a553aa-2.myshopify.com","shop-living-gardens.myshopify.com","pet-on-canvas.myshopify.com","fratrings.myshopify.com","ringsforchamps.myshopify.com","ad7dbd-2.myshopify.com","sayitwithdiamonds-com.myshopify.com","55361c-bc.myshopify.com","acropad.myshopify.com","flightcell.myshopify.com","oppastore-rashmi.myshopify.com"],Pe=["66f2b7.myshopify.com","noallani.myshopify.com","whelan-wellness-merch.myshopify.com","0eeaa5.myshopify.com","526942-3.myshopify.com","62df50.myshopify.com","f7eadb-56.myshopify.com"],Me=["initial-tiles.myshopify.com","pretty-fireplaces.myshopify.com","jis-boutique.myshopify.com","embroplacestore.myshopify.com","confetticom.myshopify.com","15f2b9-71.myshopify.com","3ccede-0d.myshopify.com"],Fe=["net-development.myshopify.com","pkdotbiz.myshopify.com"],je=["anh-27-dev.myshopify.com"],Ie=[],He=[],Be=!1,De=[],ze=[],Ve=[],Ue=Fe.includes(Q),Je=je.includes(Q),Re=Ie.includes(Q),We=He.includes(Q),Qe="notActive"===TPOConfigs?.settings?.livePreviewShowPreviewProperties||De.includes(Q),Ge=ze.includes(Q),Xe=Ve.includes(Q),Ze="notActive"===TPOConfigs?.settings?.livePreviewShowProductImageWithOptionPreview,Ye=["pkdotbiz.myshopify.com"].includes(Q),Ke=["79dd1a-48.myshopify.com","7b9ee9-61.myshopify.com","mikreative.myshopify.com","the-meter-box.myshopify.com","jd-customs-usa.myshopify.com","6e8b56.myshopify.com","intersport-kuhn.myshopify.com","oneworld-memorials.myshopify.com","ac2cea-2.myshopify.com","73836b-3.myshopify.com","playr-fit-teamwear.myshopify.com","3156cc-5.myshopify.com","www-sinclo-com-au.myshopify.com","www-smocksandfrocks-co-uk.myshopify.com","embroplacestore.myshopify.com","77d582-83.myshopify.com","eenie-meenie-mine.myshopify.com","the-couture-cushion.myshopify.com","easify-product-options.myshopify.com","barrier-boss.myshopify.com","home-themedhome.myshopify.com","leatherexpressions.myshopify.com","943925-c1.myshopify.com","04afea-3.myshopify.com","dab95a-2.myshopify.com","5324bd.myshopify.com","29b7f4-ea.myshopify.com","7e2dfe.myshopify.com","b2c4cd-d7.myshopify.com","carlitos-handmade-de.myshopify.com","a88723-60.myshopify.com","rofielty.myshopify.com","8a56ab-4.myshopify.com","luffleberry.myshopify.com","index-bindery-and-stationery.myshopify.com","cakewarehouse-co-nz.myshopify.com","251263-43.myshopify.com","69aa90-3.myshopify.com","rasicaljp.myshopify.com","classichound.myshopify.com","dc5116-83.myshopify.com","bloomthis.myshopify.com","raceline-digital-7369.myshopify.com","g1ki1p-q0.myshopify.com","silver-supermarket.myshopify.com","houndtees.myshopify.com"].includes(Q),et="",tt=[".product-form__buttons"],ot="https://cdn.shopify.com/s/files/1/0748/6904/7603/files/flatpickr.min.css?v=1742204346",it="https://cdn.shopify.com/s/files/1/0748/6904/7603/files/quill.snow.css?v=1742204347",nt="https://cdn.shopify.com/s/files/1/0748/6904/7603/files/swiper-bundle.min.css?v=1742204347",at=document.getElementsByTagName("head")[0],rt=document.getElementsByTagName("body")[0],st="/";"undefined"!=typeof Shopify&&void 0!==Shopify.routes&&(void 0!==Shopify.routes.root?st=Shopify.routes.root:void 0!==Shopify.routes.root_url&&(st=Shopify.routes.root_url));var lt=[".right-drawer-vue","quick-view-modal"],ct=["quick-add-modal","quick-buy-modal",".modal[data-modal-container]","quick-view-modal",".modal--quick-shop","#halo-quick-view-popup","#Product-Drawer","#quick-add-modal-content"],pt=["modal-opener:not(.tpo_ignore)",".quick-add-wrapper:not(.tpo_ignore)","product-card .product-card__quick-add-button[type='button']:not(.tpo_ignore)",".productitem--action-trigger:not(.tpo_ignore)","quick-view-modal-opener:not(.tpo_ignore)",".quick-product__btn:not(.tpo_ignore)",".quickview-icon:not(.tpo_ignore)","quick-view:not(.tpo_ignore)",".quick-add__button--choose:not(.tpo_ignore)"],dt=["button","a"],ut=[".product-details-wrapper",".product__info-wrapper"],mt=[],_t=[],ft=[],yt=[],ht=[".cart-drawer .header-actions__action",".section-header a.cart-link",".cart__toggle",".header__icon-list a[aria-controls='mini-cart']",".navlink[data-drawer-toggle='drawer-cart']",".js-drawer-open-right-link",".header__cart.cart-open-trigger","#cartTotal","#cart-icon-bubble",".js-mini-cart-trigger.js-slideout-open",".js-drawer-open-cart","#HeaderCartTrigger",'[data-drawer-toggle="drawer-cart"]',"a.js-mini-cart-trigger",'.header__secondary-nav a[href="/cart"]',".header-actions.header-actions--buttons a.button",'a.sf-cart-icon[href="/cart"]',".w-commerce-commercecartwrapper",".header__icons a#cart-icon",".header__cart-toggle","#cart-drawer-toggle",'.header-cart > a[href="/cart"]',".action.showcart",'label[for="minicart__button--header--default"]',".theme__header a.navlink.navlink--cart.navlink--cart--icon",".site-actions-cart a[header-minicart-drawer]",".header-controls__cart",".js-toggle-cart",".js-header-cart-status-btn",".icon-bag.mini_cart.dropdown_link","#cart-open",'a.hdt-has-count-box[href="/cart"]',"cart-drawer-component.cart-drawer button.header-actions__action",".js-mini-cart-trigger",".tpo-mini-cart-trigger"],gt=[".js-btn-addgifcart",".js-btn-giftcart"],bt=["imaginedgifts.myshopify.com","51c5d9-2.myshopify.com"],vt=["text-box","text-number","text-area","quantity","date-picker","time-picker","color-picker","time-picker","date-range","switch","file-upload","font-picker"],wt=["93359d-2.myshopify.com","65be99-6.myshopify.com","198dni-4v.myshopify.com","acez9x-fa.myshopify.com","fit-scrubs.myshopify.com","mdrdxp-wp.myshopify.com","bc1afe.myshopify.com","prt4kv-qb.myshopify.com","the-little-laser-shop-aebf.myshopify.com","xv6513-zc.myshopify.com","dipcrew.myshopify.com","8eeabd-2.myshopify.com","48ae95-b4.myshopify.com","70is8v-n0.myshopify.com","roots-to-table.myshopify.com","fta0zs-xz.myshopify.com","private-label-skin-care.myshopify.com"],St=!!window.outsellApp,Et="tpo_duplicate-addtional-price__wrapper",$t=["Heritage","Horizon","Savor","Vessel","Dwell","Tinker","Ritual","Pitch","Atelier","Fabric"],Ct=["ul.product-grid .product-grid__item product-card-link product-card.product-card","slideshow-component.resource-list__carousel product-card.product-card",".resource-list--grid .resource-list__item product-card.product-card"];if("a864ee-3.myshopify.com"===Q?(window.location.href.includes("/cart")||window.location.href.includes("/products"))&&console.log("%cWelcome to Easify Product Options app!","color: blue; font-size: 16px; font-weight: bold;"):"ac9697-3.myshopify.com"!==Q&&console.log("%cWelcome to Easify Product Options app!","color: blue; font-size: 16px; font-weight: bold;"),Q&&"nicklolo.myshopify.com"===Q){const e=document.getElementsByTagName("head")[0],t=document.createElement("style");t.innerHTML="\n .product-form__payment-container {\n flex-direction: column!important;\n }\n ",e.append(t)}function xt(e){return e.filter((e=>e&&void 0!==e.option_set_id)).sort(((e,t)=>e.option_set_id-t.option_set_id))}function kt(e,t,o){const i={...e};let n=s;for(const a of o)if(t[e[a]]){const o=t[e[a]];o[n]&&(i[a]=o[n])}return i}async function Lt(e){try{const t=await fetch(`${st}products/${e}.js`,{method:"GET"}),o=await t.json();if(t.ok)return o;console.error("Error fetch product data details!",o)}catch(e){console.error("Error: ",e)}}async function qt(e,t){const o=e?JSON.parse(e):[];let i=!0;return t&&t.length&&t.every(((e,t)=>o[t]&&e.url===`/products/${o[t].product_handle}`))&&(i=!1),i&&o&&o.length?await Promise.all(o.map((async e=>{if(e&&e.product_handle){const t=await Lt(e.product_handle);return t?{variants:[...t.variants],selling_plan_groups:[...t.selling_plan_groups],url:t.url,title:t.title,id:t.id,price:t.price,image:t.featured_image,description:t.description,available:t.available,vendor:t.vendor}:{variants:[],selling_plan_groups:[],url:"",title:"",id:"",price:"",image:"",description:"",available:"",vendor:""}}}))):[]}function Tt(e,t,o,i){if(!o||!e)return;let n,a=document.createElement(e);return"script"===e?(n=i?i.querySelector(`${e}[src='${o}']`):document.querySelector(`${e}[src='${o}']`),a.src=o):"link"===e&&(n=i?i.querySelector(`${e}[src="${o}"]`):document.querySelector(`${e}[href='${o}']`),a.rel=t||"",a.href=o),n||(i?i.prepend(a):at.appendChild(a)),a}function Ot(e){const t={"93a5d3-96.myshopify.com":"ja","3fd228-83.myshopify.com":"es","za06nu-3w.myshopify.com":"es","nellys-grannys.myshopify.com":"de","asmenf-pg.myshopify.com":"es","mjtart-zi.myshopify.com":"fr","esvzwx-sh.myshopify.com":"pl"}[Q];if(!t)return;const o={ja:"https://cdn.jsdelivr.net/npm/flatpickr@4.6.13/dist/l10n/ja.js",es:"https://cdn.jsdelivr.net/npm/flatpickr@4.6.13/dist/l10n/es.js",pl:"https://cdn.jsdelivr.net/npm/flatpickr@4.6.13/dist/l10n/pl.js",fr:"https://cdn.jsdelivr.net/npm/flatpickr@4.6.13/dist/l10n/fr.js",de:"https://cdn.jsdelivr.net/npm/flatpickr@4.6.13/dist/l10n/de.js"}[t];o&&(Tt("script","",o),e.locale=t)}Tt("script","","https://cdn.shopify.com/s/files/1/0748/6904/7603/files/flatpickr.js?v=1742044448"),Tt("script","","https://cdn.shopify.com/s/files/1/0748/6904/7603/files/luxon.min.js?v=1742204347"),Tt("script","","https://cdn.shopify.com/s/files/1/0748/6904/7603/files/math.min.js?v=1742044449"),Ot({});var At=["b7e47e.myshopify.com","6a1aab.myshopify.com","orbix-5081.myshopify.com","a57a86.myshopify.com","7ea8a3.myshopify.com","net-development-store.myshopify.com","deinweddingshop.myshopify.com","cyrell-shop.myshopify.com","fringegarments.myshopify.com","51c5d9-2.myshopify.com","jd-customs-usa.myshopify.com","0c500d-3.myshopify.com","pppublications.myshopify.com","248f3f-3.myshopify.com","3b4695.myshopify.com","sublimajewels.myshopify.com","ef0f4f-2.myshopify.com","bd5499-5.myshopify.com","dc9bee-3.myshopify.com","6b5bfc-2.myshopify.com","covenant-security-equipment.myshopify.com","56ed65-3.myshopify.com","555b61.myshopify.com","zoe-app-testing.myshopify.com","nice-digs.myshopify.com","8c05c0-5.myshopify.com","bff7f4.myshopify.com","6667f3-ae.myshopify.com","classyironworks.myshopify.com","the-inspired-stories.myshopify.com","49476b.myshopify.com","the-classy-hustle.myshopify.com","jednay.myshopify.com","exchange-life.myshopify.com","moondolls.myshopify.com","lori-wall-beds.myshopify.com","graffitiwallart.myshopify.com","9f4edd.myshopify.com","16480f-3.myshopify.com","a06aea-2.myshopify.com","moossweetsandchews.myshopify.com","the-artistic-pirates.myshopify.com","qwertyqop.myshopify.com","a222ae-2.myshopify.com","cck-outfitters.myshopify.com","2e27cf.myshopify.com","a88723-60.myshopify.com","designfabrikhamburg.myshopify.com","62df50.myshopify.com","ad5cdd-3.myshopify.com","not-your-average-candy.myshopify.com","costlowboxes.myshopify.com","5a6c60-9a.myshopify.com","3d-crystal-eye.myshopify.com","6667f3-ae.myshopify.com","3d1497-32.myshopify.com","b9cbed.myshopify.com","angelasmithkyy.myshopify.com","frio-sparkling-water.myshopify.com"],Nt=["248a58.myshopify.com"];Zt();var Pt=["exchange-life.myshopify.com"].includes(Q),Mt=["net-development.myshopify.com","test-product-attachment.myshopify.com","seppy-custom-options-base-on-po.myshopify.com","ormsprintroom.myshopify.com"].includes(Q),Ft=["2e27cf.myshopify.com","420dbb-2e.myshopify.com","akiv-hk.myshopify.com","69aa90-3.myshopify.com","99de86-d0.myshopify.com","ccwkwb-qx.myshopify.com","b89b5b-2.myshopify.com","ujzyuu-u0.myshopify.com","lakenil.myshopify.com"],jt=["hoa-test-store.myshopify.com","frio-sparkling-water.myshopify.com","7fbfaa.myshopify.com","ap-salad-bar.myshopify.com"],It=["doggos-united.myshopify.com"].includes(Q),Ht=["pretty-fireplaces.myshopify.com","scarves-by-ruthie-l-designs.myshopify.com","embroplacestore.myshopify.com"].includes(Q),Bt=["soy-austin.myshopify.com","jigsawpuzzles.myshopify.com","alljigsawpuzzles.myshopify.com","butler-and-hill-store.myshopify.com","landsbybilleder.myshopify.com","717402-2.myshopify.com","3d-crystal-eye.myshopify.com","286197-95.myshopify.com","thebakespace.myshopify.com","5b5c9d-2.myshopify.com"],Dt=Bt.includes(Q),zt=["9d8805-3.myshopify.com","graffitiwallart.myshopify.com"].includes(Q),Vt=Nt.includes(Q),Ut=["ornamentallyyou.myshopify.com","outletdelcafe.myshopify.com","barrier-boss.myshopify.com","f132c9-76.myshopify.com","35eb0b-2.myshopify.com"].includes(Q),Jt=["63d1ce.myshopify.com","1hpdba-ph.myshopify.com","tigren-demo.myshopify.com","zenshadetest.myshopify.com","net-development.myshopify.com","newaddon2install.myshopify.com"].includes(Q),Rt=window.Shopify?.currency?.rate||1,Wt=window.Shopify?.currency?.active||"USD",Qt=window.Shopify?.country||"en-US",Gt=!0,Xt=$t.includes(Z);function Zt(){if(["c6268c.myshopify.com","https-cookiebouquets-com.myshopify.com","liam-store-dev.myshopify.com"].includes(Q))return;let e=document.querySelectorAll(V.join(","));for(let t=0;t{Yt()}),1500)}function Yt(){if(["https-cookiebouquets-com.myshopify.com","liam-store-dev.myshopify.com"].includes(Q))return;let e=document.querySelectorAll(V.join(","));for(let t=0;t!!e.trim())).map((e=>e.trim())),t){case"productForm":$=[...$,...o];break;case"productDetails":Se=[...Se,...o];break;case"productPrice":ve=[...ve,...o];break;case"productOldPrice":we=[...we,...o];break;case"addToCart":j=[...j,...o],x=[...x,...o];break;case"stickyAddToCartWrapper":I.wrapper.push(o);break;case"stickyAddToCartForm":I.form.push(o);break;case"stickyAddToCartBtn":I.atcButton.push(o);break;case"variants":B=[...B,...o];break;case"productImageWrapper":$e=[...$e,...o];break;case"productPageQuantityInputSelector":yt=[...yt,...o]}}for(const e in t)if(Object.hasOwnProperty.call(t,e)){let o=t[e]?t[e].split(", "):void 0;if(o&&o.length)switch(o=o.filter((e=>!!e.trim())).map((e=>e.trim())),e){case"cartDrawerElement":case"allItemsWrapper":ce=[...ce,...o];break;case"toggleButtonCartDrawer":ht=[...ht,...o];break;case"lineItem":ue=[...ue,...o];break;case"priceItem":oe=[...oe,...o];break;case"totalPrice":ne=[...ne,...o];break;case"quantityInput":he=[...he,...o];break;case"quantityMinus":case"quantityPlus":be=[...be,...o];break;case"removeButton":le=[...le,...o];break;case"checkoutButton":U=[...U,...o];break;case"itemProperties":me=[...me,...o],Ee=[...Ee,...o];break;case"livePreviewCartDrawerMedia":_e.DRAWER=[..._e.DRAWER,...o]}}for(const e in o)if(Object.hasOwnProperty.call(o,e)){let t=o[e]?o[e].split(", "):void 0;if(t&&t.length)switch(t=t.filter((e=>!!e.trim())).map((e=>e.trim())),e){case"allItemsWrapper":de=[...de,...t];break;case"lineItem":ue=[...ue,...t];break;case"priceItem":oe=[...oe,...t];break;case"totalPrice":ne=[...ne,...t],ae=[...ae,...t];break;case"quantityInput":ye=[...ye,...t];break;case"quantityMinus":case"quantityPlus":be=[...be,...t];break;case"removeButton":le=[...le,...t];break;case"quantityBlockWrapperSelectorForDesktop":Ce=[...Ce,...t];break;case"quantityBlockWrapperSelectorForMobile":xe=[...xe,...t];break;case"checkoutButton":V=[...V,...t];break;case"itemProperties":me=[...me,...t],Ee=[...Ee,...t];break;case"livePreviewCartPageMedia":_e.CART=[..._e.CART,...t]}}for(const e in i)if(Object.hasOwnProperty.call(i,e)){let t=i[e]?i[e].split(", "):void 0;if(t&&t.length)switch(t=t.filter((e=>!!e.trim())).map((e=>e.trim())),e){case"quickViewModalSelector":ct=[...ct,...t];break;case"quickViewModalOpenerSelector":pt=[...pt,...t];break;case"productDetailWrapperInsideQuickViewSelector":ut=[...ut,...t];break;case"quickViewGetModalAfterDisplaySelector":mt=[...mt,...t];break;case"quickViewGetFormElementAfterDisplaySelector":_t=[..._t,...t];break;case"quickViewEasifyTagAfterDisplaySelector":ft=[...ft,...t]}}for(const e in n)if(Object.hasOwnProperty.call(n,e)&&(n[e]?n[e]:void 0))switch(e){case"quickViewOptionSetWrapperNoRemoveAfterDisplay":ke.push(Q);break;case"quickViewExtraLogicRunOnProductPageAfterDisplay":Le.push(Q);break;case"oldChangeImage":qe.push(Q);break;case"isMultipleForm":Te.push(Q);break;case"cloneAddToCart":Oe.push(Q);break;case"manualAddToCart":Ae.push(Q);break;case"manualSubmit":Ne.push(Q);break;case"useMoneyFormat":Nt.push(Q),Vt=Nt.includes(Q);break;case"useMultiCurrency":Ut=!0;break;case"customStoreRedirectCartPage":N.push(Q);break;case"customThemeStoreOpenCartDrawer":L.push(Q);break;case"customStoreReloadProductPage":P.push(Q);break;case"storeCustomPositionAddOnProduct":M.push(Q);break;case"storeCustomNotAddToCartMainProduct":F.push(Q);break;case"listStoreNotUseEasifyPrice":q.push(Q);break;case"storeNotAddingEventToBuyNow":O.push(Q);break;case"storeFreePlanTPO":A.push(Q);break;case"storeDOMContentLoaded":At.push(Q);break;case"storeRerenderATCWhenChangeVariants":Me.push(Q);break;case"storeUpdateMainProductProperties":Bt.push(Q),Dt=!0;break;case"storeUpdateProductPrice":Fe.push(Q),Ue=!0;break;case"storeUpdatePriceBoxProductPrice":je.push(Q),Je=!0;break;case"storeMergePriceExcludeOneTimeCharge":Ie.push(Q),Re=!0;break;case"storePricingBoxWholesaleMainProductOnly":He.push(Q),We=!0;break;case"storeHideLivePreviewLink":De.push(Q),Qe=!0;break;case"storeSeparateAddOnQuantity":ze.push(Q),Ge=!0;break;case"storeNotUseQuantitySelector":Be=!0;break;case"storeHidePriceInCart":Ve.push(Q),Xe=!0;break;case"storeUsingCartDrawer":wt.push(Q)}}(),At.includes(Q)?window.addEventListener("DOMContentLoaded",Kt,!1):window.addEventListener("load",Kt,!1),function(){class e{static getMoneyPropertyRegex(){return/ [\[(] .+ [)\]]/g}}class t{static getMoneyFormat(){return(Vt?w:v).trim()}static getSeparator(e="en-US"){if(!Ut)return{decimal:".",group:","};if(window.TPOGlobal&&window.TPOGlobal.currencySeparator&&window.TPOGlobal.currencySeparator[e])return window.TPOGlobal.currencySeparator[e];const t=Intl.NumberFormat(e).formatToParts(10000.1);return{decimal:t.find((e=>"decimal"===e.type))?.value||".",group:t.find((e=>"group"===e.type))?.value||","}}}window.Regex=e,window.MoneyFormat=t,window.PriceFormatter=class{constructor(){}static formatMoney(e,o=!1){"string"==typeof e&&(e=e.replace(".",""));let i=this.convertMoney(e),n=t.getMoneyFormat(),a=/\{\{\s*(\w+)\s*\}\}/,r=/(<\w*( \w+=?('|")?(\w|-)+('|")?)*>)+|(<\/\w*>)+/g;return o&&"0"==i?null:["f6899f-5.myshopify.com","w0zdzz-im.myshopify.com","neonland-8196.myshopify.com","tronxy3dprinters.myshopify.com","shop-otowagarou.myshopify.com"].includes(Q)?n.replace(a,i).replace(r,""):n.replace(a,i).replaceAll(r,"")}static convertMoney(e){let o="";switch(t.getMoneyFormat().match(/\{\{\s*(\w+)\s*\}\}/)[1]){case"amount":o=this.formatWithDelimiters(e,2);break;case"amount_no_decimals":o=this.formatWithDelimiters(e,0);break;case"amount_with_comma_separator":o=this.formatWithDelimiters(e,2,".",",");break;case"amount_no_decimals_with_comma_separator":o=this.formatWithDelimiters(e,0,".",",");break;case"amount_no_decimals_with_space_separator":o=this.formatWithDelimiters(e,0," ");break;case"amount_with_apostrophe_separator":o=this.formatWithDelimiters(e,2,"'");break;case"amount_with_period_and_space_separator":case"amount_with_space_separator":o=this.formatWithDelimiters(e,2," ",".")}return o}static formatWithDelimiters(e,o,i,n){const a=t.getSeparator(Qt);if(i=i||a.group,n=n||a.decimal,isNaN(e)||null===e)return 0;let r=(e=0===o?Math.ceil(e/100).toFixed(o):(e/100).toFixed(o)).split(".");return r[0].replace(/(\d)(?=(\d\d\d)+(?!\d))/g,"$1"+i)+(r[1]?n+r[1]:"")}static formatMoneyForAddOnProductProperty(e,t){return t?"":` ( +${e} )`}},window.PropertyFormatter=class{static removeMoneyProperty(t=""){return t.replace(e.getMoneyPropertyRegex(),"")}static formatDefaultPropertyValues(e){const[t,o]=e.split(" | ");return{label:t,quantity:o?parseInt(o,10):null}}}}(),K){const e=document.querySelectorAll(".tpo_modal-background");e.length&&e.forEach((e=>{e.remove()})),window.TPOConfigs?.formatMoneyPreview&&(v=window.TPOConfigs?.formatMoneyPreview,w=window.TPOConfigs?.formatMoneyPreview),Kt()}async function Kt(){if(!Gt)return;if(Gt=!1,(i&&1===Number(i)&&a&&!K||n)&&await async function(){if(a&&await async function(){await fetch(a).then((e=>e.text())).then((e=>{const t=e.split("\n"),o=t[0].split(","),i={};for(let e=1;e(console.error("Error fetching CSV file:",e),{})))}(),n&&await async function(){const e=Array.from(document.querySelectorAll("[tpo-product-id]")).flatMap((e=>e.getAttribute("tpo-product-id").split(","))).map((e=>e.trim())).filter(Boolean);h?.id&&e.push(h.id.toString());const o=[...new Set(e)].join(",");await fetch(`https://${G}/apps/easify-po/apps/v2/option_sets?product_ids=${o}`).then((e=>{if(!e.ok)throw new Error("Network response was not ok");return e.json()})).then((e=>{t=xt(e.items),window.TPOConfigs.product_options_tpo=t})).catch((e=>{console.error("Failed to fetch product options:",e)}))}(),0===Object.keys(l).length)return;let e=[];t.forEach((t=>{let o=t.option_set.options,i=[];o?.forEach((e=>{const t=function(e,t,o){const i={...e};let n=s;for(const a of o)if(t[e[a]]){const o=t[e[a]];o[n]&&(i[a]=o[n])}if(e.metadata){const o={...JSON.parse(e.metadata||"{}")};i.metadata=JSON.stringify(kt(o,t,u))}return e.option_types&&e.option_types.length>0&&(i.option_types=e.option_types.map((e=>kt(e,t,p)))),i}(e,l,d);i.push(t)})),e.push({...t,option_set:{...t.option_set,options:i}})})),t=e,TPOConfigs.product_options_tpo=e;for(const e of m)D.hasOwnProperty(e)||(D[e]=f.get(e));let o=kt(D,l,m);D=o}(),document.addEventListener("tpo_loaded",(function(){Yt()})),window.innerWidth<1023){document.addEventListener("touchmove",(function(){})),document.body.setAttribute("tabIndex",0),function(e){let t,o={touchend:function(){}};for(t in o)e.addEventListener(t,o)}(document);const e=document.createElement("meta");Object.assign(e,{name:"viewport",content:"width=device-width, initial-scale=1 "+(Pt?", maximum-scale=1.0":"")}),document.head.prepend(e)}let c,_=/^product.*$/.test(S),Fe=/^collection.*$/.test(S),je=/^index.*$/.test(S),Ie=/^search.*$/.test(S),He=[],De=[],ze=[],Ve=[],At=[],Nt=[],Bt=[],eo=-1,to={},oo=[],io=[];const no=["_tpo_main_product_id","_tpo_is_main_product","_tpo_add_on_keys","_tpo_add_on_key","_tpo_add_on_variant_ids"],ao="https://cdn.shopify.com/s/files/1/0748/6904/7603/files/default_image_url.png?v=1713240055",ro="https://cdn.shopify.com/s/files/1/0748/6904/7603/files/Group_111.png?v=1680839617",so=D?.targetSelectorSetting||"slider-component.thumbnail-slider .thumbnail-list , .slideshow-controls__thumbnails-container .slideshow-controls__thumbnails",lo=qe.includes(Q),co=document.querySelectorAll(`${so}`).length?document.querySelectorAll(`${so}`):lo?document.querySelectorAll(".product__media-list.contains-media , .media-gallery__grid"):document.querySelectorAll("slider-component.thumbnail-slider .thumbnail-list , .slideshow-controls__thumbnails-container .slideshow-controls__thumbnails");let po=co.length?Array.from(co[0].querySelectorAll($e)):[],uo=[];po.length&&(uo=[...po.map((e=>{const t=e.querySelectorAll("img");if(t.length)return t[0].getAttribute("alt")}))]);var mo=!Le.includes(Q)||_;const{requiredMessage:_o,requiredOptionMessage:fo,minCharacterMessage:yo,maxCharacterMessage:ho,exceptNumberMessage:go,exceptSpaceMessage:bo,exceptSpecialCharacterMessage:vo,exceptLetterMessage:wo,minValueMessage:So,maxValueMessage:Eo,minOptionMessage:$o,maxOptionMessage:Co,errorQuantityMessage:xo,totalQuantitySelectorMessage:ko,totalSelectedQuantityLabel:Lo,totalAdditionalPriceLabel:qo,totalPriceIncludeTaxLabel:To="Total price include tax",validNumbericMessage:Oo,designSetting:Ao="{}",tableTitle:No,quantityHeading:Po,savingHeading:Mo,saveLabel:Fo,tieredPricePosition:jo="below_add_to_cart",wholeSaleDiscountLabel:Io,showOptionSetOnCollectionPage:Ho,showOptionSetOnHomepage:Bo,showOptionSetOnQuickView:Do,showOptionSetOnFeatureProduct:zo,totalPriceMode:Vo,isShowTotalPrice:Uo,isTrackingAnalytic:Jo,newAddOnPrice:Ro="no",newAddOnProduct:Wo="no",customOptionFor:Qo,changeProductPrice:Go,taxRateField:Xo,originalPriceLabelField:Zo="Our price just",customOptionsDisplay:Yo="split",addOnProductsDisplay:Ko="hide",dimensionDropdownErrorMessage:ei="",minFileMessage:ti,minFileAtleastMessage:oi,livePreviewTextProperties:ii="Preview"}=D;let ni="disabled"===Ko;const ai=Boolean(Number(void 0!==D.enableTieredPrice?D.enableTieredPrice:"1")),ri="1"==D.allowEditCart||"true"==D.allowEditCart,si="d75b8b-2b.myshopify.com"!==Q&&"active"===D?.isShowPopup,li=Boolean(Number(D.showDiscountBoxOnCart||"0")),ci=Boolean(Number(D.showDiscountBoxOnCheckout||"0")),pi=D?.popupMode||"separate_button",di=D?.popupTitle||"Customize it",ui=D?.buttonPopupTitle||"Customize it",mi=D?.discountBoxButton||"Apply",_i=D?.discountBoxPlaceholder||"Enter your discount here",fi=D?.discountText||"Discount",yi=D?.discountValidateBlank||"Discount field must not be blank",hi=D?.discountValidateCode||"Invalid discount code",gi=void 0===Uo||"active"===Uo,bi=void 0===Jo||"active"===Jo,{designColor:vi={},designStyle:wi={},designCustomCSS:Si={},designSize:Ei={},designShape:$i={},designSpacing:Ci={},optionLabel:xi={},optionValue:ki={},helpText:Li={},infoTooltip:qi={},totalPrice:Ti={},errorText:Oi={},inputText:Ai={},fileUpload_buttonText:Ni={},fileUpload_name:Pi={},quantitySelector:Mi={},tableCell:Fi={},tableHeading:ji={},tableTitle:Ii={},selectedValue:Hi={},inputSetting:Bi={},switchSetting:Di={},dropdownSetting:zi={},buttonSetting:Vi={},colorSwatchesSetting:Ui={},imageSwatchesSetting:Ji={},wholesaleBorderSetting:Ri={},discountBoxSetting:Wi={}}=JSON.parse(Ao),Qi=JSON.parse(D.customFonts||"[]");!function(e){if(!t.length)return;const o=document.createElement("style");o.id="tpo_custom_fonts";const i={};t.forEach((t=>{const o=t.option_set?t.option_set:t,{options:n}=o;n&&n.length&&n.forEach((t=>{if("font-picker"!==t.type)return;const o=JSON.parse(t.metadata||"{}").customFonts||[];o.length&&o.filter((t=>e.findIndex((e=>e.name===t.name))>-1)).forEach((({name:e,url:t})=>{i[e]=t}))}))}));for(const[e,t]of Object.entries(i))o.innerHTML+=`\n @font-face {\n font-family: ${e};\n src: url('${t}')\n }\n `;at.appendChild(o)}(Qi);const Gi={};window.tpoCartCollections&&window.tpoCartCollections.forEach((e=>{Gi[e?.productId||"tpo"]=e?.collections||[]}));let Xi=!0;const Zi=h?.id||"",Yi=wi&&"modern"===wi?.appTheme,Ki=wi&&"dark"===wi?.appMode;let en=[];const tn=ri,on=Array.from(document.getElementsByTagName("form"));let nn=on.length?on.find((e=>"string"==typeof e.action&&e.action.includes("/cart"))):null,an=document.querySelector(de),rn=document.querySelector(ce),sn=document.querySelectorAll(ce);const ln="cart"==`${S}`;let cn=!!rn,pn=ln?an?an?.querySelector(C)||document.querySelector(C):nn||document.createElement("div"):document.querySelector($),dn=pn?.attributes.id?.value||null;if(dn&&"string"==typeof dn&&!ln&&"eenie-meenie-mine.myshopify.com"===Q){const e=document.querySelectorAll(`#${dn}`);e.length>1&&e.forEach((e=>{e.classList.contains("js-prod-form-submit")&&(pn=document.querySelector(`#${dn}`))}))}const un=la((()=>{const e=document.querySelector($);e&&vs(e).then()}),400);function mn(e){const t=document.querySelector(".tpo_option-set-wrapper").querySelectorAll('input.tpo_file-upload-input[name^="properties["]'),o=/\s*\[\s*[+-]?\s*[^\]]+\s*\]/g;t.forEach((t=>{let i=t.value;const n=i.match(o);if(n){const a=t.getAttribute("name"),r=`properties[_${a.substring(a.indexOf("[")+1,a.lastIndexOf("]"))}_price]`;let s=e.querySelector(`input[name="${r}"]`);if(s||(s=document.createElement("input"),s.type="hidden",s.name=r,e.appendChild(s)),n.length>1)s.value=i;else{const e=n[0].trim();s.value=e.substring(1,e.length-1).trim()}const l=i.replace(o,"").trim();t.value=l}}))}function _n(){an=document.querySelector(de);const e=document.querySelectorAll(de);let t=on.length?on.find((e=>"string"==typeof e.action&&e.action.includes("/cart"))):null;return pn=ln?an?an?.querySelector(C)||document.querySelector(C):t||document.createElement("div"):document.querySelector($),fn(),K&&(pn=document.querySelector(".preview-form")),rn=document.querySelector(ce),sn=document.querySelectorAll(ce),cn=!!rn,{cartPageElement:an,cartDrawerElements:sn,hasCartDrawer:cn,listCartPageElements:e}}function fn(){const e=function(){const e=[{size:1400,class:"xxl"},{size:1200,class:"xl"},{size:992,class:"lg"},{size:768,class:"md"},{size:576,class:"sm"}],t=window.innerWidth;for(const o of e)if(t>=o.size)return o.class;return"xs"}(),t=document.querySelector(`.tpo-form-selector-${e}`);if(t)return void(pn=t);let o=document.querySelectorAll($);ln||(Te.includes(Q)&&o.length>1&&o.forEach((e=>{(e.querySelector(".tpo-custom_add_to_cart_selector")||e.closest(".prd-block-actions")||e.querySelector("#addToCart")||e.querySelector("#add")||e.querySelector(".product_details_info")||e.querySelector('button[id*="AddToCart"]')||e.querySelector(".product-info__add-to-cart")||e.querySelector(".shopify-payment-button"))&&(pn=e)})),window.customElements&&pn&&!pn.offsetParent&&o&&o.length&&o.forEach((e=>{e.offsetParent&&(pn=e)})))}function yn(){if(Oe.includes(Q)&&gn.parentNode){const e=gn.cloneNode(!0);gn.parentNode.insertBefore(e,gn),gn.parentNode.removeChild(gn),e.classList.add("tpo-btn-add_to_cart"),gn=e}}fn(),K&&(pn=document.querySelector(".preview-form")),"757a1b-2.myshopify.com"===Q&&(pn=ln?an?an?.querySelector(C)||document.querySelector(C):nn||document.createElement("div"):document.querySelector('form[class*="form-submit"][action*="/cart/add"][data-product-id]'));let hn=pn?.attributes.id?.value||null,gn=pn?pn.querySelector(x):null;if(pn&&!gn&&(gn=document.querySelector(j)),gn){const e=Array.from(pn.querySelectorAll(j));if(e.length>1&&!gn.offsetParent){const t=e.filter((e=>!!e.offsetParent));t&&t.length&&(gn=t[0])}}else gn=document.createElement("div");function bn(e){if(!e)return!0;let t=!0;for(const o of e){let e=`${o.id},${o.type}`,i=document.querySelector(`[id*='${e}']`);if(!i)break;if(i.classList.contains("tpo_hidden"))break;if(1===o.is_required){t=!1;break}if(1===o.is_required&&"group"!==o.type){t=!1;break}if("checkbox"===o.type&&(o.min_value||o.max_value)){const e=o.option_types.filter((e=>1===e.is_default)).length;if(o.min_value&&eo.max_value){t=!1;break}}}return t}if("bff7f4.myshopify.com"===Q&&(gn=pn.querySelector("#product-add-to-cart-cloned")||document.createElement("div")),yn(),pn||(pn=document.createElement("div")),Array.isArray(t)&&t.length>0)for(let e=t.length-1;e>=0;e--){let o=t[e].option_set||{};const i=y?.customer||{},n=i.tags||[],a=o.customer_tag||"{}",r=JSON.parse(a),{tagSet:s,appliedCustomer:l}=r,c=Object.keys(r).length<1||"ALL"===l||"GUEST"===l&&null===i.id||"LOGIN"===l&&i.id||"TAG"===l&&n.some((e=>s.includes(e))),p=o?.status||0;let d=Pr(o?.title||"");if(0===p||!c||!d)continue;const u=o.apply_type;if(0===u){en.push(o);break}if(1===u){if(o.option_set_products.length<1)continue;if(o.option_set_products.map((e=>e.product_id.slice(22))).includes(Zi.toString())){en.push(o);break}}if(2===u){const e=o.product_condition?JSON.parse(o.product_condition):void 0;if(!e)continue;if(e.conditions.length){if(e.conditions=e.conditions.map((e=>"string"==typeof e.value?{...e}:e.value.id?{...e,value:{...e.value,id:e.value.id.slice(25)}}:void 0)),await wn(e)){en.push(o);break}continue}}}K&&0===en.length&&(en=window.TPOConfigs.product_options);let vn=K?[]:en.length?await qt(en[0].products_handle):[];async function wn(e,t,o){const{operator:i,conditions:n}=e;if(!t)return a({title:h?.title||"",price:h?.price/100||0,tag:h?.tags||"",vendor:h?.vendor||"",type:h?.type||"",handle:h?.handle||"",collections:g||""});try{let e={};if(t)if(o){const o=oo.find((e=>e.productHandle===t));o&&(e={...o.data})}else{const o=await fetch(`${st}products/${t}.js`,{method:"GET",headers:{"Content-Type":"application/json"}}).then((e=>e.json()));e={...o},oo.push({productHandle:t,data:{...o}})}const i={id:e?.id||"",title:e?.title||"",price:e?.price/100||0,tag:e?.tags||[],vendor:e?.vendor||"",type:e?.type||"",handle:e?.handle||"",collections:[]},r=n.some((e=>"COLLECTION"===e.select));return r?(Gi[i.id||"tpo"]&&Gi[i.id||"tpo"].length&&(i.collections=[...Gi[i.id]]),a(i)):a(i)}catch(e){return console.error(e),!1}function a(e){let t=[];return n.forEach((({select:o,relative:i,value:n})=>{if("COLLECTION"!==o){if(Y.includes(o))switch(i){case"EQUAL":t=n.toString()===e[o.toLowerCase()].toString()?[...t,!0]:[...t,!1];break;case"NOT_EQUAL":t=n.toString()!==e[o.toLowerCase()].toString()?[...t,!0]:[...t,!1];break;case"CONTAIN":t=e[o.toLowerCase()].toString().includes(n.toString())?[...t,!0]:[...t,!1];break;case"NOT_CONTAIN":t=e[o.toLowerCase()].toString().includes(n.toString())?[...t,!1]:[...t,!0];break;case"START_WITH":t=e[o.toLowerCase()].toString().startsWith(n.toString())?[...t,!0]:[...t,!1];break;case"END_WITH":t=e[o.toLowerCase()].toString().endsWith(n.toString())?[...t,!0]:[...t,!1]}if("PRICE"===o)switch(i){case"EQUAL":t=n.toString()===e[o.toLowerCase()].toString()?[...t,!0]:[...t,!1];break;case"NOT_EQUAL":t=n.toString()!==e[o.toLowerCase()].toString()?[...t,!0]:[...t,!1];break;case"GREATER_THAN":isNaN(Number(n))||(t=e[o.toLowerCase()]>Number(n)?[...t,!0]:[...t,!1]);break;case"LESS_THAN":isNaN(Number(n))||(t=e[o.toLowerCase()]0&&ai&&("ALL"===$n||"GUEST"===$n&&null===kn.id||"LOGIN"===$n&&kn.id||"TAG"===$n&&Ln.some((e=>Cn.includes(e)))||"EXCLUDE_TAG"===$n&&!Ln.some((e=>xn.includes(e))));function Tn(e){const t=JSON.parse(e.price_set||"[]"),o=JSON.parse(e.customer_tag||"{}"),i=o.appliedCustomer||"ALL",n=o.tagSet||[],a=o.excludeTagSet||[],r=y?.customer||{},s=r.tags||[];return{tieredPrices:t,allowTieredPrices:t.length>0&&ai&&("ALL"===i||"GUEST"===i&&null===r.id||"LOGIN"===i&&r.id||"TAG"===i&&s.some((e=>n.includes(e)))||"EXCLUDE_TAG"===i&&!s.some((e=>a.includes(e)))),appliedCustomer:i,appliedTags:n,excludeTags:a}}(async()=>{const e=document.querySelectorAll("[data-product-id]"),t=Array.from(e).map((e=>e.dataset.productId)),o=Array.from(e).map((e=>e.dataset.productHandle)),i=await async function(e,t){const o={};for(let i=0;i{const o=document.querySelector(`[data-product-id="${e}"] form`);if(!o)return;t.forEach((e=>{const{tieredPrices:t}=e;let i=o.querySelector('[name="properties[_tpo_wholesale]"]');i||(i=document.createElement("input"),i.type="hidden",i.name="properties[_tpo_wholesale]",o.appendChild(i)),i.value=jn(t)}));const n=i[e]||[],a=n[0]?.wholesalePrice||{},{allowTieredPrices:r}=Tn(a)}))})();let On=document.querySelector(fe)||document.createElement("div"),An={easifyUrl:`https://${G}/apps/easify-po/`,tokenCart:"",cartJson:{}};function Nn(e){let t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return t?`${parseInt(t[1],16)}, ${parseInt(t[2],16)}, ${parseInt(t[3],16)}`:null}function Pn(e,t=Qt){let o=(Vt?w:v).trim();const i=function(e="en-US"){if(!Ut)return{decimal:".",group:","};if(window.TPOGlobal&&window.TPOGlobal.currencySeparator&&window.TPOGlobal.currencySeparator[e])return window.TPOGlobal.currencySeparator[e];const t=Intl.NumberFormat(e).formatToParts(10000.1);return{decimal:t.find((e=>"decimal"===e.type))?.value||".",group:t.find((e=>"group"===e.type))?.value||","}}(t);let n=i.group,a=i.decimal;if(t===Qt)switch(o.match(/\{\{\s*(\w+)\s*\}\}/)[1]){case"amount_with_comma_separator":case"amount_no_decimals_with_comma_separator":n=".",a=",";break;case"amount_no_decimals_with_space_separator":n=" ";break;case"amount_with_apostrophe_separator":n="'"}let r=e.trim().match(/\d+((\.|\'|\,| )\d+)*/g);if(r){let e=r[0];if(e=e.replaceAll(n,""),e=e.replace(a,"."),e=e.replaceAll(" ",""),s=e,!isNaN(s)&&!isNaN(parseFloat(s)))return parseFloat(e)}var s;return 0}function Mn(e,t){const o=Pn(e);if(!Ut)return o;const i=(t.properties||{})._tpo_active_currency;return i?Pn(e,i):o}function Fn(e,t="default"){return"checkout"===t?e.some((e=>"_tpo_price"===e.key)):e.some((e=>"_tpo_price"===e.key||"_tpo_wholesale"===e.key))}function jn(e){const t=e.map((e=>({min:e.minQty,max:e.maxQty,t:"percentage"===e.type?"p":"f",v:e.value})));return JSON.stringify(t)}function In(e){let t={...e};for(const e in t)e.startsWith("_tpo")&&"_tpo_add_by"!==e&&"_tpo_option_value_id"!==e&&delete t[e];return t}function Hn(e){const t=e.filter((e=>e.properties._tpo_add_on_key&&"[]"!==e.properties._tpo_add_on_key)).map((e=>({i:e.id,q:parseInt(e.quantity),p:e.price,x:{o:e.properties?._tpo_option_value_id||""}})));return JSON.stringify(t)}function Bn(e,t){if(e===t)return!0;if("object"!=typeof e||"object"!=typeof t||null===e||null===t)return"string"==typeof e&&"string"==typeof t&&e.trim()===t.trim();const o=Object.keys(e).sort(),i=Object.keys(t).sort();if(o.length!==i.length)return!1;for(let n=0;n""!==t)):[];let h=f?.map((([e,t])=>({key:e,value:t}))),g=[...h].filter((({key:e,value:t})=>!no.includes(e)));if(Fn(g,t))return{lineItemsCustom:n};const b=m.product_id,v=m.handle,w=await Va(b,v),S=w?.wholesale_price||{},E=JSON.parse(S.price_set||"[]"),$=JSON.parse(S.customer_tag||"{}").appliedCustomer||"ALL",C=JSON.parse(S.customer_tag||"{}").tagSet||[],x=JSON.parse(S.customer_tag||"{}").excludeTagSet||[],k=y?.customer||{},L=k.tags||[],q=E.length>0&&ai&&("ALL"===$||"GUEST"===$&&null===k.id||"LOGIN"===$&&k.id||"TAG"===$&&L.some((e=>C.includes(e)))||"EXCLUDE_TAG"===$&&!L.some((e=>x.includes(e))));let T=0,O=0,A=0,N=0,P=[];c||h.findIndex((e=>/\[ .+ \]/g.test(e.value)))>-1&&(h=h.filter((({key:e,value:t})=>no.includes(e)))),n.push({variantId:`gid://shopify/ProductVariant/${m.variant_id}`,quantity:m.quantity,sku:m.sku,customAttributes:h,appliedDiscount:{title:Io?ba(Io,""):"Wholesale discount",valueType:"FIXED_AMOUNT",value:u||0,description:""},originalUnitPrice:m.final_line_price,index:l,productId:m.product_id});let M=l;if(l++,m.properties){let e,t=0;for(const e in m.properties){let o=m.properties[e];if(o&&"string"==typeof o){const e=/ \|\s+\d+/g;e.test(o)&&(o=o.replace(e,""));for(let e of o.split("],"))if(e){e.endsWith("]")||(e+="]");let o=/\[ \+(.*)\]/,i=e.match(o);if(i){let e=i[1],o=Pn(e);o=Mn(e,m),t+=parseFloat(100*o)}}}}t+=m.price,e="expand"===TPOConfigs?.settings?.newAddOnPrice?0:t-Aa(t,{value:m.quantity},q,E,o),O+=e*m.quantity;for(const o in m.properties){let a=0,r=m.properties[o],s={key:o,value:r},u=null,_=r;if(_&&"string"==typeof _){let f=!1;const y=/ \|\s+\d+/g;y.test(_)&&(_=_.replace(y,""));for(let e of _.split("],"))if(e){e.endsWith("]")||(e+="]");let t=/\[ \+(.*)\]/,o=e.match(t);if(o){f=!0;let e=o[1],t=Pn(e);t=Mn(e,m),N+=parseFloat(100*t),a+=parseFloat(100*t),T+=parseFloat(100*t)*m.quantity}}let h=/\( \+(.*)\)/;if(_.match(h))for(let e of _.split("),"))if(e){e.endsWith(")")||(e+=")");let t=/\( \+(.*)\)/,o=e.match(t);if(o){let e=o[1],t=Pn(e);t=Mn(e,m),A+=parseFloat(100*t)*(Ge?1:m.quantity)}}let b=e*a/t;b=parseFloat((b/100).toFixed(2)),f&&(u={key:`${o}`,value:r},P.push(u),c?(n.push({title:Qo?ba(Qo,m.title):`Custom Option for ${m.title}`,originalUnitPrice:parseFloat(a/100),quantity:p?1:m.quantity,requiresShipping:Ke,customAttributes:[s,u],appliedDiscount:{title:Io?ba(Io,""):"Wholesale discount",valueType:"FIXED_AMOUNT",value:b||0,description:""},taxable:i,index:l,isFromOptionSet:!0,properties:m.properties}),l++):d={...d,title:Qo?ba(Qo,m.title):`Custom Option for ${m.title}`,originalUnitPrice:d.originalUnitPrice+parseFloat(a/100),quantity:p?1:m.quantity,customAttributes:g,appliedDiscount:{title:Io?ba(Io,""):"Wholesale discount",valueType:"FIXED_AMOUNT",value:d.appliedDiscount.value+b,description:""},index:l,properties:m.properties})}u||P.push(s)}!c&&d.quantity>0&&(n.push(d),l++),u=e*m.price/t||0,u=parseFloat((u/100).toFixed(2));let r={tpo_add_price:T,tpo_add_on_product_price:A,tpo_final_add_price:O?T-O:T,original_price:m.original_price,original_line_price:m.original_line_price,final_line_price:m.final_line_price,final_price:m.final_price,product_id:m.product_id,variant_id:m.variant_id,quantity:m.quantity,key:m.key};An.cartJson.items.push(r);let _=m.original_price,f=m.original_line_price,y=m.final_price,h=m.final_line_price;T>-1&&(a.push({cart_item_key:m.key,price_add:T}),s+=T,An.cartJson.tpo_add_price+=T,_+=N,f+=T,y+=N,h+=T)}else u=m.price-Aa(m.price,{value:m.quantity},q,E,o);n[M].appliedDiscount.value=u,n[M].key=m.key}return{lineItemsCustom:n}}async function zn(e){let t={updates:{}},o={items:[]},i=[];for(const n of e)if(n.properties){const a=!!n.properties._tpo_add_on_key,r=!!n.properties._tpo_is_main_product,s=!!n.properties._tpo_custom_options,l=!!n.properties._tpo_wholesale;if(s||l){let e=n.properties._tpo_custom_options?JSON.parse(n.properties._tpo_custom_options):{},t=In(n.properties);Bn(e,t)||i.push({key:n.key,properties:{...t,...null!=n?.properties?._tpo_price?{_tpo_price:n.properties._tpo_price}:{},...null!=n?.properties?._tpo_wholesale?{_tpo_wholesale:n.properties._tpo_wholesale}:{},...null!=n?.properties?._tpo_add_on_products?{_tpo_add_on_products:n.properties._tpo_add_on_products}:{},...null!=n?.properties?._tpo_add_on_keys?{_tpo_add_on_keys:n.properties._tpo_add_on_keys}:{},_tpo_custom_options:JSON.stringify(t)},quantity:n.quantity})}if(a){const o=n.properties._tpo_add_on_key;e.findIndex((e=>{const t=e.properties?JSON.parse(e.properties._tpo_add_on_keys||"[]"):[];return!(!t.length||!t.includes(o))}))<0&&(t.updates[n.key]=0)}else if(r){const i=JSON.parse(n.properties._tpo_add_on_keys||"[]"),a=JSON.parse(n.properties._tpo_add_on_variant_ids||"[]"),r=JSON.parse(n.properties._tpo_one_time_charges||"[]");for(let s=0;s{const t=e.properties?._tpo_add_on_key;return!!t&&e.variant_id==c&&t==l})),d=r.find((e=>e===c));p?Be&&!d&&(t.updates[p.key]=Number(n.quantity||0)):d?o.items.push({id:c,quantity:"1",properties:{_tpo_add_on_key:l,_tpo_main_product_id:n.variant_id}}):o.items.push({id:c,quantity:n.quantity,properties:{_tpo_add_on_key:l,_tpo_main_product_id:n.variant_id}})}}}o.items.length&&await fetch("/cart/add.js",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(o)}),"{}"!=JSON.stringify(t.updates)&&await fetch("/cart/update.js",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}),i.length&&await Promise.all(i.map((async e=>{const t={id:e.key,properties:e.properties,quantity:e.quantity};await fetch("/cart/change.js",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})})));const n=await fetch("/cart.js?app=tpo",{method:"GET",headers:{"Content-Type":"application/json"}});return await n.json()}async function Vn(e="",t=!1){try{const o=await fetch("/cart.js?app=tpo",{method:"GET",headers:{"Content-Type":"application/json"}});let i=await o.json();if(t)return void await async function(e,t){await window.bndlr.getCheckoutInfo((async function(o){if(void 0!==o&&void 0!==o.can_apply_discount&&!0===o.can_apply_discount){let t=[],i=0;An.cartJson.items=[],o.items.forEach((t=>{const o=e.items.findIndex((e=>e.variant_id==t.variant_id));o>-1&&(t.properties=e.items[o].properties,t.handle=e.items[o].handle,t.sku=e.items[o].sku,t.final_price=e.items[o].final_price,t.final_line_price=t.final_price*t.quantity,t.key=self.crypto.randomUUID(),t.original_price=e.items[o].original_price,t.original_line_price=t.original_price*t.quantity)}));const n=["muskokahighlands.myshopify.com","muskoka-highlands.myshopify.com"].includes(Q),a="split"===Yo;for(let e=0;e""!==t)):[];let d=p?.map((([e,t])=>({key:e,value:t}))),u=[...d].filter((({key:e,value:t})=>!no.includes(e)));const m=l.product_id,_=l.handle,f=await Va(m,_),h=f?.wholesale_price||{},g=JSON.parse(h.price_set||"[]"),b=JSON.parse(h.customer_tag||"{}").appliedCustomer||"ALL",v=JSON.parse(h.customer_tag||"{}").tagSet||[],w=JSON.parse(h.customer_tag||"{}").excludeTagSet||[],S=y?.customer||{},E=S.tags||[],$=g.length>0&&ai&&("ALL"===b||"GUEST"===b&&null===S.id||"LOGIN"===b&&S.id||"TAG"===b&&E.some((e=>v.includes(e)))||"EXCLUDE_TAG"===b&&!E.some((e=>w.includes(e))));let C=0,x=0,k=0,L=[];a||d.findIndex((e=>/\[ .+ \]/g.test(e.value)))>-1&&(d=d.filter((({key:e,value:t})=>no.includes(e)))),t.push({variantId:`gid://shopify/ProductVariant/${l.variant_id}`,quantity:l.quantity,sku:l.sku,customAttributes:d,appliedDiscount:{title:Io?ba(Io,""):"Wholesale discount",valueType:"FIXED_AMOUNT",value:s||0,description:""},originalUnitPrice:l.final_line_price,index:i,productId:l.product_id});let q=i;if(i++,l.properties){let e=0;for(const t in l.properties){let o=l.properties[t];if(o&&"string"==typeof o){const t=/ \|\s+\d+/g;t.test(o)&&(o=o.replace(t,""));for(let t of o.split("],"))if(t){t.endsWith("]")||(t+="]");let o=/\[ \+(.*)\]/,i=t.match(o);if(i){let t=i[1],o=Pn(t);o=Mn(t,l),e+=parseFloat(100*o)}}}}e+=l.price;let o=e-Aa(e,{value:l.quantity},$,g);x+=o*l.quantity;for(const s in l.properties){let c=0,p=l.properties[s],d={key:s,value:p},m=null,_=p;if(_&&"string"==typeof _){let f=!1;const y=/ \|\s+\d+/g;y.test(_)&&(_=_.replace(y,""));for(let e of _.split("],"))if(e){e.endsWith("]")||(e+="]");let t=/\[ \+(.*)\]/,o=e.match(t);if(o){f=!0;let e=o[1],t=Pn(e);t=Mn(e,l),k+=parseFloat(100*t),c+=parseFloat(100*t),C+=parseFloat(100*t)*l.quantity}}let h=o*c/e;h=parseFloat((h/100).toFixed(2)),f&&(m={key:`${s}`,value:p},L.push(m),a?(t.push({title:Qo?ba(Qo,l.title):`Custom Option for ${l.title}`,originalUnitPrice:parseFloat(c/100),quantity:n?1:l.quantity,requiresShipping:Ke,customAttributes:[d,m],appliedDiscount:{title:Io?ba(Io,""):"Wholesale discount",valueType:"FIXED_AMOUNT",value:h||0,description:""},index:i,isFromOptionSet:!0}),i++):r={...r,title:Qo?ba(Qo,l.title):`Custom Option for ${l.title}`,originalUnitPrice:r.originalUnitPrice+parseFloat(c/100),quantity:n?1:l.quantity,customAttributes:u,appliedDiscount:{title:Io?ba(Io,""):"Wholesale discount",valueType:"FIXED_AMOUNT",value:r.appliedDiscount.value+h,description:""},index:i})}m||L.push(d)}!a&&r.quantity>0&&(t.push(r),i++),s=o*l.price/e||0,s=parseFloat((s/100).toFixed(2));let c={tpo_add_price:C,tpo_final_add_price:x?C-x:C,original_price:l.original_price,original_line_price:l.original_line_price,final_line_price:l.final_line_price,final_price:l.final_price,product_id:l.product_id,variant_id:l.variant_id,quantity:l.quantity,key:l.key};An.cartJson.items.push(c)}else s=l.price-Aa(l.price,{value:l.quantity},$,g);let T=t[q].appliedDiscount;l.applied_discount.value&&(T.value?T.title+=`+ ${l.applied_discount.title}`:T.title=`${l.applied_discount.title}`,T.value+=l.applied_discount.value),t[q].appliedDiscount=T,t[q].key=l.key}let r=!1;for(let e=0;ee.customAttributes.some((e=>"_tpo_add_on_keys"===e.key)))).length&&(r=!0);const s=t.map((e=>(e.isFromOptionSet?delete e.isFromOptionSet:delete e.originalUnitPrice,e.variantId||(e.originalUnitPrice/=Rt),e.customAttributes.length,e)));let l=document.querySelector(".tpo-discount-code-block")||null,c=l?l.querySelector("input.tpo-discount-code-input--input").value.trim():"",p={line_items:s,cart:An,customer:E,discount_code:c,locale:{shouldUseMultiCurrency:Ut,locale:Qt,currency:Wt}};const d=An.cartJson.items.some((e=>e.tpo_add_price>e.tpo_final_add_price));if(An.cartJson.tpo_add_price>0||d){const e={method:"POST",headers:{Accept:"application/json, text/plain, */*","Content-Type":"application/json",shop:Q},body:JSON.stringify(p)};fetch(`${An.easifyUrl}apps/draft-order`,e).then((function(e){if("200"==e.status)return console.log("EasifyPO redirect to checkout page 1"),e.json().then((function(e){"string"==typeof e?.draftOrder?.invoiceUrl&&(window.location.href=e.draftOrder.invoiceUrl)}));console.log("EasifyPO redirect to checkout page 2")})).catch((e=>{console.log("Error:",e)}))}else window.bndlr.checkout()}else await Vn(t,!1)}))}(i,e);i=await zn(i.items);let n=!1,a=(await Dn(i,"checkout")).lineItemsCustom;for(let e=0;ee.customAttributes.some((e=>"_tpo_add_on_keys"===e.key)))).length&&(n=!0);const r=a.map((e=>{if(e.isFromOptionSet?delete e.isFromOptionSet:delete e.originalUnitPrice,Ut){const t=e.properties||{},o=t._tpo_active_currency,i=t._tpo_currency_rate||1;o&&(e.appliedDiscount&&e.appliedDiscount.value&&(e.appliedDiscount.value/=i),e.variantId||(e.originalUnitPrice/=i))}return delete e.properties,e.customAttributes.length?(e.customAttributes.forEach((e=>{if("string"==typeof e.value&&e.value.startsWith("https://")&&e.value.includes("apps/easify-po/apps/download")){const t=e.value.replace(/\[ \+(.*)\]/,"");t&&(e.value=t.trim())}})),e):e}));let s=document.querySelector(".tpo-discount-code-block")||null,l=s?s.querySelector("input.tpo-discount-code-input--input").value.trim():"",c={line_items:r,cart:An,customer:E,discount_code:l,showDiscountBoxOnCheckout:ci,locale:{shouldUseMultiCurrency:Ut,locale:Qt,currency:Wt}};await async function(e){const t=await fetch("/cart.js?app=tpo",{method:"GET",headers:{"Content-Type":"application/json"}});let o=await t.json();o.attributes&&Object.entries(o.attributes).length&&(e.cart.attributes=o.attributes)}(c);const p=An.cartJson.items.some((e=>e.tpo_add_price>e.tpo_final_add_price));if("43d530-3.myshopify.com"===Q&&An.cartJson.tpo_add_price>0)return void(window.location.href=n?"/checkout":e||"/checkout");if(An.cartJson.tpo_add_price>0||p){const e={method:"POST",headers:{Accept:"application/json, text/plain, */*","Content-Type":"application/json",shop:Q},body:JSON.stringify(c)};fetch(`${An.easifyUrl}apps/draft-order`,e).then((function(e){if("200"==e.status)return console.log("EasifyPO redirect to checkout page 1"),e.json().then((function(e){"string"==typeof e?.draftOrder?.invoiceUrl&&(window.location.href=e.draftOrder.invoiceUrl)}));console.log("EasifyPO redirect to checkout page 2")})).catch((e=>{console.log("Error:",e)}))}else window.location.href=n?"/checkout":e||"/checkout"}catch(e){console.log("Action checkout error: ",e)}}function Un(){if(!function(){const e=document.querySelector("#birdchime-slots-box");if(!e)return!0;const t=Array.from(e.querySelectorAll("input"));return!t.length||t.every((e=>!!e.value))}()||!function(){if(!window.Zapiet)return!0;const e=document.querySelector("#storePickupApp .checkoutMethodContainer.delivery #deliveryGeoSearchField");return!(e&&!window.ZapietCheckoutEnabled)||(e.classList.contains("tpo_custom")||(e.classList.add("tpo_custom"),e.addEventListener("blur",(function(){setTimeout((()=>{window.ZapietCheckoutEnabled&&Un()}),1e3)}))),!1)}())return;if(A.includes(Q))return;let e=document.querySelectorAll(V.join(","));for(let o=0;o0&&(r=!0),r&&window.bndlr.preventBundlerCheckout(),a.addEventListener("click",(async function(e){if((!window.pickeasy||"function"!=typeof window.handleCheckoutClick||window.handleCheckoutClick())&&(!window.Zapiet||window.ZapietCheckoutEnabled))if(bt.find((e=>Q===e))){const o=document.querySelector(".rale-widget .rale-container input");o&&o.checked&&(e.preventDefault(),e.stopPropagation(),a.innerHTML='
',a.disabled=!0,await Vn("",r),window.addEventListener("pagehide",(function(){t()})))}else{if(!Jn(a)){if(window.rterms){const e=window.rterms.metafield?.alert_message?window.rterms.metafield.alert_message:"Please select the terms of service";alert(e)}return}let o=Rn();if(o)return void alert(`Please fill out ${o} field`);e.preventDefault(),e.stopPropagation(),a.innerHTML='
',a.disabled=!0,await Vn("",r),window.addEventListener("pagehide",(function(){t()}))}}))}}}function Jn(e){const t=e.parentElement.querySelector(".rterms-checkbox");return!t||t.checked}function Rn(){let e=document.querySelectorAll('form[action="/cart"] input[name*="attributes["][required]'),t=e.length?e:document.querySelectorAll(".tpo-cart-attribute[required]");if(!t.length)return!1;for(let e=0;e0&&(i=!0),i&&window.bndlr.preventBundlerCheckout(),t.addEventListener("click",(async function(o){if(!window.pickeasy||"function"!=typeof window.handleCheckoutClick||window.handleCheckoutClick()){if(bt.find((e=>Q===e))){const e=document.querySelector(".rale-widget .rale-container input");if(e&&!e.checked)return}if(Jn(t))o.preventDefault(),o.stopPropagation(),t.innerHTML='
',t.disabled=!0,await Vn("",i),window.addEventListener("pagehide",(function(){t.innerHTML=e,t.disabled=!1}));else if(window.rterms){const e=window.rterms.metafield?.alert_message?window.rterms.metafield.alert_message:"Please select the terms of service";alert(e)}}}))}}}function Qn(e,t){if(O.includes(Q))return;let o=setInterval((function(){const i=e.closest(Se);let n=i?i.querySelectorAll(".tpo-buy-it-now-btn"):document.querySelectorAll(".tpo-buy-it-now-btn");if(n&&0!==n.length)clearInterval(o);else{let e=document.querySelectorAll(W.join(","));for(let o=0;o
',n.disabled=!0,await Gn(a,t),window.addEventListener("pagehide",(function(){n.innerHTML=o,n.disabled=!1})))}))}}}}),500);setTimeout((()=>{clearInterval(o)}),2e3)}async function Gn(e,t=en[0]||{}){const o=e||(ln?an.querySelector(C):document.querySelector($));Ia(o),vs(o).then((e=>{})),Xe&&mn(o);const i=new FormData(o),n="bundle"!==Wo&&i.get("quantity")||"1";let a=document.querySelector("cart-notification")||document.querySelector("cart-drawer")||document.querySelector("cart-dropdown-bubble");a&&a.getSectionsToRender&&(i.append("sections",a.getSectionsToRender().map((e=>e.id))),i.append("sections_url",window.location.pathname));let r=!1,s="",l="",c=0,p={},d="",u=!1;i.forEach(((e,t)=>{/\[ \+(.*)\]/.exec(e)&&(r=!0);let o=/properties\[(.+)\]/.exec(t);"quantity"===t?l=e:"id"===t?s=e:o&&o.length>1&&e&&(o[1].startsWith("_tpo")||(u=!0),p[o[1]]=e)})),u&&bi&&sa(p);const m=[],_={properties:{_tpo_add_on_keys:[],_tpo_add_on_variant_ids:[],_tpo_one_time_charges:[],_tpo_wholesale:[],_tpo_custom_options:[]}};i?.get("properties[_tpo_wholesale]")?_.properties._tpo_wholesale=i.get("properties[_tpo_wholesale]"):delete _.properties._tpo_wholesale,i?.get("properties[_tpo_wholesale]")&&i?.get("properties[_tpo_custom_options]")?_.properties._tpo_custom_options=i.get("properties[_tpo_custom_options]"):delete _.properties._tpo_custom_options;let f={items:[]};const y=t.options||[];ea(_,o),Gr(_),y.forEach(((e,t)=>{const a=e.one_time_charge?JSON.parse(e.one_time_charge):{enable:!1,type:"cart"},r=a?.enable;let s=e.multi_select||0;const l=e.id;"checkbox"===e.type&&(s=!0);const p=e.option_types||[];let d=e.option_identifier;const u=JSON.parse(e.metadata||"{}");let{separateAddOnProduct:f=!1}=u;f&&(d=`_${d}`);const y=!!e.quantity_selector&&JSON.parse(e.quantity_selector).enable;let h=i.get(`properties[${d}]`);"file-upload"===e.type&&(h=d);let g,b=null;try{g=JSON.parse(e?.metadata)}catch(e){g=null}if("dimension"!==e.type&&g?.useDimensionDropdownPricing){const t=document.querySelector("[id*='"+e.id+"'] .tpo_additional-price.active"),o=t?t?.textContent.match(/\(\+?(.*)\)/):null,i=o?o[1]:null;b=i?Pn(i):null}const v=e?.option_types.map((e=>({label:e.label,price:b||e.additional_price,id:e.id,variantId:e.variant_id})));let w=v.some((e=>null!==e.variantId&&""!==e.variantId));if("string"==typeof h)if("dropdown"===e.type||"radio-buttons"===e.type||s&&!vt.find((t=>t===e.type))){let t=[];v.forEach((({label:i,price:n,id:a,variantId:r})=>{if(y){const s=o.querySelector(`[id*="${l},${a},quantity_selector"]`)||o.querySelector(`[id*="${l},${e.type},quantity_selector"]`)||document.querySelector(`[id*="${l},${a},quantity_selector"]`)||document.querySelector(`[id*="${l},${e.type},quantity_selector"]`);if(n){if(s&&s.value){const e=PriceFormatter.formatMoney(parseFloat(n*Number(s.value)*100),!0);(h.includes(`${i} [`)&&h.startsWith(`${i} [`)||h.includes(`, ${i} [`)||h.endsWith(`, ${i} [ +${e} ] | ${s.value}`)||h===`${i} [ +${e} ] | ${s.value}`)&&(t.push(`${i} [ +${e} ] | ${s.value}`),r||(c+=parseFloat(n*Number(s.value))))}}else s&&s.value&&(h.includes(`${i} |`)&&h.startsWith(`${i} | ${s.value}`)||h.includes(`, ${i} |`)||h.endsWith(`, ${i} | ${s.value}`)||h===`${i} | ${s.value}`)&&t.push(`${i} | ${s.value}`)}else if(n){if(h.includes(`${i} [`)&&h.startsWith(`${i} [`)||h.includes(`, ${i} [`)){const e=PriceFormatter.formatMoney(parseFloat(100*n),!0);t.push(`${i} [ +${e} ]`),r||(c+=parseFloat(n))}}else(h.includes(`${i},`)&&h.startsWith(i)||h.includes(`, ${i},`)||h.endsWith(`, ${i}`)||h===i)&&t.push(i)})),h=[...t]}else{let t=e.additional_price||0;if(t&&!w&&("date-picker"===e.type||"time-picker"===e.type||"date-range"===e.type)){const e=PriceFormatter.formatMoney(parseFloat(100*t),!0);h=`${h} [ +${e} ]`}if(h&&"string"==typeof h){let e=/\[ \+(.*)\]/,t=h.match(e);if(t){let e=Pn(t[1]);e&&!w&&(c+=e)}}h=[h]}if(p.forEach(((t,a)=>{let s=t.variant_id||"";const c=t.additional_price||0,p=t.id;let d=t.label,u=1;if(y){const t=o.querySelector(`[id*="${l},${p},quantity_selector"]`)||o.querySelector(`[id*="${l},${e.type},quantity_selector"]`)||document.querySelector(`[id*="${l},${p},quantity_selector"]`)||document.querySelector(`[id*="${l},${e.type},quantity_selector"]`);t&&t.value&&(u=Number(t.value),d=c?`${d} [ +${PriceFormatter.formatMoney(parseFloat(c*u*100),!0)} ] | ${u}`:`${d} | ${u}`)}else c&&(d=`${d} [ +${PriceFormatter.formatMoney(parseFloat(100*c),!0)} ]`);if(s&&h&&h[0])if(vt.find((t=>t===e.type))){let o=h[0];o=o.replace(/\[/g,"("),o=o.replace(/]/g,")"),h[0]=ni?PropertyFormatter.removeMoneyProperty(o):o;let a=o?o.replace(/(\(.*\))|(\{.*\})/g,""):0;if("text-box"===e.type){const o=e.price_type,i=!!e.metadata&&JSON.parse(e.metadata).priceNotSpace;switch(o){case"one":a=1;break;case"per_letter":if(a)if(i){const e=a.replaceAll(" ","");a=e.length}else a=a.trim().length;break;case"quantity_letter":const e=JSON.parse(t.metadata||"{}");if(e.hasOwnProperty("min_text_length")){s="";let o=i?a.replaceAll(" ","").length:a.trim().length;if(o=e.min_text_length&&o<=e.max_text_length){s=t.variant_id||"",a="1";break}break}}}else"quantity"===e.type?"all_with_new_price"===e.price_type&&(a=1):a.length&&(a="1");s&&(f?m.push({id:s,quantity:Ge&&Number(a)?Number(a):Number(a)?Number(a)*(Number(n)||1):n,price:parseFloat(c/Rt),properties:{...bi&&t.option_type_id&&{_tpo_option_value_id:t.option_type_id.toString()}}}):r?m.push({id:s,quantity:"1",price:parseFloat(c/Rt),properties:{_tpo_main_product_id:i.get("id"),_tpo_add_on_key:self.crypto.randomUUID(),_is_one_time_charge:`${s}`,...bi&&t.option_type_id&&{_tpo_option_value_id:t.option_type_id.toString()}}}):m.push({id:s,quantity:Ge&&Number(a)?Number(a):Number(a)?Number(a)*(Number(n)||1):n,price:parseFloat(c/Rt),properties:{_tpo_main_product_id:i.get("id"),_tpo_add_on_key:self.crypto.randomUUID(),...bi&&t.option_type_id&&{_tpo_option_value_id:t.option_type_id.toString()}}}))}else{const e=h.indexOf(d);if(e>-1){if(f){if(y){if(c){let o=PriceFormatter.formatMoney(parseFloat(c*u*100),!0);const i=PriceFormatter.formatMoneyForAddOnProductProperty(o,ni);h.splice(e,1,`${t.label}${i} | ${u}`)}}else if(c){let o=PriceFormatter.formatMoney(parseFloat(100*c),!0);const i=PriceFormatter.formatMoneyForAddOnProductProperty(o,ni);h.splice(e,1,`${t.label}${i}`)}}else{let t=h[e];h[e]=t.replace(/\[(.+?)\]/,"($1)")}y?f?m.push({id:s,quantity:Ge&&u?u:u?u*(Number(n)||1):n,price:parseFloat(c/Rt),properties:{...bi&&t.option_type_id&&{_tpo_option_value_id:t.option_type_id.toString()}}}):m.push({id:s,quantity:Ge&&u?u:u?u*(Number(n)||1):n,price:parseFloat(c/Rt),properties:{_tpo_main_product_id:i.get("id"),_tpo_add_on_key:self.crypto.randomUUID(),...bi&&t.option_type_id&&{_tpo_option_value_id:t.option_type_id.toString()}}}):r?m.push({id:s,quantity:"1",price:parseFloat(c/Rt),properties:{_tpo_main_product_id:i.get("id"),_tpo_add_on_key:self.crypto.randomUUID(),_is_one_time_charge:`${s}`,...bi&&t.option_type_id&&{_tpo_option_value_id:t.option_type_id.toString()}}}):f?m.push({id:s,quantity:n||"1",price:parseFloat(c/Rt),properties:{...bi&&t.option_type_id&&{_tpo_option_value_id:t.option_type_id.toString()}}}):m.push({id:s,quantity:n||"1",price:parseFloat(c/Rt),properties:{_tpo_main_product_id:i.get("id"),_tpo_add_on_key:self.crypto.randomUUID(),...bi&&t.option_type_id&&{_tpo_option_value_id:t.option_type_id.toString()}}})}}})),h&&h.length&&!f&&Array.isArray(h)&&(_.properties[d]=h.join(", ")),"file-upload"===e.type){const t=!!e.option_types[0].variant_id;let o=!1,n=JSON.parse(e.metadata||"{}"),a=n.maxFileQty>10?"fjckPiAzNHI1MzwtMzo="===window.TPOConfigs.app?n.maxFileQty:10:n.maxFileQty||1;h&&h.length&&h[0]===d&&_.properties&&delete _.properties[d];for(let e=0;e{e.properties&&(e.properties={...e.properties,...Kn(_.properties)})})),["sit-and-wonder.myshopify.com","bluemilkstudio.myshopify.com","honeycombliving.myshopify.com","d17912.myshopify.com","c91dd1-69.myshopify.com","the-fieldbar-company-3998.myshopify.com","diavy.myshopify.com"].includes(Q)&&m.forEach((e=>{if(e.properties){const t=Object.keys(_.properties).filter((e=>e.startsWith("*"))).reduce(((e,t)=>(e[t]=_.properties[t],e)),{});e.properties={...e.properties,...t}}})),jt.includes(Q)&&i.get("selling_plan")&&m.length&&(_.selling_plan=i.get("selling_plan"),i.get("subs_interval")&&(_.subs_interval=i.get("subs_interval")),i.get("selling_plan_group")&&(_.selling_plan_group=i.get("selling_plan_group")),m.forEach((e=>{e.selling_plan||(e.selling_plan=_.selling_plan,_.subs_interval&&(e.subs_interval=_.subs_interval),_.selling_plan_group&&(e.selling_plan_group=_.selling_plan_group))}))),["bisoo-shop.myshopify.com","fernandosscreenprinting.myshopify.com"].includes(Q)&&F.includes(Q)){const e={items:m.map((({properties:e,...t})=>t))};return void fetch("/cart/clear.js",{method:"POST",headers:{"Content-Type":"application/json"}}).then((()=>fetch("/cart/add.js",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}))).then((e=>{if(!e.ok)throw new Error("Add-on product add failed");window.location.href="/checkout"})).catch((e=>{console.error("Buy It Now flow for add-on products failed:",e)}))}M.includes(Q)?f.items=[...m,{..._}]:f.items=[{..._},...m]}let g=encodeURIComponent(JSON.stringify(p));d=btoa(g);let b=`https://${G}/cart/${s}:${l||1}?properties=${d}`;if(r||h)fetch("/cart/clear.js",{method:"POST",headers:{"Content-Type":"application/json"}}).then((e=>e.json())).then((async e=>{try{let e="bundle"===Wo&&m.length;if(!h||e){const e=await fetch("/cart/add.js",{method:"POST",headers:{"X-Requested-With":"XMLHttpRequest",Accept:"application/json"},body:i});if(200===e.status){const t=await e.json();i.has(Es())&&await zn([t])}}else{const[e,t]=await ws({body:f,mainProduct:_,formData:i,cartAddUrl:"/cart/add.js"})}let t=!1;Object.keys(window.bndlr||{}).length>0&&(t=!0),t&&window.bndlr.preventBundlerCheckout(),"no"!==Ro&&(c||e)&&(window.location.href="/checkout"),await Vn(b,t)}catch(e){window.location.href=b}})).catch((e=>{window.location.href=b}));else if(i.has(Es()))try{const e=await fetch("/cart/add.js",{method:"POST",headers:{"X-Requested-With":"XMLHttpRequest",Accept:"application/json"},body:i});if(200===e.status){const t=await e.json(),o=t?.properties,i=await fetch("/cart/update.js",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({updates:{[t.id]:0}})});await i.json();let n=encodeURIComponent(JSON.stringify(o));d=btoa(n),window.location.href=`https://${G}/cart/${s}:${l||1}?properties=${d}`}}catch(e){window.location.href=b}else window.location.href=b}async function Xn(e,t,o,i,n,a,s,l=!1,c=!1){try{const p=[];let d=!1,u={properties:{_tpo_add_on_keys:[],_tpo_add_on_variant_ids:[],_tpo_add_on_products:[],_tpo_one_time_charges:[],_tpo_products_per_cart:[],_tpo_wholesale:[],_tpo_custom_options:[]}};"bundle"!==Wo&&delete u.properties._tpo_add_on_products;let m=["evergreeninteriors.myshopify.com","oh-my-goody.myshopify.com","letterally-8244.myshopify.com","61062a-2.myshopify.com"];const _=e.options||[];"eenie-meenie-mine.myshopify.com"===Q&&(t=document.querySelector(`#${dn}`));let f=0;vs(t).then((e=>{}));const y=new FormData(t),h="bundle"!==Wo&&y.get("quantity")||"1";if(y?.get("properties[_tpo_wholesale]")?u.properties._tpo_wholesale=y.get("properties[_tpo_wholesale]"):delete u.properties._tpo_wholesale,y?.get("properties[_tpo_wholesale]")&&y?.get("properties[_tpo_custom_options]")?u.properties._tpo_custom_options=y.get("properties[_tpo_custom_options]"):delete u.properties._tpo_custom_options,l){if(n){let e=s||[];const o=l;t=document.querySelector(".tpo_edit-option-modal .tpo_option-set-container");const r=JSON.parse(n.properties?._tpo_add_on_keys||"[]"),c=JSON.parse(n.properties?._tpo_products_per_cart||"[]");let g=!1;if(_.forEach(((a,r)=>{const s=a.one_time_charge?JSON.parse(a.one_time_charge):{enable:!1,type:"cart"},l=s?.enable,c="cart"===s?.type,d=c&&l?"disabled":ni;let _=a.multi_select||0;const y=a.id;"checkbox"===a.type&&(_=!0);const b=a.option_types||[];let v=a.option_identifier;const w=JSON.parse(a.metadata||"{}");let{separateAddOnProduct:S=!1}=w;S&&(v=`_${v}`);const E=!!a.quantity_selector&&JSON.parse(a.quantity_selector).enable;let $=i[v]||"";$&&(g=!0),"file-upload"===a.type&&($=v);let C,x=null;try{C=JSON.parse(a?.metadata)}catch(e){C=null}if("dimension"!==a.type&&C?.useDimensionDropdownPricing){const e=document.querySelector("[id*='"+a.id+"'] .tpo_additional-price.active"),t=e?e?.textContent.match(/\(\+?(.*)\)/):null,o=t?t[1]:null;x=o?Pn(o):null}const k=a?.option_types.map((e=>({label:e.label,price:x||e.additional_price,id:e.id,variantId:e.variant_id})));let L=k.some((e=>null!==e.variantId&&""!==e.variantId));if("string"==typeof $)if("dropdown"===a.type||"radio-buttons"===a.type||_&&!vt.find((e=>e===a.type))){let e=[];k.forEach((({label:o,price:i,id:n,variantId:r})=>{if(E){const s=t.querySelector(`[id*="${y},${n},quantity_selector"]`)||t.querySelector(`[id*="${y},${a.type},quantity_selector"]`)||document.querySelector(`[id*="${y},${n},quantity_selector"]`)||document.querySelector(`[id*="${y},${a.type},quantity_selector"]`);if(i){if(s&&s.value){const t=PriceFormatter.formatMoney(parseFloat(i*Number(s.value)*100),!0);($.includes(`${o} [`)&&$.startsWith(`${o} [`)||$.includes(`, ${o} [`)||$.endsWith(`, ${o} [ +${t} ] | ${s.value}`)||$===`${o} [ +${t} ] | ${s.value}`)&&(e.push(`${o} [ +${t} ] | ${s.value}`),r||(f+=parseFloat(i*Number(s.value))))}}else $.includes(`${o} |`)&&$.startsWith(`${o} | ${s.value}`)||$.includes(`, ${o} |`)?s&&s.value&&e.push(`${o} | ${s.value}`):($.endsWith(`, ${o} | ${s.value}`)||$===`${o} | ${s.value}`)&&s&&s.value&&e.push(`${o} | ${s.value}`)}else if(i){if($.includes(`${o} [`)&&$.startsWith(`${o} [`)||$.includes(`, ${o} [`)){const t=PriceFormatter.formatMoney(parseFloat(100*i),!0);e.push(`${o} [ +${t} ]`),r||(f+=parseFloat(i))}}else($.includes(`${o},`)&&$.startsWith(o)||$.includes(`, ${o},`)||$.endsWith(`, ${o}`)||$===o)&&e.push(o)})),$=[...e]}else{if($&&"string"==typeof $){let e=/\[ \+(.*)\]/,t=$.match(e);if(t){let e=Pn(t[1]);e&&!L&&(f+=e)}}$=[$]}if(b.forEach(((i,r)=>{let s=i.variant_id||"";const u=i.id,_=i.additional_price||0;let f=i.label,g=1;if(E){const e=t.querySelector(`[id*="${y},${u},quantity_selector"]`)||t.querySelector(`[id*="${y},${a.type},quantity_selector"]`)||document.querySelector(`[id*="${y},${u},quantity_selector"]`)||document.querySelector(`[id*="${y},${a.type},quantity_selector"]`);e&&e.value&&(g=Number(e.value),f=_?`${f} [ +${PriceFormatter.formatMoney(parseFloat(_*g*100),!0)} ] | ${g}`:`${f} | ${g}`)}else _&&(f=`${f} [ +${PriceFormatter.formatMoney(parseFloat(100*_),!0)} ]`);const b=Zn(s),v=Yn(e,b);if(s&&$&&$[0])if(vt.find((e=>e===a.type))){let e=$[0];e=e.replace(/\[/g,"("),e=e.replace(/]/g,")"),m.includes(Q)&&(e=e.replace(/ \( \+.* \)/g,"")),$[0]=d?PropertyFormatter.removeMoneyProperty(e):e;let t=e?e.replace(/(\(.*\))|(\{.*\})/g,""):0;if("text-box"===a.type){const e=a.price_type,o=!!a.metadata&&JSON.parse(a.metadata).priceNotSpace;switch(e){case"one":t=1;break;case"per_letter":if(t)if(o){const e=t.replaceAll(" ","");t=e.length}else t=t.trim().length;break;case"quantity_letter":const e=JSON.parse(i.metadata||"{}");if(e.hasOwnProperty("min_text_length")){s="";let n=o?t.replaceAll(" ","").length:t.trim().length;if(n=e.min_text_length&&n<=e.max_text_length){s=i.variant_id||"",t=1;break}break}}}else"quantity"===a.type?"all_with_new_price"===a.price_type&&(t=1):t.length&&(t=1);s&&(S?p.push({id:s,quantity:Ge&&Number(t)?Number(t):Number(t)?Number(t)*(Number(h)||1):h,price:parseFloat(_/Rt),properties:{...bi&&i.option_type_id&&{_tpo_option_value_id:i.option_type_id.toString()}}}):l?c?v||p.find((e=>e.id===s))?p.push({properties:{_one_time_per_cart:b},add:!1}):p.push({id:s,quantity:"1",properties:{_one_time_per_cart:b}}):p.push({id:s,quantity:"1",price:parseFloat(_/Rt),properties:{_tpo_main_product_id:`${n.variant_id}`,_tpo_add_on_key:self.crypto.randomUUID(),_is_one_time_charge:`${s}`,...bi&&i.option_type_id&&{_tpo_option_value_id:i.option_type_id.toString()}}}):p.push({id:s,quantity:Number(t)*o,price:parseFloat(_/Rt),properties:{_tpo_main_product_id:`${n.variant_id}`,_tpo_add_on_key:self.crypto.randomUUID(),...bi&&i.option_type_id&&{_tpo_option_value_id:i.option_type_id.toString()}}}))}else{const e=$.indexOf(f);if(e>-1){if(m.includes(Q)||S)$.splice(e,1,`${i.label}`);else if(E){if(_){let t=PriceFormatter.formatMoney(parseFloat(_*g*100),!0);const o=PriceFormatter.formatMoneyForAddOnProductProperty(t,d);$.splice(e,1,`${i.label}${o} | ${g}`)}}else if(_){let t=PriceFormatter.formatMoney(parseFloat(100*_),!0);const o=PriceFormatter.formatMoneyForAddOnProductProperty(t,d);$.splice(e,1,`${i.label}${o}`)}E?S?p.push({id:s,quantity:o*(g||1),properties:{...bi&&i.option_type_id&&{_tpo_option_value_id:i.option_type_id.toString()}}}):p.push({id:s,quantity:o*(g||1),price:parseFloat(_/Rt),properties:{_tpo_main_product_id:`${n.variant_id}`,_tpo_add_on_key:self.crypto.randomUUID(),...bi&&i.option_type_id&&{_tpo_option_value_id:i.option_type_id.toString()}}}):l?c?v||p.find((e=>e.id===s))?p.push({properties:{_one_time_per_cart:b},add:!1}):p.push({id:s,quantity:"1",properties:{_one_time_per_cart:b}}):p.push({id:s,quantity:"1",price:parseFloat(_/Rt),properties:{_tpo_main_product_id:`${n.variant_id}`,_tpo_add_on_key:self.crypto.randomUUID(),_is_one_time_charge:`${s}`,...bi&&i.option_type_id&&{_tpo_option_value_id:i.option_type_id.toString()}}}):S?p.push({id:s,quantity:o||1,properties:{...bi&&i.option_type_id&&{_tpo_option_value_id:i.option_type_id.toString()}}}):p.push({id:s,quantity:o||1,price:parseFloat(_/Rt),properties:{_tpo_main_product_id:`${n.variant_id}`,_tpo_add_on_key:self.crypto.randomUUID(),...bi&&i.option_type_id&&{_tpo_option_value_id:i.option_type_id.toString()}}})}}})),$.length&&Array.isArray($)&&(u.properties[v]=$.join(", ")),"file-upload"===a.type){const e=!!a.option_types[0].variant_id;let t=!1,o=JSON.parse(a.metadata||"{}"),n=o.maxFileQty>10?"fjckPiAzNHI1MzwtMzo="===window.TPOConfigs.app?o.maxFileQty:10:o.maxFileQty||1;for(let o=0;ot===e.properties?._one_time_per_cart))||u.properties?._tpo_products_per_cart.push(e.properties?._one_time_per_cart));u.properties._tpo_add_on_keys=JSON.stringify(u.properties._tpo_add_on_keys),u.properties._tpo_add_on_variant_ids=JSON.stringify(u.properties._tpo_add_on_variant_ids),u.properties._tpo_one_time_charges&&u.properties._tpo_one_time_charges.length?u.properties._tpo_one_time_charges=JSON.stringify(u.properties._tpo_one_time_charges):delete u.properties._tpo_one_time_charges,u.properties._tpo_products_per_cart&&u.properties._tpo_products_per_cart.length?u.properties._tpo_products_per_cart=JSON.stringify(u.properties._tpo_products_per_cart):delete u.properties._tpo_products_per_cart;const b=e[a],v=b.properties?._tpo_products_per_cart?JSON.parse(b.properties?._tpo_products_per_cart):[];if("bundle"===Wo&&(u.properties._tpo_add_on_products=Hn(p),delete u.properties._tpo_add_on_keys,delete u.properties._tpo_add_on_variant_ids),d=!!p.length,"bundle"===Wo){let e=!1;p.forEach((t=>{t.properties._tpo_add_on_key||t.properties._tpo_main_product_id?t.add=!1:e=!0})),e||(d=!1)}if(d||r.length||c.length){if(u.properties._tpo_is_main_product="1",Object.keys(u.properties).forEach((e=>{"string"==typeof u.properties[e]&&""===u.properties[e].trim()&&delete u.properties[e]})),u.id=n.variant_id,u.quantity=o,["pacificsundaytour.myshopify.com","bda175.myshopify.com","paxscrubs.myshopify.com","9059d2-ed.myshopify.com","vixud8-2e.myshopify.com","baby-elegance-ie.myshopify.com"].includes(Q)&&p.forEach((e=>{e.properties&&(e.properties={...e.properties,...u.properties})})),["toonz-by-aysh.myshopify.com"].includes(Q)&&p.forEach((e=>{e.properties&&(e.properties={...e.properties,...u["properties[_essential_preorder_campaign_id]"]&&{_essential_preorder_campaign_id:u["properties[_essential_preorder_campaign_id]"]},...u["properties[Note]"]&&{Note:u["properties[Note]"]}})})),["sit-and-wonder.myshopify.com","bluemilkstudio.myshopify.com","honeycombliving.myshopify.com","d17912.myshopify.com","c91dd1-69.myshopify.com","the-fieldbar-company-3998.myshopify.com","diavy.myshopify.com"].includes(Q)&&p.forEach((e=>{if(e.properties){const t=Object.keys(u.properties).filter((e=>e.startsWith("*"))).reduce(((e,t)=>(e[t]=u.properties[t],e)),{});e.properties={...e.properties,...t}}})),jt.includes(Q))b?.selling_plan_allocation?.selling_plan?.id&&p.length&&p.forEach((e=>{e.selling_plan||(e.selling_plan=b.selling_plan_allocation.selling_plan.id,e.subs_interval=b.selling_plan_allocation.selling_plan.id)})),u.selling_plan=b?.selling_plan_allocation?.selling_plan?.id;else if(b?.selling_plan_allocation?.selling_plan?.id){let e=b?.selling_plan_allocation?.selling_plan??null;u.selling_plan=b?.selling_plan_allocation?.selling_plan?.id,e&&e.id&&p.length&&p.forEach((t=>{const o=Number(t.id);for(const i of vn){const n=i.variants.find((e=>e.id===o));if(n){const o=n.selling_plan_allocations.find((t=>{const o=i.selling_plan_groups.find((e=>e.id===t.selling_plan_group_id));return o&&o.name===e.name}))?.selling_plan_id;o&&(t.selling_plan=o);break}}}))}let t=[];p&&p.length&&(t=p.filter((e=>!1!==e.add)));const i=M.includes(Q)?{items:[...t,{...u}]}:{items:[{...u},...t]};let l={updates:{[e[a].key]:"0"}};for(let t=0;te.properties._tpo_add_on_key===r[t]))?.key;o&&(l.updates[o]="0")}const c=s[a].properties,d=u.properties;if(Object.keys(c).every((e=>c[e]&&d[e]?c[e]===d[e]:!c[e]&&!d[e])))return!0;const[m,_]=await ws({body:i,mainProduct:u,formData:y,cartAddUrl:"/cart/add.js"}),f=[_,m].find((e=>!!e)),h=await f.json();if(h.status>=400)return alert(h.description),window.scrollTo({top:0,left:0,behavior:"smooth"}),setTimeout((async()=>{window.location.reload()}),500),!0;{let e=await Ua();return fr(v,e?.items||[],b.key).forEach((e=>{e&&(l.updates[e]="0")})),setTimeout((async()=>{await fetch("/cart/update.js",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(l)}),await Ua(),window.scrollTo({top:0,left:0,behavior:"smooth"}),window.location.reload()}),500),!0}}if(Object.keys(u.properties).forEach((e=>{("string"==typeof u.properties[e]&&""===u.properties[e].trim()||"[]"===u.properties[e])&&delete u.properties[e]})),0===Object.keys(u.properties).length){if(u.id=n.variant_id,u.quantity=o,jt.includes(Q))b?.selling_plan_allocation?.selling_plan?.id&&p.length&&p.forEach((e=>{e.selling_plan||(e.selling_plan=b.selling_plan_allocation.selling_plan.id,e.subs_interval=b.selling_plan_allocation.selling_plan.id)})),u.selling_plan=b?.selling_plan_allocation?.selling_plan?.id;else if(b?.selling_plan_allocation?.selling_plan?.id){let e=b?.selling_plan_allocation?.selling_plan??null;u.selling_plan=b?.selling_plan_allocation?.selling_plan?.id,e&&e.id&&p.length&&p.forEach((t=>{const o=Number(t.id);for(const i of vn){const n=i.variants.find((e=>e.id===o));if(n){const o=n.selling_plan_allocations.find((t=>{const o=i.selling_plan_groups.find((e=>e.id===t.selling_plan_group_id));return o&&o.name===e.name}))?.selling_plan_id;o&&(t.selling_plan=o);break}}}))}const t={items:[{...u}]};let i={updates:{[e[a].key]:"0"}};const[r,s]=await ws({body:t,mainProduct:u,formData:y,cartAddUrl:"/cart/add.js"}),l=[s,r].find((e=>!!e)),c=await l.json();if(c.status>=400)return alert(c.description),window.scrollTo({top:0,left:0,behavior:"smooth"}),setTimeout((async()=>{window.location.reload()}),500),!0;{let e=await Ua();return fr(v,e?.items||[],b.key).forEach((e=>{e&&(i.updates[e]="0")})),setTimeout((async()=>{await fetch("/cart/update.js",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)}),await Ua(),window.scrollTo({top:0,left:0,behavior:"smooth"}),window.location.reload()}),500),!0}}return g&&bi&&sa(i),{properties:u.properties}}}else{let e=s||[];Ia(t),ea(u,t),Gr(u);let i=!1;if(_.forEach(((o,n)=>{const a=o.one_time_charge?JSON.parse(o.one_time_charge):{enable:!1,type:"product"},r=a?.enable,s="cart"===a?.type,l=s&&r?"disabled":ni;let c=o.multi_select||0;const d=o.id;"checkbox"===o.type&&(c=!0);const _=o.option_types||[];let g=o.option_identifier;const b=JSON.parse(o.metadata||"{}");let{separateAddOnProduct:v=!1}=b;v&&(g=`_${g}`);const w=!!o.quantity_selector&&JSON.parse(o.quantity_selector).enable;let S=y.get(`properties[${g}]`);S&&(i=!0),"file-upload"===o.type&&(S=g);let E,$=null;try{E=JSON.parse(o?.metadata)}catch(e){E=null}if("dimension"!==o.type&&E?.useDimensionDropdownPricing){const e=document.querySelector("[id*='"+o.id+"'] .tpo_additional-price.active"),t=e?e?.textContent.match(/\(\+?(.*)\)/):null,i=t?t[1]:null;$=i?Pn(i):null}const C=o?.option_types.map((e=>({label:e.label,price:$||e.additional_price,id:e.id,variantId:e.variant_id})));let x=C.some((e=>null!==e.variantId&&""!==e.variantId));if("string"==typeof S)if("dropdown"===o.type||"radio-buttons"===o.type||c&&!vt.find((e=>e===o.type))){let e=[];C.forEach((({label:i,price:n,id:a,variantId:r})=>{if(w){const s=t.querySelector(`[id*="${d},${a},quantity_selector"]`)||t.querySelector(`[id*="${d},${o.type},quantity_selector"]`)||document.querySelector(`[id*="${d},${a},quantity_selector"]`)||document.querySelector(`[id*="${d},${o.type},quantity_selector"]`);if(n){if(s&&s.value){const t=PriceFormatter.formatMoney(parseFloat(n*Number(s.value)*100),!0);(S.includes(`${i} [`)&&S.startsWith(`${i} [`)||S.includes(`, ${i} [`)||S.endsWith(`, ${i} [ +${t} ] | ${s.value}`)||S===`${i} [ +${t} ] | ${s.value}`)&&(e.push(`${i} [ +${t} ] | ${s.value}`),r||(f+=parseFloat(n*Number(s.value))))}}else s&&s.value&&(S.includes(`${i} |`)&&S.startsWith(`${i} | ${s.value}`)||S.includes(`, ${i} |`)||S.endsWith(`, ${i} | ${s.value}`)||S===`${i} | ${s.value}`)&&e.push(`${i} | ${s.value}`)}else if(n){if(S.includes(`${i} [`)&&S.startsWith(`${i} [`)||S.includes(`, ${i} [`)){const t=PriceFormatter.formatMoney(parseFloat(100*n),!0);e.push(`${i} [ +${t} ]`),r||(f+=parseFloat(n))}}else(S.includes(`${i},`)&&S.startsWith(i)||S.includes(`, ${i},`)||S.endsWith(`, ${i}`)||S===i)&&e.push(i)})),S=[...e]}else{if(S&&"string"==typeof S){let e=/\[ \+(.*)\]/,t=S.match(e);if(t){let e=Pn(t[1]);e&&!x&&(f+=e)}}S=[S]}if(_.forEach(((i,n)=>{let a=i.variant_id||"";const c=i.id;let u=i.additional_price||0,_=i.label,f=1;if(w){const e=t.querySelector(`[id*="${d},${c},quantity_selector"]`)||t.querySelector(`[id*="${d},${o.type},quantity_selector"]`)||document.querySelector(`[id*="${d},${c},quantity_selector"]`)||document.querySelector(`[id*="${d},${o.type},quantity_selector"]`);e&&e.value&&(f=Number(e.value),_=u?`${_} [ +${PriceFormatter.formatMoney(parseFloat(u*f*100),!0)} ] | ${f}`:`${_} | ${f}`)}else u&&(_=`${_} [ +${PriceFormatter.formatMoney(parseFloat(100*u),!0)} ]`);const g=Zn(a),b=Yn(e,g);if(a&&S&&S[0])if(vt.find((e=>e===o.type))){let e=S[0];e=e.replace(/\[/g,"("),e=e.replace(/]/g,")"),m.includes(Q)&&(e=e.replace(/ \( \+.* \)/g,"")),S[0]=l?PropertyFormatter.removeMoneyProperty(e):e;let t=e?e.replace(/(\(.*\))|(\{.*\})/g,""):0;if("text-box"===o.type){const e=o.price_type,n=!!o.metadata&&JSON.parse(o.metadata).priceNotSpace;switch(e){case"one":t=1;break;case"per_letter":if(t)if(n){const e=t.replaceAll(" ","");t=e.length}else t=t.trim().length;break;case"quantity_letter":const e=JSON.parse(i.metadata||"{}");if(e.hasOwnProperty("min_text_length")){a="";let o=n?t.replaceAll(" ","").length:t.trim().length;if(o=e.min_text_length&&o<=e.max_text_length){a=i.variant_id||"",t="1";break}break}}}else"quantity"===o.type?"all_with_new_price"===o.price_type&&(t=1):t.length&&(t="1");a&&(v?p.push({id:a,quantity:Ge&&Number(t)?Number(t):Number(t)?Number(t)*(Number(h)||1):h,price:parseFloat(u/Rt),properties:{...bi&&i.option_type_id&&{_tpo_option_value_id:i.option_type_id.toString()}}}):r?s?b||p.find((e=>e.id===a))?p.push({properties:{_one_time_per_cart:g},add:!1}):p.push({id:a,quantity:"1",properties:{_one_time_per_cart:g}}):p.push({id:a,quantity:"1",price:parseFloat(u/Rt),properties:{_tpo_main_product_id:y.get("id"),_tpo_add_on_key:self.crypto.randomUUID(),_is_one_time_charge:`${a}`,...bi&&i.option_type_id&&{_tpo_option_value_id:i.option_type_id.toString()}}}):p.push({id:a,quantity:Ge&&Number(t)?Number(t):Number(t)?Number(t)*(Number(h)||1):h,price:parseFloat(u/Rt),properties:{_tpo_main_product_id:y.get("id"),_tpo_add_on_key:self.crypto.randomUUID(),...bi&&i.option_type_id&&{_tpo_option_value_id:i.option_type_id.toString()}}}))}else{const e=S.indexOf(_);if(e>-1){if(m.includes(Q)||v)S.splice(e,1,`${i.label}`);else if(w){if(u){let t=PriceFormatter.formatMoney(parseFloat(u*f*100),!0);const o=PriceFormatter.formatMoneyForAddOnProductProperty(t,l);S.splice(e,1,`${i.label}${o} | ${f}`)}}else if(u){let t=PriceFormatter.formatMoney(parseFloat(100*u),!0);const o=PriceFormatter.formatMoneyForAddOnProductProperty(t,l);S.splice(e,1,`${i.label}${o}`)}w?v?p.push({id:a,quantity:Ge&&f?f:f?f*(Number(h)||1):h,price:parseFloat(u/Rt),properties:{...bi&&i.option_type_id&&{_tpo_option_value_id:i.option_type_id.toString()}}}):p.push({id:a,quantity:Ge&&f?f:f?f*(Number(h)||1):h,price:parseFloat(u/Rt),properties:{_tpo_main_product_id:y.get("id"),_tpo_add_on_key:self.crypto.randomUUID(),...bi&&i.option_type_id&&{_tpo_option_value_id:i.option_type_id.toString()}}}):r?s?b||p.find((e=>e.id===a))?p.push({properties:{_one_time_per_cart:g},add:!1}):p.push({id:a,quantity:"1",properties:{_one_time_per_cart:g}}):p.push({id:a,quantity:"1",price:parseFloat(u/Rt),properties:{_tpo_main_product_id:y.get("id"),_tpo_add_on_key:self.crypto.randomUUID(),_is_one_time_charge:`${a}`,...bi&&i.option_type_id&&{_tpo_option_value_id:i.option_type_id.toString()}}}):v?p.push({id:a,quantity:h||"1",price:parseFloat(u/Rt),properties:{...bi&&i.option_type_id&&{_tpo_option_value_id:i.option_type_id.toString()}}}):p.push({id:a,quantity:h||"1",price:parseFloat(u/Rt),properties:{_tpo_main_product_id:y.get("id"),_tpo_add_on_key:self.crypto.randomUUID(),...bi&&i.option_type_id&&{_tpo_option_value_id:i.option_type_id.toString()}}})}}})),y.delete(`properties[${g}]`),S&&S.length&&!v&&Array.isArray(S)&&(u.properties[g]=S.join(", ")),"file-upload"===o.type){const e=!!o.option_types[0].variant_id;let t=!1,i=JSON.parse(o.metadata||"{}"),n=i.maxFileQty>10?"fjckPiAzNHI1MzwtMzo="===window.TPOConfigs.app?i.maxFileQty:10:i.maxFileQty||1;S&&S.length&&S[0]===g&&u.properties&&delete u.properties[g];for(let o=0;ot===e.properties?._one_time_per_cart))||u.properties?._tpo_products_per_cart.push(e.properties?._one_time_per_cart));if(u.properties._tpo_add_on_keys=JSON.stringify(u.properties._tpo_add_on_keys),u.properties._tpo_add_on_variant_ids=JSON.stringify(u.properties._tpo_add_on_variant_ids),u.properties._tpo_one_time_charges&&u.properties._tpo_one_time_charges.length?u.properties._tpo_one_time_charges=JSON.stringify(u.properties._tpo_one_time_charges):delete u.properties._tpo_one_time_charges,u.properties._tpo_products_per_cart&&u.properties._tpo_products_per_cart.length?u.properties._tpo_products_per_cart=JSON.stringify(u.properties._tpo_products_per_cart):delete u.properties._tpo_products_per_cart,y.get("properties[_tpo_active_currency]")&&(u.properties._tpo_active_currency=y.get("properties[_tpo_active_currency]")),y.get("properties[_tpo_currency_rate]")&&(u.properties._tpo_currency_rate=y.get("properties[_tpo_currency_rate]")),"bundle"===Wo&&(u.properties._tpo_add_on_products=Hn(p),delete u.properties._tpo_add_on_keys,delete u.properties._tpo_add_on_variant_ids),"no"!==Ro&&f){if("expand"===Ro){let e=Xr();e={...e,...u.properties},u.properties._tpo_custom_options=JSON.stringify(In(e))}u.properties._tpo_price=parseFloat(f/Rt)}if(d=!!p.length,"bundle"===Wo){let e=!1;p.forEach((t=>{t.properties._tpo_add_on_key||t.properties._tpo_main_product_id?t.add=!1:e=!0})),e||(d=!1)}if(d){u.properties._tpo_is_main_product="1",t.dataset.hasAddOnProduct=!0,t.onsubmit=()=>!1;for(const[e,t]of y)u[e]=t;let e=document.querySelector("cart-notification")||document.querySelector("cart-drawer")||document.querySelector("cart-dropdown-bubble");if(e&&e.getSectionsToRender&&(u.sections=e.getSectionsToRender().map((e=>e.id)),u.sections_url=window.location.pathname),"emblematic-creative.myshopify.com"===Q){let e=[];document.documentElement.dispatchEvent(new CustomEvent("cart:prepare-bundled-sections",{bubbles:!0,detail:{sections:e}})),u.sections=e.join(","),u.sections_url=window.location.pathname}u.quantity||(u.quantity="1");let o=["608e06-2.myshopify.com","nevidjenoshop.myshopify.com","faa1a1-4.myshopify.com"];if(!u.id&&window.__pageflyProducts&&o.includes(Q)){let e=u["product-id"];e&&(u.id=window.__pageflyProducts[e]?.selected_or_first_available_variant.id,p.forEach((t=>{t.properties&&void 0!==t.properties._tpo_main_product_id&&(t.properties._tpo_main_product_id=e)})))}["pacificsundaytour.myshopify.com","bda175.myshopify.com","paxscrubs.myshopify.com","9059d2-ed.myshopify.com","vixud8-2e.myshopify.com","baby-elegance-ie.myshopify.com"].includes(Q)&&p.forEach((e=>{e.properties&&(e.properties={...e.properties,...Kn(u.properties)})})),["toonz-by-aysh.myshopify.com"].includes(Q)&&p.forEach((e=>{e.properties&&(e.properties={...e.properties,...u["properties[_essential_preorder_campaign_id]"]&&{_essential_preorder_campaign_id:u["properties[_essential_preorder_campaign_id]"]},...u["properties[Note]"]&&{Note:u["properties[Note]"]}})})),["sit-and-wonder.myshopify.com","bluemilkstudio.myshopify.com","honeycombliving.myshopify.com","d17912.myshopify.com","c91dd1-69.myshopify.com","the-fieldbar-company-3998.myshopify.com","diavy.myshopify.com"].includes(Q)&&p.forEach((e=>{if(e.properties){const t=Object.keys(u.properties).filter((e=>e.startsWith("*"))).reduce(((e,t)=>(e[t]=u.properties[t],e)),{});e.properties={...e.properties,...t}}})),jt.includes(Q)&&u.selling_plan&&p.length&&p.forEach((e=>{e.selling_plan||(e.selling_plan=u.selling_plan,u.subs_interval&&(e.subs_interval=u.subs_interval),u.selling_plan_group&&(e.selling_plan_group=u.selling_plan_group))}));let i=M.includes(Q)?{items:[...p,{...u}]}:{items:[{...u}]};F.includes(Q)&&(i={items:p.map((e=>{const{properties:t,...o}=e;return o}))});try{let o=/%[0-9A-Fa-f]{2}/g;const n=Ft.includes(Q);let a=null,s=!u.sections||n||o.test(u.sections_url)?"/cart/add.js":`/cart/add.js?sections=${u.sections}§ions_url=${u.sections_url}`;r&&(window.upcartOnCartLoaded=!1);const[l,c]=await ws({body:i,mainProduct:u,formData:y,cartAddUrl:s}),d=[c,l].find((e=>!!e)),m=await d.json();if(a=m,d.status>=400){const e=await fetch("/cart.js?app=tpo",{method:"GET",headers:{"Content-Type":"application/json"}}),o=await e.json(),i=o?.items.find((e=>e.variant_id==y.get("id")&&(JSON.parse(e.properties._tpo_add_on_keys||"[]").includes(p[0].properties._tpo_add_on_key)||JSON.parse(e.properties._tpo_products_per_cart||"[]").includes(p[0].properties._one_time_per_cart))))?.quantity||0;if(i){const e=p.map((e=>e.properties.hasOwnProperty("_one_time_per_cart")||e.properties.hasOwnProperty("_is_one_time_charge")?e:{...e,quantity:i})),t={items:[...e]};await fetch("/cart/add.js",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})}if(alert(m.description),Br(m))return;if(N.includes(Q))window.location.href="/cart";else{if(Br(m))return;L.includes(Q)&&!window.location.href.endsWith("true")?window.location.href=window.location.href+"?addToCart=true":"5"===t.dataset.afterAtc?window.location.href="/checkout":P.includes(Q)?(window.scrollTo({top:0,left:0,behavior:"smooth"}),window.location.reload()):"drawer"!==b&&"dropdown"!==b||window.location.href.endsWith("addToCart=true")?"page"===b?window.location.href="/cart":It?document.documentElement.dispatchEvent(new Event("supercart:open")):(window.scrollTo({top:0,left:0,behavior:"smooth"}),window.location.reload()):window.location.href=window.location.href+"?addToCart=true"}}else{if(document.dispatchEvent(new CustomEvent("easify:main-product:add",{bubbles:!0,detail:{cart:a}})),!M.includes(Q)&&!F.includes(Q)){let e=[],t=a?.items?.[0],o=t?.selling_plan_allocation?.selling_plan??null;o&&o.id&&p.length&&p.forEach((e=>{const t=Number(e.id);for(const i of vn){const n=i.variants.find((e=>e.id===t));if(n){const t=n.selling_plan_allocations.find((e=>{const t=i.selling_plan_groups.find((t=>t.id===e.selling_plan_group_id));return t&&t.name===o.name}))?.selling_plan_id;t&&(e.selling_plan=t);break}}})),p&&p.length&&(e=p.filter((e=>!1!==e.add)));const i={items:[...e]};if(e.length){let t=await fetch(s,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)});a=await t.json(),document.dispatchEvent(new CustomEvent("easify:add-on-product:add",{bubbles:!0,detail:{cart:a}})),422===a.status&&a.description.includes("selling plan")&&y.get("selling_plan")&&(u.selling_plan=y.get("selling_plan"),e.forEach((e=>{e.selling_plan||(e.selling_plan=u.selling_plan)})),t=await fetch(s,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({items:[...e]})}),a=await t.json())}}if(Br(m))return;if(window.icartAddToCartEvent)setTimeout((async()=>{await hr()}),1500);else if(N.includes(Q))window.location.href="/cart";else if(L.includes(Q)&&!window.location.href.endsWith("true"))window.location.href=window.location.href+"?addToCart=true";else if("5"===t.dataset.afterAtc)window.location.href="/checkout";else if(P.includes(Q))window.scrollTo({top:0,left:0,behavior:"smooth"}),window.location.reload();else if("drawer"===b||"dropdown"===b){let t="";t=window.theme&&(window.theme.settings?.themeName||window.theme.info?.name)||Z,t.includes("Impulse")||t.includes("Expanse")||t.includes("Mount-It")?document.dispatchEvent(new CustomEvent("ajaxProduct:added")):t.includes("Symmetry")||t.includes("Mode")?(document.dispatchEvent(new CustomEvent("on:cart:change")),document.dispatchEvent(new CustomEvent("dispatch:cart-drawer:open")),document.dispatchEvent(new CustomEvent("theme:cartchanged")),document.dispatchEvent(new CustomEvent("theme:open-cart-drawer")),await dr(),await Wa(),await hr()):"emblematic-creative.myshopify.com"===Q?(document.dispatchEvent(new CustomEvent("variant:add")),document.dispatchEvent(new CustomEvent("cart:refresh")),document.documentElement.dispatchEvent(new CustomEvent("cart:change",{bubbles:!0,detail:{baseEvent:"variant:add",onSuccessDo:"force_open_drawer",cart:a}})),setTimeout((()=>{document.dispatchEvent(new CustomEvent("cart:refresh"))}),1500)):t.includes("Enterprise")?window.location.href.endsWith("addToCart=true")?(window.scrollTo({top:0,left:0,behavior:"smooth"}),window.location.reload()):window.location.href=window.location.href+"?addToCart=true":e&&e.renderContents&&a&&a?.sections?(e.renderContents({...a?.items[0],sections:a?.sections}),e&&e.classList.contains("is-empty")&&e.classList.remove("is-empty"),await dr(),await Wa(),await hr()):window.easifyAddToCartEvent||(window.location.href.endsWith("addToCart=true")?(window.scrollTo({top:0,left:0,behavior:"smooth"}),window.location.reload()):window.location.href=window.location.href+"?addToCart=true")}else if("Ecomus"===Z){document.dispatchEvent(new CustomEvent("cart:refresh"));let e=document.querySelector(ht);if(e){let t=new CustomEvent("click",{bubbles:!0,cancelable:!0});e.dispatchEvent(t)}await dr(),await Wa(),await hr()}else"page"===b||"notification"===b?window.location.href="/cart":It?document.documentElement.dispatchEvent(new Event("supercart:open")):window.easifyAddToCartEvent||(window.scrollTo({top:0,left:0,behavior:"smooth"}),window.location.reload())}}catch(e){console.log("Error: ",e)}}else{if(i&&function(){const e=document.querySelector("#easify-mark-input");e&&(e.disabled=!1)}(),t.dataset.hasAddOnProduct=!1,o.type="submit","no"!==Ro&&(f||"bundle"===Wo)){let e=t?.querySelector('[name="properties[_tpo_price]"]');if(e?e.value=parseFloat(f/Rt):(e=document.createElement("input"),e.type="hidden",e.id="_tpo_price",e.name="properties[_tpo_price]",e.value=parseFloat(f/Rt),t.appendChild(e)),"expand"===Ro||"bundle"===Wo){let e=Xr();e={...e,...u.properties};let o=t.querySelector('[name="properties[_tpo_custom_options]"]');o?o.value=JSON.stringify(In(e)):(o=document.createElement("input"),o.type="hidden",o.id="_tpo_custom_options",o.name="properties[_tpo_custom_options]",o.value=JSON.stringify(In(e)),t.appendChild(o));let i=t.querySelector('[name="properties[_tpo_add_on_products]"]');i?i.value=Hn(p):(i=document.createElement("input"),i.type="hidden",i.id="_tpo_add_on_products",i.name="properties[_tpo_add_on_products]",i.value=Hn(p),t.appendChild(i))}}const e="true"===o.getAttribute("stickyAdd");if((Ne.includes(Q)||St||e)&&t.dispatchEvent(new Event("submit")),Ae.includes(Q)||c){const e={method:"POST",headers:{"X-Requested-With":"XMLHttpRequest",Accept:"application/json"},body:new FormData(t)};await fetch("/cart/add",e).then((e=>e.json())).then((e=>{const t=document.querySelector(ht);document.dispatchEvent(new Event("easify:added")),window.prepareDataForDisplayWidgetByRule?window.prepareDataForDisplayWidgetByRule():t?t.dispatchEvent(new Event("click",{bubbles:!0})):window.location.href="/cart"})).catch((e=>{console.log("error",e)}))}else if($t.includes(Z)&&"page"===b){const e={method:"POST",headers:{"X-Requested-With":"XMLHttpRequest",Accept:"application/json"},body:new FormData(t)};try{const t=await fetch("/cart/add",e),o=await t.json();if(o.status>=400)return console.error("Add to cart failed:",o.description),void alert(o.description);await fetch("/cart.js",{method:"GET",headers:{"Content-Type":"application/json"}}),window.location.href="/cart"}catch(e){console.error("Error adding to cart:",e)}}setTimeout((async()=>{await async function(){window.Appointo&&await Vn()}()}),500),setTimeout((async()=>{!function(){const e=document.querySelector("#easify-mark-input");e&&(e.disabled=!0)}(),await Or()}),2e3)}}return await Xa(),await Za(),setTimeout((async()=>{await Un(),await Wn(),await dr()}),1e3),d}catch(e){console.log("error",e)}}function Zn(e,t){return`${e}`}function Yn(e,t){let o=!1;return e&&e.length&&(o=e.some((e=>e.properties._one_time_per_cart===t))),o}function Kn(e){return Object.entries(e).reduce(((e,[t,o])=>(t.startsWith("_")||(e[`_${t}`]=o),e)),{})}function ea(e,t){if(!Dt)return;const o=new FormData(t);Array.from(t.elements).filter((e=>!e.closest(".tpo_option-set-wrapper")&&!e.disabled&&e.name&&e.name.includes("properties"))).forEach((t=>{const i=t.name.match(/\[(.*?)\]/);if(!i)return;const n=i[1],a=o.get(t.name);a&&"object"!=typeof a&&(e.properties[n]=a)}))}function ta(e){const t=D?.textAddToCartCustom;if(t&&!window.preOrderProduct){const o=e.querySelector("span");o?o.textContent=t:e.textContent=t}}function oa(e,t,o,i,n){if(delete o.dataset.isRenderOptionSet,r&&!window.upcartShouldSkipAddToCartInterceptor&&(window.upcartShouldSkipAddToCartInterceptor=!0),!e)return"";if(console.log("optionSetId: ",e?.option_set_id),function(e){e.isParsed||(e.options=e.options.map((e=>({...e,additional_price:e.additional_price*Rt,option_types:e.option_types.map((e=>{let t={},{variant_id:o,additional_price:i}=e;return o&&vn.forEach((e=>{e.variants.forEach((i=>{`${i.id}`===o&&(t={...e,variants:[{...i}]})}))})),t.variants?i=t.variants[0].price/100:i*=Rt,{...e,additional_price:i}}))}))),e.isParsed=!0)}(e),"1a3849-55.myshopify.com"===Q&&o.parentNode){const e=o.cloneNode(!0);o.parentNode.insertBefore(e,o),o.parentNode.removeChild(o),e.classList.add("tpo-btn-add_to_cart"),o=e}o.classList.add("tpo_add-to-cart"),"undefined"!=typeof BoosterTheme&&o.removeAttribute("onclick"),ta(o);const{title:a,options:s=[]}=e,l=self.crypto.randomUUID(),p=K?s.map((e=>{if("string"==typeof e.date_time_values&&(e.date_time_values=e.date_time_values.length?JSON.parse(e.date_time_values||"[]"):[]),e.conditions_serialized){const t="string"!=typeof e.conditions_serialized?e.conditions_serialized:JSON.parse(e.conditions_serialized);return De=[...De,{id:e.id,...t}],t.conditionalField?{...e,conditions_serialized:t}:{...e,conditions_serialized:{}}}return De=[...De,{id:e.id}],{...e,conditions_serialized:{}}})):s.map((e=>{const t=`${l}`,o=`${l},${e.id}`,i=`${l}-${e.id}`;if("string"==typeof e.date_time_values&&(e.date_time_values=e.date_time_values.length?JSON.parse(e.date_time_values||"[]"):[]),e.conditions_serialized){const n="string"!=typeof e.conditions_serialized?e.conditions_serialized:JSON.parse(e.conditions_serialized);return n.conditionOptions=n.conditionOptions.map((e=>({...e,id:`${l},${e.id}`}))),De=[...De,{id:o,idOther:i,...n}],n.conditionalField?{...e,id:o,idOther:i,option_set_id:t,conditions_serialized:n}:{...e,id:o,idOther:i,option_set_id:t,conditions_serialized:{}}}return De=[...De,{id:o,idOther:i}],{...e,id:o,idOther:i,option_set_id:t,conditions_serialized:{}}}));p.length&&(Ve=[...p]),e&&t&&t.removeAttribute("novalidate"),t?.addEventListener("submit",(function(){n?va(La(t,i),t):La(t,i)}));let d=document.createElement("div");if(d.classList.add("tpo_option-set-container"),Ci?.optionsSpacing&&d.style.setProperty("--options-spacing",`${Ci.optionsSpacing}px`),Si&&Si?.customCss){const e=document.createElement("style");e.innerHTML=Si?.customCss,d.prepend(e)}if(wi){const{appTheme:e,appMode:t}=wi||{},o=document.querySelector(".tpo_option-set-wrapper");o?.setAttribute("data-tpo-theme",e??""),o?.setAttribute("data-tpo-mode",t??""),document.body.setAttribute("data-tpo-theme",e??""),document.body.setAttribute("data-tpo-mode",t??""),document.body.setAttribute("data-tpo-custom-style",""),t&&"dark"===t&&document.body.setAttribute("data-tpo-dark-mode","")}const u=[...new Set(Object.values(JSON.parse(Ao)).map((e=>e.fontFamily)).filter((e=>e)))];if(u&&u.length>0){const e=document.createElement("div");e.id="list-unique-fonts";for(const t of u){const o=document.createElement("link");o.rel="stylesheet",o.href="https://fonts.googleapis.com/css2?family="+t.replaceAll(" ","+"),e.appendChild(o)}d.prepend(e)}Object.assign(d,{id:"tpo_option-set-container"+(void 0!==l?`-${l}`:"")});let m=p.map((e=>ia(e,p,t,o,i,void 0,l,n,p)));d.append(...m);const f=function(){if(!Ut)return document.createElement("div");const e=document.createElement("input");return Object.assign(e,{name:"properties[_tpo_active_currency]",value:Qt,type:"hidden"}),e}(),y=function(){if(!Ut)return document.createElement("div");const e=document.createElement("input");return Object.assign(e,{name:"properties[_tpo_currency_rate]",value:Rt,type:"hidden"}),e}();let g=t?.attributes.id?.value||null;if(f.setAttribute("form",g),y.setAttribute("form",g),d.append(f),d.append(y),bi){const e=function(){const e=document.createElement("input");return Object.assign(e,{id:"easify-mark-input",name:"properties[_tpo_add_by]",value:"easify",type:"hidden",disabled:!0}),e}();e.setAttribute("form",g),d.append(e)}Qn(t,e);let b=function(e){return _?e.filter((e=>!(!e.conditions_serialized||!e.conditions_serialized.conditionOptions)&&e.conditions_serialized.conditionOptions.some((e=>e.id.includes("variant"))))):null}(p);return b&&b.length>0&&!K&&(function(e,t){if(!_)return;let o=window.location.href.match(/variant=(\d+)/),i=o?o[1]:h.variants.find((e=>e.available)).id.toString(),n=meta.product.variants;const a=n.find((e=>e.id.toString()===i))||n[0];Nr(e,t,a?.public_title?.toLowerCase()||""),Ha()}(p,d),Ar(p,d,o)),n&&o.addEventListener("click",(async function(n){if(o.type="button",La(t,i)){o.dataset.tpoValidate=!0;let i=n.target.innerHTML;"oppastore-rashmi.myshopify.com"!==Q&&(n.target.innerHTML='
'),n.target.disabled=!0;let a=!1;try{let i=c?.items||[],n=t;"FORM"!==t?.tagName&&(n=t.querySelector($)||t.querySelector("form")),a=await Xn(e,n,o,null,null,null,i),document.dispatchEvent(new CustomEvent("tpo_product_added"))}catch(n){console.error(n)}finally{"oppastore-rashmi.myshopify.com"!==Q&&(n.target.innerHTML=i),n.target.disabled=!1}setTimeout((async()=>{await dr(),await Qn(t,e),await easifyHandleUpdateCartWithAddonProduct(),await Za(),await Xa(),Un()}),1e3),a&&n.stopImmediatePropagation()}else n.stopPropagation(),o.dataset.tpoValidate=!1,setTimeout((()=>{const e=Array.from(document.querySelectorAll(".tpo_error-message:not(:empty)"));for(let t=e.length-1;t>=0;t--){const o=e[t],i=o.parentElement.parentElement.parentElement,n=i.parentElement.parentElement;i.classList.contains("tpo_option-group_child-wrapper")?n.classList.contains("tpo_hidden")||(i.parentElement.classList.contains("show")||i.parentElement.classList.add("show"),i.hidden=!1,o.scrollIntoView({behavior:"smooth",block:"center",inline:"center"})):o.parentElement.parentElement.classList.contains("tpo_hidden")||o.scrollIntoView({behavior:"smooth",block:"center",inline:"center"})}}),0),Zr(t)||Yr(ei)})),o.dataset.isRenderOptionSet="true",d}function ia(e,t,i,n,a,r=!1,c,p,d=[]){const u=c,m=t;let _=i?.attributes.id?.value||null;m?.length&&(to[e.option_set_id]&&to[e.option_set_id].length?to[e.option_set_id].length{const n=JSON.parse(T||"{}").type_letter;e.value=function(e,t){switch(e){case"lowercase":return t.toLowerCase();case"uppercase":return t.toUpperCase();case"capitalize_each_word":return t.toLowerCase().replace(/(^|\s)([a-zA-Z\u00C0-\u1EF9])/g,(e=>e.toUpperCase()));case"sentence_case":return t.charAt(0).toUpperCase()+t.slice(1).toLowerCase();default:return t}}(n,o?.default_value||""),o?.default_value&&e.dispatchEvent(new Event("blur")),window.addEventListener("reloadValueOnTextField",(e=>{const n=e.detail.formElement,a=n.querySelector(`#${t}-${o.option_id}`);a.value=i||"",a.dispatchEvent(new Event("input")),n.querySelectorAll(".tpo_error-message.tpo_undefined").forEach((e=>{e.textContent="",e.removeAttribute("data-error")}))}))};let ce=document.createElement("div");"SHOW"===k.action?(Object.assign(ce,{id:`${O},${v}`,className:`tpo_option-container tpo_hidden tpo_flex-${se} tpo_option-container-${ee}-${v}`}),gs(O,"hide",x),Nt=[...Nt,`${O},${v}`]):Object.assign(ce,{id:`${O},${v}`,className:`tpo_option-container tpo_flex-${se} tpo_option-container-${ee}-${v}`}),At=[...At,`${O},${v}`];let pe=document.createElement("div");Object.assign(pe,{className:"tpo_option-label",innerHTML:`\n
\n \n ${b}\n \n ${y?"*":""}\n
\n \n ${Yi?'\n \n ':'\n \n '}\n \n
\n
`});let de,ue,me=document.createElement("div");Object.assign(me,{className:(e=>"text-box"===e?"tpo_option-label text-box":"tpo_option-label")(e.type),innerHTML:`\n
\n \n ${b}\n \n ${y?"*":""}\n
\n \n ${Yi?'\n \n ':'\n \n '}\n \n
\n
\n `});let _e="";1!==q&&function(e,t){if(!Array.isArray(t)||t.length<1)return;let o=t[0].additional_price||0,i=!1;for(const e of t)e.additional_price!==o&&(null!==e.additional_price?(i=!0,e.additional_price(+${i?l.From&&l.From[s]||"from":""} ${n})\n `,pe.firstElementChild.firstElementChild.innerHTML+=`\n (+${i?l.From&&l.From[s]||"from":""} ${n})\n `)}(0,h);let fe=document.createElement("input"),ye=y?g?`${g} *`:l["Please select"]&&l["Please select"][s]||"Please select":g||l["Please select"]&&l["Please select"][s]||"Please select",{useUrl:he=!1,separateAddOnProduct:ge=!1}=JSON.parse(T||"{}");Object.assign(fe,{className:`tpo_option-input tpo_${ki.fontStyle} ${Xt?"tpo_compatible_dropdown_theme":""}`,disabled:!1,placeholder:ye,type:"text",name:he?"":`properties[${ge?"_":""}${E}]`,ariaLabel:E}),_&&fe.setAttribute("form",_),fe.style.fontSize=`${ki.fontSize}px`,ki?.fontFamily&&(fe.style.fontFamily=`${ki.fontFamily}, san-serif`),fe.style.color=vi?.optionValueColor??ki.fontColor;const be=document.createElement("span");be.style=`color: ${vi?.selectedOptionValueColor??Hi?.fontColor}; ${Hi?.fontFamily?`font-family: ${Hi?.fontFamily};`:""} font-size: ${Hi.fontSize}px;`;const ve=me.querySelector(".tpo_option-label-container .form__label");Object.assign(be,{className:"tpo_selected_values_span "+(Hi?.fontStyle?`tpo_${Hi.fontStyle}`:"")}),ve.append(be);let we=document.createElement("div"),Se=document.createElement("div");Object.assign(Se,{className:`tpo_option-help-text tpo_${Li.fontStyle}`,innerHTML:`\n ${w}\n `}),Se.style.fontSize=`${Li.fontSize}px`,Se.style.color=vi.helpTextColor??Li.fontColor,Li?.fontFamily&&(Se.style.fontFamily=Li.fontFamily);let Ee=document.createElement("div");function $e(e){ce.contains(Ee)||me.append(Se,Ee);let t=te.except_number,o=te.except_special_characters,i=te.except_spaces,n=te.except_letters,a=/ \[ \+(.*) \]/,r=e.match(a),s=e.trim();return(e=r?e.replace(a,""):e)||y?e&&0===s.length&&y?(me.setAttribute("data-error",""),Ee.innerHTML=_o?ba(_o,""):"This is a required field",!1):(me.setAttribute("data-error",""),e.length<1&&y?(Ee.innerHTML=_o?ba(_o,""):"This is a required field",!1):e.length&&t&&/\d/.test(e)?(Ee.innerHTML=go?ba(go,""):"Numbers are not allowed",!1):e.length&&n&&/\p{L}/gu.test(e)?(Ee.innerHTML=wo?ba(wo,""):"Letters are not allowed",!1):e.length&&i&&/\s/.test(e)?(Ee.innerHTML=bo?ba(bo,""):"Spaces are not allowed",!1):e.length&&o&&/[^a-zA-Z0-9\s\u0600-\u06FF\u00C0-\u1EF9\u0590-\u05FF]/.test(e)?(Ee.innerHTML=vo?ba(vo,""):"Special characters are not allowed",!1):$&&e.length<$?(Ee.innerHTML=yo?ba(yo,$):`Please type at least ${$} characters`,!1):C&&e.length>C?(Ee.innerHTML=ho?ba(ho,C):`Please type at maximum ${C} characters`,!1):(me.removeAttribute("data-error"),Ee.innerHTML="",!0)):(me.removeAttribute("data-error"),Ee.innerHTML="",!0)}function Ce(e){let t=e?e.split(/[.,\s]+/).length:0;return y&&y&&t<1?(Ee.innerHTML=fo?ba(fo,""):"This is a required option",e||!1):(Ee.innerHTML="",e)}function xe(e,t,o){if(o){let i=PriceFormatter.formatMoney(parseFloat(100*o),!0),n=t.toString();n.endsWith("]")||(n+="]");let a=/\[ \+(.*) \]/,r=n.match(a);t&&(e.value=r?t.toString().replace(r[0],`[ +${i} ]`):`${t} [ +${i} ]`)}else e.value=!0===t?"":t}function ke(e,t){let o=0;if(t&&t.length)for(let i=0;i=n.min&&e<=n.max&&(o=n.value):e>=n.min&&(o=n.value)}return parseFloat(o.toFixed(2))}switch(Object.assign(Ee,{className:`tpo_error-message tpo_${Oi.fontStyle}`,innerHTML:""}),Ee.style.fontSize=`${Oi.fontSize}px`,Ee.style.color=vi.errorMessageColor??Oi.fontColor,Oi?.fontFamily&&(Ee.style.fontFamily=Oi.fontFamily),i.dispatchEvent(new Event("change")),v){case"dropdown":let rt;fe.classList.add("tpo_option-dropdown"),fe.autocomplete="off",fe.onkeydown=function(){return!1},fe.readOnly=!0,fe.dataset.required=y,fe.style.borderColor=vi.dropdownMenu_border??zi.borderColor,fe.style.backgroundColor=vi.dropdownMenu_background??zi.background,pe.querySelector(".tpo_option-label-container .form__label").append(be),n.type="button",n.addEventListener("click",(function(){Ne(fe.value)})),pe.classList.add("tpo_dropdown"),Object.assign(we,{className:"tpo_option-type-dropdown-wrapper has-scroll "+(e.is_search_dropdown?"has-search":""),hidden:!0}),we.style.setProperty("--dropdownMenu-background",vi.dropdownMenu_background||zi.background||"");let st=document.createElement("div");1===V?Object.assign(st,{className:"tpo_color-swatches-wrapper"}):0===V&&(st=document.createElement("img"),Object.assign(st,{className:`tpo_dropdown-image-wrapper tpo_image_shape_${I||"square"}`,src:""}));let lt=document.createElement("div");1===V?Object.assign(lt,{className:"tpo_color-swatches-wrapper"}):0===V&&(lt=document.createElement("img"),Object.assign(lt,{className:`tpo_dropdown-image-wrapper tpo_image_shape_${I||"square"}`,src:""}));let ct=[...h],pt=Ki?"#FFFFFFF2":"#C0C0C0",dt=document.createElement("div");Object.assign(dt,{className:"tpo_dropdown-search-wrapper "+(e.is_search_dropdown?"":"hidden"),innerHTML:`\n \n \n \n `});const ut=vi.inputText_enteredValue??Ai.fontColor??(Ki?"#FFFFFFF2":"#000000");dt.style.setProperty("--color-input-text",ut);let mt=document.createElement("input");Object.assign(mt,{className:"tpo_dropdown-search-input",placeholder:l["Type to search options"]?.[s]||"Type to search options",oninput:t=>{const o=t.target.value.trim();if(dt&&(o?dt.classList.add("active"):dt.classList.remove("active")),o){const e=o.toLowerCase();ct=[...h].filter((t=>{const o=t.label.toLowerCase();let i=0;for(let t=0;t \n ",onclick:e=>{document.querySelectorAll(".tpo_option-type-dropdown-wrapper").forEach((e=>{e!==we&&(e.hidden=!0)})),document.querySelectorAll(".tpo_option-input-wrapper-dropdown").forEach((e=>{e!==_t&&e.classList.remove("show")})),we.hidden=!we.hidden,_t.classList.toggle("show")}}),ft.style.setProperty("--active-dropdown-border",vi.dropdownMenu_border||""),ft.style.setProperty("--dropdownMenu-background",vi.dropdownMenu_background??(zi.background||"")),ft.style.setProperty("--dropdown-border-radius",`${$i.dropdownBorderRadius}px`);let yt=document.createElement("span");Object.assign(yt,{className:"tpo_additional-price absolute active"}),Rr(Y,yt,h);let ht=document.createElement("button");function Le(e,t){Mt&&(fe.dataset.printBox=JSON.stringify([{printBoxName:e,printBoxValue:t}]))}if(Object.assign(ht,{className:"tpo_option-type-selection tpo_option-type-selection--empty hidden",innerHTML:l["No results found"]&&l["No results found"][s]||"No results found"}),ce.append(pe),ft.append(fe),_t.append(ft),re.enable&&(re.configs.showTotalSelected?_e="exact_count":re.configs.isShowNewTotalSelected?_e=re.configs.isUseMinMaxSelected?"min_max_count":"only_total":re.configs.isUseMinMaxSelected&&(_e="min_max_not_count")),re.enable&&_e){let{totalQuantitySelectorElementWrapperRender:vr,errorTotalElementRender:Sr}=Fr(re,Lo,_e);de=vr,ue=Sr}function qe(e=0,t="",o=0){let n=0;if((!t||1===o)&&fe.value){let e=fe.value.includes("[")?fe.value.split("["):fe.value.split("|");const o=h.find((t=>`${t.label} `===e[0]));t=o?.label||"",n=o?.additional_price}const r=ce.querySelector(".tpo_quantity-selector_wrapper").querySelector("input").value;if(fe.value&&r>0)if(e){let o=PriceFormatter.formatMoney(parseFloat(100*e),!0);fe.value=`${t} [ +${o} ] | ${r}`}else if(n){let o=PriceFormatter.formatMoney(parseFloat(Number(n)*Number(r)*100),!0);e=parseFloat(Number(n)*Number(r)),fe.value=`${t} [ +${o} ] | ${r}`}else fe.value=`${t} | ${r}`;else r<=0&&(fe.value="");const s=re.configs;_e&&$r(ce,0,s,ue),wa(Xi,yt,e),va(La(i,a),i)}if(re.enable){const Er=re.configs,qr=re.enable,{quantitySelectorContainer:Or}=qr?function(e,t,o,i,n){const{showTotalSelected:a=!1,hasLimitations:r=!1,minValue:s=1,maxValue:l=1,limitTotalSelected:c=0,isUseCustomIncrement:p=!1,customIncrementValue:d=1,isUseMinMaxSelected:u=!1,minValueTotal:m=1,maxValueTotal:_=1,isShowNewTotalSelected:f=!1}=e,{activeBorderColor:y="",fontFamily:h,fontStyle:g,fontSize:b=0,widthQuantity:v=0}=n,w=document.createElement("div");Object.assign(w,{className:"tpo_quantity-selector_wrapper swatches-not-avaliable"}),w.style.width=Ei?.quantitySelectorWidth?`${Ei.quantitySelectorWidth}px`:"",w.style.border=vi?.quantitySelectorBorder_unselected?`1px solid ${vi.quantitySelectorBorder_unselected}`:"",w.style.borderRadius=$i?.quantitySelectorBorderRadius?`${$i.quantitySelectorBorderRadius}px`:"",w.style.setProperty("--active-quantitySelector-border",vi.quantitySelectorBorder_selected||""),w.style.width=v?`${v}px`:void 0,w.style.border=v?`2px solid ${y}`:void 0;const S=document.createElement("input");Object.assign(S,{className:`tpo_quantity-selector_input tpo_${g}`,id:`${i},dropdown,quantity_selector`}),h&&(S.style.fontFamily=h),S.style.fontSize=Number(b)>=10?`${b}px`:"14px",S.value=1,p&&Number(d)>1&&(S.value=Number(d),S.readOnly=!0);const E=document.createElement("span");Object.assign(E,{className:"tpo_quantity-selector_minus",innerHTML:"-",onclick:()=>xr(S,(()=>{}),e)});const $=document.createElement("span");Object.assign($,{className:"tpo_quantity-selector_plus",innerHTML:"+",onclick:()=>kr(S,e)});let C=document.createElement("div");Object.assign(C,{className:`tpo_error-message tpo_${Oi.fontStyle}`,innerHTML:""}),C.style.fontSize="11px",C.style.color="#D82C0D",S.addEventListener("change",(e=>{r&&(Lr(e.target,s,l,C)?w.classList.remove("tpo-error_validate"):w.classList.add("tpo-error_validate"));let i=e.target.value;if(/^(?!00)\d+|0$/.test(i))if(i=parseFloat(i||0),o(),t){const e=Number(t)*i;o(e,i,1)}else o(0,i,1)})),e.optionDefaultQuantityValue&&setTimeout((()=>{S.value=e.optionDefaultQuantityValue,S.dispatchEvent(new Event("change"))}),0),w.append(E,S,$);let x=document.createElement("div");return Object.assign(x,{className:"dropdown-quantity-selector_wrapper"}),x.append(w,C),{quantitySelectorContainer:x}}(Er,L,qe,O,Mi):{quantitySelectorContainer:null};rt=Or}function Te(e,t,o,n,r,s,l){if(function(e,t,o){if(J||R)if(1===V){if(!t[0]||3===o)return st.innerHTML="",void(lt.innerHTML="");let e=2===o&&t[1]?``:"",i=``;st.innerHTML=i,lt.innerHTML=i}else 0===V&&(st.src=e,lt.src=e)}(n===ao||n===ro?"":n,s,l),Na(m,`${O},${v}`,v,o,0,null,e),ls(0===x?O:o,r||n,!0),fe.value=e,B&&Tr(be,fe.value),Ne(e),xe(fe,e,t),wa(Xi,yt,t),p?va(La(i,a),i):La(i,a),re.enable){qe(t,e,yt),function(e,t){const o=ce.querySelector(".tpo_quantity-selector_wrapper"),i=o.querySelector("input").value,n=o.querySelector("input");n&&n.dispatchEvent(new Event("change")),i?qe(e?e*Number(i):0,t):(o.querySelector("input").value=1,qe(e?1*e:0,t))}(t,e);const o=ce.querySelector(".tpo_quantity-selector_wrapper");if(c=e?"enable":"disable",(d=o)&&("enable"===c?(d.classList.remove("swatches-not-avaliable"),d.querySelector("input").disabled=!1):"disable"===c&&(d.classList.add("swatches-not-avaliable"),d.querySelector("input").disabled=!0)),_e){const e=re.configs;$r(ce,0,e,ue)}}var c,d}function Oe(e,t){Na(m,`${O},${v}`,v,e,0,null,t)}function Ae(){we.hidden=!0,_t.classList.remove("show"),Ne(fe.value)}function Ne(e){return ce.contains(Ee)||pe.append(Se,Ee),!y||(e.length<1?(Ee.innerHTML=fo?ba(fo,""):"This is a required option",!1):(Ee.innerHTML="",!0))}document.addEventListener("click",(function(e){const t=!e.target.closest(".tpo_dropdown_image_input_wrapper ")&&!e.target.classList.contains("tpo_option_type_tooltip_wrapper"),o=_t.classList.contains("show");t&&o&&Ae()}));let gt=document.createElement("div");if(Object.assign(gt,{className:"tpo_dropdown_image_input_wrapper "+(re.enable?"dropdown_qty_selector":"")}),oe){const{dimensionId:Ar,formula:Nr,tablePricing:Pr}=Ur(e,d);Ar&&(e.dimensionId=Ar),Nr&&(e.dimensionFormula=Nr),Pr&&(e.tablePricing=Pr)}pe.append(gt),rt&>.append(rt);let bt=h.map(((t,o)=>function(e,t,o,i,n,a,r,c,p,d,u,m,_,f,y,h){_&&(o.additional_price=0,o.variant_id="");let{label:g,is_default:b,additional_price:v=null,id:w,number_color:S,color_code:E="",image_url:$,image_canvas_url:C,image_id:x,product_id:k,variant_id:L,metadata:q="{}"}=o||{};E||(E=",");const T=E?.split(","),O=u?.image_color??0,A=JSON.parse(q||"{}"),N=A.printBoxName?A.printBoxName:"",P=A.printBoxValue?A.printBoxValue:"",M=A.url||"";let F=M.startsWith("/")||M.startsWith("http")?M:`https://${M}`;const j=A.description||"",I=ga(A.tooltip||"");let H={};const B=u.is_change_label,z=JSON.parse(u.metadata||"{}");let{useUrl:V=!1,openLinkBehavior:U="new_tab",separateAddOnProduct:J=!1,descriptionPosition:R="below_value"}=z;const W="new_tab"===U?"_blank":"_self";F=zr(V,F),L&&vn.forEach((e=>{e.variants.forEach((t=>{`${t.id}`===L&&(H={...e,variants:[{...t}]},B||(o.label="Default Title"===t?.title?t?.name:t?.title,g=o.label))}))}));const Q=void 0===H?.variants||H.variants[0].available;H?.variants&&(v=H.variants[0].price/100);let G=l["SOLD OUT"]&&l["SOLD OUT"][s]||"SOLD OUT";if(Q||(o.label=`${g} - ${G}`,g=o.label),"hide"===D?.outStockOptions&&!Q)return"";let X=Dr(V,F);if(b&&Q||X){if(_){const e=parseFloat(A.dimensionPrice||0)*Rt;i(g,Jr(u,f,e),w,$,C,T,S)}else i(g,v,w,$,C,T,S);f.dataset.selectedIndex=y,L&&(f.dataset.productId=k,f.dataset.variantId=L),m(N,P),c&&Ya(g),r(w,g),"FORM"===e.tagName&&setTimeout((function(){p?va(La(e,t),e):La(e,t)}),500)}let Z,Y=document.createElement("span");Object.assign(Y,{className:"tpo_additional-price "+(0!==a?"":"tpo_hidden")});let K=jr({imageOrColor:O,numberColor:S,swatchShape:h,colorCodes:T,imageUrl:$,product:H,label:g});return V?(Z=document.createElement("a"),Object.assign(Z,{id:`tpo_option-type-selection-${w}`,className:`tpo_option-type-selection ${R} tpo_image_shape_${h||"square"} tpo_${ki.fontStyle}`,innerHTML:`\n ${K||""}\n
\n ${g}\n ${j?ha(j,"below_value").outerHTML:""}\n
\n ${j?ha(j,"below_image").outerHTML:""}\n `,href:F,target:W})):(Z=document.createElement("button"),Object.assign(Z,{id:`tpo_option-type-selection-${w}`,className:`tpo_option-type-selection ${R} tpo_image_shape_${h||"square"} tpo_${ki.fontStyle} ${Q?"":"not-avaliable out_stock_label"} ${1===O?"tpo_color":""}`,innerHTML:`\n ${K||""}\n
\n ${g}\n ${j?ha(j,"below_value").outerHTML:""}\n
\n ${j?ha(j,"below_image").outerHTML:""}\n `,type:"button",onclick:e=>{if(Q){if(e.stopPropagation(),_){const e=parseFloat(A.dimensionPrice||0)*Rt;i(g,Jr(u,f,e),w,$,C,T,S)}else i(g,v,w,$,C,T,S);f.dataset.selectedIndex=y,L?(f.dataset.productId=k,f.dataset.variantId=L):(f.dataset.productId="",f.dataset.variantId=""),m(N,P),c&&Ya(g),r(w,g),n()}else e.preventDefault()}})),Z.style.fontSize=`${ki.fontSize}px`,Z.style.color=vi.optionValueColor??ki.fontColor,ki?.fontFamily&&(Z.style.fontFamily=`${ki.fontFamily}`),_?(setTimeout((()=>{const e=parseFloat(A.dimensionPrice||0)*Rt,t=Jr(u,f,e);wa(Xi,Y,t)}),500),Z.addEventListener("updateDimensionPricing",(function(){const e=f.dataset.selectedIndex,t=parseFloat(A.dimensionPrice||0)*Rt,o=Jr(u,f,t);wa(Xi,Y,o),void 0!==e&&parseInt(e)===y&&i(g,o,w,$,C,T,S)}))):wa(Xi,Y,v),Z.querySelector(".tpo_option_type_label_wrapper").append(Y,I),window.addEventListener("searchInputDropdown",(e=>{const{optionTypesBySearch:t,id:o,option:i,optionTypeWrapper:n}=e.detail,a=`${i.idOther}-${i.type}`,r=n.querySelector(".tpo_option-type-selection--empty");if(a!==o)return;const s=t.find((e=>e.id===w));s?Array.from(document.querySelectorAll(`.tpo_option-container-${a} #tpo_option-type-selection-${w}`)).forEach((e=>e.style.display="flex")):Array.from(document.querySelectorAll(`.tpo_option-container-${a} #tpo_option-type-selection-${w}`)).forEach((e=>e.style.display="none")),t.length?r.classList.add("hidden"):r.classList.remove("hidden")})),Z}(i,a,t,Te,Ae,q,Oe,H,p,0,e,Le,oe,fe,o,I)));we.append(...bt),we.append(ht),_t.append(ft,we,yt),de&&pe.append(de),ue&&de&&pe.append(ue),rt?gt.insertBefore(_t,rt):gt.append(_t),J&&2!==V&>.prepend(st),R&&ft.prepend(lt),pe.append(Se),ce.contains(Ee)||pe.append(Ee);break;case"radio-buttons":Object.assign(we,{className:"tpo_radio-buttons-wrapper "+(U&&1!==U?`tpo-grid-${U}`:"")}),n.type="button",n.addEventListener("click",(function(){Pe()}));let vt=document.createElement("input");Object.assign(vt,{className:"tpo_hidden-checkbox",value:"",name:`properties[${ge?"_":""}${E}]`,ariaLabel:E}),ce.append(me),vt.dataset.required=y,_&&vt.setAttribute("form",_);let wt=document.createElement("span");function Pe(){if(ce.contains(Ee)||me.append(Se,Ee),!y)return!0;let e=!!vt.value,t=Array.from(document.querySelectorAll(`input[name='properties[${E}]']`));for(const o of t)if(o.checked){e=!0;break}return e?(Ee.innerHTML="",!0):(Ee.innerHTML=fo?ba(fo,""):"This is a required option",!1)}if(Object.assign(wt,{className:"tpo_additional-price absolute active"}),Rr(Y,wt,h),oe){const{dimensionId:Hr,formula:Br,tablePricing:Wr}=Ur(e,d);Hr&&(e.dimensionId=Hr),Br&&(e.dimensionFormula=Br),Wr&&(e.tablePricing=Wr)}let St=h.map(((t,o)=>_a(i,a,t,E,0,o,Pe,vt,wt,xe,q,Me,H,u,p,z,F,e,I,we,re,Cr,ce,0,oe)));function Me(e){Na(m,`${O},${v}`,v,e)}we.append(...St,vt,wt),me.append(we,Se),ce.contains(Ee)||me.append(Ee),ce.append(me);const Et=St.map((e=>"string"!=typeof e?e.querySelector(".tpo_radio-button"):null));vt.addEventListener("change",(function(){Vr(vt,Et)}));break;case"switch":const Ct=JSON.parse(T||"{}");Object.assign(we,{className:"tpo_option-input-wrapper switch"});let xt=document.createElement("span");Object.assign(xt,{className:"tpo_additional-price absolute"});let kt,Lt=document.createElement("input");Object.assign(Lt,{className:"tpo_hidden-checkbox",name:`properties[${E}]`,value:"",ariaLabel:E}),_&&Lt.setAttribute("form",_),Ct&&Ct?.switchImageUrl&&(ce.classList.add("tpo_switch-image"),f&&ce.classList.add("tpo_switch-label_hidden-with_image"),kt=document.createElement("img"),Object.assign(kt,{className:`tpo_switch-image_image-content tpo_shape_${I||"radius"}`,src:`${Ct?.switchImageUrl}"`}));let qt=e?.option_types[0]?.additional_price,Pt=L;qt&&(Pt=qt),wa(Xi,xt,Pt);let Ft=fa({formElement:i,quantityInput:a,option:e,isRequired:y,additionalPriceSwitch:xt,addToCartElement:n,handleAddPriceToProperties:xe,handleChangeValuesSwitch:function(e){Na(m,`${O},${v}`,v,e)},inputForSwitchValues:Lt,renderForProductPage:p,switchImageElement:kt});we.append(Lt,Ft,xt),me.append(we,Se,Ee),kt&&!f?ce.append(kt,me):ce.append(me);break;case"text-box":const jt=e?.default_value||"";Object.assign(we,{className:"tpo_option-input-wrapper"});let It=document.createElement("span");Object.assign(It,{className:"tpo_additional-price absolute"});let Ht=document.createElement("span");Object.assign(Ht,{className:"tpo_character-count absolute"}),"one"===M&&wa(Xi,It,L);let Bt=function(e,t,o,i,n,a,r,s,l,c,p,d,u,m,_,f,y){const{type:h,is_required:g,option_id:b,id:v,option_identifier:w,placeholder:S="",min_value:E,max_value:$,price_type:C,live_preview_transform:x}=e,k=JSON.parse(d||"{}").type_letter;let{label:L="",additional_price:q=null,product_id:T,variant_id:O}=_||{};const A=JSON.parse(d||"{}"),N=A.printBoxName?A.printBoxName:"",P=A.printBoxValue?A.printBoxValue:"",M=A.character_count?parseInt(A.character_count):0;let F=$||(1===M?200:$);function j(e){Mt&&(D.dataset.printBox=JSON.stringify([{printBoxName:N,printBoxValue:ba(P,e)}]))}let I={};O&&vn.forEach((e=>{e.variants.forEach((t=>{`${t.id}`===O&&(I={...e,variants:[{...t}]},_.label="Default Title"===t?.title?t?.name:t?.title,L=_.label)}))})),I?.variants&&(s=I.variants[0].price/100);const H=d&&JSON.parse(d)?.rangesPrice||[];JSON.parse(_?.metadata||"{}").hasOwnProperty("min_text_length")&&(H.length=0),e.option_types.forEach((e=>{const t=JSON.parse(e.metadata||"{}");t.hasOwnProperty("min_text_length")&&t.hasOwnProperty("max_text_length")&&H.push({min:t.min_text_length,max:t.max_text_length,value:e.additional_price})}));const B=!!d&&JSON.parse(d).priceNotSpace;let D=document.createElement("input");if(D.addEventListener("input",(function(e){if(k&&(D.value=y(k,e.target.value),e.target.value=D.value),c(e.target.value),hs(v,"id",e.target.value,!0,"TEXT"),1===M){let t=e.target.value.length;f.innerHTML=`\n ${t}\n /${F}`}let o=n(D.value);u(!1!==o&&""!==o&&Xi,a,s,e.target.value,C,H,B),e.target.value?a.classList.add("active"):a.classList.remove("active"),p?va(La(t,i),t):La(t,i),j(D.value)})),D.addEventListener("blur",(function(){let e=n(D.value);!1!==e&&""!==e?(u(Xi,a,s,D.value,C,H,B),e&&m(D,D.value,s,C,H,B)):u(!1,a,s,D.value,C,H,B)})),D.addEventListener("focus",(function(){let e=/ [\[(] \+(.*) [)\]]/,t=D.value.match(e);D.value=t?D.value.replace(e,""):D.value})),D.addEventListener("keypress",(function(e){"Enter"===e.key&&e.preventDefault()})),Object.assign(D,{className:`tpo_option-input tpo_text-box tpo_${Ai.fontStyle}`,type:"text",name:`properties[${w}]`,id:`${h}-${b}`,placeholder:S,value:y(k,e?.default_value||""),ariaLabel:w}),D.dataset.required=g,o&&D.setAttribute("form",o),D.style.fontSize=`${Ai.fontSize}px`,Ai?.fontFamily&&D.style.setProperty("--entered-input-fontFamily",`${Ai.fontFamily}`||""),D.style.setProperty("--entered-input-text",vi.inputText_enteredValue||Ai.fontColor||""),D.style.backgroundColor=vi.inputBackground_unselected??Bi.background,D.style.borderColor=vi.inputBorder_unselected??Bi.borderColor,D.style.borderRadius=`${$i.inputBorderRadius}px`,D.style.setProperty("--active-input-border",vi.inputBorder_selected||Bi.activeBorderColor||""),D.style.setProperty("--placeholder-input-text",vi.inputText_placeholder||""),D.style.setProperty("--active-input-background",vi.inputBackground_selected||""),1===M){let t=e?.default_value?.length||0;window.addEventListener("reloadValueOnTextField",(e=>{t=D.value.length})),f.innerHTML=`\n ${t}\n /${F}`,D.style.paddingRight="75px"}return l.type="button",l.addEventListener("click",(function(){let e=n(D.value);!1!==e&&""!==e&&La(t,i)?(u(Xi,a,s,D.value,C,H,B),e&&m(D,D.value,s,C,H,B)):u(!1,a,s,D.value,C,H,B)})),j(D.value),D}(e,i,_,a,$e,It,0,L,n,Fe,p,T,(function(e,t,o,i,n,a,r){switch(n){case"one":if(!e||o<=0)t.innerHTML="";else{let e=PriceFormatter.formatMoney(parseFloat(100*o),!1),n=i.toString();if(n&&n.endsWith("]")){const e=n.indexOf("[");n=n.slice(0,e-1).trim()}i.toString()!==n?(e=PriceFormatter.formatMoney(parseFloat(100*o),!0),t.innerHTML=`(+${e})`):t.innerHTML=`(+${e})`}break;case"per_letter":if(!e||o<=0)t.innerHTML="";else if(r){let e=i.toString();if(e&&e.endsWith("]")){const t=e.indexOf("[");e=e.slice(0,t)}const n=e.replaceAll(" ","");let a=PriceFormatter.formatMoney(parseFloat(n.length*o*100),!1);t.innerHTML=`(+${a})`}else{let e=PriceFormatter.formatMoney(parseFloat(i.length*o*100),!1),n=i.toString();if(n&&n.endsWith("]")){const e=n.indexOf("[");n=n.slice(0,e-1).trim()}i.toString()!==n?(e=PriceFormatter.formatMoney(parseFloat(n.length*o*100),!0),t.innerHTML=`(+${e})`):t.innerHTML=`(+${e})`}break;case"quantity_letter":if(e&&JSON.stringify(a)!==JSON.stringify({})){let e="",o=i.toString();if(o&&o.endsWith("]")){const e=o.indexOf("[");o=o.slice(0,e-1).trim()}let n="";r&&(n=o.replaceAll(" ",""));const s=ke(n?n.length:o.length,a);if(s){if(e=PriceFormatter.formatMoney(parseFloat(100*s),!1),o&&o.endsWith("]")){const e=o.indexOf("[");o=o.slice(0,e-1).trim()}t.innerHTML=`(+${e})`}else t.innerHTML=""}else t.innerHTML=""}}),(function(e,t,o,i,n,a){if("quantity_letter"!==i)if(o){let n="",r=t.toString();if(r&&r.endsWith("]")){const e=r.indexOf("[");r=r.slice(0,e-1).trim()}switch(i){case"one":n=PriceFormatter.formatMoney(parseFloat(100*o),!1);break;case"per_letter":if(a){const e=r.replaceAll(" ","");n=PriceFormatter.formatMoney(parseFloat(e.length*o*100),!1)}else n=PriceFormatter.formatMoney(parseFloat(r.length*o*100),!1)}let s=t.toString();s.endsWith("]")||(s+="]");let l=/\[ \+(.*) \]/;s.match(l),t&&(e.value=`${r} [ +${n} ]`)}else{let o=t.toString();if(o&&o.endsWith("]")){const e=o.indexOf("[");o=o.slice(0,e-1).trim()}e.value=o}else if(JSON.stringify(n)!==JSON.stringify({})){let o="",i=t.toString();if(i&&i.endsWith("]")){const e=i.indexOf("[");i=i.slice(0,e-1).trim()}let r="";a&&(r=i.replaceAll(" ",""));const s=ke(r?r.length:i.length,n);if(s){o=PriceFormatter.formatMoney(parseFloat(100*s),!1);let n=t.toString();n.endsWith("]")||(n+="]");let a=/\[ \+(.*) \]/;n.match(a),t&&(e.value=`${i} [ +${o} ]`)}else e.value=i}else{let o=t.toString();if(o&&o.endsWith("]")){const e=o.indexOf("[");o=o.slice(0,e-1).trim()}e.value=o}}),h[0],Ht,(function(e,t){switch(e){case"lowercase":return t.toLowerCase();case"uppercase":return t.toUpperCase();case"capitalize_each_word":return t.toLowerCase().replace(/(^|\s)([a-zA-Z\u00C0-\u1EF9])/g,(e=>e.toUpperCase()));case"sentence_case":return t.charAt(0).toUpperCase()+t.slice(1).toLowerCase();default:return t}}));if(le(Bt,"text-box",e,jt),e?.default_value){const Qr=e.default_value;Fe(Qr);const Gr=$e(Qr);!1!==Gr&&""!==Gr&&(xe(Bt,Qr,L),It.classList.add("active"))}function Fe(e){Na(m,`${O},${v}`,v,e)}we.append(Bt,It),we.prepend(Bt,Ht),me.append(we,Se),ce.contains(Ee)||me.append(Ee),ce.append(me);break;case"text-area":const Dt=e?.default_value||"";Object.assign(we,{className:"tpo_option-input-wrapper tpo_text-area"});let zt=document.createElement("span");Object.assign(zt,{className:"tpo_additional-price absolute"});let Vt=document.createElement("span");Object.assign(Vt,{className:"tpo_text-area-character-count absolute"}),wa(Xi,zt,L);let Ut=function({is_required:e,placeholder:t,type:o,option_id:i,option_identifier:n,...a},r,s,l,c,p,d,u,m,_,f,y){let h=document.createElement("textarea");const g=JSON.parse(a.metadata||"{}"),b=g.character_count?parseInt(g.character_count):0;let v=a.max_value?a.max_value:1===b?1e3:a.max_value;if(h.addEventListener("input",(function(e){_(e.target.value),c(e.target.value);const t=c(e.target.value);if(hs(a.id,"id",e.target.value,t,"TEXT"),1===b){let t=e.target.value.length;y.innerHTML=`\n ${t}\n /${v}`}e.target.value?p.classList.add("active"):p.classList.remove("active"),f?va(La(r,l),r):La(r,l)})),h.addEventListener("blur",(function(){c(h.value)&&d(h,h.value,u)})),h.addEventListener("focus",(function(){let e=/ [\[(] \+(.*) [)\]]/,t=h.value.match(e);h.value=t?h.value.replace(e,""):h.value})),Object.assign(h,{className:`tpo_option-input tpo_text-box tpo_${Ai.fontStyle}`,rows:3,name:`properties[${n}]`,id:`${o}-${i}`,placeholder:t,value:a?.default_value||"",ariaLabel:n}),h.placeholder=h.placeholder.replace(/\\n/g,"\n"),h.dataset.required=e,s&&h.setAttribute("form",s),h.style.fontSize=`${Ai.fontSize}px`,Ai?.fontFamily&&h.style.setProperty("--entered-input-fontFamily",`${Ai.fontFamily}`||""),h.style.setProperty("--entered-input-text",vi.inputText_enteredValue||Ai.fontColor||""),h.style.backgroundColor=vi.inputBackground_unselected??Bi.background,h.style.borderColor=vi.inputBorder_unselected??Bi.borderColor,h.style.borderRadius=`${$i.inputBorderRadius}px`,h.style.setProperty("--active-input-border",vi.inputBorder_selected||Bi.activeBorderColor||""),h.style.setProperty("--placeholder-input-text",vi.inputText_placeholder||""),h.style.setProperty("--active-input-background",vi.inputBackground_selected||""),1===b){let e=a?.default_value?.length||0;window.addEventListener("reloadValueOnTextField",(t=>{e=h.value.length})),y.innerHTML=`\n ${e}\n /${v}`,h.style.paddingRight="80px"}return m.type="button",m.addEventListener("click",(function(){c(h.value)&&La(r,l)&&d(h,h.value,u)})),h}(e,i,_,a,$e,zt,xe,L,n,We,p,Vt);if(le(Ut,"text-area",e,Dt),e?.default_value){const Xr=e.default_value;We(Xr);const Zr=$e(Xr);!1!==Zr&&""!==Zr&&(xe(Ut,Xr,L),zt.classList.add("active"))}we.append(Ut,zt),we.prepend(Ut,Vt),me.append(we,Se),ce.contains(Ee)||me.append(Ee),ce.append(me);break;case"text-number":const Jt=e?.default_value||"";Object.assign(we,{className:"tpo_option-input-wrapper"});let Wt=document.createElement("span");Object.assign(Wt,{className:"tpo_additional-price absolute"}),wa(Xi,Wt,L);let Qt=function({is_required:e,placeholder:t,type:o,option_id:i,option_identifier:n,default_value:a,...r},s,l,c,p,d,u,m,_,f,y){let h=document.createElement("input");return h.addEventListener("input",(function(e){f(e.target.value),p(e.target.value);const t=p(e.target.value);hs(r.id,"id",e.target.value,t,"TEXT"),e.target.value?d.classList.add("active"):d.classList.remove("active"),y?va(La(s,c),s):La(s,c)})),h.addEventListener("blur",(function(){p(h.value)&&u(h,h.value,m)})),h.addEventListener("focus",(function(){let e=/ [\[(] \+(.*) [)\]]/,t=h.value.match(e);h.value=t?h.value.replace(e,""):h.value})),Object.assign(h,{className:`tpo_option-input tpo_text-box tpo_${Ai.fontStyle}`,name:`properties[${n}]`,id:`${o}-${i}`,placeholder:t,type:"text",value:r?.default_value||"",ariaLabel:n}),h.dataset.required=e,l&&h.setAttribute("form",l),h.style.fontSize=`${Ai.fontSize}px`,Ai?.fontFamily&&h.style.setProperty("--entered-input-fontFamily",`${Ai.fontFamily}`||""),h.style.setProperty("--entered-input-text",vi.inputText_enteredValue||Ai.fontColor||""),h.style.backgroundColor=vi.inputBackground_unselected??Bi.background,h.style.borderColor=vi.inputBorder_unselected??Bi.borderColor,h.style.borderRadius=`${$i.inputBorderRadius}px`,h.style.setProperty("--active-input-border",vi.inputBorder_selected||Bi.activeBorderColor||""),h.style.setProperty("--placeholder-input-text",vi.inputText_placeholder||""),h.style.setProperty("--active-input-background",vi.inputBackground_selected||""),_.type="button",_.addEventListener("click",(function(){let e=p(h.value);!1!==e&&""!==e&&La(s,c)&&u(h,h.value,m)})),h}(e,i,_,a,(function(e){ce.contains(Ee)||me.append(Se,Ee);let t=/^[\+\-]?\d*\.?\d+$/,o=e.match(/\[ \+(.*)\]/);const i=(e=o?e.replace(/\[ \+(.*)\]/,""):e).trim().match(t);e=i?i[0]:e;let n=t.test(e);if(!e&&(Ee.innerHTML="",me.removeAttribute("data-error"),!y))return e;if(me.setAttribute("data-error",""),n)e=parseFloat(e||0);else if(e)return e=e?parseFloat(e):"",Ee.innerHTML=Oo?ba(Oo,""):"This input value is not numeric!",!1;return`${e}`.length<1&&y?(Ee.innerHTML=_o?ba(_o,""):"This is a required field",!1):$&&e<$?(Ee.innerHTML=So?ba(So,$):`Please enter a minimum value of ${$}`,!1):C&&e>C?(Ee.innerHTML=Eo?ba(Eo,C):`Please enter a maximum value of ${C}`,!1):(me.removeAttribute("data-error"),Ee.innerHTML="",e)}),Wt,xe,L,n,je,p);if(le(Qt,"text-number",e,Jt),e?.default_value){const Yr=e.default_value;je(Yr);const Kr=$e(Yr);!1!==Kr&&""!==Kr&&(xe(Qt,Yr,L),Wt.classList.add("active"))}function je(e){Na(m,`${O},${v}`,v,e)}we.append(Qt,Wt),me.append(we,Se),ce.contains(Ee)||me.append(Ee),ce.append(me);break;case"checkbox":Object.assign(we,{className:"tpo_radio-buttons-wrapper "+(U&&1!==U?`tpo-grid-${U}`:"")}),me.querySelector(".tpo_option-required-indicator").innerHTML=`\n ${y||$&&x?"*":""}\n `;let Gt=[],Zt=[],Yt={price:0},Kt=document.createElement("span");Object.assign(Kt,{className:"tpo_additional-price absolute active"}),Rr(Y,Kt,h);let eo=document.createElement("input");if(Object.assign(eo,{className:"tpo_hidden-checkbox",name:`properties[${ge?"_":""}${E}]`,value:"",ariaLabel:E}),re.enable&&(re.configs.showTotalSelected?_e="exact_count":re.configs.isShowNewTotalSelected?_e=re.configs.isUseMinMaxSelected?"min_max_count":"only_total":re.configs.isUseMinMaxSelected&&(_e="min_max_not_count")),re.enable&&_e){let{totalQuantitySelectorElementWrapperRender:es,errorTotalElementRender:ts}=Fr(re,Lo,_e);de=es,ue=ts}function Ie(){if(!y&&!$&&!C)return!0;const e=Gt.length;return x&&$&&e<$?(Ee.innerHTML=$o?ba($o,$):`Please select at least ${$} options`,!1):x&&C&&e>C?(Ee.innerHTML=Co?ba(Co,C):`Please select at maximum ${C} options`,!1):y&&e<1?(Ee.innerHTML=fo?ba(fo,""):"This is a required option",!1):(Ee.innerHTML="",!0)}function Be(e){Na(m,`${O},${v}`,v,Zt)}de&&me.append(de),ue&&de&&me.append(ue),ce.append(me),eo.dataset.required=y||x&&$,_&&eo.setAttribute("form",_),eo.dataset.required=y||$&&x;let oo=h.map(((t,o)=>{let n=t.label;const r=t.additional_price||null;if(r){let e=PriceFormatter.formatMoney(parseFloat(100*r),!0);n=`${t.label} [ +${e} ]`}return function(e,t,o,i,n,a,r,c,p,d,u,m,_,f,y,h,g,b,v,w,S,E,$,C,x,k,L,q,T){let{label:O,is_default:A,additional_price:N=null,id:P,number_color:M,color_code:F="",product_id:j,variant_id:I,image_url:H,image_canvas_url:B,metadata:z="{}"}=o||{};F||(F=",");const V=F?.split(","),U=w?.image_color??0,J=JSON.parse(z||"{}"),R=J.printBoxName?J.printBoxName:"",W=J.printBoxValue?J.printBoxValue:"",Q=J.url||"",G=Q.startsWith("/")||Q.startsWith("http")?Q:`https://${Q}`,X=J.description||"",Z=ga(J.tooltip||"");let Y={};const K=w.id,ee=w.is_change_label,te=JSON.parse(w.metadata||"{}");let{useUrl:oe=!1,linkDisplay:ie="separate",linkLabel:ne,separateAddOnProduct:ae=!1,descriptionPosition:re="below_value"}=te;ne||(ne="View");const se=oe&&"separate"===ie,le=oe&&"clickable_label"===ie;I&&vn.forEach((e=>{e.variants.forEach((t=>{`${t.id}`===I&&(Y={...e,variants:[{...t}]},ee||(o.label="Default Title"===t?.title?t?.name:t?.title,O=o.label))}))}));const ce=void 0===Y?.variants||Y.variants[0].available,pe=o?.label;H=Ir(Y,H);let de=wr(b,H,pe);de=jr({imageOrColor:U,numberColor:M,swatchShape:S,colorCodes:V,imageUrl:H,imgElement:de,imageSize:b,optionLabel:pe}),null===de&&(de=""),Y?.variants&&(N=Y.variants[0].price/100);const ue=$.configs,me=$.enable,{quantitySelectorWrapper:_e,errorMessageElement:fe}=me?C(ue,N,Ee,P,K,Mi,"",(function(){ye.checked=!1,we({target:{checked:!1}})})):{quantitySelectorWrapper:null,errorMessageElement:null};let ye=document.createElement("input");ye.style.setProperty("--checkbox-checkMark",vi?.checkboxCheckmark_unselected),ye.style.setProperty("--active-checkbox-checkMark",vi?.checkboxCheckmark_selected),Object.assign(ye,{className:"tpo_radio-button tpo-checkbox-button",type:"checkbox",disabled:!ce,checked:A&&ce,id:`${i}-${n}`,value:_,onchange:we}),I&&(ye.dataset.productId=j,ye.dataset.variantId=I);let he=l["SOLD OUT"]&&l["SOLD OUT"][s]||"SOLD OUT";if(ce||(o.label=`${O} - ${he}`,O=o.label),"hide"===D?.outStockOptions&&!ce)return"";let ge=document.createElement("span");Object.assign(ge,{className:"tpo_additional-price "+(0!==m?"":"tpo_hidden")}),A&&(y.push(P),h&&Ya(O),f(P)),Mt&&(ye.dataset.printBoxName=R,ye.dataset.printBoxValue=W);let be=document.createElement("div");Object.assign(be,{className:`container-wrap-selection ${ce?"":"out_stock_label"} ${"hover"===v?"":de?"tpo_label_under_price":""}`});let ve=document.createElement("div");function we(o){if(o.target.checked){if(me&&(_e.classList.remove("swatches-not-avaliable"),_e.querySelector("input").disabled=!1),me)Se();else{if(N){let e=PriceFormatter.formatMoney(parseFloat(100*N),!0);a.push(`${O} [ +${e} ]`)}else a.push(O);p.price+=N,wa(Xi,d,Mr(p.price)?p.price.toFixed(2):p.price),r.value=a.join(", ")}y.push(P),h&&Ya(O),f(P),ls(P,B||H,!0),c(),o.target.dataset.checked="true",g?va(La(e,t),e):La(e,t)}else{_e&&(_e.classList.add("swatches-not-avaliable"),_e.querySelector("input").disabled=!0,_e.classList.remove("tpo-error_validate"),fe.innerHTML="");let i=O;if(me){const e=_e.querySelector("input").value;if(N){const t=Number(e)*N;let o=PriceFormatter.formatMoney(parseFloat(100*t),!0);i=`${O} [ +${o} ] | ${e}`,p.price-=t}else i=`${O} | ${e}`;q&&$r(x,0,ue,T)}else{if(N){let e=PriceFormatter.formatMoney(parseFloat(100*N),!0);i=`${O} [ +${e} ]`}p.price-=N}const n=a.indexOf(i);if(n>-1&&(a.splice(n,1),y.splice(n,1)),h&&Ya(O),wa(Xi,d,Mr(p.price)?p.price.toFixed(2):p.price),r.value=a.join(", "),c(),f(P),o.target.dataset.checked="false",ls(P,B||H,!1),_e){const e=x.querySelector(".tpo_quantity_selector_total-selected");c()&&e&&"0"===e.innerHTML&&(e.classList.remove("tpo-quantity-error"),0!==Number(e.textContent)&&e.classList.add("tpo-quantity-success"))}g?va(La(e,t),e):La(e,t)}f(P),wa(Xi,d,Mr(p.price)?p.price.toFixed(2):p.price),r.value=a.join(", "),c(),g?va(La(e,t),e):La(e,t),r.dispatchEvent(new Event("change"))}if(ve.style.setProperty("--checkbox-border",vi?.checkboxBorder_unselected??""),ve.style.setProperty("--active-checkbox-border",vi?.checkboxBorder_selected??""),ve.style.setProperty("--checkbox-background",vi?.checkboxBackground_unselected??""),ve.style.setProperty("--active-checkbox-background",vi?.checkboxBackground_selected??""),ve.style.setProperty("--checkbox-checkMark",vi?.checkboxCheckmark_unselected??""),ve.style.setProperty("--active-checkbox-checkMark",vi?.checkboxCheckmark_selected??""),Object.assign(ve,{className:`tpo_radio-button-wrapper ${re} ${X?"has-description":""}`,innerHTML:`\n \n ${"hover"===v?`
\n ${de} \n
${se?`${O} ${ne}`:le?`${O} `:`${O} `}\n ${X?ha(X,"below_value").outerHTML:""}\n
`:`
${se?`${O} ${ne}`:le?`${O} `:`${O} `}${X?ha(X,"below_value").outerHTML:""} ${de}
`}${X?ha(X,"under-checkbox below_image").outerHTML:""}\n \n `}),_e){const e=document.createElement("div");Object.assign(e,{className:"tpo-quantity_always-show"}),e.append(_e),ve.append(e)}function Se(){const e=_e.querySelector("input").value,t=_e.querySelector("input");t&&t.dispatchEvent(new Event("change")),e?Ee(N?N*Number(e):0,e):(_e.querySelector("input").value=1,Ee(N?1*N:0,1))}function Ee(o,i){const n=o?`${O} [ +`:`${O} |`;if(o){const e=a.find((e=>e.includes(n)&&e.split("[")[0].trim()===n.split("[")[0].trim()));if(e){const t=a.indexOf(e),n=a[t].lastIndexOf("|"),r=a[t].slice(n+1).trim();let s=PriceFormatter.formatMoney(parseFloat(100*o),!0);a[t]=`${O} [ +${s} ] | ${i}`;const l=Number(o)/Number(i),c=Math.abs(Number(r)-Number(i));Number(r)Number(i)&&(p.price-=c*l)}else{let e=PriceFormatter.formatMoney(parseFloat(100*o),!0);a.push(`${O} [ +${e} ] | ${i}`),p.price+=o}}else{const e=a.find((e=>e.includes(n)&&e.split("|")[0].trim()===n.split("|")[0].trim()));if(e){const t=a.indexOf(e);a[t]=`${O} | ${i}`}else a.push(`${O} | ${i}`)}wa(Xi,d,Mr(p.price)?p.price.toFixed(2):p.price),r.value=a.join(", "),q&&$r(x,0,ue,T),va(La(e,t),e)}if(A&&ce){if(me){const e=E.querySelectorAll(".tpo_quantity-selector_wrapper");e&&e.length&&e.forEach((e=>{e.classList.add("swatches-not-avaliable")})),_e.classList.remove("swatches-not-avaliable"),_e.querySelector("input").disabled=!1,Se()}else{if(N){let e=PriceFormatter.formatMoney(parseFloat(100*N),!0);a.push(`${O} [ +${e} ]`)}else a.push(O);p.price+=N,r.value=a.join(", ")}ye.dataset.checked="true",wa(Xi,d,p.price.toFixed(2)),"FORM"===e.tagName&&setTimeout((function(){g?va(La(e,t),e):La(e,t)}),500),setTimeout((()=>{r.dispatchEvent(new Event("change"))}),0)}return wa(Xi,ge,N),ve.firstElementChild.prepend(ye),_e?be.append(ve,fe):be.append(ve),be.querySelector(".tpo_option_type_label")?.append(ge,Z),be}(i,a,t,E,o,Gt,eo,Ie,Yt,Kt,0,q,n,Be,Zt,H,p,z,F,e,I,we,re,Cr,ce,0,0,_e,ue)}));if(we.append(...oo,eo,Kt),de?(me.insertBefore(we,de),ce.contains(Ee)||me.insertBefore(Ee,de)):(me.append(we),ue?me.append(ue,Ee):me.append(Ee)),me.append(Se),n.type="button",n.addEventListener("click",(function(){Ie()})),re.enable){const os=h.some((e=>e.is_default));os&&$r(ce,0,re.configs,ue)}const no=oo.map((e=>"string"!=typeof e?e.querySelector(".tpo_radio-button"):null));eo.addEventListener("change",(function(){Vr(eo,no)}));break;case"color-swatches":Tt("link","stylesheet",nt),Object.assign(we,{className:"tpo_option-type-color-swatches-wrapper "+(U&&1!==U&&"always"===F?`tpo-grid-${U}`:"")}),me.querySelector(".tpo_option-required-indicator").innerHTML=`\n ${y||$&&x?"*":""}\n `;let so=[],lo=[],co=[],po={price:0},uo=document.createElement("span");Object.assign(uo,{className:"tpo_additional-price absolute active"}),Rr(Y,uo,h);let mo=document.createElement("input");if(Object.assign(mo,{className:"tpo_hidden-checkbox",name:he?"":`properties[${ge?"_":""}${E}]`,value:"",ariaLabel:E}),re.enable&&(re.configs.showTotalSelected?_e="exact_count":re.configs.isShowNewTotalSelected?_e=re.configs.isUseMinMaxSelected?"min_max_count":"only_total":re.configs.isUseMinMaxSelected&&(_e="min_max_not_count")),re.enable&&_e){let{totalQuantitySelectorElementWrapperRender:is,errorTotalElementRender:ns}=Fr(re,Lo,_e);de=is,ue=ns}function De(){if(ce.contains(Ee)||me.append(Se,Ee),!y&&!$&&!C)return!0;const e=so.length;return x&&$&&e<$?(Ee.innerHTML=$o?ba($o,$):`Please select at least ${$} options`,!1):x&&C&&e>C?(Ee.innerHTML=Co?ba(Co,C):`Please select at maximum ${C} options`,!1):y&&e<1?(Ee.innerHTML=fo?ba(fo,""):"This is a required option",!1):(Ee.innerHTML="",!0)}function ze(e){B&&Tr(be,lo),Na(m,`${O},${v}`,v,x?co:e)}de&&me.append(de),ue&&de&&me.append(ue),ce.append(me),mo.dataset.required=y||x&&$,_&&mo.setAttribute("form",_),n.type="button",n.addEventListener("click",(function(){De()}));let xo=h.map(((t,o)=>ya(i,a,t,E,x,I,ae,o,so,mo,De,po,uo,0,q,co,ze,F,j,H,u,p,lo,we,re,Cr,e,ce,0,_e,ue)));if(ae&&ne?.configs&&window.TPO_Swiper){const{sliderStyle:as,navigationPosition:rs,navigationPositionAlign:ss,showIndicators:cs}=ne?.configs||{};3===as&&we.classList.add("using_swatches_slider_type_3"),"above"===rs&&we.classList.add("using_above_navigation"),we.classList.add("using_swatches_slider");let ps=document.createElement("div");ps.setAttribute("data-swiperId",e.option_id);for(const[fs,ys]of Object.entries(ne?.configs))ps.setAttribute(`data-${fs}`,ys);Object.assign(ps,{className:`swiper tpo-swiper swiper-${e.option_id} ${3!==as&&rs}-swatches swiper-style-${as}`});let ds=document.createElement("div");Object.assign(ds,{className:"swiper-wrapper"}),ds.append(...xo),ps.append(ds);let us=document.createElement("div");Object.assign(us,{className:`tpo-swiper-navigation swiper-navigation swiper-navigation-${ss}`});let ms=document.createElement("div");Object.assign(ms,{className:"tpo-swiper-button-prev swiper-button-prev",innerHTML:'\n \n '});let _s=document.createElement("div");if(Object.assign(_s,{className:"tpo-swiper-button-next swiper-button-next",innerHTML:'\n \n '}),us.append(ms,_s),ps.append(us),cs){let bs=document.createElement("div");Object.assign(bs,{className:"tpo-swiper-pagination swiper-pagination tpo-swiper-pagination--color-swatches"}),ps.append(bs)}we.append(ps,mo,uo)}else we.append(...xo,mo,uo);de?(me.insertBefore(we,de),ce.contains(Ee)||me.insertBefore(Ee,de)):(me.append(we),ue?me.append(ue,Ee):me.append(Ee)),me.append(Se);const ko=xo.map((e=>"string"!=typeof e?e.querySelector(".tpo_color-swatches-input"):null));mo.addEventListener("change",(function(){Vr(mo,ko)})),e.option_types.some((e=>e.is_default))&&_e&&$r(ce,0,re.configs,ue);break;case"image-swatches":Tt("link","stylesheet",nt),Object.assign(we,{className:"tpo_option-type-image-swatches-wrapper "+(U&&1!==U&&"always"===F?`tpo-grid-${U}`:"")}),me.querySelector(".tpo_option-required-indicator").innerHTML=`\n ${y||$&&x?"*":""}\n `;let qo=[],To=[],Ao=[],No={price:0},Po=document.createElement("span");Object.assign(Po,{className:"tpo_additional-price absolute active"}),Rr(Y,Po,h);let Mo=document.createElement("input");if(Object.assign(Mo,{className:"tpo_hidden-checkbox",name:he?"":`properties[${ge?"_":""}${E}]`,value:"",ariaLabel:E}),re.enable&&(re.configs.showTotalSelected?_e="exact_count":re.configs.isShowNewTotalSelected?_e=re.configs.isUseMinMaxSelected?"min_max_count":"only_total":re.configs.isUseMinMaxSelected&&(_e="min_max_not_count")),re.enable&&_e){let{totalQuantitySelectorElementWrapperRender:vs,errorTotalElementRender:ws}=Fr(re,Lo,_e);de=vs,ue=ws}function Ve(){if(ce.contains(Ee)||me.append(Se,Ee),!y&&!$&&!C)return!0;const e=qo.length;return x&&$&&e<$?(Ee.innerHTML=$o?ba($o,$):`Please select at least ${$} options`,!1):x&&C&&e>C?(Ee.innerHTML=Co?ba(Co,C):`Please select at maximum ${C} options`,!1):y&&e<1?(Ee.innerHTML=fo?ba(fo,""):"This is a required option",!1):(Ee.innerHTML="",!0)}function Ue(e){B&&Tr(be,To),Na(m,`${O},${v}`,v,x?Ao:e)}de&&me.append(de),ue&&de&&me.append(ue),ce.append(me),Mo.dataset.required=y||x&&$,_&&Mo.setAttribute("form",_),n.type="button",n.addEventListener("click",(function(){Ve()}));let Fo=h.map(((t,o)=>ya(i,a,t,E,x,I,ae,o,qo,Mo,Ve,No,Po,0,q,Ao,Ue,F,j,H,u,p,To,we,re,Cr,e,ce,0,_e,ue)));if(ae&&ne?.configs&&window.TPO_Swiper){const{sliderStyle:Ss,navigationPosition:Es,navigationPositionAlign:$s,showIndicators:Cs}=ne?.configs||{};3===Ss&&we.classList.add("using_swatches_slider_type_3"),"above"===Es&&we.classList.add("using_above_navigation"),we.classList.add("using_swatches_slider");let xs=document.createElement("div");xs.setAttribute("data-swiperId",e.option_id);for(const[Os,As]of Object.entries(ne?.configs))xs.setAttribute(`data-${Os}`,As);Object.assign(xs,{className:`swiper tpo-swiper swiper-${e.option_id} ${3!==Ss&&Es}-swatches swiper-style-${Ss}`});let ks=document.createElement("div");Object.assign(ks,{className:"swiper-wrapper"}),ks.append(...Fo),xs.append(ks);let Ls=document.createElement("div");Object.assign(Ls,{className:`tpo-swiper-navigation swiper-navigation swiper-navigation-${$s}`});let qs=document.createElement("div");Object.assign(qs,{className:"tpo-swiper-button-prev swiper-button-prev",innerHTML:'\n \n '});let Ts=document.createElement("div");if(Object.assign(Ts,{className:"tpo-swiper-button-next swiper-button-next",innerHTML:'\n \n '}),Ls.append(qs,Ts),xs.append(Ls),Cs){let Ns=document.createElement("div");Object.assign(Ns,{className:"tpo-swiper-pagination swiper-pagination tpo-swiper-pagination--image-swatches"}),xs.append(Ns)}we.append(xs,Mo,Po)}else we.append(...Fo,Mo,Po);de?(me.insertBefore(we,de),ce.contains(Ee)||me.insertBefore(Ee,de)):(me.append(we),ue?me.append(ue,Ee):me.append(Ee)),me.append(Se);const jo=Fo.map((e=>"string"!=typeof e?e.querySelector(".tpo_color-swatches-input"):null));Mo.addEventListener("change",(function(){Vr(Mo,jo)})),e.option_types.some((e=>e.is_default))&&_e&&$r(ce,0,re.configs,ue);break;case"buttons":Object.assign(we,{className:"tpo_option-type-buttons-wrapper tpo_option-type-color-swatches-wrapper"}),me.querySelector(".tpo_option-required-indicator").innerHTML=`\n ${y||$&&x?"*":""}\n `;let Io=[],Ho=[],Bo={price:0},Do=document.createElement("span");Object.assign(Do,{className:"tpo_additional-price absolute active"}),Rr(Y,Do,h);let zo=document.createElement("input");if(Object.assign(zo,{className:"tpo_hidden-checkbox",name:he?"":`properties[${ge?"_":""}${E}]`,value:"",ariaLabel:E}),re.enable&&(re.configs.showTotalSelected?_e="exact_count":re.configs.isShowNewTotalSelected?_e=re.configs.isUseMinMaxSelected?"min_max_count":"only_total":re.configs.isUseMinMaxSelected&&(_e="min_max_not_count")),re.enable&&_e){let{totalQuantitySelectorElementWrapperRender:Ps,errorTotalElementRender:Ms}=Fr(re,Lo,_e);de=Ps,ue=Ms}function Je(e){Na(m,`${O},${v}`,v,x?Ho:e)}function Re(){if(!y&&!$&&!C)return!0;const e=Io.length;return x&&$&&e<$?(Ee.innerHTML=$o?ba($o,$):`Please select at least ${$} options`,!1):x&&C&&e>C?(Ee.innerHTML=Co?ba(Co,C):`Please select at maximum ${C} options`,!1):y&&e<1?(Ee.innerHTML=fo?ba(fo,""):"This is a required option",!1):(Ee.innerHTML="",!0)}de&&me.append(de),ue&&de&&me.append(ue),ce.append(me),zo.dataset.required=y||x&&$,_&&zo.setAttribute("form",_),n.type="button",n.addEventListener("click",(function(){Re()}));let Vo=h.map(((t,o)=>ya(i,a,t,E,x,I,ae,o,Io,zo,Re,Bo,Do,0,q,Ho,Je,F,j,H,u,p,null,we,re,Cr,e,ce,0,_e,ue)));we.append(...Vo,zo,Do),de?(me.insertBefore(we,de),ce.contains(Ee)||me.insertBefore(Ee,de)):(me.append(we),ue?me.append(ue,Ee):me.append(Ee)),me.append(Se);const Uo=Vo.map((e=>"string"!=typeof e?e.querySelector(".tpo_buttons-input"):null));zo.addEventListener("change",(function(){Vr(zo,Uo)})),e.option_types.some((e=>e.is_default))&&_e&&$r(ce,0,re.configs,ue);break;case"heading":const Jo=JSON.parse(T||"{}");if(!Jo.content)break;const Ro=Jo.headingType||"h1",Wo=Jo.content,Qo=Jo.color||"";let Go=document.createElement(Ro);Object.assign(Go,{className:"tpo_option-heading",textContent:Wo}),Go.style.setProperty("--active-heading-color",Qo),ce.append(Go);break;case"divider":const Xo=JSON.parse(T||"{}"),Zo=Xo.dividerType||"solid",Yo=Xo.color||"#000000";let Ko=document.createElement("hr");Object.assign(Ko,{className:"tpo_option-divider"}),Ko.style.borderTop=`1px ${Zo} ${Yo}`,"double"===Zo&&(Ko.style.borderWidth="3px"),ce.append(Ko);break;case"paragraph":Tt("link","stylesheet",it);const ei=JSON.parse(T||"{}").content||"";let ii=document.createElement("div");Object.assign(ii,{className:"tpo_option-paragraph ql-editor",innerHTML:ei}),ce.append(ii);break;case"html":const ni=JSON.parse(T||"{}").content||"";let ai=document.createElement("div");Object.assign(ai,{className:"tpo_option-html",innerHTML:ni}),ce.append(ai);break;case"file-upload":Object.assign(we,{className:"tpo_file-upload"}),we.style.height=`${Ei.fileUploadHeight}px`;let ri=document.createElement("span");Object.assign(ri,{className:"tpo_additional-price absolute"});let si=document.createElement("div");si.style.backgroundColor=vi?.fileUploadButton_background??"",Object.assign(si,{className:"tpo-file-placeholder",innerHTML:`
\n
\n
${e?.placeholder||l["Add files"]&&l["Add files"][s]||"Add files"}
\n
\n
`}),wa(Xi,ri,L);let{fileUploadElement:li,fileListElement:ci}=function({is_required:e,placeholder:t,type:o,option_id:i,option_identifier:n,file_extension:a,file_restriction_type:r,label:c,metadata:p,...d},u,m,_,f,y,h,g,b,v,w,S){let E=JSON.parse(p||"{}"),$=E.maxFileQty>10?"fjckPiAzNHI1MzwtMzo="===window.TPOConfigs.app?E.maxFileQty:10:E.maxFileQty||1,C=E.useEditorImage||!1,x=E.defaultValueUploaded||{},k=E?.image_ratios||[],L=k.map((e=>{if("custom"===e.toLowerCase())return[void 0,"Custom"];if("square"===e.toLowerCase())return[1,"Square"];if(e.includes(":")){const[t,o]=e.split(":");return[t/o,e]}})),q=k.length>0?L:[[void 0,"Custom"],[1,"Square"],[16/9,"16:9"],[4/3,"4:3"]],T=document.createElement("input");"dragover dragenter".split(" ").forEach((e=>T.addEventListener(e,(e=>{w.classList.add("is-dragover"),S.querySelector(".tpo-dropzone__action").innerHTML="Drop files to upload"})))),"dragleave dragend drop".split(" ").forEach((e=>T.addEventListener(e,(e=>{w.classList.remove("is-dragover"),S.querySelector(".tpo-dropzone__action").innerHTML="Add files"}))));let O=["test-easify-product-options.myshopify.com","plentyprints-9822.myshopify.com","efa901-2.myshopify.com","17e9ba-2.myshopify.com","0ad21f-51.myshopify.com"],A=[],N=[],P=[],M=0;for(let t=0;t<$;t++){let o=t+1,i=document.createElement("input");Object.assign(i,{className:"tpo_file-upload-input tpo_hidden",type:"text",name:`properties[${n}-${o}]`,hidden:!0,ariaLabel:n});let a=u?.attributes.id?.value||null;a&&i.setAttribute("form",a),1===o&&(i.dataset.required=e),P.push(i)}function F(){for(let e=0;e{const t=e.closest(".tpo-file__preview");if(t&&t.classList.contains("tpo_default_file"))e.onclick=function(){const e=Array.from(t.parentNode.children).indexOf(t)-1;T.classList.remove("tpo-disabled"),T.dataset.currentFileQty--,T.value="",M--,N.splice(e,1),A.splice(e,1),F(),_(M),t.parentElement.removeChild(t)};else{const o=e.dataset.index;e.onclick=function(){const e=(n=t,Array.from(n.parentNode.children).indexOf(n)-1),i=new DataTransfer;var n;for(let e=0;e\n ${Yi?'\n \n \n ':'\n \n \n \n \n \n \n \n '}\n ${H}...\n \n `}),T.addEventListener("input",(function(e){T.closest(".tpo_option-label").querySelector(".tpo-file__img")||T.closest(".tpo_option-label").append(I);let t=I.querySelector(".tpo-file-loader"),o=T.value.toLowerCase().split(".").pop(),i=[],n=$-T.dataset.currentFileQty;const a=new DataTransfer;if(T.files.length>n)for(let e=0;e10?"fjckPiAzNHI1MzwtMzo="===window.TPOConfigs.app||O.includes(Q)?parseInt(d.max_value):10:parseInt(d.max_value)||10,h=a/1048576,g=l["Please upload file having extensions {{extensions}} - {{fileName}}"]&&l["Please upload file having extensions {{extensions}} - {{fileName}}"][s]||"Please upload file having extensions {{extensions}} - {{fileName}}",b=l["Please upload file size less than {{maxFileSize}}MB - {{fileName}}"]&&l["Please upload file size less than {{maxFileSize}}MB - {{fileName}}"][s]||"Please upload file size less than {{maxFileSize}}MB - {{fileName}}",w=l["Something went wrong! Please try again."]&&l["Something went wrong! Please try again."][s]||"Something went wrong! Please try again.";if(T?.accept&&!T?.accept?.toLowerCase()?.includes(o))p.push(g.replace("{{extensions}}",T.accept).replace("{{fileName}}",n.name));else if(h>y)p.push(b.replace("{{maxFileSize}}",y).replace("{{fileName}}",n.name));else if(n){c=!0,t.classList.remove("tpo_hidden");let o=new FileReader;o.onload=function(o){let a=(n,a)=>{let r=new FormData;r.append("file",n);const s={method:"POST",headers:{shop:Q,name:encodeURIComponent(T.name)},body:r};K||fetch(`${An.easifyUrl}apps/upload-file`,s).then((function(t){if("200"==t.status)return M++,t.json().then((function(t){let r="shepolish.myshopify.com"!==Q?t.url:t.url.replace(Q,window.location.host);const s=document.createElement("div");Object.assign(s,{className:"tpo-file__preview",innerHTML:`\n \n
\n \n ${n.name}\n \n \n \n \n \n \n
\n `}),I.append(s),T.dataset.currentFileQty++,parseInt(T.dataset.currentFileQty)>=parseInt(T.dataset.maxFileAllowed)&&T.classList.add("tpo-disabled"),A.push(r),N.push(n),F(),M===i.length&&_(M,p.map((e=>`

${e}

`)))}));f.innerHTML=w,T.value="",v?va(La(u,m),u):La(u,m)})).catch((e=>{f.innerHTML=w,v?va(La(u,m),u):La(u,m),console.log("Error upload file: ",e)})).finally((()=>{t.classList.add("tpo_hidden"),j()}))};if(1===r&&C&&window.pintura){let e=k&&k.length&&L[0][0]||"";"testdiningbook.myshopify.com"===Q?(q=[[1.5,"6:4"]],e=1.5):"463aae.myshopify.com"===Q||"knk-krafts.myshopify.com"===Q?(q=[[1,"Square"]],e=1):"367e7f-3.myshopify.com"===Q?(q=[[713/450,"713:450"]],e=713/450):"j0fbzy-f0.myshopify.com"===Q?(q=[[3/4,"3:4"]],e=3/4):"cadouri-miutic.myshopify.com"===Q&&(q=[[.7,"21:30"]],e=.7);let t=["crop","filter","finetune","annotate","decorate","frame","redact","resize"];"pejknm-ex.myshopify.com"!==Q&&"k9chr0-ma.myshopify.com"!==Q||(t=["crop"]);const o=window.pintura.openDefaultEditor({src:n,imageCropAspectRatio:e,cropSelectPresetOptions:q,utils:t});o.on("load",(e=>console.log("modal result",e))),o.on("process",(e=>{a(e.dest)}))}else a(n)},o.readAsDataURL(n)}}let y=p.map((e=>`

${e}

`));y&&y.length>0?w.setAttribute("data-error",""):w.removeAttribute("data-error"),f.innerHTML=y.join(""),c||_(M,y)}));let B="",D=a?a.split(",").map((e=>e.trim().toLowerCase())):[];switch(r){case 0:B="";break;case 1:B=".jpeg,.jpg,.svg,.png,.tiff,.tif";break;case 2:B=".pdf,.doc,.docx,.html,.htm,.xls,.xlsx,.txt";break;case 3:B=D.map((e=>`.${e}`))}Object.assign(T,{className:`tpo_option-input tpo_dropzone tpo_${Ai.fontStyle}`,type:"file",id:`${o}-${i}`,accept:`${B}`,placeholder:t,multiple:!0,ariaLabel:n}),T.dataset.maxFileAllowed=$,T.dataset.currentFileQty=0;for(let e=0;e<$;e++){const t=x[`${n}-${e+1}`];t&&(P[e].value=t,z(t,e))}function z(e="",t){if(!e)return;let o="";const i=e.indexOf("name=");i&&i>0&&(o=e.slice(i+5));const n=document.createElement("div");Object.assign(n,{className:"tpo-file__preview tpo_default_file",innerHTML:`\n \n
\n \n ${o||"File"}\n \n \n \n \n
\n `}),I.append(n),T.dataset.currentFileQty++,parseInt(T.dataset.currentFileQty)>=parseInt(T.dataset.maxFileAllowed)&&T.classList.add("tpo-disabled"),A.push(e),N.push({name:o,url:e}),j(),F()}g.type="button",g.addEventListener("click",(function(){_(M)}));const V=document.createElement("div");return V.append(T,...P),{fileUploadElement:V,fileListElement:I}}(e,i,a,(function(e,t=[]){const o=e=>{Ee.innerHTML=e};let n=te.maxFileQty>10?"fjckPiAzNHI1MzwtMzo="===window.TPOConfigs.app?te.maxFileQty:10:te.maxFileQty||1;if(o(""),t?.length>0)return o(t.join("")),e?e>=ie||(va(!1,i),!1):!y||(va(!1,i),!1);if(y&&!e)return va(!1,i),o(fo?ba(fo,""):"This is a required option"),!1;if(i.dispatchEvent(new Event("change")),e)return!ie||(e""===e.innerHTML))||(va(!1,i),!1)}}),ri,xe,L,n,0,p,we,si);function We(e){Na(m,`${O},${v}`,v,e)}we.append(li,si,ri),me.append(we,Se),ce.contains(Ee)||me.append(Ee);let pi=te.defaultValueUploaded||{};ci&&Object.keys(pi).some((e=>pi[e]))&&me.append(ci),ce.append(me);break;case"modal":Tt("link","stylesheet",it);const di=JSON.parse(T||"{}"),ui=di.content||"",mi=di.contentHTML||"",_i=di.modalWidth||300,fi=di.modalTitle||"",yi=parseInt(di.modalType)||0,hi=di.imageUrl,gi=di.fontSize,bi=di.fontColor,Si=(di.fontWeight,di.fontBold),Ti=di.fontItalic,Fi=di.fontUnderline,ji=di.imageSize,Ii=(di.fontStyle,$t.includes(Z));let Di;Di=Ii?document.createElement("dialog"):document.createElement("div"),Object.assign(Di,{className:(Ki?"in-dark-mode":"")+" tpo_modal-background"});let Ui=document.createElement("div");Object.assign(Ui,{className:"tpo_modal-container",innerHTML:`\n
\n

${fi}

\n
\n
\n ${1===yi?mi:ui}\n
\n `}),Ui.style.width=`${_i}px`;let Ji=document.createElement("div");Object.assign(Ji,{className:"tpo_open-modal-button-wrapper",innerHTML:`\n ${hi?``:""}\n \n ${b||E}\n \n `,onclick:function(){Ii?Di&&"function"==typeof Di.showModal&&(Di.showModal(),Di.style.display="block"):Di.style.display="block"}});let Ri=document.createElement("span");Object.assign(Ri,{className:"tpo_close-popup-button",innerHTML:"×",onclick:function(){Ii?Di&&"function"==typeof Di.close&&(Di.close(),Di.style.display="none"):Di.style.display="none"}}),window.addEventListener("click",(function(e){e.target===Di&&(Ii?Di&&"function"==typeof Di.close&&(Di.close(),Di.style.display="none"):Di.style.display="none")})),Ui.append(Ri),Di.append(Ui),ce.append(Ji),document.body.append(Di);break;case"product-list":const Wi=JSON.parse(T||"{}"),Gi=Wi.modalTitle||"",Zi=Wi.buttonText||"Select your options",en=void 0!==Wi.isHideModalFilter&&Wi.isHideModalFilter;let tn=[],on=[],nn=[],an=[],rn=[],sn=[],ln={price:0},cn=[],pn=[];const dn=$t.includes(Z);let un;un=dn?document.createElement("dialog"):document.createElement("div"),Object.assign(un,{className:(Ki?"in-dark-mode":"")+" tpo_modal-background"}),me.querySelector(".tpo_option-required-indicator").innerHTML=`\n ${y||$&&x?"*":""}\n `;let mn=document.createElement("div");Object.assign(mn,{className:"tpo_modal-container",innerHTML:`\n
\n

${Gi}

\n
\n `}),mn.style.width="500px";let _n=document.createElement("div");Object.assign(_n,{className:"list_tag-wrap_element",id:"list_tag-wrap_element"});let fn=document.createElement("button");Object.assign(fn,{className:"tpo_popup-modal-button",type:"button",textContent:Zi,onclick:function(){dn?un&&"function"==typeof un.showModal&&(un.showModal(),un.style.display="block"):un.style.display="block",Cn.value="",cn=[...pn],ma(i,a,h,E,x,I,0,0,0,sn,0,0,q,an,we,0,Xe,!0,on,c,e,p,re,Cr,0,0,0,cn,mn)}});let yn=document.createElement("div");Object.assign(yn,{className:"tpo_modal-footer-group"});let hn=document.createElement("button");Object.assign(hn,{className:"button-modal",innerHTML:l.Cancel&&l.Cancel[s]||"Cancel",onclick:Qe});let gn=document.createElement("button");Object.assign(gn,{className:"button-modal primary",innerHTML:l.Confirm&&l.Confirm[s]||"Confirm",onclick:Ge});let bn=document.createElement("div");Object.assign(bn,{className:"tpo_modal-footer-group"}),bn.append(hn,gn),yn.append(bn),window.addEventListener("click",(function(e){e.target===un&&Qe()}));let wn=document.createElement("span");Object.assign(wn,{className:"tpo_additional-price absolute active product-list"}),Rr(Y,wn,h);let Sn=document.createElement("input");if(Object.assign(Sn,{className:"tpo_hidden-checkbox",type:"text",name:`properties[${ge?"_":""}${E}]`,id:"product-list-input"+(void 0!==c?`-${c}`:""),value:"",ariaLabel:E}),re.enable&&(re.configs.showTotalSelected?_e="exact_count":re.configs.isShowNewTotalSelected?_e=re.configs.isUseMinMaxSelected?"min_max_count":"only_total":re.configs.isUseMinMaxSelected&&(_e="min_max_not_count")),re.enable&&_e){let{totalQuantitySelectorElementWrapperRender:Fs,errorTotalElementRender:js}=Fr(re,Lo,_e);de=Fs,ue=js}de&&me.append(de),ce.append(me),Sn.dataset.required=y||x&&$,_&&Sn.setAttribute("form",_);let En=document.createElement("div");Object.assign(En,{className:"tpo_modal-content"});let $n=document.createElement("div");Object.assign($n,{className:"tpo_option-input-wrapper-filter",innerHTML:'\n \n '});let Cn=document.createElement("input");function Qe(){dn?un&&"function"==typeof un.close&&(un.close(),un.style.display="none"):un.style.display="none",an=[...nn],on=[...tn],Sn.value=tn.join(", "),sn=[...rn],cn=[...pn],rn.length?(ln.price=rn.reduce((function(e,t){return e+t.price}),0),wa(Xi,wn,Mr(ln.price)?ln.price.toFixed(2):ln.price)):wa(Xi,wn,0),p?va(La(i,a),i):La(i,a);const e=window.Konva.stages[0]?.find(`.product-list-${O.split(",")[1]}`);if(0===x)if(an&&tn.length>0){const e=h.find((e=>e.id===an[0])),{image_canvas_url:t,image_url:o}=e||{};ls(O,t||o,!0)}else e?.[0]?.hide();else e.forEach((e=>{const t=e.id();an.includes(t)?e.show():e.hide()}));setTimeout((()=>{Sn.dispatchEvent(new Event("change"))}),0)}function Ge(){if(!(mn&&re.enable&&re.configs.hasLimitations&&Array.from(mn.querySelectorAll(".tpo_quantity-selector_wrapper")).some((e=>e.classList.contains("tpo-error_validate"))))){if(dn?un&&"function"==typeof un.close&&(un.close(),un.style.display="none"):un.style.display="none",nn=[...an],tn=[...on],Sn.value=on.join(", "),rn=[...sn],re.enable){if(pn=[...cn],io.length){const e=io.findIndex((e=>e.idValue===O));e>-1?io[e].value=[...pn]:-1===e&&io.push({idValue:O,value:[...pn]})}else io.push({idValue:O,value:[...pn]});const e=pn.map((e=>e.label));Sn.value=e.join(", ")}Xe(),re.enable?sn.length?(ln.price=sn.reduce((function(e,t,o){const i=pn[o].quantity;return e+t.price*Number(i)}),0),wa(Xi,wn,Mr(ln.price)?ln.price.toFixed(2):ln.price)):wa(Xi,wn,0):sn.length?(ln.price=sn.reduce((function(e,t){return e+t.price}),0),wa(Xi,wn,Mr(ln.price)?ln.price.toFixed(2):ln.price)):wa(Xi,wn,0),p?va(La(i,a),i):La(i,a),setTimeout((()=>{Sn.dispatchEvent(new Event("change"))}),0)}}function Xe(e){if(document.getElementById(`${O},${v}`)&&Ze(),re&&re.enable){if(_n){for(;_n.firstChild;)_n.removeChild(_n.firstChild);const e=pn.map((e=>{if(e){let t=document.createElement("span");return Object.assign(t,{className:"selected_prd_list-tag selected_prd_list-tag-lg",textContent:e.label}),t}}));_n.append(...e)}_e&&$r(ce,0,re.configs,ue,mn)}else if(_n){for(;_n.firstChild;)_n.removeChild(_n.firstChild);const e=nn.map((e=>{if(e){let t=h.find((t=>t.id===e)),o=document.createElement("span");return Object.assign(o,{className:"selected_prd_list-tag selected_prd_list-tag-lg",textContent:t.label}),o}}));_n.append(...e)}Na(m,`${O},${v}`,v,nn)}function Ze(){if(ce.contains(Ee)||me.append(Se,Ee),!y&&!$&&!C)return!0;const e=nn.length;return x&&$&&e<$?(Ee.innerHTML=$o?ba($o,$):`Please select at least ${$} options`,!1):x&&C&&e>C?(Ee.innerHTML=Co?ba(Co,C):`Please select at maximum ${C} options`,!1):y&&e<1?(Ee.innerHTML=fo?ba(fo,""):"This is a required option",!1):(Ee.innerHTML="",!0)}Object.assign(Cn,{className:"tpo_option-input tpo_text-box tpo_modal-content_filter",placeholder:l["Search options"]?.[s]||"Search options",ariaLabel:E}),Cn.addEventListener("input",(function(t){const o=t.target.value;let n=h.filter((e=>-1!==e?.label.toLowerCase().indexOf(o.toLowerCase())));cn=[...pn],ma(i,a,n,E,x,I,0,0,0,sn,0,0,q,an,we,0,Xe,!0,on,c,e,p,re,Cr,0,0,0,cn,mn)})),$n.append(Cn),en||En.append($n),ma(i,a,h,E,x,I,0,0,0,sn,0,0,q,an,we,0,Xe,!1,on,c,e,p,re,Cr,0,0,0,cn,mn),n.type="button",n.addEventListener("click",(function(){Ze()})),Ge(),En.append(we),mn.append(En),mn.append(yn),un.append(mn),me.append(fn,wn,Sn,_n),de&&me.append(de),ue&&me.append(ue),me.append(Se),ce.contains(Ee)||me.append(Ee),document.body.append(un),ce.append(me),Sn.addEventListener("change",(function(){const e=mn.querySelectorAll(".tpo_radio-button");Vr(Sn,e)})),e.option_types.some((e=>e.is_default))&&Xe();break;case"spacer":const xn=JSON.parse(T||"{}").spacerHeight||0;let kn=document.createElement("div");kn.style.height=`${xn}px`,kn.innerHTML="",ce.append(kn);break;case"date-picker":const Ln=T&&JSON.parse(T).default_value||"";Tt("link","stylesheet",ot),Object.assign(we,{className:"tpo_option-input-wrapper",innerHTML:Yi?'':''});let qn=document.createElement("span");Object.assign(qn,{className:"tpo_additional-price absolute"}),wa(Xi,qn,L);let Tn=function(e,t,i,n,a,r,s,l,c,p,d,u){const{is_required:m,placeholder:_,type:f,option_identifier:y,multi_select:h,option_id:g,date_time_type:b="all",date_time_values:v="[]",metadata:w}=e;let S=document.createElement("input");const E=`date-picker-${g}`;S.setAttribute("id",E);let $=JSON.parse(w||"{}");const C=$?.dataCutOffTime,x=C?.enable,k=C?.configs||{},L=k?.sameDay,q=k?.nextDay,T=$?.formatDatePicker;let O=L&&L.enable?L?.data.map(((e={})=>{let t;switch(e?.key){case"Monday":return t=1,{...e,key:t};case"Tuesday":return t=2,{...e,key:t};case"Wednesday":return t=3,{...e,key:t};case"Thursday":return t=4,{...e,key:t};case"Friday":return t=5,{...e,key:t};case"Saturday":return t=6,{...e,key:t};case"Sunday":return t=0,{...e,key:t}}})):[],A=q&&q.enable?q?.data.map(((e={})=>{let t;switch(e?.key){case"Monday":return t=1,{...e,key:t};case"Tuesday":return t=2,{...e,key:t};case"Wednesday":return t=3,{...e,key:t};case"Thursday":return t=4,{...e,key:t};case"Friday":return t=5,{...e,key:t};case"Saturday":return t=6,{...e,key:t};case"Sunday":return t=0,{...e,key:t}}})):[],N=[],P=[];switch(b){case"all":default:break;case"except_date":P=[...v];break;case"except_weekday":let e=v.map((e=>{switch(e){case"Monday":return 1;case"Tuesday":return 2;case"Wednesday":return 3;case"Thursday":return 4;case"Friday":return 5;case"Saturday":return 6;case"Sunday":return 0}}));P=[function(t){const o=t.getDay();return e.includes(o)}];break;case"specific_date":N=[...v];break;case"specific_period":N=[{from:v[0],to:v[1]}]}const M={mode:"single",disableMobile:"true",dateFormat:"Y-m-d",defaultDate:u};$&&!b&&($.allDays||(P=[function(e){e.setHours(0);const t=e.getDay(),i=e.getFullYear(),n=String(e.getMonth()+1).padStart(2,"0"),a=String(e.getDate()).padStart(2,"0"),r=`${i}-${n}-${a}`;let s=new Date;s.setHours(0);let l=String(s.getDate()).padStart(2,"0"),c=!1,p=!1,d=!1,u=!1,m=!1,_=!1;if($.disableSpecificDays&&$.disableSpecificDaysValue&&(c=$.disableSpecificDaysValue.includes(r)),$.disableDaysOfTheWeek&&$.disableDaysOfTheWeekValue&&$.disableDaysOfTheWeekValue.length&&$.disableDaysOfTheWeekValue.map((e=>{switch(e){case"Monday":return 1;case"Tuesday":return 2;case"Wednesday":return 3;case"Thursday":return 4;case"Friday":return 5;case"Saturday":return 6;case"Sunday":return 0}})).includes(t)&&(p=!0),$.disablePastDays&&($.disablePastDaysIncludeToday?new Date(e.toDateString())<=new Date(s.toDateString())&&(m=!0):new Date(e.toDateString())new Date(e.toDateString())&&(u=!0)}if($.disableDatesAfter&&$.disableDatesAfterValue){let t=new Date($.disableDatesAfterValue);t.setHours(0),new Date(e.toDateString())>new Date(t.toDateString())&&(d=!0)}if($.enableDatesAfterXDaysFromToday){let t=parseInt($?.enableXDaysValue||0),o=new Date;o.setDate(o.getDate()+t),o.setHours(0),new Date(e.toDateString())<=new Date(o.toDateString())&&(c=!0)}if($.enableSpecificDays&&$.enableSpecificDaysValue){if($.enableSpecificDaysValue.includes(r))return!1;c=!0}if($.enableSpecificPeriod&&$.enableSpecificPeriodValue)if($.enableSpecificPeriodValue.length)for(let t=0;t<$.enableSpecificPeriodValue.length;t++){let o=new Date($.enableSpecificPeriodValue[t][0]),i=new Date($.enableSpecificPeriodValue[t][1]);if(o.setHours(0),i.setHours(0),new Date(e.toDateString())>=new Date(o.toDateString())&&new Date(i.toDateString())>=new Date(e.toDateString()))return!1;c=!0}else c=!0;if(x){let i=new Date(s);if(i.setDate(i.getDate()+2),new Date(e.toDateString())=new Date(i.toDateString()));else{if(L&&L.enable){const e=O.find((e=>e?.key===t));if(e&&l===a){let t=e.value.match(/(\d{2}):(\d{2}):(\d{2}) GMT([+-]\d{4})/);if(t){let e=parseInt(t[1]),i=parseInt(t[2]),n=parseInt(t[3]),a=60*parseInt(t[4].substring(0,3)),r=new Date;r.setUTCHours(e,i-a,n,0);let s=new Date;if(o){const{DateTime:t}=luxon;r=t.now().setZone(o).set({hour:e,minute:i,second:n}),s.getTime()>r.ts&&(_=!0)}else s>r&&(_=!0)}}}if(q&&q.enable){let e=new Date(s);e.setDate(e.getDate()+1);let t=String(e.getDate()).padStart(2,"0");const i=A.find((e=>e?.key===s.getDay()));if(i&&t===a){let e=i.value.match(/(\d{2}):(\d{2}):(\d{2}) GMT([+-]\d{4})/);if(e){let t=parseInt(e[1]),i=parseInt(e[2]),n=parseInt(e[3]),a=60*parseInt(e[4].substring(0,3)),r=new Date;r.setUTCHours(t,i-a,n,0);let s=new Date;if(o){const{DateTime:e}=luxon;r=e.now().setZone(o).set({hour:t,minute:i,second:n}),s.getTime()>r.ts&&(_=!0)}else s>r&&(_=!0)}}}}}return _||m||c||p||d||u}])),h&&(M.mode="multiple"),N.length&&(M.enable=N),P.length&&(M.disable=P);["4e8e97-2.myshopify.com","pinkylab-6384.myshopify.com","cb5770-2.myshopify.com"].includes(Q)?M.minDate="today":["honey-bug.myshopify.com"].includes(Q)?M.minDate=new Date((new Date).getTime()+864e6):["63d5ca-ae.myshopify.com"].includes(Q)?M.minDate=new Date((new Date).getTime()+864e5):"067099-3.myshopify.com"===Q&&(M.minDate=new Date((new Date).getTime()+11232e5)),T&&(M.dateFormat=T),["38732f-2.myshopify.com","0ea73a-c1.myshopify.com","crystycrystals.myshopify.com","236e7d-f6.myshopify.com","308b83.myshopify.com","dandys-topsoil.myshopify.com","prints-by-mi.myshopify.com","ideen-fra-feen.myshopify.com"].includes(Q)?(M.dateFormat="d-m-Y",M.enable&&(M.enable=M.enable.map((e=>"string"==typeof e?e?.split("-").reverse().join("-"):{from:e?.from?.split("-").reverse().join("-"),to:e?.to?.split("-").reverse().join("-")})))):["hoa-test-store.myshopify.com","quality-growers-floral-company.myshopify.com"].includes(Q)?M.dateFormat="m-d-Y":["tigren-demo.myshopify.com","island-to-east-side.myshopify.com"].includes(Q)&&(M.dateFormat="m.d.y"),Ot(M),"function"==typeof flatpickr&&("nellys-grannys.myshopify.com"===Q&&(flatpickr.l10ns.default.firstDayOfWeek=1),flatpickr(S,M)),S.addEventListener("change",(function(e){const o=e.target.value;c(o),n(o),o?a.classList.add("active"):a.classList.remove("active"),d?va(La(t,i),t):La(t,i)})),Object.assign(S,{className:`tpo_option-input tpo_text-box tpo_${Ai.fontStyle}`,type:"text",name:`properties[${y}]`,id:`${f}-${g}`,placeholder:_||"Select a date",ariaLabel:y}),S.dataset.required=m;let F=t?.attributes.id?.value||null;return F&&S.setAttribute("form",F),S.style.fontSize=`${Ai.fontSize}px`,Ai?.fontFamily&&(S.style.fontFamily=Ai.fontFamily),S.style.color=vi.inputText_enteredValue??Ai.fontColor,S.style.backgroundColor=vi.inputBackground_unselected??Bi.background,S.style.borderColor=vi.inputBorder_unselected??Bi.borderColor,S.style.borderRadius=`${$i.inputBorderRadius}px`,S.style.setProperty("--active-input-border",vi.inputBorder_selected||Bi.activeBorderColor||""),S.style.setProperty("--placeholder-input-text",vi.inputText_placeholder||""),S.style.setProperty("--active-input-background",vi.inputBackground_selected||""),l.type="button",l.addEventListener("click",(function(){let e=n(S.value);e&&La(t,i)&&r(S,e,s)})),S}(e,i,a,(function(e){let t=e?e.split(/[.,\s]+/).length:0;return y||$||C?x&&$&&t<$?(Ee.innerHTML=$o?ba($o,$):`Please select at least ${$} date`,!1):x&&C&&t>C?(Ee.innerHTML=Co?ba(Co,C):`Please select at maximum ${C} dates`,!1):y&&t<1?(Ee.innerHTML=fo?ba(fo,""):"This is a required option",!1):(Ee.innerHTML="",e):(Ee.innerHTML="",e)}),qn,xe,L,n,(function(e){Na(m,`${O},${v}`,v,e)}),0,p,Ln);Ln&&(Tn.value=Ln,Tn.dispatchEvent(new Event("change"))),we.append(Tn,qn),me.append(we,Se,Ee),ce.append(me);break;case"date-range":const On=T&&JSON.parse(T).default_value||[];Tt("link","stylesheet",ot),Object.assign(we,{className:"tpo_option-input-wrapper",innerHTML:Yi?'\n\n\n\n\n\n\n\n\n':''});let Pn=document.createElement("span");Object.assign(Pn,{className:"tpo_additional-price absolute"}),wa(Xi,Pn,L);let Mn=function(e,t,o,i,n,a,r,s,l,c,p,d){const{is_required:u,placeholder:m,type:_,option_identifier:f,option_id:y,date_time_type:h="all",date_time_values:g="[]",metadata:b}=e;let v=JSON.parse(b||"{}");const w=v?.formatDateRange;let S=document.createElement("input");const E=`date-picker-${y}`;S.setAttribute("id",E);let $=[],C=[];switch(h){case"all":default:break;case"except_date":C=[...g];break;case"except_weekday":let e=g.map((e=>{switch(e){case"Monday":return 1;case"Tuesday":return 2;case"Wednesday":return 3;case"Thursday":return 4;case"Friday":return 5;case"Saturday":return 6;case"Sunday":return 0}}));C=[function(t){const o=t.getDay();return e.includes(o)}];break;case"specific_period":$=[{from:g[0],to:g[1]}]}const x={mode:"range",disableMobile:"true",dateFormat:"Y-m-d",defaultDate:d};$.length&&(x.enable=$),w&&(x.dateFormat=w),C.length&&(x.disable=C),Ot(x),"function"==typeof flatpickr&&flatpickr(S,x),S.addEventListener("change",(function(e){const a=e.target.value;l(a),i(a),a?n.classList.add("active"):n.classList.remove("active"),p?va(La(t,o),t):La(t,o)})),Object.assign(S,{className:`tpo_option-input tpo_text-box tpo_${Ai.fontStyle}`,type:"text",name:`properties[${f}]`,id:`${_}-${y}`,placeholder:m,ariaLabel:f}),S.dataset.required=u;let k=t?.attributes.id?.value||null;return k&&S.setAttribute("form",k),S.style.fontSize=`${Ai.fontSize}px`,Ai?.fontFamily&&(S.style.fontFamily=Ai.fontFamily),S.style.color=vi.inputText_enteredValue??Ai.fontColor,S.style.backgroundColor=vi.inputBackground_unselected??Bi.background,S.style.borderColor=vi.inputBorder_unselected??Bi.borderColor,S.style.borderRadius=`${$i.inputBorderRadius}px`,S.style.setProperty("--active-input-border",vi.inputBorder_selected||Bi.activeBorderColor||""),S.style.setProperty("--placeholder-input-text",vi.inputText_placeholder||""),S.style.setProperty("--active-input-background",vi.inputBackground_selected||""),s.type="button",s.addEventListener("click",(function(){let e=i(S.value);e&&La(t,o)&&a(S,e,r)})),S}(e,i,a,Ce,Pn,xe,L,n,(function(e){Na(m,`${O},${v}`,v,e)}),0,p,On);On.length&&(Mn.value=On.join(" to "),Mn.dispatchEvent(new Event("change"))),we.append(Mn,Pn),me.append(we,Se,Ee),ce.append(me);break;case"time-picker":const Fn=T&&JSON.parse(T).default_value||{};Tt("link","stylesheet",ot),Object.assign(we,{className:"tpo_option-input-wrapper",innerHTML:Yi?'':''});let jn=document.createElement("span");Object.assign(jn,{className:"tpo_additional-price absolute"}),wa(Xi,jn,L);let In=function(e,t,o,i,n,a,r,s,l,c,p,d){const{is_required:u,placeholder:m,type:_,option_identifier:f,option_id:y,date_time_type:h="24h"}=e;let g=document.createElement("input");const b=`time-picker-${y}`;g.setAttribute("id",b);let v={disableMobile:"true",enableTime:!0,noCalendar:!0};"12h"===h&&(v.time_24hr=!1,v.dateFormat="G:i K"),"24h"===h&&(v.time_24hr=!0,v.dateFormat="H:i"),d&&d.default_hour&&(v.defaultHour=d.default_hour),d&&d.default_minute&&(v.defaultMinute=d.default_minute),Ot(v),"function"==typeof flatpickr&&flatpickr(g,v),g.addEventListener("change",(function(e){const a=e.target.value;l(a),i(a),a?n.classList.add("active"):n.classList.remove("active"),p?va(La(t,o),t):La(t,o)})),Object.assign(g,{className:`tpo_option-input tpo_text-box time_picker-container tpo_${Ai.fontStyle}`,type:"text",name:`properties[${f}]`,id:`${_}-${y}`,placeholder:m||"Select a time",ariaLabel:f}),g.dataset.required=u;let w=t?.attributes.id?.value||null;return w&&g.setAttribute("form",w),g.style.fontSize=`${Ai.fontSize}px`,Ai?.fontFamily&&(g.style.fontFamily=Ai.fontFamily),g.style.color=vi.inputText_enteredValue??Ai.fontColor,g.style.backgroundColor=vi.inputBackground_unselected??Bi.background,g.style.borderColor=vi.inputBorder_unselected??Bi.borderColor,g.style.borderRadius=`${$i.inputBorderRadius}px`,g.style.setProperty("--active-input-border",vi.inputBorder_selected||Bi.activeBorderColor||""),g.style.setProperty("--placeholder-input-text",vi.inputText_placeholder||""),g.style.setProperty("--active-input-background",vi.inputBackground_selected||""),s.type="button",s.addEventListener("click",(function(){let e=i(g.value);!1!==e&&""!==e&&La(t,o)&&a(g,e,r)})),g}(e,i,a,Ce,jn,xe,L,n,(function(e){Na(m,`${O},${v}`,v,e)}),0,p,Fn);Fn&&Fn.string_value&&(In.value=Fn.string_value,In.dispatchEvent(new Event("change"))),we.append(In,jn),me.append(we,Se,Ee),ce.append(me);break;case"group":const Hn=y,Bn=JSON.parse(T||"{}").childOptions||[],Dn=[];Bn.forEach((e=>{const o=K?e:`${c},${e}`,i=t.find((e=>e.id===o));i&&Dn.push(i)}));const zn=Dn.map((e=>ia(e,Dn,i,n,a,r=!0,"",p,t)));Object.assign(me,{className:"tpo_option-group_wrapper "+(Hn?"show":""),innerHTML:`\n
\n \n ${b}\n \n
\n \n ${Yi?'\n \n ':'\n \n '}\n \n
\n \n
\n `}),me.firstElementChild.onclick=function(){we.hidden=!we.hidden,me.classList.toggle("show")},Object.assign(we,{className:"tpo_option-group_child-wrapper",hidden:!Hn}),we.append(...zn),me.append(we,Se),ce.append(me);break;case"color-picker":const Vn=T?JSON.parse(T):{};if(!Object.keys(Vn).length)return"";const{enableColorPreview:Un,textBoxIdentifier:Jn,textBoxIdentifierV2:Rn,default_value:Wn=""}=Vn;Object.assign(we,{className:"tpo_color-picker-wrapper"});let Qn=document.createElement("span");Object.assign(Qn,{className:"tpo_additional-price absolute active"}),Rr(Y,Qn,h);let Gn=document.createElement("input");Object.assign(Gn,{className:"tpo_hidden",value:"#000000",name:`properties[${E}]`}),_&&Gn.setAttribute("form",_);let Xn=document.createElement("input");Object.assign(Xn,{className:"tpo_color-picker_input",type:"color"}),Xn.addEventListener("input",(function(e){let t=e.target.value;hs(O,"name",t,!0,"COLOR"),"modern"!==wi?.appTheme?Yn.firstElementChild.style.fill=t:(Yn.classList.add("has-value"),Yn.firstElementChild.style.setProperty("--color-picker-value",t)),Zn.textContent=t,Gn.value=t,Zn.textContent=t,wa(Xi,Qn,L),xe(Gn,Gn.value,L),p?va(La(i,a),i):La(i,a),Un&&!ce.classList.contains("tpo_hidden")&&(na(ce,Jn,t),aa(ce,Rn,t))}));let Zn=document.createElement("span");Zn.classList.add("tpo_color-picker_value"),Zn.textContent=l["Choose color"]&&l["Choose color"][s]||"Choose color";let Yn=document.createElement("span");Object.assign(Yn,{className:"tpo_color-picker_icon",innerHTML:Yi?'\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n ':'\n \n \n \n '});let Kn=document.createElement("label");Object.assign(Kn,{className:"tpo_color-picker_label"}),Wn&&(Xn.value=Wn,setTimeout((()=>{Xn.dispatchEvent(new Event("input"))}),0)),-1===window.navigator.userAgent.lastIndexOf("iPhone; CPU iPhone OS")&&-1===window.navigator.userAgent.lastIndexOf("iPad; CPU OS")||(Xn.style.visibility="initial",Xn.style.position="relative",Yn.style.display="none"),Kn.append(Yn,Xn,Zn),we.append(Kn,Gn,Qn),me.append(we,Se),ce.append(me);break;case"quantity":const ea=T&&JSON.parse(T).default_value||"";Object.assign(we,{className:"tpo_option-input-wrapper"});let ta=document.createElement("span");Object.assign(ta,{className:"tpo_additional-price absolute"}),"all"===M&&wa(Xi,ta,L);let oa=function(e,t,o,i,n,a,r,c,p,d,u,m,_,f,y){const{is_required:h,placeholder:g,type:b,option_id:v,option_identifier:w,option_label:S,price_type:E,metadata:$}=e;let{label:C="",additional_price:x=null,product_id:k,variant_id:L}=f||{};const q=JSON.parse($||"{}").formula,T=JSON.parse($||"{}").useFormula||!1,O=JSON.parse($||"{}").separateAddOnProduct||!1,A=!!["all_with_new_price","one_with_new_price","one_formula"].find((e=>e===E));let N={};(L&&"product_add_ons"===E||A&&"one_formula"!==E&&L)&&vn.forEach((e=>{e.variants.forEach((t=>{`${t.id}`===L&&(N={...e,variants:[{...t}]},f.label="Default Title"===t?.title?t?.name:t?.title,C=f.label)}))}));const P=void 0===N?.variants||N.variants[0].available;N?.variants&&"one_formula"!==E&&(c=N.variants[0].price/100);let M=l["SOLD OUT"]&&l["SOLD OUT"][s]||"SOLD OUT";P||(f.label=`${C} - ${M}`,C=f.label);let F=document.createElement("input");F.addEventListener("input",(function(e){d(e.target.value);let o=n(e.target.value);m(!1!==o&&""!==o&&Xi,a,c,e.target.value,E,q,T),e.target.value?a.classList.add("active"):a.classList.remove("active"),_?va(La(t,i),t):La(t,i)})),"one"===E||"product_add_ons"===E||"one_with_new_price"===E||"one_formula"===E?F.addEventListener("blur",(function(){let e=n(F.value);!1!==e&&""!==e?(m(Xi,a,c,F.value,E,q,T),e&&(L&&(F.value=Math.ceil(F.value)),u(F,F.value,c,E,q,T))):m(!1,a,c,F.value,E,q,T)})):F.addEventListener("blur",(function(){let e=n(F.value);!1!==e&&""!==e&&La(t,i)?(m(Xi,a,c,F.value,E,q,T),e&&(L&&(F.value=Math.ceil(F.value)),u(F,F.value,c,E,q,T))):m(!1,a,c,F.value,E,q,T)})),F.addEventListener("focus",(function(){let e=/ \[ \+(.*) \]/,t=F.value.match(e);F.value=t?F.value.replace(e,""):F.value})),Object.assign(F,{className:`tpo_option-input tpo_quantity tpo_${Ai.fontStyle}`,name:`properties[${O?"_":""}${w}]`,id:`${b}-${v}`,placeholder:g,type:"text",readOnly:!P,autocomplete:"off",ariaLabel:w}),F.dataset.required=h,o&&F.setAttribute("form",o),F.style.fontSize=`${Ai.fontSize}px`,Ai?.fontFamily&&(F.style.fontFamily=Ai.fontFamily),F.style.color=vi.inputText_enteredValue??Ai.fontColor,F.style.backgroundColor=vi.inputBackground_unselected??Bi.background,F.style.borderColor=vi.inputBorder_unselected??Bi.borderColor,F.style.borderRadius=`${$i.inputBorderRadius}px`,F.style.width=`${Ei.quantitySelectorWidth}px`,F.style.setProperty("--active-input-border",vi.inputBorder_selected||Bi.activeBorderColor||""),F.style.setProperty("--placeholder-input-text",vi.inputText_placeholder||""),F.style.setProperty("--active-input-background",vi.inputBackground_selected||"");let j=document.createElement("div");return Object.assign(j,{className:"tpo_quantity-container",innerHTML:`\n ${S||C}\n `}),j.appendChild(F),p.type="button","one"===E||"product_add_ons"===E?p.addEventListener("click",(function(){let e=n(F.value);!1!==e&&""!==e&&La(t,i)?(m(Xi,a,c,F.value,E,q,T),e&&u(F,F.value,c,E,q,T)):m(!1,a,c,F.value,E,q,T)})):p.addEventListener("click",(function(){let e=n(F.value);!1!==e&&""!==e&&La(t,i)?(m(Xi,a,c,F.value,E,q,T),e&&u(F,F.value,c,E,q,T)):m(!1,a,c,F.value,E,q,T)})),y&&(F.value=y,F.dispatchEvent(new Event("input"))),j}(e,i,_,a,(function(e){let t=/^\d+(\.\d+)?$/,o=e.match(/\[ \+(.*)\]/);const i=(e=o?e.replace(/\[ \+(.*)\]/,""):e).trim().match(t);e=i?i[0]:e;let n=t.test(e);if(!e&&(Ee.innerHTML="",me.removeAttribute("data-error"),!y))return e;if(me.setAttribute("data-error",""),n)e=parseFloat(e||0);else if(e)return e=e?parseFloat(e):"",Ee.innerHTML=Oo?ba(Oo,""):"This input value is not numeric!",!1;return NaN===e&&y||e<1&&y?(Ee.innerHTML=_o?ba(_o,""):"This is a required field",!1):$&&e<$?(Ee.innerHTML=So?ba(So,$):`Please enter a minimum value of ${$}`,!1):C&&e>C?(Ee.innerHTML=Eo?ba(Eo,C):`Please enter a maximum value of ${C}`,!1):(me.removeAttribute("data-error"),Ee.innerHTML="",e)}),ta,0,L,n,(function(e){Na(m,`${O},${v}`,v,e)}),(function(e,t,o,i,n="",a=!1){if(o){let r="",s=t.toString();if(s&&s.endsWith("]")){const e=s.indexOf("[");s=s.slice(0,e-1).trim()}if("one"===i||"product_add_ons"===i||"one_formula"===i||"one_with_new_price"===i){let e=Ca({value:s,price:o,formula:n,useFormula:a,priceType:i});r=PriceFormatter.formatMoney(parseFloat(e),!1)}else r=PriceFormatter.formatMoney(parseFloat(100*o),!1);let l=t.toString();l.endsWith("]")||(l+="]");let c=/\[ \+(.*) \]/;l.match(c),t&&(e.value=`${s} [ +${r} ]`)}else{let o=t.toString();if(o&&o.endsWith("]")){const e=o.indexOf("[");o=o.slice(0,e-1).trim()}e.value=o}}),xa,p,h[0],ea);we.append(oa,ta),me.append(we,Se,Ee),ce.append(me);break;case"dimension":if(!Object.keys(te).length)return"";const{labelX:ra="",labelY:sa="",labelZ:Sa="",suffixX:ka="",suffixY:qa="",suffixZ:Ta="",valueX:Oa="",valueY:Aa="",valueZ:Pa="",formula:Ma="x * y * {{price}}",minX:Fa="",minY:ja="",minZ:Ia="",maxX:Ha="",maxY:Ba="",maxZ:Da="",linkedDropdowns:za=[],tablePricing:Va={}}=te;Object.assign(we,{className:"tpo_dimension_wrapper"});let Ua=document.createElement("label");Object.assign(Ua,{className:"tpo_dimension_label",innerHTML:`\n ${ra}\n `});let Ja=document.createElement("div");Object.assign(Ja,{className:"tpo_dimension_input-wrapper",innerHTML:`\n \n ${ka}\n `}),Ja.firstElementChild.style.fontSize=`${Ai.fontSize}px`,Ai?.fontFamily&&(Ja.firstElementChild.style.fontFamily=Ai.fontFamily),Ja.firstElementChild.style.color=vi.inputText_enteredValue??Ai.fontColor,Ja.firstElementChild.style.backgroundColor=vi.inputBackground_unselected??Bi.background,Ja.firstElementChild.style.borderColor=vi.inputBorder_unselected??Bi.borderColor,Ja.firstElementChild.style.borderRadius=`${$i.inputBorderRadius}px`,Ja.firstElementChild.style.setProperty("--active-input-border",vi.inputBorder_selected||Bi.activeBorderColor||""),Ja.firstElementChild.style.setProperty("--placeholder-input-text",vi.inputText_placeholder||""),Ja.firstElementChild.style.setProperty("--active-input-background",vi.inputBackground_selected||"");let Ra=document.createElement("div");Object.assign(Ra,{className:`tpo_error-message tpo_${Oi.fontStyle}`,innerHTML:""}),Ra.style.fontSize=`${Oi.fontSize}px`,Ra.style.color=vi.errorMessageColor??Oi.fontColor,Oi?.fontFamily&&(Ra.style.fontFamily=Oi.fontFamily),(ra.length||Oa.length||ka.length)&&(Ua.append(Ja),Ua.append(Ra));let Wa=document.createElement("label");Object.assign(Wa,{className:"tpo_dimension_label",innerHTML:`\n ${sa}\n `});let Qa=document.createElement("div");Object.assign(Qa,{className:"tpo_dimension_input-wrapper",innerHTML:`\n \n ${qa}\n `}),Qa.firstElementChild.style.fontSize=`${Ai.fontSize}px`,Ai?.fontFamily&&(Qa.firstElementChild.style.fontFamily=Ai.fontFamily),Qa.firstElementChild.style.color=vi.inputText_enteredValue??Ai.fontColor,Qa.firstElementChild.style.backgroundColor=vi.inputBackground_unselected??Bi.background,Qa.firstElementChild.style.borderRadius=`${$i.inputBorderRadius}px`,Qa.firstElementChild.style.borderColor=vi.inputBorder_unselected??Bi.borderColor,Qa.firstElementChild.style.setProperty("--active-input-border",vi.inputBorder_selected||Bi.activeBorderColor||""),Qa.firstElementChild.style.setProperty("--placeholder-input-text",vi.inputText_placeholder||""),Qa.firstElementChild.style.setProperty("--active-input-background",vi.inputBackground_selected||"");let Ga=document.createElement("div");Object.assign(Ga,{className:`tpo_error-message tpo_${Oi.fontStyle}`,innerHTML:""}),Ga.style.fontSize=`${Oi.fontSize}px`,Ga.style.color=vi.errorMessageColor??Oi.fontColor,Oi?.fontFamily&&(Ga.style.fontFamily=Oi.fontFamily),(sa.length||Aa.length||qa.length)&&(Wa.append(Qa),Wa.append(Ga));let Xa=document.createElement("label");Object.assign(Xa,{className:"tpo_dimension_label",innerHTML:`\n ${Sa}\n `});let Za=document.createElement("div");Object.assign(Za,{className:"tpo_dimension_input-wrapper",innerHTML:`\n \n ${Ta}\n `}),Za.firstElementChild.style.fontSize=`${Ai.fontSize}px`,Ai?.fontFamily&&(Za.firstElementChild.style.fontFamily=Ai.fontFamily),Za.firstElementChild.style.color=vi.inputText_enteredValue??Ai.fontColor,Za.firstElementChild.style.backgroundColor=vi.inputBackground_unselected??Bi.background,Za.firstElementChild.style.borderColor=vi.inputBorder_unselected??Bi.borderColor,Za.firstElementChild.style.borderRadius=`${$i.inputBorderRadius}px`,Za.firstElementChild.style.setProperty("--active-input-border",vi.inputBorder_selected||Bi.activeBorderColor||""),Za.firstElementChild.style.setProperty("--placeholder-input-text",vi.inputText_placeholder||""),Za.firstElementChild.style.setProperty("--active-input-background",vi.inputBackground_selected||"");let Ka=document.createElement("div");Object.assign(Ka,{className:`tpo_error-message tpo_${Oi.fontStyle}`,innerHTML:""}),Ka.style.fontSize=`${Oi.fontSize}px`,Ka.style.color=vi.errorMessageColor??Oi.fontColor,Oi?.fontFamily&&(Ka.style.fontFamily=Oi.fontFamily),(Sa.length||Pa.length||Ta.length)&&(Xa.append(Za),Xa.append(Ka)),n.type="button",n.addEventListener("click",(function(){ce.classList.contains("tpo_hidden")||(Ja.firstElementChild.value.length&&(Ja.firstElementChild.value.includes(ka)||(Ja.firstElementChild.value+=` ${ka}`,setTimeout((()=>{Ja.firstElementChild.value=Ja.firstElementChild.value.replace(` ${ka}`,"")}),0))),Qa.firstElementChild.value.length&&(Qa.firstElementChild.value.includes(qa)||(Qa.firstElementChild.value+=` ${qa}`,setTimeout((()=>{Qa.firstElementChild.value=Qa.firstElementChild.value.replace(` ${qa}`,"")}),0))),Za.firstElementChild.value.length&&(Za.firstElementChild.value.includes(Ta)||(Za.firstElementChild.value+=` ${Ta}`,setTimeout((()=>{Za.firstElementChild.value=Za.firstElementChild.value.replace(` ${Ta}`,"")}),0))))}));const er=[{min:Fa,max:Ha},{min:ja,max:Ba},{min:Ia,max:Da}];[Ja.firstElementChild,Qa.firstElementChild,Za.firstElementChild].forEach(((e,t)=>{const o=e.parentElement.parentElement?.lastElementChild||document.createElement("div");e.addEventListener("input",(function(n){let r=n.target.value;r=r.replace(/e/g,""),/^\d*\.?(?!\.)\d*$/.test(r)||(r=r.replace(/[^\d\.]/g,"")),n.target.value=r,Ye(er[t],r,o,e)&&(Ke(),va(La(i,a),i))}))}));let tr=document.createElement("span");Object.assign(tr,{className:"tpo_additional-price absolute active"}),Rr(Y,tr);const or=document.createElement("input");function Ye(e,t,o,i){t.length||(t=0,i.removeAttribute("data-error"));const{min:n,max:a}=e;return t=parseFloat(t),i.setAttribute("data-error",""),n.length&&tNumber(a)?(o.innerHTML=Eo?ba(Eo,a):`Please enter a maximum value of ${a}`,!1):(i.removeAttribute("data-error"),o.innerHTML="",!0)}function Ke(){const e=$a({xValue:Ja.firstElementChild.value,yValue:Qa.firstElementChild.value,zValue:Za.firstElementChild.value,tablePricing:Va}),{valid:t,tablePrice:o}=e,n=Ea({xValue:Ja.firstElementChild.value,yValue:Qa.firstElementChild.value,zValue:Za.firstElementChild.value,formula:Ma,price:L,tablePrice:o});or.dataset.tablePriceValid=Number(t),or.value=n?`[ +${PriceFormatter.formatMoney(parseFloat(n),!1)} ]`:"",wa(Xi,tr,n/100),p?va(La(i,a),i):La(i,a),te.useDimensionDropdownPricing&&za&&za.length&&function(e,t){la((()=>{e.forEach((({id:e})=>{const o=t.parentElement.querySelector(`[id*="${e}"]`);o&&o.querySelectorAll([".tpo_option-type-selection",".container-wrap-selection"]).forEach((e=>e.dispatchEvent(new Event("updateDimensionPricing"))))}))}),300)()}(za,ce)}Object.assign(or,{className:"tpo_dimension_price_input tpo_hidden",type:"hidden",name:`properties[${E}]`}),_&&or.setAttribute("form",_),setTimeout((()=>{Ke()}),500),n.type="button",n.addEventListener("click",(function(){ce.classList.contains("tpo_hidden")||[Ja.firstElementChild,Qa.firstElementChild,Za.firstElementChild].forEach(((e,t)=>{const o=e.parentElement.parentElement?.lastElementChild||document.createElement("div");Ye(er[t],e.value,o,e),va(La(i,a),i)}))})),we.append(Ua,Wa,Xa,or,tr),me.append(we,Se),ce.append(me);break;case"font-picker":const ir=T?JSON.parse(T):{displayFontSwatches:0,enableFontPreview:0,enableSearch:0,fontSelection:0,textBoxIdentifier:"",textBoxIdentifierV2:[],selectedFonts:[],customFonts:[],printBoxName:"",printBoxValue:"",defaultFont:""};if(!Object.keys(ir).length)return"";let{displayFontSwatches:nr,enableFontPreview:ar,enableSearch:rr,fontSelection:sr,selectedFonts:lr=[],textBoxIdentifier:cr,textBoxIdentifierV2:pr=[],customFonts:dr=[],defaultFont:ur=""}=ir;const mr=ir.printBoxName?ir.printBoxName:"",_r=ir.printBoxValue?ir.printBoxValue:"";dr=dr.filter((e=>Qi.findIndex((t=>t.name===e.name))>-1));const fr=[...lr,...dr].map((e=>e.url?{...e,custom:!0}:{name:e,url:"",custom:!1}));Object.assign(we,{className:nr?"tpo_option-type-font-picker-swatches":"tpo_option-type-font-picker-dropdown"}),$i?.inputBorderRadius&&we.style.setProperty("--input-border-radius",`${$i.inputBorderRadius}px`),we.style.setProperty("--placeholder-input-text",vi.inputText_placeholder??""),we.style.setProperty("--entered-input-text",vi.inputText_enteredValue??Ai.fontColor??""),we.style.setProperty("--initial-input-border",vi.inputBorder_unselected||Bi.borderColor||""),we.style.setProperty("--initial-input-background",vi.inputBackground_unselected||""),we.style.setProperty("--active-input-border",vi.inputBorder_selected||Bi.activeBorderColor||""),we.style.setProperty("--active-input-background",vi.inputBackground_selected||"");let yr=[],hr=document.createElement("span");Object.assign(hr,{className:"tpo_additional-price absolute active"}),Rr(Y,hr,h);let gr,br=document.createElement("input");function et(){if(!y)return!0;const e=yr.length;return y&&e<1?(Ee.innerHTML=fo?ba(fo,""):"This is a required option",!1):(Ee.innerHTML="",!0)}if(Object.assign(br,{className:"tpo_hidden-checkbox",name:`properties[${E}]`,value:"",ariaLabel:E}),br.dataset.required=y,Mt&&(br.dataset.printBox=JSON.stringify([{printBoxName:mr,printBoxValue:_r}])),_&&br.setAttribute("form",_),nr)gr=fr.map(((e,t)=>function(e,t,o,i,n,a,r,s,l,c,p,d,u,m,_,f,y,h){o&&!o.url&&pa([o.name],y);let g=document.createElement("input"),b=document.createElement("label");Object.assign(g,{className:"tpo_buttons-input",type:"radio",value:o.name,name:`${_},${r}`,id:`${r}-${l}`});let v=document.createElement("div");function w(r){if(g.checked&&g.classList.contains("tpo_checked"))g.checked=!1,hs(y.getAttribute("id"),"name","",!0,"FONT"),b.classList.remove("tpo_is_checked_buttons"),g.classList.remove("tpo_checked"),p.value="",c.pop(),d(),wa(Xi,u,0),va(La(e,t),e),i&&(da(y,n,{}),ua(y,a,{}));else{g.checked=!0,hs(y.getAttribute("id"),"name",o,!0,"FONT");const r=f.querySelectorAll(".tpo_is_checked_buttons");if(r&&r.length&&r.forEach((e=>{e.classList.remove("tpo_is_checked_buttons")})),b.classList.add("tpo_is_checked_buttons"),g.classList.add("tpo_checked"),c[0]=o.name,m){let e=PriceFormatter.formatMoney(parseFloat(100*m),!0);c[0]=`${o.name} [ +${e} ]`,p.value=`${g.value} [ +${e} ]`}else c[0]=o.name,p.value=g.value;d(),wa(Xi,u,m),va(La(e,t),e),i&&!y.classList.contains("tpo_hidden")&&(da(y,n,o),ua(y,a,o))}}return Object.assign(v,{className:"tpo_buttons-wrapper"}),b.classList.add(`tpo_shape_${s}`),b.classList.add(`tpo_${ki.fontStyle}`),b.textContent=o.name,b.style.backgroundColor=vi.buttonBackground_unselected??Vi.background,b.style.borderColor=vi.buttonBorder_unselected??Vi.borderColor,b.style.color=vi.optionValueColor??ki.fontColor,b.style.fontFamily=o.name,b.style.setProperty("--active-color",Nn(vi.selectedOptionValueColor??Vi.activeTextColor)||""),b.style.setProperty("--active-background",Nn(vi.buttonBackground_selected??Vi.activeBackground)||""),b.style.setProperty("--active-border",Nn(vi.buttonBorder_selected??Vi.activeBorderColor)||""),b.append(g),b.addEventListener("click",(e=>{e.preventDefault()})),b.addEventListener("pointerup",w),v.append(b),h===o.name&&setTimeout((()=>{w()}),200),v}(i,a,e,ar,cr,pr,E,I,t,yr,br,et,hr,L,u,we,ce,ur))),we.append(...gr,br,hr);else if(1===sr){let Is=document.createElement("div");Object.assign(Is,{className:"tpo_font-picker-dropdown-wrapper",innerHTML:`\n
\n ${g||l["Select a font"]&&l["Select a font"][s]||"Select a font"}\n \n
\n
\n \n
    \n
    \n `});let Hs=Is.querySelector(".tpo_font-picker-label");Hs.style.borderColor=vi.dropdownMenu_border,Hs.onclick=tt;let Bs=Is.querySelector(".tpo_font-picker-option-wrapper"),Ds=Bs.querySelector("ul"),zs=Bs.firstElementChild;rr||zs.classList.add("tpo_hidden");const Vs=document.createElement("div");function tt(e){Hs.classList.toggle("show")}Object.assign(Vs,{className:"tpo_font-picker-element tpo_option-type-selection tpo_option-type-selection--empty tpo_hidden",innerHTML:l["No results found"]&&l["No results found"][s]||"No results found"}),zs.oninput=function(e){!function(e){let t=0;Array.from(Ds.children).forEach((o=>{const i=o.querySelector("span");rr&&(i?.textContent.toLowerCase().includes(e.toLowerCase())?(o.classList.remove("tpo_hidden"),t++):o.classList.add("tpo_hidden"))})),t?Vs.classList.add("tpo_hidden"):Vs.classList.remove("tpo_hidden")}(e.target.value)},document.addEventListener("click",(function(e){const t=!Is.contains(e.target),o=Hs.classList.contains("show");t&&o&&(tt(),et())})),gr=fr.map(((e,t)=>ca(i,a,e,ar,cr,pr,E,yr,br,et,hr,L,ce,Hs,ur))),Ds.append(...gr),Ds.append(Vs),we.append(Is,br,hr)}else{let Us=document.createElement("div");Object.assign(Us,{className:"tpo_font-picker-google-wrapper",innerHTML:`\n \n ${Yi?'\n \n ':'\n \n '}\n \n
      \n `}),Us.style.borderColor=vi.dropdownMenu_border;let Js=Us.firstElementChild,Rs=Us.querySelector("ul");function at(){Us.classList.toggle("show")}Js.oninput=function(e){br.value="",yr.pop();const t=e.target.value;t.trim().length<2?Rs.innerHTML="":Ws(t)},Us.onclick=function(e){Js.value.trim().length<2&&(Rs.innerHTML=""),Us.classList.contains("show")&&Js.value.trim().length||at()},gr=[].map(((e,t)=>ca(i,a,e,ar,cr,pr,E,yr,br,et,hr,L,ce,Us,ur))),Rs.append(...gr);const Ws=la((async e=>{let t=[];try{if(!He.length){const e=await fetch("https://cdn.shopify.com/s/files/1/0766/0417/8716/files/google-fonts.json?v=1695971108",{method:"GET"}),t=await e.json();He=[...t]}t=He.filter((t=>t.toLowerCase().includes(e.toLowerCase()))).map((e=>({name:e,url:"",custom:!1})))}catch(e){console.error(e)}finally{gr=t.map(((e,t)=>ca(i,a,e,ar,cr,pr,E,yr,br,et,hr,L,ce,Us,ur))),Rs.innerHTML="",Rs.append(...gr)}}),300);!p&&ur&&(Js.value=ur,Js.dispatchEvent(new Event("input"))),document.addEventListener("click",(function(e){const t=!Us.contains(e.target),o=Us.classList.contains("show");t&&o&&(at(),et())})),we.append(Us,br,hr)}n.type="button",n.addEventListener("click",(function(){et()})),me.append(we,Se,Ee),ce.append(me)}return ce}function na(e,t,o){const i=e?.parentElement;if(!i)return;const n=i.querySelector(`[name*="properties[${t}]"]`);n&&(n.style.color=`${o||""}`)}function aa(e,t,o){Array.isArray(t)&&t.length&&t.forEach((t=>{na(e,t,o)}))}function ra(e,t,o){if("no"===t)return;let i=o.querySelector('[name="properties[_tpo_wholesale]"]');i||(i=document.createElement("input"),i.type="hidden",i.id="_tpo_wholesale",i.name="properties[_tpo_wholesale]",i.value=jn(e),o.appendChild(i))}function sa(e){e._tpo_add_by="easify"}function la(e,t){let o=null;return(...i)=>{window.clearTimeout(o),o=window.setTimeout((()=>{e.apply(null,i)}),t)}}function ca(e,t,o,i,n,a,r,s,l,c,p,d,u,m,_){o&&!o.url&&pa([o.name],u);const f=document.createElement("div");return Object.assign(f,{className:"tpo_font-picker-element",innerHTML:`${o.name}`,onclick:function(_){if(_.stopPropagation(),d){let e=PriceFormatter.formatMoney(parseFloat(100*d),!0);s[0]=`${o.name} [ +${e} ]`,l.value=`${o.name} [ +${e} ]`}else s[0]=o.name,l.value=o.name;c(),wa(Xi,p,d),va(La(e,t),e),i&&!u.classList.contains("tpo_hidden")&&(da(u,n,o),ua(u,a,o)),da(u,r,o),hs(u.getAttribute("id"),"name",o,!0,"FONT"),m.firstElementChild.textContent=o.name,m.firstElementChild.value=o.name,m.classList.remove("show")}}),f.style.fontFamily=o.name,_===o.name&&setTimeout((()=>{f.click()}),200),f}function pa(e,t){if(!e||!e.length)return;let o="";return e.forEach((e=>{if(!e)return;let t=e.replaceAll(" ","+");o+=`${t}|`})),Tt("link","stylesheet","https://fonts.googleapis.com/css?family="+o,t)}function da(e,t,o){const i=e?.parentElement,n=i?.querySelector(`[name*="properties[${t}]"]`);n&&(o?.name?n.style.cssText=`${n.style.cssText} font-family: ${o?.name};`:n.style.removeProperty("font-family"))}function ua(e,t,o){Array.isArray(t)&&t.length&&t.forEach((t=>{da(e,t,o)}))}function ma(e,t,o,i,n,a,r,c,p,d,u,m,_,f,y,h,g,b,v,w,S,E,$,C,x,k,L,q,T){const O=S.id;let A=o.map(((o,r)=>{let c=!1,p=o.label;const u=o.additional_price||null;if(u){let e=PriceFormatter.formatMoney(parseFloat(100*u),!0);p=`${o.label} [ +${e} ]`}return b&&f.find((e=>e===o.id))&&(c=!0),function(e,t,o,i,n,a,r,c,p,d,u,m,_,f,y,h,g,b,v,w,S,E,$,C,x,k,L,q,T){let{label:O,is_default:A,additional_price:N=null,id:P,image_url:M,number_color:F,color_code:j="",image_canvas_url:I,image_id:H,product_id:B,variant_id:z,metadata:V="{}"}=o||{};j||(j=",");const U=j?.split(","),J=S?.image_color??0,R=JSON.parse(V||"{}"),W=R.printBoxName?R.printBoxName:"",Q=R.printBoxValue?R.printBoxValue:"",G=R.url||"",X=G.startsWith("/")||G.startsWith("http")?G:`https://${G}`,Z=(R.description,ga(R.tooltip||""),$.configs),Y=$.enable;let ee={};const te=S.id;let oe="";if(q&&q.length){const e=q.find((e=>e.typeId===P));e&&(oe=e.quantity)}const ie=S.is_change_label,ne=JSON.parse(S.metadata||"{}");let{useUrl:ae=!1,linkDisplay:re="separate",linkLabel:se,separateAddOnProduct:le=!1}=ne;se||(se="View");const ce=ae&&"separate"===re,pe=ae&&"clickable_label"===re;if(z&&vn.forEach((e=>{e.variants.forEach((t=>{`${t.id}`===z&&(ee={...e,variants:[{...t}]})}))})),ee.variants){ie||(o.label="Default Title"===ee.variants[0].title?ee.variants[0].name:ee.variants[0].title,O=o.label),N=ee.variants[0].price/100;let e=PriceFormatter.formatMoney(parseFloat(100*N),!0);N&&(_=`${O} [ +${e} ]`)}let de=void 0===ee?.variants||ee.variants[0].available;!ee.variants&&z&&(de=!1);let ue=l["SOLD OUT"]&&l["SOLD OUT"][s]||"SOLD OUT";if(de||o.label.includes(` - ${ue}`)||K||(o.label=`${O} - ${ue}`,O=o.label),"hide"===D?.outStockOptions&&!de)return"";let me=document.createElement("span");Object.assign(me,{className:"tpo_additional-price "+(0!==m?"":"tpo_hidden")});const{quantitySelectorWrapper:_e,errorMessageElement:fe}=Y?C(Z,N,Se,P,te,Mi,oe,(function(){he.checked=!1,Ee({target:{checked:!1,midEvent:!0}})})):{quantitySelectorWrapper:null,errorMessageElement:null};let ye=document.createElement("label");if(de&&A&&!h){if(1===b)-1===eo&&(eo=S.option_set_id),Y?(_e.classList.remove("swatches-not-avaliable"),_e.querySelector("input").disabled=!1,we()):p.push({id:P,price:N}),v.push(_),f.push(P);else{if(Y){const e=ye.querySelectorAll(".tpo_quantity-selector_wrapper");e&&e.length&&e.forEach((e=>{e.classList.add("swatches-not-avaliable")})),_e.classList.remove("swatches-not-avaliable"),_e.querySelector("input").disabled=!1,we()}else{let e=O;if(N){let t=PriceFormatter.formatMoney(parseFloat(100*N),!0);e=`${O} [ +${t} ]`}v[0]=e,p[0]={id:P,price:N}}f[0]=P}y(P),"FORM"===e.tagName&&setTimeout((function(){w?va(La(e,t),e):La(e,t)}),500)}let he=document.createElement("input");1===b?(ye.style.setProperty("--checkbox-border",vi?.checkboxBorder_unselected??""),ye.style.setProperty("--active-checkbox-border",vi?.checkboxBorder_selected??""),ye.style.setProperty("--checkbox-background",vi?.checkboxBackground_unselected??""),ye.style.setProperty("--active-checkbox-background",vi?.checkboxBackground_selected??""),ye.style.setProperty("--active-checkbox-checkMark",vi?.checkboxCheckmark_selected??""),Object.assign(he,{className:"tpo_radio-button",type:"checkbox",checked:f.find((e=>e===P))||g,disabled:!de,value:_,onchange:Ee}),he.dataset.checked=f.find((e=>e===P))||g):(Object.assign(he,{className:"tpo_radio-button "+(Xt?"tpo_compatible_radio-theme":""),type:"radio",value:O,checked:(f.find((e=>e===P))||g)&&de,disabled:!de,name:`${i}`,onclick:Ee}),he.dataset.checked=(f.find((e=>e===P))||g)&&de),z&&(he.dataset.productId=B,he.dataset.variantId=z),Mt&&(he.dataset.printBoxName=W,he.dataset.printBoxValue=Q);let ge=document.createElement("div");Object.assign(ge,{className:"container_wrapper"}),ge.append(ye);let be="";be=ie?O:ee.variants?"Default Title"===ee.variants[0].title?ee.variants[0].name:ee.variants[0].title:O;let ve=jr({imageOrColor:J,numberColor:F,swatchShape:E,colorCodes:U,imageUrl:M,onlyReturnColor:!0});if(Object.assign(ye,{className:"tpo_product_list-wraper",innerHTML:(z?`
      \n ${null!==ve?ve||(ee.image||M&&M!==ao&&M!==ro?`
      \n \n
      `:""):""}\n
      \n \n ${ce?`${be} ${se}`:pe?`${be} `:`${be} `}\n
      \n
      \n \n `:`
      \n ${null!==ve?ve||(H&&"default_id_image"===H?"":`
      \n \n
      `):""}\n
      \n \n ${ce?`${be} ${se}`:pe?`${be} `:`${be} `}\n
      \n
      \n `)+"\n \n "}),_e){const e=document.createElement("div");Object.assign(e,{className:"tpo-quantity_always-show"}),e.append(_e,fe),ge.append(e)}function we(){const e=_e.querySelector("input").value,t=_e.querySelector("input");t&&t.dispatchEvent(new Event("change")),e?Se(N?N*Number(e):0,e):(_e.querySelector("input").value=1,Se(N?1*N:0,1))}function Se(e,t){if(0===b)if(e){let o=PriceFormatter.formatMoney(parseFloat(100*e),!0);q[0]={typeId:P,label:`${O} [ +${o} ] | ${t}`,quantity:t}}else q[0]={typeId:P,label:`${O} | ${t}`,quantity:t};else if(e)if(q.find((e=>e.typeId===P))){const o=q.findIndex((e=>e.typeId===P)),i=q[o].label.lastIndexOf("|");q[o].label.slice(i+1).trim();let n=PriceFormatter.formatMoney(parseFloat(100*e),!0);q[o].label=`${O} [ +${n} ] | ${t}`,q[o].quantity=t}else PriceFormatter.formatMoney(parseFloat(100*e),!0),q.push({typeId:P,label:O,quantity:t});else if(q.find((e=>e.typeId===P))&&q.length){const e=q.findIndex((e=>e.typeId===P));q[e].label=`${O} | ${t}`,q[e].quantity=t}else q.push({typeId:P,label:`${O} | ${t}`,quantity:t})}function Ee(e){if(1===b)if(e.target.checked){if(f.push(P),ls(P,I||M,!0),Y&&(_e.classList.remove("swatches-not-avaliable"),_e.querySelector("input").disabled=!1,we()),N){let e=PriceFormatter.formatMoney(parseFloat(100*N),!0);v.push(`${O} [ +${e} ]`)}else v.push(O);p.push({id:P,price:N}),e.target.dataset.checked="true"}else{let t=O;if(ls(P,I||M,!1),N){let e=PriceFormatter.formatMoney(parseFloat(100*N),!0);t=`${O} [ +${e} ]`}const o=v.indexOf(t);if(o>-1&&(v.splice(o,1),f.splice(o,1),p.splice(o,1)),_e){const e=q.findIndex((e=>e.typeId===P));q.splice(e,1),_e.classList.add("swatches-not-avaliable"),_e.querySelector("input").disabled=!0,_e.classList.remove("tpo-error_validate"),fe.innerHTML=""}e.target.dataset.checked="false"}else{const t=e.target.value;let o=O;if(N&&(o=`${t} [ +${PriceFormatter.formatMoney(parseFloat(100*N),!0)} ]`),o===v[0]||e.target.midEvent)e.target.checked=!1,ls(te,I||M,!1),v.pop(),f.pop(),p.pop(),_e&&(q.pop(),_e.classList.add("swatches-not-avaliable"),_e.querySelector("input").disabled=!0,_e.classList.remove("tpo-error_validate"),fe.innerHTML=""),e.target.dataset.checked="false";else{if(e.target.checked){ls(te,I||M,!0),f[0]=P,v[0]=o,p[0]={id:P,price:N};const e=T.querySelectorAll(".tpo_quantity-selector_wrapper");e&&e.length&&e.forEach((e=>{e.classList.add("swatches-not-avaliable"),e.classList.remove("tpo-error_validate");const t=e.parentElement.querySelector(".tpo_error-message");t&&(t.innerHTML="")})),Y&&(_e.classList.remove("swatches-not-avaliable"),_e.querySelector("input").disabled=!1,we())}e.target.dataset.checked="true"}}}return q&&q.length&&q.find((e=>e.typeId===P))&&(_e.classList.remove("swatches-not-avaliable"),_e.querySelector("input").disabled=!1),wa(Xi,me,N),ye.firstElementChild.prepend(he),ye.querySelector(".tpo_option_type_label")?.append(me),ge}(e,t,o,i,0,0,0,0,d,0,0,_,p,f,g,b,c,n,v,E,S,a,$,C,0,0,0,q,T)}));const N=document.getElementById(`wrap-product-list-${O}${void 0!==w?`-${w}`:""}`);if(N?.style.setProperty("--radio-border",vi?.radioBorder_unselected??""),N?.style.setProperty("--active-radio-border",vi?.radioBorder_selected??""),N?.style.setProperty("--radio-background",vi?.radioBackground_unselected??""),N?.style.setProperty("--active-radio-background",vi?.radioBackground_selected??""),N?.style.setProperty("--radio-checkMark",vi?.radioCheckmark_unselected??""),N?.style.setProperty("--active-radio-checkMark",vi?.radioCheckmark_selected??""),N){for(;N.firstChild;)N.removeChild(N.firstChild);N.append(...A)}else{let e=document.createElement("div");Object.assign(e,{className:"wrap-product-list "+(Xt?"tpo_compatible_product-list-theme":""),id:`wrap-product-list-${O}${void 0!==w?`-${w}`:""}`}),e.append(...A),y.append(e)}}function _a(e,t,o,i,n,a,r,c,p,d,u,m,_,f,y,h,g,b,v,w,S,E,$,C,x){x&&(o.additional_price=0,o.variant_id="");let{label:k,is_default:L,additional_price:q=null,id:T,number_color:O,color_code:A="",product_id:N,variant_id:P,image_url:M,image_canvas_url:F,metadata:j="{}"}=o||{};A||(A=",");const I=A?.split(","),H=b?.image_color??0,B=JSON.parse(j||"{}"),z=B.printBoxName?B.printBoxName:"",V=B.printBoxValue?B.printBoxValue:"",U=B.url||"",J=U.startsWith("/")||U.startsWith("http")?U:`https://${U}`,R=B.description||"",W=ga(B.tooltip||"");let Q={};const G=b.is_change_label,X=b.id,Z=JSON.parse(b.metadata||"{}");let{useUrl:Y=!1,linkDisplay:K="separate",linkLabel:ee,separateAddOnProduct:te=!1,descriptionPosition:oe="below_value"}=Z;ee||(ee="View");const ie=Y&&"separate"===K,ne=Y&&"clickable_label"===K;let ae=document.createElement("input");P&&vn.forEach((e=>{e.variants.forEach((t=>{`${t.id}`===P&&(Q={...e,variants:[{...t}]},G||(o.label="Default Title"===t?.title?t?.name:t?.title,k=o.label))}))})),M=Ir(Q,M);const re=o?.label;let se=wr(h,M,re);se=jr({imageOrColor:H,numberColor:O,swatchShape:v,colorCodes:I,imageUrl:M,imgElement:se,imageSize:h,optionLabel:re}),null===se&&(se="");const le=void 0===Q?.variants||Q.variants[0].available;Q?.variants&&(q=Q.variants[0].price/100);const ce=S.configs,pe=S.enable,{quantitySelectorWrapper:de,errorMessageElement:ue}=pe?E(ce,q,ge,T,X,Mi,"",(function(){let e=new CustomEvent("pointerup",{bubbles:!0});ye.firstElementChild.dispatchEvent(e)})):{quantitySelectorWrapper:null,errorMessageElement:null};if(L&&le){if(c.dataset.selectedIndex=a,pe){const e=w.querySelectorAll(".tpo_quantity-selector_wrapper");e&&e.length&&e.forEach((e=>{e.classList.add("swatches-not-avaliable")})),de.classList.remove("swatches-not-avaliable"),de.querySelector("input").disabled=!1,he()}else x?setTimeout((()=>{be()}),500):(d(c,k,q),wa(Xi,p,q));m(T),"FORM"===e.tagName&&setTimeout((function(){y?va(La(e,t),e):La(e,t)}),500),setTimeout((()=>{c.dispatchEvent(new Event("change"))}),0)}let me=l["SOLD OUT"]&&l["SOLD OUT"][s]||"SOLD OUT";if(le||(o.label=`${k} - ${me}`,k=o.label),"hide"===D?.outStockOptions&&!le)return"";let _e=document.createElement("span");Object.assign(_e,{className:"tpo_additional-price "+(0!==u?"":"tpo_hidden")}),Object.assign(ae,{className:`tpo_radio-button ${Xt?"tpo_compatible_radio-theme":""} ${L&&le?"tpo_checked":""}`,value:k,disabled:!le,type:"radio",checked:L&&le,name:`${f},${i}`,id:`${i}-${a}`}),hn&&ae.setAttribute("form",hn),P&&(ae.dataset.productId=N,ae.dataset.variantId=P),Mt&&(ae.dataset.printBoxName=z,ae.dataset.printBoxValue=V);let fe=document.createElement("div");Object.assign(fe,{className:`container-wrap-selection ${le?"":"out_stock_label"} ${"hover"===g?"":se?"tpo_label_under_price":""}`});let ye=document.createElement("div");if(ye.style.setProperty("--radio-border",vi?.radioBorder_unselected??""),ye.style.setProperty("--active-radio-border",vi?.radioBorder_selected??""),ye.style.setProperty("--radio-background",vi?.radioBackground_unselected??""),ye.style.setProperty("--active-radio-background",vi?.radioBackground_selected??""),ye.style.setProperty("--radio-checkMark",vi?.radioCheckmark_unselected??""),ye.style.setProperty("--active-radio-checkMark",vi?.radioCheckmark_selected??""),Object.assign(ye,{className:`tpo_radio-button-wrapper ${oe} ${R?"has-description":""}`,innerHTML:`\n \n `}),de){const e=document.createElement("div");Object.assign(e,{className:"tpo-quantity_always-show"}),e.append(de),ye.append(e)}function he(){const e=de.querySelector("input").value,t=de.querySelector("input");t&&t.dispatchEvent(new Event("change")),e?ge(q?q*Number(e):0,e):(de.querySelector("input").value=1,ge(q?1*q:0,1))}function ge(o,i){if(o){let e=PriceFormatter.formatMoney(parseFloat(100*o),!0);c.value=`${k} [ +${e} ] | ${i}`}else c.value=`${k} | ${i}`;wa(Xi,p,o),ce.showTotalSelected&&$r($,i,ce),va(La(e,t),e)}function be(){const e=c.dataset.selectedIndex;void 0!==e&&parseInt(e)===a&&function(){const e=parseFloat(B.dimensionPrice||0)*Rt,t=Jr(b,c,e);d(c,k,t),wa(Xi,p,t)}()}return ye.firstElementChild.prepend(ae),le&&(ye.firstElementChild.addEventListener("click",(e=>{"A"!==e.target.tagName&&e.preventDefault()})),ye.firstElementChild.addEventListener("pointerup",(function(o){if("A"!==o.target.tagName){if(ae.checked&&ae.classList.contains("tpo_checked")){if(ae.checked=!1,ae.classList.remove("tpo_checked"),ls(X,F||M,!1),c.value="",r(),_&&Ya(""),m(""),wa(Xi,p,0),de){de.classList.add("swatches-not-avaliable"),de.querySelector("input").disabled=!0,de.classList.remove("tpo-error_validate"),ue.innerHTML="",ce.showTotalSelected&&$r($,0,ce);const e=$.querySelector(".tpo_quantity_selector_total-selected");r()&&e&&e.classList.remove("tpo-quantity-error")}c.dataset.selectedIndex=""}else{if(ae.checked=!0,ae.classList.add("tpo_checked"),ls(X,F||M,!0),!pe)if(q){let e=PriceFormatter.formatMoney(parseFloat(100*q),!0);c.value=`${k} [ +${e} ]`}else c.value=`${k}`;_&&Ya(k);const e=w.querySelectorAll(".tpo_quantity-selector_wrapper");e&&e.length&&e.forEach((e=>{e.classList.add("swatches-not-avaliable"),e.classList.remove("tpo-error_validate");const t=e.closest(".container-wrap-selection").querySelector(".tpo_error-message");t&&(t.innerHTML="")})),pe&&(de.classList.remove("swatches-not-avaliable"),de.querySelector("input").disabled=!1,he()),pe||wa(Xi,p,q),m(T),_&&Ya(k),r(),c.dataset.selectedIndex=a}x&&be(),y?va(La(e,t),e):La(e,t),c.dispatchEvent(new Event("change"))}}))),x?fe.addEventListener("updateDimensionPricing",(function(){be(),function(){const e=parseFloat(B.dimensionPrice||0)*Rt,t=Jr(b,c,e);wa(Xi,_e,t)}()})):wa(Xi,_e,q),de?fe.append(ye,ue):fe.append(ye),fe.querySelector(".tpo_option_type_label")?.append(_e,W),fe}function fa(e){const{formElement:t,quantityInput:o,option:i,isRequired:n,additionalPriceSwitch:a,addToCartElement:r,handleAddPriceToProperties:s,handleChangeValuesSwitch:l,inputForSwitchValues:c,renderForProductPage:p,switchImageElement:d}=e,{id:u,type:m,option_id:_,switch_label:f,additional_price:y,option_identifier:h,switch_value:g,metadata:b="{}",option_types:v}=i;let{additional_price:w=null}=v?.[0]||{},S=y;w&&(S=w);const E=JSON.parse(b||"{}"),$=E.printBoxName?E.printBoxName:"",C=E.printBoxValue?E.printBoxValue:"",x=E.printBoxNoValue?E.printBoxNoValue:"",k=E?.image_canvas_url||E?.switchImageUrl||ao;function L(e){Mt&&(c.dataset.printBox=e?JSON.stringify([{printBoxName:$,printBoxValue:C}]):JSON.stringify([{printBoxName:$,printBoxValue:x}]))}let q=document.createElement("label");q.classList.add("tpo_switch");let T=document.createElement("input");g&&(c.value=f,a.classList.add("active"),s(c,f,S),p?va(La(t,o),t):La(t,o)),l(Boolean(g)),L(g),Object.assign(T,{className:"checkbox",type:"checkbox",id:`${m}-${_}`,checked:g,value:f,onchange:function(e){e.target.checked?(l(!0),ls(u,k,!0),L(!0),a.classList.add("active"),s(c,f,S)):(l(!1),ls(u,k,!1),L(!1),a.classList.remove("active"),c.value=""),p?va(La(t,o),t):La(t,o)}}),T.dataset.required=n,hn&&T.setAttribute("form",hn);let O=document.createElement("span");O.classList.add("tpo_slider","round"),O.style.backgroundColor=vi?.switchBackground_unselected??Di?.background,O.style.setProperty("--active-switch-background",vi?.switchBackground_selected??Di?.activeBackground??""),q.append(T,O);let A=PriceFormatter.formatMoney(parseFloat(100*S),!0),N=document.createElement("div");return Object.assign(N,{className:`tpo_switch-container tpo_${ki.fontStyle}`,innerHTML:`\n \n `}),r.type="button",d&&i.hidden_label&&N.insertBefore(d,N.firstChild),N.insertBefore(q,N.firstChild),N}function ya(e,t,o,i,n,a,r,c,p,d,u,m,_,f,y,h,g,b,v,w,S,E,$,C,x,k,L,q,T,O,A){const N=n?1:0,P=L.type,M=L?.image_color??0;let{label:F="",number_color:j,color_code:I="",image_url:H="",image_canvas_url:B="",additional_price:z=null,id:V,product_id:U,variant_id:J,is_default:R,metadata:W="{}"}=o||{};j||(j=1),I||(I=",");const Q=I?.split(","),G=JSON.parse(W||"{}"),X=L.metadata?JSON.parse(L?.metadata||"{}"):{},Z=X?.swatchShape||"radius",Y=G.printBoxName?G.printBoxName:"",K=G.printBoxValue?G.printBoxValue:"",ee=G.url||"";let te=ee.startsWith("/")||ee.startsWith("http")?ee:`https://${ee}`,oe=jr({imageOrColor:M,numberColor:j,swatchShape:Z,colorCodes:Q,imageUrl:H,onlyReturnColor:!0}),ie={};const ne=L.id,ae=L.is_change_label,re=L.swatch_position||"next_to",se=JSON.parse(L.metadata||"{}");let{useUrl:le=!1,openLinkBehavior:ce="new_tab",separateAddOnProduct:pe=!1,descriptionPosition:de="below_value"}=se;const ue="new_tab"===ce?"_blank":"_self";te=zr(le,te);const me=G.description||"",_e=ga(G.tooltip||""),fe=ha(me,`${P}-description below_swatch`);J&&vn.forEach((e=>{e.variants.forEach((t=>{`${t.id}`===J&&(ie={...e,variants:[{...t}]},ae||(o.label="Default Title"===t?.title?t?.name:t?.title,F=o.label))}))}));const ye=void 0===ie?.variants||ie.variants[0].available;H=Ir(ie,H),ie?.variants&&(z=ie.variants[0].price/100);let he=l["SOLD OUT"]&&l["SOLD OUT"][s]||"SOLD OUT";if(ye||(o.label=`${F} - ${he}`,F=o.label),"hide"===D?.outStockOptions&&!ye)return"";const ge=x.configs,be=x.enable;let ve=document.createElement("input");const{quantitySelectorWrapper:we,errorMessageElement:Se}=be?k(ge,z,Le,V,ne,Mi,"",xe):{quantitySelectorWrapper:null,errorMessageElement:null};let Ee,$e=document.createElement(le?"article":"label");if(R=R||Dr(le,te),1===N)switch(P){case"image-swatches":Object.assign(ve,{className:"tpo_color-swatches-input tpo_image-swatches-input",type:"checkbox",disabled:!ye,value:F,checked:R&&ye,id:`${i}-${c}`});break;case"color-swatches":Object.assign(ve,{className:"tpo_color-swatches-input",type:"checkbox",disabled:!ye,value:F,id:`${i}-${c}`,checked:R&&ye});break;case"buttons":Object.assign(ve,{className:"tpo_buttons-input",type:"checkbox",disabled:!ye,value:F,id:`${i}-${c}`,checked:R&&ye})}else switch(P){case"image-swatches":Object.assign(ve,{className:"tpo_color-swatches-input tpo_image-swatches-input",type:"radio",checked:R&&ye,disabled:!ye,value:F,name:`${S},${i}`,id:`${i}-${c}`});break;case"color-swatches":Object.assign(ve,{className:"tpo_color-swatches-input "+(R&&ye?"tpo_checked":""),disabled:!ye,type:"radio",checked:R,value:F,name:`${S},${i}`,id:`${i}-${c}`});break;case"buttons":Object.assign(ve,{className:"tpo_buttons-input "+(R&&ye?"tpo_checked":""),type:"radio",disabled:!ye,value:F,checked:R,name:`${S},${i}`,id:`${i}-${c}`})}switch(J&&(ve.dataset.productId=U,ve.dataset.variantId=J),Mt&&(ve.dataset.printBoxName=Y,ve.dataset.printBoxValue=K),P){case"image-swatches":le?(Ee=document.createElement("a"),Object.assign(Ee,{className:"hover"===b?"tpo_image-swatches-wrapper "+(r?"swiper-slide":""):`tpo_swatches-label_position ${re} ${r?"swiper-slide":""}`,href:te,target:ue})):(Ee=document.createElement("div"),Object.assign(Ee,{className:"hover"===b?`tpo_image-swatches-wrapper ${r?"swiper-slide":""} ${ye?"":"swatches-not-avaliable"}`:`tpo_swatches-label_position ${r?"swiper-slide":""} ${ye?"":"swatches-not-avaliable"} ${re}`})),Ee.classList.add(de);break;case"color-swatches":le?(Ee=document.createElement("a"),Object.assign(Ee,{className:"hover"===b?`tpo_color-swatches-wrapper ${r?"swiper-slide":""} ${be?"tpo_qty_selector":""} ${ye?"":"swatches-not-avaliable"}`:`tpo_color-swatches-label_position ${r?"swiper-slide":""} ${ye?"":"swatches-not-avaliable"} ${re}`,href:te,target:ue})):(Ee=document.createElement("div"),Object.assign(Ee,{className:"hover"===b?`tpo_color-swatches-wrapper ${r?"swiper-slide":""} ${be?"tpo_qty_selector":""} ${ye?"":"swatches-not-avaliable"}`:`tpo_color-swatches-label_position ${r?"swiper-slide":""} ${ye?"":"swatches-not-avaliable"} ${re}`})),Ee.classList.add(de);break;case"buttons":le?(Ee=document.createElement("a"),Object.assign(Ee,{className:"tpo_buttons-wrapper",href:te,target:ue})):(Ee=document.createElement("div"),Object.assign(Ee,{className:`tpo_buttons-wrapper ${ye?"":"swatches-not-avaliable"} ${ye?"":"out_stock_label"}`}))}let Ce=PriceFormatter.formatMoney(parseFloat(100*z),!0);switch(P){case"image-swatches":if(vi?.imageSwatchesHoverBackground&&Ee.style.setProperty("--image-swatches-hover-background",vi?.imageSwatchesHoverBackground),$e.classList.add(`tpo_shape_${a||"square"}`),$e.style.borderColor=vi.imageSwatchesBorder_unselected??Ji.borderColor,$e.style.width=`${Ei.imageSwatchSize??Ji.swatchSize}px`,$e.style.height=`${Ei.imageSwatchSize??Ji.swatchSize}px`,$e.style.setProperty("--active-imageSwatches-border",vi.imageSwatchesBorder_selected||Ji.activeBorderColor||""),$e.innerHTML=`\n
      ${H||ao}
      \n `,"hover"===b){let e=document.createElement("div"),t=PriceFormatter.formatMoney(parseFloat(100*z),!0);Object.assign(e,{className:"tpo_image-swatches-tooltip",innerHTML:` ${ln?"":`
      \n ${H||ao}\n
      `}\n
      \n \n \n \n ${F}\n \n \n ${z&&0!==y?`${"under"===re?t:"("+t+")"}`:""}\n \n \n \n ${me?ha(me,"on_tooltip").outerHTML:""}\n
      \n `,style:ln?"max-width: 80px":""}),we?Ee.append($e,fe,we,e,Se):Ee.append($e,e,fe)}else{let e=document.createElement("div");Object.assign(e,{className:"tpo_image-swatches-tooltip",innerHTML:`\n
      \n ${H||ao}\n ${me?ha(me,"on_tooltip").outerHTML:""}\n
      \n `});let t="";if("hide"!==b){t=document.createElement("div"),t.style.color=vi.optionValueColor??ki.fontColor,t.style.setProperty("--swatch-option-color",vi.optionValueColor??ki.fontColor??""),t.style.fontSize=`${ki.fontSize}px`,ki?.fontFamily&&(t.style.fontFamily=ki.fontFamily),t.classList.add(`tpo_${ki.fontStyle}`);let e=PriceFormatter.formatMoney(parseFloat(100*z),!0);Object.assign(t,{className:`tpo_option_type_label_wrapper tpo_${ki.fontStyle} ${ye?"":"out_stock_label"}`,innerHTML:`\n \n \n \n ${F}\n \n \n ${z&&0!==y?`${"under"===re?e:"("+e+")"}`:""}\n \n \n \n `})}$e.append(e);const o=document.createElement("div");Object.assign(o,{className:"tpo-quantity_always-show"}),o.append(we,Se),we?Ee.append($e,t,o,fe):Ee.append($e,t,fe)}$e.append(ve);break;case"color-swatches":1===N?Object.assign(ve,{className:"tpo_color-swatches-input"}):Object.assign(ve,{className:"tpo_color-swatches-input "+(R&&ye?"tpo_checked":"")}),$e.classList.add(`tpo_shape_${a||"circle"}`),$e.style.borderColor=vi.colorSwatchesBorder_unselected??Ui.borderColor,$e.style.width=`${Ei.colorSwatchSize??Ui.swatchSize}px`,$e.style.height=`${Ei.colorSwatchSize??Ui.swatchSize}px`,$e.style.setProperty("--active-colorSwatches-border",vi.colorSwatchesBorder_selected||Ui.activeBorderColor||"");let e=document.createElement("div");for(let t=0;t\n `;if($e.append(e),"hover"===b){let e=document.createElement("div");Object.assign(e,{className:"tpo_color-swatches-tooltip",innerHTML:`\n \n ${F}\n \n ${z&&0!==y?`${"under"===re?Ce:"("+Ce+")"}`:""}\n
      \n ${me?ha(me,"on_tooltip").outerHTML:""}\n `,style:ln?"max-width: 80px":"abc"}),we?Ee.append($e,fe,we,e,Se):Ee.append($e,e,fe)}else{let e="";"hide"!==b&&(e=document.createElement("span"),e.style.setProperty("--swatch-option-color",vi.optionValueColor??ki.fontColor??""),e.style.fontSize=`${ki.fontSize}px`,ki?.fontFamily&&(e.style.fontFamily=ki.fontFamily),e.classList.add(`tpo_${ki.fontStyle}`),Object.assign(e,{innerHTML:`\n \n ${F}\n ${z&&0!==y?`${"under"===re?Ce:"("+Ce+")"}`:""}`,className:`tpo_option_type_label_wrapper tpo_${ki.fontStyle} ${ye?"":"out_stock_label"}`}));const t=document.createElement("div");Object.assign(t,{className:"tpo-quantity_always-show"}),t.append(we,Se),we?Ee.append($e,e,t,fe):Ee.append($e,e,fe)}$e.append(ve);break;case"buttons":$e.classList.add(`tpo_shape_${a}`),$e.classList.add(`price_position_${v}`);const t=function(e,t,o,i,n){let a="tpo_button_with";return null===e?a+="_none":e?a+="_color":t&&t!==ao&&(a+="_image"),"below"!==i||0===n||o&&(a+="_price"),a}(oe,H,z,v,y);t&&$e.classList.add(t),$e.classList.add(`tpo_${ki.fontStyle}`),$e.style.fontSize=`${ki.fontSize}px`,$e.textContent=F,$e.style.color=vi.buttonText_unselected??Vi.textColor,$e.style.backgroundColor=vi.buttonBackground_unselected??Vi.background,$e.style.borderColor=vi.buttonBorder_unselected??Vi.borderColor,$e.style.setProperty("--active-color",Nn(vi.buttonText_selected??Vi.activeTextColor)||""),$e.style.setProperty("--active-background",Nn(vi.buttonBackground_selected??Vi.activeBackground)||""),$e.style.setProperty("--active-border",Nn(vi.buttonBorder_selected??Vi.activeBorderColor)||"");let o="",i="";H&&H!==ao&&""===oe&&(i=document.createElement("div"),Object.assign(i,{className:"tpo_image-swatches-tooltip",innerHTML:`
      \n ${H||ao}\n
      `})),v&&"hover"!==v?(i&&""===oe&&(o=document.createElement("div"),Object.assign(o,{className:i?"tpo_buttons-tooltip tpo_buttons-tooltip_with-image":"tpo_buttons-tooltip",innerHTML:i.innerHTML})),$e.innerHTML=`
      \n ${null!==oe?oe||(H?`\n
      ${H||ao}
      \n `:""):""}\n \n ${F}\n ${z&&0!==y?`${"below"===v?Ce:"("+Ce+")"}`:""}\n \n
      `):(o=document.createElement("div"),Object.assign(o,{className:i&&""===oe?"tpo_buttons-tooltip tpo_buttons-tooltip_with-image":"tpo_buttons-tooltip",innerHTML:i&&""===oe?`${i.innerHTML}
      \n \n \n \n ${z&&0!==y?`${Ce}`:""}\n \n \n \n
      `:z&&0!==y?`${Ce}`:""}),$e.innerHTML=`
      \n ${null!==oe?oe||(i?`\n
      ${H||ao}
      \n `:""):""}\n \n ${F}\n \n
      `),we?Ee.append($e,we,o,Se):Ee.append($e,o),$e.append(ve)}function xe(o){if(ve.checked&&ve.classList.contains("tpo_checked"))if(ve.checked=!1,"color-swatches"===L.type&&hs(ne,"name","",!0,"COLOR"),ls(0===N?ne:V,B||H,!1),$e.classList.remove("tpo_is_checked_swatches"),ve.classList.remove("tpo_checked"),0===N){if($&&$.pop(),d.value="",g(""),w&&Ya(""),p.pop(),u(),wa(Xi,_,0),we){we.classList.add("swatches-not-avaliable"),we.querySelector("input").disabled=!0,we.classList.remove("tpo-error_validate"),Se.innerHTML="",O&&$r(q,0,ge,A);const e=q.querySelector(".tpo_quantity_selector_total-selected");u()&&e&&(e.classList.remove("tpo-quantity-error"),0!==Number(e.textContent)&&e.classList.add("tpo-quantity-success"))}E?va(La(e,t),e):La(e,t)}else{we&&(we.classList.add("swatches-not-avaliable"),we.querySelector("input").disabled=!0,we.classList.remove("tpo-error_validate"),Se.innerHTML="");let o=F;if(be){const e=we.querySelector("input").value;if(z){const t=Number(e)*z;let i=PriceFormatter.formatMoney(parseFloat(100*t),!0);o=`${F} [ +${i} ] | ${e}`,m.price-=t}else o=`${F} | ${e}`;O&&$r(q,0,ge,A)}else{if(z){let e=PriceFormatter.formatMoney(parseFloat(100*z),!0);o=`${F} [ +${e} ]`}m.price-=z}const i=p.indexOf(o);if(i>-1&&($&&$.splice(i,1),p.splice(i,1),h.splice(i,1)),w&&Ya(F),wa(Xi,_,Mr(m.price)?m.price.toFixed(2):m.price),d.value=p.join(", "),u(),g(V),we){const e=q.querySelector(".tpo_quantity_selector_total-selected");u()&&e&&"0"===e.innerHTML&&(e.classList.remove("tpo-quantity-error"),0!==Number(e.textContent)&&e.classList.add("tpo-quantity-success"))}E?va(La(e,t),e):La(e,t)}else if(ve.checked=!0,"color-swatches"===L.type&&hs(ne,"name",I,!0,"COLOR"),ls(0===N?ne:V,B||H,!0),ve.classList.add("tpo_checked"),0===N){if(!be)if(z){let e=PriceFormatter.formatMoney(parseFloat(100*z),!0);p[0]=`${F} [ +${e} ]`,d.value=`${ve.value} [ +${e} ]`}else p[0]=F,d.value=ve.value;$&&($[0]=F),w&&Ya(F);const o=C.querySelectorAll(".tpo_is_checked_swatches"),i=C.querySelectorAll(".tpo_quantity-selector_wrapper");o&&o.length&&o.forEach((e=>{e.classList.remove("tpo_is_checked_swatches")})),i&&i.length&&i.forEach((e=>{e.classList.add("swatches-not-avaliable"),e.classList.remove("tpo-error_validate");const t=e.parentElement.querySelector(".tpo_error-message");t&&(t.innerHTML="")})),$e.classList.add("tpo_is_checked_swatches"),be&&(we.classList.remove("swatches-not-avaliable"),we.querySelector("input").disabled=!1,ke()),be||wa(Xi,_,z),g(V),u(),E?va(La(e,t),e):La(e,t)}else{if(be&&(we.classList.remove("swatches-not-avaliable"),we.querySelector("input").disabled=!1),be)ke();else{if(z){let e=PriceFormatter.formatMoney(parseFloat(100*z),!0);p.push(`${F} [ +${e} ]`)}else p.push(F);m.price+=z,wa(Xi,_,Mr(m.price)?m.price.toFixed(2):m.price),d.value=p.join(", ")}$e.classList.add("tpo_is_checked_swatches"),h.push(V),$&&$.push(F),w&&Ya(F),g(V),u(),E?va(La(e,t),e):La(e,t)}d.dispatchEvent(new Event("change"))}function ke(){const e=we.querySelector("input").value,t=we.querySelector("input");t&&t.dispatchEvent(new Event("change")),e?Le(z?z*Number(e):0,e):ge.isUseCustomIncrement&&Number(ge.customIncrementValue)>1?(we.querySelector("input").value=ge.customIncrementValue,Le(z?z*ge.customIncrementValue:0,ge.customIncrementValue)):(we.querySelector("input").value=1,Le(z?1*z:0,1))}function Le(o,i){if(0===N){if(o){let e=PriceFormatter.formatMoney(parseFloat(100*o),!0);p[0]=`${F} [ +${e} ] | ${i}`,d.value=`${ve.value} [ +${e} ] | ${i}`}else p[0]=`${F} | ${i}`,d.value=`${ve.value} | ${i}`;m.price=z,wa(Xi,_,o),O&&$r(q,i,ge,A),va(La(e,t),e)}else{const n=o?`${F} [ +`:`${F} |`;if(o){const e=p.find((e=>e.includes(n)&&e.split("[")[0].trim()===n.split("[")[0].trim()));if(e){const t=p.indexOf(e),n=p[t].lastIndexOf("|"),a=p[t].slice(n+1).trim();let r=PriceFormatter.formatMoney(parseFloat(100*o),!0);p[t]=`${F} [ +${r} ] | ${i}`;const s=Number(o)/Number(i),l=Math.abs(Number(a)-Number(i));Number(a)Number(i)&&(m.price-=l*s)}else{let e=PriceFormatter.formatMoney(parseFloat(100*o),!0);p.push(`${F} [ +${e} ] | ${i}`),m.price+=o}}else if(p.find((e=>e.startsWith(n)))){const e=p.findIndex((e=>{const t=e.split("|");return 0!==t.length&&t[0].trim()===n.split("|")[0].trim()}));p[e]=`${F} | ${i}`}else p.push(`${F} | ${i}`);wa(Xi,_,Mr(m.price)?m.price.toFixed(2):m.price),d.value=p.join(", "),O&&$r(q,0,ge,A),va(La(e,t),e)}}if(ye){if(R){if(ve.classList.add("tpo_checked"),1===N){if(-1===eo&&(eo=L.option_set_id),be)we.classList.remove("swatches-not-avaliable"),we.querySelector("input").disabled=!1,ke();else{if(z){let e=PriceFormatter.formatMoney(parseFloat(100*z),!0);p.push(`${F} [ +${e} ]`)}else p.push(F);m.price+=z}$&&$.push(F),h.push(V)}else{if(be){const e=C.querySelectorAll(".tpo_quantity-selector_wrapper");e&&e.length&&e.forEach((e=>{e.classList.add("swatches-not-avaliable")})),we.classList.remove("swatches-not-avaliable"),we.querySelector("input").disabled=!1,ke()}else{if(z){let e=PriceFormatter.formatMoney(parseFloat(100*z),!0);p[0]=`${F} [ +${e} ]`,d.value=`${ve.value} [ +${e} ]`}else p[0]=F,d.value=ve.value;$&&($[0]=F),m.price=z}h[0]=V}w&&Ya(F),g(V),wa(Xi,_,Mr(m.price)?m.price.toFixed(2):m.price),$e.classList.add("tpo_is_checked_swatches"),d.value=p.join(", "),setTimeout((()=>{d.dispatchEvent(new Event("change"))}),0),u(),E?va(La(e,t),e):La(e,t)}$e.addEventListener("click",(e=>{le||e.preventDefault()})),$e.addEventListener("pointerup",xe)}return Ee.querySelector(".tpo_option_type_label")?.append(_e),Ee}function ha(e="",t="",o="span"){const i=document.createElement(o);return Object.assign(i,{className:`tpo_option_type_description ${t}`,innerHTML:e}),i}function ga(e=""){const t=document.createElement("span");Object.assign(t,{className:"tpo_option_type_tooltip_icon "+(e?"":"tpo_hidden"),innerHTML:`\n \n ${Yi?'':''} \n `});const o=document.createElement("div");Object.assign(o,{className:"tpo_option_type_tooltip_wrapper",innerHTML:e});const i=o.cloneNode(!0);let n;t.appendChild(o);const a=()=>{i.remove()};return t.addEventListener("mouseenter",(()=>{i.style.visibility="visible",i.style.opacity="1",i.style.zIndex="9999",document.body.appendChild(i),i.addEventListener("mouseenter",(()=>{clearTimeout(n)})),i.addEventListener("mouseleave",(()=>{n=setTimeout(a,200)}));const e=t.getBoundingClientRect(),o=i.getBoundingClientRect();let r=e.top+window.scrollY-o.height-5,s=e.left+e.width/2-o.width/2;s+o.width>window.innerWidth&&(s=window.innerWidth-o.width-10),s<0&&(s=10),i.style.top=`${r}px`,i.style.left=`${s}px`})),t.addEventListener("mouseleave",(()=>{n=setTimeout(a,200)})),t}function ba(e,t){let o=new RegExp(/{{(.*?)}}/gim);return"object"==typeof t&&t.length>1?e.replace("{{minValue}}",t[0]).replace("{{maxValue}}",t[1]):e.replace(o,(function(){return t}))}function va(e,t){if(e)if(t){const e=t.closest(Se);e?e.setAttribute("tpo-validated-form",!0):document.querySelector("body").setAttribute("tpo-validated-form",!0)}else document.querySelector("body").setAttribute("tpo-validated-form",!0);else if(t){const e=t.closest(Se);e?e.setAttribute("tpo-validated-form",!1):document.querySelector("body").setAttribute("tpo-validated-form",!1)}else document.querySelector("body").setAttribute("tpo-validated-form",!1);t&&Qn(t)}function wa(e,t,o){if(!e||o<=0)t.innerHTML="";else{let e=PriceFormatter.formatMoney(parseFloat(100*o),!0);t.innerHTML=`(${e})`}}function Sa(e){return Xo?e+e*Xo/100:e}function Ea({xValue:e=1,yValue:t=1,zValue:o=1,formula:i,price:n,tablePrice:a}){const r=e*t*o*n*100;if(!i)return r;i=i.replace(/({{|}})/g,"").toLowerCase();const s={x:e,y:t,z:o,price:n,tableprice:a};try{const e=100*math.evaluate(i,s);return e<0?0:e}catch(e){return console.log("Formula error: ",e),r}}function $a({xValue:e=1,yValue:t=1,zValue:o=1,tablePricing:i={}}){if(!i.enable)return{valid:!0,tablePrice:null};const{ranges:n}=i;if(!n||!n.length)return{valid:!0,tablePrice:null};const{dimensionType:a}=i,r=n.find((o=>{const{xMin:i,xMax:n,yMin:r,yMax:s}=o;let l,c;return l=!i&&e<=Number(n)||!n&&e>=Number(i)||e>=Number(i)&&e<=Number(n),c=1===a||!r&&t<=Number(s)||!s&&t>=Number(r)||t>=Number(r)&&t<=Number(s),l&&c}));return r?{valid:!!r.price,tablePrice:r.price}:{valid:!1,tablePrice:null}}function Ca({value:e,price:t,formula:o,useFormula:i,priceType:n}){if(!o||!i||"one"!==n&&"one_formula"!==n)return e*t*100;o=o.replace(/({{|}})/g,"");const a={x:e,price:t};try{const e=100*math.evaluate(o,a);return e<=0?0:e}catch(o){return console.log("Formula error: ",o),e*t*100}}function xa(e,t,o,i,n,a="",r=!1){if("one"===n||"product_add_ons"===n||"one_with_new_price"===n||"one_formula"===n)if("one_formula"===n&&(r=!0),!e||o<=0)t.innerHTML="";else{let e=PriceFormatter.formatMoney(parseFloat(i*o*100),!1),s=i.toString();if(s&&s.endsWith("]")){const e=s.indexOf("[");s=s.slice(0,e-1).trim()}s=Ca({value:s,price:o,formula:a,useFormula:r,priceType:n}),i.toString()!==s?(e=PriceFormatter.formatMoney(parseFloat(s),!0),t.innerHTML=`(+${e})`):t.innerHTML=`(+${e})`}else if(!e||o<=0)t.innerHTML="";else{let e=PriceFormatter.formatMoney(parseFloat(100*o),!1),n=i.toString();if(n&&n.endsWith("]")){const e=n.indexOf("[");n=n.slice(0,e-1).trim()}i.toString()!==n?(e=PriceFormatter.formatMoney(parseFloat(100*o),!0),t.innerHTML=`(+${e})`):t.innerHTML=`(+${e})`}}function ka(e){let t=document.createElement("input");Object.assign(t,{className:"tpo_total-additional-price-input",name:"tpo_total-additional-price",type:"hidden",value:""}),hn&&t.setAttribute("form",hn);let o=document.createElement("span");Object.assign(o,{className:"tpo_total-additional-price"}),o.style.fontSize=`${Ti.fontSize}px`,o.style.color=vi.totalPricePriceColor??Ti.fontColor;let i=document.createElement("div");return Object.assign(i,{className:`tpo_total-additional-price-wrapper ${e?.querySelectorAll(".tpo_additional-price.active").length>0?"":"tpo_hidden"} tpo_${Ti.fontStyle}`,innerHTML:`\n \n `}),gi||(i.style.display="none"),i.style.fontSize=`${Ti.fontSize}px`,i.style.color=vi.totalPriceTextColor??Ti.fontColor,i.style.backgroundColor=vi.totalPriceBackgroundColor,i.style.borderColor=vi.totalPriceBorderColor,i.style.borderRadius=`${$i.totalPriceBorderRadius}px`,Ti?.fontFamily&&(i.style.fontFamily=Ti.fontFamily),i.append(o),{totalAdditionalPrice:o,totalAdditionalPriceWrapper:i,totalAdditionalPriceInput:t}}function La(e,t){let o=e.querySelectorAll([".tpo_error-message",".tpo-quantity-error"]);if(!o.length){let t=e.closest(Se);t&&!t.querySelector(".tpo_option-set-wrapper")&&(t=document.querySelector(Se)),t||(t=document.querySelector(Se)),o=t?t.querySelectorAll([".tpo_error-message",".tpo-quantity-error"]):[]}let i=[];const n=At.map((e=>document.getElementById(e)));let a=[],r=[],s=[];n.forEach((e=>{if(e&&-1!==e.className.indexOf("tpo_hidden"))if("group"===e.id.split(",")[2]){let t=Array.from(e.querySelectorAll([".tpo_error-message",".tpo-quantity-error"]))||[];a=[...a,...t];const o=Array.from(e.querySelectorAll("input, textarea"))||[];r=[...r,...o];let i=Array.from(e.querySelectorAll(".tpo_additional-price.active"))||[];i&&(s=[...s,...i])}else{let t=e.querySelectorAll([".tpo_error-message",".tpo-quantity-error"]);a=[...a,...t];const o=e.querySelectorAll("input, textarea");r=[...r,...o];let i=e.querySelector(".tpo_additional-price.active");i&&(s=[...s,i])}}));for(const e of o)a.find((t=>t===e))?i.push(""):i.push(e.innerHTML);const l=i.every((e=>""===e));let c=Array.from(e.elements||[]).filter((e=>e.className.includes("tpo")&&!e.className.includes("tpo_add-to-cart"))),p=!0;if(!c.length){let e=document.querySelector($);c=Array.from(e?.elements||[]).filter((e=>e.className.includes("tpo")&&!e.className.includes("tpo_add-to-cart")))}for(const e of c){const t=r.find((t=>t===e));if(t&&t.name.includes("properties["))t.setAttribute("disabled","disabled");else{if("BUTTON"===e.tagName)continue;const t=e.closest(".tpo_option-container");if(t){const e=t.parentElement.closest(".tpo_option-container");if(e&&e.classList.contains("tpo_hidden"))continue}if(t&&t.classList.contains("tpo_hidden")||(e.removeAttribute("disabled"),!t)||t.querySelectorAll("input.tpo_option-dropdown").forEach((e=>{e.removeAttribute("disabled")})),"1"!==e.dataset.required||e.disabled)continue;if(t&&t.classList.contains("tpo_hidden"))continue;if("checkbox"!==e.type&&""===e.value){p=!1;continue}"checkbox"!==e.type||e.checked||(p=!1)}}let d=e.querySelector(`.tpo_total-additional-price:not(.${Et} *)`)||e.closest(Se)?.querySelector(`.tpo_total-additional-price:not(.${Et} *)`)||document.querySelector(".easify-product-options")?.querySelector(`.tpo_total-additional-price:not(.${Et} *)`)||document.createElement("div"),u=e.querySelector(`.tpo_total-additional-price-wrapper:not(.${Et} *)`)||e.closest(Se)?.querySelector(`.tpo_total-additional-price-wrapper:not(.${Et} *)`)||document.querySelector(".easify-product-options")?.querySelector(`.tpo_total-additional-price-wrapper:not(.${Et} *)`)||document.createElement("div"),m=e.querySelector(`.tpo_total-additional-price-input:not(.${Et} *)`)||e.closest(Se)?.querySelector(`.tpo_total-additional-price-input:not(.${Et} *)`)||document.querySelector(".easify-product-options")?.querySelector(`.tpo_total-additional-price-input:not(.${Et} *)`)||document.createElement("div");if(Oa(e,d,u,m,t,s),l&&p||(gn.type="button"),document.querySelector("gp-product")&&"bisoo-shop.myshopify.com"!==Q){const e=document.querySelectorAll(k),t=document.querySelectorAll(W);l&&p?(e.forEach((e=>{e.disabled&&(e.type="button",e.disabled=!1)})),t.forEach((e=>{e.disabled&&(e.disabled=!1)}))):(e.forEach((e=>{e.type="button",e.disabled=!0})),t.forEach((e=>{e.disabled=!0})))}const _=Zr(e);return l&&p&&_}function qa(e){return e?100*Pn(e.innerText):0}function Ta(e,t,o){if(!Go)return;if(e||_n(),!e)return;const{totalPrice:i,originalTotalPrice:n,additionalPrice:a,originalAdditionalPrice:r}=t;let s=PriceFormatter.formatMoney(parseFloat(i),!0),l=PriceFormatter.formatMoney(parseFloat(n+r),!0);if(!s||!l)return;const c=e.closest([...Se,...I.wrapper]);if(!c)return;let p=c.querySelectorAll(ve);if(p.length||(p=c.parentElement.querySelectorAll(ve)),!p.length)return;p.forEach((e=>{let t;const n=e.parentElement?.querySelector(":scope >.tpo_product_price");if(n)n.innerHTML=Je?l:s,t=n;else{const o=e.cloneNode(!0);o.classList.add("tpo_product_price"),e.parentNode?.insertBefore(o,e.nextSibling),o.innerHTML=Je?l:s,e.style.display="none",e.style.visibility="hidden",t=o}Wr({target:t,beforeWholesale:o,showLabel:!1,position:"after",totalPriceAfter:i,section:"main-product-price"})}));let d=c.querySelector(we);if(d||(d=c.parentElement.querySelector(we)),d){let m=d.innerHTML.includes(".tpo_product_old_price");if(f)f.innerHTML=_;else{const y=d.cloneNode(!0);y.classList.add("tpo_product_old_price"),d.parentNode?.insertBefore(y,d.nextSibling),y.innerHTML=_,d.style.display="none"}}}if("7fbfaa.myshopify.com"===Q){function u(){document.querySelectorAll(".sls-total-price .seal-money").forEach((e=>{e.innerHTML=s}))}u(),document.addEventListener("sealsubs:price_update",(function(e){u()}))}}function Oa(e,t,o,i,n,a){if(!a)return void La(e,n);let r=t,s=o,l=i;if(si){const e=document.querySelector(".tpo_modal-container");e&&(r=e.querySelector(".tpo_total-additional-price")||t,s=e.querySelector(".tpo_total-additional-price-wrapper")||o,l=e.querySelector(".tpo_total-additional-price-input")||i)}const c=gn?gn.querySelector(te):null;let p=function(e){let t=rn&&(rn.classList.contains("active")||rn.classList.contains("is-open")||"boolean"==typeof rn.open&&!!rn.open);if(rn||(rn=document.querySelector(ce),t=rn&&function(e){const t=e.getBoundingClientRect();return t.top>=0&&t.left>=0&&t.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&t.right<=(window.innerWidth||document.documentElement.clientWidth)}(rn)),"FORM"===e.tagName||e.classList.contains("product__meta")){let t=e.closest(Se);if(_||Do){if(t)return qa(t.querySelector(ve)||t.parentElement.querySelector(ve));{const t=[".product__info-wrapper",".product-detail",".product-single__meta"];let o=e.closest(t),i=o?.querySelector(ve);return qa(i)}}if((je&&Bo||(Fe||Ie)&&Ho||je&&zo)&&e.action.includes("cart/add")){const t=e.closest(Se);if(t){const e=t.querySelector(ve);if(e)return qa(e)}return 0}}else if(ln||t){const t=e.querySelector(ve)||e.closest(ue)?.querySelector(ve);return t?qa(t):0}}(e)||0;const d=document.querySelector(".tpo_option-set-wrapper")||document.createElement("div");let u;u=si?Array.from(document.querySelector(".tpo_modal-container form")?.querySelectorAll(".tpo_additional-price.active")||[]):e?Array.from(e.querySelectorAll(".tpo_additional-price.active").length?e.querySelectorAll(".tpo_additional-price.active"):d&&d.querySelectorAll(".tpo_additional-price.active")||[]):Array.from(document.querySelector("main").querySelectorAll(".tpo_additional-price.active").length?document.querySelector("main").querySelectorAll(".tpo_additional-price.active"):d&&d.querySelectorAll(".tpo_additional-price.active")||[]);const m=function(e){if(!e)return 1;const t=e.closest([...Se,...I.wrapper]);if(!t)return 1;let o=t.querySelector(fe);return o?parseInt(o.value):1}(e);let f=p||0,y=p||0;Ue&&(f*=m);let h=0,g=0,b=0,v=0,w=0;for(const e of u)if(a&&a.length>0){if(a.find((t=>t===e)))continue;{let t=e.textContent;if(!t)continue;const o=e.dataset.oneTimeCharge,i=e.dataset.addOnProduct;let n=/\(\+?(.*)\)/,a=t.match(n),r=0;if(a){let e=Pn(a[1]);r=parseFloat(100*e)}Ue?o?Re?v+=r:(f+=r,h+=r,b+=r,w+=r):(f+=r*m,h+=r*m,b+=r):o?v+=r:(f+=r,h+=r,i||(g+=r),b+=r)}}else{let t=e.textContent;if(!t)continue;const o=e.dataset.oneTimeCharge,i=e.dataset.addOnProduct;let n=/\(\+?(.*)\)/,a=t.match(n),r=0;if(a){let e=Pn(a[1]);r=parseFloat(100*e)}Ue?o?Re?v+=r:(f+=r,h+=r,b+=r,w+=r):(f+=r*m,h+=r*m,b+=r):o?v+=r:(f+=r,h+=r,i||(g+=r),b+=r)}const S={totalPrice:f,originalTotalPrice:y,productPrice:p,additionalPrice:h,originalAdditionalPrice:b},E={totalPrice:Aa(f,n,qn,En,"product",!1,w),originalTotalPrice:Aa(y,n,qn,En,"product",!0),productPrice:p,additionalPrice:h,originalAdditionalPrice:b};Ta(e,E,S),function(e,t){const o=document.querySelector(I.form);o&&Ta(o,e,t)}(E,S);const $=Aa(We?f-h:"include"===Vo?f+v:f-p+v,n,qn,En)+(We?h+v:0);let C=PriceFormatter.formatMoney(parseFloat($),!0);l.value=C;let x=["tuanna-store.myshopify.com","portail-francais.myshopify.com"].includes(Q);if("no"!==Ro&&(wt.includes(Q)||x||ai)){let t=e.querySelector('[name="properties[_tpo_price]"]');if(t?t.value=x?parseFloat(g/Rt)/100:parseFloat(h/Rt)/100:(t=document.createElement("input"),t.type="hidden",t.id="_tpo_price",t.name="properties[_tpo_price]",t.value=x?parseFloat(g/Rt)/100:parseFloat(h/Rt)/100,e.appendChild(t)),"expand"===Ro){let t=Xr(),o=e.querySelector('[name="properties[_tpo_custom_options]"]');o?o.value=JSON.stringify(In(t)):(o=document.createElement("input"),o.type="hidden",o.id="_tpo_custom_options",o.name="properties[_tpo_custom_options]",o.value=JSON.stringify(In(t)),e.appendChild(o))}}$>0?(r.innerHTML=`${C}`,s.classList.remove("tpo_hidden"),c&&(c.innerHTML=`${C}`),function(e,t){if(!Xo||!t||!t.parentElement)return;const o=e+e*Xo/100,i=PriceFormatter.formatMoney(parseFloat(o),!0),n=`${ba(To)} ${i}`;let a=t.parentElement.querySelector(".tpo_price_include_tax");a?a.innerHTML=n:(a=document.createElement("div"),Object.assign(a,{className:"tpo_price_include_tax",innerHTML:n}),t.parentElement.append(a))}($,r),Wr({target:r,beforeWholesale:S,showLabel:!0,position:"after",totalPriceAfter:$,section:"custom-box-price"})):s.classList.add("tpo_hidden"),function(e,t=Et){const o=Array.from(document.getElementsByClassName(t));o.length&&o.forEach((t=>{t.innerHTML=e.outerHTML}))}(s)}function Aa(e,t,o,i,n="product",a=!1,r=null){if(!o)return e;const s=Number(t.value),l=i.filter((e=>!Number(e.maxQty)&&s>=Number(e.minQty)||s>=Number(e.minQty)&&s<=Number(e.maxQty)));if(!l.length)return e;const c=l[l.length-1];let{type:p,value:d}=c;if("fixed"===p&&(Ue&&"product"===n&&(d*=a?1:s),e-=100*Number(d)),"percentage"===p)if("expand"===Ro&&Ue&&"product"===n){let t=0;r&&r>0&&(t=r,e-=r),e=parseFloat(e/s/100*(100-Number(d))/100).toFixed(2)*s*100+t}else e*=(100-Number(d))/100;return e>=0?e:0}function Na(e,t,o,i,n,a,r){if(a){if(-1!==eo&&!Bt.includes(a)){let e=to[eo].filter((e=>{if(e.conditions_serialized.conditionOptions)return e.conditions_serialized.conditionOptions.filter((e=>e.id===a))[0]}));const t=e.map((e=>{const t=`${e.id},${e.type}`;return document.getElementById(`${t}`)}));!e.includes(null)&&e.length&&e.forEach(((e,o)=>{const i=t[o];if(i){i.classList.add("tpo_hidden"),gs(e.id,"hide",e.multi_select),Bt.push(a);const t=i.querySelectorAll("input, textarea"),o=t[t.length-1];o&&Fa(o),Pa(i.id.split(",")[2],!0,i),Na(to,"","","",0,i.id,r)}}))}}else{e?.length&&(eo=e[0].option_set_id);const n=ze.findIndex((e=>e?.id===t));"switch"===o?n>=0?ze[n]={...ze[n],value:i}:ze=[...ze,{id:t,value:i}]:n>=0?ze[n]={...ze[n],value:i,optionValue:r}:ze=[...ze,{id:t,value:i,optionValue:r}];let a=to[eo].filter((e=>{if(e.conditions_serialized.conditionOptions)return e.conditions_serialized.conditionOptions.filter((e=>e.id===t))[0]}));const s=a.map((e=>{const t=`${e.id},${e.type}`;return document.getElementById(`${t}`)}));!a.includes(null)&&a.length&&a.forEach(((e,t)=>{const{action:o,match:i}=e.conditions_serialized,n=e?.metadata?JSON.parse(e?.metadata):{},a=(t,o,i)=>{const{enableColorPreview:n=0,textBoxIdentifier:a="",textBoxIdentifierV2:r=[]}=o,s=t.querySelector(".tpo_color-picker_input"),l=t.closest(".tpo_option-set-wrapper")||t.closest(".tpo_option-set-container"),c=s?.value;"SHOW"===i?(hs(e.id,"name",c,!0,"COLOR"),n&&(na(l,a,c),aa(l,r,c))):(hs(e.id,"name","",!0,"COLOR"),n&&(na(l,a,""),aa(l,r,"")))},l=(t,o,i)=>{const{displayFontSwatches:n,enableFontPreview:a=0,textBoxIdentifier:r="",textBoxIdentifierV2:s=[]}=o,l=t.querySelector(".tpo_font-picker-google-wrapper")||t.querySelector(".tpo_font-picker-dropdown-wrapper")||t.querySelector(".tpo_option-type-font-picker-swatches"),c=t.closest(".tpo_option-set-wrapper")||t.closest(".tpo_option-set-container");let p;p=n?l?.querySelector(".tpo_buttons-wrapper .tpo_is_checked_buttons"):l?.firstElementChild,"SHOW"===i?(hs(e.id,"name",{name:p?.textContent},!0,"FONT"),a&&(da(c,r,{name:p?.textContent}),ua(c,s,{name:p?.textContent}))):(hs(e.id,"name","",!0,"FONT"),a&&(da(c,r,{name:""}),ua(c,s,{name:""})))};switch(i){case"ANY":e.conditions_serialized.conditionOptions.every((i=>Ma(s[t],o,i.relative,i.value,0,to,e.id,r,e)));break;case"ALL":const i=De.find((t=>`${t.id}`==`${e.id}`));let c=[],p=[],d=[];const u=(e,t,o,i,n)=>{const a=document.getElementById(i),r=Number(t||"0");if(a&&a.classList.contains("tpo_hidden"))c=[...c,!1];else if("object"!=typeof o)switch(e){case"EQUAL":c=o.toString()===t.toString()?[...c,!0]:[...c,!1];break;case"NOT_EQUAL":c=o.toString()!==t.toString()?[...c,!0]:[...c,!1];break;case"CONTAIN":c=o.includes(t.toString())?[...c,!0]:[...c,!1];break;case"NOT_CONTAIN":c=o.includes(t.toString())?[...c,!1]:[...c,!0];break;case"START_WITH":c=o.startsWith(t.toString())?[...c,!0]:[...c,!1];break;case"END_WITH":c=o.endsWith(t.toString())?[...c,!0]:[...c,!1];break;case"NUMBER_CHOICES_EQUAL":NaN!==r&&(c=1===r&&o?[...c,!0]:[...c,!1]);break;case"NUMBER_CHOICES_NOT":NaN!==r&&(c=1===r&&o?[...c,!1]:[...c,!0]);break;case"GREATER_THAN":if(NaN!==r){const e=Number(o);c=e&&re?[...c,!0]:[...c,!1]}break;case"GREATER_THAN":if(NaN!==r){const e=Number(o);c=e&&re?[...c,!0]:[...c,!1]}break;case"VALUE_GREATER_THAN":if(NaN!==r){const e=Number(n);c=e&&e>r?[...c,!0]:[...c,!1]}break;case"VALUE_GREATER_EQUAL":if(NaN!==r){const e=Number(n);c=e&&e>=r?[...c,!0]:[...c,!1]}break;case"VALUE_LESS_THAN":if(NaN!==r){const e=Number(n);c=e&&ee===t))?(p=[...p,!0],c=[...c,!0]):c=[...c,!1];break;case"NOT_EQUAL":d=[...o],o.length&&o.find((e=>e===t))?c=[...c,!1]:(p=[...p,!0],c=[...c,!0]);break;case"CONTAIN":o.find((e=>e===t.toString()))?(p=[...p,!0],c=[...c,!0]):c=[...c,!1];break;case"NOT_CONTAIN":o.find((e=>e===t.toString()))?c=[...c,!1]:(p=[...p,!0],c=[...c,!0]);break;case"NUMBER_CHOICES_EQUAL":NaN!==r&&(c=r===o?.length?[...c,!0]:[...c,!1]);break;case"NUMBER_CHOICES_NOT":NaN!==r&&(c=r!==o?.length?[...c,!0]:[...c,!1]);break;case"GREATER_THAN":NaN!==r&&(c=ro?.length?[...c,!0]:[...c,!1]);break;case"VALUE_GREATER_THAN":if(NaN!==r){const e=Number(n);c=e&&e>r?[...c,!0]:[...c,!1]}break;case"VALUE_GREATER_EQUAL":if(NaN!==r){const e=Number(n);c=e&&e>=r?[...c,!0]:[...c,!1]}break;case"VALUE_LESS_THAN":if(NaN!==r){const e=Number(n);c=e&&e{ze.forEach((t=>{const o=document.getElementById(`${t.id}`);t.id===e.id&&o&&!o.classList.contains("tpo_hidden")&&u(e.relative,e.value,t.value,e.id,t.optionValue)}))}));let m=!1;m=p.length>=d.length;const _=s[t];let f="";if(_){f=_.id.split(",")[2];const t=Array.from(_.querySelectorAll("input, textarea")),o=t[t.length-1],s="060d87-4f.myshopify.com"===Q||c.length===i.conditionOptions.length;if(o&&(s&&c.every((e=>!0===e))&&m?"SHOW"===i.action?(ja(o),"color-picker"===e.type&&a(_,n,i.action),"font-picker"===e.type&&l(_,n,i.action)):(Fa(o),"color-picker"===e.type&&a(_,n),"font-picker"===e.type&&l(_,n)):"SHOW"===i.action?(Fa(o),"color-picker"===e.type&&a(_,n),"font-picker"===e.type&&l(_,n)):(ja(o),"color-picker"===e.type&&a(_,n,i.action),"font-picker"===e.type&&l(_,n,i.action))),s&&c.every((e=>!0===e))&&m)if("SHOW"===i.action){_.classList.remove("tpo_hidden"),gs(_.id,"show",e.multi_select),Bt=Bt.filter((function(e){return e!==_.id}));let t=ze.find((e=>e.id===_.id));t||(ze.push({id:_.id,value:"",optionValue:""}),t={id:_.id,value:"",optionValue:""}),t&&Na(to,_.id,e.type,t.value,0,null,t.optionValue),Pa(f,!0,_)}else _.classList.add("tpo_hidden"),gs(_.id,"hide",e.multi_select),Pa(f,!1,_),Na(to,"","","",0,_.id,r);else if("SHOW"===i.action)_.classList.add("tpo_hidden"),gs(_.id,"hide",e.multi_select),Pa(f,!1,_),Na(to,"","","",0,_.id,r);else{_.classList.remove("tpo_hidden"),gs(_.id,"show",e.multi_select),Bt=Bt.filter((function(e){return e!==_.id}));const t=ze.find((e=>e.id===_.id));t&&("string"==typeof t.value?Na(to,_.id,"",t.value,0,null,t.optionValue):Na(to,_.id,"",t.value,t.value)),Pa(f,!0,_)}}}}))}}function Pa(e,t,o){["group","dimension"].includes(e)&&(Array.from(o.querySelectorAll(["input","textarea"]))||[]).forEach((e=>{t?ja(e):Fa(e)}))}function Ma(e,t,o,i,n,a,r,s,l){const c=De.find((e=>`${e.id}`==`${r}`));let p=[],d="";e&&(d=e.id.split(",")[2]),e&&c.conditionOptions.forEach((e=>{ze.forEach((t=>{const o=document.getElementById(`${t.id}`);t.id===e.id&&o&&!o.classList.contains("tpo_hidden")&&((e,t,o,i,n)=>{const a=Number(t||"0"),r=document.getElementById(i);if(r&&r.classList.contains("tpo_hidden"))p=[...p,!1];else if("object"!=typeof o)switch(e){case"EQUAL":p=o.toString()===t.toString()?[...p,!0]:[...p,!1];break;case"NOT_EQUAL":p=o.toString()!==t.toString()?[...p,!0]:[...p,!1];break;case"CONTAIN":p=o.includes(t.toString())?[...p,!0]:[...p,!1];break;case"NOT_CONTAIN":p=o.includes(t.toString())?[...p,!1]:[...p,!0];break;case"START_WITH":p=o.startsWith(t.toString())?[...p,!0]:[...p,!1];break;case"END_WITH":p=o.endsWith(t.toString())?[...p,!0]:[...p,!1];break;case"NUMBER_CHOICES_EQUAL":NaN!==a&&(p=1===a&&o?[...p,!0]:[...p,!1]);break;case"NUMBER_CHOICES_NOT":NaN!==a&&(p=1===a&&o?[...p,!1]:[...p,!0]);break;case"GREATER_THAN":if(NaN!==a){const e=Number(o);p=e&&ae?[...p,!0]:[...p,!1]}break;case"VALUE_GREATER_THAN":if(NaN!==a){const e=Number(n);p=e&&e>a?[...p,!0]:[...p,!1]}break;case"VALUE_GREATER_EQUAL":if(NaN!==a){const e=Number(n);p=e&&e>=a?[...p,!0]:[...p,!1]}break;case"VALUE_LESS_THAN":if(NaN!==a){const e=Number(n);p=e&&ee===t.toString()))?[...p,!0]:[...p,!1];break;case"NOT_CONTAIN":p=o.find((e=>e===t.toString()))?[...p,!1]:[...p,!0];break;case"NUMBER_CHOICES_EQUAL":NaN!==a&&(p=a===o?.length?[...p,!0]:[...p,!1]);break;case"NUMBER_CHOICES_NOT":NaN!==a&&(p=a!==o?.length?[...p,!0]:[...p,!1]);break;case"GREATER_THAN":NaN!==a&&(p=ao?.length?[...p,!0]:[...p,!1]);break;case"VALUE_GREATER_THAN":if(NaN!==a){const e=Number(n);p=e&&e>a?[...p,!0]:[...p,!1]}break;case"VALUE_GREATER_EQUAL":if(NaN!==a){const e=Number(n);p=e&&e>=a?[...p,!0]:[...p,!1]}break;case"VALUE_LESS_THAN":if(NaN!==a){const e=Number(n);p=e&&et.id===e.id));t&&("string"==typeof t.value?Na(a,e.id,"",t.value,0,null,s):Na(a,e.id,"",t.value,t.value)),Pa(d,!0,e)}else e.classList.add("tpo_hidden"),gs(e.id,"hide",l.multi_select),Pa(d,!1,e),Na(a,"","","",0,e.id,s);else if(u)e.classList.add("tpo_hidden"),gs(e.id,"hide",l.multi_select),Pa(d,!1,e),Na(a,"","","",0,e.id,s);else{e.classList.remove("tpo_hidden"),gs(e.id,"show",l.multi_select),Bt=Bt.filter((function(t){return t!==e.id}));const t=ze.find((t=>t.id===e.id));t&&("string"==typeof t.value?Na(a,e.id,"",t.value,0,null,s):Na(a,e.id,"",t.value,t.value)),Pa(d,!0,e)}const o=e.querySelectorAll("input, textarea"),i=o[o.length-1];i&&("SHOW"===t?u?ja(i):Fa(i):u?Fa(i):ja(i))}return!u}function Fa(e){e.setAttribute("disabled","disabled"),e.dataset.conditionalLogic=!1}function ja(e){e.removeAttribute("disabled"),e.dataset.conditionalLogic=!0}function Ia(e){e&&e.elements&&Array.from(e.elements).forEach((e=>{"INPUT"!==e.tagName&&"TEXTAREA"!==e.tagName||e.value||e.disabled||(e.disabled=!0)}))}if(setTimeout((async()=>{await Wn()}),1500),_||K){let e=document.createElement("div");if(e.classList.add("tpo_option-set-wrapper"),(Ci?.sectionTopSpacing||Ci?.sectionBottomSpacing)&&(e.style.paddingTop=`${Ci?.sectionTopSpacing||12}px`,e.style.paddingBottom=`${Ci?.sectionBottomSpacing||12}px`),Me.includes(Q)&&document.querySelector(".tpo_option-set-wrapper")){const t=document.querySelector(".tpo_option-set-wrapper");t.parentElement.replaceChild(e,t)}K&&0===en.length&&(en=window.TPOConfigs.product_options,gn=document.querySelector(".preview-atc")),_&&en.length&&!K&&("d9022c-f9.myshopify.com"===Q?(document.querySelector("gp-product")&&window.TPOConfigs&&"product"!==window.TPOConfigs.template&&pn.querySelector(k)&&(gn=pn.querySelector(k)),yn()):(document.querySelector("gp-product")&&(gn=pn.querySelector(k)),yn()));const t=["rare-succulent.myshopify.com"];if(ee=document.querySelectorAll(".easify-product-options"),t.includes(Q)){const t=document.querySelector('form[action*="/cart/add"]');t?.parentElement.insertBefore(e,t)}else if(gn.parentElement&&(_||K)||ee.length||$t.includes(Z)){const t=D?.position||"above_add_to_cart";K&&document.querySelectorAll(".tpo_option-set-wrapper").forEach((e=>{e.remove()}));let o=[".prd-block .prd-block-info .prd-block-actions.js-sticky-add-to-cart-marker"],i=document.querySelector(o);const n=["appleton-sweets.myshopify.com","757a1b-2.myshopify.com","6fdef4.myshopify.com","0d684b-5.myshopify.com","yapcr.myshopify.com","467f57.myshopify.com","minimelons-pk.myshopify.com"];let a=document.querySelector(B);if(ee.length)ee[0].append(e);else if("below_add_to_cart"===t)if(n.includes(Q))gn.parentElement.parentElement.insertBefore(e,gn.parentElement.nextSibling);else if("lisa-marie-jimenez-designs.myshopify.com"===Q)pn.append(e);else if("f0aa9b-2.myshopify.com"===Q)gn.parentElement.parentElement.parentElement.insertBefore(e,gn.parentElement.parentElement.nextSibling);else if("sin-miedo-8556.myshopify.com"===Q)gn.parentElement.append(e);else if($t.includes(Z)){const t=document.querySelector('form[data-type="add-to-cart-form"] .product-form-buttons');t&&t.parentElement.parentElement.insertBefore(e,t.parentElement.nextSibling)}else gn.parentElement.insertBefore(e,gn.nextSibling);else if(!a&&$t.includes(Z)){const t=document.querySelector('form[data-type="add-to-cart-form"] .product-form-buttons');t&&t.parentElement.insertBefore(e,t)}else if("above_product_variants"===t){let t=document.querySelector(B);t&&"meenabazaar-3.myshopify.com"!==Q?t.parentElement.insertBefore(e,t):gn.parentElement.insertBefore(e,gn)}else if("below_product_variants"===t){let t=document.querySelector(B);if(t&&"meenabazaar-3.myshopify.com"!==Q)t.parentElement.insertBefore(e,t.nextSibling);else{let t=document.querySelector(H);t?t.parentElement.insertBefore(e,t):i?i.parentElement.insertBefore(e,i):gn.parentElement.insertBefore(e,gn)}}else if($t.includes(Z)){const t=document.querySelector('form[data-type="add-to-cart-form"] .product-form-buttons');t&&t.parentElement.insertBefore(e,t)}else if(n.includes(Q))gn.parentElement.parentElement.insertBefore(e,gn.parentElement);else if("lisa-marie-jimenez-designs.myshopify.com"===Q){const t=pn.querySelector(".purchase-details");pn.insertBefore(e,t)}else"3dd5ff.myshopify.com"===Q?pn.querySelector(".productView-group").prepend(e):gn.parentElement.insertBefore(e,gn)}else if("southeastsoftwash.myshopify.com"===Q){const t=document.querySelector(tt);t.parentElement.insertBefore(e,t)}else if("london-uk-shop.myshopify.com"===Q){const t=document.querySelector("[id*='rbr-container-element']");t?t.parentElement.insertBefore(e,t):document.querySelector(".product__info-container .button-flex").insertAdjacentElement("afterend",e)}else if(window.__pageflyProducts){let t=window.__pageflyProducts[Zi.toString()];if(t){let o=t.atcContents.entries().next().value,[i,n]=o,a=document.querySelector(`.${i}`);a?.parentElement.parentElement.insertBefore(e,a.parentElement)}}let{totalAdditionalPrice:o,totalAdditionalPriceWrapper:i,totalAdditionalPriceInput:n}=ka(pn);["gogreekstore.myshopify.com","fdb9e4-a2.myshopify.com","304b68-4.myshopify.com","3928da.myshopify.com"].includes(Q)||pn.addEventListener("change",(()=>{setTimeout((()=>{_n(),La(pn,On)}),1e3)})),e.append(i,n);let a=en.map(((e,t)=>oa(e,pn,gn,On,!0)));if(X.theme&&"Symmetry || OPT"===X.theme.name&&a){const e=a[0].querySelectorAll(".tpo_option-label-container");e.length&&e.forEach((e=>{e.classList.add("custom-label-theme")}))}if(en.length&&e.classList.add("tpo_has-option-set"),en.length>0&&si){const t=pn.closest(Se),o=await fetch("/cart.js?app=tpo",{method:"GET",headers:{"Content-Type":"application/json"}}),i=await(o?.json());let n=[];i&&(n=i?.items||[]),await za({cartItemsElement:an,productDetailElement:t,appliedOptionSet:en[0],isShowPopup:si,mainProduct:{},wrapperElement:e,formProductPageElement:pn,addToCartButton:gn,cartItems:n})}else e.prepend(...a),Qr(),await is({optionSet:en[0]});if(en.length>0&&document.dispatchEvent(new Event("easify:loaded")),Ha(),document.querySelector("gp-product")&&"bisoo-shop.myshopify.com"!==Q&&function(e){const t=document.querySelectorAll(k),o=document.querySelectorAll(W);e?(t.forEach((e=>{e.type="button",e.disabled=!1})),o.forEach((e=>{e.disabled=!1}))):(t.forEach((e=>{e.type="button",e.disabled=!0})),o.forEach((e=>{e.disabled=!0})))}(bn(en[0]?.options)),va(La(pn,On),pn),Q&&window.location.href.endsWith("?addToCart=true")){let e=document.querySelector(ht);if(window.prepareDataForDisplayWidgetByRule&&"bff7f4.myshopify.com"===Q)window.prepareDataForDisplayWidgetByRule();else{if(!e)return;let t=new CustomEvent("click",{bubbles:!0,cancelable:!0});e.dispatchEvent(t)}}if(qn){On.addEventListener("change",(function(e){let t=pn.querySelector(`.tpo_total-additional-price:not(.${Et} *)`)||pn.closest(Se)?.querySelector(`.tpo_total-additional-price:not(.${Et} *)`)||document.createElement("div"),o=pn.querySelector(`.tpo_total-additional-price-wrapper:not(.${Et} *)`)||pn.closest(Se)?.querySelector(`.tpo_total-additional-price:not(.${Et} *)`)||document.createElement("div"),i=pn.querySelector(`.tpo_total-additional-price-input:not(.${Et} *)`)||pn.closest(Se)?.querySelector(`.tpo_total-additional-price:not(.${Et} *)`)||document.createElement("div");Oa(pn,t,o,i,On)}));const e=vr(En,"product");ra(En,Ro,pn),Object.assign(e,{className:"tpo_modal-tired-wholesale-wraper tpo_wholesale_table "+(Ki?"in-dark-mode":"")});const t=document.querySelector(".tpo_wholesale_block");t?(e.style.marginBottom="30px",t.append(e)):gn.parentElement&&("below_add_to_cart"===jo?(e.style.marginBottom="30px",gn.parentElement.insertBefore(e,gn.nextSibling)):(e.style.marginBottom="30px",gn.parentElement.insertBefore(e,gn)));const o=document.querySelector('form[data-type="add-to-cart-form"] .product-form-buttons');$t.includes(Z)&&o&&o.parentElement&&o&&o.parentElement&&(e.style.marginBottom="30px","below_add_to_cart"===jo?o.parentElement.insertBefore(e,o.nextSibling):o.parentElement.insertBefore(e,o))}}function Ha(){const e=["dropdown","color-swatches","image-swatches","checkbox","buttons","radio-buttons","product-list"];Ve.forEach((t=>{if(!Bt.find((e=>e===`${t.id},${t.type}`))&&t.option_types.length)if("switch"!==t.type)if(e.find((e=>e===t.type))){const e=[];let o=JSON.parse(t.metadata||"{}"),{useUrl:i=!1}=o;t.option_types.forEach((t=>{let o=t.is_default;if(i){const e=JSON.parse(t.metadata||"{}").url||"";let n=e.startsWith("/")||e.startsWith("http")?e:`https://${e}`;n=zr(i,n),o=o||Dr(i,n)}o&&e.push(t.id)})),e.length>1&&Na(Ve,`${t.id},${t.type}`,t.type,e),e.length<=1&&Na(Ve,`${t.id},${t.type}`,t.type,e[0]||"")}else{const e=t.default_value||"";Na(Ve,`${t.id},${t.type}`,t.type,e)}else{const e=[];e.push(!!t.switch_value),Na(Ve,`${t.id},${t.type}`,t.type,e[0])}})),Nt.length&&Nt.forEach((e=>{Bt.find((t=>t===e))&&Na(Ve,"","","",0,e)}))}function Ba(e,t){for(let e=0;e{const t=e&&"string"==typeof e?JSON.parse(e):e;return t&&t?.enabled})),f=JSON.parse(JSON.stringify(i)),y=o.dataset.cartItemIndex?Number(o.dataset.cartItemIndex):o.dataset.cartItemIndex;let h=[".quantity__input",".quantity-selector__input",".js-qty__num",".input-text.js_qty",'.quantity-selector input[name="quantity"]'];const g=yt[0]?.split(",");if(g&&g?.length)for(let e=0;e":`

      ${di}

      `});const k=o.querySelector(".tpo_open-modal-button.tpo_edit-option-modal");let L=k||document.createElement("button"),q=r?l["Edit options"]&&l["Edit options"][s]||"Edit options":l["Customize it"]&&l["Customize it"][s]||ui;Object.assign(L,{className:"tpo_open-modal-button tpo_edit-option-modal "+(r?"":"tpo-show-popup"),type:"button",textContent:q,hidden:_,onclick:function(){ze=[],E?C&&"function"==typeof C.showModal&&(C.showModal(),C.style.display="block"):C.style.display="block";const e=C.querySelector("div.tpo_modal-container");e&&e.remove(),C.append(x);const t=x.querySelector(".tpo_option-set-container");if(t){r&&(f.options=function(e,t){const o={dropdown:!0,"color-swatches":!0,"image-swatches":!0,checkbox:!0,buttons:!0,"radio-buttons":!0,"product-list":!0},i={"text-box":!0,"text-area":!0,"text-number":!0,quantity:!0};return e.map((e=>{const{option_identifier:n,multi_select:a,option_types:r,type:s}=e;t[n]||(t[n]="");const l={...JSON.parse(e.metadata||"{}")};let c;if(i[e.type]||"color-picker"===s?c=t[n]:(c=l?.formatDateRange?.includes(",")?t[n].split(". "):t[n].split(", "),c=c.map((e=>{let t=PropertyFormatter.removeMoneyProperty(e).trim();return PropertyFormatter.formatDefaultPropertyValues(t)}))),"file-upload"===s){const e=l.maxFileQty||1;let o={},i=0;for(;i{i.is_default=0,c.forEach(((n,a)=>{let r=0;i.label||(i.label=""),n?.label.trim()===i?.label.trim()&&(r=1,i.is_default=r),n.quantity&&e.quantity_selector&&(t.configs.optionDefaultQuantityValue=n.quantity,r&&(o[i.id]=n.quantity),t.configs.optionTypeDefaultQuantityMapper=o)}))})),e.quantity_selector=JSON.stringify(t)}else if("switch"===s)e.switch_value=0,c.some((t=>t.label?.includes(e.switch_label)))&&(e.switch_value=1);else if(i[s])e.default_value=c;else if("color-picker"===s){const t=l.default_value;l.default_value=c||t,e.metadata=JSON.stringify(l)}else if("date-picker"===s)l.default_value=c[0].label,e.metadata=JSON.stringify(l);else if("date-range"===s)l.default_value=c[0].label.split(" to "),e.metadata=JSON.stringify(l);else if("time-picker"===s){let t=c[0].label;const o=t.split(":");let i=parseInt(o[0],10);const n=o[1]?.split(" ")||[],a=parseInt(n[0],10);n.length>1&&"pm"===n[1].toLowerCase()&&i<12&&(i+=12),l.default_value={string_value:t,default_hour:i,default_minute:a},e.metadata=JSON.stringify(l)}else if("dimension"===s){const{labelX:o="",labelY:i="",labelZ:a="",suffixX:r="",suffixY:s="",suffixZ:c="",valueX:p="",valueY:d="",valueZ:u=""}=l,m=t[`${n}-${o}`]?t[`${n}-${o}`].replace(` ${r}`,""):"",_=t[`${n}-${i}`]?t[`${n}-${i}`].replace(` ${s}`,""):"",f=t[`${n}-${a}`]?t[`${n}-${a}`].replace(` ${c}`,""):"";l.valueX=m,l.valueY=_,l.valueZ=f,e.metadata=JSON.stringify(l)}else if("font-picker"===s){const t=l.defaultFont;l.defaultFont=c[0].label||t,e.metadata=JSON.stringify(l)}else"file-upload"===s&&(l.defaultValueUploaded=c,e.metadata=JSON.stringify(l))}catch(e){console.log("setDefaultValueForOptionSet: ",e)}return e}))}(f.options,a.properties));const e=oa(f,pn||x,A,b,!1);F=Array.from(e.querySelectorAll(["input","textarea"]))||[],console.log("optionInputs 0",F),x.querySelector("form").replaceChild(e,t),Qr(),is({optionSet:i,isPopupModal:!0});const o=new CustomEvent("reloadValueOnTextField",{detail:{formElement:e}});window.dispatchEvent(o)}Ha(),Oa(o,v,w,S,b)}});let T=document.createElement("span");Object.assign(T,{className:"tpo_close-popup-button",innerHTML:"×",onclick:function(){E?(C.innerHTML="",C&&"function"==typeof C.close&&(C.close(),C.style.display="none",C.innerHTML="")):(C.style.display="none",C.innerHTML="")}}),window.addEventListener("click",(function(e){e.target===C&&(E?(C.innerHTML="",C&&"function"==typeof C.close&&(C.close(),C.style.display="none",C.innerHTML="")):(C.style.display="none",C.innerHTML=""))}));let O=r?l.Confirm&&l.Confirm[s]||"Confirm":l["Add to cart"]&&l["Add to cart"][s]||D?.textAddToCartCustom||"Add to cart",A=document.createElement("button");Object.assign(A,{className:"tpo_edit-option_confirm-button button",type:"button",textContent:O});let N=await qt(f?.products_handle,vn);vn.push(...N);const P=document.createElement("div");P.classList.add("tpo_option-set-container");const M=document.createElement("form");M.append(P);let F=[];const j=()=>{A.disabled=!0,A.classList.add("loading"),A.innerHTML=''},I=e=>{A.disabled=!1,A.classList.remove("loading"),A.innerHTML=e};r?A.addEventListener("click",(async function(e){setTimeout((async()=>{const o=A.innerHTML;if(j(),La(M,b)){e.preventDefault();let r={},s=0;const l=/properties\[(.*?)\]/;if(F&&!F.some((e=>"properties[_tpo_wholesale]"===e.name))){let d=M.querySelector('[name="properties[_tpo_wholesale]"]');d&&F.push(d)}for(const u of F){const{name:_="",value:h}=u,g=!_.includes("disabled")&&_.match(l);if(!g)continue;if(u.disabled)continue;if(!h.trim())continue;function i(e){const t=[],o=e.matchAll(/\[\s*\+?(?:\$\s*)?([\d,.]+)(?:\s*kr)?\s*\]/g);for(const e of o)t.push(Pn(e[1]));return t}r[g[1]]=h;const v=i(h);if(v?.length<2){let w=/\[ \+(.*)\]/,S=h.match(w);if(S){let E=Pn(S[1]);E&&(s+=E)}}else for(const $ of v)$&&(s+=$)}"no"!==Ro&&s?("expand"===Ro&&(r._tpo_custom_options=JSON.stringify(In(r))),r._tpo_price=parseFloat(s/Rt)):r._tpo_wholesale&&delete r._tpo_wholesale;let c=n||[];if(c&&0===c?.length){const x=await fetch("/cart.js?app=tpo",{method:"GET",headers:{"Content-Type":"application/json"}}),k=await(x?.json());k&&(c=k?.items||[])}const p=await Xn(f,M,A,r,a,y,c,m);C.style.display="none",C.innerHTML="","boolean"==typeof p&&!0===p?await Ja(t,y,r,n):"object"==typeof p&&null!==p&&(r={...r,...void 0!==p.properties._tpo_add_on_products&&{_tpo_add_on_products:p.properties._tpo_add_on_products,_tpo_price:p?.properties?._tpo_price||("expand"===Ro?"0":void 0)}},await Ja(t,y,r,n)),A.disabled=!1}else Zr(M)||Yr(ei);I(o)}),0)})):A.addEventListener("click",(async function(e){const t=document.querySelector(".tpo_modal-container");if(t){const e=t.querySelectorAll(".tpo_option-container");if(!Array.from(e).some((e=>e.classList.contains("tpo_hidden")))){const e=t.querySelectorAll(".tpo_error-message");if(Array.from(e).some((e=>""!==e.textContent.trim())))return!1}if(t.querySelector(".tpo-quantity-error")||Array.from(e).some((e=>e.querySelector(".tpo-quantity-error"))))return!1}const o=A.innerHTML;if(j(),La(d,b)){let e={},t=n||[];if(t&&0===t?.length){const e=await fetch("/cart.js?app=tpo",{method:"GET",headers:{"Content-Type":"application/json"}}),o=await(e?.json());o&&(t=o?.items||[])}await Xn(f,d,u,e,a,y,t,!1,c),C.style.display="none",A.disabled=!1}else Zr(d)||Yr(ei);I(o)})),t?.addEventListener("change",(function(){Oa(o,v,w,S,b)})),x.firstElementChild.append(T,M,w,S,A);const{tieredPrices:H,allowTieredPrices:B}=br(f);if(B){const e=vr(H,"cart",a);Object.assign(e,{className:"tpo_modal-tired-wholesale-wraper"}),A.parentElement&&("below_add_to_cart"===jo?A.parentElement.insertBefore(e,A.nextSibling):(e.style.marginBottom="30px",A.parentElement.insertBefore(e,A))),ra(H,Ro,M)}k||(c?p.append(L):o.append(L)),$||document.body.append(C),c&&"replace_add_to_cart"===pi&&(u.style.display="none")}async function Va(e,t){for(let o=window.TPOConfigs.product_options_tpo.length-1;o>=0;o--){let i=window.TPOConfigs.product_options_tpo[o].option_set;const n=y?.customer||{},a=n.tags||[],r=i.customer_tag||"{}",s=JSON.parse(r),{tagSet:l,appliedCustomer:c}=s,p=Object.keys(s).length<1||"ALL"===c||"GUEST"===c&&null===n.id||"LOGIN"===c&&n.id||"TAG"===c&&a.some((e=>l.includes(e))),d=i.status;let u=Pr(i?.title||"");if(0===d||!p||!u)continue;const m=i.apply_type;if(0===m)return i;if(1===m){if(i.option_set_products.length<1)continue;if(i.option_set_products.map((e=>e.product_id.slice(22))).includes(e?.toString()))return i}if(2===m){const e=i.product_condition?JSON.parse(i.product_condition):void 0;if(e&&e.conditions.length)if(e.conditions=e.conditions.map((e=>"string"==typeof e.value?{...e}:e.value.id?{...e,value:{...e.value,id:e.value.id.slice(25)}}:void 0)),oo.length&&oo.find((e=>e.productHandle===t))){if(await wn(e,t,!0))return i}else if(await wn(e,t))return i}}}async function Ua(){const e=await fetch("/cart.js?app=tpo-fetch",{method:"GET",headers:{"Content-Type":"application/json"}}),t=await e.json();return c=t?JSON.parse(JSON.stringify(t||{})):{},t}async function Ja(e,t,o,i){try{if(e&&"function"==typeof e.updateQuantity){const n=JSON.stringify({line:parseInt(t)+1,properties:o});await fetch("/cart/change.js",{method:"POST",headers:{"Content-Type":"application/json"},body:n}).then((async()=>{setTimeout((async()=>{await dr()}),1e3)})),await e.updateQuantity(parseInt(t)+1,i[t].quantity,document.activeElement.getAttribute("name")||"")}else{const n=JSON.stringify({line:parseInt(t)+1,properties:o,quantity:i[t].quantity});if(await fetch("/cart/change.js",{method:"POST",headers:{"Content-Type":"application/json"},body:n}).then((async()=>{setTimeout((async()=>{await dr()}),1e3)})),Z.includes("Shrine")){let t=ln?Array.from(e.querySelectorAll(ye))[0]:Array.from(e.querySelectorAll(he))[0];"INPUT"!==t.tagName&&(t=t.querySelector("input")),t&&"INPUT"===t.tagName&&t.dispatchEvent(new Event("change",{bubbles:!0}))}else window.location.reload()}}catch(e){throw new Error(e)}}async function Ra(e){let t=[];for(let o=0;o=0;t--){let{min:o,max:i,t:n,v:r}=e[t];if(l>=o&&(!i||l<=i)){p="f"===n?r*Rt*100:a*(r/100)/(1-r/100);break}}}const d=await Va(n,r),u=d?.wholesale_price||{},m=JSON.parse(u.price_set||"[]"),_=JSON.parse(u.customer_tag||"{}").appliedCustomer||"ALL",f=JSON.parse(u.customer_tag||"{}").tagSet||[],h=JSON.parse(u.customer_tag||"{}").excludeTagSet||[],g=y?.customer||{},b=g.tags||[],v=m.length>0&&ai&&("ALL"===_||"GUEST"===_&&null===g.id||"LOGIN"===_&&g.id||"TAG"===_&&b.some((e=>f.includes(e)))||"EXCLUDE_TAG"===_&&!b.some((e=>h.includes(e))));let w=0,S=0;if(i.properties&&!i.properties.hasOwnProperty("_tpo_price"))for(let[e,t]of Object.entries(i.properties))if(t&&"string"==typeof t)for(let e of t.split("],")){e.endsWith("]")||(e+="]");let t=/\[ \+(.*)\]/,o=e.match(t);if(o){let e=o[1],t=Pn(e);t=Mn(e,i),w+=parseFloat(100*t)}}S=w+a-Aa(w+a,{value:i.quantity},v,m,a,"cart"),p&&p!==S&&t.push({line:o+1,quantity:0}),ln&&Qa({discountPrice:S,allowTieredPrices:v,index:o,wholesaleDiscount:p}),cn&&setTimeout((()=>{Ga({discountPrice:S,allowTieredPrices:v,index:o,wholesaleDiscount:p})}),1e3)}}async function Wa(e){let t=await Ua();if(await Ra(t),ln){const e={childList:!0,subtree:!0},t=async(e,t)=>{if(Array.from(e[0].addedNodes).includes(pn.querySelector([".cart-items",".cart-total-label"]))){let e=await Ua();if(Object.keys(e).length<1)return;await Ra(e)}};new MutationObserver(t).observe(pn,e)}if(cn){const e={childList:!0,subtree:!0},t=async(e,t)=>{let o=Array.from(e[0].addedNodes);const i=[...pe,".loading-overlay"];if(o.includes(rn.querySelector(i))){let e=await Ua();if(Object.keys(e).length<1)return;await Ra(e)}};new MutationObserver(t).observe(rn,e)}}function Qa(e){const{discountPrice:t,allowTieredPrices:o,index:i,wholesaleDiscount:n}=e;let a=t;n&&(a=n);let r=pn.querySelectorAll(ue)[i];r||(r=document.querySelectorAll(ue)[i]);const s=r?r.querySelector(me):null;if(s){s.classList.add("tpo_cart-properties-wrapper");const e=document.createElement("div");Object.assign(e,{className:"tpo_discount-wrapper",innerHTML:a>0?`${Io?ba(Io,""):"Wholesale discount"}: -${PriceFormatter.formatMoney(parseFloat(a),!0)}`:""});const t=r.querySelector(".tpo_discount-wrapper");o&&s&&(t?t.innerHTML=a>0?`${Io?ba(Io,""):"Wholesale discount"}: -${PriceFormatter.formatMoney(parseFloat(a),!0)}`:"":s.insertAdjacentElement("afterend",e))}}function Ga(e){const{discountPrice:t,allowTieredPrices:o,index:i,wholesaleDiscount:n}=e;let a=t;if(n&&(a=n),_n(),sn.length)for(let e=0;eArray.from(t.querySelectorAll(e))));n=e[i]}else n=t.querySelectorAll(ue)[i];const r=n&&n.querySelector(me)||document.createElement("div"),s=document.createElement("div");Object.assign(s,{className:"tpo_discount-wrapper",innerHTML:a>0?`${Io?ba(Io,""):"Wholesale discount"}: -${PriceFormatter.formatMoney(parseFloat(a),!0)}`:""});let l=n?n.querySelector(".tpo_discount-wrapper"):null;l&&l.parentElement.removeChild(l),o&&r&&r.insertAdjacentElement("afterend",s)}}async function Xa(){if(tn&&ln){function e(e){let t=Array.from(pn.querySelectorAll(he)||[]);t.length||(t=Array.from(an?.querySelectorAll(ye)||[]));for(let e=0;e{const i=[".cart-items",".cart-total-label",".cart__price"];if(Array.from(t[0].addedNodes).includes(pn.querySelector(i))||t[0].target===pn.querySelector(i)){let t=await Ua();if(Object.keys(t).length<1)return;let o=t.items,{productDetailElements:i}=e(o);await Da({cartItemsElement:an,productDetailElements:i,cartItems:o})}})).observe(pn,{childList:!0,subtree:!0}),await Da({cartItemsElement:an,productDetailElements:i,cartItems:o})}()}}async function Za(){if(tn&&cn)for(let o=0;o{let n=Array.from(t[0].addedNodes);const a=[...pe,...ue,".loading-overlay",".drawer__content"];n.includes(i.querySelector(a))&&(o.disconnect(),setTimeout((async()=>{await e()}),1500))})).observe(i,t)}}else{r=i?.querySelector('form[action="/cart"]'),r||(r=i);let t=i.querySelectorAll(ye.join(", ")),o=i.querySelectorAll(be.join(", ")),n=i.querySelectorAll(le);t.forEach((function(t){t.addEventListener("change",(async function(){Zt(),setTimeout((async()=>{await e()}),1500)}))})),n.forEach((function(t){t.addEventListener("click",(async function(){Zt(),setTimeout((async()=>{await e()}),1500)}))})),o.forEach((function(t){t.addEventListener("click",(async function(){Zt(),setTimeout((async()=>{await e()}),1500)}))}))}await Da({cartItemsElement:r,productDetailElements:a,cartItems:n})}function t(e){n=i.querySelectorAll(pe)[0],n?n.onChange=function(){return!1}:n=i?.querySelector('form[action="/cart"]')||document.createElement("div"),a=i?.querySelector('form[action="/cart"]')||document.createElement("form");let t=Array.from(a.querySelectorAll(he)||[]);t.length||(t=Array.from(n.querySelectorAll(he)||[]));for(let e=0;e{await e();let t=await Ua();Object.keys(t).length<1||bs(t.items,"DRAWER")}),1e3)}}function Ya(e){if(qe.includes(Q)){const t=window.location.href;let o=co.length?Array.from(co[0].querySelectorAll($e)):[];if(J!==t){J=t,o.length&&(po=[...o],po.forEach((e=>{e.classList.remove("tpo-isactive-image")})),uo=[...o.map((e=>{const t=e.querySelectorAll("img");if(t.length)return t[0].getAttribute("alt")}))]);let e="";o[0]?.parentNode?.style?.transform&&(e=o[0]?.parentNode?.style?.transform.includes("%")?o[0]?.parentNode?.style?.transform.replace(/(\d+)%/,((e,t)=>`-${t}%`)):o[0]?.parentNode?.style?.transform.replace(/translateX\(([^)]+)\)/,((e,t)=>`translateX(${t})`))),et=e}if(e){if(po.length){const t=uo.findIndex((t=>t.toLowerCase()===e.toLowerCase()));if(-1!==t){po.forEach((e=>{e.classList.remove("tpo-isactive-image")}));const e=po[t];if(e.classList.add(["tpo-isactive-image"]),ls("tpo_custom_background_image",e.querySelector("img").getAttribute("src"),!0),D?.targetSelectorSetting&&"product__media-list contains-media grid grid--peek list-unstyled slider slider--mobile"!==D?.targetSelectorSetting?co[0].style.height=`${e.querySelectorAll("img")[0].offsetHeight}px`:po[0].classList.remove("is-active"),e.style.transform){let t="";t=e.style.transform.includes("%")?e.style.transform.replace(/(\d+)%/,((e,t)=>`-${t}%`)):e.style.transform.replace(/translateX\(([^)]+)\)/,((e,t)=>`translateX(-${t})`)),po[0].parentNode.style.transform=t}else if(co[0].style.transform){let t="";const o=e.querySelector("img").width||e.style.width;t="number"==typeof o?`translateX(-${o})`:o.replace(/translateX\(([^)]+)\)/,((e,t)=>`translateX(-${t})`)),po[0].parentNode.style.transform=t}o[0].parentNode.insertBefore(e,o[0])}}}else{po[0].style.transform&&et&&(po[0].parentNode.style.transform=et);const e=po[0].parentNode,t=e.querySelector(".tpo_canvas_builder");e.innerHTML="",po.forEach((t=>{t.classList.remove("tpo-isactive-image"),e.appendChild(t)})),t&&(ls("tpo_custom_background_image",po[0].querySelector("img").getAttribute("src"),!0),e.appendChild(t)),D?.targetSelectorSetting&&"product__media-list contains-media grid grid--peek list-unstyled slider slider--mobile"!==D?.targetSelectorSetting?(e.style.height=`${po[0].querySelectorAll("img")[0].offsetHeight}px`,co[0].style.height=`${po[0].querySelectorAll("img")[0].offsetHeight}px`):po[0].classList.add("is-active")}}else co&&co.length&&co.forEach((t=>{let o=Array.from(t.querySelectorAll($e));if(o.length&&(po=[...o],uo=[...o.map((e=>{const t=e.querySelectorAll("img");if(t.length)return t[0].getAttribute("alt")}))]),e){if(po.length){const t=uo.findIndex((t=>t.toLowerCase()===e.toLowerCase()));if(-1!==t){const e=po[t],o=e.querySelector("img");if(o){let t=new CustomEvent("click",{bubbles:!0,cancelable:!0,detail:e});o.dispatchEvent(t)}}}}else{const e=po[0];if(e){const t=e.querySelector("img");if(t){let o=new CustomEvent("click",{bubbles:!0,cancelable:!0,detail:e});t.dispatchEvent(o)}}}}))}new MutationObserver((function(e){if(window.location.href!==J){let e=co.length?Array.from(co[0].querySelectorAll($e)):[];e.length&&e.forEach((e=>{e.classList.remove("tpo-isactive-image")}))}})).observe(document,{subtree:!0,childList:!0});const Ka={1:["debut","narrative","venture","minimal","simple","express","supply","boundless","brooklyn"],2:["refresh","ride","colorblock","taste","studio","craft","crave","sense","dawn","origin","publisher"]};let er="",tr=function(e){for(const t in Ka)if(Ka[t].some((t=>e.includes(t.toLowerCase()))))return t;return null}(Z.toLowerCase()||"");2==tr&&ln&&(er="page-width");const or=`\n\n
      \n
      \n
      \n \n
      \n
      ${mi}
      \n
      \n
      \n
      \n
      \n
      \n
      \n
      \n
      `;async function ir(){const e=document.querySelector(".tpo-discount-code--applied-wrapper"),t=document.querySelector(".tpo-discount-code--summary-wrapper"),o=document.querySelector("#tpo-discount-code--message"),i=document.querySelector(".tpo-discount-code-block .tpo-discount-code-input--button"),n=document.querySelector(".tpo-discount-code-block").querySelector("input.tpo-discount-code-input--input"),a=i.querySelector("div.tpo-loader");i.classList.remove("tpo-button-active"),i.style.pointerEvents="all",a.classList.remove("button--loading"),e.innerHTML="",t.innerHTML="",o.innerHTML="",n.value="",nr(),await dr()}function nr(){const e=document.querySelector(".tpo_custom_cart_old_price");if(!e)return;e.classList.add("tpo_hidden");const t=document.querySelector(".tpo_custom_cart_total");t&&(t.classList.remove("tpo_custom_cart_new_price"),dr())}async function ar(){let e=document.querySelector(".tpo-discount-code-block .tpo-discount-code-input--button"),t=document.querySelector(".tpo-discount-code-block")||null,o=t?t.querySelector("input.tpo-discount-code-input--input"):null,i=o?o.value.trim():"",n=document.querySelector(".tpo-discount-code--applied-wrapper"),a=document.querySelector(".tpo-discount-code--summary-wrapper");const r=document.querySelector("#tpo-discount-code--message");if(!i)return r.innerHTML=yi,r.classList.add("invalid"),void r.classList.remove("valid");r.innerHTML="",e.classList.add("tpo-button-active"),e.style.pointerEvents="none";const s=e.querySelector("div.tpo-loader");s.classList.add("button--loading");const l=await Ua();if(l.item_count<1)return o.value="",void await ir();let c={line_items:l,cart:An,customer:E,discount_code:i,locale:{shouldUseMultiCurrency:Ut,locale:Qt,currency:Wt}};const p={method:"POST",headers:{Accept:"application/json, text/plain, */*","Content-Type":"application/json",shop:Q},body:JSON.stringify(c)};await fetch(`https://${window.location.host}/discount/${i}`,{method:"GET",headers:{"Content-Type":"application/json"}}),await fetch(`${An.easifyUrl}apps/discount-code`,p).then((function(e){if("200"==e.status)return e.json().then((function(e){let t=e.discount_amount;n.innerHTML=`\n
      \n \n ${i}\n
      ×
      `,a.innerHTML=`\n
      \n ${fi}\n -${PriceFormatter.formatMoney(Number(t)/100,!0)}\n
      `,r.innerHTML=`Discount code '${i}' applied`,r.classList.add("valid"),r.classList.remove("invalid"),s.classList.remove("button--loading"),document.querySelector(".tpo-discount-code--applied-wrapper--applied-remove").addEventListener("click",(async()=>{await ir()})),function(e){const t=function(){if(!An.cartJson.items||!An.cartJson.items.length)return 0;let e=An.cartJson.tpo_add_price||0;return An.cartJson.items.forEach((t=>{e+=t.original_line_price})),e}();if(!t)return;const o=t-e;if(o<0)return;const i=document.querySelector(".tpo_custom_cart_old_price");if(!i)return;const n=document.querySelector(".tpo_custom_cart_total");n&&(n.innerHTML=PriceFormatter.formatMoney(o),n.classList.add("tpo_custom_cart_new_price"),i.classList.remove("tpo_hidden"),i.innerHTML=PriceFormatter.formatMoney(t))}(t/100)}));r.innerHTML=hi,r.classList.add("invalid"),r.classList.remove("valid"),s.classList.remove("button--loading"),n.innerHTML="",a.innerHTML="",nr()})).catch((e=>{r.innerHTML=hi,r.classList.add("invalid"),r.classList.remove("valid"),s.classList.remove("button--loading"),n.innerHTML="",a.innerHTML="",nr()})).finally((()=>{dr()})),e.classList.remove("tpo-button-active"),e.style.pointerEvents="auto"}async function rr(){let e=document.querySelector(".tpo-discount-code-block")||null,t=e?e.querySelector("input.tpo-discount-code-input--input"):null;if(!t)return;const o=t.value.trim();setTimeout((async()=>{o&&(t.value="",t.value=o,await ar()),Array.from(document.querySelectorAll(ye)||[]).forEach(((e,t)=>{e.addEventListener("change",(async()=>{await rr()}))})),Array.from(document.querySelectorAll(le)||[]).forEach(((e,t)=>{e.addEventListener("click",(async()=>{await rr()}))})),await dr()}),1e3)}if(li&&ln){const e=['form[action="/cart"]:last-child',"table.line-item-table"],t=["vent-yourcar.myshopify.com","bc7269.myshopify.com","funfactory-hr.myshopify.com"];if(2==tr)document.querySelector("main .shopify-section").insertAdjacentHTML("afterend",or);else if(1==tr)document.querySelector('form[action="/cart"] table').insertAdjacentHTML("afterend",or);else if(t.includes(Q))document.querySelector('form[action="/cart"]').lastElementChild.insertAdjacentHTML("beforebegin",or);else{let t=document.querySelector(".tpo-discount-box-custom");t||(t=document.querySelector(e)),t&&t.insertAdjacentHTML("beforeend",or)}document.querySelector("input.tpo-discount-code-input--input")&&(document.querySelector("input.tpo-discount-code-input--input").addEventListener("keydown",(e=>{13===e.keyCode&&(e.preventDefault(),e.stopPropagation(),ar())})),document.querySelector(".tpo-discount-code-input--button").addEventListener("click",(e=>{ar()}))),Array.from(document.querySelectorAll(ye)||[]).forEach(((e,t)=>{e.addEventListener("change",(()=>{rr()}))})),Array.from(document.querySelectorAll(le)||[]).forEach(((e,t)=>{e.addEventListener("click",(()=>{rr()}))}))}function sr(e){if(!e.cart_level_discount_applications||!e.cart_level_discount_applications.length)return;const t=e.cart_level_discount_applications.find((e=>"discount_code"===e.type));if(!t)return;const o=t.title,i=document.querySelector(".tpo-discount-code-input--input");i&&(i.value=o)}function lr(e){const{cartContents:t,visibleTotalPriceElements:o,listLoopTotalPriceElements:i,cartTotalPriceElement:n,cartSubTotalPriceElement:a}=e;let r=0,s=0,l=t.items;if(o.forEach(((e,t)=>{let o="classyironworks.myshopify.com"===Q?e.dataset.key:l[t]?.key,n=0,a=0,c=l[t]?.final_line_price,p=l[t]?.final_line_price,d=l[t]?.total_discount;e.setAttribute("tpo-data-key",o);let u=An.cartJson.items.find((e=>e.key===o));if("classyironworks.myshopify.com"===Q){const e=l.find((e=>e.key===o));c=e?.final_line_price,p=e?.original_line_price}u&&u.tpo_final_add_price&&(n=u.tpo_final_add_price||0),u&&u.tpo_add_on_product_price&&(a=u.tpo_add_on_product_price),"classyironworks.myshopify.com"===Q?(d=l.find((e=>e.key===o))?.total_discount,i.find((t=>t===e.dataset.key))||(i.push(e.dataset.key),u?(s+=u.original_line_price+u.tpo_add_price,r+=u.original_line_price+u.tpo_add_price):(s+=p,r+=p),d&&(s-=d,r-=d))):(s+=u?u.original_line_price+u.tpo_add_price:p,r+=c||0+n||0),c=c+n+a,c=Sa(c);const m=PriceFormatter.formatMoney(c);if(e.children.length?e.textContent=e.textContent.replace(e.textContent,m):e.innerHTML=e.innerHTML.replace(e.innerHTML,m),d&&u&&u.tpo_add_price){let t=e.parentElement.querySelector(ie);if(t){const e=u.original_line_price+u.tpo_add_price;t.innerHTML=PriceFormatter.formatMoney(e)}}})),n.length&&r){const e=document.querySelector(".tpo_custom_cart_old_price");n.forEach((t=>{if(t.classList.contains("tpo_custom_cart_total")&&e&&!e.classList.contains("tpo_hidden"))return;const o=t.innerHTML;t.innerHTML=t.innerHTML.replace(o,PriceFormatter.formatMoney(r))}))}else if(a&&!r){r=An.cartJson.tpo_add_price+t.total_price;let e=a.innerHTML;a.innerHTML=a.innerHTML.replace(e,PriceFormatter.formatMoney(r))}else if(a&&r){let e=a.innerHTML;a.innerHTML=a.innerHTML.replace(e,PriceFormatter.formatMoney(r))}}function cr(e,t,o){let i,n=e.querySelectorAll(oe),a=document.querySelectorAll(ne);i=$t.includes(Z)?Array.from(e.querySelectorAll(ue)).filter((e=>e.closest("tbody"))):e.querySelectorAll(ue);let r=[];i&&i.length&&(r=Array.from(i).filter((e=>!e.classList.contains("tpo_ignore"))),Z.includes("Prestige")&&"bella-mauve.myshopify.com"!==Q&&(r=r.filter((e=>"tr"===e.tagName.toLowerCase()&&!e.classList.contains("line-item")))));let s=e.querySelectorAll(re)[0];const l=Array.from(n).filter((e=>{let t=e.closest("td");if(!t){const o=[".cart__item--price",".cart__price",".cart-item__price",".cart-item__total",".cart-drawer__items",".cart--price"];t=e.closest(o)||e}return"none"!==getComputedStyle(t).display&&!("CART-DRAWER"===t.parentElement.tagName&&ln)}));"page"===t&&(a=document.querySelectorAll(ae)),function(e,t,o,i,n,a,r){let s=e.items;const l=e.currency;let c=0,p=0;if(s.length){a.length,s.length;let t=a.length===2*s.length;if("classyironworks.myshopify.com"===Q?a.forEach(((e,o)=>{e.classList.add("tpo_cart_item_price");let i=t?o%s.length:o,n="classyironworks.myshopify.com"===Q?e.dataset.key:s[i]?.key,a=0,l=0,d=s[i]?.final_line_price,u=s[i]?.final_line_price,m=s[i]?.total_discount;e.setAttribute("tpo-data-key",n);let _=An.cartJson.items.find((e=>e.key===n));if("classyironworks.myshopify.com"===Q){const e=s.find((e=>e.key===n));d=e?.final_line_price,u=e?.original_line_price}_&&_.tpo_final_add_price&&(a=_.tpo_final_add_price||0),_&&_.tpo_add_on_product_price&&(l=_.tpo_add_on_product_price),"classyironworks.myshopify.com"===Q?(m=s.find((e=>e.key===n))?.total_discount,r.find((t=>t===e.dataset.key))||(r.push(e.dataset.key),_?(p+=_.original_line_price+_.tpo_add_price,c+=_.original_line_price+_.tpo_add_price):(p+=u,c+=u),m&&(p-=m,c-=m))):(p+=_?_.original_line_price+_.tpo_add_price:u,c+=t?(d+a)/2:d+a),d=d+a+l,d=Sa(d);const f=PriceFormatter.formatMoney(d);if(e.children.length?e.textContent=e.textContent.replace(e.textContent,f):e.innerHTML=e.innerHTML.replace(e.innerHTML,f),m&&_&&_.tpo_add_price){let t=e.parentElement.querySelector(ie);if(t){const e=_.original_line_price+_.tpo_add_price;t.innerHTML=PriceFormatter.formatMoney(e)}}})):i.forEach(((e,t)=>{let o=e.querySelectorAll(oe.join(","));const i=Array.from(o).filter((e=>{let t=e.closest("td");if(!t){const o=[".cart__item--price",".cart__price",".cart-item__price",".cart-item__total",".cart-drawer__items",".cart--price"];t=e.closest(o)||e}return"none"!==getComputedStyle(t).display&&!("CART-DRAWER"===t.parentElement.tagName&&ln)})),n=s[t]?.properties,a=n?._tpo_one_time_charges?JSON.parse(n?._tpo_one_time_charges):[],r=n?._tpo_add_on_keys?JSON.parse(n?._tpo_add_on_keys):[];let p=[];s.forEach(((e,t)=>{const o=e.properties||{},i=o._is_one_time_charge,n=o._tpo_add_on_key;a&&r&&a.find((e=>e===i))&&r.find((e=>e===n))&&p.push({key:i,price:e.final_line_price})})),i.forEach(((e,o)=>{e.classList.add("tpo_cart_item_price");const n=s[t];let a=0,r=0,d=n?.key,u=n?.final_line_price,m=An.cartJson.items.find((e=>e.key===d));if(m&&m.tpo_final_add_price&&(a=m.tpo_final_add_price||0,a=pr(n,l,a)),m&&m.tpo_add_on_product_price){const e=m.quantity;r=m.tpo_add_on_product_price,p.length&&p.forEach((t=>{r-=(e-1)*t.price})),r=pr(n,l,r)}c+=(u+a)/i.length,u=u+a+r,u=Sa(u);const _=PriceFormatter.formatMoney(u);_&&_!==e.textContent&&(e.children.length?e.textContent=e.textContent.replace(e.textContent,_):e.innerHTML=e.innerHTML.replace(e.innerHTML,_))}))})),!["555b61.myshopify.com","zoe-app-testing.myshopify.com"].includes(Q))if(c=Sa(c),o.length&&c){const e=document.querySelector(".tpo_custom_cart_old_price");o.forEach((t=>{if(t.classList.contains("tpo_custom_cart_total")&&e&&!e.classList.contains("tpo_hidden"))return;const o=t.innerHTML;t.innerHTML!==PriceFormatter.formatMoney(c)&&(t.innerHTML=t.innerHTML.replace(o,PriceFormatter.formatMoney(c)))}))}else if(n&&!c){c=An.cartJson.tpo_add_price+e.total_price;let t=n.innerHTML;n.innerHTML!==PriceFormatter.formatMoney(c)&&(n.innerHTML=n.innerHTML.replace(t,PriceFormatter.formatMoney(c)))}else if(n&&c){let e=n.innerHTML;n.innerHTML!==PriceFormatter.formatMoney(c)&&(n.innerHTML=n.innerHTML.replace(e,PriceFormatter.formatMoney(c)))}}}(o,0,a,r,s,l,[])}function pr(e,t,o){if(!Ut)return o;const i=e.properties||{},n=i._tpo_active_currency,a=i._tpo_currency_rate||1;return n?t===n?o:o/a*Rt:o}async function dr(){if((A.includes(Q)||["e9aae7-43.myshopify.com"].includes(Q))&&!["felara.myshopify.com","erikampowell.myshopify.com","bebebydunja.myshopify.com","hicapahub.myshopify.com","faa1a1-4.myshopify.com","roots-to-table.myshopify.com","urquid3636.myshopify.com","tougecon.myshopify.com","pansabella.myshopify.com","deae89-3.myshopify.com"].includes(Q))return;Zt(),Un(),Yt();const e=window.theme&&"function"==typeof window.theme.addDelegateEventListener||["aa5b29-4.myshopify.com","e950f8-3.myshopify.com"].includes(Q)?2e3:1e3;let t=await Ua(),o=t?.items;bs(o,"DRAWER"),"bundle"!==Wo&&"no"===Ro||await zn(o),function(e){const t=document.querySelector([".additional-checkout-buttons",".dynamic-checkout__content"]);if(!t)return;let o=function(e){if(!e.length)return!1;for(const t of e){let e=t.properties;if(e&&"{}"!==e.toString())for(let[o,i]of Object.entries(e))if(i&&"string"==typeof i){let e=/\[ \+(.*)\]/,o=i.match(e);if(o){let e=o[1],i=Pn(e);if(i=Mn(e,t),i)return!0}}}return!1}(e.items);t.style.pointerEvents=o?"none":"auto"}(t);let i=t.note,n=t.attributes;["sublimajewels.myshopify.com","jeff-s-specialty-sports.myshopify.com","a06aea-2.myshopify.com","class-act-eyecare.myshopify.com","costlowboxes.myshopify.com","2ha3wr-mt.myshopify.com"].includes(Q)&&await async function(e){const t=e.items.filter((function(e){return"_tpo_add_on_key"in e.properties})),o=e.items.filter((function(e){return"_tpo_is_main_product"in e.properties})).map((function(e){return e.properties._tpo_add_on_keys})),i={};t.forEach((function(e){-1===o.toString().indexOf(e.properties._tpo_add_on_key)&&(i[e.key]=0)})),Object.keys(i).length&&fetch(`${st}cart/update.js`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({updates:i})}).then((function(){window.location.reload()}))}(t),function(e){let t=document.querySelector('textarea[name="note"]')||document.querySelector(".tpo-cart-note");t&&(t.value=e||"",t.addEventListener("change",la((e=>{fetch("/cart/update.js",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({note:e.target.value})})}),300)))}(i),function(e){let t=document.querySelectorAll('form[action="/cart"] input[name*="attributes["]'),o=t.length?t:document.querySelectorAll(".tpo-cart-attribute");for(let t=0;t{fetch("/cart/update.js",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({attributes:{...e,[n]:t.target.value}})})}),300)))}}(n),await Dn(t),q.includes(Q)||("scarves-by-ruthie-l-designs.myshopify.com"===Q?function(e){let t=e.items;if(!t||!t.length)return;const{cartPageElement:o,cartDrawerElements:i,hasCartDrawer:n}=_n();sr(e);let a=Array.from(document.querySelectorAll(ue));if(ln&&n&&(a=a.filter((e=>{let t=!0;for(let o=0;o!!e.offsetParent));s.length,t.length,s.length,t.length,lr({cartContents:e,visibleTotalPriceElements:s,listLoopTotalPriceElements:n,cartTotalPriceElement:a,cartSubTotalPriceElement:r})}if(n&&i.length)for(let o=0;o{let t=e.closest(["td",".tt-list-parameters",".cart-table-mobile"]);if(!t){const o=[".cart__item--price",".cart__price",".cart-item__price",".cart-item__total",".cart-drawer__items",".cart--price"];t=e.closest(o)||e}return"none"!==getComputedStyle(t).display&&!("CART-DRAWER"===t.parentElement.tagName)}));c.length,t.length,c.length,t.length,lr({cartContents:e,visibleTotalPriceElements:c,listLoopTotalPriceElements:r,cartTotalPriceElement:s,cartSubTotalPriceElement:l})}}(t):function(e){let t=e.items;if(!t||!t.length)return;const{cartPageElement:o,cartDrawerElements:i,hasCartDrawer:n,listCartPageElements:a}=_n();sr(e);let r=Array.from(document.querySelectorAll(ue));if(ln&&n&&(r=r.filter((e=>{let t=!0;for(let o=0;o1)for(let t=0;t{await dr(),t.style.pointerEvents="unset",o.forEach((function(e){e.disabled=!1}))}),e)})),window.theme&&"District"===window.theme.info?.name&&(t.onchange=function(){if(an&&"function"==typeof an.updateQuantity){if(void 0===t.dataset.index)return;an.updateQuantity(t.dataset.index,t.value,document.activeElement.getAttribute("name")||"")}}))})),o.forEach((t=>{ur(t)||t.classList.contains("tpo")||(t.classList.add("tpo"),t.addEventListener("click",(async function(){Zt(),setTimeout((async()=>{await dr(),await easifyHandleUpdateCartWithAddonProduct(),await Za(),await Xa(),t.disabled=!1}),e)})))}))}const r=document.querySelectorAll(le.join(","));if(r.length)for(let t=0;t{await dr(),await easifyHandleUpdateCartWithAddonProduct(),await Za(),await Xa()}),e)})))}const s=document.querySelectorAll(gt);if(s.length)for(let t=0;t{await dr()}),e)})))}["cyrell-shop.myshopify.com","sublimajewels.myshopify.com"].includes(Q)&&await hr(),await Xa()}function ur(e){return!!e.closest(Se)}function mr(e,t,o=""){let i=e.querySelectorAll(t)||e.closest(".cart")?.querySelectorAll(t)||e.closest(".container")?.querySelectorAll(t)||[];const n=document.querySelector(".cart-drawer__inner");return"drawer"===o&&$t.includes(Z)&&n.querySelector(".cart-items__table thead tr.cart-items__table-row")&&i[0]?.classList.add("tpo_ignore"),Array.from(i).filter((e=>!e.classList.contains("tpo_ignore")))||[]}function _r(e,t,o){const i=e&&Ce.length?Array.from(e.querySelectorAll(Ce)):[],n=e&&xe.length?Array.from(e.querySelectorAll(xe)):[];if(o&&e&&t)for(let r=0;r!!e.offsetParent))[0],u&&(p=Array.from(u.querySelectorAll(ye))[0]),a()}if("drawer"===t){const y=mr(e,ue,t);if(m=y&&y.length?y[r]:document.createElement("div"),p=m?m.querySelector(he):null,u&&(p=Array.from(u.querySelectorAll(he))[0]),"elarceilingfans.myshopify.com"===Q){const h=m.querySelector(".qtyField span.qtyBtn");h&&(p.value=Number(h.innerHTML))}a(),window.easifyCustomDisableButton&&document.dispatchEvent(new Event("easifyEnableButtonAfterLoad"))}function a(){let e=m&&Array.from(m.querySelectorAll(be))||[];d=m?m.querySelector(me):null;let t=m?Array.from(m.querySelectorAll(le))||[]:null;if(u&&(e=u&&Array.from(u.querySelectorAll(be))||[],t=u?Array.from(u.querySelectorAll(le))||[]:null),d){d.classList.add("tpo_cart-properties-wrapper");for(const[e,t]of Object.entries(s.properties))if(no.includes(e)){m.classList.add("tpo_add_on_product"),s.properties&&s.properties._is_one_time_charge&&m.classList.add("tpo_one_time_charge");break}for(const e of d.children){if(no.some((t=>e.innerHTML.includes(t)))){e.style.display="none",m.classList.add("tpo_add_on_product"),s.properties&&s.properties._is_one_time_charge&&m.classList.add("tpo_one_time_charge");continue}const t=["dd"],o=e.querySelector(t);if(!o||!o.textContent.includes("apps/easify-po/apps/download"))continue;let i=o.textContent.split(", ").map((e=>{const[t,o=""]=e.split(/ (?=\[)/);return`${new URL(t).searchParams.get("name")} ${o}`})).join(", ");o.innerHTML=i}}s.properties?._one_time_per_cart&&(m.classList.add("tpo_disabled_item"),yr(e,m,t)),(l.length||1==s.properties._tpo_is_main_product)&&m.classList.remove("tpo_add_on_product");const i=!p||"INPUT"!==p.tagName&&"SELECT"!==p.tagName?p?.querySelector("input").value||1:p.value;if(s.properties._tpo_main_product_id)ni?u?(u.classList.add("tpo_disabled_item"),yr(e,u,t)):(m.classList.add("tpo_disabled_item"),yr(e,m,t)):m.classList.add("tpo_hidden");else if(s.properties._tpo_is_main_product){if(e[0]&&e[1]){e[0].classList.contains("incr")&&e[1].classList.contains("decr")&&(e=[e[1],e[0]]);let t=e[0];t.href&&(t.href="##");let i=1;if(p){let e;e="INPUT"!==p.tagName?p.querySelector("input"):p,i=Number(e.value)}1===i&&(t=e[0].cloneNode(!0),t.classList.remove("tpo_add_on"),e[0].replaceWith(t)),t.style.cursor="pointer",t.classList.contains("tpo_add_on")||(t.removeAttribute("on:click"),t.hasAttribute("onclick")&&t.removeAttribute("onclick"),T.find((e=>e===Q))&&p&&p.value&&Number(p.value)<=1&&"BUTTON"===t.tagName&&(t.disabled=!0),t.addEventListener("click",(async function(e){if(e.preventDefault(),e.stopImmediatePropagation(),p){let t;if(t="INPUT"!==p.tagName?p.querySelector("input"):p,t)if(1===i){const t=0;let i={updates:{[s.key]:t.toString()}};const n=s.properties?._tpo_products_per_cart?JSON.parse(s.properties?._tpo_products_per_cart):[];if(l.length||n.length){const a=fr(n,o.items,s.key);e.stopPropagation();for(let e=0;et.properties._tpo_add_on_key===l[e]))?.key;n&&(i.updates[n]=t.toString())}a.forEach((e=>{e&&(i.updates[e]=t.toString())})),await fetch("/cart/update.js",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)}).then((e=>{window.location.reload()})).catch((e=>{alert("Remove item failed: Minus button"),window.location.reload()}))}}else if(i>1){t.dataset.wholesaleStep?t.value=i-parseInt(t.dataset.wholesaleStep):t.value=i-1,p.value=Number(t.value);const e=new Event("change");p.dispatchEvent(e)}}}),!0),t.classList.add("tpo_add_on"));let n=e[1];n.href&&(n.href="##");let a=1;if(p){let e;e="INPUT"!==p.tagName?p.querySelector("input"):p,a=Number(e.value)}n.style.cursor="pointer",n.classList.contains("tpo_add_on")||(n.removeAttribute("on:click"),n.hasAttribute("onclick")&&n.removeAttribute("onclick"),n.addEventListener("click",(function(e){if(e.preventDefault(),p){let e;e="INPUT"!==p.tagName?p.querySelector("input"):p,e.dataset.wholesaleStep?e.value=a+parseInt(e.dataset.wholesaleStep):e.value=a+1,p.value=Number(e.value);const t=new Event("change");p.dispatchEvent(t)}})),n.classList.add("tpo_add_on"))}if(p){let e=[];ln?e=u?u.querySelectorAll(ye):m.querySelectorAll(ye):cn&&!ln&&(e=u?u.querySelectorAll(he):m.querySelectorAll(he)),Array.from(e).forEach((e=>{e.classList.contains("tpo_add_on")||(e.addEventListener("change",(async function(t){m.classList.add("tpo_loading_fade");let n=Number(t.target.value);if(n){e.dataset.wholesaleStep&&(n=Math.ceil(n/e.dataset.wholesaleStep)*e.dataset.wholesaleStep);let t={id:s.key,quantity:n,updates:{}};if(t.updates&&(t.updates[s.key]=n.toString()),l.length){for(let e=0;e{if(t.properties._tpo_add_on_key===l[e]&&!c.find((e=>e===t.properties._is_one_time_charge)))return a=t.quantity,!0}))?.key;if(t.updates||(t.updates={}),r)if(a==i)t.updates[r]=n.toString();else{let e=Number(a)/Number(i),o=Number(n)*Number(e);t.updates[r]=o.toString()}}setTimeout((async()=>{await fetch("/cart/update.js",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}).then((e=>{m.classList.remove("tpo_loading_fade"),!ln&&Br()||window.location.reload()}))}),1e3)}else{if(await fetch("/cart/update.js",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}),m.classList.remove("tpo_loading_fade"),!ln&&Br())return;window.location.reload()}}else{const e="0";let i={updates:{[s.key]:e.toString()}};const n=s.properties?._tpo_products_per_cart?JSON.parse(s.properties?._tpo_products_per_cart):[];if(l.length||n.length){const a=fr(n,o.items,s.key);t.stopPropagation();for(let t=0;te.properties._tpo_add_on_key===l[t]))?.key;n&&(i.updates[n]=e.toString())}a.forEach((t=>{t&&(i.updates[t]=e.toString())})),await fetch("/cart/update.js",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)}).then((e=>{!ln&&Br()||window.location.reload()}))}}})),e.classList.add("tpo_add_on"))}))}t&&t.length&&t.forEach((e=>{const t=s.properties?._tpo_products_per_cart?JSON.parse(s.properties?._tpo_products_per_cart||"[]"):[];let i=!1;(l.length||t.length)&&(e.href?(e.removeAttribute("href"),e.style.cursor="pointer",i=!0):e.firstElementChild&&e.firstElementChild.href&&(e.firstElementChild.removeAttribute("href"),e.firstElementChild.style.cursor="pointer",i=!0),e.hasAttribute("on:click")&&e.removeAttribute("on:click")),e.removeAttribute("onclick"),e.classList.add("tpo_main_product"),e.classList.contains("tpo_add_on")||!l.length&&!t.length||(e.addEventListener("click",(async function(e){e.preventDefault(),e.stopImmediatePropagation();let t={updates:{[s.key]:"0".toString()}};const i=s.properties?._tpo_products_per_cart?JSON.parse(s.properties?._tpo_products_per_cart):[];if(l.length||i.length){const n=fr(i,o.items,s.key);e.stopPropagation();for(let e=0;et.properties._tpo_add_on_key===l[e]))?.key;i&&(t.updates[i]="0".toString())}n.forEach((e=>{e&&(t.updates[e]="0".toString())})),await fetch("/cart/update.js",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}).then((e=>{!ln&&Br()||window.location.reload()}))}}),!0),e.classList.add("tpo_add_on"))}))}}}window.easifyCustomDisableButton&&document.dispatchEvent(new Event("easifyEnableButtonAfterLoad"))}function fr(e=[],t,o){let i=[];return e.length&&e.forEach((e=>{const n=t.find((t=>t.properties?._one_time_per_cart==e));n&&(t.find((t=>{const i=t.properties?._tpo_products_per_cart;return!!i&&i.includes(e)&&t.key!==o}))||i.push(n.key))})),i}function yr(e,t,o){e.length&&e.forEach((e=>e.classList.add("tpo_disabled"))),t&&Array.from(t.querySelectorAll([...ye,...he])).forEach((e=>e.classList.add("tpo_disabled"))),o&&o.length&&o.forEach((e=>e.classList.add("tpo_disabled")))}async function hr(){if("bundle"===Wo&&"expand"===Ro)return;const e=async()=>{const{cartPageElement:e,cartDrawerElements:t,hasCartDrawer:o,listCartPageElements:i}=_n();if(!ln&&!o)return;let n=await Ua();if(window.superCart){const e=["Shop Service"];n.items=n.items.filter((t=>!e.includes(t.product_type)))}if(ln&&e)if(i&&i.length>1)for(let e=0;e{let i=Array.from(t[0].addedNodes),n=t[0].target;const a=Array.from(pn.querySelectorAll([".cart__item-details",".ajax-cart__item-details","p.cart__price","strong.price__current",".price.price--end",".cart-total-subtotal.cart_total","span.money.done"]));(i.includes(pn.querySelector([".cart-items",".cart-total-label",".CartItem"]))||a.includes(n))&&(await e(),"accurate-signs-and-engraving-solar-tags.myshopify.com"!==Q&&"love-art-frames.myshopify.com"!==Q&&"meetimmo-2.myshopify.com"!==Q||await dr())})).observe(pn,t)}if(cn&&!Ht){const t={childList:!0,subtree:!0,attributes:!0};new MutationObserver((async(t,o)=>{let i=Array.from(t[0].addedNodes);const n=[...pe];let a=t[0].target;const r=["span.cart__price",".ajax-cart__item-details",".cart-count",".mini-cart__product-info","p.cart__price","strong.price__current","span.price__regular",".money.cart-item-line-price.cart-item-final-line-price",".item-info__price span.money","span.amount",".ajaxcart-item__price span.money","input.qty-input__input"];"elarceilingfans.myshopify.com"===Q&&r.push(".product-price");const s=Array.from(rn.querySelectorAll(r));(i.includes(rn.querySelector(n))||s.includes(a))&&(["5a75b6-6.myshopify.com","26389c-3.myshopify.com","textilfarm.myshopify.com","kileja.myshopify.com","embroplacestore.myshopify.com"].includes(Q)&&await dr(),await e())})).observe(rn,t)}}async function gr(e,t,o){if(mo&&mt&&mt.length>0){const t=document.querySelectorAll(mt);e=t.length>0?t[0]:e}if(!e)return;const i=e.querySelector(".tpo_option-set-wrapper");i&&!ke.includes(Q)&&i.remove();let n=!1,a=e.querySelector($);if(mo&&_t&&_t.length>0){const e=document.querySelectorAll(_t);a=e.length>0?e[0]:a}switch(e.tagName){case"QUICK-ADD-MODAL":{const t=e.querySelector("product-form");t&&(a=t.querySelector("form"));break}case"DIV":{const t=e.querySelector("product-form-component");t&&(a=t.querySelector("form"));break}}a||(a=document.createElement("form"),n=!0);let r=a?a.querySelector(x):null;if(a&&!r&&(r=document.querySelector(j)),!r){if(r=document.createElement("div"),window.__pageflyProducts){let e=window.__pageflyProducts[t.toString()];if(e){let t=e.atcContents.entries().next().value,[o,i]=t;r=document.querySelector(`.${o}`)}}window.__gemStoreData&&(r=document.querySelector("button.gf_add-to-cart"))}const s=e.querySelector(ge)||document.createElement("div"),l=await Va(t,o);if(vn=await qt(l?.products_handle),r||(r=document.createElement("div")),!l)return;r.classList.add("tpo_add-to-cart");let c=document.createElement("div");if(c.classList.add("tpo_option-set-wrapper"),(Ci?.sectionTopSpacing||Ci?.sectionBottomSpacing)&&(c.style.paddingTop=`${Ci?.sectionTopSpacing||12}px`,c.style.paddingBottom=`${Ci?.sectionBottomSpacing||12}px`),Me.includes(Q)&&e.querySelector(".tpo_option-set-wrapper")){const t=e.querySelector(".tpo_option-set-wrapper");t.parentElement.replaceChild(c,t)}const p=document.querySelectorAll(Ct.join(","));$t.includes(Z)&&p.forEach((e=>{if(e.querySelector(".easify-product-options"))return;const t=e.querySelector(".product-grid-view-zoom-out--details");if(t&&t.parentNode){const e=document.createElement("div");e.classList.add("easify-product-options"),t.parentNode.insertBefore(e,t.nextSibling)}}));let d=oa(l,a,r,s,!0);if(n){let t=[".card > [class*='card__content']",".product-block__inner",'[data-pf-type="Block"]',".productitem--info"],o=e.querySelector(t);if(o||(o=e),c.classList.add("tpo_in-card"),["e2e8c8.myshopify.com"].includes(Q)){e.classList.add("tpo-hide-price");let t=e.querySelector(".productitem--title a[data-product-page-link]")?.getAttribute("href"),o=e.querySelector("button.productitem--action-trigger");o?.addEventListener("click",(function(){window.location.href=t}))}let i=o?.querySelector(".easify-product-options");i?i.append(c):window.__pageflyProducts?(o?.insertAdjacentElement("afterend",c),r.style.pointerEvents="none"):window.__gemStoreData?o?.insertBefore(c,o.lastElementChild):o?.firstElementChild.insertAdjacentElement("afterend",c);let{totalAdditionalPrice:n,totalAdditionalPriceWrapper:l,totalAdditionalPriceInput:p}=ka(a);c.append(d),c.append(l,p),La(c,s),Ha()}else{let t=e.querySelector(".easify-product-options");if(mo&&ft&&ft.length>0){const e=document.querySelectorAll(ft);t=e.length>0?e[0]:t}if(t)t.append(c);else if(r.parentElement){const t=D?.position||"above_add_to_cart";if("below_add_to_cart"===t)r.parentElement.insertBefore(c,r.nextSibling);else if("above_product_variants"===t){let t=e.querySelector(B);t?t.parentElement.insertBefore(c,t):r.parentElement.insertBefore(c,r)}else if("below_product_variants"===t){let t=e.querySelector(B);if(t)t.parentElement.insertBefore(c,t.nextSibling);else{let t=e.querySelector(H);t?t.parentElement.insertBefore(c,t):r.parentElement.insertBefore(c,r)}}else if($t.includes(Z)){const t=e.querySelector("product-form-component");t&&t.parentElement?t.parentElement.insertBefore(c,t):r.parentElement.insertBefore(c,r)}else if("94f441-6.myshopify.com"===Q){const e=document.querySelector(".product-form__item.product-form__item--payment-button");e.parentElement.insertBefore(c,e)}else r.parentElement.insertBefore(c,r)}let{totalAdditionalPrice:i,totalAdditionalPriceWrapper:n,totalAdditionalPriceInput:p}=ka(a);if(a.addEventListener("change",(()=>{setTimeout((()=>{La(a,s)}),1e3)})),c.append(n,p),c.prepend(d),0===at.querySelectorAll('script[src="https://cdn.shopify.com/s/files/1/0748/6904/7603/files/konva.min.js?v=1742044331"]')?.length&&"fjckPiAzNHI1MzwtMzo="===window.TPOConfigs.app){const e=document.createElement("script");e.async=!0,e.src="https://cdn.shopify.com/s/files/1/0748/6904/7603/files/konva.min.js?v=1742044331",e.onload=async function(){await ts({optionSet:l,productHandle:o,isProductPage:!1})},at.appendChild(e)}Ha(),va(bn(l?.options),a),va(La(a,s),a),Un(),Qn(a,l);const{tieredPrices:u,allowTieredPrices:m}=br(l);if(m){s.addEventListener("change",(function(e){let t=a.querySelector(`.tpo_total-additional-price:not(.${Et} *)`)||document.querySelector("main").querySelector(`.tpo_total-additional-price:not(.${Et} *)`)||document.createElement("div"),o=a.querySelector(`.tpo_total-additional-price-wrapper:not(.${Et} *)`)||document.querySelector("main").querySelector(`.tpo_total-additional-price-wrapper:not(.${Et} *)`)||document.createElement("div"),i=a.querySelector(`.tpo_total-additional-price-input:not(.${Et} *)`)||document.querySelector("main").querySelector(`.tpo_total-additional-price-input:not(.${Et} *)`)||document.createElement("div");Oa(a,t,o,i,s)}));const e=vr(u,"product");Object.assign(e,{className:"tpo_modal-tired-wholesale-wraper"}),r.parentElement&&("below_add_to_cart"===jo?(e.style.marginBottom="30px",r.parentElement.insertBefore(e,r.nextSibling)):(e.style.marginBottom="30px",r.parentElement.insertBefore(e,r)))}}}function br(e){const t=e.wholesale_price||{},o=JSON.parse(t.price_set||"[]"),i=JSON.parse(t.customer_tag||"{}").appliedCustomer||"ALL",n=JSON.parse(t.customer_tag||"{}").tagSet||[],a=JSON.parse(t.customer_tag||"{}").excludeTagSet||[],r=y?.customer||{},s=r.tags||[];return{tieredPrices:o,allowTieredPrices:o.length>0&&ai&&("ALL"===i||"GUEST"===i&&null===r.id||"LOGIN"===i&&r.id||"TAG"===i&&s.some((e=>n.includes(e)))||"EXCLUDE_TAG"===i&&!s.some((e=>a.includes(e))))}}function vr(e,t="product",o={}){const i=document.createElement("div"),n=document.createElement("table");vi?.wholesaleHeaderRows&&n.style.setProperty("--wholesale-headerRow_background",vi?.wholesaleHeaderRows),vi?.wholesaleOddRows&&n.style.setProperty("--wholesale-oddRows_background",vi?.wholesaleOddRows),vi?.wholesaleEvenRows&&n.style.setProperty("--wholesale-evenRows_background",vi?.wholesaleEvenRows),Object.assign(n,{className:"tpo_option-tiered-prices-table",innerHTML:`\n \n \n \n ${Po?ba(Po):"Quantity"}\n \n \n ${Mo?ba(Mo):"Savings"}\n \n \n \n `}),e.forEach(((e,i)=>{let a=PriceFormatter.formatMoney(parseFloat(100*e.value),!0);n.firstElementChild.innerHTML+=`\n \n ${e.maxQty?`${e.minQty} - ${e.maxQty}`:`${l.From&&l.From[s]||"From"} ${e.minQty}`} \n ${Fo?ba(Fo):"Save"} ${"fixed"===e.type?a:`${e.value}%`}\n \n `,setTimeout((async()=>{await async function(e){if(!Ye)return;const{template:t,rule:o,target:i,mainProduct:n}=e;if(!i)return;let a,r;switch(t){case"product":const e=i.closest(Se);if(!e)return;let t=e.querySelector(ve)||e.parentElement.querySelector(ve);if(!t)return;a=Pn(t.innerText);break;case"cart":a=n.presentment_price||n.price/100}r=function(e,t){return"percentage"===t.type?e*(100-t.value):100*(e-t.value)}(a,o),i.innerHTML=PriceFormatter.formatMoney(parseFloat(r),!0)}({template:t,rule:e,target:n.firstElementChild.querySelector(`tr:nth-child(${i+2}) td:last-child`),mainProduct:o})}),0)})),n.querySelectorAll("tr th").forEach((e=>{ji?.fontFamily&&(e.style.fontFamily=ji.fontFamily),e.style.fontSize=`${ji.fontSize}px`,e.style.color=vi?.wholesaleTextColumnHeaders??ji.fontColor,e.style.borderColor=vi?.wholesaleTableHeaderRow,e.classList.add(`tpo_${ji.fontStyle}`)})),n.querySelectorAll("tr td").forEach((e=>{Fi?.fontFamily&&(e.style.fontFamily=Fi.fontFamily),e.style.fontSize=`${Fi.fontSize}px`,e.style.color=vi?.wholesaleTextCellContents??Fi?.fontColor,e.style.borderColor=vi?.wholesaleTableDataRows,e.classList.add(`tpo_${Fi.fontStyle}`)}));const a=document.createElement("span");Object.assign(a,{className:`tpo_option-tiered-prices-heading tpo_${Ii.fontStyle} ${Xt?"tpo_compatible_wholesale_title":""}`,textContent:No?ba(No):"Tiered wholesale price:"}),Ii?.fontFamily&&(a.style.fontFamily=Ii.fontFamily),a.style.fontSize=`${Ii.fontSize}px`,a.style.color=vi?.wholesaleTextTitle??Ii.fontColor;const r=document.createElement("div");return r.classList.add("tpo_option-tiered-prices-table-container"),Xt&&r.classList.add("tpo_compatible_wholesale_theme"),r.style.borderColor=vi?.wholesaleTableBorder??Ri.borderColor,r.append(n),i.append(a,r),i}function wr(e,t,o){if(!t||t===ao||t===ro)return"";{const i=o||"";switch(e){case"small":return`${i}`;case"medium":return`${i}`;case"large":return`${i}`}}}function Sr(e,t){const{showTotalSelected:o=!1,hasLimitations:i=!1,minValue:n=1,maxValue:a=1,limitTotalSelected:r=0,isUseCustomIncrement:s=!1,customIncrementValue:l=1,isUseMinMaxSelected:c=!1,minValueTotal:p=1,maxValueTotal:d=1,isShowNewTotalSelected:u=!1}=e;return!t||(o?t===r:!c||t>=Number(p)&&t<=Number(d))}function Er(e,t,o,i){e.innerHTML=t?"":ko?ba(ko,[o,i]):`Select a minimum of ${o} and a maximum of ${i} items`}function $r(e,t,o,i,n){const{showTotalSelected:a=!1,hasLimitations:r=!1,minValue:s=1,maxValue:l=1,limitTotalSelected:c=0,isUseCustomIncrement:p=!1,customIncrementValue:d=1,isUseMinMaxSelected:u=!1,minValueTotal:m=1,maxValueTotal:_=1,isShowNewTotalSelected:f=!1}=o;let y="";if(a?y="exact_count":f?y=u?"min_max_count":"only_total":u&&(y="min_max_not_count"),t){const n=Sr(o,Number(t)),a=e.querySelector(".tpo_quantity_selector_total-selected");a&&(a.innerHTML=t,n?(a.classList.remove("tpo-quantity-error"),Number(t)&&a.classList.add("tpo-quantity-success")):(a.classList.add("tpo-quantity-error"),a.classList.remove("tpo-quantity-success")),i&&Er(i,n,m,_))}else{const t=e.querySelector(".tpo_quantity_selector_total-selected");let a=0,r=Array.from(e.querySelectorAll(".tpo_quantity-selector_wrapper"));if(n&&(r=Array.from(n.querySelectorAll(".tpo_quantity-selector_wrapper"))),r.length){if(r.forEach((e=>{if(!e.classList.contains("swatches-not-avaliable")){const t=e.querySelector("input").value;a+=Number(t)}})),t){t.innerHTML=a;const e=Sr(o,Number(a));e?(t.classList.remove("tpo-quantity-error"),Number(a)&&t.classList.add("tpo-quantity-success")):(t.classList.add("tpo-quantity-error"),t.classList.remove("tpo-quantity-success")),i&&Er(i,e,m,_)}}else{const n=e.id;if(n&&-1!==eo){const e=to[eo].find((e=>n.includes(e.id)));e&&e.option_types.forEach((e=>{e&&e.is_default&&(a+=1)}))}const r=Sr(o,Number(a));t&&(t.innerHTML=a),t&&(r?(t.classList.remove("tpo-quantity-error"),Number(a)&&t.classList.add("tpo-quantity-success")):(t.classList.add("tpo-quantity-error"),t.classList.remove("tpo-quantity-success")),i&&Er(i,r,m,_))}}}function Cr(e,t,o,i,n,a,r,s=()=>{}){const{showTotalSelected:l=!1,hasLimitations:c=!1,minValue:p=1,maxValue:d=1,limitTotalSelected:u=0,isUseCustomIncrement:m=!1,customIncrementValue:_=1,isUseMinMaxSelected:f=!1,minValueTotal:y=1,maxValueTotal:h=1,isShowNewTotalSelected:g=!1,optionTypeDefaultQuantityMapper:b={}}=e,{fontFamily:v="",fontStyle:w="",fontSize:S=0}=a,E=document.createElement("div");Object.assign(E,{className:"tpo_quantity-selector_wrapper swatches-not-avaliable"}),E.style.width=Ei?.quantitySelectorWidth?`${Ei.quantitySelectorWidth}px`:void 0,E.style.border=vi?.quantitySelectorBorder_unselected?`1px solid ${vi.quantitySelectorBorder_unselected}`:void 0,E.style.borderRadius=$i?.quantitySelectorBorderRadius?`${$i.quantitySelectorBorderRadius}px`:void 0,E.style.setProperty("--active-quantitySelector-border",vi.quantitySelectorBorder_selected||"");const $=document.createElement("input");Object.assign($,{className:`tpo_quantity-selector_input tpo_${w}`,id:`${n},${i},quantity_selector`}),v&&($.style.fontFamily=v),S&&($.style.fontSize=`${S}px`),$.value=1,i&&e&&e.optionTypeDefaultQuantityMapper&&($.value=e.optionTypeDefaultQuantityMapper[i]||1),m&&Number(_)>1&&($.value=Number(_),$.readOnly=!0);const C=document.createElement("span");Object.assign(C,{className:"tpo_quantity-selector_minus",innerHTML:"-",onclick:()=>xr($,s,e)});const x=document.createElement("span");Object.assign(x,{className:"tpo_quantity-selector_plus",innerHTML:"+",onclick:()=>kr($,e)});let k=document.createElement("div");return Object.assign(k,{className:`tpo_error-message tpo_${Oi.fontStyle}`,innerHTML:""}),k.style.fontSize="11px",k.style.color="#D82C0D",$.addEventListener("change",(e=>{c&&(Lr(e.target,p,d,k)?E.classList.remove("tpo-error_validate"):E.classList.add("tpo-error_validate"));let i=e.target.value;if(/^(?!00)\d+|0$/.test(i))if(i=parseFloat(i||0),t){const e=Number(t)*i;o(e,i)}else o(0,i)})),Object.keys(b||{}).length&&b[i]?setTimeout((()=>{$.value=b[i]||1,$.dispatchEvent(new Event("change"))}),0):r&&setTimeout((()=>{$.value=r||1,$.dispatchEvent(new Event("change"))}),0),E.append(C,$,x),{quantitySelectorWrapper:E,errorMessageElement:k}}function xr(e,t,o){const{showTotalSelected:i=!1,hasLimitations:n=!1,minValue:a=1,maxValue:r=1,limitTotalSelected:s=0,isUseCustomIncrement:l=!1,customIncrementValue:c=1,isUseMinMaxSelected:p=!1,minValueTotal:d=1,maxValueTotal:u=1,isShowNewTotalSelected:m=!1}=o,_=Number(e.value);l&&Number(c)>1?_>Number(c)?(e.value=_-Number(c),e.dispatchEvent(new Event("change"))):_==Number(e.value)&&t():_>1?(e.value=_-1,e.dispatchEvent(new Event("change"))):1==_&&t()}function kr(e,t){const{showTotalSelected:o=!1,hasLimitations:i=!1,minValue:n=1,maxValue:a=1,limitTotalSelected:r=0,isUseCustomIncrement:s=!1,customIncrementValue:l=1,isUseMinMaxSelected:c=!1,minValueTotal:p=1,maxValueTotal:d=1,isShowNewTotalSelected:u=!1}=t,m=Number(e.value);s&&Number(l)>1?(e.value=m+Number(l),e.dispatchEvent(new Event("change"))):(e.value=m+1,e.dispatchEvent(new Event("change")))}function Lr(e,t=1,o,i){let n=e.value;return/^(?!00)\d+|0$/.test(n)?(n=parseFloat(n||0),n>=t?o?o&&n<=o?(i.innerHTML="",!0):(i.innerHTML=xo?ba(xo,[t,o]):`Between ${t}-${o}`,!1):(i.innerHTML="",!0):(i.innerHTML=xo?ba(xo,[t,o]):`Between ${t}-${o}`,!1)):n?(n=n?parseFloat(n):"",i.innerHTML=Oo?ba(Oo,""):"This input value is not numeric!",!1):void 0}function qr(){if(!Do)return;const e=Array.from(document.querySelectorAll(ct));Array.from(document.querySelectorAll(pt)).forEach(((t,o)=>{let i=t.querySelectorAll(dt)[0];i||(i=t);let n="",a="";const r=(i.closest(Se)||document.createElement("div")).querySelector(".tpo-feature-product-detail");if(r){const e=JSON.parse(r.textContent);a=e.id,n=e.handle}else{if(i.dataset.productUrl)n=i.dataset.productUrl.slice(10);else if(i.href){const e=i.href.split("/");n=e[e.length-1]}const e=i.closest(".product-card"),t=e?.querySelector("a.product-card__link");if(t){const e=t.href;n=e.split("/products/")[1]}if(!n){const e=i.closest(Se);e&&(n=e.getAttribute("handle"))}!n&&Z.includes("Expanse")&&(n=i.getAttribute("data-handle"))}n&&(i.classList.contains("tpo_quickview_opener")||(i.classList.add("tpo_quickview_opener"),i.addEventListener("click",(function(t){if(e.length){const t=e.length>1?e[o]:e[0];if(!a){const e=t.querySelector('input[name="product-id"]');if(e?.value&&/^\d+$/.test(e.value))a=e.value;else{const e=t.getAttribute("id"),o=e?.match(/\d{10,}/);o&&(a=o[0])}}setTimeout((async()=>{await gr(t,a,n)}),2e3)}else setTimeout((async()=>{const e=document.querySelectorAll(lt)[0];if(!e)return;const t=e.querySelector("script.product-json")||e.querySelector(".tpo-feature-product-detail"),o=JSON.parse(t?.textContent||"{}");if(!o.id)return;const i=e.querySelectorAll(ut)[0];await gr(i,o.id,n)}),1500)}))))}))}function Tr(e,t){e&&t&&(e.innerHTML="string"!=typeof t?t.join(", "):t,t.length?e.style.marginBottom="6px":e.style.marginBottom="0px")}async function Or(){const e=document.querySelectorAll(ht);if(e.length)for(let t=0;t{await dr()}),1e3),await Wa(),await hr()}))}function Ar(e,t,o){new MutationObserver((function(i){if(R!==window.location.href){R=window.location.href;let i=window.location.href.match(/variant=(\d+)/),n=i?i[1]:h.variants.find((e=>e.available)).id.toString(),a=meta.product.variants;const r=a.find((e=>e.id.toString()===n))||a[0];Nr(e,t,r?.public_title?.toLowerCase()||""),ta(o)}else if("Tailor"===window.Shopify?.theme?.schema_name)document.addEventListener("product:options-change",(function(i){const{variant:n}=i.detail;n&&(Nr(e,t,n?.public_title?.toLowerCase()||""),ta(o),va(La(pn,On),pn))}));else if(window.EComposer&&window.EComposer.TEMPLATE_ID&&window.EComposer.TEMPLATE){let i=document.querySelector(".ecom-product-single-select-id");if(!i)return;i.addEventListener("change",(function(i){let n=this.value;if(!n)return;let a=meta.product.variants;const r=a.find((e=>e.id.toString()===n))||a[0];r&&(Nr(e,t,r?.public_title?.toLowerCase()||""),ta(o),va(La(pn,On),pn))}))}})).observe(document,{subtree:!0,childList:!0})}function Nr(e,t,o){const i=ze.findIndex((e=>"variant"===e?.id));i>=0?ze[i]={...ze[i],value:o}:ze=[...ze,{id:"variant",value:o}],De.filter((e=>e.conditionOptions?.some((e=>e.id.includes("variant")))&&e.conditionalField)).forEach(((i,n)=>{const{action:a,match:r,id:s,conditionOptions:l}=i;let c="ALL"===r;l.forEach((e=>{e.id.includes("variant")&&("ALL"===r?"EQUAL"===e.relative?c=c&&e.value.toString().toLowerCase()===o:"CONTAIN"===e.relative?c=c&&o.includes(e.value.toString().toLowerCase()):"NOT_CONTAIN"===e.relative?c=c&&!o.includes(e.value.toString().toLowerCase()):"NOT_EQUAL"===e.relative?c=c&&e.value.toString().toLowerCase()!==o:"START_WITH"===e.relative?c=c&&o.startsWith(e.value.toString().toLowerCase()):"END_WITH"===e.relative&&(c=c&&o.endsWith(e.value.toString().toLowerCase())):"EQUAL"===e.relative?c=c||e.value.toString().toLowerCase()===o:"CONTAIN"===e.relative?c=c||o.includes(e.value.toString().toLowerCase()):"NOT_CONTAIN"===e.relative?c=c||!o.includes(e.value.toString().toLowerCase()):"NOT_EQUAL"===e.relative?c=c||e.value.toString().toLowerCase()!==o:"START_WITH"===e.relative?c=c||o.startsWith(e.value.toString().toLowerCase()):"END_WITH"===e.relative&&(c=c||o.endsWith(e.value.toString().toLowerCase())))}));let p=t.querySelector(`[id*="${s}"]`)||document.createElement("div"),d=p.querySelectorAll('[name*="properties"]')||[],u=p?.getAttribute("id")||"";const m=e[n].multi_select;"ALL"===r?c?"SHOW"===a?p.classList.contains("tpo_hidden")&&(p.classList.remove("tpo_hidden"),gs(u,"show",m),d.forEach((e=>ja(e))),-1!==Nt.indexOf(u)&&Nt.splice(Nt.indexOf(u),1),Bt=Bt.filter((function(e){return e!==u}))):p.classList.contains("tpo_hidden")||(p.classList.add("tpo_hidden"),gs(u,"hide",m),d.forEach((e=>Fa(e))),-1===Nt.indexOf(u)&&Nt.push(u),-1===Bt.indexOf(u)&&Bt.push(u)):"SHOW"===a?p.classList.contains("tpo_hidden")||(p.classList.add("tpo_hidden"),gs(u,"hide",m),d.forEach((e=>Fa(e))),-1===Nt.indexOf(u)&&Nt.push(u),-1===Bt.indexOf(u)&&Bt.push(u)):p.classList.contains("tpo_hidden")&&(p.classList.remove("tpo_hidden"),gs(u,"show",m),d.forEach((e=>ja(e))),-1!==Nt.indexOf(u)&&Nt.splice(Nt.indexOf(u),1),Bt=Bt.filter((function(e){return e!==u}))):c&&"SHOW"===a?p.classList.contains("tpo_hidden")&&(p.classList.remove("tpo_hidden"),gs(u,"show",m),d.forEach((e=>ja(e))),-1!==Nt.indexOf(u)&&Nt.splice(Nt.indexOf(u),1),Bt=Bt.filter((function(e){return e!==u}))):p.classList.contains("tpo_hidden")||(p.classList.add("tpo_hidden"),gs(u,"hide",m),d.forEach((e=>Fa(e))),-1===Nt.indexOf(u)&&Nt.push(u),-1===Bt.indexOf(u)&&Bt.push(u));const _=ze.find((e=>e.id===p.id));_&&("string"==typeof _.value?Na(Ve,p.id,"",_.value):Na(Ve,p.id,"",_.value,_.value))}))}function Pr(e){let t=e.match(/\{([A-Za-z]+(?:-[A-Za-z]+)?)\}/);return!t||t[1].toLowerCase()===s.toLowerCase()}function Mr(e){return Number.isFinite(e)&&e%1!=0}function Fr(e,t,o){let i,n=document.createElement("div");return Object.assign(n,{className:"tpo_quantity_selector_total-wrapper "+("min_max_not_count"===o?"tpo_hidden":""),innerHTML:`\n ${t||"You've chosen:"} \n \n 0\n ${e.configs.limitTotalSelected&&"exact_count"===o?`/${e.configs.limitTotalSelected}`:""}\n `}),"min_max_count"!==o&&"min_max_not_count"!==o||(i=document.createElement("div"),Object.assign(i,{className:`tpo_error-message tpo_${Oi.fontStyle}`,innerHTML:""})),{totalQuantitySelectorElementWrapperRender:n,errorTotalElementRender:i}}function jr({imageOrColor:e,numberColor:t,swatchShape:o,colorCodes:i,imageUrl:n,product:a,label:r,imgElement:s,onlyReturnColor:l}){let c="";if(2===e||0===e&&(!n||n&&(n===ao||n===ro)))return null;if(1===e){if(1===t)c=`
      \n \n
      `;else if(2===t)c=`
      \n \n
      `;else if(3===t)return null;return c}return l?c:s||(n&&n!==ao&&n!==ro?`${r}`:"")}function Ir(e,t){if(e.image){const o=`https:${e?.image}`;return(e?.variants&&e?.variants[0]?.featured_image?e.variants[0]?.featured_image.src:"")||o||t}return t}K||(await async function(e){if("loading"!==document.readyState)return await e(),window.easifyOnElementLoadShowOptionSetQuickView=async function(){await qr()},window.easifyShowOptionSetOnCustomElement=async function(e,t,o){await gr(e,t,o),Qr()},window.easifyShowCartDrawerAfterPageLoad=function(){if(Q&&window.location.href.endsWith("?addToCart=true")){const e=document.querySelector(ht);if(!e)return;let t=new CustomEvent("click",{bubbles:!0,cancelable:!0});e.dispatchEvent(t)}},window.easifyHandleCalculateCart=async function(){await dr()},window.easifyHandleUpdateCartWithAddonProduct=async function(){await hr()},void(window.getEasifyProperties=function(){return Xr()});document.addEventListener("DOMContentLoaded",e)}((async function(){Zt(),await Xa(),await Za(),await Wa(),await hr(),await qr(),await function(){if(je&&Bo||(Fe||Ie)&&Ho){const e=["[class*='card__heading'] a",'[data-pf-type="ProductTitle"]',".gf_product-title",".product-card__media","product-card.product-card product-price"];document.querySelectorAll(Se).forEach((async(t,o)=>{let i=t.querySelector(e),n="",a="";if(i?.id?n=i.id.slice(-13):(i&&(n=i.getAttribute("data-product-id")),!n&&t.querySelector("[data-pid]")&&(n=t.querySelector("[data-pid]").getAttribute("data-pid"))),i?.href)a=i.href.slice(`https://${G}/products/`.length);else if(i){let e=i.getAttribute("data-href");if(e){const t=e.match(/\/products\/([^?]+)/);t&&(a=t[1])}}if(!a){const e=t.closest(".product-card"),o=e?.querySelector("a.product-card__link");if(o){const e=o.href;a=e.split("/products/")[1]?.split(/[?#]/)[0]}}if(!n){const e=t.querySelector(".product-card__media ~ button");if(e){const t=e.getAttribute("aria-controls");t&&(n=t.slice(-13))}else{const e=t.querySelector(".product-card__media ~ form");if(e){const t=e.getAttribute("id");t&&(n=t.slice(-13))}}}let r=t.getAttribute("tpo-product-id"),s=t.getAttribute("tpo-product-handle");r&&s&&(n=r,a=s,i=s),i&&n&&a?await gr(t,n,a):n&&(n=t.id.slice(-13),await gr(t,n))}))}}(),await void(zo&&!_&&Array.from(document.querySelectorAll([".featured-product:not(.product-card-wrapper)",'[id*="featured_product"][data-product-url]','[class="product-section"][data-product-url][data-product-handle]'])||[]).forEach((async e=>{$.forEach((t=>{const o=e.querySelector(t);o&&Array.from(o.elements).every((e=>"hidden"===e.type))&&o.setAttribute("id",o.getAttribute("id")+"-installment")}));const t=e.querySelector(".tpo-feature-product-detail");if(t){const o=JSON.parse(t.textContent),{id:i,handle:n}=o;await gr(e,i,n)}else{let t=e.querySelector('a[href*="products/"]:not(.product__thumb)'),o=t?.href.split("/").pop();if(t||(o=e.getAttribute("data-product-url")?.split("/").pop()),o){const t=await fetch(`${st}products/${o}.js`,{method:"GET",headers:{"Content-Type":"application/json"}}),i=await t.json(),{id:n}=i;await gr(e,n,o)}}}))),function(){if(!gn.dataset.isRenderOptionSet)return;const e=document.querySelectorAll(I.atcButton);e.length&&gn&&e.forEach((e=>{e.classList.contains("tpo_sticky-atc")||(e.classList.add("tpo_sticky-atc"),e.addEventListener("click",(e=>{e.preventDefault(),e.stopPropagation(),gn.setAttribute("stickyAdd","true"),gn.dispatchEvent(new Event("click")),gn.removeAttribute("stickyAdd")})))}))}(),setTimeout((async()=>{await Or(),await dr(),document.dispatchEvent(new Event("tpo_loaded"))}),500),$t.includes(Z)&&new MutationObserver((()=>{document.querySelectorAll(pt).forEach((e=>{(e.querySelector(dt)||e).classList.contains("tpo_quickview_opener")||qr()}))})).observe(document,{subtree:!0,childList:!0})})),cn&&"embroplacestore.myshopify.com"!==Q&&new MutationObserver((async(e,t)=>{let o=Array.from(e[0].addedNodes);const i=[...pe];let n=e[0].target;const a=["span.cart__price",".ajax-cart__item-details",".cart-count",".mini-cart__product-info","p.cart__price","strong.price__current","span.price__regular",".money.cart-item-line-price.cart-item-final-line-price",".item-info__price span.money","span.amount",".ajaxcart-item__price span.money",".scd-item__original-price.scd-item__price"];"elarceilingfans.myshopify.com"===Q&&a.push(".product-price");const r=Array.from(rn.querySelectorAll(a));(o.includes(rn.querySelector(i))||r.includes(n))&&setTimeout((async()=>{await Wn(),await dr()}),1e3)})).observe(rn,{childList:!0,subtree:!0})),zt&&function(){const{cartDrawerElements:e}=_n();for(let t=0;t{e.isIntersecting&&setTimeout((async()=>{await Za(),await Wa(),await hr(),await dr(),await Wn()}),500)}),{root:null,threshold:.1}).observe(o)}}();const Hr=document.querySelector(".rbr-addBundleBtn-container");function Br(e){return!!Ht&&(document.dispatchEvent(new CustomEvent("easify:ajaxCart",{detail:{cartItem:e}})),setTimeout((async()=>{await hr()}),500),!0)}function Dr(e,t){if(!e)return!1;let o=!!e&&window.location.href===t;if(!o){let e=/\/products\/([^\/?]+)/,i=window.location.href.match(e),n=t.match(e),a=i?i[1]:window.location.href;(n?n[1]:t)===a&&(o=!0)}return o}function zr(e,t){if(!e)return t;let o=t,i=h?.title.toLowerCase().replace(/\s+/g,"-")||"",n=h?.handle||"",a=/\{product_handle\(([^)]+)\)\}/,r=/\{product_handle_exclude\(([^)]+)\)\}/;if(t&&t.includes("{product_name}")&&i&&(o=t.replace(/{product_name}/g,i)),t&&t.includes("{product_handle(")&&n){const e=t.match(a);if(e){const i=e[1],r=new RegExp(`^(.*?)(?:${i})$`),s=n.match(r);s&&(o=t.replace(a,s[1]))}}if(t&&t.includes("{product_handle_exclude(")&&n){const e=t.match(r);if(e){const i=e[1],a=new RegExp(`^(.*?)(?:${i})`),s=n.match(a);s&&(o=t.replace(r,s[1]))}}return t&&t.includes("{product_name_exclude_hyphen}")&&i&&(i=h?.title.toLowerCase().split(" - ")[0].replace(/\./g,"").replace(/\s+/g,"-")||"",o=t.replace(/{product_name_exclude_hyphen}/g,i)),t&&t.includes("{product_name_exclude_parentheses}")&&i&&(i=h?.title.toLowerCase().split(" (")[0].replace(/\./g,"").replace(/\s+/g,"-")||"",o=t.replace(/{product_name_exclude_parentheses}/g,i)),o}function Vr(e,t){if(!Mt)return;const o=[];t.forEach((e=>{e&&e.checked&&o.push({printBoxName:e.dataset.printBoxName,printBoxValue:e.dataset.printBoxValue})})),e.dataset.printBox=JSON.stringify(o)}function Ur(e,t){let o,i="";const n=t.findIndex((t=>{if(!t.metadata)return!1;const n=JSON.parse(t.metadata||"{}");if(!n.useDimensionDropdownPricing)return!1;const a=n.linkedDropdowns;if(!a||!a.length)return!1;const r=a.findIndex((({id:t})=>t.length>0&&e.id.includes(t)));return!(r<0||(i=a[r].formula,o=a[r].tablePricing,0))}));return n<0?"":{dimensionId:t[n].id,tablePricing:o,formula:i}}function Jr(e,t,o){const i=e.dimensionId,n=e.dimensionFormula,a=e.tablePricing;if(!i||!n)return 0;const r=document.querySelector(`[id*="${i}"]`);if(!r)return 0;let s=r.querySelector('[data-tpo-dimension="x"]')?.value||0,l=r.querySelector('[data-tpo-dimension="y"]')?.value||0,c=r.querySelector('[data-tpo-dimension="z"]')?.value||0;const p=$a({xValue:s,yValue:l,zValue:c,tablePricing:a}),{valid:d,tablePrice:u}=p;return t.dataset.tablePriceValid=Number(d),Ea({xValue:s,yValue:l,zValue:c,formula:n,price:o,tablePrice:u})/100}function Rr(e,t,o){const i=JSON.parse(e||"{}");!!o&&o.some((e=>null!==e.product_handle&&""!==e.product_handle))&&(t.dataset.addOnProduct=!0),i.enable&&(t.dataset.oneTimeCharge=!0)}function Wr(e){if(!Jt)return;const{target:t,showLabel:o=!1,position:i="after",beforeWholesale:n,totalPriceAfter:a,section:r}=e;if(!t)return;const{productPrice:s,additionalPrice:l}=n;let c=0;if("main-product-price"===r?c=s+l:(c="include"===Vo?s+l:l,function(e,t,o){const i=Math.round(100*(1-o/t)),n=document.createElement("span");Object.assign(n,{className:"tpo_wholesale_discount_percentage",innerHTML:`-${i}% `});const a=e.parentElement?.querySelector(":scope >.tpo_wholesale_discount_percentage");a?a.replaceWith(n):e.insertAdjacentElement("beforebegin",n)}(t,c,a)),a>=c){const e=t.parentElement?.querySelector(":scope >.tpo_original_price_wrapper");e&&e.remove();const o=t.parentElement?.querySelector(":scope >.tpo_wholesale_discount_percentage");return void(o&&o.remove())}let p=PriceFormatter.formatMoney(parseFloat(c),!0);if(!p)return;const d=document.createElement("del");Object.assign(d,{className:"tpo_original_price",innerHTML:p});const u=document.createElement("span");Object.assign(u,{className:"tpo_original_price_label "+(o?"":"tpo_hidden"),innerHTML:ba(Zo)});const m=document.createElement("p");Object.assign(m,{className:"tpo_original_price_wrapper"}),m.append(u,d);const _=t.parentElement?.querySelector(":scope >.tpo_original_price_wrapper");_?_.replaceWith(m):"after"===i?t.insertAdjacentElement("afterend",m):t.insertAdjacentElement("beforebegin",m)}function Qr(){const e=document.querySelectorAll(".tpo-swiper.swiper");e&&e.length>0&&e.forEach(((e,t)=>{const o=e.getAttribute("data-swiperId"),i=Number(e.getAttribute("data-numberofrows")),n=Number(e.getAttribute("data-swatchesperrow")),a="true"===e.getAttribute("data-showindicators");window.TPO_Swiper&&new TPO_Swiper(`.swiper.swiper-${o}`,{slidesPerView:n,slidesPerGroup:Math.floor(n),spaceBetween:12,speed:500,parallax:!0,grid:{fill:"row",rows:i},navigation:{nextEl:".tpo-swiper-button-next",prevEl:".tpo-swiper-button-prev"},pagination:!!a&&{el:".tpo-swiper-pagination",type:"bullets",clickable:!0}})}))}function Gr(e){const t=document.querySelector("#bookeasy-product-properties");t&&t.querySelectorAll("input").forEach((t=>{if(t.disabled)return;const o=t.name.match(/\[(.*?)\]/);if(!o)return;const i=o[1],n=t.value;n&&"object"!=typeof n&&(e.properties[i]=n)}))}function Xr(){const e={};try{const t=new FormData(pn);return Array.from(pn.elements).filter((e=>!e.disabled&&e.name&&e.name.includes("properties"))).forEach((o=>{const i=o.name.match(/\[(.*?)\]/);if(!i)return;const n=i[1],a=t.get(o.name);if(a&&"object"!=typeof a)if(Xe&&o?.classList?.contains("tpo_file-upload-input")){const t=/ \[ (.*?) ]/,o=a.match(t);let i,r=null;o&&o[1]&&(r=o[1],i=a.replace(t,"").trim()),e[`_${n}_price`]=r,e[n]=i}else e[n]=a})),e}catch(e){return console.log("getEasifyProperties error: ",e),{}}}function Zr(e){if(!e)return!0;let t=e.querySelectorAll("[data-table-price-valid]");if(!t.length){const o=e.closest(Se);o&&(t=o.querySelectorAll("[data-table-price-valid]"))}if(!t.length)return!0;const o=Array.from(t).every((e=>"0"!==e.dataset.tablePriceValid));return o||va(o,e),o}function Yr(e){const t=document.createElement("div");t.classList.add("dimension-dropdown__error__wrapper"),t.innerHTML=e;const o=new TpoModal(t,!0);o.setOverlayClass(Ki?"in-dark-mode":"in-light-mode"),o.setModalWidth(400),o.render(),o.open()}function Kr(e,t=!1,o="",i=1){const{childImageSelector:n,firstChildImageSelector:a,firstChildImageSelectorMobile:r}=es(),s=document.querySelector(".tpo_canvas_builder");let l;if(!t||"LAST_IMAGE"!==o&&"SPECIFIC_IMAGE"!==o)l=document.querySelector(a),r.length>0&&window.matchMedia("(max-width: 959px)").matches&&(l=document.querySelector(r));else{const e=r.length>0&&window.matchMedia("(max-width: 959px)").matches?r:n,t=Array.from(document.querySelectorAll(e));l="LAST_IMAGE"===o?t?.reverse()[0]:t?.[+i-1],window.matchMedia("(max-width: 750px)").matches?(s.style.removeProperty("top"),s.style.removeProperty("left"),s.style.removeProperty("right")):(s.style.top=`${l.offsetTop}px`,s.style.left=`${l.offsetLeft}px`,1!=+i&&(s.style.right="unset"))}!function(e,t){if(!e||!t)return;const{initialWidth:o,initialHeight:i}=t.getAttrs(),n=e.offsetWidth/o,a=e.offsetHeight/i,r=Math.min(n,a);t.width(o*r+1),t.height(i*r+1),t.scale({x:r,y:r})}(l,e)}function es(e){const t=[".product__media-wrapper .product__media-list:not(.tpo_ignore)",".product-gallery__media-list:not(.tpo_ignore)",".media-gallery .media-gallery__inner:not(.tpo_ignore)",".media-gallery__viewer .media-viewer:not(.tpo_ignore)",".product-gallery .product-gallery--viewer:not(.tpo_ignore)",".product__photos .product__main-photos:not(.tpo_ignore)",".preview-card-container:not(.tpo_ignore)",".product-information__media:not(.tpo_ignore)"],o=[".product__media-wrapper .product__media-list .product__media-item.is-active",".product__photos .product__main-photos .product-main-slide.is-selected",".product-gallery__media-list .product-gallery__media.is-selected",'.product-gallery .product-gallery--viewer .product-gallery--image[data-gallery-selected="true"]','.media-gallery--carousel slideshow-container .product-media-container--image[aria-hidden="false"]',".media-gallery__grid .product-media-container--image",".media-gallery__viewer .media-viewer .media-viewer__item.is-current-variant",".media-gallery .media-gallery__inner .slider__item.is-active .product-media--image",".product__media-wrapper .product__media-list .splide__slide.is-active.is-visible"],i=[".product__thumbs .product__thumb-item:not(.tpo_ignore)",".product__media-wrapper .product__media-list .product__media-item:not(.tpo_ignore)",".media-gallery__grid .product-media-container--image:not(.tpo_ignore)",".media-gallery--carousel slideshow-container .product-media-container--image:not(.tpo_ignore)",".thumbnail-list .thumbnail-list__item .thumbnail:not(.tpo_ignore)",".product__thumb-item .product__thumb:not(.tpo_ignore)",".product-gallery--media-thumbnail:not(.tpo_ignore)",".media-thumbs__item .media-thumbs__btn:not(.tpo_ignore)",".thumbnails .slider__grid .slider__item:not(.tpo_ignore)",".thumbnail-list__item.splide__thumbnail.is-active.is-visible:not(.tpo_ignore)",".slideshow-controls__thumbnails-container .slideshow-controls__thumbnails .slideshow-control:not(.tpo_ignore)"],{livePreviewParentSelector:n,livePreviewFirstChildImageSelector:a,livePreviewFirstChildImageSelectorMobile:r,livePreviewImageThumbSelector:s,livePreviewImageThumbSelectorMobile:l}=z?.productPageSelector||{};return n&&("Sleek"!==Z&&"San Francisco"!==Z&&"Swipe"!==Z||t.shift(),t.unshift(...n.split(", "))),a&&("medicid-store.myshopify.com"!==Q&&"hisenher-com.myshopify.com"!==Q&&"jehz1u-gb.myshopify.com"!==Q||o.shift(),o.unshift(...a.split(", "))),s&&i.unshift(...s.split(", ")),{parentSelector:t,firstChildImageSelector:o,childImageSelector:[".product__media-wrapper .product__media-list .product__media-item",".product-gallery__media-list .product-gallery__media",".media-gallery__grid .product-media-container--image",".product-gallery .product-gallery--viewer .product-gallery--image",".productView-image-wrapper .productView-nav .productView-image",".rio-media-gallery .pwzrswiper-wrapper .pwzrswiper-slide",".product-gallery-container .product-gallery-mobile-container.active .gallery-slide",".product-gallery-container .product-gallery-desktop.active .gallery-image-container","product-slider .product-images__slide"],firstChildImageSelectorMobile:r?r?.split(", "):[],thumbImageSelector:i,thumbImageSelectorMobile:l?l?.split(", "):[]}}async function ts({optionSet:e,productHandle:t=h?.handle,isProductPage:o=!0,isPopupModal:i=!1}){if(!window?.Konva&&!window?.Konva?.stages||!window.TPOConfigs?.appLivePreview&&!t)return;if(1===window?.Konva?.stages.length&&!i&&!window.TPOConfigs?.appLivePreview)return;if(i&&(window?.Konva?.stages?.[0]?.destroy(),window?.Konva?.stages?.pop(),document.querySelector(".tpo_canvas_builder")?.remove()),!e||!e.options)return;const n=window.TPOConfigs?.appLivePreview?h:await Lt(t),a=[...e.options].filter((({live_preview_transform:e})=>{const t=e&&"string"==typeof e?JSON.parse(e):e;return t&&t?.enabled})),r=e?.additional_data&&"string"==typeof e?.additional_data?JSON.parse(e?.additional_data):e?.additional_data,s=r?.live_preview_background||{},l=document.createElement("div");l.classList.add("tpo_canvas_builder"),(Z.includes("Prestige")||Z.includes("Stiletto"))&&l.classList.add("tpo_canvas_custom_theme");const{parentSelector:c,firstChildImageSelector:p}=es(),d=document.querySelectorAll(c),u=document.querySelectorAll(p);if(d&&u&&s&&n&&(d.forEach((e=>e.appendChild(l))),a&&a.length>0)){d.forEach((e=>e.classList.add("tpo_canvas_wrapper")));const t=n?.variants[0]?.featured_image?.src||n?.featured_image;let o=0,i=0;const{image_url:r,overlay_mode:l,type:c,preview:p,preview_index:u}=s,m=new Konva.Stage({container:".tpo_canvas_builder"}),_=new Konva.Layer({id:"tpo_live_preview_layer"});if(function(e){const t=[],o=JSON.parse(window.TPOConfigs?.settings?.customFonts||"[]");if(!o||0===o.length)return;const i=document.createElement("style");i.id="tpo_live_preview_custom_fonts",e.forEach((e=>{const{live_preview_transform:o}=e,i=o&&"string"==typeof o?JSON.parse(o):o;i&&i?.enabled&&i.transforms.forEach((e=>{"IMAGE"!==e.type&&"custom"===e?.default_font?.type&&t.push(e.default_font.value)}))}));const n=[...new Set(t)];n.length>0&&n.forEach((e=>{if(!e)return;const t=o?.find((t=>t.name===e));t&&(i.innerHTML+=`\n @font-face {\n font-family: ${t.name};\n src: url('${t.url}')\n }\n `)})),at.appendChild(i)}(a),window.TPOConfigs?.appLivePreview)os(a,_,e);else{const s=new Konva.Layer({listening:!1}),f="CUSTOM"===c&&"OVERLAY_AFTER_FILL_VALUE"===l,y="CUSTOM"===c?r:t;Konva.Image.fromURL(y,(function(e){const t=e.image(),n=rs(_.getChildren());!f&&n||d.forEach((e=>e.classList.remove("tpo_canvas_wrapper"))),o=t.naturalWidth+1,i=t.naturalHeight+1,m.setAttrs({width:o,initialWidth:o,height:i,initialHeight:i}),Kr(m),e.setAttrs({id:"tpo_custom_background_image",x:0,y:0,overlayMode:l,preview_options:p,preview_index:u,visible:!f||n?1:0,width:o,height:i,crossOrigin:"Anonymous",listening:!1}),s.add(e),s.draw()})),m.add(s),os(a,_,e),m.add(_),function(e,t,o,i=1,n){if(!window.Konva&&!window.Konva?.stages?.[0]||!e)return;const{parentSelector:a,firstChildImageSelector:r,thumbImageSelector:s,thumbImageSelectorMobile:l}=es(),c=document.querySelector(".tpo-product-container")||document.querySelector(".product-information__media media-gallery")||document.querySelector(".product"),p=c?.classList.contains("product--stacked")||c?.classList.contains("media-gallery--grid")||c?.classList.contains("product--columns"),d=new MutationObserver((function(t){const a=window.Konva.stages?.[0]?.findOne("#tpo_live_preview_layer"),c=window.Konva.stages?.[0]?.findOne("#tpo_custom_background_image");c&&"OVERLAY_AFTER_FILL_VALUE"===c?.getAttr("overlayMode")&&!rs(a?.getChildren())&&c?.hide();const d=window.location.href.match(/variant=(\d+)/),u=d?d[1]:e.variants[0].id.toString();let m=e.variants.find((e=>e.id===+u))?.featured_image?.src,_=Z.includes("July24")?r:s;const f=!window?.GP&&window.matchMedia("(max-width: 959px)").matches||window?.GP&&window.matchMedia("(max-width: 750px)").matches;if(l.length>0&&f&&(_=l),"ALL_IMAGES"===o){let e=Array.from(document.querySelectorAll(_));if(e&&e.length>0){const t=e.findIndex((e=>as(e))),o=e[t]?.querySelector("img"),i=o?.getAttribute("data-tpo-canvas-src")||o?.getAttribute("src");m=0===t&&n||i?.split("&")[0]}const t=!!m&&(m?.startsWith("/")||m?.startsWith("http")?m:`https://${m}`);if(t){const e=new Image;e.src=t,e.crossOrigin="Anonymous",e.onload=()=>{ns(e)}}}else if("ALL_VARIANTS_IMAGES"===o){const t=e.variants.map((e=>e?.featured_image?.src)),o=document.querySelector(r);if(o){const e=o.querySelector("img"),i=e?.getAttribute("data-tpo-canvas-src")||e?.getAttribute("src");let a="";if(a=i.includes("&width")?i.match(/files\/(.*?)&/)?.[1]:i.match(/files\/(.+)/)?.[1],a&&t.some((e=>e?.includes(a)))){m=n||i?.split("&")[0];const e=!!m&&(m?.startsWith("/")||m?.startsWith("http")?m:`https://${m}`);if(e){const t=new Image;t.src=e,t.crossOrigin="Anonymous",t.onload=()=>{ns(t),window.Konva?.stages?.[0]?.show()}}}else window.Konva?.stages?.[0].hide()}}else{let e,t=0;if("FIRST_IMAGE"!==o){const n=Array.from(document.querySelectorAll(_));e="LAST_IMAGE"===o?n.reverse()[0]:n[+i-1],t="LAST_IMAGE"===o?n.length-1:+i-1}else e=document.querySelector(_);const a=e?.querySelector("img"),r=a?.getAttribute("data-tpo-canvas-src")||a?.getAttribute("src");m=r?.split("&")[0];const s=new Image;if(s.src=n||m,s.crossOrigin="Anonymous",s.onload=()=>{ns(s,p,o,i)},e&&(!p||window.matchMedia("(max-width: 750px)").matches)){let o=!0;window?.GP&&window.matchMedia("(max-width: 750px)").matches?+document.querySelector('gp-carousel[id*="gp-root-carousel"]').getAttribute("active-index")!==t&&(o=!1):o=as(e),o?window.Konva?.stages?.[0]?.show():window.Konva?.stages?.[0]?.hide()}}}));Z.includes("Prestige")&&document.querySelector(".product-gallery__thumbnail-scroller")&&d.observe(document.querySelector(".product-gallery__thumbnail-scroller"),{subtree:!0,childList:!0,attributes:!0}),d.observe(document.querySelector(a),{subtree:!0,childList:!0,attributes:!0})}(n,0,p,u,"CUSTOM"===c?r:""),function(e){const t=new Konva.Layer({id:"tpo_transformer_layer"}),o=new Konva.Transformer({id:"tpo_canvas_transformer",anchorStyleFunc:e=>{(e.hasName("top-center")||e.hasName("bottom-center"))&&(e.height(6),e.offsetY(3),e.width(20),e.offsetX(10)),(e.hasName("middle-left")||e.hasName("middle-right"))&&(e.height(20),e.offsetY(10),e.width(6),e.offsetX(3))},anchorCornerRadius:12,anchorSize:8,padding:0,flipEnabled:!1,boundBoxFunc:(e,t)=>Math.abs(t.width)<5||Math.abs(t.height)<5?e:t});t.add(o),e.add(t),e.on("click tap",(function(t){const i=t.target;if(i===e)return void o.nodes([]);const n=t.evt.shiftKey||t.evt.ctrlKey||t.evt.metaKey,a=o.nodes().indexOf(i)>=0;if(i.getAttr("allowTransform"))if(n||a){if(n&&a){const e=o.nodes().slice();e.splice(e.indexOf(i),1),o.nodes(e)}else if(n&&!a){const e=o.nodes().concat([i]);o.nodes(e)}}else{const{id:e,height:t,nodeType:n,allowTransformSizeType:a}=i.getAttrs();switch(n){case"TEXT_AREA":"DEDICATED_UNDER_TEXT_FIELD"!==a?o.enabledAnchors(["middle-left","middle-right","top-center","bottom-center","top-left","top-right","bottom-left","bottom-right"]):o.enabledAnchors(["middle-left","middle-right","top-center","bottom-center"]),i.on("transform",(n=>{switch(o.getActiveAnchor()){case"middle-left":case"middle-right":case"top-center":case"bottom-center":i.setAttrs({width:Math.max(5,i.width()*i.scaleX()),height:Math.max(t,i.height()*i.scaleY()),scaleX:1,scaleY:1}),i.setAttr("fontSize",i.getAttr("currentFontSize")||i.getAttr("inputFontSize"));break;default:if("LIVE_PREVIEW_ONLY"===a)i.setAttr("currentFontSize",i.fontSize()*Math.max(i.scaleX(),i.scaleY()));else{const t=document.getElementById(`tpo-input-change-size-${e}`),o=i.getAttr("inputFontSize")*Math.max(i.scaleX(),i.scaleY());i.setAttrs({currentFontSize:o}),t.value=o.toFixed(1)}}})),o.nodes([i]);break;case"TEXT":if(o.enabledAnchors(["top-left","top-right","bottom-left","bottom-right"]),"LIVE_PREVIEW_ONLY"!==a){const{text:t,fontFamily:o,text_align:n,maxWidthEnabled:a,maxWidth:r}=i.getAttrs();i.on("transform",(r=>{const s=document.getElementById(`tpo-input-change-size-${e}`),l=i.fontSize()*Math.max(i.scaleX(),i.scaleY()),c=ps(t,o,l,i.getLayer().getContext());a||(i.setAttrs({fontSize:l,offsetY:l/2,offsetX:"center"===n?c/2:"left"===n?0:c}),s.value=l.toFixed(1))}))}break;case"IMAGE":const n=i.getAttr("lock")?[]:["middle-left","middle-right","top-center","bottom-center"];o.enabledAnchors(["top-left","top-right","bottom-left","bottom-right",...n]),i.on("transform",(()=>{const e=i?.scaleX(),t=i?.scaleY(),o=Math.round(Math.max(5,i.width()*e)),n=Math.round(Math.max(i.height()*t));i.setAttrs({width:o,height:n,scaleX:1,scaleY:1})}))}if(i.getAttr("isNodeChildren")){o.enabledAnchors(["top-left","top-right","bottom-left","bottom-right"]);const e=i.parent;"LIVE_PREVIEW_ONLY"!==e.getAttr("allowTransformSizeType")&&e.on("transform",(t=>{const{id:o,fontFamily:i,textSize:n,textValue:a,arc:r,defaultColor:s,fontSize:l}=e.getAttrs(),c=document.getElementById(`tpo-input-change-size-${o}`),p=l*Math.max(e.scaleX(),e.scaleY());e.setAttr("fontSize",p),e.destroyChildren(),_s(e,a,i,r,n,s,p/n),c.value=p.toFixed(1)})),o.nodes([e])}else o.nodes([i])}}))}(m),window.addEventListener("resize",(()=>{Kr(m)})),window.addEventListener("click",(e=>{!function(e,t){t?.parentElement?.classList.contains("konvajs-content")||e?.findOne("#tpo_canvas_transformer")?.nodes([])}(m,e.target)}))}}}function os(e,t,o){for(const[i,n]of e.entries()){const{live_preview_transform:e}=n,a=document.querySelector(`.tpo_option-container[id*="${n.id}"]`),{image_sizing_mode:r,preview_shape:s,color_picker_link:l,color_swatch_link:c,font_picker_link:p,transforms:d,allowed_to_change_position:u,allowed_to_change_size:m,allowed_change_size_type:_}=(e&&"string"==typeof e?JSON.parse(e):e)||{},f=n.multi_select||"checkbox"===n.type?d:[...d].slice(0,1);if(!f)return;if(f.length>1){const e=new Konva.Group;f.forEach(((t,o)=>{const i=new Image;i.onload=async()=>{const s=await getImageOutline(i)||[];ss(t,n,0,i,s,e,u,m,f.length-o-1,a,r)},i.crossOrigin="anonymous",i.src=s})),t.add(e)}else{const{type:e,arc:d,max_width_enabled:y,max_width:h}=f?.[0];switch(e){case"IMAGE":const e=new Image;e.onload=async()=>{const o=await getImageOutline(e)||[];ss(f[0],n,0,e,o,t,u,m,i,a,r)},e.crossOrigin="anonymous",e.src=s;break;case"TEXT":const g=[l,c,p];y&&h?ms(f[0],n,o,g,t,u,m,_,i,a):d&&0!==parseInt(d)?fs(f[0],n,o,g,t,u,m,_,i,a):us(f[0],n,o,g,t,u,m,_,i,a);break;case"TEXT_AREA":const b=[l,c,p];ys(f[0],n,o,b,t,u,m,_,i,a)}}}}async function is({optionSet:e,isPopupModal:t=!1}){const o=0===at.querySelectorAll('script[src="https://cdn.shopify.com/s/files/1/0748/6904/7603/files/konva.min.js?v=1742044331"]')?.length;if(o&&"fjckPiAzNHI1MzwtMzo="===window.TPOConfigs.app){const t=document.createElement("script");t.async=!0,t.src="https://cdn.shopify.com/s/files/1/0748/6904/7603/files/konva.min.js?v=1742044331",t.onload=async function(){await ts({optionSet:e})},at.appendChild(t)}else o||!window.TPOConfigs?.appLivePreview&&!t?rt?.querySelectorAll('script[src="https://cdn.shopify.com/s/files/1/0748/6904/7603/files/konva.min.js?v=1742044331"]')?.length&&await ts({optionSet:e}):await ts({optionSet:e,isPopupModal:t})}function ns(e,t=!1,o="",i=1){const n=e.naturalWidth,a=e.naturalHeight;window.Konva.stages?.[0]?.setAttrs({initialWidth:n,initialHeight:a});const r=window.Konva.stages?.[0]?.findOne("#tpo_custom_background_image");r?.setAttrs({image:e,width:n,height:a}),Kr(window.Konva.stages?.[0],t,o,i)}function as(e){return"Sleek"===Z||"xdjbj4-zb.myshopify.com"===Q?e&&e?.classList.contains("swiper-slide-thumb-active"):"Debut"===Z?e&&!e?.classList.contains("hide"):"Palo Alto"===Z?e&&(e?.classList.contains("is-selected")||e?.classList.contains("is-nav-selected")):e&&e?.classList.contains("slick-slide")&&!e.classList.contains("tpo_ignore")?e?.classList.contains("slick-current"):e&&e?.classList.contains("swiper-slide")?e?.classList.contains("swiper-slide-active"):window?.GP&&e?"active"===e?.getAttribute("data-outline"):e&&("true"===e?.getAttribute("aria-current")||e?.classList.contains("is-selected")||e?.classList.contains("is-nav-selected")||e?.classList.contains("active-slide")||e?.classList.contains("swiper-slide-active")||e?.classList.contains("is-active")||"active"===e?.getAttribute("data-outline")||e?.classList.contains("active")||e?.classList.contains("active-thumb")||e?.classList.contains("tpo-isactive-image")||e?.classList.contains("is-current-variant")||e?.classList.contains("animation--product-media")||e?.classList.contains("pwzrswiper-slide-active")||"true"===e?.getAttribute("data-active")||"false"===e?.getAttribute("aria-hidden")||"true"===e?.getAttribute("aria-selected")||"true"===e?.getAttribute("data-gallery-selected"))}function rs(e){return!!e&&e.filter((e=>"tpo_canvas_transformer"!==e.id())).some((e=>{if("group"===e.getType().toLowerCase())return"text"===e.getAttr("optionType")?e.getAttr("visible")&&e.getChildren().length>0:e.getChildren().some((e=>{const{visible:t}=e.getAttrs();return t}));{const{optionType:t,visible:o,text:i}=e.getAttrs();return"image"===t&&o||"text"===t&&i&&o}}))}function ss(e,t,o,i,n,a,r,s=!1,l,c,p){let d=[],u=!1,m="",_=ao;const f=["jpg","jpeg","jpe","jfif","jif","jfi","png","gif","webp","tiff","tif","raw","bmp","heif","svg"],{id:y,option_types:h,multi_select:g,type:b,metadata:v,is_in_group:w}=t,{getParams:S}=function(e){const{mode:t="FIT"}=e,o=(e,t)=>{const o=e.width,i=e.height*(t.width/o),n=t.width;return[0,(t.height-i)/2,n,i]},i=(e,t)=>{const o=e.width,i=e.height,n=t.height/i,a=t.height,r=o*n;return[(t.width-r)/2,0,r,a]},n={COVER:(e,t)=>{const o=function(e,t,o="center-middle"){const i=t.width,n=t.height,a=i/n;let r,s;a>=e.width/e.height?(r=e.width,s=e.width/a):(r=e.height*a,s=e.height);let l=0,c=0;return"left-top"===o?(l=0,c=0):"left-middle"===o?(l=0,c=(e.height-s)/2):"left-bottom"===o?(l=0,c=e.height-s):"center-top"===o?(l=(e.width-r)/2,c=0):"center-middle"===o?(l=(e.width-r)/2,c=(e.height-s)/2):"center-bottom"===o?(l=(e.width-r)/2,c=e.height-s):"right-top"===o?(l=e.width-r,c=0):"right-middle"===o?(l=e.width-r,c=(e.height-s)/2):"right-bottom"===o?(l=e.width-r,c=e.height-s):"scale"===o?(l=0,c=0,r=i,s=n):console.error(new Error("Unknown clip position property - "+o)),{x:l,y:c,width:r,height:s}}({width:e?.width||0,height:e?.height||0},{width:t?.width||0,height:t?.height||0});return[o.x,o.y,o.width,o.height,0,0,t?.width,t?.height]},FIT:(e,t)=>t.width/t.height>=e.width/e.height?i(e,t):o(e,t),FIT_WIDTH:o,FIT_HEIGHT:i,FILL:(e,t)=>[0,0,t.width,t.height]};return{getParams:(e,o)=>(n?.[t]||n.FIT)(e,o)}}({mode:p}),E=window.Konva.stages[0]?.findOne("#tpo_custom_background_image"),{overlayMode:$}=E?.getAttrs()||{},C=c?.classList?.contains("tpo_hidden")||c?.parentElement?.closest(".tpo_option-container")?.classList?.contains("tpo_hidden"),x=JSON.parse(v||"{}"),{id:k,x_axis:L,y_axis:q,rotate:T,width:O,height:A,lock_points:N}=e,P="product-list"!==b?`${y}`:`${y} ${b}-${y} ${b}-${k}`;if("switch"===b){if(d=h[0],u=t?.switch_value,m=x?.image_canvas_url||x?.switchImageUrl,!m)return}else"file-upload"===b?u=!1:"design-layer"===b?(u=!0,m=x?.image_canvas_url||e?.image_url):(d=g||"checkbox"===b?h.filter((e=>e.id===k))[0]:h.filter((e=>e.is_default))[0],u=d?.is_default,m=d?.image_canvas_url||d?.image_url);u&&!C&&"OVERLAY_AFTER_FILL_VALUE"===$&&E.show(),Konva.Image.fromURL(m||_,(function(e){if(e.setAttrs({id:g||"checkbox"===b?k:y,name:P,x:+L,y:+q,width:+O,height:+A,visible:u&&!C?1:0,isSelected:u?1:0,rotation:+T,nodeType:"IMAGE",nodeIndex:l,optionType:"image",lock:N,draggable:r,allowTransform:s,crossOrigin:"Anonymous"}),w){const t=c?.parentElement?.closest(".tpo_option-container").getAttribute("id").split(",")[1];e.setAttr("groupId",t)}"design-layer"===b&&e.setAttr("listening",!1),e.sceneFunc(((e,t)=>{const o=t.image();if(o&&f.some((e=>o.getAttribute("src").includes(e)))&&i){const a=t.width()*t.scaleX(),r=t.height()*t.scaleY(),s=i.width/a,l=i.height/r,c=S(o,{width:a,height:r}),p=[o].concat(c);e.beginPath();for(const[t,o]of n?.entries()){const i=o?.x/s,n=o?.y/l;0===t?e.moveTo(i,n):e.lineTo(i,n)}e.clip(),e.fillStrokeShape(t),o&&e.drawImage.apply(e,p)}})),e.on("dragend",(()=>{$s()})),a.add(e),e.zIndex(l),a.draw(),$s()}))}function ls(e,t,o,i=""){if(!window.Konva&&!window.Konva?.stages?.[0])return;const n=e?.includes(",")?e.split(",")[1]:e,a=window.Konva.stages[0]?.find(`#${n}`);if(!a||0===a.length)return;const r=window.Konva.stages[0]?.findOne("#tpo_live_preview_layer"),s=window.Konva.stages[0]?.findOne("#tpo_custom_background_image"),{overlayMode:l,visible:c,preview_options:p,preview_index:d}=s?.getAttrs()||{},u=window.Konva.stages[0]?.findOne("#tpo_canvas_transformer");u?.nodes([]);let m=t;"FILE_UPLOAD"===i&&t&&(m=t.replace(Q,G).replace(/\.[^/.]+$/,(e=>e.toLowerCase())));const _="oleole-art.myshopify.com"===Q?{}:{opacity:0,duration:.1,easing:Konva.Easings.EaseOut};a.forEach((e=>{const t=new Image;t.src=m||ao,t.crossOrigin="Anonymous",t.onload=()=>{o?e.to({..._,onFinish:()=>{e.image(t),e.visible(!0),"oleole-art.myshopify.com"!==Q&&e.to({opacity:1,duration:.15,easing:Konva.Easings.EaseIn}),e.setAttr("isSelected",!0),e.zIndex(e.getAttr("nodeIndex")),"OVERLAY_AFTER_FILL_VALUE"===l&&!c&&rs(r.getChildren())&&s.show(),function(e,t){if(("Impulse"===Z||"Showcase"===Z||"Swipe"===Z)&&("FIRST_IMAGE"===e||"LAST_IMAGE"===e||"SPECIFIC_IMAGE"===e)){let o,i;i="Impulse"===Z?".product__thumbs--scroller .product__thumb-item .product__thumb":"Swipe"===Z?window.matchMedia("(max-width: 750px)").matches?".product__media-list .product__media-item":".product__media-sublist .product__media-subitem":window.matchMedia("(max-width: 750px)").matches?".theme-images .theme-img":".product-area__thumbs .product-area__thumbs__thumb";const n=Array.from(document.querySelectorAll(i)),a=n.findIndex((e=>"Impulse"===Z?e.classList.contains("is-active"):"Swipe"===Z?window.matchMedia("(max-width: 750px)").matches?e.classList.contains("swiper-slide-active"):e.classList.contains("swiper-slide-thumb-active"):window.matchMedia("(max-width: 750px)").matches?e.classList.contains("swiper-slide-active"):e.querySelector("a").classList.contains("thumb-active")));switch(e){case"LAST_IMAGE":o=n.length-1;break;case"SPECIFIC_IMAGE":o=t-1;break;default:o=0}if(a!==o||a===o&&0===o)if("Impulse"===Z)n[o].dispatchEvent(new Event("click"));else if("Swipe"===Z){const e=document.querySelector(".product__slider-nav .swiper-button-next"),t=document.querySelector(".product__slider-nav .swiper-button-prev");for(let i=0;io?t.dispatchEvent(new Event("click")):e.dispatchEvent(new Event("click"));window.matchMedia("(max-width: 750px)").matches&&document.querySelector(".product__main .product__media-wrapper")?.scrollIntoView({behavior:"smooth",block:"center",inline:"nearest"})}else if(window.matchMedia("(max-width: 750px)").matches){const e=document.querySelector(".theme-viewport .swiper-button-next"),t=document.querySelector(".theme-viewport .swiper-button-prev");for(let i=0;io?t.dispatchEvent(new Event("click")):e.dispatchEvent(new Event("click"));document.querySelector(".theme-viewport .theme-images")?.scrollIntoView({behavior:"smooth",block:"start",inline:"nearest"})}else{const e=Array.from(document.querySelectorAll('.theme-viewport .theme-images .theme-img[aria-hidden="false"]'))[o];e?.scrollIntoView({behavior:"smooth",block:"start",inline:"nearest"})}}}(p,d),$s()}}):e.to({..._,onFinish:()=>{e.image(t),e.visible(!1),e.setAttr("isSelected",!1),"OVERLAY_AFTER_FILL_VALUE"===l&&c&&!rs(r.getChildren())&&s.hide(),$s()}})}}))}function cs(e){return e.split(",").map((e=>{const t=(e=e.trim()).indexOf(" ")>=0,o=e.indexOf('"')>=0||e.indexOf("'")>=0;return t&&!o&&(e=`"${e}"`),e})).join(", ")}function ps(e,t,o,i){i.save(),i.font=[`${o}px`,cs(t)].join(" ");const{width:n}=i?.measureText([" ",e," "].join(""));return i?.restore(),n}function ds(t,o,i,n=!1,a){const r=document.createElement("div");r.classList.add("tpo-input-changeLivePreviewSize-wrapperContainer");const c=document.createElement("div"),p=document.createElement("p");Object.assign(p,{className:"tpo-input-change-size-title",innerHTML:`\n ${l["Font size"]&&l["Font size"][s]||"Font size"}\n `}),c.classList.add("tpo-input-changeLivePreviewSize-wrapper");const d=document.createElement("input");Object.assign(d,{id:`tpo-input-change-size-${t}`,className:"tpo_option-input tpo-input-change-livePreview-size",type:"number",value:n?a%1==0?a:a.toFixed(1):15*+i,step:"any",min:0,autocomplete:"off",ariaLabel:"Font size"}),d.addEventListener("input",(e=>{hs(t,"id",e.target.value,!0,"SIZE")}));const u=document.createElement("span");Object.assign(u,{className:"tpo-change-livePreview-size-btn",innerHTML:'\n \n ',onclick:()=>{const e=parseFloat(d.value)+1;hs(t,"id",e,!0,"SIZE"),d.value=e%1==0?e:e.toFixed(1).toString(),m.removeAttribute("disabled")}});const m=document.createElement("span");Object.assign(m,{className:"tpo-change-livePreview-size-btn",innerHTML:'\n \n ',onclick:()=>{const o=parseFloat(d.value)-1;o>=0&&(hs(t,"id",o,!0,"SIZE"),d.value=o%1==0?o:o.toFixed(1).toString()),0===o&&e.target.setAttribute("disabled",!0)}}),c.append(m,d,u),r.append(p,c),o?.appendChild(r)}function us(e,t,o,i,n,a,r=!1,s,l,c){const{id:p,x_axis:d,y_axis:u,rotate:m,arc:_,opacity:f,size:y,text:h,default_color:g,default_font:b,text_align:v="center"}=e,{default_value:w,is_in_group:S}=t,E=window.Konva.stages[0]?.findOne("#tpo_custom_background_image"),{overlayMode:$}=E?.getAttrs()||{},C=w||h||"";let x="none";try{const e="string"==typeof t.metadata?JSON.parse(t.metadata):t.metadata;x=e?.type_letter||"none"}catch(e){console.warn("Could not parse metadata",e)}const k=function(e,t){switch(t){case"lowercase":return e.toLowerCase();case"uppercase":return e.toUpperCase();case"capitalize_each_word":return e.toLowerCase().replace(/(^|\s)([a-zA-Z\u00C0-\u1EF9])/g,(e=>e.toUpperCase()));case"sentence_case":return e.charAt(0).toUpperCase()+e.slice(1).toLowerCase();default:return e}}(C,x),L=c?.classList?.contains("tpo_hidden")||c?.parentElement?.closest(".tpo_option-container")?.classList?.contains("tpo_hidden"),q=i.map((e=>e?.enabled&&e?.data)).join(" "),{type:T,value:O}=b||{},A=n.getContext();let N=null;const P=i[1]?.enabled?i[1]?.data:null;if(P){const e=o?.options.find((e=>e.id===P));N=1!==e?.multi_select?e?.option_types.find((e=>e.is_default))?.color_code?.trim()?.replace(",",""):null}!L&&"OVERLAY_AFTER_FILL_VALUE"===$&&k&&E.show(),r&&s&&"LIVE_PREVIEW_ONLY"!==s&&ds(p,c,y);const M=new Konva.Text;M.setAttrs({id:p,name:q,x:+d,y:+u,visible:L?0:1,fill:N??g,defaultColor:g,fontFamily:O||"Roboto",defaultFont:O||"Roboto",initialText:k,text:k,rotation:+m,scaleFontSize:+y,arc:+_,fontSize:15*+y,nodeType:"TEXT",nodeIndex:l,optionType:"text",allowTransform:r&&"DEDICATED_UNDER_TEXT_FIELD"!==s,allowTransformSizeType:s,draggable:a,text_align:v,offsetY:15*+y/2,opacity:+f/100}),"giginyork.myshopify.com"===Q&&M.setAttr("letterSpacing",7);const F=O||"Roboto",j=({textWidth:e})=>{const t={left:0,center:e/2,right:e};return t?.[v]};if(M.on("dragend",(()=>{$s()})),S){const e=c?.parentElement?.closest(".tpo_option-container").getAttribute("id").split(",")[1];M.setAttr("groupId",e)}if(O)WebFont.load({[T]:{families:[O]},fontactive:()=>{const e=ps(k,F,15*+y,A);M.setAttr("offsetX",j({textWidth:e}))}});else{const e=ps(k,F,15*+y,A);M.setAttr("offsetX",j({textWidth:e}))}n.add(M),M.zIndex(l),n.draw(),$s()}function ms(e,t,o,i,n,a,r=!1,s,l,c){const{id:p,x_axis:d,y_axis:u,rotate:m,size:_,text:f,opacity:y,default_color:h,default_font:g,text_align:b="center",max_width_enabled:v,max_width:w}=e,{default_value:S,is_in_group:E}=t,$=window.Konva.stages[0]?.findOne("#tpo_custom_background_image"),{overlayMode:C}=$?.getAttrs()||{},x=S||f||"";let k="none";try{const e="string"==typeof t.metadata?JSON.parse(t.metadata):t.metadata;k=e?.type_letter||"none"}catch(e){console.warn("Could not parse metadata",e)}const L=function(e,t){switch(t){case"lowercase":return e.toLowerCase();case"uppercase":return e.toUpperCase();case"capitalize_each_word":return e.toLowerCase().replace(/(^|\s)([a-zA-Z\u00C0-\u1EF9])/g,(e=>e.toUpperCase()));case"sentence_case":return e.charAt(0).toUpperCase()+e.slice(1).toLowerCase();default:return e}}(x,k),q=c?.classList?.contains("tpo_hidden")||c?.parentElement?.closest(".tpo_option-container")?.classList?.contains("tpo_hidden"),T=i.map((e=>e?.enabled&&e?.data)).join(" "),{type:O,value:A}=g||{},N=n.getContext();let P=null;const M=i[1]?.enabled?i[1]?.data:null;if(M){const e=o?.options.find((e=>e.id===M));P=1!==e?.multi_select?e?.option_types.find((e=>e.is_default))?.color_code?.trim()?.replace(",",""):null}!q&&"OVERLAY_AFTER_FILL_VALUE"===C&&L&&$.show();const F=new Konva.Text({id:p,name:T,x:+d,y:+u,visible:q?0:1,fill:P??h,defaultColor:h,fontFamily:A||"Roboto",defaultFont:A||"Roboto",initialText:L,text:L,rotation:+m,scaleFontSize:+_,nodeType:"TEXT",nodeIndex:l,optionType:"text",allowTransform:!1,draggable:a,allowedToChangeSize:r,align:b,opacity:+y/100,width:+w,maxWidth:+w,maxWidthEnabled:v}),j=A||"Roboto",I=({textWidth:e})=>{const t={left:0,center:e/2,right:e};return t?.[b]};if(E){const e=c?.parentElement?.closest(".tpo_option-container").getAttribute("id").split(",")[1];F.setAttr("groupId",e)}if(A)WebFont.load({[O]:{families:[A]},fontactive:()=>{const e=ps(L,j,15*+_,N),t=e>+w?+w/e*15*+_:15*+_;F.setAttr("fontSize",t),F.setAttr("offsetX",I({textWidth:+w||e})),F.setAttr("offsetY",F.height()/2),F.setAttr("initialOffsetY",F.height()/2),r&&s&&"LIVE_PREVIEW_ONLY"!==s&&(F.setAttr("initialFontSize",t.toFixed(1)),ds(p,c,_,!0,t))}});else{const e=ps(L,j,15*+_,N),t=e>+w?+w/e*15*+_:15*+_;F.setAttr("fontSize",t),F.setAttr("offsetX",I({textWidth:+w||e})),F.setAttr("offsetY",F.height()/2),F.setAttr("initialOffsetY",F.height()/2),r&&s&&"LIVE_PREVIEW_ONLY"!==s&&(F.setAttr("initialFontSize",t.toFixed(1)),ds(p,c,_,!0,t))}n.add(F),F.zIndex(l),n.draw(),$s()}function _s(e,t,o,i,n,a,r=15){if(!t)return;const s=Ft.includes(Q)?t.split("").reverse().join(""):t,l=function(e="",t,o){const i=document.createElement("canvas").getContext("2d");return i.font=`${t}px ${o}`,[...e].map((e=>i.measureText(e).width))}(s,n*r,o),c=l.reduce(((e,t)=>e+t),0),p=Math.abs(i),d=100*c/(2*Math.PI*p),u=i>=0?1:-1,m=u*(d-d/c);let _=-c/(2*d);s.split("").forEach(((t,i)=>{const c=l[i],p=_+c/(2*d),f=d*Math.sin(p),y=m-u*d*Math.cos(p);_+=c/d;const h=new Konva.Text({x:f,y,fill:a,defaultColor:a,fontFamily:o,defaultFont:o,initialText:s,text:t,isNodeChildren:!0,offsetX:c/2,rotation:u*(180*p)/Math.PI,scaleFontSize:+n,fontSize:+n*r,offsetY:+n*r/2,allowTransform:e.getAttr("allowTransform"),align:"center",opacity:e.getAttr("textOpacity")});e.add(h)}))}function fs(e,t,o,i,n,a,r=!1,s,l,c){const{id:p,x_axis:d,y_axis:u,rotate:m,arc:_,opacity:f,size:y,text:h,default_color:g,default_font:b}=e,{default_value:v,is_in_group:w}=t,S=window.Konva.stages[0]?.findOne("#tpo_custom_background_image"),{overlayMode:E}=S?.getAttrs()||{},$=v||h||"";let C="none";try{const e="string"==typeof t.metadata?JSON.parse(t.metadata):t.metadata;C=e?.type_letter||"none"}catch(e){console.warn("Could not parse metadata",e)}const x=function(e,t){switch(t){case"lowercase":return e.toLowerCase();case"uppercase":return e.toUpperCase();case"capitalize_each_word":return e.toLowerCase().replace(/(^|\s)([a-zA-Z\u00C0-\u1EF9])/g,(e=>e.toUpperCase()));case"sentence_case":return e.charAt(0).toUpperCase()+e.slice(1).toLowerCase();default:return e}}($,C),{type:k,value:L}=b||{},q=i.map((e=>e?.enabled&&e?.data)).join(" ");let T=null;const O=i[1]?.enabled?i[1]?.data:null;if(O){const e=o?.options.find((e=>e.id===O));T=1!==e?.multi_select?e?.option_types.find((e=>e.is_default))?.color_code?.trim()?.replace(",",""):null}const A=c?.classList?.contains("tpo_hidden")||c?.parentElement?.closest(".tpo_option-container")?.classList?.contains("tpo_hidden");!A&&"OVERLAY_AFTER_FILL_VALUE"===E&&x&&S.show(),r&&s&&"LIVE_PREVIEW_ONLY"!==s&&ds(p,c,y);const N=new Konva.Group({id:p,name:q,x:+d,y:+u,visible:A?0:1,nodeType:"TEXT",nodeIndex:l,optionType:"text",rotation:+m,arc:_,fontSize:15,textOpacity:+f/100,textSize:+y,initialText:x,textValue:x,fontFamily:L||"Roboto",defaultColor:g,allowTransform:r,allowTransformSizeType:s,draggable:a});if(w){const e=c?.parentElement?.closest(".tpo_option-container").getAttribute("id").split(",")[1];N.setAttr("groupId",e)}N.on("dragend",(()=>{$s()})),L?WebFont.load({[k]:{families:[L]},fontactive:()=>{_s(N,x,L,_,y,T??g)}}):_s(N,x,"Roboto",_,y,T??g),n.add(N),N.zIndex(l),n.draw(),$s()}function ys(e,t,o,i,n,a,r=!1,s,l,c){const{id:p,x_axis:d,y_axis:u,rotate:m,width:_,height:f,size:y,text:h,opacity:g,text_align:b,default_color:v,default_font:w}=e,{default_value:S,is_in_group:E}=t,$=window.Konva.stages[0]?.findOne("#tpo_custom_background_image"),{overlayMode:C}=$?.getAttrs()||{},x=S||h||"",k=c?.classList?.contains("tpo_hidden")||c?.parentElement?.closest(".tpo_option-container")?.classList?.contains("tpo_hidden"),L=i?.map((e=>e?.enabled&&e?.data)).join(" ");let q=null;const T=i[1]?.enabled?i[1]?.data:null;if(T){const e=o?.options.find((e=>e.id===T));q=1!==e?.multi_select?e?.option_types.find((e=>e.is_default))?.color_code?.trim()?.replace(",",""):null}const{type:O,value:A}=w||{};!k&&"OVERLAY_AFTER_FILL_VALUE"===C&&x&&$.show(),r&&s&&"LIVE_PREVIEW_ONLY"!==s&&ds(p,c,y);const N=new Konva.Text({id:p,name:L,perfectDrawEnabled:!1,x:+d,y:+u,visible:k?0:1,fill:q??v,defaultColor:v,width:_,height:f,initialText:x,text:x,align:b,opacity:+g/100,rotation:+m,scaleFontSize:+y,fontSize:15*+y,inputFontSize:15*+y,nodeType:"TEXT_AREA",nodeIndex:l,optionType:"text",allowTransform:r,allowTransformSizeType:s,draggable:a});if(E){const e=c?.parentElement?.closest(".tpo_option-container").getAttribute("id").split(",")[1];N.setAttr("groupId",e)}N.on("dragend",(()=>{$s()})),A?WebFont.load({[O]:{families:[A]},fontactive:()=>{N.setAttrs({fontFamily:A,defaultFont:A})}}):N.setAttrs({fontFamily:"Roboto",defaultFont:"Roboto"}),n.add(N),N.zIndex(l),n.draw(),$s()}function hs(e,t,o,i,n){if(!window.Konva||!1===i)return;const a=e.includes(",")?e.split(",")[1]:e,r="id"===t?"#":".",s=window.Konva.stages[0]?.find(`${r+a}`);if(!s||0===s.length)return;const l=window.Konva.stages[0]?.findOne("#tpo_live_preview_layer"),c=window.Konva.stages[0]?.findOne("#tpo_custom_background_image"),{overlayMode:p}=c?.getAttrs()||{},d=window.Konva.stages[0]?.findOne("#tpo_canvas_transformer");d?.nodes([]),s.forEach((e=>{const t=e.getLayer().getContext(),{id:i,fontSize:a,initialFontSize:r,maxWidth:s,maxWidthEnabled:d,scaleFontSize:u,fontFamily:m,arc:_,initialText:f,nodeType:y,text_align:h,nodeIndex:g,textSize:b,defaultColor:v,defaultFont:w,initialOffsetY:S,text:E,allowedToChangeSize:$}=e.getAttrs();switch(e.zIndex(g),n){case"TEXT":const n=o||f;if(d&&s){const l=a>15*+u?a:15*+u,c=ps(n,m,l,t),p=c>s?s/c*l:l;if(e.setAttrs({text:n,fontSize:o?p:r,offsetY:c>s?e.height()/2:S}),$){const e=document.getElementById(`tpo-input-change-size-${i}`),t=o?e.value>p&&c<=s?e.value:p:r;document.getElementById(`tpo-input-change-size-${i}`).value=t%1==0?t:(+t).toFixed(1)}}else if(_&&0!==_)e.setAttr("textValue",n),e.destroyChildren(),_s(e,n,m,_,b,v);else{const o=ps(n,m,a,t),i={left:0,center:o/2,right:o};e.setAttrs({text:n,offsetX:"TEXT"===y?i?.[h]:0})}n||"OVERLAY_AFTER_FILL_VALUE"!==p||rs(l.getChildren())?c.show():c.hide();break;case"FONT":const g=o?.name||w||m;if(d&&s){const n=a>15*+u?a:15*+u,l=ps(E,g,n,t),c=l>s?s/l*n:n;if(e.setAttrs({fontSize:c,fontFamily:g,offsetY:l>s?e.height()/2:S}),$){const e=document.getElementById(`tpo-input-change-size-${i}`),t=o?e.value>c&&l<=s?e.value:c:r;document.getElementById(`tpo-input-change-size-${i}`).value=t%1==0?t:(+t).toFixed(1)}}else if(_&&0!==_){const{textValue:t}=e.getAttrs();e.setAttr("fontFamily",g),e.destroyChildren(),_s(e,t,g,_,b,v)}else{const o=ps(E,g,a,t),i={left:0,center:o/2,right:o};e.setAttrs({fontFamily:g,offsetX:"TEXT"===y?i?.[h]:0})}break;case"COLOR":if("image"===e.getAttr("optionType"))return;const C=o?o.trim().replace(",",""):v;if(_&&0!==_){const t=e.getChildren();e.setAttr("defaultColor",C),t?.forEach((e=>e.setAttr("fill",C)))}else e.setAttr("fill",C);break;case"SIZE":const{textValue:x}=e.getAttrs(),k=parseFloat(o);if(d&&s)if(ps(E,m,k,t)<=+s)e.setAttr("fontSize",k);else{const o=ps(E,m,a,t);if(o+ps(" ",m,a,t)>s)return;e.setAttr("fontSize",+s/o*a)}else if(_&&0!==_)e.setAttr("fontSize",k),e.destroyChildren(),_s(e,x,m,_,b,v,k/b);else if("TEXT"===y){const o=ps(E,m,k,t);e.setAttrs({fontSize:k,offsetY:k/2,offsetX:"center"===h?o/2:"left"===h?0:o})}else e.setAttrs({fontSize:k,inputFontSize:k,scale:{x:1,y:1}})}})),$s()}function gs(e,t,o){if(!window.Konva)return;const i=o?".":"#",n=document.querySelector(`[id*='${e}']`)?.classList.contains("tpo_hidden)"),a=e.includes(",")?e.split(",")[1]:e;let r=[];if(r=e.includes("group")?window.Konva?.stages[0]?.find((e=>e?.getAttr("groupId")===a)):window.Konva?.stages[0]?.find(`${i+a}`),!r)return;const s=window.Konva.stages[0]?.findOne("#tpo_live_preview_layer"),l=window.Konva.stages[0]?.findOne("#tpo_custom_background_image"),{overlayMode:c,visible:p}=l?.getAttrs()||{};r.forEach((e=>{const o=e?.getAttr("isSelected"),i=e.getAttr("optionType"),a=!!e?.getAttr("groupId")&&document.querySelector(`[id*='${e.getAttr("id")}']`)?.classList.contains("tpo_hidden");"show"!==t||"image"===i&&!o||n||a?(e.setAttr("visible",!1),"OVERLAY_AFTER_FILL_VALUE"===c&&p&&!rs(s.getChildren())&&l.hide()):(e.setAttr("visible",!0),"OVERLAY_AFTER_FILL_VALUE"===c&&!p&&rs(s.getChildren())&&l.show())})),$s()}function bs(e,t){if(!e)return;let o=0;const i=document.querySelectorAll(_e[t]),n=[];e.filter(((e,t)=>e.featured_image.url?!e.properties?._tpo_add_on_key||e.properties?.[Ss()]?(n.push(i[o]),o++,e):void o++:e.properties?._tpo_add_on_key?void 0:(n.push(void 0),e))).forEach(((e,t)=>{if(!e)return;Object.keys(e?.properties).some((e=>e?.includes("_tpo")));const o=e?.properties?.[Ss()];if(o){const e=document.querySelectorAll(`[href="${o}"]:not(.tpo_ignore)`);!function(e){const t=document.querySelectorAll([".product-option dt",".product-option span",".cart__item--properties span"]);for(let o of t)o.textContent.includes(e)&&o.remove()}(Ss()),n[t]&&!Ze&&(n[t].src=o,n[t].srcset=o),e.forEach((e=>{e.innerHTML=Ss()}))}}))}if(Hr&&(Hr.onclick=async function(){setTimeout((async function(){if(!Hr.querySelector(".rbr-loader"))return;window.stop();let e=await Ua();const t=e.items.findIndex((e=>e.product_id==h?.id));if(t<0)return;const o=e.items[t].key,i=Hr.closest(".product__info-container").querySelectorAll(["input","textarea"]),n={};i.forEach(((e,t)=>{const o=e?.name,i=e?.value;if(i&&o&&o.includes("properties")){const e=o.slice(11,-1);n[e]=i}}));const a={id:o,properties:n};await fetch("/cart/change.js",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)}),window.location.reload()}),1e3)}),(Z.includes("Prestige")||Z.includes("Impact"))&&function(){if(!_)return;z.productPageSelector?.variants&&(B=[...B,z.productPageSelector.variants]);const e=document.querySelector(B);if(e){const t=e.querySelectorAll('input[type="radio"]');t.length>0&&Array.from(t).forEach((e=>{e.addEventListener("change",(()=>{setTimeout((()=>{document.querySelector(".tpo_option-set-container")||Kt()}),500)}))}))}}(),ln){const e=await Ua();bs(e?.items,"CART")}async function vs(e){if(window?.Konva?.stages?.[0]){window?.Konva?.stages?.[0]?.show();const t=window?.Konva?.stages?.[0]?.findOne("#tpo_canvas_transformer"),o=window?.Konva?.stages[0]?.findOne("#tpo_live_preview_layer");t?.visible(!1);const i=window?.Konva?.stages?.[0]?.toDataURL();t?.visible(!0);const n=rs(o.getChildren());try{const t=function(e){let t=e.split(","),o=t[0].match(/:(.*?);/)[1],i=atob(t[t.length-1]),n=i.length,a=new Uint8Array(n);for(;n--;)a[n]=i.charCodeAt(n);return new File([a],"live-preview-image.png",{type:o})}(i),o=new DataTransfer;o.items.add(t);let a=e.querySelector(`input[name="${Es()}"]`);if(a||(a=document.createElement("input"),a.setAttribute("type","file"),a.setAttribute("hidden","true"),a.setAttribute("name",Es())),a&&!n)return void a.remove();a.files=o.files,e.appendChild(a)}catch(e){console.error(e)}}}async function ws({body:e,mainProduct:t,formData:o,cartAddUrl:i="/cart/add.js"}){if(!o.has(Es()))return[null,await fetch(i,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...e})})];const n=e?.items?.find((e=>e?.id===t?.id));if(n){const t=function(e={},t=new FormData){const o=new FormData;for(const t of Object.keys(e))if("properties"!==t){const i=e?.[t];if(Array.isArray(i))for(const e of i)o.append(`${t}[]`,e);else o.append(t,i)}else for(const t of Object.keys(e?.properties)){const i=e?.properties?.[t];o.append(`properties[${t}]`,i)}return t.has(Es())&&o.append(Es(),t.get(Es())),o}(n,o),a=await fetch("/cart/add",{method:"POST",headers:{"X-Requested-With":"XMLHttpRequest",Accept:"application/json"},body:t}),r=await a.json(),s=e?.items?.map((e=>r?.id==e?.id?{...e,properties:r?.properties||e?.item}:{...e})),l=await fetch("/cart/update.js",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({updates:{[r.id]:"0"}})});return await l.json(),[null,await fetch(i,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...e,items:s||[]})})]}return[]}function Ss(){return Qe?"_Preview":ii||"Preview"}function Es(){return`properties[${Ss()}]`}function $s(){un()}"function"==typeof window?.subscribe&&"fjckPiAzNHI1MzwtMzo="===window?.TPOConfigs?.app&&window?.subscribe("cart-update",(async e=>{if("cart-items"===e?.source)return;const t=await Ua();bs(t?.items,"DRAWER")}))}})();